@kafca/agentdock 0.1.30 → 0.1.31

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 (92) hide show
  1. package/README.md +4 -0
  2. package/dist/renderer/assets/{Badge-DlVJI1Ys.js → Badge-DaHt-aUT.js} +1 -1
  3. package/dist/renderer/assets/{Chat-oa8OjaHQ.js → Chat-Dzeq3kiD.js} +1 -1
  4. package/dist/renderer/assets/{ChatMarkdown-C-N8KS5C.js → ChatMarkdown-B-L5Roai.js} +1 -1
  5. package/dist/renderer/assets/{Config-D9sL_d4D.js → Config-BI4LJ7Fw.js} +1 -1
  6. package/dist/renderer/assets/{CronList-Z5JU3DHk.js → CronList-Dic7pblj.js} +1 -1
  7. package/dist/renderer/assets/{Dashboard-D3BwbG43.js → Dashboard-C0_ATyGe.js} +2 -2
  8. package/dist/renderer/assets/{EmptyState-QOj765Ul.js → EmptyState-SQsG1DZP.js} +1 -1
  9. package/dist/renderer/assets/{KnowledgeDetail-J7n01mPu.js → KnowledgeDetail-D4yUJzp7.js} +1 -1
  10. package/dist/renderer/assets/{KnowledgeHome-BFnH0NVk.js → KnowledgeHome-L0tsg-oo.js} +1 -1
  11. package/dist/renderer/assets/{Logs-DfSUifXc.js → Logs-C2Jdr3uQ.js} +1 -1
  12. package/dist/renderer/assets/{Modal-QjEGhyru.js → Modal-GUH3iPXo.js} +1 -1
  13. package/dist/renderer/assets/{Page-qdHFSw7x.js → Page-m42FBy97.js} +1 -1
  14. package/dist/renderer/assets/{ProjectDetail-DS_rfvhh.js → ProjectDetail-RF_sagPO.js} +1 -1
  15. package/dist/renderer/assets/{ProjectList-COtyZd7H.js → ProjectList-Cyr8RDK3.js} +1 -1
  16. package/dist/renderer/assets/{Select-BQ8mncVu.js → Select-CRlDgI5s.js} +1 -1
  17. package/dist/renderer/assets/{SessionChat-DjVnjuQy.js → SessionChat-_HhzMwEO.js} +1 -1
  18. package/dist/renderer/assets/{SessionList-88dgGZJ8.js → SessionList-DNwZjGTv.js} +1 -1
  19. package/dist/renderer/assets/ThreadChat-DxBmdsAm.js +23 -0
  20. package/dist/renderer/assets/{Workspace-D_hzSJjX.js → Workspace-DFphG85O.js} +1 -1
  21. package/dist/renderer/assets/{arrow-left-BMpknulW.js → arrow-left-bILMzse7.js} +1 -1
  22. package/dist/renderer/assets/{book-open-CiaOeQbU.js → book-open-BNBWEEve.js} +1 -1
  23. package/dist/renderer/assets/{check-CgwYH4GF.js → check-MGp5kvnb.js} +1 -1
  24. package/dist/renderer/assets/{chevron-down-BzD2S1OO.js → chevron-down-zsfoTlh7.js} +1 -1
  25. package/dist/renderer/assets/{circle-BDHD7g7l.js → circle-BX_xUSg-.js} +1 -1
  26. package/dist/renderer/assets/{desktop-BiR5LPL5.js → desktop-CgrO_cdQ.js} +1 -1
  27. package/dist/renderer/assets/{desktop-BkMW-h5p.js → desktop-O8_6ZCVZ.js} +2 -2
  28. package/dist/renderer/assets/{funnel-Bruf5FYA.js → funnel-7442U1wq.js} +1 -1
  29. package/dist/renderer/assets/{heart-D7Mz04B0.js → heart-B3d8bnSH.js} +1 -1
  30. package/dist/renderer/assets/{index-gZIRr4_o.js → index-5YUqCvBf.js} +1 -1
  31. package/dist/renderer/assets/{index-CL1e8m3U.js → index-BBaYsVjU.js} +2 -2
  32. package/dist/renderer/assets/{pencil-C6gzDMse.js → pencil-QzWgkmoH.js} +1 -1
  33. package/dist/renderer/assets/{play-DqTXX-Pr.js → play-Bsc8hSI7.js} +1 -1
  34. package/dist/renderer/assets/{plug-ykmbeaO3.js → plug-CRY7sjvB.js} +1 -1
  35. package/dist/renderer/assets/{plus-DHE60vMX.js → plus-Dr5Ei8Ud.js} +1 -1
  36. package/dist/renderer/assets/projects-BDYSOFIJ.js +1 -0
  37. package/dist/renderer/assets/{save-CGIvrdQI.js → save-giJnp2Ki.js} +1 -1
  38. package/dist/renderer/assets/{search-D7IFAwyE.js → search-DcvHLmKs.js} +1 -1
  39. package/dist/renderer/assets/{server-aOsirp7I.js → server-D_Qu8If5.js} +1 -1
  40. package/dist/renderer/assets/{session-utils-Dxfp4ohQ.js → session-utils-CsASahfU.js} +1 -1
  41. package/dist/renderer/assets/{sessions-Db1XPbG2.js → sessions-eMpPqp4P.js} +1 -1
  42. package/dist/renderer/assets/{shield-check-ChXeQK-d.js → shield-check-BpF0uIw-.js} +1 -1
  43. package/dist/renderer/assets/{trash-2-CfN-c1zw.js → trash-2-OJFmx3xk.js} +1 -1
  44. package/dist/renderer/assets/{user-C7OHaBp4.js → user-GL_ivaV6.js} +1 -1
  45. package/dist/renderer/assets/{wifi-off-CpaJigye.js → wifi-off-CQT5VNQl.js} +1 -1
  46. package/dist/renderer/index.html +1 -1
  47. package/dist-electron/electron/agent-runtime-detector.test.js +30 -0
  48. package/dist-electron/electron/local-core-refactor.test.js +422 -0
  49. package/dist-electron/electron/plugin-kernel.test.js +81 -1
  50. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +28 -3
  51. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-turn-coordinator.js +102 -15
  52. package/dist-electron/services/local-ai-core/src/agents/claudecode/behavior.js +5 -0
  53. package/dist-electron/services/local-ai-core/src/agents/claudecode/definition.js +36 -0
  54. package/dist-electron/services/local-ai-core/src/agents/claudecode/index.js +15 -0
  55. package/dist-electron/services/local-ai-core/src/agents/codex/behavior.js +5 -0
  56. package/dist-electron/services/local-ai-core/src/agents/codex/definition.js +24 -0
  57. package/dist-electron/services/local-ai-core/src/agents/codex/index.js +15 -0
  58. package/dist-electron/services/local-ai-core/src/agents/hermes/behavior.js +29 -0
  59. package/dist-electron/services/local-ai-core/src/agents/hermes/definition.js +22 -0
  60. package/dist-electron/services/local-ai-core/src/agents/hermes/index.js +15 -0
  61. package/dist-electron/services/local-ai-core/src/agents/index.js +98 -0
  62. package/dist-electron/services/local-ai-core/src/agents/localcore-acp/behavior.js +5 -0
  63. package/dist-electron/services/local-ai-core/src/agents/localcore-acp/definition.js +14 -0
  64. package/dist-electron/services/local-ai-core/src/agents/localcore-acp/index.js +27 -0
  65. package/dist-electron/services/local-ai-core/src/agents/opencode/behavior.js +5 -0
  66. package/dist-electron/services/local-ai-core/src/agents/opencode/definition.js +18 -0
  67. package/dist-electron/services/local-ai-core/src/agents/opencode/index.js +15 -0
  68. package/dist-electron/services/local-ai-core/src/agents/opencode/launch.js +119 -0
  69. package/dist-electron/services/local-ai-core/src/agents/pi/behavior.js +5 -0
  70. package/dist-electron/services/local-ai-core/src/agents/pi/definition.js +23 -0
  71. package/dist-electron/services/local-ai-core/src/agents/pi/index.js +15 -0
  72. package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +139 -0
  73. package/dist-electron/services/local-ai-core/src/agents/shared/acp-behavior.js +11 -0
  74. package/dist-electron/services/local-ai-core/src/agents/shared/agent-plugin.js +60 -0
  75. package/dist-electron/services/local-ai-core/src/agents/shared/definition.js +12 -0
  76. package/dist-electron/services/local-ai-core/src/agents/shared/launch-utils.js +122 -0
  77. package/dist-electron/services/local-ai-core/src/agents/shared/progress-replay.js +19 -0
  78. package/dist-electron/services/local-ai-core/src/agents/shared/replay-prefix.js +68 -0
  79. package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +0 -2
  80. package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +0 -1
  81. package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +8 -7
  82. package/dist-electron/services/local-ai-core/src/plugins/builtin/agent-localcore-acp-plugin.js +9 -130
  83. package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +22 -397
  84. package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +9 -45
  85. package/dist-electron/services/local-ai-core/src/runtime/local-core-runtime-state.js +62 -1
  86. package/dist-electron/services/local-ai-core/src/runtime/runtime-detection-service.js +2 -12
  87. package/dist-electron/shared/desktop.js +3 -1
  88. package/dist-electron/src/pages/Threads/thread-chat-model.js +27 -18
  89. package/dist-electron/src/pages/Threads/thread-chat-permission.test.js +57 -18
  90. package/package.json +1 -1
  91. package/dist/renderer/assets/ThreadChat-BCdbTxBo.js +0 -23
  92. package/dist/renderer/assets/projects-Bx5p10th.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Dashboard-D3BwbG43.js","./Badge-DlVJI1Ys.js","./EmptyState-QOj765Ul.js","./Page-qdHFSw7x.js","./projects-Bx5p10th.js","./desktop-BiR5LPL5.js","./server-aOsirp7I.js","./book-open-CiaOeQbU.js","./shield-check-ChXeQK-d.js","./ThreadChat-BCdbTxBo.js","./Modal-QjEGhyru.js","./index-gZIRr4_o.js","./session-utils-Dxfp4ohQ.js","./desktop-BkMW-h5p.js","./ChatMarkdown-C-N8KS5C.js","./check-CgwYH4GF.js","./circle-BDHD7g7l.js","./user-C7OHaBp4.js","./chevron-down-BzD2S1OO.js","./wifi-off-CpaJigye.js","./search-D7IFAwyE.js","./pencil-C6gzDMse.js","./trash-2-CfN-c1zw.js","./Chat-oa8OjaHQ.js","./sessions-Db1XPbG2.js","./Workspace-D_hzSJjX.js","./Select-BQ8mncVu.js","./plus-DHE60vMX.js","./save-CGIvrdQI.js","./ProjectList-COtyZd7H.js","./heart-D7Mz04B0.js","./ProjectDetail-DS_rfvhh.js","./arrow-left-BMpknulW.js","./plug-ykmbeaO3.js","./play-DqTXX-Pr.js","./SessionList-88dgGZJ8.js","./funnel-Bruf5FYA.js","./SessionChat-DjVnjuQy.js","./CronList-Z5JU3DHk.js","./Config-D9sL_d4D.js","./Logs-DfSUifXc.js","./KnowledgeHome-BFnH0NVk.js","./KnowledgeDetail-J7n01mPu.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Dashboard-C0_ATyGe.js","./Badge-DaHt-aUT.js","./EmptyState-SQsG1DZP.js","./Page-m42FBy97.js","./projects-BDYSOFIJ.js","./desktop-CgrO_cdQ.js","./server-D_Qu8If5.js","./book-open-BNBWEEve.js","./shield-check-BpF0uIw-.js","./ThreadChat-DxBmdsAm.js","./Modal-GUH3iPXo.js","./index-5YUqCvBf.js","./session-utils-CsASahfU.js","./desktop-O8_6ZCVZ.js","./ChatMarkdown-B-L5Roai.js","./check-MGp5kvnb.js","./circle-BX_xUSg-.js","./user-GL_ivaV6.js","./chevron-down-zsfoTlh7.js","./wifi-off-CQT5VNQl.js","./search-DcvHLmKs.js","./pencil-QzWgkmoH.js","./trash-2-OJFmx3xk.js","./Chat-Dzeq3kiD.js","./sessions-eMpPqp4P.js","./Workspace-DFphG85O.js","./Select-CRlDgI5s.js","./plus-Dr5Ei8Ud.js","./save-giJnp2Ki.js","./ProjectList-Cyr8RDK3.js","./heart-B3d8bnSH.js","./ProjectDetail-RF_sagPO.js","./arrow-left-bILMzse7.js","./plug-CRY7sjvB.js","./play-Bsc8hSI7.js","./SessionList-DNwZjGTv.js","./funnel-7442U1wq.js","./SessionChat-_HhzMwEO.js","./CronList-Dic7pblj.js","./Config-BI4LJ7Fw.js","./Logs-C2Jdr3uQ.js","./KnowledgeHome-L0tsg-oo.js","./KnowledgeDetail-D4yUJzp7.js"])))=>i.map(i=>d[i]);
2
2
  var s0=Object.defineProperty;var o0=(i,l,r)=>l in i?s0(i,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[l]=r;var In=(i,l,r)=>o0(i,typeof l!="symbol"?l+"":l,r);function c0(i,l){for(var r=0;r<l.length;r++){const o=l[r];if(typeof o!="string"&&!Array.isArray(o)){for(const c in o)if(c!=="default"&&!(c in i)){const f=Object.getOwnPropertyDescriptor(o,c);f&&Object.defineProperty(i,c,f.get?f:{enumerable:!0,get:()=>o[c]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=r(c);fetch(c.href,f)}})();function Zm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var mo={exports:{}},Fl={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -173,5 +173,5 @@ Error generating stack: `+n.message+`
173
173
  * @license MIT
174
174
  */var dm="popstate";function hm(i){return typeof i=="object"&&i!=null&&"pathname"in i&&"search"in i&&"hash"in i&&"state"in i&&"key"in i}function rv(i={}){function l(c,f){let{pathname:h="/",search:g="",hash:p=""}=hn(c.location.hash.substring(1));return!h.startsWith("/")&&!h.startsWith(".")&&(h="/"+h),zo("",{pathname:h,search:g,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function r(c,f){let h=c.document.querySelector("base"),g="";if(h&&h.getAttribute("href")){let p=c.location.href,m=p.indexOf("#");g=m===-1?p:p.slice(0,m)}return g+"#"+(typeof f=="string"?f:li(f))}function o(c,f){Ct(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(f)})`)}return ov(l,r,o,i)}function Le(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function Ct(i,l){if(!i){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function sv(){return Math.random().toString(36).substring(2,10)}function mm(i,l){return{usr:i.state,key:i.key,idx:l,masked:i.unstable_mask?{pathname:i.pathname,search:i.search,hash:i.hash}:void 0}}function zo(i,l,r=null,o,c){return{pathname:typeof i=="string"?i:i.pathname,search:"",hash:"",...typeof l=="string"?hn(l):l,state:r,key:l&&l.key||o||sv(),unstable_mask:c}}function li({pathname:i="/",search:l="",hash:r=""}){return l&&l!=="?"&&(i+=l.charAt(0)==="?"?l:"?"+l),r&&r!=="#"&&(i+=r.charAt(0)==="#"?r:"#"+r),i}function hn(i){let l={};if(i){let r=i.indexOf("#");r>=0&&(l.hash=i.substring(r),i=i.substring(0,r));let o=i.indexOf("?");o>=0&&(l.search=i.substring(o),i=i.substring(0,o)),i&&(l.pathname=i)}return l}function ov(i,l,r,o={}){let{window:c=document.defaultView,v5Compat:f=!1}=o,h=c.history,g="POP",p=null,m=b();m==null&&(m=0,h.replaceState({...h.state,idx:m},""));function b(){return(h.state||{idx:null}).idx}function v(){g="POP";let B=b(),q=B==null?null:B-m;m=B,p&&p({action:g,location:H.location,delta:q})}function N(B,q){g="PUSH";let Q=hm(B)?B:zo(H.location,B,q);r&&r(Q,B),m=b()+1;let X=mm(Q,m),J=H.createHref(Q.unstable_mask||Q);try{h.pushState(X,"",J)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;c.location.assign(J)}f&&p&&p({action:g,location:H.location,delta:1})}function L(B,q){g="REPLACE";let Q=hm(B)?B:zo(H.location,B,q);r&&r(Q,B),m=b();let X=mm(Q,m),J=H.createHref(Q.unstable_mask||Q);h.replaceState(X,"",J),f&&p&&p({action:g,location:H.location,delta:0})}function z(B){return cv(B)}let H={get action(){return g},get location(){return i(c,h)},listen(B){if(p)throw new Error("A history only accepts one active listener");return c.addEventListener(dm,v),p=B,()=>{c.removeEventListener(dm,v),p=null}},createHref(B){return l(c,B)},createURL:z,encodeLocation(B){let q=z(B);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:N,replace:L,go(B){return h.go(B)}};return H}function cv(i,l=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Le(r,"No window.location.(origin|href) available to create URL");let o=typeof i=="string"?i:li(i);return o=o.replace(/ $/,"%20"),!l&&o.startsWith("//")&&(o=r+o),new URL(o,r)}function Pm(i,l,r="/"){return fv(i,l,r,!1)}function fv(i,l,r,o){let c=typeof l=="string"?hn(l):l,f=ga(c.pathname||"/",r);if(f==null)return null;let h=eg(i);dv(h);let g=null;for(let p=0;g==null&&p<h.length;++p){let m=Tv(f);g=xv(h[p],m,o)}return g}function eg(i,l=[],r=[],o="",c=!1){let f=(h,g,p=c,m)=>{let b={relativePath:m===void 0?h.path||"":m,caseSensitive:h.caseSensitive===!0,childrenIndex:g,route:h};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(o)&&p)return;Le(b.relativePath.startsWith(o),`Absolute route path "${b.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(o.length)}let v=Qt([o,b.relativePath]),N=r.concat(b);h.children&&h.children.length>0&&(Le(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),eg(h.children,l,N,v,p)),!(h.path==null&&!h.index)&&l.push({path:v,score:bv(v,h.index),routesMeta:N})};return i.forEach((h,g)=>{var p;if(h.path===""||!((p=h.path)!=null&&p.includes("?")))f(h,g);else for(let m of tg(h.path))f(h,g,!0,m)}),l}function tg(i){let l=i.split("/");if(l.length===0)return[];let[r,...o]=l,c=r.endsWith("?"),f=r.replace(/\?$/,"");if(o.length===0)return c?[f,""]:[f];let h=tg(o.join("/")),g=[];return g.push(...h.map(p=>p===""?f:[f,p].join("/"))),c&&g.push(...h),g.map(p=>i.startsWith("/")&&p===""?"/":p)}function dv(i){i.sort((l,r)=>l.score!==r.score?r.score-l.score:Sv(l.routesMeta.map(o=>o.childrenIndex),r.routesMeta.map(o=>o.childrenIndex)))}var hv=/^:[\w-]+$/,mv=3,gv=2,pv=1,yv=10,vv=-2,gm=i=>i==="*";function bv(i,l){let r=i.split("/"),o=r.length;return r.some(gm)&&(o+=vv),l&&(o+=gv),r.filter(c=>!gm(c)).reduce((c,f)=>c+(hv.test(f)?mv:f===""?pv:yv),o)}function Sv(i,l){return i.length===l.length&&i.slice(0,-1).every((o,c)=>o===l[c])?i[i.length-1]-l[l.length-1]:0}function xv(i,l,r=!1){let{routesMeta:o}=i,c={},f="/",h=[];for(let g=0;g<o.length;++g){let p=o[g],m=g===o.length-1,b=f==="/"?l:l.slice(f.length)||"/",v=Uu({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},b),N=p.route;if(!v&&m&&r&&!o[o.length-1].route.index&&(v=Uu({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},b)),!v)return null;Object.assign(c,v.params),h.push({params:c,pathname:Qt([f,v.pathname]),pathnameBase:Ov(Qt([f,v.pathnameBase])),route:N}),v.pathnameBase!=="/"&&(f=Qt([f,v.pathnameBase]))}return h}function Uu(i,l){typeof i=="string"&&(i={path:i,caseSensitive:!1,end:!0});let[r,o]=Ev(i.path,i.caseSensitive,i.end),c=l.match(r);if(!c)return null;let f=c[0],h=f.replace(/(.)\/+$/,"$1"),g=c.slice(1);return{params:o.reduce((m,{paramName:b,isOptional:v},N)=>{if(b==="*"){let z=g[N]||"";h=f.slice(0,f.length-z.length).replace(/(.)\/+$/,"$1")}const L=g[N];return v&&!L?m[b]=void 0:m[b]=(L||"").replace(/%2F/g,"/"),m},{}),pathname:f,pathnameBase:h,pattern:i}}function Ev(i,l=!1,r=!0){Ct(i==="*"||!i.endsWith("*")||i.endsWith("/*"),`Route path "${i}" will be treated as if it were "${i.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${i.replace(/\*$/,"/*")}".`);let o=[],c="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,g,p,m,b)=>{if(o.push({paramName:g,isOptional:p!=null}),p){let v=b.charAt(m+h.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return i.endsWith("*")?(o.push({paramName:"*"}),c+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?c+="\\/*$":i!==""&&i!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,l?void 0:"i"),o]}function Tv(i){try{return i.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Ct(!1,`The URL path "${i}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),i}}function ga(i,l){if(l==="/")return i;if(!i.toLowerCase().startsWith(l.toLowerCase()))return null;let r=l.endsWith("/")?l.length-1:l.length,o=i.charAt(r);return o&&o!=="/"?null:i.slice(r)||"/"}var Rv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function _v(i,l="/"){let{pathname:r,search:o="",hash:c=""}=typeof i=="string"?hn(i):i,f;return r?(r=ag(r),r.startsWith("/")?f=pm(r.substring(1),"/"):f=pm(r,l)):f=l,{pathname:f,search:Av(o),hash:zv(c)}}function pm(i,l){let r=ku(l).split("/");return i.split("/").forEach(c=>{c===".."?r.length>1&&r.pop():c!=="."&&r.push(c)}),r.length>1?r.join("/"):"/"}function So(i,l,r,o){return`Cannot include a '${i}' character in a manually specified \`to.${l}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Cv(i){return i.filter((l,r)=>r===0||l.route.path&&l.route.path.length>0)}function qo(i){let l=Cv(i);return l.map((r,o)=>o===l.length-1?r.pathname:r.pathnameBase)}function Vu(i,l,r,o=!1){let c;typeof i=="string"?c=hn(i):(c={...i},Le(!c.pathname||!c.pathname.includes("?"),So("?","pathname","search",c)),Le(!c.pathname||!c.pathname.includes("#"),So("#","pathname","hash",c)),Le(!c.search||!c.search.includes("#"),So("#","search","hash",c)));let f=i===""||c.pathname==="",h=f?"/":c.pathname,g;if(h==null)g=r;else{let v=l.length-1;if(!o&&h.startsWith("..")){let N=h.split("/");for(;N[0]==="..";)N.shift(),v-=1;c.pathname=N.join("/")}g=v>=0?l[v]:"/"}let p=_v(c,g),m=h&&h!=="/"&&h.endsWith("/"),b=(f||h===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(m||b)&&(p.pathname+="/"),p}var ag=i=>i.replace(/\/\/+/g,"/"),Qt=i=>ag(i.join("/")),ku=i=>i.replace(/\/+$/,""),Ov=i=>ku(i).replace(/^\/*/,"/"),Av=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,zv=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i,Nv=class{constructor(i,l,r,o=!1){this.status=i,this.statusText=l||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function wv(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}function jv(i){let l=i.map(r=>r.route.path).filter(Boolean);return Qt(l)||"/"}var ng=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lg(i,l){let r=i;if(typeof r!="string"||!Rv.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let o=r,c=!1;if(ng)try{let f=new URL(window.location.href),h=r.startsWith("//")?new URL(f.protocol+r):new URL(r),g=ga(h.pathname,l);h.origin===f.origin&&g!=null?r=g+h.search+h.hash:c=!0}catch{Ct(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ig=["POST","PUT","PATCH","DELETE"];new Set(ig);var Mv=["GET",...ig];new Set(Mv);var tl=T.createContext(null);tl.displayName="DataRouter";var Ku=T.createContext(null);Ku.displayName="DataRouterState";var ug=T.createContext(!1);function Lv(){return T.useContext(ug)}var rg=T.createContext({isTransitioning:!1});rg.displayName="ViewTransition";var Dv=T.createContext(new Map);Dv.displayName="Fetchers";var Uv=T.createContext(null);Uv.displayName="Await";var At=T.createContext(null);At.displayName="Navigation";var ci=T.createContext(null);ci.displayName="Location";var qt=T.createContext({outlet:null,matches:[],isDataRoute:!1});qt.displayName="Route";var Yo=T.createContext(null);Yo.displayName="RouteError";var sg="REACT_ROUTER_ERROR",kv="REDIRECT",Hv="ROUTE_ERROR_RESPONSE";function Bv(i){if(i.startsWith(`${sg}:${kv}:{`))try{let l=JSON.parse(i.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function qv(i){if(i.startsWith(`${sg}:${Hv}:{`))try{let l=JSON.parse(i.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new Nv(l.status,l.statusText,l.data)}catch{}}function Yv(i,{relative:l}={}){Le(al(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:o}=T.useContext(At),{hash:c,pathname:f,search:h}=fi(i,{relative:l}),g=f;return r!=="/"&&(g=f==="/"?r:Qt([r,f])),o.createHref({pathname:g,search:h,hash:c})}function al(){return T.useContext(ci)!=null}function zt(){return Le(al(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(ci).location}var og="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cg(i){T.useContext(At).static||T.useLayoutEffect(i)}function Qu(){let{isDataRoute:i}=T.useContext(qt);return i?a1():Gv()}function Gv(){Le(al(),"useNavigate() may be used only in the context of a <Router> component.");let i=T.useContext(tl),{basename:l,navigator:r}=T.useContext(At),{matches:o}=T.useContext(qt),{pathname:c}=zt(),f=JSON.stringify(qo(o)),h=T.useRef(!1);return cg(()=>{h.current=!0}),T.useCallback((p,m={})=>{if(Ct(h.current,og),!h.current)return;if(typeof p=="number"){r.go(p);return}let b=Vu(p,JSON.parse(f),c,m.relative==="path");i==null&&l!=="/"&&(b.pathname=b.pathname==="/"?l:Qt([l,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[l,r,f,c,i])}var Vv=T.createContext(null);function Kv(i){let l=T.useContext(qt).outlet;return T.useMemo(()=>l&&T.createElement(Vv.Provider,{value:i},l),[l,i])}function fg(){let{matches:i}=T.useContext(qt),l=i[i.length-1];return(l==null?void 0:l.params)??{}}function fi(i,{relative:l}={}){let{matches:r}=T.useContext(qt),{pathname:o}=zt(),c=JSON.stringify(qo(r));return T.useMemo(()=>Vu(i,JSON.parse(c),o,l==="path"),[i,c,o,l])}function Qv(i,l){return dg(i,l)}function dg(i,l,r){var B;Le(al(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=T.useContext(At),{matches:c}=T.useContext(qt),f=c[c.length-1],h=f?f.params:{},g=f?f.pathname:"/",p=f?f.pathnameBase:"/",m=f&&f.route;{let q=m&&m.path||"";mg(g,!m||q.endsWith("*")||q.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${q}">) 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.
175
175
 
176
- Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}/*`}">.`)}let b=zt(),v;if(l){let q=typeof l=="string"?hn(l):l;Le(p==="/"||((B=q.pathname)==null?void 0:B.startsWith(p)),`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 "${p}" but pathname "${q.pathname}" was given in the \`location\` prop.`),v=q}else v=b;let N=v.pathname||"/",L=N;if(p!=="/"){let q=p.replace(/^\//,"").split("/");L="/"+N.replace(/^\//,"").split("/").slice(q.length).join("/")}let z=Pm(i,{pathname:L});Ct(m||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Ct(z==null||z[z.length-1].route.element!==void 0||z[z.length-1].route.Component!==void 0||z[z.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 H=Fv(z&&z.map(q=>Object.assign({},q,{params:Object.assign({},h,q.params),pathname:Qt([p,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?p:Qt([p,o.encodeLocation?o.encodeLocation(q.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathnameBase])})),c,r);return l&&H?T.createElement(ci.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},H):H}function Xv(){let i=t1(),l=wv(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),r=i instanceof Error?i.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},f={padding:"2px 4px",backgroundColor:o},h=null;return console.error("Error handled by React Router default ErrorBoundary:",i),h=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:f},"ErrorBoundary")," or"," ",T.createElement("code",{style:f},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},l),r?T.createElement("pre",{style:c},r):null,h)}var Zv=T.createElement(Xv,null),hg=class extends T.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,l){return l.location!==i.location||l.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:l.error,location:l.location,revalidation:i.revalidation||l.revalidation}}componentDidCatch(i,l){this.props.onError?this.props.onError(i,l):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const r=qv(i.digest);r&&(i=r)}let l=i!==void 0?T.createElement(qt.Provider,{value:this.props.routeContext},T.createElement(Yo.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?T.createElement($v,{error:i},l):l}};hg.contextType=ug;var xo=new WeakMap;function $v({children:i,error:l}){let{basename:r}=T.useContext(At);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=Bv(l.digest);if(o){let c=xo.get(l);if(c)throw c;let f=lg(o.location,r);if(ng&&!xo.get(l))if(f.isExternal||o.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:o.replace}));throw xo.set(l,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return i}function Jv({routeContext:i,match:l,children:r}){let o=T.useContext(tl);return o&&o.static&&o.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=l.route.id),T.createElement(qt.Provider,{value:i},r)}function Fv(i,l=[],r){let o=r==null?void 0:r.state;if(i==null){if(!o)return null;if(o.errors)i=o.matches;else if(l.length===0&&!o.initialized&&o.matches.length>0)i=o.matches;else return null}let c=i,f=o==null?void 0:o.errors;if(f!=null){let b=c.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);Le(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let h=!1,g=-1;if(r&&o){h=o.renderFallback;for(let b=0;b<c.length;b++){let v=c[b];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=b),v.route.id){let{loaderData:N,errors:L}=o,z=v.route.loader&&!N.hasOwnProperty(v.route.id)&&(!L||L[v.route.id]===void 0);if(v.route.lazy||z){r.isStatic&&(h=!0),g>=0?c=c.slice(0,g+1):c=[c[0]];break}}}}let p=r==null?void 0:r.onError,m=o&&p?(b,v)=>{var N,L;p(b,{location:o.location,params:((L=(N=o.matches)==null?void 0:N[0])==null?void 0:L.params)??{},unstable_pattern:jv(o.matches),errorInfo:v})}:void 0;return c.reduceRight((b,v,N)=>{let L,z=!1,H=null,B=null;o&&(L=f&&v.route.id?f[v.route.id]:void 0,H=v.route.errorElement||Zv,h&&(g<0&&N===0?(mg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,B=null):g===N&&(z=!0,B=v.route.hydrateFallbackElement||null)));let q=l.concat(c.slice(0,N+1)),Q=()=>{let X;return L?X=H:z?X=B:v.route.Component?X=T.createElement(v.route.Component,null):v.route.element?X=v.route.element:X=b,T.createElement(Jv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:X})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(hg,{location:o.location,revalidation:o.revalidation,component:H,error:L,children:Q(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):Q()},null)}function Go(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wv(i){let l=T.useContext(tl);return Le(l,Go(i)),l}function Iv(i){let l=T.useContext(Ku);return Le(l,Go(i)),l}function Pv(i){let l=T.useContext(qt);return Le(l,Go(i)),l}function Vo(i){let l=Pv(i),r=l.matches[l.matches.length-1];return Le(r.route.id,`${i} can only be used on routes that contain a unique "id"`),r.route.id}function e1(){return Vo("useRouteId")}function t1(){var o;let i=T.useContext(Yo),l=Iv("useRouteError"),r=Vo("useRouteError");return i!==void 0?i:(o=l.errors)==null?void 0:o[r]}function a1(){let{router:i}=Wv("useNavigate"),l=Vo("useNavigate"),r=T.useRef(!1);return cg(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ct(r.current,og),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var ym={};function mg(i,l,r){!l&&!ym[i]&&(ym[i]=!0,Ct(!1,r))}T.memo(n1);function n1({routes:i,future:l,state:r,isStatic:o,onError:c}){return dg(i,void 0,{state:r,isStatic:o,onError:c})}function Ya({to:i,replace:l,state:r,relative:o}){Le(al(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(At);Ct(!c,"<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:f}=T.useContext(qt),{pathname:h}=zt(),g=Qu(),p=Vu(i,qo(f),h,o==="path"),m=JSON.stringify(p);return T.useEffect(()=>{g(JSON.parse(m),{replace:l,state:r,relative:o})},[g,m,o,l,r]),null}function l1(i){return Kv(i.context)}function on(i){Le(!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 i1({basename:i="/",children:l=null,location:r,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){Le(!al(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=i.replace(/^\/*/,"/"),p=T.useMemo(()=>({basename:g,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[g,c,f,h]);typeof r=="string"&&(r=hn(r));let{pathname:m="/",search:b="",hash:v="",state:N=null,key:L="default",unstable_mask:z}=r,H=T.useMemo(()=>{let B=ga(m,g);return B==null?null:{location:{pathname:B,search:b,hash:v,state:N,key:L,unstable_mask:z},navigationType:o}},[g,m,b,v,N,L,o,z]);return Ct(H!=null,`<Router basename="${g}"> is not able to match the URL "${m}${b}${v}" because it does not start with the basename, so the <Router> won't render anything.`),H==null?null:T.createElement(At.Provider,{value:p},T.createElement(ci.Provider,{children:l,value:H}))}function u1({children:i,location:l}){return Qv(No(i),l)}function No(i,l=[]){let r=[];return T.Children.forEach(i,(o,c)=>{if(!T.isValidElement(o))return;let f=[...l,c];if(o.type===T.Fragment){r.push.apply(r,No(o.props.children,f));return}Le(o.type===on,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Le(!o.props.index||!o.props.children,"An index route cannot have child routes.");let h={id:o.props.id||f.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(h.children=No(o.props.children,f)),r.push(h)}),r}var Mu="get",Lu="application/x-www-form-urlencoded";function Xu(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function r1(i){return Xu(i)&&i.tagName.toLowerCase()==="button"}function s1(i){return Xu(i)&&i.tagName.toLowerCase()==="form"}function o1(i){return Xu(i)&&i.tagName.toLowerCase()==="input"}function c1(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function f1(i,l){return i.button===0&&(!l||l==="_self")&&!c1(i)}function wo(i=""){return new URLSearchParams(typeof i=="string"||Array.isArray(i)||i instanceof URLSearchParams?i:Object.keys(i).reduce((l,r)=>{let o=i[r];return l.concat(Array.isArray(o)?o.map(c=>[r,c]):[[r,o]])},[]))}function d1(i,l){let r=wo(i);return l&&l.forEach((o,c)=>{r.has(c)||l.getAll(c).forEach(f=>{r.append(c,f)})}),r}var wu=null;function h1(){if(wu===null)try{new FormData(document.createElement("form"),0),wu=!1}catch{wu=!0}return wu}var m1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eo(i){return i!=null&&!m1.has(i)?(Ct(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lu}"`),null):i}function g1(i,l){let r,o,c,f,h;if(s1(i)){let g=i.getAttribute("action");o=g?ga(g,l):null,r=i.getAttribute("method")||Mu,c=Eo(i.getAttribute("enctype"))||Lu,f=new FormData(i)}else if(r1(i)||o1(i)&&(i.type==="submit"||i.type==="image")){let g=i.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=i.getAttribute("formaction")||g.getAttribute("action");if(o=p?ga(p,l):null,r=i.getAttribute("formmethod")||g.getAttribute("method")||Mu,c=Eo(i.getAttribute("formenctype"))||Eo(g.getAttribute("enctype"))||Lu,f=new FormData(g,i),!h1()){let{name:m,type:b,value:v}=i;if(b==="image"){let N=m?`${m}.`:"";f.append(`${N}x`,"0"),f.append(`${N}y`,"0")}else m&&f.append(m,v)}}else{if(Xu(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Mu,o=null,c=Lu,h=i}return f&&c==="text/plain"&&(h=f,f=void 0),{action:o,method:r.toLowerCase(),encType:c,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ko(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function gg(i,l,r,o){let c=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return r?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:l&&ga(c.pathname,l)==="/"?c.pathname=`${ku(l)}/_root.${o}`:c.pathname=`${ku(c.pathname)}.${o}`,c}async function p1(i,l){if(i.id in l)return l[i.id];try{let r=await import(i.module);return l[i.id]=r,r}catch(r){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function y1(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function v1(i,l,r){let o=await Promise.all(i.map(async c=>{let f=l.routes[c.route.id];if(f){let h=await p1(f,r);return h.links?h.links():[]}return[]}));return E1(o.flat(1).filter(y1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function vm(i,l,r,o,c,f){let h=(p,m)=>r[m]?p.route.id!==r[m].route.id:!0,g=(p,m)=>{var b;return r[m].pathname!==p.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==p.params["*"]};return f==="assets"?l.filter((p,m)=>h(p,m)||g(p,m)):f==="data"?l.filter((p,m)=>{var v;let b=o.routes[p.route.id];if(!b||!b.hasLoader)return!1;if(h(p,m)||g(p,m))return!0;if(p.route.shouldRevalidate){let N=p.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=r[0])==null?void 0:v.params)||{},nextUrl:new URL(i,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof N=="boolean")return N}return!0}):[]}function b1(i,l,{includeHydrateFallback:r}={}){return S1(i.map(o=>{let c=l.routes[o.route.id];if(!c)return[];let f=[c.module];return c.clientActionModule&&(f=f.concat(c.clientActionModule)),c.clientLoaderModule&&(f=f.concat(c.clientLoaderModule)),r&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function S1(i){return[...new Set(i)]}function x1(i){let l={},r=Object.keys(i).sort();for(let o of r)l[o]=i[o];return l}function E1(i,l){let r=new Set;return new Set(l),i.reduce((o,c)=>{let f=JSON.stringify(x1(c));return r.has(f)||(r.add(f),o.push({key:f,link:c})),o},[])}function Qo(){let i=T.useContext(tl);return Ko(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function T1(){let i=T.useContext(Ku);return Ko(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Xo=T.createContext(void 0);Xo.displayName="FrameworkContext";function Zo(){let i=T.useContext(Xo);return Ko(i,"You must render this element inside a <HydratedRouter> element"),i}function R1(i,l){let r=T.useContext(Xo),[o,c]=T.useState(!1),[f,h]=T.useState(!1),{onFocus:g,onBlur:p,onMouseEnter:m,onMouseLeave:b,onTouchStart:v}=l,N=T.useRef(null);T.useEffect(()=>{if(i==="render"&&h(!0),i==="viewport"){let H=q=>{q.forEach(Q=>{h(Q.isIntersecting)})},B=new IntersectionObserver(H,{threshold:.5});return N.current&&B.observe(N.current),()=>{B.disconnect()}}},[i]),T.useEffect(()=>{if(o){let H=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(H)}}},[o]);let L=()=>{c(!0)},z=()=>{c(!1),h(!1)};return r?i!=="intent"?[f,N,{}]:[f,N,{onFocus:Il(g,L),onBlur:Il(p,z),onMouseEnter:Il(m,L),onMouseLeave:Il(b,z),onTouchStart:Il(v,L)}]:[!1,N,{}]}function Il(i,l){return r=>{i&&i(r),r.defaultPrevented||l(r)}}function _1({page:i,...l}){let r=Lv(),{router:o}=Qo(),c=T.useMemo(()=>Pm(o.routes,i,o.basename),[o.routes,i,o.basename]);return c?r?T.createElement(O1,{page:i,matches:c,...l}):T.createElement(A1,{page:i,matches:c,...l}):null}function C1(i){let{manifest:l,routeModules:r}=Zo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return v1(i,l,r).then(h=>{f||c(h)}),()=>{f=!0}},[i,l,r]),o}function O1({page:i,matches:l,...r}){let o=zt(),{future:c}=Zo(),{basename:f}=Qo(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let g=gg(i,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),p=!1,m=[];for(let b of l)typeof b.route.shouldRevalidate=="function"?p=!0:m.push(b.route.id);return p&&m.length>0&&g.searchParams.set("_routes",m.join(",")),[g.pathname+g.search]},[f,c.unstable_trailingSlashAwareDataRequests,i,o,l]);return T.createElement(T.Fragment,null,h.map(g=>T.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})))}function A1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=Zo(),{basename:g}=Qo(),{loaderData:p,matches:m}=T1(),b=T.useMemo(()=>vm(i,l,m,f,o,"data"),[i,l,m,f,o]),v=T.useMemo(()=>vm(i,l,m,f,o,"assets"),[i,l,m,f,o]),N=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let H=new Set,B=!1;if(l.forEach(Q=>{var J;let X=f.routes[Q.route.id];!X||!X.hasLoader||(!b.some(V=>V.route.id===Q.route.id)&&Q.route.id in p&&((J=h[Q.route.id])!=null&&J.shouldRevalidate)||X.hasClientLoader?B=!0:H.add(Q.route.id))}),H.size===0)return[];let q=gg(i,g,c.unstable_trailingSlashAwareDataRequests,"data");return B&&H.size>0&&q.searchParams.set("_routes",l.filter(Q=>H.has(Q.route.id)).map(Q=>Q.route.id).join(",")),[q.pathname+q.search]},[g,c.unstable_trailingSlashAwareDataRequests,p,o,f,b,l,i,h]),L=T.useMemo(()=>b1(v,f),[v,f]),z=C1(v);return T.createElement(T.Fragment,null,N.map(H=>T.createElement("link",{key:H,rel:"prefetch",as:"fetch",href:H,...r})),L.map(H=>T.createElement("link",{key:H,rel:"modulepreload",href:H,...r})),z.map(({key:H,link:B})=>T.createElement("link",{key:H,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function z1(...i){return l=>{i.forEach(r=>{typeof r=="function"?r(l):r!=null&&(r.current=l)})}}var N1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{N1&&(window.__reactRouterVersion="7.14.2")}catch{}function w1({basename:i,children:l,unstable_useTransitions:r,window:o}){let c=T.useRef();c.current==null&&(c.current=rv({window:o,v5Compat:!0}));let f=c.current,[h,g]=T.useState({action:f.action,location:f.location}),p=T.useCallback(m=>{r===!1?g(m):T.startTransition(()=>g(m))},[r]);return T.useLayoutEffect(()=>f.listen(p),[f,p]),T.createElement(i1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var pg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yg=T.forwardRef(function({onClick:l,discover:r="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:g,state:p,target:m,to:b,preventScrollReset:v,viewTransition:N,unstable_defaultShouldRevalidate:L,...z},H){let{basename:B,navigator:q,unstable_useTransitions:Q}=T.useContext(At),X=typeof b=="string"&&pg.test(b),J=lg(b,B);b=J.to;let V=Yv(b,{relative:c}),ue=zt(),K=null;if(g){let De=Vu(g,[],ue.unstable_mask?ue.unstable_mask.pathname:"/",!0);B!=="/"&&(De.pathname=De.pathname==="/"?B:Qt([B,De.pathname])),K=q.createHref(De)}let[te,le,se]=R1(o,z),Ae=L1(b,{replace:h,unstable_mask:g,state:p,target:m,preventScrollReset:v,relative:c,viewTransition:N,unstable_defaultShouldRevalidate:L,unstable_useTransitions:Q});function Fe(De){l&&l(De),De.defaultPrevented||Ae(De)}let ze=!(J.isExternal||f),je=T.createElement("a",{...z,...se,href:(ze?K:void 0)||J.absoluteURL||V,onClick:ze?Fe:l,ref:z1(H,le),target:m,"data-discover":!X&&r==="render"?"true":void 0});return te&&!X?T.createElement(T.Fragment,null,je,T.createElement(_1,{page:V})):je});yg.displayName="Link";var jo=T.forwardRef(function({"aria-current":l="page",caseSensitive:r=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:g,children:p,...m},b){let v=fi(h,{relative:m.relative}),N=zt(),L=T.useContext(Ku),{navigator:z,basename:H}=T.useContext(At),B=L!=null&&B1(v)&&g===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,Q=N.pathname,X=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(Q=Q.toLowerCase(),X=X?X.toLowerCase():null,q=q.toLowerCase()),X&&H&&(X=ga(X,H)||X);const J=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=Q===q||!c&&Q.startsWith(q)&&Q.charAt(J)==="/",ue=X!=null&&(X===q||!c&&X.startsWith(q)&&X.charAt(q.length)==="/"),K={isActive:V,isPending:ue,isTransitioning:B},te=V?l:void 0,le;typeof o=="function"?le=o(K):le=[o,V?"active":null,ue?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let se=typeof f=="function"?f(K):f;return T.createElement(yg,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:g},typeof p=="function"?p(K):p)});jo.displayName="NavLink";var j1=T.forwardRef(({discover:i="render",fetcherKey:l,navigate:r,reloadDocument:o,replace:c,state:f,method:h=Mu,action:g,onSubmit:p,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N,...L},z)=>{let{unstable_useTransitions:H}=T.useContext(At),B=k1(),q=H1(g,{relative:m}),Q=h.toLowerCase()==="get"?"get":"post",X=typeof g=="string"&&pg.test(g),J=V=>{if(p&&p(V),V.defaultPrevented)return;V.preventDefault();let ue=V.nativeEvent.submitter,K=(ue==null?void 0:ue.getAttribute("formmethod"))||h,te=()=>B(ue||V.currentTarget,{fetcherKey:l,method:K,navigate:r,replace:c,state:f,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N});H&&r!==!1?T.startTransition(()=>te()):te()};return T.createElement("form",{ref:z,method:Q,action:q,onSubmit:o?p:J,...L,"data-discover":!X&&i==="render"?"true":void 0})});j1.displayName="Form";function M1(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vg(i){let l=T.useContext(tl);return Le(l,M1(i)),l}function L1(i,{target:l,replace:r,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let b=Qu(),v=zt(),N=fi(i,{relative:h});return T.useCallback(L=>{if(f1(L,l)){L.preventDefault();let z=r!==void 0?r:li(v)===li(N),H=()=>b(i,{replace:z,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p});m?T.startTransition(()=>H()):H()}},[v,b,N,r,o,c,l,i,f,h,g,p,m])}function t2(i){Ct(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let l=T.useRef(wo(i)),r=T.useRef(!1),o=zt(),c=T.useMemo(()=>d1(o.search,r.current?null:l.current),[o.search]),f=Qu(),h=T.useCallback((g,p)=>{const m=wo(typeof g=="function"?g(new URLSearchParams(c)):g);r.current=!0,f("?"+m,p)},[f,c]);return[c,h]}var D1=0,U1=()=>`__${String(++D1)}__`;function k1(){let{router:i}=vg("useSubmit"),{basename:l}=T.useContext(At),r=e1(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:p,encType:m,formData:b,body:v}=g1(f,l);if(h.navigate===!1){let N=h.fetcherKey||U1();await o(N,r,h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,replace:h.replace,state:h.state,fromRouteId:r,flushSync:h.flushSync,viewTransition:h.viewTransition})},[o,c,l,r])}function H1(i,{relative:l}={}){let{basename:r}=T.useContext(At),o=T.useContext(qt);Le(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...fi(i||".",{relative:l})},h=zt();if(i==null){f.search=h.search;let g=new URLSearchParams(f.search),p=g.getAll("index");if(p.some(b=>b==="")){g.delete("index"),p.filter(v=>v).forEach(v=>g.append("index",v));let b=g.toString();f.search=b?`?${b}`:""}}return(!i||i===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(f.pathname=f.pathname==="/"?r:Qt([r,f.pathname])),li(f)}function B1(i,{relative:l}={}){let r=T.useContext(rg);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=vg("useViewTransitionState"),c=fi(i,{relative:l});if(!r.isTransitioning)return!1;let f=ga(r.currentLocation.pathname,o)||r.currentLocation.pathname,h=ga(r.nextLocation.pathname,o)||r.nextLocation.pathname;return Uu(c.pathname,h)!=null||Uu(c.pathname,f)!=null}const bm=i=>{let l;const r=new Set,o=(m,b)=>{const v=typeof m=="function"?m(l):m;if(!Object.is(v,l)){const N=l;l=b??(typeof v!="object"||v===null)?v:Object.assign({},l,v),r.forEach(L=>L(l,N))}},c=()=>l,g={setState:o,getState:c,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=l=i(o,c,g);return g},q1=(i=>i?bm(i):bm),Y1=i=>i;function G1(i,l=Y1){const r=Pn.useSyncExternalStore(i.subscribe,Pn.useCallback(()=>l(i.getState()),[i,l]),Pn.useCallback(()=>l(i.getInitialState()),[i,l]));return Pn.useDebugValue(r),r}const Sm=i=>{const l=q1(i),r=o=>G1(l,o);return Object.assign(r,l),r},$o=(i=>i?Sm(i):Sm),xm="/api/v1";class V1{constructor(){In(this,"token","");In(this,"baseUrl",xm)}setToken(l){this.token=l}setBaseUrl(l){const r=l.trim();if(!r){this.baseUrl=xm;return}this.baseUrl=r.endsWith("/api/v1")?r:`${r.replace(/\/+$/,"")}/api/v1`}getToken(){return this.token}getBaseUrl(){return this.baseUrl}headers(){const l={"Content-Type":"application/json"};return this.token&&(l.Authorization=`Bearer ${this.token}`),l}async request(l,r,o,c){let f=this.resolveUrl(r);if(c){const p=new URLSearchParams(c).toString();p&&(f+=`?${p}`)}const h=await fetch(f,{method:l,headers:this.headers(),body:o?JSON.stringify(o):void 0}),g=await h.json();if(!g.ok)throw new K1(g.error||"Unknown error",h.status);return g.data}get(l,r){return this.request("GET",l,void 0,r)}post(l,r){return this.request("POST",l,r)}patch(l,r){return this.request("PATCH",l,r)}delete(l){return this.request("DELETE",l)}resolveUrl(l){const r=l.replace(/^\/+/,"");return this.baseUrl.startsWith("http://")||this.baseUrl.startsWith("https://")?new URL(r,`${this.baseUrl}/`).toString():`${this.baseUrl}/${r}`.replace(/([^:]\/)\/+/g,"$1")}}class K1 extends Error{constructor(l,r){super(l),this.status=r,this.name="ApiError"}}const Xe=new V1,Ot=$o(i=>({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none",login:(l,r)=>{Xe.setToken(l),r&&Xe.setBaseUrl(r),localStorage.setItem("cc_token",l),r&&localStorage.setItem("cc_server_url",r),i({token:l,serverUrl:r||"",isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"})},setManagedSession:(l,r,o)=>{Xe.setToken(l),Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!0,managedBy:o})},setDesktopSession:(l,r)=>{Ot.getState().setManagedSession(l,r,"electron")},logout:()=>{Ot.getState().desktopManaged||(Xe.setToken(""),Xe.setBaseUrl(""),localStorage.removeItem("cc_token"),localStorage.removeItem("cc_server_url"),i({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none"}))},init:()=>{const l=localStorage.getItem("cc_token")||"",r=localStorage.getItem("cc_server_url")||"";l&&(Xe.setToken(l),r&&Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"}))}})),Q1=(i,l,r,o)=>{var f,h,g,p;const c=[r,{code:l,...o||{}}];if((h=(f=i==null?void 0:i.services)==null?void 0:f.logger)!=null&&h.forward)return i.services.logger.forward(c,"warn","react-i18next::",!0);fn(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),(p=(g=i==null?void 0:i.services)==null?void 0:g.logger)!=null&&p.warn?i.services.logger.warn(...c):console!=null&&console.warn&&console.warn(...c)},Em={},Mo=(i,l,r,o)=>{fn(r)&&Em[r]||(fn(r)&&(Em[r]=new Date),Q1(i,l,r,o))},bg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},Lo=(i,l,r)=>{i.loadNamespaces(l,bg(i,r))},Tm=(i,l,r,o)=>{if(fn(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return Lo(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,bg(i,o))},X1=(i,l,r={})=>!l.languages||!l.languages.length?(Mo(l,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:l.languages}),!0):l.hasLoadedNamespace(i,{lng:r.lng,precheck:(o,c)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,i))return!1}}),fn=i=>typeof i=="string",Z1=i=>typeof i=="object"&&i!==null,$1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,J1={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},F1=i=>J1[i],W1=i=>i.replace($1,F1);let Do={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:W1};const I1=(i={})=>{Do={...Do,...i}},P1=()=>Do;let Sg;const eb=i=>{Sg=i},tb=()=>Sg,ab={type:"3rdParty",init(i){I1(i.options.react),eb(i)}},nb=T.createContext();class lb{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ib=(i,l)=>{const r=T.useRef();return T.useEffect(()=>{r.current=i},[i,l]),r.current},xg=(i,l,r,o)=>i.getFixedT(l,r,o),ub=(i,l,r,o)=>T.useCallback(xg(i,l,r,o),[i,l,r,o]),Eg=(i,l={})=>{var J,V,ue,K;const{i18n:r}=l,{i18n:o,defaultNS:c}=T.useContext(nb)||{},f=r||o||tb();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new lb),!f){Mo(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const te=(se,Ae)=>fn(Ae)?Ae:Z1(Ae)&&fn(Ae.defaultValue)?Ae.defaultValue:Array.isArray(se)?se[se.length-1]:se,le=[te,{},!1];return le.t=te,le.i18n={},le.ready=!1,le}(J=f.options.react)!=null&&J.wait&&Mo(f,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const h={...P1(),...f.options.react,...l},{useSuspense:g,keyPrefix:p}=h;let m=c||((V=f.options)==null?void 0:V.defaultNS);m=fn(m)?[m]:m||["translation"],(K=(ue=f.reportNamespaces).addUsedNamespaces)==null||K.call(ue,m);const b=(f.isInitialized||f.initializedStoreOnce)&&m.every(te=>X1(te,f,h)),v=ub(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),N=()=>v,L=()=>xg(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),[z,H]=T.useState(N);let B=m.join();l.lng&&(B=`${l.lng}${B}`);const q=ib(B),Q=T.useRef(!0);T.useEffect(()=>{const{bindI18n:te,bindI18nStore:le}=h;Q.current=!0,!b&&!g&&(l.lng?Tm(f,l.lng,m,()=>{Q.current&&H(L)}):Lo(f,m,()=>{Q.current&&H(L)})),b&&q&&q!==B&&Q.current&&H(L);const se=()=>{Q.current&&H(L)};return te&&(f==null||f.on(te,se)),le&&(f==null||f.store.on(le,se)),()=>{Q.current=!1,f&&te&&(te==null||te.split(" ").forEach(Ae=>f.off(Ae,se))),le&&f&&le.split(" ").forEach(Ae=>f.store.off(Ae,se))}},[f,B]),T.useEffect(()=>{Q.current&&b&&H(N)},[f,p,b]);const X=[z,f,b];if(X.t=z,X.i18n=f,X.ready=b,b||!b&&!g)return X;throw new Promise(te=>{l.lng?Tm(f,l.lng,m,()=>te()):Lo(f,m,()=>te())})};function Tg(i){var l,r,o="";if(typeof i=="string"||typeof i=="number")o+=i;else if(typeof i=="object")if(Array.isArray(i)){var c=i.length;for(l=0;l<c;l++)i[l]&&(r=Tg(i[l]))&&(o&&(o+=" "),o+=r)}else for(r in i)i[r]&&(o&&(o+=" "),o+=r);return o}function rb(){for(var i,l,r=0,o="",c=arguments.length;r<c;r++)(i=arguments[r])&&(l=Tg(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return rb(i)}function a2(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const Jo=$o(i=>({snapshot:null,setSnapshot:l=>i({snapshot:l})}));function dn(){return ii}function To(i){ii=i}function sb(){return ii==="electron"}function ob(){return!1}function Ro(i){Jo.getState().setSnapshot(i)}function cb(){return Jo.getState().snapshot}function fb(i){return!!(i!=null&&i.knowledge.some(l=>l.enabled!==!1))}function db(i){return!!(i!=null&&i.schedulers.some(l=>l.enabled!==!1))}function hb(i,l){return!!(i!=null&&i.agents.some(r=>r.agentType===l))}function mb(i){return!!(i!=null&&i.agents.some(l=>l.agentType))}function gb(i=cb()){const l=!!i,r=hb(i,"localcore-acp");return{desktopRuntime:l||ii==="electron"||ii==="local_core",desktopChat:r,chatRoute:l?r:!0,desktopWorkspace:l?mb(i):!0,knowledgeModule:l?fb(i):!0,schedulerModule:l?db(i):!0}}function Fo(){const i=Jo(l=>l.snapshot);return gb(i)}function Rm(i){return i==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i}function _m(i){document.documentElement.classList.toggle("dark",i==="dark")}const Wo=$o(i=>({theme:"dark",resolved:"dark",setTheme:l=>{const r=Rm(l);localStorage.setItem("cc_theme",l),_m(r),i({theme:l,resolved:r})},init:()=>{const l=localStorage.getItem("cc_theme")||"dark",r=Rm(l);_m(r),i({theme:l,resolved:r})}})),pb="modulepreload",yb=function(i,l){return new URL(i,l).href},Cm={},Pe=function(l,r,o){let c=Promise.resolve();if(r&&r.length>0){let h=function(b){return Promise.all(b.map(v=>Promise.resolve(v).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};const g=document.getElementsByTagName("link"),p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=h(r.map(b=>{if(b=yb(b,o),b in Cm)return;Cm[b]=!0;const v=b.endsWith(".css"),N=v?'[rel="stylesheet"]':"";if(!!o)for(let H=g.length-1;H>=0;H--){const B=g[H];if(B.href===b&&(!v||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${N}`))return;const z=document.createElement("link");if(z.rel=v?"stylesheet":pb,v||(z.as="script"),z.crossOrigin="",z.href=b,m&&z.setAttribute("nonce",m),document.head.appendChild(z),v)return new Promise((H,B)=>{z.addEventListener("load",H),z.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${b}`)))})}))}function f(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return c.then(h=>{for(const g of h||[])g.status==="rejected"&&f(g.reason);return l().catch(f)})},vb=T.lazy(()=>Pe(()=>import("./Dashboard-D3BwbG43.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),bb=T.lazy(()=>Pe(()=>import("./ThreadChat-BCdbTxBo.js"),__vite__mapDeps([9,10,11,5,12,13,14,15,16,17,8,18,19,20,21,22]),import.meta.url)),Sb=T.lazy(()=>Pe(()=>import("./Chat-oa8OjaHQ.js"),__vite__mapDeps([23,10,11,2,14,15,4,24,12,20,21,22,17]),import.meta.url)),xb=T.lazy(()=>Pe(()=>import("./Workspace-D_hzSJjX.js"),__vite__mapDeps([25,10,11,26,18,15,2,3,5,13,22,27,28]),import.meta.url)),Eb=T.lazy(()=>Pe(()=>import("./ProjectList-COtyZd7H.js"),__vite__mapDeps([29,1,2,3,4,6,30]),import.meta.url)),Tb=T.lazy(()=>Pe(()=>import("./ProjectDetail-DS_rfvhh.js"),__vite__mapDeps([31,1,10,11,2,3,4,32,30,33,27,15,22,34]),import.meta.url)),Rb=T.lazy(()=>Pe(()=>import("./SessionList-88dgGZJ8.js"),__vite__mapDeps([35,1,26,11,18,15,2,4,24,36,16,17]),import.meta.url)),_b=T.lazy(()=>Pe(()=>import("./SessionChat-DjVnjuQy.js"),__vite__mapDeps([37,1,24,14,15,32,16,19,17]),import.meta.url)),Cb=T.lazy(()=>Pe(()=>import("./CronList-Z5JU3DHk.js"),__vite__mapDeps([38,1,10,11,26,18,15,2,3,27,34,21,22]),import.meta.url)),Ob=T.lazy(()=>Pe(()=>import("./Config-D9sL_d4D.js"),__vite__mapDeps([39,5,1,3,28,33]),import.meta.url)),Ab=T.lazy(()=>Pe(()=>import("./Logs-DfSUifXc.js"),__vite__mapDeps([40,1,26,11,18,15,3,32,36]),import.meta.url)),zb=T.lazy(()=>Pe(()=>import("./KnowledgeHome-BFnH0NVk.js"),__vite__mapDeps([41,10,11,2,21,22,20,27,7]),import.meta.url)),Nb=T.lazy(()=>Pe(()=>import("./KnowledgeDetail-J7n01mPu.js"),__vite__mapDeps([42,2,32,20,22]),import.meta.url));class wb{constructor(){In(this,"routes",new Map);In(this,"navItems",new Map)}registerRoute(l){this.routes.set(l.id,l)}registerNavItem(l){this.navItems.set(l.id,l)}listRoutes(){return[...this.routes.values()].sort((l,r)=>l.order-r.order)}listNavItems(){return[...this.navItems.values()].sort((l,r)=>l.order-r.order)}}function Pl(i,l,r="/"){return i?l:_.jsx(Ya,{to:r,replace:!0})}function jb(){const{name:i}=fg();return Ot(r=>r.desktopManaged)?_.jsx(Ya,{to:i?`/workspace?project=${encodeURIComponent(i)}`:"/workspace",replace:!0}):_.jsx(Tb,{})}function Om(){const{project:i,id:l}=fg();if(!Ot(c=>c.desktopManaged))return l&&i?_.jsx(_b,{}):_.jsx(Rb,{});const o=new URLSearchParams;return i&&o.set("project",i),l&&o.set("session",l),_.jsx(Ya,{to:`/chat${o.toString()?`?${o.toString()}`:""}`,replace:!0})}function Mb(i){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>_.jsx(vb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:r})=>Pl(r.chatRoute,r.desktopChat?_.jsx(bb,{}):_.jsx(Sb,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:r})=>Pl(r.desktopWorkspace,_.jsx(xb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(zb,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(Nb,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({desktopManaged:r,features:o})=>r&&o.desktopWorkspace?_.jsx(Ya,{to:"/workspace",replace:!0}):_.jsx(Eb,{})},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>_.jsx(jb,{})},{id:"sessions",path:"sessions",titleKey:"nav.sessions",order:60,element:()=>_.jsx(Om,{})},{id:"session-detail",path:"sessions/:project/:id",titleKey:"nav.sessions",order:61,element:()=>_.jsx(Om,{})},{id:"cron",path:"cron",titleKey:"nav.cron",order:70,element:({features:r})=>Pl(r.schedulerModule,_.jsx(Cb,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>_.jsx(Ob,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>_.jsx(Ab,{})}].forEach(r=>i.registerRoute(r))}function Lb(i){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:j0,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:q0,order:20,visible:({features:r})=>r.chatRoute,resolveLabelKey:({features:r,runtimeProvider:o})=>r.desktopChat?o==="electron"?"nav.chatDesktop":"nav.chat":"nav.chatWeb"},{id:"workspace",path:"/workspace",labelKey:"nav.workspace",icon:F0,order:30,visible:({features:r})=>r.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:L0,order:40,visible:({features:r})=>r.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:A0,order:50,visible:({desktopManaged:r})=>!r},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:H0,order:60,visible:({desktopManaged:r})=>!r},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:C0,order:70,visible:({features:r})=>r.schedulerModule},{id:"system",path:"/system",labelKey:"nav.system",icon:Q0,order:80}].forEach(r=>i.registerNavItem(r))}const Zu=new wb;Mb(Zu);Lb(Zu);function Rg({className:i,markClassName:l,showWordmark:r=!1}){const o=T.useId(),c=`${o}-bg`,f=`${o}-stroke`;return _.jsxs("div",{className:He("inline-flex items-center gap-3",i),children:[_.jsxs("svg",{className:He("h-8 w-8 shrink-0",l),viewBox:"0 0 64 64",role:"img","aria-label":"AgentDock",fill:"none",children:[_.jsxs("defs",{children:[_.jsxs("linearGradient",{id:c,x1:"7",y1:"5",x2:"57",y2:"59",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{className:"[stop-color:#FFFFFF] dark:[stop-color:#3A3A3C]"}),_.jsx("stop",{offset:"0.52",className:"[stop-color:#F5F5F7] dark:[stop-color:#2C2C2E]"}),_.jsx("stop",{offset:"1",className:"[stop-color:#E5E5EA] dark:[stop-color:#1C1C1E]"})]}),_.jsxs("linearGradient",{id:f,x1:"18",y1:"16",x2:"47",y2:"48",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{stopColor:"#5AC8FA"}),_.jsx("stop",{offset:"0.44",stopColor:"#0A84FF"}),_.jsx("stop",{offset:"1",stopColor:"#007AFF"})]})]}),_.jsx("rect",{x:"4",y:"4",width:"56",height:"56",rx:"16",fill:`url(#${c})`,className:"stroke-black/10 dark:stroke-white/10",strokeWidth:"1.5"}),_.jsx("path",{d:"M14.5 45L25.3 20.1C26.1 18.1 28.9 18.1 29.8 20.1L40.8 45",stroke:`url(#${f})`,strokeWidth:"7.5",strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M20.8 37.5H34.7",className:"stroke-white dark:stroke-white",strokeWidth:"5.25",strokeLinecap:"round"}),_.jsx("path",{d:"M33.8 20.2H37.4C45.1 20.2 50 25.6 50 32.5C50 39.4 45.1 44.8 37.4 44.8H33.8",stroke:`url(#${f})`,strokeWidth:"7",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.82"}),_.jsx("path",{d:"M34 25.5V39.5",className:"stroke-black/70 dark:stroke-black/80",strokeWidth:"3",strokeLinecap:"round",opacity:"0.18"})]}),r&&_.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"AgentDock"})]})}var _o={};const ae=i=>typeof i=="string",ei=()=>{let i,l;const r=new Promise((o,c)=>{i=o,l=c});return r.resolve=i,r.reject=l,r},Am=i=>i==null?"":""+i,Db=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},Ub=/###/g,zm=i=>i&&i.indexOf("###")>-1?i.replace(Ub,"."):i,Nm=i=>!i||ae(i),ti=(i,l,r)=>{const o=ae(l)?l.split("."):l;let c=0;for(;c<o.length-1;){if(Nm(i))return{};const f=zm(o[c]);!i[f]&&r&&(i[f]=new r),Object.prototype.hasOwnProperty.call(i,f)?i=i[f]:i={},++c}return Nm(i)?{}:{obj:i,k:zm(o[c])}},wm=(i,l,r)=>{const{obj:o,k:c}=ti(i,l,Object);if(o!==void 0||l.length===1){o[c]=r;return}let f=l[l.length-1],h=l.slice(0,l.length-1),g=ti(i,h,Object);for(;g.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),g=ti(i,h,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${f}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${f}`]=r},kb=(i,l,r,o)=>{const{obj:c,k:f}=ti(i,l,Object);c[f]=c[f]||[],c[f].push(r)},Hu=(i,l)=>{const{obj:r,k:o}=ti(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},Hb=(i,l,r)=>{const o=Hu(i,r);return o!==void 0?o:Hu(l,r)},_g=(i,l,r)=>{for(const o in l)o!=="__proto__"&&o!=="constructor"&&(o in i?ae(i[o])||i[o]instanceof String||ae(l[o])||l[o]instanceof String?r&&(i[o]=l[o]):_g(i[o],l[o],r):i[o]=l[o]);return i},sn=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Bb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const qb=i=>ae(i)?i.replace(/[&<>"'\/]/g,l=>Bb[l]):i;class Yb{constructor(l){this.capacity=l,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(l){const r=this.regExpMap.get(l);if(r!==void 0)return r;const o=new RegExp(l);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(l,o),this.regExpQueue.push(l),o}}const Gb=[" ",",","?","!",";"],Vb=new Yb(20),Kb=(i,l,r)=>{l=l||"",r=r||"";const o=Gb.filter(h=>l.indexOf(h)<0&&r.indexOf(h)<0);if(o.length===0)return!0;const c=Vb.getRegExp(`(${o.map(h=>h==="?"?"\\?":h).join("|")})`);let f=!c.test(i);if(!f){const h=i.indexOf(r);h>0&&!c.test(i.substring(0,h))&&(f=!0)}return f},Uo=(i,l,r=".")=>{if(!i)return;if(i[l])return Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;const o=l.split(r);let c=i;for(let f=0;f<o.length;){if(!c||typeof c!="object")return;let h,g="";for(let p=f;p<o.length;++p)if(p!==f&&(g+=r),g+=o[p],h=c[g],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&p<o.length-1)continue;f+=p-f+1;break}c=h}return c},ui=i=>i==null?void 0:i.replace(/_/g,"-"),Qb={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,l){var r,o;(o=(r=console==null?void 0:console[i])==null?void 0:r.apply)==null||o.call(r,console,l)}};class Bu{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||Qb,this.options=r,this.debug=r.debug}log(...l){return this.forward(l,"log","",!0)}warn(...l){return this.forward(l,"warn","",!0)}error(...l){return this.forward(l,"error","")}deprecate(...l){return this.forward(l,"warn","WARNING DEPRECATED: ",!0)}forward(l,r,o,c){return c&&!this.debug?null:(ae(l[0])&&(l[0]=`${o}${this.prefix} ${l[0]}`),this.logger[r](l))}create(l){return new Bu(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new Bu(this.logger,l)}}var Ft=new Bu;class $u{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[l,...r])})}}class jm extends $u{constructor(l,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=l||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(l){this.options.ns.indexOf(l)<0&&this.options.ns.push(l)}removeNamespaces(l){const r=this.options.ns.indexOf(l);r>-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;l.indexOf(".")>-1?g=l.split("."):(g=[l,r],o&&(Array.isArray(o)?g.push(...o):ae(o)&&f?g.push(...o.split(f)):g.push(o)));const p=Hu(this.data,g);return!p&&!r&&!o&&l.indexOf(".")>-1&&(l=g[0],r=g[1],o=g.slice(2).join(".")),p||!h||!ae(o)?p:Uo((b=(m=this.data)==null?void 0:m[l])==null?void 0:b[r],o,f)}addResource(l,r,o,c,f={silent:!1}){const h=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let g=[l,r];o&&(g=g.concat(h?o.split(h):o)),l.indexOf(".")>-1&&(g=l.split("."),c=r,r=g[1]),this.addNamespaces(r),wm(this.data,g,c),f.silent||this.emit("added",l,r,o,c)}addResources(l,r,o,c={silent:!1}){for(const f in o)(ae(o[f])||Array.isArray(o[f]))&&this.addResource(l,r,f,o[f],{silent:!0});c.silent||this.emit("added",l,r,o)}addResourceBundle(l,r,o,c,f,h={silent:!1,skipCopy:!1}){let g=[l,r];l.indexOf(".")>-1&&(g=l.split("."),c=o,o=r,r=g[1]),this.addNamespaces(r);let p=Hu(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?_g(p,o,f):p={...p,...o},wm(this.data,g,p),h.silent||this.emit("added",l,r,o)}removeResourceBundle(l,r){this.hasResourceBundle(l,r)&&delete this.data[l][r],this.removeNamespaces(r),this.emit("removed",l,r)}hasResourceBundle(l,r){return this.getResource(l,r)!==void 0}getResourceBundle(l,r){return r||(r=this.options.defaultNS),this.getResource(l,r)}getDataByLanguage(l){return this.data[l]}hasLanguageSomeTranslations(l){const r=this.getDataByLanguage(l);return!!(r&&Object.keys(r)||[]).find(c=>r[c]&&Object.keys(r[c]).length>0)}toJSON(){return this.data}}var Cg={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,l,r,o,c){return i.forEach(f=>{var h;l=((h=this.processors[f])==null?void 0:h.process(l,r,o,c))??l}),l}};const Og=Symbol("i18next/PATH_KEY");function Xb(){const i=[],l=Object.create(null);let r;return l.get=(o,c)=>{var f;return(f=r==null?void 0:r.revoke)==null||f.call(r),c===Og?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)},Proxy.revocable(Object.create(null),l).proxy}function el(i,l){const{[Og]:r}=i(Xb()),o=(l==null?void 0:l.keySeparator)??".",c=(l==null?void 0:l.nsSeparator)??":";if(r.length>1&&c){const f=l==null?void 0:l.ns,h=Array.isArray(f)?f:null;if(h&&h.length>1&&h.slice(1).includes(r[0]))return`${r[0]}${c}${r.slice(1).join(o)}`}return r.join(o)}const Mm={},Co=i=>!ae(i)&&typeof i!="boolean"&&typeof i!="number";class qu extends $u{constructor(l,r={}){super(),Db(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],l,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ft.create("translator")}changeLanguage(l){l&&(this.language=l)}exists(l,r={interpolation:{}}){const o={...r};if(l==null)return!1;const c=this.resolve(l,o);if((c==null?void 0:c.res)===void 0)return!1;const f=Co(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(l,r){let o=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let f=r.ns||this.options.defaultNS||[];const h=o&&l.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Kb(l,o,c);if(h&&!g){const p=l.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:l,namespaces:ae(f)?[f]:f};const m=l.split(o);(o!==c||o===c&&this.options.ns.indexOf(m[0])>-1)&&(f=m.shift()),l=m.join(c)}return{key:l,namespaces:ae(f)?[f]:f}}translate(l,r,o){let c=typeof r=="object"?{...r}:r;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),l==null)return"";typeof l=="function"&&(l=el(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]),l=l.map(ze=>typeof ze=="function"?el(ze,{...this.options,...c}):String(ze));const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,h=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:p}=this.extractFromKey(l[l.length-1],c),m=p[p.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const v=c.lng||this.language,N=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((v==null?void 0:v.toLowerCase())==="cimode")return N?f?{res:`${m}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${g}`:f?{res:g,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:g;const L=this.resolve(l,c);let z=L==null?void 0:L.res;const H=(L==null?void 0:L.usedKey)||g,B=(L==null?void 0:L.exactUsedKey)||g,q=["[object Number]","[object Function]","[object RegExp]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,X=!this.i18nFormat||this.i18nFormat.handleAsObject,J=c.count!==void 0&&!ae(c.count),V=qu.hasDefaultValue(c),ue=J?this.pluralResolver.getSuffix(v,c.count,c):"",K=c.ordinal&&J?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",te=J&&!c.ordinal&&c.count===0,le=te&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${ue}`]||c[`defaultValue${K}`]||c.defaultValue;let se=z;X&&!z&&V&&(se=le);const Ae=Co(se),Fe=Object.prototype.toString.apply(se);if(X&&se&&Ae&&q.indexOf(Fe)<0&&!(ae(Q)&&Array.isArray(se))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ze=this.options.returnedObjectHandler?this.options.returnedObjectHandler(H,se,{...c,ns:p}):`key '${g} (${this.language})' returned an object instead of string.`;return f?(L.res=ze,L.usedParams=this.getUsedParamsDetails(c),L):ze}if(h){const ze=Array.isArray(se),je=ze?[]:{},De=ze?B:H;for(const j in se)if(Object.prototype.hasOwnProperty.call(se,j)){const Y=`${De}${h}${j}`;V&&!z?je[j]=this.translate(Y,{...c,defaultValue:Co(le)?le[j]:void 0,joinArrays:!1,ns:p}):je[j]=this.translate(Y,{...c,joinArrays:!1,ns:p}),je[j]===Y&&(je[j]=se[j])}z=je}}else if(X&&ae(Q)&&Array.isArray(z))z=z.join(Q),z&&(z=this.extendTranslation(z,l,c,o));else{let ze=!1,je=!1;!this.isValidLookup(z)&&V&&(ze=!0,z=le),this.isValidLookup(z)||(je=!0,z=g);const j=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&je?void 0:z,Y=V&&le!==z&&this.options.updateMissing;if(je||ze||Y){if(this.logger.log(Y?"updateKey":"missingKey",v,m,g,Y?le:z),h){const x=this.resolve(g,{...c,keySeparator:!1});x&&x.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let P=[];const pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(let x=0;x<pe.length;x++)P.push(pe[x]);else this.options.saveMissingTo==="all"?P=this.languageUtils.toResolveHierarchy(c.lng||this.language):P.push(c.lng||this.language);const Se=(x,D,G)=>{var ne;const Z=V&&G!==z?G:j;this.options.missingKeyHandler?this.options.missingKeyHandler(x,m,D,Z,Y,c):(ne=this.backendConnector)!=null&&ne.saveMissing&&this.backendConnector.saveMissing(x,m,D,Z,Y,c),this.emit("missingKey",x,m,D,z)};this.options.saveMissing&&(this.options.saveMissingPlurals&&J?P.forEach(x=>{const D=this.pluralResolver.getSuffixes(x,c);te&&c[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(G=>{Se([x],g+G,c[`defaultValue${G}`]||le)})}):Se(P,g,le))}z=this.extendTranslation(z,l,c,L,o),je&&z===g&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${g}`),(je||ze)&&this.options.parseMissingKeyHandler&&(z=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${g}`:g,ze?z:void 0,c))}return f?(L.res=z,L.usedParams=this.getUsedParamsDetails(c),L):z}extendTranslation(l,r,o,c,f){var p,m;if((p=this.i18nFormat)!=null&&p.parse)l=this.i18nFormat.parse(l,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=ae(l)&&(((m=o==null?void 0:o.interpolation)==null?void 0:m.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(b){const L=l.match(this.interpolator.nestingRegexp);v=L&&L.length}let N=o.replace&&!ae(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(N={...this.options.interpolation.defaultVariables,...N}),l=this.interpolator.interpolate(l,N,o.lng||this.language||c.usedLng,o),b){const L=l.match(this.interpolator.nestingRegexp),z=L&&L.length;v<z&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(l=this.interpolator.nest(l,(...L)=>(f==null?void 0:f[0])===L[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${L[0]} in key: ${r[0]}`),null):this.translate(...L,r),o)),o.interpolation&&this.interpolator.reset()}const h=o.postProcess||this.options.postProcess,g=ae(h)?[h]:h;return l!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(l=Cg.handle(g,l,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),l}resolve(l,r={}){let o,c,f,h,g;return ae(l)&&(l=[l]),Array.isArray(l)&&(l=l.map(p=>typeof p=="function"?el(p,{...this.options,...r}):p)),l.forEach(p=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(p,r),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const N=r.count!==void 0&&!ae(r.count),L=N&&!r.ordinal&&r.count===0,z=r.context!==void 0&&(ae(r.context)||typeof r.context=="number")&&r.context!=="",H=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);v.forEach(B=>{var q,Q;this.isValidLookup(o)||(g=B,!Mm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((Q=this.utils)!=null&&Q.hasLoadedNamespace(g))&&(Mm[`${H[0]}-${B}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),H.forEach(X=>{var ue;if(this.isValidLookup(o))return;h=X;const J=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(J,b,X,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix(X,r.count,r));const te=`${this.options.pluralSeparator}zero`,le=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(N&&(r.ordinal&&K.indexOf(le)===0&&J.push(b+K.replace(le,this.options.pluralSeparator)),J.push(b+K),L&&J.push(b+te)),z){const se=`${b}${this.options.contextSeparator||"_"}${r.context}`;J.push(se),N&&(r.ordinal&&K.indexOf(le)===0&&J.push(se+K.replace(le,this.options.pluralSeparator)),J.push(se+K),L&&J.push(se+te))}}let V;for(;V=J.pop();)this.isValidLookup(o)||(f=V,o=this.getResource(X,B,V,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:g}}isValidLookup(l){return l!==void 0&&!(!this.options.returnNull&&l===null)&&!(!this.options.returnEmptyString&&l==="")}getResource(l,r,o,c={}){var f;return(f=this.i18nFormat)!=null&&f.getResource?this.i18nFormat.getResource(l,r,o,c):this.resourceStore.getResource(l,r,o,c)}getUsedParamsDetails(l={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=l.replace&&!ae(l.replace);let c=o?l.replace:l;if(o&&typeof l.count<"u"&&(c.count=l.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of r)delete c[f]}return c}static hasDefaultValue(l){const r="defaultValue";for(const o in l)if(Object.prototype.hasOwnProperty.call(l,o)&&r===o.substring(0,r.length)&&l[o]!==void 0)return!0;return!1}}class Lm{constructor(l){this.options=l,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ft.create("languageUtils")}getScriptPartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return null;const r=l.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return l;const r=l.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(l){if(ae(l)&&l.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(l)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?l.toLowerCase():l)}return this.options.cleanCode||this.options.lowerCaseLng?l.toLowerCase():l}isSupportedCode(l){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(l=this.getLanguagePartFromCode(l)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(l)>-1}getBestMatchFromCodes(l){if(!l)return null;let r;return l.forEach(o=>{if(r)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(r=c)}),!r&&this.options.supportedLngs&&l.forEach(o=>{if(r)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return r=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return r=f;r=this.options.supportedLngs.find(h=>{if(h===f)return h;if(!(h.indexOf("-")<0&&f.indexOf("-")<0)&&(h.indexOf("-")>0&&f.indexOf("-")<0&&h.substring(0,h.indexOf("-"))===f||h.indexOf(f)===0&&f.length>1))return h})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(l,r){if(!l)return[];if(typeof l=="function"&&(l=l(r)),ae(l)&&(l=[l]),Array.isArray(l))return l;if(!r)return l.default||[];let o=l[r];return o||(o=l[this.getScriptPartFromCode(r)]),o||(o=l[this.formatLanguageCode(r)]),o||(o=l[this.getLanguagePartFromCode(r)]),o||(o=l.default),o||[]}toResolveHierarchy(l,r){const o=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],l),c=[],f=h=>{h&&(this.isSupportedCode(h)?c.push(h):this.logger.warn(`rejecting language code not found in supportedLngs: ${h}`))};return ae(l)&&(l.indexOf("-")>-1||l.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(l)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(l)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(l))):ae(l)&&f(this.formatLanguageCode(l)),o.forEach(h=>{c.indexOf(h)<0&&f(this.formatLanguageCode(h))}),c}}const Dm={zero:0,one:1,two:2,few:3,many:4,other:5},Um={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Zb{constructor(l,r={}){this.languageUtils=l,this.options=r,this.logger=Ft.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(l,r={}){const o=ui(l==="dev"?"en":l),c=r.ordinal?"ordinal":"cardinal",f=JSON.stringify({cleanedCode:o,type:c});if(f in this.pluralRulesCache)return this.pluralRulesCache[f];let h;try{h=new Intl.PluralRules(o,{type:c})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Um;if(!l.match(/-|_/))return Um;const p=this.languageUtils.getLanguagePartFromCode(l);h=this.getRule(p,r)}return this.pluralRulesCache[f]=h,h}needsPlural(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(l,r,o={}){return this.getSuffixes(l,o).map(c=>`${r}${c}`)}getSuffixes(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Dm[c]-Dm[f]).map(c=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(l,r,o={}){const c=this.getRule(l,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(r)}`:(this.logger.warn(`no plural rule found for: ${l}`),this.getSuffix("dev",r,o))}}const km=(i,l,r,o=".",c=!0)=>{let f=Hb(i,l,r);return!f&&c&&ae(r)&&(f=Uo(i,r,o),f===void 0&&(f=Uo(l,r,o))),f},Oo=i=>i.replace(/\$/g,"$$$$");class Hm{constructor(l={}){var r;this.logger=Ft.create("interpolator"),this.options=l,this.format=((r=l==null?void 0:l.interpolation)==null?void 0:r.format)||(o=>o),this.init(l)}init(l={}){l.interpolation||(l.interpolation={escapeValue:!0});const{escape:r,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:h,suffix:g,suffixEscaped:p,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:N,nestingPrefixEscaped:L,nestingSuffix:z,nestingSuffixEscaped:H,nestingOptionsSeparator:B,maxReplaces:q,alwaysFormat:Q}=l.interpolation;this.escape=r!==void 0?r:qb,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?sn(f):h||"{{",this.suffix=g?sn(g):p||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=N?sn(N):L||sn("$t("),this.nestingSuffix=z?sn(z):H||sn(")"),this.nestingOptionsSeparator=B||",",this.maxReplaces=q||1e3,this.alwaysFormat=Q!==void 0?Q:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const l=(r,o)=>(r==null?void 0:r.source)===o?(r.lastIndex=0,r):new RegExp(o,"g");this.regexp=l(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=l(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=l(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(l,r,o,c){var L;let f,h,g;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=z=>{if(z.indexOf(this.formatSeparator)<0){const Q=km(r,p,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(Q,void 0,o,{...c,...r,interpolationkey:z}):Q}const H=z.split(this.formatSeparator),B=H.shift().trim(),q=H.join(this.formatSeparator).trim();return this.format(km(r,p,B,this.options.keySeparator,this.options.ignoreJSONStructure),q,o,{...c,...r,interpolationkey:B})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,v=((L=c==null?void 0:c.interpolation)==null?void 0:L.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:z=>Oo(z)},{regex:this.regexp,safeValue:z=>this.escapeValue?Oo(this.escape(z)):Oo(z)}].forEach(z=>{for(g=0;f=z.regex.exec(l);){const H=f[1].trim();if(h=m(H),h===void 0)if(typeof b=="function"){const q=b(l,f,c);h=ae(q)?q:""}else if(c&&Object.prototype.hasOwnProperty.call(c,H))h="";else if(v){h=f[0];continue}else this.logger.warn(`missed to pass in variable ${H} for interpolating ${l}`),h="";else!ae(h)&&!this.useRawValueToEscape&&(h=Am(h));const B=z.safeValue(h);if(l=l.replace(f[0],B),v?(z.regex.lastIndex+=h.length,z.regex.lastIndex-=f[0].length):z.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,h;const g=(p,m)=>{const b=this.nestingOptionsSeparator;if(p.indexOf(b)<0)return p;const v=p.split(new RegExp(`${sn(b)}[ ]*{`));let N=`{${v[1]}`;p=v[0],N=this.interpolate(N,h);const L=N.match(/'/g),z=N.match(/"/g);(((L==null?void 0:L.length)??0)%2===0&&!z||((z==null?void 0:z.length)??0)%2!==0)&&(N=N.replace(/'/g,'"'));try{h=JSON.parse(N),m&&(h={...m,...h})}catch(H){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,H),`${p}${b}${N}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,p};for(;c=this.nestingRegexp.exec(l);){let p=[];h={...o},h=h.replace&&!ae(h.replace)?h.replace:h,h.applyPostProcessor=!1,delete h.defaultValue;const m=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(m!==-1&&(p=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=r(g.call(this,c[1].trim(),h),h),f&&c[0]===l&&!ae(f))return f;ae(f)||(f=Am(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${l}`),f=""),p.length&&(f=p.reduce((b,v)=>this.format(b,v,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),l=l.replace(c[0],f),this.regexp.lastIndex=0}return l}}const $b=i=>{let l=i.toLowerCase().trim();const r={};if(i.indexOf("(")>-1){const o=i.split("(");l=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);l==="currency"&&c.indexOf(":")<0?r.currency||(r.currency=c.trim()):l==="relativetime"&&c.indexOf(":")<0?r.range||(r.range=c.trim()):c.split(";").forEach(h=>{if(h){const[g,...p]=h.split(":"),m=p.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();r[b]||(r[b]=m),m==="false"&&(r[b]=!1),m==="true"&&(r[b]=!0),isNaN(m)||(r[b]=parseInt(m,10))}})}return{formatName:l,formatOptions:r}},Bm=i=>{const l={};return(r,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const h=o+JSON.stringify(f);let g=l[h];return g||(g=i(ui(o),c),l[h]=g),g(r)}},Jb=i=>(l,r,o)=>i(ui(r),o)(l);class Fb{constructor(l={}){this.logger=Ft.create("formatter"),this.options=l,this.init(l)}init(l,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const o=r.cacheInBuiltFormats?Bm:Jb;this.formats={number:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f});return g=>h.format(g)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return g=>h.format(g)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return g=>h.format(g)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return g=>h.format(g,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return g=>h.format(g)})}}add(l,r){this.formats[l.toLowerCase().trim()]=r}addCached(l,r){this.formats[l.toLowerCase().trim()]=Bm(r)}format(l,r,o,c={}){const f=r.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(g=>g.indexOf(")")>-1)){const g=f.findIndex(p=>p.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,g)].join(this.formatSeparator)}return f.reduce((g,p)=>{var v;const{formatName:m,formatOptions:b}=$b(p);if(this.formats[m]){let N=g;try{const L=((v=c==null?void 0:c.formatParams)==null?void 0:v[c.interpolationkey])||{},z=L.locale||L.lng||c.locale||c.lng||o;N=this.formats[m](g,z,{...b,...c,...L})}catch(L){this.logger.warn(L)}return N}else this.logger.warn(`there was no format function for ${m}`);return g},l)}}const Wb=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class Ib extends $u{constructor(l,r,o,c={}){var f,h;super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Ft.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(h=(f=this.backend)==null?void 0:f.init)==null||h.call(f,o,c.backend,c)}queueLoad(l,r,o,c){const f={},h={},g={},p={};return l.forEach(m=>{let b=!0;r.forEach(v=>{const N=`${m}|${v}`;!o.reload&&this.store.hasResourceBundle(m,v)?this.state[N]=2:this.state[N]<0||(this.state[N]===1?h[N]===void 0&&(h[N]=!0):(this.state[N]=1,b=!1,h[N]===void 0&&(h[N]=!0),f[N]===void 0&&(f[N]=!0),p[v]===void 0&&(p[v]=!0)))}),b||(g[m]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(p)}}loaded(l,r,o){const c=l.split("|"),f=c[0],h=c[1];r&&this.emit("failedLoading",f,h,r),!r&&o&&this.store.addResourceBundle(f,h,o,void 0,void 0,{skipCopy:!0}),this.state[l]=r?-1:2,r&&o&&(this.state[l]=0);const g={};this.queue.forEach(p=>{kb(p.loaded,[f],h),Wb(p,l),r&&p.errors.push(r),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(m=>{g[m]||(g[m]={});const b=p.loaded[m];b.length&&b.forEach(v=>{g[m][v]===void 0&&(g[m][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(p=>!p.done)}read(l,r,o,c=0,f=this.retryTimeout,h){if(!l.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:l,ns:r,fcName:o,tried:c,wait:f,callback:h});return}this.readingCalls++;const g=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,l,r,o,c+1,f*2,h)},f);return}h(m,b)},p=this.backend[o].bind(this.backend);if(p.length===2){try{const m=p(l,r);m&&typeof m.then=="function"?m.then(b=>g(null,b)).catch(g):g(null,m)}catch(m){g(m)}return}return p(l,r,g)}prepareLoading(l,r,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();ae(l)&&(l=this.languageUtils.toResolveHierarchy(l)),ae(r)&&(r=[r]);const f=this.queueLoad(l,r,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(h=>{this.loadOne(h)})}load(l,r,o){this.prepareLoading(l,r,{},o)}reload(l,r,o){this.prepareLoading(l,r,{reload:!0},o)}loadOne(l,r=""){const o=l.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(h,g)=>{h&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,h),!h&&g&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,g),this.loaded(l,h,g)})}saveMissing(l,r,o,c,f,h={},g=()=>{}){var p,m,b,v,N;if((m=(p=this.services)==null?void 0:p.utils)!=null&&m.hasLoadedNamespace&&!((v=(b=this.services)==null?void 0:b.utils)!=null&&v.hasLoadedNamespace(r))){this.logger.warn(`did not save key "${o}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if((N=this.backend)!=null&&N.create){const L={...h,isUpdate:f},z=this.backend.create.bind(this.backend);if(z.length<6)try{let H;z.length===5?H=z(l,r,o,c,L):H=z(l,r,o,c),H&&typeof H.then=="function"?H.then(B=>g(null,B)).catch(g):g(null,H)}catch(H){g(H)}else z(l,r,o,c,g,L)}!l||!l[0]||this.store.addResource(l[0],r,o,c)}}}const Ao=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let l={};if(typeof i[1]=="object"&&(l=i[1]),ae(i[1])&&(l.defaultValue=i[1]),ae(i[2])&&(l.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const r=i[3]||i[2];Object.keys(r).forEach(o=>{l[o]=r[o]})}return l},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),qm=i=>{var l,r;return ae(i.ns)&&(i.ns=[i.ns]),ae(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),ae(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),((r=(l=i.supportedLngs)==null?void 0:l.indexOf)==null?void 0:r.call(l,"cimode"))<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i},ju=()=>{},Pb=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Ag="__i18next_supportNoticeShown",eS=()=>!!(typeof globalThis<"u"&&globalThis[Ag]||typeof process<"u"&&_o&&_o.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&_o),tS=()=>{typeof globalThis<"u"&&(globalThis[Ag]=!0)},aS=i=>{var l,r,o,c,f,h,g,p,m,b,v,N,L;return!!(((o=(r=(l=i==null?void 0:i.modules)==null?void 0:l.backend)==null?void 0:r.name)==null?void 0:o.indexOf("Locize"))>0||((g=(h=(f=(c=i==null?void 0:i.modules)==null?void 0:c.backend)==null?void 0:f.constructor)==null?void 0:h.name)==null?void 0:g.indexOf("Locize"))>0||(m=(p=i==null?void 0:i.options)==null?void 0:p.backend)!=null&&m.backends&&i.options.backend.backends.some(z=>{var H,B,q;return((H=z==null?void 0:z.name)==null?void 0:H.indexOf("Locize"))>0||((q=(B=z==null?void 0:z.constructor)==null?void 0:B.name)==null?void 0:q.indexOf("Locize"))>0})||(v=(b=i==null?void 0:i.options)==null?void 0:b.backend)!=null&&v.projectId||(L=(N=i==null?void 0:i.options)==null?void 0:N.backend)!=null&&L.backendOptions&&i.options.backend.backendOptions.some(z=>z==null?void 0:z.projectId))};class ai extends $u{constructor(l={},r){if(super(),this.options=qm(l),this.services={},this.logger=Ft,this.modules={external:[]},Pb(this),r&&!this.isInitialized&&!l.isClone){if(!this.options.initAsync)return this.init(l,r),this;setTimeout(()=>{this.init(l,r)},0)}}init(l={},r){this.isInitializing=!0,typeof l=="function"&&(r=l,l={}),l.defaultNS==null&&l.ns&&(ae(l.ns)?l.defaultNS=l.ns:l.ns.indexOf("translation")<0&&(l.defaultNS=l.ns[0]));const o=Ao();this.options={...o,...this.options,...qm(l)},this.options.interpolation={...o.interpolation,...this.options.interpolation},l.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=l.keySeparator),l.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=l.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!aS(this)&&!eS()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),tS());const c=m=>m?typeof m=="function"?new m:m:null;if(!this.options.isClone){this.modules.logger?Ft.init(c(this.modules.logger),this.options):Ft.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:m=Fb;const b=new Lm(this.options);this.store=new jm(this.options.resources,this.options);const v=this.services;v.logger=Ft,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new Zb(b,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),m&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(v.formatter=c(m),v.formatter.init&&v.formatter.init(v,this.options),this.options.interpolation.format=v.formatter.format.bind(v.formatter)),v.interpolator=new Hm(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new Ib(c(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.languageDetector&&(v.languageDetector=c(this.modules.languageDetector),v.languageDetector.init&&v.languageDetector.init(v,this.options.detection,this.options)),this.modules.i18nFormat&&(v.i18nFormat=c(this.modules.i18nFormat),v.i18nFormat.init&&v.i18nFormat.init(this)),this.translator=new qu(this.services,this.options),this.translator.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.external.forEach(L=>{L.init&&L.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ju),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(m=>{this[m]=(...b)=>this.store[m](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=(...b)=>(this.store[m](...b),this)});const g=ei(),p=()=>{const m=(b,v)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(v),r(b,v)};if(this.languages&&!this.isInitialized)return m(null,this.t.bind(this));this.changeLanguage(this.options.lng,m)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),g}loadResources(l,r=ju){var f,h;let o=r;const c=ae(l)?l:this.language;if(typeof l=="function"&&(o=l),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],p=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&g.indexOf(v)<0&&g.push(v)})};c?p(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>p(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>p(m)),this.services.backendConnector.load(g,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(m)})}else o(null)}reloadResources(l,r,o){const c=ei();return typeof l=="function"&&(o=l,l=void 0),typeof r=="function"&&(o=r,r=void 0),l||(l=this.languages),r||(r=this.options.ns),o||(o=ju),this.services.backendConnector.reload(l,r,f=>{c.resolve(),o(f)}),c}use(l){if(!l)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!l.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return l.type==="backend"&&(this.modules.backend=l),(l.type==="logger"||l.log&&l.warn&&l.error)&&(this.modules.logger=l),l.type==="languageDetector"&&(this.modules.languageDetector=l),l.type==="i18nFormat"&&(this.modules.i18nFormat=l),l.type==="postProcessor"&&Cg.addPostProcessor(l),l.type==="formatter"&&(this.modules.formatter=l),l.type==="3rdParty"&&this.modules.external.push(l),this}setResolvedLanguage(l){if(!(!l||!this.languages)&&!(["cimode","dev"].indexOf(l)>-1)){for(let r=0;r<this.languages.length;r++){const o=this.languages[r];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(l)<0&&this.store.hasLanguageSomeTranslations(l)&&(this.resolvedLanguage=l,this.languages.unshift(l))}}changeLanguage(l,r){this.isLanguageChangingTo=l;const o=ei();this.emit("languageChanging",l);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,p)=>{p?this.isLanguageChangingTo===l&&(c(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),r&&r(g,(...m)=>this.t(...m))},h=g=>{var b,v;!l&&!g&&this.services.languageDetector&&(g=[]);const p=ae(g)?g:g&&g[0],m=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(ae(g)?[g]:g);m&&(this.language||c(m),this.translator.language||this.translator.changeLanguage(m),(v=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||v.call(b,m)),this.loadResources(m,N=>{f(N,m)})};return!l&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!l&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(l),o}getFixedT(l,r,o){const c=(f,h,...g)=>{let p;typeof h!="object"?p=this.options.overloadTranslationOptionHandler([f,h].concat(g)):p={...h},p.lng=p.lng||c.lng,p.lngs=p.lngs||c.lngs,p.ns=p.ns||c.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||o||c.keyPrefix);const m={...this.options,...p};typeof p.keyPrefix=="function"&&(p.keyPrefix=el(p.keyPrefix,m));const b=this.options.keySeparator||".";let v;return p.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=el(N,m)),`${p.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=el(f,m)),v=p.keyPrefix?`${p.keyPrefix}${b}${f}`:f),this.t(v,p)};return ae(l)?c.lng=l:c.lngs=l,c.ns=r,c.keyPrefix=o,c}t(...l){var r;return(r=this.translator)==null?void 0:r.translate(...l)}exists(...l){var r;return(r=this.translator)==null?void 0:r.exists(...l)}setDefaultNamespace(l){this.options.defaultNS=l}hasLoadedNamespace(l,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=r.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const h=(g,p)=>{const m=this.services.backendConnector.state[`${g}|${p}`];return m===-1||m===0||m===2};if(r.precheck){const g=r.precheck(this,h);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,l)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(o,l)&&(!c||h(f,l)))}loadNamespaces(l,r){const o=ei();return this.options.ns?(ae(l)&&(l=[l]),l.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),r&&r(c)}),o):(r&&r(),Promise.resolve())}loadLanguages(l,r){const o=ei();ae(l)&&(l=[l]);const c=this.options.preload||[],f=l.filter(h=>c.indexOf(h)<0&&this.services.languageUtils.isSupportedCode(h));return f.length?(this.options.preload=c.concat(f),this.loadResources(h=>{o.resolve(),r&&r(h)}),o):(r&&r(),Promise.resolve())}dir(l){var c,f;if(l||(l=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!l)return"rtl";try{const h=new Intl.Locale(l);if(h&&h.getTextInfo){const g=h.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=((f=this.services)==null?void 0:f.languageUtils)||new Lm(Ao());return l.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(o.getLanguagePartFromCode(l))>-1||l.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(l={},r){const o=new ai(l,r);return o.createInstance=ai.createInstance,o}cloneInstance(l={},r=ju){const o=l.forkResourceStore;o&&delete l.forkResourceStore;const c={...this.options,...l,isClone:!0},f=new ai(c);if((l.debug!==void 0||l.prefix!==void 0)&&(f.logger=f.logger.clone(l)),["store","services","language"].forEach(g=>{f[g]=this[g]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const g=Object.keys(this.store.data).reduce((p,m)=>(p[m]={...this.store.data[m]},p[m]=Object.keys(p[m]).reduce((b,v)=>(b[v]={...p[m][v]},b),p[m]),p),{});f.store=new jm(g,c),f.services.resourceStore=f.store}if(l.interpolation){const p={...Ao().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:p};f.services.interpolator=new Hm(m)}return f.translator=new qu(f.services,c),f.translator.on("*",(g,...p)=>{f.emit(g,...p)}),f.init(c,r),f.translator.options=c,f.translator.backendConnector.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},f}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const $e=ai.createInstance();$e.createInstance;$e.dir;$e.init;$e.loadResources;$e.reloadResources;$e.use;$e.changeLanguage;$e.getFixedT;$e.t;$e.exists;$e.setDefaultNamespace;$e.hasLoadedNamespace;$e.loadNamespaces;$e.loadLanguages;const ni="en",zg={en:()=>Pe(()=>import("./en-CKhCF6St.js"),[],import.meta.url),zh:()=>Pe(()=>import("./zh-Dz5FLTBV.js"),[],import.meta.url),"zh-TW":()=>Pe(()=>import("./zh-TW-BtRwreY_.js"),[],import.meta.url),ja:()=>Pe(()=>import("./ja-ChF4vbBL.js"),[],import.meta.url),es:()=>Pe(()=>import("./es-C8UBPhxM.js"),[],import.meta.url)},Du={};function Ym(i){return i in zg}function Ng(i){if(Ym(i))return i;const l=i.split("-")[0];return Ym(l)?l:ni}function nS(){const i=localStorage.getItem("cc_lang");return Ng(i||navigator.language||ni)}async function ko(i){if(Du[i])return;const l=await zg[i]();Du[i]=l.default,$e.isInitialized&&$e.addResourceBundle(i,"translation",Du[i],!0,!0)}async function lS(){const i=nS();await Promise.all([ko(ni),i===ni?Promise.resolve():ko(i)]),$e.isInitialized||await $e.use(ab).init({lng:i,fallbackLng:ni,resources:Object.fromEntries(Object.entries(Du).map(([l,r])=>[l,{translation:r}])),interpolation:{escapeValue:!1}})}async function wg(i){const l=Ng(i);await ko(l),await $e.changeLanguage(l),localStorage.setItem("cc_lang",l)}const Gm=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],iS=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron"]},{label:"System",ids:["system"]}];function uS(){var J;const{pathname:i}=zt(),{t:l,i18n:r}=Eg(),{theme:o,setTheme:c}=Wo(),f=Ot(V=>V.logout),h=Ot(V=>V.desktopManaged),g=Fo(),p=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{wg(V),N(!1)},z={light:Im,dark:Fm,system:Jm},H={light:"dark",dark:"system",system:"light"},B=z[o],q=Zu.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:g}))??!0}),Q=q.map(V=>{var te;const ue=V.icon,K=((te=V.resolveLabelKey)==null?void 0:te.call(V,{desktopManaged:h,features:g,runtimeProvider:p}))||V.labelKey;return{...V,Icon:ue,labelKey:K}}),X=i.startsWith("/chat");return _.jsxs(_.Fragment,{children:[_.jsxs("aside",{className:He("relative hidden h-[100dvh] flex-col overflow-hidden border-r transition-all duration-300 ease-out md:flex","border-white/55 bg-white/24 shadow-[inset_-1px_0_0_rgba(255,255,255,0.36)] backdrop-blur-[34px] supports-[backdrop-filter]:bg-white/18","dark:border-white/[0.10] dark:bg-[#1c1c1e]/34 dark:shadow-[inset_-1px_0_0_rgba(255,255,255,0.08)] dark:supports-[backdrop-filter]:bg-[#1c1c1e]/26",m?"w-16":"w-56"),children:[_.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(255,255,255,0.55),rgba(255,255,255,0.18)_48%,rgba(255,255,255,0.08))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.025)_52%,rgba(255,255,255,0.015))]","aria-hidden":"true"}),_.jsx("div",{className:He("relative flex h-[5.25rem] items-center gap-3 px-4 pt-7 transition-colors"),children:_.jsx(Rg,{showWordmark:!m})}),_.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:iS.map(V=>{const ue=q.filter(K=>V.ids.includes(K.id));return ue.length===0?null:_.jsxs("div",{className:"space-y-1",children:[!m&&_.jsx("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/80",children:V.label}),ue.map(K=>{var se;const te=K.icon,le=((se=K.resolveLabelKey)==null?void 0:se.call(K,{desktopManaged:h,features:g,runtimeProvider:p}))||K.labelKey;return _.jsxs(jo,{to:K.path,end:K.end,className:({isActive:Ae})=>He("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",Ae?"bg-black/[0.07] text-foreground dark:bg-white/[0.10]":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(le)})]},K.id)})]},V.label)})}),_.jsxs("div",{className:He("relative border-t p-2 space-y-1","border-black/10 dark:border-white/[0.08]"),children:[!m&&_.jsxs("div",{className:"px-3 pb-1 pt-0.5 text-[11px] font-medium text-muted-foreground/75",children:["AgentDock v","0.1.30"]}),_.jsxs("div",{className:"relative",children:[_.jsxs("button",{type:"button",onClick:()=>N(!v),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(N0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:((J=Gm.find(V=>V.code===r.language))==null?void 0:J.label)||"English"})]}),v&&_.jsx("div",{className:He("absolute bottom-full left-0 mb-1 w-48 rounded-xl py-1 z-50 overflow-hidden","border border-black/10 bg-white/90 text-popover-foreground shadow-[0_18px_40px_rgba(0,0,0,0.12)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#2c2c2e]/90"),children:Gm.map(V=>_.jsx("button",{type:"button",onClick:()=>L(V.code),className:He("w-full text-left px-3 py-2 text-sm transition-colors duration-150",r.language===V.code?"text-primary font-medium bg-primary/10":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:V.label},V.code))})]}),_.jsxs("button",{type:"button",onClick:()=>c(H[o]),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(B,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(`theme.${o}`)})]}),!h&&_.jsxs("button",{type:"button",onClick:f,className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-destructive/10 hover:text-destructive","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(U0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l("login.logout")})]}),_.jsx("button",{type:"button",onClick:()=>b(!m),className:He("flex items-center justify-center w-full px-3 py-2 rounded-lg transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:m?_.jsx(E0,{size:18}):_.jsx(S0,{size:18})})]})]}),X?null:_.jsx("nav",{className:He("fixed inset-x-0 bottom-0 z-50 border-t px-2 pb-[max(env(safe-area-inset-bottom),0.5rem)] pt-2 md:hidden","border-black/10 bg-white/88 shadow-[0_-12px_32px_rgba(15,23,42,0.10)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#111113]/88 dark:shadow-[0_-16px_42px_rgba(0,0,0,0.34)]"),"aria-label":"Primary navigation",children:_.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:Q.map(({id:V,path:ue,end:K,Icon:te,labelKey:le})=>_.jsxs(jo,{to:ue,end:K,className:({isActive:se})=>He("flex min-w-[4.5rem] flex-1 flex-col items-center justify-center gap-1 rounded-xl px-2 py-2 text-[11px] font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",se?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),_.jsx("span",{className:"max-w-[4.25rem] truncate",children:l(le)})]},V))})})]})}function rS(){const{pathname:i}=zt(),{desktopChat:l}=Fo(),r=i.startsWith("/chat"),o=i.startsWith("/chat")&&l,c=o&&dn()==="electron";return _.jsxs("div",{className:He("flex h-[100dvh] overflow-hidden","bg-background/60 backdrop-blur-2xl"),children:[_.jsx("div",{className:"fixed left-0 right-0 top-0 z-50 hidden h-8 [-webkit-app-region:drag] md:block","aria-hidden":"true"}),_.jsx(uS,{}),_.jsx("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0 bg-background/45 backdrop-blur-2xl",children:_.jsx("main",{className:He("flex-1 min-h-0",o?"overflow-hidden":"overflow-y-auto",c?"p-0":r?"p-4 pb-4 sm:p-6 sm:pb-6":"p-4 pb-24 sm:p-6 sm:pb-6"),children:_.jsx("div",{className:He(o&&"h-full min-h-0",!c&&"mx-auto w-full max-w-7xl"),children:_.jsx(l1,{})})})})]})}const sS=()=>Xe.get("/status"),n2=i=>Xe.post("/restart",i),l2=()=>Xe.post("/reload"),i2=i=>Xe.get("/logs",i);function oS({children:i,className:l,hover:r}){return _.jsx("div",{className:He("rounded-lg p-5 text-card-foreground transition-colors duration-200 animate-float-in","border border-black/[0.08] bg-white/62 shadow-[0_1px_1px_rgba(0,0,0,0.04)] backdrop-blur-2xl","dark:border-white/[0.07] dark:bg-white/[0.06] dark:shadow-none",r&&"cursor-pointer hover:border-black/[0.12] hover:bg-white/76 hover:shadow-[0_10px_26px_rgba(0,0,0,0.07)] dark:hover:border-white/[0.10] dark:hover:bg-white/[0.09] dark:hover:shadow-none",l),children:i})}function Vm(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function jg(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Vm(c,l);return!r&&typeof f=="function"&&(r=!0),f});if(r)return()=>{for(let c=0;c<o.length;c++){const f=o[c];typeof f=="function"?f():Vm(i[c],null)}}}}function u2(...i){return T.useCallback(jg(...i),i)}var cS=Symbol.for("react.lazy"),Yu=m0[" use ".trim().toString()];function fS(i){return typeof i=="object"&&i!==null&&"then"in i}function Mg(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===cS&&"_payload"in i&&fS(i._payload)}function dS(i){const l=mS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;Mg(f)&&typeof Yu=="function"&&(f=Yu(f._payload));const g=T.Children.toArray(f),p=g.find(pS);if(p){const m=p.props.children,b=g.map(v=>v===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:v);return _.jsx(l,{...h,ref:c,children:T.isValidElement(m)?T.cloneElement(m,void 0,b):null})}return _.jsx(l,{...h,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}var hS=dS("Slot");function mS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(Mg(c)&&typeof Yu=="function"&&(c=Yu(c._payload)),T.isValidElement(c)){const h=vS(c),g=yS(f,c.props);return c.type!==T.Fragment&&(g.ref=o?jg(o,h):h),T.cloneElement(c,g)}return T.Children.count(c)>1?T.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var gS=Symbol("radix.slottable");function pS(i){return T.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===gS}function yS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...g)=>{const p=f(...g);return c(...g),p}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function vS(i){var o,c;let l=(o=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:o.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=(c=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:c.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}const bS={default:"bg-primary text-primary-foreground hover:bg-accent-dim",primary:"bg-primary text-primary-foreground hover:bg-accent-dim",secondary:"bg-black/[0.05] text-secondary-foreground hover:bg-black/[0.08] dark:bg-white/[0.08] dark:hover:bg-white/[0.12]",outline:"border border-input bg-background hover:bg-black/[0.04] hover:text-foreground dark:hover:bg-white/[0.06]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]",link:"text-primary underline-offset-4 hover:underline"},SS={default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",md:"h-9 rounded-md px-4 py-2 text-sm",lg:"h-10 rounded-md px-6 text-sm",icon:"h-9 w-9"};function Gu({variant:i="primary",size:l="md",className:r,children:o,loading:c,asChild:f,disabled:h,type:g="button",...p}){const m=l==="default"?"md":l,b=f?hS:"button";return _.jsxs(b,{...f?{}:{type:g},className:He("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors duration-200","cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50",bS[i],SS[m],r),disabled:h||c,...p,children:[c&&_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24","aria-hidden":!0,children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o]})}function Km({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("input",{className:He("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}function r2({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("textarea",{className:He("flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors resize-none","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}const Ho="http://127.0.0.1:9831",xS=`${Ho}/api/local/v1`;function ES(i){const l=i.trim();return l?l.replace(/\/+$/,""):xS}const ri=ES("/api/local/v1");ri.endsWith("/api/local/v1")&&ri.slice(0,-13);const si=new Set;let _t=null;async function W(i,l,r){const o=await fetch(`${ri}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}function Lg(){if(_t||typeof window>"u")return;_t=new EventSource(`${ri}/events`);const i=l=>{try{const r=JSON.parse(l.data);si.forEach(o=>o(r))}catch{}};["runtime.updated","runtime.detect.started","runtime.detect.completed","runtime.detect.failed","runtime.status.changed","thread.updated","message.created","message.updated","run.updated","scheduler.job.updated","scheduler.run.updated","presence.updated","stream.updated"].forEach(l=>{_t==null||_t.addEventListener(l,i)}),_t.onerror=()=>{_t==null||_t.close(),_t=null,si.size>0&&window.setTimeout(()=>Lg(),1e3)}}function TS(){si.size===0&&_t&&(_t.close(),_t=null)}function Dg(i){return si.add(i),Lg(),()=>{si.delete(i),TS()}}async function s2(){return W("GET","/runtime")}async function o2(){return W("POST","/runtime/service/start")}async function c2(){return W("POST","/runtime/service/stop")}async function f2(){return W("POST","/runtime/service/restart")}async function d2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return W("GET",`/runtime/logs${l}`)}async function h2(){return W("GET","/runtime/agent-runtimes")}async function m2(){return W("POST","/runtimes/refresh")}async function g2(){return W("GET","/runtime/config")}async function p2(i){return W("POST","/runtime/config/raw",{raw:i})}async function y2(i){return W("POST","/runtime/config/structured",{config:i})}async function v2(i){return W("POST","/runtime/settings",i)}async function RS(i){return W("GET",`/platforms/${encodeURIComponent(i)}`)}function di(i){return i?`?instance_id=${encodeURIComponent(i)}`:""}async function _S(i,l,r){return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}${di(r)}`)}async function CS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test${di(r)}`)}async function OS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable${di(r)}`)}async function AS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable${di(r)}`)}async function zS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function NS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function wS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function jS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function Ug(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode${di(r)}`)}async function kg(i,l,r,o){const c=`?ticket=${encodeURIComponent(r)}${o?`&instance_id=${encodeURIComponent(o)}`:""}`;return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode/status${c}`)}async function b2(){return RS("lark")}async function S2(i,l){return _S("lark",i,l)}async function x2(i,l){return CS("lark",i,l)}async function E2(i,l){return OS("lark",i,l)}async function T2(i,l){return AS("lark",i,l)}async function R2(i){return zS("lark",i)}async function _2(i){return NS("lark",i)}async function C2(i){return wS("lark",i)}async function O2(i){return jS("lark",i)}async function A2(i,l){return Ug("lark",i,l)}async function z2(i,l,r){return kg("lark",i,l,r)}async function N2(i,l){return Ug("weixin",i,l)}async function w2(i,l,r){return kg("weixin",i,l,r)}async function j2(){return W("GET","/workspaces")}async function M2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.runtimeId&&l.set("runtime_id",i.runtimeId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/tasks${r}`)}async function L2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/approvals${r}`)}async function D2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.approvalId&&l.set("approval_id",i.approvalId),i.type&&l.set("type",Array.isArray(i.type)?i.type.join(","):i.type),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/audit-events${r}`)}async function U2(i){return W("GET","/scheduler/jobs")}async function k2(i){return W("POST","/scheduler/jobs",i)}async function H2(i,l){return W("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function B2(i){return W("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function q2(i){return W("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function Y2(i){return W("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function G2(i,l){return W("POST","/threads",{workspaceId:i,title:l})}async function V2(i){return W("GET",`/threads/${encodeURIComponent(i)}`)}async function K2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function Q2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function X2(i){return W("DELETE",`/threads/${encodeURIComponent(i)}`)}async function Z2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function $2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function J2(i){return W("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function F2(){return W("GET","/knowledge/config")}async function W2(){return W("GET","/knowledge/folders")}async function I2(i){return W("POST","/knowledge/folders",i)}async function P2(i,l){return W("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function ex(i){return W("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function tx(){return W("GET","/knowledge/bases")}async function ax(i){return W("POST","/knowledge/bases",i)}async function nx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function lx(i,l){return W("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function ix(i){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function ux(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function rx(i,l){const r=new FormData;r.append("collection",l.collection),r.append("knowledgebase_id",i),l.folder&&r.append("folder",l.folder),l.files.forEach(f=>{r.append("files",f,f.name)});const o=await fetch(`${ri}/knowledge/bases/${encodeURIComponent(i)}/files`,{method:"POST",body:r}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core upload failed: ${o.status}`);return c.data}async function sx(i,l){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function ox(i,l){return W("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function cx(){return W("GET","/capabilities/snapshot")}async function fx(){return W("GET","/plugins/diagnostics")}async function dx(i){return W("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function hx(i){return Dg(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function mx(i){return Dg(l=>{l.type==="stream.updated"&&i(l.stream),(l.type==="message.created"||l.type==="message.updated"||l.type==="run.updated")&&"stream"in l&&l.stream&&i(l.stream)})}const MS=[{code:"en",label:"EN"},{code:"zh",label:"中"},{code:"zh-TW",label:"繁"},{code:"ja",label:"日"},{code:"es",label:"ES"}];function LS(){const{t:i,i18n:l}=Eg(),r=Qu(),o=Ot(J=>J.login),{theme:c,setTheme:f}=Wo(),[h,g]=T.useState(""),[p,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=sb(),H=ob(),B=async J=>{if(J.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{p.trim()&&Xe.setBaseUrl(p.trim()),Xe.setToken(h.trim()),await sS(),o(h.trim(),p.trim()),z?window.location.hash="#/":r("/",{replace:!0})}catch{v(i("login.invalidToken")),Xe.setToken(""),Xe.setBaseUrl("")}finally{L(!1)}}},q={light:Im,dark:Fm,system:Jm},Q={light:"dark",dark:"system",system:"light"},X=q[c];return _.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-[radial-gradient(circle_at_top,hsl(var(--secondary))_0,hsl(var(--background))_42%,hsl(var(--background))_78%)] p-4",children:[_.jsxs("div",{className:"fixed top-4 right-4 flex items-center gap-2",children:[_.jsx("div",{className:"flex overflow-hidden rounded-md border bg-card/80 backdrop-blur",children:MS.map(J=>_.jsx("button",{onClick:()=>void wg(J.code),className:He("px-2.5 py-1.5 text-xs font-medium transition-colors",l.language===J.code?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent/10 hover:text-foreground"),children:J.label},J.code))}),_.jsx(Gu,{variant:"outline",size:"icon",onClick:()=>f(Q[c]),"aria-label":i(`theme.${c}`),children:_.jsx(X,{size:16})})]}),_.jsx("div",{className:"w-full max-w-md animate-fade-in",children:_.jsxs(oS,{className:"p-8 shadow-2xl shadow-primary/10",children:[_.jsx("div",{className:"flex justify-center mb-6",children:_.jsx(Rg,{markClassName:"h-14 w-14 drop-shadow-[0_14px_28px_rgba(0,122,255,0.22)]"})}),_.jsx("h1",{className:"text-2xl font-bold text-center text-foreground mb-1",children:i("login.title")}),_.jsx("p",{className:"text-sm text-center text-muted-foreground mb-3",children:i("login.subtitle")}),_.jsx("div",{className:"mb-8 rounded-lg border bg-muted px-4 py-3 text-xs text-muted-foreground",children:z?"AgentDock 桌面模式会自动连接到本地托管运行时。":"Browser mode requires a reachable API endpoint. Enter the server URL and access token."}),b&&_.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-lg border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive dark:text-red-200",children:[_.jsx(R0,{size:16}),b]}),_.jsxs("form",{onSubmit:B,className:"space-y-4",children:[_.jsx(Km,{label:i("login.token"),type:"password",value:h,onChange:J=>g(J.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Km,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:p,onChange:J=>m(J.target.value),placeholder:"http://localhost:9820"}),_.jsxs(Gu,{type:"submit",disabled:N||!h.trim()||H,className:"w-full shadow-[0_0_20px_-6px_hsl(var(--primary)/0.55)]",children:[N?_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):_.jsx(I0,{size:16}),i("login.connect")]})]})]})})]})}function DS({children:i}){return Ot(r=>r.isAuthenticated)?_.jsx(_.Fragment,{children:i}):_.jsx(Ya,{to:"/login",replace:!0})}function US(){return _.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function kS(){const i=Ot(o=>o.isAuthenticated),l=Ot(o=>o.desktopManaged),r=Fo();return _.jsx(T.Suspense,{fallback:_.jsx(US,{}),children:_.jsxs(u1,{children:[_.jsx(on,{path:"/login",element:i?_.jsx(Ya,{to:"/",replace:!0}):_.jsx(LS,{})}),_.jsxs(on,{element:_.jsx(DS,{children:_.jsx(rS,{})}),children:[Zu.listRoutes().map(o=>o.index?_.jsx(on,{index:!0,element:o.element({desktopManaged:l,features:r})},o.id):_.jsx(on,{path:o.path,element:o.element({desktopManaged:l,features:r})},o.id)),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:"/",replace:!0})})]}),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:i?"/":"/login",replace:!0})})]})})}class HS extends Pn.Component{constructor(){super(...arguments);In(this,"state",{hasError:!1,errorMessage:""})}static getDerivedStateFromError(r){return{hasError:!0,errorMessage:r instanceof Error?r.message:String(r)}}componentDidCatch(r,o){console.error("App render failed",r,o)}render(){return this.state.hasError?_.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-lg w-full rounded-2xl border border-red-200 dark:border-red-900/40 bg-red-50 dark:bg-red-950/20 px-6 py-5",children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"页面渲染失败"}),_.jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400 break-words",children:this.state.errorMessage||"Unknown renderer error"}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700",children:"Reload"})]})}):this.props.children}}const BS="http://127.0.0.1:9831",qS=`${BS}/api/local/v1`,cn=YS("/api/local/v1"),oi=new Set;let Kt=null;function YS(i){const l=i.trim();return l?l.replace(/\/+$/,""):qS}async function Io(i,l,r){const o=await fetch(`${cn}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}async function GS(i=350){var o;const l=new AbortController,r=window.setTimeout(()=>l.abort(),i);try{const c=await fetch(`${cn}/health`,{signal:l.signal}),f=await c.json();return c.ok&&f.ok&&((o=f.data)==null?void 0:o.name)==="local-ai-core"}catch{return!1}finally{window.clearTimeout(r)}}function Hg(){Kt||typeof window>"u"||(Kt=new EventSource(`${cn}/events`),Kt.addEventListener("runtime.updated",i=>{try{const l=JSON.parse(i.data);l.type==="runtime.updated"&&oi.forEach(r=>r(l.runtime))}catch{}}),Kt.onerror=()=>{Kt==null||Kt.close(),Kt=null,oi.size>0&&window.setTimeout(()=>Hg(),1e3)})}function VS(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function KS(){return window.desktop?(To("electron"),!0):(await GS(),To("local_core"),!0)}function QS(){return dn()==="electron"&&window.desktop?window.desktop.getRuntimeStatus():Io("GET","/runtime")}function Qm(){return Io("GET","/capabilities/snapshot")}function XS(i){if(dn()==="electron"&&window.desktop)return window.desktop.getLogs(i);const l=`?limit=${encodeURIComponent(String(i))}`;return Io("GET",`/runtime/logs${l}`)}function ZS(i){return dn()==="electron"&&window.desktop?window.desktop.onRuntimeEvent(i):(oi.add(i),Hg(),()=>{oi.delete(i),VS()})}const Xm=20,$S=500;function JS(i){return new Promise(l=>window.setTimeout(l,i))}function FS(){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-white dark:bg-gray-900 px-5 py-4 text-sm text-gray-600 dark:text-gray-300 shadow-sm",children:[_.jsx(Wm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function WS({message:i,logs:l,onRetry:r}){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-2xl w-full rounded-3xl border border-red-200 dark:border-red-900/40 bg-white dark:bg-gray-900 shadow-sm overflow-hidden",children:[_.jsx("div",{className:"px-6 py-5 border-b border-red-100 dark:border-red-900/30 bg-red-50/80 dark:bg-red-950/20",children:_.jsxs("div",{className:"flex items-start gap-3",children:[_.jsx("div",{className:"w-10 h-10 rounded-2xl bg-red-100 dark:bg-red-950/40 text-red-600 dark:text-red-300 flex items-center justify-center shrink-0",children:_.jsx($0,{size:18})}),_.jsxs("div",{children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"AgentDock 运行时初始化失败"}),_.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 break-words",children:i})]})]})}),_.jsxs("div",{className:"px-6 py-5 space-y-4",children:[_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] px-4 py-3 text-sm text-gray-600 dark:text-gray-300",children:[_.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"What we can do next"}),_.jsx("p",{className:"mt-1",children:"请先重试本地运行时初始化。如果仍然失败,请检查下方运行时日志,并确认 Local AI Core 配置文件路径与运行环境是否正确。"})]}),l.length>0&&_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-gray-50 dark:bg-gray-950/40 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"最近的桌面日志"}),_.jsx("pre",{className:"mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-gray-600 dark:text-gray-300 font-mono",children:l.join(`
176
+ Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}/*`}">.`)}let b=zt(),v;if(l){let q=typeof l=="string"?hn(l):l;Le(p==="/"||((B=q.pathname)==null?void 0:B.startsWith(p)),`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 "${p}" but pathname "${q.pathname}" was given in the \`location\` prop.`),v=q}else v=b;let N=v.pathname||"/",L=N;if(p!=="/"){let q=p.replace(/^\//,"").split("/");L="/"+N.replace(/^\//,"").split("/").slice(q.length).join("/")}let z=Pm(i,{pathname:L});Ct(m||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Ct(z==null||z[z.length-1].route.element!==void 0||z[z.length-1].route.Component!==void 0||z[z.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 H=Fv(z&&z.map(q=>Object.assign({},q,{params:Object.assign({},h,q.params),pathname:Qt([p,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?p:Qt([p,o.encodeLocation?o.encodeLocation(q.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathnameBase])})),c,r);return l&&H?T.createElement(ci.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},H):H}function Xv(){let i=t1(),l=wv(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),r=i instanceof Error?i.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},f={padding:"2px 4px",backgroundColor:o},h=null;return console.error("Error handled by React Router default ErrorBoundary:",i),h=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:f},"ErrorBoundary")," or"," ",T.createElement("code",{style:f},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},l),r?T.createElement("pre",{style:c},r):null,h)}var Zv=T.createElement(Xv,null),hg=class extends T.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,l){return l.location!==i.location||l.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:l.error,location:l.location,revalidation:i.revalidation||l.revalidation}}componentDidCatch(i,l){this.props.onError?this.props.onError(i,l):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const r=qv(i.digest);r&&(i=r)}let l=i!==void 0?T.createElement(qt.Provider,{value:this.props.routeContext},T.createElement(Yo.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?T.createElement($v,{error:i},l):l}};hg.contextType=ug;var xo=new WeakMap;function $v({children:i,error:l}){let{basename:r}=T.useContext(At);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=Bv(l.digest);if(o){let c=xo.get(l);if(c)throw c;let f=lg(o.location,r);if(ng&&!xo.get(l))if(f.isExternal||o.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:o.replace}));throw xo.set(l,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return i}function Jv({routeContext:i,match:l,children:r}){let o=T.useContext(tl);return o&&o.static&&o.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=l.route.id),T.createElement(qt.Provider,{value:i},r)}function Fv(i,l=[],r){let o=r==null?void 0:r.state;if(i==null){if(!o)return null;if(o.errors)i=o.matches;else if(l.length===0&&!o.initialized&&o.matches.length>0)i=o.matches;else return null}let c=i,f=o==null?void 0:o.errors;if(f!=null){let b=c.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);Le(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let h=!1,g=-1;if(r&&o){h=o.renderFallback;for(let b=0;b<c.length;b++){let v=c[b];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=b),v.route.id){let{loaderData:N,errors:L}=o,z=v.route.loader&&!N.hasOwnProperty(v.route.id)&&(!L||L[v.route.id]===void 0);if(v.route.lazy||z){r.isStatic&&(h=!0),g>=0?c=c.slice(0,g+1):c=[c[0]];break}}}}let p=r==null?void 0:r.onError,m=o&&p?(b,v)=>{var N,L;p(b,{location:o.location,params:((L=(N=o.matches)==null?void 0:N[0])==null?void 0:L.params)??{},unstable_pattern:jv(o.matches),errorInfo:v})}:void 0;return c.reduceRight((b,v,N)=>{let L,z=!1,H=null,B=null;o&&(L=f&&v.route.id?f[v.route.id]:void 0,H=v.route.errorElement||Zv,h&&(g<0&&N===0?(mg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,B=null):g===N&&(z=!0,B=v.route.hydrateFallbackElement||null)));let q=l.concat(c.slice(0,N+1)),Q=()=>{let X;return L?X=H:z?X=B:v.route.Component?X=T.createElement(v.route.Component,null):v.route.element?X=v.route.element:X=b,T.createElement(Jv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:X})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(hg,{location:o.location,revalidation:o.revalidation,component:H,error:L,children:Q(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):Q()},null)}function Go(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wv(i){let l=T.useContext(tl);return Le(l,Go(i)),l}function Iv(i){let l=T.useContext(Ku);return Le(l,Go(i)),l}function Pv(i){let l=T.useContext(qt);return Le(l,Go(i)),l}function Vo(i){let l=Pv(i),r=l.matches[l.matches.length-1];return Le(r.route.id,`${i} can only be used on routes that contain a unique "id"`),r.route.id}function e1(){return Vo("useRouteId")}function t1(){var o;let i=T.useContext(Yo),l=Iv("useRouteError"),r=Vo("useRouteError");return i!==void 0?i:(o=l.errors)==null?void 0:o[r]}function a1(){let{router:i}=Wv("useNavigate"),l=Vo("useNavigate"),r=T.useRef(!1);return cg(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ct(r.current,og),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var ym={};function mg(i,l,r){!l&&!ym[i]&&(ym[i]=!0,Ct(!1,r))}T.memo(n1);function n1({routes:i,future:l,state:r,isStatic:o,onError:c}){return dg(i,void 0,{state:r,isStatic:o,onError:c})}function Ya({to:i,replace:l,state:r,relative:o}){Le(al(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(At);Ct(!c,"<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:f}=T.useContext(qt),{pathname:h}=zt(),g=Qu(),p=Vu(i,qo(f),h,o==="path"),m=JSON.stringify(p);return T.useEffect(()=>{g(JSON.parse(m),{replace:l,state:r,relative:o})},[g,m,o,l,r]),null}function l1(i){return Kv(i.context)}function on(i){Le(!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 i1({basename:i="/",children:l=null,location:r,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){Le(!al(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=i.replace(/^\/*/,"/"),p=T.useMemo(()=>({basename:g,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[g,c,f,h]);typeof r=="string"&&(r=hn(r));let{pathname:m="/",search:b="",hash:v="",state:N=null,key:L="default",unstable_mask:z}=r,H=T.useMemo(()=>{let B=ga(m,g);return B==null?null:{location:{pathname:B,search:b,hash:v,state:N,key:L,unstable_mask:z},navigationType:o}},[g,m,b,v,N,L,o,z]);return Ct(H!=null,`<Router basename="${g}"> is not able to match the URL "${m}${b}${v}" because it does not start with the basename, so the <Router> won't render anything.`),H==null?null:T.createElement(At.Provider,{value:p},T.createElement(ci.Provider,{children:l,value:H}))}function u1({children:i,location:l}){return Qv(No(i),l)}function No(i,l=[]){let r=[];return T.Children.forEach(i,(o,c)=>{if(!T.isValidElement(o))return;let f=[...l,c];if(o.type===T.Fragment){r.push.apply(r,No(o.props.children,f));return}Le(o.type===on,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Le(!o.props.index||!o.props.children,"An index route cannot have child routes.");let h={id:o.props.id||f.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(h.children=No(o.props.children,f)),r.push(h)}),r}var Mu="get",Lu="application/x-www-form-urlencoded";function Xu(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function r1(i){return Xu(i)&&i.tagName.toLowerCase()==="button"}function s1(i){return Xu(i)&&i.tagName.toLowerCase()==="form"}function o1(i){return Xu(i)&&i.tagName.toLowerCase()==="input"}function c1(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function f1(i,l){return i.button===0&&(!l||l==="_self")&&!c1(i)}function wo(i=""){return new URLSearchParams(typeof i=="string"||Array.isArray(i)||i instanceof URLSearchParams?i:Object.keys(i).reduce((l,r)=>{let o=i[r];return l.concat(Array.isArray(o)?o.map(c=>[r,c]):[[r,o]])},[]))}function d1(i,l){let r=wo(i);return l&&l.forEach((o,c)=>{r.has(c)||l.getAll(c).forEach(f=>{r.append(c,f)})}),r}var wu=null;function h1(){if(wu===null)try{new FormData(document.createElement("form"),0),wu=!1}catch{wu=!0}return wu}var m1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eo(i){return i!=null&&!m1.has(i)?(Ct(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lu}"`),null):i}function g1(i,l){let r,o,c,f,h;if(s1(i)){let g=i.getAttribute("action");o=g?ga(g,l):null,r=i.getAttribute("method")||Mu,c=Eo(i.getAttribute("enctype"))||Lu,f=new FormData(i)}else if(r1(i)||o1(i)&&(i.type==="submit"||i.type==="image")){let g=i.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=i.getAttribute("formaction")||g.getAttribute("action");if(o=p?ga(p,l):null,r=i.getAttribute("formmethod")||g.getAttribute("method")||Mu,c=Eo(i.getAttribute("formenctype"))||Eo(g.getAttribute("enctype"))||Lu,f=new FormData(g,i),!h1()){let{name:m,type:b,value:v}=i;if(b==="image"){let N=m?`${m}.`:"";f.append(`${N}x`,"0"),f.append(`${N}y`,"0")}else m&&f.append(m,v)}}else{if(Xu(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Mu,o=null,c=Lu,h=i}return f&&c==="text/plain"&&(h=f,f=void 0),{action:o,method:r.toLowerCase(),encType:c,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ko(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function gg(i,l,r,o){let c=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return r?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:l&&ga(c.pathname,l)==="/"?c.pathname=`${ku(l)}/_root.${o}`:c.pathname=`${ku(c.pathname)}.${o}`,c}async function p1(i,l){if(i.id in l)return l[i.id];try{let r=await import(i.module);return l[i.id]=r,r}catch(r){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function y1(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function v1(i,l,r){let o=await Promise.all(i.map(async c=>{let f=l.routes[c.route.id];if(f){let h=await p1(f,r);return h.links?h.links():[]}return[]}));return E1(o.flat(1).filter(y1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function vm(i,l,r,o,c,f){let h=(p,m)=>r[m]?p.route.id!==r[m].route.id:!0,g=(p,m)=>{var b;return r[m].pathname!==p.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==p.params["*"]};return f==="assets"?l.filter((p,m)=>h(p,m)||g(p,m)):f==="data"?l.filter((p,m)=>{var v;let b=o.routes[p.route.id];if(!b||!b.hasLoader)return!1;if(h(p,m)||g(p,m))return!0;if(p.route.shouldRevalidate){let N=p.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=r[0])==null?void 0:v.params)||{},nextUrl:new URL(i,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof N=="boolean")return N}return!0}):[]}function b1(i,l,{includeHydrateFallback:r}={}){return S1(i.map(o=>{let c=l.routes[o.route.id];if(!c)return[];let f=[c.module];return c.clientActionModule&&(f=f.concat(c.clientActionModule)),c.clientLoaderModule&&(f=f.concat(c.clientLoaderModule)),r&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function S1(i){return[...new Set(i)]}function x1(i){let l={},r=Object.keys(i).sort();for(let o of r)l[o]=i[o];return l}function E1(i,l){let r=new Set;return new Set(l),i.reduce((o,c)=>{let f=JSON.stringify(x1(c));return r.has(f)||(r.add(f),o.push({key:f,link:c})),o},[])}function Qo(){let i=T.useContext(tl);return Ko(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function T1(){let i=T.useContext(Ku);return Ko(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Xo=T.createContext(void 0);Xo.displayName="FrameworkContext";function Zo(){let i=T.useContext(Xo);return Ko(i,"You must render this element inside a <HydratedRouter> element"),i}function R1(i,l){let r=T.useContext(Xo),[o,c]=T.useState(!1),[f,h]=T.useState(!1),{onFocus:g,onBlur:p,onMouseEnter:m,onMouseLeave:b,onTouchStart:v}=l,N=T.useRef(null);T.useEffect(()=>{if(i==="render"&&h(!0),i==="viewport"){let H=q=>{q.forEach(Q=>{h(Q.isIntersecting)})},B=new IntersectionObserver(H,{threshold:.5});return N.current&&B.observe(N.current),()=>{B.disconnect()}}},[i]),T.useEffect(()=>{if(o){let H=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(H)}}},[o]);let L=()=>{c(!0)},z=()=>{c(!1),h(!1)};return r?i!=="intent"?[f,N,{}]:[f,N,{onFocus:Il(g,L),onBlur:Il(p,z),onMouseEnter:Il(m,L),onMouseLeave:Il(b,z),onTouchStart:Il(v,L)}]:[!1,N,{}]}function Il(i,l){return r=>{i&&i(r),r.defaultPrevented||l(r)}}function _1({page:i,...l}){let r=Lv(),{router:o}=Qo(),c=T.useMemo(()=>Pm(o.routes,i,o.basename),[o.routes,i,o.basename]);return c?r?T.createElement(O1,{page:i,matches:c,...l}):T.createElement(A1,{page:i,matches:c,...l}):null}function C1(i){let{manifest:l,routeModules:r}=Zo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return v1(i,l,r).then(h=>{f||c(h)}),()=>{f=!0}},[i,l,r]),o}function O1({page:i,matches:l,...r}){let o=zt(),{future:c}=Zo(),{basename:f}=Qo(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let g=gg(i,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),p=!1,m=[];for(let b of l)typeof b.route.shouldRevalidate=="function"?p=!0:m.push(b.route.id);return p&&m.length>0&&g.searchParams.set("_routes",m.join(",")),[g.pathname+g.search]},[f,c.unstable_trailingSlashAwareDataRequests,i,o,l]);return T.createElement(T.Fragment,null,h.map(g=>T.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})))}function A1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=Zo(),{basename:g}=Qo(),{loaderData:p,matches:m}=T1(),b=T.useMemo(()=>vm(i,l,m,f,o,"data"),[i,l,m,f,o]),v=T.useMemo(()=>vm(i,l,m,f,o,"assets"),[i,l,m,f,o]),N=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let H=new Set,B=!1;if(l.forEach(Q=>{var J;let X=f.routes[Q.route.id];!X||!X.hasLoader||(!b.some(V=>V.route.id===Q.route.id)&&Q.route.id in p&&((J=h[Q.route.id])!=null&&J.shouldRevalidate)||X.hasClientLoader?B=!0:H.add(Q.route.id))}),H.size===0)return[];let q=gg(i,g,c.unstable_trailingSlashAwareDataRequests,"data");return B&&H.size>0&&q.searchParams.set("_routes",l.filter(Q=>H.has(Q.route.id)).map(Q=>Q.route.id).join(",")),[q.pathname+q.search]},[g,c.unstable_trailingSlashAwareDataRequests,p,o,f,b,l,i,h]),L=T.useMemo(()=>b1(v,f),[v,f]),z=C1(v);return T.createElement(T.Fragment,null,N.map(H=>T.createElement("link",{key:H,rel:"prefetch",as:"fetch",href:H,...r})),L.map(H=>T.createElement("link",{key:H,rel:"modulepreload",href:H,...r})),z.map(({key:H,link:B})=>T.createElement("link",{key:H,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function z1(...i){return l=>{i.forEach(r=>{typeof r=="function"?r(l):r!=null&&(r.current=l)})}}var N1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{N1&&(window.__reactRouterVersion="7.14.2")}catch{}function w1({basename:i,children:l,unstable_useTransitions:r,window:o}){let c=T.useRef();c.current==null&&(c.current=rv({window:o,v5Compat:!0}));let f=c.current,[h,g]=T.useState({action:f.action,location:f.location}),p=T.useCallback(m=>{r===!1?g(m):T.startTransition(()=>g(m))},[r]);return T.useLayoutEffect(()=>f.listen(p),[f,p]),T.createElement(i1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var pg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yg=T.forwardRef(function({onClick:l,discover:r="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:g,state:p,target:m,to:b,preventScrollReset:v,viewTransition:N,unstable_defaultShouldRevalidate:L,...z},H){let{basename:B,navigator:q,unstable_useTransitions:Q}=T.useContext(At),X=typeof b=="string"&&pg.test(b),J=lg(b,B);b=J.to;let V=Yv(b,{relative:c}),ue=zt(),K=null;if(g){let De=Vu(g,[],ue.unstable_mask?ue.unstable_mask.pathname:"/",!0);B!=="/"&&(De.pathname=De.pathname==="/"?B:Qt([B,De.pathname])),K=q.createHref(De)}let[te,le,se]=R1(o,z),Ae=L1(b,{replace:h,unstable_mask:g,state:p,target:m,preventScrollReset:v,relative:c,viewTransition:N,unstable_defaultShouldRevalidate:L,unstable_useTransitions:Q});function Fe(De){l&&l(De),De.defaultPrevented||Ae(De)}let ze=!(J.isExternal||f),je=T.createElement("a",{...z,...se,href:(ze?K:void 0)||J.absoluteURL||V,onClick:ze?Fe:l,ref:z1(H,le),target:m,"data-discover":!X&&r==="render"?"true":void 0});return te&&!X?T.createElement(T.Fragment,null,je,T.createElement(_1,{page:V})):je});yg.displayName="Link";var jo=T.forwardRef(function({"aria-current":l="page",caseSensitive:r=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:g,children:p,...m},b){let v=fi(h,{relative:m.relative}),N=zt(),L=T.useContext(Ku),{navigator:z,basename:H}=T.useContext(At),B=L!=null&&B1(v)&&g===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,Q=N.pathname,X=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(Q=Q.toLowerCase(),X=X?X.toLowerCase():null,q=q.toLowerCase()),X&&H&&(X=ga(X,H)||X);const J=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=Q===q||!c&&Q.startsWith(q)&&Q.charAt(J)==="/",ue=X!=null&&(X===q||!c&&X.startsWith(q)&&X.charAt(q.length)==="/"),K={isActive:V,isPending:ue,isTransitioning:B},te=V?l:void 0,le;typeof o=="function"?le=o(K):le=[o,V?"active":null,ue?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let se=typeof f=="function"?f(K):f;return T.createElement(yg,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:g},typeof p=="function"?p(K):p)});jo.displayName="NavLink";var j1=T.forwardRef(({discover:i="render",fetcherKey:l,navigate:r,reloadDocument:o,replace:c,state:f,method:h=Mu,action:g,onSubmit:p,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N,...L},z)=>{let{unstable_useTransitions:H}=T.useContext(At),B=k1(),q=H1(g,{relative:m}),Q=h.toLowerCase()==="get"?"get":"post",X=typeof g=="string"&&pg.test(g),J=V=>{if(p&&p(V),V.defaultPrevented)return;V.preventDefault();let ue=V.nativeEvent.submitter,K=(ue==null?void 0:ue.getAttribute("formmethod"))||h,te=()=>B(ue||V.currentTarget,{fetcherKey:l,method:K,navigate:r,replace:c,state:f,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N});H&&r!==!1?T.startTransition(()=>te()):te()};return T.createElement("form",{ref:z,method:Q,action:q,onSubmit:o?p:J,...L,"data-discover":!X&&i==="render"?"true":void 0})});j1.displayName="Form";function M1(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vg(i){let l=T.useContext(tl);return Le(l,M1(i)),l}function L1(i,{target:l,replace:r,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let b=Qu(),v=zt(),N=fi(i,{relative:h});return T.useCallback(L=>{if(f1(L,l)){L.preventDefault();let z=r!==void 0?r:li(v)===li(N),H=()=>b(i,{replace:z,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p});m?T.startTransition(()=>H()):H()}},[v,b,N,r,o,c,l,i,f,h,g,p,m])}function t2(i){Ct(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let l=T.useRef(wo(i)),r=T.useRef(!1),o=zt(),c=T.useMemo(()=>d1(o.search,r.current?null:l.current),[o.search]),f=Qu(),h=T.useCallback((g,p)=>{const m=wo(typeof g=="function"?g(new URLSearchParams(c)):g);r.current=!0,f("?"+m,p)},[f,c]);return[c,h]}var D1=0,U1=()=>`__${String(++D1)}__`;function k1(){let{router:i}=vg("useSubmit"),{basename:l}=T.useContext(At),r=e1(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:p,encType:m,formData:b,body:v}=g1(f,l);if(h.navigate===!1){let N=h.fetcherKey||U1();await o(N,r,h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,replace:h.replace,state:h.state,fromRouteId:r,flushSync:h.flushSync,viewTransition:h.viewTransition})},[o,c,l,r])}function H1(i,{relative:l}={}){let{basename:r}=T.useContext(At),o=T.useContext(qt);Le(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...fi(i||".",{relative:l})},h=zt();if(i==null){f.search=h.search;let g=new URLSearchParams(f.search),p=g.getAll("index");if(p.some(b=>b==="")){g.delete("index"),p.filter(v=>v).forEach(v=>g.append("index",v));let b=g.toString();f.search=b?`?${b}`:""}}return(!i||i===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(f.pathname=f.pathname==="/"?r:Qt([r,f.pathname])),li(f)}function B1(i,{relative:l}={}){let r=T.useContext(rg);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=vg("useViewTransitionState"),c=fi(i,{relative:l});if(!r.isTransitioning)return!1;let f=ga(r.currentLocation.pathname,o)||r.currentLocation.pathname,h=ga(r.nextLocation.pathname,o)||r.nextLocation.pathname;return Uu(c.pathname,h)!=null||Uu(c.pathname,f)!=null}const bm=i=>{let l;const r=new Set,o=(m,b)=>{const v=typeof m=="function"?m(l):m;if(!Object.is(v,l)){const N=l;l=b??(typeof v!="object"||v===null)?v:Object.assign({},l,v),r.forEach(L=>L(l,N))}},c=()=>l,g={setState:o,getState:c,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=l=i(o,c,g);return g},q1=(i=>i?bm(i):bm),Y1=i=>i;function G1(i,l=Y1){const r=Pn.useSyncExternalStore(i.subscribe,Pn.useCallback(()=>l(i.getState()),[i,l]),Pn.useCallback(()=>l(i.getInitialState()),[i,l]));return Pn.useDebugValue(r),r}const Sm=i=>{const l=q1(i),r=o=>G1(l,o);return Object.assign(r,l),r},$o=(i=>i?Sm(i):Sm),xm="/api/v1";class V1{constructor(){In(this,"token","");In(this,"baseUrl",xm)}setToken(l){this.token=l}setBaseUrl(l){const r=l.trim();if(!r){this.baseUrl=xm;return}this.baseUrl=r.endsWith("/api/v1")?r:`${r.replace(/\/+$/,"")}/api/v1`}getToken(){return this.token}getBaseUrl(){return this.baseUrl}headers(){const l={"Content-Type":"application/json"};return this.token&&(l.Authorization=`Bearer ${this.token}`),l}async request(l,r,o,c){let f=this.resolveUrl(r);if(c){const p=new URLSearchParams(c).toString();p&&(f+=`?${p}`)}const h=await fetch(f,{method:l,headers:this.headers(),body:o?JSON.stringify(o):void 0}),g=await h.json();if(!g.ok)throw new K1(g.error||"Unknown error",h.status);return g.data}get(l,r){return this.request("GET",l,void 0,r)}post(l,r){return this.request("POST",l,r)}patch(l,r){return this.request("PATCH",l,r)}delete(l){return this.request("DELETE",l)}resolveUrl(l){const r=l.replace(/^\/+/,"");return this.baseUrl.startsWith("http://")||this.baseUrl.startsWith("https://")?new URL(r,`${this.baseUrl}/`).toString():`${this.baseUrl}/${r}`.replace(/([^:]\/)\/+/g,"$1")}}class K1 extends Error{constructor(l,r){super(l),this.status=r,this.name="ApiError"}}const Xe=new V1,Ot=$o(i=>({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none",login:(l,r)=>{Xe.setToken(l),r&&Xe.setBaseUrl(r),localStorage.setItem("cc_token",l),r&&localStorage.setItem("cc_server_url",r),i({token:l,serverUrl:r||"",isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"})},setManagedSession:(l,r,o)=>{Xe.setToken(l),Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!0,managedBy:o})},setDesktopSession:(l,r)=>{Ot.getState().setManagedSession(l,r,"electron")},logout:()=>{Ot.getState().desktopManaged||(Xe.setToken(""),Xe.setBaseUrl(""),localStorage.removeItem("cc_token"),localStorage.removeItem("cc_server_url"),i({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none"}))},init:()=>{const l=localStorage.getItem("cc_token")||"",r=localStorage.getItem("cc_server_url")||"";l&&(Xe.setToken(l),r&&Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"}))}})),Q1=(i,l,r,o)=>{var f,h,g,p;const c=[r,{code:l,...o||{}}];if((h=(f=i==null?void 0:i.services)==null?void 0:f.logger)!=null&&h.forward)return i.services.logger.forward(c,"warn","react-i18next::",!0);fn(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),(p=(g=i==null?void 0:i.services)==null?void 0:g.logger)!=null&&p.warn?i.services.logger.warn(...c):console!=null&&console.warn&&console.warn(...c)},Em={},Mo=(i,l,r,o)=>{fn(r)&&Em[r]||(fn(r)&&(Em[r]=new Date),Q1(i,l,r,o))},bg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},Lo=(i,l,r)=>{i.loadNamespaces(l,bg(i,r))},Tm=(i,l,r,o)=>{if(fn(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return Lo(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,bg(i,o))},X1=(i,l,r={})=>!l.languages||!l.languages.length?(Mo(l,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:l.languages}),!0):l.hasLoadedNamespace(i,{lng:r.lng,precheck:(o,c)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,i))return!1}}),fn=i=>typeof i=="string",Z1=i=>typeof i=="object"&&i!==null,$1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,J1={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},F1=i=>J1[i],W1=i=>i.replace($1,F1);let Do={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:W1};const I1=(i={})=>{Do={...Do,...i}},P1=()=>Do;let Sg;const eb=i=>{Sg=i},tb=()=>Sg,ab={type:"3rdParty",init(i){I1(i.options.react),eb(i)}},nb=T.createContext();class lb{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ib=(i,l)=>{const r=T.useRef();return T.useEffect(()=>{r.current=i},[i,l]),r.current},xg=(i,l,r,o)=>i.getFixedT(l,r,o),ub=(i,l,r,o)=>T.useCallback(xg(i,l,r,o),[i,l,r,o]),Eg=(i,l={})=>{var J,V,ue,K;const{i18n:r}=l,{i18n:o,defaultNS:c}=T.useContext(nb)||{},f=r||o||tb();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new lb),!f){Mo(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const te=(se,Ae)=>fn(Ae)?Ae:Z1(Ae)&&fn(Ae.defaultValue)?Ae.defaultValue:Array.isArray(se)?se[se.length-1]:se,le=[te,{},!1];return le.t=te,le.i18n={},le.ready=!1,le}(J=f.options.react)!=null&&J.wait&&Mo(f,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const h={...P1(),...f.options.react,...l},{useSuspense:g,keyPrefix:p}=h;let m=c||((V=f.options)==null?void 0:V.defaultNS);m=fn(m)?[m]:m||["translation"],(K=(ue=f.reportNamespaces).addUsedNamespaces)==null||K.call(ue,m);const b=(f.isInitialized||f.initializedStoreOnce)&&m.every(te=>X1(te,f,h)),v=ub(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),N=()=>v,L=()=>xg(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),[z,H]=T.useState(N);let B=m.join();l.lng&&(B=`${l.lng}${B}`);const q=ib(B),Q=T.useRef(!0);T.useEffect(()=>{const{bindI18n:te,bindI18nStore:le}=h;Q.current=!0,!b&&!g&&(l.lng?Tm(f,l.lng,m,()=>{Q.current&&H(L)}):Lo(f,m,()=>{Q.current&&H(L)})),b&&q&&q!==B&&Q.current&&H(L);const se=()=>{Q.current&&H(L)};return te&&(f==null||f.on(te,se)),le&&(f==null||f.store.on(le,se)),()=>{Q.current=!1,f&&te&&(te==null||te.split(" ").forEach(Ae=>f.off(Ae,se))),le&&f&&le.split(" ").forEach(Ae=>f.store.off(Ae,se))}},[f,B]),T.useEffect(()=>{Q.current&&b&&H(N)},[f,p,b]);const X=[z,f,b];if(X.t=z,X.i18n=f,X.ready=b,b||!b&&!g)return X;throw new Promise(te=>{l.lng?Tm(f,l.lng,m,()=>te()):Lo(f,m,()=>te())})};function Tg(i){var l,r,o="";if(typeof i=="string"||typeof i=="number")o+=i;else if(typeof i=="object")if(Array.isArray(i)){var c=i.length;for(l=0;l<c;l++)i[l]&&(r=Tg(i[l]))&&(o&&(o+=" "),o+=r)}else for(r in i)i[r]&&(o&&(o+=" "),o+=r);return o}function rb(){for(var i,l,r=0,o="",c=arguments.length;r<c;r++)(i=arguments[r])&&(l=Tg(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return rb(i)}function a2(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const Jo=$o(i=>({snapshot:null,setSnapshot:l=>i({snapshot:l})}));function dn(){return ii}function To(i){ii=i}function sb(){return ii==="electron"}function ob(){return!1}function Ro(i){Jo.getState().setSnapshot(i)}function cb(){return Jo.getState().snapshot}function fb(i){return!!(i!=null&&i.knowledge.some(l=>l.enabled!==!1))}function db(i){return!!(i!=null&&i.schedulers.some(l=>l.enabled!==!1))}function hb(i,l){return!!(i!=null&&i.agents.some(r=>r.agentType===l))}function mb(i){return!!(i!=null&&i.agents.some(l=>l.agentType))}function gb(i=cb()){const l=!!i,r=hb(i,"localcore-acp");return{desktopRuntime:l||ii==="electron"||ii==="local_core",desktopChat:r,chatRoute:l?r:!0,desktopWorkspace:l?mb(i):!0,knowledgeModule:l?fb(i):!0,schedulerModule:l?db(i):!0}}function Fo(){const i=Jo(l=>l.snapshot);return gb(i)}function Rm(i){return i==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i}function _m(i){document.documentElement.classList.toggle("dark",i==="dark")}const Wo=$o(i=>({theme:"dark",resolved:"dark",setTheme:l=>{const r=Rm(l);localStorage.setItem("cc_theme",l),_m(r),i({theme:l,resolved:r})},init:()=>{const l=localStorage.getItem("cc_theme")||"dark",r=Rm(l);_m(r),i({theme:l,resolved:r})}})),pb="modulepreload",yb=function(i,l){return new URL(i,l).href},Cm={},Pe=function(l,r,o){let c=Promise.resolve();if(r&&r.length>0){let h=function(b){return Promise.all(b.map(v=>Promise.resolve(v).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};const g=document.getElementsByTagName("link"),p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=h(r.map(b=>{if(b=yb(b,o),b in Cm)return;Cm[b]=!0;const v=b.endsWith(".css"),N=v?'[rel="stylesheet"]':"";if(!!o)for(let H=g.length-1;H>=0;H--){const B=g[H];if(B.href===b&&(!v||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${N}`))return;const z=document.createElement("link");if(z.rel=v?"stylesheet":pb,v||(z.as="script"),z.crossOrigin="",z.href=b,m&&z.setAttribute("nonce",m),document.head.appendChild(z),v)return new Promise((H,B)=>{z.addEventListener("load",H),z.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${b}`)))})}))}function f(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return c.then(h=>{for(const g of h||[])g.status==="rejected"&&f(g.reason);return l().catch(f)})},vb=T.lazy(()=>Pe(()=>import("./Dashboard-C0_ATyGe.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),bb=T.lazy(()=>Pe(()=>import("./ThreadChat-DxBmdsAm.js"),__vite__mapDeps([9,10,11,5,12,13,14,15,16,17,8,18,19,20,21,22]),import.meta.url)),Sb=T.lazy(()=>Pe(()=>import("./Chat-Dzeq3kiD.js"),__vite__mapDeps([23,10,11,2,14,15,4,24,12,20,21,22,17]),import.meta.url)),xb=T.lazy(()=>Pe(()=>import("./Workspace-DFphG85O.js"),__vite__mapDeps([25,10,11,26,18,15,2,3,5,13,22,27,28]),import.meta.url)),Eb=T.lazy(()=>Pe(()=>import("./ProjectList-Cyr8RDK3.js"),__vite__mapDeps([29,1,2,3,4,6,30]),import.meta.url)),Tb=T.lazy(()=>Pe(()=>import("./ProjectDetail-RF_sagPO.js"),__vite__mapDeps([31,1,10,11,2,3,4,32,30,33,27,15,22,34]),import.meta.url)),Rb=T.lazy(()=>Pe(()=>import("./SessionList-DNwZjGTv.js"),__vite__mapDeps([35,1,26,11,18,15,2,4,24,36,16,17]),import.meta.url)),_b=T.lazy(()=>Pe(()=>import("./SessionChat-_HhzMwEO.js"),__vite__mapDeps([37,1,24,14,15,32,16,19,17]),import.meta.url)),Cb=T.lazy(()=>Pe(()=>import("./CronList-Dic7pblj.js"),__vite__mapDeps([38,1,10,11,26,18,15,2,3,27,34,21,22]),import.meta.url)),Ob=T.lazy(()=>Pe(()=>import("./Config-BI4LJ7Fw.js"),__vite__mapDeps([39,5,1,3,28,33]),import.meta.url)),Ab=T.lazy(()=>Pe(()=>import("./Logs-C2Jdr3uQ.js"),__vite__mapDeps([40,1,26,11,18,15,3,32,36]),import.meta.url)),zb=T.lazy(()=>Pe(()=>import("./KnowledgeHome-L0tsg-oo.js"),__vite__mapDeps([41,10,11,2,21,22,20,27,7]),import.meta.url)),Nb=T.lazy(()=>Pe(()=>import("./KnowledgeDetail-D4yUJzp7.js"),__vite__mapDeps([42,2,32,20,22]),import.meta.url));class wb{constructor(){In(this,"routes",new Map);In(this,"navItems",new Map)}registerRoute(l){this.routes.set(l.id,l)}registerNavItem(l){this.navItems.set(l.id,l)}listRoutes(){return[...this.routes.values()].sort((l,r)=>l.order-r.order)}listNavItems(){return[...this.navItems.values()].sort((l,r)=>l.order-r.order)}}function Pl(i,l,r="/"){return i?l:_.jsx(Ya,{to:r,replace:!0})}function jb(){const{name:i}=fg();return Ot(r=>r.desktopManaged)?_.jsx(Ya,{to:i?`/workspace?project=${encodeURIComponent(i)}`:"/workspace",replace:!0}):_.jsx(Tb,{})}function Om(){const{project:i,id:l}=fg();if(!Ot(c=>c.desktopManaged))return l&&i?_.jsx(_b,{}):_.jsx(Rb,{});const o=new URLSearchParams;return i&&o.set("project",i),l&&o.set("session",l),_.jsx(Ya,{to:`/chat${o.toString()?`?${o.toString()}`:""}`,replace:!0})}function Mb(i){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>_.jsx(vb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:r})=>Pl(r.chatRoute,r.desktopChat?_.jsx(bb,{}):_.jsx(Sb,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:r})=>Pl(r.desktopWorkspace,_.jsx(xb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(zb,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(Nb,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({desktopManaged:r,features:o})=>r&&o.desktopWorkspace?_.jsx(Ya,{to:"/workspace",replace:!0}):_.jsx(Eb,{})},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>_.jsx(jb,{})},{id:"sessions",path:"sessions",titleKey:"nav.sessions",order:60,element:()=>_.jsx(Om,{})},{id:"session-detail",path:"sessions/:project/:id",titleKey:"nav.sessions",order:61,element:()=>_.jsx(Om,{})},{id:"cron",path:"cron",titleKey:"nav.cron",order:70,element:({features:r})=>Pl(r.schedulerModule,_.jsx(Cb,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>_.jsx(Ob,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>_.jsx(Ab,{})}].forEach(r=>i.registerRoute(r))}function Lb(i){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:j0,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:q0,order:20,visible:({features:r})=>r.chatRoute,resolveLabelKey:({features:r,runtimeProvider:o})=>r.desktopChat?o==="electron"?"nav.chatDesktop":"nav.chat":"nav.chatWeb"},{id:"workspace",path:"/workspace",labelKey:"nav.workspace",icon:F0,order:30,visible:({features:r})=>r.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:L0,order:40,visible:({features:r})=>r.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:A0,order:50,visible:({desktopManaged:r})=>!r},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:H0,order:60,visible:({desktopManaged:r})=>!r},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:C0,order:70,visible:({features:r})=>r.schedulerModule},{id:"system",path:"/system",labelKey:"nav.system",icon:Q0,order:80}].forEach(r=>i.registerNavItem(r))}const Zu=new wb;Mb(Zu);Lb(Zu);function Rg({className:i,markClassName:l,showWordmark:r=!1}){const o=T.useId(),c=`${o}-bg`,f=`${o}-stroke`;return _.jsxs("div",{className:He("inline-flex items-center gap-3",i),children:[_.jsxs("svg",{className:He("h-8 w-8 shrink-0",l),viewBox:"0 0 64 64",role:"img","aria-label":"AgentDock",fill:"none",children:[_.jsxs("defs",{children:[_.jsxs("linearGradient",{id:c,x1:"7",y1:"5",x2:"57",y2:"59",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{className:"[stop-color:#FFFFFF] dark:[stop-color:#3A3A3C]"}),_.jsx("stop",{offset:"0.52",className:"[stop-color:#F5F5F7] dark:[stop-color:#2C2C2E]"}),_.jsx("stop",{offset:"1",className:"[stop-color:#E5E5EA] dark:[stop-color:#1C1C1E]"})]}),_.jsxs("linearGradient",{id:f,x1:"18",y1:"16",x2:"47",y2:"48",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{stopColor:"#5AC8FA"}),_.jsx("stop",{offset:"0.44",stopColor:"#0A84FF"}),_.jsx("stop",{offset:"1",stopColor:"#007AFF"})]})]}),_.jsx("rect",{x:"4",y:"4",width:"56",height:"56",rx:"16",fill:`url(#${c})`,className:"stroke-black/10 dark:stroke-white/10",strokeWidth:"1.5"}),_.jsx("path",{d:"M14.5 45L25.3 20.1C26.1 18.1 28.9 18.1 29.8 20.1L40.8 45",stroke:`url(#${f})`,strokeWidth:"7.5",strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M20.8 37.5H34.7",className:"stroke-white dark:stroke-white",strokeWidth:"5.25",strokeLinecap:"round"}),_.jsx("path",{d:"M33.8 20.2H37.4C45.1 20.2 50 25.6 50 32.5C50 39.4 45.1 44.8 37.4 44.8H33.8",stroke:`url(#${f})`,strokeWidth:"7",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.82"}),_.jsx("path",{d:"M34 25.5V39.5",className:"stroke-black/70 dark:stroke-black/80",strokeWidth:"3",strokeLinecap:"round",opacity:"0.18"})]}),r&&_.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"AgentDock"})]})}var _o={};const ae=i=>typeof i=="string",ei=()=>{let i,l;const r=new Promise((o,c)=>{i=o,l=c});return r.resolve=i,r.reject=l,r},Am=i=>i==null?"":""+i,Db=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},Ub=/###/g,zm=i=>i&&i.indexOf("###")>-1?i.replace(Ub,"."):i,Nm=i=>!i||ae(i),ti=(i,l,r)=>{const o=ae(l)?l.split("."):l;let c=0;for(;c<o.length-1;){if(Nm(i))return{};const f=zm(o[c]);!i[f]&&r&&(i[f]=new r),Object.prototype.hasOwnProperty.call(i,f)?i=i[f]:i={},++c}return Nm(i)?{}:{obj:i,k:zm(o[c])}},wm=(i,l,r)=>{const{obj:o,k:c}=ti(i,l,Object);if(o!==void 0||l.length===1){o[c]=r;return}let f=l[l.length-1],h=l.slice(0,l.length-1),g=ti(i,h,Object);for(;g.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),g=ti(i,h,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${f}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${f}`]=r},kb=(i,l,r,o)=>{const{obj:c,k:f}=ti(i,l,Object);c[f]=c[f]||[],c[f].push(r)},Hu=(i,l)=>{const{obj:r,k:o}=ti(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},Hb=(i,l,r)=>{const o=Hu(i,r);return o!==void 0?o:Hu(l,r)},_g=(i,l,r)=>{for(const o in l)o!=="__proto__"&&o!=="constructor"&&(o in i?ae(i[o])||i[o]instanceof String||ae(l[o])||l[o]instanceof String?r&&(i[o]=l[o]):_g(i[o],l[o],r):i[o]=l[o]);return i},sn=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Bb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const qb=i=>ae(i)?i.replace(/[&<>"'\/]/g,l=>Bb[l]):i;class Yb{constructor(l){this.capacity=l,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(l){const r=this.regExpMap.get(l);if(r!==void 0)return r;const o=new RegExp(l);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(l,o),this.regExpQueue.push(l),o}}const Gb=[" ",",","?","!",";"],Vb=new Yb(20),Kb=(i,l,r)=>{l=l||"",r=r||"";const o=Gb.filter(h=>l.indexOf(h)<0&&r.indexOf(h)<0);if(o.length===0)return!0;const c=Vb.getRegExp(`(${o.map(h=>h==="?"?"\\?":h).join("|")})`);let f=!c.test(i);if(!f){const h=i.indexOf(r);h>0&&!c.test(i.substring(0,h))&&(f=!0)}return f},Uo=(i,l,r=".")=>{if(!i)return;if(i[l])return Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;const o=l.split(r);let c=i;for(let f=0;f<o.length;){if(!c||typeof c!="object")return;let h,g="";for(let p=f;p<o.length;++p)if(p!==f&&(g+=r),g+=o[p],h=c[g],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&p<o.length-1)continue;f+=p-f+1;break}c=h}return c},ui=i=>i==null?void 0:i.replace(/_/g,"-"),Qb={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,l){var r,o;(o=(r=console==null?void 0:console[i])==null?void 0:r.apply)==null||o.call(r,console,l)}};class Bu{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||Qb,this.options=r,this.debug=r.debug}log(...l){return this.forward(l,"log","",!0)}warn(...l){return this.forward(l,"warn","",!0)}error(...l){return this.forward(l,"error","")}deprecate(...l){return this.forward(l,"warn","WARNING DEPRECATED: ",!0)}forward(l,r,o,c){return c&&!this.debug?null:(ae(l[0])&&(l[0]=`${o}${this.prefix} ${l[0]}`),this.logger[r](l))}create(l){return new Bu(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new Bu(this.logger,l)}}var Ft=new Bu;class $u{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[l,...r])})}}class jm extends $u{constructor(l,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=l||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(l){this.options.ns.indexOf(l)<0&&this.options.ns.push(l)}removeNamespaces(l){const r=this.options.ns.indexOf(l);r>-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;l.indexOf(".")>-1?g=l.split("."):(g=[l,r],o&&(Array.isArray(o)?g.push(...o):ae(o)&&f?g.push(...o.split(f)):g.push(o)));const p=Hu(this.data,g);return!p&&!r&&!o&&l.indexOf(".")>-1&&(l=g[0],r=g[1],o=g.slice(2).join(".")),p||!h||!ae(o)?p:Uo((b=(m=this.data)==null?void 0:m[l])==null?void 0:b[r],o,f)}addResource(l,r,o,c,f={silent:!1}){const h=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let g=[l,r];o&&(g=g.concat(h?o.split(h):o)),l.indexOf(".")>-1&&(g=l.split("."),c=r,r=g[1]),this.addNamespaces(r),wm(this.data,g,c),f.silent||this.emit("added",l,r,o,c)}addResources(l,r,o,c={silent:!1}){for(const f in o)(ae(o[f])||Array.isArray(o[f]))&&this.addResource(l,r,f,o[f],{silent:!0});c.silent||this.emit("added",l,r,o)}addResourceBundle(l,r,o,c,f,h={silent:!1,skipCopy:!1}){let g=[l,r];l.indexOf(".")>-1&&(g=l.split("."),c=o,o=r,r=g[1]),this.addNamespaces(r);let p=Hu(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?_g(p,o,f):p={...p,...o},wm(this.data,g,p),h.silent||this.emit("added",l,r,o)}removeResourceBundle(l,r){this.hasResourceBundle(l,r)&&delete this.data[l][r],this.removeNamespaces(r),this.emit("removed",l,r)}hasResourceBundle(l,r){return this.getResource(l,r)!==void 0}getResourceBundle(l,r){return r||(r=this.options.defaultNS),this.getResource(l,r)}getDataByLanguage(l){return this.data[l]}hasLanguageSomeTranslations(l){const r=this.getDataByLanguage(l);return!!(r&&Object.keys(r)||[]).find(c=>r[c]&&Object.keys(r[c]).length>0)}toJSON(){return this.data}}var Cg={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,l,r,o,c){return i.forEach(f=>{var h;l=((h=this.processors[f])==null?void 0:h.process(l,r,o,c))??l}),l}};const Og=Symbol("i18next/PATH_KEY");function Xb(){const i=[],l=Object.create(null);let r;return l.get=(o,c)=>{var f;return(f=r==null?void 0:r.revoke)==null||f.call(r),c===Og?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)},Proxy.revocable(Object.create(null),l).proxy}function el(i,l){const{[Og]:r}=i(Xb()),o=(l==null?void 0:l.keySeparator)??".",c=(l==null?void 0:l.nsSeparator)??":";if(r.length>1&&c){const f=l==null?void 0:l.ns,h=Array.isArray(f)?f:null;if(h&&h.length>1&&h.slice(1).includes(r[0]))return`${r[0]}${c}${r.slice(1).join(o)}`}return r.join(o)}const Mm={},Co=i=>!ae(i)&&typeof i!="boolean"&&typeof i!="number";class qu extends $u{constructor(l,r={}){super(),Db(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],l,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ft.create("translator")}changeLanguage(l){l&&(this.language=l)}exists(l,r={interpolation:{}}){const o={...r};if(l==null)return!1;const c=this.resolve(l,o);if((c==null?void 0:c.res)===void 0)return!1;const f=Co(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(l,r){let o=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let f=r.ns||this.options.defaultNS||[];const h=o&&l.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Kb(l,o,c);if(h&&!g){const p=l.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:l,namespaces:ae(f)?[f]:f};const m=l.split(o);(o!==c||o===c&&this.options.ns.indexOf(m[0])>-1)&&(f=m.shift()),l=m.join(c)}return{key:l,namespaces:ae(f)?[f]:f}}translate(l,r,o){let c=typeof r=="object"?{...r}:r;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),l==null)return"";typeof l=="function"&&(l=el(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]),l=l.map(ze=>typeof ze=="function"?el(ze,{...this.options,...c}):String(ze));const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,h=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:p}=this.extractFromKey(l[l.length-1],c),m=p[p.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const v=c.lng||this.language,N=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((v==null?void 0:v.toLowerCase())==="cimode")return N?f?{res:`${m}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${g}`:f?{res:g,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:g;const L=this.resolve(l,c);let z=L==null?void 0:L.res;const H=(L==null?void 0:L.usedKey)||g,B=(L==null?void 0:L.exactUsedKey)||g,q=["[object Number]","[object Function]","[object RegExp]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,X=!this.i18nFormat||this.i18nFormat.handleAsObject,J=c.count!==void 0&&!ae(c.count),V=qu.hasDefaultValue(c),ue=J?this.pluralResolver.getSuffix(v,c.count,c):"",K=c.ordinal&&J?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",te=J&&!c.ordinal&&c.count===0,le=te&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${ue}`]||c[`defaultValue${K}`]||c.defaultValue;let se=z;X&&!z&&V&&(se=le);const Ae=Co(se),Fe=Object.prototype.toString.apply(se);if(X&&se&&Ae&&q.indexOf(Fe)<0&&!(ae(Q)&&Array.isArray(se))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ze=this.options.returnedObjectHandler?this.options.returnedObjectHandler(H,se,{...c,ns:p}):`key '${g} (${this.language})' returned an object instead of string.`;return f?(L.res=ze,L.usedParams=this.getUsedParamsDetails(c),L):ze}if(h){const ze=Array.isArray(se),je=ze?[]:{},De=ze?B:H;for(const j in se)if(Object.prototype.hasOwnProperty.call(se,j)){const Y=`${De}${h}${j}`;V&&!z?je[j]=this.translate(Y,{...c,defaultValue:Co(le)?le[j]:void 0,joinArrays:!1,ns:p}):je[j]=this.translate(Y,{...c,joinArrays:!1,ns:p}),je[j]===Y&&(je[j]=se[j])}z=je}}else if(X&&ae(Q)&&Array.isArray(z))z=z.join(Q),z&&(z=this.extendTranslation(z,l,c,o));else{let ze=!1,je=!1;!this.isValidLookup(z)&&V&&(ze=!0,z=le),this.isValidLookup(z)||(je=!0,z=g);const j=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&je?void 0:z,Y=V&&le!==z&&this.options.updateMissing;if(je||ze||Y){if(this.logger.log(Y?"updateKey":"missingKey",v,m,g,Y?le:z),h){const x=this.resolve(g,{...c,keySeparator:!1});x&&x.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let P=[];const pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(let x=0;x<pe.length;x++)P.push(pe[x]);else this.options.saveMissingTo==="all"?P=this.languageUtils.toResolveHierarchy(c.lng||this.language):P.push(c.lng||this.language);const Se=(x,D,G)=>{var ne;const Z=V&&G!==z?G:j;this.options.missingKeyHandler?this.options.missingKeyHandler(x,m,D,Z,Y,c):(ne=this.backendConnector)!=null&&ne.saveMissing&&this.backendConnector.saveMissing(x,m,D,Z,Y,c),this.emit("missingKey",x,m,D,z)};this.options.saveMissing&&(this.options.saveMissingPlurals&&J?P.forEach(x=>{const D=this.pluralResolver.getSuffixes(x,c);te&&c[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(G=>{Se([x],g+G,c[`defaultValue${G}`]||le)})}):Se(P,g,le))}z=this.extendTranslation(z,l,c,L,o),je&&z===g&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${g}`),(je||ze)&&this.options.parseMissingKeyHandler&&(z=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${g}`:g,ze?z:void 0,c))}return f?(L.res=z,L.usedParams=this.getUsedParamsDetails(c),L):z}extendTranslation(l,r,o,c,f){var p,m;if((p=this.i18nFormat)!=null&&p.parse)l=this.i18nFormat.parse(l,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=ae(l)&&(((m=o==null?void 0:o.interpolation)==null?void 0:m.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(b){const L=l.match(this.interpolator.nestingRegexp);v=L&&L.length}let N=o.replace&&!ae(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(N={...this.options.interpolation.defaultVariables,...N}),l=this.interpolator.interpolate(l,N,o.lng||this.language||c.usedLng,o),b){const L=l.match(this.interpolator.nestingRegexp),z=L&&L.length;v<z&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(l=this.interpolator.nest(l,(...L)=>(f==null?void 0:f[0])===L[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${L[0]} in key: ${r[0]}`),null):this.translate(...L,r),o)),o.interpolation&&this.interpolator.reset()}const h=o.postProcess||this.options.postProcess,g=ae(h)?[h]:h;return l!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(l=Cg.handle(g,l,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),l}resolve(l,r={}){let o,c,f,h,g;return ae(l)&&(l=[l]),Array.isArray(l)&&(l=l.map(p=>typeof p=="function"?el(p,{...this.options,...r}):p)),l.forEach(p=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(p,r),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const N=r.count!==void 0&&!ae(r.count),L=N&&!r.ordinal&&r.count===0,z=r.context!==void 0&&(ae(r.context)||typeof r.context=="number")&&r.context!=="",H=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);v.forEach(B=>{var q,Q;this.isValidLookup(o)||(g=B,!Mm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((Q=this.utils)!=null&&Q.hasLoadedNamespace(g))&&(Mm[`${H[0]}-${B}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),H.forEach(X=>{var ue;if(this.isValidLookup(o))return;h=X;const J=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(J,b,X,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix(X,r.count,r));const te=`${this.options.pluralSeparator}zero`,le=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(N&&(r.ordinal&&K.indexOf(le)===0&&J.push(b+K.replace(le,this.options.pluralSeparator)),J.push(b+K),L&&J.push(b+te)),z){const se=`${b}${this.options.contextSeparator||"_"}${r.context}`;J.push(se),N&&(r.ordinal&&K.indexOf(le)===0&&J.push(se+K.replace(le,this.options.pluralSeparator)),J.push(se+K),L&&J.push(se+te))}}let V;for(;V=J.pop();)this.isValidLookup(o)||(f=V,o=this.getResource(X,B,V,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:g}}isValidLookup(l){return l!==void 0&&!(!this.options.returnNull&&l===null)&&!(!this.options.returnEmptyString&&l==="")}getResource(l,r,o,c={}){var f;return(f=this.i18nFormat)!=null&&f.getResource?this.i18nFormat.getResource(l,r,o,c):this.resourceStore.getResource(l,r,o,c)}getUsedParamsDetails(l={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=l.replace&&!ae(l.replace);let c=o?l.replace:l;if(o&&typeof l.count<"u"&&(c.count=l.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of r)delete c[f]}return c}static hasDefaultValue(l){const r="defaultValue";for(const o in l)if(Object.prototype.hasOwnProperty.call(l,o)&&r===o.substring(0,r.length)&&l[o]!==void 0)return!0;return!1}}class Lm{constructor(l){this.options=l,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ft.create("languageUtils")}getScriptPartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return null;const r=l.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return l;const r=l.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(l){if(ae(l)&&l.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(l)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?l.toLowerCase():l)}return this.options.cleanCode||this.options.lowerCaseLng?l.toLowerCase():l}isSupportedCode(l){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(l=this.getLanguagePartFromCode(l)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(l)>-1}getBestMatchFromCodes(l){if(!l)return null;let r;return l.forEach(o=>{if(r)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(r=c)}),!r&&this.options.supportedLngs&&l.forEach(o=>{if(r)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return r=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return r=f;r=this.options.supportedLngs.find(h=>{if(h===f)return h;if(!(h.indexOf("-")<0&&f.indexOf("-")<0)&&(h.indexOf("-")>0&&f.indexOf("-")<0&&h.substring(0,h.indexOf("-"))===f||h.indexOf(f)===0&&f.length>1))return h})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(l,r){if(!l)return[];if(typeof l=="function"&&(l=l(r)),ae(l)&&(l=[l]),Array.isArray(l))return l;if(!r)return l.default||[];let o=l[r];return o||(o=l[this.getScriptPartFromCode(r)]),o||(o=l[this.formatLanguageCode(r)]),o||(o=l[this.getLanguagePartFromCode(r)]),o||(o=l.default),o||[]}toResolveHierarchy(l,r){const o=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],l),c=[],f=h=>{h&&(this.isSupportedCode(h)?c.push(h):this.logger.warn(`rejecting language code not found in supportedLngs: ${h}`))};return ae(l)&&(l.indexOf("-")>-1||l.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(l)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(l)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(l))):ae(l)&&f(this.formatLanguageCode(l)),o.forEach(h=>{c.indexOf(h)<0&&f(this.formatLanguageCode(h))}),c}}const Dm={zero:0,one:1,two:2,few:3,many:4,other:5},Um={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Zb{constructor(l,r={}){this.languageUtils=l,this.options=r,this.logger=Ft.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(l,r={}){const o=ui(l==="dev"?"en":l),c=r.ordinal?"ordinal":"cardinal",f=JSON.stringify({cleanedCode:o,type:c});if(f in this.pluralRulesCache)return this.pluralRulesCache[f];let h;try{h=new Intl.PluralRules(o,{type:c})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Um;if(!l.match(/-|_/))return Um;const p=this.languageUtils.getLanguagePartFromCode(l);h=this.getRule(p,r)}return this.pluralRulesCache[f]=h,h}needsPlural(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(l,r,o={}){return this.getSuffixes(l,o).map(c=>`${r}${c}`)}getSuffixes(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Dm[c]-Dm[f]).map(c=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(l,r,o={}){const c=this.getRule(l,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(r)}`:(this.logger.warn(`no plural rule found for: ${l}`),this.getSuffix("dev",r,o))}}const km=(i,l,r,o=".",c=!0)=>{let f=Hb(i,l,r);return!f&&c&&ae(r)&&(f=Uo(i,r,o),f===void 0&&(f=Uo(l,r,o))),f},Oo=i=>i.replace(/\$/g,"$$$$");class Hm{constructor(l={}){var r;this.logger=Ft.create("interpolator"),this.options=l,this.format=((r=l==null?void 0:l.interpolation)==null?void 0:r.format)||(o=>o),this.init(l)}init(l={}){l.interpolation||(l.interpolation={escapeValue:!0});const{escape:r,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:h,suffix:g,suffixEscaped:p,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:N,nestingPrefixEscaped:L,nestingSuffix:z,nestingSuffixEscaped:H,nestingOptionsSeparator:B,maxReplaces:q,alwaysFormat:Q}=l.interpolation;this.escape=r!==void 0?r:qb,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?sn(f):h||"{{",this.suffix=g?sn(g):p||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=N?sn(N):L||sn("$t("),this.nestingSuffix=z?sn(z):H||sn(")"),this.nestingOptionsSeparator=B||",",this.maxReplaces=q||1e3,this.alwaysFormat=Q!==void 0?Q:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const l=(r,o)=>(r==null?void 0:r.source)===o?(r.lastIndex=0,r):new RegExp(o,"g");this.regexp=l(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=l(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=l(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(l,r,o,c){var L;let f,h,g;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=z=>{if(z.indexOf(this.formatSeparator)<0){const Q=km(r,p,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(Q,void 0,o,{...c,...r,interpolationkey:z}):Q}const H=z.split(this.formatSeparator),B=H.shift().trim(),q=H.join(this.formatSeparator).trim();return this.format(km(r,p,B,this.options.keySeparator,this.options.ignoreJSONStructure),q,o,{...c,...r,interpolationkey:B})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,v=((L=c==null?void 0:c.interpolation)==null?void 0:L.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:z=>Oo(z)},{regex:this.regexp,safeValue:z=>this.escapeValue?Oo(this.escape(z)):Oo(z)}].forEach(z=>{for(g=0;f=z.regex.exec(l);){const H=f[1].trim();if(h=m(H),h===void 0)if(typeof b=="function"){const q=b(l,f,c);h=ae(q)?q:""}else if(c&&Object.prototype.hasOwnProperty.call(c,H))h="";else if(v){h=f[0];continue}else this.logger.warn(`missed to pass in variable ${H} for interpolating ${l}`),h="";else!ae(h)&&!this.useRawValueToEscape&&(h=Am(h));const B=z.safeValue(h);if(l=l.replace(f[0],B),v?(z.regex.lastIndex+=h.length,z.regex.lastIndex-=f[0].length):z.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,h;const g=(p,m)=>{const b=this.nestingOptionsSeparator;if(p.indexOf(b)<0)return p;const v=p.split(new RegExp(`${sn(b)}[ ]*{`));let N=`{${v[1]}`;p=v[0],N=this.interpolate(N,h);const L=N.match(/'/g),z=N.match(/"/g);(((L==null?void 0:L.length)??0)%2===0&&!z||((z==null?void 0:z.length)??0)%2!==0)&&(N=N.replace(/'/g,'"'));try{h=JSON.parse(N),m&&(h={...m,...h})}catch(H){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,H),`${p}${b}${N}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,p};for(;c=this.nestingRegexp.exec(l);){let p=[];h={...o},h=h.replace&&!ae(h.replace)?h.replace:h,h.applyPostProcessor=!1,delete h.defaultValue;const m=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(m!==-1&&(p=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=r(g.call(this,c[1].trim(),h),h),f&&c[0]===l&&!ae(f))return f;ae(f)||(f=Am(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${l}`),f=""),p.length&&(f=p.reduce((b,v)=>this.format(b,v,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),l=l.replace(c[0],f),this.regexp.lastIndex=0}return l}}const $b=i=>{let l=i.toLowerCase().trim();const r={};if(i.indexOf("(")>-1){const o=i.split("(");l=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);l==="currency"&&c.indexOf(":")<0?r.currency||(r.currency=c.trim()):l==="relativetime"&&c.indexOf(":")<0?r.range||(r.range=c.trim()):c.split(";").forEach(h=>{if(h){const[g,...p]=h.split(":"),m=p.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();r[b]||(r[b]=m),m==="false"&&(r[b]=!1),m==="true"&&(r[b]=!0),isNaN(m)||(r[b]=parseInt(m,10))}})}return{formatName:l,formatOptions:r}},Bm=i=>{const l={};return(r,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const h=o+JSON.stringify(f);let g=l[h];return g||(g=i(ui(o),c),l[h]=g),g(r)}},Jb=i=>(l,r,o)=>i(ui(r),o)(l);class Fb{constructor(l={}){this.logger=Ft.create("formatter"),this.options=l,this.init(l)}init(l,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const o=r.cacheInBuiltFormats?Bm:Jb;this.formats={number:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f});return g=>h.format(g)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return g=>h.format(g)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return g=>h.format(g)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return g=>h.format(g,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return g=>h.format(g)})}}add(l,r){this.formats[l.toLowerCase().trim()]=r}addCached(l,r){this.formats[l.toLowerCase().trim()]=Bm(r)}format(l,r,o,c={}){const f=r.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(g=>g.indexOf(")")>-1)){const g=f.findIndex(p=>p.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,g)].join(this.formatSeparator)}return f.reduce((g,p)=>{var v;const{formatName:m,formatOptions:b}=$b(p);if(this.formats[m]){let N=g;try{const L=((v=c==null?void 0:c.formatParams)==null?void 0:v[c.interpolationkey])||{},z=L.locale||L.lng||c.locale||c.lng||o;N=this.formats[m](g,z,{...b,...c,...L})}catch(L){this.logger.warn(L)}return N}else this.logger.warn(`there was no format function for ${m}`);return g},l)}}const Wb=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class Ib extends $u{constructor(l,r,o,c={}){var f,h;super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Ft.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(h=(f=this.backend)==null?void 0:f.init)==null||h.call(f,o,c.backend,c)}queueLoad(l,r,o,c){const f={},h={},g={},p={};return l.forEach(m=>{let b=!0;r.forEach(v=>{const N=`${m}|${v}`;!o.reload&&this.store.hasResourceBundle(m,v)?this.state[N]=2:this.state[N]<0||(this.state[N]===1?h[N]===void 0&&(h[N]=!0):(this.state[N]=1,b=!1,h[N]===void 0&&(h[N]=!0),f[N]===void 0&&(f[N]=!0),p[v]===void 0&&(p[v]=!0)))}),b||(g[m]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(p)}}loaded(l,r,o){const c=l.split("|"),f=c[0],h=c[1];r&&this.emit("failedLoading",f,h,r),!r&&o&&this.store.addResourceBundle(f,h,o,void 0,void 0,{skipCopy:!0}),this.state[l]=r?-1:2,r&&o&&(this.state[l]=0);const g={};this.queue.forEach(p=>{kb(p.loaded,[f],h),Wb(p,l),r&&p.errors.push(r),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(m=>{g[m]||(g[m]={});const b=p.loaded[m];b.length&&b.forEach(v=>{g[m][v]===void 0&&(g[m][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(p=>!p.done)}read(l,r,o,c=0,f=this.retryTimeout,h){if(!l.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:l,ns:r,fcName:o,tried:c,wait:f,callback:h});return}this.readingCalls++;const g=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,l,r,o,c+1,f*2,h)},f);return}h(m,b)},p=this.backend[o].bind(this.backend);if(p.length===2){try{const m=p(l,r);m&&typeof m.then=="function"?m.then(b=>g(null,b)).catch(g):g(null,m)}catch(m){g(m)}return}return p(l,r,g)}prepareLoading(l,r,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();ae(l)&&(l=this.languageUtils.toResolveHierarchy(l)),ae(r)&&(r=[r]);const f=this.queueLoad(l,r,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(h=>{this.loadOne(h)})}load(l,r,o){this.prepareLoading(l,r,{},o)}reload(l,r,o){this.prepareLoading(l,r,{reload:!0},o)}loadOne(l,r=""){const o=l.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(h,g)=>{h&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,h),!h&&g&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,g),this.loaded(l,h,g)})}saveMissing(l,r,o,c,f,h={},g=()=>{}){var p,m,b,v,N;if((m=(p=this.services)==null?void 0:p.utils)!=null&&m.hasLoadedNamespace&&!((v=(b=this.services)==null?void 0:b.utils)!=null&&v.hasLoadedNamespace(r))){this.logger.warn(`did not save key "${o}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if((N=this.backend)!=null&&N.create){const L={...h,isUpdate:f},z=this.backend.create.bind(this.backend);if(z.length<6)try{let H;z.length===5?H=z(l,r,o,c,L):H=z(l,r,o,c),H&&typeof H.then=="function"?H.then(B=>g(null,B)).catch(g):g(null,H)}catch(H){g(H)}else z(l,r,o,c,g,L)}!l||!l[0]||this.store.addResource(l[0],r,o,c)}}}const Ao=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let l={};if(typeof i[1]=="object"&&(l=i[1]),ae(i[1])&&(l.defaultValue=i[1]),ae(i[2])&&(l.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const r=i[3]||i[2];Object.keys(r).forEach(o=>{l[o]=r[o]})}return l},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),qm=i=>{var l,r;return ae(i.ns)&&(i.ns=[i.ns]),ae(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),ae(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),((r=(l=i.supportedLngs)==null?void 0:l.indexOf)==null?void 0:r.call(l,"cimode"))<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i},ju=()=>{},Pb=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Ag="__i18next_supportNoticeShown",eS=()=>!!(typeof globalThis<"u"&&globalThis[Ag]||typeof process<"u"&&_o&&_o.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&_o),tS=()=>{typeof globalThis<"u"&&(globalThis[Ag]=!0)},aS=i=>{var l,r,o,c,f,h,g,p,m,b,v,N,L;return!!(((o=(r=(l=i==null?void 0:i.modules)==null?void 0:l.backend)==null?void 0:r.name)==null?void 0:o.indexOf("Locize"))>0||((g=(h=(f=(c=i==null?void 0:i.modules)==null?void 0:c.backend)==null?void 0:f.constructor)==null?void 0:h.name)==null?void 0:g.indexOf("Locize"))>0||(m=(p=i==null?void 0:i.options)==null?void 0:p.backend)!=null&&m.backends&&i.options.backend.backends.some(z=>{var H,B,q;return((H=z==null?void 0:z.name)==null?void 0:H.indexOf("Locize"))>0||((q=(B=z==null?void 0:z.constructor)==null?void 0:B.name)==null?void 0:q.indexOf("Locize"))>0})||(v=(b=i==null?void 0:i.options)==null?void 0:b.backend)!=null&&v.projectId||(L=(N=i==null?void 0:i.options)==null?void 0:N.backend)!=null&&L.backendOptions&&i.options.backend.backendOptions.some(z=>z==null?void 0:z.projectId))};class ai extends $u{constructor(l={},r){if(super(),this.options=qm(l),this.services={},this.logger=Ft,this.modules={external:[]},Pb(this),r&&!this.isInitialized&&!l.isClone){if(!this.options.initAsync)return this.init(l,r),this;setTimeout(()=>{this.init(l,r)},0)}}init(l={},r){this.isInitializing=!0,typeof l=="function"&&(r=l,l={}),l.defaultNS==null&&l.ns&&(ae(l.ns)?l.defaultNS=l.ns:l.ns.indexOf("translation")<0&&(l.defaultNS=l.ns[0]));const o=Ao();this.options={...o,...this.options,...qm(l)},this.options.interpolation={...o.interpolation,...this.options.interpolation},l.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=l.keySeparator),l.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=l.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!aS(this)&&!eS()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),tS());const c=m=>m?typeof m=="function"?new m:m:null;if(!this.options.isClone){this.modules.logger?Ft.init(c(this.modules.logger),this.options):Ft.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:m=Fb;const b=new Lm(this.options);this.store=new jm(this.options.resources,this.options);const v=this.services;v.logger=Ft,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new Zb(b,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),m&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(v.formatter=c(m),v.formatter.init&&v.formatter.init(v,this.options),this.options.interpolation.format=v.formatter.format.bind(v.formatter)),v.interpolator=new Hm(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new Ib(c(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.languageDetector&&(v.languageDetector=c(this.modules.languageDetector),v.languageDetector.init&&v.languageDetector.init(v,this.options.detection,this.options)),this.modules.i18nFormat&&(v.i18nFormat=c(this.modules.i18nFormat),v.i18nFormat.init&&v.i18nFormat.init(this)),this.translator=new qu(this.services,this.options),this.translator.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.external.forEach(L=>{L.init&&L.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ju),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(m=>{this[m]=(...b)=>this.store[m](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=(...b)=>(this.store[m](...b),this)});const g=ei(),p=()=>{const m=(b,v)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(v),r(b,v)};if(this.languages&&!this.isInitialized)return m(null,this.t.bind(this));this.changeLanguage(this.options.lng,m)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),g}loadResources(l,r=ju){var f,h;let o=r;const c=ae(l)?l:this.language;if(typeof l=="function"&&(o=l),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],p=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&g.indexOf(v)<0&&g.push(v)})};c?p(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>p(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>p(m)),this.services.backendConnector.load(g,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(m)})}else o(null)}reloadResources(l,r,o){const c=ei();return typeof l=="function"&&(o=l,l=void 0),typeof r=="function"&&(o=r,r=void 0),l||(l=this.languages),r||(r=this.options.ns),o||(o=ju),this.services.backendConnector.reload(l,r,f=>{c.resolve(),o(f)}),c}use(l){if(!l)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!l.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return l.type==="backend"&&(this.modules.backend=l),(l.type==="logger"||l.log&&l.warn&&l.error)&&(this.modules.logger=l),l.type==="languageDetector"&&(this.modules.languageDetector=l),l.type==="i18nFormat"&&(this.modules.i18nFormat=l),l.type==="postProcessor"&&Cg.addPostProcessor(l),l.type==="formatter"&&(this.modules.formatter=l),l.type==="3rdParty"&&this.modules.external.push(l),this}setResolvedLanguage(l){if(!(!l||!this.languages)&&!(["cimode","dev"].indexOf(l)>-1)){for(let r=0;r<this.languages.length;r++){const o=this.languages[r];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(l)<0&&this.store.hasLanguageSomeTranslations(l)&&(this.resolvedLanguage=l,this.languages.unshift(l))}}changeLanguage(l,r){this.isLanguageChangingTo=l;const o=ei();this.emit("languageChanging",l);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,p)=>{p?this.isLanguageChangingTo===l&&(c(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),r&&r(g,(...m)=>this.t(...m))},h=g=>{var b,v;!l&&!g&&this.services.languageDetector&&(g=[]);const p=ae(g)?g:g&&g[0],m=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(ae(g)?[g]:g);m&&(this.language||c(m),this.translator.language||this.translator.changeLanguage(m),(v=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||v.call(b,m)),this.loadResources(m,N=>{f(N,m)})};return!l&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!l&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(l),o}getFixedT(l,r,o){const c=(f,h,...g)=>{let p;typeof h!="object"?p=this.options.overloadTranslationOptionHandler([f,h].concat(g)):p={...h},p.lng=p.lng||c.lng,p.lngs=p.lngs||c.lngs,p.ns=p.ns||c.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||o||c.keyPrefix);const m={...this.options,...p};typeof p.keyPrefix=="function"&&(p.keyPrefix=el(p.keyPrefix,m));const b=this.options.keySeparator||".";let v;return p.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=el(N,m)),`${p.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=el(f,m)),v=p.keyPrefix?`${p.keyPrefix}${b}${f}`:f),this.t(v,p)};return ae(l)?c.lng=l:c.lngs=l,c.ns=r,c.keyPrefix=o,c}t(...l){var r;return(r=this.translator)==null?void 0:r.translate(...l)}exists(...l){var r;return(r=this.translator)==null?void 0:r.exists(...l)}setDefaultNamespace(l){this.options.defaultNS=l}hasLoadedNamespace(l,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=r.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const h=(g,p)=>{const m=this.services.backendConnector.state[`${g}|${p}`];return m===-1||m===0||m===2};if(r.precheck){const g=r.precheck(this,h);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,l)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(o,l)&&(!c||h(f,l)))}loadNamespaces(l,r){const o=ei();return this.options.ns?(ae(l)&&(l=[l]),l.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),r&&r(c)}),o):(r&&r(),Promise.resolve())}loadLanguages(l,r){const o=ei();ae(l)&&(l=[l]);const c=this.options.preload||[],f=l.filter(h=>c.indexOf(h)<0&&this.services.languageUtils.isSupportedCode(h));return f.length?(this.options.preload=c.concat(f),this.loadResources(h=>{o.resolve(),r&&r(h)}),o):(r&&r(),Promise.resolve())}dir(l){var c,f;if(l||(l=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!l)return"rtl";try{const h=new Intl.Locale(l);if(h&&h.getTextInfo){const g=h.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=((f=this.services)==null?void 0:f.languageUtils)||new Lm(Ao());return l.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(o.getLanguagePartFromCode(l))>-1||l.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(l={},r){const o=new ai(l,r);return o.createInstance=ai.createInstance,o}cloneInstance(l={},r=ju){const o=l.forkResourceStore;o&&delete l.forkResourceStore;const c={...this.options,...l,isClone:!0},f=new ai(c);if((l.debug!==void 0||l.prefix!==void 0)&&(f.logger=f.logger.clone(l)),["store","services","language"].forEach(g=>{f[g]=this[g]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const g=Object.keys(this.store.data).reduce((p,m)=>(p[m]={...this.store.data[m]},p[m]=Object.keys(p[m]).reduce((b,v)=>(b[v]={...p[m][v]},b),p[m]),p),{});f.store=new jm(g,c),f.services.resourceStore=f.store}if(l.interpolation){const p={...Ao().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:p};f.services.interpolator=new Hm(m)}return f.translator=new qu(f.services,c),f.translator.on("*",(g,...p)=>{f.emit(g,...p)}),f.init(c,r),f.translator.options=c,f.translator.backendConnector.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},f}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const $e=ai.createInstance();$e.createInstance;$e.dir;$e.init;$e.loadResources;$e.reloadResources;$e.use;$e.changeLanguage;$e.getFixedT;$e.t;$e.exists;$e.setDefaultNamespace;$e.hasLoadedNamespace;$e.loadNamespaces;$e.loadLanguages;const ni="en",zg={en:()=>Pe(()=>import("./en-CKhCF6St.js"),[],import.meta.url),zh:()=>Pe(()=>import("./zh-Dz5FLTBV.js"),[],import.meta.url),"zh-TW":()=>Pe(()=>import("./zh-TW-BtRwreY_.js"),[],import.meta.url),ja:()=>Pe(()=>import("./ja-ChF4vbBL.js"),[],import.meta.url),es:()=>Pe(()=>import("./es-C8UBPhxM.js"),[],import.meta.url)},Du={};function Ym(i){return i in zg}function Ng(i){if(Ym(i))return i;const l=i.split("-")[0];return Ym(l)?l:ni}function nS(){const i=localStorage.getItem("cc_lang");return Ng(i||navigator.language||ni)}async function ko(i){if(Du[i])return;const l=await zg[i]();Du[i]=l.default,$e.isInitialized&&$e.addResourceBundle(i,"translation",Du[i],!0,!0)}async function lS(){const i=nS();await Promise.all([ko(ni),i===ni?Promise.resolve():ko(i)]),$e.isInitialized||await $e.use(ab).init({lng:i,fallbackLng:ni,resources:Object.fromEntries(Object.entries(Du).map(([l,r])=>[l,{translation:r}])),interpolation:{escapeValue:!1}})}async function wg(i){const l=Ng(i);await ko(l),await $e.changeLanguage(l),localStorage.setItem("cc_lang",l)}const Gm=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],iS=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron"]},{label:"System",ids:["system"]}];function uS(){var J;const{pathname:i}=zt(),{t:l,i18n:r}=Eg(),{theme:o,setTheme:c}=Wo(),f=Ot(V=>V.logout),h=Ot(V=>V.desktopManaged),g=Fo(),p=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{wg(V),N(!1)},z={light:Im,dark:Fm,system:Jm},H={light:"dark",dark:"system",system:"light"},B=z[o],q=Zu.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:g}))??!0}),Q=q.map(V=>{var te;const ue=V.icon,K=((te=V.resolveLabelKey)==null?void 0:te.call(V,{desktopManaged:h,features:g,runtimeProvider:p}))||V.labelKey;return{...V,Icon:ue,labelKey:K}}),X=i.startsWith("/chat");return _.jsxs(_.Fragment,{children:[_.jsxs("aside",{className:He("relative hidden h-[100dvh] flex-col overflow-hidden border-r transition-all duration-300 ease-out md:flex","border-white/55 bg-white/24 shadow-[inset_-1px_0_0_rgba(255,255,255,0.36)] backdrop-blur-[34px] supports-[backdrop-filter]:bg-white/18","dark:border-white/[0.10] dark:bg-[#1c1c1e]/34 dark:shadow-[inset_-1px_0_0_rgba(255,255,255,0.08)] dark:supports-[backdrop-filter]:bg-[#1c1c1e]/26",m?"w-16":"w-56"),children:[_.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(255,255,255,0.55),rgba(255,255,255,0.18)_48%,rgba(255,255,255,0.08))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.025)_52%,rgba(255,255,255,0.015))]","aria-hidden":"true"}),_.jsx("div",{className:He("relative flex h-[5.25rem] items-center gap-3 px-4 pt-7 transition-colors"),children:_.jsx(Rg,{showWordmark:!m})}),_.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:iS.map(V=>{const ue=q.filter(K=>V.ids.includes(K.id));return ue.length===0?null:_.jsxs("div",{className:"space-y-1",children:[!m&&_.jsx("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/80",children:V.label}),ue.map(K=>{var se;const te=K.icon,le=((se=K.resolveLabelKey)==null?void 0:se.call(K,{desktopManaged:h,features:g,runtimeProvider:p}))||K.labelKey;return _.jsxs(jo,{to:K.path,end:K.end,className:({isActive:Ae})=>He("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",Ae?"bg-black/[0.07] text-foreground dark:bg-white/[0.10]":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(le)})]},K.id)})]},V.label)})}),_.jsxs("div",{className:He("relative border-t p-2 space-y-1","border-black/10 dark:border-white/[0.08]"),children:[!m&&_.jsxs("div",{className:"px-3 pb-1 pt-0.5 text-[11px] font-medium text-muted-foreground/75",children:["AgentDock v","0.1.31"]}),_.jsxs("div",{className:"relative",children:[_.jsxs("button",{type:"button",onClick:()=>N(!v),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(N0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:((J=Gm.find(V=>V.code===r.language))==null?void 0:J.label)||"English"})]}),v&&_.jsx("div",{className:He("absolute bottom-full left-0 mb-1 w-48 rounded-xl py-1 z-50 overflow-hidden","border border-black/10 bg-white/90 text-popover-foreground shadow-[0_18px_40px_rgba(0,0,0,0.12)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#2c2c2e]/90"),children:Gm.map(V=>_.jsx("button",{type:"button",onClick:()=>L(V.code),className:He("w-full text-left px-3 py-2 text-sm transition-colors duration-150",r.language===V.code?"text-primary font-medium bg-primary/10":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:V.label},V.code))})]}),_.jsxs("button",{type:"button",onClick:()=>c(H[o]),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(B,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(`theme.${o}`)})]}),!h&&_.jsxs("button",{type:"button",onClick:f,className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-destructive/10 hover:text-destructive","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(U0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l("login.logout")})]}),_.jsx("button",{type:"button",onClick:()=>b(!m),className:He("flex items-center justify-center w-full px-3 py-2 rounded-lg transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:m?_.jsx(E0,{size:18}):_.jsx(S0,{size:18})})]})]}),X?null:_.jsx("nav",{className:He("fixed inset-x-0 bottom-0 z-50 border-t px-2 pb-[max(env(safe-area-inset-bottom),0.5rem)] pt-2 md:hidden","border-black/10 bg-white/88 shadow-[0_-12px_32px_rgba(15,23,42,0.10)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#111113]/88 dark:shadow-[0_-16px_42px_rgba(0,0,0,0.34)]"),"aria-label":"Primary navigation",children:_.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:Q.map(({id:V,path:ue,end:K,Icon:te,labelKey:le})=>_.jsxs(jo,{to:ue,end:K,className:({isActive:se})=>He("flex min-w-[4.5rem] flex-1 flex-col items-center justify-center gap-1 rounded-xl px-2 py-2 text-[11px] font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",se?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),_.jsx("span",{className:"max-w-[4.25rem] truncate",children:l(le)})]},V))})})]})}function rS(){const{pathname:i}=zt(),{desktopChat:l}=Fo(),r=i.startsWith("/chat"),o=i.startsWith("/chat")&&l,c=o&&dn()==="electron";return _.jsxs("div",{className:He("flex h-[100dvh] overflow-hidden","bg-background/60 backdrop-blur-2xl"),children:[_.jsx("div",{className:"fixed left-0 right-0 top-0 z-50 hidden h-8 [-webkit-app-region:drag] md:block","aria-hidden":"true"}),_.jsx(uS,{}),_.jsx("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0 bg-background/45 backdrop-blur-2xl",children:_.jsx("main",{className:He("flex-1 min-h-0",o?"overflow-hidden":"overflow-y-auto",c?"p-0":r?"p-4 pb-4 sm:p-6 sm:pb-6":"p-4 pb-24 sm:p-6 sm:pb-6"),children:_.jsx("div",{className:He(o&&"h-full min-h-0",!c&&"mx-auto w-full max-w-7xl"),children:_.jsx(l1,{})})})})]})}const sS=()=>Xe.get("/status"),n2=i=>Xe.post("/restart",i),l2=()=>Xe.post("/reload"),i2=i=>Xe.get("/logs",i);function oS({children:i,className:l,hover:r}){return _.jsx("div",{className:He("rounded-lg p-5 text-card-foreground transition-colors duration-200 animate-float-in","border border-black/[0.08] bg-white/62 shadow-[0_1px_1px_rgba(0,0,0,0.04)] backdrop-blur-2xl","dark:border-white/[0.07] dark:bg-white/[0.06] dark:shadow-none",r&&"cursor-pointer hover:border-black/[0.12] hover:bg-white/76 hover:shadow-[0_10px_26px_rgba(0,0,0,0.07)] dark:hover:border-white/[0.10] dark:hover:bg-white/[0.09] dark:hover:shadow-none",l),children:i})}function Vm(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function jg(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Vm(c,l);return!r&&typeof f=="function"&&(r=!0),f});if(r)return()=>{for(let c=0;c<o.length;c++){const f=o[c];typeof f=="function"?f():Vm(i[c],null)}}}}function u2(...i){return T.useCallback(jg(...i),i)}var cS=Symbol.for("react.lazy"),Yu=m0[" use ".trim().toString()];function fS(i){return typeof i=="object"&&i!==null&&"then"in i}function Mg(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===cS&&"_payload"in i&&fS(i._payload)}function dS(i){const l=mS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;Mg(f)&&typeof Yu=="function"&&(f=Yu(f._payload));const g=T.Children.toArray(f),p=g.find(pS);if(p){const m=p.props.children,b=g.map(v=>v===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:v);return _.jsx(l,{...h,ref:c,children:T.isValidElement(m)?T.cloneElement(m,void 0,b):null})}return _.jsx(l,{...h,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}var hS=dS("Slot");function mS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(Mg(c)&&typeof Yu=="function"&&(c=Yu(c._payload)),T.isValidElement(c)){const h=vS(c),g=yS(f,c.props);return c.type!==T.Fragment&&(g.ref=o?jg(o,h):h),T.cloneElement(c,g)}return T.Children.count(c)>1?T.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var gS=Symbol("radix.slottable");function pS(i){return T.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===gS}function yS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...g)=>{const p=f(...g);return c(...g),p}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function vS(i){var o,c;let l=(o=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:o.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=(c=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:c.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}const bS={default:"bg-primary text-primary-foreground hover:bg-accent-dim",primary:"bg-primary text-primary-foreground hover:bg-accent-dim",secondary:"bg-black/[0.05] text-secondary-foreground hover:bg-black/[0.08] dark:bg-white/[0.08] dark:hover:bg-white/[0.12]",outline:"border border-input bg-background hover:bg-black/[0.04] hover:text-foreground dark:hover:bg-white/[0.06]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]",link:"text-primary underline-offset-4 hover:underline"},SS={default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",md:"h-9 rounded-md px-4 py-2 text-sm",lg:"h-10 rounded-md px-6 text-sm",icon:"h-9 w-9"};function Gu({variant:i="primary",size:l="md",className:r,children:o,loading:c,asChild:f,disabled:h,type:g="button",...p}){const m=l==="default"?"md":l,b=f?hS:"button";return _.jsxs(b,{...f?{}:{type:g},className:He("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors duration-200","cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50",bS[i],SS[m],r),disabled:h||c,...p,children:[c&&_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24","aria-hidden":!0,children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o]})}function Km({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("input",{className:He("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}function r2({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("textarea",{className:He("flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors resize-none","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}const Ho="http://127.0.0.1:9831",xS=`${Ho}/api/local/v1`;function ES(i){const l=i.trim();return l?l.replace(/\/+$/,""):xS}const ri=ES("/api/local/v1");ri.endsWith("/api/local/v1")&&ri.slice(0,-13);const si=new Set;let _t=null;async function W(i,l,r){const o=await fetch(`${ri}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}function Lg(){if(_t||typeof window>"u")return;_t=new EventSource(`${ri}/events`);const i=l=>{try{const r=JSON.parse(l.data);si.forEach(o=>o(r))}catch{}};["runtime.updated","runtime.detect.started","runtime.detect.completed","runtime.detect.failed","runtime.status.changed","thread.updated","message.created","message.updated","run.updated","scheduler.job.updated","scheduler.run.updated","presence.updated","stream.updated"].forEach(l=>{_t==null||_t.addEventListener(l,i)}),_t.onerror=()=>{_t==null||_t.close(),_t=null,si.size>0&&window.setTimeout(()=>Lg(),1e3)}}function TS(){si.size===0&&_t&&(_t.close(),_t=null)}function Dg(i){return si.add(i),Lg(),()=>{si.delete(i),TS()}}async function s2(){return W("GET","/runtime")}async function o2(){return W("POST","/runtime/service/start")}async function c2(){return W("POST","/runtime/service/stop")}async function f2(){return W("POST","/runtime/service/restart")}async function d2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return W("GET",`/runtime/logs${l}`)}async function h2(){return W("GET","/runtime/agent-runtimes")}async function m2(){return W("POST","/runtimes/refresh")}async function g2(){return W("GET","/runtime/config")}async function p2(i){return W("POST","/runtime/config/raw",{raw:i})}async function y2(i){return W("POST","/runtime/config/structured",{config:i})}async function v2(i){return W("POST","/runtime/settings",i)}async function RS(i){return W("GET",`/platforms/${encodeURIComponent(i)}`)}function di(i){return i?`?instance_id=${encodeURIComponent(i)}`:""}async function _S(i,l,r){return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}${di(r)}`)}async function CS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test${di(r)}`)}async function OS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable${di(r)}`)}async function AS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable${di(r)}`)}async function zS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function NS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function wS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function jS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function Ug(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode${di(r)}`)}async function kg(i,l,r,o){const c=`?ticket=${encodeURIComponent(r)}${o?`&instance_id=${encodeURIComponent(o)}`:""}`;return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode/status${c}`)}async function b2(){return RS("lark")}async function S2(i,l){return _S("lark",i,l)}async function x2(i,l){return CS("lark",i,l)}async function E2(i,l){return OS("lark",i,l)}async function T2(i,l){return AS("lark",i,l)}async function R2(i){return zS("lark",i)}async function _2(i){return NS("lark",i)}async function C2(i){return wS("lark",i)}async function O2(i){return jS("lark",i)}async function A2(i,l){return Ug("lark",i,l)}async function z2(i,l,r){return kg("lark",i,l,r)}async function N2(i,l){return Ug("weixin",i,l)}async function w2(i,l,r){return kg("weixin",i,l,r)}async function j2(){return W("GET","/workspaces")}async function M2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.runtimeId&&l.set("runtime_id",i.runtimeId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/tasks${r}`)}async function L2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/approvals${r}`)}async function D2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.approvalId&&l.set("approval_id",i.approvalId),i.type&&l.set("type",Array.isArray(i.type)?i.type.join(","):i.type),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/audit-events${r}`)}async function U2(i){return W("GET","/scheduler/jobs")}async function k2(i){return W("POST","/scheduler/jobs",i)}async function H2(i,l){return W("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function B2(i){return W("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function q2(i){return W("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function Y2(i){return W("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function G2(i,l){return W("POST","/threads",{workspaceId:i,title:l})}async function V2(i){return W("GET",`/threads/${encodeURIComponent(i)}`)}async function K2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function Q2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function X2(i){return W("DELETE",`/threads/${encodeURIComponent(i)}`)}async function Z2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function $2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function J2(i){return W("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function F2(){return W("GET","/knowledge/config")}async function W2(){return W("GET","/knowledge/folders")}async function I2(i){return W("POST","/knowledge/folders",i)}async function P2(i,l){return W("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function ex(i){return W("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function tx(){return W("GET","/knowledge/bases")}async function ax(i){return W("POST","/knowledge/bases",i)}async function nx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function lx(i,l){return W("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function ix(i){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function ux(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function rx(i,l){const r=new FormData;r.append("collection",l.collection),r.append("knowledgebase_id",i),l.folder&&r.append("folder",l.folder),l.files.forEach(f=>{r.append("files",f,f.name)});const o=await fetch(`${ri}/knowledge/bases/${encodeURIComponent(i)}/files`,{method:"POST",body:r}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core upload failed: ${o.status}`);return c.data}async function sx(i,l){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function ox(i,l){return W("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function cx(){return W("GET","/capabilities/snapshot")}async function fx(){return W("GET","/plugins/diagnostics")}async function dx(i){return W("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function hx(i){return Dg(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function mx(i){return Dg(l=>{l.type==="stream.updated"&&i(l.stream),(l.type==="message.created"||l.type==="message.updated"||l.type==="run.updated")&&"stream"in l&&l.stream&&i(l.stream)})}const MS=[{code:"en",label:"EN"},{code:"zh",label:"中"},{code:"zh-TW",label:"繁"},{code:"ja",label:"日"},{code:"es",label:"ES"}];function LS(){const{t:i,i18n:l}=Eg(),r=Qu(),o=Ot(J=>J.login),{theme:c,setTheme:f}=Wo(),[h,g]=T.useState(""),[p,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=sb(),H=ob(),B=async J=>{if(J.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{p.trim()&&Xe.setBaseUrl(p.trim()),Xe.setToken(h.trim()),await sS(),o(h.trim(),p.trim()),z?window.location.hash="#/":r("/",{replace:!0})}catch{v(i("login.invalidToken")),Xe.setToken(""),Xe.setBaseUrl("")}finally{L(!1)}}},q={light:Im,dark:Fm,system:Jm},Q={light:"dark",dark:"system",system:"light"},X=q[c];return _.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-[radial-gradient(circle_at_top,hsl(var(--secondary))_0,hsl(var(--background))_42%,hsl(var(--background))_78%)] p-4",children:[_.jsxs("div",{className:"fixed top-4 right-4 flex items-center gap-2",children:[_.jsx("div",{className:"flex overflow-hidden rounded-md border bg-card/80 backdrop-blur",children:MS.map(J=>_.jsx("button",{onClick:()=>void wg(J.code),className:He("px-2.5 py-1.5 text-xs font-medium transition-colors",l.language===J.code?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent/10 hover:text-foreground"),children:J.label},J.code))}),_.jsx(Gu,{variant:"outline",size:"icon",onClick:()=>f(Q[c]),"aria-label":i(`theme.${c}`),children:_.jsx(X,{size:16})})]}),_.jsx("div",{className:"w-full max-w-md animate-fade-in",children:_.jsxs(oS,{className:"p-8 shadow-2xl shadow-primary/10",children:[_.jsx("div",{className:"flex justify-center mb-6",children:_.jsx(Rg,{markClassName:"h-14 w-14 drop-shadow-[0_14px_28px_rgba(0,122,255,0.22)]"})}),_.jsx("h1",{className:"text-2xl font-bold text-center text-foreground mb-1",children:i("login.title")}),_.jsx("p",{className:"text-sm text-center text-muted-foreground mb-3",children:i("login.subtitle")}),_.jsx("div",{className:"mb-8 rounded-lg border bg-muted px-4 py-3 text-xs text-muted-foreground",children:z?"AgentDock 桌面模式会自动连接到本地托管运行时。":"Browser mode requires a reachable API endpoint. Enter the server URL and access token."}),b&&_.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-lg border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive dark:text-red-200",children:[_.jsx(R0,{size:16}),b]}),_.jsxs("form",{onSubmit:B,className:"space-y-4",children:[_.jsx(Km,{label:i("login.token"),type:"password",value:h,onChange:J=>g(J.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Km,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:p,onChange:J=>m(J.target.value),placeholder:"http://localhost:9820"}),_.jsxs(Gu,{type:"submit",disabled:N||!h.trim()||H,className:"w-full shadow-[0_0_20px_-6px_hsl(var(--primary)/0.55)]",children:[N?_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):_.jsx(I0,{size:16}),i("login.connect")]})]})]})})]})}function DS({children:i}){return Ot(r=>r.isAuthenticated)?_.jsx(_.Fragment,{children:i}):_.jsx(Ya,{to:"/login",replace:!0})}function US(){return _.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function kS(){const i=Ot(o=>o.isAuthenticated),l=Ot(o=>o.desktopManaged),r=Fo();return _.jsx(T.Suspense,{fallback:_.jsx(US,{}),children:_.jsxs(u1,{children:[_.jsx(on,{path:"/login",element:i?_.jsx(Ya,{to:"/",replace:!0}):_.jsx(LS,{})}),_.jsxs(on,{element:_.jsx(DS,{children:_.jsx(rS,{})}),children:[Zu.listRoutes().map(o=>o.index?_.jsx(on,{index:!0,element:o.element({desktopManaged:l,features:r})},o.id):_.jsx(on,{path:o.path,element:o.element({desktopManaged:l,features:r})},o.id)),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:"/",replace:!0})})]}),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:i?"/":"/login",replace:!0})})]})})}class HS extends Pn.Component{constructor(){super(...arguments);In(this,"state",{hasError:!1,errorMessage:""})}static getDerivedStateFromError(r){return{hasError:!0,errorMessage:r instanceof Error?r.message:String(r)}}componentDidCatch(r,o){console.error("App render failed",r,o)}render(){return this.state.hasError?_.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-lg w-full rounded-2xl border border-red-200 dark:border-red-900/40 bg-red-50 dark:bg-red-950/20 px-6 py-5",children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"页面渲染失败"}),_.jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400 break-words",children:this.state.errorMessage||"Unknown renderer error"}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700",children:"Reload"})]})}):this.props.children}}const BS="http://127.0.0.1:9831",qS=`${BS}/api/local/v1`,cn=YS("/api/local/v1"),oi=new Set;let Kt=null;function YS(i){const l=i.trim();return l?l.replace(/\/+$/,""):qS}async function Io(i,l,r){const o=await fetch(`${cn}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}async function GS(i=350){var o;const l=new AbortController,r=window.setTimeout(()=>l.abort(),i);try{const c=await fetch(`${cn}/health`,{signal:l.signal}),f=await c.json();return c.ok&&f.ok&&((o=f.data)==null?void 0:o.name)==="local-ai-core"}catch{return!1}finally{window.clearTimeout(r)}}function Hg(){Kt||typeof window>"u"||(Kt=new EventSource(`${cn}/events`),Kt.addEventListener("runtime.updated",i=>{try{const l=JSON.parse(i.data);l.type==="runtime.updated"&&oi.forEach(r=>r(l.runtime))}catch{}}),Kt.onerror=()=>{Kt==null||Kt.close(),Kt=null,oi.size>0&&window.setTimeout(()=>Hg(),1e3)})}function VS(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function KS(){return window.desktop?(To("electron"),!0):(await GS(),To("local_core"),!0)}function QS(){return dn()==="electron"&&window.desktop?window.desktop.getRuntimeStatus():Io("GET","/runtime")}function Qm(){return Io("GET","/capabilities/snapshot")}function XS(i){if(dn()==="electron"&&window.desktop)return window.desktop.getLogs(i);const l=`?limit=${encodeURIComponent(String(i))}`;return Io("GET",`/runtime/logs${l}`)}function ZS(i){return dn()==="electron"&&window.desktop?window.desktop.onRuntimeEvent(i):(oi.add(i),Hg(),()=>{oi.delete(i),VS()})}const Xm=20,$S=500;function JS(i){return new Promise(l=>window.setTimeout(l,i))}function FS(){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-white dark:bg-gray-900 px-5 py-4 text-sm text-gray-600 dark:text-gray-300 shadow-sm",children:[_.jsx(Wm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function WS({message:i,logs:l,onRetry:r}){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-2xl w-full rounded-3xl border border-red-200 dark:border-red-900/40 bg-white dark:bg-gray-900 shadow-sm overflow-hidden",children:[_.jsx("div",{className:"px-6 py-5 border-b border-red-100 dark:border-red-900/30 bg-red-50/80 dark:bg-red-950/20",children:_.jsxs("div",{className:"flex items-start gap-3",children:[_.jsx("div",{className:"w-10 h-10 rounded-2xl bg-red-100 dark:bg-red-950/40 text-red-600 dark:text-red-300 flex items-center justify-center shrink-0",children:_.jsx($0,{size:18})}),_.jsxs("div",{children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"AgentDock 运行时初始化失败"}),_.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 break-words",children:i})]})]})}),_.jsxs("div",{className:"px-6 py-5 space-y-4",children:[_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] px-4 py-3 text-sm text-gray-600 dark:text-gray-300",children:[_.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"What we can do next"}),_.jsx("p",{className:"mt-1",children:"请先重试本地运行时初始化。如果仍然失败,请检查下方运行时日志,并确认 Local AI Core 配置文件路径与运行环境是否正确。"})]}),l.length>0&&_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-gray-50 dark:bg-gray-950/40 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"最近的桌面日志"}),_.jsx("pre",{className:"mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-gray-600 dark:text-gray-300 font-mono",children:l.join(`
177
177
  `)})]}),_.jsxs("div",{className:"flex gap-3",children:[_.jsxs(Gu,{onClick:r,children:[_.jsx(Wm,{size:14})," 重试初始化"]}),_.jsx(Gu,{variant:"secondary",onClick:()=>window.location.reload(),children:"重新加载应用"})]})]})]})})}function IS(){const[i,l]=T.useState({status:"loading"}),[r,o]=T.useState(!1),c=T.useCallback(async()=>{l({status:"loading"});const h=!!await KS();if(o(h),h)try{let g=null;for(let p=0;p<Xm;p+=1)try{await QS(),g=null;break}catch(m){g=m,p<Xm-1&&await JS($S)}if(g)throw g;Ro(await Qm()),Xe.setBaseUrl(cn),Xe.setToken(""),Ot.getState().setManagedSession("",cn,dn()==="local_core"?"local_core":"electron")}catch(g){let p=[];try{p=await XS(80)}catch{p=[]}l({status:"error",message:g instanceof Error?g.message:String(g),logs:p});return}h||Ro(null),l({status:"ready"})},[]);return T.useEffect(()=>{c()},[c]),T.useEffect(()=>{if(r)return ZS(f=>{Xe.setBaseUrl(cn),Xe.setToken(""),Qm().then(h=>Ro(h)).catch(()=>{}),Ot.getState().setManagedSession("",cn,dn()==="local_core"?"local_core":"electron")})},[r]),i.status==="loading"?_.jsx(FS,{}):i.status==="error"?_.jsx(WS,{message:i.message,logs:i.logs,onRetry:()=>void c()}):_.jsx(w1,{children:_.jsx(kS,{})})}async function PS(){await lS(),Ot.getState().init(),Wo.getState().init(),uv.createRoot(document.getElementById("root")).render(_.jsx(HS,{children:_.jsx(IS,{})}))}PS();export{R2 as $,fg as A,Gu as B,oS as C,a2 as D,C0 as E,A0 as F,Zm as G,U2 as H,Km as I,H2 as J,k2 as K,yg as L,H0 as M,B2 as N,q2 as O,Dg as P,n2 as Q,Wm as R,Q0 as S,r2 as T,l2 as U,mx as V,F0 as W,O2 as X,C2 as Y,I0 as Z,_2 as _,Fo as a,T2 as a0,E2 as a1,x2 as a2,S2 as a3,b2 as a4,z2 as a5,A2 as a6,w2 as a7,N2 as a8,kg as a9,u2 as aA,F2 as aB,W2 as aC,I2 as aD,ax as aE,P2 as aF,ex as aG,lx as aH,ix as aI,L0 as aJ,av as aK,m0 as aL,jg as aM,nx as aN,ux as aO,rx as aP,sx as aQ,ox as aR,Ug as aa,jS as ab,wS as ac,NS as ad,zS as ae,AS as af,OS as ag,CS as ah,_S as ai,RS as aj,fx as ak,cx as al,m2 as am,h2 as an,hx as ao,dx as ap,v2 as aq,y2 as ar,p2 as as,g2 as at,d2 as au,f2 as av,c2 as aw,o2 as ax,s2 as ay,i2 as az,M2 as b,Je as c,L2 as d,D2 as e,R0 as f,He as g,E0 as h,dn as i,_ as j,Y2 as k,j2 as l,V2 as m,G2 as n,Q2 as o,Z2 as p,J2 as q,T as r,$2 as s,K2 as t,Eg as u,X2 as v,t2 as w,tx as x,Pn as y,Xe as z};