pisper 0.6.9 → 0.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/npm-platform.mjs +0 -1
- package/lib/platform.mjs +2 -1
- package/package.json +6 -7
- package/web/.vite/manifest.json +943 -844
- package/web/assets/{AppDialog-DJZWnxzH.js → AppDialog-1E6olv_T.js} +1 -1
- package/web/assets/{AppOverlays-DICzFYsW.js → AppOverlays-BV_gIt77.js} +1 -1
- package/web/assets/AppSelect-BGVBQRP1.js +1 -0
- package/web/assets/AssetsPage-6HTR2IpQ.js +1 -0
- package/web/assets/{BoardPage-DKjz8Sj_.js → BoardPage-CL2e-8j4.js} +3 -3
- package/web/assets/BrandLogo-k3CvJjd4.js +1 -0
- package/web/assets/ChannelsPage-CmczBcSA.js +1 -0
- package/web/assets/{ChatAppearancePage-6Mq1uFuU.js → ChatAppearancePage-DMAnYGNb.js} +1 -1
- package/web/assets/{ChatHistoryPage-j-_vMM-M.js → ChatHistoryPage-DedOh6aO.js} +1 -1
- package/web/assets/ChatPage-b16p3qWl.js +553 -0
- package/web/assets/ConfigPage-BYB0rL_V.js +5 -0
- package/web/assets/{DesktopWindowControls-BOrn8KGA.js → DesktopWindowControls-DAuHMZFO.js} +1 -1
- package/web/assets/DispatchOverlay-CEbzXIct.js +1 -0
- package/web/assets/{FeaturePage-1MUXz3Y-.js → FeaturePage-BJGDVZ_u.js} +1 -1
- package/web/assets/{FileAttachmentPreview-B17OgdVi.js → FileAttachmentPreview-Cw5-ApIr.js} +1 -1
- package/web/assets/{FloatingWidgets-CcPNUEFB.js → FloatingWidgets-BQXBxVDd.js} +1 -1
- package/web/assets/FocusRuntimeControls-C7b1I2L5.js +1 -0
- package/web/assets/{GitDiffViewer-CSl-SGa1.js → GitDiffViewer-BAZTiiDo.js} +1 -1
- package/web/assets/{HoldToConfirmButton-CVyju89W.js → HoldToConfirmButton-BxdJ7icc.js} +1 -1
- package/web/assets/LaunchConsole-uKHKx4h0.js +2 -0
- package/web/assets/{ManageProjectsDialog-DSN8QUPg.js → ManageProjectsDialog-03d7p6Td.js} +1 -1
- package/web/assets/{MarkdownMessage-BPZcFjyR.js → MarkdownMessage-B_9d8KI-.js} +1 -1
- package/web/assets/McpPage-7NEAc3Rv.js +1 -0
- package/web/assets/MemoryPage-_mnn45jY.js +1 -0
- package/web/assets/{MobileNavigation-Cc4zcU3a.js → MobileNavigation-IXJN0OuM.js} +1 -1
- package/web/assets/{MorePage-B-qsYMAv.js → MorePage-DtqJlHAA.js} +1 -1
- package/web/assets/{PageHeader-mUKoAR30.js → PageHeader-6KRCT1j1.js} +1 -1
- package/web/assets/{PageState-aWHrkE1D.js → PageState-Cz6vFMXv.js} +1 -1
- package/web/assets/{PhoneDrawer-qES4OwMx.js → PhoneDrawer-Cp6X4_ei.js} +1 -1
- package/web/assets/{PhoneMenuButton-DEbqHUUP.js → PhoneMenuButton-Cl7FEYYw.js} +1 -1
- package/web/assets/{PhoneTopBar-CLPmKZ4Q.js → PhoneTopBar-CR1m9vf3.js} +1 -1
- package/web/assets/{PluginsPage-B53DParo.js → PluginsPage-CNddCaYt.js} +1 -1
- package/web/assets/{QuickPromptIdeas-gKobqAO3.js → QuickPromptIdeas-C7X4T7kx.js} +1 -1
- package/web/assets/{SafeModePrompt-Dlq8rlix.js → SafeModePrompt-jSCZVMGa.js} +1 -1
- package/web/assets/SchedulesPage-BRqBCtCf.js +1 -0
- package/web/assets/SessionBrowserPane-maCbfzXl.js +2 -0
- package/web/assets/SessionContextPanel-BSY6NaRx.js +2 -0
- package/web/assets/{SessionHome-CVdMY-bT.js → SessionHome-Wu8JWsto.js} +1 -1
- package/web/assets/SessionInspector-BRIFfuiZ.js +1 -0
- package/web/assets/{SessionShell-Vv2oGR0M.js → SessionShell-Dp94FUuk.js} +1 -1
- package/web/assets/{SettingsSidebar-cG_oKSWN.js → SettingsSidebar-CP1qDAcx.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-C5KKKBZd.js → ShortcutHelpDialog-C5f_x4XG.js} +1 -1
- package/web/assets/{ShortcutKeys-zuzmq8eW.js → ShortcutKeys-Cx8hNJ62.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-BXimwZ77.js → SidebarUpdateStatus-YxE_hT2l.js} +1 -1
- package/web/assets/{SkillsPage-AhmayxVl.js → SkillsPage-z6rTYJ8Z.js} +1 -1
- package/web/assets/TaskProcessesPane-yhEsHe1N.js +1 -0
- package/web/assets/TaskTerminalView-CT6V8AGR.js +18 -0
- package/web/assets/{TerminalPanel-wvzi7jBd.js → TerminalPanel-598uzwoB.js} +1 -1
- package/web/assets/{WebDesktopPet-qREBG08n.js → WebDesktopPet-D6bkGOwL.js} +1 -1
- package/web/assets/WorkflowsPage-DrltlXh1.js +1 -0
- package/web/assets/{WorkspacePicker-B68VTV5x.js → WorkspacePicker-DPwlN6KA.js} +1 -1
- package/web/assets/{api-DVgYxLec.js → api-45iTnFjN.js} +1 -1
- package/web/assets/{app-primitives-Cmdj4cIW.js → app-primitives-Drz_SjnR.js} +1 -1
- package/web/assets/{app-update-BEymQxyl.js → app-update-kStNhVOh.js} +1 -1
- package/web/assets/{approval-confirm-JevCpyyv.js → approval-confirm-CCo7v8Ln.js} +1 -1
- package/web/assets/{badge-Dk1N1mVf.js → badge-CWB3lj2H.js} +1 -1
- package/web/assets/{board-launch-CUV0KEKT.js → board-launch-YigjCnZf.js} +1 -1
- package/web/assets/board-messages-xFeTO3o6.js +1 -0
- package/web/assets/{board-projects-VBEGB9VD.js → board-projects-LnEYyP4h.js} +1 -1
- package/web/assets/{button-Bu_vuij9.js → button-CCcCN8tE.js} +1 -1
- package/web/assets/{chat-api-CQ9MShHZ.js → chat-api-BBuYjxwz.js} +1 -1
- package/web/assets/checkbox-BrEHgFV0.js +1 -0
- package/web/assets/client-store-CAhvptv1.js +1 -0
- package/web/assets/{collapsible-C__hRcbA.js → collapsible-DMaUQRX4.js} +1 -1
- package/web/assets/{config-search-ClE5BFDz.js → config-search-C1YtwJAQ.js} +1 -1
- package/web/assets/{dialog-Kx6RCn3A.js → dialog-2cmY5V75.js} +1 -1
- package/web/assets/{dist-Cfh4kzCK.js → dist-41X0pdUs.js} +1 -1
- package/web/assets/{dist-BdkTa5R3.js → dist-BHkR6BLP.js} +1 -1
- package/web/assets/dist-BRjj4UeB.js +1 -0
- package/web/assets/dist-BaBySQmo.js +1 -0
- package/web/assets/{dist-BlIIpW6W.js → dist-BiRPwy4W.js} +1 -1
- package/web/assets/{dist-B_a0oV4U.js → dist-BsRXXcSL.js} +1 -1
- package/web/assets/dist-DzGQ7sLi.js +1 -0
- package/web/assets/{dist-TksYpDID.js → dist-OB2r6Xsr.js} +1 -1
- package/web/assets/dist-V8chnW6-.js +1 -0
- package/web/assets/dropdown-menu-CFIFNaKO.js +1 -0
- package/web/assets/es2015-DTZdOI9P.js +41 -0
- package/web/assets/{events-ulSEiNKt.js → events-n27XPFgs.js} +1 -1
- package/web/assets/{field-Bnm9KAi2.js → field-DaxtcBBA.js} +1 -1
- package/web/assets/{hosts-B-POTAmu.js → hosts-CmK7Yt82.js} +1 -1
- package/web/assets/i18n-DfsxGeh5.js +1 -0
- package/web/assets/{index-C4CqzQNY.js → index-BDgCJ4Fs.js} +2 -2
- package/web/assets/index-CfTBR7Rs.css +2 -0
- package/web/assets/input-CPw-zkYh.js +1 -0
- package/web/assets/input-group-CDEyjyK4.js +1 -0
- package/web/assets/{label-BzlNatZM.js → label-CVWjEcfV.js} +1 -1
- package/web/assets/{launch-defaults-store-7CojCPDE.js → launch-defaults-store-CGeglXDI.js} +1 -1
- package/web/assets/model-display-kDwvtxrW.js +1 -0
- package/web/assets/mount-app-Bxa7xF8d.js +9 -0
- package/web/assets/{permission-rules-api-BQlSNrYK.js → permission-rules-api-BvKOF7rS.js} +1 -1
- package/web/assets/{pick-system-directory-BgN7vwKS.js → pick-system-directory-DSupTk88.js} +1 -1
- package/web/assets/placements--Zk5njsN.js +2 -0
- package/web/assets/{popover-DT3PkPcL.js → popover-BtcdIPRz.js} +1 -1
- package/web/assets/{progress-YhljaYNy.js → progress-5odAz3B9.js} +1 -1
- package/web/assets/public--8F2_oqP.js +1 -0
- package/web/assets/public-CgydVZuV.js +2 -0
- package/web/assets/public-components-CeIuV0FY.js +1 -0
- package/web/assets/public-diff-DWbitsnS.js +1 -0
- package/web/assets/public-launch-DtVwSANs.js +1 -0
- package/web/assets/run-activity-CwfO0cui.js +1 -0
- package/web/assets/{runtime-capabilities-store--7mKyYAM.js → runtime-capabilities-store-D1FwQXKw.js} +1 -1
- package/web/assets/{safe-mode-instance-fnZLVjjd.js → safe-mode-instance-TonxlRrq.js} +1 -1
- package/web/assets/safe-mode-sentinel-BG78O0yJ.js +1 -0
- package/web/assets/segmented-control-BlM_GKV6.js +1 -0
- package/web/assets/select-DD_WO-gs.js +1 -0
- package/web/assets/{separator-cVAjxx3U.js → separator-BPh_qxvc.js} +1 -1
- package/web/assets/{session-change-summary-api-3216hpjE.js → session-change-summary-api-B9M9m1C0.js} +1 -1
- package/web/assets/{session-home-CM2_V5SZ.js → session-home-BDT4lMMJ.js} +1 -1
- package/web/assets/{session-organization-api-KZqrJZdA.js → session-organization-api-BgCoIi2X.js} +1 -1
- package/web/assets/{session-scope-Bw40iOXx.js → session-scope-t_l7TRH5.js} +1 -1
- package/web/assets/{session-tree-actions-oMnZOFG4.js → session-tree-actions-7q68B3e-.js} +1 -1
- package/web/assets/{session-tree-summary-PpU7AyqE.js → session-tree-summary-CMgz9Uf-.js} +1 -1
- package/web/assets/{sheet-CASx5kBt.js → sheet-BTaIEX4w.js} +1 -1
- package/web/assets/{shortcuts-BOeaPAvF.js → shortcuts-BGzXmClx.js} +1 -1
- package/web/assets/{side-chat-context-BcCF9VZz.js → side-chat-context-D36twdWd.js} +7 -7
- package/web/assets/{sidebar-4xAUV3YP.js → sidebar-BIagLnrN.js} +2 -2
- package/web/assets/{sidebar-store-we4gMwQq.js → sidebar-store-DztdHlUn.js} +1 -1
- package/web/assets/slider-DTmAZl-R.js +1 -0
- package/web/assets/{speech-session-ClA_5hmd.js → speech-session-D0GE-Pym.js} +1 -1
- package/web/assets/{startup-queries--JqGB_Cp.js → startup-queries-BAWDaQY5.js} +1 -1
- package/web/assets/{switch-DRkmP9uM.js → switch-D_G8wFhs.js} +1 -1
- package/web/assets/tabs-DsgBuvJv.js +1 -0
- package/web/assets/{tooltip-EomUbN9-.js → tooltip-D4MFbqcG.js} +1 -1
- package/web/assets/{use-i18n-D2P6OO3w.js → use-i18n-CVZdp2ZN.js} +1 -1
- package/web/assets/use-mobile-DauOEda6.js +1 -0
- package/web/assets/{use-studio-actions-CIA2TwfZ.js → use-studio-actions-C4Zh15Vx.js} +2 -2
- package/web/assets/{useBoardItems-BU9aonpg.js → useBoardItems-DCo-4he0.js} +1 -1
- package/web/assets/{useFleetSystemInfo-BMpdQSqr.js → useFleetSystemInfo-BbQQId7X.js} +1 -1
- package/web/assets/{useNow-DAVNVxdo.js → useNow-CxO2FUQY.js} +1 -1
- package/web/assets/usePhoneShell-m3H_98m_.js +1 -0
- package/web/assets/{useSessionListQuery-DqZ3m8O9.js → useSessionListQuery-CJ-BYuqu.js} +1 -1
- package/web/assets/{useSessionRowActions-DTxXBruc.js → useSessionRowActions-D0GKtBhg.js} +1 -1
- package/web/assets/{useSidebarModel-DtY4PopW.js → useSidebarModel-b5cdTj9-.js} +1 -1
- package/web/assets/{web-preview-tGGVFpDI.js → web-preview-Bdrxyj-l.js} +1 -1
- package/web/assets/{web-preview-events-Bl80SpFF.js → web-preview-events-BBbAgfr4.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/AppSelect-fH3gqflO.js +0 -1
- package/web/assets/AssetsPage-BhrkErwt.js +0 -1
- package/web/assets/BrandLogo-C6O8cv-b.js +0 -1
- package/web/assets/ChannelsPage-C6A-ClM6.js +0 -1
- package/web/assets/ChatPage-B1V00hUs.js +0 -553
- package/web/assets/ComposerCommandMenu-BnwvT15Y.js +0 -1
- package/web/assets/ConfigPage-DwVhvmWL.js +0 -3
- package/web/assets/DispatchOverlay-ByJYJO36.js +0 -1
- package/web/assets/LaunchConsole-DRnR4Irg.js +0 -2
- package/web/assets/McpPage-DeuJ0HzI.js +0 -1
- package/web/assets/MemoryPage-CxFJYVZs.js +0 -1
- package/web/assets/SchedulesPage-BUDQGrHe.js +0 -1
- package/web/assets/SessionBrowserPane-Bq_U_5i9.js +0 -2
- package/web/assets/SessionContextPanel-V4QZj7xu.js +0 -2
- package/web/assets/SessionInspector-C14ilfNC.js +0 -1
- package/web/assets/TaskProcessesPane-hcChPVpA.js +0 -1
- package/web/assets/TaskTerminalView-DcFp0oHH.js +0 -18
- package/web/assets/WorkflowsPage-Dg9Mh9ND.js +0 -1
- package/web/assets/board-messages-CcVs4aSw.js +0 -1
- package/web/assets/checkbox-CG2AnYPm.js +0 -1
- package/web/assets/client-store-B-3_7075.js +0 -1
- package/web/assets/dist-DAs5KRGl.js +0 -1
- package/web/assets/dist-alOyD2Bh.js +0 -1
- package/web/assets/dropdown-menu-gZkWDhaR.js +0 -1
- package/web/assets/es2015-0QT3KgdC.js +0 -41
- package/web/assets/i18n-DPvJ0T4T.js +0 -1
- package/web/assets/index-DbL8igcD.css +0 -2
- package/web/assets/input-DIwJDpj9.js +0 -1
- package/web/assets/mount-app-CxpqEKPV.js +0 -9
- package/web/assets/placements-5xDVBdPk.js +0 -2
- package/web/assets/public-CyIfRdzo.js +0 -1
- package/web/assets/public-DwUlE0fE.js +0 -2
- package/web/assets/public-components-Cv7X4fW8.js +0 -1
- package/web/assets/public-diff-1bDiNGBB.js +0 -1
- package/web/assets/public-launch-D8n5o2kS.js +0 -1
- package/web/assets/safe-mode-sentinel-DEJ0ZBB_.js +0 -1
- package/web/assets/segmented-control-BOJt5SLj.js +0 -1
- package/web/assets/select-JC5m2BRQ.js +0 -1
- package/web/assets/tabs-C4VeYYS2.js +0 -1
- package/web/assets/usePhoneShell-w7JLYU3H.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,n,r}from"./vendor-react-DwNgTV1j.js";import{d as i,u as a}from"./i18n-DPvJ0T4T.js";import{t as o}from"./use-i18n-D2P6OO3w.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./braces-DQcXLGFF.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./file-text-N9JICX6E.js";var d=s(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),f=e(t(),1);function p(e){let t=e.match(/^\/btw(?:\s+([\s\S]*))?$/);return t?(t[1]||``).trim():null}function m(e,t,n,r){return n.length?[{invocation:`/${e}`,description:t},...n.map(t=>({invocation:`/${e} ${t.value}`,description:t.label,current:t.current,run:()=>r(t.value)}))]:[]}function h({t:e,models:t,model:n,onModel:r,thinkingLevels:i,thinkingLevel:a,thinkingLabel:o,onThinking:s,executionModes:c,executionMode:l,executionLabel:u,onExecutionMode:d,runModes:f,runMode:p,runModeLabel:h,onRunMode:g}){return[...m(`model`,e(`chat:commands.builtin.model`),t.map(e=>({value:e.key,label:e.providerName?`${e.label} · ${e.providerName}`:e.label,current:e.key===n})),r),...m(`effort`,e(`chat:commands.builtin.effort`),i.map(e=>({value:e,label:o(e),current:e===a})),s),...m(`approval`,e(`chat:commands.builtin.approval`),c.map(e=>({value:e,label:u(e),current:e===l})),d),...f.length>1?m(`run`,e(`chat:commands.builtin.run`),f.map(e=>({value:e,label:h(e),current:e===p})),g):[]]}function g(e,t,n){let r=e=>e.toLocaleLowerCase(n),i=r(t),a=i.search(/\s/);if(a<0)return e.filter(e=>!e.invocation.includes(` `)&&r(`${e.invocation} ${e.description}`).includes(i));let o=`/${i.slice(0,a)} `,s=i.slice(a).trim();return e.filter(e=>r(e.invocation).startsWith(o)&&r(`${e.invocation} ${e.description}`).includes(s))}var _=10485760,v=20971520,y=new Set([`txt`,`md`,`json`,`js`,`jsx`,`ts`,`tsx`,`css`,`html`,`xml`,`yaml`,`yml`,`csv`,`log`,`py`,`java`,`go`,`rs`,`sh`,`ps1`,`toml`,`sql`]),b=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`]),x=new Set([`pdf`,`docx`,`pptx`,`xlsx`,`odt`,`odp`,`ods`,`rtf`,`epub`]),S=[`image/*`,`text/*`,`application/json`,...[...b,...y,...x].map(e=>`.${e}`)].join(`,`);function C(e){let t=[...e?.files||[]];return t.length?t:[...e?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>!!e)}function w(e){return[...e?.types||[]].includes(`Files`)}function T(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(String(i.result).split(`,`)[1]||``),i.onerror=()=>r(i.error||Error(t(`chat:attachments.couldNotReadFile`))),i.readAsDataURL(e)})}function E(e){return e.toLowerCase().split(`.`).at(-1)||``}async function D(e,t){let n=[...e].slice(0,8),r=[];for(let e of n){if(e.size>_)throw Error(t(`chat:attachments.nameExceedsThe10MBLimit`,{name:e.name}));let n=E(e.name),i={id:`${e.name}-${e.lastModified}-${e.size}`,name:e.name,mimeType:e.type||`application/octet-stream`,size:e.size};if(e.type.startsWith(`image/`)||b.has(n))r.push({...i,kind:`image`,data:await T(e,t)});else if(e.type.startsWith(`text/`)||e.type===`application/json`||y.has(n))r.push({...i,kind:`text`,text:await e.text()});else if(x.has(n))r.push({...i,kind:`document`,extension:n,data:await T(e,t)});else throw Error(t(`chat:attachments.nameIsNotSupportedChooseAnImageOrTextCodeFile`,{name:e.name}))}return r}function O(e){return e.split(/[\\/]/).filter(Boolean).at(-1)||e}function k(e){return[...e].map(e=>String(e||``).trim()).filter(Boolean).slice(0,8).map(e=>({id:`path:${e}`,kind:`path`,name:O(e),path:e}))}function A(e=[],t,n){let r=(0,f.useCallback)((e,t)=>i(e,a(),t),[]),[o,s]=(0,f.useState)(()=>[...e]),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)([]),p=(0,f.useRef)(new Map),m=(0,f.useRef)(0),h=(0,f.useRef)(n);h.current=n,(0,f.useEffect)(()=>{let e=p.current;return d([]),l(``),()=>{for(let t of e.values())t.cancelled=!0;e.clear()}},[n]);let g=(0,f.useRef)([...e]),_=(0,f.useCallback)(e=>{g.current=e,s(e),t?.(e)},[t]),y=(0,f.useCallback)(async e=>{let t=n,i=[...e||[]].slice(0,8).map(e=>{let t=`preparing-${++m.current}`,n={name:e.name,cancelled:!1};return p.current.set(t,n),{id:t,job:n,file:e}}),a=()=>d([...p.current].map(([e,t])=>({id:e,name:t.name})));a(),l(``);let o=!1;for(let{id:e,job:n,file:s}of i)try{let i=await D([s],r);if(n.cancelled||h.current!==t||!p.current.has(e))continue;let a=[...g.current,...i].slice(0,8);if(a.filter(e=>e.kind!==`path`).reduce((e,t)=>e+(t.size||0),0)>v)throw Error(r(`chat:attachments.totalAttachmentSizeCannotExceed20MB`));_(a),o=!0}catch(e){!n.cancelled&&h.current===t&&l(e instanceof Error?e.message:String(e))}finally{p.current.delete(e),h.current===t&&a()}return o},[n,_,r]);return{attachments:o,attachmentError:c,preparingAttachments:u,addFiles:y,pasteFiles:(0,f.useCallback)(e=>{let t=C(e.clipboardData);t.length&&(e.preventDefault(),y(t))},[y]),dropFiles:(0,f.useCallback)(e=>{if(!w(e.dataTransfer))return;e.preventDefault();let t=C(e.dataTransfer);t.length&&y(t)},[y]),removeAttachment:(0,f.useCallback)(e=>{let t=p.current.get(e);if(t){t.cancelled=!0,p.current.delete(e),d([...p.current].map(([e,t])=>({id:e,name:t.name})));return}_(g.current.filter(t=>t.id!==e))},[_]),clearAttachments:(0,f.useCallback)(()=>{for(let e of p.current.values())e.cancelled=!0;p.current.clear(),d([]),_([])},[_]),addAttachments:(0,f.useCallback)(e=>{if(h.current!==n)return;l(``);let t=[...g.current];for(let n of e)t.some(e=>e.id===n.id)||t.push(n);_(t.slice(0,8))},[n,_]),replaceAttachments:_,setError:(0,f.useCallback)(e=>{l(e instanceof Error?e.message:String(e||``))},[])}}var j=new Map,M=new Map;function N(e,t){let n=t.match(/^\/[^\s]*(?:\s+([\s\S]*))?$/),r=(n?n[1]||``:t).trim();return`${e}${r?` ${r}`:` `}`}function P(e){return{text:e?.text||``,attachments:[...e?.attachments||[]]}}function F(e){return P(j.get(e))}function I(e,t){if(!e)return;let n={...F(e),...t};n.attachments=[...n.attachments];let r=F(e);r.text===n.text&&r.attachments.length===n.attachments.length&&r.attachments.every((e,t)=>e===n.attachments[t])||(r.text!==n.text&&M.set(e,(M.get(e)||0)+1),j.delete(e),!(!n.text&&!n.attachments.length)&&j.set(e,n))}function L(e){M.set(e,(M.get(e)||0)+1),j.delete(e)}function R(e,t){let n=[...e.attachments],r=new Set(n.map(e=>e.id));for(let e of t.attachments){let t=e.id;if(!t||r.has(t)){let n=1;do t=`${e.id||`attachment`}-restored-${n++}`;while(r.has(t))}r.add(t),n.push({...e,id:t})}return{text:e.text&&t.text?`${e.text}\n${t.text}`:e.text||t.text,attachments:n}}function z(e){let t=(0,f.useRef)(e);t.current=e;let n=(0,f.useRef)(!0);(0,f.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,f.useRef)(F(e)),[i,a]=(0,f.useState)(r.current.text),o=(0,f.useCallback)(t=>I(e,{attachments:t}),[e]),s=A(r.current.attachments,o,e),c=s.replaceAttachments,l=s.clearAttachments;return(0,f.useEffect)(()=>{let t=F(e);a(t.text),c(t.attachments)},[c,e]),{value:i,updateValue:(0,f.useCallback)(t=>{a(t),I(e,{text:t})},[e]),selection:s,clearDraft:(0,f.useCallback)(()=>{let r=F(e);r.text!==i||r.attachments.length!==s.attachments.length||r.attachments.some((e,t)=>e!==s.attachments[t])||(L(e),!(!n.current||t.current!==e)&&(a(``),l()))},[l,s.attachments,e,i]),restoreDraft:(0,f.useCallback)(r=>{let i=R(F(e),r);return I(e,i),!n.current||t.current!==e?!1:(a(i.text),c(i.attachments),!0)},[c,e]),captureSubmission:(0,f.useCallback)(()=>{let r=F(e),i=M.get(e)||0,o=!1;return{accept(){if(o)return;o=!0;let s=F(e),l={text:(M.get(e)||0)===i?``:s.text,attachments:s.attachments.filter(e=>!r.attachments.includes(e))};I(e,l),!(!n.current||t.current!==e)&&(a(l.text),c(l.attachments))}}},[c,e])}}var B=e(n(),1);function V({anchor:e,menu:t,viewport:n,placement:r=`top`,align:i=`start`,maxHeight:a=1/0}){let o=n.top+8,s=Math.max(o,n.top+n.height-8),c=n.left+8,l=Math.max(c,n.left+n.width-8),u={top:Math.max(0,Math.min(e.top,s)-o-8),bottom:Math.max(0,s-Math.max(e.bottom,o)-8)},d=Math.min(t.height,a),f=r===`top`?`bottom`:`top`,p=d>u[r]&&u[f]>u[r]?f:r,m=Math.min(a,u[p]),h=Math.min(d,m),g=Math.min(t.width,l-c);return{side:p,left:Math.max(c,Math.min(i===`end`?e.right-g:e.left,l-g)),top:Math.max(o,Math.min(p===`top`?e.top-8-h:e.bottom+8,s-h)),width:g,maxHeight:m}}var H=r();function U({open:e,anchorRef:t,menuRef:n,placement:r=`top`,align:i=`start`,matchAnchorWidth:a=!1,maxHeight:o,id:s,className:c,role:l,ariaLabel:u,onClose:d,children:p}){return(0,f.useEffect)(()=>{if(!e||!d)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),d())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,d]),(0,f.useLayoutEffect)(()=>{if(!e)return;let s=()=>{let e=n.current,s=t.current;if(!e||!s)return;let c=s.getBoundingClientRect(),l=window.visualViewport;e.style.width=a?`${c.width}px`:``;let u=V({anchor:c,menu:{width:e.getBoundingClientRect().width,height:e.scrollHeight},viewport:{left:l?.offsetLeft??0,top:l?.offsetTop??0,width:l?.width??window.innerWidth,height:l?.height??window.innerHeight},placement:r,align:i,maxHeight:o});e.dataset.side=u.side,e.style.maxHeight=`${u.maxHeight}px`,e.style.overflowY=`auto`,e.style.width=`${u.width}px`,e.style.top=`${u.top}px`,e.style.bottom=`auto`,e.style.right=`auto`,e.style.left=`${u.left}px`};s();let c=null,l=()=>{c===null&&(c=window.requestAnimationFrame(()=>{c=null,s()}))},u=typeof ResizeObserver>`u`?null:new ResizeObserver(l);return n.current&&u?.observe(n.current),t.current&&u?.observe(t.current),window.addEventListener(`resize`,s),window.addEventListener(`scroll`,s,!0),window.visualViewport?.addEventListener(`resize`,l),window.visualViewport?.addEventListener(`scroll`,l),()=>{u?.disconnect(),c!==null&&window.cancelAnimationFrame(c),window.removeEventListener(`resize`,s),window.removeEventListener(`scroll`,s,!0),window.visualViewport?.removeEventListener(`resize`,l),window.visualViewport?.removeEventListener(`scroll`,l)}},[e,t,n,r,i,a,o]),e?(0,B.createPortal)((0,H.jsx)(`div`,{ref:n,id:s,className:c,style:{position:`fixed`,zIndex:65},role:l,"aria-label":u,children:p}),document.body):null}function W({resourceKey:e,loadCommands:t,builtinCommands:n=[],value:r,onChange:i,inputRef:a,placement:s=`top`}){let{t:p,language:m}=o(),h=(0,f.useId)(),_=(0,f.useRef)(null),v=r.match(/^\/([^\n]{0,120})$/),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(null),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(0),k=v?.[1]||``,A=/\s/.test(k),j=(0,f.useRef)(t);j.current=t;let M=(0,f.useMemo)(()=>g(n,k,m),[n,m,k]),P=!!(v&&y!==r&&(!A||M.length));(0,f.useEffect)(()=>{b(``),S(null),E(!1)},[e]),(0,f.useEffect)(()=>{if(!P||x)return;let e=!0;return w(!0),E(!1),j.current().then(t=>{e&&S(t.commands||[])}).catch(()=>{e&&(S([]),E(!0))}).finally(()=>e&&w(!1)),()=>{e=!1}},[x,P,e]);let F=(0,f.useMemo)(()=>{let e=M.map(e=>({kind:`builtin`,command:e}));if(A)return e;let t=k.toLocaleLowerCase(m),n=(x||[]).filter(e=>!t||`${e.invocation} ${e.name} ${e.description}`.toLocaleLowerCase(m).includes(t));return[...e,...n.map(e=>({kind:`resource`,command:e}))]},[A,M,x,m,k]);(0,f.useEffect)(()=>{O(0)},[k,x]);let I=()=>{b(r)},L=e=>{if(e.kind===`builtin`){let t=e.command.run?``:`${e.command.invocation} `;i(t),b(``),O(0),e.command.run&&e.command.run(),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length))});return}let t=N(e.command.invocation,r);i(t),b(t),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length),e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)})};(0,f.useEffect)(()=>{if(!P)return;let e=e=>{if(document.activeElement===a.current){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),I();return}F.length&&(e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),O(e=>(e+1)%F.length)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),O(e=>(e-1+F.length)%F.length)):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),L(F[Math.min(D,F.length-1)])))}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}),(0,f.useEffect)(()=>{let e=a.current;if(!P||!e)return;let t={role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":h,"aria-activedescendant":F.length?`${h}-${Math.min(D,F.length-1)}`:``},n=Object.keys(t).map(t=>[t,e.getAttribute(t)]);for(let[n,r]of Object.entries(t))r?e.setAttribute(n,r):e.removeAttribute(n);return()=>{for(let[t,r]of n)t&&(r===null?e.removeAttribute(t):e.setAttribute(t,r))}},[D,a,h,P,F.length]);let R={user:p(`chat:commands.scope.user`),project:p(`chat:commands.scope.project`),package:p(`chat:commands.scope.package`),custom:p(`chat:commands.scope.custom`)};return(0,H.jsx)(U,{open:P,anchorRef:a,menuRef:_,placement:s,matchAnchorWidth:!0,maxHeight:330,id:h,role:`listbox`,ariaLabel:p(`chat:commands.open`),className:`permission-mode-menu composer-command-menu overflow-y-auto rounded-md bg-solid p-1 text-content shadow-float`,children:(0,H.jsxs)(`div`,{className:`chat-resource-list composer-command-list flex min-h-0 [flex:1_1_0] flex-col gap-px overflow-y-auto [overscroll-behavior:contain] [scrollbar-gutter:stable] [touch-action:pan-y] [&_>_button]:grid [&_>_button]:w-full [&_>_button]:cursor-pointer [&_>_button]:grid-cols-[28px_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-2 [&_>_button]:rounded-sm [&_>_button]:px-1.5 [&_>_button]:py-1 [&_>_button]:text-left [&_>_button]:text-content [&_>_button.active]:bg-surface-hover max-[650px]:[&_>_button]:min-h-11 [&_button_>_span:nth-child(2)]:flex [&_button_>_span:nth-child(2)]:min-w-0 [&_button_>_span:nth-child(2)]:flex-col [&_strong]:truncate [&_strong]:font-mono [&_strong]:text-[13px] [&_strong]:font-medium [&_small]:truncate [&_small]:font-sans [&_small]:text-xs [&_small]:font-normal [&_small]:text-content-muted [&_em]:text-xs [&_em]:whitespace-nowrap [&_em]:text-content-muted [&_em]:not-italic [&_>_p]:m-auto [&_>_p]:px-2 [&_>_p]:py-1.5 [&_>_p]:text-xs [&_>_p]:text-content-muted`,children:[F.map((e,t)=>{let{command:n}=e,r=e.kind===`builtin`?e.command.current?l:d:e.command.source===`prompt`?u:c,i=e.kind===`resource`?e.command:null;return(0,H.jsxs)(`button`,{type:`button`,role:`option`,id:`${h}-${t}`,"aria-selected":t===D,className:t===D?`active`:``,onMouseEnter:()=>O(t),onMouseDown:e=>e.preventDefault(),onClick:()=>L(e),children:[(0,H.jsx)(`span`,{className:`list-icon grid size-7 place-items-center rounded-sm bg-surface-muted text-content-secondary`,children:(0,H.jsx)(r,{size:15})}),(0,H.jsxs)(`span`,{className:`composer-command-copy`,children:[(0,H.jsxs)(`strong`,{children:[n.invocation,i?.argumentHint&&(0,H.jsxs)(`small`,{children:[` `,i.argumentHint]})]}),(0,H.jsx)(`small`,{children:n.description||p(`chat:commands.noDescription`)})]}),(0,H.jsx)(`em`,{children:i?(0,H.jsxs)(H.Fragment,{children:[i.source===`prompt`?p(`chat:commands.prompt`):p(`chat:commands.skill`),` · `,R[i.scope]]}):e.kind===`builtin`&&e.command.current?p(`chat:commands.builtin.current`):p(`chat:commands.builtin.label`)})]},`${e.kind}:${n.invocation}`)}),!F.length&&(0,H.jsx)(`p`,{children:p(C?`chat:commands.loading`:T?`chat:commands.loadError`:`chat:commands.empty`)})]})})}export{I as a,w as c,p as d,F as i,k as l,L as n,z as o,N as r,S as s,W as t,h as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,m as n}from"./vendor-router-CSN_DGvx.js";import{t as r}from"./index-C4CqzQNY.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{c as o,d as s,n as c}from"./i18n-DPvJ0T4T.js";import{t as l}from"./use-i18n-D2P6OO3w.js";import{a as u,l as d,t as f}from"./api-DVgYxLec.js";import{n as p}from"./runtime-capabilities-BhAMiYhG.js";import{t as m}from"./runtime-capabilities-store--7mKyYAM.js";import{n as h}from"./client-store-B-3_7075.js";import{t as g}from"./createLucideIcon-Cd-3GVxJ.js";import{a as _,i as v,t as y}from"./permission-rules-api-BQlSNrYK.js";import{t as b}from"./arrow-left-B8oVrQ2S.js";import{t as x}from"./arrow-right-DqLOhpA2.js";import{t as S}from"./arrow-up-right-B6l8qFZz.js";import{t as C}from"./bell-BjONAtgH.js";import{t as w}from"./bot-B3TaBp_T.js";import{t as T}from"./brain-qxhnKqYP.js";import{t as E}from"./check-2vYc6QaP.js";import{t as D}from"./chevron-down-CxtxIjiP.js";import{t as O}from"./chevron-left-BAtyp3_6.js";import{a as k,i as A,n as j,o as M,r as ee,s as N,t as P}from"./select-JC5m2BRQ.js";import{t as te}from"./circle-alert-DCChabnT.js";import{t as F}from"./circle-check-iEdCm3Pw.js";import{t as ne}from"./code-xml-BrUXrBax.js";import{t as re}from"./copy-DHmIFc52.js";import{t as ie}from"./download-BCfIiuaL.js";import{t as I}from"./ellipsis-CfGKfbq6.js";import{t as ae}from"./external-link-CEQqPcqc.js";import{n as oe,t as L}from"./wand-sparkles-CvEBNUFz.js";import{t as se}from"./image-BY_c3FYU.js";import{i as ce,o as le}from"./settings-navigation-DV3N_utl.js";import{t as ue}from"./loader-circle-BOwQzHB-.js";import{t as de}from"./message-square-SKjZyY3v.js";import{t as fe}from"./monitor-smartphone-B1gIjItA.js";import{n as pe,r as me,t as he}from"./zap-DZHw5afO.js";import{t as ge}from"./plus-fQbSqB1n.js";import{t as _e}from"./refresh-cw-TbWxTY4K.js";import{t as ve}from"./rocket-BgLSjoHY.js";import{t as ye}from"./rotate-ccw-C0v8V77_.js";import{t as be}from"./search-D0mqDaf_.js";import{t as xe}from"./server-BgNvmqwJ.js";import{t as Se}from"./shield-check-Gvek4RJ7.js";import{t as Ce}from"./sparkles-S_eeuqn9.js";import{t as we}from"./square-terminal-BVG6cUT1.js";import{t as Te}from"./trash-2-CNrPOoPR.js";import{t as Ee}from"./triangle-alert-CE1q54ci.js";import{t as De}from"./wrench-6pg6_bqI.js";import{t as Oe}from"./x-07u4-129.js";import{t as ke}from"./brand-DIEc3fK8.js";import{i as Ae}from"./dist-Cfh4kzCK.js";import{c as je,i as Me,o as Ne,s as Pe}from"./dist-B_a0oV4U.js";import{a as Fe,i as Ie,n as Le,r as Re,t as ze}from"./dist-DAs5KRGl.js";import{n as Be,r as Ve,t as He}from"./collapsible-C__hRcbA.js";import{t as Ue}from"./dist-TksYpDID.js";import{c as We,i as Ge,n as Ke,p as qe,r as Je,t as Ye}from"./dropdown-menu-gZkWDhaR.js";import{i as Xe,n as Ze,t as Qe}from"./popover-DT3PkPcL.js";import{t as $e}from"./separator-cVAjxx3U.js";import{t as et}from"./switch-DRkmP9uM.js";import{t as R}from"./utils-C8uzG5AZ.js";import{n as z,t as B}from"./button-Bu_vuij9.js";import{n as tt,t as nt}from"./kbd-CAufZTkl.js";import{i as rt,t as it}from"./config-search-ClE5BFDz.js";import{_ as at,c as ot,d as st,f as ct,h as lt,l as ut,m as dt,o as ft,p as pt,t as mt,u as ht}from"./shortcuts-BOeaPAvF.js";import{a as gt}from"./format-DMJQzoZ7.js";import{n as _t,r as vt,t as yt}from"./PageState-aWHrkE1D.js";import{a as bt,i as xt,l as St,o as Ct,s as wt,t as Tt}from"./dialog-Kx6RCn3A.js";import{t as V}from"./input-DIwJDpj9.js";import{t as Et}from"./useOverlayFocusReturn-NkxBSSjb.js";import{i as H,n as U,o as W,r as Dt,s as Ot,t as kt}from"./FeaturePage-1MUXz3Y-.js";import{t as G}from"./field-Bnm9KAi2.js";import{t as At}from"./MarkdownMessage-BPZcFjyR.js";import{t as jt}from"./StatusGlyph-1KgitlUg.js";import{t as Mt}from"./badge-Dk1N1mVf.js";import{a as Nt,i as Pt,l as Ft,n as It,o as Lt,r as Rt,s as zt,t as Bt}from"./app-primitives-Cmdj4cIW.js";import{t as K}from"./AppSelect-fH3gqflO.js";import{t as Vt}from"./usePagePrimaryAction-CWPC0C_f.js";import{t as Ht}from"./BrandLogo-C6O8cv-b.js";import{a as Ut,c as Wt,d as Gt,f as Kt,g as qt,i as Jt,m as Yt,o as Xt,p as Zt,r as Qt,v as $t}from"./app-update-BEymQxyl.js";import{a as en,n as tn,r as nn,t as rn}from"./ShortcutKeys-zuzmq8eW.js";import{i as an,n as on,r as sn,t as cn}from"./browser-notifications-DBS0oXqN.js";var ln=g(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),un=g(`blend`,[[`circle`,{cx:`9`,cy:`9`,r:`7`,key:`p2h5vp`}],[`circle`,{cx:`15`,cy:`15`,r:`7`,key:`19ennj`}]]),dn=g(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),fn=g(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),pn=g(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),mn=g(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),hn=g(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),gn=g(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),_n=g(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),vn=g(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),yn=g(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),bn=g(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),xn=g(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Sn=g(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Cn=g(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),wn=g(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Tn=g(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),En=g(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),q=e(i(),1),J=a(),Dn=Object.defineProperty,Y=(e,t)=>Dn(e,`name`,{value:t,configurable:!0}),On=`Radio`,[kn,An]=Pe(On),[jn,Mn]=kn(On);function Nn(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=q.useState(null),[p,m]=q.useState(null),h=q.useRef(!1),[g,_]=q.useReducer(e=>e+1,0),v={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,hasConsumerStoppedPropagationRef:h,userInteractionCount:g,onUserInteraction:_,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:Y(()=>s?.(),`onCheck`)};return(0,J.jsx)(jn,{scope:t,...v,children:Rn(u)?u(v):r})}Y(Nn,`RadioProvider`);var Pn=`RadioTrigger`,Fn=q.forwardRef(Y(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,onUserInteraction:u,isFormControl:d,bubbleInput:f}=Mn(Pn,e),p=Ae(r,s);return(0,J.jsx)(je.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":zn(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:p,onClick:Ne(t,e=>{i||(u(),c()),f&&d&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})},`RadioTrigger`)),In=`RadioBubbleInput`,Ln=q.forwardRef(Y(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:p,userInteractionCount:m}=Mn(In,e),h=Ae(r,f),g=Ue(i),_=q.useRef(!1),v=q.useRef(a),y=q.useRef(m);q.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=m!==y.current;y.current=m;let i=v.current!==a;v.current=a;let o=!(r&&p.current);if(i&&n){_.current=!r;let t=new Event(`click`,{bubbles:o});n.call(e,a),e.dispatchEvent(t),_.current=!1}},[d,a,p,m]);let b=q.useRef(a);return(0,J.jsx)(je.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:h,onClick:Ne(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function Rn(e){return typeof e==`function`}Y(Rn,`isFunction`);function zn(e){return e?`checked`:`unchecked`}Y(zn,`getState`);var Bn=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Vn=`RadioGroup`,[Hn,Un]=Pe(Vn,[Re,An]),Wn=Re(),Gn=An(),[Kn,qn]=Hn(Vn),Jn=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=Wn(n),h=Ie(u),[g,_]=Me({prop:o,defaultProp:a??null,onChange:f,caller:Vn}),[v,y]=q.useState(null),b=Ae(t,y),x=q.useRef(g);return q.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=Y(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,J.jsx)(Kn,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,J.jsx)(Le,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,J.jsx)(je.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),Yn=`RadioGroupItemProvider`,Xn=`RadioGroupItemTrigger`;function Zn(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=qn(Yn,t),s=Gn(t),c=o.disabled||r;return(0,J.jsx)(Nn,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}Y(Zn,`RadioGroupItemProvider`);var Qn=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Wn(n),a=Gn(n),{checked:o,disabled:s}=Mn(Xn,a.__scopeRadio),c=q.useRef(null),l=Ae(t,c),u=q.useRef(!1);return q.useEffect(()=>{let e=Y(e=>{Bn.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=Y(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,J.jsx)(ze,{asChild:!0,...i,focusable:!s,active:o,children:(0,J.jsx)(Fn,{...a,...r,ref:l,onKeyDown:Ne(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:Ne(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),$n=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,J.jsx)(Zn,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Qn,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,J.jsx)(er,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),er=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Gn(n);return(0,J.jsx)(Ln,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`)),tr=Object.defineProperty,X=(e,t)=>tr(e,`name`,{value:t,configurable:!0}),nr=[`PageUp`,`PageDown`],rr=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],ir={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},ar=`Slider`,[or,sr,cr]=Fe(ar),[lr,ur]=Pe(ar,[cr]),[dr,fr]=lr(ar),pr=q.forwardRef(X(function(e,t){let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[r],value:u,onValueChange:d=X(()=>{},`onValueChange`),onValueCommit:f=X(()=>{},`onValueCommit`),inverted:p=!1,form:m,...h}=e,g=q.useRef(new Set),_=q.useRef(0),v=q.useRef(!1),y=o===`horizontal`?gr:_r,[b,x]=q.useState(null),S=Ae(t,x),[C=[],w]=Me({prop:u,defaultProp:l,onChange:X(e=>{[...g.current][_.current]?.focus({preventScroll:!0,focusVisible:v.current}),v.current=!1,d(e)},`onChange`)}),T=q.useRef(C),E=q.useRef(C);q.useEffect(()=>{let e=m?b?.ownerDocument.getElementById(m):b?.closest(`form`);if(e instanceof HTMLFormElement){let t=X(()=>w(E.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[b,m,w]);function D(e){A(e,Fr(C,e))}X(D,`handleSlideStart`);function O(e){A(e,_.current)}X(O,`handleSlideMove`);function k(){String(C)!==String(T.current)&&f(C)}X(k,`handleSlideEnd`);function A(e,t,{commit:n}={commit:!1}){let o=Br(a),s=Vr(Math.round((e-r)/a)*a+r,o),l=M(s,[r,i]);w((e=[])=>{let r=Mr(e,l,t);if(Rr(r,c*a)){_.current=r.indexOf(l);let t=String(r)!==String(e);return t&&n&&f(r),t?r:e}return e})}return X(A,`updateValues`),(0,J.jsx)(dr,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:_,thumbs:g.current,values:C,orientation:o,form:m,children:(0,J.jsx)(or.Provider,{scope:e.__scopeSlider,children:(0,J.jsx)(or.Slot,{scope:e.__scopeSlider,children:(0,J.jsx)(y,{"aria-disabled":s,"data-disabled":s?``:void 0,...h,ref:S,onPointerDown:Ne(h.onPointerDown,()=>{s||(T.current=C,v.current=!1)}),min:r,max:i,inverted:p,onSlideStart:s?void 0:D,onSlideMove:s?void 0:O,onSlideEnd:s?void 0:k,onHomeKeyDown:()=>{s||(v.current=!0,A(r,0,{commit:!0}))},onEndKeyDown:()=>{s||(v.current=!0,A(i,C.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!s){v.current=!0;let n=nr.includes(e.key)||e.shiftKey&&rr.includes(e.key)?10:1,i=_.current,o=C[i];A(Hr(o,{min:r,step:a,direction:t,multiplier:n}),i,{commit:!0})}}})})})})},`Slider`)),[mr,hr]=lr(ar,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),gr=q.forwardRef(X(function(e,t){let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,[d,f]=q.useState(null),p=Ae(t,f),m=q.useRef(void 0),h=Ie(i),g=h===`ltr`,_=g&&!a||!g&&a;function v(e){let t=m.current||d.getBoundingClientRect(),i=zr([0,t.width],_?[n,r]:[r,n]);return m.current=t,i(e-t.left)}return X(v,`getValueFromPointer`),(0,J.jsx)(mr,{scope:e.__scopeSlider,startEdge:_?`left`:`right`,endEdge:_?`right`:`left`,direction:_?1:-1,size:`width`,children:(0,J.jsx)(vr,{dir:h,"data-orientation":`horizontal`,...u,ref:p,style:{...u.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=v(e.clientX);o?.(t)},onSlideMove:e=>{let t=v(e.clientX);s?.(t)},onSlideEnd:()=>{m.current=void 0,c?.()},onStepKeyDown:e=>{let t=ir[_?`from-left`:`from-right`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})},`SliderHorizontal`)),_r=q.forwardRef(X(function(e,t){let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:c,...l}=e,u=q.useRef(null),d=Ae(t,u),f=q.useRef(void 0),p=!i;function m(e){let t=f.current||u.current.getBoundingClientRect(),i=zr([0,t.height],p?[r,n]:[n,r]);return f.current=t,i(e-t.top)}return X(m,`getValueFromPointer`),(0,J.jsx)(mr,{scope:e.__scopeSlider,startEdge:p?`bottom`:`top`,endEdge:p?`top`:`bottom`,size:`height`,direction:p?1:-1,children:(0,J.jsx)(vr,{"data-orientation":`vertical`,...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=m(e.clientY);a?.(t)},onSlideMove:e=>{let t=m(e.clientY);o?.(t)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:e=>{let t=ir[p?`from-bottom`:`from-top`].includes(e.key);c?.({event:e,direction:t?-1:1})}})})},`SliderVertical`)),vr=q.forwardRef(X(function(e,t){let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=fr(ar,n);return(0,J.jsx)(je.span,{...l,ref:t,onKeyDown:Ne(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):nr.concat(rr).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:Ne(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:Ne(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:Ne(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})},`SliderImpl`)),yr=`SliderTrack`,br=q.forwardRef(X(function(e,t){let{__scopeSlider:n,...r}=e,i=fr(yr,n);return(0,J.jsx)(je.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})},`SliderTrack`)),xr=`SliderRange`,Sr=q.forwardRef(X(function(e,t){let{__scopeSlider:n,...r}=e,i=fr(xr,n),a=hr(xr,n),o=q.useRef(null),s=Ae(t,o),c=i.values.length,l=i.values.map(e=>Nr(e,i.min,i.max)),u=c>1?Math.min(...l):0,d=100-Math.max(...l);return(0,J.jsx)(je.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:s,style:{...e.style,[a.startEdge]:u+`%`,[a.endEdge]:d+`%`}})},`SliderRange`)),[Cr,wr]=lr(`SliderThumb`),Tr=`SliderThumbProvider`;function Er(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=fr(Tr,t),o=sr(t),[s,c]=q.useState(null),l=q.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=Ue(s),d=!s||!!a.form||!!s.closest(`form`),f=a.values[l],p=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),m=f===void 0?0:Nr(f,a.min,a.max);q.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let h={value:f,name:p,form:a.form,isFormControl:d,index:l,thumb:s,onThumbChange:c,percent:m,size:u};return(0,J.jsx)(Cr,{scope:t,...h,children:Ur(i)?i(h):r})}X(Er,`SliderThumbProvider`);var Dr=`SliderThumbTrigger`,Or=q.forwardRef(X(function(e,t){let{__scopeSlider:n,...r}=e,i=fr(Dr,n),a=hr(Dr,n),{index:o,value:s,percent:c,size:l,onThumbChange:u}=wr(Dr,n),d=Ae(t,u),f=Pr(o,i.values.length),p=l?.[a.size],m=p?Ir(p,c,a.direction):0;return(0,J.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[a.startEdge]:`calc(${c}% + ${m}px)`},children:(0,J.jsx)(or.ItemSlot,{scope:n,children:(0,J.jsx)(je.span,{role:`slider`,"aria-label":e[`aria-label`]||f,"aria-valuemin":i.min,"aria-valuenow":s,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,tabIndex:i.disabled?void 0:0,...r,ref:d,style:s===void 0?{display:`none`}:e.style,onFocus:Ne(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})})})},`SliderThumbTrigger`)),kr=q.forwardRef(X(function(e,t){let{__scopeSlider:n,name:r,...i}=e;return(0,J.jsx)(Er,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Or,{...i,ref:t,__scopeSlider:n}),r?(0,J.jsx)(jr,{__scopeSlider:n},e):null]})})},`SliderThumb`)),Ar=`SliderBubbleInput`,jr=q.forwardRef(X(function({__scopeSlider:e,...t},n){let{value:r,name:i,form:a}=wr(Ar,e),o=q.useRef(null),s=Ae(o,n),c=N(r);return q.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(c!==r&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),(0,J.jsx)(je.input,{style:{display:`none`},name:i,form:a,...t,ref:s,defaultValue:r})},`SliderBubbleInput`));function Mr(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}X(Mr,`getNextSortedValues`);function Nr(e,t,n){let r=100/(n-t)*(e-t);return M(r,[0,100])}X(Nr,`convertValueToPercentage`);function Pr(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}X(Pr,`getLabel`);function Fr(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}X(Fr,`getClosestValueIndex`);function Ir(e,t,n){let r=e/2;return(r-zr([0,50],[0,r])(t)*n)*n}X(Ir,`getThumbInBoundsOffset`);function Lr(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}X(Lr,`getStepsBetweenValues`);function Rr(e,t){if(t>0){let n=Lr(e);return Math.min(...n)>=t}return!0}X(Rr,`hasMinStepsBetweenValues`);function zr(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}X(zr,`linearScale`);function Br(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}X(Br,`getDecimalCount`);function Vr(e,t){let n=10**t;return Math.round(e*n)/n}X(Vr,`roundValue`);function Hr(e,{min:t,step:n,direction:r,multiplier:i}){let a=Br(n),o=(e-t)/n,s=Math.round(o),c=Vr(s*n+t,a)===Vr(e,a),l;return l=c?s+i*r:r>0?Math.ceil(o):Math.floor(o),Vr(l*n+t,a)}X(Hr,`getNextStepValue`);function Ur(e){return typeof e==`function`}X(Ur,`isFunction`);function Wr(e,t){if(typeof window>`u`||!window.__PISPER_MOBILE_APP__)return null;e.preventDefault();let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(`mobile_open_external_url`,{url:t}):Promise.reject(Error(`移动端原生桥不可用。`))}function Gr({className:e,...t}){return(0,J.jsx)(Bt,{"data-settings-card":!0,className:R(`rounded-none border-x-0 border-t border-b-0 border-stroke-soft bg-transparent px-0`,e),...t})}var Kr=Lt,qr=Ft;function Jr(e){return(0,J.jsx)(zt,{density:`compact`,...e})}function Yr({className:e,...t}){return(0,J.jsx)(`div`,{"data-settings-group":!0,className:R(`@container/card min-w-0 divide-y divide-stroke-soft border-y border-stroke-soft`,e),...t})}function Xr({label:e,help:t,htmlFor:n,labelId:r,helpId:i,children:a,className:o}){return(0,J.jsxs)(`div`,{className:R(`grid min-w-0 gap-1.5 py-2.5 @min-[480px]/card:grid-cols-[168px_minmax(0,1fr)] @min-[480px]/card:items-center @min-[480px]/card:gap-4`,o),children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`label`,{id:r,htmlFor:n,className:`text-sm font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{id:i,className:`mt-0.5 text-xs text-content-muted`,children:t})]}),(0,J.jsx)(`div`,{className:`min-w-0 @min-[480px]/card:max-w-[460px]`,children:a})]})}var Zr=`0.6.5`,Qr=`https://github.com/ling-kong-ran/pisper`,$r=`${Qr}/blob/release/LICENSE`;function ei({href:e,icon:t,label:n,value:r,onClick:i}){return(0,J.jsxs)(`a`,{className:`group grid min-h-14 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 py-2.5 text-left no-underline`,href:e,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,J.jsx)(`span`,{className:`grid size-7.5 place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key transition-colors group-hover:text-content`,children:(0,J.jsx)(t,{size:16,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-content`,children:n}),(0,J.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-xs text-content-muted`,children:r})]}),(0,J.jsx)(ae,{"aria-hidden":`true`,className:`text-content-muted transition-colors group-hover:text-content`,size:14})]})}function ti({update:e,notify:t}){let{t:n}=l(),r=e.info?.version||Zr,i=e=>{Wr(e,e.currentTarget.href)?.catch(()=>t(n(`config:aboutSettings.openLinkFailed`),`error`))};return(0,J.jsxs)(`div`,{className:`mx-auto flex w-full flex-col gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 rounded-[15px] shadow-raise`,children:(0,J.jsx)(Ht,{size:56})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-[length:calc(var(--ui-font-size)*10/7)] leading-[1.3] font-semibold tracking-[-.015em] text-content`,children:`Pisper`}),(0,J.jsxs)(qr,{tone:`gray`,className:`font-mono`,children:[`v`,r]})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-content-muted`,children:n(`config:aboutSettings.description`)})]})]}),(0,J.jsxs)(`section`,{"data-config-card":`about-project`,children:[(0,J.jsx)(Kr,{title:n(`config:aboutSettings.projectInformation`),className:`mb-3 text-[15px] leading-6 font-medium text-content`}),(0,J.jsxs)(Yr,{children:[(0,J.jsx)(ei,{href:Qr,icon:ne,label:n(`config:aboutSettings.sourceCode`),value:`github.com/ling-kong-ran/pisper`,onClick:i}),(0,J.jsx)(ei,{href:$r,icon:yn,label:n(`config:aboutSettings.license`),value:`MIT License`,onClick:i})]})]}),(0,J.jsx)(Gr,{className:`py-4`,"data-config-card":`about-support`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 max-[540px]:flex-col max-[540px]:items-stretch`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(Kr,{title:n(`config:aboutSettings.supportPisper`)}),(0,J.jsx)(`p`,{className:`mt-0.5 max-w-[520px] text-xs leading-5 text-content-muted`,children:n(`config:aboutSettings.supportDescription`)})]}),(0,J.jsx)(B,{asChild:!0,className:`max-[650px]:h-11 max-[540px]:w-full`,children:(0,J.jsxs)(`a`,{href:Qr,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,J.jsx)(Cn,{size:15}),n(`config:aboutSettings.starOnGitHub`)]})})]})}),(0,J.jsx)(`p`,{className:`text-center text-xs text-content-muted`,children:n(`config:aboutSettings.copyright`)})]})}function ni({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=q.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,J.jsxs)(pr,{"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,className:R(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,e),...a,children:[(0,J.jsx)(br,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-surface-active data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1`,children:(0,J.jsx)(Sr,{"data-slot":`slider-range`,className:`absolute bg-star select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,J.jsx)(kr,{"data-slot":`slider-thumb`,className:`relative block size-3.5 shrink-0 rounded-full border border-control bg-key shadow-key ring-focus-ring transition-shadow select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:border-focus focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50`},t))]})}function ri(e){window.dispatchEvent(new CustomEvent(`pisper:desktop-pet-changed`,{detail:e}))}function ii({notify:e,requestConfirm:t}){let{t:n}=l(),r=window.pisperDesktop,i=(0,q.useMemo)(()=>r?.getPetStatus?{getStatus:()=>r.getPetStatus(),setEnabled:e=>r.setPetEnabled(e),setOpacity:e=>r.setPetOpacity(e),search:e=>r.searchPets(e),install:e=>r.installPet(e),select:e=>r.selectPet(e),remove:e=>r.removePet(e),openCatalog:()=>void r.openPetdex?.()}:{getStatus:()=>f(`/api/desktop-pet`),setEnabled:e=>f(`/api/desktop-pet/enabled`,{method:`POST`,body:{enabled:e}}),setOpacity:e=>f(`/api/desktop-pet/opacity`,{method:`POST`,body:{opacity:e}}),search:e=>f(`/api/desktop-pet/catalog?query=${encodeURIComponent(e)}`),install:e=>f(`/api/desktop-pet/install`,{method:`POST`,body:{slug:e}}),select:e=>f(`/api/desktop-pet/select`,{method:`POST`,body:{slug:e}}),remove:e=>f(`/api/desktop-pet/${encodeURIComponent(e)}`,{method:`DELETE`}),openCatalog:()=>window.open(`https://petdex.dev`,`_blank`,`noopener,noreferrer`)},[r]),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)([]),[p,m]=(0,q.useState)(100),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(``),y=(0,q.useCallback)(e=>{o(e),m(Math.round((e.opacity??1)*100))},[]),b=(0,q.useCallback)(async()=>{try{v(``),y(await i.getStatus())}catch(e){v(e instanceof Error?e.message:String(e))}},[y,i]),x=(0,q.useCallback)(async()=>{g(`search`);try{v(``),d(await i.search(s))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}},[i,s]);(0,q.useEffect)(()=>{b(),i.search(``).then(d).catch(()=>{})},[i,b]);let S=async t=>{let r=a;o(e=>e&&{...e,enabled:t,running:!!(t&&e.installed.length)}),g(`toggle`);try{v(``);let r=await i.setEnabled(t);y(r),ri(r),e(n(t?`config:desktopPetSettings.petEnabled`:`config:desktopPetSettings.petDisabled`))}catch(e){o(r),v(e instanceof Error?e.message:String(e))}finally{g(``)}},C=async e=>{g(`opacity`);try{v(``);let t=await i.setOpacity(e);y(t),ri(t)}catch(e){m(Math.round((a?.opacity??1)*100)),v(e instanceof Error?e.message:String(e))}finally{g(``)}},w=async(t=s)=>{if(t.trim()){g(`install`);try{v(``);let r=await i.install(t);y(r),ri(r),e(n(`config:desktopPetSettings.petInstalled`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},T=async t=>{if(t!==a?.selectedSlug){g(`select:${t}`);try{v(``);let r=await i.select(t);y(r),ri(r),e(n(`config:desktopPetSettings.petSelected`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},D=async r=>{if(await t({title:n(`config:desktopPetSettings.deleteTitle`),message:n(`config:desktopPetSettings.deleteConfirm`,{name:r.name}),confirmLabel:n(`config:desktopPetSettings.delete`),tone:`danger`})){g(`remove:${r.slug}`);try{v(``);let t=await i.remove(r.slug);y(t),ri(t),e(n(`config:desktopPetSettings.petRemoved`,{name:r.name}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}};return(0,J.jsxs)(J.Fragment,{children:[_&&(0,J.jsx)(kt,{children:_}),(0,J.jsx)(W,{title:n(`config:desktopPetSettings.displayTitle`),"data-config-card":`desktop-pet-settings`,children:a?(0,J.jsxs)(U,{children:[(0,J.jsx)(H,{icon:(0,J.jsx)(dn,{}),name:n(`config:desktopPetSettings.showOnDesktop`),description:a.selectedName?n(`config:desktopPetSettings.currentPet`,{name:a.selectedName}):n(`config:desktopPetSettings.installBeforeEnabling`),status:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[a.running&&(0,J.jsx)(jt,{status:`done`,className:`size-3.5`}),a.running?n(`config:desktopPetSettings.running`):n(`config:desktopPetSettings.stopped`)]}),actions:(0,J.jsx)(et,{checked:a.enabled,disabled:!!h||!a.installed.length,onCheckedChange:e=>void S(e),"aria-label":n(`config:desktopPetSettings.showOnDesktop`)})}),(0,J.jsx)(H,{icon:(0,J.jsx)(un,{}),name:n(`config:desktopPetSettings.opacity`),nameMeta:`${p}%`,actions:(0,J.jsx)(ni,{value:[p],min:20,max:100,step:5,disabled:h===`opacity`,onValueChange:([e])=>m(e),onValueCommit:([e])=>void C(e/100),"aria-label":n(`config:desktopPetSettings.opacity`),className:`w-44 max-w-full max-[650px]:w-32`})})]}):(0,J.jsx)(_t,{kind:`loading`,title:n(`config:desktopPetSettings.loading`)})}),(0,J.jsxs)(W,{title:n(`config:desktopPetSettings.installTitle`),"data-config-card":`desktop-pet-install`,description:n(`config:desktopPetSettings.installDescription`),actions:(0,J.jsxs)(B,{variant:`ghost`,size:`sm`,onClick:i.openCatalog,children:[(0,J.jsx)(ae,{}),n(`config:desktopPetSettings.browsePetdex`)]}),children:[(0,J.jsxs)(`div`,{className:`mb-3 flex gap-2`,children:[(0,J.jsx)(V,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x()},placeholder:n(`config:desktopPetSettings.searchPlaceholder`),"aria-label":n(`config:desktopPetSettings.petSlug`),className:`h-9 min-w-0 flex-1 font-mono pointer-coarse:min-h-11 max-[650px]:min-h-11`}),(0,J.jsxs)(B,{variant:`secondary`,className:`h-9 shrink-0 pointer-coarse:h-11 max-[650px]:h-11`,disabled:h===`search`,onClick:x,children:[h===`search`?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(be,{}),n(`config:desktopPetSettings.search`)]})]}),u.length>0&&(0,J.jsx)(U,{children:u.map(e=>{let t=a?.installed.some(t=>t.slug===e.slug);return(0,J.jsx)(H,{"data-pet-catalog":e.slug,icon:(0,J.jsx)(dn,{}),name:e.displayName,nameMeta:e.slug,status:t?n(`config:desktopPetSettings.installed`):void 0,actions:(0,J.jsxs)(B,{size:`sm`,variant:t?`ghost`:`secondary`,disabled:!!h||t&&e.slug===a?.selectedSlug,"aria-label":`${n(t?`config:desktopPetSettings.use`:`config:desktopPetSettings.install`)}: ${e.displayName}`,onClick:()=>void(t?T(e.slug):w(e.slug)),children:[t?(0,J.jsx)(E,{}):(0,J.jsx)(ie,{}),n(t?`config:desktopPetSettings.use`:`config:desktopPetSettings.install`)]})},e.slug)})})]}),a&&a.installed.length>0&&(0,J.jsx)(W,{title:n(`config:desktopPetSettings.installedTitle`),count:a.installed.length,"data-config-card":`desktop-pet-installed`,description:n(`config:desktopPetSettings.installedDescription`),children:(0,J.jsx)(U,{children:a.installed.map(e=>{let t=e.slug===a.selectedSlug;return(0,J.jsx)(H,{"data-pet-installed":e.slug,"data-selected":t||void 0,className:R(`relative`,t&&`after:absolute after:inset-y-3 after:-left-3 after:w-[3px] after:rounded-full after:bg-star`),icon:(0,J.jsx)(dn,{}),name:e.name,nameMeta:`${e.slug} · ${e.source===`pisper`?`Pisper`:`Petdex`}`,status:t?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(jt,{status:`done`,className:`size-3.5`}),n(`config:desktopPetSettings.inUse`)]}):void 0,actions:(0,J.jsxs)(J.Fragment,{children:[!t&&(0,J.jsx)(B,{size:`sm`,variant:`ghost`,disabled:!!h,"aria-label":`${n(`config:desktopPetSettings.use`)}: ${e.name}`,onClick:()=>void T(e.slug),children:n(`config:desktopPetSettings.use`)}),e.source===`pisper`&&(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,disabled:!!h,onClick:()=>void D(e),"aria-label":`${n(`config:desktopPetSettings.delete`)}: ${e.name}`,title:n(`config:desktopPetSettings.delete`),children:h===`remove:${e.slug}`?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(Te,{})})]})},`${e.source}:${e.slug}`)})})})]})}function Z(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function ai(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var oi,Q,si,ci,li=`__TAURI_TO_IPC_KEY__`;function ui(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}var di=class{constructor(e){oi.set(this,void 0),Q.set(this,0),si.set(this,[]),ci.set(this,void 0),ai(this,oi,e||(()=>{}),`f`),this.id=ui(e=>{let t=e.index;if(`end`in e){t==Z(this,Q,`f`)?this.cleanupCallback():ai(this,ci,t,`f`);return}let n=e.message;if(t==Z(this,Q,`f`)){for(Z(this,oi,`f`).call(this,n),ai(this,Q,Z(this,Q,`f`)+1,`f`);Z(this,Q,`f`)in Z(this,si,`f`);){let e=Z(this,si,`f`)[Z(this,Q,`f`)];Z(this,oi,`f`).call(this,e),delete Z(this,si,`f`)[Z(this,Q,`f`)],ai(this,Q,Z(this,Q,`f`)+1,`f`)}Z(this,Q,`f`)===Z(this,ci,`f`)&&this.cleanupCallback()}else Z(this,si,`f`)[t]=n})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){ai(this,oi,e,`f`)}get onmessage(){return Z(this,oi,`f`)}[(oi=new WeakMap,Q=new WeakMap,si=new WeakMap,ci=new WeakMap,li)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[li]()}};function fi(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function pi(e,t){return fi(`plugin:barcode-scanner|${e}`,t)}function mi(e){return e instanceof Error?e.message:String(e)}function hi(e){return/cancel(?:led|ed)/i.test(mi(e))}function gi(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}function _i(e){return Array.isArray(e)?new TextDecoder().decode(Uint8Array.from(e)):``}function vi(e){if(!e.isActive||!e.port)return null;let t=_i(e.txt.fp);if(!/^SHA256:[0-9A-F]{64}$/i.test(t))return null;let n=e.addresses.find(e=>/^\d{1,3}(?:\.\d{1,3}){3}$/.test(e))||e.addresses.find(e=>e.includes(`:`));if(!n)return null;let r=n.includes(`:`)?`[${n}]`:n,i=_i(e.txt.name)||e.name||`Pisper Desktop`,a=`https://${r}:${e.port}`;return{id:`${e.fullName}:${a}`,name:i,url:a,fingerprint:t}}function yi(e){return new Promise(t=>window.setTimeout(t,e))}function bi({open:e,onOpenChange:t}){let{t:n}=l(),r=Et(e),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(!1),[c,u]=(0,q.useState)([]),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(``),y=(0,q.useRef)(!1),x=(0,q.useRef)(!1),S=(0,q.useRef)(!1),C=(0,q.useRef)(0),w=(0,q.useRef)(``),T=(0,q.useCallback)(e=>{y.current=e,s(e)},[]),E=(0,q.useCallback)(async()=>{x.current=!0,y.current&&await pi(`cancel`).catch(()=>void 0),T(!1),a(null)},[T]);(0,q.useEffect)(()=>{if(!o)return;let e=document.getElementById(`root`),t=[],n=(e,n,r)=>{e&&(t.push({element:e,property:n,value:e.style.getPropertyValue(n),priority:e.style.getPropertyPriority(n)}),e.style.setProperty(n,r,`important`))};return n(document.documentElement,`background`,`transparent`),n(document.body,`background`,`transparent`),n(e,`background`,`transparent`),n(e,`visibility`,`hidden`),()=>{for(let{element:e,property:n,value:r,priority:i}of t.reverse())r?e.style.setProperty(n,r,i):e.style.removeProperty(n)}},[o]),(0,q.useEffect)(()=>{if(!o)return;let e=`pisper-scanner-${Date.now()}`;window.history.pushState({...window.history.state,pisperScanner:e},``);let t=()=>void E();return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),!S.current&&window.history.state?.pisperScanner===e&&window.history.back()}},[E,o]);let D=e=>{if(!e.proxyUrl)throw Error(n(`config:mobileServer.pairFailed`));window.location.replace(e.proxyUrl)},O=(0,q.useCallback)(async()=>{let e=++C.current;f(!0),m(``),u([]);let t=new di;t.onmessage=t=>{if(C.current!==e)return;if(t.reason===`permission-denied`){m(n(`config:mobileServer.localNetworkDenied`));return}if(t.reason?.startsWith(`error:`)){m(n(`config:mobileServer.discoveryFailed`));return}if(!t.service)return;if(!t.service.isActive){u(e=>e.filter(e=>!e.id.startsWith(`${t.service?.fullName}:`)));return}let r=vi(t.service);r&&u(e=>[...e.filter(e=>e.fingerprint!==r.fingerprint),r])};let r=null;try{await fi(`mobile_ensure_local_network_permission`),r=(await fi(`plugin:dns-sd|browse_start`,{options:{service:{type:`pisper`,protocol:`tcp`,domain:`local`},timeoutMs:4e3},channel:t})).browseId,await yi(4300)}catch(t){C.current===e&&m(mi(t).includes(`local_network_permission_denied`)?n(`config:mobileServer.localNetworkDenied`):n(`config:mobileServer.discoveryFailed`))}finally{r!==null&&await fi(`plugin:dns-sd|browse_stop`,{browseId:r}).catch(()=>void 0),C.current===e&&f(!1)}},[n]);(0,q.useEffect)(()=>{if(!(!e||o))return O(),()=>{C.current+=1}},[O,e,o]);let k=(0,q.useCallback)(async()=>{let e=w.current;w.current=``,e&&await fi(`mobile_cancel_lan_pairing`,{operationId:e}).catch(()=>void 0),a(null),g(``)},[]),A=async e=>{let t=globalThis.crypto?.randomUUID?.()||`lan-${Date.now()}-${Math.random().toString(16).slice(2)}`;w.current=t,a(`lan:${e.id}`),v(``),g(n(`config:mobileServer.awaitingApproval`,{name:e.name}));try{let n=await fi(`mobile_pair_lan`,{operationId:t,name:e.name,url:e.url,fingerprint:e.fingerprint,deviceName:null});if(w.current!==t)return;D(n)}catch(e){w.current===t&&v(mi(e))}finally{w.current===t&&(w.current=``,a(null),g(``))}},j=async()=>{x.current=!1,S.current=!1,a(`scan`),v(``);try{let e=await pi(`check_permissions`);if(e.camera!==`granted`&&(e=await pi(`request_permissions`)),e.camera!==`granted`)throw Error(n(`config:mobileServer.cameraDenied`));if(x.current||(T(!0),await gi(),x.current))return;let t=await pi(`scan`,{windowed:!0,formats:[]});if(!t.content)throw Error(n(`config:mobileServer.scanFailed`));S.current=!0,D(await fi(`mobile_pair`,{payloadJson:t.content,deviceName:null}))}catch(e){!x.current&&!hi(e)&&v(mi(e))}finally{T(!1),a(null),x.current=!1}};return(0,J.jsx)(Tt,{open:e,onOpenChange:e=>{if(!e&&o){E();return}if(!e&&i?.startsWith(`lan:`)){k(),t(!1);return}i||(e||v(``),t(e))},children:(0,J.jsx)(xt,{showCloseButton:!o,overlayClassName:o?`bg-transparent supports-backdrop-filter:backdrop-blur-none`:void 0,className:o?`inset-0 top-0 left-0 h-dvh max-h-none w-screen max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-none bg-transparent p-0 text-white ring-0 sm:max-w-none`:`sm:max-w-md`,onPointerDownOutside:o?e=>e.preventDefault():void 0,onCloseAutoFocus:r,children:o?(0,J.jsxs)(`div`,{className:`flex h-dvh w-screen flex-col overflow-hidden`,children:[(0,J.jsxs)(wt,{className:`sr-only`,children:[(0,J.jsx)(St,{children:n(`config:mobileServer.scanTitle`)}),(0,J.jsx)(bt,{children:n(`config:mobileServer.scanHint`)})]}),(0,J.jsxs)(`header`,{className:`flex min-h-16 items-center justify-between gap-3 bg-black/60 px-4 pb-3`,style:{paddingTop:`max(env(safe-area-inset-top), 0.75rem)`},children:[(0,J.jsxs)(B,{variant:`ghost`,className:`h-10 bg-black/40 px-3 text-white hover:bg-black/70 hover:text-white`,onClick:()=>void E(),children:[(0,J.jsx)(b,{}),n(`config:mobileServer.cancelScan`)]}),(0,J.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium`,children:n(`config:mobileServer.scanTitle`)}),(0,J.jsx)(`div`,{className:`w-[88px]`,"aria-hidden":`true`})]}),(0,J.jsx)(`main`,{className:`grid min-h-0 flex-1 place-items-center p-6`,children:(0,J.jsx)(`div`,{className:`relative aspect-square w-[min(72vw,20rem)] rounded-md border-2 border-white/90 shadow-[0_0_0_9999px_rgba(0,0,0,0.18)]`,children:(0,J.jsx)(bn,{className:`absolute top-1/2 left-1/2 size-10 -translate-x-1/2 -translate-y-1/2 text-white/75`})})}),(0,J.jsxs)(`footer`,{className:`flex flex-col items-center gap-3 bg-black/60 px-5 pt-4 text-center`,style:{paddingBottom:`max(env(safe-area-inset-bottom), 1rem)`},children:[(0,J.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-white/90`,children:n(`config:mobileServer.scanHint`)}),(0,J.jsx)(B,{variant:`outline`,className:`w-full max-w-sm border-white/50 bg-black/30 text-white hover:bg-black/60 hover:text-white`,onClick:()=>void E(),children:n(`config:mobileServer.cancelScan`)})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(wt,{children:[(0,J.jsx)(St,{children:n(`config:mobileServer.addServer`)}),(0,J.jsx)(bt,{children:n(`config:mobileServer.discoverDescription`)})]}),(0,J.jsxs)(`section`,{className:`grid gap-2`,"aria-live":`polite`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,J.jsx)(vn,{className:`size-4`}),n(`config:mobileServer.nearby`)]}),(0,J.jsx)(B,{size:`icon-sm`,variant:`ghost`,disabled:d||i!==null,className:`pointer-coarse:size-11`,"aria-label":n(`config:mobileServer.rediscover`),onClick:()=>void O(),children:(0,J.jsx)(_e,{className:d?`animate-spin`:void 0})})]}),c.length?(0,J.jsx)(`ul`,{className:`m-0 grid max-h-44 list-none divide-y divide-stroke-soft overflow-y-auto border-y border-stroke-soft p-0`,children:c.map(e=>{let t=i===`lan:${e.id}`;return(0,J.jsxs)(`li`,{className:`flex min-h-12 items-center justify-between gap-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(xe,{className:`size-4 flex-none text-muted-foreground`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm`,children:e.name}),(0,J.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.url})]})]}),(0,J.jsxs)(B,{size:`sm`,className:`pointer-coarse:min-h-11`,disabled:i!==null,onClick:()=>void A(e),children:[t?(0,J.jsx)(ue,{className:`animate-spin`}):null,n(`config:mobileServer.requestConnect`)]})]},e.id)})}):(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:n(d?`config:mobileServer.discovering`:`config:mobileServer.noNearby`)}),p?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs leading-relaxed text-content-secondary`,children:p}):null,h?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-md)] bg-surface-subtle px-3 py-2`,children:[(0,J.jsx)(`p`,{role:`status`,className:`text-xs leading-relaxed`,children:h}),(0,J.jsx)(B,{size:`sm`,variant:`outline`,className:`pointer-coarse:min-h-11`,onClick:()=>void k(),children:n(`config:mobileServer.cancelRequest`)})]}):null]}),(0,J.jsxs)(`div`,{className:`relative py-1`,children:[(0,J.jsx)($e,{}),(0,J.jsx)(`span`,{className:`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-popover px-2 text-xs text-muted-foreground`,children:n(`config:mobileServer.otherMethods`)})]}),(0,J.jsxs)(B,{className:`w-full pointer-coarse:min-h-11`,disabled:i!==null,onClick:()=>void j(),children:[i===`scan`?(0,J.jsx)(ue,{className:`animate-spin`}):(0,J.jsx)(_n,{}),n(`config:mobileServer.scan`)]}),_?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs leading-relaxed text-content-secondary`,children:_}):null]})})})}function xi(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function Si({requestConfirm:e}){let{t}=l(),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(``),[c,u]=(0,q.useState)(!1),d=(0,q.useCallback)(async()=>{try{r(await xi(`mobile_state`)),a(``)}catch{a(t(`config:mobileServer.loadFailed`))}},[t]);(0,q.useEffect)(()=>{d()},[d]);let f=async(e,t,n=``)=>{s(n||e);try{r(await xi(e,t)),a(``)}catch(e){a(String(e))}finally{s(``)}},p=async n=>{o||await e({title:t(`config:mobileServer.forget`),message:t(`config:mobileServer.forgetConfirm`),confirmLabel:t(`config:mobileServer.forget`),tone:`danger`})&&await f(`mobile_forget_server`,{id:n.id},n.id)},m=async e=>{s(e);try{let t=await xi(`mobile_select_server`,{id:e});r(t),a(``),t.proxyUrl&&window.location.replace(t.proxyUrl)}catch(e){a(String(e))}finally{s(``)}},h=n?.mode===`local`,g=n?.mode===`remote`&&!!n.activeId,_=h||g,v=t(h?`config:mobileServer.currentLocal`:g?`config:mobileServer.current`:`config:mobileServer.empty`),y=e=>t(e===`iroh`?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`mt-5 flex min-h-11 items-center gap-2 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-3 py-2 text-xs text-content-secondary`,role:`status`,"aria-live":`polite`,children:[_?(0,J.jsx)(jt,{status:`done`,className:`size-3.5`}):(0,J.jsx)(te,{className:`size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v}),n?.activeTransport?(0,J.jsx)(`span`,{className:`flex-none font-mono text-xs text-content-muted`,children:y(n.activeTransport)}):null]}),(0,J.jsx)(bi,{open:c,onOpenChange:u}),i?(0,J.jsx)(kt,{className:`mt-3`,children:i}):null,(0,J.jsx)(W,{title:t(`config:mobileServer.localTitle`),"data-config-card":`mobile-server-local`,children:(0,J.jsx)(U,{children:(0,J.jsx)(H,{icon:(0,J.jsx)(Sn,{}),name:t(`config:mobileServer.localTitle`),description:t(`config:mobileServer.localDescription`),status:h?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(jt,{status:`done`,className:`size-3.5`}),t(`config:mobileServer.currentLocal`)]}):void 0,actions:h?void 0:(0,J.jsx)(B,{size:`sm`,variant:`secondary`,className:`flex-none max-[650px]:h-11 max-[650px]:px-3 pointer-coarse:h-11`,disabled:!!o,onClick:()=>void(async()=>{s(`mobile_enter_local`);try{let e=await xi(`mobile_enter_local`);e.onDevice.url&&window.location.replace(e.onDevice.url)}catch(e){a(String(e))}finally{s(``)}})(),children:t(`config:mobileServer.enterLocal`)})})})}),(0,J.jsx)(W,{title:t(`config:mobileServer.title`),count:n?.servers?.length??0,"data-config-card":`mobile-server-main`,description:t(`config:mobileServer.description`),actions:(0,J.jsxs)(B,{size:`sm`,onClick:()=>u(!0),children:[(0,J.jsx)(ge,{}),t(`config:mobileServer.addServer`)]}),children:n?.servers?.length?(0,J.jsx)(U,{children:n.servers.map(e=>{let r=n.mode===`remote`&&e.id===n.activeId,i=e.endpoints.find(e=>e.url),a=e.endpoints.find(e=>e.t===`iroh`),s=i?.url||(a?.nodeId?`Iroh ${a.nodeId.slice(0,12)}`:`Iroh`);return(0,J.jsx)(H,{"data-mobile-server":e.id,icon:(0,J.jsx)(xe,{}),name:e.name,nameMeta:t(i&&a?`config:mobileServer.transportLanP2p`:a?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`),description:(0,J.jsx)(`span`,{className:`font-mono`,children:s}),status:r?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(jt,{status:`done`,className:`size-3.5`}),n.activeTransport?t(`config:mobileServer.activeTransport`,{transport:y(n.activeTransport)}):t(`config:mobileServer.current`)]}):void 0,actions:(0,J.jsxs)(J.Fragment,{children:[r?null:(0,J.jsx)(B,{size:`sm`,variant:`ghost`,disabled:o===e.id,onClick:()=>void m(e.id),children:t(`config:mobileServer.connect`)}),(0,J.jsx)(B,{size:`icon-sm`,variant:`ghost`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":t(`config:mobileServer.forget`),title:t(`config:mobileServer.forget`),disabled:!!o,onClick:()=>void p(e),children:(0,J.jsx)(Te,{})})]})},e.id)})}):(0,J.jsx)(yt,{compact:!0,title:t(`config:mobileServer.empty`)})})]})}o.addResourceBundle(`zh-CN`,`remote-workspace`,{description:`使用本机的 Pisper 界面,在另一台 Linux 上运行会话、读写文件和执行任务。`,instructions:`先在 Linux 上运行 Pisper,在「设置 → 远程访问」启用连接,然后复制 HTTPS 地址、证书指纹和配对码。请通过可信渠道核对指纹。`,isolation:`每个工作区在独立窗口中打开。会话、文件、模型配置与任务属于远程机器,不会复制本机密钥;关闭窗口不会停止远程正在执行的任务。本机终端与桌面控制不会在远程窗口中启用。`,refresh:`刷新远程工作区`,name:`工作区名称(可选)`,address:`Linux HTTPS 地址`,fingerprint:`证书指纹`,code:`配对码`,pair:`配对并打开`,open:`连接`,show:`显示窗口`,forget:`移除 {name}`,forgetDescription:`这会关闭该工作区的本机窗口并移除保存的连接,不删除远程文件或会话,也不会停止远程任务。如需吊销设备授权,请在 Linux 的远程访问页操作。`,activeTitle:`当前为远程工作区`,activeDescription:`这里的会话、文件和模型设置属于远程 Linux。连接管理请回到本机主窗口;如需修改远程访问服务,请在 Linux 本机操作。`,manualConnection:`手动连接所需信息`,serverAddress:`HTTPS 服务器地址`}),o.addResourceBundle(`en-US`,`remote-workspace`,{description:`Use the local Pisper interface to run conversations, work with files, and execute tasks on another Linux machine.`,instructions:`Run Pisper on Linux and enable Settings → Remote access. Copy its HTTPS address, certificate fingerprint, and pairing code. Verify the fingerprint through a trusted channel.`,isolation:`Each workspace opens in a separate window. Sessions, files, model settings, and tasks belong to the remote machine; local credentials are not copied. Closing the window does not stop remote tasks. Local terminals and desktop controls are not enabled in remote windows.`,refresh:`Refresh remote workspaces`,name:`Workspace name (optional)`,address:`Linux HTTPS address`,fingerprint:`Certificate fingerprint`,code:`Pairing code`,pair:`Pair and open`,open:`Connect`,show:`Show window`,forget:`Remove {name}`,forgetDescription:`Close this workspace’s local windows and forget the saved connection. Remote files, sessions, and running tasks are not deleted or stopped. To revoke the device authorization, use Remote access on Linux.`,activeTitle:`Remote workspace`,activeDescription:`Sessions, files and model settings in this window belong to the remote Linux machine. Manage connections in your local main window; change remote access service settings directly on Linux.`,manualConnection:`Manual connection details`,serverAddress:`HTTPS server address`});function Ci({notify:e}){let{t,language:n}=l(),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)([]),[u,d]=(0,q.useState)([]),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(``),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(``),T=(0,q.useCallback)(async()=>{try{let[e,t,n,r]=await Promise.all([f(`/api/remote/status`),f(`/api/remote/devices`),f(`/api/remote/pairing-requests`).catch(()=>({requests:[]})),f(`/api/remote/firewall`).catch(e=>{if(e&&typeof e==`object`&&`status`in e&&e.status===403)return null;throw e})]);i(e),o(r),c(t.devices.filter(e=>!e.revokedAt)),d(n.requests),w(``)}catch{w(t(`config:remoteAccess.loadFailed`))}},[t]);(0,q.useEffect)(()=>{T()},[T]),(0,q.useEffect)(()=>{if(!r?.listening)return;let e=window.setInterval(()=>void T(),2e3);return()=>window.clearInterval(e)},[T,r?.listening]);let D=async n=>{S(!0);try{await f(`/api/remote/enabled`,{method:`PUT`,body:{enabled:n,configureFirewall:a!==null},timeout:15e4});let e=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;e&&await e(`desktop_iroh_set_enabled`,{enabled:n}).catch(()=>void 0),n||(m(null),g(!1),v(``)),await T()}catch(n){e(t(`config:remoteAccess.toggleFailed`,{message:String(n)}),`error`)}finally{S(!1)}},O=async()=>{S(!0);try{await f(`/api/remote/firewall/retry`,{method:`POST`,body:{},timeout:15e4}),await T()}catch(n){e(t(`config:remoteAccess.firewallRetryFailed`,{message:String(n)}),`error`)}finally{S(!1)}},k={disabled:t(`config:remoteAccess.firewallDisabled`),configured:t(`config:remoteAccess.firewallConfigured`),not_needed:t(`config:remoteAccess.firewallNotNeeded`),needs_authorization:t(`config:remoteAccess.firewallNeedsAuthorization`),unsupported:t(`config:remoteAccess.firewallUnsupported`),cancelled:t(`config:remoteAccess.firewallCancelled`),error:t(`config:remoteAccess.firewallError`),cleanup_pending:t(`config:remoteAccess.firewallCleanupPending`)},A={packaged_app_required:t(`config:remoteAccess.firewallPackagedApp`),unsupported_firewall:t(`config:remoteAccess.firewallUnsupportedBackend`),unsupported_platform:t(`config:remoteAccess.firewallUnsupportedBackend`),permission_denied:t(`config:remoteAccess.firewallPermissionDenied`),cancelled:t(`config:remoteAccess.firewallCancelled`),timeout:t(`config:remoteAccess.firewallTimeout`),block_all:t(`config:remoteAccess.firewallBlockAll`),rule_changed:t(`config:remoteAccess.firewallRuleChanged`),inspection_failed:t(`config:remoteAccess.firewallVerificationFailed`),verification_failed:t(`config:remoteAccess.firewallVerificationFailed`),operation_failed:t(`config:remoteAccess.firewallVerificationFailed`),unsupported:t(`config:remoteAccess.firewallUnsupportedBackend`)},j=async()=>{S(!0),v(``);try{let e=await f(`/api/remote/pairing-code`,{method:`POST`});if(!e?.code||!e?.expiresAt)throw Error(t(`config:remoteAccess.qrUnavailable`));e.connectionInfo=await f(`/api/remote/connection-info`).catch(()=>void 0),m(e),g(!0),e.qrDataUrl||v(t(`config:remoteAccess.qrUnavailable`))}catch(n){let r=t(`config:remoteAccess.pairingFailed`,{message:String(n)});v(r),e(r,`error`)}finally{S(!1)}},M=async(n,r)=>{b(n.id);try{await f(`/api/remote/pairing-requests/${encodeURIComponent(n.id)}/decision`,{method:`POST`,body:{approved:r}}),await T()}catch(n){e(t(`config:remoteAccess.approvalFailed`,{message:String(n)}),`error`)}finally{b(``)}},ee=async n=>{if(window.confirm(t(`config:remoteAccess.revokeConfirm`,{name:n.name})))try{await f(`/api/remote/devices/${encodeURIComponent(n.id)}/revoke`,{method:`POST`}),await T()}catch(n){e(t(`config:remoteAccess.revokeFailed`,{message:String(n)}),`error`)}};if(C&&!r)return(0,J.jsx)(_t,{kind:`error`,title:t(`config:remoteAccess.loadFailed`),action:(0,J.jsxs)(B,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void T(),children:[(0,J.jsx)(_e,{}),t(`config:remoteAccess.refresh`)]})});if(!r)return(0,J.jsx)(_t,{kind:`loading`,title:t(`config:remoteAccess.loading`)});let N=r.error?`failed`:r.listening?`on`:r.enabled?`starting`:`off`,P=a!==null&&!a.busy&&[`needs_authorization`,`cancelled`,`error`,`cleanup_pending`].includes(a.state);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Tt,{open:h&&p!==null,onOpenChange:g,children:(0,J.jsxs)(xt,{className:`sm:max-w-md`,children:[(0,J.jsxs)(wt,{children:[(0,J.jsx)(St,{children:t(`config:remoteAccess.pairingQrTitle`)}),(0,J.jsx)(bt,{children:t(`config:remoteAccess.scanQrDescription`)})]}),(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-2`,"aria-live":`polite`,children:[p?.qrDataUrl?(0,J.jsx)(`img`,{src:p.qrDataUrl,alt:t(`config:remoteAccess.qrAlt`),className:`size-64 max-w-full rounded-sm border border-stroke bg-white p-2`}):null,_?(0,J.jsx)(`p`,{role:`alert`,className:`text-center text-xs leading-relaxed text-content-secondary`,children:_}):null,p?(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`div`,{className:`font-mono text-[20px] font-medium tracking-[0.2em] text-content`,children:p.code}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-content-muted tabular-nums`,children:t(`config:remoteAccess.codeExpiresAt`,{time:gt(p.expiresAt,n)})})]}):null]}),p?.connectionInfo&&(0,J.jsxs)(`details`,{className:`min-w-0 rounded-md border border-stroke px-3 py-2 text-sm`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-content-secondary`,children:t(`remote-workspace:manualConnection`)}),(0,J.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-content-muted`,children:[(0,J.jsx)(`div`,{children:t(`remote-workspace:serverAddress`)}),p.connectionInfo.endpoints.map(e=>(0,J.jsx)(`code`,{className:`block font-mono break-all text-content select-all`,children:e.url},e.url)),(0,J.jsx)(`div`,{children:t(`remote-workspace:fingerprint`)}),(0,J.jsx)(`code`,{className:`block font-mono break-all text-content select-all`,children:p.connectionInfo.fingerprint})]})]}),(0,J.jsx)(Ct,{children:(0,J.jsxs)(B,{disabled:x,onClick:()=>void j(),children:[x?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(_e,{}),t(x?`config:remoteAccess.generatingQr`:`config:remoteAccess.regenerate`)]})})]})}),C&&(0,J.jsx)(kt,{children:C}),(0,J.jsx)(W,{title:t(`config:remoteAccess.thisComputer`),"data-config-card":`remote-access-main`,children:(0,J.jsxs)(U,{children:[(0,J.jsx)(H,{icon:(0,J.jsx)(fe,{}),name:t(`config:remoteAccess.allowConnections`),description:t(`config:remoteAccess.description`),status:(0,J.jsx)(wi,{attention:N===`failed`,glyph:N===`on`?`done`:N===`starting`?`run`:null,children:t(N===`failed`?`config:remoteAccess.stateFailed`:N===`on`?`config:remoteAccess.stateListening`:N===`starting`?`config:remoteAccess.stateStarting`:`config:remoteAccess.stateOff`)}),actions:(0,J.jsx)(et,{checked:r.enabled,disabled:x,onCheckedChange:e=>void D(e),"aria-label":t(`config:remoteAccess.title`)}),detail:r.error?(0,J.jsx)(`p`,{className:`text-xs leading-relaxed [overflow-wrap:anywhere] text-st-attn`,children:t(`config:remoteAccess.listenFailed`,{message:r.error})}):void 0}),a?(0,J.jsx)(H,{"aria-live":`polite`,icon:(0,J.jsx)(Se,{}),name:t(`config:remoteAccess.firewallTitle`),description:a.busy?t(`config:remoteAccess.firewallWorking`):k[a.state],status:a.busy?(0,J.jsx)(wi,{glyph:`run`,children:t(`config:remoteAccess.firewallChecking`)}):P?(0,J.jsx)(wi,{attention:!0,children:t(`config:remoteAccess.firewallNeedsYou`)}):void 0,actions:r.enabled||a.state===`cleanup_pending`?(0,J.jsxs)(B,{size:`sm`,variant:`secondary`,disabled:x||a.busy,onClick:()=>void O(),children:[x||a.busy?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(_e,{}),r.enabled?t(`config:remoteAccess.firewallRetry`):t(`config:remoteAccess.firewallRetryCleanup`)]}):void 0,detail:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs leading-relaxed text-content-muted`,children:[a.reason&&A[a.reason]?(0,J.jsx)(`p`,{className:`text-content-secondary`,children:A[a.reason]}):null,r.enabled?(0,J.jsx)(`p`,{children:a.scope===`application`?t(`config:remoteAccess.firewallApplicationScope`):a.scope===`program_port`?t(`config:remoteAccess.firewallProgramPortScope`,{port:a.port??`—`}):t(`config:remoteAccess.firewallPortScope`,{port:a.port??`—`})}):null,(0,J.jsx)(`p`,{children:t(`config:remoteAccess.firewallReachability`)}),a.checkedAt?(0,J.jsx)(`p`,{className:`tabular-nums`,children:t(`config:remoteAccess.firewallCheckedAt`,{time:gt(a.checkedAt,n)})}):null]})}):null]})}),r.listening&&u.length?(0,J.jsx)(W,{"aria-live":`polite`,title:t(`config:remoteAccess.pendingApprovals`),count:u.length,meta:(0,J.jsx)(`span`,{className:`font-medium text-st-attn`,children:t(`config:remoteAccess.waitingForYou`)}),description:t(`config:remoteAccess.pendingApprovalsDescription`),children:(0,J.jsx)(U,{children:u.map(e=>(0,J.jsx)(H,{"data-pairing-request":e.id,icon:(0,J.jsx)(Sn,{}),name:e.deviceName,description:(0,J.jsx)(`span`,{className:`font-mono`,children:t(`config:remoteAccess.requestSource`,{ip:e.ip})}),meta:t(`config:remoteAccess.requestedAt`,{time:gt(e.requestedAt,n)}),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(B,{size:`sm`,variant:`ghost`,disabled:y===e.id,onClick:()=>void M(e,!1),children:[(0,J.jsx)(Oe,{}),t(`config:remoteAccess.reject`)]}),(0,J.jsxs)(B,{size:`sm`,disabled:y===e.id,onClick:()=>void M(e,!0),children:[y===e.id?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(E,{}),t(`config:remoteAccess.approve`)]})]})},e.id))})}):null,r.listening?(0,J.jsx)(W,{title:t(`config:remoteAccess.pairing`),"data-config-card":`remote-access-pairing`,children:(0,J.jsx)(U,{children:(0,J.jsx)(H,{icon:(0,J.jsx)(_n,{}),name:t(`config:remoteAccess.pairWithPhone`),description:t(`config:remoteAccess.pairingDescription`),actions:(0,J.jsxs)(B,{size:`sm`,disabled:x,onClick:()=>void j(),children:[x?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(_n,{}),t(x?`config:remoteAccess.generatingQr`:`config:remoteAccess.generateQr`)]}),detail:_&&!h?(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-content-secondary`,"aria-live":`polite`,children:_}):void 0})})}):null,(0,J.jsx)(W,{title:t(`config:remoteAccess.devices`),count:s.length,"data-config-card":`remote-access-devices`,actions:(0,J.jsx)(B,{size:`icon-sm`,variant:`ghost`,className:`pointer-coarse:size-11 max-[650px]:size-11`,onClick:()=>void T(),"aria-label":t(`config:remoteAccess.refresh`),title:t(`config:remoteAccess.refresh`),children:(0,J.jsx)(_e,{})}),children:s.length===0?(0,J.jsx)(yt,{compact:!0,title:t(`config:remoteAccess.noDevices`)}):(0,J.jsx)(U,{children:s.map(e=>(0,J.jsx)(H,{icon:(0,J.jsx)(Sn,{}),name:e.name,nameMeta:e.current?t(`config:remoteAccess.currentDevice`):void 0,description:t(`config:remoteAccess.lastSeen`,{time:gt(e.lastSeenAt,n)}),actions:(0,J.jsx)(B,{size:`sm`,variant:`ghost`,className:`hover:bg-danger-soft hover:text-danger`,"aria-label":`${t(`config:remoteAccess.revoke`)}: ${e.name}`,onClick:()=>void ee(e),children:t(`config:remoteAccess.revoke`)})},e.id))})})]})}function wi({attention:e=!1,glyph:t=null,children:n}){let r=e?`attention`:t;return(0,J.jsxs)(`span`,{className:R(`inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap`,e?`font-medium text-st-attn`:`text-content-secondary`),children:[r&&(0,J.jsx)(jt,{status:r,className:`size-3.5`}),n]})}function Ti({requestConfirm:e}){let{t}=l(),n=window.pisperDesktop?.remoteWorkspaces,[r,i]=(0,q.useState)([]),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(``),v=(0,q.useCallback)(async()=>{n&&i(await n.list())},[n]);(0,q.useEffect)(()=>{v().catch(e=>_(String(e)))},[v]);let y=async e=>{if(!m){h(!0),_(``);try{await e()}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}};return window.__PISPER_REMOTE_WORKSPACE__?(0,J.jsx)(W,{title:t(`config:remoteWorkspace.title`),"data-config-card":`remote-workspaces`,children:(0,J.jsx)(U,{children:(0,J.jsx)(H,{icon:(0,J.jsx)(xe,{}),name:t(`remote-workspace:activeTitle`),description:t(`remote-workspace:activeDescription`),detail:(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:t(`remote-workspace:isolation`)})})})}):n?(0,J.jsxs)(W,{title:t(`config:remoteWorkspace.title`),count:r.length,"data-config-card":`remote-workspaces`,description:t(`remote-workspace:description`),actions:(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,disabled:m,"aria-label":t(`remote-workspace:refresh`),title:t(`remote-workspace:refresh`),onClick:()=>void y(v),children:(0,J.jsx)(_e,{className:`size-3.5`})}),children:[r.length>0&&(0,J.jsx)(U,{children:r.map(r=>(0,J.jsx)(H,{icon:(0,J.jsx)(xe,{}),name:r.name,description:(0,J.jsx)(`span`,{className:`font-mono`,children:r.address}),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(B,{type:`button`,size:`sm`,variant:`secondary`,disabled:m,onClick:()=>void y(async()=>{await n.open(r.id),await v()}),children:[r.connected?t(`remote-workspace:show`):t(`remote-workspace:open`),(0,J.jsx)(S,{className:`size-3.5`})]}),(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,disabled:m,"aria-label":t(`remote-workspace:forget`,{name:r.name}),onClick:()=>void y(async()=>{await e({title:t(`remote-workspace:forget`,{name:r.name}),message:t(`remote-workspace:forgetDescription`)})&&(await n.forget(r.id),await v())}),children:(0,J.jsx)(Te,{className:`size-3.5`})})]})},r.id))}),(0,J.jsxs)(`div`,{className:`@container/card mt-3 rounded-[var(--r-md)] border border-stroke px-3 pt-2 pb-1`,children:[(0,J.jsx)(`p`,{className:`py-1.5 text-xs leading-relaxed text-content-secondary`,children:t(`remote-workspace:instructions`)}),(0,J.jsxs)(`form`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,onSubmit:e=>{e.preventDefault(),y(async()=>{let e=await n.pair({name:a,address:s,fingerprint:u,code:f});p(``),await v(),await n.open(e),await v()})},children:[(0,J.jsx)(Xr,{label:t(`remote-workspace:name`),htmlFor:`remote-workspace-name`,children:(0,J.jsx)(V,{id:`remote-workspace-name`,value:a,maxLength:160,disabled:m,placeholder:`Linux`,onChange:e=>o(e.target.value)})}),(0,J.jsx)(Xr,{label:t(`remote-workspace:address`),htmlFor:`remote-workspace-address`,children:(0,J.jsx)(V,{id:`remote-workspace-address`,type:`url`,value:s,required:!0,disabled:m,placeholder:`https://192.168.1.10:5174`,autoComplete:`off`,spellCheck:!1,className:`font-mono`,onChange:e=>c(e.target.value)})}),(0,J.jsx)(Xr,{label:t(`remote-workspace:fingerprint`),htmlFor:`remote-workspace-fingerprint`,children:(0,J.jsx)(V,{id:`remote-workspace-fingerprint`,value:u,required:!0,disabled:m,placeholder:`SHA256:…`,autoComplete:`off`,spellCheck:!1,className:`font-mono text-xs`,onChange:e=>d(e.target.value)})}),(0,J.jsx)(Xr,{label:t(`remote-workspace:code`),htmlFor:`remote-workspace-code`,children:(0,J.jsx)(V,{id:`remote-workspace-code`,value:f,required:!0,maxLength:64,disabled:m,placeholder:`ABCD-EFGH`,autoComplete:`off`,spellCheck:!1,className:`font-mono`,onChange:e=>p(e.target.value)})}),(0,J.jsx)(`div`,{className:`flex justify-end py-3`,children:(0,J.jsxs)(B,{type:`submit`,className:`max-[650px]:h-11`,disabled:m,children:[m?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(S,{className:`size-3.5`}),t(`remote-workspace:pair`)]})})]})]}),g&&(0,J.jsx)(kt,{className:`mt-3`,children:g}),(0,J.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-content-muted`,children:t(`remote-workspace:isolation`)})]}):null}function Ei({section:e,notify:t,requestConfirm:n,onBack:r}){let{t:i}=l(),a=m(e=>e.capabilities),o=h(),s=p(a,e,{mobileApp:o}),c=i(e===`remote-access`?`config:configPage.remoteAccess`:e===`mobile-server`?`config:configPage.mobileServer`:`config:configPage.desktopPet`),u=i(e===`remote-access`?`config:deviceFeature.remoteAccessLede`:e===`mobile-server`?`config:deviceFeature.mobileServerLede`:`config:desktopPetSettings.description`),d;return d=s.supported?e===`desktop-pet`?(0,J.jsx)(ii,{notify:t,requestConfirm:n}):e===`mobile-server`?(0,J.jsx)(Si,{requestConfirm:n}):(0,J.jsxs)(J.Fragment,{children:[!window.__PISPER_REMOTE_WORKSPACE__&&(0,J.jsx)(Ci,{notify:t}),(0,J.jsx)(Ti,{requestConfirm:n})]}):(0,J.jsx)(Di,{section:e,support:s}),(0,J.jsx)(Dt,{"data-device-feature":e,title:c,description:u,back:r&&{label:i(`navigation:sidebar.features`),ariaLabel:i(`navigation:shell.backToFeaturesLabel`),onBack:r},children:(0,J.jsx)(`div`,{"data-config-card":it,className:`min-w-0`,children:d})})}function Di({section:e,support:t}){let{t:n}=l(),r=n(e===`desktop-pet`?`config:desktopPetSettings.showOnDesktop`:e===`mobile-server`?`config:mobileServer.title`:`config:remoteAccess.allowConnections`),i=t.reason===`runtime`?n(`config:deviceFeature.runtimeUnavailable`):t.reason===`mobile-only`?n(`config:deviceFeature.mobileOnly`):n(e===`desktop-pet`?`config:desktopPetSettings.desktopOnlyDescription`:`config:deviceFeature.remoteAccessDesktopOnly`);return(0,J.jsx)(W,{title:n(`config:deviceFeature.unavailableTitle`),"data-device-unsupported":!0,children:(0,J.jsx)(U,{children:(0,J.jsx)(H,{icon:e===`desktop-pet`?(0,J.jsx)(w,{}):(0,J.jsx)(fe,{}),name:r,description:i,status:n(`config:deviceFeature.unavailable`),actions:(0,J.jsx)(et,{checked:!1,disabled:!0,"aria-label":r})})})})}function Oi({title:e,description:t,action:n,children:r,className:i,...a}){let o=(0,q.useId)();return(0,J.jsxs)(`section`,{"aria-labelledby":o,className:R(`min-w-0`,i),...a,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{id:o,className:`text-[15px] leading-6 font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{className:`mt-0.5 text-[13px] text-content-muted`,children:t})]}),n]}),(0,J.jsx)(`div`,{className:`divide-y divide-stroke-soft`,children:r})]})}function ki({title:e,description:t,control:n,nested:r,children:i,className:a,...o}){return(0,J.jsxs)(`div`,{className:R(`min-w-0 py-3`,r&&`pl-4`,a),...o,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-6 gap-y-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(`div`,{className:`text-[13px] font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-content-muted`,children:t})]}),n&&(0,J.jsx)(`div`,{className:`max-w-full shrink-0`,children:n})]}),i]})}function Ai({className:e,...t}){return(0,J.jsx)(Jn,{"data-slot":`radio-group`,className:R(`grid w-full gap-2`,e),...t})}function ji({className:e,...t}){return(0,J.jsx)($n,{"data-slot":`radio-group-option`,className:R(`disabled:pointer-events-none disabled:opacity-50`,e),...t})}function Mi(e,t){return t(e===`en-US`?`config:languageSettings.english`:`config:languageSettings.simplifiedChinese`)}function Ni({notify:e}){let{language:t,setLanguage:n,t:r}=l(),i=(0,q.useId)(),a=(0,q.useId)(),o=r=>{r!==t&&(n(r),e(s(r===`en-US`?`config:languageSettings.displayLanguageChangedToEnglish`:`config:languageSettings.displayLanguageChangedToSimplifiedChinese`,r)))};return(0,J.jsxs)(`div`,{className:`flex flex-row flex-wrap items-center justify-between gap-x-6 gap-y-3 border-y border-stroke-soft py-3`,"data-config-card":`interface-language`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(`h2`,{id:i,className:`text-sm font-medium text-content`,children:r(`config:languageSettings.displayLanguage`)}),(0,J.jsx)(`p`,{id:a,className:`mt-0.5 text-xs leading-relaxed text-content-muted`,children:r(`config:languageSettings.interfaceOnlyHint`)})]}),(0,J.jsxs)(P,{value:t,onValueChange:e=>{let t=c.find(t=>t.value===e);t&&o(t.value)},children:[(0,J.jsx)(A,{"aria-labelledby":i,"aria-describedby":a,className:`min-w-36 shrink-0 pointer-coarse:min-h-11 max-[650px]:min-h-11`,children:(0,J.jsx)(k,{})}),(0,J.jsx)(j,{position:`popper`,align:`end`,className:`p-1`,children:c.map(e=>(0,J.jsx)(ee,{value:e.value,className:`min-h-9 px-3 pr-8 max-[650px]:min-h-11`,children:Mi(e.value,r)},e.value))})]})]})}function Pi({role:e,label:t,value:n,onCommit:r}){let{t:i}=l(),a=(0,q.useId)(),[o,s]=(0,q.useState)(String(n)),c=(0,q.useRef)(o),u=(0,q.useRef)(n),d=e===`ui`?Yt:Zt;(0,q.useEffect)(()=>{u.current=n,c.current=String(n),s(String(n))},[n]);let f=o!==String(n)&&qt(o,e)===null,p=()=>{let t=qt(c.current,e);t!==null&&t!==u.current&&(r(t),u.current=t)};return(0,J.jsxs)(`div`,{className:`flex max-w-full flex-col items-end gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(V,{type:`number`,min:d.min,max:d.max,step:1,value:o,"aria-label":t,"aria-invalid":f,"aria-describedby":f?a:void 0,className:`h-8 w-16 text-sm tabular-nums pointer-coarse:min-h-11 max-[650px]:min-h-11`,onChange:e=>{c.current=e.target.value,s(e.target.value)},onPointerUp:p,onBlur:p,onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Enter`?(e.preventDefault(),p()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),c.current=String(n),s(String(n))))}}),(0,J.jsx)(`span`,{className:`text-sm text-content-muted`,children:`px`})]}),f&&(0,J.jsx)(`p`,{id:a,role:`alert`,className:`max-w-56 text-xs text-destructive`,children:i(`config:interfaceSettings.invalidFontSize`,{min:d.min,max:d.max})})]})}function Fi({label:e,options:t,value:n,onChange:r}){return(0,J.jsx)(Ai,{value:n,onValueChange:e=>{let n=t.find(t=>t.value===e);n&&r(n.value)},className:`grid auto-cols-fr grid-flow-col gap-0.5 rounded-md border border-stroke bg-chrome p-[3px]`,"aria-label":e,children:t.map(e=>(0,J.jsx)(ji,{type:`button`,className:R(`min-h-7 rounded-sm border border-transparent px-2.5 text-sm transition-colors pointer-coarse:min-h-11 max-[650px]:min-h-11`,e.value===n?`border-key-border bg-key font-medium text-content shadow-key`:`text-content-secondary hover:text-content`),value:e.value,children:e.label},e.value))})}var Ii={neutral:`var(--primary)`,blue:`#3d4bef`,teal:`#0f766e`,violet:`#6d4ad6`,coral:`#c93a48`,custom:`#3d4bef`};function Li(e){let[t,n,r]=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)/255),i=Math.max(t,n,r),a=i-Math.min(t,n,r),o=0;return a&&(o=i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4),{hue:(o*60+360)%360,saturation:i?a/i:0,brightness:i}}function Ri({hue:e,saturation:t,brightness:n}){let r=n*t,i=r*(1-Math.abs(e/60%2-1));return`#`+[[r,i,0],[i,r,0],[0,r,i],[0,i,r],[i,0,r],[r,0,i]][Math.floor(e/60)%6].map(e=>Math.round((e+n-r)*255).toString(16).padStart(2,`0`)).join(``)}function zi({value:e,onCommit:t}){let{t:n}=l(),[r,i]=(0,q.useState)(e),a=(0,q.useRef)(e),[o,s]=(0,q.useState)(()=>Li(e)),c=(0,q.useId)(),u=e=>{a.current=e,i(e)};(0,q.useEffect)(()=>{a.current=e,i(e),s(Li(e))},[e]);let d=e=>{s(e),u(Ri(e))},f=()=>{let n=$t(a.current);n&&n!==$t(e)&&t(n)},p=e=>{let t=e.currentTarget.getBoundingClientRect();d({...o,saturation:Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),brightness:1-Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))})},m=!!r.trim()&&!$t(r);return(0,J.jsxs)(Qe,{onOpenChange:t=>{t||(f(),$t(a.current)||(u(e),s(Li(e))))},children:[(0,J.jsx)(Xe,{asChild:!0,children:(0,J.jsxs)(B,{variant:`outline`,className:`h-8 min-h-0 w-26 gap-1.5 px-2 text-xs tabular-nums pointer-coarse:h-11 max-[650px]:h-11`,"aria-label":n(`config:interfaceSettings.customAccentColor`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 shrink-0 rounded-full border border-stroke-strong`,style:{backgroundColor:e}}),(0,J.jsx)(`span`,{className:`font-mono`,children:e})]})}),(0,J.jsxs)(Ze,{align:`end`,sideOffset:8,className:`w-auto rounded-xl p-3`,children:[(0,J.jsx)(`div`,{role:`slider`,tabIndex:0,"aria-label":n(`config:interfaceSettings.colorSpectrum`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o.saturation*100),"aria-valuetext":r,"aria-describedby":c,className:`relative h-34 w-34 touch-none rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-ring`,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${o.hue} 100% 50%)`},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),p(e)},onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&p(e)},onPointerUp:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&(p(e),e.currentTarget.releasePointerCapture(e.pointerId),f())},onPointerCancel:()=>{u(e),s(Li(e))},onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)&&(e.preventDefault(),d({...o,saturation:Math.min(1,Math.max(0,o.saturation+(e.key===`ArrowRight`?.01:e.key===`ArrowLeft`?-.01:0))),brightness:Math.min(1,Math.max(0,o.brightness+(e.key===`ArrowUp`?.01:e.key===`ArrowDown`?-.01:0)))}))},onKeyUp:e=>{e.key.startsWith(`Arrow`)&&f()},onBlur:f,children:(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-sm`,style:{left:`${o.saturation*100}%`,top:`${(1-o.brightness)*100}%`}})}),(0,J.jsx)(`input`,{type:`range`,min:0,max:359,step:1,value:Math.round(o.hue),"aria-label":n(`config:interfaceSettings.colorHue`),className:`w-34`,onChange:e=>d({...o,hue:Number(e.target.value)}),onPointerUp:f,onBlur:f,onKeyUp:e=>{(e.key.startsWith(`Arrow`)||e.key===`Home`||e.key===`End`)&&f()}}),(0,J.jsx)(`input`,{type:`text`,value:r,spellCheck:!1,"aria-label":n(`config:interfaceSettings.customAccentHex`),"aria-invalid":m,"aria-describedby":c,className:R(`h-8 w-34 rounded-sm border border-input bg-panel px-2 font-mono text-xs outline-none focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus-ring`,m&&`border-destructive`),onChange:e=>{u(e.target.value);let t=$t(e.target.value);t&&s(Li(t))},onBlur:f,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f())}}),(0,J.jsx)(`p`,{id:c,className:`max-w-34 text-xs text-muted-foreground`,children:n(m?`config:interfaceSettings.invalidAccentColor`:`config:interfaceSettings.colorSpectrumHint`)})]})]})}function Bi({notify:e,defaultAdvancedExpanded:t=!1,navigationKey:n}){let{t:r}=l(),{theme:i,density:a,accent:o,customAccent:s,uiFontSize:c,codeFontSize:u,radius:d,motion:f,setTheme:p,setDensity:m,setAccent:h,setCustomAccent:g,setUiFontSize:y,setCodeFontSize:b,setRadius:x,setMotion:S,resetAppearance:C}=Kt(),w=v(e=>e.pinned),T=v(e=>e.setPinned),[E,O]=(0,q.useState)(t),M=(0,q.useId)(),N=(0,q.useId)();(0,q.useEffect)(()=>{t&&O(!0)},[t,n]);let te=i!==Gt.theme||a!==Gt.density||o!==Gt.accent||s!==Gt.customAccent||c!==Gt.uiFontSize||u!==Gt.codeFontSize||d!==Gt.radius||f!==Gt.motion,F=t=>n=>{t(n),e(r(`config:interfaceSettings.preferencesUpdated`))},ne=[{value:`system`,label:r(`config:interfaceSettings.followSystem`),description:r(`config:interfaceSettings.followSystemDescription`),icon:hn},{value:`light`,label:r(`config:interfaceSettings.light`),description:r(`config:interfaceSettings.lightDescription`),icon:wn},{value:`dark`,label:r(`config:interfaceSettings.dark`),description:r(`config:interfaceSettings.darkDescription`),icon:gn}],re=[{value:`comfortable`,label:r(`config:interfaceSettings.comfortable`),description:r(`config:interfaceSettings.comfortableDescription`),icon:En},{value:`compact`,label:r(`config:interfaceSettings.compact`),description:r(`config:interfaceSettings.compactDescription`),icon:pn}],ie=[{value:`system`,label:r(`config:interfaceSettings.motionSystem`),description:r(`config:interfaceSettings.motionSystemDescription`),icon:hn},{value:`full`,label:r(`config:interfaceSettings.motionFull`),description:r(`config:interfaceSettings.motionFullDescription`),icon:Ce},{value:`reduced`,label:r(`config:interfaceSettings.motionReduced`),description:r(`config:interfaceSettings.motionReducedDescription`),icon:_}],I=[{value:`neutral`,label:r(`config:interfaceSettings.accentNeutral`)},{value:`blue`,label:r(`config:interfaceSettings.accentBlue`)},{value:`teal`,label:r(`config:interfaceSettings.accentTeal`)},{value:`violet`,label:r(`config:interfaceSettings.accentViolet`)},{value:`coral`,label:r(`config:interfaceSettings.accentCoral`)},{value:`custom`,label:r(`config:interfaceSettings.accentCustom`)}],ae=[{value:`sharp`,label:r(`config:interfaceSettings.sharp`)},{value:`default`,label:r(`config:interfaceSettings.standard`)},{value:`soft`,label:r(`config:interfaceSettings.soft`)}];return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsx)(Oi,{title:r(`config:interfaceSettings.visualStyle`),description:r(`config:interfaceSettings.appearanceDescription`),"data-config-card":`interface-appearance`,action:(0,J.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`pointer-coarse:h-11`,disabled:!te,onClick:()=>{C(),e(r(`config:interfaceSettings.defaultsRestored`))},children:[(0,J.jsx)(ye,{size:14}),r(`config:interfaceSettings.restoreDefaults`)]}),children:(0,J.jsxs)(Yr,{children:[(0,J.jsx)(ki,{title:r(`config:interfaceSettings.colorMode`),control:(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`config:interfaceSettings.colorMode`),className:`grid w-68 max-w-full grid-cols-3 gap-4`,children:ne.map(e=>(0,J.jsxs)(`label`,{className:`group flex min-w-0 cursor-pointer flex-col items-center gap-2 text-xs text-content-muted`,children:[(0,J.jsx)(`input`,{className:`peer sr-only`,type:`radio`,name:N,value:e.value,checked:i===e.value,onChange:()=>F(p)(e.value)}),(0,J.jsxs)(`span`,{"aria-hidden":`true`,className:R(`relative block aspect-4/3 w-full overflow-hidden rounded-md border border-stroke bg-surface-sunken peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus`,i===e.value&&`border-star ring-2 ring-star`),children:[(0,J.jsxs)(`span`,{className:`absolute inset-2 rounded border border-(--preview-light-line) bg-(--preview-light-bg)`,children:[(0,J.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-1/4 border-r border-(--preview-light-line) bg-(--preview-light-side)`}),(0,J.jsx)(`span`,{className:`absolute top-3 right-1 h-0.5 w-1/2 rounded bg-(--preview-light-line)`}),(0,J.jsx)(`span`,{className:`absolute top-5 right-2 h-0.5 w-1/3 rounded bg-(--preview-light-line)`})]}),e.value!==`light`&&(0,J.jsxs)(`span`,{className:R(`absolute inset-2 rounded border border-(--preview-dark-line) bg-(--preview-dark-bg)`,e.value===`system`&&`left-1/2 rounded-l-none border-l-0`),children:[e.value===`dark`&&(0,J.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-1/4 border-r border-(--preview-dark-line) bg-(--preview-dark-side)`}),(0,J.jsx)(`span`,{className:`absolute top-3 right-1 h-0.5 w-1/2 rounded bg-(--preview-dark-line)`}),(0,J.jsx)(`span`,{className:`absolute top-5 right-2 h-0.5 w-1/3 rounded bg-(--preview-dark-line)`})]})]}),(0,J.jsx)(`span`,{className:R(i===e.value&&`font-medium text-content`),children:e.label})]},e.value))})}),(0,J.jsx)(ki,{title:r(`config:interfaceSettings.accentColor`),description:r(`config:interfaceSettings.accentDescription`),control:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,J.jsxs)(P,{value:o,onValueChange:e=>{let t=I.find(t=>t.value===e);t&&F(h)(t.value)},children:[(0,J.jsx)(A,{"aria-label":r(`config:interfaceSettings.accentColor`),className:`min-w-36 pointer-coarse:min-h-11 max-[650px]:min-h-11`,children:(0,J.jsx)(k,{})}),(0,J.jsx)(j,{position:`popper`,align:`end`,children:I.map(e=>(0,J.jsxs)(ee,{value:e.value,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-stroke-strong`,style:{backgroundColor:e.value===`custom`?s:Ii[e.value]}}),e.label]},e.value))})]}),o===`custom`&&(0,J.jsx)(zi,{value:$t(s)||Gt.customAccent,onCommit:F(g)})]})})]})}),(0,J.jsxs)(He,{open:E,onOpenChange:O,children:[(0,J.jsx)(Ve,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"aria-controls":M,"aria-expanded":E,className:`flex min-h-9 w-full items-center gap-2 rounded-sm text-left text-[15px] leading-6 font-medium text-content max-[650px]:min-h-11`,children:[(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:R(`text-content-muted transition-transform`,!E&&`-rotate-90`)}),r(`config:interfaceSettings.advanced`)]})}),(0,J.jsx)(Be,{id:M,children:(0,J.jsxs)(Yr,{className:`mt-3`,children:[(0,J.jsxs)(`div`,{className:`divide-y divide-stroke-soft`,"data-config-card":`interface-style`,children:[(0,J.jsx)(ki,{title:r(`config:interfaceSettings.uiFontSize`),description:r(`config:interfaceSettings.numericFontHint`),control:(0,J.jsx)(Pi,{role:`ui`,label:r(`config:interfaceSettings.uiFontSize`),value:c,onCommit:F(y)})}),(0,J.jsx)(ki,{title:r(`config:interfaceSettings.codeFontSize`),control:(0,J.jsx)(Pi,{role:`code`,label:r(`config:interfaceSettings.codeFontSize`),value:u,onCommit:F(b)})}),(0,J.jsx)(ki,{title:r(`config:interfaceSettings.cornerStyle`),control:(0,J.jsx)(Fi,{label:r(`config:interfaceSettings.cornerStyle`),options:ae,value:d,onChange:F(x)})})]}),(0,J.jsxs)(`div`,{className:`divide-y divide-stroke-soft`,"data-config-card":`interface-motion`,children:[(0,J.jsx)(ki,{title:r(`config:interfaceSettings.interfaceDensity`),control:(0,J.jsx)(Fi,{label:r(`config:interfaceSettings.interfaceDensity`),options:re,value:a,onChange:F(m)})}),(0,J.jsx)(ki,{title:r(`config:interfaceSettings.pinInspector`),description:r(`config:interfaceSettings.pinInspectorDescription`),control:(0,J.jsx)(et,{checked:w,onCheckedChange:F(T),"aria-label":r(`config:interfaceSettings.pinInspector`),"data-setting":`pin-inspector`})}),(0,J.jsx)(ki,{title:r(`config:interfaceSettings.motion`),control:(0,J.jsx)(Fi,{label:r(`config:interfaceSettings.motion`),options:ie,value:f,onChange:F(S)})}),(0,J.jsx)(ki,{title:r(`config:interfaceSettings.automaticByTime`),description:r(`config:interfaceSettings.automaticByTimeDescription`),control:(0,J.jsx)(et,{checked:i===`scheduled`,onCheckedChange:e=>F(p)(e?`scheduled`:`system`),"aria-label":r(`config:interfaceSettings.automaticByTime`)})})]})]})})]}),(0,J.jsx)(Ni,{notify:e})]})}function Vi({requestConfirm:e}){let{t}=l(),n=ot(e=>e.bindings),r=ot(e=>e.boardBindings),i=ot(e=>e.setBinding),a=ot(e=>e.setBoardBinding),o=ot(e=>e.resetBindings),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!1),m=en(),h=m.actions,g=m.boardActions,_=(e,n)=>{p(!1);let i=dt(r,e,n);if(i){d({action:e,message:t(`config:shortcuts.conflict`,{action:g[i]})});return}try{a(e,n),c(null),d(null),p(!0)}catch{d({action:e,message:t(`config:shortcuts.saveFailed`)})}},v=(e,r)=>{p(!1);let a=lt(n,e,r);if(a){d({action:e,message:t(`config:shortcuts.conflict`,{action:h[a]})});return}try{at({...n,[e]:r})}catch{d({action:e,message:t(`config:shortcuts.invalid`)});return}try{i(e,r),c(null),d(null),p(!0)}catch{d({action:e,message:t(`config:shortcuts.saveFailed`)})}},y=(e,n)=>{if(s!==n)return;if(e.key===`Tab`){c(null);return}let r=ut.includes(n),i=r?pt(e.nativeEvent):ft(e.nativeEvent);if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){c(null),d(null);return}i&&r?_(n,i):i?v(n,i):!e.nativeEvent.isComposing&&e.keyCode!==229&&!e.repeat&&![`Control`,`Meta`,`Alt`,`Shift`,`AltGraph`,`Dead`,`Process`].includes(e.key)&&d({action:n,message:t(`config:shortcuts.invalid`)})},b=async()=>{if(c(null),await e({title:t(`config:shortcuts.resetAll`),message:t(`config:shortcuts.resetConfirm`),confirmLabel:t(`config:shortcuts.resetAll`)}))try{o(),d(null),p(!0)}catch{d({action:null,message:t(`config:shortcuts.saveFailed`)})}},x=ct.some(e=>n[e]!==st[e])||ut.some(e=>r[e]!==ht[e]),S=e=>{let i=ut.includes(e),a=i?g[e]:h[e],o=i?r[e]:n[e],l=i?ht[e]:st[e],f=t=>i?_(e,t):v(e,t);return(0,J.jsxs)(`div`,{className:`py-2.5`,"data-shortcut-action":e,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2`,children:[(0,J.jsx)(`label`,{htmlFor:`shortcut-${e}`,className:`min-w-0 text-sm font-medium text-content`,children:a}),(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center gap-1 max-[650px]:w-full`,children:[(0,J.jsx)(B,{id:`shortcut-${e}`,"data-shortcut-recorder":!0,variant:`outline`,className:R(`h-8.5 w-44 min-w-0 justify-center gap-2 border-input bg-panel px-2.5 text-xs font-normal shadow-none hover:bg-surface-subtle pointer-coarse:h-11 max-[650px]:h-11 max-[650px]:flex-1`,s===e&&`border-focus text-accent-fg ring-3 ring-focus-ring hover:bg-panel`),"aria-label":t(`config:shortcuts.edit`,{action:a}),"aria-pressed":s===e,"aria-describedby":u?.action===e?`shortcut-error-${e}`:void 0,onClick:()=>{c(e),d(null),p(!1)},onBlur:()=>c(t=>t===e?null:t),onKeyDown:t=>y(t,e),children:s===e?(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t(`config:shortcuts.recording`)}):mt(o)?(0,J.jsx)(tt,{className:`min-w-0 flex-wrap justify-center`,children:mt(o).split(` + `).map((e,t)=>(0,J.jsx)(nt,{className:`text-content-secondary`,children:e},t))}):(0,J.jsx)(`span`,{className:`text-content-muted`,children:t(`config:shortcuts.disabled`)})}),(0,J.jsxs)(Ye,{children:[(0,J.jsx)(qe,{asChild:!0,children:(0,J.jsx)(B,{variant:`ghost`,size:`icon`,className:`pointer-coarse:size-11 max-[650px]:size-11`,title:t(`config:shortcuts.options`,{action:a}),"aria-label":t(`config:shortcuts.options`,{action:a}),children:(0,J.jsx)(I,{className:`size-4`})})}),(0,J.jsxs)(Je,{align:`end`,className:`w-40`,onCloseAutoFocus:e=>{document.activeElement?.hasAttribute(`data-shortcut-recorder`)&&e.preventDefault()},children:[(0,J.jsxs)(Ge,{disabled:o===null,onSelect:()=>f(null),children:[(0,J.jsx)(Oe,{className:`size-4`}),t(`config:shortcuts.disableKey`)]}),(0,J.jsxs)(Ge,{disabled:o===l,onSelect:()=>f(l),children:[(0,J.jsx)(ye,{className:`size-4`}),t(`config:shortcuts.resetAll`)]})]})]})]})]}),u?.action===e&&(0,J.jsx)(`p`,{id:`shortcut-error-${e}`,role:`alert`,className:`mt-2 text-xs text-danger`,children:u.message})]},e)},C=e=>e.kind===`fixed`?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2 py-2.5`,"data-shortcut-fixed":e.id,children:[(0,J.jsxs)(`span`,{className:`min-w-0 text-sm text-content-secondary`,children:[m.label(e),(0,J.jsx)(`span`,{className:`ml-1.5 text-xs text-content-muted`,children:t(`board:shortcuts.fixed`)})]}),(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center gap-1 max-[650px]:w-full`,children:[(0,J.jsx)(rn,{keys:e.keys,className:`h-8.5 w-44 justify-center px-2.5 max-[650px]:flex-1`}),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-7 flex-none pointer-coarse:size-11 max-[650px]:size-11`})]})]},nn(e)):S(e.action);return(0,J.jsxs)(`section`,{className:`w-full min-w-0`,"data-config-card":`shortcuts-bindings`,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-5`,children:tn.map((e,n)=>(0,J.jsxs)(`section`,{"aria-labelledby":`shortcut-group-${e.id}`,"data-shortcut-group":e.id,children:[(0,J.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{id:`shortcut-group-${e.id}`,className:`text-[13px] leading-6 font-semibold text-content`,children:m.groups[e.id].title}),n===0&&(0,J.jsxs)(B,{variant:`ghost`,size:`sm`,"data-shortcuts-reset-all":!0,className:`-mr-2 text-content-secondary max-[650px]:h-11 pointer-coarse:h-11`,disabled:!x,onClick:()=>void b(),children:[(0,J.jsx)(ye,{className:`size-3.5`,"aria-hidden":`true`}),t(`config:shortcuts.resetAll`)]})]}),(0,J.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:m.groups[e.id].hint}),(0,J.jsx)(Yr,{children:e.entries.map(C)})]},e.id))}),(0,J.jsx)(`div`,{className:`mt-3 min-h-5 text-xs text-content-muted`,role:`status`,"aria-live":`polite`,children:u?.action===null?(0,J.jsx)(`span`,{className:`text-destructive`,children:u.message}):t(f?`config:shortcuts.saved`:`config:shortcuts.deviceScope`)})]})}o.addResourceBundle(`zh-CN`,`providers`,{"modelEditor.edit":`编辑模型`,"modelEditor.add":`添加模型`,"modelEditor.description":`能力与思考强度`,"modelEditor.id":`模型 ID`,"modelEditor.capabilities":`模型能力`,"modelEditor.chat":`对话`,"modelEditor.image":`图像生成`,"modelEditor.video":`视频生成`,"modelEditor.capabilitiesHint":`可单选或多选。仅选图像生成时,复用此连接的密钥,不会出现在对话模型中。`,"modelEditor.chatCapabilities":`对话能力`,"modelEditor.vision":`图片理解`,"modelEditor.reasoning":`深度思考`,"modelEditor.contextWindow":`上下文窗口(Token)`,"modelEditor.maxTokens":`最大输出(Token)`,"modelEditor.editNamed":`编辑模型 {name}`,"modelEditor.optionsNamed":`模型能力:{name}`,"modelEditor.delete":`删除模型`,"modelEditor.deleteNamed":`删除模型 {name}`,"modelEditor.deleteConfirmation":`删除“{name}”?供应商连接和密钥会保留。若它是默认模型,将选用其他可用模型,没有可用模型时清空默认值;已有会话的模型不会自动替换。之后可以重新添加此模型。`,"modelEditor.deleted":`模型已删除`}),o.addResourceBundle(`en-US`,`providers`,{"modelEditor.edit":`Edit model`,"modelEditor.add":`Add model`,"modelEditor.description":`Capabilities and reasoning levels`,"modelEditor.id":`Model ID`,"modelEditor.capabilities":`Model capabilities`,"modelEditor.chat":`Chat`,"modelEditor.image":`Image generation`,"modelEditor.video":`Video generation`,"modelEditor.capabilitiesHint":`Choose one or more. Image-only models reuse this connection’s key and stay out of the chat model picker.`,"modelEditor.chatCapabilities":`Chat capabilities`,"modelEditor.vision":`Image understanding`,"modelEditor.reasoning":`Reasoning`,"modelEditor.contextWindow":`Context window (tokens)`,"modelEditor.maxTokens":`Maximum output (tokens)`,"modelEditor.editNamed":`Edit model {name}`,"modelEditor.optionsNamed":`Model capabilities: {name}`,"modelEditor.delete":`Delete model`,"modelEditor.deleteNamed":`Delete model {name}`,"modelEditor.deleteConfirmation":`Delete “{name}”? The provider connection and credentials will remain. If this is the default model, another available model will be selected, or the default will be cleared if none is available. Existing conversations will keep their model bindings. You can add this model again later.`,"modelEditor.deleted":`Model deleted`});function Hi(e){let t=(0,q.useContext)(Wt);return(0,q.useLayoutEffect)(()=>{t?.update(e)}),(0,q.useLayoutEffect)(()=>()=>t?.remove(e.id),[t,e.id]),{requestClose:(0,q.useCallback)(n=>{t?t.requestClose(e.id,n):n()},[t,e.id])}}var Ui=[[`openai-responses`,`OpenAI Responses`],[`openai-completions`,`OpenAI Chat Completions`],[`anthropic-messages`,`Anthropic Messages`],[`google-generative-ai`,`Google Generative AI`]],Wi={"openai-codex-responses":`OpenAI Codex Responses`,"azure-openai-responses":`Azure OpenAI Responses`,"mistral-conversations":`Mistral Conversations`,"bedrock-converse-stream":`Amazon Bedrock Converse`,"google-vertex":`Google Vertex AI`,"pi-messages":`Pi Messages`};function Gi(e){return!e||Ui.some(([t])=>t===e)?Ui:[...Ui,[e,Wi[e]||e]]}var Ki={openai:w,"openai-codex":w,anthropic:T,google:Ce,deepseek:ne,xai:he,openrouter:me,"kimi-coding":Ce,"zai-coding-cn":T},qi={saveFallbackModels(e){return f(`/api/config/fallback-models`,{method:`PUT`,body:JSON.stringify({models:e})})},deleteModel(e,t){return f(`/api/providers/`+encodeURIComponent(e)+`/models`,{method:`DELETE`,body:JSON.stringify({modelId:t})})},saveModel(e,t,n=!1){return f(`/api/providers/`+encodeURIComponent(e)+`/models`+(n?``:`/options`),{method:n?`POST`:`PUT`,body:JSON.stringify(n?{...t,id:t.modelId,kind:t.capabilities[0]}:t)})},saveConnection(e,t){return f(`/api/providers/`+encodeURIComponent(e)+`/connection`,{method:`PUT`,body:JSON.stringify(t)})},importLocal(){return f(`/api/providers/import-local`,{method:`POST`,body:`{}`})}};function Ji(e,t){return t.name!==e.name||t.api!==e.api||t.baseUrl!==(e.baseUrl||``)||!!t.apiKey}var Yi=`pointer-coarse:min-h-11 max-[650px]:min-h-11`;function Xi({provider:e,onSave:t,draft:n,onDraftChange:r,onSavingChange:i,children:a}){let{t:o}=l(),[s,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(``),f=(0,q.useId)(),p=Ji(e,n),m=async a=>{if(a.preventDefault(),!s){c(!0),i(!0),d(``);try{t(await qi.saveConnection(e.id,{...n,apiKey:n.apiKey.trim()||void 0})),r(void 0)}catch(e){d(e instanceof Error?e.message:String(e))}finally{c(!1),i(!1)}}};return(0,J.jsxs)(`form`,{onSubmit:e=>void m(e),"data-provider-connection-editor":!0,children:[(0,J.jsxs)(`fieldset`,{disabled:s,className:`min-w-0 divide-y divide-stroke-soft`,children:[(0,J.jsx)(Xr,{label:o(`config:configPage.displayName`),htmlFor:`${f}-name`,children:(0,J.jsx)(V,{id:`${f}-name`,required:!0,className:Yi,value:n.name,onChange:e=>r({...n,name:e.target.value})})}),(0,J.jsx)(Xr,{label:o(`config:configPage.apiKey`),htmlFor:`${f}-key`,children:(0,J.jsx)(V,{id:`${f}-key`,type:`password`,autoComplete:`new-password`,className:`${Yi} font-mono placeholder:font-sans`,value:n.apiKey,placeholder:e.configured?o(`config:configPage.leaveBlankToKeepExistingKey`):o(`config:configPage.enterTheProviderAPIKey`),onChange:e=>r({...n,apiKey:e.target.value})})}),(0,J.jsx)(Xr,{label:o(`config:configPage.apiProtocol`),labelId:`${f}-api-label`,help:(0,J.jsx)(`span`,{className:`font-mono`,children:n.api}),children:(0,J.jsx)(K,{"aria-labelledby":`${f}-api-label`,className:`${Yi} h-8.5`,value:n.api,onChange:e=>r({...n,api:e.target.value}),children:Gi(n.api).map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})}),(0,J.jsx)(Xr,{label:`Base URL`,htmlFor:`${f}-url`,children:(0,J.jsx)(V,{id:`${f}-url`,required:!0,type:`url`,className:`${Yi} font-mono`,value:n.baseUrl,onChange:e=>r({...n,baseUrl:e.target.value})})})]}),u&&(0,J.jsx)(kt,{className:`mt-2 mb-3`,children:u}),a,(0,J.jsxs)(`div`,{className:R(`flex flex-wrap items-center justify-end gap-2 border-t border-stroke-soft py-3`,p&&`sticky bottom-0 z-[1] bg-background`),children:[p&&(0,J.jsx)(`span`,{role:`status`,className:`mr-auto text-xs text-content-muted`,children:o(`config:configPage.unsavedChanges`)}),(0,J.jsx)(B,{type:`submit`,className:`max-[650px]:h-11`,disabled:!p,loading:s,children:o(s?`config:configPage.saving`:`config:configPage.saveChanges`)})]})]})}var Zi=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function Qi({label:e,checked:t,disabled:n,onChange:r}){return(0,J.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,disabled:n,onClick:r,className:R(`inline-flex h-8 items-center gap-2 rounded-sm border px-2.5 text-sm transition-colors disabled:opacity-50 pointer-coarse:h-11`,t?`border-star-border bg-star-soft text-star-strong`:`border-stroke text-content-secondary hover:bg-surface-hover hover:text-content`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:R(`grid size-3.5 place-items-center rounded-[3px] border border-control`,t&&`border-star bg-star text-on-accent`),children:t&&(0,J.jsx)(E,{size:11})}),e]})}function $i({provider:e,model:t,onSave:n,onClose:r}){let{t:i}=l(),[a,o]=(0,q.useState)(()=>({modelId:t?.id||``,name:t?.name||``,capabilities:t?.capabilities||[t?.kind===`image`?`image`:t?.kind===`video`?`video`:`chat`],input:t?.input||[`text`],reasoning:t?.reasoning??!0,contextWindow:t?.contextWindow||2e5,maxTokens:t?.maxTokens||8192})),[s,c]=(0,q.useState)(t?.thinkingLevels||[`off`,`low`,`medium`,`high`]),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``),g=a.capabilities.includes(`chat`),_=async i=>{if(i.preventDefault(),!f){p(!0),h(``);try{n(await qi.saveModel(e.id,{...a,modelId:a.modelId.trim(),thinkingLevels:u||!t?s:void 0},!t)),r()}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}};return(0,J.jsx)(Tt,{open:!0,onOpenChange:e=>{!e&&!f&&r()},children:(0,J.jsxs)(xt,{className:`sm:max-w-[540px] p-5`,showCloseButton:!f,onEscapeKeyDown:e=>{f&&e.preventDefault()},onInteractOutside:e=>e.preventDefault(),children:[(0,J.jsxs)(wt,{children:[(0,J.jsx)(St,{children:i(t?`providers:modelEditor.edit`:`providers:modelEditor.add`)}),(0,J.jsxs)(bt,{children:[e.name,` · `,i(`providers:modelEditor.description`)]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>void _(e),className:`space-y-5`,children:[(0,J.jsxs)(`fieldset`,{disabled:f,className:`space-y-5`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`providers:modelEditor.id`),(0,J.jsx)(V,{required:!0,disabled:!!t,value:a.modelId,onChange:e=>o({...a,modelId:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`config:configPage.modelName`),(0,J.jsx)(V,{value:a.name,onChange:e=>o({...a,name:e.target.value})})]})]}),(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.capabilities`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`chat`,`image`,`video`].map(e=>(0,J.jsx)(Qi,{label:i(e===`chat`?`providers:modelEditor.chat`:e===`image`?`providers:modelEditor.image`:`providers:modelEditor.video`),checked:a.capabilities.includes(e),onChange:()=>o({...a,capabilities:a.capabilities.includes(e)?a.capabilities.filter(t=>t!==e):[...a.capabilities,e]})},e))}),(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:i(`providers:modelEditor.capabilitiesHint`)})]}),g&&(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.chatCapabilities`)}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(Qi,{label:i(`providers:modelEditor.vision`),checked:a.input.includes(`image`),onChange:()=>o({...a,input:a.input.includes(`image`)?[`text`]:[`text`,`image`]})}),(0,J.jsx)(Qi,{label:i(`providers:modelEditor.reasoning`),checked:a.reasoning,onChange:()=>o({...a,reasoning:!a.reasoning})})]})]}),g&&a.reasoning&&(0,J.jsxs)(`fieldset`,{children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`config:configPage.modelThinkingLevels`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Zi.map(e=>(0,J.jsx)(Qi,{label:e,checked:e===`off`||s.includes(e),disabled:e===`off`,onChange:()=>{d(!0),c(s.includes(e)?s.filter(t=>t!==e):[...s,e])}},e))})]}),g&&(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[`contextWindow`,`maxTokens`].map(e=>(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(e===`contextWindow`?`providers:modelEditor.contextWindow`:`providers:modelEditor.maxTokens`),(0,J.jsx)(V,{required:!0,type:`number`,min:1,max:1e8,step:1,value:a[e],onChange:t=>o({...a,[e]:Number(t.target.value)})})]},e))})]}),m&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:m}),(0,J.jsxs)(Ct,{children:[(0,J.jsx)(B,{type:`button`,variant:`ghost`,disabled:f,onClick:r,children:i(`config:configPage.cancel`)}),(0,J.jsxs)(B,{type:`submit`,disabled:f||!a.capabilities.length||!a.modelId.trim(),children:[f&&(0,J.jsx)(ue,{className:`animate-spin`,size:14}),` `,i(f?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})]})})}function ea(e,t){let n=e.providers.filter(e=>e.configured||e.custom),r=e.defaultProvider||e.provider;return{providers:n,selected:n.find(e=>e.id===t)??n.find(e=>e.id===r)??n[0],defaultId:r}}function ta(e){let t=e.trim().split(/[\s_\-/.]+/).filter(Boolean);if(t.length>1)return(Array.from(t[0])[0]+Array.from(t[1])[0]).toUpperCase();let n=Array.from(t[0]||`?`);return n[0].toUpperCase()+(n[1]||``)}function na(e){return e?e>=1e6?`${Number((e/1e6).toFixed(2))}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e):`—`}function ra(e){return Gi(e).find(([t])=>t===e)?.[1]||e}var ia=`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 @min-[560px]/card:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_64px_76px_minmax(88px,auto)]`;function aa(e){let{t}=l(),n=(0,q.useId)(),{providers:r,defaultId:i}=ea(e.config,e.selectedProviderId),a=r.find(t=>t.id===e.selectedProviderId),[o,s]=(0,q.useState)({}),[c,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=!!(c||e.settingDefault||e.settingModel||e.toggling||e.deletingModel);Hi({id:`provider-drafts-${n}`,dirty:r.some(e=>!!(o[e.id]&&Ji(e,o[e.id]))),saving:p,discard:()=>s({})});let m={chat:t(`providers:modelEditor.chat`),image:t(`providers:modelEditor.image`),video:t(`providers:modelEditor.video`),reasoning:t(`providers:modelEditor.reasoning`)},h=e=>{let t=e.capabilities||[e.kind];return[[`chat`,de,t.includes(`chat`)],[`image`,se,t.includes(`image`)],[`video`,pe,t.includes(`video`)],[`reasoning`,T,!!e.reasoning&&t.includes(`chat`)]].filter(([,,e])=>e).map(([e,t])=>(0,J.jsxs)(`span`,{title:m[e],className:`inline-flex`,children:[(0,J.jsx)(t,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`sr-only`,children:m[e]})]},e))},g=e=>e.configured?t(`config:providerWorkbench.keyConfigured`):e.id===`openai-codex`?t(`config:configPage.codexCLILoginRequired`):t(`config:configPage.apiKeyRequired`),_=e=>e.configured?e.enabled?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(E,{className:`size-3.5`,"aria-hidden":`true`}),t(`config:providerWorkbench.connected`)]}):t(`config:configPage.disabled2`):t(`config:providerWorkbench.notConnected`),v=n=>(0,J.jsxs)(`div`,{className:`@container/card min-w-0`,"data-provider-detail":n.id,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 border-t border-stroke-soft py-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-content-muted`,children:n.id}),(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:t(`config:configPage.enabled`)}),(0,J.jsx)(Jr,{value:n.configured&&n.enabled,disabled:!n.configured||p,onChange:()=>void e.onToggle(n,!n.enabled),ariaLabel:t(`config:configPage.providerEnabled`,{name:n.name})})]}),(0,J.jsxs)(Ye,{children:[(0,J.jsx)(qe,{asChild:!0,children:(0,J.jsx)(B,{variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11 max-[650px]:size-11`,"aria-label":t(`config:providerWorkbench.actions`),children:(0,J.jsx)(I,{size:16})})}),(0,J.jsxs)(Je,{align:`end`,children:[(0,J.jsxs)(Ge,{disabled:n.id===i||!n.configured||!n.enabled||!n.defaultModel||p,onSelect:()=>void e.onSetDefault(n),children:[(0,J.jsx)(Cn,{size:14}),t(`config:configPage.setAsDefaultProvider`)]}),(0,J.jsxs)(Ge,{disabled:p,onSelect:()=>e.onClone(n),children:[(0,J.jsx)(re,{size:14}),t(`config:configPage.cloneProvider`)]}),n.custom&&(0,J.jsxs)(Ge,{className:`text-destructive`,disabled:p,onSelect:()=>void e.onDelete(n),children:[(0,J.jsx)(Te,{size:14}),t(`config:configPage.deleteProvider`)]})]})]})]}),(0,J.jsxs)(Xi,{provider:n,draft:o[n.id]??{name:n.name,api:n.api,baseUrl:n.baseUrl||``,apiKey:``},onDraftChange:e=>s(t=>({...t,[n.id]:e})),onSavingChange:u,onSave:e.onSave,children:[(0,J.jsxs)(`div`,{className:`mt-2 flex min-h-10 items-center gap-2 border-t border-stroke-soft pt-2`,children:[(0,J.jsxs)(`h3`,{className:`text-[13px] font-medium text-content-muted`,children:[t(`config:providerWorkbench.models`),(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,n.models.length]})]}),(0,J.jsxs)(B,{type:`button`,variant:`secondary`,size:`sm`,className:`ml-auto pointer-coarse:h-11 max-[650px]:h-11`,disabled:p,onClick:()=>f({provider:n}),children:[(0,J.jsx)(ge,{size:14}),t(`providers:modelEditor.add`)]})]}),n.models.length>0&&(0,J.jsxs)(`div`,{className:R(ia,`hidden h-8 text-xs font-medium text-content-muted @min-[560px]/card:grid`),children:[(0,J.jsx)(`span`,{children:t(`providers:modelEditor.id`)}),(0,J.jsx)(`span`,{children:t(`config:configPage.displayName`)}),(0,J.jsx)(`span`,{className:`text-right`,children:t(`config:providerWorkbench.contextColumn`)}),(0,J.jsx)(`span`,{children:t(`providers:modelEditor.capabilities`)}),(0,J.jsx)(`span`,{"aria-hidden":`true`})]}),n.models.map(r=>{let i=n.defaultModel===r.id;return(0,J.jsxs)(`div`,{"data-provider-model":r.id,className:R(ia,`min-h-11.5 border-t border-stroke-soft py-px text-sm text-content-secondary`),children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>f({provider:n,model:r}),disabled:p,className:`flex min-h-11 min-w-0 flex-col justify-center rounded-xs py-1 text-left`,"aria-label":t(`providers:modelEditor.editNamed`,{name:r.name||r.id}),children:[(0,J.jsx)(`span`,{className:`block truncate font-mono text-[12.5px] text-content`,children:r.id}),(0,J.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-2 text-xs text-content-muted @min-[560px]/card:hidden`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:r.name||r.id}),(0,J.jsx)(`span`,{className:`tabular-nums`,children:na(r.contextWindow)}),h(r)]})]}),(0,J.jsx)(`span`,{className:`hidden min-w-0 truncate text-content @min-[560px]/card:block`,children:r.name||r.id}),(0,J.jsx)(`span`,{className:`hidden text-right tabular-nums @min-[560px]/card:block`,children:na(r.contextWindow)}),(0,J.jsx)(`span`,{className:`hidden items-center gap-2 text-content-muted @min-[560px]/card:flex`,children:h(r)}),(0,J.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[r.kind===`chat`&&(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:R(`pointer-coarse:size-11 max-[650px]:size-11`,i&&`text-star disabled:opacity-100 aria-disabled:opacity-100`),"aria-label":t(`config:configPage.providerDefaultModel`)+`: `+r.id,title:t(`config:configPage.providerDefaultModel`),"aria-pressed":i,disabled:p||!n.configured||i,onClick:()=>void e.onSetDefaultModel(n,r.id),children:(0,J.jsx)(Cn,{size:15,className:R(i&&`fill-current`)})}),(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11 max-[650px]:size-11`,"aria-label":t(`providers:modelEditor.optionsNamed`,{name:r.id}),disabled:p,onClick:()=>f({provider:n,model:r}),children:(0,J.jsx)(xn,{size:14})}),(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger pointer-coarse:size-11 max-[650px]:size-11`,disabled:p,"aria-label":t(`providers:modelEditor.deleteNamed`,{name:r.name||r.id}),title:t(`providers:modelEditor.delete`),onClick:()=>void e.onDeleteModel(n,r),children:(0,J.jsx)(Te,{size:14})})]})]},r.id)})]},n.id)]});return(0,J.jsxs)(W,{"data-config-card":`models-connections`,"data-model-provider-list":!0,title:t(`config:providerWorkbench.providers`),count:r.length,meta:e.meta,description:t(`config:providerWorkbench.providersHint`),children:[r.length>0?(0,J.jsx)(U,{children:r.map(n=>{let r=n.id===i,o=a?.id===n.id;return(0,J.jsx)(H,{"data-provider-row":n.id,icon:(0,J.jsx)(`span`,{className:`text-[13px] font-semibold text-content-secondary`,children:ta(n.name)}),name:n.name,description:[g(n),t(`config:configPage.countModels`,{count:n.models.length}),ra(n.api)].join(` · `),status:(0,J.jsxs)(J.Fragment,{children:[r&&(0,J.jsxs)(`span`,{"data-provider-default":!0,className:`text-content-secondary`,children:[t(`config:providerWorkbench.default`),` ·`]}),_(n)]}),expanded:o,onExpandedChange:t=>e.onSelectProvider(t?n.id:``),toggleLabel:t(`config:providerWorkbench.toggleProvider`,{name:n.name}),detail:o?v(n):null},n.id)})}):(0,J.jsxs)(`div`,{className:`grid min-h-48 place-content-center justify-items-center gap-2 border-y border-stroke px-6 py-8 text-center`,children:[(0,J.jsx)(vt,{size:40,className:`mb-1`}),(0,J.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`config:providerWorkbench.noConnections`)}),(0,J.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`config:providerWorkbench.addConnectionHint`)})]}),e.onAddConnection&&(0,J.jsxs)(`button`,{type:`button`,"data-add-provider":!0,disabled:p,onClick:e.onAddConnection,className:`flex min-h-[52px] w-full min-w-0 items-center gap-2.5 text-left text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:opacity-50`,children:[(0,J.jsx)(ge,{size:16,"aria-hidden":`true`,className:`flex-none text-content-muted`}),(0,J.jsx)(`span`,{className:`flex-none`,children:t(`config:providerWorkbench.addProvider`)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted`,children:t(`config:providerWorkbench.addProviderHint`)})]}),d&&(0,J.jsx)($i,{provider:d.provider,model:d.model,onSave:e.onSave,onClose:()=>f(null)})]})}function oa(){let e=globalThis.crypto.getRandomValues(new Uint32Array(4));return`custom-${Array.from(e,e=>e.toString(16).padStart(8,`0`)).join(``)}`}function sa({value:e,onChange:t,configured:n=!1,cloning:r=!1}){let{t:i}=l();return(0,J.jsxs)(G,{variant:`control`,children:[i(`config:configPage.apiKey`),(0,J.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:e,onChange:e=>t(e.target.value),placeholder:i(r?`config:configPage.leaveBlankToCopySourceKey`:n?`config:configPage.leaveBlankToKeepExistingKey`:`config:configPage.enterTheProviderAPIKey`)})]})}function ca({ids:e,onChange:t,placeholder:n,primaryId:r=``}){let{t:i}=l(),[a,o]=(0,q.useState)(``),s=()=>{let n=a.trim();!n||n===r.trim()||e.includes(n)||(t([...e,n]),o(``))};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`control`,children:[i(`config:configPage.manualModelIds`),(0,J.jsxs)(`div`,{className:`flex items-stretch gap-1.5`,children:[(0,J.jsx)(`input`,{"aria-label":i(`config:configPage.manualModelIds`),value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())},placeholder:n}),(0,J.jsx)(B,{type:`button`,size:`icon`,variant:`secondary`,className:`h-auto w-8.5 flex-none pointer-coarse:w-11`,"aria-label":i(`config:configPage.manualModelIds`),disabled:!a.trim(),onClick:s,children:(0,J.jsx)(ge,{size:14})})]})]}),e.length>0&&(0,J.jsx)(`div`,{className:`flex flex-col overflow-hidden rounded-md border border-stroke`,children:e.map(n=>(0,J.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center gap-2 border-b border-stroke-soft py-1 pr-1 pl-2.5 last:border-b-0`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12.5px] text-content`,children:n}),(0,J.jsx)(`button`,{type:`button`,"aria-label":i(`config:configPage.delete`),className:`grid size-7 flex-none cursor-pointer place-items-center rounded-sm border-0 bg-transparent p-0 text-content-muted hover:bg-danger-soft hover:text-danger pointer-coarse:size-11`,onClick:()=>t(e.filter(e=>e!==n)),children:(0,J.jsx)(Oe,{size:12})})]},n))}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`config:configPage.manualModelIdsHint`)})]})}function la(e,t){return e?.models.find(t=>t.id===e.defaultModel)||(t===`visual`?e?.models.find(e=>e.kind===`image`||e.kind===`video`):e?.models.find(e=>e.kind===`chat`)||e?.models[0])}function ua({onClose:e,onCreated:t,onConfigChanged:n,initialProviderType:r=`chat`,initialProvider:i,cloneProvider:a,embedded:o=!1}){let{t:s}=l(),c=i||a,u=!!a,d=c?.type||r,p=la(c,d),[m,h]=(0,q.useState)(``),g=!!(i||m),[_,v]=(0,q.useState)(()=>({name:a?s(`config:configPage.clonedProviderName`,{name:a.name}):i?.name||``,id:a?oa():i?.id||``,providerType:d,api:i?.api||`openai-responses`,baseUrl:i?.baseUrl||``,model:p?.id||``,modelName:p?.name||``,modelKind:p?.kind===`image`||p?.kind===`video`?p.kind:d===`visual`?`image`:`chat`,reasoning:p?.reasoning!==!1,thinkingLevels:p?.thinkingLevels||[],enabled:i?.enabled??!0})),y=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],[b,x]=(0,q.useState)(!1),S=e=>{x(!0),v(t=>({...t,thinkingLevels:t.thinkingLevels.includes(e)?t.thinkingLevels.filter(t=>t!==e):[...t.thinkingLevels,e]}))},[C,w]=(0,q.useState)(!1),[T,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(``),A=O.trim()||void 0,[j,M]=(0,q.useState)([]),ee=e=>v(t=>({...t,name:e,id:t.id||e.toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)}));return(0,q.useEffect)(()=>{if(o||C)return;let t=t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[o,e,C]),(0,J.jsx)(`div`,{className:o?`provider-config-inline`:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:t=>!o&&!C&&t.target===t.currentTarget&&e(),children:(0,J.jsxs)(`form`,{role:o?void 0:`dialog`,"aria-modal":!o||void 0,className:o?`provider-config-form grid gap-3 text-sm [&_label]:!mt-0 [&_label]:!text-sm [&_label]:font-medium [&_input]:!h-9 [&_input]:!min-h-9 [&_input]:rounded-lg [&_input]:!text-sm [&_select]:!h-9 [&_select]:!min-h-9 [&_select]:rounded-lg [&_select]:!text-sm [&_summary]:text-sm`:`modal provider-config-modal max-h-[calc(100dvh_-_40px)] !w-[min(620px,100%)] overflow-y-auto overscroll-contain rounded-lg border border-stroke bg-solid p-[18px] shadow-float [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async e=>{if(e.preventDefault(),!C){if(!u&&!A&&!i?.configured&&!m){D(s(`config:configPage.enterTheAPIKeyForThisConnection`));return}w(!0),D(``);try{if(a){t(await f(`/api/providers/${encodeURIComponent(a.id)}/clone`,{method:`POST`,body:JSON.stringify({name:_.name,id:_.id,apiKey:A})}));return}let e=g?await f(`/api/config`,{method:`PUT`,body:JSON.stringify({..._,apiKey:A,thinkingLevels:b?_.thinkingLevels:void 0,provider:m||_.id,providerName:_.name,setAsDefault:!1})}):await f(`/api/providers`,{method:`POST`,body:JSON.stringify({..._,apiKey:A,thinkingLevels:b?_.thinkingLevels:void 0})}),r=e.createdProviderId||m||_.id;i||(h(r),v(e=>({...e,id:r})),n?.(e));let o=new Set((i?.models||[]).map(e=>e.id)),s=j.filter(e=>e!==_.model.trim()&&!o.has(e));if(s.length)try{e=await f(`/api/providers/${encodeURIComponent(r)}/models/batch`,{method:`POST`,body:JSON.stringify({models:s.map(e=>({id:e,kind:_.providerType===`visual`?_.modelKind:`chat`}))})})}catch(e){D(e instanceof Error?e.message:String(e));return}t(e)}catch(e){D(e instanceof Error?e.message:String(e))}finally{w(!1)}}},children:[!o&&(0,J.jsxs)(It,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{children:s(u?`config:configPage.cloneProvider`:g?`config:configPage.editProviderConnection`:`config:configPage.addProviderConnection`)}),!u&&(0,J.jsx)(`p`,{children:s(g?`config:configPage.updateProviderKeyURLAndModelSettings`:`config:configPage.youCanCreateMultipleConnectionsUsingTheSameProtocolEachWithItsOwnKeyAndBaseURL`)})]}),(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`config:configPage.closeDialog`),disabled:C,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},children:(0,J.jsx)(Oe,{size:17})})]}),(0,J.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.displayName`),(0,J.jsx)(`input`,{value:_.name,onChange:e=>ee(e.target.value),placeholder:s(`config:configPage.forExampleOpenAIOfficial`)})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Provider ID`,(0,J.jsx)(`input`,{value:_.id,disabled:g,onChange:e=>v({..._,id:e.target.value}),placeholder:`openai-official`})]})]}),(0,J.jsx)(sa,{value:O,onChange:k,configured:i?.configured,cloning:u}),!u&&(0,J.jsxs)(J.Fragment,{children:[!o&&(0,J.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between gap-2 rounded-sm border border-stroke-soft bg-surface-subtle px-2.5 py-2`,children:[(0,J.jsx)(`span`,{className:`text-xs text-content-muted`,children:s(`config:configPage.providerPurpose`)}),(0,J.jsx)(`strong`,{className:`font-mono text-xs font-medium`,children:_.providerType===`visual`?s(`config:configPage.visualProvider`):s(`config:configPage.chatProvider`)})]}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.apiProtocol`),(0,J.jsx)(K,{value:_.api,onChange:e=>v({..._,api:e.target.value}),children:Ui.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Base URL`,(0,J.jsx)(`input`,{value:_.baseUrl,onChange:e=>v({..._,baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})]}),(0,J.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[s(g?`config:configPage.providerDefaultModel`:`config:configPage.initialModelID`),(0,J.jsx)(`input`,{value:_.model,onChange:e=>v({..._,model:e.target.value}),placeholder:_.providerType===`visual`?`gpt-image-2 or grok-imagine-video`:`gpt-5.4 or gpt-image-1`})]}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelName`),(0,J.jsx)(`input`,{value:_.modelName,onChange:e=>v({..._,modelName:e.target.value}),placeholder:s(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,J.jsxs)(`details`,{open:!o||void 0,className:`group rounded-lg border border-border px-3 py-2 [&[open]]:space-y-3`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-[13px] text-muted-foreground`,children:s(`config:providerWorkbench.modelOptions`)}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelType`),(0,J.jsxs)(K,{value:_.modelKind,onChange:e=>v({..._,modelKind:e.target.value,providerType:e.target.value===`chat`?`chat`:`visual`}),children:[(0,J.jsx)(`option`,{value:`chat`,children:s(`providers:modelEditor.chat`)}),(0,J.jsx)(`option`,{value:`image`,children:s(`providers:modelEditor.image`)}),(0,J.jsx)(`option`,{value:`video`,children:s(`providers:modelEditor.video`)})]})]}),(0,J.jsx)(`div`,{className:`grid gap-[9px]`,children:(0,J.jsx)(ca,{ids:j,onChange:M,primaryId:_.model,placeholder:_.providerType===`visual`?`gpt-image-1`:`gpt-5.5`})}),_.modelKind===`chat`&&(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelThinkingLevels`),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-[6px]`,children:y.map(e=>{let t=e===`off`,n=t||_.thinkingLevels.includes(e),r=t||!_.reasoning&&e!==`off`;return(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":n,disabled:r,onClick:()=>!t&&S(e),className:R(`inline-flex h-[27px] cursor-pointer items-center gap-[4px] rounded-full border px-[10px] text-[12px] font-medium transition-colors`,n?`border-[var(--control-selected-border)] bg-[var(--control-selected-bg)] text-[var(--control-selected-text)]`:`border-[var(--stroke)] bg-[var(--surface-subtle)] text-[var(--text)] hover:bg-[var(--surface-highlight)]`,t?`cursor-default`:r&&`cursor-not-allowed opacity-40`),children:[n&&(0,J.jsx)(E,{size:12}),e]},e)})}),(0,J.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:s(`config:configPage.modelThinkingLevelsHint`)})]})]}),!o&&(0,J.jsxs)(`div`,{className:`mt-2.5 flex min-h-11 items-center justify-between gap-3 rounded-sm border border-[var(--stroke-soft)] bg-[var(--surface-subtle)] px-2.5 py-2`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,J.jsx)(`strong`,{className:`text-[13px]`,children:g?s(`config:configPage.providerEnabled`,{name:_.name}):s(`config:configPage.enableAfterCreation`)}),_.providerType===`visual`&&(0,J.jsx)(`small`,{className:`text-[13px] text-muted-foreground`,children:s(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]}),(0,J.jsx)(Jr,{value:_.enabled,onChange:e=>v({..._,enabled:e})})]})]}),T&&(0,J.jsxs)(Pt,{children:[(0,J.jsx)(Ee,{size:13}),T]}),(0,J.jsxs)(`div`,{className:`mt-[18px] flex justify-end gap-2`,children:[(0,J.jsx)(B,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:C,onClick:e,children:s(`config:configPage.cancel`)}),(0,J.jsxs)(B,{type:`submit`,className:`max-[650px]:h-11`,disabled:C,children:[C?(0,J.jsx)(z,{className:`text-current`}):g?(0,J.jsx)(E,{size:14}):(0,J.jsx)(ge,{size:14}),s(C?`config:configPage.saving`:u?`config:configPage.cloneProvider`:g?`config:configPage.saveChanges`:`config:configPage.createConnection`)]})]})]})})}function da(e){return(e.providers||[]).filter(e=>e.importable&&!e.imported&&!e.conflict).length}function fa(e){return da(e)>0}function pa(e,t){return!t&&!fa(e)}function ma(e,t,n){let r=e.providers||[],i=e.errors||[],a=fa(e),o=!!(n||i.length||r.some(e=>e.conflict||!e.imported&&!e.importable||e.warnings?.some(e=>e.code!==`login_auth_not_imported`)));return t||a||o}function ha(e){return e.source===`codex-config`?`Codex config.toml`:e.source===`claude-config`?`Claude settings.json`:e.source===`codex-auth`?`Codex login`:`Claude login`}function ga(e,t){return e.authType===`environment`?t(`config:configPage.keyVariableName`,{name:e.authVariable}):e.authType===`bearer`||e.authType===`api_key`?t(`config:configPage.authenticationIncludedInConfiguration`):e.authType===`oauth`?t(`config:configPage.loginStateFileDetected`):e.authType===`external-login`?t(`config:configPage.authenticationRequired`):t(`config:configPage.noAuthenticationInConfiguration`)}function _a(e,t){return t(e===`multiple_auth_values`?`config:configPage.multipleAuthenticationFieldsWereDetectedTheAuthorizationFieldTakesPrecedence`:e===`invalid_url`?`config:configPage.theProviderEndpointIsInvalid`:e===`unsupported_api`?`config:configPage.theAPIProtocolInThisConfigurationIsNotSupportedYet`:e===`invalid_env_name`?`config:configPage.theKeyEnvironmentVariableNameIsInvalid`:`config:configPage.someConfigurationFieldsCannotBeImported`)}function va({discovery:e,discovering:t,error:n,importing:r,forceVisible:i=!1,onRefresh:a,onImport:o}){let{t:s}=l(),[c,u]=(0,q.useState)(null),d=e.providers||[],f=e.errors||[];if(!i&&!ma(e,t,n))return null;let p=c??(!i&&pa(e,t)),m=()=>(u(null),a()),h=e=>(u(null),o(e)),g=e=>[`invalid_json`,`invalid_toml`].includes(e.code)?s(`config:configPage.invalidConfigurationFileFormat`):e.code===`unsupported_config`?s(`config:configPage.noImportableProviderConfigurationWasFound`):e.code===`invalid_login_state`?s(`config:configPage.incompleteLoginState`):e.code===`file_too_large`?s(`config:configPage.configurationFileIsTooLarge`):s(`config:configPage.unableToReadTheConfigurationFile`);return(0,J.jsxs)(Gr,{className:`mb-3 py-3.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2.5 max-[650px]:flex-wrap`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-sm border-0 bg-transparent p-0 text-left max-[650px]:basis-full`,"aria-expanded":!p,onClick:()=>u(!p),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-9.5 shrink-0 place-items-center rounded-lg border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(xe,{size:18})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium text-content`,children:s(`config:configPage.localProviderConfiguration`)}),(0,J.jsx)(`span`,{className:`text-xs leading-[1.45] text-content-muted`,children:s(`config:configPage.readProviderEndpointModelAndAuthenticationFieldsFromCodexConfigTomlAndClaudeSettingsJson`)})]}),(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:R(`flex-none text-content-muted transition-transform`,!p&&`rotate-180`)})]}),(0,J.jsxs)(B,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:t||!!r,onClick:m,children:[t?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(_e,{size:13}),s(`config:configPage.rescan`)]})]}),!p&&(0,J.jsxs)(J.Fragment,{children:[t&&!d.length?(0,J.jsxs)(`div`,{role:`status`,className:`mt-3 flex min-h-12 items-center justify-center gap-2 rounded-sm bg-surface-subtle text-xs text-content-muted`,children:[(0,J.jsx)(z,{}),s(`config:configPage.scanningProviderConfigurationFiles`)]}):d.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:d.map(e=>{let t=ha(e),n=r===e.id,i=e.source.startsWith(`claude-`)?T:w,a=e.kind===`authentication`?s(`config:configPage.officialProviderAuthenticationOnly`):e.models?.length?e.models.map(e=>e.id).join(`, `):s(`config:configPage.noModelSpecified`);return(0,J.jsxs)(`div`,{className:R(`grid min-h-17 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 rounded-md border px-3 py-2 max-[650px]:grid-cols-[auto_minmax(0,1fr)]`,e.imported?`border-success-border bg-success-soft`:`border-stroke bg-panel`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7.5 place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(i,{size:15})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,J.jsxs)(`span`,{className:`truncate text-sm font-medium text-content`,children:[t,` · `,e.providerName]}),(0,J.jsxs)(`span`,{className:`truncate font-mono text-xs text-content-muted`,children:[e.api,` · `,a]}),(0,J.jsxs)(`span`,{className:`truncate text-xs text-content-muted`,children:[e.kind===`authentication`?s(`config:configPage.officialEndpointOnly`):e.baseUrl||s(`config:configPage.noBaseURLSpecified`),` `,`· `,ga(e,s),` · `,e.location]})]}),(0,J.jsx)(`span`,{className:`flex min-w-0 flex-none items-center max-[650px]:col-start-2`,children:e.imported?(0,J.jsx)(qr,{tone:`green`,children:s(`config:configPage.loaded`)}):e.conflict?(0,J.jsx)(qr,{tone:`amber`,children:s(`config:configPage.conflictDetected`)}):e.importable?(0,J.jsxs)(B,{type:`button`,size:`sm`,className:`pointer-coarse:h-11`,disabled:n||!!r,onClick:()=>h(e),children:[n?(0,J.jsx)(z,{className:`size-3 text-current`}):(0,J.jsx)(ie,{size:12}),n?s(`config:configPage.loading`):e.kind===`authentication`?s(`config:configPage.loadLoginState`):s(`config:configPage.loadConfiguration`)]}):(0,J.jsx)(qr,{tone:`gray`,children:s(`config:configPage.cannotLoad`)})})]},e.id)})}):(0,J.jsxs)(`div`,{className:`mt-3 flex min-h-12 items-center justify-center gap-2 rounded-sm bg-surface-subtle px-3 text-center text-xs text-content-muted`,children:[(0,J.jsx)(xe,{size:15,"aria-hidden":`true`}),s(`config:configPage.noImportableCodexOrClaudeProviderConfigurationWasDetected`)]}),(n||f.length>0||d.some(e=>e.warnings?.some(e=>e.code!==`login_auth_not_imported`)))&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1 text-xs text-danger [&_span]:flex [&_span]:items-center [&_span]:gap-1.5`,"aria-live":`polite`,children:[n&&(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Ee,{size:13}),n]}),f.map((e,t)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Ee,{size:13}),ha(e),` · `,g(e)]},`${e.source}-${e.code}-${t}`)),d.flatMap(e=>(e.warnings||[]).filter(e=>e.code!==`login_auth_not_imported`).map((t,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Ee,{size:13}),ha(e),` · `,_a(t.code,s)]},`${e.id}-${t.code}-${n}`)))]})]})]})}function ya(e){try{return{name:new URL(e).hostname.replace(/^www\./i,``)||`Custom Provider`}}catch{return{name:`Custom Provider`}}}function ba({config:e,providerType:t=`chat`,initialProviderId:n,onClose:r,onConfigChanged:i,onCompleted:a}){let{t:o}=l(),s=n&&e.providers.find(e=>e.id===n)||null,[c,u]=(0,q.useState)(1),[d,p]=(0,q.useState)(s),[m]=(0,q.useState)(oa),[h,g]=(0,q.useState)(``),_=(0,q.useRef)(null),v=(0,q.useRef)(null),[y,S]=(0,q.useState)(s?.baseUrl||``),[C,w]=(0,q.useState)(s?.api||`openai-responses`),[T,D]=(0,q.useState)(``),O=T.trim()||void 0,[k,A]=(0,q.useState)(s?.organization||``),[j,M]=(0,q.useState)(s?.name||``),[ee,N]=(0,q.useState)(s?.models||[]),[P,te]=(0,q.useState)(s?.defaultModel||``),[F,ne]=(0,q.useState)([]),[re,ie]=(0,q.useState)(s?.models.find(e=>e.id===s.defaultModel)?.kind||(t===`visual`?`image`:`chat`)),[I,ae]=(0,q.useState)(!1),[oe,L]=(0,q.useState)(``),[se,ce]=(0,q.useState)(``),le=ya(y),ue=o(t===`visual`?`config:configPage.visualProvider`:`config:configPage.chatProvider`),de=o(c===1?`config:configPage.quickSetupStepBaseUrl`:c===2?`config:configPage.quickSetupStepProtocol`:`config:configPage.quickSetupStepModel`),fe=ee.filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`),pe=()=>{let e=y.trim();try{let t=new URL(e);if(![`http:`,`https:`].includes(t.protocol))throw Error()}catch{L(o(`config:configPage.providerBaseURLMustBeHTTPOrHTTPS`));return}L(``),j.trim()||M(le.name),u(2)},me=()=>{if(!C){L(o(`config:configPage.selectAPIProtocol`));return}L(``),u(3)},he=async()=>{if(I)return;let e=d;if(!O&&!e?.configured&&!h){L(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}ae(!0),L(``),ce(``);try{let n=((await f(`/api/providers/models/discover-connection`,{method:`POST`,body:JSON.stringify({providerId:e?.id||h,providerType:t,api:C,baseUrl:y,organization:k,apiKey:O})})).models||[]).filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`);if(!n.length){L(o(t===`visual`?`config:configPage.fetchOrAddAVisualModel`:`config:configPage.fetchOrAddAChatModel`));return}N(n);let r=n.find(e=>e.id===P)||n[0];te(r.id),ie(t===`visual`?r.kind:`chat`)}catch(n){let r=n instanceof Error?n.message:String(n),i=e?.models.filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`)||[];if(!/\(401\)|\(403\)|鉴权|认证|密钥|API Key/i.test(r)&&i.length){N(i);let e=i.find(e=>e.id===P)||i[0];te(e.id),ie(t===`visual`?e.kind:`chat`),ce(r)}else L(r)}finally{ae(!1)}},ge=async()=>{if(I)return;let e=P.trim()||F[0]||``;if(!e){L(o(`config:configPage.selectModelToFinish`));return}if(!O&&!d?.configured&&!h){L(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}let n=new Set((d?.models||[]).map(e=>e.id)),r=F.filter(t=>t!==e&&!n.has(t));ae(!0),L(``);try{let n=d?.id||h,o=n?await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:n,providerType:t,api:C,baseUrl:y,organization:k,model:e,modelKind:t===`visual`?re:`chat`,apiKey:O,setAsDefault:!1,enabled:!0})}):await f(`/api/providers`,{method:`POST`,body:JSON.stringify({id:m,name:j.trim()||le.name,providerType:t,api:C,baseUrl:y,organization:k,apiKey:O,model:e,modelKind:t===`visual`?re:`chat`,enabled:!0})}),c=n||o.createdProviderId||m,l=s?``:c;l&&g(l);let u=o.providers.find(e=>e.id===c);if(u&&p(u),i?.(l?{...o,createdProviderId:l}:o),r.length){let e=t===`visual`?re:`chat`;try{o=await f(`/api/providers/${encodeURIComponent(c)}/models/batch`,{method:`POST`,body:JSON.stringify({models:r.map(t=>({id:t,kind:e}))})})}catch(e){L(e instanceof Error?e.message:String(e));return}}a(l?{...o,createdProviderId:l}:o)}catch(e){L(e instanceof Error?e.message:String(e))}finally{ae(!1)}};return(0,J.jsx)(Tt,{open:!0,onOpenChange:e=>{!e&&!I&&r()},children:(0,J.jsxs)(xt,{showCloseButton:!1,className:`modal z-[80] block max-h-[calc(100dvh_-_40px)] w-[calc(100%_-_40px)] max-w-lg overflow-y-auto overscroll-contain rounded-[var(--r-lg)] border border-stroke bg-solid p-[18px] shadow-float sm:max-w-lg max-[650px]:max-h-[calc(100dvh_-_16px)] max-[650px]:w-[calc(100%_-_16px)]`,overlayClassName:`z-[70] bg-[var(--modal-overlay)]`,"aria-busy":I,onEscapeKeyDown:e=>{I&&e.preventDefault()},onInteractOutside:e=>{I&&e.preventDefault()},onOpenAutoFocus:e=>{e.preventDefault(),_.current=document.activeElement instanceof HTMLElement?document.activeElement:null,v.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),_.current?.focus()},children:[(0,J.jsxs)(It,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(St,{asChild:!0,children:(0,J.jsx)(`h2`,{children:o(t===`visual`?`config:configPage.visualQuickSetupTitle`:`config:configPage.quickSetupTitle`)})}),(0,J.jsx)(bt,{asChild:!0,children:(0,J.jsxs)(`p`,{children:[o(`config:configPage.stepIndicator`,{current:c,total:3}),` · `,de]})})]}),(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`pointer-coarse:size-11`,"aria-label":o(`config:configPage.closeDialog`),disabled:I,onClick:r,children:(0,J.jsx)(Oe,{size:17})})]}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`mt-3 grid grid-cols-3 gap-1`,children:[1,2,3].map(e=>(0,J.jsx)(`span`,{className:R(`h-1 rounded-full`,e<=c?`bg-star`:`bg-surface-active`)},e))}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5 rounded-md border border-stroke-soft bg-surface-subtle px-2.5 py-2`,children:[(0,J.jsx)(`span`,{className:`grid size-7.5 flex-none place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(xe,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm font-medium text-content`,children:j||le.name}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:ue})]}),(0,J.jsx)(qr,{tone:`gray`,children:ue})]}),c===1&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,J.jsxs)(G,{variant:`control`,children:[`Base URL`,(0,J.jsx)(`input`,{ref:v,value:y,onChange:e=>S(e.target.value),placeholder:`https://api.example.com/v1`,inputMode:`url`})]}),(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-[1.5] text-content-muted`,children:o(`config:configPage.quickSetupBaseUrlHint`)})]}),c===2&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.apiProtocol`),(0,J.jsx)(K,{value:C,onChange:e=>w(e.target.value),children:Ui.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Organization`,(0,J.jsx)(`input`,{value:k,onChange:e=>A(e.target.value),placeholder:o(`config:configPage.optionalUsedOnlyForOpenAIOrganization`)})]})]}),c===3&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[!d&&(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.displayName`),(0,J.jsx)(`input`,{value:j,onChange:e=>M(e.target.value),placeholder:le.name})]}),(0,J.jsx)(sa,{value:T,onChange:D,configured:d?.configured}),(0,J.jsxs)(B,{type:`button`,variant:`secondary`,className:`mt-2.5 w-full max-[650px]:h-11`,disabled:I,onClick:()=>void he(),children:[I?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(_e,{size:14}),o(I?`config:configPage.fetchingModels`:`config:configPage.fetchModels`)]}),se&&(0,J.jsxs)(Nt,{className:`[margin-top:10px]`,children:[(0,J.jsx)(Ee,{size:15}),(0,J.jsx)(`small`,{children:o(`config:configPage.discoverFailedUsingExisting`,{message:se})})]}),fe.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-3.5 mb-2 text-xs leading-[1.5] text-content-muted`,children:o(t===`visual`?`config:configPage.selectVisualModelToFinish`:`config:configPage.selectModelToFinish`)}),(0,J.jsx)(`div`,{className:`flex max-h-[260px] flex-col overflow-y-auto rounded-md border border-stroke`,children:fe.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:R(`relative flex min-h-10 min-w-0 cursor-pointer items-center gap-2 border-b border-stroke-soft px-2.5 py-2 text-left last:border-b-0 hover:bg-surface-subtle pointer-coarse:min-h-11`,P===e.id&&`bg-star-soft before:absolute before:inset-y-2 before:left-0 before:w-[3px] before:rounded-r-[3px] before:bg-star hover:bg-star-soft`),onClick:()=>{te(e.id),ie(t===`visual`?e.kind:`chat`)},children:[(0,J.jsx)(`span`,{className:R(`grid size-4 flex-none place-items-center rounded-full border border-control text-transparent`,P===e.id&&`border-star bg-star text-on-accent`),children:(0,J.jsx)(E,{size:11})}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-content`,children:e.name}),t===`visual`&&(0,J.jsx)(qr,{tone:`gray`,children:e.kind===`video`?o(`config:configPage.visualVideoModel`):o(`config:configPage.visualImageModel`)})]},`${e.id}-${e.kind}`))})]}),(0,J.jsxs)(`div`,{className:`mt-3.5 grid gap-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.manualModelId`),(0,J.jsx)(`input`,{value:P,onChange:e=>te(e.target.value),placeholder:t===`visual`?`gpt-image-1`:`gpt-5.4`})]}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:o(`config:configPage.manualModelIdHint`)}),t===`visual`&&(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.modelType`),(0,J.jsxs)(K,{value:re,onChange:e=>ie(e.target.value),children:[(0,J.jsx)(`option`,{value:`image`,children:o(`config:configPage.imageGenerationAndEditing`)}),(0,J.jsx)(`option`,{value:`video`,children:o(`config:configPage.videoGeneration`)})]})]}),(0,J.jsx)(ca,{ids:F,onChange:ne,primaryId:P,placeholder:t===`visual`?`gpt-image-1`:`gpt-5.5`})]})]}),oe&&(0,J.jsxs)(Pt,{children:[(0,J.jsx)(Ee,{size:13}),oe]}),(0,J.jsxs)(`div`,{className:`mt-[18px] flex justify-between gap-2`,children:[(0,J.jsxs)(B,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:I||c===1,onClick:()=>{L(``),u(c-1)},children:[(0,J.jsx)(b,{size:14}),o(`config:configPage.previousStep`)]}),c===1?(0,J.jsxs)(B,{type:`button`,className:`max-[650px]:h-11`,disabled:I||!y.trim(),onClick:pe,children:[(0,J.jsx)(x,{size:14}),o(`config:configPage.nextStep`)]}):c===2?(0,J.jsxs)(B,{type:`button`,className:`max-[650px]:h-11`,disabled:I,onClick:me,children:[(0,J.jsx)(x,{size:14}),o(`config:configPage.nextStep`)]}):(0,J.jsxs)(B,{type:`button`,className:`max-[650px]:h-11`,disabled:I||!P.trim()&&F.length===0,onClick:()=>void ge(),children:[I?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(E,{size:14}),o(I?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})})}var xa=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],Sa=``;function Ca(e){return`${e.provider.id}/${e.model.id}`}function wa({labelId:e,label:t,hint:n,children:r}){return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-6 gap-y-2 border-b border-stroke py-4 max-[650px]:py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-[min(240px,100%)] flex-1`,children:[(0,J.jsx)(`div`,{id:e,className:`text-sm font-medium text-content`,children:t}),(0,J.jsx)(`p`,{id:`${e}-hint`,className:`mt-0.5 text-xs text-content-muted`,children:n})]}),(0,J.jsx)(`div`,{className:`w-[min(280px,100%)] min-w-0 max-[650px]:w-full`,children:r})]})}function Ta({config:e,notify:t,busy:n,onConfigChanged:r,onSetDefaultModel:i}){let{t:a}=l(),o=(0,q.useId)(),[s,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(``),[p,m]=(0,q.useState)(e.thinkingLevel),[h,g]=(0,q.useState)(e.toolMode);(0,q.useEffect)(()=>{m(e.thinkingLevel),g(e.toolMode)},[e.thinkingLevel,e.toolMode]);let _=(e.fallbackModels||[]).join(`
|
|
2
|
-
`),[v,y]=(0,q.useState)(e.fallbackModels||[]);(0,q.useEffect)(()=>{y(_?_.split(`
|
|
3
|
-
`):[])},[_]);let b=e.defaultProvider||e.provider,x=e.defaultModel||e.model,S=e.providers.find(e=>e.id===b),C=!!(S?.configured&&x),w=e.providers.filter(e=>e.type===`chat`&&e.configured&&e.enabled),T=w.flatMap(e=>e.models.filter(e=>e.kind===`chat`).map(t=>({provider:e,model:t,value:`${e.id}${Sa}${t.id}`}))),E=S&&x?`${S.id}${Sa}${x}`:``,D=async n=>{if(!(!S||!x)){c(!0),d(``);try{r(await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:S.id,providerType:S.type,api:S.api,baseUrl:S.baseUrl||``,organization:S.organization||``,model:x,thinkingLevel:n.thinkingLevel??e.thinkingLevel,toolMode:n.toolMode??e.toolMode,setAsDefault:!1})})),t(a(`config:configPage.runtimePolicySaved`))}catch(t){m(e.thinkingLevel),g(e.toolMode),d(t instanceof Error?t.message:String(t))}finally{c(!1)}}},O=!C||s||n,k=async(e,n)=>{let i=[...v];i[e]=n;let o=i.filter((e,t)=>e&&i.indexOf(e)===t),s=v;y(o),c(!0),d(``);try{r(await qi.saveFallbackModels(o)),t(a(`config:providerWorkbench.fallbackModelsSaved`))}catch(e){y(s),d(e instanceof Error?e.message:String(e))}finally{c(!1)}},A=(e,t)=>(0,J.jsxs)(K,{"aria-labelledby":t,className:`w-full max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:!T.length||n||s||e>0&&!v[0],value:v[e]||``,onChange:t=>void k(e,t.target.value),children:[(0,J.jsx)(`option`,{value:``,children:a(`config:providerWorkbench.fallbackNone`)}),v[e]&&!T.some(t=>Ca(t)===v[e])&&(0,J.jsx)(`option`,{value:v[e],children:v[e]}),T.map(e=>(0,J.jsx)(`option`,{value:Ca(e),children:`${e.model.name||e.model.id} · ${e.provider.name}`},e.value))]});return(0,J.jsxs)(`section`,{"data-config-card":`models-current-model`,"aria-labelledby":`${o}-heading`,"aria-busy":s||void 0,className:`mt-6 min-w-0`,children:[(0,J.jsx)(`h2`,{id:`${o}-heading`,className:`sr-only`,children:a(`config:configPage.currentChatModel`)}),(0,J.jsxs)(`div`,{"data-config-target":`models-runtime-policy`,className:`border-t border-stroke`,children:[(0,J.jsx)(wa,{labelId:`${o}-model`,label:a(`config:providerWorkbench.defaultModel`),hint:a(`config:providerWorkbench.defaultModelHint`),children:(0,J.jsxs)(K,{"aria-labelledby":`${o}-model`,className:`w-full max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:!T.length||n||s,value:T.some(e=>e.value===E)?E:``,onChange:e=>{let[t,n]=e.target.value.split(Sa),r=w.find(e=>e.id===t);r&&n&&i(r,n)},children:[!T.length&&(0,J.jsx)(`option`,{value:``,children:a(`config:providerWorkbench.noChatModel`)}),T.map(({provider:e,model:t,value:n})=>(0,J.jsx)(`option`,{value:n,children:`${t.name||t.id} · ${e.name}`},n))]})}),(0,J.jsx)(wa,{labelId:`${o}-fallback`,label:a(`config:providerWorkbench.fallbackModels`),hint:a(`config:providerWorkbench.fallbackModelsHint`),children:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(`span`,{id:`${o}-fallback-1`,className:`sr-only`,children:a(`config:providerWorkbench.fallbackFirst`)}),A(0,`${o}-fallback ${o}-fallback-1`),(0,J.jsx)(`span`,{id:`${o}-fallback-2`,className:`sr-only`,children:a(`config:providerWorkbench.fallbackSecond`)}),A(1,`${o}-fallback ${o}-fallback-2`)]})}),(0,J.jsx)(wa,{labelId:`${o}-thinking`,label:a(`config:configPage.thinkingLevel`),hint:a(`config:providerWorkbench.thinkingHint`),children:(0,J.jsx)(K,{"aria-labelledby":`${o}-thinking`,className:`w-full font-mono max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:O,value:p,onChange:e=>{m(e.target.value),D({thinkingLevel:e.target.value})},children:xa.map(e=>(0,J.jsx)(`option`,{children:e},e))})}),(0,J.jsx)(wa,{labelId:`${o}-tools`,label:a(`config:configPage.availableTools`),hint:a(`config:providerWorkbench.toolsHint`),children:(0,J.jsxs)(K,{"aria-labelledby":`${o}-tools`,className:`w-full max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:O,value:h,onChange:e=>{g(e.target.value),D({toolMode:e.target.value})},children:[(0,J.jsx)(`option`,{value:`full`,children:a(`config:configPage.fullToolAccess`)}),(0,J.jsx)(`option`,{value:`custom`,children:a(`config:configPage.customManageEachToolOnThePluginsPage`)})]})})]}),(!C||s)&&(0,J.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,role:`status`,children:[s&&(0,J.jsx)(z,{className:`size-3`}),a(s?`config:configPage.saving`:`config:providerWorkbench.defaultsNeedProvider`)]}),u&&(0,J.jsx)(kt,{children:u})]})}function Ea(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).at(-1)||e}function Da({notify:e}){let{t}=l(),n=(0,q.useId)(),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(`allow`),[f,p]=(0,q.useState)(`bash`),[m,h]=(0,q.useState)(``);(0,q.useEffect)(()=>{let e=!0;return y.list().then(t=>e&&i(t.rules)).catch(t=>{e&&(i([]),o(t instanceof Error?t.message:String(t)))}),()=>{e=!1}},[]);let g=async(t,n)=>{c(!0),o(``);try{return i((await t()).rules),e(n),!0}catch(e){return o(e instanceof Error?e.message:String(e)),!1}finally{c(!1)}},_=async()=>{let e=m.trim();e&&await g(()=>y.add({effect:u,tool:f,pattern:e}),t(`config:permissionRules.added`))&&h(``)};return(0,J.jsxs)(`section`,{"aria-labelledby":`${n}-heading`,"data-config-card":`models-permission-rules`,"data-config-target":`models-permission-rules`,className:`mt-6 min-w-0`,children:[(0,J.jsx)(`h2`,{id:`${n}-heading`,className:`text-sm font-medium text-content`,children:t(`config:permissionRules.title`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:t(`config:permissionRules.hint`)}),r===null?(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-xs text-content-muted`,children:[(0,J.jsx)(z,{className:`size-3`}),t(`config:permissionRules.loading`)]}):r.length===0?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-content-muted`,children:t(`config:permissionRules.empty`)}):(0,J.jsx)(`ul`,{className:`mt-3 flex min-w-0 flex-col border-t border-stroke`,children:r.map(e=>(0,J.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 border-b border-stroke py-2 text-[13px]`,children:[(0,J.jsx)(`span`,{className:e.effect===`deny`?`shrink-0 rounded-sm bg-danger-soft px-1.5 text-xs text-danger`:`shrink-0 rounded-sm bg-surface-hover px-1.5 text-xs text-content-secondary`,children:e.effect===`deny`?t(`config:permissionRules.deny`):t(`config:permissionRules.allow`)}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:e.tool===`files`?t(`config:permissionRules.files`):t(`config:permissionRules.command`)}),(0,J.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-content`,title:e.pattern,children:e.pattern}),(0,J.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-xs text-content-muted`,title:e.cwd||void 0,children:e.cwd?Ea(e.cwd):t(`config:permissionRules.global`)}),(0,J.jsx)(B,{variant:`ghost`,size:`icon-xs`,className:`shrink-0 pointer-coarse:size-11`,disabled:s,"aria-label":t(`config:permissionRules.remove`,{pattern:e.pattern}),title:t(`config:permissionRules.remove`,{pattern:e.pattern}),onClick:()=>void g(()=>y.remove(e.id),t(`config:permissionRules.removed`)),children:(0,J.jsx)(Te,{})})]},e.id))}),(0,J.jsxs)(`form`,{className:`mt-3 flex min-w-0 flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,J.jsxs)(K,{"aria-label":t(`config:permissionRules.effectLabel`),className:`w-28 max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:s,value:u,onChange:e=>{let t=e.target.value===`deny`?`deny`:`allow`;d(t),t===`deny`&&p(`bash`)},children:[(0,J.jsx)(`option`,{value:`allow`,children:t(`config:permissionRules.allow`)}),(0,J.jsx)(`option`,{value:`deny`,children:t(`config:permissionRules.deny`)})]}),(0,J.jsxs)(K,{"aria-label":t(`config:permissionRules.toolLabel`),className:`w-32 max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:s||u===`deny`,value:f,onChange:e=>p(e.target.value===`files`?`files`:`bash`),children:[(0,J.jsx)(`option`,{value:`bash`,children:t(`config:permissionRules.command`)}),(0,J.jsx)(`option`,{value:`files`,children:t(`config:permissionRules.files`)})]}),(0,J.jsx)(V,{"aria-label":t(`config:permissionRules.patternLabel`),className:`h-[34px] min-w-[12rem] flex-1 font-mono text-[13px] max-[650px]:h-11`,disabled:s,maxLength:200,placeholder:t(f===`files`?`config:permissionRules.filesPlaceholder`:`config:permissionRules.commandPlaceholder`),value:m,onChange:e=>h(e.target.value)}),(0,J.jsxs)(B,{type:`submit`,variant:`secondary`,disabled:s||!m.trim(),className:`max-[650px]:min-h-11`,children:[s&&(0,J.jsx)(z,{className:`size-3`}),t(`config:permissionRules.add`)]})]}),a&&(0,J.jsx)(kt,{children:a})]})}function Oa(e){return e instanceof Error?e.message:String(e)}function ka({notify:e,requestConfirm:t,t:n}){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!0),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(``),[g,_]=(0,q.useState)(``),v=(0,q.useRef)(0),y=(0,q.useRef)(!1);(0,q.useEffect)(()=>{let e=!0;y.current=!0;let t=v.current;return f(`/api/config`).then(n=>{if(e)return v.current===t&&i(n),o(!1),f(`/api/providers/models/refresh`,{method:`POST`,body:`{}`})}).then(n=>{!e||v.current!==t||!n?.config||i(n.config)}).catch(n=>{!e||v.current!==t||(c(Oa(n)),o(!1))}),()=>{e=!1,y.current=!1,v.current+=1}},[]);let b=(0,q.useCallback)(e=>{v.current+=1,i(e),o(!1),c(``)},[]),x=(0,q.useCallback)(async()=>{let e=v.current,t=await f(`/api/config`);y.current&&v.current===e&&b(t)},[b]),S=(0,q.useCallback)(async(t,r)=>{u(t.id),c(``);try{let i=await f(`/api/providers/${encodeURIComponent(t.id)}/enabled`,{method:`PUT`,body:JSON.stringify({enabled:r})});b(i),e(n(`config:configPage.nameState`,{name:t.name,state:n(r?`config:configPage.enabled`:`config:configPage.disabled`)}))}catch(e){c(Oa(e))}finally{u(``)}},[b,e,n]),C=(0,q.useCallback)(async t=>{p(t.id),c(``);try{let r=await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:t.id,setAsDefault:!0})});b(r),e(n(`config:configPage.defaultProviderUpdated`,{name:t.name}))}catch(e){c(Oa(e))}finally{p(``)}},[b,e,n]),w=(0,q.useCallback)(async(t,r)=>{h(t.id),c(``);try{let i=await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:t.id,model:r,setAsDefault:!1})});b(i),e(n(`config:configPage.providerConnectionUpdated`))}catch(e){c(Oa(e))}finally{h(``)}},[b,e,n]),T=(0,q.useCallback)(async(t,r)=>{p(t.id),c(``);try{let i=await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:t.id,model:r,setAsDefault:!1})});(i.defaultProvider||i.provider)!==t.id&&(i=await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:t.id,setAsDefault:!0})})),b(i),e(n(`config:configPage.defaultProviderUpdated`,{name:t.name}))}catch(e){c(Oa(e))}finally{p(``)}},[b,e,n]),E=(0,q.useCallback)(async()=>{o(!0),c(``);let e=v.current;try{let t=await f(`/api/config`);y.current&&v.current===e&&b(t)}catch(e){y.current&&c(Oa(e))}finally{y.current&&o(!1)}},[b]),D=(0,q.useCallback)(async(r,i)=>{if(await t({title:n(`providers:modelEditor.delete`),message:n(`providers:modelEditor.deleteConfirmation`,{name:i.name||i.id}),confirmLabel:n(`config:configPage.delete`)})){_(`${r.id}/${i.id}`),c(``);try{b(await qi.deleteModel(r.id,i.id)),e(n(`providers:modelEditor.deleted`))}catch(e){c(Oa(e))}finally{_(``)}}},[b,e,t,n]);return{config:r,loading:a,error:s,toggling:l,settingDefault:d,settingModel:m,deletingModel:g,applyConfig:b,refreshConfig:x,setDefaultProvider:C,setDefaultChatModel:T,setProviderDefaultModel:w,reload:E,toggleProvider:S,deleteProvider:(0,q.useCallback)(async r=>{if(await t({title:n(`config:configPage.deleteProviderConnection`),message:n(`config:configPage.deleteNameItsModelSettingsAndAuthenticationDetailsWillAlsoBeRemoved`,{name:r.name}),confirmLabel:n(`config:configPage.delete`)})){c(``);try{let t=await f(`/api/providers/${encodeURIComponent(r.id)}`,{method:`DELETE`});b(t),e(n(`config:configPage.providerConnectionDeleted`))}catch(e){c(Oa(e))}}},[b,e,t,n]),deleteModel:D}}function Aa({requestConfirm:e,onImported:t,onAutoImported:n,t:r}){let[i,a]=(0,q.useState)({providers:[],errors:[]}),[o,s]=(0,q.useState)(!0),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)({imported:0,skipped:0}),_=(0,q.useRef)(0),v=(0,q.useRef)(n);v.current=n;let y=(0,q.useCallback)(async()=>{let e=++_.current;s(!0),l(``);try{let t=await qi.importLocal();if(e!==_.current)return;a(t.discovery),g({imported:t.imported.length,skipped:t.skipped.length}),t.imported.length&&await v.current()}catch(t){e===_.current&&l(Oa(t))}finally{e===_.current&&s(!1)}},[]);return(0,q.useEffect)(()=>(y(),()=>{_.current+=1}),[y]),{discovery:i,autoImport:h,discovering:o,error:c,operationError:u,importing:p,refresh:y,importProvider:(0,q.useCallback)(async n=>{let i=n.source===`codex-config`?`Codex config.toml`:n.source===`claude-config`?`Claude settings.json`:n.source===`codex-auth`?`Codex login`:`Claude login`,o=n.kind===`authentication`;if(await e({title:r(o?`config:configPage.loadLoginState`:`config:configPage.loadProviderConfiguration`),message:r(o?`config:configPage.loadOfficialProviderLoginStateFromSource`:`config:configPage.loadThisProviderConfigurationFromSource`,{source:i}),confirmLabel:r(o?`config:configPage.loadLoginState`:`config:configPage.loadConfiguration`)})){m(n.id),d(``);try{let e=await f(`/api/providers/${encodeURIComponent(n.id)}/import`,{method:`POST`,body:`{}`});a(e.discovery),t(e)}catch(e){d(Oa(e))}finally{m(``)}}},[t,e,r])}}function ja({providers:e,defaultProviderId:t=``,toggling:n,settingDefault:r=``,settingModel:i=``,onConfigure:a,onClone:o,onSetDefault:s,onSetDefaultModel:c,onToggle:u,onDelete:d}){let{t:f}=l(),p=e.filter(e=>e.configured||e.custom);return(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:p.map(e=>{let l=Ki[e.id]||xe,p=e.id===t,m=e.configured?e.enabled?f(`config:configPage.authenticationReady`):f(`config:configPage.disabled2`):e.id===`openai-codex`?f(`config:configPage.codexCLILoginRequired`):f(`config:configPage.apiKeyRequired`);return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-stroke bg-panel px-3 py-2.5`,children:[(0,J.jsxs)(`button`,{type:`button`,title:f(`config:configPage.configure`),className:`flex min-h-9 min-w-0 cursor-pointer items-center gap-2.5 rounded-sm border-0 bg-transparent p-0 text-left text-content hover:text-accent-fg`,onClick:()=>a(e),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7.5 flex-none place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(l,{size:15})}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:e.name}),p&&(0,J.jsx)(Mt,{variant:`accent`,children:f(`config:configPage.defaultBadge`)})]}),c&&e.models.some(e=>e.kind===`chat`)?(0,J.jsxs)(`label`,{className:`grid min-w-0 gap-1 text-xs text-content-muted`,children:[f(`config:configPage.providerDefaultModel`),(0,J.jsxs)(K,{"aria-label":`${f(`config:configPage.providerDefaultModel`)}: ${e.name}`,value:e.defaultModel||``,disabled:!!(i||r),onChange:t=>void c(e,t.target.value),children:[!e.models.some(t=>t.kind===`chat`&&t.id===e.defaultModel)&&(0,J.jsx)(`option`,{value:e.defaultModel||``,disabled:!0,children:e.defaultModel||f(`config:configPage.selectModel`)}),e.models.filter(e=>e.kind===`chat`).map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}):e.defaultModel?(0,J.jsxs)(`small`,{className:`truncate font-mono text-xs text-content-muted`,title:e.defaultModel,children:[f(`config:configPage.providerDefaultModel`),`: `,e.defaultModel]}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:m}),(0,J.jsxs)(`div`,{className:`flex flex-none items-center gap-1.5`,children:[s&&(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 pointer-coarse:size-11`,title:f(`config:configPage.setAsDefaultProvider`),"aria-label":f(`config:configPage.setAsDefaultProvider`),"aria-pressed":p,disabled:p||!e.configured||!e.enabled||!e.defaultModel||!!(r||i),onClick:()=>void s(e),children:(0,J.jsx)(Cn,{size:13})}),(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 pointer-coarse:size-11`,title:f(`config:configPage.cloneProvider`),"aria-label":f(`config:configPage.cloneProvider`),onClick:()=>o(e),children:(0,J.jsx)(re,{size:13})}),(0,J.jsx)(Jr,{ariaLabel:f(`config:configPage.providerEnabled`,{name:e.name}),value:e.configured&&e.enabled,disabled:!e.configured||n===e.id,onChange:t=>u(e,t)}),e.custom&&(0,J.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 hover:bg-danger-soft hover:text-danger pointer-coarse:size-11`,title:f(`config:configPage.deleteProvider`),"aria-label":f(`config:configPage.deleteProvider`),onClick:()=>void d(e),children:(0,J.jsx)(Te,{size:13})})]})]})]},e.id)})})}var Ma=`pisper.config.visualConnectionsOpen`,$={running:null,result:null,error:``};function Na(){return r.getItem(Ma)===`1`}function Pa({config:e,notify:t,toggling:n,onToggleProvider:i,onDeleteProvider:a,onCloneProvider:o,onQuickSetup:s,onEditVisualProvider:c}){let{t:u}=l(),[d,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(!0),[g,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(Na),O=(0,q.useCallback)(async()=>{try{p(await f(`/api/visual/models`)),C(``)}catch(e){C(e instanceof Error?e.message:String(e))}finally{h(!1)}},[]);(0,q.useEffect)(()=>{O()},[O,e]),(0,q.useEffect)(()=>{$.result&&x($.result),$.error&&C($.error);let e=$.running;if(!e)return;y(!0);let t=!0;return e.then(e=>{t&&x(e)}).catch(()=>{t&&C($.error)}).finally(()=>{t&&y(!1)}),()=>{t=!1}},[]);let k=async(e,n)=>{_(e),C(``);try{p(await f(`/api/visual/models/${e}`,{method:`PUT`,body:JSON.stringify({model:n})})),t(u(`config:configPage.visualModelUpdated`))}catch(e){C(e instanceof Error?e.message:String(e))}finally{_(``)}},A=async()=>{if($.running)return;y(!0),C(``),x(null),$.result=null,$.error=``;let e=f(`/api/visual/test`,{method:`POST`,body:`{}`,timeout:21e4});$.running=e;try{let n=await e;$.result=n,x(n),t(u(`config:configPage.testSucceeded`))}catch(e){let n=e instanceof Error?e.message:String(e);$.error=n,C(n),t(n)}finally{$.running=null,y(!1)}},j=e=>{T(e),r.setItem(Ma,e?`1`:`0`)},M=e.providers.filter(e=>e.type===`visual`),ee=M.filter(e=>e.configured||e.custom),N=d?.imageModels||[],P=d?.videoModels||[];return(0,J.jsxs)(`section`,{className:`mt-3`,children:[(0,J.jsxs)(Gr,{className:`mb-3 py-3.5`,"data-config-card":`models-visual`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:R(`grid size-9.5 flex-none place-items-center rounded-lg border border-key-border bg-key shadow-key`,d?.image?`text-accent-fg`:`text-content-muted`),children:(0,J.jsx)(Ce,{size:18})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:u(`config:configPage.currentVisualModel`)}),m?(0,J.jsxs)(`span`,{role:`status`,className:`flex items-center gap-2 text-xs text-content-muted`,children:[(0,J.jsx)(z,{className:`size-3.5`}),u(`config:configPage.loadingVisualStatus`)]}):d?.image?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`truncate text-sm font-medium text-content`,children:[d.image.providerName,` / `,d.image.name]}),(0,J.jsxs)(qr,{tone:`green`,children:[(0,J.jsx)(F,{size:11,className:`mr-[3px] inline`}),u(`config:configPage.authenticationReady`)]})]}),d.video&&(0,J.jsxs)(`small`,{className:`text-xs text-content-muted [overflow-wrap:anywhere]`,children:[u(`config:configPage.visualVideoModel`),`:`,d.video.providerName,` /`,` `,d.video.name]})]}):(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium text-warning-strong`,children:[(0,J.jsx)(te,{size:14,"aria-hidden":`true`}),u(`config:configPage.visualNoneConfigured`)]}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:u(`config:configPage.visualEmptyHint`)})]})]}),(0,J.jsxs)(`div`,{className:`flex w-full max-w-full min-w-0 flex-none flex-wrap items-center gap-2 sm:w-auto`,children:[d?.image&&(0,J.jsxs)(B,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:v,onClick:()=>void A(),children:[v?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(oe,{size:13}),u(v?`config:configPage.testingGeneration`:`config:configPage.testGeneration`)]}),(0,J.jsxs)(B,{className:`max-[650px]:h-11`,onClick:s,children:[(0,J.jsx)(L,{size:13}),u(`config:configPage.visualQuickSetup`)]})]})]}),b&&(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5 rounded-sm border border-stroke-soft bg-surface-subtle px-2.5 py-2`,children:[b.previewDataUrl?(0,J.jsx)(`img`,{src:b.previewDataUrl,alt:b.modelName,className:`size-11 flex-none rounded-xs object-cover`}):(0,J.jsx)(E,{size:16,className:`flex-none text-success`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-px text-xs`,children:[(0,J.jsx)(`span`,{className:`font-medium text-success-strong`,children:u(`config:configPage.testSucceeded`)}),(0,J.jsxs)(`span`,{className:`truncate font-mono text-content-muted`,children:[b.providerName,` / `,b.modelName,` · `,b.path]})]})]})]}),(0,J.jsxs)(He,{open:w,onOpenChange:j,children:[(0,J.jsx)(Ve,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group flex min-h-9 w-full cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent px-0.5 text-left max-[650px]:min-h-11`,children:[(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:`flex-none text-content-muted transition-transform group-data-[state=closed]:-rotate-90`}),(0,J.jsx)(`span`,{className:`shrink-0 text-sm font-medium text-content`,children:u(`config:configPage.visualConnections`)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted`,children:u(`config:configPage.visualConnectionsHint`)})]})}),(0,J.jsx)(Be,{children:(0,J.jsxs)(Gr,{className:`mt-2 py-4`,children:[(0,J.jsx)(ja,{providers:M,toggling:n,onClone:o,onConfigure:e=>c(e.id),onToggle:i,onDelete:a}),ee.length===0&&(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:u(`config:configPage.visualEmptyHint`)}),(N.length>0||P.length>0)&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 border-t border-stroke-soft pt-3`,children:[N.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-16 flex-none text-xs text-content-muted`,children:u(`config:configPage.visualImageModel`)}),(0,J.jsxs)(K,{className:`min-w-0 flex-1`,value:d?.imageSelection||``,disabled:g===`image`,"aria-label":u(`config:configPage.visualImageModel`),onChange:e=>void k(`image`,e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:u(`config:configPage.visualAutoSelected`)}),N.map(e=>(0,J.jsxs)(`option`,{value:`${e.providerId}/${e.id}`,children:[e.providerName,` · `,e.name]},`${e.providerId}/${e.id}`))]})]}),P.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-16 flex-none text-xs text-content-muted`,children:u(`config:configPage.visualVideoModel`)}),(0,J.jsxs)(K,{className:`min-w-0 flex-1`,value:d?.videoSelection||``,disabled:g===`video`,"aria-label":u(`config:configPage.visualVideoModel`),onChange:e=>void k(`video`,e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:u(`config:configPage.visualAutoSelected`)}),P.map(e=>(0,J.jsxs)(`option`,{value:`${e.providerId}/${e.id}`,children:[e.providerName,` · `,e.name]},`${e.providerId}/${e.id}`))]})]}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:u(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]})]})})]}),S&&(0,J.jsx)(`div`,{className:`mt-2.5`,children:(0,J.jsxs)(Pt,{children:[(0,J.jsx)(Ee,{size:13}),S]})})]})}var Fa=`pisper.config.manageConnectionsOpen`;function Ia(){let e=r.getItem(Fa);return e===`1`||e!==`0`&&null}function La({defaultAdvancedExpanded:e=!1,navigationKey:n,notify:i,registerPrimaryAction:a,requestConfirm:o}){let{t:s}=l(),c=t(),u=new URLSearchParams(c.search).get(`import`)===`1`,[d,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(()=>u||e?!0:Ia());(0,q.useEffect)(()=>{u&&v(!0)},[u]),(0,q.useEffect)(()=>{e&&v(!0)},[e,n]);let y=ka({notify:i,requestConfirm:o,t:s}),{config:b}=y,x=Aa({requestConfirm:o,onAutoImported:y.refreshConfig,onImported:e=>{y.applyConfig(e.config);let t=e.config.providers.find(t=>t.id===e.providerId);i(e.kind===`authentication`?s(`config:configPage.nameLoginStateHasBeenLoadedIntoPisper`,{name:t?.name||e.providerId}):s(`config:configPage.nameConfigurationHasBeenLoadedIntoPisper`,{name:t?.name||e.providerId}))},t:s});if(Vt(a,()=>m({providerType:`chat`})),!b)return y.error&&!y.loading?(0,J.jsx)(_t,{kind:`error`,title:s(`config:providerWorkbench.loadFailed`),description:y.error,action:(0,J.jsx)(B,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void y.reload(),children:s(`common:pageTemplate.retry`)})}):(0,J.jsx)(_t,{kind:`loading`,title:s(`config:configPage.loadingModelCatalog`),description:s(`config:configPage.readingProvidersAndAuthenticationStatus`)});let S=_??!1,C=da(x.discovery),w=e=>{v(e),r.setItem(Fa,e?`1`:`0`)},T=e=>g(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ta,{config:b,notify:i,busy:!!(y.settingDefault||y.toggling),onConfigChanged:y.applyConfig,onSetDefaultModel:y.setDefaultChatModel}),(0,J.jsx)(Da,{notify:i}),(0,J.jsx)(aa,{config:b,selectedProviderId:d,onSelectProvider:f,toggling:y.toggling,settingDefault:y.settingDefault,settingModel:y.settingModel,onSave:e=>{y.applyConfig(e),i(s(`config:configPage.providerConnectionUpdated`))},onClone:T,onDelete:y.deleteProvider,deletingModel:y.deletingModel,onDeleteModel:y.deleteModel,onToggle:y.toggleProvider,onSetDefault:y.setDefaultProvider,onSetDefaultModel:y.setProviderDefaultModel,onAddConnection:()=>m({providerType:`chat`}),meta:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,role:`status`,children:[x.discovering&&(0,J.jsx)(z,{className:`size-3`}),x.discovering?s(`config:providerWorkbench.scanningLocal`):s(`config:providerWorkbench.localImportStatus`,{imported:x.autoImport.imported,skipped:x.autoImport.skipped})]})}),y.error&&(0,J.jsx)(kt,{children:y.error}),C>0&&(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-2 gap-y-0 text-xs text-content-muted`,children:[(0,J.jsx)(`span`,{children:s(`config:configPage.localProviderImportHint`,{count:C})}),(0,J.jsx)(B,{type:`button`,variant:`link`,size:`sm`,className:`h-auto min-h-11 shrink-0 px-1 py-0 font-medium sm:min-h-8`,"aria-expanded":S,"aria-controls":`model-connection-management`,onClick:()=>w(!0),children:s(`config:configPage.reviewLocalProviders`)})]}),(0,J.jsxs)(He,{open:S,onOpenChange:w,"data-config-card":`models-advanced`,children:[(0,J.jsx)(Ve,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group mt-6 mb-3 flex min-h-9 w-full cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent px-0.5 text-left max-[650px]:min-h-11`,children:[(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:`shrink-0 text-content-muted transition-transform group-data-[state=closed]:-rotate-90`}),(0,J.jsx)(`span`,{className:`shrink-0 text-sm font-medium text-content`,children:s(`config:providerWorkbench.advanced`)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted`,children:s(`config:providerWorkbench.advancedHint`)})]})}),(0,J.jsxs)(Be,{id:`model-connection-management`,children:[(0,J.jsx)(va,{discovery:x.discovery,discovering:x.discovering,error:x.error||x.operationError,importing:x.importing,forceVisible:u,onRefresh:x.refresh,onImport:x.importProvider}),(0,J.jsx)(Pa,{config:b,notify:i,toggling:y.toggling,onToggleProvider:y.toggleProvider,onCloneProvider:T,onDeleteProvider:y.deleteProvider,onQuickSetup:()=>m({providerType:`visual`}),onEditVisualProvider:e=>{let t=b.providers.find(t=>t.id===e);t&&(f(t.id),requestAnimationFrame(()=>document.querySelector(`[data-provider-row="${CSS.escape(t.id)}"]`)?.scrollIntoView({block:`start`,behavior:`smooth`})))}})]})]}),p&&(0,J.jsx)(ba,{config:b,providerType:p.providerType||`chat`,initialProviderId:p.providerId,onConfigChanged:e=>{y.applyConfig(e),e.createdProviderId&&f(e.createdProviderId)},onClose:()=>m(null),onCompleted:e=>{y.applyConfig(e),e.createdProviderId&&f(e.createdProviderId),i(s(`config:configPage.setupComplete`)),m(null)}}),h&&(0,J.jsx)(ua,{initialProviderType:h.type,cloneProvider:h,onClose:()=>g(null),onCreated:e=>{y.applyConfig(e),e.createdProviderId&&f(e.createdProviderId),i(s(`config:configPage.providerConnectionCreated`)),g(null)}})]})}var Ra=[`browser`,`feishu`,`weixin`,`qq`,`telegram`];function za(e){if(!e||typeof e!=`object`||Array.isArray(e))throw d();return e}function Ba(e,t){if(typeof e!=`string`||e.length>t)throw d();return e}function Va(e){let t=za(e),n=za(t.browser);if(typeof n.enabled!=`boolean`||!Array.isArray(t.templates)||!Array.isArray(t.scopes))throw d();let r={},i=za(t.connections);for(let e of Ra){if(e===`browser`||i[e]===void 0)continue;let t=i[e];if(t===null){r[e]=null;continue}let n=za(t);if(n.enabled!==void 0&&typeof n.enabled!=`boolean`||n.status!==void 0&&typeof n.status!=`string`)throw d();r[e]={...n,enabled:n.enabled,status:n.status}}let a=new Set,o=t.templates.map(e=>{let t=za(e),n=Ba(t.id,200);if(!n||a.has(n)||typeof t.enabled!=`boolean`||!Array.isArray(t.variables))throw d();a.add(n);let r={},i=za(t.channels);for(let e of Ra){if(i[e]===void 0)continue;let t=za(i[e]);if(t.enabled!==void 0&&typeof t.enabled!=`boolean`)throw d();r[e]={content:Ba(t.content,12e3),...t.enabled===void 0?{}:{enabled:t.enabled}}}return{id:n,name:Ba(t.name,500),description:Ba(t.description,2e3),enabled:t.enabled,variables:t.variables.map(e=>Ba(e,200)),channels:r}}),s=t.scopes.map(e=>{let t=za(e);if(!Ra.includes(t.platform))throw d();return{...t,platform:t.platform}});return{browser:{enabled:n.enabled},connections:r,scopes:s,templates:o}}function Ha(e){let t=za(e);if(typeof t.sent!=`number`||!Number.isInteger(t.sent)||t.sent<0)throw d();return{sent:t.sent,...t.title===void 0?{}:{title:Ba(t.title,2e3)},...t.body===void 0?{}:{body:Ba(t.body,12e3)},...t.preview===void 0?{}:{preview:Ba(t.preview,12e3)}}}function Ua(e){return e.templates.length>0&&e.templates.every(e=>Ra.every(t=>typeof e.channels[t]?.enabled==`boolean`))}var Wa=(e,t)=>`/api/settings/notifications/templates/${encodeURIComponent(e)}/${t}`,Ga=(e,t,n,r)=>u(Wa(e,t),{method:`PUT`,body:n,...r,parse:Va}),Ka={load:(e={})=>u(`/api/settings/notifications`,{...e,parse:Va}),setBrowserEnabled:(e,t={})=>u(`/api/settings/notifications/browser`,{method:`PATCH`,body:{enabled:e},...t,parse:Va}),setEventEnabled:(e,t,n={})=>Ga(e,`browser`,{enabled:t},n),setChannelEnabled:async(e,t,n,r={})=>{let i=await Ga(e,t,{channelEnabled:n},r);if(i.templates.find(t=>t.id===e)?.channels[t]?.enabled!==n)throw d();return i},saveTemplate:(e,t,n,r={})=>Ga(e,t,{content:n},r),testSavedTemplate:(e,t,n={})=>u(`${Wa(e,t)}/test`,{method:`POST`,body:{},...n,parse:Ha})},qa=e=>e instanceof Error?e.message:String(e),Ja=(e,t)=>`${e}\0${t}`,Ya=e=>e.kind===`browser`?`browser`:e.kind===`event`?`event:${e.event}`:`channel:${e.event}:${e.platform}`;function Xa(e,t){if(t.kind===`browser`)return e.browser.enabled;let n=e.templates.find(e=>e.id===t.event);return t.kind===`event`?n?.enabled===!0:n?.channels[t.platform]?.enabled!==!1}function Za(e,t,n){return t.kind===`browser`?{...e,browser:{enabled:n}}:{...e,templates:e.templates.map(e=>e.id===t.event?t.kind===`event`?{...e,enabled:n}:{...e,channels:{...e.channels,[t.platform]:{...e.channels[t.platform],enabled:n}}}:e)}}function Qa(e){let[t,n]=(0,q.useState)(null),r=(0,q.useRef)(null),i=(0,q.useRef)(e);i.current=e;let[a,o]=(0,q.useState)(!0),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)({}),[f,p]=(0,q.useState)({}),m=(0,q.useRef)({}),[h,g]=(0,q.useState)({}),[_,v]=(0,q.useState)({}),y=(0,q.useRef)(!1),b=(0,q.useRef)(null),x=(0,q.useRef)(new Map),S=(0,q.useRef)(new Map),C=(0,q.useRef)(new Set),w=(0,q.useRef)(0),T=(0,q.useRef)(0),E=(0,q.useCallback)(e=>{r.current=e,T.current++,n(e),i.current?.(e)},[]),D=(0,q.useCallback)(async()=>{if(!y.current)return;b.current?.abort();let e=new AbortController;b.current=e;let t=T.current;o(!0),c(``);try{let n=await Ka.load({signal:e.signal});y.current&&!e.signal.aborted&&t===T.current&&E(n)}catch(t){y.current&&!e.signal.aborted&&c(qa(t))}finally{y.current&&!e.signal.aborted&&o(!1)}},[E]);(0,q.useEffect)(()=>{y.current=!0,D();let e=x.current,t=S.current;return()=>{y.current=!1,b.current?.abort();for(let t of e.values())t.abort();e.clear(),t.clear()}},[D]);let O=async(e,t)=>{if(!y.current||!r.current)return;let n=Ya(e),i={target:e,value:t,revision:++w.current};if(S.current.set(n,i),u(r=>({...r,[n]:{target:e,value:t,pending:!0,error:``}})),x.current.has(n))return;let a=new AbortController;x.current.set(n,a);try{for(;S.current.has(n)&&y.current&&!a.signal.aborted;){let t=S.current.get(n);S.current.delete(n);try{if(Xa(r.current,e)!==t.value||C.current.has(n)){let i={signal:a.signal},o=e.kind===`browser`?await Ka.setBrowserEnabled(t.value,i):e.kind===`event`?await Ka.setEventEnabled(e.event,t.value,i):await Ka.setChannelEnabled(e.event,e.platform,t.value,i);if(!y.current||a.signal.aborted)return;E(Za(r.current,e,Xa(o,e))),C.current.delete(n)}S.current.has(n)||u(r=>({...r,[n]:{target:e,value:t.value,pending:!1,error:``}}))}catch(r){if(!y.current||a.signal.aborted)return;C.current.add(n),S.current.has(n)||u(i=>({...i,[n]:{target:e,value:t.value,pending:!1,error:qa(r)}}))}}}finally{x.current.get(n)===a&&x.current.delete(n)}},k=t;if(k)for(let e of Object.values(l))e.pending&&(k=Za(k,e.target,e.value));let A=(e,t,n)=>{let r=Ja(e,t),i={...m.current,[r]:{event:e,platform:t,content:n,revision:++w.current}};m.current=i,p(i)},j=(e,n)=>{let r=Ja(e,n),i=t?.templates.find(t=>t.id===e)?.channels[n]?.content||``,a=f[r]?.content??i;return{content:a,dirty:a!==i,save:h[r]||{pending:!1,error:``},test:_[r]||{pending:!1,error:``}}};return{dirty:Object.values(f).some(e=>e.content!==(t?.templates.find(t=>t.id===e.event)?.channels[e.platform]?.content||``)),saving:Object.values(l).some(e=>e.pending)||Object.values(h).some(e=>e.pending),discard:()=>{m.current={},p({})},data:k,confirmed:t,loading:a,loadError:s,load:D,mutations:l,supportsChannels:t?Ua(t):!1,setBrowserEnabled:e=>O({kind:`browser`},e),setEventEnabled:(e,t)=>O({kind:`event`,event:e},t),setChannelEnabled:(e,t,n)=>O({kind:`channel`,event:e,platform:t},n),retryMutation:e=>O(e.target,e.value),draft:j,editDraft:A,saveTemplate:async(e,t)=>{let n=Ja(e,t),i=`content:${n}`,a=m.current[n];if(!y.current||!a||!a.content.trim()||x.current.has(i))return!1;let o=new AbortController;x.current.set(i,o),g(e=>({...e,[n]:{pending:!0,error:``}}));try{let i=await Ka.saveTemplate(e,t,a.content,{signal:o.signal});if(!y.current||o.signal.aborted)return!1;let s=i.templates.find(t=>t.id===e)?.channels[t]?.content;if(s===void 0)throw d();E({...r.current,templates:r.current.templates.map(n=>n.id===e?{...n,channels:{...n.channels,[t]:{...n.channels[t],content:s}}}:n)});let c=m.current[n]?.revision===a.revision;return c&&(m.current={...m.current,[n]:{...a,content:s}},p(m.current)),g(e=>({...e,[n]:{pending:!1,error:``}})),c}catch(e){return y.current&&!o.signal.aborted&&g(t=>({...t,[n]:{pending:!1,error:qa(e)}})),!1}finally{x.current.get(i)===o&&x.current.delete(i)}},testTemplate:async(e,t)=>{let n=Ja(e,t),r=`test:${n}`;if(!y.current||x.current.has(r)||j(e,t).dirty)return;let i=new AbortController;x.current.set(r,i),v(e=>({...e,[n]:{pending:!0,error:``}}));try{let r=await Ka.testSavedTemplate(e,t,{signal:i.signal});return!y.current||i.signal.aborted?void 0:(v(e=>({...e,[n]:{pending:!1,error:``}})),r)}catch(e){y.current&&!i.signal.aborted&&v(t=>({...t,[n]:{pending:!1,error:qa(e)}}))}finally{x.current.get(r)===i&&x.current.delete(r)}}}}function $a(e,t){let n={"chat.title":t(`config:notificationSettings.fixChannelNotification`),"chat.summary":t(`config:notificationSettings.implementationIsCompleteTestsAndBuildHavePassed`),"chat.tool":`bash`,"chat.reason":t(`config:notificationSettings.confirmationIsRequired`),"chat.model":`openai/gpt-5.4`,"task.name":t(`config:notificationSettings.dailyCodeReview`),"task.summary":t(`config:notificationSettings.found2IssuesToAddressTheReportHasBeenArchived`),"task.duration":t(`config:notificationSettings.message2Min18Sec`),"task.nextRun":t(`config:notificationSettings.tomorrow0900`),"task.error":t(`config:notificationSettings.testProcessTimedOut`),"workflow.name":t(`config:notificationSettings.preReleaseChecks`),"workflow.summary":t(`config:notificationSettings.testsBuildAndSecurityChecksHaveAllPassed`),"workflow.duration":t(`config:notificationSettings.message6Min42Sec`),"workflow.runId":`run_20260718_001`,"workflow.node":t(`config:notificationSettings.endToEndTests`),"workflow.error":t(`config:notificationSettings.browserFailedToStart`)};return String(e||``).replace(/\{\{\s*([\w.]+)\s*\}\}/g,(e,t)=>n[t]||`{{${t}}}`)}function eo({settings:e,templates:t,eventId:n,platform:r,onSelectionChange:i,platformLabel:a,permissionGranted:o,onBrowserTest:s,notify:c}){let{t:u}=l(),d=(0,q.useRef)(!0),[f,p]=(0,q.useState)(``);(0,q.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let m=t.find(e=>e.id===n)||t[0];if(!m||!e.data)return(0,J.jsx)(`p`,{role:`status`,children:u(`config:notificationSettings.noNotificationEvents`)});let h=e.draft(m.id,r),g=r===`browser`?null:e.data.connections[r],_=r===`browser`?e.confirmed?.browser.enabled===!0&&!e.mutations.browser?.pending&&o:g?.enabled===!0&&e.data.scopes.some(e=>e.platform===r),v=async()=>{p(``);let t=await e.testTemplate(m.id,r);if(!(!t||!d.current))try{r===`browser`&&await s(t.title||m.name,t.body||t.preview||``,`pisper-template-${m.id}`),d.current&&c(r===`browser`?u(`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`):u(`config:notificationSettings.testNotificationSentToCountChats`,{count:t.sent}))}catch(e){d.current&&p(e instanceof Error?e.message:String(e))}};return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`h2`,{className:`text-[15px] leading-6 font-medium text-content`,children:u(`config:notificationSettings.notificationTemplates`)}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-content`,children:[u(`config:notificationSettings.notificationEvent`),(0,J.jsx)(K,{"aria-label":u(`config:notificationSettings.notificationEvent`),value:m.id,onChange:e=>i(e.target.value,r),children:t.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-content`,children:[u(`config:notificationSettings.notificationChannel`),(0,J.jsx)(K,{"aria-label":u(`config:notificationSettings.notificationChannel`),value:r,onChange:e=>{let t=Ra.find(t=>t===e.target.value);t&&i(m.id,t)},children:Ra.map(e=>(0,J.jsx)(`option`,{value:e,children:a(e)},e))})]})]}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:m.description}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-content`,children:[u(`config:notificationSettings.messageContent`),(0,J.jsx)(`textarea`,{"aria-label":u(`config:notificationSettings.messageContent`),value:h.content,onChange:t=>e.editDraft(m.id,r,t.target.value),className:`min-h-36 w-full rounded-sm border border-input bg-panel p-3 font-mono text-[12.5px] leading-[1.65] font-normal caret-focus outline-none focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus-ring`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-content-muted`,children:[(0,J.jsx)(`span`,{children:u(`config:notificationSettings.availableVariables`)}),m.variables.map(e=>(0,J.jsx)(`code`,{className:`rounded-xs bg-inline-code px-1.5 py-0.5 font-mono text-content-secondary`,children:`{{${e}}}`},e))]}),(0,J.jsxs)(`div`,{className:`rounded-md border border-stroke bg-code p-3`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-content-muted`,children:u(`config:notificationSettings.preview`)}),(0,J.jsx)(`pre`,{className:`mt-2 font-sans text-sm break-words whitespace-pre-wrap text-content`,children:$a(h.content,u)})]}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:h.dirty?u(`config:notificationSettings.saveBeforeTest`):u(`config:notificationSettings.testUsesSavedTemplate`)}),!_&&(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-content-muted`,children:u(`config:notificationSettings.channelTestUnavailable`)}),(h.save.error||h.test.error||f)&&(0,J.jsx)(Pt,{children:h.save.error||h.test.error||f}),(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,J.jsx)(B,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:h.dirty||h.save.pending||!_,loading:h.test.pending,onClick:()=>void v(),children:u(`config:notificationSettings.sendTest`)}),(0,J.jsx)(B,{"data-template-save":!0,className:`max-[650px]:h-11`,loading:h.save.pending,disabled:!h.dirty||!h.content.trim(),onClick:async()=>{await e.saveTemplate(m.id,r)&&c(u(`config:notificationSettings.notificationTemplateSaved`))},children:u(`config:notificationSettings.saveTemplate`)})]})]})}function to(e,t){return t(e===`feishu`?`config:notificationSettings.feishu`:e===`weixin`?`config:notificationSettings.weChat`:e===`qq`?`config:notificationSettings.qq`:e===`telegram`?`config:notificationSettings.telegram`:`config:notificationSettings.systemNotificationChannel`)}function no(e,t,n){return e===`chat.completed`?n(`config:notificationSettings.chatCompleted`):e===`chat.waiting`?n(`config:notificationSettings.chatWaiting`):e===`schedule.completed`?n(`config:notificationSettings.scheduleCompleted`):e===`schedule.failed`?n(`config:notificationSettings.scheduleFailed`):e===`workflow.completed`?n(`config:notificationSettings.workflowCompleted`):e===`workflow.failed`?n(`config:notificationSettings.workflowFailed`):t}function ro(e,t,n){return e===`chat.completed`?n(`config:notificationSettings.chatCompletedDescription`):e===`chat.waiting`?n(`config:notificationSettings.chatWaitingDescription`):e===`schedule.completed`?n(`config:notificationSettings.scheduleCompletedDescription`):e===`schedule.failed`?n(`config:notificationSettings.scheduleFailedDescription`):e===`workflow.completed`?n(`config:notificationSettings.workflowCompletedDescription`):e===`workflow.failed`?n(`config:notificationSettings.workflowFailedDescription`):t}function io(){return typeof window<`u`&&window.pisperDesktop?.showNotification?window.pisperDesktop.getNotificationStatus?`checking`:`granted`:typeof window<`u`&&Qt()?`checking`:cn()}function ao(e,t){return t(e===`system-disabled`||e===`app-disabled`?`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`:e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`)}function oo(e){return e instanceof Error?e.message:String(e)}function so({notify:e,onBrowserNotificationChange:t}){let{t:r,language:i}=l(),a=(0,q.useRef)(!1);(0,q.useEffect)(()=>(a.current=!0,()=>{a.current=!1}),[]);let o=Qa(t),{data:s,loading:c,loadError:u}=o,[d,f]=n(),p=!!window.pisperDesktop?.showNotification,m=Qt(),[h,g]=(0,q.useState)(io),_=o.mutations.browser?.pending===!0,v=(0,q.useCallback)(async()=>{if(!p)return;let e=window.pisperDesktop?.getNotificationStatus;if(!e){g(`granted`);return}try{let t=await e();if(!a.current)return;let n=t?.permission;g(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{a.current&&g(`unsupported`)}},[p]);(0,q.useEffect)(()=>{if(!p)return;v();let e=()=>{v()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[p,v]);let y=(0,q.useCallback)(async()=>{if(!(p||!m))try{let e=await Jt();if(!a.current)return;g(e===!0?`granted`:e===!1?`denied`:`default`)}catch{a.current&&g(`unsupported`)}},[p,m]);(0,q.useEffect)(()=>{if(p||!m)return;y();let e=()=>void y();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[p,m,y]);let b=async t=>{let n=``;if(t){if(p&&h!==`granted`)n=ao(`system-disabled`,r);else if(!p&&m){let e=`denied`;try{let t=await Jt()===!0?`granted`:await Xt();e=t===`granted`?`granted`:t===`denied`?`denied`:`default`}catch{e=`unsupported`}if(!a.current)return;g(e),e!==`granted`&&(n=r(`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`))}else if(!p){let e=await sn();if(!a.current)return;if(g(e),e!==`granted`)n=r(e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`);else try{await on()}catch{n=r(`config:notificationSettings.theBrowserBackgroundNotificationServiceCouldNotBeRegistered`)}}}a.current&&(await o.setBrowserEnabled(t),n&&a.current&&e(n,`info`))},x=(0,q.useCallback)(async(e,t,n=`pisper-browser-test`)=>{if(p){let n=window.pisperDesktop?.showNotification;if(!n)throw Error(r(`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`));let i=await n({title:e,body:t});if(i&&typeof i==`object`&&i.shown===!1)throw g(i.permission??`denied`),Error(ao(i.reason,r));return i}return m?(await Ut(e,t),{shown:!0,transport:`tauri`}):an({title:e,body:t,tag:n,url:window.location.href})},[p,m,r]),S=async()=>{if(!(!o.confirmed?.browser.enabled||_)){if(h!==`granted`){e(h===`unsupported`?ao(`unsupported`,r):p?ao(`system-disabled`,r):r(`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`),`error`);return}try{await x(r(`config:notificationSettings.appNotificationTest`,{app:ke}),r(`config:notificationSettings.notificationsAreWorking`)),e(r(`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`),`info`)}catch(t){e(oo(t)||r(`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`),`error`)}}},w=async()=>{try{await window.pisperDesktop?.openNotificationSettings?.()||e(r(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}catch{e(r(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}};if(c)return(0,J.jsxs)(Rt,{children:[(0,J.jsx)(z,{className:`size-6`}),(0,J.jsx)(`h2`,{children:r(`config:notificationSettings.loadingNotificationSettings`)})]});if(!s)return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(Pt,{children:u}),(0,J.jsx)(B,{variant:`outline`,onClick:()=>void o.load(),children:r(`common:pageTemplate.retry`)})]});let T=(e=s.templates[0]?.id||``,t=`browser`)=>{f(n=>{let r=new URLSearchParams(n);return r.set(`view`,`templates`),e&&r.set(`event`,e),r.set(`channel`,t),r})},E=d.get(`view`)===`templates`,D=s.templates.map(e=>({...e,name:no(e.id,e.name,r),description:ro(e.id,e.description,r)}));if(E)return(0,J.jsxs)(`div`,{"data-config-card":`notifications-templates`,className:`space-y-4`,children:[(0,J.jsxs)(B,{variant:`ghost`,className:`-ml-2.5 pointer-coarse:h-11`,onClick:()=>f(e=>{let t=new URLSearchParams(e);return t.delete(`view`),t.delete(`event`),t.delete(`channel`),t}),children:[(0,J.jsx)(O,{size:16,"aria-hidden":`true`}),r(`config:notificationSettings.backToCategories`)]}),(0,J.jsx)(eo,{settings:o,templates:D,eventId:d.get(`event`)||``,platform:Ra.find(e=>e===d.get(`channel`))||`browser`,onSelectionChange:T,platformLabel:e=>to(e,r),permissionGranted:h===`granted`,onBrowserTest:x,notify:e})]});let k=r(h===`granted`?`config:notificationSettings.permissionGranted`:h===`denied`?p?`config:notificationSettings.systemNotificationsAreOff`:`config:notificationSettings.browserNotificationsAreBlocked`:h===`unsupported`?`config:notificationSettings.notSupported`:h===`checking`?`config:notificationSettings.checking`:`config:notificationSettings.waitingForPermission`),A=h===`granted`?`green`:h==="default"?`amber`:`gray`;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[u&&(0,J.jsx)(Pt,{children:u}),Object.entries(o.mutations).filter(([,e])=>e.error).map(([e,t])=>(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(Pt,{children:t.error}),(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>void o.retryMutation(t),children:r(`common:pageTemplate.retry`)})]},e)),(0,J.jsxs)(Gr,{className:`browser-notification-card py-4`,"data-config-card":`notifications-browser`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:R(`grid size-9.5 shrink-0 place-items-center rounded-lg border border-key-border bg-key shadow-key`,s.browser.enabled?`text-accent-fg`:`text-content-muted`),children:s.browser.enabled?(0,J.jsx)(C,{size:18}):(0,J.jsx)(ln,{size:18})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-content`,children:r(`config:notificationSettings.systemNotificationChannel`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-xs leading-[1.45] text-content-muted`,children:r(`config:notificationSettings.pisperUsesTheCurrentPlatformNotificationSystemWhenAnAgentCompletesOrFails`)})]}),(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[(0,J.jsx)(qr,{tone:A,children:k}),(0,J.jsx)(Jr,{ariaLabel:r(`config:notificationSettings.systemNotificationChannel`),value:s.browser.enabled,disabled:_||h===`checking`,onChange:b})]})]}),(0,J.jsxs)(Nt,{children:[(0,J.jsx)(Se,{size:15}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{children:r(p?`config:notificationSettings.controlledByOperatingSystemNotificationSettings`:`config:notificationSettings.controlledByBrowserSitePermissions`)}),(0,J.jsx)(`small`,{children:r(p?`config:notificationSettings.theDesktopAppUsesOperatingSystemNotificationsTurningThisOffDoesNotChangeTheOperatingSystemPermis`:`config:notificationSettings.theWebAppUsesBrowserSiteNotificationsTurningThisOffDoesNotChangeTheBrowserPermissionItself`)})]})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex gap-2 max-[650px]:flex-wrap`,children:[p&&h===`denied`&&(0,J.jsxs)(B,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:w,children:[(0,J.jsx)(Se,{size:14}),r(`config:notificationSettings.openSystemNotificationSettings`)]}),(0,J.jsxs)(B,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:!s.browser.enabled||_||h!==`granted`,onClick:S,children:[(0,J.jsx)(C,{size:14}),r(`config:notificationSettings.sendTestNotification`)]})]})]}),(0,J.jsxs)(Oi,{title:r(`config:notificationSettings.notificationCategories`),description:r(`config:notificationSettings.channelPreferenceHint`),action:(0,J.jsx)(B,{variant:`ghost`,size:`sm`,className:`pointer-coarse:h-11`,onClick:()=>T(),children:r(`config:notificationSettings.editNotificationTemplates`)}),children:[!o.supportsChannels&&(0,J.jsx)(`p`,{role:`status`,className:`py-2 text-sm text-content-muted`,children:r(`config:notificationSettings.channelPreferencesUnsupported`)}),D.length>0&&(0,J.jsx)(Yr,{children:D.map(e=>{let t=e.enabled?Ra.filter(t=>e.channels[t]?.enabled!==!1):[],n=Object.entries(o.mutations).some(([t,n])=>n.pending&&(t===`event:${e.id}`||t.startsWith(`channel:${e.id}:`)));return(0,J.jsx)(ki,{"data-notification-event":e.id,title:e.name,description:e.description,control:(0,J.jsxs)(Ye,{children:[(0,J.jsx)(qe,{asChild:!0,children:(0,J.jsx)(B,{variant:`outline`,size:`sm`,className:`max-w-full font-normal text-content-secondary pointer-coarse:h-11`,"aria-label":r(`config:notificationSettings.eventChannels`,{event:e.name}),"aria-busy":n,children:(0,J.jsx)(`span`,{className:`max-w-64 truncate`,children:t.length?t.map(e=>to(e,r)).join(i===`zh-CN`?`、`:`, `):r(`config:notificationSettings.channelsOff`)})})}),(0,J.jsxs)(Je,{align:`end`,className:`max-w-[calc(100vw-40px)] min-w-56`,children:[(0,J.jsx)(Ke,{checked:e.enabled,onCheckedChange:t=>void o.setEventEnabled(e.id,t===!0),children:r(`config:notificationSettings.enableEvent`)}),(0,J.jsx)(We,{}),Ra.map(t=>{let n=t===`browser`?s.browser.enabled:s.connections[t]?.enabled===!0&&s.scopes.some(e=>e.platform===t);return(0,J.jsxs)(Ke,{checked:e.channels[t]?.enabled!==!1,disabled:!o.supportsChannels,onCheckedChange:n=>void o.setChannelEnabled(e.id,t,n===!0),children:[(0,J.jsx)(`span`,{children:to(t,r)}),!n&&(0,J.jsx)(`small`,{className:`ml-2 text-muted-foreground`,children:r(`config:notificationSettings.channelNeedsSetup`)})]},t)}),(0,J.jsx)(We,{}),(0,J.jsx)(Ge,{onSelect:()=>T(e.id),children:r(`config:notificationSettings.editNotificationTemplates`)})]})]})},e.id)})}),!D.length&&(0,J.jsx)(`p`,{role:`status`,className:`py-3 text-sm text-content-muted`,children:r(`config:notificationSettings.noNotificationEvents`)})]})]})}function co({notify:e}){let{t}=l(),n=window.pisperDesktop,[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``);(0,q.useEffect)(()=>{if(!n?.getCliStatus)return;let e=!0;return n.getCliStatus().then(t=>e&&i(t)).catch(t=>e&&c(t instanceof Error?t.message:String(t))),()=>{e=!1}},[n]);let u=!!(n?.getCliStatus&&n.installCli&&n.uninstallCli),d=async()=>{if(n?.installCli){o(`install`),c(``);try{let r=await n.installCli();i(r),e(t(`config:cliSettings.installedNotification`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(``)}}},f=async()=>{if(n?.uninstallCli){o(`uninstall`),c(``);try{let r=await n.uninstallCli();i(r),e(t(`config:cliSettings.uninstalledNotification`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(``)}}},p=u&&!r,m=u?p?t(`config:cliSettings.checking`):r?.supported?r.needsRepair?t(`config:cliSettings.needsRepair`):r.installed?t(`config:cliSettings.installed`):t(`config:cliSettings.notInstalled`):t(`config:cliSettings.unavailable`):t(`config:cliSettings.unavailable`);return(0,J.jsxs)(W,{"data-config-card":`updates-cli`,title:t(`config:cliSettings.title`),description:t(`config:cliSettings.description`),actions:(0,J.jsx)(`span`,{className:`text-xs text-content-secondary`,children:m}),children:[r&&(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 border-t border-stroke py-3`,children:[r.installed&&!r.needsRepair?(0,J.jsx)(F,{className:`mt-0.5 shrink-0 text-content-muted`,size:16,"aria-hidden":`true`}):(0,J.jsx)(Tn,{className:`mt-0.5 shrink-0 text-content-muted`,size:16,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,J.jsx)(`strong`,{className:`text-sm font-medium text-content`,children:r.installed?t(`config:cliSettings.commandReady`,{command:r.command}):t(`config:cliSettings.commandNotInstalled`,{command:r.command})}),(0,J.jsx)(`small`,{className:`font-mono text-xs [overflow-wrap:anywhere] text-content-muted`,children:r.installPath}),r.installed&&(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:r.pathConfigured?t(`config:cliSettings.pathConfigured`):t(`config:cliSettings.pathNeedsRepair`)})]})]}),s&&(0,J.jsx)(kt,{children:s}),u&&(0,J.jsxs)(`div`,{className:`mt-3 flex gap-2 max-[650px]:flex-wrap`,children:[r?.installed&&(0,J.jsxs)(B,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:!!a,onClick:()=>void f(),children:[a===`uninstall`?(0,J.jsx)(z,{className:`text-current`}):(0,J.jsx)(Te,{size:14}),t(`config:cliSettings.uninstall`)]}),(!r?.installed||r.needsRepair)&&(0,J.jsxs)(B,{type:`button`,className:`max-[650px]:h-11`,disabled:!!a||p||r?.supported===!1,onClick:()=>void d(),children:[a===`install`?(0,J.jsx)(z,{className:`text-current`}):r?.needsRepair?(0,J.jsx)(De,{size:14}):(0,J.jsx)(ie,{size:14}),r?.needsRepair?t(`config:cliSettings.repair`):t(`config:cliSettings.install`)]})]}),u&&(0,J.jsx)(`small`,{className:`mt-2 block text-xs text-content-muted`,children:t(`config:cliSettings.restartTerminal`)})]})}var lo=`0.6.5`;function uo(e,t){return!e.desktop&&!e.mobile?t(`config:updateSettings.browserMode`):`${{win32:`Windows`,darwin:`macOS`,linux:`Linux`,android:`Android`,ios:`iOS`}[e.platform]||e.platform} · ${e.arch}`}function fo(e,t){let n=Number(e)||0;if(!n)return`0 B`;let r=[`B`,`KB`,`MB`,`GB`],i=Math.min(r.length-1,Math.floor(Math.log(n)/Math.log(1024)));return`${(n/1024**i).toLocaleString(t,{maximumFractionDigits:1})} ${r[i]}`}function po({notify:e,update:t}){let{t:n,language:r}=l(),i=t?.info||{desktop:!1,packaged:!1,version:lo,platform:`browser`,arch:``},a=t?.status||{state:`idle`},o=!!i.desktop,s=!!i.mobile,c=o||s,[u,d]=(0,q.useState)({version:lo,date:``,notes:``}),[f,p]=(0,q.useState)(``);(0,q.useEffect)(()=>{let e=!0;return fetch(`/release-notes.json`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(t=>{e&&t&&d(t)}).catch(()=>{}),()=>{e=!1}},[]);let m=async()=>{if(t){p(`check`);try{await t.check()}finally{p(``)}}},h=()=>t?.openReleases(),g=()=>t?.openUpdateLog?.(),_=async()=>{p(o?`install`:``);try{o?await t?.installComponents():await t?.download()}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{p(``)}},v=()=>t?.install(),y=u.version===i.version?u:null,b=a.notes||(c?y?.notes||n(`config:updateSettings.noReleaseNotesAreAvailableForThisVersion`):a.state===`current`?n(`config:updateSettings.theCurrentWebSourceIsSyncedWithBranch`,{branch:a.branch||`release`}):n(`config:updateSettings.commitsThatHaveNotBeenSyncedWillAppearHereAfterTheCheck`)),S=a.state===`available`,C=a.state===`error`&&a.canResume&&a.canDownload,w=a.state===`downloaded`,T=a.state===`checking`||f===`check`,E=a.state===`downloading`||f===`install`,D=T?`checking`:E?`downloading`:a.state,O=c?`v${i.version}`:`v${i.version}${a.currentCommit?` · ${a.currentCommit.slice(0,7)}`:``}`,k=c?`v${a.availableVersion||y?.version||i.version}`:a.availableCommit?.slice(0,7)||a.currentCommit?.slice(0,7)||u.version||i.version,A=(0,q.useMemo)(()=>{let e=new Map(t.components.map(e=>[e.component,e]));return[`desktop`,`tui`,`runtime`].map(t=>e.get(t)||{component:t,state:`idle`,currentVersion:t===`desktop`?i.version:`--`,availableVersion:``,message:``,releaseUrl:``,notes:``,size:0,transferred:0,canInstall:!1,restartRequired:!1})},[i.version,t.components]),j={idle:n(`config:updateSettings.notChecked`),checking:n(`config:updateSettings.checking`),current:n(`config:updateSettings.upToDate`),available:n(c?`config:updateSettings.updateAvailable`:`config:updateSettings.sourceUpdatesAvailable`),downloading:n(`config:updateSettings.downloading`),downloaded:n(`config:updateSettings.readyToRestart`),installed:n(`config:updateSettings.upToDate`),error:n(C?`config:updateSettings.downloadPaused`:`config:updateSettings.checkFailed`)}[D]||n(`config:updateSettings.notChecked`);return(0,J.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col`,children:[(0,J.jsxs)(W,{"data-config-card":`updates-main`,className:`mt-6`,title:n(`config:updateSettings.pisperAppUpdates`),actions:(0,J.jsx)(`span`,{"data-update-status":D,className:`text-xs text-content-secondary tabular-nums`,children:j}),children:[(0,J.jsxs)(`dl`,{className:`grid border-y border-stroke max-sm:divide-y max-sm:divide-stroke-soft sm:grid-cols-3`,children:[(0,J.jsxs)(`div`,{className:`py-3 sm:pr-4`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-content-muted`,children:n(c?`config:updateSettings.currentVersion`:`config:updateSettings.currentSource`)}),(0,J.jsx)(`dd`,{className:`mt-1 font-mono text-[12.5px] font-medium text-content`,children:O})]}),(0,J.jsxs)(`div`,{className:`py-3 sm:border-l sm:border-stroke-soft sm:px-4`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-content-muted`,children:n(`config:updateSettings.platform`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-content`,children:uo(i,n)})]}),(0,J.jsxs)(`div`,{className:`py-3 sm:border-l sm:border-stroke-soft sm:pl-4`,children:[(0,J.jsx)(`dt`,{className:`text-xs text-content-muted`,children:n(`config:updateSettings.updateChannel`)}),(0,J.jsx)(`dd`,{className:`mt-1 font-mono text-[12.5px] font-medium text-content`,children:c?`Stable`:a.branch||`release`})]})]}),a.message&&(a.state===`error`?(0,J.jsx)(kt,{children:a.message}):(0,J.jsxs)(`p`,{className:`mt-4 flex items-start gap-2 text-sm text-content-secondary`,children:[(0,J.jsx)(mn,{className:`mt-0.5 shrink-0 text-content-muted`,size:15,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-0`,children:a.message})]})),C&&(0,J.jsx)(`small`,{className:`mt-2 block text-xs text-content-muted`,children:n(`config:updateSettings.downloadedDataWasPreservedAndCanResumeFromTheInterruptionPoint`)}),E&&(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsxs)(`div`,{className:`flex justify-between text-xs text-content-muted`,children:[(0,J.jsx)(`span`,{children:n(`config:updateSettings.downloadProgress`)}),(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[Math.round(a.percent||0),`% · `,fo(a.transferred,r),` /`,` `,fo(a.total,r)]})]}),(0,J.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-surface-active`,children:(0,J.jsx)(`i`,{className:`block h-full bg-star transition-[width]`,style:{width:`${a.percent||0}%`}})})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsxs)(B,{className:`max-[650px]:h-11`,disabled:T||E||!!f,onClick:w?v:S||C?_:m,children:[T||E?(0,J.jsx)(z,{className:`text-current`}):w?(0,J.jsx)(ve,{size:14}):S||C?a.canDownload?(0,J.jsx)(ie,{size:14}):(0,J.jsx)(ae,{size:14}):(0,J.jsx)(_e,{size:14}),T||E?n(E&&o?`config:updateSettings.installingUpdates`:`config:updateSettings.checking2`):w?n(`config:updateSettings.restartAndInstall`):C?n(`config:updateSettings.resumeDownload`):S?a.canDownload?n(o?`config:updateSettings.downloadAndInstallUpdates`:`config:updateSettings.downloadUpdate`):n(c?`config:updateSettings.viewRelease`:`config:updateSettings.viewSourceUpdates`):n(`config:updateSettings.checkForUpdates`)]}),(0,J.jsxs)(B,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:h,children:[(0,J.jsx)(ae,{size:14}),c?`GitHub Releases`:`GitHub Compare`]}),o&&(0,J.jsxs)(B,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:g,children:[(0,J.jsx)(ae,{size:14}),n(`config:updateSettings.viewUpdateDiagnosticLog`)]})]})]}),!s&&(0,J.jsx)(W,{"data-config-card":`updates-components`,title:n(`config:updateSettings.appComponents`),children:(0,J.jsx)(U,{children:A.map(e=>{let t=e.component===`desktop`?mn:e.component===`tui`?we:fn,i=e.component===`desktop`?n(`config:updateSettings.desktopFrontend`):e.component===`tui`?n(`config:updateSettings.tuiClient`):n(`config:updateSettings.runtime`),a=e.state===`checking`?n(`config:updateSettings.checking`):e.state===`downloading`?n(`config:updateSettings.downloading`):e.state===`available`?n(`config:updateSettings.updateAvailable`):e.state===`installed`?n(`config:updateSettings.installed`):e.state===`error`?n(`config:updateSettings.checkFailed`):e.state===`current`?n(`config:updateSettings.upToDate`):n(`config:updateSettings.notChecked`);return(0,J.jsx)(H,{icon:(0,J.jsx)(t,{}),name:i,description:e.message||void 0,meta:(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono tabular-nums`,children:[(0,J.jsxs)(`span`,{children:[`v`,e.currentVersion]}),e.availableVersion&&e.availableVersion!==e.currentVersion&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(x,{size:12,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[`v`,e.availableVersion]})]}),e.size>0&&e.state===`available`&&(0,J.jsx)(`span`,{className:`font-sans`,children:fo(e.size,r)})]}),status:a},e.component)})})}),!s&&(0,J.jsx)(co,{notify:e}),(0,J.jsx)(W,{title:n(c?S||C||w||E?`config:updateSettings.newVersionReleaseNotes`:`config:updateSettings.currentReleaseNotes`:S?`config:updateSettings.commitsToSync`:`config:updateSettings.currentSourceStatus`),meta:(a.releaseDate||c&&y?.date)&&new Intl.DateTimeFormat(r,{dateStyle:`long`}).format(new Date(a.releaseDate||y?.date||``)),actions:(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-xs text-content-muted`,children:[(0,J.jsx)(F,{size:13,"aria-hidden":`true`}),S||C||w||E?k:c?`v${y?.version||i.version}`:a.currentCommit?.slice(0,7)||n(`config:updateSettings.notChecked`)]}),children:(0,J.jsx)(`div`,{className:`border-t border-stroke pt-3`,children:(0,J.jsx)(At,{children:b})})})]})}function mo(e,t){switch(t){case`interface`:return e(`config:settingsShell.lede.interface`);case`notifications`:return e(`config:settingsShell.lede.notifications`);case`shortcuts`:return e(`config:settingsShell.lede.shortcuts`);case`updates`:return e(`config:settingsShell.lede.updates`);case`about`:return e(`config:settingsShell.lede.about`);default:return e(`config:settingsShell.lede.models`)}}function ho({notify:e,registerPrimaryAction:t,invokePrimaryAction:n,section:r,onBackToFeatures:i,onBrowserNotificationChange:a,requestConfirm:o,update:s,renderInterfaceSettings:c}){let{t:u}=l(),d=rt(r);if(r===`remote-access`||r===`mobile-server`||r===`desktop-pet`)return(0,J.jsx)(Ei,{section:r,notify:e,requestConfirm:o,onBack:i});let f=ce(r)?r:`models`,p;if(f===`notifications`)p=(0,J.jsx)(so,{notify:e,onBrowserNotificationChange:a});else if(f===`interface`){let t=(0,J.jsx)(Bi,{notify:e,defaultAdvancedExpanded:d?.expandGroup===`interface-advanced`,navigationKey:d?.navigationKey});p=c?c(t):t}else p=f===`shortcuts`?(0,J.jsx)(Vi,{requestConfirm:o}):f===`updates`?(0,J.jsx)(po,{notify:e,update:s}):f===`about`?(0,J.jsx)(ti,{update:s,notify:e}):(0,J.jsx)(La,{defaultAdvancedExpanded:d?.expandGroup===`models-advanced`,navigationKey:d?.navigationKey,notify:e,registerPrimaryAction:t,requestConfirm:o});let m=u(`navigation:pageHeader.quickSetup`);return(0,J.jsx)(Dt,{"data-settings-page":f,title:le(u,f),description:mo(u,f),toolbar:f===`models`?(0,J.jsx)(Ot,{actions:(0,J.jsxs)(B,{variant:`outline`,"data-settings-quick-setup":!0,onClick:n,children:[(0,J.jsx)(ge,{className:`size-4`,"aria-hidden":`true`}),m]})}):void 0,children:(0,J.jsx)(`div`,{"data-config-card":it,className:`mt-6 min-w-0 max-[650px]:mt-3`,children:p})})}export{ho as ConfigPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-D2P6OO3w.js";import{t as n}from"./LaunchConsole-DRnR4Irg.js";import{t as r}from"./info-DATxy0fb.js";import{a as i,n as a,o,r as s,t as c}from"./sheet-CASx5kBt.js";import{a as l,i as u,l as d,r as f,t as p}from"./dialog-Kx6RCn3A.js";import{t as m}from"./useOverlayFocusReturn-NkxBSSjb.js";var h=e();function g({open:e,phone:g,onOpenChange:_,onDispatched:v,onDetachedFailure:y,onConfigureModels:b}){let{t:x}=t(),S=m(e),C=(0,h.jsx)(n,{variant:g?`sheet`:`overlay`,autoFocus:!0,onDispatched:v,onDetachedFailure:y,onConfigureModels:()=>{_(!1),b()}});return g?(0,h.jsx)(c,{open:e,onOpenChange:_,children:(0,h.jsxs)(a,{side:`bottom`,showCloseButton:!1,"aria-describedby":`board-dispatch-description`,onCloseAutoFocus:S,className:`max-h-[90dvh] gap-3 overflow-y-auto rounded-t-(--r-sheet) px-4 pt-2 pb-[calc(16px+var(--pisper-safe-area-bottom))]`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`mx-auto h-1 w-9 flex-none rounded-full bg-stroke-strong`}),(0,h.jsxs)(i,{className:`p-0`,children:[(0,h.jsx)(o,{children:x(`board:dispatch.title`)}),(0,h.jsx)(s,{id:`board-dispatch-description`,children:x(`board:dispatch.descriptionPhone`)})]}),C]})}):(0,h.jsx)(p,{open:e,onOpenChange:_,children:(0,h.jsxs)(u,{showCloseButton:!1,"aria-describedby":`board-dispatch-description`,"data-dispatch-dialog":!0,onCloseAutoFocus:S,className:`top-[max(16px,13vh)] max-w-[min(92vw,640px)] translate-y-0 gap-0 overflow-hidden rounded-[var(--r-lg)] border border-stroke bg-solid p-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 px-5 pt-4 pb-2`,children:[(0,h.jsx)(d,{className:`min-w-0 flex-1 text-[15px] leading-6 font-semibold`,children:x(`board:dispatch.title`)}),(0,h.jsx)(f,{"aria-label":x(`common:ui.closeDialog`),className:`-mr-1.5 h-7 rounded-[var(--r-sm)] px-1.5 text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,children:`Esc`})]}),C,(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-t border-stroke-soft bg-surface-subtle px-5 py-2.5 text-xs text-content-muted`,children:[(0,h.jsx)(r,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),(0,h.jsx)(l,{id:`board-dispatch-description`,className:`min-w-0 flex-1 text-xs text-content-muted`,children:x(`board:dispatch.description`)}),(0,h.jsx)(`span`,{className:`flex-none max-[700px]:hidden`,children:x(`board:dispatch.hint`)})]})]})})}export{g as DispatchOverlay};
|