@jingyi0605/codingns 0.9.8 → 1.0.0-beta.1

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 (169) hide show
  1. package/bin/codingns.mjs +14 -0
  2. package/dist/public/assets/{AdaptiveButlerPage-D-gXre7Y.js → AdaptiveButlerPage-BYETYaIe.js} +2 -2
  3. package/dist/public/assets/App-CHsm-VrM.js +30 -0
  4. package/dist/public/assets/App-Z0Zd7gXR.css +1 -0
  5. package/dist/public/assets/{BootstrapPage-B-yMdfpQ.js → BootstrapPage-Bp0KfySv.js} +1 -1
  6. package/dist/public/assets/ConversationPage-BCrNml1k.js +9 -0
  7. package/dist/public/assets/{DesktopDetachPreviewPage-D1DMaGcy.js → DesktopDetachPreviewPage-DlDSb_tf.js} +1 -1
  8. package/dist/public/assets/{DesktopModal-BnfGW2gk.js → DesktopModal-Csj5AdAN.js} +1 -1
  9. package/dist/public/assets/DesktopWindowPage-CacXiWjV.js +2 -0
  10. package/dist/public/assets/FileContextPanel-DzMUQvE5.js +1 -0
  11. package/dist/public/assets/GitSidebar-C8IC18GH.js +6 -0
  12. package/dist/public/assets/MobileCreateSessionSheet-BtqR_hKc.js +1 -0
  13. package/dist/public/assets/{MobileSheet-rkn_CUOY.js → MobileSheet-Co-qPMBD.js} +1 -1
  14. package/dist/public/assets/PluginAccessOverview-D-KXkcyj.js +1 -0
  15. package/dist/public/assets/{PluginContainerPage-D-ly3i3H.js → PluginContainerPage-BKwCIs4r.js} +1 -1
  16. package/dist/public/assets/{PluginDetailPage-CWAHYyyG.js → PluginDetailPage-Djv_swcO.js} +1 -1
  17. package/dist/public/assets/{PluginsListPage-Cte3vBgR.js → PluginsListPage-DAECNoN6.js} +1 -1
  18. package/dist/public/assets/PureConversationPage-DP1X7Hix.js +1 -0
  19. package/dist/public/assets/{RelayConnectEntryPage-sRJlstx9.js → RelayConnectEntryPage-xL_IPH8a.js} +1 -1
  20. package/dist/public/assets/{ServerSettingsModal-BBft9KEC.js → ServerSettingsModal-CyhMgk10.js} +1 -1
  21. package/dist/public/assets/SessionIndexPage-CVEz50tc.js +1 -0
  22. package/dist/public/assets/SettingsPage-CQNCrgaj.js +2 -0
  23. package/dist/public/assets/TerminalManagerPanel-wVnoRA8u.js +1 -0
  24. package/dist/public/assets/ToolFilesPage-BospXumK.js +1 -0
  25. package/dist/public/assets/ToolGitPage-B2zOeCAD.js +1 -0
  26. package/dist/public/assets/ToolProcessesPage-BDShao4b.js +1 -0
  27. package/dist/public/assets/{ToolsHomePage-D1n4FU1s.js → ToolsHomePage-s4zH7D9M.js} +1 -1
  28. package/dist/public/assets/{WorkbenchLandingPage-BaU_dXls.js → WorkbenchLandingPage-D51QCU_u.js} +1 -1
  29. package/dist/public/assets/{WorkbenchLayout-BksVkkFF.css → WorkbenchLayout-BZdfVest.css} +32 -1
  30. package/dist/public/assets/WorkbenchLayout-Bo2BbMY6.js +1081 -0
  31. package/dist/public/assets/{WorkbenchModal-DWsNm2B2.js → WorkbenchModal-YsyEdJ_m.js} +1 -1
  32. package/dist/public/assets/WorkbenchShellRoute-D3l4aWJS.js +1 -0
  33. package/dist/public/assets/WorkbenchShellRoute-D5fnyF8z.css +1 -0
  34. package/dist/public/assets/WorkspaceDebugDetailPage-CMjNLqFq.js +1 -0
  35. package/dist/public/assets/WorkspaceDetailPage-CKxTbPKh.js +1 -0
  36. package/dist/public/assets/WorkspaceHomePage-CEy4ShCu.js +1 -0
  37. package/dist/public/assets/{client-runtime-manager-D9VbgJZ_.js → client-runtime-manager-BFXU9DmS.js} +1 -1
  38. package/dist/public/assets/host-alias-Zb2xyVrf.js +1 -0
  39. package/dist/public/assets/index-BilHJjYU.js +50 -0
  40. package/dist/public/assets/index-OR7OITpQ.css +1 -0
  41. package/dist/public/assets/{login-direct-candidate-resolver-17wEvjhh.js → login-direct-candidate-resolver-DL8DS-Si.js} +1 -1
  42. package/dist/public/assets/peer-host-config-sync-d2ZcPC5P.js +1 -0
  43. package/dist/public/assets/{plugin-permission-copy-apDn8EWG.js → plugin-permission-copy-DrLk22m5.js} +1 -1
  44. package/dist/public/assets/{plugins-api-CnZYRKoS.js → plugins-api-COF4oh24.js} +1 -1
  45. package/dist/public/assets/{preferences-service-PZlLLAWH.js → preferences-service-CEWNV1w9.js} +1 -1
  46. package/dist/public/assets/{relay-entry-DhHwflXl.js → relay-entry-Cmc8vTlE.js} +1 -1
  47. package/dist/public/assets/useRegisteredDebugTemplates-FdmHG2S4.js +1 -0
  48. package/dist/public/assets/workbench-navigation-ED0157V-.js +1 -0
  49. package/dist/public/index.html +2 -2
  50. package/dist/server/config/env.js +5 -3
  51. package/dist/server/config/env.js.map +1 -1
  52. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +3 -0
  53. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +9 -0
  54. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  55. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +3 -0
  56. package/dist/server/modules/assistant-capability/assistant-capability-service.js +4 -1
  57. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  58. package/dist/server/modules/butler/butler-session-service.d.ts +1 -0
  59. package/dist/server/modules/butler/butler-session-service.js +2 -1
  60. package/dist/server/modules/butler/butler-session-service.js.map +1 -1
  61. package/dist/server/modules/client/npm-global-package-service.js +3 -0
  62. package/dist/server/modules/client/npm-global-package-service.js.map +1 -1
  63. package/dist/server/modules/client/service-update-types.d.ts +3 -0
  64. package/dist/server/modules/peer-host/peer-host-controller.d.ts +5 -0
  65. package/dist/server/modules/peer-host/peer-host-controller.js +3 -0
  66. package/dist/server/modules/peer-host/peer-host-controller.js.map +1 -1
  67. package/dist/server/modules/peer-host/peer-host-service.d.ts +1 -0
  68. package/dist/server/modules/peer-host/peer-host-service.js +44 -0
  69. package/dist/server/modules/peer-host/peer-host-service.js.map +1 -1
  70. package/dist/server/modules/sessions/session-controller.d.ts +10 -0
  71. package/dist/server/modules/sessions/session-controller.js +11 -0
  72. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  73. package/dist/server/modules/sessions/session-history-service.d.ts +43 -1
  74. package/dist/server/modules/sessions/session-history-service.js +362 -27
  75. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  76. package/dist/server/modules/tasks/observability-controller.d.ts +2 -0
  77. package/dist/server/modules/tasks/observability-controller.js +16 -1
  78. package/dist/server/modules/tasks/observability-controller.js.map +1 -1
  79. package/dist/server/modules/tasks/observability-service.d.ts +12 -2
  80. package/dist/server/modules/tasks/observability-service.js +16 -3
  81. package/dist/server/modules/tasks/observability-service.js.map +1 -1
  82. package/dist/server/modules/terminal/runtime/terminal-log-spooler.d.ts +5 -0
  83. package/dist/server/modules/terminal/runtime/terminal-log-spooler.js +54 -7
  84. package/dist/server/modules/terminal/runtime/terminal-log-spooler.js.map +1 -1
  85. package/dist/server/modules/workbench/affairs-assistant-session-snapshot-service.js +2 -1
  86. package/dist/server/modules/workbench/affairs-assistant-session-snapshot-service.js.map +1 -1
  87. package/dist/server/modules/workbench/workbench-service.d.ts +2 -0
  88. package/dist/server/modules/workbench/workbench-service.js +173 -20
  89. package/dist/server/modules/workbench/workbench-service.js.map +1 -1
  90. package/dist/server/modules/workspace/affairs-library-controller.d.ts +1 -0
  91. package/dist/server/modules/workspace/affairs-library-controller.js +3 -0
  92. package/dist/server/modules/workspace/affairs-library-controller.js.map +1 -1
  93. package/dist/server/modules/workspace/affairs-library-service.d.ts +4 -0
  94. package/dist/server/modules/workspace/affairs-library-service.js +23 -4
  95. package/dist/server/modules/workspace/affairs-library-service.js.map +1 -1
  96. package/dist/server/modules/workspace/affairs-lightweight-session-controller.d.ts +4 -0
  97. package/dist/server/modules/workspace/affairs-lightweight-session-controller.js +26 -0
  98. package/dist/server/modules/workspace/affairs-lightweight-session-controller.js.map +1 -1
  99. package/dist/server/modules/workspace/affairs-lightweight-session-service.d.ts +15 -1
  100. package/dist/server/modules/workspace/affairs-lightweight-session-service.js +201 -22
  101. package/dist/server/modules/workspace/affairs-lightweight-session-service.js.map +1 -1
  102. package/dist/server/modules/workspace/workspace-controller.d.ts +7 -1
  103. package/dist/server/modules/workspace/workspace-controller.js +11 -1
  104. package/dist/server/modules/workspace/workspace-controller.js.map +1 -1
  105. package/dist/server/modules/workspace/workspace-service.d.ts +9 -2
  106. package/dist/server/modules/workspace/workspace-service.js +45 -10
  107. package/dist/server/modules/workspace/workspace-service.js.map +1 -1
  108. package/dist/server/routes/affairs.js +4 -0
  109. package/dist/server/routes/affairs.js.map +1 -1
  110. package/dist/server/routes/peer-hosts.js +1 -0
  111. package/dist/server/routes/peer-hosts.js.map +1 -1
  112. package/dist/server/routes/sessions.js +2 -0
  113. package/dist/server/routes/sessions.js.map +1 -1
  114. package/dist/server/server/create-server.js +2 -2
  115. package/dist/server/server/create-server.js.map +1 -1
  116. package/dist/server/storage/repositories/session-discovery-diagnostics-repository.d.ts +10 -0
  117. package/dist/server/storage/repositories/session-discovery-diagnostics-repository.js +68 -0
  118. package/dist/server/storage/repositories/session-discovery-diagnostics-repository.js.map +1 -0
  119. package/dist/server/storage/repositories/session-source-index-repository.d.ts +14 -0
  120. package/dist/server/storage/repositories/session-source-index-repository.js +164 -0
  121. package/dist/server/storage/repositories/session-source-index-repository.js.map +1 -0
  122. package/dist/server/storage/repositories/workspace-navigation-state-repository.js +16 -7
  123. package/dist/server/storage/repositories/workspace-navigation-state-repository.js.map +1 -1
  124. package/dist/server/storage/sqlite/client.js +26 -0
  125. package/dist/server/storage/sqlite/client.js.map +1 -1
  126. package/dist/server/storage/sqlite/schema.sql +57 -0
  127. package/dist/server/types/domain.d.ts +45 -0
  128. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +19 -2
  129. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +1 -1
  130. package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +1 -0
  131. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +45 -1
  132. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  133. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +11 -4
  134. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
  135. package/package.json +3 -2
  136. package/scripts/node22-runtime.mjs +176 -0
  137. package/scripts/postinstall.mjs +6 -0
  138. package/dist/public/assets/App-7zrCMhE-.css +0 -1
  139. package/dist/public/assets/App-Dl-mcdqy.js +0 -30
  140. package/dist/public/assets/ConversationPage-DRQ5Sg_d.js +0 -9
  141. package/dist/public/assets/DesktopWindowPage-2SWAi0xz.js +0 -2
  142. package/dist/public/assets/FileContextPanel-fbPuE9dO.js +0 -1
  143. package/dist/public/assets/GitSidebar-BkmesJJR.js +0 -6
  144. package/dist/public/assets/MobileCreateSessionSheet-CEJcDBZJ.js +0 -1
  145. package/dist/public/assets/MobileTopHeaderFrame-CU0wsYSS.js +0 -1
  146. package/dist/public/assets/MobileWorkspaceSwitcherHeader-idl8o1OB.js +0 -1
  147. package/dist/public/assets/PluginAccessOverview-BBgM6tb0.js +0 -1
  148. package/dist/public/assets/SessionIndexPage-CN7cEdl9.js +0 -1
  149. package/dist/public/assets/SettingsPage-BGT-YqG2.js +0 -2
  150. package/dist/public/assets/TerminalManagerPanel-6-ZJ8vGn.js +0 -1
  151. package/dist/public/assets/TerminalPage-6GBZ9nXN.css +0 -32
  152. package/dist/public/assets/TerminalPage-CUXXQYU2.js +0 -55
  153. package/dist/public/assets/TerminalRuntimeFallbackModal-zc3qqMKJ.js +0 -1
  154. package/dist/public/assets/ToolFilesPage-QzsZyr0F.js +0 -1
  155. package/dist/public/assets/ToolGitPage-CXg4ncuT.js +0 -1
  156. package/dist/public/assets/ToolProcessesPage-BPsOsg4w.js +0 -1
  157. package/dist/public/assets/WorkbenchLayout-DViAJhHz.js +0 -1027
  158. package/dist/public/assets/WorkbenchShellRoute-BGfRqBUa.js +0 -1
  159. package/dist/public/assets/WorkbenchShellRoute-f2jWjHWu.css +0 -1
  160. package/dist/public/assets/WorkspaceDebugDetailPage-BX0zVSsI.js +0 -1
  161. package/dist/public/assets/WorkspaceDetailPage-Dx6JX4jx.js +0 -1
  162. package/dist/public/assets/WorkspaceHomePage-DQVJ042Z.js +0 -1
  163. package/dist/public/assets/host-alias-0TfFnYxR.js +0 -1
  164. package/dist/public/assets/index-DREvg1Yu.css +0 -1
  165. package/dist/public/assets/index-FOhyOpGY.js +0 -50
  166. package/dist/public/assets/peer-host-config-sync-vYkmqzNz.js +0 -1
  167. package/dist/public/assets/terminal-runtime-meta-2zvacxvM.js +0 -1
  168. package/dist/public/assets/useRegisteredDebugTemplates-CJ-o4tFl.js +0 -1
  169. package/dist/public/assets/workbench-navigation-aqJ1ay4M.js +0 -1
@@ -1,30 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js","assets/ServerSettingsModal-BBft9KEC.js","assets/index-FOhyOpGY.js","assets/index-DREvg1Yu.css","assets/relay-entry-DhHwflXl.js","assets/WorkbenchModal-DWsNm2B2.js","assets/DesktopModal-BnfGW2gk.js","assets/BootstrapPage-B-yMdfpQ.js","assets/RelayConnectEntryPage-sRJlstx9.js","assets/DesktopDetachPreviewPage-D1DMaGcy.js","assets/DesktopWindowPage-2SWAi0xz.js","assets/WorkbenchLayout-DViAJhHz.js","assets/workbench-navigation-aqJ1ay4M.js","assets/host-alias-0TfFnYxR.js","assets/MobileSheet-rkn_CUOY.js","assets/WorkbenchLayout-BksVkkFF.css","assets/FileContextPanel-fbPuE9dO.js","assets/GitSidebar-BkmesJJR.js","assets/TerminalManagerPanel-6-ZJ8vGn.js","assets/terminal-runtime-meta-2zvacxvM.js","assets/TerminalRuntimeFallbackModal-zc3qqMKJ.js","assets/TerminalPage-CUXXQYU2.js","assets/MobileWorkspaceSwitcherHeader-idl8o1OB.js","assets/MobileTopHeaderFrame-CU0wsYSS.js","assets/TerminalPage-6GBZ9nXN.css","assets/WorkbenchShellRoute-BGfRqBUa.js","assets/WorkbenchShellRoute-f2jWjHWu.css","assets/WorkbenchLandingPage-BaU_dXls.js","assets/ConversationPage-DRQ5Sg_d.js","assets/styles-DwSuZo1w.js","assets/styles-BhKoKfQ_.css","assets/WorkspaceHomePage-DQVJ042Z.js","assets/butler-records-events-DgWCG364.js","assets/MobileCreateSessionSheet-CEJcDBZJ.js","assets/WorkspaceDetailPage-Dx6JX4jx.js","assets/useRegisteredDebugTemplates-CJ-o4tFl.js","assets/WorkspaceDebugDetailPage-BX0zVSsI.js","assets/SessionIndexPage-CN7cEdl9.js","assets/ToolsHomePage-D1n4FU1s.js","assets/ToolFilesPage-QzsZyr0F.js","assets/ToolGitPage-CXg4ncuT.js","assets/ToolProcessesPage-BPsOsg4w.js","assets/PluginsListPage-Cte3vBgR.js","assets/plugins-api-CnZYRKoS.js","assets/PluginDetailPage-CWAHYyyG.js","assets/PluginAccessOverview-BBgM6tb0.js","assets/plugin-permission-copy-apDn8EWG.js","assets/PluginContainerPage-D-ly3i3H.js","assets/AdaptiveButlerPage-D-gXre7Y.js","assets/SettingsPage-BGT-YqG2.js"])))=>i.map(i=>d[i]);
2
- var kn=Object.defineProperty;var An=(e,t,r)=>t in e?kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Re=(e,t,r)=>An(e,typeof t!="symbol"?t+"":t,r);import{u as Qe,j as p,t as ce,a as Xt,g as Fn,r as Vn,b as f,R as Bn,c as Pe,_ as W,d as zn,e as he,h as Qt,f as He,i as Dt,n as Kr,k as Yr,l as Hn,m as Wn,o as Pt,p as $n,q as Kn,s as Yn,v as Gn,w as Jn,x as Wt,y as qn,z as Xn,A as Qn,B as Zn,C as ea,I as ta}from"./index-FOhyOpGY.js";function ra(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(n,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const na=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function aa({variant:e="default",className:t}){const r=Qe(a=>a.profile.language);function n(a){a!==r&&Xt({language:a}).catch(()=>{})}return p.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[p.jsx("span",{className:"language-switcher-label",children:ce("common.language")}),p.jsx("div",{className:"language-switcher-options",role:"group","aria-label":ce("common.language"),children:na.map(a=>p.jsx("button",{type:"button",className:`language-switcher-option${r===a.id?" active":""}`,"aria-pressed":r===a.id,onClick:()=>n(a.id),children:ce(a.labelKey)},a.id))})]})}var Gr=Vn();const ia=Fn(Gr),oa=ra({__proto__:null,default:ia},[Gr]);/**
3
- * @remix-run/router v1.23.2
4
- *
5
- * Copyright (c) Remix Software Inc.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE.md file in the root directory of this source tree.
9
- *
10
- * @license MIT
11
- */function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G.apply(this,arguments)}var re;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(re||(re={}));const br="popstate";function sa(e){e===void 0&&(e={});function t(n,a){let{pathname:i,search:o,hash:c}=n.location;return ct("",{pathname:i,search:o,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:dt(a)}return ca(t,r,null,e)}function U(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function $e(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function la(){return Math.random().toString(36).substr(2,8)}function xr(e,t){return{usr:e.state,key:e.key,idx:t}}function ct(e,t,r,n){return r===void 0&&(r=null),G({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ue(t):t,{state:r,key:t&&t.key||n||la()})}function dt(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Ue(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function ca(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,c=re.Pop,l=null,d=m();d==null&&(d=0,o.replaceState(G({},o.state,{idx:d}),""));function m(){return(o.state||{idx:null}).idx}function g(){c=re.Pop;let D=m(),F=D==null?null:D-d;d=D,l&&l({action:c,location:E.location,delta:F})}function w(D,F){c=re.Push;let L=ct(E.location,D,F);d=m()+1;let Y=xr(L,d),ee=E.createHref(L);try{o.pushState(Y,"",ee)}catch(K){if(K instanceof DOMException&&K.name==="DataCloneError")throw K;a.location.assign(ee)}i&&l&&l({action:c,location:E.location,delta:1})}function b(D,F){c=re.Replace;let L=ct(E.location,D,F);d=m();let Y=xr(L,d),ee=E.createHref(L);o.replaceState(Y,"",ee),i&&l&&l({action:c,location:E.location,delta:0})}function _(D){let F=a.location.origin!=="null"?a.location.origin:a.location.href,L=typeof D=="string"?D:dt(D);return L=L.replace(/ $/,"%20"),U(F,"No window.location.(origin|href) available to create URL for href: "+L),new URL(L,F)}let E={get action(){return c},get location(){return e(a,o)},listen(D){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(br,g),l=D,()=>{a.removeEventListener(br,g),l=null}},createHref(D){return t(a,D)},createURL:_,encodeLocation(D){let F=_(D);return{pathname:F.pathname,search:F.search,hash:F.hash}},push:w,replace:b,go(D){return o.go(D)}};return E}var z;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(z||(z={}));const ua=new Set(["lazy","caseSensitive","path","id","index","children"]);function da(e){return e.index===!0}function Lt(e,t,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),e.map((a,i)=>{let o=[...r,String(i)],c=typeof a.id=="string"?a.id:o.join("-");if(U(a.index!==!0||!a.children,"Cannot specify children on an index route"),U(!n[c],'Found a route id collision on id "'+c+`". Route id's must be globally unique within Data Router usages`),da(a)){let l=G({},a,t(a),{id:c});return n[c]=l,l}else{let l=G({},a,t(a),{id:c,children:void 0});return n[c]=l,a.children&&(l.children=Lt(a.children,t,o,n)),l}})}function Be(e,t,r){return r===void 0&&(r="/"),Tt(e,t,r,!1)}function Tt(e,t,r,n){let a=typeof t=="string"?Ue(t):t,i=ft(a.pathname||"/",r);if(i==null)return null;let o=Jr(e);ha(o);let c=null;for(let l=0;c==null&&l<o.length;++l){let d=Ra(i);c=Ea(o[l],d,n)}return c}function fa(e,t){let{route:r,pathname:n,params:a}=e;return{id:r.id,pathname:n,params:a,data:t[r.id],handle:r.handle}}function Jr(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(i,o,c)=>{let l={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(U(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let d=Me([n,l.relativePath]),m=r.concat(l);i.children&&i.children.length>0&&(U(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),Jr(i.children,t,m,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:ba(d,i.index),routesMeta:m})};return e.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let l of qr(i.path))a(i,o,l)}),t}function qr(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=qr(n.join("/")),c=[];return c.push(...o.map(l=>l===""?i:[i,l].join("/"))),a&&c.push(...o),c.map(l=>e.startsWith("/")&&l===""?"/":l)}function ha(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:xa(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const pa=/^:[\w-]+$/,ma=3,ga=2,va=1,ya=10,wa=-2,Er=e=>e==="*";function ba(e,t){let r=e.split("/"),n=r.length;return r.some(Er)&&(n+=wa),t&&(n+=ga),r.filter(a=>!Er(a)).reduce((a,i)=>a+(pa.test(i)?ma:i===""?va:ya),n)}function xa(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function Ea(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,a={},i="/",o=[];for(let c=0;c<n.length;++c){let l=n[c],d=c===n.length-1,m=i==="/"?t:t.slice(i.length)||"/",g=Sr({path:l.relativePath,caseSensitive:l.caseSensitive,end:d},m),w=l.route;if(!g&&d&&r&&!n[n.length-1].route.index&&(g=Sr({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},m)),!g)return null;Object.assign(a,g.params),o.push({params:a,pathname:Me([i,g.pathname]),pathnameBase:Ca(Me([i,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(i=Me([i,g.pathnameBase]))}return o}function Sr(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Sa(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:n.reduce((d,m,g)=>{let{paramName:w,isOptional:b}=m;if(w==="*"){let E=c[g]||"";o=i.slice(0,i.length-E.length).replace(/(.)\/+$/,"$1")}const _=c[g];return b&&!_?d[w]=void 0:d[w]=(_||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function Sa(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),$e(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,l)=>(n.push({paramName:c,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Ra(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return $e(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ft(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Pa=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_a=e=>Pa.test(e);function Ta(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?Ue(e):e,i;if(r)if(_a(r))i=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),$e(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=Rr(r.substring(1),"/"):i=Rr(r,t)}else i=t;return{pathname:i,search:Da(n),hash:La(a)}}function Rr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Ft(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Xr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Zt(e,t){let r=Xr(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function er(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=Ue(e):(a=G({},e),U(!a.pathname||!a.pathname.includes("?"),Ft("?","pathname","search",a)),U(!a.pathname||!a.pathname.includes("#"),Ft("#","pathname","hash",a)),U(!a.search||!a.search.includes("#"),Ft("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=r;else{let g=t.length-1;if(!n&&o.startsWith("..")){let w=o.split("/");for(;w[0]==="..";)w.shift(),g-=1;a.pathname=w.join("/")}c=g>=0?t[g]:"/"}let l=Ta(a,c),d=o&&o!=="/"&&o.endsWith("/"),m=(i||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(d||m)&&(l.pathname+="/"),l}const Me=e=>e.join("/").replace(/\/\/+/g,"/"),Ca=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Da=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,La=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Nt{constructor(t,r,n,a){a===void 0&&(a=!1),this.status=t,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function ut(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Qr=["post","put","patch","delete"],Na=new Set(Qr),ja=["get",...Qr],Ia=new Set(ja),Ma=new Set([301,302,303,307,308]),Ua=new Set([307,308]),Vt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Oa={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},at={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},tr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ka=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Zr="remix-router-transitions";function Aa(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",n=!r;U(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let s=e.detectErrorBoundary;a=u=>({hasErrorBoundary:s(u)})}else a=ka;let i={},o=Lt(e.routes,a,void 0,i),c,l=e.basename||"/",d=e.dataStrategy||za,m=e.patchRoutesOnNavigation,g=G({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),w=null,b=new Set,_=null,E=null,D=null,F=e.hydrationData!=null,L=Be(o,e.history.location,l),Y=!1,ee=null;if(L==null&&!m){let s=le(404,{pathname:e.history.location.pathname}),{matches:u,route:h}=Ur(o);L=u,ee={[h.id]:s}}L&&!e.hydrationData&&xt(L,o,e.history.location.pathname).active&&(L=null);let K;if(L)if(L.some(s=>s.route.lazy))K=!1;else if(!L.some(s=>s.route.loader))K=!0;else if(g.v7_partialHydration){let s=e.hydrationData?e.hydrationData.loaderData:null,u=e.hydrationData?e.hydrationData.errors:null;if(u){let h=L.findIndex(y=>u[y.route.id]!==void 0);K=L.slice(0,h+1).every(y=>!Kt(y.route,s,u))}else K=L.every(h=>!Kt(h.route,s,u))}else K=e.hydrationData!=null;else if(K=!1,L=[],g.v7_partialHydration){let s=xt(null,o,e.history.location.pathname);s.active&&s.matches&&(Y=!0,L=s.matches)}let me,v={historyAction:e.history.action,location:e.history.location,matches:L,initialized:K,navigation:Vt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||ee,fetchers:new Map,blockers:new Map},j=re.Pop,V=!1,M,ne=!1,J=new Map,oe=null,ae=!1,se=!1,Ke=[],Ye=new Set,Z=new Map,Te=0,Ce=-1,be=new Map,ue=new Set,De=new Map,Oe=new Map,de=new Set,xe=new Map,ve=new Map,ke;function vt(){if(w=e.history.listen(s=>{let{action:u,location:h,delta:y}=s;if(ke){ke(),ke=void 0;return}$e(ve.size===0||y!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let x=gr({currentLocation:v.location,nextLocation:h,historyAction:u});if(x&&y!=null){let C=new Promise(N=>{ke=N});e.history.go(y*-1),bt(x,{state:"blocked",location:h,proceed(){bt(x,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),C.then(()=>e.history.go(y))},reset(){let N=new Map(v.blockers);N.set(x,at),H({blockers:N})}});return}return Ae(u,h)}),r){ri(t,J);let s=()=>ni(t,J);t.addEventListener("pagehide",s),oe=()=>t.removeEventListener("pagehide",s)}return v.initialized||Ae(re.Pop,v.location,{initialHydration:!0}),me}function k(){w&&w(),oe&&oe(),b.clear(),M&&M.abort(),v.fetchers.forEach((s,u)=>wt(u)),v.blockers.forEach((s,u)=>mr(u))}function fe(s){return b.add(s),()=>b.delete(s)}function H(s,u){u===void 0&&(u={}),v=G({},v,s);let h=[],y=[];g.v7_fetcherPersist&&v.fetchers.forEach((x,C)=>{x.state==="idle"&&(de.has(C)?y.push(C):h.push(C))}),de.forEach(x=>{!v.fetchers.has(x)&&!Z.has(x)&&y.push(x)}),[...b].forEach(x=>x(v,{deletedFetchers:y,viewTransitionOpts:u.viewTransitionOpts,flushSync:u.flushSync===!0})),g.v7_fetcherPersist?(h.forEach(x=>v.fetchers.delete(x)),y.forEach(x=>wt(x))):y.forEach(x=>de.delete(x))}function ye(s,u,h){var y,x;let{flushSync:C}=h===void 0?{}:h,N=v.actionData!=null&&v.navigation.formMethod!=null&&ge(v.navigation.formMethod)&&v.navigation.state==="loading"&&((y=s.state)==null?void 0:y._isRedirect)!==!0,R;u.actionData?Object.keys(u.actionData).length>0?R=u.actionData:R=null:N?R=v.actionData:R=null;let P=u.loaderData?Ir(v.loaderData,u.loaderData,u.matches||[],u.errors):v.loaderData,S=v.blockers;S.size>0&&(S=new Map(S),S.forEach((O,ie)=>S.set(ie,at)));let T=V===!0||v.navigation.formMethod!=null&&ge(v.navigation.formMethod)&&((x=s.state)==null?void 0:x._isRedirect)!==!0;c&&(o=c,c=void 0),ae||j===re.Pop||(j===re.Push?e.history.push(s,s.state):j===re.Replace&&e.history.replace(s,s.state));let I;if(j===re.Pop){let O=J.get(v.location.pathname);O&&O.has(s.pathname)?I={currentLocation:v.location,nextLocation:s}:J.has(s.pathname)&&(I={currentLocation:s,nextLocation:v.location})}else if(ne){let O=J.get(v.location.pathname);O?O.add(s.pathname):(O=new Set([s.pathname]),J.set(v.location.pathname,O)),I={currentLocation:v.location,nextLocation:s}}H(G({},u,{actionData:R,loaderData:P,historyAction:j,location:s,initialized:!0,navigation:Vt,revalidation:"idle",restoreScrollPosition:yr(s,u.matches||v.matches),preventScrollReset:T,blockers:S}),{viewTransitionOpts:I,flushSync:C===!0}),j=re.Pop,V=!1,ne=!1,ae=!1,se=!1,Ke=[]}async function yt(s,u){if(typeof s=="number"){e.history.go(s);return}let h=$t(v.location,v.matches,l,g.v7_prependBasename,s,g.v7_relativeSplatPath,u==null?void 0:u.fromRouteId,u==null?void 0:u.relative),{path:y,submission:x,error:C}=Pr(g.v7_normalizeFormMethod,!1,h,u),N=v.location,R=ct(v.location,y,u&&u.state);R=G({},R,e.history.encodeLocation(R));let P=u&&u.replace!=null?u.replace:void 0,S=re.Push;P===!0?S=re.Replace:P===!1||x!=null&&ge(x.formMethod)&&x.formAction===v.location.pathname+v.location.search&&(S=re.Replace);let T=u&&"preventScrollReset"in u?u.preventScrollReset===!0:void 0,I=(u&&u.flushSync)===!0,O=gr({currentLocation:N,nextLocation:R,historyAction:S});if(O){bt(O,{state:"blocked",location:R,proceed(){bt(O,{state:"proceeding",proceed:void 0,reset:void 0,location:R}),yt(s,u)},reset(){let ie=new Map(v.blockers);ie.set(O,at),H({blockers:ie})}});return}return await Ae(S,R,{submission:x,pendingError:C,preventScrollReset:T,replace:u&&u.replace,enableViewTransition:u&&u.viewTransition,flushSync:I})}function Sn(){if(Ut(),H({revalidation:"loading"}),v.navigation.state!=="submitting"){if(v.navigation.state==="idle"){Ae(v.historyAction,v.location,{startUninterruptedRevalidation:!0});return}Ae(j||v.historyAction,v.navigation.location,{overrideNavigation:v.navigation,enableViewTransition:ne===!0})}}async function Ae(s,u,h){M&&M.abort(),M=null,j=s,ae=(h&&h.startUninterruptedRevalidation)===!0,In(v.location,v.matches),V=(h&&h.preventScrollReset)===!0,ne=(h&&h.enableViewTransition)===!0;let y=c||o,x=h&&h.overrideNavigation,C=h!=null&&h.initialHydration&&v.matches&&v.matches.length>0&&!Y?v.matches:Be(y,u,l),N=(h&&h.flushSync)===!0;if(C&&v.initialized&&!se&&Ga(v.location,u)&&!(h&&h.submission&&ge(h.submission.formMethod))){ye(u,{matches:C},{flushSync:N});return}let R=xt(C,y,u.pathname);if(R.active&&R.matches&&(C=R.matches),!C){let{error:$,notFoundMatches:B,route:X}=Ot(u.pathname);ye(u,{matches:B,loaderData:{},errors:{[X.id]:$}},{flushSync:N});return}M=new AbortController;let P=Xe(e.history,u,M.signal,h&&h.submission),S;if(h&&h.pendingError)S=[ze(C).route.id,{type:z.error,error:h.pendingError}];else if(h&&h.submission&&ge(h.submission.formMethod)){let $=await Rn(P,u,h.submission,C,R.active,{replace:h.replace,flushSync:N});if($.shortCircuited)return;if($.pendingActionResult){let[B,X]=$.pendingActionResult;if(pe(X)&&ut(X.error)&&X.error.status===404){M=null,ye(u,{matches:$.matches,loaderData:{},errors:{[B]:X.error}});return}}C=$.matches||C,S=$.pendingActionResult,x=Bt(u,h.submission),N=!1,R.active=!1,P=Xe(e.history,P.url,P.signal)}let{shortCircuited:T,matches:I,loaderData:O,errors:ie}=await Pn(P,u,C,R.active,x,h&&h.submission,h&&h.fetcherSubmission,h&&h.replace,h&&h.initialHydration===!0,N,S);T||(M=null,ye(u,G({matches:I||C},Mr(S),{loaderData:O,errors:ie})))}async function Rn(s,u,h,y,x,C){C===void 0&&(C={}),Ut();let N=ei(u,h);if(H({navigation:N},{flushSync:C.flushSync===!0}),x){let S=await Et(y,u.pathname,s.signal);if(S.type==="aborted")return{shortCircuited:!0};if(S.type==="error"){let T=ze(S.partialMatches).route.id;return{matches:S.partialMatches,pendingActionResult:[T,{type:z.error,error:S.error}]}}else if(S.matches)y=S.matches;else{let{notFoundMatches:T,error:I,route:O}=Ot(u.pathname);return{matches:T,pendingActionResult:[O.id,{type:z.error,error:I}]}}}let R,P=lt(y,u);if(!P.route.action&&!P.route.lazy)R={type:z.error,error:le(405,{method:s.method,pathname:u.pathname,routeId:P.route.id})};else if(R=(await et("action",v,s,[P],y,null))[P.route.id],s.signal.aborted)return{shortCircuited:!0};if(We(R)){let S;return C&&C.replace!=null?S=C.replace:S=Lr(R.response.headers.get("Location"),new URL(s.url),l,e.history)===v.location.pathname+v.location.search,await Fe(s,R,!0,{submission:h,replace:S}),{shortCircuited:!0}}if(Ie(R))throw le(400,{type:"defer-action"});if(pe(R)){let S=ze(y,P.route.id);return(C&&C.replace)!==!0&&(j=re.Push),{matches:y,pendingActionResult:[S.route.id,R]}}return{matches:y,pendingActionResult:[P.route.id,R]}}async function Pn(s,u,h,y,x,C,N,R,P,S,T){let I=x||Bt(u,C),O=C||N||kr(I),ie=!ae&&(!g.v7_partialHydration||!P);if(y){if(ie){let Q=cr(T);H(G({navigation:I},Q!==void 0?{actionData:Q}:{}),{flushSync:S})}let A=await Et(h,u.pathname,s.signal);if(A.type==="aborted")return{shortCircuited:!0};if(A.type==="error"){let Q=ze(A.partialMatches).route.id;return{matches:A.partialMatches,loaderData:{},errors:{[Q]:A.error}}}else if(A.matches)h=A.matches;else{let{error:Q,notFoundMatches:Je,route:nt}=Ot(u.pathname);return{matches:Je,loaderData:{},errors:{[nt.id]:Q}}}}let $=c||o,[B,X]=Tr(e.history,v,h,O,u,g.v7_partialHydration&&P===!0,g.v7_skipActionErrorRevalidation,se,Ke,Ye,de,De,ue,$,l,T);if(kt(A=>!(h&&h.some(Q=>Q.route.id===A))||B&&B.some(Q=>Q.route.id===A)),Ce=++Te,B.length===0&&X.length===0){let A=hr();return ye(u,G({matches:h,loaderData:{},errors:T&&pe(T[1])?{[T[0]]:T[1].error}:null},Mr(T),A?{fetchers:new Map(v.fetchers)}:{}),{flushSync:S}),{shortCircuited:!0}}if(ie){let A={};if(!y){A.navigation=I;let Q=cr(T);Q!==void 0&&(A.actionData=Q)}X.length>0&&(A.fetchers=_n(X)),H(A,{flushSync:S})}X.forEach(A=>{Ne(A.key),A.controller&&Z.set(A.key,A.controller)});let Ge=()=>X.forEach(A=>Ne(A.key));M&&M.signal.addEventListener("abort",Ge);let{loaderResults:tt,fetcherResults:Se}=await ur(v,h,B,X,s);if(s.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",Ge),X.forEach(A=>Z.delete(A.key));let we=_t(tt);if(we)return await Fe(s,we.result,!0,{replace:R}),{shortCircuited:!0};if(we=_t(Se),we)return ue.add(we.key),await Fe(s,we.result,!0,{replace:R}),{shortCircuited:!0};let{loaderData:At,errors:rt}=jr(v,h,tt,T,X,Se,xe);xe.forEach((A,Q)=>{A.subscribe(Je=>{(Je||A.done)&&xe.delete(Q)})}),g.v7_partialHydration&&P&&v.errors&&(rt=G({},v.errors,rt));let Ve=hr(),St=pr(Ce),Rt=Ve||St||X.length>0;return G({matches:h,loaderData:At,errors:rt},Rt?{fetchers:new Map(v.fetchers)}:{})}function cr(s){if(s&&!pe(s[1]))return{[s[0]]:s[1].data};if(v.actionData)return Object.keys(v.actionData).length===0?null:v.actionData}function _n(s){return s.forEach(u=>{let h=v.fetchers.get(u.key),y=it(void 0,h?h.data:void 0);v.fetchers.set(u.key,y)}),new Map(v.fetchers)}function Tn(s,u,h,y){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ne(s);let x=(y&&y.flushSync)===!0,C=c||o,N=$t(v.location,v.matches,l,g.v7_prependBasename,h,g.v7_relativeSplatPath,u,y==null?void 0:y.relative),R=Be(C,N,l),P=xt(R,C,N);if(P.active&&P.matches&&(R=P.matches),!R){Ee(s,u,le(404,{pathname:N}),{flushSync:x});return}let{path:S,submission:T,error:I}=Pr(g.v7_normalizeFormMethod,!0,N,y);if(I){Ee(s,u,I,{flushSync:x});return}let O=lt(R,S),ie=(y&&y.preventScrollReset)===!0;if(T&&ge(T.formMethod)){Cn(s,u,S,O,R,P.active,x,ie,T);return}De.set(s,{routeId:u,path:S}),Dn(s,u,S,O,R,P.active,x,ie,T)}async function Cn(s,u,h,y,x,C,N,R,P){Ut(),De.delete(s);function S(te){if(!te.route.action&&!te.route.lazy){let qe=le(405,{method:P.formMethod,pathname:h,routeId:u});return Ee(s,u,qe,{flushSync:N}),!0}return!1}if(!C&&S(y))return;let T=v.fetchers.get(s);Le(s,ti(P,T),{flushSync:N});let I=new AbortController,O=Xe(e.history,h,I.signal,P);if(C){let te=await Et(x,new URL(O.url).pathname,O.signal,s);if(te.type==="aborted")return;if(te.type==="error"){Ee(s,u,te.error,{flushSync:N});return}else if(te.matches){if(x=te.matches,y=lt(x,h),S(y))return}else{Ee(s,u,le(404,{pathname:h}),{flushSync:N});return}}Z.set(s,I);let ie=Te,B=(await et("action",v,O,[y],x,s))[y.route.id];if(O.signal.aborted){Z.get(s)===I&&Z.delete(s);return}if(g.v7_fetcherPersist&&de.has(s)){if(We(B)||pe(B)){Le(s,je(void 0));return}}else{if(We(B))if(Z.delete(s),Ce>ie){Le(s,je(void 0));return}else return ue.add(s),Le(s,it(P)),Fe(O,B,!1,{fetcherSubmission:P,preventScrollReset:R});if(pe(B)){Ee(s,u,B.error);return}}if(Ie(B))throw le(400,{type:"defer-action"});let X=v.navigation.location||v.location,Ge=Xe(e.history,X,I.signal),tt=c||o,Se=v.navigation.state!=="idle"?Be(tt,v.navigation.location,l):v.matches;U(Se,"Didn't find any matches after fetcher action");let we=++Te;be.set(s,we);let At=it(P,B.data);v.fetchers.set(s,At);let[rt,Ve]=Tr(e.history,v,Se,P,X,!1,g.v7_skipActionErrorRevalidation,se,Ke,Ye,de,De,ue,tt,l,[y.route.id,B]);Ve.filter(te=>te.key!==s).forEach(te=>{let qe=te.key,wr=v.fetchers.get(qe),On=it(void 0,wr?wr.data:void 0);v.fetchers.set(qe,On),Ne(qe),te.controller&&Z.set(qe,te.controller)}),H({fetchers:new Map(v.fetchers)});let St=()=>Ve.forEach(te=>Ne(te.key));I.signal.addEventListener("abort",St);let{loaderResults:Rt,fetcherResults:A}=await ur(v,Se,rt,Ve,Ge);if(I.signal.aborted)return;I.signal.removeEventListener("abort",St),be.delete(s),Z.delete(s),Ve.forEach(te=>Z.delete(te.key));let Q=_t(Rt);if(Q)return Fe(Ge,Q.result,!1,{preventScrollReset:R});if(Q=_t(A),Q)return ue.add(Q.key),Fe(Ge,Q.result,!1,{preventScrollReset:R});let{loaderData:Je,errors:nt}=jr(v,Se,Rt,void 0,Ve,A,xe);if(v.fetchers.has(s)){let te=je(B.data);v.fetchers.set(s,te)}pr(we),v.navigation.state==="loading"&&we>Ce?(U(j,"Expected pending action"),M&&M.abort(),ye(v.navigation.location,{matches:Se,loaderData:Je,errors:nt,fetchers:new Map(v.fetchers)})):(H({errors:nt,loaderData:Ir(v.loaderData,Je,Se,nt),fetchers:new Map(v.fetchers)}),se=!1)}async function Dn(s,u,h,y,x,C,N,R,P){let S=v.fetchers.get(s);Le(s,it(P,S?S.data:void 0),{flushSync:N});let T=new AbortController,I=Xe(e.history,h,T.signal);if(C){let B=await Et(x,new URL(I.url).pathname,I.signal,s);if(B.type==="aborted")return;if(B.type==="error"){Ee(s,u,B.error,{flushSync:N});return}else if(B.matches)x=B.matches,y=lt(x,h);else{Ee(s,u,le(404,{pathname:h}),{flushSync:N});return}}Z.set(s,T);let O=Te,$=(await et("loader",v,I,[y],x,s))[y.route.id];if(Ie($)&&($=await rr($,I.signal,!0)||$),Z.get(s)===T&&Z.delete(s),!I.signal.aborted){if(de.has(s)){Le(s,je(void 0));return}if(We($))if(Ce>O){Le(s,je(void 0));return}else{ue.add(s),await Fe(I,$,!1,{preventScrollReset:R});return}if(pe($)){Ee(s,u,$.error);return}U(!Ie($),"Unhandled fetcher deferred data"),Le(s,je($.data))}}async function Fe(s,u,h,y){let{submission:x,fetcherSubmission:C,preventScrollReset:N,replace:R}=y===void 0?{}:y;u.response.headers.has("X-Remix-Revalidate")&&(se=!0);let P=u.response.headers.get("Location");U(P,"Expected a Location header on the redirect Response"),P=Lr(P,new URL(s.url),l,e.history);let S=ct(v.location,P,{_isRedirect:!0});if(r){let B=!1;if(u.response.headers.has("X-Remix-Reload-Document"))B=!0;else if(tr.test(P)){const X=e.history.createURL(P);B=X.origin!==t.location.origin||ft(X.pathname,l)==null}if(B){R?t.location.replace(P):t.location.assign(P);return}}M=null;let T=R===!0||u.response.headers.has("X-Remix-Replace")?re.Replace:re.Push,{formMethod:I,formAction:O,formEncType:ie}=v.navigation;!x&&!C&&I&&O&&ie&&(x=kr(v.navigation));let $=x||C;if(Ua.has(u.response.status)&&$&&ge($.formMethod))await Ae(T,S,{submission:G({},$,{formAction:P}),preventScrollReset:N||V,enableViewTransition:h?ne:void 0});else{let B=Bt(S,x);await Ae(T,S,{overrideNavigation:B,fetcherSubmission:C,preventScrollReset:N||V,enableViewTransition:h?ne:void 0})}}async function et(s,u,h,y,x,C){let N,R={};try{N=await Ha(d,s,u,h,y,x,C,i,a)}catch(P){return y.forEach(S=>{R[S.route.id]={type:z.error,error:P}}),R}for(let[P,S]of Object.entries(N))if(Ja(S)){let T=S.result;R[P]={type:z.redirect,response:Ka(T,h,P,x,l,g.v7_relativeSplatPath)}}else R[P]=await $a(S);return R}async function ur(s,u,h,y,x){let C=s.matches,N=et("loader",s,x,h,u,null),R=Promise.all(y.map(async T=>{if(T.matches&&T.match&&T.controller){let O=(await et("loader",s,Xe(e.history,T.path,T.controller.signal),[T.match],T.matches,T.key))[T.match.route.id];return{[T.key]:O}}else return Promise.resolve({[T.key]:{type:z.error,error:le(404,{pathname:T.path})}})})),P=await N,S=(await R).reduce((T,I)=>Object.assign(T,I),{});return await Promise.all([Qa(u,P,x.signal,C,s.loaderData),Za(u,S,y)]),{loaderResults:P,fetcherResults:S}}function Ut(){se=!0,Ke.push(...kt()),De.forEach((s,u)=>{Z.has(u)&&Ye.add(u),Ne(u)})}function Le(s,u,h){h===void 0&&(h={}),v.fetchers.set(s,u),H({fetchers:new Map(v.fetchers)},{flushSync:(h&&h.flushSync)===!0})}function Ee(s,u,h,y){y===void 0&&(y={});let x=ze(v.matches,u);wt(s),H({errors:{[x.route.id]:h},fetchers:new Map(v.fetchers)},{flushSync:(y&&y.flushSync)===!0})}function dr(s){return Oe.set(s,(Oe.get(s)||0)+1),de.has(s)&&de.delete(s),v.fetchers.get(s)||Oa}function wt(s){let u=v.fetchers.get(s);Z.has(s)&&!(u&&u.state==="loading"&&be.has(s))&&Ne(s),De.delete(s),be.delete(s),ue.delete(s),g.v7_fetcherPersist&&de.delete(s),Ye.delete(s),v.fetchers.delete(s)}function Ln(s){let u=(Oe.get(s)||0)-1;u<=0?(Oe.delete(s),de.add(s),g.v7_fetcherPersist||wt(s)):Oe.set(s,u),H({fetchers:new Map(v.fetchers)})}function Ne(s){let u=Z.get(s);u&&(u.abort(),Z.delete(s))}function fr(s){for(let u of s){let h=dr(u),y=je(h.data);v.fetchers.set(u,y)}}function hr(){let s=[],u=!1;for(let h of ue){let y=v.fetchers.get(h);U(y,"Expected fetcher: "+h),y.state==="loading"&&(ue.delete(h),s.push(h),u=!0)}return fr(s),u}function pr(s){let u=[];for(let[h,y]of be)if(y<s){let x=v.fetchers.get(h);U(x,"Expected fetcher: "+h),x.state==="loading"&&(Ne(h),be.delete(h),u.push(h))}return fr(u),u.length>0}function Nn(s,u){let h=v.blockers.get(s)||at;return ve.get(s)!==u&&ve.set(s,u),h}function mr(s){v.blockers.delete(s),ve.delete(s)}function bt(s,u){let h=v.blockers.get(s)||at;U(h.state==="unblocked"&&u.state==="blocked"||h.state==="blocked"&&u.state==="blocked"||h.state==="blocked"&&u.state==="proceeding"||h.state==="blocked"&&u.state==="unblocked"||h.state==="proceeding"&&u.state==="unblocked","Invalid blocker state transition: "+h.state+" -> "+u.state);let y=new Map(v.blockers);y.set(s,u),H({blockers:y})}function gr(s){let{currentLocation:u,nextLocation:h,historyAction:y}=s;if(ve.size===0)return;ve.size>1&&$e(!1,"A router only supports one blocker at a time");let x=Array.from(ve.entries()),[C,N]=x[x.length-1],R=v.blockers.get(C);if(!(R&&R.state==="proceeding")&&N({currentLocation:u,nextLocation:h,historyAction:y}))return C}function Ot(s){let u=le(404,{pathname:s}),h=c||o,{matches:y,route:x}=Ur(h);return kt(),{notFoundMatches:y,route:x,error:u}}function kt(s){let u=[];return xe.forEach((h,y)=>{(!s||s(y))&&(h.cancel(),u.push(y),xe.delete(y))}),u}function jn(s,u,h){if(_=s,D=u,E=h||null,!F&&v.navigation===Vt){F=!0;let y=yr(v.location,v.matches);y!=null&&H({restoreScrollPosition:y})}return()=>{_=null,D=null,E=null}}function vr(s,u){return E&&E(s,u.map(y=>fa(y,v.loaderData)))||s.key}function In(s,u){if(_&&D){let h=vr(s,u);_[h]=D()}}function yr(s,u){if(_){let h=vr(s,u),y=_[h];if(typeof y=="number")return y}return null}function xt(s,u,h){if(m)if(s){if(Object.keys(s[0].params).length>0)return{active:!0,matches:Tt(u,h,l,!0)}}else return{active:!0,matches:Tt(u,h,l,!0)||[]};return{active:!1,matches:null}}async function Et(s,u,h,y){if(!m)return{type:"success",matches:s};let x=s;for(;;){let C=c==null,N=c||o,R=i;try{await m({signal:h,path:u,matches:x,fetcherKey:y,patch:(T,I)=>{h.aborted||Dr(T,I,N,R,a)}})}catch(T){return{type:"error",error:T,partialMatches:x}}finally{C&&!h.aborted&&(o=[...o])}if(h.aborted)return{type:"aborted"};let P=Be(N,u,l);if(P)return{type:"success",matches:P};let S=Tt(N,u,l,!0);if(!S||x.length===S.length&&x.every((T,I)=>T.route.id===S[I].route.id))return{type:"success",matches:null};x=S}}function Mn(s){i={},c=Lt(s,a,void 0,i)}function Un(s,u){let h=c==null;Dr(s,u,c||o,i,a),h&&(o=[...o],H({}))}return me={get basename(){return l},get future(){return g},get state(){return v},get routes(){return o},get window(){return t},initialize:vt,subscribe:fe,enableScrollRestoration:jn,navigate:yt,fetch:Tn,revalidate:Sn,createHref:s=>e.history.createHref(s),encodeLocation:s=>e.history.encodeLocation(s),getFetcher:dr,deleteFetcher:Ln,dispose:k,getBlocker:Nn,deleteBlocker:mr,patchRoutes:Un,_internalFetchControllers:Z,_internalActiveDeferreds:xe,_internalSetRoutes:Mn},me}function Fa(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function $t(e,t,r,n,a,i,o,c){let l,d;if(o){l=[];for(let g of t)if(l.push(g),g.route.id===o){d=g;break}}else l=t,d=t[t.length-1];let m=er(a||".",Zt(l,i),ft(e.pathname,r)||e.pathname,c==="path");if(a==null&&(m.search=e.search,m.hash=e.hash),(a==null||a===""||a===".")&&d){let g=nr(m.search);if(d.route.index&&!g)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&g){let w=new URLSearchParams(m.search),b=w.getAll("index");w.delete("index"),b.filter(E=>E).forEach(E=>w.append("index",E));let _=w.toString();m.search=_?"?"+_:""}}return n&&r!=="/"&&(m.pathname=m.pathname==="/"?r:Me([r,m.pathname])),dt(m)}function Pr(e,t,r,n){if(!n||!Fa(n))return{path:r};if(n.formMethod&&!Xa(n.formMethod))return{path:r,error:le(405,{method:n.formMethod})};let a=()=>({path:r,error:le(400,{type:"invalid-body"})}),i=n.formMethod||"get",o=e?i.toUpperCase():i.toLowerCase(),c=rn(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!ge(o))return a();let w=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((b,_)=>{let[E,D]=_;return""+b+E+"="+D+`
12
- `},""):String(n.body);return{path:r,submission:{formMethod:o,formAction:c,formEncType:n.formEncType,formData:void 0,json:void 0,text:w}}}else if(n.formEncType==="application/json"){if(!ge(o))return a();try{let w=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:o,formAction:c,formEncType:n.formEncType,formData:void 0,json:w,text:void 0}}}catch{return a()}}}U(typeof FormData=="function","FormData is not available in this environment");let l,d;if(n.formData)l=Yt(n.formData),d=n.formData;else if(n.body instanceof FormData)l=Yt(n.body),d=n.body;else if(n.body instanceof URLSearchParams)l=n.body,d=Nr(l);else if(n.body==null)l=new URLSearchParams,d=new FormData;else try{l=new URLSearchParams(n.body),d=Nr(l)}catch{return a()}let m={formMethod:o,formAction:c,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:d,json:void 0,text:void 0};if(ge(m.formMethod))return{path:r,submission:m};let g=Ue(r);return t&&g.search&&nr(g.search)&&l.append("index",""),g.search="?"+l,{path:dt(g),submission:m}}function _r(e,t,r){r===void 0&&(r=!1);let n=e.findIndex(a=>a.route.id===t);return n>=0?e.slice(0,r?n+1:n):e}function Tr(e,t,r,n,a,i,o,c,l,d,m,g,w,b,_,E){let D=E?pe(E[1])?E[1].error:E[1].data:void 0,F=e.createURL(t.location),L=e.createURL(a),Y=r;i&&t.errors?Y=_r(r,Object.keys(t.errors)[0],!0):E&&pe(E[1])&&(Y=_r(r,E[0]));let ee=E?E[1].statusCode:void 0,K=o&&ee&&ee>=400,me=Y.filter((j,V)=>{let{route:M}=j;if(M.lazy)return!0;if(M.loader==null)return!1;if(i)return Kt(M,t.loaderData,t.errors);if(Va(t.loaderData,t.matches[V],j)||l.some(oe=>oe===j.route.id))return!0;let ne=t.matches[V],J=j;return Cr(j,G({currentUrl:F,currentParams:ne.params,nextUrl:L,nextParams:J.params},n,{actionResult:D,actionStatus:ee,defaultShouldRevalidate:K?!1:c||F.pathname+F.search===L.pathname+L.search||F.search!==L.search||en(ne,J)}))}),v=[];return g.forEach((j,V)=>{if(i||!r.some(ae=>ae.route.id===j.routeId)||m.has(V))return;let M=Be(b,j.path,_);if(!M){v.push({key:V,routeId:j.routeId,path:j.path,matches:null,match:null,controller:null});return}let ne=t.fetchers.get(V),J=lt(M,j.path),oe=!1;w.has(V)?oe=!1:d.has(V)?(d.delete(V),oe=!0):ne&&ne.state!=="idle"&&ne.data===void 0?oe=c:oe=Cr(J,G({currentUrl:F,currentParams:t.matches[t.matches.length-1].params,nextUrl:L,nextParams:r[r.length-1].params},n,{actionResult:D,actionStatus:ee,defaultShouldRevalidate:K?!1:c})),oe&&v.push({key:V,routeId:j.routeId,path:j.path,matches:M,match:J,controller:new AbortController})}),[me,v]}function Kt(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let n=t!=null&&t[e.id]!==void 0,a=r!=null&&r[e.id]!==void 0;return!n&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!n&&!a}function Va(e,t,r){let n=!t||r.route.id!==t.route.id,a=e[r.route.id]===void 0;return n||a}function en(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Cr(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Dr(e,t,r,n,a){var i;let o;if(e){let d=n[e];U(d,"No route found to patch children into: routeId = "+e),d.children||(d.children=[]),o=d.children}else o=r;let c=t.filter(d=>!o.some(m=>tn(d,m))),l=Lt(c,a,[e||"_","patch",String(((i=o)==null?void 0:i.length)||"0")],n);o.push(...l)}function tn(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,n)=>{var a;return(a=t.children)==null?void 0:a.some(i=>tn(r,i))}):!1}async function Ba(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let a=r[e.id];U(a,"No route found in manifest");let i={};for(let o in n){let l=a[o]!==void 0&&o!=="hasErrorBoundary";$e(!l,'Route "'+a.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!l&&!ua.has(o)&&(i[o]=n[o])}Object.assign(a,i),Object.assign(a,G({},t(a),{lazy:void 0}))}async function za(e){let{matches:t}=e,r=t.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,i,o)=>Object.assign(a,{[r[o].route.id]:i}),{})}async function Ha(e,t,r,n,a,i,o,c,l,d){let m=i.map(b=>b.route.lazy?Ba(b.route,l,c):void 0),g=i.map((b,_)=>{let E=m[_],D=a.some(L=>L.route.id===b.route.id);return G({},b,{shouldLoad:D,resolve:async L=>(L&&n.method==="GET"&&(b.route.lazy||b.route.loader)&&(D=!0),D?Wa(t,n,b,E,L,d):Promise.resolve({type:z.data,result:void 0}))})}),w=await e({matches:g,request:n,params:i[0].params,fetcherKey:o,context:d});try{await Promise.all(m)}catch{}return w}async function Wa(e,t,r,n,a,i){let o,c,l=d=>{let m,g=new Promise((_,E)=>m=E);c=()=>m(),t.signal.addEventListener("abort",c);let w=_=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):d({request:t,params:r.params,context:i},..._!==void 0?[_]:[]),b=(async()=>{try{return{type:"data",result:await(a?a(E=>w(E)):w())}}catch(_){return{type:"error",result:_}}})();return Promise.race([b,g])};try{let d=r.route[e];if(n)if(d){let m,[g]=await Promise.all([l(d).catch(w=>{m=w}),n]);if(m!==void 0)throw m;o=g}else if(await n,d=r.route[e],d)o=await l(d);else if(e==="action"){let m=new URL(t.url),g=m.pathname+m.search;throw le(405,{method:t.method,pathname:g,routeId:r.route.id})}else return{type:z.data,result:void 0};else if(d)o=await l(d);else{let m=new URL(t.url),g=m.pathname+m.search;throw le(404,{pathname:g})}U(o.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:z.error,result:d}}finally{c&&t.signal.removeEventListener("abort",c)}return o}async function $a(e){let{result:t,type:r}=e;if(nn(t)){let g;try{let w=t.headers.get("Content-Type");w&&/\bapplication\/json\b/.test(w)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(w){return{type:z.error,error:w}}return r===z.error?{type:z.error,error:new Nt(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:z.data,data:g,statusCode:t.status,headers:t.headers}}if(r===z.error){if(Or(t)){var n,a;if(t.data instanceof Error){var i,o;return{type:z.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:z.error,error:new Nt(((n=t.init)==null?void 0:n.status)||500,void 0,t.data),statusCode:ut(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:z.error,error:t,statusCode:ut(t)?t.status:void 0}}if(qa(t)){var c,l;return{type:z.deferred,deferredData:t,statusCode:(c=t.init)==null?void 0:c.status,headers:((l=t.init)==null?void 0:l.headers)&&new Headers(t.init.headers)}}if(Or(t)){var d,m;return{type:z.data,data:t.data,statusCode:(d=t.init)==null?void 0:d.status,headers:(m=t.init)!=null&&m.headers?new Headers(t.init.headers):void 0}}return{type:z.data,data:t}}function Ka(e,t,r,n,a,i){let o=e.headers.get("Location");if(U(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!tr.test(o)){let c=n.slice(0,n.findIndex(l=>l.route.id===r)+1);o=$t(new URL(t.url),c,a,!0,o,i),e.headers.set("Location",o)}return e}function Lr(e,t,r,n){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(tr.test(e)){let i=e,o=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(a.includes(o.protocol))throw new Error("Invalid redirect location");let c=ft(o.pathname,r)!=null;if(o.origin===t.origin&&c)return o.pathname+o.search+o.hash}try{let i=n.createURL(e);if(a.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Xe(e,t,r,n){let a=e.createURL(rn(t)).toString(),i={signal:r};if(n&&ge(n.formMethod)){let{formMethod:o,formEncType:c}=n;i.method=o.toUpperCase(),c==="application/json"?(i.headers=new Headers({"Content-Type":c}),i.body=JSON.stringify(n.json)):c==="text/plain"?i.body=n.text:c==="application/x-www-form-urlencoded"&&n.formData?i.body=Yt(n.formData):i.body=n.formData}return new Request(a,i)}function Yt(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function Nr(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ya(e,t,r,n,a){let i={},o=null,c,l=!1,d={},m=r&&pe(r[1])?r[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let w=g.route.id,b=t[w];if(U(!We(b),"Cannot handle redirect results in processLoaderData"),pe(b)){let _=b.error;m!==void 0&&(_=m,m=void 0),o=o||{};{let E=ze(e,w);o[E.route.id]==null&&(o[E.route.id]=_)}i[w]=void 0,l||(l=!0,c=ut(b.error)?b.error.status:500),b.headers&&(d[w]=b.headers)}else Ie(b)?(n.set(w,b.deferredData),i[w]=b.deferredData.data,b.statusCode!=null&&b.statusCode!==200&&!l&&(c=b.statusCode),b.headers&&(d[w]=b.headers)):(i[w]=b.data,b.statusCode&&b.statusCode!==200&&!l&&(c=b.statusCode),b.headers&&(d[w]=b.headers))}),m!==void 0&&r&&(o={[r[0]]:m},i[r[0]]=void 0),{loaderData:i,errors:o,statusCode:c||200,loaderHeaders:d}}function jr(e,t,r,n,a,i,o){let{loaderData:c,errors:l}=Ya(t,r,n,o);return a.forEach(d=>{let{key:m,match:g,controller:w}=d,b=i[m];if(U(b,"Did not find corresponding fetcher result"),!(w&&w.signal.aborted))if(pe(b)){let _=ze(e.matches,g==null?void 0:g.route.id);l&&l[_.route.id]||(l=G({},l,{[_.route.id]:b.error})),e.fetchers.delete(m)}else if(We(b))U(!1,"Unhandled fetcher revalidation redirect");else if(Ie(b))U(!1,"Unhandled fetcher deferred data");else{let _=je(b.data);e.fetchers.set(m,_)}}),{loaderData:c,errors:l}}function Ir(e,t,r,n){let a=G({},t);for(let i of r){let o=i.route.id;if(t.hasOwnProperty(o)?t[o]!==void 0&&(a[o]=t[o]):e[o]!==void 0&&i.route.loader&&(a[o]=e[o]),n&&n.hasOwnProperty(o))break}return a}function Mr(e){return e?pe(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ze(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function Ur(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function le(e,t){let{pathname:r,routeId:n,method:a,type:i,message:o}=t===void 0?{}:t,c="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(c="Bad Request",a&&r&&n?l="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":i==="defer-action"?l="defer() is not supported in actions":i==="invalid-body"&&(l="Unable to encode submission body")):e===403?(c="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):e===404?(c="Not Found",l='No route matches URL "'+r+'"'):e===405&&(c="Method Not Allowed",a&&r&&n?l="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(l='Invalid request method "'+a.toUpperCase()+'"')),new Nt(e||500,c,new Error(l),!0)}function _t(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,a]=t[r];if(We(a))return{key:n,result:a}}}function rn(e){let t=typeof e=="string"?Ue(e):e;return dt(G({},t,{hash:""}))}function Ga(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Ja(e){return nn(e.result)&&Ma.has(e.result.status)}function Ie(e){return e.type===z.deferred}function pe(e){return e.type===z.error}function We(e){return(e&&e.type)===z.redirect}function Or(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function qa(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function nn(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Xa(e){return Ia.has(e.toLowerCase())}function ge(e){return Na.has(e.toLowerCase())}async function Qa(e,t,r,n,a){let i=Object.entries(t);for(let o=0;o<i.length;o++){let[c,l]=i[o],d=e.find(w=>(w==null?void 0:w.route.id)===c);if(!d)continue;let m=n.find(w=>w.route.id===d.route.id),g=m!=null&&!en(m,d)&&(a&&a[d.route.id])!==void 0;Ie(l)&&g&&await rr(l,r,!1).then(w=>{w&&(t[c]=w)})}}async function Za(e,t,r){for(let n=0;n<r.length;n++){let{key:a,routeId:i,controller:o}=r[n],c=t[a];e.find(d=>(d==null?void 0:d.route.id)===i)&&Ie(c)&&(U(o,"Expected an AbortController for revalidating fetcher deferred result"),await rr(c,o.signal,!0).then(d=>{d&&(t[a]=d)}))}}async function rr(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:z.data,data:e.deferredData.unwrappedData}}catch(a){return{type:z.error,error:a}}return{type:z.data,data:e.deferredData.data}}}function nr(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function lt(e,t){let r=typeof t=="string"?Ue(t).search:t.search;if(e[e.length-1].route.index&&nr(r||""))return e[e.length-1];let n=Xr(e);return n[n.length-1]}function kr(e){let{formMethod:t,formAction:r,formEncType:n,text:a,formData:i,json:o}=e;if(!(!t||!r||!n)){if(a!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:r,formEncType:n,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:o,text:void 0}}}function Bt(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function ei(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function it(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ti(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function je(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function ri(e,t){try{let r=e.sessionStorage.getItem(Zr);if(r){let n=JSON.parse(r);for(let[a,i]of Object.entries(n||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function ni(e,t){if(t.size>0){let r={};for(let[n,a]of t)r[n]=[...a];try{e.sessionStorage.setItem(Zr,JSON.stringify(r))}catch(n){$e(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/**
13
- * React Router v6.30.3
14
- *
15
- * Copyright (c) Remix Software Inc.
16
- *
17
- * This source code is licensed under the MIT license found in the
18
- * LICENSE.md file in the root directory of this source tree.
19
- *
20
- * @license MIT
21
- */function jt(){return jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jt.apply(this,arguments)}const Mt=f.createContext(null),an=f.createContext(null),ht=f.createContext(null),ar=f.createContext(null),_e=f.createContext({outlet:null,matches:[],isDataRoute:!1}),on=f.createContext(null);function pt(){return f.useContext(ar)!=null}function mt(){return pt()||U(!1),f.useContext(ar).location}function sn(e){f.useContext(ht).static||f.useLayoutEffect(e)}function ir(){let{isDataRoute:e}=f.useContext(_e);return e?vi():ai()}function ai(){pt()||U(!1);let e=f.useContext(Mt),{basename:t,future:r,navigator:n}=f.useContext(ht),{matches:a}=f.useContext(_e),{pathname:i}=mt(),o=JSON.stringify(Zt(a,r.v7_relativeSplatPath)),c=f.useRef(!1);return sn(()=>{c.current=!0}),f.useCallback(function(d,m){if(m===void 0&&(m={}),!c.current)return;if(typeof d=="number"){n.go(d);return}let g=er(d,JSON.parse(o),i,m.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Me([t,g.pathname])),(m.replace?n.replace:n.push)(g,m.state,m)},[t,n,o,i,e])}const ii=f.createContext(null);function oi(e){let t=f.useContext(_e).outlet;return t&&f.createElement(ii.Provider,{value:e},t)}function rs(){let{matches:e}=f.useContext(_e),t=e[e.length-1];return t?t.params:{}}function si(e,t,r,n){pt()||U(!1);let{navigator:a}=f.useContext(ht),{matches:i}=f.useContext(_e),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let d=mt(),m;m=d;let g=m.pathname||"/",w=g;if(l!=="/"){let E=l.replace(/^\//,"").split("/");w="/"+g.replace(/^\//,"").split("/").slice(E.length).join("/")}let b=Be(e,{pathname:w});return fi(b&&b.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:Me([l,a.encodeLocation?a.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?l:Me([l,a.encodeLocation?a.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),i,r,n)}function li(){let e=gi(),t=ut(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),r?f.createElement("pre",{style:a},r):null,null)}const ci=f.createElement(li,null);class ui extends f.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?f.createElement(_e.Provider,{value:this.props.routeContext},f.createElement(on.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function di(e){let{routeContext:t,match:r,children:n}=e,a=f.useContext(Mt);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),f.createElement(_e.Provider,{value:t},n)}function fi(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,c=(a=r)==null?void 0:a.errors;if(c!=null){let m=o.findIndex(g=>g.route.id&&(c==null?void 0:c[g.route.id])!==void 0);m>=0||U(!1),o=o.slice(0,Math.min(o.length,m+1))}let l=!1,d=-1;if(r&&n&&n.v7_partialHydration)for(let m=0;m<o.length;m++){let g=o[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=m),g.route.id){let{loaderData:w,errors:b}=r,_=g.route.loader&&w[g.route.id]===void 0&&(!b||b[g.route.id]===void 0);if(g.route.lazy||_){l=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((m,g,w)=>{let b,_=!1,E=null,D=null;r&&(b=c&&g.route.id?c[g.route.id]:void 0,E=g.route.errorElement||ci,l&&(d<0&&w===0?(yi("route-fallback"),_=!0,D=null):d===w&&(_=!0,D=g.route.hydrateFallbackElement||null)));let F=t.concat(o.slice(0,w+1)),L=()=>{let Y;return b?Y=E:_?Y=D:g.route.Component?Y=f.createElement(g.route.Component,null):g.route.element?Y=g.route.element:Y=m,f.createElement(di,{match:g,routeContext:{outlet:m,matches:F,isDataRoute:r!=null},children:Y})};return r&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?f.createElement(ui,{location:r.location,revalidation:r.revalidation,component:E,error:b,children:L(),routeContext:{outlet:null,matches:F,isDataRoute:!0}}):L()},null)}var ln=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(ln||{}),cn=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(cn||{});function hi(e){let t=f.useContext(Mt);return t||U(!1),t}function pi(e){let t=f.useContext(an);return t||U(!1),t}function mi(e){let t=f.useContext(_e);return t||U(!1),t}function un(e){let t=mi(),r=t.matches[t.matches.length-1];return r.route.id||U(!1),r.route.id}function gi(){var e;let t=f.useContext(on),r=pi(cn.UseRouteError),n=un();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function vi(){let{router:e}=hi(ln.UseNavigateStable),t=un(),r=f.useRef(!1);return sn(()=>{r.current=!0}),f.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,jt({fromRouteId:t},i)))},[e,t])}const Ar={};function yi(e,t,r){Ar[e]||(Ar[e]=!0)}function wi(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function or(e){let{to:t,replace:r,state:n,relative:a}=e;pt()||U(!1);let{future:i,static:o}=f.useContext(ht),{matches:c}=f.useContext(_e),{pathname:l}=mt(),d=ir(),m=er(t,Zt(c,i.v7_relativeSplatPath),l,a==="path"),g=JSON.stringify(m);return f.useEffect(()=>d(JSON.parse(g),{replace:r,state:n,relative:a}),[d,g,a,r,n]),null}function bi(e){return oi(e.context)}function xi(e){let{basename:t="/",children:r=null,location:n,navigationType:a=re.Pop,navigator:i,static:o=!1,future:c}=e;pt()&&U(!1);let l=t.replace(/^\/*/,"/"),d=f.useMemo(()=>({basename:l,navigator:i,static:o,future:jt({v7_relativeSplatPath:!1},c)}),[l,c,i,o]);typeof n=="string"&&(n=Ue(n));let{pathname:m="/",search:g="",hash:w="",state:b=null,key:_="default"}=n,E=f.useMemo(()=>{let D=ft(m,l);return D==null?null:{location:{pathname:D,search:g,hash:w,state:b,key:_},navigationType:a}},[l,m,g,w,b,_,a]);return E==null?null:f.createElement(ht.Provider,{value:d},f.createElement(ar.Provider,{children:r,value:E}))}new Promise(()=>{});function Ei(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:f.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:f.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:f.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
22
- * React Router DOM v6.30.3
23
- *
24
- * Copyright (c) Remix Software Inc.
25
- *
26
- * This source code is licensed under the MIT license found in the
27
- * LICENSE.md file in the root directory of this source tree.
28
- *
29
- * @license MIT
30
- */function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},It.apply(this,arguments)}function Gt(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function Si(e,t){let r=Gt(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const Ri="6";try{window.__reactRouterVersion=Ri}catch{}function Pi(e,t){return Aa({basename:void 0,future:It({},void 0,{v7_prependBasename:!0}),history:sa({window:void 0}),hydrationData:_i(),routes:e,mapRouteProperties:Ei,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function _i(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=It({},t,{errors:Ti(t.errors)})),t}function Ti(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&a.__type==="RouteErrorResponse")r[n]=new Nt(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let o=new i(a.message);o.stack="",r[n]=o}catch{}}if(r[n]==null){let i=new Error(a.message);i.stack="",r[n]=i}}else r[n]=a;return r}const Ci=f.createContext({isTransitioning:!1}),Di=f.createContext(new Map),Li="startTransition",Fr=Bn[Li],Ni="flushSync",Vr=oa[Ni];function ji(e){Fr?Fr(e):e()}function ot(e){Vr?Vr(e):e()}class Ii{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function Mi(e){let{fallbackElement:t,router:r,future:n}=e,[a,i]=f.useState(r.state),[o,c]=f.useState(),[l,d]=f.useState({isTransitioning:!1}),[m,g]=f.useState(),[w,b]=f.useState(),[_,E]=f.useState(),D=f.useRef(new Map),{v7_startTransition:F}=n||{},L=f.useCallback(j=>{F?ji(j):j()},[F]),Y=f.useCallback((j,V)=>{let{deletedFetchers:M,flushSync:ne,viewTransitionOpts:J}=V;j.fetchers.forEach((ae,se)=>{ae.data!==void 0&&D.current.set(se,ae.data)}),M.forEach(ae=>D.current.delete(ae));let oe=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!J||oe){ne?ot(()=>i(j)):L(()=>i(j));return}if(ne){ot(()=>{w&&(m&&m.resolve(),w.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:J.currentLocation,nextLocation:J.nextLocation})});let ae=r.window.document.startViewTransition(()=>{ot(()=>i(j))});ae.finished.finally(()=>{ot(()=>{g(void 0),b(void 0),c(void 0),d({isTransitioning:!1})})}),ot(()=>b(ae));return}w?(m&&m.resolve(),w.skipTransition(),E({state:j,currentLocation:J.currentLocation,nextLocation:J.nextLocation})):(c(j),d({isTransitioning:!0,flushSync:!1,currentLocation:J.currentLocation,nextLocation:J.nextLocation}))},[r.window,w,m,D,L]);f.useLayoutEffect(()=>r.subscribe(Y),[r,Y]),f.useEffect(()=>{l.isTransitioning&&!l.flushSync&&g(new Ii)},[l]),f.useEffect(()=>{if(m&&o&&r.window){let j=o,V=m.promise,M=r.window.document.startViewTransition(async()=>{L(()=>i(j)),await V});M.finished.finally(()=>{g(void 0),b(void 0),c(void 0),d({isTransitioning:!1})}),b(M)}},[L,o,m,r.window]),f.useEffect(()=>{m&&o&&a.location.key===o.location.key&&m.resolve()},[m,w,a.location,o]),f.useEffect(()=>{!l.isTransitioning&&_&&(c(_.state),d({isTransitioning:!0,flushSync:!1,currentLocation:_.currentLocation,nextLocation:_.nextLocation}),E(void 0))},[l.isTransitioning,_]),f.useEffect(()=>{},[]);let ee=f.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:j=>r.navigate(j),push:(j,V,M)=>r.navigate(j,{state:V,preventScrollReset:M==null?void 0:M.preventScrollReset}),replace:(j,V,M)=>r.navigate(j,{replace:!0,state:V,preventScrollReset:M==null?void 0:M.preventScrollReset})}),[r]),K=r.basename||"/",me=f.useMemo(()=>({router:r,navigator:ee,static:!1,basename:K}),[r,ee,K]),v=f.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return f.useEffect(()=>wi(n,r.future),[n,r.future]),f.createElement(f.Fragment,null,f.createElement(Mt.Provider,{value:me},f.createElement(an.Provider,{value:a},f.createElement(Di.Provider,{value:D.current},f.createElement(Ci.Provider,{value:l},f.createElement(xi,{basename:K,location:a.location,navigationType:a.historyAction,navigator:ee,future:v},a.initialized||r.future.v7_partialHydration?f.createElement(Ui,{routes:r.routes,future:r.future,state:a}):t))))),null)}const Ui=f.memo(Oi);function Oi(e){let{routes:t,future:r,state:n}=e;return si(t,void 0,n,r)}var Br;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Br||(Br={}));var zr;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(zr||(zr={}));function ki(e){let t=f.useRef(Gt(e)),r=f.useRef(!1),n=mt(),a=f.useMemo(()=>Si(n.search,r.current?null:t.current),[n.search]),i=ir(),o=f.useCallback((c,l)=>{const d=Gt(typeof c=="function"?c(a):c);r.current=!0,i("?"+d,l)},[i,a]);return[a,o]}let zt=null;function st(){return Pe().bridge}function Ai(){return{runtime:{isAvailable(){return st().supported},getPlatformInfo(){return st().getPlatformInfo()}},fs:{openFile(e){return st().openLocalFile(e)},revealInFileManager(e){return st().revealInFileManager(e)},pickDirectory(){return st().pickDirectory()}}}}function Fi(){return zt||(zt=Ai()),zt}function Vi(){if(typeof window>"u"||window.self!==window.top)return;const e=Fi();window.__CODINGNS_DESKTOP_BRIDGE_INSTALLED__=!0,Object.defineProperty(window,"CodingNSDesktop",{configurable:!0,writable:!1,value:e})}const Bi="desktop://window-lifecycle",zi=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function Hi(e){return e instanceof HTMLInputElement?!zi.has(e.type.toLowerCase()):!1}function Wi(e){const t=e.activeElement;if(Hi(t)||t instanceof HTMLTextAreaElement){const r=t.selectionStart??0,n=t.selectionEnd??r;return n<=r?null:t.value.slice(r,n)}return null}function $i(e){const t=Wi(e);if(t!==null)return t;const r=e.getSelection();if(!r||r.isCollapsed)return null;const n=r.toString();return n.length>0?n:null}function Ki(e,t){var a;const r=(a=e.execCommand)==null?void 0:a.bind(e);if(typeof r!="function")return!1;const n=e.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.opacity="0",e.body.append(n),n.select();try{return r("copy")}catch{return!1}finally{n.remove()}}async function Yi(e,t,r){var a,i;try{if(await r(t))return}catch{}const n=(a=e.defaultView)==null?void 0:a.navigator;if((i=n==null?void 0:n.clipboard)!=null&&i.writeText)try{await n.clipboard.writeText(t);return}catch{}Ki(e,t)}function Gi(e){const{window:t,document:r,writeClipboardText:n}=e;function a(i){if(i.defaultPrevented||!i.metaKey||i.ctrlKey||i.altKey||i.key.toLowerCase()!=="c")return;const o=$i(r);o&&(i.preventDefault(),Yi(r,o,n))}return t.addEventListener("keydown",a,!0),()=>{t.removeEventListener("keydown",a,!0)}}const dn=f.createContext(null),Ji=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function qi(e){if(typeof document>"u")return;const{documentElement:t,body:r}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),r&&(r.dataset.runtimePlatform=e.platform,r.dataset.osFamily=e.ui.osFamily,r.dataset.windowControls=e.ui.windowControlsStyle,r.dataset.viewportClass=e.viewportClass,r.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function Jt(){var e;if(!(typeof document>"u"))for(const t of Ji)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function Xi(e){if(typeof document>"u")return;if(!e){Jt();return}const t=[document.documentElement,document.body].filter(n=>!!n),r=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const n of t)for(const[a,i]of r)n.style.setProperty(a,i)}function Qi(){if(!(typeof window>"u"))return window.innerWidth}function Zi({children:e}){const[t,r]=f.useState(()=>Qi()),n=f.useMemo(()=>Pe({viewportWidth:t}),[t]);return f.useEffect(()=>{Vi()},[]),f.useEffect(()=>{if(typeof window>"u")return;function a(){r(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),f.useEffect(()=>{qi(n)},[n]),f.useEffect(()=>{if(!(typeof window>"u"||typeof document>"u")&&!(!n.isDesktop||n.ui.osFamily!=="macos"||!n.bridge.supported))return Gi({window,document,writeClipboardText:async a=>(await n.bridge.writeClipboardText(a)).ok})},[n]),f.useEffect(()=>()=>{Jt()},[]),f.useEffect(()=>{let a=!1,i=null;return!n.isDesktop||!n.bridge.supported?()=>{a=!0}:(W(()=>import("./event-DvH9tcej.js").then(o=>o.c),[]).then(async({listen:o})=>{const c=await o(Bi,l=>{const d=l.payload,m=d==null?void 0:d.descriptor;m!=null&&m.windowId&&(n.windows.registerDescriptor(m),d.isOpen?n.windows.markWindowOpen(m.windowId):n.windows.markWindowClosed(m.windowId))});if(a){c();return}i=c}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),f.useEffect(()=>{let a=!1,i=null;async function o(){var l,d;const c=await n.bridge.getRuntimeInfo();a||Xi(c.ok?(d=(l=c.value)==null?void 0:l.windowChrome)==null?void 0:d.macosTitlebar:null)}return!n.isDesktop||n.ui.osFamily!=="macos"||!n.ui.prefersOverlayTitlebar?(Jt(),()=>{a=!0}):(o(),W(()=>import("./window-BVUB8gMK.js").then(c=>c.w),__vite__mapDeps([0,1])).then(async({getCurrentWindow:c})=>{const l=await c().onScaleChanged(()=>{o()});if(a){l();return}i=l}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),p.jsx(dn.Provider,{value:n,children:e})}function gt(){return f.useContext(dn)??Pe()}const ns=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function as(e){return ce(e.labelKey)}function eo(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function fn(e,t){return t?eo():e}function to(){const{theme:e,autoTheme:t}=zn.getState().profile;return fn(e,t)}function ro(e){Xt({theme:e,autoTheme:!1}).catch(()=>{})}function no(e){Xt({autoTheme:e}).catch(()=>{})}function hn(e){typeof window>"u"||document.documentElement.setAttribute("data-theme",e)}function ao(){const e=Qe(n=>n.profile.theme),t=Qe(n=>n.profile.autoTheme);return{theme:fn(e,t),selectedTheme:e,autoTheme:t,setTheme:ro,setAutoTheme:no}}function io(){hn(to())}function oo({children:e}){const t=Qe(n=>n.profile.theme),r=Qe(n=>n.profile.autoTheme);return f.useEffect(()=>{io()},[t,r]),f.useEffect(()=>{if(!r||typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{hn(n.matches?"dark":"light")};return a(),typeof n.addEventListener=="function"?(n.addEventListener("change",a),()=>n.removeEventListener("change",a)):(n.addListener(a),()=>n.removeListener(a))},[r]),p.jsx(p.Fragment,{children:e})}const so={showToast:()=>"",dismissToast:()=>{}},pn=f.createContext(so);function lo(){return`toast-${Math.random().toString(36).slice(2,10)}`}function co({toast:e,onDismiss:t}){const{id:r,title:n,description:a,tone:i,durationMs:o,action:c}=e;return f.useEffect(()=>{if(o===null)return;const l=window.setTimeout(()=>{t(r)},o);return()=>{window.clearTimeout(l)}},[o,r,t,n,a,i]),p.jsxs("article",{className:"toast-card","data-tone":i,role:i==="error"?"alert":"status",children:[p.jsxs("div",{className:"toast-body",children:[p.jsx("strong",{className:"toast-title",children:n}),a?p.jsx("p",{className:"toast-description",children:a}):null]}),p.jsxs("div",{className:"toast-actions",children:[c?p.jsx("button",{className:"toast-action",type:"button",onClick:()=>{c.onClick(),t(r)},children:c.label}):null,p.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(r),children:"×"})]})]})}function uo({children:e}){const[t,r]=f.useState([]),n=f.useCallback(o=>{r(c=>c.filter(l=>l.id!==o))},[]),a=f.useCallback(o=>{const c=o.id??lo(),l={id:c,title:o.title,description:o.description,tone:o.tone??"info",durationMs:o.durationMs===void 0?4200:o.durationMs,action:o.action};return r(d=>{const m=d.findIndex(w=>w.id===c);if(m===-1)return[...d,l];const g=[...d];return g[m]=l,g}),c},[]),i=f.useMemo(()=>({showToast:a,dismissToast:n}),[n,a]);return p.jsxs(pn.Provider,{value:i,children:[e,p.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(o=>p.jsx(co,{toast:o,onDismiss:n},o.id))})]})}function is(){return f.useContext(pn)}const Ct="0.9.8",mn=f.createContext(Ct);function fo({children:e}){const t=gt(),[r,n]=f.useState(Ct);return f.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(i=>{var c,l;if(a)return;const o=i.ok?(l=(c=i.value)==null?void 0:c.version)==null?void 0:l.trim():"";n(o||Ct)}),()=>{a=!0}):(n(Ct),()=>{a=!0})},[t]),p.jsx(mn.Provider,{value:r,children:e})}function ho(){return f.useContext(mn)}const Hr={latestState:null,lastNotifiedVersion:null,pendingRestartVersion:null};class po{constructor(){Re(this,"state",Hr);Re(this,"listeners",new Set);Re(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Re(this,"getState",()=>this.state)}recordState(t){const r=Ht(this.state.pendingRestartVersion),n=Ht(t.currentVersion);this.state={latestState:t,lastNotifiedVersion:t.hasUpdate?this.state.lastNotifiedVersion:null,pendingRestartVersion:r&&r===n?null:this.state.pendingRestartVersion},this.emit()}markVersionNotified(t){this.state.lastNotifiedVersion!==t&&(this.state={...this.state,lastNotifiedVersion:t},this.emit())}markRestartPending(t){const r=Ht(t);!r||this.state.pendingRestartVersion===r||(this.state={...this.state,pendingRestartVersion:r},this.emit())}reset(){this.state=Hr,this.emit()}emit(){for(const t of this.listeners)t()}}const Ze=new po;function Ht(e){const t=e==null?void 0:e.trim();return t||null}function mo(e){return f.useSyncExternalStore(Ze.subscribe,()=>e(Ze.getState()))}function go(){return Ze.getState()}function vo(e){Ze.recordState(e)}function yo(e){Ze.markVersionNotified(e)}function wo(e){Ze.markRestartPending(e)}async function bo(){const e=Pe(),t=he.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function xo(e={}){const t=e.notify??"never",r=await bo();return vo(r),await So(r,t),r}async function Eo(){const e=Pe(),t=he.getState();return e.bridge.downloadUpdate(t.releaseChannel)}async function os(){const e=Pe(),t=he.getState();return e.bridge.installUpdate(t.releaseChannel)}function ss(e){wo(e)}async function ls(){var e;if(typeof window>"u"||typeof((e=window.__TAURI_INTERNALS__)==null?void 0:e.invoke)!="function")throw new Error("当前运行环境不支持桌面应用重启。");try{await window.__TAURI_INTERNALS__.invoke("restart_application")}catch(t){throw new Error(t instanceof Error?t.message:"重启应用失败。")}}async function So(e,t){var i,o,c;if(!e.hasUpdate||t==="never")return;const r=((o=(i=e.manifest)==null?void 0:i.version)==null?void 0:o.trim())||e.currentVersion.trim();if(!r)return;const n=go().lastNotifiedVersion;if(t==="always"||n!==r)try{(await Pe().bridge.showNotification(ce("settings.releaseUpdateReady"),((c=e.manifest)==null?void 0:c.version)??e.currentVersion)).ok&&yo(r)}catch{}}async function Ro(){const e=he.getState();return Qt.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}async function cs(e){const t=he.getState();return Qt.request("/api/client/service-update/install",{method:"POST",body:JSON.stringify({packageName:e,channel:t.releaseChannel})})}async function us(e){return Qt.request(`/api/client/service-update/tasks/${encodeURIComponent(e)}`)}const Po=3600*1e3;function _o(){const e=He(i=>i.platform),t=He(i=>i.autoCheckUpdate),r=He(i=>i.autoDownloadUpdate),n=He(i=>i.releaseChannel),a=mo(i=>i.pendingRestartVersion);return f.useEffect(()=>{if(e!=="desktop"||!t||a)return;async function i(){await Promise.all([To(),Co(r)])}i();const o=window.setInterval(()=>{i()},Po);return()=>{window.clearInterval(o)}},[t,r,a,e,n]),null}async function To(){try{const t=(await Ro()).packages.find(n=>n.hasUpdate&&!n.restartRequired);if(!t)return;await Pe().bridge.showNotification(ce("settings.serverUpdateReady"),`${ce("settings.serverTargetVersion")}: ${t.latestVersion??"-"}`)}catch{}}async function Co(e){try{const t=await xo({notify:e?"never":"if-new"});if(!e||!t.hasUpdate||!t.manifest)return;const r=await Eo();if(!r.ok)return;await Pe().bridge.showNotification(ce("settings.releaseDownloadedNotificationTitle"),ce("settings.releaseDownloadedNotificationBody",{version:r.version??t.manifest.version}))}catch{}}const gn="codingns.server.base-url.history",sr=6,vn="__custom__";function yn(){return typeof window<"u"&&typeof window.localStorage<"u"}function wn(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function lr(e){if(!e)return null;try{return Kr(e)}catch{return null}}function bn(){if(!yn())return[];const e=window.localStorage.getItem(gn);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?lr(r):null).filter(r=>!!r):[]}catch{return[]}}function Do(e){const t=new Set,r=[];for(const n of e)!n||t.has(n)||(t.add(n),r.push(n));return r}function Lo(e){const t=new Set,r=[];for(const n of e)!n||t.has(n.value)||(t.add(n.value),r.push(n));return r}function No(e,t){const r=bn();return Do([e,...t,...r,lr(wn())]).slice(0,sr)}function jo(e){const t=Dt(e),r=bn().map(c=>({value:c,source:"history"})),n=lr(wn()),a=e.hosts.map(c=>({value:c.baseUrl,source:"saved"})),i=Wn(e).map(c=>({value:c.baseUrl,source:"discovered"})),o=t?{value:t.baseUrl,source:Yr(t)?"discovered":"saved"}:null;return Lo([o,...a,...i,...r,n?{value:n,source:"origin"}:null]).slice(0,sr)}function Io(e){yn()&&window.localStorage.setItem(gn,JSON.stringify(e.slice(0,sr)))}class Mo{constructor(){Re(this,"state",this.createState(he.getState()));Re(this,"listeners",new Set);Re(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Re(this,"getState",()=>this.state);he.subscribe(()=>{const t=this.createState(he.getState());t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((r,n)=>r===this.state.options[n])&&t.presetOptions.length===this.state.presetOptions.length&&t.presetOptions.every((r,n)=>{const a=this.state.presetOptions[n];return(a==null?void 0:a.value)===r.value&&(a==null?void 0:a.source)===r.source})||(this.state=t,this.emit())})}setBaseUrl(t){const r=he.getState(),n=Dt(r);if(!n)return!1;const a=Kr(t),i=a!==n.baseUrl,o=Oo(a,n);if(Yr(n))return he.updateRuntime({discoveredHosts:r.discoveredHosts.map(l=>l.id===n.id?{...l,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:l)}),this.state=this.createState(he.getState()),this.emit(),i;const c=r.hosts.map(l=>l.id===n.id?{...l,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:l);return this.state=this.createState({...r,hosts:c}),this.emit(),he.update({hosts:c}),i}reset(){this.state=this.createState(he.getState()),this.emit()}createState(t){const r=Dt(t),n=(r==null?void 0:r.baseUrl)??"",a=jo(t),i=No(n,a.map(o=>o.value));return Io(i),{baseUrl:n,options:i,presetOptions:a}}emit(){for(const t of this.listeners)t()}}const qt=new Mo;function Uo(e){return f.useSyncExternalStore(qt.subscribe,()=>e(qt.getState()))}function ds(e,t){return t.includes(e)?e:vn}function fs(){return vn}function Oo(e,t){const r=Hn(e);if(!r)return null;const n=t==null?void 0:t.relayTunnel,a=(n==null?void 0:n.provider)==="codingns_relay"&&n.tunnelDomain===r.tunnelDomain&&n.controlBaseUrl===r.controlBaseUrl,i=((n==null?void 0:n.candidateEndpoints)??[]).filter(o=>o.kind!=="relay");return{provider:"codingns_relay",enabled:!0,tunnelDomain:r.tunnelDomain,controlBaseUrl:r.controlBaseUrl,bindingId:a?(n==null?void 0:n.bindingId)??null:null,hostFingerprint:a?(n==null?void 0:n.hostFingerprint)??null:null,candidateEndpoints:[{endpointId:`relay-entry:${r.relayBaseUrl}`,kind:"relay",url:r.relayBaseUrl,priority:0,expiresAt:null,source:"user_saved"},...i]}}const ko={login(e,t){return Pt.login(e,t)},bootstrap(e,t,r){return Pt.bootstrap(e,t,r)},refresh(){return Pt.refresh()},logout(){Pt.clear()}},Ao=f.lazy(async()=>({default:(await W(()=>import("./ServerSettingsModal-BBft9KEC.js"),__vite__mapDeps([2,3,4,5,6,7]))).ServerSettingsModal})),Wr="width=device-width, initial-scale=1.0, viewport-fit=cover",Fo="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function Vo(){const e=f.useRef(null);return f.useEffect(()=>{const t=e.current;if(!t)return;const r=t.getContext("2d");if(!r)return;let n;const a=()=>{o(),c()};let i=[];const o=()=>{t.width=window.innerWidth,t.height=window.innerHeight},c=()=>{i=[];const d=Math.min(50,Math.floor(t.width*t.height/25e3));for(let m=0;m<d;m++)i.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},l=()=>{r.clearRect(0,0,t.width,t.height),i.forEach((d,m)=>{d.x+=d.vx,d.y+=d.vy,d.x<0&&(d.x=t.width),d.x>t.width&&(d.x=0),d.y<0&&(d.y=t.height),d.y>t.height&&(d.y=0),r.beginPath(),r.arc(d.x,d.y,d.size,0,Math.PI*2),r.fillStyle=`rgba(10, 132, 255, ${d.opacity})`,r.fill(),i.slice(m+1).forEach(g=>{const w=d.x-g.x,b=d.y-g.y,_=Math.sqrt(w*w+b*b);_<150&&(r.beginPath(),r.moveTo(d.x,d.y),r.lineTo(g.x,g.y),r.strokeStyle=`rgba(10, 132, 255, ${.1*(1-_/150)})`,r.stroke())})}),n=requestAnimationFrame(l)};return o(),c(),l(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(n)}},[]),p.jsx("canvas",{ref:e,className:"particle-canvas"})}function Bo({text:e}){return p.jsx("span",{className:"glitch-text","data-text":e,children:e})}function zo({text:e}){const[t,r]=f.useState(""),[n,a]=f.useState(!0);return f.useEffect(()=>{let i=0,o=null;const c=setInterval(()=>{i<=e.length?(r(e.slice(0,i)),i++):(clearInterval(c),o=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(c),o!==null&&window.clearTimeout(o)}},[e]),p.jsxs("span",{className:"typewriter-text",children:[t,n&&p.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function Ho(e){const t=e==null?void 0:e.captcha;if(typeof t!="object"||t===null)return null;const r=t.captchaId,n=t.imageDataUrl;return typeof r!="string"||typeof n!="string"?null:{captchaId:r,imageDataUrl:n}}function Wo(){const e=ir(),t=$n(),[r]=ki(),n=gt(),a=ho(),i=He(k=>Kn(k)),o=Yn(n.platform),c=f.useMemo(()=>Gn(n),[n]),l=f.useMemo(()=>c?Jn(i):{credentials:null,legacyServerBaseUrl:null},[i,c]),d=l.credentials,m=l.legacyServerBaseUrl,[g,w]=f.useState(()=>(d==null?void 0:d.username)??"admin"),[b,_]=f.useState(()=>(d==null?void 0:d.password)??""),[E,D]=f.useState(null),[F,L]=f.useState(""),[Y,ee]=f.useState(()=>!!d),K=Uo(k=>k.baseUrl),[me,v]=f.useState(K),[j,V]=f.useState(null),[M,ne]=f.useState(!1),[J,oe]=f.useState(!1),[ae,se]=f.useState(null),[Ke,Ye]=f.useState(!1),Z=Wt(k=>k.session),Te=f.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:Ce}=ao(),be=f.useRef(!1),ue=n.isNativeMobile,De=f.useMemo(()=>Ce==="light"?"light":"dark",[Ce]);f.useEffect(()=>{w((d==null?void 0:d.username)??"admin"),_((d==null?void 0:d.password)??""),D(null),L(""),ee(!!d)},[d]),f.useEffect(()=>{if(typeof document>"u")return;const k=document.querySelector('meta[name="viewport"]');if(!(k instanceof HTMLMetaElement))return;const fe=k.getAttribute("content")??Wr;return ue?k.setAttribute("content",Fo):k.setAttribute("content",Wr),()=>{k.setAttribute("content",fe)}},[ue]),f.useEffect(()=>{be.current||(be.current=!0,!(!c||!m||m===K)&&(qt.setBaseUrl(m),v(m)))},[K,c,m]),f.useEffect(()=>{if(Z){e(Te,{replace:!0});return}if(!me)return;let k=!1;const fe=window.setTimeout(()=>{W(async()=>{const{probeHost:H}=await import("./index-FOhyOpGY.js").then(ye=>ye.ad);return{probeHost:H}},__vite__mapDeps([3,4])).then(({probeHost:H})=>H(me)).then(H=>{k||(H.demoMode&&(Ye(!0),qn()&&V(t("auth.demoSessionExpired"))),H.reachable&&!H.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{k||V(t("auth.authUnavailable"))})},0);return()=>{k=!0,window.clearTimeout(fe)}},[Z,e,me,Te,t]);async function Oe(k){k.preventDefault(),ne(!0),V(null),v(K),c&&!Y&&i&&Xn(i);try{const fe=E?{username:g,password:b,captchaId:E.captchaId,captchaCode:F}:{username:g,password:b};await ko.login(fe,K),D(null),L("");const{userPreferenceStore:H}=await W(async()=>{const{userPreferenceStore:ye}=await import("./index-FOhyOpGY.js").then(yt=>yt.ac);return{userPreferenceStore:ye}},__vite__mapDeps([3,4]));await H.refreshForAuthenticatedUser(),c&&Y&&i&&Qn({hostId:i,username:g,password:b}),e(Te,{replace:!0})}catch(fe){if(fe instanceof Zn){if(fe.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}const H=Ho(fe.data);H?(D(H),L("")):fe.errorCode==="INVALID_CREDENTIALS"&&(D(null),L("")),V(fe.message)}else V(t("auth.authUnavailable"))}finally{ne(!1)}}function de(k){w(k),d!=null&&d.username&&k.trim()!==d.username&&(_(""),ee(!1)),E&&(D(null),L(""))}function xe(k){v(k),V(null)}const ve="login-username",ke="login-password",vt="login-captcha";return p.jsxs("main",{className:"cyber-login-page","data-theme":De,"data-native-mobile":ue?"true":"false",children:[p.jsxs("div",{className:"cyber-bg",children:[p.jsx("div",{className:"cyber-grid"}),p.jsx("div",{className:"cyber-glow cyber-glow-1"}),p.jsx("div",{className:"cyber-glow cyber-glow-2"}),p.jsx(Vo,{})]}),p.jsx("div",{className:"scanlines"}),p.jsxs("div",{className:"cyber-login-container",children:[p.jsx("div",{className:"cyber-login-toolbar",children:p.jsx(aa,{variant:"compact"})}),p.jsxs("div",{className:"cyber-login-content",children:[p.jsxs("div",{className:"cyber-brand",children:[p.jsx("div",{className:"cyber-logo",children:p.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),p.jsx("h1",{className:"cyber-brand-title",children:p.jsx(Bo,{text:"CodingNS"})}),p.jsx("p",{className:"cyber-brand-subtitle",children:p.jsx(zo,{text:t("auth.loginSubtitle")})})]}),p.jsxs("div",{className:"cyber-card",children:[p.jsx("div",{className:"cyber-corner corner-tl"}),p.jsx("div",{className:"cyber-corner corner-tr"}),p.jsx("div",{className:"cyber-corner corner-bl"}),p.jsx("div",{className:"cyber-corner corner-br"}),p.jsxs("div",{className:"cyber-card-header",children:[p.jsx("div",{className:"cyber-line"}),p.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),p.jsx("div",{className:"cyber-line"})]}),Ke?p.jsxs("div",{className:"cyber-demo-banner",children:[p.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),p.jsx("span",{children:t("auth.demoBanner")})]}):null,p.jsxs("form",{className:"cyber-form",onSubmit:Oe,children:[p.jsxs("div",{className:`cyber-field ${ae==="username"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:ve,children:[p.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),p.jsx("input",{id:ve,"aria-label":t("auth.username"),className:"cyber-input",value:g,onChange:k=>de(k.target.value),onFocus:()=>se("username"),onBlur:()=>se(null),autoComplete:"username"})]}),p.jsxs("div",{className:`cyber-field ${ae==="password"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:ke,children:[p.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),p.jsx("input",{id:ke,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:b,onChange:k=>_(k.target.value),onFocus:()=>se("password"),onBlur:()=>se(null),autoComplete:"current-password"})]}),E?p.jsxs("div",{className:"cyber-captcha-panel",children:[p.jsx("img",{alt:t("auth.captchaImageAlt"),className:"cyber-captcha-image",draggable:!1,src:E.imageDataUrl}),p.jsx("p",{className:"cyber-captcha-hint",children:t("auth.captchaHint")}),p.jsxs("div",{className:`cyber-field ${ae==="captcha"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:vt,children:[p.jsx("span",{className:"cyber-field-icon",children:"#"}),t("auth.captcha")]}),p.jsx("input",{id:vt,"aria-label":t("auth.captcha"),className:"cyber-input",placeholder:t("auth.captchaPlaceholder"),value:F,onChange:k=>L(k.target.value),onFocus:()=>se("captcha"),onBlur:()=>se(null),autoComplete:"one-time-code"})]})]}):null,c?p.jsxs("label",{className:"cyber-remember-toggle",children:[p.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:Y,onChange:k=>ee(k.target.checked)}),p.jsx("span",{children:t("auth.rememberPassword")})]}):null,j?p.jsxs("div",{className:"cyber-status","data-tone":"error",children:[p.jsx("span",{className:"cyber-status-icon",children:"⚠"}),p.jsx("span",{children:j})]}):null,p.jsxs("button",{className:`cyber-submit ${M?"loading":""}`,type:"submit",disabled:M,children:[p.jsx("span",{className:"cyber-submit-glow"}),p.jsx("span",{className:"cyber-submit-border"}),p.jsx("span",{className:"cyber-submit-text",children:M?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),o?p.jsxs("div",{className:"cyber-footer",children:[p.jsxs("div",{className:"cyber-divider",children:[p.jsx("span",{className:"cyber-divider-line"}),p.jsx("span",{className:"cyber-divider-text",children:"//"}),p.jsx("span",{className:"cyber-divider-line"})]}),p.jsxs("button",{className:"cyber-server-btn",onClick:()=>oe(!0),type:"button",children:[p.jsx("span",{className:"cyber-server-icon",children:"⚙"}),p.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),p.jsx("span",{className:"cyber-server-current",children:K})]})]}):null]})]}),p.jsxs("div",{className:"cyber-version",children:[p.jsxs("span",{className:"cyber-version-text",children:["v",a]}),p.jsx("span",{className:"cyber-version-divider",children:"|"}),p.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),o&&J?p.jsx(f.Suspense,{fallback:null,children:p.jsx(Ao,{isOpen:J,onClose:()=>oe(!1),onSave:xe})}):null]})}function xn(){return p.jsx("main",{className:"page-center app-shell",children:p.jsxs("section",{className:"auth-card surface-card",children:[p.jsx("h1",{children:ce("auth.trustedEntryOnlyTitle")}),p.jsx("p",{className:"status-text",children:ce("auth.trustedEntryOnlyDescription")}),p.jsxs("div",{className:"field-group",children:[p.jsx("span",{children:ce("auth.trustedEntryOnlyHintTitle")}),p.jsx("span",{className:"auth-server-value",children:ce("auth.trustedEntryOnlyHint")})]})]})})}function $o({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function Ko(){return!1}function En(e,t,r=Ko()){var i,o;if(!r||t!=="web")return!1;const n=Dt(e),a=n==null?void 0:n.relayTunnel;return!(a!=null&&a.enabled&&((i=a.tunnelDomain)!=null&&i.trim())&&((o=a.controlBaseUrl)!=null&&o.trim()))}function Yo({runtimeKey:e,children:t}){return p.jsx("div",{children:t},e)}function Go(){const e=ea();return p.jsx(Yo,{runtimeKey:e,children:p.jsx(bi,{})})}function Jo(){const e=He(i=>i),t=gt(),r=Wt(i=>i.session),n=Wt(i=>i.sessionReady),a=mt();if(En(e,t.platform))return p.jsx(xn,{});if(!r){const i=`${a.pathname}${a.search}`;return p.jsx(or,{to:`/login?returnTo=${encodeURIComponent(i)}`,replace:!0})}return n?p.jsx(Go,{}):p.jsx("div",{children:ce("common.loading")})}function qo(){const e=He(r=>r),t=gt();return En(e,t.platform)?p.jsx(xn,{}):p.jsx(Wo,{})}function $r(){const e=gt(),t=$o(e);return p.jsx(or,{to:t==="mobile"?"/workspaces":"/landing",replace:!0})}function q(e,t){return async()=>({Component:(await e())[t]})}const Xo=[{path:"/bootstrap",lazy:q(()=>W(()=>import("./BootstrapPage-B-yMdfpQ.js"),__vite__mapDeps([8,3,4])),"BootstrapPage")},{path:"/login",element:p.jsx(qo,{})},{path:"/connect/:tunnelDomain",lazy:q(()=>W(()=>import("./RelayConnectEntryPage-sRJlstx9.js"),__vite__mapDeps([9,3,4,5])),"RelayConnectEntryPage")},{path:"/desktop-window-preview",lazy:q(()=>W(()=>import("./DesktopDetachPreviewPage-D1DMaGcy.js"),__vite__mapDeps([10,3,4])),"DesktopDetachPreviewPage")},{path:"/",element:p.jsx(Jo,{}),children:[{path:"desktop-window/:windowId",lazy:q(()=>W(()=>import("./DesktopWindowPage-2SWAi0xz.js"),__vite__mapDeps([11,3,4,12,13,0,1,14,7,6,5,15,16,17,18,19,20,21,22,23,24,25])),"DesktopWindowPage")},{lazy:q(()=>W(()=>import("./WorkbenchShellRoute-BGfRqBUa.js"),__vite__mapDeps([26,3,4,12,13,0,1,14,7,6,5,15,16,27])),"WorkbenchShellRoute"),children:[{index:!0,element:p.jsx($r,{})},{path:"landing",lazy:q(()=>W(()=>import("./WorkbenchLandingPage-BaU_dXls.js"),__vite__mapDeps([28,3,4,12,13,0,1,14,7,6,5,15,16])),"WorkbenchLandingPage")},{path:"affairs",lazy:q(()=>W(()=>import("./ConversationPage-DRQ5Sg_d.js"),__vite__mapDeps([29,3,4,7,13,12,0,1,14,6,5,15,16,17,18,19,20,21,22,23,24,25,30,31])),"ConversationPage")},{path:"workspaces",lazy:q(()=>W(()=>import("./WorkspaceHomePage-DQVJ042Z.js"),__vite__mapDeps([32,3,4,12,13,0,1,14,7,6,5,15,16,33,23,24,34])),"WorkspaceHomePage")},{path:"workspaces/:workspaceId",lazy:q(()=>W(()=>import("./WorkspaceDetailPage-Dx6JX4jx.js"),__vite__mapDeps([35,3,4,12,13,0,1,14,7,6,5,15,16,36,20,23,24,34])),"WorkspaceDetailPage")},{path:"workspaces/:workspaceId/debug",lazy:q(()=>W(()=>import("./WorkspaceDebugDetailPage-BX0zVSsI.js"),__vite__mapDeps([37,3,4,36,12,13,0,1,14,7,6,5,15,16,20])),"WorkspaceDebugDetailPage")},{path:"workspaces/:workspaceId/affairs",element:p.jsx(or,{to:"/affairs",replace:!0})},{path:"workspaces/:workspaceId/sessions",lazy:q(()=>W(()=>import("./SessionIndexPage-CN7cEdl9.js"),__vite__mapDeps([38,3,4,12,13,0,1,14,7,6,5,15,16,23,24,34,30,31])),"SessionIndexPage")},{path:"workspaces/:workspaceId/sessions/:sessionId",lazy:q(()=>W(()=>import("./ConversationPage-DRQ5Sg_d.js"),__vite__mapDeps([29,3,4,7,13,12,0,1,14,6,5,15,16,17,18,19,20,21,22,23,24,25,30,31])),"ConversationPage")},{path:"workspaces/:workspaceId/tools",lazy:q(()=>W(()=>import("./ToolsHomePage-D1n4FU1s.js"),__vite__mapDeps([39,3,4,12,13,0,1,14,7,6,5,15,16])),"ToolsHomePage")},{path:"workspaces/:workspaceId/tools/files",lazy:q(()=>W(()=>import("./ToolFilesPage-QzsZyr0F.js"),__vite__mapDeps([40,3,4,12,13,0,1,14,7,6,5,15,16])),"ToolFilesPage")},{path:"workspaces/:workspaceId/tools/git",lazy:q(()=>W(()=>import("./ToolGitPage-CXg4ncuT.js"),__vite__mapDeps([41,3,4,12,13,0,1,14,7,6,5,15,16])),"ToolGitPage")},{path:"workspaces/:workspaceId/tools/processes",lazy:q(()=>W(()=>import("./ToolProcessesPage-BPsOsg4w.js"),__vite__mapDeps([42,3,4,12,13,0,1,14,7,6,5,15,16])),"ToolProcessesPage")},{path:"workspaces/:workspaceId/terminals",lazy:q(()=>W(()=>import("./TerminalPage-CUXXQYU2.js"),__vite__mapDeps([22,3,4,15,12,13,0,1,14,7,6,5,16,23,24,20,21,25])),"TerminalPage")},{path:"workspaces/:workspaceId/plugins",lazy:q(()=>W(()=>import("./PluginsListPage-Cte3vBgR.js"),__vite__mapDeps([43,3,4,13,44])),"PluginsListPage")},{path:"workspaces/:workspaceId/plugins/:pluginId",lazy:q(()=>W(()=>import("./PluginDetailPage-CWAHYyyG.js"),__vite__mapDeps([45,3,4,13,44,46,47])),"PluginDetailPage")},{path:"workspaces/:workspaceId/plugins/:pluginId/run",lazy:q(()=>W(()=>import("./PluginContainerPage-D-ly3i3H.js"),__vite__mapDeps([48,3,4,13,44,7,15,47])),"PluginContainerPage")},{path:"workspaces/:workspaceId/butler",lazy:q(()=>W(()=>import("./AdaptiveButlerPage-D-gXre7Y.js"),__vite__mapDeps([49,3,4,12,13,0,1,14,7,6,5,15,16,33,23,24])),"AdaptiveButlerPage")},{path:"settings",lazy:q(()=>W(()=>import("./SettingsPage-BGT-YqG2.js"),__vite__mapDeps([50,3,4,12,13,0,1,14,7,6,5,15,16,44,46,47,24])),"SettingsPage")},{path:"settings/:section",lazy:q(()=>W(()=>import("./SettingsPage-BGT-YqG2.js"),__vite__mapDeps([50,3,4,12,13,0,1,14,7,6,5,15,16,44,46,47,24])),"SettingsPage")},{path:"*",element:p.jsx($r,{})}]}]}];function Qo(){return Pi(Xo)}function Zo(){const e=Qe(r=>r.profile.language),t=f.useMemo(()=>Qo(),[]);return p.jsx(Zi,{children:p.jsx(fo,{children:p.jsx(ta,{language:e,children:p.jsx(oo,{children:p.jsxs(uo,{children:[p.jsx(_o,{}),p.jsx(Mi,{router:t})]})})})})})}const hs=Object.freeze(Object.defineProperty({__proto__:null,App:Zo},Symbol.toStringTag,{value:"Module"}));export{ar as A,ds as B,fs as C,qt as D,hs as E,aa as L,or as N,bi as O,Zi as P,oo as T,Uo as a,ko as b,rs as c,ki as d,gt as e,is as f,Gr as g,mt as h,Fi as i,mo as j,xo as k,os as l,ss as m,Eo as n,ls as o,Ro as p,cs as q,$o as r,us as s,ho as t,ir as u,ao as v,ns as w,as as x,Sr as y,ht as z};