pi-web-ui 0.119.0 → 0.120.0
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/CHANGELOG.md +79 -0
- package/bin/hub-upgrade.mjs +33 -15
- package/bin/lib/atomic-file.mjs +90 -0
- package/dist/server/agent-service-daemon.js +44 -10
- package/dist/server/agent-service.js +803 -106
- package/dist/server/atomic-file.js +130 -5
- package/dist/server/bash-timeout.js +15 -0
- package/dist/server/bash-tool.js +68 -4
- package/dist/server/bg-servers.js +19 -13
- package/dist/server/canvas/canvas-dispatch.js +12 -1
- package/dist/server/client-state.js +56 -14
- package/dist/server/conversation-tool.js +3 -2
- package/dist/server/delegate-task.js +8 -8
- package/dist/server/device-center/group-router-runtime.js +2 -0
- package/dist/server/device-center/hub-upgrade.js +5 -10
- package/dist/server/dispatch-domain-handlers.js +96 -22
- package/dist/server/dispatch-plugin-handlers.js +10 -0
- package/dist/server/dsh/dsh-agent-service.js +9 -9
- package/dist/server/durable/durable-agent-service.js +1 -1
- package/dist/server/files-service.js +41 -19
- package/dist/server/fs-copy.js +93 -0
- package/dist/server/goal-review-gate.js +2 -2
- package/dist/server/index.js +15 -0
- package/dist/server/job-runner.js +345 -0
- package/dist/server/marker-service.js +42 -26
- package/dist/server/model-session.js +16 -0
- package/dist/server/phone-tool.js +167 -0
- package/dist/server/plan-mode.js +2 -2
- package/dist/server/plugin-api-catalog.js +1 -1
- package/dist/server/plugin-bundled.js +35 -28
- package/dist/server/plugin-installer.js +15 -0
- package/dist/server/plugin-manifest-validate.js +10 -0
- package/dist/server/plugin-materialize.js +161 -0
- package/dist/server/plugin-paths.js +60 -0
- package/dist/server/plugin-removal.js +16 -3
- package/dist/server/plugin-schedule.js +8 -7
- package/dist/server/plugin-secrets.js +7 -3
- package/dist/server/plugin-updater.js +2 -4
- package/dist/server/plugins.js +74 -38
- package/dist/server/preset-fields.js +9 -9
- package/dist/server/process-utils.js +11 -0
- package/dist/server/project-scripts.js +38 -0
- package/dist/server/prompt-composer.js +40 -21
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/quick-ask.js +3 -0
- package/dist/server/remote-ssh-service.js +39 -0
- package/dist/server/scm-commitmsg.js +2 -1
- package/dist/server/serialize.js +8 -0
- package/dist/server/session-list-index.js +246 -0
- package/dist/server/session-list-scan.js +5 -0
- package/dist/server/session-parser.js +16 -0
- package/dist/server/settings-service.js +39 -6
- package/dist/server/subagent-budget.js +68 -0
- package/dist/server/subagent-evidence.js +297 -0
- package/dist/server/subagent-helpers.js +12 -0
- package/dist/server/subagent-ledger.js +401 -0
- package/dist/server/subagent-notify.js +6 -2
- package/dist/server/subagent-security-gate.js +2 -2
- package/dist/server/subagent-settle.js +71 -0
- package/dist/server/subagents.js +497 -79
- package/dist/server/tabs.js +8 -1
- package/dist/server/terminals.js +0 -1
- package/dist/server/tool-manager.js +90 -16
- package/dist/server/tool-prompts.js +5 -1
- package/dist/server/universal/universal-service.js +1 -1
- package/dist/server/universal/universal-session.js +45 -7
- package/dist/server/vision-bridge.js +2 -0
- package/dist/server/workspace-handle.js +119 -17
- package/dist/server/workspace-queue.js +37 -0
- package/docs/README.md +25 -23
- package/docs/architecture-plugins.md +23 -3
- package/docs/device-center.md +1 -1
- package/package.json +15 -3
- package/plugins/catalog.json +13 -2
- package/themes/bases/flow-base.css +7 -16
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BdOJ19Hj.js +1 -0
- package/web/dist/assets/BgTasksModal-SAH2XCkY.js +1 -0
- package/web/dist/assets/{CanvasStudio-2ydYbnpW.js → CanvasStudio-BB_Iq7pl.js} +3 -3
- package/web/dist/assets/{CanvasStudio-DizWvRjn.js → CanvasStudio-DU6O3N4u.js} +3 -3
- package/web/dist/assets/DeviceCenter-By1zVTSY.js +3 -0
- package/web/dist/assets/DeviceCenter-Cnm0Tjrx.js +3 -0
- package/web/dist/assets/{DeviceExecutionSettings-B7R9ONaq.js → DeviceExecutionSettings-qJzbI0Cf.js} +1 -1
- package/web/dist/assets/{DeviceGroups-DFU4cv5b.js → DeviceGroups-DPrQxW6B.js} +1 -1
- package/web/dist/assets/{DeviceGroups-DoaQcxKj.js → DeviceGroups-DoucyUjI.js} +1 -1
- package/web/dist/assets/{Dropdown-Btjt6Dzh.js → Dropdown-kj_NIj6e.js} +1 -1
- package/web/dist/assets/FilePreview-Bub8Y9uq.js +2 -0
- package/web/dist/assets/FilePreview-CC76Z6an.js +2 -0
- package/web/dist/assets/GlobalSearchModal-01nkgw4X.js +1 -0
- package/web/dist/assets/GlobalSearchModal-CiT6wBmR.js +1 -0
- package/web/dist/assets/{GroupConversation-DwZZrMuE.js → GroupConversation-1-lsPO1f.js} +3 -3
- package/web/dist/assets/{GroupConversation-KOi8sa5b.js → GroupConversation-HeiyW_O_.js} +3 -3
- package/web/dist/assets/{GroupWorkItems-FqAL74bC.js → GroupWorkItems-BYJv2XFj.js} +1 -1
- package/web/dist/assets/{HintTip-BOwPzBGR.js → HintTip-DFhoclDw.js} +1 -1
- package/web/dist/assets/{ModelConfigModal-DLIfWKdB.js → ModelConfigModal-D2Ro-jUZ.js} +2 -2
- package/web/dist/assets/{ModelConfigModal-B140kWrs.js → ModelConfigModal-DPc9R1pq.js} +2 -2
- package/web/dist/assets/{NativeCliPanel-BwiLazSq.js → NativeCliPanel-B108d697.js} +3 -3
- package/web/dist/assets/{NativeCliPanel-U0F_EfAU.js → NativeCliPanel-DupvGwQM.js} +3 -3
- package/web/dist/assets/{PiSetupModal-Dc7EQ4L3.js → PiSetupModal-D0HitBfd.js} +1 -1
- package/web/dist/assets/{ProviderOAuthControls-C3opmPhu.js → ProviderOAuthControls-BLKUEDde.js} +1 -1
- package/web/dist/assets/{SCMPanel-BBxQfmq9.js → SCMPanel-DDbWrUHR.js} +1 -1
- package/web/dist/assets/{SCMPanel-D2t97Vvr.js → SCMPanel-DluNcd2-.js} +1 -1
- package/web/dist/assets/SettingsModal-Cy5lRC97.css +1 -0
- package/web/dist/assets/SettingsModal-DQu18366.js +33 -0
- package/web/dist/assets/SettingsModal-Dm_haPme.js +33 -0
- package/web/dist/assets/{TermXterm-B6nCtO2b.js → TermXterm-SYc-MUk2.js} +1 -1
- package/web/dist/assets/{TerminalPanel-BWB3iSeN.js → TerminalPanel-CgA_lhVT.js} +1 -1
- package/web/dist/assets/{TerminalPanel-CAV2SosY.js → TerminalPanel-vdSIOPjD.js} +1 -1
- package/web/dist/assets/{TuiOverlayModal-B0jBPOMc.js → TuiOverlayModal-Cy1jYYIw.js} +1 -1
- package/web/dist/assets/{TuiOverlayModal-DGd6fzU6.js → TuiOverlayModal-kXY_4hV8.js} +1 -1
- package/web/dist/assets/{app-globals-CR8Ls9nE.js → app-globals-CBEscsYP.js} +9 -9
- package/web/dist/assets/{canvas-client-B0lkqTtF.js → canvas-client-Clsypfs6.js} +1 -1
- package/web/dist/assets/{desktop-BME3DkyE.js → desktop-C6D9a8HZ.js} +1 -1
- package/web/dist/assets/index-BD29OL9L.js +404 -0
- package/web/dist/assets/index-BlCxbqqr.js +404 -0
- package/web/dist/assets/index-DB55rbKC.css +1 -0
- package/web/dist/assets/{plugin-host-CVgcdBOk.js → plugin-host-VWBcq-LQ.js} +1 -1
- package/web/dist/assets/remote-ssh-client-C2eab5Kw.js +1 -0
- package/web/dist/assets/theme-CpQk_Agp.js +1 -0
- package/web/dist/index.html +10 -10
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/BgTasksModal-CVHW1lRA.js +0 -1
- package/web/dist/assets/BgTasksModal-t5hxW1H6.js +0 -1
- package/web/dist/assets/DeviceCenter-CPaZNBJE.js +0 -3
- package/web/dist/assets/DeviceCenter-DsVakAYR.js +0 -3
- package/web/dist/assets/FilePreview-QGQfD2lV.js +0 -2
- package/web/dist/assets/FilePreview-qez9walH.js +0 -2
- package/web/dist/assets/GlobalSearchModal-B-cnTDJ5.js +0 -1
- package/web/dist/assets/GlobalSearchModal-BvbafjdU.js +0 -1
- package/web/dist/assets/SettingsModal-BqPQNUwF.js +0 -34
- package/web/dist/assets/SettingsModal-l7eeV-Rq.js +0 -34
- package/web/dist/assets/index-BBAQNi6v.js +0 -404
- package/web/dist/assets/index-BYW9d61A.js +0 -404
- package/web/dist/assets/index-BYWs88H2.css +0 -1
- package/web/dist/assets/remote-ssh-client-DEpvwgqG.js +0 -1
- package/web/dist/assets/theme-DVa7Z5Zu.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t,Tn as n,Ut as r,hn as i,l as a,t as o}from"./app-globals-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t,Tn as n,Ut as r,hn as i,l as a,t as o}from"./app-globals-CBEscsYP.js";import{i as s,t as c}from"./react-CR5VJ85Q.js";import{r as l}from"./desktop-C6D9a8HZ.js";import{t as u}from"./ProviderOAuthControls-BLKUEDde.js";var d=e(s(),1),f=c();function p({piConfigured:e,piAgentInstalled:s,providers:c,providerOAuthFlows:p,providerOAuthResults:m,installResult:h,onClose:g}){let _=n(),v=l(),y=a(),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)(``),[E,D]=(0,d.useState)(!1);(0,d.useEffect)(()=>{o({type:`list_providers`}),o({type:`list_provider_oauth_flows`})},[]),(0,d.useEffect)(()=>{e&&g()},[e,g]),(0,d.useEffect)(()=>{h&&x(!1)},[h]),(0,d.useEffect)(()=>{!S&&c.length>0&&C(c.find(e=>!e.configured)?.id??c[0].id)},[c,S]);let O=()=>{b||(x(!0),o({type:`install_pi_agent`}))},k=()=>{w.trim()&&!E&&(D(!0),o({type:`set_provider_api_key`,provider:S.trim(),apiKey:w.trim()}),setTimeout(()=>D(!1),3e3))},A=()=>{o({type:`get_state`}),o({type:`list_providers`})},j=c.find(e=>e.id===S),M=h!==null&&!h.ok;return(0,f.jsx)(`div`,{className:`modal-backdrop`,children:(0,f.jsxs)(`div`,{className:`modal setup-modal`,children:[(0,f.jsx)(`button`,{type:`button`,className:`modal-close`,"aria-label":_(`close`),onClick:g,children:(0,f.jsx)(i,{})}),(0,f.jsxs)(`div`,{className:`modal-head`,children:[(0,f.jsx)(t,{className:`modal-head-icon`}),(0,f.jsx)(`h2`,{children:_(`setupTitle`)})]}),(0,f.jsx)(`p`,{className:`modal-desc`,children:_(`setupDesc`)}),M?(0,f.jsxs)(`div`,{className:`setup-failed`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:_(`installFailed`)}),(0,f.jsx)(`pre`,{className:`setup-detail`,children:h.detail}),(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:b,onClick:O,children:_(`retryInstall`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]})]}):s||h?.ok||v?(0,f.jsxs)(`div`,{className:`setup-key-form`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:h?.ok?_(`installDone`):_(`cliReadyHint`)}),(0,f.jsxs)(`label`,{className:`field`,children:[(0,f.jsx)(`span`,{className:`field-label`,children:_(`provider`)}),(0,f.jsxs)(`select`,{value:S,onChange:e=>C(e.target.value),children:[c.length===0&&(0,f.jsx)(`option`,{value:``,children:_(`loading`)}),c.map(e=>(0,f.jsxs)(`option`,{value:e.id,children:[e.name,`(`,e.id,`)`,e.configured?` · ${_(`configured`)}`:``]},e.id))]}),j?.configured&&(0,f.jsx)(`div`,{className:`field-hint`,children:_(`providerKeyReady`)})]}),j?.supportsOAuth&&(0,f.jsx)(u,{provider:j,flow:p.find(e=>e.provider===j.id),result:m[j.id]}),j?.supportsApiKey&&(0,f.jsxs)(`label`,{className:`field`,children:[(0,f.jsx)(`span`,{className:`field-label`,children:_(`apiKey`)}),(0,f.jsx)(`input`,{type:`password`,value:w,onChange:e=>T(e.target.value),placeholder:`sk-…`})]}),(0,f.jsxs)(`div`,{className:`setup-actions`,children:[j?.supportsApiKey&&(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:!w.trim()||E||!S,onClick:k,children:_(E?`saving`:`saveAndStart`)}),(0,f.jsxs)(`button`,{type:`button`,className:`btn`,onClick:A,children:[(0,f.jsx)(r,{}),` `,_(`recheck`)]})]})]}):y?(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:_(`updatesManaged`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]}):(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:b,onClick:O,children:_(b?`installing`:`autoInstall`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]})]})})}export{p as PiSetupModal};
|
package/web/dist/assets/{ProviderOAuthControls-C3opmPhu.js → ProviderOAuthControls-BLKUEDde.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Tn as t,t as n}from"./app-globals-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Tn as t,t as n}from"./app-globals-CBEscsYP.js";import{i as r,t as i}from"./react-CR5VJ85Q.js";var a=e(r(),1),o=i();function s({provider:e,flow:r,result:i}){let s=t(),c=r?.event,l=e.oauthName??e.name,[u,d]=(0,a.useState)(``);return(0,a.useEffect)(()=>d(``),[r?.promptId]),e.usingOAuth?(0,o.jsxs)(`div`,{className:`provider-oauth`,children:[(0,o.jsx)(`span`,{className:`provider-oauth-status`,children:s(`oauthConnected`,{name:l})}),(0,o.jsx)(`button`,{type:`button`,className:`btn sm danger`,"data-provider-oauth-logout":e.id,onClick:()=>n({type:`provider_oauth_logout`,provider:e.id}),children:s(`oauthLogout`)}),i?.error&&(0,o.jsx)(`div`,{className:`provider-oauth-error`,children:i.error})]}):(0,o.jsxs)(`div`,{className:`provider-oauth`,children:[r?(0,o.jsxs)(o.Fragment,{children:[c?.type===`device_code`&&(0,o.jsxs)(`div`,{className:`provider-oauth-device`,children:[(0,o.jsx)(`div`,{children:s(`oauthDeviceCode`)}),(0,o.jsx)(`code`,{"data-oauth-device-code":!0,children:c.userCode}),(0,o.jsx)(`a`,{"data-oauth-verification-url":!0,href:c.verificationUri,target:`_blank`,rel:`noreferrer`,children:s(`oauthOpenVerification`)})]}),c?.type===`auth_url`&&(0,o.jsxs)(`div`,{className:`provider-oauth-event`,children:[c.instructions&&(0,o.jsx)(`div`,{children:c.instructions}),(0,o.jsx)(`a`,{href:c.url,target:`_blank`,rel:`noreferrer`,children:s(`oauthOpenVerification`)})]}),c?.type===`progress`&&(0,o.jsx)(`div`,{className:`provider-oauth-message`,children:c.message}),c?.type===`info`&&(0,o.jsxs)(`div`,{className:`provider-oauth-event`,children:[(0,o.jsx)(`div`,{children:c.message}),c.links?.map(e=>(0,o.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.label??e.url},e.url))]}),r.prompt&&(0,o.jsx)(`div`,{className:`provider-oauth-message`,children:r.prompt.message}),r.prompt?.type===`select`&&r.promptId&&(0,o.jsx)(`div`,{className:`provider-oauth-options`,children:r.prompt.options.map(e=>(0,o.jsx)(`button`,{type:`button`,className:`btn sm`,"data-oauth-option":e.id,onClick:()=>n({type:`provider_oauth_reply`,flowId:r.flowId,promptId:r.promptId,value:e.id}),children:e.label},e.id))}),r.prompt&&r.prompt.type!==`select`&&r.promptId&&(0,o.jsxs)(`form`,{className:`provider-oauth-prompt`,onSubmit:e=>{e.preventDefault(),u.trim()&&n({type:`provider_oauth_reply`,flowId:r.flowId,promptId:r.promptId,value:u.trim()})},children:[(0,o.jsx)(`input`,{"data-oauth-prompt-input":!0,type:r.prompt.type===`secret`?`password`:`text`,className:`key-input`,placeholder:r.prompt.placeholder,value:u,onChange:e=>d(e.target.value)}),(0,o.jsx)(`button`,{type:`submit`,className:`btn primary sm`,"data-oauth-prompt-submit":!0,disabled:!u.trim(),children:s(`oauthContinue`)})]}),(0,o.jsx)(`button`,{type:`button`,className:`btn sm danger`,"data-oauth-cancel":r.flowId,onClick:()=>n({type:`provider_oauth_cancel`,flowId:r.flowId}),children:s(`cancel`)})]}):(0,o.jsx)(`button`,{type:`button`,className:`btn primary sm`,"data-provider-oauth-login":e.id,onClick:()=>n({type:`provider_oauth_start`,provider:e.id}),children:s(`oauthLogin`,{name:l})}),i?.error&&(0,o.jsx)(`div`,{className:`provider-oauth-error`,children:i.error})]})}export{s as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,K as n,Tn as r,Ut as i,_ as a,an as o,ct as s,t as ee,x as te}from"./app-globals-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,K as n,Tn as r,Ut as i,_ as a,an as o,ct as s,t as ee,x as te}from"./app-globals-CBEscsYP.js";import{i as c,t as l}from"./react-CR5VJ85Q.js";import{t as ne}from"./uuid-BzDIGCwP.js";import{L as u}from"./index-BD29OL9L.js";var d=e(c(),1),re=e=>`'${e.replace(/'/g,`'\\''`)}'`,ie=`pi-web-ui:scm-sidebar-width`;function ae(e,t=0){if(!Number.isFinite(e))return 300;let n=Math.max(200,Math.min(720,t>0?t-220:720));return Math.min(n,Math.max(200,Math.round(e)))}function oe(e){return e===null||e.trim()===``?300:ae(Number(e))}function f(e,t){let n=t.toLowerCase();return e.subject.toLowerCase().includes(n)||e.author.toLowerCase().includes(n)||e.shortHash.toLowerCase().includes(n)||e.hash.toLowerCase().includes(n)||e.decorations!==void 0&&e.decorations.toLowerCase().includes(n)}function se(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e:e.filter(e=>n.every(t=>f(e,t)))}var p=`scm-commit-history`;function m(e=localStorage){try{let t=e.getItem(p);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):[]}catch{return[]}}function ce(e,t=localStorage){let n=e.trim();if(!n)return m(t);let r=[n,...m(t).filter(e=>e!==n)].slice(0,20);try{t.setItem(p,JSON.stringify(r))}catch{}return r}var h={idx:-1,draft:``};function le(e,t,n,r){return e.length===0?null:r===`up`?t.idx>=e.length-1?null:t.idx===-1?{state:{idx:0,draft:n},text:e[0]}:{state:{idx:t.idx+1,draft:t.draft},text:e[t.idx+1]}:t.idx===-1?null:t.idx===0?{state:h,text:t.draft}:{state:{idx:t.idx-1,draft:t.draft},text:e[t.idx-1]}}var g=l();function ue(e){if(e.x===`?`&&e.y===`?`)return`untracked`;let t=e.x!==` `&&e.x!==`?`,n=e.y!==` `&&e.y!==`?`;return t&&n?`both`:t?`staged`:`unstaged`}function _({chat:e,terminal:c,active:l,onSwitchToTerminal:f,uiScmToolbar:p,onUiAction:_}){let v=r(),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)([]),[C,de]=(0,d.useState)(``),[fe,pe]=(0,d.useState)(new Map),[w,me]=(0,d.useState)(`changes`),[T,he]=(0,d.useState)([]),[E,D]=(0,d.useState)(null),[ge,O]=(0,d.useState)(``),[k,_e]=(0,d.useState)(!1),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(null),[ve,P]=(0,d.useState)(!1),[ye,be]=(0,d.useState)(!1),[xe,Se]=(0,d.useState)(!1),[F,I]=(0,d.useState)(null),[L,Ce]=(0,d.useState)(!1),[R,z]=(0,d.useState)(!1),[we,B]=(0,d.useState)(null),[V,Te]=(0,d.useState)(()=>oe(localStorage.getItem(ie))),[H,U]=(0,d.useState)(``),[Ee,De]=(0,d.useState)(``),[Oe,ke]=(0,d.useState)(()=>m()),W=(0,d.useRef)(h),Ae=(0,d.useRef)(0),je=(0,d.useRef)(-1),Me=(0,d.useRef)(-1),Ne=(0,d.useRef)(-1),G=(0,d.useRef)(-1),K=(0,d.useRef)(-1),Pe=(0,d.useRef)(void 0),Fe=(0,d.useRef)(null),Ie=(0,d.useRef)([]),Le=(0,d.useRef)(V);Le.current=V;let Re=(0,d.useRef)(null),q=(0,d.useCallback)(e=>{try{localStorage.setItem(ie,String(e))}catch{}},[]),ze=(0,d.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=Le.current,r=Re.current?.getBoundingClientRect().width??0,i=n,a=e=>{i=ae(n+(e.clientX-t),r),Te(i)},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),document.body.classList.remove(`panel-resizing`),q(i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),document.body.classList.add(`panel-resizing`)},[q]),Be=(0,d.useCallback)(()=>{Te(300),q(300)},[q]),Ve=(0,d.useCallback)(e=>{if(e.reqId===je.current){if(je.current=-1,be(!1),I(null),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}if(e.notRepo){Ce(!0),b(null),S([]),pe(new Map),he([]),D(null),O(``),N(null);return}Ce(!1);let t={branch:e.branch??``,detached:!!e.detached,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,upstreamGone:!!e.upstreamGone,files:(e.files??[]).map(e=>({...e}))},n=(e.branches??[]).map(e=>({...e})),r=new Map;for(let[t,n]of Object.entries(e.stats??{}))r.set(t,{add:n[0],del:n[1]});b(t),S(n),pe(r),de(e=>t.detached?e||``:t.branch&&n.some(e=>e.name===t.branch)?t.branch:e&&n.some(t=>t.name===e)?e:n[0]?.name??``),N(e=>e&&!t.files.some(t=>t.path===e.file.path)?null:e)}else if(e.reqId===Me.current){if(Me.current=-1,P(!1),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}let t=Fe.current;if(!t)return;N({file:t,staged:e.stagedText??``,worktree:e.worktreeText??``,untracked:!1})}else if(e.reqId===G.current){if(G.current=-1,Se(!1),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}he((e.history??[]).map(e=>({...e})))}else if(e.reqId===Ne.current){if(Ne.current=-1,_e(!1),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}O(e.text??``)}else if(e.reqId===K.current){if(K.current=-1,z(!1),!e.ok){B(e.error??v(`scmGenMsgFail`));return}B(null),U(e.text??``)}},[]);(0,d.useEffect)(()=>{let t=e.scmData;t&&t.type===`scm_data`&&Ve(t)},[e.scmData,Ve]);let J=(0,d.useCallback)((t,n)=>{if(!e.ready||e.status!==`open`)return!1;let r=++Ae.current;return ee({...t,reqId:r})?(n.current=r,!0):(--Ae.current,!1)},[e.ready,e.status]),Y=(0,d.useCallback)((t=!1,n=!1)=>{e.ready&&e.status===`open`&&e.state?.cwd&&(Pe.current!==void 0&&Pe.current!==e.state.cwd&&(b(null),S([]),pe(new Map),he([]),De(``),Se(!1),G.current=-1,D(null),O(``),N(null),j(null),B(null),z(!1),K.current=-1),Pe.current=e.state.cwd,I(null),J({type:`scm_status`},je)&&(n||be(!0)))},[e.ready,e.state?.cwd,e.status,J]),He=(0,d.useCallback)(e=>{if(j(e),D(null),Fe.current=e,e.x===`?`&&e.y===`?`){N({file:e,staged:``,worktree:``,untracked:!0});return}P(!0),I(null),J({type:`scm_filediff`,path:e.path},Me)||P(!1)},[J]),Ue=(0,d.useCallback)(e=>{D(e),j(null),N(null),O(``),_e(!0),I(null),J({type:`scm_commit`,hash:e.hash},Ne)||_e(!1)},[J]),X=(0,d.useCallback)((t,n)=>{if(!e.ready)return;let r={name:t,command:n,cwd:"${pwd}"},i,a=e.terminals.find(e=>e.title===t);a?(c.restart(a.id),ee({type:`run_command`,terminalId:a.id,conversationId:a.conversationId,command:r,cols:80,rows:24}),i=a.id):(i=ne(),c.create({id:i,conversationId:e.activeConversationId||e.state?.conversationId||``,title:t,cwd:e.state?.cwd??``,cols:80,rows:24,running:!0,exitCode:null,command:r})),c.select(i),f()},[e.ready,e.state?.cwd,e.terminals,f,c]),We=(0,d.useCallback)(()=>{let e=H.trim();if(!e||L)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git commit -m "${t}"`),ke(ce(e)),U(``),W.current=h},[H,L,X]),Ge=(0,d.useCallback)(()=>{let e=H.trim();if(!e||L)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git add -A && git commit -m "${t}"`),ke(ce(e)),U(``),W.current=h},[H,L,X]),Ke=(0,d.useCallback)(e=>{L||X(`git add`,`git add -- ${re(e.path)}`)},[L,X]),qe=(0,d.useCallback)(e=>{L||X(`git reset`,`git reset HEAD -- ${re(e.path)}`)},[L,X]),Je=(0,d.useCallback)(()=>{if(!C||L)return;let e=x.find(e=>e.name===C);if(e?.remote&&typeof e.remote==`string`){let t=C.slice(e.remote.length+1);X(`git checkout`,`git checkout -b ${t} ${C} || git checkout ${C}`)}else X(`git checkout`,`git checkout ${C}`)},[C,x,L,X]),Ye=(0,d.useCallback)(()=>X(`git push`,`git push`),[X]),Xe=(0,d.useCallback)(()=>X(`git pull`,`git pull`),[X]),Ze=(0,d.useCallback)(()=>{R||L||!e.ready||e.status!==`open`||(B(null),J({type:`scm_commitmsg`},K)?z(!0):B(v(`scmGenMsgFail`)))},[R,L,e.ready,e.status,J,v]),Z=(0,d.useCallback)(()=>{J({type:`scm_history`},G)||(G.current=-1)},[J]);(0,d.useEffect)(()=>{l&&Y()},[l,Y]),(0,d.useEffect)(()=>{w===`history`&&y&&Z()},[w,y,Z]),(0,d.useEffect)(()=>{e.scmDirty>0&&l&&Y(!1,!0)},[e.scmDirty]),(0,d.useEffect)(()=>{if(!l||!e.ready||e.status!==`open`)return;let t=setInterval(()=>{document.visibilityState!==`hidden`&&Y(!1,!0)},3e4);return()=>clearInterval(t)},[l,e.ready,e.status,Y]),(0,d.useEffect)(()=>{let t=Ie.current;Ie.current=e.terminals,l&&e.terminals.some(e=>e.running===!1&&t.find(t=>t.id===e.id)?.running===!0&&e.title.startsWith(`git `))&&e.ready&&e.status===`open`&&(Y(!1,!0),w===`history`&&y&&Z())},[e.terminals,l,e.ready,e.status,Y,w,y,Z]);let Qe={staged:v(`scmStaged`),unstaged:v(`scmUnstaged`),untracked:v(`scmUntracked`),both:v(`scmStagedUnstaged`)},$e=se(T,Ee),et=e=>{let t=e.split(`
|
|
2
2
|
`);return(0,g.jsx)(`pre`,{className:`scm-diff-pre`,children:t.map((e,t)=>{let n=``;return e.startsWith(`diff --git`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`similarity index`)||e.startsWith(`rename `)||e.startsWith(`copy `)||e.startsWith(`Binary files`)||e.startsWith(`---`)||e.startsWith(`+++`)?n=`hdr`:e.startsWith(`@@`)?n=`hunk`:e.startsWith(`+`)?n=`add`:e.startsWith(`-`)&&(n=`del`),(0,g.jsx)(`div`,{className:`scm-diff-line ${n}`,children:e||` `},t)})})},tt=p===void 0?[`host:scm-changes`,`host:scm-history`,`host:scm-refresh`,`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`,`host:scm-term`].map(e=>({id:e,source:`host`})):p.filter(e=>!e.hidden),nt=[`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`],rt=(e,t)=>{let n=new Set(e);return tt.filter(e=>n.has(e.id)||t&&e.source!==`host`)},it=e=>p===void 0||!p.some(t=>t.id===e&&t.hidden),Q=(e,t)=>{let n=tt.find(t=>t.id===e);return n?.labelExplicit?n.label:t},$={"host:scm-changes":(0,g.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":w===`changes`,className:w===`changes`?`active`:``,onClick:()=>{me(`changes`),I(null)},children:Q(`host:scm-changes`,v(`scmChanges`))}),"host:scm-history":(0,g.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":w===`history`,className:w===`history`?`active`:``,onClick:()=>{me(`history`),I(null)},children:Q(`host:scm-history`,v(`scmHistory`))}),"host:scm-refresh":(0,g.jsx)(`button`,{type:`button`,className:`panel-refresh`,title:v(`scmRefreshTip`),disabled:ye,onClick:()=>Y(!0),children:(0,g.jsx)(i,{className:ye?`scm-spin`:``})}),"host:scm-branch":(0,g.jsxs)(`select`,{className:`scm-select`,value:C,disabled:L||x.length===0,title:Q(`host:scm-branch`,v(`scmSwitchBranch`)),onChange:e=>de(e.target.value),children:[(0,g.jsx)(`option`,{value:``,disabled:!0,children:v(`scmSelectBranch`)}),x.filter(e=>!e.remote).map(e=>(0,g.jsx)(`option`,{value:e.name,children:e.current?`* ${e.name}`:e.name},e.name)),x.some(e=>e.remote)&&(0,g.jsx)(`optgroup`,{label:v(`scmRemoteBranches`),children:x.filter(e=>e.remote).map(e=>(0,g.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),"host:scm-switch":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!C||C===y?.branch||L,title:v(`scmSwitchBranchTip`,{branch:C}),onClick:Je,children:[(0,g.jsx)(s,{}),Q(`host:scm-switch`,v(`scmSwitch`))]}),"host:scm-push":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!y||y.detached||L,title:v(`scmPushTip`),onClick:Ye,children:[(0,g.jsx)(te,{}),Q(`host:scm-push`,v(`scmPush`))]}),"host:scm-pull":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!y||y.detached||L,title:v(`scmPullTip`),onClick:Xe,children:[(0,g.jsx)(a,{}),Q(`host:scm-pull`,v(`scmPull`))]}),"host:scm-input":(0,g.jsx)(`input`,{className:`scm-commit-input`,value:H,placeholder:v(`scmCommitPlaceholder`),disabled:L,title:Oe.length>0?v(`scmCommitHistoryTip`):void 0,onChange:e=>{U(e.target.value),W.current=h},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Enter`){We();return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){let t=le(Oe,W.current,H,e.key===`ArrowUp`?`up`:`down`);t&&(e.preventDefault(),W.current=t.state,U(t.text))}}}}),"host:scm-genmsg":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:R||L||!y||y.files.length===0,title:v(`scmGenMsgTip`),onClick:Ze,children:[(0,g.jsx)(n,{className:R?`scm-spin`:``}),R?v(`scmGenMsgRunning`):Q(`host:scm-genmsg`,v(`scmGenMsg`))]}),"host:scm-commit":(0,g.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:!H.trim()||L,title:v(`scmCommitTip`),onClick:We,children:[(0,g.jsx)(t,{}),Q(`host:scm-commit`,v(`scmCommit`))]}),"host:scm-commit-all":(0,g.jsx)(`button`,{type:`button`,className:`btn`,disabled:!H.trim()||L,title:v(`scmCommitAllTip`),onClick:Ge,children:Q(`host:scm-commit-all`,v(`scmCommitAll`))})};return(0,g.jsxs)(`div`,{className:`scm-view`,children:[(0,g.jsxs)(`div`,{className:`scm-header`,children:[(0,g.jsxs)(`div`,{className:`scm-title-row`,children:[(0,g.jsxs)(`span`,{className:`scm-title`,children:[(0,g.jsx)(s,{}),v(`scmTitle`)]}),(0,g.jsx)(`div`,{className:`scm-view-tabs`,role:`tablist`,children:u(rt([`host:scm-changes`,`host:scm-history`],!1),$,_)}),u(rt([`host:scm-refresh`],!0),$,_)]}),(0,g.jsxs)(`div`,{className:`scm-row`,children:[(0,g.jsxs)(`span`,{className:`scm-branch-current`,title:v(`scmCurrentBranch`),children:[(0,g.jsx)(s,{}),y?y.detached?v(`scmDetached`):y.branch:`…`,y?.upstream&&(0,g.jsx)(`span`,{className:`scm-upstream`,children:y.upstreamGone?v(`scmUpstreamGone`):y.ahead>0||y.behind>0?v(`scmAheadBehind`,{ahead:y.ahead,behind:y.behind}):y.upstream})]}),u(rt(nt,!1),$,_)]}),we&&(0,g.jsx)(`div`,{className:`scm-gen-error`,role:`alert`,title:v(`close`),onClick:()=>B(null),children:we})]}),(0,g.jsxs)(`div`,{className:`scm-body`,ref:Re,style:{"--scm-sidebar-w":`${V}px`},children:[w===`history`?(0,g.jsxs)(`div`,{className:`scm-history`,children:[(0,g.jsxs)(`div`,{className:`scm-files-header`,children:[(0,g.jsx)(`span`,{children:v(`scmHistory`)}),T.length>0&&(0,g.jsx)(`span`,{className:`scm-files-count`,children:Ee.trim()?`${$e.length}/${T.length}`:T.length})]}),T.length>0&&!L&&(0,g.jsx)(`input`,{className:`scm-history-filter`,value:Ee,placeholder:v(`scmHistoryFilterPlaceholder`),title:v(`scmHistoryFilterTip`),onChange:e=>De(e.target.value)}),(0,g.jsx)(`div`,{className:`scm-history-list`,children:L?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNotGitRepo`)}):!y||xe?(0,g.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?v(`scmLoading`):v(`scmConnecting`)}):T.length===0?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNoHistory`)}):$e.length===0?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmHistoryFilterEmpty`)}):$e.map(e=>(0,g.jsxs)(`button`,{type:`button`,className:`scm-commit ${E?.hash===e.hash?`active`:``}`,onClick:()=>Ue(e),title:e.hash,children:[(0,g.jsx)(`span`,{className:`scm-commit-graph`,"aria-hidden":`true`,children:e.graph||`* `}),(0,g.jsxs)(`span`,{className:`scm-commit-info`,children:[(0,g.jsx)(`span`,{className:`scm-commit-subject`,children:e.subject}),(0,g.jsxs)(`span`,{className:`scm-commit-meta`,children:[e.shortHash,` · `,e.author,` · `,e.date]}),e.decorations&&(0,g.jsx)(`span`,{className:`scm-commit-refs`,children:e.decorations})]})]},e.hash))})]}):(0,g.jsxs)(`div`,{className:`scm-files`,children:[(0,g.jsxs)(`div`,{className:`scm-files-header`,children:[(0,g.jsx)(`span`,{children:v(`scmChanges`)}),y&&y.files.length>0&&(0,g.jsx)(`span`,{className:`scm-files-count`,children:y.files.length})]}),(0,g.jsx)(`div`,{className:`scm-files-list`,children:L?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNotGitRepo`)}):y?y.files.length===0?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNoChanges`)}):y.files.map(e=>{let t=ue(e),n=fe.get(e.path);return(0,g.jsxs)(`div`,{className:`scm-file ${A?.path===e.path?`active`:``}`,title:Qe[t],onClick:()=>He(e),children:[(0,g.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`x`}`,children:e.x===` `?`\xA0`:e.x}),(0,g.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`y`}`,children:e.y===` `?`\xA0`:e.y}),(0,g.jsx)(`span`,{className:`scm-file-path`,children:e.path}),n&&(n.add>0||n.del>0)&&(0,g.jsxs)(`span`,{className:`scm-file-stat`,children:[n.add>0&&(0,g.jsxs)(`span`,{className:`add`,children:[`+`,n.add]}),n.del>0&&(0,g.jsxs)(`span`,{className:`del`,children:[`-`,n.del]})]}),(0,g.jsxs)(`span`,{className:`scm-file-actions`,children:[(e.y!==` `||t===`untracked`)&&(0,g.jsx)(`button`,{type:`button`,className:`scm-act`,title:v(`scmStageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),Ke(e)},children:`+`}),t===`staged`||t===`both`?(0,g.jsx)(`button`,{type:`button`,className:`scm-act`,title:v(`scmUnstageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),qe(e)},children:`−`}):null]})]},e.path)}):(0,g.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?v(`scmLoading`):v(`scmConnecting`)})})]}),(0,g.jsx)(`div`,{className:`scm-divider`,role:`separator`,"aria-orientation":`vertical`,title:v(`dragToResize`),onPointerDown:ze,onDoubleClick:Be}),(0,g.jsxs)(`div`,{className:`scm-diff`,children:[(0,g.jsxs)(`div`,{className:`scm-diff-header`,children:[(0,g.jsx)(`span`,{children:w===`history`?E?`${E.shortHash} ${E.subject}`:v(`scmCommitDetail`):A?A.path:v(`scmDiff`)}),(w===`history`?k:ve)&&(0,g.jsx)(`span`,{className:`scm-diff-loading`,children:v(`scmLoading`)})]}),(0,g.jsx)(`div`,{className:`scm-diff-body`,children:w===`history`?(0,g.jsxs)(g.Fragment,{children:[F&&(0,g.jsx)(`div`,{className:`scm-error`,children:F}),!E&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmSelectCommitHint`)}),E&&k&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmLoading`)}),E&&!k&&!F&&ge?et(ge):null]}):(0,g.jsxs)(g.Fragment,{children:[F&&(0,g.jsx)(`div`,{className:`scm-error`,children:F}),!A&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmSelectFileHint`)}),A&&!M&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmLoading`)}),A&&M&&M.untracked&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmUntrackedNote`)}),A&&M&&!M.untracked&&(0,g.jsxs)(g.Fragment,{children:[M.staged&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`scm-diff-section`,children:v(`scmStaged`)}),et(M.staged)]}),M.worktree&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`scm-diff-section`,children:v(`scmUnstaged`)}),et(M.worktree)]}),!M.staged&&!M.worktree&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNoDiff`)})]})]})})]})]}),(0,g.jsxs)(`div`,{className:`scm-hint`,children:[(0,g.jsx)(o,{}),(0,g.jsx)(`span`,{children:v(`scmRunsInTerminal`)}),it(`host:scm-term`)&&(0,g.jsx)(`button`,{type:`button`,className:`scm-goto-term`,onClick:f,children:Q(`host:scm-term`,v(`scmViewTerminal`))})]})]})}export{_ as ScmPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,K as n,Tn as r,Ut as i,_ as a,an as o,ct as s,t as ee,x as te}from"./app-globals-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,K as n,Tn as r,Ut as i,_ as a,an as o,ct as s,t as ee,x as te}from"./app-globals-CBEscsYP.js";import{i as c,t as l}from"./react-CR5VJ85Q.js";import{t as ne}from"./uuid-BzDIGCwP.js";import{L as u}from"./index-BlCxbqqr.js";var d=e(c(),1),re=e=>`'${e.replace(/'/g,`'\\''`)}'`,ie=`pi-web-ui:scm-sidebar-width`;function ae(e,t=0){if(!Number.isFinite(e))return 300;let n=Math.max(200,Math.min(720,t>0?t-220:720));return Math.min(n,Math.max(200,Math.round(e)))}function oe(e){return e===null||e.trim()===``?300:ae(Number(e))}function f(e,t){let n=t.toLowerCase();return e.subject.toLowerCase().includes(n)||e.author.toLowerCase().includes(n)||e.shortHash.toLowerCase().includes(n)||e.hash.toLowerCase().includes(n)||e.decorations!==void 0&&e.decorations.toLowerCase().includes(n)}function se(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e:e.filter(e=>n.every(t=>f(e,t)))}var p=`scm-commit-history`;function m(e=localStorage){try{let t=e.getItem(p);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):[]}catch{return[]}}function ce(e,t=localStorage){let n=e.trim();if(!n)return m(t);let r=[n,...m(t).filter(e=>e!==n)].slice(0,20);try{t.setItem(p,JSON.stringify(r))}catch{}return r}var h={idx:-1,draft:``};function le(e,t,n,r){return e.length===0?null:r===`up`?t.idx>=e.length-1?null:t.idx===-1?{state:{idx:0,draft:n},text:e[0]}:{state:{idx:t.idx+1,draft:t.draft},text:e[t.idx+1]}:t.idx===-1?null:t.idx===0?{state:h,text:t.draft}:{state:{idx:t.idx-1,draft:t.draft},text:e[t.idx-1]}}var g=l();function ue(e){if(e.x===`?`&&e.y===`?`)return`untracked`;let t=e.x!==` `&&e.x!==`?`,n=e.y!==` `&&e.y!==`?`;return t&&n?`both`:t?`staged`:`unstaged`}function _({chat:e,terminal:c,active:l,onSwitchToTerminal:f,uiScmToolbar:p,onUiAction:_}){let v=r(),[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)([]),[C,de]=(0,d.useState)(``),[fe,pe]=(0,d.useState)(new Map),[w,me]=(0,d.useState)(`changes`),[T,he]=(0,d.useState)([]),[E,D]=(0,d.useState)(null),[ge,O]=(0,d.useState)(``),[k,_e]=(0,d.useState)(!1),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(null),[ve,P]=(0,d.useState)(!1),[ye,be]=(0,d.useState)(!1),[xe,Se]=(0,d.useState)(!1),[F,I]=(0,d.useState)(null),[L,Ce]=(0,d.useState)(!1),[R,z]=(0,d.useState)(!1),[we,B]=(0,d.useState)(null),[V,Te]=(0,d.useState)(()=>oe(localStorage.getItem(ie))),[H,U]=(0,d.useState)(``),[Ee,De]=(0,d.useState)(``),[Oe,ke]=(0,d.useState)(()=>m()),W=(0,d.useRef)(h),Ae=(0,d.useRef)(0),je=(0,d.useRef)(-1),Me=(0,d.useRef)(-1),Ne=(0,d.useRef)(-1),G=(0,d.useRef)(-1),K=(0,d.useRef)(-1),Pe=(0,d.useRef)(void 0),Fe=(0,d.useRef)(null),Ie=(0,d.useRef)([]),Le=(0,d.useRef)(V);Le.current=V;let Re=(0,d.useRef)(null),q=(0,d.useCallback)(e=>{try{localStorage.setItem(ie,String(e))}catch{}},[]),ze=(0,d.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=Le.current,r=Re.current?.getBoundingClientRect().width??0,i=n,a=e=>{i=ae(n+(e.clientX-t),r),Te(i)},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),document.body.classList.remove(`panel-resizing`),q(i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),document.body.classList.add(`panel-resizing`)},[q]),Be=(0,d.useCallback)(()=>{Te(300),q(300)},[q]),Ve=(0,d.useCallback)(e=>{if(e.reqId===je.current){if(je.current=-1,be(!1),I(null),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}if(e.notRepo){Ce(!0),b(null),S([]),pe(new Map),he([]),D(null),O(``),N(null);return}Ce(!1);let t={branch:e.branch??``,detached:!!e.detached,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,upstreamGone:!!e.upstreamGone,files:(e.files??[]).map(e=>({...e}))},n=(e.branches??[]).map(e=>({...e})),r=new Map;for(let[t,n]of Object.entries(e.stats??{}))r.set(t,{add:n[0],del:n[1]});b(t),S(n),pe(r),de(e=>t.detached?e||``:t.branch&&n.some(e=>e.name===t.branch)?t.branch:e&&n.some(t=>t.name===e)?e:n[0]?.name??``),N(e=>e&&!t.files.some(t=>t.path===e.file.path)?null:e)}else if(e.reqId===Me.current){if(Me.current=-1,P(!1),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}let t=Fe.current;if(!t)return;N({file:t,staged:e.stagedText??``,worktree:e.worktreeText??``,untracked:!1})}else if(e.reqId===G.current){if(G.current=-1,Se(!1),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}he((e.history??[]).map(e=>({...e})))}else if(e.reqId===Ne.current){if(Ne.current=-1,_e(!1),!e.ok){I(e.error??v(`scmQueryFailedShort`));return}O(e.text??``)}else if(e.reqId===K.current){if(K.current=-1,z(!1),!e.ok){B(e.error??v(`scmGenMsgFail`));return}B(null),U(e.text??``)}},[]);(0,d.useEffect)(()=>{let t=e.scmData;t&&t.type===`scm_data`&&Ve(t)},[e.scmData,Ve]);let J=(0,d.useCallback)((t,n)=>{if(!e.ready||e.status!==`open`)return!1;let r=++Ae.current;return ee({...t,reqId:r})?(n.current=r,!0):(--Ae.current,!1)},[e.ready,e.status]),Y=(0,d.useCallback)((t=!1,n=!1)=>{e.ready&&e.status===`open`&&e.state?.cwd&&(Pe.current!==void 0&&Pe.current!==e.state.cwd&&(b(null),S([]),pe(new Map),he([]),De(``),Se(!1),G.current=-1,D(null),O(``),N(null),j(null),B(null),z(!1),K.current=-1),Pe.current=e.state.cwd,I(null),J({type:`scm_status`},je)&&(n||be(!0)))},[e.ready,e.state?.cwd,e.status,J]),He=(0,d.useCallback)(e=>{if(j(e),D(null),Fe.current=e,e.x===`?`&&e.y===`?`){N({file:e,staged:``,worktree:``,untracked:!0});return}P(!0),I(null),J({type:`scm_filediff`,path:e.path},Me)||P(!1)},[J]),Ue=(0,d.useCallback)(e=>{D(e),j(null),N(null),O(``),_e(!0),I(null),J({type:`scm_commit`,hash:e.hash},Ne)||_e(!1)},[J]),X=(0,d.useCallback)((t,n)=>{if(!e.ready)return;let r={name:t,command:n,cwd:"${pwd}"},i,a=e.terminals.find(e=>e.title===t);a?(c.restart(a.id),ee({type:`run_command`,terminalId:a.id,conversationId:a.conversationId,command:r,cols:80,rows:24}),i=a.id):(i=ne(),c.create({id:i,conversationId:e.activeConversationId||e.state?.conversationId||``,title:t,cwd:e.state?.cwd??``,cols:80,rows:24,running:!0,exitCode:null,command:r})),c.select(i),f()},[e.ready,e.state?.cwd,e.terminals,f,c]),We=(0,d.useCallback)(()=>{let e=H.trim();if(!e||L)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git commit -m "${t}"`),ke(ce(e)),U(``),W.current=h},[H,L,X]),Ge=(0,d.useCallback)(()=>{let e=H.trim();if(!e||L)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git add -A && git commit -m "${t}"`),ke(ce(e)),U(``),W.current=h},[H,L,X]),Ke=(0,d.useCallback)(e=>{L||X(`git add`,`git add -- ${re(e.path)}`)},[L,X]),qe=(0,d.useCallback)(e=>{L||X(`git reset`,`git reset HEAD -- ${re(e.path)}`)},[L,X]),Je=(0,d.useCallback)(()=>{if(!C||L)return;let e=x.find(e=>e.name===C);if(e?.remote&&typeof e.remote==`string`){let t=C.slice(e.remote.length+1);X(`git checkout`,`git checkout -b ${t} ${C} || git checkout ${C}`)}else X(`git checkout`,`git checkout ${C}`)},[C,x,L,X]),Ye=(0,d.useCallback)(()=>X(`git push`,`git push`),[X]),Xe=(0,d.useCallback)(()=>X(`git pull`,`git pull`),[X]),Ze=(0,d.useCallback)(()=>{R||L||!e.ready||e.status!==`open`||(B(null),J({type:`scm_commitmsg`},K)?z(!0):B(v(`scmGenMsgFail`)))},[R,L,e.ready,e.status,J,v]),Z=(0,d.useCallback)(()=>{J({type:`scm_history`},G)||(G.current=-1)},[J]);(0,d.useEffect)(()=>{l&&Y()},[l,Y]),(0,d.useEffect)(()=>{w===`history`&&y&&Z()},[w,y,Z]),(0,d.useEffect)(()=>{e.scmDirty>0&&l&&Y(!1,!0)},[e.scmDirty]),(0,d.useEffect)(()=>{if(!l||!e.ready||e.status!==`open`)return;let t=setInterval(()=>{document.visibilityState!==`hidden`&&Y(!1,!0)},3e4);return()=>clearInterval(t)},[l,e.ready,e.status,Y]),(0,d.useEffect)(()=>{let t=Ie.current;Ie.current=e.terminals,l&&e.terminals.some(e=>e.running===!1&&t.find(t=>t.id===e.id)?.running===!0&&e.title.startsWith(`git `))&&e.ready&&e.status===`open`&&(Y(!1,!0),w===`history`&&y&&Z())},[e.terminals,l,e.ready,e.status,Y,w,y,Z]);let Qe={staged:v(`scmStaged`),unstaged:v(`scmUnstaged`),untracked:v(`scmUntracked`),both:v(`scmStagedUnstaged`)},$e=se(T,Ee),et=e=>{let t=e.split(`
|
|
2
2
|
`);return(0,g.jsx)(`pre`,{className:`scm-diff-pre`,children:t.map((e,t)=>{let n=``;return e.startsWith(`diff --git`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`similarity index`)||e.startsWith(`rename `)||e.startsWith(`copy `)||e.startsWith(`Binary files`)||e.startsWith(`---`)||e.startsWith(`+++`)?n=`hdr`:e.startsWith(`@@`)?n=`hunk`:e.startsWith(`+`)?n=`add`:e.startsWith(`-`)&&(n=`del`),(0,g.jsx)(`div`,{className:`scm-diff-line ${n}`,children:e||` `},t)})})},tt=p===void 0?[`host:scm-changes`,`host:scm-history`,`host:scm-refresh`,`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`,`host:scm-term`].map(e=>({id:e,source:`host`})):p.filter(e=>!e.hidden),nt=[`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`],rt=(e,t)=>{let n=new Set(e);return tt.filter(e=>n.has(e.id)||t&&e.source!==`host`)},it=e=>p===void 0||!p.some(t=>t.id===e&&t.hidden),Q=(e,t)=>{let n=tt.find(t=>t.id===e);return n?.labelExplicit?n.label:t},$={"host:scm-changes":(0,g.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":w===`changes`,className:w===`changes`?`active`:``,onClick:()=>{me(`changes`),I(null)},children:Q(`host:scm-changes`,v(`scmChanges`))}),"host:scm-history":(0,g.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":w===`history`,className:w===`history`?`active`:``,onClick:()=>{me(`history`),I(null)},children:Q(`host:scm-history`,v(`scmHistory`))}),"host:scm-refresh":(0,g.jsx)(`button`,{type:`button`,className:`panel-refresh`,title:v(`scmRefreshTip`),disabled:ye,onClick:()=>Y(!0),children:(0,g.jsx)(i,{className:ye?`scm-spin`:``})}),"host:scm-branch":(0,g.jsxs)(`select`,{className:`scm-select`,value:C,disabled:L||x.length===0,title:Q(`host:scm-branch`,v(`scmSwitchBranch`)),onChange:e=>de(e.target.value),children:[(0,g.jsx)(`option`,{value:``,disabled:!0,children:v(`scmSelectBranch`)}),x.filter(e=>!e.remote).map(e=>(0,g.jsx)(`option`,{value:e.name,children:e.current?`* ${e.name}`:e.name},e.name)),x.some(e=>e.remote)&&(0,g.jsx)(`optgroup`,{label:v(`scmRemoteBranches`),children:x.filter(e=>e.remote).map(e=>(0,g.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),"host:scm-switch":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!C||C===y?.branch||L,title:v(`scmSwitchBranchTip`,{branch:C}),onClick:Je,children:[(0,g.jsx)(s,{}),Q(`host:scm-switch`,v(`scmSwitch`))]}),"host:scm-push":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!y||y.detached||L,title:v(`scmPushTip`),onClick:Ye,children:[(0,g.jsx)(te,{}),Q(`host:scm-push`,v(`scmPush`))]}),"host:scm-pull":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!y||y.detached||L,title:v(`scmPullTip`),onClick:Xe,children:[(0,g.jsx)(a,{}),Q(`host:scm-pull`,v(`scmPull`))]}),"host:scm-input":(0,g.jsx)(`input`,{className:`scm-commit-input`,value:H,placeholder:v(`scmCommitPlaceholder`),disabled:L,title:Oe.length>0?v(`scmCommitHistoryTip`):void 0,onChange:e=>{U(e.target.value),W.current=h},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Enter`){We();return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){let t=le(Oe,W.current,H,e.key===`ArrowUp`?`up`:`down`);t&&(e.preventDefault(),W.current=t.state,U(t.text))}}}}),"host:scm-genmsg":(0,g.jsxs)(`button`,{type:`button`,className:`btn`,disabled:R||L||!y||y.files.length===0,title:v(`scmGenMsgTip`),onClick:Ze,children:[(0,g.jsx)(n,{className:R?`scm-spin`:``}),R?v(`scmGenMsgRunning`):Q(`host:scm-genmsg`,v(`scmGenMsg`))]}),"host:scm-commit":(0,g.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:!H.trim()||L,title:v(`scmCommitTip`),onClick:We,children:[(0,g.jsx)(t,{}),Q(`host:scm-commit`,v(`scmCommit`))]}),"host:scm-commit-all":(0,g.jsx)(`button`,{type:`button`,className:`btn`,disabled:!H.trim()||L,title:v(`scmCommitAllTip`),onClick:Ge,children:Q(`host:scm-commit-all`,v(`scmCommitAll`))})};return(0,g.jsxs)(`div`,{className:`scm-view`,children:[(0,g.jsxs)(`div`,{className:`scm-header`,children:[(0,g.jsxs)(`div`,{className:`scm-title-row`,children:[(0,g.jsxs)(`span`,{className:`scm-title`,children:[(0,g.jsx)(s,{}),v(`scmTitle`)]}),(0,g.jsx)(`div`,{className:`scm-view-tabs`,role:`tablist`,children:u(rt([`host:scm-changes`,`host:scm-history`],!1),$,_)}),u(rt([`host:scm-refresh`],!0),$,_)]}),(0,g.jsxs)(`div`,{className:`scm-row`,children:[(0,g.jsxs)(`span`,{className:`scm-branch-current`,title:v(`scmCurrentBranch`),children:[(0,g.jsx)(s,{}),y?y.detached?v(`scmDetached`):y.branch:`…`,y?.upstream&&(0,g.jsx)(`span`,{className:`scm-upstream`,children:y.upstreamGone?v(`scmUpstreamGone`):y.ahead>0||y.behind>0?v(`scmAheadBehind`,{ahead:y.ahead,behind:y.behind}):y.upstream})]}),u(rt(nt,!1),$,_)]}),we&&(0,g.jsx)(`div`,{className:`scm-gen-error`,role:`alert`,title:v(`close`),onClick:()=>B(null),children:we})]}),(0,g.jsxs)(`div`,{className:`scm-body`,ref:Re,style:{"--scm-sidebar-w":`${V}px`},children:[w===`history`?(0,g.jsxs)(`div`,{className:`scm-history`,children:[(0,g.jsxs)(`div`,{className:`scm-files-header`,children:[(0,g.jsx)(`span`,{children:v(`scmHistory`)}),T.length>0&&(0,g.jsx)(`span`,{className:`scm-files-count`,children:Ee.trim()?`${$e.length}/${T.length}`:T.length})]}),T.length>0&&!L&&(0,g.jsx)(`input`,{className:`scm-history-filter`,value:Ee,placeholder:v(`scmHistoryFilterPlaceholder`),title:v(`scmHistoryFilterTip`),onChange:e=>De(e.target.value)}),(0,g.jsx)(`div`,{className:`scm-history-list`,children:L?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNotGitRepo`)}):!y||xe?(0,g.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?v(`scmLoading`):v(`scmConnecting`)}):T.length===0?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNoHistory`)}):$e.length===0?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmHistoryFilterEmpty`)}):$e.map(e=>(0,g.jsxs)(`button`,{type:`button`,className:`scm-commit ${E?.hash===e.hash?`active`:``}`,onClick:()=>Ue(e),title:e.hash,children:[(0,g.jsx)(`span`,{className:`scm-commit-graph`,"aria-hidden":`true`,children:e.graph||`* `}),(0,g.jsxs)(`span`,{className:`scm-commit-info`,children:[(0,g.jsx)(`span`,{className:`scm-commit-subject`,children:e.subject}),(0,g.jsxs)(`span`,{className:`scm-commit-meta`,children:[e.shortHash,` · `,e.author,` · `,e.date]}),e.decorations&&(0,g.jsx)(`span`,{className:`scm-commit-refs`,children:e.decorations})]})]},e.hash))})]}):(0,g.jsxs)(`div`,{className:`scm-files`,children:[(0,g.jsxs)(`div`,{className:`scm-files-header`,children:[(0,g.jsx)(`span`,{children:v(`scmChanges`)}),y&&y.files.length>0&&(0,g.jsx)(`span`,{className:`scm-files-count`,children:y.files.length})]}),(0,g.jsx)(`div`,{className:`scm-files-list`,children:L?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNotGitRepo`)}):y?y.files.length===0?(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNoChanges`)}):y.files.map(e=>{let t=ue(e),n=fe.get(e.path);return(0,g.jsxs)(`div`,{className:`scm-file ${A?.path===e.path?`active`:``}`,title:Qe[t],onClick:()=>He(e),children:[(0,g.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`x`}`,children:e.x===` `?`\xA0`:e.x}),(0,g.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`y`}`,children:e.y===` `?`\xA0`:e.y}),(0,g.jsx)(`span`,{className:`scm-file-path`,children:e.path}),n&&(n.add>0||n.del>0)&&(0,g.jsxs)(`span`,{className:`scm-file-stat`,children:[n.add>0&&(0,g.jsxs)(`span`,{className:`add`,children:[`+`,n.add]}),n.del>0&&(0,g.jsxs)(`span`,{className:`del`,children:[`-`,n.del]})]}),(0,g.jsxs)(`span`,{className:`scm-file-actions`,children:[(e.y!==` `||t===`untracked`)&&(0,g.jsx)(`button`,{type:`button`,className:`scm-act`,title:v(`scmStageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),Ke(e)},children:`+`}),t===`staged`||t===`both`?(0,g.jsx)(`button`,{type:`button`,className:`scm-act`,title:v(`scmUnstageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),qe(e)},children:`−`}):null]})]},e.path)}):(0,g.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?v(`scmLoading`):v(`scmConnecting`)})})]}),(0,g.jsx)(`div`,{className:`scm-divider`,role:`separator`,"aria-orientation":`vertical`,title:v(`dragToResize`),onPointerDown:ze,onDoubleClick:Be}),(0,g.jsxs)(`div`,{className:`scm-diff`,children:[(0,g.jsxs)(`div`,{className:`scm-diff-header`,children:[(0,g.jsx)(`span`,{children:w===`history`?E?`${E.shortHash} ${E.subject}`:v(`scmCommitDetail`):A?A.path:v(`scmDiff`)}),(w===`history`?k:ve)&&(0,g.jsx)(`span`,{className:`scm-diff-loading`,children:v(`scmLoading`)})]}),(0,g.jsx)(`div`,{className:`scm-diff-body`,children:w===`history`?(0,g.jsxs)(g.Fragment,{children:[F&&(0,g.jsx)(`div`,{className:`scm-error`,children:F}),!E&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmSelectCommitHint`)}),E&&k&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmLoading`)}),E&&!k&&!F&&ge?et(ge):null]}):(0,g.jsxs)(g.Fragment,{children:[F&&(0,g.jsx)(`div`,{className:`scm-error`,children:F}),!A&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmSelectFileHint`)}),A&&!M&&!F&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmLoading`)}),A&&M&&M.untracked&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmUntrackedNote`)}),A&&M&&!M.untracked&&(0,g.jsxs)(g.Fragment,{children:[M.staged&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`scm-diff-section`,children:v(`scmStaged`)}),et(M.staged)]}),M.worktree&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`scm-diff-section`,children:v(`scmUnstaged`)}),et(M.worktree)]}),!M.staged&&!M.worktree&&(0,g.jsx)(`div`,{className:`scm-empty`,children:v(`scmNoDiff`)})]})]})})]})]}),(0,g.jsxs)(`div`,{className:`scm-hint`,children:[(0,g.jsx)(o,{}),(0,g.jsx)(`span`,{children:v(`scmRunsInTerminal`)}),it(`host:scm-term`)&&(0,g.jsx)(`button`,{type:`button`,className:`scm-goto-term`,onClick:f,children:Q(`host:scm-term`,v(`scmViewTerminal`))})]})]})}export{_ as ScmPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.modal-backdrop.settings-mobile-backdrop{align-items:stretch;padding:0}.settings-modal.is-mobile{height:100%;max-width:none;height:100dvh;max-height:none;padding:0;padding-top:max(8px, var(--safe-top,env(safe-area-inset-top,0px)));background:var(--bg);box-shadow:none;border:0;border-radius:0;gap:0;overflow:hidden}.settings-modal.is-mobile .modal-head.settings-cmd-head{border-bottom:1px solid var(--border-soft);background:var(--bg);flex-wrap:nowrap;flex-shrink:0;gap:6px;min-height:48px;padding:4px 8px}.settings-modal.is-mobile .settings-head-brand{flex:auto;gap:2px;min-width:0;overflow:hidden}.settings-modal.is-mobile .settings-head-brand h2{letter-spacing:-.2px;white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:650;overflow:hidden}.settings-modal.is-mobile .settings-head-brand .modal-head-icon,.settings-modal.is-mobile .settings-head-brand .set-tip{display:none}body:has(.settings-modal.is-mobile) .quick-ask-launcher{display:none}.settings-modal.is-mobile .settings-cmd-wrap,.settings-modal.is-mobile .settings-kbd-chip{display:none}.settings-modal.is-mobile .settings-head-actions{flex:none;gap:4px;margin-left:auto}.settings-mobile-back{width:44px;height:44px;color:var(--text);cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:12px;flex:none;place-items:center;margin-left:-6px;font-size:21px;display:grid}.settings-mobile-back:active{background:var(--fill-press,#7f7f7f29)}.settings-mobile-back:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.settings-modal.is-mobile .settings-layout{flex-direction:column;gap:0;min-height:0;margin:0}.settings-modal.is-mobile .settings-rail,.settings-modal.is-mobile.is-mobile-home .modal-head,.settings-modal.is-mobile.is-mobile-home .modal-body{display:none}.settings-modal.is-mobile .modal-body{padding:12px 12px calc(20px + env(safe-area-inset-bottom,0px));gap:16px}.settings-modal.is-mobile .modal-body>.set-section{border-radius:12px}.settings-modal.is-mobile .modal-body .set-row{min-height:52px}.sm-home{background:var(--bg);flex-direction:column;flex:auto;min-height:0;display:flex}.sm-head{flex:none;align-items:center;gap:10px;padding:4px 8px 2px 16px;display:flex}.sm-title{letter-spacing:-.6px;min-width:0;color:var(--text);flex:auto;margin:0;font-size:28px;font-weight:800;line-height:1.2}.sm-save{border-radius:999px;flex:none;height:26px}.sm-close{width:44px;height:44px;color:var(--text-dim);cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:12px;flex:none;place-items:center;margin-right:-6px;font-size:20px;display:grid}.sm-close:active{background:var(--fill-press,#7f7f7f29)}.sm-close:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.sm-search{background:var(--bg-elev2);border:1px solid var(--border-soft);min-height:44px;color:var(--text-faint);border-radius:11px;flex:none;align-items:center;gap:8px;margin:6px 16px 10px;padding:0 8px 0 10px;display:flex}.sm-search:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}.sm-search-icon{flex:none;font-size:16px}.sm-search-input{min-width:0;color:var(--text);font:inherit;background:0 0;border:0;outline:none;flex:auto;padding:9px 0;font-size:16px;line-height:1.4}.sm-search-input::placeholder{color:var(--text-faint)}.sm-search-input::-webkit-search-cancel-button{appearance:none;display:none}.sm-search-input::-webkit-search-decoration{appearance:none;display:none}.sm-search-clear{background:var(--fill-press,#7f7f7f29);width:28px;height:28px;color:var(--text-dim);cursor:pointer;border:0;border-radius:50%;flex:none;place-items:center;font-size:14px;display:grid}.sm-scroll{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;min-height:0;padding:2px 16px calc(24px + env(safe-area-inset-bottom,0px));flex-direction:column;flex:auto;gap:16px;display:flex;overflow-y:auto}.sm-group{flex-direction:column;gap:7px;display:flex}.sm-group-title{letter-spacing:.02em;color:var(--text-dim);margin:0;padding:0 4px;font-size:13px;font-weight:700}.sm-card{background:var(--bg-elev);border:1px solid var(--border-soft);border-radius:12px;overflow:hidden}.sm-row{width:100%;min-height:56px;color:var(--text);font:inherit;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;align-items:center;gap:12px;padding:8px 14px;transition:background .12s;display:flex;position:relative}.sm-row+.sm-row:before{content:"";background:var(--border-soft);height:1px;position:absolute;top:0;left:54px;right:0}.sm-row:active{background:var(--fill-press,#7f7f7f29)}.sm-row:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.sm-row-icon{background:var(--accent-soft);width:28px;height:28px;color:var(--accent);border-radius:8px;flex:none;place-items:center;font-size:15px;display:grid}[data-theme=light] .sm-row-icon{color:var(--accent);background:color-mix(in srgb, var(--accent) 12%, transparent)}.sm-row-main{flex-direction:column;flex:auto;gap:2px;min-width:0;display:flex}.sm-row-label{white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:500;line-height:1.3;overflow:hidden}.sm-row-crumb{color:var(--text-faint);white-space:nowrap;text-overflow:ellipsis;font-size:11.5px;line-height:1.3;overflow:hidden}.sm-row-value{max-width:40%;color:var(--text-dim);white-space:nowrap;text-overflow:ellipsis;flex:none;font-size:13px;overflow:hidden}.sm-count{background:var(--bg-elev2);border:1px solid var(--border-soft);min-width:20px;height:20px;color:var(--text-dim);font-variant-numeric:tabular-nums;border-radius:10px;flex:none;place-items:center;padding:0 6px;font-size:11.5px;font-weight:700;display:inline-grid}.sm-dot{background:var(--accent);border-radius:50%;flex:none;width:7px;height:7px}.sm-chev{width:16px;height:16px;color:var(--text-faint);flex:none}.sm-empty{text-align:center;flex-direction:column;align-items:center;gap:10px;padding:40px 20px;display:flex}.sm-empty-title{color:var(--text);font-size:14px;font-weight:600}.sm-empty-btn{border:1px solid var(--border);background:var(--bg-elev);min-height:44px;color:var(--text);font:inherit;cursor:pointer;border-radius:10px;padding:0 16px;font-size:13px;font-weight:600}@media (max-width:340px){.sm-head{padding-left:12px}.sm-search{margin-left:12px;margin-right:12px}.sm-scroll{padding-left:12px;padding-right:12px}.sm-row{gap:10px;padding-left:12px;padding-right:12px}.sm-row+.sm-row:before{left:50px}.sm-row-label{font-size:15px}}
|