@yuriai/web 0.2.39-beta.1 → 0.2.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/assets/{AgentAvatar-qwoC8op7.js → AgentAvatar-BPihSrmD.js} +1 -1
  2. package/dist/assets/AssistantConversationSurface-B60CYrok.css +1 -0
  3. package/dist/assets/AssistantConversationSurface-CjY5PL5-.js +3 -0
  4. package/dist/assets/{AssistantUnreadBadge-Hnqqug3k.js → AssistantUnreadBadge-Cqm9s7su.js} +1 -1
  5. package/dist/assets/AssistantView-DQYpQy2m.js +1 -0
  6. package/dist/assets/{DiagramView-D1g_U1Ve.js → DiagramView-B0BtdArn.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-DLWVDmNr.js → FadeInOnReveal-tft8IuZn.js} +1 -1
  8. package/dist/assets/{GuiPluginPage-DGrpzWyU.js → GuiPluginPage-DbRaxEMz.js} +1 -1
  9. package/dist/assets/{GuiPluginSurface-CU2-fLdm.js → GuiPluginSurface-slfiNhjw.js} +1 -1
  10. package/dist/assets/{GuiPluginWindow-Cear_hK6.js → GuiPluginWindow-CncIyWAp.js} +1 -1
  11. package/dist/assets/{Icon-D6eeecf3.js → Icon-CGEMyGrr.js} +1 -1
  12. package/dist/assets/{ImageLoadingPlaceholder-BJguSRQf.js → ImageLoadingPlaceholder-DPV84_Pj.js} +1 -1
  13. package/dist/assets/{LoadingImage-C0ebLsVf.js → LoadingImage-C54k9D10.js} +1 -1
  14. package/dist/assets/MarkdownRenderer-DBZS1O3m.js +2 -0
  15. package/dist/assets/{MarkdownRendererImpl-CRMSm9zP.js → MarkdownRendererImpl-QZCYT1B1.js} +1 -1
  16. package/dist/assets/{MarkstreamRendererImpl-Cz3f0w5O.js → MarkstreamRendererImpl-CH0XdDB8.js} +1 -1
  17. package/dist/assets/MobileDetailNavigation-doWZ3QnX.js +1 -0
  18. package/dist/assets/{MobileResizableSheet-CSHVXdcc.js → MobileResizableSheet-DmBfNDpy.js} +1 -1
  19. package/dist/assets/{MobileShareBridge-CrnmSDpN.js → MobileShareBridge-CCRDZ5at.js} +1 -1
  20. package/dist/assets/{MobileTabPageHeader-CwAiYIiK.js → MobileTabPageHeader-RIJ0Tv9a.js} +1 -1
  21. package/dist/assets/{MultiRunWindow-A7FOh3y9.js → MultiRunWindow-FISLdCRZ.js} +1 -1
  22. package/dist/assets/{OnboardingScreen-C4aWPE5g.js → OnboardingScreen-D4OnZuHF.js} +1 -1
  23. package/dist/assets/{OverlayScrollbar-BDmFJvuO.js → OverlayScrollbar-B5tpZ8bV.js} +1 -1
  24. package/dist/assets/{SettingsView-YvxmCurl.js → SettingsView-B9qVD3Y-.js} +6 -6
  25. package/dist/assets/{SettingsWindow-C6sp5FCT.js → SettingsWindow-DUlTQkFw.js} +1 -1
  26. package/dist/assets/{SetupTourDialog-DAbtAImS.js → SetupTourDialog-Cfc1h-8p.js} +1 -1
  27. package/dist/assets/{TerminalView-bFqYE6E8.js → TerminalView-D0nGaGQc.js} +1 -1
  28. package/dist/assets/{ToolOutputDialog-BfKFoRx6.js → ToolOutputDialog-RBSVUj7J.js} +1 -1
  29. package/dist/assets/{VoiceSettings-BFJoynNT.js → VoiceSettings-B6L3hyGL.js} +1 -1
  30. package/dist/assets/{YuriLogo-DcoYyXzq.js → YuriLogo-B58GIl2v.js} +1 -1
  31. package/dist/assets/{YuriWordmark-Dlsq3scd.js → YuriWordmark--S-QEpRp.js} +1 -1
  32. package/dist/assets/{appThemeRegistry-DzF1KyRO.js → appThemeRegistry-CvThoPJW.js} +1 -1
  33. package/dist/assets/{capgoAdapter-DomoN2dQ.js → capgoAdapter-Bj8RLSP5.js} +1 -1
  34. package/dist/assets/{checkbox-ClSxDwlM.js → checkbox-CnTrXcOT.js} +1 -1
  35. package/dist/assets/{collapsible-Dhf2eN1l.js → collapsible-Brxkw3Ad.js} +1 -1
  36. package/dist/assets/{context-menu-DQz7Hocu.js → context-menu-V40RXF6h.js} +1 -1
  37. package/dist/assets/{diagram-BaIvxWpH.js → diagram-DmtDqCEH.js} +1 -1
  38. package/dist/assets/{dialog-B1Rrafoy.js → dialog-wNy9dklb.js} +1 -1
  39. package/dist/assets/{es-30Wqm-Bx.js → es-D0Q_CV0t.js} +1 -1
  40. package/dist/assets/{fileMentionTouchSelection-CUUCXrKA.js → fileMentionTouchSelection-B35c9M1S.js} +1 -1
  41. package/dist/assets/{fileReferenceActions-BRF8f7uA.js → fileReferenceActions-BmquJskG.js} +1 -1
  42. package/dist/assets/{fr-BbWLXNYa.js → fr-DrO5SAKl.js} +1 -1
  43. package/dist/assets/{gitApi-L3nS1oNJ.js → gitApi-B6T5guw-.js} +1 -1
  44. package/dist/assets/{gitApiHttp-B1mApXwC.js → gitApiHttp-D4d-rgcR.js} +1 -1
  45. package/dist/assets/{i18n-BU14awhU.js → i18n-UaLestuf.js} +1 -1
  46. package/dist/assets/{image-loading-D9Z_BASK.css → image-loading-DA9JEHD8.css} +1 -1
  47. package/dist/assets/{input-el2PLKbt.js → input-DKLf8ixL.js} +1 -1
  48. package/dist/assets/{insertionBoundaries-DyPQrOsg.js → insertionBoundaries-BT7QMdXR.js} +1 -1
  49. package/dist/assets/{ja-BI7m9bgW.js → ja-BNeP9_GU.js} +1 -1
  50. package/dist/assets/{ko-B89SVFZa.js → ko-DRRFD_7l.js} +1 -1
  51. package/dist/assets/{main-BPnfMzuY.js → main-Bto3lVGC.js} +2 -2
  52. package/dist/assets/{main-5mNQIc25.js → main-wQpnkA8l.js} +21 -21
  53. package/dist/assets/{markdownHeightCache-DUGTouXi.js → markdownHeightCache-CDLGxKMx.js} +1 -1
  54. package/dist/assets/{mcpQueries-B2gQBmMk.js → mcpQueries-W4pdjGH6.js} +1 -1
  55. package/dist/assets/{miniChat-DkaYsaSY.js → miniChat-5-Hv0t6L.js} +2 -2
  56. package/dist/assets/mobile-CIfJVgvD.js +2 -0
  57. package/dist/assets/{mobileBackNavigation-CXTWT9pL.js → mobileBackNavigation-DEYDDBvo.js} +1 -1
  58. package/dist/assets/{mobileConnections-NoXReTUi.js → mobileConnections-Ciduwjrk.js} +2 -2
  59. package/dist/assets/{multirun-DizITQa8.js → multirun-DH5YM6eW.js} +1 -1
  60. package/dist/assets/{native-config--mmoJe_H.js → native-config-tZKBxKlJ.js} +1 -1
  61. package/dist/assets/{pl-B55Lf3HE.js → pl-BnW5wJrl.js} +1 -1
  62. package/dist/assets/{projectMeta-BzvXAJMC.js → projectMeta-ByznasuE.js} +1 -1
  63. package/dist/assets/{pt-BR-CFZj-ECy.js → pt-BR-fZW8CCVQ.js} +1 -1
  64. package/dist/assets/pwa-6LwD5mEU.js +2 -0
  65. package/dist/assets/{queue-abort-optimistic-BZ-uX9Xl.js → queue-abort-optimistic-BxQHPU5z.js} +1 -1
  66. package/dist/assets/{react-CnKEwma7.js → react-KWIP7CQs.js} +1 -1
  67. package/dist/assets/readiness-aRoinILZ.js +2 -0
  68. package/dist/assets/{renderElectronMiniChatApp-CGDnFkRT.js → renderElectronMiniChatApp-CZScT8zj.js} +2 -2
  69. package/dist/assets/renderMobileApp-DuXuzELH.js +29 -0
  70. package/dist/assets/{runtimeConfig-CBsnA3T3.js → runtimeConfig-D6tyDSf2.js} +1 -1
  71. package/dist/assets/runtimeEndpointReset-BOdd_mJM.css +1 -0
  72. package/dist/assets/{runtimeEndpointReset-Co74Bqfs.js → runtimeEndpointReset-CTScNTQk.js} +15 -15
  73. package/dist/assets/{scheduledTaskNavigation-PH-etFzZ.js → scheduledTaskNavigation-FMDNRUnX.js} +1 -1
  74. package/dist/assets/{select-Bn8U3CWh.js → select-CM7BZ8sO.js} +1 -1
  75. package/dist/assets/{sessionLookup-14_73BfN.js → sessionLookup-BU5wx0-q.js} +1 -1
  76. package/dist/assets/{sortable-tabs-strip-DdP1ALtI.js → sortable-tabs-strip-DucBEuLZ.js} +1 -1
  77. package/dist/assets/{speechSettingsQueries-D4ZaI_pC.js → speechSettingsQueries-BP-b2-GN.js} +1 -1
  78. package/dist/assets/src-CCKR0Tmd.css +2 -0
  79. package/dist/assets/{store-BNNIbb4k.js → store-CzVMz42v.js} +2 -2
  80. package/dist/assets/{terminalApi-BXKIVBPo.js → terminalApi-DK4KmfFn.js} +1 -1
  81. package/dist/assets/{textarea-CI1VKA2e.js → textarea-C8G6xLAC.js} +1 -1
  82. package/dist/assets/{tooltip-Bjzgrs1l.js → tooltip-CeCFnNNR.js} +1 -1
  83. package/dist/assets/types-Zl9uYRiX.js +2 -0
  84. package/dist/assets/{uk-CS2c4Dtj.js → uk-C4OKsNRv.js} +1 -1
  85. package/dist/assets/{useAppFontEffects-DtgrP7dP.js → useAppFontEffects-B2DfbicL.js} +58 -58
  86. package/dist/assets/{useAssistantUIStore-Du8puXWz.js → useAssistantUIStore-nNYL140o.js} +1 -1
  87. package/dist/assets/{useDesktopWindowControlsLayout-H91TGqj1.js → useDesktopWindowControlsLayout-CD1Nr6Ms.js} +1 -1
  88. package/dist/assets/{useDictation-CyWtsxSn.js → useDictation-Sk20Gi0T.js} +1 -1
  89. package/dist/assets/{useEffectiveDirectory-C_NYC9Sb.js → useEffectiveDirectory-DT950TGk.js} +1 -1
  90. package/dist/assets/{useFontPreferences-CAdw6cBK.js → useFontPreferences-DxzruDDQ.js} +1 -1
  91. package/dist/assets/{useMobileNavigationStore-BoZDstLm.js → useMobileNavigationStore-CXnVqWpM.js} +7 -7
  92. package/dist/assets/{usePluginsStore-B3hliD_2.js → usePluginsStore-DIah6ngo.js} +1 -1
  93. package/dist/assets/{useStreamingTextThrottle-BA4aJ24a.js → useStreamingTextThrottle-BrP3Yc-q.js} +1 -1
  94. package/dist/assets/useUIStore-vvNwcOk3.js +1 -0
  95. package/dist/assets/{useWorkerHighlightedLines-CEl8asH9.js → useWorkerHighlightedLines-tpb9bWVl.js} +1 -1
  96. package/dist/assets/{zh-CN-BpiwUUs4.js → zh-CN-ieAs59w6.js} +1 -1
  97. package/dist/assets/{zh-TW-Bl9CnlGi.js → zh-TW-WWTW1fkP.js} +1 -1
  98. package/dist/index.html +9 -9
  99. package/dist/mini-chat.html +9 -9
  100. package/dist/mobile.html +2 -3
  101. package/package.json +1 -1
  102. package/server/index.d.ts +6 -0
  103. package/server/index.js +1 -0
  104. package/server/lib/config-sync/DOCUMENTATION.md +12 -0
  105. package/server/lib/config-sync/magpie.js +26 -0
  106. package/server/lib/config-sync/magpie.test.js +38 -0
  107. package/server/lib/config-sync/receiver.js +1 -0
  108. package/server/lib/config-sync/routes.js +5 -0
  109. package/server/lib/config-sync/routes.test.js +12 -0
  110. package/server/lib/gui-customization/DOCUMENTATION.md +44 -2
  111. package/server/lib/gui-customization/remote-connections-client.mjs +65 -0
  112. package/server/lib/gui-customization/remote-connections.js +43 -0
  113. package/server/lib/gui-customization/remote-connections.test.js +30 -0
  114. package/server/lib/gui-customization/session-skill.js +14 -11
  115. package/server/lib/gui-customization/session-skill.test.js +12 -2
  116. package/server/lib/gui-customization/skill/SKILL.md +2 -2
  117. package/server/lib/gui-customization/skill/references/remote-connections.md +30 -0
  118. package/server/lib/opencode/DOCUMENTATION.md +7 -1
  119. package/server/lib/opencode/core-routes.js +2 -1
  120. package/server/lib/opencode/feature-routes-runtime.js +7 -0
  121. package/server/lib/opencode/feature-routes-runtime.test.js +8 -0
  122. package/server/lib/scheduled-tasks/session-skill.js +2 -1
  123. package/server/lib/scheduled-tasks/session-skill.test.js +50 -1
  124. package/dist/assets/AssistantConversationSurface-BmOHENhF.css +0 -1
  125. package/dist/assets/AssistantConversationSurface-CyJGN78Z.js +0 -3
  126. package/dist/assets/AssistantView-CFadOGiW.js +0 -1
  127. package/dist/assets/MarkdownRenderer-Bibq6sQR.js +0 -2
  128. package/dist/assets/MobileDetailNavigation-BfTbzw3E.js +0 -1
  129. package/dist/assets/mobile-B-ZWpOj6.js +0 -2
  130. package/dist/assets/mobile-html-network-dTGXQKw0.js +0 -2
  131. package/dist/assets/mobile-network-bridge-B_h92A-9.js +0 -1
  132. package/dist/assets/pwa-BZGtwuiQ.js +0 -2
  133. package/dist/assets/readiness-NhPYDe48.js +0 -1
  134. package/dist/assets/renderMobileApp-DgTlrPpr.js +0 -29
  135. package/dist/assets/runtimeEndpointReset-6jhYadQt.css +0 -1
  136. package/dist/assets/src-D-W1MV14.css +0 -2
  137. package/dist/assets/types-ChrzXO9y.js +0 -2
  138. package/dist/assets/useUIStore-BF882_0b.js +0 -1
  139. /package/dist/assets/{image-loading-DEXNCcCm.js → image-loading-BrDob6MW.js} +0 -0
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-CzHs0bHY.js";import{n as c}from"./vendor-react-DlzBev0S.js";import{t as l}from"./i18n-BU14awhU.js";import{Jn as u}from"./useMobileNavigationStore-BoZDstLm.js";import{n as d}from"./Icon-D6eeecf3.js";import{t as f}from"./multirun-DizITQa8.js";var p=c(),m=e(o(),1),h=i(),g=e=>{let i=(0,p.c)(33),{open:o,onOpenChange:c,initialPrompt:g}=e,v=m.useId(),{t:y}=l(),b=_,x;i[0]===c?x=i[1]:(x=e=>{!e&&b()||c(e)},i[0]=c,i[1]=x);let S;i[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`)}),i[2]=S):S=i[2];let C;i[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]`),i[3]=C):C=i[3];let w;i[4]===c?w=i[5]:(w=()=>c(!1),i[4]=c,i[5]=w);let T;i[6]===y?T=i[7]:(T=y(`multiRun.window.actions.closeAria`),i[6]=y,i[7]=T);let E;i[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,h.jsx)(d,{name:`close`,className:`h-5 w-5`}),i[8]=E):E=i[8];let D;i[9]!==w||i[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})}),i[9]=w,i[10]=T,i[11]=D):D=i[11];let O;i[12]===y?O=i[13]:(O=y(`multiRun.window.description`),i[12]=y,i[13]=O);let k;i[14]!==v||i[15]!==O?(k=(0,h.jsx)(s,{id:v,className:`sr-only`,children:O}),i[14]=v,i[15]=O,i[16]=k):k=i[16];let A,j;i[17]===c?(A=i[18],j=i[19]):(A=()=>c(!1),j=()=>c(!1),i[17]=c,i[18]=A,i[19]=j);let M;i[20]!==g||i[21]!==A||i[22]!==j?(M=(0,h.jsx)(f,{initialPrompt:g,onCreated:A,onCancel:j,isWindowed:!0}),i[20]=g,i[21]=A,i[22]=j,i[23]=M):M=i[23];let N;i[24]!==v||i[25]!==M||i[26]!==D||i[27]!==k?(N=(0,h.jsxs)(t,{children:[S,(0,h.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,h.jsxs)(r,{"aria-describedby":v,className:C,children:[D,k,M]})})]}),i[24]=v,i[25]=M,i[26]=D,i[27]=k,i[28]=N):N=i[28];let P;return i[29]!==o||i[30]!==x||i[31]!==N?(P=(0,h.jsx)(n,{open:o,onOpenChange:x,children:N}),i[29]=o,i[30]=x,i[31]=N,i[32]=P):P=i[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
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-CzHs0bHY.js";import{n as c}from"./vendor-react-DlzBev0S.js";import{t as l}from"./i18n-UaLestuf.js";import{Jn as u}from"./useMobileNavigationStore-CXnVqWpM.js";import{n as d}from"./Icon-CGEMyGrr.js";import{t as f}from"./multirun-DH5YM6eW.js";var p=c(),m=e(o(),1),h=i(),g=e=>{let i=(0,p.c)(33),{open:o,onOpenChange:c,initialPrompt:g}=e,v=m.useId(),{t:y}=l(),b=_,x;i[0]===c?x=i[1]:(x=e=>{!e&&b()||c(e)},i[0]=c,i[1]=x);let S;i[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`)}),i[2]=S):S=i[2];let C;i[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]`),i[3]=C):C=i[3];let w;i[4]===c?w=i[5]:(w=()=>c(!1),i[4]=c,i[5]=w);let T;i[6]===y?T=i[7]:(T=y(`multiRun.window.actions.closeAria`),i[6]=y,i[7]=T);let E;i[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,h.jsx)(d,{name:`close`,className:`h-5 w-5`}),i[8]=E):E=i[8];let D;i[9]!==w||i[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})}),i[9]=w,i[10]=T,i[11]=D):D=i[11];let O;i[12]===y?O=i[13]:(O=y(`multiRun.window.description`),i[12]=y,i[13]=O);let k;i[14]!==v||i[15]!==O?(k=(0,h.jsx)(s,{id:v,className:`sr-only`,children:O}),i[14]=v,i[15]=O,i[16]=k):k=i[16];let A,j;i[17]===c?(A=i[18],j=i[19]):(A=()=>c(!1),j=()=>c(!1),i[17]=c,i[18]=A,i[19]=j);let M;i[20]!==g||i[21]!==A||i[22]!==j?(M=(0,h.jsx)(f,{initialPrompt:g,onCreated:A,onCancel:j,isWindowed:!0}),i[20]=g,i[21]=A,i[22]=j,i[23]=M):M=i[23];let N;i[24]!==v||i[25]!==M||i[26]!==D||i[27]!==k?(N=(0,h.jsxs)(t,{children:[S,(0,h.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,h.jsxs)(r,{"aria-describedby":v,className:C,children:[D,k,M]})})]}),i[24]=v,i[25]=M,i[26]=D,i[27]=k,i[28]=N):N=i[28];let P;return i[29]!==o||i[30]!==x||i[31]!==N?(P=(0,h.jsx)(n,{open:o,onOpenChange:x,children:N}),i[29]=o,i[30]=x,i[31]=N,i[32]=P):P=i[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{n as t}from"./runtime-fetch-DKZOpfzo.js";import{E as n,V as r,Y as i,z as a}from"./platform-DMsFWy1a.js";import{b as o,i as s,n as c,r as l,s as u,v as d}from"./desktopHosts-DovfbQPm.js";import{ot as f,st as p}from"./vendor-base-ui-CzHs0bHY.js";import{Nt as m}from"./gitApiHttp-B1mApXwC.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{t as g}from"./i18n-BU14awhU.js";import{Jn as _,Kn as v,ji as y,ui as b}from"./useMobileNavigationStore-BoZDstLm.js";import{n as x}from"./Icon-D6eeecf3.js";import{o as S,r as C}from"./dialog-B1Rrafoy.js";import{t as w}from"./input-el2PLKbt.js";import{t as T}from"./YuriLogo-DcoYyXzq.js";var E=h(),D=e(p(),1),O=f();function k(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 A(e){return e===`wrong-service`||e===`unreachable`||e===`incompatible`}function j({onBack:e,showBackButton:t=!0,initialUrl:i=``,initialLabel:a=``,isRecoveryMode:u=!1,onConnect:d,onSwitchToLocal:f}){let{t:p}=g(),[m,h]=(0,D.useState)(i),[_,y]=(0,D.useState)(a),[b,x]=(0,D.useState)(`idle`),[S,C]=(0,D.useState)(null),[T,E]=(0,D.useState)(``),j=o(m),M=j?.persistedUrl??null,N=(0,D.useCallback)(e=>{h(e.target.value),x(`idle`),C(null),E(``)},[]),P=(0,D.useCallback)(e=>{y(e.target.value)},[]),F=(0,D.useCallback)(async()=>{if(M){x(`testing`),C(null),E(``);try{let e=await c(M);C(e),x(e.status===`ok`||e.status===`update-recommended`?`success`:`error`)}catch(e){E(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.connectionTestFailed`)),x(`error`)}}},[M,p]),I=(0,D.useCallback)(async()=>{if(!j)return;let e=j.persistedUrl;x(`testing`),C(null),E(``);try{let t=await c(e);if(C(t),A(t.status)){x(`error`);return}let i=await l(),a=_.trim()||e,o=i.hosts.find(t=>t.url===e),u=o?o.id:`host-${Date.now().toString(16)}`,f={id:u,label:a,url:e,apiUrl:e},p=o?i.hosts.map(e=>e.id===u?f:e):[...i.hosts,f];if(await s({hosts:p,defaultHostId:u,initialHostChoiceCompleted:!0}),d?.(),j.redeemUrl){window.location.assign(j.redeemUrl);return}n()&&await r()}catch(e){E(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.failedToSaveConnection`)),x(`error`)}},[j,_,d,p]),L=b===`testing`,R=M!==null&&!L,z=M!==null&&!L&&!A(S?.status??null),B=k(S?.status??null),V=S?.status===`ok`,H=S?.status===`update-recommended`,U=S?.status===`auth`,W=A(S?.status??null);return(0,O.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,O.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[t&&(0,O.jsx)(`div`,{className:`flex items-center`,children:(0,O.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:p(`onboarding.common.actions.back`)})}),(0,O.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,O.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:p(u?`onboarding.remoteConnection.titleRecovery`:`onboarding.remoteConnection.title`)}),(0,O.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:p(`onboarding.remoteConnection.description`)})]}),(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`label`,{htmlFor:`remote-url`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.serverAddress`)}),(0,O.jsx)(w,{id:`remote-url`,type:`url`,value:m,onChange:N,placeholder:p(`onboarding.remoteConnection.field.serverAddressPlaceholder`),disabled:L})]}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`label`,{htmlFor:`remote-label`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.nameOptional`)}),(0,O.jsx)(w,{id:`remote-label`,type:`text`,value:_,onChange:P,placeholder:p(`onboarding.remoteConnection.field.namePlaceholder`),disabled:L})]})]}),S&&V&&(0,O.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:S.latencyMs})}),S&&U&&(0,O.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`)}),S&&H&&(0,O.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:B?p(B):null}),S&&W&&(0,O.jsxs)(`div`,{className:`rounded-lg border p-3 text-sm space-y-3`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-semibold mb-1`,children:p(`onboarding.remoteConnection.status.connectionFailed`)}),(0,O.jsx)(`div`,{className:`opacity-90`,children:B?p(B):null})]}),(0,O.jsx)(`div`,{className:`text-xs opacity-80`,children:S.status===`unreachable`?p(`onboarding.remoteConnection.status.suggestionsUnreachable`):p(`onboarding.remoteConnection.status.suggestionsWrongService`)})]}),T&&(0,O.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:T}),(0,O.jsxs)(`div`,{className:`flex gap-3`,children:[(0,O.jsx)(v,{variant:`outline`,onClick:F,disabled:!R,children:p(L?`onboarding.remoteConnection.actions.testing`:`onboarding.remoteConnection.actions.testConnection`)}),(0,O.jsx)(v,{onClick:I,disabled:!z,children:p(`onboarding.remoteConnection.actions.connectAndRestart`)})]}),W&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t border-border`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:p(`onboarding.remoteConnection.actions.whatToDo`)}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(v,{variant:`outline`,size:`sm`,onClick:e,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.chooseDifferentServer`)}),!u&&f&&(0,O.jsx)(v,{variant:`outline`,size:`sm`,onClick:f,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.useLocalInstead`)})]})]})]})})}async function M(){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 N(){return(await t(`/api/opencode/retry`,{method:`POST`})).ok?M():!1}var P=`curl -fsSL https://opencode.ai/v2/install | bash`,F=`https://opencode.ai/docs`,I=2500,L=1e4;function R(e){let t=(0,E.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsxs)(`code`,{className:`flex-1 text-left overflow-x-auto whitespace-nowrap`,children:[(0,O.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,O.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,O.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,O.jsx)(x,{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,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full`,children:[i,(0,O.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 z({onCliAvailable:e}){let{t:o}=g(),[c,u]=D.useState(!1),[d,f]=D.useState(!1),[p,h]=D.useState(!1),[b,S]=D.useState(!1),[C,T]=D.useState(``),[E,k]=D.useState(`unknown`),[A,z]=D.useState(`local`),[B,V]=D.useState(!1),[H,U]=D.useState(!1),[W,G]=D.useState(null),K=D.useRef(!1);D.useEffect(()=>{f(n())},[]),D.useEffect(()=>{if(typeof navigator>`u`){k(`unknown`);return}let e=navigator.userAgent||``;/Windows/i.test(e)?k(`windows`):/Macintosh|Mac OS X/i.test(e)?k(`macos`):/Linux/i.test(e)?k(`linux`):k(`unknown`)},[]),D.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&&T(i)}catch{}})(),()=>{e=!0}},[]);let q=D.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&&d&&await i()},[d]),J=D.useCallback(async e=>{if(!d)return;let t=await l();await s({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})},[d]),Y=D.useCallback(async()=>{if(!K.current){K.current=!0;try{d&&await J(`local`),await e?.()}catch(e){throw K.current=!1,e}}},[d,e,J]);D.useEffect(()=>{if(A!==`local`)return;let e=!1,t=null,n=0,r=async()=>{if(!e){try{let t=await M(),r=Date.now();if(!t&&r-n>=L&&(n=r,t=await N()),e)return;if(t){await Y();return}}catch{}e||(t=setTimeout(r,I))}};return t=setTimeout(r,I),()=>{e=!0,t&&clearTimeout(t)}},[A,Y]);let X=D.useCallback(async()=>{S(!0),G(null);try{let e=await M();e||=await N(),e?await Y():G(o(`onboarding.localSetup.errors.cliNotReady`))}catch{G(o(`onboarding.localSetup.errors.detectionFailed`))}finally{S(!1)}},[Y,o]),Z=D.useCallback(async()=>{if(!(typeof window>`u`)&&d)try{let e=await a();e.success&&e.path&&e.path.trim().length>0&&T(e.path.trim())}catch{}},[d]),Q=D.useCallback(async()=>{h(!0);try{if(await m({opencodeBinary:C.trim()}),d){await J(`local`),await r();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>h(!1),1e3)}},[d,C,J]),$=D.useCallback(async()=>{let e=await y(P);e.ok?(u(!0),setTimeout(()=>u(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),ee=F,te=E===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:E===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`,ne=!d||A===`local`;return(0,O.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,O.jsxs)(`div`,{className:`w-full max-w-md space-y-7`,children:[(0,O.jsxs)(`header`,{className:`text-center space-y-1.5`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground`,children:o(`onboarding.chooser.title`)}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`onboarding.chooser.description`)})]}),d&&(0,O.jsxs)(`div`,{className:`app-region-no-drag flex gap-1.5`,children:[(0,O.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,A===`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:o(`onboarding.chooser.tabs.localInstall`)}),(0,O.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,A===`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:o(`onboarding.chooser.tabs.connectRemote`)})]}),d&&A===`remote`?(0,O.jsx)(`div`,{className:`app-region-no-drag`,children:(0,O.jsx)(j,{onBack:()=>z(`local`),showBackButton:!1,onSwitchToLocal:()=>z(`local`)})}):null,ne&&(0,O.jsxs)(`div`,{className:`space-y-4`,children:[E===`windows`&&(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-4`,children:[(0,O.jsx)(`div`,{className:`text-sm text-foreground`,children:o(`onboarding.localSetup.windows.title`)}),(0,O.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground text-center leading-relaxed`,children:o(`onboarding.localSetup.intro`)}),(0,O.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,O.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--status-success)`},children:[(0,O.jsx)(x,{name:`check`,className:`h-4 w-4`}),o(`onboarding.common.status.copiedToClipboard`)]}):(0,O.jsx)(R,{onCopy:$,copyTitle:o(`onboarding.common.copyToClipboard`)})}),(0,O.jsxs)(`div`,{className:`app-region-no-drag flex items-center justify-between`,children:[(0,O.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:[o(E===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,O.jsx)(x,{name:`external-link`,className:`h-3 w-3`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:X,disabled:b,className:`text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,children:o(b?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkNow`)})]}),W&&(0,O.jsx)(`p`,{role:`alert`,className:`text-center text-xs text-[var(--status-error-foreground)]`,children:W}),(0,O.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,O.jsxs)(`span`,{className:`relative inline-flex h-2.5 w-2.5 shrink-0`,"aria-hidden":!0,children:[(0,O.jsx)(`span`,{className:`absolute inset-0 rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity 1.6s ease-in-out infinite`}}),(0,O.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,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm text-foreground leading-tight`,children:o(`onboarding.localSetup.status.watching`)}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground leading-tight mt-0.5`,children:o(`onboarding.localSetup.status.autoContinue`)})]})]}),(0,O.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,O.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,O.jsx)(`span`,{children:o(`onboarding.localSetup.advanced.title`)}),(0,O.jsx)(x,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,O.jsxs)(`div`,{className:`pb-4 space-y-2`,children:[(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(w,{value:C,onChange:e=>T(e.target.value),placeholder:te,disabled:p,className:`flex-1 font-mono text-xs`}),(0,O.jsx)(v,{type:`button`,variant:`secondary`,size:`sm`,onClick:Z,disabled:p||!d,children:o(`onboarding.localSetup.actions.browse`)}),(0,O.jsx)(v,{type:`button`,size:`sm`,onClick:Q,disabled:p||!C.trim(),children:o(`onboarding.localSetup.actions.apply`)})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:o(`onboarding.localSetup.helper.saveAndReload`)})]})]}),(0,O.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,O.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,O.jsx)(`span`,{children:o(`onboarding.localSetup.troubleshoot.title`)}),(0,O.jsx)(x,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,O.jsx)(`ul`,{className:`pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4`,children:E===`windows`?(0,O.jsx)(O.Fragment,{children:(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.hint.ensurePath`)}),(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.hint.setEnv`)}),(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.hint.missingRuntime`)})]})})]})]})]})})}var B=`curl -fsSL https://opencode.ai/v2/install | bash`,V=`https://opencode.ai/docs`;function H(e){let t=(0,E.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsxs)(`code`,{children:[(0,O.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,O.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,O.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,O.jsx)(x,{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,O.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[i,(0,O.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 U=3e4;function W({onBack:e,onCliAvailable:o,isFromRecovery:s=!1,onSwitchToRemote:c}){let{t:l}=g(),[u,d]=D.useState(!1),[f,p]=D.useState(!1),[h,_]=D.useState(!1),[b,S]=D.useState(!1),[C,T]=D.useState(!1),[E,k]=D.useState(null),[A,j]=D.useState(``),[P,F]=D.useState(`unknown`);D.useEffect(()=>{let e=setTimeout(()=>p(!0),U);return()=>clearTimeout(e)},[]),D.useEffect(()=>{_(n())},[]),D.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`)},[]),D.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&&j(i)}catch{}})(),()=>{e=!0}},[]);let I=D.useCallback(async e=>{e.target.closest(`button, a, input, select, textarea, code`)||e.button===0&&h&&await i()},[h]),L=D.useCallback(async()=>{if(!(typeof window>`u`)&&h)try{let e=await a();e.success&&e.path&&e.path.trim().length>0&&j(e.path.trim())}catch{}},[h]),R=D.useCallback(async()=>{S(!0);try{if(await m({opencodeBinary:A.trim()}),h){await r();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>S(!1),1e3)}},[h,A]),z=D.useCallback(async()=>{let e=await y(B);e.ok?(d(!0),setTimeout(()=>d(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),W=D.useCallback(async()=>{T(!0),k(null);try{let e=await M();e||=await N(),e?o?.():k(l(`onboarding.localSetup.errors.cliNotReady`))}catch(e){k(e instanceof Error?e.message:l(`onboarding.localSetup.errors.detectionFailed`))}finally{T(!1)}},[o,l]),G=V,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,O.jsxs)(`div`,{className:`h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none`,onMouseDown:I,children:[(0,O.jsxs)(`div`,{className:`w-full max-w-lg space-y-4 text-center`,children:[(0,O.jsx)(`div`,{className:`flex items-center`,children:(0,O.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:l(`onboarding.common.actions.back`)})}),(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:l(`onboarding.localSetup.title`)}),(0,O.jsx)(`p`,{className:`text-muted-foreground`,children:l(`onboarding.localSetup.description`)})]}),P===`windows`&&(0,O.jsxs)(`div`,{className:`mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left`,children:[(0,O.jsx)(`div`,{className:`text-sm text-foreground`,children:l(`onboarding.localSetup.windows.title`)}),(0,O.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,O.jsx)(`li`,{children:l(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,O.jsx)(`li`,{children:l(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,O.jsx)(`div`,{className:`flex justify-center`,children:(0,O.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:u?(0,O.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,style:{color:`var(--status-success)`},children:[(0,O.jsx)(x,{name:`check`,className:`h-4 w-4`}),l(`onboarding.common.status.copiedToClipboard`)]}):(0,O.jsx)(H,{onCopy:z,copyTitle:l(`onboarding.common.copyToClipboard`)})})}),(0,O.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:[l(P===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,O.jsx)(x,{name:`external-link`,className:`h-3 w-3`})]}),E&&(0,O.jsx)(`div`,{className:`mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive`,children:E}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(v,{type:`button`,onClick:W,disabled:C,className:`w-full max-w-xs`,size:`lg`,children:l(C?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkAndContinue`)}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`onboarding.localSetup.helper.checkAndContinue`)})]}),(0,O.jsx)(`div`,{className:`mx-auto w-full max-w-xl pt-4`,children:(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:l(`onboarding.localSetup.field.alreadyInstalled`)}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(w,{value:A,onChange:e=>j(e.target.value),placeholder:K,disabled:b,className:`flex-1 font-mono text-xs`}),(0,O.jsx)(v,{type:`button`,variant:`secondary`,onClick:L,disabled:b||!h,children:l(`onboarding.localSetup.actions.browse`)}),(0,O.jsx)(v,{type:`button`,onClick:R,disabled:b,children:l(`onboarding.localSetup.actions.apply`)})]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:l(`onboarding.localSetup.helper.saveAndReload`)})]})}),s&&c&&(0,O.jsxs)(`div`,{className:`text-center pt-4`,children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:l(`onboarding.localSetup.remotePreference`)}),(0,O.jsx)(v,{variant:`link`,onClick:c,children:l(`onboarding.localSetup.actions.connectRemoteServer`)})]})]}),f&&(0,O.jsx)(`div`,{className:`absolute bottom-8 left-0 right-0 text-center space-y-1`,children:P===`windows`?(0,O.jsx)(O.Fragment,{children:(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.hint.ensurePath`)}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.hint.setEnv`)}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.hint.missingRuntime`)})]})})]})}function G(e,t){if(e?.trim())return d(e.trim());if(t)return d(t)}function K(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-pairing-expired`:return{title:`Pairing expired`,description:`Get a new connection link from the other computer.`,titleKey:`mobile.connect.pairing.expired`,descriptionKey:`desktopHostSwitcher.pairing.reconnectHint`,iconKey:`remote`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Manage instances`,useRemoteLabelKey:`settings.remoteInstances.openLocalManager`};case`remote-unreachable`:{let e=G(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=G(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=G(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 q(e){switch(e){case`local`:return(0,O.jsx)(x,{name:`macbook`,className:`h-8 w-8`});case`remote`:return(0,O.jsx)(x,{name:`server`,className:`h-8 w-8`})}}function J({variant:e,hostLabel:t,hostUrl:n,onRetry:r,onUseLocal:i,onUseRemote:a,isRetrying:o=!1}){let{t:s}=g(),c=K(e,t,n),l=c.retryLabelKey??`onboarding.desktopRecovery.actions.retryConnection`,u=D.useMemo(()=>{if(c.descriptionParams?.host)return c.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`)}},[c.descriptionParams,s,e]);return(0,O.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,O.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[(0,O.jsx)(`div`,{className:`p-3 rounded-full`,style:{backgroundColor:`var(--status-warning)`,opacity:.15},children:(0,O.jsx)(`div`,{style:{color:`var(--status-warning)`},children:q(c.iconKey)})}),(0,O.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:s(c.titleKey)}),(0,O.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-sm`,children:s(c.descriptionKey,u)})]}),n&&(e===`remote-unreachable`||e===`remote-wrong-service`||e===`remote-incompatible`)&&(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:s(`onboarding.remoteConnection.field.serverAddress`)}),(0,O.jsx)(`div`,{className:`font-mono text-sm text-foreground truncate`,children:d(n)})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c.showRetry&&r&&(0,O.jsxs)(v,{onClick:r,disabled:o,className:`w-full`,children:[(0,O.jsx)(x,{name:`refresh`,className:_(`h-4 w-4`,o&&`animate-spin`)}),s(o?`onboarding.desktopRecovery.actions.retrying`:l)]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[c.showUseLocal&&i&&(0,O.jsxs)(v,{variant:`outline`,onClick:i,disabled:o,className:`flex-1`,children:[(0,O.jsx)(x,{name:`macbook`,className:`h-4 w-4`}),s(c.useLocalLabelKey)]}),c.showUseRemote&&a&&(0,O.jsxs)(v,{variant:`outline`,onClick:a,disabled:o,className:`flex-1`,children:[(0,O.jsx)(x,{name:`server`,className:`h-4 w-4`}),s(c.useRemoteLabelKey)]})]})]})]})})}function Y(e,t){if(t===`use-remote`)return e===`remote-pairing-expired`?{kind:`local-host-settings`}:{kind:`remote-form`};switch(e){case`local-unavailable`:return{kind:`local-setup`};case`remote-unreachable`:case`remote-pairing-expired`: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 X(e){let i=(0,E.c)(28),{variant:a,hostUrl:o,hostLabel:s,onRetry:c,onChooseRemote:l,showRemoteForm:d,onCloseRemoteForm:f,onSwitchToLocalFromRemote:p,onEnterLocalSetup:m,isRetrying:h}=e,_=d!==void 0&&d,v=h!==void 0&&h,{t:y}=g(),x=Z,S;i[0]===c?S=i[1]:(S=async()=>{if(n()){await r();return}await t(`/api/config/reload`,{method:`POST`}),c?.()},i[0]=c,i[1]=S);let C=S,w;i[2]!==m||i[3]!==a?(w=async()=>{if(Y(a,`use-local`).kind===`local-setup`){m?.();return}if(await x(`local`),n()){await r();return}window.location.reload()},i[2]=m,i[3]=a,i[4]=w):w=i[4];let T=w,D;i[5]!==l||i[6]!==y||i[7]!==a?(D=()=>{let e=Y(a,`use-remote`);if(e.kind===`local-host-settings`){u().catch(()=>b.error(y(`sessionAuth.error.networkTitle`)));return}e.kind===`remote-form`&&l?.()},i[5]=l,i[6]=y,i[7]=a,i[8]=D):D=i[8];let k=D;if(_){let e=a===`remote-wrong-service`?``:o||``,t=a===`remote-wrong-service`?``:s||``,c;i[9]!==l||i[10]!==f?(c=f||(()=>l?.()),i[9]=l,i[10]=f,i[11]=c):c=i[11];let u;i[12]!==m||i[13]!==p?(u=p||(()=>{x(`local`).then(()=>{n()?r():m?.()})}),i[12]=m,i[13]=p,i[14]=u):u=i[14];let d;return i[15]!==t||i[16]!==e||i[17]!==c||i[18]!==u?(d=(0,O.jsx)(j,{onBack:c,initialUrl:e,initialLabel:t,isRecoveryMode:!0,onSwitchToLocal:u}),i[15]=t,i[16]=e,i[17]=c,i[18]=u,i[19]=d):d=i[19],d}let A;return i[20]!==C||i[21]!==T||i[22]!==k||i[23]!==s||i[24]!==o||i[25]!==v||i[26]!==a?(A=(0,O.jsx)(J,{variant:a,hostLabel:s,hostUrl:o,onRetry:C,onUseLocal:T,onUseRemote:k,isRetrying:v}),i[20]=C,i[21]=T,i[22]=k,i[23]=s,i[24]=o,i[25]=v,i[26]=a,i[27]=A):A=i[27],A}async function Z(e){if(!n())return;let t=await l();await s({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})}function Q(e){let t=(0,E.c)(50),{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]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,O.jsx)(T,{width:120,height:120,className:`block h-[120px] w-[120px] [&_path]:fill-[var(--splash-logo-fill,currentColor)]`}),t[0]=d):d=t[0];let f;t[1]===a?f=t[2]:(f=a(`onboarding.index.title`),t[1]=a,t[2]=f);let p=Math.max(s,1),m=s>0?c:void 0,h;t[3]!==c||t[4]!==a||t[5]!==s?(h=a(`commandPalette.index.progress`,{completed:c,total:s}),t[3]=c,t[4]=a,t[5]=s,t[6]=h):h=t[6];let _=`absolute inset-0 size-full -rotate-90 ${u===null&&!l?`motion-safe:animate-spin motion-safe:[animation-duration:3s]`:``}`,y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,O.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,stroke:`currentColor`,strokeWidth:`1.5`,className:`text-border`}),t[7]=y):y=t[7];let b=100-(u??.22)*100,x;t[8]===b?x=t[9]:(x=(0,O.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,pathLength:`100`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`100`,strokeDashoffset:b,className:`text-foreground/80 motion-safe:transition-[stroke-dashoffset] motion-safe:duration-700`}),t[8]=b,t[9]=x);let w;t[10]===u?w=t[11]:(w=u!==null&&u>0&&u<1&&(0,O.jsx)(`g`,{style:{transform:`rotate(${u*360}deg)`,transformOrigin:`96px 96px`},className:`motion-safe:transition-transform motion-safe:duration-700`,children:(0,O.jsx)(`circle`,{cx:`180`,cy:`96`,r:`3`,fill:`currentColor`,className:`text-foreground`})}),t[10]=u,t[11]=w);let D;t[12]!==w||t[13]!==_||t[14]!==x?(D=(0,O.jsxs)(`svg`,{viewBox:`0 0 192 192`,fill:`none`,"aria-hidden":`true`,className:_,children:[y,x,w]}),t[12]=w,t[13]=_,t[14]=x,t[15]=D):D=t[15];let k;t[16]!==D||t[17]!==f||t[18]!==p||t[19]!==m||t[20]!==h?(k=(0,O.jsxs)(`div`,{className:`absolute left-1/2 top-1/2 h-[120px] w-[120px] -translate-x-1/2 -translate-y-1/2`,children:[d,(0,O.jsx)(`div`,{role:`progressbar`,"aria-label":f,"aria-valuemin":0,"aria-valuemax":p,"aria-valuenow":m,"aria-valuetext":h,className:`pointer-events-none absolute -inset-9`,children:D})]}),t[16]=D,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=k):k=t[21];let A;t[22]!==o||t[23]!==u?(A=u!==null&&(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`mb-3 text-sm tabular-nums text-muted-foreground`,children:new Intl.NumberFormat(o,{style:`percent`,maximumFractionDigits:0}).format(u)}),t[22]=o,t[23]=u,t[24]=A):A=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j={fontSize:`1.0625rem`,fontWeight:450},t[25]=j):j=t[25];let M;t[26]===a?M=t[27]:(M=a(`onboarding.index.title`),t[26]=a,t[27]=M);let N;t[28]===M?N=t[29]:(N=(0,O.jsx)(S,{className:`tracking-tight`,style:j,children:M}),t[28]=M,t[29]=N);let P;t[30]!==l||t[31]!==a?(P=a(l?`onboarding.index.retrying`:`onboarding.index.description`),t[30]=l,t[31]=a,t[32]=P):P=t[32];let F;t[33]===P?F=t[34]:(F=(0,O.jsx)(C,{className:`text-xs text-muted-foreground`,children:P}),t[33]=P,t[34]=F);let I;t[35]!==N||t[36]!==F?(I=(0,O.jsxs)(`header`,{className:`space-y-2.5`,role:`status`,"aria-live":`polite`,children:[N,F]}),t[35]=N,t[36]=F,t[37]=I):I=t[37];let L;t[38]===a?L=t[39]:(L=a(`onboarding.index.background`),t[38]=a,t[39]=L);let R;t[40]!==i||t[41]!==L?(R=(0,O.jsx)(v,{size:`sm`,className:`mt-8 text-xs font-normal`,onClick:i,children:L}),t[40]=i,t[41]=L,t[42]=R):R=t[42];let z;t[43]!==A||t[44]!==I||t[45]!==R?(z=(0,O.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 top-[calc(50%+116px)] overflow-y-auto px-6 pb-6 text-center`,children:(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm flex-col items-center`,children:[A,I,R]})}),t[43]=A,t[44]=I,t[45]=R,t[46]=z):z=t[46];let B;return t[47]!==k||t[48]!==z?(B=(0,O.jsxs)(`div`,{className:`absolute inset-0 overflow-hidden`,"data-content-index-onboarding":!0,children:[k,z]}),t[47]=k,t[48]=z,t[49]=B):B=t[49],B}function $(e){let t=(0,E.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]=D.useState(!1),[g,_]=D.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],D.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,O.jsx)(Q,{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,O.jsx)(X,{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,O.jsx)(W,{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,O.jsx)(z,{onCliAvailable:r}),t[28]=r,t[29]=x),x}export{$ as OnboardingScreen};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./runtime-fetch-DKZOpfzo.js";import{E as n,V as r,Y as i,z as a}from"./platform-DMsFWy1a.js";import{b as o,i as s,n as c,r as l,s as u,v as d}from"./desktopHosts-DovfbQPm.js";import{ot as f,st as p}from"./vendor-base-ui-CzHs0bHY.js";import{Nt as m}from"./gitApiHttp-D4d-rgcR.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{t as g}from"./i18n-UaLestuf.js";import{Jn as _,Kn as v,ji as y,ui as b}from"./useMobileNavigationStore-CXnVqWpM.js";import{n as x}from"./Icon-CGEMyGrr.js";import{o as S,r as C}from"./dialog-wNy9dklb.js";import{t as w}from"./input-DKLf8ixL.js";import{t as T}from"./YuriLogo-B58GIl2v.js";var E=h(),D=e(p(),1),O=f();function k(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 A(e){return e===`wrong-service`||e===`unreachable`||e===`incompatible`}function j({onBack:e,showBackButton:t=!0,initialUrl:i=``,initialLabel:a=``,isRecoveryMode:u=!1,onConnect:d,onSwitchToLocal:f}){let{t:p}=g(),[m,h]=(0,D.useState)(i),[_,y]=(0,D.useState)(a),[b,x]=(0,D.useState)(`idle`),[S,C]=(0,D.useState)(null),[T,E]=(0,D.useState)(``),j=o(m),M=j?.persistedUrl??null,N=(0,D.useCallback)(e=>{h(e.target.value),x(`idle`),C(null),E(``)},[]),P=(0,D.useCallback)(e=>{y(e.target.value)},[]),F=(0,D.useCallback)(async()=>{if(M){x(`testing`),C(null),E(``);try{let e=await c(M);C(e),x(e.status===`ok`||e.status===`update-recommended`?`success`:`error`)}catch(e){E(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.connectionTestFailed`)),x(`error`)}}},[M,p]),I=(0,D.useCallback)(async()=>{if(!j)return;let e=j.persistedUrl;x(`testing`),C(null),E(``);try{let t=await c(e);if(C(t),A(t.status)){x(`error`);return}let i=await l(),a=_.trim()||e,o=i.hosts.find(t=>t.url===e),u=o?o.id:`host-${Date.now().toString(16)}`,f={id:u,label:a,url:e,apiUrl:e},p=o?i.hosts.map(e=>e.id===u?f:e):[...i.hosts,f];if(await s({hosts:p,defaultHostId:u,initialHostChoiceCompleted:!0}),d?.(),j.redeemUrl){window.location.assign(j.redeemUrl);return}n()&&await r()}catch(e){E(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.failedToSaveConnection`)),x(`error`)}},[j,_,d,p]),L=b===`testing`,R=M!==null&&!L,z=M!==null&&!L&&!A(S?.status??null),B=k(S?.status??null),V=S?.status===`ok`,H=S?.status===`update-recommended`,U=S?.status===`auth`,W=A(S?.status??null);return(0,O.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,O.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[t&&(0,O.jsx)(`div`,{className:`flex items-center`,children:(0,O.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:p(`onboarding.common.actions.back`)})}),(0,O.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,O.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:p(u?`onboarding.remoteConnection.titleRecovery`:`onboarding.remoteConnection.title`)}),(0,O.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:p(`onboarding.remoteConnection.description`)})]}),(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`label`,{htmlFor:`remote-url`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.serverAddress`)}),(0,O.jsx)(w,{id:`remote-url`,type:`url`,value:m,onChange:N,placeholder:p(`onboarding.remoteConnection.field.serverAddressPlaceholder`),disabled:L})]}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`label`,{htmlFor:`remote-label`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.nameOptional`)}),(0,O.jsx)(w,{id:`remote-label`,type:`text`,value:_,onChange:P,placeholder:p(`onboarding.remoteConnection.field.namePlaceholder`),disabled:L})]})]}),S&&V&&(0,O.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:S.latencyMs})}),S&&U&&(0,O.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`)}),S&&H&&(0,O.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:B?p(B):null}),S&&W&&(0,O.jsxs)(`div`,{className:`rounded-lg border p-3 text-sm space-y-3`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-semibold mb-1`,children:p(`onboarding.remoteConnection.status.connectionFailed`)}),(0,O.jsx)(`div`,{className:`opacity-90`,children:B?p(B):null})]}),(0,O.jsx)(`div`,{className:`text-xs opacity-80`,children:S.status===`unreachable`?p(`onboarding.remoteConnection.status.suggestionsUnreachable`):p(`onboarding.remoteConnection.status.suggestionsWrongService`)})]}),T&&(0,O.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:T}),(0,O.jsxs)(`div`,{className:`flex gap-3`,children:[(0,O.jsx)(v,{variant:`outline`,onClick:F,disabled:!R,children:p(L?`onboarding.remoteConnection.actions.testing`:`onboarding.remoteConnection.actions.testConnection`)}),(0,O.jsx)(v,{onClick:I,disabled:!z,children:p(`onboarding.remoteConnection.actions.connectAndRestart`)})]}),W&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t border-border`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:p(`onboarding.remoteConnection.actions.whatToDo`)}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(v,{variant:`outline`,size:`sm`,onClick:e,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.chooseDifferentServer`)}),!u&&f&&(0,O.jsx)(v,{variant:`outline`,size:`sm`,onClick:f,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.useLocalInstead`)})]})]})]})})}async function M(){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 N(){return(await t(`/api/opencode/retry`,{method:`POST`})).ok?M():!1}var P=`curl -fsSL https://opencode.ai/v2/install | bash`,F=`https://opencode.ai/docs`,I=2500,L=1e4;function R(e){let t=(0,E.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsxs)(`code`,{className:`flex-1 text-left overflow-x-auto whitespace-nowrap`,children:[(0,O.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,O.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,O.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,O.jsx)(x,{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,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full`,children:[i,(0,O.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 z({onCliAvailable:e}){let{t:o}=g(),[c,u]=D.useState(!1),[d,f]=D.useState(!1),[p,h]=D.useState(!1),[b,S]=D.useState(!1),[C,T]=D.useState(``),[E,k]=D.useState(`unknown`),[A,z]=D.useState(`local`),[B,V]=D.useState(!1),[H,U]=D.useState(!1),[W,G]=D.useState(null),K=D.useRef(!1);D.useEffect(()=>{f(n())},[]),D.useEffect(()=>{if(typeof navigator>`u`){k(`unknown`);return}let e=navigator.userAgent||``;/Windows/i.test(e)?k(`windows`):/Macintosh|Mac OS X/i.test(e)?k(`macos`):/Linux/i.test(e)?k(`linux`):k(`unknown`)},[]),D.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&&T(i)}catch{}})(),()=>{e=!0}},[]);let q=D.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&&d&&await i()},[d]),J=D.useCallback(async e=>{if(!d)return;let t=await l();await s({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})},[d]),Y=D.useCallback(async()=>{if(!K.current){K.current=!0;try{d&&await J(`local`),await e?.()}catch(e){throw K.current=!1,e}}},[d,e,J]);D.useEffect(()=>{if(A!==`local`)return;let e=!1,t=null,n=0,r=async()=>{if(!e){try{let t=await M(),r=Date.now();if(!t&&r-n>=L&&(n=r,t=await N()),e)return;if(t){await Y();return}}catch{}e||(t=setTimeout(r,I))}};return t=setTimeout(r,I),()=>{e=!0,t&&clearTimeout(t)}},[A,Y]);let X=D.useCallback(async()=>{S(!0),G(null);try{let e=await M();e||=await N(),e?await Y():G(o(`onboarding.localSetup.errors.cliNotReady`))}catch{G(o(`onboarding.localSetup.errors.detectionFailed`))}finally{S(!1)}},[Y,o]),Z=D.useCallback(async()=>{if(!(typeof window>`u`)&&d)try{let e=await a();e.success&&e.path&&e.path.trim().length>0&&T(e.path.trim())}catch{}},[d]),Q=D.useCallback(async()=>{h(!0);try{if(await m({opencodeBinary:C.trim()}),d){await J(`local`),await r();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>h(!1),1e3)}},[d,C,J]),$=D.useCallback(async()=>{let e=await y(P);e.ok?(u(!0),setTimeout(()=>u(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),ee=F,te=E===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:E===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`,ne=!d||A===`local`;return(0,O.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,O.jsxs)(`div`,{className:`w-full max-w-md space-y-7`,children:[(0,O.jsxs)(`header`,{className:`text-center space-y-1.5`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground`,children:o(`onboarding.chooser.title`)}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`onboarding.chooser.description`)})]}),d&&(0,O.jsxs)(`div`,{className:`app-region-no-drag flex gap-1.5`,children:[(0,O.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,A===`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:o(`onboarding.chooser.tabs.localInstall`)}),(0,O.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,A===`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:o(`onboarding.chooser.tabs.connectRemote`)})]}),d&&A===`remote`?(0,O.jsx)(`div`,{className:`app-region-no-drag`,children:(0,O.jsx)(j,{onBack:()=>z(`local`),showBackButton:!1,onSwitchToLocal:()=>z(`local`)})}):null,ne&&(0,O.jsxs)(`div`,{className:`space-y-4`,children:[E===`windows`&&(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-4`,children:[(0,O.jsx)(`div`,{className:`text-sm text-foreground`,children:o(`onboarding.localSetup.windows.title`)}),(0,O.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground text-center leading-relaxed`,children:o(`onboarding.localSetup.intro`)}),(0,O.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,O.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--status-success)`},children:[(0,O.jsx)(x,{name:`check`,className:`h-4 w-4`}),o(`onboarding.common.status.copiedToClipboard`)]}):(0,O.jsx)(R,{onCopy:$,copyTitle:o(`onboarding.common.copyToClipboard`)})}),(0,O.jsxs)(`div`,{className:`app-region-no-drag flex items-center justify-between`,children:[(0,O.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:[o(E===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,O.jsx)(x,{name:`external-link`,className:`h-3 w-3`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:X,disabled:b,className:`text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,children:o(b?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkNow`)})]}),W&&(0,O.jsx)(`p`,{role:`alert`,className:`text-center text-xs text-[var(--status-error-foreground)]`,children:W}),(0,O.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,O.jsxs)(`span`,{className:`relative inline-flex h-2.5 w-2.5 shrink-0`,"aria-hidden":!0,children:[(0,O.jsx)(`span`,{className:`absolute inset-0 rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity 1.6s ease-in-out infinite`}}),(0,O.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,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm text-foreground leading-tight`,children:o(`onboarding.localSetup.status.watching`)}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground leading-tight mt-0.5`,children:o(`onboarding.localSetup.status.autoContinue`)})]})]}),(0,O.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,O.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,O.jsx)(`span`,{children:o(`onboarding.localSetup.advanced.title`)}),(0,O.jsx)(x,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,O.jsxs)(`div`,{className:`pb-4 space-y-2`,children:[(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(w,{value:C,onChange:e=>T(e.target.value),placeholder:te,disabled:p,className:`flex-1 font-mono text-xs`}),(0,O.jsx)(v,{type:`button`,variant:`secondary`,size:`sm`,onClick:Z,disabled:p||!d,children:o(`onboarding.localSetup.actions.browse`)}),(0,O.jsx)(v,{type:`button`,size:`sm`,onClick:Q,disabled:p||!C.trim(),children:o(`onboarding.localSetup.actions.apply`)})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:o(`onboarding.localSetup.helper.saveAndReload`)})]})]}),(0,O.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,O.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,O.jsx)(`span`,{children:o(`onboarding.localSetup.troubleshoot.title`)}),(0,O.jsx)(x,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,O.jsx)(`ul`,{className:`pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4`,children:E===`windows`?(0,O.jsx)(O.Fragment,{children:(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.hint.ensurePath`)}),(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.hint.setEnv`)}),(0,O.jsx)(`li`,{children:o(`onboarding.localSetup.hint.missingRuntime`)})]})})]})]})]})})}var B=`curl -fsSL https://opencode.ai/v2/install | bash`,V=`https://opencode.ai/docs`;function H(e){let t=(0,E.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsxs)(`code`,{children:[(0,O.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,O.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/v2/install`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,O.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,O.jsx)(x,{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,O.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[i,(0,O.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 U=3e4;function W({onBack:e,onCliAvailable:o,isFromRecovery:s=!1,onSwitchToRemote:c}){let{t:l}=g(),[u,d]=D.useState(!1),[f,p]=D.useState(!1),[h,_]=D.useState(!1),[b,S]=D.useState(!1),[C,T]=D.useState(!1),[E,k]=D.useState(null),[A,j]=D.useState(``),[P,F]=D.useState(`unknown`);D.useEffect(()=>{let e=setTimeout(()=>p(!0),U);return()=>clearTimeout(e)},[]),D.useEffect(()=>{_(n())},[]),D.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`)},[]),D.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&&j(i)}catch{}})(),()=>{e=!0}},[]);let I=D.useCallback(async e=>{e.target.closest(`button, a, input, select, textarea, code`)||e.button===0&&h&&await i()},[h]),L=D.useCallback(async()=>{if(!(typeof window>`u`)&&h)try{let e=await a();e.success&&e.path&&e.path.trim().length>0&&j(e.path.trim())}catch{}},[h]),R=D.useCallback(async()=>{S(!0);try{if(await m({opencodeBinary:A.trim()}),h){await r();return}await t(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>S(!1),1e3)}},[h,A]),z=D.useCallback(async()=>{let e=await y(B);e.ok?(d(!0),setTimeout(()=>d(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),W=D.useCallback(async()=>{T(!0),k(null);try{let e=await M();e||=await N(),e?o?.():k(l(`onboarding.localSetup.errors.cliNotReady`))}catch(e){k(e instanceof Error?e.message:l(`onboarding.localSetup.errors.detectionFailed`))}finally{T(!1)}},[o,l]),G=V,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,O.jsxs)(`div`,{className:`h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none`,onMouseDown:I,children:[(0,O.jsxs)(`div`,{className:`w-full max-w-lg space-y-4 text-center`,children:[(0,O.jsx)(`div`,{className:`flex items-center`,children:(0,O.jsx)(v,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:l(`onboarding.common.actions.back`)})}),(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:l(`onboarding.localSetup.title`)}),(0,O.jsx)(`p`,{className:`text-muted-foreground`,children:l(`onboarding.localSetup.description`)})]}),P===`windows`&&(0,O.jsxs)(`div`,{className:`mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left`,children:[(0,O.jsx)(`div`,{className:`text-sm text-foreground`,children:l(`onboarding.localSetup.windows.title`)}),(0,O.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,O.jsx)(`li`,{children:l(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,O.jsx)(`li`,{children:l(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,O.jsx)(`div`,{className:`flex justify-center`,children:(0,O.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:u?(0,O.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,style:{color:`var(--status-success)`},children:[(0,O.jsx)(x,{name:`check`,className:`h-4 w-4`}),l(`onboarding.common.status.copiedToClipboard`)]}):(0,O.jsx)(H,{onCopy:z,copyTitle:l(`onboarding.common.copyToClipboard`)})})}),(0,O.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:[l(P===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,O.jsx)(x,{name:`external-link`,className:`h-3 w-3`})]}),E&&(0,O.jsx)(`div`,{className:`mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive`,children:E}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(v,{type:`button`,onClick:W,disabled:C,className:`w-full max-w-xs`,size:`lg`,children:l(C?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkAndContinue`)}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`onboarding.localSetup.helper.checkAndContinue`)})]}),(0,O.jsx)(`div`,{className:`mx-auto w-full max-w-xl pt-4`,children:(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:l(`onboarding.localSetup.field.alreadyInstalled`)}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(w,{value:A,onChange:e=>j(e.target.value),placeholder:K,disabled:b,className:`flex-1 font-mono text-xs`}),(0,O.jsx)(v,{type:`button`,variant:`secondary`,onClick:L,disabled:b||!h,children:l(`onboarding.localSetup.actions.browse`)}),(0,O.jsx)(v,{type:`button`,onClick:R,disabled:b,children:l(`onboarding.localSetup.actions.apply`)})]}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:l(`onboarding.localSetup.helper.saveAndReload`)})]})}),s&&c&&(0,O.jsxs)(`div`,{className:`text-center pt-4`,children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:l(`onboarding.localSetup.remotePreference`)}),(0,O.jsx)(v,{variant:`link`,onClick:c,children:l(`onboarding.localSetup.actions.connectRemoteServer`)})]})]}),f&&(0,O.jsx)(`div`,{className:`absolute bottom-8 left-0 right-0 text-center space-y-1`,children:P===`windows`?(0,O.jsx)(O.Fragment,{children:(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.hint.ensurePath`)}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.hint.setEnv`)}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:l(`onboarding.localSetup.hint.missingRuntime`)})]})})]})}function G(e,t){if(e?.trim())return d(e.trim());if(t)return d(t)}function K(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-pairing-expired`:return{title:`Pairing expired`,description:`Get a new connection link from the other computer.`,titleKey:`mobile.connect.pairing.expired`,descriptionKey:`desktopHostSwitcher.pairing.reconnectHint`,iconKey:`remote`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Manage instances`,useRemoteLabelKey:`settings.remoteInstances.openLocalManager`};case`remote-unreachable`:{let e=G(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=G(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=G(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 q(e){switch(e){case`local`:return(0,O.jsx)(x,{name:`macbook`,className:`h-8 w-8`});case`remote`:return(0,O.jsx)(x,{name:`server`,className:`h-8 w-8`})}}function J({variant:e,hostLabel:t,hostUrl:n,onRetry:r,onUseLocal:i,onUseRemote:a,isRetrying:o=!1}){let{t:s}=g(),c=K(e,t,n),l=c.retryLabelKey??`onboarding.desktopRecovery.actions.retryConnection`,u=D.useMemo(()=>{if(c.descriptionParams?.host)return c.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`)}},[c.descriptionParams,s,e]);return(0,O.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,O.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[(0,O.jsx)(`div`,{className:`p-3 rounded-full`,style:{backgroundColor:`var(--status-warning)`,opacity:.15},children:(0,O.jsx)(`div`,{style:{color:`var(--status-warning)`},children:q(c.iconKey)})}),(0,O.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:s(c.titleKey)}),(0,O.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-sm`,children:s(c.descriptionKey,u)})]}),n&&(e===`remote-unreachable`||e===`remote-wrong-service`||e===`remote-incompatible`)&&(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-3`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:s(`onboarding.remoteConnection.field.serverAddress`)}),(0,O.jsx)(`div`,{className:`font-mono text-sm text-foreground truncate`,children:d(n)})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c.showRetry&&r&&(0,O.jsxs)(v,{onClick:r,disabled:o,className:`w-full`,children:[(0,O.jsx)(x,{name:`refresh`,className:_(`h-4 w-4`,o&&`animate-spin`)}),s(o?`onboarding.desktopRecovery.actions.retrying`:l)]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[c.showUseLocal&&i&&(0,O.jsxs)(v,{variant:`outline`,onClick:i,disabled:o,className:`flex-1`,children:[(0,O.jsx)(x,{name:`macbook`,className:`h-4 w-4`}),s(c.useLocalLabelKey)]}),c.showUseRemote&&a&&(0,O.jsxs)(v,{variant:`outline`,onClick:a,disabled:o,className:`flex-1`,children:[(0,O.jsx)(x,{name:`server`,className:`h-4 w-4`}),s(c.useRemoteLabelKey)]})]})]})]})})}function Y(e,t){if(t===`use-remote`)return e===`remote-pairing-expired`?{kind:`local-host-settings`}:{kind:`remote-form`};switch(e){case`local-unavailable`:return{kind:`local-setup`};case`remote-unreachable`:case`remote-pairing-expired`: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 X(e){let i=(0,E.c)(28),{variant:a,hostUrl:o,hostLabel:s,onRetry:c,onChooseRemote:l,showRemoteForm:d,onCloseRemoteForm:f,onSwitchToLocalFromRemote:p,onEnterLocalSetup:m,isRetrying:h}=e,_=d!==void 0&&d,v=h!==void 0&&h,{t:y}=g(),x=Z,S;i[0]===c?S=i[1]:(S=async()=>{if(n()){await r();return}await t(`/api/config/reload`,{method:`POST`}),c?.()},i[0]=c,i[1]=S);let C=S,w;i[2]!==m||i[3]!==a?(w=async()=>{if(Y(a,`use-local`).kind===`local-setup`){m?.();return}if(await x(`local`),n()){await r();return}window.location.reload()},i[2]=m,i[3]=a,i[4]=w):w=i[4];let T=w,D;i[5]!==l||i[6]!==y||i[7]!==a?(D=()=>{let e=Y(a,`use-remote`);if(e.kind===`local-host-settings`){u().catch(()=>b.error(y(`sessionAuth.error.networkTitle`)));return}e.kind===`remote-form`&&l?.()},i[5]=l,i[6]=y,i[7]=a,i[8]=D):D=i[8];let k=D;if(_){let e=a===`remote-wrong-service`?``:o||``,t=a===`remote-wrong-service`?``:s||``,c;i[9]!==l||i[10]!==f?(c=f||(()=>l?.()),i[9]=l,i[10]=f,i[11]=c):c=i[11];let u;i[12]!==m||i[13]!==p?(u=p||(()=>{x(`local`).then(()=>{n()?r():m?.()})}),i[12]=m,i[13]=p,i[14]=u):u=i[14];let d;return i[15]!==t||i[16]!==e||i[17]!==c||i[18]!==u?(d=(0,O.jsx)(j,{onBack:c,initialUrl:e,initialLabel:t,isRecoveryMode:!0,onSwitchToLocal:u}),i[15]=t,i[16]=e,i[17]=c,i[18]=u,i[19]=d):d=i[19],d}let A;return i[20]!==C||i[21]!==T||i[22]!==k||i[23]!==s||i[24]!==o||i[25]!==v||i[26]!==a?(A=(0,O.jsx)(J,{variant:a,hostLabel:s,hostUrl:o,onRetry:C,onUseLocal:T,onUseRemote:k,isRetrying:v}),i[20]=C,i[21]=T,i[22]=k,i[23]=s,i[24]=o,i[25]=v,i[26]=a,i[27]=A):A=i[27],A}async function Z(e){if(!n())return;let t=await l();await s({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})}function Q(e){let t=(0,E.c)(50),{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]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,O.jsx)(T,{width:120,height:120,className:`block h-[120px] w-[120px] [&_path]:fill-[var(--splash-logo-fill,currentColor)]`}),t[0]=d):d=t[0];let f;t[1]===a?f=t[2]:(f=a(`onboarding.index.title`),t[1]=a,t[2]=f);let p=Math.max(s,1),m=s>0?c:void 0,h;t[3]!==c||t[4]!==a||t[5]!==s?(h=a(`commandPalette.index.progress`,{completed:c,total:s}),t[3]=c,t[4]=a,t[5]=s,t[6]=h):h=t[6];let _=`absolute inset-0 size-full -rotate-90 ${u===null&&!l?`motion-safe:animate-spin motion-safe:[animation-duration:3s]`:``}`,y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,O.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,stroke:`currentColor`,strokeWidth:`1.5`,className:`text-border`}),t[7]=y):y=t[7];let b=100-(u??.22)*100,x;t[8]===b?x=t[9]:(x=(0,O.jsx)(`circle`,{cx:`96`,cy:`96`,r:`84`,pathLength:`100`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`100`,strokeDashoffset:b,className:`text-foreground/80 motion-safe:transition-[stroke-dashoffset] motion-safe:duration-700`}),t[8]=b,t[9]=x);let w;t[10]===u?w=t[11]:(w=u!==null&&u>0&&u<1&&(0,O.jsx)(`g`,{style:{transform:`rotate(${u*360}deg)`,transformOrigin:`96px 96px`},className:`motion-safe:transition-transform motion-safe:duration-700`,children:(0,O.jsx)(`circle`,{cx:`180`,cy:`96`,r:`3`,fill:`currentColor`,className:`text-foreground`})}),t[10]=u,t[11]=w);let D;t[12]!==w||t[13]!==_||t[14]!==x?(D=(0,O.jsxs)(`svg`,{viewBox:`0 0 192 192`,fill:`none`,"aria-hidden":`true`,className:_,children:[y,x,w]}),t[12]=w,t[13]=_,t[14]=x,t[15]=D):D=t[15];let k;t[16]!==D||t[17]!==f||t[18]!==p||t[19]!==m||t[20]!==h?(k=(0,O.jsxs)(`div`,{className:`absolute left-1/2 top-1/2 h-[120px] w-[120px] -translate-x-1/2 -translate-y-1/2`,children:[d,(0,O.jsx)(`div`,{role:`progressbar`,"aria-label":f,"aria-valuemin":0,"aria-valuemax":p,"aria-valuenow":m,"aria-valuetext":h,className:`pointer-events-none absolute -inset-9`,children:D})]}),t[16]=D,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=k):k=t[21];let A;t[22]!==o||t[23]!==u?(A=u!==null&&(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`mb-3 text-sm tabular-nums text-muted-foreground`,children:new Intl.NumberFormat(o,{style:`percent`,maximumFractionDigits:0}).format(u)}),t[22]=o,t[23]=u,t[24]=A):A=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j={fontSize:`1.0625rem`,fontWeight:450},t[25]=j):j=t[25];let M;t[26]===a?M=t[27]:(M=a(`onboarding.index.title`),t[26]=a,t[27]=M);let N;t[28]===M?N=t[29]:(N=(0,O.jsx)(S,{className:`tracking-tight`,style:j,children:M}),t[28]=M,t[29]=N);let P;t[30]!==l||t[31]!==a?(P=a(l?`onboarding.index.retrying`:`onboarding.index.description`),t[30]=l,t[31]=a,t[32]=P):P=t[32];let F;t[33]===P?F=t[34]:(F=(0,O.jsx)(C,{className:`text-xs text-muted-foreground`,children:P}),t[33]=P,t[34]=F);let I;t[35]!==N||t[36]!==F?(I=(0,O.jsxs)(`header`,{className:`space-y-2.5`,role:`status`,"aria-live":`polite`,children:[N,F]}),t[35]=N,t[36]=F,t[37]=I):I=t[37];let L;t[38]===a?L=t[39]:(L=a(`onboarding.index.background`),t[38]=a,t[39]=L);let R;t[40]!==i||t[41]!==L?(R=(0,O.jsx)(v,{size:`sm`,className:`mt-8 text-xs font-normal`,onClick:i,children:L}),t[40]=i,t[41]=L,t[42]=R):R=t[42];let z;t[43]!==A||t[44]!==I||t[45]!==R?(z=(0,O.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 top-[calc(50%+116px)] overflow-y-auto px-6 pb-6 text-center`,children:(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm flex-col items-center`,children:[A,I,R]})}),t[43]=A,t[44]=I,t[45]=R,t[46]=z):z=t[46];let B;return t[47]!==k||t[48]!==z?(B=(0,O.jsxs)(`div`,{className:`absolute inset-0 overflow-hidden`,"data-content-index-onboarding":!0,children:[k,z]}),t[47]=k,t[48]=z,t[49]=B):B=t[49],B}function $(e){let t=(0,E.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]=D.useState(!1),[g,_]=D.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],D.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,O.jsx)(Q,{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,O.jsx)(X,{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,O.jsx)(W,{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,O.jsx)(z,{onCliAvailable:r}),t[28]=r,t[29]=x),x}export{$ as OnboardingScreen};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{n as r}from"./vendor-react-DlzBev0S.js";import{Jn as i}from"./useMobileNavigationStore-BoZDstLm.js";var a=r(),o=e(n(),1),s=t(),ee=1e3,c=.5,te={length:0,offset:0},ne=(e,t)=>Math.abs(e.length-t.length)<c&&Math.abs(e.offset-t.offset)<c,l=e=>{let t=(0,a.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:c,className:l,disableHorizontal:re,observeMutations:ie,suppressVisibility:ae,userIntentOnly:oe}=e,u=r===void 0?32:r,se=c===void 0?1e3:c,ce=re!==void 0&&re,d=ie===void 0||ie,f=ae!==void 0&&ae,p=oe!==void 0&&oe,[le,m]=o.useState(!1),ue;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ue={length:0,offset:0},t[0]=ue):ue=t[0];let[h,de]=o.useState(ue),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={length:0,offset:0},t[1]=g):g=t[1];let[_,fe]=o.useState(g),v=o.useRef(null),y=o.useRef(null),b=o.useRef(null),x=o.useRef(!1),pe=o.useRef(!1),me=o.useRef(0),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=S):S=t[2];let he=o.useRef(S),ge=o.useRef(null),C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=new Set,t[3]=C):C=t[3];let w=o.useRef(C),T;t[4]!==n||t[5]!==ce||t[6]!==u?(T=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,ee=te;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(u,Math.min(e,n)),o=Math.max(e-a,0);ee={length:a,offset:i/Math.max(t-r,1)*o}}de(e=>ne(e,ee)?e:ee);let c=te;if(!ce&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(u,Math.min(e,t)),r=Math.max(e-n,0);c={length:n,offset:s/Math.max(a-o,1)*r}}fe(e=>ne(e,c)?e:c)},t[4]=n,t[5]=ce,t[6]=u,t[7]=T):T=t[7];let E=T,D;t[8]===E?D=t[9]:(D=()=>{b.current===null&&(b.current=requestAnimationFrame(()=>{b.current=null,E()}))},t[8]=E,t[9]=D);let O=D,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(e,t)=>{if(!t){w.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),w.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{w.current.has(e)||t.observe(e)}),w.current=n},t[10]=k):k=t[10];let _e=k,A;t[11]===se?A=t[12]:(A=()=>{v.current&&clearTimeout(v.current),!pe.current&&(v.current=setTimeout(()=>m(!1),se))},t[11]=se,t[12]=A);let j=A,M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{me.current=Date.now()},t[13]=M):M=t[13];let N=M,P;t[14]!==j||t[15]!==f||t[16]!==E||t[17]!==p?(P=()=>{y.current&&cancelAnimationFrame(y.current),y.current=requestAnimationFrame(()=>{if(E(),f&&!x.current){m(!1);return}if(p&&!x.current&&!(Date.now()-me.current<=ee)){m(!1);return}m(!0),j()})},t[14]=j,t[15]=f,t[16]=E,t[17]=p,t[18]=P):P=t[18];let ve=P,F,I;t[19]!==n||t[20]!==ve||t[21]!==d||t[22]!==O||t[23]!==E||t[24]!==p?(F=()=>{let e=n.current;if(!e)return;E(),m(!1);let t=()=>ve(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&N()};e.addEventListener(`scroll`,t,{passive:!0}),p&&(e.addEventListener(`wheel`,N,{passive:!0}),e.addEventListener(`touchstart`,N,{passive:!0}),e.addEventListener(`touchmove`,N,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{O()}):null;_e(e,i);let a=d&&typeof MutationObserver<`u`?new MutationObserver(()=>{_e(e,i),O()}):null;a?.observe(e,{childList:!0});let o=()=>O(),s=()=>O();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),p&&(e.removeEventListener(`wheel`,N),e.removeEventListener(`touchstart`,N),e.removeEventListener(`touchmove`,N),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),w.current.clear(),v.current&&clearTimeout(v.current),y.current&&cancelAnimationFrame(y.current),b.current&&cancelAnimationFrame(b.current)}},I=[n,ve,N,d,O,_e,E,p],t[19]=n,t[20]=ve,t[21]=d,t[22]=O,t[23]=E,t[24]=p,t[25]=F,t[26]=I):(F=t[25],I=t[26]),o.useEffect(F,I);let L,R;t[27]===f?(L=t[28],R=t[29]):(L=()=>{f&&(x.current||(m(!1),v.current&&=(clearTimeout(v.current),null)))},R=[f],t[27]=f,t[28]=L,t[29]=R),o.useEffect(L,R);let z;t[30]===n?z=t[31]:(z=(e,t)=>{let r=n.current;r&&(x.current=!0,he.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},ge.current=t,N(),m(!0),v.current&&clearTimeout(v.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=z);let B=z,V;t[32]!==n||t[33]!==_.length||t[34]!==h.length?(V=e=>{if(!x.current)return;let t=n.current;if(!t)return;let r=ge.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=he.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-h.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}=he.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-_.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=_.length,t[34]=h.length,t[35]=V):V=t[35];let H=V,U;t[36]===j?U=t[37]:(U=e=>{x.current&&(x.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),j())},t[36]=j,t[37]=U);let W=U,G;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{pe.current=!0,v.current&&=(clearTimeout(v.current),null)},t[38]=G):G=t[38];let ye=G,K;t[39]===j?K=t[40]:(K=()=>{pe.current=!1,j()},t[39]=j,t[40]=K);let q=K,J=h.length>0,be=_.length>0;if(!J&&!be)return null;let Y;t[41]===l?Y=t[42]:(Y=i(`overlay-scrollbar`,l),t[41]=l,t[42]=Y);let xe=+!!le,X;t[43]===xe?X=t[44]:(X={opacity:xe},t[43]=xe,t[44]=X);let Z;t[45]!==B||t[46]!==H||t[47]!==W||t[48]!==q||t[49]!==J||t[50]!==h.length||t[51]!==h.offset?(Z=J&&(0,s.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${h.length}px`,top:`${8+h.offset}px`,right:`4px`},onPointerDown:e=>B(e,`vertical`),onPointerMove:H,onPointerUp:W,onPointerCancel:W,onMouseEnter:ye,onMouseLeave:q}),t[45]=B,t[46]=H,t[47]=W,t[48]=q,t[49]=J,t[50]=h.length,t[51]=h.offset,t[52]=Z):Z=t[52];let Q;t[53]!==B||t[54]!==H||t[55]!==W||t[56]!==q||t[57]!==_.length||t[58]!==_.offset||t[59]!==be?(Q=be&&(0,s.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${_.length}px`,left:`${8+_.offset}px`,bottom:`4px`},onPointerDown:e=>B(e,`horizontal`),onPointerMove:H,onPointerUp:W,onPointerCancel:W,onMouseEnter:ye,onMouseLeave:q}),t[53]=B,t[54]=H,t[55]=W,t[56]=q,t[57]=_.length,t[58]=_.offset,t[59]=be,t[60]=Q):Q=t[60];let $;return t[61]!==Y||t[62]!==X||t[63]!==Z||t[64]!==Q?($=(0,s.jsxs)(`div`,{className:Y,"aria-hidden":`true`,style:X,children:[Z,Q]}),t[61]=Y,t[62]=X,t[63]=Z,t[64]=Q,t[65]=$):$=t[65],$};l.displayName=`OverlayScrollbar`;var re=l;export{re as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{n as r}from"./vendor-react-DlzBev0S.js";import{Jn as i}from"./useMobileNavigationStore-CXnVqWpM.js";var a=r(),o=e(n(),1),s=t(),ee=1e3,c=.5,te={length:0,offset:0},ne=(e,t)=>Math.abs(e.length-t.length)<c&&Math.abs(e.offset-t.offset)<c,l=e=>{let t=(0,a.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:c,className:l,disableHorizontal:re,observeMutations:ie,suppressVisibility:ae,userIntentOnly:oe}=e,u=r===void 0?32:r,se=c===void 0?1e3:c,ce=re!==void 0&&re,d=ie===void 0||ie,f=ae!==void 0&&ae,p=oe!==void 0&&oe,[le,m]=o.useState(!1),ue;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ue={length:0,offset:0},t[0]=ue):ue=t[0];let[h,de]=o.useState(ue),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={length:0,offset:0},t[1]=g):g=t[1];let[_,fe]=o.useState(g),v=o.useRef(null),y=o.useRef(null),b=o.useRef(null),x=o.useRef(!1),pe=o.useRef(!1),me=o.useRef(0),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=S):S=t[2];let he=o.useRef(S),ge=o.useRef(null),C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=new Set,t[3]=C):C=t[3];let w=o.useRef(C),T;t[4]!==n||t[5]!==ce||t[6]!==u?(T=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,ee=te;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(u,Math.min(e,n)),o=Math.max(e-a,0);ee={length:a,offset:i/Math.max(t-r,1)*o}}de(e=>ne(e,ee)?e:ee);let c=te;if(!ce&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(u,Math.min(e,t)),r=Math.max(e-n,0);c={length:n,offset:s/Math.max(a-o,1)*r}}fe(e=>ne(e,c)?e:c)},t[4]=n,t[5]=ce,t[6]=u,t[7]=T):T=t[7];let E=T,D;t[8]===E?D=t[9]:(D=()=>{b.current===null&&(b.current=requestAnimationFrame(()=>{b.current=null,E()}))},t[8]=E,t[9]=D);let O=D,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(e,t)=>{if(!t){w.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),w.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{w.current.has(e)||t.observe(e)}),w.current=n},t[10]=k):k=t[10];let _e=k,A;t[11]===se?A=t[12]:(A=()=>{v.current&&clearTimeout(v.current),!pe.current&&(v.current=setTimeout(()=>m(!1),se))},t[11]=se,t[12]=A);let j=A,M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{me.current=Date.now()},t[13]=M):M=t[13];let N=M,P;t[14]!==j||t[15]!==f||t[16]!==E||t[17]!==p?(P=()=>{y.current&&cancelAnimationFrame(y.current),y.current=requestAnimationFrame(()=>{if(E(),f&&!x.current){m(!1);return}if(p&&!x.current&&!(Date.now()-me.current<=ee)){m(!1);return}m(!0),j()})},t[14]=j,t[15]=f,t[16]=E,t[17]=p,t[18]=P):P=t[18];let ve=P,F,I;t[19]!==n||t[20]!==ve||t[21]!==d||t[22]!==O||t[23]!==E||t[24]!==p?(F=()=>{let e=n.current;if(!e)return;E(),m(!1);let t=()=>ve(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&N()};e.addEventListener(`scroll`,t,{passive:!0}),p&&(e.addEventListener(`wheel`,N,{passive:!0}),e.addEventListener(`touchstart`,N,{passive:!0}),e.addEventListener(`touchmove`,N,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{O()}):null;_e(e,i);let a=d&&typeof MutationObserver<`u`?new MutationObserver(()=>{_e(e,i),O()}):null;a?.observe(e,{childList:!0});let o=()=>O(),s=()=>O();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),p&&(e.removeEventListener(`wheel`,N),e.removeEventListener(`touchstart`,N),e.removeEventListener(`touchmove`,N),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),w.current.clear(),v.current&&clearTimeout(v.current),y.current&&cancelAnimationFrame(y.current),b.current&&cancelAnimationFrame(b.current)}},I=[n,ve,N,d,O,_e,E,p],t[19]=n,t[20]=ve,t[21]=d,t[22]=O,t[23]=E,t[24]=p,t[25]=F,t[26]=I):(F=t[25],I=t[26]),o.useEffect(F,I);let L,R;t[27]===f?(L=t[28],R=t[29]):(L=()=>{f&&(x.current||(m(!1),v.current&&=(clearTimeout(v.current),null)))},R=[f],t[27]=f,t[28]=L,t[29]=R),o.useEffect(L,R);let z;t[30]===n?z=t[31]:(z=(e,t)=>{let r=n.current;r&&(x.current=!0,he.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},ge.current=t,N(),m(!0),v.current&&clearTimeout(v.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=z);let B=z,V;t[32]!==n||t[33]!==_.length||t[34]!==h.length?(V=e=>{if(!x.current)return;let t=n.current;if(!t)return;let r=ge.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=he.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-h.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}=he.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-_.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=_.length,t[34]=h.length,t[35]=V):V=t[35];let H=V,U;t[36]===j?U=t[37]:(U=e=>{x.current&&(x.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),j())},t[36]=j,t[37]=U);let W=U,G;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{pe.current=!0,v.current&&=(clearTimeout(v.current),null)},t[38]=G):G=t[38];let ye=G,K;t[39]===j?K=t[40]:(K=()=>{pe.current=!1,j()},t[39]=j,t[40]=K);let q=K,J=h.length>0,be=_.length>0;if(!J&&!be)return null;let Y;t[41]===l?Y=t[42]:(Y=i(`overlay-scrollbar`,l),t[41]=l,t[42]=Y);let xe=+!!le,X;t[43]===xe?X=t[44]:(X={opacity:xe},t[43]=xe,t[44]=X);let Z;t[45]!==B||t[46]!==H||t[47]!==W||t[48]!==q||t[49]!==J||t[50]!==h.length||t[51]!==h.offset?(Z=J&&(0,s.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${h.length}px`,top:`${8+h.offset}px`,right:`4px`},onPointerDown:e=>B(e,`vertical`),onPointerMove:H,onPointerUp:W,onPointerCancel:W,onMouseEnter:ye,onMouseLeave:q}),t[45]=B,t[46]=H,t[47]=W,t[48]=q,t[49]=J,t[50]=h.length,t[51]=h.offset,t[52]=Z):Z=t[52];let Q;t[53]!==B||t[54]!==H||t[55]!==W||t[56]!==q||t[57]!==_.length||t[58]!==_.offset||t[59]!==be?(Q=be&&(0,s.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${_.length}px`,left:`${8+_.offset}px`,bottom:`4px`},onPointerDown:e=>B(e,`horizontal`),onPointerMove:H,onPointerUp:W,onPointerCancel:W,onMouseEnter:ye,onMouseLeave:q}),t[53]=B,t[54]=H,t[55]=W,t[56]=q,t[57]=_.length,t[58]=_.offset,t[59]=be,t[60]=Q):Q=t[60];let $;return t[61]!==Y||t[62]!==X||t[63]!==Z||t[64]!==Q?($=(0,s.jsxs)(`div`,{className:Y,"aria-hidden":`true`,style:X,children:[Z,Q]}),t[61]=Y,t[62]=X,t[63]=Z,t[64]=Q,t[65]=$):$=t[65],$};l.displayName=`OverlayScrollbar`;var re=l;export{re as t};