@xopcai/xopc 0.0.263 → 0.0.264
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/README.md +1 -0
- package/README.zh-CN.md +1 -0
- 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-C3PGOKZ2.js → activity-store-BYBCpt7_.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CGfZj39N.js → agent-avatar-dicebear-D20aBHPJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BEfQ37Md.js → agent-defaults-settings-panel-BZvMqNrU.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-D04Sobl9.js → agents-6foBELwt.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B9Ujaa2n.js → api-YbtjDbuG.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BPHAGj40.js → app-management-settings-panel-4ps1RrDU.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-1c8VsdQr.js → appearance-settings-C7nBHnkG.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CRuJkEs4.js → apps-page-B_g-rL5b.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BO0zh3JH.js → archive-plugin-DfKK1iJO.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-hM6hZczY.js → attachment-load-BOU1pdnQ.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DQFZUB4m.js → automations-page-BePzexAH.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-B4Rm1r01.js → automations-workspace-7-m5pBEZ.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BycS7-SL.js → binary-plugins-Cly8XDyt.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BKWv_VZ-.js → block-editor-DzSu62js.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C5CkGZTi.js → browser-automation-inputs-8bHj7Fv2.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CH1MCd_B.js → browser-automations-page-CzL7Aj2k.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-C6fxxddT.js → browser-settings-page-Dum3mTiz.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CO33biQC.js → capabilities-settings-panel-Ci6qVS-O.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-B9SXtr0p.js → channels-settings-BOGEZnSv.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-0RbeaCb4.js → channels-status-swr-BR8oQ_eP.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdajkVWX.js → chat-terminal-dock-BF9ZXa5Z.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Dv9Gc04W.js → connectors-page-DBvEvupa.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-IQ7L7Yfo.js → cron-expression-BszT_gjK.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-_8L4XYi4.js → date-picker-D2MKBJ0G.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DqKQ7zii.js → dependency-picker-DqigBx-G.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-B5Hj8onM.js → desktop-pet-CapspBGG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Cx9eOnxz.js → desktop-pet-settings-DMPk4CaK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-C0E8G0L3.js → extension-debug-page-CXLsDtrW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DwU54hPO.js → extension-page-B2j87ROw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CoHiKnkT.js → extension-settings-page-t1BApw-u.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DftrkBXi.js → gateway-config-swr-BFSesvAC.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-D9eRbAgP.js → gateway-settings-BFAecoGy.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BgI4nHyS.js → gateway-startup-retry-D1giYgI-.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Bo6VHm0J.js → heartbeat-settings-CyD9zDcU.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-E1AzAvyw.js → home-page-uItZMiBE.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-SZomqErK.js → image-generation-api-BeB-OPqO.js} +1 -1
- package/dist/gateway/static/root/assets/{index-pmcvQ5pq.js → index-DQtjs2x3.js} +8 -8
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Nzl7HzsR.js → keyboard-shortcuts-settings-Q_CM-ZCs.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-yIMJ_WdU.js → local-app-workbench-page-DaiBWfOt.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DRQoDm9I.js → local-apps-page-BALMNCSp.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CHtOF1kO.js → locale-store-RJHYFoq9.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Cdpl_Ccj.js → logs-page-C-TS7oFg.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-U81XMIVy.js → management-settings-BajkJeYl.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-D-FLW0dt.js → markdown-view-BxoQJqHx.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D9ajlmEo.js → media-plugins-C_8Hl6KG.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cf1h5WXB.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-DFAUuhB5.js → mobile-pairing-wizard-CsWIZrZW.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-Cx0UW1ml.js → note-detail-panel-CCbPg_GP.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-CqWid6rN.js → notes-page-BdxxcUKa.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-CXo5GsOJ.js → page-tabs-BMYQef5D.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Ct078fbo.js → preview-open-alternatives-CKZ-H5hJ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-UiLKUjzS.js → product-open-page-zXJIptXs.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DloclfjI.js → project-detail-page-DRhhxhZB.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DPbVBxEl.js → projects-page-Wt7gF3Sx.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BbSVGn6X.js → registry-api-BSfFaxVN.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BkFDpVBV.js → remote-access-hub-B6de5Zrb.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DPIpVABf.js → runtime-tools-settings-panel-DcUB5h1f.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-B_1CsQnV.js → schema-form-CquWhe7r.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Cu-O03Ah.js → sessions-page-BNWO2EVF.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DK1yTYE4.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DpAFw7dA.js → settings-form-section-DwswAefc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-KGC3Nc4j.js → settings-page-CoAVmjjs.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DUnPvWv4.js → setup-status-panel-C9EIcWtH.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Bz49xVj2.js → share-preview-page-DWwy_4zh.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BdnefOpB.js → shares-settings-CIUvq27-.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DfE3zFVw.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CqASoG63.js → skills-page-CqsgVtVh.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DpNBvHVa.js → skills-page.utils-B-N73248.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CjYfWbkg.js → system-settings-panel-BndjXuBZ.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-1ciKj-G2.js → task-detail-page-CG6Ha9t7.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-CyYxQYpT.js → theme-store-C5ssn64t.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BeTjaQ30.js → tunnel-api-BxZdcp3h.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DMeAoaFH.js → use-autosave-mj9CUuz1.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CqF2Sz0B.js → user-model-page-DKeHMXI4.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BpCCTqEw.js → voice-api-key-field-CzxVMYlr.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-BS1ozT6b.js → voice-config-api-COA0V1cK.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CHKBgPVw.js → work-discovery-overlay-DMiPK8dp.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C7a3xXM2.js → workflow-run-setup-panel-C82OXCJK.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-B-qyam4R.js → workflows-page-HLCUV3rQ.js} +1 -1
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/endpoint-tools/policy.js +14 -5
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/messages-CIDIpI4Y.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3b1Fj9k.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CArff6hI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{a,i as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-CIDIpI4Y.js";import{n as m}from"./locale-store-CHtOF1kO.js";import{t as h}from"./cn-JdwAhgNB.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-B11EPpor.js";import{t as v}from"./skeleton-BwbyijEw.js";import{i as y,o as b}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{B as x,Di as S,R as C,St as w,no as T,wt as E,xt as D,z as O}from"./index-pmcvQ5pq.js";import{_ as k,c as A,f as j,g as M,i as N,l as P,m as ee,n as F,o as I,p as te,r as L,t as R}from"./tunnel-api-BeTjaQ30.js";import{t as z}from"./browser-BLJWD7WI.js";var B=e(n(),1),V=r(),H=e(z(),1),U={width:216,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function ne(e){let t=await H.toString(e,{...U,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var W=i();function re(){let e=p(m(e=>e.language)),t=e.endpointToolsSettings.mobileAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=g(`tunnel-status`,R,{refreshInterval:1500}),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!0),[f,h]=(0,B.useState)(`idle`),[y,b]=(0,B.useState)(!1),[S,T]=(0,B.useState)(``),k=(0,B.useRef)(!0);(0,B.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let A=async()=>{if(!r)return;if(r.consentRequired&&!o){l(!0);return}let e=r.registrationSecret?.configured?null:x(),t,n=!1;b(!1);try{if(r.consentRequired&&await N(),!r.registrationSecret?.configured){h(`authorizing`);let r=sessionStorage.getItem(`mobile-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await E(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`mobile-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;k.current&&Date.now()<o;){let r=await w(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await O(a,e)||T(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!k.current)return;if(!s)throw Error(`Authorization expired`);await L()}if(!k.current)return;h(`starting`),await I(),u&&await F({autoStart:!0}),await a(),n=!0}catch{n=!0,k.current&&b(!0)}finally{C(e),n&&(sessionStorage.removeItem(`mobile-pairing-oauth`),t&&D(t).catch(()=>{})),k.current&&(h(`idle`),T(``))}};if(!r&&!i)return(0,W.jsxs)(`div`,{className:`space-y-5`,children:[(0,W.jsx)(v,{className:`h-5 w-4/5`}),(0,W.jsx)(v,{className:`h-24 w-full`})]});let j=f===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,W.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:j?t.preparingHint:f===`authorizing`?t.authorizing:t.enableHint}),S&&f===`authorizing`?(0,W.jsx)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,j?(0,W.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,W.jsx)(v,{className:`h-2 w-full`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(c||r?.consentRequired)&&f===`idle`?(0,W.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,W.jsxs)(`details`,{open:c,className:`text-sm text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,W.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,W.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,y||i||r?.state===`error`?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.failed}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f!==`idle`,onChange:e=>d(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:!r||f!==`idle`||j||c&&!o,onClick:()=>void A(),children:f===`authorizing`?t.authorizing:j?t.preparing:y?t.retry:t.enable}),i&&!r?(0,W.jsx)(_,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var G=t({MobilePairingWizard:()=>K});function K(e){let t=(0,V.c)(8),{open:n,onOpenChange:r,onPaired:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=n?(0,W.jsx)(q,{onClose:()=>r(!1),onPaired:i}):null,t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==r||t[5]!==n||t[6]!==a?(o=(0,W.jsx)(u,{open:n,onOpenChange:r,children:a}),t[4]=r,t[5]=n,t[6]=a,t[7]=o):o=t[7],o}function q({onClose:e,onPaired:t}){let n=p(m(e=>e.language)),r=n.endpointToolsSettings.mobileAccess,i=r.flow,u=g(`mobile-pairing-readiness`,M,{refreshInterval:1500}),[x,C]=(0,B.useState)(),[w,E]=(0,B.useState)(!1),[D,O]=(0,B.useState)(!1),[N,F]=(0,B.useState)(Date.now()),[I,L]=(0,B.useState)(null),R=(0,B.useRef)(!0),z=(0,B.useRef)(null),V=(0,B.useRef)(!1),H=(0,B.useRef)(!1),U=g(x?[`mobile-pairing-setup`,x.id]:null,()=>k(x.id),{refreshInterval:1500}),G=U.data?.request,K=G?.status===`completed`,q=g(K&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),J=T(()=>ne(x?.universalLink??``),[x?.universalLink],{enabled:!!x,initial:null,errorData:null});(0,B.useEffect)(()=>{R.current=!0;let e=setInterval(()=>F(Date.now()),1e3);return()=>{R.current=!1,clearInterval(e),z.current&&j(z.current).catch(()=>{})}},[]);let Y=(0,B.useCallback)(async()=>{if(!V.current){V.current=!0,O(!0),E(!1);try{z.current&&await j(z.current),z.current=null,C(void 0);let e=await te();if(e.kind===`ready`){if(!R.current){await j(e.setup.id);return}z.current=e.setup.id,C(e.setup)}else await u.mutate()}catch{R.current&&E(!0)}finally{V.current=!1,R.current&&O(!1)}}},[u]);(0,B.useEffect)(()=>{u.data?.ready&&u.data.protocolVersions?.includes(3)&&!x&&!w&&!V.current&&Y()},[u.data,x,w,Y]),(0,B.useEffect)(()=>{K&&!H.current&&(H.current=!0,t?.())},[K,t]);let X=async e=>{if(G){O(!0),E(!1);try{await ee(G,e),await U.mutate()}catch{E(!0),await U.mutate()}finally{R.current&&O(!1)}}},Z=(0,B.useRef)(0);(0,B.useEffect)(()=>{U.data&&(Z.current=U.data.serverTime-Date.now())},[U.data]);let Q=N+Z.current,$=x&&Q>=x.expiresAt&&!G,ie=G&&[`expired`,`rejected`,`cancelled`].includes(G.status),ae=u.data&&!u.data.protocolVersions?.includes(3),oe=K?i.success:G?.status===`pending`?i.allowTitle:G?.status===`approved`?i.waiting:x?i.scan:i.title;return(0,W.jsxs)(s,{children:[(0,W.jsx)(a,{className:h(`fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,W.jsxs)(c,{className:h(`fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover`,y),children:[(0,W.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,W.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,W.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":i.cancel,onClick:e,children:(0,W.jsx)(f,{className:`size-4`})})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[K?(0,W.jsx)(d,{className:`mb-5 size-7 text-success`}):null,(0,W.jsx)(l,{className:`text-xl font-semibold tracking-tight text-fg`,children:oe}),(0,W.jsx)(o,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:K?i.successHint:G?G.displayName:x?i.scanHint:i.intro}),w||u.error||U.error||J.error?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:i.failed}):null,ae?(0,W.jsx)(`p`,{className:`mt-8 text-sm text-fg-muted`,children:i.update}):u.data?K?(0,W.jsxs)(W.Fragment,{children:[q.data?(0,W.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[i.background,(0,W.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":q.data.runInBackground??!1,disabled:!q.data.backgroundSupported,checked:q.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>q.mutate(e.behavior)).catch(()=>E(!0))}})]}):null,(0,W.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:i.sleep})]}):ie||$?(0,W.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:$||G?.status===`expired`?i.expired:i.declined}),(0,W.jsx)(_,{variant:`primary`,onClick:()=>void Y(),disabled:D,children:i.refresh})]}):G?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i.scope}),(0,W.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[G.confirmationCode.slice(0,3),` `,G.confirmationCode.slice(3)]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i.compare}),(0,W.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.access}),(0,W.jsx)(`p`,{children:i.accessHint})]})]}):x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`my-6 flex justify-center`,children:J.data?(0,W.jsx)(`img`,{src:J.data,alt:r.qrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):(0,W.jsx)(v,{className:`size-[216px]`})}),(0,W.jsx)(`p`,{className:`text-center text-xs text-fg-muted`,children:x.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((x.expiresAt-Q)/1e3))}s`:i.valid}),(0,W.jsxs)(`details`,{className:`mt-5 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.fallback}),(0,W.jsx)(S,{text:x.universalLink,labels:{copy:r.copy,copied:r.copied,copyFailed:n.clipboard.copyFailed}})]})]}):u.data.ready?(0,W.jsx)(`div`,{className:`mt-8`,children:(0,W.jsx)(v,{className:`mx-auto size-[216px]`})}):(0,W.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[I===`tailscale`?(0,W.jsx)(P,{embedded:!0}):I===`https`?(0,W.jsx)(A,{}):I===`choices`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`tailscale`),children:r.useTailscale}),(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`https`),children:r.useOwnHttps})]}):(0,W.jsx)(re,{}),(0,W.jsx)(_,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>L(I?null:`choices`),children:I?i.back:i.existing})]}):(0,W.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,W.jsx)(v,{className:`h-5 w-3/4`}),(0,W.jsx)(v,{className:`h-40 w-full`})]})]}),K||G?.status===`pending`||w?(0,W.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:K?(0,W.jsx)(_,{className:`w-full`,variant:`primary`,onClick:e,children:i.done}):G?.status===`pending`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:D,onClick:()=>void X(`approve`),children:i.allow}),(0,W.jsx)(_,{className:`w-full`,variant:`ghost`,disabled:D,onClick:()=>void X(`reject`),children:i.cancel})]}):(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:D,onClick:()=>void Y(),children:i.retry})}):null]})]})}export{G as n,K as t};
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{a,i as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-Cf1h5WXB.js";import{n as m}from"./locale-store-RJHYFoq9.js";import{t as h}from"./cn-JdwAhgNB.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-B11EPpor.js";import{t as v}from"./skeleton-BwbyijEw.js";import{i as y,o as b}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{B as x,Di as S,R as C,St as w,no as T,wt as E,xt as D,z as O}from"./index-DQtjs2x3.js";import{_ as k,c as A,f as j,g as M,i as N,l as P,m as ee,n as F,o as I,p as te,r as L,t as R}from"./tunnel-api-BxZdcp3h.js";import{t as z}from"./browser-BLJWD7WI.js";var B=e(n(),1),V=r(),H=e(z(),1),U={width:216,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function ne(e){let t=await H.toString(e,{...U,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var W=i();function re(){let e=p(m(e=>e.language)),t=e.endpointToolsSettings.mobileAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=g(`tunnel-status`,R,{refreshInterval:1500}),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!0),[f,h]=(0,B.useState)(`idle`),[y,b]=(0,B.useState)(!1),[S,T]=(0,B.useState)(``),k=(0,B.useRef)(!0);(0,B.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let A=async()=>{if(!r)return;if(r.consentRequired&&!o){l(!0);return}let e=r.registrationSecret?.configured?null:x(),t,n=!1;b(!1);try{if(r.consentRequired&&await N(),!r.registrationSecret?.configured){h(`authorizing`);let r=sessionStorage.getItem(`mobile-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await E(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`mobile-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;k.current&&Date.now()<o;){let r=await w(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await O(a,e)||T(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!k.current)return;if(!s)throw Error(`Authorization expired`);await L()}if(!k.current)return;h(`starting`),await I(),u&&await F({autoStart:!0}),await a(),n=!0}catch{n=!0,k.current&&b(!0)}finally{C(e),n&&(sessionStorage.removeItem(`mobile-pairing-oauth`),t&&D(t).catch(()=>{})),k.current&&(h(`idle`),T(``))}};if(!r&&!i)return(0,W.jsxs)(`div`,{className:`space-y-5`,children:[(0,W.jsx)(v,{className:`h-5 w-4/5`}),(0,W.jsx)(v,{className:`h-24 w-full`})]});let j=f===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,W.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:j?t.preparingHint:f===`authorizing`?t.authorizing:t.enableHint}),S&&f===`authorizing`?(0,W.jsx)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,j?(0,W.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,W.jsx)(v,{className:`h-2 w-full`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(c||r?.consentRequired)&&f===`idle`?(0,W.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,W.jsxs)(`details`,{open:c,className:`text-sm text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,W.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,W.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,y||i||r?.state===`error`?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.failed}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f!==`idle`,onChange:e=>d(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:!r||f!==`idle`||j||c&&!o,onClick:()=>void A(),children:f===`authorizing`?t.authorizing:j?t.preparing:y?t.retry:t.enable}),i&&!r?(0,W.jsx)(_,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var G=t({MobilePairingWizard:()=>K});function K(e){let t=(0,V.c)(8),{open:n,onOpenChange:r,onPaired:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=n?(0,W.jsx)(q,{onClose:()=>r(!1),onPaired:i}):null,t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==r||t[5]!==n||t[6]!==a?(o=(0,W.jsx)(u,{open:n,onOpenChange:r,children:a}),t[4]=r,t[5]=n,t[6]=a,t[7]=o):o=t[7],o}function q({onClose:e,onPaired:t}){let n=p(m(e=>e.language)),r=n.endpointToolsSettings.mobileAccess,i=r.flow,u=g(`mobile-pairing-readiness`,M,{refreshInterval:1500}),[x,C]=(0,B.useState)(),[w,E]=(0,B.useState)(!1),[D,O]=(0,B.useState)(!1),[N,F]=(0,B.useState)(Date.now()),[I,L]=(0,B.useState)(null),R=(0,B.useRef)(!0),z=(0,B.useRef)(null),V=(0,B.useRef)(!1),H=(0,B.useRef)(!1),U=g(x?[`mobile-pairing-setup`,x.id]:null,()=>k(x.id),{refreshInterval:1500}),G=U.data?.request,K=G?.status===`completed`,q=g(K&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),J=T(()=>ne(x?.universalLink??``),[x?.universalLink],{enabled:!!x,initial:null,errorData:null});(0,B.useEffect)(()=>{R.current=!0;let e=setInterval(()=>F(Date.now()),1e3);return()=>{R.current=!1,clearInterval(e),z.current&&j(z.current).catch(()=>{})}},[]);let Y=(0,B.useCallback)(async()=>{if(!V.current){V.current=!0,O(!0),E(!1);try{z.current&&await j(z.current),z.current=null,C(void 0);let e=await te();if(e.kind===`ready`){if(!R.current){await j(e.setup.id);return}z.current=e.setup.id,C(e.setup)}else await u.mutate()}catch{R.current&&E(!0)}finally{V.current=!1,R.current&&O(!1)}}},[u]);(0,B.useEffect)(()=>{u.data?.ready&&u.data.protocolVersions?.includes(3)&&!x&&!w&&!V.current&&Y()},[u.data,x,w,Y]),(0,B.useEffect)(()=>{K&&!H.current&&(H.current=!0,t?.())},[K,t]);let X=async e=>{if(G){O(!0),E(!1);try{await ee(G,e),await U.mutate()}catch{E(!0),await U.mutate()}finally{R.current&&O(!1)}}},Z=(0,B.useRef)(0);(0,B.useEffect)(()=>{U.data&&(Z.current=U.data.serverTime-Date.now())},[U.data]);let Q=N+Z.current,$=x&&Q>=x.expiresAt&&!G,ie=G&&[`expired`,`rejected`,`cancelled`].includes(G.status),ae=u.data&&!u.data.protocolVersions?.includes(3),oe=K?i.success:G?.status===`pending`?i.allowTitle:G?.status===`approved`?i.waiting:x?i.scan:i.title;return(0,W.jsxs)(s,{children:[(0,W.jsx)(a,{className:h(`fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,W.jsxs)(c,{className:h(`fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover`,y),children:[(0,W.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,W.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,W.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":i.cancel,onClick:e,children:(0,W.jsx)(f,{className:`size-4`})})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[K?(0,W.jsx)(d,{className:`mb-5 size-7 text-success`}):null,(0,W.jsx)(l,{className:`text-xl font-semibold tracking-tight text-fg`,children:oe}),(0,W.jsx)(o,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:K?i.successHint:G?G.displayName:x?i.scanHint:i.intro}),w||u.error||U.error||J.error?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:i.failed}):null,ae?(0,W.jsx)(`p`,{className:`mt-8 text-sm text-fg-muted`,children:i.update}):u.data?K?(0,W.jsxs)(W.Fragment,{children:[q.data?(0,W.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[i.background,(0,W.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":q.data.runInBackground??!1,disabled:!q.data.backgroundSupported,checked:q.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>q.mutate(e.behavior)).catch(()=>E(!0))}})]}):null,(0,W.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:i.sleep})]}):ie||$?(0,W.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:$||G?.status===`expired`?i.expired:i.declined}),(0,W.jsx)(_,{variant:`primary`,onClick:()=>void Y(),disabled:D,children:i.refresh})]}):G?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i.scope}),(0,W.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[G.confirmationCode.slice(0,3),` `,G.confirmationCode.slice(3)]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i.compare}),(0,W.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.access}),(0,W.jsx)(`p`,{children:i.accessHint})]})]}):x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`my-6 flex justify-center`,children:J.data?(0,W.jsx)(`img`,{src:J.data,alt:r.qrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):(0,W.jsx)(v,{className:`size-[216px]`})}),(0,W.jsx)(`p`,{className:`text-center text-xs text-fg-muted`,children:x.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((x.expiresAt-Q)/1e3))}s`:i.valid}),(0,W.jsxs)(`details`,{className:`mt-5 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.fallback}),(0,W.jsx)(S,{text:x.universalLink,labels:{copy:r.copy,copied:r.copied,copyFailed:n.clipboard.copyFailed}})]})]}):u.data.ready?(0,W.jsx)(`div`,{className:`mt-8`,children:(0,W.jsx)(v,{className:`mx-auto size-[216px]`})}):(0,W.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[I===`tailscale`?(0,W.jsx)(P,{embedded:!0}):I===`https`?(0,W.jsx)(A,{}):I===`choices`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`tailscale`),children:r.useTailscale}),(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`https`),children:r.useOwnHttps})]}):(0,W.jsx)(re,{}),(0,W.jsx)(_,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>L(I?null:`choices`),children:I?i.back:i.existing})]}):(0,W.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,W.jsx)(v,{className:`h-5 w-3/4`}),(0,W.jsx)(v,{className:`h-40 w-full`})]})]}),K||G?.status===`pending`||w?(0,W.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:K?(0,W.jsx)(_,{className:`w-full`,variant:`primary`,onClick:e,children:i.done}):G?.status===`pending`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:D,onClick:()=>void X(`approve`),children:i.allow}),(0,W.jsx)(_,{className:`w-full`,variant:`ghost`,disabled:D,onClick:()=>void X(`reject`),children:i.cancel})]}):(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:D,onClick:()=>void Y(),children:i.retry})}):null]})]})}export{G as n,K as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
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{d as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,r as h}from"./popover-select-CKBYnT3c.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./copy-Dv6d4Dvw.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{t as b}from"./x-B_N4OPjy.js";import{t as x}from"./copy-to-clipboard-HOJ79TWv.js";import{t as S}from"./messages-CIDIpI4Y.js";import{d as C,n as w}from"./locale-store-CHtOF1kO.js";import{t as T}from"./cn-JdwAhgNB.js";import{i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-B11EPpor.js";import{i as O}from"./theme-store-CyYxQYpT.js";import{t as k}from"./skeleton-BwbyijEw.js";import{Ac as A,Au as j,Bl as M,Bn as N,Cn as P,Dn as F,En as I,Gc as L,Gn as R,Hn as z,Hs as B,Kt as ee,Mn as te,On as ne,Pl as V,Pn as re,Qn as ie,Qs as ae,Rn as oe,Si as se,Tn as ce,Ui as le,Un as ue,Us as H,Vc as U,Vn as de,Vs as fe,Ws as pe,Xn as me,Yl as he,Yn as ge,Zn as _e,_n as ve,a as ye,bn as be,bo as xe,c as Se,cc as Ce,er as we,fu as Te,gn as Ee,hi as De,hn as Oe,il as W,jn as G,ju as K,kn as q,l as ke,mi as Ae,mn as je,nc as Me,o as Ne,pc as Pe,ro as Fe,s as Ie,tr as Le,vc as Re,vi as ze,vn as Be,wn as Ve,xi as J,xn as Y,yl as He,yn as Ue,yt as We,zl as Ge,zn as Ke}from"./index-pmcvQ5pq.js";var X=n(),Z=e(t(),1),Q=r(),qe=(0,Z.createContext)(null);function Je(){let e=(0,X.c)(1),t=(0,Z.useContext)(qe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ye},e[0]=t):t=e[0],t}return t}function Ye(){}function Xe(e){let t=(0,X.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(e,t)=>{s({src:e,alt:t})},t[0]=p):p=t[0];let m=p,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={openImage:m},t[1]=h):h=t[1];let g=h,_=a!==null,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||s(null)},t[2]=v):v=t[2];let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=y):y=t[3];let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=T(`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]=x):x=t[4];let S=a?.alt||`Image preview`,C;t[5]===S?C=t[6]:(C=(0,Q.jsx)(d,{className:`sr-only`,children:S}),t[5]=S,t[6]=C);let w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(b,{className:`size-5`,"aria-hidden":!0}),t[7]=w):w=t[7];let E;t[8]===i?E=t[9]:(E=(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:w})}),t[8]=i,t[9]=E);let D;t[10]===a?D=t[11]:(D=a?(0,Q.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]=D);let O;t[12]!==E||t[13]!==D||t[14]!==C?(O=(0,Q.jsxs)(l,{children:[y,(0,Q.jsxs)(u,{className:x,"aria-describedby":void 0,children:[C,E,D]})]}),t[12]=E,t[13]=D,t[14]=C,t[15]=O):O=t[15];let k;t[16]!==O||t[17]!==_?(k=(0,Q.jsx)(f,{open:_,onOpenChange:v,children:O}),t[16]=O,t[17]=_,t[18]=k):k=t[18];let A;return t[19]!==n||t[20]!==k?(A=(0,Q.jsxs)(qe.Provider,{value:g,children:[n,k]}),t[19]=n,t[20]=k,t[21]=A):A=t[21],A}var $=6e4,Ze=36e5,Qe=864e5;function $e(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function et(e,t,n){let r=t-e;if(r<$)return n.justNow;if(r<Ze){let e=Math.floor(r/$);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=$e(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Qe)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*Qe){let e=Math.floor(r/Qe);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function tt(e,t,n){let r=$e(t);if(e>=r)return n.today;if(e>=r-Qe)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function nt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function rt(e){let t=(0,X.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=w(ot),d=S(u).automations.suggestions,f=S(u).automations,p=a(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=m):m=t[0];let{data:h}=E(o?`automation-suggestion-coverage`:null,at,m),_=o?h?.automations.find(e=>Se(e,o)):void 0,v=_?Ne(_,f):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=T(`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,Q.jsx)(g,{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]===p?r=t[5]:(r=()=>p(`/automations`),t[4]=p,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,Q.jsx)(D,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===s?e=t[7]:(e=T(`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,Q.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,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==p||t[13]!==i?(c=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=p,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(D,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=T(`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,Q.jsx)(g,{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]===p?r=t[20]:(r=()=>p(`/automations`),t[19]=p,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(D,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ie(d.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:f.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(it)})]}),i]})}let y;t[24]===s?y=t[25]:(y=T(`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,Q.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,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let C;t[29]===r?C=t[30]:(C=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let O;t[31]!==x||t[32]!==C?(O=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,C]})]}),t[31]=x,t[32]=C,t[33]=O):O=t[33];let k;t[34]!==p||t[35]!==i?(k=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=p,t[35]=i,t[36]=k):k=t[36];let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),t[37]=A):A=t[37];let j;t[38]!==d.create||t[39]!==k?(j=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(D,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:k,children:[A,d.create]})}),t[38]=d.create,t[39]=k,t[40]=j):j=t[40];let M;return t[41]!==j||t[42]!==y||t[43]!==O?(M=(0,Q.jsxs)(`section`,{className:y,children:[O,j]}),t[41]=j,t[42]=y,t[43]=O,t[44]=M):M=t[44],M}function it(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function at(){return ke.list()}function ot(e){return e.language}function st(e){let t=(0,X.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,Q.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,Q.jsx)(`li`,{children:e},`${t}:${e}`)}function lt(e){let t=(0,X.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),we(n,r).then(i=>{if(e=!0,t){Le(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&Le(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Z.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,Q.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,Q.jsx)(k,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,Q.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]=f):f=t[9],f}function ut(e){let t=(0,X.c)(39),{noteId:n}=e,r=S(w(pt)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>ee(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:c}=E(i,a,o),l,u;if(t[4]===c?(l=t[5],u=t[6]):(l=()=>{let e=e=>{let t=e.detail;t&&c(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(ft);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 c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},u=[c],t[4]=c,t[5]=l,t[6]=u),(0,Z.useEffect)(l,u),!s)return null;let{discussion:d,transcript:f}=s,p=s.organization?.organization,m=[`stopping`,`sealing`,`organizing`].includes(d.status),h=f.stats.uploaded+f.stats.transcribing,_=f.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(f.stats.failed)):h>0?r.processingSegments.replace(`{{count}}`,String(h)):m?r.finalizing:d.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]!==p?(v=p?(0,Q.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:p.summary}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[p.decisions.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,Q.jsx)(st,{values:p.decisions})]}):null,p.actionItems.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,Q.jsx)(st,{values:p.actionItems.map(dt)})]}):null,p.risks.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,Q.jsx)(st,{values:p.risks})]}):null,p.openQuestions.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,Q.jsx)(st,{values:p.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]=p,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==d.audioAttachmentId||t[17]!==n?(y=d.audioAttachmentId?(0,Q.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(U,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,Q.jsx)(lt,{noteId:n,attachmentId:d.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=d.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(U,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=d.status===`recording`?r.draftTranscript:r.fullTranscript,C;t[20]===x?C=t[21]:(C=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=C);let T;t[22]===d.status?T=t[23]:(T=d.status===`needs_attention`?(0,Q.jsx)(fe,{className:`size-3.5 text-danger`}):d.status===`completed`?(0,Q.jsx)(g,{className:`size-3.5 text-success`}):null,t[22]=d.status,t[23]=T);let D=d.status===`needs_attention`?d.failureMessage:_,O;t[24]!==T||t[25]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[T,D]}),t[24]=T,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==C||t[28]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,O]}),t[27]=C,t[28]=O,t[29]=k):k=t[29];let A=f.text||r.waitingTranscript,j;t[30]===A?j=t[31]:(j=(0,Q.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:A}),t[30]=A,t[31]=j);let M;t[32]!==k||t[33]!==j?(M=(0,Q.jsxs)(`section`,{className:`px-6 py-4`,children:[k,j]}),t[32]=k,t[33]=j,t[34]=M):M=t[34];let N;return t[35]!==M||t[36]!==v||t[37]!==y?(N=(0,Q.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,M]}),t[35]=M,t[36]=v,t[37]=y,t[38]=N):N=t[38],N}function dt(e){return e.title}function ft(e,t){return e.sequence-t.sequence}function pt(e){return e.language}var mt={edit:A,ai_edit:Me,sync:Re,restore:K};function ht(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function gt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=w(e=>e.language),o=S(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:C(a)},{data:c}=E(e?[`note-history`,e]:null,()=>q(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await z(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(He,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.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,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=mt[e.trigger]??A,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:T(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ht(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:et(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,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:l?`...`:o.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(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:o.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function _t({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=S(w(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:v,mutate:y,isLoading:b}=E(e?[`note-agent-context-status`,e]:null,()=>I(e),{revalidateOnFocus:!1}),x=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>oe(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),C=(0,Z.useCallback)(async t=>{try{await Ke(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Me,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(j,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:b||g,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:g?u.processing:u.contextRebuild}),(0,Q.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.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:v.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,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:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`helpful`),className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`not_helpful`),className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,Q.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.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:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(L,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,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:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,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:u.newThread})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/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,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var vt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function yt({open:e,onOpenChange:t,note:n}){let r=w(e=>e.language)===`zh`,i=r?Ct:wt,{data:a,mutate:g}=E(e?[`note-shares`,n.id]:null,()=>G(n.id)),S=E(e?`hosted-share-auth-status`:null,ze),C=S.data===!0,T=E(e&&C?`hosted-publication-capabilities`:null,De),O=T.data?.publishing.allowed===!0,k=E(e&&C?[`hosted-note-publications`,n.id]:null,()=>ne(n.id)),[A,j]=(0,Z.useState)(new Set),[M,F]=(0,Z.useState)(`86400000`),[I,L]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(``),[B,ee]=(0,Z.useState)(`hosted`),[te,V]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(null),[ae,oe]=(0,Z.useState)(null),[ce,le]=(0,Z.useState)(!1),[ue,H]=(0,Z.useState)(null),U=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(j(new Set(U.map(e=>e.id))),oe(null),le(!1),H(null))},[e,U]);let fe=async()=>{V(!0),H(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...A],ttlMs:Number(M),maxViews:I.trim()?Number(I):null,description:R.trim()||void 0};B===`hosted`?(oe((await Y(n.id,e)).shareUrl),await k.mutate()):(oe((await P(n.id,e)).payload.shareUrl),await g())}catch(e){H(e instanceof Error?e.message:String(e))}finally{V(!1)}},pe=async(e,t)=>{ie(e.id),H(null);try{t===`refresh`?await N(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...A]}):await J(e.id),await k.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{ie(null)}},me=async(e,t)=>{ie(e.id),H(null);try{t===`refresh`?await de(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...A]}):t===`extend`?await Ae(e.id,864e5):await se(e.id),await g()}catch(e){H(e instanceof Error?e.message:String(e))}finally{ie(null)}},he=async e=>{H(null);try{if(!await x(e)){le(!1),H(i.copyFailed);return}le(!0),window.setTimeout(()=>le(!1),1500)}catch{le(!1),H(i.copyFailed)}};return(0,Q.jsx)(f,{open:e,onOpenChange:t,children:(0,Q.jsxs)(l,{children:[(0,Q.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(u,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(d,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Ce,{className:`size-4`}),i.title]}),(0,Q.jsx)(s,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(b,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),U.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:U.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:A.has(e.id),onChange:()=>j(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:St(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(m,{value:B,onChange:e=>ee(e.target.value),children:[(0,Q.jsx)(h,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(h,{value:`local`,children:i.deliveryLocal})]})]}),B===`hosted`&&S.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(We,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void S.mutate(!0,{revalidate:!1})})}):null,B===`hosted`&&C&&T.data&&!O?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(m,{value:M,onChange:e=>F(e.target.value),children:vt.map(e=>(0,Q.jsx)(h,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:I,onChange:e=>L(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:R,onChange:e=>z(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),ae?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:ae,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(D,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void he(ae),children:[ce?(0,Q.jsx)(p,{className:`size-4`}):(0,Q.jsx)(_,{className:`size-4`}),ce?i.copied:i.copy]}),(0,Q.jsxs)(D,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(ae,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(v,{className:`size-4`}),i.open]})]})}):null,ue?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ue}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(xt,{share:e,busy:re===e.id,t:i,onCopy:he,onAction:me},e.id))})]}):null,(k.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:k.data.map(e=>(0,Q.jsx)(bt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:re===e.id,publishingAllowed:O,t:i,onCopy:he,onAction:pe},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(D,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(D,{type:`button`,onClick:()=>void fe(),disabled:te||B===`hosted`&&(!C||!O),children:[te?(0,Q.jsx)(y,{className:`size-4 animate-spin`}):(0,Q.jsx)(Ce,{className:`size-4`}),te?i.creating:i.create]})]})]})]})})}function bt(e){let t=(0,X.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=T(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let f=r&&!l?o.stale:l?o.inactive:o.active,p;t[2]===f?p=t[3]:(p=(0,Q.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==h?(g=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=o.views,t[7]=h,t[8]=g):g=t[8];let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{children:`·`}),t[9]=b):b=t[9];let x;t[10]!==n.revision||t[11]!==o.revision?(x=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=x):x=t[12];let S;t[13]!==p||t[14]!==g||t[15]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,b,x]}),t[13]=p,t[14]=g,t[15]=x,t[16]=S):S=t[16];let C;t[17]===n.shareUrl?C=t[18]:(C=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=C);let w;t[19]!==S||t[20]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[19]=S,t[20]=C,t[21]=w):w=t[21];let E;t[22]===i?E=t[23]:(E=i?(0,Q.jsx)(y,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=E);let O;t[24]!==w||t[25]!==E?(O=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,E]}),t[24]=w,t[25]=E,t[26]=O):O=t[26];let k=!a,A;t[27]!==s||t[28]!==n.shareUrl?(A=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=A):A=t[29];let j;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(_,{className:`size-3.5`}),t[30]=j):j=t[30];let M;t[31]!==o.copy||t[32]!==k||t[33]!==A?(M=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:k,onClick:A,children:[j,o.copy]}),t[31]=o.copy,t[32]=k,t[33]=A,t[34]=M):M=t[34];let N=!a,P;t[35]===n.shareUrl?P=t[36]:(P=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=P);let F;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(v,{className:`size-3.5`}),t[37]=F):F=t[37];let I;t[38]!==o.open||t[39]!==N||t[40]!==P?(I=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:N,onClick:P,children:[F,o.open]}),t[38]=o.open,t[39]=N,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(L=r&&!l?(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(Re,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=L):L=t[49];let R;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(R=n.revoked?null:(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(B,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=R):R=t[54];let z;t[55]!==M||t[56]!==I||t[57]!==L||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[M,I,L,R]}),t[55]=M,t[56]=I,t[57]=L,t[58]=R,t[59]=z):z=t[59];let ee;return t[60]!==O||t[61]!==d||t[62]!==z?(ee=(0,Q.jsxs)(`div`,{className:d,children:[O,z]}),t[60]=O,t[61]=d,t[62]=z,t[63]=ee):ee=t[63],ee}function xt(e){let t=(0,X.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=T(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let b;t[12]===g?b=t[13]:(b=(0,Q.jsx)(`span`,{children:g}),t[12]=g,t[13]=b);let x;t[14]!==b||t[15]!==d||t[16]!==m?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,b]}),t[14]=b,t[15]=d,t[16]=m,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let C;t[20]!==x||t[21]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===r?w=t[24]:(w=r?(0,Q.jsx)(y,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=w);let E;t[25]!==C||t[26]!==w?(E=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=E):E=t[27];let O;t[28]!==a||t[29]!==n.shareUrl?(O=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(_,{className:`size-3.5`}),t[31]=k):k=t[31];let A;t[32]!==i.copy||t[33]!==O?(A=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.copy]}),t[32]=i.copy,t[33]=O,t[34]=A):A=t[34];let j;t[35]===n.shareUrl?j=t[36]:(j=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=j);let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(v,{className:`size-3.5`}),t[37]=M):M=t[37];let N;t[38]!==i.open||t[39]!==j?(N=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:j,children:[M,i.open]}),t[38]=i.open,t[39]=j,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(P=n.stale&&!s?(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(Re,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=P):P=t[46];let F;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(F=s?null:(0,Q.jsx)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=F):F=t[52];let I;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(I=n.revoked?null:(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(B,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=I):I=t[57];let L;t[58]!==A||t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I?(L=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[A,N,P,F,I]}),t[58]=A,t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==E||t[65]!==l||t[66]!==L?(R=(0,Q.jsxs)(`div`,{className:l,children:[E,L]}),t[64]=E,t[65]=l,t[66]=L,t[67]=R):R=t[67],R}function St(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Ct={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},wt={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Tt(e){let t=(0,X.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=me(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=me(u),f=me(Et),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(ge,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,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`,children:(0,Q.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Et(e){return e.stop}function Dt(e,t){let n=_e(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=_e(e);return!r||n.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-DzSu62js.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DQtjs2x3.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-BvLh9GaE.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DBS3OB8K.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-BxoQJqHx.js","assets/dist-CpzYSoz7.js","assets/chunk-KS7C4IRE-Cq1tE_3b.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-RJHYFoq9.js","assets/messages-Cf1h5WXB.js","assets/cn-JdwAhgNB.js","assets/product-delivery-CV4pDOtG.js","assets/schemas-BHS7bo06.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Y68dCxuc.css","assets/dist-DLmwHyAh.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-CKBYnT3c.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-DCp6ykjQ.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/globe-DSSGFWFn.js","assets/loader-circle-CifKLtgG.js","assets/middleware-Pd0e8Igk.js","assets/files-BArWTfr7.js","assets/tool-activity-R8V9l6nk.js","assets/button-B11EPpor.js","assets/registry-api-BSfFaxVN.js","assets/gateway-startup-retry-D1giYgI-.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-BFSesvAC.js","assets/electron-env-DH5wF8X8.js","assets/activity-store-BYBCpt7_.js","assets/theme-store-C5ssn64t.js","assets/index-CRJrO4GI.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.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{d as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,r as h}from"./popover-select-CKBYnT3c.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./copy-Dv6d4Dvw.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{t as b}from"./x-B_N4OPjy.js";import{t as x}from"./copy-to-clipboard-HOJ79TWv.js";import{t as S}from"./messages-Cf1h5WXB.js";import{d as C,n as w}from"./locale-store-RJHYFoq9.js";import{t as T}from"./cn-JdwAhgNB.js";import{i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-B11EPpor.js";import{i as O}from"./theme-store-C5ssn64t.js";import{t as k}from"./skeleton-BwbyijEw.js";import{Ac as A,Au as j,Bl as M,Bn as N,Cn as P,Dn as F,En as I,Gc as L,Gn as R,Hn as z,Hs as B,Kt as ee,Mn as te,On as ne,Pl as V,Pn as re,Qn as ie,Qs as ae,Rn as oe,Si as se,Tn as ce,Ui as le,Un as ue,Us as H,Vc as U,Vn as de,Vs as fe,Ws as pe,Xn as me,Yl as he,Yn as ge,Zn as _e,_n as ve,a as ye,bn as be,bo as xe,c as Se,cc as Ce,er as we,fu as Te,gn as Ee,hi as De,hn as Oe,il as W,jn as G,ju as K,kn as q,l as ke,mi as Ae,mn as je,nc as Me,o as Ne,pc as Pe,ro as Fe,s as Ie,tr as Le,vc as Re,vi as ze,vn as Be,wn as Ve,xi as J,xn as Y,yl as He,yn as Ue,yt as We,zl as Ge,zn as Ke}from"./index-DQtjs2x3.js";var X=n(),Z=e(t(),1),Q=r(),qe=(0,Z.createContext)(null);function Je(){let e=(0,X.c)(1),t=(0,Z.useContext)(qe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ye},e[0]=t):t=e[0],t}return t}function Ye(){}function Xe(e){let t=(0,X.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(e,t)=>{s({src:e,alt:t})},t[0]=p):p=t[0];let m=p,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={openImage:m},t[1]=h):h=t[1];let g=h,_=a!==null,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||s(null)},t[2]=v):v=t[2];let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=y):y=t[3];let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=T(`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]=x):x=t[4];let S=a?.alt||`Image preview`,C;t[5]===S?C=t[6]:(C=(0,Q.jsx)(d,{className:`sr-only`,children:S}),t[5]=S,t[6]=C);let w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(b,{className:`size-5`,"aria-hidden":!0}),t[7]=w):w=t[7];let E;t[8]===i?E=t[9]:(E=(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:w})}),t[8]=i,t[9]=E);let D;t[10]===a?D=t[11]:(D=a?(0,Q.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]=D);let O;t[12]!==E||t[13]!==D||t[14]!==C?(O=(0,Q.jsxs)(l,{children:[y,(0,Q.jsxs)(u,{className:x,"aria-describedby":void 0,children:[C,E,D]})]}),t[12]=E,t[13]=D,t[14]=C,t[15]=O):O=t[15];let k;t[16]!==O||t[17]!==_?(k=(0,Q.jsx)(f,{open:_,onOpenChange:v,children:O}),t[16]=O,t[17]=_,t[18]=k):k=t[18];let A;return t[19]!==n||t[20]!==k?(A=(0,Q.jsxs)(qe.Provider,{value:g,children:[n,k]}),t[19]=n,t[20]=k,t[21]=A):A=t[21],A}var $=6e4,Ze=36e5,Qe=864e5;function $e(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function et(e,t,n){let r=t-e;if(r<$)return n.justNow;if(r<Ze){let e=Math.floor(r/$);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=$e(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Qe)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*Qe){let e=Math.floor(r/Qe);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function tt(e,t,n){let r=$e(t);if(e>=r)return n.today;if(e>=r-Qe)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function nt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function rt(e){let t=(0,X.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=w(ot),d=S(u).automations.suggestions,f=S(u).automations,p=a(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=m):m=t[0];let{data:h}=E(o?`automation-suggestion-coverage`:null,at,m),_=o?h?.automations.find(e=>Se(e,o)):void 0,v=_?Ne(_,f):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=T(`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,Q.jsx)(g,{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]===p?r=t[5]:(r=()=>p(`/automations`),t[4]=p,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,Q.jsx)(D,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===s?e=t[7]:(e=T(`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,Q.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,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==p||t[13]!==i?(c=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=p,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(D,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=T(`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,Q.jsx)(g,{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]===p?r=t[20]:(r=()=>p(`/automations`),t[19]=p,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(D,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ie(d.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:f.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(it)})]}),i]})}let y;t[24]===s?y=t[25]:(y=T(`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,Q.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,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let C;t[29]===r?C=t[30]:(C=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let O;t[31]!==x||t[32]!==C?(O=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,C]})]}),t[31]=x,t[32]=C,t[33]=O):O=t[33];let k;t[34]!==p||t[35]!==i?(k=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=p,t[35]=i,t[36]=k):k=t[36];let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),t[37]=A):A=t[37];let j;t[38]!==d.create||t[39]!==k?(j=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(D,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:k,children:[A,d.create]})}),t[38]=d.create,t[39]=k,t[40]=j):j=t[40];let M;return t[41]!==j||t[42]!==y||t[43]!==O?(M=(0,Q.jsxs)(`section`,{className:y,children:[O,j]}),t[41]=j,t[42]=y,t[43]=O,t[44]=M):M=t[44],M}function it(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function at(){return ke.list()}function ot(e){return e.language}function st(e){let t=(0,X.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,Q.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,Q.jsx)(`li`,{children:e},`${t}:${e}`)}function lt(e){let t=(0,X.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),we(n,r).then(i=>{if(e=!0,t){Le(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&Le(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Z.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,Q.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,Q.jsx)(k,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,Q.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]=f):f=t[9],f}function ut(e){let t=(0,X.c)(39),{noteId:n}=e,r=S(w(pt)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>ee(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:c}=E(i,a,o),l,u;if(t[4]===c?(l=t[5],u=t[6]):(l=()=>{let e=e=>{let t=e.detail;t&&c(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(ft);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 c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},u=[c],t[4]=c,t[5]=l,t[6]=u),(0,Z.useEffect)(l,u),!s)return null;let{discussion:d,transcript:f}=s,p=s.organization?.organization,m=[`stopping`,`sealing`,`organizing`].includes(d.status),h=f.stats.uploaded+f.stats.transcribing,_=f.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(f.stats.failed)):h>0?r.processingSegments.replace(`{{count}}`,String(h)):m?r.finalizing:d.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]!==p?(v=p?(0,Q.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:p.summary}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[p.decisions.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,Q.jsx)(st,{values:p.decisions})]}):null,p.actionItems.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,Q.jsx)(st,{values:p.actionItems.map(dt)})]}):null,p.risks.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,Q.jsx)(st,{values:p.risks})]}):null,p.openQuestions.length>0?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,Q.jsx)(st,{values:p.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]=p,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==d.audioAttachmentId||t[17]!==n?(y=d.audioAttachmentId?(0,Q.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(U,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,Q.jsx)(lt,{noteId:n,attachmentId:d.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=d.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(U,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=d.status===`recording`?r.draftTranscript:r.fullTranscript,C;t[20]===x?C=t[21]:(C=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=C);let T;t[22]===d.status?T=t[23]:(T=d.status===`needs_attention`?(0,Q.jsx)(fe,{className:`size-3.5 text-danger`}):d.status===`completed`?(0,Q.jsx)(g,{className:`size-3.5 text-success`}):null,t[22]=d.status,t[23]=T);let D=d.status===`needs_attention`?d.failureMessage:_,O;t[24]!==T||t[25]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[T,D]}),t[24]=T,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==C||t[28]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,O]}),t[27]=C,t[28]=O,t[29]=k):k=t[29];let A=f.text||r.waitingTranscript,j;t[30]===A?j=t[31]:(j=(0,Q.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:A}),t[30]=A,t[31]=j);let M;t[32]!==k||t[33]!==j?(M=(0,Q.jsxs)(`section`,{className:`px-6 py-4`,children:[k,j]}),t[32]=k,t[33]=j,t[34]=M):M=t[34];let N;return t[35]!==M||t[36]!==v||t[37]!==y?(N=(0,Q.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,M]}),t[35]=M,t[36]=v,t[37]=y,t[38]=N):N=t[38],N}function dt(e){return e.title}function ft(e,t){return e.sequence-t.sequence}function pt(e){return e.language}var mt={edit:A,ai_edit:Me,sync:Re,restore:K};function ht(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function gt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=w(e=>e.language),o=S(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:C(a)},{data:c}=E(e?[`note-history`,e]:null,()=>q(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await z(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(He,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.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,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=mt[e.trigger]??A,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:T(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ht(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:et(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,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:l?`...`:o.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(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:o.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function _t({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=S(w(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:v,mutate:y,isLoading:b}=E(e?[`note-agent-context-status`,e]:null,()=>I(e),{revalidateOnFocus:!1}),x=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>oe(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),C=(0,Z.useCallback)(async t=>{try{await Ke(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Me,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(j,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:b||g,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:g?u.processing:u.contextRebuild}),(0,Q.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.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:v.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,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:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`helpful`),className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`not_helpful`),className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,Q.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.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:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(L,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,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:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,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:u.newThread})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/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,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var vt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function yt({open:e,onOpenChange:t,note:n}){let r=w(e=>e.language)===`zh`,i=r?Ct:wt,{data:a,mutate:g}=E(e?[`note-shares`,n.id]:null,()=>G(n.id)),S=E(e?`hosted-share-auth-status`:null,ze),C=S.data===!0,T=E(e&&C?`hosted-publication-capabilities`:null,De),O=T.data?.publishing.allowed===!0,k=E(e&&C?[`hosted-note-publications`,n.id]:null,()=>ne(n.id)),[A,j]=(0,Z.useState)(new Set),[M,F]=(0,Z.useState)(`86400000`),[I,L]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(``),[B,ee]=(0,Z.useState)(`hosted`),[te,V]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(null),[ae,oe]=(0,Z.useState)(null),[ce,le]=(0,Z.useState)(!1),[ue,H]=(0,Z.useState)(null),U=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(j(new Set(U.map(e=>e.id))),oe(null),le(!1),H(null))},[e,U]);let fe=async()=>{V(!0),H(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...A],ttlMs:Number(M),maxViews:I.trim()?Number(I):null,description:R.trim()||void 0};B===`hosted`?(oe((await Y(n.id,e)).shareUrl),await k.mutate()):(oe((await P(n.id,e)).payload.shareUrl),await g())}catch(e){H(e instanceof Error?e.message:String(e))}finally{V(!1)}},pe=async(e,t)=>{ie(e.id),H(null);try{t===`refresh`?await N(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...A]}):await J(e.id),await k.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{ie(null)}},me=async(e,t)=>{ie(e.id),H(null);try{t===`refresh`?await de(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...A]}):t===`extend`?await Ae(e.id,864e5):await se(e.id),await g()}catch(e){H(e instanceof Error?e.message:String(e))}finally{ie(null)}},he=async e=>{H(null);try{if(!await x(e)){le(!1),H(i.copyFailed);return}le(!0),window.setTimeout(()=>le(!1),1500)}catch{le(!1),H(i.copyFailed)}};return(0,Q.jsx)(f,{open:e,onOpenChange:t,children:(0,Q.jsxs)(l,{children:[(0,Q.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(u,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(d,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Ce,{className:`size-4`}),i.title]}),(0,Q.jsx)(s,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(b,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),U.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:U.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:A.has(e.id),onChange:()=>j(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:St(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(m,{value:B,onChange:e=>ee(e.target.value),children:[(0,Q.jsx)(h,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(h,{value:`local`,children:i.deliveryLocal})]})]}),B===`hosted`&&S.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(We,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void S.mutate(!0,{revalidate:!1})})}):null,B===`hosted`&&C&&T.data&&!O?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(m,{value:M,onChange:e=>F(e.target.value),children:vt.map(e=>(0,Q.jsx)(h,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:I,onChange:e=>L(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:R,onChange:e=>z(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),ae?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:ae,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(D,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void he(ae),children:[ce?(0,Q.jsx)(p,{className:`size-4`}):(0,Q.jsx)(_,{className:`size-4`}),ce?i.copied:i.copy]}),(0,Q.jsxs)(D,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(ae,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(v,{className:`size-4`}),i.open]})]})}):null,ue?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ue}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(xt,{share:e,busy:re===e.id,t:i,onCopy:he,onAction:me},e.id))})]}):null,(k.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:k.data.map(e=>(0,Q.jsx)(bt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:re===e.id,publishingAllowed:O,t:i,onCopy:he,onAction:pe},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsx)(D,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(D,{type:`button`,onClick:()=>void fe(),disabled:te||B===`hosted`&&(!C||!O),children:[te?(0,Q.jsx)(y,{className:`size-4 animate-spin`}):(0,Q.jsx)(Ce,{className:`size-4`}),te?i.creating:i.create]})]})]})]})})}function bt(e){let t=(0,X.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=T(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let f=r&&!l?o.stale:l?o.inactive:o.active,p;t[2]===f?p=t[3]:(p=(0,Q.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==h?(g=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=o.views,t[7]=h,t[8]=g):g=t[8];let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{children:`·`}),t[9]=b):b=t[9];let x;t[10]!==n.revision||t[11]!==o.revision?(x=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=x):x=t[12];let S;t[13]!==p||t[14]!==g||t[15]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,b,x]}),t[13]=p,t[14]=g,t[15]=x,t[16]=S):S=t[16];let C;t[17]===n.shareUrl?C=t[18]:(C=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=C);let w;t[19]!==S||t[20]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[19]=S,t[20]=C,t[21]=w):w=t[21];let E;t[22]===i?E=t[23]:(E=i?(0,Q.jsx)(y,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=E);let O;t[24]!==w||t[25]!==E?(O=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,E]}),t[24]=w,t[25]=E,t[26]=O):O=t[26];let k=!a,A;t[27]!==s||t[28]!==n.shareUrl?(A=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=A):A=t[29];let j;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(_,{className:`size-3.5`}),t[30]=j):j=t[30];let M;t[31]!==o.copy||t[32]!==k||t[33]!==A?(M=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:k,onClick:A,children:[j,o.copy]}),t[31]=o.copy,t[32]=k,t[33]=A,t[34]=M):M=t[34];let N=!a,P;t[35]===n.shareUrl?P=t[36]:(P=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=P);let F;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(v,{className:`size-3.5`}),t[37]=F):F=t[37];let I;t[38]!==o.open||t[39]!==N||t[40]!==P?(I=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:N,onClick:P,children:[F,o.open]}),t[38]=o.open,t[39]=N,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(L=r&&!l?(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(Re,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=L):L=t[49];let R;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(R=n.revoked?null:(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(B,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=R):R=t[54];let z;t[55]!==M||t[56]!==I||t[57]!==L||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[M,I,L,R]}),t[55]=M,t[56]=I,t[57]=L,t[58]=R,t[59]=z):z=t[59];let ee;return t[60]!==O||t[61]!==d||t[62]!==z?(ee=(0,Q.jsxs)(`div`,{className:d,children:[O,z]}),t[60]=O,t[61]=d,t[62]=z,t[63]=ee):ee=t[63],ee}function xt(e){let t=(0,X.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=T(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let b;t[12]===g?b=t[13]:(b=(0,Q.jsx)(`span`,{children:g}),t[12]=g,t[13]=b);let x;t[14]!==b||t[15]!==d||t[16]!==m?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,b]}),t[14]=b,t[15]=d,t[16]=m,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let C;t[20]!==x||t[21]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===r?w=t[24]:(w=r?(0,Q.jsx)(y,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=w);let E;t[25]!==C||t[26]!==w?(E=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=E):E=t[27];let O;t[28]!==a||t[29]!==n.shareUrl?(O=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(_,{className:`size-3.5`}),t[31]=k):k=t[31];let A;t[32]!==i.copy||t[33]!==O?(A=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.copy]}),t[32]=i.copy,t[33]=O,t[34]=A):A=t[34];let j;t[35]===n.shareUrl?j=t[36]:(j=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=j);let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(v,{className:`size-3.5`}),t[37]=M):M=t[37];let N;t[38]!==i.open||t[39]!==j?(N=(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:j,children:[M,i.open]}),t[38]=i.open,t[39]=j,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(P=n.stale&&!s?(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(Re,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=P):P=t[46];let F;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(F=s?null:(0,Q.jsx)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=F):F=t[52];let I;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(I=n.revoked?null:(0,Q.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(B,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=I):I=t[57];let L;t[58]!==A||t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I?(L=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[A,N,P,F,I]}),t[58]=A,t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==E||t[65]!==l||t[66]!==L?(R=(0,Q.jsxs)(`div`,{className:l,children:[E,L]}),t[64]=E,t[65]=l,t[66]=L,t[67]=R):R=t[67],R}function St(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Ct={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},wt={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Tt(e){let t=(0,X.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=me(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=me(u),f=me(Et),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(ge,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,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`,children:(0,Q.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Et(e){return e.stop}function Dt(e,t){let n=_e(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=_e(e);return!r||n.split(`
|
|
3
3
|
`)[0]===r?n:[r,n].filter(Boolean).join(`
|
|
4
4
|
|
|
5
|
-
`)}var Ot=()=>i(()=>import(`./block-editor-BKWv_VZ-.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,47,48,49])),kt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([50,1,47,5,51,52,3])),At=(0,Z.lazy)(()=>Ot().then(e=>({default:e.BlockEditor}))),jt=(0,Z.lazy)(()=>kt().then(e=>({default:e.MarkdownEditor})));function Mt(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Nt(e){let t=(0,X.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:V},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:he},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Ge},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;t[10]!==n||t[11]!==l?(u=l.find(e=>e.id===n)??l[0],t[10]=n,t[11]=l,t[12]=u):u=t[12];let d=u,f=d.Icon,m=Pt,h;t[13]===f?h=t[14]:(h=(0,Q.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[13]=f,t[14]=h);let g;t[15]===d.label?g=t[16]:(g=(0,Q.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Te,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=_):_=t[17];let v;t[18]!==d.label||t[19]!==h||t[20]!==g?(v=(0,Q.jsx)(Ue,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":d.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium 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:[h,g,_]})}),t[18]=d.label,t[19]=h,t[20]=g,t[21]=v):v=t[21];let y;t[22]!==n||t[23]!==l||t[24]!==r?(y=(0,Q.jsx)(Ee,{children:(0,Q.jsx)(je,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,Q.jsxs)(Oe,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(t),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,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=l,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==y||t[27]!==v?(b=(0,Q.jsxs)(ve,{modal:!1,children:[v,y]}),t[26]=y,t[27]=v,t[28]=b):b=t[28],b}function Pt(e){e===`wysiwyg`&&Ot(),e===`source`&&kt()}function Ft(e){let t=(0,X.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=w(It),g;t[0]===h?g=t[1]:(g=S(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,Q.jsx)(Lt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(Xe,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function It(e){return e.language}function Lt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:u}){let d=w(e=>e.language),f=S(d).notes,m=S(d).automations.suggestions,h=a(),g=O(e=>e.resolved)===`dark`,{openImage:_}=Je(),[v,y]=(0,Z.useState)(l),[b,x]=(0,Z.useState)(null),[C,D]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(``),[I,z]=(0,Z.useState)(360),[ee,ne]=(0,Z.useState)(!1),[V,ae]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(!1),[H,U]=(0,Z.useState)(null),[de,fe]=(0,Z.useState)(!1),[pe,he]=(0,Z.useState)(null),[ge,_e]=(0,Z.useState)(!1),[Se,we]=(0,Z.useState)(!1),Te=(0,Z.useRef)(!1),De=(0,Z.useRef)(!1),W=(0,Z.useRef)(null),G=(0,Z.useRef)(null),K=(0,Z.useRef)(null),q=(0,Z.useRef)(null),ke=(0,Z.useRef)(null),Ae=(0,Z.useRef)(null),Ne=(0,Z.useRef)(null),Ie=(0,Z.useRef)(null),Le=(0,Z.useRef)(null),Re=Fe(e=>e.setPageHeader),ze=Fe(e=>e.clearPageHeader),{data:J,mutate:Y,error:We}=E(e?[`note-detail`,e]:null,()=>ce(e)),{data:Ge=[],mutate:Ke}=E(e?[`note-threads`,e]:null,()=>te(e),{revalidateOnFocus:!1}),X=C!==null,qe=(0,Z.useCallback)(e=>{U(`${f.refreshFailed}: ${e instanceof Error?e.message:f.quickCaptureFailedHint}`)},[f.quickCaptureFailedHint,f.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y().catch(qe)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e,qe]),(0,Z.useEffect)(()=>{Te.current=!1,P(``),D(null),x(null),De.current=!1,Le.current=null},[e]),(0,Z.useEffect)(()=>{!J||Te.current||(P(J.title??``),Te.current=!0)},[J]),(0,Z.useEffect)(()=>{if(!c||!J||X||Le.current===e)return;let t=window.requestAnimationFrame(()=>{Ie.current?.focus(),u?.()});return Le.current=e,()=>window.cancelAnimationFrame(t)},[c,X,J,e,u]);let Ye=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Xe=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":f.back,className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,xe,i),children:(0,Q.jsx)(j,{className:`size-4`,"aria-hidden":!0})}):null,[i,f.back,t,r]),$=(0,Z.useCallback)(()=>{let t=me.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),Ze=(0,Z.useCallback)(e=>{e!==`preview`&&$(),y(e)},[$]),Qe=(0,Z.useCallback)(t=>{$(),P(t),e&&(q.current=t,G.current&&clearTimeout(G.current),G.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){A(!0);try{await ue(e,{title:t}),await Y(),n?.()}catch{}finally{A(!1)}}},600))},[$,e,Y,n]),$e=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-2`,xe),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:N||Ye||void 0,children:N||Ye}),k?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:f.saving}):null]}),[f.saving,k,Ye,N]),et=(0,Z.useCallback)(async(t=!1)=>{se(!0),U(null);try{let n=await re(e,{forceNew:t});await Y(),await Ke(),h(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){U(`${f.chatOpenFailedTitle}: ${e instanceof Error?e.message:f.chatOpenFailedMessage}`)}finally{se(!1)}},[Y,Ke,h,e,f.chatOpenFailedMessage,f.chatOpenFailedTitle]),tt=(0,Z.useCallback)(async()=>{ae(!0),U(null);try{await be(e),await Y()}catch(e){U(`${f.catalysisFailed}: ${e instanceof Error?e.message:f.chatOpenFailedMessage}`)}finally{ae(!1)}},[Y,e]),nt=(0,Z.useCallback)(()=>{x(b===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!V&&tt()},[b,V,tt,J?.aiDeep?.catalysis?.report]),it=(0,Z.useCallback)(()=>{let t=C?C.markdown??``:K.current??J?.markdown??``,n=C?C.title??``:N,r=Dt(n,t);return{source:{type:`note`,id:e,title:n||f.titlePlaceholder},text:r,language:ie(r,d)}},[d,f.titlePlaceholder,J?.markdown,e,C,N]),at=(0,Z.useCallback)(async()=>{W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current),W.current=null,G.current=null;let t=K.current,r=q.current;K.current=null,q.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return J??null;A(!0);try{let t=await ue(e,i);return await Y(t,{revalidate:!1}),n?.(),t}catch(e){return U(`${f.saveFailed}: ${e instanceof Error?e.message:f.saveFailedHint}`),null}finally{A(!1)}},[Y,f.saveFailed,f.saveFailedHint,J,e,n]),ot=(0,Z.useCallback)(async()=>{U(null);let e=await at();e&&(he(e),fe(!0))},[at]),st=(0,Z.useCallback)(async()=>{if(!(Se||k)){_e(!1),we(!0),U(null),$(),W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current),W.current=null,G.current=null,K.current=null,q.current=null;try{await Ve(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){U(`${f.deleteFailed}: ${e instanceof Error?e.message:f.quickCaptureFailedHint}`)}finally{we(!1)}}},[Se,f.deleteFailed,f.quickCaptureFailedHint,e,t,n,k,$]),ct=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:T(`flex items-center gap-2`,xe),children:[s?(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.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,Q.jsx)(Pe,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(Tt,{input:it,showLabel:!1,labels:{read:f.readAloud,preparing:f.readAloudPreparing,pause:f.readAloudPause,resume:f.readAloudResume,retry:f.readAloudRetry,stop:f.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:nt,disabled:V,"aria-label":f.catalysisSectionTitle,className:T(`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,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),V?f.catalyzing:f.catalyzeButton]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>et(!1),disabled:oe,className:T(`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,Q.jsx)(L,{className:`size-3.5`,"aria-hidden":!0}),oe?f.openingChat:f.openChatButton]}),(0,Q.jsx)(Nt,{mode:v,onModeChange:Ze,labels:{edit:f.modeEdit,source:f.modeSource,preview:f.modePreview}}),(0,Q.jsxs)(ve,{modal:!1,children:[(0,Q.jsx)(Ue,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":f.noteActions,title:f.noteActions,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`,children:(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(Ee,{children:(0,Q.jsxs)(je,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(Oe,{onSelect:()=>void ot(),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,Q.jsx)(Ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),d===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(Oe,{onSelect:()=>x(b===`history`?null:`history`),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,Q.jsx)(He,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:f.history}),b===`history`?(0,Q.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(Be,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(Oe,{disabled:Se||k,onSelect:()=>_e(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(B,{className:`size-4`,"aria-hidden":!0}),f.delete]})]})})]})]}),[V,nt,et,v,f.history,f.modeEdit,f.modePreview,f.modeSource,oe,b,s,f.searchDialogTitle,f.readAloud,f.readAloudPause,f.readAloudPreparing,f.readAloudResume,f.readAloudRetry,f.readAloudStop,Ze,it,ot,Se,k,d,f.delete,_e]);(0,Z.useLayoutEffect)(()=>(Re({startExtra:Xe,main:J?$e:null,end:J?ct:null}),()=>{o&&ze()}),[o,ze,ct,$e,Xe,J,Re]);let lt=(0,Z.useCallback)(t=>{e&&($(),K.current=t,W.current&&clearTimeout(W.current),W.current=setTimeout(async()=>{let t=K.current;if(K.current=null,t!==null){A(!0),U(null);try{await ue(e,{markdown:t}),await Y(),n?.()}catch(e){U(`${f.saveFailed}: ${e instanceof Error?e.message:f.saveFailedHint}`)}finally{A(!1)}}},600))},[$,e,Y,f.saveFailed,f.saveFailedHint,n]),dt=(0,Z.useCallback)(t=>{F(e,t.timestamp).then(e=>{e&&($(),D(e))})},[e,$]),ft=(0,Z.useCallback)(()=>{$(),x(null),D(null)},[$]),pt=(0,Z.useCallback)(()=>{$(),x(null),D(null),Y().catch(qe),n?.()},[Y,n,qe,$]);if((0,Z.useEffect)(()=>()=>{W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current);let t=K.current,n=q.current;K.current=null,q.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&ue(e,r).catch(()=>void 0)},[e]),J===void 0)return We?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:f.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void Y().catch(qe),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:f.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:f.back})]}):(0,Q.jsx)(Mt,{});if(J===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:f.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.notFoundDescription}),(0,Q.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:f.back})]});let mt=X?C.title??``:N,ht=X?C.markdown??``:K.current??J.markdown??``,vt=new Date(J.createdAt).getTime(),bt=Number.isFinite(vt)&&Date.now()-vt<3600*1e3?(0,Q.jsx)(rt,{title:m.noteCreatedTitle,description:m.noteCreatedDescription,prompt:m.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[H?(0,Q.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:H}):null,(0,Q.jsx)(ye,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(ye,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsxs)(`div`,{ref:ke,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,Q.jsx)(ut,{noteId:e}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:X?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[mt&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:mt}),ht?(0,Q.jsx)(R,{noteId:e,content:ht,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:f.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[v===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ie,type:`text`,value:N,onChange:e=>Qe(e.target.value),onCompositionStart:()=>{De.current=!0},onCompositionEnd:()=>{De.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!De.current&&!t.isComposing&&(e.preventDefault(),(ke.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:f.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`}),bt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Mt,{}),children:(0,Q.jsx)(At,{initialContent:J.markdown??``,onChange:lt,noteId:e},`wysiwyg-${e}`)})})]}),v===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ie,type:`text`,value:N,onChange:e=>Qe(e.target.value),placeholder:f.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`}),bt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Mt,{}),children:(0,Q.jsx)(jt,{initialContent:J.markdown??``,onChange:lt,isDark:g},`source-${e}`)})})]}),v===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&_(t.currentSrc||t.src,t.alt)},children:[N&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:N}),J.markdown?(0,Q.jsx)(R,{noteId:e,content:J.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:f.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:Ae,className:T(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ee&&`transition-[width] duration-300 ease-in-out`),style:{width:b?I:0},children:(0,Q.jsxs)(`div`,{ref:Ne,className:`flex min-h-0 flex-1 flex-col`,style:{width:I},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ne(!0);let n=e.clientX,r=I,i=e.pointerId,a=0,o=I,s=I,c=()=>{a=0,s=o,b&&Ae.current?.style.setProperty(`width`,`${s}px`),Ne.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{}ne(!1),z(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:T(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,ee&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.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,Q.jsx)(gt,{noteId:e,activeTimestamp:C?.timestamp??null,onSelect:dt,onClose:ft,onRestored:pt}):b===`breakdown`?(0,Q.jsx)(_t,{noteId:e,note:J??null,catalyzing:V,onCatalyze:tt,onClose:()=>x(null),noteThreads:Ge,openingChat:oe,onOpenChat:()=>et(!1),onOpenNewChat:()=>et(!0)}):null})]})})]}),pe?(0,Q.jsx)(yt,{open:de,onOpenChange:fe,note:pe}):null,(0,Q.jsx)(le,{open:ge,title:f.deleteConfirmTitle,description:f.deleteConfirmDescription.replace(`{{title}}`,J.title||f.titlePlaceholder),confirmLabel:f.deleteConfirmLabel,cancelLabel:f.deleteCancelLabel,destructive:!0,onConfirm:()=>void st(),onCancel:()=>_e(!1)})]})}export{Je as a,et as i,nt as n,tt as r,Ft as t};
|
|
5
|
+
`)}var Ot=()=>i(()=>import(`./block-editor-DzSu62js.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,47,48,49])),kt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([50,1,47,5,51,52,3])),At=(0,Z.lazy)(()=>Ot().then(e=>({default:e.BlockEditor}))),jt=(0,Z.lazy)(()=>kt().then(e=>({default:e.MarkdownEditor})));function Mt(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Nt(e){let t=(0,X.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:V},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:he},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Ge},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;t[10]!==n||t[11]!==l?(u=l.find(e=>e.id===n)??l[0],t[10]=n,t[11]=l,t[12]=u):u=t[12];let d=u,f=d.Icon,m=Pt,h;t[13]===f?h=t[14]:(h=(0,Q.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[13]=f,t[14]=h);let g;t[15]===d.label?g=t[16]:(g=(0,Q.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Te,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=_):_=t[17];let v;t[18]!==d.label||t[19]!==h||t[20]!==g?(v=(0,Q.jsx)(Ue,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":d.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium 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:[h,g,_]})}),t[18]=d.label,t[19]=h,t[20]=g,t[21]=v):v=t[21];let y;t[22]!==n||t[23]!==l||t[24]!==r?(y=(0,Q.jsx)(Ee,{children:(0,Q.jsx)(je,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,Q.jsxs)(Oe,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(t),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,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=l,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==y||t[27]!==v?(b=(0,Q.jsxs)(ve,{modal:!1,children:[v,y]}),t[26]=y,t[27]=v,t[28]=b):b=t[28],b}function Pt(e){e===`wysiwyg`&&Ot(),e===`source`&&kt()}function Ft(e){let t=(0,X.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=w(It),g;t[0]===h?g=t[1]:(g=S(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,Q.jsx)(Lt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(Xe,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function It(e){return e.language}function Lt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:u}){let d=w(e=>e.language),f=S(d).notes,m=S(d).automations.suggestions,h=a(),g=O(e=>e.resolved)===`dark`,{openImage:_}=Je(),[v,y]=(0,Z.useState)(l),[b,x]=(0,Z.useState)(null),[C,D]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(``),[I,z]=(0,Z.useState)(360),[ee,ne]=(0,Z.useState)(!1),[V,ae]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(!1),[H,U]=(0,Z.useState)(null),[de,fe]=(0,Z.useState)(!1),[pe,he]=(0,Z.useState)(null),[ge,_e]=(0,Z.useState)(!1),[Se,we]=(0,Z.useState)(!1),Te=(0,Z.useRef)(!1),De=(0,Z.useRef)(!1),W=(0,Z.useRef)(null),G=(0,Z.useRef)(null),K=(0,Z.useRef)(null),q=(0,Z.useRef)(null),ke=(0,Z.useRef)(null),Ae=(0,Z.useRef)(null),Ne=(0,Z.useRef)(null),Ie=(0,Z.useRef)(null),Le=(0,Z.useRef)(null),Re=Fe(e=>e.setPageHeader),ze=Fe(e=>e.clearPageHeader),{data:J,mutate:Y,error:We}=E(e?[`note-detail`,e]:null,()=>ce(e)),{data:Ge=[],mutate:Ke}=E(e?[`note-threads`,e]:null,()=>te(e),{revalidateOnFocus:!1}),X=C!==null,qe=(0,Z.useCallback)(e=>{U(`${f.refreshFailed}: ${e instanceof Error?e.message:f.quickCaptureFailedHint}`)},[f.quickCaptureFailedHint,f.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y().catch(qe)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e,qe]),(0,Z.useEffect)(()=>{Te.current=!1,P(``),D(null),x(null),De.current=!1,Le.current=null},[e]),(0,Z.useEffect)(()=>{!J||Te.current||(P(J.title??``),Te.current=!0)},[J]),(0,Z.useEffect)(()=>{if(!c||!J||X||Le.current===e)return;let t=window.requestAnimationFrame(()=>{Ie.current?.focus(),u?.()});return Le.current=e,()=>window.cancelAnimationFrame(t)},[c,X,J,e,u]);let Ye=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Xe=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":f.back,className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,xe,i),children:(0,Q.jsx)(j,{className:`size-4`,"aria-hidden":!0})}):null,[i,f.back,t,r]),$=(0,Z.useCallback)(()=>{let t=me.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),Ze=(0,Z.useCallback)(e=>{e!==`preview`&&$(),y(e)},[$]),Qe=(0,Z.useCallback)(t=>{$(),P(t),e&&(q.current=t,G.current&&clearTimeout(G.current),G.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){A(!0);try{await ue(e,{title:t}),await Y(),n?.()}catch{}finally{A(!1)}}},600))},[$,e,Y,n]),$e=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-2`,xe),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:N||Ye||void 0,children:N||Ye}),k?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:f.saving}):null]}),[f.saving,k,Ye,N]),et=(0,Z.useCallback)(async(t=!1)=>{se(!0),U(null);try{let n=await re(e,{forceNew:t});await Y(),await Ke(),h(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){U(`${f.chatOpenFailedTitle}: ${e instanceof Error?e.message:f.chatOpenFailedMessage}`)}finally{se(!1)}},[Y,Ke,h,e,f.chatOpenFailedMessage,f.chatOpenFailedTitle]),tt=(0,Z.useCallback)(async()=>{ae(!0),U(null);try{await be(e),await Y()}catch(e){U(`${f.catalysisFailed}: ${e instanceof Error?e.message:f.chatOpenFailedMessage}`)}finally{ae(!1)}},[Y,e]),nt=(0,Z.useCallback)(()=>{x(b===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!V&&tt()},[b,V,tt,J?.aiDeep?.catalysis?.report]),it=(0,Z.useCallback)(()=>{let t=C?C.markdown??``:K.current??J?.markdown??``,n=C?C.title??``:N,r=Dt(n,t);return{source:{type:`note`,id:e,title:n||f.titlePlaceholder},text:r,language:ie(r,d)}},[d,f.titlePlaceholder,J?.markdown,e,C,N]),at=(0,Z.useCallback)(async()=>{W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current),W.current=null,G.current=null;let t=K.current,r=q.current;K.current=null,q.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return J??null;A(!0);try{let t=await ue(e,i);return await Y(t,{revalidate:!1}),n?.(),t}catch(e){return U(`${f.saveFailed}: ${e instanceof Error?e.message:f.saveFailedHint}`),null}finally{A(!1)}},[Y,f.saveFailed,f.saveFailedHint,J,e,n]),ot=(0,Z.useCallback)(async()=>{U(null);let e=await at();e&&(he(e),fe(!0))},[at]),st=(0,Z.useCallback)(async()=>{if(!(Se||k)){_e(!1),we(!0),U(null),$(),W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current),W.current=null,G.current=null,K.current=null,q.current=null;try{await Ve(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){U(`${f.deleteFailed}: ${e instanceof Error?e.message:f.quickCaptureFailedHint}`)}finally{we(!1)}}},[Se,f.deleteFailed,f.quickCaptureFailedHint,e,t,n,k,$]),ct=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:T(`flex items-center gap-2`,xe),children:[s?(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.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,Q.jsx)(Pe,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(Tt,{input:it,showLabel:!1,labels:{read:f.readAloud,preparing:f.readAloudPreparing,pause:f.readAloudPause,resume:f.readAloudResume,retry:f.readAloudRetry,stop:f.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:nt,disabled:V,"aria-label":f.catalysisSectionTitle,className:T(`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,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),V?f.catalyzing:f.catalyzeButton]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>et(!1),disabled:oe,className:T(`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,Q.jsx)(L,{className:`size-3.5`,"aria-hidden":!0}),oe?f.openingChat:f.openChatButton]}),(0,Q.jsx)(Nt,{mode:v,onModeChange:Ze,labels:{edit:f.modeEdit,source:f.modeSource,preview:f.modePreview}}),(0,Q.jsxs)(ve,{modal:!1,children:[(0,Q.jsx)(Ue,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":f.noteActions,title:f.noteActions,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`,children:(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(Ee,{children:(0,Q.jsxs)(je,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(Oe,{onSelect:()=>void ot(),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,Q.jsx)(Ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),d===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(Oe,{onSelect:()=>x(b===`history`?null:`history`),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,Q.jsx)(He,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:f.history}),b===`history`?(0,Q.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(Be,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(Oe,{disabled:Se||k,onSelect:()=>_e(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(B,{className:`size-4`,"aria-hidden":!0}),f.delete]})]})})]})]}),[V,nt,et,v,f.history,f.modeEdit,f.modePreview,f.modeSource,oe,b,s,f.searchDialogTitle,f.readAloud,f.readAloudPause,f.readAloudPreparing,f.readAloudResume,f.readAloudRetry,f.readAloudStop,Ze,it,ot,Se,k,d,f.delete,_e]);(0,Z.useLayoutEffect)(()=>(Re({startExtra:Xe,main:J?$e:null,end:J?ct:null}),()=>{o&&ze()}),[o,ze,ct,$e,Xe,J,Re]);let lt=(0,Z.useCallback)(t=>{e&&($(),K.current=t,W.current&&clearTimeout(W.current),W.current=setTimeout(async()=>{let t=K.current;if(K.current=null,t!==null){A(!0),U(null);try{await ue(e,{markdown:t}),await Y(),n?.()}catch(e){U(`${f.saveFailed}: ${e instanceof Error?e.message:f.saveFailedHint}`)}finally{A(!1)}}},600))},[$,e,Y,f.saveFailed,f.saveFailedHint,n]),dt=(0,Z.useCallback)(t=>{F(e,t.timestamp).then(e=>{e&&($(),D(e))})},[e,$]),ft=(0,Z.useCallback)(()=>{$(),x(null),D(null)},[$]),pt=(0,Z.useCallback)(()=>{$(),x(null),D(null),Y().catch(qe),n?.()},[Y,n,qe,$]);if((0,Z.useEffect)(()=>()=>{W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current);let t=K.current,n=q.current;K.current=null,q.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&ue(e,r).catch(()=>void 0)},[e]),J===void 0)return We?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:f.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void Y().catch(qe),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:f.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:f.back})]}):(0,Q.jsx)(Mt,{});if(J===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:f.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.notFoundDescription}),(0,Q.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:f.back})]});let mt=X?C.title??``:N,ht=X?C.markdown??``:K.current??J.markdown??``,vt=new Date(J.createdAt).getTime(),bt=Number.isFinite(vt)&&Date.now()-vt<3600*1e3?(0,Q.jsx)(rt,{title:m.noteCreatedTitle,description:m.noteCreatedDescription,prompt:m.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[H?(0,Q.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:H}):null,(0,Q.jsx)(ye,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(ye,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsxs)(`div`,{ref:ke,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,Q.jsx)(ut,{noteId:e}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:X?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[mt&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:mt}),ht?(0,Q.jsx)(R,{noteId:e,content:ht,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:f.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[v===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ie,type:`text`,value:N,onChange:e=>Qe(e.target.value),onCompositionStart:()=>{De.current=!0},onCompositionEnd:()=>{De.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!De.current&&!t.isComposing&&(e.preventDefault(),(ke.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:f.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`}),bt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Mt,{}),children:(0,Q.jsx)(At,{initialContent:J.markdown??``,onChange:lt,noteId:e},`wysiwyg-${e}`)})})]}),v===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ie,type:`text`,value:N,onChange:e=>Qe(e.target.value),placeholder:f.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`}),bt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Mt,{}),children:(0,Q.jsx)(jt,{initialContent:J.markdown??``,onChange:lt,isDark:g},`source-${e}`)})})]}),v===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&_(t.currentSrc||t.src,t.alt)},children:[N&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:N}),J.markdown?(0,Q.jsx)(R,{noteId:e,content:J.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:f.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:Ae,className:T(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ee&&`transition-[width] duration-300 ease-in-out`),style:{width:b?I:0},children:(0,Q.jsxs)(`div`,{ref:Ne,className:`flex min-h-0 flex-1 flex-col`,style:{width:I},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ne(!0);let n=e.clientX,r=I,i=e.pointerId,a=0,o=I,s=I,c=()=>{a=0,s=o,b&&Ae.current?.style.setProperty(`width`,`${s}px`),Ne.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{}ne(!1),z(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:T(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,ee&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.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,Q.jsx)(gt,{noteId:e,activeTimestamp:C?.timestamp??null,onSelect:dt,onClose:ft,onRestored:pt}):b===`breakdown`?(0,Q.jsx)(_t,{noteId:e,note:J??null,catalyzing:V,onCatalyze:tt,onClose:()=>x(null),noteThreads:Ge,openingChat:oe,onOpenChat:()=>et(!1),onOpenNewChat:()=>et(!0)}):null})]})})]}),pe?(0,Q.jsx)(yt,{open:de,onOpenChange:fe,note:pe}):null,(0,Q.jsx)(le,{open:ge,title:f.deleteConfirmTitle,description:f.deleteConfirmDescription.replace(`{{title}}`,J.title||f.titlePlaceholder),confirmLabel:f.deleteConfirmLabel,cancelLabel:f.deleteCancelLabel,destructive:!0,onConfirm:()=>void st(),onCancel:()=>_e(!1)})]})}export{Je as a,et as i,nt as n,tt as r,Ft as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,h as a,p as o,u as s}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as c}from"./popover-select-CKBYnT3c.js";import{d as l}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{d as i,h as a,p as o,u as s}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as c}from"./popover-select-CKBYnT3c.js";import{d as l}from"./markdown-view-BxoQJqHx.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-Cf1h5WXB.js";import{d as m,n as h,s as g}from"./locale-store-RJHYFoq9.js";import{t as _}from"./cn-JdwAhgNB.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./skeleton-BwbyijEw.js";import{An as b,Au as ee,Bl as x,Dl as te,Du as S,Eu as C,Hs as ne,Lc as re,Mu as w,Nc as T,Nn as E,Oi as ie,Pa as D,Pl as O,Pn as k,Sn as A,Ui as ae,Un as j,Vc as M,Wn as N,Zs as oe,_n as se,bo as ce,bu as le,gn as ue,hn as de,ku as fe,mc as P,ml as pe,mn as me,nc as he,pc as ge,pu as F,qn as _e,ro as ve,wn as ye,yn as be}from"./index-DQtjs2x3.js";import{i as xe,t as I}from"./note-detail-panel-CCbPg_GP.js";var L=e(t(),1),R=n();async function z(e){e.note??=await A({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await N(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${_e(t,e.id)})`);e.note=await j(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
2
|
|
|
3
3
|
`)}`})}return{noteId:t,sessionKey:(await k(t,{projectId:e.projectId})).sessionKey}}function Se(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var B=r(),V={meeting:C,requirements:O,research:P,weekly:F};function Ce({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:a,projectsLoading:o,projectsError:s}){let l=a.home,d=i(),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)(null),[v,y]=(0,L.useState)([]),[b,ee]=(0,L.useState)(!1),[x,C]=(0,L.useState)(null),[ne,re]=(0,L.useState)(``),w=(0,L.useRef)(null),E=(0,L.useRef)(!1),ie=(0,L.useRef)(null),O=(0,L.useRef)(null),k=b||!!w.current,A=h?l.templateOptions[h]:null,ae=!!(p.trim()||v.length);async function j(){if(!(E.current||!ae&&!w.current)){E.current=!0,ee(!0),C(null),w.current??={requestId:crypto.randomUUID(),title:p.trim().split(`
|
|
4
4
|
`)[0]?.slice(0,80)||A?.label||a.titlePlaceholder,markdown:`## ${l.requestHeading}\n\n${A?`${A.prompt}\n`:``}${p.trim()}`,projectId:t||void 0,files:[...v],attachments:[],materialHeading:l.materialsHeading};try{let e=await z(w.current);r(),d(Se(e.sessionKey,e.noteId,l.agentPrompt))}catch(e){w.current.note&&r(),C(e instanceof Error?e.message:a.quickCaptureFailedHint)}finally{E.current=!1,ee(!1)}}}function N(){w.current=null,C(null),m(``),y([]),g(null),O.current?.focus()}return(0,B.jsxs)(`section`,{"aria-label":l.askLabel,children:[(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),j()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,B.jsxs)(`fieldset`,{disabled:k,className:`min-w-0`,children:[(0,B.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,B.jsx)(he,{className:`size-4`,"aria-hidden":!0}),l.askLabel]}),A?(0,B.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,B.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[A.label,` · `]}),A.prompt.split(`
|
|
@@ -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{as 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{as as a}from"./index-DQtjs2x3.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{as 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{as as o}from"./index-DQtjs2x3.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{r as n,t as r,u as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a,r as o}from"./product-delivery-CV4pDOtG.js";import{n as s}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r,u as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a,r as o}from"./product-delivery-CV4pDOtG.js";import{n as s}from"./locale-store-RJHYFoq9.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{n as u}from"./api-YbtjDbuG.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=i(),r=s(h)===`zh`,m=o(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=r?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[0]=t,e[1]=r,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=a({...m,title:m.id,capabilities:[`open`]}),i;return e[3]!==t||e[4]!==r?(i=t?(0,p.jsx)(n,{to:t,replace:!0}):(0,p.jsx)(g,{message:r?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:r}),e[3]=t,e[4]=r,e[5]=i):i=e[5],i}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?r?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:r?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[6]=t,e[7]=r,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 r;return e[11]===t?r=e[12]:(r=(0,p.jsx)(n,{to:t,replace:!0}),e[11]=t,e[12]=r),r}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:i}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=i?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(r,{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};
|