@hot-updater/console 1.2.0-rc.38 → 1.2.0-rc.39
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.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{-native-builds-search-BJPSRi4t.js → -native-builds-search-CRhUT348.js} +1 -1
- package/.output/public/assets/{ChannelBadge-B04sTjw5.js → ChannelBadge-B7DxBTj3.js} +1 -1
- package/.output/public/assets/{CompositeItem-CcgQyrSU.js → CompositeItem-AJPwCjWh.js} +1 -1
- package/.output/public/assets/{ConsoleFeatureUnavailable-P2up1IkX.js → ConsoleFeatureUnavailable-PXmQqkJQ.js} +1 -1
- package/.output/public/assets/{EventDetails-BYZUOYsT.js → EventDetails-C7rnoh47.js} +1 -1
- package/.output/public/assets/{HashValueDisplay-N89T2mVj.js → HashValueDisplay-DDz2Ecy7.js} +1 -1
- package/.output/public/assets/{InsightsPageHeader-DhOT-Tmn.js → InsightsPageHeader-C7BMHQtN.js} +1 -1
- package/.output/public/assets/{IosInstall-ChFnQISV.js → IosInstall-CJ0427uA.js} +1 -1
- package/.output/public/assets/{NativeBuildsNav-CivF1UpI.js → NativeBuildsNav-CZSaxAYo.js} +1 -1
- package/.output/public/assets/{RelativeTime-CAwDWRiM.js → RelativeTime-DxYXSuC4.js} +1 -1
- package/.output/public/assets/RolloutPercentageBadge-Di_Ca_ss.js +1 -0
- package/.output/public/assets/{RowReason-CRPq0CHS.js → RowReason-BvjPxMrd.js} +1 -1
- package/.output/public/assets/SandboxBadge-B_edulK_.js +1 -0
- package/.output/public/assets/{TargetDisplay-C6ofsnLc.js → TargetDisplay-CyBWoX-f.js} +1 -1
- package/.output/public/assets/api-keys-BhEu-4kH.js +1 -0
- package/.output/public/assets/{api-keys-Bjv4olzj.js → api-keys-D3TC5aQy.js} +1 -1
- package/.output/public/assets/{index-DzRyUcWR.js → index-MllyLAwb.js} +3 -3
- package/.output/public/assets/insights-Cl7F_W3G.js +1 -0
- package/.output/public/assets/{insights-B1yw5HMS.js → insights-DvMY7nq6.js} +1 -1
- package/.output/public/assets/insights-Z2S8xvnR.js +2 -0
- package/.output/public/assets/{insights-search-DmxDGWAA.js → insights-search-BCR_lahU.js} +1 -1
- package/.output/public/assets/insights_.distribution-BYakpdgY.js +2 -0
- package/.output/public/assets/insights_.distribution-D9yFYdru.js +1 -0
- package/.output/public/assets/{insights_.distribution-vyjSwP0f.js → insights_.distribution-QzaOKttT.js} +1 -1
- package/.output/public/assets/{installations-BfbwP-Ub.js → installations-BryK0NqR.js} +2 -2
- package/.output/public/assets/{installations-BKAdFmTM.js → installations-CzsM7ZGi.js} +1 -1
- package/.output/public/assets/installations-D758kWNf.js +1 -0
- package/.output/public/assets/{native-builds-DYvuFp4w.js → native-builds-3qvP-53q.js} +1 -1
- package/.output/public/assets/native-builds-BYQ8bQGN.js +1 -0
- package/.output/public/assets/native-builds-CnaQgVq6.js +2 -0
- package/.output/public/assets/native-builds_._buildId-D-eAGzXZ.js +2 -0
- package/.output/public/assets/native-builds_._buildId-D2-0EtFr.js +1 -0
- package/.output/public/assets/native-builds_.devices-D8CsVAuR.js +2 -0
- package/.output/public/assets/{native-builds_.devices-CjmuLWk7.js → native-builds_.devices-OQV8P5Hf.js} +1 -1
- package/.output/public/assets/remote-config-Bt6V_XHg.js +1 -0
- package/.output/public/assets/{remote-config-BopBV_qe.js → remote-config-CSJSQdOv.js} +1 -1
- package/.output/public/assets/{remote-config-FiUamvQE.js → remote-config-DNSdmvmp.js} +3 -3
- package/.output/public/assets/routes-DgbtNsWJ.js +1 -0
- package/.output/public/assets/{routes-DVuMMuc5.js → routes-DkzFq9jv.js} +2 -2
- package/.output/server/{__23tanstack-start-server-fn-resolver-BtWTR3K6.mjs → __23tanstack-start-server-fn-resolver-D-ox_XZH.mjs} +58 -58
- package/.output/server/_libs/_.mjs +1 -1
- package/.output/server/_ssr/{BundleIdDisplay-CoG9Vh6a.mjs → BundleIdDisplay-Dobgd7p0.mjs} +2 -2
- package/.output/server/_ssr/{ChannelBadge-OzIjNKqL.mjs → ChannelBadge-Dp9lOdkW.mjs} +3 -3
- package/.output/server/_ssr/{ConsoleFeatureUnavailable-jSQbtBgK.mjs → ConsoleFeatureUnavailable-sMoqvehk.mjs} +5 -5
- package/.output/server/_ssr/{EventDetails-CJrDHxsT.mjs → EventDetails-B2lRHRhs.mjs} +6 -6
- package/.output/server/_ssr/{HashValueDisplay-DcC8Slj7.mjs → HashValueDisplay-DgOVBPz-.mjs} +2 -2
- package/.output/server/_ssr/{InsightsPageHeader-BNH5TKN9.mjs → InsightsPageHeader-CFrO8ZhS.mjs} +5 -5
- package/.output/server/_ssr/{IosInstall-CuSgvhg-.mjs → IosInstall-COL13Y9Q.mjs} +6 -6
- package/.output/server/_ssr/{NativeBuildsNav-DAXCwIoa.mjs → NativeBuildsNav-DADiCA79.mjs} +3 -3
- package/.output/server/_ssr/{NotFoundPage-DffajSyb.mjs → NotFoundPage-C6fy3EQE.mjs} +2 -2
- package/.output/server/_ssr/{QrCode-DwBVEOIh.mjs → QrCode-pjBmMRNW.mjs} +2 -2
- package/.output/server/_ssr/{RelativeTime-CH0r_O2c.mjs → RelativeTime-ybh_YpRa.mjs} +3 -3
- package/.output/server/_ssr/{RolloutPercentageBadge-Bwn0TagX.mjs → RolloutPercentageBadge-Ck1Qz_u9.mjs} +3 -3
- package/.output/server/_ssr/{RowReason-DWr8eiRr.mjs → RowReason-DrDg86zk.mjs} +4 -4
- package/.output/server/_ssr/{SandboxBadge-D5ecaKjw.mjs → SandboxBadge-BVLfk_MI.mjs} +7 -19
- package/.output/server/_ssr/{TargetDisplay-sdzBTzVV.mjs → TargetDisplay-CcNoERcA.mjs} +3 -3
- package/.output/server/_ssr/{alert-dialog-BmbeXMVA.mjs → alert-dialog-Cneyp4SL.mjs} +1 -1
- package/.output/server/_ssr/{api-BHKgmaIU.mjs → api-D1iTDB8X.mjs} +3 -3
- package/.output/server/_ssr/{api-keys-BOVrv884.mjs → api-keys-BmByedx3.mjs} +2 -2
- package/.output/server/_ssr/{api-keys-BsnJI325.mjs → api-keys-L22cEsbx.mjs} +9 -9
- package/.output/server/_ssr/{api-keys-rpc-BLJiZe-7.mjs → api-keys-rpc-De0gejNE.mjs} +3 -3
- package/.output/server/_ssr/{api-rpc-CozVGcH5.mjs → api-rpc-CLUkjEzc.mjs} +7 -7
- package/.output/server/_ssr/{auth-rpc-DRY2e35e.mjs → auth-rpc-BR35Xq9A.mjs} +4 -4
- package/.output/server/_ssr/{auth.server-BMzf25uQ.mjs → auth.server-DGB_iSU1.mjs} +2 -2
- package/.output/server/_ssr/{badge-COm_alG-.mjs → badge-Cr_XmvdA.mjs} +1 -1
- package/.output/server/_ssr/{card-BFTQ_XzK.mjs → card-DmZaoqKT.mjs} +1 -1
- package/.output/server/_ssr/{config.server-Bv6DoXn5.mjs → config.server-B5Dghtv-.mjs} +3 -3
- package/.output/server/_ssr/{console-access-DEJ5MJE4.mjs → console-access-GUnQkD3j.mjs} +2 -2
- package/.output/server/_ssr/{console-features-api-BpiwpG_6.mjs → console-features-api-rDUY2XrP.mjs} +3 -3
- package/.output/server/_ssr/{console-features-rpc-VIMnfCAY.mjs → console-features-rpc-BJrkm9dz.mjs} +3 -3
- package/.output/server/_ssr/{dialog-BI3i27S5.mjs → dialog-BvTfEtqZ.mjs} +1 -1
- package/.output/server/_ssr/{empty-BFtyXzTb.mjs → empty-DD6BahGF.mjs} +2 -2
- package/.output/server/_ssr/{field-CrIyg_Pu.mjs → field-BTahddUR.mjs} +2 -2
- package/.output/server/_ssr/{input-group-CaQYmdpl.mjs → input-group-DtCeEJ9x.mjs} +1 -1
- package/.output/server/_ssr/{insights-BWhfhoIe.mjs → insights-BKG9fP-a.mjs} +5 -5
- package/.output/server/_ssr/{insights-BUS6BNcb.mjs → insights-ChiX0NMe.mjs} +19 -19
- package/.output/server/_ssr/{insights-D3FBuhNP.mjs → insights-DMnvHO-N.mjs} +2 -2
- package/.output/server/_ssr/{insights-api-Dp_g14ew.mjs → insights-api-Cpr7F9Zq.mjs} +3 -3
- package/.output/server/_ssr/{insights-failures-rpc-B9HE0jaG.mjs → insights-failures-rpc-ClIZ5YAr.mjs} +4 -4
- package/.output/server/_ssr/{insights-recovery-rpc-CItLuIvv.mjs → insights-recovery-rpc-9vTxL0b9.mjs} +3 -3
- package/.output/server/_ssr/{insights-rpc-BK9yCwTo.mjs → insights-rpc-ntVL4dMr.mjs} +3 -3
- package/.output/server/_ssr/{insights-search-C3zfHoQH.mjs → insights-search-BDC6qL_N.mjs} +2 -2
- package/.output/server/_ssr/{insights-usage-rpc-D5DLPj5-.mjs → insights-usage-rpc-B3tWIvs7.mjs} +3 -3
- package/.output/server/_ssr/{insights-usage-rpc-BgMHF87M.mjs → insights-usage-rpc-D1AH4wIp.mjs} +3 -3
- package/.output/server/_ssr/{insights_.distribution-Cn0HJH9g.mjs → insights_.distribution-16p6uw87.mjs} +2 -2
- package/.output/server/_ssr/{insights_.distribution-93_mA2-l.mjs → insights_.distribution-BQyY6j-B.mjs} +13 -13
- package/.output/server/_ssr/{insights_.distribution-CP9GZanc.mjs → insights_.distribution-Bs9C7zLO.mjs} +5 -5
- package/.output/server/_ssr/{installations-ysHMBT1s.mjs → installations-BjPcHbsA.mjs} +4 -4
- package/.output/server/_ssr/{installations-CY_qlCNv.mjs → installations-DD36dmtY.mjs} +2 -2
- package/.output/server/_ssr/{installations-CvmlbSO9.mjs → installations-DkAGd1RB.mjs} +11 -11
- package/.output/server/_ssr/{ios-devices-rpc-Dux6IEq9.mjs → ios-devices-rpc-CUe5hM5d.mjs} +7 -7
- package/.output/server/_ssr/{iosDeviceCookie-C8I4QNd8.mjs → iosDeviceCookie-DeLAGIDy.mjs} +3 -3
- package/.output/server/_ssr/{iosDeviceProfile-htlFx2Iz.mjs → iosDeviceProfile-DEhxhqB1.mjs} +2 -2
- package/.output/server/_ssr/{iosDevices-Bm5YmQne.mjs → iosDevices-DC6OSIpz.mjs} +2 -2
- package/.output/server/_ssr/{native-builds-DokuKdcX.mjs → native-builds-83NqyJmR.mjs} +2 -2
- package/.output/server/_ssr/{native-builds-DSDdaywn.mjs → native-builds-BVCLjZy3.mjs} +27 -54
- package/.output/server/_ssr/{native-builds_._buildId-xRldfNoO.mjs → native-builds_._buildId-CW246wU-.mjs} +55 -94
- package/.output/server/_ssr/{native-builds_._buildId-Dah2sUhQ.mjs → native-builds_._buildId-Dz3ZOBO4.mjs} +2 -2
- package/.output/server/_ssr/{native-builds_.devices-ObbbZTA2.mjs → native-builds_.devices-BcgwCDYe.mjs} +2 -2
- package/.output/server/_ssr/{native-builds_.devices-CC2uVmMy.mjs → native-builds_.devices-Cb1j7l0p.mjs} +15 -15
- package/.output/server/_ssr/{nativeBuildDownloadLink-D_Lc8Kdl.mjs → nativeBuildDownloadLink-S98Fp4EL.mjs} +2 -2
- package/.output/server/_ssr/{nativeBuildInstall-D-zJgIjg.mjs → nativeBuildInstall-CGx9_h9k.mjs} +3 -3
- package/.output/server/_ssr/{release-adoption-rpc-BmBnPwgL.mjs → release-adoption-rpc-CH1S7Q72.mjs} +5 -5
- package/.output/server/_ssr/{remote-config-Bj3_Vy5J.mjs → remote-config-B37Kf8E_.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-Cc61LMhc.mjs → remote-config-Bt9nmY6h.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-Dzb-so_N.mjs → remote-config-D5eSR-Oj.mjs} +17 -17
- package/.output/server/_ssr/{remote-config-rpc-D1bl95E9.mjs → remote-config-rpc-C47nnyek.mjs} +3 -3
- package/.output/server/_ssr/{router-B9WYJ0i8.mjs → router-CHveNRca.mjs} +32 -32
- package/.output/server/_ssr/{routes-CupMWrld.mjs → routes-Dfa8uOh-.mjs} +8 -8
- package/.output/server/_ssr/{routes-Cf4GSQVG.mjs → routes-t2IGGOuQ.mjs} +21 -21
- package/.output/server/_ssr/{schema-migration-rpc-BJfLrS5u.mjs → schema-migration-rpc-LvcWmZNf.mjs} +3 -3
- package/.output/server/_ssr/{select-BhlTavBg.mjs → select-BM4VyXJ2.mjs} +1 -1
- package/.output/server/_ssr/{server-CO04rHE0.mjs → server-ChOocPzQ.mjs} +3 -3
- package/.output/server/_ssr/{sidebar-kS1dkq7c.mjs → sidebar-DaVgRP2d.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +1 -1
- package/.output/server/_ssr/{switch-Up7u760a.mjs → switch-BSixbqb5.mjs} +2 -2
- package/.output/server/_ssr/{table-BVS2P58k.mjs → table-DIgStkYT.mjs} +1 -1
- package/.output/server/_ssr/{tabs-B-w3F332.mjs → tabs-BcBESH4i.mjs} +2 -2
- package/.output/server/_tanstack-start-manifest_v-CR_uX94i.mjs +223 -0
- package/.output/server/index.mjs +307 -307
- package/package.json +7 -7
- package/src/components/features/native-builds/BuiltInBundleCard.tsx +0 -6
- package/src/components/features/native-builds/InstallCard.tsx +48 -74
- package/src/components/features/native-builds/NativeBuildsTable.tsx +10 -40
- package/src/components/features/native-builds/playTracks.ts +4 -16
- package/.output/public/assets/RolloutPercentageBadge-DlaDqnOs.js +0 -1
- package/.output/public/assets/SandboxBadge-BpJoP3BG.js +0 -1
- package/.output/public/assets/api-keys-CrrBMw2x.js +0 -1
- package/.output/public/assets/insights-DuQ160fy.js +0 -2
- package/.output/public/assets/insights-QaHXTgmd.js +0 -1
- package/.output/public/assets/insights_.distribution-D2BkPvdk.js +0 -2
- package/.output/public/assets/insights_.distribution-gCONJgiU.js +0 -1
- package/.output/public/assets/installations-D5bvOxlY.js +0 -1
- package/.output/public/assets/native-builds-BqfRi0ou.js +0 -1
- package/.output/public/assets/native-builds-urjkBbVZ.js +0 -2
- package/.output/public/assets/native-builds_._buildId-Cy_v6FQF.js +0 -1
- package/.output/public/assets/native-builds_._buildId-EnQK17U1.js +0 -2
- package/.output/public/assets/native-builds_.devices-B6hLe0uI.js +0 -2
- package/.output/public/assets/remote-config-9h5s5yCy.js +0 -1
- package/.output/public/assets/routes-CMsRlxFp.js +0 -1
- package/.output/server/_tanstack-start-manifest_v-CGhBxSt1.mjs +0 -224
- /package/.output/public/assets/{BundleIdDisplay-Bm85NZma.js → BundleIdDisplay-Cz5MehaS.js} +0 -0
- /package/.output/public/assets/{NotFoundPage-DUWkihqx.js → NotFoundPage-DIwHXtYM.js} +0 -0
- /package/.output/public/assets/{PlatformIcon-CZjIJt0C.js → PlatformIcon-DjcYGkV6.js} +0 -0
- /package/.output/public/assets/{alert-dialog-ndHfUqUh.js → alert-dialog-C6K18pl_.js} +0 -0
- /package/.output/public/assets/{api-USY_IWMu.js → api-sTvbSydX.js} +0 -0
- /package/.output/public/assets/{badge-D4Tiwei-.js → badge-Cf3eoJjl.js} +0 -0
- /package/.output/public/assets/{card-VtWYErXu.js → card-CHIqYgB7.js} +0 -0
- /package/.output/public/assets/{constants-C5gi7fdZ.js → constants-zSb7FXDh.js} +0 -0
- /package/.output/public/assets/{dialog-Dx9gstou.js → dialog-ZrH3ul9A.js} +0 -0
- /package/.output/public/assets/{dist-BDfiL2Qz.js → dist-Dh2hrHKj.js} +0 -0
- /package/.output/public/assets/{empty-Cdfs8tuN.js → empty-Oq7fhUu4.js} +0 -0
- /package/.output/public/assets/{field-CubHQ_EM.js → field-BHPxgJmr.js} +0 -0
- /package/.output/public/assets/{git-branch-BWrvONjc.js → git-branch-BOz43vpU.js} +0 -0
- /package/.output/public/assets/{history-DwdBLzJP.js → history-Bz8IgNln.js} +0 -0
- /package/.output/public/assets/{input-group-DNfVeeYZ.js → input-group-cEQZv88S.js} +0 -0
- /package/.output/public/assets/{key-round-B-vaAsR7.js → key-round-Dy3paJP6.js} +0 -0
- /package/.output/public/assets/{list-Dq40Mmoj.js → list-ClzEOP6k.js} +0 -0
- /package/.output/public/assets/{loader-circle-C26cZDSM.js → loader-circle-BUfUHW-o.js} +0 -0
- /package/.output/public/assets/{plus-Bp6IqwOH.js → plus-CNhNPLpx.js} +0 -0
- /package/.output/public/assets/{relativeTime-Wk64dka-.js → relativeTime-CdKwnwWK.js} +0 -0
- /package/.output/public/assets/{rotate-cw-Bn3fIWmY.js → rotate-cw-CyYMmYDu.js} +0 -0
- /package/.output/public/assets/{search-DeKSyo9Q.js → search-C9QXSW-Z.js} +0 -0
- /package/.output/public/assets/{smartphone-lSZWrqxx.js → smartphone-NAD6OBaK.js} +0 -0
- /package/.output/public/assets/{switch-7xIPmzJp.js → switch-Bvelc7zQ.js} +0 -0
- /package/.output/public/assets/{table-DtcLx8yw.js → table-tm9RvUbS.js} +0 -0
- /package/.output/public/assets/{tabs-DYlO8l4M.js → tabs-TD0mdxc_.js} +0 -0
- /package/.output/public/assets/{trash-2-BPH7ydek.js → trash-2-SV8_CRNk.js} +0 -0
- /package/.output/public/assets/{undo-2-CGeTBZjC.js → undo-2-K3gpHMd2.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-
|
|
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,Q as c,Ri as l,Si as u,Sn as d,Sr as f,Vi as p,Vr 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-UnsNYOry.js";import{i as T,n as ee,r as te,t as E}from"./preload-helper-52zhjEsw.js";import{t as D}from"./useMutation-BWX97JX2.js";import{r as O}from"./console-features-api-De6tXQnd.js";import{t as k}from"./arrow-right-jHG0fJt7.js";import{i as ne}from"./useCompositeListItem-B9ONn9qn.js";import{a as re,i as A,n as ie,o as ae,r as oe,s as se,t as ce}from"./select-DSZKLAHH.js";import{t as le}from"./clipboard-D8uvj6FN.js";import{t as ue}from"./git-branch-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-Bt6V_XHg.js","assets/ConsoleFeatureUnavailable-PXmQqkJQ.js","assets/sidebar-UnsNYOry.js","assets/console-features-api-De6tXQnd.js","assets/arrow-up-right-BPRe5soE.js","assets/NotFoundPage-DIwHXtYM.js","assets/link-D95E0fwF.js","assets/empty-Oq7fhUu4.js","assets/remote-config-CSJSQdOv.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,Q as c,Ri as l,Si as u,Sn as d,Sr as f,Vi as p,Vr 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-UnsNYOry.js";import{i as T,n as ee,r as te,t as E}from"./preload-helper-52zhjEsw.js";import{t as D}from"./useMutation-BWX97JX2.js";import{r as O}from"./console-features-api-De6tXQnd.js";import{t as k}from"./arrow-right-jHG0fJt7.js";import{i as ne}from"./useCompositeListItem-B9ONn9qn.js";import{a as re,i as A,n as ie,o as ae,r as oe,s as se,t as ce}from"./select-DSZKLAHH.js";import{t as le}from"./clipboard-D8uvj6FN.js";import{t as ue}from"./git-branch-BOz43vpU.js";import{t as de}from"./history-Bz8IgNln.js";import{t as fe}from"./loader-circle-BUfUHW-o.js";import{n as pe,t as me}from"./CompositeItem-AJPwCjWh.js";import{t as j}from"./plus-CNhNPLpx.js";import{n as M,r as he}from"./dist-Dh2hrHKj.js";import{i as ge,n as _e,o as ve,r as ye,s as be,t as xe}from"./input-group-cEQZv88S.js";import{t as Se}from"./search-C9QXSW-Z.js";import{i as Ce,n as N,r as we,t as Te}from"./switch-Bvelc7zQ.js";import{t as Ee}from"./smartphone-NAD6OBaK.js";import{t as De}from"./trash-2-SV8_CRNk.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./badge-Cf3eoJjl.js";import{t as Oe}from"./undo-2-K3gpHMd2.js";import{a as B,n as ke,o as Ae,r as je,t as Me}from"./card-CHIqYgB7.js";import{n as Ne,t as Pe}from"./relativeTime-CdKwnwWK.js";import{a as V,i as Fe,n as Ie,o as Le,r as H,s as Re,t as U}from"./field-BHPxgJmr.js";import{i as ze}from"./api-sTvbSydX.js";import{a as Be,i as Ve,n as He,o as Ue,r as We,t as Ge}from"./empty-Oq7fhUu4.js";import{i as Ke,n as qe,o as Je,r as Ye,t as Xe}from"./tabs-TD0mdxc_.js";import{a as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,t as it}from"./alert-dialog-C6K18pl_.js";import{t as at}from"./PlatformIcon-DjcYGkV6.js";import{a as ot,i as st,n as ct,o as lt,r as ut,t as dt}from"./dialog-ZrH3ul9A.js";var ft=m(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),pt=m(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),mt=m(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),ht=m(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),gt=m(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),W=p(l()),G=r(),_t=p(Ne(),1),vt=p(Pe(),1),yt=x({method:`GET`}).middleware([w]).handler(s(`0ccfae64b399b03d820328fa98a38e2caa0b622d3da5a7ca633c5a0e8101e3f6`)),bt=x({method:`GET`}).middleware([w]).handler(s(`3377db68b9d1d971971595469029c0466da0777a177b294d655cd0c039737f1a`)),xt=x({method:`GET`}).middleware([w]).handler(s(`af71e3c55a659ce46093e33b9d70e729359610eec7d576502e8f0e26c785b317`)),St=x({method:`POST`}).middleware([w]).handler(s(`4182bf9ccbb675700638f30bc6122517ccd90b16a339a6823a0f5f6c808d70a6`)),Ct=x({method:`POST`}).middleware([w]).handler(s(`98c10bdc514eb4d3fe65af546be44452b492a81092cfe45625778a4c9f731727`)),wt=x({method:`POST`}).middleware([w]).handler(s(`1371bff16085636e2c44b60a573ae434b556c63045c40a0a93a93ab69ec47999`)),K={all:[`remote-config`],active:[`remote-config`,`active`],versions:[`remote-config`,`versions`],version:e=>[`remote-config`,`version`,e],preview:e=>[`remote-config`,`preview`,e]},Tt=()=>a({queryKey:K.active,queryFn:()=>yt(),staleTime:6e4}),Et=({enabled:e})=>ee({queryKey:K.versions,queryFn:({pageParam:e})=>bt({data:e===void 0?{}:{cursor:e}}),initialPageParam:void 0,getNextPageParam:e=>e.next,staleTime:6e4,enabled:e}),Dt=e=>a({queryKey:K.version(e??0),queryFn:()=>xt({data:{version:e}}),enabled:e!==null,staleTime:1/0}),Ot=()=>{let e=u();return async()=>{await Promise.all([e.invalidateQueries({queryKey:K.active}),e.invalidateQueries({queryKey:K.versions})])}},kt=()=>{let e=Ot();return D({mutationFn:e=>St({data:e}),onSuccess:async t=>{(t.status===`published`||t.status===`conflict`)&&await e()}})},At=()=>D({mutationFn:e=>Ct({data:e}),onSuccess:Ot()}),jt=e=>a({queryKey:K.preview(e),queryFn:()=>wt({data:e}),placeholderData:h,staleTime:1/0}),q={STRING:`String`,NUMBER:`Number`,BOOLEAN:`Boolean`,JSON:`JSON`},J={platform:`Platform`,channel:`Channel`,appVersion:`App version`,percent:`Percentage of installs`,cohort:`Cohort`,fingerprint:`Fingerprint`,dateTime:`Date and time`},Y=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,Mt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Nt=(e,t,n,r)=>{let i=Object.entries(e.parameters),a=t===null?-1:i.findIndex(([e])=>e===t),o=a===-1?[...i.filter(([e])=>e!==n),[n,r]]:i.map((e,t)=>t===a?[n,r]:e);return{...e,parameters:Object.fromEntries(o)}},Pt=(e,t)=>({...e,parameters:Object.fromEntries(Object.entries(e.parameters).filter(([e])=>e!==t))}),Ft=(e,t)=>Object.fromEntries(Object.entries(e.parameters).map(([e,n])=>{let{conditionalValues:r,...i}=n,a=Object.entries(r??{}).flatMap(([e,n])=>{let r=t(e);return r===null?[]:[[r,n]]});return[e,a.length===0?i:{...i,conditionalValues:Object.fromEntries(a)}]})),It=(e,t,n)=>t===null?{...e,conditions:[...e.conditions,n]}:{conditions:e.conditions.map(e=>e.name===t?n:e),parameters:t===n.name?e.parameters:Ft(e,e=>e===t?n.name:e)},Lt=(e,t)=>({conditions:e.conditions.filter(e=>e.name!==t),parameters:Ft(e,e=>e===t?null:e)}),Rt=(e,t,n)=>{let r=t+n;if(r<0||r>=e.conditions.length)return e;let i=[...e.conditions];return[i[t],i[r]]=[i[r],i[t]],{...e,conditions:i}},zt=(e,t)=>Object.entries(e.parameters).filter(([,e])=>Y(e.conditionalValues,t)!==void 0).map(([e])=>e),Bt=(e,t=3)=>e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} +${e.length-t}`,Vt=e=>Number.isInteger(e)?String(e):e.toFixed(1),Ht=e=>{let t=new Intl.DateTimeFormat(`en`,{timeZone:e,timeZoneName:e===`UTC`?`short`:`shortOffset`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});return e=>t.format(new Date(e))},Ut=Ht(`UTC`),Wt=(e=new Date)=>{let t=new Date(e);t.setMinutes(60,0,0);let n=new Date(e);n.setDate(n.getDate()+1),n.setHours(9,0,0,0);let r=new Date(e);return r.setSeconds(0,0),[{label:`Now`,iso:r.toISOString()},{label:`Next hour`,iso:t.toISOString()},{label:`Tomorrow 09:00`,iso:n.toISOString()}]},Gt=(e,t=new Date)=>{let n=e===void 0?t:new Date(e),r=e=>{let t=new Date(n);return t.setDate(t.getDate()+e),t.setSeconds(0,0),t.toISOString()};return[{label:`+1 day`,iso:r(1)},{label:`+1 week`,iso:r(7)}]},Kt=e=>{if(e===void 0)return``;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`},qt=e=>{if(e.length===0)return;let t=new Date(e).getTime();return Number.isFinite(t)?new Date(t).toISOString():void 0},Jt=(e,t=Ut)=>{switch(e.type){case`platform`:return`Platform is ${Bt(e.platforms.map(e=>e===`ios`?`iOS`:`Android`))}`;case`channel`:return`Channel is ${Bt(e.channels)}`;case`appVersion`:return`App version ${e.range}`;case`cohort`:return`Cohort is ${Bt(e.cohorts)}`;case`percent`:return e.from===0?`${Vt(e.to)}% of installs`:`${Vt(e.from)}–${Vt(e.to)}% of installs`;case`fingerprint`:return`Fingerprint is ${Bt(e.hashes.map(e=>e.slice(0,8)))}`;case`dateTime`:return e.from!==void 0&&e.to!==void 0?`From ${t(e.from)} until ${t(e.to)}`:e.from===void 0?`Until ${t(e.to??``)}`:`From ${t(e.from)}`}},X=e=>`value`in e?e.value.length===0?`""`:e.value:`In-app default`,Yt=()=>{let e=crypto.getRandomValues(new Uint8Array(6));return Array.from(e,e=>e.toString(36).padStart(2,`0`)).join(``).slice(0,8)},Xt=(e,t)=>({added:Object.keys(t).filter(t=>!Object.hasOwn(e,t)),changed:Object.keys(t).filter(n=>Object.hasOwn(e,n)&&JSON.stringify(e[n])!==JSON.stringify(t[n])),removed:Object.keys(e).filter(e=>!Object.hasOwn(t,e))}),Zt=(e,t)=>{let n=e=>Object.fromEntries(e.conditions.map(e=>[e.name,e])),r=(e,t)=>e.conditions.map(({name:e})=>e).filter(e=>t.conditions.some(t=>t.name===e));return{parameters:Xt(e.parameters,t.parameters),conditions:Xt(n(e),n(t)),reordered:r(e,t).join(`
|
|
3
3
|
`)!==r(t,e).join(`
|
|
4
4
|
`)}},Z=`Not set`,Qt=(e,t)=>{let n=[],r=(e,t,r)=>{(t===null?r!==Z:t!==r)&&n.push({field:e,before:t,after:r})};r(`Type`,e===null?null:q[e.valueType],q[t.valueType]),r(`Default`,e===null?null:X(e.defaultValue),X(t.defaultValue));let i=new Set([...Object.keys(e?.conditionalValues??{}),...Object.keys(t.conditionalValues??{})]);for(let n of i){let i=Y(e?.conditionalValues,n),a=Y(t.conditionalValues,n);r(`When ${n}`,e===null?null:i===void 0?Z:X(i),a===void 0?Z:X(a))}return r(`Description`,e===null?null:e.description??Z,t.description??Z),n},$t=(e,t,n=Ut)=>{let r=e=>e.rules.map(e=>Jt(e,n)).join(` · `),i=r(t);if(e===null)return[{field:`Rules`,before:null,after:i}];let a=r(e);return a===i?[]:[{field:`Rules`,before:a,after:i}]},en=`hot-updater:remote-config-draft`,Q=e=>typeof e==`object`&&!!e&&!Array.isArray(e),tn=e=>Q(e)&&(typeof e.value==`string`||e.useInAppDefault===!0),nn=e=>Q(e)&&Q(e.parameters)&&Array.isArray(e.conditions)&&Object.values(e.parameters).every(e=>Q(e)&&Object.hasOwn(q,String(e.valueType))&&tn(e.defaultValue)&&(e.conditionalValues===void 0||Q(e.conditionalValues)&&Object.values(e.conditionalValues).every(tn)))&&e.conditions.every(e=>Q(e)&&typeof e.name==`string`&&Array.isArray(e.rules)&&e.rules.every(e=>Q(e)&&Object.hasOwn(J,String(e.type)))),rn=e=>{try{let t=window.localStorage.getItem(en);if(t===null)return null;let n=JSON.parse(t);return!Q(n)||n.baseVersion!==e.version||!nn(n.base)||!nn(n.template)||!Mt(n.base,e.template)||Mt(n.template,e.template)?null:{baseVersion:e.version,base:n.base,template:n.template}}catch{return null}},an=e=>{try{return e===null?window.localStorage.removeItem(en):window.localStorage.setItem(en,JSON.stringify(e)),!0}catch{return!1}},on=/^[A-Za-z_][A-Za-z0-9_]{0,255}$/u,sn=(e,t)=>e.length===0?`Enter a key.`:on.test(e)?t.includes(e)?`Another parameter uses this key.`:null:`Start with a letter or _, then use letters, digits, and _.`,cn=(e,t)=>{if(e===`NUMBER`)return t.trim().length>0&&Number.isFinite(Number(t))?null:`Enter a number.`;if(e===`JSON`)try{return JSON.parse(t),null}catch{return`Enter valid JSON.`}return e===`BOOLEAN`&&t!==`true`&&t!==`false`?`Choose true or false.`:null},ln=(e,t,n)=>{let r=e.map(e=>Jt(e,n)).join(` · `),i=r.length<=100?r:`${r.slice(0,99).trimEnd()}…`;if(i.length===0||!t.includes(i))return i;for(let e=2;;e+=1){let n=` (${e})`,r=`${i.slice(0,100-n.length)}${n}`;if(!t.includes(r))return r}},un=(e,t)=>{let n=e.trim();return n.length===0?`Enter a name.`:n.length>100?`Use 100 characters or fewer.`:t.includes(n)?`Another condition uses this name.`:null},dn=e=>[...new Set(e.split(/[\n,]/u).map(e=>e.trim()).filter(e=>e.length>0))],fn=e=>{switch(e.type){case`platform`:return e.platforms.length===0?`Choose a platform.`:null;case`channel`:return e.channels.length===0?`Enter a channel.`:null;case`appVersion`:return e.range.trim().length===0?`Enter a version range, such as >=1.4.0.`:null;case`cohort`:return e.cohorts.length===0?`Enter a cohort.`:null;case`percent`:return e.from>=e.to||e.from<0||e.to>100||Math.abs(e.to*10-Math.round(e.to*10))>1e-9||Math.abs(e.from*10-Math.round(e.from*10))>1e-9?`Use a range from 0 to 100 in steps of 0.1.`:null;case`fingerprint`:return e.hashes.length===0?`Enter a fingerprint.`:null;case`dateTime`:return e.from===void 0&&e.to===void 0?`Choose a start, an end, or both.`:e.from!==void 0&&e.to!==void 0&&e.from>=e.to?`End after the start.`:null}},pn=e=>{switch(e){case`platform`:return{type:e,platforms:[`ios`]};case`channel`:return{type:e,channels:[]};case`appVersion`:return{type:e,range:``};case`cohort`:return{type:e,cohorts:[]};case`percent`:return{type:e,seed:Yt(),from:0,to:10};case`fingerprint`:return{type:e,hashes:[]};case`dateTime`:return{type:e,from:Wt()[1].iso}}},mn=W.createContext(void 0);function hn(e=!0){let t=W.useContext(mn);if(t===void 0&&!e)throw Error(v(7));return t}var gn=W.forwardRef(function(e,n){let{className:r,defaultPressed:a=!1,disabled:o=!1,form:s,onPressedChange:c,pressed:l,render:u,type:f,value:p,nativeButton:m=!0,style:h,..._}=e,v=g(p||void 0),y=hn(),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=d(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,G.jsx)(me,{tag:`button`,render:u,className:r,style:h,state:E,refs:D,props:O}):k}),_n=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),vn={multiple(e){return e?{[_n.multiple]:``}:null}},yn=W.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:d,style:p,...m}=e,h=se(!0),g=W.useMemo(()=>l!==void 0||n!==void 0,[l,n]),_=(h?.disabled??!1)||r,[v,y]=ne({controlled:l,default:l===void 0?n??f: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=W.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:vn});return(0,G.jsx)(mn.Provider,{value:C,children:h?T:(0,G.jsx)(Je,{render:d,className:u,style:p,state:x,refs:[t],props:[w,m],stateAttributesMapping:vn,loopFocus:i,enableHomeAndEndKeys:!0,orientation:s})})}),bn=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`}}),xn=W.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function Sn({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,G.jsx)(yn,{"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,G.jsx)(xn.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Cn({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=W.useContext(xn);return(0,G.jsx)(gn,{"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`,bn({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function $(){let[e,t]=(0,W.useState)(`UTC`);return(0,W.useEffect)(()=>{t(Intl.DateTimeFormat().resolvedOptions().timeZone)},[]),{timeZone:e,dateTimeText:(0,W.useMemo)(()=>Ht(e),[e])}}var wn=Object.keys(J);function Tn({id:e,values:t,onChange:n,placeholder:r,multiline:i=!1}){let[a,o]=(0,W.useState)(t.join(`, `)),[s,l]=(0,W.useState)(t);s!==t&&(l(t),dn(a).join(`
|
|
5
5
|
`)!==t.join(`
|
|
6
|
-
`)&&o(t.join(`, `)));let u=e=>{o(e),n(dn(e))};return i?(0,G.jsx)(ve,{className:`min-h-20 font-mono text-xs`,id:e,onChange:e=>u(e.target.value),placeholder:r,spellCheck:!1,value:a}):(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:e,onChange:e=>u(e.target.value),placeholder:r,value:a})}function En({id:e,label:t,value:r,presets:i,onChange:a}){return(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:e,children:t}),(0,G.jsxs)(xe,{className:`h-11 sm:h-9`,children:[(0,G.jsx)(ge,{className:`h-11 tabular-nums sm:h-9`,id:e,onChange:e=>a(qt(e.target.value)),type:`datetime-local`,value:Kt(r)}),r===void 0?null:(0,G.jsx)(_e,{align:`inline-end`,children:(0,G.jsx)(ye,{"aria-label":`Clear ${t.toLowerCase()}`,className:`size-11 sm:size-5`,onClick:()=>a(void 0),size:`icon-xs`,children:(0,G.jsx)(n,{})})})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,G.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,W.useId)(),r=ze();switch(e.type){case`platform`:return(0,G.jsx)(Sn,{"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,G.jsxs)(Cn,{className:`min-h-11 px-3 sm:min-h-8`,value:e,children:[(0,G.jsx)(at,{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,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Tn,{id:`${n}-channels`,onChange:n=>t({...e,channels:n}),placeholder:`production, beta`,values:e.channels}),i.length>0?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Add:`}),i.slice(0,8).map(n=>(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-6`,onClick:()=>t({...e,channels:[...e.channels,n]}),size:`xs`,type:`button`,variant:`outline`,children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),n]},n))]}):null]})}case`appVersion`:return(0,G.jsx)(c,{"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,G.jsx)(Tn,{id:`${n}-cohorts`,onChange:n=>t({...e,cohorts:n}),placeholder:`1, 2, beta-testers`,values:e.cohorts});case`percent`:return(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[repeat(2,minmax(0,8rem))_minmax(0,1fr)]`,children:[(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${n}-from`,children:`From %`}),(0,G.jsx)(c,{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,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${n}-to`,children:`To %`}),(0,G.jsx)(c,{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,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${n}-seed`,children:`Seed`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(c,{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,G.jsx)(_,{"aria-label":`New seed`,className:`size-11 sm:size-9`,onClick:()=>t({...e,seed:Yt()}),size:`icon`,type:`button`,variant:`outline`,children:(0,G.jsx)(he,{})})]})]})]});case`fingerprint`:return(0,G.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,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsx)(En,{id:`${n}-from`,label:`From`,onChange:e=>r(`from`,e),presets:Wt(),value:e.from}),(0,G.jsx)(En,{id:`${n}-until`,label:`Until`,onChange:e=>r(`to`,e),presets:Gt(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=we(e);return(0,G.jsx)(dt,{onOpenChange:t,open:e,children:(0,G.jsx)(ct,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-xl`,children:(0,G.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,W.useId)(),{dateTimeText:a,timeZone:o}=$(),[s,l]=(0,W.useState)(()=>e===null||e.name===ln(e.rules,t,a)?``:e.name),[u,d]=(0,W.useState)(e===null?[pn(`platform`)]:[...e.rules]),[f,p]=(0,W.useState)(!1),m=ln(u,t,a),h=s.trim().length===0?m:s,g=un(h,t),v=u.map(fn),y=wn.filter(e=>!u.some(t=>t.type===e)),b=g!==null||u.length===0||v.some(e=>e!==null);return(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),p(!0),!b&&n({name:h.trim(),rules:u.map(e=>e.type===`appVersion`?{...e,range:e.range.trim()}:e)})},children:[(0,G.jsxs)(ot,{children:[(0,G.jsx)(lt,{children:e===null?`Add condition`:`Edit condition`}),(0,G.jsx)(ut,{children:`A device matches when it matches every rule.`})]}),(0,G.jsxs)(Fe,{children:[(0,G.jsxs)(U,{"data-invalid":f&&g!==null||void 0,children:[(0,G.jsx)(V,{htmlFor:`${i}-name`,children:`Name`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${i}-name`,maxLength:101,onChange:e=>l(e.target.value),placeholder:m||`Beta testers on iOS`,value:s}),(0,G.jsx)(Ie,{children:`Optional: without one, it is named after its rules.`}),(0,G.jsx)(H,{children:f?g:null})]}),(0,G.jsxs)(Re,{children:[(0,G.jsx)(Le,{variant:`label`,children:`Rules`}),u.length===0?(0,G.jsx)(H,{children:f?`Add at least one rule.`:null}):null,(0,G.jsx)(`ol`,{className:`flex flex-col gap-3`,children:u.map((e,t)=>(0,G.jsx)(`li`,{className:`rounded-lg border p-3`,children:(0,G.jsxs)(U,{"data-invalid":f&&v[t]!==null||void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:J[e.type]}),(0,G.jsx)(_,{"aria-label":`Remove the ${J[e.type].toLowerCase()} rule`,className:`size-11 sm:size-7`,onClick:()=>d(u.filter((e,n)=>n!==t)),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,G.jsx)(De,{})})]}),(0,G.jsx)(Dn,{onChange:e=>d(u.map((n,r)=>r===t?e:n)),rule:e}),(0,G.jsx)(Ie,{children:e.type===`dateTime`?`In your time zone, ${o}. ${On.dateTime}`:On[e.type]}),(0,G.jsx)(H,{children:f?v[t]:null})]})},e.type))}),y.length>0?(0,G.jsxs)(ce,{items:Object.fromEntries(y.map(e=>[e,J[e]])),onValueChange:e=>{e!==null&&d([...u,pn(e)])},value:null,children:[(0,G.jsxs)(re,{"aria-label":`Add a rule`,className:`min-h-11 w-full sm:min-h-9 sm:w-56`,children:[(0,G.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),(0,G.jsx)(ae,{placeholder:`Add a rule`})]}),(0,G.jsx)(ie,{alignItemWithTrigger:!1,children:(0,G.jsx)(oe,{children:y.map(e=>(0,G.jsx)(A,{value:e,children:J[e]},e))})})]}):null]})]}),(0,G.jsxs)(st,{children:[(0,G.jsx)(_,{onClick:r,type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsx)(_,{type:`submit`,children:e===null?`Add condition`:`Save condition`})]})]})}function jn({condition:e,dateTimeText:t}){let n=e.rules.map(e=>Jt(e,t)).join(` · `);return n===e.name?null:(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}function Mn({template:e,onSaveCondition:t,onRemoveCondition:n,onMoveCondition:r}){let[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=N(i),l=N(o),{dateTimeText:u}=$(),{conditions:d}=e,f=c?.condition?.name??null,p=t=>{let r=zt(e,t);r.length===0?n(t):s({name:t,users:r})};return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(B,{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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Conditions`})}),(0,G.jsx)(je,{className:`text-xs`,children:`Listed by priority: when several match a device, the first wins.`})]}),(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add condition`]})]}),(0,G.jsx)(ke,{className:`p-0`,children:d.length===0?(0,G.jsxs)(Ge,{className:`py-10`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(ue,{})}),(0,G.jsx)(Ue,{children:`No conditions`}),(0,G.jsx)(We,{children:`Add a condition to give some devices other values: a platform, channel, app version range, cohort, or a share of installs.`})]}),(0,G.jsx)(He,{children:(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add condition`]})})]}):(0,G.jsx)(`ol`,{"aria-label":`Conditions`,className:`divide-y`,children:d.map((t,n)=>{let i=zt(e,t.name);return(0,G.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,G.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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.name}),(0,G.jsx)(jn,{condition:t,dateTimeText:u}),(0,G.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,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 md:justify-end`,children:[(0,G.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,G.jsx)(pt,{})}),(0,G.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,G.jsx)(ft,{})}),(0,G.jsxs)(_,{"aria-label":`Edit ${t.name}`,className:`min-h-11 md:min-h-7`,onClick:()=>a({condition:t}),size:`sm`,variant:`outline`,children:[(0,G.jsx)(pe,{"data-icon":`inline-start`}),`Edit`]}),(0,G.jsx)(_,{"aria-label":`Delete ${t.name}`,className:`size-11 md:size-7`,onClick:()=>p(t.name),size:`icon`,variant:`ghost`,children:(0,G.jsx)(De,{})})]})]},t.name)})})}),(0,G.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,G.jsx)(it,{onOpenChange:e=>{e||s(null)},open:o!==null,children:(0,G.jsxs)(Qe,{children:[(0,G.jsxs)(rt,{children:[(0,G.jsxs)($e,{children:[`Delete `,l?.name,`?`]}),(0,G.jsxs)(Ze,{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,G.jsxs)(tt,{children:[(0,G.jsx)(nt,{children:`Cancel`}),(0,G.jsx)(et,{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?cn(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:``,l=a?Pn(n,r):null,u=e=>i({value:e});return(0,G.jsxs)(U,{"data-invalid":l!==null||void 0,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(V,{htmlFor:e,id:`${e}-label`,children:t}),(0,G.jsxs)(`div`,{className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground sm:min-h-0`,children:[(0,G.jsx)(Te,{checked:o,id:`${e}-in-app-default`,onCheckedChange:e=>i(e?{useInAppDefault:!0}:{value:Nn(n)})}),(0,G.jsx)(`label`,{htmlFor:`${e}-in-app-default`,children:`Use in-app default`})]})]}),o?(0,G.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,G.jsxs)(`code`,{className:`font-mono`,children:[`remoteConfig(`,`{ defaults }`,`)`]}),`.`]}):n===`BOOLEAN`?(0,G.jsxs)(Sn,{"aria-labelledby":`${e}-label`,id:e,onValueChange:e=>{let[t]=e;(t===`true`||t===`false`)&&u(t)},value:[s],variant:`outline`,children:[(0,G.jsx)(Cn,{className:`min-h-11 px-4 sm:min-h-8`,value:`true`,children:`true`}),(0,G.jsx)(Cn,{className:`min-h-11 px-4 sm:min-h-8`,value:`false`,children:`false`})]}):n===`NUMBER`?(0,G.jsx)(c,{"aria-invalid":l!==null||void 0,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:e,inputMode:`decimal`,onChange:e=>u(e.target.value),value:s}):n===`JSON`?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(ve,{"aria-invalid":l!==null||void 0,className:`min-h-24 font-mono text-xs`,id:e,onChange:e=>u(e.target.value),spellCheck:!1,value:s}),(0,G.jsxs)(_,{className:`self-start`,disabled:cn(`JSON`,s)!==null,onClick:()=>u(JSON.stringify(JSON.parse(s),null,2)),size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(mt,{"data-icon":`inline-start`}),`Format JSON`]})]}):(0,G.jsx)(ve,{"aria-invalid":l!==null||void 0,className:`min-h-11 text-sm sm:min-h-9`,id:e,onChange:e=>u(e.target.value),rows:2,value:s}),(0,G.jsx)(H,{children:l})]})}var In=Object.keys(q),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=we(e);return(0,G.jsx)(dt,{onOpenChange:t,open:e,children:(0,G.jsx)(ct,{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,G.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 l=(0,W.useId)(),{dateTimeText:u}=$(),[d,f]=(0,W.useState)(e??``),[p,m]=(0,W.useState)(t?.valueType??`STRING`),[h,g]=(0,W.useState)(t?.description??``),v=h.trim().length>256,[y,b]=(0,W.useState)(t?.defaultValue??{value:``}),[x,S]=(0,W.useState)(t?.conditionalValues??{}),[C,w]=(0,W.useState)({}),[T,ee]=(0,W.useState)(!1),[te,E]=(0,W.useState)(!1),D=sn(d.trim(),r),O=i.filter(({name:e})=>Y(x,e)!==void 0),k=i.filter(({name:e})=>Y(x,e)===void 0),ne=D!==null||v||[y,...Object.values(x)].some(e=>Pn(p,e)!==null),se=e=>{m(e),b(Rn(y,e)),S(Object.fromEntries(Object.entries(x).map(([t,n])=>[t,Rn(n,e)])))},le=e=>{let t=Y(C,e);S({...x,[e]:t===void 0?{value:Nn(p)}:Rn(t,p)})},ue=e=>{let{[e]:t,...n}=x;t!==void 0&&w({...C,[e]:t}),S(n)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.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,Y(x,e)]));a(d.trim(),{valueType:p,defaultValue:y,...Object.keys(t).length===0?{}:{conditionalValues:t},...h.trim().length===0?{}:{description:h.trim()}})},children:[(0,G.jsxs)(ot,{children:[(0,G.jsx)(lt,{children:e===null?`Add parameter`:`Edit parameter`}),(0,G.jsxs)(ut,{children:[`The app reads it with`,` `,(0,G.jsxs)(`code`,{className:`font-mono`,children:[`hotUpdater.remoteConfig.`,Ln[p],`("`,d.trim()||`key`,`")`]}),`, which is null when neither the server nor the app's defaults have a value.`]})]}),(0,G.jsxs)(Fe,{children:[(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[minmax(0,1fr)_11rem]`,children:[(0,G.jsxs)(U,{"data-invalid":T&&D!==null||void 0,children:[(0,G.jsx)(V,{htmlFor:`${l}-key`,children:`Key`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${l}-key`,maxLength:257,onChange:e=>f(e.target.value),placeholder:`welcome_message`,spellCheck:!1,value:d}),(0,G.jsx)(H,{children:T?D:null})]}),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${l}-type`,children:`Type`}),(0,G.jsxs)(ce,{items:q,onValueChange:e=>{e!==null&&se(e)},value:p,children:[(0,G.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${l}-type`,children:(0,G.jsx)(ae,{})}),(0,G.jsx)(ie,{children:(0,G.jsx)(oe,{children:In.map(e=>(0,G.jsx)(A,{value:e,children:q[e]},e))})})]})]})]}),(0,G.jsxs)(U,{"data-invalid":v||void 0,children:[(0,G.jsx)(V,{htmlFor:`${l}-description`,children:`Description`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${l}-description`,onChange:e=>g(e.target.value),placeholder:`Optional: what the app does with it`,value:h}),(0,G.jsx)(H,{children:v?`Use 256 characters or fewer.`:null})]}),(0,G.jsx)(Fn,{id:`${l}-default`,label:`Default value`,onChange:b,showErrors:T,value:y,valueType:p}),(0,G.jsxs)(Re,{children:[(0,G.jsx)(Le,{variant:`label`,children:`Conditional values`}),(0,G.jsx)(Ie,{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,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:O.map(e=>(0,G.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),(0,G.jsx)(jn,{condition:e,dateTimeText:u})]}),(0,G.jsxs)(_,{"aria-label":`Remove the value for ${e.name}`,className:`min-h-11 shrink-0 text-muted-foreground sm:min-h-7`,onClick:()=>ue(e.name),size:`sm`,type:`button`,variant:`ghost`,children:[(0,G.jsx)(n,{"data-icon":`inline-start`}),`Remove value`]})]}),(0,G.jsx)(Fn,{id:`${l}-${e.name}`,label:(0,G.jsxs)(G.Fragment,{children:[`Value`,(0,G.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]}),onChange:t=>S({...x,[e.name]:t}),showErrors:T,value:Y(x,e.name),valueType:p})]},e.name))}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0?(0,G.jsxs)(ce,{items:Object.fromEntries(k.map(({name:e})=>[e,e])),onValueChange:e=>{e!==null&&le(e)},value:null,children:[(0,G.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,G.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),(0,G.jsx)(ae,{placeholder:`Add a value for a condition`})]}),(0,G.jsx)(ie,{alignItemWithTrigger:!1,children:(0,G.jsx)(oe,{children:k.map(({name:e})=>(0,G.jsx)(A,{value:e,children:e},e))})})]}):null,(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-9`,onClick:()=>E(!0),type:`button`,variant:`outline`,children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`New condition`]})]})]})]}),(0,G.jsxs)(st,{children:[(0,G.jsx)(_,{onClick:o,type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsx)(_,{type:`submit`,children:e===null?`Add parameter`:`Save parameter`})]})]}),(0,G.jsx)(kn,{condition:null,onOpenChange:E,onSave:e=>{s(e),le(e.name)},open:te,takenNames:i.map(({name:e})=>e)})]})}function Vn({text:e}){return(0,G.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})=>Y(t.conditionalValues,e)!==void 0);return(0,G.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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-mono text-sm font-medium`,children:e}),(0,G.jsx)(z,{className:`shrink-0`,variant:`outline`,children:q[t.valueType]})]}),t.description===void 0?null:(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t.description})]}),(0,G.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,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`line-clamp-2 break-words text-muted-foreground`,title:e,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:(0,G.jsx)(Vn,{text:X(Y(t.conditionalValues,e))})})]},e)),(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:`Default`}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:`value`in t.defaultValue?(0,G.jsx)(Vn,{text:X(t.defaultValue)}):(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`In-app default`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,G.jsxs)(_,{"aria-label":`Edit ${e}`,className:`min-h-11 md:min-h-7`,onClick:r,size:`sm`,variant:`outline`,children:[(0,G.jsx)(pe,{"data-icon":`inline-start`}),`Edit`]}),(0,G.jsx)(_,{"aria-label":`Delete ${e}`,className:`size-11 md:size-7`,onClick:i,size:`icon`,variant:`ghost`,children:(0,G.jsx)(De,{})})]})]})}function Un({template:e,onSaveParameter:t,onRemoveParameter:n,onAddCondition:r}){let[i,a]=(0,W.useState)(null),o=N(i),[s,c]=(0,W.useState)(``),l=Object.keys(e.parameters),u=l.filter(e=>e.toLowerCase().includes(s.trim().toLowerCase())),d=o?.key??null;return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(B,{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,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Parameters`})}),(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap gap-2 sm:w-auto`,children:[l.length>5?(0,G.jsxs)(xe,{className:`min-h-11 w-full sm:min-h-8 sm:w-56`,children:[(0,G.jsx)(_e,{children:(0,G.jsx)(Se,{"aria-hidden":`true`})}),(0,G.jsx)(ge,{"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,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add parameter`]})]})]}),(0,G.jsx)(ke,{className:`p-0`,children:l.length===0?(0,G.jsxs)(Ge,{className:`py-10`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(Ce,{})}),(0,G.jsx)(Ue,{children:`No parameters`}),(0,G.jsx)(We,{children:`Add a parameter, give it a default, then publish to change the app without a new build.`})]}),(0,G.jsx)(He,{children:(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add parameter`]})})]}):u.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-xs text-muted-foreground`,children:[(0,G.jsx)(`p`,{className:`font-medium text-foreground`,children:`No matching keys`}),(0,G.jsx)(_,{onClick:()=>c(``),size:`sm`,variant:`outline`,children:`Clear filter`})]}):(0,G.jsx)(`ul`,{"aria-label":`Parameters`,className:`divide-y`,children:u.map(t=>(0,G.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,G.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,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n};function Kn({template:t,isDraft:n}){let r=(0,W.useId)(),[i,a]=(0,W.useState)(Wn),{at:o,...s}=Gn(i),l=qt(o),u=jt({template:t,context:{...s,...l===void 0?{}:{now:Date.parse(l)}}}),d=Object.keys(t.parameters),f=(e,t)=>a({...i,[e]:t});return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(B,{className:`border-b px-4 py-3 sm:px-6`,children:[(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Preview a device`})}),(0,G.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,G.jsxs)(ke,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-platform`,children:`Platform`}),(0,G.jsxs)(ce,{items:{ios:`iOS`,android:`Android`},onValueChange:e=>{(e===`ios`||e===`android`)&&f(`platform`,e)},value:i.platform,children:[(0,G.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${r}-platform`,children:(0,G.jsxs)(ae,{children:[(0,G.jsx)(at,{className:`size-3.5`,platform:i.platform}),i.platform===`ios`?`iOS`:`Android`]})}),(0,G.jsx)(ie,{children:(0,G.jsxs)(oe,{children:[(0,G.jsxs)(A,{value:`ios`,children:[(0,G.jsx)(at,{className:`size-3.5`,platform:`ios`}),`iOS`]}),(0,G.jsxs)(A,{value:`android`,children:[(0,G.jsx)(at,{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,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-${e}`,children:t}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 text-base sm:min-h-9 sm:text-xs`,id:`${r}-${e}`,onChange:t=>f(e,t.target.value),placeholder:n,spellCheck:!1,value:i[e]})]},e)),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-at`,children:`Time`}),(0,G.jsxs)(xe,{className:`h-11 sm:h-9`,children:[(0,G.jsx)(ge,{className:`h-11 text-base tabular-nums sm:h-9 sm:text-xs`,id:`${r}-at`,onChange:e=>f(`at`,e.target.value),type:`datetime-local`,value:i.at}),i.at.length===0?null:(0,G.jsx)(_e,{align:`inline-end`,children:(0,G.jsx)(ye,{className:`min-h-11 sm:min-h-6`,onClick:()=>f(`at`,``),size:`xs`,children:`Now`})})]})]})]}),d.length===0?(0,G.jsx)(Ge,{className:`border py-8`,children:(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(Ee,{})}),(0,G.jsx)(Ue,{children:`Nothing to preview`}),(0,G.jsx)(We,{children:`Add a parameter, and its value for this device shows here.`})]})}):u.data?.status===`invalid`?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`The draft has problems to fix first`}),(0,G.jsx)(F,{children:(0,G.jsx)(`ul`,{className:`list-disc pl-4`,children:u.data.issues.slice(0,5).map(e=>(0,G.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):u.isError?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`The preview couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection, then change a field to try again.`})]}):u.data===void 0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading the preview`}),d.slice(0,4).map(t=>(0,G.jsx)(e,{className:`h-8 w-full`},t))]}):(0,G.jsx)(`dl`,{"aria-busy":u.isFetching||void 0,className:`divide-y rounded-lg border`,children:d.map(e=>{let t=u.data.status===`ok`?u.data.parameters[e]:void 0;return(0,G.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,G.jsx)(`dt`,{className:`truncate font-mono text-xs font-medium`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs`,children:t===void 0?`…`:t.value===null?(0,G.jsx)(`span`,{className:`font-sans text-muted-foreground`,children:`In-app default`}):(0,G.jsx)(`span`,{title:t.value,children:t.value.length===0?`""`:t.value})}),(0,G.jsx)(`dd`,{children:t?.condition===void 0?null:t.condition===null?(0,G.jsx)(z,{variant:`outline`,children:`Default value`}):(0,G.jsx)(z,{variant:`secondary`,children:t.condition})})]},e)})})]})]})}function qn({name:e,fields:t}){return(0,G.jsxs)(`li`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`break-words font-mono`,children:e}),t.length===0?null:(0,G.jsx)(`ul`,{className:`mt-0.5 flex flex-col gap-0.5`,children:t.map(e=>(0,G.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:e.field}),e.before===null?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`max-w-full truncate font-mono line-through decoration-muted-foreground/60`,title:e.before,children:e.before}),(0,G.jsx)(k,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`to`})]}),(0,G.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,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs font-medium`,children:e}),(0,G.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,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:e===`Removed`?(0,G.jsx)(`span`,{className:`break-words font-mono`,children:t.join(`, `)}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,G.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 l=(0,W.useId)(),u=kt(),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(null),{dateTimeText:h}=$(),g=Zt(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?[]:Qt(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?[]:$t(t,r,h)},b=d.trim().length>256,x=e=>{u.isPending||(t(e),e||(m(null),u.reset()))};return(0,G.jsx)(dt,{onOpenChange:x,open:e,children:(0,G.jsx)(ct,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-lg`,children:(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:async e=>{if(e.preventDefault(),!b)try{let e=await u.mutateAsync({template:i,baseVersion:r,...d.trim().length===0?{}:{description:d.trim()}});m(e),e.status===`published`&&(M.success(`Published version ${e.version.version}`),f(``),m(null),t(!1),a())}catch(e){M.error(e instanceof Error?e.message:`Unable to publish`)}},children:[(0,G.jsxs)(ot,{children:[(0,G.jsx)(lt,{children:`Publish changes`}),(0,G.jsxs)(ut,{children:[`This becomes version `,r+1,`. Devices get its values on their next fetch; earlier versions stay available to roll back to.`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,G.jsx)(Jn,{changes:g.parameters,describe:v,label:`Parameters`}),(0,G.jsx)(Jn,{changes:g.conditions,describe:y,label:`Conditions`}),g.reordered?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Condition priority changed.`}):null]}),p?.status===`invalid`?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`The server refused the template`}),(0,G.jsx)(F,{children:(0,G.jsx)(`ul`,{className:`list-disc pl-4`,children:p.issues.slice(0,6).map(e=>(0,G.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):null,p?.status===`conflict`?(0,G.jsxs)(I,{children:[(0,G.jsx)(L,{}),(0,G.jsxs)(P,{children:[`Version `,p.currentVersion,` was published while you edited`]}),(0,G.jsx)(F,{children:`Load it to review what changed, or publish yours after it, replacing its values.`}),(0,G.jsxs)(`div`,{className:`col-span-full mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(_,{onClick:()=>{x(!1),o()},size:`sm`,type:`button`,variant:`outline`,children:[`Load version `,p.currentVersion]}),(0,G.jsx)(_,{onClick:()=>{s(p.currentVersion),m(null)},size:`sm`,type:`button`,variant:`ghost`,children:`Publish mine after it`})]})]}):null,(0,G.jsxs)(U,{"data-invalid":b||void 0,children:[(0,G.jsx)(V,{htmlFor:`${l}-description`,children:`Description`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${l}-description`,onChange:e=>f(e.target.value),placeholder:`What changed and why`,value:d}),(0,G.jsx)(Ie,{children:`Shown in the version history.`}),(0,G.jsx)(H,{children:b?`Use 256 characters or fewer.`:null})]}),(0,G.jsxs)(st,{children:[(0,G.jsx)(_,{disabled:u.isPending,onClick:()=>x(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsxs)(_,{disabled:u.isPending||p?.status===`conflict`,type:`submit`,children:[u.isPending?(0,G.jsx)(fe,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,G.jsx)(gt,{"data-icon":`inline-start`}),`Publish version `,r+1]})]})]})})})}function Xn({ms:e}){let t=new Date(e);return(0,G.jsx)(`time`,{className:`tabular-nums`,dateTime:t.toISOString(),title:`${t.toISOString().replace(`T`,` `).slice(0,19)} UTC`,children:(0,_t.default)(e).format(`YYYY/MM/DD HH:mm`)})}function Zn({open:t,version:n,onOpenChange:r}){let i=Dt(n),a=i.data===null||i.data===void 0?null:JSON.stringify(i.data.template,null,2);return(0,G.jsx)(dt,{onOpenChange:r,open:t,children:(0,G.jsxs)(ct,{className:`max-h-[calc(100svh-2rem)] grid-rows-[auto_minmax(0,1fr)] sm:max-w-2xl`,children:[(0,G.jsxs)(ot,{children:[(0,G.jsxs)(lt,{children:[`Version `,n]}),(0,G.jsx)(ut,{children:`The template as it was published, in the JSON the admin API takes.`})]}),i.isLoading?(0,G.jsx)(e,{className:`h-48 w-full`}):i.isError?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`This version couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection and try again.`}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:()=>void i.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(he,{"data-icon":`inline-start`}),`Retry`]})})]}):a===null?(0,G.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` no longer exists.`]}):(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:[(0,G.jsx)(`pre`,{className:`min-h-0 overflow-auto rounded-md bg-muted p-3 font-mono text-xs`,children:a}),(0,G.jsxs)(_,{className:`self-end`,onClick:()=>{navigator.clipboard.writeText(a).then(()=>M.success(`Template JSON copied`),()=>M.error(`Unable to copy the template`))},size:`sm`,variant:`outline`,children:[(0,G.jsx)(le,{"data-icon":`inline-start`}),`Copy JSON`]})]})]})})}function Qn({activeVersion:t,hasDraft:n,onRolledBack:r,onStartEditing:i}){let a=Et({enabled:!0}),o=At(),[s,c]=(0,W.useState)(null),[l,u]=(0,W.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`?(M.success(`Version ${e.version.version} restores version ${l.source}`),r()):e.status===`conflict`?M.error(`Version ${e.currentVersion} was published meanwhile. Review it, then roll back again.`):M.error(`That version no longer exists.`),u(null)}catch(e){M.error(e instanceof Error?e.message:`Unable to roll back`)}};return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsx)(B,{className:`border-b px-4 py-3 sm:px-6`,children:(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Versions`})})}),(0,G.jsx)(ke,{className:`p-0`,children:a.isError?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`Versions couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection and try again.`}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:()=>void a.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(he,{"data-icon":`inline-start`}),`Retry`]})})]})}):a.isLoading?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:p-6`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading versions`}),Array.from({length:3},(t,n)=>(0,G.jsx)(e,{className:`h-10 w-full`},n))]}):p.length===0?(0,G.jsxs)(Ge,{className:`py-10`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(de,{})}),(0,G.jsx)(Ue,{children:`No versions yet`}),(0,G.jsx)(We,{children:`Your first publish becomes version 1. Every publish after it is kept here, ready to roll back to.`})]}),(0,G.jsx)(He,{children:(0,G.jsx)(_,{className:`min-h-11 sm:min-h-7`,onClick:i,children:`Add a parameter`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`ol`,{"aria-label":`Versions`,className:`divide-y`,children:p.map(e=>(0,G.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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-sm font-medium tabular-nums`,children:[`Version `,e.version]}),e.version===t?(0,G.jsx)(z,{children:`Active`}):null,e.updateType===`ROLLBACK`?(0,G.jsxs)(z,{variant:`outline`,children:[`Rollback to v`,e.rollbackSource]}):null]}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(Xn,{ms:e.createdAtMs}),e.description===null||e.updateType===`ROLLBACK`&&e.description===`Rollback to version ${e.rollbackSource}`?null:(0,G.jsxs)(G.Fragment,{children:[` · `,e.description]})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,G.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,G.jsx)(ht,{"data-icon":`inline-start`}),`View`]}),(0,G.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,G.jsx)(be,{"data-icon":`inline-start`}),`Roll back`]})]})]},e.version))}),a.hasNextPage?(0,G.jsx)(`div`,{className:`border-t px-4 py-3 sm:px-6`,children:(0,G.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,G.jsx)(fe,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):null,`Load older versions`]})}):null]})}),(0,G.jsx)(Zn,{onOpenChange:e=>{e||c(null)},open:s!==null,version:d}),(0,G.jsx)(it,{onOpenChange:e=>{!o.isPending&&!e&&u(null)},open:l!==null,children:(0,G.jsxs)(Qe,{children:[(0,G.jsxs)(rt,{children:[(0,G.jsxs)($e,{children:[`Roll back to version `,f?.source,`?`]}),(0,G.jsxs)(Ze,{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,G.jsxs)(tt,{children:[(0,G.jsx)(nt,{disabled:o.isPending,children:`Cancel`}),(0,G.jsxs)(et,{disabled:o.isPending,onClick:e=>void m(e),children:[o.isPending?(0,G.jsx)(fe,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,G.jsx)(be,{"data-icon":`inline-start`}),`Roll back`]})]})]})})]})}_t.default.extend(vt.default);var $n=[`parameters`,`conditions`,`preview`,`versions`];function er({tab:t,onTabChange:n}){let r=Tt(),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),f=r.data,p=i?.template??f?.template,m=i!==null&&f!==void 0&&!Mt(i.template,f.template),h=m&&f!==void 0&&i.baseVersion!==f.version;(0,W.useEffect)(()=>{if(o||f===void 0)return;s(!0);let e=rn(f);e!==null&&(a(e),l(!0))},[f,o]),(0,W.useEffect)(()=>{if(i===null||!m||an(i))return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[i,m]);let g=()=>{a(null),l(!1),an(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,G.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,G.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,G.jsx)(y,{className:`-ml-1 size-11 lg:size-7`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,G.jsx)(`h1`,{className:`text-sm font-medium`,children:`Remote Config`})]}),f===void 0?null:(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f.version===0?`Nothing published yet`:(0,G.jsxs)(G.Fragment,{children:[`Version `,f.version,f.updatedAtMs===null?null:(0,G.jsxs)(G.Fragment,{children:[` · published `,(0,G.jsx)(`time`,{dateTime:new Date(f.updatedAtMs).toISOString(),title:(0,_t.default)(f.updatedAtMs).format(`YYYY/MM/DD HH:mm:ss`),children:(0,_t.default)(f.updatedAtMs).fromNow()})]})]})}),m?(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,G.jsx)(z,{className:`hidden sm:inline-flex`,variant:`secondary`,children:`Unpublished changes`}),(0,G.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:g,variant:`ghost`,children:[(0,G.jsx)(Oe,{"data-icon":`inline-start`}),`Discard`]}),(0,G.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:()=>d(!0),children:[(0,G.jsx)(gt,{"data-icon":`inline-start`}),`Publish changes`]})]}):null]}),(0,G.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4`,children:[r.isError?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`Remote Config couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection and try again.`}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:()=>void r.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(he,{"data-icon":`inline-start`}),`Retry`]})})]}):null,c&&m&&i!==null?(0,G.jsxs)(I,{children:[(0,G.jsx)(de,{}),(0,G.jsx)(P,{children:`Your unpublished changes are back`}),(0,G.jsxs)(F,{children:[`This browser kept them from your last visit, on version`,` `,i.baseVersion,`.`]}),(0,G.jsx)(R,{children:(0,G.jsx)(_,{onClick:g,size:`xs`,variant:`outline`,children:`Discard them`})})]}):null,h&&i!==null&&f!==void 0?(0,G.jsxs)(I,{children:[(0,G.jsx)(L,{}),(0,G.jsxs)(P,{children:[`Version `,f.version,` was published while you edited`]}),(0,G.jsxs)(F,{children:[`Your draft started from version `,i.baseVersion,`. Discard it to review version `,f.version,`, or publish yours after it.`]}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:g,size:`xs`,variant:`outline`,children:[`Load version `,f.version]})})]}):null,(0,G.jsxs)(Xe,{onValueChange:e=>n(e),value:t,children:[(0,G.jsx)(Ye,{"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,G.jsxs)(Ke,{className:`min-h-11 flex-none px-3 lg:min-h-7`,value:e,children:[t,n===null?null:(0,G.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]},e))}),p===void 0||f===void 0?r.isError?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 pt-2`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading Remote Config`}),(0,G.jsx)(e,{className:`h-14 w-full`}),(0,G.jsx)(e,{className:`h-14 w-full`}),(0,G.jsx)(e,{className:`h-14 w-full`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qe,{value:`parameters`,children:(0,G.jsx)(Un,{onAddCondition:e=>v(t=>It(t,null,e)),onRemoveParameter:e=>v(t=>Pt(t,e)),onSaveParameter:(e,t,n)=>v(r=>Nt(r,e,t,n)),template:p})}),(0,G.jsx)(qe,{value:`conditions`,children:(0,G.jsx)(Mn,{onMoveCondition:(e,t)=>v(n=>Rt(n,e,t)),onRemoveCondition:e=>v(t=>Lt(t,e)),onSaveCondition:(e,t)=>v(n=>It(n,e,t)),template:p})}),(0,G.jsx)(qe,{value:`preview`,children:(0,G.jsx)(Kn,{isDraft:m,template:p})}),(0,G.jsx)(qe,{value:`versions`,children:(0,G.jsx)(Qn,{activeVersion:f.version,hasDraft:m,onRolledBack:g,onStartEditing:()=>n(`parameters`)})})]})]})]})}),f!==void 0&&i!==null?(0,G.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-9h5s5yCy.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:te(()=>E(()=>import(`./remote-config-BopBV_qe.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 u=e=>{o(e),n(dn(e))};return i?(0,G.jsx)(ve,{className:`min-h-20 font-mono text-xs`,id:e,onChange:e=>u(e.target.value),placeholder:r,spellCheck:!1,value:a}):(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:e,onChange:e=>u(e.target.value),placeholder:r,value:a})}function En({id:e,label:t,value:r,presets:i,onChange:a}){return(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:e,children:t}),(0,G.jsxs)(xe,{className:`h-11 sm:h-9`,children:[(0,G.jsx)(ge,{className:`h-11 tabular-nums sm:h-9`,id:e,onChange:e=>a(qt(e.target.value)),type:`datetime-local`,value:Kt(r)}),r===void 0?null:(0,G.jsx)(_e,{align:`inline-end`,children:(0,G.jsx)(ye,{"aria-label":`Clear ${t.toLowerCase()}`,className:`size-11 sm:size-5`,onClick:()=>a(void 0),size:`icon-xs`,children:(0,G.jsx)(n,{})})})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,G.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,W.useId)(),r=ze();switch(e.type){case`platform`:return(0,G.jsx)(Sn,{"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,G.jsxs)(Cn,{className:`min-h-11 px-3 sm:min-h-8`,value:e,children:[(0,G.jsx)(at,{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,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Tn,{id:`${n}-channels`,onChange:n=>t({...e,channels:n}),placeholder:`production, beta`,values:e.channels}),i.length>0?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Add:`}),i.slice(0,8).map(n=>(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-6`,onClick:()=>t({...e,channels:[...e.channels,n]}),size:`xs`,type:`button`,variant:`outline`,children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),n]},n))]}):null]})}case`appVersion`:return(0,G.jsx)(c,{"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,G.jsx)(Tn,{id:`${n}-cohorts`,onChange:n=>t({...e,cohorts:n}),placeholder:`1, 2, beta-testers`,values:e.cohorts});case`percent`:return(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[repeat(2,minmax(0,8rem))_minmax(0,1fr)]`,children:[(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${n}-from`,children:`From %`}),(0,G.jsx)(c,{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,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${n}-to`,children:`To %`}),(0,G.jsx)(c,{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,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${n}-seed`,children:`Seed`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(c,{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,G.jsx)(_,{"aria-label":`New seed`,className:`size-11 sm:size-9`,onClick:()=>t({...e,seed:Yt()}),size:`icon`,type:`button`,variant:`outline`,children:(0,G.jsx)(he,{})})]})]})]});case`fingerprint`:return(0,G.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,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsx)(En,{id:`${n}-from`,label:`From`,onChange:e=>r(`from`,e),presets:Wt(),value:e.from}),(0,G.jsx)(En,{id:`${n}-until`,label:`Until`,onChange:e=>r(`to`,e),presets:Gt(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=we(e);return(0,G.jsx)(dt,{onOpenChange:t,open:e,children:(0,G.jsx)(ct,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-xl`,children:(0,G.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,W.useId)(),{dateTimeText:a,timeZone:o}=$(),[s,l]=(0,W.useState)(()=>e===null||e.name===ln(e.rules,t,a)?``:e.name),[u,d]=(0,W.useState)(e===null?[pn(`platform`)]:[...e.rules]),[f,p]=(0,W.useState)(!1),m=ln(u,t,a),h=s.trim().length===0?m:s,g=un(h,t),v=u.map(fn),y=wn.filter(e=>!u.some(t=>t.type===e)),b=g!==null||u.length===0||v.some(e=>e!==null);return(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),p(!0),!b&&n({name:h.trim(),rules:u.map(e=>e.type===`appVersion`?{...e,range:e.range.trim()}:e)})},children:[(0,G.jsxs)(ot,{children:[(0,G.jsx)(lt,{children:e===null?`Add condition`:`Edit condition`}),(0,G.jsx)(ut,{children:`A device matches when it matches every rule.`})]}),(0,G.jsxs)(Fe,{children:[(0,G.jsxs)(U,{"data-invalid":f&&g!==null||void 0,children:[(0,G.jsx)(V,{htmlFor:`${i}-name`,children:`Name`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${i}-name`,maxLength:101,onChange:e=>l(e.target.value),placeholder:m||`Beta testers on iOS`,value:s}),(0,G.jsx)(Ie,{children:`Optional: without one, it is named after its rules.`}),(0,G.jsx)(H,{children:f?g:null})]}),(0,G.jsxs)(Re,{children:[(0,G.jsx)(Le,{variant:`label`,children:`Rules`}),u.length===0?(0,G.jsx)(H,{children:f?`Add at least one rule.`:null}):null,(0,G.jsx)(`ol`,{className:`flex flex-col gap-3`,children:u.map((e,t)=>(0,G.jsx)(`li`,{className:`rounded-lg border p-3`,children:(0,G.jsxs)(U,{"data-invalid":f&&v[t]!==null||void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:J[e.type]}),(0,G.jsx)(_,{"aria-label":`Remove the ${J[e.type].toLowerCase()} rule`,className:`size-11 sm:size-7`,onClick:()=>d(u.filter((e,n)=>n!==t)),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,G.jsx)(De,{})})]}),(0,G.jsx)(Dn,{onChange:e=>d(u.map((n,r)=>r===t?e:n)),rule:e}),(0,G.jsx)(Ie,{children:e.type===`dateTime`?`In your time zone, ${o}. ${On.dateTime}`:On[e.type]}),(0,G.jsx)(H,{children:f?v[t]:null})]})},e.type))}),y.length>0?(0,G.jsxs)(ce,{items:Object.fromEntries(y.map(e=>[e,J[e]])),onValueChange:e=>{e!==null&&d([...u,pn(e)])},value:null,children:[(0,G.jsxs)(re,{"aria-label":`Add a rule`,className:`min-h-11 w-full sm:min-h-9 sm:w-56`,children:[(0,G.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),(0,G.jsx)(ae,{placeholder:`Add a rule`})]}),(0,G.jsx)(ie,{alignItemWithTrigger:!1,children:(0,G.jsx)(oe,{children:y.map(e=>(0,G.jsx)(A,{value:e,children:J[e]},e))})})]}):null]})]}),(0,G.jsxs)(st,{children:[(0,G.jsx)(_,{onClick:r,type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsx)(_,{type:`submit`,children:e===null?`Add condition`:`Save condition`})]})]})}function jn({condition:e,dateTimeText:t}){let n=e.rules.map(e=>Jt(e,t)).join(` · `);return n===e.name?null:(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}function Mn({template:e,onSaveCondition:t,onRemoveCondition:n,onMoveCondition:r}){let[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=N(i),l=N(o),{dateTimeText:u}=$(),{conditions:d}=e,f=c?.condition?.name??null,p=t=>{let r=zt(e,t);r.length===0?n(t):s({name:t,users:r})};return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(B,{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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Conditions`})}),(0,G.jsx)(je,{className:`text-xs`,children:`Listed by priority: when several match a device, the first wins.`})]}),(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add condition`]})]}),(0,G.jsx)(ke,{className:`p-0`,children:d.length===0?(0,G.jsxs)(Ge,{className:`py-10`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(ue,{})}),(0,G.jsx)(Ue,{children:`No conditions`}),(0,G.jsx)(We,{children:`Add a condition to give some devices other values: a platform, channel, app version range, cohort, or a share of installs.`})]}),(0,G.jsx)(He,{children:(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({condition:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add condition`]})})]}):(0,G.jsx)(`ol`,{"aria-label":`Conditions`,className:`divide-y`,children:d.map((t,n)=>{let i=zt(e,t.name);return(0,G.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,G.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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.name}),(0,G.jsx)(jn,{condition:t,dateTimeText:u}),(0,G.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,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 md:justify-end`,children:[(0,G.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,G.jsx)(pt,{})}),(0,G.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,G.jsx)(ft,{})}),(0,G.jsxs)(_,{"aria-label":`Edit ${t.name}`,className:`min-h-11 md:min-h-7`,onClick:()=>a({condition:t}),size:`sm`,variant:`outline`,children:[(0,G.jsx)(pe,{"data-icon":`inline-start`}),`Edit`]}),(0,G.jsx)(_,{"aria-label":`Delete ${t.name}`,className:`size-11 md:size-7`,onClick:()=>p(t.name),size:`icon`,variant:`ghost`,children:(0,G.jsx)(De,{})})]})]},t.name)})})}),(0,G.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,G.jsx)(it,{onOpenChange:e=>{e||s(null)},open:o!==null,children:(0,G.jsxs)(Qe,{children:[(0,G.jsxs)(rt,{children:[(0,G.jsxs)($e,{children:[`Delete `,l?.name,`?`]}),(0,G.jsxs)(Ze,{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,G.jsxs)(tt,{children:[(0,G.jsx)(nt,{children:`Cancel`}),(0,G.jsx)(et,{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?cn(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:``,l=a?Pn(n,r):null,u=e=>i({value:e});return(0,G.jsxs)(U,{"data-invalid":l!==null||void 0,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(V,{htmlFor:e,id:`${e}-label`,children:t}),(0,G.jsxs)(`div`,{className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground sm:min-h-0`,children:[(0,G.jsx)(Te,{checked:o,id:`${e}-in-app-default`,onCheckedChange:e=>i(e?{useInAppDefault:!0}:{value:Nn(n)})}),(0,G.jsx)(`label`,{htmlFor:`${e}-in-app-default`,children:`Use in-app default`})]})]}),o?(0,G.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,G.jsxs)(`code`,{className:`font-mono`,children:[`remoteConfig(`,`{ defaults }`,`)`]}),`.`]}):n===`BOOLEAN`?(0,G.jsxs)(Sn,{"aria-labelledby":`${e}-label`,id:e,onValueChange:e=>{let[t]=e;(t===`true`||t===`false`)&&u(t)},value:[s],variant:`outline`,children:[(0,G.jsx)(Cn,{className:`min-h-11 px-4 sm:min-h-8`,value:`true`,children:`true`}),(0,G.jsx)(Cn,{className:`min-h-11 px-4 sm:min-h-8`,value:`false`,children:`false`})]}):n===`NUMBER`?(0,G.jsx)(c,{"aria-invalid":l!==null||void 0,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:e,inputMode:`decimal`,onChange:e=>u(e.target.value),value:s}):n===`JSON`?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(ve,{"aria-invalid":l!==null||void 0,className:`min-h-24 font-mono text-xs`,id:e,onChange:e=>u(e.target.value),spellCheck:!1,value:s}),(0,G.jsxs)(_,{className:`self-start`,disabled:cn(`JSON`,s)!==null,onClick:()=>u(JSON.stringify(JSON.parse(s),null,2)),size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(mt,{"data-icon":`inline-start`}),`Format JSON`]})]}):(0,G.jsx)(ve,{"aria-invalid":l!==null||void 0,className:`min-h-11 text-sm sm:min-h-9`,id:e,onChange:e=>u(e.target.value),rows:2,value:s}),(0,G.jsx)(H,{children:l})]})}var In=Object.keys(q),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=we(e);return(0,G.jsx)(dt,{onOpenChange:t,open:e,children:(0,G.jsx)(ct,{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,G.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 l=(0,W.useId)(),{dateTimeText:u}=$(),[d,f]=(0,W.useState)(e??``),[p,m]=(0,W.useState)(t?.valueType??`STRING`),[h,g]=(0,W.useState)(t?.description??``),v=h.trim().length>256,[y,b]=(0,W.useState)(t?.defaultValue??{value:``}),[x,S]=(0,W.useState)(t?.conditionalValues??{}),[C,w]=(0,W.useState)({}),[T,ee]=(0,W.useState)(!1),[te,E]=(0,W.useState)(!1),D=sn(d.trim(),r),O=i.filter(({name:e})=>Y(x,e)!==void 0),k=i.filter(({name:e})=>Y(x,e)===void 0),ne=D!==null||v||[y,...Object.values(x)].some(e=>Pn(p,e)!==null),se=e=>{m(e),b(Rn(y,e)),S(Object.fromEntries(Object.entries(x).map(([t,n])=>[t,Rn(n,e)])))},le=e=>{let t=Y(C,e);S({...x,[e]:t===void 0?{value:Nn(p)}:Rn(t,p)})},ue=e=>{let{[e]:t,...n}=x;t!==void 0&&w({...C,[e]:t}),S(n)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.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,Y(x,e)]));a(d.trim(),{valueType:p,defaultValue:y,...Object.keys(t).length===0?{}:{conditionalValues:t},...h.trim().length===0?{}:{description:h.trim()}})},children:[(0,G.jsxs)(ot,{children:[(0,G.jsx)(lt,{children:e===null?`Add parameter`:`Edit parameter`}),(0,G.jsxs)(ut,{children:[`The app reads it with`,` `,(0,G.jsxs)(`code`,{className:`font-mono`,children:[`hotUpdater.remoteConfig.`,Ln[p],`("`,d.trim()||`key`,`")`]}),`, which is null when neither the server nor the app's defaults have a value.`]})]}),(0,G.jsxs)(Fe,{children:[(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[minmax(0,1fr)_11rem]`,children:[(0,G.jsxs)(U,{"data-invalid":T&&D!==null||void 0,children:[(0,G.jsx)(V,{htmlFor:`${l}-key`,children:`Key`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${l}-key`,maxLength:257,onChange:e=>f(e.target.value),placeholder:`welcome_message`,spellCheck:!1,value:d}),(0,G.jsx)(H,{children:T?D:null})]}),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${l}-type`,children:`Type`}),(0,G.jsxs)(ce,{items:q,onValueChange:e=>{e!==null&&se(e)},value:p,children:[(0,G.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${l}-type`,children:(0,G.jsx)(ae,{})}),(0,G.jsx)(ie,{children:(0,G.jsx)(oe,{children:In.map(e=>(0,G.jsx)(A,{value:e,children:q[e]},e))})})]})]})]}),(0,G.jsxs)(U,{"data-invalid":v||void 0,children:[(0,G.jsx)(V,{htmlFor:`${l}-description`,children:`Description`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${l}-description`,onChange:e=>g(e.target.value),placeholder:`Optional: what the app does with it`,value:h}),(0,G.jsx)(H,{children:v?`Use 256 characters or fewer.`:null})]}),(0,G.jsx)(Fn,{id:`${l}-default`,label:`Default value`,onChange:b,showErrors:T,value:y,valueType:p}),(0,G.jsxs)(Re,{children:[(0,G.jsx)(Le,{variant:`label`,children:`Conditional values`}),(0,G.jsx)(Ie,{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,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:O.map(e=>(0,G.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),(0,G.jsx)(jn,{condition:e,dateTimeText:u})]}),(0,G.jsxs)(_,{"aria-label":`Remove the value for ${e.name}`,className:`min-h-11 shrink-0 text-muted-foreground sm:min-h-7`,onClick:()=>ue(e.name),size:`sm`,type:`button`,variant:`ghost`,children:[(0,G.jsx)(n,{"data-icon":`inline-start`}),`Remove value`]})]}),(0,G.jsx)(Fn,{id:`${l}-${e.name}`,label:(0,G.jsxs)(G.Fragment,{children:[`Value`,(0,G.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]}),onChange:t=>S({...x,[e.name]:t}),showErrors:T,value:Y(x,e.name),valueType:p})]},e.name))}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0?(0,G.jsxs)(ce,{items:Object.fromEntries(k.map(({name:e})=>[e,e])),onValueChange:e=>{e!==null&&le(e)},value:null,children:[(0,G.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,G.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),(0,G.jsx)(ae,{placeholder:`Add a value for a condition`})]}),(0,G.jsx)(ie,{alignItemWithTrigger:!1,children:(0,G.jsx)(oe,{children:k.map(({name:e})=>(0,G.jsx)(A,{value:e,children:e},e))})})]}):null,(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-9`,onClick:()=>E(!0),type:`button`,variant:`outline`,children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`New condition`]})]})]})]}),(0,G.jsxs)(st,{children:[(0,G.jsx)(_,{onClick:o,type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsx)(_,{type:`submit`,children:e===null?`Add parameter`:`Save parameter`})]})]}),(0,G.jsx)(kn,{condition:null,onOpenChange:E,onSave:e=>{s(e),le(e.name)},open:te,takenNames:i.map(({name:e})=>e)})]})}function Vn({text:e}){return(0,G.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})=>Y(t.conditionalValues,e)!==void 0);return(0,G.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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-mono text-sm font-medium`,children:e}),(0,G.jsx)(z,{className:`shrink-0`,variant:`outline`,children:q[t.valueType]})]}),t.description===void 0?null:(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t.description})]}),(0,G.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,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`line-clamp-2 break-words text-muted-foreground`,title:e,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:(0,G.jsx)(Vn,{text:X(Y(t.conditionalValues,e))})})]},e)),(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:`Default`}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:`value`in t.defaultValue?(0,G.jsx)(Vn,{text:X(t.defaultValue)}):(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`In-app default`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,G.jsxs)(_,{"aria-label":`Edit ${e}`,className:`min-h-11 md:min-h-7`,onClick:r,size:`sm`,variant:`outline`,children:[(0,G.jsx)(pe,{"data-icon":`inline-start`}),`Edit`]}),(0,G.jsx)(_,{"aria-label":`Delete ${e}`,className:`size-11 md:size-7`,onClick:i,size:`icon`,variant:`ghost`,children:(0,G.jsx)(De,{})})]})]})}function Un({template:e,onSaveParameter:t,onRemoveParameter:n,onAddCondition:r}){let[i,a]=(0,W.useState)(null),o=N(i),[s,c]=(0,W.useState)(``),l=Object.keys(e.parameters),u=l.filter(e=>e.toLowerCase().includes(s.trim().toLowerCase())),d=o?.key??null;return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(B,{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,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Parameters`})}),(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap gap-2 sm:w-auto`,children:[l.length>5?(0,G.jsxs)(xe,{className:`min-h-11 w-full sm:min-h-8 sm:w-56`,children:[(0,G.jsx)(_e,{children:(0,G.jsx)(Se,{"aria-hidden":`true`})}),(0,G.jsx)(ge,{"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,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add parameter`]})]})]}),(0,G.jsx)(ke,{className:`p-0`,children:l.length===0?(0,G.jsxs)(Ge,{className:`py-10`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(Ce,{})}),(0,G.jsx)(Ue,{children:`No parameters`}),(0,G.jsx)(We,{children:`Add a parameter, give it a default, then publish to change the app without a new build.`})]}),(0,G.jsx)(He,{children:(0,G.jsxs)(_,{className:`min-h-11 sm:min-h-7`,onClick:()=>a({key:null,parameter:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add parameter`]})})]}):u.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-xs text-muted-foreground`,children:[(0,G.jsx)(`p`,{className:`font-medium text-foreground`,children:`No matching keys`}),(0,G.jsx)(_,{onClick:()=>c(``),size:`sm`,variant:`outline`,children:`Clear filter`})]}):(0,G.jsx)(`ul`,{"aria-label":`Parameters`,className:`divide-y`,children:u.map(t=>(0,G.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,G.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,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n};function Kn({template:t,isDraft:n}){let r=(0,W.useId)(),[i,a]=(0,W.useState)(Wn),{at:o,...s}=Gn(i),l=qt(o),u=jt({template:t,context:{...s,...l===void 0?{}:{now:Date.parse(l)}}}),d=Object.keys(t.parameters),f=(e,t)=>a({...i,[e]:t});return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(B,{className:`border-b px-4 py-3 sm:px-6`,children:[(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Preview a device`})}),(0,G.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,G.jsxs)(ke,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-platform`,children:`Platform`}),(0,G.jsxs)(ce,{items:{ios:`iOS`,android:`Android`},onValueChange:e=>{(e===`ios`||e===`android`)&&f(`platform`,e)},value:i.platform,children:[(0,G.jsx)(re,{className:`min-h-11 w-full sm:min-h-9`,id:`${r}-platform`,children:(0,G.jsxs)(ae,{children:[(0,G.jsx)(at,{className:`size-3.5`,platform:i.platform}),i.platform===`ios`?`iOS`:`Android`]})}),(0,G.jsx)(ie,{children:(0,G.jsxs)(oe,{children:[(0,G.jsxs)(A,{value:`ios`,children:[(0,G.jsx)(at,{className:`size-3.5`,platform:`ios`}),`iOS`]}),(0,G.jsxs)(A,{value:`android`,children:[(0,G.jsx)(at,{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,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-${e}`,children:t}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 text-base sm:min-h-9 sm:text-xs`,id:`${r}-${e}`,onChange:t=>f(e,t.target.value),placeholder:n,spellCheck:!1,value:i[e]})]},e)),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-at`,children:`Time`}),(0,G.jsxs)(xe,{className:`h-11 sm:h-9`,children:[(0,G.jsx)(ge,{className:`h-11 text-base tabular-nums sm:h-9 sm:text-xs`,id:`${r}-at`,onChange:e=>f(`at`,e.target.value),type:`datetime-local`,value:i.at}),i.at.length===0?null:(0,G.jsx)(_e,{align:`inline-end`,children:(0,G.jsx)(ye,{className:`min-h-11 sm:min-h-6`,onClick:()=>f(`at`,``),size:`xs`,children:`Now`})})]})]})]}),d.length===0?(0,G.jsx)(Ge,{className:`border py-8`,children:(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(Ee,{})}),(0,G.jsx)(Ue,{children:`Nothing to preview`}),(0,G.jsx)(We,{children:`Add a parameter, and its value for this device shows here.`})]})}):u.data?.status===`invalid`?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`The draft has problems to fix first`}),(0,G.jsx)(F,{children:(0,G.jsx)(`ul`,{className:`list-disc pl-4`,children:u.data.issues.slice(0,5).map(e=>(0,G.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):u.isError?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`The preview couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection, then change a field to try again.`})]}):u.data===void 0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading the preview`}),d.slice(0,4).map(t=>(0,G.jsx)(e,{className:`h-8 w-full`},t))]}):(0,G.jsx)(`dl`,{"aria-busy":u.isFetching||void 0,className:`divide-y rounded-lg border`,children:d.map(e=>{let t=u.data.status===`ok`?u.data.parameters[e]:void 0;return(0,G.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,G.jsx)(`dt`,{className:`truncate font-mono text-xs font-medium`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs`,children:t===void 0?`…`:t.value===null?(0,G.jsx)(`span`,{className:`font-sans text-muted-foreground`,children:`In-app default`}):(0,G.jsx)(`span`,{title:t.value,children:t.value.length===0?`""`:t.value})}),(0,G.jsx)(`dd`,{children:t?.condition===void 0?null:t.condition===null?(0,G.jsx)(z,{variant:`outline`,children:`Default value`}):(0,G.jsx)(z,{variant:`secondary`,children:t.condition})})]},e)})})]})]})}function qn({name:e,fields:t}){return(0,G.jsxs)(`li`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`break-words font-mono`,children:e}),t.length===0?null:(0,G.jsx)(`ul`,{className:`mt-0.5 flex flex-col gap-0.5`,children:t.map(e=>(0,G.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:e.field}),e.before===null?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`max-w-full truncate font-mono line-through decoration-muted-foreground/60`,title:e.before,children:e.before}),(0,G.jsx)(k,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`to`})]}),(0,G.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,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs font-medium`,children:e}),(0,G.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,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:e===`Removed`?(0,G.jsx)(`span`,{className:`break-words font-mono`,children:t.join(`, `)}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,G.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 l=(0,W.useId)(),u=kt(),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(null),{dateTimeText:h}=$(),g=Zt(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?[]:Qt(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?[]:$t(t,r,h)},b=d.trim().length>256,x=e=>{u.isPending||(t(e),e||(m(null),u.reset()))};return(0,G.jsx)(dt,{onOpenChange:x,open:e,children:(0,G.jsx)(ct,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-lg`,children:(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:async e=>{if(e.preventDefault(),!b)try{let e=await u.mutateAsync({template:i,baseVersion:r,...d.trim().length===0?{}:{description:d.trim()}});m(e),e.status===`published`&&(M.success(`Published version ${e.version.version}`),f(``),m(null),t(!1),a())}catch(e){M.error(e instanceof Error?e.message:`Unable to publish`)}},children:[(0,G.jsxs)(ot,{children:[(0,G.jsx)(lt,{children:`Publish changes`}),(0,G.jsxs)(ut,{children:[`This becomes version `,r+1,`. Devices get its values on their next fetch; earlier versions stay available to roll back to.`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,G.jsx)(Jn,{changes:g.parameters,describe:v,label:`Parameters`}),(0,G.jsx)(Jn,{changes:g.conditions,describe:y,label:`Conditions`}),g.reordered?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Condition priority changed.`}):null]}),p?.status===`invalid`?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`The server refused the template`}),(0,G.jsx)(F,{children:(0,G.jsx)(`ul`,{className:`list-disc pl-4`,children:p.issues.slice(0,6).map(e=>(0,G.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):null,p?.status===`conflict`?(0,G.jsxs)(I,{children:[(0,G.jsx)(L,{}),(0,G.jsxs)(P,{children:[`Version `,p.currentVersion,` was published while you edited`]}),(0,G.jsx)(F,{children:`Load it to review what changed, or publish yours after it, replacing its values.`}),(0,G.jsxs)(`div`,{className:`col-span-full mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(_,{onClick:()=>{x(!1),o()},size:`sm`,type:`button`,variant:`outline`,children:[`Load version `,p.currentVersion]}),(0,G.jsx)(_,{onClick:()=>{s(p.currentVersion),m(null)},size:`sm`,type:`button`,variant:`ghost`,children:`Publish mine after it`})]})]}):null,(0,G.jsxs)(U,{"data-invalid":b||void 0,children:[(0,G.jsx)(V,{htmlFor:`${l}-description`,children:`Description`}),(0,G.jsx)(c,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${l}-description`,onChange:e=>f(e.target.value),placeholder:`What changed and why`,value:d}),(0,G.jsx)(Ie,{children:`Shown in the version history.`}),(0,G.jsx)(H,{children:b?`Use 256 characters or fewer.`:null})]}),(0,G.jsxs)(st,{children:[(0,G.jsx)(_,{disabled:u.isPending,onClick:()=>x(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsxs)(_,{disabled:u.isPending||p?.status===`conflict`,type:`submit`,children:[u.isPending?(0,G.jsx)(fe,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,G.jsx)(gt,{"data-icon":`inline-start`}),`Publish version `,r+1]})]})]})})})}function Xn({ms:e}){let t=new Date(e);return(0,G.jsx)(`time`,{className:`tabular-nums`,dateTime:t.toISOString(),title:`${t.toISOString().replace(`T`,` `).slice(0,19)} UTC`,children:(0,_t.default)(e).format(`YYYY/MM/DD HH:mm`)})}function Zn({open:t,version:n,onOpenChange:r}){let i=Dt(n),a=i.data===null||i.data===void 0?null:JSON.stringify(i.data.template,null,2);return(0,G.jsx)(dt,{onOpenChange:r,open:t,children:(0,G.jsxs)(ct,{className:`max-h-[calc(100svh-2rem)] grid-rows-[auto_minmax(0,1fr)] sm:max-w-2xl`,children:[(0,G.jsxs)(ot,{children:[(0,G.jsxs)(lt,{children:[`Version `,n]}),(0,G.jsx)(ut,{children:`The template as it was published, in the JSON the admin API takes.`})]}),i.isLoading?(0,G.jsx)(e,{className:`h-48 w-full`}):i.isError?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`This version couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection and try again.`}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:()=>void i.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(he,{"data-icon":`inline-start`}),`Retry`]})})]}):a===null?(0,G.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` no longer exists.`]}):(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:[(0,G.jsx)(`pre`,{className:`min-h-0 overflow-auto rounded-md bg-muted p-3 font-mono text-xs`,children:a}),(0,G.jsxs)(_,{className:`self-end`,onClick:()=>{navigator.clipboard.writeText(a).then(()=>M.success(`Template JSON copied`),()=>M.error(`Unable to copy the template`))},size:`sm`,variant:`outline`,children:[(0,G.jsx)(le,{"data-icon":`inline-start`}),`Copy JSON`]})]})]})})}function Qn({activeVersion:t,hasDraft:n,onRolledBack:r,onStartEditing:i}){let a=Et({enabled:!0}),o=At(),[s,c]=(0,W.useState)(null),[l,u]=(0,W.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`?(M.success(`Version ${e.version.version} restores version ${l.source}`),r()):e.status===`conflict`?M.error(`Version ${e.currentVersion} was published meanwhile. Review it, then roll back again.`):M.error(`That version no longer exists.`),u(null)}catch(e){M.error(e instanceof Error?e.message:`Unable to roll back`)}};return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsx)(B,{className:`border-b px-4 py-3 sm:px-6`,children:(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Versions`})})}),(0,G.jsx)(ke,{className:`p-0`,children:a.isError?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`Versions couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection and try again.`}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:()=>void a.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(he,{"data-icon":`inline-start`}),`Retry`]})})]})}):a.isLoading?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:p-6`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading versions`}),Array.from({length:3},(t,n)=>(0,G.jsx)(e,{className:`h-10 w-full`},n))]}):p.length===0?(0,G.jsxs)(Ge,{className:`py-10`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Be,{variant:`icon`,children:(0,G.jsx)(de,{})}),(0,G.jsx)(Ue,{children:`No versions yet`}),(0,G.jsx)(We,{children:`Your first publish becomes version 1. Every publish after it is kept here, ready to roll back to.`})]}),(0,G.jsx)(He,{children:(0,G.jsx)(_,{className:`min-h-11 sm:min-h-7`,onClick:i,children:`Add a parameter`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`ol`,{"aria-label":`Versions`,className:`divide-y`,children:p.map(e=>(0,G.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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-sm font-medium tabular-nums`,children:[`Version `,e.version]}),e.version===t?(0,G.jsx)(z,{children:`Active`}):null,e.updateType===`ROLLBACK`?(0,G.jsxs)(z,{variant:`outline`,children:[`Rollback to v`,e.rollbackSource]}):null]}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(Xn,{ms:e.createdAtMs}),e.description===null||e.updateType===`ROLLBACK`&&e.description===`Rollback to version ${e.rollbackSource}`?null:(0,G.jsxs)(G.Fragment,{children:[` · `,e.description]})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,G.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,G.jsx)(ht,{"data-icon":`inline-start`}),`View`]}),(0,G.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,G.jsx)(be,{"data-icon":`inline-start`}),`Roll back`]})]})]},e.version))}),a.hasNextPage?(0,G.jsx)(`div`,{className:`border-t px-4 py-3 sm:px-6`,children:(0,G.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,G.jsx)(fe,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):null,`Load older versions`]})}):null]})}),(0,G.jsx)(Zn,{onOpenChange:e=>{e||c(null)},open:s!==null,version:d}),(0,G.jsx)(it,{onOpenChange:e=>{!o.isPending&&!e&&u(null)},open:l!==null,children:(0,G.jsxs)(Qe,{children:[(0,G.jsxs)(rt,{children:[(0,G.jsxs)($e,{children:[`Roll back to version `,f?.source,`?`]}),(0,G.jsxs)(Ze,{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,G.jsxs)(tt,{children:[(0,G.jsx)(nt,{disabled:o.isPending,children:`Cancel`}),(0,G.jsxs)(et,{disabled:o.isPending,onClick:e=>void m(e),children:[o.isPending?(0,G.jsx)(fe,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,G.jsx)(be,{"data-icon":`inline-start`}),`Roll back`]})]})]})})]})}_t.default.extend(vt.default);var $n=[`parameters`,`conditions`,`preview`,`versions`];function er({tab:t,onTabChange:n}){let r=Tt(),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),f=r.data,p=i?.template??f?.template,m=i!==null&&f!==void 0&&!Mt(i.template,f.template),h=m&&f!==void 0&&i.baseVersion!==f.version;(0,W.useEffect)(()=>{if(o||f===void 0)return;s(!0);let e=rn(f);e!==null&&(a(e),l(!0))},[f,o]),(0,W.useEffect)(()=>{if(i===null||!m||an(i))return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[i,m]);let g=()=>{a(null),l(!1),an(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,G.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,G.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,G.jsx)(y,{className:`-ml-1 size-11 lg:size-7`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,G.jsx)(`h1`,{className:`text-sm font-medium`,children:`Remote Config`})]}),f===void 0?null:(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f.version===0?`Nothing published yet`:(0,G.jsxs)(G.Fragment,{children:[`Version `,f.version,f.updatedAtMs===null?null:(0,G.jsxs)(G.Fragment,{children:[` · published `,(0,G.jsx)(`time`,{dateTime:new Date(f.updatedAtMs).toISOString(),title:(0,_t.default)(f.updatedAtMs).format(`YYYY/MM/DD HH:mm:ss`),children:(0,_t.default)(f.updatedAtMs).fromNow()})]})]})}),m?(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,G.jsx)(z,{className:`hidden sm:inline-flex`,variant:`secondary`,children:`Unpublished changes`}),(0,G.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:g,variant:`ghost`,children:[(0,G.jsx)(Oe,{"data-icon":`inline-start`}),`Discard`]}),(0,G.jsxs)(_,{className:`min-h-11 lg:min-h-7`,onClick:()=>d(!0),children:[(0,G.jsx)(gt,{"data-icon":`inline-start`}),`Publish changes`]})]}):null]}),(0,G.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4`,children:[r.isError?(0,G.jsxs)(I,{variant:`destructive`,children:[(0,G.jsx)(L,{}),(0,G.jsx)(P,{children:`Remote Config couldn't be loaded`}),(0,G.jsx)(F,{children:`Check the connection and try again.`}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:()=>void r.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(he,{"data-icon":`inline-start`}),`Retry`]})})]}):null,c&&m&&i!==null?(0,G.jsxs)(I,{children:[(0,G.jsx)(de,{}),(0,G.jsx)(P,{children:`Your unpublished changes are back`}),(0,G.jsxs)(F,{children:[`This browser kept them from your last visit, on version`,` `,i.baseVersion,`.`]}),(0,G.jsx)(R,{children:(0,G.jsx)(_,{onClick:g,size:`xs`,variant:`outline`,children:`Discard them`})})]}):null,h&&i!==null&&f!==void 0?(0,G.jsxs)(I,{children:[(0,G.jsx)(L,{}),(0,G.jsxs)(P,{children:[`Version `,f.version,` was published while you edited`]}),(0,G.jsxs)(F,{children:[`Your draft started from version `,i.baseVersion,`. Discard it to review version `,f.version,`, or publish yours after it.`]}),(0,G.jsx)(R,{children:(0,G.jsxs)(_,{onClick:g,size:`xs`,variant:`outline`,children:[`Load version `,f.version]})})]}):null,(0,G.jsxs)(Xe,{onValueChange:e=>n(e),value:t,children:[(0,G.jsx)(Ye,{"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,G.jsxs)(Ke,{className:`min-h-11 flex-none px-3 lg:min-h-7`,value:e,children:[t,n===null?null:(0,G.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]},e))}),p===void 0||f===void 0?r.isError?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 pt-2`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading Remote Config`}),(0,G.jsx)(e,{className:`h-14 w-full`}),(0,G.jsx)(e,{className:`h-14 w-full`}),(0,G.jsx)(e,{className:`h-14 w-full`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qe,{value:`parameters`,children:(0,G.jsx)(Un,{onAddCondition:e=>v(t=>It(t,null,e)),onRemoveParameter:e=>v(t=>Pt(t,e)),onSaveParameter:(e,t,n)=>v(r=>Nt(r,e,t,n)),template:p})}),(0,G.jsx)(qe,{value:`conditions`,children:(0,G.jsx)(Mn,{onMoveCondition:(e,t)=>v(n=>Rt(n,e,t)),onRemoveCondition:e=>v(t=>Lt(t,e)),onSaveCondition:(e,t)=>v(n=>It(n,e,t)),template:p})}),(0,G.jsx)(qe,{value:`preview`,children:(0,G.jsx)(Kn,{isDraft:m,template:p})}),(0,G.jsx)(qe,{value:`versions`,children:(0,G.jsx)(Qn,{activeVersion:f.version,hasDraft:m,onRolledBack:g,onStartEditing:()=>n(`parameters`)})})]})]})]})}),f!==void 0&&i!==null?(0,G.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-Bt6V_XHg.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:te(()=>E(()=>import(`./remote-config-CSJSQdOv.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,$n as t,Ar as n,Br as r,Cn as i,Di as a,Ei as o,F as s,Fr as c,H as l,I as u,Ir as d,L as f,Ln as p,M as m,Mr as h,Nn as g,On as _,P as v,Q as y,Qn as b,R as ee,Ri as x,Sn as S,Tr as C,U as w,Un as te,Vi as T,Vr as E,Xn as ne,Zn as re,_ as ie,_r as ae,b as oe,bn as se,dt as ce,et as le,ft as ue,g as de,gn as fe,gr as D,h as O,jr as pe,kr as me,p as he,v as k,vn as A,vr as j,w as ge,wr as M,xn as N,xr as _e,y as P,yn as F}from"./sidebar-UnsNYOry.js";import{t as I}from"./link-D95E0fwF.js";import{t as L}from"./arrow-right-jHG0fJt7.js";import{t as ve}from"./arrow-up-right-BPRe5soE.js";import{a as ye,i as be,l as xe,n as R,o as Se,r as Ce,s as we,t as z}from"./routes-DkzFq9jv.js";import{t as B}from"./check-Dz_5aNwx.js";import{a as Te,i as Ee,n as De,r as Oe}from"./useCompositeListItem-B9ONn9qn.js";import{i as ke,r as Ae}from"./TargetDisplay-CyBWoX-f.js";import{t as je}from"./chevron-right-CuYrscDY.js";import{A as Me,D as Ne,E as Pe,M as V,N as Fe,T as Ie,a as Le,d as Re,f as ze,h as Be,i as H,m as U,n as Ve,o as W,r as He,t as G}from"./select-DSZKLAHH.js";import{t as Ue}from"./circle-off-BZFOMb8J.js";import{t as We}from"./download-ekENI2Sw.js";import{t as Ge}from"./list-ClzEOP6k.js";import{t as Ke}from"./loader-circle-BUfUHW-o.js";import{C as qe,O as Je,T as Ye,h as Xe}from"./native-builds-3qvP-53q.js";import{t as Ze}from"./plus-CNhNPLpx.js";import{n as K,r as Qe}from"./dist-Dh2hrHKj.js";import{a as $e,i as et,n as tt,o as nt,s as rt,t as it}from"./input-group-cEQZv88S.js";import{n as at,t as ot}from"./switch-Bvelc7zQ.js";import{t as st}from"./trash-2-SV8_CRNk.js";import{a as ct,i as lt,n as ut,o as dt,r as ft,t as q}from"./badge-Cf3eoJjl.js";import{a as pt}from"./insights-search-BCR_lahU.js";import{a as mt,n as ht,o as gt,r as _t,t as vt}from"./card-CHIqYgB7.js";import{a as yt,c as bt,d as xt,f as St,i as Ct,l as wt,o as Tt,s as Et,t as Dt,u as Ot}from"./constants-zSb7FXDh.js";import{a as kt,c as At,i as jt,n as Mt,r as Nt,t as Pt}from"./field-BHPxgJmr.js";import{C as Ft,S as It,_ as Lt,a as Rt,b as zt,c as Bt,i as Vt,n as Ht,o as Ut,r as Wt,s as Gt,t as Kt,v as qt,w as Jt,x as Yt,y as Xt}from"./api-sTvbSydX.js";import{a as Zt,i as Qt,l as $t,n as en,o as tn,r as nn,s as rn,t as an}from"./alert-dialog-C6K18pl_.js";import{n as on,t as sn}from"./PlatformIcon-DjcYGkV6.js";import{a as cn,i as ln,n as un,o as dn,r as fn,s as pn,t as mn}from"./dialog-ZrH3ul9A.js";import{a as hn,i as J,n as gn,o as _n,r as Y,t as vn}from"./table-tm9RvUbS.js";import{t as yn}from"./BundleIdDisplay-Cz5MehaS.js";import{t as bn}from"./ChannelBadge-B7DxBTj3.js";import{a as xn,c as Sn,d as Cn,f as wn,i as Tn,l as En,n as Dn,o as On,p as kn,r as An,s as jn,t as Mn,u as Nn}from"./RelativeTime-DxYXSuC4.js";import{n as Pn,r as Fn,t as In}from"./RolloutPercentageBadge-Di_Ca_ss.js";import{t as Ln}from"./HashValueDisplay-DDz2Ecy7.js";import{n as Rn,t as zn}from"./valueToPercent-Db73Kirz.js";import{a as Bn,c as Vn,i as Hn,l as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./RowReason-BvjPxMrd.js";var Yn=E(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Xn=E(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Zn=E(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Qn=E(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),$n=E(`tags`,[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]),er=o();function tr(){return M}function nr(){return!1}function rr(){return!0}function ir(){return(0,er.useSyncExternalStore)(tr,nr,rr)}var X=T(x(),1),Z=a();function ar({enabled:e,className:t,falseIcon:n=`x`,colorMode:i=`semantic`}){let a=i===`inherit`?`text-current`:void 0;return e?(0,Z.jsx)(B,{className:j(`h-4 w-4`,a??`text-green-600 dark:text-green-400`,t)}):n===`minus`?(0,Z.jsx)(Zn,{className:j(`h-4 w-4`,a??`text-muted-foreground`,t)}):(0,Z.jsx)(r,{className:j(`h-4 w-4`,a??`text-red-600 dark:text-red-400`,t)})}function or({panelId:t,bundle:n,bundles:r,loading:i,onDetailClick:a}){let o=O();return(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-3 sm:p-4`,id:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Advanced artifact diagnostics`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 text-sm sm:items-center`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Base artifact ID`}),(0,Z.jsx)(yn,{bundleId:n.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(q,{variant:`outline`,children:[r.length,` `,r.length===1?`patch`:`patches`]})]}),i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(e,{className:`h-10 w-full`}),(0,Z.jsx)(e,{className:`h-10 w-full`})]}):r.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),o?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(e=>(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Target artifact ID`}),(0,Z.jsx)(yn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Relation`}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-1 text-sm`,children:[(0,Z.jsx)(yn,{bundleId:n.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(L,{className:`size-4 rotate-90 text-muted-foreground`}),(0,Z.jsx)(yn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Artifact`}),(0,Z.jsx)(q,{variant:`secondary`,children:`bsdiff`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1 text-right`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Created`}),(0,Z.jsx)(`div`,{className:`text-xs tabular-nums text-foreground`,children:(0,Z.jsx)(Fn,{uuid:e.id})})]})]}),(0,Z.jsx)(D,{className:`w-full`,onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})]})},e.id))}):(0,Z.jsx)(`div`,{className:`overflow-x-auto rounded-md border bg-background`,children:(0,Z.jsxs)(vn,{className:`min-w-max`,children:[(0,Z.jsx)(hn,{children:(0,Z.jsxs)(_n,{className:`hover:bg-transparent`,children:[(0,Z.jsx)(J,{children:`Target artifact ID`}),(0,Z.jsx)(J,{children:`Relation`}),(0,Z.jsx)(J,{children:`Artifact`}),(0,Z.jsx)(J,{children:`Created`}),(0,Z.jsx)(J,{className:`w-24 text-right`,children:`Detail`})]})}),(0,Z.jsx)(gn,{children:r.map(e=>(0,Z.jsxs)(_n,{children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(yn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`flex min-w-[280px] flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[(0,Z.jsx)(yn,{bundleId:n.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(L,{className:`size-4 shrink-0 rotate-90 text-muted-foreground sm:rotate-0`}),(0,Z.jsx)(yn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(q,{variant:`secondary`,children:`bsdiff`})}),(0,Z.jsx)(Y,{className:`tabular-nums`,children:(0,Z.jsx)(Fn,{uuid:e.id})}),(0,Z.jsx)(Y,{className:`text-right`,children:(0,Z.jsx)(D,{onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})})]},e.id))})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3 text-sm text-muted-foreground`,children:`No direct patch artifacts.`})]})]})})}function sr({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(null),o=at(i),{data:s=[],isPending:c}=Vt(),l=Ut(),u=Gt(),d=n.trim(),f=async e=>{if(e.preventDefault(),!(!d||l.isPending))try{let e=await l.mutateAsync({name:d});r(``),e.inserted?K.success(`Channel ${e.row.name} created`):K.info(`Channel ${e.row.name} already exists`)}catch(e){K.error(`Failed to create channel`),console.error(e)}},p=async()=>{if(!(!i||u.isPending))try{let e=await u.mutateAsync({id:i.id});e.deleted?K.success(`Channel ${i.name} deleted`):e.reason===`not_empty`?K.error(`Channel ${i.name} is still in use and cannot be deleted`):K.error(`Channel ${i.name} no longer exists`),a(null)}catch(e){K.error(`Failed to delete channel`),console.error(e)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mn,{open:e,onOpenChange:t,children:(0,Z.jsxs)(un,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(cn,{children:[(0,Z.jsxs)(dn,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Qn,{className:`size-4 text-muted-foreground`}),`Channels`]}),(0,Z.jsx)(fn,{children:`Create deployment channels and remove them when no bundle uses them. Empty channels remain available until you delete them.`})]}),(0,Z.jsx)(`form`,{onSubmit:f,children:(0,Z.jsx)(jt,{className:`gap-2`,children:(0,Z.jsxs)(Pt,{orientation:`horizontal`,children:[(0,Z.jsx)(kt,{htmlFor:`channel-name`,className:`sr-only`,children:`Channel name`}),(0,Z.jsx)(y,{id:`channel-name`,value:n,onChange:e=>r(e.target.value),placeholder:`Channel name`,autoComplete:`off`,disabled:l.isPending}),(0,Z.jsxs)(D,{className:`max-md:h-11`,type:`submit`,disabled:!d||l.isPending,children:[l.isPending?(0,Z.jsx)(Ke,{"data-icon":`inline-start`,className:`animate-spin motion-reduce:animate-none`}):(0,Z.jsx)(Ze,{"data-icon":`inline-start`}),`Create`]})]})})}),(0,Z.jsx)(`div`,{className:`max-h-72 overflow-y-auto rounded-lg border`,children:c?(0,Z.jsxs)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:[(0,Z.jsx)(Ke,{className:`mr-2 size-3.5 animate-spin motion-reduce:animate-none`}),`Loading channels`]}):s.length===0?(0,Z.jsx)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:`No channels yet`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:s.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-12 items-center gap-3 px-3 py-2`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,title:e.name,children:e.name}),(0,Z.jsx)(D,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,title:`Delete ${e.name}`,disabled:u.isPending,onClick:()=>a(e),className:`text-muted-foreground hover:text-destructive max-md:size-11`,children:(0,Z.jsx)(st,{"data-icon":`inline-start`})})]},e.id))})})]})}),(0,Z.jsx)(an,{open:i!==null,onOpenChange:e=>{!e&&!u.isPending&&a(null)},children:(0,Z.jsxs)(Qt,{children:[(0,Z.jsxs)(rn,{children:[(0,Z.jsxs)($t,{children:[`Delete `,o?.name,`?`]}),(0,Z.jsx)(Zt,{children:`Only empty channels can be removed. The server checks this when you delete it, and the channel can be created again later with a new ID.`})]}),(0,Z.jsxs)(tn,{children:[(0,Z.jsx)(nn,{disabled:u.isPending,children:`Cancel`}),(0,Z.jsx)(en,{variant:`destructive`,disabled:u.isPending,onClick:e=>{e.preventDefault(),p()},children:u.isPending?`Deleting...`:`Delete channel`})]})]})})]})}var cr=`[a-zA-Z0-9-]`,lr=String.raw`0|[1-9]\d*`,ur=String.raw`\d+`,dr=String.raw`\d*[a-zA-Z-]${cr}*`,fr=String.raw`(${lr})\.(${lr})\.(${lr})`,pr=String.raw`(${ur})\.(${ur})\.(${ur})`,mr=`(?:${dr}|${lr})`,hr=`(?:${dr}|${ur})`,gr=String.raw`(?:-(${mr}(?:\.${mr})*))`,_r=String.raw`(?:-?(${hr}(?:\.${hr})*))`,vr=`${cr}+`,yr=String.raw`(?:\+(${vr}(?:\.${vr})*))`,br=`v?${fr}${gr}?${yr}?`,xr=String.raw`[v=\s]*${pr}${_r}?${yr}?`,Sr=`((?:<|>)?=?)`,Cr=String.raw`${lr}|x|X|\*`,wr=String.raw`${ur}|x|X|\*`,Tr=String.raw`[v=\s]*(${Cr})(?:\.(${Cr})(?:\.(${Cr})(?:${gr})?${yr}?)?)?`,Er=String.raw`[v=\s]*(${wr})(?:\.(${wr})(?:\.(${wr})(?:${_r})?${yr}?)?)?`,Dr=`(?:~>?)`,Or=String.raw`(?:\^)`,kr=String.raw`(^|[^\d])(\d{1,${16}})(?:\.(\d{1,${16}}))?(?:\.(\d{1,${16}}))?`;String.raw`${kr}(?:$|[^\d])`,String.raw`${kr}(?:${gr})?(?:${yr})?(?:$|[^\d])`;function Ar(e){let t=[[String.raw`\s`,1],[String.raw`\d`,256],[cr,250]];for(let[n,r]of t)e=e.split(`${n}*`).join(`${n}{0,${r}}`).split(`${n}+`).join(`${n}{1,${r}}`);return e}function Q(e,t){return new RegExp(Ar(e),t)}var jr=Q(`^${br}$`),Mr=Q(`^${xr}$`),Nr=/^\d+$/;function Pr(e){let t=`${e.major}.${e.minor}.${e.patch}`;return e.prerelease?.length?`${t}-${e.prerelease.join(`.`)}`:t}function Fr(e,t={}){if(typeof e!=`string`)return e;if(e.length>256)throw TypeError(`Version exceeds the maximum length of 256 characters`);let n=e.trim().match(t.loose?Mr:jr);if(!n)throw TypeError(`Invalid version syntax: ${e}`);let r=Number(n[1]),i=Number(n[2]),a=Number(n[3]);if(r>2**53-1||r<0)throw TypeError(`Invalid major version: ${n[1]}`);if(i>2**53-1||i<0)throw TypeError(`Invalid minor version: ${n[2]}`);if(a>2**53-1||a<0)throw TypeError(`Invalid patch version: ${n[3]}`);let o=n[4]?n[4].split(`.`).map(e=>{if(Nr.test(e)){let t=Number(e);if(t>=0&&t<2**53-1)return t}return e}):void 0;return{build:n[5]?.split(`.`),major:r,minor:i,patch:a,prerelease:o}}var Ir=Q(String.raw`^${Sr}\s*(${br})$|^$`),Lr=Q(String.raw`^${Sr}\s*(${xr})$|^$`);function Rr(e){return e.version?`${e.operator}${Pr(e.version)}`:``}function zr(e,t={}){if(typeof e!=`string`)return e;let n=e.trim().replaceAll(/\s+/g,` `),r=n.match(t.loose?Lr:Ir);if(!r)throw TypeError(`Invalid comparator: ${n}`);let i=r[1]===`=`?``:r[1]||``,a=r[2]?Fr(r[2],t):null;return{operator:i,options:t,value:a?`${i}${Pr(a)}`:``,version:a}}function Br(e){return e.sets.map(e=>e.map(Rr).join(` `)).join(`||`)}var Vr=new RegExp(yr,`g`),Hr=Q(yr),Ur=Q(String.raw`^\s*(${Tr})\s+-\s+(${Tr})\s*$`),Wr=Q(String.raw`^\s*(${Er})\s+-\s+(${Er})\s*$`),Gr=Q(String.raw`(\s*)${Sr}\s*(${xr}|${Tr})`,`g`),Kr=Q(String.raw`(\s*)${Dr}\s+`,`g`),qr=Q(String.raw`(\s*)${Or}\s+`,`g`),Jr=Q(`^${Dr}${Tr}$`),Yr=Q(`^${Dr}${Er}$`),Xr=Q(`^${Or}${Tr}$`),Zr=Q(`^${Or}${Er}$`),Qr=Q(String.raw`^${Sr}\s*${Tr}$`),$r=Q(String.raw`^${Sr}\s*${Er}$`),ei=Q(String.raw`(<|>)?=?\s*\*`),ti=/^\s*>=\s*0\.0\.0\s*$/,ni=/^\s*>=\s*0\.0\.0-0\s*$/,ri=Q(String.raw`^${Sr}\s*(${xr})$|^$`);function $(e){return!e||String(e).toLowerCase()===`x`||String(e)===`*`}function ii(e,t,n){return $(e)&&!$(t)||$(t)&&!!n&&!$(n)}function ai(e,t){let n=t.loose?Yr:Jr,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:a?`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`)}function oi(e,t){return e.trim().split(/\s+/).map(e=>ai(e,t)).join(` `)}function si(e,t){let n=t.loose?Zr:Xr,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.0${r} <${Number(t)+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i}-${a} <${Number(t)+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${Number(t)+1}.0.0-0`)}function ci(e,t){return e.trim().split(/\s+/).map(e=>si(e,t)).join(` `)}function li(e,t){let n=t.loose?$r:Qr;return e.trim().replace(n,(n,r,i,a,o)=>{let s=r,c=i,l=a,u=o;if(ii(String(c),l===void 0?void 0:String(l),u===void 0?void 0:String(u)))return e;let d=$(c),f=d||$(l),p=f||$(u);if(s===`=`&&p&&(s=``),d)return s===`>`||s===`<`?`<0.0.0-0`:`*`;let m=t.includePrerelease?`-0`:``;return s&&p?(f&&(l=0),u=0,s===`>`?(s=`>=`,f?(c=Number(c)+1,l=0):l=Number(l)+1):s===`<=`&&(s=`<`,f?c=Number(c)+1:l=Number(l)+1),s===`<`&&(m=`-0`),`${s}${c}.${l}.${u}${m}`):f?`>=${c}.0.0${m} <${Number(c)+1}.0.0-0`:p?`>=${c}.${l}.0${m} <${c}.${Number(l)+1}.0-0`:n})}function ui(e,t){return e.split(/\s+/).map(e=>li(e,t)).join(` `)}function di(e,t){let n=t.loose?Wr:Ur;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>{let p=n,m=c;return p=$(r)?``:$(i)?`>=${r}.0.0${t.includePrerelease?`-0`:``}`:$(a)?`>=${r}.${i}.0${t.includePrerelease?`-0`:``}`:o?`>=${p}`:`>=${p}${t.includePrerelease?`-0`:``}`,m=$(l)?``:$(u)?`<${Number(l)+1}.0.0-0`:$(d)?`<${l}.${Number(u)+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t.includePrerelease?`<${l}.${u}.${Number(d)+1}-0`:`<=${m}`,`${p} ${m}`.trim()})}function fi(e,t){return ui(oi(ci(e.replace(Hr,``),t),t),t).trim().replace(ei,``)}function pi(e,t){let n=di(e.replace(Vr,``),t).replace(Gr,`$1$2$3`).replace(Kr,`$1~`).replace(qr,`$1^`).split(` `).map(e=>fi(e,t)).join(` `).split(/\s+/).map(e=>e.trim().replace(t.includePrerelease?ni:ti,``));t.loose&&(n=n.filter(e=>ri.test(e)));let r=new Map;for(let e of n.map(e=>zr(e,t))){if(e.value===`<0.0.0-0`)return[e];r.set(e.value,e)}return r.size>1&&r.delete(``),[...r.values()]}function mi(e,t={}){if(typeof e!=`string`)return e;let n={...t},r=e.trim().replaceAll(/\s+/g,` `),i=r.split(`||`).map(e=>pi(e.trim(),n)).filter(e=>e.length);if(!i.length)throw TypeError(`Range contains no valid comparator sets: ${r}`);if(i.length>1){let e=i[0];if(i=i.filter(e=>e[0]?.value!==`<0.0.0-0`),!i.length)i=[e];else if(i.length>1){let e=i.find(e=>e.length===1&&e[0]?.value===``);e&&(i=[e])}}return{options:n,sets:i}}function hi(e,t={}){try{return mi(e,t)}catch{return null}}function gi(e,t={}){let n=hi(e,t);return n?Br(n)||`*`:null}function _i({label:e,value:t}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Z.jsx)(`dd`,{className:`min-w-0 text-left text-sm sm:text-right`,children:t})]})}function vi({bundle:e,release:t}){let{data:n,isFetched:r}=Rt(),i=e?wt(e):null,a=e?bt(e):null,o=e?.gitCommitHash&&r?Pn(n?.console.gitUrl,e.gitCommitHash):null,s=t.strategy===`APP_VERSION`?t.target_app_version:t.fingerprint_hash;return s||e?.gitCommitHash||e?.manifestFileHash||a||i?(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(mt,{className:`p-4 pb-3`,children:(0,Z.jsx)(gt,{className:`text-sm font-medium`,children:`Metadata`})}),(0,Z.jsx)(ht,{className:`px-4 pb-4`,children:(0,Z.jsxs)(`dl`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Z.jsx)(_i,{label:t.strategy===`APP_VERSION`?`Target app version`:`Fingerprint target`,value:(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs`,translate:`no`,children:s??`—`})}),e?.gitCommitHash?(0,Z.jsx)(_i,{label:`Git commit`,value:(0,Z.jsxs)(`div`,{className:`flex items-center justify-start gap-1 sm:justify-end`,children:[(0,Z.jsx)(Ln,{className:o?`text-primary`:void 0,maxLength:12,value:e.gitCommitHash}),o?(0,Z.jsx)(`a`,{"aria-label":`Open git commit`,className:`relative shrink-0 text-primary after:absolute after:-inset-2.5 hover:underline md:after:hidden`,href:o,rel:`noopener noreferrer`,target:`_blank`,children:(0,Z.jsx)(Yn,{"aria-hidden":`true`})}):null]})}):null,e?.manifestFileHash?(0,Z.jsx)(_i,{label:`Manifest hash`,value:(0,Z.jsx)(Ln,{maxLength:16,value:e.manifestFileHash})}):null,a?(0,Z.jsx)(_i,{label:`Base hash`,value:(0,Z.jsx)(Ln,{maxLength:16,value:a})}):null,i?(0,Z.jsx)(_i,{label:`Patch hash`,value:(0,Z.jsx)(Ln,{maxLength:16,value:i})}):null]})})]}):null}var yi=Array.from({length:yt},(e,t)=>t+1);function bi({releaseId:e,rolloutCohortCount:t,targetCohorts:n}){let r=St(t),i=n??[],a=i.length>0,o=r>0&&r<1e3,s=r===yt,c=O(),l=s?yi:o?yi.filter(t=>Tt(e,t)<r):[],u=(r/10).toFixed(1),d=s?yt:l.length,f=yt-d,p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Z.jsx)(vt,{children:(0,Z.jsxs)(mt,{className:`p-4`,children:[(0,Z.jsx)(_t,{children:`Selected cohorts`}),(0,Z.jsx)(gt,{className:`font-mono text-2xl tabular-nums`,children:d})]})}),(0,Z.jsx)(vt,{children:(0,Z.jsxs)(mt,{className:`p-4`,children:[(0,Z.jsx)(_t,{children:`Excluded cohorts`}),(0,Z.jsx)(gt,{className:`font-mono text-2xl tabular-nums`,children:f})]})})]}),a?(0,Z.jsxs)(vt,{children:[(0,Z.jsxs)(mt,{className:`p-4 pb-3`,children:[(0,Z.jsx)(gt,{className:`text-sm`,children:`Additional cohorts`}),(0,Z.jsx)(_t,{children:`Always included in addition to the percentage rollout.`})]}),(0,Z.jsx)(ht,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-lg border bg-muted/20 p-3`,children:i.map(e=>(0,Z.jsx)(q,{className:`max-w-full font-mono`,variant:`secondary`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:e})},e))})})]}):null,(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(mt,{className:`p-4 pb-3`,children:(0,Z.jsx)(gt,{className:`text-sm`,children:`Numeric cohorts`})}),(0,Z.jsx)(ht,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto overscroll-contain rounded-lg border bg-muted/20 p-3 sm:max-h-[45vh]`,children:l.length>0?(0,Z.jsx)(`div`,{"aria-label":`Included numeric cohorts`,className:`grid grid-cols-3 gap-2 sm:grid-cols-6 lg:grid-cols-8`,role:`list`,children:l.map(e=>(0,Z.jsx)(q,{className:`justify-center font-mono tabular-nums`,role:`listitem`,variant:`outline`,children:e},e))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No numeric cohorts are included.`})})})]})]});return(0,Z.jsxs)(mn,{children:[(0,Z.jsxs)(pn,{render:(0,Z.jsx)(D,{className:`max-md:h-11`,size:`sm`,type:`button`,variant:`outline`}),children:[(0,Z.jsx)(Ge,{"data-icon":`inline-start`}),`Preview cohorts`]}),(0,Z.jsx)(un,{className:c?`top-0 left-0 h-dvh max-w-none translate-x-0 translate-y-0 rounded-none border-0 p-0`:`sm:max-w-3xl`,children:c?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsxs)(cn,{className:`shrink-0 border-b border-border/70 px-4 py-4`,children:[(0,Z.jsx)(dn,{children:`Rolled out cohorts`}),(0,Z.jsxs)(fn,{children:[u,`% includes `,d,` of`,` `,yt,` numeric cohorts.`,a?` Additional cohorts are always included.`:``]})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto overscroll-contain px-4 py-4`,children:p}),(0,Z.jsx)(ln,{className:`shrink-0 border-t border-border/70 px-4 py-3`,showCloseButton:!0})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(cn,{children:[(0,Z.jsx)(dn,{children:`Rolled out cohorts`}),(0,Z.jsxs)(fn,{children:[u,`% includes `,d,` of`,` `,yt,` numeric cohorts.`,a?` Additional cohorts are always included.`:``]})]}),p,(0,Z.jsx)(ln,{showCloseButton:!0})]})})]})}function xi({release:t,channel:n,bundle:r}){let i=t.bundle_id===null?null:{platform:t.platform,channel:n,fingerprintHash:t.fingerprint_hash,targetAppVersion:t.target_app_version},a=i!==null&&Ye(i)!==null,o=Yt(a?i:null);if(!a)return null;let s=o.data;return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Native build`}),o.isPending?(0,Z.jsx)(e,{className:`h-4 w-40`}):s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(I,{className:`inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 text-xs text-foreground underline-offset-4 hover:underline`,params:{buildId:s.id},to:`/native-builds/$buildId`,children:[qe(s.platform),` `,Xe[s.artifact_kind].label,` ·`,` `,(0,Z.jsx)(`span`,{className:`font-mono`,translate:`no`,children:s.min_bundle_id}),(0,Z.jsx)(ve,{"aria-hidden":`true`,className:`size-3`})]}),r?(0,Z.jsx)(q,{variant:`secondary`,children:(r.patches??[]).some(({baseBundleId:e})=>e===s.min_bundle_id)?`Patches from it`:`No patch from it`}):null]}):o.isError?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Couldn't load the scope's native build.`,` `,(0,Z.jsx)(`button`,{className:`underline underline-offset-4`,onClick:()=>void o.refetch(),type:`button`,children:`Retry`})]}):(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`None tracked for this scope ·`,` `,(0,Z.jsx)(I,{className:`relative underline-offset-4 after:absolute after:-inset-x-2 after:-inset-y-4 hover:text-foreground hover:underline md:after:hidden`,search:{channel:n},to:`/native-builds`,children:`This channel's builds`})]})]})}function Si(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Ci(e,t){return e-t}function wi(e,t,n){let r=e.slice();return r[t]=n,r.sort(Ci)}function Ti(e,t,n,r,i,a){let o=e;return o=U(o,n,r),i&&(o=wi(a,t,U(o,a[t-1]||-1/0,a[t+1]||1/0))),o}function Ei(e,t,n){if(!Array.isArray(e))return!0;let r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}var Di={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...V},Oi=X.createContext(void 0);function ki(){let e=X.useContext(Oi);if(e===void 0)throw Error(me(62));return e}function Ai(e){return`key`in e?p:g}function ji(e,t){return typeof e==`number`&&typeof t==`number`?e===t:Array.isArray(e)&&Array.isArray(t)?Si(e,t):!1}var Mi=X.forwardRef(function(e,t){let{"aria-labelledby":n,className:r,defaultValue:a,disabled:o=!1,id:s,format:c,largeStep:l=10,locale:u,render:d,max:f=100,min:p=0,minStepsBetweenValues:m=0,form:g,name:_,onValueChange:v,onValueCommitted:y,orientation:ee=`horizontal`,step:x=1,thumbCollisionBehavior:C=`push`,thumbAlignment:w=`center`,value:te,style:T,...E}=e,ne=ue(s),ie=Re(ne),ae=h(v),oe=h(y),{clearErrors:ce}=Be(),{state:le,disabled:de,name:fe,setTouched:D,setDirty:O,validityData:me,shouldValidateOnChange:he,validation:k}=Me(),{labelId:j}=Pe(),[M,N]=X.useState(),P=n??ze(j,M),F=de||o,I=fe??_,[L,ve]=Ee({controlled:te,default:a??p,name:`Slider`}),ye=X.useRef(null),be=X.useRef(null),xe=X.useRef([]),R=X.useRef(null),Se=X.useRef(null),Ce=X.useRef(-1),we=X.useRef(null),z=X.useRef(null),B=X.useRef(`none`),Te=se(c),[De,ke]=X.useState(-1),[Ae,je]=X.useState(-1),[V,Fe]=X.useState(!1),[Ie,Le]=X.useState(()=>new Map),[H,Ve]=X.useState([void 0,void 0]),W=h(e=>{ke(e),e!==-1&&je(e)});Ne(be,ne,L),ge(L,()=>{ce(I),he()?k.commit(L):k.commit(L,!0);let e=me.initialValue,t;t=Array.isArray(L)&&Array.isArray(e)?!Si(L,e):L!==e,O(t)});let He=h(e=>{e&&(be.current=e)}),G=Array.isArray(L),Ue=X.useMemo(()=>G?L.slice().sort(Ci):[U(L,p,f)],[f,p,G,L]),We=h((e,t)=>{if(Number.isNaN(e)||ji(e,L))return;let n=t??S(`none`,void 0,void 0,{activeThumbIndex:-1});B.current=n.reason;let r=n.event,i=new(r.constructor??Event)(r.type,r);Object.defineProperty(i,`target`,{writable:!0,value:{value:e,name:I}}),n.event=i,z.current=e,ae(e,n),!n.isCanceled&&ve(e)}),Ge=h((e,t,n)=>{let r=Ti(e,t,p,f,G,Ue);if(Ei(r,x,m)){let e=Ai(n);We(r,S(e,n.nativeEvent,void 0,{activeThumbIndex:t})),D(!0),oe(z.current??r,i(e,n.nativeEvent))}});pe(()=>{let e=re(A(ye.current));F&&b(ye.current,e)&&e.blur()},[F]),F&&De!==-1&&W(-1);let Ke=X.useMemo(()=>({...le,activeThumbIndex:De,disabled:F,dragging:V,orientation:ee,max:f,min:p,minStepsBetweenValues:m,step:x,values:Ue}),[le,De,F,V,f,p,m,ee,x,Ue]),qe=X.useMemo(()=>({active:De,controlRef:be,disabled:F,dragging:V,validation:k,formatOptionsRef:Te,handleInputChange:Ge,indicatorPosition:H,inset:w!==`center`,labelId:P,rootLabelId:ie,largeStep:l,lastUsedThumbIndex:Ae,lastChangedValueRef:z,lastChangeReasonRef:B,form:g,locale:u,max:f,min:p,minStepsBetweenValues:m,name:I,onValueCommitted:oe,orientation:ee,pressedInputRef:R,pressedThumbCenterOffsetRef:Se,pressedThumbIndexRef:Ce,pressedValuesRef:we,registerFieldControlRef:He,renderBeforeHydration:w===`edge`,setActive:W,setDragging:Fe,setIndicatorPosition:Ve,setLabelId:N,setValue:We,state:Ke,step:x,thumbCollisionBehavior:C,thumbMap:Ie,thumbRefs:xe,values:Ue}),[De,be,P,ie,F,V,k,Te,Ge,H,l,Ae,z,B,g,u,f,p,m,I,oe,ee,R,Se,Ce,we,He,W,Fe,Ve,N,We,Ke,x,C,w,Ie,xe,Ue]),Je=_e(`div`,e,{state:Ke,ref:[t,ye],props:[{"aria-labelledby":P,id:ne,role:`group`},k.getValidationProps,E],stateAttributesMapping:Di});return(0,Z.jsx)(Oi.Provider,{value:qe,children:(0,Z.jsx)(Oe,{elementsRef:xe,onMapChange:Le,children:Je})})});function Ni(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function Pi(e){if(e===0)return 0;if(Math.abs(e)<1){let t=e.toExponential().split(`e-`),n=t[0].split(`.`)[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(`.`)[1];return t?t.length:0}function Fi(e,t,n){let r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Math.max(Pi(t),Pi(n))))}function Ii({values:e,index:t,nextValue:n,min:r,max:i,step:a,minStepsBetweenValues:o,initialValues:s}){if(e.length===0)return[];let c=e.slice(),l=a*o,u=c.length-1,d=s??e;c[t]=U(n,r+t*l,i-(u-t)*l);for(let e=t+1;e<=u;e+=1){let t=c[e-1]+l,n=i-(u-e)*l,r=d[e]??c[e],a=Math.max(c[e],t);r<a&&(a=Math.max(r,t)),c[e]=U(a,t,n)}for(let e=t-1;e>=0;--e){let t=c[e+1]-l,n=r+e*l,i=d[e]??c[e],a=Math.min(c[e],t);i>a&&(a=Math.min(i,t)),c[e]=U(a,n,t)}for(let e=0;e<=u;e+=1)c[e]=Number(c[e].toFixed(12));return c}function Li({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}){let u=n??t,d=r??t;if(!(u.length>1))return{value:a,thumbIndex:0,didSwap:!1};let f=c*l;switch(e){case`swap`:{let e=u[i],t=1e-7,n=u.slice(),r=n[i-1],p=n[i+1],m=U(a,r==null?o:r+f,p==null?s:p-f),h=Number(m.toFixed(12));n[i]=h;let g=a>e,_=a<e,v=g&&p!=null&&a>=p-t,y=_&&r!=null&&a<=r+t;if(!v&&!y)return{value:n,thumbIndex:i,didSwap:!1};let b=v?i+1:i-1,ee=n.map((e,t)=>t===i?h:d[t]??u[t]),x=a;x=v?Math.max(a,n[b]):Math.min(a,n[b]);let S=Ii({values:n,index:b,nextValue:x,min:o,max:s,step:c,minStepsBetweenValues:l,initialValues:ee}),C=v?b-1:b+1;if(C>=0&&C<S.length){let e=S[C-1],t=S[C+1],n=e==null?o:e+f;n=Math.max(n,o+C*f);let r=t==null?s:t-f;r=Math.min(r,s-(S.length-1-C)*f);let i=U(h,n,r);S[C]=Number(i.toFixed(12))}return{value:S,thumbIndex:b,didSwap:!0}}case`push`:return{value:Ii({values:u,index:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}),thumbIndex:i,didSwap:!1};default:{let e=u.slice(),t=e[i-1],n=e[i+1],r=U(a,t==null?o:t+f,n==null?s:n-f);return e[i]=Number(r.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}var Ri=2;function zi(e,t){if(!e)return{start:0,end:0};function n(e){let t=e==null?0:parseFloat(e);return Number.isNaN(t)?0:t}let r=t?`Top`:`InlineStart`,i=t?`Bottom`:`InlineEnd`;return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${i}Width`])+n(e[`padding${i}`])}}function Bi(e,t){if(t.current!=null&&e.changedTouches){let n=e;for(let e=0;e<n.changedTouches.length;e+=1){let r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}var Vi=X.forwardRef(function(e,n){let{render:r,className:a,style:o,...s}=e,{disabled:l,dragging:u,inset:f,lastChangedValueRef:p,lastChangeReasonRef:m,max:g,min:v,minStepsBetweenValues:y,onValueCommitted:ee,orientation:x,pressedInputRef:C,pressedThumbCenterOffsetRef:w,pressedThumbIndexRef:T,pressedValuesRef:E,registerFieldControlRef:ne,renderBeforeHydration:ie,setActive:ae,setDragging:oe,setValue:le,state:ue,step:de,thumbCollisionBehavior:fe,thumbRefs:D,values:O}=ki(),pe=ce(),me=O.length>1,he=x===`vertical`,k=X.useRef(null),j=X.useRef(null),ge=h(e=>{e&&j.current==null&&(j.current=c(e).getComputedStyle(e))}),M=X.useRef(null),P=X.useRef(0),I=X.useRef(0),L=se(O);function ve(e){T.current!==e&&(T.current=e);let t=D.current[e];if(!t){w.current=null,C.current=null;return}C.current=t.querySelector(`input[type="range"]`)}function ye(e){let t=k.current;if(!t)return null;let{width:n,height:r,bottom:i,left:a,right:o}=t.getBoundingClientRect(),s=zi(j.current,he),c=I.current,l=(he?r:n)-s.start-s.end-c*2,u=w.current??0,d=e.x-u,f=e.y-u,p=U(((he?i-f-s.end:(pe===`rtl`?o-d:d-a)-s.start)-c)/l,0,1),m=(g-v)*p+v;if(m=Fi(m,de,v),m=U(m,v,g),!me)return{value:m,thumbIndex:0,didSwap:!1};let h=T.current;if(h<0)return null;let _=Li({behavior:fe,values:O,currentValues:L.current??O,initialValues:E.current,pressedIndex:h,nextValue:m,min:v,max:g,step:de,minStepsBetweenValues:y});return fe===`swap`&&_.didSwap?ve(_.thumbIndex):T.current=_.thumbIndex,_}function be(e){E.current=me?O.slice():null,L.current=O;let t=T.current,n=t;if(t>-1&&t<O.length){if(O[t]===g){let e=t;for(;e>0&&O[e-1]===g;)--e;n=e}}else{let t=he?`y`:`x`,r;n=-1;for(let i=0;i<D.current.length;i+=1){let a=D.current[i];if(d(a)){let o=Ni(a),s=Math.abs(e[t]-o[t]);(r===void 0||s<=r)&&(n=i,r=s)}}}if(n>-1&&n!==t&&ve(n),f){let e=D.current[n];d(e)&&(I.current=e.getBoundingClientRect()[he?`height`:`width`]/2)}}function xe(e){let t=D.current?.[e]?.querySelector(`input[type="range"]`);t&&t.focus({preventScroll:!0,focusVisible:!1})}let R=h(e=>{let t=Bi(e,M);if(t==null)return;if(P.current+=1,e.type===`pointermove`&&e.buttons===0){Se(e);return}let n=ye(t);n!=null&&Ei(n.value,de,y)&&(!u&&P.current>Ri&&oe(!0),le(n.value,S(_,e,void 0,{activeThumbIndex:n.thumbIndex})),L.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&xe(n.thumbIndex))});function Se(e){ae(-1),oe(!1),C.current=null,w.current=null;let t=Bi(e,M),n=t==null?null:ye(t);if(n!=null){let t=m.current;ee(p.current??n.value,i(t,e))}`pointerType`in e&&k.current?.hasPointerCapture(e.pointerId)&&k.current?.releasePointerCapture(e.pointerId),T.current=-1,M.current=null,E.current=null,we()}let Ce=h(e=>{if(l)return;let t=e.changedTouches[0];t!=null&&(M.current=t.identifier);let n=Bi(e,M);if(n!=null){be(n);let t=ye(n);if(t==null)return;xe(t.thumbIndex),le(t.value,S(te,e,void 0,{activeThumbIndex:t.thumbIndex})),L.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&xe(t.thumbIndex)}P.current=0;let r=A(k.current);r.addEventListener(`touchmove`,R,{passive:!0}),r.addEventListener(`touchend`,Se,{passive:!0})}),we=h(()=>{let e=A(k.current);e.removeEventListener(`pointermove`,R),e.removeEventListener(`pointerup`,Se),e.removeEventListener(`touchmove`,R),e.removeEventListener(`touchend`,Se),E.current=null}),z=F();return X.useEffect(()=>{let e=k.current;if(!e)return()=>we();let t=N(e,`touchstart`,Ce,{passive:!0});return()=>{t(),z.cancel(),we()}},[we,Ce,k,z]),X.useEffect(()=>{l&&we()},[l,we]),_e(`div`,e,{state:ue,ref:[n,ne,k,ge],props:[{"data-base-ui-slider-control":ie?``:void 0,onPointerDown(e){let n=k.current,r=t(e.nativeEvent);if(!n||l||e.defaultPrevented||!d(r)||e.button!==0)return;let i=Bi(e,M);if(i!=null){be(i);let t=ye(i);if(t==null)return;b(D.current[t.thumbIndex],re(A(n)))?e.preventDefault():z.request(()=>{xe(t.thumbIndex)}),oe(!0),w.current??(le(t.value,S(te,e.nativeEvent,void 0,{activeThumbIndex:t.thumbIndex})),L.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&xe(t.thumbIndex))}e.nativeEvent.pointerId&&n.setPointerCapture(e.nativeEvent.pointerId),P.current=0;let a=A(k.current);a.addEventListener(`pointermove`,R,{passive:!0}),a.addEventListener(`pointerup`,Se,{once:!0})}},s],stateAttributesMapping:Di})}),Hi=X.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=ki();return _e(`div`,e,{state:o,ref:t,props:[{style:{position:`relative`}},a],stateAttributesMapping:Di})}),Ui=function(e){return e.index=`data-index`,e.dragging=`data-dragging`,e.orientation=`data-orientation`,e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.focused=`data-focused`,e}({}),Wi=new Set([...f,w,l]);function Gi(e,t,n,r){if(!(t<0))return e.length===2?t===0?`${Rn(e[t],r,n)} start range`:`${Rn(e[t],r,n)} end range`:n?Rn(e[t],r,n):void 0}function Ki(e,t,n,r,i){let a=n===1?e+t:e-t;return U(Number(a.toFixed(Math.max(Pi(e),Pi(t),Pi(r)))),r,i)}var qi=X.forwardRef(function(e,t){let{render:r,children:i,className:a,"aria-describedby":o,"aria-label":d,"aria-labelledby":p,disabled:g=!1,getAriaLabel:_,getAriaValueText:y,id:b,index:x,inputRef:S,onBlur:te,onFocus:T,onKeyDown:E,tabIndex:re,style:ie,...ae}=e,{nonce:oe}=Fe(),se=ue(b),{active:le,lastUsedThumbIndex:de,controlRef:D,disabled:O,validation:me,formatOptionsRef:he,handleInputChange:k,inset:A,labelId:j,largeStep:ge,locale:M,max:N,min:P,minStepsBetweenValues:F,form:I,name:L,orientation:ve,pressedInputRef:ye,pressedThumbCenterOffsetRef:be,pressedThumbIndexRef:xe,renderBeforeHydration:R,setActive:Se,setIndicatorPosition:Ce,state:we,step:z,values:B}=ki(),Te=ce(),Ee=g||O,Oe=B.length>1,ke=ve===`vertical`,Ae=Te===`rtl`,{setTouched:je,setFocused:Ne,validationMode:Pe}=Me(),V=X.useRef(null),Le=X.useRef(null),Re=X.useRef(!1),ze=ue(),Be=Ie(),H=Oe?ze:Be,{ref:U,index:Ve}=De({metadata:X.useMemo(()=>({inputId:H}),[H])}),W=Oe?x??Ve:0,He=W===B.length-1,G=B[W],Ue=zn(G,P,N),[We,Ge]=X.useState(),Ke=ir(),qe=de>=0&&de<B.length?de:-1,Je=h(()=>{let e=D.current,t=V.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=ke?`height`:`width`,a=r[i]-n[i],o=(n[i]/2+a*Ue/100)/r[i]*100,s=Number.isFinite(o)?o:void 0;Ge(s),W===0?Ce(e=>[s,e[1]]):He&&Ce(e=>[e[0],s])});pe(()=>{A&&queueMicrotask(Je)},[Je,A]),pe(()=>{A&&Je()},[Je,A,Ue]),pe(()=>{if(!A)return;let e=D.current,t=V.current;if(!e||!t)return;let n=c(e).ResizeObserver;if(typeof n!=`function`)return;let r=new n(Je);return r.observe(e),r.observe(t),()=>{r.disconnect()}},[D,Je,A]);let Ye=ke?`bottom`:`insetInlineStart`,Xe=ke?`left`:`top`,Ze;Oe?le===W?Ze=2:qe===W&&(Ze=1):le===W&&(Ze=1);let K;K=A?{"--position":`${We??0}%`,visibility:R&&Ke||We===void 0?`hidden`:void 0,position:`absolute`,[Ye]:`var(--position)`,[Xe]:`50%`,translate:`${(ke||!Ae?-1:1)*50}% ${(ke?1:-1)*50}%`,zIndex:Ze}:Number.isFinite(Ue)?{position:`absolute`,[Ye]:`${Ue}%`,[Xe]:`50%`,translate:`${(ke||!Ae?-1:1)*50}% ${(ke?1:-1)*50}%`,zIndex:Ze}:fe;let Qe;ve===`vertical`&&(Qe=Ae?`vertical-rl`:`vertical-lr`);let $e=typeof _==`function`?_(W):d,et=n({"aria-label":$e,"aria-labelledby":p??($e==null?j:void 0),"aria-describedby":o,"aria-orientation":ve,"aria-valuenow":G,"aria-valuetext":typeof y==`function`?y(Rn(G,M,he.current??void 0),G,W):Gi(B,W,he.current??void 0,M),disabled:Ee,form:I,id:H,max:N,min:P,name:L,onChange(e){k(e.currentTarget.valueAsNumber,W,e)},onFocus(e){let t=Re.current;Re.current=!1,Se(W),Ne(!0),t&&e.stopPropagation()},onBlur(e){if(Re.current){e.stopPropagation();return}V.current&&(Se(-1),je(!0),Ne(!1),Pe===`onBlur`&&me.commit(Ti(G,W,P,N,Oe,B)))},onKeyDown(e){if(!Wi.has(e.key))return;f.has(e.key)&&e.stopPropagation();let t=null,n=Fi(G,z,P);switch(e.key){case u:t=Ki(n,e.shiftKey?ge:z,1,P,N);break;case s:t=Ki(n,e.shiftKey?ge:z,Ae?-1:1,P,N);break;case m:t=Ki(n,e.shiftKey?ge:z,-1,P,N);break;case v:t=Ki(n,e.shiftKey?ge:z,Ae?1:-1,P,N);break;case w:t=Ki(n,ge,1,P,N);break;case l:t=Ki(n,ge,-1,P,N);break;case`End`:t=N,Oe&&(t=Number.isFinite(B[W+1])?B[W+1]-z*F:N);break;case ee:t=P,Oe&&(t=Number.isFinite(B[W-1])?B[W-1]+z*F:P);break;default:break}if(t!==null){let n=e.currentTarget;ne(n)||(Re.current=!0,n.blur(),n.focus({preventScroll:!0,focusVisible:!0})),k(t,W,e),e.preventDefault()}},step:z,style:{...fe,width:`100%`,height:`100%`,writingMode:Qe},tabIndex:re??void 0,type:`range`,value:G??``},me.getInputValidationProps),tt=C(Le,me.inputRef,S);return _e(`div`,e,{state:we,ref:[t,U,V],props:[{[Ui.index]:W,children:(0,Z.jsxs)(X.Fragment,{children:[i,(0,Z.jsx)(`input`,{ref:tt,...et,suppressHydrationWarning:!0}),A&&Ke&&R&&He&&(0,Z.jsx)(`script`,{nonce:oe,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:se,onBlur:te,onFocus:T,onPointerDown(e){if(xe.current=W,V.current!=null){let t=ve===`horizontal`?`x`:`y`,n=Ni(V.current);be.current=(ve===`horizontal`?e.clientX:e.clientY)-n[t]}Le.current!=null&&ye.current!==Le.current&&(ye.current=Le.current)},style:K,suppressHydrationWarning:R||void 0},ae],stateAttributesMapping:Di})});function Ji(e,t,n,r,i,a){let o=n===void 0||t&&r===void 0?`hidden`:void 0,s=e?`bottom`:`insetInlineStart`,c=e?`height`:`width`,l={visibility:i&&a?`hidden`:o,position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};return l[`--start-position`]=`${n??0}%`,t?(l[`--relative-size`]=`${(r??0)-(n??0)}%`,l[s]=`var(--start-position)`,l[c]=`var(--relative-size)`,l):(l[s]=0,l[c]=`var(--start-position)`,l)}function Yi(e,t,n,r){let i=e?`bottom`:`insetInlineStart`,a=e?`height`:`width`,o={position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};if(!t)return o[i]=0,o[a]=`${n}%`,o;let s=r-n;return o[i]=`${n}%`,o[a]=`${s}%`,o}var Xi=X.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{indicatorPosition:o,inset:s,max:c,min:l,orientation:u,renderBeforeHydration:d,state:f,values:p}=ki(),m=ir(),h=u===`vertical`,g=p.length>1,_=s?Ji(h,g,o[0],o[1],d,m):Yi(h,g,zn(p[0],l,c),zn(p[p.length-1],l,c));return _e(`div`,e,{state:f,ref:t,props:[{"data-base-ui-slider-indicator":d?``:void 0,style:_,suppressHydrationWarning:d||void 0},a],stateAttributesMapping:Di})});function Zi({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=Array.isArray(n)?n:n===void 0?Array.isArray(t)?t:t===void 0?[r]:[t]:[n];return(0,Z.jsx)(Mi,{className:j(`data-horizontal:w-full data-vertical:h-full`,e),"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,thumbAlignment:`edge`,...a,children:(0,Z.jsxs)(Vi,{className:`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,children:[(0,Z.jsx)(Hi,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-primary/20 select-none data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5`,children:(0,Z.jsx)(Xi,{"data-slot":`slider-range`,className:`bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,Z.jsx)(qi,{"data-slot":`slider-thumb`,className:`relative block size-4 shrink-0 rounded-full border border-primary/50 bg-background shadow transition-colors select-none after:absolute after:-inset-2 max-md:after:-inset-3.5 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-disabled:pointer-events-none data-disabled:opacity-50`},t))]})})}var Qi=[{label:`Move bundle`,value:`move`},{label:`Copy bundle`,value:`copy`}],$i=e=>({enabled:e.enabled,message:e.message??``,rolloutCohortCount:e.rollout_cohort_count,shouldForceUpdate:e.should_force_update,targetAppVersion:e.target_app_version??``,targetCohorts:[...e.target_cohorts]}),ea=(e,t)=>({enabled:t.enabled,message:t.message.trim()||null,rolloutCohortCount:t.rolloutCohortCount,shouldForceUpdate:t.shouldForceUpdate,...e.strategy===`APP_VERSION`?{targetAppVersion:t.targetAppVersion.trim()}:{},targetCohorts:t.targetCohorts}),ta=e=>(e/10).toFixed(1),na=e=>{let t=e.replace(`,`,`.`),[n=``,...r]=t.split(`.`),i=n.replace(/\D/g,``).slice(0,3),a=r.join(``).replace(/\D/g,``).slice(0,1);return t.includes(`.`)?`${i}.${a}`:i},ra=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?Math.min(1e3,Math.max(0,Math.trunc(t*10))):null};function ia({value:e,onChange:t}){let[n,r]=(0,X.useState)(ta(e)),[i,a]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{i||r(ta(e))},[i,e]),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(Zi,{"aria-label":`Rollout percentage`,max:1e3,min:0,onValueChange:n=>t(Array.isArray(n)?n[0]??e:n),step:1,value:e}),(0,Z.jsxs)(it,{className:`w-24 shrink-0`,children:[(0,Z.jsx)(et,{"aria-label":`Rollout percentage`,autoComplete:`off`,className:`text-right tabular-nums`,id:`release-rollout-percentage`,inputMode:`decimal`,name:`rolloutPercentage`,onBlur:()=>{let i=ra(n)??e;a(!1),r(ta(i)),t(i)},onChange:e=>{let n=na(e.target.value);r(n);let i=ra(n);i!==null&&t(i)},onFocus:()=>a(!0),value:n}),(0,Z.jsx)(tt,{align:`inline-end`,children:(0,Z.jsx)($e,{children:`%`})})]})]})}function aa({channels:t,onOpenChange:n,onShowScope:i,open:a,releaseId:o}){let s=It(o),c=s.data,l=Wt(c?.bundle_id??``),u=l.data,d=u?Et(u):null,f=Xt(c?.scope_key??``),p=Jt(),m=Lt(),h=Bt(),g=qt(),[_,v]=(0,X.useState)(null),[b,ee]=(0,X.useState)(``),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(!1),[te,T]=(0,X.useState)(!1),[E,ne]=(0,X.useState)(!1),[re,ae]=(0,X.useState)(``),[se,ce]=(0,X.useState)(`move`);(0,X.useEffect)(()=>{v(c?$i(c):null),S(``)},[c]);let ue=c?$i(c):null,fe=_!==null&&ue!==null&&JSON.stringify(_)!==JSON.stringify(ue),O=m.isPending||p.isPending||h.isPending||g.isPending,pe=()=>{if(!O){if(fe){w(!0);return}n(!1)}},me=()=>{if(!_)return;let e=xt(b);if(!Ot(e)){S(Ct);return}v({..._,targetCohorts:Array.from(new Set([..._.targetCohorts,e]))}),ee(``),S(``)},he=async()=>{if(!c||!_)return;let e=_.targetCohorts.map(xt);if(e.some(e=>!Ot(e))){S(Ct);return}if(c.strategy===`APP_VERSION`&&!gi(_.targetAppVersion.trim())){S(`Enter a valid target app version range.`);return}let t={expectedRevision:c.revision,patch:ea(c,{..._,targetCohorts:e}),releaseId:c.id};S(``);try{await m.mutateAsync(t),await p.mutateAsync(t),K.success(`Bundle settings saved`),n(!1)}catch(e){S(e instanceof Error?e.message:`Bundle settings could not be saved.`)}},A=t.find(e=>e.id===c?.channel_id)?.name??c?.channel_id,j=t.filter(e=>e.id!==c?.channel_id),ge=j.map(e=>({label:e.name,value:e.name})),M=re.trim(),N=se===`copy`,_e=_?gi(_.targetAppVersion.trim()):null,F=()=>{ae(``),ce(`move`)},I=e=>{!e&&g.isPending||(ne(e),e||F())};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(de,{onOpenChange:e=>e?void 0:pe(),open:a,children:(0,Z.jsxs)(ie,{className:`min-w-0 overflow-hidden data-[side=right]:w-full sm:max-w-[600px]`,children:[(0,Z.jsxs)(P,{className:`shrink-0 pr-12`,children:[(0,Z.jsx)(oe,{children:`Bundle Detail`}),(0,Z.jsx)(k,{className:`sr-only`,children:`Edit bundle delivery settings.`}),c?(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-col gap-3 text-sm`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(sn,{className:`size-4`,platform:c.platform}),(0,Z.jsx)(`span`,{className:`font-medium`,children:c.platform===`ios`?`iOS`:`Android`})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`ID`}),(0,Z.jsxs)(`span`,{className:`min-w-0 basis-full sm:basis-auto`,children:[(0,Z.jsx)(yn,{bundleId:c.id,fullOnMobile:!0,maxLength:18}),c.bundle_id?null:(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:`Built-in bundle`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Channel`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,translate:`no`,children:A})]}),A?(0,Z.jsx)(xi,{bundle:u,channel:A,release:c}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Platform`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:c.platform===`ios`?`iOS`:`Android`})]})]}):(0,Z.jsx)(e,{className:`h-12 w-full`})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[s.isError?(0,Z.jsxs)(ut,{className:`m-4 sm:m-6`,variant:`destructive`,children:[(0,Z.jsx)(dt,{}),(0,Z.jsx)(ct,{children:`Bundle details could not be loaded`}),(0,Z.jsx)(lt,{children:s.error.message})]}):null,c&&_?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6 px-4 pb-4 sm:px-6 sm:pb-6`,children:[A?(0,Z.jsx)(we,{release:{platform:c.platform,channel:A,releaseId:c.id,builtIn:!c.bundle_id}}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`delivery-settings-heading`,className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,id:`delivery-settings-heading`,children:`Delivery settings`}),(0,Z.jsxs)(jt,{className:`gap-6`,children:[(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(kt,{htmlFor:`release-message`,children:`Message`}),(0,Z.jsx)(nt,{autoComplete:`off`,id:`release-message`,name:`message`,onChange:e=>v({..._,message:e.target.value}),rows:3,value:_.message})]}),c.strategy===`APP_VERSION`?(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(kt,{htmlFor:`release-target`,children:`Target app version`}),(0,Z.jsx)(y,{autoComplete:`off`,id:`release-target`,name:`targetAppVersion`,onChange:e=>v({..._,targetAppVersion:e.target.value}),value:_.targetAppVersion}),_e?(0,Z.jsx)(Mt,{children:_e}):null]}):null,(0,Z.jsx)(Pt,{children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(kt,{htmlFor:`release-enabled`,children:`Enabled`}),(0,Z.jsx)(pt,{label:`About Enabled`,children:`Disabling rolls devices back to the previous enabled bundle on their next check, or to the built-in app when none remains.`})]}),(0,Z.jsx)(ot,{"aria-label":`Enabled`,checked:_.enabled,id:`release-enabled`,name:`enabled`,onCheckedChange:e=>v({..._,enabled:e})})]})}),(0,Z.jsx)(Pt,{children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(kt,{htmlFor:`release-force-update`,children:`Force update`}),(0,Z.jsx)(pt,{label:`About Force update`,children:`Devices apply this bundle right away, and so do devices that skip it to update straight to a newer bundle.`})]}),(0,Z.jsx)(ot,{"aria-label":`Force update`,checked:_.shouldForceUpdate,id:`release-force-update`,name:`shouldForceUpdate`,onCheckedChange:e=>v({..._,shouldForceUpdate:e})})]})}),(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(kt,{htmlFor:`release-rollout-percentage`,children:`Rollout percentage`}),(0,Z.jsx)(ia,{onChange:e=>v({..._,rolloutCohortCount:e}),value:_.rolloutCohortCount})]}),(0,Z.jsxs)(Pt,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(kt,{htmlFor:`release-cohort`,children:`Additional cohorts (optional)`}),(0,Z.jsx)(bi,{releaseId:c.id,rolloutCohortCount:_.rolloutCohortCount,targetCohorts:_.targetCohorts})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(y,{autoComplete:`off`,id:`release-cohort`,name:`targetCohort`,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),me())},placeholder:`e.g. qa-team…`,value:b}),(0,Z.jsx)(D,{"aria-label":`Add cohort`,className:`max-md:size-11`,disabled:!b.trim(),onClick:me,size:`icon`,type:`button`,variant:`outline`,children:(0,Z.jsx)(Ze,{})})]}),_.targetCohorts.length?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.targetCohorts.map(e=>(0,Z.jsxs)(q,{className:`gap-1 font-mono`,variant:`secondary`,children:[e,(0,Z.jsx)(`button`,{"aria-label":`Remove cohort ${e}`,className:`rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>v({..._,targetCohorts:_.targetCohorts.filter(t=>t!==e)}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]},e))}):null,(0,Z.jsx)(Mt,{children:`Public names—no IDs or secrets.`})]})]}),x?(0,Z.jsx)(Nt,{children:x}):null,(0,Z.jsx)(D,{className:`w-full max-md:h-11`,disabled:!fe||O,onClick:he,size:`lg`,children:m.isPending||p.isPending?`Saving…`:`Save changes`})]}),(0,Z.jsx)(le,{className:`my-2`}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Actions`}),(0,Z.jsx)(D,{className:`w-full max-md:h-11`,disabled:!c.bundle_id||O,onClick:()=>ne(!0),size:`sm`,variant:`outline`,children:`Promote to channel`}),c.bundle_id?(0,Z.jsxs)(D,{className:`w-full max-md:h-11`,disabled:O,onClick:()=>{window.open(`/api/bundles/${encodeURIComponent(c.bundle_id)}/download`,`_blank`,`noopener,noreferrer`),K.success(`Bundle download started`)},size:`sm`,variant:`outline`,children:[(0,Z.jsx)(We,{"data-icon":`inline-start`}),`Download manifest`]}):null,(0,Z.jsx)(D,{className:`w-full max-md:h-11`,disabled:c.enabled||O,onClick:()=>T(!0),size:`sm`,variant:`destructive`,children:`Remove from channel`})]}),c.bundle_id&&l.isPending?(0,Z.jsx)(e,{className:`h-40 w-full`}):null,c.bundle_id&&l.isError?(0,Z.jsxs)(ut,{variant:`destructive`,children:[(0,Z.jsx)(dt,{}),(0,Z.jsx)(ct,{children:`Build details are unavailable`}),(0,Z.jsx)(lt,{children:`Delivery settings are unaffected.`})]}):null,!c.bundle_id||!l.isPending?(0,Z.jsx)(vi,{bundle:u,release:c}):null,(0,Z.jsxs)(`details`,{className:`rounded-lg border bg-muted/10 p-4 text-xs`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:`Advanced diagnostics`}),(0,Z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:c.bundle_id??`Built-in bundle`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Revision`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:c.revision})]}),d?(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Patch base artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:d})]}):null,(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog generation`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:f.data?.generation??`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog size`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:f.data?`${f.data.byte_size} bytes`:`—`})]}),(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Scope key`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:c.scope_key}),i?(0,Z.jsx)(D,{className:`mt-1 h-auto px-0 text-xs max-md:min-h-11`,onClick:()=>i(c.scope_key),size:`sm`,variant:`link`,children:`Show bundles for this target`}):null]})]}),f.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-destructive`,children:`Diagnostics are unavailable. Bundle settings are unaffected.`}):null]})]}):null]})]})}),(0,Z.jsx)(an,{onOpenChange:w,open:C,children:(0,Z.jsxs)(Qt,{children:[(0,Z.jsxs)(rn,{children:[(0,Z.jsx)($t,{children:`Discard unsaved changes?`}),(0,Z.jsx)(Zt,{children:`Your Bundle changes will be lost.`})]}),(0,Z.jsxs)(tn,{children:[(0,Z.jsx)(nn,{children:`Keep editing`}),(0,Z.jsx)(en,{onClick:()=>{w(!1),n(!1)},variant:`destructive`,children:`Discard changes`})]})]})}),(0,Z.jsx)(an,{onOpenChange:T,open:te,children:(0,Z.jsxs)(Qt,{children:[(0,Z.jsxs)(rn,{children:[(0,Z.jsxs)($t,{children:[`Remove this Bundle from `,A??`the channel`,`?`]}),(0,Z.jsx)(Zt,{children:`The uploaded artifact stays available. This only removes the Bundle from the channel.`})]}),(0,Z.jsxs)(tn,{children:[(0,Z.jsx)(nn,{children:`Cancel`}),(0,Z.jsx)(en,{onClick:async()=>{if(c)try{await h.mutateAsync({expectedRevision:c.revision,releaseId:c.id}),K.success(`Bundle removed from ${A??`the channel`}`),T(!1),n(!1)}catch(e){S(e instanceof Error?e.message:`Bundle could not be removed from the channel.`)}},variant:`destructive`,children:`Remove from channel`})]})]})}),(0,Z.jsx)(mn,{onOpenChange:I,open:E,children:(0,Z.jsxs)(un,{showCloseButton:!g.isPending,children:[(0,Z.jsxs)(cn,{children:[(0,Z.jsx)(dn,{children:`Promote to Channel`}),(0,Z.jsx)(fn,{children:`Choose how to promote this Bundle, then select the target channel.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(At,{htmlFor:`promote-action`,children:`Action`}),(0,Z.jsxs)(G,{disabled:g.isPending,items:Qi,onValueChange:e=>ce(e),value:se,children:[(0,Z.jsx)(Le,{className:`w-full`,id:`promote-action`,children:(0,Z.jsx)(W,{placeholder:`Select an action`})}),(0,Z.jsx)(Ve,{children:(0,Z.jsxs)(He,{children:[(0,Z.jsx)(H,{value:`move`,children:`Move bundle`}),(0,Z.jsx)(H,{value:`copy`,children:`Copy bundle`})]})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:N?`Make this Bundle available in the target channel and keep it in the current channel.`:`Move this Bundle to the target channel. Devices in the current channel may fall back to an earlier Bundle.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(At,{htmlFor:`target-channel`,children:`Target Channel`}),(0,Z.jsxs)(G,{disabled:g.isPending,items:ge,onValueChange:e=>ae(e??``),value:re||null,children:[(0,Z.jsx)(Le,{className:`w-full`,id:`target-channel`,children:(0,Z.jsx)(W,{placeholder:`Select a channel`})}),(0,Z.jsx)(Ve,{className:`md:max-h-64`,children:(0,Z.jsx)(He,{children:j.map(e=>(0,Z.jsx)(H,{value:e.name,children:e.name},e.id))})})]})]})]}),(0,Z.jsxs)(ln,{children:[(0,Z.jsx)(D,{disabled:g.isPending,onClick:()=>I(!1),variant:`outline`,children:`Cancel`}),(0,Z.jsx)(D,{disabled:!M||g.isPending,onClick:async()=>{if(c)try{await g.mutateAsync({action:se,expectedRevision:c.revision,releaseId:c.id,targetChannel:M}),I(!1),K.success(N?`Bundle copied to ${M}`:`Bundle moved to ${M}`)}catch(e){K.error(e instanceof Error?e.message:`Bundle could not be promoted.`)}},children:g.isPending?N?`Copying…`:`Moving…`:N?`Copy`:`Move`})]})]})})]})}function oa({release:e}){return(0,Z.jsxs)(q,{className:`gap-1 font-normal text-muted-foreground`,variant:e.enabled?`outline`:`secondary`,children:[e.enabled?(0,Z.jsx)(B,{className:`size-3`}):(0,Z.jsx)(Ue,{className:`size-3`}),e.enabled?`Enabled`:`Disabled`]})}var sa={data:void 0,error:null,isError:!1,isPending:!0,isPlaceholderData:!1},ca={one:`unreachable bundle`,other:`unreachable bundles`},la=[{label:`iOS`,value:`ios`},{label:`Android`,value:`android`}],ua=[{label:`Any Status`,value:`all`},{label:`Enabled`,value:`enabled`},{label:`Disabled`,value:`disabled`}];function da({channels:e,clearable:t,onChange:n,onClear:i,onManageChannels:a,pending:o,search:s}){let c=s.channelId!==void 0,l=[{label:Dt,value:`all`},...e.map(e=>({label:e.name,value:e.id}))];return(0,Z.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-2 border-b bg-background px-3 py-3 sm:h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:py-0 sm:backdrop-blur-sm`,children:[(0,Z.jsx)(he,{className:`-ml-1 size-11 lg:size-7`}),(0,Z.jsx)(`h1`,{className:`sr-only`,children:`Bundles`}),(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-1.5 text-muted-foreground sm:ml-2`,children:[(0,Z.jsx)(Xn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`text-xs font-medium`,children:`Filters`})]}),(0,Z.jsxs)(G,{disabled:o,items:l,onValueChange:e=>n(e===null||e===`all`?{channelId:void 0,channels:`all`}:{channelId:e}),value:o?null:s.channelId??`all`,children:[(0,Z.jsx)(Le,{"aria-label":`Channel`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 sm:w-[140px] sm:data-[size=default]:h-8`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(Ve,{children:(0,Z.jsxs)(He,{children:[(0,Z.jsx)(H,{value:`all`,children:Dt}),e.map(e=>(0,Z.jsx)(H,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsxs)(G,{disabled:!c,items:la,onValueChange:e=>n({platform:e===`android`?`android`:`ios`}),value:s.platform??`ios`,children:[(0,Z.jsx)(Le,{"aria-label":`Platform`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 max-sm:order-2 sm:w-[140px] sm:data-[size=default]:h-8`,title:c?void 0:`Choose a channel first`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(Ve,{children:(0,Z.jsxs)(He,{children:[(0,Z.jsx)(H,{value:`ios`,children:`iOS`}),(0,Z.jsx)(H,{value:`android`,children:`Android`})]})})]}),(0,Z.jsxs)(G,{disabled:!c&&s.scopeKey===void 0,items:ua,onValueChange:e=>n({enabled:e===`enabled`?!0:e===`disabled`?!1:void 0}),value:s.enabled===void 0?`all`:s.enabled?`enabled`:`disabled`,children:[(0,Z.jsx)(Le,{"aria-label":`Status`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 max-sm:order-2 sm:w-[140px] sm:data-[size=default]:h-8`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(Ve,{children:(0,Z.jsxs)(He,{children:[(0,Z.jsx)(H,{value:`all`,children:`Any Status`}),(0,Z.jsx)(H,{value:`enabled`,children:`Enabled`}),(0,Z.jsx)(H,{value:`disabled`,children:`Disabled`})]})})]}),(0,Z.jsx)(D,{"aria-label":`Manage channels`,className:`size-11 max-sm:order-1 sm:size-7`,onClick:a,size:`icon-sm`,title:`Manage channels`,variant:`outline`,children:(0,Z.jsx)($n,{})}),s.bundleId?(0,Z.jsxs)(q,{className:`max-w-48 gap-1 max-sm:order-3`,variant:`secondary`,children:[`Artifact filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear artifact filter`,className:`relative rounded-sm after:absolute after:-inset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,onClick:()=>n({bundleId:void 0}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]}):null,s.scopeKey?(0,Z.jsxs)(q,{className:`max-w-48 gap-1 max-sm:order-3`,variant:`secondary`,children:[`Target filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear target filter`,className:`relative rounded-sm after:absolute after:-inset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,onClick:()=>n({scopeKey:void 0}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]}):null,t?(0,Z.jsxs)(D,{className:`h-11 px-2 text-xs text-muted-foreground hover:text-foreground max-sm:order-3 sm:ml-auto sm:h-8`,onClick:i,size:`sm`,variant:`ghost`,children:[(0,Z.jsx)(r,{"data-icon":`inline-start`}),`Clear`]}):null]})}function fa({expanded:e,onOpen:t,onToggleExpand:n,release:r}){let i=r.operation===`PROMOTE`?`Promoted`:r.operation===`ROLLBACK`?`Rollback`:null;return(0,Z.jsxs)(`div`,{className:`flex min-w-[240px] items-center gap-3`,children:[r.bundle_id?(0,Z.jsx)(D,{"aria-controls":`bundle-lineage-panel-${r.id}`,"aria-expanded":e,"aria-label":e?`Hide advanced artifact diagnostics`:`Show advanced artifact diagnostics`,title:`Advanced artifact diagnostics`,className:`size-11 shrink-0 touch-manipulation sm:size-8`,onClick:n,size:`icon`,type:`button`,variant:`ghost`,children:e?(0,Z.jsx)(Te,{}):(0,Z.jsx)(je,{})}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-11 shrink-0 sm:size-8`}),(0,Z.jsxs)(`button`,{"aria-label":`Open details for ID ${r.id}`,className:`min-w-0 rounded-sm text-left text-foreground transition-colors underline-offset-4 hover:text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:t,title:r.id,type:`button`,children:[(0,Z.jsx)(yn,{bundleId:r.id,fullOnMobile:!0}),r.bundle_id?null:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,Z.jsx)(rt,{className:`size-3.5`}),` Built-in bundle`]})]}),i?(0,Z.jsx)(q,{className:`shrink-0 font-normal`,variant:`secondary`,children:i}):null,r.currentlyUnreachable?(0,Z.jsx)(Jn,{icon:Ue,label:`Unreachable: no device gets this bundle with the current delivery settings.`,reason:`No device gets this bundle with the current delivery settings.`,children:`Unreachable`}):null]})}function pa({onDetailClick:t,panelId:n,release:r}){let i=r.bundle_id??``,a=Wt(i),o=Ht(i);return a.isError||o.isError?(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:n,children:`Patch lineage could not be loaded.`}):a.isPending?(0,Z.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-2 border-t bg-muted/10 p-4`,id:n,children:[(0,Z.jsx)(e,{className:`h-10 w-full`}),(0,Z.jsx)(e,{className:`h-10 w-full`})]}):a.data?(0,Z.jsx)(or,{bundle:a.data,bundles:o.data??[],loading:o.isPending,onDetailClick:t,panelId:n}):(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:n,children:`Bundle details are unavailable.`})}function ma(e,t){return{patchCounts:Kt(Array.from(new Set(e.flatMap(e=>e.bundle_id?[e.bundle_id]:[])))).data??{},slotReleases:e.flatMap(e=>{let n=t.find(t=>t.id===e.channel_id)?.name;return n?[{releaseId:e.id,platform:e.platform,channel:n,builtIn:!e.bundle_id}]:[]})}}var ha=(e,t)=>t>=e.to&&(e.from===void 0||t<e.from);function ga({fold:e,filter:t,channels:n,columns:r,isMobile:i,open:a,onOpenChange:o,render:s}){let c=zt(t,{...e.from===void 0?{}:{from:e.from},to:e.to},a),l=c.data?.pages.flatMap(e=>e.rows)??[],u=ma(l,n),d=i?void 0:r,f=c.isError?(0,Z.jsx)(Hn,{columns:d,label:`Unreachable bundles`,onRetry:()=>void c.refetch(),state:`error`}):c.isPending||c.isFetchingNextPage?(0,Z.jsx)(Hn,{columns:d,label:`Loading unreachable bundles`,state:`loading`}):c.hasNextPage?(0,Z.jsx)(Hn,{columns:d,label:`Unreachable bundles`,onMore:()=>void c.fetchNextPage(),state:`more`}):null,p={label:Gn(e,ca),open:a,onOpenChange:o,panelId:`bundle-fold-${e.to}`};return i?(0,Z.jsxs)(Wn,{...p,children:[l.map(e=>s(e,u)),f]}):(0,Z.jsxs)(Kn,{...p,columns:r,children:[l.map(e=>s(e,u)),f]})}function _a(){let e=z.useSearch(),t=z.useNavigate(),n=O(),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(),s=Un(),c=Vt(),l=c.data??[],u=c.data,d=be(e,u),f=d===void 0&&c.isError,p=d??e,m=Ce(p),h=Ft({afterReleaseId:p.afterReleaseId,beforeReleaseId:p.beforeReleaseId,filter:m,releaseId:p.releaseId},{enabled:d!==void 0}),g=!ye(e,u),_=d===void 0?sa:h,v=_.data?.entries??[],y=v.flatMap(e=>e.kind===`row`?[e.row]:[]),b=ma(y,l),ee=_.data?.next,x=_.data?.previous,S=xe(),C=10+S.length,w=new Map(l.map(e=>[e.id,e.name])),te=a!==void 0&&(e=>y.some(t=>t.id===e)||v.some(t=>t.kind===`fold`&&s.isOpen(Bn(t))&&ha(t,e)))(a);(0,X.useEffect)(()=>{a!==void 0&&!te&&o(void 0)},[a,te]);let T=(e,n=!0)=>void t({resetScroll:n,search:e,to:`/`}),E=e=>T(Se(p,e)),ne=e=>{y.some(({id:t})=>t===e.id)||s.set(e.id,!0),T({...p,releaseId:e.id},!1)},re=e=>{let t=y.find(t=>t.bundle_id===e.id);if(o(void 0),t){T({...p,releaseId:t.id},!1);return}E({bundleId:e.id})},ie=p.afterReleaseId!==void 0||p.beforeReleaseId!==void 0,oe=x?{...p,afterReleaseId:`after`in x?x.after:void 0,beforeReleaseId:`before`in x?x.before:void 0,releaseId:void 0}:null,se=ee?{...p,afterReleaseId:void 0,beforeReleaseId:ee,releaseId:void 0}:null,ce={...p,afterReleaseId:void 0,beforeReleaseId:void 0,releaseId:void 0},le=(e,t)=>{let n=w.get(e.channel_id)??e.channel_id,r=e.bundle_id?t.patchCounts[e.bundle_id]:0,i=te&&a===e.id,s=`bundle-lineage-panel-${e.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(Dn,{"aria-label":`Bundle ${e.id}`,className:j(`gap-3`,e.currentlyUnreachable&&`bg-muted/60 saturate-50 hover:bg-muted/60 hover:saturate-100 focus-within:saturate-100`,i&&`border-b-0 bg-primary/5`),"data-state":p.releaseId===e.id?`selected`:void 0,onClick:kn(()=>ne(e)),children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsx)(fa,{expanded:i,onOpen:()=>ne(e),onToggleExpand:()=>o(i?void 0:e.id),release:e}),(0,Z.jsx)(bn,{channel:n,className:`shrink-0`})]}),(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-foreground`,children:[(0,Z.jsx)(sn,{className:`size-4`,platform:e.platform}),e.platform===`ios`?`iOS`:`Android`]}),r===void 0||r>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(`span`,{children:r===void 0?`Checking patches`:`${r} ${r===1?`patch`:`patches`}`})]}):null,(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(Mn,{ms:e.created_at_ms})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 text-xs`,children:[(0,Z.jsx)(In,{percentage:e.rollout_cohort_count/10}),(0,Z.jsx)(oa,{release:e}),e.should_force_update?(0,Z.jsx)(q,{variant:`secondary`,children:`Force update`}):null,(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:`Target `}),(0,Z.jsx)(Ae,{appVersion:e.target_app_version,fingerprintHash:e.fingerprint_hash})]})]}),S.map(({Cell:n,feature:r,label:i})=>(0,Z.jsxs)(`div`,{className:`mt-3 text-xs`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:i}),(0,Z.jsx)(n,{releaseId:e.id,releases:t.slotReleases})]},r)),e.message?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.message}):null]}),i&&e.bundle_id?(0,Z.jsx)(pa,{onDetailClick:re,panelId:s,release:e}):null]},e.id)},ue=(e,t)=>{let n=te&&a===e.id,r=`bundle-lineage-panel-${e.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(Cn,{"aria-label":`Open bundle ${e.id}`,className:j(e.currentlyUnreachable&&`bg-muted/60 saturate-50 hover:bg-muted/60 hover:saturate-100 focus-within:saturate-100`,n&&`bg-primary/5`),"data-state":p.releaseId===e.id?`selected`:void 0,onOpen:()=>ne(e),children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(fa,{expanded:n,onOpen:()=>ne(e),onToggleExpand:()=>o(n?void 0:e.id),release:e})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(bn,{channel:w.get(e.channel_id)??e.channel_id})}),(0,Z.jsx)(Y,{className:`whitespace-nowrap`,children:(0,Z.jsx)(on,{platform:e.platform})}),(0,Z.jsx)(Y,{children:e.bundle_id&&t.patchCounts[e.bundle_id]===void 0?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Checking`}):e.bundle_id&&t.patchCounts[e.bundle_id]>0?(0,Z.jsxs)(q,{variant:`secondary`,children:[t.patchCounts[e.bundle_id],` `,t.patchCounts[e.bundle_id]===1?`patch`:`patches`]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(Ae,{appVersion:e.target_app_version,fingerprintHash:e.fingerprint_hash})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(ar,{enabled:e.enabled}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.enabled?`Enabled`:`Disabled`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(ar,{enabled:e.should_force_update,falseIcon:`minus`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.should_force_update?`Required`:`Optional`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(In,{percentage:e.rollout_cohort_count/10})}),S.map(({Cell:n,feature:r})=>(0,Z.jsx)(Y,{children:(0,Z.jsx)(n,{releaseId:e.id,releases:t.slotReleases})},r)),(0,Z.jsx)(Y,{className:`text-sm text-muted-foreground`,title:e.message??void 0,children:e.message||`-`}),(0,Z.jsx)(Y,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Mn,{ms:e.created_at_ms})})]}),n&&e.bundle_id?(0,Z.jsx)(_n,{className:`hover:bg-transparent`,children:(0,Z.jsx)(Y,{className:`border-t-0 p-0`,colSpan:C,children:(0,Z.jsx)(pa,{onDetailClick:re,panelId:r,release:e})})}):null]},e.id)},de=(e,t)=>(0,Z.jsx)(ga,{channels:l,columns:C,filter:m,fold:e,isMobile:n,onOpenChange:t=>s.set(Bn(e),t),open:s.isOpen(Bn(e)),render:t},`fold-${e.to}`),fe=(0,Z.jsxs)(Z.Fragment,{children:[`No `,p.platform===`android`?`Android`:`iOS`,` bundles in`,` `,(0,Z.jsx)(`span`,{translate:`no`,children:w.get(p.channelId??``)??p.channelId})]}),pe=(0,Z.jsx)(jn,{icon:Je,title:y.length===0&&v.length>0?`No device gets the bundles here`:ie?`No more bundles`:R(p)?g?`No bundles match these filters`:fe:`No bundles yet`,children:ie?(0,Z.jsx)(I,{className:ae({className:`mt-1 min-h-11 sm:min-h-8`,variant:`outline`}),search:ce,to:`/`,children:`Show the newest bundles`}):g?(0,Z.jsx)(D,{className:`mt-1 min-h-11 sm:min-h-8`,onClick:()=>T({}),variant:`outline`,children:`Clear filters`}):R(p)?(0,Z.jsx)(D,{className:`mt-1 min-h-11 sm:min-h-8`,onClick:()=>E({channelId:void 0,channels:`all`}),variant:`outline`,children:`Show all channels`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`Deploy one from your app's project:`}),(0,Z.jsx)(`div`,{className:`w-full text-left`,children:(0,Z.jsx)(ke,{label:`the deploy command`,value:`npx hot-updater deploy`,wrap:!0})})]})});return(0,Z.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,Z.jsx)(da,{channels:l,clearable:g,onChange:E,onClear:()=>T({}),onManageChannels:()=>i(!0),pending:d===void 0,search:p}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-6 bg-muted/5 p-3 sm:p-6`,children:[f?(0,Z.jsxs)(ut,{variant:`destructive`,children:[(0,Z.jsx)(dt,{}),(0,Z.jsx)(ct,{children:`Channels couldn't be loaded`}),(0,Z.jsx)(lt,{children:`Bundles show once the channels load.`}),(0,Z.jsx)(ft,{children:(0,Z.jsxs)(D,{className:`min-h-11 sm:min-h-7`,onClick:()=>void c.refetch(),size:`xs`,variant:`outline`,children:[(0,Z.jsx)(Qe,{"data-icon":`inline-start`}),`Retry`]})})]}):_.isError?(0,Z.jsxs)(ut,{variant:`destructive`,children:[(0,Z.jsx)(dt,{}),(0,Z.jsx)(ct,{children:`Bundles could not be loaded`}),(0,Z.jsx)(lt,{children:_.error?.message})]}):(0,Z.jsx)(Sn,{children:n?(0,Z.jsx)(`div`,{className:`h-full overflow-y-auto`,children:_.isPending?(0,Z.jsx)(An,{}):(0,Z.jsxs)(Z.Fragment,{children:[y.length===0?(0,Z.jsx)(Tn,{children:pe}):null,v.map(e=>e.kind===`row`?le(e.row,b):de(e,le))]})}):(0,Z.jsx)(xn,{rowGroups:!0,header:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{children:`ID`}),(0,Z.jsx)(J,{children:`Channel`}),(0,Z.jsx)(J,{children:`Platform`}),(0,Z.jsx)(J,{children:`Patches`}),(0,Z.jsx)(J,{children:`Target`}),(0,Z.jsx)(J,{children:`Enabled`}),(0,Z.jsx)(J,{children:`Force update`}),(0,Z.jsx)(J,{children:`Rollout`}),S.map(({feature:e,label:t})=>(0,Z.jsx)(J,{children:t},e)),(0,Z.jsx)(J,{children:`Message`}),(0,Z.jsx)(J,{children:`Created`})]}),children:_.isPending?(0,Z.jsx)(On,{children:(0,Z.jsx)(wn,{columns:C})}):(0,Z.jsxs)(Z.Fragment,{children:[y.length===0?(0,Z.jsx)(On,{children:(0,Z.jsx)(En,{columns:C,children:pe})}):null,Vn(v).map(e=>e.kind===`fold`?de(e.fold,ue):(0,Z.jsx)(On,{children:e.rows.map(e=>ue(e,b))},`rows-${e.rows[0].id}`))]})})}),!f&&!_.isError&&!_.isPending?(0,Z.jsx)(Nn,{count:y.length,folded:{...qn(v),label:`unreachable`},label:`Bundle pagination`,noun:[`bundle`,`bundles`],pending:_.isPlaceholderData,newest:ie?{search:ce,to:`/`}:void 0,next:se?{search:se,to:`/`}:void 0,previous:oe?{search:oe,to:`/`}:void 0}):null]}),(0,Z.jsx)(aa,{channels:l,onOpenChange:e=>!e&&T({...p,releaseId:void 0},!1),onShowScope:e=>E({scopeKey:e}),open:!!p.releaseId,releaseId:p.releaseId??``}),(0,Z.jsx)(sr,{onOpenChange:i,open:r})]})}export{_a as component};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-
|
|
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 ee}from"./sidebar-UnsNYOry.js";import{t as l}from"./link-D95E0fwF.js";import{i as u,r as d,t as f}from"./preload-helper-52zhjEsw.js";import{a as p,i as te,o as m}from"./console-features-api-De6tXQnd.js";import{_ as h,m as g,s as _,x as v}from"./insights-api-CXXCRZhF.js";import{t as y}from"./key-round-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-DgbtNsWJ.js","assets/sidebar-UnsNYOry.js","assets/alert-dialog-C6K18pl_.js","assets/select-DSZKLAHH.js","assets/useCompositeListItem-B9ONn9qn.js","assets/check-Dz_5aNwx.js","assets/switch-Bvelc7zQ.js","assets/valueToPercent-Db73Kirz.js","assets/link-D95E0fwF.js","assets/arrow-right-jHG0fJt7.js","assets/arrow-up-right-BPRe5soE.js","assets/TargetDisplay-CyBWoX-f.js","assets/copy-BxI24-g-.js","assets/key-round-Dy3paJP6.js","assets/native-builds-3qvP-53q.js","assets/constants-zSb7FXDh.js","assets/dist-Dh2hrHKj.js","assets/HashValueDisplay-DDz2Ecy7.js","assets/chevron-right-CuYrscDY.js","assets/circle-off-BZFOMb8J.js","assets/download-ekENI2Sw.js","assets/list-ClzEOP6k.js","assets/loader-circle-BUfUHW-o.js","assets/plus-CNhNPLpx.js","assets/input-group-cEQZv88S.js","assets/trash-2-SV8_CRNk.js","assets/badge-Cf3eoJjl.js","assets/BundleIdDisplay-Cz5MehaS.js","assets/ChannelBadge-B7DxBTj3.js","assets/RelativeTime-DxYXSuC4.js","assets/relativeTime-CdKwnwWK.js","assets/table-tm9RvUbS.js","assets/RowReason-BvjPxMrd.js","assets/insights-search-BCR_lahU.js","assets/insights-api-CXXCRZhF.js","assets/preload-helper-52zhjEsw.js","assets/PlatformIcon-DjcYGkV6.js","assets/RolloutPercentageBadge-Di_Ca_ss.js","assets/card-CHIqYgB7.js","assets/dialog-ZrH3ul9A.js","assets/field-BHPxgJmr.js","assets/api-sTvbSydX.js","assets/useMutation-BWX97JX2.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 ee}from"./sidebar-UnsNYOry.js";import{t as l}from"./link-D95E0fwF.js";import{i as u,r as d,t as f}from"./preload-helper-52zhjEsw.js";import{a as p,i as te,o as m}from"./console-features-api-De6tXQnd.js";import{_ as h,m as g,s as _,x as v}from"./insights-api-CXXCRZhF.js";import{t as y}from"./key-round-Dy3paJP6.js";import{i as b}from"./switch-Bvelc7zQ.js";import{a as x,t as S}from"./insights-search-BCR_lahU.js";import{a as C,i as w,n as T,o as E,t as D}from"./card-CHIqYgB7.js";import{n as O}from"./constants-zSb7FXDh.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)(y,{}),paths:[`/api-keys`],link:({onClick:e})=>(0,A.jsx)(l,{to:`/api-keys`,onClick:e})}}},M=c({method:`GET`}).middleware([ee]).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)(x,{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)(l,{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=_({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:[`(`,h(g(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)(x,{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)(D,{children:[(0,A.jsxs)(C,{className:`flex-row items-center justify-between px-4 pt-4 pb-3`,children:[(0,A.jsx)(E,{className:`text-sm font-medium`,children:`Insights`}),(0,A.jsx)(L,{})]}),(0,A.jsxs)(T,{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)(w,{className:`px-4 pb-4`,children:(0,A.jsxs)(l,{className:a({className:`max-md:h-11`,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 te(`insightsAnalytics`)?null:(0,A.jsxs)(D,{children:[(0,A.jsx)(C,{className:`px-4 pt-4 pb-3`,children:(0,A.jsx)(E,{className:`text-sm font-medium`,children:`Insights`})}),(0,A.jsx)(T,{className:`px-4 pb-4`,children:(0,A.jsx)(z,{input:e})})]})}function ne({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 H={Cell:ne},U={insights:{navigation:{icon:(0,A.jsx)(v,{}),paths:[`/insights`,`/insights/distribution`,`/installations`],link:({features:e,onClick:t})=>e.insightsAnalytics?(0,A.jsx)(l,{to:`/insights`,onClick:t}):(0,A.jsx)(l,{to:`/installations`,onClick:t})},releaseSection:({release:e})=>(0,A.jsx)(V,{input:e})},insightsAnalytics:{releaseColumn:H,releaseSection:({release:e})=>(0,A.jsx)(B,{input:e})}},W={remoteConfig:{navigation:{icon:(0,A.jsx)(b,{}),paths:[`/remote-config`],link:({onClick:e})=>(0,A.jsx)(l,{to:`/remote-config`,onClick:e})}}},G={...U,...j,...W},K=Object.keys(m),q=()=>{let e=p().data?.features;return e===void 0?[]:K.flatMap(t=>{let n=G[t];return n!==void 0&&e[t]?[{...n,feature:t,label:m[t].label,features:e}]:[]})},J=()=>q().flatMap(({feature:e,label:t,releaseColumn:n})=>n===void 0?[]:[{...n,feature:e,label:t}]);function Y({release:e}){return q().map(({feature:t,releaseSection:n})=>n===void 0?null:(0,A.jsx)(n,{release:e},t))}var X=e=>typeof e==`string`&&e.trim().length>0?e.trim():void 0;function Z(e){let t=X(e.beforeReleaseId),n=t?void 0:X(e.afterReleaseId),r=e.enabled===!0||e.enabled===`true`?!0:e.enabled===!1||e.enabled===`false`?!1:void 0,i=X(e.bundleId),a=i?void 0:X(e.scopeKey),o=i||a?void 0:X(e.channelId),s=o===void 0?void 0:e.platform===`android`?`android`:`ios`;return{afterReleaseId:n,beforeReleaseId:t,bundleId:i,channelId:o,channels:!i&&!a&&!o&&e.channels===`all`?`all`:void 0,enabled:a||o?r:void 0,platform:s,releaseId:X(e.releaseId),scopeKey:a}}function Q(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 re(e){return Q(e).kind!==`all`}function $(e,t){if(e.bundleId||e.scopeKey||e.channelId||e.channels===`all`)return e;if(e.releaseId)return{...e,channels:`all`};if(t===void 0)return;let n=t.find(({name:e})=>e===O);return n?Z({...e,channelId:n.id}):e}function ie(e,t){let n={...e,...t};return t.bundleId?Z({bundleId:n.bundleId}):t.scopeKey?Z({scopeKey:n.scopeKey,enabled:n.enabled}):`channelId`in t||`platform`in t?Z({channelId:n.channelId,channels:n.channels,enabled:n.enabled,platform:n.platform}):Z({bundleId:n.bundleId,channelId:n.channelId,channels:n.channels,enabled:n.enabled,platform:n.platform,scopeKey:n.scopeKey})}function ae(e,t){let n=$(e,t),r=$({},t);return n===void 0||r===void 0||JSON.stringify(Q(n))===JSON.stringify(Q(r))}var oe=u(`/`)({component:d(()=>f(()=>import(`./routes-DgbtNsWJ.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:Z});export{ae as a,q as c,$ as i,J as l,re as n,ie as o,Q as r,Y as s,oe as t};
|