@basis-theory/web-elements 3.0.0-beta.3 → 3.0.0-beta.4

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 (58) hide show
  1. package/dist/.vite/manifest.json +19 -8
  2. package/dist/api-client/src/api-client.d.ts.map +1 -1
  3. package/dist/api-client/src/bin-lookup-transform.d.ts +35 -0
  4. package/dist/api-client/src/bin-lookup-transform.d.ts.map +1 -0
  5. package/dist/api-client/src/http-client.d.ts.map +1 -1
  6. package/dist/api-client/src/index.d.ts +1 -1
  7. package/dist/api-client/src/index.d.ts.map +1 -1
  8. package/dist/api-client/src/types.d.ts +114 -6
  9. package/dist/api-client/src/types.d.ts.map +1 -1
  10. package/dist/basis-theory-sdk.es.js +1 -1
  11. package/dist/basis-theory-sdk.umd.js +1 -1
  12. package/dist/basis-theory-sdk.umd.js.map +1 -1
  13. package/dist/{create-card-DipDWgph.js → create-card-B5zEHyRg.js} +49 -15
  14. package/dist/create-card-B5zEHyRg.js.map +1 -0
  15. package/dist/create-copy-button-DrAz8g0m.js +233 -0
  16. package/dist/create-copy-button-DrAz8g0m.js.map +1 -0
  17. package/dist/{index-BBfuUaLw.js → index-BOedIhUN.js} +406 -54
  18. package/dist/index-BOedIhUN.js.map +1 -0
  19. package/dist/loader/basis-theory.min.js +1 -1
  20. package/dist/postmessage/src/client.d.ts.map +1 -1
  21. package/dist/postmessage/src/event-map.d.ts +4 -0
  22. package/dist/postmessage/src/event-map.d.ts.map +1 -1
  23. package/dist/postmessage/src/server.d.ts.map +1 -1
  24. package/dist/postmessage/src/types.d.ts +7 -3
  25. package/dist/postmessage/src/types.d.ts.map +1 -1
  26. package/dist/shared/src/index.d.ts +1 -0
  27. package/dist/shared/src/index.d.ts.map +1 -1
  28. package/dist/shared/src/proxy-validation.d.ts +93 -0
  29. package/dist/shared/src/proxy-validation.d.ts.map +1 -0
  30. package/dist/sri.json +9 -9
  31. package/dist/stats.html +1 -1
  32. package/dist/web-elements/src/BasisTheory.d.ts +1 -1
  33. package/dist/web-elements/src/BasisTheory.d.ts.map +1 -1
  34. package/dist/web-elements/src/basis-theory.d.ts +23 -0
  35. package/dist/web-elements/src/basis-theory.d.ts.map +1 -1
  36. package/dist/web-elements/src/elements/create-card-number.d.ts +2 -1
  37. package/dist/web-elements/src/elements/create-card-number.d.ts.map +1 -1
  38. package/dist/web-elements/src/elements/create-card.d.ts +14 -1
  39. package/dist/web-elements/src/elements/create-card.d.ts.map +1 -1
  40. package/dist/web-elements/src/elements/create-copy-button.d.ts +19 -0
  41. package/dist/web-elements/src/elements/create-copy-button.d.ts.map +1 -0
  42. package/dist/web-elements/src/elements/create-cvv.d.ts +2 -1
  43. package/dist/web-elements/src/elements/create-cvv.d.ts.map +1 -1
  44. package/dist/web-elements/src/elements/create-expiry.d.ts +2 -1
  45. package/dist/web-elements/src/elements/create-expiry.d.ts.map +1 -1
  46. package/dist/web-elements/src/elements/create-text.d.ts +2 -1
  47. package/dist/web-elements/src/elements/create-text.d.ts.map +1 -1
  48. package/dist/web-elements/src/index.d.ts +1 -1
  49. package/dist/web-elements/src/index.d.ts.map +1 -1
  50. package/dist/web-elements/src/types/events.d.ts +30 -2
  51. package/dist/web-elements/src/types/events.d.ts.map +1 -1
  52. package/dist/web-elements/src/types.d.ts +135 -5
  53. package/dist/web-elements/src/types.d.ts.map +1 -1
  54. package/dist/web-elements/src/utils/create-event-dispatcher.d.ts.map +1 -1
  55. package/dist/web-elements/src/utils/validate-element-options.d.ts.map +1 -1
  56. package/package.json +5 -5
  57. package/dist/create-card-DipDWgph.js.map +0 -1
  58. package/dist/index-BBfuUaLw.js.map +0 -1
@@ -1,27 +1,38 @@
1
1
  {
2
- "_index-BBfuUaLw.js": {
3
- "file": "index-BBfuUaLw.js",
2
+ "_index-BOedIhUN.js": {
3
+ "file": "index-BOedIhUN.js",
4
4
  "name": "index",
5
5
  "dynamicImports": [
6
- "src/elements/create-card.ts"
6
+ "src/elements/create-card.ts",
7
+ "src/elements/create-copy-button.ts"
7
8
  ],
8
- "integrity": "sha384-uSoWS5QGRB9FD+tnc9SotWKHHU5/nLmr2IVmjU/YMnBOBwg3MOXjsj7VYlFw+Rpm"
9
+ "integrity": "sha384-ftnxLYP5CzGh3h2e8VJw46EV6GEJmbVeT0Ky2nPjhTaCyKaAH7BHTey7L/USLDmi"
9
10
  },
10
11
  "src/elements/create-card.ts": {
11
- "file": "create-card-DipDWgph.js",
12
+ "file": "create-card-B5zEHyRg.js",
12
13
  "name": "create-card",
13
14
  "src": "src/elements/create-card.ts",
14
15
  "isDynamicEntry": true,
15
16
  "imports": [
16
- "_index-BBfuUaLw.js"
17
+ "_index-BOedIhUN.js"
17
18
  ],
18
- "integrity": "sha384-ghGZpmJtjKvmURaj6QaLxtRDDbnc+4EKBMsgYO68iicGxqHHmGAsWyjbWhxBmreJ"
19
+ "integrity": "sha384-+T9LELUbX1LiJbyhaxrzZE0gSVQJddp8Fy5KnUrU9NaBI+Tn6D+qO+v/ppfi5nik"
20
+ },
21
+ "src/elements/create-copy-button.ts": {
22
+ "file": "create-copy-button-DrAz8g0m.js",
23
+ "name": "create-copy-button",
24
+ "src": "src/elements/create-copy-button.ts",
25
+ "isDynamicEntry": true,
26
+ "imports": [
27
+ "_index-BOedIhUN.js"
28
+ ],
29
+ "integrity": "sha384-eFvMvGMheUyByCIEfg9HHyzRzoYGPod8Q7ZAMq325WHKudElLIqw9uRr8/XUiXND"
19
30
  },
20
31
  "src/index.ts": {
21
32
  "file": "basis-theory-sdk.umd.js",
22
33
  "name": "index",
23
34
  "src": "src/index.ts",
24
35
  "isEntry": true,
25
- "integrity": "sha384-ddyMdTUvEA0NROPra0/eWz+jWaUMNSsyhhlM1rCTNGdqTMkLAHqd5G/QQPZ/uJbv"
36
+ "integrity": "sha384-i0A+Aeio9P9FwvLeFXZyLhS1xXwcBLgkrv3oIieLZw3sWt0Vg7HktHMadS2lJPE0"
26
37
  }
27
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../../api-client/src/api-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EACV,iBAAiB,EAEjB,gBAAgB,EAKjB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,EACd,UAAS,OAAO,CAAC,gBAAgB,CAAM,KACtC,iBA0KF,CAAC"}
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../../api-client/src/api-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EACV,iBAAiB,EAEjB,gBAAgB,EAKjB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,EACd,UAAS,OAAO,CAAC,gBAAgB,CAAM,KACtC,iBAmMF,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * BIN enrichment API → BinInfo (co-badge networks, etc.)
3
+ */
4
+ import type { BinInfo } from './types';
5
+ /** Raw card enrichment response */
6
+ export interface CardEnrichmentApiResponse {
7
+ brand?: string;
8
+ funding?: string;
9
+ segment?: string;
10
+ issuer?: {
11
+ country?: string;
12
+ name?: string;
13
+ };
14
+ binRange?: Array<{
15
+ binMin?: string;
16
+ binMax?: string;
17
+ }>;
18
+ additional?: Array<{
19
+ brand?: string;
20
+ funding?: string;
21
+ segment?: string;
22
+ issuer?: {
23
+ country?: string;
24
+ name?: string;
25
+ };
26
+ binRange?: Array<{
27
+ binMin?: string;
28
+ binMax?: string;
29
+ }>;
30
+ }>;
31
+ }
32
+ export declare const normalizeCardBrand: (brand: string) => string;
33
+ export declare const normalizeFundingType: (funding?: string) => "debit" | "credit" | "prepaid" | "unknown";
34
+ export declare const transformCardEnrichmentToBinInfo: (apiResponse: CardEnrichmentApiResponse, bin: string) => BinInfo;
35
+ //# sourceMappingURL=bin-lookup-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin-lookup-transform.d.ts","sourceRoot":"","sources":["../../../../api-client/src/bin-lookup-transform.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAyC,MAAM,SAAS,CAAC;AAE9E,mCAAmC;AACnC,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvD,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACxD,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,MACN,CAAC;AAE9C,eAAO,MAAM,oBAAoB,GAC/B,UAAU,MAAM,KACf,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,SAMnC,CAAC;AAaF,eAAO,MAAM,gCAAgC,GAC3C,aAAa,yBAAyB,EACtC,KAAK,MAAM,KACV,OA4CF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../../api-client/src/http-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAEV,gBAAgB,EAEhB,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,gBAAgB;IA0QrD;;OAEG;YACW,CAAC,iBACR,MAAM,YACF,cAAc,QACjB,WAAW,GAChB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAkE3B;;OAEG;kBACW,IAAI;IAIlB;;OAEG;oBACa,MAAM;CAIzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../../api-client/src/http-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAEV,gBAAgB,EAEhB,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,gBAAgB;IAkSrD;;OAEG;YACW,CAAC,iBACR,MAAM,YACF,cAAc,QACjB,WAAW,GAChB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAmE3B;;OAEG;kBACW,IAAI;IAIlB;;OAEG;oBACa,MAAM;CAIzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -5,5 +5,5 @@
5
5
  */
6
6
  export { createBasisTheoryClient } from './api-client';
7
7
  export { createHttpClient } from './http-client';
8
- export type { BasisTheoryClient, BinInfo, CacheEntry, HttpClientConfig, HttpError, HttpResponse, ProxyRequest, RequestOptions, Token, TokenCreateRequest, TokenData, TokenIntent, TokenIntentCreateRequest, TokenUpdateRequest, TokenizeRequest, } from './types';
8
+ export type { BasisTheoryClient, BinRangeSegment, BinInfo, NetworkBinRangeEntry, CacheEntry, HttpClientConfig, HttpError, HttpResponse, ProxyRequest, RequestOptions, Token, TokenCreateRequest, TokenData, TokenIntent, TokenIntentCreateRequest, TokenUpdateRequest, TokenizeRequest, DeviceInfo, NetworkInformation, } from './types';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../api-client/src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,YAAY,EAEV,iBAAiB,EAEjB,OAAO,EAEP,UAAU,EAEV,gBAAgB,EAChB,SAAS,EAET,YAAY,EAEZ,YAAY,EACZ,cAAc,EAEd,KAAK,EACL,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,GAChB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../api-client/src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,YAAY,EAEV,iBAAiB,EACjB,eAAe,EAEf,OAAO,EACP,oBAAoB,EAEpB,UAAU,EAEV,gBAAgB,EAChB,SAAS,EAET,YAAY,EAEZ,YAAY,EACZ,cAAc,EAEd,KAAK,EACL,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EAEf,UAAU,EACV,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
@@ -3,6 +3,79 @@
3
3
  *
4
4
  * Type definitions for HTTP client, tokenization, and BIN lookup services
5
5
  */
6
+ /**
7
+ * Network connection information (Navigator.connection)
8
+ * Note: Not available in Safari/Firefox
9
+ */
10
+ export interface NetworkInformation {
11
+ /** Connection type: '4g', '3g', '2g', 'slow-2g' */
12
+ effectiveType?: string;
13
+ /** Round-trip time in milliseconds */
14
+ rtt?: number;
15
+ /** Downlink speed in Mbps */
16
+ downlink?: number;
17
+ /** Data saver mode enabled */
18
+ saveData?: boolean;
19
+ }
20
+ /**
21
+ * Device information for fraud detection and 3DS
22
+ * Collected by coordinator and sent via BT-DEVICE-INFO header
23
+ */
24
+ export interface DeviceInfo {
25
+ /** Browser brands and versions */
26
+ uaBrands?: Array<{
27
+ brand: string;
28
+ version: string;
29
+ }>;
30
+ /** Whether device is mobile */
31
+ uaMobile?: boolean;
32
+ /** Platform name */
33
+ uaPlatform?: string;
34
+ /** Preferred languages */
35
+ languages?: string[];
36
+ /** IANA timezone */
37
+ timeZone?: string;
38
+ /** Whether cookies are enabled */
39
+ cookiesEnabled?: boolean;
40
+ /** Whether localStorage is available */
41
+ localStorageEnabled?: boolean;
42
+ /** Whether sessionStorage is available */
43
+ sessionStorageEnabled?: boolean;
44
+ /** Platform string (navigator.platform) */
45
+ platform?: string;
46
+ /** Number of logical processors */
47
+ hardwareConcurrency?: number;
48
+ /** Device memory in GB (may be null if not available) */
49
+ deviceMemoryGb?: number | null;
50
+ /** Maximum touch points supported */
51
+ maxTouchPoints?: number;
52
+ /** Screen width in pixels */
53
+ screenWidth?: number;
54
+ /** Screen height in pixels */
55
+ screenHeight?: number;
56
+ /** Available screen width */
57
+ screenAvailWidth?: number;
58
+ /** Available screen height */
59
+ screenAvailHeight?: number;
60
+ /** Device pixel ratio */
61
+ devicePixelRatio?: number;
62
+ /** Network connection information */
63
+ network?: NetworkInformation;
64
+ /** Installed plugin names (max 20) */
65
+ plugins?: string[];
66
+ /** Supported MIME types (max 20) */
67
+ mimeTypes?: string[];
68
+ /** Whether WebDriver is detected */
69
+ webdriver?: boolean;
70
+ /** Whether headless browser is suspected */
71
+ suspectedHeadless?: boolean;
72
+ /** WebGL vendor string */
73
+ webglVendor?: string;
74
+ /** WebGL renderer string */
75
+ webglRenderer?: string;
76
+ /** Deterministic hash of canvas rendering */
77
+ canvasHash?: string;
78
+ }
6
79
  /**
7
80
  * HTTP Client Configuration
8
81
  */
@@ -17,7 +90,7 @@ export interface HttpClientConfig {
17
90
  retries?: number;
18
91
  /** Initial retry delay in milliseconds (default: 1000, exponential backoff) */
19
92
  retryDelay?: number;
20
- /** Enable response caching for GET requests (default: false) */
93
+ /** Enable response caching for GET requests globally (default: false). Use useCache per-request for selective caching. */
21
94
  cache?: boolean;
22
95
  /** Enable debug logging (default: false) */
23
96
  debug?: boolean;
@@ -36,10 +109,16 @@ export interface RequestOptions {
36
109
  timeout?: number;
37
110
  /** Skip caching for this request */
38
111
  skipCache?: boolean;
112
+ /** Force enable caching for this request (overrides global cache: false) */
113
+ useCache?: boolean;
39
114
  /** Override API key for this request (e.g., session key) */
40
115
  apiKey?: string;
41
116
  /** Idempotency key for safe retries */
42
117
  idempotencyKey?: string;
118
+ /** Number of retries (overrides config retries, use 0 to disable) */
119
+ retries?: number;
120
+ /** Device fingerprint information for fraud detection and 3DS */
121
+ deviceInfo?: DeviceInfo;
43
122
  }
44
123
  /**
45
124
  * HTTP Response
@@ -196,6 +275,25 @@ export interface TokenIntent {
196
275
  /** Expiration timestamp */
197
276
  expires_at: string;
198
277
  }
278
+ /**
279
+ * BIN range segment from card enrichment (8-digit strings typical).
280
+ */
281
+ export interface BinRangeSegment {
282
+ binMin?: string;
283
+ binMax?: string;
284
+ }
285
+ /**
286
+ * Per-network BIN ranges for co-badge narrowing after the first 6 digits.
287
+ */
288
+ export interface NetworkBinRangeEntry {
289
+ /** Normalized network id (kebab-case, e.g. `visa`) */
290
+ network: string;
291
+ /**
292
+ * Ranges for this network; omitted or empty means no narrowing (always eligible
293
+ * when filtering runs; see `filterNetworksByPanPrefix`).
294
+ */
295
+ binRange?: BinRangeSegment[];
296
+ }
199
297
  /**
200
298
  * BIN Lookup Response
201
299
  */
@@ -210,12 +308,13 @@ export interface BinInfo {
210
308
  country?: string;
211
309
  /** Issuing bank name */
212
310
  bank?: string;
213
- /** Card product name */
214
- product?: string;
215
311
  /** Supported networks (for co-badged cards) */
216
312
  networks?: string[];
217
- /** Card level (e.g., 'standard', 'gold', 'platinum') */
218
- card_level?: string;
313
+ /**
314
+ * Per-network `binRange` from enrichment (primary + additional brands).
315
+ * Used to narrow visible co-badge networks when PAN length &gt; 6.
316
+ */
317
+ networkBinRanges?: NetworkBinRangeEntry[];
219
318
  }
220
319
  /**
221
320
  * Session Response (snake_case matches BasisTheory API)
@@ -234,10 +333,19 @@ export interface Session {
234
333
  export interface ProxyRequest {
235
334
  /** HTTP method */
236
335
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
237
- /** Request headers */
336
+ /** Request headers (forwarded to destination) */
238
337
  headers?: Record<string, string>;
239
338
  /** Request body */
240
339
  body?: unknown;
340
+ /**
341
+ * Pre-configured proxy key — sent as `BT-PROXY-KEY` on the Basis Theory API request.
342
+ * When set, `url` passed to `proxy()` may be empty.
343
+ */
344
+ proxyKey?: string;
345
+ /**
346
+ * When true, asks the API to include destination response headers in the payload shape.
347
+ */
348
+ includeResponseHeaders?: boolean;
241
349
  }
242
350
  /**
243
351
  * Cache Entry
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../api-client/src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;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CAAC,KAAK,CAAC,CAAC;KACpE,CAAC;IAEF;;OAEG;IACH,YAAY,EAAE;QACZ;;WAEG;QACH,MAAM,EAAE,CACN,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,WAAW,CAAC,CAAC;QAE1B;;WAEG;QACH,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;KACrE,CAAC;IAEF;;OAEG;IACH,QAAQ,EAAE;QACR;;WAEG;QACH,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KACxD,CAAC;IAEF;;OAEG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IAE9E;;OAEG;IACH,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvE;;OAEG;IACH,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB"}
@@ -1,4 +1,4 @@
1
- import { e, B, v } from "./index-BBfuUaLw.js";
1
+ import { e, B, v } from "./index-BOedIhUN.js";
2
2
  export {
3
3
  e as buildDate,
4
4
  B as default,
@@ -1 +1 @@
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).BasisTheory={})}(this,function(e){"use strict";const t=[/cardnumber/i,/^pan$/i,/accountnumber/i,/^number$/i],r=[/cvv/i,/cvc/i,/cvv2/i,/securitycode/i,/pin/i,/password/i,/secret/i,/token/i,/ssn/i,/track/i],n=e=>t.some(t=>t.test(e)),o=e=>r.some(t=>t.test(e)),a=e=>{const t=e.replace(/\D/g,"");if(t.length<10)return"***";const r=t.substring(0,6),n=t.substring(t.length-4),o=Math.max(t.length-10,6);return`${r}${"*".repeat(o)}${n}`},i=e=>{const t=e.replace(/[\s-]/g,"");return/^\d{13,19}$/.test(t)},s=(e,t)=>null==t?t:"function"==typeof t?"[Function]":"symbol"==typeof t?"[Symbol]":t instanceof RegExp?"[RegExp]":t instanceof Date?t:n(e)?"string"==typeof t?a(t):"***":o(e)?"***":"string"==typeof t&&i(t)?a(t):t,d=(e,t=0,r=new WeakSet)=>{if(t>=5)return"[Max Depth]";if(null==e)return e;if("string"==typeof e)return i(e)?a(e):e;if("object"!=typeof e)return e;if(e instanceof RegExp)return"[RegExp]";if(e instanceof Date)return e;if(r.has(e))return"[Circular]";let n;if(r.add(e),Array.isArray(e))n=e.map(e=>d(e,t+1,r));else{const o={};for(const[n,a]of Object.entries(e)){const e=s(n,a);o[n]=null!==e&&"object"==typeof e?d(e,t+1,r):e}n=o}return r.delete(e),n},l=(e,t)=>t?(t,r)=>{const a=(()=>{const e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}.${String(e.getMilliseconds()).padStart(3,"0")}`})(),i=r?(e=>{const t={};for(const[r,a]of Object.entries(e))if(n(r)||o(r)){const e="string"==typeof a?a.length:"number"==typeof a?String(a).length:0;t[`${r}_length`]=e}else t[r]=d(a);return t})(r):{};console.log(`🔍 [${a}] [${e}] ${t}`,i)}:()=>{},u=(e,t,r)=>{const n=new Error(t);return n.name="BasisTheoryError",n.code=e,n.details=r,Error.captureStackTrace&&Error.captureStackTrace(n,u),n.toJSON=()=>({name:n.name,code:n.code,message:n.message,...n.details&&{details:n.details}}),n},m=(e,t,r)=>{const n=u(e,t,r);return n.name="BasisTheoryError",n},c=(e,t,r)=>{const n=u("VALIDATION_ERROR",e,r);return n.name="ValidationError",n.field=t,n},f=(e,t,r)=>{const n=u("ELEMENT_ERROR",e,t?{elementId:t,...r}:r);return n.name="ElementError",n.elementId=t,n},h=(e,t)=>{const r=u("CONFIGURATION_ERROR",e,t);return r.name="ConfigurationError",r},p={maxRetries:2,initialDelay:500,maxDelay:3e3,backoffFactor:2},g=(e,t)=>{const r=t.initialDelay*Math.pow(t.backoffFactor,e);return Math.min(r,t.maxDelay)},y=e=>new Promise(t=>setTimeout(t,e)),b=(e,t)=>{const r=new Map,n=new Map,o=l("PostMessageClient",t.debug||!1),a=a=>{const{nonce:i,type:s,payload:d,error:l}=a.data||{};if(!s)return;if(a.origin!==t.targetOrigin)return void o("Rejected message (origin mismatch)",{receivedOrigin:a.origin,expectedOrigin:t.targetOrigin,messageType:s});if(a.source!==e.contentWindow)return;if(i){const e=r.get(i);if(e){if(o("Message received",{origin:a.origin,expectedOrigin:t.targetOrigin,type:s,nonce:i}),clearTimeout(e.timeout),r.delete(i),l){const t=m(l.code,`[${l.code}] ${l.message}`);Object.assign(t,{...void 0!==l.status&&{status:l.status},...void 0!==l.statusCode&&{statusCode:l.statusCode},...l.validationErrors&&{validationErrors:l.validationErrors},...l.body&&{body:l.body},...void 0!==l.retryCount&&{retryCount:l.retryCount},...l.details&&{details:l.details}}),e.reject(t)}else e.resolve(d);return}return}const u=n.get(s);u&&u.size>0?(o("Event received",{origin:a.origin,expectedOrigin:t.targetOrigin,type:s,nonce:i,subscriberCount:u.size}),u.forEach(e=>{try{e(d)}catch(r){t.debug&&console.error(`[PostMessage Client] Error in event subscriber for ${s}:`,r)}})):i||o("Event received but no subscribers",{type:s,availableSubscribers:Array.from(n.keys())})};window.addEventListener("message",a);const i="number"==typeof t.retries?{...p,maxRetries:t.retries}:"object"==typeof t.retries?t.retries:p,s=(n,a)=>new Promise((i,s)=>{const d=crypto.randomUUID(),l=Date.now();if(!e.contentWindow)return void s(m("IFRAME_NOT_READY","Iframe not ready"));const u=setTimeout(()=>{r.delete(d),s(m("REQUEST_TIMEOUT",`Request timeout: ${n} (${t.timeout||5e3}ms)`))},t.timeout||5e3);r.set(d,{resolve:i,reject:s,timeout:u,timestamp:l}),o("Sending request",{type:n,nonce:d}),e.contentWindow.postMessage({type:n,nonce:d,timestamp:l,payload:a},t.targetOrigin)});return{sendRequest:async(e,t)=>{let r=null;for(let a=0;a<=i.maxRetries;a++)try{return await s(e,t)}catch(n){r=n;const e=n.message;if(e.startsWith("[HANDLER_ERROR]")||"Client destroyed"===e||"Iframe not ready"===e)throw o("Not retrying error",{error:e,reason:"Non-retriable error"}),n;if(a<i.maxRetries){const t=g(a,i);o("Retrying request",{attempt:a+1,maxRetries:i.maxRetries,delayMs:t,error:e}),await y(t)}}throw r||new Error(`Request failed after ${i.maxRetries} retries: ${e}`)},ping:async(n=1e3)=>{const a=Date.now();o("Starting health check",{timeoutMs:n,iframeReady:!!e.contentWindow,targetOrigin:t.targetOrigin});try{await s("SYS_PING",void 0);const e=Date.now()-a;return o("Health check passed",{latencyMs:e}),e}catch(i){const e=`Health check failed after ${Date.now()-a}ms: ${i.message}. Target: ${t.targetOrigin}`;throw t.debug&&(o(`❌ [PostMessage Client] ${e}`),o(`📊 [PostMessage Client] Pending requests: ${r.size}`)),m("HEALTH_CHECK_FAILED",e)}},subscribe:(e,t)=>(n.has(e)||n.set(e,new Set),n.get(e).add(t),()=>{const r=n.get(e);r&&(r.delete(t),0===r.size&&n.delete(e))}),destroy:()=>{window.removeEventListener("message",a),r.forEach(({timeout:e,reject:t})=>{clearTimeout(e),t(m("CLIENT_DESTROYED","Client destroyed"))}),r.clear(),n.clear()},getPendingCount:()=>r.size}},w=e=>{const t=document.createElement("iframe");return t.src=e.src,t.setAttribute("sandbox",e.sandbox),t.title=e.title,t.setAttribute("allow","payment *"),t.setAttribute("importance","high"),t.style.opacity="0",t},E=e=>{const{elementType:t,elementId:r,client:n,eventTarget:o}=e,a=(e,n)=>{const a=new CustomEvent(e,{detail:{elementType:t,elementId:r,timestamp:Date.now(),...n}});o.dispatchEvent(a)};return{setupSubscriptions:()=>{n.subscribe("EVENT_READY",()=>{a("ready",{})}),n.subscribe("EVENT_VALUE_CHANGED",e=>{const r={isValid:e.isValid,isEmpty:e.isEmpty,error:e.error||null};if("cardNumber"===t){const t={...r,cardBrand:e.cardBrand,last4:e.last4,bin:e.bin,cvvLengths:e.cvvLengths,potentialBrands:e.potentialBrands,matchStrength:e.matchStrength};a("change",t)}else a("change","card"===t?{...r,cardBrand:e.cardBrand,last4:e.last4,bin:e.bin,errors:e.errors||null}:r)}),n.subscribe("EVENT_FOCUS",()=>{a("focus",{})}),n.subscribe("EVENT_BLUR",()=>{a("blur",{})}),n.subscribe("EVENT_ERROR",e=>{a("error",{code:e.code,message:e.message,status:e.status,validationErrors:e.validationErrors,metadata:e.metadata||{}})})},dispatchError:(e,t,r)=>{a("error",{code:e,message:t,metadata:{source:"initialization",originalError:r}})}}},v=(e,t,r={},n,o)=>{let a=null,i=null,s=null,d=!1,l=null,u=null;const m=new EventTarget,c=n,h="cardNumber";return{id:c,type:h,get mounted(){return d},mount:async n=>{if(d)throw f("Element is already mounted");if(l="string"==typeof n?document.querySelector(n):n,!l)throw f(`Container not found: ${n}`);const p=window.location.origin,g=new URL(`${t.elementsBaseUrl}/card-number.html`);g.searchParams.set("parentOrigin",p),g.searchParams.set("elementId",c),g.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),g.searchParams.set("debug",String(t.debug||!1)),a=w({src:g.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Card Number Input"}),a.setAttribute("data-bt-element-id",c),a.setAttribute("data-theme-mode",t.themeMode||"auto"),i=b(a,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),s={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},i&&(u=E({elementType:h,elementId:c,client:i,eventTarget:m}),u.setupSubscriptions());const y=new Promise((e,r)=>{const n=setTimeout(()=>{r(f(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,c,{elementType:h,timeoutMs:t.timeoutMs}))},t.timeoutMs);m.addEventListener("ready",()=>{clearTimeout(n),e()},{once:!0})});s.mount(l,a,{timeoutMs:t.timeoutMs}),d=!0;try{await o(),await y,await i.sendRequest("CMD_SET_CONFIG",{elementId:c,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,debug:t.debug}),a&&(a.style.opacity="1")}catch(v){throw u&&u.dispatchError("MOUNT_ERROR",v.message,v),d=!1,i&&(i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,v}},unmount:()=>{if(!d)throw f("Element is not mounted");i&&(i.sendRequest("CMD_CLEAR_CACHE",{}).catch(e=>{e.message}),i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,d=!1},update:async e=>{if(!d||!i)throw f("Element must be mounted before updating");const r={placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly};void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await i.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!i)throw f("Element must be mounted before focusing");i.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!i)throw f("Element must be mounted before blurring");i.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!i)throw f("Element must be mounted before clearing");i.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(m.addEventListener(e,t),()=>m.removeEventListener(e,t))}},M=(e,t,r={},n,o)=>{let a=null,i=null,s=null,d=!1,l=null,u=null;const m=new EventTarget,c=n,h="cvv";return{id:c,type:h,get mounted(){return d},mount:async n=>{if(d)throw f("Element is already mounted",c);if(l="string"==typeof n?document.querySelector(n):n,!l)throw f(`Container not found: ${n}`);const p=window.location.origin,g=new URL(`${t.elementsBaseUrl}/cvv.html`);g.searchParams.set("parentOrigin",p),g.searchParams.set("elementId",c),g.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),g.searchParams.set("debug",String(t.debug||!1)),a=w({src:g.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"CVV Input"}),a.setAttribute("data-bt-element-id",c),i=b(a,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),s={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},i&&(u=E({elementType:h,elementId:c,client:i,eventTarget:m}),u.setupSubscriptions());const y=new Promise((e,r)=>{const n=setTimeout(()=>{r(f(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,c,{elementType:h,timeoutMs:t.timeoutMs}))},t.timeoutMs);m.addEventListener("ready",()=>{clearTimeout(n),e()},{once:!0})});s.mount(l,a,{timeoutMs:t.timeoutMs}),d=!0;try{await o(),await y,await i.sendRequest("CMD_SET_CONFIG",{elementId:c,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,showToggle:r.showToggle,debug:t.debug}),a&&(a.style.opacity="1")}catch(v){throw u&&u.dispatchError("MOUNT_ERROR",v.message,v),d=!1,i&&(i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,v}},unmount:()=>{if(!d)throw f("Element is not mounted");i&&(i.sendRequest("CMD_CLEAR_CACHE",{}).catch(e=>{e.message}),i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,d=!1},update:async e=>{if(!d||!i)throw f("Element must be mounted before updating",c);const r={placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly,cardBrand:e.cardBrand,cvvLengths:e.cvvLengths};void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await i.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!i)throw f("Element must be mounted before focusing",c);i.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!i)throw f("Element must be mounted before blurring",c);i.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!i)throw f("Element must be mounted before clearing",c);i.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(m.addEventListener(e,t),()=>m.removeEventListener(e,t))}},R=(e,t,r={},n,o)=>{let a=null,i=null,s=null,d=!1,l=null,u=null;const m=new EventTarget,c=n,h="expiry";return{id:c,type:h,get mounted(){return d},mount:async n=>{if(d)throw f("Element is already mounted",c);if(l="string"==typeof n?document.querySelector(n):n,!l)throw f(`Container not found: ${n}`);const p=window.location.origin,g=new URL(`${t.elementsBaseUrl}/expiry.html`);g.searchParams.set("parentOrigin",p),g.searchParams.set("elementId",c),g.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),g.searchParams.set("debug",String(t.debug||!1)),a=w({src:g.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Expiry Date Input"}),a.setAttribute("data-bt-element-id",c),i=b(a,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),s={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},i&&(u=E({elementType:h,elementId:c,client:i,eventTarget:m}),u.setupSubscriptions());const y=new Promise((e,r)=>{const n=setTimeout(()=>{r(f(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,c,{elementType:h,timeoutMs:t.timeoutMs}))},t.timeoutMs);m.addEventListener("ready",()=>{clearTimeout(n),e()},{once:!0})});s.mount(l,a,{timeoutMs:t.timeoutMs}),d=!0;try{await o(),await y,await i.sendRequest("CMD_SET_CONFIG",{elementId:c,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,debug:t.debug}),a&&(a.style.opacity="1")}catch(v){throw u&&u.dispatchError("MOUNT_ERROR",v.message,v),d=!1,i&&(i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,v}},unmount:()=>{if(!d)throw f("Element is not mounted");i&&(i.sendRequest("CMD_CLEAR_CACHE",{}).catch(e=>{e.message}),i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,d=!1},update:async e=>{if(!d||!i)throw f("Element must be mounted before updating",c);const r={placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly};void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await i.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!i)throw f("Element must be mounted before focusing",c);i.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!i)throw f("Element must be mounted before blurring",c);i.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!i)throw f("Element must be mounted before clearing",c);i.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(m.addEventListener(e,t),()=>m.removeEventListener(e,t))}},C=(e,t,r={},n,o)=>{let a=null,i=null,s=null,d=!1,l=null,u=null;const m=new EventTarget,c=n,h="text";if(r.transform&&!(Array.isArray(r.transform)&&2===r.transform.length&&r.transform[0]instanceof RegExp&&"string"==typeof r.transform[1]))throw new TypeError('transform must be a tuple of [RegExp, string]. Example: [/-/g, ""]');return{id:c,type:h,get mounted(){return d},mount:async n=>{if(d)throw f("Element is already mounted",c);if(l="string"==typeof n?document.querySelector(n):n,!l)throw f(`Container not found: ${n}`);const p=window.location.origin,g=new URL(`${t.elementsBaseUrl}/text.html`);g.searchParams.set("parentOrigin",p),g.searchParams.set("elementId",c),g.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),g.searchParams.set("debug",String(t.debug||!1)),a=w({src:g.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Text Input"}),a.setAttribute("data-bt-element-id",c),i=b(a,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),s={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},i&&(u=E({elementType:h,elementId:c,client:i,eventTarget:m}),u.setupSubscriptions());const y=new Promise((e,r)=>{const n=setTimeout(()=>{r(f(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,c,{elementType:h,timeoutMs:t.timeoutMs}))},t.timeoutMs);m.addEventListener("ready",()=>{clearTimeout(n),e()},{once:!0})});s.mount(l,a,{timeoutMs:t.timeoutMs}),d=!0;try{await o(),await y;const n=r.transform?{pattern:r.transform[0].source,flags:r.transform[0].flags,replacement:r.transform[1]}:void 0,s=r.mask?r.mask.map(e=>"string"==typeof e?e:e instanceof RegExp?{source:e.source,flags:e.flags}:e):void 0;await i.sendRequest("CMD_SET_CONFIG",{elementId:c,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,validation:r.validation,required:r.required,maxLength:r.maxLength,password:r.password,inputMode:r.inputMode,mask:s,transform:n,debug:t.debug}),a&&(a.style.opacity="1")}catch(v){throw u&&u.dispatchError("MOUNT_ERROR",v.message,v),d=!1,i&&(i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,v}},unmount:()=>{if(!d)throw f("Element is not mounted");i&&(i.sendRequest("CMD_CLEAR_CACHE",{}).catch(e=>{e.message}),i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,d=!1},update:async e=>{if(!d||!i)throw f("Element must be mounted before updating",c);const r={placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly,required:e.required,maxLength:e.maxLength,password:e.password,inputMode:e.inputMode};void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await i.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!i)throw f("Element must be mounted before focusing",c);i.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!i)throw f("Element must be mounted before blurring",c);i.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!i)throw f("Element must be mounted before clearing",c);i.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(m.addEventListener(e,t),()=>m.removeEventListener(e,t))}},T=e=>{if((e=>null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)(e))return e;if((e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"function"==typeof t.mount&&"function"==typeof t.update&&"function"==typeof t.on})(e)){if(!e.id)throw f("Element is missing id property. Ensure createElement is called after the SDK loads and all elements are mounted before calling tokenize().");return e.id}if(Array.isArray(e))return e.map(T);if("object"==typeof e&&null!==e){const t={};for(const[r,n]of Object.entries(e))t[r]=T(n);return t}return e},x={colors:{primary:"#3b82f6",error:"#ef4444",success:"#10b981",text:{primary:"#1f2937",secondary:"#6b7280",placeholder:"#9ca3af",disabled:"#d1d5db"},background:{default:"#ffffff",hover:"#f9fafb",focus:"#eff6ff",disabled:"#f9fafb"},border:{default:"#d1d5db",hover:"#9ca3af",focus:"#3b82f6",error:"#ef4444"}},typography:{fontFamily:'"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:{sm:"14px",base:"16px",lg:"18px"},fontWeight:{normal:"400",medium:"500",semibold:"600"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},spacing:{xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px"},borders:{radius:{none:"0",sm:"2px",base:"4px",md:"6px",lg:"8px",full:"9999px"},width:{thin:"1px",base:"2px",thick:"3px"}},shadows:{none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",focus:"0 0 0 3px rgba(59, 130, 246, 0.1)"},transitions:{fast:"150ms cubic-bezier(0.4, 0, 0.2, 1)",base:"200ms cubic-bezier(0.4, 0, 0.2, 1)",slow:"300ms cubic-bezier(0.4, 0, 0.2, 1)"}},O=e=>{var t,r,n,o,a,i,s,d,l,u,m;return e?{colors:{primary:(null==(t=e.colors)?void 0:t.primary)??x.colors.primary,error:(null==(r=e.colors)?void 0:r.error)??x.colors.error,success:(null==(n=e.colors)?void 0:n.success)??x.colors.success,text:{...x.colors.text,...null==(o=e.colors)?void 0:o.text},background:{...x.colors.background,...null==(a=e.colors)?void 0:a.background},border:{...x.colors.border,...null==(i=e.colors)?void 0:i.border}},typography:{...x.typography,...e.typography,fontSize:{...x.typography.fontSize,...null==(s=e.typography)?void 0:s.fontSize},fontWeight:{...x.typography.fontWeight,...null==(d=e.typography)?void 0:d.fontWeight},lineHeight:{...x.typography.lineHeight,...null==(l=e.typography)?void 0:l.lineHeight}},spacing:{...x.spacing,...e.spacing},borders:{radius:{...x.borders.radius,...null==(u=e.borders)?void 0:u.radius},width:{...x.borders.width,...null==(m=e.borders)?void 0:m.width}},shadows:{...x.shadows,...e.shadows},transitions:{...x.transitions,...e.transitions}}:x},k=(e,t,r,n)=>{for(const o of Object.keys(t))r.has(o)||((null==n?void 0:n.has(o))?console.warn(`[BasisTheory] Deprecated option "${o}" in ${e}. ${n.get(o)}`):console.warn(`[BasisTheory] Unknown option "${o}" in ${e}. This option will be ignored. See https://developers.basistheory.com/docs/ for supported options.`))},_=new Set(["elementsBaseUrl","apiBaseUrl","debug","measurePerformance","timeoutMs","retryConfig","themeMode","theme","darkTheme"]),S=new Map([["iframeOrigin",'Use "elementsBaseUrl" instead.']]),D=new Set(["placeholder","ariaLabel","disabled","readOnly"]),I={cardNumber:new Set([...D]),cvv:new Set([...D,"cardBrand","cvvLengths"]),expiry:new Set([...D]),text:new Set([...D,"validation","required","maxLength","password","inputMode","mask","transform"]),card:new Set([...D,"layout","stackAt","iconPosition","cardBrands"])},A=(e,t={},r)=>{(e=>{if(!e||"string"!=typeof e||0===e.trim().length)throw h("API key is required")})(e);const n=((e={})=>{var t,r,n;k("SDKOptions",e,_,S);const o=e.elementsBaseUrl||e.iframeOrigin;if(void 0!==o){if("string"!=typeof o||0===o.trim().length)throw h("elementsBaseUrl must be a non-empty string");try{new URL(o)}catch{throw h("elementsBaseUrl must be a valid URL")}}if(void 0!==e.apiBaseUrl){if("string"!=typeof e.apiBaseUrl||0===e.apiBaseUrl.trim().length)throw h("apiBaseUrl must be a non-empty string");try{new URL(e.apiBaseUrl)}catch{throw h("apiBaseUrl must be a valid URL")}}if(void 0!==e.debug&&"boolean"!=typeof e.debug)throw h("debug must be a boolean");if(void 0!==e.measurePerformance&&"boolean"!=typeof e.measurePerformance)throw h("measurePerformance must be a boolean");if(void 0!==e.timeoutMs&&("number"!=typeof e.timeoutMs||e.timeoutMs<=0))throw h("timeoutMs must be a positive number");const a={maxRetries:(null==(t=e.retryConfig)?void 0:t.maxRetries)??3,delayMs:(null==(r=e.retryConfig)?void 0:r.delayMs)??1e3,backoffFactor:(null==(n=e.retryConfig)?void 0:n.backoffFactor)??2};if("number"!=typeof a.maxRetries||a.maxRetries<0)throw h("maxRetries must be a non-negative number");if("number"!=typeof a.delayMs||a.delayMs<=0)throw h("retryConfig.delayMs must be a positive number");if("number"!=typeof a.backoffFactor||a.backoffFactor<1)throw h("retryConfig.backoffFactor must be >= 1");const i=e.themeMode||"auto";if(!["light","dark","auto"].includes(i))throw h('themeMode must be "light", "dark", or "auto"');const s=o||"https://js.basistheory.com/3.0.0-beta.3/elements";return{iframeOrigin:new URL(s).origin,elementsBaseUrl:s,apiBaseUrl:e.apiBaseUrl,debug:e.debug??!1,measurePerformance:e.measurePerformance??!1,timeoutMs:e.timeoutMs||3e4,themeMode:i,theme:O(e.theme),darkTheme:e.darkTheme?O(e.darkTheme):void 0,retryConfig:a}})(t),o=l("SDK",n.debug||!1);o("SDK initialized",{apiKeyPrefix:e.substring(0,7)+"...",elementsBaseUrl:n.elementsBaseUrl,iframeOrigin:n.iframeOrigin,debug:n.debug||!1});const a=new Map;let i=null,s=null,d=null,m=!1,p=t.themeMode||"auto",g=null;const y={cardNumber:v,cvv:M,expiry:R,text:C},w={card:async()=>{if(!g){const e=await Promise.resolve().then(()=>L);g=e.createCardElement}return g}},E=()=>d||(m||(m=!0,d=x()),d),x=async()=>{if(i)return void o("Coordinator already initialized",{loaded:null!==i.contentWindow});o("Initializing coordinator iframe",{elementsBaseUrl:n.elementsBaseUrl}),i=document.createElement("iframe"),i.setAttribute("name","bt-coordinator"),i.setAttribute("title","BasisTheory Coordinator"),i.setAttribute("role","none"),i.style.border="none",i.style.width="0",i.style.height="0",i.style.position="absolute",i.style.top="-9999px",i.style.left="-9999px";const t=n.elementsBaseUrl.endsWith("/")?n.elementsBaseUrl:`${n.elementsBaseUrl}/`,r=new URL("coordinator.html",t);r.searchParams.set("parentOrigin",window.location.origin),i.src=r.toString(),document.body.appendChild(i),o("Coordinator iframe mounted",{url:i.src}),await new Promise((e,t)=>{const r=setTimeout(()=>{t(new Error(`Coordinator load timeout (${n.timeoutMs}ms). Try increasing timeoutMs for slow connections.`))},n.timeoutMs);i.addEventListener("load",()=>{clearTimeout(r),o("Coordinator iframe loaded"),e()},{once:!0})}),s=b(i,{targetOrigin:new URL(n.elementsBaseUrl).origin,timeout:3e4,retries:3,debug:n.debug||!1}),o("Coordinator PostMessage client created"),await s.sendRequest("CMD_SET_CONFIG",{apiKey:e,apiBaseUrl:n.apiBaseUrl,apiTimeout:3e4,apiRetries:3,debug:n.debug||!1,theme:n.theme,darkTheme:n.darkTheme,themeMode:n.themeMode}),o("Coordinator initialized successfully")},D={createElement:(t,r)=>{const s=y[t],d=w[t];if(!s&&!d)throw h(`Unknown element type: ${t}`);r&&((e,t={})=>{if(k(`ElementOptions (${e})`,t,I[e]),void 0!==t.placeholder)if("card"===e){if("object"!=typeof t.placeholder||null===t.placeholder)throw h("placeholder for card element must be an object with cardNumber, expiryDate, and cvv keys")}else if("string"!=typeof t.placeholder)throw h("placeholder must be a string");if(void 0!==t.disabled&&"boolean"!=typeof t.disabled)throw h("disabled must be a boolean");if(void 0!==t.readOnly&&"boolean"!=typeof t.readOnly)throw h("readOnly must be a boolean");if(void 0!==t.ariaLabel&&"string"!=typeof t.ariaLabel)throw h("ariaLabel must be a string");if("text"===e){if(void 0!==t.maxLength&&("number"!=typeof t.maxLength||t.maxLength<=0))throw h("maxLength must be a positive number");if(void 0!==t.password&&"boolean"!=typeof t.password)throw h("password must be a boolean");if(void 0!==t.required&&"boolean"!=typeof t.required)throw h("required must be a boolean");if(void 0!==t.validation&&!(t.validation instanceof RegExp))throw h("validation must be a RegExp");if(t.transform&&!(Array.isArray(t.transform)&&2===t.transform.length&&t.transform[0]instanceof RegExp&&"string"==typeof t.transform[1]))throw h('transform must be a tuple of [RegExp, string]. Example: [/-/g, ""]')}if("card"===e){const e=t;if(void 0!==e.layout&&!["row","column","auto"].includes(e.layout))throw h('layout must be "row", "column", or "auto"');if(void 0!==e.stackAt&&("number"!=typeof e.stackAt||e.stackAt<=0))throw h("stackAt must be a positive number");if(void 0!==e.iconPosition&&!["left","right","none"].includes(e.iconPosition))throw h('iconPosition must be "left", "right", or "none"');if(void 0!==e.cardBrands){if(!Array.isArray(e.cardBrands))throw h("cardBrands must be an array of strings");if(e.cardBrands.some(e=>"string"!=typeof e))throw h("All cardBrands must be strings")}}})(t,r);const l=`${t}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;let u;if(o("Creating element (sync)",{type:t,elementId:l,coordinatorInitialized:null!==i,isLazyLoaded:!!d}),s)u=s(e,n,r,l,E);else{let o=null,a=null;const i=async()=>{a||(a=(async()=>{const t=await d();o=t(e,n,r,l,E)})()),await a};u={id:l,type:t,get mounted(){return(null==o?void 0:o.mounted)??!1},get fields(){return null==o?void 0:o.fields},mount:async e=>(await i(),o.mount(e)),unmount:()=>{if(!o)throw f("Element not initialized");return o.unmount()},update:async e=>{if(!o)throw f("Element not initialized");return o.update(e)},focus:()=>{if(!o)throw f("Element not initialized");return o.focus()},blur:()=>{if(!o)throw f("Element not initialized");return o.blur()},clear:()=>{if(!o)throw f("Element not initialized");return o.clear()},on:(e,t)=>o?o.on(e,t):(i().then(()=>o.on(e,t)),()=>{})}}return a.set(u.id,u),"cardNumber"===t&&u.on("change",e=>{const{cardBrand:t,cvvLengths:r}=e.detail;if(o("Card number change event received",{cardBrand:t,cvvLengths:r,cvvElementsCount:Array.from(a.values()).filter(e=>"cvv"===e.type).length}),t&&"Unknown"!==t&&r)for(const[n,i]of a)"cvv"===i.type&&i.mounted&&(o("Coordinating CVV element with card brand",{cvvElementId:n,cardBrand:t,cvvLengths:r,mounted:i.mounted}),i.update({cardBrand:t,cvvLengths:r}).catch(e=>{o("Failed to update CVV element with card brand",{cvvElementId:n,cardBrand:t,error:e.message})}))}),u},tokenize:async(e,t)=>{if(o("tokenize called",{hasPayload:!!e,hasOptions:!!t,coordinatorReady:!!s}),s||(o("Waiting for coordinator initialization"),await x()),!s)throw(()=>{const e=u("COORDINATOR_ERROR","Coordinator failed to initialize",void 0);return e.name="CoordinatorError",e})();try{const r=e?T(e):{};o("Element references resolved",{originalPayload:!!e,resolvedPayload:!!r}),o("Delegating tokenization to coordinator");const n=await s.sendRequest("CMD_TOKENIZE",{payload:r,options:t});return o("tokenize successful",{tokenId:n.id}),n}catch(r){throw o("tokenize failed",{error:r.message}),r}},tokens:{create:async e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw c("Token data must be a non-null object");if(o("tokens.create called",{type:e.type,hasData:!!e.data}),s||(o("Waiting for coordinator initialization"),await x()),!s)throw new Error("Coordinator failed to initialize");try{const t={...e,data:T(e.data)};o("Element references resolved for tokens.create",{resolvedData:!!t});const r=await s.sendRequest("CMD_TOKENS_CREATE",{data:t});return o("tokens.create successful",{tokenId:r.id}),r}catch(t){throw o("tokens.create failed",{error:t.message}),t}},retrieve:async(e,t)=>{if(o("tokens.retrieve called",{tokenId:e,hasSessionKey:!!(null==t?void 0:t.apiKey)}),s||await x(),!s)throw new Error("Coordinator failed to initialize");try{const r=await s.sendRequest("CMD_TOKENS_RETRIEVE",{id:e,apiKey:null==t?void 0:t.apiKey});return o("tokens.retrieve successful",{tokenId:r.id}),r}catch(r){throw o("tokens.retrieve failed",{error:r.message}),r}},update:async(e,t)=>{if(o("tokens.update called",{tokenId:e}),s||await x(),!s)throw new Error("Coordinator failed to initialize");try{const r=t.data?{...t,data:T(t.data)}:t,n=await s.sendRequest("CMD_TOKENS_UPDATE",{id:e,data:r});return o("tokens.update successful",{tokenId:n.id}),n}catch(r){throw o("tokens.update failed",{error:r.message}),r}},encrypt:async(e,t,r)=>{if(o("tokens.encrypt called",{isSingleToken:"type"in e&&"data"in e,keyId:r}),!e||"object"!=typeof e)throw c("tokenData must be an object");if(!t||"string"!=typeof t)throw c("publicKeyPEM is required");if(!r||"string"!=typeof r)throw c("keyId is required");if(s||await x(),!s)throw new Error("Coordinator failed to initialize");try{const n=T(e);o("Element references resolved for tokens.encrypt",{originalData:!!e,resolvedData:!!n});const a=await s.sendRequest("CMD_TOKENS_ENCRYPT",{tokenRequests:n,publicKeyPEM:t,keyId:r});return o("tokens.encrypt successful",{isSingleToken:"encrypted"in a&&"type"in a}),a}catch(n){throw o("tokens.encrypt failed",{error:n.message}),n}}},sessions:{create:async()=>{if(o("sessions.create called"),s||await x(),!s)throw new Error("Coordinator failed to initialize");try{const e=await s.sendRequest("CMD_SESSIONS_CREATE",{});return o("sessions.create successful",{nonce:e.nonce,expiresAt:e.expires_at}),e}catch(e){throw o("sessions.create failed",{error:e.message}),e}}},tokenIntents:{create:async(e,t)=>{if(o("tokenIntents.create called",{type:e.type,hasData:!!e.data,hasOptions:!!t}),s||await x(),!s)throw new Error("Coordinator failed to initialize");try{const r=T(e.data);o("Element references resolved for token intent");const n=await s.sendRequest("CMD_TOKEN_INTENTS_CREATE",{type:e.type,data:r,options:t});return o("tokenIntents.create successful",{intentId:n.id}),n}catch(r){throw o("tokenIntents.create failed",{error:r.message}),r}},get:async(e,t)=>{if(o("tokenIntents.get called",{intentId:e}),s||await x(),!s)throw new Error("Coordinator failed to initialize");try{const r=await s.sendRequest("CMD_TOKEN_INTENTS_GET",{id:e,options:t});return o("tokenIntents.get successful",{intentId:r.id}),r}catch(r){throw o("tokenIntents.get failed",{error:r.message}),r}}},updateThemeMode:async e=>{o("updateThemeMode called",{oldMode:p,newMode:e,mountedElements:Array.from(a.values()).filter(e=>e.mounted).length}),p=e;const t=[];for(const[r,n]of a)if(n.mounted){o("Sending theme mode update to element",{elementId:r,elementType:n.type,mode:e});const a=document.querySelector(`iframe[data-bt-element-id="${n.id}"]`);a&&a.setAttribute("data-theme-mode",e);const i=n.update({themeMode:e}).catch(e=>{o("Failed to update theme mode for element",{elementId:r,error:e.message})});t.push(i)}await Promise.all(t),o("Theme mode updated for all mounted elements",{mode:e,updatedCount:Array.from(a.values()).filter(e=>e.mounted).length})}};if(r&&r.length>0){o("Draining command queue from loader",{queueLength:r.length,commands:r.map(e=>e.method)});for(const e of r)try{const t=D[e.method];if(!t)throw new Error(`Unknown method: ${e.method}`);o("Replaying queued command",{method:e.method,argsCount:e.args.length});const r=t(...e.args);r&&"function"==typeof r.then?r.then(t=>{o("Queued command completed (async)",{method:e.method}),e.resolve(t)}).catch(t=>{o("Queued command failed (async)",{method:e.method,error:t.message}),e.reject(t)}):(o("Queued command completed (sync)",{method:e.method}),e.resolve(r))}catch(A){o("Queued command failed (sync)",{method:e.method,error:A.message}),e.reject(A)}o("Command queue drain complete",{processedCount:r.length})}return D};"undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript&&!window.BasisTheory&&(window.BasisTheory=A),"undefined"!=typeof window&&(window.__BasisTheorySDK__=A);const L=Object.freeze(Object.defineProperty({__proto__:null,createCardElement:(e,t,r={},n,o)=>{let a=null,i=null,s=null,d=!1,l=null,u=null;const m=new EventTarget,c=n,h="card",p=e=>({id:e,type:"card",get mounted(){return d},mount:()=>{throw f("Sub-field refs cannot be mounted independently")},unmount:()=>{},update:()=>Promise.resolve(),focus:()=>{},blur:()=>{},clear:()=>{},on:()=>()=>{}});return{id:c,type:h,get mounted(){return d},fields:{number:p(`${c}__number`),expiryDate:p(`${c}__expiry`),cvc:p(`${c}__cvc`)},mount:async n=>{if(d)throw f("Element is already mounted");if(l="string"==typeof n?document.querySelector(n):n,!l)throw f(`Container not found: ${n}`);const p=window.location.origin,g=new URL(`${t.elementsBaseUrl}/card.html`);g.searchParams.set("parentOrigin",p),g.searchParams.set("elementId",c),g.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),g.searchParams.set("debug",String(t.debug||!1)),a=w({src:g.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Card Input"}),a.setAttribute("data-bt-element-id",c),a.setAttribute("data-theme-mode",t.themeMode||"auto"),i=b(a,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),s={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},i&&(u=E({elementType:h,elementId:c,client:i,eventTarget:m}),u.setupSubscriptions());const y=new Promise((e,r)=>{const n=setTimeout(()=>{r(f(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,c,{elementType:h,timeoutMs:t.timeoutMs}))},t.timeoutMs);m.addEventListener("ready",()=>{clearTimeout(n),e()},{once:!0})});s.mount(l,a,{timeoutMs:t.timeoutMs}),d=!0;try{await o(),await y,await i.sendRequest("CMD_SET_CONFIG",{elementId:c,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,placeholder:r.placeholder,style:r.style,disabled:r.disabled,readOnly:r.readOnly,layout:r.layout||"auto",stackAt:r.stackAt||400,iconPosition:r.iconPosition||"left",cardBrands:r.cardBrands,debug:t.debug}),a&&(a.style.opacity="1")}catch(v){throw u&&u.dispatchError("MOUNT_ERROR",v.message,v),d=!1,i&&(i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,v}},unmount:()=>{if(!d)throw f("Element is not mounted");i&&(i.sendRequest("CMD_CLEAR_CACHE",{}).catch(e=>{e.message}),i.destroy(),i=null),s&&a&&(s.unmount(a),a=null,s=null),u=null,l=null,d=!1},update:async e=>{if(!d||!i)throw f("Element must be mounted before updating");const r=e,n={placeholder:r.placeholder,style:r.style,disabled:r.disabled,readOnly:r.readOnly,layout:r.layout,stackAt:r.stackAt,iconPosition:r.iconPosition,cardBrands:r.cardBrands};void 0!==e.themeMode&&(n.themeMode=e.themeMode,n.theme=t.theme,n.darkTheme=t.darkTheme),await i.sendRequest("CMD_UPDATE_CONFIG",n)},focus:()=>{if(!d||!i)throw f("Element must be mounted before focusing");i.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!i)throw f("Element must be mounted before blurring");i.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!i)throw f("Element must be mounted before clearing");i.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(m.addEventListener(e,t),()=>m.removeEventListener(e,t))}}},Symbol.toStringTag,{value:"Module"}));e.buildDate="2026-04-13T19:51:30.877Z",e.default=A,e.version="3.0.0-beta.3",Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
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).BasisTheory={})}(this,function(e){"use strict";const t=[/cardnumber/i,/^pan$/i,/accountnumber/i,/^number$/i],r=[/cvv/i,/cvc/i,/cvv2/i,/securitycode/i,/pin/i,/password/i,/secret/i,/token/i,/ssn/i,/track/i],o=e=>t.some(t=>t.test(e)),n=e=>r.some(t=>t.test(e)),a=e=>{const t=e.replace(/\D/g,"");if(t.length<10)return"***";const r=t.substring(0,6),o=t.substring(t.length-4),n=Math.max(t.length-10,6);return`${r}${"*".repeat(n)}${o}`},i=e=>{const t=e.replace(/[\s-]/g,"");return/^\d{13,19}$/.test(t)},s=(e,t)=>null==t?t:"function"==typeof t?"[Function]":"symbol"==typeof t?"[Symbol]":t instanceof RegExp?"[RegExp]":t instanceof Date?t:o(e)?"string"==typeof t?a(t):"***":n(e)?"***":"string"==typeof t&&i(t)?a(t):t,l=(e,t=0,r=new WeakSet)=>{if(t>=5)return"[Max Depth]";if(null==e)return e;if("string"==typeof e)return i(e)?a(e):e;if("object"!=typeof e)return e;if(e instanceof RegExp)return"[RegExp]";if(e instanceof Date)return e;if(r.has(e))return"[Circular]";let o;if(r.add(e),Array.isArray(e))o=e.map(e=>l(e,t+1,r));else{const n={};for(const[o,a]of Object.entries(e)){const e=s(o,a);n[o]=null!==e&&"object"==typeof e?l(e,t+1,r):e}o=n}return r.delete(e),o},d=(e,t)=>t?(t,r)=>{const a=(()=>{const e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}.${String(e.getMilliseconds()).padStart(3,"0")}`})(),i=r?(e=>{const t={};for(const[r,a]of Object.entries(e))if(o(r)||n(r)){const e="string"==typeof a?a.length:"number"==typeof a?String(a).length:0;t[`${r}_length`]=e}else t[r]=l(a);return t})(r):{};console.log(`🔍 [${a}] [${e}] ${t}`,i)}:()=>{},u=(e,t,r)=>{const o=new Error(t);return o.name="BasisTheoryError",o.code=e,o.details=r,Error.captureStackTrace&&Error.captureStackTrace(o,u),o.toJSON=()=>({name:o.name,code:o.code,message:o.message,...o.details&&{details:o.details}}),o},m=(e,t,r)=>{const o=u(e,t,r);return o.name="BasisTheoryError",o},c=(e,t,r)=>{const o=u("VALIDATION_ERROR",e,t?{field:t,...r}:r);return o.name="ValidationError",o.field=t,o},f=(e,t)=>{const r=u("COORDINATOR_ERROR",e,t);return r.name="CoordinatorError",r},h=(e,t,r)=>{const o=u("ELEMENT_ERROR",e,t?{elementId:t,...r}:r);return o.name="ElementError",o.elementId=t,o},p=(e,t)=>{const r=u("CONFIGURATION_ERROR",e,t);return r.name="ConfigurationError",r},y=new Set(["https:"]),g=new Set(["GET","POST","PUT","PATCH","DELETE"]),b=new Set(["host","content-length","transfer-encoding","te","trailer","connection","upgrade","keep-alive","proxy-connection","via","proxy-authorization","bt-api-key","bt-proxy-key","bt-proxy-url","bt-idempotency-key","x-forwarded-for","x-forwarded-host","x-real-ip","content-type"]),w=e=>{const t=e.replace(/^\[|\]$/g,"");if(/^(0x[\da-f]+|\d+)$/i.test(t)){const e=t.toLowerCase().startsWith("0x")?parseInt(t,16):parseInt(t,10);return e>=0&&e<=4294967295?[e>>>24&255,e>>>16&255,e>>>8&255,255&e]:null}const r=t.split(".");if(4!==r.length)return null;const o=[];for(const n of r){let e;if(e=n.toLowerCase().startsWith("0x")?parseInt(n,16):n.startsWith("0")&&n.length>1&&!/[89]/.test(n)?parseInt(n,8):parseInt(n,10),isNaN(e)||e<0||e>255)return null;o.push(e)}return o},E=e=>{const t=e[0],r=e[1];return void 0===t||void 0===r||127===t||10===t||172===t&&r>=16&&r<=31||192===t&&168===r||169===t&&254===r||0===t},v=e=>{const t=e.replace(/^\[|\]$/g,"").toLowerCase();if("::1"===t||"0:0:0:0:0:0:0:1"===t||"0000:0000:0000:0000:0000:0000:0000:0001"===t)return!0;if(t.startsWith("fe8")||t.startsWith("fe9")||t.startsWith("fea")||t.startsWith("feb"))return!0;if(t.startsWith("fc")||t.startsWith("fd"))return!0;const r=t.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);if(r){const e=r[1];if(e){const t=w(e);if(t&&E(t))return!0}}const o=t.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);if(o){const e=o[1],t=o[2];if(!e||!t)return!0;const r=parseInt(e,16),n=parseInt(t,16);if(E([r>>>8&255,255&r,n>>>8&255,255&n]))return!0}return!1},T=e=>{if(void 0!==e&&("object"!=typeof e||null===e))throw c("Proxy options must be a plain object","options");if(void 0!==(null==e?void 0:e.method)&&!g.has(e.method))throw c(`Method '${e.method}' is not allowed`,"method");((e,t)=>{const r="string"==typeof e&&e.length>0;if(r===("string"==typeof t&&t.length>0))throw c("Specify exactly one of url or proxyKey","url/proxyKey");r&&(e=>{let t;try{t=new URL(e)}catch{throw c("Invalid URL format","url")}if(!y.has(t.protocol))throw c(`URL scheme '${t.protocol}' is not allowed. Only https: is permitted`,"url");(e=>{const t=e.hostname.toLowerCase();if(e.username||e.password)throw c("URL must not contain userinfo (username/password)","url");if("localhost"===t)throw c("URL must not target localhost","url");if((t.startsWith("[")||v(t))&&v(t))throw c("URL must not target loopback or link-local IPv6 addresses","url");const r=w(t);if(r&&E(r))throw c("URL must not target private or internal IP addresses","url")})(t)})(e)})(null==e?void 0:e.url,null==e?void 0:e.proxyKey),(e=>{if(e)for(const[t,r]of Object.entries(e)){if(/[\r\n]/.test(r))throw c(`Header '${t}' value contains illegal CRLF`,"headers");if(/[\r\n]/.test(t))throw c(`Header name '${t}' contains illegal CRLF`,"headers");if(b.has(t.toLowerCase().trim()))throw c(`Header '${t}' is not allowed in proxy requests`,"headers")}})(null==e?void 0:e.headers)},M={maxRetries:2,initialDelay:500,maxDelay:3e3,backoffFactor:2},R=(e,t)=>{const r=t.initialDelay*Math.pow(t.backoffFactor,e);return Math.min(r,t.maxDelay)},C=e=>new Promise(t=>setTimeout(t,e)),k=(e,t)=>{const r=new Map,o=new Map,n=d("PostMessageClient",t.debug||!1),a=a=>{const{nonce:i,type:s,payload:l,error:d}=a.data||{};if(!s)return;if(a.origin!==t.targetOrigin)return void n("Rejected message (origin mismatch)",{receivedOrigin:a.origin,expectedOrigin:t.targetOrigin,messageType:s});if(a.source!==e.contentWindow)return;if(i){const e=r.get(i);if(e){if(n("Message received",{origin:a.origin,expectedOrigin:t.targetOrigin,type:s,nonce:i}),clearTimeout(e.timeout),r.delete(i),d){const t=m(d.code,`[${d.code}] ${d.message}`);Object.assign(t,{...void 0!==d.status&&{status:d.status},...void 0!==d.statusCode&&{statusCode:d.statusCode},...d.validationErrors&&{validationErrors:d.validationErrors},...d.body&&{body:d.body},...void 0!==d.retryCount&&{retryCount:d.retryCount},...d.details&&{details:d.details}}),e.reject(t)}else e.resolve(l);return}return}const u=o.get(s);u&&u.size>0?(n("Event received",{origin:a.origin,expectedOrigin:t.targetOrigin,type:s,nonce:i,subscriberCount:u.size}),u.forEach(e=>{try{e(l)}catch(r){t.debug&&console.error(`[PostMessage Client] Error in event subscriber for ${s}:`,r)}})):i||n("Event received but no subscribers",{type:s,availableSubscribers:Array.from(o.keys())})};window.addEventListener("message",a);const i="number"==typeof t.retries?{...M,maxRetries:t.retries}:"object"==typeof t.retries?t.retries:M,s=(o,a)=>new Promise((i,s)=>{const l=crypto.randomUUID(),d=Date.now();if(!e.contentWindow)return void s(m("IFRAME_NOT_READY","Iframe not ready"));const u=setTimeout(()=>{r.delete(l),s(m("REQUEST_TIMEOUT",`Request timeout: ${o} (${t.timeout||5e3}ms)`))},t.timeout||5e3);r.set(l,{resolve:i,reject:s,timeout:u,timestamp:d}),n("Sending request",{type:o,nonce:l}),e.contentWindow.postMessage({type:o,nonce:l,timestamp:d,payload:a},t.targetOrigin)});return{sendRequest:async(e,t,r)=>{const o=void 0!==(null==r?void 0:r.retries)?r.retries:i.maxRetries;let a=null;for(let d=0;d<=o;d++)try{return await s(e,t)}catch(l){a=l;const e=l.message;if(e.startsWith("[HANDLER_ERROR]")||"Client destroyed"===e||"Iframe not ready"===e)throw n("Not retrying error",{error:e,reason:"Non-retriable error"}),l;if(d<o){const t=R(d,i);n("Retrying request",{attempt:d+1,maxRetries:o,delayMs:t,error:e}),await C(t)}}throw a||new Error(`Request failed after ${o} retries: ${e}`)},ping:async(o=1e3)=>{const a=Date.now();n("Starting health check",{timeoutMs:o,iframeReady:!!e.contentWindow,targetOrigin:t.targetOrigin});try{await s("SYS_PING",void 0);const e=Date.now()-a;return n("Health check passed",{latencyMs:e}),e}catch(i){const e=`Health check failed after ${Date.now()-a}ms: ${i.message}. Target: ${t.targetOrigin}`;throw t.debug&&(n(`❌ [PostMessage Client] ${e}`),n(`📊 [PostMessage Client] Pending requests: ${r.size}`)),m("HEALTH_CHECK_FAILED",e)}},subscribe:(e,t)=>(o.has(e)||o.set(e,new Set),o.get(e).add(t),()=>{const r=o.get(e);r&&(r.delete(t),0===r.size&&o.delete(e))}),destroy:()=>{window.removeEventListener("message",a),r.forEach(({timeout:e,reject:t})=>{clearTimeout(e),t(m("CLIENT_DESTROYED","Client destroyed"))}),r.clear(),o.clear()},getPendingCount:()=>r.size}},x=e=>{const t=document.createElement("iframe");return t.src=e.src,t.setAttribute("sandbox",e.sandbox),t.title=e.title,t.setAttribute("allow",e.allow??"payment *"),t.setAttribute("importance","high"),t.style.opacity="0",t},O=e=>{const{elementType:t,elementId:r,client:o,eventTarget:n}=e,a=(e,o)=>{const a=new CustomEvent(e,{detail:{elementType:t,elementId:r,timestamp:Date.now(),...o}});n.dispatchEvent(a)};return{setupSubscriptions:()=>{o.subscribe("EVENT_READY",()=>{a("ready",{})}),o.subscribe("EVENT_VALUE_CHANGED",e=>{const r={isValid:e.isValid,isEmpty:e.isEmpty,error:e.error||null};if("cardNumber"===t){const t={...r,cardBrand:e.cardBrand,last4:e.last4,bin:e.bin,cvvLengths:e.cvvLengths,potentialBrands:e.potentialBrands,matchStrength:e.matchStrength,networks:e.networks,selectedNetwork:e.selectedNetwork};a("change",t)}else a("change","card"===t?{...r,cardBrand:e.cardBrand,last4:e.last4,bin:e.bin,networks:e.networks,selectedNetwork:e.selectedNetwork,errors:e.errors||null}:r)}),o.subscribe("EVENT_NETWORK_CHANGED",e=>{if("cardNumber"!==t&&"card"!==t)return;const r={network:e.network,previousNetwork:e.previousNetwork,availableNetworks:e.availableNetworks??[],selectionMode:e.selectionMode??"auto"};a("networkChanged",r)}),o.subscribe("EVENT_FOCUS",()=>{a("focus",{})}),o.subscribe("EVENT_BLUR",()=>{a("blur",{})}),o.subscribe("EVENT_ERROR",e=>{a("error",{code:e.code,message:e.message,status:e.status,validationErrors:e.validationErrors,metadata:e.metadata||{}})})},dispatchError:(e,t,r)=>{a("error",{code:e,message:t,metadata:{source:"initialization",originalError:r}})}}},_=(e,t,r={},o,n,a)=>{let i=null,s=null,l=null,d=!1,u=null,m=null;const c=new EventTarget,f=o,p="cardNumber";return{id:f,type:p,get mounted(){return d},mount:async o=>{if(d)throw h("Element is already mounted");if(u="string"==typeof o?document.querySelector(o):o,!u)throw h(`Container not found: ${o}`);const a=window.location.origin,y=new URL(`${t.elementsBaseUrl}/card-number.html`);y.searchParams.set("parentOrigin",a),y.searchParams.set("elementId",f),y.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),y.searchParams.set("debug",String(t.debug||!1)),i=x({src:y.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Card Number Input"}),i.setAttribute("data-bt-element-id",f),i.setAttribute("data-theme-mode",t.themeMode||"auto"),s=k(i,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),l={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},s&&(m=O({elementType:p,elementId:f,client:s,eventTarget:c}),m.setupSubscriptions(),s.subscribe("EVENT_CONTENT_HEIGHT",e=>{const t=null==e?void 0:e.heightPx;i&&"number"==typeof t&&t>0&&(i.style.height=`${Math.ceil(t)}px`)}));const g=new Promise((e,r)=>{const o=setTimeout(()=>{r(h(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,f,{elementType:p,timeoutMs:t.timeoutMs}))},t.timeoutMs);c.addEventListener("ready",()=>{clearTimeout(o),e()},{once:!0})});l.mount(u,i,{timeoutMs:t.timeoutMs}),d=!0;try{await n(),await g,await s.sendRequest("CMD_SET_CONFIG",{elementId:f,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,debug:t.debug,binLookup:r.binLookup,coBadge:r.coBadge}),i&&(i.style.opacity="1")}catch(b){throw m&&m.dispatchError("MOUNT_ERROR",b.message,b),d=!1,s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,b}},unmount:()=>{if(!d)throw h("Element is not mounted");a(f).catch(e=>{e.message}),s&&(s.destroy(),s=null),l&&i&&(i.style.height="",l.unmount(i),i=null,l=null),m=null,u=null,d=!1},update:async e=>{if(!d||!s)throw h("Element must be mounted before updating");const r={elementId:f};void 0!==e.placeholder&&(r.placeholder=e.placeholder),void 0!==e.disabled&&(r.disabled=e.disabled),void 0!==e.readOnly&&(r.readOnly=e.readOnly),void 0!==e.binLookup&&(r.binLookup=e.binLookup),void 0!==e.coBadge&&(r.coBadge=e.coBadge),void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await s.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!s)throw h("Element must be mounted before focusing");s.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!s)throw h("Element must be mounted before blurring");s.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!s)throw h("Element must be mounted before clearing");s.sendRequest("CMD_CLEAR",{})},setNetwork:async e=>{if(!d||!s)throw h("Element must be mounted before setNetwork");await s.sendRequest("CMD_SET_NETWORK",{network:e})},on:(e,t)=>(c.addEventListener(e,t),()=>c.removeEventListener(e,t))}},S=(e,t,r={},o,n,a)=>{let i=null,s=null,l=null,d=!1,u=null,m=null;const c=new EventTarget,f=o,p="cvv";return{id:f,type:p,get mounted(){return d},mount:async o=>{if(d)throw h("Element is already mounted",f);if(u="string"==typeof o?document.querySelector(o):o,!u)throw h(`Container not found: ${o}`);const a=window.location.origin,y=new URL(`${t.elementsBaseUrl}/cvv.html`);y.searchParams.set("parentOrigin",a),y.searchParams.set("elementId",f),y.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),y.searchParams.set("debug",String(t.debug||!1)),i=x({src:y.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"CVV Input"}),i.setAttribute("data-bt-element-id",f),s=k(i,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),l={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},s&&(m=O({elementType:p,elementId:f,client:s,eventTarget:c}),m.setupSubscriptions());const g=new Promise((e,r)=>{const o=setTimeout(()=>{r(h(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,f,{elementType:p,timeoutMs:t.timeoutMs}))},t.timeoutMs);c.addEventListener("ready",()=>{clearTimeout(o),e()},{once:!0})});l.mount(u,i,{timeoutMs:t.timeoutMs}),d=!0;try{await n(),await g,await s.sendRequest("CMD_SET_CONFIG",{elementId:f,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,showToggle:r.showToggle,debug:t.debug}),i&&(i.style.opacity="1")}catch(b){throw m&&m.dispatchError("MOUNT_ERROR",b.message,b),d=!1,s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,b}},unmount:()=>{if(!d)throw h("Element is not mounted");a(f).catch(e=>{e.message}),s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,d=!1},update:async e=>{if(!d||!s)throw h("Element must be mounted before updating",f);const r={placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly,cardBrand:e.cardBrand,cvvLengths:e.cvvLengths};void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await s.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!s)throw h("Element must be mounted before focusing",f);s.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!s)throw h("Element must be mounted before blurring",f);s.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!s)throw h("Element must be mounted before clearing",f);s.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(c.addEventListener(e,t),()=>c.removeEventListener(e,t))}},I=(e,t,r={},o,n,a)=>{let i=null,s=null,l=null,d=!1,u=null,m=null;const c=new EventTarget,f=o,p="expiry";return{id:f,type:p,get mounted(){return d},mount:async o=>{if(d)throw h("Element is already mounted",f);if(u="string"==typeof o?document.querySelector(o):o,!u)throw h(`Container not found: ${o}`);const a=window.location.origin,y=new URL(`${t.elementsBaseUrl}/expiry.html`);y.searchParams.set("parentOrigin",a),y.searchParams.set("elementId",f),y.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),y.searchParams.set("debug",String(t.debug||!1)),i=x({src:y.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Expiry Date Input"}),i.setAttribute("data-bt-element-id",f),s=k(i,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),l={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},s&&(m=O({elementType:p,elementId:f,client:s,eventTarget:c}),m.setupSubscriptions());const g=new Promise((e,r)=>{const o=setTimeout(()=>{r(h(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,f,{elementType:p,timeoutMs:t.timeoutMs}))},t.timeoutMs);c.addEventListener("ready",()=>{clearTimeout(o),e()},{once:!0})});l.mount(u,i,{timeoutMs:t.timeoutMs}),d=!0;try{await n(),await g,await s.sendRequest("CMD_SET_CONFIG",{elementId:f,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,debug:t.debug}),i&&(i.style.opacity="1")}catch(b){throw m&&m.dispatchError("MOUNT_ERROR",b.message,b),d=!1,s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,b}},unmount:()=>{if(!d)throw h("Element is not mounted");a(f).catch(e=>{e.message}),s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,d=!1},update:async e=>{if(!d||!s)throw h("Element must be mounted before updating",f);const r={placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly};void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await s.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!s)throw h("Element must be mounted before focusing",f);s.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!s)throw h("Element must be mounted before blurring",f);s.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!s)throw h("Element must be mounted before clearing",f);s.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(c.addEventListener(e,t),()=>c.removeEventListener(e,t))}},L=(e,t,r={},o,n,a)=>{let i=null,s=null,l=null,d=!1,u=null,m=null;const c=new EventTarget,f=o,p="text";if(r.transform&&!(Array.isArray(r.transform)&&2===r.transform.length&&r.transform[0]instanceof RegExp&&"string"==typeof r.transform[1]))throw new TypeError('transform must be a tuple of [RegExp, string]. Example: [/-/g, ""]');return{id:f,type:p,get mounted(){return d},mount:async o=>{if(d)throw h("Element is already mounted",f);if(u="string"==typeof o?document.querySelector(o):o,!u)throw h(`Container not found: ${o}`);const a=window.location.origin,y=new URL(`${t.elementsBaseUrl}/text.html`);y.searchParams.set("parentOrigin",a),y.searchParams.set("elementId",f),y.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),y.searchParams.set("debug",String(t.debug||!1)),i=x({src:y.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Text Input"}),i.setAttribute("data-bt-element-id",f),s=k(i,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),l={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},s&&(m=O({elementType:p,elementId:f,client:s,eventTarget:c}),m.setupSubscriptions());const g=new Promise((e,r)=>{const o=setTimeout(()=>{r(h(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,f,{elementType:p,timeoutMs:t.timeoutMs}))},t.timeoutMs);c.addEventListener("ready",()=>{clearTimeout(o),e()},{once:!0})});l.mount(u,i,{timeoutMs:t.timeoutMs}),d=!0;try{await n(),await g;const o=r.transform?{pattern:r.transform[0].source,flags:r.transform[0].flags,replacement:r.transform[1]}:void 0,a=r.mask?r.mask.map(e=>"string"==typeof e?e:e instanceof RegExp?{source:e.source,flags:e.flags}:e):void 0;await s.sendRequest("CMD_SET_CONFIG",{elementId:f,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,placeholder:r.placeholder,disabled:r.disabled,readOnly:r.readOnly,validation:r.validation,required:r.required,maxLength:r.maxLength,password:r.password,inputMode:r.inputMode,mask:a,transform:o,debug:t.debug}),i&&(i.style.opacity="1")}catch(b){throw m&&m.dispatchError("MOUNT_ERROR",b.message,b),d=!1,s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,b}},unmount:()=>{if(!d)throw h("Element is not mounted");a(f).catch(e=>{e.message}),s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,d=!1},update:async e=>{if(!d||!s)throw h("Element must be mounted before updating",f);const r={placeholder:e.placeholder,disabled:e.disabled,readOnly:e.readOnly,required:e.required,maxLength:e.maxLength,password:e.password,inputMode:e.inputMode};void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await s.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!d||!s)throw h("Element must be mounted before focusing",f);s.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!s)throw h("Element must be mounted before blurring",f);s.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!s)throw h("Element must be mounted before clearing",f);s.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(c.addEventListener(e,t),()=>c.removeEventListener(e,t))}},P=e=>{if((e=>null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)(e))return e;if((e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"function"==typeof t.mount&&"function"==typeof t.update&&"function"==typeof t.on})(e)){if(!e.id)throw h("Element is missing id property. Ensure createElement is called after the SDK loads and all elements are mounted before calling tokenize().");return e.id}if(Array.isArray(e))return e.map(P);if("object"==typeof e&&null!==e){const t={};for(const[r,o]of Object.entries(e))t[r]=P(o);return t}return e},D={colors:{primary:"#3b82f6",error:"#ef4444",success:"#10b981",text:{primary:"#1f2937",secondary:"#6b7280",placeholder:"#9ca3af",disabled:"#d1d5db"},background:{default:"#ffffff",hover:"#f9fafb",focus:"#eff6ff",disabled:"#f9fafb"},border:{default:"#d1d5db",hover:"#9ca3af",focus:"#3b82f6",error:"#ef4444"}},typography:{fontFamily:'"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:{sm:"14px",base:"16px",lg:"18px"},fontWeight:{normal:"400",medium:"500",semibold:"600"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},spacing:{xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px"},borders:{radius:{none:"0",sm:"2px",base:"4px",md:"6px",lg:"8px",full:"9999px"},width:{thin:"1px",base:"2px",thick:"3px"}},shadows:{none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",focus:"0 0 0 3px rgba(59, 130, 246, 0.1)"},transitions:{fast:"150ms cubic-bezier(0.4, 0, 0.2, 1)",base:"200ms cubic-bezier(0.4, 0, 0.2, 1)",slow:"300ms cubic-bezier(0.4, 0, 0.2, 1)"}},B=e=>{var t,r,o,n,a,i,s,l,d,u,m;return e?{colors:{primary:(null==(t=e.colors)?void 0:t.primary)??D.colors.primary,error:(null==(r=e.colors)?void 0:r.error)??D.colors.error,success:(null==(o=e.colors)?void 0:o.success)??D.colors.success,text:{...D.colors.text,...null==(n=e.colors)?void 0:n.text},background:{...D.colors.background,...null==(a=e.colors)?void 0:a.background},border:{...D.colors.border,...null==(i=e.colors)?void 0:i.border}},typography:{...D.typography,...e.typography,fontSize:{...D.typography.fontSize,...null==(s=e.typography)?void 0:s.fontSize},fontWeight:{...D.typography.fontWeight,...null==(l=e.typography)?void 0:l.fontWeight},lineHeight:{...D.typography.lineHeight,...null==(d=e.typography)?void 0:d.lineHeight}},spacing:{...D.spacing,...e.spacing},borders:{radius:{...D.borders.radius,...null==(u=e.borders)?void 0:u.radius},width:{...D.borders.width,...null==(m=e.borders)?void 0:m.width}},shadows:{...D.shadows,...e.shadows},transitions:{...D.transitions,...e.transitions}}:D},U=(e,t,r,o)=>{for(const n of Object.keys(t))r.has(n)||((null==o?void 0:o.has(n))?console.warn(`[BasisTheory] Deprecated option "${n}" in ${e}. ${o.get(n)}`):console.warn(`[BasisTheory] Unknown option "${n}" in ${e}. This option will be ignored. See https://developers.basistheory.com/docs/ for supported options.`))},N=new Set(["elementsBaseUrl","apiBaseUrl","debug","measurePerformance","timeoutMs","retryConfig","themeMode","theme","darkTheme"]),A=new Map([["iframeOrigin",'Use "elementsBaseUrl" instead.']]),q=new Set(["placeholder","ariaLabel","disabled","readOnly"]),$={cardNumber:new Set([...q,"binLookup","coBadge"]),cvv:new Set([...q,"cardBrand","cvvLengths"]),expiry:new Set([...q]),text:new Set([...q,"validation","required","maxLength","password","inputMode","mask","transform"]),card:new Set([...q,"layout","stackAt","iconPosition","cardBrands","binLookup","coBadge"]),copyButton:new Set(["allowClipboard","value","text","disabled"])},z=(e,t={},r)=>{(e=>{if(!e||"string"!=typeof e||0===e.trim().length)throw p("API key is required")})(e);const o=((e={})=>{var t,r,o;U("SDKOptions",e,N,A);const n=e.elementsBaseUrl||e.iframeOrigin;if(void 0!==n){if("string"!=typeof n||0===n.trim().length)throw p("elementsBaseUrl must be a non-empty string");try{new URL(n)}catch{throw p("elementsBaseUrl must be a valid URL")}}if(void 0!==e.apiBaseUrl){if("string"!=typeof e.apiBaseUrl||0===e.apiBaseUrl.trim().length)throw p("apiBaseUrl must be a non-empty string");try{new URL(e.apiBaseUrl)}catch{throw p("apiBaseUrl must be a valid URL")}}if(void 0!==e.debug&&"boolean"!=typeof e.debug)throw p("debug must be a boolean");if(void 0!==e.measurePerformance&&"boolean"!=typeof e.measurePerformance)throw p("measurePerformance must be a boolean");if(void 0!==e.timeoutMs&&("number"!=typeof e.timeoutMs||e.timeoutMs<=0))throw p("timeoutMs must be a positive number");const a={maxRetries:(null==(t=e.retryConfig)?void 0:t.maxRetries)??3,delayMs:(null==(r=e.retryConfig)?void 0:r.delayMs)??1e3,backoffFactor:(null==(o=e.retryConfig)?void 0:o.backoffFactor)??2};if("number"!=typeof a.maxRetries||a.maxRetries<0)throw p("maxRetries must be a non-negative number");if("number"!=typeof a.delayMs||a.delayMs<=0)throw p("retryConfig.delayMs must be a positive number");if("number"!=typeof a.backoffFactor||a.backoffFactor<1)throw p("retryConfig.backoffFactor must be >= 1");const i=e.themeMode||"auto";if(!["light","dark","auto"].includes(i))throw p('themeMode must be "light", "dark", or "auto"');const s=n||"https://js.basistheory.com/3.0.0-beta.4/elements";return{iframeOrigin:new URL(s).origin,elementsBaseUrl:s,apiBaseUrl:e.apiBaseUrl,debug:e.debug??!1,measurePerformance:e.measurePerformance??!1,timeoutMs:e.timeoutMs||3e4,themeMode:i,theme:B(e.theme),darkTheme:e.darkTheme?B(e.darkTheme):void 0,retryConfig:a}})(t),n=d("SDK",o.debug||!1);n("SDK initialized",{apiKeyPrefix:e.substring(0,7)+"...",elementsBaseUrl:o.elementsBaseUrl,iframeOrigin:o.iframeOrigin,debug:o.debug||!1});const a=new Map;let i=null,s=null,l=null,u=!1,m=t.themeMode||"auto";const y=async e=>{if(s)try{await s.sendRequest("CMD_BROADCAST_ELEMENT_UNMOUNT",{elementId:e}),n("Notified coordinator of element unmount",{elementId:e})}catch(t){n("Failed to notify coordinator of element unmount",{elementId:e,error:t.message})}else n("Cannot notify coordinator of unmount - coordinator not initialized",{elementId:e})};let g=null,b=null;const w={cardNumber:_,cvv:S,expiry:I,text:L},E={card:async()=>{if(!g){const e=await Promise.resolve().then(()=>F);g=e.createCardElement}return g},copyButton:async()=>{if(!b){const e=await Promise.resolve().then(()=>K);b=e.createCopyButtonElement}return b}},v=()=>l||(u||(u=!0,l=M()),l),M=async()=>{if(i)return void n("Coordinator already initialized",{loaded:null!==i.contentWindow});n("Initializing coordinator iframe",{elementsBaseUrl:o.elementsBaseUrl}),i=document.createElement("iframe"),i.setAttribute("name","bt-coordinator"),i.setAttribute("title","BasisTheory Coordinator"),i.setAttribute("role","none"),i.style.border="none",i.style.width="0",i.style.height="0",i.style.position="absolute",i.style.top="-9999px",i.style.left="-9999px";const t=o.elementsBaseUrl.endsWith("/")?o.elementsBaseUrl:`${o.elementsBaseUrl}/`,r=new URL("coordinator.html",t);r.searchParams.set("parentOrigin",window.location.origin),i.src=r.toString(),document.body.appendChild(i),n("Coordinator iframe mounted",{url:i.src}),await new Promise((e,t)=>{const r=setTimeout(()=>{t(new Error(`Coordinator load timeout (${o.timeoutMs}ms). Try increasing timeoutMs for slow connections.`))},o.timeoutMs);i.addEventListener("load",()=>{clearTimeout(r),n("Coordinator iframe loaded"),e()},{once:!0})}),s=k(i,{targetOrigin:new URL(o.elementsBaseUrl).origin,timeout:3e4,retries:3,debug:o.debug||!1}),n("Coordinator PostMessage client created"),await s.sendRequest("CMD_SET_CONFIG",{apiKey:e,apiBaseUrl:o.apiBaseUrl,apiTimeout:3e4,apiRetries:3,debug:o.debug||!1,theme:o.theme,darkTheme:o.darkTheme,themeMode:o.themeMode}),n("Coordinator initialized successfully")},R={createElement:(t,r)=>{const s=w[t],l=E[t];if(!s&&!l)throw p(`Unknown element type: ${t}`);r&&((e,t={})=>{if(U(`ElementOptions (${e})`,t,$[e]),void 0!==t.placeholder)if("card"===e){if("object"!=typeof t.placeholder||null===t.placeholder)throw p("placeholder for card element must be an object with cardNumber, expiryDate, and cvv keys")}else if("string"!=typeof t.placeholder)throw p("placeholder must be a string");if(void 0!==t.disabled&&"boolean"!=typeof t.disabled)throw p("disabled must be a boolean");if(void 0!==t.readOnly&&"boolean"!=typeof t.readOnly)throw p("readOnly must be a boolean");if(void 0!==t.ariaLabel&&"string"!=typeof t.ariaLabel)throw p("ariaLabel must be a string");if("text"===e){if(void 0!==t.maxLength&&("number"!=typeof t.maxLength||t.maxLength<=0))throw p("maxLength must be a positive number");if(void 0!==t.password&&"boolean"!=typeof t.password)throw p("password must be a boolean");if(void 0!==t.required&&"boolean"!=typeof t.required)throw p("required must be a boolean");if(void 0!==t.validation&&!(t.validation instanceof RegExp))throw p("validation must be a RegExp");if(t.transform&&!(Array.isArray(t.transform)&&2===t.transform.length&&t.transform[0]instanceof RegExp&&"string"==typeof t.transform[1]))throw p('transform must be a tuple of [RegExp, string]. Example: [/-/g, ""]')}if("copyButton"===e&&!0!==t.allowClipboard)throw p("CopyButton requires allowClipboard: true. Clipboard access for raw card data may not be PCI compliant and must be explicitly enabled.");if("card"===e){const e=t;if(void 0!==e.layout&&!["row","column","auto"].includes(e.layout))throw p('layout must be "row", "column", or "auto"');if(void 0!==e.stackAt&&("number"!=typeof e.stackAt||e.stackAt<=0))throw p("stackAt must be a positive number");if(void 0!==e.iconPosition&&!["left","right","none"].includes(e.iconPosition))throw p('iconPosition must be "left", "right", or "none"');if(void 0!==e.cardBrands){if(!Array.isArray(e.cardBrands))throw p("cardBrands must be an array of strings");if(e.cardBrands.some(e=>"string"!=typeof e))throw p("All cardBrands must be strings")}}})(t,r);const d=`${t}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;let u;if(n("Creating element (sync)",{type:t,elementId:d,coordinatorInitialized:null!==i,isLazyLoaded:!!l}),s)u=s(e,o,r,d,v,y);else{let n=null,a=null;const i=async()=>{a||(a=(async()=>{const t=await l();n=t(e,o,r,d,v,y)})()),await a};u={id:d,type:t,get mounted(){return(null==n?void 0:n.mounted)??!1},get fields(){return null==n?void 0:n.fields},mount:async e=>(await i(),n.mount(e)),unmount:()=>{if(!n)throw h("Element not initialized");return n.unmount()},update:async e=>{if(!n)throw h("Element not initialized");return n.update(e)},focus:()=>{if(!n)throw h("Element not initialized");return n.focus()},blur:()=>{if(!n)throw h("Element not initialized");return n.blur()},clear:()=>{if(!n)throw h("Element not initialized");return n.clear()},on:(e,t)=>n?n.on(e,t):(i().then(()=>n.on(e,t)),()=>{}),setValueRef:async e=>{if(n||await i(),n&&"setValueRef"in n&&"function"==typeof n.setValueRef)return n.setValueRef(e);throw h("setValueRef not available on this element type")}}}return a.set(u.id,u),"cardNumber"===t&&u.on("change",e=>{const{cardBrand:t,cvvLengths:r}=e.detail;if(n("Card number change event received",{cardBrand:t,cvvLengths:r,cvvElementsCount:Array.from(a.values()).filter(e=>"cvv"===e.type).length}),t&&"Unknown"!==t&&r)for(const[o,i]of a)"cvv"===i.type&&i.mounted&&(n("Coordinating CVV element with card brand",{cvvElementId:o,cardBrand:t,cvvLengths:r,mounted:i.mounted}),i.update({cardBrand:t,cvvLengths:r}).catch(e=>{n("Failed to update CVV element with card brand",{cvvElementId:o,cardBrand:t,error:e.message})}))}),u},tokenize:async(e,t)=>{if(n("tokenize called",{hasPayload:!!e,hasOptions:!!t,coordinatorReady:!!s}),s||(n("Waiting for coordinator initialization"),await M()),!s)throw f("Coordinator failed to initialize");try{const r=e?P(e):{};n("Element references resolved",{originalPayload:!!e,resolvedPayload:!!r}),n("Delegating tokenization to coordinator");const o=await s.sendRequest("CMD_TOKENIZE",{payload:r,options:t});return n("tokenize successful",{tokenId:o.id}),o}catch(r){throw n("tokenize failed",{error:r.message}),r}},tokens:{create:async e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw c("Token data must be a non-null object");if(n("tokens.create called",{type:e.type,hasData:!!e.data}),s||(n("Waiting for coordinator initialization"),await M()),!s)throw new Error("Coordinator failed to initialize");try{const t={...e,data:P(e.data)};n("Element references resolved for tokens.create",{resolvedData:!!t});const r=await s.sendRequest("CMD_TOKENS_CREATE",{data:t});return n("tokens.create successful",{tokenId:r.id}),r}catch(t){throw n("tokens.create failed",{error:t.message}),t}},retrieve:async(e,t)=>{if(n("tokens.retrieve called",{tokenId:e,hasSessionKey:!!(null==t?void 0:t.apiKey)}),s||await M(),!s)throw new Error("Coordinator failed to initialize");try{const r=await s.sendRequest("CMD_TOKENS_RETRIEVE",{id:e,apiKey:null==t?void 0:t.apiKey});return n("tokens.retrieve successful",{tokenId:r.id}),r}catch(r){throw n("tokens.retrieve failed",{error:r.message}),r}},update:async(e,t)=>{if(n("tokens.update called",{tokenId:e}),s||await M(),!s)throw new Error("Coordinator failed to initialize");try{const r=t.data?{...t,data:P(t.data)}:t,o=await s.sendRequest("CMD_TOKENS_UPDATE",{id:e,data:r});return n("tokens.update successful",{tokenId:o.id}),o}catch(r){throw n("tokens.update failed",{error:r.message}),r}},encrypt:async(e,t,r)=>{if(n("tokens.encrypt called",{isSingleToken:"type"in e&&"data"in e,keyId:r}),!e||"object"!=typeof e)throw c("tokenData must be an object");if(!t||"string"!=typeof t)throw c("publicKeyPEM is required");if(!r||"string"!=typeof r)throw c("keyId is required");if(s||await M(),!s)throw new Error("Coordinator failed to initialize");try{const o=P(e);n("Element references resolved for tokens.encrypt",{originalData:!!e,resolvedData:!!o});const a=await s.sendRequest("CMD_TOKENS_ENCRYPT",{tokenRequests:o,publicKeyPEM:t,keyId:r});return n("tokens.encrypt successful",{isSingleToken:"encrypted"in a&&"type"in a}),a}catch(o){throw n("tokens.encrypt failed",{error:o.message}),o}}},sessions:{create:async()=>{if(n("sessions.create called"),s||await M(),!s)throw new Error("Coordinator failed to initialize");try{const e=await s.sendRequest("CMD_SESSIONS_CREATE",{});return n("sessions.create successful",{nonce:e.nonce,expiresAt:e.expires_at}),e}catch(e){throw n("sessions.create failed",{error:e.message}),e}}},tokenIntents:{create:async(e,t)=>{if(n("tokenIntents.create called",{type:e.type,hasData:!!e.data,hasOptions:!!t}),s||await M(),!s)throw new Error("Coordinator failed to initialize");try{const r=P(e.data);n("Element references resolved for token intent");const o=await s.sendRequest("CMD_TOKEN_INTENTS_CREATE",{type:e.type,data:r,options:t});return n("tokenIntents.create successful",{intentId:o.id}),o}catch(r){throw n("tokenIntents.create failed",{error:r.message}),r}},get:async(e,t)=>{if(n("tokenIntents.get called",{intentId:e}),s||await M(),!s)throw new Error("Coordinator failed to initialize");try{const r=await s.sendRequest("CMD_TOKEN_INTENTS_GET",{id:e,options:t});return n("tokenIntents.get successful",{intentId:r.id}),r}catch(r){throw n("tokenIntents.get failed",{error:r.message}),r}}},proxy:(()=>{const e=e=>t=>(async(e,t={})=>{if(T({...t,method:e}),n("proxy invoked",{method:e,hasUrl:!!t.url,hasProxyKey:!!t.proxyKey}),s||(n("Waiting for coordinator initialization"),await M()),!s)throw f("Coordinator failed to initialize");const r=void 0!==t.body?P(t.body):void 0;try{const o=await s.sendRequest("CMD_PROXY",{method:e,url:t.url,proxyKey:t.proxyKey,headers:t.headers,body:r,includeResponseHeaders:t.includeResponseHeaders},{retries:0});return n("proxy successful",{method:e}),o}catch(o){throw n("proxy failed",{method:e,error:o.message}),o}})(e,t??{});return{get:e("GET"),post:e("POST"),put:e("PUT"),patch:e("PATCH"),delete:e("DELETE")}})(),updateThemeMode:async e=>{n("updateThemeMode called",{oldMode:m,newMode:e,mountedElements:Array.from(a.values()).filter(e=>e.mounted).length}),m=e;const t=[];for(const[r,o]of a)if(o.mounted){n("Sending theme mode update to element",{elementId:r,elementType:o.type,mode:e});const a=document.querySelector(`iframe[data-bt-element-id="${o.id}"]`);a&&a.setAttribute("data-theme-mode",e);const i=o.update({themeMode:e}).catch(e=>{n("Failed to update theme mode for element",{elementId:r,error:e.message})});t.push(i)}await Promise.all(t),n("Theme mode updated for all mounted elements",{mode:e,updatedCount:Array.from(a.values()).filter(e=>e.mounted).length})}};if(r&&r.length>0){n("Draining command queue from loader",{queueLength:r.length,commands:r.map(e=>e.method)});for(const e of r)try{const t=R[e.method];if(!t)throw new Error(`Unknown method: ${e.method}`);n("Replaying queued command",{method:e.method,argsCount:e.args.length});const r=t(...e.args);r&&"function"==typeof r.then?r.then(t=>{n("Queued command completed (async)",{method:e.method}),e.resolve(t)}).catch(t=>{n("Queued command failed (async)",{method:e.method,error:t.message}),e.reject(t)}):(n("Queued command completed (sync)",{method:e.method}),e.resolve(r))}catch(C){n("Queued command failed (sync)",{method:e.method,error:C.message}),e.reject(C)}n("Command queue drain complete",{processedCount:r.length})}return R};"undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript&&!window.BasisTheory&&(window.BasisTheory=z),"undefined"!=typeof window&&(window.__BasisTheorySDK__=z);const F=Object.freeze(Object.defineProperty({__proto__:null,createCardElement:(e,t,r={},o,n,a)=>{let i=null,s=null,l=null,d=!1,u=null,m=null;const c=new EventTarget,f=o,p="card",y=e=>({id:e,type:"card",get mounted(){return d},mount:()=>{throw h("Sub-field refs cannot be mounted independently")},unmount:()=>{},update:()=>Promise.resolve(),focus:()=>{},blur:()=>{},clear:()=>{},on:()=>()=>{}});return{id:f,type:p,get mounted(){return d},fields:{number:y(`${f}__number`),expiryDate:y(`${f}__expiry`),cvc:y(`${f}__cvc`)},mount:async o=>{if(d)throw h("Element is already mounted");if(u="string"==typeof o?document.querySelector(o):o,!u)throw h(`Container not found: ${o}`);const a=window.location.origin,y=new URL(`${t.elementsBaseUrl}/card.html`);y.searchParams.set("parentOrigin",a),y.searchParams.set("elementId",f),y.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),y.searchParams.set("debug",String(t.debug||!1)),i=x({src:y.toString(),sandbox:"allow-scripts allow-same-origin",title:r.ariaLabel||"Card Input"}),i.setAttribute("data-bt-element-id",f),i.setAttribute("data-theme-mode",t.themeMode||"auto"),s=k(i,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),l={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},s&&(m=O({elementType:p,elementId:f,client:s,eventTarget:c}),m.setupSubscriptions());const g=new Promise((e,r)=>{const o=setTimeout(()=>{r(h(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,f,{elementType:p,timeoutMs:t.timeoutMs}))},t.timeoutMs);c.addEventListener("ready",()=>{clearTimeout(o),e()},{once:!0})});l.mount(u,i,{timeoutMs:t.timeoutMs}),d=!0;try{await n(),await g,await s.sendRequest("CMD_SET_CONFIG",{elementId:f,apiKey:e,apiTimeout:t.timeoutMs,apiRetries:t.retryConfig.maxRetries,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,placeholder:r.placeholder,...void 0!==r.style&&{style:r.style},disabled:r.disabled,readOnly:r.readOnly,layout:r.layout||"auto",stackAt:r.stackAt||400,iconPosition:r.iconPosition||"left",...void 0!==r.cardBrands&&{cardBrands:r.cardBrands},...void 0!==r.binLookup&&{binLookup:r.binLookup},...void 0!==r.coBadge&&{coBadge:r.coBadge},debug:t.debug}),i&&(i.style.opacity="1")}catch(b){throw m&&m.dispatchError("MOUNT_ERROR",b.message,b),d=!1,s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,b}},unmount:()=>{if(!d)throw h("Element is not mounted");const e=["__number","__expiry","__cvc"];for(const t of e)a(`${f}${t}`).catch(e=>{e.message});s&&(s.destroy(),s=null),l&&i&&(l.unmount(i),i=null,l=null),m=null,u=null,d=!1},update:async e=>{if(!d||!s)throw h("Element must be mounted before updating");const r=e,o={elementId:f};void 0!==r.placeholder&&(o.placeholder=r.placeholder),void 0!==r.style&&(o.style=r.style),void 0!==r.disabled&&(o.disabled=r.disabled),void 0!==r.readOnly&&(o.readOnly=r.readOnly),void 0!==r.layout&&(o.layout=r.layout),void 0!==r.stackAt&&(o.stackAt=r.stackAt),void 0!==r.iconPosition&&(o.iconPosition=r.iconPosition),void 0!==r.cardBrands&&(o.cardBrands=r.cardBrands),void 0!==r.binLookup&&(o.binLookup=r.binLookup),void 0!==r.coBadge&&(o.coBadge=r.coBadge),void 0!==e.themeMode&&(o.themeMode=e.themeMode,o.theme=t.theme,o.darkTheme=t.darkTheme),await s.sendRequest("CMD_UPDATE_CONFIG",o)},focus:()=>{if(!d||!s)throw h("Element must be mounted before focusing");s.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!d||!s)throw h("Element must be mounted before blurring");s.sendRequest("CMD_BLUR",{})},clear:()=>{if(!d||!s)throw h("Element must be mounted before clearing");s.sendRequest("CMD_CLEAR",{})},on:(e,t)=>(c.addEventListener(e,t),()=>c.removeEventListener(e,t)),setNetwork:async e=>{if(!d||!s)throw h("Element must be mounted before setNetwork");await s.sendRequest("CMD_SET_NETWORK",{network:e})}}}},Symbol.toStringTag,{value:"Module"})),K=Object.freeze(Object.defineProperty({__proto__:null,createCopyButtonElement:(e,t,r,o,n,a)=>{const i=r;if(!0!==(null==i?void 0:i.allowClipboard))throw p("CopyButton requires allowClipboard: true. Clipboard access for raw card data may not be PCI compliant and must be explicitly enabled.",{received:null==i?void 0:i.allowClipboard,expected:!0,elementType:"copyButton"});let s=null,l=null,d=null,u=!1,m=null,c=null;const f=new EventTarget,y=o,g="copyButton";return{id:y,type:g,get mounted(){return u},mount:async e=>{if(u)throw h("Element is already mounted",y);if(m="string"==typeof e?document.querySelector(e):e,!m)throw h(`Container not found: ${e}`);const r=crypto.randomUUID(),o=window.location.origin,a=new URL(`${t.elementsBaseUrl}/copy-button.html`);a.searchParams.set("parentOrigin",o),a.searchParams.set("elementId",y),a.searchParams.set("signature",r),a.searchParams.set("measurePerformance",String(t.measurePerformance||!1)),a.searchParams.set("debug",String(t.debug||!1)),s=x({src:a.toString(),sandbox:"allow-scripts allow-same-origin",allow:"clipboard-write",title:"Copy Button"}),s.setAttribute("data-bt-element-id",y),l=k(s,{targetOrigin:t.iframeOrigin,timeout:t.timeoutMs,retries:t.retryConfig.maxRetries,debug:t.debug}),d={mount:async(e,t,r)=>{(e=>{e.style.border="none",e.style.width="100%",e.style.height="100%",e.style.display="block"})(t),e.appendChild(t)},unmount:e=>{e.remove()}},l&&(c=O({elementType:g,elementId:y,client:l,eventTarget:f}),c.setupSubscriptions(),l.subscribe("EVENT_COPY",e=>{const t=new CustomEvent("copy",{detail:{elementType:g,elementId:y,timestamp:Date.now(),success:(null==e?void 0:e.success)??!1,error:null==e?void 0:e.error}});f.dispatchEvent(t)}));const p=new Promise((e,r)=>{const o=setTimeout(()=>{r(h(`Iframe EVENT_READY not received within ${t.timeoutMs}ms`,y,{elementType:g,timeoutMs:t.timeoutMs}))},t.timeoutMs);f.addEventListener("ready",()=>{clearTimeout(o),e()},{once:!0})});d.mount(m,s,{timeoutMs:t.timeoutMs}),u=!0;try{await n(),await p,await l.sendRequest("CMD_SET_CONFIG",{elementId:y,signature:r,theme:t.theme,darkTheme:t.darkTheme,themeMode:t.themeMode,text:i.text||"Copy",value:i.value,disabled:i.disabled,debug:t.debug}),s&&(s.style.opacity="1")}catch(b){throw c&&c.dispatchError("MOUNT_ERROR",b.message,b),u=!1,l&&(l.destroy(),l=null),d&&s&&(d.unmount(s),s=null,d=null),c=null,m=null,b}},unmount:()=>{if(!u)throw h("Element is not mounted");l&&(l.destroy(),l=null),d&&s&&(d.unmount(s),s=null,d=null),c=null,m=null,u=!1},update:async e=>{if(!u||!l)throw h("Element must be mounted before updating",y);const r={},o=e;void 0!==o.text&&(r.text=o.text),void 0!==o.value&&(r.value=o.value),void 0!==o.disabled&&(r.disabled=o.disabled),void 0!==e.themeMode&&(r.themeMode=e.themeMode,r.theme=t.theme,r.darkTheme=t.darkTheme),await l.sendRequest("CMD_UPDATE_CONFIG",r)},focus:()=>{if(!u||!l)throw h("Element must be mounted before focusing",y);l.sendRequest("CMD_FOCUS",{})},blur:()=>{if(!u||!l)throw h("Element must be mounted before blurring",y);l.sendRequest("CMD_BLUR",{})},clear:()=>{},on:(e,t)=>(f.addEventListener(e,t),()=>f.removeEventListener(e,t)),setValueRef:async e=>{if(null==e||e.id,!e||!e.id)throw h("setValueRef requires a valid Element with an ID",y);if(!u||!l)throw h("Element must be mounted before calling setValueRef",y);await l.sendRequest("CMD_SET_VALUE_REF",{referenceElementId:e.id})}}}},Symbol.toStringTag,{value:"Module"}));e.buildDate="2026-06-09T15:35:24.276Z",e.default=z,e.version="3.0.0-beta.4",Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});