@hot-updater/console 1.2.0-rc.28 → 1.2.0-rc.29

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 (196) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{-native-builds-search-7blX2yQW.js → -native-builds-search-DdHwfe4q.js} +1 -1
  3. package/.output/public/assets/ChannelBadge-CEabmopB.js +1 -0
  4. package/.output/public/assets/{CompositeItem-Dy4xgOMg.js → CompositeItem-KUM5yQVr.js} +1 -1
  5. package/.output/public/assets/{ConsoleFeatureUnavailable-cy_snb33.js → ConsoleFeatureUnavailable-Be-0iTww.js} +1 -1
  6. package/.output/public/assets/EventDetails-bDOYte1z.js +1 -0
  7. package/.output/public/assets/HashValueDisplay-D2f0HmyU.js +1 -0
  8. package/.output/public/assets/{InsightsPageHeader-D5TJspVe.js → InsightsPageHeader-Cj2ROSQO.js} +1 -1
  9. package/.output/public/assets/IosInstall-CHI2C4Yd.js +1 -0
  10. package/.output/public/assets/{NativeBuildsNav-CjOOlbEu.js → NativeBuildsNav-DaqxQPnG.js} +1 -1
  11. package/.output/public/assets/{RelativeTime-CY1dKZpv.js → RelativeTime-B4PK8qDw.js} +1 -1
  12. package/.output/public/assets/{RolloutPercentageBadge-BHgHkBGB.js → RolloutPercentageBadge-D_I0Raj2.js} +1 -1
  13. package/.output/public/assets/{RowReason-BMx_vclu.js → RowReason-B7VM1ztc.js} +1 -1
  14. package/.output/public/assets/{SandboxBadge-irEkMf1P.js → SandboxBadge-BVxHg_HF.js} +1 -1
  15. package/.output/public/assets/TargetDisplay-KU7JhIWG.js +1 -0
  16. package/.output/public/assets/api-keys-DLC8jjaM.js +1 -0
  17. package/.output/public/assets/api-keys-eDnzgFAf.js +1 -0
  18. package/.output/public/assets/download-B2GjTySo.js +1 -0
  19. package/.output/public/assets/{index-CAnjb7M2.js → index-BdyQq4-k.js} +3 -3
  20. package/.output/public/assets/insights-C94CdeAA.js +1 -0
  21. package/.output/public/assets/insights-DILMVpk8.js +2 -0
  22. package/.output/public/assets/{insights-DTF7C4jb.js → insights-_j_ieOyh.js} +1 -1
  23. package/.output/public/assets/{insights-search-TfRz5kGG.js → insights-search-Bgvg6wSP.js} +1 -1
  24. package/.output/public/assets/{insights-usage-rpc-B4V-Qqo4.js → insights-usage-rpc-BUCinjSN.js} +1 -1
  25. package/.output/public/assets/insights_.distribution-Bb6_S-hD.js +2 -0
  26. package/.output/public/assets/{insights_.distribution-BqfzAuAf.js → insights_.distribution-CRkGNelG.js} +1 -1
  27. package/.output/public/assets/insights_.distribution-CyAu3RN3.js +1 -0
  28. package/.output/public/assets/installations-BA01mqJE.js +1 -0
  29. package/.output/public/assets/{installations-D3MbzcFb.js → installations-BsD6LgNc.js} +2 -2
  30. package/.output/public/assets/{installations-BU65zztK.js → installations-CYTzndfP.js} +1 -1
  31. package/.output/public/assets/native-builds-BMbws1g5.js +2 -0
  32. package/.output/public/assets/native-builds-xgHiHQML.js +1 -0
  33. package/.output/public/assets/native-builds_._buildId-B04z9yfk.js +1 -0
  34. package/.output/public/assets/native-builds_._buildId-DaMmTcHo.js +2 -0
  35. package/.output/public/assets/native-builds_.devices-B-u7uLLG.js +2 -0
  36. package/.output/public/assets/native-builds_.devices-CVNAQtSy.js +1 -0
  37. package/.output/public/assets/{remote-config-D1OkfQKt.js → remote-config-Cxkr7_BP.js} +1 -1
  38. package/.output/public/assets/remote-config-DAOyn5xL.js +1 -0
  39. package/.output/public/assets/{remote-config-CGbqsPh_.js → remote-config-DXv25LX1.js} +3 -3
  40. package/.output/public/assets/{routes-BTG3rg0l.js → routes-DM3TyTLW.js} +2 -2
  41. package/.output/public/assets/routes-Des97uK_.js +1 -0
  42. package/.output/public/assets/styles-BHLI87EH.css +2 -0
  43. package/.output/server/{__23tanstack-start-server-fn-resolver-BFiPs5uv.mjs → __23tanstack-start-server-fn-resolver-DTuNq7_z.mjs} +58 -58
  44. package/.output/server/_libs/_.mjs +1 -1
  45. package/.output/server/_ssr/{BundleIdDisplay-BSBR5eJ3.mjs → BundleIdDisplay-BX6DLh1K.mjs} +2 -2
  46. package/.output/server/_ssr/ChannelBadge-D7O95Ack.mjs +23 -0
  47. package/.output/server/_ssr/{ConsoleFeatureUnavailable-DcZ4JBVq.mjs → ConsoleFeatureUnavailable-Dfs3WUZf.mjs} +5 -5
  48. package/.output/server/_ssr/{EventDetails-CUHZuwei.mjs → EventDetails-C1Q9caVa.mjs} +6 -6
  49. package/.output/server/_ssr/{HashValueDisplay-B9ORaCcP.mjs → HashValueDisplay-SIEeZe0O.mjs} +2 -2
  50. package/.output/server/_ssr/{InsightsPageHeader-C0bJqC-n.mjs → InsightsPageHeader-CAcbXSFD.mjs} +5 -5
  51. package/.output/server/_ssr/{IosInstall-C5Y5gnDY.mjs → IosInstall-B7yxnQ7o.mjs} +61 -20
  52. package/.output/server/_ssr/{NativeBuildsNav-hFiyBaFW.mjs → NativeBuildsNav-BwoEX7xx.mjs} +3 -3
  53. package/.output/server/_ssr/{NotFoundPage-D4xRjmIA.mjs → NotFoundPage-Cd_nKv04.mjs} +2 -2
  54. package/.output/server/_ssr/{RelativeTime-DnvxB666.mjs → RelativeTime-B5txzq94.mjs} +23 -6
  55. package/.output/server/_ssr/{RolloutPercentageBadge-NBnIOzY9.mjs → RolloutPercentageBadge-BEV8btLv.mjs} +3 -3
  56. package/.output/server/_ssr/{RowReason-B_jZN48d.mjs → RowReason-CEDEk7-N.mjs} +24 -7
  57. package/.output/server/_ssr/{SandboxBadge-CFtTG1ZJ.mjs → SandboxBadge-wlOMZIUd.mjs} +2 -2
  58. package/.output/server/_ssr/{TargetDisplay-0sb03v_6.mjs → TargetDisplay-076I9qHx.mjs} +29 -20
  59. package/.output/server/_ssr/{alert-dialog-SLr1Q_AI.mjs → alert-dialog-DrD4hAp4.mjs} +1 -1
  60. package/.output/server/_ssr/{api-CkgOQzSb.mjs → api-C1plnjZg.mjs} +3 -3
  61. package/.output/server/_ssr/{api-keys-BP7NJtoX.mjs → api-keys-Bzn-P-lX.mjs} +2 -2
  62. package/.output/server/_ssr/{api-keys-BcSzq0TA.mjs → api-keys-L8_p18pO.mjs} +10 -10
  63. package/.output/server/_ssr/{api-keys-rpc-IWPOq5vn.mjs → api-keys-rpc-Mne2yo8z.mjs} +3 -3
  64. package/.output/server/_ssr/{api-rpc-cNJTB3v4.mjs → api-rpc-ChVBmeca.mjs} +13 -6
  65. package/.output/server/_ssr/{auth-rpc-oaBbtxSP.mjs → auth-rpc-Dml8l_eq.mjs} +4 -4
  66. package/.output/server/_ssr/{auth.server-WQw9JjMm.mjs → auth.server-DOShgraQ.mjs} +2 -2
  67. package/.output/server/_ssr/{badge-n3c0OTBQ.mjs → badge-BasQflNy.mjs} +1 -1
  68. package/.output/server/_ssr/{card-CYgCcRUd.mjs → card-BrGGQYC0.mjs} +1 -1
  69. package/.output/server/_ssr/{config.server-R3KQbcML.mjs → config.server-CVOdMDBk.mjs} +3 -3
  70. package/.output/server/_ssr/{console-access-BLVi82IN.mjs → console-access-Bi-abtY-.mjs} +2 -2
  71. package/.output/server/_ssr/{console-features-api-B2JvJOlE.mjs → console-features-api-Bjxo5ur3.mjs} +3 -3
  72. package/.output/server/_ssr/{console-features-rpc-LAxQoSNw.mjs → console-features-rpc-xzdodg3g.mjs} +3 -3
  73. package/.output/server/_ssr/{dialog-eru_h5oK.mjs → dialog-7iMkt9l0.mjs} +1 -1
  74. package/.output/server/_ssr/{empty-Bu4qodCx.mjs → empty-Chb-YL3R.mjs} +2 -2
  75. package/.output/server/_ssr/{field-DA5lwO5U.mjs → field-mL_Aa6ff.mjs} +2 -2
  76. package/.output/server/_ssr/{input-group-VV5E3q78.mjs → input-group-C00_xYka.mjs} +1 -1
  77. package/.output/server/_ssr/{insights-Ci82qdkq.mjs → insights-BcVNQCXf.mjs} +19 -19
  78. package/.output/server/_ssr/{insights-BJIt1xuT.mjs → insights-BdF3o0Yp.mjs} +2 -2
  79. package/.output/server/_ssr/{insights-C23mopzv.mjs → insights-C9sSQPMF.mjs} +5 -5
  80. package/.output/server/_ssr/{insights-api-BwXMKUSe.mjs → insights-api-CShlv9dA.mjs} +3 -3
  81. package/.output/server/_ssr/{insights-failures-rpc-BuZ-jnby.mjs → insights-failures-rpc-C-cv9bId.mjs} +4 -4
  82. package/.output/server/_ssr/{insights-recovery-rpc-DrXSy9aA.mjs → insights-recovery-rpc-Ct-jIQZU.mjs} +3 -3
  83. package/.output/server/_ssr/{insights-rpc-DyrIZg3a.mjs → insights-rpc-Dc0I8O3n.mjs} +3 -3
  84. package/.output/server/_ssr/{insights-search-CNkNB-aa.mjs → insights-search-D_vVwBwW.mjs} +2 -2
  85. package/.output/server/_ssr/{insights-usage-rpc-C7UC1lom.mjs → insights-usage-rpc-4TR94EHa.mjs} +3 -3
  86. package/.output/server/_ssr/{insights-usage-rpc-cTgmD-Ej.mjs → insights-usage-rpc-D60hOhzl.mjs} +3 -3
  87. package/.output/server/_ssr/{insights_.distribution-CIY_IGmh.mjs → insights_.distribution-BgnfMzw1.mjs} +13 -13
  88. package/.output/server/_ssr/{insights_.distribution-wfFKEv-Z.mjs → insights_.distribution-DkD7uAwA.mjs} +5 -5
  89. package/.output/server/_ssr/{insights_.distribution-BauOpBTE.mjs → insights_.distribution-wT1mjWsG.mjs} +2 -2
  90. package/.output/server/_ssr/{installations-VzacOKHp.mjs → installations-DtRbzy3N.mjs} +2 -2
  91. package/.output/server/_ssr/{installations-jGW7nvEV.mjs → installations-DvxMRP5u.mjs} +4 -4
  92. package/.output/server/_ssr/{installations-Ba3YVrAf.mjs → installations-tFsFnxKk.mjs} +11 -11
  93. package/.output/server/_ssr/{ios-devices-rpc-Bhn7VVIh.mjs → ios-devices-rpc-CIPuCUQ8.mjs} +9 -8
  94. package/.output/server/_ssr/{iosDeviceProfile-_XT8TpgZ.mjs → iosDeviceProfile-WyMC1593.mjs} +2 -2
  95. package/.output/server/_ssr/{iosDevices-Bc27J72d.mjs → iosDevices-B0TjF_sb.mjs} +2 -2
  96. package/.output/server/_ssr/{native-builds-DZFJGcHy.mjs → native-builds-C458T7Ts.mjs} +2 -2
  97. package/.output/server/_ssr/{native-builds-DiNkKHly.mjs → native-builds-C5WxR0BT.mjs} +35 -25
  98. package/.output/server/_ssr/{native-builds_._buildId-CuM1PsT6.mjs → native-builds_._buildId-CyCGKZ1H.mjs} +89 -61
  99. package/.output/server/_ssr/{native-builds_._buildId-D0n4QZY6.mjs → native-builds_._buildId-UsgsqKI8.mjs} +2 -2
  100. package/.output/server/_ssr/{native-builds_.devices-DiM2FdcW.mjs → native-builds_.devices-BcfLIzJs.mjs} +2 -2
  101. package/.output/server/_ssr/{native-builds_.devices-D0JJlX8E.mjs → native-builds_.devices-BpTcIWm0.mjs} +57 -57
  102. package/.output/server/_ssr/{nativeBuildDownloadLink-CvvWuhh0.mjs → nativeBuildDownloadLink-CtB2G7qG.mjs} +3 -3
  103. package/.output/server/_ssr/{nativeBuildInstall-BqcVHBaD.mjs → nativeBuildInstall-PavEyZtZ.mjs} +5 -4
  104. package/.output/server/_ssr/{release-adoption-rpc-Dm-5yAJG.mjs → release-adoption-rpc-DkT6ui4_.mjs} +5 -5
  105. package/.output/server/_ssr/{remote-config-D1BhIBKu.mjs → remote-config-BKlK0dFP.mjs} +2 -2
  106. package/.output/server/_ssr/{remote-config-D7RruPiO.mjs → remote-config-D_nQT__6.mjs} +2 -2
  107. package/.output/server/_ssr/{remote-config-rpc-C7AZy37o.mjs → remote-config-rpc-BW6lyp9Y.mjs} +3 -3
  108. package/.output/server/_ssr/{remote-config-ZFm-l4Gi.mjs → remote-config-v1hs050H.mjs} +20 -20
  109. package/.output/server/_ssr/{router-BGkGFMsT.mjs → router-hKO__Vrv.mjs} +25 -25
  110. package/.output/server/_ssr/{routes-CJJxz-Ak.mjs → routes-DKxm5A7X.mjs} +30 -25
  111. package/.output/server/_ssr/{routes-CiJ2dhL9.mjs → routes-OhljAvlx.mjs} +8 -8
  112. package/.output/server/_ssr/{schema-migration-rpc-D4YlwvGH.mjs → schema-migration-rpc-DrrYEFqy.mjs} +3 -3
  113. package/.output/server/_ssr/{select-BB8GE7OZ.mjs → select-M4kWGKJW.mjs} +1 -1
  114. package/.output/server/_ssr/{server-DAHTchcr.mjs → server-4hXySEh0.mjs} +3 -3
  115. package/.output/server/_ssr/{sidebar-CsKVgZHa.mjs → sidebar-CFlo6lny.mjs} +2 -2
  116. package/.output/server/_ssr/ssr.mjs +1 -1
  117. package/.output/server/_ssr/{switch-BvvmP7Y3.mjs → switch-xTCGSBdC.mjs} +2 -2
  118. package/.output/server/_ssr/{table-WKKzprFn.mjs → table-CqdaVMjd.mjs} +1 -1
  119. package/.output/server/_ssr/{tabs-BJ-4SgmC.mjs → tabs-DtMAFr25.mjs} +2 -2
  120. package/.output/server/_tanstack-start-manifest_v-CYfHRC4i.mjs +225 -0
  121. package/.output/server/index.mjs +351 -344
  122. package/package.json +7 -7
  123. package/src/components/DataTable.tsx +26 -1
  124. package/src/components/FoldedRows.tsx +20 -2
  125. package/src/components/features/api-keys/ApiKeysPage.tsx +1 -1
  126. package/src/components/features/channels/ChannelManagementDialog.tsx +2 -2
  127. package/src/components/features/native-builds/CommitLink.tsx +2 -1
  128. package/src/components/features/native-builds/InstallCard.tsx +76 -39
  129. package/src/components/features/native-builds/IosDevicesPage.tsx +75 -42
  130. package/src/components/features/native-builds/IosInstall.tsx +103 -31
  131. package/src/components/features/native-builds/IpaDevicesCard.tsx +19 -15
  132. package/src/components/features/native-builds/NativeBuildsTable.tsx +17 -13
  133. package/src/components/features/native-builds/ShortHash.tsx +5 -2
  134. package/src/components/features/remote-config/PublishDialog.tsx +4 -1
  135. package/src/components/features/remote-config/VersionsCard.tsx +5 -2
  136. package/src/components/ui/sonner.tsx +3 -1
  137. package/src/lib/api-rpc.ts +14 -1
  138. package/src/lib/ios-devices-rpc.ts +10 -1
  139. package/src/lib/server/nativeBuildInstall.ts +9 -0
  140. package/src/routes/index.tsx +5 -2
  141. package/src/styles.css +2 -2
  142. package/.output/public/assets/EventDetails-sxag8Hfc.js +0 -1
  143. package/.output/public/assets/HashValueDisplay-DMweha_0.js +0 -1
  144. package/.output/public/assets/IosInstall-B5NspihF.js +0 -1
  145. package/.output/public/assets/TargetDisplay-DB8D019f.js +0 -1
  146. package/.output/public/assets/api-keys-Cd-aNt-v.js +0 -1
  147. package/.output/public/assets/api-keys-D3tAc4Uu.js +0 -1
  148. package/.output/public/assets/insights-DIs4nJI9.js +0 -2
  149. package/.output/public/assets/insights-bUk3ChoU.js +0 -1
  150. package/.output/public/assets/insights_.distribution-BPl5oRt4.js +0 -2
  151. package/.output/public/assets/insights_.distribution-BqtmnGTt.js +0 -1
  152. package/.output/public/assets/installations-6U8c_03X.js +0 -1
  153. package/.output/public/assets/native-builds-BdzfAFnF.js +0 -1
  154. package/.output/public/assets/native-builds-CWwvuOXr.js +0 -2
  155. package/.output/public/assets/native-builds-Eh72Vr2G.js +0 -1
  156. package/.output/public/assets/native-builds_._buildId-33ksAlnZ.js +0 -1
  157. package/.output/public/assets/native-builds_._buildId-BVA5GnZP.js +0 -2
  158. package/.output/public/assets/native-builds_.devices-CElovmwq.js +0 -1
  159. package/.output/public/assets/native-builds_.devices-DWtcOVYO.js +0 -2
  160. package/.output/public/assets/remote-config-B3oq9qR0.js +0 -1
  161. package/.output/public/assets/routes-CVbPjRKo.js +0 -1
  162. package/.output/public/assets/styles-B0kzy3kp.css +0 -2
  163. package/.output/server/_ssr/CopyableText-DgNEsByt.mjs +0 -33
  164. package/.output/server/_tanstack-start-manifest_v-CSUJeG5D.mjs +0 -219
  165. /package/.output/public/assets/{BundleIdDisplay-B0gAH01c.js → BundleIdDisplay-CTBdtFQ8.js} +0 -0
  166. /package/.output/public/assets/{NotFoundPage-DDOJarFa.js → NotFoundPage-CVBtl68B.js} +0 -0
  167. /package/.output/public/assets/{PlatformIcon-BBvlg6JY.js → PlatformIcon-DVnzzGqM.js} +0 -0
  168. /package/.output/public/assets/{alert-dialog-CLC_h1fL.js → alert-dialog-Ch0QxRsa.js} +0 -0
  169. /package/.output/public/assets/{api-DLryz9hA.js → api-C1OPeiG1.js} +0 -0
  170. /package/.output/public/assets/{badge-DJMW4YVM.js → badge-FZMD5vvS.js} +0 -0
  171. /package/.output/public/assets/{card-C4sBAMU-.js → card-CyHYmHue.js} +0 -0
  172. /package/.output/public/assets/{dialog-tCTZmAo8.js → dialog-BLj71-Nf.js} +0 -0
  173. /package/.output/public/assets/{dist-Bw_uSBJn.js → dist-DAM__Tdz.js} +0 -0
  174. /package/.output/public/assets/{empty-DsbLxQ1w.js → empty--YaE5Z4p.js} +0 -0
  175. /package/.output/public/assets/{field-DL4OXTJ7.js → field-CdhSgWhI.js} +0 -0
  176. /package/.output/public/assets/{git-branch-ByZMEBxZ.js → git-branch-DG1VDaKq.js} +0 -0
  177. /package/.output/public/assets/{history-wYnPoVmT.js → history-C0wv4htz.js} +0 -0
  178. /package/.output/public/assets/{input-group-B7jx0icS.js → input-group-XKLcUGoa.js} +0 -0
  179. /package/.output/public/assets/{key-round-B-P_hhUB.js → key-round-D7UgdXyA.js} +0 -0
  180. /package/.output/public/assets/{list-fFsS8Wxe.js → list-Bm-CfN5g.js} +0 -0
  181. /package/.output/public/assets/{loader-circle-GWIgH0fo.js → loader-circle-iMqC-8ZE.js} +0 -0
  182. /package/.output/public/assets/{package-CXSDZsME.js → package-BmfoZ5Zj.js} +0 -0
  183. /package/.output/public/assets/{plus-Cx-yFNd9.js → plus-Db0KxLZp.js} +0 -0
  184. /package/.output/public/assets/{refresh-cw-BgiOaFX3.js → refresh-cw-BHhBYjS8.js} +0 -0
  185. /package/.output/public/assets/{relativeTime-CBmDq8wh.js → relativeTime-BYRt19mj.js} +0 -0
  186. /package/.output/public/assets/{rotate-cw-C1v7YuN7.js → rotate-cw-Ba-slJea.js} +0 -0
  187. /package/.output/public/assets/{search-DiOSjaYL.js → search-dJG2BYmx.js} +0 -0
  188. /package/.output/public/assets/{send-BgXZNiEA.js → send-DuMOCzbD.js} +0 -0
  189. /package/.output/public/assets/{smartphone-CxP0GGT6.js → smartphone-D1C6BRd_.js} +0 -0
  190. /package/.output/public/assets/{switch-BTHWmKQ5.js → switch-BsV3d4km.js} +0 -0
  191. /package/.output/public/assets/{table-CwF7yxj4.js → table-D8YjT_ht.js} +0 -0
  192. /package/.output/public/assets/{tabs-CHNnCyvw.js → tabs-RdhEl9sE.js} +0 -0
  193. /package/.output/public/assets/{trash-2-CYISg7ZF.js → trash-2-B5KIvrXy.js} +0 -0
  194. /package/.output/public/assets/{undo-2-Bod3vw7x.js → undo-2-CFcU9dIB.js} +0 -0
  195. /package/.output/public/assets/{uuidv7-CVJ09bBG.js → uuidv7-DAoOOpz9.js} +0 -0
  196. /package/.output/public/assets/{valueToPercent-Db73Kirz.js → valueToPercent-Bn8p2lng.js} +0 -0
@@ -0,0 +1 @@
1
+ import{Di as e,Vr as t,_r as n,gr as r,h as i,p as a}from"./sidebar-yC7KdImc.js";import{t as o}from"./link-CN3iHC4A.js";import{o as s}from"./preload-helper-CRQjUQaZ.js";import{t as c}from"./arrow-up-right-BFafIOrq.js";import{S as l,T as u,_ as d,b as f,d as p,g as ee,h as m,m as h,n as g,r as _,t as v}from"./TargetDisplay-KU7JhIWG.js";import{a as te,i as y,n as ne,o as re,r as ie,t as ae}from"./select-CA8r-UUe.js";import{t as oe}from"./download-B2GjTySo.js";import{i as b}from"./-native-builds-search-DdHwfe4q.js";import{t as se}from"./history-C0wv4htz.js";import{t as x}from"./refresh-cw-BHhBYjS8.js";import{a as ce,i as le,n as ue,o as de,r as fe,t as pe}from"./badge-FZMD5vvS.js";import{t as me}from"./uuidv7-DAoOOpz9.js";import{t as S}from"./native-builds-BMbws1g5.js";import{n as he,t as ge}from"./PlatformIcon-DVnzzGqM.js";import{a as _e,n as ve,o as ye,r as be,s as xe,t as Se}from"./dialog-BLj71-Nf.js";import{g as Ce,i as we,p as Te}from"./api-C1OPeiG1.js";import{i as C,r as w}from"./table-D8YjT_ht.js";import{t as Ee}from"./ChannelBadge-CEabmopB.js";import{a as De,c as T,d as E,f as Oe,i as ke,l as Ae,n as je,o as D,p as Me,r as Ne,s as O,t as k,u as Pe}from"./RelativeTime-B4PK8qDw.js";import{a as A,c as Fe,i as j,l as Ie,n as Le,o as Re,r as M,s as ze,t as Be}from"./RowReason-B7VM1ztc.js";import{t as Ve}from"./NativeBuildsNav-DaqxQPnG.js";import{i as He,n as Ue,r as N,t as P}from"./SandboxBadge-BVxHg_HF.js";var We=t(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),F=e(),I=`npx hot-updater native-build import <file>`,L=`https://hot-updater.dev/docs/guides/native-build#import-a-build-made-elsewhere`;function Ge(){return(0,F.jsxs)(Se,{children:[(0,F.jsxs)(xe,{render:(0,F.jsx)(r,{"aria-label":`Import a build`,className:`min-h-11 min-w-11 sm:min-h-7 sm:min-w-0`,size:`sm`,variant:`outline`}),children:[(0,F.jsx)(We,{"data-icon":`inline-start`}),(0,F.jsx)(`span`,{className:`hidden sm:inline`,children:`Import a build`})]}),(0,F.jsxs)(ve,{className:`sm:max-w-lg`,children:[(0,F.jsxs)(_e,{children:[(0,F.jsx)(ye,{children:`Import a build`}),(0,F.jsx)(be,{children:`Track an .ipa, .aab, .apk or .app built elsewhere as a patch base.`})]}),(0,F.jsx)(u,{label:`the import command`,value:I,wrap:!0}),(0,F.jsxs)(`a`,{className:n({className:`min-h-11 w-full sm:min-h-8 sm:w-fit`,variant:`outline`}),href:L,rel:`noreferrer`,target:`_blank`,children:[`Import guide`,(0,F.jsx)(c,{"data-icon":`inline-end`})]})]})]})}var Ke={"app-store":`App Store`,"ad-hoc":`ad hoc`,development:`development`,enterprise:`enterprise`},R=e=>{let t=h[e.artifact_kind].label,n=e.submitted_to===null?e.artifact_kind===`ipa`&&e.export_method!==null?`${Ke[e.export_method]} ${t}`:t:`${He[e.submitted_to]} build`;return e.is_sandbox?`sandbox ${n}`:n},qe=e=>{if(e===void 0)return{sentence:`A newer build on its channel reaches people the same way.`,label:`Older: a newer build on its channel reaches people the same way`};let t=f(e);return{sentence:`A newer ${R(e)} exists${t===null?`.`:`: ${t}`}`,label:`Older: a newer ${R(e)} exists${t===null?``:`, ${t}`}`}};function z({newer:e}){let t=qe(e);return(0,F.jsx)(Be,{icon:se,label:t.label,reason:t.sentence,children:`Older`})}var Je=`https://hot-updater.dev/docs/guides/native-build#how-a-build-is-tracked`,B=10,V=e=>e===void 0?{}:{channel:e},Ye={one:`older build`,other:`older builds`};function Xe({channel:e,paged:t,folded:i,onClearChannel:a}){return t||i?(0,F.jsx)(O,{icon:b,title:i?`Each build here has a newer one`:`No more native builds`,children:(0,F.jsx)(o,{className:n({className:`mt-1 min-h-11 sm:min-h-8`,variant:`outline`}),search:V(e),to:`/native-builds`,children:`Show the newest builds`})}):e===void 0?(0,F.jsxs)(O,{icon:b,title:`No native builds`,children:[(0,F.jsxs)(`p`,{children:[`Build one with`,` `,(0,F.jsx)(`code`,{className:`font-mono text-xs`,children:`native-build android`}),` or`,` `,(0,F.jsx)(`code`,{className:`font-mono text-xs`,children:`native-build ios`}),`, or import one built elsewhere:`]}),(0,F.jsx)(`div`,{className:`w-full text-left`,children:(0,F.jsx)(u,{label:`the import command`,value:I,wrap:!0})}),(0,F.jsxs)(`a`,{className:n({className:`mt-1 min-h-11 sm:min-h-8`,variant:`outline`}),href:Je,rel:`noreferrer`,target:`_blank`,children:[`Native build guide`,(0,F.jsx)(c,{"data-icon":`inline-end`})]}),(0,F.jsxs)(`a`,{className:n({className:`min-h-11 sm:min-h-8`,variant:`outline`}),href:L,rel:`noreferrer`,target:`_blank`,children:[`Import guide`,(0,F.jsx)(c,{"data-icon":`inline-end`})]})]}):(0,F.jsxs)(O,{icon:b,title:(0,F.jsxs)(F.Fragment,{children:[`No native build embeds `,(0,F.jsx)(`span`,{translate:`no`,children:e})]}),children:[(0,F.jsx)(`p`,{children:`A build embeds the channel it was built on. Build one on this channel, or list every channel's builds.`}),(0,F.jsx)(r,{className:`mt-1 min-h-11 sm:min-h-8`,onClick:a,variant:`outline`,children:`Show all channels`})]})}var H=e=>`${l(e.platform)} ${h[e.artifact_kind].label}`;function U({build:e}){return(0,F.jsx)(o,{"aria-label":H(e),className:`relative rounded-sm font-medium whitespace-nowrap text-foreground transition-colors underline-offset-4 after:absolute after:-inset-x-[10px] after:-inset-y-[10px] hover:text-primary hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:after:hidden`,params:{buildId:e.id},to:`/native-builds/$buildId`,children:h[e.artifact_kind].label})}function W({build:e,inTable:t=!1,older:n=!1,newer:r}){return t?(0,F.jsxs)(`span`,{className:`flex max-w-24 flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,F.jsx)(U,{build:e}),(0,F.jsx)(P,{build:e}),n?(0,F.jsx)(z,{newer:r}):null]}):(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,F.jsx)(U,{build:e}),(0,F.jsx)(P,{build:e})]})}function G({channel:e,onChannel:t}){return(0,F.jsx)(`button`,{"aria-label":`Show the builds that embed ${e}`,className:`relative flex max-w-full min-w-0 rounded-md text-left after:absolute after:inset-x-0 after:-inset-y-[11px] focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:after:hidden`,onClick:()=>t(e),title:e,type:`button`,children:(0,F.jsx)(Ee,{channel:e,className:`block max-w-32 truncate`})})}function Ze({build:e}){return!N(e)&&!e.is_store_build?(0,F.jsx)(g,{}):(0,F.jsx)(K,{build:e,className:`flex flex-col items-start gap-1`})}function K({build:e,className:t}){return(0,F.jsxs)(`span`,{className:t,children:[(0,F.jsx)(Ue,{build:e}),e.is_store_build?(0,F.jsx)(pe,{className:`px-1.5`,variant:`muted`,children:`Store build`}):null]})}function q({build:e}){return(0,F.jsxs)(`a`,{"aria-label":`Download ${d(e)}`,className:n({className:`min-h-11 sm:min-h-8`,size:`sm`,variant:`outline`}),download:!0,href:ee(e.id),children:[(0,F.jsx)(oe,{"data-icon":`inline-start`}),`Download`]})}function Qe({build:e}){return e.build_number?(0,F.jsx)(`span`,{className:`font-mono tabular-nums`,translate:`no`,children:e.build_number}):(0,F.jsx)(g,{})}var J=e=>me(e.id);function Y({build:e,older:t=!1,newer:n,onChannel:r}){let i=s(),a=m(e);return(0,F.jsxs)(E,{"aria-label":`Open native build ${e.id}`,className:`data-[older=true]:bg-muted/60 data-[older=true]:saturate-50 data-[older=true]:hover:bg-muted/60 data-[older=true]:hover:saturate-100 data-[older=true]:focus-within:saturate-100`,"data-older":t?!0:void 0,onOpen:()=>void i({to:`/native-builds/$buildId`,params:{buildId:e.id}}),children:[(0,F.jsx)(w,{children:(0,F.jsx)(W,{build:e,inTable:!0,newer:n,older:t})}),(0,F.jsx)(w,{children:(0,F.jsx)(G,{channel:a,onChannel:r})}),(0,F.jsx)(w,{className:`whitespace-nowrap`,children:(0,F.jsx)(he,{platform:e.platform})}),(0,F.jsx)(w,{children:(0,F.jsx)(Qe,{build:e})}),(0,F.jsx)(w,{children:(0,F.jsx)(_,{appVersion:e.app_version,fingerprintHash:e.fingerprint_hash})}),(0,F.jsx)(w,{children:(0,F.jsx)(v,{value:e.build_key})}),(0,F.jsx)(w,{children:(0,F.jsx)(Ze,{build:e})}),(0,F.jsx)(w,{className:`whitespace-nowrap text-muted-foreground tabular-nums`,children:p(e.byte_size)}),(0,F.jsx)(w,{className:`text-xs text-muted-foreground`,children:(0,F.jsx)(k,{ms:J(e)})}),(0,F.jsx)(w,{className:`text-right`,children:(0,F.jsx)(q,{build:e})})]})}function X({build:e,older:t=!1,newer:n,onChannel:r}){let i=s(),a=m(e),o=N(e)||e.is_store_build;return(0,F.jsxs)(je,{"aria-label":`Native build ${H(e)} ${e.id}`,className:`gap-3 border-b-0 data-[older=true]:bg-muted/60 data-[older=true]:saturate-50 data-[older=true]:hover:bg-muted/60 data-[older=true]:hover:saturate-100 data-[older=true]:focus-within:saturate-100`,"data-older":t?!0:void 0,onClick:Me(()=>void i({to:`/native-builds/$buildId`,params:{buildId:e.id}})),children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-x-2.5`,children:[(0,F.jsx)(ge,{className:`size-4 shrink-0 text-muted-foreground`,platform:e.platform}),(0,F.jsx)(W,{build:e}),t?(0,F.jsx)(z,{newer:n}):null]}),(0,F.jsx)(q,{build:e})]}),(0,F.jsx)(`div`,{className:`flex min-w-0`,children:(0,F.jsx)(G,{channel:a,onChannel:r})}),(0,F.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,F.jsx)(`span`,{className:`sr-only`,children:l(e.platform)}),e.build_number?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{translate:`no`,children:[`Build`,` `,(0,F.jsx)(`span`,{className:`font-mono tabular-nums text-foreground`,children:e.build_number})]}),(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}):null,(0,F.jsx)(`span`,{className:`tabular-nums`,children:p(e.byte_size)}),(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,F.jsx)(k,{ms:J(e)})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-6 text-xs`,children:[(0,F.jsxs)(`span`,{className:`flex items-center`,children:[(0,F.jsx)(`span`,{className:`sr-only`,children:`Target `}),(0,F.jsx)(_,{appVersion:e.app_version,fingerprintHash:e.fingerprint_hash})]}),e.build_key?(0,F.jsxs)(`span`,{className:`flex items-center`,children:[(0,F.jsx)(`span`,{className:`sr-only`,children:`Build key `}),(0,F.jsx)(v,{value:e.build_key})]}):null]}),o?(0,F.jsx)(K,{build:e,className:`flex flex-wrap items-center gap-1.5`}):null]})}function $e({fold:e,channel:t,isMobile:n,open:r,onOpenChange:i,onChannel:a}){let o=Te(t,{...e.from===void 0?{}:{from:e.from},to:e.to},r),s=o.data?.pages??[],c=Object.assign({},...s.map(e=>e.newer)),l=s.flatMap(e=>e.rows),u=n?void 0:B,d=o.isError?(0,F.jsx)(j,{columns:u,label:`Older builds`,onRetry:()=>void o.refetch(),state:`error`}):o.isPending||o.isFetchingNextPage?(0,F.jsx)(j,{columns:u,label:`Loading older builds`,state:`loading`}):o.hasNextPage?(0,F.jsx)(j,{columns:u,label:`Older builds`,onMore:()=>void o.fetchNextPage(),state:`more`}):null,f={label:Re(e,Ye),open:r,onOpenChange:i,panelId:`native-build-fold-${e.to}`};return n?(0,F.jsxs)(Le,{...f,inList:!0,children:[l.map(e=>(0,F.jsx)(`div`,{className:`border-b last:border-b-0`,role:`listitem`,children:(0,F.jsx)(X,{build:e,newer:c[e.id],older:!0,onChannel:a})},e.id)),d]}):(0,F.jsxs)(M,{...f,columns:B,children:[l.map(e=>(0,F.jsx)(Y,{build:e,newer:c[e.id],older:!0,onChannel:a},e.id)),d]})}function et({builds:e,channel:t,paged:n,onChannel:a}){let o=i(),s=Ie(),c=e.data?.entries,{next:l,previous:u}=e.data??{},d=c?.filter(({kind:e})=>e===`row`).length??0;if(e.isError)return(0,F.jsxs)(ue,{variant:`destructive`,children:[(0,F.jsx)(de,{}),(0,F.jsx)(ce,{children:`Native builds couldn't be loaded`}),(0,F.jsx)(le,{children:`Check your connection and try again.`}),(0,F.jsx)(fe,{children:(0,F.jsxs)(r,{onClick:()=>void e.refetch(),size:`xs`,variant:`outline`,children:[(0,F.jsx)(x,{"data-icon":`inline-start`}),`Retry`]})})]});let f=(0,F.jsx)(Xe,{channel:t,folded:(c?.length??0)>0,onClearChannel:()=>a(void 0),paged:n}),p=e=>(0,F.jsx)($e,{channel:t,fold:e,isMobile:o,onChannel:a,onOpenChange:t=>s.set(A(e),t),open:s.isOpen(A(e))},`fold-${e.to}`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(T,{children:o?(0,F.jsx)(`div`,{"aria-busy":e.isPlaceholderData,"aria-label":`Native builds`,className:`h-full overflow-y-auto aria-busy:opacity-60`,role:`list`,children:e.isLoading?(0,F.jsx)(Ne,{label:`Loading native builds`}):(0,F.jsxs)(F.Fragment,{children:[d===0?(0,F.jsx)(ke,{children:f}):null,c?.map(e=>e.kind===`fold`?p(e):(0,F.jsx)(`div`,{className:`border-b last:border-b-0`,role:`listitem`,children:(0,F.jsx)(X,{build:e.row,onChannel:a})},e.row.id))]})}):(0,F.jsx)(De,{"aria-busy":e.isPlaceholderData,"aria-label":`Native builds`,className:`aria-busy:opacity-60 [&_td]:px-1.5 [&_th]:px-1.5`,header:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{children:`Artifact`}),(0,F.jsx)(C,{children:`Channel`}),(0,F.jsx)(C,{children:`Platform`}),(0,F.jsx)(C,{children:`Build`}),(0,F.jsx)(C,{children:`Target`}),(0,F.jsx)(C,{children:`Build key`}),(0,F.jsx)(C,{children:`Store`}),(0,F.jsx)(C,{children:`Size`}),(0,F.jsx)(C,{children:`Created`}),(0,F.jsx)(C,{className:`text-right`,children:(0,F.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),rowGroups:!0,children:e.isLoading?(0,F.jsx)(D,{children:(0,F.jsx)(Oe,{columns:B,label:`Loading native builds`})}):(0,F.jsxs)(F.Fragment,{children:[d===0?(0,F.jsx)(D,{children:(0,F.jsx)(Ae,{columns:B,children:f})}):null,Fe(c??[]).map(e=>e.kind===`fold`?p(e.fold):(0,F.jsx)(D,{children:e.rows.map(e=>(0,F.jsx)(Y,{build:e,onChannel:a},e.id))},`rows-${e.rows[0].id}`))]})})}),e.isLoading||c===void 0?null:(0,F.jsx)(Pe,{count:d,folded:{...ze(c),label:`older`},label:`Native build pages`,noun:[`build`,`builds`],pending:e.isPlaceholderData,newest:n?{search:V(t),to:`/native-builds`}:void 0,next:l===void 0?void 0:{search:{...V(t),before:l},to:`/native-builds`},previous:u===void 0?void 0:{search:{...V(t),...u},to:`/native-builds`}})]})}var Z=`all`,Q=`channel:`,$=e=>`${Q}${e}`;function tt({search:e,onSearchChange:t}){let{channel:n,before:i,after:o}=e,s=Ce(e),c=we(),l=c.data?.map(({name:e})=>e)??[],u=n===void 0||l.includes(n)?l:[n,...l],d=e=>t(e===void 0?{}:{channel:e});return(0,F.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,F.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-background px-3 py-3 sm:min-h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,F.jsx)(a,{className:`-ml-1 size-11 lg:size-7`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,F.jsx)(`h1`,{className:`text-sm font-medium`,children:`Native builds`})]}),(0,F.jsx)(`p`,{className:`basis-full pl-12 text-xs text-muted-foreground sm:basis-auto sm:pl-0`,children:`Store and test builds, each the built-in bundle its OTAs patch from.`})]}),(0,F.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 bg-muted/5 p-3 sm:p-6`,children:[(0,F.jsx)(Ve,{current:`builds`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(ae,{items:[{label:`All channels`,value:Z},...u.map(e=>({label:e,value:$(e)}))],onOpenChange:e=>{e&&c.refetch()},onValueChange:e=>d(e?.startsWith(Q)?e.slice(8):void 0),value:n===void 0?Z:$(n),children:[(0,F.jsx)(te,{"aria-label":`Channel`,className:`min-w-0 flex-1 text-xs data-[size=default]:h-11 sm:w-48 sm:flex-none sm:data-[size=default]:h-8`,children:(0,F.jsx)(re,{})}),(0,F.jsx)(ne,{children:(0,F.jsxs)(ie,{children:[(0,F.jsx)(y,{value:Z,children:`All channels`}),u.map(e=>(0,F.jsx)(y,{translate:`no`,value:$(e),children:e},e))]})})]}),(0,F.jsx)(`div`,{className:`ml-auto`,children:(0,F.jsx)(Ge,{})}),(0,F.jsx)(r,{"aria-label":`Refresh native builds`,className:`size-11 sm:size-7`,disabled:s.isLoading,onClick:()=>void s.refetch(),size:`icon-sm`,variant:`ghost`,children:(0,F.jsx)(x,{"aria-hidden":`true`})})]}),(0,F.jsx)(et,{builds:s,channel:n,onChannel:d,paged:i!==void 0||o!==void 0})]})]})}function nt(){let e=S.useSearch(),t=S.useNavigate();return(0,F.jsx)(tt,{onSearchChange:e=>void t({search:e}),search:e})}export{nt as component};
@@ -0,0 +1 @@
1
+ import{$ as e,Di as t,Ri as n,Vi as r,Vr as i,_r as a,gr as o,p as s}from"./sidebar-yC7KdImc.js";import{t as c}from"./link-CN3iHC4A.js";import{t as l}from"./arrow-up-right-BFafIOrq.js";import{E as u,S as d,T as f,_ as p,b as ee,d as m,g as te,m as h,n as ne,p as re,r as ie,t as ae,v as g,w as _,x as oe}from"./TargetDisplay-KU7JhIWG.js";import{t as v}from"./chevron-right-DNbYTBX1.js";import{n as se,t as y}from"./native-builds_._buildId-DaMmTcHo.js";import{t as b}from"./download-B2GjTySo.js";import{i as ce,n as le,r as x,t as ue}from"./RolloutPercentageBadge-D_I0Raj2.js";import{t as de}from"./git-branch-DG1VDaKq.js";import{i as fe}from"./-native-builds-search-DdHwfe4q.js";import{t as pe}from"./history-C0wv4htz.js";import{t as S}from"./refresh-cw-BHhBYjS8.js";import{t as me}from"./smartphone-D1C6BRd_.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./badge-FZMD5vvS.js";import{n as k}from"./dist-DAM__Tdz.js";import{a as A,n as j,o as M,t as N}from"./card-CyHYmHue.js";import{r as he}from"./uuidv7-DAoOOpz9.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./empty--YaE5Z4p.js";import{n as ge}from"./relativeTime-BYRt19mj.js";import{t as _e}from"./PlatformIcon-DVnzzGqM.js";import{a as ve,d as ye,f as be,h as xe,l as Se,u as Ce}from"./api-C1OPeiG1.js";import{a as B,i as V,n as H,o as U,r as W,t as G}from"./table-D8YjT_ht.js";import{t as we}from"./BundleIdDisplay-CTBdtFQ8.js";import{t as Te}from"./ChannelBadge-CEabmopB.js";import{a as K,n as Ee,r as q,t as De}from"./SandboxBadge-BVxHg_HF.js";import{l as J,n as Oe,o as ke,t as Ae}from"./IosInstall-CHI2C4Yd.js";var je=i(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Y=t();function X({value:e,length:t,shown:n=e.slice(0,t),label:r}){let i=async()=>{try{await navigator.clipboard.writeText(e),k.success(`Copied to clipboard`,{description:e})}catch{k.error(`Could not copy the ${r}`)}};return(0,Y.jsx)(`button`,{"aria-label":`Copy the ${r} ${e}`,className:`relative cursor-copy rounded-sm font-mono after:absolute after:-inset-x-2 after:-inset-y-4 sm:after:hidden text-xs whitespace-nowrap tabular-nums underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,onClick:e=>{e.stopPropagation(),i()},title:e,translate:`no`,type:`button`,children:n})}function Me({hash:e}){let t=ve();if(e===null)return(0,Y.jsx)(ne,{});let n=le(t.data?.console.gitUrl,e);return n===null?(0,Y.jsx)(X,{label:`commit`,length:7,value:e}):(0,Y.jsx)(`a`,{className:`relative font-mono text-xs whitespace-nowrap underline-offset-4 after:absolute after:-inset-x-2 after:-inset-y-4 hover:underline sm:after:hidden`,href:n,onClick:e=>e.stopPropagation(),rel:`noreferrer`,target:`_blank`,title:e,translate:`no`,children:e.slice(0,7)})}function Z({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[10rem_minmax(0,1fr)] sm:gap-4`,children:[(0,Y.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,Y.jsx)(`dd`,{className:`min-w-0 text-sm`,children:t})]})}function Ne({detail:e}){let{build:t}=e,n=Se();if(t.is_sandbox)return null;let r=!t.is_store_build;return(0,Y.jsx)(o,{className:`min-h-11 shrink-0 sm:min-h-8`,disabled:n.isPending,onClick:()=>n.mutate({id:t.id,storeBuild:r},{onSuccess:()=>{k.success(r?`Marked as the store build`:`Mark cleared`)},onError:e=>{k.error(`Could not change the mark`,{description:e.message})}}),size:`sm`,type:`button`,variant:`outline`,children:r?`Mark as store build`:`Clear mark`})}function Pe({detail:e}){let{build:t,newestInScope:n,storeBuildInScope:r}=e,i=r??n;if(i===null)return null;let a=i.id===t.id;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border bg-muted/40 p-3 text-xs sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(a?se:pe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),r?.id===t.id?(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Store build.`}),` New deploys to this scope patch from this build.`]}):a?(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Current baseline.`}),` The newest build, and no store build is marked. New deploys to this scope patch from this build.`]}):(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Not the base.`}),` New deploys patch from`,` `,(0,Y.jsxs)(c,{className:`inline-flex items-center gap-0.5 font-medium underline underline-offset-4`,params:{buildId:i.id},to:`/native-builds/$buildId`,children:[ee(i)??(0,Y.jsxs)(Y.Fragment,{children:[d(i.platform),` `,h[i.artifact_kind].label,` ·`,` `,(0,Y.jsx)(x,{uuid:i.id})]}),(0,Y.jsx)(l,{"aria-hidden":`true`,className:`size-3`})]}),`, so this one gets no new patches.`]})]}),(0,Y.jsx)(Ne,{detail:e})]})}function Fe({detail:e}){let{build:t,builtInBundle:n,channel:r}=e,i=n?.childCount??0;return(0,Y.jsxs)(N,{className:`overflow-hidden shadow-sm`,children:[(0,Y.jsx)(A,{className:`border-b px-4 py-3`,children:(0,Y.jsx)(M,{className:`text-sm`,children:(0,Y.jsx)(`h2`,{children:`Built-in bundle`})})}),(0,Y.jsxs)(j,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,Y.jsxs)(`dl`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(Z,{label:`Bundle ID`,children:(0,Y.jsx)(we,{bundleId:t.min_bundle_id})}),(0,Y.jsx)(Z,{label:`OTAs patching from it`,children:(0,Y.jsx)(`span`,{className:`tabular-nums`,children:i===1?`1 bundle`:`${i} bundles`})}),(0,Y.jsx)(Z,{label:`Scope`,children:(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(c,{"aria-label":`Show the builds that embed ${r}`,className:`relative rounded-md after:absolute after:inset-x-0 after:-inset-y-[11px] sm:after:hidden`,search:{channel:r},to:`/native-builds`,children:(0,Y.jsx)(Te,{channel:r})}),(0,Y.jsx)(`span`,{className:`text-xs`,children:d(t.platform)})]})}),(0,Y.jsx)(Z,{label:`Target`,children:(0,Y.jsx)(`span`,{className:`text-xs`,children:(0,Y.jsx)(ie,{appVersion:t.app_version,fingerprintHash:t.fingerprint_hash})})}),(0,Y.jsx)(Z,{label:`Build key`,children:(0,Y.jsx)(`span`,{className:`text-xs`,children:(0,Y.jsx)(ae,{value:t.build_key})})}),t.build_number?(0,Y.jsx)(Z,{label:`Build`,children:(0,Y.jsx)(`span`,{className:`font-mono text-xs tabular-nums`,translate:`no`,children:t.build_number})}):null,q(t)?(0,Y.jsx)(Z,{label:`Store`,children:(0,Y.jsx)(Ee,{build:t,withTime:!0})}):null,(0,Y.jsx)(Z,{label:`Commit`,children:(0,Y.jsx)(Me,{hash:t.git_commit_hash})}),(0,Y.jsx)(Z,{label:`Created`,children:(0,Y.jsx)(x,{format:`both`,uuid:t.id})})]}),(0,Y.jsx)(Pe,{detail:e}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A store or test install of this build runs this bundle until its first OTA. That OTA downloads as a patch from this bundle when one exists, and as the full bundle otherwise.`})]})]})}var Ie=r(ge(),1),Q=r(n(),1),$={ipa:`The .ipa installs only on devices its signing profile allows (development or ad hoc); an App Store export reaches testers through TestFlight.`,aab:`The .aab installs through Google Play or bundletool, not from the file.`},Le={apk:`Scan with an Android phone's camera, then open the APK to install it.`,ipa:`Scan to download. ${$.ipa}`,aab:`Scan to download. ${$.aab}`,app:`Scan to download the .app.zip on a Mac.`};function Re(){let{origin:e,pathname:t}=window.location;return(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,Y.jsx)(J,{className:`size-48`,label:`Open this page on an iPhone`,value:`${e}${t}`}),(0,Y.jsx)(`p`,{className:`max-w-56 text-center text-xs text-muted-foreground`,children:`Scan with an iPhone to install this build from here. The phone signs in to the Console first.`})]})}function ze({build:e,url:t,note:n}){return(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,Y.jsx)(J,{className:`size-48`,label:`Download ${p(e)}`,value:t}),(0,Y.jsx)(`p`,{className:`max-w-56 text-center text-xs text-muted-foreground`,children:Le[e.artifact_kind]}),n?(0,Y.jsx)(`p`,{className:`max-w-56 text-center text-xs text-muted-foreground`,children:n}):null]})}function Be({message:e}){return(0,Y.jsxs)(T,{variant:`destructive`,children:[(0,Y.jsx)(E,{}),(0,Y.jsx)(C,{children:`The download link couldn't be created`}),(0,Y.jsx)(w,{children:e})]})}function Ve({build:t}){let n=be(t.id),r=n.data?.url;if(r===null){let e=$[t.artifact_kind];return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{children:`This storage gives no download link a phone can open without signing in, so there is no QR code. Download the build here, or open this page on the phone signed in to the console.`}),e?(0,Y.jsx)(`p`,{children:e}):null]})}return r===void 0?n.isError?(0,Y.jsx)(Be,{message:n.error.message}):(0,Y.jsx)(e,{className:`size-48`}):(0,Y.jsx)(ze,{build:t,note:`This link expires. If the download fails, reload this page.`,url:r})}function He({build:e}){return(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,translate:`no`,children:e.submitted_version??`this build`})}function Ue({build:e}){let t=e.submitted_to===`testflight`?{name:`App Store Connect`,url:`https://appstoreconnect.apple.com/apps`}:{name:`Play Console`,url:`https://play.google.com/console`};return(0,Y.jsxs)(N,{className:`overflow-hidden shadow-sm`,children:[(0,Y.jsx)(A,{className:`border-b px-4 py-3`,children:(0,Y.jsx)(M,{className:`text-sm`,children:(0,Y.jsx)(`h2`,{children:`Install`})})}),(0,Y.jsxs)(j,{className:`flex min-w-0 flex-col gap-4 p-4 sm:p-6`,children:[(0,Y.jsx)(We,{build:e}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,Y.jsxs)(`a`,{className:a({className:`h-auto min-h-11 w-full min-w-0 py-2 whitespace-normal sm:min-h-8 sm:w-fit`}),href:t.url,rel:`noreferrer`,target:`_blank`,children:[(0,Y.jsx)(ce,{"data-icon":`inline-start`}),`Open `,t.name]}),(0,Y.jsxs)(`a`,{className:a({className:`h-auto min-h-11 w-full min-w-0 py-2 whitespace-normal sm:min-h-8 sm:w-fit`,variant:`outline`}),download:!0,href:te(e.id),children:[(0,Y.jsx)(b,{"data-icon":`inline-start`}),(0,Y.jsxs)(`span`,{className:`text-left [overflow-wrap:anywhere]`,children:[`Download `,p(e)]})]})]})]})]})}function We({build:e}){switch(e.artifact_kind){case`apk`:return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Your browser needs the "Install unknown apps" permission.`}),e.is_sandbox?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Its .sandbox ID installs it beside a Play copy.`}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`If this package is already installed with another signing key, such as a Play copy, the install fails. Uninstall that copy first, or build with sandbox: true, whose .sandbox ID installs beside it.`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`On an emulator or a phone over USB, install and open it from your project:`}),(0,Y.jsx)(f,{label:`the install command`,value:g(e)})]});case`app`:return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It runs only in the iOS Simulator. In your project, install and open it on the booted one:`}),(0,Y.jsx)(f,{label:`the install command`,value:g(e)})]});case`aab`:return q(e)?(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Submitted to`,` `,e.submitted_to===`play-internal`?K[`play-internal`].name:K[e.submitted_to].label,` `,`as `,(0,Y.jsx)(He,{build:e}),`.`,` `,e.submitted_to===`play-production`?`Users`:`Testers`,` get it once its release is rolled out; on an app Play Console hasn't published, the release is a draft you roll out in Play Console.`]}):(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`For testers, build and release to internal testing:`}),(0,Y.jsx)(f,{label:`the Google Play command`,value:`npx hot-updater google-play upload`})]});case`ipa`:return q(e)?(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`On TestFlight as `,(0,Y.jsx)(He,{build:e}),`. Internal testers install it from the TestFlight app once App Store Connect has processed it, and a preview's pull request comment shows that state.`]}):(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Over USB, Xcode or Apple Configurator installs it. For testers without a registered device:`}),(0,Y.jsx)(f,{label:`the TestFlight command`,value:`npx hot-updater testflight`})]})}}function Ge({link:e,url:t}){return e?.status===`no-secret`?(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:[`Set `,e.secretName,` on the Console to create links.`]}):e?.status!==`issued`||t===null?null:(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsx)(f,{label:`the download link`,value:t}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Anyone with this link can download this build until`,` `,(0,Y.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,Ie.default)(e.expiresAt).format(`YYYY-MM-DD`),`.`]})]})]})}function Ke({build:e}){return q(e)&&(e.artifact_kind===`ipa`||e.artifact_kind===`aab`)?(0,Y.jsx)(Ue,{build:e}):(0,Y.jsx)(Je,{build:e})}function qe({children:e}){let[t,n]=(0,Q.useState)(!1),r=(0,Q.useId)();return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 border-t pt-3`,children:[(0,Y.jsxs)(`button`,{"aria-controls":r,"aria-expanded":t,className:`group/other -mx-1 flex min-h-11 items-center gap-1.5 self-start rounded-md px-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none motion-reduce:transition-none sm:min-h-8`,onClick:()=>n(e=>!e),type:`button`,children:[(0,Y.jsx)(v,{"aria-hidden":`true`,className:`size-3.5 shrink-0 transition-transform group-aria-expanded/other:rotate-90 motion-reduce:transition-none`}),`Other ways to install`]}),(0,Y.jsx)(`div`,{hidden:!t,id:r,children:e})]})}function Je({build:t}){let n=p(t),r=ye(t.id),i=r.data?.status===`issued`?oe(window.location,t.id,r.data.token):null,o=Oe(),s=t.artifact_kind===`ipa`,c=s&&o?.ios===!0,l=(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Y.jsx)(We,{build:t}),(0,Y.jsxs)(`a`,{className:a({className:`h-auto min-h-11 w-full min-w-0 py-2 whitespace-normal sm:min-h-8 sm:w-fit`,variant:`outline`}),download:!0,href:i??te(t.id),children:[(0,Y.jsx)(b,{"data-icon":`inline-start`}),(0,Y.jsxs)(`span`,{className:`text-left [overflow-wrap:anywhere]`,children:[`Download `,n]})]}),(0,Y.jsx)(Ge,{link:r.data,url:i})]});return(0,Y.jsxs)(N,{className:`overflow-hidden shadow-sm`,children:[(0,Y.jsx)(A,{className:`border-b px-4 py-3`,children:(0,Y.jsx)(M,{className:`text-sm`,children:(0,Y.jsx)(`h2`,{children:`Install`})})}),c?(0,Y.jsxs)(j,{className:`flex min-w-0 flex-col gap-4 p-4 sm:p-6`,children:[(0,Y.jsx)(Ae,{build:t,device:o}),(0,Y.jsx)(qe,{children:l})]}):(0,Y.jsxs)(j,{className:`grid gap-6 p-4 sm:grid-cols-[12rem_minmax(0,1fr)] sm:p-6`,children:[s&&i!==null?(0,Y.jsx)(Re,{}):i===null?r.data===void 0?r.isError?(0,Y.jsx)(Be,{message:r.error.message}):(0,Y.jsx)(e,{className:`size-48`}):(0,Y.jsx)(Ve,{build:t}):(0,Y.jsx)(ze,{build:t,url:i}),l]})]})}function Ye({build:t}){let n=ke(t.id),r=n.data;if(r?.status===`store`||r?.status===`enterprise`)return null;let i=r?.status===`listed`?r.devices:null;return(0,Y.jsxs)(N,{className:`overflow-hidden shadow-sm`,children:[(0,Y.jsxs)(A,{className:`flex flex-row items-center gap-2 border-b px-4 py-3`,children:[(0,Y.jsx)(M,{className:`text-sm`,children:(0,Y.jsx)(`h2`,{children:`Devices in this build`})}),i===null?null:(0,Y.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:i.length}),(0,Y.jsx)(c,{className:a({className:`ml-auto h-11 sm:h-7`,size:`sm`,variant:`ghost`}),to:`/native-builds/devices`,children:`iOS devices`})]}),(0,Y.jsx)(j,{className:`p-0`,children:n.isPending?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Reading this IPA's devices`}),(0,Y.jsx)(e,{className:`h-8 w-full`}),(0,Y.jsx)(e,{className:`h-8 w-full`})]}):n.isError||r?.status===`unavailable`?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-4 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 flex-1`,children:`The Console couldn't read this IPA's devices from storage.`}),(0,Y.jsxs)(o,{className:`h-11 sm:h-7`,onClick:()=>void n.refetch(),size:`sm`,variant:`outline`,children:[(0,Y.jsx)(S,{"data-icon":`inline-start`}),`Retry`]})]}):i?.length===0?(0,Y.jsx)(`p`,{className:`p-4 text-xs text-muted-foreground`,children:`This IPA lists no devices.`}):(0,Y.jsx)(`ul`,{"aria-label":`Devices in this build`,className:`divide-y`,children:i?.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-h-11 min-w-0 items-center gap-3 px-4 py-2 text-sm`,children:[(0,Y.jsx)(me,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col items-start`,children:[(0,Y.jsx)(`span`,{className:e.name===null?`truncate text-muted-foreground`:`truncate`,children:e.name??`Unknown device`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Y.jsx)(X,{label:`UDID`,shown:re(e.udid),value:e.udid})})]})]},e.udid))})})]})}var Xe=`https://hot-updater.dev/docs/guides/bundle-diffing#first-ota-update`;function Ze({detail:t,page:n,onPage:r}){let i=n.before!==void 0||n.after!==void 0,s=xe(t.build.min_bundle_id,n,i),d=i?s.data:t.patches,{next:f,previous:p}=d??{};return(0,Y.jsxs)(N,{className:`overflow-hidden shadow-sm`,id:`patches`,children:[(0,Y.jsx)(A,{className:`border-b px-4 py-3`,children:(0,Y.jsx)(M,{className:`text-sm`,children:(0,Y.jsx)(`h2`,{children:`Patches from this build`})})}),(0,Y.jsxs)(j,{className:`p-0`,children:[i&&s.isError?(0,Y.jsx)(`div`,{className:`p-4`,children:(0,Y.jsxs)(T,{variant:`destructive`,children:[(0,Y.jsx)(E,{}),(0,Y.jsx)(C,{children:`Patches couldn't be loaded`}),(0,Y.jsx)(w,{children:s.error.message}),(0,Y.jsx)(D,{children:(0,Y.jsxs)(o,{onClick:()=>void s.refetch(),size:`xs`,variant:`outline`,children:[(0,Y.jsx)(S,{"data-icon":`inline-start`}),`Retry`]})})]})}):d===void 0?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Loading patches`}),(0,Y.jsx)(e,{className:`h-4 w-full`}),(0,Y.jsx)(e,{className:`h-4 w-2/3`})]}):d.data.length===0?i?(0,Y.jsxs)(z,{className:`py-10`,children:[(0,Y.jsx)(F,{children:(0,Y.jsx)(L,{children:`No more patches`})}),(0,Y.jsx)(o,{className:`min-h-11 sm:min-h-8`,onClick:()=>r({}),variant:`outline`,children:`Show the newest patches`})]}):(0,Y.jsxs)(z,{className:`py-10`,children:[(0,Y.jsxs)(F,{children:[(0,Y.jsx)(P,{variant:`icon`,children:(0,Y.jsx)(de,{})}),(0,Y.jsx)(L,{children:`No patches from this build`}),(0,Y.jsxs)(R,{children:[`A deploy adds a patch from this build's bundle while it is its scope's store build, or its newest build with none marked, and the deploy config turns patches on, with`,` `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`patch`}),` in`,` `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`hot-updater.config.ts`}),`.`]})]}),(0,Y.jsx)(I,{children:(0,Y.jsxs)(`a`,{className:a({className:`min-h-11 sm:min-h-8`,variant:`outline`}),href:Xe,rel:`noreferrer`,target:`_blank`,children:[`Bundle diffing guide`,(0,Y.jsx)(l,{"data-icon":`inline-end`})]})})]}):(0,Y.jsxs)(G,{"aria-busy":i&&s.isPlaceholderData,"aria-label":`Patches from this build`,className:`table-fixed`,children:[(0,Y.jsx)(B,{children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{children:`Target bundle`}),(0,Y.jsx)(V,{className:`w-28`,children:`Patch size`}),(0,Y.jsx)(V,{className:`hidden w-32 sm:table-cell`,children:`Created`})]})}),(0,Y.jsx)(H,{children:d.data.map(e=>(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{className:`py-3 whitespace-normal`,children:(0,Y.jsx)(c,{className:`block font-mono text-xs [overflow-wrap:anywhere] underline-offset-4 hover:underline`,search:{bundleId:e.bundleId},title:e.bundleId,to:`/`,translate:`no`,children:e.bundleId})}),(0,Y.jsx)(W,{className:`text-xs tabular-nums`,children:m(e.byteSize)}),(0,Y.jsx)(W,{className:`hidden sm:table-cell`,children:(0,Y.jsx)(x,{uuid:e.bundleId})})]},e.bundleId))})]}),f!==void 0||p!==void 0?(0,Y.jsxs)(`nav`,{"aria-label":`Patch pages`,className:`flex items-center justify-end gap-2 border-t px-4 py-2`,children:[(0,Y.jsxs)(o,{className:`min-h-11 sm:min-h-7`,disabled:p===void 0||i&&s.isPlaceholderData,onClick:()=>r({after:p}),size:`sm`,variant:`ghost`,children:[(0,Y.jsx)(u,{"data-icon":`inline-start`}),`Newer`]}),(0,Y.jsxs)(o,{className:`min-h-11 sm:min-h-7`,disabled:f===void 0||i&&s.isPlaceholderData,onClick:()=>r({before:f}),size:`sm`,variant:`ghost`,children:[`Older`,(0,Y.jsx)(v,{"data-icon":`inline-end`})]})]}):null]})]})}var Qe=(e,t)=>{let n=e.data.find(e=>e.bundleId===t);if(n!==void 0)return{kind:`patch`,byteSize:n.byteSize};let r=e.data.at(-1)?.bundleId;return e.next!==void 0&&r!==void 0&&t<r?{kind:`unknown`}:{kind:`full`}};function $e({download:e}){switch(e.kind){case`patch`:return(0,Y.jsxs)(`span`,{className:`text-xs`,children:[`Patch`,` `,(0,Y.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`(`,m(e.byteSize),`)`]})]});case`full`:return(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Full bundle`});case`unknown`:return(0,Y.jsx)(`a`,{className:`text-xs underline-offset-4 hover:underline`,href:`#patches`,children:`See patches`})}}function et({detail:e}){let{build:t,channel:n,servedNow:r,patches:i,catalogScopeKey:o}=e,s=r.find(({rolloutCohortCount:e,targetCohorts:t})=>e>0||t.length>0)?.bundleId,u=t.is_store_build&&s!=null&&Qe(i,s).kind===`full`?[`npx hot-updater patch`,`-p ${t.platform}`,`-c ${_(n)}`,`-b ${_(s)}`,`--base-artifact-id ${_(t.min_bundle_id)}`].join(` `):null,d=(0,Y.jsxs)(c,{className:`inline-flex items-center gap-0.5 underline-offset-4 hover:underline`,search:{scopeKey:o},to:`/`,children:[`All releases in this scope`,(0,Y.jsx)(l,{"aria-hidden":`true`,className:`size-3`})]});return(0,Y.jsxs)(N,{className:`overflow-hidden shadow-sm`,children:[(0,Y.jsx)(A,{className:`border-b px-4 py-3`,children:(0,Y.jsx)(M,{className:`text-sm`,children:(0,Y.jsx)(`h2`,{children:`Served now`})})}),(0,Y.jsx)(j,{className:`p-0`,children:r.length===0?(0,Y.jsxs)(z,{className:`py-10`,children:[(0,Y.jsxs)(F,{children:[(0,Y.jsx)(P,{variant:`icon`,children:(0,Y.jsx)(je,{})}),(0,Y.jsx)(L,{children:`No OTA for this build yet`}),(0,Y.jsxs)(R,{children:[`No release in this build's scope is newer than its built-in bundle. Deploy one with`,` `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`hot-updater deploy`}),`, and it shows here.`]})]}),(0,Y.jsx)(I,{children:(0,Y.jsx)(c,{className:a({className:`min-h-11 sm:min-h-8`,variant:`outline`}),search:{scopeKey:o},to:`/`,children:`All releases in this scope`})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(G,{"aria-label":`Served now`,className:`table-fixed`,children:[(0,Y.jsx)(B,{children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{children:`Bundle`}),(0,Y.jsx)(V,{className:`hidden w-40 md:table-cell`,children:`Rollout`}),(0,Y.jsx)(V,{className:`hidden w-32 sm:table-cell`,children:`Created`}),(0,Y.jsx)(V,{className:`w-32`,children:`First OTA download`})]})}),(0,Y.jsx)(H,{children:r.map(e=>{let t=e.bundleId,n=e.rolloutCohortCount/he*100;return(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{className:`py-3 whitespace-normal`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsx)(c,{className:`font-mono text-xs [overflow-wrap:anywhere] underline-offset-4 hover:underline`,search:{releaseId:e.releaseId},title:t,to:`/`,translate:`no`,children:t}),e.message?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.message}):null]})}),(0,Y.jsx)(W,{className:`hidden md:table-cell`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.targetCohorts.length>0?(0,Y.jsx)(O,{variant:`secondary`,children:e.targetCohorts.length===1?`1 cohort`:`${e.targetCohorts.length} cohorts`}):(0,Y.jsx)(ue,{percentage:n}),e.shouldForceUpdate?(0,Y.jsx)(O,{variant:`outline`,children:`Forced`}):null]})}),(0,Y.jsx)(W,{className:`hidden sm:table-cell`,children:(0,Y.jsx)(x,{uuid:t})}),(0,Y.jsx)(W,{children:(0,Y.jsx)($e,{download:Qe(i,t)})})]},e.releaseId)})})]}),u===null?null:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 border-t px-4 py-3 text-xs`,children:[(0,Y.jsx)(`p`,{children:`The OTA fresh installs get first has no patch from this store build, so they download all of it. Add one from your project:`}),(0,Y.jsx)(f,{label:`the patch command`,value:u})]}),(0,Y.jsxs)(`p`,{className:`border-t px-4 py-3 text-xs text-muted-foreground`,children:[`What the update check serves an install of this build now, newest first: not the history. `,d]})]})})]})}function tt({buildId:t,search:n,onSearchChange:r}){let i=Ce(t),l=i.data,f={...n.patchesBefore===void 0?{}:{before:n.patchesBefore},...n.patchesAfter===void 0?{}:{after:n.patchesAfter}};return(0,Y.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 items-center gap-x-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,Y.jsx)(s,{className:`-ml-1 size-11 lg:size-7`}),(0,Y.jsxs)(c,{className:a({className:`min-h-11 sm:min-h-7`,size:`sm`,variant:`ghost`}),to:`/native-builds`,children:[(0,Y.jsx)(u,{"data-icon":`inline-start`}),`Native builds`]}),l?(0,Y.jsxs)(`h1`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium`,children:[(0,Y.jsx)(_e,{className:`size-3.5 shrink-0 text-muted-foreground`,platform:l.build.platform}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 whitespace-nowrap`,children:[(0,Y.jsxs)(`span`,{className:`sr-only`,children:[d(l.build.platform),` `]}),h[l.build.artifact_kind].label,(0,Y.jsx)(De,{build:l.build})]}),(0,Y.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`· `,(0,Y.jsx)(`span`,{translate:`no`,children:l.channel})]})]}),(0,Y.jsx)(`span`,{className:`hidden text-xs font-normal text-muted-foreground tabular-nums sm:inline`,children:m(l.build.byte_size)})]}):(0,Y.jsx)(`h1`,{className:`sr-only`,children:`Native build`})]}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,Y.jsx)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4 sm:gap-6`,children:i.isError?(0,Y.jsxs)(T,{variant:`destructive`,children:[(0,Y.jsx)(E,{}),(0,Y.jsx)(C,{children:`The native build couldn't be loaded`}),(0,Y.jsx)(w,{children:i.error.message}),(0,Y.jsx)(D,{children:(0,Y.jsxs)(o,{onClick:()=>void i.refetch(),size:`xs`,variant:`outline`,children:[(0,Y.jsx)(S,{"data-icon":`inline-start`}),`Retry`]})})]}):l===void 0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Loading the native build`}),(0,Y.jsx)(e,{className:`h-56 w-full rounded-xl`}),(0,Y.jsx)(e,{className:`h-64 w-full rounded-xl`})]}):l===null?(0,Y.jsxs)(z,{className:`border py-16`,children:[(0,Y.jsxs)(F,{children:[(0,Y.jsx)(P,{variant:`icon`,children:(0,Y.jsx)(fe,{})}),(0,Y.jsx)(L,{children:`Native build not found`}),(0,Y.jsxs)(R,{children:[`No native build has this ID. It may have been deleted with`,` `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`native-build delete`}),`, or be from another console.`]})]}),(0,Y.jsx)(I,{children:(0,Y.jsx)(c,{className:a({className:`min-h-11 sm:min-h-8`,variant:`outline`}),to:`/native-builds`,children:`Show all native builds`})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ke,{build:l.build}),l.build.artifact_kind===`ipa`&&!q(l.build)?(0,Y.jsx)(Ye,{build:l.build}):null,(0,Y.jsx)(Fe,{detail:l}),(0,Y.jsx)(et,{detail:l}),(0,Y.jsx)(Ze,{detail:l,onPage:e=>r({...e.before===void 0?{}:{patchesBefore:e.before},...e.after===void 0?{}:{patchesAfter:e.after}}),page:f})]})})})]})}function nt(){let{buildId:e}=y.useParams(),t=y.useSearch(),n=y.useNavigate();return(0,Y.jsx)(tt,{buildId:e,onSearchChange:e=>void n({search:e,replace:!0}),search:t})}export{nt as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/native-builds_._buildId-B04z9yfk.js","assets/sidebar-yC7KdImc.js","assets/link-CN3iHC4A.js","assets/relativeTime-BYRt19mj.js","assets/arrow-up-right-BFafIOrq.js","assets/TargetDisplay-KU7JhIWG.js","assets/copy-CH1__JAW.js","assets/key-round-D7UgdXyA.js","assets/package-BmfoZ5Zj.js","assets/dist-DAM__Tdz.js","assets/HashValueDisplay-D2f0HmyU.js","assets/uuidv7-DAoOOpz9.js","assets/chevron-right-DNbYTBX1.js","assets/download-B2GjTySo.js","assets/RolloutPercentageBadge-D_I0Raj2.js","assets/badge-FZMD5vvS.js","assets/git-branch-DG1VDaKq.js","assets/-native-builds-search-DdHwfe4q.js","assets/history-C0wv4htz.js","assets/refresh-cw-BHhBYjS8.js","assets/smartphone-D1C6BRd_.js","assets/IosInstall-CHI2C4Yd.js","assets/useMutation-w3qYaU2L.js","assets/loader-circle-iMqC-8ZE.js","assets/send-DuMOCzbD.js","assets/field-CdhSgWhI.js","assets/api-C1OPeiG1.js","assets/preload-helper-CRQjUQaZ.js","assets/BundleIdDisplay-CTBdtFQ8.js","assets/ChannelBadge-CEabmopB.js","assets/PlatformIcon-DVnzzGqM.js","assets/SandboxBadge-BVxHg_HF.js","assets/card-CyHYmHue.js","assets/empty--YaE5Z4p.js","assets/table-D8YjT_ht.js"])))=>i.map(i=>d[i]);
2
+ import{Vr as e}from"./sidebar-yC7KdImc.js";import{i as t,r as n,t as r}from"./preload-helper-CRQjUQaZ.js";import{n as i}from"./-native-builds-search-DdHwfe4q.js";var a=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),o=t(`/native-builds_/$buildId`)({component:n(()=>r(()=>import(`./native-builds_._buildId-B04z9yfk.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34])),`component`),validateSearch:i});export{a as n,o as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/native-builds_.devices-CVNAQtSy.js","assets/sidebar-yC7KdImc.js","assets/alert-dialog-Ch0QxRsa.js","assets/select-CA8r-UUe.js","assets/useCompositeListItem-lAmUsXcc.js","assets/check-CqWNyG93.js","assets/CompositeItem-KUM5yQVr.js","assets/tabs-RdhEl9sE.js","assets/link-CN3iHC4A.js","assets/relativeTime-BYRt19mj.js","assets/TargetDisplay-KU7JhIWG.js","assets/copy-CH1__JAW.js","assets/key-round-D7UgdXyA.js","assets/package-BmfoZ5Zj.js","assets/dist-DAM__Tdz.js","assets/HashValueDisplay-D2f0HmyU.js","assets/uuidv7-DAoOOpz9.js","assets/-native-builds-search-DdHwfe4q.js","assets/loader-circle-iMqC-8ZE.js","assets/refresh-cw-BHhBYjS8.js","assets/smartphone-D1C6BRd_.js","assets/trash-2-B5KIvrXy.js","assets/badge-FZMD5vvS.js","assets/IosInstall-CHI2C4Yd.js","assets/useMutation-w3qYaU2L.js","assets/send-DuMOCzbD.js","assets/field-CdhSgWhI.js","assets/api-C1OPeiG1.js","assets/preload-helper-CRQjUQaZ.js","assets/RelativeTime-B4PK8qDw.js","assets/chevron-right-DNbYTBX1.js","assets/table-D8YjT_ht.js","assets/NativeBuildsNav-DaqxQPnG.js","assets/card-CyHYmHue.js","assets/dialog-BLj71-Nf.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,r as t,t as n}from"./preload-helper-CRQjUQaZ.js";import{t as r}from"./-native-builds-search-DdHwfe4q.js";var i=e(`/native-builds_/devices`)({component:t(()=>n(()=>import(`./native-builds_.devices-CVNAQtSy.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34])),`component`),validateSearch:r});export{i as t};
@@ -0,0 +1 @@
1
+ import{$ as e,A as t,An as n,Ar as r,At as i,Bt as a,C as o,Cr as s,Ct as c,Di as l,Dt as u,Er as d,Et as f,Ft as p,Gt as m,Hn as h,Ht as g,In as _,Jt as v,Kt as ee,L as te,Li as y,Lr as b,Mr as x,Mt as S,Nr as C,Or as w,Ot as T,Pr as E,Pt as ne,Qn as D,Qt as O,Ri as k,Rr as re,Rt as A,Sn as j,Sr as ie,St as M,Tr as N,Tt as ae,Ut as P,Vi as F,Vr as I,Vt as oe,Wt as L,Xt as se,Yt as R,Z as z,Zt as B,_r as V,_t as ce,ct as H,dt as le,en as U,fr as ue,ft as W,gr as G,gt as de,h as fe,hn as pe,hr as me,jn as he,jr as ge,kr as K,kt as _e,lt as q,mr as J,mt as ve,nn as ye,ot as be,p as Y,pr as xe,pt as Se,qt as Ce,rn as X,st as we,tn as Te,tt as Ee,ur as De,ut as Oe,vn as ke,vr as Ae,vt as je,wn as Me,wt as Ne,xr as Pe,xt as Fe,yt as Ie}from"./sidebar-yC7KdImc.js";import{t as Le}from"./link-CN3iHC4A.js";import{t as Re}from"./check-CqWNyG93.js";import{n as ze,r as Be}from"./useCompositeListItem-lAmUsXcc.js";import{T as Ve,a as He,f as Ue,i as We,n as Ge,p as Ke,u as qe}from"./TargetDisplay-KU7JhIWG.js";import{F as Je,P as Ye,a as Xe,i as Ze,l as Qe,n as $e,o as et,r as tt,s as nt,t as rt,u as it}from"./select-CA8r-UUe.js";import{i as at}from"./-native-builds-search-DdHwfe4q.js";import{t as ot}from"./loader-circle-iMqC-8ZE.js";import{n as st,t as ct}from"./CompositeItem-KUM5yQVr.js";import{t as lt}from"./refresh-cw-BHhBYjS8.js";import{t as ut}from"./smartphone-D1C6BRd_.js";import{t as dt}from"./trash-2-B5KIvrXy.js";import{a as ft,i as pt,n as mt,o as ht,r as gt,t as _t}from"./badge-FZMD5vvS.js";import{a as vt,n as yt,o as bt,t as xt}from"./card-CyHYmHue.js";import{t as St}from"./uuidv7-DAoOOpz9.js";import{n as Ct}from"./relativeTime-BYRt19mj.js";import{a as wt,i as Tt,l as Et,n as Dt,o as Ot,r as kt,s as At,t as jt}from"./alert-dialog-Ch0QxRsa.js";import{a as Mt,i as Nt,n as Pt,o as Ft,r as It,t as Lt}from"./dialog-BLj71-Nf.js";import{a as Rt,i as zt,n as Bt,r as Vt,t as Ht}from"./field-CdhSgWhI.js";import{t as Ut}from"./native-builds_.devices-B-u7uLLG.js";import{i as Z,o as Wt,r as Gt}from"./table-D8YjT_ht.js";import{a as Kt,c as qt,f as Jt,i as Yt,l as Xt,n as Zt,r as Qt,s as $t,t as en}from"./RelativeTime-B4PK8qDw.js";import{t as tn}from"./NativeBuildsNav-DaqxQPnG.js";import{a as nn,c as rn,i as an,l as on,n as sn,r as cn,s as ln}from"./IosInstall-CHI2C4Yd.js";var un=I(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Q=F(k()),dn=Q.createContext(void 0);function fn(e=!0){let t=Q.useContext(dn);if(t===void 0&&!e)throw Error(K(25));return t}var pn=Q.createContext(void 0);function mn(e){let t=Q.useContext(pn);if(t===void 0&&!e)throw Error(K(33));return t}var hn=Q.createContext(void 0);function gn(e){let t=Q.useContext(hn);if(t===void 0&&!e)throw Error(K(36));return t}function _n(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=fn(!0),d=u!==void 0;return Q.useMemo(()=>({id:r,role:`menuitem`,tabIndex:n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:_})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||d&&!De&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,a,o,s,u,d,c])}var vn={type:`regular-item`};function yn(e){let{closeOnClick:t,disabled:n=!1,highlighted:i,id:a,store:o,typingRef:s=o.context.typingRef,nativeButton:c,itemMetadata:l,nodeId:u}=e,f=Q.useRef(null),{getButtonProps:p,buttonRef:m}=d({disabled:n,focusableWhenDisabled:!0,native:c,composite:!0}),h=_n({closeOnClick:t,highlighted:i,id:a,nodeId:u,store:o,typingRef:s,itemRef:f,itemMetadata:l}),g=Q.useCallback(e=>r(h,{onMouseEnter(){l.type===`submenu-trigger`&&l.setActive()}},e,p),[h,p,l]),_=N(f,m);return Q.useMemo(()=>({getItemProps:g,itemRef:_}),[g,_])}var bn=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=ze({label:a}),f=mn(!0),p=W(i),{store:m}=gn(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=yn({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:vn});return Pe(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),$=l(),xn={...Se,...S},Sn=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=gn(),{side:c,align:l}=mn(),u=nt(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),ee=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`activeTriggerElement`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=v.type===`context-menu`;_e({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Q.useEffect(()=>{function e(e){s.setOpen(!1,j(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),je(b,{enabled:w&&!T&&!E&&v.type!==`menubar`,closeDelay:S});let ne=Q.useCallback(e=>{s.set(`popupElement`,e)},[s]),D=Pe(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:v.type===`menu`,instant:h},ref:[t,s.context.popupRef,ne],stateAttributesMapping:xn,props:[p,{onKeyDown(e){u&&te.has(e.key)&&e.stopPropagation()}},H(f),o,{"data-rootownerid":y}]}),O=v.type===void 0||E;return(_||v.type===`menubar`&&ee!==`outside-press`)&&(O=!0),(0,$.jsx)(g,{context:b,modal:E,disabled:!m,returnFocus:a===void 0?O:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:x,previousFocusableElement:C,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:D})}),Cn=Q.createContext(void 0);function wn(){let e=Q.useContext(Cn);if(e===void 0)throw Error(K(32));return e}var Tn=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=gn();return i.useState(`mounted`)||n?(0,$.jsx)(Cn.Provider,{value:n,children:(0,$.jsx)(R,{ref:t,...r})}):null}),En=Q.forwardRef(function(e,n){let{anchor:r,positionMethod:a=`absolute`,className:o,render:s,side:c,align:l,sideOffset:u=0,alignOffset:d=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:_=!1,collisionAvoidance:v=se,style:ee,...te}=e,{store:y}=gn(),b=wn(),x=fn(!0),S=y.useState(`parent`),C=y.useState(`floatingRootContext`),w=y.useState(`floatingTreeRoot`),T=y.useState(`mounted`),E=y.useState(`open`),ne=y.useState(`modal`),D=y.useState(`openMethod`),O=y.useState(`activeTriggerElement`),k=y.useState(`transitionStatus`),re=y.useState(`positionerElement`),A=y.useState(`instantType`),ie=y.useState(`hasViewport`),M=y.useState(`lastOpenChangeReason`),N=y.useState(`floatingNodeId`),ae=y.useState(`floatingParentNodeId`),F=C.useState(`domReferenceElement`),I=Q.useRef(null),oe=i(re,!1,!1),L=r,R=u,z=d,V=l,ce=v;S.type===`context-menu`&&(L=r??S.context?.anchor,V??=`start`,!c&&V!==`center`&&(z=e.alignOffset??2,R=e.sideOffset??-5));let H=c,le=V;S.type===`menu`?(H??=`inline-end`,le??=`start`,ce=e.collisionAvoidance??B):S.type===`menubar`&&(H??=`bottom`,le??=`start`);let U=S.type===`context-menu`,W=q({anchor:L,floatingRootContext:C,positionMethod:x?`fixed`:a,mounted:T,side:H,sideOffset:R,align:le,alignOffset:z,arrowPadding:U?0:m,collisionBoundary:f,collisionPadding:p,sticky:g,nodeId:N,keepMounted:b,disableAnchorTracking:_,collisionAvoidance:ce,shiftCrossAxis:U&&!(`side`in ce&&ce.side===`flip`),externalTree:w,adaptiveOrigin:ie?Oe:void 0});Q.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===N&&y.set(`hoverEnabled`,!1),e.nodeId!==N&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,j(h)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[y,w.events,N]),Q.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,j(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,y]);let G=ue();Q.useEffect(()=>{E||G.clear()},[E,G]),Q.useEffect(()=>{function e(e){if(!(!E||e.nodeId!==y.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=y.select(`closeDelay`);e>0?G.isStarted()||G.start(e,()=>{y.setOpen(!1,j(h))}):y.setOpen(!1,j(h))}else G.clear()}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,E,O,y,G]),Q.useEffect(()=>{let e={open:E,nodeId:N,parentNodeId:ae,reason:y.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,E,y,N,ae]),ge(()=>{let e=F,t=I.current;if(e&&(I.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return oe(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,oe,y]);let de={open:E,side:W.side,align:W.align,anchorHidden:W.anchorHidden,nested:S.type===`menu`,instant:A},fe=S.type===`menubar`&&S.context.modal;Qe(E&&(fe||ne&&M!==`trigger-hover`),D===`touch`,re,O);let pe=we(e,de,{styles:W.positionerStyles,transitionStatus:k,props:te,refs:[n,y.useStateSetter(`positionerElement`)],hidden:!T,inert:!E}),me=T&&S.type!==`menu`&&(S.type!==`menubar`&&ne&&M!==`trigger-hover`||S.type===`menubar`&&S.context.modal),he=null;return S.type===`menubar`?he=S.context.contentElement:S.type===void 0&&(he=O),(0,$.jsxs)(pn.Provider,{value:W,children:[me&&(0,$.jsx)(t,{ref:S.type===`context-menu`||S.type===`nested-context-menu`?S.context.internalBackdropRef:null,inert:be(!E),cutout:he}),(0,$.jsx)(P,{id:N,children:(0,$.jsx)(Be,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:pe})})]})}),Dn=Q.createContext(null);function On(e){let t=Q.useContext(Dn);if(t===null&&!e)throw Error(K(5));return t}var kn={...M,disabled:A(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:A(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:A(e=>e.openMethod),allowMouseEnter:A(e=>e.allowMouseEnter),stickIfOpen:A(e=>e.stickIfOpen),parent:A(e=>e.parent),rootId:A(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:A(e=>e.activeIndex),isActive:A((e,t)=>e.activeIndex===t),hoverEnabled:A(e=>e.hoverEnabled),instantType:A(e=>e.instantType),lastOpenChangeReason:A(e=>e.openChangeReason),floatingTreeRoot:A(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:A(e=>e.floatingNodeId),floatingParentNodeId:A(e=>e.floatingParentNodeId),itemProps:A(e=>e.itemProps),closeDelay:A(e=>e.closeDelay),hasViewport:A(e=>e.hasViewport),keyboardEventRelay:A(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},An=class e extends p{constructor(e){super({...jn(),...e},{positionerRef:Q.createRef(),popupRef:Q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),onOpenChangeComplete:void 0,triggerElements:new c},kn),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=C(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function jn(){return{...Fe(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new v,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:s,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var Mn=Q.createContext(void 0);function Nn(){return Q.useContext(Mn)}var Pn=J(function(e){let{children:t,open:n,onOpenChange:i,onOpenChangeComplete:c,defaultOpen:l=!1,disabled:d=!1,modal:p,loopFocus:h=!0,orientation:g=`vertical`,actionsRef:_,closeParentOnEsc:v=!1,handle:te,triggerId:y,defaultTriggerId:b=null,highlightItemOnHover:S=!0}=e,C=fn(!0),w=gn(!0),T=On(!0),E=Nn(),D=Q.useMemo(()=>E&&w?{type:`menu`,store:w.store}:T?{type:`menubar`,context:T}:C&&!w?{type:`context-menu`,context:C}:{type:void 0},[C,w,T,E]),k=An.useStore(te?.store,{open:l,openProp:n,activeTriggerId:b,triggerIdProp:y,parent:D});xe(()=>{n===void 0&&k.state.open===!1&&l===!0&&k.update({open:!0,activeTriggerId:b})}),k.useControlledProp(`openProp`,n),k.useControlledProp(`triggerIdProp`,y),k.useContextCallback(`onOpenChangeComplete`,c);let re=O(),A=O(),M=k.useState(`floatingTreeRoot`),N=m(M),P=ee(),F=k.useState(`open`),I=k.useState(`activeTriggerElement`),oe=k.useState(`positionerElement`),se=k.useState(`hoverEnabled`),R=k.useState(`disabled`),z=k.useState(`lastOpenChangeReason`),B=k.useState(`parent`),V=k.useState(`activeIndex`),ce=k.useState(`payload`),H=k.useState(`floatingParentNodeId`),U=Q.useRef(null),W=Q.useRef(B.type!==`context-menu`),G=ue(),de=Q.useRef(!0),fe=ue(),pe=H!=null,{openMethod:me,triggerProps:K}=o(F);k.useSyncedValues({disabled:d,modal:B.type===void 0?p:void 0,openMethod:me,rootId:re}),ae(k);let{forceUnmount:_e}=f(F,k,()=>{k.update({allowMouseEnter:!1,stickIfOpen:!0})});ge(()=>{C&&!w?k.update({parent:{type:`context-menu`,context:C},floatingNodeId:N,floatingParentNodeId:P}):w&&k.update({floatingNodeId:N,floatingParentNodeId:P})},[C,w,N,P,k]),Q.useEffect(()=>{if(F||(U.current=null),B.type===`context-menu`){if(!F){G.clear(),W.current=!1;return}G.start(500,()=>{W.current=!0})}},[G,F,B.type]),ge(()=>{!F&&!se&&k.set(`hoverEnabled`,!0)},[F,se,k]);let q=x((e,t)=>{let n=t.reason;if(F===e&&t.trigger===I&&z===n||(t.preventUnmountOnClose=()=>{k.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=I??void 0),i?.(e,t),t.isCanceled))return;k.state.floatingRootContext.dispatchOpenChange(e,t);let r=t.event;if(e===!1&&r?.type===`click`&&r.pointerType===`touch`&&!de.current)return;if(!e&&V!==null){let e=k.context.itemDomElements.current[V];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(de.current=!1,fe.start(300,()=>{de.current=!0})):(de.current=!0,fe.clear());let a=(n===`trigger-press`||n===`item-press`)&&r.detail===0&&r?.isTrusted,o=!e&&(n===`escape-key`||n==null),s={open:e,openChangeReason:n};U.current=t.event??null;let c=t.trigger?.id??null;(c||e)&&(s.activeTriggerId=c,s.activeTriggerElement=t.trigger??null),k.update(s),B.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?k.set(`instantType`,`group`):a||o?k.set(`instantType`,a?`click`:`dismiss`):k.set(`instantType`,void 0)}),J=ne({popupStore:k,floatingId:A,nested:P!=null,onOpenChange:q}),ve=J.context.events;Q.useEffect(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return ve.on(`setOpen`,e),()=>{ve?.off(`setOpen`,e)}},[ve,q]);let ye=Q.useCallback(()=>{k.setOpen(!1,j(he))},[k]);Q.useImperativeHandle(_,()=>({unmount:_e,close:ye}),[_e,ye]);let be;B.type===`context-menu`&&(be=B.context),Q.useImperativeHandle(be?.positionerRef,()=>oe,[oe]),Q.useImperativeHandle(be?.actionsRef,()=>({setOpen:q}),[q]);let Y=a(J,{enabled:!R,bubbles:{escapeKey:v&&B.type===`menu`},outsidePress(){return B.type!==`context-menu`||U.current?.type===`contextmenu`?!0:W.current},externalTree:pe?M:void 0}),Se=le(),Ce=Q.useCallback(e=>{k.select(`activeIndex`)!==e&&k.set(`activeIndex`,e)},[k]),X=Je(J,{enabled:!R,listRef:k.context.itemDomElements,activeIndex:V,nested:B.type!==void 0,loopFocus:h,orientation:g,parentOrientation:B.type===`menubar`?B.context.orientation:void 0,rtl:Se===`rtl`,disabledIndices:ie,onNavigate:Ce,openOnArrowKeyDown:B.type!==`context-menu`,externalTree:pe?M:void 0,focusItemOnHover:S}),we=Q.useCallback(e=>{k.context.typingRef.current=e},[k]),Te=Ye(J,{listRef:k.context.itemLabels,elementsRef:k.context.itemDomElements,activeIndex:V,resetMs:500,onMatch:e=>{F&&e!==V&&k.set(`activeIndex`,e)},onTyping:we});u(k,{floatingRootContext:J,activeTriggerProps:Q.useMemo(()=>{let e=r(Te.reference,X.reference,Y.reference,{onMouseMove(){k.set(`allowMouseEnter`,!0)}},K);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=F,e},[k,Te.reference,X.reference,Y.reference,K,F]),inactiveTriggerProps:Q.useMemo(()=>{let e=r(X.trigger,Y.trigger,K);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[X.trigger,Y.trigger,K]),popupProps:Q.useMemo(()=>r(Ne,{id:A,role:`menu`,"aria-labelledby":I?.id,onMouseMove(){k.set(`allowMouseEnter`,!0),B.type===`menu`&&k.set(`hoverEnabled`,!1)},onClick(){k.select(`hoverEnabled`)&&k.set(`hoverEnabled`,!1)},onKeyDown(e){let t=k.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Te.floating,X.floating,Y.floating),[I,A,B.type,k,Te.floating,X.floating,Y.floating]),itemProps:X.item??s});let Ee=Q.useMemo(()=>({store:k,parent:D}),[k,D]),De=(0,$.jsx)(hn.Provider,{value:Ee,children:typeof t==`function`?t({payload:ce}):t});return B.type===void 0||B.type===`context-menu`?(0,$.jsx)(L,{externalTree:M,children:De}):De});function Fn(e){if(b(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!re(e))return Fn(E(e))}var In=F(y());function Ln(e,t){let r=Q.useRef(null);function i(t){In.flushSync(()=>{e.setOpen(!1,j(n,t.nativeEvent,t.currentTarget))}),ye(r.current)?.focus()}function a(r){let i=e.select(`positionerElement`);if(i&&X(r,i))e.context.beforeContentFocusGuardRef.current?.focus();else{In.flushSync(()=>{e.setOpen(!1,j(n,r.nativeEvent,r.currentTarget))});let a=Te(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&D(i,a);){let e=a;if(a=U(a),a===e)break}a?.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:i,handleFocusTargetFocus:a}}function Rn(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Q.useRef(!1);return Q.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,ke(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:s,[t,n,r])}var zn=2,Bn=me(function(e,t){let{render:n,className:i,style:a,disabled:o=!1,nativeButton:c=!0,id:l,openOnHover:u,delay:f=100,closeDelay:p=0,handle:h,payload:g,..._}=e,te=gn(!0),y=h?.store??te?.store;if(!y)throw Error(K(85));let b=W(l),S=y.useState(`isTriggerActive`,b),C=y.useState(`floatingRootContext`),E=y.useState(`isOpenedByTrigger`,b),ne=y.useState(`triggerPopupId`,b),O=Q.useRef(null),k=Hn(),re=w(!0),A=Ce(),j=Q.useMemo(()=>A??new v,[A]),{registerTrigger:ie,isMountedByThisTrigger:M}=T(b,O,y,{payload:g,closeDelay:p,parent:k,floatingTreeRoot:j,floatingNodeId:m(j),floatingParentNodeId:ee(),keyboardEventRelay:re?.relayKeyboardEvent}),N=k.type===`menubar`,ae=y.useState(`disabled`),P=o||ae||N&&k.context.disabled,{getButtonProps:F,buttonRef:I}=d({disabled:P,native:c});Q.useEffect(()=>{!E&&k.type===void 0&&(y.context.allowMouseUpTriggerRef.current=!1)},[y,E,k.type]);let L=Q.useRef(null),se=ue(),R=x(e=>{if(!L.current)return;se.clear(),y.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(D(L.current,t)||D(y.select(`positionerElement`),t)||t===L.current||t!=null&&Fn(t)===y.select(`rootId`))return;let n=it(L.current);e.clientX>=n.left-zn&&e.clientX<=n.right+zn&&e.clientY>=n.top-zn&&e.clientY<=n.bottom+zn||j.events.emit(`close`,{domEvent:e,reason:Me})});Q.useEffect(()=>{E&&y.select(`lastOpenChangeReason`)===`trigger-hover`&&ke(L.current).addEventListener(`mouseup`,R,{once:!0})},[E,R,y]);let z=N&&k.context.hasSubmenuOpen,B=ce(C,{enabled:(u??z)&&!P&&k.type!==`context-menu`&&(!N||z&&!M),handleClose:de({blockPointerEvents:!N}),mouseOnly:!0,move:!1,restMs:k.type===void 0?f:void 0,delay:{close:p},triggerElementRef:O,externalTree:j,isActiveTrigger:S,isClosing:()=>y.select(`transitionStatus`)===`ending`}),V=Vn(E,y.select(`lastOpenChangeReason`)),H=oe(C,{enabled:!P&&k.type!==`context-menu`,event:E&&N?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:k.type===void 0?V:!1}),le=Ie(C,{enabled:!P&&z}),U=Rn({open:E,enabled:N,mouseDownAction:`open`}),G=Q.useMemo(()=>r(le.reference,H.reference),[le.reference,H.reference]),fe=y.useState(`triggerProps`,M),{preFocusGuardRef:me,handlePreFocusGuardFocus:he,handleFocusTargetFocus:ge}=Ln(y,O),_e={disabled:P,open:E},q=[L,t,I,ie,O],J=[G,B??s,fe,{"aria-haspopup":`menu`,"aria-controls":ne,id:b,onMouseDown:e=>{y.select(`open`)||(se.start(200,()=>{y.context.allowMouseUpTriggerRef.current=!0}),ke(e.currentTarget).addEventListener(`mouseup`,R,{once:!0}))}},N?{role:`menuitem`}:{},U,_,F],ye=Pe(`button`,e,{enabled:!N,stateAttributesMapping:ve,state:_e,ref:q,props:J});return N?(0,$.jsx)(ct,{tag:`button`,render:n,className:i,style:a,state:_e,refs:q,props:J,stateAttributesMapping:ve}):E?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(pe,{ref:me,onFocus:he},`${b}-pre-focus-guard`),(0,$.jsx)(Q.Fragment,{children:ye},b),(0,$.jsx)(pe,{ref:y.context.triggerFocusTargetRef,onFocus:ge},`${b}-post-focus-guard`)]}):(0,$.jsx)(Q.Fragment,{children:ye},b)});function Vn(e,t){let n=ue(),[r,i]=Q.useState(!1);return ge(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Hn(){let e=fn(!0),t=gn(!0),n=On(!0);return Q.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var Un=F(Ct(),1);function Wn({...e}){return(0,$.jsx)(Pn,{"data-slot":`dropdown-menu`,...e})}function Gn({...e}){return(0,$.jsx)(Bn,{"data-slot":`dropdown-menu-trigger`,...e})}function Kn({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,$.jsx)(Tn,{children:(0,$.jsx)(En,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,$.jsx)(Sn,{"data-slot":`dropdown-menu-content`,className:Ae(`dark z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function qn({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(bn,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Ae(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Jn({className:e,...t}){return(0,$.jsx)(Ee,{"data-slot":`dropdown-menu-separator`,className:Ae(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var Yn={pending:`Requested`,approved:`Approved`,registered:`Registered`},Xn={pending:`warning`,approved:`secondary`,registered:`muted`},Zn=`all`,Qn=6,$n=()=>window.location.pathname.endsWith(`/native-builds/devices`)?window.location.pathname.slice(0,-He.length):qe(window.location,``),er=(e,t)=>({approve:t.canApprove&&e.status===`pending`,rename:t.canApprove,remove:t.canApprove,withdraw:!t.canApprove&&e.status===`pending`&&e.requested_by===t.email}),tr=e=>e.status===`approved`&&e.apple_error!==null,nr=e=>e.requested_by??`Added from a terminal`;function rr({device:e}){return e.apple_error===null?null:(0,$.jsx)(`span`,{className:`max-w-64 text-xs whitespace-normal text-muted-foreground`,children:e.apple_error})}function ir({device:e,withError:t=!0}){return(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 flex-col items-start gap-1`,children:[tr(e)?(0,$.jsx)(_t,{variant:`warning`,children:`Apple refused`}):(0,$.jsx)(_t,{variant:Xn[e.status],children:Yn[e.status]}),t?(0,$.jsx)(rr,{device:e}):null]})}function ar({device:e}){if(e.build_id===null)return(0,$.jsx)(Ge,{});let t=`A build`;try{t=`Build of ${(0,Un.default)(St(e.build_id)).format(`MMM D`)}`}catch{}return(0,$.jsx)(Le,{className:`text-xs font-medium underline-offset-4 hover:underline`,params:{buildId:e.build_id},to:`/native-builds/$buildId`,children:t})}function or({device:e,viewer:t,onOpen:n}){let r=er(e,t);return!r.approve&&!r.rename&&!r.remove&&!r.withdraw?null:(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[r.approve?(0,$.jsxs)(G,{className:`h-11 sm:h-8`,onClick:()=>n({kind:`approve`,device:e}),size:`sm`,children:[(0,$.jsx)(Re,{"data-icon":`inline-start`}),`Approve`]}):null,r.withdraw?(0,$.jsx)(G,{className:`h-11 sm:h-8`,onClick:()=>n({kind:`remove`,device:e}),size:`sm`,variant:`outline`,children:`Withdraw`}):null,r.rename||r.remove?(0,$.jsxs)(Wn,{children:[(0,$.jsx)(Gn,{render:(0,$.jsx)(G,{"aria-label":`More actions for ${e.name}`,className:`size-11 sm:size-8`,size:`icon-sm`,variant:`ghost`}),children:(0,$.jsx)(un,{"aria-hidden":`true`})}),(0,$.jsxs)(Kn,{align:`end`,children:[(0,$.jsxs)(qn,{onClick:()=>n({kind:`rename`,device:e}),children:[(0,$.jsx)(st,{"aria-hidden":`true`}),`Rename`]}),(0,$.jsx)(Jn,{}),(0,$.jsxs)(qn,{onClick:()=>n({kind:`remove`,device:e}),variant:`destructive`,children:[(0,$.jsx)(dt,{"aria-hidden":`true`}),e.status===`pending`?`Decline`:`Remove`]})]})]}):null]})}function sr({device:e,viewer:t,onOpen:n}){return(0,$.jsxs)(Wt,{children:[(0,$.jsx)(Gt,{className:`font-medium`,children:e.name}),(0,$.jsx)(Gt,{children:(0,$.jsx)(`span`,{className:`font-mono text-xs`,title:e.udid,translate:`no`,children:Ke(e.udid)})}),(0,$.jsx)(Gt,{className:`text-xs`,children:e.requested_by??(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:nr(e)})}),(0,$.jsx)(Gt,{children:(0,$.jsx)(ir,{device:e})}),(0,$.jsx)(Gt,{className:`text-xs`,children:(0,$.jsx)(en,{ms:e.created_at_ms})}),(0,$.jsx)(Gt,{children:(0,$.jsx)(ar,{device:e})}),(0,$.jsx)(Gt,{className:`text-right`,children:(0,$.jsx)(or,{device:e,onOpen:n,viewer:t})})]})}function cr({device:e,viewer:t,onOpen:n}){return(0,$.jsxs)(Zt,{className:`cursor-default gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,translate:`no`,children:Ke(e.udid)})]}),(0,$.jsx)(ir,{device:e,withError:!1})]}),(0,$.jsx)(rr,{device:e}),(0,$.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:nr(e)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsx)(en,{ms:e.created_at_ms}),e.build_id===null?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsx)(ar,{device:e})]})]}),(0,$.jsx)(or,{device:e,onOpen:n,viewer:t})]})}function lr({target:e,onClose:t}){let n=cn(),r=rn(),i=e.kind===`approve`?n:r,[a,o]=(0,Q.useState)(e.device.name),s=a.trim();return(0,$.jsx)(Lt,{onOpenChange:e=>e?null:t(),open:!0,children:(0,$.jsxs)(Pt,{children:[(0,$.jsxs)(Mt,{children:[(0,$.jsx)(Ft,{children:e.kind===`approve`?`Approve ${e.device.name}?`:`Rename ${e.device.name}`}),(0,$.jsx)(It,{children:e.kind===`approve`?`The next ad hoc build registers this iPhone with your Apple account. Each new iPhone uses one of the account's 100 a year, and removing it never gives the slot back.`:`The registry shows this name. The next ad hoc build doesn't rename it at Apple.`})]}),(0,$.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),s!==``&&i.mutate({id:e.device.id,name:s},{onSuccess:t})},children:[(0,$.jsxs)(zt,{children:[e.kind===`approve`?(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Requested by`}),(0,$.jsx)(`dd`,{className:`truncate`,children:e.device.requested_by??`Terminal (CLI)`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`UDID`}),(0,$.jsx)(`dd`,{className:`font-mono text-xs break-all select-all`,translate:`no`,children:e.device.udid})]}):null,(0,$.jsxs)(Ht,{"data-invalid":i.isError||void 0,children:[(0,$.jsx)(Rt,{htmlFor:`ios-device-dialog-name`,children:`Name`}),(0,$.jsx)(z,{autoComplete:`off`,id:`ios-device-dialog-name`,maxLength:100,onChange:e=>o(e.target.value),value:a}),e.kind===`approve`?(0,$.jsx)(Bt,{children:`The iPhone's ID comes from the person who asked. Approve devices you recognize.`}):null,(0,$.jsx)(Vt,{children:i.isError?`Couldn't ${e.kind===`approve`?`approve`:`rename`} ${e.device.name}. Check your connection and try again.`:null})]})]}),(0,$.jsx)(Nt,{className:`mt-4`,children:(0,$.jsxs)(G,{className:`h-11 sm:h-8`,disabled:s===``||i.isPending,type:`submit`,children:[i.isPending?(0,$.jsx)(ot,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,$.jsx)(Re,{"data-icon":`inline-start`}),e.kind===`approve`?`Approve`:`Rename`]})})]})]})})}function ur({device:e,viewer:t,onClose:n}){let r=ln(),i=!t.canApprove,a=e.status===`pending`;return(0,$.jsx)(jt,{onOpenChange:e=>e?null:n(),open:!0,children:(0,$.jsxs)(Tt,{children:[(0,$.jsxs)(At,{children:[(0,$.jsx)(Et,{children:i?`Withdraw ${e.name}?`:a?`Decline ${e.name}?`:`Remove ${e.name}?`}),(0,$.jsx)(wt,{children:a?`It leaves the list. Its owner can request it again.`:`It leaves the list. New ad hoc builds keep it until it's disabled at Apple.`})]}),a||!t.canApprove?null:(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col text-xs text-muted-foreground [&_code]:break-words [&_code]:whitespace-normal`,children:(0,$.jsx)(Ve,{label:`the command that disables it`,value:`npx hot-updater native-build devices remove --udid ${e.udid}`,wrap:!0})}),r.isError?(0,$.jsxs)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:[`Couldn't `,i?`withdraw`:a?`decline`:`remove`,` `,e.name,`. Check your connection and try again.`]}):null,(0,$.jsxs)(Ot,{children:[(0,$.jsx)(kt,{disabled:r.isPending,children:`Cancel`}),(0,$.jsxs)(Dt,{disabled:r.isPending,onClick:t=>{t.preventDefault(),r.mutate({udid:e.udid},{onSuccess:n})},variant:`destructive`,children:[r.isPending?(0,$.jsx)(ot,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):null,i?`Withdraw`:a?`Decline`:`Remove`]})]})]})})}function dr({status:e,secretName:t}){return(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:e===`local-console`?`iPhones register through your hosted Console: an iPhone can't reach this computer's.`:`Set ${t} on this Console to register iPhones.`})}function fr({view:t,devices:n}){let r=sn(),[i,a]=(0,Q.useState)(null),o=i??t?.defaultName??``,[s,c]=(0,Q.useState)(o);(0,Q.useEffect)(()=>{let e=setTimeout(()=>c(o.trim()),400);return()=>clearTimeout(e)},[o]);let l=r?.ios===!0,u=an({mode:`register`,name:s||`iPhone`},l&&t?.registration===`ready`),d=r===null||window.location.protocol===`https:`,f=r?.requested&&r.udid!==null?n?.find(e=>e.udid===r.udid?.toLowerCase()):void 0,p=r===null?(0,$.jsx)(e,{"aria-label":`Loading`,className:`h-36 w-full`}):f===void 0?t!==void 0&&(t.registration===`local-console`||t.registration===`no-secret`)?(0,$.jsx)(dr,{secretName:t.secretName,status:t.registration}):l?d?u.data?.status===`local-console`?(0,$.jsx)(dr,{status:`local-console`}):u.data?.status===`no-secret`?(0,$.jsx)(dr,{secretName:u.data.secretName,status:`no-secret`}):(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(Ht,{children:[(0,$.jsx)(Rt,{htmlFor:`ios-device-register-name`,children:`This iPhone's name`}),(0,$.jsx)(z,{autoComplete:`off`,className:`h-11`,id:`ios-device-register-name`,maxLength:100,onChange:e=>a(e.target.value),value:o})]}),u.data?.status===`issued`&&s===o.trim()?(0,$.jsxs)(`a`,{className:V({className:`h-auto min-h-11 w-full whitespace-normal`}),href:Ue($n(),u.data.token),children:[(0,$.jsx)(ut,{"data-icon":`inline-start`}),`Install profile`]}):(0,$.jsx)(e,{"aria-label":`Preparing the profile`,className:`h-11 w-full`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Safari only. Allow the download, then install it in Settings, where iOS calls it not signed. Safari comes back here, and nothing stays installed.`})]}):(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:`iPhones need this Console on HTTPS.`}):(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-4 sm:flex-row sm:items-center`,children:[(0,$.jsx)(on,{className:`size-36 shrink-0`,label:`Open this page on an iPhone`,value:`${window.location.origin}${$n()}${He}`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:`Open this page on the iPhone, in Safari.`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It installs a profile that reads the iPhone's ID, then lists the iPhone here as requested. Nothing stays installed.`})]})]}):(0,$.jsxs)(`p`,{className:`text-sm`,role:`status`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:f.name}),` ·`,` `,Yn[f.status],`.`,` `,f.status===`pending`?`A maintainer approves it next, and it joins the next ad hoc build.`:`It joins the next ad hoc build.`]});return(0,$.jsxs)(xt,{className:`shadow-sm`,children:[(0,$.jsx)(vt,{className:`border-b px-4 py-3`,children:(0,$.jsx)(bt,{className:`text-sm`,children:(0,$.jsx)(`h2`,{children:`Register an iPhone`})})}),(0,$.jsx)(yt,{className:`p-4 sm:p-6`,children:p})]})}function pr({search:e,onSearchChange:t}){let n=fe(),r=nn(e.status),i=r.data,a=i?.devices,[o,s]=(0,Q.useState)(null),c=()=>s(null),l=(0,$.jsx)($t,{icon:ut,title:e.status===void 0?`No iPhones yet`:`No ${Yn[e.status].toLowerCase()} iPhones`,children:e.status===void 0?(0,$.jsx)(`p`,{children:`Open this page on an iPhone to register it.`}):(0,$.jsx)(G,{className:`h-11 sm:h-8`,onClick:()=>t({}),size:`sm`,variant:`outline`,children:`Show all`})});return(0,$.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-background px-3 py-3 sm:min-h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,$.jsx)(Y,{className:`-ml-1 size-11 lg:size-7`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(at,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`text-sm font-medium`,children:`Native builds`})]}),(0,$.jsx)(`p`,{className:`basis-full pl-12 text-xs text-muted-foreground sm:basis-auto sm:pl-0`,children:`The iPhones and iPads ad hoc builds install on. Android needs none.`})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:[(0,$.jsx)(tn,{current:`devices`}),(0,$.jsx)(fr,{devices:a,view:i}),i!==void 0&&!i.viewer.approversConfigured?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:`Nobody approves in this Console. Approve from a terminal:`}),(0,$.jsx)(Ve,{label:`the approve command`,value:We})]}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(rt,{items:[{label:`All statuses`,value:Zn},...Object.keys(Yn).map(e=>({label:Yn[e],value:e}))],onValueChange:e=>t(e===null||e===Zn?{}:{status:e}),value:e.status??Zn,children:[(0,$.jsx)(Xe,{"aria-label":`Status`,className:`min-w-0 flex-1 text-xs data-[size=default]:h-11 sm:w-44 sm:flex-none sm:data-[size=default]:h-8`,children:(0,$.jsx)(et,{})}),(0,$.jsx)($e,{children:(0,$.jsxs)(tt,{children:[(0,$.jsx)(Ze,{value:Zn,children:`All statuses`}),Object.keys(Yn).map(e=>(0,$.jsx)(Ze,{value:e,children:Yn[e]},e))]})})]}),(0,$.jsx)(G,{"aria-label":`Refresh iOS devices`,className:`ml-auto size-11 sm:size-7`,disabled:r.isFetching,onClick:()=>void r.refetch(),size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(lt,{"aria-hidden":`true`})})]}),r.isError?(0,$.jsxs)(mt,{variant:`destructive`,children:[(0,$.jsx)(ht,{}),(0,$.jsx)(ft,{children:`iOS devices couldn't be loaded`}),(0,$.jsx)(pt,{children:`Check your connection and try again.`}),(0,$.jsx)(gt,{children:(0,$.jsxs)(G,{onClick:()=>void r.refetch(),size:`xs`,variant:`outline`,children:[(0,$.jsx)(lt,{"data-icon":`inline-start`}),`Retry`]})})]}):(0,$.jsx)(qt,{children:n?(0,$.jsx)(`div`,{"aria-busy":r.isPlaceholderData,"aria-label":`iOS devices`,className:`aria-busy:opacity-60`,role:`list`,children:r.isLoading?(0,$.jsx)(Qt,{label:`Loading iOS devices`}):a?.length===0?(0,$.jsx)(Yt,{children:l}):a?.map(e=>(0,$.jsx)(`div`,{className:`border-b last:border-b-0`,role:`listitem`,children:(0,$.jsx)(cr,{device:e,onOpen:s,viewer:i.viewer})},e.id))}):(0,$.jsx)(Kt,{"aria-busy":r.isPlaceholderData,"aria-label":`iOS devices`,className:`aria-busy:opacity-60`,header:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{children:`Name`}),(0,$.jsx)(Z,{children:`UDID`}),(0,$.jsx)(Z,{children:`Requested by`}),(0,$.jsx)(Z,{children:`Status`}),(0,$.jsx)(Z,{children:`Added`}),(0,$.jsx)(Z,{children:`Build`}),(0,$.jsx)(Z,{className:`text-right`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:r.isLoading?(0,$.jsx)(Jt,{columns:Qn+1,label:`Loading iOS devices`}):a?.length===0?(0,$.jsx)(Xt,{columns:Qn+1,children:l}):a?.map(e=>(0,$.jsx)(sr,{device:e,onOpen:s,viewer:i.viewer},e.id))})})]}),o!==null&&o.kind!==`remove`?(0,$.jsx)(lr,{onClose:c,target:o},o.device.id):null,o?.kind===`remove`&&i!==void 0?(0,$.jsx)(ur,{device:o.device,onClose:c,viewer:i.viewer},o.device.id):null]})}function mr(){let e=Ut.useSearch(),t=Ut.useNavigate();return(0,$.jsx)(pr,{onSearchChange:e=>void t({search:e,replace:!0}),search:e})}export{mr as component};
@@ -1 +1 @@
1
- import{Di as e}from"./sidebar-yC7KdImc.js";import{n as t,t as n}from"./remote-config-CGbqsPh_.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};
1
+ import{Di as e}from"./sidebar-yC7KdImc.js";import{n as t,t as n}from"./remote-config-DXv25LX1.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 @@
1
+ import{t as e}from"./ConsoleFeatureUnavailable-Be-0iTww.js";var t=e;export{t as notFoundComponent};
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-B3oq9qR0.js","assets/ConsoleFeatureUnavailable-cy_snb33.js","assets/sidebar-yC7KdImc.js","assets/console-features-api-BO5V64P3.js","assets/arrow-up-right-BFafIOrq.js","assets/NotFoundPage-DDOJarFa.js","assets/link-CN3iHC4A.js","assets/empty-DsbLxQ1w.js","assets/remote-config-D1OkfQKt.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,Bn as t,Br as n,Di as r,Er as i,Hr as a,Mr as o,Oi as s,Ri as c,Si as l,Sn as u,Sr as d,Vi as f,Vr as p,Z as m,di as h,ft as g,gr as _,kr as v,p as y,vr as b,wi as x,xr as S,yr as C,zr as w}from"./sidebar-yC7KdImc.js";import{i as T,n as ee,r as te,t as E}from"./preload-helper-CRQjUQaZ.js";import{t as D}from"./useMutation-w3qYaU2L.js";import{r as O}from"./console-features-api-BO5V64P3.js";import{t as k}from"./arrow-right-CXp_K3xK.js";import{i as ne}from"./useCompositeListItem-lAmUsXcc.js";import{a as re,i as A,n as ie,o as j,r as ae,s as oe,t as se}from"./select-CA8r-UUe.js";import{t as ce}from"./clipboard-DZrZK5gR.js";import{t as le}from"./git-branch-ByZMEBxZ.js";import{t as ue}from"./history-wYnPoVmT.js";import{t as de}from"./loader-circle-GWIgH0fo.js";import{n as fe,t as pe}from"./CompositeItem-Dy4xgOMg.js";import{t as M}from"./plus-Cx-yFNd9.js";import{t as me}from"./refresh-cw-BgiOaFX3.js";import{i as he,n as ge,o as _e,r as ve,s as ye,t as be}from"./input-group-B7jx0icS.js";import{t as xe}from"./search-DiOSjaYL.js";import{i as Se,n as N,r as Ce,t as we}from"./switch-BTHWmKQ5.js";import{t as Te}from"./smartphone-CxP0GGT6.js";import{t as Ee}from"./trash-2-CYISg7ZF.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./badge-DJMW4YVM.js";import{t as De}from"./undo-2-Bod3vw7x.js";import{n as B}from"./dist-Bw_uSBJn.js";import{a as Oe,n as ke,o as Ae,r as je,t as Me}from"./card-C4sBAMU-.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,t as Re}from"./empty-DsbLxQ1w.js";import{n as ze,t as Be}from"./relativeTime-CBmDq8wh.js";import{i as Ve,n as He,o as Ue,r as We,t as Ge}from"./tabs-CHNnCyvw.js";import{a as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e}from"./alert-dialog-CLC_h1fL.js";import{t as et}from"./PlatformIcon-BBvlg6JY.js";import{a as tt,i as nt,n as rt,o as it,r as at,t as V}from"./dialog-tCTZmAo8.js";import{a as H,i as ot,n as st,o as ct,r as U,s as lt,t as W}from"./field-DL4OXTJ7.js";import{i as ut}from"./api-DLryz9hA.js";var dt=p(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ft=p(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),pt=p(`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`}]]),mt=p(`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`}]]),ht=p(`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=f(c()),K=r(),gt=f(ze(),1),_t=f(Be(),1),vt=x({method:`GET`}).middleware([w]).handler(s(`0ccfae64b399b03d820328fa98a38e2caa0b622d3da5a7ca633c5a0e8101e3f6`)),yt=x({method:`GET`}).middleware([w]).handler(s(`3377db68b9d1d971971595469029c0466da0777a177b294d655cd0c039737f1a`)),bt=x({method:`GET`}).middleware([w]).handler(s(`af71e3c55a659ce46093e33b9d70e729359610eec7d576502e8f0e26c785b317`)),xt=x({method:`POST`}).middleware([w]).handler(s(`4182bf9ccbb675700638f30bc6122517ccd90b16a339a6823a0f5f6c808d70a6`)),St=x({method:`POST`}).middleware([w]).handler(s(`98c10bdc514eb4d3fe65af546be44452b492a81092cfe45625778a4c9f731727`)),Ct=x({method:`POST`}).middleware([w]).handler(s(`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]},wt=()=>a({queryKey:q.active,queryFn:()=>vt(),staleTime:6e4}),Tt=({enabled:e})=>ee({queryKey:q.versions,queryFn:({pageParam:e})=>yt({data:e===void 0?{}:{cursor:e}}),initialPageParam:void 0,getNextPageParam:e=>e.next,staleTime:6e4,enabled:e}),Et=e=>a({queryKey:q.version(e??0),queryFn:()=>bt({data:{version:e}}),enabled:e!==null,staleTime:1/0}),Dt=()=>{let e=l();return async()=>{await Promise.all([e.invalidateQueries({queryKey:q.active}),e.invalidateQueries({queryKey:q.versions})])}},Ot=()=>{let e=Dt();return D({mutationFn:e=>xt({data:e}),onSuccess:async t=>{(t.status===`published`||t.status===`conflict`)&&await e()}})},kt=()=>D({mutationFn:e=>St({data:e}),onSuccess:Dt()}),At=e=>a({queryKey:q.preview(e),queryFn:()=>Ct({data:e}),placeholderData:h,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,jt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Mt=(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)}},Nt=(e,t)=>({...e,parameters:Object.fromEntries(Object.entries(e.parameters).filter(([e])=>e!==t))}),Pt=(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)}]})),Ft=(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:Pt(e,e=>e===t?n.name:e)},It=(e,t)=>({conditions:e.conditions.filter(e=>e.name!==t),parameters:Pt(e,e=>e===t?null:e)}),Lt=(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}},Rt=(e,t)=>Object.entries(e.parameters).filter(([,e])=>X(e.conditionalValues,t)!==void 0).map(([e])=>e),zt=(e,t=3)=>e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} +${e.length-t}`,Bt=e=>Number.isInteger(e)?String(e):e.toFixed(1),Vt=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))},Ht=Vt(`UTC`),Ut=(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()}]},Wt=(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)}]},Gt=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())}`},Kt=e=>{if(e.length===0)return;let t=new Date(e).getTime();return Number.isFinite(t)?new Date(t).toISOString():void 0},qt=(e,t=Ht)=>{switch(e.type){case`platform`:return`Platform is ${zt(e.platforms.map(e=>e===`ios`?`iOS`:`Android`))}`;case`channel`:return`Channel is ${zt(e.channels)}`;case`appVersion`:return`App version ${e.range}`;case`cohort`:return`Cohort is ${zt(e.cohorts)}`;case`percent`:return e.from===0?`${Bt(e.to)}% of installs`:`${Bt(e.from)}–${Bt(e.to)}% of installs`;case`fingerprint`:return`Fingerprint is ${zt(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`,Jt=()=>{let e=crypto.getRandomValues(new Uint8Array(6));return Array.from(e,e=>e.toString(36).padStart(2,`0`)).join(``).slice(0,8)},Yt=(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))}),Xt=(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:Yt(e.parameters,t.parameters),conditions:Yt(n(e),n(t)),reordered:r(e,t).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-DAOyn5xL.js","assets/ConsoleFeatureUnavailable-Be-0iTww.js","assets/sidebar-yC7KdImc.js","assets/console-features-api-BO5V64P3.js","assets/arrow-up-right-BFafIOrq.js","assets/NotFoundPage-CVBtl68B.js","assets/link-CN3iHC4A.js","assets/empty--YaE5Z4p.js","assets/remote-config-Cxkr7_BP.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,Bn as t,Br as n,Di as r,Er as i,Hr as a,Mr as o,Oi as s,Ri as c,Si as l,Sn as u,Sr as d,Vi as f,Vr as p,Z as m,di as h,ft as g,gr as _,kr as v,p as y,vr as b,wi as x,xr as S,yr as C,zr as w}from"./sidebar-yC7KdImc.js";import{i as T,n as ee,r as te,t as E}from"./preload-helper-CRQjUQaZ.js";import{t as D}from"./useMutation-w3qYaU2L.js";import{r as O}from"./console-features-api-BO5V64P3.js";import{t as k}from"./arrow-right-CXp_K3xK.js";import{i as ne}from"./useCompositeListItem-lAmUsXcc.js";import{a as re,i as A,n as ie,o as j,r as ae,s as oe,t as se}from"./select-CA8r-UUe.js";import{t as ce}from"./clipboard-DZrZK5gR.js";import{t as le}from"./git-branch-DG1VDaKq.js";import{t as ue}from"./history-C0wv4htz.js";import{t as de}from"./loader-circle-iMqC-8ZE.js";import{n as fe,t as pe}from"./CompositeItem-KUM5yQVr.js";import{t as M}from"./plus-Db0KxLZp.js";import{t as me}from"./refresh-cw-BHhBYjS8.js";import{i as he,n as ge,o as _e,r as ve,s as ye,t as be}from"./input-group-XKLcUGoa.js";import{t as xe}from"./search-dJG2BYmx.js";import{i as Se,n as N,r as Ce,t as we}from"./switch-BsV3d4km.js";import{t as Te}from"./smartphone-D1C6BRd_.js";import{t as Ee}from"./trash-2-B5KIvrXy.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./badge-FZMD5vvS.js";import{t as De}from"./undo-2-CFcU9dIB.js";import{n as B}from"./dist-DAM__Tdz.js";import{a as Oe,n as ke,o as Ae,r as je,t as Me}from"./card-CyHYmHue.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,t as Re}from"./empty--YaE5Z4p.js";import{n as ze,t as Be}from"./relativeTime-BYRt19mj.js";import{i as Ve,n as He,o as Ue,r as We,t as Ge}from"./tabs-RdhEl9sE.js";import{a as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e}from"./alert-dialog-Ch0QxRsa.js";import{t as et}from"./PlatformIcon-DVnzzGqM.js";import{a as tt,i as nt,n as rt,o as it,r as at,t as V}from"./dialog-BLj71-Nf.js";import{a as H,i as ot,n as st,o as ct,r as U,s as lt,t as W}from"./field-CdhSgWhI.js";import{i as ut}from"./api-C1OPeiG1.js";var dt=p(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ft=p(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),pt=p(`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`}]]),mt=p(`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`}]]),ht=p(`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=f(c()),K=r(),gt=f(ze(),1),_t=f(Be(),1),vt=x({method:`GET`}).middleware([w]).handler(s(`0ccfae64b399b03d820328fa98a38e2caa0b622d3da5a7ca633c5a0e8101e3f6`)),yt=x({method:`GET`}).middleware([w]).handler(s(`3377db68b9d1d971971595469029c0466da0777a177b294d655cd0c039737f1a`)),bt=x({method:`GET`}).middleware([w]).handler(s(`af71e3c55a659ce46093e33b9d70e729359610eec7d576502e8f0e26c785b317`)),xt=x({method:`POST`}).middleware([w]).handler(s(`4182bf9ccbb675700638f30bc6122517ccd90b16a339a6823a0f5f6c808d70a6`)),St=x({method:`POST`}).middleware([w]).handler(s(`98c10bdc514eb4d3fe65af546be44452b492a81092cfe45625778a4c9f731727`)),Ct=x({method:`POST`}).middleware([w]).handler(s(`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]},wt=()=>a({queryKey:q.active,queryFn:()=>vt(),staleTime:6e4}),Tt=({enabled:e})=>ee({queryKey:q.versions,queryFn:({pageParam:e})=>yt({data:e===void 0?{}:{cursor:e}}),initialPageParam:void 0,getNextPageParam:e=>e.next,staleTime:6e4,enabled:e}),Et=e=>a({queryKey:q.version(e??0),queryFn:()=>bt({data:{version:e}}),enabled:e!==null,staleTime:1/0}),Dt=()=>{let e=l();return async()=>{await Promise.all([e.invalidateQueries({queryKey:q.active}),e.invalidateQueries({queryKey:q.versions})])}},Ot=()=>{let e=Dt();return D({mutationFn:e=>xt({data:e}),onSuccess:async t=>{(t.status===`published`||t.status===`conflict`)&&await e()}})},kt=()=>D({mutationFn:e=>St({data:e}),onSuccess:Dt()}),At=e=>a({queryKey:q.preview(e),queryFn:()=>Ct({data:e}),placeholderData:h,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,jt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Mt=(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)}},Nt=(e,t)=>({...e,parameters:Object.fromEntries(Object.entries(e.parameters).filter(([e])=>e!==t))}),Pt=(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)}]})),Ft=(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:Pt(e,e=>e===t?n.name:e)},It=(e,t)=>({conditions:e.conditions.filter(e=>e.name!==t),parameters:Pt(e,e=>e===t?null:e)}),Lt=(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}},Rt=(e,t)=>Object.entries(e.parameters).filter(([,e])=>X(e.conditionalValues,t)!==void 0).map(([e])=>e),zt=(e,t=3)=>e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} +${e.length-t}`,Bt=e=>Number.isInteger(e)?String(e):e.toFixed(1),Vt=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))},Ht=Vt(`UTC`),Ut=(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()}]},Wt=(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)}]},Gt=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())}`},Kt=e=>{if(e.length===0)return;let t=new Date(e).getTime();return Number.isFinite(t)?new Date(t).toISOString():void 0},qt=(e,t=Ht)=>{switch(e.type){case`platform`:return`Platform is ${zt(e.platforms.map(e=>e===`ios`?`iOS`:`Android`))}`;case`channel`:return`Channel is ${zt(e.channels)}`;case`appVersion`:return`App version ${e.range}`;case`cohort`:return`Cohort is ${zt(e.cohorts)}`;case`percent`:return e.from===0?`${Bt(e.to)}% of installs`:`${Bt(e.from)}–${Bt(e.to)}% of installs`;case`fingerprint`:return`Fingerprint is ${zt(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`,Jt=()=>{let e=crypto.getRandomValues(new Uint8Array(6));return Array.from(e,e=>e.toString(36).padStart(2,`0`)).join(``).slice(0,8)},Yt=(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))}),Xt=(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:Yt(e.parameters,t.parameters),conditions:Yt(n(e),n(t)),reordered:r(e,t).join(`
3
3
  `)!==r(t,e).join(`
4
4
  `)}},Q=`Not set`,Zt=(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},Qt=(e,t,n=Ht)=>{let r=e=>e.rules.map(e=>qt(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}]},$t=`hot-updater:remote-config-draft`,$=e=>typeof e==`object`&&!!e&&!Array.isArray(e),en=e=>$(e)&&(typeof e.value==`string`||e.useInAppDefault===!0),tn=e=>$(e)&&$(e.parameters)&&Array.isArray(e.conditions)&&Object.values(e.parameters).every(e=>$(e)&&Object.hasOwn(J,String(e.valueType))&&en(e.defaultValue)&&(e.conditionalValues===void 0||$(e.conditionalValues)&&Object.values(e.conditionalValues).every(en)))&&e.conditions.every(e=>$(e)&&typeof e.name==`string`&&Array.isArray(e.rules)&&e.rules.every(e=>$(e)&&Object.hasOwn(Y,String(e.type)))),nn=e=>{try{let t=window.localStorage.getItem($t);if(t===null)return null;let n=JSON.parse(t);return!$(n)||n.baseVersion!==e.version||!tn(n.base)||!tn(n.template)||!jt(n.base,e.template)||jt(n.template,e.template)?null:{baseVersion:e.version,base:n.base,template:n.template}}catch{return null}},rn=e=>{try{return e===null?window.localStorage.removeItem($t):window.localStorage.setItem($t,JSON.stringify(e)),!0}catch{return!1}},an=/^[A-Za-z_][A-Za-z0-9_]{0,255}$/u,on=(e,t)=>e.length===0?`Enter a key.`:an.test(e)?t.includes(e)?`Another parameter uses this key.`:null:`Start with a letter or _, then use letters, digits, and _.`,sn=(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},cn=(e,t,n)=>{let r=e.map(e=>qt(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}},ln=(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},un=e=>[...new Set(e.split(/[\n,]/u).map(e=>e.trim()).filter(e=>e.length>0))],dn=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}},fn=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:Jt(),from:0,to:10};case`fingerprint`:return{type:e,hashes:[]};case`dateTime`:return{type:e,from:Ut()[1].iso}}},pn=G.createContext(void 0);function mn(e=!0){let t=G.useContext(pn);if(t===void 0&&!e)throw Error(v(7));return t}var hn=G.forwardRef(function(e,n){let{className:r,defaultPressed:a=!1,disabled:o=!1,form:s,onPressedChange:c,pressed:l,render:d,type:f,value:p,nativeButton:m=!0,style:h,..._}=e,v=g(p||void 0),y=mn(),b=y?.value??[],x=y?void 0:a,C=(o||y?.disabled)??!1,[w,T]=ne({controlled:y?v!==void 0&&b.indexOf(v)>-1:l,default:x,name:`Toggle`,state:`pressed`}),{getButtonProps:ee,buttonRef:te}=i({disabled:C,native:m}),E={disabled:C,pressed:w},D=[te,n],O=[{"aria-pressed":w,onClick(e){let n=!w,r=u(t,e.nativeEvent);v&&y?.setGroupValue?.(v,n,r),c?.(n,r),!r.isCanceled&&T(n)}},_,ee],k=S(`button`,e,{enabled:!y,state:E,ref:D,props:O});return y?(0,K.jsx)(pe,{tag:`button`,render:d,className:r,style:h,state:E,refs:D,props:O}):k}),gn=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),_n={multiple(e){return e?{[gn.multiple]:``}:null}},vn=G.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:s=`horizontal`,multiple:c=!1,value:l,className:u,render:f,style:p,...m}=e,h=oe(!0),g=G.useMemo(()=>l!==void 0||n!==void 0,[l,n]),_=(h?.disabled??!1)||r,[v,y]=ne({controlled:l,default:l===void 0?n??d:void 0,name:`ToggleGroup`,state:`value`}),b=o((e,t,n)=>{let r;c?(r=v.slice(),t?r.push(e):r.splice(v.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&y(r)}),x={disabled:_,multiple:c,orientation:s},C=G.useMemo(()=>({disabled:_,orientation:s,setGroupValue:b,value:v,isValueInitialized:g}),[_,s,b,v,g]),w={role:`group`},T=S(`div`,e,{enabled:!!h,state:x,ref:t,props:[w,m],stateAttributesMapping:_n});return(0,K.jsx)(pn.Provider,{value:C,children:h?T:(0,K.jsx)(Ue,{render:f,className:u,style:p,state:x,refs:[t],props:[w,m],stateAttributesMapping:_n,loopFocus:i,enableHomeAndEndKeys:!0,orientation:s})})}),yn=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`}}),bn=G.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function xn({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,K.jsx)(vn,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:b(`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),...o,children:(0,K.jsx)(bn.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Sn({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=G.useContext(bn);return(0,K.jsx)(hn,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:b(`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`,yn({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function Cn(){let[e,t]=(0,G.useState)(`UTC`);return(0,G.useEffect)(()=>{t(Intl.DateTimeFormat().resolvedOptions().timeZone)},[]),{timeZone:e,dateTimeText:(0,G.useMemo)(()=>Vt(e),[e])}}var wn=Object.keys(Y);function Tn({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),un(a).join(`
5
5
  `)!==t.join(`
6
- `)&&o(t.join(`, `)));let l=e=>{o(e),n(un(e))};return i?(0,K.jsx)(_e,{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)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:e,onChange:e=>l(e.target.value),placeholder:r,value:a})}function En({id:e,label:t,value:r,presets:i,onChange:a}){return(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:e,children:t}),(0,K.jsxs)(be,{className:`h-11 sm:h-9`,children:[(0,K.jsx)(he,{className:`h-11 tabular-nums sm:h-9`,id:e,onChange:e=>a(Kt(e.target.value)),type:`datetime-local`,value:Gt(r)}),r===void 0?null:(0,K.jsx)(ge,{align:`inline-end`,children:(0,K.jsx)(ve,{"aria-label":`Clear ${t.toLowerCase()}`,className:`size-11 sm:size-5`,onClick:()=>a(void 0),size:`icon-xs`,children:(0,K.jsx)(n,{})})})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,K.jsx)(_,{"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 Dn({rule:e,onChange:t}){let n=(0,G.useId)(),r=ut();switch(e.type){case`platform`:return(0,K.jsx)(xn,{"aria-label":`Platforms`,multiple:!0,onValueChange:n=>t({...e,platforms:n.filter(e=>e===`ios`||e===`android`)}),value:[...e.platforms],variant:`outline`,children:[`ios`,`android`].map(e=>(0,K.jsxs)(Sn,{className:`min-h-11 px-3 sm:min-h-8`,value:e,children:[(0,K.jsx)(et,{className:`size-3.5`,platform:e}),e===`ios`?`iOS`:`Android`]},e))});case`channel`:{let i=(r.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)(Tn,{id:`${n}-channels`,onChange:n=>t({...e,channels:n}),placeholder:`production, beta`,values:e.channels}),i.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:`}),i.slice(0,8).map(n=>(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-6`,onClick:()=>t({...e,channels:[...e.channels,n]}),size:`xs`,type:`button`,variant:`outline`,children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),n]},n))]}):null]})}case`appVersion`:return(0,K.jsx)(m,{"aria-label":`App version range`,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,onChange:n=>t({...e,range:n.target.value}),placeholder:`>=1.4.0`,value:e.range});case`cohort`:return(0,K.jsx)(Tn,{id:`${n}-cohorts`,onChange:n=>t({...e,cohorts:n}),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)(W,{children:[(0,K.jsx)(H,{htmlFor:`${n}-from`,children:`From %`}),(0,K.jsx)(m,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${n}-from`,inputMode:`decimal`,max:100,min:0,onChange:n=>t({...e,from:Number(n.target.value)}),step:.1,type:`number`,value:e.from})]}),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${n}-to`,children:`To %`}),(0,K.jsx)(m,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${n}-to`,inputMode:`decimal`,max:100,min:0,onChange:n=>t({...e,to:Number(n.target.value)}),step:.1,type:`number`,value:e.to})]}),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${n}-seed`,children:`Seed`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${n}-seed`,onChange:n=>t({...e,seed:n.target.value}),value:e.seed}),(0,K.jsx)(_,{"aria-label":`New seed`,className:`size-11 sm:size-9`,onClick:()=>t({...e,seed:Jt()}),size:`icon`,type:`button`,variant:`outline`,children:(0,K.jsx)(me,{})})]})]})]});case`fingerprint`:return(0,K.jsx)(Tn,{id:`${n}-hashes`,multiline:!0,onChange:n=>t({...e,hashes:n}),placeholder:`One fingerprint hash per line`,values:e.hashes});case`dateTime`:{let r=(n,r)=>{let{[n]:i,...a}=e;t(r===void 0?a:{...a,[n]:r})};return(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)(En,{id:`${n}-from`,label:`From`,onChange:e=>r(`from`,e),presets:Ut(),value:e.from}),(0,K.jsx)(En,{id:`${n}-until`,label:`Until`,onChange:e=>r(`to`,e),presets:Wt(e.from),value:e.to})]})}}}var On={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 kn({open:e,onOpenChange:t,condition:n,takenNames:r,onSave:i}){let a=Ce(e);return(0,K.jsx)(V,{onOpenChange:t,open:e,children:(0,K.jsx)(rt,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-xl`,children:(0,K.jsx)(An,{condition:n,onCancel:()=>t(!1),onSave:e=>{i(e),t(!1)},takenNames:r},a)})})}function An({condition:e,takenNames:t,onSave:n,onCancel:r}){let i=(0,G.useId)(),{dateTimeText:a,timeZone:o}=Cn(),[s,c]=(0,G.useState)(()=>e===null||e.name===cn(e.rules,t,a)?``:e.name),[l,u]=(0,G.useState)(e===null?[fn(`platform`)]:[...e.rules]),[d,f]=(0,G.useState)(!1),p=cn(l,t,a),h=s.trim().length===0?p:s,g=ln(h,t),v=l.map(dn),y=wn.filter(e=>!l.some(t=>t.type===e)),b=g!==null||l.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(),f(!0),!b&&n({name:h.trim(),rules:l.map(e=>e.type===`appVersion`?{...e,range:e.range.trim()}:e)})},children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(it,{children:e===null?`Add condition`:`Edit condition`}),(0,K.jsx)(at,{children:`A device matches when it matches every rule.`})]}),(0,K.jsxs)(ot,{children:[(0,K.jsxs)(W,{"data-invalid":d&&g!==null||void 0,children:[(0,K.jsx)(H,{htmlFor:`${i}-name`,children:`Name`}),(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${i}-name`,maxLength:101,onChange:e=>c(e.target.value),placeholder:p||`Beta testers on iOS`,value:s}),(0,K.jsx)(st,{children:`Optional: without one, it is named after its rules.`}),(0,K.jsx)(U,{children:d?g:null})]}),(0,K.jsxs)(lt,{children:[(0,K.jsx)(ct,{variant:`label`,children:`Rules`}),l.length===0?(0,K.jsx)(U,{children:d?`Add at least one rule.`:null}):null,(0,K.jsx)(`ol`,{className:`flex flex-col gap-3`,children:l.map((e,t)=>(0,K.jsx)(`li`,{className:`rounded-lg border p-3`,children:(0,K.jsxs)(W,{"data-invalid":d&&v[t]!==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)(_,{"aria-label":`Remove the ${Y[e.type].toLowerCase()} rule`,className:`size-11 sm:size-7`,onClick:()=>u(l.filter((e,n)=>n!==t)),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,K.jsx)(Ee,{})})]}),(0,K.jsx)(Dn,{onChange:e=>u(l.map((n,r)=>r===t?e:n)),rule:e}),(0,K.jsx)(st,{children:e.type===`dateTime`?`In your time zone, ${o}. ${On.dateTime}`:On[e.type]}),(0,K.jsx)(U,{children:d?v[t]:null})]})},e.type))}),y.length>0?(0,K.jsxs)(se,{items:Object.fromEntries(y.map(e=>[e,Y[e]])),onValueChange:e=>{e!==null&&u([...l,fn(e)])},value:null,children:[(0,K.jsxs)(re,{"aria-label":`Add a rule`,className:`min-h-11 w-full sm:min-h-9 sm:w-56`,children:[(0,K.jsx)(M,{"aria-hidden":`true`,className:`size-3.5`}),(0,K.jsx)(j,{placeholder:`Add a rule`})]}),(0,K.jsx)(ie,{alignItemWithTrigger:!1,children:(0,K.jsx)(ae,{children:y.map(e=>(0,K.jsx)(A,{value:e,children:Y[e]},e))})})]}):null]})]}),(0,K.jsxs)(nt,{children:[(0,K.jsx)(_,{onClick:r,type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsx)(_,{type:`submit`,children:e===null?`Add condition`:`Save condition`})]})]})}function jn({condition:e,dateTimeText:t}){let n=e.rules.map(e=>qt(e,t)).join(` · `);return n===e.name?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}function Mn({template:e,onSaveCondition:t,onRemoveCondition:n,onMoveCondition:r}){let[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(null),c=N(i),l=N(o),{dateTimeText:u}=Cn(),{conditions:d}=e,f=c?.condition?.name??null,p=t=>{let r=Rt(e,t);r.length===0?n(t):s({name:t,users:r})};return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(Oe,{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)(Ae,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Conditions`})}),(0,K.jsx)(je,{className:`text-xs`,children:`Listed by priority: when several match a device, the first wins.`})]}),(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add condition`]})]}),(0,K.jsx)(ke,{className:`p-0`,children:d.length===0?(0,K.jsxs)(Re,{className:`py-10`,children:[(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(le,{})}),(0,K.jsx)(Ie,{children:`No conditions`}),(0,K.jsx)(Le,{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)(Fe,{children:(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add condition`]})})]}):(0,K.jsx)(`ol`,{"aria-label":`Conditions`,className:`divide-y`,children:d.map((t,n)=>{let i=Rt(e,t.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 ${n+1}`,className:`flex size-6 items-center justify-center rounded-md bg-muted text-xs font-medium tabular-nums`,children:n+1}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.name}),(0,K.jsx)(jn,{condition:t,dateTimeText:u}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:i.length===0?`No parameter uses it yet`:`Sets ${i.length===1?`1 parameter`:`${i.length} parameters`}: ${i.slice(0,3).join(`, `)}${i.length>3?`…`:``}`})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1 md:justify-end`,children:[(0,K.jsx)(_,{"aria-label":`Move ${t.name} up`,className:`size-11 md:size-7`,disabled:n===0,onClick:()=>r(n,-1),size:`icon`,variant:`ghost`,children:(0,K.jsx)(ft,{})}),(0,K.jsx)(_,{"aria-label":`Move ${t.name} down`,className:`size-11 md:size-7`,disabled:n===d.length-1,onClick:()=>r(n,1),size:`icon`,variant:`ghost`,children:(0,K.jsx)(dt,{})}),(0,K.jsxs)(_,{"aria-label":`Edit ${t.name}`,className:`min-h-11 md:min-h-7`,onClick:()=>a({condition:t}),size:`sm`,variant:`outline`,children:[(0,K.jsx)(fe,{"data-icon":`inline-start`}),`Edit`]}),(0,K.jsx)(_,{"aria-label":`Delete ${t.name}`,className:`size-11 md:size-7`,onClick:()=>p(t.name),size:`icon`,variant:`ghost`,children:(0,K.jsx)(Ee,{})})]})]},t.name)})})}),(0,K.jsx)(kn,{condition:c?.condition??null,onOpenChange:e=>{e||a(null)},onSave:e=>t(f,e),open:i!==null,takenNames:d.map(({name:e})=>e).filter(e=>e!==f)}),(0,K.jsx)($e,{onOpenChange:e=>{e||s(null)},open:o!==null,children:(0,K.jsxs)(qe,{children:[(0,K.jsxs)(Qe,{children:[(0,K.jsxs)(Je,{children:[`Delete `,l?.name,`?`]}),(0,K.jsxs)(Ke,{children:[l?.users.length===1?`1 parameter has a value for it`:`${l?.users.length} parameters have a value for it`,` `,`(`,l?.users.join(`, `),`). Those values are removed too, so matching devices get the default value after you publish.`]})]}),(0,K.jsxs)(Xe,{children:[(0,K.jsx)(Ze,{children:`Cancel`}),(0,K.jsx)(Ye,{onClick:e=>{e.preventDefault(),o!==null&&n(o.name),s(null)},variant:`destructive`,children:`Delete condition`})]})]})})]})}var Nn=e=>e===`BOOLEAN`?`false`:e===`NUMBER`?`0`:e===`JSON`?`{}`:``,Pn=(e,t)=>`value`in t?sn(e,t.value):null;function Fn({id:e,label:t,valueType:n,value:r,onChange:i,showErrors:a}){let o=!(`value`in r),s=`value`in r?r.value:``,c=a?Pn(n,r):null,l=e=>i({value:e});return(0,K.jsxs)(W,{"data-invalid":c!==null||void 0,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(H,{htmlFor:e,id:`${e}-label`,children:t}),(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)(we,{checked:o,id:`${e}-in-app-default`,onCheckedChange:e=>i(e?{useInAppDefault:!0}:{value:Nn(n)})}),(0,K.jsx)(`label`,{htmlFor:`${e}-in-app-default`,children:`Use in-app default`})]})]}),o?(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 }`,`)`]}),`.`]}):n===`BOOLEAN`?(0,K.jsxs)(xn,{"aria-labelledby":`${e}-label`,id:e,onValueChange:e=>{let[t]=e;(t===`true`||t===`false`)&&l(t)},value:[s],variant:`outline`,children:[(0,K.jsx)(Sn,{className:`min-h-11 px-4 sm:min-h-8`,value:`true`,children:`true`}),(0,K.jsx)(Sn,{className:`min-h-11 px-4 sm:min-h-8`,value:`false`,children:`false`})]}):n===`NUMBER`?(0,K.jsx)(m,{"aria-invalid":c!==null||void 0,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:e,inputMode:`decimal`,onChange:e=>l(e.target.value),value:s}):n===`JSON`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(_e,{"aria-invalid":c!==null||void 0,className:`min-h-24 font-mono text-xs`,id:e,onChange:e=>l(e.target.value),spellCheck:!1,value:s}),(0,K.jsxs)(_,{className:`self-start`,disabled:sn(`JSON`,s)!==null,onClick:()=>l(JSON.stringify(JSON.parse(s),null,2)),size:`sm`,type:`button`,variant:`outline`,children:[(0,K.jsx)(pt,{"data-icon":`inline-start`}),`Format JSON`]})]}):(0,K.jsx)(_e,{"aria-invalid":c!==null||void 0,className:`min-h-11 text-sm sm:min-h-9`,id:e,onChange:e=>l(e.target.value),rows:2,value:s}),(0,K.jsx)(U,{children:c})]})}var In=Object.keys(J),Ln={STRING:`getString`,NUMBER:`getNumber`,BOOLEAN:`getBoolean`,JSON:`getString`},Rn=(e,t)=>`value`in e&&Pn(t,e)!==null?{value:Nn(t)}:e;function zn({open:e,onOpenChange:t,parameterKey:n,parameter:r,takenKeys:i,conditions:a,onSave:o,onAddCondition:s}){let c=Ce(e);return(0,K.jsx)(V,{onOpenChange:t,open:e,children:(0,K.jsx)(rt,{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)(Bn,{conditions:a,onAddCondition:s,onCancel:()=>t(!1),onSave:(e,n)=>{o(e,n),t(!1)},parameter:r,parameterKey:n,takenKeys:i},c)})})}function Bn({parameterKey:e,parameter:t,takenKeys:r,conditions:i,onSave:a,onCancel:o,onAddCondition:s}){let c=(0,G.useId)(),{dateTimeText:l}=Cn(),[u,d]=(0,G.useState)(e??``),[f,p]=(0,G.useState)(t?.valueType??`STRING`),[h,g]=(0,G.useState)(t?.description??``),v=h.trim().length>256,[y,b]=(0,G.useState)(t?.defaultValue??{value:``}),[x,S]=(0,G.useState)(t?.conditionalValues??{}),[C,w]=(0,G.useState)({}),[T,ee]=(0,G.useState)(!1),[te,E]=(0,G.useState)(!1),D=on(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||v||[y,...Object.values(x)].some(e=>Pn(f,e)!==null),oe=e=>{p(e),b(Rn(y,e)),S(Object.fromEntries(Object.entries(x).map(([t,n])=>[t,Rn(n,e)])))},ce=e=>{let t=X(C,e);S({...x,[e]:t===void 0?{value:Nn(f)}:Rn(t,f)})},le=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:f,defaultValue:y,...Object.keys(t).length===0?{}:{conditionalValues:t},...h.trim().length===0?{}:{description:h.trim()}})},children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(it,{children:e===null?`Add parameter`:`Edit parameter`}),(0,K.jsxs)(at,{children:[`The app reads it with`,` `,(0,K.jsxs)(`code`,{className:`font-mono`,children:[`hotUpdater.remoteConfig.`,Ln[f],`("`,u.trim()||`key`,`")`]}),`, which is null when neither the server nor the app's defaults have a value.`]})]}),(0,K.jsxs)(ot,{children:[(0,K.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[minmax(0,1fr)_11rem]`,children:[(0,K.jsxs)(W,{"data-invalid":T&&D!==null||void 0,children:[(0,K.jsx)(H,{htmlFor:`${c}-key`,children:`Key`}),(0,K.jsx)(m,{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)(U,{children:T?D:null})]}),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${c}-type`,children:`Type`}),(0,K.jsxs)(se,{items:J,onValueChange:e=>{e!==null&&oe(e)},value:f,children:[(0,K.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${c}-type`,children:(0,K.jsx)(j,{})}),(0,K.jsx)(ie,{children:(0,K.jsx)(ae,{children:In.map(e=>(0,K.jsx)(A,{value:e,children:J[e]},e))})})]})]})]}),(0,K.jsxs)(W,{"data-invalid":v||void 0,children:[(0,K.jsx)(H,{htmlFor:`${c}-description`,children:`Description`}),(0,K.jsx)(m,{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)(U,{children:v?`Use 256 characters or fewer.`:null})]}),(0,K.jsx)(Fn,{id:`${c}-default`,label:`Default value`,onChange:b,showErrors:T,value:y,valueType:f}),(0,K.jsxs)(lt,{children:[(0,K.jsx)(ct,{variant:`label`,children:`Conditional values`}),(0,K.jsx)(st,{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)(jn,{condition:e,dateTimeText:l})]}),(0,K.jsxs)(_,{"aria-label":`Remove the value for ${e.name}`,className:`min-h-11 shrink-0 text-muted-foreground sm:min-h-7`,onClick:()=>le(e.name),size:`sm`,type:`button`,variant:`ghost`,children:[(0,K.jsx)(n,{"data-icon":`inline-start`}),`Remove value`]})]}),(0,K.jsx)(Fn,{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:f})]},e.name))}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0?(0,K.jsxs)(se,{items:Object.fromEntries(k.map(({name:e})=>[e,e])),onValueChange:e=>{e!==null&&ce(e)},value:null,children:[(0,K.jsxs)(re,{"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)(M,{"aria-hidden":`true`,className:`size-3.5`}),(0,K.jsx)(j,{placeholder:`Add a value for a condition`})]}),(0,K.jsx)(ie,{alignItemWithTrigger:!1,children:(0,K.jsx)(ae,{children:k.map(({name:e})=>(0,K.jsx)(A,{value:e,children:e},e))})})]}):null,(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-9`,onClick:()=>E(!0),type:`button`,variant:`outline`,children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`New condition`]})]})]})]}),(0,K.jsxs)(nt,{children:[(0,K.jsx)(_,{onClick:o,type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsx)(_,{type:`submit`,children:e===null?`Add parameter`:`Save parameter`})]})]}),(0,K.jsx)(kn,{condition:null,onOpenChange:E,onSave:e=>{s(e),ce(e.name)},open:te,takenNames:i.map(({name:e})=>e)})]})}function Vn({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 Hn({parameterKey:e,parameter:t,conditions:n,onEdit:r,onRemove:i}){let a=n.filter(({name:e})=>X(t.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)(z,{className:`shrink-0`,variant:`outline`,children:J[t.valueType]})]}),t.description===void 0?null:(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t.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:[a.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)(Vn,{text:Z(X(t.conditionalValues,e))})})]},e)),(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Default`}),(0,K.jsx)(`dd`,{className:`min-w-0`,children:`value`in t.defaultValue?(0,K.jsx)(Vn,{text:Z(t.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)(_,{"aria-label":`Edit ${e}`,className:`min-h-11 md:min-h-7`,onClick:r,size:`sm`,variant:`outline`,children:[(0,K.jsx)(fe,{"data-icon":`inline-start`}),`Edit`]}),(0,K.jsx)(_,{"aria-label":`Delete ${e}`,className:`size-11 md:size-7`,onClick:i,size:`icon`,variant:`ghost`,children:(0,K.jsx)(Ee,{})})]})]})}function Un({template:e,onSaveParameter:t,onRemoveParameter:n,onAddCondition:r}){let[i,a]=(0,G.useState)(null),o=N(i),[s,c]=(0,G.useState)(``),l=Object.keys(e.parameters),u=l.filter(e=>e.toLowerCase().includes(s.trim().toLowerCase())),d=o?.key??null;return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(Oe,{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)(Ae,{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:[l.length>5?(0,K.jsxs)(be,{className:`min-h-11 w-full sm:min-h-8 sm:w-56`,children:[(0,K.jsx)(ge,{children:(0,K.jsx)(xe,{"aria-hidden":`true`})}),(0,K.jsx)(he,{"aria-label":`Filter parameters by key`,className:`text-base sm:text-xs`,onChange:e=>c(e.target.value),placeholder:`Filter by key`,value:s})]}):null,(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add parameter`]})]})]}),(0,K.jsx)(ke,{className:`p-0`,children:l.length===0?(0,K.jsxs)(Re,{className:`py-10`,children:[(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(Se,{})}),(0,K.jsx)(Ie,{children:`No parameters`}),(0,K.jsx)(Le,{children:`Add a parameter, give it a default, then publish to change the app without a new build.`})]}),(0,K.jsx)(Fe,{children:(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add parameter`]})})]}):u.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)(_,{onClick:()=>c(``),size:`sm`,variant:`outline`,children:`Clear filter`})]}):(0,K.jsx)(`ul`,{"aria-label":`Parameters`,className:`divide-y`,children:u.map(t=>(0,K.jsx)(Hn,{conditions:e.conditions,onEdit:()=>a({key:t,parameter:e.parameters[t]??null}),onRemove:()=>n(t),parameter:e.parameters[t],parameterKey:t},t))})}),(0,K.jsx)(zn,{conditions:e.conditions,onAddCondition:r,onOpenChange:e=>{e||a(null)},onSave:(e,n)=>t(d,e,n),open:i!==null,parameter:o?.parameter??null,parameterKey:d,takenKeys:l.filter(e=>e!==d)})]})}var Wn={platform:`ios`,channel:`production`,appVersion:`1.0.0`,cohort:`1`,fingerprintHash:``,at:``},Gn=(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 Kn({template:t,isDraft:n}){let r=(0,G.useId)(),[i,a]=(0,G.useState)(Wn),{at:o,...s}=Gn(i),c=Kt(o),l=At({template:t,context:{...s,...c===void 0?{}:{now:Date.parse(c)}}}),u=Object.keys(t.parameters),d=(e,t)=>a({...i,[e]:t});return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(Oe,{className:`border-b px-4 py-3 sm:px-6`,children:[(0,K.jsx)(Ae,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Preview a device`})}),(0,K.jsx)(je,{className:`text-xs`,children:n?`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)(ke,{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)(W,{children:[(0,K.jsx)(H,{htmlFor:`${r}-platform`,children:`Platform`}),(0,K.jsxs)(se,{items:{ios:`iOS`,android:`Android`},onValueChange:e=>{(e===`ios`||e===`android`)&&d(`platform`,e)},value:i.platform,children:[(0,K.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${r}-platform`,children:(0,K.jsxs)(j,{children:[(0,K.jsx)(et,{className:`size-3.5`,platform:i.platform}),i.platform===`ios`?`iOS`:`Android`]})}),(0,K.jsx)(ie,{children:(0,K.jsxs)(ae,{children:[(0,K.jsxs)(A,{value:`ios`,children:[(0,K.jsx)(et,{className:`size-3.5`,platform:`ios`}),`iOS`]}),(0,K.jsxs)(A,{value:`android`,children:[(0,K.jsx)(et,{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,n])=>(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${r}-${e}`,children:t}),(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 text-base sm:min-h-9 sm:text-xs`,id:`${r}-${e}`,onChange:t=>d(e,t.target.value),placeholder:n,spellCheck:!1,value:i[e]})]},e)),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${r}-at`,children:`Time`}),(0,K.jsxs)(be,{className:`h-11 sm:h-9`,children:[(0,K.jsx)(he,{className:`h-11 text-base tabular-nums sm:h-9 sm:text-xs`,id:`${r}-at`,onChange:e=>d(`at`,e.target.value),type:`datetime-local`,value:i.at}),i.at.length===0?null:(0,K.jsx)(ge,{align:`inline-end`,children:(0,K.jsx)(ve,{className:`min-h-11 sm:min-h-6`,onClick:()=>d(`at`,``),size:`xs`,children:`Now`})})]})]})]}),u.length===0?(0,K.jsx)(Re,{className:`border py-8`,children:(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(Te,{})}),(0,K.jsx)(Ie,{children:`Nothing to preview`}),(0,K.jsx)(Le,{children:`Add a parameter, and its value for this device shows here.`})]})}):l.data?.status===`invalid`?(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`The draft has problems to fix first`}),(0,K.jsx)(F,{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)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`The preview couldn't be loaded`}),(0,K.jsx)(F,{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(t=>(0,K.jsx)(e,{className:`h-8 w-full`},t))]}):(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)(z,{variant:`outline`,children:`Default value`}):(0,K.jsx)(z,{variant:`secondary`,children:t.condition})})]},e)})})]})]})}function qn({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)(k,{"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 Jn({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)(qn,{fields:n(e),name:e},e))})})]},e))})]})}function Yn({open:e,onOpenChange:t,base:n,baseVersion:r,draft:i,onPublished:a,onLoadLatest:o,onPublishOver:s}){let c=(0,G.useId)(),l=Ot(),[u,d]=(0,G.useState)(``),[f,p]=(0,G.useState)(null),{dateTimeText:h}=Cn(),g=Xt(n,i),v=e=>{let t=Object.hasOwn(n.parameters,e)?n.parameters[e]:null,r=Object.hasOwn(i.parameters,e)?i.parameters[e]:null;return r===null?[]:Zt(t,r)},y=e=>{let t=n.conditions.find(t=>t.name===e)??null,r=i.conditions.find(t=>t.name===e)??null;return r===null?[]:Qt(t,r,h)},b=u.trim().length>256,x=e=>{l.isPending||(t(e),e||(p(null),l.reset()))};return(0,K.jsx)(V,{onOpenChange:x,open:e,children:(0,K.jsx)(rt,{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 l.mutateAsync({template:i,baseVersion:r,...u.trim().length===0?{}:{description:u.trim()}});p(e),e.status===`published`&&(B.success(`Published version ${e.version.version}`),d(``),p(null),t(!1),a())}catch(e){B.error(e instanceof Error?e.message:`Unable to publish`)}},children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(it,{children:`Publish changes`}),(0,K.jsxs)(at,{children:[`This becomes version `,r+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)(Jn,{changes:g.parameters,describe:v,label:`Parameters`}),(0,K.jsx)(Jn,{changes:g.conditions,describe:y,label:`Conditions`}),g.reordered?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Condition priority changed.`}):null]}),f?.status===`invalid`?(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`The server refused the template`}),(0,K.jsx)(F,{children:(0,K.jsx)(`ul`,{className:`list-disc pl-4`,children:f.issues.slice(0,6).map(e=>(0,K.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):null,f?.status===`conflict`?(0,K.jsxs)(I,{children:[(0,K.jsx)(L,{}),(0,K.jsxs)(P,{children:[`Version `,f.currentVersion,` was published while you edited`]}),(0,K.jsx)(F,{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)(_,{onClick:()=>{x(!1),o()},size:`sm`,type:`button`,variant:`outline`,children:[`Load version `,f.currentVersion]}),(0,K.jsx)(_,{onClick:()=>{s(f.currentVersion),p(null)},size:`sm`,type:`button`,variant:`ghost`,children:`Publish mine after it`})]})]}):null,(0,K.jsxs)(W,{"data-invalid":b||void 0,children:[(0,K.jsx)(H,{htmlFor:`${c}-description`,children:`Description`}),(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${c}-description`,onChange:e=>d(e.target.value),placeholder:`What changed and why`,value:u}),(0,K.jsx)(st,{children:`Shown in the version history.`}),(0,K.jsx)(U,{children:b?`Use 256 characters or fewer.`:null})]}),(0,K.jsxs)(nt,{children:[(0,K.jsx)(_,{disabled:l.isPending,onClick:()=>x(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsxs)(_,{disabled:l.isPending||f?.status===`conflict`,type:`submit`,children:[l.isPending?(0,K.jsx)(de,{className:`animate-spin`,"data-icon":`inline-start`}):(0,K.jsx)(ht,{"data-icon":`inline-start`}),`Publish version `,r+1]})]})]})})})}function Xn({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,gt.default)(e).format(`YYYY/MM/DD HH:mm`)})}function Zn({open:t,version:n,onOpenChange:r}){let i=Et(n),a=i.data===null||i.data===void 0?null:JSON.stringify(i.data.template,null,2);return(0,K.jsx)(V,{onOpenChange:r,open:t,children:(0,K.jsxs)(rt,{className:`max-h-[calc(100svh-2rem)] grid-rows-[auto_minmax(0,1fr)] sm:max-w-2xl`,children:[(0,K.jsxs)(tt,{children:[(0,K.jsxs)(it,{children:[`Version `,n]}),(0,K.jsx)(at,{children:`The template as it was published, in the JSON the admin API takes.`})]}),i.isLoading?(0,K.jsx)(e,{className:`h-48 w-full`}):i.isError?(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`This version couldn't be loaded`}),(0,K.jsx)(F,{children:`Check the connection and try again.`}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:()=>void i.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(me,{"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)(_,{className:`self-end`,onClick:()=>{navigator.clipboard.writeText(a).then(()=>B.success(`Template JSON copied`),()=>B.error(`Unable to copy the template`))},size:`sm`,variant:`outline`,children:[(0,K.jsx)(ce,{"data-icon":`inline-start`}),`Copy JSON`]})]})]})})}function Qn({activeVersion:t,hasDraft:n,onRolledBack:r,onStartEditing:i}){let a=Tt({enabled:!0}),o=kt(),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null),d=N(s),f=N(l),p=a.data?.pages.flatMap(e=>e.versions)??[],m=async e=>{if(e.preventDefault(),l!==null)try{let e=await o.mutateAsync({version:l.source,baseVersion:l.next-1});e.status===`published`?(B.success(`Version ${e.version.version} restores version ${l.source}`),r()):e.status===`conflict`?B.error(`Version ${e.currentVersion} was published meanwhile. Review it, then roll back again.`):B.error(`That version no longer exists.`),u(null)}catch(e){B.error(e instanceof Error?e.message:`Unable to roll back`)}};return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsx)(Oe,{className:`border-b px-4 py-3 sm:px-6`,children:(0,K.jsx)(Ae,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Versions`})})}),(0,K.jsx)(ke,{className:`p-0`,children:a.isError?(0,K.jsx)(`div`,{className:`p-4`,children:(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`Versions couldn't be loaded`}),(0,K.jsx)(F,{children:`Check the connection and try again.`}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:()=>void a.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(me,{"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},(t,n)=>(0,K.jsx)(e,{className:`h-10 w-full`},n))]}):p.length===0?(0,K.jsxs)(Re,{className:`py-10`,children:[(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(ue,{})}),(0,K.jsx)(Ie,{children:`No versions yet`}),(0,K.jsx)(Le,{children:`Your first publish becomes version 1. Every publish after it is kept here, ready to roll back to.`})]}),(0,K.jsx)(Fe,{children:(0,K.jsx)(_,{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:p.map(e=>(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 `,e.version]}),e.version===t?(0,K.jsx)(z,{children:`Active`}):null,e.updateType===`ROLLBACK`?(0,K.jsxs)(z,{variant:`outline`,children:[`Rollback to v`,e.rollbackSource]}):null]}),(0,K.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(Xn,{ms:e.createdAtMs}),e.description===null||e.updateType===`ROLLBACK`&&e.description===`Rollback to version ${e.rollbackSource}`?null:(0,K.jsxs)(K.Fragment,{children:[` · `,e.description]})]})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,K.jsxs)(_,{"aria-label":`View version ${e.version}`,className:`min-h-11 md:min-h-7`,onClick:()=>c(e.version),size:`sm`,variant:`ghost`,children:[(0,K.jsx)(mt,{"data-icon":`inline-start`}),`View`]}),(0,K.jsxs)(_,{"aria-label":`Roll back to version ${e.version}`,className:`min-h-11 md:min-h-7`,disabled:e.version===t,onClick:()=>u({source:e.version,next:t+1}),size:`sm`,variant:`outline`,children:[(0,K.jsx)(ye,{"data-icon":`inline-start`}),`Roll back`]})]})]},e.version))}),a.hasNextPage?(0,K.jsx)(`div`,{className:`border-t px-4 py-3 sm:px-6`,children:(0,K.jsxs)(_,{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)(de,{className:`animate-spin`,"data-icon":`inline-start`}):null,`Load older versions`]})}):null]})}),(0,K.jsx)(Zn,{onOpenChange:e=>{e||c(null)},open:s!==null,version:d}),(0,K.jsx)($e,{onOpenChange:e=>{!o.isPending&&!e&&u(null)},open:l!==null,children:(0,K.jsxs)(qe,{children:[(0,K.jsxs)(Qe,{children:[(0,K.jsxs)(Je,{children:[`Roll back to version `,f?.source,`?`]}),(0,K.jsxs)(Ke,{children:[`Version `,f?.next,` will publish a copy of version`,` `,f?.source,`, and devices get its values on their next fetch.`,n?` Your unpublished changes are discarded.`:``]})]}),(0,K.jsxs)(Xe,{children:[(0,K.jsx)(Ze,{disabled:o.isPending,children:`Cancel`}),(0,K.jsxs)(Ye,{disabled:o.isPending,onClick:e=>void m(e),children:[o.isPending?(0,K.jsx)(de,{className:`animate-spin`,"data-icon":`inline-start`}):(0,K.jsx)(ye,{"data-icon":`inline-start`}),`Roll back`]})]})]})})]})}gt.default.extend(_t.default);var $n=[`parameters`,`conditions`,`preview`,`versions`];function er({tab:t,onTabChange:n}){let r=wt(),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),f=r.data,p=i?.template??f?.template,m=i!==null&&f!==void 0&&!jt(i.template,f.template),h=m&&f!==void 0&&i.baseVersion!==f.version;(0,G.useEffect)(()=>{if(o||f===void 0)return;s(!0);let e=nn(f);e!==null&&(a(e),l(!0))},[f,o]),(0,G.useEffect)(()=>{if(i===null||!m||rn(i))return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[i,m]);let g=()=>{a(null),l(!1),rn(null)},v=e=>{f===void 0||p===void 0||(l(!1),a({baseVersion:i?.baseVersion??f.version,base:i?.base??f.template,template:e(p)}))},b={parameters:p===void 0?null:Object.keys(p.parameters).length,conditions:p?.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)(y,{className:`-ml-1 size-11 lg:size-7`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,K.jsx)(`h1`,{className:`text-sm font-medium`,children:`Remote Config`})]}),f===void 0?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f.version===0?`Nothing published yet`:(0,K.jsxs)(K.Fragment,{children:[`Version `,f.version,f.updatedAtMs===null?null:(0,K.jsxs)(K.Fragment,{children:[` · published `,(0,K.jsx)(`time`,{dateTime:new Date(f.updatedAtMs).toISOString(),title:(0,gt.default)(f.updatedAtMs).format(`YYYY/MM/DD HH:mm:ss`),children:(0,gt.default)(f.updatedAtMs).fromNow()})]})]})}),m?(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,K.jsx)(z,{className:`hidden sm:inline-flex`,variant:`secondary`,children:`Unpublished changes`}),(0,K.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:g,variant:`ghost`,children:[(0,K.jsx)(De,{"data-icon":`inline-start`}),`Discard`]}),(0,K.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:()=>d(!0),children:[(0,K.jsx)(ht,{"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)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`Remote Config couldn't be loaded`}),(0,K.jsx)(F,{children:`Check the connection and try again.`}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:()=>void r.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(me,{"data-icon":`inline-start`}),`Retry`]})})]}):null,c&&m&&i!==null?(0,K.jsxs)(I,{children:[(0,K.jsx)(ue,{}),(0,K.jsx)(P,{children:`Your unpublished changes are back`}),(0,K.jsxs)(F,{children:[`This browser kept them from your last visit, on version`,` `,i.baseVersion,`.`]}),(0,K.jsx)(R,{children:(0,K.jsx)(_,{onClick:g,size:`xs`,variant:`outline`,children:`Discard them`})})]}):null,h&&i!==null&&f!==void 0?(0,K.jsxs)(I,{children:[(0,K.jsx)(L,{}),(0,K.jsxs)(P,{children:[`Version `,f.version,` was published while you edited`]}),(0,K.jsxs)(F,{children:[`Your draft started from version `,i.baseVersion,`. Discard it to review version `,f.version,`, or publish yours after it.`]}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:g,size:`xs`,variant:`outline`,children:[`Load version `,f.version]})})]}):null,(0,K.jsxs)(Ge,{onValueChange:e=>n(e),value:t,children:[(0,K.jsx)(We,{"aria-label":`Remote Config views`,className:`max-w-full group-data-horizontal/tabs:h-auto`,children:[[`parameters`,`Parameters`,b.parameters],[`conditions`,`Conditions`,b.conditions],[`preview`,`Preview`,null],[`versions`,`Versions`,null]].map(([e,t,n])=>(0,K.jsxs)(Ve,{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))}),p===void 0||f===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)(e,{className:`h-14 w-full`}),(0,K.jsx)(e,{className:`h-14 w-full`}),(0,K.jsx)(e,{className:`h-14 w-full`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(He,{value:`parameters`,children:(0,K.jsx)(Un,{onAddCondition:e=>v(t=>Ft(t,null,e)),onRemoveParameter:e=>v(t=>Nt(t,e)),onSaveParameter:(e,t,n)=>v(r=>Mt(r,e,t,n)),template:p})}),(0,K.jsx)(He,{value:`conditions`,children:(0,K.jsx)(Mn,{onMoveCondition:(e,t)=>v(n=>Lt(n,e,t)),onRemoveCondition:e=>v(t=>It(t,e)),onSaveCondition:(e,t)=>v(n=>Ft(n,e,t)),template:p})}),(0,K.jsx)(He,{value:`preview`,children:(0,K.jsx)(Kn,{isDraft:m,template:p})}),(0,K.jsx)(He,{value:`versions`,children:(0,K.jsx)(Qn,{activeVersion:f.version,hasDraft:m,onRolledBack:g,onStartEditing:()=>n(`parameters`)})})]})]})]})}),f!==void 0&&i!==null?(0,K.jsx)(Yn,{base:f.template,baseVersion:i.baseVersion,draft:i.template,onLoadLatest:g,onOpenChange:d,onPublishOver:e=>a({...i,baseVersion:e,base:f.template}),onPublished:g,open:u}):null]})}var tr=T(`/remote-config`)({beforeLoad:({context:e})=>O(e.queryClient,`remoteConfig`),notFoundComponent:te(()=>E(()=>import(`./remote-config-B3oq9qR0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:te(()=>E(()=>import(`./remote-config-D1OkfQKt.js`),__vite__mapDeps([8,2])),`component`),validateSearch:e=>$n.includes(e.tab)&&e.tab!==`parameters`?{tab:e.tab}:{}});export{er as n,tr as t};
6
+ `)&&o(t.join(`, `)));let l=e=>{o(e),n(un(e))};return i?(0,K.jsx)(_e,{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)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:e,onChange:e=>l(e.target.value),placeholder:r,value:a})}function En({id:e,label:t,value:r,presets:i,onChange:a}){return(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:e,children:t}),(0,K.jsxs)(be,{className:`h-11 sm:h-9`,children:[(0,K.jsx)(he,{className:`h-11 tabular-nums sm:h-9`,id:e,onChange:e=>a(Kt(e.target.value)),type:`datetime-local`,value:Gt(r)}),r===void 0?null:(0,K.jsx)(ge,{align:`inline-end`,children:(0,K.jsx)(ve,{"aria-label":`Clear ${t.toLowerCase()}`,className:`size-11 sm:size-5`,onClick:()=>a(void 0),size:`icon-xs`,children:(0,K.jsx)(n,{})})})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,K.jsx)(_,{"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 Dn({rule:e,onChange:t}){let n=(0,G.useId)(),r=ut();switch(e.type){case`platform`:return(0,K.jsx)(xn,{"aria-label":`Platforms`,multiple:!0,onValueChange:n=>t({...e,platforms:n.filter(e=>e===`ios`||e===`android`)}),value:[...e.platforms],variant:`outline`,children:[`ios`,`android`].map(e=>(0,K.jsxs)(Sn,{className:`min-h-11 px-3 sm:min-h-8`,value:e,children:[(0,K.jsx)(et,{className:`size-3.5`,platform:e}),e===`ios`?`iOS`:`Android`]},e))});case`channel`:{let i=(r.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)(Tn,{id:`${n}-channels`,onChange:n=>t({...e,channels:n}),placeholder:`production, beta`,values:e.channels}),i.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:`}),i.slice(0,8).map(n=>(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-6`,onClick:()=>t({...e,channels:[...e.channels,n]}),size:`xs`,type:`button`,variant:`outline`,children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),n]},n))]}):null]})}case`appVersion`:return(0,K.jsx)(m,{"aria-label":`App version range`,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,onChange:n=>t({...e,range:n.target.value}),placeholder:`>=1.4.0`,value:e.range});case`cohort`:return(0,K.jsx)(Tn,{id:`${n}-cohorts`,onChange:n=>t({...e,cohorts:n}),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)(W,{children:[(0,K.jsx)(H,{htmlFor:`${n}-from`,children:`From %`}),(0,K.jsx)(m,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${n}-from`,inputMode:`decimal`,max:100,min:0,onChange:n=>t({...e,from:Number(n.target.value)}),step:.1,type:`number`,value:e.from})]}),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${n}-to`,children:`To %`}),(0,K.jsx)(m,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${n}-to`,inputMode:`decimal`,max:100,min:0,onChange:n=>t({...e,to:Number(n.target.value)}),step:.1,type:`number`,value:e.to})]}),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${n}-seed`,children:`Seed`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${n}-seed`,onChange:n=>t({...e,seed:n.target.value}),value:e.seed}),(0,K.jsx)(_,{"aria-label":`New seed`,className:`size-11 sm:size-9`,onClick:()=>t({...e,seed:Jt()}),size:`icon`,type:`button`,variant:`outline`,children:(0,K.jsx)(me,{})})]})]})]});case`fingerprint`:return(0,K.jsx)(Tn,{id:`${n}-hashes`,multiline:!0,onChange:n=>t({...e,hashes:n}),placeholder:`One fingerprint hash per line`,values:e.hashes});case`dateTime`:{let r=(n,r)=>{let{[n]:i,...a}=e;t(r===void 0?a:{...a,[n]:r})};return(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)(En,{id:`${n}-from`,label:`From`,onChange:e=>r(`from`,e),presets:Ut(),value:e.from}),(0,K.jsx)(En,{id:`${n}-until`,label:`Until`,onChange:e=>r(`to`,e),presets:Wt(e.from),value:e.to})]})}}}var On={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 kn({open:e,onOpenChange:t,condition:n,takenNames:r,onSave:i}){let a=Ce(e);return(0,K.jsx)(V,{onOpenChange:t,open:e,children:(0,K.jsx)(rt,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-xl`,children:(0,K.jsx)(An,{condition:n,onCancel:()=>t(!1),onSave:e=>{i(e),t(!1)},takenNames:r},a)})})}function An({condition:e,takenNames:t,onSave:n,onCancel:r}){let i=(0,G.useId)(),{dateTimeText:a,timeZone:o}=Cn(),[s,c]=(0,G.useState)(()=>e===null||e.name===cn(e.rules,t,a)?``:e.name),[l,u]=(0,G.useState)(e===null?[fn(`platform`)]:[...e.rules]),[d,f]=(0,G.useState)(!1),p=cn(l,t,a),h=s.trim().length===0?p:s,g=ln(h,t),v=l.map(dn),y=wn.filter(e=>!l.some(t=>t.type===e)),b=g!==null||l.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(),f(!0),!b&&n({name:h.trim(),rules:l.map(e=>e.type===`appVersion`?{...e,range:e.range.trim()}:e)})},children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(it,{children:e===null?`Add condition`:`Edit condition`}),(0,K.jsx)(at,{children:`A device matches when it matches every rule.`})]}),(0,K.jsxs)(ot,{children:[(0,K.jsxs)(W,{"data-invalid":d&&g!==null||void 0,children:[(0,K.jsx)(H,{htmlFor:`${i}-name`,children:`Name`}),(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${i}-name`,maxLength:101,onChange:e=>c(e.target.value),placeholder:p||`Beta testers on iOS`,value:s}),(0,K.jsx)(st,{children:`Optional: without one, it is named after its rules.`}),(0,K.jsx)(U,{children:d?g:null})]}),(0,K.jsxs)(lt,{children:[(0,K.jsx)(ct,{variant:`label`,children:`Rules`}),l.length===0?(0,K.jsx)(U,{children:d?`Add at least one rule.`:null}):null,(0,K.jsx)(`ol`,{className:`flex flex-col gap-3`,children:l.map((e,t)=>(0,K.jsx)(`li`,{className:`rounded-lg border p-3`,children:(0,K.jsxs)(W,{"data-invalid":d&&v[t]!==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)(_,{"aria-label":`Remove the ${Y[e.type].toLowerCase()} rule`,className:`size-11 sm:size-7`,onClick:()=>u(l.filter((e,n)=>n!==t)),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,K.jsx)(Ee,{})})]}),(0,K.jsx)(Dn,{onChange:e=>u(l.map((n,r)=>r===t?e:n)),rule:e}),(0,K.jsx)(st,{children:e.type===`dateTime`?`In your time zone, ${o}. ${On.dateTime}`:On[e.type]}),(0,K.jsx)(U,{children:d?v[t]:null})]})},e.type))}),y.length>0?(0,K.jsxs)(se,{items:Object.fromEntries(y.map(e=>[e,Y[e]])),onValueChange:e=>{e!==null&&u([...l,fn(e)])},value:null,children:[(0,K.jsxs)(re,{"aria-label":`Add a rule`,className:`min-h-11 w-full sm:min-h-9 sm:w-56`,children:[(0,K.jsx)(M,{"aria-hidden":`true`,className:`size-3.5`}),(0,K.jsx)(j,{placeholder:`Add a rule`})]}),(0,K.jsx)(ie,{alignItemWithTrigger:!1,children:(0,K.jsx)(ae,{children:y.map(e=>(0,K.jsx)(A,{value:e,children:Y[e]},e))})})]}):null]})]}),(0,K.jsxs)(nt,{children:[(0,K.jsx)(_,{onClick:r,type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsx)(_,{type:`submit`,children:e===null?`Add condition`:`Save condition`})]})]})}function jn({condition:e,dateTimeText:t}){let n=e.rules.map(e=>qt(e,t)).join(` · `);return n===e.name?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}function Mn({template:e,onSaveCondition:t,onRemoveCondition:n,onMoveCondition:r}){let[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(null),c=N(i),l=N(o),{dateTimeText:u}=Cn(),{conditions:d}=e,f=c?.condition?.name??null,p=t=>{let r=Rt(e,t);r.length===0?n(t):s({name:t,users:r})};return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(Oe,{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)(Ae,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Conditions`})}),(0,K.jsx)(je,{className:`text-xs`,children:`Listed by priority: when several match a device, the first wins.`})]}),(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add condition`]})]}),(0,K.jsx)(ke,{className:`p-0`,children:d.length===0?(0,K.jsxs)(Re,{className:`py-10`,children:[(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(le,{})}),(0,K.jsx)(Ie,{children:`No conditions`}),(0,K.jsx)(Le,{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)(Fe,{children:(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add condition`]})})]}):(0,K.jsx)(`ol`,{"aria-label":`Conditions`,className:`divide-y`,children:d.map((t,n)=>{let i=Rt(e,t.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 ${n+1}`,className:`flex size-6 items-center justify-center rounded-md bg-muted text-xs font-medium tabular-nums`,children:n+1}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.name}),(0,K.jsx)(jn,{condition:t,dateTimeText:u}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:i.length===0?`No parameter uses it yet`:`Sets ${i.length===1?`1 parameter`:`${i.length} parameters`}: ${i.slice(0,3).join(`, `)}${i.length>3?`…`:``}`})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1 md:justify-end`,children:[(0,K.jsx)(_,{"aria-label":`Move ${t.name} up`,className:`size-11 md:size-7`,disabled:n===0,onClick:()=>r(n,-1),size:`icon`,variant:`ghost`,children:(0,K.jsx)(ft,{})}),(0,K.jsx)(_,{"aria-label":`Move ${t.name} down`,className:`size-11 md:size-7`,disabled:n===d.length-1,onClick:()=>r(n,1),size:`icon`,variant:`ghost`,children:(0,K.jsx)(dt,{})}),(0,K.jsxs)(_,{"aria-label":`Edit ${t.name}`,className:`min-h-11 md:min-h-7`,onClick:()=>a({condition:t}),size:`sm`,variant:`outline`,children:[(0,K.jsx)(fe,{"data-icon":`inline-start`}),`Edit`]}),(0,K.jsx)(_,{"aria-label":`Delete ${t.name}`,className:`size-11 md:size-7`,onClick:()=>p(t.name),size:`icon`,variant:`ghost`,children:(0,K.jsx)(Ee,{})})]})]},t.name)})})}),(0,K.jsx)(kn,{condition:c?.condition??null,onOpenChange:e=>{e||a(null)},onSave:e=>t(f,e),open:i!==null,takenNames:d.map(({name:e})=>e).filter(e=>e!==f)}),(0,K.jsx)($e,{onOpenChange:e=>{e||s(null)},open:o!==null,children:(0,K.jsxs)(qe,{children:[(0,K.jsxs)(Qe,{children:[(0,K.jsxs)(Je,{children:[`Delete `,l?.name,`?`]}),(0,K.jsxs)(Ke,{children:[l?.users.length===1?`1 parameter has a value for it`:`${l?.users.length} parameters have a value for it`,` `,`(`,l?.users.join(`, `),`). Those values are removed too, so matching devices get the default value after you publish.`]})]}),(0,K.jsxs)(Xe,{children:[(0,K.jsx)(Ze,{children:`Cancel`}),(0,K.jsx)(Ye,{onClick:e=>{e.preventDefault(),o!==null&&n(o.name),s(null)},variant:`destructive`,children:`Delete condition`})]})]})})]})}var Nn=e=>e===`BOOLEAN`?`false`:e===`NUMBER`?`0`:e===`JSON`?`{}`:``,Pn=(e,t)=>`value`in t?sn(e,t.value):null;function Fn({id:e,label:t,valueType:n,value:r,onChange:i,showErrors:a}){let o=!(`value`in r),s=`value`in r?r.value:``,c=a?Pn(n,r):null,l=e=>i({value:e});return(0,K.jsxs)(W,{"data-invalid":c!==null||void 0,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(H,{htmlFor:e,id:`${e}-label`,children:t}),(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)(we,{checked:o,id:`${e}-in-app-default`,onCheckedChange:e=>i(e?{useInAppDefault:!0}:{value:Nn(n)})}),(0,K.jsx)(`label`,{htmlFor:`${e}-in-app-default`,children:`Use in-app default`})]})]}),o?(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 }`,`)`]}),`.`]}):n===`BOOLEAN`?(0,K.jsxs)(xn,{"aria-labelledby":`${e}-label`,id:e,onValueChange:e=>{let[t]=e;(t===`true`||t===`false`)&&l(t)},value:[s],variant:`outline`,children:[(0,K.jsx)(Sn,{className:`min-h-11 px-4 sm:min-h-8`,value:`true`,children:`true`}),(0,K.jsx)(Sn,{className:`min-h-11 px-4 sm:min-h-8`,value:`false`,children:`false`})]}):n===`NUMBER`?(0,K.jsx)(m,{"aria-invalid":c!==null||void 0,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:e,inputMode:`decimal`,onChange:e=>l(e.target.value),value:s}):n===`JSON`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(_e,{"aria-invalid":c!==null||void 0,className:`min-h-24 font-mono text-xs`,id:e,onChange:e=>l(e.target.value),spellCheck:!1,value:s}),(0,K.jsxs)(_,{className:`self-start`,disabled:sn(`JSON`,s)!==null,onClick:()=>l(JSON.stringify(JSON.parse(s),null,2)),size:`sm`,type:`button`,variant:`outline`,children:[(0,K.jsx)(pt,{"data-icon":`inline-start`}),`Format JSON`]})]}):(0,K.jsx)(_e,{"aria-invalid":c!==null||void 0,className:`min-h-11 text-sm sm:min-h-9`,id:e,onChange:e=>l(e.target.value),rows:2,value:s}),(0,K.jsx)(U,{children:c})]})}var In=Object.keys(J),Ln={STRING:`getString`,NUMBER:`getNumber`,BOOLEAN:`getBoolean`,JSON:`getString`},Rn=(e,t)=>`value`in e&&Pn(t,e)!==null?{value:Nn(t)}:e;function zn({open:e,onOpenChange:t,parameterKey:n,parameter:r,takenKeys:i,conditions:a,onSave:o,onAddCondition:s}){let c=Ce(e);return(0,K.jsx)(V,{onOpenChange:t,open:e,children:(0,K.jsx)(rt,{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)(Bn,{conditions:a,onAddCondition:s,onCancel:()=>t(!1),onSave:(e,n)=>{o(e,n),t(!1)},parameter:r,parameterKey:n,takenKeys:i},c)})})}function Bn({parameterKey:e,parameter:t,takenKeys:r,conditions:i,onSave:a,onCancel:o,onAddCondition:s}){let c=(0,G.useId)(),{dateTimeText:l}=Cn(),[u,d]=(0,G.useState)(e??``),[f,p]=(0,G.useState)(t?.valueType??`STRING`),[h,g]=(0,G.useState)(t?.description??``),v=h.trim().length>256,[y,b]=(0,G.useState)(t?.defaultValue??{value:``}),[x,S]=(0,G.useState)(t?.conditionalValues??{}),[C,w]=(0,G.useState)({}),[T,ee]=(0,G.useState)(!1),[te,E]=(0,G.useState)(!1),D=on(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||v||[y,...Object.values(x)].some(e=>Pn(f,e)!==null),oe=e=>{p(e),b(Rn(y,e)),S(Object.fromEntries(Object.entries(x).map(([t,n])=>[t,Rn(n,e)])))},ce=e=>{let t=X(C,e);S({...x,[e]:t===void 0?{value:Nn(f)}:Rn(t,f)})},le=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:f,defaultValue:y,...Object.keys(t).length===0?{}:{conditionalValues:t},...h.trim().length===0?{}:{description:h.trim()}})},children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(it,{children:e===null?`Add parameter`:`Edit parameter`}),(0,K.jsxs)(at,{children:[`The app reads it with`,` `,(0,K.jsxs)(`code`,{className:`font-mono`,children:[`hotUpdater.remoteConfig.`,Ln[f],`("`,u.trim()||`key`,`")`]}),`, which is null when neither the server nor the app's defaults have a value.`]})]}),(0,K.jsxs)(ot,{children:[(0,K.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[minmax(0,1fr)_11rem]`,children:[(0,K.jsxs)(W,{"data-invalid":T&&D!==null||void 0,children:[(0,K.jsx)(H,{htmlFor:`${c}-key`,children:`Key`}),(0,K.jsx)(m,{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)(U,{children:T?D:null})]}),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${c}-type`,children:`Type`}),(0,K.jsxs)(se,{items:J,onValueChange:e=>{e!==null&&oe(e)},value:f,children:[(0,K.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${c}-type`,children:(0,K.jsx)(j,{})}),(0,K.jsx)(ie,{children:(0,K.jsx)(ae,{children:In.map(e=>(0,K.jsx)(A,{value:e,children:J[e]},e))})})]})]})]}),(0,K.jsxs)(W,{"data-invalid":v||void 0,children:[(0,K.jsx)(H,{htmlFor:`${c}-description`,children:`Description`}),(0,K.jsx)(m,{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)(U,{children:v?`Use 256 characters or fewer.`:null})]}),(0,K.jsx)(Fn,{id:`${c}-default`,label:`Default value`,onChange:b,showErrors:T,value:y,valueType:f}),(0,K.jsxs)(lt,{children:[(0,K.jsx)(ct,{variant:`label`,children:`Conditional values`}),(0,K.jsx)(st,{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)(jn,{condition:e,dateTimeText:l})]}),(0,K.jsxs)(_,{"aria-label":`Remove the value for ${e.name}`,className:`min-h-11 shrink-0 text-muted-foreground sm:min-h-7`,onClick:()=>le(e.name),size:`sm`,type:`button`,variant:`ghost`,children:[(0,K.jsx)(n,{"data-icon":`inline-start`}),`Remove value`]})]}),(0,K.jsx)(Fn,{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:f})]},e.name))}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0?(0,K.jsxs)(se,{items:Object.fromEntries(k.map(({name:e})=>[e,e])),onValueChange:e=>{e!==null&&ce(e)},value:null,children:[(0,K.jsxs)(re,{"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)(M,{"aria-hidden":`true`,className:`size-3.5`}),(0,K.jsx)(j,{placeholder:`Add a value for a condition`})]}),(0,K.jsx)(ie,{alignItemWithTrigger:!1,children:(0,K.jsx)(ae,{children:k.map(({name:e})=>(0,K.jsx)(A,{value:e,children:e},e))})})]}):null,(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-9`,onClick:()=>E(!0),type:`button`,variant:`outline`,children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`New condition`]})]})]})]}),(0,K.jsxs)(nt,{children:[(0,K.jsx)(_,{onClick:o,type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsx)(_,{type:`submit`,children:e===null?`Add parameter`:`Save parameter`})]})]}),(0,K.jsx)(kn,{condition:null,onOpenChange:E,onSave:e=>{s(e),ce(e.name)},open:te,takenNames:i.map(({name:e})=>e)})]})}function Vn({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 Hn({parameterKey:e,parameter:t,conditions:n,onEdit:r,onRemove:i}){let a=n.filter(({name:e})=>X(t.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)(z,{className:`shrink-0`,variant:`outline`,children:J[t.valueType]})]}),t.description===void 0?null:(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t.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:[a.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)(Vn,{text:Z(X(t.conditionalValues,e))})})]},e)),(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Default`}),(0,K.jsx)(`dd`,{className:`min-w-0`,children:`value`in t.defaultValue?(0,K.jsx)(Vn,{text:Z(t.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)(_,{"aria-label":`Edit ${e}`,className:`min-h-11 md:min-h-7`,onClick:r,size:`sm`,variant:`outline`,children:[(0,K.jsx)(fe,{"data-icon":`inline-start`}),`Edit`]}),(0,K.jsx)(_,{"aria-label":`Delete ${e}`,className:`size-11 md:size-7`,onClick:i,size:`icon`,variant:`ghost`,children:(0,K.jsx)(Ee,{})})]})]})}function Un({template:e,onSaveParameter:t,onRemoveParameter:n,onAddCondition:r}){let[i,a]=(0,G.useState)(null),o=N(i),[s,c]=(0,G.useState)(``),l=Object.keys(e.parameters),u=l.filter(e=>e.toLowerCase().includes(s.trim().toLowerCase())),d=o?.key??null;return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(Oe,{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)(Ae,{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:[l.length>5?(0,K.jsxs)(be,{className:`min-h-11 w-full sm:min-h-8 sm:w-56`,children:[(0,K.jsx)(ge,{children:(0,K.jsx)(xe,{"aria-hidden":`true`})}),(0,K.jsx)(he,{"aria-label":`Filter parameters by key`,className:`text-base sm:text-xs`,onChange:e=>c(e.target.value),placeholder:`Filter by key`,value:s})]}):null,(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add parameter`]})]})]}),(0,K.jsx)(ke,{className:`p-0`,children:l.length===0?(0,K.jsxs)(Re,{className:`py-10`,children:[(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(Se,{})}),(0,K.jsx)(Ie,{children:`No parameters`}),(0,K.jsx)(Le,{children:`Add a parameter, give it a default, then publish to change the app without a new build.`})]}),(0,K.jsx)(Fe,{children:(0,K.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,K.jsx)(M,{"data-icon":`inline-start`}),`Add parameter`]})})]}):u.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)(_,{onClick:()=>c(``),size:`sm`,variant:`outline`,children:`Clear filter`})]}):(0,K.jsx)(`ul`,{"aria-label":`Parameters`,className:`divide-y`,children:u.map(t=>(0,K.jsx)(Hn,{conditions:e.conditions,onEdit:()=>a({key:t,parameter:e.parameters[t]??null}),onRemove:()=>n(t),parameter:e.parameters[t],parameterKey:t},t))})}),(0,K.jsx)(zn,{conditions:e.conditions,onAddCondition:r,onOpenChange:e=>{e||a(null)},onSave:(e,n)=>t(d,e,n),open:i!==null,parameter:o?.parameter??null,parameterKey:d,takenKeys:l.filter(e=>e!==d)})]})}var Wn={platform:`ios`,channel:`production`,appVersion:`1.0.0`,cohort:`1`,fingerprintHash:``,at:``},Gn=(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 Kn({template:t,isDraft:n}){let r=(0,G.useId)(),[i,a]=(0,G.useState)(Wn),{at:o,...s}=Gn(i),c=Kt(o),l=At({template:t,context:{...s,...c===void 0?{}:{now:Date.parse(c)}}}),u=Object.keys(t.parameters),d=(e,t)=>a({...i,[e]:t});return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsxs)(Oe,{className:`border-b px-4 py-3 sm:px-6`,children:[(0,K.jsx)(Ae,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Preview a device`})}),(0,K.jsx)(je,{className:`text-xs`,children:n?`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)(ke,{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)(W,{children:[(0,K.jsx)(H,{htmlFor:`${r}-platform`,children:`Platform`}),(0,K.jsxs)(se,{items:{ios:`iOS`,android:`Android`},onValueChange:e=>{(e===`ios`||e===`android`)&&d(`platform`,e)},value:i.platform,children:[(0,K.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${r}-platform`,children:(0,K.jsxs)(j,{children:[(0,K.jsx)(et,{className:`size-3.5`,platform:i.platform}),i.platform===`ios`?`iOS`:`Android`]})}),(0,K.jsx)(ie,{children:(0,K.jsxs)(ae,{children:[(0,K.jsxs)(A,{value:`ios`,children:[(0,K.jsx)(et,{className:`size-3.5`,platform:`ios`}),`iOS`]}),(0,K.jsxs)(A,{value:`android`,children:[(0,K.jsx)(et,{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,n])=>(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${r}-${e}`,children:t}),(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 text-base sm:min-h-9 sm:text-xs`,id:`${r}-${e}`,onChange:t=>d(e,t.target.value),placeholder:n,spellCheck:!1,value:i[e]})]},e)),(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{htmlFor:`${r}-at`,children:`Time`}),(0,K.jsxs)(be,{className:`h-11 sm:h-9`,children:[(0,K.jsx)(he,{className:`h-11 text-base tabular-nums sm:h-9 sm:text-xs`,id:`${r}-at`,onChange:e=>d(`at`,e.target.value),type:`datetime-local`,value:i.at}),i.at.length===0?null:(0,K.jsx)(ge,{align:`inline-end`,children:(0,K.jsx)(ve,{className:`min-h-11 sm:min-h-6`,onClick:()=>d(`at`,``),size:`xs`,children:`Now`})})]})]})]}),u.length===0?(0,K.jsx)(Re,{className:`border py-8`,children:(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(Te,{})}),(0,K.jsx)(Ie,{children:`Nothing to preview`}),(0,K.jsx)(Le,{children:`Add a parameter, and its value for this device shows here.`})]})}):l.data?.status===`invalid`?(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`The draft has problems to fix first`}),(0,K.jsx)(F,{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)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`The preview couldn't be loaded`}),(0,K.jsx)(F,{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(t=>(0,K.jsx)(e,{className:`h-8 w-full`},t))]}):(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)(z,{variant:`outline`,children:`Default value`}):(0,K.jsx)(z,{variant:`secondary`,children:t.condition})})]},e)})})]})]})}function qn({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)(k,{"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 Jn({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)(qn,{fields:n(e),name:e},e))})})]},e))})]})}function Yn({open:e,onOpenChange:t,base:n,baseVersion:r,draft:i,onPublished:a,onLoadLatest:o,onPublishOver:s}){let c=(0,G.useId)(),l=Ot(),[u,d]=(0,G.useState)(``),[f,p]=(0,G.useState)(null),{dateTimeText:h}=Cn(),g=Xt(n,i),v=e=>{let t=Object.hasOwn(n.parameters,e)?n.parameters[e]:null,r=Object.hasOwn(i.parameters,e)?i.parameters[e]:null;return r===null?[]:Zt(t,r)},y=e=>{let t=n.conditions.find(t=>t.name===e)??null,r=i.conditions.find(t=>t.name===e)??null;return r===null?[]:Qt(t,r,h)},b=u.trim().length>256,x=e=>{l.isPending||(t(e),e||(p(null),l.reset()))};return(0,K.jsx)(V,{onOpenChange:x,open:e,children:(0,K.jsx)(rt,{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 l.mutateAsync({template:i,baseVersion:r,...u.trim().length===0?{}:{description:u.trim()}});p(e),e.status===`published`&&(B.success(`Published version ${e.version.version}`),d(``),p(null),t(!1),a())}catch(e){B.error(e instanceof Error?e.message:`Unable to publish`)}},children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(it,{children:`Publish changes`}),(0,K.jsxs)(at,{children:[`This becomes version `,r+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)(Jn,{changes:g.parameters,describe:v,label:`Parameters`}),(0,K.jsx)(Jn,{changes:g.conditions,describe:y,label:`Conditions`}),g.reordered?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Condition priority changed.`}):null]}),f?.status===`invalid`?(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`The server refused the template`}),(0,K.jsx)(F,{children:(0,K.jsx)(`ul`,{className:`list-disc pl-4`,children:f.issues.slice(0,6).map(e=>(0,K.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):null,f?.status===`conflict`?(0,K.jsxs)(I,{children:[(0,K.jsx)(L,{}),(0,K.jsxs)(P,{children:[`Version `,f.currentVersion,` was published while you edited`]}),(0,K.jsx)(F,{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)(_,{onClick:()=>{x(!1),o()},size:`sm`,type:`button`,variant:`outline`,children:[`Load version `,f.currentVersion]}),(0,K.jsx)(_,{onClick:()=>{s(f.currentVersion),p(null)},size:`sm`,type:`button`,variant:`ghost`,children:`Publish mine after it`})]})]}):null,(0,K.jsxs)(W,{"data-invalid":b||void 0,children:[(0,K.jsx)(H,{htmlFor:`${c}-description`,children:`Description`}),(0,K.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${c}-description`,onChange:e=>d(e.target.value),placeholder:`What changed and why`,value:u}),(0,K.jsx)(st,{children:`Shown in the version history.`}),(0,K.jsx)(U,{children:b?`Use 256 characters or fewer.`:null})]}),(0,K.jsxs)(nt,{children:[(0,K.jsx)(_,{disabled:l.isPending,onClick:()=>x(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,K.jsxs)(_,{disabled:l.isPending||f?.status===`conflict`,type:`submit`,children:[l.isPending?(0,K.jsx)(de,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,K.jsx)(ht,{"data-icon":`inline-start`}),`Publish version `,r+1]})]})]})})})}function Xn({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,gt.default)(e).format(`YYYY/MM/DD HH:mm`)})}function Zn({open:t,version:n,onOpenChange:r}){let i=Et(n),a=i.data===null||i.data===void 0?null:JSON.stringify(i.data.template,null,2);return(0,K.jsx)(V,{onOpenChange:r,open:t,children:(0,K.jsxs)(rt,{className:`max-h-[calc(100svh-2rem)] grid-rows-[auto_minmax(0,1fr)] sm:max-w-2xl`,children:[(0,K.jsxs)(tt,{children:[(0,K.jsxs)(it,{children:[`Version `,n]}),(0,K.jsx)(at,{children:`The template as it was published, in the JSON the admin API takes.`})]}),i.isLoading?(0,K.jsx)(e,{className:`h-48 w-full`}):i.isError?(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`This version couldn't be loaded`}),(0,K.jsx)(F,{children:`Check the connection and try again.`}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:()=>void i.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(me,{"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)(_,{className:`self-end`,onClick:()=>{navigator.clipboard.writeText(a).then(()=>B.success(`Template JSON copied`),()=>B.error(`Unable to copy the template`))},size:`sm`,variant:`outline`,children:[(0,K.jsx)(ce,{"data-icon":`inline-start`}),`Copy JSON`]})]})]})})}function Qn({activeVersion:t,hasDraft:n,onRolledBack:r,onStartEditing:i}){let a=Tt({enabled:!0}),o=kt(),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null),d=N(s),f=N(l),p=a.data?.pages.flatMap(e=>e.versions)??[],m=async e=>{if(e.preventDefault(),l!==null)try{let e=await o.mutateAsync({version:l.source,baseVersion:l.next-1});e.status===`published`?(B.success(`Version ${e.version.version} restores version ${l.source}`),r()):e.status===`conflict`?B.error(`Version ${e.currentVersion} was published meanwhile. Review it, then roll back again.`):B.error(`That version no longer exists.`),u(null)}catch(e){B.error(e instanceof Error?e.message:`Unable to roll back`)}};return(0,K.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,K.jsx)(Oe,{className:`border-b px-4 py-3 sm:px-6`,children:(0,K.jsx)(Ae,{className:`text-sm`,children:(0,K.jsx)(`h2`,{children:`Versions`})})}),(0,K.jsx)(ke,{className:`p-0`,children:a.isError?(0,K.jsx)(`div`,{className:`p-4`,children:(0,K.jsxs)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`Versions couldn't be loaded`}),(0,K.jsx)(F,{children:`Check the connection and try again.`}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:()=>void a.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(me,{"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},(t,n)=>(0,K.jsx)(e,{className:`h-10 w-full`},n))]}):p.length===0?(0,K.jsxs)(Re,{className:`py-10`,children:[(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Ne,{variant:`icon`,children:(0,K.jsx)(ue,{})}),(0,K.jsx)(Ie,{children:`No versions yet`}),(0,K.jsx)(Le,{children:`Your first publish becomes version 1. Every publish after it is kept here, ready to roll back to.`})]}),(0,K.jsx)(Fe,{children:(0,K.jsx)(_,{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:p.map(e=>(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 `,e.version]}),e.version===t?(0,K.jsx)(z,{children:`Active`}):null,e.updateType===`ROLLBACK`?(0,K.jsxs)(z,{variant:`outline`,children:[`Rollback to v`,e.rollbackSource]}):null]}),(0,K.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(Xn,{ms:e.createdAtMs}),e.description===null||e.updateType===`ROLLBACK`&&e.description===`Rollback to version ${e.rollbackSource}`?null:(0,K.jsxs)(K.Fragment,{children:[` · `,e.description]})]})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,K.jsxs)(_,{"aria-label":`View version ${e.version}`,className:`min-h-11 md:min-h-7`,onClick:()=>c(e.version),size:`sm`,variant:`ghost`,children:[(0,K.jsx)(mt,{"data-icon":`inline-start`}),`View`]}),(0,K.jsxs)(_,{"aria-label":`Roll back to version ${e.version}`,className:`min-h-11 md:min-h-7`,disabled:e.version===t,onClick:()=>u({source:e.version,next:t+1}),size:`sm`,variant:`outline`,children:[(0,K.jsx)(ye,{"data-icon":`inline-start`}),`Roll back`]})]})]},e.version))}),a.hasNextPage?(0,K.jsx)(`div`,{className:`border-t px-4 py-3 sm:px-6`,children:(0,K.jsxs)(_,{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)(de,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):null,`Load older versions`]})}):null]})}),(0,K.jsx)(Zn,{onOpenChange:e=>{e||c(null)},open:s!==null,version:d}),(0,K.jsx)($e,{onOpenChange:e=>{!o.isPending&&!e&&u(null)},open:l!==null,children:(0,K.jsxs)(qe,{children:[(0,K.jsxs)(Qe,{children:[(0,K.jsxs)(Je,{children:[`Roll back to version `,f?.source,`?`]}),(0,K.jsxs)(Ke,{children:[`Version `,f?.next,` will publish a copy of version`,` `,f?.source,`, and devices get its values on their next fetch.`,n?` Your unpublished changes are discarded.`:``]})]}),(0,K.jsxs)(Xe,{children:[(0,K.jsx)(Ze,{disabled:o.isPending,children:`Cancel`}),(0,K.jsxs)(Ye,{disabled:o.isPending,onClick:e=>void m(e),children:[o.isPending?(0,K.jsx)(de,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,K.jsx)(ye,{"data-icon":`inline-start`}),`Roll back`]})]})]})})]})}gt.default.extend(_t.default);var $n=[`parameters`,`conditions`,`preview`,`versions`];function er({tab:t,onTabChange:n}){let r=wt(),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),f=r.data,p=i?.template??f?.template,m=i!==null&&f!==void 0&&!jt(i.template,f.template),h=m&&f!==void 0&&i.baseVersion!==f.version;(0,G.useEffect)(()=>{if(o||f===void 0)return;s(!0);let e=nn(f);e!==null&&(a(e),l(!0))},[f,o]),(0,G.useEffect)(()=>{if(i===null||!m||rn(i))return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[i,m]);let g=()=>{a(null),l(!1),rn(null)},v=e=>{f===void 0||p===void 0||(l(!1),a({baseVersion:i?.baseVersion??f.version,base:i?.base??f.template,template:e(p)}))},b={parameters:p===void 0?null:Object.keys(p.parameters).length,conditions:p?.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)(y,{className:`-ml-1 size-11 lg:size-7`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,K.jsx)(`h1`,{className:`text-sm font-medium`,children:`Remote Config`})]}),f===void 0?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f.version===0?`Nothing published yet`:(0,K.jsxs)(K.Fragment,{children:[`Version `,f.version,f.updatedAtMs===null?null:(0,K.jsxs)(K.Fragment,{children:[` · published `,(0,K.jsx)(`time`,{dateTime:new Date(f.updatedAtMs).toISOString(),title:(0,gt.default)(f.updatedAtMs).format(`YYYY/MM/DD HH:mm:ss`),children:(0,gt.default)(f.updatedAtMs).fromNow()})]})]})}),m?(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,K.jsx)(z,{className:`hidden sm:inline-flex`,variant:`secondary`,children:`Unpublished changes`}),(0,K.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:g,variant:`ghost`,children:[(0,K.jsx)(De,{"data-icon":`inline-start`}),`Discard`]}),(0,K.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:()=>d(!0),children:[(0,K.jsx)(ht,{"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)(I,{variant:`destructive`,children:[(0,K.jsx)(L,{}),(0,K.jsx)(P,{children:`Remote Config couldn't be loaded`}),(0,K.jsx)(F,{children:`Check the connection and try again.`}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:()=>void r.refetch(),size:`xs`,variant:`outline`,children:[(0,K.jsx)(me,{"data-icon":`inline-start`}),`Retry`]})})]}):null,c&&m&&i!==null?(0,K.jsxs)(I,{children:[(0,K.jsx)(ue,{}),(0,K.jsx)(P,{children:`Your unpublished changes are back`}),(0,K.jsxs)(F,{children:[`This browser kept them from your last visit, on version`,` `,i.baseVersion,`.`]}),(0,K.jsx)(R,{children:(0,K.jsx)(_,{onClick:g,size:`xs`,variant:`outline`,children:`Discard them`})})]}):null,h&&i!==null&&f!==void 0?(0,K.jsxs)(I,{children:[(0,K.jsx)(L,{}),(0,K.jsxs)(P,{children:[`Version `,f.version,` was published while you edited`]}),(0,K.jsxs)(F,{children:[`Your draft started from version `,i.baseVersion,`. Discard it to review version `,f.version,`, or publish yours after it.`]}),(0,K.jsx)(R,{children:(0,K.jsxs)(_,{onClick:g,size:`xs`,variant:`outline`,children:[`Load version `,f.version]})})]}):null,(0,K.jsxs)(Ge,{onValueChange:e=>n(e),value:t,children:[(0,K.jsx)(We,{"aria-label":`Remote Config views`,className:`max-w-full group-data-horizontal/tabs:h-auto`,children:[[`parameters`,`Parameters`,b.parameters],[`conditions`,`Conditions`,b.conditions],[`preview`,`Preview`,null],[`versions`,`Versions`,null]].map(([e,t,n])=>(0,K.jsxs)(Ve,{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))}),p===void 0||f===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)(e,{className:`h-14 w-full`}),(0,K.jsx)(e,{className:`h-14 w-full`}),(0,K.jsx)(e,{className:`h-14 w-full`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(He,{value:`parameters`,children:(0,K.jsx)(Un,{onAddCondition:e=>v(t=>Ft(t,null,e)),onRemoveParameter:e=>v(t=>Nt(t,e)),onSaveParameter:(e,t,n)=>v(r=>Mt(r,e,t,n)),template:p})}),(0,K.jsx)(He,{value:`conditions`,children:(0,K.jsx)(Mn,{onMoveCondition:(e,t)=>v(n=>Lt(n,e,t)),onRemoveCondition:e=>v(t=>It(t,e)),onSaveCondition:(e,t)=>v(n=>Ft(n,e,t)),template:p})}),(0,K.jsx)(He,{value:`preview`,children:(0,K.jsx)(Kn,{isDraft:m,template:p})}),(0,K.jsx)(He,{value:`versions`,children:(0,K.jsx)(Qn,{activeVersion:f.version,hasDraft:m,onRolledBack:g,onStartEditing:()=>n(`parameters`)})})]})]})]})}),f!==void 0&&i!==null?(0,K.jsx)(Yn,{base:f.template,baseVersion:i.baseVersion,draft:i.template,onLoadLatest:g,onOpenChange:d,onPublishOver:e=>a({...i,baseVersion:e,base:f.template}),onPublished:g,open:u}):null]})}var tr=T(`/remote-config`)({beforeLoad:({context:e})=>O(e.queryClient,`remoteConfig`),notFoundComponent:te(()=>E(()=>import(`./remote-config-DAOyn5xL.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:te(()=>E(()=>import(`./remote-config-Cxkr7_BP.js`),__vite__mapDeps([8,2])),`component`),validateSearch:e=>$n.includes(e.tab)&&e.tab!==`parameters`?{tab:e.tab}:{}});export{er as n,tr as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-CVbPjRKo.js","assets/sidebar-yC7KdImc.js","assets/alert-dialog-CLC_h1fL.js","assets/select-CA8r-UUe.js","assets/useCompositeListItem-lAmUsXcc.js","assets/check-CqWNyG93.js","assets/switch-BTHWmKQ5.js","assets/valueToPercent-Db73Kirz.js","assets/link-CN3iHC4A.js","assets/arrow-right-CXp_K3xK.js","assets/arrow-up-right-BFafIOrq.js","assets/native-builds-BdzfAFnF.js","assets/copy-CH1__JAW.js","assets/dist-Bw_uSBJn.js","assets/uuidv7-CVJ09bBG.js","assets/chevron-right-DNbYTBX1.js","assets/circle-off-BCkZpskJ.js","assets/HashValueDisplay-DMweha_0.js","assets/RolloutPercentageBadge-BHgHkBGB.js","assets/relativeTime-CBmDq8wh.js","assets/badge-DJMW4YVM.js","assets/TargetDisplay-DB8D019f.js","assets/key-round-B-P_hhUB.js","assets/package-CXSDZsME.js","assets/list-fFsS8Wxe.js","assets/loader-circle-GWIgH0fo.js","assets/plus-Cx-yFNd9.js","assets/input-group-B7jx0icS.js","assets/trash-2-CYISg7ZF.js","assets/BundleIdDisplay-B0gAH01c.js","assets/RelativeTime-CY1dKZpv.js","assets/table-CwF7yxj4.js","assets/RowReason-BMx_vclu.js","assets/insights-search-TfRz5kGG.js","assets/insights-api-B6Gj74n5.js","assets/preload-helper-CRQjUQaZ.js","assets/PlatformIcon-BBvlg6JY.js","assets/card-C4sBAMU-.js","assets/dialog-tCTZmAo8.js","assets/field-DL4OXTJ7.js","assets/api-DLryz9hA.js","assets/useMutation-w3qYaU2L.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,Di as t,Hr as n,Oi as r,Vr as i,_r as a,et as o,vr as s,wi as c,zr as l}from"./sidebar-yC7KdImc.js";import{t as u}from"./link-CN3iHC4A.js";import{i as d,r as f,t as p}from"./preload-helper-CRQjUQaZ.js";import{a as m,i as h,o as g}from"./console-features-api-BO5V64P3.js";import{_,m as v,s as ee,x as y}from"./insights-api-B6Gj74n5.js";import{t as b}from"./key-round-B-P_hhUB.js";import{i as x}from"./switch-BTHWmKQ5.js";import{n as S,o as C}from"./insights-search-TfRz5kGG.js";import{a as w,i as T,n as E,o as D,t as O}from"./card-C4sBAMU-.js";var k=i(`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`}]]),A=t(),j={apiKeys:{navigation:{icon:(0,A.jsx)(b,{}),paths:[`/api-keys`],link:({onClick:e})=>(0,A.jsx)(u,{to:`/api-keys`,onClick:e})}}},M=c({method:`GET`}).middleware([l]).handler(r(`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 n({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)(C,{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:t,loading:n=!1,input:r,variant:i=`inline`}){if(!t)return n?(0,A.jsx)(e,{"aria-label":`Loading release insights`,className:i===`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 a=r?.builtIn===!0,o=a?0:I(t),c=(0,A.jsx)(`dl`,{className:s(i===`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:e,field:n,color:r})=>(0,A.jsxs)(`div`,{className:s(`flex`,i===`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:e}),(0,A.jsxs)(`dd`,{className:s(`flex flex-wrap items-baseline gap-x-1.5 tabular-nums`,i===`card`?`text-xl font-semibold`:`text-sm font-medium`,t[n]>0&&!(n===`downloads`&&a)?r:`text-muted-foreground`),children:[n===`downloads`&&a?(0,A.jsx)(`span`,{title:`The built-in bundle is never downloaded`,children:`—`}):t[n].toLocaleString(),n===`failedLaunches`?(0,A.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,F(t),`)`]}):null]})]},n))});return(0,A.jsxs)(`div`,{className:s(`flex`,i===`card`?`flex-col gap-2`:`items-center gap-1`),children:[r?(0,A.jsx)(u,{className:`relative min-w-0 rounded-sm after:absolute after:inset-x-0 after:-inset-y-3 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,to:`/insights`,search:{platform:r.platform,channel:r.channel,releaseId:r.releaseId,bundleWindow:S(r.releaseId)},children:c}):c,i===`card`&&o>0?(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[o.toLocaleString(),` downloaded but not launched yet: waiting for a restart, or passed over for a newer bundle.`]}):null,i===`inline`?(0,A.jsx)(L,{}):null]})}function z({input:t}){let n=ee({platform:t.platform,channel:t.channel,releaseId:t.releaseId}),r=n.data;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r?(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:s(`flex items-baseline gap-1.5 text-sm font-medium tabular-nums`,r.failedUpdates>0?`text-warning/85`:`text-muted-foreground`),children:[r.failedUpdates.toLocaleString(),(0,A.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,_(v(r)),`)`]})]})]})}):n.isPending?(0,A.jsx)(e,{"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)(C,{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:e}){let t=N([e]);return(0,A.jsxs)(O,{children:[(0,A.jsxs)(w,{className:`flex-row items-center justify-between px-4 pt-4 pb-3`,children:[(0,A.jsx)(D,{className:`text-sm font-medium`,children:`Insights`}),(0,A.jsx)(L,{})]}),(0,A.jsxs)(E,{className:`flex flex-col gap-3 px-4 pb-4`,children:[(0,A.jsx)(R,{variant:`card`,input:e,loading:t.isFetching,report:t.data?.[e.releaseId]}),(0,A.jsx)(o,{}),(0,A.jsx)(z,{input:e})]}),(0,A.jsx)(T,{className:`px-4 pb-4`,children:(0,A.jsxs)(u,{className:a({variant:`outline`,size:`sm`}),to:`/insights`,search:{platform:e.platform,channel:e.channel,releaseId:e.releaseId,bundleWindow:S(e.releaseId),healthChart:`adoption`},children:[(0,A.jsx)(k,{"aria-hidden":`true`,"data-icon":`inline-start`}),`View adoption`]})})]})}function V({input:e}){return h(`insightsAnalytics`)?null:(0,A.jsxs)(O,{children:[(0,A.jsx)(w,{className:`px-4 pt-4 pb-3`,children:(0,A.jsx)(D,{className:`text-sm font-medium`,children:`Insights`})}),(0,A.jsx)(E,{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)(u,{to:`/insights`,onClick:t}):(0,A.jsx)(u,{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)(x,{}),paths:[`/remote-config`],link:({onClick:e})=>(0,A.jsx)(u,{to:`/remote-config`,onClick:e})}}},K={...W,...j,...G},q=Object.keys(g),J=()=>{let e=m().data?.features;return e===void 0?[]:q.flatMap(t=>{let n=K[t];return n!==void 0&&e[t]?[{...n,feature:t,label:g[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 te(e){return $(e).kind!==`all`}function ne(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 re=d(`/`)({component:f(()=>p(()=>import(`./routes-CVbPjRKo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])),`component`),validateSearch:Q});export{X as a,ne as i,te as n,J as o,$ as r,Y as s,re as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-Des97uK_.js","assets/sidebar-yC7KdImc.js","assets/alert-dialog-Ch0QxRsa.js","assets/select-CA8r-UUe.js","assets/useCompositeListItem-lAmUsXcc.js","assets/check-CqWNyG93.js","assets/switch-BsV3d4km.js","assets/valueToPercent-Bn8p2lng.js","assets/link-CN3iHC4A.js","assets/arrow-right-CXp_K3xK.js","assets/arrow-up-right-BFafIOrq.js","assets/TargetDisplay-KU7JhIWG.js","assets/copy-CH1__JAW.js","assets/key-round-D7UgdXyA.js","assets/package-BmfoZ5Zj.js","assets/dist-DAM__Tdz.js","assets/HashValueDisplay-D2f0HmyU.js","assets/uuidv7-DAoOOpz9.js","assets/chevron-right-DNbYTBX1.js","assets/circle-off-BCkZpskJ.js","assets/download-B2GjTySo.js","assets/RolloutPercentageBadge-D_I0Raj2.js","assets/relativeTime-BYRt19mj.js","assets/badge-FZMD5vvS.js","assets/list-Bm-CfN5g.js","assets/loader-circle-iMqC-8ZE.js","assets/plus-Db0KxLZp.js","assets/input-group-XKLcUGoa.js","assets/trash-2-B5KIvrXy.js","assets/BundleIdDisplay-CTBdtFQ8.js","assets/ChannelBadge-CEabmopB.js","assets/RelativeTime-B4PK8qDw.js","assets/table-D8YjT_ht.js","assets/RowReason-B7VM1ztc.js","assets/insights-search-Bgvg6wSP.js","assets/insights-api-B6Gj74n5.js","assets/preload-helper-CRQjUQaZ.js","assets/PlatformIcon-DVnzzGqM.js","assets/card-CyHYmHue.js","assets/dialog-BLj71-Nf.js","assets/field-CdhSgWhI.js","assets/api-C1OPeiG1.js","assets/useMutation-w3qYaU2L.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,Di as t,Hr as n,Oi as r,Vr as i,_r as a,et as o,vr as s,wi as c,zr as l}from"./sidebar-yC7KdImc.js";import{t as u}from"./link-CN3iHC4A.js";import{i as d,r as f,t as p}from"./preload-helper-CRQjUQaZ.js";import{a as m,i as h,o as g}from"./console-features-api-BO5V64P3.js";import{_,m as v,s as ee,x as y}from"./insights-api-B6Gj74n5.js";import{t as b}from"./key-round-D7UgdXyA.js";import{i as x}from"./switch-BsV3d4km.js";import{n as S,o as C}from"./insights-search-Bgvg6wSP.js";import{a as w,i as T,n as E,o as D,t as O}from"./card-CyHYmHue.js";var k=i(`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`}]]),A=t(),j={apiKeys:{navigation:{icon:(0,A.jsx)(b,{}),paths:[`/api-keys`],link:({onClick:e})=>(0,A.jsx)(u,{to:`/api-keys`,onClick:e})}}},M=c({method:`GET`}).middleware([l]).handler(r(`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 n({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)(C,{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:t,loading:n=!1,input:r,variant:i=`inline`}){if(!t)return n?(0,A.jsx)(e,{"aria-label":`Loading release insights`,className:i===`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 a=r?.builtIn===!0,o=a?0:I(t),c=(0,A.jsx)(`dl`,{className:s(i===`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:e,field:n,color:r})=>(0,A.jsxs)(`div`,{className:s(`flex`,i===`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:e}),(0,A.jsxs)(`dd`,{className:s(`flex flex-wrap items-baseline gap-x-1.5 tabular-nums`,i===`card`?`text-xl font-semibold`:`text-sm font-medium`,t[n]>0&&!(n===`downloads`&&a)?r:`text-muted-foreground`),children:[n===`downloads`&&a?(0,A.jsx)(`span`,{title:`The built-in bundle is never downloaded`,children:`—`}):t[n].toLocaleString(),n===`failedLaunches`?(0,A.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,F(t),`)`]}):null]})]},n))});return(0,A.jsxs)(`div`,{className:s(`flex`,i===`card`?`flex-col gap-2`:`items-center gap-1`),children:[r?(0,A.jsx)(u,{className:`relative min-w-0 rounded-sm after:absolute after:inset-x-0 after:-inset-y-3 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,to:`/insights`,search:{platform:r.platform,channel:r.channel,releaseId:r.releaseId,bundleWindow:S(r.releaseId)},children:c}):c,i===`card`&&o>0?(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[o.toLocaleString(),` downloaded but not launched yet: waiting for a restart, or passed over for a newer bundle.`]}):null,i===`inline`?(0,A.jsx)(L,{}):null]})}function z({input:t}){let n=ee({platform:t.platform,channel:t.channel,releaseId:t.releaseId}),r=n.data;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r?(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:s(`flex items-baseline gap-1.5 text-sm font-medium tabular-nums`,r.failedUpdates>0?`text-warning/85`:`text-muted-foreground`),children:[r.failedUpdates.toLocaleString(),(0,A.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,_(v(r)),`)`]})]})]})}):n.isPending?(0,A.jsx)(e,{"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)(C,{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:e}){let t=N([e]);return(0,A.jsxs)(O,{children:[(0,A.jsxs)(w,{className:`flex-row items-center justify-between px-4 pt-4 pb-3`,children:[(0,A.jsx)(D,{className:`text-sm font-medium`,children:`Insights`}),(0,A.jsx)(L,{})]}),(0,A.jsxs)(E,{className:`flex flex-col gap-3 px-4 pb-4`,children:[(0,A.jsx)(R,{variant:`card`,input:e,loading:t.isFetching,report:t.data?.[e.releaseId]}),(0,A.jsx)(o,{}),(0,A.jsx)(z,{input:e})]}),(0,A.jsx)(T,{className:`px-4 pb-4`,children:(0,A.jsxs)(u,{className:a({variant:`outline`,size:`sm`}),to:`/insights`,search:{platform:e.platform,channel:e.channel,releaseId:e.releaseId,bundleWindow:S(e.releaseId),healthChart:`adoption`},children:[(0,A.jsx)(k,{"aria-hidden":`true`,"data-icon":`inline-start`}),`View adoption`]})})]})}function V({input:e}){return h(`insightsAnalytics`)?null:(0,A.jsxs)(O,{children:[(0,A.jsx)(w,{className:`px-4 pt-4 pb-3`,children:(0,A.jsx)(D,{className:`text-sm font-medium`,children:`Insights`})}),(0,A.jsx)(E,{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)(u,{to:`/insights`,onClick:t}):(0,A.jsx)(u,{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)(x,{}),paths:[`/remote-config`],link:({onClick:e})=>(0,A.jsx)(u,{to:`/remote-config`,onClick:e})}}},K={...W,...j,...G},q=Object.keys(g),J=()=>{let e=m().data?.features;return e===void 0?[]:q.flatMap(t=>{let n=K[t];return n!==void 0&&e[t]?[{...n,feature:t,label:g[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 te(e){return $(e).kind!==`all`}function ne(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 re=d(`/`)({component:f(()=>p(()=>import(`./routes-Des97uK_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])),`component`),validateSearch:Q});export{X as a,ne as i,te as n,J as o,$ as r,Y as s,re as t};