@ankhorage/zora 28.1.5 → 28.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +159 -2
  4. package/dist/capabilities/index.js.map +8 -5
  5. package/dist/constants/authoring.d.ts +6 -3
  6. package/dist/constants/authoring.d.ts.map +1 -1
  7. package/dist/constants/authoring.js +6 -0
  8. package/dist/constants/authoring.js.map +1 -1
  9. package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
  10. package/dist/features/audio/adapters/inbound/Audio.d.ts +5 -0
  11. package/dist/features/audio/adapters/inbound/Audio.d.ts.map +1 -0
  12. package/dist/features/audio/adapters/inbound/Audio.js +80 -0
  13. package/dist/features/audio/adapters/inbound/Audio.js.map +1 -0
  14. package/dist/features/audio/audioMeta.d.ts +22 -0
  15. package/dist/features/audio/audioMeta.d.ts.map +1 -0
  16. package/dist/features/audio/audioMeta.js +18 -0
  17. package/dist/features/audio/audioMeta.js.map +1 -0
  18. package/dist/features/audio/composition/AudioController.d.ts +13 -0
  19. package/dist/features/audio/composition/AudioController.d.ts.map +1 -0
  20. package/dist/features/audio/composition/AudioController.js +2 -0
  21. package/dist/features/audio/composition/AudioController.js.map +1 -0
  22. package/dist/features/audio/composition/useAudioController.d.ts +5 -0
  23. package/dist/features/audio/composition/useAudioController.d.ts.map +1 -0
  24. package/dist/features/audio/composition/useAudioController.js +22 -0
  25. package/dist/features/audio/composition/useAudioController.js.map +1 -0
  26. package/dist/features/audio/composition/useAudioController.web.d.ts +5 -0
  27. package/dist/features/audio/composition/useAudioController.web.d.ts.map +1 -0
  28. package/dist/features/audio/composition/useAudioController.web.js +80 -0
  29. package/dist/features/audio/composition/useAudioController.web.js.map +1 -0
  30. package/dist/features/audio/public.d.ts +3 -0
  31. package/dist/features/audio/public.d.ts.map +1 -0
  32. package/dist/features/audio/public.js +2 -0
  33. package/dist/features/audio/public.js.map +1 -0
  34. package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
  35. package/dist/features/card/cardMeta.d.ts +1 -1
  36. package/dist/features/card/mediaCardMeta.d.ts +1 -1
  37. package/dist/features/card/postCardMeta.d.ts +1 -1
  38. package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
  39. package/dist/features/dialog/dialogMeta.d.ts +2 -2
  40. package/dist/features/gradient/gradientMeta.d.ts +1 -1
  41. package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
  42. package/dist/features/layout/gridMeta.d.ts +1 -1
  43. package/dist/features/layout/screenMeta.d.ts +1 -1
  44. package/dist/features/layout/scrollViewMeta.d.ts +1 -1
  45. package/dist/features/layout/viewMeta.d.ts +1 -1
  46. package/dist/features/link/adapters/inbound/Link.d.ts +2 -0
  47. package/dist/features/link/adapters/inbound/Link.d.ts.map +1 -0
  48. package/dist/features/link/adapters/inbound/Link.js +2 -0
  49. package/dist/features/link/adapters/inbound/Link.js.map +1 -0
  50. package/dist/features/link/adapters/inbound/Link.native.d.ts +5 -0
  51. package/dist/features/link/adapters/inbound/Link.native.d.ts.map +1 -0
  52. package/dist/features/link/adapters/inbound/Link.native.js +29 -0
  53. package/dist/features/link/adapters/inbound/Link.native.js.map +1 -0
  54. package/dist/features/link/adapters/inbound/Link.web.d.ts +5 -0
  55. package/dist/features/link/adapters/inbound/Link.web.d.ts.map +1 -0
  56. package/dist/features/link/adapters/inbound/Link.web.js +34 -0
  57. package/dist/features/link/adapters/inbound/Link.web.js.map +1 -0
  58. package/dist/features/link/linkMeta.d.ts +116 -0
  59. package/dist/features/link/linkMeta.d.ts.map +1 -0
  60. package/dist/features/link/linkMeta.js +82 -0
  61. package/dist/features/link/linkMeta.js.map +1 -0
  62. package/dist/features/link/public.d.ts +3 -0
  63. package/dist/features/link/public.d.ts.map +1 -0
  64. package/dist/features/link/public.js +2 -0
  65. package/dist/features/link/public.js.map +1 -0
  66. package/dist/features/link/utils/linkThemeRecipeMeta.d.ts +25 -0
  67. package/dist/features/link/utils/linkThemeRecipeMeta.d.ts.map +1 -0
  68. package/dist/features/link/utils/linkThemeRecipeMeta.js +26 -0
  69. package/dist/features/link/utils/linkThemeRecipeMeta.js.map +1 -0
  70. package/dist/features/list/flatListMeta.d.ts +1 -1
  71. package/dist/features/list/sectionListMeta.d.ts +1 -1
  72. package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
  73. package/dist/features/reader/meta.d.ts +2 -2
  74. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
  75. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +6 -0
  76. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
  77. package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
  78. package/dist/features/registry/componentMeta.d.ts.map +1 -1
  79. package/dist/features/registry/componentMeta.js +6 -0
  80. package/dist/features/registry/componentMeta.js.map +1 -1
  81. package/dist/features/registry/themeRecipeMeta.d.ts.map +1 -1
  82. package/dist/features/registry/themeRecipeMeta.js +2 -0
  83. package/dist/features/registry/themeRecipeMeta.js.map +1 -1
  84. package/dist/features/scanner/meta.d.ts +2 -2
  85. package/dist/features/section/screenSectionMeta.d.ts +1 -1
  86. package/dist/features/surface/surfaceMeta.d.ts +1 -1
  87. package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
  88. package/dist/features/video/adapters/inbound/Video.d.ts +2 -0
  89. package/dist/features/video/adapters/inbound/Video.d.ts.map +1 -0
  90. package/dist/features/video/adapters/inbound/Video.js +2 -0
  91. package/dist/features/video/adapters/inbound/Video.js.map +1 -0
  92. package/dist/features/video/adapters/inbound/Video.native.d.ts +5 -0
  93. package/dist/features/video/adapters/inbound/Video.native.d.ts.map +1 -0
  94. package/dist/features/video/adapters/inbound/Video.native.js +160 -0
  95. package/dist/features/video/adapters/inbound/Video.native.js.map +1 -0
  96. package/dist/features/video/adapters/inbound/Video.web.d.ts +5 -0
  97. package/dist/features/video/adapters/inbound/Video.web.d.ts.map +1 -0
  98. package/dist/features/video/adapters/inbound/Video.web.js +30 -0
  99. package/dist/features/video/adapters/inbound/Video.web.js.map +1 -0
  100. package/dist/features/video/public.d.ts +3 -0
  101. package/dist/features/video/public.d.ts.map +1 -0
  102. package/dist/features/video/public.js +2 -0
  103. package/dist/features/video/public.js.map +1 -0
  104. package/dist/features/video/videoMeta.d.ts +64 -0
  105. package/dist/features/video/videoMeta.d.ts.map +1 -0
  106. package/dist/features/video/videoMeta.js +50 -0
  107. package/dist/features/video/videoMeta.js.map +1 -0
  108. package/dist/index.d.ts +2 -0
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +1 -0
  111. package/dist/index.js.map +1 -1
  112. package/dist/readerFree.d.ts +5 -0
  113. package/dist/readerFree.d.ts.map +1 -1
  114. package/dist/readerFree.js +3 -0
  115. package/dist/readerFree.js.map +1 -1
  116. package/dist/types/audio.d.ts +15 -0
  117. package/dist/types/audio.d.ts.map +1 -0
  118. package/dist/types/audio.js +2 -0
  119. package/dist/types/audio.js.map +1 -0
  120. package/dist/types/link.d.ts +23 -0
  121. package/dist/types/link.d.ts.map +1 -0
  122. package/dist/types/link.js +2 -0
  123. package/dist/types/link.js.map +1 -0
  124. package/dist/types/video.d.ts +24 -0
  125. package/dist/types/video.d.ts.map +1 -0
  126. package/dist/types/video.js +2 -0
  127. package/dist/types/video.js.map +1 -0
  128. package/package.json +41 -3
  129. package/src/constants/authoring.ts +6 -0
  130. package/src/features/audio/adapters/inbound/Audio.tsx +158 -0
  131. package/src/features/audio/audioMeta.ts +20 -0
  132. package/src/features/audio/composition/AudioController.ts +12 -0
  133. package/src/features/audio/composition/useAudioController.ts +27 -0
  134. package/src/features/audio/composition/useAudioController.web.ts +106 -0
  135. package/src/features/audio/public.test.ts +37 -0
  136. package/src/features/audio/public.ts +2 -0
  137. package/src/features/link/Link.test.tsx +48 -0
  138. package/src/features/link/adapters/inbound/Link.native.tsx +62 -0
  139. package/src/features/link/adapters/inbound/Link.tsx +1 -0
  140. package/src/features/link/adapters/inbound/Link.web.tsx +67 -0
  141. package/src/features/link/linkMeta.ts +83 -0
  142. package/src/features/link/public.ts +2 -0
  143. package/src/features/link/utils/linkThemeRecipeMeta.ts +27 -0
  144. package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +6 -0
  145. package/src/features/registry/componentMeta.test.ts +31 -0
  146. package/src/features/registry/componentMeta.ts +6 -0
  147. package/src/features/registry/themeRecipeMeta.test.ts +1 -0
  148. package/src/features/registry/themeRecipeMeta.ts +2 -0
  149. package/src/features/video/adapters/inbound/Video.native.tsx +296 -0
  150. package/src/features/video/adapters/inbound/Video.test.tsx +188 -0
  151. package/src/features/video/adapters/inbound/Video.tsx +1 -0
  152. package/src/features/video/adapters/inbound/Video.web.tsx +70 -0
  153. package/src/features/video/public.ts +7 -0
  154. package/src/features/video/videoMeta.ts +51 -0
  155. package/src/index.ts +2 -0
  156. package/src/readerFree.ts +15 -0
  157. package/src/types/audio.ts +16 -0
  158. package/src/types/link.ts +26 -0
  159. package/src/types/video.ts +28 -0
  160. package/web-dist/authoring/index.js +27 -0
  161. package/web-dist/chunks/{Accordion-15sxxjym.js → Accordion-17s33h1a.js} +1 -1
  162. package/web-dist/chunks/{Accordion-qrt9xz0h.js → Accordion-2wggrer7.js} +2 -2
  163. package/web-dist/chunks/{Accordion-9k7ktksc.js → Accordion-2xkxthf1.js} +3 -3
  164. package/web-dist/chunks/{Accordion-qkkeyr18.js → Accordion-2ys50fc8.js} +1 -1
  165. package/web-dist/chunks/{Accordion-xfkg7dcw.js → Accordion-379mgrse.js} +1 -1
  166. package/web-dist/chunks/{Accordion-xb9zhdhp.js → Accordion-38xvj0cq.js} +2 -2
  167. package/web-dist/chunks/{Accordion-q11svb96.js → Accordion-5qz4j8tt.js} +5 -5
  168. package/web-dist/chunks/{Accordion-8c4w7366.js → Accordion-5rwztz14.js} +1 -1
  169. package/web-dist/chunks/{Accordion-afpjg1d6.js → Accordion-8skz71ct.js} +1 -1
  170. package/web-dist/chunks/{Accordion-27yg9ktv.js → Accordion-9qg7cjt8.js} +1 -1
  171. package/web-dist/chunks/{Accordion-wb9pmykz.js → Accordion-a1mgdfg7.js} +1 -1
  172. package/web-dist/chunks/{Accordion-vzq344av.js → Accordion-axe7nsht.js} +1 -1
  173. package/web-dist/chunks/{Accordion-46n609yq.js → Accordion-bd9vzpbz.js} +2 -2
  174. package/web-dist/chunks/{Accordion-gnxmybxx.js → Accordion-bp9y7738.js} +4 -4
  175. package/web-dist/chunks/{Accordion-5cjhz94e.js → Accordion-bzgy9sg3.js} +2 -2
  176. package/web-dist/chunks/{Accordion-f4919ghm.js → Accordion-e0vm82xr.js} +1 -1
  177. package/web-dist/chunks/{Accordion-jmxe6kw0.js → Accordion-f1vargnk.js} +1 -1
  178. package/web-dist/chunks/{Accordion-de8srt4x.js → Accordion-f8zpd80k.js} +3 -3
  179. package/web-dist/chunks/{Accordion-qsppnx7g.js → Accordion-gnbt6w4q.js} +1 -1
  180. package/web-dist/chunks/{Accordion-h1q243zq.js → Accordion-htm3j8r8.js} +3 -3
  181. package/web-dist/chunks/{Accordion-01zvarrn.js → Accordion-kdb9g5b1.js} +1 -1
  182. package/web-dist/chunks/{Accordion-78tknqmc.js → Accordion-nmpzv3b0.js} +2 -2
  183. package/web-dist/chunks/{Accordion-22cda3h5.js → Accordion-r75ep5pg.js} +2 -2
  184. package/web-dist/chunks/{Accordion-34b3rwbc.js → Accordion-rq311z1k.js} +3 -3
  185. package/web-dist/chunks/{Accordion-epv5yhch.js → Accordion-tqagt6cz.js} +1 -1
  186. package/web-dist/chunks/{Accordion-0xaq2k2h.js → Accordion-vb52sts9.js} +1 -1
  187. package/web-dist/chunks/{Accordion-b8w0f8s0.js → Accordion-za0jcjgn.js} +1 -1
  188. package/web-dist/chunks/Video.native-97x0098j.js +905 -0
  189. package/web-dist/chunks/index-cnnsfz6n.js +1807 -0
  190. package/web-dist/components/accordion/Accordion.js +2 -2
  191. package/web-dist/components/accordion-item/AccordionItem.js +2 -2
  192. package/web-dist/components/app-bar/AppBar.js +4 -4
  193. package/web-dist/components/app-header/AppHeader.js +4 -4
  194. package/web-dist/components/audio/Audio.d.ts +7 -0
  195. package/web-dist/components/audio/Audio.dependency-0.d.ts +27 -0
  196. package/web-dist/components/audio/Audio.dependency-1.d.ts +3 -0
  197. package/web-dist/components/audio/Audio.js +264 -0
  198. package/web-dist/components/audio/Audio.types-0.d.ts +18 -0
  199. package/web-dist/components/audio/index.d.ts +2 -0
  200. package/web-dist/components/audio/index.js +2 -0
  201. package/web-dist/components/auth-screen/AuthScreen.js +6 -6
  202. package/web-dist/components/avatar/Avatar.js +2 -2
  203. package/web-dist/components/avatar-group/AvatarGroup.js +2 -2
  204. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +5 -5
  205. package/web-dist/components/breadcrumbs/Breadcrumbs.js +2 -2
  206. package/web-dist/components/button/Button.js +1 -1
  207. package/web-dist/components/button-group/ButtonGroup.js +1 -1
  208. package/web-dist/components/calendar/Calendar.js +3 -3
  209. package/web-dist/components/camera-permission-view/CameraPermissionView.js +5 -5
  210. package/web-dist/components/card/Card.js +4 -4
  211. package/web-dist/components/chat-list-item/ChatListItem.js +3 -3
  212. package/web-dist/components/checkbox/Checkbox.js +2 -2
  213. package/web-dist/components/checkbox-group/CheckboxGroup.js +2 -2
  214. package/web-dist/components/chip/Chip.js +2 -2
  215. package/web-dist/components/chip-group/ChipGroup.js +2 -2
  216. package/web-dist/components/collection-editor/CollectionEditor.js +4 -4
  217. package/web-dist/components/color-hue-scale/ColorHueScale.js +6 -6
  218. package/web-dist/components/color-picker/ColorPicker.js +6 -6
  219. package/web-dist/components/color-tone/ColorTone.js +6 -6
  220. package/web-dist/components/color-wheel/ColorWheel.js +6 -6
  221. package/web-dist/components/content-rail/ContentRail.js +2 -2
  222. package/web-dist/components/data-table/DataTable.js +10 -10
  223. package/web-dist/components/date-picker/DatePicker.js +4 -4
  224. package/web-dist/components/dialog/Dialog.js +2 -2
  225. package/web-dist/components/empty-state/EmptyState.js +5 -5
  226. package/web-dist/components/explorer/Explorer.js +2 -2
  227. package/web-dist/components/field/Field.js +2 -2
  228. package/web-dist/components/file-explorer/FileExplorer.js +2 -2
  229. package/web-dist/components/flat-list/FlatList.js +3 -3
  230. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +6 -6
  231. package/web-dist/components/form/Form.js +4 -4
  232. package/web-dist/components/form-actions/FormActions.js +4 -4
  233. package/web-dist/components/form-error/FormError.js +4 -4
  234. package/web-dist/components/heading/Heading.js +1 -1
  235. package/web-dist/components/hero/Hero.js +4 -4
  236. package/web-dist/components/icon-button/IconButton.js +1 -1
  237. package/web-dist/components/link/Link.d.ts +7 -0
  238. package/web-dist/components/link/Link.dependency-0.d.ts +27 -0
  239. package/web-dist/components/link/Link.dependency-1.d.ts +3 -0
  240. package/web-dist/components/link/Link.dependency-2.d.ts +7 -0
  241. package/web-dist/components/link/Link.dependency-3.d.ts +5 -0
  242. package/web-dist/components/link/Link.js +95 -0
  243. package/web-dist/components/link/Link.types-0.d.ts +28 -0
  244. package/web-dist/components/link/index.d.ts +2 -0
  245. package/web-dist/components/link/index.js +2 -0
  246. package/web-dist/components/list/List.js +3 -3
  247. package/web-dist/components/list-item/ListItem.js +3 -3
  248. package/web-dist/components/list-section/ListSection.js +3 -3
  249. package/web-dist/components/media-card/MediaCard.js +4 -4
  250. package/web-dist/components/media-explorer/MediaExplorer.js +2 -2
  251. package/web-dist/components/message-bubble/MessageBubble.js +3 -3
  252. package/web-dist/components/metric-card/MetricCard.js +4 -4
  253. package/web-dist/components/missing-element/MissingElement.js +1 -1
  254. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +6 -6
  255. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +6 -6
  256. package/web-dist/components/otp-form/OtpForm.js +6 -6
  257. package/web-dist/components/pagination/Pagination.js +2 -2
  258. package/web-dist/components/palette-item/PaletteItem.js +4 -4
  259. package/web-dist/components/popover-menu/PopoverMenu.js +1 -1
  260. package/web-dist/components/post-card/PostCard.js +4 -4
  261. package/web-dist/components/product-card/ProductCard.js +4 -4
  262. package/web-dist/components/progress/Progress.js +2 -2
  263. package/web-dist/components/progress-ring/ProgressRing.js +2 -2
  264. package/web-dist/components/radio/Radio.js +2 -2
  265. package/web-dist/components/radio-group/RadioGroup.js +2 -2
  266. package/web-dist/components/reader/Reader.js +6 -6
  267. package/web-dist/components/scan-overlay/ScanOverlay.js +5 -5
  268. package/web-dist/components/screen-section/ScreenSection.js +2 -2
  269. package/web-dist/components/search-input/SearchInput.js +2 -2
  270. package/web-dist/components/section-header/SectionHeader.js +2 -2
  271. package/web-dist/components/section-list/SectionList.js +3 -3
  272. package/web-dist/components/select/Select.js +3 -3
  273. package/web-dist/components/sign-in-form/SignInForm.js +6 -6
  274. package/web-dist/components/sign-up-form/SignUpForm.js +6 -6
  275. package/web-dist/components/skeleton/Skeleton.js +7 -7
  276. package/web-dist/components/skeleton-card/SkeletonCard.js +7 -7
  277. package/web-dist/components/skeleton-list/SkeletonList.js +7 -7
  278. package/web-dist/components/skeleton-text/SkeletonText.js +7 -7
  279. package/web-dist/components/text/Text.js +1 -1
  280. package/web-dist/components/text-input/TextInput.js +2 -2
  281. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +1 -1
  282. package/web-dist/components/time-picker/TimePicker.js +3 -3
  283. package/web-dist/components/timeline/Timeline.js +1 -1
  284. package/web-dist/components/toast/Toast.js +2 -2
  285. package/web-dist/components/toast-provider/ToastProvider.js +2 -2
  286. package/web-dist/components/toolbar/Toolbar.js +4 -4
  287. package/web-dist/components/tree-item/TreeItem.js +4 -4
  288. package/web-dist/components/uploader/Uploader.js +7 -7
  289. package/web-dist/components/video/Video.d.ts +7 -0
  290. package/web-dist/components/video/Video.dependency-0.d.ts +27 -0
  291. package/web-dist/components/video/Video.dependency-1.d.ts +3 -0
  292. package/web-dist/components/video/Video.dependency-2.d.ts +9 -0
  293. package/web-dist/components/video/Video.dependency-3.d.ts +23 -0
  294. package/web-dist/components/video/Video.js +80 -0
  295. package/web-dist/components/video/Video.types-0.d.ts +29 -0
  296. package/web-dist/components/video/index.d.ts +2 -0
  297. package/web-dist/components/video/index.js +2 -0
  298. package/web-dist/manifest.json +399 -294
  299. package/web-dist/runtime/ZoraProvider.js +1 -1
  300. /package/web-dist/chunks/{Accordion-7bd6zq4s.js → Accordion-2xb252py.js} +0 -0
  301. /package/web-dist/chunks/{Accordion-q046ws5p.js → Accordion-q683s6kd.js} +0 -0
@@ -0,0 +1,905 @@
1
+ 'use client';
2
+ import"./Accordion-0dj1r7w3.js";
3
+ import"./Accordion-9d38cgqj.js";
4
+ import"./Accordion-wgc67k1g.js";
5
+ import"./Accordion-ww4f12ty.js";
6
+ import"./Accordion-hdyzyw8q.js";
7
+ import"./Accordion-kcm6jcpp.js";
8
+ import {
9
+ require_registry,
10
+ IconButton2
11
+ } from "./Accordion-f1vargnk.js";
12
+ import"./Accordion-76b0qz8y.js";
13
+ import {
14
+ withZoraThemeScope
15
+ } from "./Accordion-tk8zf9ff.js";
16
+ import {
17
+ View2
18
+ } from "./Accordion-f8a49gy8.js";
19
+ import {
20
+ Image2
21
+ } from "./Accordion-01bsg7zt.js";
22
+ import"./Accordion-3zzzw7a8.js";
23
+ import {
24
+ Text3
25
+ } from "./Accordion-8skz71ct.js";
26
+ import"./Accordion-61e19g3e.js";
27
+ import"./Accordion-c6edgxay.js";
28
+ import"./Accordion-yrac5a7m.js";
29
+ import {
30
+ useZoraTheme2
31
+ } from "./Accordion-b1y5mjac.js";
32
+ import"./Accordion-fre84yaq.js";
33
+ import {
34
+ require_cjs
35
+ } from "./Accordion-xgpzh4wq.js";
36
+ import {
37
+ __toESM
38
+ } from "./Accordion-nh0cs9hq.js";
39
+ // node_modules/expo-video/build/VideoView.web.js
40
+ var import_react_native = __toESM(require_cjs());
41
+ import { jsx as _jsx } from "react/jsx-runtime";
42
+ import React, { useEffect, useRef, forwardRef, useImperativeHandle } from "react";
43
+
44
+ // node_modules/expo-video/build/VideoPlayer.web.js
45
+ import { useMemo } from "react";
46
+
47
+ // node_modules/expo-video/build/resolveAssetSource.web.js
48
+ var import_registry = __toESM(require_registry());
49
+ function resolveAssetSource(assetId) {
50
+ const asset = import_registry.getAssetByID(assetId);
51
+ if (!asset) {
52
+ return null;
53
+ }
54
+ const type = !asset.type ? "" : `.${asset.type}`;
55
+ const assetPath = __DEV__ ? asset.httpServerLocation + "/" + asset.name + type : asset.httpServerLocation.replace(/\.\.\//g, "_") + "/" + asset.name + type;
56
+ const fromUrl = new URL(assetPath, "https://expo.dev");
57
+ return { uri: fromUrl.toString().replace(fromUrl.origin, "") };
58
+ }
59
+
60
+ // node_modules/expo-video/build/VideoPlayer.web.js
61
+ function useVideoPlayer(source, setup) {
62
+ const parsedSource = typeof source === "string" ? { uri: source } : source;
63
+ return useMemo(() => {
64
+ const player = new VideoPlayerWeb(parsedSource);
65
+ setup?.(player);
66
+ return player;
67
+ }, [JSON.stringify(source)]);
68
+ }
69
+ function getSourceUri(source) {
70
+ if (typeof source === "string") {
71
+ return source;
72
+ }
73
+ if (typeof source === "number") {
74
+ return resolveAssetSource(source)?.uri ?? null;
75
+ }
76
+ if (typeof source?.assetId === "number" && !source?.uri) {
77
+ return resolveAssetSource(source.assetId)?.uri ?? null;
78
+ }
79
+ return source?.uri ?? null;
80
+ }
81
+ class VideoPlayerWeb extends globalThis.expo.SharedObject {
82
+ constructor(source) {
83
+ super();
84
+ this.src = source;
85
+ }
86
+ src = null;
87
+ previousSrc = null;
88
+ _mountedVideos = new Set;
89
+ _audioNodes = new Set;
90
+ playing = false;
91
+ _muted = false;
92
+ _volume = 1;
93
+ _loop = false;
94
+ _playbackRate = 1;
95
+ _preservesPitch = true;
96
+ _status = "idle";
97
+ _error = null;
98
+ _timeUpdateLoop = null;
99
+ _timeUpdateEventInterval = 0;
100
+ audioMixingMode = "auto";
101
+ allowsExternalPlayback = false;
102
+ staysActiveInBackground = false;
103
+ showNowPlayingNotification = false;
104
+ currentLiveTimestamp = null;
105
+ currentOffsetFromLive = null;
106
+ targetOffsetFromLive = 0;
107
+ bufferOptions = {};
108
+ subtitleTrack = null;
109
+ availableSubtitleTracks = [];
110
+ audioTrack = null;
111
+ availableAudioTracks = [];
112
+ videoTrack = null;
113
+ availableVideoTracks = [];
114
+ isExternalPlaybackActive = false;
115
+ keepScreenOnWhilePlaying = false;
116
+ seekTolerance = {};
117
+ scrubbingModeOptions = {};
118
+ set muted(value) {
119
+ this._mountedVideos.forEach((video) => {
120
+ video.muted = value;
121
+ });
122
+ this._muted = value;
123
+ }
124
+ get muted() {
125
+ return this._muted;
126
+ }
127
+ set playbackRate(value) {
128
+ this._mountedVideos.forEach((video) => {
129
+ video.playbackRate = value;
130
+ });
131
+ this._playbackRate = value;
132
+ }
133
+ get playbackRate() {
134
+ return this._playbackRate;
135
+ }
136
+ get isLive() {
137
+ return [...this._mountedVideos][0]?.duration === Infinity;
138
+ }
139
+ set volume(value) {
140
+ this._mountedVideos.forEach((video) => {
141
+ video.volume = value;
142
+ });
143
+ this._volume = value;
144
+ }
145
+ get volume() {
146
+ return this._volume;
147
+ }
148
+ set loop(value) {
149
+ this._mountedVideos.forEach((video) => {
150
+ video.loop = value;
151
+ });
152
+ this._loop = value;
153
+ }
154
+ get loop() {
155
+ return this._loop;
156
+ }
157
+ get currentTime() {
158
+ return [...this._mountedVideos][0]?.currentTime ?? 0;
159
+ }
160
+ set currentTime(value) {
161
+ this._mountedVideos.forEach((video) => {
162
+ video.currentTime = value;
163
+ });
164
+ }
165
+ get duration() {
166
+ return [...this._mountedVideos][0]?.duration ?? 0;
167
+ }
168
+ get preservesPitch() {
169
+ return this._preservesPitch;
170
+ }
171
+ set preservesPitch(value) {
172
+ this._mountedVideos.forEach((video) => {
173
+ video.preservesPitch = value;
174
+ });
175
+ this._preservesPitch = value;
176
+ }
177
+ get timeUpdateEventInterval() {
178
+ return this._timeUpdateEventInterval;
179
+ }
180
+ set timeUpdateEventInterval(value) {
181
+ this._timeUpdateEventInterval = value;
182
+ if (this._timeUpdateLoop) {
183
+ clearInterval(this._timeUpdateLoop);
184
+ }
185
+ if (value > 0) {
186
+ this.emit("timeUpdate", {
187
+ currentTime: this.currentTime,
188
+ currentLiveTimestamp: null,
189
+ currentOffsetFromLive: null,
190
+ bufferedPosition: this.bufferedPosition
191
+ });
192
+ this._timeUpdateLoop = setInterval(() => {
193
+ this.emit("timeUpdate", {
194
+ currentTime: this.currentTime,
195
+ currentLiveTimestamp: null,
196
+ currentOffsetFromLive: null,
197
+ bufferedPosition: this.bufferedPosition
198
+ });
199
+ }, value * 1000);
200
+ }
201
+ }
202
+ get status() {
203
+ return this._status;
204
+ }
205
+ get bufferedPosition() {
206
+ if (this._mountedVideos.size === 0 || this.status === "error") {
207
+ return -1;
208
+ }
209
+ const buffered = [...this._mountedVideos][0]?.buffered;
210
+ if (buffered != null) {
211
+ for (let i = 0;i < buffered.length; i++) {
212
+ if (buffered.start(i) <= this.currentTime && buffered.end(i) >= this.currentTime) {
213
+ return buffered.end(i);
214
+ }
215
+ }
216
+ }
217
+ return 0;
218
+ }
219
+ set status(value) {
220
+ if (this._status === value)
221
+ return;
222
+ if (value === "error" && this._error) {
223
+ this.emit("statusChange", {
224
+ status: value,
225
+ oldStatus: this._status,
226
+ error: this._error
227
+ });
228
+ } else {
229
+ this.emit("statusChange", {
230
+ status: value,
231
+ oldStatus: this._status
232
+ });
233
+ this._error = null;
234
+ }
235
+ this._status = value;
236
+ }
237
+ mountVideoView(video) {
238
+ if (this._mountedVideos.size === 0) {
239
+ video.preservesPitch = this._preservesPitch;
240
+ video.loop = this._loop;
241
+ video.volume = this._volume;
242
+ video.muted = this._muted;
243
+ video.playbackRate = this._playbackRate;
244
+ }
245
+ this._mountedVideos.add(video);
246
+ this._addListeners(video);
247
+ this._synchronizeWithFirstVideo(video);
248
+ }
249
+ unmountVideoView(video) {
250
+ this._mountedVideos.delete(video);
251
+ }
252
+ mountAudioNode(audioContext, zeroGainNode, audioSourceNode) {
253
+ if (!audioContext || !zeroGainNode)
254
+ return;
255
+ this._audioNodes.add(audioSourceNode);
256
+ if (this._audioNodes.size === 1) {
257
+ audioSourceNode.connect(audioContext.destination);
258
+ } else {
259
+ audioSourceNode.connect(zeroGainNode);
260
+ }
261
+ }
262
+ unmountAudioNode(video, audioContext, audioSourceNode) {
263
+ const mountedVideos = [...this._mountedVideos];
264
+ const videoPlayingAudio = mountedVideos[0];
265
+ this._audioNodes.delete(audioSourceNode);
266
+ audioSourceNode.disconnect();
267
+ if (videoPlayingAudio === video && this._audioNodes.size > 0 && audioContext) {
268
+ const newMainAudioSource = [...this._audioNodes][0];
269
+ if (newMainAudioSource != null) {
270
+ newMainAudioSource.disconnect();
271
+ newMainAudioSource.connect(audioContext.destination);
272
+ }
273
+ }
274
+ }
275
+ play() {
276
+ this._mountedVideos.forEach((video) => {
277
+ video.play();
278
+ });
279
+ }
280
+ pause() {
281
+ this._mountedVideos.forEach((video) => {
282
+ video.pause();
283
+ });
284
+ }
285
+ replace(source) {
286
+ this._mountedVideos.forEach((video) => {
287
+ const uri = getSourceUri(source);
288
+ video.pause();
289
+ if (uri) {
290
+ video.setAttribute("src", uri);
291
+ video.load();
292
+ video.play();
293
+ } else {
294
+ video.removeAttribute("src");
295
+ video.load();
296
+ }
297
+ });
298
+ this.previousSrc = this.src;
299
+ this.src = source;
300
+ this.playing = true;
301
+ }
302
+ async replaceAsync(source) {
303
+ return this.replace(source);
304
+ }
305
+ seekBy(seconds) {
306
+ this._mountedVideos.forEach((video) => {
307
+ video.currentTime += seconds;
308
+ });
309
+ }
310
+ replay() {
311
+ this._mountedVideos.forEach((video) => {
312
+ video.currentTime = 0;
313
+ video.play();
314
+ });
315
+ this.playing = true;
316
+ }
317
+ generateThumbnailsAsync(times) {
318
+ throw new Error("Generating video thumbnails is not supported on Web yet");
319
+ }
320
+ _synchronizeWithFirstVideo(video) {
321
+ const firstVideo = [...this._mountedVideos][0];
322
+ if (!firstVideo)
323
+ return;
324
+ if (firstVideo.paused) {
325
+ video.pause();
326
+ } else {
327
+ video.play();
328
+ }
329
+ video.currentTime = firstVideo.currentTime;
330
+ video.volume = firstVideo.volume;
331
+ video.muted = firstVideo.muted;
332
+ video.playbackRate = firstVideo.playbackRate;
333
+ }
334
+ _emitOnce(eventSource, eventName, ...args) {
335
+ const mountedVideos = [...this._mountedVideos];
336
+ if (mountedVideos[0] === eventSource) {
337
+ this.emit(eventName, ...args);
338
+ }
339
+ }
340
+ _addListeners(video) {
341
+ video.onplay = (e) => {
342
+ this._emitOnce(video, "playingChange", {
343
+ isPlaying: true,
344
+ oldIsPlaying: this.playing
345
+ });
346
+ this.playing = true;
347
+ this._mountedVideos.forEach((mountedVideo) => {
348
+ if (e.target !== mountedVideo) {
349
+ mountedVideo.play();
350
+ }
351
+ });
352
+ };
353
+ video.onpause = (e) => {
354
+ this._emitOnce(video, "playingChange", {
355
+ isPlaying: false,
356
+ oldIsPlaying: this.playing
357
+ });
358
+ this.playing = false;
359
+ this._mountedVideos.forEach((mountedVideo) => {
360
+ if (e.target !== mountedVideo) {
361
+ mountedVideo.pause();
362
+ }
363
+ });
364
+ };
365
+ video.onvolumechange = () => {
366
+ this._emitOnce(video, "volumeChange", { volume: video.volume, oldVolume: this.volume });
367
+ this._emitOnce(video, "mutedChange", { muted: video.muted, oldMuted: this.muted });
368
+ this.volume = video.volume;
369
+ this.muted = video.muted;
370
+ };
371
+ video.onseeking = () => {
372
+ this._mountedVideos.forEach((mountedVideo) => {
373
+ if (mountedVideo === video || mountedVideo.currentTime === video.currentTime)
374
+ return;
375
+ mountedVideo.currentTime = video.currentTime;
376
+ });
377
+ };
378
+ video.onseeked = () => {
379
+ this._mountedVideos.forEach((mountedVideo) => {
380
+ if (mountedVideo === video || mountedVideo.currentTime === video.currentTime)
381
+ return;
382
+ mountedVideo.currentTime = video.currentTime;
383
+ });
384
+ };
385
+ video.onratechange = () => {
386
+ this._emitOnce(video, "playbackRateChange", {
387
+ playbackRate: video.playbackRate,
388
+ oldPlaybackRate: this.playbackRate
389
+ });
390
+ this._mountedVideos.forEach((mountedVideo) => {
391
+ if (mountedVideo.playbackRate === video.playbackRate)
392
+ return;
393
+ this._playbackRate = video.playbackRate;
394
+ mountedVideo.playbackRate = video.playbackRate;
395
+ });
396
+ this._playbackRate = video.playbackRate;
397
+ };
398
+ video.onerror = () => {
399
+ this._error = {
400
+ message: video.error?.message ?? "Unknown player error"
401
+ };
402
+ this.status = "error";
403
+ };
404
+ video.oncanplay = () => {
405
+ const allCanPlay = [...this._mountedVideos].reduce((previousValue, video) => {
406
+ return previousValue && video.readyState >= 3;
407
+ }, true);
408
+ if (!allCanPlay)
409
+ return;
410
+ this.status = "readyToPlay";
411
+ };
412
+ video.onwaiting = () => {
413
+ if (this._status === "loading")
414
+ return;
415
+ this.status = "loading";
416
+ };
417
+ video.onended = () => {
418
+ this._emitOnce(video, "playToEnd");
419
+ };
420
+ video.onloadstart = () => {
421
+ this._emitOnce(video, "sourceChange", { source: this.src, oldSource: this.previousSrc });
422
+ };
423
+ }
424
+ }
425
+
426
+ // node_modules/expo-video/build/VideoView.web.js
427
+ function createAudioContext() {
428
+ return typeof window !== "undefined" ? new window.AudioContext : null;
429
+ }
430
+ function createZeroGainNode(audioContext) {
431
+ const zeroGainNode = audioContext?.createGain() ?? null;
432
+ if (audioContext && zeroGainNode) {
433
+ zeroGainNode.gain.value = 0;
434
+ zeroGainNode.connect(audioContext.destination);
435
+ }
436
+ return zeroGainNode;
437
+ }
438
+ function mapStyles(style) {
439
+ const flattenedStyles = import_react_native.StyleSheet.flatten(style);
440
+ return flattenedStyles;
441
+ }
442
+ var VideoView = forwardRef((props, ref) => {
443
+ const videoRef = useRef(null);
444
+ const mediaNodeRef = useRef(null);
445
+ const hasToSetupAudioContext = useRef(false);
446
+ const fullscreenChangeListeners = useRef(null);
447
+ const isWaitingForFirstFrame = useRef(false);
448
+ const mountedPlayerRef = useRef(null);
449
+ const audioContextRef = useRef(null);
450
+ const zeroGainNodeRef = useRef(null);
451
+ useEffect(() => {
452
+ if (props.useAudioNodePlayback) {
453
+ maybeSetupAudioContext();
454
+ attachAudioNodes();
455
+ } else {
456
+ detachAudioNodes();
457
+ }
458
+ }, [props.useAudioNodePlayback]);
459
+ useImperativeHandle(ref, () => ({
460
+ enterFullscreen: async () => {
461
+ const video = videoRef.current;
462
+ if (video.requestFullscreen) {
463
+ await video.requestFullscreen();
464
+ } else if (video.webkitRequestFullscreen) {
465
+ await video.webkitRequestFullscreen();
466
+ } else if (video.webkitEnterFullScreen) {
467
+ await video.webkitEnterFullScreen();
468
+ } else if (video.msRequestFullscreen) {
469
+ await video.msRequestFullscreen();
470
+ }
471
+ },
472
+ exitFullscreen: async () => {
473
+ await document.exitFullscreen();
474
+ },
475
+ startPictureInPicture: async () => {
476
+ await videoRef.current?.requestPictureInPicture();
477
+ },
478
+ stopPictureInPicture: async () => {
479
+ try {
480
+ await document.exitPictureInPicture();
481
+ } catch (e) {
482
+ if (e instanceof DOMException && e.name === "InvalidStateError") {
483
+ console.warn("The VideoView is not in Picture-in-Picture mode.");
484
+ } else {
485
+ throw e;
486
+ }
487
+ }
488
+ },
489
+ nativeRef: videoRef
490
+ }));
491
+ useEffect(() => {
492
+ const onEnter = () => {
493
+ props.onPictureInPictureStart?.();
494
+ };
495
+ const onLeave = () => {
496
+ props.onPictureInPictureStop?.();
497
+ };
498
+ const onLoadStart = () => {
499
+ isWaitingForFirstFrame.current = true;
500
+ };
501
+ const onCanPlay = () => {
502
+ if (isWaitingForFirstFrame.current) {
503
+ props.onFirstFrameRender?.();
504
+ }
505
+ isWaitingForFirstFrame.current = false;
506
+ };
507
+ videoRef.current?.addEventListener("enterpictureinpicture", onEnter);
508
+ videoRef.current?.addEventListener("leavepictureinpicture", onLeave);
509
+ videoRef.current?.addEventListener("loadstart", onLoadStart);
510
+ videoRef.current?.addEventListener("loadeddata", onCanPlay);
511
+ return () => {
512
+ videoRef.current?.removeEventListener("enterpictureinpicture", onEnter);
513
+ videoRef.current?.removeEventListener("leavepictureinpicture", onLeave);
514
+ videoRef.current?.removeEventListener("loadstart", onLoadStart);
515
+ videoRef.current?.removeEventListener("loadeddata", onCanPlay);
516
+ };
517
+ }, [videoRef, props.onPictureInPictureStop, props.onPictureInPictureStart]);
518
+ function attachAudioNodes() {
519
+ if (!props.useAudioNodePlayback) {
520
+ return;
521
+ }
522
+ const audioContext = audioContextRef.current;
523
+ const zeroGainNode = zeroGainNodeRef.current;
524
+ const mediaNode = mediaNodeRef.current;
525
+ if (audioContext && zeroGainNode && mediaNode) {
526
+ props.player?.mountAudioNode(audioContext, zeroGainNode, mediaNode);
527
+ } else {
528
+ console.warn("Couldn't mount audio node, this might affect the audio playback when using multiple video views with the same player.");
529
+ }
530
+ }
531
+ function detachAudioNodes() {
532
+ if (!props.useAudioNodePlayback) {
533
+ return;
534
+ }
535
+ const audioContext = audioContextRef.current;
536
+ const mediaNode = mediaNodeRef.current;
537
+ if (audioContext && mediaNode && videoRef.current) {
538
+ props.player?.unmountAudioNode(videoRef.current, audioContext, mediaNode);
539
+ }
540
+ }
541
+ function maybeSetupAudioContext() {
542
+ const userHasNotBeenActive = "userActivation" in navigator && !navigator.userActivation.hasBeenActive;
543
+ if (!hasToSetupAudioContext.current || userHasNotBeenActive || !videoRef.current || !props.useAudioNodePlayback) {
544
+ return;
545
+ }
546
+ const audioContext = createAudioContext();
547
+ detachAudioNodes();
548
+ audioContextRef.current = audioContext;
549
+ zeroGainNodeRef.current = createZeroGainNode(audioContextRef.current);
550
+ mediaNodeRef.current = audioContext ? audioContext.createMediaElementSource(videoRef.current) : null;
551
+ attachAudioNodes();
552
+ hasToSetupAudioContext.current = false;
553
+ }
554
+ function fullscreenListener() {
555
+ if (document.fullscreenElement === videoRef.current) {
556
+ props.onFullscreenEnter?.();
557
+ } else {
558
+ props.onFullscreenExit?.();
559
+ }
560
+ }
561
+ function setupFullscreenListener() {
562
+ cleanupFullscreenListener();
563
+ const video = videoRef.current;
564
+ if (!video)
565
+ return;
566
+ const fullscreenListeners = {
567
+ default: fullscreenListener,
568
+ safariEnter: () => props.onFullscreenEnter?.(),
569
+ safariExit: () => props.onFullscreenExit?.(),
570
+ msListener: fullscreenListener
571
+ };
572
+ fullscreenChangeListeners.current = fullscreenListeners;
573
+ video.addEventListener("fullscreenchange", fullscreenListeners.default);
574
+ video.addEventListener("webkitbeginfullscreen", fullscreenListeners.safariEnter);
575
+ video.addEventListener("webkitendfullscreen", fullscreenListeners.safariExit);
576
+ document.addEventListener("MSFullscreenChange", fullscreenListeners.msListener);
577
+ }
578
+ function cleanupFullscreenListener() {
579
+ const video = videoRef.current;
580
+ if (!video || !fullscreenChangeListeners.current)
581
+ return;
582
+ video.removeEventListener("fullscreenchange", fullscreenChangeListeners.current.default);
583
+ video.removeEventListener("webkitbeginfullscreen", fullscreenChangeListeners.current?.safariEnter);
584
+ video.removeEventListener("webkitendfullscreen", fullscreenChangeListeners.current.safariExit);
585
+ document.removeEventListener("MSFullscreenChange", fullscreenChangeListeners.current.msListener);
586
+ }
587
+ useEffect(() => {
588
+ videoRef.current && mountedPlayerRef.current?.unmountVideoView(videoRef.current);
589
+ if (videoRef.current) {
590
+ props.player?.mountVideoView(videoRef.current);
591
+ }
592
+ setupFullscreenListener();
593
+ attachAudioNodes();
594
+ mountedPlayerRef.current = props.player ?? null;
595
+ if (props.player == null) {
596
+ videoRef.current?.removeAttribute("src");
597
+ videoRef.current?.load();
598
+ }
599
+ return () => {
600
+ if (videoRef.current) {
601
+ props.player?.unmountVideoView(videoRef.current);
602
+ }
603
+ mountedPlayerRef.current = null;
604
+ cleanupFullscreenListener();
605
+ detachAudioNodes();
606
+ };
607
+ }, [props.player]);
608
+ return _jsx("video", {
609
+ controls: props.nativeControls ?? true,
610
+ controlsList: props.fullscreenOptions?.enable ? undefined : "nofullscreen",
611
+ crossOrigin: props.crossOrigin,
612
+ style: {
613
+ ...mapStyles(props.style),
614
+ objectFit: props.contentFit
615
+ },
616
+ onPlay: () => {
617
+ maybeSetupAudioContext();
618
+ },
619
+ onVolumeChange: () => {
620
+ maybeSetupAudioContext();
621
+ },
622
+ ref: (newRef) => {
623
+ if (newRef && !newRef.isEqualNode(videoRef.current)) {
624
+ videoRef.current = newRef;
625
+ hasToSetupAudioContext.current = props.useAudioNodePlayback ?? false;
626
+ maybeSetupAudioContext();
627
+ }
628
+ },
629
+ disablePictureInPicture: !props.allowsPictureInPicture,
630
+ playsInline: props.playsInline,
631
+ src: getSourceUri(props.player?.src) ?? undefined
632
+ });
633
+ });
634
+ // src/features/video/adapters/inbound/Video.native.tsx
635
+ var import_react_native2 = __toESM(require_cjs(), 1);
636
+ import React2 from "react";
637
+ import { jsx, jsxs } from "react/jsx-runtime";
638
+ var Video = withZoraThemeScope(VideoInner);
639
+ function configureVideoPlayer(player, volume) {
640
+ player.timeUpdateEventInterval = 0.25;
641
+ setVideoPlayerVolume(player, volume);
642
+ }
643
+ function VideoInner({
644
+ themeId: _themeId,
645
+ mode: _mode,
646
+ interactionPolicy,
647
+ source,
648
+ poster,
649
+ aspectRatio = 16 / 9,
650
+ contentFit = "contain",
651
+ volume = 1,
652
+ accessibilityLabel = "Video player",
653
+ testID
654
+ }) {
655
+ const { theme } = useZoraTheme2();
656
+ const videoRef = React2.useRef(null);
657
+ const player = useVideoPlayer(source ?? null, (nextPlayer) => configureVideoPlayer(nextPlayer, volume));
658
+ const playbackEvents = useVideoPlayerEvents(player);
659
+ const [renderedSource, setRenderedSource] = React2.useState(null);
660
+ const [progressWidth, setProgressWidth] = React2.useState(0);
661
+ const currentTime = playbackEvents.timeUpdate?.currentTime ?? player.currentTime;
662
+ const duration = playbackEvents.sourceLoad?.duration ?? player.duration;
663
+ const isPlaying = playbackEvents.playingChange?.isPlaying ?? player.playing;
664
+ const currentVolume = playbackEvents.volumeChange?.volume ?? player.volume;
665
+ const canInteract = interactionPolicy !== "passive" && source !== null && source !== undefined;
666
+ const safeAspectRatio = isPositiveFiniteNumber(aspectRatio) ? aspectRatio : 16 / 9;
667
+ const safeDuration = isPositiveFiniteNumber(duration) ? duration : 0;
668
+ const safeCurrentTime = clamp(currentTime, 0, safeDuration);
669
+ React2.useEffect(() => {
670
+ setVideoPlayerVolume(player, volume);
671
+ }, [player, volume]);
672
+ const togglePlayback = () => {
673
+ if (player.playing) {
674
+ player.pause();
675
+ return;
676
+ }
677
+ player.play();
678
+ };
679
+ const seekToProgress = (locationX) => {
680
+ if (progressWidth <= 0 || safeDuration === 0)
681
+ return;
682
+ setVideoPlayerCurrentTime(player, clamp(locationX / progressWidth, 0, 1) * safeDuration);
683
+ };
684
+ const changeVolume = (difference) => {
685
+ setVideoPlayerVolume(player, currentVolume + difference);
686
+ };
687
+ const enterFullscreen = () => {
688
+ videoRef.current?.enterFullscreen().catch(() => {
689
+ return;
690
+ });
691
+ };
692
+ return /* @__PURE__ */ jsxs(View2, {
693
+ bg: theme.semantics.surface.raised,
694
+ borderColor: theme.semantics.neutral.divider,
695
+ borderWidth: 1,
696
+ radius: "m",
697
+ testID,
698
+ overflow: "hidden",
699
+ children: [
700
+ /* @__PURE__ */ jsxs(View2, {
701
+ bg: theme.semantics.neutral.surface,
702
+ style: { aspectRatio: safeAspectRatio },
703
+ children: [
704
+ /* @__PURE__ */ jsx(VideoView, {
705
+ contentFit,
706
+ fullscreenOptions: { enable: true },
707
+ nativeControls: false,
708
+ onFirstFrameRender: () => setRenderedSource(source ?? null),
709
+ player,
710
+ ref: videoRef,
711
+ style: { height: "100%", width: "100%" }
712
+ }),
713
+ poster && renderedSource !== source ? /* @__PURE__ */ jsx(View2, {
714
+ style: { bottom: 0, left: 0, position: "absolute", right: 0, top: 0 },
715
+ pointerEvents: "none",
716
+ children: /* @__PURE__ */ jsx(Image2, {
717
+ alt: "",
718
+ aspectRatio: safeAspectRatio,
719
+ fit: contentFit === "fill" ? "stretch" : contentFit,
720
+ source: poster
721
+ })
722
+ }) : null
723
+ ]
724
+ }),
725
+ /* @__PURE__ */ jsxs(View2, {
726
+ gap: "s",
727
+ p: "m",
728
+ children: [
729
+ /* @__PURE__ */ jsx(import_react_native2.Pressable, {
730
+ accessibilityLabel: "Seek video",
731
+ accessibilityRole: "adjustable",
732
+ accessibilityValue: { max: safeDuration, min: 0, now: safeCurrentTime },
733
+ disabled: !canInteract || safeDuration === 0,
734
+ onLayout: (event) => setProgressWidth(event.nativeEvent.layout.width),
735
+ onPress: (event) => seekToProgress(event.nativeEvent.locationX),
736
+ children: /* @__PURE__ */ jsx(View2, {
737
+ bg: theme.semantics.neutral.surface,
738
+ borderColor: theme.semantics.neutral.divider,
739
+ borderWidth: 1,
740
+ radius: "full",
741
+ style: { height: 8, overflow: "hidden" },
742
+ children: /* @__PURE__ */ jsx(View2, {
743
+ bg: theme.semantics.action.primary.base,
744
+ style: {
745
+ height: "100%",
746
+ width: `${resolveProgressPercent(safeCurrentTime, safeDuration)}%`
747
+ }
748
+ })
749
+ })
750
+ }),
751
+ /* @__PURE__ */ jsxs(View2, {
752
+ align: "center",
753
+ direction: "row",
754
+ justify: "space-between",
755
+ wrap: "nowrap",
756
+ children: [
757
+ /* @__PURE__ */ jsxs(Text3, {
758
+ accessibilityLiveRegion: "polite",
759
+ emphasis: "muted",
760
+ variant: "caption",
761
+ children: [
762
+ formatVideoTime(safeCurrentTime),
763
+ " / ",
764
+ formatVideoTime(safeDuration)
765
+ ]
766
+ }),
767
+ /* @__PURE__ */ jsxs(View2, {
768
+ align: "center",
769
+ direction: "row",
770
+ gap: "xs",
771
+ wrap: "nowrap",
772
+ children: [
773
+ /* @__PURE__ */ jsx(IconButton2, {
774
+ disabled: !canInteract,
775
+ icon: { name: "play-skip-back" },
776
+ interactionPolicy,
777
+ label: "Seek back 10 seconds",
778
+ onPress: () => player.seekBy(-10),
779
+ size: "s"
780
+ }),
781
+ /* @__PURE__ */ jsx(IconButton2, {
782
+ disabled: !canInteract,
783
+ icon: { name: isPlaying ? "pause" : "play" },
784
+ interactionPolicy,
785
+ label: isPlaying ? "Pause video" : "Play video",
786
+ onPress: togglePlayback,
787
+ size: "m"
788
+ }),
789
+ /* @__PURE__ */ jsx(IconButton2, {
790
+ disabled: !canInteract,
791
+ icon: { name: "play-skip-forward" },
792
+ interactionPolicy,
793
+ label: "Seek forward 10 seconds",
794
+ onPress: () => player.seekBy(10),
795
+ size: "s"
796
+ })
797
+ ]
798
+ }),
799
+ /* @__PURE__ */ jsxs(View2, {
800
+ align: "center",
801
+ direction: "row",
802
+ gap: "xs",
803
+ wrap: "nowrap",
804
+ children: [
805
+ /* @__PURE__ */ jsx(IconButton2, {
806
+ disabled: !canInteract || currentVolume <= 0,
807
+ icon: { name: "volume-low" },
808
+ interactionPolicy,
809
+ label: "Lower volume",
810
+ onPress: () => changeVolume(-0.1),
811
+ size: "s"
812
+ }),
813
+ /* @__PURE__ */ jsx(IconButton2, {
814
+ disabled: !canInteract || currentVolume >= 1,
815
+ icon: { name: "volume-high" },
816
+ interactionPolicy,
817
+ label: "Raise volume",
818
+ onPress: () => changeVolume(0.1),
819
+ size: "s"
820
+ }),
821
+ /* @__PURE__ */ jsx(IconButton2, {
822
+ disabled: !canInteract,
823
+ icon: { name: "expand" },
824
+ interactionPolicy,
825
+ label: `Enter fullscreen ${accessibilityLabel}`,
826
+ onPress: enterFullscreen,
827
+ size: "s"
828
+ })
829
+ ]
830
+ })
831
+ ]
832
+ })
833
+ ]
834
+ })
835
+ ]
836
+ });
837
+ }
838
+ function clamp(value, minimum, maximum) {
839
+ if (!Number.isFinite(value))
840
+ return minimum;
841
+ return Math.min(Math.max(value, minimum), maximum);
842
+ }
843
+ function setVideoPlayerCurrentTime(player, currentTime) {
844
+ player.currentTime = currentTime;
845
+ }
846
+ function setVideoPlayerVolume(player, volume) {
847
+ player.volume = clamp(volume, 0, 1);
848
+ }
849
+ function formatVideoTime(value) {
850
+ const totalSeconds = Math.floor(Math.max(0, Number.isFinite(value) ? value : 0));
851
+ const seconds = totalSeconds % 60;
852
+ const minutes = Math.floor(totalSeconds / 60) % 60;
853
+ const hours = Math.floor(totalSeconds / 3600);
854
+ const minuteLabel = hours > 0 ? String(minutes).padStart(2, "0") : String(minutes);
855
+ const secondLabel = String(seconds).padStart(2, "0");
856
+ return hours > 0 ? `${hours}:${minuteLabel}:${secondLabel}` : `${minuteLabel}:${secondLabel}`;
857
+ }
858
+ function isPositiveFiniteNumber(value) {
859
+ return Number.isFinite(value) && value > 0;
860
+ }
861
+ function resolveProgressPercent(currentTime, duration) {
862
+ if (duration <= 0)
863
+ return 0;
864
+ return clamp(currentTime / duration * 100, 0, 100);
865
+ }
866
+ function useVideoPlayerEvents(player) {
867
+ const [events, setEvents] = React2.useState({
868
+ player: null,
869
+ playingChange: null,
870
+ sourceLoad: null,
871
+ timeUpdate: null,
872
+ volumeChange: null
873
+ });
874
+ React2.useEffect(() => {
875
+ const timeUpdate = player.addListener("timeUpdate", (value) => {
876
+ setEvents((current) => ({ ...current, player, timeUpdate: value }));
877
+ });
878
+ const sourceLoad = player.addListener("sourceLoad", (value) => {
879
+ setEvents((current) => ({ ...current, player, sourceLoad: value }));
880
+ });
881
+ const playingChange = player.addListener("playingChange", (value) => {
882
+ setEvents((current) => ({ ...current, player, playingChange: value }));
883
+ });
884
+ const volumeChange = player.addListener("volumeChange", (value) => {
885
+ setEvents((current) => ({ ...current, player, volumeChange: value }));
886
+ });
887
+ return () => {
888
+ timeUpdate.remove();
889
+ sourceLoad.remove();
890
+ playingChange.remove();
891
+ volumeChange.remove();
892
+ };
893
+ }, [player]);
894
+ return events.player === player ? events : EMPTY_VIDEO_PLAYBACK_EVENTS;
895
+ }
896
+ var EMPTY_VIDEO_PLAYBACK_EVENTS = {
897
+ player: null,
898
+ playingChange: null,
899
+ sourceLoad: null,
900
+ timeUpdate: null,
901
+ volumeChange: null
902
+ };
903
+ export {
904
+ Video
905
+ };