@hot-updater/console 1.2.0-rc.39 → 1.2.0-rc.40
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-CRhUT348.js → -native-builds-search-qeto9-fq.js} +1 -1
- package/.output/public/assets/{BundleIdDisplay-Cz5MehaS.js → BundleIdDisplay-BKaGARD1.js} +1 -1
- package/.output/public/assets/{ChannelBadge-B7DxBTj3.js → ChannelBadge-CPc1M44L.js} +1 -1
- package/.output/public/assets/{CompositeItem-AJPwCjWh.js → CompositeItem-B541MSYC.js} +1 -1
- package/.output/public/assets/{ConsoleFeatureUnavailable-PXmQqkJQ.js → ConsoleFeatureUnavailable-C6aryy7j.js} +1 -1
- package/.output/public/assets/{EventDetails-C7rnoh47.js → EventDetails-BdqU96Wu.js} +1 -1
- package/.output/public/assets/{HashValueDisplay-DDz2Ecy7.js → HashValueDisplay-BHL4xWSY.js} +1 -1
- package/.output/public/assets/InsightsPageHeader-D0Nxcccp.js +1 -0
- package/.output/public/assets/{IosInstall-CJ0427uA.js → IosInstall-CgNa8B4v.js} +1 -1
- package/.output/public/assets/{NativeBuildsNav-CZSaxAYo.js → NativeBuildsNav-BxAmQr2E.js} +1 -1
- package/.output/public/assets/{NotFoundPage-DIwHXtYM.js → NotFoundPage-haKPLHiT.js} +1 -1
- package/.output/public/assets/{PlatformIcon-DjcYGkV6.js → PlatformIcon-DYsYaYt6.js} +1 -1
- package/.output/public/assets/{QrCode-DJ5leikY.js → QrCode-BSNEn_M-.js} +1 -1
- package/.output/public/assets/{RelativeTime-DxYXSuC4.js → RelativeTime-CdQ86VoP.js} +1 -1
- package/.output/public/assets/{RolloutPercentageBadge-Di_Ca_ss.js → RolloutPercentageBadge-Cd1UNLL0.js} +1 -1
- package/.output/public/assets/{RowReason-BvjPxMrd.js → RowReason-CEI-_T6G.js} +1 -1
- package/.output/public/assets/{SandboxBadge-B_edulK_.js → SandboxBadge-CqGX5DiH.js} +1 -1
- package/.output/public/assets/{TargetDisplay-CyBWoX-f.js → TargetDisplay-DMZHMgWk.js} +1 -1
- package/.output/public/assets/{alert-dialog-C6K18pl_.js → alert-dialog-Cj7AOTIE.js} +1 -1
- package/.output/public/assets/{api-keys-D3TC5aQy.js → api-keys-B9XQLCZ8.js} +1 -1
- package/.output/public/assets/api-keys-D4tjInrB.js +1 -0
- package/.output/public/assets/{api-sTvbSydX.js → api-tJRzijjy.js} +1 -1
- package/.output/public/assets/arrow-left-68S4uy4I.js +1 -0
- package/.output/public/assets/arrow-right-DjRwIoF1.js +1 -0
- package/.output/public/assets/arrow-up-right-C_1ALUCD.js +1 -0
- package/.output/public/assets/{badge-Cf3eoJjl.js → badge-zMibJGR5.js} +1 -1
- package/.output/public/assets/{card-CHIqYgB7.js → card-pYZSDIxg.js} +1 -1
- package/.output/public/assets/check-C3VCvMOV.js +1 -0
- package/.output/public/assets/chevron-right-RAuPv9r1.js +1 -0
- package/.output/public/assets/{circle-off-BZFOMb8J.js → circle-off-DvYMC5yF.js} +1 -1
- package/.output/public/assets/{clipboard-D8uvj6FN.js → clipboard-D0JWZ1KF.js} +1 -1
- package/.output/public/assets/{console-features-api-De6tXQnd.js → console-features-api-CtbGqKyr.js} +1 -1
- package/.output/public/assets/{copy-BxI24-g-.js → copy-BjVLMKbo.js} +1 -1
- package/.output/public/assets/{dialog-ZrH3ul9A.js → dialog-DlAv6zou.js} +1 -1
- package/.output/public/assets/{dist-Dh2hrHKj.js → dist-BEmib-ZM.js} +1 -1
- package/.output/public/assets/{download-ekENI2Sw.js → download-CgpaZb23.js} +1 -1
- package/.output/public/assets/{empty-Oq7fhUu4.js → empty-Bwao2ztZ.js} +1 -1
- package/.output/public/assets/{field-BHPxgJmr.js → field-BiSGCVoS.js} +1 -1
- package/.output/public/assets/{git-branch-BOz43vpU.js → git-branch-BGatQV8Q.js} +1 -1
- package/.output/public/assets/{history-Bz8IgNln.js → history-Ci4dhphE.js} +1 -1
- package/.output/public/assets/{index-MllyLAwb.js → index-D7PWINwc.js} +3 -3
- package/.output/public/assets/{input-group-cEQZv88S.js → input-group-CPboh0Rx.js} +1 -1
- package/.output/public/assets/insights-B7GL298D.js +1 -0
- package/.output/public/assets/{insights-DvMY7nq6.js → insights-BzKbxWIo.js} +1 -1
- package/.output/public/assets/insights-Q2nAkSMz.js +2 -0
- package/.output/public/assets/{insights-api-CXXCRZhF.js → insights-api-D4-FZeEI.js} +1 -1
- package/.output/public/assets/{insights-search-BCR_lahU.js → insights-search-DkovoDrZ.js} +1 -1
- package/.output/public/assets/{insights-usage-rpc-BG7EOn2n.js → insights-usage-rpc-DkJgbAYm.js} +1 -1
- package/.output/public/assets/insights_.distribution-BafQuEd0.js +1 -0
- package/.output/public/assets/insights_.distribution-DHU1udei.js +2 -0
- package/.output/public/assets/{insights_.distribution-QzaOKttT.js → insights_.distribution-DmeI9XZw.js} +1 -1
- package/.output/public/assets/{installations-BryK0NqR.js → installations-ClsF2q6A.js} +2 -2
- package/.output/public/assets/installations-CmuNX_Ok.js +1 -0
- package/.output/public/assets/{installations-CzsM7ZGi.js → installations-oGkAO7nb.js} +1 -1
- package/.output/public/assets/{key-round-Dy3paJP6.js → key-round-BkeLvA1m.js} +1 -1
- package/.output/public/assets/{link-D95E0fwF.js → link-CRMwpc7-.js} +1 -1
- package/.output/public/assets/{list-ClzEOP6k.js → list-DQ9YBIDW.js} +1 -1
- package/.output/public/assets/loader-circle-8lunBReu.js +1 -0
- package/.output/public/assets/native-builds-DJlYvvPY.js +2 -0
- package/.output/public/assets/{native-builds-BYQ8bQGN.js → native-builds-NyGMlBx2.js} +1 -1
- package/.output/public/assets/{native-builds-3qvP-53q.js → native-builds-uKuvmyXZ.js} +1 -1
- package/.output/public/assets/{native-builds_._buildId-D2-0EtFr.js → native-builds_._buildId-DZqylSRq.js} +1 -1
- package/.output/public/assets/native-builds_._buildId-Dza7vEcy.js +2 -0
- package/.output/public/assets/{native-builds_.devices-OQV8P5Hf.js → native-builds_.devices-BykEftlY.js} +1 -1
- package/.output/public/assets/native-builds_.devices-DH1JB1zr.js +2 -0
- package/.output/public/assets/plus-DztQIXYL.js +1 -0
- package/.output/public/assets/{preload-helper-52zhjEsw.js → preload-helper-CE9OukVC.js} +1 -1
- package/.output/public/assets/{relativeTime-CdKwnwWK.js → relativeTime-Dbefsycs.js} +1 -1
- package/.output/public/assets/remote-config-BiD075AT.js +1 -0
- package/.output/public/assets/{remote-config-DNSdmvmp.js → remote-config-CBirPcRR.js} +3 -3
- package/.output/public/assets/remote-config-r945bivi.js +1 -0
- package/.output/public/assets/{rotate-cw-CyYMmYDu.js → rotate-cw-BFQcpUTO.js} +1 -1
- package/.output/public/assets/{routes-DgbtNsWJ.js → routes-5U4k3N1_.js} +1 -1
- package/.output/public/assets/{routes-DkzFq9jv.js → routes-DWjGfLRs.js} +2 -2
- package/.output/public/assets/search-BfEqtE64.js +1 -0
- package/.output/public/assets/{select-DSZKLAHH.js → select-DIyG5G-V.js} +1 -1
- package/.output/public/assets/sidebar-BmzmPGuv.js +3 -0
- package/.output/public/assets/smartphone-Dy13ukaU.js +1 -0
- package/.output/public/assets/{switch-Bvelc7zQ.js → switch-B_7OwJhK.js} +1 -1
- package/.output/public/assets/{table-tm9RvUbS.js → table-Bo1jU9-v.js} +1 -1
- package/.output/public/assets/{tabs-TD0mdxc_.js → tabs-DARDj-XC.js} +1 -1
- package/.output/public/assets/{trash-2-SV8_CRNk.js → trash-2-DI0biNI-.js} +1 -1
- package/.output/public/assets/{undo-2-K3gpHMd2.js → undo-2-CxhBbgJw.js} +1 -1
- package/.output/public/assets/{useCompositeListItem-B9ONn9qn.js → useCompositeListItem-Cbk_weKW.js} +1 -1
- package/.output/public/assets/{useMutation-BWX97JX2.js → useMutation-D7IuoOLE.js} +1 -1
- package/.output/server/{__23tanstack-start-server-fn-resolver-D-ox_XZH.mjs → __23tanstack-start-server-fn-resolver-CSEErUrV.mjs} +58 -58
- package/.output/server/_libs/_.mjs +1 -1
- package/.output/server/_ssr/{BundleIdDisplay-Dobgd7p0.mjs → BundleIdDisplay-BfMtMws8.mjs} +2 -2
- package/.output/server/_ssr/{ChannelBadge-Dp9lOdkW.mjs → ChannelBadge-CyjOxlfr.mjs} +3 -3
- package/.output/server/_ssr/{ConsoleFeatureUnavailable-sMoqvehk.mjs → ConsoleFeatureUnavailable-D5a8SXzu.mjs} +5 -5
- package/.output/server/_ssr/{EventDetails-B2lRHRhs.mjs → EventDetails-XaXslOac.mjs} +6 -6
- package/.output/server/_ssr/{HashValueDisplay-DgOVBPz-.mjs → HashValueDisplay-CtrIkPNM.mjs} +2 -2
- package/.output/server/_ssr/{InsightsPageHeader-CFrO8ZhS.mjs → InsightsPageHeader-CK76Vycr.mjs} +9 -9
- package/.output/server/_ssr/{IosInstall-COL13Y9Q.mjs → IosInstall-BD2HpMsh.mjs} +6 -6
- package/.output/server/_ssr/{NativeBuildsNav-DADiCA79.mjs → NativeBuildsNav-DvFscYEN.mjs} +3 -3
- package/.output/server/_ssr/{NotFoundPage-C6fy3EQE.mjs → NotFoundPage-CQc5Envb.mjs} +2 -2
- package/.output/server/_ssr/{QrCode-pjBmMRNW.mjs → QrCode-VPGDhoTy.mjs} +2 -2
- package/.output/server/_ssr/{RelativeTime-ybh_YpRa.mjs → RelativeTime-D6qU9XeU.mjs} +3 -3
- package/.output/server/_ssr/{RolloutPercentageBadge-Ck1Qz_u9.mjs → RolloutPercentageBadge-7HdtPPd8.mjs} +3 -3
- package/.output/server/_ssr/{RowReason-DrDg86zk.mjs → RowReason-CR2C_0d9.mjs} +4 -4
- package/.output/server/_ssr/{SandboxBadge-BVLfk_MI.mjs → SandboxBadge-HQv4waT2.mjs} +2 -2
- package/.output/server/_ssr/{TargetDisplay-CcNoERcA.mjs → TargetDisplay-BQ3rf-jt.mjs} +3 -3
- package/.output/server/_ssr/{alert-dialog-Cneyp4SL.mjs → alert-dialog-DZfV4jo0.mjs} +1 -1
- package/.output/server/_ssr/{api-D1iTDB8X.mjs → api-C3S89RIl.mjs} +3 -3
- package/.output/server/_ssr/{api-keys-BmByedx3.mjs → api-keys-DhgkyA5L.mjs} +2 -2
- package/.output/server/_ssr/{api-keys-rpc-De0gejNE.mjs → api-keys-rpc-PnrzjW84.mjs} +3 -3
- package/.output/server/_ssr/{api-keys-L22cEsbx.mjs → api-keys-tydhn1tu.mjs} +9 -9
- package/.output/server/_ssr/{api-rpc-CLUkjEzc.mjs → api-rpc-D8qYGyez.mjs} +7 -7
- package/.output/server/_ssr/{auth-rpc-BR35Xq9A.mjs → auth-rpc-rMdoXrTW.mjs} +4 -4
- package/.output/server/_ssr/{auth.server-DGB_iSU1.mjs → auth.server-YE2ZZC0j.mjs} +2 -2
- package/.output/server/_ssr/{badge-Cr_XmvdA.mjs → badge-NON1cyRV.mjs} +1 -1
- package/.output/server/_ssr/{card-DmZaoqKT.mjs → card-CVw7zPaM.mjs} +1 -1
- package/.output/server/_ssr/{config.server-B5Dghtv-.mjs → config.server-BYkojQAW.mjs} +3 -3
- package/.output/server/_ssr/{console-access-GUnQkD3j.mjs → console-access-CRyGs-sb.mjs} +2 -2
- package/.output/server/_ssr/{console-features-api-rDUY2XrP.mjs → console-features-api-DwbIx8oM.mjs} +3 -3
- package/.output/server/_ssr/{console-features-rpc-BJrkm9dz.mjs → console-features-rpc-erZu7BIN.mjs} +3 -3
- package/.output/server/_ssr/{dialog-BvTfEtqZ.mjs → dialog-ZuUCxUNo.mjs} +1 -1
- package/.output/server/_ssr/{empty-DD6BahGF.mjs → empty-4FbiMhrz.mjs} +2 -2
- package/.output/server/_ssr/{field-BTahddUR.mjs → field-B9YWRLoo.mjs} +2 -2
- package/.output/server/_ssr/{input-group-DtCeEJ9x.mjs → input-group-sETcyyLC.mjs} +1 -1
- package/.output/server/_ssr/{insights-ChiX0NMe.mjs → insights-BjtOex57.mjs} +19 -19
- package/.output/server/_ssr/{insights-DMnvHO-N.mjs → insights-CkJWItoo.mjs} +2 -2
- package/.output/server/_ssr/{insights-BKG9fP-a.mjs → insights-K6CFztcF.mjs} +5 -5
- package/.output/server/_ssr/{insights-api-Cpr7F9Zq.mjs → insights-api-9jE9dp-3.mjs} +3 -3
- package/.output/server/_ssr/{insights-failures-rpc-ClIZ5YAr.mjs → insights-failures-rpc-XxbDFtKo.mjs} +4 -4
- package/.output/server/_ssr/{insights-recovery-rpc-9vTxL0b9.mjs → insights-recovery-rpc-CFeoyZEw.mjs} +3 -3
- package/.output/server/_ssr/{insights-rpc-ntVL4dMr.mjs → insights-rpc-TAS-cemx.mjs} +3 -3
- package/.output/server/_ssr/{insights-search-BDC6qL_N.mjs → insights-search-DL8LLP6s.mjs} +2 -2
- package/.output/server/_ssr/{insights-usage-rpc-B3tWIvs7.mjs → insights-usage-rpc-CrAA5_Wn.mjs} +3 -3
- package/.output/server/_ssr/{insights-usage-rpc-D1AH4wIp.mjs → insights-usage-rpc-DGSVT5eB.mjs} +3 -3
- package/.output/server/_ssr/{insights_.distribution-Bs9C7zLO.mjs → insights_.distribution-C9nMSRtr.mjs} +5 -5
- package/.output/server/_ssr/{insights_.distribution-16p6uw87.mjs → insights_.distribution-CK5_wfLT.mjs} +2 -2
- package/.output/server/_ssr/{insights_.distribution-BQyY6j-B.mjs → insights_.distribution-DDr3vglh.mjs} +13 -13
- package/.output/server/_ssr/{installations-DD36dmtY.mjs → installations-BvGL_EXM.mjs} +2 -2
- package/.output/server/_ssr/{installations-BjPcHbsA.mjs → installations-CRHGd6SX.mjs} +4 -4
- package/.output/server/_ssr/{installations-DkAGd1RB.mjs → installations-CWutybSC.mjs} +11 -11
- package/.output/server/_ssr/{ios-devices-rpc-CUe5hM5d.mjs → ios-devices-rpc-CCx4TvyR.mjs} +7 -7
- package/.output/server/_ssr/{iosDeviceCookie-DeLAGIDy.mjs → iosDeviceCookie-B3FPj65l.mjs} +3 -3
- package/.output/server/_ssr/{iosDeviceProfile-DEhxhqB1.mjs → iosDeviceProfile-Cclrfk8N.mjs} +2 -2
- package/.output/server/_ssr/{iosDevices-DC6OSIpz.mjs → iosDevices-DMXaKH8F.mjs} +2 -2
- package/.output/server/_ssr/{native-builds-83NqyJmR.mjs → native-builds-BGDsGYAp.mjs} +2 -2
- package/.output/server/_ssr/{native-builds-BVCLjZy3.mjs → native-builds-BPiSm8HX.mjs} +14 -14
- package/.output/server/_ssr/{native-builds_._buildId-CW246wU-.mjs → native-builds_._buildId-B749BEMp.mjs} +15 -15
- package/.output/server/_ssr/{native-builds_._buildId-Dz3ZOBO4.mjs → native-builds_._buildId-CS9w0JIp.mjs} +2 -2
- package/.output/server/_ssr/{native-builds_.devices-BcgwCDYe.mjs → native-builds_.devices-BPT8_91w.mjs} +2 -2
- package/.output/server/_ssr/{native-builds_.devices-Cb1j7l0p.mjs → native-builds_.devices-w_jDlH8K.mjs} +15 -15
- package/.output/server/_ssr/{nativeBuildDownloadLink-S98Fp4EL.mjs → nativeBuildDownloadLink-CXibRgym.mjs} +2 -2
- package/.output/server/_ssr/{nativeBuildInstall-CGx9_h9k.mjs → nativeBuildInstall-BLuyTfXE.mjs} +3 -3
- package/.output/server/_ssr/{release-adoption-rpc-CH1S7Q72.mjs → release-adoption-rpc-DOdELZNl.mjs} +5 -5
- package/.output/server/_ssr/{remote-config-B37Kf8E_.mjs → remote-config-C5mPNt0s.mjs} +2 -2
- package/.output/server/_ssr/{remote-config-D5eSR-Oj.mjs → remote-config-DuOo-AFR.mjs} +17 -17
- package/.output/server/_ssr/{remote-config-rpc-C47nnyek.mjs → remote-config-rpc-rEe5HBxX.mjs} +3 -3
- package/.output/server/_ssr/{remote-config-Bt9nmY6h.mjs → remote-config-xbBIsBh1.mjs} +2 -2
- package/.output/server/_ssr/{router-CHveNRca.mjs → router-Bc5Zx-dc.mjs} +32 -32
- package/.output/server/_ssr/{routes-Dfa8uOh-.mjs → routes-CUQ96XR2.mjs} +8 -8
- package/.output/server/_ssr/{routes-t2IGGOuQ.mjs → routes-DCOnxOlA.mjs} +21 -21
- package/.output/server/_ssr/{schema-migration-rpc-LvcWmZNf.mjs → schema-migration-rpc-DK_ceMAg.mjs} +3 -3
- package/.output/server/_ssr/{select-BM4VyXJ2.mjs → select-dGQiTkaZ.mjs} +1 -1
- package/.output/server/_ssr/{server-ChOocPzQ.mjs → server-l-C5qBnr.mjs} +3 -3
- package/.output/server/_ssr/{sidebar-DaVgRP2d.mjs → sidebar-Ccd4WNjQ.mjs} +12 -5
- package/.output/server/_ssr/ssr.mjs +1 -1
- package/.output/server/_ssr/{switch-BSixbqb5.mjs → switch-CC7UK0Nw.mjs} +2 -2
- package/.output/server/_ssr/{table-DIgStkYT.mjs → table-BAlgZdxo.mjs} +1 -1
- package/.output/server/_ssr/{tabs-BcBESH4i.mjs → tabs-Bm7PWhQk.mjs} +2 -2
- package/.output/server/_tanstack-start-manifest_v-C_zDNaKT.mjs +223 -0
- package/.output/server/index.mjs +381 -381
- package/package.json +7 -7
- package/src/components/features/insights/InsightsPageHeader.tsx +10 -15
- package/src/components/ui/button.tsx +11 -2
- package/.output/public/assets/InsightsPageHeader-C7BMHQtN.js +0 -1
- package/.output/public/assets/api-keys-BhEu-4kH.js +0 -1
- package/.output/public/assets/arrow-left-CxxDwBQs.js +0 -1
- package/.output/public/assets/arrow-right-jHG0fJt7.js +0 -1
- package/.output/public/assets/arrow-up-right-BPRe5soE.js +0 -1
- package/.output/public/assets/check-Dz_5aNwx.js +0 -1
- package/.output/public/assets/chevron-right-CuYrscDY.js +0 -1
- package/.output/public/assets/insights-Cl7F_W3G.js +0 -1
- package/.output/public/assets/insights-Z2S8xvnR.js +0 -2
- package/.output/public/assets/insights_.distribution-BYakpdgY.js +0 -2
- package/.output/public/assets/insights_.distribution-D9yFYdru.js +0 -1
- package/.output/public/assets/installations-D758kWNf.js +0 -1
- package/.output/public/assets/loader-circle-BUfUHW-o.js +0 -1
- package/.output/public/assets/native-builds-CnaQgVq6.js +0 -2
- package/.output/public/assets/native-builds_._buildId-D-eAGzXZ.js +0 -2
- package/.output/public/assets/native-builds_.devices-D8CsVAuR.js +0 -2
- package/.output/public/assets/plus-CNhNPLpx.js +0 -1
- package/.output/public/assets/remote-config-Bt6V_XHg.js +0 -1
- package/.output/public/assets/remote-config-CSJSQdOv.js +0 -1
- package/.output/public/assets/search-C9QXSW-Z.js +0 -1
- package/.output/public/assets/sidebar-UnsNYOry.js +0 -3
- package/.output/public/assets/smartphone-NAD6OBaK.js +0 -1
- package/.output/server/_tanstack-start-manifest_v-CR_uX94i.mjs +0 -223
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,An as n,Ar as r,At as i,Bt as a,C as o,Cr as s,Ct as c,Di as l,Dt as u,Er as d,Et as f,Ft as p,Gt as m,Hn as h,Ht as g,In as _,Jt as v,Kt as ee,L as te,Li as y,Lr as b,Mr as ne,Mt as x,Nr as S,Or as C,Ot as w,Pr as T,Pt as re,Q as E,Qn as D,Qt as O,Ri as ie,Rr as k,Rt as A,Si as j,Sn as M,Sr as N,St as P,Tr as F,Tt as ae,Ut as oe,Vi as I,Vr as L,Vt as se,Wt as ce,Xt as le,Yt as R,Zt as z,_r as B,_t as ue,ct as V,dt as de,en as H,fr as fe,ft as U,gr as W,gt as pe,h as me,hn as he,hr as G,jn as ge,jr as _e,kr as K,kt as q,lt as J,mr as ve,mt as ye,nn as be,ot as Y,p as xe,pr as Se,pt as Ce,qt as X,rn as we,st as Te,tn as Ee,tt as De,ur as Oe,ut as ke,vn as Ae,vr as je,vt as Me,wn as Ne,wt as Pe,xr as Fe,xt as Ie,yt as Le}from"./sidebar-UnsNYOry.js";import{t as Re}from"./link-D95E0fwF.js";import{t as ze}from"./check-Dz_5aNwx.js";import{n as Be,r as Ve}from"./useCompositeListItem-B9ONn9qn.js";import{i as He,n as Ue}from"./TargetDisplay-CyBWoX-f.js";import{F as We,P as Ge,a as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et}from"./select-DSZKLAHH.js";import{o as tt}from"./-native-builds-search-CRhUT348.js";import{t as nt}from"./loader-circle-BUfUHW-o.js";import{l as rt,m as it,n as at,p as ot,t as st}from"./native-builds-3qvP-53q.js";import{n as ct,t as lt}from"./CompositeItem-AJPwCjWh.js";import{r as ut}from"./dist-Dh2hrHKj.js";import{t as dt}from"./smartphone-NAD6OBaK.js";import{t as ft}from"./trash-2-SV8_CRNk.js";import{a as pt,i as mt,n as ht,o as gt,r as _t,t as vt}from"./badge-Cf3eoJjl.js";import{a as yt,n as bt,o as xt,t as St}from"./card-CHIqYgB7.js";import{r as Ct}from"./constants-zSb7FXDh.js";import{n as wt}from"./relativeTime-CdKwnwWK.js";import{a as Tt,i as Et,n as Dt,r as Ot,t as kt}from"./field-BHPxgJmr.js";import{_ as At,a as jt,c as Mt,d as Nt,f as Pt,g as Ft,h as It,i as Lt,l as Rt,p as zt,s as Bt,t as Vt,u as Ht}from"./IosInstall-CJ0427uA.js";import{a as Ut,i as Wt,l as Gt,n as Kt,o as qt,r as Jt,s as Yt,t as Xt}from"./alert-dialog-C6K18pl_.js";import{a as Zt,i as Qt,n as $t,o as en,r as tn,t as nn}from"./dialog-ZrH3ul9A.js";import{t as rn}from"./native-builds_.devices-D8CsVAuR.js";import{i as Z,o as an,r as on}from"./table-tm9RvUbS.js";import{a as sn,c as cn,f as ln,i as un,l as dn,n as fn,r as pn,s as mn,t as hn}from"./RelativeTime-DxYXSuC4.js";import{t as gn}from"./NativeBuildsNav-CZSaxAYo.js";import{t as _n}from"./QrCode-DJ5leikY.js";var vn=L(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Q=I(ie()),yn=Q.createContext(void 0);function bn(e=!0){let t=Q.useContext(yn);if(t===void 0&&!e)throw Error(K(25));return t}var xn=Q.createContext(void 0);function Sn(e){let t=Q.useContext(xn);if(t===void 0&&!e)throw Error(K(33));return t}var Cn=Q.createContext(void 0);function wn(e){let t=Q.useContext(Cn);if(t===void 0&&!e)throw Error(K(36));return t}function Tn(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=bn(!0),d=u!==void 0;return Q.useMemo(()=>({id:r,role:`menuitem`,tabIndex:n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:_})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||d&&!Oe&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,a,o,s,u,d,c])}var En={type:`regular-item`};function Dn(e){let{closeOnClick:t,disabled:n=!1,highlighted:i,id:a,store:o,typingRef:s=o.context.typingRef,nativeButton:c,itemMetadata:l,nodeId:u}=e,f=Q.useRef(null),{getButtonProps:p,buttonRef:m}=d({disabled:n,focusableWhenDisabled:!0,native:c,composite:!0}),h=Tn({closeOnClick:t,highlighted:i,id:a,nodeId:u,store:o,typingRef:s,itemRef:f,itemMetadata:l}),g=Q.useCallback(e=>r(h,{onMouseEnter(){l.type===`submenu-trigger`&&l.setActive()}},e,p),[h,p,l]),_=F(f,m);return Q.useMemo(()=>({getItemProps:g,itemRef:_}),[g,_])}var On=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Be({label:a}),f=Sn(!0),p=U(i),{store:m}=wn(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=Dn({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:En});return Fe(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),$=l(),kn={...Ce,...x},An=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=wn(),{side:c,align:l}=Sn(),u=Qe(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),ee=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),ne=s.useState(`floatingTreeRoot`),x=s.useState(`closeDelay`),S=s.useState(`activeTriggerElement`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=v.type===`context-menu`;q({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Q.useEffect(()=>{function e(e){s.setOpen(!1,M(e.reason,e.domEvent))}return ne.events.on(`close`,e),()=>{ne.events.off(`close`,e)}},[ne.events,s]),Me(b,{enabled:C&&!w&&!T&&v.type!==`menubar`,closeDelay:x});let re=Q.useCallback(e=>{s.set(`popupElement`,e)},[s]),E=Fe(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:v.type===`menu`,instant:h},ref:[t,s.context.popupRef,re],stateAttributesMapping:kn,props:[p,{onKeyDown(e){u&&te.has(e.key)&&e.stopPropagation()}},V(f),o,{"data-rootownerid":y}]}),D=v.type===void 0||T;return(_||v.type===`menubar`&&ee!==`outside-press`)&&(D=!0),(0,$.jsx)(g,{context:b,modal:T,disabled:!m,returnFocus:a===void 0?D:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:ne,previousFocusableElement:S,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:E})}),jn=Q.createContext(void 0);function Mn(){let e=Q.useContext(jn);if(e===void 0)throw Error(K(32));return e}var Nn=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=wn();return i.useState(`mounted`)||n?(0,$.jsx)(jn.Provider,{value:n,children:(0,$.jsx)(R,{ref:t,...r})}):null}),Pn=Q.forwardRef(function(e,n){let{anchor:r,positionMethod:a=`absolute`,className:o,render:s,side:c,align:l,sideOffset:u=0,alignOffset:d=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:_=!1,collisionAvoidance:v=le,style:ee,...te}=e,{store:y}=wn(),b=Mn(),ne=bn(!0),x=y.useState(`parent`),S=y.useState(`floatingRootContext`),C=y.useState(`floatingTreeRoot`),w=y.useState(`mounted`),T=y.useState(`open`),re=y.useState(`modal`),E=y.useState(`openMethod`),D=y.useState(`activeTriggerElement`),O=y.useState(`transitionStatus`),ie=y.useState(`positionerElement`),k=y.useState(`instantType`),A=y.useState(`hasViewport`),j=y.useState(`lastOpenChangeReason`),N=y.useState(`floatingNodeId`),P=y.useState(`floatingParentNodeId`),F=S.useState(`domReferenceElement`),ae=Q.useRef(null),I=i(ie,!1,!1),L=r,se=u,ce=d,R=l,B=v;x.type===`context-menu`&&(L=r??x.context?.anchor,R??=`start`,!c&&R!==`center`&&(ce=e.alignOffset??2,se=e.sideOffset??-5));let ue=c,V=R;x.type===`menu`?(ue??=`inline-end`,V??=`start`,B=e.collisionAvoidance??z):x.type===`menubar`&&(ue??=`bottom`,V??=`start`);let de=x.type===`context-menu`,H=J({anchor:L,floatingRootContext:S,positionMethod:ne?`fixed`:a,mounted:w,side:ue,sideOffset:se,align:V,alignOffset:ce,arrowPadding:de?0:m,collisionBoundary:f,collisionPadding:p,sticky:g,nodeId:N,keepMounted:b,disableAnchorTracking:_,collisionAvoidance:B,shiftCrossAxis:de&&!(`side`in B&&B.side===`flip`),externalTree:C,adaptiveOrigin:A?ke:void 0});Q.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===N&&y.set(`hoverEnabled`,!1),e.nodeId!==N&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,M(h)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[y,C.events,N]),Q.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,M(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,y]);let U=fe();Q.useEffect(()=>{T||U.clear()},[T,U]),Q.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==y.select(`floatingParentNodeId`)))if(e.target&&D&&D!==e.target){let e=y.select(`closeDelay`);e>0?U.isStarted()||U.start(e,()=>{y.setOpen(!1,M(h))}):y.setOpen(!1,M(h))}else U.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,D,y,U]),Q.useEffect(()=>{let e={open:T,nodeId:N,parentNodeId:P,reason:y.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,y,N,P]),_e(()=>{let e=F,t=ae.current;if(e&&(ae.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return I(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,I,y]);let W={open:T,side:H.side,align:H.align,anchorHidden:H.anchorHidden,nested:x.type===`menu`,instant:k},pe=x.type===`menubar`&&x.context.modal;Je(T&&(pe||re&&j!==`trigger-hover`),E===`touch`,ie,D);let me=Te(e,W,{styles:H.positionerStyles,transitionStatus:O,props:te,refs:[n,y.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),he=w&&x.type!==`menu`&&(x.type!==`menubar`&&re&&j!==`trigger-hover`||x.type===`menubar`&&x.context.modal),G=null;return x.type===`menubar`?G=x.context.contentElement:x.type===void 0&&(G=D),(0,$.jsxs)(xn.Provider,{value:H,children:[he&&(0,$.jsx)(t,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:Y(!T),cutout:G}),(0,$.jsx)(oe,{id:N,children:(0,$.jsx)(Ve,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:me})})]})}),Fn=Q.createContext(null);function In(e){let t=Q.useContext(Fn);if(t===null&&!e)throw Error(K(5));return t}var Ln={...P,disabled:A(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:A(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:A(e=>e.openMethod),allowMouseEnter:A(e=>e.allowMouseEnter),stickIfOpen:A(e=>e.stickIfOpen),parent:A(e=>e.parent),rootId:A(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:A(e=>e.activeIndex),isActive:A((e,t)=>e.activeIndex===t),hoverEnabled:A(e=>e.hoverEnabled),instantType:A(e=>e.instantType),lastOpenChangeReason:A(e=>e.openChangeReason),floatingTreeRoot:A(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:A(e=>e.floatingNodeId),floatingParentNodeId:A(e=>e.floatingParentNodeId),itemProps:A(e=>e.itemProps),closeDelay:A(e=>e.closeDelay),hasViewport:A(e=>e.hasViewport),keyboardEventRelay:A(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},Rn=class e extends p{constructor(e){super({...zn(),...e},{positionerRef:Q.createRef(),popupRef:Q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),onOpenChangeComplete:void 0,triggerElements:new c},Ln),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=S(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function zn(){return{...Ie(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new v,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:s,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var Bn=Q.createContext(void 0);function Vn(){return Q.useContext(Bn)}var Hn=ve(function(e){let{children:t,open:n,onOpenChange:i,onOpenChangeComplete:c,defaultOpen:l=!1,disabled:d=!1,modal:p,loopFocus:h=!0,orientation:g=`vertical`,actionsRef:_,closeParentOnEsc:v=!1,handle:te,triggerId:y,defaultTriggerId:b=null,highlightItemOnHover:x=!0}=e,S=bn(!0),C=wn(!0),w=In(!0),T=Vn(),E=Q.useMemo(()=>T&&C?{type:`menu`,store:C.store}:w?{type:`menubar`,context:w}:S&&!C?{type:`context-menu`,context:S}:{type:void 0},[S,C,w,T]),D=Rn.useStore(te?.store,{open:l,openProp:n,activeTriggerId:b,triggerIdProp:y,parent:E});Se(()=>{n===void 0&&D.state.open===!1&&l===!0&&D.update({open:!0,activeTriggerId:b})}),D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,y),D.useContextCallback(`onOpenChangeComplete`,c);let ie=O(),k=O(),A=D.useState(`floatingTreeRoot`),j=m(A),P=ee(),F=D.useState(`open`),oe=D.useState(`activeTriggerElement`),I=D.useState(`positionerElement`),L=D.useState(`hoverEnabled`),se=D.useState(`disabled`),le=D.useState(`lastOpenChangeReason`),R=D.useState(`parent`),z=D.useState(`activeIndex`),B=D.useState(`payload`),ue=D.useState(`floatingParentNodeId`),V=Q.useRef(null),H=Q.useRef(R.type!==`context-menu`),U=fe(),W=Q.useRef(!0),pe=fe(),me=ue!=null,{openMethod:he,triggerProps:G}=o(F);D.useSyncedValues({disabled:d,modal:R.type===void 0?p:void 0,openMethod:he,rootId:ie}),ae(D);let{forceUnmount:K}=f(F,D,()=>{D.update({allowMouseEnter:!1,stickIfOpen:!0})});_e(()=>{S&&!C?D.update({parent:{type:`context-menu`,context:S},floatingNodeId:j,floatingParentNodeId:P}):C&&D.update({floatingNodeId:j,floatingParentNodeId:P})},[S,C,j,P,D]),Q.useEffect(()=>{if(F||(V.current=null),R.type===`context-menu`){if(!F){U.clear(),H.current=!1;return}U.start(500,()=>{H.current=!0})}},[U,F,R.type]),_e(()=>{!F&&!L&&D.set(`hoverEnabled`,!0)},[F,L,D]);let q=ne((e,t)=>{let n=t.reason;if(F===e&&t.trigger===oe&&le===n||(t.preventUnmountOnClose=()=>{D.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=oe??void 0),i?.(e,t),t.isCanceled))return;D.state.floatingRootContext.dispatchOpenChange(e,t);let r=t.event;if(e===!1&&r?.type===`click`&&r.pointerType===`touch`&&!W.current)return;if(!e&&z!==null){let e=D.context.itemDomElements.current[z];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(W.current=!1,pe.start(300,()=>{W.current=!0})):(W.current=!0,pe.clear());let a=(n===`trigger-press`||n===`item-press`)&&r.detail===0&&r?.isTrusted,o=!e&&(n===`escape-key`||n==null),s={open:e,openChangeReason:n};V.current=t.event??null;let c=t.trigger?.id??null;(c||e)&&(s.activeTriggerId=c,s.activeTriggerElement=t.trigger??null),D.update(s),R.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?D.set(`instantType`,`group`):a||o?D.set(`instantType`,a?`click`:`dismiss`):D.set(`instantType`,void 0)}),J=re({popupStore:D,floatingId:k,nested:P!=null,onOpenChange:q}),ve=J.context.events;Q.useEffect(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return ve.on(`setOpen`,e),()=>{ve?.off(`setOpen`,e)}},[ve,q]);let ye=Q.useCallback(()=>{D.setOpen(!1,M(ge))},[D]);Q.useImperativeHandle(_,()=>({unmount:K,close:ye}),[K,ye]);let be;R.type===`context-menu`&&(be=R.context),Q.useImperativeHandle(be?.positionerRef,()=>I,[I]),Q.useImperativeHandle(be?.actionsRef,()=>({setOpen:q}),[q]);let Y=a(J,{enabled:!se,bubbles:{escapeKey:v&&R.type===`menu`},outsidePress(){return R.type!==`context-menu`||V.current?.type===`contextmenu`?!0:H.current},externalTree:me?A:void 0}),xe=de(),Ce=Q.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),X=We(J,{enabled:!se,listRef:D.context.itemDomElements,activeIndex:z,nested:R.type!==void 0,loopFocus:h,orientation:g,parentOrientation:R.type===`menubar`?R.context.orientation:void 0,rtl:xe===`rtl`,disabledIndices:N,onNavigate:Ce,openOnArrowKeyDown:R.type!==`context-menu`,externalTree:me?A:void 0,focusItemOnHover:x}),we=Q.useCallback(e=>{D.context.typingRef.current=e},[D]),Te=Ge(J,{listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:z,resetMs:500,onMatch:e=>{F&&e!==z&&D.set(`activeIndex`,e)},onTyping:we});u(D,{floatingRootContext:J,activeTriggerProps:Q.useMemo(()=>{let e=r(Te.reference,X.reference,Y.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=F,e},[D,Te.reference,X.reference,Y.reference,G,F]),inactiveTriggerProps:Q.useMemo(()=>{let e=r(X.trigger,Y.trigger,G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[X.trigger,Y.trigger,G]),popupProps:Q.useMemo(()=>r(Pe,{id:k,role:`menu`,"aria-labelledby":oe?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),R.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Te.floating,X.floating,Y.floating),[oe,k,R.type,D,Te.floating,X.floating,Y.floating]),itemProps:X.item??s});let Ee=Q.useMemo(()=>({store:D,parent:E}),[D,E]),De=(0,$.jsx)(Cn.Provider,{value:Ee,children:typeof t==`function`?t({payload:B}):t});return R.type===void 0||R.type===`context-menu`?(0,$.jsx)(ce,{externalTree:A,children:De}):De});function Un(e){if(b(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!k(e))return Un(T(e))}var Wn=I(y());function Gn(e,t){let r=Q.useRef(null);function i(t){Wn.flushSync(()=>{e.setOpen(!1,M(n,t.nativeEvent,t.currentTarget))}),be(r.current)?.focus()}function a(r){let i=e.select(`positionerElement`);if(i&&we(r,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Wn.flushSync(()=>{e.setOpen(!1,M(n,r.nativeEvent,r.currentTarget))});let a=Ee(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&D(i,a);){let e=a;if(a=H(a),a===e)break}a?.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:i,handleFocusTargetFocus:a}}function Kn(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Q.useRef(!1);return Q.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Ae(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:s,[t,n,r])}var qn=2,Jn=G(function(e,t){let{render:n,className:i,style:a,disabled:o=!1,nativeButton:c=!0,id:l,openOnHover:u,delay:f=100,closeDelay:p=0,handle:h,payload:g,..._}=e,te=wn(!0),y=h?.store??te?.store;if(!y)throw Error(K(85));let b=U(l),x=y.useState(`isTriggerActive`,b),S=y.useState(`floatingRootContext`),T=y.useState(`isOpenedByTrigger`,b),re=y.useState(`triggerPopupId`,b),E=Q.useRef(null),O=Xn(),ie=C(!0),k=X(),A=Q.useMemo(()=>k??new v,[k]),{registerTrigger:j,isMountedByThisTrigger:M}=w(b,E,y,{payload:g,closeDelay:p,parent:O,floatingTreeRoot:A,floatingNodeId:m(A),floatingParentNodeId:ee(),keyboardEventRelay:ie?.relayKeyboardEvent}),N=O.type===`menubar`,P=y.useState(`disabled`),F=o||P||N&&O.context.disabled,{getButtonProps:ae,buttonRef:oe}=d({disabled:F,native:c});Q.useEffect(()=>{!T&&O.type===void 0&&(y.context.allowMouseUpTriggerRef.current=!1)},[y,T,O.type]);let I=Q.useRef(null),L=fe(),ce=ne(e=>{if(!I.current)return;L.clear(),y.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(D(I.current,t)||D(y.select(`positionerElement`),t)||t===I.current||t!=null&&Un(t)===y.select(`rootId`))return;let n=et(I.current);e.clientX>=n.left-qn&&e.clientX<=n.right+qn&&e.clientY>=n.top-qn&&e.clientY<=n.bottom+qn||A.events.emit(`close`,{domEvent:e,reason:Ne})});Q.useEffect(()=>{T&&y.select(`lastOpenChangeReason`)===`trigger-hover`&&Ae(I.current).addEventListener(`mouseup`,ce,{once:!0})},[T,ce,y]);let le=N&&O.context.hasSubmenuOpen,R=ue(S,{enabled:(u??le)&&!F&&O.type!==`context-menu`&&(!N||le&&!M),handleClose:pe({blockPointerEvents:!N}),mouseOnly:!0,move:!1,restMs:O.type===void 0?f:void 0,delay:{close:p},triggerElementRef:E,externalTree:A,isActiveTrigger:x,isClosing:()=>y.select(`transitionStatus`)===`ending`}),z=Yn(T,y.select(`lastOpenChangeReason`)),B=se(S,{enabled:!F&&O.type!==`context-menu`,event:T&&N?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0?z:!1}),V=Le(S,{enabled:!F&&le}),de=Kn({open:T,enabled:N,mouseDownAction:`open`}),H=Q.useMemo(()=>r(V.reference,B.reference),[V.reference,B.reference]),W=y.useState(`triggerProps`,M),{preFocusGuardRef:me,handlePreFocusGuardFocus:G,handleFocusTargetFocus:ge}=Gn(y,E),_e={disabled:F,open:T},q=[I,t,oe,j,E],J=[H,R??s,W,{"aria-haspopup":`menu`,"aria-controls":re,id:b,onMouseDown:e=>{y.select(`open`)||(L.start(200,()=>{y.context.allowMouseUpTriggerRef.current=!0}),Ae(e.currentTarget).addEventListener(`mouseup`,ce,{once:!0}))}},N?{role:`menuitem`}:{},de,_,ae],ve=Fe(`button`,e,{enabled:!N,stateAttributesMapping:ye,state:_e,ref:q,props:J});return N?(0,$.jsx)(lt,{tag:`button`,render:n,className:i,style:a,state:_e,refs:q,props:J,stateAttributesMapping:ye}):T?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(he,{ref:me,onFocus:G},`${b}-pre-focus-guard`),(0,$.jsx)(Q.Fragment,{children:ve},b),(0,$.jsx)(he,{ref:y.context.triggerFocusTargetRef,onFocus:ge},`${b}-post-focus-guard`)]}):(0,$.jsx)(Q.Fragment,{children:ve},b)});function Yn(e,t){let n=fe(),[r,i]=Q.useState(!1);return _e(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Xn(){let e=bn(!0),t=wn(!0),n=In(!0);return Q.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var Zn=I(wt(),1);function Qn({...e}){return(0,$.jsx)(Hn,{"data-slot":`dropdown-menu`,...e})}function $n({...e}){return(0,$.jsx)(Jn,{"data-slot":`dropdown-menu-trigger`,...e})}function er({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,$.jsx)(Nn,{children:(0,$.jsx)(Pn,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,$.jsx)(An,{"data-slot":`dropdown-menu-content`,className:je(`dark z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function tr({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(On,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:je(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function nr({className:e,...t}){return(0,$.jsx)(De,{"data-slot":`dropdown-menu-separator`,className:je(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var rr={pending:`Requested`,approved:`Approved`,registered:`Registered`},ir={pending:`warning`,approved:`secondary`,registered:`muted`},ar=`all`,or=6,sr=()=>window.location.pathname.endsWith(`/native-builds/devices`)?window.location.pathname.slice(0,-at.length):rt(window.location,``),cr=(e,t)=>({approve:t.canApprove&&e.status===`pending`,rename:t.canApprove,remove:t.canApprove,withdraw:!t.canApprove&&e.status===`pending`&&e.requested_by===t.email}),lr=e=>e.status===`approved`&&e.apple_error!==null,ur=e=>e.requested_by??`Added from a terminal`;function dr({device:e,inTable:t=!1}){return e.apple_error===null?null:t?(0,$.jsx)(`span`,{className:`line-clamp-2 max-w-48 text-xs whitespace-normal text-muted-foreground`,title:e.apple_error,children:e.apple_error}):(0,$.jsx)(`span`,{className:`max-w-64 text-xs whitespace-normal text-muted-foreground`,children:e.apple_error})}function fr({device:e,withError:t=!0}){return(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 flex-col items-start gap-1`,children:[lr(e)?(0,$.jsx)(vt,{variant:`warning`,children:`Apple refused`}):(0,$.jsx)(vt,{variant:ir[e.status],children:rr[e.status]}),t?(0,$.jsx)(dr,{device:e,inTable:!0}):null]})}function pr({device:e}){if(e.build_id===null)return(0,$.jsx)(Ue,{});let t=`A build`;try{t=`Build of ${(0,Zn.default)(Ct(e.build_id)).format(`MMM D`)}`}catch{}return(0,$.jsx)(Re,{className:`text-xs font-medium underline-offset-4 hover:underline`,params:{buildId:e.build_id},to:`/native-builds/$buildId`,children:t})}function mr({device:e,viewer:t,onOpen:n}){let r=cr(e,t);return!r.approve&&!r.rename&&!r.remove&&!r.withdraw?null:(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[r.approve?(0,$.jsxs)(W,{className:`h-11 sm:h-8`,onClick:()=>n({kind:`approve`,device:e}),size:`sm`,children:[(0,$.jsx)(ze,{"data-icon":`inline-start`}),`Approve`]}):null,r.withdraw?(0,$.jsx)(W,{className:`h-11 sm:h-8`,onClick:()=>n({kind:`remove`,device:e}),size:`sm`,variant:`outline`,children:`Withdraw`}):null,r.rename||r.remove?(0,$.jsxs)(Qn,{children:[(0,$.jsx)($n,{render:(0,$.jsx)(W,{"aria-label":`More actions for ${e.name}`,className:`size-11 sm:size-8`,size:`icon-sm`,variant:`ghost`}),children:(0,$.jsx)(vn,{"aria-hidden":`true`})}),(0,$.jsxs)(er,{align:`end`,children:[(0,$.jsxs)(tr,{onClick:()=>n({kind:`rename`,device:e}),children:[(0,$.jsx)(ct,{"aria-hidden":`true`}),`Rename`]}),(0,$.jsx)(nr,{}),(0,$.jsxs)(tr,{onClick:()=>n({kind:`remove`,device:e}),variant:`destructive`,children:[(0,$.jsx)(ft,{"aria-hidden":`true`}),e.status===`pending`?`Decline`:`Remove`]})]})]}):null]})}function hr(){return(0,$.jsx)(vt,{className:`shrink-0 px-1.5`,variant:`muted`,children:`This iPhone`})}function gr({device:e,viewer:t,onOpen:n,isThisIphone:r}){return(0,$.jsxs)(an,{children:[(0,$.jsx)(on,{className:`font-medium`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.name,r?(0,$.jsx)(hr,{}):null]})}),(0,$.jsx)(on,{children:(0,$.jsx)(`span`,{className:`font-mono text-xs`,title:e.udid,translate:`no`,children:it(e.udid)})}),(0,$.jsx)(on,{className:`text-xs`,children:e.requested_by??(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:ur(e)})}),(0,$.jsx)(on,{children:(0,$.jsx)(fr,{device:e})}),(0,$.jsx)(on,{className:`text-xs`,children:(0,$.jsx)(hn,{ms:e.created_at_ms})}),(0,$.jsx)(on,{children:(0,$.jsx)(pr,{device:e})}),(0,$.jsx)(on,{className:`text-right`,children:(0,$.jsx)(mr,{device:e,onOpen:n,viewer:t})})]})}function _r({device:e,viewer:t,onOpen:n,isThisIphone:r}){return(0,$.jsxs)(fn,{className:`cursor-default gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),r?(0,$.jsx)(hr,{}):null]}),(0,$.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,translate:`no`,children:it(e.udid)})]}),(0,$.jsx)(fr,{device:e,withError:!1})]}),(0,$.jsx)(dr,{device:e}),(0,$.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:ur(e)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsx)(hn,{ms:e.created_at_ms}),e.build_id===null?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsx)(pr,{device:e})]})]}),(0,$.jsx)(mr,{device:e,onOpen:n,viewer:t})]})}function vr({target:e,onClose:t}){let n=Rt(),r=Ft(),i=e.kind===`approve`?n:r,[a,o]=(0,Q.useState)(e.device.name),s=a.trim();return(0,$.jsx)(nn,{onOpenChange:e=>e?null:t(),open:!0,children:(0,$.jsxs)($t,{children:[(0,$.jsxs)(Zt,{children:[(0,$.jsx)(en,{children:e.kind===`approve`?`Approve ${e.device.name}?`:`Rename ${e.device.name}`}),(0,$.jsx)(tn,{children:e.kind===`approve`?`The next ad hoc build registers this iPhone with your Apple account. Each new iPhone uses one of the account's 100 a year, and removing it never gives the slot back.`:`The registry shows this name. The next ad hoc build doesn't rename it at Apple.`})]}),(0,$.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),s!==``&&i.mutate({id:e.device.id,name:s},{onSuccess:t})},children:[(0,$.jsxs)(Et,{children:[e.kind===`approve`?(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Requested by`}),(0,$.jsx)(`dd`,{className:`truncate`,children:e.device.requested_by??`Terminal (CLI)`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`UDID`}),(0,$.jsx)(`dd`,{className:`font-mono text-xs break-all select-all`,translate:`no`,children:e.device.udid})]}):null,(0,$.jsxs)(kt,{"data-invalid":i.isError||void 0,children:[(0,$.jsx)(Tt,{htmlFor:`ios-device-dialog-name`,children:`Name`}),(0,$.jsx)(E,{autoComplete:`off`,id:`ios-device-dialog-name`,maxLength:100,onChange:e=>o(e.target.value),value:a}),e.kind===`approve`?(0,$.jsx)(Dt,{children:`The iPhone's ID comes from the person who asked. Approve devices you recognize.`}):null,(0,$.jsx)(Ot,{children:i.isError?`Couldn't ${e.kind===`approve`?`approve`:`rename`} ${e.device.name}. Check your connection and try again.`:null})]})]}),(0,$.jsx)(Qt,{className:`mt-4`,children:(0,$.jsxs)(W,{className:`h-11 sm:h-8`,disabled:s===``||i.isPending,type:`submit`,children:[i.isPending?(0,$.jsx)(nt,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,$.jsx)(ze,{"data-icon":`inline-start`}),e.kind===`approve`?`Approve`:`Rename`]})})]})]})})}function yr({device:e,viewer:t,onClose:n}){let r=It(),i=!t.canApprove,a=e.status===`pending`;return(0,$.jsx)(Xt,{onOpenChange:e=>e?null:n(),open:!0,children:(0,$.jsxs)(Wt,{children:[(0,$.jsxs)(Yt,{children:[(0,$.jsx)(Gt,{children:i?`Withdraw ${e.name}?`:a?`Decline ${e.name}?`:`Remove ${e.name}?`}),(0,$.jsx)(Ut,{children:a?`It leaves the list. Its owner can request it again.`:`It leaves the list. New ad hoc builds keep it until it's disabled at Apple.`})]}),r.isError?(0,$.jsxs)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:[`Couldn't `,i?`withdraw`:a?`decline`:`remove`,` `,e.name,`. Check your connection and try again.`]}):null,(0,$.jsxs)(qt,{children:[(0,$.jsx)(Jt,{disabled:r.isPending,children:`Cancel`}),(0,$.jsxs)(Kt,{disabled:r.isPending,onClick:t=>{t.preventDefault(),r.mutate({udid:e.udid},{onSuccess:n})},variant:`destructive`,children:[r.isPending?(0,$.jsx)(nt,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):null,i?`Withdraw`:a?`Decline`:`Remove`]})]})]})})}function br({device:e,viewer:t}){let n=t?.canApprove===!0;return e.apple_error===null?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,translate:`no`,children:it(e.udid)})]}),(0,$.jsx)(fr,{device:e,withError:!1})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:e.status===`pending`?n?`Approve it below, and it joins the next ad hoc build.`:`A maintainer approves it next.`:e.status===`approved`?`It joins the next ad hoc build.`:`New ad hoc builds install on it.`})]}):(0,$.jsx)(Vt,{canApprove:n,device:e,onDevicesPage:!0})}function xr({status:e,secretName:t}){return(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:e===`local-console`?`iPhones register through your hosted Console: an iPhone can't reach this computer's.`:`Set ${t} on this Console to register iPhones.`})}function Sr({view:t,phone:n}){let[r,i]=(0,Q.useState)(null),a=r??t?.defaultName??``,[o,s]=(0,Q.useState)(a);(0,Q.useEffect)(()=>{let e=setTimeout(()=>s(a.trim()),400);return()=>clearTimeout(e)},[a]);let c=n?.ios===!0,l=Ht({mode:`register`,name:o||`iPhone`},c&&t?.registration===`ready`),u=n===null||window.location.protocol===`https:`,d=c?n.udid:null,f=Nt(d),p=n?.answers??0,{refetch:m}=f,h=(0,Q.useRef)({udid:d,answers:p});(0,Q.useEffect)(()=>{let e=h.current;h.current={udid:d,answers:p},d!==null&&d===e.udid&&p>e.answers&&m()},[d,p,m]);let g=n===null?``:sr(),_=zt(g,n?.receipt??null,c&&t?.registration===`ready`&&(d===null||n.receipt!==null||f.data===null));Lt(n,_.data?.udid);let v=At(g),ee=c&&Mt(_.data?.udid,n.udid),te=(()=>{if(n===null||c&&n.udid!==null&&f.isPending)return(0,$.jsx)(e,{"aria-label":`Loading`,className:`h-36 w-full`});if(c&&f.data)return(0,$.jsx)(br,{device:f.data,viewer:t?.viewer});if(t!==void 0&&(t.registration===`local-console`||t.registration===`no-secret`))return(0,$.jsx)(xr,{secretName:t.secretName,status:t.registration});if(!c)return(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-4 sm:flex-row sm:items-center`,children:[(0,$.jsx)(_n,{className:`size-36 shrink-0`,label:`Open this page on an iPhone`,value:`${window.location.origin}${sr()}${at}`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:`Open this page on the iPhone, in Safari.`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It installs a profile that reads the iPhone's ID, then lists the iPhone here as requested. Nothing stays installed.`})]})]});if(!u)return(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:`iPhones need this Console on HTTPS.`});if(f.data===null&&_.isFetching&&!ee)return(0,$.jsx)(e,{"aria-label":`Loading`,className:`h-36 w-full`});if(ee){let e=a.trim();return(0,$.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-3`,onSubmit:t=>{t.preventDefault(),e!==``&&v.mutate({name:e,receipt:n.receipt})},children:[(0,$.jsxs)(kt,{"data-invalid":v.isError||void 0,children:[(0,$.jsx)(Tt,{htmlFor:`ios-device-register-name`,children:`This iPhone's name`}),(0,$.jsx)(E,{autoComplete:`off`,className:`h-11`,id:`ios-device-register-name`,maxLength:100,onChange:e=>i(e.target.value),value:a}),(0,$.jsx)(Dt,{children:`This Safari checked it before, so no profile is needed.`}),(0,$.jsx)(Ot,{children:v.isError?`The request didn't go through. Try again.`:null})]}),(0,$.jsxs)(W,{className:`h-11 w-full`,disabled:e===``||v.isPending,type:`submit`,children:[v.isPending?(0,$.jsx)(nt,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,$.jsx)(dt,{"data-icon":`inline-start`}),`Request this iPhone`]})]})}return l.data?.status===`local-console`?(0,$.jsx)(xr,{status:`local-console`}):l.data?.status===`no-secret`?(0,$.jsx)(xr,{secretName:l.data.secretName,status:`no-secret`}):(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(kt,{children:[(0,$.jsx)(Tt,{htmlFor:`ios-device-register-name`,children:`This iPhone's name`}),(0,$.jsx)(E,{autoComplete:`off`,className:`h-11`,id:`ios-device-register-name`,maxLength:100,onChange:e=>i(e.target.value),value:a})]}),l.data?.status===`issued`&&o===a.trim()?(0,$.jsxs)(`a`,{className:B({className:`h-auto min-h-11 w-full whitespace-normal`}),href:ot(sr(),l.data.token),children:[(0,$.jsx)(dt,{"data-icon":`inline-start`}),`Install profile`]}):(0,$.jsx)(e,{"aria-label":`Preparing the profile`,className:`h-11 w-full`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Safari only. Allow the download, then install it in Settings, where iOS calls it not signed. Safari comes back here, and nothing stays installed.`})]})})();return(0,$.jsxs)(St,{className:`shadow-sm`,children:[(0,$.jsx)(yt,{className:`border-b px-4 py-3`,children:(0,$.jsx)(xt,{className:`text-sm`,children:(0,$.jsx)(`h2`,{children:`Register an iPhone`})})}),(0,$.jsx)(bt,{className:`p-4 sm:p-6`,children:te})]})}function Cr({search:e,onSearchChange:t}){let n=me(),r=Pt(e.status),i=r.data,a=i?.devices,o=j(),s=()=>void o.invalidateQueries({queryKey:Bt.all}),[c,l]=(0,Q.useState)(null),u=jt(),d=u?.ios===!0?u.udid?.toLowerCase()??null:null,f=()=>l(null),p=(0,$.jsx)(mn,{icon:dt,title:e.status===void 0?`No iPhones yet`:`No ${rr[e.status].toLowerCase()} iPhones`,children:e.status===void 0?(0,$.jsx)(`p`,{children:`Open this page on an iPhone to register it.`}):(0,$.jsx)(W,{className:`h-11 sm:h-8`,onClick:()=>t({}),size:`sm`,variant:`outline`,children:`Show all`})});return(0,$.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-background px-3 py-3 sm:min-h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,$.jsx)(xe,{className:`-ml-1 size-11 lg:size-7`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(tt,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`text-sm font-medium`,children:`Native builds`})]}),(0,$.jsx)(`p`,{className:`basis-full pl-12 text-xs text-muted-foreground sm:basis-auto sm:pl-0`,children:`The iPhones and iPads ad hoc builds install on. Android needs none.`})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:[(0,$.jsx)(gn,{current:`devices`}),(0,$.jsx)(Sr,{phone:u,view:i}),i!==void 0&&!i.viewer.approversConfigured?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:`Nobody approves in this Console. Approve from a terminal:`}),(0,$.jsx)(He,{label:`the approve command`,value:st})]}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)($e,{items:[{label:`All statuses`,value:ar},...Object.keys(rr).map(e=>({label:rr[e],value:e}))],onValueChange:e=>t(e===null||e===ar?{}:{status:e}),value:e.status??ar,children:[(0,$.jsx)(Ke,{"aria-label":`Status`,className:`min-w-0 flex-1 text-xs data-[size=default]:h-11 sm:w-44 sm:flex-none sm:data-[size=default]:h-8`,children:(0,$.jsx)(Xe,{})}),(0,$.jsx)(Ye,{children:(0,$.jsxs)(Ze,{children:[(0,$.jsx)(qe,{value:ar,children:`All statuses`}),Object.keys(rr).map(e=>(0,$.jsx)(qe,{value:e,children:rr[e]},e))]})})]}),(0,$.jsx)(W,{"aria-label":`Refresh iOS devices`,className:`ml-auto size-11 sm:size-7`,disabled:r.isFetching,onClick:s,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(ut,{"aria-hidden":`true`})})]}),r.isError?(0,$.jsxs)(ht,{variant:`destructive`,children:[(0,$.jsx)(gt,{}),(0,$.jsx)(pt,{children:`iOS devices couldn't be loaded`}),(0,$.jsx)(mt,{children:`Check your connection and try again.`}),(0,$.jsx)(_t,{children:(0,$.jsxs)(W,{onClick:s,size:`xs`,variant:`outline`,children:[(0,$.jsx)(ut,{"data-icon":`inline-start`}),`Retry`]})})]}):(0,$.jsx)(cn,{className:`flex-none`,children:n?(0,$.jsx)(`div`,{"aria-busy":r.isPlaceholderData,"aria-label":`iOS devices`,className:`aria-busy:opacity-60`,role:`list`,children:r.isLoading?(0,$.jsx)(pn,{label:`Loading iOS devices`}):a?.length===0?(0,$.jsx)(un,{children:p}):a?.map(e=>(0,$.jsx)(`div`,{className:`border-b last:border-b-0`,role:`listitem`,children:(0,$.jsx)(_r,{device:e,isThisIphone:e.udid===d,onOpen:l,viewer:i.viewer})},e.id))}):(0,$.jsx)(sn,{"aria-busy":r.isPlaceholderData,"aria-label":`iOS devices`,className:`aria-busy:opacity-60`,header:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{children:`Name`}),(0,$.jsx)(Z,{children:`UDID`}),(0,$.jsx)(Z,{children:`Requested by`}),(0,$.jsx)(Z,{children:`Status`}),(0,$.jsx)(Z,{children:`Added`}),(0,$.jsx)(Z,{children:`Build`}),(0,$.jsx)(Z,{className:`text-right`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:r.isLoading?(0,$.jsx)(ln,{columns:or+1,label:`Loading iOS devices`}):a?.length===0?(0,$.jsx)(dn,{columns:or+1,children:p}):a?.map(e=>(0,$.jsx)(gr,{device:e,isThisIphone:e.udid===d,onOpen:l,viewer:i.viewer},e.id))})})]}),c!==null&&c.kind!==`remove`?(0,$.jsx)(vr,{onClose:f,target:c},c.device.id):null,c?.kind===`remove`&&i!==void 0?(0,$.jsx)(yr,{device:c.device,onClose:f,viewer:i.viewer},c.device.id):null]})}function wr(){let e=rn.useSearch(),t=rn.useNavigate();return(0,$.jsx)(Cr,{onSearchChange:e=>void t({search:e,replace:!0}),search:e})}export{wr as component};
|
|
1
|
+
import{$ as e,A as t,An as n,Ar as r,At as i,Bt as a,C as o,Cr as s,Ct as c,Di as l,Dt as u,Er as d,Et as f,Ft as p,Gt as m,Hn as h,Ht as g,In as _,Jt as v,Kt as ee,L as te,Li as y,Lr as b,Mr as ne,Mt as x,Nr as S,Or as C,Ot as w,Pr as T,Pt as re,Q as E,Qn as D,Qt as O,Ri as ie,Rr as k,Rt as A,Si as j,Sn as M,Sr as N,St as P,Tr as F,Tt as ae,Ut as oe,Vi as I,Vr as L,Vt as se,Wt as ce,Xt as le,Yt as R,Zt as z,_r as B,_t as ue,ct as V,dt as de,en as H,fr as fe,ft as U,gr as W,gt as pe,h as me,hn as he,hr as G,jn as ge,jr as _e,kr as K,kt as q,lt as J,mr as ve,mt as ye,nn as be,ot as Y,p as xe,pr as Se,pt as Ce,qt as X,rn as we,st as Te,tn as Ee,tt as De,ur as Oe,ut as ke,vn as Ae,vr as je,vt as Me,wn as Ne,wt as Pe,xr as Fe,xt as Ie,yt as Le}from"./sidebar-BmzmPGuv.js";import{t as Re}from"./link-CRMwpc7-.js";import{t as ze}from"./check-C3VCvMOV.js";import{n as Be,r as Ve}from"./useCompositeListItem-Cbk_weKW.js";import{i as He,n as Ue}from"./TargetDisplay-DMZHMgWk.js";import{F as We,P as Ge,a as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et}from"./select-DIyG5G-V.js";import{o as tt}from"./-native-builds-search-qeto9-fq.js";import{t as nt}from"./loader-circle-8lunBReu.js";import{l as rt,m as it,n as at,p as ot,t as st}from"./native-builds-uKuvmyXZ.js";import{n as ct,t as lt}from"./CompositeItem-B541MSYC.js";import{r as ut}from"./dist-BEmib-ZM.js";import{t as dt}from"./smartphone-Dy13ukaU.js";import{t as ft}from"./trash-2-DI0biNI-.js";import{a as pt,i as mt,n as ht,o as gt,r as _t,t as vt}from"./badge-zMibJGR5.js";import{a as yt,n as bt,o as xt,t as St}from"./card-pYZSDIxg.js";import{r as Ct}from"./constants-zSb7FXDh.js";import{n as wt}from"./relativeTime-Dbefsycs.js";import{a as Tt,i as Et,n as Dt,r as Ot,t as kt}from"./field-BiSGCVoS.js";import{_ as At,a as jt,c as Mt,d as Nt,f as Pt,g as Ft,h as It,i as Lt,l as Rt,p as zt,s as Bt,t as Vt,u as Ht}from"./IosInstall-CgNa8B4v.js";import{a as Ut,i as Wt,l as Gt,n as Kt,o as qt,r as Jt,s as Yt,t as Xt}from"./alert-dialog-Cj7AOTIE.js";import{a as Zt,i as Qt,n as $t,o as en,r as tn,t as nn}from"./dialog-DlAv6zou.js";import{t as rn}from"./native-builds_.devices-DH1JB1zr.js";import{i as Z,o as an,r as on}from"./table-Bo1jU9-v.js";import{a as sn,c as cn,f as ln,i as un,l as dn,n as fn,r as pn,s as mn,t as hn}from"./RelativeTime-CdQ86VoP.js";import{t as gn}from"./NativeBuildsNav-BxAmQr2E.js";import{t as _n}from"./QrCode-BSNEn_M-.js";var vn=L(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Q=I(ie()),yn=Q.createContext(void 0);function bn(e=!0){let t=Q.useContext(yn);if(t===void 0&&!e)throw Error(K(25));return t}var xn=Q.createContext(void 0);function Sn(e){let t=Q.useContext(xn);if(t===void 0&&!e)throw Error(K(33));return t}var Cn=Q.createContext(void 0);function wn(e){let t=Q.useContext(Cn);if(t===void 0&&!e)throw Error(K(36));return t}function Tn(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=bn(!0),d=u!==void 0;return Q.useMemo(()=>({id:r,role:`menuitem`,tabIndex:n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:_})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||d&&!Oe&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,a,o,s,u,d,c])}var En={type:`regular-item`};function Dn(e){let{closeOnClick:t,disabled:n=!1,highlighted:i,id:a,store:o,typingRef:s=o.context.typingRef,nativeButton:c,itemMetadata:l,nodeId:u}=e,f=Q.useRef(null),{getButtonProps:p,buttonRef:m}=d({disabled:n,focusableWhenDisabled:!0,native:c,composite:!0}),h=Tn({closeOnClick:t,highlighted:i,id:a,nodeId:u,store:o,typingRef:s,itemRef:f,itemMetadata:l}),g=Q.useCallback(e=>r(h,{onMouseEnter(){l.type===`submenu-trigger`&&l.setActive()}},e,p),[h,p,l]),_=F(f,m);return Q.useMemo(()=>({getItemProps:g,itemRef:_}),[g,_])}var On=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Be({label:a}),f=Sn(!0),p=U(i),{store:m}=wn(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=Dn({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:En});return Fe(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),$=l(),kn={...Ce,...x},An=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=wn(),{side:c,align:l}=Sn(),u=Qe(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),ee=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),ne=s.useState(`floatingTreeRoot`),x=s.useState(`closeDelay`),S=s.useState(`activeTriggerElement`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=v.type===`context-menu`;q({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Q.useEffect(()=>{function e(e){s.setOpen(!1,M(e.reason,e.domEvent))}return ne.events.on(`close`,e),()=>{ne.events.off(`close`,e)}},[ne.events,s]),Me(b,{enabled:C&&!w&&!T&&v.type!==`menubar`,closeDelay:x});let re=Q.useCallback(e=>{s.set(`popupElement`,e)},[s]),E=Fe(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:v.type===`menu`,instant:h},ref:[t,s.context.popupRef,re],stateAttributesMapping:kn,props:[p,{onKeyDown(e){u&&te.has(e.key)&&e.stopPropagation()}},V(f),o,{"data-rootownerid":y}]}),D=v.type===void 0||T;return(_||v.type===`menubar`&&ee!==`outside-press`)&&(D=!0),(0,$.jsx)(g,{context:b,modal:T,disabled:!m,returnFocus:a===void 0?D:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:ne,previousFocusableElement:S,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:E})}),jn=Q.createContext(void 0);function Mn(){let e=Q.useContext(jn);if(e===void 0)throw Error(K(32));return e}var Nn=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=wn();return i.useState(`mounted`)||n?(0,$.jsx)(jn.Provider,{value:n,children:(0,$.jsx)(R,{ref:t,...r})}):null}),Pn=Q.forwardRef(function(e,n){let{anchor:r,positionMethod:a=`absolute`,className:o,render:s,side:c,align:l,sideOffset:u=0,alignOffset:d=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:_=!1,collisionAvoidance:v=le,style:ee,...te}=e,{store:y}=wn(),b=Mn(),ne=bn(!0),x=y.useState(`parent`),S=y.useState(`floatingRootContext`),C=y.useState(`floatingTreeRoot`),w=y.useState(`mounted`),T=y.useState(`open`),re=y.useState(`modal`),E=y.useState(`openMethod`),D=y.useState(`activeTriggerElement`),O=y.useState(`transitionStatus`),ie=y.useState(`positionerElement`),k=y.useState(`instantType`),A=y.useState(`hasViewport`),j=y.useState(`lastOpenChangeReason`),N=y.useState(`floatingNodeId`),P=y.useState(`floatingParentNodeId`),F=S.useState(`domReferenceElement`),ae=Q.useRef(null),I=i(ie,!1,!1),L=r,se=u,ce=d,R=l,B=v;x.type===`context-menu`&&(L=r??x.context?.anchor,R??=`start`,!c&&R!==`center`&&(ce=e.alignOffset??2,se=e.sideOffset??-5));let ue=c,V=R;x.type===`menu`?(ue??=`inline-end`,V??=`start`,B=e.collisionAvoidance??z):x.type===`menubar`&&(ue??=`bottom`,V??=`start`);let de=x.type===`context-menu`,H=J({anchor:L,floatingRootContext:S,positionMethod:ne?`fixed`:a,mounted:w,side:ue,sideOffset:se,align:V,alignOffset:ce,arrowPadding:de?0:m,collisionBoundary:f,collisionPadding:p,sticky:g,nodeId:N,keepMounted:b,disableAnchorTracking:_,collisionAvoidance:B,shiftCrossAxis:de&&!(`side`in B&&B.side===`flip`),externalTree:C,adaptiveOrigin:A?ke:void 0});Q.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===N&&y.set(`hoverEnabled`,!1),e.nodeId!==N&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,M(h)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[y,C.events,N]),Q.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,M(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,y]);let U=fe();Q.useEffect(()=>{T||U.clear()},[T,U]),Q.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==y.select(`floatingParentNodeId`)))if(e.target&&D&&D!==e.target){let e=y.select(`closeDelay`);e>0?U.isStarted()||U.start(e,()=>{y.setOpen(!1,M(h))}):y.setOpen(!1,M(h))}else U.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,D,y,U]),Q.useEffect(()=>{let e={open:T,nodeId:N,parentNodeId:P,reason:y.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,y,N,P]),_e(()=>{let e=F,t=ae.current;if(e&&(ae.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return I(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,I,y]);let W={open:T,side:H.side,align:H.align,anchorHidden:H.anchorHidden,nested:x.type===`menu`,instant:k},pe=x.type===`menubar`&&x.context.modal;Je(T&&(pe||re&&j!==`trigger-hover`),E===`touch`,ie,D);let me=Te(e,W,{styles:H.positionerStyles,transitionStatus:O,props:te,refs:[n,y.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),he=w&&x.type!==`menu`&&(x.type!==`menubar`&&re&&j!==`trigger-hover`||x.type===`menubar`&&x.context.modal),G=null;return x.type===`menubar`?G=x.context.contentElement:x.type===void 0&&(G=D),(0,$.jsxs)(xn.Provider,{value:H,children:[he&&(0,$.jsx)(t,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:Y(!T),cutout:G}),(0,$.jsx)(oe,{id:N,children:(0,$.jsx)(Ve,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:me})})]})}),Fn=Q.createContext(null);function In(e){let t=Q.useContext(Fn);if(t===null&&!e)throw Error(K(5));return t}var Ln={...P,disabled:A(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:A(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:A(e=>e.openMethod),allowMouseEnter:A(e=>e.allowMouseEnter),stickIfOpen:A(e=>e.stickIfOpen),parent:A(e=>e.parent),rootId:A(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:A(e=>e.activeIndex),isActive:A((e,t)=>e.activeIndex===t),hoverEnabled:A(e=>e.hoverEnabled),instantType:A(e=>e.instantType),lastOpenChangeReason:A(e=>e.openChangeReason),floatingTreeRoot:A(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:A(e=>e.floatingNodeId),floatingParentNodeId:A(e=>e.floatingParentNodeId),itemProps:A(e=>e.itemProps),closeDelay:A(e=>e.closeDelay),hasViewport:A(e=>e.hasViewport),keyboardEventRelay:A(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},Rn=class e extends p{constructor(e){super({...zn(),...e},{positionerRef:Q.createRef(),popupRef:Q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),onOpenChangeComplete:void 0,triggerElements:new c},Ln),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=S(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function zn(){return{...Ie(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new v,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:s,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var Bn=Q.createContext(void 0);function Vn(){return Q.useContext(Bn)}var Hn=ve(function(e){let{children:t,open:n,onOpenChange:i,onOpenChangeComplete:c,defaultOpen:l=!1,disabled:d=!1,modal:p,loopFocus:h=!0,orientation:g=`vertical`,actionsRef:_,closeParentOnEsc:v=!1,handle:te,triggerId:y,defaultTriggerId:b=null,highlightItemOnHover:x=!0}=e,S=bn(!0),C=wn(!0),w=In(!0),T=Vn(),E=Q.useMemo(()=>T&&C?{type:`menu`,store:C.store}:w?{type:`menubar`,context:w}:S&&!C?{type:`context-menu`,context:S}:{type:void 0},[S,C,w,T]),D=Rn.useStore(te?.store,{open:l,openProp:n,activeTriggerId:b,triggerIdProp:y,parent:E});Se(()=>{n===void 0&&D.state.open===!1&&l===!0&&D.update({open:!0,activeTriggerId:b})}),D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,y),D.useContextCallback(`onOpenChangeComplete`,c);let ie=O(),k=O(),A=D.useState(`floatingTreeRoot`),j=m(A),P=ee(),F=D.useState(`open`),oe=D.useState(`activeTriggerElement`),I=D.useState(`positionerElement`),L=D.useState(`hoverEnabled`),se=D.useState(`disabled`),le=D.useState(`lastOpenChangeReason`),R=D.useState(`parent`),z=D.useState(`activeIndex`),B=D.useState(`payload`),ue=D.useState(`floatingParentNodeId`),V=Q.useRef(null),H=Q.useRef(R.type!==`context-menu`),U=fe(),W=Q.useRef(!0),pe=fe(),me=ue!=null,{openMethod:he,triggerProps:G}=o(F);D.useSyncedValues({disabled:d,modal:R.type===void 0?p:void 0,openMethod:he,rootId:ie}),ae(D);let{forceUnmount:K}=f(F,D,()=>{D.update({allowMouseEnter:!1,stickIfOpen:!0})});_e(()=>{S&&!C?D.update({parent:{type:`context-menu`,context:S},floatingNodeId:j,floatingParentNodeId:P}):C&&D.update({floatingNodeId:j,floatingParentNodeId:P})},[S,C,j,P,D]),Q.useEffect(()=>{if(F||(V.current=null),R.type===`context-menu`){if(!F){U.clear(),H.current=!1;return}U.start(500,()=>{H.current=!0})}},[U,F,R.type]),_e(()=>{!F&&!L&&D.set(`hoverEnabled`,!0)},[F,L,D]);let q=ne((e,t)=>{let n=t.reason;if(F===e&&t.trigger===oe&&le===n||(t.preventUnmountOnClose=()=>{D.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=oe??void 0),i?.(e,t),t.isCanceled))return;D.state.floatingRootContext.dispatchOpenChange(e,t);let r=t.event;if(e===!1&&r?.type===`click`&&r.pointerType===`touch`&&!W.current)return;if(!e&&z!==null){let e=D.context.itemDomElements.current[z];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(W.current=!1,pe.start(300,()=>{W.current=!0})):(W.current=!0,pe.clear());let a=(n===`trigger-press`||n===`item-press`)&&r.detail===0&&r?.isTrusted,o=!e&&(n===`escape-key`||n==null),s={open:e,openChangeReason:n};V.current=t.event??null;let c=t.trigger?.id??null;(c||e)&&(s.activeTriggerId=c,s.activeTriggerElement=t.trigger??null),D.update(s),R.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?D.set(`instantType`,`group`):a||o?D.set(`instantType`,a?`click`:`dismiss`):D.set(`instantType`,void 0)}),J=re({popupStore:D,floatingId:k,nested:P!=null,onOpenChange:q}),ve=J.context.events;Q.useEffect(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return ve.on(`setOpen`,e),()=>{ve?.off(`setOpen`,e)}},[ve,q]);let ye=Q.useCallback(()=>{D.setOpen(!1,M(ge))},[D]);Q.useImperativeHandle(_,()=>({unmount:K,close:ye}),[K,ye]);let be;R.type===`context-menu`&&(be=R.context),Q.useImperativeHandle(be?.positionerRef,()=>I,[I]),Q.useImperativeHandle(be?.actionsRef,()=>({setOpen:q}),[q]);let Y=a(J,{enabled:!se,bubbles:{escapeKey:v&&R.type===`menu`},outsidePress(){return R.type!==`context-menu`||V.current?.type===`contextmenu`?!0:H.current},externalTree:me?A:void 0}),xe=de(),Ce=Q.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),X=We(J,{enabled:!se,listRef:D.context.itemDomElements,activeIndex:z,nested:R.type!==void 0,loopFocus:h,orientation:g,parentOrientation:R.type===`menubar`?R.context.orientation:void 0,rtl:xe===`rtl`,disabledIndices:N,onNavigate:Ce,openOnArrowKeyDown:R.type!==`context-menu`,externalTree:me?A:void 0,focusItemOnHover:x}),we=Q.useCallback(e=>{D.context.typingRef.current=e},[D]),Te=Ge(J,{listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:z,resetMs:500,onMatch:e=>{F&&e!==z&&D.set(`activeIndex`,e)},onTyping:we});u(D,{floatingRootContext:J,activeTriggerProps:Q.useMemo(()=>{let e=r(Te.reference,X.reference,Y.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=F,e},[D,Te.reference,X.reference,Y.reference,G,F]),inactiveTriggerProps:Q.useMemo(()=>{let e=r(X.trigger,Y.trigger,G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[X.trigger,Y.trigger,G]),popupProps:Q.useMemo(()=>r(Pe,{id:k,role:`menu`,"aria-labelledby":oe?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),R.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Te.floating,X.floating,Y.floating),[oe,k,R.type,D,Te.floating,X.floating,Y.floating]),itemProps:X.item??s});let Ee=Q.useMemo(()=>({store:D,parent:E}),[D,E]),De=(0,$.jsx)(Cn.Provider,{value:Ee,children:typeof t==`function`?t({payload:B}):t});return R.type===void 0||R.type===`context-menu`?(0,$.jsx)(ce,{externalTree:A,children:De}):De});function Un(e){if(b(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!k(e))return Un(T(e))}var Wn=I(y());function Gn(e,t){let r=Q.useRef(null);function i(t){Wn.flushSync(()=>{e.setOpen(!1,M(n,t.nativeEvent,t.currentTarget))}),be(r.current)?.focus()}function a(r){let i=e.select(`positionerElement`);if(i&&we(r,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Wn.flushSync(()=>{e.setOpen(!1,M(n,r.nativeEvent,r.currentTarget))});let a=Ee(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&D(i,a);){let e=a;if(a=H(a),a===e)break}a?.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:i,handleFocusTargetFocus:a}}function Kn(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Q.useRef(!1);return Q.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Ae(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:s,[t,n,r])}var qn=2,Jn=G(function(e,t){let{render:n,className:i,style:a,disabled:o=!1,nativeButton:c=!0,id:l,openOnHover:u,delay:f=100,closeDelay:p=0,handle:h,payload:g,..._}=e,te=wn(!0),y=h?.store??te?.store;if(!y)throw Error(K(85));let b=U(l),x=y.useState(`isTriggerActive`,b),S=y.useState(`floatingRootContext`),T=y.useState(`isOpenedByTrigger`,b),re=y.useState(`triggerPopupId`,b),E=Q.useRef(null),O=Xn(),ie=C(!0),k=X(),A=Q.useMemo(()=>k??new v,[k]),{registerTrigger:j,isMountedByThisTrigger:M}=w(b,E,y,{payload:g,closeDelay:p,parent:O,floatingTreeRoot:A,floatingNodeId:m(A),floatingParentNodeId:ee(),keyboardEventRelay:ie?.relayKeyboardEvent}),N=O.type===`menubar`,P=y.useState(`disabled`),F=o||P||N&&O.context.disabled,{getButtonProps:ae,buttonRef:oe}=d({disabled:F,native:c});Q.useEffect(()=>{!T&&O.type===void 0&&(y.context.allowMouseUpTriggerRef.current=!1)},[y,T,O.type]);let I=Q.useRef(null),L=fe(),ce=ne(e=>{if(!I.current)return;L.clear(),y.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(D(I.current,t)||D(y.select(`positionerElement`),t)||t===I.current||t!=null&&Un(t)===y.select(`rootId`))return;let n=et(I.current);e.clientX>=n.left-qn&&e.clientX<=n.right+qn&&e.clientY>=n.top-qn&&e.clientY<=n.bottom+qn||A.events.emit(`close`,{domEvent:e,reason:Ne})});Q.useEffect(()=>{T&&y.select(`lastOpenChangeReason`)===`trigger-hover`&&Ae(I.current).addEventListener(`mouseup`,ce,{once:!0})},[T,ce,y]);let le=N&&O.context.hasSubmenuOpen,R=ue(S,{enabled:(u??le)&&!F&&O.type!==`context-menu`&&(!N||le&&!M),handleClose:pe({blockPointerEvents:!N}),mouseOnly:!0,move:!1,restMs:O.type===void 0?f:void 0,delay:{close:p},triggerElementRef:E,externalTree:A,isActiveTrigger:x,isClosing:()=>y.select(`transitionStatus`)===`ending`}),z=Yn(T,y.select(`lastOpenChangeReason`)),B=se(S,{enabled:!F&&O.type!==`context-menu`,event:T&&N?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0?z:!1}),V=Le(S,{enabled:!F&&le}),de=Kn({open:T,enabled:N,mouseDownAction:`open`}),H=Q.useMemo(()=>r(V.reference,B.reference),[V.reference,B.reference]),W=y.useState(`triggerProps`,M),{preFocusGuardRef:me,handlePreFocusGuardFocus:G,handleFocusTargetFocus:ge}=Gn(y,E),_e={disabled:F,open:T},q=[I,t,oe,j,E],J=[H,R??s,W,{"aria-haspopup":`menu`,"aria-controls":re,id:b,onMouseDown:e=>{y.select(`open`)||(L.start(200,()=>{y.context.allowMouseUpTriggerRef.current=!0}),Ae(e.currentTarget).addEventListener(`mouseup`,ce,{once:!0}))}},N?{role:`menuitem`}:{},de,_,ae],ve=Fe(`button`,e,{enabled:!N,stateAttributesMapping:ye,state:_e,ref:q,props:J});return N?(0,$.jsx)(lt,{tag:`button`,render:n,className:i,style:a,state:_e,refs:q,props:J,stateAttributesMapping:ye}):T?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(he,{ref:me,onFocus:G},`${b}-pre-focus-guard`),(0,$.jsx)(Q.Fragment,{children:ve},b),(0,$.jsx)(he,{ref:y.context.triggerFocusTargetRef,onFocus:ge},`${b}-post-focus-guard`)]}):(0,$.jsx)(Q.Fragment,{children:ve},b)});function Yn(e,t){let n=fe(),[r,i]=Q.useState(!1);return _e(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Xn(){let e=bn(!0),t=wn(!0),n=In(!0);return Q.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var Zn=I(wt(),1);function Qn({...e}){return(0,$.jsx)(Hn,{"data-slot":`dropdown-menu`,...e})}function $n({...e}){return(0,$.jsx)(Jn,{"data-slot":`dropdown-menu-trigger`,...e})}function er({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,$.jsx)(Nn,{children:(0,$.jsx)(Pn,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,$.jsx)(An,{"data-slot":`dropdown-menu-content`,className:je(`dark z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function tr({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(On,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:je(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function nr({className:e,...t}){return(0,$.jsx)(De,{"data-slot":`dropdown-menu-separator`,className:je(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var rr={pending:`Requested`,approved:`Approved`,registered:`Registered`},ir={pending:`warning`,approved:`secondary`,registered:`muted`},ar=`all`,or=6,sr=()=>window.location.pathname.endsWith(`/native-builds/devices`)?window.location.pathname.slice(0,-at.length):rt(window.location,``),cr=(e,t)=>({approve:t.canApprove&&e.status===`pending`,rename:t.canApprove,remove:t.canApprove,withdraw:!t.canApprove&&e.status===`pending`&&e.requested_by===t.email}),lr=e=>e.status===`approved`&&e.apple_error!==null,ur=e=>e.requested_by??`Added from a terminal`;function dr({device:e,inTable:t=!1}){return e.apple_error===null?null:t?(0,$.jsx)(`span`,{className:`line-clamp-2 max-w-48 text-xs whitespace-normal text-muted-foreground`,title:e.apple_error,children:e.apple_error}):(0,$.jsx)(`span`,{className:`max-w-64 text-xs whitespace-normal text-muted-foreground`,children:e.apple_error})}function fr({device:e,withError:t=!0}){return(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 flex-col items-start gap-1`,children:[lr(e)?(0,$.jsx)(vt,{variant:`warning`,children:`Apple refused`}):(0,$.jsx)(vt,{variant:ir[e.status],children:rr[e.status]}),t?(0,$.jsx)(dr,{device:e,inTable:!0}):null]})}function pr({device:e}){if(e.build_id===null)return(0,$.jsx)(Ue,{});let t=`A build`;try{t=`Build of ${(0,Zn.default)(Ct(e.build_id)).format(`MMM D`)}`}catch{}return(0,$.jsx)(Re,{className:`text-xs font-medium underline-offset-4 hover:underline`,params:{buildId:e.build_id},to:`/native-builds/$buildId`,children:t})}function mr({device:e,viewer:t,onOpen:n}){let r=cr(e,t);return!r.approve&&!r.rename&&!r.remove&&!r.withdraw?null:(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[r.approve?(0,$.jsxs)(W,{className:`h-11 sm:h-8`,onClick:()=>n({kind:`approve`,device:e}),size:`sm`,children:[(0,$.jsx)(ze,{"data-icon":`inline-start`}),`Approve`]}):null,r.withdraw?(0,$.jsx)(W,{className:`h-11 sm:h-8`,onClick:()=>n({kind:`remove`,device:e}),size:`sm`,variant:`outline`,children:`Withdraw`}):null,r.rename||r.remove?(0,$.jsxs)(Qn,{children:[(0,$.jsx)($n,{render:(0,$.jsx)(W,{"aria-label":`More actions for ${e.name}`,className:`size-11 sm:size-8`,size:`icon-sm`,variant:`ghost`}),children:(0,$.jsx)(vn,{"aria-hidden":`true`})}),(0,$.jsxs)(er,{align:`end`,children:[(0,$.jsxs)(tr,{onClick:()=>n({kind:`rename`,device:e}),children:[(0,$.jsx)(ct,{"aria-hidden":`true`}),`Rename`]}),(0,$.jsx)(nr,{}),(0,$.jsxs)(tr,{onClick:()=>n({kind:`remove`,device:e}),variant:`destructive`,children:[(0,$.jsx)(ft,{"aria-hidden":`true`}),e.status===`pending`?`Decline`:`Remove`]})]})]}):null]})}function hr(){return(0,$.jsx)(vt,{className:`shrink-0 px-1.5`,variant:`muted`,children:`This iPhone`})}function gr({device:e,viewer:t,onOpen:n,isThisIphone:r}){return(0,$.jsxs)(an,{children:[(0,$.jsx)(on,{className:`font-medium`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.name,r?(0,$.jsx)(hr,{}):null]})}),(0,$.jsx)(on,{children:(0,$.jsx)(`span`,{className:`font-mono text-xs`,title:e.udid,translate:`no`,children:it(e.udid)})}),(0,$.jsx)(on,{className:`text-xs`,children:e.requested_by??(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:ur(e)})}),(0,$.jsx)(on,{children:(0,$.jsx)(fr,{device:e})}),(0,$.jsx)(on,{className:`text-xs`,children:(0,$.jsx)(hn,{ms:e.created_at_ms})}),(0,$.jsx)(on,{children:(0,$.jsx)(pr,{device:e})}),(0,$.jsx)(on,{className:`text-right`,children:(0,$.jsx)(mr,{device:e,onOpen:n,viewer:t})})]})}function _r({device:e,viewer:t,onOpen:n,isThisIphone:r}){return(0,$.jsxs)(fn,{className:`cursor-default gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),r?(0,$.jsx)(hr,{}):null]}),(0,$.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,translate:`no`,children:it(e.udid)})]}),(0,$.jsx)(fr,{device:e,withError:!1})]}),(0,$.jsx)(dr,{device:e}),(0,$.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:ur(e)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsx)(hn,{ms:e.created_at_ms}),e.build_id===null?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsx)(pr,{device:e})]})]}),(0,$.jsx)(mr,{device:e,onOpen:n,viewer:t})]})}function vr({target:e,onClose:t}){let n=Rt(),r=Ft(),i=e.kind===`approve`?n:r,[a,o]=(0,Q.useState)(e.device.name),s=a.trim();return(0,$.jsx)(nn,{onOpenChange:e=>e?null:t(),open:!0,children:(0,$.jsxs)($t,{children:[(0,$.jsxs)(Zt,{children:[(0,$.jsx)(en,{children:e.kind===`approve`?`Approve ${e.device.name}?`:`Rename ${e.device.name}`}),(0,$.jsx)(tn,{children:e.kind===`approve`?`The next ad hoc build registers this iPhone with your Apple account. Each new iPhone uses one of the account's 100 a year, and removing it never gives the slot back.`:`The registry shows this name. The next ad hoc build doesn't rename it at Apple.`})]}),(0,$.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),s!==``&&i.mutate({id:e.device.id,name:s},{onSuccess:t})},children:[(0,$.jsxs)(Et,{children:[e.kind===`approve`?(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Requested by`}),(0,$.jsx)(`dd`,{className:`truncate`,children:e.device.requested_by??`Terminal (CLI)`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`UDID`}),(0,$.jsx)(`dd`,{className:`font-mono text-xs break-all select-all`,translate:`no`,children:e.device.udid})]}):null,(0,$.jsxs)(kt,{"data-invalid":i.isError||void 0,children:[(0,$.jsx)(Tt,{htmlFor:`ios-device-dialog-name`,children:`Name`}),(0,$.jsx)(E,{autoComplete:`off`,id:`ios-device-dialog-name`,maxLength:100,onChange:e=>o(e.target.value),value:a}),e.kind===`approve`?(0,$.jsx)(Dt,{children:`The iPhone's ID comes from the person who asked. Approve devices you recognize.`}):null,(0,$.jsx)(Ot,{children:i.isError?`Couldn't ${e.kind===`approve`?`approve`:`rename`} ${e.device.name}. Check your connection and try again.`:null})]})]}),(0,$.jsx)(Qt,{className:`mt-4`,children:(0,$.jsxs)(W,{className:`h-11 sm:h-8`,disabled:s===``||i.isPending,type:`submit`,children:[i.isPending?(0,$.jsx)(nt,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,$.jsx)(ze,{"data-icon":`inline-start`}),e.kind===`approve`?`Approve`:`Rename`]})})]})]})})}function yr({device:e,viewer:t,onClose:n}){let r=It(),i=!t.canApprove,a=e.status===`pending`;return(0,$.jsx)(Xt,{onOpenChange:e=>e?null:n(),open:!0,children:(0,$.jsxs)(Wt,{children:[(0,$.jsxs)(Yt,{children:[(0,$.jsx)(Gt,{children:i?`Withdraw ${e.name}?`:a?`Decline ${e.name}?`:`Remove ${e.name}?`}),(0,$.jsx)(Ut,{children:a?`It leaves the list. Its owner can request it again.`:`It leaves the list. New ad hoc builds keep it until it's disabled at Apple.`})]}),r.isError?(0,$.jsxs)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:[`Couldn't `,i?`withdraw`:a?`decline`:`remove`,` `,e.name,`. Check your connection and try again.`]}):null,(0,$.jsxs)(qt,{children:[(0,$.jsx)(Jt,{disabled:r.isPending,children:`Cancel`}),(0,$.jsxs)(Kt,{disabled:r.isPending,onClick:t=>{t.preventDefault(),r.mutate({udid:e.udid},{onSuccess:n})},variant:`destructive`,children:[r.isPending?(0,$.jsx)(nt,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):null,i?`Withdraw`:a?`Decline`:`Remove`]})]})]})})}function br({device:e,viewer:t}){let n=t?.canApprove===!0;return e.apple_error===null?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,translate:`no`,children:it(e.udid)})]}),(0,$.jsx)(fr,{device:e,withError:!1})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:e.status===`pending`?n?`Approve it below, and it joins the next ad hoc build.`:`A maintainer approves it next.`:e.status===`approved`?`It joins the next ad hoc build.`:`New ad hoc builds install on it.`})]}):(0,$.jsx)(Vt,{canApprove:n,device:e,onDevicesPage:!0})}function xr({status:e,secretName:t}){return(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:e===`local-console`?`iPhones register through your hosted Console: an iPhone can't reach this computer's.`:`Set ${t} on this Console to register iPhones.`})}function Sr({view:t,phone:n}){let[r,i]=(0,Q.useState)(null),a=r??t?.defaultName??``,[o,s]=(0,Q.useState)(a);(0,Q.useEffect)(()=>{let e=setTimeout(()=>s(a.trim()),400);return()=>clearTimeout(e)},[a]);let c=n?.ios===!0,l=Ht({mode:`register`,name:o||`iPhone`},c&&t?.registration===`ready`),u=n===null||window.location.protocol===`https:`,d=c?n.udid:null,f=Nt(d),p=n?.answers??0,{refetch:m}=f,h=(0,Q.useRef)({udid:d,answers:p});(0,Q.useEffect)(()=>{let e=h.current;h.current={udid:d,answers:p},d!==null&&d===e.udid&&p>e.answers&&m()},[d,p,m]);let g=n===null?``:sr(),_=zt(g,n?.receipt??null,c&&t?.registration===`ready`&&(d===null||n.receipt!==null||f.data===null));Lt(n,_.data?.udid);let v=At(g),ee=c&&Mt(_.data?.udid,n.udid),te=(()=>{if(n===null||c&&n.udid!==null&&f.isPending)return(0,$.jsx)(e,{"aria-label":`Loading`,className:`h-36 w-full`});if(c&&f.data)return(0,$.jsx)(br,{device:f.data,viewer:t?.viewer});if(t!==void 0&&(t.registration===`local-console`||t.registration===`no-secret`))return(0,$.jsx)(xr,{secretName:t.secretName,status:t.registration});if(!c)return(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-4 sm:flex-row sm:items-center`,children:[(0,$.jsx)(_n,{className:`size-36 shrink-0`,label:`Open this page on an iPhone`,value:`${window.location.origin}${sr()}${at}`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:`Open this page on the iPhone, in Safari.`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It installs a profile that reads the iPhone's ID, then lists the iPhone here as requested. Nothing stays installed.`})]})]});if(!u)return(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:`iPhones need this Console on HTTPS.`});if(f.data===null&&_.isFetching&&!ee)return(0,$.jsx)(e,{"aria-label":`Loading`,className:`h-36 w-full`});if(ee){let e=a.trim();return(0,$.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-3`,onSubmit:t=>{t.preventDefault(),e!==``&&v.mutate({name:e,receipt:n.receipt})},children:[(0,$.jsxs)(kt,{"data-invalid":v.isError||void 0,children:[(0,$.jsx)(Tt,{htmlFor:`ios-device-register-name`,children:`This iPhone's name`}),(0,$.jsx)(E,{autoComplete:`off`,className:`h-11`,id:`ios-device-register-name`,maxLength:100,onChange:e=>i(e.target.value),value:a}),(0,$.jsx)(Dt,{children:`This Safari checked it before, so no profile is needed.`}),(0,$.jsx)(Ot,{children:v.isError?`The request didn't go through. Try again.`:null})]}),(0,$.jsxs)(W,{className:`h-11 w-full`,disabled:e===``||v.isPending,type:`submit`,children:[v.isPending?(0,$.jsx)(nt,{className:`animate-spin motion-reduce:animate-none`,"data-icon":`inline-start`}):(0,$.jsx)(dt,{"data-icon":`inline-start`}),`Request this iPhone`]})]})}return l.data?.status===`local-console`?(0,$.jsx)(xr,{status:`local-console`}):l.data?.status===`no-secret`?(0,$.jsx)(xr,{secretName:l.data.secretName,status:`no-secret`}):(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(kt,{children:[(0,$.jsx)(Tt,{htmlFor:`ios-device-register-name`,children:`This iPhone's name`}),(0,$.jsx)(E,{autoComplete:`off`,className:`h-11`,id:`ios-device-register-name`,maxLength:100,onChange:e=>i(e.target.value),value:a})]}),l.data?.status===`issued`&&o===a.trim()?(0,$.jsxs)(`a`,{className:B({className:`h-auto min-h-11 w-full whitespace-normal`}),href:ot(sr(),l.data.token),children:[(0,$.jsx)(dt,{"data-icon":`inline-start`}),`Install profile`]}):(0,$.jsx)(e,{"aria-label":`Preparing the profile`,className:`h-11 w-full`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Safari only. Allow the download, then install it in Settings, where iOS calls it not signed. Safari comes back here, and nothing stays installed.`})]})})();return(0,$.jsxs)(St,{className:`shadow-sm`,children:[(0,$.jsx)(yt,{className:`border-b px-4 py-3`,children:(0,$.jsx)(xt,{className:`text-sm`,children:(0,$.jsx)(`h2`,{children:`Register an iPhone`})})}),(0,$.jsx)(bt,{className:`p-4 sm:p-6`,children:te})]})}function Cr({search:e,onSearchChange:t}){let n=me(),r=Pt(e.status),i=r.data,a=i?.devices,o=j(),s=()=>void o.invalidateQueries({queryKey:Bt.all}),[c,l]=(0,Q.useState)(null),u=jt(),d=u?.ios===!0?u.udid?.toLowerCase()??null:null,f=()=>l(null),p=(0,$.jsx)(mn,{icon:dt,title:e.status===void 0?`No iPhones yet`:`No ${rr[e.status].toLowerCase()} iPhones`,children:e.status===void 0?(0,$.jsx)(`p`,{children:`Open this page on an iPhone to register it.`}):(0,$.jsx)(W,{className:`h-11 sm:h-8`,onClick:()=>t({}),size:`sm`,variant:`outline`,children:`Show all`})});return(0,$.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-background px-3 py-3 sm:min-h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,$.jsx)(xe,{className:`-ml-1 size-11 lg:size-7`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(tt,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`text-sm font-medium`,children:`Native builds`})]}),(0,$.jsx)(`p`,{className:`basis-full pl-12 text-xs text-muted-foreground sm:basis-auto sm:pl-0`,children:`The iPhones and iPads ad hoc builds install on. Android needs none.`})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:[(0,$.jsx)(gn,{current:`devices`}),(0,$.jsx)(Sr,{phone:u,view:i}),i!==void 0&&!i.viewer.approversConfigured?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:`Nobody approves in this Console. Approve from a terminal:`}),(0,$.jsx)(He,{label:`the approve command`,value:st})]}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)($e,{items:[{label:`All statuses`,value:ar},...Object.keys(rr).map(e=>({label:rr[e],value:e}))],onValueChange:e=>t(e===null||e===ar?{}:{status:e}),value:e.status??ar,children:[(0,$.jsx)(Ke,{"aria-label":`Status`,className:`min-w-0 flex-1 text-xs data-[size=default]:h-11 sm:w-44 sm:flex-none sm:data-[size=default]:h-8`,children:(0,$.jsx)(Xe,{})}),(0,$.jsx)(Ye,{children:(0,$.jsxs)(Ze,{children:[(0,$.jsx)(qe,{value:ar,children:`All statuses`}),Object.keys(rr).map(e=>(0,$.jsx)(qe,{value:e,children:rr[e]},e))]})})]}),(0,$.jsx)(W,{"aria-label":`Refresh iOS devices`,className:`ml-auto size-11 sm:size-7`,disabled:r.isFetching,onClick:s,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(ut,{"aria-hidden":`true`})})]}),r.isError?(0,$.jsxs)(ht,{variant:`destructive`,children:[(0,$.jsx)(gt,{}),(0,$.jsx)(pt,{children:`iOS devices couldn't be loaded`}),(0,$.jsx)(mt,{children:`Check your connection and try again.`}),(0,$.jsx)(_t,{children:(0,$.jsxs)(W,{onClick:s,size:`xs`,variant:`outline`,children:[(0,$.jsx)(ut,{"data-icon":`inline-start`}),`Retry`]})})]}):(0,$.jsx)(cn,{className:`flex-none`,children:n?(0,$.jsx)(`div`,{"aria-busy":r.isPlaceholderData,"aria-label":`iOS devices`,className:`aria-busy:opacity-60`,role:`list`,children:r.isLoading?(0,$.jsx)(pn,{label:`Loading iOS devices`}):a?.length===0?(0,$.jsx)(un,{children:p}):a?.map(e=>(0,$.jsx)(`div`,{className:`border-b last:border-b-0`,role:`listitem`,children:(0,$.jsx)(_r,{device:e,isThisIphone:e.udid===d,onOpen:l,viewer:i.viewer})},e.id))}):(0,$.jsx)(sn,{"aria-busy":r.isPlaceholderData,"aria-label":`iOS devices`,className:`aria-busy:opacity-60`,header:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{children:`Name`}),(0,$.jsx)(Z,{children:`UDID`}),(0,$.jsx)(Z,{children:`Requested by`}),(0,$.jsx)(Z,{children:`Status`}),(0,$.jsx)(Z,{children:`Added`}),(0,$.jsx)(Z,{children:`Build`}),(0,$.jsx)(Z,{className:`text-right`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:r.isLoading?(0,$.jsx)(ln,{columns:or+1,label:`Loading iOS devices`}):a?.length===0?(0,$.jsx)(dn,{columns:or+1,children:p}):a?.map(e=>(0,$.jsx)(gr,{device:e,isThisIphone:e.udid===d,onOpen:l,viewer:i.viewer},e.id))})})]}),c!==null&&c.kind!==`remove`?(0,$.jsx)(vr,{onClose:f,target:c},c.device.id):null,c?.kind===`remove`&&i!==void 0?(0,$.jsx)(yr,{device:c.device,onClose:f,viewer:i.viewer},c.device.id):null]})}function wr(){let e=rn.useSearch(),t=rn.useNavigate();return(0,$.jsx)(Cr,{onSearchChange:e=>void t({search:e,replace:!0}),search:e})}export{wr as component};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/native-builds_.devices-BykEftlY.js","assets/sidebar-BmzmPGuv.js","assets/alert-dialog-Cj7AOTIE.js","assets/select-DIyG5G-V.js","assets/useCompositeListItem-Cbk_weKW.js","assets/check-C3VCvMOV.js","assets/CompositeItem-B541MSYC.js","assets/tabs-DARDj-XC.js","assets/link-CRMwpc7-.js","assets/relativeTime-Dbefsycs.js","assets/TargetDisplay-DMZHMgWk.js","assets/copy-BjVLMKbo.js","assets/key-round-BkeLvA1m.js","assets/native-builds-uKuvmyXZ.js","assets/constants-zSb7FXDh.js","assets/dist-BEmib-ZM.js","assets/HashValueDisplay-BHL4xWSY.js","assets/-native-builds-search-qeto9-fq.js","assets/loader-circle-8lunBReu.js","assets/smartphone-Dy13ukaU.js","assets/trash-2-DI0biNI-.js","assets/badge-zMibJGR5.js","assets/QrCode-BSNEn_M-.js","assets/RelativeTime-CdQ86VoP.js","assets/chevron-right-RAuPv9r1.js","assets/table-Bo1jU9-v.js","assets/IosInstall-CgNa8B4v.js","assets/useMutation-D7IuoOLE.js","assets/field-BiSGCVoS.js","assets/api-tJRzijjy.js","assets/preload-helper-CE9OukVC.js","assets/NativeBuildsNav-BxAmQr2E.js","assets/card-pYZSDIxg.js","assets/dialog-DlAv6zou.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,r as t,t as n}from"./preload-helper-CE9OukVC.js";import{n as r}from"./-native-builds-search-qeto9-fq.js";var i=e(`/native-builds_/devices`)({component:t(()=>n(()=>import(`./native-builds_.devices-BykEftlY.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])),`component`),validateSearch:r});export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Vr as e}from"./sidebar-BmzmPGuv.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Di as e,Ni as t,Qr as n,Ri as r,Ti as i,Ur as a,Vi as o,ei as s,ji as c,ti as l}from"./sidebar-
|
|
1
|
+
import{Di as e,Ni as t,Qr as n,Ri as r,Ti as i,Ur as a,Vi as o,ei as s,ji as c,ti as l}from"./sidebar-BmzmPGuv.js";import{S as u,_ as d,g as f,i as p,n as m,p as h,r as g,t as _,v,w as y}from"./link-CRMwpc7-.js";var b=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=h:this.parentRoute||c();let r=n?h:t?.path;r&&r!==`/`&&(r=d(r));let i=t?.id||r,a=n?h:f((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:f(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=v(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>t({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},x=class extends b{constructor(e){super(e)}},S=o(r(),1),C=S.use,w=S.useLayoutEffect,T=i();function E(e,t){return e===t}function D(e,t=e=>e,n){let r=n?.compare??E,i=(0,S.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,S.useCallback)(()=>e.get(),[e]);return(0,T.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var O={};function k(e,t){let n=S.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=y(n.current,i):i}}function A(e){let t=p(),n=S.useContext(e.from?m:g),r=e.from??n,i=t.stores.getMatchStore(r),a=k(e,t),o=D(i,e=>e?a(e):O);if(o!==O)return o;(e.shouldThrow??!0)&&c()}function j(e){return A({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function M(e){let{select:t,...n}=e;return A({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function N(e){return A({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function P(e){return A({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function F(e){let t=p();return S.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function I(e){return A({...e,select:t=>e.select?e.select(t.context):t.context})}var L=e(),R=class extends b{constructor(e){super(e),this.useMatch=e=>A({...e,from:this.id}),this.useRouteContext=e=>I({...e,from:this.id}),this.useSearch=e=>P({...e,from:this.id}),this.useParams=e=>N({...e,from:this.id}),this.useLoaderDeps=e=>M({...e,from:this.id}),this.useLoaderData=e=>j({...e,from:this.id}),this.useNavigate=()=>F({from:this.fullPath}),this.Link=S.forwardRef((e,t)=>(0,L.jsx)(_,{ref:t,from:this.fullPath,...e}))}};function z(e){return new R(e)}function B(){return e=>H(e)}var V=class extends x{constructor(e){super(e),this.useMatch=e=>A({...e,from:this.id}),this.useRouteContext=e=>I({...e,from:this.id}),this.useSearch=e=>P({...e,from:this.id}),this.useParams=e=>N({...e,from:this.id}),this.useLoaderDeps=e=>M({...e,from:this.id}),this.useLoaderData=e=>j({...e,from:this.id}),this.useNavigate=()=>F({from:this.fullPath}),this.Link=S.forwardRef((e,t)=>(0,L.jsx)(_,{ref:t,from:this.fullPath,...e}))}};function H(e){return new V(e)}function U(e){return e=>{let t=z(e);return t.isRoot=!1,t}}function W(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,o.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(u(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r)if(C)C(a());else throw a();return S.createElement(r,e)};return o.preload=a,o}var G=class extends n{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:c}=r,u=n.fetchMeta?.fetchMore?.direction,d=o&&u===`forward`,f=i&&u===`forward`,p=o&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:s(t,n.data),hasPreviousPage:l(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:c&&!d&&!p,isRefetching:a&&!f&&!m}}};function K(e,t){return a(e,G,t)}var q=`modulepreload`,J=function(e){return`/`+e},Y={},X=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=J(t,n),t in Y)return;Y[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:q,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{B as a,D as c,U as i,C as l,K as n,F as o,W as r,k as s,X as t,w as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{zi as e}from"./sidebar-
|
|
1
|
+
import{zi as e}from"./sidebar-BmzmPGuv.js";var t=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),n=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(e,(function(){return function(e,t,n){e||={};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],p=f.length,m=0;m<p;m+=1){var h=f[m];h.d&&(c=o?n(t).diff(a,h.d,!0):a.diff(t,h.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=h.r||!h.r){g<=1&&m>0&&(h=f[m-1]);var _=d[h.l];s&&(g=s(``+g)),l=typeof _==`string`?_.replace(`%d`,g):_(g,r,h.l,u);break}}if(r)return l;var v=u?d.future:d.past;return typeof v==`function`?v(l):v.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))}));export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./ConsoleFeatureUnavailable-C6aryy7j.js";var t=e;export{t as notFoundComponent};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-
|
|
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-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-BiD075AT.js","assets/ConsoleFeatureUnavailable-C6aryy7j.js","assets/sidebar-BmzmPGuv.js","assets/console-features-api-CtbGqKyr.js","assets/arrow-up-right-C_1ALUCD.js","assets/NotFoundPage-haKPLHiT.js","assets/link-CRMwpc7-.js","assets/empty-Bwao2ztZ.js","assets/remote-config-r945bivi.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-BmzmPGuv.js";import{i as T,n as ee,r as te,t as E}from"./preload-helper-CE9OukVC.js";import{t as D}from"./useMutation-D7IuoOLE.js";import{r as O}from"./console-features-api-CtbGqKyr.js";import{t as k}from"./arrow-right-DjRwIoF1.js";import{i as ne}from"./useCompositeListItem-Cbk_weKW.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-DIyG5G-V.js";import{t as le}from"./clipboard-D0JWZ1KF.js";import{t as ue}from"./git-branch-BGatQV8Q.js";import{t as de}from"./history-Ci4dhphE.js";import{t as fe}from"./loader-circle-8lunBReu.js";import{n as pe,t as me}from"./CompositeItem-B541MSYC.js";import{t as j}from"./plus-DztQIXYL.js";import{n as M,r as he}from"./dist-BEmib-ZM.js";import{i as ge,n as _e,o as ve,r as ye,s as be,t as xe}from"./input-group-CPboh0Rx.js";import{t as Se}from"./search-BfEqtE64.js";import{i as Ce,n as N,r as we,t as Te}from"./switch-B_7OwJhK.js";import{t as Ee}from"./smartphone-Dy13ukaU.js";import{t as De}from"./trash-2-DI0biNI-.js";import{a as P,i as F,n as I,o as L,r as R,t as z}from"./badge-zMibJGR5.js";import{t as Oe}from"./undo-2-CxhBbgJw.js";import{a as B,n as ke,o as Ae,r as je,t as Me}from"./card-pYZSDIxg.js";import{n as Ne,t as Pe}from"./relativeTime-Dbefsycs.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-BiSGCVoS.js";import{i as ze}from"./api-tJRzijjy.js";import{a as Be,i as Ve,n as He,o as Ue,r as We,t as Ge}from"./empty-Bwao2ztZ.js";import{i as Ke,n as qe,o as Je,r as Ye,t as Xe}from"./tabs-DARDj-XC.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-Cj7AOTIE.js";import{t as at}from"./PlatformIcon-DYsYaYt6.js";import{a as ot,i as st,n as ct,o as lt,r as ut,t as dt}from"./dialog-DlAv6zou.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-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};
|
|
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-BiD075AT.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:te(()=>E(()=>import(`./remote-config-r945bivi.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};
|