@kaitranntt/ccs 7.74.0-dev.9 → 7.75.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/ccs.js +4 -2
  2. package/dist/ccs.js.map +1 -1
  3. package/dist/cliproxy/account-safety.d.ts.map +1 -1
  4. package/dist/cliproxy/account-safety.js +6 -1
  5. package/dist/cliproxy/account-safety.js.map +1 -1
  6. package/dist/cliproxy/ai-providers/service.d.ts.map +1 -1
  7. package/dist/cliproxy/ai-providers/service.js +10 -3
  8. package/dist/cliproxy/ai-providers/service.js.map +1 -1
  9. package/dist/cliproxy/config/generator.d.ts +2 -1
  10. package/dist/cliproxy/config/generator.d.ts.map +1 -1
  11. package/dist/cliproxy/config/generator.js +25 -1
  12. package/dist/cliproxy/config/generator.js.map +1 -1
  13. package/dist/cliproxy/executor/index.d.ts +5 -0
  14. package/dist/cliproxy/executor/index.d.ts.map +1 -1
  15. package/dist/cliproxy/executor/index.js +22 -6
  16. package/dist/cliproxy/executor/index.js.map +1 -1
  17. package/dist/cliproxy/executor/retry-handler.js +2 -2
  18. package/dist/cliproxy/executor/retry-handler.js.map +1 -1
  19. package/dist/cliproxy/management-api-client.d.ts.map +1 -1
  20. package/dist/cliproxy/management-api-client.js +3 -2
  21. package/dist/cliproxy/management-api-client.js.map +1 -1
  22. package/dist/cliproxy/quota-fetcher-claude-normalizer.d.ts.map +1 -1
  23. package/dist/cliproxy/quota-fetcher-claude-normalizer.js +16 -12
  24. package/dist/cliproxy/quota-fetcher-claude-normalizer.js.map +1 -1
  25. package/dist/cliproxy/quota-fetcher-codex.d.ts +18 -3
  26. package/dist/cliproxy/quota-fetcher-codex.d.ts.map +1 -1
  27. package/dist/cliproxy/quota-fetcher-codex.js +74 -24
  28. package/dist/cliproxy/quota-fetcher-codex.js.map +1 -1
  29. package/dist/cliproxy/quota-fetcher-ghcp.d.ts.map +1 -1
  30. package/dist/cliproxy/quota-fetcher-ghcp.js +19 -8
  31. package/dist/cliproxy/quota-fetcher-ghcp.js.map +1 -1
  32. package/dist/cliproxy/quota-manager.d.ts +5 -2
  33. package/dist/cliproxy/quota-manager.d.ts.map +1 -1
  34. package/dist/cliproxy/quota-manager.js +177 -63
  35. package/dist/cliproxy/quota-manager.js.map +1 -1
  36. package/dist/cliproxy/quota-types.d.ts +16 -2
  37. package/dist/cliproxy/quota-types.d.ts.map +1 -1
  38. package/dist/cliproxy/routing-strategy-http.d.ts +1 -0
  39. package/dist/cliproxy/routing-strategy-http.d.ts.map +1 -1
  40. package/dist/cliproxy/routing-strategy-http.js +7 -2
  41. package/dist/cliproxy/routing-strategy-http.js.map +1 -1
  42. package/dist/cliproxy/routing-strategy.d.ts +23 -0
  43. package/dist/cliproxy/routing-strategy.d.ts.map +1 -1
  44. package/dist/cliproxy/routing-strategy.js +148 -2
  45. package/dist/cliproxy/routing-strategy.js.map +1 -1
  46. package/dist/cliproxy/types.d.ts +3 -0
  47. package/dist/cliproxy/types.d.ts.map +1 -1
  48. package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
  49. package/dist/commands/cliproxy/help-subcommand.js +3 -1
  50. package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
  51. package/dist/commands/cliproxy/index.d.ts.map +1 -1
  52. package/dist/commands/cliproxy/index.js +12 -0
  53. package/dist/commands/cliproxy/index.js.map +1 -1
  54. package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
  55. package/dist/commands/cliproxy/quota-subcommand.js +79 -23
  56. package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
  57. package/dist/commands/cliproxy/routing-subcommand.d.ts +3 -0
  58. package/dist/commands/cliproxy/routing-subcommand.d.ts.map +1 -1
  59. package/dist/commands/cliproxy/routing-subcommand.js +127 -2
  60. package/dist/commands/cliproxy/routing-subcommand.js.map +1 -1
  61. package/dist/commands/completion-backend.d.ts.map +1 -1
  62. package/dist/commands/completion-backend.js +16 -1
  63. package/dist/commands/completion-backend.js.map +1 -1
  64. package/dist/commands/config-dashboard-host.d.ts.map +1 -1
  65. package/dist/commands/config-dashboard-host.js +14 -2
  66. package/dist/commands/config-dashboard-host.js.map +1 -1
  67. package/dist/config/unified-config-loader.d.ts.map +1 -1
  68. package/dist/config/unified-config-loader.js +26 -0
  69. package/dist/config/unified-config-loader.js.map +1 -1
  70. package/dist/config/unified-config-types.d.ts +4 -0
  71. package/dist/config/unified-config-types.d.ts.map +1 -1
  72. package/dist/config/unified-config-types.js +2 -0
  73. package/dist/config/unified-config-types.js.map +1 -1
  74. package/dist/delegation/headless-executor.d.ts.map +1 -1
  75. package/dist/delegation/headless-executor.js +17 -2
  76. package/dist/delegation/headless-executor.js.map +1 -1
  77. package/dist/proxy/transformers/request-transformer.d.ts.map +1 -1
  78. package/dist/proxy/transformers/request-transformer.js +0 -8
  79. package/dist/proxy/transformers/request-transformer.js.map +1 -1
  80. package/dist/targets/target-metadata.js +1 -1
  81. package/dist/targets/target-metadata.js.map +1 -1
  82. package/dist/ui/assets/{accounts-DCJVsC1R.js → accounts-CP_Nosd7.js} +1 -1
  83. package/dist/ui/assets/{alert-dialog-BZtIoyBc.js → alert-dialog-CjnZBDj3.js} +1 -1
  84. package/dist/ui/assets/{api-DNXD8EA9.js → api-B7mmrAjt.js} +1 -1
  85. package/dist/ui/assets/{auth-section-2-a8KRNY.js → auth-section-BFQ8Mu15.js} +1 -1
  86. package/dist/ui/assets/{backups-section-CezuWNFi.js → backups-section-CPwm9q19.js} +1 -1
  87. package/dist/ui/assets/{channels-DaijLXYu.js → channels-B2colnY7.js} +1 -1
  88. package/dist/ui/assets/{checkbox-D6sWns2x.js → checkbox-BAMXPp68.js} +1 -1
  89. package/dist/ui/assets/{claude-extension-BFbvT7N_.js → claude-extension-BDVoXHr-.js} +1 -1
  90. package/dist/ui/assets/{cliproxy-4Z6gEF3R.js → cliproxy-CuLlmDu7.js} +1 -1
  91. package/dist/ui/assets/{cliproxy-ai-providers-BZ0mTP-l.js → cliproxy-ai-providers-8dH1cHVk.js} +1 -1
  92. package/dist/ui/assets/{cliproxy-control-panel-CFFjKRRQ.js → cliproxy-control-panel-CC8HzA8e.js} +1 -1
  93. package/dist/ui/assets/{codex-D9ivkuYH.js → codex-C6Q9rOwp.js} +1 -1
  94. package/dist/ui/assets/{confirm-dialog-CpZGygf5.js → confirm-dialog-D0VQlM7B.js} +1 -1
  95. package/dist/ui/assets/{copilot-DMmn_rxB.js → copilot-CgG2oaRV.js} +1 -1
  96. package/dist/ui/assets/{cursor-D_Q86_Ei.js → cursor-CE1giQU2.js} +1 -1
  97. package/dist/ui/assets/{droid-BAf_vL2l.js → droid-FG2w7nRu.js} +1 -1
  98. package/dist/ui/assets/{globalenv-section-B8jXcXvb.js → globalenv-section-BJbBud4W.js} +1 -1
  99. package/dist/ui/assets/{health-BO8TUGV-.js → health-Dh7o4wt7.js} +1 -1
  100. package/dist/ui/assets/index-0mNJhDEG.js +72 -0
  101. package/dist/ui/assets/{index-CC4Wj5Im.js → index-B6bIHdvz.js} +1 -1
  102. package/dist/ui/assets/{index-BsAeVEGk.js → index-BNTqP5R7.js} +1 -1
  103. package/dist/ui/assets/{index-DwhLYuc2.js → index-BNW5qVXZ.js} +1 -1
  104. package/dist/ui/assets/{index-vlkxIfEe.js → index-Bj8UFR7b.js} +1 -1
  105. package/dist/ui/assets/index-DM5Khyln.css +1 -0
  106. package/dist/ui/assets/{index-mHMlp8Vb.js → index-DTAdzUUA.js} +1 -1
  107. package/dist/ui/assets/index-X21iqV9e.js +1 -0
  108. package/dist/ui/assets/{logs-Be6Ybx9a.js → logs-CxwEaeVS.js} +1 -1
  109. package/dist/ui/assets/masked-input-DygH0M2a.js +1 -0
  110. package/dist/ui/assets/proxy-status-widget-BWjGFUas.js +1 -0
  111. package/dist/ui/assets/{raw-json-settings-editor-panel-Bzz3efQU.js → raw-json-settings-editor-panel-DYpsr-1d.js} +1 -1
  112. package/dist/ui/assets/{searchable-select-DZale_hJ.js → searchable-select-BKx31cCH.js} +1 -1
  113. package/dist/ui/assets/{separator-BkmmPPJc.js → separator-mG07scBE.js} +1 -1
  114. package/dist/ui/assets/{shared-ruYPWqHA.js → shared-hbFOfnWU.js} +1 -1
  115. package/dist/ui/assets/{table-DdulTUSB.js → table-DoECcNZ-.js} +1 -1
  116. package/dist/ui/assets/{updates-COyrJbQd.js → updates-BSeFQRwL.js} +1 -1
  117. package/dist/ui/index.html +2 -2
  118. package/dist/utils/openai-compat-launch-settings.d.ts +7 -0
  119. package/dist/utils/openai-compat-launch-settings.d.ts.map +1 -0
  120. package/dist/utils/openai-compat-launch-settings.js +61 -0
  121. package/dist/utils/openai-compat-launch-settings.js.map +1 -0
  122. package/dist/utils/shell-executor.d.ts +1 -1
  123. package/dist/utils/shell-executor.d.ts.map +1 -1
  124. package/dist/utils/shell-executor.js +11 -1
  125. package/dist/utils/shell-executor.js.map +1 -1
  126. package/dist/web-server/jsonl-parser.d.ts.map +1 -1
  127. package/dist/web-server/jsonl-parser.js +22 -4
  128. package/dist/web-server/jsonl-parser.js.map +1 -1
  129. package/dist/web-server/model-pricing.d.ts +8 -6
  130. package/dist/web-server/model-pricing.d.ts.map +1 -1
  131. package/dist/web-server/model-pricing.js +80 -29
  132. package/dist/web-server/model-pricing.js.map +1 -1
  133. package/dist/web-server/models-dev/pricing-resolver.d.ts +18 -0
  134. package/dist/web-server/models-dev/pricing-resolver.d.ts.map +1 -0
  135. package/dist/web-server/models-dev/pricing-resolver.js +153 -0
  136. package/dist/web-server/models-dev/pricing-resolver.js.map +1 -0
  137. package/dist/web-server/models-dev/registry-cache.d.ts +19 -0
  138. package/dist/web-server/models-dev/registry-cache.d.ts.map +1 -0
  139. package/dist/web-server/models-dev/registry-cache.js +155 -0
  140. package/dist/web-server/models-dev/registry-cache.js.map +1 -0
  141. package/dist/web-server/models-dev/types.d.ts +39 -0
  142. package/dist/web-server/models-dev/types.d.ts.map +1 -0
  143. package/dist/web-server/models-dev/types.js +3 -0
  144. package/dist/web-server/models-dev/types.js.map +1 -0
  145. package/dist/web-server/routes/cliproxy-routing-routes.d.ts.map +1 -1
  146. package/dist/web-server/routes/cliproxy-routing-routes.js +35 -0
  147. package/dist/web-server/routes/cliproxy-routing-routes.js.map +1 -1
  148. package/dist/web-server/usage/aggregator.d.ts +1 -0
  149. package/dist/web-server/usage/aggregator.d.ts.map +1 -1
  150. package/dist/web-server/usage/aggregator.js +121 -20
  151. package/dist/web-server/usage/aggregator.js.map +1 -1
  152. package/dist/web-server/usage/cliproxy-usage-syncer.d.ts +0 -15
  153. package/dist/web-server/usage/cliproxy-usage-syncer.d.ts.map +1 -1
  154. package/dist/web-server/usage/cliproxy-usage-syncer.js +159 -55
  155. package/dist/web-server/usage/cliproxy-usage-syncer.js.map +1 -1
  156. package/dist/web-server/usage/cliproxy-usage-transformer.d.ts +23 -7
  157. package/dist/web-server/usage/cliproxy-usage-transformer.d.ts.map +1 -1
  158. package/dist/web-server/usage/cliproxy-usage-transformer.js +191 -28
  159. package/dist/web-server/usage/cliproxy-usage-transformer.js.map +1 -1
  160. package/dist/web-server/usage/codex-native-usage-collector.d.ts +11 -0
  161. package/dist/web-server/usage/codex-native-usage-collector.d.ts.map +1 -0
  162. package/dist/web-server/usage/codex-native-usage-collector.js +177 -0
  163. package/dist/web-server/usage/codex-native-usage-collector.js.map +1 -0
  164. package/dist/web-server/usage/data-aggregator.d.ts.map +1 -1
  165. package/dist/web-server/usage/data-aggregator.js +45 -46
  166. package/dist/web-server/usage/data-aggregator.js.map +1 -1
  167. package/dist/web-server/usage/droid-native-usage-collector.d.ts +14 -0
  168. package/dist/web-server/usage/droid-native-usage-collector.d.ts.map +1 -0
  169. package/dist/web-server/usage/droid-native-usage-collector.js +201 -0
  170. package/dist/web-server/usage/droid-native-usage-collector.js.map +1 -0
  171. package/dist/web-server/usage/handlers.d.ts +1 -0
  172. package/dist/web-server/usage/handlers.d.ts.map +1 -1
  173. package/dist/web-server/usage/handlers.js +155 -45
  174. package/dist/web-server/usage/handlers.js.map +1 -1
  175. package/dist/web-server/usage/model-identity.d.ts +16 -0
  176. package/dist/web-server/usage/model-identity.d.ts.map +1 -0
  177. package/dist/web-server/usage/model-identity.js +70 -0
  178. package/dist/web-server/usage/model-identity.js.map +1 -0
  179. package/dist/web-server/usage/sqlite-cli.d.ts +3 -0
  180. package/dist/web-server/usage/sqlite-cli.d.ts.map +1 -0
  181. package/dist/web-server/usage/sqlite-cli.js +62 -0
  182. package/dist/web-server/usage/sqlite-cli.js.map +1 -0
  183. package/dist/web-server/usage/types.d.ts +6 -0
  184. package/dist/web-server/usage/types.d.ts.map +1 -1
  185. package/package.json +1 -1
  186. package/scripts/dev-release.sh +4 -2
  187. package/dist/ui/assets/index-8bXW-BpK.js +0 -72
  188. package/dist/ui/assets/index-BXEJ1fT2.css +0 -1
  189. package/dist/ui/assets/index-DcX4r1mv.js +0 -1
  190. package/dist/ui/assets/masked-input-DXnXVYlE.js +0 -1
  191. package/dist/ui/assets/proxy-status-widget-BnvVPoy1.js +0 -1
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as p,c as pe}from"./react-vendor-CNOkPC89.js";import{u as A,a as $,C as g,b as j,S as f,c as x,P as w,B as I,d as _,e as se,f as ge,g as te,h as je,i as ae,j as N,k as D,l as ye,m as Ne,n as we,o as be}from"./index-8bXW-BpK.js";import{a3 as ve,am as re,an as Y,ao as ne,a1 as le,aa as ke,G as Ce,ap as Se,R as De,$ as V,U as $e,Z as ie,v as Le,ae as H,aq as Fe,Y as Re,C as Te,ar as Me,as as Pe}from"./icons-DyorC3Xk.js";import{a as Be,u as U}from"./tanstack-CrmUhA7Z.js";import{K as T,L as Q,f as C,H as Ae}from"./utils-CzKF5WmX.js";import{R as oe,A as Ue,C as qe,X as Oe,Y as Z,T as ce,a as X,P as Ie,b as Ke,c as Ee}from"./charts-BBPXh0Ar.js";import"./notifications-B2HqRBj7.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Ge({data:s,isLoading:t}){const{privacyMode:a}=A(),{t:r}=$();if(t)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[1,2,3,4,5].map(n=>e.jsx(g,{children:e.jsx(j,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"h-4 w-[100px]"}),e.jsx(f,{className:"h-8 w-[80px]"})]}),e.jsx(f,{className:"h-8 w-8 rounded-lg"})]})})},n))});const c=(s?.tokenBreakdown?.cacheCreation?.cost??0)+(s?.tokenBreakdown?.cacheRead?.cost??0),o=s?.totalCost?Math.round(c/s.totalCost*100):0,i=[{title:r("analyticsSummary.totalTokens"),value:s?.totalTokens??0,icon:ve,format:n=>B(n),color:"text-blue-600",bgColor:"bg-blue-100 dark:bg-blue-900/20",subtitle:r("analyticsSummary.totalTokensSubtitle",{input:B(s?.totalInputTokens??0),output:B(s?.totalOutputTokens??0)})},{title:r("analyticsSummary.totalCost"),value:s?.totalCost??0,icon:re,format:n=>`$${n.toFixed(2)}`,color:"text-green-600",bgColor:"bg-green-100 dark:bg-green-900/20",subtitle:r("analyticsSummary.totalCostSubtitle",{value:s?.averageCostPerDay?.toFixed(2)??"0.00"})},{title:r("analyticsSummary.cacheTokens"),value:s?.totalCacheTokens??0,icon:Y,format:n=>B(n),color:"text-cyan-600",bgColor:"bg-cyan-100 dark:bg-cyan-900/20",subtitle:r("analyticsSummary.cacheTokensSubtitle",{cost:c.toFixed(2),percent:o})},{title:r("analyticsSummary.inputCost"),value:s?.tokenBreakdown?.input?.cost??0,icon:ne,format:n=>`$${n.toFixed(2)}`,color:"text-purple-600",bgColor:"bg-purple-100 dark:bg-purple-900/20",subtitle:r("analyticsSummary.tokensSubtitle",{value:B(s?.tokenBreakdown?.input?.tokens??0)})},{title:r("analyticsSummary.outputCost"),value:s?.tokenBreakdown?.output?.cost??0,icon:le,format:n=>`$${n.toFixed(2)}`,color:"text-orange-600",bgColor:"bg-orange-100 dark:bg-orange-900/20",subtitle:r("analyticsSummary.tokensSubtitle",{value:B(s?.tokenBreakdown?.output?.tokens??0)})}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:i.map((n,l)=>{const d=n.icon;return e.jsx(g,{className:"hover:shadow-md transition-shadow",children:e.jsx(j,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between space-x-2",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:n.title}),e.jsx("p",{className:x("text-xl font-bold truncate",a&&w),children:n.format(n.value)}),n.subtitle&&e.jsx("p",{className:x("text-[10px] text-muted-foreground truncate",a&&w),children:n.subtitle})]}),e.jsx("div",{className:x("p-2 rounded-lg shrink-0",n.bgColor),children:e.jsx(d,{className:x("h-4 w-4",n.color)})})]})})},l)})})}function B(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function He({model:s}){const{privacyMode:t}=A(),{t:a}=$(),r=We(s.ioRatio);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold leading-none truncate",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(I,{variant:"secondary",className:"text-[10px] h-5 px-1.5",children:[s.percentage.toFixed(1),"% usage"]}),e.jsxs(I,{variant:r.variant,className:"text-[10px] h-5 px-1.5",children:[s.ioRatio.toFixed(0),":1 I/O"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("p",{className:x("text-lg font-bold",t&&w),children:["$",s.cost.toFixed(2)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:a("analyticsCards.totalCost")})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsx("p",{className:x("text-lg font-bold",t&&w),children:ze(s.tokens)}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:a("analyticsCards.totalTokens")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Token Breakdown"}),e.jsxs("div",{className:x("space-y-1",t&&w),children:[e.jsx(W,{label:"Input",tokens:s.inputTokens,cost:s.costBreakdown.input.cost,color:"#335c67",icon:ne}),e.jsx(W,{label:"Output",tokens:s.outputTokens,cost:s.costBreakdown.output.cost,color:"#fff3b0",icon:le}),e.jsx(W,{label:"Cache Write",tokens:s.cacheCreationTokens,cost:s.costBreakdown.cacheCreation.cost,color:"#e09f3e",icon:Y}),e.jsx(W,{label:"Cache Read",tokens:s.cacheReadTokens,cost:s.costBreakdown.cacheRead.cost,color:"#9e2a2b",icon:Y})]})]}),e.jsxs("div",{className:"p-2.5 rounded-md border bg-muted/20 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium",children:a("analyticsCards.inputOutputRatio")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:r.description})]})]})}function W({label:s,tokens:t,cost:a,color:r,icon:c}){return t===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-1 h-6 rounded-full shrink-0",style:{backgroundColor:r}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:s}),e.jsxs("span",{className:"font-mono text-muted-foreground",children:["$",a.toFixed(3)]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(c,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:_e(t)})]})]})]})}function We(s){return s>=200?{variant:"destructive",description:"Extended thinking or large context loading. Expected for reasoning models."}:s>=50?{variant:"secondary",description:"More input than output. Typical for analysis tasks."}:s>=5?{variant:"outline",description:"Balanced input/output ratio for typical coding tasks."}:{variant:"default",description:"More output than input. Generation-heavy workload."}}function _e(s){return s.toLocaleString()}function ze(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}const Ye="/api";function b(s){const t=s.getFullYear(),a=String(s.getMonth()+1).padStart(2,"0"),r=String(s.getDate()).padStart(2,"0");return`${t}${a}${r}`}const M={summary:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),F(`/usage/summary?${t}`)},trends:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),F(`/usage/daily?${t}`)},hourly:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),F(`/usage/hourly?${t}`)},models:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),F(`/usage/models?${t}`)},sessions:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),s?.limit&&t.append("limit",s.limit.toString()),s?.offset&&t.append("offset",s.offset.toString()),F(`/usage/sessions?${t}`)},monthly:(s,t)=>{const a=new URLSearchParams;return s&&a.append("months",s.toString()),t&&a.append("profile",t),F(`/usage/monthly?${a}`)},refresh:async()=>{if(!(await fetch(`${Ye}/usage/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh usage cache")},status:()=>F("/usage/status"),insights:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),F(`/usage/insights?${t}`)}};async function F(s){const a=await fetch(`/api${s}`,{headers:{"Content-Type":"application/json"}});if(!a.ok){const c=await a.json().catch(()=>({error:"Unknown error"}));throw new Error(c.error||a.statusText)}const r=await a.json();return r.data||r}function Qe(s){return U({queryKey:["usage","summary",s],queryFn:()=>M.summary(s),staleTime:60*1e3})}function Ve(s){return U({queryKey:["usage","trends",s],queryFn:()=>M.trends(s),staleTime:60*1e3})}function Ze(s){return U({queryKey:["usage","hourly",s],queryFn:()=>M.hourly(s),staleTime:60*1e3})}function Xe(s){return U({queryKey:["usage","models",s],queryFn:()=>M.models(s),staleTime:60*1e3})}function Je(){const s=Be();return p.useCallback(async()=>{await M.refresh(),await s.invalidateQueries({queryKey:["usage"]})},[s])}function es(){return U({queryKey:["usage","status"],queryFn:()=>M.status(),staleTime:10*1e3,refetchInterval:30*1e3})}function ss(s){return U({queryKey:["usage","sessions",s],queryFn:()=>M.sessions(s),staleTime:60*1e3})}function ts(){const[s,t]=p.useState({from:T(new Date,30),to:new Date}),[a,r]=p.useState(!1),[c,o]=p.useState(null),[i,n]=p.useState(null),[l,d]=p.useState("daily"),m=Je(),h=p.useCallback(async()=>{r(!0);try{await m()}finally{r(!1)}},[m]),u=p.useMemo(()=>({startDate:s?.from,endDate:s?.to}),[s?.from,s?.to]),{data:S,isLoading:y}=Qe(u),{data:v,isLoading:k}=Ve(u),{data:L,isLoading:q}=Ze(u),{data:R,isLoading:O}=Xe(u),{data:z,isLoading:K}=ss({...u,limit:3}),{data:E}=es(),de=p.useCallback(()=>{const P=new Date;t({from:T(P,1),to:P}),d("hourly")},[]),xe=p.useCallback(P=>{t(P),d("daily")},[]),ue=p.useMemo(()=>E?.lastFetch?Q(new Date(E.lastFetch),{addSuffix:!0}):null,[E?.lastFetch]),me=p.useCallback((P,fe)=>{const G=fe.currentTarget.getBoundingClientRect();n({x:G.left+G.width/2,y:G.top+G.height/2}),o(P)},[]),he=p.useCallback(()=>{o(null),n(null)},[]);return{dateRange:s,isRefreshing:a,viewMode:l,selectedModel:c,popoverPosition:i,summary:S,trends:v,hourlyData:L,models:R,sessions:z,status:E,isSummaryLoading:y,isTrendsLoading:k,isHourlyLoading:q,isModelsLoading:O,isSessionsLoading:K,isLoading:y||k||O||K,handleRefresh:h,handleTodayClick:de,handleDateRangeChange:xe,handleModelClick:me,handlePopoverClose:he,lastUpdatedText:ue}}function as({value:s,onChange:t,presets:a=[{label:"Last 7 days",range:{from:T(new Date,7),to:new Date}},{label:"Last 30 days",range:{from:T(new Date,30),to:new Date}},{label:"Last 90 days",range:{from:T(new Date,90),to:new Date}}],className:r}){const[c,o]=pe.useState(!1),{t:i}=$(),n=l=>!s||!s.from||!s.to||!l.from||!l.to?!1:C(s.from,"yyyy-MM-dd")===C(l.from,"yyyy-MM-dd")&&C(s.to,"yyyy-MM-dd")===C(l.to,"yyyy-MM-dd");return e.jsxs("div",{className:x("flex flex-wrap items-center gap-2",r),children:[a.map(l=>e.jsx(_,{variant:n(l.range)?"default":"outline",size:"sm",onClick:()=>t(l.range),children:l.label},l.label)),e.jsxs(se,{open:c,onOpenChange:o,children:[e.jsx(ge,{asChild:!0,children:e.jsxs(_,{id:"date",variant:"outline",className:x("w-auto min-w-[200px] sm:min-w-[240px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[e.jsx(Se,{className:"mr-2 h-4 w-4"}),s?.from?s.to?e.jsxs(e.Fragment,{children:[C(s.from,"LLL dd, y")," - ",C(s.to,"LLL dd, y")]}):C(s.from,"LLL dd, y"):e.jsx("span",{children:i("dateRangeFilter.pickADate")})]})}),e.jsx(te,{className:"w-auto p-0",align:"end",children:e.jsx(je,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:t,numberOfMonths:2})})]})]})}function rs({dateRange:s,onDateRangeChange:t,onTodayClick:a,onRefresh:r,isRefreshing:c,lastUpdatedText:o,viewMode:i}){const{t:n}=$();return e.jsxs("div",{className:"flex flex-col gap-3 shrink-0 xl:flex-row xl:items-center xl:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:n("analytics.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("analytics.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:justify-end",children:[e.jsx(_,{variant:i==="hourly"?"default":"outline",size:"sm",className:"h-8",onClick:a,children:"24H"}),e.jsx(as,{className:"flex-wrap",value:s,onChange:t,presets:[{label:"7D",range:{from:T(new Date,7),to:new Date}},{label:"30D",range:{from:T(new Date,30),to:new Date}},{label:n("analytics.month"),range:{from:Ae(new Date),to:new Date}},{label:n("analytics.allTime"),range:{from:void 0,to:new Date}}]}),o&&e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:n("analytics.updated",{value:o})}),e.jsx(_,{variant:"outline",size:"sm",className:"gap-2 h-8",onClick:r,disabled:c,children:e.jsx(De,{className:`w-3.5 h-3.5 ${c?"animate-spin":""}`})})]})]})}function ns({data:s,isLoading:t,granularity:a="daily",className:r}){const{privacyMode:c}=A(),{t:o}=$(),i=p.useMemo(()=>!s||s.length===0?[]:s.map(d=>{const m="hour"in d?d.hour:d.date;return{...d,dateFormatted:ls(m,a),costRounded:Number(d.cost.toFixed(4))}}),[s,a]);if(t)return e.jsx(f,{className:x("h-full w-full",r)});if(!s||s.length===0)return e.jsx("div",{className:x("h-full flex items-center justify-center",r),children:e.jsx("p",{className:"text-muted-foreground",children:o(a==="hourly"?"analytics.noDailyUsage":"analytics.noUsageData")})});const n=({x:l,y:d,payload:m,isRight:h})=>{const u=h?`$${m.value}`:J(Number(m.value));return e.jsx("text",{x:l,y:d,dy:4,textAnchor:h?"start":"end",fontSize:12,fill:"currentColor",className:x("fill-muted-foreground",c&&"blur-[4px]"),children:u})};return e.jsx("div",{className:x("w-full h-full",r),children:e.jsx(oe,{width:"100%",height:"100%",children:e.jsxs(Ue,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0080FF",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#0080FF",stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"costGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#00C49F",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#00C49F",stopOpacity:.1})]})]}),e.jsx(qe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Oe,{dataKey:"dateFormatted",tick:{fontSize:12},tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(Z,{yAxisId:"left",orientation:"left",tick:l=>e.jsx(n,{...l,isRight:!1}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(Z,{yAxisId:"right",orientation:"right",tick:l=>e.jsx(n,{...l,isRight:!0}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(ce,{content:({active:l,payload:d,label:m})=>{if(!l||!d||!d.length)return null;const h=d[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-lg",children:[e.jsx("p",{className:"font-medium mb-2",children:m}),d.map((u,S)=>e.jsxs("p",{className:x("text-sm",c&&w),style:{color:u.color},children:[u.name,":"," ",u.name==="Tokens"?J(Number(u.value)||0):`$${u.value}`]},S)),"requests"in h&&e.jsxs("p",{className:x("text-sm text-muted-foreground mt-1",c&&w),children:["Requests: ",h.requests]})]})}}),e.jsx(X,{yAxisId:"left",type:"monotone",dataKey:"tokens",stroke:"#0080FF",strokeWidth:2,fillOpacity:1,fill:"url(#tokenGradient)",name:"Tokens"}),e.jsx(X,{yAxisId:"right",type:"monotone",dataKey:"costRounded",stroke:"#00C49F",strokeWidth:2,fillOpacity:1,fill:"url(#costGradient)",name:"Cost"})]})})})}function ls(s,t){if(t==="hourly"){const[r,c]=s.split(" ");if(r&&c){const o=new Date(`${r}T${c}:00Z`);return C(o,"HH:mm")}return s}const a=new Date(s);return t==="monthly"?C(a,"MMM yyyy"):C(a,"MMM dd")}function J(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function is({data:s,isLoading:t,className:a}){const{privacyMode:r}=A(),{t:c}=$(),o=p.useMemo(()=>!s||s.length===0?[]:s.map(l=>({name:l.model,value:l.tokens,cost:l.cost,percentage:l.percentage,fill:ae(l.model)})),[s]);if(t)return e.jsx(f,{className:x("h-full min-h-[100px] w-full",a)});if(!s||s.length===0)return e.jsx("div",{className:x("h-full min-h-[100px] flex items-center justify-center",a),children:e.jsx("p",{className:"text-muted-foreground",children:c("analyticsCards.noModelData")})});const i=({active:l,payload:d})=>{if(!l||!d)return null;const m=d;if(!m.length)return null;const h=m[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-lg text-xs",children:[e.jsx("p",{className:"font-medium mb-1",children:h.name}),e.jsxs("p",{className:x("text-muted-foreground",r&&w),children:[os(h.value)," (",h.percentage.toFixed(1),"%)"]}),e.jsxs("p",{className:x("text-muted-foreground",r&&w),children:["$",h.cost.toFixed(4)]})]})},n=l=>l.percentage>5?`${l.percentage.toFixed(1)}%`:"";return e.jsx("div",{className:x("w-full h-full min-h-[100px]",a),children:e.jsx(oe,{width:"100%",height:"100%",children:e.jsxs(Ie,{children:[e.jsx(Ke,{data:o,cx:"50%",cy:"50%",labelLine:!1,label:n,innerRadius:50,outerRadius:70,paddingAngle:2,dataKey:"value",children:o.map((l,d)=>e.jsx(Ee,{fill:l.fill,strokeWidth:1},`cell-${d}`))}),e.jsx(ce,{content:i})]})})})}function os(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function cs(s){if(!s)return"";const a=s.replace(/^\/|\/$/g,"").split("/").filter(r=>r.length>0);return a[a.length-1]||""}function ds({data:s,isLoading:t,className:a}){const{privacyMode:r}=A(),{t:c}=$(),o=p.useMemo(()=>{if(!s?.sessions||s.sessions.length===0)return null;const i=s.sessions,n=s.total,l=i.reduce((y,v)=>y+(v.inputTokens+v.outputTokens),0),d=Math.round(l/i.length),h=i.reduce((y,v)=>y+v.cost,0)/i.length,u=i[0],S=u?Q(new Date(u.lastActivity),{addSuffix:!0}):"N/A";return{totalSessions:n,avgTokens:d,avgCost:h,lastActive:S,recentSessions:i.slice(0,3)}},[s]);return t?e.jsxs(g,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsx(f,{className:"h-5 w-32"})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx(f,{className:"h-full w-full"})})]}):o?e.jsxs(g,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(V,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsxs(j,{className:"px-3 pb-3 pt-0 flex-1 min-h-0 flex flex-col gap-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-blue-600 dark:text-blue-400",children:[e.jsx($e,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xl font-bold",children:o.totalSessions})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Total Sessions"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(ie,{className:"w-4 h-4"}),e.jsxs("span",{className:x("text-xl font-bold",r&&w),children:["$",o.avgCost.toFixed(2)]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Avg Cost/Session"})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-medium mb-1",children:[e.jsx(Le,{className:"w-3 h-3"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-1.5 max-h-full overflow-y-auto pr-1",children:o.recentSessions.map(i=>e.jsxs("div",{className:"flex items-center justify-between text-xs p-1.5 rounded bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium truncate",title:i.projectPath,children:cs(i.projectPath)}),(i.target??"claude")!=="claude"&&e.jsx("span",{className:"shrink-0 px-1 py-0 text-[9px] font-medium rounded bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300 uppercase",children:i.target})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:Q(new Date(i.lastActivity),{addSuffix:!0})})]}),e.jsxs("div",{className:x("text-right shrink-0 ml-2",r&&w),children:[e.jsxs("div",{className:"font-mono",children:["$",i.cost.toFixed(2)]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[xs(i.inputTokens+i.outputTokens)," toks"]})]})]},i.sessionId))})]})]})]}):e.jsxs(g,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(V,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:c("analyticsCards.noSessionData")})})]})}function xs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function us({className:s,isLoading:t}){const{data:a,isLoading:r}=ye(),{data:c,isLoading:o,error:i}=Ne(a?.running),{t:n}=$();if(t||r||a?.running&&o)return e.jsxs(g,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4"}),"CLIProxy Stats"]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"h-4 w-[100px]"}),e.jsx(f,{className:"h-16 w-full"})]})})]});if(!a?.running)return e.jsxs(g,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-dashed",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-muted-foreground"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"secondary",className:"text-[10px] h-5",children:n("cliproxyStatsOverview.offline")})]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:n("cliproxyStatsOverview.noActiveSessionHint")})})]});if(i)return e.jsxs(g,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-destructive/50",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx("p",{className:"text-xs text-destructive",children:i.message})})]});const d=c?.totalRequests??0,m=c?.quotaExceededCount??0,h=d-m,u=d>0?Math.round(h/d*100):100,S=c?.tokens?.total??0,y=Object.entries(c?.requestsByModel??{}).sort((k,L)=>L[1]-k[1]).slice(0,4),v=y.length>0?y[0][1]:1;return e.jsxs(g,{className:x("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(N,{className:"px-3 py-2 border-b bg-muted/5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsxs(I,{variant:"outline",className:"text-[10px] h-5 text-green-600 border-green-200 bg-green-50 dark:bg-green-900/10 dark:border-green-800",children:[e.jsx(ie,{className:"h-3 w-3 mr-0.5"}),n("cliproxyStatsOverview.running")]})]})}),e.jsx(j,{className:"p-0 flex-1 min-h-0",children:e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"w-10 h-10 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted/30"}),e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${u*.88} 88`,strokeLinecap:"round",className:u>=90?"text-green-500":"text-amber-500"})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[8px] font-bold",children:[u,"%"]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:ee(d)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:m>0?`${m} failed`:"All success"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-purple-100 dark:bg-purple-900/20",children:e.jsx(Fe,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:ee(S)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:n("cliproxyStatsOverview.totalTokens")})]})]})]}),y.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[e.jsx(Re,{className:"h-3 w-3"}),n("cliproxyStatsOverview.modelsUsed")]}),e.jsx("div",{className:"space-y-1",children:y.map(([k,L])=>{const q=Math.round(L/v*100),R=ms(k);return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] mb-0.5",children:[e.jsx("span",{className:"truncate font-medium",title:k,children:R}),e.jsx("span",{className:"text-muted-foreground shrink-0 ml-2",children:L})]}),e.jsx("div",{className:"h-1 bg-muted/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent/70 rounded-full transition-all",style:{width:`${q}%`}})})]},k)})})]})]})})})]})}function ee(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function ms(s){let t=s.replace(/^gemini-claude-/,"").replace(/^gemini-/,"").replace(/^claude-/,"").replace(/^anthropic\./,"").replace(/-thinking$/," Thinking");return t=t.split(/[-_]/).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),t.length>20&&(t=t.slice(0,18)+"..."),t}function hs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString()}function fs({models:s,isLoading:t,onModelClick:a,privacyMode:r}){const{t:c}=$();return e.jsxs(g,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-4",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(re,{className:"w-4 h-4"}),c("analyticsPages.costByModel")]})}),e.jsx(j,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 overflow-y-auto",children:t?e.jsx(f,{className:"h-full w-full"}):e.jsxs("div",{className:"space-y-0.5",children:[[...s||[]].sort((o,i)=>i.cost-o.cost).map(o=>e.jsxs("button",{className:"group flex items-center text-xs w-full hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer gap-3",onClick:i=>a(o,i),title:"Click for details",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-[180px] shrink-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:ae(o.model)}}),e.jsx("span",{className:"font-medium truncate group-hover:underline underline-offset-2",children:o.model})]}),e.jsx(ps,{model:o}),e.jsx("span",{className:x("text-[10px] text-muted-foreground w-14 text-right shrink-0",r&&w),children:hs(o.tokens)}),e.jsxs("span",{className:x("font-mono font-medium w-16 text-right shrink-0",r&&w),children:["$",o.cost.toFixed(2)]}),e.jsx(Te,{className:"w-3 h-3 opacity-0 group-hover:opacity-50 transition-opacity shrink-0"})]},o.model)),e.jsx(gs,{})]})})]})}function ps({model:s}){const t={input:"#335c67",output:"#fff3b0",cacheWrite:"#e09f3e",cacheRead:"#9e2a2b"},a=r=>s.cost>0?r/s.cost*100:0;return e.jsx("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:e.jsxs("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full",style:{backgroundColor:t.input,width:`${a(s.costBreakdown.input.cost)}%`},title:`Input: $${s.costBreakdown.input.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.output,width:`${a(s.costBreakdown.output.cost)}%`},title:`Output: $${s.costBreakdown.output.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheWrite,width:`${a(s.costBreakdown.cacheCreation.cost)}%`},title:`Cache Write: $${s.costBreakdown.cacheCreation.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheRead,width:`${a(s.costBreakdown.cacheRead.cost)}%`},title:`Cache Read: $${s.costBreakdown.cacheRead.cost.toFixed(2)}`})]})})}function gs(){const s=[{color:"#335c67",label:"Input"},{color:"#fff3b0",label:"Output",hasBorder:!0},{color:"#e09f3e",label:"Cache Write"},{color:"#9e2a2b",label:"Cache Read"}];return e.jsx("div",{className:"flex items-center gap-3 pt-2 px-2 text-[10px] text-muted-foreground border-t mt-2",children:s.map(({color:t,label:a,hasBorder:r})=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:x("w-2 h-2 rounded-full",r&&"border border-muted-foreground/30"),style:{backgroundColor:t}}),a]},a))})}function js({viewMode:s,trends:t,hourlyData:a,models:r,sessions:c,isTrendsLoading:o,isHourlyLoading:i,isModelsLoading:n,isSessionsLoading:l,isSummaryLoading:d,onModelClick:m}){const{privacyMode:h}=A();return e.jsxs("div",{className:"min-h-0 grid gap-4 lg:grid-rows-[minmax(260px,1.2fr)_minmax(220px,0.9fr)]",children:[e.jsxs(g,{className:"flex flex-col h-full min-h-[220px] lg:min-h-[240px] overflow-hidden gap-0 py-0 shadow-sm",children:[e.jsx(N,{className:"px-3 py-2 shrink-0",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Me,{className:"w-4 h-4"}),s==="hourly"?"Last 24 Hours":"Usage Trends"]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1 min-h-0",children:e.jsx(ns,{data:s==="hourly"?a||[]:t||[],isLoading:s==="hourly"?i:o,granularity:s==="hourly"?"hourly":"daily"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-4 h-auto min-h-[220px] lg:h-full lg:min-h-[220px] lg:grid-rows-[minmax(0,1fr)] lg:[&>*]:min-h-0",children:[e.jsx(fs,{models:r,isLoading:n,onModelClick:m,privacyMode:h}),e.jsxs(g,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-2",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Pe,{className:"w-4 h-4"}),"Model Usage"]})}),e.jsx(j,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 flex items-center justify-center",children:e.jsx(is,{data:r||[],isLoading:n,className:"h-full w-full"})})]}),e.jsx(ds,{data:c,isLoading:l,className:"lg:col-span-2"}),e.jsx(us,{isLoading:d,className:"lg:col-span-2"})]})]})}function Ls(){return e.jsxs("div",{className:"space-y-4 h-full overflow-hidden",children:[e.jsxs(g,{className:"flex flex-col min-h-[300px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(f,{className:"h-4 w-32"})}),e.jsx(j,{className:"p-4 pt-0 flex-1",children:e.jsx(f,{className:"h-full w-full"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(g,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(f,{className:"h-4 w-28"})}),e.jsx(j,{className:"p-4 pt-2",children:e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"w-2.5 h-2.5 rounded-full"}),e.jsx(f,{className:"h-3 w-24"})]}),e.jsx(f,{className:"h-3 w-16"})]},s))})})]}),e.jsxs(g,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(f,{className:"h-4 w-28"})}),e.jsx(j,{className:"p-4 pt-0 flex-1",children:e.jsxs("div",{className:"flex w-full h-full items-center",children:[e.jsx("div",{className:"flex-1 flex justify-center",children:e.jsx(f,{className:"h-[180px] w-[180px] rounded-full"})}),e.jsx("div",{className:"w-[140px] shrink-0 pl-2 space-y-2",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"w-2 h-2 rounded-full"}),e.jsx(f,{className:"h-3 w-20"})]},s))})]})})]})]})]})}function Fs(){const s=p.useRef(null),{dateRange:t,handleDateRangeChange:a,handleTodayClick:r,handleRefresh:c,isRefreshing:o,lastUpdatedText:i,viewMode:n,summary:l,isSummaryLoading:d,trends:m,hourlyData:h,models:u,sessions:S,isTrendsLoading:y,isHourlyLoading:v,isModelsLoading:k,isSessionsLoading:L,handleModelClick:q,selectedModel:R,popoverPosition:O,handlePopoverClose:z}=ts();return e.jsxs("div",{className:"grid h-full min-h-0 grid-rows-[auto_auto_minmax(0,1fr)] gap-4 overflow-y-auto px-4 py-4",children:[e.jsx(rs,{dateRange:t,onDateRangeChange:a,onTodayClick:r,onRefresh:c,isRefreshing:o,lastUpdatedText:i,viewMode:n}),e.jsx(Ge,{data:l,isLoading:d}),e.jsx(js,{viewMode:n,trends:m,hourlyData:h,models:u,sessions:S,isTrendsLoading:y,isHourlyLoading:v,isModelsLoading:k,isSessionsLoading:L,isSummaryLoading:d,onModelClick:q}),e.jsxs(se,{open:!!R,onOpenChange:K=>!K&&z(),children:[e.jsx(be,{asChild:!0,children:e.jsx("div",{ref:s,className:"fixed pointer-events-none",style:{left:O?.x??0,top:O?.y??0,width:1,height:1}})}),e.jsx(te,{className:"w-80 p-3",side:"top",align:"center",children:R&&e.jsx(He,{model:R})})]})]})}export{Fs as AnalyticsPage,Ls as AnalyticsSkeleton};
@@ -1 +0,0 @@
1
- import{j as s}from"./radix-ui-Zb8sVEtn.js";import{r}from"./react-vendor-CNOkPC89.js";import{I as i,d as m}from"./index-8bXW-BpK.js";import{E as l,g as n}from"./icons-DyorC3Xk.js";function f({label:e,...a}){const[t,o]=r.useState(!1);return s.jsxs("div",{className:"space-y-1",children:[e&&s.jsx("label",{className:"text-sm font-medium",children:e}),s.jsxs("div",{className:"relative",children:[s.jsx(i,{type:t?"text":"password",className:"pr-10 font-mono",...a}),s.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>o(!t),tabIndex:-1,children:t?s.jsx(l,{className:"w-4 h-4"}):s.jsx(n,{className:"w-4 h-4"})})]})]})}export{f as M};
@@ -1 +0,0 @@
1
- import{j as t}from"./radix-ui-Zb8sVEtn.js";import{g as Ve,r as w}from"./react-vendor-CNOkPC89.js";import{bB as be,bC as je,bD as ve,bE as $e,bF as M,bG as te,bH as L,bI as Oe,bJ as We,a as ce,c as O,B as H,d as K,bx as _e,aZ as De,bK as Ie,bL as Re,bM as Fe,bN as Le,bO as Ue,bP as Me,bQ as qe,aM as ze,M as Be,O as He,r as Ge,s as Ke,t as Ze,v as Qe,w as Ye,T as Je,p as Xe,q as et,Y as tt}from"./index-8bXW-BpK.js";import{A as st,a as nt,b as rt,c as at,d as it,e as ot,f as lt,g as ct}from"./alert-dialog-BZtIoyBc.js";import{u as Ne,a as ut,b as dt,h as mt}from"./tanstack-CrmUhA7Z.js";import{t as se}from"./notifications-B2HqRBj7.js";import{be as xe,R as G,t as xt,s as pt,u as gt,A as ft,bf as ht,bg as yt,bh as bt,X as jt,e as vt,bi as Nt,bj as St,U as wt,v as Ct,m as kt,w as At,aF as Et,T as ne,aP as Pt}from"./icons-DyorC3Xk.js";var re,pe;function Tt(){return pe||(pe=1,re={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),re}var Vt=Tt();const $t=Ve(Vt);var Ot=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ge(e){var s={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(s.name=n[1],($t[n[1]]||e.charAt(e.length-2)==="/")&&(s.voidElement=!0),s.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Ot),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),s.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(s.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return s}var Wt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,_t=/^\s*$/,Dt=Object.create(null);function Se(e,s){switch(s.type){case"text":return e+s.content;case"tag":return e+="<"+s.name+(s.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(s.attrs):"")+(s.voidElement?"/>":">"),s.voidElement?e:e+s.children.reduce(Se,"")+"</"+s.name+">";case"comment":return e+"<!--"+s.comment+"-->"}}var It={parse:function(e,s){s||(s={}),s.components||(s.components=Dt);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(Wt,function(u,d){if(o){if(u!=="</"+n.name+">")return;o=!1}var p,v=u.charAt(1)!=="/",k=u.startsWith("<!--"),h=d+u.length,f=e.charAt(h);if(k){var V=ge(u);return i<0?(r.push(V),r):((p=a[i]).children.push(V),r)}if(v&&(i++,(n=ge(u)).type==="tag"&&s.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!f||f==="<"||n.children.push({type:"text",content:e.slice(h,e.indexOf("<",h))}),i===0&&r.push(n),(p=a[i-1])&&p.children.push(n),a[i]=n),(!v||n.voidElement)&&(i>-1&&(n.voidElement||n.name===u.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&f!=="<"&&f)){p=i===-1?r:a[i].children;var m=e.indexOf("<",h),x=e.slice(h,m===-1?void 0:m);_t.test(x)&&(x=" "),(m>-1&&i+p.length>=0||x!==" ")&&p.push({type:"text",content:x})}}),r},stringify:function(e){return e.reduce(function(s,n){return s+Se("",n)},"")}};const Q=(e,s)=>{if(!e)return!1;const n=e.props?.children??e.children;return s?n.length>0:!!n},Y=e=>{if(!e)return[];const s=e.props?.children??e.children;return e.props?.i18nIsDynamicList?U(s):s},Rt=e=>Array.isArray(e)&&e.every(w.isValidElement),U=e=>Array.isArray(e)?e:[e],Ft=(e,s)=>{const n={...s};return n.props={...s.props,...e.props},n},Lt=e=>{const s={};if(!e)return s;const n=r=>{U(r).forEach(i=>{M(i)||(Q(i)?n(Y(i)):L(i)&&!w.isValidElement(i)&&Object.assign(s,i))})};return n(e),s},we=(e,s,n,r)=>{if(!e)return"";let a="";const i=U(e),o=s?.transSupportBasicHtmlNodes?s.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,u)=>{if(M(c)){a+=`${c}`;return}if(w.isValidElement(c)){const{props:d,type:p}=c,v=Object.keys(d).length,k=o.indexOf(p)>-1,h=d.children;if(!h&&k&&!v){a+=`<${p}/>`;return}if(!h&&(!k||v)||d.i18nIsDynamicList){a+=`<${u}></${u}>`;return}if(k&&v===1&&M(h)){a+=`<${p}>${h}</${p}>`;return}const f=we(h,s,n,r);a+=`<${u}>${f}</${u}>`;return}if(c===null){te(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:d,...p}=c,v=Object.keys(p);if(v.length===1){const k=d?`${v[0]}, ${d}`:v[0];a+=`{{${k}}}`;return}te(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}te(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Ut=(e,s=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...s,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const u=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(u){const d=u[1];(/^\d+$/.test(d)||a.includes(d))&&(c=!0,i+=u[0],o+=u[0].length)}if(!c){const d=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(d){const p=d[1];(/^\d+$/.test(p)||a.includes(p))&&(c=!0,i+=d[0],o+=d[0].length)}}c||(i+="&lt;",o+=1)}else i+=e[o],o+=1;return i},Mt=(e,s,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(c.map(g=>`<${g}`).join("|")).test(n);if(!e&&!s&&!u&&!o)return[n];const d=s??{},p=g=>{U(g).forEach(C=>{M(C)||(Q(C)?p(Y(C)):L(C)&&!w.isValidElement(C)&&Object.assign(d,C))})};p(e);const v=Ut(n,c,d),k=It.parse(`<0>${v}</0>`),h={...d,...i},f=(g,N,C)=>{const A=Y(g),$=m(A,N.children,C);return Rt(A)&&$.length===0||g.props?.i18nIsDynamicList?A:$},V=(g,N,C,A,$)=>{g.dummy?(g.children=N,C.push(w.cloneElement(g,{key:A},$?void 0:N))):C.push(...w.Children.map([g],y=>{const l="data-i18n-is-dynamic-list",P={key:A,[l]:void 0};return y&&y.props&&Object.keys(y.props).forEach(E=>{E==="ref"||E==="children"||E==="i18nIsDynamicList"||E===l||(P[E]=y.props[E])}),w.cloneElement(y,P,$?null:N)}))},m=(g,N,C)=>{const A=U(g);return U(N).reduce((y,l,P)=>{const E=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,h,r.language);if(l.type==="tag"){let T=A[parseInt(l.name,10)];!T&&s&&(T=s[l.name]),C.length===1&&!T&&(T=C[0][l.name]),T||(T={});const W={...l.attrs};o&&Object.keys(W).forEach(b=>{const F=W[b];M(F)&&(W[b]=Oe(F))});const j=Object.keys(W).length!==0?Ft({props:W},T):T,_=w.isValidElement(j),D=_&&Q(l,!0)&&!l.voidElement,R=u&&L(j)&&j.dummy&&!_,q=L(s)&&Object.hasOwnProperty.call(s,l.name);if(M(j)){const b=r.services.interpolator.interpolate(j,h,r.language);y.push(b)}else if(Q(j)||D){const b=f(j,l,C);V(j,b,y,P)}else if(R){const b=m(A,l.children,C);V(j,b,y,P)}else if(Number.isNaN(parseFloat(l.name)))if(q){const b=f(j,l,C);V(j,b,y,P,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)y.push(w.createElement(l.name,{key:`${l.name}-${P}`}));else{const b=m(A,l.children,C);y.push(w.createElement(l.name,{key:`${l.name}-${P}`},b))}else if(l.voidElement)y.push(`<${l.name} />`);else{const b=m(A,l.children,C);y.push(`<${l.name}>${b}</${l.name}>`)}else if(L(j)&&!_){const b=l.children[0]?E:null;b&&y.push(b)}else V(j,E,y,P,l.children.length!==1||!E)}else if(l.type==="text"){const T=a.transWrapTextNodes,W=typeof a.unescape=="function"?a.unescape:ve().unescape,j=o?W(r.services.interpolator.interpolate(l.content,h,r.language)):r.services.interpolator.interpolate(l.content,h,r.language);T?y.push(w.createElement(T,{key:`${l.name}-${P}`},j)):y.push(j)}return y},[])},x=m([{dummy:!0,children:e||[]}],k,U(e||[]));return Y(x[0])},Ce=(e,s,n)=>{const r=e.key||s,a=w.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${s}/>`)<0&&n.indexOf(`${s} />`)<0)return a;function i(){return w.createElement(w.Fragment,null,a)}return w.createElement(i,{key:r})},qt=(e,s)=>e.map((n,r)=>Ce(n,r,s)),zt=(e,s)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Ce(e[r],r,s)})}),n},Bt=(e,s,n,r)=>e?Array.isArray(e)?qt(e,s):L(e)?zt(e,s):(be(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Ht=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((s,n)=>s&&Number.isNaN(Number.parseFloat(n)),!0);function Gt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:u,ns:d,i18n:p,t:v,shouldUnescape:k,...h}){const f=p||je();if(!f)return be(f,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const V=v||f.t.bind(f)||(z=>z),m={...ve(),...f.options?.react};let x=d||V.ns||f.options?.defaultNS;x=M(x)?[x]:x||["translation"];const{transDefaultProps:g}=m,N=g?.tOptions?{...g.tOptions,...i}:i,C=k??g?.shouldUnescape,A=g?.values?{...g.values,...o}:o,$=g?.components?{...g.components,...u}:u,y=we(e,m,f,r),l=c||N?.defaultValue||y||m.transEmptyNodeValue||(typeof r=="function"?$e(r):r),{hashTransKey:P}=m,E=r||(P?P(y||l):y||l);f.options?.interpolation?.defaultVariables?o=A&&Object.keys(A).length>0?{...A,...f.options.interpolation.defaultVariables}:{...f.options.interpolation.defaultVariables}:o=A;const T=Lt(e);T&&typeof T.count=="number"&&s===void 0&&(s=T.count);const W=o||s!==void 0&&!f.options?.interpolation?.alwaysFormat||!e?N.interpolation:{interpolation:{...N.interpolation,prefix:"#$?",suffix:"?$#"}},j={...N,context:a||N.context,count:s,...o,...W,defaultValue:l,ns:x};let _=E?V(E,j):l;_===E&&l&&(_=l);const D=Bt($,_,f,r);let R=D||e,q=null;Ht(D)&&(q=D,R=e);const b=Mt(R,q,_,f,m,j,C),F=n??m.defaultTransParent;return F?w.createElement(F,h,b):b}function fe({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:u,ns:d,i18n:p,t:v,shouldUnescape:k,...h}){const{i18n:f,defaultNS:V}=w.useContext(We)||{},m=p||f||je(),x=v||m?.t.bind(m);return Gt({children:e,count:s,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:u,ns:d||x?.ns||V||m?.options?.defaultNS,i18n:m,t:v,shouldUnescape:k,...h})}async function Kt(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let s="Failed to fetch sync status";try{const n=await e.json();s=n.error||n.message||s}catch{}throw new Error(s)}return e.json()}async function Zt(){const e=new AbortController,s=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(s)}}function Qt(){return Ne({queryKey:["cliproxy-sync-status"],queryFn:Kt,refetchInterval:3e4,retry:1,staleTime:1e4})}function Yt(){const e=ut(),{t:s}=ce();return dt({mutationFn:Zt,onSuccess:n=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?se.info(s("toasts.noProfilesToSync")):se.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{se.error(s("toasts.syncFailed",{error:n.message}))}})}function he(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function le(e,s){const n=he(e),r=he(s);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function ae(e,s){return le(e,s)>0}function ie(e,s,n){return le(e,s)>=0&&le(e,n)<=0}const oe={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function ye({className:e,compact:s=!1,state:n,isLoading:r,isSaving:a,error:i,onApply:o}){const{t:c}=ce(),u=n?.strategy??"round-robin",[d,p]=w.useState(u),[v,k]=w.useState(!1),h=n?.source==="live"?"Live CLIProxy":"Saved startup default",f=r||a||!n||d===u,V=v?"Hide details":"Show details";if(s){const m=x=>{p(x),x!==u&&o(x)};return t.jsxs("div",{className:O("group/routing flex items-center justify-between mt-1 p-1 -mx-1 rounded-lg transition-colors hover:bg-primary/5",e),children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[t.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[t.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),t.jsx(xe,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),t.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),a&&t.jsx(G,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),t.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[t.jsx("div",{className:O("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",d==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(oe).map(([x,g])=>{const N=d===x;return t.jsx("button",{type:"button",className:O("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",N?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>m(x),disabled:r||a||!!i,title:g.description,children:g.title},x)})]})]})}return t.jsx("section",{className:O("rounded-xl border border-border/70 bg-background",e),children:t.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[t.jsxs("div",{className:"min-w-0 space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:t.jsx(xe,{className:"h-4 w-4"})}),t.jsx("div",{className:"text-sm font-medium",children:c("routingGuidance.routingStrategy")}),t.jsx(H,{variant:"secondary",children:u}),n?t.jsx(H,{variant:"outline",children:h}):null,n?t.jsx(H,{variant:"outline",children:n.target}):null]}),t.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."})]}),t.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[t.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(oe).map(([m,x])=>{const g=d===m;return t.jsx("button",{type:"button",className:O("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",g?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>p(m),disabled:r||a||!!i,children:x.title},m)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(K,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>k(m=>!m),children:[v?t.jsx(xt,{className:"mr-1 h-3.5 w-3.5"}):t.jsx(pt,{className:"mr-1 h-3.5 w-3.5"}),V]}),t.jsx(K,{size:"sm",onClick:()=>o(d),disabled:f||!!i,children:a?"Saving...":`Use ${d}`})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[t.jsx("span",{children:c("routingGuidance.roundRobin")}),t.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),t.jsx("span",{children:c("routingGuidance.fillFirst")})]}),i?t.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:i.message}):null,!i&&n?.message?t.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,v?t.jsx("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:Object.entries(oe).map(([m,x])=>{const g=u===m;return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("div",{className:"text-sm font-medium",children:x.title}),g?t.jsx(H,{variant:"secondary",children:"Current"}):null]}),t.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:x.description})]},m)})}):null]})})}function Jt(e){if(!e)return"";const s=new Date(e).getTime(),r=Date.now()-s,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function Xt(e,s){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?s("proxyStatusWidget.justNow"):r<60?s("proxyStatusWidget.minutesAgo",{count:r}):s("proxyStatusWidget.hoursAgo",{count:a})}function Z({icon:e,tooltip:s,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return t.jsxs(Je,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(K,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:O("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?t.jsx(G,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(e,{className:"w-3.5 h-3.5"})})}),t.jsx(et,{side:"bottom",className:"text-xs",children:s})]})}function os(){const{t:e}=ce(),{data:s,isLoading:n}=_e(),{data:r}=De(),{data:a,isLoading:i}=Ie(),{data:o,isLoading:c,error:u}=Re(),d=Fe(),p=Le(),v=Ue(),k=Me(),h=qe(),{data:f}=Qt(),{mutate:V,isPending:m}=Yt(),[x,g]=w.useState(!1),[N,C]=w.useState(""),[A,$]=w.useState(!1),[y,l]=w.useState(null),[P,E]=w.useState(null),{data:T}=Ne({queryKey:["cliproxy-server-config"],queryFn:()=>tt.cliproxyServer.get(),staleTime:3e4}),W=mt({mutationKey:["update-backend"]})>0,j=T?.remote,_=j?.enabled&&j?.host,D=s?.running??!1,R=p.isPending||v.isPending||k.isPending||h.isPending||W||m,q=r?.hasUpdate??!1,b=r?.isStable===!1,F=r?.currentVersion,z=f?.configured??!1,ke=e(z?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),J=b?r?.maxStableVersion||a?.latestStable:r?.latestVersion,ue=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",B=a?.faultyRange,Ae=B&&`${B.min.replace(/-\d+$/,"")}-${B.max.replace(/-\d+$/,"")}`,X=(S,I)=>{l(S),E(I),$(!0)},de=async S=>{if(!S)return;const I=ae(S,ue);if(B!==void 0&&ie(S,B.min,B.max)){X(S,"faulty");return}if(I){X(S,"experimental");return}try{const me=await h.mutateAsync({version:S});me.requiresConfirmation&&X(S,me.isFaulty?"faulty":"experimental")}catch{}},Ee=()=>{y&&h.mutate({version:y,force:!0}),$(!1),l(null),E(null)},Pe=()=>{$(!1),l(null),E(null)},Te=_?(()=>{const S=j.protocol||"http",I=j.port||(S==="https"?443:80);return S==="https"&&I===443||S==="http"&&I===80?j.host:`${j.host}:${I}`})():null;return _?t.jsxs("div",{className:O("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(gt,{className:"w-4 h-4 text-blue-500"}),t.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),t.jsx(H,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:e("proxyStatusWidget.active")})]}),t.jsx(ft,{className:"w-3 h-3 text-blue-600"})]}),t.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[t.jsx("div",{className:"flex items-center gap-1 mb-1",children:t.jsx("span",{className:"font-mono",children:Te})}),t.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]}),t.jsx(ye,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:d.isPending,error:u instanceof Error?u:null,onApply:S=>d.mutate(S)},`remote:${o?.strategy??"round-robin"}`)]}):t.jsx(ze,{delayDuration:300,children:t.jsxs("div",{className:O("rounded-lg border p-3 transition-colors",D?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:O("w-2 h-2 rounded-full",D?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),t.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[n?t.jsx(G,{className:"w-3 h-3 animate-spin text-muted-foreground"}):D?t.jsxs(t.Fragment,{children:[t.jsx(Z,{icon:m?G:ht,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>V(),disabled:!z||R,isPending:m}),t.jsx(Z,{icon:yt,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>k.mutate(),disabled:R,isPending:k.isPending}),t.jsx(Z,{icon:bt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>v.mutate(),disabled:R,isPending:v.isPending,variant:"destructive-ghost"})]}):null,t.jsx(Z,{icon:x?jt:vt,tooltip:e(x?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>g(!x),className:x?"bg-muted":void 0})]})]}),F&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[t.jsxs("span",{className:O("text-xs font-mono text-muted-foreground",b&&"text-amber-600 dark:text-amber-400"),children:["v",F]}),(q||b)&&J&&t.jsxs(H,{variant:"secondary",className:O("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",b?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void de(J),title:e(b?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[b?t.jsx(Nt,{className:"w-2.5 h-2.5"}):t.jsx(St,{className:"w-2.5 h-2.5"}),J]})]}),D&&s&&t.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[t.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ct,{className:"w-3 h-3"}),Jt(s.startedAt)]})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[z?t.jsx(kt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):t.jsx(At,{className:"w-3 h-3 text-muted-foreground"}),t.jsx("span",{className:O("text-xs",z?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ke})]}),t.jsx(ye,{compact:!0,className:"mt-3",state:o,isLoading:c,isSaving:d.isPending,error:u instanceof Error?u:null,onApply:S=>d.mutate(S)},`local:${o?.strategy??"round-robin"}`),t.jsx(Be,{open:x,onOpenChange:g,children:t.jsxs(He,{className:"mt-3 pt-3 border-t border-muted",children:[t.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(Ge,{value:N,onValueChange:C,disabled:i,children:[t.jsx(Ke,{className:"h-8 text-xs flex-1",children:t.jsx(Ze,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),t.jsx(Qe,{children:a?.versions.slice(0,20).map(S=>{const I=a?.maxStableVersion&&ae(S,a.maxStableVersion),ee=a?.faultyRange&&ie(S,a.faultyRange.min,a.faultyRange.max);return t.jsx(Ye,{value:S,className:"text-xs",children:t.jsxs("span",{className:"flex items-center gap-2",children:["v",S,S===a.latestStable&&t.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(ee||I)&&t.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},S)})})]}),t.jsxs(K,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void de(N),disabled:h.isPending||!N,children:[h.isPending?t.jsx(G,{className:"w-3.5 h-3.5 animate-spin"}):t.jsx(Et,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),N&&a?.maxStableVersion&&ae(N,a.maxStableVersion)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),N&&a?.faultyRange&&ie(N,a.faultyRange.min,a.faultyRange.max)&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(ne,{className:"w-3.5 h-3.5 flex-shrink-0"}),t.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:N})})]}),r?.checkedAt&&t.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Xt(r.checkedAt,e)})})]})}),!D&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),t.jsxs(K,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?t.jsx(G,{className:"w-3 h-3 animate-spin"}):t.jsx(Pt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),t.jsx(st,{open:A,onOpenChange:$,children:t.jsxs(nt,{children:[t.jsxs(rt,{children:[t.jsxs(at,{className:"flex items-center gap-2",children:[t.jsx(ne,{className:"w-5 h-5 text-amber-500"}),e(P==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),t.jsxs(it,{className:"space-y-2",children:[P==="faulty"?t.jsx("p",{children:t.jsx(fe,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:y??"",range:Ae||""},components:{strong:t.jsx("strong",{})}})}):t.jsx("p",{children:t.jsx(fe,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:y??"",maxStable:ue},components:{strong:t.jsx("strong",{})}})}),t.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(P==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),t.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),t.jsxs(ot,{children:[t.jsx(lt,{onClick:Pe,children:e("proxyStatusWidget.cancel")}),t.jsx(ct,{onClick:Ee,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{os as P};