@ionic/react 7.5.3-dev.11698858201.14165f23 → 7.5.3-dev.11699994454.1cbf1283

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 (247) hide show
  1. package/dist/index.js +2443 -8
  2. package/dist/index.js.map +1 -7
  3. package/dist/types/components/CreateAnimation.d.ts +71 -0
  4. package/dist/types/components/IonActionSheet.d.ts +3 -0
  5. package/dist/types/components/IonAlert.d.ts +3 -0
  6. package/dist/types/components/IonApp.d.ts +41 -0
  7. package/dist/types/components/IonIcon.d.ts +16 -0
  8. package/dist/types/components/IonLoading.d.ts +3 -0
  9. package/dist/types/components/IonModal.d.ts +3 -0
  10. package/dist/types/components/IonOverlayManager.d.ts +15 -0
  11. package/dist/types/components/IonPage.d.ts +3 -0
  12. package/dist/types/components/IonPicker.d.ts +3 -0
  13. package/dist/types/components/IonPopover.d.ts +3 -0
  14. package/dist/types/components/IonRedirect.d.ts +16 -0
  15. package/dist/types/components/IonRoute.d.ts +17 -0
  16. package/dist/types/components/IonRouterContext.d.ts +42 -0
  17. package/dist/types/components/IonRouterOutlet.d.ts +8 -0
  18. package/dist/types/components/IonToast.d.ts +3 -0
  19. package/dist/types/components/IonicReactProps.d.ts +6 -0
  20. package/dist/types/components/__tests__/utils.spec.d.ts +1 -0
  21. package/dist/types/components/createControllerComponent.d.ts +19 -0
  22. package/dist/types/components/createInlineOverlayComponent.d.ts +2 -0
  23. package/dist/types/components/createOverlayComponent.d.ts +20 -0
  24. package/dist/types/components/createRoutingComponent.d.ts +2 -0
  25. package/dist/types/components/hrefprops.d.ts +9 -0
  26. package/dist/types/components/index.d.ts +35 -0
  27. package/dist/types/components/inner-proxies.d.ts +14 -0
  28. package/dist/types/components/navigation/IonBackButton.d.ts +68 -0
  29. package/dist/types/components/navigation/IonNav.d.ts +5 -0
  30. package/dist/types/components/navigation/IonTabBar.d.ts +15 -0
  31. package/dist/types/components/navigation/IonTabButton.d.ts +40 -0
  32. package/dist/types/components/navigation/IonTabs.d.ts +49 -0
  33. package/dist/types/components/navigation/IonTabsContext.d.ts +6 -0
  34. package/dist/types/components/proxies.d.ts +66 -0
  35. package/dist/types/components/react-component-lib/createComponent.d.ts +10 -0
  36. package/dist/types/components/react-component-lib/createOverlayComponent.d.ts +21 -0
  37. package/dist/types/components/react-component-lib/index.d.ts +2 -0
  38. package/dist/types/components/react-component-lib/interfaces.d.ts +29 -0
  39. package/dist/types/components/react-component-lib/utils/attachProps.d.ts +16 -0
  40. package/dist/types/components/react-component-lib/utils/case.d.ts +2 -0
  41. package/dist/types/components/react-component-lib/utils/dev.d.ts +2 -0
  42. package/dist/types/components/react-component-lib/utils/index.d.ts +10 -0
  43. package/dist/types/components/routing-proxies.d.ts +44 -0
  44. package/dist/types/components/utils/detachProps.d.ts +8 -0
  45. package/dist/types/components/utils/index.d.ts +8 -0
  46. package/dist/types/components/utils/ionRenderToString.d.ts +2 -0
  47. package/dist/types/contexts/IonContext.d.ts +7 -0
  48. package/dist/types/contexts/IonLifeCycleContext.d.ts +72 -0
  49. package/dist/types/contexts/NavContext.d.ts +17 -0
  50. package/dist/types/framework-delegate.d.ts +2 -0
  51. package/dist/types/hooks/HookOverlayOptions.d.ts +7 -0
  52. package/dist/types/hooks/__tests__/hooks.spec.d.ts +0 -0
  53. package/dist/types/hooks/useController.d.ts +12 -0
  54. package/dist/types/hooks/useIonActionSheet.d.ts +26 -0
  55. package/dist/types/hooks/useIonAlert.d.ts +26 -0
  56. package/dist/types/hooks/useIonLoading.d.ts +27 -0
  57. package/dist/types/hooks/useIonModal.d.ts +17 -0
  58. package/dist/types/hooks/useIonPicker.d.ts +26 -0
  59. package/dist/types/hooks/useIonPopover.d.ts +17 -0
  60. package/dist/types/hooks/useIonToast.d.ts +26 -0
  61. package/dist/types/hooks/useOverlay.d.ts +13 -0
  62. package/dist/types/index.d.ts +7 -0
  63. package/dist/types/lifecycle/IonLifeCycleHOC.d.ts +31 -0
  64. package/dist/types/lifecycle/hooks.d.ts +5 -0
  65. package/dist/types/lifecycle/index.d.ts +2 -0
  66. package/dist/types/models/ReactComponentOrElement.d.ts +2 -0
  67. package/dist/types/models/RouteAction.d.ts +1 -0
  68. package/dist/types/models/RouteInfo.d.ts +19 -0
  69. package/dist/types/models/RouterDirection.d.ts +1 -0
  70. package/dist/types/models/RouterOptions.d.ts +10 -0
  71. package/dist/types/models/index.d.ts +5 -0
  72. package/dist/types/routing/LocationHistory.d.ts +20 -0
  73. package/dist/types/routing/NavManager.d.ts +38 -0
  74. package/dist/types/routing/OutletPageManager.d.ts +26 -0
  75. package/dist/types/routing/PageManager.d.ts +25 -0
  76. package/dist/types/routing/RouteManagerContext.d.ts +16 -0
  77. package/dist/types/routing/StackContext.d.ts +7 -0
  78. package/dist/types/routing/ViewItem.d.ts +12 -0
  79. package/dist/types/routing/ViewLifeCycleManager.d.ts +42 -0
  80. package/dist/types/routing/ViewStacks.d.ts +19 -0
  81. package/dist/types/routing/__tests__/LocationHistory.spec.d.ts +1 -0
  82. package/dist/types/routing/index.d.ts +7 -0
  83. package/dist/types/utils/HTMLElementSSR.d.ts +4 -0
  84. package/dist/types/utils/generateId.d.ts +1 -0
  85. package/package.json +12 -5
  86. package/dist/components/CreateAnimation.js +0 -107
  87. package/dist/components/CreateAnimation.js.map +0 -7
  88. package/dist/components/IonActionSheet.js +0 -8
  89. package/dist/components/IonActionSheet.js.map +0 -7
  90. package/dist/components/IonAlert.js +0 -8
  91. package/dist/components/IonAlert.js.map +0 -7
  92. package/dist/components/IonApp.js +0 -42
  93. package/dist/components/IonApp.js.map +0 -7
  94. package/dist/components/IonIcon.js +0 -39
  95. package/dist/components/IonIcon.js.map +0 -7
  96. package/dist/components/IonLoading.js +0 -8
  97. package/dist/components/IonLoading.js.map +0 -7
  98. package/dist/components/IonModal.js +0 -9
  99. package/dist/components/IonModal.js.map +0 -7
  100. package/dist/components/IonOverlayManager.js +0 -29
  101. package/dist/components/IonOverlayManager.js.map +0 -7
  102. package/dist/components/IonPage.js +0 -31
  103. package/dist/components/IonPage.js.map +0 -7
  104. package/dist/components/IonPicker.js +0 -8
  105. package/dist/components/IonPicker.js.map +0 -7
  106. package/dist/components/IonPopover.js +0 -8
  107. package/dist/components/IonPopover.js.map +0 -7
  108. package/dist/components/IonRedirect.js +0 -19
  109. package/dist/components/IonRedirect.js.map +0 -7
  110. package/dist/components/IonRoute.js +0 -17
  111. package/dist/components/IonRoute.js.map +0 -7
  112. package/dist/components/IonRouterContext.js +0 -32
  113. package/dist/components/IonRouterContext.js.map +0 -7
  114. package/dist/components/IonRouterOutlet.js +0 -24
  115. package/dist/components/IonRouterOutlet.js.map +0 -7
  116. package/dist/components/IonToast.js +0 -8
  117. package/dist/components/IonToast.js.map +0 -7
  118. package/dist/components/IonicReactProps.js +0 -2
  119. package/dist/components/IonicReactProps.js.map +0 -7
  120. package/dist/components/__tests__/utils.spec.js +0 -50
  121. package/dist/components/__tests__/utils.spec.js.map +0 -7
  122. package/dist/components/createControllerComponent.js +0 -80
  123. package/dist/components/createControllerComponent.js.map +0 -7
  124. package/dist/components/createInlineOverlayComponent.js +0 -114
  125. package/dist/components/createInlineOverlayComponent.js.map +0 -7
  126. package/dist/components/createOverlayComponent.js +0 -88
  127. package/dist/components/createOverlayComponent.js.map +0 -7
  128. package/dist/components/createRoutingComponent.js +0 -79
  129. package/dist/components/createRoutingComponent.js.map +0 -7
  130. package/dist/components/hrefprops.js +0 -2
  131. package/dist/components/hrefprops.js.map +0 -7
  132. package/dist/components/index.js +0 -126
  133. package/dist/components/index.js.map +0 -7
  134. package/dist/components/inner-proxies.js +0 -30
  135. package/dist/components/inner-proxies.js.map +0 -7
  136. package/dist/components/navigation/IonBackButton.js +0 -31
  137. package/dist/components/navigation/IonBackButton.js.map +0 -7
  138. package/dist/components/navigation/IonNav.js +0 -21
  139. package/dist/components/navigation/IonNav.js.map +0 -7
  140. package/dist/components/navigation/IonTabBar.js +0 -173
  141. package/dist/components/navigation/IonTabBar.js.map +0 -7
  142. package/dist/components/navigation/IonTabButton.js +0 -30
  143. package/dist/components/navigation/IonTabButton.js.map +0 -7
  144. package/dist/components/navigation/IonTabs.js +0 -103
  145. package/dist/components/navigation/IonTabs.js.map +0 -7
  146. package/dist/components/navigation/IonTabsContext.js +0 -7
  147. package/dist/components/navigation/IonTabsContext.js.map +0 -7
  148. package/dist/components/proxies.js +0 -131
  149. package/dist/components/proxies.js.map +0 -7
  150. package/dist/components/react-component-lib/createComponent.js +0 -58
  151. package/dist/components/react-component-lib/createComponent.js.map +0 -7
  152. package/dist/components/react-component-lib/createOverlayComponent.js +0 -86
  153. package/dist/components/react-component-lib/createOverlayComponent.js.map +0 -7
  154. package/dist/components/react-component-lib/index.js +0 -4
  155. package/dist/components/react-component-lib/index.js.map +0 -7
  156. package/dist/components/react-component-lib/interfaces.js +0 -2
  157. package/dist/components/react-component-lib/interfaces.js.map +0 -7
  158. package/dist/components/react-component-lib/utils/attachProps.js +0 -92
  159. package/dist/components/react-component-lib/utils/attachProps.js.map +0 -7
  160. package/dist/components/react-component-lib/utils/case.js +0 -4
  161. package/dist/components/react-component-lib/utils/case.js.map +0 -7
  162. package/dist/components/react-component-lib/utils/dev.js +0 -14
  163. package/dist/components/react-component-lib/utils/dev.js.map +0 -7
  164. package/dist/components/react-component-lib/utils/index.js +0 -31
  165. package/dist/components/react-component-lib/utils/index.js.map +0 -7
  166. package/dist/components/routing-proxies.js +0 -29
  167. package/dist/components/routing-proxies.js.map +0 -7
  168. package/dist/components/utils/detachProps.js +0 -24
  169. package/dist/components/utils/detachProps.js.map +0 -7
  170. package/dist/components/utils/index.js +0 -26
  171. package/dist/components/utils/index.js.map +0 -7
  172. package/dist/components/utils/ionRenderToString.js +0 -36
  173. package/dist/components/utils/ionRenderToString.js.map +0 -7
  174. package/dist/contexts/IonContext.js +0 -11
  175. package/dist/contexts/IonContext.js.map +0 -7
  176. package/dist/contexts/IonLifeCycleContext.js +0 -185
  177. package/dist/contexts/IonLifeCycleContext.js.map +0 -7
  178. package/dist/contexts/NavContext.js +0 -36
  179. package/dist/contexts/NavContext.js.map +0 -7
  180. package/dist/framework-delegate.js +0 -30
  181. package/dist/framework-delegate.js.map +0 -7
  182. package/dist/hooks/HookOverlayOptions.js +0 -2
  183. package/dist/hooks/HookOverlayOptions.js.map +0 -7
  184. package/dist/hooks/__tests__/hooks.spec.js +0 -6
  185. package/dist/hooks/__tests__/hooks.spec.js.map +0 -7
  186. package/dist/hooks/useController.js +0 -45
  187. package/dist/hooks/useController.js.map +0 -7
  188. package/dist/hooks/useIonActionSheet.js +0 -27
  189. package/dist/hooks/useIonActionSheet.js.map +0 -7
  190. package/dist/hooks/useIonAlert.js +0 -23
  191. package/dist/hooks/useIonAlert.js.map +0 -7
  192. package/dist/hooks/useIonLoading.js +0 -28
  193. package/dist/hooks/useIonLoading.js.map +0 -7
  194. package/dist/hooks/useIonModal.js +0 -22
  195. package/dist/hooks/useIonModal.js.map +0 -7
  196. package/dist/hooks/useIonPicker.js +0 -27
  197. package/dist/hooks/useIonPicker.js.map +0 -7
  198. package/dist/hooks/useIonPopover.js +0 -22
  199. package/dist/hooks/useIonPopover.js.map +0 -7
  200. package/dist/hooks/useIonToast.js +0 -23
  201. package/dist/hooks/useIonToast.js.map +0 -7
  202. package/dist/hooks/useOverlay.js +0 -67
  203. package/dist/hooks/useOverlay.js.map +0 -7
  204. package/dist/lifecycle/IonLifeCycleHOC.js +0 -41
  205. package/dist/lifecycle/IonLifeCycleHOC.js.map +0 -7
  206. package/dist/lifecycle/hooks.js +0 -52
  207. package/dist/lifecycle/hooks.js.map +0 -7
  208. package/dist/lifecycle/index.js +0 -4
  209. package/dist/lifecycle/index.js.map +0 -7
  210. package/dist/models/ReactComponentOrElement.js +0 -2
  211. package/dist/models/ReactComponentOrElement.js.map +0 -7
  212. package/dist/models/RouteAction.js +0 -2
  213. package/dist/models/RouteAction.js.map +0 -7
  214. package/dist/models/RouteInfo.js +0 -2
  215. package/dist/models/RouteInfo.js.map +0 -7
  216. package/dist/models/RouterDirection.js +0 -2
  217. package/dist/models/RouterDirection.js.map +0 -7
  218. package/dist/models/RouterOptions.js +0 -2
  219. package/dist/models/RouterOptions.js.map +0 -7
  220. package/dist/models/index.js +0 -7
  221. package/dist/models/index.js.map +0 -7
  222. package/dist/routing/LocationHistory.js +0 -140
  223. package/dist/routing/LocationHistory.js.map +0 -7
  224. package/dist/routing/NavManager.js +0 -76
  225. package/dist/routing/NavManager.js.map +0 -7
  226. package/dist/routing/OutletPageManager.js +0 -69
  227. package/dist/routing/OutletPageManager.js.map +0 -7
  228. package/dist/routing/PageManager.js +0 -60
  229. package/dist/routing/PageManager.js.map +0 -7
  230. package/dist/routing/RouteManagerContext.js +0 -15
  231. package/dist/routing/RouteManagerContext.js.map +0 -7
  232. package/dist/routing/StackContext.js +0 -7
  233. package/dist/routing/StackContext.js.map +0 -7
  234. package/dist/routing/ViewItem.js +0 -2
  235. package/dist/routing/ViewItem.js.map +0 -7
  236. package/dist/routing/ViewLifeCycleManager.js +0 -36
  237. package/dist/routing/ViewLifeCycleManager.js.map +0 -7
  238. package/dist/routing/ViewStacks.js +0 -49
  239. package/dist/routing/ViewStacks.js.map +0 -7
  240. package/dist/routing/__tests__/LocationHistory.spec.js +0 -185
  241. package/dist/routing/__tests__/LocationHistory.spec.js.map +0 -7
  242. package/dist/routing/index.js +0 -9
  243. package/dist/routing/index.js.map +0 -7
  244. package/dist/utils/HTMLElementSSR.js +0 -4
  245. package/dist/utils/HTMLElementSSR.js.map +0 -7
  246. package/dist/utils/generateId.js +0 -8
  247. package/dist/utils/generateId.js.map +0 -7
package/dist/index.js CHANGED
@@ -1,9 +1,2444 @@
1
- "use strict";
2
- export * from "./lifecycle";
3
- export * from "./contexts/NavContext";
4
- export * from "./contexts/IonLifeCycleContext";
5
- export * from "./components";
6
- export * from "./routing";
7
- export * from "./models";
8
- export * from "./utils/generateId";
1
+ import React, { useContext, useRef, useEffect, createElement, useState, useMemo, Fragment, useCallback } from 'react';
2
+ import { isPlatform as isPlatform$1, getPlatforms as getPlatforms$1, componentOnReady, createAnimation, actionSheetController, alertController, toastController, modalController, popoverController, pickerController, loadingController, initialize } from '@ionic/core/components';
3
+ export { IonicSafeString, IonicSlides, createAnimation, createGesture, getIonPageElement, getTimeGivenProgression, iosTransitionAnimation, mdTransitionAnimation, openURL } from '@ionic/core/components';
4
+ import { __rest } from 'tslib';
5
+ import ReactDOM, { createPortal } from 'react-dom';
6
+ import { defineCustomElement as defineCustomElement$1 } from '@ionic/core/components/ion-accordion.js';
7
+ import { defineCustomElement as defineCustomElement$2 } from '@ionic/core/components/ion-accordion-group.js';
8
+ import { defineCustomElement as defineCustomElement$3 } from '@ionic/core/components/ion-avatar.js';
9
+ import { defineCustomElement as defineCustomElement$4 } from '@ionic/core/components/ion-backdrop.js';
10
+ import { defineCustomElement as defineCustomElement$5 } from '@ionic/core/components/ion-badge.js';
11
+ import { defineCustomElement as defineCustomElement$6 } from '@ionic/core/components/ion-breadcrumbs.js';
12
+ import { defineCustomElement as defineCustomElement$7 } from '@ionic/core/components/ion-buttons.js';
13
+ import { defineCustomElement as defineCustomElement$8 } from '@ionic/core/components/ion-card-content.js';
14
+ import { defineCustomElement as defineCustomElement$9 } from '@ionic/core/components/ion-card-header.js';
15
+ import { defineCustomElement as defineCustomElement$a } from '@ionic/core/components/ion-card-subtitle.js';
16
+ import { defineCustomElement as defineCustomElement$b } from '@ionic/core/components/ion-card-title.js';
17
+ import { defineCustomElement as defineCustomElement$c } from '@ionic/core/components/ion-checkbox.js';
18
+ import { defineCustomElement as defineCustomElement$d } from '@ionic/core/components/ion-chip.js';
19
+ import { defineCustomElement as defineCustomElement$e } from '@ionic/core/components/ion-col.js';
20
+ import { defineCustomElement as defineCustomElement$f } from '@ionic/core/components/ion-content.js';
21
+ import { defineCustomElement as defineCustomElement$g } from '@ionic/core/components/ion-datetime.js';
22
+ import { defineCustomElement as defineCustomElement$h } from '@ionic/core/components/ion-datetime-button.js';
23
+ import { defineCustomElement as defineCustomElement$i } from '@ionic/core/components/ion-fab.js';
24
+ import { defineCustomElement as defineCustomElement$j } from '@ionic/core/components/ion-fab-list.js';
25
+ import { defineCustomElement as defineCustomElement$k } from '@ionic/core/components/ion-footer.js';
26
+ import { defineCustomElement as defineCustomElement$l } from '@ionic/core/components/ion-grid.js';
27
+ import { defineCustomElement as defineCustomElement$m } from '@ionic/core/components/ion-header.js';
28
+ import { defineCustomElement as defineCustomElement$n } from '@ionic/core/components/ion-img.js';
29
+ import { defineCustomElement as defineCustomElement$o } from '@ionic/core/components/ion-infinite-scroll.js';
30
+ import { defineCustomElement as defineCustomElement$p } from '@ionic/core/components/ion-infinite-scroll-content.js';
31
+ import { defineCustomElement as defineCustomElement$q } from '@ionic/core/components/ion-input.js';
32
+ import { defineCustomElement as defineCustomElement$r } from '@ionic/core/components/ion-item-divider.js';
33
+ import { defineCustomElement as defineCustomElement$s } from '@ionic/core/components/ion-item-group.js';
34
+ import { defineCustomElement as defineCustomElement$t } from '@ionic/core/components/ion-item-options.js';
35
+ import { defineCustomElement as defineCustomElement$u } from '@ionic/core/components/ion-item-sliding.js';
36
+ import { defineCustomElement as defineCustomElement$v } from '@ionic/core/components/ion-label.js';
37
+ import { defineCustomElement as defineCustomElement$w } from '@ionic/core/components/ion-list.js';
38
+ import { defineCustomElement as defineCustomElement$x } from '@ionic/core/components/ion-list-header.js';
39
+ import { defineCustomElement as defineCustomElement$y } from '@ionic/core/components/ion-menu.js';
40
+ import { defineCustomElement as defineCustomElement$z } from '@ionic/core/components/ion-menu-button.js';
41
+ import { defineCustomElement as defineCustomElement$A } from '@ionic/core/components/ion-menu-toggle.js';
42
+ import { defineCustomElement as defineCustomElement$1d } from '@ionic/core/components/ion-nav.js';
43
+ import { defineCustomElement as defineCustomElement$B } from '@ionic/core/components/ion-nav-link.js';
44
+ import { defineCustomElement as defineCustomElement$C } from '@ionic/core/components/ion-note.js';
45
+ import { defineCustomElement as defineCustomElement$D } from '@ionic/core/components/ion-progress-bar.js';
46
+ import { defineCustomElement as defineCustomElement$E } from '@ionic/core/components/ion-radio.js';
47
+ import { defineCustomElement as defineCustomElement$F } from '@ionic/core/components/ion-radio-group.js';
48
+ import { defineCustomElement as defineCustomElement$G } from '@ionic/core/components/ion-range.js';
49
+ import { defineCustomElement as defineCustomElement$H } from '@ionic/core/components/ion-refresher.js';
50
+ import { defineCustomElement as defineCustomElement$I } from '@ionic/core/components/ion-refresher-content.js';
51
+ import { defineCustomElement as defineCustomElement$J } from '@ionic/core/components/ion-reorder.js';
52
+ import { defineCustomElement as defineCustomElement$K } from '@ionic/core/components/ion-reorder-group.js';
53
+ import { defineCustomElement as defineCustomElement$L } from '@ionic/core/components/ion-ripple-effect.js';
54
+ import { defineCustomElement as defineCustomElement$M } from '@ionic/core/components/ion-row.js';
55
+ import { defineCustomElement as defineCustomElement$N } from '@ionic/core/components/ion-searchbar.js';
56
+ import { defineCustomElement as defineCustomElement$O } from '@ionic/core/components/ion-segment.js';
57
+ import { defineCustomElement as defineCustomElement$P } from '@ionic/core/components/ion-segment-button.js';
58
+ import { defineCustomElement as defineCustomElement$Q } from '@ionic/core/components/ion-select.js';
59
+ import { defineCustomElement as defineCustomElement$R } from '@ionic/core/components/ion-select-option.js';
60
+ import { defineCustomElement as defineCustomElement$S } from '@ionic/core/components/ion-skeleton-text.js';
61
+ import { defineCustomElement as defineCustomElement$T } from '@ionic/core/components/ion-spinner.js';
62
+ import { defineCustomElement as defineCustomElement$U } from '@ionic/core/components/ion-split-pane.js';
63
+ import { defineCustomElement as defineCustomElement$V } from '@ionic/core/components/ion-tab.js';
64
+ import { defineCustomElement as defineCustomElement$W } from '@ionic/core/components/ion-text.js';
65
+ import { defineCustomElement as defineCustomElement$X } from '@ionic/core/components/ion-textarea.js';
66
+ import { defineCustomElement as defineCustomElement$Y } from '@ionic/core/components/ion-thumbnail.js';
67
+ import { defineCustomElement as defineCustomElement$Z } from '@ionic/core/components/ion-title.js';
68
+ import { defineCustomElement as defineCustomElement$_ } from '@ionic/core/components/ion-toggle.js';
69
+ import { defineCustomElement as defineCustomElement$$ } from '@ionic/core/components/ion-toolbar.js';
70
+ import { IonBreadcrumb as IonBreadcrumb$1 } from '@ionic/core/components/ion-breadcrumb.js';
71
+ import { IonButton as IonButton$1 } from '@ionic/core/components/ion-button.js';
72
+ import { IonCard as IonCard$1 } from '@ionic/core/components/ion-card.js';
73
+ import { IonFabButton as IonFabButton$1 } from '@ionic/core/components/ion-fab-button.js';
74
+ import { IonItemOption as IonItemOption$1 } from '@ionic/core/components/ion-item-option.js';
75
+ import { IonItem as IonItem$1 } from '@ionic/core/components/ion-item.js';
76
+ import { IonRouterLink as IonRouterLink$1 } from '@ionic/core/components/ion-router-link.js';
77
+ import { defineCustomElement as defineCustomElement$10 } from '@ionic/core/components/ion-alert.js';
78
+ import { defineCustomElement as defineCustomElement$11 } from '@ionic/core/components/ion-loading.js';
79
+ import { defineCustomElement as defineCustomElement$12 } from '@ionic/core/components/ion-toast.js';
80
+ import { defineCustomElement as defineCustomElement$13 } from '@ionic/core/components/ion-picker.js';
81
+ import { defineCustomElement as defineCustomElement$14 } from '@ionic/core/components/ion-action-sheet.js';
82
+ import { defineCustomElement as defineCustomElement$15 } from '@ionic/core/components/ion-modal.js';
83
+ import { defineCustomElement as defineCustomElement$16 } from '@ionic/core/components/ion-popover.js';
84
+ import { defineCustomElement as defineCustomElement$1c } from '@ionic/core/components/ion-app.js';
85
+ import { defineCustomElement as defineCustomElement$1b } from '@ionic/core/components/ion-back-button.js';
86
+ import { defineCustomElement as defineCustomElement$18 } from '@ionic/core/components/ion-router-outlet.js';
87
+ import { defineCustomElement as defineCustomElement$17 } from '@ionic/core/components/ion-tab-bar.js';
88
+ import { defineCustomElement as defineCustomElement$1a } from '@ionic/core/components/ion-tab-button.js';
89
+ import { defineCustomElement as defineCustomElement$19 } from 'ionicons/components/ion-icon.js';
90
+
91
+ const IonLifeCycleContext = /*@__PURE__*/ React.createContext({
92
+ onIonViewWillEnter: () => {
93
+ return;
94
+ },
95
+ ionViewWillEnter: () => {
96
+ return;
97
+ },
98
+ onIonViewDidEnter: () => {
99
+ return;
100
+ },
101
+ ionViewDidEnter: () => {
102
+ return;
103
+ },
104
+ onIonViewWillLeave: () => {
105
+ return;
106
+ },
107
+ ionViewWillLeave: () => {
108
+ return;
109
+ },
110
+ onIonViewDidLeave: () => {
111
+ return;
112
+ },
113
+ ionViewDidLeave: () => {
114
+ return;
115
+ },
116
+ cleanupIonViewWillEnter: () => {
117
+ return;
118
+ },
119
+ cleanupIonViewDidEnter: () => {
120
+ return;
121
+ },
122
+ cleanupIonViewWillLeave: () => {
123
+ return;
124
+ },
125
+ cleanupIonViewDidLeave: () => {
126
+ return;
127
+ },
128
+ });
129
+ const DefaultIonLifeCycleContext = class {
130
+ constructor() {
131
+ this.ionViewWillEnterCallbacks = [];
132
+ this.ionViewDidEnterCallbacks = [];
133
+ this.ionViewWillLeaveCallbacks = [];
134
+ this.ionViewDidLeaveCallbacks = [];
135
+ this.ionViewWillEnterDestructorCallbacks = [];
136
+ this.ionViewDidEnterDestructorCallbacks = [];
137
+ this.ionViewWillLeaveDestructorCallbacks = [];
138
+ this.ionViewDidLeaveDestructorCallbacks = [];
139
+ }
140
+ onIonViewWillEnter(callback) {
141
+ if (callback.id) {
142
+ const index = this.ionViewWillEnterCallbacks.findIndex((x) => x.id === callback.id);
143
+ if (index > -1) {
144
+ this.ionViewWillEnterCallbacks[index] = callback;
145
+ }
146
+ else {
147
+ this.ionViewWillEnterCallbacks.push(callback);
148
+ }
149
+ }
150
+ else {
151
+ this.ionViewWillEnterCallbacks.push(callback);
152
+ }
153
+ }
154
+ teardownCallback(callback, callbacks) {
155
+ // Find any destructors that have been registered for the callback
156
+ const matches = callbacks.filter((x) => x.id === callback.id);
157
+ if (matches.length !== 0) {
158
+ // Execute the destructor for each matching item
159
+ matches.forEach((match) => {
160
+ if (match && typeof match.destructor === 'function') {
161
+ match.destructor();
162
+ }
163
+ });
164
+ // Remove all matching items from the array
165
+ callbacks = callbacks.filter((x) => x.id !== callback.id);
166
+ }
167
+ }
168
+ /**
169
+ * Tears down the user-provided ionViewWillEnter lifecycle callback.
170
+ * This is the same behavior as React's useEffect hook. The callback
171
+ * is invoked when the component is unmounted.
172
+ */
173
+ cleanupIonViewWillEnter(callback) {
174
+ this.teardownCallback(callback, this.ionViewWillEnterDestructorCallbacks);
175
+ }
176
+ /**
177
+ * Tears down the user-provided ionViewDidEnter lifecycle callback.
178
+ * This is the same behavior as React's useEffect hook. The callback
179
+ * is invoked when the component is unmounted.
180
+ */
181
+ cleanupIonViewDidEnter(callback) {
182
+ this.teardownCallback(callback, this.ionViewDidEnterDestructorCallbacks);
183
+ }
184
+ /**
185
+ * Tears down the user-provided ionViewWillLeave lifecycle callback.
186
+ * This is the same behavior as React's useEffect hook. The callback
187
+ * is invoked when the component is unmounted.
188
+ */
189
+ cleanupIonViewWillLeave(callback) {
190
+ this.teardownCallback(callback, this.ionViewWillLeaveDestructorCallbacks);
191
+ }
192
+ /**
193
+ * Tears down the user-provided ionViewDidLeave lifecycle callback.
194
+ * This is the same behavior as React's useEffect hook. The callback
195
+ * is invoked when the component is unmounted.
196
+ */
197
+ cleanupIonViewDidLeave(callback) {
198
+ this.teardownCallback(callback, this.ionViewDidLeaveDestructorCallbacks);
199
+ }
200
+ ionViewWillEnter() {
201
+ this.ionViewWillEnterCallbacks.forEach((cb) => {
202
+ const destructor = cb();
203
+ if (cb.id) {
204
+ this.ionViewWillEnterDestructorCallbacks.push({ id: cb.id, destructor });
205
+ }
206
+ });
207
+ }
208
+ onIonViewDidEnter(callback) {
209
+ if (callback.id) {
210
+ const index = this.ionViewDidEnterCallbacks.findIndex((x) => x.id === callback.id);
211
+ if (index > -1) {
212
+ this.ionViewDidEnterCallbacks[index] = callback;
213
+ }
214
+ else {
215
+ this.ionViewDidEnterCallbacks.push(callback);
216
+ }
217
+ }
218
+ else {
219
+ this.ionViewDidEnterCallbacks.push(callback);
220
+ }
221
+ }
222
+ ionViewDidEnter() {
223
+ this.ionViewDidEnterCallbacks.forEach((cb) => {
224
+ const destructor = cb();
225
+ if (cb.id) {
226
+ this.ionViewDidEnterDestructorCallbacks.push({ id: cb.id, destructor });
227
+ }
228
+ });
229
+ }
230
+ onIonViewWillLeave(callback) {
231
+ if (callback.id) {
232
+ const index = this.ionViewWillLeaveCallbacks.findIndex((x) => x.id === callback.id);
233
+ if (index > -1) {
234
+ this.ionViewWillLeaveCallbacks[index] = callback;
235
+ }
236
+ else {
237
+ this.ionViewWillLeaveCallbacks.push(callback);
238
+ }
239
+ }
240
+ else {
241
+ this.ionViewWillLeaveCallbacks.push(callback);
242
+ }
243
+ }
244
+ ionViewWillLeave() {
245
+ this.ionViewWillLeaveCallbacks.forEach((cb) => {
246
+ const destructor = cb();
247
+ if (cb.id) {
248
+ this.ionViewWillLeaveDestructorCallbacks.push({ id: cb.id, destructor });
249
+ }
250
+ });
251
+ }
252
+ onIonViewDidLeave(callback) {
253
+ if (callback.id) {
254
+ const index = this.ionViewDidLeaveCallbacks.findIndex((x) => x.id === callback.id);
255
+ if (index > -1) {
256
+ this.ionViewDidLeaveCallbacks[index] = callback;
257
+ }
258
+ else {
259
+ this.ionViewDidLeaveCallbacks.push(callback);
260
+ }
261
+ }
262
+ else {
263
+ this.ionViewDidLeaveCallbacks.push(callback);
264
+ }
265
+ }
266
+ ionViewDidLeave() {
267
+ this.ionViewDidLeaveCallbacks.forEach((cb) => {
268
+ const destructor = cb();
269
+ if (cb.id) {
270
+ this.ionViewDidLeaveDestructorCallbacks.push({ id: cb.id, destructor });
271
+ }
272
+ });
273
+ this.componentCanBeDestroyed();
274
+ }
275
+ onComponentCanBeDestroyed(callback) {
276
+ this.componentCanBeDestroyedCallback = callback;
277
+ }
278
+ componentCanBeDestroyed() {
279
+ if (this.componentCanBeDestroyedCallback) {
280
+ this.componentCanBeDestroyedCallback();
281
+ }
282
+ }
283
+ };
284
+
285
+ // TODO(FW-2959): types
286
+ const withIonLifeCycle = (WrappedComponent) => {
287
+ return class IonLifeCycle extends React.Component {
288
+ constructor(props) {
289
+ super(props);
290
+ this.componentRef = React.createRef();
291
+ }
292
+ componentDidMount() {
293
+ const element = this.componentRef.current;
294
+ this.context.onIonViewWillEnter(() => {
295
+ if (element && element.ionViewWillEnter) {
296
+ element.ionViewWillEnter();
297
+ }
298
+ });
299
+ this.context.onIonViewDidEnter(() => {
300
+ if (element && element.ionViewDidEnter) {
301
+ element.ionViewDidEnter();
302
+ }
303
+ });
304
+ this.context.onIonViewWillLeave(() => {
305
+ if (element && element.ionViewWillLeave) {
306
+ element.ionViewWillLeave();
307
+ }
308
+ });
309
+ this.context.onIonViewDidLeave(() => {
310
+ if (element && element.ionViewDidLeave) {
311
+ element.ionViewDidLeave();
312
+ }
313
+ });
314
+ }
315
+ render() {
316
+ return (React.createElement(IonLifeCycleContext.Consumer, null, (context) => {
317
+ this.context = context;
318
+ return React.createElement(WrappedComponent, Object.assign({ ref: this.componentRef }, this.props));
319
+ }));
320
+ }
321
+ };
322
+ };
323
+
324
+ const useIonViewWillEnter = (callback, deps = []) => {
325
+ const context = useContext(IonLifeCycleContext);
326
+ const id = useRef();
327
+ id.current = id.current || Math.floor(Math.random() * 1000000);
328
+ useEffect(() => {
329
+ callback.id = id.current;
330
+ context.onIonViewWillEnter(callback);
331
+ return () => {
332
+ context.cleanupIonViewWillEnter(callback);
333
+ };
334
+ }, deps);
335
+ };
336
+ const useIonViewDidEnter = (callback, deps = []) => {
337
+ const context = useContext(IonLifeCycleContext);
338
+ const id = useRef();
339
+ id.current = id.current || Math.floor(Math.random() * 1000000);
340
+ useEffect(() => {
341
+ callback.id = id.current;
342
+ context.onIonViewDidEnter(callback);
343
+ return () => {
344
+ context.cleanupIonViewDidEnter(callback);
345
+ };
346
+ }, deps);
347
+ };
348
+ const useIonViewWillLeave = (callback, deps = []) => {
349
+ const context = useContext(IonLifeCycleContext);
350
+ const id = useRef();
351
+ id.current = id.current || Math.floor(Math.random() * 1000000);
352
+ useEffect(() => {
353
+ callback.id = id.current;
354
+ context.onIonViewWillLeave(callback);
355
+ return () => {
356
+ context.cleanupIonViewWillLeave(callback);
357
+ };
358
+ }, deps);
359
+ };
360
+ const useIonViewDidLeave = (callback, deps = []) => {
361
+ const context = useContext(IonLifeCycleContext);
362
+ const id = useRef();
363
+ id.current = id.current || Math.floor(Math.random() * 1000000);
364
+ useEffect(() => {
365
+ callback.id = id.current;
366
+ context.onIonViewDidLeave(callback);
367
+ return () => {
368
+ context.cleanupIonViewDidLeave(callback);
369
+ };
370
+ }, deps);
371
+ };
372
+
373
+ const NavContext = /*@__PURE__*/ React.createContext({
374
+ getIonRedirect: () => undefined,
375
+ getIonRoute: () => undefined,
376
+ getPageManager: () => undefined,
377
+ getStackManager: () => undefined,
378
+ goBack: (route) => {
379
+ if (typeof window !== 'undefined') {
380
+ if (typeof route === 'string') {
381
+ window.location.pathname = route;
382
+ }
383
+ else {
384
+ window.history.back();
385
+ }
386
+ }
387
+ },
388
+ navigate: (path) => {
389
+ if (typeof window !== 'undefined') {
390
+ window.location.pathname = path;
391
+ }
392
+ },
393
+ hasIonicRouter: () => false,
394
+ routeInfo: undefined,
395
+ setCurrentTab: () => undefined,
396
+ changeTab: (_tab, path) => {
397
+ if (typeof window !== 'undefined') {
398
+ window.location.pathname = path;
399
+ }
400
+ },
401
+ resetTab: (_tab, path) => {
402
+ if (typeof window !== 'undefined') {
403
+ window.location.pathname = path;
404
+ }
405
+ },
406
+ });
407
+
408
+ const dashToPascalCase = (str) => str
409
+ .toLowerCase()
410
+ .split('-')
411
+ .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
412
+ .join('');
413
+ const camelToDashCase = (str) => str.replace(/([A-Z])/g, (m) => `-${m[0].toLowerCase()}`);
414
+
415
+ const attachProps = (node, newProps, oldProps = {}) => {
416
+ // some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
417
+ if (node instanceof Element) {
418
+ // add any classes in className to the class list
419
+ const className = getClassName(node.classList, newProps, oldProps);
420
+ if (className !== '') {
421
+ node.className = className;
422
+ }
423
+ Object.keys(newProps).forEach((name) => {
424
+ if (name === 'children' ||
425
+ name === 'style' ||
426
+ name === 'ref' ||
427
+ name === 'class' ||
428
+ name === 'className' ||
429
+ name === 'forwardedRef') {
430
+ return;
431
+ }
432
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
433
+ const eventName = name.substring(2);
434
+ const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
435
+ if (!isCoveredByReact(eventNameLc)) {
436
+ syncEvent(node, eventNameLc, newProps[name]);
437
+ }
438
+ }
439
+ else {
440
+ node[name] = newProps[name];
441
+ const propType = typeof newProps[name];
442
+ if (propType === 'string') {
443
+ node.setAttribute(camelToDashCase(name), newProps[name]);
444
+ }
445
+ }
446
+ });
447
+ }
448
+ };
449
+ const getClassName = (classList, newProps, oldProps) => {
450
+ const newClassProp = newProps.className || newProps.class;
451
+ const oldClassProp = oldProps.className || oldProps.class;
452
+ // map the classes to Maps for performance
453
+ const currentClasses = arrayToMap(classList);
454
+ const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
455
+ const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
456
+ const finalClassNames = [];
457
+ // loop through each of the current classes on the component
458
+ // to see if it should be a part of the classNames added
459
+ currentClasses.forEach((currentClass) => {
460
+ if (incomingPropClasses.has(currentClass)) {
461
+ // add it as its already included in classnames coming in from newProps
462
+ finalClassNames.push(currentClass);
463
+ incomingPropClasses.delete(currentClass);
464
+ }
465
+ else if (!oldPropClasses.has(currentClass)) {
466
+ // add it as it has NOT been removed by user
467
+ finalClassNames.push(currentClass);
468
+ }
469
+ });
470
+ incomingPropClasses.forEach((s) => finalClassNames.push(s));
471
+ return finalClassNames.join(' ');
472
+ };
473
+ /**
474
+ * Transforms a React event name to a browser event name.
475
+ */
476
+ const transformReactEventName = (eventNameSuffix) => {
477
+ switch (eventNameSuffix) {
478
+ case 'doubleclick':
479
+ return 'dblclick';
480
+ }
481
+ return eventNameSuffix;
482
+ };
483
+ /**
484
+ * Checks if an event is supported in the current execution environment.
485
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
486
+ */
487
+ const isCoveredByReact = (eventNameSuffix) => {
488
+ if (typeof document === 'undefined') {
489
+ return true;
490
+ }
491
+ else {
492
+ const eventName = 'on' + transformReactEventName(eventNameSuffix);
493
+ let isSupported = eventName in document;
494
+ if (!isSupported) {
495
+ const element = document.createElement('div');
496
+ element.setAttribute(eventName, 'return;');
497
+ isSupported = typeof element[eventName] === 'function';
498
+ }
499
+ return isSupported;
500
+ }
501
+ };
502
+ const syncEvent = (node, eventName, newEventHandler) => {
503
+ const eventStore = node.__events || (node.__events = {});
504
+ const oldEventHandler = eventStore[eventName];
505
+ // Remove old listener so they don't double up.
506
+ if (oldEventHandler) {
507
+ node.removeEventListener(eventName, oldEventHandler);
508
+ }
509
+ // Bind new listener.
510
+ node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
511
+ if (newEventHandler) {
512
+ newEventHandler.call(this, e);
513
+ }
514
+ }));
515
+ };
516
+ const arrayToMap = (arr) => {
517
+ const map = new Map();
518
+ arr.forEach((s) => map.set(s, s));
519
+ return map;
520
+ };
521
+
522
+ const setRef = (ref, value) => {
523
+ if (typeof ref === 'function') {
524
+ ref(value);
525
+ }
526
+ else if (ref != null) {
527
+ // Cast as a MutableRef so we can assign current
528
+ ref.current = value;
529
+ }
530
+ };
531
+ const mergeRefs = (...refs) => {
532
+ return (value) => {
533
+ refs.forEach((ref) => {
534
+ setRef(ref, value);
535
+ });
536
+ };
537
+ };
538
+ const createForwardRef$1 = (ReactComponent, displayName) => {
539
+ const forwardRef = (props, ref) => {
540
+ return React.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
541
+ };
542
+ forwardRef.displayName = displayName;
543
+ return React.forwardRef(forwardRef);
544
+ };
545
+ const defineCustomElement = (tagName, customElement) => {
546
+ if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
547
+ customElements.define(tagName, customElement);
548
+ }
549
+ };
550
+
551
+ const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
552
+ if (defineCustomElement !== undefined) {
553
+ defineCustomElement();
554
+ }
555
+ const displayName = dashToPascalCase(tagName);
556
+ const ReactComponent = class extends React.Component {
557
+ constructor(props) {
558
+ super(props);
559
+ this.setComponentElRef = (element) => {
560
+ this.componentEl = element;
561
+ };
562
+ }
563
+ componentDidMount() {
564
+ this.componentDidUpdate(this.props);
565
+ }
566
+ componentDidUpdate(prevProps) {
567
+ attachProps(this.componentEl, this.props, prevProps);
568
+ }
569
+ render() {
570
+ const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
571
+ let propsToPass = Object.keys(cProps).reduce((acc, name) => {
572
+ const value = cProps[name];
573
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
574
+ const eventName = name.substring(2).toLowerCase();
575
+ if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
576
+ acc[name] = value;
577
+ }
578
+ }
579
+ else {
580
+ // we should only render strings, booleans, and numbers as attrs in html.
581
+ // objects, functions, arrays etc get synced via properties on mount.
582
+ const type = typeof value;
583
+ if (type === 'string' || type === 'boolean' || type === 'number') {
584
+ acc[camelToDashCase(name)] = value;
585
+ }
586
+ }
587
+ return acc;
588
+ }, {});
589
+ if (manipulatePropsFunction) {
590
+ propsToPass = manipulatePropsFunction(this.props, propsToPass);
591
+ }
592
+ const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
593
+ /**
594
+ * We use createElement here instead of
595
+ * React.createElement to work around a
596
+ * bug in Vite (https://github.com/vitejs/vite/issues/6104).
597
+ * React.createElement causes all elements to be rendered
598
+ * as <tagname> instead of the actual Web Component.
599
+ */
600
+ return createElement(tagName, newProps, children);
601
+ }
602
+ static get displayName() {
603
+ return displayName;
604
+ }
605
+ };
606
+ // If context was passed to createReactComponent then conditionally add it to the Component Class
607
+ if (ReactComponentContext) {
608
+ ReactComponent.contextType = ReactComponentContext;
609
+ }
610
+ return createForwardRef$1(ReactComponent, displayName);
611
+ };
612
+
613
+ /* eslint-disable */
614
+ const IonAccordion = /*@__PURE__*/ createReactComponent('ion-accordion', undefined, undefined, defineCustomElement$1);
615
+ const IonAccordionGroup = /*@__PURE__*/ createReactComponent('ion-accordion-group', undefined, undefined, defineCustomElement$2);
616
+ const IonAvatar = /*@__PURE__*/ createReactComponent('ion-avatar', undefined, undefined, defineCustomElement$3);
617
+ const IonBackdrop = /*@__PURE__*/ createReactComponent('ion-backdrop', undefined, undefined, defineCustomElement$4);
618
+ const IonBadge = /*@__PURE__*/ createReactComponent('ion-badge', undefined, undefined, defineCustomElement$5);
619
+ const IonBreadcrumbs = /*@__PURE__*/ createReactComponent('ion-breadcrumbs', undefined, undefined, defineCustomElement$6);
620
+ const IonButtons = /*@__PURE__*/ createReactComponent('ion-buttons', undefined, undefined, defineCustomElement$7);
621
+ const IonCardContent = /*@__PURE__*/ createReactComponent('ion-card-content', undefined, undefined, defineCustomElement$8);
622
+ const IonCardHeader = /*@__PURE__*/ createReactComponent('ion-card-header', undefined, undefined, defineCustomElement$9);
623
+ const IonCardSubtitle = /*@__PURE__*/ createReactComponent('ion-card-subtitle', undefined, undefined, defineCustomElement$a);
624
+ const IonCardTitle = /*@__PURE__*/ createReactComponent('ion-card-title', undefined, undefined, defineCustomElement$b);
625
+ const IonCheckbox = /*@__PURE__*/ createReactComponent('ion-checkbox', undefined, undefined, defineCustomElement$c);
626
+ const IonChip = /*@__PURE__*/ createReactComponent('ion-chip', undefined, undefined, defineCustomElement$d);
627
+ const IonCol = /*@__PURE__*/ createReactComponent('ion-col', undefined, undefined, defineCustomElement$e);
628
+ const IonContent = /*@__PURE__*/ createReactComponent('ion-content', undefined, undefined, defineCustomElement$f);
629
+ const IonDatetime = /*@__PURE__*/ createReactComponent('ion-datetime', undefined, undefined, defineCustomElement$g);
630
+ const IonDatetimeButton = /*@__PURE__*/ createReactComponent('ion-datetime-button', undefined, undefined, defineCustomElement$h);
631
+ const IonFab = /*@__PURE__*/ createReactComponent('ion-fab', undefined, undefined, defineCustomElement$i);
632
+ const IonFabList = /*@__PURE__*/ createReactComponent('ion-fab-list', undefined, undefined, defineCustomElement$j);
633
+ const IonFooter = /*@__PURE__*/ createReactComponent('ion-footer', undefined, undefined, defineCustomElement$k);
634
+ const IonGrid = /*@__PURE__*/ createReactComponent('ion-grid', undefined, undefined, defineCustomElement$l);
635
+ const IonHeader = /*@__PURE__*/ createReactComponent('ion-header', undefined, undefined, defineCustomElement$m);
636
+ const IonImg = /*@__PURE__*/ createReactComponent('ion-img', undefined, undefined, defineCustomElement$n);
637
+ const IonInfiniteScroll = /*@__PURE__*/ createReactComponent('ion-infinite-scroll', undefined, undefined, defineCustomElement$o);
638
+ const IonInfiniteScrollContent = /*@__PURE__*/ createReactComponent('ion-infinite-scroll-content', undefined, undefined, defineCustomElement$p);
639
+ const IonInput = /*@__PURE__*/ createReactComponent('ion-input', undefined, undefined, defineCustomElement$q);
640
+ const IonItemDivider = /*@__PURE__*/ createReactComponent('ion-item-divider', undefined, undefined, defineCustomElement$r);
641
+ const IonItemGroup = /*@__PURE__*/ createReactComponent('ion-item-group', undefined, undefined, defineCustomElement$s);
642
+ const IonItemOptions = /*@__PURE__*/ createReactComponent('ion-item-options', undefined, undefined, defineCustomElement$t);
643
+ const IonItemSliding = /*@__PURE__*/ createReactComponent('ion-item-sliding', undefined, undefined, defineCustomElement$u);
644
+ const IonLabel = /*@__PURE__*/ createReactComponent('ion-label', undefined, undefined, defineCustomElement$v);
645
+ const IonList = /*@__PURE__*/ createReactComponent('ion-list', undefined, undefined, defineCustomElement$w);
646
+ const IonListHeader = /*@__PURE__*/ createReactComponent('ion-list-header', undefined, undefined, defineCustomElement$x);
647
+ const IonMenu = /*@__PURE__*/ createReactComponent('ion-menu', undefined, undefined, defineCustomElement$y);
648
+ const IonMenuButton = /*@__PURE__*/ createReactComponent('ion-menu-button', undefined, undefined, defineCustomElement$z);
649
+ const IonMenuToggle = /*@__PURE__*/ createReactComponent('ion-menu-toggle', undefined, undefined, defineCustomElement$A);
650
+ const IonNavLink = /*@__PURE__*/ createReactComponent('ion-nav-link', undefined, undefined, defineCustomElement$B);
651
+ const IonNote = /*@__PURE__*/ createReactComponent('ion-note', undefined, undefined, defineCustomElement$C);
652
+ const IonProgressBar = /*@__PURE__*/ createReactComponent('ion-progress-bar', undefined, undefined, defineCustomElement$D);
653
+ const IonRadio = /*@__PURE__*/ createReactComponent('ion-radio', undefined, undefined, defineCustomElement$E);
654
+ const IonRadioGroup = /*@__PURE__*/ createReactComponent('ion-radio-group', undefined, undefined, defineCustomElement$F);
655
+ const IonRange = /*@__PURE__*/ createReactComponent('ion-range', undefined, undefined, defineCustomElement$G);
656
+ const IonRefresher = /*@__PURE__*/ createReactComponent('ion-refresher', undefined, undefined, defineCustomElement$H);
657
+ const IonRefresherContent = /*@__PURE__*/ createReactComponent('ion-refresher-content', undefined, undefined, defineCustomElement$I);
658
+ const IonReorder = /*@__PURE__*/ createReactComponent('ion-reorder', undefined, undefined, defineCustomElement$J);
659
+ const IonReorderGroup = /*@__PURE__*/ createReactComponent('ion-reorder-group', undefined, undefined, defineCustomElement$K);
660
+ const IonRippleEffect = /*@__PURE__*/ createReactComponent('ion-ripple-effect', undefined, undefined, defineCustomElement$L);
661
+ const IonRow = /*@__PURE__*/ createReactComponent('ion-row', undefined, undefined, defineCustomElement$M);
662
+ const IonSearchbar = /*@__PURE__*/ createReactComponent('ion-searchbar', undefined, undefined, defineCustomElement$N);
663
+ const IonSegment = /*@__PURE__*/ createReactComponent('ion-segment', undefined, undefined, defineCustomElement$O);
664
+ const IonSegmentButton = /*@__PURE__*/ createReactComponent('ion-segment-button', undefined, undefined, defineCustomElement$P);
665
+ const IonSelect = /*@__PURE__*/ createReactComponent('ion-select', undefined, undefined, defineCustomElement$Q);
666
+ const IonSelectOption = /*@__PURE__*/ createReactComponent('ion-select-option', undefined, undefined, defineCustomElement$R);
667
+ const IonSkeletonText = /*@__PURE__*/ createReactComponent('ion-skeleton-text', undefined, undefined, defineCustomElement$S);
668
+ const IonSpinner = /*@__PURE__*/ createReactComponent('ion-spinner', undefined, undefined, defineCustomElement$T);
669
+ const IonSplitPane = /*@__PURE__*/ createReactComponent('ion-split-pane', undefined, undefined, defineCustomElement$U);
670
+ const IonTab = /*@__PURE__*/ createReactComponent('ion-tab', undefined, undefined, defineCustomElement$V);
671
+ const IonText = /*@__PURE__*/ createReactComponent('ion-text', undefined, undefined, defineCustomElement$W);
672
+ const IonTextarea = /*@__PURE__*/ createReactComponent('ion-textarea', undefined, undefined, defineCustomElement$X);
673
+ const IonThumbnail = /*@__PURE__*/ createReactComponent('ion-thumbnail', undefined, undefined, defineCustomElement$Y);
674
+ const IonTitle = /*@__PURE__*/ createReactComponent('ion-title', undefined, undefined, defineCustomElement$Z);
675
+ const IonToggle = /*@__PURE__*/ createReactComponent('ion-toggle', undefined, undefined, defineCustomElement$_);
676
+ const IonToolbar = /*@__PURE__*/ createReactComponent('ion-toolbar', undefined, undefined, defineCustomElement$$);
677
+
678
+ const createForwardRef = (ReactComponent, // TODO(FW-2959): type
679
+ displayName) => {
680
+ const forwardRef = (props, ref) => {
681
+ return React.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
682
+ };
683
+ forwardRef.displayName = displayName;
684
+ return React.forwardRef(forwardRef);
685
+ };
686
+ const isPlatform = (platform) => {
687
+ return isPlatform$1(window, platform);
688
+ };
689
+ const getPlatforms = () => {
690
+ return getPlatforms$1(window);
691
+ };
692
+ const getConfig = () => {
693
+ if (typeof window !== 'undefined') {
694
+ const Ionic = window.Ionic;
695
+ if (Ionic && Ionic.config) {
696
+ return Ionic.config;
697
+ }
698
+ }
699
+ return null;
700
+ };
701
+
702
+ const createRoutingComponent = (tagName, customElement) => {
703
+ defineCustomElement(tagName, customElement);
704
+ const displayName = dashToPascalCase(tagName);
705
+ const ReactComponent = class extends React.Component {
706
+ constructor(props) {
707
+ super(props);
708
+ this.handleClick = (e) => {
709
+ const { routerLink, routerDirection, routerOptions, routerAnimation } = this.props;
710
+ if (routerLink !== undefined) {
711
+ e.preventDefault();
712
+ this.context.navigate(routerLink, routerDirection, undefined, routerAnimation, routerOptions);
713
+ }
714
+ };
715
+ // Create a local ref to to attach props to the wrapped element.
716
+ this.ref = React.createRef();
717
+ // React refs must be stable (not created inline).
718
+ this.stableMergedRefs = mergeRefs(this.ref, this.props.forwardedRef);
719
+ }
720
+ componentDidMount() {
721
+ this.componentDidUpdate(this.props);
722
+ }
723
+ componentDidUpdate(prevProps) {
724
+ const node = this.ref.current;
725
+ attachProps(node, this.props, prevProps);
726
+ }
727
+ render() {
728
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
729
+ const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
730
+ const propsToPass = Object.keys(cProps).reduce((acc, name) => {
731
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
732
+ const eventName = name.substring(2).toLowerCase();
733
+ if (isCoveredByReact(eventName)) {
734
+ acc[name] = cProps[name];
735
+ }
736
+ }
737
+ else if (['string', 'boolean', 'number'].includes(typeof cProps[name])) {
738
+ acc[camelToDashCase(name)] = cProps[name];
739
+ }
740
+ return acc;
741
+ }, {});
742
+ const newProps = Object.assign(Object.assign({}, propsToPass), { ref: this.stableMergedRefs, style });
743
+ if (this.props.routerLink && !this.props.href) {
744
+ newProps.href = this.props.routerLink;
745
+ }
746
+ if (newProps.onClick) {
747
+ const oldClick = newProps.onClick;
748
+ newProps.onClick = (e) => {
749
+ oldClick(e);
750
+ if (!e.defaultPrevented) {
751
+ this.handleClick(e);
752
+ }
753
+ };
754
+ }
755
+ else {
756
+ newProps.onClick = this.handleClick;
757
+ }
758
+ return createElement(tagName, newProps, children);
759
+ }
760
+ static get displayName() {
761
+ return displayName;
762
+ }
763
+ static get contextType() {
764
+ return NavContext;
765
+ }
766
+ };
767
+ return createForwardRef(ReactComponent, displayName);
768
+ };
769
+
770
+ const IonRouterLink = /*@__PURE__*/ createRoutingComponent('ion-router-link', IonRouterLink$1);
771
+ const IonButton = /*@__PURE__*/ createRoutingComponent('ion-button', IonButton$1);
772
+ const IonCard = /*@__PURE__*/ createRoutingComponent('ion-card', IonCard$1);
773
+ const IonFabButton = /*@__PURE__*/ createRoutingComponent('ion-fab-button', IonFabButton$1);
774
+ const IonItem = /*@__PURE__*/ createRoutingComponent('ion-item', IonItem$1);
775
+ const IonItemOption = /*@__PURE__*/ createRoutingComponent('ion-item-option', IonItemOption$1);
776
+ const IonBreadcrumb = /*@__PURE__*/ createRoutingComponent('ion-breadcrumb', IonBreadcrumb$1);
777
+
778
+ /**
779
+ * The @stencil/react-output-target will bind event listeners for any
780
+ * attached props that use the `on` prefix. This function will remove
781
+ * those event listeners when the component is unmounted.
782
+ *
783
+ * This prevents memory leaks and React state updates on unmounted components.
784
+ */
785
+ const detachProps = (node, props) => {
786
+ if (node instanceof Element) {
787
+ Object.keys(props).forEach((name) => {
788
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
789
+ const eventName = name.substring(2);
790
+ const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
791
+ if (!isCoveredByReact(eventNameLc)) {
792
+ /**
793
+ * Detach custom event bindings (not built-in React events)
794
+ * that were added by the @stencil/react-output-target attachProps function.
795
+ */
796
+ detachEvent(node, eventNameLc);
797
+ }
798
+ }
799
+ });
800
+ }
801
+ };
802
+ const detachEvent = (node, eventName) => {
803
+ const eventStore = node.__events || (node.__events = {});
804
+ /**
805
+ * If the event listener was added by attachProps, it will
806
+ * be stored in the __events object.
807
+ */
808
+ const eventHandler = eventStore[eventName];
809
+ if (eventHandler) {
810
+ node.removeEventListener(eventName, eventHandler);
811
+ eventStore[eventName] = undefined;
812
+ }
813
+ };
814
+
815
+ const createInlineOverlayComponent = (tagName, defineCustomElement, hasDelegateHost) => {
816
+ if (defineCustomElement) {
817
+ defineCustomElement();
818
+ }
819
+ const displayName = dashToPascalCase(tagName);
820
+ const ReactComponent = class extends React.Component {
821
+ constructor(props) {
822
+ super(props);
823
+ this.handleIonMount = () => {
824
+ /**
825
+ * Mount the inner component when the
826
+ * overlay is about to open.
827
+ *
828
+ * For ion-popover, this is when `ionMount` is emitted.
829
+ * For other overlays, this is when `willPresent` is emitted.
830
+ */
831
+ this.setState({ isOpen: true });
832
+ };
833
+ this.handleWillPresent = (evt) => {
834
+ this.setState({ isOpen: true });
835
+ /**
836
+ * Manually call the onWillPresent
837
+ * handler if present as setState will
838
+ * cause the event handlers to be
839
+ * destroyed and re-created.
840
+ */
841
+ this.props.onWillPresent && this.props.onWillPresent(evt);
842
+ };
843
+ this.handleDidDismiss = (evt) => {
844
+ const wrapper = this.wrapperRef.current;
845
+ const el = this.ref.current;
846
+ /**
847
+ * This component might be unmounted already, if the containing
848
+ * element was removed while the overlay was still open. (For
849
+ * example, if an item contains an inline overlay with a button
850
+ * that removes the item.)
851
+ */
852
+ if (wrapper && el) {
853
+ el.append(wrapper);
854
+ this.setState({ isOpen: false });
855
+ }
856
+ this.props.onDidDismiss && this.props.onDidDismiss(evt);
857
+ };
858
+ // Create a local ref to to attach props to the wrapped element.
859
+ this.ref = React.createRef();
860
+ // React refs must be stable (not created inline).
861
+ this.stableMergedRefs = mergeRefs(this.ref, this.props.forwardedRef);
862
+ // Component is hidden by default
863
+ this.state = { isOpen: false };
864
+ // Create a local ref to the inner child element.
865
+ this.wrapperRef = React.createRef();
866
+ }
867
+ componentDidMount() {
868
+ var _a, _b, _c;
869
+ this.componentDidUpdate(this.props);
870
+ (_a = this.ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener('ionMount', this.handleIonMount);
871
+ (_b = this.ref.current) === null || _b === void 0 ? void 0 : _b.addEventListener('willPresent', this.handleWillPresent);
872
+ (_c = this.ref.current) === null || _c === void 0 ? void 0 : _c.addEventListener('didDismiss', this.handleDidDismiss);
873
+ }
874
+ componentDidUpdate(prevProps) {
875
+ const node = this.ref.current;
876
+ /**
877
+ * onDidDismiss and onWillPresent have manual implementations that
878
+ * will invoke the original handler. We need to filter those out
879
+ * so they don't get attached twice and called twice.
880
+ */
881
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
882
+ const _a = this.props, cProps = __rest(_a, ["onDidDismiss", "onWillPresent"]);
883
+ attachProps(node, cProps, prevProps);
884
+ }
885
+ componentWillUnmount() {
886
+ const node = this.ref.current;
887
+ /**
888
+ * If the overlay is being unmounted, but is still
889
+ * open, this means the unmount was triggered outside
890
+ * of the overlay being dismissed.
891
+ *
892
+ * This can happen with:
893
+ * - The parent component being unmounted
894
+ * - The overlay being conditionally rendered
895
+ * - A route change (push/pop/replace)
896
+ *
897
+ * Unmounting the overlay at this stage should skip
898
+ * the dismiss lifecycle, including skipping the transition.
899
+ *
900
+ */
901
+ if (node && this.state.isOpen) {
902
+ /**
903
+ * Detach the local event listener that performs the state updates,
904
+ * before dismissing the overlay, to prevent the callback handlers
905
+ * executing after the component has been unmounted. This is to
906
+ * avoid memory leaks.
907
+ */
908
+ node.removeEventListener('didDismiss', this.handleDidDismiss);
909
+ node.remove();
910
+ detachProps(node, this.props);
911
+ }
912
+ }
913
+ render() {
914
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
915
+ const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
916
+ const propsToPass = Object.keys(cProps).reduce((acc, name) => {
917
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
918
+ const eventName = name.substring(2).toLowerCase();
919
+ if (isCoveredByReact(eventName)) {
920
+ acc[name] = cProps[name];
921
+ }
922
+ }
923
+ else if (['string', 'boolean', 'number'].includes(typeof cProps[name])) {
924
+ acc[camelToDashCase(name)] = cProps[name];
925
+ }
926
+ return acc;
927
+ }, {});
928
+ const newProps = Object.assign(Object.assign({}, propsToPass), { ref: this.stableMergedRefs, style });
929
+ /**
930
+ * Some overlays need `.ion-page` so content
931
+ * takes up the full size of the parent overlay.
932
+ */
933
+ const getWrapperClasses = () => {
934
+ if (hasDelegateHost) {
935
+ return `${DELEGATE_HOST} ion-page`;
936
+ }
937
+ return DELEGATE_HOST;
938
+ };
939
+ return createElement('template', {}, createElement(tagName, newProps,
940
+ /**
941
+ * We only want the inner component
942
+ * to be mounted if the overlay is open,
943
+ * so conditionally render the component
944
+ * based on the isOpen state.
945
+ */
946
+ this.state.isOpen || this.props.keepContentsMounted
947
+ ? createElement('div', {
948
+ ref: this.wrapperRef,
949
+ className: getWrapperClasses(),
950
+ }, children)
951
+ : null));
952
+ }
953
+ static get displayName() {
954
+ return displayName;
955
+ }
956
+ };
957
+ return createForwardRef(ReactComponent, displayName);
958
+ };
959
+ const DELEGATE_HOST = 'ion-delegate-host';
960
+
961
+ const IonAlert = /*@__PURE__*/ createInlineOverlayComponent('ion-alert', defineCustomElement$10);
962
+
963
+ const IonLoading = /*@__PURE__*/ createInlineOverlayComponent('ion-loading', defineCustomElement$11);
964
+
965
+ const IonToast = /*@__PURE__*/ createInlineOverlayComponent('ion-toast', defineCustomElement$12);
966
+
967
+ const IonPicker = /*@__PURE__*/ createInlineOverlayComponent('ion-picker', defineCustomElement$13);
968
+
969
+ const IonActionSheet = /*@__PURE__*/ createInlineOverlayComponent('ion-action-sheet', defineCustomElement$14);
970
+
971
+ const IonModal = /*@__PURE__*/ createInlineOverlayComponent('ion-modal', defineCustomElement$15, true);
972
+
973
+ const IonPopover = /*@__PURE__*/ createInlineOverlayComponent('ion-popover', defineCustomElement$16);
974
+
975
+ const IonContext = React.createContext({
976
+ addOverlay: () => {
977
+ return;
978
+ },
979
+ removeOverlay: () => {
980
+ return;
981
+ },
982
+ });
983
+
984
+ /**
985
+ * Manages overlays that are added via the useOverlay hook.
986
+ * This is a standalone component so changes to its children don't cause other descendant
987
+ * components to re-render when overlays are added. However, we need to communicate with the IonContext
988
+ * that is set up in <IonApp />, so we register callbacks so when overlays are added to IonContext,
989
+ * they ultimately added here.
990
+ */
991
+ const IonOverlayManager = ({ onAddOverlay, onRemoveOverlay }) => {
992
+ /**
993
+ * Because of the way we're passing around the addOverlay and removeOverlay
994
+ * callbacks, by the time they finally get called, they use a stale reference
995
+ * to the state that only has the initial values. So if two overlays are opened
996
+ * at the same time, both using useIonModal or similar (such as through nesting),
997
+ * the second will erase the first from the overlays list. This causes the content
998
+ * of the first overlay to unmount.
999
+ *
1000
+ * We wrap the state in useRef to ensure the two callbacks always use the most
1001
+ * up-to-date version.
1002
+ *
1003
+ * Further reading: https://stackoverflow.com/a/56554056
1004
+ */
1005
+ const [overlays, setOverlays] = useState({});
1006
+ const overlaysRef = useRef({});
1007
+ useEffect(() => {
1008
+ /* Setup the callbacks that get called from <IonApp /> */
1009
+ onAddOverlay(addOverlay);
1010
+ onRemoveOverlay(removeOverlay);
1011
+ }, []);
1012
+ const addOverlay = (id, component, containerElement) => {
1013
+ const newOverlays = Object.assign({}, overlaysRef.current);
1014
+ newOverlays[id] = { component, containerElement };
1015
+ /**
1016
+ * In order for this function to use the latest data
1017
+ * we need to update the ref synchronously.
1018
+ * However, updating a ref does not cause a re-render
1019
+ * which is why we still update the state.
1020
+ *
1021
+ * Note that updating the ref in the body
1022
+ * of IonOverlayManager is not sufficient
1023
+ * because that relies on overlaysRef being
1024
+ * updated as part of React's render loop. State updates
1025
+ * are batched, so updating the state twice in quick succession does
1026
+ * not necessarily result in 2 separate render calls.
1027
+ * This means if two modals are added one after the other,
1028
+ * the first modal will not have been added to
1029
+ * overlaysRef since React has not re-rendered yet.
1030
+ * More info: https://react.dev/reference/react/useState#setstate-caveats
1031
+ */
1032
+ overlaysRef.current = newOverlays;
1033
+ setOverlays(newOverlays);
1034
+ };
1035
+ const removeOverlay = (id) => {
1036
+ const newOverlays = Object.assign({}, overlaysRef.current);
1037
+ delete newOverlays[id];
1038
+ /**
1039
+ * In order for this function to use the latest data
1040
+ * we need to update the ref synchronously.
1041
+ * However, updating a ref does not cause a re-render
1042
+ * which is why we still update the state.
1043
+ *
1044
+ * Note that updating the ref in the body
1045
+ * of IonOverlayManager is not sufficient
1046
+ * because that relies on overlaysRef being
1047
+ * updated as part of React's render loop. State updates
1048
+ * are batched, so updating the state twice in quick succession does
1049
+ * not necessarily result in 2 separate render calls.
1050
+ * This means if two modals are added one after the other,
1051
+ * the first modal will not have been added to
1052
+ * overlaysRef since React has not re-rendered yet.
1053
+ * More info: https://react.dev/reference/react/useState#setstate-caveats
1054
+ */
1055
+ overlaysRef.current = newOverlays;
1056
+ setOverlays(newOverlays);
1057
+ };
1058
+ const overlayKeys = Object.keys(overlays);
1059
+ return (React.createElement(React.Fragment, null, overlayKeys.map((key) => {
1060
+ const overlay = overlays[key];
1061
+ return ReactDOM.createPortal(overlay.component, overlay.containerElement, `overlay-${key}`);
1062
+ })));
1063
+ };
1064
+
1065
+ const IonTabButtonInner = /*@__PURE__*/ createReactComponent('ion-tab-button', undefined, undefined, defineCustomElement$1a);
1066
+ const IonTabBarInner = /*@__PURE__*/ createReactComponent('ion-tab-bar', undefined, undefined, defineCustomElement$17);
1067
+ const IonBackButtonInner = /*@__PURE__*/ createReactComponent('ion-back-button', undefined, undefined, defineCustomElement$1b);
1068
+ const IonRouterOutletInner = /*@__PURE__*/ createReactComponent('ion-router-outlet', undefined, undefined, defineCustomElement$18);
1069
+ const IonAppInner = /*@__PURE__*/ createReactComponent('ion-app', undefined, undefined, defineCustomElement$1c);
1070
+ // ionicons
1071
+ const IonIconInner = /*@__PURE__*/ createReactComponent('ion-icon', undefined, undefined, defineCustomElement$19);
1072
+
1073
+ const IonApp = /*@__PURE__*/ (() => class extends React.Component {
1074
+ constructor(props) {
1075
+ super(props);
1076
+ /*
1077
+ Wire up methods to call into IonOverlayManager
1078
+ */
1079
+ this.ionContext = {
1080
+ addOverlay: (id, overlay, containerElement) => {
1081
+ if (this.addOverlayCallback) {
1082
+ this.addOverlayCallback(id, overlay, containerElement);
1083
+ }
1084
+ },
1085
+ removeOverlay: (id) => {
1086
+ if (this.removeOverlayCallback) {
1087
+ this.removeOverlayCallback(id);
1088
+ }
1089
+ },
1090
+ };
1091
+ }
1092
+ render() {
1093
+ return (React.createElement(IonContext.Provider, { value: this.ionContext },
1094
+ React.createElement(IonAppInner, Object.assign({}, this.props), this.props.children),
1095
+ React.createElement(IonOverlayManager, { onAddOverlay: (callback) => {
1096
+ this.addOverlayCallback = callback;
1097
+ }, onRemoveOverlay: (callback) => {
1098
+ this.removeOverlayCallback = callback;
1099
+ } })));
1100
+ }
1101
+ static get displayName() {
1102
+ return 'IonApp';
1103
+ }
1104
+ })();
1105
+
1106
+ const StackContext = React.createContext({
1107
+ registerIonPage: () => undefined,
1108
+ isInOutlet: () => false,
1109
+ });
1110
+
1111
+ class PageManager extends React.PureComponent {
1112
+ constructor(props) {
1113
+ super(props);
1114
+ this.ionPageElementRef = React.createRef();
1115
+ // React refs must be stable (not created inline).
1116
+ this.stableMergedRefs = mergeRefs(this.ionPageElementRef, this.props.forwardedRef);
1117
+ /**
1118
+ * This binds the scope of the following methods to the class scope.
1119
+ * The `.bind` method returns a new function, so we need to assign it
1120
+ * in the constructor rather than when adding or removing the listeners
1121
+ * to avoid creating a new function.
1122
+ */
1123
+ this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);
1124
+ this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);
1125
+ this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);
1126
+ this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);
1127
+ }
1128
+ componentDidMount() {
1129
+ if (this.ionPageElementRef.current) {
1130
+ if (this.context.isInOutlet()) {
1131
+ this.ionPageElementRef.current.classList.add('ion-page-invisible');
1132
+ }
1133
+ this.context.registerIonPage(this.ionPageElementRef.current, this.props.routeInfo);
1134
+ this.ionPageElementRef.current.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
1135
+ this.ionPageElementRef.current.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
1136
+ this.ionPageElementRef.current.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
1137
+ this.ionPageElementRef.current.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
1138
+ }
1139
+ }
1140
+ componentWillUnmount() {
1141
+ if (this.ionPageElementRef.current) {
1142
+ this.ionPageElementRef.current.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
1143
+ this.ionPageElementRef.current.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
1144
+ this.ionPageElementRef.current.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
1145
+ this.ionPageElementRef.current.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
1146
+ }
1147
+ }
1148
+ ionViewWillEnterHandler() {
1149
+ this.ionLifeCycleContext.ionViewWillEnter();
1150
+ }
1151
+ ionViewDidEnterHandler() {
1152
+ this.ionLifeCycleContext.ionViewDidEnter();
1153
+ }
1154
+ ionViewWillLeaveHandler() {
1155
+ this.ionLifeCycleContext.ionViewWillLeave();
1156
+ }
1157
+ ionViewDidLeaveHandler() {
1158
+ this.ionLifeCycleContext.ionViewDidLeave();
1159
+ }
1160
+ render() {
1161
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1162
+ const _a = this.props, { className, children, routeInfo, forwardedRef } = _a, props = __rest(_a, ["className", "children", "routeInfo", "forwardedRef"]);
1163
+ return (React.createElement(IonLifeCycleContext.Consumer, null, (context) => {
1164
+ this.ionLifeCycleContext = context;
1165
+ return (React.createElement("div", Object.assign({ className: className ? `${className} ion-page` : `ion-page`, ref: this.stableMergedRefs }, props), children));
1166
+ }));
1167
+ }
1168
+ static get contextType() {
1169
+ return StackContext;
1170
+ }
1171
+ }
1172
+
1173
+ class IonPageInternal extends React.Component {
1174
+ constructor(props) {
1175
+ super(props);
1176
+ }
1177
+ render() {
1178
+ const _a = this.props, { className, children, forwardedRef } = _a, props = __rest(_a, ["className", "children", "forwardedRef"]);
1179
+ return this.context.hasIonicRouter() ? (React.createElement(PageManager, Object.assign({ className: className ? `${className}` : '', routeInfo: this.context.routeInfo, forwardedRef: forwardedRef }, props), children)) : (React.createElement("div", Object.assign({ className: className ? `ion-page ${className}` : 'ion-page', ref: forwardedRef }, props), children));
1180
+ }
1181
+ static get displayName() {
1182
+ return 'IonPage';
1183
+ }
1184
+ static get contextType() {
1185
+ return NavContext;
1186
+ }
1187
+ }
1188
+ const IonPage = createForwardRef(IonPageInternal, 'IonPage');
1189
+
1190
+ const ids = { main: 0 };
1191
+ const generateId = (type = 'main') => {
1192
+ var _a;
1193
+ const id = ((_a = ids[type]) !== null && _a !== void 0 ? _a : 0) + 1;
1194
+ ids[type] = id;
1195
+ return id.toString();
1196
+ };
1197
+
1198
+ const ReactDelegate = (addView, removeView) => {
1199
+ const refMap = new WeakMap();
1200
+ const reactDelegateId = `react-delegate-${generateId()}`;
1201
+ // Incrementing counter to generate unique keys for each view
1202
+ let id = 0;
1203
+ const attachViewToDom = async (parentElement, component, propsOrDataObj, cssClasses) => {
1204
+ const div = document.createElement('div');
1205
+ cssClasses && div.classList.add(...cssClasses);
1206
+ parentElement.appendChild(div);
1207
+ const componentWithProps = component(propsOrDataObj);
1208
+ const key = `${reactDelegateId}-${id++}`;
1209
+ const hostComponent = createPortal(componentWithProps, div, key);
1210
+ refMap.set(div, hostComponent);
1211
+ addView(hostComponent);
1212
+ return Promise.resolve(div);
1213
+ };
1214
+ const removeViewFromDom = (_container, component) => {
1215
+ const hostComponent = refMap.get(component);
1216
+ hostComponent && removeView(hostComponent);
1217
+ component.remove();
1218
+ return Promise.resolve();
1219
+ };
1220
+ return {
1221
+ attachViewToDom,
1222
+ removeViewFromDom,
1223
+ };
1224
+ };
1225
+
1226
+ const IonNavInner = createReactComponent('ion-nav', undefined, undefined, defineCustomElement$1d);
1227
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1228
+ const IonNavInternal = (_a) => {
1229
+ var { children, forwardedRef } = _a, restOfProps = __rest(_a, ["children", "forwardedRef"]);
1230
+ const [views, setViews] = useState([]);
1231
+ /**
1232
+ * Allows us to create React components that are rendered within
1233
+ * the context of the IonNav component.
1234
+ */
1235
+ const addView = (view) => setViews((existingViews) => [...existingViews, view]);
1236
+ const removeView = (view) => setViews((existingViews) => existingViews.filter((v) => v !== view));
1237
+ const delegate = useMemo(() => ReactDelegate(addView, removeView), []);
1238
+ return (React.createElement(IonNavInner, Object.assign({ delegate: delegate, ref: forwardedRef }, restOfProps), views));
1239
+ };
1240
+ const IonNav = createForwardRef(IonNavInternal, 'IonNav');
1241
+
1242
+ const IonTabsContext = React.createContext({
1243
+ activeTab: undefined,
1244
+ selectTab: () => false,
1245
+ });
1246
+
1247
+ const HTMLElementSSR = (typeof HTMLElement !== 'undefined' ? HTMLElement : class {
1248
+ });
1249
+
1250
+ class OutletPageManager extends React.Component {
1251
+ constructor(props) {
1252
+ super(props);
1253
+ this.outletIsReady = false;
1254
+ /**
1255
+ * This binds the scope of the following methods to the class scope.
1256
+ * The `.bind` method returns a new function, so we need to assign it
1257
+ * in the constructor rather than when adding or removing the listeners
1258
+ * to avoid creating a new function.
1259
+ */
1260
+ this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);
1261
+ this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);
1262
+ this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);
1263
+ this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);
1264
+ }
1265
+ componentDidMount() {
1266
+ if (this.ionRouterOutlet) {
1267
+ /**
1268
+ * This avoids multiple raf calls
1269
+ * when React unmounts + remounts components.
1270
+ */
1271
+ if (!this.outletIsReady) {
1272
+ componentOnReady(this.ionRouterOutlet, () => {
1273
+ this.outletIsReady = true;
1274
+ this.context.registerIonPage(this.ionRouterOutlet, this.props.routeInfo);
1275
+ });
1276
+ }
1277
+ this.ionRouterOutlet.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
1278
+ this.ionRouterOutlet.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
1279
+ this.ionRouterOutlet.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
1280
+ this.ionRouterOutlet.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
1281
+ }
1282
+ }
1283
+ componentWillUnmount() {
1284
+ if (this.ionRouterOutlet) {
1285
+ this.ionRouterOutlet.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
1286
+ this.ionRouterOutlet.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
1287
+ this.ionRouterOutlet.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
1288
+ this.ionRouterOutlet.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
1289
+ }
1290
+ }
1291
+ ionViewWillEnterHandler() {
1292
+ this.ionLifeCycleContext.ionViewWillEnter();
1293
+ }
1294
+ ionViewDidEnterHandler() {
1295
+ this.ionLifeCycleContext.ionViewDidEnter();
1296
+ }
1297
+ ionViewWillLeaveHandler() {
1298
+ this.ionLifeCycleContext.ionViewWillLeave();
1299
+ }
1300
+ ionViewDidLeaveHandler() {
1301
+ this.ionLifeCycleContext.ionViewDidLeave();
1302
+ }
1303
+ render() {
1304
+ const _a = this.props, { StackManager, children, routeInfo } = _a, props = __rest(_a, ["StackManager", "children", "routeInfo"]);
1305
+ return (React.createElement(IonLifeCycleContext.Consumer, null, (context) => {
1306
+ this.ionLifeCycleContext = context;
1307
+ return (React.createElement(StackManager, { routeInfo: routeInfo },
1308
+ React.createElement(IonRouterOutletInner, Object.assign({ setRef: (val) => (this.ionRouterOutlet = val) }, props), children)));
1309
+ }));
1310
+ }
1311
+ static get contextType() {
1312
+ return StackContext;
1313
+ }
1314
+ }
1315
+
1316
+ class IonRouterOutletContainer extends React.Component {
1317
+ constructor(props) {
1318
+ super(props);
1319
+ }
1320
+ render() {
1321
+ const StackManager = this.context.getStackManager();
1322
+ const _a = this.props, { children, forwardedRef } = _a, props = __rest(_a, ["children", "forwardedRef"]);
1323
+ return this.context.hasIonicRouter() ? (props.ionPage ? (React.createElement(OutletPageManager, Object.assign({ StackManager: StackManager, routeInfo: this.context.routeInfo }, props), children)) : (React.createElement(StackManager, { routeInfo: this.context.routeInfo },
1324
+ React.createElement(IonRouterOutletInner, Object.assign({}, props, { forwardedRef: forwardedRef }), children)))) : (React.createElement(IonRouterOutletInner, Object.assign({ ref: forwardedRef }, this.props), this.props.children));
1325
+ }
1326
+ static get contextType() {
1327
+ return NavContext;
1328
+ }
1329
+ }
1330
+ const IonRouterOutlet = createForwardRef(IonRouterOutletContainer, 'IonRouterOutlet');
1331
+
1332
+ const IonTabButton = /*@__PURE__*/ (() => class extends React.Component {
1333
+ constructor(props) {
1334
+ super(props);
1335
+ this.handleIonTabButtonClick = this.handleIonTabButtonClick.bind(this);
1336
+ }
1337
+ handleIonTabButtonClick() {
1338
+ if (this.props.onClick) {
1339
+ this.props.onClick(new CustomEvent('ionTabButtonClick', {
1340
+ detail: {
1341
+ tab: this.props.tab,
1342
+ href: this.props.href,
1343
+ routeOptions: this.props.routerOptions,
1344
+ },
1345
+ }));
1346
+ }
1347
+ }
1348
+ render() {
1349
+ /**
1350
+ * onClick is excluded from the props, since it has a custom
1351
+ * implementation within IonTabBar.tsx. Calling onClick within this
1352
+ * component would result in duplicate handler calls.
1353
+ */
1354
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1355
+ const _a = this.props, rest = __rest(_a, ["onClick"]);
1356
+ return React.createElement(IonTabButtonInner, Object.assign({ onIonTabButtonClick: this.handleIonTabButtonClick }, rest));
1357
+ }
1358
+ static get displayName() {
1359
+ return 'IonTabButton';
1360
+ }
1361
+ })();
1362
+
1363
+ // TODO(FW-2959): types
1364
+ class IonTabBarUnwrapped extends React.PureComponent {
1365
+ constructor(props) {
1366
+ super(props);
1367
+ // eslint-disable-next-line
1368
+ this.setActiveTabOnContext = (_tab) => { };
1369
+ const tabs = {};
1370
+ React.Children.forEach(props.children, (child) => {
1371
+ var _a, _b, _c, _d;
1372
+ if (child != null &&
1373
+ typeof child === 'object' &&
1374
+ child.props &&
1375
+ (child.type === IonTabButton || child.type.isTabButton)) {
1376
+ tabs[child.props.tab] = {
1377
+ originalHref: child.props.href,
1378
+ currentHref: child.props.href,
1379
+ originalRouteOptions: child.props.href === ((_a = props.routeInfo) === null || _a === void 0 ? void 0 : _a.pathname) ? (_b = props.routeInfo) === null || _b === void 0 ? void 0 : _b.routeOptions : undefined,
1380
+ currentRouteOptions: child.props.href === ((_c = props.routeInfo) === null || _c === void 0 ? void 0 : _c.pathname) ? (_d = props.routeInfo) === null || _d === void 0 ? void 0 : _d.routeOptions : undefined,
1381
+ };
1382
+ }
1383
+ });
1384
+ this.state = {
1385
+ tabs,
1386
+ };
1387
+ this.onTabButtonClick = this.onTabButtonClick.bind(this);
1388
+ this.renderTabButton = this.renderTabButton.bind(this);
1389
+ this.setActiveTabOnContext = this.setActiveTabOnContext.bind(this);
1390
+ this.selectTab = this.selectTab.bind(this);
1391
+ }
1392
+ componentDidMount() {
1393
+ const tabs = this.state.tabs;
1394
+ const tabKeys = Object.keys(tabs);
1395
+ const activeTab = tabKeys.find((key) => {
1396
+ const href = tabs[key].originalHref;
1397
+ return this.props.routeInfo.pathname.startsWith(href);
1398
+ });
1399
+ if (activeTab) {
1400
+ this.setState({
1401
+ activeTab,
1402
+ });
1403
+ }
1404
+ }
1405
+ componentDidUpdate() {
1406
+ if (this.state.activeTab) {
1407
+ this.setActiveTabOnContext(this.state.activeTab);
1408
+ }
1409
+ }
1410
+ selectTab(tab) {
1411
+ const tabUrl = this.state.tabs[tab];
1412
+ if (tabUrl) {
1413
+ this.onTabButtonClick(new CustomEvent('ionTabButtonClick', {
1414
+ detail: {
1415
+ href: tabUrl.currentHref,
1416
+ tab,
1417
+ selected: tab === this.state.activeTab,
1418
+ routeOptions: undefined,
1419
+ },
1420
+ }));
1421
+ return true;
1422
+ }
1423
+ return false;
1424
+ }
1425
+ static getDerivedStateFromProps(props, state) {
1426
+ var _a, _b, _c;
1427
+ const tabs = Object.assign({}, state.tabs);
1428
+ const tabKeys = Object.keys(state.tabs);
1429
+ const activeTab = tabKeys.find((key) => {
1430
+ const href = state.tabs[key].originalHref;
1431
+ return props.routeInfo.pathname.startsWith(href);
1432
+ });
1433
+ // Check to see if the tab button href has changed, and if so, update it in the tabs state
1434
+ React.Children.forEach(props.children, (child) => {
1435
+ if (child != null &&
1436
+ typeof child === 'object' &&
1437
+ child.props &&
1438
+ (child.type === IonTabButton || child.type.isTabButton)) {
1439
+ const tab = tabs[child.props.tab];
1440
+ if (!tab || tab.originalHref !== child.props.href) {
1441
+ tabs[child.props.tab] = {
1442
+ originalHref: child.props.href,
1443
+ currentHref: child.props.href,
1444
+ originalRouteOptions: child.props.routeOptions,
1445
+ currentRouteOptions: child.props.routeOptions,
1446
+ };
1447
+ }
1448
+ }
1449
+ });
1450
+ const { activeTab: prevActiveTab } = state;
1451
+ if (activeTab && prevActiveTab) {
1452
+ const prevHref = state.tabs[prevActiveTab].currentHref;
1453
+ const prevRouteOptions = state.tabs[prevActiveTab].currentRouteOptions;
1454
+ if (activeTab !== prevActiveTab ||
1455
+ prevHref !== ((_a = props.routeInfo) === null || _a === void 0 ? void 0 : _a.pathname) ||
1456
+ prevRouteOptions !== ((_b = props.routeInfo) === null || _b === void 0 ? void 0 : _b.routeOptions)) {
1457
+ tabs[activeTab] = {
1458
+ originalHref: tabs[activeTab].originalHref,
1459
+ currentHref: props.routeInfo.pathname + (props.routeInfo.search || ''),
1460
+ originalRouteOptions: tabs[activeTab].originalRouteOptions,
1461
+ currentRouteOptions: (_c = props.routeInfo) === null || _c === void 0 ? void 0 : _c.routeOptions,
1462
+ };
1463
+ if (props.routeInfo.routeAction === 'pop' && activeTab !== prevActiveTab) {
1464
+ // If navigating back and the tabs change, set the prev tab back to its original href
1465
+ tabs[prevActiveTab] = {
1466
+ originalHref: tabs[prevActiveTab].originalHref,
1467
+ currentHref: tabs[prevActiveTab].originalHref,
1468
+ originalRouteOptions: tabs[prevActiveTab].originalRouteOptions,
1469
+ currentRouteOptions: tabs[prevActiveTab].currentRouteOptions,
1470
+ };
1471
+ }
1472
+ }
1473
+ }
1474
+ activeTab && props.onSetCurrentTab(activeTab, props.routeInfo);
1475
+ return {
1476
+ activeTab,
1477
+ tabs,
1478
+ };
1479
+ }
1480
+ onTabButtonClick(e, onClickFn) {
1481
+ const tappedTab = this.state.tabs[e.detail.tab];
1482
+ const originalHref = tappedTab.originalHref;
1483
+ const currentHref = e.detail.href;
1484
+ const { activeTab: prevActiveTab } = this.state;
1485
+ if (onClickFn) {
1486
+ /**
1487
+ * If the user provides an onClick function, we call it
1488
+ * with the original event.
1489
+ */
1490
+ onClickFn(e);
1491
+ }
1492
+ // this.props.onSetCurrentTab(e.detail.tab, this.props.routeInfo);
1493
+ // Clicking the current tab will bring you back to the original href
1494
+ if (prevActiveTab === e.detail.tab) {
1495
+ if (originalHref !== currentHref) {
1496
+ this.context.resetTab(e.detail.tab, originalHref, tappedTab.originalRouteOptions);
1497
+ }
1498
+ }
1499
+ else {
1500
+ if (this.props.onIonTabsWillChange) {
1501
+ this.props.onIonTabsWillChange(new CustomEvent('ionTabWillChange', { detail: { tab: e.detail.tab } }));
1502
+ }
1503
+ if (this.props.onIonTabsDidChange) {
1504
+ this.props.onIonTabsDidChange(new CustomEvent('ionTabDidChange', { detail: { tab: e.detail.tab } }));
1505
+ }
1506
+ this.setActiveTabOnContext(e.detail.tab);
1507
+ this.context.changeTab(e.detail.tab, currentHref, e.detail.routeOptions);
1508
+ }
1509
+ }
1510
+ renderTabButton(activeTab) {
1511
+ return (child) => {
1512
+ var _a, _b;
1513
+ if (child != null && child.props && (child.type === IonTabButton || child.type.isTabButton)) {
1514
+ const href = child.props.tab === activeTab
1515
+ ? (_a = this.props.routeInfo) === null || _a === void 0 ? void 0 : _a.pathname
1516
+ : this.state.tabs[child.props.tab].currentHref;
1517
+ const routeOptions = child.props.tab === activeTab
1518
+ ? (_b = this.props.routeInfo) === null || _b === void 0 ? void 0 : _b.routeOptions
1519
+ : this.state.tabs[child.props.tab].currentRouteOptions;
1520
+ return React.cloneElement(child, {
1521
+ href,
1522
+ routeOptions,
1523
+ onClick: (ev) => this.onTabButtonClick(ev, child.props.onClick),
1524
+ });
1525
+ }
1526
+ return null;
1527
+ };
1528
+ }
1529
+ render() {
1530
+ const { activeTab } = this.state;
1531
+ return (React.createElement(IonTabBarInner, Object.assign({}, this.props, { selectedTab: activeTab }), React.Children.map(this.props.children, this.renderTabButton(activeTab))));
1532
+ }
1533
+ static get contextType() {
1534
+ return NavContext;
1535
+ }
1536
+ }
1537
+ const IonTabBarContainer = React.memo((_a) => {
1538
+ var { forwardedRef } = _a, props = __rest(_a, ["forwardedRef"]);
1539
+ const context = useContext(NavContext);
1540
+ return (React.createElement(IonTabBarUnwrapped, Object.assign({ ref: forwardedRef }, props, { routeInfo: props.routeInfo || context.routeInfo || { pathname: window.location.pathname }, onSetCurrentTab: context.setCurrentTab }), props.children));
1541
+ });
1542
+ const IonTabBar = createForwardRef(IonTabBarContainer, 'IonTabBar');
1543
+
1544
+ class IonTabsElement extends HTMLElementSSR {
1545
+ constructor() {
1546
+ super();
1547
+ }
1548
+ }
1549
+ // TODO(FW-2959): types
1550
+ if (typeof window !== 'undefined' && window.customElements) {
1551
+ const element = window.customElements.get('ion-tabs');
1552
+ if (!element) {
1553
+ window.customElements.define('ion-tabs', IonTabsElement);
1554
+ }
1555
+ }
1556
+ const hostStyles = {
1557
+ display: 'flex',
1558
+ position: 'absolute',
1559
+ top: '0',
1560
+ left: '0',
1561
+ right: '0',
1562
+ bottom: '0',
1563
+ flexDirection: 'column',
1564
+ width: '100%',
1565
+ height: '100%',
1566
+ contain: 'layout size style',
1567
+ };
1568
+ const tabsInner = {
1569
+ position: 'relative',
1570
+ flex: 1,
1571
+ contain: 'layout size style',
1572
+ };
1573
+ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
1574
+ constructor(props) {
1575
+ super(props);
1576
+ this.routerOutletRef = React.createRef();
1577
+ this.tabBarRef = React.createRef();
1578
+ this.ionTabContextState = {
1579
+ activeTab: undefined,
1580
+ selectTab: () => false,
1581
+ };
1582
+ }
1583
+ componentDidMount() {
1584
+ if (this.tabBarRef.current) {
1585
+ // Grab initial value
1586
+ this.ionTabContextState.activeTab = this.tabBarRef.current.state.activeTab;
1587
+ // Override method
1588
+ this.tabBarRef.current.setActiveTabOnContext = (tab) => {
1589
+ this.ionTabContextState.activeTab = tab;
1590
+ };
1591
+ this.ionTabContextState.selectTab = this.tabBarRef.current.selectTab;
1592
+ }
1593
+ }
1594
+ render() {
1595
+ let outlet;
1596
+ let tabBar;
1597
+ const _a = this.props, { className, onIonTabsDidChange, onIonTabsWillChange } = _a, props = __rest(_a, ["className", "onIonTabsDidChange", "onIonTabsWillChange"]);
1598
+ const children = typeof this.props.children === 'function'
1599
+ ? this.props.children(this.ionTabContextState)
1600
+ : this.props.children;
1601
+ React.Children.forEach(children, (child) => {
1602
+ // eslint-disable-next-line no-prototype-builtins
1603
+ if (child == null || typeof child !== 'object' || !child.hasOwnProperty('type')) {
1604
+ return;
1605
+ }
1606
+ if (child.type === IonRouterOutlet || child.type.isRouterOutlet) {
1607
+ outlet = React.cloneElement(child);
1608
+ }
1609
+ else if (child.type === Fragment && child.props.children[0].type === IonRouterOutlet) {
1610
+ outlet = child.props.children[0];
1611
+ }
1612
+ let childProps = {
1613
+ ref: this.tabBarRef,
1614
+ };
1615
+ /**
1616
+ * Only pass these props
1617
+ * down from IonTabs to IonTabBar
1618
+ * if they are defined, otherwise
1619
+ * if you have a handler set on
1620
+ * IonTabBar it will be overridden.
1621
+ */
1622
+ if (onIonTabsDidChange !== undefined) {
1623
+ childProps = Object.assign(Object.assign({}, childProps), { onIonTabsDidChange });
1624
+ }
1625
+ if (onIonTabsWillChange !== undefined) {
1626
+ childProps = Object.assign(Object.assign({}, childProps), { onIonTabsWillChange });
1627
+ }
1628
+ if (child.type === IonTabBar || child.type.isTabBar) {
1629
+ tabBar = React.cloneElement(child, childProps);
1630
+ }
1631
+ else if (child.type === Fragment &&
1632
+ (child.props.children[1].type === IonTabBar || child.props.children[1].type.isTabBar)) {
1633
+ tabBar = React.cloneElement(child.props.children[1], childProps);
1634
+ }
1635
+ });
1636
+ if (!outlet) {
1637
+ throw new Error('IonTabs must contain an IonRouterOutlet');
1638
+ }
1639
+ if (!tabBar) {
1640
+ throw new Error('IonTabs needs a IonTabBar');
1641
+ }
1642
+ return (React.createElement(IonTabsContext.Provider, { value: this.ionTabContextState }, this.context.hasIonicRouter() ? (React.createElement(PageManager, Object.assign({ className: className ? `${className}` : '', routeInfo: this.context.routeInfo }, props),
1643
+ React.createElement("ion-tabs", { className: "ion-tabs", style: hostStyles },
1644
+ tabBar.props.slot === 'top' ? tabBar : null,
1645
+ React.createElement("div", { style: tabsInner, className: "tabs-inner" }, outlet),
1646
+ tabBar.props.slot === 'bottom' ? tabBar : null))) : (React.createElement("div", Object.assign({ className: className ? `${className}` : 'ion-tabs' }, props, { style: hostStyles }),
1647
+ tabBar.props.slot === 'top' ? tabBar : null,
1648
+ React.createElement("div", { style: tabsInner, className: "tabs-inner" }, outlet),
1649
+ tabBar.props.slot === 'bottom' ? tabBar : null))));
1650
+ }
1651
+ static get contextType() {
1652
+ return NavContext;
1653
+ }
1654
+ })();
1655
+
1656
+ const IonBackButton = /*@__PURE__*/ (() => class extends React.Component {
1657
+ constructor() {
1658
+ super(...arguments);
1659
+ this.clickButton = (e) => {
1660
+ /**
1661
+ * If ion-back-button is being used inside
1662
+ * of ion-nav then we should not interact with
1663
+ * the router.
1664
+ */
1665
+ if (e.target && e.target.closest('ion-nav') !== null) {
1666
+ return;
1667
+ }
1668
+ const { defaultHref, routerAnimation } = this.props;
1669
+ if (this.context.hasIonicRouter()) {
1670
+ e.stopPropagation();
1671
+ this.context.goBack(defaultHref, routerAnimation);
1672
+ }
1673
+ else if (defaultHref !== undefined) {
1674
+ window.location.href = defaultHref;
1675
+ }
1676
+ };
1677
+ }
1678
+ render() {
1679
+ return React.createElement(IonBackButtonInner, Object.assign({ onClick: this.clickButton }, this.props));
1680
+ }
1681
+ static get displayName() {
1682
+ return 'IonBackButton';
1683
+ }
1684
+ static get contextType() {
1685
+ return NavContext;
1686
+ }
1687
+ })();
1688
+
1689
+ class IonIconContainer extends React.PureComponent {
1690
+ constructor(props) {
1691
+ super(props);
1692
+ if (this.props.name) {
1693
+ console.warn('In Ionic React, you import icons from "ionicons/icons" and set the icon you imported to the "icon" property. Setting the "name" property has no effect.');
1694
+ }
1695
+ }
1696
+ render() {
1697
+ var _a, _b;
1698
+ const _c = this.props, { icon, ios, md, mode } = _c, rest = __rest(_c, ["icon", "ios", "md", "mode"]);
1699
+ let iconToUse;
1700
+ const config = getConfig();
1701
+ const iconMode = mode || (config === null || config === void 0 ? void 0 : config.get('mode'));
1702
+ if (ios || md) {
1703
+ if (iconMode === 'ios') {
1704
+ iconToUse = (_a = ios !== null && ios !== void 0 ? ios : md) !== null && _a !== void 0 ? _a : icon;
1705
+ }
1706
+ else {
1707
+ iconToUse = (_b = md !== null && md !== void 0 ? md : ios) !== null && _b !== void 0 ? _b : icon;
1708
+ }
1709
+ }
1710
+ else {
1711
+ iconToUse = icon;
1712
+ }
1713
+ return (React.createElement(IonIconInner, Object.assign({ ref: this.props.forwardedRef, icon: iconToUse }, rest), this.props.children));
1714
+ }
1715
+ static get contextType() {
1716
+ return NavContext;
1717
+ }
1718
+ }
1719
+ const IonIcon = createForwardRef(IonIconContainer, 'IonIcon');
1720
+
1721
+ class IonRoute extends React.PureComponent {
1722
+ render() {
1723
+ const IonRouteInner = this.context.getIonRoute();
1724
+ if (!this.context.hasIonicRouter() || !IonRoute) {
1725
+ console.error('You either do not have an Ionic Router package, or your router does not support using <IonRoute>');
1726
+ return null;
1727
+ }
1728
+ return React.createElement(IonRouteInner, Object.assign({}, this.props));
1729
+ }
1730
+ static get contextType() {
1731
+ return NavContext;
1732
+ }
1733
+ }
1734
+
1735
+ class IonRedirect extends React.PureComponent {
1736
+ render() {
1737
+ const IonRedirectInner = this.context.getIonRedirect();
1738
+ if (!this.context.hasIonicRouter() || !IonRedirect) {
1739
+ console.error('You either do not have an Ionic Router package, or your router does not support using <IonRedirect>');
1740
+ return null;
1741
+ }
1742
+ return React.createElement(IonRedirectInner, Object.assign({}, this.props));
1743
+ }
1744
+ static get contextType() {
1745
+ return NavContext;
1746
+ }
1747
+ }
1748
+
1749
+ const IonRouterContext = React.createContext({
1750
+ routeInfo: undefined,
1751
+ push: () => {
1752
+ throw new Error('An Ionic Router is required for IonRouterContext');
1753
+ },
1754
+ back: () => {
1755
+ throw new Error('An Ionic Router is required for IonRouterContext');
1756
+ },
1757
+ canGoBack: () => {
1758
+ throw new Error('An Ionic Router is required for IonRouterContext');
1759
+ },
1760
+ nativeBack: () => {
1761
+ throw new Error('An Ionic Router is required for IonRouterContext');
1762
+ },
1763
+ });
1764
+ /**
1765
+ * A hook for more direct control over routing in an Ionic React application. Allows you to pass additional meta-data to the router before the call to the native router.
1766
+ */
1767
+ function useIonRouter() {
1768
+ const context = useContext(IonRouterContext);
1769
+ return useMemo(() => ({
1770
+ back: context.back,
1771
+ push: context.push,
1772
+ goBack: context.back,
1773
+ canGoBack: context.canGoBack,
1774
+ routeInfo: context.routeInfo,
1775
+ }), [context.back, context.push, context.canGoBack, context.routeInfo]);
1776
+ }
1777
+
1778
+ class CreateAnimation extends React.PureComponent {
1779
+ constructor(props) {
1780
+ super(props);
1781
+ this.nodes = new Map();
1782
+ this.animation = createAnimation(props.id);
1783
+ }
1784
+ setupAnimation(props) {
1785
+ const animation = this.animation;
1786
+ if (this.nodes.size > 0) {
1787
+ animation.addElement(Array.from(this.nodes.values()));
1788
+ }
1789
+ checkConfig(animation, props);
1790
+ checkPlayback(animation, props);
1791
+ }
1792
+ componentDidMount() {
1793
+ const props = this.props;
1794
+ this.setupAnimation(props);
1795
+ }
1796
+ componentDidUpdate(prevProps) {
1797
+ const animation = this.animation;
1798
+ const props = this.props;
1799
+ checkConfig(animation, props, prevProps);
1800
+ checkProgress(animation, props, prevProps);
1801
+ checkPlayback(animation, props, prevProps);
1802
+ }
1803
+ render() {
1804
+ const { children } = this.props;
1805
+ return (React.createElement(React.Fragment, null, React.Children.map(children, (child, id) => React.cloneElement(child, { ref: (el) => this.nodes.set(id, el) }))));
1806
+ }
1807
+ }
1808
+ const checkConfig = (animation, currentProps = {}, prevProps = {}) => {
1809
+ const reservedProps = [
1810
+ 'children',
1811
+ 'progressStart',
1812
+ 'progressStep',
1813
+ 'progressEnd',
1814
+ 'pause',
1815
+ 'stop',
1816
+ 'destroy',
1817
+ 'play',
1818
+ 'from',
1819
+ 'to',
1820
+ 'fromTo',
1821
+ 'onFinish',
1822
+ ];
1823
+ for (const key in currentProps) {
1824
+ if (
1825
+ // eslint-disable-next-line no-prototype-builtins
1826
+ currentProps.hasOwnProperty(key) &&
1827
+ !reservedProps.includes(key) &&
1828
+ currentProps[key] !== prevProps[key]) {
1829
+ animation[key](currentProps[key]);
1830
+ }
1831
+ }
1832
+ const fromValues = currentProps.from;
1833
+ if (fromValues && fromValues !== prevProps.from) {
1834
+ const values = Array.isArray(fromValues) ? fromValues : [fromValues];
1835
+ values.forEach((val) => animation.from(val.property, val.value));
1836
+ }
1837
+ const toValues = currentProps.to;
1838
+ if (toValues && toValues !== prevProps.to) {
1839
+ const values = Array.isArray(toValues) ? toValues : [toValues];
1840
+ values.forEach((val) => animation.to(val.property, val.value));
1841
+ }
1842
+ const fromToValues = currentProps.fromTo;
1843
+ if (fromToValues && fromToValues !== prevProps.fromTo) {
1844
+ const values = Array.isArray(fromToValues) ? fromToValues : [fromToValues];
1845
+ values.forEach((val) => animation.fromTo(val.property, val.fromValue, val.toValue));
1846
+ }
1847
+ const onFinishValues = currentProps.onFinish;
1848
+ if (onFinishValues && onFinishValues !== prevProps.onFinish) {
1849
+ const values = Array.isArray(onFinishValues) ? onFinishValues : [onFinishValues];
1850
+ values.forEach((val) => animation.onFinish(val.callback, val.opts));
1851
+ }
1852
+ };
1853
+ const checkProgress = (animation, currentProps = {}, prevProps = {}) => {
1854
+ var _a, _b, _c, _d, _e;
1855
+ const { progressStart, progressStep, progressEnd } = currentProps;
1856
+ if (progressStart &&
1857
+ (((_a = prevProps.progressStart) === null || _a === void 0 ? void 0 : _a.forceLinearEasing) !== (progressStart === null || progressStart === void 0 ? void 0 : progressStart.forceLinearEasing) ||
1858
+ ((_b = prevProps.progressStart) === null || _b === void 0 ? void 0 : _b.step) !== (progressStart === null || progressStart === void 0 ? void 0 : progressStart.step))) {
1859
+ animation.progressStart(progressStart.forceLinearEasing, progressStart.step);
1860
+ }
1861
+ if (progressStep && ((_c = prevProps.progressStep) === null || _c === void 0 ? void 0 : _c.step) !== (progressStep === null || progressStep === void 0 ? void 0 : progressStep.step)) {
1862
+ animation.progressStep(progressStep.step);
1863
+ }
1864
+ if (progressEnd &&
1865
+ (((_d = prevProps.progressEnd) === null || _d === void 0 ? void 0 : _d.playTo) !== (progressEnd === null || progressEnd === void 0 ? void 0 : progressEnd.playTo) ||
1866
+ ((_e = prevProps.progressEnd) === null || _e === void 0 ? void 0 : _e.step) !== (progressEnd === null || progressEnd === void 0 ? void 0 : progressEnd.step) ||
1867
+ (prevProps === null || prevProps === void 0 ? void 0 : prevProps.dur) !== (progressEnd === null || progressEnd === void 0 ? void 0 : progressEnd.dur))) {
1868
+ animation.progressEnd(progressEnd.playTo, progressEnd.step, progressEnd.dur);
1869
+ }
1870
+ };
1871
+ const checkPlayback = (animation, currentProps = {}, prevProps = {}) => {
1872
+ if (!prevProps.play && currentProps.play) {
1873
+ animation.play();
1874
+ }
1875
+ if (!prevProps.pause && currentProps.pause) {
1876
+ animation.pause();
1877
+ }
1878
+ if (!prevProps.stop && currentProps.stop) {
1879
+ animation.stop();
1880
+ }
1881
+ if (!prevProps.destroy && currentProps.destroy) {
1882
+ animation.destroy();
1883
+ }
1884
+ };
1885
+
1886
+ function useController(displayName, controller, defineCustomElement) {
1887
+ const overlayRef = useRef();
1888
+ const didDismissEventName = useMemo(() => `on${displayName}DidDismiss`, [displayName]);
1889
+ const didPresentEventName = useMemo(() => `on${displayName}DidPresent`, [displayName]);
1890
+ const willDismissEventName = useMemo(() => `on${displayName}WillDismiss`, [displayName]);
1891
+ const willPresentEventName = useMemo(() => `on${displayName}WillPresent`, [displayName]);
1892
+ defineCustomElement();
1893
+ const present = useCallback(async (options) => {
1894
+ if (overlayRef.current) {
1895
+ return;
1896
+ }
1897
+ const { onDidDismiss, onWillDismiss, onDidPresent, onWillPresent } = options, rest = __rest(options, ["onDidDismiss", "onWillDismiss", "onDidPresent", "onWillPresent"]);
1898
+ const handleDismiss = (event) => {
1899
+ if (onDidDismiss) {
1900
+ onDidDismiss(event);
1901
+ }
1902
+ overlayRef.current = undefined;
1903
+ };
1904
+ overlayRef.current = await controller.create(Object.assign({}, rest));
1905
+ attachProps(overlayRef.current, {
1906
+ [didDismissEventName]: handleDismiss,
1907
+ [didPresentEventName]: (e) => onDidPresent && onDidPresent(e),
1908
+ [willDismissEventName]: (e) => onWillDismiss && onWillDismiss(e),
1909
+ [willPresentEventName]: (e) => onWillPresent && onWillPresent(e),
1910
+ });
1911
+ overlayRef.current.present();
1912
+ }, [controller]);
1913
+ const dismiss = useCallback(async () => {
1914
+ overlayRef.current && (await overlayRef.current.dismiss());
1915
+ overlayRef.current = undefined;
1916
+ }, []);
1917
+ return {
1918
+ present,
1919
+ dismiss,
1920
+ };
1921
+ }
1922
+
1923
+ /**
1924
+ * A hook for presenting/dismissing an IonActionSheet component
1925
+ * @returns Returns the present and dismiss methods in an array
1926
+ */
1927
+ function useIonActionSheet() {
1928
+ const controller = useController('IonActionSheet', actionSheetController, defineCustomElement$14);
1929
+ const present = useCallback((buttonsOrOptions, header) => {
1930
+ if (Array.isArray(buttonsOrOptions)) {
1931
+ return controller.present({
1932
+ buttons: buttonsOrOptions,
1933
+ header,
1934
+ });
1935
+ }
1936
+ else {
1937
+ return controller.present(buttonsOrOptions);
1938
+ }
1939
+ }, [controller.present]);
1940
+ return [present, controller.dismiss];
1941
+ }
1942
+
1943
+ /**
1944
+ * A hook for presenting/dismissing an IonAlert component
1945
+ * @returns Returns the present and dismiss methods in an array
1946
+ */
1947
+ function useIonAlert() {
1948
+ const controller = useController('IonAlert', alertController, defineCustomElement$10);
1949
+ const present = useCallback((messageOrOptions, buttons) => {
1950
+ if (typeof messageOrOptions === 'string') {
1951
+ return controller.present({
1952
+ message: messageOrOptions,
1953
+ buttons: buttons !== null && buttons !== void 0 ? buttons : [{ text: 'Ok' }],
1954
+ });
1955
+ }
1956
+ else {
1957
+ return controller.present(messageOrOptions);
1958
+ }
1959
+ }, [controller.present]);
1960
+ return [present, controller.dismiss];
1961
+ }
1962
+
1963
+ /**
1964
+ * A hook for presenting/dismissing an IonToast component
1965
+ * @returns Returns the present and dismiss methods in an array
1966
+ */
1967
+ function useIonToast() {
1968
+ const controller = useController('IonToast', toastController, defineCustomElement$12);
1969
+ const present = useCallback((messageOrOptions, duration) => {
1970
+ if (typeof messageOrOptions === 'string') {
1971
+ return controller.present({
1972
+ message: messageOrOptions,
1973
+ duration,
1974
+ });
1975
+ }
1976
+ else {
1977
+ return controller.present(messageOrOptions);
1978
+ }
1979
+ }, [controller.present]);
1980
+ return [present, controller.dismiss];
1981
+ }
1982
+
1983
+ function useOverlay(displayName, controller, defineCustomElement, component, componentProps) {
1984
+ const overlayRef = useRef();
1985
+ const containerElRef = useRef();
1986
+ const didDismissEventName = useMemo(() => `on${displayName}DidDismiss`, [displayName]);
1987
+ const didPresentEventName = useMemo(() => `on${displayName}DidPresent`, [displayName]);
1988
+ const willDismissEventName = useMemo(() => `on${displayName}WillDismiss`, [displayName]);
1989
+ const willPresentEventName = useMemo(() => `on${displayName}WillPresent`, [displayName]);
1990
+ const [isOpen, setIsOpen] = useState(false);
1991
+ const ionContext = useContext(IonContext);
1992
+ const [overlayId] = useState(generateId('overlay'));
1993
+ defineCustomElement();
1994
+ useEffect(() => {
1995
+ if (isOpen && component && containerElRef.current) {
1996
+ if (React.isValidElement(component)) {
1997
+ ionContext.addOverlay(overlayId, component, containerElRef.current);
1998
+ }
1999
+ else {
2000
+ const element = createElement(component, componentProps);
2001
+ ionContext.addOverlay(overlayId, element, containerElRef.current);
2002
+ }
2003
+ }
2004
+ }, [component, containerElRef.current, isOpen, componentProps]);
2005
+ const present = useCallback(async (options) => {
2006
+ if (overlayRef.current) {
2007
+ return;
2008
+ }
2009
+ const { onDidDismiss, onWillDismiss, onDidPresent, onWillPresent } = options, rest = __rest(options, ["onDidDismiss", "onWillDismiss", "onDidPresent", "onWillPresent"]);
2010
+ if (typeof document !== 'undefined') {
2011
+ containerElRef.current = document.createElement('div');
2012
+ }
2013
+ overlayRef.current = await controller.create(Object.assign(Object.assign({}, rest), { component: containerElRef.current }));
2014
+ attachProps(overlayRef.current, {
2015
+ [didDismissEventName]: handleDismiss,
2016
+ [didPresentEventName]: (e) => onDidPresent && onDidPresent(e),
2017
+ [willDismissEventName]: (e) => onWillDismiss && onWillDismiss(e),
2018
+ [willPresentEventName]: (e) => onWillPresent && onWillPresent(e),
2019
+ });
2020
+ overlayRef.current.present();
2021
+ setIsOpen(true);
2022
+ function handleDismiss(event) {
2023
+ if (onDidDismiss) {
2024
+ onDidDismiss(event);
2025
+ }
2026
+ overlayRef.current = undefined;
2027
+ containerElRef.current = undefined;
2028
+ setIsOpen(false);
2029
+ ionContext.removeOverlay(overlayId);
2030
+ }
2031
+ }, []);
2032
+ const dismiss = useCallback(async (data, role) => {
2033
+ overlayRef.current && (await overlayRef.current.dismiss(data, role));
2034
+ overlayRef.current = undefined;
2035
+ containerElRef.current = undefined;
2036
+ }, []);
2037
+ return {
2038
+ present,
2039
+ dismiss,
2040
+ };
2041
+ }
2042
+
2043
+ // TODO(FW-2959): types
2044
+ /**
2045
+ * A hook for presenting/dismissing an IonModal component
2046
+ * @param component The component that the modal will show. Can be a React Component, a functional component, or a JSX Element
2047
+ * @param componentProps The props that will be passed to the component, if required
2048
+ * @returns Returns the present and dismiss methods in an array
2049
+ */
2050
+ function useIonModal(component, componentProps) {
2051
+ const controller = useOverlay('IonModal', modalController, defineCustomElement$15, component, componentProps);
2052
+ const present = useCallback((options = {}) => {
2053
+ controller.present(options);
2054
+ }, [controller.present]);
2055
+ return [present, controller.dismiss];
2056
+ }
2057
+
2058
+ // TODO(FW-2959): types
2059
+ /**
2060
+ * A hook for presenting/dismissing an IonPicker component
2061
+ * @param component The component that the popover will show. Can be a React Component, a functional component, or a JSX Element
2062
+ * @param componentProps The props that will be passed to the component, if required
2063
+ * @returns Returns the present and dismiss methods in an array
2064
+ */
2065
+ function useIonPopover(component, componentProps) {
2066
+ const controller = useOverlay('IonPopover', popoverController, defineCustomElement$16, component, componentProps);
2067
+ const present = useCallback((options = {}) => {
2068
+ controller.present(options);
2069
+ }, [controller.present]);
2070
+ return [present, controller.dismiss];
2071
+ }
2072
+
2073
+ /**
2074
+ * A hook for presenting/dismissing an IonPicker component
2075
+ * @returns Returns the present and dismiss methods in an array
2076
+ */
2077
+ function useIonPicker() {
2078
+ const controller = useController('IonPicker', pickerController, defineCustomElement$13);
2079
+ const present = useCallback((columnsOrOptions, buttons) => {
2080
+ if (Array.isArray(columnsOrOptions)) {
2081
+ return controller.present({
2082
+ columns: columnsOrOptions,
2083
+ buttons: buttons !== null && buttons !== void 0 ? buttons : [{ text: 'Ok' }],
2084
+ });
2085
+ }
2086
+ else {
2087
+ return controller.present(columnsOrOptions);
2088
+ }
2089
+ }, [controller.present]);
2090
+ return [present, controller.dismiss];
2091
+ }
2092
+
2093
+ /**
2094
+ * A hook for presenting/dismissing an IonLoading component
2095
+ * @returns Returns the present and dismiss methods in an array
2096
+ */
2097
+ function useIonLoading() {
2098
+ const controller = useController('IonLoading', loadingController, defineCustomElement$11);
2099
+ const present = useCallback((messageOrOptions = {}, duration, spinner) => {
2100
+ if (typeof messageOrOptions === 'string') {
2101
+ return controller.present({
2102
+ message: messageOrOptions,
2103
+ duration,
2104
+ spinner,
2105
+ });
2106
+ }
2107
+ else {
2108
+ return controller.present(messageOrOptions);
2109
+ }
2110
+ }, [controller.present]);
2111
+ return [present, controller.dismiss];
2112
+ }
2113
+
2114
+ const setupIonicReact = (config = {}) => {
2115
+ /**
2116
+ * By default Ionic Framework hides elements that
2117
+ * are not hydrated, but in the CE build there is no
2118
+ * hydration.
2119
+ * TODO FW-2797: Remove when all integrations have been
2120
+ * migrated to CE build.
2121
+ */
2122
+ if (typeof document !== 'undefined') {
2123
+ document.documentElement.classList.add('ion-ce');
2124
+ }
2125
+ initialize(Object.assign({}, config));
2126
+ };
2127
+
2128
+ // TODO(FW-2959): types
2129
+ const RouteManagerContext = /*@__PURE__*/ React.createContext({
2130
+ addViewItem: () => undefined,
2131
+ canGoBack: () => undefined,
2132
+ clearOutlet: () => undefined,
2133
+ createViewItem: () => undefined,
2134
+ findViewItemByPathname: () => undefined,
2135
+ findLeavingViewItemByRouteInfo: () => undefined,
2136
+ findViewItemByRouteInfo: () => undefined,
2137
+ getChildrenToRender: () => undefined,
2138
+ goBack: () => undefined,
2139
+ unMountViewItem: () => undefined,
2140
+ });
2141
+
2142
+ class ViewLifeCycleManager extends React.Component {
2143
+ constructor(props) {
2144
+ super(props);
2145
+ this.ionLifeCycleContext = new DefaultIonLifeCycleContext();
2146
+ this._isMounted = false;
2147
+ this.ionLifeCycleContext.onComponentCanBeDestroyed(() => {
2148
+ if (!this.props.mount) {
2149
+ if (this._isMounted) {
2150
+ this.setState({
2151
+ show: false,
2152
+ }, () => this.props.removeView());
2153
+ }
2154
+ }
2155
+ });
2156
+ this.state = {
2157
+ show: true,
2158
+ };
2159
+ }
2160
+ componentDidMount() {
2161
+ this._isMounted = true;
2162
+ }
2163
+ componentWillUnmount() {
2164
+ this._isMounted = false;
2165
+ }
2166
+ render() {
2167
+ const { show } = this.state;
2168
+ return (React.createElement(IonLifeCycleContext.Provider, { value: this.ionLifeCycleContext }, show && this.props.children));
2169
+ }
2170
+ }
2171
+
2172
+ // const RESTRICT_SIZE = 100;
2173
+ class LocationHistory {
2174
+ constructor() {
2175
+ this.locationHistory = [];
2176
+ this.tabHistory = {};
2177
+ }
2178
+ add(routeInfo) {
2179
+ if (routeInfo.routeAction === 'push' || routeInfo.routeAction == null) {
2180
+ this._add(routeInfo);
2181
+ }
2182
+ else if (routeInfo.routeAction === 'pop') {
2183
+ this._pop(routeInfo);
2184
+ }
2185
+ else if (routeInfo.routeAction === 'replace') {
2186
+ this._replace(routeInfo);
2187
+ }
2188
+ if (routeInfo.routeDirection === 'root') {
2189
+ this._clear();
2190
+ this._add(routeInfo);
2191
+ }
2192
+ }
2193
+ clearTabStack(tab) {
2194
+ const routeInfos = this._getRouteInfosByKey(tab);
2195
+ if (routeInfos) {
2196
+ routeInfos.forEach((ri) => {
2197
+ this.locationHistory = this.locationHistory.filter((x) => x.id !== ri.id);
2198
+ });
2199
+ this.tabHistory[tab] = [];
2200
+ }
2201
+ }
2202
+ update(routeInfo) {
2203
+ const locationIndex = this.locationHistory.findIndex((x) => x.id === routeInfo.id);
2204
+ if (locationIndex > -1) {
2205
+ this.locationHistory.splice(locationIndex, 1, routeInfo);
2206
+ }
2207
+ const tabArray = this.tabHistory[routeInfo.tab || ''];
2208
+ if (tabArray) {
2209
+ const tabIndex = tabArray.findIndex((x) => x.id === routeInfo.id);
2210
+ if (tabIndex > -1) {
2211
+ tabArray.splice(tabIndex, 1, routeInfo);
2212
+ }
2213
+ else {
2214
+ tabArray.push(routeInfo);
2215
+ }
2216
+ }
2217
+ else if (routeInfo.tab) {
2218
+ this.tabHistory[routeInfo.tab] = [routeInfo];
2219
+ }
2220
+ }
2221
+ _add(routeInfo) {
2222
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
2223
+ if (routeInfos) {
2224
+ // If the latest routeInfo is the same (going back and forth between tabs), replace it
2225
+ if (this._areRoutesEqual(routeInfos[routeInfos.length - 1], routeInfo)) {
2226
+ routeInfos.pop();
2227
+ }
2228
+ routeInfos.push(routeInfo);
2229
+ }
2230
+ this.locationHistory.push(routeInfo);
2231
+ }
2232
+ _areRoutesEqual(route1, route2) {
2233
+ if (!route1 || !route2) {
2234
+ return false;
2235
+ }
2236
+ return route1.pathname === route2.pathname && route1.search === route2.search;
2237
+ }
2238
+ _pop(routeInfo) {
2239
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
2240
+ if (routeInfos) {
2241
+ // Pop the previous route
2242
+ routeInfos.pop();
2243
+ // Replace the current route with an updated version
2244
+ routeInfos.pop();
2245
+ routeInfos.push(routeInfo);
2246
+ }
2247
+ // Pop the previous route
2248
+ this.locationHistory.pop();
2249
+ // Replace the current route with an updated version
2250
+ this.locationHistory.pop();
2251
+ this.locationHistory.push(routeInfo);
2252
+ }
2253
+ _replace(routeInfo) {
2254
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
2255
+ routeInfos && routeInfos.pop();
2256
+ this.locationHistory.pop();
2257
+ this._add(routeInfo);
2258
+ }
2259
+ _clear() {
2260
+ const keys = Object.keys(this.tabHistory);
2261
+ keys.forEach((k) => (this.tabHistory[k] = []));
2262
+ this.locationHistory = [];
2263
+ }
2264
+ _getRouteInfosByKey(key) {
2265
+ let routeInfos;
2266
+ if (key) {
2267
+ routeInfos = this.tabHistory[key];
2268
+ if (!routeInfos) {
2269
+ routeInfos = this.tabHistory[key] = [];
2270
+ }
2271
+ }
2272
+ return routeInfos;
2273
+ }
2274
+ getFirstRouteInfoForTab(tab) {
2275
+ const routeInfos = this._getRouteInfosByKey(tab);
2276
+ if (routeInfos) {
2277
+ return routeInfos[0];
2278
+ }
2279
+ return undefined;
2280
+ }
2281
+ getCurrentRouteInfoForTab(tab) {
2282
+ const routeInfos = this._getRouteInfosByKey(tab);
2283
+ if (routeInfos) {
2284
+ return routeInfos[routeInfos.length - 1];
2285
+ }
2286
+ return undefined;
2287
+ }
2288
+ findLastLocation(routeInfo) {
2289
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
2290
+ if (routeInfos) {
2291
+ for (let i = routeInfos.length - 2; i >= 0; i--) {
2292
+ const ri = routeInfos[i];
2293
+ if (ri) {
2294
+ if (ri.pathname === routeInfo.pushedByRoute) {
2295
+ return ri;
2296
+ }
2297
+ }
2298
+ }
2299
+ }
2300
+ for (let i = this.locationHistory.length - 2; i >= 0; i--) {
2301
+ const ri = this.locationHistory[i];
2302
+ if (ri) {
2303
+ if (ri.pathname === routeInfo.pushedByRoute) {
2304
+ return ri;
2305
+ }
2306
+ }
2307
+ }
2308
+ return undefined;
2309
+ }
2310
+ previous() {
2311
+ return (this.locationHistory[this.locationHistory.length - 2] || this.locationHistory[this.locationHistory.length - 1]);
2312
+ }
2313
+ current() {
2314
+ return this.locationHistory[this.locationHistory.length - 1];
2315
+ }
2316
+ canGoBack() {
2317
+ return this.locationHistory.length > 1;
2318
+ }
2319
+ }
2320
+
2321
+ class NavManager extends React.PureComponent {
2322
+ constructor(props) {
2323
+ super(props);
2324
+ this.ionRouterContextValue = {
2325
+ push: (pathname, routerDirection, routeAction, routerOptions, animationBuilder) => {
2326
+ this.navigate(pathname, routerDirection, routeAction, animationBuilder, routerOptions);
2327
+ },
2328
+ back: (animationBuilder) => {
2329
+ this.goBack(undefined, animationBuilder);
2330
+ },
2331
+ canGoBack: () => this.props.locationHistory.canGoBack(),
2332
+ nativeBack: () => this.props.onNativeBack(),
2333
+ routeInfo: this.props.routeInfo,
2334
+ };
2335
+ this.state = {
2336
+ goBack: this.goBack.bind(this),
2337
+ hasIonicRouter: () => true,
2338
+ navigate: this.navigate.bind(this),
2339
+ getIonRedirect: this.getIonRedirect.bind(this),
2340
+ getIonRoute: this.getIonRoute.bind(this),
2341
+ getStackManager: this.getStackManager.bind(this),
2342
+ getPageManager: this.getPageManager.bind(this),
2343
+ routeInfo: this.props.routeInfo,
2344
+ setCurrentTab: this.props.onSetCurrentTab,
2345
+ changeTab: this.props.onChangeTab,
2346
+ resetTab: this.props.onResetTab,
2347
+ };
2348
+ }
2349
+ componentDidMount() {
2350
+ if (typeof document !== 'undefined') {
2351
+ this.handleHardwareBackButton = this.handleHardwareBackButton.bind(this);
2352
+ document.addEventListener('ionBackButton', this.handleHardwareBackButton);
2353
+ }
2354
+ }
2355
+ componentWillUnmount() {
2356
+ if (typeof document !== 'undefined') {
2357
+ document.removeEventListener('ionBackButton', this.handleHardwareBackButton);
2358
+ }
2359
+ }
2360
+ handleHardwareBackButton(e) {
2361
+ e.detail.register(0, (processNextHandler) => {
2362
+ this.nativeGoBack();
2363
+ processNextHandler();
2364
+ });
2365
+ }
2366
+ goBack(route, animationBuilder) {
2367
+ this.props.onNavigateBack(route, animationBuilder);
2368
+ }
2369
+ nativeGoBack() {
2370
+ this.props.onNativeBack();
2371
+ }
2372
+ navigate(path, direction = 'forward', action = 'push', animationBuilder, options, tab) {
2373
+ this.props.onNavigate(path, action, direction, animationBuilder, options, tab);
2374
+ }
2375
+ getPageManager() {
2376
+ return PageManager;
2377
+ }
2378
+ getIonRedirect() {
2379
+ return this.props.ionRedirect;
2380
+ }
2381
+ getIonRoute() {
2382
+ return this.props.ionRoute;
2383
+ }
2384
+ getStackManager() {
2385
+ return this.props.stackManager;
2386
+ }
2387
+ render() {
2388
+ return (React.createElement(NavContext.Provider, { value: Object.assign(Object.assign({}, this.state), { routeInfo: this.props.routeInfo }) },
2389
+ React.createElement(IonRouterContext.Provider, { value: Object.assign(Object.assign({}, this.ionRouterContextValue), { routeInfo: this.props.routeInfo }) }, this.props.children)));
2390
+ }
2391
+ }
2392
+
2393
+ class ViewStacks {
2394
+ constructor() {
2395
+ this.viewStacks = {};
2396
+ this.add = this.add.bind(this);
2397
+ this.clear = this.clear.bind(this);
2398
+ this.getViewItemsForOutlet = this.getViewItemsForOutlet.bind(this);
2399
+ this.remove = this.remove.bind(this);
2400
+ }
2401
+ add(viewItem) {
2402
+ const { outletId } = viewItem;
2403
+ if (!this.viewStacks[outletId]) {
2404
+ this.viewStacks[outletId] = [viewItem];
2405
+ }
2406
+ else {
2407
+ this.viewStacks[outletId].push(viewItem);
2408
+ }
2409
+ }
2410
+ clear(outletId) {
2411
+ // Give some time for the leaving views to transition before removing
2412
+ return setTimeout(() => {
2413
+ delete this.viewStacks[outletId];
2414
+ }, 500);
2415
+ }
2416
+ getViewItemsForOutlet(outletId) {
2417
+ return this.viewStacks[outletId] || [];
2418
+ }
2419
+ remove(viewItem) {
2420
+ const { outletId } = viewItem;
2421
+ const viewStack = this.viewStacks[outletId];
2422
+ if (viewStack) {
2423
+ const viewItemToRemove = viewStack.find((x) => x.id === viewItem.id);
2424
+ if (viewItemToRemove) {
2425
+ viewItemToRemove.mount = false;
2426
+ this.viewStacks[outletId] = viewStack.filter((x) => x.id !== viewItemToRemove.id);
2427
+ }
2428
+ }
2429
+ }
2430
+ getStackIds() {
2431
+ return Object.keys(this.viewStacks);
2432
+ }
2433
+ getAllViewItems() {
2434
+ const keys = this.getStackIds();
2435
+ const viewItems = [];
2436
+ keys.forEach((k) => {
2437
+ viewItems.push(...this.viewStacks[k]);
2438
+ });
2439
+ return viewItems;
2440
+ }
2441
+ }
2442
+
2443
+ export { CreateAnimation, DefaultIonLifeCycleContext, IonAccordion, IonAccordionGroup, IonActionSheet, IonAlert, IonApp, IonAvatar, IonBackButton, IonBackdrop, IonBadge, IonBreadcrumb, IonBreadcrumbs, IonButton, IonButtons, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonCheckbox, IonChip, IonCol, IonContent, IonDatetime, IonDatetimeButton, IonFab, IonFabButton, IonFabList, IonFooter, IonGrid, IonHeader, IonIcon, IonImg, IonInfiniteScroll, IonInfiniteScrollContent, IonInput, IonItem, IonItemDivider, IonItemGroup, IonItemOption, IonItemOptions, IonItemSliding, IonLabel, IonLifeCycleContext, IonList, IonListHeader, IonLoading, IonMenu, IonMenuButton, IonMenuToggle, IonModal, IonNav, IonNavLink, IonNote, IonPage, IonPicker, IonPopover, IonProgressBar, IonRadio, IonRadioGroup, IonRange, IonRedirect, IonRefresher, IonRefresherContent, IonReorder, IonReorderGroup, IonRippleEffect, IonRoute, IonRouterContext, IonRouterLink, IonRouterOutlet, IonRow, IonSearchbar, IonSegment, IonSegmentButton, IonSelect, IonSelectOption, IonSkeletonText, IonSpinner, IonSplitPane, IonTab, IonTabBar, IonTabButton, IonTabs, IonTabsContext, IonText, IonTextarea, IonThumbnail, IonTitle, IonToast, IonToggle, IonToolbar, LocationHistory, NavContext, NavManager, RouteManagerContext, StackContext, ViewLifeCycleManager, ViewStacks, generateId, getConfig, getPlatforms, isPlatform, setupIonicReact, useIonActionSheet, useIonAlert, useIonLoading, useIonModal, useIonPicker, useIonPopover, useIonRouter, useIonToast, useIonViewDidEnter, useIonViewDidLeave, useIonViewWillEnter, useIonViewWillLeave, withIonLifeCycle };
9
2444
  //# sourceMappingURL=index.js.map