@incodetech/web 0.0.0-dev-20260608-c8c427ca → 0.0.0-dev-20260609-11ba3e8a

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 (211) hide show
  1. package/dist/ae-signature/ae-signature.es.js +15 -13
  2. package/dist/aligndevicelottie-DY_bX_p8.js +12769 -0
  3. package/dist/antifraud/antifraud.es.js +22 -19
  4. package/dist/authentication/authentication.es.js +42 -33
  5. package/dist/autoFocusTitle-DM6PvgcP.js +29 -0
  6. package/dist/{back-horizontal-hint-DsPhKbR4.js → back-horizontal-hint-BXYix0Wj.js} +26 -26
  7. package/dist/back-tutorial-vb1MxlrT.js +14597 -0
  8. package/dist/{back-vertical-hint-BFJbYQrX.js → back-vertical-hint-DNSh6JNH.js} +27 -27
  9. package/dist/backdevicelottie-HypPqBz7.js +16690 -0
  10. package/dist/base.css +5 -0
  11. package/dist/blurdevicelottie-CBXtBFiJ.js +15951 -0
  12. package/dist/bottomSheet-BuzqNQtG.js +39 -0
  13. package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
  14. package/dist/button-B-qlr4iI.js +35 -0
  15. package/dist/checkbox-CTPETqo5.js +96 -0
  16. package/dist/consent/consent.es.js +75 -64
  17. package/dist/countrySelector-CzyuaDIs.js +60 -0
  18. package/dist/cpf-ocr/cpf-ocr.es.js +2 -2
  19. package/dist/cpfOcr-DQVs3r8N.js +92 -0
  20. package/dist/cpfOcr-WNklFuxT.js +2 -0
  21. package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -17
  22. package/dist/curp-validation/curp-validation.es.js +246 -211
  23. package/dist/customFields-B4MqqDI6.js +140 -0
  24. package/dist/customWatchlist-Dfqw1DQP.js +36 -0
  25. package/dist/dateInputComposed-BsPQHG5o.js +1 -0
  26. package/dist/dateInputComposed-DY97tQVK.js +69 -0
  27. package/dist/defineProperty-mefzVtTv.js +39 -0
  28. package/dist/document-capture/document-capture.es.js +2 -2
  29. package/dist/documentCapture-BE78MIlR.js +876 -0
  30. package/dist/documentCapture-BVfNZL29.js +2 -0
  31. package/dist/dropdownComposed-BF4L-7mJ.js +380 -0
  32. package/dist/dropdownComposed-mvHuRFHn.js +1 -0
  33. package/dist/dynamicForms-BYGGAQoc.js +352 -0
  34. package/dist/ekyb/ekyb.es.js +2 -2
  35. package/dist/ekybModule-BUPX0QhW.js +2 -0
  36. package/dist/ekybModule-CkTXu-4u.js +279 -0
  37. package/dist/ekyc/ekyc.es.js +2 -2
  38. package/dist/ekycModule-BWsVX39d.js +257 -0
  39. package/dist/ekycModule-DNDPqvUc.js +2 -0
  40. package/dist/electronic-signature/electronic-signature.es.js +2 -2
  41. package/dist/electronic-signature-BJSyzex9.js +426 -0
  42. package/dist/email/email.es.js +198 -78
  43. package/dist/emailInput-BHp4Apt4.js +39 -0
  44. package/dist/errorIcon-B0rmz3rw.js +26 -0
  45. package/dist/expiredId-C105HVKv.js +85 -0
  46. package/dist/extensibility-DJwVxojG.js +3070 -0
  47. package/dist/extensibility.es.js +26 -26
  48. package/dist/face-match/face-match.es.js +2 -2
  49. package/dist/faceMatch-BOFGxzzx.js +343 -0
  50. package/dist/faceMatch-CDMcFQwR.js +2 -0
  51. package/dist/field-comparison/field-comparison.es.js +2 -2
  52. package/dist/fieldComparison-BMDmQ8eA.js +88 -0
  53. package/dist/fieldComparison-Z1NleSxD.js +2 -0
  54. package/dist/{flip-animation-CuQ57qTn.js → flip-animation-BGRvygw9.js} +4221 -4221
  55. package/dist/flow/flow.es.js +597 -493
  56. package/dist/flow/styles.css +0 -8
  57. package/dist/{front-horizontal-hint-CKm7PnmS.js → front-horizontal-hint-CLSU0iVo.js} +70 -70
  58. package/dist/{front-vertical-hint-CLHC2qoH.js → front-vertical-hint-BWq-yWQ8.js} +81 -81
  59. package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
  60. package/dist/geolocation/geolocation.es.js +485 -395
  61. package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
  62. package/dist/governmentValidation/governmentValidation.es.js +145 -64
  63. package/dist/governmentValidation/styles.css +0 -36
  64. package/dist/homeScreen-BsEYyiDB.js +264 -0
  65. package/dist/hooks-BtgmGvba.js +149 -0
  66. package/dist/i18n-gTHArCl9.js +2971 -0
  67. package/dist/icons-DKY3xDkf.js +360 -0
  68. package/dist/id/id.es.js +565 -413
  69. package/dist/id-laser-h-DX8UbVNH.js +467 -0
  70. package/dist/id-laser-v-DhnHdjlB.js +490 -0
  71. package/dist/id-tutorial-lj4iKtYT.js +13165 -0
  72. package/dist/id-verification/id-verification.es.js +21 -18
  73. package/dist/idOcr-BS77o1VC.js +123 -0
  74. package/dist/identity-reuse/identity-reuse.es.js +168 -130
  75. package/dist/incode-logo-57XFniXU.js +4 -0
  76. package/dist/incodeComponent-CDJxFZvS.js +63 -0
  77. package/dist/incodeModule-DkA_yd0X.js +13 -0
  78. package/dist/index.es.js +16 -14
  79. package/dist/inputComposed-5V2nLTqH.js +99 -0
  80. package/dist/inputComposed-BPOYwUBl.js +1 -0
  81. package/dist/loadingIcon-DN62ugKs.js +148 -0
  82. package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
  83. package/dist/mandatoryConsent-DP189TUn.js +107 -0
  84. package/dist/modal-B5QeulDu.js +153 -0
  85. package/dist/modal.hooks-C7K9k_pY.js +202 -0
  86. package/dist/numberedStep-DVAyTPv1.js +13 -0
  87. package/dist/optionAccessibleLabel-Czc2YC8z.js +202 -0
  88. package/dist/otpInput-2IQ-JCK8.js +195 -0
  89. package/dist/page-BZ-0eNWq.js +71 -0
  90. package/dist/{passport-horizontal-hint-C_le0HVU.js → passport-horizontal-hint-DfVsf4Cc.js} +55 -55
  91. package/dist/{passport-tutorial-BYN4T_TE.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
  92. package/dist/{passport-vertical-hint-H-pyICSv.js → passport-vertical-hint-DVxbTyQp.js} +49 -49
  93. package/dist/pdf-BZA70WbM.js +22398 -0
  94. package/dist/pdfViewer-Dr63sJ51.js +114 -0
  95. package/dist/phone/phone.es.js +214 -87
  96. package/dist/phoneInputComposed-D_IabWKJ.js +12142 -0
  97. package/dist/processing-B_u8wUB7.js +8 -0
  98. package/dist/qe-signature/qe-signature.es.js +15 -13
  99. package/dist/radioGroupComposed-DwYW-Ld-.js +215 -0
  100. package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2099 -859
  101. package/dist/registerIncodeElement-BJJGzVdq.js +11 -0
  102. package/dist/requiredLabelHint-DEadtiwx.js +17 -0
  103. package/dist/richText-C7GUm0WL.js +3153 -0
  104. package/dist/rolldown-runtime--E5BIlTp.js +33 -0
  105. package/dist/selfie/selfie.es.js +54 -42
  106. package/dist/selfieTutorial-CtruLyO2.js +2689 -0
  107. package/dist/signature/signature.es.js +765 -406
  108. package/dist/snackbar-Dz9crm39.js +16 -0
  109. package/dist/spinner-BfBIZkDQ.js +42 -0
  110. package/dist/spinner-DEDtE7Pz.js +1 -0
  111. package/dist/statusPage-CVCoieyd.js +28 -0
  112. package/dist/successIcon-rmzr-pxu.js +30 -0
  113. package/dist/tabs--UMd6eEB.js +103 -0
  114. package/dist/transitionSpinner-CWhGcr7c.js +26 -0
  115. package/dist/{tutorial-QzQ536BL.js → tutorial-Jv0noW4z.js} +832 -578
  116. package/dist/types/extensibility.d.ts +3 -1
  117. package/dist/types/index.d.ts +13 -4
  118. package/dist/typography-BK4AmfKX.js +45 -0
  119. package/dist/uiConfig-sgEkFuuA.js +25 -0
  120. package/dist/useModuleLoader-CuhHtmgr.js +670 -0
  121. package/dist/vendor-preact-BH7vOa2r.js +957 -0
  122. package/dist/verificationResult-CJ0JyV6A.js +64 -0
  123. package/dist/verifiedByIncode-8QBn-kgZ.js +103 -0
  124. package/dist/watchlist/watchlist.es.js +31 -26
  125. package/dist/watchlistForBusiness-RZcnjVDb.js +80 -0
  126. package/dist/workflow/styles.css +0 -8
  127. package/dist/workflow/workflow.es.js +251 -209
  128. package/package.json +4 -2
  129. package/dist/aligndevicelottie-D8KsO77t.js +0 -12757
  130. package/dist/autoFocusTitle-BpYdaSUM.js +0 -16
  131. package/dist/back-tutorial-DhSE2FJo.js +0 -14585
  132. package/dist/backdevicelottie-CJWGVMdw.js +0 -16678
  133. package/dist/blurdevicelottie-Dxt2deEB.js +0 -15939
  134. package/dist/bottomSheet-QrpyatOD.js +0 -31
  135. package/dist/browser-ponyfill-Crda_c5R.js +0 -299
  136. package/dist/button-DcCUEn2n.js +0 -24
  137. package/dist/checkbox-DCCzBAuF.js +0 -86
  138. package/dist/countrySelector-CJ8egQ4C.js +0 -58
  139. package/dist/cpfOcr-Db06i-Lm.js +0 -2
  140. package/dist/cpfOcr-FixhUeMQ.js +0 -79
  141. package/dist/customFields-C1G9xHNX.js +0 -125
  142. package/dist/customWatchlist-IKEblz7u.js +0 -31
  143. package/dist/dateInputComposed-Cg8BvYSK.js +0 -1
  144. package/dist/dateInputComposed-Ddd7HLyM.js +0 -58
  145. package/dist/defineProperty-xczUyn-m.js +0 -39
  146. package/dist/documentCapture-D9I7FjGe.js +0 -2
  147. package/dist/documentCapture-b61wlala.js +0 -765
  148. package/dist/dropdownComposed-B4U0AIak.js +0 -1
  149. package/dist/dropdownComposed-CS2pyn-g.js +0 -293
  150. package/dist/dynamicForms-tYQog0kw.js +0 -298
  151. package/dist/ekybModule-C33C4JES.js +0 -237
  152. package/dist/ekybModule-LON6G2Bz.js +0 -2
  153. package/dist/ekycModule-BJOgtTAh.js +0 -225
  154. package/dist/ekycModule-BSf_DIG7.js +0 -2
  155. package/dist/electronic-signature-OdgTyso4.js +0 -406
  156. package/dist/emailInput-CU7mLB21.js +0 -37
  157. package/dist/errorIcon-DpHzAoAo.js +0 -24
  158. package/dist/expiredId-nfVAZgTL.js +0 -70
  159. package/dist/extensibility-BbNy3mVG.js +0 -2602
  160. package/dist/faceMatch-BIila4kf.js +0 -2
  161. package/dist/faceMatch-DJ7Mqujx.js +0 -206
  162. package/dist/fieldComparison-D2RSFYl-.js +0 -84
  163. package/dist/fieldComparison-DbUyouFd.js +0 -2
  164. package/dist/frontdevicelottie-65Vyfpff.js +0 -17302
  165. package/dist/glaredevicelottie-BEyaqtc6.js +0 -14466
  166. package/dist/homeScreen-CyPddxWl.js +0 -227
  167. package/dist/hooks-MxHtZWTS.js +0 -112
  168. package/dist/i18n-Kzzvkz94.js +0 -2019
  169. package/dist/icons-9I5g9-_1.js +0 -292
  170. package/dist/id-laser-h-iCPbFixz.js +0 -467
  171. package/dist/id-laser-v-CNzwliP2.js +0 -483
  172. package/dist/id-tutorial-CF4nO4oX.js +0 -13153
  173. package/dist/idOcr-DlMLMDqa.js +0 -97
  174. package/dist/incode-logo-DX016usY.js +0 -4
  175. package/dist/incodeComponent-BoFhgK7G.js +0 -50
  176. package/dist/incodeModule-BiCoAJ5k.js +0 -13
  177. package/dist/inputComposed-DAEey9xm.js +0 -94
  178. package/dist/inputComposed-eS4B0Mkh.js +0 -1
  179. package/dist/loadingIcon-BN5YRQUb.js +0 -104
  180. package/dist/lottie_light-DLqSnziX.js +0 -4419
  181. package/dist/mandatoryConsent-DNz2jZ43.js +0 -98
  182. package/dist/modal-ZqAhwiRF.js +0 -135
  183. package/dist/modal.hooks-LdusROLW.js +0 -126
  184. package/dist/numberedStep-CdLWASwL.js +0 -11
  185. package/dist/optionAccessibleLabel-DcygPaME.js +0 -140
  186. package/dist/otpInput-C4pk4BJU.js +0 -157
  187. package/dist/page-DA3R7q0J.js +0 -69
  188. package/dist/pdf-51QeiFSx.js +0 -14967
  189. package/dist/pdfViewer-rKzTHket.js +0 -64
  190. package/dist/phoneInputComposed-CjAxk2Gj.js +0 -11230
  191. package/dist/processing-DPktVde2.js +0 -6
  192. package/dist/radioGroupComposed-DRRxVk9Z.js +0 -178
  193. package/dist/registerIncodeElement-BHWOwdSS.js +0 -7
  194. package/dist/requiredLabelHint-B6FN3v88.js +0 -13
  195. package/dist/richText-6pIbydcz.js +0 -1973
  196. package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
  197. package/dist/selfieTutorial-Yo9AlUoT.js +0 -2677
  198. package/dist/snackbar-CQiiWO4p.js +0 -14
  199. package/dist/spinner-B4dcie2T.js +0 -1
  200. package/dist/spinner-CKnjVHxw.js +0 -39
  201. package/dist/statusPage-B8b3Jg6N.js +0 -28
  202. package/dist/successIcon-SlKgTSty.js +0 -28
  203. package/dist/tabs-D7lGst3Q.js +0 -78
  204. package/dist/transitionSpinner-Di3bOyOu.js +0 -17
  205. package/dist/typography-CxjaknHN.js +0 -28
  206. package/dist/uiConfig-CwpQ-IM6.js +0 -20
  207. package/dist/useModuleLoader-Bqs7fglI.js +0 -517
  208. package/dist/vendor-preact-D6SntenC.js +0 -958
  209. package/dist/verificationResult-DhT3hH1b.js +0 -90
  210. package/dist/verifiedByIncode-DpbxzO0y.js +0 -101
  211. package/dist/watchlistForBusiness-CRXVbH4l.js +0 -75
@@ -0,0 +1,670 @@
1
+ import { a as createI18n, i as setI18nInstance, n as useTranslation, r as hasI18nInstance } from "./i18n-gTHArCl9.js";
2
+ import { _ as y, l as A, p as d, v as u } from "./vendor-preact-BH7vOa2r.js";
3
+ import { t as setUiConfig } from "./uiConfig-sgEkFuuA.js";
4
+ import { t as Page } from "./page-BZ-0eNWq.js";
5
+ import { t as Button } from "./button-B-qlr4iI.js";
6
+ import { t as ErrorIcon } from "./errorIcon-B0rmz3rw.js";
7
+ import { initializeWasmUtil, resolveWasmConfig, setWasmConfig, upgradeToWasmHttpClient, warmupWasm } from "@incodetech/core/wasm";
8
+ import { getDeviceClass } from "@incodetech/core/device";
9
+ import { createOrchestratedFlowManager, getFlow, getRequiredWasmPipelines } from "@incodetech/core/flow";
10
+ import { getFinishStatus, initializeSession } from "@incodetech/core/session";
11
+ import { api } from "@incodetech/core/http";
12
+ //#region src/shared/terminalErrorPage/terminalErrorPage.tsx
13
+ /**
14
+ * Terminal error screen shown by `<incode-flow>` / `<incode-workflow>` when
15
+ * the SDK reaches an unrecoverable error state — both during initialization
16
+ * (e.g. `/omni/start` or `/omni/workflow/info` returns `4028` "not activated")
17
+ * and during the flow/workflow lifecycle (e.g. `/omni/workflow/process/node`,
18
+ * `/omni/finish-status`, or a child module's terminal error).
19
+ *
20
+ * When the error carries a backend-provided `error`/`message` (surfaced via
21
+ * `IncodeApiError.message` from core's service wrappers), it's rendered
22
+ * verbatim as the subtitle. Generic transport failures fall back to a
23
+ * translated default.
24
+ *
25
+ * Layout: `Page` is used for the Incode logo + optional "Verified by Incode"
26
+ * footer only — the title/subtitle/titleTopSlot slots are deliberately *not*
27
+ * used so we can vertically center the status block (icon + title + message)
28
+ * within the available height at every viewport size. The Try again button
29
+ * is anchored to the bottom of the content area. The screen intentionally
30
+ * has no close button — the only exit is "Try again", which delegates to
31
+ * `onRetry`.
32
+ */
33
+ var TerminalErrorPage = ({ message, onRetry }) => {
34
+ const { t } = useTranslation();
35
+ const titleRef = A(null);
36
+ y(() => {
37
+ titleRef.current?.focus();
38
+ }, []);
39
+ const handleRetry = () => {
40
+ if (onRetry) {
41
+ onRetry();
42
+ return;
43
+ }
44
+ if (typeof window !== "undefined") window.location.reload();
45
+ };
46
+ return /* @__PURE__ */ u(Page, {
47
+ className: "IncodeTerminalErrorPage",
48
+ "data-testid": "terminal-error-page",
49
+ children: /* @__PURE__ */ u("div", {
50
+ class: "IncodeTerminalErrorPageBody",
51
+ children: [/* @__PURE__ */ u("div", {
52
+ class: "IncodeTerminalErrorPageStatus",
53
+ children: [
54
+ /* @__PURE__ */ u(ErrorIcon, { size: 64 }),
55
+ /* @__PURE__ */ u("h2", {
56
+ ref: titleRef,
57
+ class: "IncodeTerminalErrorPageTitle",
58
+ tabIndex: -1,
59
+ children: t("common.somethingWentWrong")
60
+ }),
61
+ /* @__PURE__ */ u("p", {
62
+ class: "IncodeTerminalErrorPageMessage",
63
+ children: message ?? t("common.unexpectedError")
64
+ })
65
+ ]
66
+ }), /* @__PURE__ */ u("div", {
67
+ class: "IncodeTerminalErrorPageFooter",
68
+ children: /* @__PURE__ */ u(Button, {
69
+ onClick: handleRetry,
70
+ children: t("common.tryAgain")
71
+ })
72
+ })]
73
+ })
74
+ });
75
+ };
76
+ //#endregion
77
+ //#region src/styles/generatePalette.ts
78
+ function hexToHsl(hex) {
79
+ let normalizedHex = hex.replace("#", "");
80
+ if (normalizedHex.length === 3) normalizedHex = normalizedHex.split("").map((char) => char + char).join("");
81
+ const result = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(normalizedHex);
82
+ if (!result) return null;
83
+ const r = Number.parseInt(result[1], 16) / 255;
84
+ const g = Number.parseInt(result[2], 16) / 255;
85
+ const b = Number.parseInt(result[3], 16) / 255;
86
+ const max = Math.max(r, g, b);
87
+ const min = Math.min(r, g, b);
88
+ let h = 0;
89
+ let s = 0;
90
+ const l = (max + min) / 2;
91
+ if (max !== min) {
92
+ const d = max - min;
93
+ s = l > .5 ? d / (2 - max - min) : d / (max + min);
94
+ switch (max) {
95
+ case r:
96
+ h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
97
+ break;
98
+ case g:
99
+ h = ((b - r) / d + 2) / 6;
100
+ break;
101
+ case b:
102
+ h = ((r - g) / d + 4) / 6;
103
+ break;
104
+ }
105
+ }
106
+ return {
107
+ h: h * 360,
108
+ s: s * 100,
109
+ l: l * 100
110
+ };
111
+ }
112
+ function hslToHex(h, s, l) {
113
+ const hNorm = h / 360;
114
+ const sNorm = s / 100;
115
+ const lNorm = l / 100;
116
+ let r;
117
+ let g;
118
+ let b;
119
+ if (sNorm === 0) r = g = b = lNorm;
120
+ else {
121
+ const hue2rgb = (p, q, t) => {
122
+ if (t < 0) t += 1;
123
+ if (t > 1) t -= 1;
124
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
125
+ if (t < 1 / 2) return q;
126
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
127
+ return p;
128
+ };
129
+ const q = lNorm < .5 ? lNorm * (1 + sNorm) : lNorm + sNorm - lNorm * sNorm;
130
+ const p = 2 * lNorm - q;
131
+ r = hue2rgb(p, q, hNorm + 1 / 3);
132
+ g = hue2rgb(p, q, hNorm);
133
+ b = hue2rgb(p, q, hNorm - 1 / 3);
134
+ }
135
+ const toHex = (n) => {
136
+ const hex = Math.round(n * 255).toString(16);
137
+ return hex.length === 1 ? `0${hex}` : hex;
138
+ };
139
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
140
+ }
141
+ function generateBrandPalette(mainColor) {
142
+ const hsl = hexToHsl(mainColor);
143
+ if (!hsl) throw new Error(`Invalid color format: ${mainColor}`);
144
+ return {
145
+ "50": hslToHex(hsl.h, hsl.s, 95),
146
+ "200": hslToHex(hsl.h, hsl.s, 80),
147
+ "300": hslToHex(hsl.h, hsl.s, 65),
148
+ "400": hslToHex(hsl.h, hsl.s, Math.min(100, hsl.l + 10)),
149
+ "500": mainColor,
150
+ "600": hslToHex(hsl.h, hsl.s, Math.max(0, hsl.l - 10)),
151
+ "900": hslToHex(hsl.h, hsl.s, 20)
152
+ };
153
+ }
154
+ //#endregion
155
+ //#region src/styles/applyTheme.ts
156
+ function applyTheme(mainColor, buttonColor) {
157
+ if (typeof document === "undefined") return;
158
+ const palette = generateBrandPalette(mainColor);
159
+ let styleElement = document.getElementById("incode-theme");
160
+ if (!styleElement) {
161
+ styleElement = document.createElement("style");
162
+ styleElement.id = "incode-theme";
163
+ document.head.appendChild(styleElement);
164
+ }
165
+ const buttonTextColor = buttonColor || "#ffffff";
166
+ const css = `
167
+ :root,
168
+ :host {
169
+ --primitive-color-brand-50: ${palette["50"]};
170
+ --primitive-color-brand-200: ${palette["200"]};
171
+ --primitive-color-brand-300: ${palette["300"]};
172
+ --primitive-color-brand-400: ${palette["400"]};
173
+ --primitive-color-brand-500: ${palette["500"]};
174
+ --primitive-color-brand-600: ${palette["600"]};
175
+ --primitive-color-brand-900: ${palette["900"]};
176
+ --button-primary-text-default: ${buttonTextColor};
177
+ }
178
+ `;
179
+ styleElement.textContent = css;
180
+ }
181
+ //#endregion
182
+ //#region src/styles/fetchTheme.ts
183
+ async function fetchAssets() {
184
+ return (await api.get("/omni/asset/fetch-all")).data;
185
+ }
186
+ var dataUrlCache = /* @__PURE__ */ new Map();
187
+ async function urlToDataUrl(url) {
188
+ if (url.startsWith("data:")) return url;
189
+ const cached = dataUrlCache.get(url);
190
+ if (cached) return cached;
191
+ const blob = await (await fetch(url)).blob();
192
+ const dataUrl = await new Promise((resolve, reject) => {
193
+ const reader = new FileReader();
194
+ reader.onloadend = () => resolve(reader.result);
195
+ reader.onerror = reject;
196
+ reader.readAsDataURL(blob);
197
+ });
198
+ dataUrlCache.set(url, dataUrl);
199
+ return dataUrl;
200
+ }
201
+ async function fetchTheme$1() {
202
+ const assets = await fetchAssets();
203
+ if (!assets.theme) throw new Error("Theme URL not found in assets response");
204
+ const themeUrl = assets.theme;
205
+ const isAbsoluteUrl = themeUrl.startsWith("http://") || themeUrl.startsWith("https://");
206
+ let theme;
207
+ if (isAbsoluteUrl) {
208
+ const themeResponse = await fetch(themeUrl);
209
+ if (!themeResponse.ok) throw new Error(`Failed to fetch theme: ${themeResponse.statusText}`);
210
+ theme = await themeResponse.json();
211
+ } else theme = (await api.get(themeUrl)).data;
212
+ const logoUrl = assets["logo.png"] || assets["logo.svg"] || assets["logo.jpg"] || assets["logo.jpeg"] || assets["logo.webp"] || theme.logo;
213
+ let cachedLogoUrl = logoUrl;
214
+ if (logoUrl) cachedLogoUrl = await urlToDataUrl(logoUrl);
215
+ return {
216
+ ...theme,
217
+ logo: cachedLogoUrl
218
+ };
219
+ }
220
+ async function fetchAndApplyTheme() {
221
+ const theme = await fetchTheme$1();
222
+ if (theme.main) applyTheme(theme.main, theme.buttonColor);
223
+ return theme;
224
+ }
225
+ //#endregion
226
+ //#region src/modules/flow/flowInit.ts
227
+ var lazyIdModule = () => import("./id/id.es.js").then((m) => m.Id);
228
+ var loadLazyHomeScreen = () => import("./homeScreen-BsEYyiDB.js").then((m) => m.HomeScreen);
229
+ var homeScreenPreloadPromise;
230
+ /**
231
+ * Headless flow keys: backend-only steps with no UI. `<incode-flow>` renders
232
+ * an empty shell while the core machine for the step runs and resolves —
233
+ * see `flow.tsx`. Each key still resolves to its own core machine inside
234
+ * `getLazyCoreMachineLoader` (e.g. `IP_ADDRESS` → `noOpFlowModuleMachine`,
235
+ * `TRUST_GRAPH` → `trustGraphMachine`).
236
+ */
237
+ var HEADLESS_FLOW_MODULE_KEYS = new Set(["IP_ADDRESS", "TRUST_GRAPH"]);
238
+ function getLazyCoreMachineLoader(moduleKey) {
239
+ if (moduleKey === "IP_ADDRESS") return () => import("@incodetech/core/flow").then((m) => m.noOpFlowModuleMachine);
240
+ if (moduleKey === "TRUST_GRAPH") return () => import("@incodetech/core/trust-graph").then((m) => m.trustGraphMachine);
241
+ if (moduleKey === "REDIRECT_TO_MOBILE") return () => import("@incodetech/core/redirect-to-mobile").then((m) => m.redirectToMobileMachine);
242
+ if (moduleKey === "PHONE") return () => import("@incodetech/core/phone").then((m) => m.phoneMachine);
243
+ if (moduleKey === "EMAIL") return () => import("@incodetech/core/email").then((m) => m.emailMachine);
244
+ if (moduleKey === "SELFIE") return () => import("@incodetech/core/selfie").then((m) => m.selfieMachine);
245
+ if (moduleKey === "AUTHENTICATION") return () => import("@incodetech/core/authentication").then((m) => m.authenticationMachine);
246
+ if (moduleKey === "ID" || moduleKey === "TUTORIAL_ID" || moduleKey === "SECOND_ID") return () => import("@incodetech/core/id").then((m) => m.idCaptureMachine);
247
+ if (moduleKey === "ID_OCR") return () => import("@incodetech/core/id-ocr").then((m) => m.idOcrStateMachine);
248
+ if (moduleKey === "CPF_OCR") return () => import("@incodetech/core/cpf-ocr").then((m) => m.cpfOcrMachine);
249
+ if (moduleKey === "FACE_MATCH") return () => import("@incodetech/core/face-match").then((m) => m.faceMatchMachine);
250
+ if (moduleKey === "CURP_VALIDATION") return () => import("@incodetech/core/curp-validation").then((m) => m.curpValidationMachine);
251
+ if (moduleKey === "GOVT_VALIDATION_PROVISIONING" || moduleKey === "INE_VALIDATION") return () => import("@incodetech/core/government-validation").then((m) => m.governmentValidationMachine);
252
+ if (moduleKey === "GEOLOCATION") return () => import("@incodetech/core/geolocation").then((m) => m.geolocationMachine);
253
+ if (moduleKey === "EXTERNAL_VERIFICATION") return () => import("@incodetech/core/ekyc").then((m) => m.ekycMachine);
254
+ if (moduleKey === "EKYB") return () => import("@incodetech/core/ekyb").then((m) => m.ekybMachine);
255
+ if (moduleKey === "DOCUMENT_CAPTURE" || moduleKey === "ADDRESS") return () => import("@incodetech/core/document-capture").then((m) => m.documentCaptureMachine);
256
+ if (moduleKey === "COMBINED_CONSENT") return () => import("@incodetech/core/consent").then((m) => m.consentMachine);
257
+ if (moduleKey === "MANDATORY_CONSENT" || moduleKey === "ML_CONSENT") return () => import("@incodetech/core/mandatory-consent").then((m) => m.mandatoryConsentMachine);
258
+ if (moduleKey === "SIGNATURE") return () => import("@incodetech/core/signature").then((m) => m.signatureMachine);
259
+ if (moduleKey === "ANTIFRAUD") return () => import("@incodetech/core/antifraud").then((m) => m.antifraudMachine);
260
+ if (moduleKey === "CUSTOM_FIELDS") return () => import("@incodetech/core/custom-fields").then((m) => m.customFieldsMachine);
261
+ if (moduleKey === "WATCHLIST") return () => import("@incodetech/core/watchlist").then((m) => m.watchlistMachine);
262
+ if (moduleKey === "WATCHLIST_BUSINESS") return () => import("@incodetech/core/watchlist-for-business").then((m) => m.watchlistForBusinessMachine);
263
+ if (moduleKey === "INCODE_WATCHLIST") return () => import("@incodetech/core/custom-watchlist").then((m) => m.customWatchlistMachine);
264
+ if (moduleKey === "AE_SIGNATURE") return () => import("@incodetech/core/ae-signature").then((m) => m.aeSignatureMachine);
265
+ if (moduleKey === "QE_SIGNATURE") return () => import("@incodetech/core/qe-signature").then((m) => m.qeSignatureMachine);
266
+ if (moduleKey === "CROSS_DOCUMENT_DATA_MATCH") return () => import("@incodetech/core/cross-document-data-match").then((m) => m.crossDocumentDataMatchMachine);
267
+ if (moduleKey === "DYNAMIC_FORMS") return () => import("@incodetech/core/dynamic-forms").then((m) => m.dynamicFormsMachine);
268
+ if (moduleKey === "FIELD_COMPARISON") return () => import("@incodetech/core/field-comparison").then((m) => m.fieldComparisonMachine);
269
+ }
270
+ function buildLazyCoreRegistryForFlow(flowModules) {
271
+ const registry = {};
272
+ for (const flowModule of flowModules) {
273
+ const moduleKey = flowModule.key;
274
+ if (registry[moduleKey]) continue;
275
+ const loader = getLazyCoreMachineLoader(moduleKey);
276
+ if (loader) registry[moduleKey] = loader;
277
+ }
278
+ return registry;
279
+ }
280
+ var LAZY_UI_MODULES = {
281
+ REDIRECT_TO_MOBILE: () => import("./redirect-to-mobile/redirect-to-mobile.es.js").then((m) => m.RedirectToMobile),
282
+ PHONE: () => import("./phone/phone.es.js").then((m) => m.Phone),
283
+ EMAIL: () => import("./email/email.es.js").then((m) => m.Email),
284
+ SELFIE: () => import("./selfie/selfie.es.js").then((m) => m.Selfie),
285
+ AUTHENTICATION: () => import("./authentication/authentication.es.js").then((m) => m.Authentication),
286
+ ID: lazyIdModule,
287
+ ID_CAPTURE: lazyIdModule,
288
+ TUTORIAL_ID: lazyIdModule,
289
+ SECOND_ID: lazyIdModule,
290
+ FACE_MATCH: () => import("./faceMatch-CDMcFQwR.js").then((m) => m.FaceMatch),
291
+ CURP_VALIDATION: () => import("./curp-validation/curp-validation.es.js").then((m) => m.CurpValidation),
292
+ GOVT_VALIDATION_PROVISIONING: () => import("./governmentValidation/governmentValidation.es.js").then((m) => m.GovernmentValidation),
293
+ INE_VALIDATION: () => import("./governmentValidation/governmentValidation.es.js").then((m) => m.GovernmentValidation),
294
+ GEOLOCATION: () => import("./geolocation/geolocation.es.js").then((m) => m.Geolocation),
295
+ EXTERNAL_VERIFICATION: () => import("./ekycModule-DNDPqvUc.js").then((m) => m.EkycModule),
296
+ EKYB: () => import("./ekybModule-BUPX0QhW.js").then((m) => m.EkybModule),
297
+ DOCUMENT_CAPTURE: () => import("./documentCapture-BVfNZL29.js").then((m) => m.DocumentCapture),
298
+ ADDRESS: () => import("./documentCapture-BVfNZL29.js").then((m) => m.DocumentCapture),
299
+ COMBINED_CONSENT: () => import("./consent/consent.es.js").then((m) => m.Consent),
300
+ MANDATORY_CONSENT: () => import("./mandatoryConsent-DP189TUn.js").then((m) => m.MandatoryConsent),
301
+ ML_CONSENT: () => import("./mandatoryConsent-DP189TUn.js").then((m) => m.MandatoryConsent),
302
+ SIGNATURE: () => import("./signature/signature.es.js").then((m) => m.Signature),
303
+ ID_OCR: () => import("./idOcr-BS77o1VC.js").then((m) => m.IdOcr),
304
+ CPF_OCR: () => import("./cpfOcr-WNklFuxT.js").then((m) => m.CpfOcr),
305
+ ANTIFRAUD: () => import("./antifraud/antifraud.es.js").then((m) => m.Antifraud),
306
+ CUSTOM_FIELDS: () => import("./customFields-B4MqqDI6.js").then((m) => m.CustomFields),
307
+ WATCHLIST: () => import("./watchlist/watchlist.es.js").then((m) => m.Watchlist),
308
+ WATCHLIST_BUSINESS: () => import("./watchlistForBusiness-RZcnjVDb.js").then((m) => m.WatchlistForBusiness),
309
+ INCODE_WATCHLIST: () => import("./customWatchlist-Dfqw1DQP.js").then((m) => m.CustomWatchlist),
310
+ AE_SIGNATURE: () => import("./ae-signature/ae-signature.es.js").then((m) => m.AeSignature),
311
+ QE_SIGNATURE: () => import("./qe-signature/qe-signature.es.js").then((m) => m.QeSignature),
312
+ CROSS_DOCUMENT_DATA_MATCH: () => import("./cross-document-data-match/cross-document-data-match.es.js").then((m) => m.CrossDocumentDataMatch),
313
+ DYNAMIC_FORMS: () => import("./dynamicForms-BYGGAQoc.js").then((m) => m.DynamicForms),
314
+ FIELD_COMPARISON: () => import("./fieldComparison-Z1NleSxD.js").then((m) => m.FieldComparison)
315
+ };
316
+ function loadHomeScreen() {
317
+ return loadLazyHomeScreen();
318
+ }
319
+ function preloadHomeScreen() {
320
+ if (homeScreenPreloadPromise) return;
321
+ homeScreenPreloadPromise = loadHomeScreen();
322
+ homeScreenPreloadPromise.catch(() => {
323
+ homeScreenPreloadPromise = void 0;
324
+ });
325
+ }
326
+ var redirectToMobilePreloadPromise;
327
+ /**
328
+ * Eagerly prefetches the REDIRECT_TO_MOBILE UI + core chunks.
329
+ * Call on desktop during flow init so the QR paints instantly when the
330
+ * orchestrator injects REDIRECT_TO_MOBILE as the first step.
331
+ */
332
+ function preloadRedirectToMobile() {
333
+ if (redirectToMobilePreloadPromise) return;
334
+ const uiLoader = LAZY_UI_MODULES.REDIRECT_TO_MOBILE;
335
+ const coreLoader = getLazyCoreMachineLoader("REDIRECT_TO_MOBILE");
336
+ const promises = [];
337
+ if (uiLoader) promises.push(uiLoader());
338
+ if (coreLoader) promises.push(coreLoader());
339
+ redirectToMobilePreloadPromise = Promise.all(promises);
340
+ redirectToMobilePreloadPromise.catch(() => {
341
+ redirectToMobilePreloadPromise = void 0;
342
+ });
343
+ }
344
+ function createFlowManager(options = {}) {
345
+ const scopedLazyModules = {};
346
+ const isDesktop = options.isDesktop ?? getDeviceClass() === "desktop";
347
+ const { enableHome, ...flowFetchOptions } = options;
348
+ let endScreen = {
349
+ endScreenTitle: null,
350
+ endScreenText: null
351
+ };
352
+ const manager = createOrchestratedFlowManager({
353
+ enableHome,
354
+ getFlow: async (signal) => {
355
+ const flow = await getFlow(signal, {
356
+ ...flowFetchOptions,
357
+ isDesktop
358
+ });
359
+ const scopedRegistry = buildLazyCoreRegistryForFlow(flow.flowModules ?? []);
360
+ for (const key of Object.keys(scopedLazyModules)) delete scopedLazyModules[key];
361
+ Object.assign(scopedLazyModules, scopedRegistry);
362
+ return flow;
363
+ },
364
+ getFinishStatus: async (flowId, signal) => {
365
+ return {
366
+ ...await getFinishStatus(flowId, signal),
367
+ ...endScreen
368
+ };
369
+ },
370
+ lazyModules: scopedLazyModules
371
+ });
372
+ return Object.assign(manager, { setEndScreenTexts(endScreenTitle, endScreenText) {
373
+ endScreen = {
374
+ endScreenTitle,
375
+ endScreenText
376
+ };
377
+ } });
378
+ }
379
+ async function setupSDK(options) {
380
+ await initializeSession({ token: options.token });
381
+ if (hasI18nInstance()) return;
382
+ setI18nInstance(createI18n(options.lang ? { lang: options.lang } : void 0));
383
+ }
384
+ async function initializeFlowManager(options) {
385
+ const { token, lang, flowManager } = options;
386
+ await setupSDK({
387
+ token,
388
+ lang
389
+ });
390
+ flowManager.load();
391
+ }
392
+ async function fetchTheme() {
393
+ try {
394
+ const theme = await fetchAndApplyTheme();
395
+ const uiConfig = {
396
+ logoSrc: theme.logo,
397
+ subtitle: theme.subtitle,
398
+ hideFooterBranding: theme.hideFooterBranding
399
+ };
400
+ setUiConfig(uiConfig);
401
+ return {
402
+ theme,
403
+ uiConfig
404
+ };
405
+ } catch {
406
+ return {};
407
+ }
408
+ }
409
+ function warmupWasmIfNeeded(managerState, wasmConfig) {
410
+ if (managerState.currentStep === "REDIRECT_TO_MOBILE") return;
411
+ const requiredPipelines = getRequiredWasmPipelines(managerState.flow);
412
+ if (requiredPipelines.length > 0) {
413
+ const resolved = resolveWasmConfig({
414
+ ...wasmConfig ?? {},
415
+ pipelines: requiredPipelines
416
+ });
417
+ const configToStore = {
418
+ ...resolved,
419
+ pipelines: resolved.pipelines ? [...resolved.pipelines] : void 0
420
+ };
421
+ setWasmConfig(configToStore);
422
+ warmupWasm(resolved).then(() => initializeWasmUtil(configToStore)).then(() => upgradeToWasmHttpClient(configToStore)).catch((error) => {
423
+ console.error("WASM warmup failed:", error);
424
+ });
425
+ }
426
+ }
427
+ function preloadFirstModule(managerState) {
428
+ const firstStep = managerState.currentStep;
429
+ if (firstStep) {
430
+ const loader = LAZY_UI_MODULES[firstStep];
431
+ if (loader) loader().catch(() => {});
432
+ }
433
+ }
434
+ //#endregion
435
+ //#region src/modules/flow/unsupportedModule.tsx
436
+ var UnsupportedModule = ({ moduleKey, onNext }) => {
437
+ return /* @__PURE__ */ u("section", {
438
+ class: "IncodeUnsupportedModule",
439
+ "aria-live": "polite",
440
+ children: /* @__PURE__ */ u("div", {
441
+ class: "IncodeUnsupportedModuleContent",
442
+ children: [
443
+ /* @__PURE__ */ u("h2", {
444
+ class: "IncodeUnsupportedModuleTitle",
445
+ children: "Module not available"
446
+ }),
447
+ /* @__PURE__ */ u("p", {
448
+ class: "IncodeUnsupportedModuleMessage",
449
+ children: [
450
+ "The \"",
451
+ moduleKey,
452
+ "\" module is not yet supported in this version."
453
+ ]
454
+ }),
455
+ /* @__PURE__ */ u(Button, {
456
+ onClick: onNext,
457
+ class: "IncodeUnsupportedModuleButton",
458
+ "data-testid": "unsupported-module-next-button",
459
+ children: "Next"
460
+ })
461
+ ]
462
+ })
463
+ });
464
+ };
465
+ //#endregion
466
+ //#region src/modules/flow/extractIncodeStatus.ts
467
+ /**
468
+ * Extract the Incode-specific status code (e.g. `4028` for "Flow is not
469
+ * activated", `4081`/`4083` for QR failures) from an error caught during SDK
470
+ * init.
471
+ *
472
+ * Both `QrValidationError` and `IncodeApiError` (thrown from core's
473
+ * `validateQrUuid`/`createSession`/`getWorkflowConfig`) expose a numeric
474
+ * `status` field, so a duck-typed check is enough — no class-level coupling
475
+ * to core, which keeps this safe under stale `dist/*.d.ts` during local dev.
476
+ */
477
+ function extractIncodeStatus(err) {
478
+ if (typeof err === "object" && err !== null && "status" in err && typeof err.status === "number") return err.status;
479
+ }
480
+ //#endregion
481
+ //#region src/shared/selfLoading/resolveApiKey.ts
482
+ function toHex(buffer) {
483
+ return Array.from(new Uint8Array(buffer), (value) => value.toString(16).padStart(2, "0")).join("");
484
+ }
485
+ async function sha1(value) {
486
+ const subtle = globalThis.crypto?.subtle;
487
+ if (!subtle) throw new Error("SHA-1 is not available in this environment");
488
+ return toHex(await subtle.digest("SHA-1", new TextEncoder().encode(value)));
489
+ }
490
+ async function resolveApiKey(config) {
491
+ if (typeof config.apiKey === "string") return config.apiKey;
492
+ if (typeof config.clientId === "string") return sha1(config.clientId);
493
+ throw new Error("Self-loading mode requires apiKey or clientId");
494
+ }
495
+ //#endregion
496
+ //#region src/modules/flow/headlessModule.ts
497
+ var HeadlessWorkflowModule = () => null;
498
+ var lazyHeadlessWorkflowModule = () => Promise.resolve(HeadlessWorkflowModule);
499
+ var HEADLESS_WORKFLOW_MODULE_KEYS = new Set(["IDENTITY_SEARCH"]);
500
+ //#endregion
501
+ //#region src/modules/flow/useModuleLoader.ts
502
+ function getLoadErrorMessage(error, fallbackMessage) {
503
+ return error instanceof Error ? error.message : fallbackMessage;
504
+ }
505
+ var loadedComponents = /* @__PURE__ */ new WeakMap();
506
+ var inflightLoaders = /* @__PURE__ */ new WeakMap();
507
+ function getLoaderKey(loader) {
508
+ return loader;
509
+ }
510
+ function getCachedComponent(loader) {
511
+ if (!loader) return void 0;
512
+ return loadedComponents.get(getLoaderKey(loader));
513
+ }
514
+ function loadComponent(loader) {
515
+ const key = getLoaderKey(loader);
516
+ const cached = loadedComponents.get(key);
517
+ if (cached) return Promise.resolve(cached);
518
+ const inflight = inflightLoaders.get(key);
519
+ if (inflight) return inflight;
520
+ const promise = loader().then((Component) => {
521
+ loadedComponents.set(key, Component);
522
+ inflightLoaders.delete(key);
523
+ return Component;
524
+ }).catch((error) => {
525
+ inflightLoaders.delete(key);
526
+ throw error;
527
+ });
528
+ inflightLoaders.set(key, promise);
529
+ return promise;
530
+ }
531
+ function computeInitialState(loader) {
532
+ if (!loader) return { status: "idle" };
533
+ const cached = getCachedComponent(loader);
534
+ if (cached) return {
535
+ status: "loaded",
536
+ Component: cached
537
+ };
538
+ return { status: "loading" };
539
+ }
540
+ function resolveModuleLoader(moduleKey, modules, headlessModuleKeys) {
541
+ if (!moduleKey) return void 0;
542
+ return modules[moduleKey] ?? (headlessModuleKeys?.has(moduleKey) ? lazyHeadlessWorkflowModule : void 0);
543
+ }
544
+ function useLazyComponentLoader(options) {
545
+ const { loader, onLoading, onLoaded, onError } = options;
546
+ const [state, setState] = d(() => computeInitialState(loader));
547
+ const prevLoaderRef = A(loader);
548
+ const onLoadingRef = A(onLoading);
549
+ const onLoadedRef = A(onLoaded);
550
+ const onErrorRef = A(onError);
551
+ y(() => {
552
+ onLoadingRef.current = onLoading;
553
+ onLoadedRef.current = onLoaded;
554
+ onErrorRef.current = onError;
555
+ }, [
556
+ onLoading,
557
+ onLoaded,
558
+ onError
559
+ ]);
560
+ if (prevLoaderRef.current !== loader) {
561
+ prevLoaderRef.current = loader;
562
+ setState(computeInitialState(loader));
563
+ }
564
+ y(() => {
565
+ if (!loader) return;
566
+ if (getCachedComponent(loader)) {
567
+ onLoadedRef.current?.();
568
+ return;
569
+ }
570
+ onLoadingRef.current?.();
571
+ let cancelled = false;
572
+ loadComponent(loader).then((Component) => {
573
+ if (!cancelled) {
574
+ setState({
575
+ status: "loaded",
576
+ Component
577
+ });
578
+ onLoadedRef.current?.();
579
+ }
580
+ }).catch((error) => {
581
+ if (!cancelled) {
582
+ const errorMessage = getLoadErrorMessage(error, "Failed to load component");
583
+ setState({
584
+ status: "error",
585
+ error: errorMessage
586
+ });
587
+ onErrorRef.current?.(errorMessage);
588
+ }
589
+ });
590
+ return () => {
591
+ cancelled = true;
592
+ };
593
+ }, [loader]);
594
+ return state;
595
+ }
596
+ function useModuleLoader(options) {
597
+ const { moduleKey, modules, headlessModuleKeys, onModuleLoading, onModuleLoaded, onError } = options;
598
+ const [unsupportedModuleKey, setUnsupportedModuleKey] = d(void 0);
599
+ const loader = resolveModuleLoader(moduleKey, modules, headlessModuleKeys);
600
+ const state = useLazyComponentLoader({
601
+ loader,
602
+ onLoading: moduleKey ? () => onModuleLoading?.(moduleKey) : void 0,
603
+ onLoaded: moduleKey ? () => onModuleLoaded?.(moduleKey) : void 0,
604
+ onError: moduleKey ? (errorMessage) => onError?.(`Failed to load ${moduleKey}: ${errorMessage}`) : void 0
605
+ });
606
+ y(() => {
607
+ if (!moduleKey) {
608
+ setUnsupportedModuleKey(void 0);
609
+ return;
610
+ }
611
+ if (!loader) setUnsupportedModuleKey(moduleKey);
612
+ else setUnsupportedModuleKey(void 0);
613
+ }, [loader, moduleKey]);
614
+ if (!moduleKey) return { status: "idle" };
615
+ if (unsupportedModuleKey) return {
616
+ status: "unsupported",
617
+ moduleKey: unsupportedModuleKey
618
+ };
619
+ if (state.status === "idle" || state.status === "loading") return {
620
+ status: "loading",
621
+ moduleKey
622
+ };
623
+ if (state.status === "error") return {
624
+ status: "error",
625
+ moduleKey,
626
+ error: state.error
627
+ };
628
+ return {
629
+ status: "loaded",
630
+ moduleKey,
631
+ Component: state.Component
632
+ };
633
+ }
634
+ function useModulePreloader(options) {
635
+ const { moduleKey, modules } = options;
636
+ const loader = moduleKey ? modules[moduleKey] : void 0;
637
+ const state = useLazyComponentLoader({ loader });
638
+ return loader != null && state.status === "loaded";
639
+ }
640
+ function schedulePrefetch(run) {
641
+ if (typeof requestIdleCallback !== "undefined") requestIdleCallback(() => {
642
+ run();
643
+ });
644
+ else setTimeout(run, 0);
645
+ }
646
+ function usePrefetchNextModule(steps, currentStepIndex, modules, currentModuleLoaded) {
647
+ const prefetchedRef = A(/* @__PURE__ */ new Set());
648
+ y(() => {
649
+ if (!currentModuleLoaded) return;
650
+ if (currentStepIndex < steps.length - 1) {
651
+ const nextStep = steps[currentStepIndex + 1];
652
+ if (nextStep && !prefetchedRef.current.has(nextStep)) {
653
+ prefetchedRef.current.add(nextStep);
654
+ const loader = modules[nextStep];
655
+ if (loader) schedulePrefetch(() => {
656
+ loader().catch(() => {
657
+ prefetchedRef.current.delete(nextStep);
658
+ });
659
+ });
660
+ }
661
+ }
662
+ }, [
663
+ steps,
664
+ currentStepIndex,
665
+ modules,
666
+ currentModuleLoaded
667
+ ]);
668
+ }
669
+ //#endregion
670
+ export { warmupWasmIfNeeded as _, resolveApiKey as a, HEADLESS_FLOW_MODULE_KEYS as c, fetchTheme as d, initializeFlowManager as f, setupSDK as g, preloadRedirectToMobile as h, HEADLESS_WORKFLOW_MODULE_KEYS as i, LAZY_UI_MODULES as l, preloadHomeScreen as m, useModulePreloader as n, extractIncodeStatus as o, preloadFirstModule as p, usePrefetchNextModule as r, UnsupportedModule as s, useModuleLoader as t, createFlowManager as u, fetchAndApplyTheme as v, TerminalErrorPage as y };