@yuriai/web 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/assets/{AgentAvatar-1UO8KpCd.js → AgentAvatar-D6H7fWWf.js} +1 -1
- package/dist/assets/{AssistantView-D4pGrXQ2.js → AssistantView-CLk1T4Of.js} +3 -3
- package/dist/assets/{DiagramView-ClqTTADy.js → DiagramView-BXVAioBW.js} +1 -1
- package/dist/assets/{FadeInOnReveal-BsRKluhI.js → FadeInOnReveal-eVZbrwte.js} +1 -1
- package/dist/assets/{Icon-jsQQXouE.js → Icon-2cKLcXGe.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-CGHGcrEo.js → ImageLoadingPlaceholder-DmCEIw55.js} +1 -1
- package/dist/assets/{LoadingImage-BG9q4Tm_.js → LoadingImage-B-cD_lfU.js} +1 -1
- package/dist/assets/{MarkdownRenderer-CnHu4XPA.js → MarkdownRenderer-BY7SOGeo.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-BsnfVIC9.js → MarkdownRendererImpl-KSaMBtRF.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-Cmzb7xFE.js → MarkstreamRendererImpl-BvkGmuQ6.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-OWYq5ZOS.js → MobileDetailNavigation-DACAHTpS.js} +1 -1
- package/dist/assets/{MobileShareBridge-DukiyCpU.js → MobileShareBridge-DLPBToEM.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-Cp_gk7cy.js → MobileTabPageHeader-CvtrPaC2.js} +1 -1
- package/dist/assets/{MultiRunWindow-kOpD2Th8.js → MultiRunWindow-4G9PetNl.js} +1 -1
- package/dist/assets/{OnboardingScreen-DTr_WxYY.js → OnboardingScreen-CG2xI_UT.js} +1 -1
- package/dist/assets/{OverlayScrollbar-C4VUlRzo.js → OverlayScrollbar-piA-chKb.js} +1 -1
- package/dist/assets/{SettingsView-CNxbrxjd.js → SettingsView-pRXWe1jD.js} +3 -3
- package/dist/assets/{SettingsWindow-B_Fgbas9.js → SettingsWindow-DGK3Earv.js} +1 -1
- package/dist/assets/{TerminalView-Cz3XX-pa.js → TerminalView-CagyLr39.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Ck3maV4e.js → ToolOutputDialog-DHukIjoH.js} +1 -1
- package/dist/assets/{appThemeRegistry-8PNdkIWO.js → appThemeRegistry-U9eZywBt.js} +1 -1
- package/dist/assets/{button-C3292Ee6.js → button-_ReBqWzC.js} +1 -1
- package/dist/assets/{capgoAdapter-CnsewE-n.js → capgoAdapter-ChF9Cg3G.js} +1 -1
- package/dist/assets/{collapsible-B0yvtXQR.js → collapsible-BRKOX_ML.js} +1 -1
- package/dist/assets/{diagram-Ddq5F6R_.js → diagram-C9F3kAJt.js} +1 -1
- package/dist/assets/{dialog-DrgcVFLG.js → dialog-NsOVcGdh.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-CeLR2UTs.js → dropdown-menu.styles-CjPDePJF.js} +1 -1
- package/dist/assets/{es-D0ZhEIQm.js → es-Cu6zoTXv.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-CRG8r4mq.js → fileMentionTouchSelection-Bip-B2J9.js} +1 -1
- package/dist/assets/{fr-Cx3Hkjq_.js → fr-DA4Apf6C.js} +1 -1
- package/dist/assets/{gitApi-2OimpBnB.js → gitApi-BN0aozGg.js} +1 -1
- package/dist/assets/{input-DaOOTCQd.js → input-BI3Ya8O_.js} +1 -1
- package/dist/assets/{insertionBoundaries-DEY-uxCq.js → insertionBoundaries-gfsrexDz.js} +1 -1
- package/dist/assets/{ja-BRvZxcKF.js → ja-DHQdrjZd.js} +1 -1
- package/dist/assets/{ko-HRfDZwXS.js → ko-DbAl47mv.js} +1 -1
- package/dist/assets/{main-y7Aekp2v.js → main-C8xj4UeZ.js} +2 -2
- package/dist/assets/{main-D_ttGvxI.js → main-CjjADMt-.js} +4 -4
- package/dist/assets/{markdownHeightCache-BwSTMSRn.js → markdownHeightCache-CHFSvA8u.js} +1 -1
- package/dist/assets/{mcpQueries-Qx_eVfxx.js → mcpQueries-DJCrzyc3.js} +1 -1
- package/dist/assets/{miniChat-DcATvJc9.js → miniChat-D17acnB9.js} +2 -2
- package/dist/assets/{mobile-CfPAWSXr.js → mobile-DiL1n1m5.js} +2 -2
- package/dist/assets/{mobileBackNavigation-B_aT7hZA.js → mobileBackNavigation-B1NT3K0K.js} +1 -1
- package/dist/assets/{multirun-B2GaFlNf.js → multirun-D2KlubbP.js} +1 -1
- package/dist/assets/{native-config-Cu2rtzKa.js → native-config-D9DfX51I.js} +1 -1
- package/dist/assets/{pl-CxLc1wGT.js → pl-CogXecG6.js} +1 -1
- package/dist/assets/{projectMeta-CfvCStpj.js → projectMeta-B5lVMdxF.js} +1 -1
- package/dist/assets/{pt-BR-D4Lpwv4-.js → pt-BR-Ditt0LyE.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-D0v1rp6C.js → renderElectronMiniChatApp-DQGRyvOy.js} +2 -2
- package/dist/assets/{renderMobileApp-1NEaEWn6.js → renderMobileApp-BlCyG-WF.js} +4 -4
- package/dist/assets/{runtimeConfig-CE0t2CEh.js → runtimeConfig-MKo97i27.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BPBRlu2g.js → runtimeEndpointReset-DrO__UOn.js} +2 -2
- package/dist/assets/{scheduledTaskNavigation-C6UYwVbD.js → scheduledTaskNavigation-DUskP6qh.js} +1 -1
- package/dist/assets/{sessionChangeSummary-C8fjiAIl.js → sessionChangeSummary-DN7H-rqE.js} +1 -1
- package/dist/assets/{sessionLookup-CxeDvyRN.js → sessionLookup-DezY-ONT.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-BMrSDJob.js → sortable-tabs-strip-Benojjgi.js} +1 -1
- package/dist/assets/{speechSettingsQueries-L-IonKwV.js → speechSettingsQueries-DFAUd_Aw.js} +1 -1
- package/dist/assets/{store-CZu30-QE.js → store-szlu5Wxv.js} +2 -2
- package/dist/assets/{textarea-BcA4uouw.js → textarea-C5vjnZcE.js} +1 -1
- package/dist/assets/{tooltip-DGUZtHif.js → tooltip-C73L9gDf.js} +1 -1
- package/dist/assets/{types-0GGhodUf.js → types-DZcrt4Z0.js} +1 -1
- package/dist/assets/{uk-BdjdFLjV.js → uk-DFoTnIxi.js} +1 -1
- package/dist/assets/{useAppFontEffects-BzvaFRBa.js → useAppFontEffects-DUPuwJH5.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-B7YLipUA.js → useDesktopWindowControlsLayout-Co_z6hbP.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-BkXDzQaJ.js → useEffectiveDirectory-DXPmcf8E.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-CjhF9j5V.js → useMobileNavigationStore-DcG6Ukmu.js} +6 -6
- package/dist/assets/{useWorkerHighlightedLines-C-BpvG5l.js → useWorkerHighlightedLines-BnmJy3ZO.js} +1 -1
- package/dist/assets/{zh-CN-BIC0OlRu.js → zh-CN-Cw2OYvFl.js} +1 -1
- package/dist/assets/{zh-TW-Bavvf14t.js → zh-TW-CPuXOw_f.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +1 -1
- package/server/lib/content-search/DOCUMENTATION.md +5 -1
- package/server/lib/opencode/DOCUMENTATION.md +8 -7
- package/server/lib/opencode/config-entity-routes.js +5 -1
- package/server/lib/opencode/config-entity-routes.test.js +23 -0
- package/server/lib/opencode/ensure-cli.js +48 -11
- package/server/lib/opencode/ensure-cli.test.js +53 -1
- package/server/lib/opencode/env-runtime.js +5 -5
- package/server/lib/opencode/terminal-path.js +67 -0
- package/server/lib/opencode/terminal-path.test.js +68 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Q as t,X as n,Y as r,Z as i,et as a,it as o,rt as s}from"./vendor-base-ui-CdzJ6My_.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{f as l,r as u}from"./button-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Q as t,X as n,Y as r,Z as i,et as a,it as o,rt as s}from"./vendor-base-ui-CdzJ6My_.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{f as l,r as u}from"./button-_ReBqWzC.js";import{n as d}from"./Icon-2cKLcXGe.js";import{t as f}from"./multirun-D2KlubbP.js";var p=c(),m=e(o(),1),h=s(),g=e=>{let o=(0,p.c)(33),{open:s,onOpenChange:c,initialPrompt:g}=e,v=m.useId(),{t:y}=l(),b=_,x;o[0]===c?x=o[1]:(x=e=>{!e&&b()||c(e)},o[0]=c,o[1]=x);let S;o[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,h.jsx)(a,{className:u(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),o[2]=S):S=o[2];let C;o[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=u(`relative pointer-events-auto`,`w-[90vw] max-w-[720px] h-[680px] max-h-[85vh]`,`flex flex-col rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`),o[3]=C):C=o[3];let w;o[4]===c?w=o[5]:(w=()=>c(!1),o[4]=c,o[5]=w);let T;o[6]===y?T=o[7]:(T=y(`multiRun.window.actions.closeAria`),o[6]=y,o[7]=T);let E;o[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,h.jsx)(d,{name:`close`,className:`h-5 w-5`}),o[8]=E):E=o[8];let D;o[9]!==w||o[10]!==T?(D=(0,h.jsx)(`div`,{className:`absolute right-0.5 top-0.5 z-50`,children:(0,h.jsx)(`button`,{type:`button`,onClick:w,"aria-label":T,className:`inline-flex h-7 w-7 items-center justify-center rounded-md p-0.5 text-muted-foreground hover:text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:E})}),o[9]=w,o[10]=T,o[11]=D):D=o[11];let O;o[12]===y?O=o[13]:(O=y(`multiRun.window.description`),o[12]=y,o[13]=O);let k;o[14]!==v||o[15]!==O?(k=(0,h.jsx)(t,{id:v,className:`sr-only`,children:O}),o[14]=v,o[15]=O,o[16]=k):k=o[16];let A,j;o[17]===c?(A=o[18],j=o[19]):(A=()=>c(!1),j=()=>c(!1),o[17]=c,o[18]=A,o[19]=j);let M;o[20]!==g||o[21]!==A||o[22]!==j?(M=(0,h.jsx)(f,{initialPrompt:g,onCreated:A,onCancel:j,isWindowed:!0}),o[20]=g,o[21]=A,o[22]=j,o[23]=M):M=o[23];let N;o[24]!==v||o[25]!==M||o[26]!==D||o[27]!==k?(N=(0,h.jsxs)(n,{children:[S,(0,h.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,h.jsxs)(i,{"aria-describedby":v,className:C,children:[D,k,M]})})]}),o[24]=v,o[25]=M,o[26]=D,o[27]=k,o[28]=N):N=o[28];let P;return o[29]!==s||o[30]!==x||o[31]!==N?(P=(0,h.jsx)(r,{open:s,onOpenChange:x,children:N}),o[29]=s,o[30]=x,o[31]=N,o[32]=P):P=o[32],P};function _(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{g as MultiRunWindow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./queryRuntime-DKGLQtb9.js";import{Cn as n,en as r,hn as i,i as a,pn as o}from"./persistence-Dzooc9Xg.js";import{_ as s,h as c,i as l,n as u,r as d}from"./desktopHosts-BDyl2P7W.js";import{it as f,rt as p}from"./vendor-base-ui-CdzJ6My_.js";import{n as m}from"./vendor-react-BP2cRVqX.js";import{d as h,f as g,r as _,t as v}from"./button-C3292Ee6.js";import{n as y}from"./Icon-jsQQXouE.js";import{o as b,r as x}from"./dialog-DrgcVFLG.js";import{t as S}from"./input-DaOOTCQd.js";var C=m(),w=e(f(),1),T=p();function E(e){switch(e){case`ok`:return null;case`auth`:return`onboarding.remoteConnection.probe.authMessage`;case`update-recommended`:return`onboarding.remoteConnection.probe.updateRecommendedMessage`;case`incompatible`:return`onboarding.remoteConnection.probe.incompatibleMessage`;case`wrong-service`:return`onboarding.remoteConnection.probe.wrongServiceMessage`;case`unreachable`:return`onboarding.remoteConnection.probe.unreachableMessage`;default:return null}}function D(e){return e===`wrong-service`||e===`unreachable`||e===`incompatible`}function O({onBack:e,showBackButton:t=!0,initialUrl:n=``,initialLabel:a=``,isRecoveryMode:o=!1,onConnect:c,onSwitchToLocal:f}){let{t:p}=g(),[m,h]=(0,w.useState)(n),[_,y]=(0,w.useState)(a),[b,x]=(0,w.useState)(`idle`),[C,O]=(0,w.useState)(null),[k,A]=(0,w.useState)(``),j=s(m),M=j?.persistedUrl??null,N=(0,w.useCallback)(e=>{h(e.target.value),x(`idle`),O(null),A(``)},[]),P=(0,w.useCallback)(e=>{y(e.target.value)},[]),F=(0,w.useCallback)(async()=>{if(M){x(`testing`),O(null),A(``);try{let e=await u(M);O(e),x(e.status===`ok`||e.status===`update-recommended`?`success`:`error`)}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.connectionTestFailed`)),x(`error`)}}},[M,p]),I=(0,w.useCallback)(async()=>{if(!j)return;let e=j.persistedUrl;x(`testing`),O(null),A(``);try{let t=await u(e);if(O(t),D(t.status)){x(`error`);return}let n=await d(),a=_.trim()||e,o=n.hosts.find(t=>t.url===e),s=o?o.id:`host-${Date.now().toString(16)}`,f={id:s,label:a,url:e,apiUrl:e},p=o?n.hosts.map(e=>e.id===s?f:e):[...n.hosts,f];if(await l({hosts:p,defaultHostId:s,initialHostChoiceCompleted:!0}),c?.(),j.redeemUrl){window.location.assign(j.redeemUrl);return}r()&&await i()}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.failedToSaveConnection`)),x(`error`)}},[j,_,c,p]),L=b===`testing`,R=M!==null&&!L,z=M!==null&&!L&&!D(C?.status??null),B=E(C?.status??null),V=C?.status===`ok`,H=C?.status===`update-recommended`,U=C?.status===`auth`,W=D(C?.status??null);return(0,T.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,T.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[t&&(0,T.jsx)(`div`,{className:`flex items-center`,children:(0,T.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:p(`onboarding.common.actions.back`)})}),(0,T.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,T.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:p(o?`onboarding.remoteConnection.titleRecovery`:`onboarding.remoteConnection.title`)}),(0,T.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:p(`onboarding.remoteConnection.description`)})]}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`label`,{htmlFor:`remote-url`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.serverAddress`)}),(0,T.jsx)(S,{id:`remote-url`,type:`url`,value:m,onChange:N,placeholder:p(`onboarding.remoteConnection.field.serverAddressPlaceholder`),disabled:L})]}),(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`label`,{htmlFor:`remote-label`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.nameOptional`)}),(0,T.jsx)(S,{id:`remote-label`,type:`text`,value:_,onChange:P,placeholder:p(`onboarding.remoteConnection.field.namePlaceholder`),disabled:L})]})]}),C&&V&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-success)`,color:`var(--status-success)`},children:p(`onboarding.remoteConnection.status.connectedSuccessfully`,{latencyMs:C.latencyMs})}),C&&U&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:p(`onboarding.remoteConnection.status.authWarning`)}),C&&H&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:B?p(B):null}),C&&W&&(0,T.jsxs)(`div`,{className:`rounded-lg border p-3 text-sm space-y-3`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`font-semibold mb-1`,children:p(`onboarding.remoteConnection.status.connectionFailed`)}),(0,T.jsx)(`div`,{className:`opacity-90`,children:B?p(B):null})]}),(0,T.jsx)(`div`,{className:`text-xs opacity-80`,children:C.status===`unreachable`?p(`onboarding.remoteConnection.status.suggestionsUnreachable`):p(`onboarding.remoteConnection.status.suggestionsWrongService`)})]}),k&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:k}),(0,T.jsxs)(`div`,{className:`flex gap-3`,children:[(0,T.jsx)(v,{variant:`outline`,onClick:F,disabled:!R,children:p(L?`onboarding.remoteConnection.actions.testing`:`onboarding.remoteConnection.actions.testConnection`)}),(0,T.jsx)(v,{onClick:I,disabled:!z,children:p(`onboarding.remoteConnection.actions.connectAndRestart`)})]}),W&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t border-border`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:p(`onboarding.remoteConnection.actions.whatToDo`)}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(v,{variant:`outline`,size:`sm`,onClick:e,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.chooseDifferentServer`)}),!o&&f&&(0,T.jsx)(v,{variant:`outline`,size:`sm`,onClick:f,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.useLocalInstead`)})]})]})]})})}async function k(){let e=await t(`/health`);if(!e.ok)return!1;let n=await e.json().catch(()=>null);return n?.openCodeRunning===!0||n?.isOpenCodeReady===!0}async function A(){return(await t(`/api/opencode/retry`,{method:`POST`})).ok?k():!1}var j=`curl -fsSL https://opencode.ai/v2/install | bash`,M=`https://opencode.ai/docs`,N=2500,P=1e4;function F(e){let t=(0,C.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,T.jsxs)(`code`,{className:`flex-1 text-left overflow-x-auto whitespace-nowrap`,children:[(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,T.jsx)(y,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full`,children:[i,(0,T.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:r,"aria-label":r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}function I({onCliAvailable:e}){let{t:s}=g(),[c,u]=w.useState(!1),[f,p]=w.useState(!1),[m,b]=w.useState(!1),[x,C]=w.useState(!1),[E,D]=w.useState(``),[I,L]=w.useState(`unknown`),[R,z]=w.useState(`local`),[B,V]=w.useState(!1),[H,U]=w.useState(!1),[W,G]=w.useState(null),K=w.useRef(!1);w.useEffect(()=>{p(r())},[]),w.useEffect(()=>{if(typeof navigator>`u`){L(`unknown`);return}let e=navigator.userAgent||``;/Windows/i.test(e)?L(`windows`):/Macintosh|Mac OS X/i.test(e)?L(`macos`):/Linux/i.test(e)?L(`linux`):L(`unknown`)},[]),w.useEffect(()=>{let e=!1;return(async()=>{try{let n=await t(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json().catch(()=>null);if(!r||e)return;let i=typeof r.opencodeBinary==`string`?r.opencodeBinary.trim():``;i&&D(i)}catch{}})(),()=>{e=!0}},[]);let q=w.useCallback(async e=>{let t=e.target;t.closest(`.app-region-no-drag`)||t.closest(`button, a, input, select, textarea, code, summary, details`)||e.button===0&&f&&await n()},[f]),J=w.useCallback(async e=>{if(!f)return;let t=await d();await l({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})},[f]),Y=w.useCallback(async()=>{if(!K.current){K.current=!0;try{f&&await J(`local`),await e?.()}catch(e){throw K.current=!1,e}}},[f,e,J]);w.useEffect(()=>{if(R!==`local`)return;let e=!1,t=null,n=0,r=async()=>{if(!e){try{let t=await k(),r=Date.now();if(!t&&r-n>=P&&(n=r,t=await A()),e)return;if(t){await Y();return}}catch{}e||(t=setTimeout(r,N))}};return t=setTimeout(r,N),()=>{e=!0,t&&clearTimeout(t)}},[R,Y]);let X=w.useCallback(async()=>{C(!0),G(null);try{let e=await k();e||=await A(),e?await Y():G(s(`onboarding.localSetup.errors.cliNotReady`))}catch{G(s(`onboarding.localSetup.errors.detectionFailed`))}finally{C(!1)}},[Y,s]),Z=w.useCallback(async()=>{if(!(typeof window>`u`)&&f)try{let e=await o();e.success&&e.path&&e.path.trim().length>0&&D(e.path.trim())}catch{}},[f]),Q=w.useCallback(async()=>{b(!0);try{if(await a({opencodeBinary:E.trim()}),f){await J(`local`),await i();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>b(!1),1e3)}},[f,E,J]),$=w.useCallback(async()=>{let e=await h(j);e.ok?(u(!0),setTimeout(()=>u(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),ee=M,te=I===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:I===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`,ne=!f||R===`local`;return(0,T.jsx)(`div`,{className:`app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto`,onMouseDown:q,children:(0,T.jsxs)(`div`,{className:`w-full max-w-md space-y-7`,children:[(0,T.jsxs)(`header`,{className:`text-center space-y-1.5`,children:[(0,T.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground`,children:s(`onboarding.chooser.title`)}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`onboarding.chooser.description`)})]}),f&&(0,T.jsxs)(`div`,{className:`app-region-no-drag flex gap-1.5`,children:[(0,T.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`local`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`local`),children:s(`onboarding.chooser.tabs.localInstall`)}),(0,T.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`remote`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`remote`),children:s(`onboarding.chooser.tabs.connectRemote`)})]}),f&&R===`remote`?(0,T.jsx)(`div`,{className:`app-region-no-drag`,children:(0,T.jsx)(O,{onBack:()=>z(`local`),showBackButton:!1,onSwitchToLocal:()=>z(`local`)})}):null,ne&&(0,T.jsxs)(`div`,{className:`space-y-4`,children:[I===`windows`&&(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-4`,children:[(0,T.jsx)(`div`,{className:`text-sm text-foreground`,children:s(`onboarding.localSetup.windows.title`)}),(0,T.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground text-center leading-relaxed`,children:s(`onboarding.localSetup.intro`)}),(0,T.jsx)(`div`,{className:`app-region-no-drag rounded-lg border border-border bg-background/60 backdrop-blur-sm px-4 py-3 font-mono text-sm`,children:c?(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--status-success)`},children:[(0,T.jsx)(y,{name:`check`,className:`h-4 w-4`}),s(`onboarding.common.status.copiedToClipboard`)]}):(0,T.jsx)(F,{onCopy:$,copyTitle:s(`onboarding.common.copyToClipboard`)})}),(0,T.jsxs)(`div`,{className:`app-region-no-drag flex items-center justify-between`,children:[(0,T.jsxs)(`a`,{href:ee,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1`,children:[s(I===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,T.jsx)(y,{name:`external-link`,className:`h-3 w-3`})]}),(0,T.jsx)(`button`,{type:`button`,onClick:X,disabled:x,className:`text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,children:s(x?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkNow`)})]}),W&&(0,T.jsx)(`p`,{role:`alert`,className:`text-center text-xs text-[var(--status-error-foreground)]`,children:W}),(0,T.jsxs)(`div`,{className:`rounded-lg border px-4 py-3 flex items-center gap-3`,style:{borderColor:`color-mix(in srgb, var(--primary-base) 20%, transparent)`,backgroundColor:`color-mix(in srgb, var(--primary-base) 6%, transparent)`},role:`status`,"aria-live":`polite`,children:[(0,T.jsxs)(`span`,{className:`relative inline-flex h-2.5 w-2.5 shrink-0`,"aria-hidden":!0,children:[(0,T.jsx)(`span`,{className:`absolute inset-0 rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity 1.6s ease-in-out infinite`}}),(0,T.jsx)(`span`,{className:`absolute inset-[-4px] rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity-dim 1.6s ease-in-out infinite`,opacity:0}})]}),(0,T.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,T.jsx)(`div`,{className:`text-sm text-foreground leading-tight`,children:s(`onboarding.localSetup.status.watching`)}),(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground leading-tight mt-0.5`,children:s(`onboarding.localSetup.status.autoContinue`)})]})]}),(0,T.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:B,onToggle:e=>V(e.currentTarget.open),children:[(0,T.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,T.jsx)(`span`,{children:s(`onboarding.localSetup.advanced.title`)}),(0,T.jsx)(y,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,T.jsxs)(`div`,{className:`pb-4 space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(S,{value:E,onChange:e=>D(e.target.value),placeholder:te,disabled:m,className:`flex-1 font-mono text-xs`}),(0,T.jsx)(v,{type:`button`,variant:`secondary`,size:`sm`,onClick:Z,disabled:m||!f,children:s(`onboarding.localSetup.actions.browse`)}),(0,T.jsx)(v,{type:`button`,size:`sm`,onClick:Q,disabled:m||!E.trim(),children:s(`onboarding.localSetup.actions.apply`)})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:s(`onboarding.localSetup.helper.saveAndReload`)})]})]}),(0,T.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:H,onToggle:e=>U(e.currentTarget.open),children:[(0,T.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,T.jsx)(`span`,{children:s(`onboarding.localSetup.troubleshoot.title`)}),(0,T.jsx)(y,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,T.jsx)(`ul`,{className:`pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4`,children:I===`windows`?(0,T.jsx)(T.Fragment,{children:(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.hint.ensurePath`)}),(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.hint.setEnv`)}),(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.hint.missingRuntime`)})]})})]})]})]})})}var L=`curl -fsSL https://opencode.ai/v2/install | bash`,R=`https://opencode.ai/docs`;function z(e){let t=(0,C.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,T.jsxs)(`code`,{children:[(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,T.jsx)(y,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,T.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[i,(0,T.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors`,title:r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}var B=3e4;function V({onBack:e,onCliAvailable:s,isFromRecovery:c=!1,onSwitchToRemote:l}){let{t:u}=g(),[d,f]=w.useState(!1),[p,m]=w.useState(!1),[_,b]=w.useState(!1),[x,C]=w.useState(!1),[E,D]=w.useState(!1),[O,j]=w.useState(null),[M,N]=w.useState(``),[P,F]=w.useState(`unknown`);w.useEffect(()=>{let e=setTimeout(()=>m(!0),B);return()=>clearTimeout(e)},[]),w.useEffect(()=>{b(r())},[]),w.useEffect(()=>{if(typeof navigator>`u`){F(`unknown`);return}let e=navigator.userAgent||``;if(/Windows/i.test(e)){F(`windows`);return}if(/Macintosh|Mac OS X/i.test(e)){F(`macos`);return}if(/Linux/i.test(e)){F(`linux`);return}F(`unknown`)},[]),w.useEffect(()=>{let e=!1;return(async()=>{try{let n=await t(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json().catch(()=>null);if(!r||e)return;let i=typeof r.opencodeBinary==`string`?r.opencodeBinary.trim():``;i&&N(i)}catch{}})(),()=>{e=!0}},[]);let I=w.useCallback(async e=>{e.target.closest(`button, a, input, select, textarea, code`)||e.button===0&&_&&await n()},[_]),V=w.useCallback(async()=>{if(!(typeof window>`u`)&&_)try{let e=await o();e.success&&e.path&&e.path.trim().length>0&&N(e.path.trim())}catch{}},[_]),H=w.useCallback(async()=>{C(!0);try{if(await a({opencodeBinary:M.trim()}),_){await i();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>C(!1),1e3)}},[_,M]),U=w.useCallback(async()=>{let e=await h(L);e.ok?(f(!0),setTimeout(()=>f(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),W=w.useCallback(async()=>{D(!0),j(null);try{let e=await k();e||=await A(),e?s?.():j(u(`onboarding.localSetup.errors.cliNotReady`))}catch(e){j(e instanceof Error?e.message:u(`onboarding.localSetup.errors.detectionFailed`))}finally{D(!1)}},[s,u]),G=R,K=P===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:P===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`;return(0,T.jsxs)(`div`,{className:`h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none`,onMouseDown:I,children:[(0,T.jsxs)(`div`,{className:`w-full max-w-lg space-y-4 text-center`,children:[(0,T.jsx)(`div`,{className:`flex items-center`,children:(0,T.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:u(`onboarding.common.actions.back`)})}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:u(`onboarding.localSetup.title`)}),(0,T.jsx)(`p`,{className:`text-muted-foreground`,children:u(`onboarding.localSetup.description`)})]}),P===`windows`&&(0,T.jsxs)(`div`,{className:`mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left`,children:[(0,T.jsx)(`div`,{className:`text-sm text-foreground`,children:u(`onboarding.localSetup.windows.title`)}),(0,T.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,T.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,T.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,T.jsx)(`div`,{className:`flex justify-center`,children:(0,T.jsx)(`div`,{className:`bg-background/60 backdrop-blur-sm border border-border rounded-lg px-5 py-3 font-mono text-sm w-fit`,children:d?(0,T.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,style:{color:`var(--status-success)`},children:[(0,T.jsx)(y,{name:`check`,className:`h-4 w-4`}),u(`onboarding.common.status.copiedToClipboard`)]}):(0,T.jsx)(z,{onCopy:U,copyTitle:u(`onboarding.common.copyToClipboard`)})})}),(0,T.jsxs)(`a`,{href:G,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1 justify-center`,children:[u(P===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,T.jsx)(y,{name:`external-link`,className:`h-3 w-3`})]}),O&&(0,T.jsx)(`div`,{className:`mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive`,children:O}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(v,{type:`button`,onClick:W,disabled:E,className:`w-full max-w-xs`,size:`lg`,children:u(E?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkAndContinue`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u(`onboarding.localSetup.helper.checkAndContinue`)})]}),(0,T.jsx)(`div`,{className:`mx-auto w-full max-w-xl pt-4`,children:(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u(`onboarding.localSetup.field.alreadyInstalled`)}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(S,{value:M,onChange:e=>N(e.target.value),placeholder:K,disabled:x,className:`flex-1 font-mono text-xs`}),(0,T.jsx)(v,{type:`button`,variant:`secondary`,onClick:V,disabled:x||!_,children:u(`onboarding.localSetup.actions.browse`)}),(0,T.jsx)(v,{type:`button`,onClick:H,disabled:x,children:u(`onboarding.localSetup.actions.apply`)})]}),(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:u(`onboarding.localSetup.helper.saveAndReload`)})]})}),c&&l&&(0,T.jsxs)(`div`,{className:`text-center pt-4`,children:[(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:u(`onboarding.localSetup.remotePreference`)}),(0,T.jsx)(v,{variant:`link`,onClick:l,children:u(`onboarding.localSetup.actions.connectRemoteServer`)})]})]}),p&&(0,T.jsx)(`div`,{className:`absolute bottom-8 left-0 right-0 text-center space-y-1`,children:P===`windows`?(0,T.jsx)(T.Fragment,{children:(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.ensurePath`)}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.setEnv`)}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.missingRuntime`)})]})})]})}function H(e,t){if(e?.trim())return c(e.trim());if(t)return c(t)}function U(e,t,n){switch(e){case`local-unavailable`:return{title:`Local OpenCode Unavailable`,description:`OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.`,titleKey:`onboarding.desktopRecovery.localUnavailable.title`,descriptionKey:`onboarding.desktopRecovery.localUnavailable.description`,iconKey:`local`,showRetry:!0,retryLabel:`Retry Local`,retryLabelKey:`onboarding.desktopRecovery.localUnavailable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Set Up Local`,useLocalLabelKey:`onboarding.desktopRecovery.localUnavailable.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-missing`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-unreachable`:{let e=H(t,n);return{title:`Remote Server Unreachable`,description:`Could not connect to "${e||`the remote server`}". Check your network connection and verify the server address.`,titleKey:`onboarding.desktopRecovery.remoteUnreachable.title`,descriptionKey:`onboarding.desktopRecovery.remoteUnreachable.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-wrong-service`:{let e=H(t,n);return{title:`Incompatible Server`,description:`The server at "${e||`unknown`}" is not running Yuri. Verify the address points to an Yuri server.`,titleKey:`onboarding.desktopRecovery.incompatibleServer.title`,descriptionKey:`onboarding.desktopRecovery.incompatibleServer.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-incompatible`:{let e=H(t,n);return{title:`Server Update Required`,description:`The Yuri server at "${e||`unknown`}" is not compatible with this app version. Update Yuri on the server, then try again.`,titleKey:`onboarding.desktopRecovery.remoteIncompatible.title`,descriptionKey:`onboarding.desktopRecovery.remoteIncompatible.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`missing-default-host`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};default:throw Error(`Unknown recovery variant: ${e}`)}}function W(e){switch(e){case`local`:return(0,T.jsx)(y,{name:`macbook`,className:`h-8 w-8`});case`remote`:return(0,T.jsx)(y,{name:`server`,className:`h-8 w-8`})}}function G({variant:e,hostLabel:t,hostUrl:n,onRetry:r,onUseLocal:i,onUseRemote:a,isRetrying:o=!1}){let{t:s}=g(),l=U(e,t,n),u=l.retryLabelKey??`onboarding.desktopRecovery.actions.retryConnection`,d=w.useMemo(()=>{if(l.descriptionParams?.host)return l.descriptionParams;if(e===`remote-unreachable`)return{host:s(`onboarding.desktopRecovery.placeholders.remoteServer`)};if(e===`remote-wrong-service`||e===`remote-incompatible`)return{host:s(`onboarding.desktopRecovery.placeholders.unknownServer`)}},[l.descriptionParams,s,e]);return(0,T.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,T.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[(0,T.jsx)(`div`,{className:`p-3 rounded-full`,style:{backgroundColor:`var(--status-warning)`,opacity:.15},children:(0,T.jsx)(`div`,{style:{color:`var(--status-warning)`},children:W(l.iconKey)})}),(0,T.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:s(l.titleKey)}),(0,T.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-sm`,children:s(l.descriptionKey,d)})]}),n&&(e===`remote-unreachable`||e===`remote-wrong-service`||e===`remote-incompatible`)&&(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-3`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:s(`onboarding.remoteConnection.field.serverAddress`)}),(0,T.jsx)(`div`,{className:`font-mono text-sm text-foreground truncate`,children:c(n)})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l.showRetry&&r&&(0,T.jsxs)(v,{onClick:r,disabled:o,className:`w-full`,children:[(0,T.jsx)(y,{name:`refresh`,className:_(`h-4 w-4`,o&&`animate-spin`)}),s(o?`onboarding.desktopRecovery.actions.retrying`:u)]}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[l.showUseLocal&&i&&(0,T.jsxs)(v,{variant:`outline`,onClick:i,disabled:o,className:`flex-1`,children:[(0,T.jsx)(y,{name:`macbook`,className:`h-4 w-4`}),s(l.useLocalLabelKey)]}),l.showUseRemote&&a&&(0,T.jsxs)(v,{variant:`outline`,onClick:a,disabled:o,className:`flex-1`,children:[(0,T.jsx)(y,{name:`server`,className:`h-4 w-4`}),s(l.useRemoteLabelKey)]})]})]})]})})}function K(e,t){if(t===`use-remote`)return{kind:`remote-form`};switch(e){case`local-unavailable`:return{kind:`local-setup`};case`remote-unreachable`:case`remote-incompatible`:case`remote-wrong-service`:case`remote-missing`:case`missing-default-host`:return{kind:`switch-default-to-local`};default:throw Error(`Unhandled RecoveryVariant: ${e}`)}}function q(e){let n=(0,C.c)(27),{variant:a,hostUrl:o,hostLabel:s,onRetry:c,onChooseRemote:l,showRemoteForm:u,onCloseRemoteForm:d,onSwitchToLocalFromRemote:f,onEnterLocalSetup:p,isRetrying:m}=e,h=u!==void 0&&u,g=m!==void 0&&m,_=J,v;n[0]===c?v=n[1]:(v=async()=>{if(r()){await i();return}await t(`/api/config/reload`,{method:`POST`}),c?.()},n[0]=c,n[1]=v);let y=v,b;n[2]!==p||n[3]!==a?(b=async()=>{if(K(a,`use-local`).kind===`local-setup`){p?.();return}if(await _(`local`),r()){await i();return}window.location.reload()},n[2]=p,n[3]=a,n[4]=b):b=n[4];let x=b,S;n[5]!==l||n[6]!==a?(S=()=>{K(a,`use-remote`).kind===`remote-form`&&l?.()},n[5]=l,n[6]=a,n[7]=S):S=n[7];let w=S;if(h){let e=a===`remote-wrong-service`?``:o||``,t=a===`remote-wrong-service`?``:s||``,c;n[8]!==l||n[9]!==d?(c=d||(()=>l?.()),n[8]=l,n[9]=d,n[10]=c):c=n[10];let u;n[11]!==p||n[12]!==f?(u=f||(()=>{_(`local`).then(()=>{r()?i():p?.()})}),n[11]=p,n[12]=f,n[13]=u):u=n[13];let m;return n[14]!==t||n[15]!==e||n[16]!==c||n[17]!==u?(m=(0,T.jsx)(O,{onBack:c,initialUrl:e,initialLabel:t,isRecoveryMode:!0,onSwitchToLocal:u}),n[14]=t,n[15]=e,n[16]=c,n[17]=u,n[18]=m):m=n[18],m}let E;return n[19]!==y||n[20]!==x||n[21]!==w||n[22]!==s||n[23]!==o||n[24]!==g||n[25]!==a?(E=(0,T.jsx)(G,{variant:a,hostLabel:s,hostUrl:o,onRetry:y,onUseLocal:x,onUseRemote:w,isRetrying:g}),n[19]=y,n[20]=x,n[21]=w,n[22]=s,n[23]=o,n[24]=g,n[25]=a,n[26]=E):E=n[26],E}async function J(e){if(!r())return;let t=await d();await l({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})}function Y(e){let t=(0,C.c)(47),{status:n,statusError:r,onContinueInBackground:i}=e,{t:a,locale:o}=g(),s=n?.total??0,c=n?.completed??0,l=r||n?.phase===`partial`||n?.phase===`error`,u=s>0?Math.min(1,Math.max(0,c/s)):null,d;t[0]===a?d=t[1]:(d=a(`onboarding.index.title`),t[0]=a,t[1]=d);let f=Math.max(s,1),p=s>0?c:void 0,m;t[2]!==c||t[3]!==a||t[4]!==s?(m=a(`commandPalette.index.progress`,{completed:c,total:s}),t[2]=c,t[3]=a,t[4]=s,t[5]=m):m=t[5];let h=`absolute inset-0 size-full -rotate-90 ${u===null&&!l?`motion-safe:animate-spin motion-safe:[animation-duration:3s]`:``}`,_;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,T.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,stroke:`currentColor`,strokeWidth:`1.5`,className:`text-border`}),t[6]=_):_=t[6];let y=100-(u??.22)*100,S;t[7]===y?S=t[8]:(S=(0,T.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,pathLength:`100`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`100`,strokeDashoffset:y,className:`text-foreground/80 motion-safe:transition-[stroke-dashoffset] motion-safe:duration-700`}),t[7]=y,t[8]=S);let w;t[9]===u?w=t[10]:(w=u!==null&&u>0&&u<1&&(0,T.jsx)(`g`,{style:{transform:`rotate(${u*360}deg)`,transformOrigin:`96px 96px`},className:`motion-safe:transition-transform motion-safe:duration-700`,children:(0,T.jsx)(`circle`,{cx:`180`,cy:`96`,r:`3`,fill:`currentColor`,className:`text-foreground`})}),t[9]=u,t[10]=w);let E;t[11]!==h||t[12]!==S||t[13]!==w?(E=(0,T.jsxs)(`svg`,{viewBox:`0 0 192 192`,fill:`none`,"aria-hidden":`true`,className:h,children:[_,S,w]}),t[11]=h,t[12]=S,t[13]=w,t[14]=E):E=t[14];let D;t[15]!==o||t[16]!==u?(D=u!==null&&(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`text-[2.5rem] font-light tabular-nums tracking-[-0.05em] text-foreground`,children:new Intl.NumberFormat(o,{style:`percent`,maximumFractionDigits:0}).format(u)}),t[15]=o,t[16]=u,t[17]=D):D=t[17];let O;t[18]!==d||t[19]!==E||t[20]!==D||t[21]!==f||t[22]!==p||t[23]!==m?(O=(0,T.jsxs)(`div`,{role:`progressbar`,"aria-label":d,"aria-valuemin":0,"aria-valuemax":f,"aria-valuenow":p,"aria-valuetext":m,className:`relative mb-9 flex size-40 items-center justify-center sm:size-44`,children:[E,D]}),t[18]=d,t[19]=E,t[20]=D,t[21]=f,t[22]=p,t[23]=m,t[24]=O):O=t[24];let k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k={fontSize:`1.0625rem`,fontWeight:450},t[25]=k):k=t[25];let A;t[26]===a?A=t[27]:(A=a(`onboarding.index.title`),t[26]=a,t[27]=A);let j;t[28]===A?j=t[29]:(j=(0,T.jsx)(b,{className:`tracking-tight`,style:k,children:A}),t[28]=A,t[29]=j);let M;t[30]!==l||t[31]!==a?(M=a(l?`onboarding.index.retrying`:`onboarding.index.description`),t[30]=l,t[31]=a,t[32]=M):M=t[32];let N;t[33]===M?N=t[34]:(N=(0,T.jsx)(x,{className:`text-xs text-muted-foreground`,children:M}),t[33]=M,t[34]=N);let P;t[35]!==j||t[36]!==N?(P=(0,T.jsxs)(`header`,{className:`space-y-2.5`,role:`status`,"aria-live":`polite`,children:[j,N]}),t[35]=j,t[36]=N,t[37]=P):P=t[37];let F;t[38]===a?F=t[39]:(F=a(`onboarding.index.background`),t[38]=a,t[39]=F);let I;t[40]!==i||t[41]!==F?(I=(0,T.jsx)(v,{variant:`ghost`,size:`sm`,className:`mt-8 text-xs font-normal text-muted-foreground`,onClick:i,children:F}),t[40]=i,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==O||t[44]!==P||t[45]!==I?(L=(0,T.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,"data-content-index-onboarding":!0,children:(0,T.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col items-center text-center`,children:[O,P,I]})}),t[43]=O,t[44]=P,t[45]=I,t[46]=L):L=t[46],L}function X(e){let t=(0,C.c)(30),{onBack:n,onCliAvailable:r,mode:i,recoveryVariant:a,recoveryHostUrl:o,recoveryHostLabel:s,onEnterLocalSetup:c,indexStatus:l,indexStatusError:u,onContinueInBackground:d}=e,f=i===void 0?`first-launch`:i,p=a===void 0?`missing-default-host`:a,[m,h]=w.useState(!1),[g,_]=w.useState(!1),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{_(!1),h(!1)},t[0]=v):v=t[0];let y;t[1]!==f||t[2]!==s||t[3]!==o||t[4]!==p?(y=[f,p,o,s],t[1]=f,t[2]=s,t[3]=o,t[4]=p,t[5]=y):y=t[5],w.useEffect(v,y);let b=g?`local-setup`:f;if(b===`content-index`){let e;return t[6]!==l||t[7]!==u||t[8]!==d?(e=(0,T.jsx)(Y,{status:l,statusError:u,onContinueInBackground:d}),t[6]=l,t[7]=u,t[8]=d,t[9]=e):e=t[9],e}if(b===`recovery`){let e,n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>h(!1),n=()=>{h(!1),_(!0)},t[10]=e,t[11]=n):(e=t[10],n=t[11]);let r;t[12]===c?r=t[13]:(r=()=>{_(!0),c?.()},t[12]=c,t[13]=r);let i;return t[14]!==s||t[15]!==o||t[16]!==p||t[17]!==m||t[18]!==r?(i=(0,T.jsx)(q,{variant:p,hostUrl:o,hostLabel:s,showRemoteForm:m,onCloseRemoteForm:e,onSwitchToLocalFromRemote:n,onEnterLocalSetup:r}),t[14]=s,t[15]=o,t[16]=p,t[17]=m,t[18]=r,t[19]=i):i=t[19],i}if(b===`local-setup`){let e;t[20]!==n||t[21]!==g?(e=()=>{g?_(!1):n?.()},t[20]=n,t[21]=g,t[22]=e):e=t[22];let i;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>h(!0),t[23]=i):i=t[23];let a;return t[24]!==r||t[25]!==g||t[26]!==e?(a=(0,T.jsx)(V,{onBack:e,onCliAvailable:r,isFromRecovery:g,onSwitchToRemote:i}),t[24]=r,t[25]=g,t[26]=e,t[27]=a):a=t[27],a}let x;return t[28]===r?x=t[29]:(x=(0,T.jsx)(I,{onCliAvailable:r}),t[28]=r,t[29]=x),x}export{X as OnboardingScreen};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./queryRuntime-DKGLQtb9.js";import{Cn as n,en as r,hn as i,i as a,pn as o}from"./persistence-Dzooc9Xg.js";import{_ as s,h as c,i as l,n as u,r as d}from"./desktopHosts-BDyl2P7W.js";import{it as f,rt as p}from"./vendor-base-ui-CdzJ6My_.js";import{n as m}from"./vendor-react-BP2cRVqX.js";import{d as h,f as g,r as _,t as v}from"./button-_ReBqWzC.js";import{n as y}from"./Icon-2cKLcXGe.js";import{o as b,r as x}from"./dialog-NsOVcGdh.js";import{t as S}from"./input-BI3Ya8O_.js";var C=m(),w=e(f(),1),T=p();function E(e){switch(e){case`ok`:return null;case`auth`:return`onboarding.remoteConnection.probe.authMessage`;case`update-recommended`:return`onboarding.remoteConnection.probe.updateRecommendedMessage`;case`incompatible`:return`onboarding.remoteConnection.probe.incompatibleMessage`;case`wrong-service`:return`onboarding.remoteConnection.probe.wrongServiceMessage`;case`unreachable`:return`onboarding.remoteConnection.probe.unreachableMessage`;default:return null}}function D(e){return e===`wrong-service`||e===`unreachable`||e===`incompatible`}function O({onBack:e,showBackButton:t=!0,initialUrl:n=``,initialLabel:a=``,isRecoveryMode:o=!1,onConnect:c,onSwitchToLocal:f}){let{t:p}=g(),[m,h]=(0,w.useState)(n),[_,y]=(0,w.useState)(a),[b,x]=(0,w.useState)(`idle`),[C,O]=(0,w.useState)(null),[k,A]=(0,w.useState)(``),j=s(m),M=j?.persistedUrl??null,N=(0,w.useCallback)(e=>{h(e.target.value),x(`idle`),O(null),A(``)},[]),P=(0,w.useCallback)(e=>{y(e.target.value)},[]),F=(0,w.useCallback)(async()=>{if(M){x(`testing`),O(null),A(``);try{let e=await u(M);O(e),x(e.status===`ok`||e.status===`update-recommended`?`success`:`error`)}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.connectionTestFailed`)),x(`error`)}}},[M,p]),I=(0,w.useCallback)(async()=>{if(!j)return;let e=j.persistedUrl;x(`testing`),O(null),A(``);try{let t=await u(e);if(O(t),D(t.status)){x(`error`);return}let n=await d(),a=_.trim()||e,o=n.hosts.find(t=>t.url===e),s=o?o.id:`host-${Date.now().toString(16)}`,f={id:s,label:a,url:e,apiUrl:e},p=o?n.hosts.map(e=>e.id===s?f:e):[...n.hosts,f];if(await l({hosts:p,defaultHostId:s,initialHostChoiceCompleted:!0}),c?.(),j.redeemUrl){window.location.assign(j.redeemUrl);return}r()&&await i()}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.failedToSaveConnection`)),x(`error`)}},[j,_,c,p]),L=b===`testing`,R=M!==null&&!L,z=M!==null&&!L&&!D(C?.status??null),B=E(C?.status??null),V=C?.status===`ok`,H=C?.status===`update-recommended`,U=C?.status===`auth`,W=D(C?.status??null);return(0,T.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,T.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[t&&(0,T.jsx)(`div`,{className:`flex items-center`,children:(0,T.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:p(`onboarding.common.actions.back`)})}),(0,T.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,T.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:p(o?`onboarding.remoteConnection.titleRecovery`:`onboarding.remoteConnection.title`)}),(0,T.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:p(`onboarding.remoteConnection.description`)})]}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`label`,{htmlFor:`remote-url`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.serverAddress`)}),(0,T.jsx)(S,{id:`remote-url`,type:`url`,value:m,onChange:N,placeholder:p(`onboarding.remoteConnection.field.serverAddressPlaceholder`),disabled:L})]}),(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`label`,{htmlFor:`remote-label`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.nameOptional`)}),(0,T.jsx)(S,{id:`remote-label`,type:`text`,value:_,onChange:P,placeholder:p(`onboarding.remoteConnection.field.namePlaceholder`),disabled:L})]})]}),C&&V&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-success)`,color:`var(--status-success)`},children:p(`onboarding.remoteConnection.status.connectedSuccessfully`,{latencyMs:C.latencyMs})}),C&&U&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:p(`onboarding.remoteConnection.status.authWarning`)}),C&&H&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:B?p(B):null}),C&&W&&(0,T.jsxs)(`div`,{className:`rounded-lg border p-3 text-sm space-y-3`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`font-semibold mb-1`,children:p(`onboarding.remoteConnection.status.connectionFailed`)}),(0,T.jsx)(`div`,{className:`opacity-90`,children:B?p(B):null})]}),(0,T.jsx)(`div`,{className:`text-xs opacity-80`,children:C.status===`unreachable`?p(`onboarding.remoteConnection.status.suggestionsUnreachable`):p(`onboarding.remoteConnection.status.suggestionsWrongService`)})]}),k&&(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:k}),(0,T.jsxs)(`div`,{className:`flex gap-3`,children:[(0,T.jsx)(v,{variant:`outline`,onClick:F,disabled:!R,children:p(L?`onboarding.remoteConnection.actions.testing`:`onboarding.remoteConnection.actions.testConnection`)}),(0,T.jsx)(v,{onClick:I,disabled:!z,children:p(`onboarding.remoteConnection.actions.connectAndRestart`)})]}),W&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t border-border`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:p(`onboarding.remoteConnection.actions.whatToDo`)}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(v,{variant:`outline`,size:`sm`,onClick:e,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.chooseDifferentServer`)}),!o&&f&&(0,T.jsx)(v,{variant:`outline`,size:`sm`,onClick:f,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.useLocalInstead`)})]})]})]})})}async function k(){let e=await t(`/health`);if(!e.ok)return!1;let n=await e.json().catch(()=>null);return n?.openCodeRunning===!0||n?.isOpenCodeReady===!0}async function A(){return(await t(`/api/opencode/retry`,{method:`POST`})).ok?k():!1}var j=`curl -fsSL https://opencode.ai/v2/install | bash`,M=`https://opencode.ai/docs`,N=2500,P=1e4;function F(e){let t=(0,C.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,T.jsxs)(`code`,{className:`flex-1 text-left overflow-x-auto whitespace-nowrap`,children:[(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,T.jsx)(y,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full`,children:[i,(0,T.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:r,"aria-label":r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}function I({onCliAvailable:e}){let{t:s}=g(),[c,u]=w.useState(!1),[f,p]=w.useState(!1),[m,b]=w.useState(!1),[x,C]=w.useState(!1),[E,D]=w.useState(``),[I,L]=w.useState(`unknown`),[R,z]=w.useState(`local`),[B,V]=w.useState(!1),[H,U]=w.useState(!1),[W,G]=w.useState(null),K=w.useRef(!1);w.useEffect(()=>{p(r())},[]),w.useEffect(()=>{if(typeof navigator>`u`){L(`unknown`);return}let e=navigator.userAgent||``;/Windows/i.test(e)?L(`windows`):/Macintosh|Mac OS X/i.test(e)?L(`macos`):/Linux/i.test(e)?L(`linux`):L(`unknown`)},[]),w.useEffect(()=>{let e=!1;return(async()=>{try{let n=await t(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json().catch(()=>null);if(!r||e)return;let i=typeof r.opencodeBinary==`string`?r.opencodeBinary.trim():``;i&&D(i)}catch{}})(),()=>{e=!0}},[]);let q=w.useCallback(async e=>{let t=e.target;t.closest(`.app-region-no-drag`)||t.closest(`button, a, input, select, textarea, code, summary, details`)||e.button===0&&f&&await n()},[f]),J=w.useCallback(async e=>{if(!f)return;let t=await d();await l({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})},[f]),Y=w.useCallback(async()=>{if(!K.current){K.current=!0;try{f&&await J(`local`),await e?.()}catch(e){throw K.current=!1,e}}},[f,e,J]);w.useEffect(()=>{if(R!==`local`)return;let e=!1,t=null,n=0,r=async()=>{if(!e){try{let t=await k(),r=Date.now();if(!t&&r-n>=P&&(n=r,t=await A()),e)return;if(t){await Y();return}}catch{}e||(t=setTimeout(r,N))}};return t=setTimeout(r,N),()=>{e=!0,t&&clearTimeout(t)}},[R,Y]);let X=w.useCallback(async()=>{C(!0),G(null);try{let e=await k();e||=await A(),e?await Y():G(s(`onboarding.localSetup.errors.cliNotReady`))}catch{G(s(`onboarding.localSetup.errors.detectionFailed`))}finally{C(!1)}},[Y,s]),Z=w.useCallback(async()=>{if(!(typeof window>`u`)&&f)try{let e=await o();e.success&&e.path&&e.path.trim().length>0&&D(e.path.trim())}catch{}},[f]),Q=w.useCallback(async()=>{b(!0);try{if(await a({opencodeBinary:E.trim()}),f){await J(`local`),await i();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>b(!1),1e3)}},[f,E,J]),$=w.useCallback(async()=>{let e=await h(j);e.ok?(u(!0),setTimeout(()=>u(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),ee=M,te=I===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:I===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`,ne=!f||R===`local`;return(0,T.jsx)(`div`,{className:`app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto`,onMouseDown:q,children:(0,T.jsxs)(`div`,{className:`w-full max-w-md space-y-7`,children:[(0,T.jsxs)(`header`,{className:`text-center space-y-1.5`,children:[(0,T.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground`,children:s(`onboarding.chooser.title`)}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`onboarding.chooser.description`)})]}),f&&(0,T.jsxs)(`div`,{className:`app-region-no-drag flex gap-1.5`,children:[(0,T.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`local`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`local`),children:s(`onboarding.chooser.tabs.localInstall`)}),(0,T.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`remote`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`remote`),children:s(`onboarding.chooser.tabs.connectRemote`)})]}),f&&R===`remote`?(0,T.jsx)(`div`,{className:`app-region-no-drag`,children:(0,T.jsx)(O,{onBack:()=>z(`local`),showBackButton:!1,onSwitchToLocal:()=>z(`local`)})}):null,ne&&(0,T.jsxs)(`div`,{className:`space-y-4`,children:[I===`windows`&&(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-4`,children:[(0,T.jsx)(`div`,{className:`text-sm text-foreground`,children:s(`onboarding.localSetup.windows.title`)}),(0,T.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground text-center leading-relaxed`,children:s(`onboarding.localSetup.intro`)}),(0,T.jsx)(`div`,{className:`app-region-no-drag rounded-lg border border-border bg-background/60 backdrop-blur-sm px-4 py-3 font-mono text-sm`,children:c?(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--status-success)`},children:[(0,T.jsx)(y,{name:`check`,className:`h-4 w-4`}),s(`onboarding.common.status.copiedToClipboard`)]}):(0,T.jsx)(F,{onCopy:$,copyTitle:s(`onboarding.common.copyToClipboard`)})}),(0,T.jsxs)(`div`,{className:`app-region-no-drag flex items-center justify-between`,children:[(0,T.jsxs)(`a`,{href:ee,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1`,children:[s(I===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,T.jsx)(y,{name:`external-link`,className:`h-3 w-3`})]}),(0,T.jsx)(`button`,{type:`button`,onClick:X,disabled:x,className:`text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,children:s(x?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkNow`)})]}),W&&(0,T.jsx)(`p`,{role:`alert`,className:`text-center text-xs text-[var(--status-error-foreground)]`,children:W}),(0,T.jsxs)(`div`,{className:`rounded-lg border px-4 py-3 flex items-center gap-3`,style:{borderColor:`color-mix(in srgb, var(--primary-base) 20%, transparent)`,backgroundColor:`color-mix(in srgb, var(--primary-base) 6%, transparent)`},role:`status`,"aria-live":`polite`,children:[(0,T.jsxs)(`span`,{className:`relative inline-flex h-2.5 w-2.5 shrink-0`,"aria-hidden":!0,children:[(0,T.jsx)(`span`,{className:`absolute inset-0 rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity 1.6s ease-in-out infinite`}}),(0,T.jsx)(`span`,{className:`absolute inset-[-4px] rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity-dim 1.6s ease-in-out infinite`,opacity:0}})]}),(0,T.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,T.jsx)(`div`,{className:`text-sm text-foreground leading-tight`,children:s(`onboarding.localSetup.status.watching`)}),(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground leading-tight mt-0.5`,children:s(`onboarding.localSetup.status.autoContinue`)})]})]}),(0,T.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:B,onToggle:e=>V(e.currentTarget.open),children:[(0,T.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,T.jsx)(`span`,{children:s(`onboarding.localSetup.advanced.title`)}),(0,T.jsx)(y,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,T.jsxs)(`div`,{className:`pb-4 space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(S,{value:E,onChange:e=>D(e.target.value),placeholder:te,disabled:m,className:`flex-1 font-mono text-xs`}),(0,T.jsx)(v,{type:`button`,variant:`secondary`,size:`sm`,onClick:Z,disabled:m||!f,children:s(`onboarding.localSetup.actions.browse`)}),(0,T.jsx)(v,{type:`button`,size:`sm`,onClick:Q,disabled:m||!E.trim(),children:s(`onboarding.localSetup.actions.apply`)})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:s(`onboarding.localSetup.helper.saveAndReload`)})]})]}),(0,T.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:H,onToggle:e=>U(e.currentTarget.open),children:[(0,T.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,T.jsx)(`span`,{children:s(`onboarding.localSetup.troubleshoot.title`)}),(0,T.jsx)(y,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,T.jsx)(`ul`,{className:`pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4`,children:I===`windows`?(0,T.jsx)(T.Fragment,{children:(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.hint.ensurePath`)}),(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.hint.setEnv`)}),(0,T.jsx)(`li`,{children:s(`onboarding.localSetup.hint.missingRuntime`)})]})})]})]})]})})}var L=`curl -fsSL https://opencode.ai/v2/install | bash`,R=`https://opencode.ai/docs`;function z(e){let t=(0,C.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,T.jsxs)(`code`,{children:[(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,T.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,T.jsx)(y,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,T.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[i,(0,T.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors`,title:r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}var B=3e4;function V({onBack:e,onCliAvailable:s,isFromRecovery:c=!1,onSwitchToRemote:l}){let{t:u}=g(),[d,f]=w.useState(!1),[p,m]=w.useState(!1),[_,b]=w.useState(!1),[x,C]=w.useState(!1),[E,D]=w.useState(!1),[O,j]=w.useState(null),[M,N]=w.useState(``),[P,F]=w.useState(`unknown`);w.useEffect(()=>{let e=setTimeout(()=>m(!0),B);return()=>clearTimeout(e)},[]),w.useEffect(()=>{b(r())},[]),w.useEffect(()=>{if(typeof navigator>`u`){F(`unknown`);return}let e=navigator.userAgent||``;if(/Windows/i.test(e)){F(`windows`);return}if(/Macintosh|Mac OS X/i.test(e)){F(`macos`);return}if(/Linux/i.test(e)){F(`linux`);return}F(`unknown`)},[]),w.useEffect(()=>{let e=!1;return(async()=>{try{let n=await t(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json().catch(()=>null);if(!r||e)return;let i=typeof r.opencodeBinary==`string`?r.opencodeBinary.trim():``;i&&N(i)}catch{}})(),()=>{e=!0}},[]);let I=w.useCallback(async e=>{e.target.closest(`button, a, input, select, textarea, code`)||e.button===0&&_&&await n()},[_]),V=w.useCallback(async()=>{if(!(typeof window>`u`)&&_)try{let e=await o();e.success&&e.path&&e.path.trim().length>0&&N(e.path.trim())}catch{}},[_]),H=w.useCallback(async()=>{C(!0);try{if(await a({opencodeBinary:M.trim()}),_){await i();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>C(!1),1e3)}},[_,M]),U=w.useCallback(async()=>{let e=await h(L);e.ok?(f(!0),setTimeout(()=>f(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),W=w.useCallback(async()=>{D(!0),j(null);try{let e=await k();e||=await A(),e?s?.():j(u(`onboarding.localSetup.errors.cliNotReady`))}catch(e){j(e instanceof Error?e.message:u(`onboarding.localSetup.errors.detectionFailed`))}finally{D(!1)}},[s,u]),G=R,K=P===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:P===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`;return(0,T.jsxs)(`div`,{className:`h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none`,onMouseDown:I,children:[(0,T.jsxs)(`div`,{className:`w-full max-w-lg space-y-4 text-center`,children:[(0,T.jsx)(`div`,{className:`flex items-center`,children:(0,T.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:u(`onboarding.common.actions.back`)})}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:u(`onboarding.localSetup.title`)}),(0,T.jsx)(`p`,{className:`text-muted-foreground`,children:u(`onboarding.localSetup.description`)})]}),P===`windows`&&(0,T.jsxs)(`div`,{className:`mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left`,children:[(0,T.jsx)(`div`,{className:`text-sm text-foreground`,children:u(`onboarding.localSetup.windows.title`)}),(0,T.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,T.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,T.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,T.jsx)(`div`,{className:`flex justify-center`,children:(0,T.jsx)(`div`,{className:`bg-background/60 backdrop-blur-sm border border-border rounded-lg px-5 py-3 font-mono text-sm w-fit`,children:d?(0,T.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,style:{color:`var(--status-success)`},children:[(0,T.jsx)(y,{name:`check`,className:`h-4 w-4`}),u(`onboarding.common.status.copiedToClipboard`)]}):(0,T.jsx)(z,{onCopy:U,copyTitle:u(`onboarding.common.copyToClipboard`)})})}),(0,T.jsxs)(`a`,{href:G,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1 justify-center`,children:[u(P===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,T.jsx)(y,{name:`external-link`,className:`h-3 w-3`})]}),O&&(0,T.jsx)(`div`,{className:`mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive`,children:O}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(v,{type:`button`,onClick:W,disabled:E,className:`w-full max-w-xs`,size:`lg`,children:u(E?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkAndContinue`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u(`onboarding.localSetup.helper.checkAndContinue`)})]}),(0,T.jsx)(`div`,{className:`mx-auto w-full max-w-xl pt-4`,children:(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u(`onboarding.localSetup.field.alreadyInstalled`)}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(S,{value:M,onChange:e=>N(e.target.value),placeholder:K,disabled:x,className:`flex-1 font-mono text-xs`}),(0,T.jsx)(v,{type:`button`,variant:`secondary`,onClick:V,disabled:x||!_,children:u(`onboarding.localSetup.actions.browse`)}),(0,T.jsx)(v,{type:`button`,onClick:H,disabled:x,children:u(`onboarding.localSetup.actions.apply`)})]}),(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:u(`onboarding.localSetup.helper.saveAndReload`)})]})}),c&&l&&(0,T.jsxs)(`div`,{className:`text-center pt-4`,children:[(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:u(`onboarding.localSetup.remotePreference`)}),(0,T.jsx)(v,{variant:`link`,onClick:l,children:u(`onboarding.localSetup.actions.connectRemoteServer`)})]})]}),p&&(0,T.jsx)(`div`,{className:`absolute bottom-8 left-0 right-0 text-center space-y-1`,children:P===`windows`?(0,T.jsx)(T.Fragment,{children:(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.ensurePath`)}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.setEnv`)}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.missingRuntime`)})]})})]})}function H(e,t){if(e?.trim())return c(e.trim());if(t)return c(t)}function U(e,t,n){switch(e){case`local-unavailable`:return{title:`Local OpenCode Unavailable`,description:`OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.`,titleKey:`onboarding.desktopRecovery.localUnavailable.title`,descriptionKey:`onboarding.desktopRecovery.localUnavailable.description`,iconKey:`local`,showRetry:!0,retryLabel:`Retry Local`,retryLabelKey:`onboarding.desktopRecovery.localUnavailable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Set Up Local`,useLocalLabelKey:`onboarding.desktopRecovery.localUnavailable.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-missing`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-unreachable`:{let e=H(t,n);return{title:`Remote Server Unreachable`,description:`Could not connect to "${e||`the remote server`}". Check your network connection and verify the server address.`,titleKey:`onboarding.desktopRecovery.remoteUnreachable.title`,descriptionKey:`onboarding.desktopRecovery.remoteUnreachable.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-wrong-service`:{let e=H(t,n);return{title:`Incompatible Server`,description:`The server at "${e||`unknown`}" is not running Yuri. Verify the address points to an Yuri server.`,titleKey:`onboarding.desktopRecovery.incompatibleServer.title`,descriptionKey:`onboarding.desktopRecovery.incompatibleServer.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-incompatible`:{let e=H(t,n);return{title:`Server Update Required`,description:`The Yuri server at "${e||`unknown`}" is not compatible with this app version. Update Yuri on the server, then try again.`,titleKey:`onboarding.desktopRecovery.remoteIncompatible.title`,descriptionKey:`onboarding.desktopRecovery.remoteIncompatible.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`missing-default-host`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};default:throw Error(`Unknown recovery variant: ${e}`)}}function W(e){switch(e){case`local`:return(0,T.jsx)(y,{name:`macbook`,className:`h-8 w-8`});case`remote`:return(0,T.jsx)(y,{name:`server`,className:`h-8 w-8`})}}function G({variant:e,hostLabel:t,hostUrl:n,onRetry:r,onUseLocal:i,onUseRemote:a,isRetrying:o=!1}){let{t:s}=g(),l=U(e,t,n),u=l.retryLabelKey??`onboarding.desktopRecovery.actions.retryConnection`,d=w.useMemo(()=>{if(l.descriptionParams?.host)return l.descriptionParams;if(e===`remote-unreachable`)return{host:s(`onboarding.desktopRecovery.placeholders.remoteServer`)};if(e===`remote-wrong-service`||e===`remote-incompatible`)return{host:s(`onboarding.desktopRecovery.placeholders.unknownServer`)}},[l.descriptionParams,s,e]);return(0,T.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,T.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[(0,T.jsx)(`div`,{className:`p-3 rounded-full`,style:{backgroundColor:`var(--status-warning)`,opacity:.15},children:(0,T.jsx)(`div`,{style:{color:`var(--status-warning)`},children:W(l.iconKey)})}),(0,T.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:s(l.titleKey)}),(0,T.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-sm`,children:s(l.descriptionKey,d)})]}),n&&(e===`remote-unreachable`||e===`remote-wrong-service`||e===`remote-incompatible`)&&(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-3`,children:[(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:s(`onboarding.remoteConnection.field.serverAddress`)}),(0,T.jsx)(`div`,{className:`font-mono text-sm text-foreground truncate`,children:c(n)})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l.showRetry&&r&&(0,T.jsxs)(v,{onClick:r,disabled:o,className:`w-full`,children:[(0,T.jsx)(y,{name:`refresh`,className:_(`h-4 w-4`,o&&`animate-spin`)}),s(o?`onboarding.desktopRecovery.actions.retrying`:u)]}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[l.showUseLocal&&i&&(0,T.jsxs)(v,{variant:`outline`,onClick:i,disabled:o,className:`flex-1`,children:[(0,T.jsx)(y,{name:`macbook`,className:`h-4 w-4`}),s(l.useLocalLabelKey)]}),l.showUseRemote&&a&&(0,T.jsxs)(v,{variant:`outline`,onClick:a,disabled:o,className:`flex-1`,children:[(0,T.jsx)(y,{name:`server`,className:`h-4 w-4`}),s(l.useRemoteLabelKey)]})]})]})]})})}function K(e,t){if(t===`use-remote`)return{kind:`remote-form`};switch(e){case`local-unavailable`:return{kind:`local-setup`};case`remote-unreachable`:case`remote-incompatible`:case`remote-wrong-service`:case`remote-missing`:case`missing-default-host`:return{kind:`switch-default-to-local`};default:throw Error(`Unhandled RecoveryVariant: ${e}`)}}function q(e){let n=(0,C.c)(27),{variant:a,hostUrl:o,hostLabel:s,onRetry:c,onChooseRemote:l,showRemoteForm:u,onCloseRemoteForm:d,onSwitchToLocalFromRemote:f,onEnterLocalSetup:p,isRetrying:m}=e,h=u!==void 0&&u,g=m!==void 0&&m,_=J,v;n[0]===c?v=n[1]:(v=async()=>{if(r()){await i();return}await t(`/api/config/reload`,{method:`POST`}),c?.()},n[0]=c,n[1]=v);let y=v,b;n[2]!==p||n[3]!==a?(b=async()=>{if(K(a,`use-local`).kind===`local-setup`){p?.();return}if(await _(`local`),r()){await i();return}window.location.reload()},n[2]=p,n[3]=a,n[4]=b):b=n[4];let x=b,S;n[5]!==l||n[6]!==a?(S=()=>{K(a,`use-remote`).kind===`remote-form`&&l?.()},n[5]=l,n[6]=a,n[7]=S):S=n[7];let w=S;if(h){let e=a===`remote-wrong-service`?``:o||``,t=a===`remote-wrong-service`?``:s||``,c;n[8]!==l||n[9]!==d?(c=d||(()=>l?.()),n[8]=l,n[9]=d,n[10]=c):c=n[10];let u;n[11]!==p||n[12]!==f?(u=f||(()=>{_(`local`).then(()=>{r()?i():p?.()})}),n[11]=p,n[12]=f,n[13]=u):u=n[13];let m;return n[14]!==t||n[15]!==e||n[16]!==c||n[17]!==u?(m=(0,T.jsx)(O,{onBack:c,initialUrl:e,initialLabel:t,isRecoveryMode:!0,onSwitchToLocal:u}),n[14]=t,n[15]=e,n[16]=c,n[17]=u,n[18]=m):m=n[18],m}let E;return n[19]!==y||n[20]!==x||n[21]!==w||n[22]!==s||n[23]!==o||n[24]!==g||n[25]!==a?(E=(0,T.jsx)(G,{variant:a,hostLabel:s,hostUrl:o,onRetry:y,onUseLocal:x,onUseRemote:w,isRetrying:g}),n[19]=y,n[20]=x,n[21]=w,n[22]=s,n[23]=o,n[24]=g,n[25]=a,n[26]=E):E=n[26],E}async function J(e){if(!r())return;let t=await d();await l({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})}function Y(e){let t=(0,C.c)(47),{status:n,statusError:r,onContinueInBackground:i}=e,{t:a,locale:o}=g(),s=n?.total??0,c=n?.completed??0,l=r||n?.phase===`partial`||n?.phase===`error`,u=s>0?Math.min(1,Math.max(0,c/s)):null,d;t[0]===a?d=t[1]:(d=a(`onboarding.index.title`),t[0]=a,t[1]=d);let f=Math.max(s,1),p=s>0?c:void 0,m;t[2]!==c||t[3]!==a||t[4]!==s?(m=a(`commandPalette.index.progress`,{completed:c,total:s}),t[2]=c,t[3]=a,t[4]=s,t[5]=m):m=t[5];let h=`absolute inset-0 size-full -rotate-90 ${u===null&&!l?`motion-safe:animate-spin motion-safe:[animation-duration:3s]`:``}`,_;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,T.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,stroke:`currentColor`,strokeWidth:`1.5`,className:`text-border`}),t[6]=_):_=t[6];let y=100-(u??.22)*100,S;t[7]===y?S=t[8]:(S=(0,T.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,pathLength:`100`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`100`,strokeDashoffset:y,className:`text-foreground/80 motion-safe:transition-[stroke-dashoffset] motion-safe:duration-700`}),t[7]=y,t[8]=S);let w;t[9]===u?w=t[10]:(w=u!==null&&u>0&&u<1&&(0,T.jsx)(`g`,{style:{transform:`rotate(${u*360}deg)`,transformOrigin:`96px 96px`},className:`motion-safe:transition-transform motion-safe:duration-700`,children:(0,T.jsx)(`circle`,{cx:`180`,cy:`96`,r:`3`,fill:`currentColor`,className:`text-foreground`})}),t[9]=u,t[10]=w);let E;t[11]!==h||t[12]!==S||t[13]!==w?(E=(0,T.jsxs)(`svg`,{viewBox:`0 0 192 192`,fill:`none`,"aria-hidden":`true`,className:h,children:[_,S,w]}),t[11]=h,t[12]=S,t[13]=w,t[14]=E):E=t[14];let D;t[15]!==o||t[16]!==u?(D=u!==null&&(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`text-[2.5rem] font-light tabular-nums tracking-[-0.05em] text-foreground`,children:new Intl.NumberFormat(o,{style:`percent`,maximumFractionDigits:0}).format(u)}),t[15]=o,t[16]=u,t[17]=D):D=t[17];let O;t[18]!==d||t[19]!==E||t[20]!==D||t[21]!==f||t[22]!==p||t[23]!==m?(O=(0,T.jsxs)(`div`,{role:`progressbar`,"aria-label":d,"aria-valuemin":0,"aria-valuemax":f,"aria-valuenow":p,"aria-valuetext":m,className:`relative mb-9 flex size-40 items-center justify-center sm:size-44`,children:[E,D]}),t[18]=d,t[19]=E,t[20]=D,t[21]=f,t[22]=p,t[23]=m,t[24]=O):O=t[24];let k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k={fontSize:`1.0625rem`,fontWeight:450},t[25]=k):k=t[25];let A;t[26]===a?A=t[27]:(A=a(`onboarding.index.title`),t[26]=a,t[27]=A);let j;t[28]===A?j=t[29]:(j=(0,T.jsx)(b,{className:`tracking-tight`,style:k,children:A}),t[28]=A,t[29]=j);let M;t[30]!==l||t[31]!==a?(M=a(l?`onboarding.index.retrying`:`onboarding.index.description`),t[30]=l,t[31]=a,t[32]=M):M=t[32];let N;t[33]===M?N=t[34]:(N=(0,T.jsx)(x,{className:`text-xs text-muted-foreground`,children:M}),t[33]=M,t[34]=N);let P;t[35]!==j||t[36]!==N?(P=(0,T.jsxs)(`header`,{className:`space-y-2.5`,role:`status`,"aria-live":`polite`,children:[j,N]}),t[35]=j,t[36]=N,t[37]=P):P=t[37];let F;t[38]===a?F=t[39]:(F=a(`onboarding.index.background`),t[38]=a,t[39]=F);let I;t[40]!==i||t[41]!==F?(I=(0,T.jsx)(v,{variant:`ghost`,size:`sm`,className:`mt-8 text-xs font-normal text-muted-foreground`,onClick:i,children:F}),t[40]=i,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==O||t[44]!==P||t[45]!==I?(L=(0,T.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,"data-content-index-onboarding":!0,children:(0,T.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col items-center text-center`,children:[O,P,I]})}),t[43]=O,t[44]=P,t[45]=I,t[46]=L):L=t[46],L}function X(e){let t=(0,C.c)(30),{onBack:n,onCliAvailable:r,mode:i,recoveryVariant:a,recoveryHostUrl:o,recoveryHostLabel:s,onEnterLocalSetup:c,indexStatus:l,indexStatusError:u,onContinueInBackground:d}=e,f=i===void 0?`first-launch`:i,p=a===void 0?`missing-default-host`:a,[m,h]=w.useState(!1),[g,_]=w.useState(!1),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{_(!1),h(!1)},t[0]=v):v=t[0];let y;t[1]!==f||t[2]!==s||t[3]!==o||t[4]!==p?(y=[f,p,o,s],t[1]=f,t[2]=s,t[3]=o,t[4]=p,t[5]=y):y=t[5],w.useEffect(v,y);let b=g?`local-setup`:f;if(b===`content-index`){let e;return t[6]!==l||t[7]!==u||t[8]!==d?(e=(0,T.jsx)(Y,{status:l,statusError:u,onContinueInBackground:d}),t[6]=l,t[7]=u,t[8]=d,t[9]=e):e=t[9],e}if(b===`recovery`){let e,n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>h(!1),n=()=>{h(!1),_(!0)},t[10]=e,t[11]=n):(e=t[10],n=t[11]);let r;t[12]===c?r=t[13]:(r=()=>{_(!0),c?.()},t[12]=c,t[13]=r);let i;return t[14]!==s||t[15]!==o||t[16]!==p||t[17]!==m||t[18]!==r?(i=(0,T.jsx)(q,{variant:p,hostUrl:o,hostLabel:s,showRemoteForm:m,onCloseRemoteForm:e,onSwitchToLocalFromRemote:n,onEnterLocalSetup:r}),t[14]=s,t[15]=o,t[16]=p,t[17]=m,t[18]=r,t[19]=i):i=t[19],i}if(b===`local-setup`){let e;t[20]!==n||t[21]!==g?(e=()=>{g?_(!1):n?.()},t[20]=n,t[21]=g,t[22]=e):e=t[22];let i;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>h(!0),t[23]=i):i=t[23];let a;return t[24]!==r||t[25]!==g||t[26]!==e?(a=(0,T.jsx)(V,{onBack:e,onCliAvailable:r,isFromRecovery:g,onSwitchToRemote:i}),t[24]=r,t[25]=g,t[26]=e,t[27]=a):a=t[27],a}let x;return t[28]===r?x=t[29]:(x=(0,T.jsx)(I,{onCliAvailable:r}),t[28]=r,t[29]=x),x}export{X as OnboardingScreen};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{en as t,rn as n}from"./persistence-Dzooc9Xg.js";import{it as r,rt as i}from"./vendor-base-ui-CdzJ6My_.js";import{n as a}from"./platform-7bX6qtBV.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{o as s}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as c}from"./button-C3292Ee6.js";var l=e(r(),1),ee=o(),te=.85,u=1.2,d=10/9,f=.9,p=.98,m=p/f,h=`yuri.designPtScale.v8`;function g(e){return!Number.isFinite(e)||e<=0?1:Math.min(u,Math.max(te,e))}function _(e){if(!e)return p;let t=e.density,n=(e.xdpi+e.ydpi)/2;if(!(t>0)||!(n>=50)||n>800)return p;let r=g(n/t/163);return Math.min(p,r*m)}function v(){if(typeof window>`u`)return 1;try{let e=Number.parseFloat(window.localStorage.getItem(`yuri.designPtScale.v8`)??``),t=window.Capacitor?.getPlatform?.();return t===`android`?Math.min(p,g(e)):t===`ios`?d:g(e)}catch{return 1}}function y(e){if(!(typeof window>`u`))try{window.localStorage.setItem(h,String(e))}catch{}}function b(e,t=document.documentElement){let n=g(e);t.style.setProperty(`--dpt`,`${n}px`),t.style.setProperty(`--dpt-n`,String(n))}async function ne(){if(typeof document>`u`)return 1;b(v());let{Capacitor:e,registerPlugin:t}=await s(async()=>{let{Capacitor:e,registerPlugin:t}=await import(`./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js`).then(e=>e.i);return{Capacitor:e,registerPlugin:t}},__vite__mapDeps([0,1]));if(!e.isNativePlatform())return b(1),1;if(e.getPlatform()===`ios`)return b(d),y(d),d;if(e.getPlatform()!==`android`)return b(1),1;if(!e.isPluginAvailable(`YuriPhysicalScale`))return b(p),y(p),p;try{let e=_(await t(`YuriPhysicalScale`).getMetrics());return y(e),b(e),e}catch{return b(p),y(p),p}}var x={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},S={isMobile:!1,isTablet:!1,isDesktop:!0,deviceType:`desktop`,screenWidth:1024,breakpoint:`lg`,hasTouchInput:!1,hasTouchOnlyPointer:!1},re=()=>typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`surface`)===`desktop`,C=e=>{if(typeof navigator>`u`)return{isExplicitTablet:!1};let t=navigator.userAgent||``,n=navigator.platform||``,r=/iPad/i.test(t)||(/Macintosh|MacIntel/i.test(t)||/MacIntel/i.test(n))&&e>1,i=/Android/i.test(t)&&!/Mobile/i.test(t),a=/Tablet/i.test(t);return{isExplicitTablet:r||i||a}},w=(e,t,n)=>{if(typeof window>`u`)return;let r=document.documentElement,i=t===`mobile`,a=t===`tablet`;r.classList.remove(`device-mobile`,`device-tablet`,`device-desktop`),r.classList.add(t===`mobile`?`device-mobile`:t===`tablet`?`device-tablet`:`device-desktop`),e?(r.classList.add(`desktop-runtime`),r.style.setProperty(`--is-mobile`,`0`),r.style.setProperty(`--device-type`,`desktop`),r.style.setProperty(`--font-scale`,`1`),r.style.setProperty(`--has-coarse-pointer`,`0`),r.style.setProperty(`--has-touch-input`,`0`),r.classList.remove(`mobile-pointer`)):(r.classList.remove(`desktop-runtime`),r.style.setProperty(`--is-mobile`,i?`1`:`0`),r.style.setProperty(`--device-type`,t),r.style.setProperty(`--font-scale`,i?`0.9`:a?`0.95`:`1`),r.style.setProperty(`--has-coarse-pointer`,n?`1`:`0`),r.style.setProperty(`--has-touch-input`,n?`1`:`0`),n?r.classList.add(`mobile-pointer`):r.classList.remove(`mobile-pointer`)),b(e?1:v(),r)};function T(){let e=window.innerWidth,r=typeof window.matchMedia==`function`,i=r?window.matchMedia(`(pointer: coarse)`):null,o=r?window.matchMedia(`(hover: none)`):null,s=i?.matches??!1,c=o?.matches??!1,l=typeof navigator<`u`?navigator.maxTouchPoints??0:0,ee=t()||n()||re(),{isExplicitTablet:te}=C(l),u=s||c||l>0,d=s||c,f=e>x.md&&e<=x.lg,p=e<=x.md,m=u&&p,h=u&&!m&&(f||te),g=!u||!h&&e>x.lg,_=`desktop`;ee?(m=!1,h=!1,g=!0,_=`desktop`):a()?(m=!0,h=!1,g=!1,_=`mobile`):m?_=`mobile`:h?_=`tablet`:(g=!0,_=`desktop`),w(ee,_,u);let v=`xs`;for(let[t,n]of Object.entries(x))e>=n&&(v=t);return{isMobile:m,isTablet:h,isDesktop:g,deviceType:_,screenWidth:e,breakpoint:v,hasTouchInput:u,hasTouchOnlyPointer:d}}var E=(e,t)=>e.isMobile===t.isMobile&&e.isTablet===t.isTablet&&e.isDesktop===t.isDesktop&&e.deviceType===t.deviceType&&e.screenWidth===t.screenWidth&&e.breakpoint===t.breakpoint&&e.hasTouchInput===t.hasTouchInput&&e.hasTouchOnlyPointer===t.hasTouchOnlyPointer,D=new Set,O=null,k,A=null,ie=()=>typeof window>`u`?S:(O||=T(),O),j=()=>{for(let e of D)e()},M=()=>{k=void 0;let e=T();O&&E(O,e)||(O=e,j())},N=()=>{typeof window>`u`||k!==void 0||(k=window.requestAnimationFrame(M))},P=(e,t)=>e?typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}:()=>{},F=()=>{if(typeof window>`u`)return()=>{};O=T(),window.addEventListener(`resize`,N);let e=typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null,t=typeof window.matchMedia==`function`?window.matchMedia(`(hover: none)`):null,n=P(e,N),r=P(t,N);return()=>{window.removeEventListener(`resize`,N),n(),r(),k!==void 0&&(window.cancelAnimationFrame(k),k=void 0)}},I=e=>typeof window>`u`?()=>{}:(D.add(e),A||=F(),()=>{D.delete(e),D.size===0&&A&&(A(),A=null,O=null)});function L(){if(typeof window>`u`||typeof window<`u`&&t())return!1;let e=document.documentElement,n=e.style.getPropertyValue(`--is-mobile`)||getComputedStyle(e).getPropertyValue(`--is-mobile`);return n===`1`||n===`true`}var ae=()=>typeof window>`u`?!1:!!(navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches||window.matchMedia?.(`(display-mode: fullscreen)`)?.matches),R=()=>{if(typeof window>`u`||t())return!1;let e=typeof navigator<`u`?navigator.maxTouchPoints??0:0;return ae()&&e>0&&window.innerWidth>x.md};function z(){let e=(0,ee.c)(2),[t,n]=l.useState(B),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>n(R()),t=window.matchMedia?.(`(display-mode: standalone)`),r=window.matchMedia?.(`(display-mode: fullscreen)`);e(),window.addEventListener(`resize`,e),window.addEventListener(`focus`,e);let i=t=>{t&&(typeof t.addEventListener==`function`?t.addEventListener(`change`,e):typeof t.addListener==`function`&&t.addListener(e))},a=t=>{t&&(typeof t.removeEventListener==`function`?t.removeEventListener(`change`,e):typeof t.removeListener==`function`&&t.removeListener(e))};return i(t),i(r),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`focus`,e),a(t),a(r)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function B(){return R()}var V=()=>typeof window>`u`?`portrait`:window.matchMedia?.(`(orientation: landscape)`)?.matches?`landscape`:`portrait`;function H(){let e=(0,ee.c)(2),[t,n]=l.useState(V),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(orientation: landscape)`),t=()=>n(e.matches?`landscape`:`portrait`);return t(),P(e,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function U(){return l.useSyncExternalStore(I,ie,oe)}function oe(){return S}var se=i(),ce=1e3,W=.5,le={length:0,offset:0},ue=(e,t)=>Math.abs(e.length-t.length)<W&&Math.abs(e.offset-t.offset)<W,G=e=>{let t=(0,ee.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:i,className:a,disableHorizontal:o,observeMutations:s,suppressVisibility:te,userIntentOnly:u}=e,d=r===void 0?32:r,f=i===void 0?1e3:i,p=o!==void 0&&o,m=s===void 0||s,h=te!==void 0&&te,g=u!==void 0&&u,[_,v]=l.useState(!1),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y={length:0,offset:0},t[0]=y):y=t[0];let[b,ne]=l.useState(y),x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x={length:0,offset:0},t[1]=x):x=t[1];let[S,re]=l.useState(x),C=l.useRef(null),w=l.useRef(null),T=l.useRef(null),E=l.useRef(!1),D=l.useRef(!1),O=l.useRef(0),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=k):k=t[2];let A=l.useRef(k),ie=l.useRef(null),j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=new Set,t[3]=j):j=t[3];let M=l.useRef(j),N;t[4]!==n||t[5]!==p||t[6]!==d?(N=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,c=le;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(d,Math.min(e,n)),o=Math.max(e-a,0);c={length:a,offset:i/Math.max(t-r,1)*o}}ne(e=>ue(e,c)?e:c);let l=le;if(!p&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(d,Math.min(e,t)),r=Math.max(e-n,0);l={length:n,offset:s/Math.max(a-o,1)*r}}re(e=>ue(e,l)?e:l)},t[4]=n,t[5]=p,t[6]=d,t[7]=N):N=t[7];let P=N,F;t[8]===P?F=t[9]:(F=()=>{T.current===null&&(T.current=requestAnimationFrame(()=>{T.current=null,P()}))},t[8]=P,t[9]=F);let I=F,L;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(L=(e,t)=>{if(!t){M.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),M.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{M.current.has(e)||t.observe(e)}),M.current=n},t[10]=L):L=t[10];let ae=L,R;t[11]===f?R=t[12]:(R=()=>{C.current&&clearTimeout(C.current),!D.current&&(C.current=setTimeout(()=>v(!1),f))},t[11]=f,t[12]=R);let z=R,B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{O.current=Date.now()},t[13]=B):B=t[13];let V=B,H;t[14]!==z||t[15]!==h||t[16]!==P||t[17]!==g?(H=()=>{w.current&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame(()=>{if(P(),h&&!E.current){v(!1);return}if(g&&!E.current&&!(Date.now()-O.current<=ce)){v(!1);return}v(!0),z()})},t[14]=z,t[15]=h,t[16]=P,t[17]=g,t[18]=H):H=t[18];let U=H,oe,W;t[19]!==n||t[20]!==U||t[21]!==m||t[22]!==I||t[23]!==P||t[24]!==g?(oe=()=>{let e=n.current;if(!e)return;P(),v(!1);let t=()=>U(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&V()};e.addEventListener(`scroll`,t,{passive:!0}),g&&(e.addEventListener(`wheel`,V,{passive:!0}),e.addEventListener(`touchstart`,V,{passive:!0}),e.addEventListener(`touchmove`,V,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{I()}):null;ae(e,i);let a=m&&typeof MutationObserver<`u`?new MutationObserver(()=>{ae(e,i),I()}):null;a?.observe(e,{childList:!0});let o=()=>I(),s=()=>I();return e.addEventListener(`input`,o,!0),e.addEventListener(`load`,s,!0),()=>{e.removeEventListener(`scroll`,t),e.removeEventListener(`input`,o,!0),e.removeEventListener(`load`,s,!0),g&&(e.removeEventListener(`wheel`,V),e.removeEventListener(`touchstart`,V),e.removeEventListener(`touchmove`,V),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),M.current.clear(),C.current&&clearTimeout(C.current),w.current&&cancelAnimationFrame(w.current),T.current&&cancelAnimationFrame(T.current)}},W=[n,U,V,m,I,ae,P,g],t[19]=n,t[20]=U,t[21]=m,t[22]=I,t[23]=P,t[24]=g,t[25]=oe,t[26]=W):(oe=t[25],W=t[26]),l.useEffect(oe,W);let G,de;t[27]===h?(G=t[28],de=t[29]):(G=()=>{h&&(E.current||(v(!1),C.current&&=(clearTimeout(C.current),null)))},de=[h],t[27]=h,t[28]=G,t[29]=de),l.useEffect(G,de);let fe;t[30]===n?fe=t[31]:(fe=(e,t)=>{let r=n.current;r&&(E.current=!0,A.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},ie.current=t,V(),v(!0),C.current&&clearTimeout(C.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=fe);let K=fe,pe;t[32]!==n||t[33]!==S.length||t[34]!==b.length?(pe=e=>{if(!E.current)return;let t=n.current;if(!t)return;let r=ie.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=A.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-b.length,1),s=Math.max(t.scrollHeight-t.clientHeight,1);t.scrollTop=r+i/o*s}else if(r===`horizontal`){let{pointerX:n,scrollLeft:r}=A.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-S.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=S.length,t[34]=b.length,t[35]=pe):pe=t[35];let q=pe,me;t[36]===z?me=t[37]:(me=e=>{E.current&&(E.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),z())},t[36]=z,t[37]=me);let J=me,he;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{D.current=!0,C.current&&=(clearTimeout(C.current),null)},t[38]=he):he=t[38];let ge=he,_e;t[39]===z?_e=t[40]:(_e=()=>{D.current=!1,z()},t[39]=z,t[40]=_e);let Y=_e,ve=b.length>0,ye=S.length>0;if(!ve&&!ye)return null;let X;t[41]===a?X=t[42]:(X=c(`overlay-scrollbar`,a),t[41]=a,t[42]=X);let be=+!!_,Z;t[43]===be?Z=t[44]:(Z={opacity:be},t[43]=be,t[44]=Z);let Q;t[45]!==K||t[46]!==q||t[47]!==J||t[48]!==Y||t[49]!==ve||t[50]!==b.length||t[51]!==b.offset?(Q=ve&&(0,se.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${b.length}px`,top:`${8+b.offset}px`,right:`4px`},onPointerDown:e=>K(e,`vertical`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[45]=K,t[46]=q,t[47]=J,t[48]=Y,t[49]=ve,t[50]=b.length,t[51]=b.offset,t[52]=Q):Q=t[52];let $;t[53]!==K||t[54]!==q||t[55]!==J||t[56]!==Y||t[57]!==S.length||t[58]!==S.offset||t[59]!==ye?($=ye&&(0,se.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${S.length}px`,left:`${8+S.offset}px`,bottom:`4px`},onPointerDown:e=>K(e,`horizontal`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[53]=K,t[54]=q,t[55]=J,t[56]=Y,t[57]=S.length,t[58]=S.offset,t[59]=ye,t[60]=$):$=t[60];let xe;return t[61]!==X||t[62]!==Z||t[63]!==Q||t[64]!==$?(xe=(0,se.jsxs)(`div`,{className:X,"aria-hidden":`true`,style:Z,children:[Q,$]}),t[61]=X,t[62]=Z,t[63]=Q,t[64]=$,t[65]=xe):xe=t[65],xe};G.displayName=`OverlayScrollbar`;var de=G;export{H as a,U as i,T as n,z as o,L as r,ne as s,de as t};
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{en as t,rn as n}from"./persistence-Dzooc9Xg.js";import{it as r,rt as i}from"./vendor-base-ui-CdzJ6My_.js";import{n as a}from"./platform-7bX6qtBV.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{o as s}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as c}from"./button-_ReBqWzC.js";var l=e(r(),1),ee=o(),te=.85,u=1.2,d=10/9,f=.9,p=.98,m=p/f,h=`yuri.designPtScale.v8`;function g(e){return!Number.isFinite(e)||e<=0?1:Math.min(u,Math.max(te,e))}function _(e){if(!e)return p;let t=e.density,n=(e.xdpi+e.ydpi)/2;if(!(t>0)||!(n>=50)||n>800)return p;let r=g(n/t/163);return Math.min(p,r*m)}function v(){if(typeof window>`u`)return 1;try{let e=Number.parseFloat(window.localStorage.getItem(`yuri.designPtScale.v8`)??``),t=window.Capacitor?.getPlatform?.();return t===`android`?Math.min(p,g(e)):t===`ios`?d:g(e)}catch{return 1}}function y(e){if(!(typeof window>`u`))try{window.localStorage.setItem(h,String(e))}catch{}}function b(e,t=document.documentElement){let n=g(e);t.style.setProperty(`--dpt`,`${n}px`),t.style.setProperty(`--dpt-n`,String(n))}async function ne(){if(typeof document>`u`)return 1;b(v());let{Capacitor:e,registerPlugin:t}=await s(async()=>{let{Capacitor:e,registerPlugin:t}=await import(`./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js`).then(e=>e.i);return{Capacitor:e,registerPlugin:t}},__vite__mapDeps([0,1]));if(!e.isNativePlatform())return b(1),1;if(e.getPlatform()===`ios`)return b(d),y(d),d;if(e.getPlatform()!==`android`)return b(1),1;if(!e.isPluginAvailable(`YuriPhysicalScale`))return b(p),y(p),p;try{let e=_(await t(`YuriPhysicalScale`).getMetrics());return y(e),b(e),e}catch{return b(p),y(p),p}}var x={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},S={isMobile:!1,isTablet:!1,isDesktop:!0,deviceType:`desktop`,screenWidth:1024,breakpoint:`lg`,hasTouchInput:!1,hasTouchOnlyPointer:!1},re=()=>typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`surface`)===`desktop`,C=e=>{if(typeof navigator>`u`)return{isExplicitTablet:!1};let t=navigator.userAgent||``,n=navigator.platform||``,r=/iPad/i.test(t)||(/Macintosh|MacIntel/i.test(t)||/MacIntel/i.test(n))&&e>1,i=/Android/i.test(t)&&!/Mobile/i.test(t),a=/Tablet/i.test(t);return{isExplicitTablet:r||i||a}},w=(e,t,n)=>{if(typeof window>`u`)return;let r=document.documentElement,i=t===`mobile`,a=t===`tablet`;r.classList.remove(`device-mobile`,`device-tablet`,`device-desktop`),r.classList.add(t===`mobile`?`device-mobile`:t===`tablet`?`device-tablet`:`device-desktop`),e?(r.classList.add(`desktop-runtime`),r.style.setProperty(`--is-mobile`,`0`),r.style.setProperty(`--device-type`,`desktop`),r.style.setProperty(`--font-scale`,`1`),r.style.setProperty(`--has-coarse-pointer`,`0`),r.style.setProperty(`--has-touch-input`,`0`),r.classList.remove(`mobile-pointer`)):(r.classList.remove(`desktop-runtime`),r.style.setProperty(`--is-mobile`,i?`1`:`0`),r.style.setProperty(`--device-type`,t),r.style.setProperty(`--font-scale`,i?`0.9`:a?`0.95`:`1`),r.style.setProperty(`--has-coarse-pointer`,n?`1`:`0`),r.style.setProperty(`--has-touch-input`,n?`1`:`0`),n?r.classList.add(`mobile-pointer`):r.classList.remove(`mobile-pointer`)),b(e?1:v(),r)};function T(){let e=window.innerWidth,r=typeof window.matchMedia==`function`,i=r?window.matchMedia(`(pointer: coarse)`):null,o=r?window.matchMedia(`(hover: none)`):null,s=i?.matches??!1,c=o?.matches??!1,l=typeof navigator<`u`?navigator.maxTouchPoints??0:0,ee=t()||n()||re(),{isExplicitTablet:te}=C(l),u=s||c||l>0,d=s||c,f=e>x.md&&e<=x.lg,p=e<=x.md,m=u&&p,h=u&&!m&&(f||te),g=!u||!h&&e>x.lg,_=`desktop`;ee?(m=!1,h=!1,g=!0,_=`desktop`):a()?(m=!0,h=!1,g=!1,_=`mobile`):m?_=`mobile`:h?_=`tablet`:(g=!0,_=`desktop`),w(ee,_,u);let v=`xs`;for(let[t,n]of Object.entries(x))e>=n&&(v=t);return{isMobile:m,isTablet:h,isDesktop:g,deviceType:_,screenWidth:e,breakpoint:v,hasTouchInput:u,hasTouchOnlyPointer:d}}var E=(e,t)=>e.isMobile===t.isMobile&&e.isTablet===t.isTablet&&e.isDesktop===t.isDesktop&&e.deviceType===t.deviceType&&e.screenWidth===t.screenWidth&&e.breakpoint===t.breakpoint&&e.hasTouchInput===t.hasTouchInput&&e.hasTouchOnlyPointer===t.hasTouchOnlyPointer,D=new Set,O=null,k,A=null,ie=()=>typeof window>`u`?S:(O||=T(),O),j=()=>{for(let e of D)e()},M=()=>{k=void 0;let e=T();O&&E(O,e)||(O=e,j())},N=()=>{typeof window>`u`||k!==void 0||(k=window.requestAnimationFrame(M))},P=(e,t)=>e?typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}:()=>{},F=()=>{if(typeof window>`u`)return()=>{};O=T(),window.addEventListener(`resize`,N);let e=typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null,t=typeof window.matchMedia==`function`?window.matchMedia(`(hover: none)`):null,n=P(e,N),r=P(t,N);return()=>{window.removeEventListener(`resize`,N),n(),r(),k!==void 0&&(window.cancelAnimationFrame(k),k=void 0)}},I=e=>typeof window>`u`?()=>{}:(D.add(e),A||=F(),()=>{D.delete(e),D.size===0&&A&&(A(),A=null,O=null)});function L(){if(typeof window>`u`||typeof window<`u`&&t())return!1;let e=document.documentElement,n=e.style.getPropertyValue(`--is-mobile`)||getComputedStyle(e).getPropertyValue(`--is-mobile`);return n===`1`||n===`true`}var ae=()=>typeof window>`u`?!1:!!(navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches||window.matchMedia?.(`(display-mode: fullscreen)`)?.matches),R=()=>{if(typeof window>`u`||t())return!1;let e=typeof navigator<`u`?navigator.maxTouchPoints??0:0;return ae()&&e>0&&window.innerWidth>x.md};function z(){let e=(0,ee.c)(2),[t,n]=l.useState(B),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>n(R()),t=window.matchMedia?.(`(display-mode: standalone)`),r=window.matchMedia?.(`(display-mode: fullscreen)`);e(),window.addEventListener(`resize`,e),window.addEventListener(`focus`,e);let i=t=>{t&&(typeof t.addEventListener==`function`?t.addEventListener(`change`,e):typeof t.addListener==`function`&&t.addListener(e))},a=t=>{t&&(typeof t.removeEventListener==`function`?t.removeEventListener(`change`,e):typeof t.removeListener==`function`&&t.removeListener(e))};return i(t),i(r),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`focus`,e),a(t),a(r)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function B(){return R()}var V=()=>typeof window>`u`?`portrait`:window.matchMedia?.(`(orientation: landscape)`)?.matches?`landscape`:`portrait`;function H(){let e=(0,ee.c)(2),[t,n]=l.useState(V),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(orientation: landscape)`),t=()=>n(e.matches?`landscape`:`portrait`);return t(),P(e,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function U(){return l.useSyncExternalStore(I,ie,oe)}function oe(){return S}var se=i(),ce=1e3,W=.5,le={length:0,offset:0},ue=(e,t)=>Math.abs(e.length-t.length)<W&&Math.abs(e.offset-t.offset)<W,G=e=>{let t=(0,ee.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:i,className:a,disableHorizontal:o,observeMutations:s,suppressVisibility:te,userIntentOnly:u}=e,d=r===void 0?32:r,f=i===void 0?1e3:i,p=o!==void 0&&o,m=s===void 0||s,h=te!==void 0&&te,g=u!==void 0&&u,[_,v]=l.useState(!1),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y={length:0,offset:0},t[0]=y):y=t[0];let[b,ne]=l.useState(y),x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x={length:0,offset:0},t[1]=x):x=t[1];let[S,re]=l.useState(x),C=l.useRef(null),w=l.useRef(null),T=l.useRef(null),E=l.useRef(!1),D=l.useRef(!1),O=l.useRef(0),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=k):k=t[2];let A=l.useRef(k),ie=l.useRef(null),j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=new Set,t[3]=j):j=t[3];let M=l.useRef(j),N;t[4]!==n||t[5]!==p||t[6]!==d?(N=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,c=le;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(d,Math.min(e,n)),o=Math.max(e-a,0);c={length:a,offset:i/Math.max(t-r,1)*o}}ne(e=>ue(e,c)?e:c);let l=le;if(!p&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(d,Math.min(e,t)),r=Math.max(e-n,0);l={length:n,offset:s/Math.max(a-o,1)*r}}re(e=>ue(e,l)?e:l)},t[4]=n,t[5]=p,t[6]=d,t[7]=N):N=t[7];let P=N,F;t[8]===P?F=t[9]:(F=()=>{T.current===null&&(T.current=requestAnimationFrame(()=>{T.current=null,P()}))},t[8]=P,t[9]=F);let I=F,L;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(L=(e,t)=>{if(!t){M.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),M.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{M.current.has(e)||t.observe(e)}),M.current=n},t[10]=L):L=t[10];let ae=L,R;t[11]===f?R=t[12]:(R=()=>{C.current&&clearTimeout(C.current),!D.current&&(C.current=setTimeout(()=>v(!1),f))},t[11]=f,t[12]=R);let z=R,B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{O.current=Date.now()},t[13]=B):B=t[13];let V=B,H;t[14]!==z||t[15]!==h||t[16]!==P||t[17]!==g?(H=()=>{w.current&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame(()=>{if(P(),h&&!E.current){v(!1);return}if(g&&!E.current&&!(Date.now()-O.current<=ce)){v(!1);return}v(!0),z()})},t[14]=z,t[15]=h,t[16]=P,t[17]=g,t[18]=H):H=t[18];let U=H,oe,W;t[19]!==n||t[20]!==U||t[21]!==m||t[22]!==I||t[23]!==P||t[24]!==g?(oe=()=>{let e=n.current;if(!e)return;P(),v(!1);let t=()=>U(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&V()};e.addEventListener(`scroll`,t,{passive:!0}),g&&(e.addEventListener(`wheel`,V,{passive:!0}),e.addEventListener(`touchstart`,V,{passive:!0}),e.addEventListener(`touchmove`,V,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{I()}):null;ae(e,i);let a=m&&typeof MutationObserver<`u`?new MutationObserver(()=>{ae(e,i),I()}):null;a?.observe(e,{childList:!0});let o=()=>I(),s=()=>I();return e.addEventListener(`input`,o,!0),e.addEventListener(`load`,s,!0),()=>{e.removeEventListener(`scroll`,t),e.removeEventListener(`input`,o,!0),e.removeEventListener(`load`,s,!0),g&&(e.removeEventListener(`wheel`,V),e.removeEventListener(`touchstart`,V),e.removeEventListener(`touchmove`,V),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),M.current.clear(),C.current&&clearTimeout(C.current),w.current&&cancelAnimationFrame(w.current),T.current&&cancelAnimationFrame(T.current)}},W=[n,U,V,m,I,ae,P,g],t[19]=n,t[20]=U,t[21]=m,t[22]=I,t[23]=P,t[24]=g,t[25]=oe,t[26]=W):(oe=t[25],W=t[26]),l.useEffect(oe,W);let G,de;t[27]===h?(G=t[28],de=t[29]):(G=()=>{h&&(E.current||(v(!1),C.current&&=(clearTimeout(C.current),null)))},de=[h],t[27]=h,t[28]=G,t[29]=de),l.useEffect(G,de);let fe;t[30]===n?fe=t[31]:(fe=(e,t)=>{let r=n.current;r&&(E.current=!0,A.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},ie.current=t,V(),v(!0),C.current&&clearTimeout(C.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=fe);let K=fe,pe;t[32]!==n||t[33]!==S.length||t[34]!==b.length?(pe=e=>{if(!E.current)return;let t=n.current;if(!t)return;let r=ie.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=A.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-b.length,1),s=Math.max(t.scrollHeight-t.clientHeight,1);t.scrollTop=r+i/o*s}else if(r===`horizontal`){let{pointerX:n,scrollLeft:r}=A.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-S.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=S.length,t[34]=b.length,t[35]=pe):pe=t[35];let q=pe,me;t[36]===z?me=t[37]:(me=e=>{E.current&&(E.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),z())},t[36]=z,t[37]=me);let J=me,he;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{D.current=!0,C.current&&=(clearTimeout(C.current),null)},t[38]=he):he=t[38];let ge=he,_e;t[39]===z?_e=t[40]:(_e=()=>{D.current=!1,z()},t[39]=z,t[40]=_e);let Y=_e,ve=b.length>0,ye=S.length>0;if(!ve&&!ye)return null;let X;t[41]===a?X=t[42]:(X=c(`overlay-scrollbar`,a),t[41]=a,t[42]=X);let be=+!!_,Z;t[43]===be?Z=t[44]:(Z={opacity:be},t[43]=be,t[44]=Z);let Q;t[45]!==K||t[46]!==q||t[47]!==J||t[48]!==Y||t[49]!==ve||t[50]!==b.length||t[51]!==b.offset?(Q=ve&&(0,se.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${b.length}px`,top:`${8+b.offset}px`,right:`4px`},onPointerDown:e=>K(e,`vertical`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[45]=K,t[46]=q,t[47]=J,t[48]=Y,t[49]=ve,t[50]=b.length,t[51]=b.offset,t[52]=Q):Q=t[52];let $;t[53]!==K||t[54]!==q||t[55]!==J||t[56]!==Y||t[57]!==S.length||t[58]!==S.offset||t[59]!==ye?($=ye&&(0,se.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${S.length}px`,left:`${8+S.offset}px`,bottom:`4px`},onPointerDown:e=>K(e,`horizontal`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[53]=K,t[54]=q,t[55]=J,t[56]=Y,t[57]=S.length,t[58]=S.offset,t[59]=ye,t[60]=$):$=t[60];let xe;return t[61]!==X||t[62]!==Z||t[63]!==Q||t[64]!==$?(xe=(0,se.jsxs)(`div`,{className:X,"aria-hidden":`true`,style:Z,children:[Q,$]}),t[61]=X,t[62]=Z,t[63]=Q,t[64]=$,t[65]=xe):xe=t[65],xe};G.displayName=`OverlayScrollbar`;var de=G;export{H as a,U as i,T as n,z as o,L as r,ne as s,de as t};
|