@hot-updater/console 1.0.0-rc.9 → 1.0.0

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 (341) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/ConsoleFeatureUnavailable-jB4Loglh.js +1 -0
  3. package/.output/public/assets/EventDetails-B6yUsyNA.js +1 -0
  4. package/.output/public/assets/HashValueDisplay-BFX_kY3-.js +1 -0
  5. package/.output/public/assets/InsightsInfo-BNO0WznZ.js +1 -0
  6. package/.output/public/assets/InsightsPageHeader-B892oVml.js +1 -0
  7. package/.output/public/assets/NotFoundPage-DIqCpWa3.js +1 -0
  8. package/.output/public/assets/alert-dialog-Bbk_4-WJ.js +1 -0
  9. package/.output/public/assets/api-DCM0wr6O.js +1 -0
  10. package/.output/public/assets/api-keys-CIO9L_wu.js +1 -0
  11. package/.output/public/assets/api-keys-DVTL_--f.js +1 -0
  12. package/.output/public/assets/arrow-left-CnMYpqB7.js +1 -0
  13. package/.output/public/assets/arrow-up-right-BtffZA6e.js +1 -0
  14. package/.output/public/assets/chevron-right-BqD5wtFb.js +1 -0
  15. package/.output/public/assets/clipboard-DS9ucUQL.js +1 -0
  16. package/.output/public/assets/console-features-api-BH5m_PtQ.js +1 -0
  17. package/.output/public/assets/dialog-Bqbb7B0N.js +1 -0
  18. package/.output/public/assets/dist-LxKJB-Vu.js +1 -0
  19. package/.output/public/assets/empty-CuT2UhFp.js +1 -0
  20. package/.output/public/assets/field-BBDpjIqu.js +1 -0
  21. package/.output/public/assets/index-6o51GkFe.js +11 -0
  22. package/.output/public/assets/input-group-ja_30qaF.js +1 -0
  23. package/.output/public/assets/insights-CmraDzQh.js +1 -0
  24. package/.output/public/assets/insights-CxZ2GCYV.js +2 -0
  25. package/.output/public/assets/insights-api-BigAU9sZ.js +1 -0
  26. package/.output/public/assets/insights-usage-rpc-DYEhsCKT.js +1 -0
  27. package/.output/public/assets/insights-vNRCrfnS.js +42 -0
  28. package/.output/public/assets/insights_.distribution-ChOerfJt.js +1 -0
  29. package/.output/public/assets/insights_.distribution-D-e4iga8.js +1 -0
  30. package/.output/public/assets/insights_.distribution-DZtkibX1.js +2 -0
  31. package/.output/public/assets/installations-BazSJXE0.js +2 -0
  32. package/.output/public/assets/installations-ClHTqdAO.js +1 -0
  33. package/.output/public/assets/installations-DpKsBuHi.js +1 -0
  34. package/.output/public/assets/key-round-wS_SIZ6b.js +1 -0
  35. package/.output/public/assets/list-CgrYiadM.js +1 -0
  36. package/.output/public/assets/refresh-cw-BYgoNCco.js +1 -0
  37. package/.output/public/assets/remote-config-BWwHOkCK.js +1 -0
  38. package/.output/public/assets/remote-config-Br56BODb.js +6 -0
  39. package/.output/public/assets/remote-config-CXOi0LRu.js +1 -0
  40. package/.output/public/assets/routes-B88Erkpk.js +2 -0
  41. package/.output/public/assets/routes-CfzsAleC.js +1 -0
  42. package/.output/public/assets/search-DaTDPW25.js +1 -0
  43. package/.output/public/assets/select-BZZBXMkr.js +1 -0
  44. package/.output/public/assets/sidebar-DNVyJPfX.js +3 -0
  45. package/.output/public/assets/smartphone-DpTFgtKf.js +1 -0
  46. package/.output/public/assets/styles-DTGEAJFv.css +2 -0
  47. package/.output/public/assets/switch-DZ1TPwx-.js +1 -0
  48. package/.output/public/assets/table-Gm4qRWwE.js +1 -0
  49. package/.output/public/assets/tabs-C7FOEjFC.js +1 -0
  50. package/.output/public/assets/undo-2-CmrHjwFc.js +1 -0
  51. package/.output/public/assets/useCompositeListItem-9E4pj_CH.js +1 -0
  52. package/.output/public/assets/valueToPercent-CH8GCHaL.js +1 -0
  53. package/.output/server/__23tanstack-start-server-fn-resolver-BpRlos5Q.mjs +170 -0
  54. package/.output/server/_libs/@base-ui/react+[...].mjs +4389 -4207
  55. package/.output/server/_libs/@tanstack/react-router+[...].mjs +3802 -4022
  56. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +140 -97
  57. package/.output/server/_libs/lucide-react.mjs +221 -9
  58. package/.output/server/_libs/next-themes.mjs +1 -1
  59. package/.output/server/_libs/react-redux+[...].mjs +1 -1
  60. package/.output/server/_libs/recharts+[...].mjs +483 -901
  61. package/.output/server/_libs/sonner.mjs +1 -1
  62. package/.output/server/_libs/tanstack__history.mjs +68 -41
  63. package/.output/server/_libs/tanstack__query-core.mjs +2010 -309
  64. package/.output/server/_libs/tanstack__react-query.mjs +448 -21
  65. package/.output/server/_libs/verkit.mjs +102 -1
  66. package/.output/server/_ssr/BundleIdDisplay-x94o9rlU.mjs +13 -0
  67. package/.output/server/_ssr/ConsoleFeatureUnavailable-ldW8v8-q.mjs +58 -0
  68. package/.output/server/_ssr/EventDetails-Q8kfj9Nr.mjs +344 -0
  69. package/.output/server/_ssr/{HashValueDisplay-CyMmr0O9.mjs → HashValueDisplay-n1GholGS.mjs} +3 -3
  70. package/.output/server/_ssr/InsightsInfo-DuJFatQO.mjs +75 -0
  71. package/.output/server/_ssr/InsightsPageHeader-BSUX3Ye9.mjs +145 -0
  72. package/.output/server/_ssr/NotFoundPage-DZzOOzS3.mjs +37 -0
  73. package/.output/server/_ssr/{dialog-CKvQ4VIE.mjs → alert-dialog-C43Doa0I.mjs} +6 -83
  74. package/.output/server/_ssr/{api-keys-CzZ7Ont4.mjs → api-keys-B4sYm8dM.mjs} +48 -9
  75. package/.output/server/_ssr/api-keys-CEnM9fqG.mjs +5 -0
  76. package/.output/server/_ssr/api-keys-rpc-BIFuUgMt.mjs +52 -0
  77. package/.output/server/_ssr/api-oZjRn9tP.mjs +186 -0
  78. package/.output/server/_ssr/api-rpc-BNiFRRK8.mjs +240 -0
  79. package/.output/server/_ssr/{auth-BF8mbAgF.mjs → auth-UP0wXs4i.mjs} +1 -1
  80. package/.output/server/_ssr/{auth-rpc-DH6Bhwcz.mjs → auth-rpc-DnZqYxyq.mjs} +6 -6
  81. package/.output/server/_ssr/auth.server-DFpyxRDd.mjs +5374 -0
  82. package/.output/server/_ssr/bundleActivity-M5gzBFNg.mjs +18 -0
  83. package/.output/server/_ssr/config-WVX4IxSR.mjs +15 -0
  84. package/.output/server/_ssr/config.server-DskXCAyI.mjs +35 -0
  85. package/.output/server/_ssr/console-access-BJfAXknd.mjs +17 -0
  86. package/.output/server/_ssr/console-features-Oz0q20jJ.mjs +61 -0
  87. package/.output/server/_ssr/console-features-api-C9kiKvaV.mjs +43 -0
  88. package/.output/server/_ssr/console-features-rpc-P0GL7Z-R.mjs +19 -0
  89. package/.output/server/_ssr/{createServerFn-B2hcXoPM.mjs → createMiddleware-Cm6Tn0_Y.mjs} +67 -56
  90. package/.output/server/_ssr/{createServerRpc-DB29C_5p.mjs → createServerRpc-RLR4H-Fn.mjs} +2 -2
  91. package/.output/server/_ssr/databaseConfig-C5SkAyUy.mjs +5 -0
  92. package/.output/server/_ssr/{databaseJsonValue-d6I3nAS4.mjs → databaseJsonValue-Csbuzc9Q.mjs} +28 -5
  93. package/.output/server/_ssr/databaseRows-CPphvbag.mjs +73 -0
  94. package/.output/server/_ssr/dialog-BbYDMjdC.mjs +84 -0
  95. package/.output/server/_ssr/{dist-CyzPaI5v.mjs → dist-CbQbBIw-.mjs} +140 -7
  96. package/.output/server/_ssr/{downloadBundle-CI7JUKvC.mjs → downloadBundle-CZysjmNW.mjs} +10 -10
  97. package/.output/server/_ssr/empty-CVLGfxuu.mjs +60 -0
  98. package/.output/server/_ssr/{empty-plugin-adapters-B5QvGpEl.mjs → empty-plugin-adapters-CPtwX8a7.mjs} +1 -1
  99. package/.output/server/_ssr/failureReports-DKDhVsXA.mjs +33 -0
  100. package/.output/server/_ssr/field-asw83X0v.mjs +189 -0
  101. package/.output/server/_ssr/getBundleChildren-Cv9iz1As.mjs +22 -0
  102. package/.output/server/_ssr/{input-group-BrGSjz4S.mjs → input-group-CuYJHosb.mjs} +2 -2
  103. package/.output/server/_ssr/insights-B55FG5fm.mjs +14 -0
  104. package/.output/server/_ssr/insights-CWnHIFUV.mjs +5 -0
  105. package/.output/server/_ssr/insights-CpLpedFZ.mjs +2315 -0
  106. package/.output/server/_ssr/insights-api-sjws23WF.mjs +122 -0
  107. package/.output/server/_ssr/insights-errors-BjnFUyZj.mjs +34 -0
  108. package/.output/server/_ssr/insights-failures-rpc-BvbWvqNf.mjs +36 -0
  109. package/.output/server/_ssr/insights-failures-xaa41Buf.mjs +46 -0
  110. package/.output/server/_ssr/insights-recovery-BWQhiZaF.mjs +28 -0
  111. package/.output/server/_ssr/insights-recovery-rpc-GiYXdkaY.mjs +32 -0
  112. package/.output/server/_ssr/{insights-rpc-DDKmIrpV.mjs → insights-rpc-DP_8Rmz4.mjs} +22 -14
  113. package/.output/server/_ssr/insights-usage-BpBM0U0c.mjs +29 -0
  114. package/.output/server/_ssr/insights-usage-rpc-BiolgB8e.mjs +29 -0
  115. package/.output/server/_ssr/insights-usage-rpc-KStL0zOx.mjs +41 -0
  116. package/.output/server/_ssr/insightsUsage-CzhVjsc8.mjs +56 -0
  117. package/.output/server/_ssr/insights_.distribution-CVrnbP3R.mjs +7 -0
  118. package/.output/server/_ssr/insights_.distribution-D2HaNTAA.mjs +16 -0
  119. package/.output/server/_ssr/{insights_.distribution-cIsU-kHG.mjs → insights_.distribution-DN9pR422.mjs} +50 -22
  120. package/.output/server/_ssr/installations-BHmbbnH8.mjs +5 -0
  121. package/.output/server/_ssr/{installations-C5anhyP0.mjs → installations-BSCmFq8Q.mjs} +279 -367
  122. package/.output/server/_ssr/installations-DD1g__Nc.mjs +69 -0
  123. package/.output/server/_ssr/listReleases-BfUBlCHo.mjs +79 -0
  124. package/.output/server/_ssr/plugins-BaD1slHx.mjs +2086 -0
  125. package/.output/server/_ssr/release-adoption-005tQRpo.mjs +55 -0
  126. package/.output/server/_ssr/release-adoption-rpc-BsstqxUp.mjs +41 -0
  127. package/.output/server/_ssr/releaseAdoption-CtOFkwli.mjs +114 -0
  128. package/.output/server/_ssr/releaseManagement-DFMUnDF5.mjs +11 -0
  129. package/.output/server/_ssr/remote-config-C2Ee8lXO.mjs +5 -0
  130. package/.output/server/_ssr/remote-config-Dv1ccMo-.mjs +17 -0
  131. package/.output/server/_ssr/remote-config-of0lGQH8.mjs +2648 -0
  132. package/.output/server/_ssr/remote-config-rpc-BzX31mUS.mjs +115 -0
  133. package/.output/server/_ssr/rolldown-runtime-rSIU-vHC.mjs +13 -0
  134. package/.output/server/_ssr/{router-BuanSsRI.mjs → router-D8NuoJ_I.mjs} +107 -134
  135. package/.output/server/_ssr/{routes-DY-vqU6R.mjs → routes-DgvnFqDy.mjs} +195 -429
  136. package/.output/server/_ssr/routes-V8sDybGf.mjs +409 -0
  137. package/.output/server/_ssr/runtime.server-De0QVWc9.mjs +104 -0
  138. package/.output/server/_ssr/schema-BiAVyEj2.mjs +361 -0
  139. package/.output/server/_ssr/{select-DD2szs3Y.mjs → select-t3iXRwc9.mjs} +3 -3
  140. package/.output/server/_ssr/server-h4VxnExB.mjs +8325 -0
  141. package/.output/server/_ssr/{createSsrRpc-CdlfejmI.mjs → sidebar-DJcErBMo.mjs} +107 -47
  142. package/.output/server/_ssr/ssr.mjs +1 -1
  143. package/.output/server/_ssr/start-BfFbHKMK.mjs +4 -0
  144. package/.output/server/_ssr/switch-E-btwMGt.mjs +43 -0
  145. package/.output/server/_ssr/{table-CTj6n-4F.mjs → table-37Dd23TN.mjs} +2 -2
  146. package/.output/server/_ssr/tabs-DEFnTm95.mjs +45 -0
  147. package/.output/server/_ssr/updateFailures-H6pnnYK4.mjs +40 -0
  148. package/.output/server/_ssr/{uuidv7-D0QFkPL_.mjs → uuidv7-C88s9jWF.mjs} +2 -2
  149. package/.output/server/_tanstack-start-manifest_v-55AGsehh.mjs +139 -0
  150. package/.output/server/index.mjs +309 -211
  151. package/LICENSE +13 -14
  152. package/README.md +80 -71
  153. package/lib/index.d.mts +23 -11
  154. package/lib/vite-internal.mjs +13 -3
  155. package/lib/vite.d.mts +2 -0
  156. package/package.json +14 -14
  157. package/src/components/AppSidebar.tsx +69 -74
  158. package/src/components/ConsoleFeatureUnavailable.tsx +80 -0
  159. package/src/components/NotFoundPage.tsx +7 -7
  160. package/src/components/features/FeatureSlots.tsx +103 -0
  161. package/src/components/features/api-keys/apiKeysFeatureUi.tsx +15 -0
  162. package/src/components/features/bundles/BundleMetadata.tsx +8 -5
  163. package/src/components/features/bundles/RolloutCohortsDialog.tsx +1 -1
  164. package/src/components/features/channels/ChannelManagementDialog.tsx +8 -6
  165. package/src/components/features/insights/AppUsage.tsx +41 -14
  166. package/src/components/features/insights/BuiltinBundle.tsx +36 -0
  167. package/src/components/features/insights/ComparedBundlesChart.tsx +310 -0
  168. package/src/components/features/insights/EstimatedCount.tsx +18 -0
  169. package/src/components/features/insights/EventDetails.tsx +390 -26
  170. package/src/components/features/insights/EventHistoryCard.tsx +111 -25
  171. package/src/components/features/insights/EventHistoryList.tsx +1 -1
  172. package/src/components/features/insights/FailureReports.tsx +407 -0
  173. package/src/components/features/insights/InsightsControls.tsx +240 -142
  174. package/src/components/features/insights/InsightsErrorAlert.tsx +14 -1
  175. package/src/components/features/insights/InsightsOverview.tsx +601 -403
  176. package/src/components/features/insights/InsightsPageHeader.tsx +19 -14
  177. package/src/components/features/insights/InsightsPeriodSelector.tsx +67 -12
  178. package/src/components/features/insights/InstallationHistoryCard.tsx +65 -10
  179. package/src/components/features/insights/InstallationMatchesCard.tsx +1 -1
  180. package/src/components/features/insights/ReleaseActivity.tsx +308 -0
  181. package/src/components/features/insights/ReportingDevicesSummary.tsx +13 -13
  182. package/src/components/features/insights/RollbackButton.tsx +118 -0
  183. package/src/components/features/insights/UpdateFailures.tsx +382 -0
  184. package/src/components/features/insights/insightsFeatureUi.tsx +35 -0
  185. package/src/components/features/releases/ReleaseEditorSheet.tsx +27 -13
  186. package/src/components/features/remote-config/ConditionDialog.tsx +592 -0
  187. package/src/components/features/remote-config/ConditionsCard.tsx +247 -0
  188. package/src/components/features/remote-config/ParameterDialog.tsx +426 -0
  189. package/src/components/features/remote-config/ParametersCard.tsx +254 -0
  190. package/src/components/features/remote-config/PreviewCard.tsx +284 -0
  191. package/src/components/features/remote-config/PublishDialog.tsx +325 -0
  192. package/src/components/features/remote-config/RemoteConfigPage.tsx +353 -0
  193. package/src/components/features/remote-config/RuleSummary.tsx +21 -0
  194. package/src/components/features/remote-config/ValueInput.tsx +151 -0
  195. package/src/components/features/remote-config/VersionsCard.tsx +384 -0
  196. package/src/components/features/remote-config/remoteConfigFeatureUi.tsx +15 -0
  197. package/src/components/features/remote-config/useDateTimeText.ts +16 -0
  198. package/src/components/ui/sidebar.tsx +22 -29
  199. package/src/index.ts +26 -19
  200. package/src/lib/api-keys-api.ts +0 -28
  201. package/src/lib/api-keys-rpc.ts +27 -38
  202. package/src/lib/api-rpc.ts +125 -288
  203. package/src/lib/api.ts +15 -134
  204. package/src/lib/bundle-activity.ts +24 -4
  205. package/src/lib/console-access.ts +20 -0
  206. package/src/lib/console-features-api.ts +68 -0
  207. package/src/lib/console-features-rpc.ts +13 -0
  208. package/src/lib/console-features.ts +98 -0
  209. package/src/lib/insights-api.ts +56 -2
  210. package/src/lib/insights-errors.ts +64 -0
  211. package/src/lib/insights-failures-rpc.ts +36 -0
  212. package/src/lib/insights-failures.ts +130 -0
  213. package/src/lib/insights-recovery-rpc.ts +13 -17
  214. package/src/lib/insights-recovery.ts +12 -36
  215. package/src/lib/insights-retention.ts +21 -0
  216. package/src/lib/insights-rpc.ts +30 -12
  217. package/src/lib/insights-search.ts +50 -4
  218. package/src/lib/insights-usage-rpc.ts +15 -9
  219. package/src/lib/insights-usage.ts +41 -3
  220. package/src/lib/insights-view.ts +34 -5
  221. package/src/lib/release-adoption-api.ts +214 -0
  222. package/src/lib/release-adoption-rpc.ts +49 -0
  223. package/src/lib/release-adoption.ts +164 -0
  224. package/src/lib/remote-config-api.ts +119 -0
  225. package/src/lib/remote-config-draft.ts +666 -0
  226. package/src/lib/remote-config-rpc.ts +196 -0
  227. package/src/lib/scroll-restoration.ts +21 -0
  228. package/src/lib/server/auth.server.ts +13 -5
  229. package/src/lib/server/bundleActivity.ts +27 -28
  230. package/src/lib/server/config.server.ts +21 -76
  231. package/src/lib/server/console-feature-apis.ts +70 -0
  232. package/src/lib/server/console-runtime.server.ts +82 -38
  233. package/src/lib/server/downloadBundle.ts +14 -15
  234. package/src/lib/server/failureReports.ts +50 -0
  235. package/src/lib/server/getBundleChildren.ts +31 -122
  236. package/src/lib/server/insightsUsage.ts +52 -113
  237. package/src/lib/server/listReleases.ts +109 -44
  238. package/src/lib/server/releaseAdoption.ts +151 -0
  239. package/src/lib/server/releaseReachability.ts +8 -8
  240. package/src/lib/server/remoteConfig.ts +75 -0
  241. package/src/lib/server/runtime.server.ts +120 -31
  242. package/src/lib/server/updateFailures.ts +66 -0
  243. package/src/lib/use-dialog-target.ts +27 -0
  244. package/src/routeTree.gen.ts +44 -44
  245. package/src/router.tsx +3 -2
  246. package/src/routes/-installations-search.ts +32 -8
  247. package/src/routes/-releases-search.ts +76 -29
  248. package/src/routes/__root.tsx +7 -1
  249. package/src/routes/api/bundles/$bundleId/download.ts +2 -5
  250. package/src/routes/api-keys.tsx +5 -2
  251. package/src/routes/index.tsx +210 -152
  252. package/src/routes/insights.tsx +91 -23
  253. package/src/routes/insights_.distribution.tsx +50 -9
  254. package/src/routes/installations.tsx +97 -40
  255. package/src/routes/remote-config.tsx +42 -0
  256. package/src/styles.css +9 -0
  257. package/src/vite-internal.ts +15 -3
  258. package/src/vite.ts +2 -0
  259. package/.output/public/assets/HashValueDisplay-BpTc3Oyg.js +0 -1
  260. package/.output/public/assets/InsightsPageHeader-DC2eEst8.js +0 -1
  261. package/.output/public/assets/api-CdUyUqzR.js +0 -42
  262. package/.output/public/assets/api-keys-64PM9PwW.js +0 -1
  263. package/.output/public/assets/api-keys-api-BeaJnvY5.js +0 -1
  264. package/.output/public/assets/arrow-left-04Rh8Zgp.js +0 -1
  265. package/.output/public/assets/card-CYHs5FZv.js +0 -1
  266. package/.output/public/assets/chart-no-axes-combined-DwyMsVFW.js +0 -1
  267. package/.output/public/assets/createServerFn-DU71xucx.js +0 -3
  268. package/.output/public/assets/dialog-IVMkBRCq.js +0 -1
  269. package/.output/public/assets/dist-BR4GzeEu.js +0 -1
  270. package/.output/public/assets/field-B3CYDpjg.js +0 -1
  271. package/.output/public/assets/index-Cb_D1D6N.js +0 -10
  272. package/.output/public/assets/info-C3y9HNoU.js +0 -1
  273. package/.output/public/assets/input-group-nLZylhWF.js +0 -1
  274. package/.output/public/assets/insights-Bm9v8uO3.js +0 -2
  275. package/.output/public/assets/insights-DS3iO7Up.js +0 -1
  276. package/.output/public/assets/insights-search-Byj3g3Mp.js +0 -1
  277. package/.output/public/assets/insights-usage-rpc-BaGR3lgq.js +0 -1
  278. package/.output/public/assets/insights_.distribution-B1i6cjlQ.js +0 -1
  279. package/.output/public/assets/insights_.distribution-C1Wf27eB.js +0 -2
  280. package/.output/public/assets/installations-CkFW4fV9.js +0 -2
  281. package/.output/public/assets/installations-DxTaIcHD.js +0 -1
  282. package/.output/public/assets/lazyRouteComponent-BapzjYnb.js +0 -1
  283. package/.output/public/assets/list-Dqt53fWZ.js +0 -1
  284. package/.output/public/assets/loader-circle-CUKfUqow.js +0 -1
  285. package/.output/public/assets/preload-helper-ClBMtM1g.js +0 -1
  286. package/.output/public/assets/refresh-cw-CNE_2PnD.js +0 -1
  287. package/.output/public/assets/routes-Cgtvspjg.js +0 -2
  288. package/.output/public/assets/routes-O2r2UUN8.js +0 -1
  289. package/.output/public/assets/shield-check-BFcJ46kz.js +0 -1
  290. package/.output/public/assets/signing-BgspC-xP.js +0 -1
  291. package/.output/public/assets/styles-DnrWuBwd.css +0 -2
  292. package/.output/public/assets/table-BuWQgxJJ.js +0 -1
  293. package/.output/public/assets/useMutation-CSV9NCUl.js +0 -1
  294. package/.output/public/assets/useOpenInteractionType-D5kduCTD.js +0 -1
  295. package/.output/public/assets/valueToPercent-BAtcbSLk.js +0 -1
  296. package/.output/server/__23tanstack-start-server-fn-resolver-DBRojHaG.mjs +0 -150
  297. package/.output/server/_ssr/InsightsPageHeader-mtxVuZKK.mjs +0 -64
  298. package/.output/server/_ssr/api-BfCgYlj5.mjs +0 -332
  299. package/.output/server/_ssr/api-keys-api-C3oeq01R.mjs +0 -60
  300. package/.output/server/_ssr/api-keys-rpc-CdPFdGOx.mjs +0 -136
  301. package/.output/server/_ssr/api-rpc-B2E1ZIG5.mjs +0 -1399
  302. package/.output/server/_ssr/auth.server-CmicHh0J.mjs +0 -47
  303. package/.output/server/_ssr/bundle-signing-rpc-Di7-I6fE.mjs +0 -16
  304. package/.output/server/_ssr/bundle-signing.server-Uqt1OF49.mjs +0 -12
  305. package/.output/server/_ssr/bundleActivity-pBrPSG01.mjs +0 -28
  306. package/.output/server/_ssr/card-Bemj0dpY.mjs +0 -108
  307. package/.output/server/_ssr/config-Dv8qLDZ0.mjs +0 -13
  308. package/.output/server/_ssr/config.server-B8WsT3s0.mjs +0 -368
  309. package/.output/server/_ssr/databaseRows-5bCRTxm-.mjs +0 -126
  310. package/.output/server/_ssr/deleteBundle-8X-jq7Z7.mjs +0 -66
  311. package/.output/server/_ssr/field-BrQ2u0fT.mjs +0 -74
  312. package/.output/server/_ssr/getBundleChildren-DoL8l_AS.mjs +0 -50
  313. package/.output/server/_ssr/insights-BwQ-wF2a.mjs +0 -10
  314. package/.output/server/_ssr/insights-gr1I_dJU.mjs +0 -938
  315. package/.output/server/_ssr/insights-recovery-Cv6RSyeR.mjs +0 -21
  316. package/.output/server/_ssr/insights-recovery-rpc-DOzxfYfv.mjs +0 -37
  317. package/.output/server/_ssr/insights-search-1czJMZgk.mjs +0 -21
  318. package/.output/server/_ssr/insights-usage-rpc-4ImOq_0p.mjs +0 -184
  319. package/.output/server/_ssr/insights-usage-rpc-BUruODjE.mjs +0 -24
  320. package/.output/server/_ssr/insightsContract-B09K_Px1.mjs +0 -303
  321. package/.output/server/_ssr/insightsHistory-Ci4rYAgl.mjs +0 -41
  322. package/.output/server/_ssr/insightsRecovery-CaghWL2t.mjs +0 -113
  323. package/.output/server/_ssr/insightsUsage-DNIj6jxF.mjs +0 -71
  324. package/.output/server/_ssr/insights_.distribution-VmHuikRE.mjs +0 -10
  325. package/.output/server/_ssr/installations-HXMF_kKf.mjs +0 -29
  326. package/.output/server/_ssr/routes-Dru3IRj0.mjs +0 -37
  327. package/.output/server/_ssr/runtime.server-CsiKFp_Z.mjs +0 -436
  328. package/.output/server/_ssr/server-DJm72Kj-.mjs +0 -7468
  329. package/.output/server/_ssr/signing-H8Lg4lPe.mjs +0 -133
  330. package/.output/server/_ssr/start-DpViQGnt.mjs +0 -4
  331. package/.output/server/_tanstack-start-manifest_v-DsFcTLw_.mjs +0 -125
  332. package/src/components/features/bundles/BundleActivityChart.tsx +0 -97
  333. package/src/components/features/bundles/BundleInsightsSummary.tsx +0 -126
  334. package/src/components/features/signing/BundleSigningPage.tsx +0 -139
  335. package/src/lib/bundle-signing-api.ts +0 -14
  336. package/src/lib/bundle-signing-rpc.ts +0 -16
  337. package/src/lib/server/bundle-signing.server.ts +0 -23
  338. package/src/lib/server/deleteBundle.ts +0 -145
  339. package/src/lib/server/insightsHistory.ts +0 -52
  340. package/src/lib/server/insightsRecovery.ts +0 -187
  341. package/src/routes/signing.tsx +0 -37
@@ -0,0 +1 @@
1
+ import{t as e}from"./ConsoleFeatureUnavailable-jB4Loglh.js";var t=e;export{t as notFoundComponent};
@@ -0,0 +1 @@
1
+ import{Fn as e,In as t,Nn as n,Ur as r,cr as i}from"./sidebar-DNVyJPfX.js";import{l as a}from"./console-features-api-BH5m_PtQ.js";import{t as o}from"./arrow-left-CnMYpqB7.js";import{t as s}from"./arrow-up-right-BtffZA6e.js";import{o as c,u as ee}from"./insights-api-BigAU9sZ.js";import{_ as te,a as l,f as u,h as d,l as f,m as p,p as m,t as h,u as g,v as _,y as ne}from"./field-BBDpjIqu.js";import{N as v,a as re,i as y,n as b,o as x,r as S,t as C}from"./select-BZZBXMkr.js";import{n as w,r as T,t as E}from"./insights-usage-rpc-DYEhsCKT.js";import{a as D,t as O}from"./InsightsInfo-BNO0WznZ.js";import{i as k,o as A,r as j,t as M}from"./empty-CuT2UhFp.js";import{t as N}from"./insights_.distribution-DZtkibX1.js";import{i as P}from"./valueToPercent-CH8GCHaL.js";import{c as ie,n as F,o as I,t as L}from"./InsightsPageHeader-B892oVml.js";var R=r(),z=20,B=new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,timeZone:`UTC`}),V=e=>e.releaseId??(e.builtinBundleId?`Built-in bundle ${e.builtinBundleId}`:`Unknown bundle`);function H({bundleId:e}){return(0,R.jsxs)(`div`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2 md:min-h-9`,children:[(0,R.jsx)(F,{}),(0,R.jsx)(P,{bundleId:e,className:`text-muted-foreground`})]})}function U(){let r=N.useSearch(),P=c(),F=N.useNavigate(),U={platform:r.platform??`all`,channel:r.channel??`production`,appVersion:r.appVersion,window:r.window??`24h`},W=i({queryKey:[`insights`,`app-usage`,U],queryFn:()=>E({data:U}),staleTime:3e4}),G=W.error?void 0:W.data,K=G?`since ${B.format(G.distributionSinceMs)}, 00:00 UTC`:`in this period`,q=(G?.bundleDistribution??[]).filter(e=>!r.version||e.appVersion===r.version),J=q.reduce((e,t)=>e+t.installations,0),Y=Math.max(1,Math.ceil(q.length/z)),X=Math.min(r.page??1,Y),Z=[...new Set([...G?.versions.map(e=>e.name)??[],...r.version?[r.version]:[]])],Q=D(r),$=e=>void F({search:{...r,page:void 0,...e}});return(0,R.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,R.jsx)(L,{view:`distribution`,overviewSearch:Q}),(0,R.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 px-4 py-6 sm:p-8`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-6`,children:[(0,R.jsxs)(a,{to:`/insights`,search:Q,className:t({variant:`ghost`,className:`h-11 w-fit sm:h-9`}),children:[(0,R.jsx)(o,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Back to overview`]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,R.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight`,children:`Distribution`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(I,{twelveMonths:ee(P),window:U.window,onWindowChange:e=>$({window:e})}),(0,R.jsx)(e,{"aria-label":`Refresh distribution`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,disabled:W.isFetching,onClick:()=>void W.refetch(),children:(0,R.jsx)(T,{"aria-hidden":`true`})})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-4`,children:[(0,R.jsxs)(h,{className:`w-full sm:w-64`,children:[(0,R.jsx)(l,{htmlFor:`distribution-version`,children:`App version`}),(0,R.jsxs)(C,{items:Object.fromEntries([[`all`,`All versions`],...Z.map(e=>[`version:${e}`,e])]),value:r.version?`version:${r.version}`:`all`,onValueChange:e=>{e!==null&&$({version:e===`all`?void 0:e.slice(8)})},children:[(0,R.jsx)(re,{id:`distribution-version`,className:`min-h-11 w-full sm:min-h-9`,children:(0,R.jsx)(x,{})}),(0,R.jsx)(b,{children:(0,R.jsxs)(S,{children:[(0,R.jsx)(y,{value:`all`,children:`All versions`}),Z.map(e=>(0,R.jsx)(y,{value:`version:${e}`,children:e},e))]})})]})]}),(0,R.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center gap-2`,"aria-label":`Distribution scope`,children:[(0,R.jsxs)(f,{variant:`outline`,className:`gap-1.5`,children:[U.platform===`all`?null:(0,R.jsx)(v,{platform:U.platform,className:`size-3.5`}),U.platform===`all`?`All platforms`:U.platform===`ios`?`iOS`:`Android`]}),(0,R.jsx)(f,{variant:`outline`,children:U.channel}),U.appVersion?(0,R.jsxs)(f,{variant:`outline`,children:[`Reports from `,U.appVersion]}):null]})]}),(0,R.jsxs)(p,{"aria-label":`Bundles by app version`,role:`region`,className:`min-w-0`,children:[(0,R.jsxs)(_,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(ne,{children:`Bundles by app version`}),(0,R.jsxs)(O,{label:`How bundle distribution is counted`,children:[`Each installation counts once, by its latest report`,` `,K,`. Shares are within each app version. Built-in bundle: the bundle the native build shipped, by its ID. Unknown bundle: no deployment and no built-in bundle ID.`]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[W.isPending?(0,R.jsx)(n,{className:`h-9 w-16`}):(0,R.jsx)(`p`,{className:`text-3xl font-semibold tabular-nums`,children:G?`${G.truncated?`≥`:``}${J.toLocaleString()}`:`—`}),(0,R.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Reporting installations`})]})]}),(0,R.jsxs)(d,{className:`flex min-w-0 flex-col gap-4`,children:[G?.truncated?(0,R.jsxs)(g,{children:[(0,R.jsx)(m,{children:`Partial history`}),(0,R.jsxs)(u,{children:[`Counts and shares reflect reports since`,` `,new Date(G.sinceMs).toLocaleString(`en`,{timeZone:`UTC`}),` `,`UTC. Choose a shorter period for a more complete view.`]})]}):null,W.isPending?(0,R.jsx)(n,{"aria-label":`Loading bundle distribution`,className:`h-64`}):W.error?(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[(0,R.jsx)(ie,{error:W.error,fallbackTitle:`Distribution unavailable`}),(0,R.jsx)(e,{variant:`outline`,onClick:()=>void W.refetch(),children:`Retry distribution`})]}):q.length===0?(0,R.jsxs)(M,{children:[(0,R.jsxs)(k,{children:[(0,R.jsx)(A,{children:`No bundles reported`}),(0,R.jsx)(j,{children:`Choose another version or period, or change the filters in the overview.`})]}),(0,R.jsx)(e,{variant:`outline`,onClick:()=>$({version:void 0}),children:`Show all versions`})]}):(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[8rem_minmax(0,1fr)_7rem_7rem] gap-4 border-b px-3 pb-3 text-xs text-muted-foreground md:grid`,children:[(0,R.jsx)(`span`,{children:`App version`}),(0,R.jsx)(`span`,{children:`Bundle ID`}),(0,R.jsx)(`span`,{className:`text-right`,children:`Active installations`}),(0,R.jsx)(`span`,{className:`text-right`,children:`Version share`})]}),(0,R.jsx)(`ul`,{"aria-label":`Bundle distribution`,className:`divide-y`,children:q.slice((X-1)*z,X*z).map(e=>{let t=G?.versions.find(t=>t.name===e.appVersion)?.installations??0,n=t>0?e.installations/t*100:0;return(0,R.jsxs)(`li`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 gap-y-3 px-1 py-4 md:grid-cols-[8rem_minmax(0,1fr)_7rem_7rem] md:px-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`truncate text-sm font-medium`,title:e.appVersion,children:e.appVersion}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(v,{platform:e.platform,className:`size-3.5`}),e.platform===`ios`?`iOS`:`Android`]})]}),(0,R.jsxs)(`div`,{className:`col-span-2 row-start-2 min-w-0 md:col-span-1 md:row-auto`,children:[e.releaseId?(0,R.jsxs)(a,{to:`/`,search:{releaseId:e.releaseId},"aria-label":`Review bundle ${e.releaseId} for app version ${e.appVersion}`,className:`flex min-h-11 min-w-0 items-center gap-2 text-xs underline-offset-4 hover:underline md:min-h-9`,children:[(0,R.jsx)(`span`,{className:`break-all font-mono`,children:e.releaseId}),(0,R.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]}):e.builtinBundleId?null:(0,R.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Unknown bundle`}),e.builtinBundleId?(0,R.jsx)(H,{bundleId:e.builtinBundleId}):null]}),(0,R.jsxs)(`div`,{className:`col-start-2 row-start-1 text-right md:col-auto md:row-auto`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:e.installations.toLocaleString()}),(0,R.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground md:sr-only`,children:`active`}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs tabular-nums text-muted-foreground md:hidden`,children:[n.toFixed(1),`% of version`]})]}),(0,R.jsxs)(`div`,{className:`hidden flex-col gap-2 md:flex`,children:[(0,R.jsxs)(`span`,{className:`text-right text-sm tabular-nums`,children:[n.toFixed(1),`%`]}),(0,R.jsx)(w,{"aria-label":`${V(e)} share in ${e.appVersion} on ${e.platform}`,value:n})]})]},JSON.stringify([e.appVersion,e.platform,e.releaseId,e.builtinBundleId]))})})]})]}),G&&q.length>0?(0,R.jsxs)(te,{className:`flex flex-wrap items-center justify-between gap-3 border-t pt-4`,children:[(0,R.jsxs)(`p`,{className:`text-xs tabular-nums text-muted-foreground`,children:[(X-1)*z+1,`–`,Math.min(X*z,q.length),` of `,q.length]}),(0,R.jsxs)(`nav`,{"aria-label":`Distribution pages`,className:`flex gap-2`,children:[(0,R.jsx)(e,{variant:`outline`,className:`h-11 sm:h-9`,disabled:X<=1,onClick:()=>$({page:X-1}),children:`Previous`}),(0,R.jsx)(e,{variant:`outline`,className:`h-11 sm:h-9`,disabled:X>=Y,onClick:()=>$({page:X+1}),children:`Next`})]})]}):null]})]})})]})}export{U as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/insights_.distribution-ChOerfJt.js","assets/ConsoleFeatureUnavailable-jB4Loglh.js","assets/sidebar-DNVyJPfX.js","assets/console-features-api-BH5m_PtQ.js","assets/arrow-up-right-BtffZA6e.js","assets/NotFoundPage-DIqCpWa3.js","assets/empty-CuT2UhFp.js","assets/insights_.distribution-D-e4iga8.js","assets/select-BZZBXMkr.js","assets/useCompositeListItem-9E4pj_CH.js","assets/field-BBDpjIqu.js","assets/insights-usage-rpc-DYEhsCKT.js","assets/valueToPercent-CH8GCHaL.js","assets/arrow-left-CnMYpqB7.js","assets/insights-api-BigAU9sZ.js","assets/InsightsPageHeader-B892oVml.js","assets/tabs-C7FOEjFC.js","assets/list-CgrYiadM.js","assets/InsightsInfo-BNO0WznZ.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./console-features-api-BH5m_PtQ.js";import{a as t,c as n,s as r}from"./useCompositeListItem-9E4pj_CH.js";import{i}from"./InsightsInfo-BNO0WznZ.js";var a=n(`/insights_/distribution`)({beforeLoad:({context:t})=>e(t.queryClient,`insightsAnalytics`),notFoundComponent:r(()=>t(()=>import(`./insights_.distribution-ChOerfJt.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`notFoundComponent`),component:r(()=>t(()=>import(`./insights_.distribution-D-e4iga8.js`),__vite__mapDeps([7,2,8,9,3,10,11,12,13,4,14,15,16,17,18,6])),`component`),validateSearch:i});export{a as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/installations-ClHTqdAO.js","assets/ConsoleFeatureUnavailable-jB4Loglh.js","assets/sidebar-DNVyJPfX.js","assets/console-features-api-BH5m_PtQ.js","assets/arrow-up-right-BtffZA6e.js","assets/NotFoundPage-DIqCpWa3.js","assets/empty-CuT2UhFp.js","assets/installations-DpKsBuHi.js","assets/useCompositeListItem-9E4pj_CH.js","assets/EventDetails-B6yUsyNA.js","assets/insights-api-BigAU9sZ.js","assets/field-BBDpjIqu.js","assets/HashValueDisplay-BFX_kY3-.js","assets/dist-LxKJB-Vu.js","assets/input-group-ja_30qaF.js","assets/smartphone-DpTFgtKf.js","assets/InsightsPageHeader-B892oVml.js","assets/tabs-C7FOEjFC.js","assets/list-CgrYiadM.js","assets/arrow-left-CnMYpqB7.js","assets/refresh-cw-BYgoNCco.js","assets/search-DaTDPW25.js","assets/table-Gm4qRWwE.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./console-features-api-BH5m_PtQ.js";import{a as t,c as n,s as r}from"./useCompositeListItem-9E4pj_CH.js";function i(){try{return sessionStorage}catch{return}}var a=`tsr-scroll-restoration-v1_3`,o=i();function s(){try{return JSON.parse(o?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var c=s(),l=`data-scroll-restoration-id`,u=e=>e.state.__TSR_key||e.href;function d(e){let t=e.getAttribute(l);if(t)return`[${l}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}function f(e,t){let n=c[(t.getKey||u)(e.latestLocation)];if(!n)return;if(t.id)return n[`[${l}="${t.id}"]`];let r=t.getElement?.();if(r)return n[r===window?m:d(r)]}var p=!1,m=`window`;function h(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function g(e){let t=new Set;for(let n of e){if(n===m)continue;let e=h(n);e&&t.add(e)}return t}function _(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||u,s=new Set,l=e=>{let t=c[e]||={};for(let e of s)e===document?t[m]={scrollX,scrollY}:e.isConnected&&(t[d(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,p=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{p||s.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&l(i(e.fromLocation)),s.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,l(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{o?.setItem(a,JSON.stringify(c))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),!r.r&&(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,a=e.options.scrollToTopSelectors,o=r.n,l=r.h,u;if(s.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let d=i(t.toLocation),f=t.fromLocation&&i(t.fromLocation);if(r.e&&f&&f!==d){let e=c[f];if(e){let t=c[d];for(let n in e){if(n===m){if(o)continue}else{let e=h(n);if(!e||o&&a&&(u??=g(a),u.has(e)))continue}t||=c[d]={},t[n]??=e[n]}}}p=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,s=!1;if(o){!e&&a&&(u??=g(a));let t=e&&i&&l,o=r.e?c[d]:void 0;if(o)for(let e in o){let{scrollX:r,scrollY:i}=o[e];if(e===m){if(t)continue;scrollTo({top:i,left:r,behavior:n}),s=!0}else{let t=h(e);t&&(t.scrollLeft=r,t.scrollTop=i,u?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(s||scrollTo(e),u)for(let t of u)t.scrollTo(e)}}!s&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{p=!1}}))}var v=864e5,y={"24h":{period:`24 hours`,durationMs:v},"7d":{period:`7 days`,durationMs:7*v},"30d":{period:`30 days`,durationMs:30*v},"90d":{period:`90 days`,durationMs:90*v}},b=Object.keys(y),x=e=>b[b.indexOf(e)+1],S=(e,t)=>({beforeReceivedAtMs:t,sinceMs:Math.max(0,t-y[e].durationMs)}),C=e=>typeof e==`string`&&e.length>0?e:void 0,w=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0,T=e=>b.find(t=>t===e);function E(e){let t=D(e.search);return t.query===void 0&&t.installId===void 0?`/installations?eventsBefore=${t.eventsBefore??`new`}&eventsRange=${t.eventsRange??`7d`}&eventsCursor=${t.eventsCursor??`first`}`:e.state.__TSR_key}function D(e){return{query:typeof e.query==`string`?e.query:void 0,installId:typeof e.installId==`string`?e.installId:void 0,eventsCursor:C(e.eventsCursor),eventsBefore:w(e.eventsBefore),eventsRange:T(e.eventsRange),searchCursor:C(e.searchCursor),historyCursor:C(e.historyCursor),historyBefore:w(e.historyBefore)}}var O=n(`/installations`)({beforeLoad:({context:t})=>e(t.queryClient,`insights`),notFoundComponent:r(()=>t(()=>import(`./installations-ClHTqdAO.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`notFoundComponent`),component:r(()=>t(()=>import(`./installations-DpKsBuHi.js`),__vite__mapDeps([7,2,8,3,9,10,11,12,13,14,15,16,17,18,6,19,4,20,21,22])),`component`),staticData:{scrollRestorationKey:E},validateSearch:D});export{y as a,_ as c,S as i,E as n,x as o,b as r,f as s,O as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ConsoleFeatureUnavailable-jB4Loglh.js";var t=e;export{t as notFoundComponent};
@@ -0,0 +1 @@
1
+ import{Fn as e,In as t,Ln as n,Nn as r,Pn as i,Ur as a,ei as o,ir as s,ri as c}from"./sidebar-DNVyJPfX.js";import{d as l,l as u,u as d}from"./console-features-api-BH5m_PtQ.js";import{a as f,c as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./installations-BazSJXE0.js";import{o as b,u as x}from"./useCompositeListItem-9E4pj_CH.js";import{a as S,n as C,o as w,r as T,t as E}from"./EventDetails-B6yUsyNA.js";import{t as D}from"./arrow-left-CnMYpqB7.js";import{t as O}from"./arrow-up-right-BtffZA6e.js";import{a as ee,c as k,i as te,l as A,n as ne,o as re,r as ie}from"./insights-api-BigAU9sZ.js";import{a as j,g as M,h as N,m as P,t as F,v as I,x as ae,y as L}from"./field-BBDpjIqu.js";import{n as R,t as z}from"./HashValueDisplay-BFX_kY3-.js";import{t as oe}from"./refresh-cw-BYgoNCco.js";import{i as se,n as B,r as ce,t as le}from"./input-group-ja_30qaF.js";import{t as ue}from"./search-DaTDPW25.js";import{a as V,i as H,n as U,o as W,r as G,t as K}from"./table-Gm4qRWwE.js";import{a as de,c as q,n as fe,r as pe,t as me}from"./InsightsPageHeader-B892oVml.js";function he(){p(l(),!0)}function ge(e){return he(),v(l(),e)}function _e(e){let t=l();return d(t.stores.location,x(e,t))}var J=c(o(),1),Y=a();function ve({events:e,formatter:t,renderIdentity:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`px-4 pb-2 text-xs text-muted-foreground sm:px-6`,children:`Time in your browser zone`}),(0,Y.jsx)(`ol`,{"aria-label":`Events`,className:`divide-y border-y`,children:e.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-3 px-4 py-4 sm:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1`,children:[(0,Y.jsx)(T,{event:e}),(0,Y.jsx)(`div`,{className:`text-xs tabular-nums`,children:(0,Y.jsx)(C,{value:e.receivedAtMs,formatter:t,touch:!0})})]}),n?.(e),(0,Y.jsxs)(`dl`,{className:`flex flex-wrap gap-x-2 gap-y-1 text-sm`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:`App`}),(0,Y.jsxs)(`dd`,{children:[e.platform===`ios`?`iOS`:`Android`,` `,e.appVersion]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 text-muted-foreground`,children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:`Channel`}),(0,Y.jsx)(`dd`,{className:`wrap-anywhere`,children:e.channel})]})]}),(0,Y.jsx)(`div`,{className:`text-xs`,"aria-label":`Bundle`,children:(0,Y.jsx)(E,{event:e,touch:!0})})]},e.id))})]})}function X({hasPrevious:t,label:n,nextCursor:r,onNext:i,onPrevious:a,pageLength:o,pageNumber:s}){return(0,Y.jsxs)(`nav`,{"aria-label":`${n} pagination`,className:`flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3 sm:px-6`,children:[(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[`Page `,s,` · `,o.toLocaleString(),` rows`]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(e,{className:`h-11 min-w-11 px-3 lg:h-8 lg:min-w-0 lg:px-2`,disabled:!t,onClick:a,size:`sm`,type:`button`,variant:`outline`,children:`Previous`}),(0,Y.jsx)(e,{className:`h-11 min-w-11 px-3 lg:h-8 lg:min-w-0 lg:px-2`,disabled:r===null,onClick:i,size:`sm`,type:`button`,variant:`outline`,children:`Next`})]})]})}var ye=e=>_.filter((t,n)=>n===0||f[t].durationMs<=e*864e5);function be({event:e,eventsLocation:n,touch:r=!1}){return(0,Y.jsxs)(`div`,{className:r?`flex min-w-0 flex-wrap items-center justify-between gap-2`:`flex min-w-0 flex-col items-start gap-2`,children:[(0,Y.jsxs)(u,{className:t({className:r?`-ml-2 h-auto min-h-11 min-w-0 flex-1 justify-start gap-2 whitespace-normal text-sm`:`-ml-2 max-w-full justify-start`,size:`sm`,variant:`ghost`}),to:`/installations`,search:{...n,query:e.installId||void 0,installId:e.installId},state:e=>({insightsPagination:{eventsBack:e.insightsPagination?.eventsBack}}),"aria-label":`View history for ${e.userId??`anonymous installation`} (${e.installId})`,children:[(0,Y.jsx)(`span`,{className:r?`min-w-0 text-left wrap-anywhere`:`truncate`,children:e.userId??`Anonymous installation`}),(0,Y.jsx)(O,{"aria-hidden":`true`,"data-icon":`inline-end`})]}),(0,Y.jsx)(z,{value:e.installId,maxLength:13,buttonClassName:r?`min-h-11 px-3`:void 0})]})}function xe({children:t,description:n,error:i,eventsLocation:a,history:o,isFetching:s,isLoading:c,onNext:l,onPrevious:u,onRangeChange:d,onRefresh:p,pageNumber:m,range:h,rawDays:_=90,title:v=`All events`}){let y=w(),b=m>1,x=ye(_),S=h===void 0?void 0:g(h),D=S!==void 0&&x.includes(S)?S:void 0,O=D!==void 0&&d?(0,Y.jsx)(e,{className:`h-11 px-3 lg:h-8`,onClick:()=>d(D),type:`button`,variant:`outline`,children:`Show the last ${f[D].period}`}):null;return(0,Y.jsxs)(P,{className:`@container min-w-0 shadow-sm`,"aria-busy":s,children:[(0,Y.jsxs)(I,{className:`gap-4 p-4 sm:p-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsx)(L,{children:(0,Y.jsx)(`h2`,{children:v})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[h!==void 0&&d?(0,Y.jsx)(de,{label:`Time range`,onPeriodChange:d,period:h,periods:x.map(e=>({value:e,name:`Last ${f[e].period}`}))}):null,(0,Y.jsxs)(e,{className:`h-11 lg:h-8`,disabled:s,onClick:p,size:`lg`,variant:`outline`,children:[(0,Y.jsx)(oe,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Refresh`]})]})]}),n?(0,Y.jsx)(M,{children:n}):null]}),t]}),(0,Y.jsx)(N,{className:`min-w-0 p-0`,children:c?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 p-6`,role:`status`,"aria-label":`Loading events`,children:[(0,Y.jsx)(r,{className:`h-12 w-full`}),(0,Y.jsx)(r,{className:`h-12 w-full`}),(0,Y.jsx)(r,{className:`h-12 w-full`})]}):i?(0,Y.jsx)(`div`,{className:`px-6 pb-6`,children:(0,Y.jsx)(q,{error:i,fallbackTitle:`Event history unavailable`})}):o?(0,Y.jsxs)(Y.Fragment,{children:[o.data.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`@[58rem]:hidden`,children:(0,Y.jsx)(ve,{events:o.data,formatter:y,renderIdentity:e=>(0,Y.jsx)(be,{event:e,eventsLocation:a,touch:!0})})}),(0,Y.jsx)(`div`,{className:`hidden @[58rem]:block`,children:(0,Y.jsxs)(K,{className:`min-w-4xl table-fixed`,children:[(0,Y.jsx)(V,{children:(0,Y.jsxs)(W,{className:`[&>th]:px-4 sm:[&>th]:px-6`,children:[(0,Y.jsx)(H,{className:`w-64`,children:`Time`}),(0,Y.jsx)(H,{className:`w-48`,children:`Event`}),(0,Y.jsx)(H,{className:`w-48`,children:`User / installation`}),(0,Y.jsx)(H,{className:`w-32`,children:`App`}),(0,Y.jsx)(H,{className:`w-52`,children:`Bundle`})]})}),(0,Y.jsx)(U,{children:o.data.map(e=>(0,Y.jsxs)(W,{className:`[&>td]:px-4 [&>td]:py-4 [&>td]:align-top sm:[&>td]:px-6`,children:[(0,Y.jsx)(G,{className:`whitespace-normal text-xs tabular-nums`,children:(0,Y.jsx)(C,{value:e.receivedAtMs,formatter:y})}),(0,Y.jsx)(G,{children:(0,Y.jsx)(T,{event:e})}),(0,Y.jsx)(G,{children:(0,Y.jsx)(be,{event:e,eventsLocation:a})}),(0,Y.jsx)(G,{className:`whitespace-normal text-xs`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`span`,{children:[e.platform===`ios`?`iOS`:`Android`,` `,e.appVersion]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.channel})]})}),(0,Y.jsx)(G,{className:`whitespace-normal text-xs`,children:(0,Y.jsx)(E,{event:e})})]},e.id))})]})})]}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 pb-4 sm:px-6 sm:pb-6`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:b?`No older events in this range.`:h===void 0?v===`All events`?`No events recorded yet`:`No matching reports in this period`:`No events in the last ${f[h].period}.`}),b?null:O]}),h!==void 0&&o.nextCursor===null&&(o.data.length>0||b)?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Start of range reached`}),O]}):null,o.data.length>0||b||o.nextCursor?(0,Y.jsx)(X,{hasPrevious:b,label:v,nextCursor:o.nextCursor,onNext:l,onPrevious:u,pageLength:o.data.length,pageNumber:m}):null]}):null})]})}var Se=e=>e.userId??`—`,Ce=e=>`lastKnownBundleId`in e?e.lastKnownBundleId:e.type===`UPDATE_DOWNLOADED`||e.type===`UPDATE_FAILED`?e.fromBundleId:e.toBundleId;function we({error:t,history:n,isLoading:a,onNext:o,onPrevious:s,onRefresh:c,pageNumber:l,retention:u=k,selectedEvent:d,selectedInstallId:f}){let p=w(),m=d?Ce(d):void 0,h=d&&`pendingBundleId`in d?d.pendingBundleId:d&&`type`in d&&d.type===`UPDATE_DOWNLOADED`?d.toBundleId:null;return(0,Y.jsxs)(P,{className:`@container min-h-0 min-w-0 shadow-sm`,children:[(0,Y.jsx)(I,{className:`p-4 sm:p-6`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Y.jsx)(L,{className:`text-sm font-medium`,children:(0,Y.jsx)(`h2`,{children:f===void 0?`Select an installation`:`Installation history`})}),f===void 0?null:(0,Y.jsxs)(M,{children:[`Bundle changes and update failures are kept for`,` `,A(u.rawDays),`; the latest report, for`,` `,A(u.dailyDays),` after the installation last reports.`]})]}),c&&f!==void 0?(0,Y.jsxs)(e,{className:`h-11 lg:h-8`,size:`lg`,variant:`outline`,onClick:c,disabled:a,children:[(0,Y.jsx)(oe,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Refresh`]}):null]})}),(0,Y.jsxs)(N,{className:`min-h-0 p-0`,children:[f!==void 0&&d?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"aria-labelledby":`latest-installation-state`,className:`px-4 pb-4 sm:px-6 sm:pb-6`,children:[(0,Y.jsx)(`h3`,{className:`sr-only`,id:`latest-installation-state`,children:`Latest reported state`}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 @[36rem]:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`col-span-2 min-w-0 @[36rem]:col-span-1`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`User ID`}),(0,Y.jsx)(`dd`,{className:`mt-1 text-sm font-medium wrap-anywhere`,children:Se(d)})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Install ID`}),(0,Y.jsx)(`dd`,{className:`mt-1 font-mono text-xs`,children:(0,Y.jsx)(z,{value:f,buttonClassName:`min-h-11 px-3 lg:min-h-0 lg:px-1.5`})})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Last known bundle`}),(0,Y.jsxs)(`dd`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2 font-mono text-xs`,children:[m?(0,Y.jsx)(z,{value:m,buttonClassName:`min-h-11 px-3 lg:min-h-0 lg:px-1.5`}):`—`,pe(m,d.minBundleId)?(0,Y.jsx)(fe,{}):null]})]}),h?(0,Y.jsxs)(`div`,{className:`col-span-2 min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Downloaded · Not launched yet`}),(0,Y.jsx)(`dd`,{className:`mt-1 text-xs`,children:(0,Y.jsx)(z,{value:h})})]}):null]}),d.httpResponse?(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(S,{event:d})}):null]}),(0,Y.jsx)(i,{})]}):null,f===void 0?null:a?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 p-6`,role:`status`,"aria-label":`Loading installation history`,children:[(0,Y.jsx)(r,{className:`h-10 w-full`}),(0,Y.jsx)(r,{className:`h-10 w-full`}),(0,Y.jsx)(r,{className:`h-10 w-full`})]}):t?(0,Y.jsx)(`div`,{className:`p-6`,children:(0,Y.jsx)(q,{error:t instanceof Error?t:Error(),fallbackTitle:`Installation history unavailable`})}):n&&n.data.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`@[48rem]:hidden`,children:(0,Y.jsx)(ve,{events:n.data,formatter:p})}),(0,Y.jsx)(`div`,{className:`hidden @[48rem]:block`,children:(0,Y.jsxs)(K,{className:`min-w-3xl table-fixed`,children:[(0,Y.jsx)(V,{children:(0,Y.jsxs)(W,{className:`[&>th]:px-4 sm:[&>th]:px-6`,children:[(0,Y.jsx)(H,{className:`w-64`,children:`Time`}),(0,Y.jsx)(H,{className:`w-48`,children:`Event`}),(0,Y.jsx)(H,{className:`w-32`,children:`App`}),(0,Y.jsx)(H,{className:`w-52`,children:`Bundle`})]})}),(0,Y.jsx)(U,{children:n.data.map(e=>(0,Y.jsxs)(W,{className:`[&>td]:px-4 [&>td]:py-4 [&>td]:align-top sm:[&>td]:px-6`,children:[(0,Y.jsx)(G,{className:`whitespace-normal text-xs tabular-nums`,children:(0,Y.jsx)(C,{value:e.receivedAtMs,formatter:p})}),(0,Y.jsx)(G,{children:(0,Y.jsx)(T,{event:e})}),(0,Y.jsx)(G,{className:`whitespace-normal text-xs`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`span`,{children:[e.platform===`ios`?`iOS`:`Android`,` `,e.appVersion]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.channel})]})}),(0,Y.jsx)(G,{className:`whitespace-normal text-xs`,children:(0,Y.jsx)(E,{event:e})})]},e.id))})]})}),(0,Y.jsx)(X,{hasPrevious:l>1,label:`Installation history`,nextCursor:n.nextCursor,onNext:o,onPrevious:s,pageLength:n.data.length,pageNumber:l})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:l>1?`No older bundle changes.`:`No bundle changes recorded yet.`}),n&&(l>1||n.nextCursor)?(0,Y.jsx)(X,{hasPrevious:l>1,label:`Installation history`,nextCursor:n.nextCursor,onNext:o,onPrevious:s,pageLength:0,pageNumber:l}):null]})]})]})}var Te=e=>e.lastKnownBundleId,Ee=e=>e.userId??`—`;function De({error:r,onNext:i,onPrevious:a,onSelect:o,pageNumber:s,results:c,selectedInstallId:l}){let[u,d]=(0,J.useState)(!1),f=(0,J.useId)(),p=(0,J.useRef)(null),m=!r&&c&&c.data.length>0;return(0,Y.jsxs)(P,{className:`min-h-0 min-w-0 shadow-sm`,children:[(0,Y.jsx)(I,{className:`p-4 sm:px-6`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:(0,Y.jsx)(L,{className:`text-sm font-medium`,children:(0,Y.jsx)(`h2`,{children:`Matching installations`})})}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:m?(0,Y.jsx)(e,{"aria-controls":f,"aria-expanded":u,"aria-label":u?`Hide matching installations`:`Show matching installations`,className:`size-11 lg:hidden`,onClick:()=>d(!u),ref:p,size:`icon-lg`,variant:`ghost`,children:(0,Y.jsx)(b,{"aria-hidden":`true`,className:n(u&&`rotate-180`)})}):null})]})}),(0,Y.jsxs)(N,{className:n(`min-h-0 p-0`,m&&!u&&`hidden lg:block`),id:f,children:[r?(0,Y.jsx)(`div`,{className:`p-6`,children:(0,Y.jsx)(q,{error:r instanceof Error?r:Error(),fallbackTitle:`Installation search unavailable`})}):c&&c.data.length>0?(0,Y.jsx)(`ul`,{"aria-label":`Matching installations`,className:`divide-y`,children:c.data.map(e=>{let t=Te(e),n=e.installId===l;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{"aria-label":`${Ee(e)}, install ID ${e.installId}`,"aria-pressed":n,className:`group flex w-full min-w-0 flex-col gap-2 border-l-2 border-transparent px-4 py-4 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:border-ring focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/30 aria-pressed:border-primary aria-pressed:bg-muted/60 motion-reduce:transition-none sm:px-6`,onClick:()=>{o(e.installId),d(!1),p.current?.focus()},type:`button`,children:[(0,Y.jsxs)(`span`,{className:`flex w-full min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:Ee(e)}),n?(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs font-medium text-primary`,children:[(0,Y.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Selected`})]}):null]}),(0,Y.jsx)(`span`,{className:`flex flex-wrap items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,title:e.installId,children:R(e.installId)})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Bundle`}),t?(0,Y.jsx)(`span`,{className:`font-mono text-xs`,title:t,children:R(t)}):(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`—`})]})]})},e.installId)})}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 p-4 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No matches`}),(0,Y.jsx)(`a`,{className:t({variant:`outline`,className:`h-11 px-3 lg:h-8`}),href:`#installation-history-search`,children:`Edit search`})]}),c&&(c.data.length>0||s>1||c.nextCursor)?(0,Y.jsx)(X,{hasPrevious:s>1,label:`Installation results`,nextCursor:c.nextCursor,onNext:i,onPrevious:a,pageLength:c.data.length,pageNumber:s}):null]})]})}function Oe({draftQuery:t,onDraftQueryChange:n,onSubmit:r,onClear:i}){return(0,Y.jsx)(`form`,{"aria-label":`Find installation`,onSubmit:e=>{e.preventDefault(),t.trim()&&r()},role:`search`,children:(0,Y.jsxs)(F,{className:`gap-2`,children:[(0,Y.jsx)(j,{className:`sr-only`,htmlFor:`installation-history-search`,children:`User ID or installation ID`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(le,{className:`h-11 w-auto min-w-0 flex-1 basis-44 lg:h-8`,children:[(0,Y.jsx)(B,{children:(0,Y.jsx)(ue,{"aria-hidden":`true`})}),(0,Y.jsx)(se,{autoComplete:`off`,className:`h-11 text-base md:text-base lg:h-8 lg:text-xs`,id:`installation-history-search`,maxLength:1024,name:`installation`,onChange:e=>n(e.target.value),placeholder:`User ID or installation ID`,spellCheck:!1,type:`search`,value:t}),t.length>0?(0,Y.jsx)(B,{align:`inline-end`,children:(0,Y.jsx)(ce,{"aria-label":`Clear installation lookup`,className:`size-11 lg:size-5`,onClick:i,size:`icon-xs`,children:(0,Y.jsx)(s,{"aria-hidden":`true`})})}):null]}),(0,Y.jsx)(e,{"aria-label":`Find installation`,className:`h-11 px-3 lg:h-8`,disabled:t.trim().length===0,size:`lg`,type:`submit`,variant:`outline`,children:`Find`})]})]})})}function ke(){return(0,Y.jsxs)(`div`,{className:`grid items-stretch gap-6 lg:min-h-96 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(r,{className:`h-64 w-full lg:h-full`}),(0,Y.jsx)(r,{className:`h-64 w-full lg:h-full`})]})}var Ae=20,je=50,Z=()=>Date.now(),Q=(e,t)=>[...e,t??``],$=e=>({cursor:e?.at(-1)||void 0,stack:e.slice(0,-1)});function Me(){let t=y.useSearch(),n=y.useNavigate(),r=re(),[i,a]=(0,J.useState)(t.query??``),[o]=(0,J.useState)(Z),[s]=(0,J.useState)(Z),c=_e({select:e=>e.state.insightsPagination}),l=c?.eventsBack??[],u=c?.searchBack??[],d=c?.historyBack??[],f=t.query?.trim()??``,p=f.length>0,g=t.installId!==void 0,_=p||g,v=t.eventsBefore??o,b=t.eventsRange??`7d`,x=t.historyBefore??s,S=(e,r=!1,i={})=>{n({to:`/installations`,search:{...t,...e},state:e=>({...e,insightsPagination:{...e.insightsPagination,...i}}),replace:r})};(0,J.useEffect)(()=>{a(t.query??``)},[t.query]),(0,J.useEffect)(()=>{t.eventsBefore===void 0&&S({eventsBefore:v},!0)},[v,t.eventsBefore]),(0,J.useEffect)(()=>{g&&t.historyBefore===void 0&&S({historyBefore:x},!0)},[g,x,t.historyBefore]);let C=ne({...m(b,v),cursor:t.eventsCursor,limit:20},!_),w=ee({cursor:t.searchCursor,identity:f,limit:Ae},p);(0,J.useEffect)(()=>{let e=w.data?.data[0]?.installId;!p||g||e===void 0||S({historyBefore:Z(),historyCursor:void 0,installId:e},!0,{historyBack:[]})},[p,g,w.data?.data]);let T=te(t.installId??``,g),E=ie({beforeReceivedAtMs:x,cursor:t.historyCursor,installId:t.installId??``,limit:je},g),O=T.data??w.data?.data.find(({installId:e})=>e===t.installId)??E.data?.data[0],k=_?`installation-history-${t.historyCursor??`first`}`:`all-events-${t.eventsCursor??`first`}`,j=(0,J.useRef)(null),M=ge({id:k,getKey:h});(0,J.useLayoutEffect)(()=>{!_&&!C.isLoading&&j.current&&(j.current.scrollTop=M?.scrollY??0)},[C.isLoading,_,M?.scrollY,k]);let F=()=>{a(``),S({historyBefore:void 0,historyCursor:void 0,installId:void 0,query:void 0,searchCursor:void 0},!1,{historyBack:[],searchBack:[]})},I=(0,Y.jsx)(Oe,{draftQuery:i,onClear:F,onDraftQueryChange:a,onSubmit:()=>{let e=i.trim();if(!e){F();return}S({historyBefore:void 0,historyCursor:void 0,installId:void 0,query:e,searchCursor:void 0},!1,{historyBack:[],searchBack:[]})}});return(0,Y.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,Y.jsx)(me,{view:`events`}),(0,Y.jsx)(`div`,{ref:j,"data-scroll-restoration-id":k,id:`insights-events-scroll`,className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-4 sm:gap-6`,children:[_?(0,Y.jsx)(P,{className:`shadow-sm`,children:(0,Y.jsxs)(N,{className:`flex flex-col gap-3 p-4 sm:p-6`,children:[(0,Y.jsxs)(e,{className:`-ml-2 h-11 self-start lg:h-8`,onClick:F,variant:`ghost`,children:[(0,Y.jsx)(D,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Back to all events`]}),I]})}):null,_?w.isLoading&&p?(0,Y.jsx)(ke,{}):(0,Y.jsxs)(`div`,{className:`grid min-h-0 min-w-0 items-stretch gap-4 sm:gap-6 ${p?`lg:min-h-96 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)]`:`lg:grid-cols-1`}`,children:[p?(0,Y.jsx)(De,{error:w.error,onNext:()=>{w.data?.nextCursor&&S({installId:void 0,searchCursor:w.data.nextCursor},!0,{searchBack:Q(u,t.searchCursor)})},onPrevious:()=>{let e=$(u);S({installId:void 0,searchCursor:e.cursor},!0,{searchBack:e.stack})},onSelect:e=>{S({historyBefore:Z(),historyCursor:void 0,installId:e},!1,{historyBack:[]})},pageNumber:u.length+1,results:w.data,selectedInstallId:t.installId}):null,(0,Y.jsx)(we,{error:E.error??T.error,history:E.data,isLoading:E.isLoading||T.isLoading,onNext:()=>{E.data?.nextCursor&&S({historyCursor:E.data.nextCursor},!0,{historyBack:Q(d,t.historyCursor)})},onPrevious:()=>{let e=$(d);S({historyCursor:e.cursor},!0,{historyBack:e.stack})},onRefresh:()=>{S({historyBefore:Z(),historyCursor:void 0},!0,{historyBack:[]})},pageNumber:d.length+1,retention:r,selectedEvent:O,selectedInstallId:t.installId})]}):(0,Y.jsx)(xe,{description:`Downloads, launches, crashes, update failures, and other changes to what an installation runs, newest first, kept for ${A(r.rawDays)}. Launches that change nothing aren't listed.`,error:C.error,eventsLocation:{eventsBefore:v,eventsCursor:t.eventsCursor,eventsRange:t.eventsRange},history:C.data,isFetching:C.isFetching,isLoading:C.isLoading,onNext:()=>{C.data?.nextCursor&&S({eventsCursor:C.data.nextCursor},!0,{eventsBack:Q(l,t.eventsCursor)})},onPrevious:()=>{let e=$(l);S({eventsCursor:e.cursor},!0,{eventsBack:e.stack})},onRangeChange:e=>{S({eventsBefore:Z(),eventsCursor:void 0,eventsRange:e},!1,{eventsBack:[]})},onRefresh:()=>{S({eventsBefore:Z(),eventsCursor:void 0},!0,{eventsBack:[]})},pageNumber:l.length+1,range:b,rawDays:r.rawDays,children:I})]})},k)]})}export{Me as component};
@@ -0,0 +1 @@
1
+ import{ar as e}from"./sidebar-DNVyJPfX.js";var t=e(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{ar as e}from"./sidebar-DNVyJPfX.js";var t=e(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{ar as e}from"./sidebar-DNVyJPfX.js";var t=e(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{Ur as e}from"./sidebar-DNVyJPfX.js";import{n as t,t as n}from"./remote-config-Br56BODb.js";var r=e();function i(){let{tab:e=`parameters`}=n.useSearch(),i=n.useNavigate();return(0,r.jsx)(t,{onTabChange:e=>void i({search:e===`parameters`?{}:{tab:e},replace:!0}),tab:e})}export{i as component};
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-CXOi0LRu.js","assets/ConsoleFeatureUnavailable-jB4Loglh.js","assets/sidebar-DNVyJPfX.js","assets/console-features-api-BH5m_PtQ.js","assets/arrow-up-right-BtffZA6e.js","assets/NotFoundPage-DIqCpWa3.js","assets/empty-CuT2UhFp.js","assets/remote-config-BWwHOkCK.js"])))=>i.map(i=>d[i]);
2
+ import{Bn as e,Fn as t,Gn as n,Hn as r,Hr as i,Jn as a,Ln as o,Nn as s,Rn as c,Ur as l,Vn as u,Wr as d,Z as f,Zn as p,ar as m,cr as h,ct as g,ei as _,ir as v,jr as y,nr as b,p as x,qt as S,ri as C,rr as w,un as T}from"./sidebar-DNVyJPfX.js";import{r as ee}from"./console-features-api-BH5m_PtQ.js";import{a as te,c as E,i as D,m as O,s as k}from"./useCompositeListItem-9E4pj_CH.js";import{a as ne,d as re,i as ie,l as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./alert-dialog-Bbk_4-WJ.js";import{h as de,i as fe}from"./api-DCM0wr6O.js";import{a as A,b as j,d as M,f as N,g as pe,h as me,i as he,l as P,m as ge,n as _e,o as ve,p as F,r as I,s as ye,t as L,u as R,v as z,y as be}from"./field-BBDpjIqu.js";import{N as xe,a as Se,i as B,n as Ce,o as we,r as V,s as Te,t as Ee}from"./select-BZZBXMkr.js";import{t as De}from"./clipboard-DS9ucUQL.js";import{a as Oe,c as H,i as ke,l as Ae,n as je,o as Me,r as Ne,t as Pe}from"./dialog-Bqbb7B0N.js";import{t as Fe}from"./refresh-cw-BYgoNCco.js";import{i as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve}from"./input-group-ja_30qaF.js";import{t as He}from"./search-DaTDPW25.js";import{a as Ue,i as We,n as U,o as Ge,r as Ke,s as qe,t as Je}from"./switch-DZ1TPwx-.js";import{t as Ye}from"./smartphone-DpTFgtKf.js";import{t as Xe}from"./undo-2-CmrHjwFc.js";import{n as W}from"./dist-LxKJB-Vu.js";import{a as Ze,i as Qe,n as $e,o as et,r as tt,t as nt}from"./tabs-C7FOEjFC.js";import{a as rt,i as it,n as at,o as ot,r as st,t as ct}from"./empty-CuT2UhFp.js";var lt=m(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ut=m(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),dt=m(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),ft=m(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),pt=m(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),mt=m(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),ht=m(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),gt=m(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),G=C(_()),K=l(),_t=C(Ue(),1),vt=C(We(),1),yt=w({method:`GET`}).middleware([b]).handler(d(`0ccfae64b399b03d820328fa98a38e2caa0b622d3da5a7ca633c5a0e8101e3f6`)),bt=w({method:`GET`}).middleware([b]).handler(d(`3377db68b9d1d971971595469029c0466da0777a177b294d655cd0c039737f1a`)),xt=w({method:`GET`}).middleware([b]).handler(d(`af71e3c55a659ce46093e33b9d70e729359610eec7d576502e8f0e26c785b317`)),St=w({method:`POST`}).middleware([b]).handler(d(`4182bf9ccbb675700638f30bc6122517ccd90b16a339a6823a0f5f6c808d70a6`)),Ct=w({method:`POST`}).middleware([b]).handler(d(`98c10bdc514eb4d3fe65af546be44452b492a81092cfe45625778a4c9f731727`)),wt=w({method:`POST`}).middleware([b]).handler(d(`1371bff16085636e2c44b60a573ae434b556c63045c40a0a93a93ab69ec47999`)),q={all:[`remote-config`],active:[`remote-config`,`active`],versions:[`remote-config`,`versions`],version:e=>[`remote-config`,`version`,e],preview:e=>[`remote-config`,`preview`,e]},Tt=()=>h({queryKey:q.active,queryFn:()=>yt(),staleTime:6e4}),Et=({enabled:e})=>O({queryKey:q.versions,queryFn:({pageParam:e})=>bt({data:e===void 0?{}:{cursor:e}}),initialPageParam:void 0,getNextPageParam:e=>e.next,staleTime:6e4,enabled:e}),Dt=e=>h({queryKey:q.version(e??0),queryFn:()=>xt({data:{version:e}}),enabled:e!==null,staleTime:1/0}),Ot=()=>{let e=i();return async()=>{await Promise.all([e.invalidateQueries({queryKey:q.active}),e.invalidateQueries({queryKey:q.versions})])}},kt=()=>{let e=Ot();return re({mutationFn:e=>St({data:e}),onSuccess:async t=>{(t.status===`published`||t.status===`conflict`)&&await e()}})},At=()=>re({mutationFn:e=>Ct({data:e}),onSuccess:Ot()}),jt=e=>h({queryKey:q.preview(e),queryFn:()=>wt({data:e}),placeholderData:y,staleTime:1/0}),J={STRING:`String`,NUMBER:`Number`,BOOLEAN:`Boolean`,JSON:`JSON`},Y={platform:`Platform`,channel:`Channel`,appVersion:`App version`,percent:`Percentage of installs`,cohort:`Cohort`,fingerprint:`Fingerprint`,dateTime:`Date and time`},X=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,Mt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Nt=(e,t,n,r)=>{let i=Object.entries(e.parameters),a=t===null?-1:i.findIndex(([e])=>e===t),o=a===-1?[...i.filter(([e])=>e!==n),[n,r]]:i.map((e,t)=>t===a?[n,r]:e);return{...e,parameters:Object.fromEntries(o)}},Pt=(e,t)=>({...e,parameters:Object.fromEntries(Object.entries(e.parameters).filter(([e])=>e!==t))}),Ft=(e,t)=>Object.fromEntries(Object.entries(e.parameters).map(([e,n])=>{let{conditionalValues:r,...i}=n,a=Object.entries(r??{}).flatMap(([e,n])=>{let r=t(e);return r===null?[]:[[r,n]]});return[e,a.length===0?i:{...i,conditionalValues:Object.fromEntries(a)}]})),It=(e,t,n)=>t===null?{...e,conditions:[...e.conditions,n]}:{conditions:e.conditions.map(e=>e.name===t?n:e),parameters:t===n.name?e.parameters:Ft(e,e=>e===t?n.name:e)},Lt=(e,t)=>({conditions:e.conditions.filter(e=>e.name!==t),parameters:Ft(e,e=>e===t?null:e)}),Rt=(e,t,n)=>{let r=t+n;if(r<0||r>=e.conditions.length)return e;let i=[...e.conditions];return[i[t],i[r]]=[i[r],i[t]],{...e,conditions:i}},zt=(e,t)=>Object.entries(e.parameters).filter(([,e])=>X(e.conditionalValues,t)!==void 0).map(([e])=>e),Bt=(e,t=3)=>e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} +${e.length-t}`,Vt=e=>Number.isInteger(e)?String(e):e.toFixed(1),Ht=e=>{let t=new Intl.DateTimeFormat(`en`,{timeZone:e,timeZoneName:e===`UTC`?`short`:`shortOffset`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});return e=>t.format(new Date(e))},Ut=Ht(`UTC`),Wt=(e=new Date)=>{let t=new Date(e);t.setMinutes(60,0,0);let n=new Date(e);n.setDate(n.getDate()+1),n.setHours(9,0,0,0);let r=new Date(e);return r.setSeconds(0,0),[{label:`Now`,iso:r.toISOString()},{label:`Next hour`,iso:t.toISOString()},{label:`Tomorrow 09:00`,iso:n.toISOString()}]},Gt=(e,t=new Date)=>{let n=e===void 0?t:new Date(e),r=e=>{let t=new Date(n);return t.setDate(t.getDate()+e),t.setSeconds(0,0),t.toISOString()};return[{label:`+1 day`,iso:r(1)},{label:`+1 week`,iso:r(7)}]},Kt=e=>{if(e===void 0)return``;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`},qt=e=>{if(e.length===0)return;let t=new Date(e).getTime();return Number.isFinite(t)?new Date(t).toISOString():void 0},Jt=(e,t=Ut)=>{switch(e.type){case`platform`:return`Platform is ${Bt(e.platforms.map(e=>e===`ios`?`iOS`:`Android`))}`;case`channel`:return`Channel is ${Bt(e.channels)}`;case`appVersion`:return`App version ${e.range}`;case`cohort`:return`Cohort is ${Bt(e.cohorts)}`;case`percent`:return e.from===0?`${Vt(e.to)}% of installs`:`${Vt(e.from)}–${Vt(e.to)}% of installs`;case`fingerprint`:return`Fingerprint is ${Bt(e.hashes.map(e=>e.slice(0,8)))}`;case`dateTime`:return e.from!==void 0&&e.to!==void 0?`From ${t(e.from)} until ${t(e.to)}`:e.from===void 0?`Until ${t(e.to??``)}`:`From ${t(e.from)}`}},Z=e=>`value`in e?e.value.length===0?`""`:e.value:`In-app default`,Yt=()=>{let e=crypto.getRandomValues(new Uint8Array(6));return Array.from(e,e=>e.toString(36).padStart(2,`0`)).join(``).slice(0,8)},Xt=(e,t)=>({added:Object.keys(t).filter(t=>!Object.hasOwn(e,t)),changed:Object.keys(t).filter(n=>Object.hasOwn(e,n)&&JSON.stringify(e[n])!==JSON.stringify(t[n])),removed:Object.keys(e).filter(e=>!Object.hasOwn(t,e))}),Zt=(e,t)=>{let n=e=>Object.fromEntries(e.conditions.map(e=>[e.name,e])),r=(e,t)=>e.conditions.map(({name:e})=>e).filter(e=>t.conditions.some(t=>t.name===e));return{parameters:Xt(e.parameters,t.parameters),conditions:Xt(n(e),n(t)),reordered:r(e,t).join(`
3
+ `)!==r(t,e).join(`
4
+ `)}},Q=`Not set`,Qt=(e,t)=>{let n=[],r=(e,t,r)=>{(t===null?r!==Q:t!==r)&&n.push({field:e,before:t,after:r})};r(`Type`,e===null?null:J[e.valueType],J[t.valueType]),r(`Default`,e===null?null:Z(e.defaultValue),Z(t.defaultValue));let i=new Set([...Object.keys(e?.conditionalValues??{}),...Object.keys(t.conditionalValues??{})]);for(let n of i){let i=X(e?.conditionalValues,n),a=X(t.conditionalValues,n);r(`When ${n}`,e===null?null:i===void 0?Q:Z(i),a===void 0?Q:Z(a))}return r(`Description`,e===null?null:e.description??Q,t.description??Q),n},$t=(e,t,n=Ut)=>{let r=e=>e.rules.map(e=>Jt(e,n)).join(` · `),i=r(t);if(e===null)return[{field:`Rules`,before:null,after:i}];let a=r(e);return a===i?[]:[{field:`Rules`,before:a,after:i}]},en=`hot-updater:remote-config-draft`,$=e=>typeof e==`object`&&!!e&&!Array.isArray(e),tn=e=>$(e)&&(typeof e.value==`string`||e.useInAppDefault===!0),nn=e=>$(e)&&$(e.parameters)&&Array.isArray(e.conditions)&&Object.values(e.parameters).every(e=>$(e)&&Object.hasOwn(J,String(e.valueType))&&tn(e.defaultValue)&&(e.conditionalValues===void 0||$(e.conditionalValues)&&Object.values(e.conditionalValues).every(tn)))&&e.conditions.every(e=>$(e)&&typeof e.name==`string`&&Array.isArray(e.rules)&&e.rules.every(e=>$(e)&&Object.hasOwn(Y,String(e.type)))),rn=e=>{try{let t=window.localStorage.getItem(en);if(t===null)return null;let n=JSON.parse(t);return!$(n)||n.baseVersion!==e.version||!nn(n.base)||!nn(n.template)||!Mt(n.base,e.template)||Mt(n.template,e.template)?null:{baseVersion:e.version,base:n.base,template:n.template}}catch{return null}},an=e=>{try{return e===null?window.localStorage.removeItem(en):window.localStorage.setItem(en,JSON.stringify(e)),!0}catch{return!1}},on=/^[A-Za-z_][A-Za-z0-9_]{0,255}$/u,sn=(e,t)=>e.length===0?`Enter a key.`:on.test(e)?t.includes(e)?`Another parameter uses this key.`:null:`Start with a letter or _, then use letters, digits, and _.`,cn=(e,t)=>{if(e===`NUMBER`)return t.trim().length>0&&Number.isFinite(Number(t))?null:`Enter a number.`;if(e===`JSON`)try{return JSON.parse(t),null}catch{return`Enter valid JSON.`}return e===`BOOLEAN`&&t!==`true`&&t!==`false`?`Choose true or false.`:null},ln=(e,t,n)=>{let r=e.map(e=>Jt(e,n)).join(` · `),i=r.length<=100?r:`${r.slice(0,99).trimEnd()}…`;if(i.length===0||!t.includes(i))return i;for(let e=2;;e+=1){let n=` (${e})`,r=`${i.slice(0,100-n.length)}${n}`;if(!t.includes(r))return r}},un=(e,t)=>{let n=e.trim();return n.length===0?`Enter a name.`:n.length>100?`Use 100 characters or fewer.`:t.includes(n)?`Another condition uses this name.`:null},dn=e=>[...new Set(e.split(/[\n,]/u).map(e=>e.trim()).filter(e=>e.length>0))],fn=e=>{switch(e.type){case`platform`:return e.platforms.length===0?`Choose a platform.`:null;case`channel`:return e.channels.length===0?`Enter a channel.`:null;case`appVersion`:return e.range.trim().length===0?`Enter a version range, such as >=1.4.0.`:null;case`cohort`:return e.cohorts.length===0?`Enter a cohort.`:null;case`percent`:return e.from>=e.to||e.from<0||e.to>100||Math.abs(e.to*10-Math.round(e.to*10))>1e-9||Math.abs(e.from*10-Math.round(e.from*10))>1e-9?`Use a range from 0 to 100 in steps of 0.1.`:null;case`fingerprint`:return e.hashes.length===0?`Enter a fingerprint.`:null;case`dateTime`:return e.from===void 0&&e.to===void 0?`Choose a start, an end, or both.`:e.from!==void 0&&e.to!==void 0&&e.from>=e.to?`End after the start.`:null}},pn=e=>{switch(e){case`platform`:return{type:e,platforms:[`ios`]};case`channel`:return{type:e,channels:[]};case`appVersion`:return{type:e,range:``};case`cohort`:return{type:e,cohorts:[]};case`percent`:return{type:e,seed:Yt(),from:0,to:10};case`fingerprint`:return{type:e,hashes:[]};case`dateTime`:return{type:e,from:Wt()[1].iso}}},mn=G.createContext(void 0);function hn(e=!0){let t=G.useContext(mn);if(t===void 0&&!e)throw Error(a(7));return t}function gn(t){let{render:n,className:i,style:a,state:o=r,props:s=u,refs:c=u,metadata:l,stateAttributesMapping:d,tag:f=`div`,...p}=t,{compositeProps:m,compositeRef:h}=et({metadata:l});return e(f,t,{state:o,ref:[...c,h],props:[m,...s,p],stateAttributesMapping:d})}var _n=G.forwardRef(function(t,r){let{className:i,defaultPressed:a=!1,disabled:o=!1,form:s,onPressedChange:c,pressed:l,render:u,type:d,value:f,nativeButton:p=!0,style:m,...h}=t,_=g(f||void 0),v=hn(),y=v?.value??[],b=v?void 0:a,x=(o||v?.disabled)??!1,[C,w]=D({controlled:v?_!==void 0&&y.indexOf(_)>-1:l,default:b,name:`Toggle`,state:`pressed`}),{getButtonProps:ee,buttonRef:te}=n({disabled:x,native:p}),E={disabled:x,pressed:C},O=[te,r],k=[{"aria-pressed":C,onClick(e){let t=!C,n=S(T,e.nativeEvent);_&&v?.setGroupValue?.(_,t,n),c?.(t,n),!n.isCanceled&&w(t)}},h,ee],ne=e(`button`,t,{enabled:!v,state:E,ref:O,props:k});return v?(0,K.jsx)(gn,{tag:`button`,render:u,className:i,style:m,state:E,refs:O,props:k}):ne}),vn=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),yn={multiple(e){return e?{[vn.multiple]:``}:null}},bn=G.forwardRef(function(t,n){let{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:o,orientation:s=`horizontal`,multiple:c=!1,value:l,className:d,render:f,style:m,...h}=t,g=Te(!0),_=G.useMemo(()=>l!==void 0||r!==void 0,[l,r]),v=(g?.disabled??!1)||i,[y,b]=D({controlled:l,default:l===void 0?r??u:void 0,name:`ToggleGroup`,state:`value`}),x=p((e,t,n)=>{let r;c?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],o?.(r,n),!n.isCanceled&&b(r)}),S={disabled:v,multiple:c,orientation:s},C=G.useMemo(()=>({disabled:v,orientation:s,setGroupValue:x,value:y,isValueInitialized:_}),[v,s,x,y,_]),w={role:`group`},T=e(`div`,t,{enabled:!!g,state:S,ref:n,props:[w,h],stateAttributesMapping:yn});return(0,K.jsx)(mn.Provider,{value:C,children:g?T:(0,K.jsx)(Ze,{render:f,className:d,style:m,state:S,refs:[n],props:[w,h],stateAttributesMapping:yn,loopFocus:a,enableHomeAndEndKeys:!0,orientation:s})})}),xn=c(`group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-7 min-w-7 px-2 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,sm:`h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),Sn=G.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function Cn({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...s}){return(0,K.jsx)(bn,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:o(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] data-vertical:flex-col data-vertical:items-stretch`,e),...s,children:(0,K.jsx)(Sn.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function wn({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=G.useContext(Sn);return(0,K.jsx)(_n,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:o(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,xn({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function Tn(){let[e,t]=(0,G.useState)(`UTC`);return(0,G.useEffect)(()=>{t(Intl.DateTimeFormat().resolvedOptions().timeZone)},[]),{timeZone:e,dateTimeText:(0,G.useMemo)(()=>Ht(e),[e])}}var En=Object.keys(Y);function Dn({id:e,values:t,onChange:n,placeholder:r,multiline:i=!1}){let[a,o]=(0,G.useState)(t.join(`, `)),[s,c]=(0,G.useState)(t);s!==t&&(c(t),dn(a).join(`
5
+ `)!==t.join(`
6
+ `)&&o(t.join(`, `)));let l=e=>{o(e),n(dn(e))};return i?(0,K.jsx)(Re,{className:`min-h-20 font-mono text-xs`,id:e,onChange:e=>l(e.target.value),placeholder:r,spellCheck:!1,value:a}):(0,K.jsx)(f,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:e,onChange:e=>l(e.target.value),placeholder:r,value:a})}function On({id:e,label:n,value:r,presets:i,onChange:a}){return(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:e,children:n}),(0,K.jsxs)(Ve,{className:`h-11 sm:h-9`,children:[(0,K.jsx)(Ie,{className:`h-11 tabular-nums sm:h-9`,id:e,onChange:e=>a(qt(e.target.value)),type:`datetime-local`,value:Kt(r)}),r===void 0?null:(0,K.jsx)(Le,{align:`inline-end`,children:(0,K.jsx)(ze,{"aria-label":`Clear ${n.toLowerCase()}`,className:`size-11 sm:size-5`,onClick:()=>a(void 0),size:`icon-xs`,children:(0,K.jsx)(v,{})})})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,K.jsx)(t,{"aria-pressed":e.iso===r,className:`min-h-11 sm:min-h-6`,onClick:()=>a(e.iso),size:`xs`,type:`button`,variant:e.iso===r?`secondary`:`outline`,children:e.label},e.label))})]})}function kn({rule:e,onChange:n}){let r=(0,G.useId)(),i=fe();switch(e.type){case`platform`:return(0,K.jsx)(Cn,{"aria-label":`Platforms`,multiple:!0,onValueChange:t=>n({...e,platforms:t.filter(e=>e===`ios`||e===`android`)}),value:[...e.platforms],variant:`outline`,children:[`ios`,`android`].map(e=>(0,K.jsxs)(wn,{className:`min-h-11 px-3 sm:min-h-8`,value:e,children:[(0,K.jsx)(xe,{className:`size-3.5`,platform:e}),e===`ios`?`iOS`:`Android`]},e))});case`channel`:{let a=(i.data??[]).map(({name:e})=>e).filter(t=>!e.channels.includes(t));return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(Dn,{id:`${r}-channels`,onChange:t=>n({...e,channels:t}),placeholder:`production, beta`,values:e.channels}),a.length>0?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Add:`}),a.slice(0,8).map(r=>(0,K.jsxs)(t,{className:`min-h-11 sm:min-h-6`,onClick:()=>n({...e,channels:[...e.channels,r]}),size:`xs`,type:`button`,variant:`outline`,children:[(0,K.jsx)(H,{"data-icon":`inline-start`}),r]},r))]}):null]})}case`appVersion`:return(0,K.jsx)(f,{"aria-label":`App version range`,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,onChange:t=>n({...e,range:t.target.value}),placeholder:`>=1.4.0`,value:e.range});case`cohort`:return(0,K.jsx)(Dn,{id:`${r}-cohorts`,onChange:t=>n({...e,cohorts:t}),placeholder:`1, 2, beta-testers`,values:e.cohorts});case`percent`:return(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[repeat(2,minmax(0,8rem))_minmax(0,1fr)]`,children:[(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:`${r}-from`,children:`From %`}),(0,K.jsx)(f,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${r}-from`,inputMode:`decimal`,max:100,min:0,onChange:t=>n({...e,from:Number(t.target.value)}),step:.1,type:`number`,value:e.from})]}),(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:`${r}-to`,children:`To %`}),(0,K.jsx)(f,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${r}-to`,inputMode:`decimal`,max:100,min:0,onChange:t=>n({...e,to:Number(t.target.value)}),step:.1,type:`number`,value:e.to})]}),(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:`${r}-seed`,children:`Seed`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(f,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${r}-seed`,onChange:t=>n({...e,seed:t.target.value}),value:e.seed}),(0,K.jsx)(t,{"aria-label":`New seed`,className:`size-11 sm:size-9`,onClick:()=>n({...e,seed:Yt()}),size:`icon`,type:`button`,variant:`outline`,children:(0,K.jsx)(Fe,{})})]})]})]});case`fingerprint`:return(0,K.jsx)(Dn,{id:`${r}-hashes`,multiline:!0,onChange:t=>n({...e,hashes:t}),placeholder:`One fingerprint hash per line`,values:e.hashes});case`dateTime`:{let t=(t,r)=>{let{[t]:i,...a}=e;n(r===void 0?a:{...a,[t]:r})};return(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)(On,{id:`${r}-from`,label:`From`,onChange:e=>t(`from`,e),presets:Wt(),value:e.from}),(0,K.jsx)(On,{id:`${r}-until`,label:`Until`,onChange:e=>t(`to`,e),presets:Gt(e.from),value:e.to})]})}}}var An={platform:`Devices on any of these platforms.`,channel:`Devices on any of these channels, separated by commas.`,appVersion:`A semver range of native app versions, as release targets use: 2.x, >=1.4.0 <2.0.0.`,percent:`Installs whose numeric cohort lands in this share. Rules with one seed split the same order, so 0–10 and 10–20 never overlap.`,cohort:`Numeric cohorts from 1 to 1000, or custom cohort names.`,fingerprint:`Native builds with any of these fingerprints.`,dateTime:`Leave either end empty to keep it open. Devices get the change at their next fetch.`};function jn({open:e,onOpenChange:t,condition:n,takenNames:r,onSave:i}){let a=Ke(e);return(0,K.jsx)(Pe,{onOpenChange:t,open:e,children:(0,K.jsx)(je,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-xl`,children:(0,K.jsx)(Mn,{condition:n,onCancel:()=>t(!1),onSave:e=>{i(e),t(!1)},takenNames:r},a)})})}function Mn({condition:e,takenNames:n,onSave:r,onCancel:i}){let a=(0,G.useId)(),{dateTimeText:o,timeZone:s}=Tn(),[c,l]=(0,G.useState)(()=>e===null||e.name===ln(e.rules,n,o)?``:e.name),[u,d]=(0,G.useState)(e===null?[pn(`platform`)]:[...e.rules]),[p,m]=(0,G.useState)(!1),h=ln(u,n,o),g=c.trim().length===0?h:c,_=un(g,n),v=u.map(fn),y=En.filter(e=>!u.some(t=>t.type===e)),b=_!==null||u.length===0||v.some(e=>e!==null);return(0,K.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),m(!0),!b&&r({name:g.trim(),rules:u.map(e=>e.type===`appVersion`?{...e,range:e.range.trim()}:e)})},children:[(0,K.jsxs)(Oe,{children:[(0,K.jsx)(Me,{children:e===null?`Add condition`:`Edit condition`}),(0,K.jsx)(Ne,{children:`A device matches when it matches every rule.`})]}),(0,K.jsxs)(he,{children:[(0,K.jsxs)(L,{"data-invalid":p&&_!==null||void 0,children:[(0,K.jsx)(A,{htmlFor:`${a}-name`,children:`Name`}),(0,K.jsx)(f,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${a}-name`,maxLength:101,onChange:e=>l(e.target.value),placeholder:h||`Beta testers on iOS`,value:c}),(0,K.jsx)(_e,{children:`Optional: without one, it is named after its rules.`}),(0,K.jsx)(I,{children:p?_:null})]}),(0,K.jsxs)(ye,{children:[(0,K.jsx)(ve,{variant:`label`,children:`Rules`}),u.length===0?(0,K.jsx)(I,{children:p?`Add at least one rule.`:null}):null,(0,K.jsx)(`ol`,{className:`flex flex-col gap-3`,children:u.map((e,n)=>(0,K.jsx)(`li`,{className:`rounded-lg border p-3`,children:(0,K.jsxs)(L,{"data-invalid":p&&v[n]!==null||void 0,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:Y[e.type]}),(0,K.jsx)(t,{"aria-label":`Remove the ${Y[e.type].toLowerCase()} rule`,className:`size-11 sm:size-7`,onClick:()=>d(u.filter((e,t)=>t!==n)),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,K.jsx)(Ge,{})})]}),(0,K.jsx)(kn,{onChange:e=>d(u.map((t,r)=>r===n?e:t)),rule:e}),(0,K.jsx)(_e,{children:e.type===`dateTime`?`In your time zone, ${s}. ${An.dateTime}`:An[e.type]}),(0,K.jsx)(I,{children:p?v[n]:null})]})},e.type))}),y.length>0?(0,K.jsxs)(Ee,{items:Object.fromEntries(y.map(e=>[e,Y[e]])),onValueChange:e=>{e!==null&&d([...u,pn(e)])},value:null,children:[(0,K.jsxs)(Se,{"aria-label":`Add a rule`,className:`min-h-11 w-full sm:min-h-9 sm:w-56`,children:[(0,K.jsx)(H,{"aria-hidden":`true`,className:`size-3.5`}),(0,K.jsx)(we,{placeholder:`Add a rule`})]}),(0,K.jsx)(Ce,{alignItemWithTrigger:!1,children:(0,K.jsx)(V,{children:y.map(e=>(0,K.jsx)(B,{value:e,children:Y[e]},e))})})]}):null]})]}),(0,K.jsxs)(ke,{children:[(0,K.jsx)(t,{onClick:i,type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsx)(t,{type:`submit`,children:e===null?`Add condition`:`Save condition`})]})]})}function Nn({condition:e,dateTimeText:t}){let n=e.rules.map(e=>Jt(e,t)).join(` · `);return n===e.name?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}function Pn({template:e,onSaveCondition:n,onRemoveCondition:r,onMoveCondition:i}){let[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),l=U(a),u=U(s),{dateTimeText:d}=Tn(),{conditions:f}=e,p=l?.condition?.name??null,m=t=>{let n=zt(e,t);n.length===0?r(t):c({name:t,users:n})};return(0,K.jsxs)(ge,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(z,{className:`flex-row flex-wrap items-center justify-between gap-3 space-y-0 border-b px-4 py-3 sm:px-6`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(be,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Conditions`})}),(0,K.jsx)(pe,{className:`text-xs`,children:`Listed by priority: when several match a device, the first wins.`})]}),(0,K.jsxs)(t,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({condition:null}),children:[(0,K.jsx)(H,{"data-icon":`inline-start`}),`Add condition`]})]}),(0,K.jsx)(me,{className:`p-0`,children:f.length===0?(0,K.jsxs)(ct,{className:`py-10`,children:[(0,K.jsxs)(it,{children:[(0,K.jsx)(rt,{variant:`icon`,children:(0,K.jsx)(pt,{})}),(0,K.jsx)(ot,{children:`No conditions`}),(0,K.jsx)(st,{children:`Add a condition to give some devices other values: a platform, channel, app version range, cohort, or a share of installs.`})]}),(0,K.jsx)(at,{children:(0,K.jsxs)(t,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({condition:null}),children:[(0,K.jsx)(H,{"data-icon":`inline-start`}),`Add condition`]})})]}):(0,K.jsx)(`ol`,{"aria-label":`Conditions`,className:`divide-y`,children:f.map((n,r)=>{let a=zt(e,n.name);return(0,K.jsxs)(`li`,{className:`grid gap-3 px-4 py-3 sm:px-6 md:grid-cols-[auto_minmax(0,1fr)_auto] md:items-center`,children:[(0,K.jsx)(`span`,{"aria-label":`Priority ${r+1}`,className:`flex size-6 items-center justify-center rounded-md bg-muted text-xs font-medium tabular-nums`,children:r+1}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:n.name}),(0,K.jsx)(Nn,{condition:n,dateTimeText:d}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:a.length===0?`No parameter uses it yet`:`Sets ${a.length===1?`1 parameter`:`${a.length} parameters`}: ${a.slice(0,3).join(`, `)}${a.length>3?`…`:``}`})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1 md:justify-end`,children:[(0,K.jsx)(t,{"aria-label":`Move ${n.name} up`,className:`size-11 md:size-7`,disabled:r===0,onClick:()=>i(r,-1),size:`icon`,variant:`ghost`,children:(0,K.jsx)(ut,{})}),(0,K.jsx)(t,{"aria-label":`Move ${n.name} down`,className:`size-11 md:size-7`,disabled:r===f.length-1,onClick:()=>i(r,1),size:`icon`,variant:`ghost`,children:(0,K.jsx)(lt,{})}),(0,K.jsxs)(t,{"aria-label":`Edit ${n.name}`,className:`min-h-11 md:min-h-7`,onClick:()=>o({condition:n}),size:`sm`,variant:`outline`,children:[(0,K.jsx)(ht,{"data-icon":`inline-start`}),`Edit`]}),(0,K.jsx)(t,{"aria-label":`Delete ${n.name}`,className:`size-11 md:size-7`,onClick:()=>m(n.name),size:`icon`,variant:`ghost`,children:(0,K.jsx)(Ge,{})})]})]},n.name)})})}),(0,K.jsx)(jn,{condition:l?.condition??null,onOpenChange:e=>{e||o(null)},onSave:e=>n(p,e),open:a!==null,takenNames:f.map(({name:e})=>e).filter(e=>e!==p)}),(0,K.jsx)(ue,{onOpenChange:e=>{e||c(null)},open:s!==null,children:(0,K.jsxs)(ie,{children:[(0,K.jsxs)(le,{children:[(0,K.jsxs)(ae,{children:[`Delete `,u?.name,`?`]}),(0,K.jsxs)(ne,{children:[u?.users.length===1?`1 parameter has a value for it`:`${u?.users.length} parameters have a value for it`,` `,`(`,u?.users.join(`, `),`). Those values are removed too, so matching devices get the default value after you publish.`]})]}),(0,K.jsxs)(se,{children:[(0,K.jsx)(ce,{children:`Cancel`}),(0,K.jsx)(oe,{onClick:e=>{e.preventDefault(),s!==null&&r(s.name),c(null)},variant:`destructive`,children:`Delete condition`})]})]})})]})}var Fn=e=>e===`BOOLEAN`?`false`:e===`NUMBER`?`0`:e===`JSON`?`{}`:``,In=(e,t)=>`value`in t?cn(e,t.value):null;function Ln({id:e,label:n,valueType:r,value:i,onChange:a,showErrors:o}){let s=!(`value`in i),c=`value`in i?i.value:``,l=o?In(r,i):null,u=e=>a({value:e});return(0,K.jsxs)(L,{"data-invalid":l!==null||void 0,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(A,{htmlFor:e,id:`${e}-label`,children:n}),(0,K.jsxs)(`div`,{className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground sm:min-h-0`,children:[(0,K.jsx)(Je,{checked:s,id:`${e}-in-app-default`,onCheckedChange:e=>a(e?{useInAppDefault:!0}:{value:Fn(r)})}),(0,K.jsx)(`label`,{htmlFor:`${e}-in-app-default`,children:`Use in-app default`})]})]}),s?(0,K.jsxs)(`p`,{className:`rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground`,id:e,children:[`Devices keep the default set in the app's`,` `,(0,K.jsxs)(`code`,{className:`font-mono`,children:[`remoteConfig(`,`{ defaults }`,`)`]}),`.`]}):r===`BOOLEAN`?(0,K.jsxs)(Cn,{"aria-labelledby":`${e}-label`,id:e,onValueChange:e=>{let[t]=e;(t===`true`||t===`false`)&&u(t)},value:[c],variant:`outline`,children:[(0,K.jsx)(wn,{className:`min-h-11 px-4 sm:min-h-8`,value:`true`,children:`true`}),(0,K.jsx)(wn,{className:`min-h-11 px-4 sm:min-h-8`,value:`false`,children:`false`})]}):r===`NUMBER`?(0,K.jsx)(f,{"aria-invalid":l!==null||void 0,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:e,inputMode:`decimal`,onChange:e=>u(e.target.value),value:c}):r===`JSON`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(Re,{"aria-invalid":l!==null||void 0,className:`min-h-24 font-mono text-xs`,id:e,onChange:e=>u(e.target.value),spellCheck:!1,value:c}),(0,K.jsxs)(t,{className:`self-start`,disabled:cn(`JSON`,c)!==null,onClick:()=>u(JSON.stringify(JSON.parse(c),null,2)),size:`sm`,type:`button`,variant:`outline`,children:[(0,K.jsx)(dt,{"data-icon":`inline-start`}),`Format JSON`]})]}):(0,K.jsx)(Re,{"aria-invalid":l!==null||void 0,className:`min-h-11 text-sm sm:min-h-9`,id:e,onChange:e=>u(e.target.value),rows:2,value:c}),(0,K.jsx)(I,{children:l})]})}var Rn=Object.keys(J),zn={STRING:`getString`,NUMBER:`getNumber`,BOOLEAN:`getBoolean`,JSON:`getString`},Bn=(e,t)=>`value`in e&&In(t,e)!==null?{value:Fn(t)}:e;function Vn({open:e,onOpenChange:t,parameterKey:n,parameter:r,takenKeys:i,conditions:a,onSave:o,onAddCondition:s}){let c=Ke(e);return(0,K.jsx)(Pe,{onOpenChange:t,open:e,children:(0,K.jsx)(je,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto data-nested-dialog-open:after:absolute data-nested-dialog-open:after:inset-0 data-nested-dialog-open:after:rounded-xl data-nested-dialog-open:after:bg-background/70 sm:max-w-2xl`,children:(0,K.jsx)(Hn,{conditions:a,onAddCondition:s,onCancel:()=>t(!1),onSave:(e,n)=>{o(e,n),t(!1)},parameter:r,parameterKey:n,takenKeys:i},c)})})}function Hn({parameterKey:e,parameter:n,takenKeys:r,conditions:i,onSave:a,onCancel:o,onAddCondition:s}){let c=(0,G.useId)(),{dateTimeText:l}=Tn(),[u,d]=(0,G.useState)(e??``),[p,m]=(0,G.useState)(n?.valueType??`STRING`),[h,g]=(0,G.useState)(n?.description??``),_=h.trim().length>256,[y,b]=(0,G.useState)(n?.defaultValue??{value:``}),[x,S]=(0,G.useState)(n?.conditionalValues??{}),[C,w]=(0,G.useState)({}),[T,ee]=(0,G.useState)(!1),[te,E]=(0,G.useState)(!1),D=sn(u.trim(),r),O=i.filter(({name:e})=>X(x,e)!==void 0),k=i.filter(({name:e})=>X(x,e)===void 0),ne=D!==null||_||[y,...Object.values(x)].some(e=>In(p,e)!==null),re=e=>{m(e),b(Bn(y,e)),S(Object.fromEntries(Object.entries(x).map(([t,n])=>[t,Bn(n,e)])))},ie=e=>{let t=X(C,e);S({...x,[e]:t===void 0?{value:Fn(p)}:Bn(t,p)})},ae=e=>{let{[e]:t,...n}=x;t!==void 0&&w({...C,[e]:t}),S(n)};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{if(e.preventDefault(),ee(!0),ne)return;let t=Object.fromEntries(O.map(({name:e})=>[e,X(x,e)]));a(u.trim(),{valueType:p,defaultValue:y,...Object.keys(t).length===0?{}:{conditionalValues:t},...h.trim().length===0?{}:{description:h.trim()}})},children:[(0,K.jsxs)(Oe,{children:[(0,K.jsx)(Me,{children:e===null?`Add parameter`:`Edit parameter`}),(0,K.jsxs)(Ne,{children:[`The app reads it with`,` `,(0,K.jsxs)(`code`,{className:`font-mono`,children:[`hotUpdater.remoteConfig.`,zn[p],`("`,u.trim()||`key`,`")`]}),`, which is null when neither the server nor the app's defaults have a value.`]})]}),(0,K.jsxs)(he,{children:[(0,K.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[minmax(0,1fr)_11rem]`,children:[(0,K.jsxs)(L,{"data-invalid":T&&D!==null||void 0,children:[(0,K.jsx)(A,{htmlFor:`${c}-key`,children:`Key`}),(0,K.jsx)(f,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${c}-key`,maxLength:257,onChange:e=>d(e.target.value),placeholder:`welcome_message`,spellCheck:!1,value:u}),(0,K.jsx)(I,{children:T?D:null})]}),(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:`${c}-type`,children:`Type`}),(0,K.jsxs)(Ee,{items:J,onValueChange:e=>{e!==null&&re(e)},value:p,children:[(0,K.jsx)(Se,{className:`min-h-11 w-full sm:min-h-9`,id:`${c}-type`,children:(0,K.jsx)(we,{})}),(0,K.jsx)(Ce,{children:(0,K.jsx)(V,{children:Rn.map(e=>(0,K.jsx)(B,{value:e,children:J[e]},e))})})]})]})]}),(0,K.jsxs)(L,{"data-invalid":_||void 0,children:[(0,K.jsx)(A,{htmlFor:`${c}-description`,children:`Description`}),(0,K.jsx)(f,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${c}-description`,onChange:e=>g(e.target.value),placeholder:`Optional: what the app does with it`,value:h}),(0,K.jsx)(I,{children:_?`Use 256 characters or fewer.`:null})]}),(0,K.jsx)(Ln,{id:`${c}-default`,label:`Default value`,onChange:b,showErrors:T,value:y,valueType:p}),(0,K.jsxs)(ye,{children:[(0,K.jsx)(ve,{variant:`label`,children:`Conditional values`}),(0,K.jsx)(_e,{children:`Devices that match a condition get its value. When several match, the first in the Conditions list wins. Removing a value keeps the condition, and its devices get the default value.`}),O.length>0?(0,K.jsx)(`ul`,{className:`flex flex-col gap-3`,children:O.map(e=>(0,K.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),(0,K.jsx)(Nn,{condition:e,dateTimeText:l})]}),(0,K.jsxs)(t,{"aria-label":`Remove the value for ${e.name}`,className:`min-h-11 shrink-0 text-muted-foreground sm:min-h-7`,onClick:()=>ae(e.name),size:`sm`,type:`button`,variant:`ghost`,children:[(0,K.jsx)(v,{"data-icon":`inline-start`}),`Remove value`]})]}),(0,K.jsx)(Ln,{id:`${c}-${e.name}`,label:(0,K.jsxs)(K.Fragment,{children:[`Value`,(0,K.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]}),onChange:t=>S({...x,[e.name]:t}),showErrors:T,value:X(x,e.name),valueType:p})]},e.name))}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0?(0,K.jsxs)(Ee,{items:Object.fromEntries(k.map(({name:e})=>[e,e])),onValueChange:e=>{e!==null&&ie(e)},value:null,children:[(0,K.jsxs)(Se,{"aria-label":`Add a value for a condition`,className:`min-h-11 w-full sm:min-h-9 sm:w-64`,children:[(0,K.jsx)(H,{"aria-hidden":`true`,className:`size-3.5`}),(0,K.jsx)(we,{placeholder:`Add a value for a condition`})]}),(0,K.jsx)(Ce,{alignItemWithTrigger:!1,children:(0,K.jsx)(V,{children:k.map(({name:e})=>(0,K.jsx)(B,{value:e,children:e},e))})})]}):null,(0,K.jsxs)(t,{className:`min-h-11 sm:min-h-9`,onClick:()=>E(!0),type:`button`,variant:`outline`,children:[(0,K.jsx)(H,{"data-icon":`inline-start`}),`New condition`]})]})]})]}),(0,K.jsxs)(ke,{children:[(0,K.jsx)(t,{onClick:o,type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsx)(t,{type:`submit`,children:e===null?`Add parameter`:`Save parameter`})]})]}),(0,K.jsx)(jn,{condition:null,onOpenChange:E,onSave:e=>{s(e),ie(e.name)},open:te,takenNames:i.map(({name:e})=>e)})]})}function Un({text:e}){return(0,K.jsx)(`span`,{className:`line-clamp-2 block min-w-0 break-words font-mono text-xs text-foreground`,title:e,children:e})}function Wn({parameterKey:e,parameter:n,conditions:r,onEdit:i,onRemove:a}){let o=r.filter(({name:e})=>X(n.conditionalValues,e)!==void 0);return(0,K.jsxs)(`li`,{className:`grid gap-3 px-4 py-3 sm:px-6 md:grid-cols-[minmax(0,15rem)_minmax(0,1fr)_auto] md:items-start`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate font-mono text-sm font-medium`,children:e}),(0,K.jsx)(P,{className:`shrink-0`,variant:`outline`,children:J[n.valueType]})]}),n.description===void 0?null:(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n.description})]}),(0,K.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[minmax(0,9rem)_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:[o.map(({name:e})=>(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`line-clamp-2 break-words text-muted-foreground`,title:e,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0`,children:(0,K.jsx)(Un,{text:Z(X(n.conditionalValues,e))})})]},e)),(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Default`}),(0,K.jsx)(`dd`,{className:`min-w-0`,children:`value`in n.defaultValue?(0,K.jsx)(Un,{text:Z(n.defaultValue)}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`In-app default`})})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,K.jsxs)(t,{"aria-label":`Edit ${e}`,className:`min-h-11 md:min-h-7`,onClick:i,size:`sm`,variant:`outline`,children:[(0,K.jsx)(ht,{"data-icon":`inline-start`}),`Edit`]}),(0,K.jsx)(t,{"aria-label":`Delete ${e}`,className:`size-11 md:size-7`,onClick:a,size:`icon`,variant:`ghost`,children:(0,K.jsx)(Ge,{})})]})]})}function Gn({template:e,onSaveParameter:n,onRemoveParameter:r,onAddCondition:i}){let[a,o]=(0,G.useState)(null),s=U(a),[c,l]=(0,G.useState)(``),u=Object.keys(e.parameters),d=u.filter(e=>e.toLowerCase().includes(c.trim().toLowerCase())),f=s?.key??null;return(0,K.jsxs)(ge,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(z,{className:`flex-row flex-wrap items-center justify-between gap-3 space-y-0 border-b px-4 py-3 sm:px-6`,children:[(0,K.jsx)(be,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Parameters`})}),(0,K.jsxs)(`div`,{className:`flex w-full flex-wrap gap-2 sm:w-auto`,children:[u.length>5?(0,K.jsxs)(Ve,{className:`min-h-11 w-full sm:min-h-8 sm:w-56`,children:[(0,K.jsx)(Le,{children:(0,K.jsx)(He,{"aria-hidden":`true`})}),(0,K.jsx)(Ie,{"aria-label":`Filter parameters by key`,className:`text-base sm:text-xs`,onChange:e=>l(e.target.value),placeholder:`Filter by key`,value:c})]}):null,(0,K.jsxs)(t,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({key:null,parameter:null}),children:[(0,K.jsx)(H,{"data-icon":`inline-start`}),`Add parameter`]})]})]}),(0,K.jsx)(me,{className:`p-0`,children:u.length===0?(0,K.jsxs)(ct,{className:`py-10`,children:[(0,K.jsxs)(it,{children:[(0,K.jsx)(rt,{variant:`icon`,children:(0,K.jsx)(qe,{})}),(0,K.jsx)(ot,{children:`No parameters`}),(0,K.jsx)(st,{children:`Add a parameter, give it a default, then publish to change the app without a new build.`})]}),(0,K.jsx)(at,{children:(0,K.jsxs)(t,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({key:null,parameter:null}),children:[(0,K.jsx)(H,{"data-icon":`inline-start`}),`Add parameter`]})})]}):d.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-xs text-muted-foreground`,children:[(0,K.jsx)(`p`,{className:`font-medium text-foreground`,children:`No matching keys`}),(0,K.jsx)(t,{onClick:()=>l(``),size:`sm`,variant:`outline`,children:`Clear filter`})]}):(0,K.jsx)(`ul`,{"aria-label":`Parameters`,className:`divide-y`,children:d.map(t=>(0,K.jsx)(Wn,{conditions:e.conditions,onEdit:()=>o({key:t,parameter:e.parameters[t]??null}),onRemove:()=>r(t),parameter:e.parameters[t],parameterKey:t},t))})}),(0,K.jsx)(Vn,{conditions:e.conditions,onAddCondition:i,onOpenChange:e=>{e||o(null)},onSave:(e,t)=>n(f,e,t),open:a!==null,parameter:s?.parameter??null,parameterKey:f,takenKeys:u.filter(e=>e!==f)})]})}var Kn={platform:`ios`,channel:`production`,appVersion:`1.0.0`,cohort:`1`,fingerprintHash:``,at:``},qn=(e,t=300)=>{let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n};function Jn({template:e,isDraft:t}){let n=(0,G.useId)(),[r,i]=(0,G.useState)(Kn),{at:a,...o}=qn(r),c=qt(a),l=jt({template:e,context:{...o,...c===void 0?{}:{now:Date.parse(c)}}}),u=Object.keys(e.parameters),d=(e,t)=>i({...r,[e]:t});return(0,K.jsxs)(ge,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(z,{className:`border-b px-4 py-3 sm:px-6`,children:[(0,K.jsx)(be,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Preview a device`})}),(0,K.jsx)(pe,{className:`text-xs`,children:t?`The values this device would get once your changes are published, now or at the time you pick.`:`The values this device gets from the active version, now or at the time you pick.`})]}),(0,K.jsxs)(me,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:`${n}-platform`,children:`Platform`}),(0,K.jsxs)(Ee,{items:{ios:`iOS`,android:`Android`},onValueChange:e=>{(e===`ios`||e===`android`)&&d(`platform`,e)},value:r.platform,children:[(0,K.jsx)(Se,{className:`min-h-11 w-full sm:min-h-9`,id:`${n}-platform`,children:(0,K.jsxs)(we,{children:[(0,K.jsx)(xe,{className:`size-3.5`,platform:r.platform}),r.platform===`ios`?`iOS`:`Android`]})}),(0,K.jsx)(Ce,{children:(0,K.jsxs)(V,{children:[(0,K.jsxs)(B,{value:`ios`,children:[(0,K.jsx)(xe,{className:`size-3.5`,platform:`ios`}),`iOS`]}),(0,K.jsxs)(B,{value:`android`,children:[(0,K.jsx)(xe,{className:`size-3.5`,platform:`android`}),`Android`]})]})})]})]}),[[`channel`,`Channel`,`production`],[`appVersion`,`App version`,`1.0.0`],[`cohort`,`Cohort`,`1-1000 or a name`],[`fingerprintHash`,`Fingerprint`,`Optional`]].map(([e,t,i])=>(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:`${n}-${e}`,children:t}),(0,K.jsx)(f,{autoComplete:`off`,className:`min-h-11 text-base sm:min-h-9 sm:text-xs`,id:`${n}-${e}`,onChange:t=>d(e,t.target.value),placeholder:i,spellCheck:!1,value:r[e]})]},e)),(0,K.jsxs)(L,{children:[(0,K.jsx)(A,{htmlFor:`${n}-at`,children:`Time`}),(0,K.jsxs)(Ve,{className:`h-11 sm:h-9`,children:[(0,K.jsx)(Ie,{className:`h-11 text-base tabular-nums sm:h-9 sm:text-xs`,id:`${n}-at`,onChange:e=>d(`at`,e.target.value),type:`datetime-local`,value:r.at}),r.at.length===0?null:(0,K.jsx)(Le,{align:`inline-end`,children:(0,K.jsx)(ze,{className:`min-h-11 sm:min-h-6`,onClick:()=>d(`at`,``),size:`xs`,children:`Now`})})]})]})]}),u.length===0?(0,K.jsx)(ct,{className:`border py-8`,children:(0,K.jsxs)(it,{children:[(0,K.jsx)(rt,{variant:`icon`,children:(0,K.jsx)(Ye,{})}),(0,K.jsx)(ot,{children:`Nothing to preview`}),(0,K.jsx)(st,{children:`Add a parameter, and its value for this device shows here.`})]})}):l.data?.status===`invalid`?(0,K.jsxs)(R,{variant:`destructive`,children:[(0,K.jsx)(j,{}),(0,K.jsx)(F,{children:`The draft has problems to fix first`}),(0,K.jsx)(N,{children:(0,K.jsx)(`ul`,{className:`list-disc pl-4`,children:l.data.issues.slice(0,5).map(e=>(0,K.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):l.isError?(0,K.jsxs)(R,{variant:`destructive`,children:[(0,K.jsx)(j,{}),(0,K.jsx)(F,{children:`The preview couldn't be loaded`}),(0,K.jsx)(N,{children:`Check the connection, then change a field to try again.`})]}):l.data===void 0?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:`Loading the preview`}),u.slice(0,4).map(e=>(0,K.jsx)(s,{className:`h-8 w-full`},e))]}):(0,K.jsx)(`dl`,{"aria-busy":l.isFetching||void 0,className:`divide-y rounded-lg border`,children:u.map(e=>{let t=l.data.status===`ok`?l.data.parameters[e]:void 0;return(0,K.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,14rem)_minmax(0,1fr)_auto] sm:items-center sm:gap-3`,children:[(0,K.jsx)(`dt`,{className:`truncate font-mono text-xs font-medium`,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs`,children:t===void 0?`…`:t.value===null?(0,K.jsx)(`span`,{className:`font-sans text-muted-foreground`,children:`In-app default`}):(0,K.jsx)(`span`,{title:t.value,children:t.value.length===0?`""`:t.value})}),(0,K.jsx)(`dd`,{children:t?.condition===void 0?null:t.condition===null?(0,K.jsx)(P,{variant:`outline`,children:`Default value`}):(0,K.jsx)(P,{variant:`secondary`,children:t.condition})})]},e)})})]})]})}function Yn({name:e,fields:t}){return(0,K.jsxs)(`li`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`break-words font-mono`,children:e}),t.length===0?null:(0,K.jsx)(`ul`,{className:`mt-0.5 flex flex-col gap-0.5`,children:t.map(e=>(0,K.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:e.field}),e.before===null?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`max-w-full truncate font-mono line-through decoration-muted-foreground/60`,title:e.before,children:e.before}),(0,K.jsx)(de,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`to`})]}),(0,K.jsx)(`span`,{className:`max-w-full truncate font-mono text-foreground`,title:e.after,children:e.after})]},e.field))})]})}function Xn({label:e,changes:t,describe:n}){let r=[[`Added`,t.added],[`Changed`,t.changed],[`Removed`,t.removed]];return r.every(([,e])=>e.length===0)?null:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-xs font-medium`,children:e}),(0,K.jsx)(`dl`,{className:`mt-1 grid grid-cols-[5rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t.length===0?null:(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0`,children:e===`Removed`?(0,K.jsx)(`span`,{className:`break-words font-mono`,children:t.join(`, `)}):(0,K.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,K.jsx)(Yn,{fields:n(e),name:e},e))})})]},e))})]})}function Zn({open:e,onOpenChange:n,base:r,baseVersion:i,draft:a,onPublished:o,onLoadLatest:s,onPublishOver:c}){let l=(0,G.useId)(),u=kt(),[d,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(null),{dateTimeText:g}=Tn(),_=Zt(r,a),v=e=>{let t=Object.hasOwn(r.parameters,e)?r.parameters[e]:null,n=Object.hasOwn(a.parameters,e)?a.parameters[e]:null;return n===null?[]:Qt(t,n)},y=e=>{let t=r.conditions.find(t=>t.name===e)??null,n=a.conditions.find(t=>t.name===e)??null;return n===null?[]:$t(t,n,g)},b=d.trim().length>256,x=e=>{u.isPending||(n(e),e||(h(null),u.reset()))};return(0,K.jsx)(Pe,{onOpenChange:x,open:e,children:(0,K.jsx)(je,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-lg`,children:(0,K.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:async e=>{if(e.preventDefault(),!b)try{let e=await u.mutateAsync({template:a,baseVersion:i,...d.trim().length===0?{}:{description:d.trim()}});h(e),e.status===`published`&&(W.success(`Published version ${e.version.version}`),p(``),h(null),n(!1),o())}catch(e){W.error(e instanceof Error?e.message:`Unable to publish`)}},children:[(0,K.jsxs)(Oe,{children:[(0,K.jsx)(Me,{children:`Publish changes`}),(0,K.jsxs)(Ne,{children:[`This becomes version `,i+1,`. Devices get its values on their next fetch; earlier versions stay available to roll back to.`]})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,K.jsx)(Xn,{changes:_.parameters,describe:v,label:`Parameters`}),(0,K.jsx)(Xn,{changes:_.conditions,describe:y,label:`Conditions`}),_.reordered?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Condition priority changed.`}):null]}),m?.status===`invalid`?(0,K.jsxs)(R,{variant:`destructive`,children:[(0,K.jsx)(j,{}),(0,K.jsx)(F,{children:`The server refused the template`}),(0,K.jsx)(N,{children:(0,K.jsx)(`ul`,{className:`list-disc pl-4`,children:m.issues.slice(0,6).map(e=>(0,K.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):null,m?.status===`conflict`?(0,K.jsxs)(R,{children:[(0,K.jsx)(j,{}),(0,K.jsxs)(F,{children:[`Version `,m.currentVersion,` was published while you edited`]}),(0,K.jsx)(N,{children:`Load it to review what changed, or publish yours after it, replacing its values.`}),(0,K.jsxs)(`div`,{className:`col-span-full mt-2 flex flex-wrap gap-2`,children:[(0,K.jsxs)(t,{onClick:()=>{x(!1),s()},size:`sm`,type:`button`,variant:`outline`,children:[`Load version `,m.currentVersion]}),(0,K.jsx)(t,{onClick:()=>{c(m.currentVersion),h(null)},size:`sm`,type:`button`,variant:`ghost`,children:`Publish mine after it`})]})]}):null,(0,K.jsxs)(L,{"data-invalid":b||void 0,children:[(0,K.jsx)(A,{htmlFor:`${l}-description`,children:`Description`}),(0,K.jsx)(f,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${l}-description`,onChange:e=>p(e.target.value),placeholder:`What changed and why`,value:d}),(0,K.jsx)(_e,{children:`Shown in the version history.`}),(0,K.jsx)(I,{children:b?`Use 256 characters or fewer.`:null})]}),(0,K.jsxs)(ke,{children:[(0,K.jsx)(t,{disabled:u.isPending,onClick:()=>x(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsxs)(t,{disabled:u.isPending||m?.status===`conflict`,type:`submit`,children:[u.isPending?(0,K.jsx)(Ae,{className:`animate-spin`,"data-icon":`inline-start`}):(0,K.jsx)(gt,{"data-icon":`inline-start`}),`Publish version `,i+1]})]})]})})})}function Qn({ms:e}){let t=new Date(e);return(0,K.jsx)(`time`,{className:`tabular-nums`,dateTime:t.toISOString(),title:`${t.toISOString().replace(`T`,` `).slice(0,19)} UTC`,children:(0,_t.default)(e).format(`YYYY/MM/DD HH:mm`)})}function $n({open:e,version:n,onOpenChange:r}){let i=Dt(n),a=i.data===null||i.data===void 0?null:JSON.stringify(i.data.template,null,2);return(0,K.jsx)(Pe,{onOpenChange:r,open:e,children:(0,K.jsxs)(je,{className:`max-h-[calc(100svh-2rem)] grid-rows-[auto_minmax(0,1fr)] sm:max-w-2xl`,children:[(0,K.jsxs)(Oe,{children:[(0,K.jsxs)(Me,{children:[`Version `,n]}),(0,K.jsx)(Ne,{children:`The template as it was published, in the JSON the admin API takes.`})]}),i.isLoading?(0,K.jsx)(s,{className:`h-48 w-full`}):i.isError?(0,K.jsxs)(R,{variant:`destructive`,children:[(0,K.jsx)(j,{}),(0,K.jsx)(F,{children:`This version couldn't be loaded`}),(0,K.jsx)(N,{children:`Check the connection and try again.`}),(0,K.jsx)(M,{children:(0,K.jsxs)(t,{onClick:()=>void i.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(Fe,{"data-icon":`inline-start`}),`Retry`]})})]}):a===null?(0,K.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` no longer exists.`]}):(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:[(0,K.jsx)(`pre`,{className:`min-h-0 overflow-auto rounded-md bg-muted p-3 font-mono text-xs`,children:a}),(0,K.jsxs)(t,{className:`self-end`,onClick:()=>{navigator.clipboard.writeText(a).then(()=>W.success(`Template JSON copied`),()=>W.error(`Unable to copy the template`))},size:`sm`,variant:`outline`,children:[(0,K.jsx)(De,{"data-icon":`inline-start`}),`Copy JSON`]})]})]})})}function er({activeVersion:e,hasDraft:n,onRolledBack:r,onStartEditing:i}){let a=Et({enabled:!0}),o=At(),[c,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(null),f=U(c),p=U(u),m=a.data?.pages.flatMap(e=>e.versions)??[],h=async e=>{if(e.preventDefault(),u!==null)try{let e=await o.mutateAsync({version:u.source,baseVersion:u.next-1});e.status===`published`?(W.success(`Version ${e.version.version} restores version ${u.source}`),r()):e.status===`conflict`?W.error(`Version ${e.currentVersion} was published meanwhile. Review it, then roll back again.`):W.error(`That version no longer exists.`),d(null)}catch(e){W.error(e instanceof Error?e.message:`Unable to roll back`)}};return(0,K.jsxs)(ge,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsx)(z,{className:`border-b px-4 py-3 sm:px-6`,children:(0,K.jsx)(be,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Versions`})})}),(0,K.jsx)(me,{className:`p-0`,children:a.isError?(0,K.jsx)(`div`,{className:`p-4`,children:(0,K.jsxs)(R,{variant:`destructive`,children:[(0,K.jsx)(j,{}),(0,K.jsx)(F,{children:`Versions couldn't be loaded`}),(0,K.jsx)(N,{children:`Check the connection and try again.`}),(0,K.jsx)(M,{children:(0,K.jsxs)(t,{onClick:()=>void a.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(Fe,{"data-icon":`inline-start`}),`Retry`]})})]})}):a.isLoading?(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:p-6`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:`Loading versions`}),Array.from({length:3},(e,t)=>(0,K.jsx)(s,{className:`h-10 w-full`},t))]}):m.length===0?(0,K.jsxs)(ct,{className:`py-10`,children:[(0,K.jsxs)(it,{children:[(0,K.jsx)(rt,{variant:`icon`,children:(0,K.jsx)(mt,{})}),(0,K.jsx)(ot,{children:`No versions yet`}),(0,K.jsx)(st,{children:`Your first publish becomes version 1. Every publish after it is kept here, ready to roll back to.`})]}),(0,K.jsx)(at,{children:(0,K.jsx)(t,{className:`min-h-11 sm:min-h-7`,onClick:i,children:`Add a parameter`})})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ol`,{"aria-label":`Versions`,className:`divide-y`,children:m.map(n=>(0,K.jsxs)(`li`,{className:`grid gap-2 px-4 py-3 sm:px-6 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`span`,{className:`text-sm font-medium tabular-nums`,children:[`Version `,n.version]}),n.version===e?(0,K.jsx)(P,{children:`Active`}):null,n.updateType===`ROLLBACK`?(0,K.jsxs)(P,{variant:`outline`,children:[`Rollback to v`,n.rollbackSource]}):null]}),(0,K.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(Qn,{ms:n.createdAtMs}),n.description===null||n.updateType===`ROLLBACK`&&n.description===`Rollback to version ${n.rollbackSource}`?null:(0,K.jsxs)(K.Fragment,{children:[` · `,n.description]})]})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,K.jsxs)(t,{"aria-label":`View version ${n.version}`,className:`min-h-11 md:min-h-7`,onClick:()=>l(n.version),size:`sm`,variant:`ghost`,children:[(0,K.jsx)(ft,{"data-icon":`inline-start`}),`View`]}),(0,K.jsxs)(t,{"aria-label":`Roll back to version ${n.version}`,className:`min-h-11 md:min-h-7`,disabled:n.version===e,onClick:()=>d({source:n.version,next:e+1}),size:`sm`,variant:`outline`,children:[(0,K.jsx)(Be,{"data-icon":`inline-start`}),`Roll back`]})]})]},n.version))}),a.hasNextPage?(0,K.jsx)(`div`,{className:`border-t px-4 py-3 sm:px-6`,children:(0,K.jsxs)(t,{className:`min-h-11 w-full sm:min-h-7 sm:w-auto`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),variant:`outline`,children:[a.isFetchingNextPage?(0,K.jsx)(Ae,{className:`animate-spin`,"data-icon":`inline-start`}):null,`Load older versions`]})}):null]})}),(0,K.jsx)($n,{onOpenChange:e=>{e||l(null)},open:c!==null,version:f}),(0,K.jsx)(ue,{onOpenChange:e=>{!o.isPending&&!e&&d(null)},open:u!==null,children:(0,K.jsxs)(ie,{children:[(0,K.jsxs)(le,{children:[(0,K.jsxs)(ae,{children:[`Roll back to version `,p?.source,`?`]}),(0,K.jsxs)(ne,{children:[`Version `,p?.next,` will publish a copy of version`,` `,p?.source,`, and devices get its values on their next fetch.`,n?` Your unpublished changes are discarded.`:``]})]}),(0,K.jsxs)(se,{children:[(0,K.jsx)(ce,{disabled:o.isPending,children:`Cancel`}),(0,K.jsxs)(oe,{disabled:o.isPending,onClick:e=>void h(e),children:[o.isPending?(0,K.jsx)(Ae,{className:`animate-spin`,"data-icon":`inline-start`}):(0,K.jsx)(Be,{"data-icon":`inline-start`}),`Roll back`]})]})]})})]})}_t.default.extend(vt.default);var tr=[`parameters`,`conditions`,`preview`,`versions`];function nr({tab:e,onTabChange:n}){let r=Tt(),[i,a]=(0,G.useState)(null),[o,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),p=r.data,m=i?.template??p?.template,h=i!==null&&p!==void 0&&!Mt(i.template,p.template),g=h&&p!==void 0&&i.baseVersion!==p.version;(0,G.useEffect)(()=>{if(o||p===void 0)return;c(!0);let e=rn(p);e!==null&&(a(e),u(!0))},[p,o]),(0,G.useEffect)(()=>{if(i===null||!h||an(i))return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[i,h]);let _=()=>{a(null),u(!1),an(null)},v=e=>{p===void 0||m===void 0||(u(!1),a({baseVersion:i?.baseVersion??p.version,base:i?.base??p.template,template:e(m)}))},y={parameters:m===void 0?null:Object.keys(m.parameters).length,conditions:m?.conditions.length??null};return(0,K.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,K.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 border-b bg-background px-3 py-3 sm:min-h-12 sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,K.jsx)(x,{className:`-ml-1 size-11 lg:size-7`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,K.jsx)(`h1`,{className:`text-sm font-medium`,children:`Remote Config`})]}),p===void 0?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p.version===0?`Nothing published yet`:(0,K.jsxs)(K.Fragment,{children:[`Version `,p.version,p.updatedAtMs===null?null:(0,K.jsxs)(K.Fragment,{children:[` · published `,(0,K.jsx)(`time`,{dateTime:new Date(p.updatedAtMs).toISOString(),title:(0,_t.default)(p.updatedAtMs).format(`YYYY/MM/DD HH:mm:ss`),children:(0,_t.default)(p.updatedAtMs).fromNow()})]})]})}),h?(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,K.jsx)(P,{className:`hidden sm:inline-flex`,variant:`secondary`,children:`Unpublished changes`}),(0,K.jsxs)(t,{className:`min-h-11 lg:min-h-7`,onClick:_,variant:`ghost`,children:[(0,K.jsx)(Xe,{"data-icon":`inline-start`}),`Discard`]}),(0,K.jsxs)(t,{className:`min-h-11 lg:min-h-7`,onClick:()=>f(!0),children:[(0,K.jsx)(gt,{"data-icon":`inline-start`}),`Publish changes`]})]}):null]}),(0,K.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4`,children:[r.isError?(0,K.jsxs)(R,{variant:`destructive`,children:[(0,K.jsx)(j,{}),(0,K.jsx)(F,{children:`Remote Config couldn't be loaded`}),(0,K.jsx)(N,{children:`Check the connection and try again.`}),(0,K.jsx)(M,{children:(0,K.jsxs)(t,{onClick:()=>void r.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(Fe,{"data-icon":`inline-start`}),`Retry`]})})]}):null,l&&h&&i!==null?(0,K.jsxs)(R,{children:[(0,K.jsx)(mt,{}),(0,K.jsx)(F,{children:`Your unpublished changes are back`}),(0,K.jsxs)(N,{children:[`This browser kept them from your last visit, on version`,` `,i.baseVersion,`.`]}),(0,K.jsx)(M,{children:(0,K.jsx)(t,{onClick:_,size:`xs`,variant:`outline`,children:`Discard them`})})]}):null,g&&i!==null&&p!==void 0?(0,K.jsxs)(R,{children:[(0,K.jsx)(j,{}),(0,K.jsxs)(F,{children:[`Version `,p.version,` was published while you edited`]}),(0,K.jsxs)(N,{children:[`Your draft started from version `,i.baseVersion,`. Discard it to review version `,p.version,`, or publish yours after it.`]}),(0,K.jsx)(M,{children:(0,K.jsxs)(t,{onClick:_,size:`xs`,variant:`outline`,children:[`Load version `,p.version]})})]}):null,(0,K.jsxs)(nt,{onValueChange:e=>n(e),value:e,children:[(0,K.jsx)(tt,{"aria-label":`Remote Config views`,className:`max-w-full group-data-horizontal/tabs:h-auto`,children:[[`parameters`,`Parameters`,y.parameters],[`conditions`,`Conditions`,y.conditions],[`preview`,`Preview`,null],[`versions`,`Versions`,null]].map(([e,t,n])=>(0,K.jsxs)(Qe,{className:`min-h-11 flex-none px-3 lg:min-h-7`,value:e,children:[t,n===null?null:(0,K.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]},e))}),m===void 0||p===void 0?r.isError?null:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 pt-2`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:`Loading Remote Config`}),(0,K.jsx)(s,{className:`h-14 w-full`}),(0,K.jsx)(s,{className:`h-14 w-full`}),(0,K.jsx)(s,{className:`h-14 w-full`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($e,{value:`parameters`,children:(0,K.jsx)(Gn,{onAddCondition:e=>v(t=>It(t,null,e)),onRemoveParameter:e=>v(t=>Pt(t,e)),onSaveParameter:(e,t,n)=>v(r=>Nt(r,e,t,n)),template:m})}),(0,K.jsx)($e,{value:`conditions`,children:(0,K.jsx)(Pn,{onMoveCondition:(e,t)=>v(n=>Rt(n,e,t)),onRemoveCondition:e=>v(t=>Lt(t,e)),onSaveCondition:(e,t)=>v(n=>It(n,e,t)),template:m})}),(0,K.jsx)($e,{value:`preview`,children:(0,K.jsx)(Jn,{isDraft:h,template:m})}),(0,K.jsx)($e,{value:`versions`,children:(0,K.jsx)(er,{activeVersion:p.version,hasDraft:h,onRolledBack:_,onStartEditing:()=>n(`parameters`)})})]})]})]})}),p!==void 0&&i!==null?(0,K.jsx)(Zn,{base:p.template,baseVersion:i.baseVersion,draft:i.template,onLoadLatest:_,onOpenChange:f,onPublishOver:e=>a({...i,baseVersion:e,base:p.template}),onPublished:_,open:d}):null]})}var rr=E(`/remote-config`)({beforeLoad:({context:e})=>ee(e.queryClient,`remoteConfig`),notFoundComponent:k(()=>te(()=>import(`./remote-config-CXOi0LRu.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`notFoundComponent`),component:k(()=>te(()=>import(`./remote-config-BWwHOkCK.js`),__vite__mapDeps([7,2])),`component`),validateSearch:e=>tr.includes(e.tab)&&e.tab!==`parameters`?{tab:e.tab}:{}});export{nr as n,rr as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ConsoleFeatureUnavailable-jB4Loglh.js";var t=e;export{t as notFoundComponent};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-CfzsAleC.js","assets/sidebar-DNVyJPfX.js","assets/useCompositeListItem-9E4pj_CH.js","assets/console-features-api-BH5m_PtQ.js","assets/alert-dialog-Bbk_4-WJ.js","assets/select-BZZBXMkr.js","assets/field-BBDpjIqu.js","assets/switch-DZ1TPwx-.js","assets/valueToPercent-CH8GCHaL.js","assets/api-DCM0wr6O.js","assets/chevron-right-BqD5wtFb.js","assets/HashValueDisplay-BFX_kY3-.js","assets/dist-LxKJB-Vu.js","assets/list-CgrYiadM.js","assets/dialog-Bqbb7B0N.js","assets/input-group-ja_30qaF.js","assets/InsightsInfo-BNO0WznZ.js","assets/insights-api-BigAU9sZ.js","assets/table-Gm4qRWwE.js"])))=>i.map(i=>d[i]);
2
+ import{In as e,Ln as t,Nn as n,Pn as r,Ur as i,Wr as a,ar as o,cr as s,nr as c,rr as l}from"./sidebar-DNVyJPfX.js";import{a as u,i as d,l as f,o as p}from"./console-features-api-BH5m_PtQ.js";import{a as ee,c as m,s as h}from"./useCompositeListItem-9E4pj_CH.js";import{_ as g,m as _,s as v,x as y}from"./insights-api-BigAU9sZ.js";import{_ as b,h as x,m as S,v as C,y as w}from"./field-BBDpjIqu.js";import{t as T}from"./key-round-wS_SIZ6b.js";import{s as te}from"./switch-DZ1TPwx-.js";import{n as E,t as D}from"./InsightsInfo-BNO0WznZ.js";var O=o(`chart-line`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]]),k=o(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),A=i(),j={apiKeys:{navigation:{icon:(0,A.jsx)(T,{}),paths:[`/api-keys`],link:({onClick:e})=>(0,A.jsx)(f,{to:`/api-keys`,onClick:e})}}},M=l({method:`GET`}).middleware([c]).handler(a(`b4bf4c461903edcdc44eea52468c737b5b600a586f542138ff022dcbbe86c45c`));function N(e){let t=e.map(({releaseId:e,platform:t,channel:n})=>({releaseId:e,platform:t,channel:n})).sort((e,t)=>e.releaseId.localeCompare(t.releaseId));return s({queryKey:[`bundle-activity`,t],queryFn:()=>M({data:t}),enabled:t.length>0,staleTime:3e4})}var P=[{label:`Downloaded`,field:`downloads`,color:`text-primary/85`},{label:`Launched`,field:`launched`,color:`text-success/85`},{label:`Crashed`,field:`failedLaunches`,color:`text-warning/85`}],F=e=>{let t=e.launched+e.failedLaunches;return t===0?`—`:`${(e.failedLaunches/t*100).toFixed(2)}%`},I=e=>Math.max(0,e.downloads-e.launched-e.failedLaunches);function L(){return(0,A.jsx)(D,{label:`About release insight metrics`,children:`Downloaded: got this bundle. Launched: ran it. Crashed: crashed on it and rolled back. Once every installation restarts, Downloaded = Launched + Crashed.`})}function R({report:e,loading:r=!1,input:i,variant:a=`inline`}){if(!e)return r?(0,A.jsx)(n,{"aria-label":`Loading release insights`,className:a===`card`?`h-16 w-full`:`h-4 w-40`}):(0,A.jsx)(`span`,{"aria-label":`Release insights unavailable`,className:`text-sm text-muted-foreground`,children:`—`});let o=i?.builtIn===!0,s=o?0:I(e),c=(0,A.jsx)(`dl`,{className:t(a===`card`?`grid grid-cols-[1fr_1fr_auto] gap-4`:`flex min-w-[220px] flex-wrap items-baseline gap-x-3 gap-y-1`),children:P.map(({label:n,field:r,color:i})=>(0,A.jsxs)(`div`,{className:t(`flex`,a===`card`?`min-w-0 flex-col gap-1`:`items-baseline gap-1.5 whitespace-nowrap`),children:[(0,A.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n}),(0,A.jsxs)(`dd`,{className:t(`flex flex-wrap items-baseline gap-x-1.5 tabular-nums`,a===`card`?`text-xl font-semibold`:`text-sm font-medium`,e[r]>0&&!(r===`downloads`&&o)?i:`text-muted-foreground`),children:[r===`downloads`&&o?(0,A.jsx)(`span`,{title:`The built-in bundle is never downloaded`,children:`—`}):e[r].toLocaleString(),r===`failedLaunches`?(0,A.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,F(e),`)`]}):null]})]},r))});return(0,A.jsxs)(`div`,{className:t(`flex`,a===`card`?`flex-col gap-2`:`items-center gap-1`),children:[i?(0,A.jsx)(f,{className:`min-w-0 rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,to:`/insights`,search:{healthPlatform:i.platform,healthChannel:i.channel,releaseId:i.releaseId,bundleWindow:E(i.releaseId)},children:c}):c,a===`card`&&s>0?(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[s.toLocaleString(),` downloaded but not launched yet: waiting for a restart, or passed over for a newer bundle.`]}):null,a===`inline`?(0,A.jsx)(L,{}):null]})}function z({input:e}){let r=v({platform:e.platform,channel:e.channel,releaseId:e.releaseId}),i=r.data;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[i?(0,A.jsx)(`dl`,{children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-1.5`,children:[(0,A.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Download failures`}),(0,A.jsxs)(`dd`,{className:t(`flex items-baseline gap-1.5 text-sm font-medium tabular-nums`,i.failedUpdates>0?`text-warning/85`:`text-muted-foreground`),children:[i.failedUpdates.toLocaleString(),(0,A.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,g(_(i)),`)`]})]})]})}):r.isPending?(0,A.jsx)(n,{"aria-label":`Loading download failures`,className:`h-4 w-40`}):(0,A.jsx)(`span`,{"aria-label":`Download failures unavailable`,className:`text-sm text-muted-foreground`,children:`—`}),(0,A.jsx)(D,{label:`About download failures`,children:`Failed downloads or installs of this bundle, at most one per installation a day. Rate = failures ÷ (failures + downloads).`})]})}function B({input:t}){let n=N([t]);return(0,A.jsxs)(S,{children:[(0,A.jsxs)(C,{className:`flex-row items-center justify-between px-4 pt-4 pb-3`,children:[(0,A.jsx)(w,{className:`text-sm font-medium`,children:`Insights`}),(0,A.jsx)(L,{})]}),(0,A.jsxs)(x,{className:`flex flex-col gap-3 px-4 pb-4`,children:[(0,A.jsx)(R,{variant:`card`,input:t,loading:n.isFetching,report:n.data?.[t.releaseId]}),(0,A.jsx)(r,{}),(0,A.jsx)(z,{input:t})]}),(0,A.jsx)(b,{className:`px-4 pb-4`,children:(0,A.jsxs)(f,{className:e({variant:`outline`,size:`sm`}),to:`/insights`,search:{healthPlatform:t.platform,healthChannel:t.channel,releaseId:t.releaseId,bundleWindow:E(t.releaseId),healthChart:`adoption`},children:[(0,A.jsx)(O,{"aria-hidden":`true`,"data-icon":`inline-start`}),`View adoption`]})})]})}function V({input:e}){return d(`insightsAnalytics`)?null:(0,A.jsxs)(S,{children:[(0,A.jsx)(C,{className:`px-4 pt-4 pb-3`,children:(0,A.jsx)(w,{className:`text-sm font-medium`,children:`Insights`})}),(0,A.jsx)(x,{className:`px-4 pb-4`,children:(0,A.jsx)(z,{input:e})})]})}function H({releaseId:e,releases:t}){let n=N(t);return(0,A.jsx)(R,{input:t.find(t=>t.releaseId===e),loading:n.isFetching,report:n.data?.[e]})}var U={Cell:H},W={insights:{navigation:{icon:(0,A.jsx)(y,{}),paths:[`/insights`,`/insights/distribution`,`/installations`],link:({features:e,onClick:t})=>e.insightsAnalytics?(0,A.jsx)(f,{to:`/insights`,onClick:t}):(0,A.jsx)(f,{to:`/installations`,onClick:t})},releaseSection:({release:e})=>(0,A.jsx)(V,{input:e})},insightsAnalytics:{releaseColumn:U,releaseSection:({release:e})=>(0,A.jsx)(B,{input:e})}},G={remoteConfig:{navigation:{icon:(0,A.jsx)(te,{}),paths:[`/remote-config`],link:({onClick:e})=>(0,A.jsx)(f,{to:`/remote-config`,onClick:e})}}},K={...W,...j,...G},q=Object.keys(p),J=()=>{let e=u().data?.features;return e===void 0?[]:q.flatMap(t=>{let n=K[t];return n!==void 0&&e[t]?[{...n,feature:t,label:p[t].label,features:e}]:[]})},Y=()=>J().flatMap(({feature:e,label:t,releaseColumn:n})=>n===void 0?[]:[{...n,feature:e,label:t}]);function X({release:e}){return J().map(({feature:t,releaseSection:n})=>n===void 0?null:(0,A.jsx)(n,{release:e},t))}var Z=e=>typeof e==`string`&&e.trim().length>0?e.trim():void 0;function Q(e){let t=Z(e.beforeReleaseId),n=t?void 0:Z(e.afterReleaseId),r=e.enabled===!0||e.enabled===`true`?!0:e.enabled===!1||e.enabled===`false`?!1:void 0,i=Z(e.bundleId),a=i?void 0:Z(e.scopeKey),o=i||a?void 0:Z(e.channelId),s=o===void 0?void 0:e.platform===`android`?`android`:`ios`;return{afterReleaseId:n,beforeReleaseId:t,bundleId:i,channelId:o,enabled:a||o?r:void 0,platform:s,releaseId:Z(e.releaseId),scopeKey:a}}function $(e){let t=e.enabled===void 0?{}:{enabled:e.enabled};return e.bundleId?{kind:`bundle`,bundleId:e.bundleId}:e.scopeKey?{kind:`scope`,scopeKey:e.scopeKey,...t}:e.channelId&&e.platform?{kind:`channelPlatform`,channelId:e.channelId,platform:e.platform,...t}:{kind:`all`}}function ne(e){return $(e).kind!==`all`}function re(e,t){let n={...e,...t};return t.bundleId?Q({bundleId:n.bundleId}):t.scopeKey?Q({scopeKey:n.scopeKey,enabled:n.enabled}):`channelId`in t||`platform`in t?Q({channelId:n.channelId,enabled:n.enabled,platform:n.platform}):Q({bundleId:n.bundleId,channelId:n.channelId,enabled:n.enabled,platform:n.platform,scopeKey:n.scopeKey})}var ie=m(`/`)({component:h(()=>ee(()=>import(`./routes-CfzsAleC.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),`component`),validateSearch:Q});export{X as a,k as c,re as i,ne as n,J as o,$ as r,Y as s,ie as t};
@@ -0,0 +1 @@
1
+ import{$n as e,$t as t,Bn as n,F as r,Fn as i,Gt as a,H as o,I as s,In as c,Jn as l,Jt as u,Kt as d,L as f,Ln as p,M as m,Nn as h,P as g,Pn as _,R as v,U as y,Un as b,Ur as x,Ut as S,Vt as C,Wn as w,Wt as ee,Xn as T,Yn as te,Z as ne,Zn as E,_ as re,_n as ie,ar as D,b as ae,ct as oe,ei as se,er as ce,fn as le,g as ue,gn as de,h as O,ir as k,p as fe,qt as pe,ri as me,rn as A,sn as j,sr as he,st as ge,v as _e,vn as ve,w as M,y as N,yn as ye}from"./sidebar-DNVyJPfX.js";import{l as P}from"./console-features-api-BH5m_PtQ.js";import{i as be,n as F,o as xe,r as Se}from"./useCompositeListItem-9E4pj_CH.js";import{a as I,i as L,l as R,n as Ce,o as z,r as we,s as B,t as V}from"./alert-dialog-Bbk_4-WJ.js";import{a as Te,c as Ee,d as H,f as De,h as Oe,i as ke,l as Ae,m as je,n as Me,o as Ne,p as Pe,r as Fe,s as Ie,t as Le,u as Re}from"./api-DCM0wr6O.js";import{a as ze,c as U,i as Be,n as W,r as Ve,s as He,t as Ue}from"./routes-B88Erkpk.js";import{a as We,b as Ge,c as Ke,f as qe,g as Je,h as Ye,i as Xe,l as G,m as Ze,n as Qe,p as $e,r as et,t as tt,u as nt,v as rt,x as it,y as at}from"./field-BBDpjIqu.js";import{t as ot}from"./chevron-right-BqD5wtFb.js";import{A as st,D as ct,E as lt,M as ut,N as dt,P as ft,T as pt,a as mt,d as ht,f as gt,h as _t,i as vt,m as K,n as yt,o as bt,r as xt,t as St}from"./select-BZZBXMkr.js";import{r as Ct,t as wt}from"./HashValueDisplay-BFX_kY3-.js";import{t as Tt}from"./list-CgrYiadM.js";import{a as Et,c as Dt,i as Ot,l as kt,n as At,o as jt,r as Mt,s as Nt,t as Pt}from"./dialog-Bqbb7B0N.js";import{a as Ft,i as It,n as Lt,o as Rt,s as zt,t as Bt}from"./input-group-ja_30qaF.js";import{a as Vt,i as Ht,n as Ut,o as Wt,t as Gt}from"./switch-DZ1TPwx-.js";import{n as q}from"./dist-LxKJB-Vu.js";import{c as Kt,d as qt,f as Jt,h as Yt,l as Xt,m as Zt,o as Qt,p as $t,s as en,u as tn}from"./InsightsInfo-BNO0WznZ.js";import{a as nn,i as J,n as rn,o as an,r as Y,t as on}from"./table-Gm4qRWwE.js";import{i as sn,n as cn,t as ln}from"./valueToPercent-CH8GCHaL.js";var un=D(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),dn=D(`circle-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.35 2.69A10 10 0 0 1 21.3 15.65`,key:`1pfsoa`}],[`path`,{d:`M19.08 19.08A10 10 0 1 1 4.92 4.92`,key:`1ablyi`}]]),fn=D(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),pn=D(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),mn=D(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),hn=D(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),gn=D(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),_n=D(`tags`,[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]),vn=he();function yn(){return b}function bn(){return!1}function xn(){return!0}function Sn(){return(0,vn.useSyncExternalStore)(yn,bn,xn)}var X=me(se(),1),Z=x(),Cn={production:`bg-green-500/10 text-green-700 dark:text-green-400 border-green-500/20`,dev:`bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20`,staging:`bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20`};function wn({channel:e,className:t}){return(0,Z.jsx)(G,{variant:`outline`,className:p(Cn[e.toLowerCase()]||`bg-gray-500/10 text-gray-700 dark:text-gray-400 border-gray-500/20`,t),children:e})}function Tn({enabled:e,className:t,falseIcon:n=`x`,colorMode:r=`semantic`}){let i=r===`inherit`?`text-current`:void 0;return e?(0,Z.jsx)(it,{className:p(`h-4 w-4`,i??`text-green-600 dark:text-green-400`,t)}):n===`minus`?(0,Z.jsx)(hn,{className:p(`h-4 w-4`,i??`text-muted-foreground`,t)}):(0,Z.jsx)(k,{className:p(`h-4 w-4`,i??`text-red-600 dark:text-red-400`,t)})}var En=me(Vt(),1),Dn=me(Ht(),1);En.default.extend(Dn.default);function On({uuid:e,format:t=`relative`}){let n=(0,En.default)(Qt(e));return t===`relative`?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:n.fromNow()}):t===`absolute`?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:n.format(`YYYY-MM-DD HH:mm:ss`)}):(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-sm`,children:n.fromNow()}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.format(`YYYY-MM-DD HH:mm:ss`)})]})}function kn({panelId:e,bundle:t,bundles:n,loading:r,onDetailClick:a}){let o=O();return(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-3 sm:p-4`,id:e,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Advanced artifact diagnostics`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 text-sm sm:items-center`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Base artifact ID`}),(0,Z.jsx)(sn,{bundleId:t.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(G,{variant:`outline`,children:[n.length,` `,n.length===1?`patch`:`patches`]})]}),r?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(h,{className:`h-10 w-full`}),(0,Z.jsx)(h,{className:`h-10 w-full`})]}):n.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),o?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.map(e=>(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Target artifact ID`}),(0,Z.jsx)(sn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Relation`}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-1 text-sm`,children:[(0,Z.jsx)(sn,{bundleId:t.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(Oe,{className:`size-4 rotate-90 text-muted-foreground`}),(0,Z.jsx)(sn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Artifact`}),(0,Z.jsx)(G,{variant:`secondary`,children:`bsdiff`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1 text-right`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Created`}),(0,Z.jsx)(`div`,{className:`text-xs tabular-nums text-foreground`,children:(0,Z.jsx)(On,{uuid:e.id})})]})]}),(0,Z.jsx)(i,{className:`w-full`,onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})]})},e.id))}):(0,Z.jsx)(`div`,{className:`overflow-x-auto rounded-md border bg-background`,children:(0,Z.jsxs)(on,{className:`min-w-max`,children:[(0,Z.jsx)(nn,{children:(0,Z.jsxs)(an,{className:`hover:bg-transparent`,children:[(0,Z.jsx)(J,{children:`Target artifact ID`}),(0,Z.jsx)(J,{children:`Relation`}),(0,Z.jsx)(J,{children:`Artifact`}),(0,Z.jsx)(J,{children:`Created`}),(0,Z.jsx)(J,{className:`w-24 text-right`,children:`Detail`})]})}),(0,Z.jsx)(rn,{children:n.map(e=>(0,Z.jsxs)(an,{children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(sn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`flex min-w-[280px] flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[(0,Z.jsx)(sn,{bundleId:t.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(Oe,{className:`size-4 shrink-0 rotate-90 text-muted-foreground sm:rotate-0`}),(0,Z.jsx)(sn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(G,{variant:`secondary`,children:`bsdiff`})}),(0,Z.jsx)(Y,{className:`tabular-nums`,children:(0,Z.jsx)(On,{uuid:e.id})}),(0,Z.jsx)(Y,{className:`text-right`,children:(0,Z.jsx)(i,{onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})})]},e.id))})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3 text-sm text-muted-foreground`,children:`No direct patch artifacts.`})]})]})})}function An({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[a,o]=(0,X.useState)(null),s=Ut(a),{data:c=[],isPending:l}=ke(),u=Ne(),d=Ie(),f=n.trim(),p=async e=>{if(e.preventDefault(),!(!f||u.isPending))try{let e=await u.mutateAsync({name:f});r(``),e.inserted?q.success(`Channel ${e.row.name} created`):q.info(`Channel ${e.row.name} already exists`)}catch(e){q.error(`Failed to create channel`),console.error(e)}},m=async()=>{if(!(!a||d.isPending))try{let e=await d.mutateAsync({id:a.id});e.deleted?q.success(`Channel ${a.name} deleted`):e.reason===`not_empty`?q.error(`Channel ${a.name} is still in use and cannot be deleted`):q.error(`Channel ${a.name} no longer exists`),o(null)}catch(e){q.error(`Failed to delete channel`),console.error(e)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pt,{open:e,onOpenChange:t,children:(0,Z.jsxs)(At,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(Et,{children:[(0,Z.jsxs)(jt,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(gn,{className:`size-4 text-muted-foreground`}),`Channels`]}),(0,Z.jsx)(Mt,{children:`Create deployment channels and remove them when no bundle uses them. Empty channels remain available until you delete them.`})]}),(0,Z.jsx)(`form`,{onSubmit:p,children:(0,Z.jsx)(Xe,{className:`gap-2`,children:(0,Z.jsxs)(tt,{orientation:`horizontal`,children:[(0,Z.jsx)(We,{htmlFor:`channel-name`,className:`sr-only`,children:`Channel name`}),(0,Z.jsx)(ne,{id:`channel-name`,value:n,onChange:e=>r(e.target.value),placeholder:`Channel name`,autoComplete:`off`,disabled:u.isPending}),(0,Z.jsxs)(i,{type:`submit`,disabled:!f||u.isPending,children:[u.isPending?(0,Z.jsx)(kt,{"data-icon":`inline-start`,className:`animate-spin`}):(0,Z.jsx)(Dt,{"data-icon":`inline-start`}),`Create`]})]})})}),(0,Z.jsx)(`div`,{className:`max-h-72 overflow-y-auto rounded-lg border`,children:l?(0,Z.jsxs)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:[(0,Z.jsx)(kt,{className:`mr-2 size-3.5 animate-spin`}),`Loading channels`]}):c.length===0?(0,Z.jsx)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:`No channels yet`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:c.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-12 items-center gap-3 px-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`truncate text-xs font-medium`,children:e.name}),(0,Z.jsx)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:e.id})]}),(0,Z.jsx)(i,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,title:`Delete ${e.name}`,disabled:d.isPending,onClick:()=>o(e),className:`text-muted-foreground hover:text-destructive`,children:(0,Z.jsx)(Wt,{"data-icon":`inline-start`})})]},e.id))})})]})}),(0,Z.jsx)(V,{open:a!==null,onOpenChange:e=>{!e&&!d.isPending&&o(null)},children:(0,Z.jsxs)(L,{children:[(0,Z.jsxs)(B,{children:[(0,Z.jsxs)(R,{children:[`Delete `,s?.name,`?`]}),(0,Z.jsx)(I,{children:`Only empty channels can be removed. The server checks this when you delete it, and the channel can be created again later with a new ID.`})]}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(we,{disabled:d.isPending,children:`Cancel`}),(0,Z.jsx)(Ce,{variant:`destructive`,disabled:d.isPending,onClick:e=>{e.preventDefault(),m()},children:d.isPending?`Deleting...`:`Delete channel`})]})]})})]})}var jn=`[a-zA-Z0-9-]`,Mn=String.raw`0|[1-9]\d*`,Nn=String.raw`\d+`,Pn=String.raw`\d*[a-zA-Z-]${jn}*`,Fn=String.raw`(${Mn})\.(${Mn})\.(${Mn})`,In=String.raw`(${Nn})\.(${Nn})\.(${Nn})`,Ln=`(?:${Pn}|${Mn})`,Rn=`(?:${Pn}|${Nn})`,zn=String.raw`(?:-(${Ln}(?:\.${Ln})*))`,Bn=String.raw`(?:-?(${Rn}(?:\.${Rn})*))`,Vn=`${jn}+`,Hn=String.raw`(?:\+(${Vn}(?:\.${Vn})*))`,Un=`v?${Fn}${zn}?${Hn}?`,Wn=String.raw`[v=\s]*${In}${Bn}?${Hn}?`,Gn=`((?:<|>)?=?)`,Kn=String.raw`${Mn}|x|X|\*`,qn=String.raw`${Nn}|x|X|\*`,Jn=String.raw`[v=\s]*(${Kn})(?:\.(${Kn})(?:\.(${Kn})(?:${zn})?${Hn}?)?)?`,Yn=String.raw`[v=\s]*(${qn})(?:\.(${qn})(?:\.(${qn})(?:${Bn})?${Hn}?)?)?`,Xn=`(?:~>?)`,Zn=String.raw`(?:\^)`,Qn=String.raw`(^|[^\d])(\d{1,${16}})(?:\.(\d{1,${16}}))?(?:\.(\d{1,${16}}))?`;String.raw`${Qn}(?:$|[^\d])`,String.raw`${Qn}(?:${zn})?(?:${Hn})?(?:$|[^\d])`;function $n(e){let t=[[String.raw`\s`,1],[String.raw`\d`,256],[jn,250]];for(let[n,r]of t)e=e.split(`${n}*`).join(`${n}{0,${r}}`).split(`${n}+`).join(`${n}{1,${r}}`);return e}function Q(e,t){return new RegExp($n(e),t)}var er=Q(`^${Un}$`),tr=Q(`^${Wn}$`),nr=/^\d+$/;function rr(e){let t=`${e.major}.${e.minor}.${e.patch}`;return e.prerelease?.length?`${t}-${e.prerelease.join(`.`)}`:t}function ir(e,t={}){if(typeof e!=`string`)return e;if(e.length>256)throw TypeError(`Version exceeds the maximum length of 256 characters`);let n=e.trim().match(t.loose?tr:er);if(!n)throw TypeError(`Invalid version syntax: ${e}`);let r=Number(n[1]),i=Number(n[2]),a=Number(n[3]);if(r>2**53-1||r<0)throw TypeError(`Invalid major version: ${n[1]}`);if(i>2**53-1||i<0)throw TypeError(`Invalid minor version: ${n[2]}`);if(a>2**53-1||a<0)throw TypeError(`Invalid patch version: ${n[3]}`);let o=n[4]?n[4].split(`.`).map(e=>{if(nr.test(e)){let t=Number(e);if(t>=0&&t<2**53-1)return t}return e}):void 0;return{build:n[5]?.split(`.`),major:r,minor:i,patch:a,prerelease:o}}var ar=Q(String.raw`^${Gn}\s*(${Un})$|^$`),or=Q(String.raw`^${Gn}\s*(${Wn})$|^$`);function sr(e){return e.version?`${e.operator}${rr(e.version)}`:``}function cr(e,t={}){if(typeof e!=`string`)return e;let n=e.trim().replaceAll(/\s+/g,` `),r=n.match(t.loose?or:ar);if(!r)throw TypeError(`Invalid comparator: ${n}`);let i=r[1]===`=`?``:r[1]||``,a=r[2]?ir(r[2],t):null;return{operator:i,options:t,value:a?`${i}${rr(a)}`:``,version:a}}function lr(e){return e.sets.map(e=>e.map(sr).join(` `)).join(`||`)}var ur=new RegExp(Hn,`g`),dr=Q(Hn),fr=Q(String.raw`^\s*(${Jn})\s+-\s+(${Jn})\s*$`),pr=Q(String.raw`^\s*(${Yn})\s+-\s+(${Yn})\s*$`),mr=Q(String.raw`(\s*)${Gn}\s*(${Wn}|${Jn})`,`g`),hr=Q(String.raw`(\s*)${Xn}\s+`,`g`),gr=Q(String.raw`(\s*)${Zn}\s+`,`g`),_r=Q(`^${Xn}${Jn}$`),vr=Q(`^${Xn}${Yn}$`),yr=Q(`^${Zn}${Jn}$`),br=Q(`^${Zn}${Yn}$`),xr=Q(String.raw`^${Gn}\s*${Jn}$`),Sr=Q(String.raw`^${Gn}\s*${Yn}$`),Cr=Q(String.raw`(<|>)?=?\s*\*`),wr=/^\s*>=\s*0\.0\.0\s*$/,Tr=/^\s*>=\s*0\.0\.0-0\s*$/,Er=Q(String.raw`^${Gn}\s*(${Wn})$|^$`);function $(e){return!e||String(e).toLowerCase()===`x`||String(e)===`*`}function Dr(e,t,n){return $(e)&&!$(t)||$(t)&&!!n&&!$(n)}function Or(e,t){let n=t.loose?vr:_r,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:a?`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`)}function kr(e,t){return e.trim().split(/\s+/).map(e=>Or(e,t)).join(` `)}function Ar(e,t){let n=t.loose?br:yr,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.0${r} <${Number(t)+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i}-${a} <${Number(t)+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${Number(t)+1}.0.0-0`)}function jr(e,t){return e.trim().split(/\s+/).map(e=>Ar(e,t)).join(` `)}function Mr(e,t){let n=t.loose?Sr:xr;return e.trim().replace(n,(n,r,i,a,o)=>{let s=r,c=i,l=a,u=o;if(Dr(String(c),l===void 0?void 0:String(l),u===void 0?void 0:String(u)))return e;let d=$(c),f=d||$(l),p=f||$(u);if(s===`=`&&p&&(s=``),d)return s===`>`||s===`<`?`<0.0.0-0`:`*`;let m=t.includePrerelease?`-0`:``;return s&&p?(f&&(l=0),u=0,s===`>`?(s=`>=`,f?(c=Number(c)+1,l=0):l=Number(l)+1):s===`<=`&&(s=`<`,f?c=Number(c)+1:l=Number(l)+1),s===`<`&&(m=`-0`),`${s}${c}.${l}.${u}${m}`):f?`>=${c}.0.0${m} <${Number(c)+1}.0.0-0`:p?`>=${c}.${l}.0${m} <${c}.${Number(l)+1}.0-0`:n})}function Nr(e,t){return e.split(/\s+/).map(e=>Mr(e,t)).join(` `)}function Pr(e,t){let n=t.loose?pr:fr;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>{let p=n,m=c;return p=$(r)?``:$(i)?`>=${r}.0.0${t.includePrerelease?`-0`:``}`:$(a)?`>=${r}.${i}.0${t.includePrerelease?`-0`:``}`:o?`>=${p}`:`>=${p}${t.includePrerelease?`-0`:``}`,m=$(l)?``:$(u)?`<${Number(l)+1}.0.0-0`:$(d)?`<${l}.${Number(u)+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t.includePrerelease?`<${l}.${u}.${Number(d)+1}-0`:`<=${m}`,`${p} ${m}`.trim()})}function Fr(e,t){return Nr(kr(jr(e.replace(dr,``),t),t),t).trim().replace(Cr,``)}function Ir(e,t){let n=Pr(e.replace(ur,``),t).replace(mr,`$1$2$3`).replace(hr,`$1~`).replace(gr,`$1^`).split(` `).map(e=>Fr(e,t)).join(` `).split(/\s+/).map(e=>e.trim().replace(t.includePrerelease?Tr:wr,``));t.loose&&(n=n.filter(e=>Er.test(e)));let r=new Map;for(let e of n.map(e=>cr(e,t))){if(e.value===`<0.0.0-0`)return[e];r.set(e.value,e)}return r.size>1&&r.delete(``),[...r.values()]}function Lr(e,t={}){if(typeof e!=`string`)return e;let n={...t},r=e.trim().replaceAll(/\s+/g,` `),i=r.split(`||`).map(e=>Ir(e.trim(),n)).filter(e=>e.length);if(!i.length)throw TypeError(`Range contains no valid comparator sets: ${r}`);if(i.length>1){let e=i[0];if(i=i.filter(e=>e[0]?.value!==`<0.0.0-0`),!i.length)i=[e];else if(i.length>1){let e=i.find(e=>e.length===1&&e[0]?.value===``);e&&(i=[e])}}return{options:n,sets:i}}function Rr(e,t={}){try{return Lr(e,t)}catch{return null}}function zr(e,t={}){let n=Rr(e,t);return n?lr(n)||`*`:null}var Br=e=>{let t=e.trim();if(t.startsWith(`git@`)){let e=t.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(e)return`https://${e[1]}/${e[2]}`}if(t.startsWith(`ssh://`))try{let e=new URL(t);return`https://${e.hostname}${e.pathname}`.replace(/\/+$/,``).replace(/\.git$/,``)}catch{return t.replace(/\/+$/,``).replace(/\.git$/,``)}return t.replace(/\/+$/,``).replace(/\.git$/,``)},Vr=(e,t)=>{if(!e?.trim())return null;let n=Br(e);try{let{hostname:e}=new URL(n);if(e.includes(`gitlab`))return`${n}/-/commit/${t}`;if(e.includes(`bitbucket`))return`${n}/commits/${t}`}catch{}return`${n}/commit/${t}`};function Hr({label:e,value:t}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Z.jsx)(`dd`,{className:`min-w-0 text-left text-sm sm:text-right`,children:t})]})}function Ur({bundle:e,release:t}){let{data:n,isFetched:r}=Te(),i=e?Jt(e):null,a=e?qt(e):null,o=e?.gitCommitHash&&r?Vr(n?.console.gitUrl,e.gitCommitHash):null,s=t.strategy===`APP_VERSION`?t.target_app_version:t.fingerprint_hash;return s||e?.gitCommitHash||e?.manifestFileHash||a||i?(0,Z.jsxs)(Ze,{children:[(0,Z.jsx)(rt,{className:`p-4 pb-3`,children:(0,Z.jsx)(at,{className:`text-sm font-medium`,children:`Metadata`})}),(0,Z.jsx)(Ye,{className:`px-4 pb-4`,children:(0,Z.jsxs)(`dl`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Z.jsx)(Hr,{label:t.strategy===`APP_VERSION`?`Target app version`:`Fingerprint target`,value:(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs`,translate:`no`,children:s??`—`})}),e?.gitCommitHash?(0,Z.jsx)(Hr,{label:`Git commit`,value:(0,Z.jsxs)(`div`,{className:`flex items-center justify-start gap-1 sm:justify-end`,children:[(0,Z.jsx)(wt,{className:o?`text-primary`:void 0,maxLength:12,value:e.gitCommitHash}),o?(0,Z.jsx)(`a`,{"aria-label":`Open git commit`,className:`shrink-0 text-primary hover:underline`,href:o,rel:`noopener noreferrer`,target:`_blank`,children:(0,Z.jsx)(fn,{"aria-hidden":`true`})}):null]})}):null,e?.manifestFileHash?(0,Z.jsx)(Hr,{label:`Manifest hash`,value:(0,Z.jsx)(wt,{maxLength:16,value:e.manifestFileHash})}):null,a?(0,Z.jsx)(Hr,{label:`Base hash`,value:(0,Z.jsx)(wt,{maxLength:16,value:a})}):null,i?(0,Z.jsx)(Hr,{label:`Patch hash`,value:(0,Z.jsx)(wt,{maxLength:16,value:i})}):null]})})]}):null}var Wr=Array.from({length:Kt},(e,t)=>t+1);function Gr({releaseId:e,rolloutCohortCount:t,targetCohorts:n}){let r=Yt(t),a=n??[],o=a.length>0,s=r>0&&r<1e3,c=r===Kt,l=O(),u=c?Wr:s?Wr.filter(t=>Xt(e,t)<r):[],d=(r/10).toFixed(1),f=c?Kt:u.length,p=Kt-f,m=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(rt,{className:`p-4`,children:[(0,Z.jsx)(Je,{children:`Selected cohorts`}),(0,Z.jsx)(at,{className:`font-mono text-2xl tabular-nums`,children:f})]})}),(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(rt,{className:`p-4`,children:[(0,Z.jsx)(Je,{children:`Excluded cohorts`}),(0,Z.jsx)(at,{className:`font-mono text-2xl tabular-nums`,children:p})]})})]}),o?(0,Z.jsxs)(Ze,{children:[(0,Z.jsxs)(rt,{className:`p-4 pb-3`,children:[(0,Z.jsx)(at,{className:`text-sm`,children:`Additional cohorts`}),(0,Z.jsx)(Je,{children:`Always included in addition to the percentage rollout.`})]}),(0,Z.jsx)(Ye,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-lg border bg-muted/20 p-3`,children:a.map(e=>(0,Z.jsx)(G,{className:`max-w-full font-mono`,variant:`secondary`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:e})},e))})})]}):null,(0,Z.jsxs)(Ze,{children:[(0,Z.jsx)(rt,{className:`p-4 pb-3`,children:(0,Z.jsx)(at,{className:`text-sm`,children:`Numeric cohorts`})}),(0,Z.jsx)(Ye,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto overscroll-contain rounded-lg border bg-muted/20 p-3 sm:max-h-[45vh]`,children:u.length>0?(0,Z.jsx)(`div`,{"aria-label":`Included numeric cohorts`,className:`grid grid-cols-3 gap-2 sm:grid-cols-6 lg:grid-cols-8`,role:`list`,children:u.map(e=>(0,Z.jsx)(G,{className:`justify-center font-mono tabular-nums`,role:`listitem`,variant:`outline`,children:e},e))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No numeric cohorts are included.`})})})]})]});return(0,Z.jsxs)(Pt,{children:[(0,Z.jsxs)(Nt,{render:(0,Z.jsx)(i,{size:`sm`,type:`button`,variant:`outline`}),children:[(0,Z.jsx)(Tt,{"data-icon":`inline-start`}),`Preview cohorts`]}),(0,Z.jsx)(At,{className:l?`top-0 left-0 h-dvh max-w-none translate-x-0 translate-y-0 rounded-none border-0 p-0`:`sm:max-w-3xl`,children:l?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsxs)(Et,{className:`shrink-0 border-b border-border/70 px-4 py-4`,children:[(0,Z.jsx)(jt,{children:`Rolled out cohorts`}),(0,Z.jsxs)(Mt,{children:[d,`% includes `,f,` of`,` `,Kt,` numeric cohorts.`,o?` Additional cohorts are always included.`:``]})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto overscroll-contain px-4 py-4`,children:m}),(0,Z.jsx)(Ot,{className:`shrink-0 border-t border-border/70 px-4 py-3`,showCloseButton:!0})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Et,{children:[(0,Z.jsx)(jt,{children:`Rolled out cohorts`}),(0,Z.jsxs)(Mt,{children:[d,`% includes `,f,` of`,` `,Kt,` numeric cohorts.`,o?` Additional cohorts are always included.`:``]})]}),m,(0,Z.jsx)(Ot,{showCloseButton:!0})]})})]})}function Kr(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function qr(e,t){return e-t}function Jr(e,t,n){let r=e.slice();return r[t]=n,r.sort(qr)}function Yr(e,t,n,r,i,a){let o=e;return o=K(o,n,r),i&&(o=Jr(a,t,K(o,a[t-1]||-1/0,a[t+1]||1/0))),o}function Xr(e,t,n){if(!Array.isArray(e))return!0;let r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}var Zr={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...ut},Qr=X.createContext(void 0);function $r(){let e=X.useContext(Qr);if(e===void 0)throw Error(l(62));return e}function ei(e){return`key`in e?j:A}function ti(e,t){return typeof e==`number`&&typeof t==`number`?e===t:Array.isArray(e)&&Array.isArray(t)?Kr(e,t):!1}var ni=X.forwardRef(function(e,t){let{"aria-labelledby":r,className:i,defaultValue:o,disabled:s=!1,id:c,format:l,largeStep:d=10,locale:f,render:p,max:m=100,min:h=0,minStepsBetweenValues:g=0,form:_,name:v,onValueChange:y,onValueCommitted:b,orientation:x=`horizontal`,step:C=1,thumbCollisionBehavior:w=`push`,thumbAlignment:ee=`center`,value:te,style:ne,...re}=e,D=oe(c),ae=ht(D),se=E(y),ce=E(b),{clearErrors:le}=_t(),{state:ue,disabled:de,name:O,setTouched:k,setDirty:fe,validityData:me,shouldValidateOnChange:A,validation:j}=st(),{labelId:he}=lt(),[ge,_e]=X.useState(),N=r??gt(he,ge),ye=de||s,P=O??v,[F,xe]=be({controlled:te,default:o??h,name:`Slider`}),I=X.useRef(null),L=X.useRef(null),R=X.useRef([]),Ce=X.useRef(null),z=X.useRef(null),we=X.useRef(-1),B=X.useRef(null),V=X.useRef(null),Te=X.useRef(`none`),Ee=a(l),[H,De]=X.useState(-1),[Oe,ke]=X.useState(-1),[Ae,je]=X.useState(!1),[Me,Ne]=X.useState(()=>new Map),[Pe,Fe]=X.useState([void 0,void 0]),Ie=E(e=>{De(e),e!==-1&&ke(e)});ct(L,D,F),M(F,()=>{le(P),A()?j.commit(F):j.commit(F,!0);let e=me.initialValue,t;t=Array.isArray(F)&&Array.isArray(e)?!Kr(F,e):F!==e,fe(t)});let Le=E(e=>{e&&(L.current=e)}),Re=Array.isArray(F),ze=X.useMemo(()=>Re?F.slice().sort(qr):[K(F,h,m)],[m,h,Re,F]),U=E((e,t)=>{if(Number.isNaN(e)||ti(e,F))return;let n=t??pe(`none`,void 0,void 0,{activeThumbIndex:-1});Te.current=n.reason;let r=n.event,i=new(r.constructor??Event)(r.type,r);Object.defineProperty(i,`target`,{writable:!0,value:{value:e,name:P}}),n.event=i,V.current=e,se(e,n),!n.isCanceled&&xe(e)}),Be=E((e,t,n)=>{let r=Yr(e,t,h,m,Re,ze);if(Xr(r,C,g)){let e=ei(n);U(r,pe(e,n.nativeEvent,void 0,{activeThumbIndex:t})),k(!0),ce(V.current??r,u(e,n.nativeEvent))}});T(()=>{let e=ie(S(I.current));ye&&ve(I.current,e)&&e.blur()},[ye]),ye&&H!==-1&&Ie(-1);let W=X.useMemo(()=>({...ue,activeThumbIndex:H,disabled:ye,dragging:Ae,orientation:x,max:m,min:h,minStepsBetweenValues:g,step:C,values:ze}),[ue,H,ye,Ae,m,h,g,x,C,ze]),Ve=X.useMemo(()=>({active:H,controlRef:L,disabled:ye,dragging:Ae,validation:j,formatOptionsRef:Ee,handleInputChange:Be,indicatorPosition:Pe,inset:ee!==`center`,labelId:N,rootLabelId:ae,largeStep:d,lastUsedThumbIndex:Oe,lastChangedValueRef:V,lastChangeReasonRef:Te,form:_,locale:f,max:m,min:h,minStepsBetweenValues:g,name:P,onValueCommitted:ce,orientation:x,pressedInputRef:Ce,pressedThumbCenterOffsetRef:z,pressedThumbIndexRef:we,pressedValuesRef:B,registerFieldControlRef:Le,renderBeforeHydration:ee===`edge`,setActive:Ie,setDragging:je,setIndicatorPosition:Fe,setLabelId:_e,setValue:U,state:W,step:C,thumbCollisionBehavior:w,thumbMap:Me,thumbRefs:R,values:ze}),[H,L,N,ae,ye,Ae,j,Ee,Be,Pe,d,Oe,V,Te,_,f,m,h,g,P,ce,x,Ce,z,we,B,Le,Ie,je,Fe,_e,U,W,C,w,ee,Me,R,ze]),He=n(`div`,e,{state:W,ref:[t,I],props:[{"aria-labelledby":N,id:D,role:`group`},j.getValidationProps,re],stateAttributesMapping:Zr});return(0,Z.jsx)(Qr.Provider,{value:Ve,children:(0,Z.jsx)(Se,{elementsRef:R,onMapChange:Ne,children:He})})});function ri(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function ii(e){if(e===0)return 0;if(Math.abs(e)<1){let t=e.toExponential().split(`e-`),n=t[0].split(`.`)[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(`.`)[1];return t?t.length:0}function ai(e,t,n){let r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Math.max(ii(t),ii(n))))}function oi({values:e,index:t,nextValue:n,min:r,max:i,step:a,minStepsBetweenValues:o,initialValues:s}){if(e.length===0)return[];let c=e.slice(),l=a*o,u=c.length-1,d=s??e;c[t]=K(n,r+t*l,i-(u-t)*l);for(let e=t+1;e<=u;e+=1){let t=c[e-1]+l,n=i-(u-e)*l,r=d[e]??c[e],a=Math.max(c[e],t);r<a&&(a=Math.max(r,t)),c[e]=K(a,t,n)}for(let e=t-1;e>=0;--e){let t=c[e+1]-l,n=r+e*l,i=d[e]??c[e],a=Math.min(c[e],t);i>a&&(a=Math.min(i,t)),c[e]=K(a,n,t)}for(let e=0;e<=u;e+=1)c[e]=Number(c[e].toFixed(12));return c}function si({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}){let u=n??t,d=r??t;if(!(u.length>1))return{value:a,thumbIndex:0,didSwap:!1};let f=c*l;switch(e){case`swap`:{let e=u[i],t=1e-7,n=u.slice(),r=n[i-1],p=n[i+1],m=K(a,r==null?o:r+f,p==null?s:p-f),h=Number(m.toFixed(12));n[i]=h;let g=a>e,_=a<e,v=g&&p!=null&&a>=p-t,y=_&&r!=null&&a<=r+t;if(!v&&!y)return{value:n,thumbIndex:i,didSwap:!1};let b=v?i+1:i-1,x=n.map((e,t)=>t===i?h:d[t]??u[t]),S=a;S=v?Math.max(a,n[b]):Math.min(a,n[b]);let C=oi({values:n,index:b,nextValue:S,min:o,max:s,step:c,minStepsBetweenValues:l,initialValues:x}),w=v?b-1:b+1;if(w>=0&&w<C.length){let e=C[w-1],t=C[w+1],n=e==null?o:e+f;n=Math.max(n,o+w*f);let r=t==null?s:t-f;r=Math.min(r,s-(C.length-1-w)*f);let i=K(h,n,r);C[w]=Number(i.toFixed(12))}return{value:C,thumbIndex:b,didSwap:!0}}case`push`:return{value:oi({values:u,index:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}),thumbIndex:i,didSwap:!1};default:{let e=u.slice(),t=e[i-1],n=e[i+1],r=K(a,t==null?o:t+f,n==null?s:n-f);return e[i]=Number(r.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}var ci=2;function li(e,t){if(!e)return{start:0,end:0};function n(e){let t=e==null?0:parseFloat(e);return Number.isNaN(t)?0:t}let r=t?`Top`:`InlineStart`,i=t?`Bottom`:`InlineEnd`;return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${i}Width`])+n(e[`padding${i}`])}}function ui(e,t){if(t.current!=null&&e.changedTouches){let n=e;for(let e=0;e<n.changedTouches.length;e+=1){let r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}var di=X.forwardRef(function(r,i){let{render:o,className:s,style:c,...l}=r,{disabled:f,dragging:p,inset:m,lastChangedValueRef:h,lastChangeReasonRef:g,max:_,min:v,minStepsBetweenValues:y,onValueCommitted:b,orientation:x,pressedInputRef:C,pressedThumbCenterOffsetRef:w,pressedThumbIndexRef:T,pressedValuesRef:te,registerFieldControlRef:ne,renderBeforeHydration:re,setActive:D,setDragging:ae,setValue:oe,state:se,step:ue,thumbCollisionBehavior:de,thumbRefs:O,values:k}=$r(),fe=ge(),me=k.length>1,A=x===`vertical`,j=X.useRef(null),he=X.useRef(null),_e=E(t=>{t&&he.current==null&&(he.current=e(t).getComputedStyle(t))}),M=X.useRef(null),N=X.useRef(0),P=X.useRef(0),be=a(k);function F(e){T.current!==e&&(T.current=e);let t=O.current[e];if(!t){w.current=null,C.current=null;return}C.current=t.querySelector(`input[type="range"]`)}function xe(e){let t=j.current;if(!t)return null;let{width:n,height:r,bottom:i,left:a,right:o}=t.getBoundingClientRect(),s=li(he.current,A),c=P.current,l=(A?r:n)-s.start-s.end-c*2,u=w.current??0,d=e.x-u,f=e.y-u,p=K(((A?i-f-s.end:(fe===`rtl`?o-d:d-a)-s.start)-c)/l,0,1),m=(_-v)*p+v;if(m=ai(m,ue,v),m=K(m,v,_),!me)return{value:m,thumbIndex:0,didSwap:!1};let h=T.current;if(h<0)return null;let g=si({behavior:de,values:k,currentValues:be.current??k,initialValues:te.current,pressedIndex:h,nextValue:m,min:v,max:_,step:ue,minStepsBetweenValues:y});return de===`swap`&&g.didSwap?F(g.thumbIndex):T.current=g.thumbIndex,g}function Se(e){te.current=me?k.slice():null,be.current=k;let t=T.current,n=t;if(t>-1&&t<k.length){if(k[t]===_){let e=t;for(;e>0&&k[e-1]===_;)--e;n=e}}else{let t=A?`y`:`x`,r;n=-1;for(let i=0;i<O.current.length;i+=1){let a=O.current[i];if(ce(a)){let o=ri(a),s=Math.abs(e[t]-o[t]);(r===void 0||s<=r)&&(n=i,r=s)}}}if(n>-1&&n!==t&&F(n),m){let e=O.current[n];ce(e)&&(P.current=e.getBoundingClientRect()[A?`height`:`width`]/2)}}function I(e){let t=O.current?.[e]?.querySelector(`input[type="range"]`);t&&t.focus({preventScroll:!0,focusVisible:!1})}let L=E(e=>{let n=ui(e,M);if(n==null)return;if(N.current+=1,e.type===`pointermove`&&e.buttons===0){R(e);return}let r=xe(n);r!=null&&Xr(r.value,ue,y)&&(!p&&N.current>ci&&ae(!0),oe(r.value,pe(t,e,void 0,{activeThumbIndex:r.thumbIndex})),be.current=Array.isArray(r.value)?r.value:[r.value],r.didSwap&&I(r.thumbIndex))});function R(e){D(-1),ae(!1),C.current=null,w.current=null;let t=ui(e,M),n=t==null?null:xe(t);if(n!=null){let t=g.current;b(h.current??n.value,u(t,e))}`pointerType`in e&&j.current?.hasPointerCapture(e.pointerId)&&j.current?.releasePointerCapture(e.pointerId),T.current=-1,M.current=null,te.current=null,z()}let Ce=E(e=>{if(f)return;let t=e.changedTouches[0];t!=null&&(M.current=t.identifier);let n=ui(e,M);if(n!=null){Se(n);let t=xe(n);if(t==null)return;I(t.thumbIndex),oe(t.value,pe(le,e,void 0,{activeThumbIndex:t.thumbIndex})),be.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&I(t.thumbIndex)}N.current=0;let r=S(j.current);r.addEventListener(`touchmove`,L,{passive:!0}),r.addEventListener(`touchend`,R,{passive:!0})}),z=E(()=>{let e=S(j.current);e.removeEventListener(`pointermove`,L),e.removeEventListener(`pointerup`,R),e.removeEventListener(`touchmove`,L),e.removeEventListener(`touchend`,R),te.current=null}),we=ee();return X.useEffect(()=>{let e=j.current;if(!e)return()=>z();let t=d(e,`touchstart`,Ce,{passive:!0});return()=>{t(),we.cancel(),z()}},[z,Ce,j,we]),X.useEffect(()=>{f&&z()},[f,z]),n(`div`,r,{state:se,ref:[i,ne,j,_e],props:[{"data-base-ui-slider-control":re?``:void 0,onPointerDown(e){let t=j.current,n=ye(e.nativeEvent);if(!t||f||e.defaultPrevented||!ce(n)||e.button!==0)return;let r=ui(e,M);if(r!=null){Se(r);let n=xe(r);if(n==null)return;ve(O.current[n.thumbIndex],ie(S(t)))?e.preventDefault():we.request(()=>{I(n.thumbIndex)}),ae(!0),w.current??(oe(n.value,pe(le,e.nativeEvent,void 0,{activeThumbIndex:n.thumbIndex})),be.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&I(n.thumbIndex))}e.nativeEvent.pointerId&&t.setPointerCapture(e.nativeEvent.pointerId),N.current=0;let i=S(j.current);i.addEventListener(`pointermove`,L,{passive:!0}),i.addEventListener(`pointerup`,R,{once:!0})}},l],stateAttributesMapping:Zr})}),fi=X.forwardRef(function(e,t){let{render:r,className:i,style:a,...o}=e,{state:s}=$r();return n(`div`,e,{state:s,ref:t,props:[{style:{position:`relative`}},o],stateAttributesMapping:Zr})}),pi=function(e){return e.index=`data-index`,e.dragging=`data-dragging`,e.orientation=`data-orientation`,e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.focused=`data-focused`,e}({}),mi=new Set([...f,y,o]);function hi(e,t,n,r){if(!(t<0))return e.length===2?t===0?`${cn(e[t],r,n)} start range`:`${cn(e[t],r,n)} end range`:n?cn(e[t],r,n):void 0}function gi(e,t,n,r,i){let a=n===1?e+t:e-t;return K(Number(a.toFixed(Math.max(ii(e),ii(t),ii(r)))),r,i)}var _i=X.forwardRef(function(t,i){let{render:a,children:c,className:l,"aria-describedby":u,"aria-label":d,"aria-labelledby":p,disabled:h=!1,getAriaLabel:_,getAriaValueText:b,id:x,index:S,inputRef:ee,onBlur:ne,onFocus:re,onKeyDown:ie,tabIndex:D,style:ae,...se}=t,{nonce:ce}=ft(),le=oe(x),{active:ue,lastUsedThumbIndex:O,controlRef:k,disabled:fe,validation:pe,formatOptionsRef:me,handleInputChange:A,inset:j,labelId:he,largeStep:_e,locale:ve,max:M,min:N,minStepsBetweenValues:ye,form:P,name:be,orientation:xe,pressedInputRef:Se,pressedThumbCenterOffsetRef:I,pressedThumbIndexRef:L,renderBeforeHydration:R,setActive:Ce,setIndicatorPosition:z,state:we,step:B,values:V}=$r(),Te=ge(),Ee=h||fe,H=V.length>1,De=xe===`vertical`,Oe=Te===`rtl`,{setTouched:ke,setFocused:Ae,validationMode:je}=st(),Me=X.useRef(null),Ne=X.useRef(null),Pe=X.useRef(!1),Fe=oe(),Ie=pt(),Le=H?Fe:Ie,{ref:Re,index:ze}=F({metadata:X.useMemo(()=>({inputId:Le}),[Le])}),U=H?S??ze:0,Be=U===V.length-1,W=V[U],Ve=ln(W,N,M),[He,Ue]=X.useState(),We=Sn(),Ge=O>=0&&O<V.length?O:-1,Ke=E(()=>{let e=k.current,t=Me.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=De?`height`:`width`,a=r[i]-n[i],o=(n[i]/2+a*Ve/100)/r[i]*100,s=Number.isFinite(o)?o:void 0;Ue(s),U===0?z(e=>[s,e[1]]):Be&&z(e=>[e[0],s])});T(()=>{j&&queueMicrotask(Ke)},[Ke,j]),T(()=>{j&&Ke()},[Ke,j,Ve]),T(()=>{if(!j)return;let t=k.current,n=Me.current;if(!t||!n)return;let r=e(t).ResizeObserver;if(typeof r!=`function`)return;let i=new r(Ke);return i.observe(t),i.observe(n),()=>{i.disconnect()}},[k,Ke,j]);let qe=De?`bottom`:`insetInlineStart`,Je=De?`left`:`top`,Ye;H?ue===U?Ye=2:Ge===U&&(Ye=1):ue===U&&(Ye=1);let Xe;Xe=j?{"--position":`${He??0}%`,visibility:R&&We||He===void 0?`hidden`:void 0,position:`absolute`,[qe]:`var(--position)`,[Je]:`50%`,translate:`${(De||!Oe?-1:1)*50}% ${(De?1:-1)*50}%`,zIndex:Ye}:Number.isFinite(Ve)?{position:`absolute`,[qe]:`${Ve}%`,[Je]:`50%`,translate:`${(De||!Oe?-1:1)*50}% ${(De?1:-1)*50}%`,zIndex:Ye}:C;let G;xe===`vertical`&&(G=Oe?`vertical-rl`:`vertical-lr`);let Ze=typeof _==`function`?_(U):d,Qe=te({"aria-label":Ze,"aria-labelledby":p??(Ze==null?he:void 0),"aria-describedby":u,"aria-orientation":xe,"aria-valuenow":W,"aria-valuetext":typeof b==`function`?b(cn(W,ve,me.current??void 0),W,U):hi(V,U,me.current??void 0,ve),disabled:Ee,form:P,id:Le,max:M,min:N,name:be,onChange(e){A(e.currentTarget.valueAsNumber,U,e)},onFocus(e){let t=Pe.current;Pe.current=!1,Ce(U),Ae(!0),t&&e.stopPropagation()},onBlur(e){if(Pe.current){e.stopPropagation();return}Me.current&&(Ce(-1),ke(!0),Ae(!1),je===`onBlur`&&pe.commit(Yr(W,U,N,M,H,V)))},onKeyDown(e){if(!mi.has(e.key))return;f.has(e.key)&&e.stopPropagation();let t=null,n=ai(W,B,N);switch(e.key){case s:t=gi(n,e.shiftKey?_e:B,1,N,M);break;case r:t=gi(n,e.shiftKey?_e:B,Oe?-1:1,N,M);break;case m:t=gi(n,e.shiftKey?_e:B,-1,N,M);break;case g:t=gi(n,e.shiftKey?_e:B,Oe?1:-1,N,M);break;case y:t=gi(n,_e,1,N,M);break;case o:t=gi(n,_e,-1,N,M);break;case`End`:t=M,H&&(t=Number.isFinite(V[U+1])?V[U+1]-B*ye:M);break;case v:t=N,H&&(t=Number.isFinite(V[U-1])?V[U-1]+B*ye:N);break;default:break}if(t!==null){let n=e.currentTarget;de(n)||(Pe.current=!0,n.blur(),n.focus({preventScroll:!0,focusVisible:!0})),A(t,U,e),e.preventDefault()}},step:B,style:{...C,width:`100%`,height:`100%`,writingMode:G},tabIndex:D??void 0,type:`range`,value:W??``},pe.getInputValidationProps),$e=w(Ne,pe.inputRef,ee);return n(`div`,t,{state:we,ref:[i,Re,Me],props:[{[pi.index]:U,children:(0,Z.jsxs)(X.Fragment,{children:[c,(0,Z.jsx)(`input`,{ref:$e,...Qe,suppressHydrationWarning:!0}),j&&We&&R&&Be&&(0,Z.jsx)(`script`,{nonce:ce,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:le,onBlur:ne,onFocus:re,onPointerDown(e){if(L.current=U,Me.current!=null){let t=xe===`horizontal`?`x`:`y`,n=ri(Me.current);I.current=(xe===`horizontal`?e.clientX:e.clientY)-n[t]}Ne.current!=null&&Se.current!==Ne.current&&(Se.current=Ne.current)},style:Xe,suppressHydrationWarning:R||void 0},se],stateAttributesMapping:Zr})});function vi(e,t,n,r,i,a){let o=n===void 0||t&&r===void 0?`hidden`:void 0,s=e?`bottom`:`insetInlineStart`,c=e?`height`:`width`,l={visibility:i&&a?`hidden`:o,position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};return l[`--start-position`]=`${n??0}%`,t?(l[`--relative-size`]=`${(r??0)-(n??0)}%`,l[s]=`var(--start-position)`,l[c]=`var(--relative-size)`,l):(l[s]=0,l[c]=`var(--start-position)`,l)}function yi(e,t,n,r){let i=e?`bottom`:`insetInlineStart`,a=e?`height`:`width`,o={position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};if(!t)return o[i]=0,o[a]=`${n}%`,o;let s=r-n;return o[i]=`${n}%`,o[a]=`${s}%`,o}var bi=X.forwardRef(function(e,t){let{render:r,className:i,style:a,...o}=e,{indicatorPosition:s,inset:c,max:l,min:u,orientation:d,renderBeforeHydration:f,state:p,values:m}=$r(),h=Sn(),g=d===`vertical`,_=m.length>1,v=c?vi(g,_,s[0],s[1],f,h):yi(g,_,ln(m[0],u,l),ln(m[m.length-1],u,l));return n(`div`,e,{state:p,ref:t,props:[{"data-base-ui-slider-indicator":f?``:void 0,style:v,suppressHydrationWarning:f||void 0},o],stateAttributesMapping:Zr})});function xi({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=Array.isArray(n)?n:n===void 0?Array.isArray(t)?t:t===void 0?[r]:[t]:[n];return(0,Z.jsx)(ni,{className:p(`data-horizontal:w-full data-vertical:h-full`,e),"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,thumbAlignment:`edge`,...a,children:(0,Z.jsxs)(di,{className:`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,children:[(0,Z.jsx)(fi,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-primary/20 select-none data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5`,children:(0,Z.jsx)(bi,{"data-slot":`slider-range`,className:`bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,Z.jsx)(_i,{"data-slot":`slider-thumb`,className:`relative block size-4 shrink-0 rounded-full border border-primary/50 bg-background shadow transition-colors select-none after:absolute after:-inset-2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-disabled:pointer-events-none data-disabled:opacity-50`},t))]})})}var Si=[{label:`Move bundle`,value:`move`},{label:`Copy bundle`,value:`copy`}],Ci=e=>({enabled:e.enabled,message:e.message??``,rolloutCohortCount:e.rollout_cohort_count,shouldForceUpdate:e.should_force_update,targetAppVersion:e.target_app_version??``,targetCohorts:[...e.target_cohorts]}),wi=(e,t)=>({enabled:t.enabled,message:t.message.trim()||null,rolloutCohortCount:t.rolloutCohortCount,shouldForceUpdate:t.shouldForceUpdate,...e.strategy===`APP_VERSION`?{targetAppVersion:t.targetAppVersion.trim()}:{},targetCohorts:t.targetCohorts}),Ti=e=>(e/10).toFixed(1),Ei=e=>{let t=e.replace(`,`,`.`),[n=``,...r]=t.split(`.`),i=n.replace(/\D/g,``).slice(0,3),a=r.join(``).replace(/\D/g,``).slice(0,1);return t.includes(`.`)?`${i}.${a}`:i},Di=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?Math.min(1e3,Math.max(0,Math.trunc(t*10))):null};function Oi({value:e,onChange:t}){let[n,r]=(0,X.useState)(Ti(e)),[i,a]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{i||r(Ti(e))},[i,e]),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(xi,{"aria-label":`Rollout percentage`,max:1e3,min:0,onValueChange:n=>t(Array.isArray(n)?n[0]??e:n),step:1,value:e}),(0,Z.jsxs)(Bt,{className:`w-24 shrink-0`,children:[(0,Z.jsx)(It,{"aria-label":`Rollout percentage`,autoComplete:`off`,className:`text-right tabular-nums`,id:`release-rollout-percentage`,inputMode:`decimal`,name:`rolloutPercentage`,onBlur:()=>{let i=Di(n)??e;a(!1),r(Ti(i)),t(i)},onChange:e=>{let n=Ei(e.target.value);r(n);let i=Di(n);i!==null&&t(i)},onFocus:()=>a(!0),value:n}),(0,Z.jsx)(Lt,{align:`inline-end`,children:(0,Z.jsx)(Ft,{children:`%`})})]})]})}function ki({channels:e,onOpenChange:t,onShowScope:n,open:r,releaseId:a}){let o=De(a),s=o.data,c=Fe(s?.bundle_id??``),l=c.data,u=l?tn(l):null,d=H(s?.scope_key??``),f=je(),p=Ae(),m=Ee(),g=Re(),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(``),[w,ee]=(0,X.useState)(!1),[T,te]=(0,X.useState)(!1),[E,ie]=(0,X.useState)(!1),[D,oe]=(0,X.useState)(``),[se,ce]=(0,X.useState)(`move`);(0,X.useEffect)(()=>{y(s?Ci(s):null),C(``)},[s]);let le=s?Ci(s):null,de=v!==null&&le!==null&&JSON.stringify(v)!==JSON.stringify(le),O=p.isPending||f.isPending||m.isPending||g.isPending,fe=()=>{if(!O){if(de){ee(!0);return}t(!1)}},pe=()=>{if(!v)return;let e=Zt(b);if(!$t(e)){C(en);return}y({...v,targetCohorts:Array.from(new Set([...v.targetCohorts,e]))}),x(``),C(``)},me=async()=>{if(!s||!v)return;let e=v.targetCohorts.map(Zt);if(e.some(e=>!$t(e))){C(en);return}if(s.strategy===`APP_VERSION`&&!zr(v.targetAppVersion.trim())){C(`Enter a valid target app version range.`);return}let n={expectedRevision:s.revision,patch:wi(s,{...v,targetCohorts:e}),releaseId:s.id};C(``);try{await p.mutateAsync(n),await f.mutateAsync(n),q.success(`Bundle settings saved`),t(!1)}catch(e){C(e instanceof Error?e.message:`Bundle settings could not be saved.`)}},A=e.find(e=>e.id===s?.channel_id)?.name??s?.channel_id,j=e.filter(e=>e.id!==s?.channel_id),he=j.map(e=>({label:e.name,value:e.name})),ge=D.trim(),ve=se===`copy`,M=v?zr(v.targetAppVersion.trim()):null,ye=()=>{oe(``),ce(`move`)},P=e=>{!e&&g.isPending||(ie(e),e||ye())};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue,{onOpenChange:e=>e?void 0:fe(),open:r,children:(0,Z.jsxs)(re,{className:`min-w-0 overflow-hidden data-[side=right]:w-full sm:max-w-[600px]`,children:[(0,Z.jsxs)(N,{className:`shrink-0 pr-12`,children:[(0,Z.jsx)(ae,{children:`Bundle Detail`}),(0,Z.jsx)(_e,{className:`sr-only`,children:`Edit bundle delivery settings.`}),s?(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-col gap-3 text-sm`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(dt,{className:`size-4`,platform:s.platform}),(0,Z.jsx)(`span`,{className:`font-medium`,children:s.platform===`ios`?`iOS`:`Android`})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`ID`}),(0,Z.jsxs)(`span`,{className:`min-w-0 basis-full sm:basis-auto`,children:[(0,Z.jsx)(sn,{bundleId:s.id,fullOnMobile:!0,maxLength:18}),s.bundle_id?null:(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:`Built-in bundle`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Channel`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,translate:`no`,children:A})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Platform`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:s.platform===`ios`?`iOS`:`Android`})]})]}):(0,Z.jsx)(h,{className:`h-12 w-full`})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[o.isError?(0,Z.jsxs)(nt,{className:`m-4 sm:m-6`,variant:`destructive`,children:[(0,Z.jsx)(Ge,{}),(0,Z.jsx)($e,{children:`Bundle details could not be loaded`}),(0,Z.jsx)(qe,{children:o.error.message})]}):null,s&&v?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6 px-4 pb-4 sm:px-6 sm:pb-6`,children:[A?(0,Z.jsx)(ze,{release:{platform:s.platform,channel:A,releaseId:s.id,builtIn:!s.bundle_id}}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`delivery-settings-heading`,className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,id:`delivery-settings-heading`,children:`Delivery settings`}),(0,Z.jsxs)(Xe,{className:`gap-6`,children:[(0,Z.jsxs)(tt,{children:[(0,Z.jsx)(We,{htmlFor:`release-message`,children:`Message`}),(0,Z.jsx)(Rt,{autoComplete:`off`,id:`release-message`,name:`message`,onChange:e=>y({...v,message:e.target.value}),rows:3,value:v.message})]}),s.strategy===`APP_VERSION`?(0,Z.jsxs)(tt,{children:[(0,Z.jsx)(We,{htmlFor:`release-target`,children:`Target app version`}),(0,Z.jsx)(ne,{autoComplete:`off`,id:`release-target`,name:`targetAppVersion`,onChange:e=>y({...v,targetAppVersion:e.target.value}),value:v.targetAppVersion}),M?(0,Z.jsx)(Qe,{children:M}):null]}):null,(0,Z.jsxs)(tt,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsx)(We,{htmlFor:`release-enabled`,children:`Enabled`}),(0,Z.jsx)(Gt,{"aria-label":`Enabled`,checked:v.enabled,id:`release-enabled`,name:`enabled`,onCheckedChange:e=>y({...v,enabled:e})})]}),(0,Z.jsx)(Qe,{children:`Disabling rolls devices back to the previous enabled bundle on their next check, or to the built-in app when none remains.`})]}),(0,Z.jsxs)(tt,{orientation:`horizontal`,children:[(0,Z.jsx)(We,{htmlFor:`release-force-update`,children:`Force update`}),(0,Z.jsx)(Gt,{"aria-label":`Force update`,checked:v.shouldForceUpdate,id:`release-force-update`,name:`shouldForceUpdate`,onCheckedChange:e=>y({...v,shouldForceUpdate:e})})]}),(0,Z.jsxs)(tt,{children:[(0,Z.jsx)(We,{htmlFor:`release-rollout-percentage`,children:`Rollout percentage`}),(0,Z.jsx)(Oi,{onChange:e=>y({...v,rolloutCohortCount:e}),value:v.rolloutCohortCount})]}),(0,Z.jsxs)(tt,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(We,{htmlFor:`release-cohort`,children:`Additional cohorts (optional)`}),(0,Z.jsx)(Gr,{releaseId:s.id,rolloutCohortCount:v.rolloutCohortCount,targetCohorts:v.targetCohorts})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(ne,{autoComplete:`off`,id:`release-cohort`,name:`targetCohort`,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),pe())},placeholder:`e.g. qa-team…`,value:b}),(0,Z.jsx)(i,{"aria-label":`Add cohort`,disabled:!b.trim(),onClick:pe,size:`icon`,type:`button`,variant:`outline`,children:(0,Z.jsx)(Dt,{})})]}),v.targetCohorts.length?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:v.targetCohorts.map(e=>(0,Z.jsxs)(G,{className:`gap-1 font-mono`,variant:`secondary`,children:[e,(0,Z.jsx)(`button`,{"aria-label":`Remove cohort ${e}`,className:`rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>y({...v,targetCohorts:v.targetCohorts.filter(t=>t!==e)}),type:`button`,children:(0,Z.jsx)(k,{className:`size-3`})})]},e))}):null,(0,Z.jsx)(Qe,{children:`Public names—no IDs or secrets.`})]})]}),S?(0,Z.jsx)(et,{children:S}):null,(0,Z.jsx)(i,{className:`w-full`,disabled:!de||O,onClick:me,size:`lg`,children:p.isPending||f.isPending?`Saving…`:`Save changes`})]}),(0,Z.jsx)(_,{className:`my-2`}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Actions`}),(0,Z.jsx)(i,{className:`w-full`,disabled:!s.bundle_id||O,onClick:()=>ie(!0),size:`sm`,variant:`outline`,children:`Promote to channel`}),s.bundle_id?(0,Z.jsxs)(i,{className:`w-full`,disabled:O,onClick:()=>{window.open(`/api/bundles/${encodeURIComponent(s.bundle_id)}/download`,`_blank`,`noopener,noreferrer`),q.success(`Bundle download started`)},size:`sm`,variant:`outline`,children:[(0,Z.jsx)(Ct,{"data-icon":`inline-start`}),`Download manifest`]}):null,(0,Z.jsx)(i,{className:`w-full`,disabled:s.enabled||O,onClick:()=>te(!0),size:`sm`,variant:`destructive`,children:`Remove from channel`})]}),s.bundle_id&&c.isPending?(0,Z.jsx)(h,{className:`h-40 w-full`}):null,s.bundle_id&&c.isError?(0,Z.jsxs)(nt,{variant:`destructive`,children:[(0,Z.jsx)(Ge,{}),(0,Z.jsx)($e,{children:`Build details are unavailable`}),(0,Z.jsx)(qe,{children:`Delivery settings are unaffected.`})]}):null,!s.bundle_id||!c.isPending?(0,Z.jsx)(Ur,{bundle:l,release:s}):null,(0,Z.jsxs)(`details`,{className:`rounded-lg border bg-muted/10 p-4 text-xs`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:`Advanced diagnostics`}),(0,Z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:s.bundle_id??`Built-in bundle`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Revision`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:s.revision})]}),u?(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Patch base artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:u})]}):null,(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog generation`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:d.data?.generation??`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog size`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:d.data?`${d.data.byte_size} bytes`:`—`})]}),(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Scope key`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:s.scope_key}),n?(0,Z.jsx)(i,{className:`mt-1 h-auto px-0 text-xs`,onClick:()=>n(s.scope_key),size:`sm`,variant:`link`,children:`Show bundles for this target`}):null]})]}),d.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-destructive`,children:`Diagnostics are unavailable. Bundle settings are unaffected.`}):null]})]}):null]})]})}),(0,Z.jsx)(V,{onOpenChange:ee,open:w,children:(0,Z.jsxs)(L,{children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{children:`Discard unsaved changes?`}),(0,Z.jsx)(I,{children:`Your Bundle changes will be lost.`})]}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(we,{children:`Keep editing`}),(0,Z.jsx)(Ce,{onClick:()=>{ee(!1),t(!1)},variant:`destructive`,children:`Discard changes`})]})]})}),(0,Z.jsx)(V,{onOpenChange:te,open:T,children:(0,Z.jsxs)(L,{children:[(0,Z.jsxs)(B,{children:[(0,Z.jsxs)(R,{children:[`Remove this Bundle from `,A??`the channel`,`?`]}),(0,Z.jsx)(I,{children:`The uploaded artifact stays available. This only removes the Bundle from the channel.`})]}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(we,{children:`Cancel`}),(0,Z.jsx)(Ce,{onClick:async()=>{if(s)try{await m.mutateAsync({expectedRevision:s.revision,releaseId:s.id}),q.success(`Bundle removed from ${A??`the channel`}`),te(!1),t(!1)}catch(e){C(e instanceof Error?e.message:`Bundle could not be removed from the channel.`)}},variant:`destructive`,children:`Remove from channel`})]})]})}),(0,Z.jsx)(Pt,{onOpenChange:P,open:E,children:(0,Z.jsxs)(At,{showCloseButton:!g.isPending,children:[(0,Z.jsxs)(Et,{children:[(0,Z.jsx)(jt,{children:`Promote to Channel`}),(0,Z.jsx)(Mt,{children:`Choose how to promote this Bundle, then select the target channel.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Ke,{htmlFor:`promote-action`,children:`Action`}),(0,Z.jsxs)(St,{disabled:g.isPending,items:Si,onValueChange:e=>ce(e),value:se,children:[(0,Z.jsx)(mt,{className:`w-full`,id:`promote-action`,children:(0,Z.jsx)(bt,{placeholder:`Select an action`})}),(0,Z.jsx)(yt,{children:(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(vt,{value:`move`,children:`Move bundle`}),(0,Z.jsx)(vt,{value:`copy`,children:`Copy bundle`})]})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:ve?`Make this Bundle available in the target channel and keep it in the current channel.`:`Move this Bundle to the target channel. Devices in the current channel may fall back to an earlier Bundle.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Ke,{htmlFor:`target-channel`,children:`Target Channel`}),(0,Z.jsxs)(St,{disabled:g.isPending,items:he,onValueChange:e=>oe(e??``),value:D||null,children:[(0,Z.jsx)(mt,{className:`w-full`,id:`target-channel`,children:(0,Z.jsx)(bt,{placeholder:`Select a channel`})}),(0,Z.jsx)(yt,{className:`max-h-64`,children:(0,Z.jsx)(xt,{children:j.map(e=>(0,Z.jsx)(vt,{value:e.name,children:e.name},e.id))})})]})]})]}),(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(i,{disabled:g.isPending,onClick:()=>P(!1),variant:`outline`,children:`Cancel`}),(0,Z.jsx)(i,{disabled:!ge||g.isPending,onClick:async()=>{if(s)try{await g.mutateAsync({action:se,expectedRevision:s.revision,releaseId:s.id,targetChannel:ge}),P(!1),q.success(ve?`Bundle copied to ${ge}`:`Bundle moved to ${ge}`)}catch(e){q.error(e instanceof Error?e.message:`Bundle could not be promoted.`)}},children:g.isPending?ve?`Copying…`:`Moving…`:ve?`Copy`:`Move`})]})]})})]})}function Ai({release:e}){return(0,Z.jsxs)(G,{className:`gap-1 font-normal text-muted-foreground`,variant:e.enabled?`outline`:`secondary`,children:[e.enabled?(0,Z.jsx)(it,{className:`size-3`}):(0,Z.jsx)(dn,{className:`size-3`}),e.enabled?`Enabled`:`Disabled`]})}function ji({percentage:e,className:t}){let n=e<100,r=e.toFixed(1);return(0,Z.jsxs)(G,{className:p(`gap-1`,t),variant:n?`secondary`:`default`,children:[n?(0,Z.jsx)(Ge,{className:`h-3 w-3`}):null,r,`%`]})}var Mi=20,Ni=[{label:`iOS`,value:`ios`},{label:`Android`,value:`android`}],Pi=[{label:`Any Status`,value:`all`},{label:`Enabled`,value:`enabled`},{label:`Disabled`,value:`disabled`}],Fi=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),Ii=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),Li=e=>t=>{t.target instanceof Element&&t.target.closest(`button, a, input, select, textarea`)||e()};function Ri({channels:e,onChange:t,onClear:n,onManageChannels:r,search:a}){let o=W(a),s=a.channelId!==void 0,c=[{label:`All Channels`,value:`all`},...e.map(e=>({label:e.name,value:e.id}))];return(0,Z.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-2 border-b bg-background px-3 py-3 sm:h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:py-0 sm:backdrop-blur-sm`,children:[(0,Z.jsx)(fe,{className:`-ml-1`}),(0,Z.jsx)(`h1`,{className:`sr-only`,children:`Bundles`}),(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-1.5 text-muted-foreground sm:ml-2`,children:[(0,Z.jsx)(mn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`text-xs font-medium`,children:`Filters`})]}),(0,Z.jsxs)(St,{items:c,onValueChange:e=>t({channelId:e===null||e===`all`?void 0:e}),value:a.channelId??`all`,children:[(0,Z.jsx)(mt,{"aria-label":`Channel`,className:`h-8 w-[calc(50%-0.25rem)] min-w-[132px] text-xs sm:w-[140px]`,children:(0,Z.jsx)(bt,{})}),(0,Z.jsx)(yt,{children:(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(vt,{value:`all`,children:`All Channels`}),e.map(e=>(0,Z.jsx)(vt,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsxs)(St,{disabled:!s,items:Ni,onValueChange:e=>t({platform:e===`android`?`android`:`ios`}),value:a.platform??`ios`,children:[(0,Z.jsx)(mt,{"aria-label":`Platform`,className:`h-8 w-[calc(50%-0.25rem)] min-w-[132px] text-xs sm:w-[140px]`,title:s?void 0:`Choose a channel first`,children:(0,Z.jsx)(bt,{})}),(0,Z.jsx)(yt,{children:(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(vt,{value:`ios`,children:`iOS`}),(0,Z.jsx)(vt,{value:`android`,children:`Android`})]})})]}),(0,Z.jsxs)(St,{disabled:!s&&a.scopeKey===void 0,items:Pi,onValueChange:e=>t({enabled:e===`enabled`?!0:e===`disabled`?!1:void 0}),value:a.enabled===void 0?`all`:a.enabled?`enabled`:`disabled`,children:[(0,Z.jsx)(mt,{"aria-label":`Status`,className:`h-8 w-[calc(50%-0.25rem)] min-w-[132px] text-xs sm:w-[140px]`,children:(0,Z.jsx)(bt,{})}),(0,Z.jsx)(yt,{children:(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(vt,{value:`all`,children:`Any Status`}),(0,Z.jsx)(vt,{value:`enabled`,children:`Enabled`}),(0,Z.jsx)(vt,{value:`disabled`,children:`Disabled`})]})})]}),(0,Z.jsx)(i,{"aria-label":`Manage channels`,onClick:r,size:`icon-sm`,title:`Manage channels`,variant:`outline`,children:(0,Z.jsx)(_n,{})}),a.bundleId?(0,Z.jsxs)(G,{className:`max-w-48 gap-1`,variant:`secondary`,children:[`Artifact filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear artifact filter`,className:`rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>t({bundleId:void 0}),type:`button`,children:(0,Z.jsx)(k,{className:`size-3`})})]}):null,a.scopeKey?(0,Z.jsxs)(G,{className:`max-w-48 gap-1`,variant:`secondary`,children:[`Target filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear target filter`,className:`rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>t({scopeKey:void 0}),type:`button`,children:(0,Z.jsx)(k,{className:`size-3`})})]}):null,o?(0,Z.jsxs)(i,{className:`h-8 px-2 text-xs text-muted-foreground hover:text-foreground sm:ml-auto`,onClick:n,size:`sm`,variant:`ghost`,children:[(0,Z.jsx)(k,{"data-icon":`inline-start`}),`Clear`]}):null]})}function zi({expanded:e,onOpen:t,onToggleExpand:n,release:r}){let a=r.operation===`PROMOTE`?`Promoted`:r.operation===`ROLLBACK`?`Rollback`:null;return(0,Z.jsxs)(`div`,{className:`flex min-w-[240px] items-center gap-3`,children:[r.bundle_id?(0,Z.jsx)(i,{"aria-controls":`bundle-lineage-panel-${r.id}`,"aria-expanded":e,"aria-label":e?`Hide advanced artifact diagnostics`:`Show advanced artifact diagnostics`,title:`Advanced artifact diagnostics`,className:`size-8 shrink-0 touch-manipulation`,onClick:n,size:`icon`,type:`button`,variant:`ghost`,children:e?(0,Z.jsx)(xe,{}):(0,Z.jsx)(ot,{})}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-8 shrink-0`}),(0,Z.jsxs)(`button`,{"aria-label":`Open details for ID ${r.id}`,className:`min-w-0 rounded-sm text-left text-foreground transition-colors underline-offset-4 hover:text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:t,title:r.id,type:`button`,children:[(0,Z.jsx)(sn,{bundleId:r.id,fullOnMobile:!0}),r.bundle_id?null:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,Z.jsx)(zt,{className:`size-3.5`}),` Built-in bundle`]})]}),a?(0,Z.jsx)(G,{className:`shrink-0 font-normal`,variant:`secondary`,children:a}):null,r.currentlyUnreachable?(0,Z.jsxs)(`span`,{"aria-label":`Unreachable: no device gets this bundle with the current delivery settings.`,className:`inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,title:`No device gets this bundle with the current delivery settings.`,children:[(0,Z.jsx)(dn,{className:`size-3.5`}),`Unreachable`]}):null]})}function Bi({onDetailClick:e,panelId:t,release:n}){let r=n.bundle_id??``,i=Fe(r),a=Me(r);return i.isError||a.isError?(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:t,children:`Patch lineage could not be loaded.`}):i.isPending?(0,Z.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-2 border-t bg-muted/10 p-4`,id:t,children:[(0,Z.jsx)(h,{className:`h-10 w-full`}),(0,Z.jsx)(h,{className:`h-10 w-full`})]}):i.data?(0,Z.jsx)(kn,{bundle:i.data,bundles:a.data??[],loading:a.isPending,onDetailClick:e,panelId:t}):(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:t,children:`Bundle details are unavailable.`})}function Vi(){let e=Ue.useSearch(),t=Ue.useNavigate(),n=O(),[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(),l=Pe({afterReleaseId:e.afterReleaseId,beforeReleaseId:e.beforeReleaseId,filter:Ve(e),limit:Mi}),u=ke().data??[],d=l.data?.data??[],f=Le(Array.from(new Set(d.flatMap(e=>e.bundle_id?[e.bundle_id]:[])))).data??{},m=l.data?.next,g=l.data?.previous,_=d.flatMap(e=>{let t=u.find(t=>t.id===e.channel_id)?.name;return t?[{releaseId:e.id,platform:e.platform,channel:t,builtIn:!e.bundle_id}]:[]}),v=He(),y=10+v.length,b=new Map(u.map(e=>[e.id,e.name]));(0,X.useEffect)(()=>{o&&!d.some(e=>e.id===o)&&s(void 0)},[o,d]);let x=(e,n=!0)=>void t({resetScroll:n,search:e,to:`/`}),S=t=>x(Be(e,t)),C=t=>{let n=d.find(e=>e.bundle_id===t.id);if(s(void 0),n){x({...e,releaseId:n.id},!1);return}S({bundleId:t.id})},w=e.afterReleaseId!==void 0||e.beforeReleaseId!==void 0,ee=g?{...e,afterReleaseId:g,beforeReleaseId:void 0,releaseId:void 0}:null,T=m?{...e,afterReleaseId:void 0,beforeReleaseId:m,releaseId:void 0}:null,te={...e,afterReleaseId:void 0,beforeReleaseId:void 0,releaseId:void 0};return(0,Z.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,Z.jsx)(Ri,{channels:u,onChange:S,onClear:()=>x({}),onManageChannels:()=>a(!0),search:e}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-6 bg-muted/5 p-3 sm:p-6`,children:[l.isError?(0,Z.jsxs)(nt,{variant:`destructive`,children:[(0,Z.jsx)(Ge,{}),(0,Z.jsx)($e,{children:`Bundles could not be loaded`}),(0,Z.jsx)(qe,{children:l.error.message})]}):(0,Z.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-lg border bg-card text-card-foreground shadow-sm [&_[data-slot=table-container]]:h-full [&_[data-slot=table-container]]:overflow-auto`,children:n?(0,Z.jsx)(`div`,{className:`h-full overflow-y-auto`,children:l.isPending?(0,Z.jsx)(`div`,{className:`flex flex-col gap-3 p-4`,children:Array.from({length:5},(e,t)=>(0,Z.jsx)(h,{className:`h-44 w-full`},t))}):d.length?d.map(t=>{let n=b.get(t.channel_id)??t.channel_id,r=t.bundle_id?f[t.bundle_id]:0,i=o===t.id,a=`bundle-lineage-panel-${t.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(`article`,{"aria-label":`Bundle ${t.id}`,className:p(`flex cursor-pointer touch-manipulation flex-col gap-4 border-b p-4 transition-[background-color,filter] last:border-b-0 hover:bg-muted/10 active:bg-muted/20 motion-reduce:transition-none data-[state=selected]:bg-muted/15`,t.currentlyUnreachable&&`bg-muted/35 saturate-50 hover:bg-muted/50 hover:saturate-100 focus-within:saturate-100`,i&&`border-b-0 bg-primary/5`),"data-state":e.releaseId===t.id?`selected`:void 0,onClick:Li(()=>x({...e,releaseId:t.id},!1)),children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsx)(zi,{expanded:i,onOpen:()=>x({...e,releaseId:t.id},!1),onToggleExpand:()=>s(i?void 0:t.id),release:t}),(0,Z.jsx)(wn,{channel:n,className:`shrink-0`})]}),(0,Z.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,Z.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Platform`}),(0,Z.jsxs)(`dd`,{className:`mt-1 flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(dt,{className:`size-4`,platform:t.platform}),t.platform===`ios`?`iOS`:`Android`]})]}),(0,Z.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created`}),(0,Z.jsx)(`dd`,{className:`mt-1 tabular-nums`,children:Fi.format(t.created_at_ms)})]}),(0,Z.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Rollout`}),(0,Z.jsx)(`dd`,{className:`mt-1`,children:(0,Z.jsx)(ji,{percentage:t.rollout_cohort_count/10})})]}),(0,Z.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Patches`}),(0,Z.jsx)(`dd`,{className:`mt-1`,children:r===void 0?`Checking`:r>0?`${r} ${r===1?`patch`:`patches`}`:`—`})]}),v.map(({Cell:e,feature:n,label:r})=>(0,Z.jsxs)(`div`,{className:`col-span-2 rounded-md bg-muted/40 p-3`,children:[(0,Z.jsx)(`dt`,{className:`mb-2 text-muted-foreground`,children:r}),(0,Z.jsx)(`dd`,{children:(0,Z.jsx)(e,{releaseId:t.id,releases:_})})]},n)),(0,Z.jsxs)(`div`,{className:`col-span-2 flex flex-wrap items-center gap-2 rounded-md bg-muted/40 p-3`,children:[(0,Z.jsx)(Ai,{release:t}),t.should_force_update?(0,Z.jsx)(G,{variant:`secondary`,children:`Force update`}):null]}),(0,Z.jsxs)(`div`,{className:`col-span-2 grid grid-cols-1 gap-2 rounded-md border bg-background/80 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Target`}),(0,Z.jsx)(`dd`,{className:`min-w-0 truncate text-right font-mono`,children:t.target_app_version??t.fingerprint_hash??`—`})]}),(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Message`}),(0,Z.jsx)(`dd`,{className:`min-w-0 text-right text-foreground`,children:t.message||`—`})]})]})]})]}),i&&t.bundle_id?(0,Z.jsx)(Bi,{onDetailClick:C,panelId:a,release:t}):null]},t.id)}):(0,Z.jsx)(`p`,{className:`p-8 text-center text-sm text-muted-foreground`,children:w?`No more bundles on this side.`:W(e)?`No bundles match these filters.`:`No bundles yet. Deploy an update to see it here.`})}):(0,Z.jsxs)(on,{className:`min-w-max`,children:[(0,Z.jsx)(nn,{className:`bg-muted/40`,children:(0,Z.jsxs)(an,{className:`border-b border-border/60 hover:bg-transparent [&>th]:h-10 [&>th]:text-xs [&>th]:font-semibold [&>th]:uppercase [&>th]:text-muted-foreground/70`,children:[(0,Z.jsx)(J,{children:`ID`}),(0,Z.jsx)(J,{children:`Channel`}),(0,Z.jsx)(J,{children:`Platform`}),(0,Z.jsx)(J,{children:`Patches`}),(0,Z.jsx)(J,{children:`Target`}),(0,Z.jsx)(J,{children:`Enabled`}),(0,Z.jsx)(J,{children:`Force update`}),(0,Z.jsx)(J,{children:`Rollout`}),v.map(({feature:e,label:t})=>(0,Z.jsx)(J,{children:t},e)),(0,Z.jsx)(J,{children:`Message`}),(0,Z.jsx)(J,{children:`Created`})]})}),(0,Z.jsxs)(rn,{children:[l.isPending?Array.from({length:7},(e,t)=>(0,Z.jsx)(an,{children:(0,Z.jsx)(Y,{colSpan:y,children:(0,Z.jsx)(h,{className:`h-8 w-full`})})},t)):d.map(t=>{let n=o===t.id,r=`bundle-lineage-panel-${t.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(an,{"aria-label":`Open bundle ${t.id}`,className:p(`cursor-pointer transition-[background-color,filter] hover:bg-muted/10 focus-within:bg-muted/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring motion-reduce:transition-none data-[state=selected]:bg-muted/15 [&>td]:py-3`,t.currentlyUnreachable&&`bg-muted/35 saturate-50 hover:bg-muted/50 hover:saturate-100 focus-within:saturate-100`,n&&`bg-primary/5`),"data-state":e.releaseId===t.id?`selected`:void 0,onClick:Li(()=>x({...e,releaseId:t.id},!1)),onKeyDown:n=>{n.target!==n.currentTarget||n.key!==`Enter`&&n.key!==` `||(n.preventDefault(),x({...e,releaseId:t.id},!1))},tabIndex:0,children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(zi,{expanded:n,onOpen:()=>x({...e,releaseId:t.id},!1),onToggleExpand:()=>s(n?void 0:t.id),release:t})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(wn,{channel:b.get(t.channel_id)??t.channel_id})}),(0,Z.jsx)(Y,{className:`whitespace-nowrap`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(dt,{className:`size-4`,platform:t.platform}),t.platform===`ios`?`iOS`:`Android`]})}),(0,Z.jsx)(Y,{children:t.bundle_id&&f[t.bundle_id]===void 0?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Checking`}):t.bundle_id&&f[t.bundle_id]>0?(0,Z.jsxs)(G,{variant:`secondary`,children:[f[t.bundle_id],` `,f[t.bundle_id]===1?`patch`:`patches`]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,Z.jsx)(Y,{children:t.target_app_version?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(U,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`font-medium`,children:t.target_app_version})]}):t.fingerprint_hash?(0,Z.jsxs)(`span`,{className:`flex min-w-[160px] items-center gap-2`,children:[(0,Z.jsx)(pn,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(wt,{maxLength:12,value:t.fingerprint_hash})]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(Tn,{enabled:t.enabled}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t.enabled?`Enabled`:`Disabled`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(Tn,{enabled:t.should_force_update,falseIcon:`minus`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t.should_force_update?`Required`:`Optional`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(ji,{percentage:t.rollout_cohort_count/10})}),v.map(({Cell:e,feature:n})=>(0,Z.jsx)(Y,{children:(0,Z.jsx)(e,{releaseId:t.id,releases:_})},n)),(0,Z.jsx)(Y,{className:`text-sm text-muted-foreground`,title:t.message??void 0,children:t.message||`-`}),(0,Z.jsx)(Y,{className:`whitespace-nowrap text-xs text-muted-foreground`,title:Fi.format(t.created_at_ms),children:Ii.format(t.created_at_ms)})]}),n&&t.bundle_id?(0,Z.jsx)(an,{className:`hover:bg-transparent`,children:(0,Z.jsx)(Y,{className:`border-t-0 p-0`,colSpan:y,children:(0,Z.jsx)(Bi,{onDetailClick:C,panelId:r,release:t})})}):null]},t.id)}),!l.isPending&&d.length===0?(0,Z.jsx)(an,{children:(0,Z.jsx)(Y,{className:`h-40 text-center text-muted-foreground`,colSpan:y,children:w?`No more bundles on this side.`:W(e)?`No bundles match these filters.`:`No bundles yet. Deploy an update to see it here.`})}):null]})]})}),!l.isError&&!l.isPending?(0,Z.jsxs)(`nav`,{"aria-label":`Bundle pagination`,className:`flex flex-col gap-3 px-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:d.length}),` `,d.length===1?`entry`:`entries`,`, newest first`]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 sm:justify-end`,children:[w?(0,Z.jsx)(P,{className:c({className:`h-8 flex-1 px-3 text-xs sm:flex-none`,size:`sm`,variant:`ghost`}),search:te,to:`/`,children:`Newest`}):null,ee?(0,Z.jsxs)(P,{className:c({className:`h-8 flex-1 px-3 text-xs sm:flex-none`,size:`sm`,variant:`outline`}),search:ee,to:`/`,children:[(0,Z.jsx)(un,{"data-icon":`inline-start`}),`Previous`]}):(0,Z.jsxs)(i,{className:`h-8 flex-1 px-3 text-xs sm:flex-none`,disabled:!0,size:`sm`,variant:`outline`,children:[(0,Z.jsx)(un,{"data-icon":`inline-start`}),`Previous`]}),T?(0,Z.jsxs)(P,{className:c({className:`h-8 flex-1 px-3 text-xs sm:flex-none`,size:`sm`,variant:`outline`}),search:T,to:`/`,children:[`Next`,(0,Z.jsx)(ot,{"data-icon":`inline-end`})]}):(0,Z.jsxs)(i,{className:`h-8 flex-1 px-3 text-xs sm:flex-none`,disabled:!0,size:`sm`,variant:`outline`,children:[`Next`,(0,Z.jsx)(ot,{"data-icon":`inline-end`})]})]})]}):null]}),(0,Z.jsx)(ki,{channels:u,onOpenChange:t=>!t&&x({...e,releaseId:void 0},!1),onShowScope:e=>S({scopeKey:e}),open:!!e.releaseId,releaseId:e.releaseId??``}),(0,Z.jsx)(An,{onOpenChange:a,open:r})]})}export{Vi as component};
@@ -0,0 +1 @@
1
+ import{ar as e}from"./sidebar-DNVyJPfX.js";var t=e(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]);export{t};