@qonto/embed-sdk 0.63.0 → 0.64.1

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 (261) hide show
  1. package/dist/auth-links/client/auth-links.client.d.ts.map +1 -1
  2. package/dist/beneficiaries/client/beneficiaries.client.d.ts.map +1 -1
  3. package/dist/cards/client/cards.client.d.ts.map +1 -1
  4. package/dist/common/analytics/analytics-tracker.d.ts +18 -2
  5. package/dist/common/analytics/analytics-tracker.d.ts.map +1 -1
  6. package/dist/common/analytics/analytics.constants.d.ts +18 -2
  7. package/dist/common/analytics/analytics.constants.d.ts.map +1 -1
  8. package/dist/index.server.d.ts +7 -1
  9. package/dist/index.server.d.ts.map +1 -1
  10. package/dist/index.umd.js +2 -2
  11. package/dist/organizations/client/organizations.client.d.ts.map +1 -1
  12. package/dist/organizations/index.d.ts +2 -2
  13. package/dist/organizations/index.server.d.ts +2 -2
  14. package/dist/payment-links/client/payment-links.client.d.ts +95 -0
  15. package/dist/payment-links/client/payment-links.client.d.ts.map +1 -0
  16. package/dist/payment-links/client/payment-links.client.test.d.ts +2 -0
  17. package/dist/payment-links/client/payment-links.client.test.d.ts.map +1 -0
  18. package/dist/payment-links/index.d.ts +27 -6
  19. package/dist/payment-links/index.d.ts.map +1 -1
  20. package/dist/payment-links/index.server.d.ts +35 -0
  21. package/dist/payment-links/index.server.d.ts.map +1 -0
  22. package/dist/payment-links/server/payment-links.server.d.ts +50 -0
  23. package/dist/payment-links/server/payment-links.server.d.ts.map +1 -0
  24. package/dist/payment-links/server/payment-links.server.test.d.ts +2 -0
  25. package/dist/payment-links/server/payment-links.server.test.d.ts.map +1 -0
  26. package/dist/payment-links/shared/currency.validation.d.ts.map +1 -0
  27. package/dist/payment-links/shared/payment-links.shared.test.d.ts +2 -0
  28. package/dist/payment-links/shared/payment-links.shared.test.d.ts.map +1 -0
  29. package/dist/payment-links/{payment-links.types.d.ts → shared/payment-links.types.d.ts} +2 -2
  30. package/dist/payment-links/shared/payment-links.types.d.ts.map +1 -0
  31. package/dist/payment-links/{validation → shared}/payment-links.validate.d.ts +1 -1
  32. package/dist/payment-links/shared/payment-links.validate.d.ts.map +1 -0
  33. package/dist/payment-links/shared/unit.validation.d.ts.map +1 -0
  34. package/dist/sepa-transfers/bulk-transfers/client/bulk-transfers.client.d.ts.map +1 -1
  35. package/dist/sepa-transfers/client/sepa-transfers.client.d.ts.map +1 -1
  36. package/dist/server/auth-links/client/auth-links.client.d.ts.map +1 -1
  37. package/dist/server/beneficiaries/client/beneficiaries.client.d.ts.map +1 -1
  38. package/dist/server/cards/client/cards.client.d.ts.map +1 -1
  39. package/dist/server/common/analytics/analytics-tracker.d.ts +18 -2
  40. package/dist/server/common/analytics/analytics-tracker.d.ts.map +1 -1
  41. package/dist/server/common/analytics/analytics.constants.d.ts +18 -2
  42. package/dist/server/common/analytics/analytics.constants.d.ts.map +1 -1
  43. package/dist/server/index.server.d.ts +7 -1
  44. package/dist/server/index.server.d.ts.map +1 -1
  45. package/dist/server/index.server.umd.js +1 -1
  46. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/attribution/helpers.js +1 -0
  47. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/attribution/web-attribution.js +1 -0
  48. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js +1 -0
  49. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js +1 -0
  50. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/config/joined-config.js +1 -0
  51. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/config.js +1 -0
  52. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/constants.js +1 -0
  53. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js +1 -0
  54. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/default-tracking.js +1 -0
  55. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/det-notification.js +1 -0
  56. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/index.js +1 -0
  57. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/lib-prefix.js +1 -0
  58. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js +1 -0
  59. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js +1 -0
  60. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js +1 -0
  61. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/plugins/network-connectivity-checker.js +1 -0
  62. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js +1 -0
  63. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/storage/session-storage.js +1 -0
  64. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js +1 -0
  65. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js +1 -0
  66. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/types.js +1 -0
  67. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js +1 -0
  68. package/dist/server/node_modules/.pnpm/@amplitude_analytics-browser@2.32.2/node_modules/@amplitude/analytics-browser/lib/esm/version.js +1 -0
  69. package/dist/server/node_modules/.pnpm/@amplitude_analytics-connector@1.6.4/node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js +1 -0
  70. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/analytics-connector.js +1 -0
  71. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/campaign/campaign-parser.js +1 -0
  72. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/config.js +1 -0
  73. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/cookie-name.js +1 -0
  74. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/core-client.js +1 -0
  75. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-client.js +1 -0
  76. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-storage.js +1 -0
  77. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/diagnostics/uncaught-sdk-errors.js +1 -0
  78. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js +1 -0
  79. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/identify.js +1 -0
  80. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/language.js +1 -0
  81. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/logger.js +1 -0
  82. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/network-observer.js +1 -0
  83. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/network-request-event.js +1 -0
  84. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js +1 -0
  85. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/plugins/helpers.js +1 -0
  86. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/plugins/identity.js +1 -0
  87. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/query-params.js +1 -0
  88. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/remote-config/remote-config-localstorage.js +1 -0
  89. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/remote-config/remote-config.js +1 -0
  90. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/revenue.js +1 -0
  91. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/session.js +1 -0
  92. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/storage/browser-storage.js +1 -0
  93. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/storage/cookie.js +1 -0
  94. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/storage/helpers.js +1 -0
  95. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js +1 -0
  96. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/timeline.js +1 -0
  97. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js +1 -0
  98. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/transports/fetch.js +1 -0
  99. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js +1 -0
  100. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/element-interactions.js +1 -0
  101. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js +1 -0
  102. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/frustration-interactions.js +1 -0
  103. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js +1 -0
  104. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js +1 -0
  105. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js +1 -0
  106. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js +1 -0
  107. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/types/status.js +1 -0
  108. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js +1 -0
  109. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js +1 -0
  110. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js +1 -0
  111. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/json-query.js +1 -0
  112. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/observable.js +1 -0
  113. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js +1 -0
  114. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js +1 -0
  115. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/sampling.js +1 -0
  116. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js +1 -0
  117. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/url-utils.js +1 -0
  118. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js +1 -0
  119. package/dist/server/node_modules/.pnpm/@amplitude_analytics-core@2.34.1/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js +1 -0
  120. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/autocapture/track-action-click.js +1 -0
  121. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/autocapture/track-change.js +1 -0
  122. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/autocapture/track-click.js +1 -0
  123. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/autocapture/track-dead-click.js +1 -0
  124. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/autocapture/track-rage-click.js +1 -0
  125. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/autocapture-plugin.js +1 -0
  126. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/constants.js +1 -0
  127. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/data-extractor.js +1 -0
  128. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/frustration-plugin.js +1 -0
  129. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/helpers.js +1 -0
  130. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/hierarchy.js +1 -0
  131. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/libs/messenger.js +1 -0
  132. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/observables.js +1 -0
  133. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/pageActions/actions.js +1 -0
  134. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/pageActions/matchEventToFilter.js +1 -0
  135. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/pageActions/triggers.js +1 -0
  136. package/dist/server/node_modules/.pnpm/@amplitude_plugin-autocapture-browser@1.18.2/node_modules/@amplitude/plugin-autocapture-browser/lib/esm/version.js +1 -0
  137. package/dist/server/node_modules/.pnpm/@amplitude_plugin-network-capture-browser@1.7.2/node_modules/@amplitude/plugin-network-capture-browser/lib/esm/constants.js +1 -0
  138. package/dist/server/node_modules/.pnpm/@amplitude_plugin-network-capture-browser@1.7.2/node_modules/@amplitude/plugin-network-capture-browser/lib/esm/network-capture-plugin.js +1 -0
  139. package/dist/server/node_modules/.pnpm/@amplitude_plugin-network-capture-browser@1.7.2/node_modules/@amplitude/plugin-network-capture-browser/lib/esm/track-network-event.js +1 -0
  140. package/dist/server/node_modules/.pnpm/@amplitude_plugin-page-url-enrichment-browser@0.5.8/node_modules/@amplitude/plugin-page-url-enrichment-browser/lib/esm/page-url-enrichment.js +1 -0
  141. package/dist/server/node_modules/.pnpm/@amplitude_plugin-page-view-tracking-browser@2.6.5/node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js +1 -0
  142. package/dist/server/node_modules/.pnpm/@amplitude_plugin-page-view-tracking-browser@2.6.5/node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/utils.js +1 -0
  143. package/dist/server/node_modules/.pnpm/@amplitude_plugin-web-vitals-browser@1.1.2/node_modules/@amplitude/plugin-web-vitals-browser/lib/esm/constants.js +1 -0
  144. package/dist/server/node_modules/.pnpm/@amplitude_plugin-web-vitals-browser@1.1.2/node_modules/@amplitude/plugin-web-vitals-browser/lib/esm/web-vitals-plugin.js +1 -0
  145. package/dist/server/node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.39.0_tslib@2.8.1_typescript@5.8.3/node_modules/tslib/tslib.es6.js +1 -0
  146. package/dist/server/node_modules/.pnpm/web-vitals@5.0.1/node_modules/web-vitals/dist/web-vitals.js +1 -0
  147. package/dist/server/node_modules/.pnpm/zen-observable-ts@1.1.0/node_modules/zen-observable-ts/module.js +1 -0
  148. package/dist/server/organizations/client/organizations.client.d.ts.map +1 -1
  149. package/dist/server/organizations/index.d.ts +2 -2
  150. package/dist/server/organizations/index.server.d.ts +2 -2
  151. package/dist/server/payment-links/client/payment-links.client.d.ts +95 -0
  152. package/dist/server/payment-links/client/payment-links.client.d.ts.map +1 -0
  153. package/dist/server/payment-links/client/payment-links.client.test.d.ts +2 -0
  154. package/dist/server/payment-links/client/payment-links.client.test.d.ts.map +1 -0
  155. package/dist/server/payment-links/index.d.ts +27 -6
  156. package/dist/server/payment-links/index.d.ts.map +1 -1
  157. package/dist/server/payment-links/index.server.d.ts +35 -0
  158. package/dist/server/payment-links/index.server.d.ts.map +1 -0
  159. package/dist/server/payment-links/server/payment-links.server.d.ts +50 -0
  160. package/dist/server/payment-links/server/payment-links.server.d.ts.map +1 -0
  161. package/dist/server/payment-links/server/payment-links.server.test.d.ts +2 -0
  162. package/dist/server/payment-links/server/payment-links.server.test.d.ts.map +1 -0
  163. package/dist/server/payment-links/shared/currency.validation.d.ts.map +1 -0
  164. package/dist/server/payment-links/shared/payment-links.shared.test.d.ts +2 -0
  165. package/dist/server/payment-links/shared/payment-links.shared.test.d.ts.map +1 -0
  166. package/dist/server/payment-links/{payment-links.types.d.ts → shared/payment-links.types.d.ts} +2 -2
  167. package/dist/server/payment-links/shared/payment-links.types.d.ts.map +1 -0
  168. package/dist/server/payment-links/{validation → shared}/payment-links.validate.d.ts +1 -1
  169. package/dist/server/payment-links/shared/payment-links.validate.d.ts.map +1 -0
  170. package/dist/server/payment-links/shared/unit.validation.d.ts.map +1 -0
  171. package/dist/server/sepa-transfers/bulk-transfers/client/bulk-transfers.client.d.ts.map +1 -1
  172. package/dist/server/sepa-transfers/client/sepa-transfers.client.d.ts.map +1 -1
  173. package/dist/server/src/auth-links/auth-links.js +1 -1
  174. package/dist/server/src/auth-links/index.server.js +1 -0
  175. package/dist/server/src/auth-links/server/auth-links.server.js +1 -0
  176. package/dist/server/src/beneficiaries/index.server.js +1 -0
  177. package/dist/server/src/beneficiaries/server/beneficiaries.server.js +1 -0
  178. package/dist/server/src/beneficiaries/shared/beneficiaries.api.js +1 -1
  179. package/dist/server/src/beneficiaries/shared/beneficiaries.serializer.js +1 -1
  180. package/dist/server/src/beneficiaries/shared/beneficiaries.validate.js +1 -1
  181. package/dist/server/src/cards/index.server.js +1 -0
  182. package/dist/server/src/cards/server/cards.server.js +1 -0
  183. package/dist/server/src/cards/shared/cards.api.js +1 -0
  184. package/dist/server/src/cards/shared/cards.serializer.js +1 -0
  185. package/dist/server/src/cards/shared/cards.types.js +1 -0
  186. package/dist/server/src/cards/shared/cards.validate.js +1 -0
  187. package/dist/server/src/common/analytics/amplitude-manager.js +1 -0
  188. package/dist/server/src/common/analytics/analytics-tracker.js +1 -0
  189. package/dist/server/src/common/analytics/analytics.constants.js +1 -0
  190. package/dist/server/src/common/logger/logger.js +1 -0
  191. package/dist/server/src/index.server.js +1 -1
  192. package/dist/server/src/organizations/index.server.js +1 -0
  193. package/dist/server/src/organizations/server/organizations.server.js +1 -0
  194. package/dist/server/src/organizations/shared/organizations.api.js +1 -0
  195. package/dist/server/src/organizations/shared/organizations.serializer.js +1 -0
  196. package/dist/server/src/payment-links/index.server.js +1 -0
  197. package/dist/server/src/payment-links/server/payment-links.server.js +1 -0
  198. package/dist/server/src/payment-links/shared/payment-links.validate.js +1 -0
  199. package/dist/server/src/transactions/index.server.js +1 -0
  200. package/dist/server/src/transactions/server/transactions.server.js +1 -0
  201. package/dist/server/src/transactions/shared/transactions.api.js +1 -0
  202. package/dist/server/src/transactions/shared/transactions.serializer.js +1 -0
  203. package/dist/server/src/transactions/shared/transactions.validation.js +1 -0
  204. package/dist/server/transactions/client/transactions.client.d.ts.map +1 -1
  205. package/dist/server/types/types.public-api.d.ts +1 -1
  206. package/dist/server/types/types.public-api.d.ts.map +1 -1
  207. package/dist/server/validation/operation-settings-validation.d.ts +2 -1
  208. package/dist/server/validation/operation-settings-validation.d.ts.map +1 -1
  209. package/dist/src/auth-links/client/auth-links.client.js +1 -1
  210. package/dist/src/auth-links/shared/auth-links.api.js +1 -1
  211. package/dist/src/beneficiaries/client/beneficiaries.client.js +1 -1
  212. package/dist/src/cards/client/cards.client.js +1 -1
  213. package/dist/src/common/analytics/analytics-tracker.js +1 -1
  214. package/dist/src/common/analytics/analytics.constants.js +1 -1
  215. package/dist/src/organizations/client/organizations.client.js +1 -1
  216. package/dist/src/payment-links/client/payment-links.client.js +1 -0
  217. package/dist/src/payment-links/index.js +1 -1
  218. package/dist/src/payment-links/shared/currency.validation.js +1 -0
  219. package/dist/src/payment-links/shared/payment-links.types.js +1 -0
  220. package/dist/src/payment-links/shared/payment-links.validate.js +1 -0
  221. package/dist/src/payment-links/shared/unit.validation.js +1 -0
  222. package/dist/src/sepa-transfers/bulk-transfers/client/bulk-transfers.client.js +1 -1
  223. package/dist/src/sepa-transfers/client/sepa-transfers.client.js +1 -1
  224. package/dist/src/transactions/client/transactions.client.js +1 -1
  225. package/dist/transactions/client/transactions.client.d.ts.map +1 -1
  226. package/dist/types/types.public-api.d.ts +1 -1
  227. package/dist/types/types.public-api.d.ts.map +1 -1
  228. package/dist/validation/operation-settings-validation.d.ts +2 -1
  229. package/dist/validation/operation-settings-validation.d.ts.map +1 -1
  230. package/package.json +5 -1
  231. package/dist/payment-links/payment-links.d.ts +0 -58
  232. package/dist/payment-links/payment-links.d.ts.map +0 -1
  233. package/dist/payment-links/payment-links.public-api.d.ts +0 -5
  234. package/dist/payment-links/payment-links.public-api.d.ts.map +0 -1
  235. package/dist/payment-links/payment-links.test.d.ts +0 -2
  236. package/dist/payment-links/payment-links.test.d.ts.map +0 -1
  237. package/dist/payment-links/payment-links.types.d.ts.map +0 -1
  238. package/dist/payment-links/validation/currency.validation.d.ts.map +0 -1
  239. package/dist/payment-links/validation/payment-links.validate.d.ts.map +0 -1
  240. package/dist/payment-links/validation/unit.validation.d.ts.map +0 -1
  241. package/dist/server/payment-links/payment-links.d.ts +0 -58
  242. package/dist/server/payment-links/payment-links.d.ts.map +0 -1
  243. package/dist/server/payment-links/payment-links.public-api.d.ts +0 -5
  244. package/dist/server/payment-links/payment-links.public-api.d.ts.map +0 -1
  245. package/dist/server/payment-links/payment-links.test.d.ts +0 -2
  246. package/dist/server/payment-links/payment-links.test.d.ts.map +0 -1
  247. package/dist/server/payment-links/payment-links.types.d.ts.map +0 -1
  248. package/dist/server/payment-links/validation/currency.validation.d.ts.map +0 -1
  249. package/dist/server/payment-links/validation/payment-links.validate.d.ts.map +0 -1
  250. package/dist/server/payment-links/validation/unit.validation.d.ts.map +0 -1
  251. package/dist/src/auth-links/auth-links.js +0 -1
  252. package/dist/src/payment-links/payment-links.js +0 -1
  253. package/dist/src/payment-links/payment-links.public-api.js +0 -1
  254. package/dist/src/payment-links/validation/payment-links.validate.js +0 -1
  255. /package/dist/payment-links/{validation → shared}/currency.validation.d.ts +0 -0
  256. /package/dist/payment-links/{validation → shared}/unit.validation.d.ts +0 -0
  257. /package/dist/server/payment-links/{validation → shared}/currency.validation.d.ts +0 -0
  258. /package/dist/server/payment-links/{validation → shared}/unit.validation.d.ts +0 -0
  259. /package/dist/{src/payment-links/validation → server/src/payment-links/shared}/currency.validation.js +0 -0
  260. /package/dist/{src/payment-links → server/src/payment-links/shared}/payment-links.types.js +0 -0
  261. /package/dist/{src/payment-links/validation → server/src/payment-links/shared}/unit.validation.js +0 -0
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbedServer={})}(this,(function(e){"use strict";const n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));let t;const a=new Uint8Array(16);var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function s(e,s,o){if(r.randomUUID&&!e)return r.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!t){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(a)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}(i)}function o(e){const n=new URLSearchParams;return e?.page&&n.append("page",e.page.toString()),e?.itemsPerPage&&n.append("per_page",e.itemsPerPage.toString()),n}function i(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}class c{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return c.instance||(c.instance=new c),c.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const u=c.getInstance();class d extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class f extends d{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid authentication method. Provide either a proxyRequestFunction (recommended) or accessToken, either as parameters or by calling the initialize function first."}}function p(){if(!u.hasAccessToken())throw new f;return u.getAccessToken()}const g={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},l={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},T={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},h=3e4,m="REJECT",k={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"},b="https://embed.qonto.com",y="https://embed-js{branch}.staging.qonto.co",w="https://embed.dev.qonto.co",I={[g.PRODUCTION]:{EMBED_BASE_URL:b,EMBED_URL:`${b}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[g.STAGING]:{EMBED_BASE_URL:y,EMBED_URL:`${y}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[g.LOCAL]:{EMBED_BASE_URL:w,EMBED_URL:`${w}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class S{constructor(){let e,n;this.environment=g.PRODUCTION,this.branch=l.SANDBOX,"undefined"!=typeof process&&process.env&&(e=process.env.QONTO_EMBED_ENVIRONMENT,n=process.env.QONTO_EMBED_BRANCH),this.environment=Object.values(g).includes(e)?e:g.PRODUCTION,this.branch=Object.values(l).includes(n)?n:l.SANDBOX}static getInstance(){return S.instance||(S.instance=new S),S.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===g.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=g.PRODUCTION,this.branch=l.MASTER}getEnvironmentUrls(){if(this.environment===g.PRODUCTION)return I.production;{const e=I[this.environment];return Object.entries(e).reduce(((e,[n,t])=>({...e,[n]:t.replace("{branch}",`-${this.branch}`)})),{})}}}const _=S.getInstance();function P(){return!("undefined"!=typeof window&&"undefined"!=typeof document)}class E{constructor(){this.currentLocale="en"}static getInstance(){return E.instance||(E.instance=new E),E.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const A=E.getInstance();class v{constructor(){this.mfaPreference=T.PASSKEY,this.debugMode=!1}static getInstance(){return v.instance||(v.instance=new v),v.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction),e.proxyEndpointDescriptor&&(this.proxyEndpointDescriptor=e.proxyEndpointDescriptor)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}getProxyEndpointDescriptor(){return this.proxyEndpointDescriptor}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=T.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0,this.proxyEndpointDescriptor=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const D=v.getInstance();class R extends d{constructor({message:e,data:n,code:t}){super(),this.code=500;const a=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${a}`,this.data=n||{},this.code=t||this.code}}function x({accessToken:e,stagingToken:n,idempotencyKey:t,mfaPreference:a,scaSessionToken:r}){const s=new Headers;s.append("Authorization",`Bearer ${e}`);const o=n||u.getStagingToken();o&&s.append("X-Qonto-Staging-Token",o),t&&s.append("X-Qonto-Idempotency-Key",t);const i=a||D.getMFAPreference();return i&&s.append("X-Qonto-2fa-Preference",i),r&&s.append("X-Qonto-SCA-Session-Token",r),s.append("Content-Type","application/json"),s.append("Accept-Language",A.getLocale()),s}async function U({path:e,options:n}){const t=`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,a=await fetch(t,{...n,headers:x(n.headers),body:n.body?JSON.stringify(n.body):void 0});if(204===a.status)return;const r=await a.json();if(!a.ok)throw r.errors?new R({code:a.status,message:r.errors.map((e=>`${e.code}: ${e.detail}`))}):new R({code:a.status,message:`${r.code}: ${r.detail}`,data:r});return r}function O(e){const n={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},t=JSON.stringify(n);return a=t,P()?Buffer.from(a).toString("base64"):btoa(a);var a}function $(e){return JSON.parse((n=e,P()?Buffer.from(n,"base64").toString("utf-8"):atob(n)));var n}function q(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function M(e){return{name:e.name,iban:e.iban}}const N="/v2/sepa",L=`${N}/transfers`;async function C({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${L}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{transfers:r,meta:s}=await U(a);return{transfers:r,meta:s}}async function j({accessToken:e,stagingToken:n,sepaTransferId:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:t,accessToken:e,stagingToken:n}),{transfer:r}=await U(a);return r}async function B({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}){const o=function(e){const n=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:n,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}(e);return{path:L,options:{method:"POST",headers:{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s},body:{transfer:o,vop_proof_token:n}}}}({transfer:e,vopProofToken:n,accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:s}),{transfer:i}=await U(o);return i}async function F({sepaTransferId:e,accessToken:n,stagingToken:t}){const a=function({sepaTransferId:e,accessToken:n,stagingToken:t}){return{path:`${L}/${e}/cancel`,options:{method:"POST",headers:{accessToken:n,stagingToken:t}}}}({sepaTransferId:e,accessToken:n,stagingToken:t});await U(a)}async function K({sepaPayee:e,accessToken:n,stagingToken:t}){const a=function({sepaPayee:e,accessToken:n,stagingToken:t}){return{path:`${N}/verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:n,stagingToken:t});return await U(a)}function Y(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function G(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}const H="/v2/sepa/bulk_transfers";async function Q({accessToken:e,stagingToken:n,paginationSettings:t}){const a=function({paginationSettings:e,accessToken:n,stagingToken:t}){const a={method:"GET",headers:{accessToken:n,stagingToken:t}},r=o(e),s=r.size?`?${r.toString()}`:"";return{path:`${H}${s}`,options:a}}({paginationSettings:t,accessToken:e,stagingToken:n}),{bulk_transfers:r,meta:s}=await U(a);return{bulkTransfers:r,meta:s}}async function X({accessToken:e,stagingToken:n,bulkTransferId:t}){const a=function({bulkTransferId:e,accessToken:n,stagingToken:t}){return{path:`${H}/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}({bulkTransferId:t,accessToken:e,stagingToken:n}),{bulk_transfer:r}=await U(a);return r}async function z({sepaPayees:e,accessToken:n,stagingToken:t}){const a=function({sepaPayees:e,accessToken:n,stagingToken:t}){return{path:`${N}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:n,stagingToken:t},body:{requests:e.map(M)}}}}({sepaPayees:e,accessToken:n,stagingToken:t});return await U(a)}class J extends d{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}function V(e,n){const t=n.filter((n=>n.requiredIfPresent?!e[n.name]&&e[n.requiredIfPresent]:void 0===e[n.name])).map((e=>e.name));if(t.length>0)throw new J(t.map((e=>`Missing required parameter: ${e}`)))}function W(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function Z(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}function ee(e){if(!e)throw new J("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new J("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new J("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new J("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,n)=>{!function(e,n){if(!e)throw new J(`Invalid bulkTransfer at index ${n}: bulkTransfer object is required`);if(!e.beneficiary)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new J(`Invalid bulkTransfer at index ${n}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new J(`Invalid bulkTransfer at index ${n}: Beneficiary name is required as part of the beneficiary details`);const t=W({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),a=Z({amount:e.amount}),r=[...t,...a].flat();if(r.length>0)throw new J(r);if(e.amount>h&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new J(`Invalid bulkTransfer at index ${n}: Attachments are required for transfers over €30000`)}(e,n)})),e}const ne={getBulkTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await Q({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.bulkTransfers?.map(Y),c=i(s.meta);return{bulkTransfers:o,...c?{meta:c}:{}}},getBulkTransfer:async function({bulkTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new J("bulkTransferId must be a string.");return e}(e?.bulkTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return Y(await X({accessToken:s,stagingToken:r,bulkTransferId:t}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s(),u=ee(e),d=new Map;for(const e of u.bulkTransfers){const n=e.beneficiary;if(n){const e=n.iban;e&&!d.has(e)&&d.set(e,{name:n.name,iban:e})}}const f=Array.from(d.values()),g=await z({sepaPayees:f,accessToken:i,stagingToken:a});if((yield g.requests.map(G))===m)return;const l=await async function({bulkTransfers:e,accessToken:n,stagingToken:t,scaSessionToken:a,bankAccountId:r,idempotencyKey:s}){const o={method:"POST",headers:{...x({accessToken:n,stagingToken:t,scaSessionToken:a,idempotencyKey:s})},body:JSON.stringify({bank_account_id:r,bulk_transfers:e.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))})},i=new URL(`${_.getEnvironmentUrls().THIRD_PARTY_API_URL}${H}`),c=await fetch(i,o),u=await c.json();if(!c.ok||u.errors)throw new R({message:u.errors?u.errors.map((e=>`${e.code}: ${e.detail}`)).join(", "):"Failed to create SEPA bulk transfer"});return u.bulk_transfer}({bulkTransfers:u.bulkTransfers,bankAccountId:u.bankAccountId,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c});return{bulkTransfer:Y(l),meta:{idempotencyKey:c}}}};class te extends d{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}async function ae({proxyFunction:e,networkCallDescriptor:n,proxyEndpointDescriptor:t}){if(t){const e={...Object.fromEntries([...x(n.options?.headers)??{}])},a=O({...n,options:{...n.options,headers:e}}),r=await fetch(t.path,{method:t.method,headers:t.options.headers,body:a}),s=$(await r.text());if(!r.ok)throw new R({code:r.status,data:s,message:`Error from proxy endpoint: ${r.status} ${r.statusText}`});return s}if(e){const t=Object.fromEntries([...x(n.options?.headers)??{}]),a=O({...n,options:{...n.options,headers:t}});return $(await e(a))}throw new te("No proxy function or proxy endpoint descriptor provided for proxy call.")}const re={requiresUI:!1};function se(e,{requiresUI:n}=re){const t=e?.uiParentElementId||D.getUIParentElementId();if(n){if(!t)throw new J("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");if(!["string","function"].includes(typeof t))throw new J("operationSettings.uiParentElementId must be a string or a function returning an HTMLElement")}const a=e?.mfaPreference||D.getMFAPreference();if(a){const e=(r=Object.values(T),_.isProductionEnvironment()?r.filter((e=>e!==T.MOCK)):r);if(!e.includes(a))throw new J(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(_.isProductionEnvironment()&&a===T.MOCK)throw new J("operationSettings.mfaPreference cannot be set to mock in production environment.")}var r;const s=e?.debugMode||D.getDebugMode();if(void 0!==s&&"boolean"!=typeof s)throw new J("operationSettings.debugMode must be a boolean.");const o=e?.proxyRequestFunction||D.getProxyRequestFunction();if(o&&"function"!=typeof o)throw new J("operationSettings.proxyRequestFunction must be a function.");const i=e?.proxyEndpointDescriptor||D.getProxyEndpointDescriptor();if(i&&!i.path)throw new J("operationSettings.proxyEndpointDescriptor must have at least a string-formatted path property.");return{...e,uiParentElementId:t,mfaPreference:a,debugMode:s,proxyRequestFunction:o,proxyEndpointDescriptor:i}}function oe({accessToken:e,stagingToken:n,action:t,callbackUrl:a}){const r={post_authn_action:t};return a&&(r.callback_url=a),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:n},body:{embed_auth_link:r}}}}function ie(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}async function ce({requestSettings:e,operationSettings:n}){!function(e){if(!e||"object"!=typeof e)throw new J("requestSettings must be an object");const n=e,{action:t,callbackUrl:a}=e;V(n,[{name:"action"}]);const r=W(n),s=Object.values(k);if(s.includes(t)||r.push(`action must be one of ${s.join(", ")}`),r.length>0)throw new J(r);if(void 0!==a&&""===a.trim())throw new J("callbackUrl cannot be empty")}(e);const{proxyRequestFunction:t,proxyEndpointDescriptor:a,stagingToken:r}=se(n||{});if(t||a){const n=oe({stagingToken:r,action:e.action,callbackUrl:e.callbackUrl});return ie((await ae({proxyFunction:t,proxyEndpointDescriptor:a,networkCallDescriptor:n})).body)}{const t=n?.accessToken||p();return ie(await async function(e){const n=oe({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:t}=await U(n);return{url:t.url,post_authn_action:t.post_authn_action,callback_url:t.callback_url,expired_at:t.expired_at,used_at:t.used_at}}({accessToken:t,stagingToken:r,action:e.action,callbackUrl:e.callbackUrl}))}}function ue(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function de({beneficiaryId:e,accessToken:n,stagingToken:t}){return{path:`/v2/sepa/beneficiaries/${e}`,options:{method:"GET",headers:{accessToken:n,stagingToken:t}}}}async function fe({beneficiarySettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("beneficiaryId must be a string");return e}(e?.beneficiaryId),{proxyRequestFunction:a,proxyEndpointDescriptor:r,accessToken:s,stagingToken:o}=se(n||{});if(a||r){const e=de({beneficiaryId:t});return ue((await ae({proxyFunction:a,proxyEndpointDescriptor:r,networkCallDescriptor:e})).body.beneficiary)}{const e=s||p(),n=await async function({accessToken:e,stagingToken:n,beneficiaryId:t}){const a=de({beneficiaryId:t,accessToken:e,stagingToken:n}),{beneficiary:r}=await U(a);return r}({beneficiaryId:t,accessToken:e,stagingToken:o});return ue(n)}}function pe(e,n){const t=n?.locale||A.getLocale(),a=new URL(e);return t&&a.searchParams.append("lang",t),n?.mfaPreference&&a.searchParams.append("mfaPreference",n.mfaPreference),n?.idempotencyKey&&a.searchParams.append("idempotencyKey",n.idempotencyKey),a.toString()}const ge=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const le={getSepaTransfers:async function(e){const{accessToken:n,stagingToken:t,paginationSettings:a}=e?.operationSettings||{},r=n||p(),s=await C({accessToken:r,stagingToken:t,paginationSettings:a}),o=s.transfers.map(q),c=i(s.meta);return{transfers:o,...c?{meta:c}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();return q(await j({sepaTransferId:t,accessToken:s,stagingToken:r}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:n}){const{accessToken:t,stagingToken:a,scaSessionToken:r,idempotencyKey:o}=n||{},i=t||p(),c=o||s();!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");if(!e.beneficiaryId&&!e.beneficiary)throw new J("Either beneficiaryId or beneficiary must be provided");const n=W({beneficiaryId:e.beneficiaryId});if(n.length>0)throw new J(n)}(e);const u=e?.beneficiary?e.beneficiary:await async function({sepaTransferSettings:e,operationSettings:n}){return e?.beneficiary?e.beneficiary:await fe({beneficiarySettings:{beneficiaryId:e?.beneficiaryId},operationSettings:n})}({sepaTransferSettings:e,operationSettings:n}),d={name:u.name,iban:u.iban},f=await K({sepaPayee:d,accessToken:i,stagingToken:a}),g=yield(l=f,{matchResult:l.match_result,matchedName:l.matched_name});var l;let T;if("string"==typeof g){if(g===m)return}else{if(g.vopDecision===m)return;T=g.sepaTransferSettings}const k={...e,...T};!function(e){if(!e)throw new J("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new J("sepaTransferSettings must be an object");V(e,ge);const n=[...W({bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...Z({amount:e.amount})].flat();if(n.length>0)throw new J(n);if(e.amount>h&&(!e.attachmentIds||0===e.attachmentIds.length))throw new J("Attachments are required for transfers over €30,000")}(k);const b={...k,beneficiary:u};return{transfer:q(await B({transfer:b,vopProofToken:f.proof_token.token,accessToken:i,stagingToken:a,scaSessionToken:r,idempotencyKey:c})),meta:{idempotencyKey:c}}},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e)throw new J("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new J("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:a,stagingToken:r}=n||{},s=a||p();await F({sepaTransferId:t,accessToken:s,stagingToken:r})},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:n}){const t=function(e){if(!e||!e.callbackUrl)throw new J("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new J("callbackUrl must be a string");return e.callbackUrl}(e),{accessToken:a,stagingToken:r}=n||{},s=a||p(),o=await ce({requestSettings:{action:k.SEPA_TRANSFER_CREATE,callbackUrl:t},operationSettings:{stagingToken:r,accessToken:s}});return{...o,url:pe(o.url,n)}},bulkTransfers:ne};e.sepaTransfers=le}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QontoEmbedServer={})}(this,(function(e){"use strict";class t{constructor(){this.accessToken=null,this.stagingToken=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}setAccessToken(e){this.accessToken=e}getAccessToken(){return this.accessToken}hasAccessToken(){return null!==this.accessToken&&""!==this.accessToken}clearAccessToken(){this.accessToken=null}setStagingToken(e){this.stagingToken=e}getStagingToken(){return this.stagingToken}hasStagingToken(){return null!==this.stagingToken&&""!==this.stagingToken}clearStagingToken(){this.stagingToken=null}}const n=t.getInstance();class r extends Error{constructor(){super(),this.stack=""}toString(){return`${this.name}: ${this.message}`}}class i extends r{constructor(){super(),this.name="AuthenticationError",this.message="Authentication failed due to missing or invalid authentication method. Provide either a proxyRequestFunction (recommended) or accessToken, either as parameters or by calling the initialize function first."}}function o(){if(!n.hasAccessToken())throw new i;return n.getAccessToken()}function a(){return!("undefined"!=typeof window&&"undefined"!=typeof document)}const s={PRODUCTION:"production",STAGING:"staging",LOCAL:"local"},c={MASTER:"master",SANDBOX:"sandbox",QA:"qa"},u={PASSKEY:"passkey",SMS_OTP:"sms-otp",PAIRED_DEVICE:"paired-device",MOCK:"mock"},l=3e4,d="REJECT",f={CARD_DISPLAY:"display_card",PAYMENT_LINK_CREATE:"create_payment_link",SEPA_TRANSFER_CREATE:"create_sepa_transfer"},p="https://embed.qonto.com",g="https://embed-js{branch}.staging.qonto.co",h="https://embed.dev.qonto.co",v={[s.PRODUCTION]:{EMBED_BASE_URL:p,EMBED_URL:`${p}/connect`,THIRD_PARTY_API_URL:"https://thirdparty.qonto.com"},[s.STAGING]:{EMBED_BASE_URL:g,EMBED_URL:`${g}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"},[s.LOCAL]:{EMBED_BASE_URL:h,EMBED_URL:`${h}/connect`,THIRD_PARTY_API_URL:"https://thirdparty{branch}.staging.qonto.co"}};class m{constructor(){let e,t;this.environment=s.PRODUCTION,this.branch=c.SANDBOX,"undefined"!=typeof process&&process.env&&(e=process.env.QONTO_EMBED_ENVIRONMENT,t=process.env.QONTO_EMBED_BRANCH),this.environment=Object.values(s).includes(e)?e:s.PRODUCTION,this.branch=Object.values(c).includes(t)?t:c.SANDBOX}static getInstance(){return m.instance||(m.instance=new m),m.instance}setEnvironment(e){this.environment=e}getEnvironment(){return this.environment}isProductionEnvironment(){return this.environment===s.PRODUCTION}setBranch(e){this.branch=e}getBranch(){return this.branch}clear(){this.environment=s.PRODUCTION,this.branch=c.MASTER}getEnvironmentUrls(){if(this.environment===s.PRODUCTION)return v.production;{const e=v[this.environment];return Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:n.replace("{branch}",`-${this.branch}`)})),{})}}}const y=m.getInstance();class b{constructor(){this.currentLocale="en"}static getInstance(){return b.instance||(b.instance=new b),b.instance}setLocale(e){this.currentLocale=e}getLocale(){return this.currentLocale}setDefaultLocale(){this.currentLocale="en"}}const T=b.getInstance();class w{constructor(){this.mfaPreference=u.PASSKEY,this.debugMode=!1}static getInstance(){return w.instance||(w.instance=new w),w.instance}setSettings(e){e.uiParentElementId&&(this.uiParentElementId=e.uiParentElementId),e.mfaPreference&&(this.mfaPreference=e.mfaPreference),e.debugMode&&(this.debugMode=e.debugMode),e.proxyRequestFunction&&(this.proxyRequestFunction=e.proxyRequestFunction),e.proxyEndpointDescriptor&&(this.proxyEndpointDescriptor=e.proxyEndpointDescriptor)}getUIParentElementId(){return this.uiParentElementId}getMFAPreference(){return this.mfaPreference}getDebugMode(){return this.debugMode}getProxyRequestFunction(){return this.proxyRequestFunction}getProxyEndpointDescriptor(){return this.proxyEndpointDescriptor}clearSettings(){this.uiParentElementId=void 0,this.mfaPreference=u.PASSKEY,this.debugMode=!1,this.proxyRequestFunction=void 0,this.proxyEndpointDescriptor=void 0}getSettings(){return{uiParentElementId:this.uiParentElementId,mfaPreference:this.mfaPreference,debugMode:this.debugMode,proxyRequestFunction:this.proxyRequestFunction}}}const k=w.getInstance();class S extends r{constructor({message:e,data:t,code:n}){super(),this.code=500;const r=Array.isArray(e)?e.join("\n"):e;this.name="EmbedApiError",this.message=`The call to the Embed API failed with the following errors:\n${r}`,this.data=t||{},this.code=n||this.code}}function E({accessToken:e,stagingToken:t,idempotencyKey:r,mfaPreference:i,scaSessionToken:o}){const a=new Headers;a.append("Authorization",`Bearer ${e}`);const s=t||n.getStagingToken();s&&a.append("X-Qonto-Staging-Token",s),r&&a.append("X-Qonto-Idempotency-Key",r);const c=i||k.getMFAPreference();return c&&a.append("X-Qonto-2fa-Preference",c),o&&a.append("X-Qonto-SCA-Session-Token",o),a.append("Content-Type","application/json"),a.append("Accept-Language",T.getLocale()),a}async function _({path:e,options:t}){const n=`${y.getEnvironmentUrls().THIRD_PARTY_API_URL}${e}`,r=await fetch(n,{...t,headers:E(t.headers),body:t.body?JSON.stringify(t.body):void 0});if(204===r.status)return;const i=await r.json();if(!r.ok)throw i.errors?new S({code:r.status,message:i.errors.map((e=>`${e.code}: ${e.detail}`))}):new S({code:r.status,message:`${i.code}: ${i.detail}`,data:i});return i}function I(e){const t={method:e.options.method,headers:e.options.headers,path:e.path,payload:e.options?.body},n=JSON.stringify(t);return r=n,a()?Buffer.from(r).toString("base64"):btoa(r);var r}function P(e){return JSON.parse((t=e,a()?Buffer.from(t,"base64").toString("utf-8"):atob(t)));var t}function A({accessToken:e,stagingToken:t,action:n,callbackUrl:r}){const i={post_authn_action:n};return r&&(i.callback_url=r),{path:"/v1/embed_auth_links",options:{method:"POST",headers:{accessToken:e,stagingToken:t},body:{embed_auth_link:i}}}}async function O(e){const t=A({accessToken:e.accessToken,stagingToken:e.stagingToken,action:e.action,callbackUrl:e.callbackUrl}),{embed_auth_link:n}=await _(t);return{url:n.url,post_authn_action:n.post_authn_action,callback_url:n.callback_url,expired_at:n.expired_at,used_at:n.used_at}}function R(e){return{url:e.url,postAuthAction:e.post_authn_action,callbackUrl:e.callback_url,expiresAt:e.expired_at,usedAt:e.used_at}}class x extends r{constructor(e){super(),this.name="InvalidParametersError",this.invalidParameters=Array.isArray(e)?e:[e],this.message=`Invalid parameters were passed to the function:\n${this.invalidParameters.map((e=>e)).join("\n")}`}}function C(e,t){const n=t.filter((t=>t.requiredIfPresent?!e[t.name]&&e[t.requiredIfPresent]:void 0===e[t.name])).map((e=>e.name));if(n.length>0)throw new x(n.map((e=>`Missing required parameter: ${e}`)))}function D(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"string"!=typeof e)).map((([e])=>`${e} must be a string`))}function L(e){return Object.entries(e).filter((([,e])=>void 0!==e)).filter((([,e])=>"number"!=typeof e)).map((([e])=>`${e} must be a number`))}function N(e){if(!e||"object"!=typeof e)throw new x("requestSettings must be an object");const t=e,{action:n,callbackUrl:r}=e;C(t,[{name:"action"}]);const i=D(t),o=Object.values(f);if(o.includes(n)||i.push(`action must be one of ${o.join(", ")}`),i.length>0)throw new x(i);if(void 0!==r&&""===r.trim())throw new x("callbackUrl cannot be empty")}async function U({requestSettings:e,operationSettings:t}){N(e);const{accessToken:n,stagingToken:r}=t||{},i=n||o();return R(await O({accessToken:i,stagingToken:r,action:e.action,callbackUrl:e.callbackUrl}))}const j={request:U};function M(e){const t=new URLSearchParams;return e?.page&&t.append("page",e.page.toString()),e?.itemsPerPage&&t.append("per_page",e.itemsPerPage.toString()),t}function q(e){if(e)return{totalItems:e?.total_count,totalPages:e?.total_pages,currentPage:e?.current_page,itemsPerPage:e?.per_page,previousPage:e?.prev_page||null,nextPage:e?.next_page||null}}const F=[];for(let e=0;e<256;++e)F.push((e+256).toString(16).slice(1));let B;const $=new Uint8Array(16);var K={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function H(e,t,n){if(K.randomUUID&&!e)return K.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!B){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");B=crypto.getRandomValues.bind(crypto)}return B($)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase()}(r)}function z(e){return{id:e.id,name:e.name,email:e.email,activityTag:e.activity_tag,iban:e.iban,bic:e.bic,currency:e.currency,status:e.status,trusted:e.trusted,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function V(e){return{name:e.name,...e.email&&{email:e.email},...e.activityTag&&{activity_tag:e.activityTag},iban:e.iban,...e.bic&&{bic:e.bic}}}const G="/v2/sepa/beneficiaries";async function J({paginationSettings:e,accessToken:t,stagingToken:n}){const r=function({paginationSettings:e,accessToken:t,stagingToken:n}){const r={method:"GET",headers:{accessToken:t,stagingToken:n}},i=M(e),o=i.size?`?${i.toString()}`:"";return{path:`${G}${o}`,options:r}}({paginationSettings:e,accessToken:t,stagingToken:n}),{beneficiaries:i,meta:o}=await _(r);return{beneficiaries:i,meta:o}}function W({beneficiaryId:e,accessToken:t,stagingToken:n}){return{path:`${G}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}async function Y({accessToken:e,stagingToken:t,beneficiaryId:n}){const r=W({beneficiaryId:n,accessToken:e,stagingToken:t}),{beneficiary:i}=await _(r);return i}async function Q({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:r=H()}){const i=function({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:r=H()}){return{path:G,options:{method:"POST",headers:{accessToken:t,stagingToken:n,idempotencyKey:r},body:{beneficiary:V(e)}}}}({beneficiary:e,accessToken:t,stagingToken:n,idempotencyKey:r}),{beneficiary:o}=await _(i);return o}async function X({beneficiaryIds:e,accessToken:t,stagingToken:n}){const r=function({beneficiaryIds:e,accessToken:t,stagingToken:n}){return{path:`${G}/untrust`,options:{method:"PATCH",headers:{accessToken:t,stagingToken:n},body:{ids:e}}}}({beneficiaryIds:e,accessToken:t,stagingToken:n}),{beneficiaries:i}=await _(r);return i}async function Z({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:r,mfaPreference:i}){const o=function({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:r,mfaPreference:i}){const{name:o,email:a,activityTag:s}=e,c={method:"PATCH",headers:{accessToken:t,stagingToken:n,idempotencyKey:r,mfaPreference:i},body:{beneficiary:{name:o,email:a,activity_tag:s}}};return{path:`${G}/${e.id}`,options:c}}({beneficiaryParamsBeingEdited:e,accessToken:t,stagingToken:n,idempotencyKey:r,mfaPreference:i}),{beneficiary:a}=await _(o);return a}const ee=[{name:"name"},{name:"iban"}];function te(e){if(!e)throw new x("beneficiaryId parameter is required for the called function");if(e&&"string"!=typeof e)throw new x("beneficiaryId must be a string");return e}const ne={getBeneficiaries:async function(e){const{accessToken:t,stagingToken:n,paginationSettings:r}=e?.operationSettings||{},i=t||o(),a=await J({accessToken:i,stagingToken:n,paginationSettings:r}),s=a.beneficiaries.map((e=>z(e))),c=q(a.meta);return{beneficiaries:s,...c?{meta:c}:{}}},getBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=te(e?.beneficiaryId),{accessToken:r,stagingToken:i}=t||{},a=r||o();return z(await Y({beneficiaryId:n,accessToken:a,stagingToken:i}))},addBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new x("beneficiary parameter is required for the called function");if("object"!=typeof e)throw new x("beneficiary must be an object");C(e,ee);const t=D({name:e.name,iban:e.iban,email:e.email,activityTag:e.activityTag,bic:e.bic});if(t.length>0)throw new x(t);return e}(e),{accessToken:r,stagingToken:i,idempotencyKey:a}=t||{},s=r||o();return z(await Q({beneficiary:n,accessToken:s,stagingToken:i,idempotencyKey:a}))},updateBeneficiary:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){const{id:t,name:n,email:r,activityTag:i}=e||{};if(!t)throw new x("Invalid parameters were passed to the function:\nA beneficiary ID is required for the called function");if(!n&&!r&&!i)throw new x("Invalid parameters were passed to the function:\nAt least one of the following properties must be provided: name, email, activityTag");const o=D({name:n,email:r,activityTag:i});if(o.length>0)throw new x(o);return{id:t,name:n,email:r,activityTag:i}}(e),{accessToken:r,stagingToken:i,idempotencyKey:a,mfaPreference:s}=t||{},c={beneficiaryParamsBeingEdited:n,accessToken:r||o(),stagingToken:i,idempotencyKey:a,mfaPreference:s};return z(await Z(c))},untrustBeneficiaries:async function({beneficiarySettings:e,operationSettings:t}){const n=function(e){if(!e)throw new x("beneficiaryIds parameter is required for the called function");if(!Array.isArray(e)||!e.every((e=>"string"==typeof e)))throw new x("beneficiaryIds must be an array of strings");return e}(e?.beneficiaryIds),{accessToken:r,stagingToken:i}=t||{},a=r||o();return(await X({beneficiaryIds:n,accessToken:a,stagingToken:i})).map(z)}},re="SDK Initialized",ie="Cards List";var oe=function(e,t){return oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},oe(e,t)};function ae(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}oe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var se,ce,ue=function(){return ue=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ue.apply(this,arguments)};function le(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function de(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function fe(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function pe(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ge(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function he(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(se||(se={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(ce||(ce={}));var ve,me="AMP",ye="".concat(me,"_unsent"),be="$default_instance",Te="https://api2.amplitude.com/2/httpapi",we="dclid",ke="fbclid",Se="gbraid",Ee="gclid",_e="ko_click_id",Ie="li_fat_id",Pe="msclkid",Ae="rdt_cid",Oe="ttclid",Re="twclid",xe="wbraid",Ce={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},De=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],Le=["authorization","cookie","set-cookie"],Ne=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!Ue(t,n))return!1}return!0},Ue=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=pe(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if("object"==typeof s)i=i&&Ne(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return Ne(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},je=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return ue({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(ve.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(ve.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(ve.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(ve.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(ve.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(ve.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(ve.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(ve.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(ve.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[ve.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[ve.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===ve.ADD?"number"==typeof n:e===ve.UNSET||e===ve.REMOVE||Ue(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(ve||(ve={}));var Me,qe=[ve.CLEAR_ALL,ve.UNSET,ve.SET,ve.SET_ONCE,ve.ADD,ve.APPEND,ve.PREPEND,ve.PREINSERT,ve.POSTINSERT,ve.REMOVE];!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(Me||(Me={}));var Fe,Be=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Me.Unknown),{event:e,code:t,message:n}},$e=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},Ke=he([],ge(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),He=function(e){var t,n=$e();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,He)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,he([],ge(r.entries()),!1).map((function(e){var t=ge(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(Ke[r]):Ke[r]})).join("")},ze=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return de(this,void 0,void 0,(function(){return fe(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=He(),this.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(e.name,". \n Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e,t){var n;return de(this,void 0,void 0,(function(){var r,i;return fe(this,(function(o){switch(o.label){case 0:return r=this.plugins.findIndex((function(t){return t.name===e})),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}}))}))},e.prototype.reset=function(e){this.applying=!1,this.plugins.map((function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)})),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise((function(n){t.queue.push([e,n]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c,u,l,d,f,p,g,h,v,m,y,b,T;return fe(this,(function(w){switch(w.label){case 0:if(!e)return[2];t=ge(e,1),n=t[0],r=ge(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),o=this.plugins.filter((function(e){return"before"===e.type})),w.label=1;case 1:w.trys.push([1,6,7,8]),a=pe(o),s=a.next(),w.label=2;case 2:return s.done?[3,5]:(f=s.value).execute?[4,f.execute(ue({},n))]:[3,4];case 3:if(null===(p=w.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(f.name),"', event: ").concat(JSON.stringify(n))),i({event:n,code:0,message:""}),[2];n=p,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(f.name),"', event: ").concat(JSON.stringify(n))),w.label=4;case 4:return s=a.next(),[3,2];case 5:return[3,8];case 6:return c=w.sent(),m={error:c},[3,8];case 7:try{s&&!s.done&&(y=a.return)&&y.call(a)}finally{if(m)throw m.error}return[7];case 8:u=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),w.label=9;case 9:w.trys.push([9,14,15,16]),l=pe(u),d=l.next(),w.label=10;case 10:return d.done?[3,13]:(f=d.value).execute?[4,f.execute(ue({},n))]:[3,12];case 11:if(null===(p=w.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(f.name),"', event: ").concat(JSON.stringify(n))),i({event:n,code:0,message:""}),[2];n=p,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(f.name),"', event: ").concat(JSON.stringify(n))),w.label=12;case 12:return d=l.next(),[3,10];case 13:return[3,16];case 14:return g=w.sent(),b={error:g},[3,16];case 15:try{d&&!d.done&&(T=l.return)&&T.call(l)}finally{if(b)throw b.error}return[7];case 16:return h=this.plugins.filter((function(e){return"destination"===e.type})),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),v=h.map((function(e){var t=ue({},n);return e.execute(t).catch((function(e){return Be(t,0,String(e))}))})),Promise.all(v).then((function(e){var t=ge(e,1)[0]||Be(n,100,"Event not tracked, no destination plugins on the instance");i(t)})),[2]}}))}))},e.prototype.flush=function(){return de(this,void 0,void 0,(function(){var e,t,n,r=this;return fe(this,(function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return r.apply(e)})))];case 1:return i.sent(),t=this.plugins.filter((function(e){return"destination"===e.type})),n=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(n)];case 2:return i.sent(),[2]}}))}))},e.prototype.onIdentityChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)}))},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)}))},e.prototype.onOptOutChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}))},e.prototype.onReset=function(){this.plugins.forEach((function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)}))},e}(),Ve=function(e,t){return ue(ue({},t),{event_type:ce.IDENTIFY,user_properties:e.getUserProperties()})},Ge=function(e){return{promise:e||Promise.resolve()}},Je=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new ze(this),this.name=e}return e.prototype._init=function(e){return de(this,void 0,void 0,(function(){return fe(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i,o,a,s,c;return fe(this,(function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),n=pe(t),r=n.next(),u.label=2;case 2:return r.done?[3,7]:(i=r.value,(o=i())&&"promise"in o?[4,o.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,o];case 5:u.sent(),u.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return a=u.sent(),s={error:a},[3,10];case 9:try{r&&!r.done&&(c=n.return)&&c.call(n)}finally{if(s)throw s.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:u.sent(),u.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return ue(ue(ue({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return Ge(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Ve(e,t);return Ge(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=function(e,t,n,r){var i;return ue(ue({},r),{event_type:ce.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n,r);return Ge(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,i=new je;return i.set(e,t),ue(ue({},n),{event_type:ce.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return Ge(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return ue(ue({},t),{event_type:ce.REVENUE,event_properties:e.getEventProperties()})}(e,t);return Ge(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),Ge())},e.prototype._addPlugin=function(e){return Ge(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),Ge())},e.prototype._removePlugin=function(e){return Ge(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(Be(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return de(this,void 0,void 0,(function(){var t=this;return fe(this,(function(n){return this.isReady?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.getOperationAppliedUserProperties=function(e){var t={};if(void 0===e)return t;var n={};return Object.keys(e).forEach((function(t){Object.values(se).includes(t)||(n[t]=e[t])})),qe.forEach((function(n){if(Object.keys(e).includes(n)){var r=e[n];switch(n){case se.CLEAR_ALL:Object.keys(t).forEach((function(e){delete t[e]}));break;case se.UNSET:Object.keys(r).forEach((function(e){delete t[e]}));break;case se.SET:Object.assign(t,r)}}})),Object.assign(t,n),t},e.prototype.process=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i;return fe(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.config.optOut?[2,Be(e,0,"Event skipped due to optOut config")]:(e.event_type===ce.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[4,this.timeline.push(e)]);case 1:return 200===(i=o.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=o.sent(),r=String(n),this.config.loggerProvider.error(r),[2,i=Be(e,0,r)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=Boolean(e))},e.prototype.flush=function(){return Ge(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find((function(t){return t.name===e}));if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter((function(t){return t instanceof e}))},e}(),We=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){return Ne(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?ue({},this.properties):{};return e[Fe.REVENUE_PRODUCT_ID]=this.productId,e[Fe.REVENUE_QUANTITY]=this.quantity,e[Fe.REVENUE_PRICE]=this.price,e[Fe.REVENUE_TYPE]=this.revenueType,e[Fe.REVENUE_CURRENCY]=this.currency,e[Fe.REVENUE]=this.revenue,e[Fe.RECEIPT]=this.receipt,e[Fe.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(Fe||(Fe={}));var Ye;!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(Ye||(Ye={}));var Qe="Amplitude Logger ",Xe=function(){function e(){this.logLevel=Ye.None}return e.prototype.disable=function(){this.logLevel=Ye.None},e.prototype.enable=function(e){void 0===e&&(e=Ye.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Ye.Verbose||console.log("".concat(Qe,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Ye.Warn||console.warn("".concat(Qe,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Ye.Error||console.error("".concat(Qe,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Ye.Debug||console.log("".concat(Qe,"[Debug]: ").concat(e.join(" ")))},e}(),Ze=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:be,logLevel:Ye.Warn,loggerProvider:new Xe,offline:!1,optOut:!1,serverUrl:Te,serverZone:"US",useBatch:!1}},et=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=Ze();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var a=nt(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),tt=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":Te},nt=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=Ze().serverZone),void 0===n&&(n=Ze().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:Ze().serverZone;return{serverZone:r,serverUrl:tt(r,n)}},rt=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function it(e){return e>=200&&e<300}var ot=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},at=function(e){return function(){var t=ue({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},st=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=pe(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ct=function(e,t){return function(){var n,r,i={};try{for(var o=pe(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=st(e,s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},ut=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=n(),c=s.logger,u=s.logLevel;if(u&&u<Ye.Debug||!u||!c)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ot(1),time:{start:(new Date).toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then((function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),c.debug(JSON.stringify(l,null,2))})):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),c.debug(JSON.stringify(l,null,2))),d}};function lt(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var dt=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return de(this,void 0,void 0,(function(){var n,r=this;return fe(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(ye,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map((function(e){return r.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=He()),new Promise((function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()}))},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter((function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)}))},e.prototype.scheduleEvents=function(e){var t=this;e.forEach((function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)}))},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout((function(){t.queue=t.queue.map((function(e){return e.timeout=0,e})),t.flush(!0)}),e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),de(this,void 0,void 0,(function(){var t,n,r=this;return fe(this,(function(i){switch(i.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),o=t,a=this.config.flushQueueSize,s=Math.max(a,1),[4,o.reduce((function(e,t,n){var r=Math.floor(n/s);return e[r]||(e[r]=[]),e[r].push(t),e}),[]).reduce((function(t,n){return de(r,void 0,void 0,(function(){return fe(this,(function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}}))}))}),Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,s}))}))},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),de(this,void 0,void 0,(function(){var r,i,o,a,s;return fe(this,(function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,le(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new rt,c.label=1;case 1:return c.trys.push([1,3,,4]),i=nt(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return null===(o=c.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(lt(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return a=c.sent(),s=(u=a)instanceof Error?u.message:String(u),this.config.loggerProvider.error(s),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map((function(e){return e.event.event_type})),message:s,stack_trace:ot()}),this.handleResponse({status:Me.Failed,statusCode:0},e),[3,4];case 4:return[2]}var u}))}))},e.prototype.handleResponse=function(e,t){var n;it(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map((function(e){return e.event.event_type})),code:e.statusCode,status:e.status,body:lt(e),stack_trace:ot()});var r=e.status;switch(r){case Me.Success:this.handleSuccessResponse(e,t);break;case Me.Invalid:this.handleInvalidResponse(e,t);break;case Me.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case Me.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=he(he(he(he([],ge(Object.values(e.body.eventsWithInvalidFields)),!1),ge(Object.values(e.body.eventsWithMissingFields)),!1),ge(Object.values(e.body.eventsWithInvalidIdLengths)),!1),ge(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter((function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(lt(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(lt(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,a=new Set(r),s=new Set(i),c=new Set(o),u=t.filter((function(t,r){if(!(t.event.user_id&&a.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)))return c.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));u.length>0&&this.config.loggerProvider.warn(lt(e));var l=this.removeEventsExceedFlushMaxRetries(u);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;it(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map((function(e){return e.event.event_type})),code:t,message:n,stack_trace:ot()})),this.removeEvents(e),e.forEach((function(e){return e.callback(Be(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map((function(e){return e.event}));this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter((function(t){return!e.some((function(e){return e.event.insert_id===t.event.insert_id}))})),this.saveEvents()},e}(),ft=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:pt(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),pt=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},gt=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),ht=function(){return ht=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ht.apply(this,arguments)};function vt(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function mt(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}"function"==typeof SuppressedError&&SuppressedError;var yt=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=vt(["string","number","boolean","undefined"]),a=o.next();!a.done;a=o.next()){if(a.value===i)return e===t}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),c=Array.isArray(t);if(s!==c)return!1;if(!s||!c){var u=Object.keys(e).sort(),l=Object.keys(t).sort();if(!yt(u,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){yt(e[n],t[n])||(d=!1)})),d}for(var f=0;f<e.length;f++)if(!yt(e[f],t[f]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var bt,Tt=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ht({},this.identity.userProperties),n=ht(ht({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,a,s,c=n.userProperties||{};try{for(var u=vt(Object.entries(e)),l=u.next();!l.done;l=u.next()){var d=mt(l.value,2),f=d[0],p=d[1];switch(f){case"$set":try{for(var g=(i=void 0,vt(Object.entries(p))),h=g.next();!h.done;h=g.next()){var v=mt(h.value,2),m=v[0],y=v[1];c[m]=y}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(a=void 0,vt(Object.keys(p))),T=b.next();!T.done;T=b.next()){delete c[m=T.value]}}catch(e){a={error:e}}finally{try{T&&!T.done&&(s=b.return)&&s.call(b)}finally{if(a)throw a.error}}break;case"$clearAll":c={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return n.userProperties=c,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ht({},this.identity)},e.prototype.setIdentity=function(e){var t=ht({},this.identity);this.identity=ht({},e),yt(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),wt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,kt=function(){function e(){this.identityStore=new Tt,this.eventBridge=new gt,this.applicationContextProvider=new ft}return e.getInstance=function(t){return wt.analyticsConnectorInstances||(wt.analyticsConnectorInstances={}),wt.analyticsConnectorInstances[t]||(wt.analyticsConnectorInstances[t]=new e),wt.analyticsConnectorInstances[t]},e}(),St=function(e){return void 0===e&&(e=be),kt.getInstance(e)},Et=function(){function e(){this.name="identity",this.type="before",this.identityStore=St().identityStore}return e.prototype.execute=function(e){return de(this,void 0,void 0,(function(){var t;return fe(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return de(this,void 0,void 0,(function(){return fe(this,(function(t){return e.instanceName&&(this.identityStore=St(e.instanceName).identityStore),[2]}))}))},e}(),_t=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},It=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[me,t,e.substring(0,n)].filter(Boolean).join("_")},Pt=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},At=function(){var e,t=$e();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=Ot(n[0]),i=Ot(n[1]);return i?(e[r]=i,e):e}),{}):{}},Ot=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Rt=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},xt=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},Ct=function(e,t){var n=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}(e.toString());return 31*Math.abs(n)%1e5/1e5<t},Dt=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return de(this,void 0,void 0,(function(){return fe(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return de(this,void 0,void 0,(function(){return fe(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return de(this,void 0,void 0,(function(){var t;return fe(this,(function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return de(this,void 0,void 0,(function(){return fe(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return de(this,void 0,void 0,(function(){return fe(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return de(this,void 0,void 0,(function(){return fe(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),Lt=function(){function e(e){this.options=ue({},e)}return e.prototype.isEnabled=function(){return de(this,void 0,void 0,(function(){var t,n;return fe(this,(function(r){switch(r.label){case 0:if(!$e())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return r.sent(),[4,t.get(n)];case 3:return[2,r.sent()===e.testValue];case 4:return r.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){var t;return de(this,void 0,void 0,(function(){var n,r;return fe(this,(function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(n=i.sent()))return[2,void 0];try{return void 0===(r=null!==(t=Nt(n))&&void 0!==t?t:Ut(n))?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(r)]}catch(t){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return de(this,void 0,void 0,(function(){var r,i,o;return fe(this,(function(a){return r=$e(),i=null!==(n=null===(t=null==r?void 0:r.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],o=i.find((function(t){return 0===t.indexOf(e+"=")})),o?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return de(this,void 0,void 0,(function(){var r,i,o,a,s,c,u;return fe(this,(function(l){try{r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(i=null!==t?r:-1)&&((a=new Date).setTime(a.getTime()+24*i*60*60*1e3),o=a),s="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(s+="; expires=".concat(o.toUTCString())),s+="; path=/",this.options.domain&&(s+="; domain=".concat(this.options.domain)),this.options.secure&&(s+="; Secure"),this.options.sameSite&&(s+="; SameSite=".concat(this.options.sameSite)),(c=$e())&&(c.document.cookie=s)}catch(t){u=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(u))}return[2]}))}))},e.prototype.remove=function(e){return de(this,void 0,void 0,(function(){return fe(this,(function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}}))}))},e.prototype.reset=function(){return de(this,void 0,void 0,(function(){return fe(this,(function(e){return[2]}))}))},e}(),Nt=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},Ut=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},jt=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[me,t,e.substring(0,n)].filter(Boolean).join("_")},Mt=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return de(this,void 0,void 0,(function(){var t,n,r;return fe(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return de(this,void 0,void 0,(function(){var t;return fe(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){var t;return de(this,void 0,void 0,(function(){return fe(this,(function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return de(this,void 0,void 0,(function(){return fe(this,(function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){var t;return de(this,void 0,void 0,(function(){return fe(this,(function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){var e;return de(this,void 0,void 0,(function(){return fe(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),qt="tags",Ft="counters",Bt="histograms",$t="events",Kt="internal",Ht="last_flush_timestamp",zt=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=$e())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return de(this,void 0,void 0,(function(){return fe(this,(function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]}))}))},e.prototype.openDB=function(){var e=this;return new Promise((function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(t){var n=t.target.result;e.createTables(n)}}))},e.prototype.createTables=function(e){(e.objectStoreNames.contains(qt)||e.createObjectStore(qt,{keyPath:"key"}),e.objectStoreNames.contains(Ft)||e.createObjectStore(Ft,{keyPath:"key"}),e.objectStoreNames.contains(Bt)||e.createObjectStore(Bt,{keyPath:"key"}),e.objectStoreNames.contains($t))||e.createObjectStore($t,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(Kt)||e.createObjectStore(Kt,{keyPath:"key"})},e.prototype.setTags=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i,o=this;return fe(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([qt],"readwrite"),r=n.objectStore(qt),[2,new Promise((function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach((function(e){var t=ge(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,i,e)}}))}))];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}}))}))},e.prototype.incrementCounters=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i,o=this;return fe(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Ft],"readwrite"),r=n.objectStore(Ft),[2,new Promise((function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach((function(e){var t=ge(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}}))}))];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}}))}))},e.prototype.setHistogramStats=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i,o=this;return fe(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Bt],"readwrite"),r=n.objectStore(Bt),[2,new Promise((function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach((function(e){var t=ge(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.result;e=t?{key:n,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}}))}))];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}}))}))},e.prototype.addEventRecords=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i,o=this;return fe(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([$t],"readwrite"),r=n.objectStore($t),[2,new Promise((function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach((function(e){r.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}}))},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}}))];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}}))}))},e.prototype.setInternal=function(e,t){return de(this,void 0,void 0,(function(){var n,r,i,o;return fe(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([Kt],"readwrite"),i=r.objectStore(Kt),[2,new Promise((function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var a=i.put({key:e,value:t});a.onsuccess=function(){return n()},a.onerror=function(){return o(new Error("Failed to set internal value"))}}))];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}}))}))},e.prototype.getInternal=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i;return fe(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([Kt],"readonly"),r=n.objectStore(Kt),[2,new Promise((function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}}))];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}}))}))},e.prototype.getLastFlushTimestamp=function(){return de(this,void 0,void 0,(function(){var e,t;return fe(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(Ht)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}}))}))},e.prototype.setLastFlushTimestamp=function(e){return de(this,void 0,void 0,(function(){var t;return fe(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(Ht,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}}))}))},e.prototype.clearTable=function(e,t){return new Promise((function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}}))},e.prototype.getAllAndClear=function(){return de(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,s;return fe(this,(function(c){switch(c.label){case 0:return c.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=c.sent(),t=e.transaction([qt,Ft,Bt,$t],"readwrite"),[4,Promise.all([this.getAllFromStore(t,qt),this.getAllFromStore(t,Ft),this.getAllFromStore(t,Bt),this.getAllFromStore(t,$t)])];case 2:return n=ge.apply(void 0,[c.sent(),4]),r=n[0],i=n[1],o=n[2],a=n[3],[4,Promise.all([this.clearTable(t,Ft),this.clearTable(t,Bt),this.clearTable(t,$t)])];case 3:return c.sent(),[2,{tags:r,counters:i,histogramStats:o,events:a}];case 4:return s=c.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}}))}))},e.prototype.getAllFromStore=function(e,t){return new Promise((function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}}))},e}(),Vt=function(e){var t,n=null==(t=$e())?void 0:t.__AMPLITUDE_SCRIPT_URL__;if(n)return e.filename&&e.filename.includes(n)?"filename":e.stack&&e.stack.includes(n)?"stack":void 0},Gt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},Jt=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},Wt=3e5,Yt=1e4,Qt=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=ue({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=Ct(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,zt.isSupported()?this.storage=new zt(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=$e();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",ue({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",(function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=Vt({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})}),!0),t.addEventListener("unhandledrejection",(function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=Gt(i),a=Vt({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:Jt(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})}),!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=Yt?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=Yt?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=Yt)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout((function(){e.saveAllDataToStorage().catch((function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)})).finally((function(){e.saveTimer=null}))}),1e3)),this.flushTimer||(this.flushTimer=setTimeout((function(){e._flush().catch((function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)})).finally((function(){e.flushTimer=null}))}),Wt))},e.prototype.saveAllDataToStorage=function(){return de(this,void 0,void 0,(function(){var e,t,n,r;return fe(this,(function(i){switch(i.label){case 0:return this.storage?(e=ue({},this.inMemoryTags),t=ue({},this.inMemoryCounters),n=ue({},this.inMemoryHistograms),r=he([],ge(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}}))}))},e.prototype._flush=function(){return de(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,s,c,u;return fe(this,(function(l){switch(l.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return l.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=l.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach((function(e){o[e.key]=e.value})),a={},n.forEach((function(e){a[e.key]=e.value})),s={},r.forEach((function(e){s[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}})),c=i.map((function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}})),0===Object.keys(a).length&&0===Object.keys(s).length&&0===c.length?[2]:(u={tags:o,histogram:s,counters:a,events:c},this.fetch(u),[2])}}))}))},e.prototype.fetch=function(e){return de(this,void 0,void 0,(function(){var t;return fe(this,(function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!$e())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}}))}))},e.prototype.initializeFlushInterval=function(){return de(this,void 0,void 0,(function(){var e,t,n;return fe(this,(function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(Wt),[2]):(n=e-t)>=Wt?(this._flush(),[2]):(this._setFlushTimer(Wt-n),[2])}}))}))},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout((function(){t._flush().catch((function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)})).finally((function(){t.flushTimer=null}))}),e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=Ct(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),Xt=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,a,s,c,u,l,d,f,p,g,h,v,m,y,b,T,w,k;if("object"!=typeof e)return null;var S=e.code||0,E=this.buildStatus(S);switch(E){case Me.Success:return{status:E,statusCode:S,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case Me.Invalid:return{status:E,statusCode:S,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(s=e.events_with_missing_fields)&&void 0!==s?s:{},eventsWithInvalidIdLengths:null!==(c=e.events_with_invalid_id_lengths)&&void 0!==c?c:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(g=e.throttled_events)&&void 0!==g?g:[]}};case Me.PayloadTooLarge:return{status:E,statusCode:S,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case Me.RateLimit:return{status:E,statusCode:S,body:{error:null!==(v=e.error)&&void 0!==v?v:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(T=e.exceeded_daily_quota_devices)&&void 0!==T?T:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(k=e.throttled_events)&&void 0!==k?k:[]}};case Me.Timeout:default:return{status:E,statusCode:S}}},e.prototype.buildStatus=function(e){return it(e)?Me.Success:429===e?Me.RateLimit:413===e?Me.PayloadTooLarge:408===e?Me.Timeout:e>=400&&e<500?Me.Invalid:e>=500?Me.Failed:Me.Unknown},e}(),Zt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ae(t,e),t.prototype.send=function(e,t){return de(this,void 0,void 0,(function(){var n,r,i;return fe(this,(function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}}))}))},t}(Xt),en=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),tn=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.apiKey=e,this.serverUrl=r||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new en(e,t)}return e.prototype.subscribe=function(e,t,n){var r=He(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex((function(t){return t.id===e}));return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return de(this,void 0,void 0,(function(){var e,t=this;return fe(this,(function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach((function(n){t.sendCallback(n,e,"remote")})),[2]}}))}))},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise||(this.fetchPromise=this.fetch().then((function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t})).finally((function(){e.fetchPromise=null}))),this.fetchPromise},e.prototype.subscribeAll=function(e){return de(this,void 0,void 0,(function(){var t,n,r,i=this;return fe(this,(function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then((function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)})),n=this.storage.fetchConfig().then((function(e){return e})),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}}))}))},e.prototype.subscribeWaitForRemote=function(e,t){return de(this,void 0,void 0,(function(){var n,r;return fe(this,(function(i){switch(i.label){case 0:n=new Promise((function(e,n){setTimeout((function(){n("Timeout exceeded")}),t)})),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}}))}))},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce((function(e,t){return null===e?e:t in e?e[t]:null}),t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),de(this,void 0,void 0,(function(){var n,r,i,o,a,s,c=this;return fe(this,(function(u){switch(u.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,s,u,l;return fe(this,(function(d){switch(d.label){case 0:i=new AbortController,a=setTimeout((function(){return i.abort()}),t),d.label=1;case 1:return d.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:i.signal})];case 2:return(s=d.sent()).ok?[3,4]:[4,s.text()];case 3:return u=d.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(s.status,": ").concat(u)),[3,6];case 4:return[4,s.json()];case 5:return[2,{value:{remoteConfig:d.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(l=d.sent())instanceof Error&&"AbortError"===l.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),l),[3,9];case 8:return clearTimeout(a),[7];case 9:return r<e-1?[4,new Promise((function(e){return setTimeout(e,c.getJitterDelay(n))}))]:[3,11];case 10:d.sent(),d.label=11;case 11:return[2]}}))},o=this,a=0,u.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"==typeof(s=u.sent()))return[2,s.value];u.label=3;case 3:return a++,[3,1];case 4:return[2,r]}}))}))},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}();!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(bt||(bt={}));var nn=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],rn="data-amp-track-",on=["div","span","h1","h2","h3","h4","h5","h6"],an=he(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],ge(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),sn=["*"];function cn(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function un(e,t,n){e&&ln({json:e,allowlist:t.map(dn),excludelist:n.map(dn),ancestors:[]})}function ln(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,c=e.parentObject,u=e.targetKey;i||(i=r);var l=Object.keys(i);try{for(var d=pe(l),f=d.next();!f.done;f=d.next()){var p=f.value,g=he(he([],ge(s),!1),[p],!1);cn(i[p])?pn(g,o)&&!pn(g,a)||delete i[p]:ln({json:r,targetObject:i[p],allowlist:o,excludelist:a,ancestors:g,parentObject:i,targetKey:p})}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}0===Object.keys(i).length&&c&&u&&delete c[u]}function dn(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map((function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")}))}function fn(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(fn(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&fn(e,t,n+1,r+1)}function pn(e,t){return t.some((function(t){return fn(e,t)}))}var gn=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach((function(e){var t=ge(e,2),n=t[0],r=t[1];i[n]=r}));else if(r instanceof Headers)r.forEach((function(e,t){i[t]=e}));else if("object"==typeof r&&null!==r)try{for(var o=pe(Object.entries(r)),a=o.next();!a.done;a=o.next()){var s=ge(a.value,2),c=s[0],u=s[1];i[c]=u}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return kn(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=$e();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=vn(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),de(this,void 0,void 0,(function(){return fe(this,(function(n){return 0===e.length?[2,null]:[2,Tn(this.body,e,t)]}))}))},e}(),hn=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),kn(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return vn(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),de(this,void 0,void 0,(function(){return fe(this,(function(n){return 0===e.length?[2,null]:[2,Tn(this.body,e,t)]}))}))},e}();function vn(e,t){var n,r,i,o=$e(),a=null==o?void 0:o.TextEncoder;if(a){var s;if("string"==typeof e)s=e,i=(new a).encode(s).length;else if(e instanceof Blob)i=(s=e).size;else if(e instanceof URLSearchParams)s=e,i=(new a).encode(s.toString()).length;else if(ArrayBuffer.isView(e))i=(s=e).byteLength;else if(e instanceof ArrayBuffer)i=(s=e).byteLength;else if(e instanceof FormData){var c=e,u=0,l=0;try{for(var d=pe(c.entries()),f=d.next();!f.done;f=d.next()){var p=ge(f.value,2),g=p[0],h=p[1];if(u+=g.length,"string"==typeof h)u+=(new a).encode(h).length;else{if(!(h instanceof Blob))return;u+=h.size}if(++l>=t)return}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}i=u}else if(e instanceof ReadableStream)return void(s=e);return i}}var mn,yn=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,(function(e,t){r[t]=e})),kn(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return de(this,void 0,void 0,(function(){var e,t;return fe(this,(function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}}))}))},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),de(this,void 0,void 0,(function(){return fe(this,(function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Tn(n.sent(),e,t)]}}))}))},e}(),bn=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=pe(i),a=o.next();!a.done;a=o.next()){var s=ge(a.value.split(": "),2),c=s[0],u=s[1];c&&u&&(r[c]=u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return kn(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),de(this,void 0,void 0,(function(){var n;return fe(this,(function(r){return 0===e.length?[2,null]:(n=this.getJson())?(un(n,e,t),[2,n]):[2,null]}))}))},e}();function Tn(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return un(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(mn||(mn={}));var wn="[REDACTED]",kn=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?mn.REMOVE:a,c=he([],ge(Le),!1),u={},l=function(t){var n=t.toLowerCase();c.find((function(e){return e.toLowerCase()===n}))?s===mn.REDACT&&(u[t]=wn):o.find((function(e){return e.toLowerCase()===n}))?u[t]=e[t]:s===mn.REDACT&&(u[t]=wn)};try{for(var d=pe(Object.keys(e)),f=d.next();!f.done;f=d.next()){l(f.value)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return u},Sn=function(){function e(e,t,n,r,i,o,a,s,c,u,l){void 0===a&&(a=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=a,this.duration=s,this.responseWrapper=c,this.error=u,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(he([],ge(De),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(he([],ge(De),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter((function(e){var t=ge(e,2);return t[0],void 0!==t[1]})))},e}();var En=function(e,t){void 0===t&&(t=He()),this.callback=e,this.id=t},_n=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=$e();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=$e();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,a,s,c,u,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,p=null===(s=null===(a=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===s?void 0:s.send,g=null===(l=null===(u=null===(c=this.globalScope)||void 0===c?void 0:c.XMLHttpRequest)||void 0===u?void 0:u.prototype)||void 0===l?void 0:l.setRequestHeader;f&&p&&g&&this.observeXhr(f,p,g);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach((function(n){var r;try{n.callback(e)}catch(e){null===(r=t.logger)||void 0===r||r.debug("an unexpected error occurred while triggering event callbacks",e)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,a){var s;if(void 0!==o&&void 0!==a){var c,u,l,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?c=null===(s=null==t?void 0:t.toString)||void 0===s?void 0:s.call(t):(c=t.url,d=t.method),c)try{var f=new URL(c);c="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(u=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},u=0);var p=Math.floor(performance.now()-a),g=Math.floor(o+p),h=new Sn(e,d,o,o,c,n,u,p,r,l,g);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return de(t,void 0,void 0,(function(){var t,i,o,a,s,c;return fe(this,(function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){null===(s=this.logger)||void 0===s||s.debug("an unexpected error occurred while retrieving timestamps",e)}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),o=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new gn(r):void 0,i?new yn(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while handling fetch",e)}if(i)return[2,i];throw o}}))}))})},e.createXhrJsonParser=function(e,t){return function(){var n,r;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&(null===(r=t.logger)||void 0===r||r.error("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=ge(r,2),s=a[0],c=a[1];try{this.$$AmplitudeAnalyticsEvent=ue({method:s,url:null===(e=null==c?void 0:c.toString)||void 0===e?void 0:e.call(c),headers:{}},o.getTimestamps())}catch(e){null===(n=o.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr open",e)}return t.apply(this,r)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,a=e.createXhrJsonParser(this,o),s=t[0],c=i.$$AmplitudeAnalyticsEvent;return i.addEventListener("loadend",(function(){var e;try{var t=i.getAllResponseHeaders(),n=i.getResponseHeader("content-length"),r=new bn(i.status,t,n?parseInt(n,10):void 0,a),u=i.$$AmplitudeAnalyticsEvent.headers,l=new hn(s,u);c.status=i.status,o.handleNetworkRequestEvent("xhr",{url:c.url,method:c.method},l,r,void 0,c.startTime,c.durationStart)}catch(t){null===(e=o.logger)||void 0===e||e.error("an unexpected error occurred while handling xhr send",t)}})),n.apply(i,t)},i.setRequestHeader=function(e,t){var n;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null===(n=o.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr setRequestHeader",e)}r.apply(this,[e,t])}}},e}(),In=new _n,Pn=function(){function e(){}return e.prototype.parse=function(){return de(this,void 0,void 0,(function(){return fe(this,(function(e){return[2,ue(ue(ue(ue({},Ce),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=At();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=At();return(e={})[we]=t[we],e[ke]=t[ke],e[Se]=t[Se],e[Ee]=t[Ee],e[_e]=t[_e],e[Ie]=t[Ie],e[Pe]=t[Pe],e[Ae]=t[Ae],e[Oe]=t[Oe],e[Re]=t[Re],e[xe]=t[xe],e},e}(),An="data-amp-mask",On="*****",Rn=/\b(?:\d[ -]*?){13,16}\b/,xn=/(\d{3}-?\d{2}-?\d{4})/g,Cn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,Dn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(Rn,On)).replace(xn,On)).replace(Cn,On);try{for(var o=pe(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,On)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},Ln=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(An)?On:e?e(document.title):document.title};function Nn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Un(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Un(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function jn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Mn(e,t,n){return t&&jn(e.prototype,t),n&&jn(e,n),e}var qn=function(){return"function"==typeof Symbol},Fn=function(e){return qn()&&Boolean(Symbol[e])},Bn=function(e){return Fn(e)?Symbol[e]:"@@"+e};qn()&&!Fn("observable")&&(Symbol.observable=Symbol("observable"));var $n=Bn("iterator"),Kn=Bn("observable"),Hn=Bn("species");function zn(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function Vn(e){var t=e.constructor;return void 0!==t&&null===(t=t[Hn])&&(t=void 0),void 0!==t?t:nr}function Gn(e){return e instanceof nr}function Jn(e){Jn.log?Jn.log(e):setTimeout((function(){throw e}))}function Wn(e){Promise.resolve().then((function(){try{e()}catch(e){Jn(e)}}))}function Yn(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=zn(t,"unsubscribe");n&&n.call(t)}}catch(e){Jn(e)}}function Qn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function Xn(e,t,n){e._state="running";var r=e._observer;try{var i=zn(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(Qn(e),!i)throw n;i.call(r,n);break;case"complete":Qn(e),i&&i.call(r)}}catch(e){Jn(e)}"closed"===e._state?Yn(e):"running"===e._state&&(e._state="ready")}function Zn(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void Wn((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(Xn(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void Xn(e,t,n);e._queue.push({type:t,value:n})}}var er=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var n=new tr(this);try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}return e.prototype.unsubscribe=function(){"closed"!==this._state&&(Qn(this),Yn(this))},Mn(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),tr=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){Zn(this._subscription,"next",e)},t.error=function(e){Zn(this._subscription,"error",e)},t.complete=function(){Zn(this._subscription,"complete")},Mn(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),nr=function(){function e(t){if(!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}var t=e.prototype;return t.subscribe=function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new er(e,this._subscriber)},t.forEach=function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),n()}}))},t.map=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(Vn(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},t.filter=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(Vn(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},t.reduce=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=Vn(this),r=arguments.length>1,i=!1,o=arguments[1];return new n((function(n){return t.subscribe({next:function(t){var a=!i;if(i=!0,!a||r)try{o=e(o,t)}catch(e){return n.error(e)}else o=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(o),n.complete()}})}))},t.concat=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=Vn(this);return new i((function(t){var r,o=0;return function e(a){r=a.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===n.length?(r=void 0,t.complete()):e(i.from(n[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))},t.flatMap=function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=Vn(this);return new n((function(r){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var o=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),a()}});i.push(o)},error:function(e){r.error(e)},complete:function(){a()}});function a(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))},t[Kn]=function(){return this},e.from=function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=zn(t,Kn);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Gn(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(Fn("iterator")&&(r=zn(t,$n)))return new n((function(e){Wn((function(){if(!e.closed){for(var n,i=Nn(r.call(t));!(n=i()).done;){var o=n.value;if(e.next(o),e.closed)return}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){Wn((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")},e.of=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return new("function"==typeof this?this:e)((function(e){Wn((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))},Mn(e,null,[{key:Hn,get:function(){return this}}]),e}();function rr(e,t){return new nr((function(n){e.subscribe({next:function(e){t(e).then((function(e){return n.next(e)})).catch((function(e){return n.error(e)}))},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}function ir(e,t){return new nr((function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=pe(i),o=n.next();!o.done;o=n.next()){var a=o.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return a(e),a(t),o}))}function or(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new nr((function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var o=pe(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.next)||void 0===i||i.call(s,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,i,o;try{for(var a=pe(t),s=a.next();!s.done;s=a.next()){var c=s.value;null===(o=c.error)||void 0===o||o.call(c,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var o=pe(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.complete)||void 0===i||i.call(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}}))}qn()&&Object.defineProperty(nr,Symbol("extensions"),{value:{symbol:Kn,hostReportError:Jn},configurable:!0});var ar=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},sr=function(e){return ar(e,"attribution")},cr=function(e){return ar(e,"pageViews")},ur=function(e){return ar(e,"sessions")},lr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},dr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},fr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},pr=function(e){if(dr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},gr=function(e){if(fr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},hr=function(e){var t;if(lr(e.autocapture)){var n=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?n=e.autocapture.networkTracking:e.networkTrackingOptions&&(n=e.networkTrackingOptions),ue(ue({},n),{captureRules:null===(t=null==n?void 0:n.captureRules)||void 0===t?void 0:t.map((function(t){var n,r,i;if((null===(n=t.urls)||void 0===n?void 0:n.length)&&(null===(r=t.hosts)||void 0===r?void 0:r.length)){var o=JSON.stringify(t.hosts),a=JSON.stringify(t.urls);return null===(i=e.loggerProvider)||void 0===i||i.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),ue(ue({},t),{hosts:void 0})}return t}))})}},vr=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return cr(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},mr=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,a=r.resolve,s=e&&e[i];if("function"==typeof s){var c=s.apply(e,o);"function"==typeof a&&a(null==c?void 0:c.promise)}}return e},yr=function(e){return e&&void 0!==e._q},br="2.32.2",Tr="amplitude-ts",wr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(Tr,"/").concat(br),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return de(this,void 0,void 0,(function(){var r,i,o;return fe(this,(function(a){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[2,ue(ue(ue(ue(ue(ue(ue(ue({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Pt()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:He(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent})]}))}))},e}(),kr=1e3,Sr=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=$e())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return ae(t,e),t.prototype.set=function(t,n){var r;return de(this,void 0,void 0,(function(){var i;return fe(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>kr?(i=n.length-kr,[4,e.prototype.set.call(this,t,n.slice(0,kr))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(kr,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},t}(Mt),Er=function(e){function t(){var t;return e.call(this,null===(t=$e())||void 0===t?void 0:t.sessionStorage)||this}return ae(t,e),t}(Mt),_r=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return ae(t,e),t.prototype.send=function(e,t){return de(this,void 0,void 0,(function(){var n=this;return fe(this,(function(r){return[2,new Promise((function(r,i){"undefined"==typeof XMLHttpRequest&&i(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done){var e=o.responseText;try{r(n.buildResponse(JSON.parse(e)))}catch(e){r(n.buildResponse({code:o.status}))}}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},t}(Xt),Ir=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ae(t,e),t.prototype.send=function(e,t){return de(this,void 0,void 0,(function(){var n=this;return fe(this,(function(r){return[2,new Promise((function(r,i){var o=$e();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(t);return r(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}}))]}))}))},t}(Xt),Pr=function(e,t,n){return void 0===n&&(n=!0),de(void 0,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d;return fe(this,(function(f){switch(f.label){case 0:return r=function(e){return"".concat(me.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=f.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:f.sent(),f.label=3;case 3:return o=ge(i.split("."),6),a=o[0],s=o[1],c=o[2],u=o[3],l=o[4],d=o[5],[2,{deviceId:a,userId:Or(s),sessionId:Ar(u),lastEventId:Ar(d),lastEventTime:Ar(l),optOut:Boolean(c)}]}}))}))},Ar=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Or=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Rr="[Amplitude]",xr="".concat(Rr," Form Started"),Cr="".concat(Rr," Form Submitted"),Dr="".concat(Rr," File Downloaded"),Lr="session_start",Nr="session_end",Ur="".concat(Rr," File Extension"),jr="".concat(Rr," File Name"),Mr="".concat(Rr," Link ID"),qr="".concat(Rr," Link Text"),Fr="".concat(Rr," Link URL"),Br="".concat(Rr," Form ID"),$r="".concat(Rr," Form Name"),Kr="".concat(Rr," Form Destination"),Hr="cookie",zr=function(e){function t(t,n,r,i,o,a,s,c,u,l,d,f,p,g,h,v,m,y,b,T,w,k,S,E,_,I,P,A,O,R,x,C,D,L,N,U,j,M,q,F){void 0===r&&(r=new Dt),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===c&&(c=1e3),void 0===u&&(u=5),void 0===l&&(l=30),void 0===d&&(d=Hr),void 0===v&&(v=new Xe),void 0===m&&(m=Ye.Warn),void 0===b&&(b=!1),void 0===T&&(T=!1),void 0===S&&(S=""),void 0===E&&(E="US"),void 0===I&&(I=18e5),void 0===P&&(P=new Sr({loggerProvider:v})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===R&&(R=!1),void 0===x&&(x=!0),void 0===j&&(j=!0),void 0===M&&(M=0);var B,$=e.call(this,{apiKey:t,storageProvider:P,transportProvider:Jr(O)})||this;return $.apiKey=t,$.appVersion=n,$.cookieOptions=i,$.defaultTracking=o,$.autocapture=a,$.flushIntervalMillis=c,$.flushMaxRetries=u,$.flushQueueSize=l,$.identityStorage=d,$.ingestionMetadata=f,$.instanceName=p,$.loggerProvider=v,$.logLevel=m,$.minIdLength=y,$.offline=b,$.partnerId=w,$.plan=k,$.serverUrl=S,$.serverZone=E,$.sessionTimeout=I,$.storageProvider=P,$.trackingOptions=A,$.transport=O,$.useBatch=R,$.fetchRemoteConfig=x,$.networkTrackingOptions=N,$.identify=U,$.enableDiagnostics=j,$.diagnosticsSampleRate=M,$.diagnosticsClient=q,$.remoteConfig=F,$.version=br,$._optOut=!1,$._cookieStorage=r,$.deviceId=s,$.lastEventId=g,$.lastEventTime=h,$.optOut=T,$.sessionId=_,$.pageCounter=D,$.userId=C,$.debugLogsEnabled=L,$.loggerProvider.enable(L?Ye.Debug:$.logLevel),$.networkTrackingOptions=N,$.identify=U,$.enableDiagnostics=j,$.diagnosticsSampleRate=M,$.diagnosticsClient=q,B=!0===(null==F?void 0:F.fetchRemoteConfig)||!1!==(null==F?void 0:F.fetchRemoteConfig)&&!1!==x,$.remoteConfig=$.remoteConfig||{},$.remoteConfig.fetchRemoteConfig=B,$.fetchRemoteConfig=B,$}return ae(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(It(this.apiKey),e)},t}(et),Vr=function(e,t,n){return void 0===t&&(t={}),de(void 0,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,d,f,p,g,h,v,m,y,b,T,w,k,S,E,_,I,P,A,O,R,x,C,D,L,N,U,j,M,q,F,B,$,K,H,z,V,G;return fe(this,(function(J){switch(J.label){case 0:return r=t.identityStorage||Hr,S={},r===Hr?[3,1]:(o="",[3,5]);case 1:return null===(_=null===(E=t.cookieOptions)||void 0===E?void 0:E.domain)||void 0===_?[3,2]:(a=_,[3,4]);case 2:return[4,Wr()];case 3:a=J.sent(),J.label=4;case 4:o=a,J.label=5;case 5:return i=ue.apply(void 0,[(S.domain=o,S.expiration=365,S.sameSite="Lax",S.secure=!1,S.upgrade=!0,S),t.cookieOptions]),s=Gr(t.identityStorage,i),[4,Pr(e,s,null===(P=null===(I=t.cookieOptions)||void 0===I?void 0:I.upgrade)||void 0===P||P)];case 6:return c=J.sent(),[4,s.get(It(e))];case 7:return u=J.sent(),l=At(),d=l.ampTimestamp?Number(l.ampTimestamp):void 0,f=!d||Date.now()<d,p=null!==(C=null!==(x=null!==(R=null!==(A=t.deviceId)&&void 0!==A?A:f?null!==(O=l.ampDeviceId)&&void 0!==O?O:l.deviceId:void 0)&&void 0!==R?R:null==u?void 0:u.deviceId)&&void 0!==x?x:c.deviceId)&&void 0!==C?C:He(),g=null!==(D=null==u?void 0:u.lastEventId)&&void 0!==D?D:c.lastEventId,h=null!==(L=null==u?void 0:u.lastEventTime)&&void 0!==L?L:c.lastEventTime,v=null!==(U=null!==(N=t.optOut)&&void 0!==N?N:null==u?void 0:u.optOut)&&void 0!==U?U:c.optOut,m=null!==(j=null==u?void 0:u.sessionId)&&void 0!==j?j:c.sessionId,y=null!==(q=null!==(M=t.userId)&&void 0!==M?M:null==u?void 0:u.userId)&&void 0!==q?q:c.userId,n.previousSessionDeviceId=null!==(F=null==u?void 0:u.deviceId)&&void 0!==F?F:c.deviceId,n.previousSessionUserId=null!==(B=null==u?void 0:u.userId)&&void 0!==B?B:c.userId,b={ipAddress:null===(K=null===($=t.trackingOptions)||void 0===$?void 0:$.ipAddress)||void 0===K||K,language:null===(z=null===(H=t.trackingOptions)||void 0===H?void 0:H.language)||void 0===z||z,platform:null===(G=null===(V=t.trackingOptions)||void 0===V?void 0:V.platform)||void 0===G||G},T=null==u?void 0:u.pageCounter,w=null==u?void 0:u.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(k=new zr(e,t.appVersion,s,i,t.defaultTracking,t.autocapture,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,g,h,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,v,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,b,t.transport,t.useBatch,t.fetchRemoteConfig,y,T,w,t.networkTrackingOptions,t.identify,t.enableDiagnostics,n._diagnosticsSampleRate,void 0,t.remoteConfig)).storageProvider.isEnabled()];case 8:return J.sent()||(k.loggerProvider.warn("Storage provider ".concat(k.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),k.storageProvider=new Dt),[2,k]}}))}))},Gr=function(e,t){switch(void 0===e&&(e=Hr),void 0===t&&(t={}),e){case"localStorage":return new Sr;case"sessionStorage":return new Er;case"none":return new Dt;default:return new Lt(ue(ue({},t),{expirationDays:t.expiration}))}},Jr=function(e){return"xhr"===e?new _r:"beacon"===e?new Ir:new Zt},Wr=function(e){return de(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,a;return fe(this,(function(s){switch(s.label){case 0:return[4,(new Lt).isEnabled()];case 1:if(!s.sent()||"undefined"==typeof location||!location.hostname)return[2,""];for(e=location.hostname,t=e.split("."),n=[],r="AMP_TLDTEST",i=t.length-2;i>=0;--i)n.push(t.slice(i).join("."));i=0,s.label=2;case 2:return i<n.length?(o=n[i],[4,(a=new Lt({domain:"."+o})).set(r,1)]):[3,7];case 3:return s.sent(),[4,a.get(r)];case 4:return s.sent()?[4,a.remove(r)]:[3,6];case 5:return s.sent(),[2,"."+o];case 6:return i++,[3,2];case 7:return[2,""]}}))}))},Yr=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Qr=function(e){var t;void 0===e&&(e={});var n,r=$e(),i=void 0,o=!1,a=e.trackOn,s=e.trackHistoryChanges,c=e.eventType,u=void 0===c?"[Amplitude] Page Viewed":c,l=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==i||i.error("Malformed URI sequence: ",e)}return t},d=function(){return de(void 0,void 0,void 0,(function(){var e,t,n;return fe(this,(function(r){switch(r.label){case 0:return e=l("undefined"!=typeof location&&location.href||""),n={event_type:u},t=[{}],[4,Xr()];case 1:return[2,(n.event_properties=ue.apply(void 0,[ue.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&l(location.pathname)||"","[Amplitude] Page Title":Ln(Dn),"[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},f=function(){return void 0===a||"function"==typeof a&&a()},p="undefined"!=typeof location?location.href:null,g=function(){return de(void 0,void 0,void 0,(function(){var e,n,r,o;return fe(this,(function(a){switch(a.label){case 0:return e=location.href,n=ei(s,e,p||"")&&f(),p=e,n?(null==i||i.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return o=(r=t).track,[4,d()];case 2:o.apply(r,[a.sent()]),a.label=3;case 3:a.label=4;case 4:return[2]}}))}))},h=function(){g()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return de(void 0,void 0,void 0,(function(){var s,c;return fe(this,(function(u){switch(u.label){case 0:return t=a,n=e,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),o=!0,r&&(r.addEventListener("popstate",h),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=ge(n,3),i=r[0],a=r[1],s=r[2];e.apply(t,[i,a,s]),o&&g()}})),f()?(i.log("Tracking page view event"),c=(s=t).track,[4,d()]):[3,2];case 1:c.apply(s,[u.sent()]),u.label=2;case 2:return[2]}}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){var t;return fe(this,(function(r){switch(r.label){case 0:return"attribution"===a&&Zr(e)?(null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,d()]):[3,2];case 1:t=r.sent(),e.event_type=t.event_type,e.event_properties=ue(ue({},e.event_properties),t.event_properties),r.label=2;case 2:return n&&e.event_type===u&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=ue(ue({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){return fe(this,(function(e){return r&&(r.removeEventListener("popstate",h),o=!1),[2]}))}))}};return v},Xr=function(){return de(void 0,void 0,void 0,(function(){var e;return fe(this,(function(t){switch(t.label){case 0:return e=Yr,[4,(new Pn).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},Zr=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[se.SET]||{},r=t[se.UNSET]||{},i=he(he([],ge(Object.keys(n)),!1),ge(Object.keys(r)),!1);return Object.keys(Ce).every((function(e){return i.includes(e)}))}return!1},ei=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},ti=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,r){return de(void 0,void 0,void 0,(function(){var i,o;return fe(this,(function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var t=!1;n(e,"change",(function(){var n,i=ri(e);t||r.track(xr,((n={})[Br]=ni(e.id),n[$r]=ni(e.name),n[Kr]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=ri(e);t||r.track(xr,((n={})[Br]=ni(e.id),n[$r]=ni(e.name),n[Kr]=o,n)),r.track(Cr,((i={})[Br]=ni(e.id),i[$r]=ni(e.name),i[Kr]=o,i)),t=!1}))};Array.from(document.getElementsByTagName("form")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?i():(o=$e())?o.addEventListener("load",i):t.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){return[2,e]}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){return fe(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},ni=function(e){if("string"==typeof e)return e},ri=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},ii=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return de(void 0,void 0,void 0,(function(){var i,o;return fe(this,(function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),a=null==i?void 0:i[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",(function(){var t;a&&r.track(Dr,((t={})[Ur]=a,t[jr]=n.pathname,t[Mr]=e.id,t[qr]=e.text,t[Fr]=e.href,t))}))},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=$e())?o.addEventListener("load",i):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){return[2,e]}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){return fe(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},oi=!1,ai=function(){var e=$e(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return de(void 0,void 0,void 0,(function(){return fe(this,(function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",(function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout((function(){t.flush()}),e.flushIntervalMillis)})),n("offline",(function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2])}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){return fe(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)})),t=[],[2]}))}))}}};function si(e){var t,n,r,i,o,a,s,c,u,l,d;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var f=Object.keys(e);try{for(var p=pe(f),g=p.next();!g.done;g=p.next()){var h=g.value;try{var v=e[h];"boolean"==typeof(null==v?void 0:v.enabled)&&(v.enabled?(delete v.enabled,0===Object.keys(v).length&&(e[h]=!0)):e[h]=!1),si(v)}catch(e){}}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}try{if(null===(u=null===(c=null===(s=e.autocapture)||void 0===s?void 0:s.networkTracking)||void 0===c?void 0:c.captureRules)||void 0===u?void 0:u.length)try{for(var m=pe(e.autocapture.networkTracking.captureRules),y=m.next();!y.done;y=m.next()){var b=y.value;try{for(var T=(o=void 0,pe(["responseHeaders","requestHeaders"])),w=T.next();!w.done;w=T.next()){var k=w.value,S=null!==(l=b[k])&&void 0!==l?l:{},E=S.captureSafeHeaders,_=S.allowlist;(E||_)&&(void 0===_||Array.isArray(_)?b[k]=he(he([],ge(E?De:[]),!1),ge(null!=_?_:[]),!1):delete b[k])}}catch(e){o={error:e}}finally{try{w&&!w.done&&(a=T.return)&&a.call(T)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}}catch(e){}var I=null===(d=e.autocapture)||void 0===d?void 0:d.frustrationInteractions;I&&(I.rageClick&&(I.rageClicks=I.rageClick,delete I.rageClick),I.deadClick&&(I.deadClicks=I.deadClick,delete I.deadClick))}}function ci(e,t,n){var r,i,o=[];try{for(var a=pe(null!=t?t:[]),s=a.next();!s.done;s=a.next()){var c=s.value;try{o.push(new RegExp(c))}catch(e){n.loggerProvider.warn("Invalid regex pattern: ".concat(c),e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return e.concat(o)}function ui(e,t){var n,r,i,o,a,s,c;if(e){si(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e));var u=e;if(u&&"autocapture"in u){if("boolean"==typeof u.autocapture&&(t.autocapture=u.autocapture),"object"==typeof u.autocapture&&null!==u.autocapture){var l=ue({},u.autocapture);if(void 0===t.autocapture&&(t.autocapture=u.autocapture),"object"==typeof u.autocapture.elementInteractions&&null!==u.autocapture.elementInteractions&&(null===(i=u.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===i?void 0:i.length)){l.elementInteractions=ue({},u.autocapture.elementInteractions);var d=l.elementInteractions,f=null!==(o=d.pageUrlAllowlist)&&void 0!==o?o:[],p=u.autocapture.elementInteractions.pageUrlAllowlistRegex;d.pageUrlAllowlist=ci(f,p,t),delete d.pageUrlAllowlistRegex}if("object"==typeof u.autocapture.networkTracking&&null!==u.autocapture.networkTracking&&(null===(a=u.autocapture.networkTracking.captureRules)||void 0===a?void 0:a.length)){l.networkTracking=ue({},u.autocapture.networkTracking);var g=null!==(s=l.networkTracking.captureRules)&&void 0!==s?s:[];try{for(var h=pe(g),v=h.next();!v.done;v=h.next()){var m=v.value;m.urls=ci(null!==(c=m.urls)&&void 0!==c?c:[],m.urlsRegex,t),delete m.urlsRegex}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=ue({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},l)),"object"==typeof t.autocapture&&(t.autocapture=ue(ue({},t.autocapture),l))}t.defaultTracking=t.autocapture}t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var li="1.18.2",di="[Amplitude] Element Clicked",fi="[Amplitude] Element Tag",pi="[Amplitude] Element Text",gi="[Amplitude] Page URL",hi="https://app.amplitude.com",vi={US:hi,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},mi="data-amp-mask-attributes",yi=["input","select","textarea"],bi=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t},Ti=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,a,s=e.pageUrlAllowlist,c=e.pageUrlExcludelist,u=e.shouldTrackEventResolver,l=null===(a=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===a?void 0:a.call(o);if(!l)return!1;if(u)return u(r,i);if(!Rt(window.location.href,s))return!1;if(c&&c.length>0&&Rt(window.location.href,c))return!1;var d=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof d)switch(d.toLowerCase()){case"hidden":case"password":return!1}var f=bi(i,r);if(n&&f)return!0;if(t){var p=t.some((function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))}));if(!p)return!1}switch(l){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!f||"click"===r}}},wi=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},ki=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:ki(null==e?void 0:e.parentElement,t):null};var Si=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};var Ei=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",mi,An]),_i=["type"],Ii=["svg","path","g"],Pi=["password","hidden"];function Ai(e,t){var n,r,i,o,a,s;if(null===e)return null;var c=String(e.tagName).toLowerCase(),u={tag:c},l=Array.from(null!==(o=null===(i=e.parentElement)||void 0===i?void 0:i.children)&&void 0!==o?o:[]);l.length&&(u.index=l.indexOf(e),u.indexOfType=l.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var d=null===(s=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===s?void 0:s.toLowerCase();d&&(u.prevSib=String(d));var f=e.getAttribute("id");f&&(u.id=String(f));var p=Array.from(e.classList);p.length&&(u.classes=p);var g={},h=Array.from(e.attributes).filter((function(e){return!Ei.has(e.name)})),v=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!yi.includes(i)&&!o}(e);if(!Pi.includes(String(e.getAttribute("type")))&&!Ii.includes(c))try{for(var m=pe(h),y=m.next();!y.done;y=m.next()){var b=y.value;v&&!_i.includes(b.name)||(t.has(b.name)?g[b.name]=On:g[b.name]=String(b.value).substring(0,128))}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(g).length&&(u.attrs=g),u}var Oi=function(e,t,n){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}}))},Ri=function(e,t){var n,r,i,o=this;this.replaceSensitiveString=function(e){return Dn(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,a,s=performance.now();if(!e)return[];for(var c,u=function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),l=new Map,d=u.length-1;d>=0;d--){var f=u[d];if(f){var p=(c=f.getAttribute(mi))?c.split(",").map((function(e){return e.trim()})).filter((function(e){return e.length>0&&"id"!==e&&"class"!==e})):[],g=d===u.length-1?[]:null!==(r=l.get(u[d+1]))&&void 0!==r?r:new Set,h=new Set(he(he([],ge(g),!1),ge(p),!1));l.set(f,h)}}a=u.map((function(e){var t;return Ai(e,null!==(t=l.get(e))&&void 0!==t?t:new Set)}));var v=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach((function(t){var n=ge(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=o.replaceSensitiveString(i))}))};try{for(var m=pe(a),y=m.next();!y.done;y=m.next())v(y.value)}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}var b=performance.now();return null===(i=o.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",b-s),a},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?o.getText(t):o.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,i,a,s,c,u,l=null===(a=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===a?void 0:a.call(i),d="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},f=o.getHierarchy(t),p=null===(s=f[0])||void 0===s?void 0:s.attrs,g=o.getNearestLabel(t),h=(c=null!=p?p:{},u=n,Object.entries(c).reduce((function(e,t){var n=ge(t,2),r=n[0],i=n[1];if(r.startsWith(u)){var o=r.replace(u,"");o&&(e[o]=i||"")}return e}),{})),v=((r={})["[Amplitude] Element Hierarchy"]=f,r[fi]=l,r[pi]=o.getText(t),r["[Amplitude] Element Position Left"]=null==d.left?null:Math.round(d.left),r["[Amplitude] Element Position Top"]=null==d.top?null:Math.round(d.top),r["[Amplitude] Element Attributes"]=h,r["[Amplitude] Element Parent Label"]=g,r[gi]=xt(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=Ln(o.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);if(v["[Amplitude] Element ID"]=t.getAttribute("id")||"",v["[Amplitude] Element Class"]=t.getAttribute("class"),v["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===l&&"click"===e&&t instanceof HTMLAnchorElement){var m=t.href.substring(0,128);v["[Amplitude] Element Href"]=o.replaceSensitiveString(m)}return wi(v)},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var a={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(a)&&null!==a.event.target){if(i&&bi(a.event.target,a.type))return a.closestTrackedAncestor=a.event.target,a.targetElementProperties=o.getEventProperties(a.type,a.closestTrackedAncestor,r),a;var s=ki(a.event.target,n);return s&&(a.closestTrackedAncestor=s,a.targetElementProperties=o.getEventProperties(a.type,s,r)),a}return a},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?o.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getText=function(e){if(null!==e.closest("[".concat(An,"]")))return On;var t="";if(e.querySelector("[".concat(An,"], [contenteditable]"))){var n=e.cloneNode(!0);n.querySelectorAll("[".concat(An,"], [contenteditable]")).forEach((function(e){e.innerText=On})),t=n.innerText||""}else t=e.innerText||"";return o.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),a=((t={})[fi]=i,t[pi]=o.getText(e),t[gi]=window.location.href.split("?")[0],t);return wi(a)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var a=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],s=[];try{for(var c=pe(a),u=c.next();!u.done;u=c.next()){var l=u.value;if(s.length>=25)break;if(l instanceof RegExp)s.push(l);else if("pattern"in l&&"string"==typeof l.pattern)try{s.push(new RegExp(l.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=s},xi=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?hi:t,r=this;this.endpoint=hi,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){a(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{dataExtractor:new Ri({})}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,a=n.cssSelectorAllowlist,s=n.actionClickAllowlist,c=n.dataExtractor;this.logger=r,i&&this.endpoint===hi&&(this.endpoint=i);var u=null;window.addEventListener("message",(function(e){var n,r,i,l,d;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var f,p=null==e?void 0:e.data,g=null==p?void 0:p.action;if(g)if("id"in p)null===(l=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===l||l.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(p);else if("ping"===g)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===g){var h=null==p?void 0:p.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;u=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:c.getEventTagProps,isElementSelectable:function(e){return!o||o((null==h?void 0:h.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:a,actionClickAllowlist:s,extractDataFromDataSource:c.extractDataFromDataSource,dataExtractor:c,diagnostics:{autocapture:{version:li}}}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===g&&(null===(d=null==u?void 0:u.close)||void 0===d||d.call(u))}})),this.notify({action:"page-loaded"})},e}();var Ci,Di=function(){return new nr((function(e){var t=new MutationObserver((function(t){e.next(t)}));return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}}))},Li=function(e){return void 0===e&&(e="click"),new nr((function(t){var n,r=function(e){t.next(e)};return null===(n=$e())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=$e())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}}))},Ni={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Ui=function(e){var t,n,r,i,o=Object.values(Ni).reduce((function(e,t){return e[t]=new Set,e}),{});if(!e)return o;try{for(var a=pe(e),s=a.next();!s.done;s=a.next()){var c=s.value;try{try{for(var u=(r=void 0,pe(c.definition)),l=u.next();!l.done;l=u.next()){var d=l.value,f=Ni[d.event_type];f&&o[f].add(c.id)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==c?void 0:c.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},ji=function(e){var t,n,r,i,o=new Map;try{for(var a=pe(e),s=a.next();!s.done;s=a.next()){var c=s.value;try{for(var u=(r=void 0,pe(c.conditions)),l=u.next();!l.done;l=u.next()){var d=l.value;if("LABELED_EVENT"===d.type){var f=d.match.eventId,p=o.get(f);p||(p=[],o.set(f,p)),p.push(c)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},Mi=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return Ni[t.event_type]===e.type&&t.filters.every((function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)}))}))}))},qi=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,a=new Set;try{for(var s=pe(e),c=s.next();!c.done;c=s.next()){var u=c.value,l=t.get(u.id);if(l)try{for(var d=(i=void 0,pe(l)),f=d.next();!f.done;f=d.next()){var p=f.value;a.add(p)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(a)}(Mi(e,Array.from(this.groupedLabeledEvents[e.type]).map((function(e){return r.labeledEvents[e]}))),this.labeledEventToTriggerMap);try{for(var o=pe(i),a=o.next();!a.done;a=o.next()){var s=a.value;Oi(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}();!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(Ci||(Ci={}));var Fi=function(e,t){var n,r,i,o,a,s,c,u;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",li);var l=e.dataAttributePrefix,d=void 0===l?rn:l,f=e.visualTaggingOptions,p=void 0===f?{enabled:!0,messenger:new xi}:f;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:nn,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:on,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0,e.pageUrlExcludelist=null===(o=e.pageUrlExcludelist)||void 0===o?void 0:o.reduce((function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e}),[]);var g="@amplitude/plugin-autocapture-browser",h=[],v=new Ri(e,t),m=Ui(Object.values(null!==(s=null===(a=e.pageActions)||void 0===a?void 0:a.labeledEvents)&&void 0!==s?s:{})),y=ji(null!==(u=null===(c=e.pageActions)||void 0===c?void 0:c.triggers)&&void 0!==u?u:[]),b=function(e,t,n,r){return new qi(e,t,n,r)}(m,y,v,e);return{name:g,type:"enrichment",setup:function(t,n){return de(void 0,void 0,void 0,(function(){var r,i,o,a,s,c,u,l,f,T;return fe(this,(function(w){return"undefined"==typeof document||(t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("analyticsSDK.pageActions","all",(function(t){!function(t){var n,r;t&&(e.pageActions=ue(ue({},e.pageActions),t),m=Ui(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),y=ji(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),b.update(m,y,e))}(t)})):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),r=Ti(e,e.cssSelectorAllowlist),i=Ti(e,e.actionClickAllowlist),o=function(){var t,n,r=or(Li().map((function(t){return v.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,d)}))),i=or(new nr((function(t){var n,r=function(n){var r=v.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,d);t.next(r)};return null===(n=$e())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=$e())||void 0===e?void 0:e.document.removeEventListener("change",r)}})));window.navigation&&(n=or(new nr((function(t){var n=function(n){var r=v.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,d);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}}))));var o=or(Di().map((function(t){return v.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,d)})));return(t={})[Ci.ChangeObservable]=i,t[Ci.ClickObservable]=r,t[Ci.MutationObservable]=o,t[Ci.NavigateObservable]=n,t}(),a=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(Si).filter((function(e){return r("click",e.closestTrackedAncestor)})).map((function(e){return i(e)})).subscribe((function(e){null==t||t.track(di,e.targetElementProperties)}))}({allObservables:o,amplitude:n,shouldTrackEvent:r,evaluateTriggers:b.evaluate.bind(b)}),h.push(a),s=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(Si).filter((function(e){return i("change",e.closestTrackedAncestor)})).map((function(e){return o(e)})).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:o,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.getEventProperties.apply(v,he(he([],ge(e),!1),[d],!1))},amplitude:n,shouldTrackEvent:r,evaluateTriggers:b.evaluate.bind(b)}),h.push(s),c=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=n.clickObservable,c=n.mutationObservable,u=n.navigateObservable,l=s.filter((function(e){return!o("click",e.closestTrackedAncestor)})).map((function(e){var t=ki(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})).filter(Si).filter((function(e){return a("click",e.closestTrackedAncestor)})),d=u?ir(c,u):c,f=ir(l,d),p=null,g=null;return rr(f,(function(e){if(p&&(clearTimeout(p),p=null),"click"===e.type)return g=e,p=setTimeout((function(){p=null,g=null}),500),Promise.resolve(null);if(g){var t=g;return g=null,Promise.resolve(t)}return Promise.resolve(null)})).subscribe((function(e){e&&(null==t||t.track(di,i("click",e.closestTrackedAncestor)))}))}({allObservables:o,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.getEventProperties.apply(v,he(he([],ge(e),!1),[d],!1))},amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:i}),c&&h.push(c),null===(f=null==t?void 0:t.loggerProvider)||void 0===f||f.log("".concat(g," has been successfully added.")),window.opener&&p.enabled&&(u=e.cssSelectorAllowlist,l=e.actionClickAllowlist,null===(T=p.messenger)||void 0===T||T.setup(ue(ue({dataExtractor:v,logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:vi[t.serverZone]}),{isElementSelectable:Ti(e,he(he([],ge(u),!1),ge(l),!1)),cssSelectorAllowlist:u,actionClickAllowlist:l})))),[2]}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){return[2,e]}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){var e,t,n,r;return fe(this,(function(i){try{for(e=pe(h),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},Bi=["mutation","navigate"];function $i(e,t){var n,r,i,o,a=t.event,s=a.clientX,c=a.clientY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:c,c),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:c,c),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:s,s),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function Ki(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:ue({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map((function(e){return{X:e.event.clientX,Y:e.event.clientY,Time:e.timestamp}})),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Hi(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,a=[],s={},c=null;return rr(o.filter((function(e){return i("click",e.closestTrackedAncestor)})),(function(e){return de(t,void 0,void 0,(function(){var t;return fe(this,(function(n){return $i(s,e),t=null,0===a.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(a,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(a,e)||s.isOutOfBounds?(c&&(t=Ki(a)),function(e){a=[],s={},e&&($i(s,e),a.push(e))}(e)):a.push(e),c&&(clearTimeout(c.timerId),c.resolve(t),c=null),a.length>=4?[2,new Promise((function(e){c={resolve:e,timerId:setTimeout((function(){e(Ki(a))}),1e3)}}))]:[2,null]}))}))})).subscribe((function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})}))}var zi,Vi,Gi=function(e){var t,n,r,i,o;void 0===e&&(e={});var a="@amplitude/plugin-frustration-browser",s=[],c=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:sn,u=null!==(i=null===(r=e.deadClicks)||void 0===r?void 0:r.cssSelectorAllowlist)&&void 0!==i?i:an,l=null!==(o=e.dataAttributePrefix)&&void 0!==o?o:rn,d=new Ri(e),f=he([],ge(new Set(he(he([],ge(c),!1),ge(u),!1))),!1);return{name:a,type:"enrichment",setup:function(t,n){return de(void 0,void 0,void 0,(function(){var r,i,o,p,g,h;return fe(this,(function(v){return"undefined"==typeof document||(r=Ti(e,c),i=Ti(e,u),o=function(){var e,t,n=or(Li("pointerdown").map((function(e){return d.addAdditionalEventProperties(e,"click",f,l,!0)}))),r=or(Di().map((function(e){return d.addAdditionalEventProperties(e,"mutation",f,l)})));return window.navigation&&(t=or(new nr((function(e){var t=function(t){e.next(ue(ue({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}})).map((function(e){return d.addAdditionalEventProperties(e,"navigate",f,l)})))),(e={})[Ci.ClickObservable]=n,e[Ci.MutationObservable]=r,e[Ci.NavigateObservable]=t,e}(),p=Hi({allObservables:o,amplitude:n,shouldTrackRageClick:r}),s.push(p),g=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,o=n.clickObservable,a=n.mutationObservable,s=n.navigateObservable,c=o.filter((function(e){return Si(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')})),u=s?ir(a,s):a,l=ir(c,u),d=null;return rr(l,(function(e){return d&&Bi.includes(e.type)?(clearTimeout(d),d=null,Promise.resolve(null)):"click"===e.type?d?Promise.resolve(null):new Promise((function(t){d=setTimeout((function(){t(e),d=null}),3e3)})):Promise.resolve(null)})).subscribe((function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",ue(ue({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}}))}({amplitude:n,allObservables:o,getEventProperties:function(e,t){return d.getEventProperties(e,t,l)},shouldTrackDeadClick:i}),s.push(g),null===(h=null==t?void 0:t.loggerProvider)||void 0===h||h.log("".concat(a," has been successfully added."))),[2]}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){return[2,e]}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){var e,t,n,r;return fe(this,(function(i){try{for(e=pe(s),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},Ji="[Amplitude] Network Request",Wi="500-599";function Yi(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function Qi(e,t){var n,r,i=t.split(",");try{for(var o=pe(i),a=o.next();!a.done;a=o.next()){var s=ge(a.value.split("-").map(Number),2),c=s[0],u=s[1];if(e===c&&void 0===u)return!0;if(e>=c&&e<=u)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function Xi(e){var t;if(e)try{var n=null===(t=$e())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),a=r.href,s=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:r.href,host:s}}catch(e){return}}function Zi(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return he([],ge(De),!1);if(void 0===e){return}}}function eo(e){var t,n;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)}function to(e,t){var n;void 0===t&&(t={});var r=Xi(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(Yi(o,"*.amplitude.com")||Yi(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find((function(e){return Yi(o,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!Qi(e.status,Wi))return!1;if(t.captureRules&&(he([],ge(t.captureRules),!1).reverse().find((function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find((function(e){return Yi(t,e)})))&&(!r||!e.urls||Rt(r,e.urls))&&(!i||!e.methods||e.methods.find((function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e}))))return!((n||0===n)&&!Qi(n,e.statusCodeRange||Wi))}(t,o,e.status,e.url,e.method),i){var n=Zi(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=Zi(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}e.responseWrapper&&t.responseBody&&!eo(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!eo(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==i})),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find((function(e){return e.event_type===Ji})))return!0}catch(e){}return!1}(o,e.requestWrapper)}function no(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter((function(e){return to(e.event,n)})).subscribe((function(e){var t,n,o,a=e.event,s=Xi(a.url);if(s){var c=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,u=null===(o=a.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){de(this,void 0,void 0,(function(){var i,o,a;return fe(this,(function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=ge.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(e){null==r||r.debug("Failed to stringify response body")}s.label=2;case 2:return null==n||n.track(Ji,e),[2]}}))}))}(((t={})["[Amplitude] URL"]=s.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=s.query,t["[Amplitude] URL Fragment"]=s.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=u,t["[Amplitude] Response Body Size"]=c,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}}))}!function(e){e.NetworkObservable="networkObservable"}(zi||(zi={}));var ro=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new nr((function(e){var n=new En((function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)}));return In.subscribe(n,t),function(){In.unsubscribe(n)}}));return(e={})[zi.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return de(void 0,void 0,void 0,(function(){var a;return fe(this,(function(s){return"undefined"==typeof document||(a=r(),t=null==i?void 0:i.loggerProvider,Vi=no({allObservables:a,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," has been successfully added."))),[2]}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){return[2,e]}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){return fe(this,(function(e){return Vi.unsubscribe(),[2]}))}))}}};let io=-1;const oo=e=>{addEventListener("pageshow",(t=>{t.persisted&&(io=t.timeStamp,e(t))}),!0)},ao=(e,t,n,r)=>{let i,o;return a=>{t.value>=0&&(a||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},so=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},co=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},uo=()=>{const e=co();return e?.activationStart??0},lo=(e,t=-1)=>{const n=co();let r="navigate";return io>=0?r="back-forward-cache":n&&(document.prerendering||uo()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},fo=new WeakMap;function po(e,t){return fo.get(e)||fo.set(e,new t),fo.get(e)}class go{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const ho=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe({type:e,buffered:!0,...n}),r}}catch{}},vo=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let mo=-1;const yo=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,bo=e=>{"hidden"===document.visibilityState&&mo>-1&&(mo="visibilitychange"===e.type?e.timeStamp:0,wo())},To=()=>{addEventListener("visibilitychange",bo,!0),addEventListener("prerenderingchange",bo,!0)},wo=()=>{removeEventListener("visibilitychange",bo,!0),removeEventListener("prerenderingchange",bo,!0)},ko=()=>{if(mo<0){const e=uo(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;mo=t??yo(),To(),oo((()=>{setTimeout((()=>{mo=yo(),To()}))}))}return{get firstHiddenTime(){return mo}}},So=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},Eo=[1800,3e3],_o=(e,t={})=>{So((()=>{const n=ko();let r,i=lo("FCP");const o=ho("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-uo(),0),i.entries.push(t),r(!0)))}));o&&(r=ao(e,i,Eo,t.reportAllChanges),oo((n=>{i=lo("FCP"),r=ao(e,i,Eo,t.reportAllChanges),so((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},Io=[.1,.25];let Po=0,Ao=1/0,Oo=0;const Ro=e=>{for(const t of e)t.interactionId&&(Ao=Math.min(Ao,t.interactionId),Oo=Math.max(Oo,t.interactionId),Po=Oo?(Oo-Ao)/7+1:0)};let xo;const Co=()=>xo?Po:performance.interactionCount??0;let Do=0;class Lo{u=[];l=new Map;m;p;v(){Do=Co(),this.u.length=0,this.l.clear()}P(){const e=Math.min(this.u.length-1,Math.floor((Co()-Do)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.T){if(n?e.duration>n.T?(n.entries=[e],n.T=e.duration):e.duration===n.T&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],T:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.T-e.T)),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const No=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(t(e=vo(e)),document.addEventListener("visibilitychange",e,{once:!0}))},Uo=[200,500],jo=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&So((()=>{"interactionCount"in performance||xo||(xo=ho("event",Ro,{type:"event",buffered:!0,durationThreshold:0}));let n,r=lo("INP");const i=po(t,Lo),o=e=>{No((()=>{for(const t of e)i.h(t);const t=i.P();t&&t.T!==r.value&&(r.value=t.T,r.entries=t.entries,n())}))},a=ho("event",o,{durationThreshold:t.durationThreshold??40});n=ao(e,r,Uo,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(a.takeRecords()),n(!0))})),oo((()=>{i.v(),r=lo("INP"),n=ao(e,r,Uo,t.reportAllChanges)})))}))};class Mo{m;h(e){this.m?.(e)}}const qo=[2500,4e3],Fo=[800,1800],Bo=e=>{document.prerendering?So((()=>Bo(e))):"complete"!==document.readyState?addEventListener("load",(()=>Bo(e)),!0):setTimeout(e)};function $o(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function Ko(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor($o(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Ho,zo=function(){var e=null,t=$e(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return de(void 0,void 0,void 0,(function(){var o,a;return fe(this,(function(s){return void 0===n||(o=xt((null==r?void 0:r.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":xt((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":xt(o.split("?")[0],t.loggerProvider)},((e,t={})=>{So((()=>{const n=ko();let r,i=lo("LCP");const o=po(t,Mo),a=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-uo(),0),i.entries=[t],r())},s=ho("largest-contentful-paint",a);if(s){r=ao(e,i,qo,t.reportAllChanges);const n=vo((()=>{a(s.takeRecords()),s.disconnect(),r(!0)}));for(const e of["keydown","click","visibilitychange"])addEventListener(e,(()=>No(n)),{capture:!0,once:!0});oo((n=>{i=lo("LCP"),r=ao(e,i,qo,t.reportAllChanges),so((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((function(e){a["[Amplitude] LCP"]=Ko(e)})),_o((function(e){a["[Amplitude] FCP"]=Ko(e)})),jo((function(e){a["[Amplitude] INP"]=Ko(e)})),((e,t={})=>{_o(vo((()=>{let n,r=lo("CLS",0);const i=po(t,go),o=e=>{for(const t of e)i.h(t);i.i>r.value&&(r.value=i.i,r.entries=i.o,n())},a=ho("layout-shift",o);a&&(n=ao(e,r,Io,t.reportAllChanges),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(a.takeRecords()),n(!0))})),oo((()=>{i.i=0,r=lo("CLS",0),n=ao(e,r,Io,t.reportAllChanges),so((()=>n()))})),setTimeout(n))})))})((function(e){a["[Amplitude] CLS"]=Ko(e)})),((e,t={})=>{let n=lo("TTFB"),r=ao(e,n,Fo,t.reportAllChanges);Bo((()=>{const i=co();i&&(n.value=Math.max(i.responseStart-uo(),0),n.entries=[i],r(!0),oo((()=>{n=lo("TTFB",0),r=ao(e,n,Fo,t.reportAllChanges),r(!0)})))}))})((function(e){a["[Amplitude] TTFB"]=Ko(e)})),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){return[2,e]}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]}))}))}}},Vo=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Go=function(e,t,n,r,i){void 0===i&&(i=!0),e.referrer;var o=e.referring_domain,a=le(e,["referrer","referring_domain"]),s=t||{};s.referrer;var c=s.referring_domain,u=le(s,["referrer","referring_domain"]);if(Jo(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var l=JSON.stringify(a)!==JSON.stringify(u),d=Vo(o||"")!==Vo(c||""),f=!t||l||d;return f?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),f},Jo=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))},Wo=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=ue({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=jt(t.apiKey,"MKTG"),this.webExpStorageKey=jt(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=Ce,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return de(this,void 0,void 0,(function(){var e,t;return fe(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=ge.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||_t(this.sessionTimeout,this.lastEventTime),Go(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},e.prototype.fetchCampaign=function(){return de(this,void 0,void 0,(function(){var e;return fe(this,(function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new Pn).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,o=(t=this.currentCampaign,n=this.options,r=ue(ue({},Ce),t),i=Object.entries(r).reduce((function(e,t){var r,i=ge(t,2),o=i[0],a=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=a?a:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(o,a):e.unset(o)}),new je),Ve(i));return e&&(o.event_id=e),o},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Yo="AMP_CURRENT_PAGE",Qo="AMP_PREVIOUS_PAGE",Xo="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(Ho||(Ho={}));var Zo=new Set([ce.IDENTIFY,ce.GROUP_IDENTIFY,ce.REVENUE]),ea=function(e){var t={}.internalDomains,n=void 0===t?[]:t,r=$e(),i=void 0,o=!1,a=void 0,s=!1,c=!1,u=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?function(e){var t;try{var n=xt(e,a);t=new URL(n).hostname}catch(e){null==a||a.error("Could not parse URL: ",e)}return t}(e):void 0;if(!r)return Ho.Direct;var i=n.some((function(e){return-1!==t.indexOf(e)})),o=n.some((function(e){return-1!==r.indexOf(e)}));return t===r||o&&i?Ho.Internal:Ho.External},l=function(){de(void 0,void 0,void 0,(function(){var e,t,n,r,a;return fe(this,(function(s){switch(s.label){case 0:return i&&o?[4,i.get(Xo)]:[3,3];case 1:return e=s.sent(),t=xt("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[Yo])||"",r=void 0,r=t===n?(null==e?void 0:e[Qo])||"":n||document.referrer||"",[4,i.set(Xo,(a={},a[Yo]=t,a[Qo]=r,a))];case 2:s.sent(),s.label=3;case 3:return[2]}}))}))},d={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return de(void 0,void 0,void 0,(function(){return fe(this,(function(t){switch(t.label){case 0:return(a=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),c=!0,r?[4,(i=new Mt(r.sessionStorage)).isEnabled()]:[3,2];case 1:o=t.sent(),r.addEventListener("popstate",l),s||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=ge(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),c&&l()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=ge(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),c&&l()}}),s=!0),t.label=2;case 2:return[2]}}))}))},execute:function(e){return de(void 0,void 0,void 0,(function(){var t,n,r,a,s;return fe(this,(function(c){switch(c.label){case 0:return t=xt("undefined"!=typeof location&&location.href||""),i&&o?[4,i.get(Xo)]:[3,5];case 1:return(null==(n=c.sent())?void 0:n[Yo])?[3,3]:[4,i.set(Xo,(s={},s[Yo]=t,s[Qo]=document.referrer||"",s))];case 2:c.sent(),c.label=3;case 3:return[4,i.get(Xo)];case 4:if(r=c.sent(),a="",r&&(a=r[Qo]||""),Zo.has(e.event_type))return[2,e];e.event_properties=ue(ue({},e.event_properties||{}),{"[Amplitude] Page Domain":ta(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":ta(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":ta(e,"[Amplitude] Page Path","undefined"!=typeof location&&xt(location.pathname)||""),"[Amplitude] Page Title":ta(e,"[Amplitude] Page Title",Ln(Dn)),"[Amplitude] Page URL":ta(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":a,"[Amplitude] Previous Page Type":u(a)}),c.label=5;case 5:return[2,e]}}))}))},teardown:function(){return de(void 0,void 0,void 0,(function(){return fe(this,(function(e){switch(e.label){case 0:return r&&(r.removeEventListener("popstate",l),c=!1),i&&o?[4,i.set(Xo,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}};return d};function ta(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var na=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return ae(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),Ge(this._init(ue(ue({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,o;return de(this,void 0,void 0,(function(){var a,s,c,u,l,d,f,p,g,h=this;return fe(this,(function(v){switch(v.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Vr(t.apiKey,t,this)]);case 1:return a=v.sent(),a.remoteConfig&&a.remoteConfig.fetchRemoteConfig?(s=new tn(a.apiKey,a.loggerProvider,a.serverZone,null===(n=a.remoteConfig)||void 0===n?void 0:n.serverUrl),[4,new Promise((function(e){null==s||s.subscribe("configs.analyticsSDK.browserSDK","all",(function(t,n,r){a.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&ui(t,a),e()}))}))]):[3,4];case 2:return v.sent(),[4,new Promise((function(e){null==s||s.subscribe("configs.diagnostics.browserSDK","all",(function(t,n,r){if(a.loggerProvider.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(a.diagnosticsSampleRate=i);var o=t.enabled;"boolean"==typeof o&&(a.enableDiagnostics=o)}e()}))}))];case 3:v.sent(),v.label=4;case 4:return(c=new Qt(a.apiKey,a.loggerProvider,a.serverZone,{enabled:a.enableDiagnostics,sampleRate:a.diagnosticsSampleRate})).setTag("library","".concat(Tr,"/").concat(br)),c.setTag("user_agent",navigator.userAgent),[4,e.prototype._init.call(this,a)];case 5:return v.sent(),this.logBrowserOptions(a),this.config.diagnosticsClient=c,this.config.remoteConfigClient=s,sr(this.config.defaultTracking)?(y=this.config,u=sr(y.defaultTracking)&&y.defaultTracking&&"object"==typeof y.defaultTracking&&y.defaultTracking.attribution&&"object"==typeof y.defaultTracking.attribution?ue({},y.defaultTracking.attribution):{},this.webAttribution=new Wo(u,this.config),[4,this.webAttribution.init()]):[3,7];case 6:v.sent(),v.label=7;case 7:return l=At(),d=l.ampTimestamp?Number(l.ampTimestamp):void 0,f=!d||Date.now()<d,p=f&&!Number.isNaN(Number(l.ampSessionId))?Number(l.ampSessionId):void 0,this.setSessionId(null!==(o=null!==(i=null!==(r=t.sessionId)&&void 0!==r?r:p)&&void 0!==i?i:this.config.sessionId)&&void 0!==o?o:Date.now()),(g=St(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,9]:[4,this.add(ai()).promise];case 8:v.sent(),v.label=9;case 9:return[4,this.add(new dt({diagnosticsClient:c})).promise];case 10:return v.sent(),[4,this.add(new wr).promise];case 11:return v.sent(),[4,this.add(new Et).promise];case 12:return v.sent(),function(e){oi||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),oi=!0)}(this.config),m=this.config.defaultTracking,ar(m,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(ii()).promise]):[3,14];case 13:v.sent(),v.label=14;case 14:return function(e){return ar(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(ti()).promise]):[3,16];case 15:v.sent(),v.label=16;case 16:return cr(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Qr(vr(this.config))).promise]):[3,18];case 17:v.sent(),v.label=18;case 18:return dr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Fi(pr(this.config),{diagnosticsClient:c})).promise]):[3,20];case 19:v.sent(),v.label=20;case 20:return fr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Gi(gr(this.config))).promise]):[3,22];case 21:v.sent(),v.label=22;case 22:return lr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(ro(hr(this.config))).promise]):[3,24];case 23:v.sent(),v.label=24;case 24:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(zo()).promise]):[3,26];case 25:v.sent(),v.label=26;case 26:return function(e){return ar(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(ea()).promise]):[3,28];case 27:v.sent(),v.label=28;case 28:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 29:return v.sent(),g.eventBridge.setEventReceiver((function(e){var t=e.eventProperties||{},n=t.time,r=le(t,["time"]),i="number"==typeof n?{time:n}:void 0;h.track(e.eventType,r,i)})),[2]}var m,y}))}))},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){St(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){St(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(He()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),Ge(Promise.resolve());if(e===this.config.sessionId)return Ge(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,ur(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Nr,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var a=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(Ve(this.config.identify)).promise),ur(this.config.defaultTracking)&&n.push(this.track(Lr,void 0,{event_id:a?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,Ge(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Jr(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(yr(t)){var r=t._q;t._q=[],t=mr(new je,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(yr(r)){var o=r._q;r._q=[],r=mr(new je,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(yr(t)){var r=t._q;t._q=[],t=mr(new We,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return de(this,void 0,void 0,(function(){var n,r,i;return fe(this,(function(o){return n=Date.now(),r=_t(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Lr||t.event_type===Nr||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),t.event_type===ce.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]}))}))},t.prototype.logBrowserOptions=function(e){try{var t=ue(ue({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(Je),ra=function(){var e=new na;return{init:ut(e.init.bind(e),"init",at(e),ct(e,["config"])),add:ut(e.add.bind(e),"add",at(e),ct(e,["config.apiKey","timeline.plugins"])),remove:ut(e.remove.bind(e),"remove",at(e),ct(e,["config.apiKey","timeline.plugins"])),track:ut(e.track.bind(e),"track",at(e),ct(e,["config.apiKey","timeline.queue.length"])),logEvent:ut(e.logEvent.bind(e),"logEvent",at(e),ct(e,["config.apiKey","timeline.queue.length"])),identify:ut(e.identify.bind(e),"identify",at(e),ct(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ut(e.groupIdentify.bind(e),"groupIdentify",at(e),ct(e,["config.apiKey","timeline.queue.length"])),setGroup:ut(e.setGroup.bind(e),"setGroup",at(e),ct(e,["config.apiKey","timeline.queue.length"])),revenue:ut(e.revenue.bind(e),"revenue",at(e),ct(e,["config.apiKey","timeline.queue.length"])),flush:ut(e.flush.bind(e),"flush",at(e),ct(e,["config.apiKey","timeline.queue.length"])),getUserId:ut(e.getUserId.bind(e),"getUserId",at(e),ct(e,["config","config.userId"])),setUserId:ut(e.setUserId.bind(e),"setUserId",at(e),ct(e,["config","config.userId"])),getDeviceId:ut(e.getDeviceId.bind(e),"getDeviceId",at(e),ct(e,["config","config.deviceId"])),setDeviceId:ut(e.setDeviceId.bind(e),"setDeviceId",at(e),ct(e,["config","config.deviceId"])),reset:ut(e.reset.bind(e),"reset",at(e),ct(e,["config","config.userId","config.deviceId"])),getSessionId:ut(e.getSessionId.bind(e),"getSessionId",at(e),ct(e,["config"])),setSessionId:ut(e.setSessionId.bind(e),"setSessionId",at(e),ct(e,["config"])),extendSession:ut(e.extendSession.bind(e),"extendSession",at(e),ct(e,["config"])),setOptOut:ut(e.setOptOut.bind(e),"setOptOut",at(e),ct(e,["config"])),setTransport:ut(e.setTransport.bind(e),"setTransport",at(e),ct(e,["config"])),getIdentity:ut(e.getIdentity.bind(e),"getIdentity",at(e),ct(e,["config"])),getOptOut:ut(e.getOptOut.bind(e),"getOptOut",at(e),ct(e,["config"])),_setDiagnosticsSampleRate:ut(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",at(e),ct(e,["config"]))}},ia=ra(),oa=Object.freeze({__proto__:null,DEFAULT_ACTION_CLICK_ALLOWLIST:on,DEFAULT_CSS_SELECTOR_ALLOWLIST:nn,DEFAULT_DATA_ATTRIBUTE_PREFIX:rn,get IdentifyOperation(){return se},get LogLevel(){return Ye},OfflineDisabled:null,get RevenueProperty(){return Fe},get ServerZone(){return bt},get SpecialEventType(){return ce}}),aa=ia.add,sa=ia.extendSession,ca=ia.flush,ua=ia.getDeviceId,la=ia.getIdentity,da=ia.getOptOut,fa=ia.getSessionId,pa=ia.getUserId,ga=ia.groupIdentify,ha=ia.identify,va=ia.init,ma=ia.logEvent,ya=ia.remove,ba=ia.reset,Ta=ia.revenue,wa=ia.setDeviceId,ka=ia.setGroup,Sa=ia.setOptOut,Ea=ia.setSessionId,_a=ia.setTransport,Ia=ia.setUserId,Pa=ia.track,Aa=ia._setDiagnosticsSampleRate,Oa=Object.freeze({__proto__:null,AmplitudeBrowser:na,Identify:je,Revenue:We,Types:oa,_setDiagnosticsSampleRate:Aa,add:aa,createInstance:ra,extendSession:sa,flush:ca,getDeviceId:ua,getIdentity:la,getOptOut:da,getSessionId:fa,getUserId:pa,groupIdentify:ga,identify:ha,init:va,logEvent:ma,remove:ya,reset:ba,revenue:Ta,runQueuedFunctions:function(e,t){mr(e,t)},setDeviceId:wa,setGroup:ka,setOptOut:Sa,setSessionId:Ea,setTransport:_a,setUserId:Ia,track:Pa});function Ra(e,t){if(!k.getDebugMode())return;const n=["[Qonto Embed SDK]",e];console.log(...n)}class xa{constructor(){this.isInitialized=!1}static getInstance(){return xa.instance||(xa.instance=new xa),xa.instance}initialize(){if(this.isInitialized||a())return;const e=y.getEnvironment()||"production",t=e===s.PRODUCTION?"52c120d2f5c89ca646fae6649a1ce7ad":"373aa80c38e5bc2a55895a96c8447fef";if(t)try{if(!Oa||"function"!=typeof va)throw new Error("Analytics SDK module not available");const n={defaultTracking:{sessions:!1,pageViews:!1,formInteractions:!1,fileDownloads:!1},logLevel:e!==s.PRODUCTION?Ye.Debug:Ye.None};va(t,void 0,n),this.isInitialized=!0,this.track(re)}catch(e){console.error("Failed to initialize analytics tracking:",e)}else Ra("No tracking client will be initialized due to missing API key")}isEnabled(){return this.isInitialized}track(e,t){if(this.isInitialized)try{Pa(e,t)}catch(e){console.error("Failed to track analytics event:",e)}}reset(){if(this.isInitialized)try{ba()}catch(e){console.error("Failed to reset analytics:",e)}}}const Ca=xa.getInstance();function Da(e,t){Ca.track(e,t)}const La=e=>{Da(ie,e)};class Na extends r{constructor(e){super(),this.name="EmbedOperationError",this.message=e}}async function Ua({proxyFunction:e,networkCallDescriptor:t,proxyEndpointDescriptor:n}){if(n){const e={...Object.fromEntries([...E(t.options?.headers)??{}])},r=I({...t,options:{...t.options,headers:e}}),i=await fetch(n.path,{method:n.method,headers:n.options.headers,body:r}),o=P(await i.text());if(!i.ok)throw new S({code:i.status,data:o,message:`Error from proxy endpoint: ${i.status} ${i.statusText}`});return o}if(e){const n=Object.fromEntries([...E(t.options?.headers)??{}]),r=I({...t,options:{...t.options,headers:n}});return P(await e(r))}throw new Na("No proxy function or proxy endpoint descriptor provided for proxy call.")}var ja;function Ma(e){return{id:e.id,nickname:e.nickname,embossedName:e.embossed_name,status:e.status,maskPan:e.mask_pan,expMonth:parseInt(e.exp_month,10),expYear:parseInt(e.exp_year,10),lastActivityAt:new Date(e.last_activity_at),lastDigits:e.last_digits,shipToBusiness:e.ship_to_business,atmOption:e.atm_option,atmDailyLimitOption:e.atm_daily_limit_option,nfcOption:e.nfc_option,onlineOption:e.online_option,foreignOption:e.foreign_option,atmMonthlyLimit:e.atm_monthly_limit,atmMonthlySpent:e.atm_monthly_spent,atmDailyLimit:e.atm_daily_limit,atmDailySpent:e.atm_daily_spent,paymentMonthlyLimit:e.payment_monthly_limit,paymentMonthlySpent:e.payment_monthly_spent,paymentDailyLimit:e.payment_daily_limit,paymentDailySpent:e.payment_daily_spent,paymentDailyLimitOption:e.payment_daily_limit_option,paymentTransactionLimit:e.payment_transaction_limit,paymentTransactionLimitOption:e.payment_transaction_limit_option,activeDays:e.active_days,holderId:e.holder_id,bankAccountId:e.bank_account_id,organizationId:e.organization_id,updatedAt:new Date(e.updated_at),createdAt:new Date(e.created_at),shippedAt:new Date(e.shipped_at),cardType:e.card_type,cardLevel:e.card_level,paymentLifespanLimit:e.payment_lifespan_limit,paymentLifespanSpent:e.payment_lifespan_spent,preExpiresAt:new Date(e.pre_expires_at),categories:e.categories,renewed:e.renewed,renewal:e.renewal,...e.parent_card_summary&&{parentCardSummary:{id:e.parent_card_summary.id,lastDigits:e.parent_card_summary.last_digits}},hadOperation:e.had_operation,hadPinOperation:e.had_pin_operation,cardDesign:e.card_design,typeOfPrint:e.type_of_print,upsold:e.upsold,upsell:e.upsell,discardOn:new Date(e.discard_on),reordered:e.reordered}}!function(e){e.PENDING="pending",e.ONHOLD="onhold",e.ORDER_CANCELED="order_canceled",e.LIVE="live",e.PAUSED="paused",e.STOLEN="stolen",e.LOST="lost",e.PIN_BLOCKED="pin_blocked",e.DELETED="deleted",e.PRE_EXPIRED="pre_expired",e.EXPIRED="expired",e.DISCARDED="discarded",e.SHIPPED_LOST="shipped_lost",e.ABUSIVE="abusive"}(ja||(ja={}));const qa={getCards:async function(e){La();const t=e?.cardSettings?.membershipId;if(t&&"string"!=typeof t)throw new x("membershipId must be a string");const{accessToken:n,stagingToken:r}=e?.operationSettings||{},i=n||o(),a=await async function({membershipId:e,accessToken:t,stagingToken:n}){const r=function({membershipId:e,accessToken:t,stagingToken:n}){return{path:e?`/v2/cards?holder_ids[]=${e}`:"/v2/cards",options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}({membershipId:e,accessToken:t,stagingToken:n}),{cards:i}=await _(r);return i}({membershipId:t,accessToken:i,stagingToken:r});return a.map((e=>Ma(e)))},getCard:async function({cardSettings:e,operationSettings:t}){!function(e){if(!e)throw new x("cardSettings parameter is required for the called function");if(!e.cardId)throw new x("cardId parameter is required for the called function");const t=D({cardId:e.cardId});if(t.length>0)throw new x(t)}(e);const n=e.cardId,{accessToken:r,stagingToken:i}=t||{},a=r||o(),s=await async function({cardId:e,accessToken:t,stagingToken:n}){const r=function({cardId:e,accessToken:t,stagingToken:n}){return{path:`/v2/cards?ids[]=${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}({cardId:e,accessToken:t,stagingToken:n}),{cards:i}=await _(r);return i[0]}({cardId:n,accessToken:a,stagingToken:i});return Ma(s)}},Fa=e=>({id:e?.id,slug:e.slug,iban:e.iban,bic:e.bic,currency:e.currency,balance:parseFloat(e.balance),balanceCents:e.balance_cents,authorizedBalance:e.authorized_balance,authorizedBalanceCents:e.authorized_balance_cents,name:e.name,updatedAt:new Date(e.updated_at),status:e.status,main:e.main}),Ba={getOrganization:async({operationSettings:e}={})=>{const{accessToken:t,stagingToken:n}=e||{},r=t||o(),i=await(async({accessToken:e,stagingToken:t})=>{const n=(({accessToken:e,stagingToken:t})=>({path:"/v2/organization/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}))({accessToken:e,stagingToken:t});return await _(n)})({accessToken:r,stagingToken:n});return{id:(a=i.organization).id,slug:a.slug,legalName:a.legal_name,legalNumber:a.legal_number,legalSector:a.legal_sector,legalRegistrationDate:a.legal_registration_date,legalAddress:a.legal_address,legalForm:a.legal_form,legalCountry:a.legal_country,legalShareCapital:a.legal_share_capital,locale:a.locale,contractSignedAt:a.contract_signed_at,bankAccounts:a.bank_accounts.map(Fa)};var a},getBankAccounts:async({operationSettings:e}={})=>{const{accessToken:t,stagingToken:n}=e||{},r=t||o(),i=await(async({accessToken:e,stagingToken:t})=>{const n=(({accessToken:e,stagingToken:t})=>({path:"/v2/bank_accounts/",options:{method:"GET",headers:{accessToken:e,stagingToken:t}}}))({accessToken:e,stagingToken:t});return await _(n)})({accessToken:r,stagingToken:n});return i.bank_accounts.map(Fa)}},$a={AED:"AED",AUD:"AUD",BGN:"BGN",CAD:"CAD",CHF:"CHF",CNY:"CNY",CZK:"CZK",DKK:"DKK",EUR:"EUR",GBP:"GBP",GHS:"GHS",HKD:"HKD",HUF:"HUF",ILS:"ILS",INR:"INR",MXN:"MXN",NOK:"NOK",NZD:"NZD",PEN:"PEN",PLN:"PLN",RON:"RON",RSD:"RSD",SAR:"SAR",SEK:"SEK",SGD:"SGD",TRY:"TRY",USD:"USD",ZAR:"ZAR",ZMW:"ZMW"},Ka=e=>{if(!(e=>Object.values($a).includes(e))(e))throw new x(`currency ${e} is not valid, valid currencies are ${Object.values($a).join(", ")}`)},Ha={GOOD:"good",SERVICE:"service"},za={UNIT:"unit",HOUR:"hour",DAY:"day",MONTH:"month",GRAM:"gram",KILOGRAM:"kilogram",LITER:"liter",METER:"meter",SQUARE_METER:"square_meter",CUBIC_METER:"cubic_meter",AMPERE:"ampere",NUMBER_OF_ARTICLES:"number_of_articles",CENTIMETER:"centimeter",CUBIC_METER_PER_HOUR:"cubic_meter_per_hour",GIGAJOULE:"gigajoule",GIGAWATT:"gigawatt",GIGAWATT_HOUR:"gigawatt_hour",HALF_YEAR:"half_year",JOULE:"joule",KILOJOULE:"kilojoule",KILOVAR:"kilovar",KILOWATT:"kilowatt",KILOWATT_HOUR:"kilowatt_hour",MEGAJOULE:"megajoule",MEGAWATT:"megawatt",MEGAWATT_HOUR:"megawatt_hour",MILLIGRAM:"milligram",MILLILITER:"milliliter",MILLIMETER:"millimeter",MINUTE:"minute",PAIR:"pair",QUARTER:"quarter",SECOND:"second",SET:"set",TON:"ton",TWO_WEEK:"two_week",WATT_HOUR:"watt_hour",WEEK:"week",YEAR:"year"},Va=e=>{if(!(e=>Object.values(za).includes(e))(e))throw new x(`unit ${e} is not valid, valid units are ${Object.values(za).join(", ")}`)},Ga=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],Ja=[{name:"currency"},{name:"value"}];const Wa=e=>{if(!Object.values(Ha).includes(e))throw new x(`type ${e} is not valid, valid types are ${Object.values(Ha).join(", ")}`)};const Ya={getPaymentLinkCreationFlowUrl:async({paymentLinkSettings:e,operationSettings:t})=>{const{items:n}=e;!function(e){if(!e||!Array.isArray(e))return[];e.forEach((e=>{C(e,Ga),C(e.unitPrice,Ja);const t=[...D({id:e.id,title:e.title,vatRate:e.vatRate,currency:e.unitPrice.currency,measureUnit:e.measureUnit,unitPrice:e.unitPrice.value,...e.description?{description:e.description}:{}}),...L({quantity:e.quantity})].flat();if(t.length>0)throw new x(t);Wa(e.type),Ka(e.unitPrice.currency),Va(e.measureUnit)}))}(n);const r=function(e){if(!e?.callbackUrl)throw new x("callbackUrl parameter is required for the payment link creation flow");if("string"!=typeof e.callbackUrl)throw new x("callbackUrl must be a string");if(""===e.callbackUrl.trim())throw new x("callbackUrl cannot be empty");return e.callbackUrl}(e),i=await U({requestSettings:{action:f.PAYMENT_LINK_CREATE,callbackUrl:r},operationSettings:t}),o=new URLSearchParams({...n?{items:JSON.stringify(n)}:{}});return o.toString()?`${i.url}?${o.toString()}`:i.url}};function Qa(e){return{id:e.id,initiatorId:e.initiator_id,bankAccountId:e.bank_account_id,amount:Number(e.amount),amountCents:Number(e.amount_cents),amountCurrency:e.amount_currency,status:e.status,beneficiaryId:e.beneficiary_id,reference:e.reference,note:e.note,declinedReason:e.declined_reason,scheduledDate:new Date(e.scheduled_date),createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),processedAt:new Date(e.processed_at),completedAt:new Date(e.completed_at),transactionId:e.transaction_id}}function Xa(e){return{name:e.name,iban:e.iban}}const Za="/v2/sepa",es=`${Za}/transfers`;async function ts({accessToken:e,stagingToken:t,paginationSettings:n}){const r=function({paginationSettings:e,accessToken:t,stagingToken:n}){const r={method:"GET",headers:{accessToken:t,stagingToken:n}},i=M(e),o=i.size?`?${i.toString()}`:"";return{path:`${es}${o}`,options:r}}({paginationSettings:n,accessToken:e,stagingToken:t}),{transfers:i,meta:o}=await _(r);return{transfers:i,meta:o}}async function ns({accessToken:e,stagingToken:t,sepaTransferId:n}){const r=function({sepaTransferId:e,accessToken:t,stagingToken:n}){return{path:`${es}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}({sepaTransferId:n,accessToken:e,stagingToken:t}),{transfer:i}=await _(r);return i}async function rs({transfer:e,vopProofToken:t,accessToken:n,stagingToken:r,scaSessionToken:i,idempotencyKey:o}){const a=function({transfer:e,vopProofToken:t,accessToken:n,stagingToken:r,scaSessionToken:i,idempotencyKey:o}){const a=function(e){const t=e.beneficiaryId||e.beneficiary?.id;return{bank_account_id:e.bankAccountId,beneficiary_id:t,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentIds?{attachment_ids:e.attachmentIds}:{}}}(e);return{path:es,options:{method:"POST",headers:{accessToken:n,stagingToken:r,scaSessionToken:i,idempotencyKey:o},body:{transfer:a,vop_proof_token:t}}}}({transfer:e,vopProofToken:t,accessToken:n,stagingToken:r,scaSessionToken:i,idempotencyKey:o}),{transfer:s}=await _(a);return s}async function is({sepaTransferId:e,accessToken:t,stagingToken:n}){const r=function({sepaTransferId:e,accessToken:t,stagingToken:n}){return{path:`${es}/${e}/cancel`,options:{method:"POST",headers:{accessToken:t,stagingToken:n}}}}({sepaTransferId:e,accessToken:t,stagingToken:n});await _(r)}async function os({sepaPayee:e,accessToken:t,stagingToken:n}){const r=function({sepaPayee:e,accessToken:t,stagingToken:n}){return{path:`${Za}/verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{beneficiary_name:e.name,iban:e.iban}}}}({sepaPayee:e,accessToken:t,stagingToken:n});return await _(r)}function as(e){return{id:e.id,initiatorId:e.initiator_id,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),totalCount:Number(e.total_count),completedCount:Number(e.completed_count),failedCount:Number(e.failed_count),pendingCount:Number(e.pending_count),results:e.results.map((e=>({clientTransferId:e.client_transfer_id,transferId:e.transfer_id??null,errors:e.errors||null,status:e.status})))}}function ss(e){return{id:e.id,response:{matchResult:e.response.match_result,matchedName:e.response.matched_name}}}const cs="/v2/sepa/bulk_transfers";async function us({accessToken:e,stagingToken:t,paginationSettings:n}){const r=function({paginationSettings:e,accessToken:t,stagingToken:n}){const r={method:"GET",headers:{accessToken:t,stagingToken:n}},i=M(e),o=i.size?`?${i.toString()}`:"";return{path:`${cs}${o}`,options:r}}({paginationSettings:n,accessToken:e,stagingToken:t}),{bulk_transfers:i,meta:o}=await _(r);return{bulkTransfers:i,meta:o}}async function ls({accessToken:e,stagingToken:t,bulkTransferId:n}){const r=function({bulkTransferId:e,accessToken:t,stagingToken:n}){return{path:`${cs}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}({bulkTransferId:n,accessToken:e,stagingToken:t}),{bulk_transfer:i}=await _(r);return i}async function ds({sepaPayees:e,accessToken:t,stagingToken:n}){const r=function({sepaPayees:e,accessToken:t,stagingToken:n}){return{path:`${Za}/bulk_verify_payee`,options:{method:"POST",headers:{accessToken:t,stagingToken:n},body:{requests:e.map(Xa)}}}}({sepaPayees:e,accessToken:t,stagingToken:n});return await _(r)}function fs(e){if(!e)throw new x("bulkTransferSettings parameter is required for the called function.");if(!e.bankAccountId)throw new x("bankAccountId is required");if(!Array.isArray(e.bulkTransfers))throw new x("bulkTransfers must be an array");if(e.bulkTransfers.length>400)throw new x("Maximum of 400 bulk transfers allowed");return e.bulkTransfers.forEach(((e,t)=>{!function(e,t){if(!e)throw new x(`Invalid bulkTransfer at index ${t}: bulkTransfer object is required`);if(!e.beneficiary)throw new x(`Invalid bulkTransfer at index ${t}: Beneficiary details must be provided in the bulkTransferSettings.beneficiary field`);if(!e.beneficiary.iban)throw new x(`Invalid bulkTransfer at index ${t}: IBAN is required as part of the beneficiary details`);if(!e.beneficiary.name)throw new x(`Invalid bulkTransfer at index ${t}: Beneficiary name is required as part of the beneficiary details`);const n=D({reference:e.reference,clientTransferId:e.clientTransferId,note:e.note}),r=L({amount:e.amount}),i=[...n,...r].flat();if(i.length>0)throw new x(i);if(e.amount>l&&(!e.attachmentsIds||0===e.attachmentsIds.length))throw new x(`Invalid bulkTransfer at index ${t}: Attachments are required for transfers over €30000`)}(e,t)})),e}const ps={requiresUI:!1};function gs(e,{requiresUI:t}=ps){const n=e?.uiParentElementId||k.getUIParentElementId();if(t){if(!n)throw new x("operationSettings parameter must have a uiParentElementId for the called function.\nYou can pass it either to the initialize function or in a per function basis.");if(!["string","function"].includes(typeof n))throw new x("operationSettings.uiParentElementId must be a string or a function returning an HTMLElement")}const r=e?.mfaPreference||k.getMFAPreference();if(r){const e=(i=Object.values(u),y.isProductionEnvironment()?i.filter((e=>e!==u.MOCK)):i);if(!e.includes(r))throw new x(`operationSettings.mfaPreference must be one of ${e.join(", ")}`);if(y.isProductionEnvironment()&&r===u.MOCK)throw new x("operationSettings.mfaPreference cannot be set to mock in production environment.")}var i;const o=e?.debugMode||k.getDebugMode();if(void 0!==o&&"boolean"!=typeof o)throw new x("operationSettings.debugMode must be a boolean.");const a=e?.proxyRequestFunction||k.getProxyRequestFunction();if(a&&"function"!=typeof a)throw new x("operationSettings.proxyRequestFunction must be a function.");const s=e?.proxyEndpointDescriptor||k.getProxyEndpointDescriptor();if(s&&!s.path)throw new x("operationSettings.proxyEndpointDescriptor must have at least a string-formatted path property.");return{...e,uiParentElementId:n,mfaPreference:r,debugMode:o,proxyRequestFunction:a,proxyEndpointDescriptor:s}}async function hs({sepaTransferSettings:e,operationSettings:t}){return e?.beneficiary?e.beneficiary:await async function({beneficiarySettings:e,operationSettings:t}){const n=te(e?.beneficiaryId),{proxyRequestFunction:r,proxyEndpointDescriptor:i,accessToken:a,stagingToken:s}=gs(t||{});if(r||i){const e=W({beneficiaryId:n});return z((await Ua({proxyFunction:r,proxyEndpointDescriptor:i,networkCallDescriptor:e})).body.beneficiary)}{const e=a||o();return z(await Y({beneficiaryId:n,accessToken:e,stagingToken:s}))}}({beneficiarySettings:{beneficiaryId:e?.beneficiaryId},operationSettings:t})}function vs(e,t){const n=t?.locale||T.getLocale(),r=new URL(e);return n&&r.searchParams.append("lang",n),t?.mfaPreference&&r.searchParams.append("mfaPreference",t.mfaPreference),t?.idempotencyKey&&r.searchParams.append("idempotencyKey",t.idempotencyKey),r.toString()}const ms=[{name:"bankAccountId"},{name:"reference"},{name:"amount"}];const ys={getSepaTransfers:async function(e){const{accessToken:t,stagingToken:n,paginationSettings:r}=e?.operationSettings||{},i=t||o(),a=await ts({accessToken:i,stagingToken:n,paginationSettings:r}),s=a.transfers.map(Qa),c=q(a.meta);return{transfers:s,...c?{meta:c}:{}}},getSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e)throw new x("sepaTransferId parameter is required for the called function");if(e&&"string"!=typeof e)throw new x("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:r,stagingToken:i}=t||{},a=r||o();return Qa(await ns({sepaTransferId:n,accessToken:a,stagingToken:i}))},createSepaTransfer:async function*({sepaTransferSettings:e,operationSettings:t}){const{accessToken:n,stagingToken:r,scaSessionToken:i,idempotencyKey:a}=t||{},s=n||o(),c=a||H();!function(e){if(!e)throw new x("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new x("sepaTransferSettings must be an object");if(!e.beneficiaryId&&!e.beneficiary)throw new x("Either beneficiaryId or beneficiary must be provided");const t=D({beneficiaryId:e.beneficiaryId});if(t.length>0)throw new x(t)}(e);const u=e?.beneficiary?e.beneficiary:await hs({sepaTransferSettings:e,operationSettings:t}),f={name:u.name,iban:u.iban},p=await os({sepaPayee:f,accessToken:s,stagingToken:r}),g=yield(h=p,{matchResult:h.match_result,matchedName:h.matched_name});var h;let v;if("string"==typeof g){if(g===d)return}else{if(g.vopDecision===d)return;v=g.sepaTransferSettings}const m={...e,...v};!function(e){if(!e)throw new x("sepaTransferSettings parameter is required for the called function");if("object"!=typeof e)throw new x("sepaTransferSettings must be an object");C(e,ms);const t=[...D({bankAccountId:e.bankAccountId,note:e.note,reference:e.reference}),...L({amount:e.amount})].flat();if(t.length>0)throw new x(t);if(e.amount>l&&(!e.attachmentIds||0===e.attachmentIds.length))throw new x("Attachments are required for transfers over €30,000")}(m);const y={...m,beneficiary:u};return{transfer:Qa(await rs({transfer:y,vopProofToken:p.proof_token.token,accessToken:s,stagingToken:r,scaSessionToken:i,idempotencyKey:c})),meta:{idempotencyKey:c}}},cancelSepaTransfer:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e)throw new x("sepaTransferId parameter is required for the called function");if("string"!=typeof e)throw new x("sepaTransferId must be a string");return e}(e?.sepaTransferId),{accessToken:r,stagingToken:i}=t||{},a=r||o();await is({sepaTransferId:n,accessToken:a,stagingToken:i})},getSepaTransferCreationFlowLink:async function({sepaTransferSettings:e,operationSettings:t}){const n=function(e){if(!e||!e.callbackUrl)throw new x("callbackUrl parameter is required for the getSepaTransferCreationFlowLink function");if("string"!=typeof e.callbackUrl)throw new x("callbackUrl must be a string");return e.callbackUrl}(e),{accessToken:r,stagingToken:i}=t||{},a=r||o(),s=await async function({requestSettings:e,operationSettings:t}){N(e);const{proxyRequestFunction:n,proxyEndpointDescriptor:r,stagingToken:i}=gs(t||{});if(n||r){const t=A({stagingToken:i,action:e.action,callbackUrl:e.callbackUrl});return R((await Ua({proxyFunction:n,proxyEndpointDescriptor:r,networkCallDescriptor:t})).body)}{const n=t?.accessToken||o();return R(await O({accessToken:n,stagingToken:i,action:e.action,callbackUrl:e.callbackUrl}))}}({requestSettings:{action:f.SEPA_TRANSFER_CREATE,callbackUrl:n},operationSettings:{stagingToken:i,accessToken:a}});return{...s,url:vs(s.url,t)}},bulkTransfers:{getBulkTransfers:async function(e){const{accessToken:t,stagingToken:n,paginationSettings:r}=e?.operationSettings||{},i=t||o(),a=await us({accessToken:i,stagingToken:n,paginationSettings:r}),s=a.bulkTransfers?.map(as),c=q(a.meta);return{bulkTransfers:s,...c?{meta:c}:{}}},getBulkTransfer:async function({bulkTransferSettings:e,operationSettings:t}){const n=function(e){if(!e)throw new x("bulkTransferId parameter is required for the called function.");if("string"!=typeof e)throw new x("bulkTransferId must be a string.");return e}(e?.bulkTransferId),{accessToken:r,stagingToken:i}=t||{},a=r||o();return as(await ls({accessToken:a,stagingToken:i,bulkTransferId:n}))},createBulkTransfer:async function*({bulkTransferSettings:e,operationSettings:t}){const{accessToken:n,stagingToken:r,scaSessionToken:i,idempotencyKey:a}=t||{},s=n||o(),c=a||H(),u=fs(e),l=new Map;for(const e of u.bulkTransfers){const t=e.beneficiary;if(t){const e=t.iban;e&&!l.has(e)&&l.set(e,{name:t.name,iban:e})}}const f=Array.from(l.values()),p=await ds({sepaPayees:f,accessToken:s,stagingToken:r});if((yield p.requests.map(ss))===d)return;const g=await async function({bulkTransfers:e,accessToken:t,stagingToken:n,scaSessionToken:r,bankAccountId:i,idempotencyKey:o}){const a={method:"POST",headers:{...E({accessToken:t,stagingToken:n,scaSessionToken:r,idempotencyKey:o})},body:JSON.stringify({bank_account_id:i,bulk_transfers:e.map((e=>function(e){return{beneficiary_id:e.beneficiaryId||e.beneficiary?.id,client_transfer_id:e.clientTransferId,amount:e.amount.toString(),reference:e.reference,...e.note?{note:e.note}:{},...e.scheduledDate?{scheduled_date:e.scheduledDate.toISOString().split("T")[0]}:{},...e.attachmentsIds?{attachment_ids:e.attachmentsIds}:{}}}(e)))})},s=new URL(`${y.getEnvironmentUrls().THIRD_PARTY_API_URL}${cs}`),c=await fetch(s,a),u=await c.json();if(!c.ok||u.errors)throw new S({message:u.errors?u.errors.map((e=>`${e.code}: ${e.detail}`)).join(", "):"Failed to create SEPA bulk transfer"});return u.bulk_transfer}({bulkTransfers:u.bulkTransfers,bankAccountId:u.bankAccountId,accessToken:s,stagingToken:r,scaSessionToken:i,idempotencyKey:c});return{bulkTransfer:as(g),meta:{idempotencyKey:c}}}}},bs="/v2/transactions";async function Ts(e){const t=function({bankAccountId:e,iban:t,status:n,updatedAtFrom:r,updatedAtTo:i,emittedAtFrom:o,emittedAtTo:a,settledAtFrom:s,settledAtTo:c,side:u,operationType:l,withAttachments:d,paginationSettings:f,accessToken:p,stagingToken:g}){const h={method:"GET",headers:{accessToken:p,stagingToken:g}},v=new URLSearchParams;e&&v.append("bank_account_id",e),t&&v.append("iban",t),n&&v.append("status",n),r&&v.append("updated_at_from",r),i&&v.append("updated_at_to",i),o&&v.append("emitted_at_from",o),a&&v.append("emitted_at_to",a),s&&v.append("settled_at_from",s),c&&v.append("settled_at_to",c),u&&v.append("side",u),l&&v.append("operation_type",l),void 0!==d&&v.append("with_attachments",String(d));const m=M(f);for(const[e,t]of m)v.append(e,t);const y=v.toString();return{path:`${bs}${y?`?${y}`:""}`,options:h}}(e),{transactions:n,meta:r}=await _(t);return{transactions:n,meta:r}}async function ws(e){const t=function({transactionId:e,accessToken:t,stagingToken:n}){return{path:`${bs}/${e}`,options:{method:"GET",headers:{accessToken:t,stagingToken:n}}}}(e),{transaction:n}=await _(t);return n}function ks(e){return{transactionId:e.transaction_id,amount:e.amount,amountCents:e.amount_cents,settledBalance:e.settled_balance,settledBalanceCents:e.settled_balance_cents,attachmentIds:e.attachment_ids,localAmount:e.local_amount,localAmountCents:e.local_amount_cents,side:e.side,operationType:e.operation_type,currency:e.currency,localCurrency:e.local_currency,label:e.label,settledAt:new Date(e.settled_at),emittedAt:new Date(e.emitted_at),updatedAt:new Date(e.updated_at),status:e.status,note:e.note,reference:e.reference,vatAmount:e.vat_amount,vatAmountCents:e.vat_amount_cents,vatRate:e.vat_rate,initiatorId:e.initiator_id,labelIds:e.label_ids,attachmentLost:e.attachment_lost,attachmentRequired:e.attachment_required,cardLastDigits:e.card_last_digits,category:e.category,cashflowCategory:{name:e.cashflow_category?.name||""},cashflowSubcategory:{name:e.cashflow_subcategory?.name||""},id:e.id,subjectType:e.subject_type,...e.transfer?{transfer:{counterpartyAccountNumber:e.transfer.counterparty_account_number,counterpartyName:e.transfer.counterparty_name,counterpartyBic:e.transfer.counterparty_bic,counterpartyIban:e.transfer.counterparty_iban}}:{}}}const Ss={getTransactions:async function(e){const{accessToken:t,stagingToken:n,paginationSettings:r}=e?.operationSettings||{},i={...e?.transactionSettings||{},paginationSettings:r},a=t||o(),s=await Ts({...i,accessToken:a,stagingToken:n});return{transactions:s.transactions.map(ks),meta:q(s.meta)}},getTransaction:async function({transactionSettings:e,operationSettings:t}){const{accessToken:n,stagingToken:r}=t||{},{transactionId:i}=function(e){if(!e)throw new x("transactionSettings parameter is required for the called function");if(!e.transactionId)throw new x("transactionSettings.transactionId parameter is required for the called function");if(e.transactionId&&"string"!=typeof e.transactionId)throw new x("transactionSettings.transactionId must be a string.");return e}(e),a=n||o();return ks(await ws({transactionId:i,accessToken:a,stagingToken:r}))}};e.authLinks=j,e.beneficiaries=ne,e.cards=qa,e.organizations=Ba,e.paymentLinks=Ya,e.sepaTransfers=ys,e.transactions=Ss}));