nextclaw 0.18.12-beta.2 → 0.18.12-beta.21

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 (96) hide show
  1. package/dist/cli/app/index.js +908 -266
  2. package/dist/cli/launcher/index.js +8 -3
  3. package/dist/{npm-runtime-update-state.store-DaF0iDY9.js → npm-runtime-update-state.store-75vzvn0B.js} +200 -30
  4. package/package.json +17 -16
  5. package/resources/USAGE.md +41 -1
  6. package/ui-dist/assets/api-Dai6UR3J.js +15 -0
  7. package/ui-dist/assets/app-manager-provider-BZr5VxCe.js +1 -0
  8. package/ui-dist/assets/app-navigation.config-BjIj_FLm.js +1 -0
  9. package/ui-dist/assets/{book-open-C5p9re7m.js → book-open-DgLqYpNY.js} +1 -1
  10. package/ui-dist/assets/channels-list-page-L6FFtRYn.js +8 -0
  11. package/ui-dist/assets/{chat-a-_X0PmT.js → chat-ZQIVJChB.js} +7 -7
  12. package/ui-dist/assets/chat-page-CR1yI96r.js +1 -0
  13. package/ui-dist/assets/chunk-JZWAC4HX-u4uYphxM.js +3 -0
  14. package/ui-dist/assets/{config-split-page-YB7xRSn7.js → config-split-page-BMRGuCJQ.js} +1 -1
  15. package/ui-dist/assets/{createLucideIcon-D48LQ7_3.js → createLucideIcon-BZkY6emz.js} +1 -1
  16. package/ui-dist/assets/desktop-update-config-AXzb7OEa.js +1 -0
  17. package/ui-dist/assets/{dialog-BNdeIVqc.js → dialog-DgybjpeU.js} +1 -1
  18. package/ui-dist/assets/{dist-BjUfmI6n.js → dist-CxcPOISF.js} +1 -1
  19. package/ui-dist/assets/{doc-browser-CX_BvO6R.js → doc-browser-BUlCkZo2.js} +1 -1
  20. package/ui-dist/assets/{doc-browser-CLdhFEsz.js → doc-browser-CzCV73NJ.js} +1 -1
  21. package/ui-dist/assets/doc-browser-Doh2541x.js +1 -0
  22. package/ui-dist/assets/{doc-browser-context-5mbkyvid.js → doc-browser-context-DfLHAWbG.js} +1 -1
  23. package/ui-dist/assets/{es2015-Db-PtAnL.js → es2015-BVRlEE06.js} +1 -1
  24. package/ui-dist/assets/{external-link-BwNyDSMe.js → external-link-Sw3ah_JD.js} +1 -1
  25. package/ui-dist/assets/{folder-BSLCUICp.js → folder-D7-VTnkz.js} +1 -1
  26. package/ui-dist/assets/{hash-DpL5u6Fu.js → hash-zajSTDXZ.js} +1 -1
  27. package/ui-dist/assets/i18n-C5Mibli1.js +1 -0
  28. package/ui-dist/assets/index-B7RsQ-ne.js +2 -0
  29. package/ui-dist/assets/index-D8MKmXtO.css +1 -0
  30. package/ui-dist/assets/{key-round-BNTFD7Jk.js → key-round-CnI1mc9F.js} +1 -1
  31. package/ui-dist/assets/loader-circle-B5i8oMMY.js +1 -0
  32. package/ui-dist/assets/{logo-badge-a-OsoTKw.js → logo-badge-BQgKnVtz.js} +1 -1
  33. package/ui-dist/assets/{logos--4c27B_Z.js → logos-CqVm0q0W.js} +1 -1
  34. package/ui-dist/assets/marketplace-page-Bj55-6F2.js +1 -0
  35. package/ui-dist/assets/{marketplace-page-PA3qcNzv.js → marketplace-page-ClRW-W3g.js} +2 -2
  36. package/ui-dist/assets/mcp-marketplace-page-DtngnIi0.js +40 -0
  37. package/ui-dist/assets/mcp-marketplace-page-_Wu2VnHy.js +1 -0
  38. package/ui-dist/assets/message-square-D6Z4NwpG.js +1 -0
  39. package/ui-dist/assets/{model-config-C3-m1Sua.js → model-config-D_y8F0j6.js} +1 -1
  40. package/ui-dist/assets/{notice-card-DE4jOEXF.js → notice-card-uzwjFyML.js} +1 -1
  41. package/ui-dist/assets/play-D8WJLnJe.js +1 -0
  42. package/ui-dist/assets/plus-Di0KAkiO.js +1 -0
  43. package/ui-dist/assets/{popover-B6dtrFF5.js → popover-C8tMB7tR.js} +1 -1
  44. package/ui-dist/assets/{provider-scoped-model-input-BkpcdlQB.js → provider-scoped-model-input-ORZutTDv.js} +1 -1
  45. package/ui-dist/assets/{providers-list-EzKC5s0y.js → providers-list-DSc3d8me.js} +1 -1
  46. package/ui-dist/assets/refresh-ccw-Bii4w8aB.js +1 -0
  47. package/ui-dist/assets/refresh-cw-BxojR62w.js +1 -0
  48. package/ui-dist/assets/remote-rWiu3cys.js +1 -0
  49. package/ui-dist/assets/{rotate-cw-CeTNbfMs.js → rotate-cw-1Xqa7LZ8.js} +1 -1
  50. package/ui-dist/assets/runtime-config-page-B4uSax1I.js +1 -0
  51. package/ui-dist/assets/{save-B8Rym7bl.js → save--BVI5wZX.js} +1 -1
  52. package/ui-dist/assets/{search-config-CNh9FS_N.js → search-config-CaqqlsdW.js} +1 -1
  53. package/ui-dist/assets/{search-BUGoDsjN.js → search-vChioOoe.js} +1 -1
  54. package/ui-dist/assets/{secrets-config-Bau56GeM.js → secrets-config-llf5ROde.js} +2 -2
  55. package/ui-dist/assets/{select-BuXrS7g3.js → select-uO-zhYsH.js} +1 -1
  56. package/ui-dist/assets/{sessions-config-page-BDF04GaS.js → sessions-config-page-BqOXte9x.js} +2 -2
  57. package/ui-dist/assets/{setting-row-CifMdz8g.js → setting-row-BIiXR4hx.js} +1 -1
  58. package/ui-dist/assets/settings-CiRChctQ.js +1 -0
  59. package/ui-dist/assets/skeleton-CFQRIUzt.js +1 -0
  60. package/ui-dist/assets/{sparkles-Bo0DxmaB.js → sparkles-D1ZKWdm4.js} +1 -1
  61. package/ui-dist/assets/{status-dot-CS7yRd9c.js → status-dot-Dv_hiUVa.js} +1 -1
  62. package/ui-dist/assets/{tabs-custom-HBN-j_Kn.js → tabs-custom-CsACkVji.js} +1 -1
  63. package/ui-dist/assets/{tag-chip-BZSHb3cE.js → tag-chip-DVbgpsYW.js} +1 -1
  64. package/ui-dist/assets/theme-provider-BU77FNSB.js +1 -0
  65. package/ui-dist/assets/{tooltip-BMz2ki-V.js → tooltip-CvAtG-kT.js} +1 -1
  66. package/ui-dist/assets/{trash-2-gWTb2oNS.js → trash-2-rY9ZteZX.js} +1 -1
  67. package/ui-dist/assets/use-config-D2QgG7qc.js +1 -0
  68. package/ui-dist/assets/{use-confirm-dialog-DLVARUvb.js → use-confirm-dialog-BBClFV8E.js} +1 -1
  69. package/ui-dist/assets/{use-infinite-scroll-loader-BdGMvR3y.js → use-infinite-scroll-loader-CWzpUecQ.js} +1 -1
  70. package/ui-dist/assets/{use-viewport-layout-DOqJ0LPT.js → use-viewport-layout-C6EN0_eq.js} +1 -1
  71. package/ui-dist/assets/x-DpTzXQcX.js +1 -0
  72. package/ui-dist/index.html +40 -36
  73. package/ui-dist/assets/api-BsY-53_V.js +0 -15
  74. package/ui-dist/assets/app-manager-provider-DTrWjVLB.js +0 -1
  75. package/ui-dist/assets/channels-list-page-CZAdoJ3s.js +0 -8
  76. package/ui-dist/assets/chat-page-BCypc4bi.js +0 -1
  77. package/ui-dist/assets/chunk-JZWAC4HX-CD1w8mri.js +0 -3
  78. package/ui-dist/assets/desktop-B9azAgEh.js +0 -2
  79. package/ui-dist/assets/desktop-update-config-Dm_cedSL.js +0 -1
  80. package/ui-dist/assets/doc-browser-eF2QWInq.js +0 -1
  81. package/ui-dist/assets/i18n-jGA3YQz4.js +0 -1
  82. package/ui-dist/assets/index-CUmk8xFK.css +0 -1
  83. package/ui-dist/assets/index-o_M3x0GR.js +0 -2
  84. package/ui-dist/assets/loader-circle-C3XJNZy7.js +0 -1
  85. package/ui-dist/assets/marketplace-page-DvmfPCAY.js +0 -1
  86. package/ui-dist/assets/mcp-marketplace-page-Dl8wdAtD.js +0 -1
  87. package/ui-dist/assets/mcp-marketplace-page-DukryaOq.js +0 -40
  88. package/ui-dist/assets/play-DGBx1fWI.js +0 -1
  89. package/ui-dist/assets/plus-CUuByV8j.js +0 -1
  90. package/ui-dist/assets/remote-Xzy42m-0.js +0 -1
  91. package/ui-dist/assets/runtime-config-page-DAMnv5Xp.js +0 -1
  92. package/ui-dist/assets/settings-COxdZHdu.js +0 -1
  93. package/ui-dist/assets/skeleton-DW5F83p8.js +0 -1
  94. package/ui-dist/assets/use-config-Ds7DyaYQ.js +0 -1
  95. package/ui-dist/assets/x-CxanI1fH.js +0 -1
  96. /package/ui-dist/assets/{config-hints-fDrYfl0l.js → config-hints-MogHYQ8G.js} +0 -0
@@ -1 +0,0 @@
1
- import{_ as e,i as t,m as n,n as r,p as i}from"./i18n-jGA3YQz4.js";import{At as a,Ct as o,Dt as s,Et as c,It as l,Mt as u,Ot as d,Pt as f,St as p,Tt as m,a as h,bt as g,c as _,d as v,ft as ee,i as y,kt as b,l as te,o as x,s as ne,u as re,wt as S,xt as C}from"./api-BsY-53_V.js";import{a as w,n as T,o as ie,r as ae,t as E}from"./dialog-BNdeIVqc.js";import{t as D}from"./createLucideIcon-D48LQ7_3.js";import{t as oe}from"./key-round-BNTFD7Jk.js";import{t as O}from"./notice-card-DE4jOEXF.js";import{t as k}from"./status-dot-CS7yRd9c.js";var se=D(`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`}]]),A=D(`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`}]]),j=D(`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`}]]),M=D(`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`}]]);function N(){return l({queryKey:L,queryFn:x,staleTime:5e3,refetchOnWindowFocus:!0})}var P=e(n(),1),F=i();function I(e){let{label:t,muted:n,value:r}=e;return(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,F.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,F.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function ce(){let e=$(),n=N(),i=n.data,l=U(e=>e.actionLabel),u=(0,P.useMemo)(()=>q(i),[i]),d=!!l,f=i?.runtime?.deviceName?.trim()||i?.settings.deviceName?.trim()||t(`remoteDeviceNameAuto`),h=!!(i?.account.loggedIn&&H(i)),{hero:g,issueHint:_}=u;return(0,P.useEffect)(()=>{e.remoteAccessManager.syncStatus(i)},[e,i]),n.isLoading&&!i?(0,F.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`remoteLoading`)}):(0,F.jsxs)(s,{className:`space-y-6`,children:[(0,F.jsx)(c,{title:t(`remotePageTitle`),description:t(`remotePageDescription`)}),(0,F.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,F.jsxs)(C,{children:[(0,F.jsxs)(S,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsx)(m,{children:g.title}),(0,F.jsx)(k,{status:g.badgeStatus,label:g.badgeLabel})]}),(0,F.jsx)(o,{children:g.description})]}),(0,F.jsxs)(p,{className:`space-y-5`,children:[(0,F.jsxs)(O,{tone:`neutral`,children:[(0,F.jsx)(I,{label:t(`remoteSignedInAccount`),value:i?.account.email}),(0,F.jsx)(I,{label:t(`remoteDeviceName`),value:f}),(0,F.jsx)(I,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,F.jsx)(I,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[u.primaryAction?(0,F.jsxs)(a,{onClick:()=>{if(u.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(i);return}if(u.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(i);return}e.remoteAccessManager.enableRemoteAccess(i)},disabled:d,children:[u.primaryAction.showRefreshIcon?(0,F.jsx)(j,{className:`mr-2 h-4 w-4`}):null,l||u.primaryAction.label]}):null,(0,F.jsxs)(a,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:d||!h,children:[(0,F.jsx)(M,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),i?.settings.enabled?(0,F.jsx)(a,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(i),disabled:d,children:t(`remoteDisable`)}):null]}),u.shouldShowIssueHint&&_?(0,F.jsx)(O,{tone:`warning`,title:_.title,description:_.body}):null,(0,F.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteOpenWebHint`)})]})]}),(0,F.jsxs)(C,{children:[(0,F.jsxs)(S,{children:[(0,F.jsxs)(m,{className:`flex items-center gap-2`,children:[(0,F.jsx)(se,{className:`h-4 w-4 text-primary`}),t(`remoteDeviceSectionTitle`)]}),(0,F.jsx)(o,{children:t(`remoteDeviceSectionDescription`)})]}),(0,F.jsxs)(p,{className:`space-y-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(k,{status:i?.account.loggedIn?`ready`:`inactive`,label:i?.account.loggedIn?t(`remoteAccountConnected`):t(`remoteAccountNotConnected`)}),(0,F.jsx)(k,{status:i?.settings.enabled?`active`:`inactive`,label:i?.settings.enabled?t(`remoteEnabled`):t(`remoteStateDisabled`)}),(0,F.jsx)(k,{status:i?.service.running?`active`:`inactive`,label:i?.service.running?t(`remoteServiceRunning`):t(`remoteServiceStopped`)})]}),(0,F.jsxs)(O,{tone:`neutral`,children:[(0,F.jsx)(I,{label:t(`remoteDeviceName`),value:f}),(0,F.jsx)(I,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,F.jsx)(I,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,F.jsx)(O,{tone:`neutral`,borderStyle:`dashed`,description:i?.account.loggedIn?t(`remoteOpenWebHint`):t(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var L=[`remote-status`],le=`https://platform.nextclaw.io`,ue=`https://nextclaw-platform-console.pages.dev`,R=async()=>await u.fetchQuery({queryKey:L,queryFn:x,staleTime:5e3}),z=async()=>(await u.invalidateQueries({queryKey:L}),await R()),B=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function V(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 le;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return ue}var H=e=>V(e?.account.apiBase)||V(e?.settings.platformApiBase)||V(e?.platformBase)||V(e?.account.platformBase)||void 0,U=g(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})})),W=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=U.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{U.getState().setEnabled(e)},this.setDeviceName=e=>{U.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{U.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{U.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await z(),n=U.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await z();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let n=e??await z();if(!n.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let r=n.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:t(r===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await y(r);let e=await z();this.hydrateDraftFromStatus(e)},successMessage:t(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await z();await this.accountManager?.startBrowserSignIn({status:t,apiBase:U.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let n=e??await z(),r=U.getState();await this.runManagedAction({actionLabel:t(`remoteActionSavingAdvanced`),job:async()=>{await v({enabled:r.enabled,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let e=await z();this.hydrateDraftFromStatus(e)},successMessage:n.settings.enabled===r.enabled?t(`remoteSettingsSaved`):t(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:t(`remoteDoctorRunning`),job:async()=>{let e=await h();U.getState().setDoctor(e)},successMessage:t(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,t(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,t(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,t(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,n)=>{let r=U.getState();await this.runManagedAction({actionLabel:t(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await v({enabled:e,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let t=await z();this.hydrateDraftFromStatus(t),e?await y(t.service.running?`restart`:`start`):n.service.running&&await y(`restart`);let i=await z();this.hydrateDraftFromStatus(i)},successMessage:t(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await y(e),n=await z();this.hydrateDraftFromStatus(n),f.success(t.message)}})},this.hydrateDraftFromStatus=e=>{U.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{U.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&f.success(e.successMessage)}catch(e){let n=e instanceof Error?e.message:t(`error`);throw f.error(n),e}finally{U.getState().finishAction()}}}},de=[/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 G(e){return e?.runtime?.lastError?.trim()||``}function fe(e){let n=t(`remoteStatusIssueDetailGeneric`),r=G(e);return r?`${n} (${r})`:n}function K(e){if(!e?.settings.enabled)return!1;let t=G(e);return de.some(e=>e.test(t))}function q(e){return K(e)?{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateReauthorizationRequired`),title:t(`remoteStatusReauthorizationTitle`),description:t(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:t(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:t(`statusReady`),title:t(`remoteStatusReadyTitle`),description:t(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:t(`connecting`),title:t(`remoteStatusConnectingTitle`),description:t(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateDisconnected`),title:t(`remoteStatusIssueTitle`),description:t(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:fe(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteServiceStopped`),title:t(`remoteStatusNeedsServiceTitle`),description:t(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:t(`statusInactive`),title:t(`remoteStatusNeedsEnable`),description:t(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:t(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:t(`statusSetup`),title:t(`remoteStatusNeedsSignIn`),description:t(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:t(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var J=g(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),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 Y({label:e,value:t}){return(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,F.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,F.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function pe(e){let{email:n,username:r,role:i,canSubmitUsername:o,savingUsername:s,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:u,onOpenDeviceList:f,onLogout:p}=e;return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(O,{tone:`success`,title:t(`accountPanelSignedInTitle`),description:t(`accountPanelSignedInDescription`)}),(0,F.jsxs)(O,{tone:`neutral`,children:[(0,F.jsx)(Y,{label:t(`remoteAccountEmail`),value:n}),(0,F.jsx)(Y,{label:t(`remoteAccountUsername`),value:r}),(0,F.jsx)(Y,{label:t(`remoteAccountRole`),value:i})]}),r?(0,F.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteAccountUsernameLockedHelp`)}):(0,F.jsxs)(O,{tone:`warning`,title:t(`remoteAccountUsernameRequiredTitle`),description:t(`remoteAccountUsernameRequiredDescription`),children:[(0,F.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,F.jsx)(d,{htmlFor:`account-panel-username`,children:t(`remoteAccountUsername`)}),(0,F.jsx)(b,{id:`account-panel-username`,value:c,onChange:e=>l(e.target.value),placeholder:t(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,F.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,F.jsx)(a,{disabled:!o,onClick:()=>void u(),children:t(s?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,F.jsxs)(a,{onClick:()=>void f(),children:[(0,F.jsx)(M,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),(0,F.jsxs)(a,{variant:`outline`,onClick:()=>void p(),children:[(0,F.jsx)(A,{className:`mr-2 h-4 w-4`}),t(`remoteLogout`)]})]})]})}function me(e){let{authSessionId:n,authExpiresAt:i,authStatusMessage:o,authVerificationUri:s,onStartBrowserSignIn:c,onResumeBrowserSignIn:l}=e;return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(O,{tone:`neutral`,title:t(`accountPanelSignedOutTitle`),description:t(`accountPanelSignedOutDescription`),children:n?(0,F.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,F.jsx)(Y,{label:t(`remoteBrowserAuthSession`),value:n}),(0,F.jsx)(Y,{label:t(`remoteBrowserAuthExpiresAt`),value:i?r(i):`-`})]}):null}),o?(0,F.jsx)(`p`,{className:`text-sm text-gray-600`,children:o}):null,(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,F.jsx)(a,{onClick:()=>void c(),children:t(n?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),s?(0,F.jsx)(a,{variant:`outline`,onClick:l,children:t(`remoteBrowserAuthResume`)}):null]})]})}function he(){let e=$(),n=N(),r=J(e=>e.panelOpen),i=J(e=>e.authSessionId),a=J(e=>e.authVerificationUri),o=J(e=>e.authExpiresAt),s=J(e=>e.authStatusMessage),c=n.data,[l,u]=(0,P.useState)(``),[d,f]=(0,P.useState)(!1);(0,P.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let p=!d&&l.trim().length>0&&!c?.account.username;return(0,F.jsx)(E,{open:r,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,F.jsxs)(T,{className:`max-w-xl`,children:[(0,F.jsxs)(w,{children:[(0,F.jsxs)(ie,{className:`flex items-center gap-2`,children:[(0,F.jsx)(oe,{className:`h-5 w-5 text-primary`}),t(`accountPanelTitle`)]}),(0,F.jsx)(ae,{children:t(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,F.jsx)(pe,{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,F.jsx)(me,{authSessionId:i,authExpiresAt:o,authStatusMessage:s,authVerificationUri:a,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}function ge({username:e}){let n=ee(),[r,i]=(0,P.useState)(e??``),[s,c]=(0,P.useState)(``),l=r.trim().length>0&&s.length>0&&!n.isPending;return(0,F.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,F.jsxs)(C,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,F.jsxs)(S,{children:[(0,F.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:t(`authBrand`)}),(0,F.jsx)(m,{className:`text-2xl`,children:t(`authLoginTitle`)}),(0,F.jsx)(o,{children:t(`authLoginDescription`)})]}),(0,F.jsx)(p,{children:(0,F.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),l&&n.mutate({username:r.trim(),password:s})},children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authUsername`)}),(0,F.jsx)(b,{value:r,onChange:e=>i(e.target.value),placeholder:t(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authPassword`)}),(0,F.jsx)(b,{type:`password`,value:s,onChange:e=>c(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,F.jsx)(a,{type:`submit`,className:`w-full`,disabled:!l,children:n.isPending?t(`authLoggingIn`):t(`authLoginAction`)})]})})]})})}var X=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{J.getState().openPanel()},this.closeAccountPanel=()=>{J.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),J.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await R();return t.account.loggedIn?!0:(e?.pendingAction&&J.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let n=e?.apiBase,r=e?.pendingAction,i=e?.status??await R();r&&J.getState().setPendingAction(r);let a=await te({apiBase:B(i,n)});J.getState().beginBrowserAuth({sessionId:a.sessionId,verificationUri:a.verificationUri,expiresAt:a.expiresAt,intervalMs:a.intervalMs,statusMessage:t(`remoteBrowserAuthWaiting`)}),window.open(a.verificationUri,`_blank`,`noopener,noreferrer`)||J.getState().setAuthStatusMessage(t(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let n=e instanceof Error?e.message:t(`remoteBrowserAuthStartFailed`);f.error(`${t(`remoteBrowserAuthStartFailed`)}: ${n}`)}},this.resumeBrowserSignIn=()=>{let e=J.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await ne(),J.getState().clearPendingAction(),J.getState().clearBrowserAuth(),await z(),f.success(t(`remoteLogoutSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteLogoutFailed`);f.error(`${t(`remoteLogoutFailed`)}: ${n}`)}},this.updateUsername=async e=>{try{await re({username:e.trim()}),await z(),f.success(t(`remoteAccountUsernameSetSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteAccountUsernameSetFailed`);f.error(`${t(`remoteAccountUsernameSetFailed`)}: ${n}`)}},this.openNextClawWeb=async(e=`/`)=>{let n=H(await R());if(!n){f.error(t(`remoteOpenWebUnavailable`));return}let r=new URL(e,`${n.replace(/\/+$/,``)}/`).toString();window.open(r,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=J.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=J.getState();if(e.authSessionId)try{let n=await R(),r=await _({sessionId:e.authSessionId,apiBase:B(n)});if(r.status===`pending`){J.getState().updateBrowserAuth({statusMessage:t(`remoteBrowserAuthWaiting`),intervalMs:r.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(r.status===`expired`){this.clearPollTimer(),J.getState().clearBrowserAuth(),f.error(r.message||t(`remoteBrowserAuthExpired`));return}J.getState().setAuthStatusMessage(t(`remoteBrowserAuthCompleted`));let i=await z(),{pendingAction:a}=J.getState();this.clearPollTimer(),J.getState().clearBrowserAuth(),f.success(t(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,i),J.getState().clearPendingAction()}catch(e){this.clearPollTimer(),J.getState().clearBrowserAuth();let n=e instanceof Error?e.message:t(`remoteBrowserAuthPollFailed`);f.error(`${t(`remoteBrowserAuthPollFailed`)}: ${n}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=J.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?r(e.authExpiresAt):`-`}}}},Z=new class{constructor(){this.accountManager=new X,this.remoteAccessManager=new W}};Z.accountManager.bindSignedInContinuation(Z.remoteAccessManager.resumePendingActionAfterSignIn),Z.remoteAccessManager.bindAccountManager(Z.accountManager);var Q=(0,P.createContext)(null);function _e({children:e}){return(0,F.jsx)(Q.Provider,{value:Z,children:e})}function $(){let e=(0,P.useContext)(Q);if(!e)throw Error(`useAppManager must be used inside AppManagerProvider`);return e}export{q as a,U as c,z as d,B as f,j as g,N as h,he as i,L as l,ce as m,$ as n,K as o,H as p,ge as r,W as s,_e as t,R as u};
@@ -1,8 +0,0 @@
1
- import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-jGA3YQz4.js";import{At as c,Dt as l,Et as u,Ft as d,It as f,Ot as p,Pt as m,ct as h,kt as g,nt as _,pt as v,tt as y,zt as b}from"./api-BsY-53_V.js";import{t as x}from"./createLucideIcon-D48LQ7_3.js";import{t as S}from"./search-BUGoDsjN.js";import{t as C}from"./book-open-C5p9re7m.js";import{O as ee,a as te,i as ne,n as re,r as ie,t as ae}from"./select-BuXrS7g3.js";import{t as w}from"./external-link-BwNyDSMe.js";import{n as oe,t as T}from"./logos--4c27B_Z.js";import{t as se}from"./hash-DpL5u6Fu.js";import{t as ce}from"./key-round-BNTFD7Jk.js";import{t as E}from"./loader-circle-C3XJNZy7.js";import{n as le,t as ue}from"./settings-COxdZHdu.js";import{t as de}from"./x-CxanI1fH.js";import{t as D}from"./status-dot-CS7yRd9c.js";import{t as fe}from"./use-viewport-layout-DOqJ0LPT.js";import{b as pe,i as O,n as k,r as A,u as me}from"./use-config-Ds7DyaYQ.js";import{t as j}from"./logo-badge-a-OsoTKw.js";import{t as he}from"./tabs-custom-HBN-j_Kn.js";import{t as ge}from"./tag-chip-BZSHb3cE.js";import{t as M}from"./config-hints-fDrYfl0l.js";import{a as N,c as P,i as _e,n as ve,o as F,r as ye,s as be,t as xe}from"./config-split-page-YB7xRSn7.js";var Se=x(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),Ce=x(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),I=x(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),we=x(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),L=e(r(),1),R=o();function Te({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,L.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,R.jsxs)(`div`,{className:s(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,r),children:[e.map((e,t)=>(0,R.jsxs)(ge,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,R.jsx)(de,{className:`h-3 w-3`})})]},t)),(0,R.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,R.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,R.jsx)(oe,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,R.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,R.jsx)(se,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,R.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,R.jsx)(ue,{className:`h-3.5 w-3.5 text-gray-500`})}function De({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,R.jsx)(R.Fragment,{children:t.map(t=>{let c=M(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,R.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,R.jsxs)(p,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),l]}),t.type===`boolean`&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,R.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,R.jsx)(v,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,R.jsx)(g,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,R.jsx)(g,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,R.jsx)(g,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,R.jsx)(Te,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,R.jsxs)(ae,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,R.jsx)(ne,{className:`rounded-xl`,children:(0,R.jsx)(te,{})}),(0,R.jsx)(re,{children:(t.options??[]).map(e=>(0,R.jsx)(ie,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,R.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Oe=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),B=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ke=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ae=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),je=t((e=>{var t=z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Me=t((e=>{var t=z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ne=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),V=t((e=>{var t=B(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Pe=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Fe=t((e=>{var t=Pe();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Ie=t(((e,t)=>{var n=Fe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),H=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),U=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
- ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),W=t((e=>{var t=H(),n=U();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Le=t((e=>{var t=z(),n=V(),r=B(),i=W(),a=H(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Re=t((e=>{var t=z(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),ze=t(((e,t)=>{var n=W();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Be=t(((e,t)=>{var n=W(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Ve=t(((e,t)=>{var n=W();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),He=t(((e,t)=>{var n=W(),r=z();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
- Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ue=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),We=t((e=>{var t=W(),n=ze(),r=Be(),i=Ve(),a=He(),o=U(),s=z(),c=Ue();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
- Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Ge=t((e=>{var t=z(),n=B(),r=ke(),i=Ae(),a=je(),o=Me(),s=Ne(),c=V(),l=Ie(),u=Le(),d=Re(),f=W(),p=We();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
- The chosen QR Code version cannot contain this amount of data.
6
- Minimum version required to store current data is: `+c+`.
7
- `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),G=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[a[t*i+r]?1:0]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Ke=t((e=>{var t=G();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),qe=t((e=>{var t=G();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
- `;return typeof a==`function`&&a(null,p),p}})),Je=t((e=>{var t=Oe(),n=Ge(),r=Ke(),i=qe();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))();function Ye(){return d({mutationFn:({channel:e,data:t})=>_(e,t)})}function Xe(){return d({mutationFn:({channel:e,data:t})=>y(e,t)})}function Ze(e){let{accounts:t}=e,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function Qe(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function $e(e){return f({queryKey:[`weixin-channel-qr`,e],enabled:!!e,queryFn:()=>(0,Je.toDataURL)(e,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function et(e){return(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,R.jsx)(I,{className:`h-3.5 w-3.5`}),n(`weixinAuthTitle`)]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:n(`weixinAuthDescription`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:n(`weixinAuthHint`)})]}),(0,R.jsxs)(`div`,{className:s(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,e.activeSession?`bg-amber-50 text-amber-700`:e.hasConnectedAccount?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[e.activeSession?(0,R.jsx)(E,{className:`h-3.5 w-3.5 animate-spin`}):(0,R.jsx)(Ce,{className:`h-3.5 w-3.5`}),e.statusLabel]}),(0,R.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,R.jsx)(`p`,{children:e.channelEnabled||!e.hasConnectedAccount?n(`weixinAuthCapabilityHint`):n(`weixinAuthDisabledHint`)}),e.primaryAccountId?(0,R.jsxs)(`p`,{children:[n(`weixinAuthPrimaryAccount`),`: `,(0,R.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:e.primaryAccountId})]}):null,e.connectedAccountIds.length>1?(0,R.jsxs)(`p`,{children:[n(`weixinAuthConnectedAccounts`),`: `,(0,R.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:e.connectedAccountIds.join(`, `)})]}):null,e.baseUrl?(0,R.jsxs)(`p`,{children:[n(`weixinAuthBaseUrl`),`: `,(0,R.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:e.baseUrl})]}):null]}),(0,R.jsx)(c,{type:`button`,onClick:()=>void e.handleStartAuth(),disabled:e.disabled,className:`rounded-xl`,children:e.connectButtonLabel})]})}function tt(e){return(0,R.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:e.activeSession?(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:e.qrDataUrl?(0,R.jsx)(`img`,{src:e.qrDataUrl,alt:n(`weixinAuthQrAlt`),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,R.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,R.jsx)(E,{className:`h-5 w-5 animate-spin`}),(0,R.jsx)(`p`,{className:`text-xs`,children:n(`weixinAuthStarting`)})]})})}),(0,R.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,R.jsx)(`p`,{children:e.authMessage||e.activeSession.note||n(`weixinAuthScanPrompt`)}),(0,R.jsxs)(`p`,{children:[n(`weixinAuthExpiresAt`),`: `,i(e.activeSession.expiresAt)]})]}),(0,R.jsxs)(`a`,{href:e.activeSession.qrCodeUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,R.jsx)(w,{className:`h-3.5 w-3.5`}),n(`weixinAuthOpenQr`)]})]}):(0,R.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,R.jsx)(I,{className:`h-9 w-9 text-gray-300`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:n(`weixinAuthReadyTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:n(`weixinAuthReadyDescription`)})]})})}function nt(e){let t=b(),r=Ye(),i=Xe(),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),d=(0,L.useMemo)(()=>Ze(e.channelConfig),[e.channelConfig]),f=d[0],p=Qe(e.formData,e.channelConfig),h=d.length>0,g=h&&!l?null:a,_=$e(g?.qrCodeUrl);(0,L.useEffect)(()=>{if(!g)return;let e=!1,r=null,a=async()=>{try{let s=await i.mutateAsync({channel:`weixin`,data:{sessionId:g.sessionId}});if(e)return;if(c(s),s.status===`authorized`){await t.invalidateQueries({queryKey:[`config`]}),await t.invalidateQueries({queryKey:[`config-meta`]}),m.success(s.message||n(`weixinAuthAuthorized`)),o(null);return}if(s.status===`expired`||s.status===`error`){m.error(s.message||n(`weixinAuthRetryRequired`)),o(null);return}r=setTimeout(a,s.nextPollMs??g.intervalMs)}catch(t){e||(m.error(`${n(`error`)}: ${t instanceof Error?t.message:String(t)}`),o(null))}};return r=setTimeout(a,g.intervalMs),()=>{e=!0,r&&clearTimeout(r)}},[g,i,t]);let v=async()=>{try{let t=await r.mutateAsync({channel:`weixin`,data:{baseUrl:p,accountId:typeof e.formData.defaultAccountId==`string`&&e.formData.defaultAccountId.trim()?e.formData.defaultAccountId.trim():void 0}});u(h),o(t),c({channel:`weixin`,status:`pending`,message:t.note,nextPollMs:t.intervalMs})}catch(e){m.error(`${n(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},y=g?s?.status===`scanned`?n(`weixinAuthScanned`):n(`weixinAuthWaiting`):h?e.channelEnabled?n(`weixinAuthAuthorized`):n(`weixinAuthConnectedDisabled`):n(`weixinAuthNotConnected`),x=r.isPending?n(`weixinAuthStarting`):n(g?`weixinAuthWaiting`:h?`weixinAuthReconnect`:`weixinAuthConnect`),S=h?n(`weixinAuthAuthorized`):s?.message;return(0,R.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,R.jsx)(et,{activeSession:g,baseUrl:p,channelEnabled:e.channelEnabled,connectButtonLabel:x,connectedAccountIds:d,disabled:e.disabled||r.isPending||!!g,handleStartAuth:v,hasConnectedAccount:h,primaryAccountId:f,statusLabel:y}),(0,R.jsx)(tt,{activeSession:g,authMessage:S,qrDataUrl:_})]})})}var K=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],q=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],rt=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function it(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:K},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:q},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:n(`gatewayUrl`)},{name:`intents`,type:`number`,label:n(`intents`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:n(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:n(`streamingMode`),options:rt},{name:`draftChunk`,type:`json`,label:n(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:n(`textChunkLimit`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:K},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:q},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`bridgeUrl`,type:`text`,label:n(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},feishu:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`appSecret`,type:`password`,label:n(`appSecret`)},{name:`encryptKey`,type:`password`,label:n(`encryptKey`)},{name:`verificationToken`,type:`password`,label:n(`verificationToken`)},{name:`domain`,type:`text`,label:`Domain`},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:K},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:q},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}]},dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`clientId`,type:`text`,label:n(`clientId`)},{name:`clientSecret`,type:`password`,label:n(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`corpId`,type:`text`,label:n(`corpId`)},{name:`agentId`,type:`text`,label:n(`agentId`)},{name:`secret`,type:`password`,label:n(`secret`)},{name:`token`,type:`password`,label:n(`token`)},{name:`callbackPort`,type:`number`,label:n(`callbackPort`)},{name:`callbackPath`,type:`text`,label:n(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:n(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:n(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:n(`weixinAuthAdvancedTitle`),description:n(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`mode`,type:`text`,label:n(`mode`)},{name:`webhookPath`,type:`text`,label:n(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`botToken`,type:`password`,label:n(`botToken`)},{name:`appToken`,type:`password`,label:n(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`consentGranted`,type:`boolean`,label:n(`consentGranted`)},{name:`imapHost`,type:`text`,label:n(`imapHost`)},{name:`imapPort`,type:`number`,label:n(`imapPort`)},{name:`imapUsername`,type:`text`,label:n(`imapUsername`)},{name:`imapPassword`,type:`password`,label:n(`imapPassword`)},{name:`fromAddress`,type:`email`,label:n(`fromAddress`)}]},mochat:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`clawToken`,type:`password`,label:n(`clawToken`)},{name:`agentUserId`,type:`text`,label:n(`agentUserId`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`secret`,type:`password`,label:n(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:n(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]}}}function J(e){let t=a();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var at=[],ot=[{type:`fields`,section:`all`}],Y=new Set,X=new Map,Z=null;function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=Q(n[e])&&Q(r)?$(n[e],r):r;return n}function st(e,t){let n={},r=n,i=e.split(`.`);for(let e=0;e<i.length-1;e+=1)r[i[e]]={},r=r[i[e]];return r[i[i.length-1]]=t,n}function ct(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function lt(e,t){let n={};return t.filter(e=>e.type===`json`).forEach(t=>{n[t.name]=JSON.stringify(e[t.name]??{},null,2)}),n}function ut(){Z||=h.subscribe(e=>{e.type===`channel.config.apply-status`&&(X.set(e.payload.channel,e.payload.status===`started`?{status:`applying`}:e.payload.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.payload.message}),Y.forEach(e=>e()))})}function dt(e){return Y.add(e),ut(),()=>{Y.delete(e),!Y.size&&Z&&(Z(),Z=null,X.clear())}}function ft(e){return(0,L.useSyncExternalStore)(dt,()=>e?X.get(e)??null:null,()=>null)}function pt(e){return e?e.status===`applying`?{className:`text-amber-600`,label:n(`channelConfigApplying`)}:e.status===`applied`?{className:`text-emerald-600`,label:n(`channelConfigApplied`)}:{className:`text-red-600`,label:`${n(`channelConfigApplyFailed`)}${e.message?`: ${e.message}`:``}`}:null}function mt(e){return(0,R.jsx)(P,{className:`px-6 py-5`,children:(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(j,{name:e.channelName,src:T(e.channelName),className:s(`h-9 w-9 rounded-lg border`,e.enabled?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,R.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e.channelName[0]})}),(0,R.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900 capitalize`,children:e.channelLabel})]}),(0,R.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:n(`channelsFormDescription`)}),e.channelApplyStatus?(0,R.jsx)(`p`,{className:s(`mt-2 text-xs font-medium`,e.channelApplyStatus.className),children:e.channelApplyStatus.label}):null,e.tutorialUrl?(0,R.jsxs)(`a`,{href:e.tutorialUrl,className:`mt-2 inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,R.jsx)(C,{className:`h-3.5 w-3.5`}),n(`channelsGuideTitle`)]}):null]}),(0,R.jsx)(D,{status:e.enabled?`active`:`inactive`,label:e.enabled?n(`statusActive`):n(`statusInactive`)})]})})}function ht(e){return(0,R.jsx)(R.Fragment,{children:e.layoutBlocks.map((t,n)=>{if(t.type===`fields`){let r=ct(e.fields,t.section);if(r.length===0)return null;let i=(0,R.jsx)(De,{channelName:e.channelName,fields:r,formData:e.formData,jsonDrafts:e.jsonDrafts,setJsonDrafts:e.setJsonDrafts,updateField:e.updateField,uiHints:e.uiHints});return t.collapsible?(0,R.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200/80 bg-white`,children:[(0,R.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-5 py-4 text-sm font-medium text-gray-900`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{children:t.collapsible.title}),t.collapsible.description?(0,R.jsx)(`p`,{className:`mt-1 text-xs font-normal text-gray-500`,children:t.collapsible.description}):null]}),(0,R.jsx)(ee,{className:`h-4 w-4 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,R.jsx)(`div`,{className:`space-y-6 border-t border-gray-100 px-5 py-5`,children:i})]},`${t.type}-${t.section}-${n}`):(0,R.jsx)(`div`,{children:i},`${t.type}-${t.section}-${n}`)}return t.sectionId===`weixin-auth`?(0,R.jsx)(nt,{channelConfig:e.channelConfig,formData:e.formData,channelEnabled:e.enabled,disabled:e.disabled},`${t.type}-${t.sectionId}-${n}`):null})})}function gt(e){let t=pe(),r=me(),[i,a]=(0,L.useState)(()=>({...e.channelConfig})),[o,s]=(0,L.useState)(()=>lt(e.channelConfig,e.fields)),[l,u]=(0,L.useState)(null),d=pt(ft(e.channelName)),f=typeof i.enabled==`boolean`?i.enabled:!!e.channelConfig.enabled,p=t.isPending||!!l,h=(e,t)=>a(n=>({...n,[e]:t})),g=r=>{r.preventDefault();let a={...i};for(let t of e.fields){if(t.type===`password`){let e=a[t.name];(typeof e!=`string`||e.length===0)&&delete a[t.name]}if(t.type===`json`)try{a[t.name]=(o[t.name]??``).trim()?JSON.parse(o[t.name]):{}}catch{m.error(`${n(`invalidJson`)}: ${t.name}`);return}}t.mutate({channel:e.channelName,data:a})},_=t=>{if(!Q(t?.channels)||!Q(t.channels[e.channelName]))return;let n=t.channels[e.channelName];a(e=>$(e,n)),s(t=>{let r={...t},i=!1;for(let t of e.fields)t.type!==`json`||!Object.prototype.hasOwnProperty.call(n,t.name)||(r[t.name]=JSON.stringify(n[t.name]??{},null,2),i=!0);return i?r:t})},v=async o=>{u(o.id);try{let s=`channels.${e.channelName}`,c={...i};o.saveBeforeRun&&(c={...c,...o.savePatch??{}},a(c),await t.mutateAsync({channel:e.channelName,data:c}));let l=await r.mutateAsync({actionId:o.id,data:{scope:s,draftConfig:st(s,c)}});_(l.patch),l.ok?m.success(l.message||n(`success`)):m.error(l.message||n(`error`))}catch(e){m.error(`${n(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{u(null)}};return(0,R.jsxs)(N,{children:[(0,R.jsx)(mt,{channelName:e.channelName,channelLabel:e.channelLabel,enabled:f,tutorialUrl:e.tutorialUrl,channelApplyStatus:d}),(0,R.jsxs)(`form`,{onSubmit:g,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsx)(F,{className:`space-y-6 px-6 py-5`,children:(0,R.jsx)(ht,{channelConfig:e.channelConfig,channelName:e.channelName,enabled:f,fields:e.fields,formData:i,jsonDrafts:o,layoutBlocks:e.layoutBlocks,setJsonDrafts:s,uiHints:e.uiHints,updateField:h,disabled:p})}),(0,R.jsxs)(be,{className:`flex flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.actions.filter(e=>e.trigger===`manual`).map(e=>(0,R.jsx)(c,{type:`button`,onClick:()=>void v(e),disabled:p,variant:`secondary`,children:l===e.id?n(`connecting`):e.title},e.id))}),(0,R.jsx)(c,{type:`submit`,disabled:p,children:t.isPending?n(`saving`):n(`save`)})]})]})]})}function _t({channelName:e}){let{data:t}=k(),{data:r}=A(),{data:i}=O(),a=e?t?.channels[e]??null:null,o=r?.channels.find(t=>t.name===e),s=(0,L.useMemo)(()=>it()[e||``],[e]);if(!e||!o||!a)return(0,R.jsx)(ve,{children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:n(`channelsSelectTitle`)}),(0,R.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:n(`channelsSelectDescription`)})]})});let c=s?.fields??at,l=s?.layout??ot,u=i?.uiHints,d=M(`channels.${e}`,u)?.label??e,f=J(o),p=JSON.stringify({channelName:e,channelConfig:a,jsonFields:c.filter(e=>e.type===`json`).map(e=>e.name)});return(0,R.jsx)(gt,{actions:i?.actions?.filter(t=>t.scope===`channels.${e}`)??[],channelConfig:a,channelLabel:d,channelName:e,fields:c,layoutBlocks:l,tutorialUrl:f,uiHints:u},p)}var vt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},yt=[`weixin`,`feishu`,`discord`,`qq`];function bt(e){let t=new Map(yt.map((e,t)=>[e,t]));return e.map((e,t)=>({channel:e,index:t})).sort((e,n)=>{let r=t.get(e.channel.name)??1/0,i=t.get(n.channel.name)??1/0;return r===i?e.index-n.index:r-i}).map(({channel:e})=>e)}function xt(){let{isMobile:e}=fe(),{data:t}=k(),{data:r}=A(),{data:i}=O(),[a,o]=(0,L.useState)(`enabled`),[c,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(``),m=(0,L.useMemo)(()=>bt(r?.channels??[]),[r?.channels]),h=t?.channels,_=(0,L.useMemo)(()=>{let e=f.trim().toLowerCase();return m.filter(e=>a!==`enabled`||!!h?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[a,h,m,f]),v=c&&_.some(e=>e.name===c)?c:e?null:_[0]?.name??null;return!t||!r?(0,R.jsx)(`div`,{className:`p-8 text-gray-400`,children:n(`channelsLoading`)}):(0,R.jsxs)(l,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,R.jsx)(u,{title:n(`channelsPageTitle`),description:n(`channelsPageDescription`)}),(0,R.jsxs)(_e,{className:`xl:min-h-0`,mobileView:e?v?`detail`:`list`:void 0,onMobileBack:()=>d(null),mobileListLabel:n(`channelsPageTitle`),children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(P,{className:`px-4 pt-4`,children:(0,R.jsx)(he,{tabs:[{id:`enabled`,label:n(`channelsTabEnabled`),count:m.filter(e=>h?.[e.name]?.enabled).length},{id:`all`,label:n(`channelsTabAll`),count:m.length}],activeTab:a,onChange:o,className:`mb-0`})}),(0,R.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,R.jsx)(g,{value:f,onChange:e=>p(e.target.value),placeholder:n(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,R.jsxs)(F,{className:`space-y-2 p-3`,children:[_.map(e=>{let r=!!t.channels[e.name]?.enabled,a=J(e),o=M(`channels.${e.name}`,i?.uiHints)?.help||n(vt[e.name]||`channelDescriptionDefault`);return(0,R.jsx)(xe,{onClick:()=>d(e.name),active:v===e.name,children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,R.jsx)(j,{name:e.name,src:T(e.name),className:s(`h-10 w-10 rounded-lg border`,r?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,R.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e.name[0]})}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.displayName||e.name}),(0,R.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:o})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a?(0,R.jsx)(`a`,{href:a,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500`,title:n(`channelsGuideTitle`),children:(0,R.jsx)(w,{className:`h-3.5 w-3.5`})}):null,(0,R.jsx)(D,{status:r?`active`:`inactive`,label:n(r?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),_.length===0?(0,R.jsx)(ye,{icon:le,title:n(`channelsNoMatch`)}):null]})]}),(0,R.jsx)(_t,{channelName:v??void 0})]})]})}export{xt as ChannelsList};
@@ -1 +0,0 @@
1
- import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-jGA3YQz4.js";import{At as o,Dt as s,Et as c,St as l,gt as u,kt as d,xt as f}from"./api-BsY-53_V.js";import{c as p,l as m,s as h}from"./chunk-JZWAC4HX-CD1w8mri.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./dialog-BNdeIVqc.js";import{t as S}from"./createLucideIcon-D48LQ7_3.js";import{D as C,M as w,T,j as E}from"./desktop-B9azAgEh.js";import{A as D,B as O,C as ee,D as te,E as ne,F as re,L as ie,M as ae,N as k,O as A,P as oe,S as se,T as ce,_ as j,a as le,b as ue,c as de,d as M,f as fe,g as pe,h as N,i as me,j as P,k as he,l as ge,m as _e,n as ve,o as ye,p as be,r as xe,s as F,t as Se,u as Ce,v as we,w as Te,x as Ee,y as I,z as L}from"./chat-a-_X0PmT.js";import{a as R,i as z,n as B,r as V,t as H}from"./select-BuXrS7g3.js";import{i as De,n as U,r as Oe,t as W}from"./provider-scoped-model-input-BkpcdlQB.js";import"./mcp-marketplace-page-DukryaOq.js";import{t as ke}from"./play-DGBx1fWI.js";import{t as G}from"./plus-CUuByV8j.js";import{t as K}from"./sparkles-Bo0DxmaB.js";import{t as q}from"./trash-2-gWTb2oNS.js";import{t as J}from"./notice-card-DE4jOEXF.js";import{t as Ae}from"./use-viewport-layout-DOqJ0LPT.js";import{g as je,m as Me,n as Y,o as Ne,p as Pe,r as Fe,s as Ie,y as Le}from"./use-config-Ds7DyaYQ.js";import{t as Re}from"./index-o_M3x0GR.js";import{t as ze}from"./tag-chip-BZSHb3cE.js";import{t as Be}from"./use-confirm-dialog-DLVARUvb.js";import{t as Ve}from"./marketplace-page-PA3qcNzv.js";var He=S(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ue=S(`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`}]]),X=e(n(),1),Z=i(),Q=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`textarea`,{className:a(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));Q.displayName=`Textarea`;var We={id:``,displayName:``,description:``,avatar:``,model:``,home:``,runtime:``};function Ge(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Ke(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=N(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:j(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function qe({value:e,disabled:n=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?N(e):``,s=Ke({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?t(`agentsRuntimeUnavailableHelp`):``);return(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(H,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:n,children:[(0,Z.jsx)(z,{"aria-label":t(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,Z.jsx)(R,{placeholder:t(`agentsRuntimeSelectPlaceholder`)})}),(0,Z.jsx)(B,{className:`rounded-xl`,children:s.map(e=>(0,Z.jsx)(V,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,Z.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Je({open:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Z.jsx)(x,{open:e,onOpenChange:a,children:e||t?(0,Z.jsx)(Xe,{pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e?`create-open`:`create-closed`):null})}function Ye({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Z.jsx)(x,{open:e!==null,onOpenChange:a,children:e?(0,Z.jsx)(Ze,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Xe(e){let{pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,X.useState)(We);return(0,Z.jsxs)(v,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Z.jsxs)(g,{className:`text-left`,children:[(0,Z.jsx)(y,{children:t(`agentsCreateDialogTitle`)}),(0,Z.jsx)(b,{children:t(`agentsCreateDialogDescription`)})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(d,{value:l.id,onChange:e=>u(t=>({...t,id:e.target.value})),placeholder:t(`agentsFormIdPlaceholder`)}),(0,Z.jsx)(d,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Z.jsx)(Q,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Z.jsx)(d,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Z.jsx)(d,{value:l.home,onChange:e=>u(t=>({...t,home:e.target.value})),placeholder:t(`agentsFormHomePlaceholder`)}),(0,Z.jsx)(W,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,Z.jsx)(qe,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,Z.jsx)(J,{tone:`warning`,title:t(`agentsCreateDialogHint`),className:`text-xs leading-6`})]})}),(0,Z.jsxs)(_,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:n,children:t(`cancel`)}),(0,Z.jsxs)(o,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>void c(l),disabled:n||l.id.trim().length===0,children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateAction`)]})]})]})}function Ze(e){let{agent:n,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:s,onOpenChange:c,onSubmit:l}=e,[u,f]=(0,X.useState)(Ge(n));return(0,Z.jsxs)(v,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Z.jsxs)(g,{className:`text-left`,children:[(0,Z.jsx)(y,{children:t(`agentsEditDialogTitle`)}),(0,Z.jsx)(b,{children:t(`agentsEditDialogDescription`)})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(J,{tone:`warning`,title:t(`agentsEditHomeReadonly`),description:t(`agentsEditHomeReadonlyHint`),children:(0,Z.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:n.workspace??`-`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(d,{value:u.displayName,onChange:e=>f(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Z.jsx)(Q,{value:u.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Z.jsx)(d,{value:u.avatar,onChange:e=>f(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Z.jsx)(W,{value:u.model,onChange:e=>f(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,Z.jsx)(qe,{value:u.runtime,onChange:e=>f(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:s,disabled:r})]})]})}),(0,Z.jsxs)(_,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>c(!1),disabled:r,children:t(`cancel`)}),(0,Z.jsxs)(o,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>l(n.id,u),disabled:r,children:[(0,Z.jsx)(L,{className:`mr-2 h-4 w-4`}),t(`agentsEditSaveAction`)]})]})]})}var Qe=[{strip:`bg-[#efc37a]`,chip:`border-[#f2d7a7] bg-[#fff8eb] text-[#8d5a18]`},{strip:`bg-[#8fd4c0]`,chip:`border-[#bde6da] bg-[#effbf7] text-[#156653]`},{strip:`bg-[#b7c9fb]`,chip:`border-[#d7e2ff] bg-[#f4f7ff] text-[#2d4d8f]`}];function $e(e,t){return t?{strip:`bg-[#e6b765]`,chip:`border-[#f2d19c] bg-[#fff8ec] text-[#90550d]`}:Qe[e%Qe.length]}function et(e){let{agentCount:n,onCreate:r}=e;return(0,Z.jsxs)(`section`,{className:`relative overflow-hidden rounded-[28px] border border-[#f0d6aa] bg-[linear-gradient(135deg,#fff7ea_0%,#fff9f1_32%,#f2fbff_100%)] px-5 py-5 sm:px-6`,children:[(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-0 w-[46%] bg-[radial-gradient(circle_at_top_right,rgba(255,215,163,0.52),transparent_54%)]`}),(0,Z.jsx)(`div`,{className:`absolute -bottom-10 left-8 h-32 w-32 rounded-full bg-[#ffe6c0]/55 blur-3xl`}),(0,Z.jsxs)(`div`,{className:`relative grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px] xl:items-center`,children:[(0,Z.jsxs)(`div`,{className:`max-w-3xl space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-white/70 bg-white/80 px-3 py-1 text-[11px] font-semibold tracking-[0.16em] text-[#9b6118]`,children:[(0,Z.jsx)(K,{className:`h-3.5 w-3.5`}),t(`agentsHeroEyebrow`)]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`h1`,{className:`max-w-2xl text-[30px] font-semibold leading-tight tracking-[-0.05em] text-[#2f2212] sm:text-[38px]`,children:t(`agentsHeroTitle`)}),(0,Z.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[#6d5841] sm:text-[15px] sm:leading-7`,children:t(`agentsHeroDescription`)})]}),(0,Z.jsx)(`div`,{className:`pt-1`,children:(0,Z.jsxs)(`div`,{className:`inline-flex items-center gap-3 rounded-2xl border border-[#f2d5a4] bg-white/82 px-3 py-2 text-[#7a4d12] shadow-[0_14px_30px_rgba(167,117,47,0.07)]`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.14em]`,children:t(`agentsOverviewTotal`)}),(0,Z.jsx)(`span`,{className:`text-xl font-semibold tracking-[-0.04em] text-[#1f2937]`,children:n})]})})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3`,children:[(0,Z.jsxs)(o,{type:`button`,variant:`primary`,className:`h-10 rounded-2xl px-5 text-sm font-semibold`,onClick:r,children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]}),(0,Z.jsx)(J,{title:t(`agentsCreateDialogHint`),className:`border-white/70 bg-white/72 text-xs leading-6 shadow-[0_18px_40px_rgba(167,117,47,0.08)]`})]})]})]})}function tt(e){let{agent:n,index:r,runtimeOptions:i,defaultRuntimeLabel:s,updatePending:c,deletePending:u,onStartChat:d,onEdit:p,onDelete:m}=e,h=$e(r,!!n.builtIn),g=n.runtime?.trim()||n.engine?.trim()||``,_=g?i.find(e=>e.value===N(g))?.label??j(g):s;return(0,Z.jsxs)(f,{className:`overflow-hidden border border-gray-200 bg-white shadow-sm transition-shadow duration-200 hover:shadow-md`,children:[(0,Z.jsx)(`div`,{className:a(`h-1.5 w-full`,h.strip)}),(0,Z.jsxs)(l,{className:`flex h-full flex-col gap-4 px-4 py-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(ie,{agentId:n.id,displayName:n.displayName,avatarUrl:n.avatarUrl,className:`h-11 w-11 shrink-0`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 pt-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`truncate text-lg font-semibold tracking-[-0.03em] text-[#1f2937]`,children:n.displayName?.trim()||n.id}),n.builtIn?(0,Z.jsxs)(ze,{tone:`warning`,className:a(`gap-1`,h.chip),children:[(0,Z.jsx)(Ue,{className:`h-3 w-3`}),t(`agentsCardBuiltInTag`)]}):null]}),(0,Z.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-[#94a3b8]`,children:[`@`,n.id]})]})]}),(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-[#64748b]`,children:n.description?.trim()||(n.builtIn?t(`agentsCardBuiltInSummary`):t(`agentsCardCustomSummary`))}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Z.jsx)(K,{className:`h-3.5 w-3.5`}),t(`agentsCardRuntimeLabel`)]}),(0,Z.jsx)(`div`,{className:`mt-1.5 text-sm leading-6 text-[#475569]`,children:_})]}),(0,Z.jsxs)(`div`,{className:`border-t border-gray-100 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Z.jsx)(O,{className:`h-3.5 w-3.5`}),t(`agentsCardHomeLabel`)]}),(0,Z.jsx)(`div`,{className:`mt-1.5 break-all text-sm leading-6 text-[#475569]`,children:n.workspace??`-`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(o,{type:`button`,variant:`primary`,className:`h-9 rounded-xl px-4`,onClick:d,children:[(0,Z.jsx)(C,{className:`mr-2 h-4 w-4`}),t(`agentsCardStartChat`)]}),(0,Z.jsxs)(o,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:p,disabled:c,children:[(0,Z.jsx)(L,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsEditAction`)]}),n.builtIn?null:(0,Z.jsxs)(o,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:m,disabled:u,children:[(0,Z.jsx)(q,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsRemoveAction`)]})]})]})]})]})}function nt(){let e=p(),n=I(),r=Y(),i=Fe(),a=F(),c=ue(),u=se(),d=Ee(),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),v=A(e=>e.setSnapshot),y=(0,X.useMemo)(()=>n.data?.agents??[],[n.data?.agents]),b=(0,X.useMemo)(()=>[...y].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[y]),x=(0,X.useMemo)(()=>U({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),S=(0,X.useMemo)(()=>_e(a.data?.options??[]),[a.data?.options]),C=(0,X.useMemo)(()=>N(a.data?.defaultType??`native`),[a.data?.defaultType]),w=(0,X.useMemo)(()=>S.find(e=>e.value===C)?.label??j(C),[C,S]),T=async e=>{await c.mutateAsync({data:{id:e.id,...e.displayName.trim()?{displayName:e.displayName.trim()}:{},...e.description.trim()?{description:e.description.trim()}:{},...e.avatar.trim()?{avatar:e.avatar.trim()}:{},...e.home.trim()?{home:e.home.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{},...e.runtime.trim()?{runtime:e.runtime.trim()}:{}}}),h(!1)},D=e=>{_(e)},O=async(e,t)=>{await u.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),_(null)},ee=t=>{v({selectedAgentId:t.id,selectedSessionKey:null}),k.getState().setSnapshot({pendingSessionType:pe(t,C),pendingProjectRoot:null,pendingProjectRootSessionKey:null}),e(`/chat`)};return(0,Z.jsxs)(s,{className:`space-y-5`,children:[(0,Z.jsx)(et,{agentCount:y.length,onCreate:()=>h(!0)}),(0,Z.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:n.isLoading?(0,Z.jsx)(f,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,Z.jsx)(l,{className:`py-14 text-center text-sm text-gray-500`,children:t(`agentsLoading`)})}):b.length===0?(0,Z.jsx)(f,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,Z.jsxs)(l,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,Z.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,Z.jsx)(E,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,Z.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:t(`agentsEmpty`)}),(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:t(`agentsEmptyDescription`)}),(0,Z.jsxs)(o,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>h(!0),children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]})]})}):b.map((e,t)=>(0,Z.jsx)(tt,{agent:e,index:t,runtimeOptions:S,defaultRuntimeLabel:w,updatePending:u.isPending,deletePending:d.isPending,onStartChat:()=>ee(e),onEdit:()=>D(e),onDelete:()=>d.mutate({agentId:e.id})},e.id))}),(0,Z.jsx)(Je,{open:m,pending:c.isPending,providerCatalog:x,runtimeOptions:S,defaultRuntime:C,onOpenChange:h,onSubmit:T}),(0,Z.jsx)(Ye,{agent:g,pending:u.isPending,providerCatalog:x,runtimeOptions:S,defaultRuntime:C,onOpenChange:e=>{!e&&!u.isPending&&_(null)},onSubmit:O})]})}function $(e){return r(e??void 0)}function rt(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:r(new Date(e))}function it(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function at(e){let{schedule:t}=e;return t.kind===`cron`?t.expr?`cron ${t.expr}`:`cron`:t.kind===`every`?`every ${it(t.everyMs)}`:t.kind===`at`?`at ${rt(t.atMs)}`:`-`}function ot(e){return e.payload.deliver?`${e.payload.channel??`-`}:${e.payload.to??`-`}`:`-`}function st(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function ct(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function lt(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function ut(e){let{job:n,onDelete:r,onRun:i,onToggle:s}=e;return(0,Z.jsx)(f,{className:`border border-gray-200`,children:(0,Z.jsx)(l,{className:`pt-5 pb-5`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:n.name||n.id}),(0,Z.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:n.id}),(0,Z.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,n.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:n.enabled?t(`enabled`):t(`disabled`)}),n.deleteAfterRun?(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:t(`cronOneShot`)}):null]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronScheduleLabel`),`: `,at(n)]}),(0,Z.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:n.payload.message}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronSessionLabel`),`: `,st(n)]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronDeliverTo`),`: `,ot(n)]})]}),(0,Z.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronNextRun`),`:`]}),` `,$(n.state.nextRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastRun`),`:`]}),` `,$(n.state.lastRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastStatus`),`:`]}),` `,n.state.lastStatus??`-`]}),n.state.lastError?(0,Z.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:n.state.lastError}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,Z.jsxs)(o,{variant:`subtle`,size:`sm`,onClick:()=>i(n),className:`gap-1`,children:[(0,Z.jsx)(ke,{className:`h-3.5 w-3.5`}),t(`cronRunNow`)]}),(0,Z.jsxs)(o,{variant:n.enabled?`outline`:`primary`,size:`sm`,onClick:()=>s(n),className:`gap-1`,children:[(0,Z.jsx)(He,{className:`h-3.5 w-3.5`}),n.enabled?t(`cronDisable`):t(`cronEnable`)]}),(0,Z.jsxs)(o,{variant:`destructive`,size:`sm`,onClick:()=>r(n),className:`gap-1`,children:[(0,Z.jsx)(q,{className:`h-3.5 w-3.5`}),t(`delete`)]})]})]})})})}function dt(){let[e,n]=(0,X.useState)(``),[r,i]=(0,X.useState)(`all`),l=Ne({all:!0}),u=Ie(),f=Le(),p=je(),{confirm:m,ConfirmDialog:h}=Be(),g=(0,X.useMemo)(()=>(l.data?.jobs??[]).filter(t=>ct(t,e)).filter(e=>lt(e,r)),[l.data,e,r]),_=async e=>{await m({title:`${t(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:t(`delete`)})&&u.mutate({id:e.id})},v=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronEnableConfirm`)}?`:`${t(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:n?`default`:`destructive`,confirmLabel:t(n?`cronEnable`:`cronDisable`)})&&f.mutate({id:e.id,enabled:n})},y=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronRunForceConfirm`)}?`:`${t(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:t(`cronRunNow`)})&&p.mutate({id:e.id,force:n})};return(0,Z.jsxs)(s,{fullHeight:!0,children:[(0,Z.jsx)(c,{title:t(`cronPageTitle`),description:t(`cronPageDescription`),actions:(0,Z.jsx)(o,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>l.refetch(),children:(0,Z.jsx)(T,{className:a(`h-4 w-4`,l.isFetching&&`animate-spin`)})})}),(0,Z.jsx)(`div`,{className:`mb-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,Z.jsx)(d,{value:e,onChange:e=>n(e.target.value),placeholder:t(`cronSearchPlaceholder`),className:`pl-9`}),(0,Z.jsx)(w,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,Z.jsx)(`div`,{className:`min-w-[180px]`,children:(0,Z.jsxs)(H,{value:r,onValueChange:e=>i(e),children:[(0,Z.jsx)(z,{className:`w-full`,children:(0,Z.jsx)(R,{placeholder:t(`cronStatusLabel`)})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(V,{value:`all`,children:t(`cronStatusAll`)}),(0,Z.jsx)(V,{value:`enabled`,children:t(`cronStatusEnabled`)}),(0,Z.jsx)(V,{value:`disabled`,children:t(`cronStatusDisabled`)})]})]})}),(0,Z.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[t(`cronTotalLabel`),`: `,l.data?.total??0,` / `,g.length]})]})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:l.isLoading?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronLoading`)}):g.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronEmpty`)}):(0,Z.jsx)(`div`,{className:`space-y-4`,children:g.map(e=>(0,Z.jsx)(ut,{job:e,onDelete:_,onRun:y,onToggle:v},e.id))})}),(0,Z.jsx)(h,{})]})}function ft(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,X.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,X.useEffect)(()=>{a.current=r},[r,a])}function pt({view:e,confirmDialog:t}){let{isMobile:n}=Ae();return(0,Z.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,Z.jsx)(Ce,{}),e===`chat`?n?(0,Z.jsx)(Re,{}):(0,Z.jsx)(be,{}):(0,Z.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(dt,{})})}):e===`agents`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(nt,{})})}):(0,Z.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(Ve,{forcedType:`skills`})})})}),t]})}function mt(e,t){return e.filter(e=>fe(e,t))}function ht(e){let{config:t,meta:n}=e;return(0,X.useMemo)(()=>{let e=U({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=Oe(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:De(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function gt(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,X.useMemo)(()=>Se({sessions:t,selectedSessionKey:n,sessionType:r}),[n,r,t]),recentSessionPreferredThinking:(0,X.useMemo)(()=>ve({sessions:t,selectedSessionKey:n,sessionType:r}),[n,r,t])}}function _t(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,X.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,X.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,X.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function vt(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function yt(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=Y(),u=Fe(),d=Me({limit:200}),f=F(),p=Pe({sessionId:a,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=ht({config:l.data,meta:u.data}),g=(0,X.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,X.useMemo)(()=>he(g),[g]),v=(0,X.useMemo)(()=>mt(_,i),[_,i]),y=(0,X.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,X.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=we({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,X.useMemo)(()=>vt({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=gt({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=_t({currentSelectedModel:t,modelOptions:S});return xe({modelOptions:S,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),me({supportedThinkingLevels:T,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function bt(e){return e.parentSessionKey?e.sessionSummaries.map(D).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function xt(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?M(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,X.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?D(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??j(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,X.useMemo)(()=>bt({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function St(e){(0,X.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:ee(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?M(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function Ct(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function wt(e){let t={};e.model?.trim()&&(t.model=e.model.trim(),t.preferred_model=e.model.trim()),e.thinkingLevel?.trim()&&(t.thinking=e.thinkingLevel.trim(),t.preferred_thinking=e.thinkingLevel.trim()),e.sessionType?.trim()&&(t.session_type=e.sessionType.trim(),t.runtime=e.sessionType.trim()),e.agentId?.trim()&&(t.agent_id=e.agentId.trim());let n=ae(e.projectRoot);n&&(t.project_root=n);let r=Ct(e.requestedSkills);r.length>0&&(t.requested_skill_refs=r);let i=e.composerNodes?ce(e.composerNodes):[];return i.length>0&&(t[Te]=i),t}function Tt(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Et(e){let t=A(e=>e.snapshot.query),n=A(e=>e.snapshot.selectedSessionKey),r=A(e=>e.snapshot.draftSessionKey),i=A(e=>e.snapshot.selectedAgentId),a=k(e=>e.snapshot.pendingSessionType),o=k(e=>e.snapshot.pendingProjectRoot),s=k(e=>e.snapshot.pendingProjectRootSessionKey),c=k(e=>e.snapshot.selectedModel),l=u(),d=ne(l),f=I(),{confirm:g,ConfirmDialog:_}=Be(),v=h(),y=p(),{sessionId:b}=m(),x=(0,X.useRef)(null),S=(0,X.useRef)(n),C=(0,X.useMemo)(()=>ye(b),[b]),w=C??n??r,T=o!==null&&s===w,E=yt({query:t,sessionKey:w,projectRootOverride:T?o:void 0,currentSelectedModel:c,pendingSessionType:a,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:i,pendingProjectRoot:o,pendingProjectRootSessionKey:s,systemStatus:l,isRuntimeBlocked:d,agentsQuery:f,confirm:g,ConfirmDialog:_,location:v,navigate:y,threadRef:x,selectedSessionKeyRef:S,routeSessionKey:C,sessionKey:w,hasSessionProjectRootOverride:T,agent:ge(w),...E}}function Dt(e){let t=Et(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=i?P(m):l?.projectName??P(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=s.phase===`ready`&&de(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],y=xt({sessionKey:d,selectedSession:l,selectedAgentId:c,availableAgents:v,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p});return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||n.isRunning,isAwaitingAssistantOutput:n.isRunning,canStopCurrentRun:n.isRunning,stopDisabledReason:n.isRunning?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?_:te({message:_,status:s}),...y}}function Ot(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKey:o,selectedSessionKeyRef:s,sessionKey:c}=e;(0,X.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if(e.sessionKey!==c)return;let o=wt({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),s=re({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(s)try{await t.send(s)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===c&&await t.streamRun()},resetStreamState:()=>{s.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,o,a?.projectRoot,s,c])}function kt(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r,selectedSessionKey:i}=e;(0,X.useEffect)(()=>{!r||!Tt({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||k.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r,i])}function At(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,X.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function jt(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,X.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function Mt({view:e}){let[t]=(0,X.useState)(()=>new le),n=Dt(t);return Ot(n),kt(n),At(n),jt(n),ft({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),St({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,Z.jsx)(oe,{presenter:t,children:(0,Z.jsx)(pt,{view:e,confirmDialog:(0,Z.jsx)(n.ConfirmDialog,{})})})}function Nt({view:e}){return(0,Z.jsx)(Mt,{view:e})}export{Nt as ChatPage};
@@ -1,3 +0,0 @@
1
- import{_ as e,m as t}from"./i18n-jGA3YQz4.js";import{Wt as n}from"./api-BsY-53_V.js";var r=e(t(),1),i=`popstate`;function a(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return u(``,{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:d(t)}return p(t,n,null,e)}function o(e,t){if(e===!1||e==null)throw Error(t)}function s(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function c(){return Math.random().toString(36).substring(2,10)}function l(e,t){return{usr:e.state,key:e.key,idx:t}}function u(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?f(t):t,state:n,key:t&&t.key||r||c()}}function d({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 f(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 p(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,s=a.history,c=`POP`,d=null,f=p();f??(f=0,s.replaceState({...s.state,idx:f},``));function p(){return(s.state||{idx:null}).idx}function h(){c=`POP`;let e=p(),t=e==null?null:e-f;f=e,d&&d({action:c,location:y.location,delta:t})}function g(e,t){c=`PUSH`;let r=u(y.location,e,t);n&&n(r,e),f=p()+1;let i=l(r,f),m=y.createHref(r);try{s.pushState(i,``,m)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;a.location.assign(m)}o&&d&&d({action:c,location:y.location,delta:1})}function _(e,t){c=`REPLACE`;let r=u(y.location,e,t);n&&n(r,e),f=p();let i=l(r,f),a=y.createHref(r);s.replaceState(i,``,a),o&&d&&d({action:c,location:y.location,delta:0})}function v(e){return m(e)}let y={get action(){return c},get location(){return e(a,s)},listen(e){if(d)throw Error(`A history only accepts one active listener`);return a.addEventListener(i,h),d=e,()=>{a.removeEventListener(i,h),d=null}},createHref(e){return t(a,e)},createURL:v,encodeLocation(e){let t=v(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:_,go(e){return s.go(e)}};return y}function m(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),o(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:d(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function h(e,t,n=`/`){return g(e,t,n,!1)}function g(e,t,n,r){let i=D((typeof t==`string`?f(t):t).pathname||`/`,n);if(i==null)return null;let a=v(e);b(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=oe(i);o=ie(a[e],t,r)}return o}function _(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 v(e,t=[],n=[],r=``,i=!1){let a=(e,a,s=i,c)=>{let l={relativePath:c===void 0?e.path||``:c,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(l.relativePath.startsWith(`/`)){if(!l.relativePath.startsWith(r)&&s)return;o(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length)}let u=j([r,l.relativePath]),d=n.concat(l);e.children&&e.children.length>0&&(o(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),v(e.children,t,d,u,s)),!(e.path==null&&!e.index)&&t.push({path:u,score:ne(u,e.index),routesMeta:d})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of y(e.path))a(e,t,!0,n)}),t}function y(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=y(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 b(e){e.sort((e,t)=>e.score===t.score?re(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var x=/^:[\w-]+$/,S=3,C=2,w=1,T=10,ee=-2,te=e=>e===`*`;function ne(e,t){let n=e.split(`/`),r=n.length;return n.some(te)&&(r+=ee),t&&(r+=C),n.filter(e=>!te(e)).reduce((e,t)=>e+(x.test(t)?S:t===``?w:T),r)}function re(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 ie(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=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:j([a,u.pathname]),pathnameBase:de(j([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=j([a,u.pathnameBase]))}return o}function E(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ae(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 ae(e,t=!1,n=!0){s(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 oe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return s(!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 D(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 se=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function ce(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?f(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?le(n.substring(1),`/`):le(n,t)):a=t,{pathname:a,search:fe(r),hash:pe(i)}}function le(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 O(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 ue(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function k(e){let t=ue(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function A(e,t,n,r=!1){let i;typeof e==`string`?i=f(e):(i={...e},o(!i.pathname||!i.pathname.includes(`?`),O(`?`,`pathname`,`search`,i)),o(!i.pathname||!i.pathname.includes(`#`),O(`#`,`pathname`,`hash`,i)),o(!i.search||!i.search.includes(`#`),O(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,s=a?`/`:i.pathname,c;if(s==null)c=n;else{let e=t.length-1;if(!r&&s.startsWith(`..`)){let t=s.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}c=e>=0?t[e]:`/`}let l=ce(i,c),u=s&&s!==`/`&&s.endsWith(`/`),d=(a||s===`.`)&&n.endsWith(`/`);return!l.pathname.endsWith(`/`)&&(u||d)&&(l.pathname+=`/`),l}var j=e=>e.join(`/`).replace(/\/\/+/g,`/`),de=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),fe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,pe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,me=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 he(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ge(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var _e=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ve(e,t){let n=e;if(typeof n!=`string`||!se.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(_e)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=D(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{s(!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 ye=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(ye);var be=[`GET`,...ye];new Set(be);var M=r.createContext(null);M.displayName=`DataRouter`;var N=r.createContext(null);N.displayName=`DataRouterState`;var xe=r.createContext(!1),Se=r.createContext({isTransitioning:!1});Se.displayName=`ViewTransition`;var Ce=r.createContext(new Map);Ce.displayName=`Fetchers`;var we=r.createContext(null);we.displayName=`Await`;var P=r.createContext(null);P.displayName=`Navigation`;var F=r.createContext(null);F.displayName=`Location`;var I=r.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var L=r.createContext(null);L.displayName=`RouteError`;var Te=`REACT_ROUTER_ERROR`,Ee=`REDIRECT`,De=`ROUTE_ERROR_RESPONSE`;function Oe(e){if(e.startsWith(`${Te}:${Ee}:{`))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 ke(e){if(e.startsWith(`${Te}:${De}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new me(t.status,t.statusText,t.data)}catch{}}function Ae(e,{relative:t}={}){o(R(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:i}=r.useContext(P),{hash:a,pathname:s,search:c}=V(e,{relative:t}),l=s;return n!==`/`&&(l=s===`/`?n:j([n,s])),i.createHref({pathname:l,search:c,hash:a})}function R(){return r.useContext(F)!=null}function z(){return o(R(),`useLocation() may be used only in the context of a <Router> component.`),r.useContext(F).location}var je=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Me(e){r.useContext(P).static||r.useLayoutEffect(e)}function B(){let{isDataRoute:e}=r.useContext(I);return e?Qe():Ne()}function Ne(){o(R(),`useNavigate() may be used only in the context of a <Router> component.`);let e=r.useContext(M),{basename:t,navigator:n}=r.useContext(P),{matches:i}=r.useContext(I),{pathname:a}=z(),c=JSON.stringify(k(i)),l=r.useRef(!1);return Me(()=>{l.current=!0}),r.useCallback((r,i={})=>{if(s(l.current,je),!l.current)return;if(typeof r==`number`){n.go(r);return}let o=A(r,JSON.parse(c),a,i.relative===`path`);e==null&&t!==`/`&&(o.pathname=o.pathname===`/`?t:j([t,o.pathname])),(i.replace?n.replace:n.push)(o,i.state,i)},[t,n,c,a,e])}r.createContext(null);function Pe(){let{matches:e}=r.useContext(I),t=e[e.length-1];return t?t.params:{}}function V(e,{relative:t}={}){let{matches:n}=r.useContext(I),{pathname:i}=z(),a=JSON.stringify(k(n));return r.useMemo(()=>A(e,JSON.parse(a),i,t===`path`),[e,a,i,t])}function Fe(e,t){return Ie(e,t)}function Ie(e,t,n,i,a){o(R(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:c}=r.useContext(P),{matches:l}=r.useContext(I),u=l[l.length-1],d=u?u.params:{},p=u?u.pathname:`/`,m=u?u.pathnameBase:`/`,g=u&&u.route;{let e=g&&g.path||``;et(p,!g||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (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 _=z(),v;if(t){let e=typeof t==`string`?f(t):t;o(m===`/`||e.pathname?.startsWith(m),`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 "${m}" but pathname "${e.pathname}" was given in the \`location\` prop.`),v=e}else v=_;let y=v.pathname||`/`,b=y;if(m!==`/`){let e=m.replace(/^\//,``).split(`/`);b=`/`+y.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let x=h(e,{pathname:b});s(g||x!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),s(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.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 S=He(x&&x.map(e=>Object.assign({},e,{params:Object.assign({},d,e.params),pathname:j([m,c.encodeLocation?c.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?m:j([m,c.encodeLocation?c.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),l,n,i,a);return t&&S?r.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...v},navigationType:`POP`}},S):S}function Le(){let e=Ze(),t=he(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i=`rgba(200,200,200, 0.5)`,a={padding:`0.5rem`,backgroundColor:i},o={padding:`2px 4px`,backgroundColor:i},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=r.createElement(r.Fragment,null,r.createElement(`p`,null,`💿 Hey developer 👋`),r.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,r.createElement(`code`,{style:o},`ErrorBoundary`),` or`,` `,r.createElement(`code`,{style:o},`errorElement`),` prop on your route.`)),r.createElement(r.Fragment,null,r.createElement(`h2`,null,`Unexpected Application Error!`),r.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?r.createElement(`pre`,{style:a},n):null,s)}var Re=r.createElement(Le,null),ze=class extends r.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=ke(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:r.createElement(I.Provider,{value:this.props.routeContext},r.createElement(L.Provider,{value:e,children:this.props.component}));return this.context?r.createElement(Be,{error:e},t):t}};ze.contextType=xe;var H=new WeakMap;function Be({children:e,error:t}){let{basename:n}=r.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Oe(t.digest);if(e){let i=H.get(t);if(i)throw i;let a=ve(e.location,n);if(_e&&!H.get(t))if(a.isExternal||e.reloadDocument)window.location.href=a.absoluteURL||a.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw H.set(t,n),n}return r.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a.absoluteURL||a.to}`})}}return e}function Ve({routeContext:e,match:t,children:n}){let i=r.useContext(M);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(I.Provider,{value:e},n)}function He(e,t=[],n=null,i=null,a=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 s=e,c=n?.errors;if(c!=null){let e=s.findIndex(e=>e.route.id&&c?.[e.route.id]!==void 0);o(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(`,`)}`),s=s.slice(0,Math.min(s.length,e+1))}let l=!1,u=-1;if(n)for(let e=0;e<s.length;e++){let t=s[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=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){l=!0,s=u>=0?s.slice(0,u+1):[s[0]];break}}}let d=n&&i?(e,t)=>{i(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:ge(n.matches),errorInfo:t})}:void 0;return s.reduceRight((e,i,a)=>{let o,f=!1,p=null,m=null;n&&(o=c&&i.route.id?c[i.route.id]:void 0,p=i.route.errorElement||Re,l&&(u<0&&a===0?(et(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):u===a&&(f=!0,m=i.route.hydrateFallbackElement||null)));let h=t.concat(s.slice(0,a+1)),g=()=>{let t;return t=o?p:f?m:i.route.Component?r.createElement(i.route.Component,null):i.route.element?i.route.element:e,r.createElement(Ve,{match:i,routeContext:{outlet:e,matches:h,isDataRoute:n!=null},children:t})};return n&&(i.route.ErrorBoundary||i.route.errorElement||a===0)?r.createElement(ze,{location:n.location,revalidation:n.revalidation,component:p,error:o,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:d}):g()},null)}function Ue(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function We(e){let t=r.useContext(M);return o(t,Ue(e)),t}function Ge(e){let t=r.useContext(N);return o(t,Ue(e)),t}function Ke(e){let t=r.useContext(I);return o(t,Ue(e)),t}function qe(e){let t=Ke(e),n=t.matches[t.matches.length-1];return o(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Je(){return qe(`useRouteId`)}function Ye(){return Ge(`useNavigation`).navigation}function Xe(){let{matches:e,loaderData:t}=Ge(`useMatches`);return r.useMemo(()=>e.map(e=>_(e,t)),[e,t])}function Ze(){let e=r.useContext(L),t=Ge(`useRouteError`),n=qe(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Qe(){let{router:e}=We(`useNavigate`),t=qe(`useNavigate`),n=r.useRef(!1);return Me(()=>{n.current=!0}),r.useCallback(async(r,i={})=>{s(n.current,je),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var $e={};function et(e,t,n){!t&&!$e[e]&&($e[e]=!0,s(!1,n))}r.useOptimistic,r.memo(tt);function tt({routes:e,future:t,state:n,onError:r}){return Ie(e,void 0,n,r,t)}function nt({to:e,replace:t,state:n,relative:i}){o(R(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a}=r.useContext(P);s(!a,`<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:c}=r.useContext(I),{pathname:l}=z(),u=B(),d=A(e,k(c),l,i===`path`),f=JSON.stringify(d);return r.useEffect(()=>{u(JSON.parse(f),{replace:t,state:n,relative:i})},[u,f,i,t,n]),null}function rt(e){o(!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 it({basename:e=`/`,children:t=null,location:n,navigationType:i=`POP`,navigator:a,static:c=!1,unstable_useTransitions:l}){o(!R(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let u=e.replace(/^\/*/,`/`),d=r.useMemo(()=>({basename:u,navigator:a,static:c,unstable_useTransitions:l,future:{}}),[u,a,c,l]);typeof n==`string`&&(n=f(n));let{pathname:p=`/`,search:m=``,hash:h=``,state:g=null,key:_=`default`}=n,v=r.useMemo(()=>{let e=D(p,u);return e==null?null:{location:{pathname:e,search:m,hash:h,state:g,key:_},navigationType:i}},[u,p,m,h,g,_,i]);return s(v!=null,`<Router basename="${u}"> is not able to match the URL "${p}${m}${h}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:r.createElement(P.Provider,{value:d},r.createElement(F.Provider,{children:t,value:v}))}function at({children:e,location:t}){return Fe(U(e),t)}r.Component;function U(e,t=[]){let n=[];return r.Children.forEach(e,(e,i)=>{if(!r.isValidElement(e))return;let a=[...t,i];if(e.type===r.Fragment){n.push.apply(n,U(e.props.children,a));return}o(e.type===rt,`[${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>`),o(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let s={id:e.props.id||a.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&&(s.children=U(e.props.children,a)),n.push(s)}),n}var W=`get`,G=`application/x-www-form-urlencoded`;function K(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function ot(e){return K(e)&&e.tagName.toLowerCase()===`button`}function st(e){return K(e)&&e.tagName.toLowerCase()===`form`}function ct(e){return K(e)&&e.tagName.toLowerCase()===`input`}function lt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ut(e,t){return e.button===0&&(!t||t===`_self`)&&!lt(e)}var q=null;function dt(){if(q===null)try{new FormData(document.createElement(`form`),0),q=!1}catch{q=!0}return q}var ft=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function J(e){return e!=null&&!ft.has(e)?(s(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${G}"`),null):e}function pt(e,t){let n,r,i,a,o;if(st(e)){let o=e.getAttribute(`action`);r=o?D(o,t):null,n=e.getAttribute(`method`)||W,i=J(e.getAttribute(`enctype`))||G,a=new FormData(e)}else if(ot(e)||ct(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?D(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||W,i=J(e.getAttribute(`formenctype`))||J(o.getAttribute(`enctype`))||G,a=new FormData(o,e),!dt()){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(K(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=W,r=null,i=G,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 mt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},ht=/[&><\u2028\u2029]/g;function gt(e){return e.replace(ht,e=>mt[e])}function Y(e,t){if(e===!1||e==null)throw Error(t)}function _t(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&&D(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function vt(e,t){if(e.id in t)return t[e.id];try{let r=await n(()=>import(e.module),[]);return t[e.id]=r,r}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 yt(e){return e!=null&&typeof e.page==`string`}function bt(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 xt(e,t,n){return Et((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await vt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(bt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function St(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 Ct(e,t,{includeHydrateFallback:n}={}){return wt(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 wt(e){return[...new Set(e)]}function Tt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Et(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!yt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Tt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Dt(){let e=r.useContext(M);return Y(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ot(){let e=r.useContext(N);return Y(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var X=r.createContext(void 0);X.displayName=`FrameworkContext`;function kt(){let e=r.useContext(X);return Y(e,`You must render this element inside a <HydratedRouter> element`),e}function At(e,t){let n=r.useContext(X),[i,a]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=r.useRef(null);r.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),r.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return n?e===`intent`?[o,p,{onFocus:Z(c,m),onBlur:Z(l,h),onMouseEnter:Z(u,m),onMouseLeave:Z(d,h),onTouchStart:Z(f,m)}]:[o,p,{}]:[!1,p,{}]}function Z(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function jt({page:e,...t}){let{router:n}=Dt(),i=r.useMemo(()=>h(n.routes,e,n.basename),[n.routes,e,n.basename]);return i?r.createElement(Nt,{page:e,matches:i,...t}):null}function Mt(e){let{manifest:t,routeModules:n}=kt(),[i,a]=r.useState([]);return r.useEffect(()=>{let r=!1;return xt(e,t,n).then(e=>{r||a(e)}),()=>{r=!0}},[e,t,n]),i}function Nt({page:e,matches:t,...n}){let i=z(),{future:a,manifest:o,routeModules:s}=kt(),{basename:c}=Dt(),{loaderData:l,matches:u}=Ot(),d=r.useMemo(()=>St(e,t,u,o,i,`data`),[e,t,u,o,i]),f=r.useMemo(()=>St(e,t,u,o,i,`assets`),[e,t,u,o,i]),p=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let u=_t(e,c,a.unstable_trailingSlashAwareDataRequests,`data`);return r&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,a.unstable_trailingSlashAwareDataRequests,l,i,o,d,t,e,s]),m=r.useMemo(()=>Ct(f,o),[f,o]),h=Mt(f);return r.createElement(r.Fragment,null,p.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>r.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>r.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Pt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}r.Component;var Ft=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Ft&&(window.__reactRouterVersion=`7.13.0`)}catch{}function It({basename:e,children:t,unstable_useTransitions:n,window:i}){let o=r.useRef();o.current??=a({window:i,v5Compat:!0});let s=o.current,[c,l]=r.useState({action:s.action,location:s.location}),u=r.useCallback(e=>{n===!1?l(e):r.startTransition(()=>l(e))},[n]);return r.useLayoutEffect(()=>s.listen(u),[s,u]),r.createElement(it,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:s,unstable_useTransitions:n})}function Lt({basename:e,children:t,history:n,unstable_useTransitions:i}){let[a,o]=r.useState({action:n.action,location:n.location}),s=r.useCallback(e=>{i===!1?o(e):r.startTransition(()=>o(e))},[i]);return r.useLayoutEffect(()=>n.listen(s),[n,s]),r.createElement(it,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:n,unstable_useTransitions:i})}Lt.displayName=`unstable_HistoryRouter`;var Rt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Q=r.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:i,reloadDocument:a,replace:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,unstable_useTransitions:g}=r.useContext(P),_=typeof l==`string`&&Rt.test(l),v=ve(l,h);l=v.to;let y=Ae(l,{relative:i}),[b,x,S]=At(n,p),C=Gt(l,{replace:o,state:s,target:c,preventScrollReset:u,relative:i,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:g});function w(t){e&&e(t),t.defaultPrevented||C(t)}let T=r.createElement(`a`,{...p,...S,href:v.absoluteURL||y,onClick:v.isExternal||a?e:w,ref:Pt(m,x),target:c,"data-discover":!_&&t===`render`?`true`:void 0});return b&&!_?r.createElement(r.Fragment,null,T,r.createElement(jt,{page:y})):T});Q.displayName=`Link`;var zt=r.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=V(o,{relative:l.relative}),f=z(),p=r.useContext(N),{navigator:m,basename:h}=r.useContext(P),g=p!=null&&en(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=D(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof a==`function`?a(C):a;return r.createElement(Q,{...l,"aria-current":w,className:T,ref:u,style:ee,to:o,viewTransition:s},typeof c==`function`?c(C):c)});zt.displayName=`NavLink`;var Bt=r.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:i,replace:a,state:o,method:s=W,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p,...m},h)=>{let{unstable_useTransitions:g}=r.useContext(P),_=Jt(),v=Yt(c,{relative:u}),y=s.toLowerCase()===`get`?`get`:`post`,b=typeof c==`string`&&Rt.test(c);return r.createElement(`form`,{ref:h,method:y,action:v,onSubmit:i?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let i=e.nativeEvent.submitter,c=i?.getAttribute(`formmethod`)||s,m=()=>_(i||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:a,state:o,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p});g&&n!==!1?r.startTransition(()=>m()):m()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});Bt.displayName=`Form`;function Vt({getKey:e,storageKey:t,...n}){let i=r.useContext(X),{basename:a}=r.useContext(P),o=z(),s=Xe();Qt({getKey:e,storageKey:t});let c=r.useMemo(()=>{if(!i||!e)return null;let t=Zt(o,s,a,e);return t===o.key?null:t},[]);if(!i||i.isSpaMode)return null;let l=((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 r.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${gt(JSON.stringify(t||Xt))}, ${gt(JSON.stringify(c))})`}})}Vt.displayName=`ScrollRestoration`;function Ht(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ut(e){let t=r.useContext(M);return o(t,Ht(e)),t}function Wt(e){let t=r.useContext(N);return o(t,Ht(e)),t}function Gt(e,{target:t,replace:n,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=B(),f=z(),p=V(e,{relative:o});return r.useCallback(m=>{if(ut(m,t)){m.preventDefault();let t=n===void 0?d(f)===d(p):n,h=()=>u(e,{replace:t,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?r.startTransition(()=>h()):h()}},[f,u,p,n,i,t,e,a,o,s,c,l])}var Kt=0,qt=()=>`__${String(++Kt)}__`;function Jt(){let{router:e}=Ut(`useSubmit`),{basename:t}=r.useContext(P),n=Je(),i=e.fetch,a=e.navigate;return r.useCallback(async(e,r={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=pt(e,t);r.navigate===!1?await i(r.fetcherKey||qt(),n,r.action||o,{unstable_defaultShouldRevalidate:r.unstable_defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,flushSync:r.flushSync}):await a(r.action||o,{unstable_defaultShouldRevalidate:r.unstable_defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,a,t,n])}function Yt(e,{relative:t}={}){let{basename:n}=r.useContext(P),i=r.useContext(I);o(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),s={...V(e||`.`,{relative:t})},c=z();if(e==null){s.search=c.search;let e=new URLSearchParams(s.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();s.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(s.pathname=s.pathname===`/`?n:j([n,s.pathname])),d(s)}var Xt=`react-router-scroll-positions`,$={};function Zt(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:D(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Qt({getKey:e,storageKey:t}={}){let{router:n}=Ut(`useScrollRestoration`),{restoreScrollPosition:i,preventScrollReset:a}=Wt(`useScrollRestoration`),{basename:o}=r.useContext(P),c=z(),l=Xe(),u=Ye();r.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),$t(r.useCallback(()=>{if(u.state===`idle`){let t=Zt(c,l,o,e);$[t]=window.scrollY}try{sessionStorage.setItem(t||Xt,JSON.stringify($))}catch(e){s(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[u.state,e,o,c,l,t])),typeof document<`u`&&(r.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Xt);e&&($=JSON.parse(e))}catch{}},[t]),r.useLayoutEffect(()=>{let t=n?.enableScrollRestoration($,()=>window.scrollY,e?(t,n)=>Zt(t,n,o,e):void 0);return()=>t&&t()},[n,o,e]),r.useLayoutEffect(()=>{if(i!==!1){if(typeof i==`number`){window.scrollTo(0,i);return}try{if(c.hash){let e=document.getElementById(decodeURIComponent(c.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{s(!1,`"${c.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[c,i,a]))}function $t(e,t){let{capture:n}=t||{};r.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function en(e,{relative:t}={}){let n=r.useContext(Se);o(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Ut(`useViewTransitionState`),a=V(e,{relative:t});if(!n.isTransitioning)return!1;let s=D(n.currentLocation.pathname,i)||n.currentLocation.pathname,c=D(n.nextLocation.pathname,i)||n.nextLocation.pathname;return E(a.pathname,c)!=null||E(a.pathname,s)!=null}export{rt as a,B as c,nt as i,Pe as l,Q as n,at as o,zt as r,z as s,It as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/doc-browser-eF2QWInq.js","assets/doc-browser-CLdhFEsz.js","assets/i18n-jGA3YQz4.js","assets/createLucideIcon-D48LQ7_3.js","assets/search-BUGoDsjN.js","assets/book-open-C5p9re7m.js","assets/external-link-BwNyDSMe.js","assets/plus-CUuByV8j.js","assets/x-CxanI1fH.js","assets/doc-browser-context-5mbkyvid.js"])))=>i.map(i=>d[i]);
2
- import{_ as e,a as t,i as n,m as r,p as i,u as a}from"./i18n-jGA3YQz4.js";import{At as o,Ct as s,Pt as c,St as l,Tt as u,Wt as d,bt as f,ht as ee,wt as p,xt as te,yt as ne}from"./api-BsY-53_V.js";import{r as re}from"./chunk-JZWAC4HX-CD1w8mri.js";import{t as m}from"./createLucideIcon-D48LQ7_3.js";import{n as ie,t as h}from"./search-BUGoDsjN.js";import{t as ae}from"./book-open-C5p9re7m.js";import{i as g,k as _,n as oe,r as se,t as ce}from"./select-BuXrS7g3.js";import{t as le}from"./key-round-BNTFD7Jk.js";import{h as ue,n as de}from"./app-manager-provider-DTrWjVLB.js";import{n as fe,t as pe}from"./settings-COxdZHdu.js";import{t as me}from"./sparkles-Bo0DxmaB.js";import{t as he}from"./x-CxanI1fH.js";import{i as ge}from"./doc-browser-context-5mbkyvid.js";import{n as _e}from"./doc-browser-CX_BvO6R.js";import{t as ve}from"./use-config-Ds7DyaYQ.js";import{n as ye,r as be,t as xe}from"./popover-B6dtrFF5.js";var v=m(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),y=m(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),b=m(`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`}]]),Se=m(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),x=m(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Ce=m(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),S=m(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),C=m(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),w=m(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),we=m(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),T=m(`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`}]]),Te=m(`Shield`,[[`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`}]]),Ee=m(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),De=m(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),E=m(`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`}]]),D=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Oe=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}D.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();D.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){D.setState({supported:!0,initialized:!0,busyAction:null}),c.error(`${n(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{D.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(n(`runtimePresenceLaunchAtLoginUnavailable`));D.setState({busyAction:`saving-preferences`});try{let r=await t.updatePresencePreferences(e);return D.setState({supported:!0,initialized:!0,snapshot:r}),c.success(n(`runtimePresenceSaved`)),r}catch(e){throw c.error(`${n(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{D.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:n(`error`)}},O=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),k=new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){O.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{O.setState({supported:!0,initialized:!0,snapshot:e})}),O.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();O.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){O.setState({supported:!0,initialized:!0}),c.error(`${n(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,n(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){c.success(n(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){c.success(n(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??n(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){c.success(n(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&c.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,n(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&c.success(n(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,n(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updatePreferences=async e=>{try{await this.runSnapshotCommand(`saving-preferences`,n(`desktopUpdatesPreferencesFailed`),async t=>await t.updatePreferences(e))}catch{return}},this.updateChannel=async e=>{if(O.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,n(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){c.success(n(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}c.success(n(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,r)=>{let i=this.getDesktopApi();if(!i)throw Error(n(`desktopUpdatesDesktopOnlyDescription`));O.setState({busyAction:e});try{let e=await r(i);return O.setState({snapshot:e}),e}catch(e){throw c.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{O.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:n(`error`),this.getChannelLabel=e=>n(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function A(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function j(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function M(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function ke(e){return[{target:`/chat`,label:e(`chat`),icon:C},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:b},{target:`/agents`,label:e(`agentsPageTitle`),icon:y},{target:`/settings`,label:e(`settings`),icon:pe}]}function Ae(e){return[{target:`/model`,label:e(`model`),icon:Se},{target:`/providers`,label:e(`providers`),icon:me},{target:`/channels`,label:e(`channels`),icon:fe},{target:`/search`,label:e(`searchChannels`),icon:h},{target:`/runtime`,label:e(`runtime`),icon:Se},{target:`/updates`,label:e(`updates`),icon:x},{target:`/remote`,label:e(`remote`),icon:De},{target:`/security`,label:e(`security`),icon:Te},{target:`/sessions`,label:e(`sessions`),icon:Ce},{target:`/secrets`,label:e(`secrets`),icon:le},{target:`/cron`,label:e(`cron`),icon:v},{target:`/marketplace/plugins`,label:e(`marketplaceFilterPlugins`),icon:we},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:E}]}function N(e){return[{target:`/language`,label:e(`language`),icon:S},...Ae(e)]}function je(e){let t=e.toLowerCase();return t===`/settings`?!0:N(e=>e).some(e=>A(t,e.target))}function Me(e,t){let n=e.toLowerCase(),r=N(t);if(M(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(A(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var P=`nextclaw.ui.theme`,F=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],I=`warm`,Ne=!1,L=new Set;function Pe(e){return e===`warm`||e===`cool`}function Fe(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function Ie(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(P);if(Pe(e))return e}catch{}return`warm`}function R(){return Ne||=(I=Ie(),Fe(I),!0),I}function Le(){return Ne?I:R()}function Re(e){if(R(),e!==I){if(I=e,Fe(I),typeof window<`u`)try{window.localStorage.setItem(P,I)}catch{}L.forEach(e=>e(I))}}function ze(e){return L.add(e),()=>{L.delete(e)}}var z=i(),Be={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function Ve(){let e=ee(),t=e.actionLabel===n(`runtimeStatusRestartAction`),r=async()=>{if(t)try{let e=await ne.runRuntimeControlAction(`restart-service`);c.success(e.message)}catch(e){let t=e instanceof Error?e.message:n(`runtimeControlActionFailed`);c.error(`${n(`runtimeControlActionFailed`)}: ${t}`)}};return(0,z.jsxs)(xe,{children:[(0,z.jsx)(be,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,z.jsx)(`span`,{className:a(`h-2.5 w-2.5 rounded-full`,Be[e.tone])})})}),(0,z.jsxs)(ye,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,z.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,z.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,z.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:n(`runtimeStatusActionHint`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?n(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function He({className:e,suffix:t}){let{data:n}=ve(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim(),a=t??(0,z.jsx)(Ve,{});return(0,z.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,z.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,z.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,z.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,z.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),i?(0,z.jsxs)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:[`v`,i]}):null,(0,z.jsx)(Ue,{}),a?(0,z.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:a}):null]})]})}function Ue(){let{supported:e,busyAction:t,snapshot:r}=O();return!e||!r?null:r.status===`downloading`?(0,z.jsx)(We,{snapshot:r}):r.status===`downloaded`?(0,z.jsx)(`button`,{type:`button`,className:a(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,B(r.status)),disabled:t===`applying`,onClick:()=>void k.applyDownloadedUpdate(),children:n(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)}):r.status===`update-available`?(0,z.jsx)(`button`,{type:`button`,className:a(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,B(r.status)),disabled:t===`downloading`,onClick:()=>void k.downloadUpdate(),children:n(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)}):r.status===`blocked`||r.status===`failed`?(0,z.jsx)(We,{snapshot:r}):null}function We({snapshot:e}){let t=Ge(e);return t?(0,z.jsx)(`span`,{className:a(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-semibold leading-none ring-1 transition-colors`,B(e.status)),title:n(`updates`),children:t}):null}function Ge(e){if(e.status===`downloading`){let t=e.progress?.percent;return t==null?n(`desktopUpdatesInlineDownloading`):n(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}return e.status===`downloaded`?n(`desktopUpdatesInlineReady`):e.status===`update-available`?n(`desktopUpdatesInlineDownload`):e.status===`blocked`||e.status===`failed`?n(`desktopUpdatesInlineAttention`):null}function B(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100 hover:bg-emerald-100 disabled:opacity-70`:e===`blocked`||e===`failed`?`bg-red-50 text-red-700 ring-red-100`:`bg-amber-50 text-amber-700 ring-amber-100 hover:bg-amber-100 disabled:opacity-70`}var Ke={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function V(e){return Ke[e]}function H({to:e,label:t,icon:n,density:r=`default`,className:i}){let o=V(r);return(0,z.jsx)(re,{to:e,className:({isActive:e})=>a(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n,{className:a(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function U({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=V(r);return(0,z.jsxs)(`button`,{type:`button`,onClick:n,className:a(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,i),"data-testid":l,children:[(0,z.jsx)(t,{className:a(d.icon,`shrink-0 text-gray-400`)}),(0,z.jsx)(`span`,{className:a(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,z.jsx)(`span`,{className:a(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function W({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:o=`default`,children:s}){let c=V(o);return(0,z.jsxs)(ce,{value:n,onValueChange:i,children:[(0,z.jsxs)(g,{className:a(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,z.jsxs)(`div`,{className:a(`flex min-w-0 items-center`,c.gap),children:[(0,z.jsx)(t,{className:a(c.icon,`text-gray-400`)}),(0,z.jsx)(`span`,{className:`text-left`,children:e})]}),(0,z.jsx)(`span`,{className:a(`ml-auto text-gray-500`,c.value),children:r})]}),(0,z.jsx)(oe,{children:s})]})}var G=`nextclaw-pwa-install-banner-dismissed`,K=`nextclaw-pwa-install-banner-dismissed-until`;function qe(){let e=q();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Xe(e):!1}function Je(){let e=q();e?.setItem(G,`1`),e?.removeItem(K)}function Ye(){let e=q();e?.removeItem(G),e?.removeItem(K)}function q(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Xe(e){let t=e.getItem(K);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(K),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(G,`1`),!0)}function Ze(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:qe(),updateAvailable:!1,registrationFailed:!1}}var J=f(()=>Ze()),Y=`nextclaw-pwa-dev-sw-reset`,X=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{J.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){J.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;J.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:J.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(Y)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(Y,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(Y)}catch{}}}},Z=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),J.setState(Ze())},this.refreshState=()=>{let e=this.resolveInstallability();J.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:qe()})),X.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Je(),J.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(Ye(),this.refreshState(),c.success(n(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,Ye(),J.setState({dismissedInstallPrompt:!0}),c.success(n(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function Qe(){let e=J(e=>e.installability);return(0,z.jsx)(`span`,{className:a(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:$e(e)})}function $e(e){return n(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function et(e,t,r){return n(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:r===`insecure-context`?`pwaInstallCardInsecureContext`:r===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function tt(){let e=J(e=>e.installability),t=J(e=>e.installMethod),r=J(e=>e.blockedReason);return(0,z.jsxs)(te,{children:[(0,z.jsxs)(p,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(u,{children:n(`pwaInstallTitle`)}),(0,z.jsx)(s,{children:n(`pwaInstallDescription`)})]}),(0,z.jsx)(Qe,{})]}),(0,z.jsxs)(l,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:et(e,t,r)})}),e===`available`&&t===`prompt`?(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsxs)(o,{type:`button`,className:`gap-2`,onClick:()=>{Z.promptInstall()},children:[(0,z.jsx)(x,{className:`h-4 w-4`}),n(`pwaInstallAction`)]}),(0,z.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,z.jsx)(Ee,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:n(`pwaInstallManualHint`)})]}):null]})]})}function nt(){let e=J(e=>e.installability),t=J(e=>e.installMethod),r=J(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||r?null:(0,z.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:n(`pwaInstallBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:n(`pwaInstallBannerDescription`)})]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":n(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Z.dismissInstallPrompt()},children:(0,z.jsx)(he,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,z.jsxs)(o,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Z.promptInstall()},children:[(0,z.jsx)(x,{className:`h-4 w-4`}),n(`pwaInstallAction`)]}),(0,z.jsx)(o,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Z.dismissInstallPrompt()},children:n(`pwaInstallDismiss`)})]})]})}function rt(){let e=J(e=>e.updateAvailable),t=J(e=>e.installability);return!e||t!==`installed`?null:(0,z.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:n(`pwaUpdateBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:n(`pwaUpdateBannerDescription`)})]})}),(0,z.jsx)(`div`,{className:`mt-4`,children:(0,z.jsxs)(o,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{X.applyUpdate()},children:[(0,z.jsx)(T,{className:`h-4 w-4`}),n(`pwaUpdateAction`)]})})]})}var it=!1;function at(){it||typeof window>`u`||(it=!0,Z.start(),X.start())}var ot={warm:`#F9F8F5`,cool:`#F8FAFB`},st=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=ot[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},Q=e(r(),1),ct=(0,Q.createContext)(null);function lt({children:e}){let[t,n]=(0,Q.useState)(()=>R());(0,Q.useEffect)(()=>{st.syncTheme(t)},[t]),(0,Q.useEffect)(()=>ze(e=>{n(e)}),[]);let r=(0,Q.useCallback)(e=>{Re(e),n(Le())},[]),i=(0,Q.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,z.jsx)(ct.Provider,{value:i,children:e})}function ut(){let e=(0,Q.useContext)(ct);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function dt(){let{language:e,setLanguage:n}=_e();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,Q.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}function ft(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:r,selectLanguage:i}=dt();return(0,z.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,z.jsx)(S,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:n(`language`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,z.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:r.map(t=>{let n=t.value===e;return(0,z.jsxs)(`button`,{type:`button`,onClick:()=>i(t.value),className:a(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,z.jsx)(_,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function pt({mode:e}){let t=de(),r=ge(),i=ue(),{currentLanguage:o,currentLanguageLabel:s,languageOptions:c,selectLanguage:l}=dt(),{theme:u,setTheme:d}=ut(),f=e===`settings`,ee=n(F.find(e=>e.value===u)?.labelKey??`themeWarm`),p=i.data?.account.email?.trim(),te=!!i.data?.account.loggedIn,ne=e=>{u!==e&&d(e)},m=[{target:`/chat`,label:n(`chat`),icon:C},{target:`/chat/cron`,label:n(`cron`),icon:v},{target:`/chat/skills`,label:n(`marketplaceFilterSkills`),icon:b},{target:`/agents`,label:n(`agentsPageTitle`),icon:y}],h=Ae(n),g=f?h:m,_=f?`compact`:`default`;return(0,z.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[f?(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,z.jsxs)(re,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,z.jsx)(ie,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,z.jsx)(`span`,{className:`truncate`,children:n(`backToMain`)})]}),(0,z.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,z.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:n(`settings`)})]})}):(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,z.jsx)(He,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,z.jsx)(`ul`,{className:a(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:g.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(H,{to:e.target,label:e.label,icon:e.icon,density:_})},e.target))})}),(0,z.jsxs)(`div`,{className:a(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,z.jsx)(U,{onClick:()=>t.accountManager.openAccountPanel(),icon:le,label:n(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:te?p||n(`remoteAccountEntryConnected`):n(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(H,{to:`/settings`,label:n(`settings`),icon:pe})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(W,{value:u,onValueChange:e=>ne(e),icon:w,label:n(`theme`),valueLabel:ee,density:_,children:F.map(e=>(0,z.jsx)(se,{value:e.value,className:`text-xs`,children:n(e.labelKey)},e.value))})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(W,{value:o,onValueChange:e=>l(e),icon:S,label:n(`language`),valueLabel:s,density:_,children:c.map(e=>(0,z.jsx)(se,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,z.jsx)(U,{onClick:()=>r.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:ae,label:n(`docBrowserHelp`),density:_})]})]})]})}var $=(0,Q.lazy)(async()=>({default:(await d(async()=>{let{DocBrowser:e}=await import(`./doc-browser-eF2QWInq.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function mt({pathname:e,isDocBrowserOpen:t,docBrowserMode:n,children:r}){let i=j(e);return(0,z.jsxs)(`div`,{className:`h-screen flex bg-background font-sans text-foreground`,children:[!i&&(0,z.jsx)(pt,{mode:`settings`}),(0,z.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,z.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:i?(0,z.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:r}):(0,z.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,z.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:r})})}),t&&n===`docked`?(0,z.jsx)(Q.Suspense,{fallback:null,children:(0,z.jsx)($,{})}):null]}),t&&n===`floating`?(0,z.jsx)(Q.Suspense,{fallback:null,children:(0,z.jsx)($,{})}):null]})}export{b as A,D as C,C as D,w as E,v as M,S as O,Oe as S,T,j as _,at as a,k as b,rt as c,W as d,He as f,M as g,N as h,ut as i,y as j,x as k,U as l,ke as m,ft as n,nt as o,F as p,lt as r,tt as s,mt as t,H as u,je as v,E as w,O as x,Me as y};
@@ -1 +0,0 @@
1
- import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-jGA3YQz4.js";import{At as o,Ct as s,Dt as c,Et as l,Ot as u,St as d,Tt as f,pt as p,wt as m,xt as h}from"./api-BsY-53_V.js";import{T as g,b as _,k as v,x as y}from"./desktop-B9azAgEh.js";import{a as b,i as x,n as S,r as C,t as w}from"./select-BuXrS7g3.js";import{t as T}from"./external-link-BwNyDSMe.js";import{t as E}from"./rotate-cw-CeTNbfMs.js";var D=e(n(),1),O=i(),k={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`};function A({status:e}){return(0,O.jsx)(`span`,{className:a(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,B(e)),children:z(e)})}function j({label:e,value:t}){return(0,O.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,O.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,O.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function M({snapshot:e}){if(e.status!==`downloading`)return null;let n=e.progress?.percent,r=n==null?t(`desktopUpdatesDownloadProgressUnknown`):t(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(n)),i=I(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,O.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,O.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,O.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${n??0}%`}})})]})}function N({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(u,{children:e}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,O.jsx)(p,{checked:n,disabled:r,onCheckedChange:i})]})}function P(e){return e?.trim()||`-`}function F(e){return e?r(e):`-`}function I(e,t){let n=L(e);return t&&t>0?`${n} / ${L(t)}`:n}function L(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function R(e){return t(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function z(e){return t(k[e]??`desktopUpdatesStatusIdle`)}function B(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function V(){return(0,O.jsxs)(c,{className:`space-y-6`,children:[(0,O.jsx)(l,{title:t(`desktopUpdatesPageTitle`),description:t(`desktopUpdatesPageDescription`)}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesDesktopOnlyTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesDesktopOnlyDescription`)})]}),(0,O.jsx)(d,{children:(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesDesktopOnlyFutureHint`)})})]})]})}function H(){let{supported:e,initialized:n,busyAction:r,snapshot:i}=y();if((0,D.useEffect)(()=>(_.start(),()=>{_.stop()}),[]),!n)return(0,O.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`loading`)});if(!e||!i)return(0,O.jsx)(V,{});let p=r===`checking`,k=r===`downloading`,I=r===`applying`,L=r===`saving-preferences`,z=r===`switching-channel`,B=i.status===`update-available`&&!k&&!I,H=i.status===`downloaded`&&!I,U=[[t(`desktopUpdatesLauncherVersion`),P(i.launcherVersion)],[t(`desktopUpdatesCurrentBundleVersion`),P(i.currentVersion)],[t(`desktopUpdatesAvailableVersion`),P(i.availableVersion)],[t(`desktopUpdatesLastCheckedAt`),F(i.lastCheckedAt)],[t(`desktopUpdatesCurrentChannel`),R(i.channel)]];return(0,O.jsxs)(c,{className:`space-y-6`,children:[(0,O.jsx)(l,{title:t(`desktopUpdatesPageTitle`),description:t(`desktopUpdatesPageDescription`),actions:(0,O.jsxs)(o,{variant:`outline`,onClick:()=>void _.checkForUpdates(),disabled:p||k||I,children:[(0,O.jsx)(g,{className:a(`mr-2 h-4 w-4`,p&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]})}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesOverviewTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesOverviewDescription`)})]}),(0,O.jsxs)(d,{className:`space-y-5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,O.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:t(`desktopUpdatesStatusLabel`)}),(0,O.jsx)(A,{status:i.status})]}),(0,O.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:U.map(([e,t])=>(0,O.jsx)(j,{label:e,value:t},e))}),i.channel===`beta`?(0,O.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:t(`desktopUpdatesBetaBadgeTitle`)}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:t(`desktopUpdatesBetaBadgeDescription`)})]}):null,i.downloadedVersion?(0,O.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:t(`desktopUpdatesDownloadedBannerTitle`)}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:t(`desktopUpdatesDownloadedBannerDescription`).replace(`{version}`,i.downloadedVersion)})]}):null,(0,O.jsx)(M,{snapshot:i}),i.status===`blocked`?(0,O.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:t(`desktopUpdatesBlockedTitle`)}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:i.errorMessage??t(`desktopUpdatesBlockedDescription`)}),i.recoveryCommand?(0,O.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:i.recoveryCommand}):null]}):null,i.errorMessage&&i.status!==`blocked`?(0,O.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:i.errorMessage}):null]})]}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesPreferencesTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesPreferencesDescription`)})]}),(0,O.jsxs)(d,{className:`space-y-5`,children:[(0,O.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(u,{children:t(`desktopUpdatesReleaseChannel`)}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelHelp`)})]}),(0,O.jsxs)(w,{value:i.channel,disabled:z||p||k||I,onValueChange:e=>void _.updateChannel(e),children:[(0,O.jsx)(x,{className:`w-full max-w-sm`,children:(0,O.jsx)(b,{placeholder:t(`desktopUpdatesReleaseChannel`)})}),(0,O.jsxs)(S,{children:[(0,O.jsx)(C,{value:`stable`,children:t(`desktopUpdatesChannelStable`)}),(0,O.jsx)(C,{value:`beta`,children:t(`desktopUpdatesChannelBeta`)})]})]}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,O.jsx)(N,{label:t(`desktopUpdatesAutomaticChecks`),help:t(`desktopUpdatesAutomaticChecksHelp`),checked:i.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void _.updatePreferences({automaticChecks:e})}),(0,O.jsx)(N,{label:t(`desktopUpdatesAutoDownload`),help:t(`desktopUpdatesAutoDownloadHelp`),checked:i.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void _.updatePreferences({autoDownload:e})})]})]}),(0,O.jsxs)(h,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(f,{children:t(`desktopUpdatesActionsTitle`)}),(0,O.jsx)(s,{children:t(`desktopUpdatesActionsDescription`)})]}),(0,O.jsxs)(d,{className:`flex flex-wrap items-center gap-3`,children:[(0,O.jsxs)(o,{variant:`outline`,onClick:()=>void _.checkForUpdates(),disabled:p||k||I,children:[(0,O.jsx)(g,{className:a(`mr-2 h-4 w-4`,p&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]}),(0,O.jsxs)(o,{onClick:()=>void _.downloadUpdate(),disabled:!B,children:[(0,O.jsx)(v,{className:a(`mr-2 h-4 w-4`,k&&`animate-bounce`)}),t(`desktopUpdatesDownloadNow`)]}),(0,O.jsxs)(o,{variant:`secondary`,onClick:()=>void _.applyDownloadedUpdate(),disabled:!H,children:[(0,O.jsx)(E,{className:a(`mr-2 h-4 w-4`,I&&`animate-spin`)}),t(`desktopUpdatesApplyNow`)]}),i.releaseNotesUrl?(0,O.jsxs)(o,{variant:`ghost`,onClick:()=>window.open(i.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,O.jsx)(T,{className:`mr-2 h-4 w-4`}),t(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{H as DesktopUpdateConfig};
@@ -1 +0,0 @@
1
- import{t as e}from"./doc-browser-CLdhFEsz.js";export{e as DocBrowser};