@nextclaw/ui 0.12.20-beta.6 → 0.12.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +322 -0
  2. package/dist/assets/api-lwyw9j7i.js +15 -0
  3. package/dist/assets/{app-manager-provider-BZr5VxCe.js → app-manager-provider-C0ONQxUg.js} +1 -1
  4. package/dist/assets/{app-navigation.config-BjIj_FLm.js → app-navigation.config-DgiR0c5_.js} +1 -1
  5. package/dist/assets/{channels-list-page-L6FFtRYn.js → channels-list-page-Dl839n02.js} +1 -1
  6. package/dist/assets/{chat-ZQIVJChB.js → chat-DwUf7AKR.js} +36 -36
  7. package/dist/assets/chat-page-B-FvPmA7.js +1 -0
  8. package/dist/assets/{desktop-update-config-AXzb7OEa.js → desktop-update-config-D5g_gPak.js} +1 -1
  9. package/dist/assets/{dialog-DgybjpeU.js → dialog-CdtCU2xX.js} +1 -1
  10. package/dist/assets/{dist-CxcPOISF.js → dist-CuqvE--P.js} +1 -1
  11. package/dist/assets/{es2015-BVRlEE06.js → es2015-yYU5Ad5w.js} +1 -1
  12. package/dist/assets/{index-B7RsQ-ne.js → index-Doxyk7L2.js} +2 -2
  13. package/dist/assets/marketplace-page-BRHkZaO5.js +1 -0
  14. package/dist/assets/{marketplace-page-ClRW-W3g.js → marketplace-page-CawcdL6Y.js} +1 -1
  15. package/dist/assets/mcp-marketplace-page-CL7BF4dD.js +1 -0
  16. package/dist/assets/{mcp-marketplace-page-DtngnIi0.js → mcp-marketplace-page-DEGfJ_70.js} +1 -1
  17. package/dist/assets/{model-config-D_y8F0j6.js → model-config-r-1RPSrZ.js} +1 -1
  18. package/dist/assets/{notice-card-uzwjFyML.js → notice-card-BPtCVEKW.js} +1 -1
  19. package/dist/assets/{popover-C8tMB7tR.js → popover-jbfQhYQh.js} +1 -1
  20. package/dist/assets/{provider-scoped-model-input-ORZutTDv.js → provider-scoped-model-input-gdk2lmRi.js} +1 -1
  21. package/dist/assets/{providers-list-DSc3d8me.js → providers-list-DpISIr3M.js} +1 -1
  22. package/dist/assets/remote-BnRNqMlb.js +1 -0
  23. package/dist/assets/{runtime-config-page-B4uSax1I.js → runtime-config-page-DQ8YY8Lc.js} +1 -1
  24. package/dist/assets/{search-config-CaqqlsdW.js → search-config-BWqz8nqY.js} +1 -1
  25. package/dist/assets/{secrets-config-llf5ROde.js → secrets-config-CjzSNg0Y.js} +1 -1
  26. package/dist/assets/{select-uO-zhYsH.js → select-Cw5Zkb1w.js} +1 -1
  27. package/dist/assets/{sessions-config-page-BqOXte9x.js → sessions-config-page-beoDPtII.js} +2 -2
  28. package/dist/assets/{setting-row-BIiXR4hx.js → setting-row-Cjl2d40s.js} +1 -1
  29. package/dist/assets/{tag-chip-DVbgpsYW.js → tag-chip-CoWHxYJj.js} +1 -1
  30. package/dist/assets/{theme-provider-BU77FNSB.js → theme-provider-B5XReW_-.js} +1 -1
  31. package/dist/assets/{tooltip-CvAtG-kT.js → tooltip-GYzH-Hfq.js} +1 -1
  32. package/dist/assets/{use-config-D2QgG7qc.js → use-config-BhJHD3-G.js} +1 -1
  33. package/dist/assets/{use-confirm-dialog-BBClFV8E.js → use-confirm-dialog-Bqgy3Gi-.js} +1 -1
  34. package/dist/assets/{use-infinite-scroll-loader-CWzpUecQ.js → use-infinite-scroll-loader-BfexitoF.js} +1 -1
  35. package/dist/assets/{use-viewport-layout-C6EN0_eq.js → use-viewport-layout-D33zVbr5.js} +1 -1
  36. package/dist/index.html +15 -15
  37. package/dist/sw.js +4 -7
  38. package/package.json +9 -9
  39. package/public/sw.js +4 -7
  40. package/src/app/hooks/use-app-event-consumers.ts +1 -1
  41. package/src/features/agents/components/agents-page.test.tsx +34 -19
  42. package/src/features/agents/components/agents-page.tsx +6 -18
  43. package/src/features/channels/components/config/channel-form.tsx +6 -2
  44. package/src/features/chat/index.ts +1 -1
  45. package/src/features/chat/managers/chat-session-list.manager.test.ts +24 -0
  46. package/src/features/chat/managers/chat-session-list.manager.ts +7 -0
  47. package/src/features/pwa/managers/pwa-service-worker-cache.manager.test.ts +16 -0
  48. package/src/features/system-status/components/desktop-update-config.tsx +1 -1
  49. package/src/features/system-status/managers/runtime-update.manager.ts +1 -3
  50. package/src/features/system-status/stores/runtime-update.store.ts +1 -1
  51. package/src/platforms/desktop/types/desktop-update.types.ts +1 -1
  52. package/src/shared/components/common/brand-header.tsx +1 -1
  53. package/src/shared/lib/api/README.md +4 -0
  54. package/src/shared/lib/api/index.ts +12 -12
  55. package/src/shared/lib/api/{services/client.service.ts → managers/client.manager.ts} +2 -2
  56. package/src/shared/lib/api/ncp-session.test.ts +3 -3
  57. package/src/shared/lib/api/{services/runtime-update.service.ts → runtime-update.utils.ts} +2 -2
  58. package/src/shared/lib/api/{services/agents.service.ts → utils/agents.utils.ts} +1 -1
  59. package/src/shared/lib/api/{services/channel-auth.service.ts → utils/channel-auth.utils.ts} +1 -1
  60. package/src/shared/lib/api/{services/config.service.ts → utils/config.utils.ts} +1 -1
  61. package/src/shared/lib/api/{services/marketplace.service.ts → utils/marketplace.utils.ts} +1 -1
  62. package/src/shared/lib/api/{services/mcp-marketplace.service.ts → utils/mcp-marketplace.utils.ts} +1 -1
  63. package/src/shared/lib/api/{services/ncp-attachments.service.ts → utils/ncp-attachments.utils.ts} +1 -1
  64. package/src/shared/lib/api/{services/ncp-session.service.ts → utils/ncp-session.utils.ts} +1 -1
  65. package/src/shared/lib/api/{services/remote.service.ts → utils/remote.utils.ts} +1 -1
  66. package/src/shared/lib/api/{services/runtime-control.service.ts → utils/runtime-control.utils.ts} +1 -1
  67. package/src/shared/lib/api/{services/server-path.service.ts → utils/server-path.utils.ts} +1 -1
  68. package/src/shared/lib/transport/transport.types.ts +1 -1
  69. package/tsconfig.json +2 -3
  70. package/vite.config.ts +1 -2
  71. package/vitest.config.ts +1 -2
  72. package/dist/assets/api-Dai6UR3J.js +0 -15
  73. package/dist/assets/chat-page-CR1yI96r.js +0 -1
  74. package/dist/assets/marketplace-page-Bj55-6F2.js +0 -1
  75. package/dist/assets/mcp-marketplace-page-_Wu2VnHy.js +0 -1
  76. package/dist/assets/remote-rWiu3cys.js +0 -1
@@ -1,2 +1,2 @@
1
- import{_ as e,i as t,m as n,n as r,p as i,t as a,u as o}from"./i18n-C5Mibli1.js";import{Mt as s,Ot as c,jt as l,kt as u}from"./api-Dai6UR3J.js";import{t as d}from"./createLucideIcon-BZkY6emz.js";import{_ as f,m as p}from"./theme-provider-BU77FNSB.js";import{t as m}from"./search-vChioOoe.js";import{F as h,L as g,O as _,d as v,u as y}from"./chat-ZQIVJChB.js";import{a as b,i as x,n as S,r as C,t as w}from"./select-uO-zhYsH.js";import{t as T}from"./refresh-cw-BxojR62w.js";import{t as E}from"./hash-zajSTDXZ.js";import{t as D}from"./settings-CiRChctQ.js";import{t as O}from"./use-viewport-layout-C6EN0_eq.js";import{S as k,c as A,f as j,m as M}from"./use-config-D2QgG7qc.js";import{a as N,c as P,i as F,o as I}from"./config-split-page-BMRGuCJQ.js";import{t as L}from"./use-confirm-dialog-BBClFV8E.js";var R=d(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),z=d(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),B=e(n(),1),V=i();function H(e){return e===`service`?`system`:e===`tool`?`tool`:e}function U(e){let t=[];for(let n of e.parts){if(n.type===`text`||n.type===`rich-text`||n.type===`reasoning`){t.push(n.text);continue}if(n.type!==`tool-invocation`)continue;let e=n.toolName?.trim()?`[${n.toolName.trim()}]`:`[tool]`;if(n.state===`result`&&typeof n.result==`string`&&n.result.trim()){t.push(`${e} ${n.result.trim()}`);continue}t.push(e)}return t.join(`
2
- `).trim()}function W({message:e}){let t=H(e.role),n=t===`user`,i=U(e);return(0,V.jsx)(`div`,{className:o(`flex w-full mb-6`,n?`justify-end`:`justify-start`),children:(0,V.jsxs)(`div`,{className:o(`max-w-[85%] rounded-[1.25rem] p-5 flex gap-3 text-sm`,n?`bg-primary text-white rounded-tr-sm`:`bg-gray-50 text-gray-800 rounded-tl-sm border border-gray-100/50`),children:[(0,V.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:n?(0,V.jsx)(g,{className:`w-4 h-4 text-primary-100`}):(0,V.jsx)(f,{className:`w-4 h-4 text-gray-400`})}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-1 overflow-x-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 mb-2`,children:[(0,V.jsx)(`span`,{className:o(`font-semibold text-xs capitalize`,n?`text-primary-50`:`text-gray-900`),children:t}),(0,V.jsx)(`span`,{className:o(`text-[10px]`,n?`text-primary-200`:`text-gray-400`),children:r(e.timestamp)})]}),(0,V.jsx)(`div`,{className:`whitespace-pre-wrap break-words leading-relaxed text-[15px]`,children:i||`-`})]})]})})}function G(e){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(e.session.label||``),[c,u]=(0,B.useState)(e.session.preferredModel||``);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>r(e=>!e),className:o(`h-8.5 rounded-lg shadow-none border-gray-200 transition-all text-xs font-semibold`,n?`bg-gray-100 text-gray-900`:`hover:bg-gray-50 hover:text-gray-900`),children:[(0,V.jsx)(D,{className:`w-3.5 h-3.5 mr-1.5`}),t(`sessionsMetadata`)]}),n?(0,V.jsxs)(`div`,{className:`flex items-center gap-3 bg-gray-50/50 p-3 rounded-lg border border-gray-100 animate-slide-in`,children:[(0,V.jsx)(l,{placeholder:t(`sessionsLabelPlaceholder`),value:i,onChange:e=>a(e.target.value),className:`h-8 text-sm bg-white`}),(0,V.jsx)(l,{placeholder:t(`sessionsModelPlaceholder`),value:c,onChange:e=>u(e.target.value),className:`h-8 text-sm bg-white`}),(0,V.jsx)(s,{size:`sm`,onClick:()=>{e.onSave({label:i,preferredModel:c}),r(!1)},className:`h-8 px-4 shrink-0 shadow-none`,disabled:e.isPending,children:t(`sessionsSaveMeta`)})]}):null]})}function K(){return(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-gray-400 p-8 h-full bg-white`,children:[(0,V.jsx)(`div`,{className:`w-20 h-20 bg-gray-50 rounded-3xl flex items-center justify-center mb-6 border border-gray-100 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.02)] rotate-3`,children:(0,V.jsx)(z,{className:`h-8 w-8 text-gray-300 -rotate-3`})}),(0,V.jsx)(`h3`,{className:`text-lg font-bold text-gray-900 mb-2`,children:t(`sessionsNoSelectionTitle`)}),(0,V.jsx)(`p`,{className:`text-sm text-center max-w-sm leading-relaxed`,children:t(`sessionsNoSelectionDescription`)})]})}function q(e){let n=j(e.sessionKey,300),r=k(),i=A(),{confirm:a,ConfirmDialog:o}=L();return(0,V.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col overflow-hidden relative bg-white rounded-2xl shadow-sm border border-gray-200`,children:[r.isPending||i.isPending?(0,V.jsx)(`div`,{className:`absolute top-0 left-0 w-full h-1 bg-primary/20 overflow-hidden z-20`,children:(0,V.jsx)(`div`,{className:`h-full bg-primary animate-pulse w-1/3 rounded-r-full`})}):null,e.sessionKey&&e.session&&e.summary&&e.channelLabel?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`shrink-0 border-b border-gray-100 bg-white px-4 py-4 z-10 space-y-4 sm:px-8 sm:py-5`,children:(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(`div`,{className:`h-12 w-12 rounded-[14px] bg-gray-50 border border-gray-100 flex items-center justify-center text-gray-400 shrink-0`,children:(0,V.jsx)(E,{className:`h-6 w-6`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-1.5`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-bold text-gray-900 tracking-tight`,children:e.session.label?.trim()||e.session.key.split(`:`).pop()||e.session.key}),(0,V.jsx)(`span`,{className:`text-[10px] font-bold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-widest`,children:e.channelLabel}),e.summary.status===`running`?(0,V.jsx)(h,{status:`running`,className:`h-4 w-4`}):null]}),(0,V.jsx)(`div`,{className:`text-xs text-gray-500 font-mono break-all line-clamp-1 opacity-70`,title:e.sessionKey,children:e.sessionKey})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,V.jsx)(G,{session:e.session,isPending:r.isPending,onSave:t=>{e.sessionKey&&r.mutate({sessionId:e.sessionKey,data:{label:t.label.trim()||null,preferredModel:t.preferredModel.trim()||null}})}},e.session.key),(0,V.jsx)(s,{variant:`outline`,size:`sm`,onClick:async()=>{e.sessionKey&&await a({title:t(`sessionsDeleteConfirm`)+`?`,variant:`destructive`,confirmLabel:t(`sessionsDeleteConfirm`)})&&i.mutate({sessionId:e.sessionKey},{onSuccess:()=>e.onClearSelection()})},className:`h-8.5 rounded-lg shadow-none hover:bg-red-50 hover:text-red-600 hover:border-red-200 border-gray-200 text-xs font-semibold text-red-500`,children:t(`delete`)})]})]})}),(0,V.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 relative [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-gray-300/80 [&::-webkit-scrollbar-thumb]:rounded-full sm:p-6`,children:[n.isLoading?(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-gray-50/50 backdrop-blur-sm z-10`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-3 animate-pulse`,children:[(0,V.jsx)(T,{className:`w-6 h-6 text-primary animate-spin`}),(0,V.jsx)(`span`,{className:`text-sm font-medium text-gray-500`,children:t(`sessionsHistoryLoading`)})]})}):null,n.error?(0,V.jsx)(`div`,{className:`text-center p-6 bg-red-50 rounded-xl text-red-600 border border-red-100 text-sm`,children:n.error.message}):null,!n.isLoading&&n.data?.messages.length===0?(0,V.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center text-gray-400`,children:[(0,V.jsx)(p,{className:`w-12 h-12 mb-3 text-gray-300`}),(0,V.jsx)(`p`,{className:`text-sm`,children:t(`sessionsEmpty`)})]}):null,(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(n.data?.messages??[]).map(e=>(0,V.jsx)(W,{message:e},e.id))})]})]}):(0,V.jsx)(K,{}),(0,V.jsx)(o,{})]})}var J=`__unknown_channel__`;function Y(e){let t=e.indexOf(`:`);return t<=0?J:e.slice(0,t).trim()||J}function X(e){return e===J?t(`sessionsUnknownChannel`):e}function Z(e){return(0,V.jsxs)(`button`,{onClick:e.onSelect,className:o(`w-full text-left p-3.5 rounded-xl transition-all duration-200 outline-none focus:outline-none focus:ring-0 group`,e.isSelected?`bg-brand-50 border border-brand-100/50`:`bg-transparent border border-transparent hover:bg-gray-50/80`),children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between mb-1.5`,children:[(0,V.jsx)(`div`,{className:o(`font-semibold truncate pr-2 flex-1 text-sm`,e.isSelected?`text-brand-800`:`text-gray-900`),children:y(e.session)}),(0,V.jsx)(`div`,{className:o(`text-[10px] font-bold px-2 py-0.5 rounded-full shrink-0 capitalize`,e.isSelected?`bg-white text-brand-600 shadow-[0_1px_2px_rgba(0,0,0,0.02)]`:`bg-gray-100 text-gray-500`),children:e.channelLabel})]}),(0,V.jsxs)(`div`,{className:o(`flex items-center text-xs justify-between mt-2 font-medium`,e.isSelected?`text-brand-600/80`:`text-gray-400`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:e.summary.status===`running`?(0,V.jsx)(h,{status:`running`}):null}),(0,V.jsx)(R,{className:`w-3.5 h-3.5 opacity-70`}),(0,V.jsx)(`span`,{className:`truncate max-w-[100px]`,children:a(e.summary.updatedAt)})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(p,{className:`w-3.5 h-3.5 opacity-70`}),(0,V.jsx)(`span`,{children:e.summary.messageCount})]})]})]})}function Q(){let{isMobile:e}=O(),[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(null),[d,f]=(0,B.useState)(`all`),p=M({limit:100}),h=(0,B.useMemo)(()=>p.data?.sessions??[],[p.data?.sessions]),g=(0,B.useMemo)(()=>_(h),[h]),y=(0,B.useMemo)(()=>new Map(h.map(e=>[e.sessionId,e])),[h]),E=(0,B.useMemo)(()=>g.filter(e=>d!==`all`&&Y(e.key)!==d?!1:v(e,n)),[n,d,g]),D=(0,B.useMemo)(()=>{let e=new Set;for(let t of g)e.add(Y(t.key));return Array.from(e).sort((e,t)=>e===J?1:t===J?-1:e.localeCompare(t))},[g]),k=i&&y.has(i)?i:null,A=(0,B.useMemo)(()=>g.find(e=>e.key===k)??null,[k,g]),j=k?y.get(k)??null:null,L=A?X(Y(A.key)):null;return(0,V.jsxs)(u,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,V.jsx)(c,{title:t(`sessionsPageTitle`),description:t(`sessionsPageDescription`)}),(0,V.jsxs)(F,{className:`xl:min-h-0`,mobileView:e?k?`detail`:`list`:void 0,onMobileBack:()=>a(null),mobileListLabel:t(`sessionsPageTitle`),children:[(0,V.jsxs)(N,{className:`xl:w-[320px] xl:flex-none`,children:[(0,V.jsxs)(P,{className:`space-y-3 px-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] font-semibold text-gray-400 uppercase tracking-wider`,children:[g.length,` `,t(`sessionsListTitle`)]}),(0,V.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>p.refetch(),children:(0,V.jsx)(T,{className:o(`h-3.5 w-3.5`,p.isFetching&&`animate-spin`)})})]}),(0,V.jsxs)(w,{value:d,onValueChange:f,children:[(0,V.jsx)(x,{className:`w-full h-8.5 rounded-lg bg-gray-50/50 hover:bg-gray-100 border-gray-200 focus:ring-0 shadow-none text-xs font-medium text-gray-700`,children:(0,V.jsx)(b,{placeholder:t(`sessionsAllChannels`)})}),(0,V.jsxs)(S,{className:`rounded-xl shadow-lg border-gray-100 max-w-[280px]`,children:[(0,V.jsx)(C,{value:`all`,className:`rounded-lg text-xs`,children:t(`sessionsAllChannels`)}),D.map(e=>(0,V.jsx)(C,{value:e,className:`rounded-lg text-xs truncate pr-6`,children:X(e)},e))]})]}),(0,V.jsxs)(`div`,{className:`relative w-full`,children:[(0,V.jsx)(m,{className:`h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400`}),(0,V.jsx)(l,{value:n,onChange:e=>r(e.target.value),placeholder:t(`sessionsSearchPlaceholder`),className:`pl-8 h-8.5 rounded-lg bg-gray-50/50 border-gray-200 focus-visible:bg-white text-xs`})]})]}),(0,V.jsx)(I,{className:`space-y-1 p-3 pb-10`,children:p.isLoading?(0,V.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`sessionsLoading`)}):E.length===0?(0,V.jsxs)(`div`,{className:`text-sm text-gray-400 p-4 text-center border-2 border-dashed border-gray-100 rounded-xl mt-4`,children:[(0,V.jsx)(z,{className:`w-8 h-8 mx-auto mb-2 text-gray-300`}),t(`sessionsEmpty`)]}):E.map(e=>{let t=y.get(e.key);return t?(0,V.jsx)(Z,{session:e,summary:t,channelLabel:X(Y(e.key)),isSelected:k===e.key,onSelect:()=>a(e.key)},e.key):null})})]}),(0,V.jsx)(q,{sessionKey:k,session:A,summary:j,channelLabel:L,onClearSelection:()=>a(null)})]})]})}export{Q as SessionsConfig};
1
+ import{_ as e,i as t,m as n,n as r,p as i,t as a,u as o}from"./i18n-C5Mibli1.js";import{Mt as s,Ot as c,jt as l,kt as u}from"./api-lwyw9j7i.js";import{t as d}from"./createLucideIcon-BZkY6emz.js";import{_ as f,m as p}from"./theme-provider-B5XReW_-.js";import{t as m}from"./search-vChioOoe.js";import{I as h,O as g,R as _,d as v,u as y}from"./chat-DwUf7AKR.js";import{a as b,i as x,n as S,r as C,t as w}from"./select-Cw5Zkb1w.js";import{t as T}from"./refresh-cw-BxojR62w.js";import{t as E}from"./hash-zajSTDXZ.js";import{t as D}from"./settings-CiRChctQ.js";import{t as O}from"./use-viewport-layout-D33zVbr5.js";import{S as k,c as A,f as j,m as M}from"./use-config-BhJHD3-G.js";import{a as N,c as P,i as F,o as I}from"./config-split-page-BMRGuCJQ.js";import{t as L}from"./use-confirm-dialog-Bqgy3Gi-.js";var R=d(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),z=d(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),B=e(n(),1),V=i();function H(e){return e===`service`?`system`:e===`tool`?`tool`:e}function U(e){let t=[];for(let n of e.parts){if(n.type===`text`||n.type===`rich-text`||n.type===`reasoning`){t.push(n.text);continue}if(n.type!==`tool-invocation`)continue;let e=n.toolName?.trim()?`[${n.toolName.trim()}]`:`[tool]`;if(n.state===`result`&&typeof n.result==`string`&&n.result.trim()){t.push(`${e} ${n.result.trim()}`);continue}t.push(e)}return t.join(`
2
+ `).trim()}function W({message:e}){let t=H(e.role),n=t===`user`,i=U(e);return(0,V.jsx)(`div`,{className:o(`flex w-full mb-6`,n?`justify-end`:`justify-start`),children:(0,V.jsxs)(`div`,{className:o(`max-w-[85%] rounded-[1.25rem] p-5 flex gap-3 text-sm`,n?`bg-primary text-white rounded-tr-sm`:`bg-gray-50 text-gray-800 rounded-tl-sm border border-gray-100/50`),children:[(0,V.jsx)(`div`,{className:`shrink-0 pt-0.5`,children:n?(0,V.jsx)(_,{className:`w-4 h-4 text-primary-100`}):(0,V.jsx)(f,{className:`w-4 h-4 text-gray-400`})}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-1 overflow-x-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 mb-2`,children:[(0,V.jsx)(`span`,{className:o(`font-semibold text-xs capitalize`,n?`text-primary-50`:`text-gray-900`),children:t}),(0,V.jsx)(`span`,{className:o(`text-[10px]`,n?`text-primary-200`:`text-gray-400`),children:r(e.timestamp)})]}),(0,V.jsx)(`div`,{className:`whitespace-pre-wrap break-words leading-relaxed text-[15px]`,children:i||`-`})]})]})})}function G(e){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(e.session.label||``),[c,u]=(0,B.useState)(e.session.preferredModel||``);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>r(e=>!e),className:o(`h-8.5 rounded-lg shadow-none border-gray-200 transition-all text-xs font-semibold`,n?`bg-gray-100 text-gray-900`:`hover:bg-gray-50 hover:text-gray-900`),children:[(0,V.jsx)(D,{className:`w-3.5 h-3.5 mr-1.5`}),t(`sessionsMetadata`)]}),n?(0,V.jsxs)(`div`,{className:`flex items-center gap-3 bg-gray-50/50 p-3 rounded-lg border border-gray-100 animate-slide-in`,children:[(0,V.jsx)(l,{placeholder:t(`sessionsLabelPlaceholder`),value:i,onChange:e=>a(e.target.value),className:`h-8 text-sm bg-white`}),(0,V.jsx)(l,{placeholder:t(`sessionsModelPlaceholder`),value:c,onChange:e=>u(e.target.value),className:`h-8 text-sm bg-white`}),(0,V.jsx)(s,{size:`sm`,onClick:()=>{e.onSave({label:i,preferredModel:c}),r(!1)},className:`h-8 px-4 shrink-0 shadow-none`,disabled:e.isPending,children:t(`sessionsSaveMeta`)})]}):null]})}function K(){return(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-gray-400 p-8 h-full bg-white`,children:[(0,V.jsx)(`div`,{className:`w-20 h-20 bg-gray-50 rounded-3xl flex items-center justify-center mb-6 border border-gray-100 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.02)] rotate-3`,children:(0,V.jsx)(z,{className:`h-8 w-8 text-gray-300 -rotate-3`})}),(0,V.jsx)(`h3`,{className:`text-lg font-bold text-gray-900 mb-2`,children:t(`sessionsNoSelectionTitle`)}),(0,V.jsx)(`p`,{className:`text-sm text-center max-w-sm leading-relaxed`,children:t(`sessionsNoSelectionDescription`)})]})}function q(e){let n=j(e.sessionKey,300),r=k(),i=A(),{confirm:a,ConfirmDialog:o}=L();return(0,V.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col overflow-hidden relative bg-white rounded-2xl shadow-sm border border-gray-200`,children:[r.isPending||i.isPending?(0,V.jsx)(`div`,{className:`absolute top-0 left-0 w-full h-1 bg-primary/20 overflow-hidden z-20`,children:(0,V.jsx)(`div`,{className:`h-full bg-primary animate-pulse w-1/3 rounded-r-full`})}):null,e.sessionKey&&e.session&&e.summary&&e.channelLabel?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`shrink-0 border-b border-gray-100 bg-white px-4 py-4 z-10 space-y-4 sm:px-8 sm:py-5`,children:(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(`div`,{className:`h-12 w-12 rounded-[14px] bg-gray-50 border border-gray-100 flex items-center justify-center text-gray-400 shrink-0`,children:(0,V.jsx)(E,{className:`h-6 w-6`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-1.5`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-bold text-gray-900 tracking-tight`,children:e.session.label?.trim()||e.session.key.split(`:`).pop()||e.session.key}),(0,V.jsx)(`span`,{className:`text-[10px] font-bold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-widest`,children:e.channelLabel}),e.summary.status===`running`?(0,V.jsx)(h,{status:`running`,className:`h-4 w-4`}):null]}),(0,V.jsx)(`div`,{className:`text-xs text-gray-500 font-mono break-all line-clamp-1 opacity-70`,title:e.sessionKey,children:e.sessionKey})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,V.jsx)(G,{session:e.session,isPending:r.isPending,onSave:t=>{e.sessionKey&&r.mutate({sessionId:e.sessionKey,data:{label:t.label.trim()||null,preferredModel:t.preferredModel.trim()||null}})}},e.session.key),(0,V.jsx)(s,{variant:`outline`,size:`sm`,onClick:async()=>{e.sessionKey&&await a({title:t(`sessionsDeleteConfirm`)+`?`,variant:`destructive`,confirmLabel:t(`sessionsDeleteConfirm`)})&&i.mutate({sessionId:e.sessionKey},{onSuccess:()=>e.onClearSelection()})},className:`h-8.5 rounded-lg shadow-none hover:bg-red-50 hover:text-red-600 hover:border-red-200 border-gray-200 text-xs font-semibold text-red-500`,children:t(`delete`)})]})]})}),(0,V.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 relative [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-gray-300/80 [&::-webkit-scrollbar-thumb]:rounded-full sm:p-6`,children:[n.isLoading?(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-gray-50/50 backdrop-blur-sm z-10`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-3 animate-pulse`,children:[(0,V.jsx)(T,{className:`w-6 h-6 text-primary animate-spin`}),(0,V.jsx)(`span`,{className:`text-sm font-medium text-gray-500`,children:t(`sessionsHistoryLoading`)})]})}):null,n.error?(0,V.jsx)(`div`,{className:`text-center p-6 bg-red-50 rounded-xl text-red-600 border border-red-100 text-sm`,children:n.error.message}):null,!n.isLoading&&n.data?.messages.length===0?(0,V.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center text-gray-400`,children:[(0,V.jsx)(p,{className:`w-12 h-12 mb-3 text-gray-300`}),(0,V.jsx)(`p`,{className:`text-sm`,children:t(`sessionsEmpty`)})]}):null,(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(n.data?.messages??[]).map(e=>(0,V.jsx)(W,{message:e},e.id))})]})]}):(0,V.jsx)(K,{}),(0,V.jsx)(o,{})]})}var J=`__unknown_channel__`;function Y(e){let t=e.indexOf(`:`);return t<=0?J:e.slice(0,t).trim()||J}function X(e){return e===J?t(`sessionsUnknownChannel`):e}function Z(e){return(0,V.jsxs)(`button`,{onClick:e.onSelect,className:o(`w-full text-left p-3.5 rounded-xl transition-all duration-200 outline-none focus:outline-none focus:ring-0 group`,e.isSelected?`bg-brand-50 border border-brand-100/50`:`bg-transparent border border-transparent hover:bg-gray-50/80`),children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between mb-1.5`,children:[(0,V.jsx)(`div`,{className:o(`font-semibold truncate pr-2 flex-1 text-sm`,e.isSelected?`text-brand-800`:`text-gray-900`),children:y(e.session)}),(0,V.jsx)(`div`,{className:o(`text-[10px] font-bold px-2 py-0.5 rounded-full shrink-0 capitalize`,e.isSelected?`bg-white text-brand-600 shadow-[0_1px_2px_rgba(0,0,0,0.02)]`:`bg-gray-100 text-gray-500`),children:e.channelLabel})]}),(0,V.jsxs)(`div`,{className:o(`flex items-center text-xs justify-between mt-2 font-medium`,e.isSelected?`text-brand-600/80`:`text-gray-400`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:e.summary.status===`running`?(0,V.jsx)(h,{status:`running`}):null}),(0,V.jsx)(R,{className:`w-3.5 h-3.5 opacity-70`}),(0,V.jsx)(`span`,{className:`truncate max-w-[100px]`,children:a(e.summary.updatedAt)})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(p,{className:`w-3.5 h-3.5 opacity-70`}),(0,V.jsx)(`span`,{children:e.summary.messageCount})]})]})]})}function Q(){let{isMobile:e}=O(),[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(null),[d,f]=(0,B.useState)(`all`),p=M({limit:100}),h=(0,B.useMemo)(()=>p.data?.sessions??[],[p.data?.sessions]),_=(0,B.useMemo)(()=>g(h),[h]),y=(0,B.useMemo)(()=>new Map(h.map(e=>[e.sessionId,e])),[h]),E=(0,B.useMemo)(()=>_.filter(e=>d!==`all`&&Y(e.key)!==d?!1:v(e,n)),[n,d,_]),D=(0,B.useMemo)(()=>{let e=new Set;for(let t of _)e.add(Y(t.key));return Array.from(e).sort((e,t)=>e===J?1:t===J?-1:e.localeCompare(t))},[_]),k=i&&y.has(i)?i:null,A=(0,B.useMemo)(()=>_.find(e=>e.key===k)??null,[k,_]),j=k?y.get(k)??null:null,L=A?X(Y(A.key)):null;return(0,V.jsxs)(u,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,V.jsx)(c,{title:t(`sessionsPageTitle`),description:t(`sessionsPageDescription`)}),(0,V.jsxs)(F,{className:`xl:min-h-0`,mobileView:e?k?`detail`:`list`:void 0,onMobileBack:()=>a(null),mobileListLabel:t(`sessionsPageTitle`),children:[(0,V.jsxs)(N,{className:`xl:w-[320px] xl:flex-none`,children:[(0,V.jsxs)(P,{className:`space-y-3 px-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] font-semibold text-gray-400 uppercase tracking-wider`,children:[_.length,` `,t(`sessionsListTitle`)]}),(0,V.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>p.refetch(),children:(0,V.jsx)(T,{className:o(`h-3.5 w-3.5`,p.isFetching&&`animate-spin`)})})]}),(0,V.jsxs)(w,{value:d,onValueChange:f,children:[(0,V.jsx)(x,{className:`w-full h-8.5 rounded-lg bg-gray-50/50 hover:bg-gray-100 border-gray-200 focus:ring-0 shadow-none text-xs font-medium text-gray-700`,children:(0,V.jsx)(b,{placeholder:t(`sessionsAllChannels`)})}),(0,V.jsxs)(S,{className:`rounded-xl shadow-lg border-gray-100 max-w-[280px]`,children:[(0,V.jsx)(C,{value:`all`,className:`rounded-lg text-xs`,children:t(`sessionsAllChannels`)}),D.map(e=>(0,V.jsx)(C,{value:e,className:`rounded-lg text-xs truncate pr-6`,children:X(e)},e))]})]}),(0,V.jsxs)(`div`,{className:`relative w-full`,children:[(0,V.jsx)(m,{className:`h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400`}),(0,V.jsx)(l,{value:n,onChange:e=>r(e.target.value),placeholder:t(`sessionsSearchPlaceholder`),className:`pl-8 h-8.5 rounded-lg bg-gray-50/50 border-gray-200 focus-visible:bg-white text-xs`})]})]}),(0,V.jsx)(I,{className:`space-y-1 p-3 pb-10`,children:p.isLoading?(0,V.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`sessionsLoading`)}):E.length===0?(0,V.jsxs)(`div`,{className:`text-sm text-gray-400 p-4 text-center border-2 border-dashed border-gray-100 rounded-xl mt-4`,children:[(0,V.jsx)(z,{className:`w-8 h-8 mx-auto mb-2 text-gray-300`}),t(`sessionsEmpty`)]}):E.map(e=>{let t=y.get(e.key);return t?(0,V.jsx)(Z,{session:e,summary:t,channelLabel:X(Y(e.key)),isSelected:k===e.key,onSelect:()=>a(e.key)},e.key):null})})]}),(0,V.jsx)(q,{sessionKey:k,session:A,summary:j,channelLabel:L,onClearSelection:()=>a(null)})]})]})}export{Q as SessionsConfig};
@@ -1 +1 @@
1
- import{_ as e,m as t,p as n,u as r}from"./i18n-C5Mibli1.js";import{Nt as i}from"./api-Dai6UR3J.js";var a=e(t(),1),o=n(),s=i(`flex items-start justify-between gap-4 rounded-xl border p-4`,{variants:{tone:{default:`border-gray-200 bg-white`,muted:`border-gray-200 bg-gray-50`}},defaultVariants:{tone:`default`}}),c=a.forwardRef(({className:e,tone:t,title:n,description:i,control:a,children:c,...l},u)=>(0,o.jsxs)(`div`,{ref:u,className:r(s({tone:t}),e),...l,children:[(0,o.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,o.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:n}),i?(0,o.jsx)(`p`,{className:`text-sm leading-6 text-gray-500`,children:i}):null,c]}),a?(0,o.jsx)(`div`,{className:`shrink-0`,children:a}):null]}));c.displayName=`SettingRow`;export{c as t};
1
+ import{_ as e,m as t,p as n,u as r}from"./i18n-C5Mibli1.js";import{Nt as i}from"./api-lwyw9j7i.js";var a=e(t(),1),o=n(),s=i(`flex items-start justify-between gap-4 rounded-xl border p-4`,{variants:{tone:{default:`border-gray-200 bg-white`,muted:`border-gray-200 bg-gray-50`}},defaultVariants:{tone:`default`}}),c=a.forwardRef(({className:e,tone:t,title:n,description:i,control:a,children:c,...l},u)=>(0,o.jsxs)(`div`,{ref:u,className:r(s({tone:t}),e),...l,children:[(0,o.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,o.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:n}),i?(0,o.jsx)(`p`,{className:`text-sm leading-6 text-gray-500`,children:i}):null,c]}),a?(0,o.jsx)(`div`,{className:`shrink-0`,children:a}):null]}));c.displayName=`SettingRow`;export{c as t};
@@ -1 +1 @@
1
- import{_ as e,m as t,p as n,u as r}from"./i18n-C5Mibli1.js";import{Nt as i}from"./api-Dai6UR3J.js";var a=e(t(),1),o=n(),s=i(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,{variants:{tone:{subtle:`border-gray-200 bg-gray-50 text-gray-600`,neutral:`border-gray-200 bg-white text-gray-600`,success:`border-emerald-200 bg-emerald-50 text-emerald-700`,warning:`border-amber-200 bg-amber-50 text-amber-800`,danger:`border-rose-200 bg-rose-50 text-rose-600`,info:`border-primary/20 bg-primary/10 text-primary`}},defaultVariants:{tone:`subtle`}}),c=a.forwardRef(({className:e,tone:t,...n},i)=>(0,o.jsx)(`span`,{ref:i,className:r(s({tone:t}),e),...n}));c.displayName=`TagChip`;export{c as t};
1
+ import{_ as e,m as t,p as n,u as r}from"./i18n-C5Mibli1.js";import{Nt as i}from"./api-lwyw9j7i.js";var a=e(t(),1),o=n(),s=i(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,{variants:{tone:{subtle:`border-gray-200 bg-gray-50 text-gray-600`,neutral:`border-gray-200 bg-white text-gray-600`,success:`border-emerald-200 bg-emerald-50 text-emerald-700`,warning:`border-amber-200 bg-amber-50 text-amber-800`,danger:`border-rose-200 bg-rose-50 text-rose-600`,info:`border-primary/20 bg-primary/10 text-primary`}},defaultVariants:{tone:`subtle`}}),c=a.forwardRef(({className:e,tone:t,...n},i)=>(0,o.jsx)(`span`,{ref:i,className:r(s({tone:t}),e),...n}));c.displayName=`TagChip`;export{c as t};
@@ -1 +1 @@
1
- import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-C5Mibli1.js";import{Ct as a,Dt as o,Et as s,It as c,Mt as l,Tt as u,bt as d,ft as f,ht as p,pt as m,wt as ee,yt as h}from"./api-Dai6UR3J.js";import{r as g}from"./chunk-JZWAC4HX-u4uYphxM.js";import{t as _}from"./createLucideIcon-BZkY6emz.js";import{i as v,n as y,t as b}from"./select-uO-zhYsH.js";import{n as x,t as te}from"./refresh-cw-BxojR62w.js";import{t as ne}from"./x-DpTzXQcX.js";import{t as re}from"./use-config-D2QgG7qc.js";import{n as ie,r as ae,t as oe}from"./popover-C8tMB7tR.js";var se=_(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),ce=_(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),le=_(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),ue=_(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),de=_(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),fe=_(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),pe=_(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),me=_(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),S=`nextclaw.ui.theme`,he=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],C=`warm`,w=!1,T=new Set;function E(e){return e===`warm`||e===`cool`}function D(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function O(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(S);if(E(e))return e}catch{}return`warm`}function k(){return w||=(C=O(),D(C),!0),C}function A(){return w?C:k()}function j(e){if(k(),e!==C){if(C=e,D(C),typeof window<`u`)try{window.localStorage.setItem(S,C)}catch{}T.forEach(e=>e(C))}}function M(e){return T.add(e),()=>{T.delete(e)}}var N=r(),P={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function F(){let e=p(),n=e.actionLabel===t(`runtimeStatusRestartAction`),r=async()=>{if(n)try{let e=await h.runRuntimeControlAction(`restart-service`);c.success(e.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);c.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}};return(0,N.jsxs)(oe,{children:[(0,N.jsx)(ae,{asChild:!0,children:(0,N.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,N.jsx)(`span`,{className:i(`h-2.5 w-2.5 rounded-full`,P[e.tone])})})}),(0,N.jsxs)(ie,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,N.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,N.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,N.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,N.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:t(`runtimeStatusActionHint`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?t(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}var I=e(n(),1);function L({className:e,suffix:t}){let{data:n}=re(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim(),a=i?`v${i}`:null,o=t??(0,N.jsx)(F,{});return(0,N.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,N.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,N.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,N.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,N.jsx)(`span`,{className:`shrink-0 text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),a?(0,N.jsx)(R,{versionLabel:a}):null]}),(0,N.jsx)(ge,{}),o?(0,N.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:o}):null]})]})}function R({versionLabel:e}){let[t,n]=(0,I.useState)(!1);return(0,N.jsxs)(`span`,{className:`relative min-w-0 flex-1`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:[(0,N.jsx)(`span`,{tabIndex:0,"aria-label":e,className:`block min-w-0 truncate text-[13px] font-medium text-gray-500 outline-none`,children:e}),t?(0,N.jsx)(`span`,{className:`pointer-events-none absolute left-0 top-full z-[var(--z-tooltip)] mt-1 w-max max-w-none whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md`,children:e}):null]})}function ge(){let{supported:e,busyAction:n,snapshot:r}=m();return!e||!r?null:r.status===`downloading`||r.status===`blocked`||r.status===`failed`?(0,N.jsx)(_e,{snapshot:r}):r.status===`downloaded`?(0,N.jsx)(`button`,{type:`button`,className:i(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,z(r.status)),disabled:n===`applying`,onClick:()=>void f.applyDownloadedUpdate(),children:t(n===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)}):r.status===`update-available`?(0,N.jsx)(`button`,{type:`button`,className:i(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,z(r.status)),disabled:n===`downloading`,onClick:()=>void f.downloadUpdate(),children:t(n===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)}):null}function _e({snapshot:e}){let n=ve(e);return n?(0,N.jsx)(`span`,{className:i(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,z(e.status)),title:t(`updates`),children:n}):null}function ve(e){if(e.status===`downloading`){let n=e.progress?.percent;return n==null?t(`desktopUpdatesInlineDownloading`):t(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(n))}return e.status===`downloaded`?t(`desktopUpdatesInlineReady`):e.status===`update-available`?t(`desktopUpdatesInlineDownload`):e.status===`blocked`||e.status===`failed`?t(`desktopUpdatesInlineAttention`):null}function z(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100 hover:bg-emerald-100 disabled:opacity-70`:e===`blocked`||e===`failed`?`bg-red-50 text-red-700 ring-red-100`:`bg-amber-50 text-amber-700 ring-amber-100 hover:bg-amber-100 disabled:opacity-70`}var ye={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function B(e){return ye[e]}function be({to:e,label:t,icon:n,density:r=`default`,className:a}){let o=B(r);return(0,N.jsx)(g,{to:e,className:({isActive:e})=>i(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,a),children:({isActive:e})=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(n,{className:i(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function xe({label:e,icon:t,onClick:n,density:r=`default`,className:a,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=B(r);return(0,N.jsxs)(`button`,{type:`button`,onClick:n,className:i(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,a),"data-testid":l,children:[(0,N.jsx)(t,{className:i(d.icon,`shrink-0 text-gray-400`)}),(0,N.jsx)(`span`,{className:i(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,N.jsx)(`span`,{className:i(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function Se({label:e,icon:t,value:n,valueLabel:r,onValueChange:a,density:o=`default`,children:s}){let c=B(o);return(0,N.jsxs)(b,{value:n,onValueChange:a,children:[(0,N.jsxs)(v,{className:i(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,N.jsxs)(`div`,{className:i(`flex min-w-0 items-center`,c.gap),children:[(0,N.jsx)(t,{className:i(c.icon,`text-gray-400`)}),(0,N.jsx)(`span`,{className:`text-left`,children:e})]}),(0,N.jsx)(`span`,{className:i(`ml-auto text-gray-500`,c.value),children:r})]}),(0,N.jsx)(y,{children:s})]})}var V=`nextclaw-pwa-install-banner-dismissed`,H=`nextclaw-pwa-install-banner-dismissed-until`;function U(){let e=G();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:we(e):!1}function Ce(){let e=G();e?.setItem(V,`1`),e?.removeItem(H)}function W(){let e=G();e?.removeItem(V),e?.removeItem(H)}function G(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function we(e){let t=e.getItem(H);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(H),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(V,`1`),!0)}function K(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:U(),updateAvailable:!1,registrationFailed:!1}}var q=d(()=>K()),J=`nextclaw-pwa-dev-sw-reset`,Y=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{q.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){q.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;q.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:q.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(J)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(J,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(J)}catch{}}}},X=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),q.setState(K())},this.refreshState=()=>{let e=this.resolveInstallability();q.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:U()})),Y.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Ce(),q.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let n=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,n.outcome===`accepted`?(W(),this.refreshState(),c.success(t(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,W(),q.setState({dismissedInstallPrompt:!0}),c.success(t(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function Te(){let e=q(e=>e.installability);return(0,N.jsx)(`span`,{className:i(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:Ee(e)})}function Ee(e){return t(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function De(e,n,r){return t(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&n===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:r===`insecure-context`?`pwaInstallCardInsecureContext`:r===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function Oe(){let e=q(e=>e.installability),n=q(e=>e.installMethod),r=q(e=>e.blockedReason);return(0,N.jsxs)(a,{children:[(0,N.jsxs)(s,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(o,{children:t(`pwaInstallTitle`)}),(0,N.jsx)(u,{children:t(`pwaInstallDescription`)})]}),(0,N.jsx)(Te,{})]}),(0,N.jsxs)(ee,{className:`space-y-4`,children:[(0,N.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:De(e,n,r)})}),e===`available`&&n===`prompt`?(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsxs)(l,{type:`button`,className:`gap-2`,onClick:()=>{X.promptInstall()},children:[(0,N.jsx)(x,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,N.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`pwaInstallPromptHint`)})]}):null,e===`available`&&n===`manual`?(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,N.jsx)(pe,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallManualHint`)})]}):null]})]})}function ke(){let e=q(e=>e.installability),n=q(e=>e.installMethod),r=q(e=>e.dismissedInstallPrompt);return e!==`available`||n!==`prompt`||r?null:(0,N.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaInstallBannerTitle`)}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallBannerDescription`)})]}),(0,N.jsx)(`button`,{type:`button`,"aria-label":t(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{X.dismissInstallPrompt()},children:(0,N.jsx)(ne,{className:`h-4 w-4`})})]}),(0,N.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,N.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{X.promptInstall()},children:[(0,N.jsx)(x,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,N.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{X.dismissInstallPrompt()},children:t(`pwaInstallDismiss`)})]})]})}function Z(){let e=q(e=>e.updateAvailable),n=q(e=>e.installability);return!e||n!==`installed`?null:(0,N.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,N.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaUpdateBannerTitle`)}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaUpdateBannerDescription`)})]})}),(0,N.jsx)(`div`,{className:`mt-4`,children:(0,N.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Y.applyUpdate()},children:[(0,N.jsx)(te,{className:`h-4 w-4`}),t(`pwaUpdateAction`)]})})]})}var Q=!1;function Ae(){Q||typeof window>`u`||(Q=!0,X.start(),Y.start())}var je={warm:`#F9F8F5`,cool:`#F8FAFB`},Me=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=je[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},$=(0,I.createContext)(null);function Ne({children:e}){let[t,n]=(0,I.useState)(()=>k());(0,I.useEffect)(()=>{Me.syncTheme(t)},[t]),(0,I.useEffect)(()=>M(e=>{n(e)}),[]);let r=(0,I.useCallback)(e=>{j(e),n(A())},[]),i=(0,I.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,N.jsx)($.Provider,{value:i,children:e})}function Pe(){let e=(0,I.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{ce as _,Oe as a,be as c,he as d,me as f,le as g,ue as h,ke as i,Se as l,de as m,Pe as n,Z as o,fe as p,Ae as r,xe as s,Ne as t,L as u,se as v};
1
+ import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-C5Mibli1.js";import{Ct as a,Dt as o,Et as s,It as c,Mt as l,Tt as u,bt as d,ft as f,ht as p,pt as m,wt as ee,yt as h}from"./api-lwyw9j7i.js";import{r as g}from"./chunk-JZWAC4HX-u4uYphxM.js";import{t as _}from"./createLucideIcon-BZkY6emz.js";import{i as v,n as y,t as b}from"./select-Cw5Zkb1w.js";import{n as x,t as te}from"./refresh-cw-BxojR62w.js";import{t as ne}from"./x-DpTzXQcX.js";import{t as re}from"./use-config-BhJHD3-G.js";import{n as ie,r as ae,t as oe}from"./popover-jbfQhYQh.js";var se=_(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),ce=_(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),le=_(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),ue=_(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),de=_(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),fe=_(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),pe=_(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),me=_(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),S=`nextclaw.ui.theme`,he=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],C=`warm`,w=!1,T=new Set;function E(e){return e===`warm`||e===`cool`}function D(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function O(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(S);if(E(e))return e}catch{}return`warm`}function k(){return w||=(C=O(),D(C),!0),C}function A(){return w?C:k()}function j(e){if(k(),e!==C){if(C=e,D(C),typeof window<`u`)try{window.localStorage.setItem(S,C)}catch{}T.forEach(e=>e(C))}}function M(e){return T.add(e),()=>{T.delete(e)}}var N=r(),P={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function F(){let e=p(),n=e.actionLabel===t(`runtimeStatusRestartAction`),r=async()=>{if(n)try{let e=await h.runRuntimeControlAction(`restart-service`);c.success(e.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);c.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}};return(0,N.jsxs)(oe,{children:[(0,N.jsx)(ae,{asChild:!0,children:(0,N.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,N.jsx)(`span`,{className:i(`h-2.5 w-2.5 rounded-full`,P[e.tone])})})}),(0,N.jsxs)(ie,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,N.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,N.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,N.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,N.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:t(`runtimeStatusActionHint`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?t(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}var I=e(n(),1);function L({className:e,suffix:t}){let{data:n}=re(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim(),a=i?`v${i}`:null,o=t??(0,N.jsx)(F,{});return(0,N.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,N.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,N.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,N.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,N.jsx)(`span`,{className:`shrink-0 text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),a?(0,N.jsx)(R,{versionLabel:a}):null]}),(0,N.jsx)(ge,{}),o?(0,N.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:o}):null]})]})}function R({versionLabel:e}){let[t,n]=(0,I.useState)(!1);return(0,N.jsxs)(`span`,{className:`relative min-w-0 flex-1`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:[(0,N.jsx)(`span`,{tabIndex:0,"aria-label":e,className:`block min-w-0 truncate text-[13px] font-medium text-gray-500 outline-none`,children:e}),t?(0,N.jsx)(`span`,{className:`pointer-events-none absolute left-0 top-full z-[var(--z-tooltip)] mt-1 w-max max-w-none whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md`,children:e}):null]})}function ge(){let{supported:e,busyAction:n,snapshot:r}=m();return!e||!r?null:r.status===`downloading`||r.status===`blocked`||r.status===`failed`?(0,N.jsx)(_e,{snapshot:r}):r.status===`downloaded`?(0,N.jsx)(`button`,{type:`button`,className:i(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,z(r.status)),disabled:n===`applying`,onClick:()=>void f.applyDownloadedUpdate(),children:t(n===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)}):r.status===`update-available`?(0,N.jsx)(`button`,{type:`button`,className:i(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,z(r.status)),disabled:n===`downloading`,onClick:()=>void f.downloadUpdate(),children:t(n===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)}):null}function _e({snapshot:e}){let n=ve(e);return n?(0,N.jsx)(`span`,{className:i(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,z(e.status)),title:t(`updates`),children:n}):null}function ve(e){if(e.status===`downloading`){let n=e.progress?.percent;return n==null?t(`desktopUpdatesInlineDownloading`):t(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(n))}return e.status===`downloaded`?t(`desktopUpdatesInlineReady`):e.status===`update-available`?t(`desktopUpdatesInlineDownload`):e.status===`blocked`||e.status===`failed`?t(`desktopUpdatesInlineAttention`):null}function z(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100 hover:bg-emerald-100 disabled:opacity-70`:e===`blocked`||e===`failed`?`bg-red-50 text-red-700 ring-red-100`:`bg-amber-50 text-amber-700 ring-amber-100 hover:bg-amber-100 disabled:opacity-70`}var ye={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function B(e){return ye[e]}function be({to:e,label:t,icon:n,density:r=`default`,className:a}){let o=B(r);return(0,N.jsx)(g,{to:e,className:({isActive:e})=>i(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,a),children:({isActive:e})=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(n,{className:i(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function xe({label:e,icon:t,onClick:n,density:r=`default`,className:a,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=B(r);return(0,N.jsxs)(`button`,{type:`button`,onClick:n,className:i(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,a),"data-testid":l,children:[(0,N.jsx)(t,{className:i(d.icon,`shrink-0 text-gray-400`)}),(0,N.jsx)(`span`,{className:i(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,N.jsx)(`span`,{className:i(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function Se({label:e,icon:t,value:n,valueLabel:r,onValueChange:a,density:o=`default`,children:s}){let c=B(o);return(0,N.jsxs)(b,{value:n,onValueChange:a,children:[(0,N.jsxs)(v,{className:i(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,N.jsxs)(`div`,{className:i(`flex min-w-0 items-center`,c.gap),children:[(0,N.jsx)(t,{className:i(c.icon,`text-gray-400`)}),(0,N.jsx)(`span`,{className:`text-left`,children:e})]}),(0,N.jsx)(`span`,{className:i(`ml-auto text-gray-500`,c.value),children:r})]}),(0,N.jsx)(y,{children:s})]})}var V=`nextclaw-pwa-install-banner-dismissed`,H=`nextclaw-pwa-install-banner-dismissed-until`;function U(){let e=G();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:we(e):!1}function Ce(){let e=G();e?.setItem(V,`1`),e?.removeItem(H)}function W(){let e=G();e?.removeItem(V),e?.removeItem(H)}function G(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function we(e){let t=e.getItem(H);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(H),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(V,`1`),!0)}function K(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:U(),updateAvailable:!1,registrationFailed:!1}}var q=d(()=>K()),J=`nextclaw-pwa-dev-sw-reset`,Y=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{q.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){q.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;q.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:q.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(J)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(J,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(J)}catch{}}}},X=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),q.setState(K())},this.refreshState=()=>{let e=this.resolveInstallability();q.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:U()})),Y.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Ce(),q.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let n=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,n.outcome===`accepted`?(W(),this.refreshState(),c.success(t(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,W(),q.setState({dismissedInstallPrompt:!0}),c.success(t(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function Te(){let e=q(e=>e.installability);return(0,N.jsx)(`span`,{className:i(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:Ee(e)})}function Ee(e){return t(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function De(e,n,r){return t(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&n===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:r===`insecure-context`?`pwaInstallCardInsecureContext`:r===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function Oe(){let e=q(e=>e.installability),n=q(e=>e.installMethod),r=q(e=>e.blockedReason);return(0,N.jsxs)(a,{children:[(0,N.jsxs)(s,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(o,{children:t(`pwaInstallTitle`)}),(0,N.jsx)(u,{children:t(`pwaInstallDescription`)})]}),(0,N.jsx)(Te,{})]}),(0,N.jsxs)(ee,{className:`space-y-4`,children:[(0,N.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:De(e,n,r)})}),e===`available`&&n===`prompt`?(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsxs)(l,{type:`button`,className:`gap-2`,onClick:()=>{X.promptInstall()},children:[(0,N.jsx)(x,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,N.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`pwaInstallPromptHint`)})]}):null,e===`available`&&n===`manual`?(0,N.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,N.jsx)(pe,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallManualHint`)})]}):null]})]})}function ke(){let e=q(e=>e.installability),n=q(e=>e.installMethod),r=q(e=>e.dismissedInstallPrompt);return e!==`available`||n!==`prompt`||r?null:(0,N.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaInstallBannerTitle`)}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallBannerDescription`)})]}),(0,N.jsx)(`button`,{type:`button`,"aria-label":t(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{X.dismissInstallPrompt()},children:(0,N.jsx)(ne,{className:`h-4 w-4`})})]}),(0,N.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,N.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{X.promptInstall()},children:[(0,N.jsx)(x,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,N.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{X.dismissInstallPrompt()},children:t(`pwaInstallDismiss`)})]})]})}function Z(){let e=q(e=>e.updateAvailable),n=q(e=>e.installability);return!e||n!==`installed`?null:(0,N.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,N.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaUpdateBannerTitle`)}),(0,N.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaUpdateBannerDescription`)})]})}),(0,N.jsx)(`div`,{className:`mt-4`,children:(0,N.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Y.applyUpdate()},children:[(0,N.jsx)(te,{className:`h-4 w-4`}),t(`pwaUpdateAction`)]})})]})}var Q=!1;function Ae(){Q||typeof window>`u`||(Q=!0,X.start(),Y.start())}var je={warm:`#F9F8F5`,cool:`#F8FAFB`},Me=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=je[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},$=(0,I.createContext)(null);function Ne({children:e}){let[t,n]=(0,I.useState)(()=>k());(0,I.useEffect)(()=>{Me.syncTheme(t)},[t]),(0,I.useEffect)(()=>M(e=>{n(e)}),[]);let r=(0,I.useCallback)(e=>{j(e),n(A())},[]),i=(0,I.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,N.jsx)($.Provider,{value:i,children:e})}function Pe(){let e=(0,I.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{ce as _,Oe as a,be as c,he as d,me as f,le as g,ue as h,ke as i,Se as l,de as m,Pe as n,Z as o,fe as p,Ae as r,xe as s,Ne as t,L as u,se as v};
@@ -1 +1 @@
1
- import{_ as e,m as t,p as n,u as r}from"./i18n-C5Mibli1.js";import{_ as i,c as a,d as o,f as s,g as c,h as l,i as u,o as d,u as f}from"./es2015-BVRlEE06.js";import{t as p}from"./dist-CxcPOISF.js";import{C as m,E as h,S as g,T as _,w as v,x as y}from"./select-uO-zhYsH.js";var b=e(t(),1),x=n(),[S,C]=l(`Tooltip`,[h]),w=h(),T=`TooltipProvider`,E=700,D=`tooltip.open`,[O,k]=S(T),A=e=>{let{__scopeTooltip:t,delayDuration:n=E,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,x.jsx)(O,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};A.displayName=T;var j=`Tooltip`,[ee,M]=S(j),N=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:c,delayDuration:l}=e,u=k(j,e.__scopeTooltip),d=w(t),[f,p]=b.useState(null),m=s(),h=b.useRef(0),g=c??u.disableHoverableContent,v=l??u.delayDuration,y=b.useRef(!1),[S,C]=o({prop:r,defaultProp:i??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(D))):u.onClose(),a?.(e)},caller:j}),T=b.useMemo(()=>S?y.current?`delayed-open`:`instant-open`:`closed`,[S]),E=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,C(!0)},[C]),O=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C(!1)},[C]),A=b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,C(!0),h.current=0},v)},[v,C]);return b.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,x.jsx)(_,{...d,children:(0,x.jsx)(ee,{scope:t,contentId:m,open:S,stateAttribute:T,trigger:f,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{u.isOpenDelayedRef.current?A():E()},[u.isOpenDelayedRef,A,E]),onTriggerLeave:b.useCallback(()=>{g?O():(window.clearTimeout(h.current),h.current=0)},[O,g]),onOpen:E,onClose:O,disableHoverableContent:g,children:n})})};N.displayName=j;var P=`TooltipTrigger`,F=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,o=M(P,n),s=k(P,n),l=w(n),u=c(t,b.useRef(null),o.onTriggerChange),d=b.useRef(!1),f=b.useRef(!1),p=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,x.jsx)(g,{asChild:!0,...l,children:(0,x.jsx)(a.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:i(e.onPointerMove,e=>{e.pointerType!==`touch`&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:i(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:i(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:i(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:i(e.onBlur,o.onClose),onClick:i(e.onClick,o.onClose)})})});F.displayName=P;var I=`TooltipPortal`,[L,R]=S(I,{forceMount:void 0}),z=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=M(I,t);return(0,x.jsx)(L,{scope:t,forceMount:n,children:(0,x.jsx)(p,{present:n||a.open,children:(0,x.jsx)(u,{asChild:!0,container:i,children:r})})})};z.displayName=I;var B=`TooltipContent`,V=b.forwardRef((e,t)=>{let n=R(B,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=M(B,e.__scopeTooltip);return(0,x.jsx)(p,{present:r||o.open,children:o.disableHoverableContent?(0,x.jsx)(K,{side:i,...a,ref:t}):(0,x.jsx)(H,{side:i,...a,ref:t})})}),H=b.forwardRef((e,t)=>{let n=M(B,e.__scopeTooltip),r=k(B,e.__scopeTooltip),i=b.useRef(null),a=c(t,i),[o,s]=b.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=b.useCallback(()=>{s(null),f(!1)},[f]),m=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=re(r,ne(r,n.getBoundingClientRect())),a=ie(t.getBoundingClientRect());s(oe([...i,...a])),f(!0)},[f]);return b.useEffect(()=>()=>p(),[p]),b.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!ae(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,x.jsx)(K,{...e,ref:a})}),[U,W]=S(j,{isInside:!1}),G=f(`TooltipContent`),K=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=M(B,n),l=w(n),{onClose:u}=c;return b.useEffect(()=>(document.addEventListener(D,u),()=>document.removeEventListener(D,u)),[u]),b.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,x.jsx)(d,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,x.jsxs)(v,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,x.jsx)(G,{children:r}),(0,x.jsx)(U,{scope:n,isInside:!0,children:(0,x.jsx)(y,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});V.displayName=B;var q=`TooltipArrow`,te=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=w(n);return W(q,n).isInside?null:(0,x.jsx)(m,{...i,...r,ref:t})});te.displayName=q;function ne(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function re(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ie(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function oe(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),se(t)}function se(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var J=A,Y=N,X=F,Z=z,Q=V,ce=J,le=Y,ue=X,$=b.forwardRef(({className:e,sideOffset:t=4,...n},i)=>(0,x.jsx)(Z,{children:(0,x.jsx)(Q,{ref:i,sideOffset:t,className:r(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));$.displayName=Q.displayName;export{Q as a,Y as c,ue as i,X as l,$ as n,Z as o,ce as r,J as s,le as t};
1
+ import{_ as e,m as t,p as n,u as r}from"./i18n-C5Mibli1.js";import{_ as i,c as a,d as o,f as s,g as c,h as l,i as u,o as d,u as f}from"./es2015-yYU5Ad5w.js";import{t as p}from"./dist-CuqvE--P.js";import{C as m,E as h,S as g,T as _,w as v,x as y}from"./select-Cw5Zkb1w.js";var b=e(t(),1),x=n(),[S,C]=l(`Tooltip`,[h]),w=h(),T=`TooltipProvider`,E=700,D=`tooltip.open`,[O,k]=S(T),A=e=>{let{__scopeTooltip:t,delayDuration:n=E,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,x.jsx)(O,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};A.displayName=T;var j=`Tooltip`,[ee,M]=S(j),N=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:c,delayDuration:l}=e,u=k(j,e.__scopeTooltip),d=w(t),[f,p]=b.useState(null),m=s(),h=b.useRef(0),g=c??u.disableHoverableContent,v=l??u.delayDuration,y=b.useRef(!1),[S,C]=o({prop:r,defaultProp:i??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(D))):u.onClose(),a?.(e)},caller:j}),T=b.useMemo(()=>S?y.current?`delayed-open`:`instant-open`:`closed`,[S]),E=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,C(!0)},[C]),O=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C(!1)},[C]),A=b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,C(!0),h.current=0},v)},[v,C]);return b.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,x.jsx)(_,{...d,children:(0,x.jsx)(ee,{scope:t,contentId:m,open:S,stateAttribute:T,trigger:f,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{u.isOpenDelayedRef.current?A():E()},[u.isOpenDelayedRef,A,E]),onTriggerLeave:b.useCallback(()=>{g?O():(window.clearTimeout(h.current),h.current=0)},[O,g]),onOpen:E,onClose:O,disableHoverableContent:g,children:n})})};N.displayName=j;var P=`TooltipTrigger`,F=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,o=M(P,n),s=k(P,n),l=w(n),u=c(t,b.useRef(null),o.onTriggerChange),d=b.useRef(!1),f=b.useRef(!1),p=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,x.jsx)(g,{asChild:!0,...l,children:(0,x.jsx)(a.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:i(e.onPointerMove,e=>{e.pointerType!==`touch`&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:i(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:i(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:i(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:i(e.onBlur,o.onClose),onClick:i(e.onClick,o.onClose)})})});F.displayName=P;var I=`TooltipPortal`,[L,R]=S(I,{forceMount:void 0}),z=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=M(I,t);return(0,x.jsx)(L,{scope:t,forceMount:n,children:(0,x.jsx)(p,{present:n||a.open,children:(0,x.jsx)(u,{asChild:!0,container:i,children:r})})})};z.displayName=I;var B=`TooltipContent`,V=b.forwardRef((e,t)=>{let n=R(B,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=M(B,e.__scopeTooltip);return(0,x.jsx)(p,{present:r||o.open,children:o.disableHoverableContent?(0,x.jsx)(K,{side:i,...a,ref:t}):(0,x.jsx)(H,{side:i,...a,ref:t})})}),H=b.forwardRef((e,t)=>{let n=M(B,e.__scopeTooltip),r=k(B,e.__scopeTooltip),i=b.useRef(null),a=c(t,i),[o,s]=b.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=b.useCallback(()=>{s(null),f(!1)},[f]),m=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=re(r,ne(r,n.getBoundingClientRect())),a=ie(t.getBoundingClientRect());s(oe([...i,...a])),f(!0)},[f]);return b.useEffect(()=>()=>p(),[p]),b.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!ae(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,x.jsx)(K,{...e,ref:a})}),[U,W]=S(j,{isInside:!1}),G=f(`TooltipContent`),K=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=M(B,n),l=w(n),{onClose:u}=c;return b.useEffect(()=>(document.addEventListener(D,u),()=>document.removeEventListener(D,u)),[u]),b.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,x.jsx)(d,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,x.jsxs)(v,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,x.jsx)(G,{children:r}),(0,x.jsx)(U,{scope:n,isInside:!0,children:(0,x.jsx)(y,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});V.displayName=B;var q=`TooltipArrow`,te=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=w(n);return W(q,n).isInside?null:(0,x.jsx)(m,{...i,...r,ref:t})});te.displayName=q;function ne(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function re(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ie(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function oe(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),se(t)}function se(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var J=A,Y=N,X=F,Z=z,Q=V,ce=J,le=Y,ue=X,$=b.forwardRef(({className:e,sideOffset:t=4,...n},i)=>(0,x.jsx)(Z,{children:(0,x.jsx)(Q,{ref:i,sideOffset:t,className:r(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));$.displayName=Q.displayName;export{Q as a,Y as c,ue as i,X as l,$ as n,Z as o,ce as r,J as s,le as t};
@@ -1 +1 @@
1
- import{i as e}from"./i18n-C5Mibli1.js";import{$ as t,B as n,F as r,G as i,H as a,I as o,It as s,J as c,K as l,L as u,Lt as d,M as f,N as p,P as m,Q as h,R as g,Rt as _,U as v,Vt as y,W as b,X as x,Y as S,Z as C,_ as w,f as T,g as E,h as D,m as O,p as k,q as A,v as j,z as M}from"./api-Dai6UR3J.js";function ee(){return _({queryKey:[`config`],queryFn:u,staleTime:3e4,refetchOnWindowFocus:!0})}function N(){return _({queryKey:[`app-meta`],queryFn:o,staleTime:1/0})}function P(){return _({queryKey:[`config-meta`],queryFn:g,staleTime:1/0})}function F(){return _({queryKey:[`config-schema`],queryFn:M,staleTime:1/0})}function I(){let t=y();return d({mutationFn:S,onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function L(){let t=y();return d({mutationFn:({data:e})=>h(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function R(){let t=y();return d({mutationFn:({provider:e,data:t})=>x(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function z(){let t=y();return d({mutationFn:({data:e})=>f(e??{}),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function B(){let t=y();return d({mutationFn:({provider:e})=>m(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function V(){return d({mutationFn:({provider:e,data:t})=>A(e,t)})}function H(){return d({mutationFn:({provider:e,data:t})=>l(e,t)})}function U(){return d({mutationFn:({provider:e,data:t})=>v(e,t)})}function W(){return d({mutationFn:({provider:e})=>a(e)})}function G(){let t=y();return d({mutationFn:({channel:e,data:t})=>c(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSavedApplying`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function K(){let t=y();return d({mutationFn:({data:e})=>C(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function q(){let n=y();return d({mutationFn:({data:e})=>t(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`config`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function J(){return d({mutationFn:({actionId:e,data:t})=>r(e,t),onError:t=>{s.error(e(`error`)+`: `+t.message)}})}function Y(e){return _({queryKey:[`ncp-sessions`,e?.limit??null],queryFn:()=>w(e),staleTime:5e3,retry:!1})}function X(e,t=200){return _({queryKey:[`ncp-session-messages`,e,t],queryFn:()=>D(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Z(e){return _({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>E(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,staleTime:5e3,retry:!1})}function Q(){let t=y();return d({mutationFn:({sessionId:e})=>O(e),onSuccess:(n,r)=>{T(t,r.sessionId),t.removeQueries({queryKey:[`ncp-session-messages`,r.sessionId]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function $(){let t=y();return d({mutationFn:({sessionId:e,data:t})=>j(e,t),onSuccess:n=>{k(t,n),t.invalidateQueries({queryKey:[`ncp-session-skills`,n.sessionId]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function te(e={all:!0}){return _({queryKey:[`cron`,e],queryFn:()=>n(e),staleTime:1e4})}function ne(){let t=y();return d({mutationFn:({id:e})=>p(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function re(){let t=y();return d({mutationFn:({id:e,enabled:t})=>i(e,{enabled:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function ie(){let t=y();return d({mutationFn:({id:e,force:t})=>b(e,{force:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}export{R as C,q as E,$ as S,L as T,H as _,z as a,G as b,Q as c,W as d,X as f,ie as g,U as h,F as i,B as l,Y as m,ee as n,te as o,Z as p,P as r,ne as s,N as t,J as u,V as v,K as w,I as x,re as y};
1
+ import{i as e}from"./i18n-C5Mibli1.js";import{$ as t,B as n,F as r,G as i,H as a,I as o,It as s,J as c,K as l,L as u,Lt as d,M as f,N as p,P as m,Q as h,R as g,Rt as _,U as v,Vt as y,W as b,X as x,Y as S,Z as C,_ as w,f as T,g as E,h as D,m as O,p as k,q as A,v as j,z as M}from"./api-lwyw9j7i.js";function ee(){return _({queryKey:[`config`],queryFn:u,staleTime:3e4,refetchOnWindowFocus:!0})}function N(){return _({queryKey:[`app-meta`],queryFn:o,staleTime:1/0})}function P(){return _({queryKey:[`config-meta`],queryFn:g,staleTime:1/0})}function F(){return _({queryKey:[`config-schema`],queryFn:M,staleTime:1/0})}function I(){let t=y();return d({mutationFn:S,onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function L(){let t=y();return d({mutationFn:({data:e})=>h(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function R(){let t=y();return d({mutationFn:({provider:e,data:t})=>x(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function z(){let t=y();return d({mutationFn:({data:e})=>f(e??{}),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function B(){let t=y();return d({mutationFn:({provider:e})=>m(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSaved`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function V(){return d({mutationFn:({provider:e,data:t})=>A(e,t)})}function H(){return d({mutationFn:({provider:e,data:t})=>l(e,t)})}function U(){return d({mutationFn:({provider:e,data:t})=>v(e,t)})}function W(){return d({mutationFn:({provider:e})=>a(e)})}function G(){let t=y();return d({mutationFn:({channel:e,data:t})=>c(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),s.success(e(`configSavedApplying`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function K(){let t=y();return d({mutationFn:({data:e})=>C(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function q(){let n=y();return d({mutationFn:({data:e})=>t(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`config`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function J(){return d({mutationFn:({actionId:e,data:t})=>r(e,t),onError:t=>{s.error(e(`error`)+`: `+t.message)}})}function Y(e){return _({queryKey:[`ncp-sessions`,e?.limit??null],queryFn:()=>w(e),staleTime:5e3,retry:!1})}function X(e,t=200){return _({queryKey:[`ncp-session-messages`,e,t],queryFn:()=>D(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Z(e){return _({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>E(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,staleTime:5e3,retry:!1})}function Q(){let t=y();return d({mutationFn:({sessionId:e})=>O(e),onSuccess:(n,r)=>{T(t,r.sessionId),t.removeQueries({queryKey:[`ncp-session-messages`,r.sessionId]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function $(){let t=y();return d({mutationFn:({sessionId:e,data:t})=>j(e,t),onSuccess:n=>{k(t,n),t.invalidateQueries({queryKey:[`ncp-session-skills`,n.sessionId]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function te(e={all:!0}){return _({queryKey:[`cron`,e],queryFn:()=>n(e),staleTime:1e4})}function ne(){let t=y();return d({mutationFn:({id:e})=>p(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function re(){let t=y();return d({mutationFn:({id:e,enabled:t})=>i(e,{enabled:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}function ie(){let t=y();return d({mutationFn:({id:e,force:t})=>b(e,{force:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),s.success(e(`configSavedApplied`))},onError:t=>{s.error(e(`configSaveFailed`)+`: `+t.message)}})}export{R as C,q as E,$ as S,L as T,H as _,z as a,G as b,Q as c,W as d,X as f,ie as g,U as h,F as i,B as l,Y as m,ee as n,te as o,Z as p,P as r,ne as s,N as t,J as u,V as v,K as w,I as x,re as y};
@@ -1 +1 @@
1
- import{_ as e,i as t,m as n,p as r}from"./i18n-C5Mibli1.js";import{Mt as i}from"./api-Dai6UR3J.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./dialog-DgybjpeU.js";var d=e(n(),1),f=r(),p=({open:e,onOpenChange:n,title:r,description:d,confirmLabel:p=t(`confirm`),cancelLabel:m=t(`cancel`),variant:h=`default`,onConfirm:g,onCancel:_})=>(0,f.jsx)(u,{open:e,onOpenChange:n,children:(0,f.jsxs)(s,{className:`[&>:last-child]:hidden`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,f.jsxs)(a,{children:[(0,f.jsx)(c,{children:r}),d?(0,f.jsx)(l,{children:d}):null]}),(0,f.jsxs)(o,{className:`gap-2 sm:gap-0`,children:[(0,f.jsx)(i,{type:`button`,variant:`outline`,onClick:()=>{_(),n(!1)},children:m}),(0,f.jsx)(i,{type:`button`,variant:h===`destructive`?`destructive`:`default`,onClick:()=>{g(),n(!1)},children:p})]})]})}),m={open:!1,title:``,description:``,confirmLabel:t(`confirm`),cancelLabel:t(`cancel`),variant:`default`,resolve:null};function h(){let[e,n]=(0,d.useState)(m),r=(0,d.useCallback)(e=>new Promise(r=>{n({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??t(`confirm`),cancelLabel:e.cancelLabel??t(`cancel`),variant:e.variant??`default`,resolve:e=>{r(e),n(e=>({...e,open:!1,resolve:null}))}})}),[]),i=(0,d.useCallback)(e=>{n(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:r,ConfirmDialog:(0,d.useCallback)(()=>(0,f.jsx)(p,{open:e.open,onOpenChange:i,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,i])}}export{h as t};
1
+ import{_ as e,i as t,m as n,p as r}from"./i18n-C5Mibli1.js";import{Mt as i}from"./api-lwyw9j7i.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./dialog-CdtCU2xX.js";var d=e(n(),1),f=r(),p=({open:e,onOpenChange:n,title:r,description:d,confirmLabel:p=t(`confirm`),cancelLabel:m=t(`cancel`),variant:h=`default`,onConfirm:g,onCancel:_})=>(0,f.jsx)(u,{open:e,onOpenChange:n,children:(0,f.jsxs)(s,{className:`[&>:last-child]:hidden`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,f.jsxs)(a,{children:[(0,f.jsx)(c,{children:r}),d?(0,f.jsx)(l,{children:d}):null]}),(0,f.jsxs)(o,{className:`gap-2 sm:gap-0`,children:[(0,f.jsx)(i,{type:`button`,variant:`outline`,onClick:()=>{_(),n(!1)},children:m}),(0,f.jsx)(i,{type:`button`,variant:h===`destructive`?`destructive`:`default`,onClick:()=>{g(),n(!1)},children:p})]})]})}),m={open:!1,title:``,description:``,confirmLabel:t(`confirm`),cancelLabel:t(`cancel`),variant:`default`,resolve:null};function h(){let[e,n]=(0,d.useState)(m),r=(0,d.useCallback)(e=>new Promise(r=>{n({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??t(`confirm`),cancelLabel:e.cancelLabel??t(`cancel`),variant:e.variant??`default`,resolve:e=>{r(e),n(e=>({...e,open:!1,resolve:null}))}})}),[]),i=(0,d.useCallback)(e=>{n(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:r,ConfirmDialog:(0,d.useCallback)(()=>(0,f.jsx)(p,{open:e.open,onOpenChange:i,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,i])}}export{h as t};
@@ -1 +1 @@
1
- import{_ as e,i as t,m as n,p as r}from"./i18n-C5Mibli1.js";import{Gt as i,Ht as a,Ut as o,Wt as s,zt as c}from"./api-Dai6UR3J.js";import{t as l}from"./createLucideIcon-BZkY6emz.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-uO-zhYsH.js";import{t as h}from"./skeleton-CFQRIUzt.js";var g=class extends i{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:s()})}getOptimisticResult(e){return e.behavior=s(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=i&&u===`forward`,p=c&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:a(t,n.data),hasPreviousPage:o(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function _(e,t){return c(e,g,t)}var v=l(`PackageSearch`,[[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]);function y(e){if(!e||e.pages.length===0)return;let t=e.pages.flatMap(e=>e.items);return{...e.pages[e.pages.length-1],items:t,pages:e.pages,loadedItems:t.length,loadedPages:e.pages.length}}var b=r();function x({scope:e,searchText:n,searchPlaceholder:r,sort:i,onSearchTextChange:a,onSortChange:o}){return(0,b.jsx)(`div`,{className:`mb-4`,children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,b.jsx)(v,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,b.jsx)(`input`,{value:n,onChange:e=>a(e.target.value),placeholder:r,className:`h-9 w-full rounded-xl border border-gray-200/80 pl-9 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40`})]}),e===`all`&&(0,b.jsxs)(m,{value:i,onValueChange:e=>o(e),children:[(0,b.jsx)(d,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,b.jsx)(u,{})}),(0,b.jsxs)(f,{children:[(0,b.jsx)(p,{value:`relevance`,children:t(`marketplaceSortRelevance`)}),(0,b.jsx)(p,{value:`updated`,children:t(`marketplaceSortUpdated`)})]})]})]})})}function S({count:e}){return(0,b.jsx)(b.Fragment,{children:Array.from({length:e},(e,t)=>(0,b.jsx)(`article`,{className:`rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm`,children:(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3.5`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,b.jsx)(h,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pt-0.5`,children:[(0,b.jsx)(h,{className:`h-4 w-32 max-w-[70%]`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(h,{className:`h-3 w-12`}),(0,b.jsx)(h,{className:`h-3 w-24`})]}),(0,b.jsx)(h,{className:`h-3 w-full`})]})]}),(0,b.jsx)(h,{className:`h-8 w-20 shrink-0 rounded-xl`})]})},`marketplace-skeleton-${t}`))})}function C({hasMore:e,loading:n,sentinelRef:r}){return!e&&!n?null:(0,b.jsxs)(`div`,{className:`py-4`,children:[e&&(0,b.jsx)(`div`,{ref:r,className:`h-1 w-full`,"aria-hidden":`true`}),n&&(0,b.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:t(`loading`)})]})}function w(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function T(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function E(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:T(e),text:typeof t==`string`?t.trim():``})).filter(e=>e.text.length>0);if(t.length>0){let e=new Map(t.map(e=>[e.locale,e.text]));for(let t of n){let n=T(t),r=e.get(n);if(r)return r}for(let e of n){let n=T(e).split(`-`)[0];if(!n)continue;let r=t.find(e=>e.locale===n||e.locale.startsWith(`${n}-`));if(r)return r.text}return t[0]?.text??``}}return t?.trim()??``}function D(e,t){if(!e)return``;for(let n of t)if(T(n).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}var O=e(n(),1),k=160;function A(e){let t=(0,O.useRef)(null),n=(0,O.useRef)(null),r=(0,O.useRef)(e.onLoadMore),i=(0,O.useRef)(!1);return(0,O.useEffect)(()=>{r.current=e.onLoadMore},[e.onLoadMore]),(0,O.useEffect)(()=>{e.disabled&&(i.current=!1)},[e.disabled]),(0,O.useEffect)(()=>{let a=t.current,o=n.current,s=e.thresholdPx??k;if(e.disabled||!a||!o)return;let c=()=>{i.current||e.disabled||(i.current=!0,Promise.resolve(r.current()).finally(()=>{i.current=!1}))},l=()=>{o.getBoundingClientRect().top-a.getBoundingClientRect().bottom<=s&&c()};if(typeof IntersectionObserver==`function`){let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:a,rootMargin:`0px 0px ${s}px 0px`});return e.observe(o),l(),()=>{e.disconnect()}}return a.addEventListener(`scroll`,l,{passive:!0}),l(),()=>{a.removeEventListener(`scroll`,l)}},[e.disabled,e.thresholdPx,e.watchValue]),{containerRef:t,sentinelRef:n}}export{x as a,y as c,E as i,_ as l,w as n,C as o,D as r,S as s,A as t};
1
+ import{_ as e,i as t,m as n,p as r}from"./i18n-C5Mibli1.js";import{Gt as i,Ht as a,Ut as o,Wt as s,zt as c}from"./api-lwyw9j7i.js";import{t as l}from"./createLucideIcon-BZkY6emz.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-Cw5Zkb1w.js";import{t as h}from"./skeleton-CFQRIUzt.js";var g=class extends i{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:s()})}getOptimisticResult(e){return e.behavior=s(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=i&&u===`forward`,p=c&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:a(t,n.data),hasPreviousPage:o(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function _(e,t){return c(e,g,t)}var v=l(`PackageSearch`,[[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]);function y(e){if(!e||e.pages.length===0)return;let t=e.pages.flatMap(e=>e.items);return{...e.pages[e.pages.length-1],items:t,pages:e.pages,loadedItems:t.length,loadedPages:e.pages.length}}var b=r();function x({scope:e,searchText:n,searchPlaceholder:r,sort:i,onSearchTextChange:a,onSortChange:o}){return(0,b.jsx)(`div`,{className:`mb-4`,children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,b.jsx)(v,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,b.jsx)(`input`,{value:n,onChange:e=>a(e.target.value),placeholder:r,className:`h-9 w-full rounded-xl border border-gray-200/80 pl-9 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40`})]}),e===`all`&&(0,b.jsxs)(m,{value:i,onValueChange:e=>o(e),children:[(0,b.jsx)(d,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,b.jsx)(u,{})}),(0,b.jsxs)(f,{children:[(0,b.jsx)(p,{value:`relevance`,children:t(`marketplaceSortRelevance`)}),(0,b.jsx)(p,{value:`updated`,children:t(`marketplaceSortUpdated`)})]})]})]})})}function S({count:e}){return(0,b.jsx)(b.Fragment,{children:Array.from({length:e},(e,t)=>(0,b.jsx)(`article`,{className:`rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm`,children:(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3.5`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,b.jsx)(h,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pt-0.5`,children:[(0,b.jsx)(h,{className:`h-4 w-32 max-w-[70%]`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(h,{className:`h-3 w-12`}),(0,b.jsx)(h,{className:`h-3 w-24`})]}),(0,b.jsx)(h,{className:`h-3 w-full`})]})]}),(0,b.jsx)(h,{className:`h-8 w-20 shrink-0 rounded-xl`})]})},`marketplace-skeleton-${t}`))})}function C({hasMore:e,loading:n,sentinelRef:r}){return!e&&!n?null:(0,b.jsxs)(`div`,{className:`py-4`,children:[e&&(0,b.jsx)(`div`,{ref:r,className:`h-1 w-full`,"aria-hidden":`true`}),n&&(0,b.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:t(`loading`)})]})}function w(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function T(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function E(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:T(e),text:typeof t==`string`?t.trim():``})).filter(e=>e.text.length>0);if(t.length>0){let e=new Map(t.map(e=>[e.locale,e.text]));for(let t of n){let n=T(t),r=e.get(n);if(r)return r}for(let e of n){let n=T(e).split(`-`)[0];if(!n)continue;let r=t.find(e=>e.locale===n||e.locale.startsWith(`${n}-`));if(r)return r.text}return t[0]?.text??``}}return t?.trim()??``}function D(e,t){if(!e)return``;for(let n of t)if(T(n).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}var O=e(n(),1),k=160;function A(e){let t=(0,O.useRef)(null),n=(0,O.useRef)(null),r=(0,O.useRef)(e.onLoadMore),i=(0,O.useRef)(!1);return(0,O.useEffect)(()=>{r.current=e.onLoadMore},[e.onLoadMore]),(0,O.useEffect)(()=>{e.disabled&&(i.current=!1)},[e.disabled]),(0,O.useEffect)(()=>{let a=t.current,o=n.current,s=e.thresholdPx??k;if(e.disabled||!a||!o)return;let c=()=>{i.current||e.disabled||(i.current=!0,Promise.resolve(r.current()).finally(()=>{i.current=!1}))},l=()=>{o.getBoundingClientRect().top-a.getBoundingClientRect().bottom<=s&&c()};if(typeof IntersectionObserver==`function`){let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:a,rootMargin:`0px 0px ${s}px 0px`});return e.observe(o),l(),()=>{e.disconnect()}}return a.addEventListener(`scroll`,l,{passive:!0}),l(),()=>{a.removeEventListener(`scroll`,l)}},[e.disabled,e.thresholdPx,e.watchValue]),{containerRef:t,sentinelRef:n}}export{x as a,y as c,E as i,_ as l,w as n,C as o,D as r,S as s,A as t};
@@ -1 +1 @@
1
- import{_ as e,m as t}from"./i18n-C5Mibli1.js";import{bt as n}from"./api-Dai6UR3J.js";function r(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function i(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:r(e),width:e}}var a=n(()=>i()),o=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>a.getState(),this.resetForTests=()=>{this.consumerCount=0,this.stop(),a.setState(i())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;a.setState({width:e,mode:r(e)})}}},s=e(t(),1);function c(){(0,s.useEffect)(()=>o.attach(),[]);let e=a(e=>e.mode);return{mode:e,isMobile:e===`mobile`,isDesktop:e===`desktop`}}export{o as n,c as t};
1
+ import{_ as e,m as t}from"./i18n-C5Mibli1.js";import{bt as n}from"./api-lwyw9j7i.js";function r(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function i(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:r(e),width:e}}var a=n(()=>i()),o=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>a.getState(),this.resetForTests=()=>{this.consumerCount=0,this.stop(),a.setState(i())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;a.setState({width:e,mode:r(e)})}}},s=e(t(),1);function c(){(0,s.useEffect)(()=>o.attach(),[]);let e=a(e=>e.mode);return{mode:e,isMobile:e===`mobile`,isDesktop:e===`desktop`}}export{o as n,c as t};
package/dist/index.html CHANGED
@@ -78,21 +78,21 @@
78
78
  })();
79
79
  </script>
80
80
  <title>NextClaw</title>
81
- <script type="module" crossorigin src="/assets/index-B7RsQ-ne.js"></script>
81
+ <script type="module" crossorigin src="/assets/index-Doxyk7L2.js"></script>
82
82
  <link rel="modulepreload" crossorigin href="/assets/i18n-C5Mibli1.js">
83
83
  <link rel="modulepreload" crossorigin href="/assets/chunk-JZWAC4HX-u4uYphxM.js">
84
- <link rel="modulepreload" crossorigin href="/assets/api-Dai6UR3J.js">
85
- <link rel="modulepreload" crossorigin href="/assets/es2015-BVRlEE06.js">
84
+ <link rel="modulepreload" crossorigin href="/assets/api-lwyw9j7i.js">
85
+ <link rel="modulepreload" crossorigin href="/assets/es2015-yYU5Ad5w.js">
86
86
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BZkY6emz.js">
87
- <link rel="modulepreload" crossorigin href="/assets/select-uO-zhYsH.js">
88
- <link rel="modulepreload" crossorigin href="/assets/dist-CxcPOISF.js">
87
+ <link rel="modulepreload" crossorigin href="/assets/select-Cw5Zkb1w.js">
88
+ <link rel="modulepreload" crossorigin href="/assets/dist-CuqvE--P.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/x-DpTzXQcX.js">
90
- <link rel="modulepreload" crossorigin href="/assets/dialog-DgybjpeU.js">
91
- <link rel="modulepreload" crossorigin href="/assets/popover-C8tMB7tR.js">
92
- <link rel="modulepreload" crossorigin href="/assets/tooltip-CvAtG-kT.js">
90
+ <link rel="modulepreload" crossorigin href="/assets/dialog-CdtCU2xX.js">
91
+ <link rel="modulepreload" crossorigin href="/assets/popover-jbfQhYQh.js">
92
+ <link rel="modulepreload" crossorigin href="/assets/tooltip-GYzH-Hfq.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/refresh-cw-BxojR62w.js">
94
- <link rel="modulepreload" crossorigin href="/assets/use-config-D2QgG7qc.js">
95
- <link rel="modulepreload" crossorigin href="/assets/theme-provider-BU77FNSB.js">
94
+ <link rel="modulepreload" crossorigin href="/assets/use-config-BhJHD3-G.js">
95
+ <link rel="modulepreload" crossorigin href="/assets/theme-provider-B5XReW_-.js">
96
96
  <link rel="modulepreload" crossorigin href="/assets/search-vChioOoe.js">
97
97
  <link rel="modulepreload" crossorigin href="/assets/book-open-DgLqYpNY.js">
98
98
  <link rel="modulepreload" crossorigin href="/assets/external-link-Sw3ah_JD.js">
@@ -107,16 +107,16 @@
107
107
  <link rel="modulepreload" crossorigin href="/assets/doc-browser-context-DfLHAWbG.js">
108
108
  <link rel="modulepreload" crossorigin href="/assets/doc-browser-CzCV73NJ.js">
109
109
  <link rel="modulepreload" crossorigin href="/assets/doc-browser-BUlCkZo2.js">
110
- <link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-C6EN0_eq.js">
110
+ <link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-D33zVbr5.js">
111
111
  <link rel="modulepreload" crossorigin href="/assets/logo-badge-BQgKnVtz.js">
112
112
  <link rel="modulepreload" crossorigin href="/assets/skeleton-CFQRIUzt.js">
113
- <link rel="modulepreload" crossorigin href="/assets/chat-ZQIVJChB.js">
113
+ <link rel="modulepreload" crossorigin href="/assets/chat-DwUf7AKR.js">
114
114
  <link rel="modulepreload" crossorigin href="/assets/key-round-CnI1mc9F.js">
115
115
  <link rel="modulepreload" crossorigin href="/assets/message-square-D6Z4NwpG.js">
116
- <link rel="modulepreload" crossorigin href="/assets/app-navigation.config-BjIj_FLm.js">
117
- <link rel="modulepreload" crossorigin href="/assets/notice-card-uzwjFyML.js">
116
+ <link rel="modulepreload" crossorigin href="/assets/app-navigation.config-DgiR0c5_.js">
117
+ <link rel="modulepreload" crossorigin href="/assets/notice-card-BPtCVEKW.js">
118
118
  <link rel="modulepreload" crossorigin href="/assets/status-dot-Dv_hiUVa.js">
119
- <link rel="modulepreload" crossorigin href="/assets/app-manager-provider-BZr5VxCe.js">
119
+ <link rel="modulepreload" crossorigin href="/assets/app-manager-provider-C0ONQxUg.js">
120
120
  <link rel="stylesheet" crossorigin href="/assets/index-D8MKmXtO.css">
121
121
  </head>
122
122
 
package/dist/sw.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /* global caches, self */
2
2
 
3
- const SHELL_CACHE = 'nextclaw-ui-shell-v1';
4
- const RUNTIME_CACHE = 'nextclaw-ui-runtime-v1';
5
- const SHELL_ASSETS = ['/', '/offline.html', '/manifest.webmanifest', '/logo.svg', '/pwa-192.png', '/pwa-512.png'];
3
+ const SHELL_CACHE = 'nextclaw-ui-shell-v2';
4
+ const RUNTIME_CACHE = 'nextclaw-ui-runtime-v2';
5
+ const SHELL_ASSETS = ['/offline.html', '/manifest.webmanifest', '/logo.svg', '/pwa-192.png', '/pwa-512.png'];
6
6
 
7
7
  self.addEventListener('install', (event) => {
8
8
  event.waitUntil(
@@ -10,6 +10,7 @@ self.addEventListener('install', (event) => {
10
10
  return cache.addAll(SHELL_ASSETS);
11
11
  })
12
12
  );
13
+ self.skipWaiting();
13
14
  });
14
15
 
15
16
  self.addEventListener('activate', (event) => {
@@ -59,10 +60,6 @@ async function handleNavigation(request) {
59
60
  runtimeCache.put(request, response.clone());
60
61
  return response;
61
62
  } catch {
62
- const cachedResponse = await caches.match(request);
63
- if (cachedResponse) {
64
- return cachedResponse;
65
- }
66
63
  return caches.match('/offline.html');
67
64
  }
68
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/ui",
3
- "version": "0.12.20-beta.6",
3
+ "version": "0.12.21",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,14 +28,14 @@
28
28
  "tailwind-merge": "^2.5.4",
29
29
  "zod": "^3.23.8",
30
30
  "zustand": "^5.0.2",
31
- "@nextclaw/client-sdk": "0.1.1-beta.6",
32
- "@nextclaw/agent-chat": "0.1.11-beta.4",
33
- "@nextclaw/agent-chat-ui": "0.3.13-beta.4",
34
- "@nextclaw/kernel": "0.1.2-beta.6",
35
- "@nextclaw/ncp": "0.5.6-beta.4",
36
- "@nextclaw/server": "0.12.13-beta.6",
37
- "@nextclaw/ncp-http-agent-client": "0.3.18-beta.5",
38
- "@nextclaw/ncp-react": "0.4.26-beta.5"
31
+ "@nextclaw/agent-chat-ui": "0.3.14",
32
+ "@nextclaw/client-sdk": "0.1.2",
33
+ "@nextclaw/ncp-http-agent-client": "0.3.19",
34
+ "@nextclaw/ncp-react": "0.4.27",
35
+ "@nextclaw/ncp": "0.5.7",
36
+ "@nextclaw/server": "0.12.14",
37
+ "@nextclaw/shared": "0.1.1",
38
+ "@nextclaw/agent-chat": "0.1.12"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@testing-library/react": "^16.3.0",
package/public/sw.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /* global caches, self */
2
2
 
3
- const SHELL_CACHE = 'nextclaw-ui-shell-v1';
4
- const RUNTIME_CACHE = 'nextclaw-ui-runtime-v1';
5
- const SHELL_ASSETS = ['/', '/offline.html', '/manifest.webmanifest', '/logo.svg', '/pwa-192.png', '/pwa-512.png'];
3
+ const SHELL_CACHE = 'nextclaw-ui-shell-v2';
4
+ const RUNTIME_CACHE = 'nextclaw-ui-runtime-v2';
5
+ const SHELL_ASSETS = ['/offline.html', '/manifest.webmanifest', '/logo.svg', '/pwa-192.png', '/pwa-512.png'];
6
6
 
7
7
  self.addEventListener('install', (event) => {
8
8
  event.waitUntil(
@@ -10,6 +10,7 @@ self.addEventListener('install', (event) => {
10
10
  return cache.addAll(SHELL_ASSETS);
11
11
  })
12
12
  );
13
+ self.skipWaiting();
13
14
  });
14
15
 
15
16
  self.addEventListener('activate', (event) => {
@@ -59,10 +60,6 @@ async function handleNavigation(request) {
59
60
  runtimeCache.put(request, response.clone());
60
61
  return response;
61
62
  } catch {
62
- const cachedResponse = await caches.match(request);
63
- if (cachedResponse) {
64
- return cachedResponse;
65
- }
66
63
  return caches.match('/offline.html');
67
64
  }
68
65
  }
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef } from 'react';
2
- import { eventKeys } from '@nextclaw/kernel';
2
+ import { eventKeys } from '@nextclaw/shared';
3
3
  import { applyNcpSessionRealtimeEvent, nextclawClient } from '@/shared/lib/api';
4
4
  import { runtimeUpdateManager, systemStatusManager } from '@/features/system-status';
5
5
  import type { QueryClient } from '@tanstack/react-query';
@@ -3,7 +3,13 @@ import userEvent from "@testing-library/user-event";
3
3
  import { MemoryRouter } from "react-router-dom";
4
4
  import { beforeEach, describe, expect, it, vi } from "vitest";
5
5
  import { AgentsPage } from "@/features/agents";
6
- import { useChatInputStore, useChatSessionListStore } from "@/features/chat";
6
+ import {
7
+ ChatPresenterProvider,
8
+ NcpChatPresenter,
9
+ useChatInputStore,
10
+ useChatSessionListStore,
11
+ useChatThreadStore,
12
+ } from "@/features/chat";
7
13
  import { setLanguage } from "@/shared/lib/i18n";
8
14
 
9
15
  const mocks = vi.hoisted(() => ({
@@ -113,6 +119,17 @@ vi.mock("@/features/chat", async (importOriginal) => {
113
119
  };
114
120
  });
115
121
 
122
+ function renderAgentsPage() {
123
+ const presenter = new NcpChatPresenter();
124
+ return render(
125
+ <MemoryRouter>
126
+ <ChatPresenterProvider presenter={presenter}>
127
+ <AgentsPage />
128
+ </ChatPresenterProvider>
129
+ </MemoryRouter>,
130
+ );
131
+ }
132
+
116
133
  describe("AgentsPage", () => {
117
134
  beforeEach(() => {
118
135
  setLanguage("zh");
@@ -141,6 +158,13 @@ describe("AgentsPage", () => {
141
158
  ...useChatSessionListStore.getState().snapshot,
142
159
  selectedAgentId: "main",
143
160
  selectedSessionKey: "session-1",
161
+ draftSessionKey: "stale-draft-session",
162
+ },
163
+ });
164
+ useChatThreadStore.setState({
165
+ snapshot: {
166
+ ...useChatThreadStore.getState().snapshot,
167
+ sessionKey: "session-1",
144
168
  },
145
169
  });
146
170
  });
@@ -148,11 +172,7 @@ describe("AgentsPage", () => {
148
172
  it("renders the agents workspace in Chinese and keeps core actions visible", async () => {
149
173
  const user = userEvent.setup();
150
174
 
151
- render(
152
- <MemoryRouter>
153
- <AgentsPage />
154
- </MemoryRouter>,
155
- );
175
+ renderAgentsPage();
156
176
 
157
177
  expect(screen.getByText("Agent 管理台")).toBeTruthy();
158
178
  expect(
@@ -182,11 +202,7 @@ describe("AgentsPage", () => {
182
202
  it("uses a runtime dropdown instead of manual text input when editing an agent", async () => {
183
203
  const user = userEvent.setup();
184
204
 
185
- render(
186
- <MemoryRouter>
187
- <AgentsPage />
188
- </MemoryRouter>,
189
- );
205
+ renderAgentsPage();
190
206
 
191
207
  await user.click(screen.getAllByRole("button", { name: "编辑" })[1]);
192
208
 
@@ -216,20 +232,19 @@ describe("AgentsPage", () => {
216
232
  it("starts a draft chat with the agent runtime as the pending session type", async () => {
217
233
  const user = userEvent.setup();
218
234
 
219
- render(
220
- <MemoryRouter>
221
- <AgentsPage />
222
- </MemoryRouter>,
223
- );
235
+ renderAgentsPage();
224
236
 
225
237
  await user.click(screen.getAllByRole("button", { name: "开始对话" })[1]);
226
238
 
239
+ const sessionListSnapshot = useChatSessionListStore.getState().snapshot;
227
240
  expect(useChatSessionListStore.getState().snapshot.selectedAgentId).toBe(
228
241
  "researcher",
229
242
  );
230
- expect(
231
- useChatSessionListStore.getState().snapshot.selectedSessionKey,
232
- ).toBeNull();
243
+ expect(sessionListSnapshot.selectedSessionKey).toBeNull();
244
+ expect(sessionListSnapshot.draftSessionKey).not.toBe("stale-draft-session");
245
+ expect(useChatThreadStore.getState().snapshot.sessionKey).toBe(
246
+ sessionListSnapshot.draftSessionKey,
247
+ );
233
248
  expect(useChatInputStore.getState().snapshot.pendingSessionType).toBe(
234
249
  "codex",
235
250
  );