nextclaw 0.21.7 → 0.21.8

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 (78) hide show
  1. package/package.json +16 -16
  2. package/ui-dist/assets/{api-D0hARyyl.js → api-B50yVdT8.js} +7 -7
  3. package/ui-dist/assets/app-presenter-provider-BI-ewLbO.js +3 -0
  4. package/ui-dist/assets/arrow-left-BOCJyLbQ.js +1 -0
  5. package/ui-dist/assets/{book-open-DmeQPqkd.js → book-open-Bd2Xbrrc.js} +1 -1
  6. package/ui-dist/assets/channels-list-page-moJkpxtU.js +8 -0
  7. package/ui-dist/assets/chat-page-CO27cl4v.js +105 -0
  8. package/ui-dist/assets/config-split-page-CsQ2rIdq.js +1 -0
  9. package/ui-dist/assets/{confirm-dialog-CTcaBp-8.js → confirm-dialog-DRSelLdI.js} +2 -2
  10. package/ui-dist/assets/desktop-update-config-qa-SynOc.js +1 -0
  11. package/ui-dist/assets/{dist-Di6EHp2x.js → dist-D19wiQwB.js} +1 -1
  12. package/ui-dist/assets/{dist-C59BKqbX.js → dist-NZRV-BxD.js} +1 -1
  13. package/ui-dist/assets/doc-browser-2ddUJCA0.js +1 -0
  14. package/ui-dist/assets/doc-browser-BjHUczQb.js +1 -0
  15. package/ui-dist/assets/doc-browser-context-C8KPbj-p.js +1 -0
  16. package/ui-dist/assets/{ellipsis-hXUNwi63.js → ellipsis-BYy8TP0A.js} +1 -1
  17. package/ui-dist/assets/{es2015-CJlVSTh-.js → es2015-BUIIKCNh.js} +1 -1
  18. package/ui-dist/assets/{external-link-J0fCK-vu.js → external-link-528k6MDD.js} +1 -1
  19. package/ui-dist/assets/index-CMNrRhnG.js +101 -0
  20. package/ui-dist/assets/index-UTmTW1eU.css +1 -0
  21. package/ui-dist/assets/{key-round-BzYZ0Nno.js → key-round-D3vD9dj7.js} +1 -1
  22. package/ui-dist/assets/loader-circle-DV9TSRns.js +1 -0
  23. package/ui-dist/assets/mcp-marketplace-page-CS5Lh3oA.js +1 -0
  24. package/ui-dist/assets/mcp-marketplace-page-DEOMcWb0.js +40 -0
  25. package/ui-dist/assets/model-config-page-BSc4o7pb.js +1 -0
  26. package/ui-dist/assets/{notice-card-CD9Ok62G.js → notice-card-qqlbsOoR.js} +1 -1
  27. package/ui-dist/assets/plus-Bf9qhPDO.js +1 -0
  28. package/ui-dist/assets/{popover-CoBu3mbV.js → popover-BnmPOXe3.js} +1 -1
  29. package/ui-dist/assets/provider-scoped-model-input-Ca56s475.js +1 -0
  30. package/ui-dist/assets/providers-config-page-D8Kf4U3u.js +1 -0
  31. package/ui-dist/assets/{react-C7HsxuKH.js → react-Dsotw5vM.js} +1 -1
  32. package/ui-dist/assets/{refresh-cw-CVo4nWpq.js → refresh-cw-Bmx4wc9P.js} +1 -1
  33. package/ui-dist/assets/remote-DNMEy_c4.js +1 -0
  34. package/ui-dist/assets/rotate-cw-CL0sVBel.js +1 -0
  35. package/ui-dist/assets/runtime-config-page-CUFtKr0U.js +1 -0
  36. package/ui-dist/assets/{save-Z1QTovIt.js → save-CHDnDTok.js} +1 -1
  37. package/ui-dist/assets/search-D7L-TCH-.js +1 -0
  38. package/ui-dist/assets/search-config-page-CA3RVAef.js +1 -0
  39. package/ui-dist/assets/secrets-config-page-95yaH1fa.js +3 -0
  40. package/ui-dist/assets/{status-dot-C1-FKgvv.js → status-dot-Dm4h-bjn.js} +1 -1
  41. package/ui-dist/assets/tabs-CJvw5Lqp.js +1 -0
  42. package/ui-dist/assets/{tag-chip-3kpiMTST.js → tag-chip-Cr8GwpRE.js} +1 -1
  43. package/ui-dist/assets/{tooltip-Bw-mXQAM.js → tooltip-Bxzi6aDL.js} +1 -1
  44. package/ui-dist/assets/{trash-2-CmIwAJIT.js → trash-2-CSfX-BvU.js} +1 -1
  45. package/ui-dist/assets/use-config-TzwzTgg0.js +1 -0
  46. package/ui-dist/assets/x-fkIWvi07.js +1 -0
  47. package/ui-dist/index.html +27 -27
  48. package/ui-dist/assets/app-presenter-provider-C7EsUuEJ.js +0 -3
  49. package/ui-dist/assets/arrow-left-CzSkR5L6.js +0 -1
  50. package/ui-dist/assets/channels-list-page-B0yiiH01.js +0 -8
  51. package/ui-dist/assets/chat-page-ChPjx_X9.js +0 -105
  52. package/ui-dist/assets/config-split-page-BzfZSyAr.js +0 -1
  53. package/ui-dist/assets/desktop-update-config-CExpdkqD.js +0 -1
  54. package/ui-dist/assets/doc-browser-EZbnEcdk.js +0 -1
  55. package/ui-dist/assets/doc-browser-XIwe1Tg-.js +0 -1
  56. package/ui-dist/assets/doc-browser-context-BzEA1lm1.js +0 -1
  57. package/ui-dist/assets/index-DfZTO6Pi.js +0 -101
  58. package/ui-dist/assets/index-mIb_YMrc.css +0 -1
  59. package/ui-dist/assets/loader-circle-BbdIlBbQ.js +0 -1
  60. package/ui-dist/assets/mcp-marketplace-page-L22aCzHX.js +0 -40
  61. package/ui-dist/assets/mcp-marketplace-page-f80Jmv37.js +0 -1
  62. package/ui-dist/assets/model-config-DkD7vSQT.js +0 -1
  63. package/ui-dist/assets/play-DHuSeKs8.js +0 -1
  64. package/ui-dist/assets/plus-DrV685KC.js +0 -1
  65. package/ui-dist/assets/provider-models-C9VRroK3.js +0 -1
  66. package/ui-dist/assets/provider-scoped-model-input-DZlmTCJU.js +0 -1
  67. package/ui-dist/assets/providers-list-CVkWiqIy.js +0 -1
  68. package/ui-dist/assets/remote-Bznw9iji.js +0 -1
  69. package/ui-dist/assets/rotate-cw-CXDpRO6D.js +0 -1
  70. package/ui-dist/assets/runtime-config-page-5IycbIxs.js +0 -1
  71. package/ui-dist/assets/search-8nY6PGm0.js +0 -1
  72. package/ui-dist/assets/search-config-DEH80WkC.js +0 -1
  73. package/ui-dist/assets/secrets-config-Gzo5nDJG.js +0 -3
  74. package/ui-dist/assets/tabs-BqkKwx1R.js +0 -1
  75. package/ui-dist/assets/tabs-custom-DOkaJZmt.js +0 -1
  76. package/ui-dist/assets/x-CSRTOZnM.js +0 -1
  77. /package/ui-dist/assets/{config-hints-fGnUjDe9.js → config-hints-Cl2XAhzV.js} +0 -0
  78. /package/ui-dist/assets/{host-capabilities-DjiRQ0Q9.js → host-capabilities-9bB_998Z.js} +0 -0
@@ -1 +1 @@
1
- import{c as e}from"./dist-C59BKqbX.js";var t=e(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
1
+ import{c as e}from"./dist-NZRV-BxD.js";var t=e(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./app-presenter-provider-BI-ewLbO.js";export{e as RemoteAccessPage};
@@ -0,0 +1 @@
1
+ import{c as e}from"./dist-NZRV-BxD.js";var t=e(`RotateCw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{h as e,p as t,r as n,u as r,v as i}from"./react-Dsotw5vM.js";import{At as a,It as o,Lt as s,Mt as c,Nt as l,Ot as u,Pt as d,Rt as f,St as p,Vt as m,_t as h,jt as g,kt as _,mt as v,xt as y,yt as b}from"./api-B50yVdT8.js";import{t as x}from"./loader-circle-DV9TSRns.js";import{t as S}from"./plus-Bf9qhPDO.js";import{t as ee}from"./rotate-cw-CL0sVBel.js";import{t as C}from"./save-CHDnDTok.js";import{t as w}from"./trash-2-CSfX-BvU.js";import{t as T}from"./notice-card-qqlbsOoR.js";import{B as E,G as D,H as O,J as k,R as te,U as A,V as j,W as M,Z as ne,z as N}from"./index-CMNrRhnG.js";import{g as P,t as F}from"./use-config-TzwzTgg0.js";var I=i(e(),1),L=t(),R={healthy:`runtimeControlHealthy`,"starting-service":`runtimeControlStartingService`,"restarting-service":`runtimeControlRestartingService`,"stopping-service":`runtimeControlStoppingService`,"restarting-app":`runtimeControlRestartingApp`,recovering:`runtimeControlRecovering`,failed:`runtimeControlFailed`},z={running:`runtimeControlServiceRunning`,stopped:`runtimeControlServiceStopped`,starting:`runtimeControlServiceStarting`,stopping:`runtimeControlServiceStopping`,restarting:`runtimeControlServiceRestarting`},B={"desktop-embedded":`runtimeControlEnvironmentDesktop`,"managed-local-service":`runtimeControlEnvironmentManagedService`,"self-hosted-web":`runtimeControlEnvironmentSelfHosted`,"shared-web":`runtimeControlEnvironmentSharedWeb`};function V(e){return n(R[e]??`runtimeControlUnavailable`)}function H(e){return n(z[e]??`runtimeControlServiceUnknown`)}function U(e){return n(B[e.environment])}function W(e,t){return t===`start-service`?e?.canStartService:t===`stop-service`?e?.canStopService:e?.canRestartService}function G(e){return e?[{action:`start-service`,capability:e.canStartService,label:n(`runtimeControlStartService`),icon:`play`},{action:`restart-service`,capability:e.canRestartService,label:n(`runtimeControlRestartService`),icon:`rotate`},{action:`stop-service`,capability:e.canStopService,label:n(`runtimeControlStopService`),icon:`square`,variant:`destructive`},{action:`restart-app`,capability:e.canRestartApp,label:n(`runtimeControlRestartApp`),icon:`rotate`,variant:`secondary`}].filter(e=>e.capability.available||!!e.capability.reasonIfUnavailable):[]}function K(e){let{busy:t,icon:n}=e;return t?(0,L.jsx)(x,{className:`mr-2 h-4 w-4 animate-spin`}):n===`play`?(0,L.jsx)(ne,{className:`mr-2 h-4 w-4`}):n===`square`?(0,L.jsx)(k,{className:`mr-2 h-4 w-4`}):(0,L.jsx)(ee,{className:`mr-2 h-4 w-4`})}function q(){let{busy:e,busyAction:t,controlView:r,errorMessage:i,pendingRestart:o,visibleLifecycle:l,visibleMessage:d,visibleServiceState:f}=h(),v=G(r??void 0),b=async e=>{let t=W(r,e);if(!t?.available){m.error(p(t?.reasonIfUnavailable)??n(`runtimeControlLoadFailed`));return}if(!(e===`stop-service`&&t.requiresConfirmation&&!window.confirm(n(`runtimeControlStopServiceConfirm`))))try{let t=await y.runRuntimeControlAction(e);m.success(p(t.message)??t.message)}catch(e){let t=e instanceof Error?e.message:n(`runtimeControlActionFailed`);m.error(`${n(`runtimeControlActionFailed`)}: ${t}`)}},x=async()=>{if(!r?.canRestartApp.available){m.error(p(r?.canRestartApp.reasonIfUnavailable)??n(`runtimeRestartAppUnavailable`));return}if(window.confirm(n(`runtimeControlRestartAppConfirm`)))try{let e=await y.runRuntimeControlAction(`restart-app`);m.success(p(e.message)??e.message)}catch(e){let t=e instanceof Error?e.message:n(`runtimeControlActionFailed`);m.error(`${n(`runtimeControlActionFailed`)}: ${t}`)}};return(0,L.jsxs)(u,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(c,{children:n(`runtimeControlTitle`)}),(0,L.jsx)(a,{children:n(`runtimeControlDescription`)})]}),(0,L.jsxs)(_,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 bg-gray-50 p-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-center md:justify-between`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:H(f)}),(0,L.jsx)(`div`,{className:`text-xs text-gray-500`,children:r?U(r):n(`runtimeControlLoading`)})]}),(0,L.jsx)(`p`,{className:`text-sm text-gray-600`,children:d}),(0,L.jsx)(`div`,{className:`text-xs text-gray-500`,children:V(l)}),r?.managementHint?(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:p(r.managementHint)}):null,i&&!e?(0,L.jsx)(`p`,{className:`text-sm text-amber-700`,children:i}):null]}),o?(0,L.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-amber-200 bg-amber-50 p-4`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-amber-900`,children:n(`runtimeControlPendingRestartTitle`)}),(0,L.jsx)(`p`,{className:`text-sm text-amber-800`,children:n(`runtimeControlPendingRestartDescription`)}),o.changedPaths.length>0?(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-amber-700`,children:n(`runtimeControlPendingRestartPaths`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.changedPaths.map(e=>(0,L.jsx)(`span`,{className:`rounded-full border border-amber-200 bg-white px-2.5 py-1 text-xs text-amber-800`,children:e},e))})]}):null]}):null,(0,L.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:flex-wrap`,children:v.map(n=>(0,L.jsxs)(s,{type:`button`,variant:n.variant??`default`,onClick:()=>{if(n.action===`restart-app`){x();return}b(n.action)},disabled:!n.capability.available||e,children:[(0,L.jsx)(K,{icon:n.icon,busy:t===n.action}),n.label]},n.action))}),v.filter(e=>!e.capability.available&&e.capability.reasonIfUnavailable).map(e=>(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:p(e.capability.reasonIfUnavailable)},`${e.action}-reason`))]})]})}var J=f(`flex items-start justify-between gap-4 rounded-xl border p-4`,{variants:{tone:{default:`border-gray-200 bg-white`,muted:`border-gray-200 bg-gray-50`}},defaultVariants:{tone:`default`}}),Y=I.forwardRef(({className:e,tone:t,title:n,description:i,control:a,children:o,...s},c)=>(0,L.jsxs)(`div`,{ref:c,className:r(J({tone:t}),e),...s,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:n}),i?(0,L.jsx)(`p`,{className:`text-sm leading-6 text-gray-500`,children:i}):null,o]}),a?(0,L.jsx)(`div`,{className:`shrink-0`,children:a}):null]}));Y.displayName=`SettingRow`;function X(e){let{description:t,title:n}=e;return(0,L.jsx)(T,{tone:`neutral`,title:n,description:t})}function Z(e){let{children:t}=e;return(0,L.jsxs)(u,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(c,{children:n(`runtimePresenceTitle`)}),(0,L.jsx)(a,{children:n(`runtimePresenceDescription`)})]}),(0,L.jsx)(_,{children:t})]})}function re(){let e=b().runtimeControlView?.environment,t=D(e=>e.supported),r=D(e=>e.initialized),i=D(e=>e.busyAction),a=D(e=>e.snapshot);return(0,I.useEffect)(()=>{if(e===`desktop-embedded`){M.start();return}M.markUnsupported()},[e]),e===`desktop-embedded`?(0,L.jsx)(Z,{children:(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(T,{tone:`neutral`,title:n(`runtimePresenceBehaviorLabel`),description:a?.closeToBackground?n(`runtimePresenceBehaviorBackground`):n(`runtimePresenceBehaviorQuit`),className:`rounded-xl`}),!r||t&&!a?(0,L.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`runtimePresenceLoading`)}):null,a?(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsx)(Y,{title:n(`runtimePresenceCloseToBackground`),description:n(`runtimePresenceCloseToBackgroundHelp`),control:(0,L.jsx)(v,{id:`runtime-presence-close-background`,"aria-label":n(`runtimePresenceCloseToBackground`),checked:a.closeToBackground,disabled:i===`saving-preferences`,onCheckedChange:e=>{M.updatePreferences({closeToBackground:e})}})}),(0,L.jsx)(Y,{title:n(`runtimePresenceLaunchAtLogin`),description:a.supportsLaunchAtLogin?n(`runtimePresenceLaunchAtLoginHelp`):a.launchAtLoginReason??n(`runtimePresenceLaunchAtLoginUnavailable`),control:(0,L.jsx)(v,{id:`runtime-presence-launch-login`,"aria-label":n(`runtimePresenceLaunchAtLogin`),checked:a.launchAtLogin,disabled:!a.supportsLaunchAtLogin||i===`saving-preferences`,onCheckedChange:e=>{M.updatePreferences({launchAtLogin:e})}})})]}):null]})}):e===`managed-local-service`?(0,L.jsx)(Z,{children:(0,L.jsx)(X,{title:n(`runtimePresenceManagedLocalTitle`),description:n(`runtimePresenceManagedLocalDescription`)})}):e===`self-hosted-web`?(0,L.jsx)(Z,{children:(0,L.jsx)(X,{title:n(`runtimePresenceSelfHostedTitle`),description:n(`runtimePresenceSelfHostedDescription`)})}):e===`shared-web`?(0,L.jsx)(Z,{children:(0,L.jsx)(X,{title:n(`runtimePresenceSharedTitle`),description:n(`runtimePresenceSharedDescription`)})}):(0,L.jsx)(Z,{children:(0,L.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`runtimePresenceLoading`)})})}function ie(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(l,{title:n(`runtimePageTitle`),description:n(`runtimePageDescription`)}),(0,L.jsx)(q,{}),(0,L.jsx)(re,{}),(0,L.jsx)(te,{})]})}var Q={wireDialect:`acp`,processScope:`per-session`,command:``,args:[`acp`],env:{},cwd:``,startupTimeoutMs:8e3,probeTimeoutMs:3e3,requestTimeoutMs:12e4};function ae(){return{id:``,default:!1,workspace:``,model:``,runtime:``,contextTokens:void 0,maxToolIterations:void 0}}function oe(){return{agentId:``,match:{channel:``,accountId:``}}}function se(){return{id:``,enabled:!0,label:``,type:`narp-stdio`,config:Q,configText:JSON.stringify(Q,null,2)}}function ce(e){return{id:e.id??``,default:!!e.default,displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,workspace:e.workspace??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:e.contextTokens,maxToolIterations:e.maxToolIterations}}function le(e){return{agentId:e.agentId??``,match:{channel:e.match?.channel??``,accountId:e.match?.accountId??``,peer:e.match?.peer?{kind:e.match.peer.kind,id:e.match.peer.id}:void 0}}}function $(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:void 0}function ue(e){return{companionEnabled:e.companion?.enabled===!0,agents:(e.agents.list??[]).map(ce),bindings:(e.bindings??[]).map(le),runtimeEntries:Object.entries(e.agents.runtimes?.entries??{}).map(([e,t])=>({id:e,enabled:t.enabled!==!1,label:t.label??``,type:t.type,config:t.config??{},configText:JSON.stringify(t.config??{},null,2)})),dmScope:e.session?.dmScope??`per-channel-peer`,defaultContextTokens:e.agents.defaults.contextTokens??2e5,defaultEngine:e.agents.defaults.engine??`native`}}function de(e){let t={id:e.id.trim()};e.default&&(t.default=!0),e.displayName?.trim()&&(t.displayName=e.displayName.trim()),e.description?.trim()&&(t.description=e.description.trim()),e.avatar?.trim()&&(t.avatar=e.avatar.trim()),e.workspace?.trim()&&(t.workspace=e.workspace.trim()),e.model?.trim()&&(t.model=e.model.trim());let n=e.runtime?.trim()??e.engine?.trim();return n&&(t.engine=n),typeof e.contextTokens==`number`&&(t.contextTokens=Math.max(1e3,e.contextTokens)),typeof e.maxToolIterations==`number`&&(t.maxToolIterations=e.maxToolIterations),t}function fe(e){let t=e.agents.map((e,t)=>{if(!e.id.trim())throw Error(n(`agentIdRequiredError`).replace(`{index}`,String(t)));return de(e)}),r=t.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t);if(r.length>0)throw Error(`${n(`duplicateAgentId`)}: ${r[0]}`);let i=e.bindings.map((t,r)=>{let i=t.agentId.trim(),a=t.match.channel.trim(),o=t.match.accountId?.trim()??``,s=t.match.peer?.kind,c=t.match.peer?.id?.trim()??``;if(!i)throw Error(n(`bindingAgentIdRequired`).replace(`{index}`,String(r)));if(!e.knownAgentIds.has(i))throw Error(`${n(`bindingAgentIdNotFound`).replace(`{index}`,String(r))}: ${i}`);if(!a)throw Error(n(`bindingChannelRequired`).replace(`{index}`,String(r)));let l={agentId:i,match:{channel:a}};if(o&&(l.match.accountId=o),s){if(!c)throw Error(n(`bindingPeerIdRequired`).replace(`{index}`,String(r)));l.match.peer={kind:s,id:c}}return l}),a=e.runtimeEntries.reduce((e,t,r)=>{let i=t.id.trim(),a=t.type.trim();if(!i)throw Error(n(`runtimeEntryIdRequired`).replace(`{index}`,String(r)));if(!a)throw Error(n(`runtimeEntryTypeRequired`).replace(`{id}`,i));if(e[i])throw Error(`${n(`runtimeEntryDuplicate`)}: ${i}`);let o=t.configText.trim()?JSON.parse(t.configText):{};if(o&&(typeof o!=`object`||Array.isArray(o)))throw Error(n(`runtimeEntryConfigObjectRequired`).replace(`{id}`,i));return e[i]={enabled:t.enabled!==!1,...t.label?.trim()?{label:t.label.trim()}:{},type:a,config:o??{}},e},{});return{companion:{enabled:e.companionEnabled},agents:{defaults:{contextTokens:Math.max(1e3,e.defaultContextTokens),engine:e.defaultEngine.trim()||`native`},list:t,runtimes:{entries:a}},bindings:i,session:{dmScope:e.dmScope}}}function pe(e){return(0,L.jsxs)(u,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(c,{children:n(`agentList`)}),(0,L.jsx)(a,{children:n(`agentListHelp`)})]}),(0,L.jsxs)(_,{className:`space-y-3`,children:[e.agents.map((t,r)=>(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,L.jsx)(o,{value:t.id,onChange:t=>e.onUpdateAgent(r,{id:t.target.value}),placeholder:n(`agentIdPlaceholder`)}),(0,L.jsx)(o,{value:t.workspace??``,onChange:t=>e.onUpdateAgent(r,{workspace:t.target.value}),placeholder:n(`workspaceOverridePlaceholder`)}),(0,L.jsx)(o,{value:t.model??``,onChange:t=>e.onUpdateAgent(r,{model:t.target.value}),placeholder:n(`modelOverridePlaceholder`)}),(0,L.jsx)(o,{value:t.runtime??t.engine??``,onChange:t=>e.onUpdateAgent(r,{runtime:t.target.value}),placeholder:n(`engineOverridePlaceholder`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:[(0,L.jsx)(o,{type:`number`,min:1e3,step:1e3,value:t.contextTokens??``,onChange:t=>e.onUpdateAgent(r,{contextTokens:$(t.target.value)}),placeholder:n(`contextTokensPlaceholder`)}),(0,L.jsx)(o,{type:`number`,min:1,value:t.maxToolIterations??``,onChange:t=>e.onUpdateAgent(r,{maxToolIterations:$(t.target.value)}),placeholder:n(`maxToolsPlaceholder`)})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,L.jsx)(v,{checked:!!t.default,onCheckedChange:t=>e.onSetDefaultAgent(r,t)}),(0,L.jsx)(`span`,{children:n(`defaultAgent`)})]}),(0,L.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveAgent(r),children:[(0,L.jsx)(w,{className:`h-4 w-4 mr-1`}),n(`remove`)]})]})]},`${r}-${t.id}`)),(0,L.jsxs)(s,{type:`button`,variant:`outline`,onClick:e.onAddAgent,children:[(0,L.jsx)(S,{className:`h-4 w-4 mr-2`}),n(`addAgent`)]})]})]})}function me(e){return(0,L.jsxs)(u,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(c,{children:n(`bindings`)}),(0,L.jsx)(a,{children:n(`bindingsHelp`)})]}),(0,L.jsxs)(_,{className:`space-y-3`,children:[e.bindings.map((t,r)=>{let i=t.match.peer?.kind??``;return(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,L.jsx)(o,{value:t.agentId,onChange:n=>e.onUpdateBinding(r,{...t,agentId:n.target.value}),placeholder:n(`targetAgentIdPlaceholder`)}),(0,L.jsx)(o,{value:t.match.channel,onChange:n=>e.onUpdateBinding(r,{...t,match:{...t.match,channel:n.target.value}}),placeholder:n(`channelPlaceholder`)}),(0,L.jsx)(o,{value:t.match.accountId??``,onChange:n=>e.onUpdateBinding(r,{...t,match:{...t.match,accountId:n.target.value}}),placeholder:n(`accountIdOptionalPlaceholder`)}),(0,L.jsxs)(N,{value:i||`__none__`,onValueChange:n=>{let i=n===`__none__`?``:n;e.onUpdateBinding(r,i?{...t,match:{...t.match,peer:{kind:i,id:t.match.peer?.id??``}}}:{...t,match:{...t.match,peer:void 0}})},children:[(0,L.jsx)(O,{children:(0,L.jsx)(A,{})}),(0,L.jsxs)(E,{children:[(0,L.jsx)(j,{value:`__none__`,children:n(`peerKindOptional`)}),(0,L.jsx)(j,{value:`direct`,children:n(`peerKindDirect`)}),(0,L.jsx)(j,{value:`group`,children:n(`peerKindGroup`)}),(0,L.jsx)(j,{value:`channel`,children:n(`peerKindChannel`)})]})]}),(0,L.jsx)(o,{value:t.match.peer?.id??``,onChange:n=>e.onUpdateBinding(r,{...t,match:{...t.match,peer:i?{kind:i,id:n.target.value}:void 0}}),placeholder:n(`peerIdPlaceholder`)})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveBinding(r),children:[(0,L.jsx)(w,{className:`h-4 w-4 mr-1`}),n(`remove`)]})})]},`${r}-${t.agentId}`)}),(0,L.jsxs)(s,{type:`button`,variant:`outline`,onClick:e.onAddBinding,children:[(0,L.jsx)(S,{className:`h-4 w-4 mr-2`}),n(`addBinding`)]})]})]})}function he(e){return(0,L.jsxs)(u,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(c,{children:n(`runtimeEntries`)}),(0,L.jsx)(a,{children:n(`runtimeEntriesHelp`)})]}),(0,L.jsxs)(_,{className:`space-y-3`,children:[e.entries.map((t,r)=>(0,L.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,L.jsx)(o,{value:t.id,onChange:t=>e.onUpdateEntry(r,{id:t.target.value}),placeholder:n(`runtimeEntryIdPlaceholder`)}),(0,L.jsx)(o,{value:t.label??``,onChange:t=>e.onUpdateEntry(r,{label:t.target.value}),placeholder:n(`runtimeEntryLabelPlaceholder`)}),(0,L.jsx)(o,{value:t.type,onChange:t=>e.onUpdateEntry(r,{type:t.target.value}),placeholder:n(`runtimeEntryTypePlaceholder`)}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2`,children:[(0,L.jsx)(`span`,{className:`text-sm text-gray-700`,children:n(`enabled`)}),(0,L.jsx)(v,{checked:t.enabled!==!1,onCheckedChange:t=>e.onUpdateEntry(r,{enabled:t})})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:n(`runtimeEntryConfigJson`)}),(0,L.jsx)(`textarea`,{className:`min-h-32 w-full rounded-md border border-gray-200 px-3 py-2 text-sm font-mono`,value:t.configText,onChange:t=>e.onUpdateEntry(r,{configText:t.target.value}),spellCheck:!1})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(s,{type:`button`,variant:`outline`,onClick:()=>e.onRemoveEntry(r),children:[(0,L.jsx)(w,{className:`mr-2 h-4 w-4`}),n(`delete`)]})})]},`${r}-${t.id||`runtime-entry`}`)),(0,L.jsxs)(s,{type:`button`,variant:`outline`,onClick:e.onAddEntry,children:[(0,L.jsx)(S,{className:`mr-2 h-4 w-4`}),n(`addRuntimeEntry`)]})]})]})}var ge=[{value:`main`,labelKey:`dmScopeMain`},{value:`per-peer`,labelKey:`dmScopePerPeer`},{value:`per-channel-peer`,labelKey:`dmScopePerChannelPeer`},{value:`per-account-channel-peer`,labelKey:`dmScopePerAccountChannelPeer`}];function _e(e){return(0,L.jsxs)(u,{children:[(0,L.jsxs)(g,{children:[(0,L.jsx)(c,{children:n(`dmScope`)}),(0,L.jsx)(a,{children:n(`dmScopeHelp`)})]}),(0,L.jsxs)(_,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-md border border-gray-200 px-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:n(`runtimeCompanionEnabled`)}),(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:n(`runtimeCompanionEnabledHelp`)})]}),(0,L.jsx)(v,{checked:e.companionEnabled,onCheckedChange:e.onCompanionEnabledChange})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:n(`defaultContextTokens`)}),(0,L.jsx)(o,{type:`number`,min:1e3,step:1e3,value:e.defaultContextTokens,onChange:t=>e.onDefaultContextTokensChange(Math.max(1e3,Number.parseInt(t.target.value,10)||1e3))}),(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:n(`defaultContextTokensHelp`)})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:n(`defaultEngine`)}),(0,L.jsx)(o,{value:e.defaultEngine,onChange:t=>e.onDefaultEngineChange(t.target.value),placeholder:n(`defaultEnginePlaceholder`)}),(0,L.jsx)(`p`,{className:`text-xs text-gray-500`,children:n(`defaultEngineHelp`)})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:n(`dmScope`)}),(0,L.jsxs)(N,{value:e.dmScope,onValueChange:t=>e.onDmScopeChange(t),children:[(0,L.jsx)(O,{children:(0,L.jsx)(A,{})}),(0,L.jsx)(E,{children:ge.map(e=>(0,L.jsx)(j,{value:e.value,children:n(e.labelKey)},e.value))})]})]})]})]})}function ve(e){let t=(0,I.useMemo)(()=>ue(e.config),[e.config]),[r,i]=(0,I.useState)(t.agents),[a,o]=(0,I.useState)(t.bindings),[c,l]=(0,I.useState)(t.runtimeEntries),[u,f]=(0,I.useState)(t.dmScope),[p,h]=(0,I.useState)(t.companionEnabled),[g,_]=(0,I.useState)(t.defaultContextTokens),[v,y]=(0,I.useState)(t.defaultEngine),b=(0,I.useMemo)(()=>{let e=new Set([`main`]);return r.forEach(t=>{let n=t.id.trim();n&&e.add(n)}),e},[r]);return(0,L.jsxs)(d,{className:`space-y-6`,children:[(0,L.jsx)(ie,{}),(0,L.jsx)(_e,{companionEnabled:p,dmScope:u,defaultContextTokens:g,defaultEngine:v,onCompanionEnabledChange:h,onDmScopeChange:f,onDefaultContextTokensChange:_,onDefaultEngineChange:y}),(0,L.jsx)(he,{entries:c,onUpdateEntry:(e,t)=>l(n=>n.map((n,r)=>r===e?{...n,...t}:n)),onRemoveEntry:e=>l(t=>t.filter((t,n)=>n!==e)),onAddEntry:()=>l(e=>[...e,se()])}),(0,L.jsx)(pe,{agents:r,onUpdateAgent:(e,t)=>{i(n=>n.map((n,r)=>r===e?{...n,...t}:n))},onRemoveAgent:e=>i(t=>t.filter((t,n)=>n!==e)),onAddAgent:()=>i(e=>[...e,ae()]),onSetDefaultAgent:(e,t)=>i(n=>t?n.map((t,n)=>({...t,default:n===e})):n.map((t,n)=>n===e?{...t,default:!1}:t))}),(0,L.jsx)(me,{bindings:a,onUpdateBinding:(e,t)=>{o(n=>n.map((n,r)=>r===e?t:n))},onRemoveBinding:e=>o(t=>t.filter((t,n)=>n!==e)),onAddBinding:()=>o(e=>[...e,oe()])}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsxs)(s,{type:`button`,onClick:()=>{try{let t=fe({companionEnabled:p,agents:r,bindings:a,runtimeEntries:c,dmScope:u,defaultContextTokens:g,defaultEngine:v,knownAgentIds:b});e.updateRuntime.mutate({data:t})}catch(e){m.error(e instanceof Error?e.message:String(e))}},disabled:e.updateRuntime.isPending,children:[(0,L.jsx)(C,{className:`h-4 w-4 mr-2`}),e.updateRuntime.isPending?n(`saving`):n(`saveRuntimeSettings`)]})})]})}function ye(){let{data:e,isLoading:t}=F(),r=P();return t||!e?(0,L.jsx)(`div`,{className:`p-8 text-gray-400`,children:n(`runtimeLoading`)}):(0,L.jsx)(ve,{config:e,updateRuntime:r})}export{ye as RuntimeConfig};
@@ -1 +1 @@
1
- import{c as e}from"./dist-C59BKqbX.js";var t=e(`Save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]);export{t};
1
+ import{c as e}from"./dist-NZRV-BxD.js";var t=e(`Save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{c as e}from"./dist-NZRV-BxD.js";var t=e(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{h as e,p as t,r as n,v as r}from"./react-Dsotw5vM.js";import{Ft as i,It as a,Lt as o,Nt as s,Pt as c}from"./api-B50yVdT8.js";import{t as l}from"./external-link-528k6MDD.js";import{t as u}from"./key-round-D3vD9dj7.js";import{t as d}from"./search-D7L-TCH-.js";import{B as f,H as p,K as m,U as h,V as g,z as _}from"./index-CMNrRhnG.js";import{_ as v,n as y,t as b}from"./use-config-TzwzTgg0.js";import{a as x,c as S,i as C,n as w,o as T,s as E,t as D}from"./config-split-page-CsQ2rIdq.js";var O=r(e(),1),k=t(),A=[{value:`noLimit`,label:`searchFreshnessNoLimit`},{value:`oneDay`,label:`searchFreshnessOneDay`},{value:`oneWeek`,label:`searchFreshnessOneWeek`},{value:`oneMonth`,label:`searchFreshnessOneMonth`},{value:`oneYear`,label:`searchFreshnessOneYear`}],j=[{value:`basic`,label:`searchDepthBasic`},{value:`advanced`,label:`searchDepthAdvanced`}],M=[{value:`true`,label:`enabled`},{value:`false`,label:`disabled`}],N={bocha:`searchProviderBochaDescription`,tavily:`searchProviderTavilyDescription`,brave:`searchProviderBraveDescription`};function P(e){return{activeProvider:e.provider,enabledProviders:e.enabledProviders,maxResults:String(e.defaults.maxResults),providers:{bocha:{apiKey:``,baseUrl:e.providers.bocha.baseUrl,summary:!!e.providers.bocha.summary,freshness:e.providers.bocha.freshness??`noLimit`},tavily:{apiKey:``,baseUrl:e.providers.tavily.baseUrl,searchDepth:e.providers.tavily.searchDepth??`basic`,includeAnswer:!!e.providers.tavily.includeAnswer},brave:{apiKey:``,baseUrl:e.providers.brave.baseUrl}}}}function F(e){return{provider:e.activeProvider,enabledProviders:e.enabledProviders,defaults:{maxResults:Number(e.maxResults)||10},providers:{bocha:{apiKey:e.providers.bocha.apiKey||void 0,baseUrl:e.providers.bocha.baseUrl,summary:e.providers.bocha.summary,freshness:e.providers.bocha.freshness},tavily:{apiKey:e.providers.tavily.apiKey||void 0,baseUrl:e.providers.tavily.baseUrl,searchDepth:e.providers.tavily.searchDepth,includeAnswer:e.providers.tavily.includeAnswer},brave:{apiKey:e.providers.brave.apiKey||void 0,baseUrl:e.providers.brave.baseUrl}}}}function I(e){let{label:t,value:n,onChange:r,placeholder:o,type:s=`text`,inputMode:c}=e;return(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(i,{children:t}),(0,k.jsx)(a,{type:s,value:n,onChange:e=>r(e.target.value),placeholder:o,inputMode:c,className:`rounded-xl`})]})}function L(e){let{label:t,value:r,options:a,onChange:o}=e;return(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(i,{children:t}),(0,k.jsxs)(_,{value:r,onValueChange:o,children:[(0,k.jsx)(p,{className:`rounded-xl`,children:(0,k.jsx)(h,{})}),(0,k.jsx)(f,{children:a.map(e=>(0,k.jsx)(g,{value:e.value,children:n(e.label)},e.value))})]})]})}function R({docsUrl:e}){return e?(0,k.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:(0,k.jsxs)(o,{type:`button`,variant:`outline`,className:`rounded-xl`,children:[(0,k.jsx)(l,{className:`mr-2 h-4 w-4`}),n(`searchProviderOpenDocs`)]})}):null}function z(e){let{draft:t,provider:r,search:i,selectedDocsUrl:a,updateProviderDraft:o}=e;if(r===`bocha`){let{bocha:e}=t.providers;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(I,{label:n(`apiKey`),value:e.apiKey,onChange:e=>o(`bocha`,{apiKey:e}),placeholder:i.providers.bocha.apiKeyMasked||n(`enterApiKey`),type:`password`}),(0,k.jsx)(I,{label:n(`searchProviderBaseUrl`),value:e.baseUrl,onChange:e=>o(`bocha`,{baseUrl:e})}),(0,k.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,k.jsx)(L,{label:n(`searchProviderSummary`),value:e.summary?`true`:`false`,options:M,onChange:e=>o(`bocha`,{summary:e===`true`})}),(0,k.jsx)(L,{label:n(`searchProviderFreshness`),value:e.freshness,options:A,onChange:e=>o(`bocha`,{freshness:e})})]}),(0,k.jsx)(R,{docsUrl:a??`https://open.bocha.cn`})]})}if(r===`tavily`){let{tavily:e}=t.providers;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(I,{label:n(`apiKey`),value:e.apiKey,onChange:e=>o(`tavily`,{apiKey:e}),placeholder:i.providers.tavily.apiKeyMasked||n(`enterApiKey`),type:`password`}),(0,k.jsx)(I,{label:n(`searchProviderBaseUrl`),value:e.baseUrl,onChange:e=>o(`tavily`,{baseUrl:e})}),(0,k.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,k.jsx)(L,{label:n(`searchProviderSearchDepth`),value:e.searchDepth,options:j,onChange:e=>o(`tavily`,{searchDepth:e})}),(0,k.jsx)(L,{label:n(`searchProviderIncludeAnswer`),value:e.includeAnswer?`true`:`false`,options:M,onChange:e=>o(`tavily`,{includeAnswer:e===`true`})})]}),(0,k.jsx)(R,{docsUrl:a})]})}let{brave:s}=t.providers;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(I,{label:n(`apiKey`),value:s.apiKey,onChange:e=>o(`brave`,{apiKey:e}),placeholder:i.providers.brave.apiKeyMasked||n(`enterApiKey`),type:`password`}),(0,k.jsx)(I,{label:n(`searchProviderBaseUrl`),value:s.baseUrl,onChange:e=>o(`brave`,{baseUrl:e})})]})}function B(e){let{draft:t,providers:r,search:i,selectedProvider:a,onSelect:o}=e;return(0,k.jsxs)(x,{children:[(0,k.jsx)(S,{className:`px-4 py-4`,children:(0,k.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-gray-500`,children:n(`searchChannels`)})}),(0,k.jsx)(T,{className:`space-y-2 p-3`,children:r.map(e=>{let r=i.providers[e.name],s=t.enabledProviders.includes(e.name);return(0,k.jsx)(D,{onClick:()=>o(e.name),active:a===e.name,className:`p-3`,children:(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.displayName}),(0,k.jsx)(`p`,{className:`line-clamp-2 text-[11px] text-gray-500`,children:n(N[e.name])})]}),(0,k.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,k.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-medium text-gray-600`,children:r.apiKeySet?n(`searchStatusConfigured`):n(`searchStatusNeedsSetup`)}),s?(0,k.jsx)(`span`,{className:`rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700`,children:n(`searchProviderActivated`)}):null]})]})},e.name)})})]})}function V(e){let{initialDraft:t,providers:r,search:i,onSubmit:a,isPending:s}=e,{isMobile:c}=m(),[l,f]=(0,O.useState)(c?null:i.provider),[p,h]=(0,O.useState)(t),g=l&&r.some(e=>e.name===l)?l:c?null:i.provider,_=r.find(e=>e.name===g)??null,v=g?i.providers[g]:null,y=g?p.enabledProviders.includes(g):!1,b=v?.docsUrl??_?.docsUrl;return(0,k.jsxs)(C,{className:`xl:min-h-0`,mobileView:c?g?`detail`:`list`:void 0,onMobileBack:()=>f(null),mobileListLabel:n(`searchPageTitle`),children:[(0,k.jsx)(B,{draft:p,providers:r,search:i,selectedProvider:g??i.provider,onSelect:f}),_?(0,k.jsx)(x,{children:(0,k.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),a(p)},className:`flex min-h-0 flex-1 flex-col`,children:[(0,k.jsx)(S,{className:`px-6 py-5`,children:(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,k.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-primary text-white`,children:(0,k.jsx)(d,{className:`h-5 w-5`})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900`,children:_.displayName}),(0,k.jsx)(`p`,{className:`text-sm text-gray-500`,children:_.description})]})]}),(0,k.jsx)(o,{type:`button`,variant:y?`secondary`:`outline`,className:`rounded-xl`,onClick:()=>{let e=y?p.enabledProviders.filter(e=>e!==g):g?[...p.enabledProviders,g]:p.enabledProviders,t={...p,enabledProviders:e};h(t),a(t)},children:n(y?`searchProviderDeactivate`:`searchProviderActivate`)})]})}),(0,k.jsxs)(T,{className:`space-y-6 px-6 py-5`,children:[(0,k.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,k.jsx)(L,{label:n(`searchActiveProvider`),value:p.activeProvider,options:r.map(e=>({value:e.name,label:e.displayName})),onChange:e=>h({...p,activeProvider:e})}),(0,k.jsx)(I,{label:n(`searchDefaultMaxResults`),value:p.maxResults,onChange:e=>h({...p,maxResults:e}),inputMode:`numeric`})]}),(0,k.jsx)(z,{draft:p,provider:g,search:i,selectedDocsUrl:b,updateProviderDraft:(e,t)=>{h(n=>({...n,providers:{...n.providers,[e]:{...n.providers[e],...t}}}))}})]}),(0,k.jsx)(E,{className:`flex justify-end px-6 py-4`,children:(0,k.jsxs)(o,{type:`submit`,disabled:s,children:[(0,k.jsx)(u,{className:`mr-2 h-4 w-4`}),n(s?`saving`:`saveChanges`)]})})]})}):(0,k.jsx)(w,{children:(0,k.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`searchNoProviderSelected`)})})]})}function H(){let{data:e}=b(),{data:t}=y(),r=v(),i=t?.search??[],a=e?.search;return!a||i.length===0?(0,k.jsx)(`div`,{className:`p-8`,children:n(`loading`)}):(0,k.jsxs)(c,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,k.jsx)(s,{title:n(`searchPageTitle`),description:n(`searchPageDescription`)}),(0,k.jsx)(V,{initialDraft:P(a),providers:i,search:a,onSubmit:e=>r.mutate({data:F(e)}),isPending:r.isPending},JSON.stringify(a))]})}export{H as SearchConfigPage};
@@ -0,0 +1,3 @@
1
+ import{h as e,p as t,r as n,v as r}from"./react-Dsotw5vM.js";import{At as i,Ft as a,It as o,Lt as s,Mt as c,Nt as l,Ot as u,Pt as d,Vt as f,jt as p,kt as m,mt as h}from"./api-B50yVdT8.js";import{t as g}from"./plus-Bf9qhPDO.js";import{t as _}from"./save-CHDnDTok.js";import{t as v}from"./trash-2-CSfX-BvU.js";import{B as y,H as b,U as x,V as S,z as C}from"./index-CMNrRhnG.js";import{t as w,v as T}from"./use-config-TzwzTgg0.js";var E=r(e(),1),D=t(),O=[`env`,`file`,`exec`];function k(e=``){return{alias:e,source:`env`,prefix:``,path:``,command:``,argsText:``,cwd:``,timeoutMs:5e3}}function A(){return{path:``,source:`env`,provider:``,id:``}}function j(e,t){return t.source===`env`?{...k(e),source:`env`,prefix:t.prefix??``}:t.source===`file`?{...k(e),source:`file`,path:t.path}:{...k(e),source:`exec`,command:t.command,argsText:(t.args??[]).join(`
2
+ `),cwd:t.cwd??``,timeoutMs:t.timeoutMs??5e3}}function M(e){return e.source===`env`?{source:`env`,...e.prefix.trim()?{prefix:e.prefix.trim()}:{}}:e.source===`file`?{source:`file`,path:e.path.trim(),format:`json`}:{source:`exec`,command:e.command.trim(),args:e.argsText.split(`
3
+ `).map(e=>e.trim()).filter(Boolean),...e.cwd.trim()?{cwd:e.cwd.trim()}:{},timeoutMs:Math.max(1,Math.trunc(e.timeoutMs||5e3))}}function N(e){return e?{enabled:!!e.enabled,defaultEnv:e.defaults.env??``,defaultFile:e.defaults.file??``,defaultExec:e.defaults.exec??``,providers:Object.entries(e.providers).map(([e,t])=>j(e,t)),refs:Object.entries(e.refs).map(([e,t])=>({path:e,source:t.source,provider:t.provider??``,id:t.id}))}:{enabled:!0,defaultEnv:``,defaultFile:``,defaultExec:``,providers:[],refs:[]}}function P(e){return{enabled:e.enabled,defaults:{env:e.defaultEnv||null,file:e.defaultFile||null,exec:e.defaultExec||null},providers:Object.fromEntries(e.providers.map(e=>[e.alias.trim(),M(e)]).filter(([e])=>e)),refs:Object.fromEntries(e.refs.map(e=>[e.path.trim(),{source:e.source,...e.provider.trim()?{provider:e.provider.trim()}:{},id:e.id.trim()}]).filter(([e,t])=>e&&t.id))}}function F(e){let{defaultEnv:t,defaultFile:r,defaultExec:o,providerAliases:s,onChange:l}=e;return(0,D.jsxs)(u,{children:[(0,D.jsxs)(p,{children:[(0,D.jsx)(c,{children:n(`secrets`)}),(0,D.jsx)(i,{children:n(`secretsEnabledHelp`)})]}),(0,D.jsx)(m,{className:`space-y-4`,children:[{label:n(`defaultEnvProvider`),value:t,key:`defaultEnv`},{label:n(`defaultFileProvider`),value:r,key:`defaultFile`},{label:n(`defaultExecProvider`),value:o,key:`defaultExec`}].map(e=>(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(a,{children:e.label}),(0,D.jsxs)(C,{value:e.value||`__none__`,onValueChange:t=>l(e.key,t===`__none__`?``:t),children:[(0,D.jsx)(b,{children:(0,D.jsx)(x,{placeholder:n(`noneOption`)})}),(0,D.jsxs)(y,{children:[(0,D.jsx)(S,{value:`__none__`,children:n(`noneOption`)}),s.map(e=>(0,D.jsx)(S,{value:e,children:e},e))]})]})]},e.key))})]})}function I(e){let{providers:t,onUpdate:r,onRemove:a,onAdd:l}=e;return(0,D.jsxs)(u,{children:[(0,D.jsxs)(p,{children:[(0,D.jsx)(c,{children:n(`secretProvidersTitle`)}),(0,D.jsx)(i,{children:n(`secretProvidersDescription`)})]}),(0,D.jsxs)(m,{className:`space-y-3`,children:[t.map((e,t)=>(0,D.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 p-3`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-3`,children:[(0,D.jsx)(o,{value:e.alias,onChange:e=>r(t,{alias:e.target.value}),placeholder:n(`providerAlias`)}),(0,D.jsxs)(C,{value:e.source,onValueChange:e=>r(t,{source:e}),children:[(0,D.jsx)(b,{children:(0,D.jsx)(x,{})}),(0,D.jsx)(y,{children:O.map(e=>(0,D.jsx)(S,{value:e,children:e},e))})]}),(0,D.jsxs)(s,{type:`button`,variant:`outline`,onClick:()=>a(t),children:[(0,D.jsx)(v,{className:`mr-2 h-4 w-4`}),n(`removeProvider`)]})]}),e.source===`env`?(0,D.jsx)(o,{value:e.prefix,onChange:e=>r(t,{prefix:e.target.value}),placeholder:n(`envPrefix`)}):null,e.source===`file`?(0,D.jsx)(o,{value:e.path,onChange:e=>r(t,{path:e.target.value}),placeholder:n(`secretFilePath`)}):null,e.source===`exec`?(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(o,{value:e.command,onChange:e=>r(t,{command:e.target.value}),placeholder:n(`secretExecCommand`)}),(0,D.jsx)(`textarea`,{className:`min-h-[84px] w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`,value:e.argsText,onChange:e=>r(t,{argsText:e.target.value}),placeholder:n(`secretExecArgs`)}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 md:grid-cols-2`,children:[(0,D.jsx)(o,{value:e.cwd,onChange:e=>r(t,{cwd:e.target.value}),placeholder:n(`secretExecCwd`)}),(0,D.jsx)(o,{type:`number`,min:1,value:e.timeoutMs,onChange:e=>r(t,{timeoutMs:Number.parseInt(e.target.value,10)||5e3}),placeholder:n(`secretExecTimeoutMs`)})]})]}):null]},`provider-${t}`)),(0,D.jsxs)(s,{type:`button`,variant:`outline`,onClick:l,children:[(0,D.jsx)(g,{className:`mr-2 h-4 w-4`}),n(`addSecretProvider`)]})]})]})}function L(e){let{refs:t,providerAliases:r,onUpdate:a,onRemove:l,onAdd:d}=e;return(0,D.jsxs)(u,{children:[(0,D.jsxs)(p,{children:[(0,D.jsx)(c,{children:n(`secretRefsTitle`)}),(0,D.jsx)(i,{children:n(`secretRefsDescription`)})]}),(0,D.jsxs)(m,{className:`space-y-3`,children:[t.map((e,t)=>(0,D.jsx)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 p-3`,children:(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,D.jsx)(o,{value:e.path,onChange:e=>a(t,{path:e.target.value}),placeholder:n(`secretConfigPath`)}),(0,D.jsx)(o,{value:e.id,onChange:e=>a(t,{id:e.target.value}),placeholder:n(`secretId`)}),(0,D.jsxs)(C,{value:e.source,onValueChange:e=>a(t,{source:e}),children:[(0,D.jsx)(b,{children:(0,D.jsx)(x,{})}),(0,D.jsx)(y,{children:O.map(e=>(0,D.jsx)(S,{value:e,children:e},e))})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2`,children:[(0,D.jsxs)(C,{value:e.provider||`__none__`,onValueChange:e=>a(t,{provider:e===`__none__`?``:e}),children:[(0,D.jsx)(b,{children:(0,D.jsx)(x,{placeholder:n(`secretProviderAlias`)})}),(0,D.jsxs)(y,{children:[(0,D.jsx)(S,{value:`__none__`,children:n(`noneOption`)}),r.map(e=>(0,D.jsx)(S,{value:e,children:e},e))]})]}),(0,D.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>l(t),children:(0,D.jsx)(v,{className:`h-4 w-4`})})]})]})},`ref-${t}`)),(0,D.jsxs)(s,{type:`button`,variant:`outline`,onClick:d,children:[(0,D.jsx)(g,{className:`mr-2 h-4 w-4`}),n(`addSecretRef`)]})]})]})}function R(e){let{initialState:t,isPending:r,onSubmit:a}=e,[o,g]=(0,E.useState)(t),v=(0,E.useMemo)(()=>{let e=o.providers.map(e=>e.alias.trim()).filter(Boolean);return Array.from(new Set(e))},[o.providers]);return(0,D.jsxs)(d,{className:`space-y-6`,children:[(0,D.jsx)(l,{title:n(`secretsPageTitle`),description:n(`secretsPageDescription`)}),(0,D.jsxs)(u,{children:[(0,D.jsxs)(p,{children:[(0,D.jsx)(c,{children:n(`secrets`)}),(0,D.jsx)(i,{children:n(`secretsEnabledHelp`)})]}),(0,D.jsxs)(m,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-gray-200 p-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-gray-800`,children:n(`enabled`)}),(0,D.jsx)(`p`,{className:`text-xs text-gray-500`,children:n(`secretsEnabledHelp`)})]}),(0,D.jsx)(h,{checked:o.enabled,onCheckedChange:e=>g(t=>({...t,enabled:e}))})]}),(0,D.jsx)(F,{defaultEnv:o.defaultEnv,defaultFile:o.defaultFile,defaultExec:o.defaultExec,providerAliases:v,onChange:(e,t)=>g(n=>({...n,[e]:t}))})]})]}),(0,D.jsx)(I,{providers:o.providers,onUpdate:(e,t)=>{g(n=>({...n,providers:n.providers.map((n,r)=>r===e?{...n,...t}:n)}))},onRemove:e=>g(t=>({...t,providers:t.providers.filter((t,n)=>n!==e)})),onAdd:()=>g(e=>({...e,providers:[...e.providers,k()]}))}),(0,D.jsx)(L,{refs:o.refs,providerAliases:v,onUpdate:(e,t)=>{g(n=>({...n,refs:n.refs.map((n,r)=>r===e?{...n,...t}:n)}))},onRemove:e=>g(t=>({...t,refs:t.refs.filter((t,n)=>n!==e)})),onAdd:()=>g(e=>({...e,refs:[...e.refs,A()]}))}),(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(s,{type:`button`,onClick:()=>{try{let e={};for(let[t,r]of o.providers.entries()){let i=r.alias.trim();if(!i)throw Error(`${n(`providerAlias`)} #${t+1} ${n(`isRequired`)}`);if(e[i])throw Error(`${n(`providerAlias`)}: ${i} (${n(`duplicate`)})`);if(r.source===`file`&&!r.path.trim())throw Error(`${n(`secretFilePath`)} #${t+1} ${n(`isRequired`)}`);if(r.source===`exec`&&!r.command.trim())throw Error(`${n(`secretExecCommand`)} #${t+1} ${n(`isRequired`)}`);e[i]=M(r)}let t={};for(let[r,i]of o.refs.entries()){let a=i.path.trim(),o=i.id.trim();if(!a)throw Error(`${n(`secretConfigPath`)} #${r+1} ${n(`isRequired`)}`);if(!o)throw Error(`${n(`secretId`)} #${r+1} ${n(`isRequired`)}`);let s=i.provider.trim();if(s&&!e[s])throw Error(`${n(`secretProviderAlias`)}: ${s} ${n(`notFound`)}`);t[a]={source:i.source,...s?{provider:s}:{},id:o}}a({enabled:o.enabled,defaultEnv:o.defaultEnv.trim(),defaultFile:o.defaultFile.trim(),defaultExec:o.defaultExec.trim(),providers:Object.entries(e).map(([e,t])=>j(e,t)),refs:Object.entries(t).map(([e,t])=>({path:e,source:t.source,provider:t.provider??``,id:t.id}))})}catch(e){f.error(e instanceof Error?e.message:String(e))}},disabled:r,children:[(0,D.jsx)(_,{className:`mr-2 h-4 w-4`}),n(r?`saving`:`save`)]})})]})}function z(){let{data:e,isLoading:t}=w(),r=T();return t?(0,D.jsx)(`div`,{className:`p-8 text-gray-400`,children:n(`loading`)}):(0,D.jsx)(R,{initialState:N(e?.secrets),isPending:r.isPending,onSubmit:e=>r.mutate({data:P(e)})},JSON.stringify(e?.secrets??null))}export{z as SecretsConfigPage};
@@ -1 +1 @@
1
- import{d as e,m as t}from"./react-C7HsxuKH.js";var n=t(),r={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function i({status:t,label:i,className:a}){let o=r[t];return(0,n.jsxs)(`div`,{className:e(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,o.bg,a),children:[(0,n.jsx)(`span`,{className:e(`h-1.5 w-1.5 rounded-full`,o.dot)}),(0,n.jsx)(`span`,{className:e(`text-[11px] font-medium`,o.text),children:i})]})}export{i as t};
1
+ import{p as e,u as t}from"./react-Dsotw5vM.js";var n=e(),r={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function i({status:e,label:i,className:a}){let o=r[e];return(0,n.jsxs)(`div`,{className:t(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,o.bg,a),children:[(0,n.jsx)(`span`,{className:t(`h-1.5 w-1.5 rounded-full`,o.dot)}),(0,n.jsx)(`span`,{className:t(`text-[11px] font-medium`,o.text),children:i})]})}export{i as t};
@@ -0,0 +1 @@
1
+ import{h as e,p as t,u as n,v as r}from"./react-Dsotw5vM.js";var i=r(e(),1),a=t(),o=i.createContext(null);function s({defaultValue:e,value:t,onValueChange:n,children:r}){return(0,a.jsx)(o.Provider,{value:{value:t,onValueChange:n},children:r})}function c({children:e,className:t}){return(0,a.jsx)(`div`,{className:n(`inline-flex h-9 items-center justify-center rounded-xl bg-gray-100/80 p-1 text-gray-500`,t),children:e})}function l({value:e,children:t,className:r}){let s=i.useContext(o);if(!s)throw Error(`TabsTrigger must be used within Tabs`);let c=s.value===e;return(0,a.jsx)(`button`,{type:`button`,onClick:()=>s.onValueChange(e),"aria-pressed":c,"data-state":c?`active`:`inactive`,className:n(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-[13px] font-medium ring-offset-white transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,c?`bg-white text-gray-900 shadow-sm`:`hover:bg-white/50 hover:text-gray-800 text-gray-600`,r),children:t})}function u({value:e,children:t,className:r}){let s=i.useContext(o);if(!s)throw Error(`TabsContent must be used within Tabs`);return s.value===e?(0,a.jsx)(`div`,{className:n(`mt-2 animate-fade-in`,r),children:t}):null}export{l as i,u as n,c as r,s as t};
@@ -1 +1 @@
1
- import{d as e,g as t,m as n,y as r}from"./react-C7HsxuKH.js";import{It as i}from"./api-D0hARyyl.js";var a=r(t(),1),o=n(),s=i(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,{variants:{tone:{subtle:`border-gray-200 bg-gray-50 text-gray-600`,neutral:`border-gray-200 bg-white text-gray-600`,success:`border-emerald-200 bg-emerald-50 text-emerald-700`,warning:`border-amber-200 bg-amber-50 text-amber-800`,danger:`border-rose-200 bg-rose-50 text-rose-600`,info:`border-primary/20 bg-primary/10 text-primary`}},defaultVariants:{tone:`subtle`}}),c=a.forwardRef(({className:t,tone:n,...r},i)=>(0,o.jsx)(`span`,{ref:i,className:e(s({tone:n}),t),...r}));c.displayName=`TagChip`;export{c as t};
1
+ import{h as e,p as t,u as n,v as r}from"./react-Dsotw5vM.js";import{Rt as i}from"./api-B50yVdT8.js";var a=r(e(),1),o=t(),s=i(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,{variants:{tone:{subtle:`border-gray-200 bg-gray-50 text-gray-600`,neutral:`border-gray-200 bg-white text-gray-600`,success:`border-emerald-200 bg-emerald-50 text-emerald-700`,warning:`border-amber-200 bg-amber-50 text-amber-800`,danger:`border-rose-200 bg-rose-50 text-rose-600`,info:`border-primary/20 bg-primary/10 text-primary`}},defaultVariants:{tone:`subtle`}}),c=a.forwardRef(({className:e,tone:t,...r},i)=>(0,o.jsx)(`span`,{ref:i,className:n(s({tone:t}),e),...r}));c.displayName=`TagChip`;export{c as t};
@@ -1 +1 @@
1
- import{d as e,g as t,m as n,y as r}from"./react-C7HsxuKH.js";import{a as i,b as a,c as o,f as s,g as c,h as l,i as u,l as d,m as f,o as p,r as m,s as h,t as g,u as _,x as v,y}from"./dist-C59BKqbX.js";import{t as b}from"./dist-Di6EHp2x.js";var x=o(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),S=r(t(),1),C=n(),[w,T]=y(`Tooltip`,[h]),E=h(),D=`TooltipProvider`,O=700,k=`tooltip.open`,[A,j]=w(D),M=e=>{let{__scopeTooltip:t,delayDuration:n=O,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=S.useRef(!0),s=S.useRef(!1),c=S.useRef(0);return S.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,C.jsx)(A,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:S.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};M.displayName=D;var N=`Tooltip`,[ee,P]=w(N),F=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,u=j(N,e.__scopeTooltip),d=E(t),[f,m]=S.useState(null),h=c(),g=S.useRef(0),_=o??u.disableHoverableContent,v=s??u.delayDuration,y=S.useRef(!1),[b,x]=l({prop:r,defaultProp:i??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(k))):u.onClose(),a?.(e)},caller:N}),w=S.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),T=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,x(!0)},[x]),D=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),O=S.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,x(!0),g.current=0},v)},[v,x]);return S.useEffect(()=>()=>{g.current&&=(window.clearTimeout(g.current),0)},[]),(0,C.jsx)(p,{...d,children:(0,C.jsx)(ee,{scope:t,contentId:h,open:b,stateAttribute:w,trigger:f,onTriggerChange:m,onTriggerEnter:S.useCallback(()=>{u.isOpenDelayedRef.current?O():T()},[u.isOpenDelayedRef,O,T]),onTriggerLeave:S.useCallback(()=>{_?D():(window.clearTimeout(g.current),g.current=0)},[D,_]),onOpen:T,onClose:D,disableHoverableContent:_,children:n})})};F.displayName=N;var I=`TooltipTrigger`,L=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=P(I,n),o=j(I,n),c=E(n),l=a(t,S.useRef(null),i.onTriggerChange),u=S.useRef(!1),d=S.useRef(!1),f=S.useCallback(()=>u.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,C.jsx)(m,{asChild:!0,...c,children:(0,C.jsx)(s.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:v(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:v(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:v(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:v(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:v(e.onBlur,i.onClose),onClick:v(e.onClick,i.onClose)})})});L.displayName=I;var R=`TooltipPortal`,[z,B]=w(R,{forceMount:void 0}),V=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=P(R,t);return(0,C.jsx)(z,{scope:t,forceMount:n,children:(0,C.jsx)(b,{present:n||a.open,children:(0,C.jsx)(d,{asChild:!0,container:i,children:r})})})};V.displayName=R;var H=`TooltipContent`,U=S.forwardRef((e,t)=>{let n=B(H,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=P(H,e.__scopeTooltip);return(0,C.jsx)(b,{present:r||o.open,children:o.disableHoverableContent?(0,C.jsx)(K,{side:i,...a,ref:t}):(0,C.jsx)(W,{side:i,...a,ref:t})})}),W=S.forwardRef((e,t)=>{let n=P(H,e.__scopeTooltip),r=j(H,e.__scopeTooltip),i=S.useRef(null),o=a(t,i),[s,c]=S.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=S.useCallback(()=>{c(null),f(!1)},[f]),m=S.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=ae(r,ie(r,n.getBoundingClientRect())),a=oe(t.getBoundingClientRect());c(ce([...i,...a])),f(!0)},[f]);return S.useEffect(()=>()=>p(),[p]),S.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),S.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!se(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,C.jsx)(K,{...e,ref:o})}),[G,te]=w(N,{isInside:!1}),ne=f(`TooltipContent`),K=S.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=P(H,n),u=E(n),{onClose:d}=l;return S.useEffect(()=>(document.addEventListener(k,d),()=>document.removeEventListener(k,d)),[d]),S.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,C.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,C.jsxs)(i,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,C.jsx)(ne,{children:r}),(0,C.jsx)(G,{scope:n,isInside:!0,children:(0,C.jsx)(g,{id:l.contentId,role:`tooltip`,children:a||r})})]})})});U.displayName=H;var q=`TooltipArrow`,re=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=E(n);return te(q,n).isInside?null:(0,C.jsx)(u,{...i,...r,ref:t})});re.displayName=q;function ie(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function ae(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function oe(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function se(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ce(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),le(t)}function le(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var J=M,Y=F,X=L,Z=V,Q=U,ue=J,de=Y,fe=X,$=S.forwardRef(({className:t,sideOffset:n=4,...r},i)=>(0,C.jsx)(Z,{children:(0,C.jsx)(Q,{ref:i,sideOffset:n,className:e(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,t),...r})}));$.displayName=Q.displayName;export{Q as a,Y as c,fe as i,X as l,$ as n,Z as o,ue as r,J as s,de as t,x as u};
1
+ import{h as e,p as t,u as n,v as r}from"./react-Dsotw5vM.js";import{a as i,b as a,c as o,f as s,g as c,h as l,i as u,l as d,m as f,o as p,r as m,s as h,t as g,u as _,x as v,y}from"./dist-NZRV-BxD.js";import{t as b}from"./dist-D19wiQwB.js";var x=o(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),S=r(e(),1),C=t(),[w,T]=y(`Tooltip`,[h]),E=h(),D=`TooltipProvider`,O=700,k=`tooltip.open`,[A,j]=w(D),M=e=>{let{__scopeTooltip:t,delayDuration:n=O,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=S.useRef(!0),s=S.useRef(!1),c=S.useRef(0);return S.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,C.jsx)(A,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:S.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};M.displayName=D;var N=`Tooltip`,[ee,P]=w(N),F=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,u=j(N,e.__scopeTooltip),d=E(t),[f,m]=S.useState(null),h=c(),g=S.useRef(0),_=o??u.disableHoverableContent,v=s??u.delayDuration,y=S.useRef(!1),[b,x]=l({prop:r,defaultProp:i??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(k))):u.onClose(),a?.(e)},caller:N}),w=S.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),T=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,x(!0)},[x]),D=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),O=S.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,x(!0),g.current=0},v)},[v,x]);return S.useEffect(()=>()=>{g.current&&=(window.clearTimeout(g.current),0)},[]),(0,C.jsx)(p,{...d,children:(0,C.jsx)(ee,{scope:t,contentId:h,open:b,stateAttribute:w,trigger:f,onTriggerChange:m,onTriggerEnter:S.useCallback(()=>{u.isOpenDelayedRef.current?O():T()},[u.isOpenDelayedRef,O,T]),onTriggerLeave:S.useCallback(()=>{_?D():(window.clearTimeout(g.current),g.current=0)},[D,_]),onOpen:T,onClose:D,disableHoverableContent:_,children:n})})};F.displayName=N;var I=`TooltipTrigger`,L=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=P(I,n),o=j(I,n),c=E(n),l=a(t,S.useRef(null),i.onTriggerChange),u=S.useRef(!1),d=S.useRef(!1),f=S.useCallback(()=>u.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,C.jsx)(m,{asChild:!0,...c,children:(0,C.jsx)(s.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:v(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:v(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:v(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:v(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:v(e.onBlur,i.onClose),onClick:v(e.onClick,i.onClose)})})});L.displayName=I;var R=`TooltipPortal`,[z,B]=w(R,{forceMount:void 0}),V=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=P(R,t);return(0,C.jsx)(z,{scope:t,forceMount:n,children:(0,C.jsx)(b,{present:n||a.open,children:(0,C.jsx)(d,{asChild:!0,container:i,children:r})})})};V.displayName=R;var H=`TooltipContent`,U=S.forwardRef((e,t)=>{let n=B(H,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=P(H,e.__scopeTooltip);return(0,C.jsx)(b,{present:r||o.open,children:o.disableHoverableContent?(0,C.jsx)(K,{side:i,...a,ref:t}):(0,C.jsx)(W,{side:i,...a,ref:t})})}),W=S.forwardRef((e,t)=>{let n=P(H,e.__scopeTooltip),r=j(H,e.__scopeTooltip),i=S.useRef(null),o=a(t,i),[s,c]=S.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=S.useCallback(()=>{c(null),f(!1)},[f]),m=S.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=ae(r,ie(r,n.getBoundingClientRect())),a=oe(t.getBoundingClientRect());c(ce([...i,...a])),f(!0)},[f]);return S.useEffect(()=>()=>p(),[p]),S.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),S.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!se(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,C.jsx)(K,{...e,ref:o})}),[G,te]=w(N,{isInside:!1}),ne=f(`TooltipContent`),K=S.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=P(H,n),u=E(n),{onClose:d}=l;return S.useEffect(()=>(document.addEventListener(k,d),()=>document.removeEventListener(k,d)),[d]),S.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,C.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,C.jsxs)(i,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,C.jsx)(ne,{children:r}),(0,C.jsx)(G,{scope:n,isInside:!0,children:(0,C.jsx)(g,{id:l.contentId,role:`tooltip`,children:a||r})})]})})});U.displayName=H;var q=`TooltipArrow`,re=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=E(n);return te(q,n).isInside?null:(0,C.jsx)(u,{...i,...r,ref:t})});re.displayName=q;function ie(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function ae(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function oe(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function se(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ce(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),le(t)}function le(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var J=M,Y=F,X=L,Z=V,Q=U,ue=J,de=Y,fe=X,$=S.forwardRef(({className:e,sideOffset:t=4,...r},i)=>(0,C.jsx)(Z,{children:(0,C.jsx)(Q,{ref:i,sideOffset:t,className:n(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));$.displayName=Q.displayName;export{Q as a,Y as c,fe as i,X as l,$ as n,Z as o,ue as r,J as s,de as t,x as u};
@@ -1 +1 @@
1
- import{c as e}from"./dist-C59BKqbX.js";var t=e(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]);export{t};
1
+ import{c as e}from"./dist-NZRV-BxD.js";var t=e(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./react-Dsotw5vM.js";import{$ as t,F as n,G as r,H as i,Ht as a,J as o,L as s,M as c,P as l,Q as u,R as d,U as f,Ut as p,Vt as m,W as h,X as g,Y as _,Z as v,en as y,et as b,tt as x,z as S}from"./api-B50yVdT8.js";function C(){return p({queryKey:[`config`],queryFn:s,staleTime:3e4,refetchOnWindowFocus:!0})}function w(){return p({queryKey:[`config-meta`],queryFn:d,staleTime:1/0})}function T(){return p({queryKey:[`providers`],queryFn:f,staleTime:3e4,refetchOnWindowFocus:!0})}function E(){return p({queryKey:[`provider-templates`],queryFn:i,staleTime:1/0})}function D(){return p({queryKey:[`config-schema`],queryFn:S,staleTime:1/0})}function O(){let t=y();return a({mutationFn:v,onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),m.success(e(`configSaved`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function k(){let t=y();return a({mutationFn:({data:e})=>b(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),m.success(e(`configSavedApplied`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function A(){let t=y();return a({mutationFn:({provider:e,data:t})=>u(e,t),onSuccess:(n,r)=>{t.invalidateQueries({queryKey:[`providers`]}),t.invalidateQueries({queryKey:[`config`]}),r.silentSuccess||m.success(e(`configSaved`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function j(){let t=y();return a({mutationFn:({data:e})=>c(e??{}),onSuccess:()=>{t.invalidateQueries({queryKey:[`providers`]}),t.invalidateQueries({queryKey:[`config`]}),m.success(e(`configSaved`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function M(){let t=y();return a({mutationFn:({provider:e})=>l(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`providers`]}),t.invalidateQueries({queryKey:[`config`]}),m.success(e(`configSaved`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function N(){return a({mutationFn:({provider:e,data:t})=>_(e,t)})}function P(){return a({mutationFn:({provider:e,data:t})=>o(e,t)})}function F(){return a({mutationFn:({provider:e,data:t})=>r(e,t)})}function I(){return a({mutationFn:({provider:e})=>h(e)})}function L(){let t=y();return a({mutationFn:({channel:e,data:t})=>g(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),m.success(e(`configSavedApplying`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function R(){let n=y();return a({mutationFn:({data:e})=>t(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`config`]}),m.success(e(`configSavedApplied`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function z(){let t=y();return a({mutationFn:({data:e})=>x(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),m.success(e(`configSavedApplied`))},onError:t=>{m.error(e(`configSaveFailed`)+`: `+t.message)}})}function B(){return a({mutationFn:({actionId:e,data:t})=>n(e,t),onError:t=>{m.error(e(`error`)+`: `+t.message)}})}export{k as _,M as a,F as c,P as d,N as f,R as g,A as h,j as i,E as l,O as m,w as n,B as o,L as p,D as r,I as s,C as t,T as u,z as v};
@@ -0,0 +1 @@
1
+ import{c as e}from"./dist-NZRV-BxD.js";var t=e(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
@@ -105,33 +105,33 @@
105
105
  })();
106
106
  </script>
107
107
  <title>NextClaw</title>
108
- <script type="module" crossorigin src="/assets/index-DfZTO6Pi.js"></script>
109
- <link rel="modulepreload" crossorigin href="/assets/react-C7HsxuKH.js">
110
- <link rel="modulepreload" crossorigin href="/assets/dist-C59BKqbX.js">
111
- <link rel="modulepreload" crossorigin href="/assets/es2015-CJlVSTh-.js">
112
- <link rel="modulepreload" crossorigin href="/assets/dist-Di6EHp2x.js">
113
- <link rel="modulepreload" crossorigin href="/assets/api-D0hARyyl.js">
114
- <link rel="modulepreload" crossorigin href="/assets/x-CSRTOZnM.js">
115
- <link rel="modulepreload" crossorigin href="/assets/confirm-dialog-CTcaBp-8.js">
116
- <link rel="modulepreload" crossorigin href="/assets/popover-CoBu3mbV.js">
117
- <link rel="modulepreload" crossorigin href="/assets/tooltip-Bw-mXQAM.js">
118
- <link rel="modulepreload" crossorigin href="/assets/arrow-left-CzSkR5L6.js">
119
- <link rel="modulepreload" crossorigin href="/assets/book-open-DmeQPqkd.js">
120
- <link rel="modulepreload" crossorigin href="/assets/key-round-BzYZ0Nno.js">
121
- <link rel="modulepreload" crossorigin href="/assets/loader-circle-BbdIlBbQ.js">
122
- <link rel="modulepreload" crossorigin href="/assets/plus-DrV685KC.js">
123
- <link rel="modulepreload" crossorigin href="/assets/refresh-cw-CVo4nWpq.js">
124
- <link rel="modulepreload" crossorigin href="/assets/trash-2-CmIwAJIT.js">
125
- <link rel="modulepreload" crossorigin href="/assets/doc-browser-context-BzEA1lm1.js">
126
- <link rel="modulepreload" crossorigin href="/assets/notice-card-CD9Ok62G.js">
127
- <link rel="modulepreload" crossorigin href="/assets/status-dot-C1-FKgvv.js">
128
- <link rel="modulepreload" crossorigin href="/assets/tabs-BqkKwx1R.js">
129
- <link rel="modulepreload" crossorigin href="/assets/host-capabilities-DjiRQ0Q9.js">
130
- <link rel="modulepreload" crossorigin href="/assets/app-presenter-provider-C7EsUuEJ.js">
131
- <link rel="modulepreload" crossorigin href="/assets/external-link-J0fCK-vu.js">
132
- <link rel="modulepreload" crossorigin href="/assets/search-8nY6PGm0.js">
133
- <link rel="modulepreload" crossorigin href="/assets/doc-browser-EZbnEcdk.js">
134
- <link rel="stylesheet" crossorigin href="/assets/index-mIb_YMrc.css">
108
+ <script type="module" crossorigin src="/assets/index-CMNrRhnG.js"></script>
109
+ <link rel="modulepreload" crossorigin href="/assets/react-Dsotw5vM.js">
110
+ <link rel="modulepreload" crossorigin href="/assets/dist-NZRV-BxD.js">
111
+ <link rel="modulepreload" crossorigin href="/assets/es2015-BUIIKCNh.js">
112
+ <link rel="modulepreload" crossorigin href="/assets/dist-D19wiQwB.js">
113
+ <link rel="modulepreload" crossorigin href="/assets/api-B50yVdT8.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/x-fkIWvi07.js">
115
+ <link rel="modulepreload" crossorigin href="/assets/confirm-dialog-DRSelLdI.js">
116
+ <link rel="modulepreload" crossorigin href="/assets/popover-BnmPOXe3.js">
117
+ <link rel="modulepreload" crossorigin href="/assets/tooltip-Bxzi6aDL.js">
118
+ <link rel="modulepreload" crossorigin href="/assets/arrow-left-BOCJyLbQ.js">
119
+ <link rel="modulepreload" crossorigin href="/assets/book-open-Bd2Xbrrc.js">
120
+ <link rel="modulepreload" crossorigin href="/assets/key-round-D3vD9dj7.js">
121
+ <link rel="modulepreload" crossorigin href="/assets/loader-circle-DV9TSRns.js">
122
+ <link rel="modulepreload" crossorigin href="/assets/plus-Bf9qhPDO.js">
123
+ <link rel="modulepreload" crossorigin href="/assets/refresh-cw-Bmx4wc9P.js">
124
+ <link rel="modulepreload" crossorigin href="/assets/trash-2-CSfX-BvU.js">
125
+ <link rel="modulepreload" crossorigin href="/assets/doc-browser-context-C8KPbj-p.js">
126
+ <link rel="modulepreload" crossorigin href="/assets/notice-card-qqlbsOoR.js">
127
+ <link rel="modulepreload" crossorigin href="/assets/status-dot-Dm4h-bjn.js">
128
+ <link rel="modulepreload" crossorigin href="/assets/tabs-CJvw5Lqp.js">
129
+ <link rel="modulepreload" crossorigin href="/assets/host-capabilities-9bB_998Z.js">
130
+ <link rel="modulepreload" crossorigin href="/assets/app-presenter-provider-BI-ewLbO.js">
131
+ <link rel="modulepreload" crossorigin href="/assets/external-link-528k6MDD.js">
132
+ <link rel="modulepreload" crossorigin href="/assets/search-D7L-TCH-.js">
133
+ <link rel="modulepreload" crossorigin href="/assets/doc-browser-2ddUJCA0.js">
134
+ <link rel="stylesheet" crossorigin href="/assets/index-UTmTW1eU.css">
135
135
  </head>
136
136
 
137
137
  <body>
@@ -1,3 +0,0 @@
1
- import{d as e,g as t,i as n,m as r,n as i,o as a,s as o,t as s,y as c}from"./react-C7HsxuKH.js";import{At as l,Bt as u,Dt as d,Et as f,Ft as p,Lt as m,Mt as h,Nt as g,Ot as _,Pt as v,Qt as y,Vt as b,a as ee,c as te,ct as x,i as ne,jt as re,kt as ie,l as ae,o as oe,pt as se,r as ce,s as le,u as ue,wt as S,zt as C}from"./api-D0hARyyl.js";import{c as w}from"./dist-C59BKqbX.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./confirm-dialog-CTcaBp-8.js";import{t as ve}from"./arrow-left-CzSkR5L6.js";import{t as ye}from"./book-open-DmeQPqkd.js";import{i as be,n as xe,r as Se,t as Ce,u as we}from"./tooltip-Bw-mXQAM.js";import{t as Te}from"./key-round-BzYZ0Nno.js";import{t as Ee}from"./loader-circle-BbdIlBbQ.js";import{t as De}from"./plus-DrV685KC.js";import{t as Oe}from"./refresh-cw-CVo4nWpq.js";import{t as ke}from"./trash-2-CmIwAJIT.js";import{t as Ae}from"./x-CSRTOZnM.js";import{t as T}from"./notice-card-CD9Ok62G.js";import{t as je}from"./status-dot-C1-FKgvv.js";import{t as Me}from"./host-capabilities-DjiRQ0Q9.js";import{n as Ne,r as Pe,t as Fe}from"./popover-CoBu3mbV.js";import{i as E,r as Ie,t as Le}from"./tabs-BqkKwx1R.js";import{a as D,c as Re,f as O,g as ze,h as k,i as Be,l as Ve,m as He,n as Ue,o as We,p as Ge,r as Ke,s as qe,u as Je}from"./doc-browser-context-BzEA1lm1.js";var Ye=`modulepreload`,Xe=function(e){return`/`+e},Ze={},Qe=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Xe(t,n),t in Ze)return;Ze[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ye,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},A=c(t(),1),$e=`popstate`;function et(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=it(i?l().pathname:`/`,e,t,n);return M(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:N(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?P(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function tt(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return it(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:N(t)}return at(t,n,null,e)}function j(e,t){if(e===!1||e==null)throw Error(t)}function M(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function nt(){return Math.random().toString(36).substring(2,10)}function rt(e,t){return{usr:e.state,key:e.key,idx:t}}function it(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?P(t):t,state:n,key:t&&t.key||r||nt()}}function N({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function P(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function at(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=it(h.location,e,t);n&&n(r,e),l=u()+1;let d=rt(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=it(h.location,e,t);n&&n(r,e),l=u();let i=rt(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ot(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener($e,d),c=e,()=>{i.removeEventListener($e,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ot(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),j(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:N(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function st(e,t,n=`/`){return ct(e,t,n,!1)}function ct(e,t,n,r){let i=F((typeof t==`string`?P(t):t).pathname||`/`,n);if(i==null)return null;let a=ut(e);ft(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Tt(i);o=St(a[e],t,r)}return o}function lt(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ut(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;j(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=I([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(j(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ut(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:bt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of dt(e.path))a(e,t,!0,n)}),t}function dt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=dt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ft(e){e.sort((e,t)=>e.score===t.score?xt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var pt=/^:[\w-]+$/,mt=3,ht=2,gt=1,_t=10,vt=-2,yt=e=>e===`*`;function bt(e,t){let n=e.split(`/`),r=n.length;return n.some(yt)&&(r+=vt),t&&(r+=ht),n.filter(e=>!yt(e)).reduce((e,t)=>e+(pt.test(t)?mt:t===``?gt:_t),r)}function xt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function St(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Ct({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Ct({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:I([a,u.pathname]),pathnameBase:Nt(I([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=I([a,u.pathnameBase]))}return o}function Ct(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=wt(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function wt(e,t=!1,n=!0){M(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 r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Tt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function F(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Et=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Dt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?P(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?Ot(n.substring(1),`/`):Ot(n,t)):a=t,{pathname:a,search:Pt(r),hash:Ft(i)}}function Ot(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function kt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function At(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function jt(e){let t=At(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Mt(e,t,n,r=!1){let i;typeof e==`string`?i=P(e):(i={...e},j(!i.pathname||!i.pathname.includes(`?`),kt(`?`,`pathname`,`search`,i)),j(!i.pathname||!i.pathname.includes(`#`),kt(`#`,`pathname`,`hash`,i)),j(!i.search||!i.search.includes(`#`),kt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Dt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var I=e=>e.join(`/`).replace(/\/\/+/g,`/`),Nt=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Pt=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ft=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,It=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Lt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Rt(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var zt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Bt(e,t){let n=e;if(typeof n!=`string`||!Et.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(zt)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=F(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{M(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Vt=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Vt);var Ht=[`GET`,...Vt];new Set(Ht);var Ut=A.createContext(null);Ut.displayName=`DataRouter`;var Wt=A.createContext(null);Wt.displayName=`DataRouterState`;var Gt=A.createContext(!1),Kt=A.createContext({isTransitioning:!1});Kt.displayName=`ViewTransition`;var qt=A.createContext(new Map);qt.displayName=`Fetchers`;var Jt=A.createContext(null);Jt.displayName=`Await`;var L=A.createContext(null);L.displayName=`Navigation`;var Yt=A.createContext(null);Yt.displayName=`Location`;var R=A.createContext({outlet:null,matches:[],isDataRoute:!1});R.displayName=`Route`;var Xt=A.createContext(null);Xt.displayName=`RouteError`;var Zt=`REACT_ROUTER_ERROR`,Qt=`REDIRECT`,$t=`ROUTE_ERROR_RESPONSE`;function en(e){if(e.startsWith(`${Zt}:${Qt}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function tn(e){if(e.startsWith(`${Zt}:${$t}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new It(t.status,t.statusText,t.data)}catch{}}function nn(e,{relative:t}={}){j(z(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=A.useContext(L),{hash:i,pathname:a,search:o}=ln(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:I([n,a])),r.createHref({pathname:s,search:o,hash:i})}function z(){return A.useContext(Yt)!=null}function B(){return j(z(),`useLocation() may be used only in the context of a <Router> component.`),A.useContext(Yt).location}var rn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function an(e){A.useContext(L).static||A.useLayoutEffect(e)}function on(){let{isDataRoute:e}=A.useContext(R);return e?On():sn()}function sn(){j(z(),`useNavigate() may be used only in the context of a <Router> component.`);let e=A.useContext(Ut),{basename:t,navigator:n}=A.useContext(L),{matches:r}=A.useContext(R),{pathname:i}=B(),a=JSON.stringify(jt(r)),o=A.useRef(!1);return an(()=>{o.current=!0}),A.useCallback((r,s={})=>{if(M(o.current,rn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Mt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:I([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}A.createContext(null);function cn(){let{matches:e}=A.useContext(R),t=e[e.length-1];return t?t.params:{}}function ln(e,{relative:t}={}){let{matches:n}=A.useContext(R),{pathname:r}=B(),i=JSON.stringify(jt(n));return A.useMemo(()=>Mt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function un(e,t){return dn(e,t)}function dn(e,t,n,r,i){j(z(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=A.useContext(L),{matches:o}=A.useContext(R),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;An(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
-
3
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=B(),p;if(t){let e=typeof t==`string`?P(t):t;j(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=st(e,{pathname:h});M(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),M(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=vn(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:I([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:I([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?A.createElement(Yt.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function fn(){let e=Dn(),t=Lt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=A.createElement(A.Fragment,null,A.createElement(`p`,null,`💿 Hey developer 👋`),A.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,A.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,A.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),A.createElement(A.Fragment,null,A.createElement(`h2`,null,`Unexpected Application Error!`),A.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?A.createElement(`pre`,{style:i},n):null,o)}var pn=A.createElement(fn,null),mn=class extends A.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=tn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:A.createElement(R.Provider,{value:this.props.routeContext},A.createElement(Xt.Provider,{value:e,children:this.props.component}));return this.context?A.createElement(gn,{error:e},t):t}};mn.contextType=Gt;var hn=new WeakMap;function gn({children:e,error:t}){let{basename:n}=A.useContext(L);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=en(t.digest);if(e){let r=hn.get(t);if(r)throw r;let i=Bt(e.location,n);if(zt&&!hn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw hn.set(t,n),n}return A.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function _n({routeContext:e,match:t,children:n}){let r=A.useContext(Ut);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(R.Provider,{value:e},n)}function vn(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);j(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}let l=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Rt(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,d=!1,f=null,p=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,f=r.route.errorElement||pn,s&&(c<0&&i===0?(An(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===i&&(d=!0,p=r.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,i+1)),h=()=>{let t;return t=u?f:d?p:r.route.Component?A.createElement(r.route.Component,null):r.route.element?r.route.element:e,A.createElement(_n,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?A.createElement(mn,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function yn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bn(e){let t=A.useContext(Ut);return j(t,yn(e)),t}function xn(e){let t=A.useContext(Wt);return j(t,yn(e)),t}function Sn(e){let t=A.useContext(R);return j(t,yn(e)),t}function Cn(e){let t=Sn(e),n=t.matches[t.matches.length-1];return j(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function wn(){return Cn(`useRouteId`)}function Tn(){return xn(`useNavigation`).navigation}function En(){let{matches:e,loaderData:t}=xn(`useMatches`);return A.useMemo(()=>e.map(e=>lt(e,t)),[e,t])}function Dn(){let e=A.useContext(Xt),t=xn(`useRouteError`),n=Cn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function On(){let{router:e}=bn(`useNavigate`),t=Cn(`useNavigate`),n=A.useRef(!1);return an(()=>{n.current=!0}),A.useCallback(async(r,i={})=>{M(n.current,rn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var kn={};function An(e,t,n){!t&&!kn[e]&&(kn[e]=!0,M(!1,n))}A.useOptimistic,A.memo(jn);function jn({routes:e,future:t,state:n,onError:r}){return dn(e,void 0,n,r,t)}function Mn({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=A.useRef();a.current??=et({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[s,c]=A.useState({action:o.action,location:o.location}),l=A.useCallback(e=>{i===!1?c(e):A.startTransition(()=>c(e))},[i]);return A.useLayoutEffect(()=>o.listen(l),[o,l]),A.createElement(Fn,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,unstable_useTransitions:i})}function Nn({to:e,replace:t,state:n,relative:r}){j(z(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=A.useContext(L);M(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=A.useContext(R),{pathname:o}=B(),s=on(),c=Mt(e,jt(a),o,r===`path`),l=JSON.stringify(c);return A.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Pn(e){j(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Fn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){j(!z(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=A.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=P(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`}=n,m=A.useMemo(()=>{let e=F(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p},navigationType:r}},[s,l,u,d,f,p,r]);return M(m!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:A.createElement(L.Provider,{value:c},A.createElement(Yt.Provider,{children:t,value:m}))}function In({children:e,location:t}){return un(Ln(e),t)}A.Component;function Ln(e,t=[]){let n=[];return A.Children.forEach(e,(e,r)=>{if(!A.isValidElement(e))return;let i=[...t,r];if(e.type===A.Fragment){n.push.apply(n,Ln(e.props.children,i));return}j(e.type===Pn,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),j(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Ln(e.props.children,i)),n.push(a)}),n}var Rn=`get`,zn=`application/x-www-form-urlencoded`;function Bn(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Vn(e){return Bn(e)&&e.tagName.toLowerCase()===`button`}function Hn(e){return Bn(e)&&e.tagName.toLowerCase()===`form`}function Un(e){return Bn(e)&&e.tagName.toLowerCase()===`input`}function Wn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Gn(e,t){return e.button===0&&(!t||t===`_self`)&&!Wn(e)}var Kn=null;function qn(){if(Kn===null)try{new FormData(document.createElement(`form`),0),Kn=!1}catch{Kn=!0}return Kn}var Jn=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Yn(e){return e!=null&&!Jn.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zn}"`),null):e}function Xn(e,t){let n,r,i,a,o;if(Hn(e)){let o=e.getAttribute(`action`);r=o?F(o,t):null,n=e.getAttribute(`method`)||Rn,i=Yn(e.getAttribute(`enctype`))||zn,a=new FormData(e)}else if(Vn(e)||Un(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?F(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Rn,i=Yn(e.getAttribute(`formenctype`))||Yn(o.getAttribute(`enctype`))||zn,a=new FormData(o,e),!qn()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Bn(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Rn,r=null,i=zn,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Zn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Qn=/[&><\u2028\u2029]/g;function $n(e){return e.replace(Qn,e=>Zn[e])}function er(e,t){if(e===!1||e==null)throw Error(t)}function tr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&F(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function nr(e,t){if(e.id in t)return t[e.id];try{let n=await Qe(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function rr(e){return e!=null&&typeof e.page==`string`}function ir(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function ar(e,t,n){return ur((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await nr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ir).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function or(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function sr(e,t,{includeHydrateFallback:n}={}){return cr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function cr(e){return[...new Set(e)]}function lr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ur(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!rr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(lr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function dr(){let e=A.useContext(Ut);return er(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function fr(){let e=A.useContext(Wt);return er(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var pr=A.createContext(void 0);pr.displayName=`FrameworkContext`;function mr(){let e=A.useContext(pr);return er(e,`You must render this element inside a <HydratedRouter> element`),e}function hr(e,t){let n=A.useContext(pr),[r,i]=A.useState(!1),[a,o]=A.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=A.useRef(null);A.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),A.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:gr(s,p),onBlur:gr(c,m),onMouseEnter:gr(l,p),onMouseLeave:gr(u,m),onTouchStart:gr(d,p)}]:[a,f,{}]:[!1,f,{}]}function gr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function _r({page:e,...t}){let{router:n}=dr(),r=A.useMemo(()=>st(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?A.createElement(yr,{page:e,matches:r,...t}):null}function vr(e){let{manifest:t,routeModules:n}=mr(),[r,i]=A.useState([]);return A.useEffect(()=>{let r=!1;return ar(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function yr({page:e,matches:t,...n}){let r=B(),{future:i,manifest:a,routeModules:o}=mr(),{basename:s}=dr(),{loaderData:c,matches:l}=fr(),u=A.useMemo(()=>or(e,t,l,a,r,`data`),[e,t,l,a,r]),d=A.useMemo(()=>or(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=A.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=tr(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=A.useMemo(()=>sr(d,a),[d,a]),m=vr(d);return A.createElement(A.Fragment,null,f.map(e=>A.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>A.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>A.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function br(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}A.Component;var xr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{xr&&(window.__reactRouterVersion=`7.13.0`)}catch{}function Sr({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=A.useRef();i.current??=tt({window:r,v5Compat:!0});let a=i.current,[o,s]=A.useState({action:a.action,location:a.location}),c=A.useCallback(e=>{n===!1?s(e):A.startTransition(()=>s(e))},[n]);return A.useLayoutEffect(()=>a.listen(c),[a,c]),A.createElement(Fn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Cr({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=A.useState({action:n.action,location:n.location}),o=A.useCallback(e=>{r===!1?a(e):A.startTransition(()=>a(e))},[r]);return A.useLayoutEffect(()=>n.listen(o),[n,o]),A.createElement(Fn,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Cr.displayName=`unstable_HistoryRouter`;var wr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Tr=A.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,unstable_defaultShouldRevalidate:d,...f},p){let{basename:m,unstable_useTransitions:h}=A.useContext(L),g=typeof c==`string`&&wr.test(c),_=Bt(c,m);c=_.to;let v=nn(c,{relative:r}),[y,b,ee]=hr(n,f),te=Mr(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h});function x(t){e&&e(t),t.defaultPrevented||te(t)}let ne=A.createElement(`a`,{...f,...ee,href:_.absoluteURL||v,onClick:_.isExternal||i?e:x,ref:br(p,b),target:s,"data-discover":!g&&t===`render`?`true`:void 0});return y&&!g?A.createElement(A.Fragment,null,ne,A.createElement(_r,{page:v})):ne});Tr.displayName=`Link`;var Er=A.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=ln(a,{relative:c.relative}),d=B(),f=A.useContext(Wt),{navigator:p,basename:m}=A.useContext(L),h=f!=null&&Hr(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=F(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,ee=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),te={isActive:b,isPending:ee,isTransitioning:h},x=b?e:void 0,ne;ne=typeof n==`function`?n(te):[n,b?`active`:null,ee?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let re=typeof i==`function`?i(te):i;return A.createElement(Tr,{...c,"aria-current":x,className:ne,ref:l,style:re,to:a,viewTransition:o},typeof s==`function`?s(te):s)});Er.displayName=`NavLink`;var Dr=A.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Rn,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=A.useContext(L),g=Fr(),_=Ir(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&wr.test(s);return A.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?A.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Dr.displayName=`Form`;function Or({getKey:e,storageKey:t,...n}){let r=A.useContext(pr),{basename:i}=A.useContext(L),a=B(),o=En();Br({getKey:e,storageKey:t});let s=A.useMemo(()=>{if(!r||!e)return null;let t=zr(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return A.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${$n(JSON.stringify(t||Lr))}, ${$n(JSON.stringify(s))})`}})}Or.displayName=`ScrollRestoration`;function kr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ar(e){let t=A.useContext(Ut);return j(t,kr(e)),t}function jr(e){let t=A.useContext(Wt);return j(t,kr(e)),t}function Mr(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s,unstable_useTransitions:c}={}){let l=on(),u=B(),d=ln(e,{relative:a});return A.useCallback(f=>{if(Gn(f,t)){f.preventDefault();let t=n===void 0?N(u)===N(d):n,p=()=>l(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s});c?A.startTransition(()=>p()):p()}},[u,l,d,n,r,t,e,i,a,o,s,c])}var Nr=0,Pr=()=>`__${String(++Nr)}__`;function Fr(){let{router:e}=Ar(`useSubmit`),{basename:t}=A.useContext(L),n=wn(),r=e.fetch,i=e.navigate;return A.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Xn(e,t);a.navigate===!1?await r(a.fetcherKey||Pr(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ir(e,{relative:t}={}){let{basename:n}=A.useContext(L),r=A.useContext(R);j(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...ln(e||`.`,{relative:t})},o=B();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:I([n,a.pathname])),N(a)}var Lr=`react-router-scroll-positions`,Rr={};function zr(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:F(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Br({getKey:e,storageKey:t}={}){let{router:n}=Ar(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=jr(`useScrollRestoration`),{basename:a}=A.useContext(L),o=B(),s=En(),c=Tn();A.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Vr(A.useCallback(()=>{if(c.state===`idle`){let t=zr(o,s,a,e);Rr[t]=window.scrollY}try{sessionStorage.setItem(t||Lr,JSON.stringify(Rr))}catch(e){M(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(A.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Lr);e&&(Rr=JSON.parse(e))}catch{}},[t]),A.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Rr,()=>window.scrollY,e?(t,n)=>zr(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),A.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{M(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Vr(e,t){let{capture:n}=t||{};A.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Hr(e,{relative:t}={}){let n=A.useContext(Kt);j(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ar(`useViewTransitionState`),i=ln(e,{relative:t});if(!n.isTransitioning)return!1;let a=F(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=F(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ct(i.pathname,o)!=null||Ct(i.pathname,a)!=null}var Ur=w(`AppWindow`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Wr=w(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),Gr=w(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Kr=w(`CircleDashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),qr=w(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Jr=w(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),Yr=w(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Xr=w(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Zr=w(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),Qr=w(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),$r=w(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),ei=w(`RefreshCcw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),ti=w(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ni=w(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ri=w(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ii=w(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),ai=w(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),oi=w(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),si=w(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),ci=w(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]);function li(){return b({queryKey:di,queryFn:ee,staleTime:5e3,refetchOnWindowFocus:!0})}var V=r();function H(e){let{label:t,muted:n,value:r}=e;return(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,V.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,V.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function ui(){let e=us(),t=li(),r=t.data,a=G(e=>e.actionLabel),o=(0,A.useMemo)(()=>Si(r),[r]),s=!!a,c=r?.runtime?.deviceName?.trim()||r?.settings.deviceName?.trim()||n(`remoteDeviceNameAuto`),u=!!(r?.account.loggedIn&&gi(r)),{hero:m,issueHint:g}=o;return(0,A.useEffect)(()=>{e.remoteAccessManager.syncStatus(r)},[e,r]),t.isLoading&&!r?(0,V.jsx)(`div`,{className:`p-8 text-gray-400`,children:n(`remoteLoading`)}):(0,V.jsxs)(h,{className:`space-y-6`,children:[(0,V.jsx)(re,{title:n(`remotePageTitle`),description:n(`remotePageDescription`)}),(0,V.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,V.jsxs)(f,{children:[(0,V.jsxs)(ie,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,V.jsx)(l,{children:m.title}),(0,V.jsx)(je,{status:m.badgeStatus,label:m.badgeLabel})]}),(0,V.jsx)(_,{children:m.description})]}),(0,V.jsxs)(d,{className:`space-y-5`,children:[(0,V.jsxs)(T,{tone:`neutral`,children:[(0,V.jsx)(H,{label:n(`remoteSignedInAccount`),value:r?.account.email}),(0,V.jsx)(H,{label:n(`remoteDeviceName`),value:c}),(0,V.jsx)(H,{label:n(`remoteConnectionStatus`),value:m.badgeLabel}),(0,V.jsx)(H,{label:n(`remoteLastConnectedAt`),value:r?.runtime?.lastConnectedAt?i(r.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[o.primaryAction?(0,V.jsxs)(p,{onClick:()=>{if(o.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(r);return}if(o.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(r);return}e.remoteAccessManager.enableRemoteAccess(r)},disabled:s,children:[o.primaryAction.showRefreshIcon?(0,V.jsx)(ei,{className:`mr-2 h-4 w-4`}):null,a||o.primaryAction.label]}):null,(0,V.jsxs)(p,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:s||!u,children:[(0,V.jsx)(ii,{className:`mr-2 h-4 w-4`}),n(`remoteOpenDeviceList`)]}),r?.settings.enabled?(0,V.jsx)(p,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(r),disabled:s,children:n(`remoteDisable`)}):null]}),o.shouldShowIssueHint&&g?(0,V.jsx)(T,{tone:`warning`,title:g.title,description:g.body}):null,(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:n(`remoteOpenWebHint`)})]})]}),(0,V.jsxs)(f,{children:[(0,V.jsxs)(ie,{children:[(0,V.jsxs)(l,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Zr,{className:`h-4 w-4 text-primary`}),n(`remoteDeviceSectionTitle`)]}),(0,V.jsx)(_,{children:n(`remoteDeviceSectionDescription`)})]}),(0,V.jsxs)(d,{className:`space-y-5`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(je,{status:r?.account.loggedIn?`ready`:`inactive`,label:r?.account.loggedIn?n(`remoteAccountConnected`):n(`remoteAccountNotConnected`)}),(0,V.jsx)(je,{status:r?.settings.enabled?`active`:`inactive`,label:r?.settings.enabled?n(`remoteEnabled`):n(`remoteStateDisabled`)}),(0,V.jsx)(je,{status:r?.service.running?`active`:`inactive`,label:r?.service.running?n(`remoteServiceRunning`):n(`remoteServiceStopped`)})]}),(0,V.jsxs)(T,{tone:`neutral`,children:[(0,V.jsx)(H,{label:n(`remoteDeviceName`),value:c}),(0,V.jsx)(H,{label:n(`remoteConnectionStatus`),value:m.badgeLabel}),(0,V.jsx)(H,{label:n(`remoteLastConnectedAt`),value:r?.runtime?.lastConnectedAt?i(r.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,V.jsx)(T,{tone:`neutral`,borderStyle:`dashed`,description:r?.account.loggedIn?n(`remoteOpenWebHint`):n(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var di=[`remote-status`],fi=`https://platform.nextclaw.io`,pi=`https://nextclaw-platform-console.pages.dev`,U=async()=>await m.fetchQuery({queryKey:di,queryFn:ee,staleTime:5e3}),W=async()=>(await m.invalidateQueries({queryKey:di}),await U()),mi=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function hi(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return fi;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return pi}var gi=e=>hi(e?.account.apiBase)||hi(e?.settings.platformApiBase)||hi(e?.platformBase)||hi(e?.account.platformBase)||void 0,G=s(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),_i=class{constructor(e){this.params=e,this.syncStatus=e=>{if(!e)return;let t=G.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{G.getState().setEnabled(e)},this.setDeviceName=e=>{G.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{G.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{G.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await W(),n=G.getState(),r=await this.ensureRemoteAccount(t,n.platformApiBase);await this.applyEnabledState(!0,r)},this.disableRemoteAccess=async e=>{let t=e??await W();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await W(),r=(await this.ensureRemoteAccount(t)).service.running?`restart`:`start`;await this.runManagedAction({actionLabel:n(r===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await ce(r);let e=await W();this.hydrateDraftFromStatus(e)},successMessage:n(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await W(),n=await this.params.accountManager.startBrowserSignInAndWait({status:t,apiBase:G.getState().platformApiBase});await this.repairRemoteAccess(n)},this.saveAdvancedSettings=async e=>{let t=e??await W(),r=G.getState();await this.runManagedAction({actionLabel:n(`remoteActionSavingAdvanced`),job:async()=>{await ue({enabled:r.enabled,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let e=await W();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===r.enabled?n(`remoteSettingsSaved`):n(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:n(`remoteDoctorRunning`),job:async()=>{let e=await ne();G.getState().setDoctor(e)},successMessage:n(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,n(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,n(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,n(`remoteActionStopping`))},this.applyEnabledState=async(e,t)=>{let r=G.getState();await this.runManagedAction({actionLabel:n(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await ue({enabled:e,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let n=await W();this.hydrateDraftFromStatus(n),e?await ce(n.service.running?`restart`:`start`):t.service.running&&await ce(`restart`);let i=await W();this.hydrateDraftFromStatus(i)},successMessage:n(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.ensureRemoteAccount=async(e,t)=>e.account.loggedIn?e:await this.params.accountManager.ensureSignedIn({apiBase:t,status:e}),this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await ce(e),n=await W();this.hydrateDraftFromStatus(n),C.success(t.message)}})},this.hydrateDraftFromStatus=e=>{G.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{let{actionLabel:t,job:r,successMessage:i}=e;G.getState().beginAction(t);try{await r(),i&&C.success(i)}catch(e){let t=e instanceof Error?e.message:n(`error`);throw C.error(t),e}finally{G.getState().finishAction()}}}},vi=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function yi(e){return e?.runtime?.lastError?.trim()||``}function bi(e){let t=n(`remoteStatusIssueDetailGeneric`),r=yi(e);return r?`${t} (${r})`:t}function xi(e){if(!e?.settings.enabled)return!1;let t=yi(e);return vi.some(e=>e.test(t))}function Si(e){return xi(e)?{hero:{badgeStatus:`warning`,badgeLabel:n(`remoteStateReauthorizationRequired`),title:n(`remoteStatusReauthorizationTitle`),description:n(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:n(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:n(`remoteStatusRecoveryTitle`),body:n(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:n(`statusReady`),title:n(`remoteStatusReadyTitle`),description:n(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:n(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:n(`connecting`),title:n(`remoteStatusConnectingTitle`),description:n(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:n(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:n(`remoteStateDisconnected`),title:n(`remoteStatusIssueTitle`),description:n(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:n(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:n(`remoteStatusRecoveryTitle`),body:bi(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:n(`remoteServiceStopped`),title:n(`remoteStatusNeedsServiceTitle`),description:n(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:n(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:n(`remoteStatusRecoveryTitle`),body:n(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:n(`statusInactive`),title:n(`remoteStatusNeedsEnable`),description:n(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:n(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:n(`statusSetup`),title:n(`remoteStatusNeedsSignIn`),description:n(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:n(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var K=s(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function Ci({label:e,value:t}){return(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,V.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,V.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function wi(e){let{email:t,username:r,role:i,canSubmitUsername:a,savingUsername:o,usernameDraft:s,onUsernameDraftChange:c,onSubmitUsername:l,onOpenDeviceList:u,onLogout:d}=e;return(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(T,{tone:`success`,title:n(`accountPanelSignedInTitle`),description:n(`accountPanelSignedInDescription`)}),(0,V.jsxs)(T,{tone:`neutral`,children:[(0,V.jsx)(Ci,{label:n(`remoteAccountEmail`),value:t}),(0,V.jsx)(Ci,{label:n(`remoteAccountUsername`),value:r}),(0,V.jsx)(Ci,{label:n(`remoteAccountRole`),value:i})]}),r?(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:n(`remoteAccountUsernameLockedHelp`)}):(0,V.jsxs)(T,{tone:`warning`,title:n(`remoteAccountUsernameRequiredTitle`),description:n(`remoteAccountUsernameRequiredDescription`),children:[(0,V.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,V.jsx)(g,{htmlFor:`account-panel-username`,children:n(`remoteAccountUsername`)}),(0,V.jsx)(v,{id:`account-panel-username`,value:s,onChange:e=>c(e.target.value),placeholder:n(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,V.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,V.jsx)(p,{disabled:!a,onClick:()=>void l(),children:n(o?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,V.jsxs)(p,{onClick:()=>void u(),children:[(0,V.jsx)(ii,{className:`mr-2 h-4 w-4`}),n(`remoteOpenDeviceList`)]}),(0,V.jsxs)(p,{variant:`outline`,onClick:()=>void d(),children:[(0,V.jsx)(Qr,{className:`mr-2 h-4 w-4`}),n(`remoteLogout`)]})]})]})}function Ti(e){let{authSessionId:t,authExpiresAt:r,authStatusMessage:a,authVerificationUri:o,onStartBrowserSignIn:s,onResumeBrowserSignIn:c}=e;return(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(T,{tone:`neutral`,title:n(`accountPanelSignedOutTitle`),description:n(`accountPanelSignedOutDescription`),children:t?(0,V.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,V.jsx)(Ci,{label:n(`remoteBrowserAuthSession`),value:t}),(0,V.jsx)(Ci,{label:n(`remoteBrowserAuthExpiresAt`),value:r?i(r):`-`})]}):null}),a?(0,V.jsx)(`p`,{className:`text-sm text-gray-600`,children:a}):null,(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,V.jsx)(p,{onClick:()=>void s(),children:n(t?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),o?(0,V.jsx)(p,{variant:`outline`,onClick:()=>void c(),children:n(`remoteBrowserAuthResume`)}):null]})]})}function Ei(){let e=us(),t=li(),r=K(e=>e.panelOpen),i=K(e=>e.authSessionId),a=K(e=>e.authVerificationUri),o=K(e=>e.authExpiresAt),s=K(e=>e.authStatusMessage),c=t.data,[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(!1);(0,A.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let p=!d&&l.trim().length>0&&!c?.account.username;return(0,V.jsx)(pe,{open:r,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,V.jsxs)(he,{className:`max-w-xl`,children:[(0,V.jsxs)(me,{children:[(0,V.jsxs)(ge,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Te,{className:`h-5 w-5 text-primary`}),n(`accountPanelTitle`)]}),(0,V.jsx)(fe,{children:n(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,V.jsx)(wi,{email:c.account.email,username:c.account.username,role:c.account.role,canSubmitUsername:p,savingUsername:d,usernameDraft:l,onUsernameDraftChange:u,onSubmitUsername:async()=>{f(!0);try{await e.accountManager.updateUsername(l)}finally{f(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,V.jsx)(Ti,{authSessionId:i,authExpiresAt:o,authStatusMessage:s,authVerificationUri:a,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}function Di({username:e}){let t=se(),[r,i]=(0,A.useState)(e??``),[a,o]=(0,A.useState)(``),s=r.trim().length>0&&a.length>0&&!t.isPending;return(0,V.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,V.jsxs)(f,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,V.jsxs)(ie,{children:[(0,V.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:n(`authBrand`)}),(0,V.jsx)(l,{className:`text-2xl`,children:n(`authLoginTitle`)}),(0,V.jsx)(_,{children:n(`authLoginDescription`)})]}),(0,V.jsx)(d,{children:(0,V.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),s&&t.mutate({username:r.trim(),password:a})},children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:n(`authUsername`)}),(0,V.jsx)(v,{value:r,onChange:e=>i(e.target.value),placeholder:n(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:n(`authPassword`)}),(0,V.jsx)(v,{type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:n(`authPasswordPlaceholder`)})]}),(0,V.jsx)(p,{type:`submit`,className:`w-full`,disabled:!s,children:t.isPending?n(`authLoggingIn`):n(`authLoginAction`)})]})})]})})}var Oi=class{constructor(){this.authPollTimerId=null,this.browserSignInCompletion=null,this.openAccountPanel=()=>{K.getState().openPanel()},this.closeAccountPanel=()=>{K.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),this.resolveBrowserSignIn(e),K.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=e?.status??await U();return t.account.loggedIn?t:(this.openAccountPanel(),await this.startBrowserSignInAndWait({apiBase:e?.apiBase,status:t}))},this.startBrowserSignInAndWait=async e=>{let t=this.createBrowserSignInCompletion();return await this.startBrowserSignIn(e),await t},this.startBrowserSignIn=async e=>{try{let t=e?.apiBase,r=await te({apiBase:mi(e?.status??await U(),t)});K.getState().beginBrowserAuth({sessionId:r.sessionId,verificationUri:r.verificationUri,expiresAt:r.expiresAt,intervalMs:r.intervalMs,statusMessage:n(`remoteBrowserAuthWaiting`)}),(await Me.openExternalUrl(r.verificationUri)).opened||K.getState().setAuthStatusMessage(n(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:n(`remoteBrowserAuthStartFailed`);this.rejectBrowserSignIn(e),C.error(`${n(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=async()=>{let e=K.getState().authVerificationUri;e&&await Me.openExternalUrl(e)},this.logout=async()=>{try{await oe(),this.rejectBrowserSignIn(Error(`Signed out before browser sign-in completed.`)),K.getState().clearBrowserAuth(),await W(),C.success(n(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:n(`remoteLogoutFailed`);C.error(`${n(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await ae({username:e.trim()}),await W(),C.success(n(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:n(`remoteAccountUsernameSetFailed`);C.error(`${n(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=gi(await U());if(!t){C.error(n(`remoteOpenWebUnavailable`));return}let r=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();await Me.openExternalUrl(r)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=K.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=K.getState();if(e.authSessionId)try{let t=await U(),r=await le({sessionId:e.authSessionId,apiBase:mi(t)});if(r.status===`pending`){K.getState().updateBrowserAuth({statusMessage:n(`remoteBrowserAuthWaiting`),intervalMs:r.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(r.status===`expired`){this.clearPollTimer(),this.rejectBrowserSignIn(Error(r.message||n(`remoteBrowserAuthExpired`))),K.getState().clearBrowserAuth(),C.error(r.message||n(`remoteBrowserAuthExpired`));return}K.getState().setAuthStatusMessage(n(`remoteBrowserAuthCompleted`));let i=await W();this.clearPollTimer(),this.resolveBrowserSignIn(i),K.getState().clearBrowserAuth(),C.success(n(`remoteLoginSuccess`))}catch(e){this.clearPollTimer(),this.rejectBrowserSignIn(e),K.getState().clearBrowserAuth();let t=e instanceof Error?e.message:n(`remoteBrowserAuthPollFailed`);C.error(`${n(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.createBrowserSignInCompletion=()=>(this.rejectBrowserSignIn(Error(`Browser sign-in was replaced by a newer request.`)),new Promise((e,t)=>{this.browserSignInCompletion={resolve:e,reject:t}})),this.resolveBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.resolve(e))},this.rejectBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.reject(e instanceof Error?e:Error(String(e))))},this.getBrowserAuthSummary=()=>{let e=K.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?i(e.authExpiresAt):`-`}}}};function ki({deletePending:e,entry:t,favoritePending:r,onDelete:i,onOpen:a,onToggleFavorite:o}){let[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(!1),d=t.favorite?n(`panelAppsUnfavorite`):n(`panelAppsFavorite`),f=t.lastOpenedAt?`${n(`panelAppsLastOpened`)} ${ji(t.lastOpenedAt)}`:`${n(`panelAppsUpdated`)} ${ji(t.updatedAt)}`,p=e=>{e.stopPropagation(),o()},m=()=>{c(!1),u(!0)};return(0,V.jsxs)(`div`,{className:`group w-full min-w-0 rounded-lg border border-gray-200 bg-white px-2.5 py-2.5 transition-colors hover:border-amber-200 hover:bg-amber-50/50`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:a,className:`min-w-0 flex-1 text-left`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-amber-50 text-base text-amber-700`,children:(0,V.jsx)(Mi,{icon:t.icon,title:t.title})}),(0,V.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-sm font-medium text-gray-900`,children:t.title})]}),t.description?(0,V.jsx)(`span`,{className:`mt-1.5 block truncate text-xs leading-5 text-gray-600`,children:t.description}):null,(0,V.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] leading-4 text-gray-400`,children:f})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:p,disabled:r,className:`rounded-md p-1.5 text-gray-400 transition-colors hover:bg-white hover:text-amber-500 disabled:opacity-50`,title:d,"aria-label":d,children:(0,V.jsx)(ai,{className:t.favorite?`h-4 w-4 fill-amber-400 text-amber-500`:`h-4 w-4`})}),(0,V.jsxs)(Fe,{open:s,onOpenChange:c,children:[(0,V.jsx)(Pe,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-gray-400 transition-colors hover:bg-white hover:text-gray-700`,"aria-label":n(`panelAppsMoreActions`),disabled:e,children:(0,V.jsx)(Yr,{className:`h-4 w-4`})})}),(0,V.jsx)(Ne,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,V.jsx)(Ai,{destructive:!0,disabled:e,icon:ke,label:n(`panelAppsDelete`),onClick:m})})]})]})]}),(0,V.jsx)(_e,{open:l,onOpenChange:u,title:n(`panelAppsDeleteConfirmTitle`),description:`${n(`panelAppsDeleteConfirmDescription`)} ${t.fileName}`,confirmLabel:n(`delete`),variant:`destructive`,onConfirm:i,onCancel:()=>void 0})]})}function Ai({destructive:t=!1,disabled:n=!1,icon:r,label:i,onClick:a}){return(0,V.jsxs)(`button`,{type:`button`,className:e(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,t?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),disabled:n,onClick:a,children:[(0,V.jsx)(r,{className:`h-4 w-4 shrink-0`}),(0,V.jsx)(`span`,{children:i})]})}function ji(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=o(a()),r=new Date;return t.toDateString()===r.toDateString()?new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`}).format(t):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(n,{month:`numeric`,day:`numeric`}).format(t):new Intl.DateTimeFormat(n,{year:`2-digit`,month:`numeric`,day:`numeric`}).format(t)}function Mi({icon:e,title:t}){return e?Ni(e)?(0,V.jsx)(`img`,{src:e,alt:``,"aria-hidden":`true`,className:`h-5 w-5 rounded-sm object-contain`,title:t}):(0,V.jsx)(`span`,{className:`max-w-6 truncate text-center leading-none`,children:e}):(0,V.jsx)(Ur,{className:`h-4 w-4`})}function Ni(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}var Pi=[`panel-apps`];function Fi(){return b({queryKey:Pi,queryFn:()=>x.panelApps.listPanelApps(),staleTime:0})}function Ii(){let e=y();return u({mutationFn:({id:e,preferences:t})=>x.panelApps.updatePanelAppPreferences(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:Pi})}})}function Li(){let e=y();return u({mutationFn:e=>x.panelApps.recordPanelAppOpened(e),onSuccess:()=>{e.invalidateQueries({queryKey:Pi})}})}function Ri(){let e=y();return u({mutationFn:e=>x.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:Pi})}})}function zi(){let e=y();return u({mutationFn:e=>x.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:Pi})}})}function Bi(e,t){return t===`favorites`?Vi(e.filter(e=>e.favorite),`smart`):Vi(t===`recent-open`?e.filter(e=>e.lastOpenedAt):e,t)}function Vi(e,t){return[...e].sort((e,n)=>Hi(e,n,t))}function Hi(e,t,n){return n===`recent-open`?Ki(e.lastOpenedAt,t.lastOpenedAt)||Ui(e,t):n===`updated`?Ki(e.updatedAt,t.updatedAt)||Ui(e,t):n===`name`?Ui(e,t):Wi(e,t)||Number(t.favorite)-Number(e.favorite)||Ui(e,t)}function Ui(e,t){return e.title.localeCompare(t.title)}function Wi(e,t){return Gi(t)-Gi(e)}function Gi(e){return Math.max(new Date(e.lastOpenedAt??0).getTime(),new Date(e.createdAt).getTime(),new Date(e.updatedAt).getTime())}function Ki(e,t){return new Date(t??0).getTime()-new Date(e??0).getTime()}function qi({headerContent:e,onOpenPanelApp:t}){let r=Fi(),i=zi(),a=Ii(),o=Li(),s=Ri(),c=us(),[l,u]=(0,A.useState)(`smart`),d=(0,A.useMemo)(()=>Bi(r.data?.entries??[],l),[r.data?.entries,l]),f=async e=>{if(await p(e))try{t(await o.mutateAsync(e.id))}catch{t(e)}},p=async e=>!e.clientDeclared||e.clientGranted?!0:await c.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:n(`panelAppsClientGrantTitle`),actionDescription:n(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await s.mutateAsync(e.appId),!0):!1,m=e=>{a.mutate({id:e.id,preferences:{favorite:!e.favorite}})},h=e=>{i.mutate(e.id)};return r.isLoading?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-gray-500`,children:n(`panelAppsLoading`)}):r.isError?(0,V.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:r.error instanceof Error?r.error.message:n(`panelAppsLoadFailed`)}):(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e??(0,V.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:n(`panelAppsTitle`)}),r.data?.panelsPath?(0,V.jsx)(Se,{delayDuration:250,children:(0,V.jsxs)(Ce,{children:[(0,V.jsx)(be,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700`,"aria-label":n(`panelAppsTitle`),children:(0,V.jsx)(qr,{className:`h-3.5 w-3.5`})})}),(0,V.jsx)(xe,{side:`bottom`,className:`max-w-[320px] break-all font-mono text-xs`,children:r.data.panelsPath})]})}):null]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void r.refetch(),className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800`,title:n(`panelAppsRefresh`),"aria-label":n(`panelAppsRefresh`),children:(0,V.jsx)(Oe,{className:`h-3.5 w-3.5`})})]}),(0,V.jsx)(`div`,{className:`border-b border-gray-100 px-3 py-2`,children:(0,V.jsx)(Le,{value:l,onValueChange:e=>u(e),children:(0,V.jsxs)(Ie,{className:`grid h-auto w-full grid-cols-5 rounded-lg bg-gray-100/70 p-0.5`,children:[(0,V.jsx)(E,{value:`smart`,className:`px-2 py-1 text-xs`,children:n(`panelAppsSortSmart`)}),(0,V.jsx)(E,{value:`favorites`,className:`px-2 py-1 text-xs`,children:n(`panelAppsFavorites`)}),(0,V.jsx)(E,{value:`recent-open`,className:`px-2 py-1 text-xs`,children:n(`panelAppsSortRecentOpen`)}),(0,V.jsx)(E,{value:`updated`,className:`px-2 py-1 text-xs`,children:n(`panelAppsSortUpdated`)}),(0,V.jsx)(E,{value:`name`,className:`px-2 py-1 text-xs`,children:n(`panelAppsSortName`)})]})})}),d.length===0?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-gray-500`,children:n(`panelAppsEmpty`)}):(0,V.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,V.jsx)(`div`,{className:`space-y-1.5`,children:d.map(e=>(0,V.jsx)(ki,{entry:e,deletePending:i.isPending,favoritePending:a.isPending,onDelete:()=>h(e),onOpen:()=>void f(e),onToggleFavorite:()=>m(e)},e.id))})})]})}var Ji=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t,iframeInstanceId:n,tab:r})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t,iframeInstanceId:n,tab:r},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,t)=>{switch(t.method){case`list`:return await x.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(t));case`revokeGrant`:return await x.serviceApps.revokeServiceAction(this.requireActionId(t),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,t);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,t);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,t);default:throw Error(`Unsupported panel bridge method: ${String(t.method)}`)}},this.invokeWithAuthorization=async(e,t)=>{let n=this.requireActionId(t);try{return await x.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof S)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrant(e,n,this.readOptionalRecord(t.payload?.input)),await x.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,t)=>{try{return await x.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof S)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await x.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,t)=>{try{return await x.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof S)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await x.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,t)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:t,actionTitle:t===`agent:send`?`Send agent message`:`Generate object`,actionDescription:t===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new S({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});return await x.panelApps.grantAgentCapability(t,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,t,n)=>{let r=await this.listGrantCandidateActions(e,t);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:r.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(n)}))throw new S({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});let i=await x.serviceApps.grantServiceActions(r.map(e=>e.id),{bridgeSessionToken:e.token}),a=i.grants.find(e=>e.actionId===t)??i.grants[0];if(!a)throw Error(`No permission grant returned for ${t}.`);return a},this.listGrantCandidateActions=async(e,t)=>{let n=await x.serviceApps.listServiceActions({bridgeSessionToken:e.token}),r=n.actions.find(e=>e.id===t);if(r&&r.grantState!==`not-granted`)return[r];let i=n.actions.filter(e=>e.grantState===`not-granted`),a=[...i.filter(e=>e.id===t),...i.filter(e=>e.id!==t)];return a.length>0?a:[{appId:r?.appId??t.split(`.`)[0]??t,description:r?.description,id:t,name:r?.name??t,risk:r?.risk??`dangerous`,title:r?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof S?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`)}}};function Yi(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var Xi=s((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:Yi(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}}));function Zi(){let e=Xi(e=>e.pending),t=Xi(e=>e.resolveAuthorization);return(0,V.jsx)(pe,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,V.jsxs)(he,{className:`[&>:last-child]:hidden`,children:[(0,V.jsxs)(me,{children:[(0,V.jsxs)(ge,{className:`flex items-center gap-2`,children:[(0,V.jsx)(ni,{className:`h-4 w-4 text-amber-600`}),n(`serviceActionAuthorizationTitle`)]}),(0,V.jsx)(fe,{children:n(`serviceActionAuthorizationDescription`)})]}),e?(0,V.jsxs)(`div`,{className:`space-y-3 rounded-md border border-gray-100 bg-gray-50 p-3 text-sm`,children:[(0,V.jsx)($i,{label:n(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`div`,{className:`text-xs font-medium text-gray-500`,children:n(`serviceActionAuthorizationActions`)}),(0,V.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,V.jsx)(Qi,{action:e},e.actionId))})]}),e.inputPreview?(0,V.jsx)($i,{label:n(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,V.jsxs)(de,{className:`gap-2 sm:gap-0`,children:[(0,V.jsx)(p,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:n(`serviceActionAuthorizationReject`)}),(0,V.jsx)(p,{type:`button`,onClick:()=>t(!0),children:n(`serviceActionAuthorizationAllow`)})]})]})})}function Qi({action:e}){return(0,V.jsxs)(`div`,{className:`space-y-1 rounded border border-gray-200 bg-white px-3 py-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-gray-900`,children:e.actionTitle??e.actionId}),(0,V.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,V.jsx)(`div`,{className:`break-words text-[11px] text-gray-500`,children:e.actionId}),e.actionDescription?(0,V.jsx)(`div`,{className:`break-words text-xs text-gray-600`,children:e.actionDescription}):null]})}function $i({label:e,value:t}){return(0,V.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,V.jsx)(`div`,{className:`text-xs font-medium text-gray-500`,children:e}),(0,V.jsx)(`div`,{className:`min-w-0 break-words text-xs text-gray-900`,children:t})]})}var ea=class{constructor(){this.requestAuthorization=async e=>await Xi.getState().requestAuthorization(e)}},ta=[`service-apps`],na=[`service-actions`],ra=[`service-action-grants`];function ia(){return b({queryKey:ta,queryFn:()=>x.serviceApps.listServiceApps()})}function aa(){return b({queryKey:na,queryFn:()=>x.serviceApps.listServiceActions()})}function oa(){return b({queryKey:ra,queryFn:()=>x.serviceApps.listServiceActionGrants()})}function sa(){let e=y();return u({mutationFn:e=>x.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:ta}),e.invalidateQueries({queryKey:na})])}})}function ca(){let e=y();return u({mutationFn:e=>x.serviceApps.deleteServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:ta}),e.invalidateQueries({queryKey:na}),e.invalidateQueries({queryKey:ra})])}})}function la(){let e=y();return u({mutationFn:e=>x.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:ta})}})}function ua(){let e=y();return u({mutationFn:e=>x.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:na}),e.invalidateQueries({queryKey:ra})])}})}function da({headerContent:e}){let t=ia(),r=aa(),i=oa(),a=ca(),o=sa(),s=la(),c=ua(),[l,u]=(0,A.useState)({}),d=()=>{t.refetch(),r.refetch(),i.refetch()};if(t.isLoading||r.isLoading||i.isLoading)return(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-gray-500`,children:n(`serviceAppsLoading`)});if(t.isError||r.isError||i.isError){let e=t.error??r.error??i.error;return(0,V.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:n(`serviceAppsLoadFailed`)})}let f=t.data?.entries??[],p=r.data?.actions??[],m=i.data?.grants??[],h=e=>{s.mutateAsync(e).then(t=>{u(n=>({...n,[e]:t.actions}))})};return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3`,children:[(0,V.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:e??(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ti,{className:`h-4 w-4 text-primary`}),(0,V.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:n(`serviceAppsTitle`)})]})}),(0,V.jsx)(Se,{delayDuration:250,children:(0,V.jsx)(ha,{icon:Oe,label:n(`serviceAppsRefresh`),onClick:d})})]}),f.length===0?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-gray-500`,children:n(`serviceAppsEmpty`)}):(0,V.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,V.jsx)(`div`,{className:`space-y-3`,children:f.map(e=>(0,V.jsx)(fa,{app:e,actions:l[e.id]??p.filter(t=>t.appId===e.id),grants:m,deletePending:a.isPending,isDiscovering:s.isPending,onDiscover:h,onDelete:e=>void a.mutate(e),onRestart:e=>void o.mutate(e),onRevoke:e=>void c.mutate({actionId:e.actionId,caller:e.caller})},e.id))})})]})}function fa({app:e,actions:t,grants:r,deletePending:i,isDiscovering:a,onDiscover:o,onDelete:s,onRestart:c,onRevoke:l}){let[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1),m=e.status!==`starting`&&e.status!==`stopped`,h=e.status===`running`||e.status===`failed`,g=()=>{d(!1),p(!0)};return(0,V.jsx)(Se,{delayDuration:250,children:(0,V.jsxs)(`section`,{className:`rounded-lg border border-gray-200 bg-white p-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.title}),(0,V.jsx)(pa,{status:e.status})]}),e.description?(0,V.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-gray-500`,children:e.description}):null,e.lastError?(0,V.jsx)(`div`,{className:`mt-2 rounded bg-rose-50 px-2 py-1 text-xs text-rose-700`,children:e.lastError}):null]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,V.jsx)(ha,{disabled:a||!m,icon:$r,label:n(`serviceAppsDiscoverActions`),tooltip:n(`serviceAppsDiscoverActionsHint`),onClick:()=>o(e.id)}),(0,V.jsx)(ha,{disabled:!h,icon:si,label:n(`serviceAppsDisconnectRuntime`),tooltip:n(`serviceAppsDisconnectRuntimeHint`),onClick:()=>c(e.id)}),(0,V.jsxs)(Fe,{open:u,onOpenChange:d,children:[(0,V.jsxs)(Ce,{children:[(0,V.jsx)(be,{asChild:!0,children:(0,V.jsx)(Pe,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800 disabled:opacity-50`,"aria-label":n(`serviceAppsMoreActions`),disabled:i,children:(0,V.jsx)(Yr,{className:`h-3.5 w-3.5`})})})}),(0,V.jsx)(xe,{side:`bottom`,className:`text-xs`,children:n(`serviceAppsMoreActions`)})]}),(0,V.jsx)(Ne,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,V.jsx)(ga,{destructive:!0,disabled:i,icon:ke,label:n(`serviceAppsDelete`),onClick:g})})]})]})]}),(0,V.jsx)(_a,{app:e}),(0,V.jsx)(`div`,{className:`mt-3 space-y-1`,children:t.map(e=>(0,V.jsx)(ya,{action:e,grants:r.filter(t=>t.actionId===e.id),onRevoke:l},e.id))}),(0,V.jsx)(_e,{open:f,onOpenChange:p,title:n(`serviceAppsDeleteConfirmTitle`),description:`${n(`serviceAppsDeleteConfirmDescription`)} ${e.title}`,confirmLabel:n(`delete`),variant:`destructive`,onConfirm:()=>s(e.id),onCancel:()=>void 0})]})})}function pa({status:t}){let n=ma(t),r=n.icon;return(0,V.jsxs)(Ce,{children:[(0,V.jsx)(be,{asChild:!0,children:(0,V.jsxs)(`span`,{className:e(`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium`,n.className),"aria-label":n.label,children:[(0,V.jsx)(r,{className:e(`h-3 w-3`,n.iconClassName)}),(0,V.jsx)(`span`,{children:n.label})]})}),(0,V.jsx)(xe,{side:`bottom`,className:`text-xs`,children:n.tooltip})]})}function ma(e){switch(e){case`running`:return{className:`bg-emerald-50 text-emerald-700`,icon:Gr,label:n(`serviceAppsStatus_running`),tooltip:n(`serviceAppsStatusHint_running`)};case`starting`:return{className:`bg-blue-50 text-blue-700`,icon:Ee,iconClassName:`animate-spin`,label:n(`serviceAppsStatus_starting`),tooltip:n(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`bg-rose-50 text-rose-700`,icon:oi,label:n(`serviceAppsStatus_failed`),tooltip:n(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`bg-gray-100 text-gray-600`,icon:Jr,label:n(`serviceAppsStatus_stopped`),tooltip:n(`serviceAppsStatusHint_stopped`)};default:return{className:`bg-slate-100 text-slate-600`,icon:Kr,label:n(`serviceAppsStatus_idle`),tooltip:n(`serviceAppsStatusHint_idle`)}}}function ha({disabled:e=!1,icon:t,label:n,tooltip:r=n,onClick:i}){return(0,V.jsxs)(Ce,{children:[(0,V.jsx)(be,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,onClick:i,disabled:e,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent`,"aria-label":n,children:(0,V.jsx)(t,{className:`h-3.5 w-3.5`})})}),(0,V.jsx)(xe,{side:`bottom`,className:`max-w-56 text-xs`,children:r})]})}function ga({destructive:t=!1,disabled:n=!1,icon:r,label:i,onClick:a}){return(0,V.jsxs)(`button`,{type:`button`,className:e(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,t?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),disabled:n,onClick:a,children:[(0,V.jsx)(r,{className:`h-4 w-4 shrink-0`}),(0,V.jsx)(`span`,{children:i})]})}function _a({app:e}){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `),r=[{label:n(`serviceAppsCommand`),value:t},{label:n(`serviceAppsCwd`),value:e.cwd},{label:n(`serviceAppsManifest`),value:e.manifestPath},{label:n(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:n(`serviceAppsLastReady`),value:e.lastReadyAt},{label:n(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value);return r.length===0?null:(0,V.jsx)(`dl`,{className:`mt-3 grid grid-cols-[4.5rem_minmax(0,1fr)] gap-x-2 gap-y-1 border-t border-gray-100 pt-2 text-[11px]`,children:r.map(e=>(0,V.jsx)(va,{label:e.label,value:e.value},e.label))})}function va({label:e,value:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`text-gray-400`,children:e}),(0,V.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-gray-500`,title:t,children:t})]})}function ya({action:e,grants:t,onRevoke:r}){return(0,V.jsxs)(`div`,{className:`rounded bg-gray-50 px-2 py-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(ci,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`truncate text-xs font-medium text-gray-800`,children:e.title??e.name}),e.description?(0,V.jsx)(`div`,{className:`truncate text-[11px] text-gray-500`,children:e.description}):null]})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,V.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-gray-600`,children:n(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,V.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-gray-600`,children:e.risk})]})]}),t.map(e=>(0,V.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2 pl-5`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-gray-500`,children:[(0,V.jsx)(ri,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,V.jsxs)(`span`,{className:`truncate`,children:[n(`serviceAppsGrantedTo`),` `,e.caller.appId]})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`rounded-md p-1 text-gray-400 transition-colors hover:bg-white hover:text-rose-600`,title:n(`serviceAppsRevokeGrant`),"aria-label":n(`serviceAppsRevokeGrant`),children:(0,V.jsx)(ke,{className:`h-3 w-3`})})]},`${e.caller.surface}:${e.caller.appId}:${e.actionId}`))]})}function ba({activeTab:e,onActiveTabChange:t,onOpenPanelApp:r}){let i=(0,V.jsx)(Le,{value:e,onValueChange:e=>t(e),children:(0,V.jsxs)(Ie,{className:`grid h-auto w-[min(340px,100%)] grid-cols-2 rounded-lg bg-gray-100/70 p-0.5`,children:[(0,V.jsxs)(E,{value:`panel-apps`,className:`gap-1.5 px-2 py-1.5 text-xs`,children:[(0,V.jsx)(Ur,{className:`h-3.5 w-3.5`}),n(`panelAppsTitle`)]}),(0,V.jsxs)(E,{value:`service-apps`,className:`gap-1.5 px-2 py-1.5 text-xs`,children:[(0,V.jsx)(ti,{className:`h-3.5 w-3.5`}),n(`serviceAppsTitle`)]})]})});return(0,V.jsx)(`div`,{className:`h-full min-h-0 bg-white`,children:e===`panel-apps`?(0,V.jsx)(qi,{headerContent:i,onOpenPanelApp:r}):(0,V.jsx)(da,{headerContent:i})})}function xa({appTitle:e,onOpenApps:t,onRefresh:r}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,className:`inline-flex shrink-0 items-center rounded-md p-1.5 text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,title:n(`appsTitle`),"aria-label":n(`appsTitle`),children:(0,V.jsx)(ve,{className:`h-3.5 w-3.5`})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-gray-600`,title:e,children:e}),(0,V.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800`,title:n(`panelAppsRefreshCurrent`),"aria-label":n(`panelAppsRefreshCurrent`),children:(0,V.jsx)(Oe,{className:`h-3.5 w-3.5`})})]})}function Sa(e){return e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0)}function q(e){let t=e.trim();try{let e=new URL(t);return{authority:e.hostname,pathSegments:Sa(e.pathname),pathname:e.pathname,raw:t,scheme:e.protocol.replace(/:$/,``).toLowerCase(),searchParams:e.searchParams}}catch{return{authority:``,pathSegments:Sa(t),pathname:t,raw:t,scheme:``,searchParams:new URLSearchParams}}}var Ca=class{constructor(e,t){this.routeDefinitions=e,this.options=t,this.resolve=e=>{let t=q(e);return this.findDefinition(t).resolve(t)},this.normalize=e=>this.options.getNormalizedUri(this.resolve(e)),this.areEquivalent=(e,t)=>this.findDefinition(q(e)).areEquivalent?.(e,t)??this.normalize(e)===this.normalize(t),this.findDefinition=e=>{let t=this.routeDefinitions.find(t=>t.match(e));if(!t)throw Error(`Unsupported resource URI: ${e.raw}`);return t}}},wa=`home`,Ta=`nextclaw://new-tab`,Ea=`apps`,J=`nextclaw://apps`,Da=`${J}?tab=service-apps`,Oa=`panel-app`,ka=`panel-apps`;function Aa(e){return e===`panel-apps`||e===`service-apps`}function ja(e=ka){return e===ka?J:Da}function Ma(e){try{let t=new URL(e).searchParams.get(`tab`);return Aa(t)?t:ka}catch{return ka}}function Na(e){return ja(Ma(e))}function Pa(e){return`nextclaw://panel-app/${encodeURIComponent(e)}`}function Fa(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}function Ia(e){let t=e.icon?.trim();if(t)return Fa(t)?{type:`url`,url:t}:{type:`text`,value:t}}function La(e){return{dedupeKey:`panel-app:${e.id}`,dockIcon:Ia(e),historyPolicy:`managed`,kind:Oa,resourceUri:Pa(e.id),title:e.title,url:e.contentPath}}function Ra(e,t){return e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}/`)}function za(e){let t=e.pathSegments.join(`/`);return ze(t?`/${t}`:`/`,`docs`)}function Ba(e){let t=e.filter(e=>e.trim().length>0).map(e=>encodeURIComponent(decodeURIComponent(e))).join(`/`);return t?`nextclaw://docs/${t}`:`nextclaw://docs`}function Va(e){let t=k(e),n=t.startsWith(`/`)?t:(()=>{try{return new URL(e).pathname}catch{return``}})();return n?Ba(n.split(`/`)):`nextclaw://docs`}function Y(e){if(e.scheme===`nextclaw`&&e.authority===`panel-app`)return e.pathSegments[0]??``;let[t,n,r,i]=e.pathSegments;return t===`api`&&n===`panel-apps`&&r!==void 0&&r.length>0&&i===`content`?r:``}function Ha(e){return Y(e).length>0}function Ua(e){let t=Y(e);return t?`/api/panel-apps/${encodeURIComponent(decodeURIComponent(t))}/content`:`nextclaw://panel-app`}function Wa(e){let t=Y(e);return t?`nextclaw://panel-app/${encodeURIComponent(decodeURIComponent(t))}`:`nextclaw://panel-app`}function Ga(e,t){let n=q(e),r=q(t),i=Y(n),a=Y(r);return i.length>0&&a.length>0?decodeURIComponent(i)===decodeURIComponent(a):e===t}var X=[{defaultUrl:()=>Ta,id:`home`,kind:wa,match:e=>e.raw===Ta,resolve:()=>({historyPolicy:`managed`,kind:wa,resourceUri:Ta,title:n(`docBrowserHomeTitle`),url:Ta}),areEquivalent:(e,t)=>e===t},{defaultUrl:O,id:`docs-url`,kind:`docs`,match:e=>He(e.raw),resolve:e=>{let t=ze(e.raw,`docs`);return{historyPolicy:`managed`,kind:`docs`,resourceUri:Va(t),title:n(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>k(e)===k(t)},{defaultUrl:O,id:`nextclaw-docs`,kind:`docs`,match:e=>e.scheme===`nextclaw`&&e.authority===`docs`,resolve:e=>{let t=za(e);return{historyPolicy:`managed`,kind:`docs`,resourceUri:Ba(e.pathSegments),title:n(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>k(e)===k(t)},{defaultUrl:()=>J,id:`apps`,kind:Ea,match:e=>Ra(e.raw,J),resolve:e=>{let t=Na(e.raw);return{dedupeKey:`apps`,historyPolicy:`managed`,kind:Ea,resourceUri:t,title:n(t===`nextclaw://apps`?`appsTitle`:`serviceAppsTitle`),url:t}},areEquivalent:(e,t)=>Na(e)===Na(t)},{defaultUrl:()=>`nextclaw://panel-app`,id:`panel-app`,kind:Oa,match:e=>e.scheme===`nextclaw`&&e.authority===`panel-app`||Ha(e),resolve:e=>{let t=Ua(e),r=Y(e);return{dedupeKey:r?`panel-app:${decodeURIComponent(r)}`:void 0,historyPolicy:`managed`,kind:Oa,resourceUri:Wa(e),title:n(`panelAppsTitle`),url:t}},areEquivalent:Ga},{defaultUrl:()=>`about:blank`,id:`content`,kind:`content`,match:()=>!0,resolve:e=>({historyPolicy:`managed`,kind:`content`,resourceUri:e.raw||`about:blank`,title:Ge(e.raw,`content`,`Detail`),url:e.raw||`about:blank`}),areEquivalent:(e,t)=>e===t}],Ka=X.map(e=>({areEquivalent:e.areEquivalent,id:e.id,match:e.match,resolve:e.resolve}));function qa(){return[{id:`apps`,label:n(`appsTitle`),target:{type:`right-panel-resource`,uri:J}},{id:`service-apps`,label:n(`serviceAppsTitle`),target:{type:`right-panel-resource`,uri:Da}},{id:`docs`,label:n(`docBrowserHelp`),target:{options:{newTab:!0},type:`right-panel-resource`,uri:O()}},{id:`skill-marketplace`,label:n(`marketplaceSkillsPageTitle`),target:{path:`/marketplace/skills`,type:`app-route`}}]}var Ja={apps:{accentClassName:`bg-emerald-50 text-emerald-700`,hoverAccentClassName:`group-hover:bg-emerald-100`,icon:(0,V.jsx)(we,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700`,hoverAccentClassName:`group-hover:bg-sky-100`,icon:(0,V.jsx)(Xr,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700`,hoverAccentClassName:`group-hover:bg-amber-100`,icon:(0,V.jsx)(ye,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700`,hoverAccentClassName:`group-hover:bg-rose-100`,icon:(0,V.jsx)(Wr,{className:`h-5 w-5`})}};function Ya(e){return Ja[e.id]??{accentClassName:`bg-gray-50 text-gray-700`,hoverAccentClassName:`group-hover:bg-gray-100`,icon:(0,V.jsx)(we,{className:`h-5 w-5`})}}function Xa({open:t}){let n=on(),r=qa(),i=e=>{if(e.type===`app-route`){n(e.path);return}t(e.uri,e.options)};return(0,V.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5`,children:(0,V.jsx)(`div`,{className:`mx-auto w-full max-w-[520px]`,children:(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(76px,1fr))] gap-x-2 gap-y-4`,children:r.map(t=>{let n=Ya(t);return(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i(t.target),className:`group flex min-h-[68px] flex-col items-center gap-1.5 rounded-md px-1.5 py-1.5 text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,V.jsx)(`span`,{className:e(`flex h-10 w-10 shrink-0 items-center justify-center rounded-md transition-colors`,n.accentClassName,n.hoverAccentClassName),children:n.icon}),(0,V.jsx)(`span`,{className:`line-clamp-2 min-w-0 max-w-full text-xs font-medium leading-snug text-gray-700 transition-colors group-hover:text-gray-900`,children:t.label})]},t.id)})})})})}function Za(e){return e&&He(e)?`docs`:`content`}var Qa=class{constructor(){this.resourceUriResolver=new Ca(Ka,{getNormalizedUri:e=>e.resourceUri??e.url}),this.resolve=e=>this.resourceUriResolver.resolve(e),this.normalize=e=>this.resourceUriResolver.normalize(e),this.areEquivalent=(e,t)=>this.resourceUriResolver.areEquivalent(e,t),this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=this.resolveRouteDefinition(r,n,t),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i.defaultUrl());return i.resolve(q(a))},this.areUrlsEquivalent=(e,t,n,r)=>n===r?this.resolveRouteDefinition(e,n).areEquivalent?.(e,t)??this.areEquivalent(e,t):!1,this.usesManagedHistory=e=>this.resolveRouteDefinition(e.currentUrl,e.kind).resolve(q(e.currentUrl)).historyPolicy===`managed`,this.resolveRouteDefinition=(e,t,n)=>{let r=t??(e?void 0:n?.kind),i=r?X.find(e=>e.kind===r):void 0;if(i)return i;let a=e?q(e):null,o=a?X.find(e=>e.match(a)):void 0;if(o)return o;let s=t??n?.kind??Za(e);return X.find(e=>e.kind===s)??X[X.length-1]}}},$a=Ea,eo=Oa,to=`panel-apps`,no=[`allow-scripts`,`allow-forms`,`allow-modals`,`allow-popups`,`allow-popups-to-escape-sandbox`,`allow-downloads`,`allow-pointer-lock`,`allow-presentation`].join(` `);function ro(e){return e===`panel-apps`||e===`service-apps`}function io(e=to){return e===to?J:Da}function ao(e){try{let t=new URL(e).searchParams.get(`tab`);return ro(t)?t:to}catch{return to}}function oo(e){e.open(io(),{kind:$a,title:n(`appsTitle`),dedupeKey:`apps`})}var so={[wa]:{getTitle:()=>n(`docBrowserHomeTitle`),renderContent:({open:e})=>(0,V.jsx)(Xa,{open:e})},[$a]:{getTitle:()=>n(`appsTitle`),renderIcon:()=>(0,V.jsx)(we,{className:`w-4 h-4 text-primary shrink-0`}),renderContent:({currentUrl:e,open:t,openTarget:r})=>(0,V.jsx)(ba,{activeTab:ao(e),onActiveTabChange:e=>t(io(e),{activate:!1,kind:$a,title:n(`appsTitle`),dedupeKey:`apps`}),onOpenPanelApp:e=>r(La(e))})},[eo]:{getIframeSandbox:()=>no,getTitle:e=>e.title||n(`panelAppsTitle`),onIframeMessage:e=>ss().panelAppBridgeManager.handleIframeMessage(e),renderIcon:()=>(0,V.jsx)(Ur,{className:`w-4 h-4 text-primary shrink-0`}),renderToolbar:({open:e,refreshIframe:t,tab:r})=>(0,V.jsx)(xa,{appTitle:r.title||n(`panelAppsTitle`),onOpenApps:()=>oo({open:e}),onRefresh:t})}},co=`nextclaw://docs`;function lo(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:n(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:J}},{builtIn:!0,icon:{type:`builtin`,name:`service-apps`},id:`service-apps`,label:n(`serviceAppsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:Da}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:n(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:co}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:n(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:Ta}}]}var uo=[`apps`,`docs`,`new-tab`,`panel-app`,`service-apps`];function fo(e){return!!e&&typeof e==`object`}function po(e){return uo.includes(e)}function mo(e){return!fo(e)||typeof e.type!=`string`?null:e.type===`builtin`&&po(e.name)?{type:`builtin`,name:e.name}:e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function ho(e){if(!fo(e)||typeof e.id!=`string`||e.id.trim().length===0||typeof e.label!=`string`||e.label.trim().length===0||typeof e.createdAt!=`string`||e.createdAt.trim().length===0||!fo(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=mo(e.icon);return t?{createdAt:e.createdAt,icon:t,id:e.id.trim(),label:e.label.trim(),target:{type:`right-panel-resource`,uri:e.target.uri.trim()}}:null}function go(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=ho(e);n&&t.set(n.id,n)}),Array.from(t.values())}function _o(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function vo(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function yo(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(e=>e.target.uri)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(vo);return[...e,...i]}var bo=`nextclaw.side-dock.state`,xo=1;function So(e){return!!e&&typeof e==`object`}var Co=s()(Re(e=>({pinnedItems:[],setPinnedItems:t=>e({pinnedItems:go(t)})}),{name:bo,version:xo,storage:qe(()=>window.localStorage),partialize:e=>({pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=So(e)?go(e.pinnedItems):[];return{...t,pinnedItems:n}}})),wo={apps:we,docs:ye,"new-tab":De,"panel-app":Ur,"service-apps":Ur},To=/^\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*$/u;function Eo(e){return To.test(e.trim())}function Do({icon:e}){if(e.type===`url`)return(0,V.jsx)(`img`,{src:e.url,alt:``,className:`h-5 w-5 rounded object-cover`});if(e.type===`text`)return Eo(e.value)?(0,V.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center text-[20px] leading-none`,"aria-hidden":`true`,children:e.value}):(0,V.jsx)(`span`,{className:`max-w-7 truncate text-center text-[13px] font-semibold leading-none`,"aria-hidden":`true`,children:e.value});let t=wo[e.name];return(0,V.jsx)(t,{className:`h-5 w-5`,"aria-hidden":`true`})}function Oo({active:t,item:r,onOpen:i,onUnpin:a}){let{label:o}=r;return(0,V.jsxs)(Ce,{children:[(0,V.jsxs)(`div`,{className:`group relative`,children:[(0,V.jsx)(be,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":o,title:o,"data-side-dock-item-id":r.id,onClick:()=>i(r),className:e(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,t?`bg-primary/10 text-primary`:`bg-transparent`),children:(0,V.jsx)(Do,{icon:r.icon})})}),r.removable?(0,V.jsx)(`button`,{type:`button`,"aria-label":n(`sideDockUnpinItem`),title:n(`sideDockUnpinItem`),onClick:e=>{e.stopPropagation(),a(r)},className:`absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-background text-muted-foreground shadow-sm ring-1 ring-border/70 transition-colors hover:bg-muted hover:text-foreground group-hover:flex focus-visible:flex focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,V.jsx)(Ae,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]}),(0,V.jsx)(xe,{side:`left`,children:o})]})}function Z(e){return e?.trim()??``}function ko(e,t,n,r=!1){if(!t||!n)return!1;let i=Z(e.target.uri),a=Z(n.resourceUri);return a&&a===i||Z(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function Ao(e,t){if(!t)return!1;let n=Z(t.resourceUri),r=Z(t.currentUrl);return e.some(e=>{let t=Z(e.target.uri);return t===n||t===r})}function jo({manager:e}){let t=Co(e=>e.pinnedItems),{currentTab:n,isOpen:r}=Ue(),i=yo(lo(),t),a=Ao(i,n);return(0,V.jsx)(Se,{delayDuration:250,children:(0,V.jsx)(`aside`,{"data-testid":`side-dock`,className:`z-30 flex h-full w-14 shrink-0 flex-col items-center gap-1 border-l border-border/60 bg-background/95 px-2 py-3`,children:i.map(t=>(0,V.jsx)(Oo,{active:ko(t,r,n,a),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id))})})}var Mo=`pinned`,No=new Set([`apps`,`docs`,`new-tab`,`panel-app`,`service-apps`]);function Q(e){return e.trim()}function Po(e){let t=0;return Array.from(Q(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${Mo}-${Q(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function Fo(e){return e?.type===`builtin`&&No.has(e.name)?{type:`builtin`,name:e.name}:e?.type===`url`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e?.type===`text`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function Io(e){return e.kind===`docs`?`docs`:e.kind===`home`?`new-tab`:e.kind===`apps`?e.resourceUri?.includes(`service-apps`)?`service-apps`:`apps`:e.kind===`panel-app`?`panel-app`:`apps`}var Lo=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>yo(lo(),Co.getState().pinnedItems),this.openItem=e=>{e.target.type===`right-panel-resource`&&this.docBrowserManager.open(e.target.uri,{dockIcon:e.icon,title:e.label})},this.getDockState=e=>{let t=this.getTabResourceUri(e);if(!t)return{canDock:!1,isDocked:!1,removable:!1};let n=this.findItemByUri(t);return{canDock:!0,isDocked:!!n,removable:n?.removable===!0}},this.pinTab=(e,t=new Date().toISOString())=>{let n=this.getTabResourceUri(e);!e||!n||this.findItemByUri(n)||this.pinItem({builtIn:!1,icon:Fo(e.dockIcon)??{type:`builtin`,name:Io(e)},id:Po(n),label:e.title.trim()||n,removable:!0,target:{type:`right-panel-resource`,uri:n}},t)},this.unpinTab=e=>{let t=this.getTabResourceUri(e),n=t?this.findItemByUri(t):void 0;n?.removable&&this.unpinItem(n.id)},this.pinItem=(e,t=new Date().toISOString())=>{if(!e.removable)return;let n=Q(e.target.uri);this.setPinnedItems(r=>r.some(t=>t.id===e.id||Q(t.target.uri)===n)?r:[...r,_o({...e,target:{...e.target,uri:n}},t)])},this.unpinItem=e=>{this.setPinnedItems(t=>t.filter(t=>t.id!==e))},this.reorderPinnedItems=e=>{this.setPinnedItems(t=>{let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>n.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.id)),a=t.filter(e=>!i.has(e.id));return[...r,...a]})},this.setPinnedItems=e=>{let{pinnedItems:t,setPinnedItems:n}=Co.getState();n(e(t))},this.getTabResourceUri=e=>{let t=e?.resourceUri??e?.currentUrl,n=t?Q(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=Q(e);return this.getItems().find(e=>Q(e.target.uri)===t)}}},Ro=class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:r,url:i}=e,a=r??(i?void 0:t?.kind)??(i&&He(i)?`docs`:`home`),o=i?.trim()||(!r&&t&&t.kind!==`docs`?t.currentUrl:a===`home`?`nextclaw://new-tab`:a===`docs`?O():`about:blank`),s=a===`docs`?ze(o,`docs`):o;return{historyPolicy:`managed`,kind:a,title:a===`home`?n(`docBrowserHomeTitle`):Ge(s,a,a===`docs`?n(`docBrowserHelp`):`Detail`),url:s}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?k(e)===k(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==Ve}};function zo(e){return e.index>0&&e.entries.length>0}function Bo(e){return e.index>=0&&e.index<e.entries.length-1}function Vo(e,t,n=Object.is){let r=Wo(e),i=e.entries[r];if(i&&n(i,t))return{entries:e.entries,index:r};let a=[...e.entries.slice(0,r+1),t];return{entries:a,index:a.length-1}}function Ho(e,t){let n=Wo(e),r=t===`back`?n-1:n+1,i=e.entries[r];return i?{history:{entries:e.entries,index:r},entry:i}:null}function Uo(e,t,n){let r=Wo(e),i=e.entries.filter(t);if(i.length===0)return n===void 0?{entries:[],index:0}:{entries:[n],index:0};let a=e.entries.slice(0,r+1).filter(t);return{entries:i,index:Math.min(Math.max(0,a.length-1),i.length-1)}}function Wo(e){return e.entries.length===0?0:Number.isInteger(e.index)?Math.min(Math.max(0,e.index),e.entries.length-1):e.entries.length-1}var Go=new Ro;function Ko(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function qo(e,t){return Ko(e,e.activeTabId,t)}function Jo(e,t){let n=[...e.history.slice(0,e.historyIndex+1),t];return{history:n,historyIndex:n.length-1}}function Yo(e,t,n){let r=t.resourceUri??t.url,i=n.resourceUri??n.url;return t.tabId===n.tabId&&t.kind===n.kind&&e.areUrlsEquivalent(r,i,t.kind,n.kind)}function Xo(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function $(e,t,n){let r=Vo({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>Yo(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function Zo(e,t,n){for(let r=t.history.length-1;r>=0;--r)if(e.areUrlsEquivalent(t.history[r],n,t.kind,t.kind))return r;return-1}function Qo(e,t,n){let r=t.tabs.find(e=>e.id===n.tabId);if(!r)return t;let i=n.resourceUri??n.url,a=e.resolveOpenTarget({activeTab:r,kind:n.kind,url:i}),o=Zo(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return Ko({...t,activeTabId:r.id,isOpen:!0},r.id,e=>({...e,currentUrl:a.url,dedupeKey:a.dedupeKey,dockIcon:a.dockIcon??e.dockIcon,historyIndex:o>=0?o:e.historyIndex,kind:a.kind,resourceUri:a.resourceUri??a.url,title:s?e.title:a.title}))}function $o(e,t,n,r,i){let a={...t,title:r?.title||n.title||t.title,kind:n.kind,resourceUri:n.resourceUri??n.url,dockIcon:r?.dockIcon??n.dockIcon,dedupeKey:i};return e.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?a:{...a,currentUrl:n.url,...Jo(t,n.url),navVersion:t.navVersion+1}}function es(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function ts(e,t,n,r){let{activate:i,dedupeKey:a,newTab:o,title:s}=r??{},c=a?.trim()||n.dedupeKey,l=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0],u=c?t.tabs.find(e=>e.dedupeKey===c):void 0;if(u){let a=Ko(t,u.id,t=>$o(e,t,n,r,c)),o=i!==!1,s=o?u.id:t.activeTabId,l={...a,activeTabId:s,isOpen:!0};return o||u.id===t.activeTabId?$(e,l,Xo(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=We(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon);return es(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[D(i)],activeHistoryIndex:0}:$(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},D(i))}return $(e,{...qo(t,t=>$o(e,t,n,r,c)),isOpen:!0},Xo(t.activeTabId,n))}function ns(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return ts(e,t,e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),r)}var rs=class{constructor(e=Go){this.routeResolver=e,this.setSnapshot=e=>{Ke.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>ns(this.routeResolver,n,e,t))},this.openTarget=(e,t)=>{this.setSnapshot(n=>ts(this.routeResolver,n,e,{...t,dedupeKey:t?.dedupeKey??e.dedupeKey,kind:t?.kind??e.kind,title:t?.title??e.title}))},this.openNewTab=()=>{this.open(void 0,{kind:Je,newTab:!0})},this.close=()=>{this.setSnapshot(e=>({...e,isOpen:!1}))},this.toggleMode=()=>{this.setSnapshot(e=>({...e,mode:e.mode===`floating`?`docked`:`floating`}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=We(O(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=qo(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Jo(t,n.url),kind:n.kind,navVersion:t.navVersion+1,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?$(this.routeResolver,n,D(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=We(O(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=qo(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,kind:t.kind,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Jo(t,n.url),kind:n.kind,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?$(this.routeResolver,n,D(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=Ho({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?Qo(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=Ho({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?Qo(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.closeTab=e=>{this.setSnapshot(t=>{if(t.tabs.length<=1)return{...Be(),isOpen:!1};let n=t.tabs.findIndex(t=>t.id===e);if(n<0)return t;let r=t.tabs.filter(t=>t.id!==e),i=t.activeTabId===e?r[Math.max(0,n-1)]?.id??r[0].id:t.activeTabId,a={...t,tabs:r,activeTabId:i},o=r.find(e=>e.id===i)??r[0],s=Uo({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,D(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?$(this.routeResolver,c,D(o)):c})},this.setActiveTab=e=>{this.setSnapshot(t=>{if(!t.tabs.some(t=>t.id===e))return t;let n=t.tabs.find(t=>t.id===e);return n?$(this.routeResolver,{...t,activeTabId:e,isOpen:!0},D(n)):t})}}},is=class{constructor(){this.accountManager=new Oi,this.rightPanelResourceRouteResolver=new Qa,this.docBrowserManager=new rs(this.rightPanelResourceRouteResolver),this.sideDockManager=new Lo(this.docBrowserManager),this.serviceActionAuthorizationManager=new ea,this.panelAppBridgeManager=new Ji(this.serviceActionAuthorizationManager),this.remoteAccessManager=new _i({accountManager:this.accountManager})}},as=null;function os(){return as??=new is,as}function ss(){return os()}var cs=(0,A.createContext)(null);function ls({children:e}){let t=(0,A.useMemo)(()=>os(),[]);return(0,V.jsx)(cs.Provider,{value:t,children:e})}function us(){let e=(0,A.useContext)(cs);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}export{ei as A,In as B,mi as C,ci as D,li as E,Tr as F,on as H,Mn as I,Er as L,Gr as M,Wr as N,oi as O,Sr as P,Nn as R,W as S,ui as T,cn as U,B as V,Qe as W,xi as _,Bo as a,di as b,Ho as c,so as d,oo as f,Si as g,Ei as h,zo as i,Yr as j,ri as k,jo as l,Di as m,us as n,Uo as o,Zi as p,ss as r,Vo as s,ls as t,Co as u,_i as v,gi as w,U as x,G as y,Pn as z};
@@ -1 +0,0 @@
1
- import{c as e}from"./dist-C59BKqbX.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};