@hot-updater/console 1.2.0-rc.4 → 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.
Files changed (387) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/-native-builds-search-qeto9-fq.js +1 -0
  3. package/.output/public/assets/BundleIdDisplay-BKaGARD1.js +1 -0
  4. package/.output/public/assets/ChannelBadge-CPc1M44L.js +1 -0
  5. package/.output/public/assets/CompositeItem-B541MSYC.js +1 -0
  6. package/.output/public/assets/{ConsoleFeatureUnavailable-CUtcXuY2.js → ConsoleFeatureUnavailable-C6aryy7j.js} +1 -1
  7. package/.output/public/assets/{EventDetails-Dl2RvPAk.js → EventDetails-BdqU96Wu.js} +1 -1
  8. package/.output/public/assets/HashValueDisplay-BHL4xWSY.js +1 -0
  9. package/.output/public/assets/InsightsPageHeader-D0Nxcccp.js +1 -0
  10. package/.output/public/assets/IosInstall-CgNa8B4v.js +1 -0
  11. package/.output/public/assets/NativeBuildsNav-BxAmQr2E.js +1 -0
  12. package/.output/public/assets/{NotFoundPage-DZ3DxyRA.js → NotFoundPage-haKPLHiT.js} +1 -1
  13. package/.output/public/assets/{PlatformIcon-BBWQlWm9.js → PlatformIcon-DYsYaYt6.js} +1 -1
  14. package/.output/public/assets/QrCode-BSNEn_M-.js +1 -0
  15. package/.output/public/assets/RelativeTime-CdQ86VoP.js +1 -0
  16. package/.output/public/assets/RolloutPercentageBadge-Cd1UNLL0.js +1 -0
  17. package/.output/public/assets/RowReason-CEI-_T6G.js +1 -0
  18. package/.output/public/assets/SandboxBadge-CqGX5DiH.js +1 -0
  19. package/.output/public/assets/TargetDisplay-DMZHMgWk.js +1 -0
  20. package/.output/public/assets/alert-dialog-Cj7AOTIE.js +1 -0
  21. package/.output/public/assets/api-keys-B9XQLCZ8.js +1 -0
  22. package/.output/public/assets/api-keys-D4tjInrB.js +1 -0
  23. package/.output/public/assets/api-tJRzijjy.js +1 -0
  24. package/.output/public/assets/arrow-left-68S4uy4I.js +1 -0
  25. package/.output/public/assets/arrow-right-DjRwIoF1.js +1 -0
  26. package/.output/public/assets/arrow-up-right-C_1ALUCD.js +1 -0
  27. package/.output/public/assets/badge-zMibJGR5.js +1 -0
  28. package/.output/public/assets/card-pYZSDIxg.js +1 -0
  29. package/.output/public/assets/check-C3VCvMOV.js +1 -0
  30. package/.output/public/assets/chevron-right-RAuPv9r1.js +1 -0
  31. package/.output/public/assets/{circle-off-C7Muo0ss.js → circle-off-DvYMC5yF.js} +1 -1
  32. package/.output/public/assets/{clipboard-DQbOcrL7.js → clipboard-D0JWZ1KF.js} +1 -1
  33. package/.output/public/assets/{console-features-api-DEXSwFtc.js → console-features-api-CtbGqKyr.js} +1 -1
  34. package/.output/public/assets/{uuidv7-zXMtwR9Q.js → constants-zSb7FXDh.js} +1 -1
  35. package/.output/public/assets/{copy-DsuLj3oj.js → copy-BjVLMKbo.js} +1 -1
  36. package/.output/public/assets/dialog-DlAv6zou.js +1 -0
  37. package/.output/public/assets/dist-BEmib-ZM.js +1 -0
  38. package/.output/public/assets/{download-Cf24LBde.js → download-CgpaZb23.js} +1 -1
  39. package/.output/public/assets/empty-Bwao2ztZ.js +1 -0
  40. package/.output/public/assets/field-BiSGCVoS.js +1 -0
  41. package/.output/public/assets/git-branch-BGatQV8Q.js +1 -0
  42. package/.output/public/assets/history-Ci4dhphE.js +1 -0
  43. package/.output/public/assets/index-D7PWINwc.js +10 -0
  44. package/.output/public/assets/input-group-CPboh0Rx.js +1 -0
  45. package/.output/public/assets/insights-B7GL298D.js +1 -0
  46. package/.output/public/assets/insights-BzKbxWIo.js +42 -0
  47. package/.output/public/assets/insights-Q2nAkSMz.js +2 -0
  48. package/.output/public/assets/insights-api-D4-FZeEI.js +1 -0
  49. package/.output/public/assets/insights-search-DkovoDrZ.js +1 -0
  50. package/.output/public/assets/insights-usage-rpc-DkJgbAYm.js +1 -0
  51. package/.output/public/assets/insights_.distribution-BafQuEd0.js +1 -0
  52. package/.output/public/assets/insights_.distribution-DHU1udei.js +2 -0
  53. package/.output/public/assets/insights_.distribution-DmeI9XZw.js +1 -0
  54. package/.output/public/assets/installations-ClsF2q6A.js +2 -0
  55. package/.output/public/assets/installations-CmuNX_Ok.js +1 -0
  56. package/.output/public/assets/installations-oGkAO7nb.js +1 -0
  57. package/.output/public/assets/{key-round-DwNKkHhy.js → key-round-BkeLvA1m.js} +1 -1
  58. package/.output/public/assets/{link-DTEyW70e.js → link-CRMwpc7-.js} +2 -2
  59. package/.output/public/assets/{list--NIee1FZ.js → list-DQ9YBIDW.js} +1 -1
  60. package/.output/public/assets/loader-circle-8lunBReu.js +1 -0
  61. package/.output/public/assets/native-builds-DJlYvvPY.js +2 -0
  62. package/.output/public/assets/native-builds-NyGMlBx2.js +1 -0
  63. package/.output/public/assets/native-builds-uKuvmyXZ.js +1 -0
  64. package/.output/public/assets/native-builds_._buildId-DZqylSRq.js +1 -0
  65. package/.output/public/assets/native-builds_._buildId-Dza7vEcy.js +2 -0
  66. package/.output/public/assets/native-builds_.devices-BykEftlY.js +1 -0
  67. package/.output/public/assets/native-builds_.devices-DH1JB1zr.js +2 -0
  68. package/.output/public/assets/plus-DztQIXYL.js +1 -0
  69. package/.output/public/assets/preload-helper-CE9OukVC.js +1 -0
  70. package/.output/public/assets/{relativeTime-YQt84dYr.js → relativeTime-Dbefsycs.js} +1 -1
  71. package/.output/public/assets/remote-config-BiD075AT.js +1 -0
  72. package/.output/public/assets/remote-config-CBirPcRR.js +6 -0
  73. package/.output/public/assets/remote-config-r945bivi.js +1 -0
  74. package/.output/public/assets/{rotate-cw-Cv2aVbYr.js → rotate-cw-BFQcpUTO.js} +1 -1
  75. package/.output/public/assets/routes-5U4k3N1_.js +1 -0
  76. package/.output/public/assets/routes-DWjGfLRs.js +2 -0
  77. package/.output/public/assets/search-BfEqtE64.js +1 -0
  78. package/.output/public/assets/select-DIyG5G-V.js +1 -0
  79. package/.output/public/assets/sidebar-BmzmPGuv.js +3 -0
  80. package/.output/public/assets/smartphone-Dy13ukaU.js +1 -0
  81. package/.output/public/assets/styles-C_9Rf75p.css +2 -0
  82. package/.output/public/assets/switch-B_7OwJhK.js +1 -0
  83. package/.output/public/assets/table-Bo1jU9-v.js +1 -0
  84. package/.output/public/assets/tabs-DARDj-XC.js +1 -0
  85. package/.output/public/assets/trash-2-DI0biNI-.js +1 -0
  86. package/.output/public/assets/{undo-2-CUX96_BG.js → undo-2-CxhBbgJw.js} +1 -1
  87. package/.output/public/assets/{useCompositeListItem-JmyDfo3-.js → useCompositeListItem-Cbk_weKW.js} +1 -1
  88. package/.output/public/assets/{useMutation-DbYw7boA.js → useMutation-D7IuoOLE.js} +1 -1
  89. package/.output/public/assets/valueToPercent-Db73Kirz.js +1 -0
  90. package/.output/server/{__23tanstack-start-server-fn-resolver-X9YQcrQI.mjs → __23tanstack-start-server-fn-resolver-CSEErUrV.mjs} +94 -46
  91. package/.output/server/_chunks/ssr-renderer.mjs +2 -2
  92. package/.output/server/_libs/@base-ui/react+[...].mjs +1488 -183
  93. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  94. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
  95. package/.output/server/_libs/_.mjs +2 -0
  96. package/.output/server/_libs/lucide-react.mjs +34 -28
  97. package/.output/server/_libs/next-themes.mjs +1 -1
  98. package/.output/server/_libs/react-redux+[...].mjs +1 -1
  99. package/.output/server/_libs/recharts+[...].mjs +1 -1
  100. package/.output/server/_libs/sonner.mjs +1 -1
  101. package/.output/server/_libs/tanstack__react-query.mjs +1 -1
  102. package/.output/server/_ssr/-native-builds-search-Bwt8tQzp.mjs +55 -0
  103. package/.output/server/_ssr/{BundleIdDisplay-BVrZXzTm.mjs → BundleIdDisplay-BfMtMws8.mjs} +3 -3
  104. package/.output/server/_ssr/ChannelBadge-CyjOxlfr.mjs +23 -0
  105. package/.output/server/_ssr/{ConsoleFeatureUnavailable-CULyV3nR.mjs → ConsoleFeatureUnavailable-D5a8SXzu.mjs} +8 -8
  106. package/.output/server/_ssr/{EventDetails-DeI1rOQc.mjs → EventDetails-XaXslOac.mjs} +9 -9
  107. package/.output/server/_ssr/{HashValueDisplay-DpnPD3U2.mjs → HashValueDisplay-CtrIkPNM.mjs} +7 -7
  108. package/.output/server/_ssr/{InsightsPageHeader-Dwmdtelg.mjs → InsightsPageHeader-CK76Vycr.mjs} +13 -13
  109. package/.output/server/_ssr/IosInstall-BD2HpMsh.mjs +751 -0
  110. package/.output/server/_ssr/NativeBuildsNav-DvFscYEN.mjs +38 -0
  111. package/.output/server/_ssr/{NotFoundPage-Dddp1HSc.mjs → NotFoundPage-CQc5Envb.mjs} +3 -3
  112. package/.output/server/_ssr/{PlatformIcon-CFLiTjh1.mjs → PlatformIcon-C22qEcwo.mjs} +13 -3
  113. package/.output/server/_ssr/QrCode-VPGDhoTy.mjs +50 -0
  114. package/.output/server/_ssr/RelativeTime-D6qU9XeU.mjs +242 -0
  115. package/.output/server/_ssr/{git-CTA8Aqr0.mjs → RolloutPercentageBadge-7HdtPPd8.mjs} +20 -4
  116. package/.output/server/_ssr/RowReason-CR2C_0d9.mjs +186 -0
  117. package/.output/server/_ssr/SandboxBadge-HQv4waT2.mjs +85 -0
  118. package/.output/server/_ssr/TargetDisplay-BQ3rf-jt.mjs +105 -0
  119. package/.output/server/_ssr/{alert-dialog-ei2c1b6A.mjs → alert-dialog-DZfV4jo0.mjs} +4 -4
  120. package/.output/server/_ssr/{api-CvwqILEx.mjs → api-C3S89RIl.mjs} +174 -37
  121. package/.output/server/_ssr/{api-keys-BLHCygD_.mjs → api-keys-DhgkyA5L.mjs} +2 -2
  122. package/.output/server/_ssr/{api-keys-rpc-CLZsTwih.mjs → api-keys-rpc-PnrzjW84.mjs} +4 -4
  123. package/.output/server/_ssr/{api-keys-CVi7E0qS.mjs → api-keys-tydhn1tu.mjs} +14 -11
  124. package/.output/server/_ssr/{api-rpc-p-7EhGIG.mjs → api-rpc-D8qYGyez.mjs} +83 -35
  125. package/.output/server/_ssr/{auth-rpc-B1W4-hxa.mjs → auth-rpc-rMdoXrTW.mjs} +5 -5
  126. package/.output/server/_ssr/{auth.server-CVKs7SWJ.mjs → auth.server-YE2ZZC0j.mjs} +833 -179
  127. package/.output/server/_ssr/{badge-nS9EbEA0.mjs → badge-NON1cyRV.mjs} +4 -45
  128. package/.output/server/_ssr/{bundleActivity-MLrjNJCT.mjs → bundleActivity-CjE9yslP.mjs} +1 -1
  129. package/.output/server/_ssr/card-CVw7zPaM.mjs +49 -0
  130. package/.output/server/_ssr/{config.server-BAdvotbH.mjs → config.server-BYkojQAW.mjs} +4 -4
  131. package/.output/server/_ssr/{console-access-BiuC2QFp.mjs → console-access-CRyGs-sb.mjs} +2 -2
  132. package/.output/server/_ssr/{console-features-BTV-XuhQ.mjs → console-features-DTYyXrWO.mjs} +1 -1
  133. package/.output/server/_ssr/{console-features-api-FvbqhbTg.mjs → console-features-api-DwbIx8oM.mjs} +4 -4
  134. package/.output/server/_ssr/{console-features-rpc-Cl3J66aP.mjs → console-features-rpc-erZu7BIN.mjs} +4 -4
  135. package/.output/server/_ssr/constants-BjsJZqaU.mjs +10 -0
  136. package/.output/server/_ssr/{createServerRpc-BVvRVOz5.mjs → createServerRpc-DJZel12M.mjs} +1 -1
  137. package/.output/server/_ssr/{databaseConfig-B_Bg7qS5.mjs → databaseConfig-B56IJxlu.mjs} +1 -1
  138. package/.output/server/_ssr/{databaseJsonValue-kS7cvEtz.mjs → databaseJsonValue-DuUoft8j.mjs} +1 -1
  139. package/.output/server/_ssr/{databaseRows-B6H8Cmgq.mjs → databaseRows-BZMFl5QV.mjs} +3 -3
  140. package/.output/server/_ssr/deviceProfileToken-Eeltr-o0.mjs +98 -0
  141. package/.output/server/_ssr/{dialog-GmTPeUS4.mjs → dialog-ZuUCxUNo.mjs} +5 -5
  142. package/.output/server/_ssr/dist-CiOq3ygH.mjs +148 -0
  143. package/.output/server/_ssr/{downloadBundle-DCmr7vsj.mjs → downloadBundle-DLkb7A7E.mjs} +1 -1
  144. package/.output/server/_ssr/{empty-CXWKv24M.mjs → empty-4FbiMhrz.mjs} +3 -3
  145. package/.output/server/_ssr/{empty-plugin-adapters-zrZ0xs6n.mjs → empty-plugin-adapters-BYBYBaxo.mjs} +1 -1
  146. package/.output/server/_ssr/{failureReports-Cn_zU9S8.mjs → failureReports-Bd7CaadE.mjs} +3 -3
  147. package/.output/server/_ssr/{field-lwIHAwLc.mjs → field-B9YWRLoo.mjs} +3 -3
  148. package/.output/server/_ssr/foldedPage-DrxWt5XS.mjs +176 -0
  149. package/.output/server/_ssr/{getBundleChildren-rtkEEJw5.mjs → getBundleChildren-DA9zbUBD.mjs} +2 -2
  150. package/.output/server/_ssr/{input-group-Dgr4DNbE.mjs → input-group-sETcyyLC.mjs} +3 -3
  151. package/.output/server/_ssr/{insights-DSnQTQw1.mjs → insights-BjtOex57.mjs} +38 -31
  152. package/.output/server/_ssr/{insights-BxtyBLt0.mjs → insights-CkJWItoo.mjs} +2 -2
  153. package/.output/server/_ssr/{insights-B9NvjAWc.mjs → insights-K6CFztcF.mjs} +5 -5
  154. package/.output/server/_ssr/{insights-api-PN_9ilr8.mjs → insights-api-9jE9dp-3.mjs} +5 -5
  155. package/.output/server/_ssr/{insights-errors-7BCwFybo.mjs → insights-errors-BrToSfI9.mjs} +2 -2
  156. package/.output/server/_ssr/{insights-failures-B9VPkzZE.mjs → insights-failures-lmcxwKb3.mjs} +2 -2
  157. package/.output/server/_ssr/{insights-failures-rpc-Cxu3UtyB.mjs → insights-failures-rpc-XxbDFtKo.mjs} +11 -11
  158. package/.output/server/_ssr/{insights-recovery-BtXVU3ro.mjs → insights-recovery-Dhg3WGpC.mjs} +1 -1
  159. package/.output/server/_ssr/{insights-recovery-rpc--c6kBp3k.mjs → insights-recovery-rpc-CFeoyZEw.mjs} +7 -7
  160. package/.output/server/_ssr/{insights-rpc-oTMaAqc1.mjs → insights-rpc-TAS-cemx.mjs} +4 -4
  161. package/.output/server/_ssr/{insights-search-r-Z50f0Y.mjs → insights-search-DL8LLP6s.mjs} +6 -8
  162. package/.output/server/_ssr/{insights-usage-DiGnuxW8.mjs → insights-usage-gW3T5N6N.mjs} +1 -1
  163. package/.output/server/_ssr/{insights-usage-rpc-B00vjt0a.mjs → insights-usage-rpc-CrAA5_Wn.mjs} +5 -5
  164. package/.output/server/_ssr/{insights-usage-rpc-DoElOI5b.mjs → insights-usage-rpc-DGSVT5eB.mjs} +7 -7
  165. package/.output/server/_ssr/{insightsUsage-ClAmoUz8.mjs → insightsUsage-B_7pM9wp.mjs} +3 -3
  166. package/.output/server/_ssr/{insights_.distribution-B8AMBp-Q.mjs → insights_.distribution-C9nMSRtr.mjs} +5 -5
  167. package/.output/server/_ssr/{insights_.distribution-CnYddZ2Y.mjs → insights_.distribution-CK5_wfLT.mjs} +2 -2
  168. package/.output/server/_ssr/{insights_.distribution-mpZ0wS_R.mjs → insights_.distribution-DDr3vglh.mjs} +16 -15
  169. package/.output/server/_ssr/{installations-CWTRzcR7.mjs → installations-BvGL_EXM.mjs} +2 -2
  170. package/.output/server/_ssr/{installations-BfhcY_XQ.mjs → installations-CRHGd6SX.mjs} +4 -4
  171. package/.output/server/_ssr/{installations-O6Jzc5PO.mjs → installations-CWutybSC.mjs} +13 -13
  172. package/.output/server/_ssr/ios-devices-rpc-CCx4TvyR.mjs +137 -0
  173. package/.output/server/_ssr/iosDeviceCookie-B3FPj65l.mjs +155 -0
  174. package/.output/server/_ssr/iosDeviceProfile-Cclrfk8N.mjs +176 -0
  175. package/.output/server/_ssr/iosDevices-DMXaKH8F.mjs +113 -0
  176. package/.output/server/_ssr/listReleases-B2Q9xwFv.mjs +94 -0
  177. package/.output/server/_ssr/{request-guard-CPdRBuGW.mjs → local-console-Dtxlsav0.mjs} +2 -9
  178. package/.output/server/_ssr/native-artifact-BurROe05.mjs +1573 -0
  179. package/.output/server/_ssr/{native-builds-UIgRLMb8.mjs → native-builds-BGDsGYAp.mjs} +3 -3
  180. package/.output/server/_ssr/native-builds-BPiSm8HX.mjs +724 -0
  181. package/.output/server/_ssr/native-builds-Bnx0fVWs.mjs +264 -0
  182. package/.output/server/_ssr/native-builds_._buildId-B749BEMp.mjs +1148 -0
  183. package/.output/server/_ssr/{native-builds_._buildId-DjUqI5sa.mjs → native-builds_._buildId-CS9w0JIp.mjs} +3 -3
  184. package/.output/server/_ssr/native-builds_.devices-BPT8_91w.mjs +10 -0
  185. package/.output/server/_ssr/native-builds_.devices-w_jDlH8K.mjs +820 -0
  186. package/.output/server/_ssr/nativeBuildDownloadLink-CXibRgym.mjs +96 -0
  187. package/.output/server/_ssr/nativeBuildInstall-BLuyTfXE.mjs +252 -0
  188. package/.output/server/_ssr/nativeBuilds-WKdqgemR.mjs +287 -0
  189. package/.output/server/_ssr/plistText-DkzlCfPI.mjs +15 -0
  190. package/.output/server/_ssr/{plugins-RIryUNWj.mjs → plugins-D9CCkDjn.mjs} +7 -6
  191. package/.output/server/_ssr/publicConsoleBase-C3sNbafy.mjs +15 -0
  192. package/.output/server/_ssr/{release-adoption-DoAtNPED.mjs → release-adoption-D2719HVh.mjs} +2 -2
  193. package/.output/server/_ssr/{release-adoption-rpc-PLyiDnas.mjs → release-adoption-rpc-DOdELZNl.mjs} +9 -9
  194. package/.output/server/_ssr/{releaseAdoption-a2byXMfz.mjs → releaseAdoption-CxGKmUXx.mjs} +4 -4
  195. package/.output/server/_ssr/{releaseCatalogCompiler-DLcean2k.mjs → releaseCatalogCompiler-CJ2Shida.mjs} +4 -3
  196. package/.output/server/_ssr/{releaseManagement-DHUux2az.mjs → releaseManagement-CqIc-SDE.mjs} +1 -1
  197. package/.output/server/_ssr/{releaseReachability-DZOK_dH-.mjs → releaseReachability-sWr0bLRk.mjs} +2 -2
  198. package/.output/server/_ssr/{remote-config-C5j4CfGa.mjs → remote-config-C5mPNt0s.mjs} +3 -3
  199. package/.output/server/_ssr/{remote-config-eNxv5Kzc.mjs → remote-config-DuOo-AFR.mjs} +23 -22
  200. package/.output/server/_ssr/{remote-config-rpc-Cy4VwdMt.mjs → remote-config-rpc-rEe5HBxX.mjs} +5 -5
  201. package/.output/server/_ssr/{remote-config-tOdzsFMi.mjs → remote-config-xbBIsBh1.mjs} +2 -2
  202. package/.output/server/_ssr/request-guard-BPLyogIN.mjs +11 -0
  203. package/.output/server/_ssr/{router-DaQ6OkIp.mjs → router-Bc5Zx-dc.mjs} +136 -63
  204. package/.output/server/_ssr/{routes-BYmUIYfN.mjs → routes-CUQ96XR2.mjs} +49 -17
  205. package/.output/server/_ssr/{routes-Drni4c1E.mjs → routes-DCOnxOlA.mjs} +469 -456
  206. package/.output/server/_ssr/{runtime.server-BdMY1blX.mjs → runtime.server-BUbb281Z.mjs} +4 -4
  207. package/.output/server/_ssr/{schema-ChlRtZIo.mjs → schema-CaIuQCXb.mjs} +1 -1
  208. package/.output/server/_ssr/{schema-migration-rpc-mZ_19Wt_.mjs → schema-migration-rpc-DK_ceMAg.mjs} +4 -4
  209. package/.output/server/_ssr/{select-Cjrp1Sl9.mjs → select-dGQiTkaZ.mjs} +12 -10
  210. package/.output/server/_ssr/{server-y3KoaSil.mjs → server-l-C5qBnr.mjs} +7 -7
  211. package/.output/server/_ssr/{sidebar-tRHVNWpo.mjs → sidebar-Ccd4WNjQ.mjs} +17 -10
  212. package/.output/server/_ssr/ssr.mjs +1 -1
  213. package/.output/server/_ssr/{start-BvDsQehg.mjs → start-BXlykDIg.mjs} +2 -2
  214. package/.output/server/_ssr/{switch-YrqCYfP-.mjs → switch-CC7UK0Nw.mjs} +4 -4
  215. package/.output/server/_ssr/{table-NHakBPSp.mjs → table-BAlgZdxo.mjs} +2 -2
  216. package/.output/server/_ssr/tabs-Bm7PWhQk.mjs +45 -0
  217. package/.output/server/_ssr/{updateFailures-n-tGv90S.mjs → updateFailures-DGuFoK6A.mjs} +3 -3
  218. package/.output/server/_ssr/{dist-TEpM_UAD.mjs → uuid-kZvLA0Ly-DNL0qBSj.mjs} +2 -147
  219. package/.output/server/_ssr/{uuidv7-BIF4nb_q.mjs → uuidv7-C0jNe2Om.mjs} +2 -2
  220. package/.output/server/_ssr/{version-CQ98ZBpL-CWSkTT9J.mjs → version-CQ98ZBpL-zW2fpHOZ.mjs} +1 -1
  221. package/.output/server/_tanstack-start-manifest_v-C_zDNaKT.mjs +223 -0
  222. package/.output/server/index.mjs +482 -391
  223. package/lib/index.d.mts +9 -0
  224. package/package.json +7 -30
  225. package/src/components/AppSidebar.tsx +11 -2
  226. package/src/components/ChannelBadge.tsx +9 -9
  227. package/src/components/DataTable.tsx +363 -0
  228. package/src/components/FoldedRows.tsx +219 -0
  229. package/src/components/HashValueDisplay.tsx +6 -3
  230. package/src/components/PlatformIcon.tsx +10 -0
  231. package/src/components/RelativeTime.tsx +31 -0
  232. package/src/components/RowReason.tsx +56 -0
  233. package/src/components/TargetDisplay.tsx +95 -0
  234. package/src/components/ThemeProvider.tsx +11 -2
  235. package/src/components/features/api-keys/ApiKeysPage.tsx +5 -3
  236. package/src/components/features/bundles/BundleMetadata.tsx +1 -1
  237. package/src/components/features/bundles/RolloutCohortsDialog.tsx +8 -1
  238. package/src/components/features/channels/ChannelManagementDialog.tsx +10 -11
  239. package/src/components/features/insights/AppUsage.tsx +3 -5
  240. package/src/components/features/insights/FailureReports.tsx +3 -2
  241. package/src/components/features/insights/InsightsControls.tsx +2 -2
  242. package/src/components/features/insights/InsightsOverview.tsx +7 -1
  243. package/src/components/features/insights/InsightsPageHeader.tsx +10 -15
  244. package/src/components/features/insights/ReleaseActivity.tsx +6 -2
  245. package/src/components/features/insights/ReleaseCombobox.tsx +1 -1
  246. package/src/components/features/insights/UpdateFailures.tsx +1 -0
  247. package/src/components/features/native-builds/BuiltInBundleCard.tsx +122 -61
  248. package/src/components/features/native-builds/CommitLink.tsx +3 -2
  249. package/src/components/features/native-builds/ImportBuild.tsx +1 -1
  250. package/src/components/features/native-builds/InstallCard.tsx +316 -91
  251. package/src/components/features/native-builds/IosDevicesPage.tsx +1100 -0
  252. package/src/components/features/native-builds/IosInstall.tsx +732 -0
  253. package/src/components/features/native-builds/IpaDevicesCard.tsx +111 -0
  254. package/src/components/features/native-builds/NativeBuildDetailPage.tsx +30 -6
  255. package/src/components/features/native-builds/NativeBuildsNav.tsx +44 -0
  256. package/src/components/features/native-builds/NativeBuildsPage.tsx +138 -89
  257. package/src/components/features/native-builds/NativeBuildsTable.tsx +649 -323
  258. package/src/components/features/native-builds/OlderBuildLabel.tsx +61 -0
  259. package/src/components/features/native-builds/PatchesCard.tsx +28 -19
  260. package/src/components/features/native-builds/ReleaseNativeBuildLink.tsx +5 -5
  261. package/src/components/features/native-builds/SandboxBadge.tsx +21 -0
  262. package/src/components/features/native-builds/ServedNowCard.tsx +33 -1
  263. package/src/components/features/native-builds/ShortHash.tsx +6 -3
  264. package/src/components/features/native-builds/StoreSubmission.tsx +18 -12
  265. package/src/components/features/native-builds/playTracks.ts +7 -0
  266. package/src/components/features/releases/ReleaseEditorSheet.tsx +8 -6
  267. package/src/components/features/remote-config/PublishDialog.tsx +4 -1
  268. package/src/components/features/remote-config/VersionsCard.tsx +5 -2
  269. package/src/components/ui/alert-dialog.tsx +2 -2
  270. package/src/components/ui/badge.tsx +2 -0
  271. package/src/components/ui/button.tsx +11 -2
  272. package/src/components/ui/dialog.tsx +3 -3
  273. package/src/components/ui/input.tsx +1 -1
  274. package/src/components/ui/select.tsx +15 -7
  275. package/src/components/ui/sheet.tsx +1 -1
  276. package/src/components/ui/sidebar.tsx +2 -2
  277. package/src/components/ui/slider.tsx +1 -1
  278. package/src/components/ui/sonner.tsx +3 -1
  279. package/src/components/ui/switch.tsx +1 -1
  280. package/src/components/ui/tabs.tsx +1 -1
  281. package/src/components/ui/textarea.tsx +1 -1
  282. package/src/index.ts +9 -0
  283. package/src/lib/api-rpc.ts +125 -35
  284. package/src/lib/api.ts +160 -16
  285. package/src/lib/constants.ts +15 -0
  286. package/src/lib/insights-search.ts +0 -3
  287. package/src/lib/ios-devices-api.ts +290 -0
  288. package/src/lib/ios-devices-rpc.ts +188 -0
  289. package/src/lib/native-builds.ts +263 -20
  290. package/src/lib/server/console-runtime.server.ts +9 -2
  291. package/src/lib/server/deviceProfileToken.ts +221 -0
  292. package/src/lib/server/foldedPage.ts +360 -0
  293. package/src/lib/server/iosDeviceCookie.ts +239 -0
  294. package/src/lib/server/iosDeviceProfile.ts +232 -0
  295. package/src/lib/server/iosDevices.ts +193 -0
  296. package/src/lib/server/listReleases.ts +101 -62
  297. package/src/lib/server/local-console.ts +1 -1
  298. package/src/lib/server/nativeBuildDownloadLink.ts +193 -0
  299. package/src/lib/server/nativeBuildInstall.ts +497 -0
  300. package/src/lib/server/nativeBuilds.ts +314 -58
  301. package/src/lib/server/plistText.ts +17 -0
  302. package/src/lib/server/publicConsoleBase.ts +17 -0
  303. package/src/routeTree.gen.ts +129 -18
  304. package/src/routes/-native-builds-search.ts +52 -4
  305. package/src/routes/-releases-search.ts +63 -2
  306. package/src/routes/[_]hot-updater/devices/device-response.ts +21 -0
  307. package/src/routes/[_]hot-updater/devices/device[.]mobileconfig.ts +17 -0
  308. package/src/routes/[_]hot-updater/devices/receipt.ts +28 -0
  309. package/src/routes/[_]hot-updater/devices/request.ts +28 -0
  310. package/src/routes/[_]hot-updater/native-builds/$buildId/manifest[.]plist.ts +22 -0
  311. package/src/routes/api/native-builds/$buildId/download.ts +22 -1
  312. package/src/routes/index.tsx +645 -552
  313. package/src/routes/insights.tsx +3 -5
  314. package/src/routes/insights_.distribution.tsx +2 -2
  315. package/src/routes/native-builds_.devices.tsx +21 -0
  316. package/src/styles.css +24 -0
  317. package/.output/public/assets/-native-builds-search-C-TGpFAm.js +0 -1
  318. package/.output/public/assets/HashValueDisplay-6lNRxDJX.js +0 -1
  319. package/.output/public/assets/InsightsPageHeader-DHhqY3DT.js +0 -1
  320. package/.output/public/assets/RolloutPercentageBadge-Cxogpi8F.js +0 -1
  321. package/.output/public/assets/StoreSubmission-ViTkW4eJ.js +0 -1
  322. package/.output/public/assets/alert-dialog-BqYScr9y.js +0 -1
  323. package/.output/public/assets/api-P2g8dCNg.js +0 -1
  324. package/.output/public/assets/api-keys-DWQC2q6y.js +0 -1
  325. package/.output/public/assets/api-keys-FueRkF9q.js +0 -1
  326. package/.output/public/assets/arrow-left-g9cKqXuC.js +0 -1
  327. package/.output/public/assets/arrow-right-CNII8TYn.js +0 -1
  328. package/.output/public/assets/arrow-up-right-DK8Zdg40.js +0 -1
  329. package/.output/public/assets/badge-DWFcDWho.js +0 -1
  330. package/.output/public/assets/check-CXVR3s3X.js +0 -1
  331. package/.output/public/assets/chevron-right-BoUXo82O.js +0 -1
  332. package/.output/public/assets/dialog-CNUPxNxH.js +0 -1
  333. package/.output/public/assets/dist-CPlO6ko9.js +0 -1
  334. package/.output/public/assets/empty-B3Uwdd6k.js +0 -1
  335. package/.output/public/assets/field-D-2-mnNh.js +0 -1
  336. package/.output/public/assets/history-DqHlgSuV.js +0 -1
  337. package/.output/public/assets/index-CqP5HPV6.js +0 -10
  338. package/.output/public/assets/input-group-D3OUBk4n.js +0 -1
  339. package/.output/public/assets/insights-B-0odqpt.js +0 -42
  340. package/.output/public/assets/insights-BSVGfxSL.js +0 -1
  341. package/.output/public/assets/insights-NK5B6ReS.js +0 -2
  342. package/.output/public/assets/insights-api-BVCXJsoV.js +0 -1
  343. package/.output/public/assets/insights-search-DghCbEnk.js +0 -1
  344. package/.output/public/assets/insights-usage-rpc-CKQH0pUS.js +0 -1
  345. package/.output/public/assets/insights_.distribution-CJvgwcVZ.js +0 -2
  346. package/.output/public/assets/insights_.distribution-DblZM0mO.js +0 -1
  347. package/.output/public/assets/insights_.distribution-dvk6vYDM.js +0 -1
  348. package/.output/public/assets/installations-B674P5Z5.js +0 -2
  349. package/.output/public/assets/installations-BWxczZ2t.js +0 -1
  350. package/.output/public/assets/installations-Dv4kWQYz.js +0 -1
  351. package/.output/public/assets/native-builds-BOC71grI.js +0 -1
  352. package/.output/public/assets/native-builds-D6rldpSh.js +0 -2
  353. package/.output/public/assets/native-builds-DAy2678K.js +0 -1
  354. package/.output/public/assets/native-builds_._buildId-DD58_Phd.js +0 -1
  355. package/.output/public/assets/native-builds_._buildId-DvQDKnUQ.js +0 -2
  356. package/.output/public/assets/plus-BReVKct-.js +0 -1
  357. package/.output/public/assets/preload-helper-B44EvKhG.js +0 -1
  358. package/.output/public/assets/refresh-cw-B9HHjLej.js +0 -1
  359. package/.output/public/assets/remote-config-B7ujqhLa.js +0 -6
  360. package/.output/public/assets/remote-config-WjpozBG5.js +0 -1
  361. package/.output/public/assets/remote-config-gXeH6PBW.js +0 -1
  362. package/.output/public/assets/routes-BDdBIxYS.js +0 -1
  363. package/.output/public/assets/routes-CCD33Azv.js +0 -2
  364. package/.output/public/assets/search-BCel4Oy6.js +0 -1
  365. package/.output/public/assets/select-CBIU0_M1.js +0 -1
  366. package/.output/public/assets/sidebar-Di9SN47G.js +0 -3
  367. package/.output/public/assets/smartphone-CMaSy_ir.js +0 -1
  368. package/.output/public/assets/styles-uK-0vUMk.css +0 -2
  369. package/.output/public/assets/switch-BpdiHL_t.js +0 -1
  370. package/.output/public/assets/table-Bpy3SvSo.js +0 -1
  371. package/.output/public/assets/tabs-Xmt7tZeG.js +0 -1
  372. package/.output/public/assets/useInfiniteQuery-DX4WpBRG.js +0 -1
  373. package/.output/public/assets/valueToPercent-BLwGy_xK.js +0 -1
  374. package/.output/server/_ssr/-native-builds-search-CwNcoXf4.mjs +0 -37
  375. package/.output/server/_ssr/RolloutPercentageBadge-CoBhJtv9.mjs +0 -21
  376. package/.output/server/_ssr/StoreSubmission-CPg_Rn5E.mjs +0 -139
  377. package/.output/server/_ssr/listReleases-D_GY00SQ.mjs +0 -79
  378. package/.output/server/_ssr/native-builds-BDcOlKnd.mjs +0 -510
  379. package/.output/server/_ssr/native-builds-DhXL5zf_.mjs +0 -137
  380. package/.output/server/_ssr/native-builds_._buildId-BjsdQO93.mjs +0 -813
  381. package/.output/server/_ssr/nativeBuildQr-84cnFQPX.mjs +0 -59
  382. package/.output/server/_ssr/nativeBuilds-B_7BPjt_.mjs +0 -133
  383. package/.output/server/_ssr/qr-code-C7kNRIDX.mjs +0 -22
  384. package/.output/server/_ssr/tabs-BgTTFotk.mjs +0 -45
  385. package/.output/server/_tanstack-start-manifest_v-B5nsO5L4.mjs +0 -184
  386. package/src/lib/server/nativeBuildQr.ts +0 -73
  387. package/src/routes/[_]hot-updater/native-builds/qr.ts +0 -14
@@ -0,0 +1,1573 @@
1
+ import { n as __exportAll } from "../_runtime.mjs";
2
+ import { n as assertCanonicalChannelName, o as encodeChannelKey, r as canonicalizeAppVersion, s as isUUIDv7 } from "./uuid-kZvLA0Ly-DNL0qBSj.mjs";
3
+ import { t as __exportAll$1 } from "./rolldown-runtime-rSIU-vHC.mjs";
4
+ //#region node_modules/.nitro/vite/services/ssr/assets/native-artifact-BurROe05.js
5
+ var native_artifact_BurROe05_exports = /* @__PURE__ */ __exportAll({
6
+ a: () => readProfileServiceUdid,
7
+ i: () => readIpaInstallInfo,
8
+ n: () => native_artifact_exports,
9
+ r: () => normalizeIosUdid,
10
+ t: () => isSandboxChannel
11
+ });
12
+ var native_artifact_exports = /* @__PURE__ */ __exportAll$1({
13
+ NativeArtifactError: () => NativeArtifactError,
14
+ SANDBOX_ACTIVITY: () => SANDBOX_ACTIVITY,
15
+ SANDBOX_APPLICATION_ID_SUFFIX: () => SANDBOX_APPLICATION_ID_SUFFIX,
16
+ SANDBOX_CODE_MARKER: () => SANDBOX_CODE_MARKER,
17
+ SANDBOX_INFO_PLIST_KEY: () => SANDBOX_INFO_PLIST_KEY,
18
+ SANDBOX_META_DATA: () => SANDBOX_META_DATA,
19
+ SANDBOX_URL_SCHEME_INFO_PLIST_KEY: () => SANDBOX_URL_SCHEME_INFO_PLIST_KEY,
20
+ SANDBOX_URL_SCHEME_META_DATA: () => SANDBOX_URL_SCHEME_META_DATA,
21
+ SANDBOX_URL_TYPE_NAME: () => SANDBOX_URL_TYPE_NAME,
22
+ alreadyImportedProblem: () => alreadyImportedProblem,
23
+ blobSource: () => blobSource,
24
+ checkNativeArtifact: () => checkNativeArtifact,
25
+ createPreviewLink: () => createPreviewLink,
26
+ findZipEntry: () => findZipEntry,
27
+ isConfigurableSandboxUrlScheme: () => isConfigurableSandboxUrlScheme,
28
+ isRecordedUrlSchemeSyntax: () => isRecordedUrlSchemeSyntax,
29
+ isSandboxChannel: () => isSandboxChannel,
30
+ isSandboxUrlScheme: () => isSandboxUrlScheme,
31
+ normalizeIosUdid: () => normalizeIosUdid,
32
+ openZipEntry: () => openZipEntry,
33
+ parsePreviewLink: () => parsePreviewLink,
34
+ readIpaInstallInfo: () => readIpaInstallInfo,
35
+ readNativeArtifact: () => readNativeArtifact,
36
+ readProfileServiceUdid: () => readProfileServiceUdid,
37
+ readProvisioningProfile: () => readProvisioningProfile,
38
+ readZipDirectory: () => readZipDirectory,
39
+ recordedSandboxUrlScheme: () => recordedSandboxUrlScheme,
40
+ sandboxArtifactProblem: () => sandboxArtifactProblem,
41
+ sandboxChannelOf: () => sandboxChannelOf,
42
+ sandboxUrlSchemeOf: () => sandboxUrlSchemeOf
43
+ });
44
+ /** A `Blob`, such as Node's `fs.openAsBlob`, read by slices. */
45
+ var blobSource = (blob) => ({
46
+ size: blob.size,
47
+ async read(offset, length) {
48
+ return new Uint8Array(await blob.slice(offset, Math.min(blob.size, offset + length)).arrayBuffer());
49
+ }
50
+ });
51
+ /** Why an artifact can't be read, or can't serve as a native build. */
52
+ var NativeArtifactError = class extends Error {
53
+ code;
54
+ name = "NativeArtifactError";
55
+ constructor(code, message) {
56
+ super(message);
57
+ this.code = code;
58
+ }
59
+ };
60
+ var corrupt$1 = () => new NativeArtifactError("UNREADABLE", "The artifact's AndroidManifest.xml is corrupt.");
61
+ var view$3 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
62
+ var RES_STRING_POOL_TYPE = 1;
63
+ var RES_XML_TYPE = 3;
64
+ var RES_XML_START_ELEMENT_TYPE = 258;
65
+ var RES_XML_END_ELEMENT_TYPE = 259;
66
+ var RES_XML_RESOURCE_MAP_TYPE = 384;
67
+ var UTF8_FLAG = 256;
68
+ var NO_INDEX = 4294967295;
69
+ /** A `ResXMLTree_attrExt`, and a `ResXMLTree_attribute`, in bytes. */
70
+ var ELEMENT_EXT_BYTES = 20;
71
+ var ATTRIBUTE_BYTES = 20;
72
+ /** How deep a manifest's elements nest: an AndroidManifest.xml, a few levels. */
73
+ var MAX_ELEMENT_DEPTH = 64;
74
+ var TYPE_REFERENCE = 1;
75
+ var TYPE_STRING = 3;
76
+ var TYPE_INT_DEC = 16;
77
+ var TYPE_INT_HEX = 17;
78
+ var TYPE_INT_BOOLEAN = 18;
79
+ /**
80
+ * How many bytes a manifest's strings decode to in all. A pool's offsets can
81
+ * point many indexes, or overlapping ranges, at one long string, so the
82
+ * manifest's own size bounds nothing.
83
+ */
84
+ var DECODED_STRING_BYTES = 16777216;
85
+ /**
86
+ * A `ResStringPool` chunk's strings, decoded when an index is read: each
87
+ * offset once, against one budget, within the chunk.
88
+ */
89
+ var readStringPool = (bytes, start, size) => {
90
+ const data = view$3(bytes);
91
+ const end = start + size;
92
+ if (size < 28) throw corrupt$1();
93
+ const count = data.getUint32(start + 8, true);
94
+ const flags = data.getUint32(start + 16, true);
95
+ const stringsStart = start + data.getUint32(start + 20, true);
96
+ if (start + 28 + count * 4 > end || stringsStart > end) throw corrupt$1();
97
+ const utf8 = (flags & UTF8_FLAG) !== 0;
98
+ const decoder = new TextDecoder(utf8 ? "utf-8" : "utf-16le");
99
+ const decoded = /* @__PURE__ */ new Map();
100
+ let budget = DECODED_STRING_BYTES;
101
+ return (index) => {
102
+ if (index === NO_INDEX || index >= count) return "";
103
+ const offset = data.getUint32(start + 28 + index * 4, true);
104
+ const known = decoded.get(offset);
105
+ if (known !== void 0) return known;
106
+ let at = stringsStart + offset;
107
+ let byteLength;
108
+ if (at + 4 > end) throw corrupt$1();
109
+ if (utf8) {
110
+ at += bytes[at] & 128 ? 2 : 1;
111
+ let length = bytes[at];
112
+ if (length & 128) {
113
+ length = (length & 127) << 8 | bytes[at + 1];
114
+ at += 2;
115
+ } else at += 1;
116
+ byteLength = length;
117
+ } else {
118
+ let length = data.getUint16(at, true);
119
+ if (length & 32768) {
120
+ length = (length & 32767) << 16 | data.getUint16(at + 2, true);
121
+ at += 4;
122
+ } else at += 2;
123
+ byteLength = length * 2;
124
+ }
125
+ budget -= byteLength;
126
+ if (at + byteLength > end || budget < 0) throw corrupt$1();
127
+ const text = decoder.decode(bytes.subarray(at, at + byteLength));
128
+ decoded.set(offset, text);
129
+ return text;
130
+ };
131
+ };
132
+ var parseBinaryManifest = (bytes) => {
133
+ const data = view$3(bytes);
134
+ if (bytes.byteLength < 8 || data.getUint16(0, true) !== RES_XML_TYPE) throw corrupt$1();
135
+ let stringAt = () => "";
136
+ let resourceIds = [];
137
+ const stack = [];
138
+ let root = null;
139
+ for (let at = data.getUint16(2, true); at + 8 <= bytes.byteLength;) {
140
+ const type = data.getUint16(at, true);
141
+ const headerSize = data.getUint16(at + 2, true);
142
+ const size = data.getUint32(at + 4, true);
143
+ if (size < 8 || at + size > bytes.byteLength) throw corrupt$1();
144
+ if (type === RES_STRING_POOL_TYPE) stringAt = readStringPool(bytes, at, size);
145
+ else if (type === RES_XML_RESOURCE_MAP_TYPE) {
146
+ resourceIds = [];
147
+ for (let i = at + headerSize; i + 4 <= at + size; i += 4) resourceIds.push(data.getUint32(i, true));
148
+ } else if (type === RES_XML_START_ELEMENT_TYPE) {
149
+ const ext = at + headerSize;
150
+ const attributeStart = data.getUint16(ext + 8, true);
151
+ const attributeSize = data.getUint16(ext + 10, true);
152
+ const attributeCount = data.getUint16(ext + 12, true);
153
+ if (headerSize < 16 || ext + ELEMENT_EXT_BYTES > at + size || attributeStart < ELEMENT_EXT_BYTES || attributeSize < ATTRIBUTE_BYTES || ext + attributeStart + attributeCount * attributeSize > at + size || stack.length >= MAX_ELEMENT_DEPTH) throw corrupt$1();
154
+ const name = stringAt(data.getUint32(ext + 4, true));
155
+ const attributes = [];
156
+ for (let i = 0; i < attributeCount; i += 1) {
157
+ const attr = ext + attributeStart + i * attributeSize;
158
+ const nameIndex = data.getUint32(attr + 4, true);
159
+ const raw = data.getUint32(attr + 8, true);
160
+ const dataType = bytes[attr + 15];
161
+ const value = data.getUint32(attr + 16, true);
162
+ attributes.push({
163
+ name: stringAt(nameIndex),
164
+ resourceId: resourceIds[nameIndex] ?? 0,
165
+ value: dataType === TYPE_STRING ? {
166
+ type: "string",
167
+ value: stringAt(raw === NO_INDEX ? value : raw)
168
+ } : dataType === TYPE_INT_BOOLEAN ? {
169
+ type: "boolean",
170
+ value: value !== 0
171
+ } : dataType === TYPE_INT_DEC || dataType === TYPE_INT_HEX ? {
172
+ type: "int",
173
+ value: value | 0
174
+ } : dataType === TYPE_REFERENCE ? {
175
+ type: "reference",
176
+ id: value
177
+ } : { type: "other" }
178
+ });
179
+ }
180
+ stack.push({
181
+ name,
182
+ attributes,
183
+ children: []
184
+ });
185
+ } else if (type === RES_XML_END_ELEMENT_TYPE) {
186
+ const element = stack.pop();
187
+ if (element === void 0) throw corrupt$1();
188
+ const parent = stack.at(-1);
189
+ if (parent === void 0) root ??= element;
190
+ else parent.children.push(element);
191
+ }
192
+ at += size;
193
+ }
194
+ if (root === null) throw corrupt$1();
195
+ return root;
196
+ };
197
+ /** A minimal protobuf reader: fields of one message, by number. */
198
+ var readMessage = (bytes) => {
199
+ const fields = [];
200
+ let at = 0;
201
+ const varint = () => {
202
+ let value = 0;
203
+ let multiplier = 1;
204
+ for (;;) {
205
+ if (at >= bytes.byteLength) throw corrupt$1();
206
+ const byte = bytes[at++];
207
+ value += (byte & 127) * multiplier;
208
+ if ((byte & 128) === 0) return value;
209
+ multiplier *= 128;
210
+ if (multiplier > 2 ** 63) throw corrupt$1();
211
+ }
212
+ };
213
+ while (at < bytes.byteLength) {
214
+ const key = varint();
215
+ const field = Math.floor(key / 8);
216
+ const wireType = key % 8;
217
+ if (wireType === 0) fields.push({
218
+ field,
219
+ wireType,
220
+ value: varint()
221
+ });
222
+ else if (wireType === 2) {
223
+ const length = varint();
224
+ if (at + length > bytes.byteLength) throw corrupt$1();
225
+ fields.push({
226
+ field,
227
+ wireType,
228
+ value: bytes.subarray(at, at + length)
229
+ });
230
+ at += length;
231
+ } else if (wireType === 5) at += 4;
232
+ else if (wireType === 1) at += 8;
233
+ else throw corrupt$1();
234
+ }
235
+ return fields;
236
+ };
237
+ var decoder = new TextDecoder();
238
+ var bytesOf = (fields, field) => fields.filter((f) => f.field === field && f.value instanceof Uint8Array).map((f) => f.value);
239
+ var stringOf = (fields, field) => {
240
+ const [value] = bytesOf(fields, field);
241
+ return value === void 0 ? "" : decoder.decode(value);
242
+ };
243
+ var numberOf = (fields, field) => {
244
+ const found = fields.find((f) => f.field === field && f.wireType === 0);
245
+ return found === void 0 ? void 0 : found.value;
246
+ };
247
+ /** An `Item` of aapt2's Resources.proto, as an attribute's compiled value. */
248
+ var protoItemValue = (item, raw) => {
249
+ const fields = readMessage(item);
250
+ const [reference] = bytesOf(fields, 1);
251
+ if (reference !== void 0) {
252
+ const ref = readMessage(reference);
253
+ return {
254
+ type: "reference",
255
+ id: numberOf(ref, 2) ?? 0,
256
+ name: stringOf(ref, 3) || void 0
257
+ };
258
+ }
259
+ const [str] = bytesOf(fields, 2);
260
+ if (str !== void 0) return {
261
+ type: "string",
262
+ value: stringOf(readMessage(str), 1)
263
+ };
264
+ const [primitive] = bytesOf(fields, 7);
265
+ if (primitive !== void 0) {
266
+ const prim = readMessage(primitive);
267
+ const boolean = numberOf(prim, 8);
268
+ if (boolean !== void 0) return {
269
+ type: "boolean",
270
+ value: boolean !== 0
271
+ };
272
+ const int = numberOf(prim, 6) ?? numberOf(prim, 7);
273
+ if (int !== void 0) return {
274
+ type: "int",
275
+ value: int | 0
276
+ };
277
+ if (raw !== "") return {
278
+ type: "string",
279
+ value: raw
280
+ };
281
+ }
282
+ return null;
283
+ };
284
+ /** An `XmlElement` of aapt2's Resources.proto. */
285
+ var protoElement = (bytes, depth = 0) => {
286
+ if (depth >= MAX_ELEMENT_DEPTH) throw corrupt$1();
287
+ const fields = readMessage(bytes);
288
+ const attributes = bytesOf(fields, 4).map((attribute) => {
289
+ const attr = readMessage(attribute);
290
+ const raw = stringOf(attr, 3);
291
+ const [item] = bytesOf(attr, 6);
292
+ return {
293
+ name: stringOf(attr, 2),
294
+ resourceId: numberOf(attr, 5) ?? 0,
295
+ value: (item && protoItemValue(item, raw)) ?? {
296
+ type: "string",
297
+ value: raw
298
+ }
299
+ };
300
+ });
301
+ const children = bytesOf(fields, 5).flatMap((node) => {
302
+ const [element] = bytesOf(readMessage(node), 1);
303
+ return element === void 0 ? [] : [protoElement(element, depth + 1)];
304
+ });
305
+ return {
306
+ name: stringOf(fields, 3),
307
+ attributes,
308
+ children
309
+ };
310
+ };
311
+ /**
312
+ * An `.aab` module's `manifest/AndroidManifest.xml`, an `XmlNode` of
313
+ * aapt2's Resources.proto.
314
+ */
315
+ var parseProtoManifest = (bytes) => {
316
+ const [element] = bytesOf(readMessage(bytes), 1);
317
+ if (element === void 0) throw corrupt$1();
318
+ return protoElement(element);
319
+ };
320
+ var VERSION_CODE = 16843291;
321
+ var VERSION_NAME = 16843292;
322
+ var NAME = 16842755;
323
+ var VALUE = 16842788;
324
+ var RESOURCE = 16842789;
325
+ var SCHEME = 16842791;
326
+ var COMPONENTS = /* @__PURE__ */ new Set(["activity", "activity-alias"]);
327
+ var attributeOf = (element, resourceId, name) => element.attributes.find((attribute) => attribute.resourceId !== 0 ? attribute.resourceId === resourceId : attribute.name === name)?.value ?? null;
328
+ /** The values of a parsed manifest that import reads. */
329
+ var readAndroidManifest = (manifest) => {
330
+ if (manifest.name !== "manifest") throw corrupt$1();
331
+ const packageValue = manifest.attributes.find((attribute) => attribute.name === "package")?.value;
332
+ const versionCode = attributeOf(manifest, VERSION_CODE, "versionCode");
333
+ const application = manifest.children.find(({ name }) => name === "application");
334
+ const metaData = /* @__PURE__ */ new Map();
335
+ const launchers = [];
336
+ const urlSchemes = /* @__PURE__ */ new Map();
337
+ const componentMetaData = /* @__PURE__ */ new Map();
338
+ const metaDataOf = (element, into) => {
339
+ const name = attributeOf(element, NAME, "name");
340
+ const value = attributeOf(element, VALUE, "value") ?? attributeOf(element, RESOURCE, "resource");
341
+ if (name?.type === "string" && value !== null) into.set(name.value, value);
342
+ };
343
+ const stringAttribute = (element, id, name) => {
344
+ const value = attributeOf(element, id, name);
345
+ return value?.type === "string" ? value.value : null;
346
+ };
347
+ for (const element of application?.children ?? []) {
348
+ if (COMPONENTS.has(element.name)) {
349
+ const component = stringAttribute(element, NAME, "name");
350
+ if (component === null) continue;
351
+ for (const item of element.children) {
352
+ if (item.name !== "meta-data") continue;
353
+ const own = componentMetaData.get(component) ?? /* @__PURE__ */ new Map();
354
+ metaDataOf(item, own);
355
+ componentMetaData.set(component, own);
356
+ }
357
+ for (const filter of element.children) {
358
+ if (filter.name !== "intent-filter") continue;
359
+ const named = (child) => filter.children.filter(({ name }) => name === child).map((part) => stringAttribute(part, NAME, "name"));
360
+ if (named("action").includes("android.intent.action.MAIN") && named("category").includes("android.intent.category.LAUNCHER") && !launchers.includes(component)) launchers.push(component);
361
+ if (!named("action").includes("android.intent.action.VIEW")) continue;
362
+ for (const data of filter.children) {
363
+ if (data.name !== "data") continue;
364
+ const scheme = stringAttribute(data, SCHEME, "scheme");
365
+ if (scheme === null) continue;
366
+ urlSchemes.set(component, [...urlSchemes.get(component) ?? [], scheme]);
367
+ }
368
+ }
369
+ continue;
370
+ }
371
+ if (element.name !== "meta-data") continue;
372
+ metaDataOf(element, metaData);
373
+ }
374
+ return {
375
+ packageName: packageValue?.type === "string" ? packageValue.value : null,
376
+ versionName: attributeOf(manifest, VERSION_NAME, "versionName"),
377
+ versionCode: versionCode?.type === "int" ? versionCode.value : null,
378
+ metaData,
379
+ launchers,
380
+ urlSchemes,
381
+ componentMetaData
382
+ };
383
+ };
384
+ /** How deep a plist nests: an Info.plist nests a few levels. */
385
+ var MAX_DEPTH = 64;
386
+ var corrupt = () => new NativeArtifactError("UNREADABLE", "The app's Info.plist is corrupt.");
387
+ var view$2 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
388
+ /** A big-endian unsigned integer of `size` bytes. */
389
+ var uintAt = (bytes, offset, size) => {
390
+ let value = 0;
391
+ for (let i = 0; i < size; i += 1) value = value * 256 + bytes[offset + i];
392
+ return value;
393
+ };
394
+ /** A binary property list (`bplist00`), as Xcode writes an app's Info.plist. */
395
+ var parseBinaryPlist = (bytes) => {
396
+ if (bytes.byteLength < 40) throw corrupt();
397
+ const trailer = bytes.byteLength - 32;
398
+ const offsetSize = bytes[trailer + 6];
399
+ const refSize = bytes[trailer + 7];
400
+ const objectCount = uintAt(bytes, trailer + 8, 8);
401
+ const top = uintAt(bytes, trailer + 16, 8);
402
+ const tableOffset = uintAt(bytes, trailer + 24, 8);
403
+ if (offsetSize < 1 || offsetSize > 8 || refSize < 1 || refSize > 8 || objectCount < 1 || top >= objectCount || tableOffset < 8 || tableOffset + objectCount * offsetSize > trailer) throw corrupt();
404
+ const data = view$2(bytes);
405
+ const seen = /* @__PURE__ */ new Set();
406
+ const parsed = /* @__PURE__ */ new Map();
407
+ let budget = 2 * bytes.byteLength + 4096;
408
+ const spend = (units) => {
409
+ budget -= units;
410
+ if (budget < 0) throw corrupt();
411
+ };
412
+ const parse = (ref) => {
413
+ if (ref >= objectCount) throw corrupt();
414
+ const offset = uintAt(bytes, tableOffset + ref * offsetSize, offsetSize);
415
+ if (offset < 8 || offset >= tableOffset) throw corrupt();
416
+ const done = parsed.get(offset);
417
+ if (done !== void 0) return done;
418
+ if (seen.has(offset) || seen.size > MAX_DEPTH) throw corrupt();
419
+ const value = parseObject(offset);
420
+ parsed.set(offset, value);
421
+ return value;
422
+ };
423
+ const parseObject = (offset) => {
424
+ const marker = bytes[offset];
425
+ const kind = marker >> 4;
426
+ const info = marker & 15;
427
+ /** `count` units of `unit` bytes from `start`, which must fit the objects. */
428
+ const fits = (start, count, unit) => {
429
+ if (start + count * unit > tableOffset) throw corrupt();
430
+ };
431
+ /**
432
+ * A length in the marker, or in the integer object after it, and where
433
+ * its `unit`-byte items start, all of which must fit the objects.
434
+ */
435
+ const lengthAt = (unit) => {
436
+ let length = info;
437
+ let start = offset + 1;
438
+ if (info === 15) {
439
+ const sizeMarker = bytes[offset + 1];
440
+ if (sizeMarker >> 4 !== 1 || (sizeMarker & 15) > 3) throw corrupt();
441
+ const size = 1 << (sizeMarker & 15);
442
+ fits(offset + 2, size, 1);
443
+ length = uintAt(bytes, offset + 2, size);
444
+ start = offset + 2 + size;
445
+ }
446
+ fits(start, length, unit);
447
+ spend(length + 1);
448
+ return [length, start];
449
+ };
450
+ switch (kind) {
451
+ case 0: return info === 9 ? true : info === 8 ? false : null;
452
+ case 1: {
453
+ if (info > 3) throw corrupt();
454
+ const size = 1 << info;
455
+ fits(offset + 1, size, 1);
456
+ return size === 8 ? Number(data.getBigInt64(offset + 1, false)) : uintAt(bytes, offset + 1, size);
457
+ }
458
+ case 2:
459
+ if (info !== 2 && info !== 3) throw corrupt();
460
+ fits(offset + 1, 1 << info, 1);
461
+ return info === 2 ? data.getFloat32(offset + 1, false) : data.getFloat64(offset + 1, false);
462
+ case 3:
463
+ fits(offset + 1, 8, 1);
464
+ return data.getFloat64(offset + 1, false);
465
+ case 4: {
466
+ const [length, start] = lengthAt(1);
467
+ return bytes.slice(start, start + length);
468
+ }
469
+ case 5: {
470
+ const [length, start] = lengthAt(1);
471
+ return new TextDecoder("latin1").decode(bytes.subarray(start, start + length));
472
+ }
473
+ case 6: {
474
+ const [length, start] = lengthAt(2);
475
+ let text = "";
476
+ for (let i = 0; i < length; i += 1) text += String.fromCharCode(data.getUint16(start + i * 2, false));
477
+ return text;
478
+ }
479
+ case 8:
480
+ if (info > 7) throw corrupt();
481
+ fits(offset + 1, info + 1, 1);
482
+ return uintAt(bytes, offset + 1, info + 1);
483
+ case 10:
484
+ case 12: {
485
+ const [length, start] = lengthAt(refSize);
486
+ seen.add(offset);
487
+ const items = [];
488
+ for (let i = 0; i < length; i += 1) items.push(parse(uintAt(bytes, start + i * refSize, refSize)));
489
+ seen.delete(offset);
490
+ return items;
491
+ }
492
+ case 13: {
493
+ const [length, start] = lengthAt(2 * refSize);
494
+ seen.add(offset);
495
+ const dict = Object.create(null);
496
+ for (let i = 0; i < length; i += 1) {
497
+ const key = parse(uintAt(bytes, start + i * refSize, refSize));
498
+ const value = parse(uintAt(bytes, start + (length + i) * refSize, refSize));
499
+ if (typeof key !== "string") throw corrupt();
500
+ dict[key] = value;
501
+ }
502
+ seen.delete(offset);
503
+ return dict;
504
+ }
505
+ default: throw corrupt();
506
+ }
507
+ };
508
+ return parse(top);
509
+ };
510
+ var ENTITIES = {
511
+ amp: "&",
512
+ lt: "<",
513
+ gt: ">",
514
+ quot: "\"",
515
+ apos: "'"
516
+ };
517
+ var decodeEntities = (text) => text.replace(/&(#x[0-9a-f]+|#\d+|\w+);/giu, (whole, entity) => {
518
+ if (entity[0] === "#") {
519
+ const code = entity[1] === "x" || entity[1] === "X" ? Number.parseInt(entity.slice(2), 16) : Number.parseInt(entity.slice(1), 10);
520
+ if (code > 1114111) throw corrupt();
521
+ return String.fromCodePoint(code);
522
+ }
523
+ return ENTITIES[entity] ?? whole;
524
+ });
525
+ /**
526
+ * `text` without each `open`, what follows it, and its `close`. A scan, because
527
+ * a regular expression retries from every `open` that never closes, which on a
528
+ * crafted file takes minutes.
529
+ */
530
+ var withoutSpans = (text, open, close) => {
531
+ let kept = "";
532
+ let position = 0;
533
+ for (;;) {
534
+ const start = text.indexOf(open, position);
535
+ const end = start === -1 ? -1 : text.indexOf(close, start + open.length);
536
+ if (end === -1) return kept + text.slice(position);
537
+ kept += text.slice(position, start);
538
+ position = end + close.length;
539
+ }
540
+ };
541
+ /** An XML property list, as a provisioning profile holds one. */
542
+ var parseXmlPlist = (text) => {
543
+ const tokens = withoutSpans(withoutSpans(text, "<!--", "-->"), "<?", "?>").replace(/<!DOCTYPE[^<>]*>/giu, "").split(/(<[^<>]+>)/u);
544
+ let i = 0;
545
+ const nextTag = () => {
546
+ while (i < tokens.length) {
547
+ const token = tokens[i++];
548
+ if (token.startsWith("<")) return token;
549
+ if (token.trim() !== "") throw corrupt();
550
+ }
551
+ throw corrupt();
552
+ };
553
+ const textUntil = (close) => {
554
+ let value = "";
555
+ while (i < tokens.length && tokens[i] !== close) value += tokens[i++];
556
+ if (tokens[i++] !== close) throw corrupt();
557
+ return decodeEntities(value);
558
+ };
559
+ let depth = 0;
560
+ const parseValue = (tag) => {
561
+ if (depth > MAX_DEPTH) throw corrupt();
562
+ const name = /^<\s*([\w]+)/u.exec(tag)?.[1];
563
+ const empty = tag.endsWith("/>");
564
+ switch (name) {
565
+ case "string": return empty ? "" : textUntil("</string>");
566
+ case "integer": return Number(textUntil("</integer>"));
567
+ case "real": return Number(textUntil("</real>"));
568
+ case "true": return true;
569
+ case "false": return false;
570
+ case "date": return textUntil("</date>");
571
+ case "data": return textUntil("</data>").replace(/\s+/gu, "");
572
+ case "array": {
573
+ const items = [];
574
+ if (empty) return items;
575
+ depth += 1;
576
+ for (let next = nextTag(); next !== "</array>"; next = nextTag()) items.push(parseValue(next));
577
+ depth -= 1;
578
+ return items;
579
+ }
580
+ case "dict": {
581
+ const dict = Object.create(null);
582
+ if (empty) return dict;
583
+ depth += 1;
584
+ for (let next = nextTag(); next !== "</dict>"; next = nextTag()) {
585
+ if (next !== "<key>") throw corrupt();
586
+ const key = textUntil("</key>");
587
+ dict[key] = parseValue(nextTag());
588
+ }
589
+ depth -= 1;
590
+ return dict;
591
+ }
592
+ default: throw corrupt();
593
+ }
594
+ };
595
+ let tag = nextTag();
596
+ if (/^<plist\b/u.test(tag)) tag = nextTag();
597
+ return parseValue(tag);
598
+ };
599
+ /** A property list, binary or XML, as a JavaScript value. */
600
+ var parsePlist = (bytes) => {
601
+ if (new TextDecoder().decode(bytes.subarray(0, 8)) === "bplist00") return parseBinaryPlist(bytes);
602
+ return parseXmlPlist(new TextDecoder().decode(bytes));
603
+ };
604
+ /**
605
+ * What a sandbox build is, wherever it is built or read: `sandbox: true` on a
606
+ * `nativeBuild` scheme adds a native layer to the app, which a normal build
607
+ * never compiles.
608
+ */
609
+ /**
610
+ * The literal the sandbox layer's code holds, in `ios/HotUpdater/Sandbox` and
611
+ * `android/src/sandbox`: reading an artifact's strings finds it. Its length
612
+ * is its own among the lengths those reads keep.
613
+ */
614
+ var SANDBOX_CODE_MARKER = "HOT_UPDATER_SANDBOX_NATIVE_LAYER";
615
+ /** The Info.plist key an iOS sandbox build declares itself with. */
616
+ var SANDBOX_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX";
617
+ /**
618
+ * The Info.plist key that records the URL scheme an iOS sandbox build
619
+ * registers in its `SANDBOX_URL_TYPE_NAME` URL type: the build reads its own
620
+ * scheme from it, and a later patch knows which scheme is the sandbox's.
621
+ */
622
+ var SANDBOX_URL_SCHEME_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX_URL_SCHEME";
623
+ var URL_SCHEME_SYNTAX = /^[a-z][a-z0-9+.-]*$/;
624
+ /**
625
+ * Whether a value is a URL scheme in lower-case ASCII, as written: what a
626
+ * build records, read before any lower-casing.
627
+ */
628
+ var isRecordedUrlSchemeSyntax = (value) => typeof value === "string" && URL_SCHEME_SYNTAX.test(value);
629
+ /**
630
+ * The URL scheme an iOS sandbox build registers, by one rule its patch, its
631
+ * reader, and its own code apply alike. `recorded` is the Info.plist's
632
+ * `SANDBOX_URL_SCHEME_INFO_PLIST_KEY`, undefined when the key is absent, and
633
+ * `namedTypes` its URL types named `SANDBOX_URL_TYPE_NAME`.
634
+ * - Absent: a prerelease's build, which recorded none. Undefined: the caller
635
+ * reads it the way that build was read.
636
+ * - Present: a scheme in lower-case ASCII, as written, that the one URL type
637
+ * of the name holds alone. Anything else is null, with no fallback.
638
+ */
639
+ var recordedSandboxUrlScheme = (recorded, namedTypes) => {
640
+ if (recorded === void 0) return void 0;
641
+ if (!isRecordedUrlSchemeSyntax(recorded) || namedTypes.length !== 1) return null;
642
+ const schemes = namedTypes[0]?.CFBundleURLSchemes;
643
+ return Array.isArray(schemes) && schemes.length === 1 && schemes[0] === recorded ? recorded : null;
644
+ };
645
+ /** The `<meta-data>` an Android sandbox build declares itself with. */
646
+ var SANDBOX_META_DATA = "com.hotupdater.SANDBOX";
647
+ /** The activity that takes an Android sandbox build's launcher entry and links. */
648
+ var SANDBOX_ACTIVITY = "com.hotupdater.HotUpdaterSandboxActivity";
649
+ /** The `applicationIdSuffix` an Android sandbox build appends. */
650
+ var SANDBOX_APPLICATION_ID_SUFFIX = ".sandbox";
651
+ /**
652
+ * The `CFBundleURLName` of the URL type an iOS sandbox build registers its URL
653
+ * scheme with, which the build reads its own scheme from.
654
+ */
655
+ var SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
656
+ /**
657
+ * The `<meta-data>` of `SANDBOX_ACTIVITY` that names the URL scheme an Android
658
+ * sandbox build registers, which the build reads its own scheme from.
659
+ */
660
+ var SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
661
+ var SANDBOX_CHANNEL_PREFIX = "sandbox-";
662
+ var SANDBOX_URL_SCHEME_PREFIX = "hu-sandbox-";
663
+ /**
664
+ * The channel a scheme's sandbox build registers on. `sandbox-*` is reserved:
665
+ * only a sandbox build registers there, and the registry records `sandbox` on
666
+ * it.
667
+ */
668
+ var sandboxChannelOf = (scheme) => `${SANDBOX_CHANNEL_PREFIX}${scheme}`;
669
+ /** Whether a channel is reserved for sandbox builds. */
670
+ var isSandboxChannel = (channel) => channel.startsWith(SANDBOX_CHANNEL_PREFIX);
671
+ /**
672
+ * The URL scheme a sandbox build registers when its scheme sets none, derived
673
+ * from the app's ID: the app's own scheme would ask which app to open beside
674
+ * the store app.
675
+ */
676
+ var sandboxUrlSchemeOf = (appId) => `${SANDBOX_URL_SCHEME_PREFIX}${appId.toLowerCase().replace(/[^a-z0-9]+/gu, "-")}`;
677
+ /**
678
+ * Whether a URL scheme has the prefix of the derived one: how an artifact built
679
+ * before the URL scheme could be set is read, which registered no other.
680
+ */
681
+ var isSandboxUrlScheme = (scheme) => scheme.toLowerCase().startsWith(SANDBOX_URL_SCHEME_PREFIX);
682
+ var CONFIGURED_URL_SCHEME = /^[a-z][a-z0-9+.-]{0,63}$/u;
683
+ var RESERVED_URL_SCHEMES = /* @__PURE__ */ new Set([
684
+ "http",
685
+ "https",
686
+ "file",
687
+ "data",
688
+ "javascript",
689
+ "true",
690
+ "false"
691
+ ]);
692
+ /**
693
+ * Whether `sandbox: { urlScheme }` can name a URL scheme: lower case, a letter
694
+ * then up to 63 letters, digits, `+`, `.` or `-`, none the system or a browser
695
+ * owns, and neither `true` nor `false`, which Android's manifest can't hold as
696
+ * a string.
697
+ */
698
+ var isConfigurableSandboxUrlScheme = (urlScheme) => CONFIGURED_URL_SCHEME.test(urlScheme) && !RESERVED_URL_SCHEMES.has(urlScheme);
699
+ /**
700
+ * The link a preview QR holds. `urlScheme` is the one the sandbox build
701
+ * registered; without it, the one derived from `appId`, the scheme's
702
+ * `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
703
+ * `.sandbox` suffix.
704
+ */
705
+ var createPreviewLink = ({ urlScheme, appId, channel, fingerprintHash, platform }) => {
706
+ assertCanonicalChannelName(channel);
707
+ if (platform !== void 0 && !PREVIEW_LINK_PLATFORMS.has(platform)) throw new Error(`A preview link's platform is ios or android, not ${platform}.`);
708
+ const link = `${(urlScheme ?? sandboxUrlSchemeOf(appId)).toLowerCase()}://hot-updater/preview?channel=${encodeURIComponent(channel)}&fingerprint=${encodeURIComponent(fingerprintHash)}`;
709
+ return platform === void 0 ? link : `${link}&platform=${platform}`;
710
+ };
711
+ /** Any URL scheme: which app's it is, the app that opens the link decides. */
712
+ var PREVIEW_LINK = /^([a-z][a-z0-9+.-]*):\/\/hot-updater\/preview\?([^#]*)$/iu;
713
+ /**
714
+ * A URL scheme in ASCII alone: case folding lets `/iu` match `K` (Kelvin) or
715
+ * `ſ` as a letter.
716
+ */
717
+ var ASCII_URL_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/;
718
+ var MAX_FINGERPRINT_LENGTH = 256;
719
+ var PREVIEW_LINK_PLATFORMS = /* @__PURE__ */ new Set(["ios", "android"]);
720
+ /**
721
+ * What a preview link says, or null for anything else: another shape, a
722
+ * repeated or missing parameter, or a channel no release can target. It takes
723
+ * any URL scheme: a sandbox build refuses a link of another scheme than its
724
+ * own. A `platform` other than `ios` or `android` reads as none. Native code
725
+ * parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
726
+ * and shares the vectors in test-utils' `sandbox-preview-links.json`.
727
+ */
728
+ var parsePreviewLink = (link) => {
729
+ const match = PREVIEW_LINK.exec(link);
730
+ if (match === null || !ASCII_URL_SCHEME.test(match[1])) return null;
731
+ const parameters = /* @__PURE__ */ new Map();
732
+ for (const parameter of match[2].split("&")) {
733
+ const separator = parameter.indexOf("=");
734
+ if (separator === -1) return null;
735
+ const name = parameter.slice(0, separator);
736
+ if (parameters.has(name)) return null;
737
+ let value;
738
+ try {
739
+ value = decodeURIComponent(parameter.slice(separator + 1));
740
+ } catch {
741
+ return null;
742
+ }
743
+ parameters.set(name, value);
744
+ }
745
+ const channel = parameters.get("channel");
746
+ const fingerprintHash = parameters.get("fingerprint");
747
+ if (channel === void 0 || fingerprintHash === void 0 || fingerprintHash.length === 0 || fingerprintHash.length > MAX_FINGERPRINT_LENGTH) return null;
748
+ try {
749
+ assertCanonicalChannelName(channel);
750
+ } catch {
751
+ return null;
752
+ }
753
+ const platform = parameters.get("platform");
754
+ return {
755
+ urlScheme: match[1].toLowerCase(),
756
+ channel,
757
+ fingerprintHash,
758
+ ...platform !== void 0 && PREVIEW_LINK_PLATFORMS.has(platform) ? { platform } : {}
759
+ };
760
+ };
761
+ var view$1 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
762
+ /** Bytes that are all ASCII, as text; null otherwise. */
763
+ var asciiOf = (bytes) => {
764
+ let text = "";
765
+ for (const byte of bytes) {
766
+ if (byte === 0 || byte >= 128) return null;
767
+ text += String.fromCharCode(byte);
768
+ }
769
+ return text;
770
+ };
771
+ /**
772
+ * The string constants of a dex file with one of `lengths`, from its string
773
+ * pool: every string literal the app's code holds, each one whole. R8
774
+ * renames and inlines classes, but never drops a literal the code returns,
775
+ * so the pool still holds a value the native SDK compiled in.
776
+ */
777
+ var readDexStrings = (dex, lengths) => {
778
+ const data = view$1(dex);
779
+ if (dex.byteLength < 112 || asciiOf(dex.subarray(0, 3)) !== "dex" || dex[3] !== 10) throw new NativeArtifactError("UNREADABLE", "A dex file is corrupt.");
780
+ const count = data.getUint32(56, true);
781
+ const idsOffset = data.getUint32(60, true);
782
+ if (idsOffset + count * 4 > dex.byteLength) throw new NativeArtifactError("UNREADABLE", "A dex file is corrupt.");
783
+ const strings = [];
784
+ const read = /* @__PURE__ */ new Set();
785
+ for (let i = 0; i < count; i += 1) {
786
+ let offset = data.getUint32(idsOffset + i * 4, true);
787
+ if (read.has(offset)) continue;
788
+ read.add(offset);
789
+ let utf16Length = 0;
790
+ for (let shift = 0; offset < dex.byteLength; shift += 7) {
791
+ const byte = dex[offset++];
792
+ utf16Length |= (byte & 127) << shift;
793
+ if ((byte & 128) === 0 || shift > 28) break;
794
+ }
795
+ if (!lengths.has(utf16Length)) continue;
796
+ const end = offset + utf16Length;
797
+ if (end >= dex.byteLength || dex[end] !== 0) continue;
798
+ const text = asciiOf(dex.subarray(offset, end));
799
+ if (text !== null) strings.push(text);
800
+ }
801
+ return strings;
802
+ };
803
+ var MH_MAGIC = 4277009102;
804
+ var MH_MAGIC_64 = 4277009103;
805
+ var FAT_MAGIC = 3405691582;
806
+ var FAT_MAGIC_64 = 3405691583;
807
+ var LC_SEGMENT = 1;
808
+ var LC_SEGMENT_64 = 25;
809
+ var CPU_TYPE_ARM64 = 16777228;
810
+ var nameAt = (bytes, offset) => {
811
+ let name = "";
812
+ for (let i = offset; i < offset + 16 && bytes[i] !== 0; i += 1) name += String.fromCharCode(bytes[i]);
813
+ return name;
814
+ };
815
+ /** The slice of a universal binary to read: arm64's, else the first. */
816
+ var sliceOf = async (read) => {
817
+ const head = await read(0, 4096);
818
+ if (head.byteLength < 8) return null;
819
+ const data = view$1(head);
820
+ const magic = data.getUint32(0, false);
821
+ if (magic !== FAT_MAGIC && magic !== FAT_MAGIC_64) return 0;
822
+ const count = data.getUint32(4, false);
823
+ const size = magic === FAT_MAGIC ? 20 : 32;
824
+ let first = null;
825
+ for (let i = 0; i < count && 8 + (i + 1) * size <= head.byteLength; i += 1) {
826
+ const at = 8 + i * size;
827
+ const offset = magic === FAT_MAGIC ? data.getUint32(at + 8, false) : Number(data.getBigUint64(at + 8, false));
828
+ if (data.getUint32(at, false) === CPU_TYPE_ARM64) return offset;
829
+ first ??= offset;
830
+ }
831
+ return first;
832
+ };
833
+ /**
834
+ * The C string literals of a Mach-O binary with one of `lengths`, from its
835
+ * `__TEXT,__cstring` section, each one whole: the literals an Objective-C or
836
+ * Swift source compiled in. A universal binary is read by its arm64 slice.
837
+ * A file that is no Mach-O binary holds none.
838
+ */
839
+ var readMachOStrings = async (read, lengths) => {
840
+ const base = await sliceOf(read);
841
+ if (base === null) return [];
842
+ const header = await read(base, base + 32);
843
+ if (header.byteLength < 28) return [];
844
+ const data = view$1(header);
845
+ const magic = data.getUint32(0, true);
846
+ if (magic !== MH_MAGIC && magic !== MH_MAGIC_64) return [];
847
+ const is64 = magic === MH_MAGIC_64;
848
+ const headerSize = is64 ? 32 : 28;
849
+ const commandCount = data.getUint32(16, true);
850
+ const commandsSize = data.getUint32(20, true);
851
+ const commands = await read(base + headerSize, base + headerSize + commandsSize);
852
+ const cmds = view$1(commands);
853
+ let section = null;
854
+ for (let i = 0, at = 0; i < commandCount && at + 8 <= commands.byteLength && section === null; i += 1) {
855
+ const cmd = cmds.getUint32(at, true);
856
+ const cmdSize = cmds.getUint32(at + 4, true);
857
+ if (cmdSize < 8) break;
858
+ if ((cmd === LC_SEGMENT_64 || cmd === LC_SEGMENT) && nameAt(commands, at + 8) === "__TEXT") {
859
+ const sectionCount = cmds.getUint32(at + (is64 ? 64 : 48), true);
860
+ const first = at + (is64 ? 72 : 56);
861
+ const sectionSize = is64 ? 80 : 68;
862
+ for (let s = 0; s < sectionCount; s += 1) {
863
+ const sec = first + s * sectionSize;
864
+ if (sec + sectionSize > commands.byteLength) break;
865
+ if (nameAt(commands, sec) !== "__cstring") continue;
866
+ section = is64 ? {
867
+ size: Number(cmds.getBigUint64(sec + 40, true)),
868
+ offset: cmds.getUint32(sec + 48, true)
869
+ } : {
870
+ size: cmds.getUint32(sec + 36, true),
871
+ offset: cmds.getUint32(sec + 40, true)
872
+ };
873
+ break;
874
+ }
875
+ }
876
+ at += cmdSize;
877
+ }
878
+ if (section === null || section.size === 0) return [];
879
+ const cstrings = await read(base + section.offset, base + section.offset + section.size);
880
+ const strings = [];
881
+ for (let start = 0; start < cstrings.byteLength;) {
882
+ let end = cstrings.indexOf(0, start);
883
+ if (end === -1) end = cstrings.byteLength;
884
+ if (lengths.has(end - start)) {
885
+ const text = asciiOf(cstrings.subarray(start, end));
886
+ if (text !== null) strings.push(text);
887
+ }
888
+ start = end + 1;
889
+ }
890
+ return strings;
891
+ };
892
+ var EOCD_SIGNATURE = 101010256;
893
+ var ZIP64_EOCD_LOCATOR_SIGNATURE = 117853008;
894
+ var ZIP64_EOCD_SIGNATURE = 101075792;
895
+ var CENTRAL_HEADER_SIGNATURE = 33639248;
896
+ var LOCAL_HEADER_SIGNATURE = 67324752;
897
+ var ZIP64_EXTRA_ID = 1;
898
+ var UINT32_MAX = 4294967295;
899
+ /** The end-of-central-directory record and the longest comment after it. */
900
+ var EOCD_SEARCH_LENGTH = 65557;
901
+ /** How much compressed data one read takes. */
902
+ var READ_CHUNK = 1048576;
903
+ var MiB$2 = 1048576;
904
+ /**
905
+ * What an archive may hold before it is refused as no artifact: an upload is
906
+ * untrusted, so a crafted directory or entry (a zip bomb) stops here, not
907
+ * after filling memory.
908
+ */
909
+ var ZIP_LIMITS = {
910
+ directoryBytes: 64 * MiB$2,
911
+ entries: 5e5,
912
+ entryBytes: 1024 * MiB$2
913
+ };
914
+ var UNIX_HOST = 3;
915
+ var S_IFMT = 61440;
916
+ var S_IFLNK = 40960;
917
+ var view = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
918
+ var notZip = () => new NativeArtifactError("UNREADABLE", "The file is not a zip archive, as an .ipa, .aab or .apk is.");
919
+ var u64 = (data, offset) => Number(data.getBigUint64(offset, true));
920
+ /** The central directory's offset and size, from its end record (ZIP64 too). */
921
+ var centralDirectoryOf = async (source) => {
922
+ const start = Math.max(0, source.size - EOCD_SEARCH_LENGTH);
923
+ const tail = await source.read(start, source.size - start);
924
+ const data = view(tail);
925
+ for (let i = tail.length - 22; i >= 0; i -= 1) {
926
+ if (data.getUint32(i, true) !== EOCD_SIGNATURE) continue;
927
+ let size = data.getUint32(i + 12, true);
928
+ let offset = data.getUint32(i + 16, true);
929
+ if (offset === UINT32_MAX || size === UINT32_MAX) {
930
+ const locator = i - 20;
931
+ if (locator < 0 || data.getUint32(locator, true) !== ZIP64_EOCD_LOCATOR_SIGNATURE) throw notZip();
932
+ const record = view(await source.read(u64(data, locator + 8), 56));
933
+ if (record.byteLength < 56 || record.getUint32(0, true) !== ZIP64_EOCD_SIGNATURE) throw notZip();
934
+ size = u64(record, 40);
935
+ offset = u64(record, 48);
936
+ }
937
+ if (offset + size > source.size) throw notZip();
938
+ return {
939
+ offset,
940
+ size
941
+ };
942
+ }
943
+ throw notZip();
944
+ };
945
+ /** Every entry of a zip archive, reading only its central directory. */
946
+ var readZipDirectory = async (source) => {
947
+ const { offset, size } = await centralDirectoryOf(source);
948
+ if (size > ZIP_LIMITS.directoryBytes) throw new NativeArtifactError("UNREADABLE", "The archive's directory is larger than any artifact's.");
949
+ const directory = await source.read(offset, size);
950
+ const data = view(directory);
951
+ const decoder = new TextDecoder();
952
+ const entries = [];
953
+ for (let i = 0; i + 46 <= directory.length;) {
954
+ if (data.getUint32(i, true) !== CENTRAL_HEADER_SIGNATURE) break;
955
+ if (entries.length >= ZIP_LIMITS.entries) throw new NativeArtifactError("UNREADABLE", "The archive holds more entries than any artifact.");
956
+ const madeBy = data.getUint16(i + 4, true);
957
+ const externalAttributes = data.getUint32(i + 38, true);
958
+ const method = data.getUint16(i + 10, true);
959
+ let compressedSize = data.getUint32(i + 20, true);
960
+ let uncompressedSize = data.getUint32(i + 24, true);
961
+ const nameLength = data.getUint16(i + 28, true);
962
+ const extraLength = data.getUint16(i + 30, true);
963
+ const commentLength = data.getUint16(i + 32, true);
964
+ let localHeaderOffset = data.getUint32(i + 42, true);
965
+ const nameStart = i + 46;
966
+ const name = decoder.decode(directory.subarray(nameStart, nameStart + nameLength));
967
+ const extraStart = nameStart + nameLength;
968
+ for (let j = extraStart; j + 4 <= extraStart + extraLength;) {
969
+ const id = data.getUint16(j, true);
970
+ const length = data.getUint16(j + 2, true);
971
+ if (id === ZIP64_EXTRA_ID) {
972
+ let k = j + 4;
973
+ if (uncompressedSize === UINT32_MAX) {
974
+ uncompressedSize = u64(data, k);
975
+ k += 8;
976
+ }
977
+ if (compressedSize === UINT32_MAX) {
978
+ compressedSize = u64(data, k);
979
+ k += 8;
980
+ }
981
+ if (localHeaderOffset === UINT32_MAX) localHeaderOffset = u64(data, k);
982
+ }
983
+ j += 4 + length;
984
+ }
985
+ const segments = name.split("/");
986
+ entries.push({
987
+ name,
988
+ unsafe: name.startsWith("/") || /^[A-Za-z]:/u.test(name) || name.includes("\\") || name.includes("\0") || segments.includes(".."),
989
+ symlink: madeBy >> 8 === UNIX_HOST && (externalAttributes >>> 16 & S_IFMT) === S_IFLNK,
990
+ method,
991
+ compressedSize,
992
+ uncompressedSize,
993
+ localHeaderOffset
994
+ });
995
+ i = extraStart + extraLength + commentLength;
996
+ }
997
+ return entries;
998
+ };
999
+ /**
1000
+ * The one entry an artifact's reader takes by `name`: a symbolic link, or a
1001
+ * name the archive holds twice, which could hand the reader other bytes
1002
+ * than an installer reads, is refused. Unsafe names match nothing.
1003
+ */
1004
+ var findZipEntry = (entries, match) => {
1005
+ const test = typeof match === "string" ? (name) => name === match : match;
1006
+ const found = entries.filter(({ name, unsafe }) => !unsafe && test(name));
1007
+ for (const entry of found) assertReadable(entry);
1008
+ if (typeof match === "string" && found.length > 1) throw new NativeArtifactError("UNREADABLE", `The archive holds ${match} more than once.`);
1009
+ return found[0];
1010
+ };
1011
+ /** Every safe entry `match` takes, each a file the reader may read. */
1012
+ var filterZipEntries = (entries, match) => {
1013
+ const found = entries.filter(({ name, unsafe }) => !unsafe && match(name));
1014
+ for (const entry of found) assertReadable(entry);
1015
+ return found;
1016
+ };
1017
+ var assertReadable = (entry) => {
1018
+ if (entry.symlink) throw new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} is a symbolic link, not a file.`);
1019
+ };
1020
+ var tooLarge = (entry, limit) => new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} is larger than ${Math.round(limit / MiB$2)} MB, more than any artifact's.`);
1021
+ /** Where an entry's data starts, past its local header. */
1022
+ var dataOffsetOf = async (source, entry) => {
1023
+ const local = view(await source.read(entry.localHeaderOffset, 30));
1024
+ if (local.byteLength < 30 || local.getUint32(0, true) !== LOCAL_HEADER_SIGNATURE) throw new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} is corrupt.`);
1025
+ return entry.localHeaderOffset + 30 + local.getUint16(26, true) + local.getUint16(28, true);
1026
+ };
1027
+ /**
1028
+ * An entry's uncompressed bytes as a stream, read from the source a chunk at
1029
+ * a time, so a large entry is never held whole.
1030
+ */
1031
+ var openZipEntry = async (source, entry, { maxBytes = ZIP_LIMITS.entryBytes } = {}) => {
1032
+ assertReadable(entry);
1033
+ if (entry.unsafe) throw new NativeArtifactError("UNREADABLE", `The archive's entry ${JSON.stringify(entry.name)} has a name no artifact holds.`);
1034
+ if (entry.uncompressedSize > maxBytes) throw tooLarge(entry, maxBytes);
1035
+ if (entry.method !== 0 && entry.method !== 8) throw new NativeArtifactError("UNREADABLE", `The archive stores ${entry.name} with an unsupported compression method (${entry.method}).`);
1036
+ const start = await dataOffsetOf(source, entry);
1037
+ const end = start + entry.compressedSize;
1038
+ let position = start;
1039
+ const compressed = new ReadableStream({ async pull(controller) {
1040
+ if (position >= end) {
1041
+ controller.close();
1042
+ return;
1043
+ }
1044
+ const chunk = await source.read(position, Math.min(READ_CHUNK, end - position));
1045
+ if (chunk.byteLength === 0) {
1046
+ controller.error(new NativeArtifactError("UNREADABLE", `The archive ends inside ${entry.name}.`));
1047
+ return;
1048
+ }
1049
+ position += chunk.byteLength;
1050
+ controller.enqueue(chunk);
1051
+ } });
1052
+ const inflated = entry.method === 0 ? compressed : compressed.pipeThrough(new DecompressionStream("deflate-raw"));
1053
+ const limit = Math.min(entry.uncompressedSize, maxBytes);
1054
+ let produced = 0;
1055
+ return inflated.pipeThrough(new TransformStream({ transform(chunk, controller) {
1056
+ produced += chunk.byteLength;
1057
+ if (produced > limit) {
1058
+ controller.error(new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} inflates past the size it declares.`));
1059
+ return;
1060
+ }
1061
+ controller.enqueue(chunk);
1062
+ } }));
1063
+ };
1064
+ /**
1065
+ * The uncompressed bytes in `[start, end)` of an entry, which stops
1066
+ * inflating once it has them: a Mach-O header without the rest of the
1067
+ * binary.
1068
+ */
1069
+ var readZipEntryRange = async (source, entry, start, end, budget) => {
1070
+ const length = Math.max(0, Math.min(end, entry.uncompressedSize) - start);
1071
+ if (budget !== void 0 && start + length > budget.remaining) throw new NativeArtifactError("UNREADABLE", "The artifact inflates to more than any artifact's.");
1072
+ const out = new Uint8Array(length);
1073
+ if (length === 0) return out;
1074
+ const reader = (await openZipEntry(source, entry)).getReader();
1075
+ let position = 0;
1076
+ let written = 0;
1077
+ try {
1078
+ while (written < length) {
1079
+ if (budget !== void 0 && Date.now() > budget.deadline) throw new NativeArtifactError("UNREADABLE", "Reading the artifact took too long.");
1080
+ const { done, value } = await reader.read();
1081
+ if (done) break;
1082
+ if (budget !== void 0) budget.remaining -= value.byteLength;
1083
+ const from = Math.max(start - position, 0);
1084
+ const to = Math.min(start + length - position, value.byteLength);
1085
+ if (from < to) {
1086
+ out.set(value.subarray(from, to), position + from - start);
1087
+ written += to - from;
1088
+ }
1089
+ position += value.byteLength;
1090
+ }
1091
+ } catch (error) {
1092
+ throw error instanceof NativeArtifactError ? error : new NativeArtifactError("UNREADABLE", `The archive's ${entry.name} can't be decompressed: ${error instanceof Error ? error.message : String(error)}.`);
1093
+ } finally {
1094
+ await reader.cancel().catch(() => {});
1095
+ }
1096
+ return written === length ? out : out.subarray(0, written);
1097
+ };
1098
+ /** An entry's uncompressed bytes, refused past `maxBytes`. */
1099
+ var readZipEntry = (source, entry, maxBytes, budget) => {
1100
+ if (entry.uncompressedSize > maxBytes) throw tooLarge(entry, maxBytes);
1101
+ return readZipEntryRange(source, entry, 0, entry.uncompressedSize, budget);
1102
+ };
1103
+ var MiB$1 = 1048576;
1104
+ /** The most a manifest or an Info.plist holds. */
1105
+ var METADATA_BYTES$1 = 16 * MiB$1;
1106
+ /** The most one dex file holds. */
1107
+ var DEX_BYTES = 256 * MiB$1;
1108
+ /** The most reading one artifact inflates, across every entry it reads. */
1109
+ var READ_BUDGET_BYTES$1 = 2048 * MiB$1;
1110
+ /** How long reading one artifact may take. */
1111
+ var DEFAULT_TIMEOUT_MS = 12e4;
1112
+ /** Where each kind of artifact packs its built-in bundle. */
1113
+ var builtInBundlePathOf = (kind, appDirectory = kind === "app" ? "<App>.app/" : "Payload/<App>.app/") => kind === "aab" ? "base/assets/index.android.bundle" : kind === "apk" ? "assets/index.android.bundle" : `${appDirectory}main.jsbundle`;
1114
+ /** The kind of artifact a file name names, or null. */
1115
+ var nativeArtifactKindOf = (fileName) => {
1116
+ if (/\.app\.zip$/iu.test(fileName)) return "app";
1117
+ const extension = /\.([^./\\]+)$/u.exec(fileName)?.[1]?.toLowerCase();
1118
+ return extension === "ipa" || extension === "aab" || extension === "apk" ? extension : null;
1119
+ };
1120
+ var UUID_LENGTH = 36;
1121
+ var SHA256_HEX = /^[0-9a-f]{64}$/u;
1122
+ var LENGTHS = /* @__PURE__ */ new Set([
1123
+ UUID_LENGTH,
1124
+ 64,
1125
+ 32
1126
+ ]);
1127
+ var unique = (values) => [...new Set(values)].sort();
1128
+ var candidatesOf = (strings) => {
1129
+ const all = [...strings];
1130
+ return {
1131
+ minBundleIds: unique(all.filter(isUUIDv7)),
1132
+ fingerprints: unique(all.filter((value) => SHA256_HEX.test(value)))
1133
+ };
1134
+ };
1135
+ var literalOf = (value, what) => {
1136
+ if (value === null || value === void 0) return null;
1137
+ if (value.type === "string") return value.value;
1138
+ if (value.type === "int") return String(value.value);
1139
+ return { unreadable: value.type === "reference" ? `${what} is a resource reference (${value.name ?? `@0x${value.id.toString(16)}`}), not a literal` : `${what} is not a string` };
1140
+ };
1141
+ /**
1142
+ * The channel an Android app reports from its `com.hotupdater.CHANNEL`
1143
+ * meta-data, as the SDK reads it (`NativeConfigUtils`): the value as a
1144
+ * string, and none when it is empty, which the SDK reports as `production`.
1145
+ */
1146
+ var androidChannelOf = (value) => {
1147
+ if (value === void 0) return null;
1148
+ if (value.type === "boolean") return String(value.value);
1149
+ const channel = literalOf(value, "The com.hotupdater.CHANNEL meta-data");
1150
+ return channel === "" ? null : channel;
1151
+ };
1152
+ var readAndroid = async (source, kind, entries, budget) => {
1153
+ const manifestEntry = findZipEntry(entries, kind === "aab" ? "base/manifest/AndroidManifest.xml" : "AndroidManifest.xml");
1154
+ if (manifestEntry === void 0) throw new NativeArtifactError("UNREADABLE", `The ${kind === "aab" ? ".aab has no base/manifest/AndroidManifest.xml" : ".apk has no AndroidManifest.xml"}.`);
1155
+ const manifestBytes = await readZipEntry(source, manifestEntry, METADATA_BYTES$1, budget);
1156
+ const manifest = readAndroidManifest(kind === "aab" ? parseProtoManifest(manifestBytes) : parseBinaryManifest(manifestBytes));
1157
+ const strings = [];
1158
+ const dexes = filterZipEntries(entries, (name) => kind === "aab" ? /^base\/dex\/classes\d*\.dex$/u.test(name) : /^classes\d*\.dex$/u.test(name));
1159
+ for (const entry of dexes) strings.push(...readDexStrings(await readZipEntry(source, entry, DEX_BYTES, budget), LENGTHS));
1160
+ const { minBundleIds, fingerprints } = candidatesOf(strings);
1161
+ const bundle = findZipEntry(entries, builtInBundlePathOf(kind));
1162
+ return {
1163
+ platform: "android",
1164
+ kind,
1165
+ appId: manifest.packageName,
1166
+ appVersion: literalOf(manifest.versionName, "versionName"),
1167
+ buildNumber: manifest.versionCode === null ? null : String(manifest.versionCode),
1168
+ channel: androidChannelOf(manifest.metaData.get("com.hotupdater.CHANNEL")),
1169
+ minBundleIdCandidates: minBundleIds,
1170
+ fingerprintCandidates: fingerprints,
1171
+ sandbox: {
1172
+ code: strings.includes(SANDBOX_CODE_MARKER),
1173
+ declared: manifest.metaData.has(SANDBOX_META_DATA)
1174
+ },
1175
+ entry: {
1176
+ launchers: manifest.launchers,
1177
+ sandboxUrlScheme: androidSandboxUrlScheme(manifest)
1178
+ },
1179
+ builtInBundle: bundle === void 0 ? null : {
1180
+ path: bundle.name,
1181
+ byteSize: bundle.uncompressedSize
1182
+ }
1183
+ };
1184
+ };
1185
+ /**
1186
+ * The URL scheme an Android sandbox build registers, or null: the one its
1187
+ * activity's `SANDBOX_URL_SCHEME_META_DATA` names, when the activity's `VIEW`
1188
+ * filters take it too. An artifact built before the meta-data takes the one
1189
+ * with the derived scheme's prefix.
1190
+ */
1191
+ var androidSandboxUrlScheme = (manifest) => {
1192
+ const schemes = manifest.urlSchemes.get("com.hotupdater.HotUpdaterSandboxActivity") ?? [];
1193
+ const declared = manifest.componentMetaData.get(SANDBOX_ACTIVITY)?.get(SANDBOX_URL_SCHEME_META_DATA);
1194
+ if (declared === void 0) return schemes.find(isSandboxUrlScheme) ?? null;
1195
+ if (declared.type !== "string") return null;
1196
+ return schemes.includes(declared.value) ? declared.value : null;
1197
+ };
1198
+ /**
1199
+ * The sandbox URL scheme of an Info.plist, or null: the one
1200
+ * `SANDBOX_URL_SCHEME_INFO_PLIST_KEY` records, by `recordedSandboxUrlScheme`'s
1201
+ * rule. A prerelease's artifact, with no key, gives its named URL type's one
1202
+ * scheme, or, with no named type, one with the derived scheme's prefix.
1203
+ */
1204
+ var sandboxUrlSchemeIn = (info) => {
1205
+ const types = info["CFBundleURLTypes"];
1206
+ if (!Array.isArray(types)) return null;
1207
+ const schemesOf = (type) => {
1208
+ const schemes = type?.CFBundleURLSchemes;
1209
+ return Array.isArray(schemes) ? schemes.filter((scheme) => typeof scheme === "string") : [];
1210
+ };
1211
+ const named = types.filter((type) => type?.CFBundleURLName === SANDBOX_URL_TYPE_NAME);
1212
+ const recorded = recordedSandboxUrlScheme("HOT_UPDATER_SANDBOX_URL_SCHEME" in info ? info[SANDBOX_URL_SCHEME_INFO_PLIST_KEY] : void 0, named);
1213
+ if (recorded !== void 0) return recorded;
1214
+ if (named.length > 1) return null;
1215
+ if (named.length === 1) {
1216
+ const schemes = schemesOf(named[0]);
1217
+ return schemes.length === 1 ? schemes[0] : null;
1218
+ }
1219
+ return types.flatMap(schemesOf).find(isSandboxUrlScheme) ?? null;
1220
+ };
1221
+ var stringValue = (value) => typeof value === "string" && value !== "" ? value : null;
1222
+ var readIos = async (source, kind, entries, budget) => {
1223
+ const infoPlist = kind === "ipa" ? /^Payload\/[^/]+\.app\/Info\.plist$/u : /^[^/]+\.app\/Info\.plist$/u;
1224
+ const plistEntry = findZipEntry(entries, (name) => infoPlist.test(name));
1225
+ if (plistEntry === void 0) throw new NativeArtifactError("UNREADABLE", kind === "ipa" ? "The .ipa has no Payload/<App>.app/Info.plist." : "The .app.zip has no <App>.app/Info.plist at its root.");
1226
+ const appDirectory = plistEntry.name.slice(0, -10);
1227
+ const plist = parsePlist(await readZipEntry(source, plistEntry, METADATA_BYTES$1, budget));
1228
+ if (plist === null || typeof plist !== "object" || Array.isArray(plist)) throw new NativeArtifactError("UNREADABLE", "The app's Info.plist is not a dictionary.");
1229
+ const info = plist;
1230
+ const machO = (entry) => readMachOStrings((start, end) => readZipEntryRange(source, entry, start, end, budget), LENGTHS);
1231
+ const frameworks = filterZipEntries(entries, (name) => {
1232
+ const match = new RegExp(`^${appDirectory.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}Frameworks/([^/]+)\\.framework/([^/]+)$`, "u").exec(name);
1233
+ return match !== null && match[1] === match[2];
1234
+ });
1235
+ const sdk = frameworks.find(({ name }) => name.endsWith("/HotUpdater"));
1236
+ const executable = stringValue(info["CFBundleExecutable"]);
1237
+ const executableEntry = executable === null ? void 0 : findZipEntry(entries, `${appDirectory}${executable}`);
1238
+ let strings = sdk === void 0 ? [] : await machO(sdk);
1239
+ if (!strings.some(isUUIDv7) && executableEntry !== void 0) strings = await machO(executableEntry);
1240
+ if (!strings.some(isUUIDv7)) {
1241
+ for (const framework of frameworks) if (framework !== sdk) strings.push(...await machO(framework));
1242
+ }
1243
+ const { minBundleIds, fingerprints } = candidatesOf(strings);
1244
+ const bundle = findZipEntry(entries, builtInBundlePathOf(kind, appDirectory));
1245
+ const channel = info["HOT_UPDATER_CHANNEL"];
1246
+ return {
1247
+ platform: "ios",
1248
+ kind,
1249
+ appId: stringValue(info["CFBundleIdentifier"]),
1250
+ appVersion: stringValue(info["CFBundleShortVersionString"]),
1251
+ buildNumber: stringValue(info["CFBundleVersion"]),
1252
+ channel: channel === void 0 || channel === "" ? null : typeof channel === "string" ? channel : { unreadable: "HOT_UPDATER_CHANNEL is not a string" },
1253
+ minBundleIdCandidates: minBundleIds,
1254
+ fingerprintCandidates: fingerprints,
1255
+ sandbox: {
1256
+ code: strings.includes(SANDBOX_CODE_MARKER),
1257
+ declared: info[SANDBOX_INFO_PLIST_KEY] !== void 0
1258
+ },
1259
+ entry: {
1260
+ launchers: [],
1261
+ sandboxUrlScheme: sandboxUrlSchemeIn(info)
1262
+ },
1263
+ builtInBundle: bundle === void 0 ? null : {
1264
+ path: bundle.name,
1265
+ byteSize: bundle.uncompressedSize
1266
+ }
1267
+ };
1268
+ };
1269
+ /**
1270
+ * Reads a store artifact (`.ipa`, `.aab` or `.apk`) by its file name's
1271
+ * extension: what its app reports at runtime, and its built-in bundle. It
1272
+ * reads the archive's directory, the manifest or Info.plist, and the app's
1273
+ * code, but not the built-in bundle, so a large artifact is never held
1274
+ * whole. Whether the result can be imported is `checkNativeArtifact`'s.
1275
+ */
1276
+ var readNativeArtifact = async (source, fileName, { timeoutMs = DEFAULT_TIMEOUT_MS } = {}) => {
1277
+ const kind = nativeArtifactKindOf(fileName);
1278
+ if (kind === null) throw new NativeArtifactError("UNSUPPORTED_FILE", `${fileName} is not an .ipa, .aab, .apk or a simulator .app. Import the artifact of a release build.`);
1279
+ const budget = {
1280
+ remaining: READ_BUDGET_BYTES$1,
1281
+ deadline: Date.now() + timeoutMs
1282
+ };
1283
+ const timed = {
1284
+ size: source.size,
1285
+ read(offset, length) {
1286
+ if (Date.now() > budget.deadline) return Promise.reject(new NativeArtifactError("UNREADABLE", "Reading the artifact took too long."));
1287
+ return source.read(offset, length);
1288
+ }
1289
+ };
1290
+ try {
1291
+ const entries = await readZipDirectory(timed);
1292
+ return await (kind === "ipa" || kind === "app" ? readIos(timed, kind, entries, budget) : readAndroid(timed, kind, entries, budget));
1293
+ } catch (error) {
1294
+ if (error instanceof NativeArtifactError) throw error;
1295
+ throw new NativeArtifactError("UNREADABLE", `The artifact is malformed: ${error instanceof Error ? error.message : String(error)}.`);
1296
+ }
1297
+ };
1298
+ /** The channel an app without a default channel reports. */
1299
+ var DEFAULT_CHANNEL = "production";
1300
+ /**
1301
+ * Why an artifact can't register on `channel`: the sandbox layer must be whole
1302
+ * or absent, and only a sandbox build registers on a `sandbox-*` channel.
1303
+ */
1304
+ var sandboxArtifactProblem = ({ kind, platform, sandbox, entry }, channel) => {
1305
+ const declaration = platform === "ios" ? "Info.plist key" : "manifest meta-data";
1306
+ if (sandbox.code !== sandbox.declared) return {
1307
+ code: "SANDBOX_MISMATCH",
1308
+ message: sandbox.code ? `The .${kind} has the sandbox layer's code, but no sandbox ${declaration}.\nBuild it again with hot-updater native-build.` : `The .${kind} has a sandbox ${declaration}, but not the sandbox layer's code.\nBuild it again with hot-updater native-build.`
1309
+ };
1310
+ if (sandbox.code && entry.sandboxUrlScheme === null) return {
1311
+ code: "SANDBOX_MISMATCH",
1312
+ message: `The .${kind} is a sandbox build with no sandbox URL scheme, so no link can open it.\nBuild it again with hot-updater native-build.`
1313
+ };
1314
+ if (sandbox.code && platform === "android" && (entry.launchers.length !== 1 || entry.launchers[0] !== "com.hotupdater.HotUpdaterSandboxActivity")) return {
1315
+ code: "SANDBOX_MISMATCH",
1316
+ message: `The .${kind} is a sandbox build, but its launcher is ${entry.launchers.join(", ") || "missing"}.\nBuild it again with hot-updater native-build.`
1317
+ };
1318
+ if (sandbox.code && !isSandboxChannel(channel)) return {
1319
+ code: "SANDBOX_MISMATCH",
1320
+ message: `The .${kind} is a sandbox build, which can't register on channel ${channel}.\nUse a sandbox-<scheme> channel.`
1321
+ };
1322
+ if (!sandbox.code && isSandboxChannel(channel)) return {
1323
+ code: "SANDBOX_MISMATCH",
1324
+ message: `Channel ${channel} is reserved for sandbox builds, and the .${kind} isn't one.\nUse another channel, or build it with sandbox: true.`
1325
+ };
1326
+ return null;
1327
+ };
1328
+ var isUnreadable = (value) => typeof value === "object" && value !== null && "unreadable" in value;
1329
+ /**
1330
+ * Whether a read artifact can be imported as a native build, whose built-in
1331
+ * bundle OTAs patch from, and what it registers as. It refuses an artifact
1332
+ * that ships no built-in bundle, such as a debug build, which loads its
1333
+ * JavaScript from Metro, one built without the native SDK's build step (no MIN_BUNDLE_ID), and
1334
+ * one the project's update strategy can't place: no fingerprint under the
1335
+ * fingerprint strategy, or no app version a device compares under the
1336
+ * appVersion strategy. With `appIds`, the identifiers the project's
1337
+ * `nativeBuild` schemes name, it warns about an artifact of another app.
1338
+ */
1339
+ var checkNativeArtifact = (info, { updateStrategy, appIds = [], channel: channelOverride }) => {
1340
+ const problems = [];
1341
+ const warnings = [];
1342
+ const refuse = (code, message) => problems.push({
1343
+ code,
1344
+ message
1345
+ });
1346
+ if (info.builtInBundle === null) refuse("NO_BUILT_IN_BUNDLE", `The .${info.kind} has no ${builtInBundlePathOf(info.kind)}, so it ships no built-in bundle to patch from. A debug build loads its JavaScript from Metro, and a release build packs it there unless the project renames its bundle. Import a release build.`);
1347
+ const [minBundleId, ...otherMinBundleIds] = info.minBundleIdCandidates;
1348
+ if (minBundleId === void 0) refuse("NO_MIN_BUNDLE_ID", "The app's code holds no MIN_BUNDLE_ID: it was built without @hot-updater/react-native, or with a version of it that doesn't compile MIN_BUNDLE_ID in. Rebuild it with the @hot-updater/react-native this project uses.");
1349
+ else if (otherMinBundleIds.length > 0) refuse("AMBIGUOUS_MIN_BUNDLE_ID", `The app's code holds several UUIDv7 strings (${info.minBundleIdCandidates.join(", ")}), so which is MIN_BUNDLE_ID can't be told.`);
1350
+ let fingerprintHash = null;
1351
+ let appVersion = null;
1352
+ if (updateStrategy === "fingerprint") {
1353
+ const [fingerprint, ...others] = info.fingerprintCandidates;
1354
+ if (fingerprint === void 0) refuse("NO_FINGERPRINT", "The app's code holds no fingerprint, but hot-updater.config.ts updates by fingerprint: it was built without fingerprint.json, or with a @hot-updater/react-native that doesn't compile the fingerprint in, so its app can't check for fingerprint updates.");
1355
+ else if (others.length > 0) refuse("AMBIGUOUS_FINGERPRINT", `The app's code holds several SHA-256 strings (${info.fingerprintCandidates.join(", ")}), so which is its fingerprint can't be told.`);
1356
+ else fingerprintHash = fingerprint;
1357
+ } else if (info.appVersion === null) refuse("NO_APP_VERSION", `The app has no ${info.platform === "ios" ? "CFBundleShortVersionString" : "versionName"}, which the appVersion strategy updates by.`);
1358
+ else if (isUnreadable(info.appVersion)) refuse("NO_APP_VERSION", `The app's ${info.appVersion.unreadable}.`);
1359
+ else if (canonicalizeAppVersion(info.appVersion) === null) refuse("INVALID_SCOPE", `The app version ${info.appVersion} holds no version a device compares, such as 1.4.0, so no appVersion update targets it.`);
1360
+ else appVersion = info.appVersion;
1361
+ let channel = DEFAULT_CHANNEL;
1362
+ if (channelOverride !== void 0) {
1363
+ channel = channelOverride;
1364
+ try {
1365
+ encodeChannelKey(channel);
1366
+ } catch (error) {
1367
+ refuse("INVALID_SCOPE", `The channel ${JSON.stringify(channel)} is no channel a release can target: ${error instanceof Error ? error.message : String(error)}.`);
1368
+ }
1369
+ } else if (isUnreadable(info.channel)) refuse("INVALID_SCOPE", `${info.channel.unreadable}, so the channel its app reports can't be read: name it with --channel.`);
1370
+ else if (info.channel !== null) {
1371
+ channel = info.channel;
1372
+ try {
1373
+ encodeChannelKey(channel);
1374
+ } catch (error) {
1375
+ refuse("INVALID_SCOPE", `The app's channel ${JSON.stringify(channel)} is no channel a release can target: ${error instanceof Error ? error.message : String(error)}.`);
1376
+ }
1377
+ }
1378
+ const sandboxProblem = sandboxArtifactProblem(info, channel);
1379
+ if (sandboxProblem !== null) problems.push(sandboxProblem);
1380
+ if (appIds.length > 0 && info.appId !== null && !appIds.includes(info.appId)) warnings.push({
1381
+ code: "APP_ID_MISMATCH",
1382
+ message: `The app is ${info.appId}, which no ${info.platform} scheme in nativeBuild names (${appIds.join(", ")}): check that it is this project's build.`
1383
+ });
1384
+ if (problems.length > 0 || minBundleId === void 0) return {
1385
+ ok: false,
1386
+ problems,
1387
+ warnings
1388
+ };
1389
+ return {
1390
+ ok: true,
1391
+ warnings,
1392
+ build: {
1393
+ platform: info.platform,
1394
+ kind: info.kind,
1395
+ appId: info.appId,
1396
+ buildNumber: info.buildNumber,
1397
+ minBundleId,
1398
+ channel,
1399
+ fingerprintHash,
1400
+ appVersion,
1401
+ nativeAppVersion: typeof info.appVersion === "string" && info.appVersion.trim() ? info.appVersion : null,
1402
+ builtInBundlePath: info.builtInBundle.path,
1403
+ sandbox: info.sandbox.code,
1404
+ sandboxUrlScheme: info.sandbox.code ? info.entry.sandboxUrlScheme : null
1405
+ }
1406
+ };
1407
+ };
1408
+ /**
1409
+ * The refusal of an artifact whose built-in bundle is already registered:
1410
+ * the registry takes a MIN_BUNDLE_ID once.
1411
+ */
1412
+ var alreadyImportedProblem = (minBundleId, nativeBuildId) => ({
1413
+ code: "ALREADY_IMPORTED",
1414
+ ...nativeBuildId === null ? {} : { nativeBuildId },
1415
+ message: nativeBuildId === null ? `The built-in bundle ${minBundleId} is already registered, as a bundle that is no native build's.` : `This build is already registered as native build ${nativeBuildId} (built-in bundle ${minBundleId}).`
1416
+ });
1417
+ var MiB = 1048576;
1418
+ /** The most an app's Info.plist or a provisioning profile holds here. */
1419
+ var METADATA_BYTES = 1 * MiB;
1420
+ /** The most reading what an install needs inflates, across every entry. */
1421
+ var READ_BUDGET_BYTES = 8 * MiB;
1422
+ /** How long reading what an install needs may take. */
1423
+ var READ_TIMEOUT_MS = 3e4;
1424
+ /** The extensions an app may carry, each with a profile to read. */
1425
+ var MAX_NESTED_PROFILES = 16;
1426
+ var APP_INFO_PLIST = /^Payload\/[^/]+\.app\/Info\.plist$/u;
1427
+ /**
1428
+ * What installs with the app and must list the device too: not a Watch app's
1429
+ * profile, which lists watches and installs on one.
1430
+ */
1431
+ var NESTED_PROFILE = /^Payload\/[^/]+\.app\/(?:PlugIns|Extensions|AppClips)\/[^/]+\.(?:appex|app)\/embedded\.mobileprovision$/u;
1432
+ /** A device's UDID: 40 hex digits, or 8 and 16 joined by a hyphen. */
1433
+ var UDID = /^(?:[0-9a-f]{40}|[0-9a-f]{8}-[0-9a-f]{16})$/iu;
1434
+ /**
1435
+ * The form two UDIDs compare in, or null for text that isn't one. Apple writes
1436
+ * them in either case, and App Store Connect takes the device's own.
1437
+ */
1438
+ var normalizeIosUdid = (value) => {
1439
+ const trimmed = value.trim();
1440
+ return UDID.test(trimmed) ? trimmed.toLowerCase() : null;
1441
+ };
1442
+ /**
1443
+ * The bytes from `<?xml` through `</plist>`, or null without both: a CMS
1444
+ * message, as a provisioning profile and a Profile Service answer are, holds
1445
+ * its plist as plain text among binary bytes.
1446
+ */
1447
+ var sliceEmbeddedPlist = (bytes) => {
1448
+ const text = new TextDecoder("latin1").decode(bytes);
1449
+ const start = text.indexOf("<?xml");
1450
+ if (start === -1) return null;
1451
+ const end = text.indexOf("</plist>", start);
1452
+ return end === -1 ? null : bytes.subarray(start, end + 8);
1453
+ };
1454
+ /**
1455
+ * The UDID in a Profile Service answer's body, or null when it has no one
1456
+ * well-formed UDID. It only finds the text: nothing here verifies the signature
1457
+ * around it, so nothing automated may trust the result.
1458
+ */
1459
+ var readProfileServiceUdid = (body) => {
1460
+ const plist = sliceEmbeddedPlist(body);
1461
+ if (plist === null) return null;
1462
+ const matches = [...new TextDecoder().decode(plist).matchAll(/<key>\s*UDID\s*<\/key>\s*<string>([^<]*)<\/string>/gu)];
1463
+ if (matches.length !== 1) return null;
1464
+ const udid = matches[0][1].trim();
1465
+ return normalizeIosUdid(udid) === null ? null : udid;
1466
+ };
1467
+ var unreadable = (message) => new NativeArtifactError("UNREADABLE", message);
1468
+ var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Uint8Array);
1469
+ var readProfile = (bytes, name) => {
1470
+ const plistBytes = sliceEmbeddedPlist(bytes);
1471
+ if (plistBytes === null) throw unreadable(`The archive's ${name} holds no property list.`);
1472
+ const plist = parsePlist(plistBytes);
1473
+ if (!isDict(plist)) throw unreadable(`The archive's ${name} is corrupt.`);
1474
+ const listed = plist["ProvisionedDevices"];
1475
+ if (listed !== void 0 && !Array.isArray(listed)) throw unreadable(`The archive's ${name} is corrupt.`);
1476
+ const devices = listed?.map((device) => {
1477
+ if (typeof device !== "string") throw unreadable(`The archive's ${name} is corrupt.`);
1478
+ return device.trim().toLowerCase();
1479
+ });
1480
+ const expiration = plist["ExpirationDate"];
1481
+ const expiresAtMs = typeof expiration === "string" ? Date.parse(expiration) : null;
1482
+ if (expiresAtMs !== null && Number.isNaN(expiresAtMs)) throw unreadable(`The archive's ${name} is corrupt.`);
1483
+ const entitlements = plist["Entitlements"];
1484
+ const applicationId = isDict(entitlements) ? entitlements["application-identifier"] : void 0;
1485
+ const bundleId = typeof applicationId === "string" ? applicationId.slice(applicationId.indexOf(".") + 1) : null;
1486
+ const teams = plist["TeamIdentifier"];
1487
+ const team = Array.isArray(teams) ? teams[0] : void 0;
1488
+ const uuid = plist["UUID"];
1489
+ return {
1490
+ allDevices: plist["ProvisionsAllDevices"] === true,
1491
+ devices: devices === void 0 ? null : new Set(devices),
1492
+ getTaskAllow: isDict(entitlements) && entitlements["get-task-allow"] === true,
1493
+ expiresAtMs,
1494
+ bundleId: bundleId === null || bundleId.includes("*") ? null : bundleId,
1495
+ applicationIdentifier: typeof applicationId === "string" ? applicationId : null,
1496
+ teamId: typeof team === "string" && team !== "" ? team : null,
1497
+ xcodeManaged: plist["IsXcodeManaged"] === true,
1498
+ uuid: typeof uuid === "string" && uuid !== "" ? uuid : null
1499
+ };
1500
+ };
1501
+ var distributionOf = (profile) => {
1502
+ if (profile === null) return "store";
1503
+ if (profile.allDevices) return "enterprise";
1504
+ if (profile.devices === null) return "store";
1505
+ return profile.getTaskAllow ? "development" : "ad-hoc";
1506
+ };
1507
+ /**
1508
+ * What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
1509
+ * around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
1510
+ * no signature. Throws `NativeArtifactError` for one it can't read.
1511
+ */
1512
+ var readProvisioningProfile = (bytes) => {
1513
+ const profile = readProfile(bytes, "provisioning profile");
1514
+ return {
1515
+ uuid: profile.uuid,
1516
+ distribution: distributionOf(profile),
1517
+ teamId: profile.teamId,
1518
+ applicationIdentifier: profile.applicationIdentifier,
1519
+ xcodeManaged: profile.xcodeManaged,
1520
+ devices: [...profile.devices ?? []].sort(),
1521
+ expiresAtMs: profile.expiresAtMs
1522
+ };
1523
+ };
1524
+ /**
1525
+ * What an `.ipa` installs as, reading only its directory, its app's Info.plist
1526
+ * and its provisioning profiles: a few requests of a remote file, whatever its
1527
+ * size. The `.ipa` is untrusted, and each part is bounded before it is read.
1528
+ * Throws `NativeArtifactError` for one it can't read.
1529
+ */
1530
+ var readIpaInstallInfo = async (source) => {
1531
+ const entries = await readZipDirectory(source);
1532
+ const infoPlists = filterZipEntries(entries, (name) => APP_INFO_PLIST.test(name));
1533
+ const infoEntry = infoPlists[0];
1534
+ if (infoEntry === void 0 || infoPlists.length > 1) throw unreadable("The .ipa has no one Payload/<App>.app/Info.plist.");
1535
+ const budget = {
1536
+ remaining: READ_BUDGET_BYTES,
1537
+ deadline: Date.now() + READ_TIMEOUT_MS
1538
+ };
1539
+ const read = (entry) => readZipEntry(source, entry, METADATA_BYTES, budget);
1540
+ const info = parsePlist(await read(infoEntry));
1541
+ if (!isDict(info)) throw unreadable("The app's Info.plist is corrupt.");
1542
+ const bundleId = info["CFBundleIdentifier"];
1543
+ const bundleVersion = info["CFBundleVersion"];
1544
+ if (typeof bundleId !== "string" || bundleId === "") throw unreadable("The app's Info.plist has no CFBundleIdentifier.");
1545
+ if (typeof bundleVersion !== "string" || bundleVersion === "") throw unreadable("The app's Info.plist has no CFBundleVersion.");
1546
+ const displayName = info["CFBundleDisplayName"];
1547
+ const bundleName = info["CFBundleName"];
1548
+ const title = typeof displayName === "string" && displayName !== "" ? displayName : typeof bundleName === "string" && bundleName !== "" ? bundleName : bundleId;
1549
+ const appDirectory = infoEntry.name.slice(0, -10);
1550
+ const profileEntry = findZipEntry(entries, `${appDirectory}embedded.mobileprovision`);
1551
+ const nestedEntries = filterZipEntries(entries, (name) => name.startsWith(appDirectory) && NESTED_PROFILE.test(name));
1552
+ if (nestedEntries.length > MAX_NESTED_PROFILES) throw unreadable(`The app has more than ${MAX_NESTED_PROFILES} extensions with profiles.`);
1553
+ const profile = profileEntry === void 0 ? null : readProfile(await read(profileEntry), profileEntry.name);
1554
+ const nested = [];
1555
+ for (const entry of nestedEntries) nested.push(readProfile(await read(entry), entry.name));
1556
+ const distribution = distributionOf(profile);
1557
+ const profiles = profile === null ? nested : [profile, ...nested];
1558
+ const listDevices = distribution === "ad-hoc" || distribution === "development";
1559
+ const lists = profiles.flatMap(({ allDevices, devices }) => allDevices ? [] : [devices ?? /* @__PURE__ */ new Set()]);
1560
+ const expiries = profiles.flatMap(({ expiresAtMs }) => expiresAtMs === null ? [] : [expiresAtMs]);
1561
+ return {
1562
+ bundleId,
1563
+ bundleVersion,
1564
+ title,
1565
+ distribution,
1566
+ devices: listDevices ? [...lists[0] ?? []].filter((udid) => lists.every((list) => list.has(udid))).sort() : [],
1567
+ expiresAtMs: expiries.length === 0 ? null : Math.min(...expiries),
1568
+ profileBundleIds: [.../* @__PURE__ */ new Set([bundleId, ...profiles.flatMap((item) => item.bundleId ?? [])])],
1569
+ teamId: profile?.teamId ?? null
1570
+ };
1571
+ };
1572
+ //#endregion
1573
+ export { readProfileServiceUdid as a, readIpaInstallInfo as i, native_artifact_BurROe05_exports as n, normalizeIosUdid as r, isSandboxChannel as t };