domma-js 0.53.2 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,8 +28,8 @@ export interface EventAction {
28
28
  log?: string;
29
29
  }
30
30
 
31
- export type EventHandler = (event: Event, $el: DommaCollection) => void;
32
- export type EventActions = EventHandler | EventAction | (EventHandler | EventAction)[];
31
+ export type ConfigEventHandler = (event: Event, $el: DommaCollection) => void;
32
+ export type EventActions = ConfigEventHandler | EventAction | (ConfigEventHandler | EventAction)[];
33
33
 
34
34
  export interface SelectorConfig {
35
35
  /** Component type to initialise */
@@ -22,11 +22,11 @@ export * from './flags';
22
22
  export * from './smooth-caret';
23
23
 
24
24
  // Import types for the main Domma object
25
- import {dom, DommaCollection} from './dom';
25
+ import {DommaCollection} from './dom';
26
26
  import {Utils, utils} from './utils';
27
27
  import {Dates, dates, DommaDate} from './dates';
28
28
  import {Model, models, Models} from './models';
29
- import {configEngine, SelectorConfig, SetupConfig} from './config';
29
+ import {SelectorConfig, SetupConfig} from './config';
30
30
  import {Elements, elements} from './elements';
31
31
  import {Tables, tables} from './tables';
32
32
  import {Storage, storage} from './storage';
@@ -55,9 +55,6 @@ export interface DommaStatic {
55
55
  */
56
56
  (callback: () => void): void;
57
57
 
58
- /** DOM manipulation module */
59
- dom: typeof dom;
60
-
61
58
  /** Utility functions (Lodash-compatible) */
62
59
  utils: Utils;
63
60
 
@@ -137,8 +134,12 @@ export interface DommaStatic {
137
134
  /** Domma version string */
138
135
  version: string;
139
136
 
140
- /** No-conflict mode - restore previous $ */
141
- noConflict(): DommaStatic;
137
+ /**
138
+ * Give `$` and `_` back to whatever owned them before Domma loaded (jQuery, Lodash).
139
+ * With `deep`, give back every short alias (`window.Domma` stays).
140
+ * @returns Domma, so `const dm = Domma.noConflict()` keeps a handle
141
+ */
142
+ noConflict(deep?: boolean): DommaStatic;
142
143
  }
143
144
 
144
145
  // ============================================
@@ -190,21 +191,43 @@ declare global {
190
191
  declare const Domma: DommaStatic;
191
192
  export default Domma;
192
193
 
193
- // Named exports for ES modules
194
- export {
195
- Domma,
196
- dom,
197
- utils,
198
- dates,
199
- models,
200
- elements,
201
- tables,
202
- storage,
203
- http,
204
- theme,
205
- icons,
206
- configEngine,
207
- DommaCollection,
208
- DommaDate,
209
- Model
210
- };
194
+ // Named exports for ES modules - exactly what src/index.js exports
195
+ declare const $: DommaStatic;
196
+ declare const _: Utils;
197
+ declare const M: Models;
198
+ declare const D: Dates;
199
+ declare const S: Storage;
200
+ declare const H: Http;
201
+ declare const E: Elements;
202
+ declare const I: Icons;
203
+ declare const T: Tables;
204
+ declare const smoothCaret: SmoothCaret;
205
+ // Not typed yet: auth, forms, router, blueprint helpers, web-component registry
206
+ declare const A: any;
207
+ declare const F: any;
208
+ declare const R: any;
209
+ declare const B: any;
210
+ declare const components: any;
211
+
212
+ export {Domma, $, _, M, D, S, A, F, H, E, I, T, R, B, components, smoothCaret};
213
+ export type {DommaCollection, DommaDate, Model};
214
+
215
+ /** Options read from `window.DommaOptions` when Domma loads - set it before the script tag. */
216
+ export interface DommaLoadOptions {
217
+ /** true (default): every alias; 'safe': only aliases nobody else owns; false: window.Domma only */
218
+ globals?: boolean | 'safe';
219
+ /** false: never add the `dm-cloaked` class */
220
+ cloak?: boolean;
221
+ /** false: don't initialise the theme engine automatically */
222
+ theme?: boolean;
223
+ /** false: no console warning when DOMPurify is missing */
224
+ purifyWarning?: boolean;
225
+ /** false: no deprecation warnings */
226
+ deprecationWarnings?: boolean;
227
+ }
228
+
229
+ declare global {
230
+ interface Window {
231
+ DommaOptions?: DommaLoadOptions;
232
+ }
233
+ }
@@ -23,7 +23,8 @@ export interface ThemeChangeEvent {
23
23
  }
24
24
 
25
25
  export type ThemeChangeCallback = (event: ThemeChangeEvent) => void;
26
- export type UnsubscribeFn = () => void;
26
+ import type {UnsubscribeFn} from './models';
27
+ export type {UnsubscribeFn};
27
28
 
28
29
  export interface ThemeOptions {
29
30
  /** Initial theme mode */
package/package.json CHANGED
@@ -1,10 +1,34 @@
1
1
  {
2
2
  "name": "domma-js",
3
- "version": "0.53.2",
3
+ "version": "0.54.0",
4
4
  "description": "Dynamic Object Manipulation & Modeling API - A complete front-end toolkit.",
5
5
  "main": "public/dist/domma.min.js",
6
6
  "module": "public/dist/domma.esm.js",
7
7
  "types": "assets/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./assets/types/index.d.ts",
11
+ "import": "./public/dist/domma.esm.js",
12
+ "default": "./public/dist/domma.esm.js"
13
+ },
14
+ "./css": "./public/dist/domma.css",
15
+ "./elements.css": "./public/dist/elements.css",
16
+ "./grid.css": "./public/dist/grid.css",
17
+ "./syntax.css": "./public/dist/syntax.css",
18
+ "./syntax": "./public/dist/domma-syntax.min.js",
19
+ "./flags": {
20
+ "import": "./public/dist/domma-flags.esm.js",
21
+ "default": "./public/dist/domma-flags.min.js"
22
+ },
23
+ "./themes/*": "./public/dist/themes/*",
24
+ "./bundles/*": "./public/dist/bundles/*",
25
+ "./types": "./assets/types/index.d.ts",
26
+ "./package.json": "./package.json",
27
+ "./public/*": "./public/*",
28
+ "./assets/*": "./assets/*",
29
+ "./templates/*": "./templates/*",
30
+ "./bin/*": "./bin/*"
31
+ },
8
32
  "bin": {
9
33
  "domma": "./bin/domma-cli.js"
10
34
  },
@@ -15,15 +39,20 @@
15
39
  "templates/page-template/",
16
40
  "templates/view-template/",
17
41
  "public/dist/domma.min.js",
42
+ "public/dist/domma.min.js.map",
18
43
  "public/dist/domma.esm.js",
44
+ "public/dist/domma.esm.js.map",
19
45
  "public/dist/domma.css",
20
46
  "public/dist/bundles/",
21
47
  "public/dist/elements.css",
22
48
  "public/dist/grid.css",
23
49
  "public/dist/syntax.css",
24
50
  "public/dist/domma-syntax.min.js",
51
+ "public/dist/domma-syntax.min.js.map",
25
52
  "public/dist/domma-flags.min.js",
53
+ "public/dist/domma-flags.min.js.map",
26
54
  "public/dist/domma-flags.esm.js",
55
+ "public/dist/domma-flags.esm.js.map",
27
56
  "public/dist/themes/",
28
57
  "assets/types/",
29
58
  "LICENSE",
@@ -35,7 +64,6 @@
35
64
  },
36
65
  "type": "module",
37
66
  "scripts": {
38
- "postinstall": "node bin/postinstall.js",
39
67
  "start": "node bin/domma-cli.js serve",
40
68
  "serve": "node bin/domma-cli.js serve",
41
69
  "serve:3096": "node bin/domma-cli.js serve --port 3096",
@@ -87,7 +115,7 @@
87
115
  "@rollup/plugin-terser": "^0.4.4",
88
116
  "@vitest/coverage-v8": "^4.0.16",
89
117
  "cypress": "^15.8.1",
90
- "domma-celebrate": "1.4.0",
118
+ "domma-celebrate": "1.5.0",
91
119
  "domma-reactive": "1.3.1",
92
120
  "dompurify": "^3.4.13",
93
121
  "dotenv": "^17.2.3",
@@ -95,10 +123,7 @@
95
123
  "live-server": "^1.2.0",
96
124
  "puppeteer": "^24.34.0",
97
125
  "rollup": "^4.28.0",
98
- "rollup-plugin-obfuscator": "^1.1.0",
99
126
  "vitest": "^4.0.16"
100
127
  },
101
- "dependencies": {
102
- "@fastify/cors": "^11.2.0"
103
- }
128
+ "dependencies": {}
104
129
  }
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Complete CSS Bundle v0.53.2
2
+ * Domma Complete CSS Bundle v0.54.0
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-10-17T11:20:35.478Z
5
+ * Built: 2026-10-24T13:16:34.503Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.53.2
14
+ * Domma Core CSS v0.54.0
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-10-17T11:20:35.308Z
18
- * Commit: ddc1a73
17
+ * Built: 2026-10-24T13:16:34.331Z
18
+ * Commit: 8d2b9ea
19
19
  */
20
20
 
21
21
  /**
@@ -4971,11 +4971,11 @@ body.dm-cloaked.dm-ready {
4971
4971
  ============================================ */
4972
4972
 
4973
4973
  /*!
4974
- * Domma Grid CSS v0.53.2
4974
+ * Domma Grid CSS v0.54.0
4975
4975
  * Dynamic Object Manipulation & Modeling API
4976
4976
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4977
- * Built: 2026-10-17T11:20:35.312Z
4978
- * Commit: ddc1a73
4977
+ * Built: 2026-10-24T13:16:34.336Z
4978
+ * Commit: 8d2b9ea
4979
4979
  */
4980
4980
 
4981
4981
  /**
@@ -5596,11 +5596,11 @@ body.dm-cloaked.dm-ready {
5596
5596
  ============================================ */
5597
5597
 
5598
5598
  /*!
5599
- * Domma Elements CSS v0.53.2
5599
+ * Domma Elements CSS v0.54.0
5600
5600
  * Dynamic Object Manipulation & Modeling API
5601
5601
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5602
- * Built: 2026-10-17T11:20:35.317Z
5603
- * Commit: ddc1a73
5602
+ * Built: 2026-10-24T13:16:34.341Z
5603
+ * Commit: 8d2b9ea
5604
5604
  */
5605
5605
 
5606
5606
  /**
@@ -15161,11 +15161,11 @@ a.avatar-more-person:hover .avatar-more-name {
15161
15161
  ============================================ */
15162
15162
 
15163
15163
  /*!
15164
- * Domma Themes v0.53.2
15164
+ * Domma Themes v0.54.0
15165
15165
  * Dynamic Object Manipulation & Modeling API
15166
15166
  * (c) 2026 Darryl Waterhouse & DCBW-IT
15167
- * Built: 2026-10-17T11:20:35.295Z
15168
- * Commit: ddc1a73
15167
+ * Built: 2026-10-24T13:16:34.318Z
15168
+ * Commit: 8d2b9ea
15169
15169
  */
15170
15170
 
15171
15171
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Data-Focused CSS Bundle v0.53.2
2
+ * Domma Data-Focused CSS Bundle v0.54.0
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-10-17T11:20:35.474Z
5
+ * Built: 2026-10-24T13:16:34.499Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.53.2
14
+ * Domma Core CSS v0.54.0
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-10-17T11:20:35.308Z
18
- * Commit: ddc1a73
17
+ * Built: 2026-10-24T13:16:34.331Z
18
+ * Commit: 8d2b9ea
19
19
  */
20
20
 
21
21
  /**
@@ -4971,11 +4971,11 @@ body.dm-cloaked.dm-ready {
4971
4971
  ============================================ */
4972
4972
 
4973
4973
  /*!
4974
- * Domma Grid CSS v0.53.2
4974
+ * Domma Grid CSS v0.54.0
4975
4975
  * Dynamic Object Manipulation & Modeling API
4976
4976
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4977
- * Built: 2026-10-17T11:20:35.312Z
4978
- * Commit: ddc1a73
4977
+ * Built: 2026-10-24T13:16:34.336Z
4978
+ * Commit: 8d2b9ea
4979
4979
  */
4980
4980
 
4981
4981
  /**
@@ -5596,11 +5596,11 @@ body.dm-cloaked.dm-ready {
5596
5596
  ============================================ */
5597
5597
 
5598
5598
  /*!
5599
- * Domma Elements CSS v0.53.2
5599
+ * Domma Elements CSS v0.54.0
5600
5600
  * Dynamic Object Manipulation & Modeling API
5601
5601
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5602
- * Built: 2026-10-17T11:20:35.317Z
5603
- * Commit: ddc1a73
5602
+ * Built: 2026-10-24T13:16:34.341Z
5603
+ * Commit: 8d2b9ea
5604
5604
  */
5605
5605
 
5606
5606
  /**
@@ -15161,11 +15161,11 @@ a.avatar-more-person:hover .avatar-more-name {
15161
15161
  ============================================ */
15162
15162
 
15163
15163
  /*!
15164
- * Domma Themes v0.53.2
15164
+ * Domma Themes v0.54.0
15165
15165
  * Dynamic Object Manipulation & Modeling API
15166
15166
  * (c) 2026 Darryl Waterhouse & DCBW-IT
15167
- * Built: 2026-10-17T11:20:35.295Z
15168
- * Commit: ddc1a73
15167
+ * Built: 2026-10-24T13:16:34.318Z
15168
+ * Commit: 8d2b9ea
15169
15169
  */
15170
15170
 
15171
15171
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Essentials CSS Bundle v0.53.2
2
+ * Domma Essentials CSS Bundle v0.54.0
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-10-17T11:20:35.465Z
5
+ * Built: 2026-10-24T13:16:34.489Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.53.2
14
+ * Domma Core CSS v0.54.0
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-10-17T11:20:35.308Z
18
- * Commit: ddc1a73
17
+ * Built: 2026-10-24T13:16:34.331Z
18
+ * Commit: 8d2b9ea
19
19
  */
20
20
 
21
21
  /**
@@ -4971,11 +4971,11 @@ body.dm-cloaked.dm-ready {
4971
4971
  ============================================ */
4972
4972
 
4973
4973
  /*!
4974
- * Domma Grid CSS v0.53.2
4974
+ * Domma Grid CSS v0.54.0
4975
4975
  * Dynamic Object Manipulation & Modeling API
4976
4976
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4977
- * Built: 2026-10-17T11:20:35.312Z
4978
- * Commit: ddc1a73
4977
+ * Built: 2026-10-24T13:16:34.336Z
4978
+ * Commit: 8d2b9ea
4979
4979
  */
4980
4980
 
4981
4981
  /**
@@ -5596,11 +5596,11 @@ body.dm-cloaked.dm-ready {
5596
5596
  ============================================ */
5597
5597
 
5598
5598
  /*!
5599
- * Domma Elements CSS v0.53.2
5599
+ * Domma Elements CSS v0.54.0
5600
5600
  * Dynamic Object Manipulation & Modeling API
5601
5601
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5602
- * Built: 2026-10-17T11:20:35.317Z
5603
- * Commit: ddc1a73
5602
+ * Built: 2026-10-24T13:16:34.341Z
5603
+ * Commit: 8d2b9ea
5604
5604
  */
5605
5605
 
5606
5606
  /**
@@ -15161,11 +15161,11 @@ a.avatar-more-person:hover .avatar-more-name {
15161
15161
  ============================================ */
15162
15162
 
15163
15163
  /*!
15164
- * Domma Themes v0.53.2
15164
+ * Domma Themes v0.54.0
15165
15165
  * Dynamic Object Manipulation & Modeling API
15166
15166
  * (c) 2026 Darryl Waterhouse & DCBW-IT
15167
- * Built: 2026-10-17T11:20:35.295Z
15168
- * Commit: ddc1a73
15167
+ * Built: 2026-10-24T13:16:34.318Z
15168
+ * Commit: 8d2b9ea
15169
15169
  */
15170
15170
 
15171
15171
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Full CSS Bundle v0.53.2
2
+ * Domma Full CSS Bundle v0.54.0
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-10-17T11:20:35.470Z
5
+ * Built: 2026-10-24T13:16:34.495Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.53.2
14
+ * Domma Core CSS v0.54.0
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-10-17T11:20:35.308Z
18
- * Commit: ddc1a73
17
+ * Built: 2026-10-24T13:16:34.331Z
18
+ * Commit: 8d2b9ea
19
19
  */
20
20
 
21
21
  /**
@@ -4971,11 +4971,11 @@ body.dm-cloaked.dm-ready {
4971
4971
  ============================================ */
4972
4972
 
4973
4973
  /*!
4974
- * Domma Grid CSS v0.53.2
4974
+ * Domma Grid CSS v0.54.0
4975
4975
  * Dynamic Object Manipulation & Modeling API
4976
4976
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4977
- * Built: 2026-10-17T11:20:35.312Z
4978
- * Commit: ddc1a73
4977
+ * Built: 2026-10-24T13:16:34.336Z
4978
+ * Commit: 8d2b9ea
4979
4979
  */
4980
4980
 
4981
4981
  /**
@@ -5596,11 +5596,11 @@ body.dm-cloaked.dm-ready {
5596
5596
  ============================================ */
5597
5597
 
5598
5598
  /*!
5599
- * Domma Elements CSS v0.53.2
5599
+ * Domma Elements CSS v0.54.0
5600
5600
  * Dynamic Object Manipulation & Modeling API
5601
5601
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5602
- * Built: 2026-10-17T11:20:35.317Z
5603
- * Commit: ddc1a73
5602
+ * Built: 2026-10-24T13:16:34.341Z
5603
+ * Commit: 8d2b9ea
5604
5604
  */
5605
5605
 
5606
5606
  /**
@@ -15161,11 +15161,11 @@ a.avatar-more-person:hover .avatar-more-name {
15161
15161
  ============================================ */
15162
15162
 
15163
15163
  /*!
15164
- * Domma Themes v0.53.2
15164
+ * Domma Themes v0.54.0
15165
15165
  * Dynamic Object Manipulation & Modeling API
15166
15166
  * (c) 2026 Darryl Waterhouse & DCBW-IT
15167
- * Built: 2026-10-17T11:20:35.295Z
15168
- * Commit: ddc1a73
15167
+ * Built: 2026-10-24T13:16:34.318Z
15168
+ * Commit: 8d2b9ea
15169
15169
  */
15170
15170
 
15171
15171
  /**
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Domma Minimal CSS Bundle v0.53.2
2
+ * Domma Minimal CSS Bundle v0.54.0
3
3
  * Dynamic Object Manipulation & Modeling API
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-10-17T11:20:35.464Z
5
+ * Built: 2026-10-24T13:16:34.488Z
6
6
  */
7
7
 
8
8
  /* ============================================
@@ -11,11 +11,11 @@
11
11
  ============================================ */
12
12
 
13
13
  /*!
14
- * Domma Core CSS v0.53.2
14
+ * Domma Core CSS v0.54.0
15
15
  * Dynamic Object Manipulation & Modeling API
16
16
  * (c) 2026 Darryl Waterhouse & DCBW-IT
17
- * Built: 2026-10-17T11:20:35.308Z
18
- * Commit: ddc1a73
17
+ * Built: 2026-10-24T13:16:34.331Z
18
+ * Commit: 8d2b9ea
19
19
  */
20
20
 
21
21
  /**
@@ -4971,11 +4971,11 @@ body.dm-cloaked.dm-ready {
4971
4971
  ============================================ */
4972
4972
 
4973
4973
  /*!
4974
- * Domma Grid CSS v0.53.2
4974
+ * Domma Grid CSS v0.54.0
4975
4975
  * Dynamic Object Manipulation & Modeling API
4976
4976
  * (c) 2026 Darryl Waterhouse & DCBW-IT
4977
- * Built: 2026-10-17T11:20:35.312Z
4978
- * Commit: ddc1a73
4977
+ * Built: 2026-10-24T13:16:34.336Z
4978
+ * Commit: 8d2b9ea
4979
4979
  */
4980
4980
 
4981
4981
  /**
@@ -1,10 +1,11 @@
1
1
  /*!
2
- * Domma Flags v0.53.2
2
+ * Domma Flags v0.54.0
3
3
  * Nation flags as inline SVG (opt-in module)
4
4
  * (c) 2026 Darryl Waterhouse & DCBW-IT
5
- * Built: 2026-10-17T11:20:19.523Z
6
- * Commit: ddc1a73
5
+ * Built: 2026-10-24T13:16:17.257Z
6
+ * Commit: 8d2b9ea
7
7
  *
8
8
  * Requires: domma.min.js
9
9
  */
10
10
  const e={gb:{name:"United Kingdom",svg:'<rect width="60" height="40" fill="#012169"/><path d="M0,0 60,40 M60,0 0,40" stroke="#fff" stroke-width="8"/><path d="M0,0 60,40 M60,0 0,40" stroke="#C8102E" stroke-width="4"/><path d="M30,0 V40 M0,20 H60" stroke="#fff" stroke-width="13"/><path d="M30,0 V40 M0,20 H60" stroke="#C8102E" stroke-width="8"/>'},fr:{name:"France",stripes:{dir:"v",colors:["#0055A4","#FFFFFF","#EF4135"]}},de:{name:"Germany",stripes:{dir:"h",colors:["#000000","#DD0000","#FFCE00"]}},it:{name:"Italy",stripes:{dir:"v",colors:["#009246","#FFFFFF","#CE2B37"]}},es:{name:"Spain",stripes:{dir:"h",colors:["#AA151B","#F1BF00","#AA151B"],weights:[1,2,1]}},pt:{name:"Portugal",stripes:{dir:"v",colors:["#006600","#FF0000"],weights:[2,3]},overlays:[{type:"circle",cx:24,cy:20,r:5,fill:"#FFE936",stroke:"#006600",strokeWidth:1},{type:"circle",cx:24,cy:20,r:2.4,fill:"#FF0000"}]},nl:{name:"Netherlands",stripes:{dir:"h",colors:["#AE1C28","#FFFFFF","#21468B"]}},be:{name:"Belgium",stripes:{dir:"v",colors:["#000000","#FAE042","#ED2939"]}},ie:{name:"Ireland",stripes:{dir:"v",colors:["#169B62","#FFFFFF","#FF883E"]}},ch:{name:"Switzerland",bg:"#FF0000",overlays:[{type:"rect",x:27,y:11,w:6,h:18,fill:"#fff"},{type:"rect",x:21,y:17,w:18,h:6,fill:"#fff"}]},at:{name:"Austria",stripes:{dir:"h",colors:["#ED2939","#FFFFFF","#ED2939"]}},se:{name:"Sweden",cross:{bg:"#006AA7",colour:"#FECC00"}},no:{name:"Norway",cross:{bg:"#BA0C2F",border:"#FFFFFF",colour:"#00205B"}},dk:{name:"Denmark",cross:{bg:"#C60C30",colour:"#FFFFFF"}},fi:{name:"Finland",cross:{bg:"#FFFFFF",colour:"#003580"}},is:{name:"Iceland",cross:{bg:"#02529C",border:"#FFFFFF",colour:"#DC1E35"}},pl:{name:"Poland",stripes:{dir:"h",colors:["#FFFFFF","#DC143C"]}},ua:{name:"Ukraine",stripes:{dir:"h",colors:["#0057B7","#FFD700"]}},gr:{name:"Greece",stripes:{dir:"h",colors:["#0D5EAF","#fff","#0D5EAF","#fff","#0D5EAF","#fff","#0D5EAF","#fff","#0D5EAF"]},overlays:[{type:"rect",x:0,y:0,w:22.22,h:22.22,fill:"#0D5EAF"},{type:"rect",x:8.9,y:0,w:4.44,h:22.22,fill:"#fff"},{type:"rect",x:0,y:8.9,w:22.22,h:4.44,fill:"#fff"}]},hr:{name:"Croatia",stripes:{dir:"h",colors:["#FF0000","#FFFFFF","#171796"]}},ru:{name:"Russia",stripes:{dir:"h",colors:["#FFFFFF","#0039A6","#D52B1E"]}},cz:{name:"Czechia",stripes:{dir:"h",colors:["#FFFFFF","#D7141A"]},overlays:[{type:"path",d:"M0,0 L30,20 L0,40 Z",fill:"#11457E"}]}},t={us:{name:"United States",svg:'<rect width="60" height="40" fill="#fff"/><g fill="#B22234"><rect y="0" width="60" height="3.08"/><rect y="6.15" width="60" height="3.08"/><rect y="12.31" width="60" height="3.08"/><rect y="18.46" width="60" height="3.08"/><rect y="24.62" width="60" height="3.08"/><rect y="30.77" width="60" height="3.08"/><rect y="36.92" width="60" height="3.08"/></g><rect width="24" height="21.54" fill="#3C3B6E"/><g fill="#fff"><circle cx="3" cy="3" r="0.9"/><circle cx="7" cy="3" r="0.9"/><circle cx="11" cy="3" r="0.9"/><circle cx="15" cy="3" r="0.9"/><circle cx="19" cy="3" r="0.9"/><circle cx="5" cy="6" r="0.9"/><circle cx="9" cy="6" r="0.9"/><circle cx="13" cy="6" r="0.9"/><circle cx="17" cy="6" r="0.9"/><circle cx="21" cy="6" r="0.9"/><circle cx="3" cy="9" r="0.9"/><circle cx="7" cy="9" r="0.9"/><circle cx="11" cy="9" r="0.9"/><circle cx="15" cy="9" r="0.9"/><circle cx="19" cy="9" r="0.9"/><circle cx="5" cy="12" r="0.9"/><circle cx="9" cy="12" r="0.9"/><circle cx="13" cy="12" r="0.9"/><circle cx="17" cy="12" r="0.9"/><circle cx="21" cy="12" r="0.9"/><circle cx="3" cy="15" r="0.9"/><circle cx="7" cy="15" r="0.9"/><circle cx="11" cy="15" r="0.9"/><circle cx="15" cy="15" r="0.9"/><circle cx="19" cy="15" r="0.9"/><circle cx="5" cy="18" r="0.9"/><circle cx="9" cy="18" r="0.9"/><circle cx="13" cy="18" r="0.9"/><circle cx="17" cy="18" r="0.9"/><circle cx="21" cy="18" r="0.9"/></g>'},ca:{name:"Canada",stripes:{dir:"v",colors:["#FF0000","#FFFFFF","#FF0000"],weights:[1,2,1]},overlays:[{type:"path",fill:"#FF0000",d:"M30 8 l1.6 3.4 3.6-0.8-1.2 2.6 2.4 1-2 1.8 3.4 1-3.4 1 0.5 1.2-3.1-0.4 0.4 4-1.6-2.4-1.6 2.4 0.4-4-3.1 0.4 0.5-1.2-3.4-1 3.4-1-2-1.8 2.4-1-1.2-2.6 3.6 0.8z"}]},br:{name:"Brazil",bg:"#009C3B",overlays:[{type:"path",d:"M30,5 L53,20 L30,35 L7,20 Z",fill:"#FFDF00"},{type:"circle",cx:30,cy:20,r:9,fill:"#002776"},{type:"path",d:"M21.5,17.5 A12,12 0 0 1 38.5,21",fill:"none",stroke:"#fff",strokeWidth:1.6},{type:"star",cx:27,cy:18,r:1.1,fill:"#fff"},{type:"star",cx:33,cy:17,r:1.1,fill:"#fff"},{type:"star",cx:30,cy:23,r:1.1,fill:"#fff"},{type:"star",cx:35,cy:22,r:1.1,fill:"#fff"},{type:"star",cx:25,cy:22,r:1.1,fill:"#fff"}]},ar:{name:"Argentina",stripes:{dir:"h",colors:["#74ACDF","#FFFFFF","#74ACDF"]},overlays:[{type:"circle",cx:30,cy:20,r:3.4,fill:"#F6B40E",stroke:"#85340A",strokeWidth:.4}]},mx:{name:"Mexico",stripes:{dir:"v",colors:["#006847","#FFFFFF","#CE1126"]},overlays:[{type:"circle",cx:30,cy:20,r:3.2,fill:"#8C9A5B"}]},cl:{name:"Chile",overlays:[{type:"rect",x:0,y:0,w:60,h:20,fill:"#fff"},{type:"rect",x:0,y:20,w:60,h:20,fill:"#D52B1E"},{type:"rect",x:0,y:0,w:20,h:20,fill:"#0039A6"},{type:"star",cx:10,cy:10,r:6,fill:"#fff"}]},co:{name:"Colombia",stripes:{dir:"h",colors:["#FCD116","#003893","#CE1126"],weights:[2,1,1]}},pe:{name:"Peru",stripes:{dir:"v",colors:["#D91023","#FFFFFF","#D91023"]}},uy:{name:"Uruguay",stripes:{dir:"h",colors:["#fff","#0038A8","#fff","#0038A8","#fff","#0038A8","#fff","#0038A8","#fff"]},overlays:[{type:"rect",x:0,y:0,w:20,h:17.78,fill:"#fff"},{type:"circle",cx:10,cy:8.9,r:4.5,fill:"#FCD116",stroke:"#7B3F00",strokeWidth:.5}]}},r={za:{name:"South Africa",svg:'<rect width="60" height="40" fill="#fff"/><path d="M0,0 H22 L40,20 L22,40 H0 Z" fill="#002395"/><path d="M0,0 L26,20 L0,40 Z" fill="#000"/><rect x="0" y="0" width="60" height="13.3" fill="#DE3831"/><rect x="0" y="26.7" width="60" height="13.3" fill="#002395"/><path d="M0,0 L26,20 L0,40" fill="none" stroke="#FFB915" stroke-width="3"/><path d="M0,3 L21,20 L0,37" fill="none" stroke="#007749" stroke-width="6"/><path d="M-1,13.3 H60 M-1,26.7 H60" stroke="#fff" stroke-width="0"/><rect x="26" y="14.8" width="34" height="10.4" fill="#007749"/><path d="M0,6 L18,20 L0,34" fill="none" stroke="#fff" stroke-width="1.5"/>'},ng:{name:"Nigeria",stripes:{dir:"v",colors:["#008751","#FFFFFF","#008751"]}},gh:{name:"Ghana",stripes:{dir:"h",colors:["#CE1126","#FCD116","#006B3F"]},overlays:[{type:"star",cx:30,cy:20,r:5,fill:"#000"}]},eg:{name:"Egypt",stripes:{dir:"h",colors:["#CE1126","#FFFFFF","#000000"]},overlays:[{type:"path",d:"M30,17 l1.2,2.6 2.8-0.4-2,2 0.7,2.8-2.7-1.4-2.7,1.4 0.7-2.8-2-2 2.8,0.4z",fill:"#C09300"}]},ma:{name:"Morocco",bg:"#C1272D",overlays:[{type:"star",cx:30,cy:20,r:8,fill:"none",stroke:"#006233",strokeWidth:1.6}]},sn:{name:"Senegal",stripes:{dir:"v",colors:["#00853F","#FDEF42","#E31B23"]},overlays:[{type:"star",cx:30,cy:20,r:4.5,fill:"#00853F"}]},ci:{name:"Ivory Coast",stripes:{dir:"v",colors:["#F77F00","#FFFFFF","#009E60"]}},cm:{name:"Cameroon",stripes:{dir:"v",colors:["#007A5E","#CE1126","#FCD116"]},overlays:[{type:"star",cx:30,cy:20,r:4,fill:"#FCD116"}]},dz:{name:"Algeria",overlays:[{type:"rect",x:0,y:0,w:30,h:40,fill:"#006233"},{type:"rect",x:30,y:0,w:30,h:40,fill:"#fff"},{type:"crescent",cx:28,cy:20,r:7,off:3,fill:"#D21034"},{type:"star",cx:36,cy:20,r:4,fill:"#D21034"}]},tn:{name:"Tunisia",bg:"#E70013",overlays:[{type:"circle",cx:30,cy:20,r:9,fill:"#fff"},{type:"crescent",cx:31,cy:20,r:5.5,off:2.6,fill:"#E70013"},{type:"star",cx:33,cy:20,r:3,fill:"#E70013"}]},ke:{name:"Kenya",stripes:{dir:"h",colors:["#000000","#fff","#BB0000","#fff","#006600"],weights:[12,1,12,1,12]},overlays:[{type:"line",x1:24,y1:8,x2:36,y2:32,stroke:"#000",strokeWidth:1},{type:"line",x1:36,y1:8,x2:24,y2:32,stroke:"#000",strokeWidth:1},{type:"ellipse",cx:30,cy:20,rx:4,ry:8,fill:"#fff"},{type:"ellipse",cx:30,cy:20,rx:2.6,ry:6.4,fill:"#BB0000"}]}},i={jp:{name:"Japan",bg:"#FFFFFF",overlays:[{type:"circle",cx:30,cy:20,r:10,fill:"#BC002D"}]},cn:{name:"China",bg:"#DE2910",overlays:[{type:"star",cx:12,cy:11,r:6,fill:"#FFDE00"},{type:"star",cx:22,cy:5,r:2,fill:"#FFDE00"},{type:"star",cx:26,cy:9,r:2,fill:"#FFDE00"},{type:"star",cx:26,cy:15,r:2,fill:"#FFDE00"},{type:"star",cx:22,cy:19,r:2,fill:"#FFDE00"}]},kr:{name:"South Korea",bg:"#FFFFFF",overlays:[{type:"path",d:"M30,13 a7,7 0 0 1 0,14 a3.5,3.5 0 0 1 0,-7 a3.5,3.5 0 0 0 0,-7 Z",fill:"#CD2E3A"},{type:"path",d:"M30,13 a7,7 0 0 0 0,14 a3.5,3.5 0 0 0 0,-7 a3.5,3.5 0 0 1 0,-7 Z",fill:"#0047A0"},{type:"circle",cx:30,cy:16.5,r:3.5,fill:"#CD2E3A"},{type:"circle",cx:30,cy:23.5,r:3.5,fill:"#0047A0"},{type:"group",children:[{type:"rect",x:9,y:8,w:7,h:1.3,fill:"#000"},{type:"rect",x:9,y:10.4,w:7,h:1.3,fill:"#000"},{type:"rect",x:9,y:12.8,w:7,h:1.3,fill:"#000"}]},{type:"group",children:[{type:"rect",x:44,y:8,w:7,h:1.3,fill:"#000"},{type:"rect",x:44,y:10.4,w:7,h:1.3,fill:"#000"},{type:"rect",x:44,y:12.8,w:7,h:1.3,fill:"#000"}]}]},in:{name:"India",stripes:{dir:"h",colors:["#FF9933","#FFFFFF","#138808"]},overlays:[{type:"circle",cx:30,cy:20,r:5,fill:"none",stroke:"#000080",strokeWidth:.8},{type:"circle",cx:30,cy:20,r:1,fill:"#000080"},{type:"path",d:"M30,15 V25 M25,20 H35 M26.5,16.5 L33.5,23.5 M33.5,16.5 L26.5,23.5",stroke:"#000080",strokeWidth:.5}]},sa:{name:"Saudi Arabia",bg:"#006C35",overlays:[{type:"rect",x:10,y:26,w:40,h:1.6,fill:"#fff"},{type:"path",d:"M10,26.8 l4,-2 v4 z",fill:"#fff"},{type:"rect",x:14,y:14,w:32,h:5,fill:"none"}]},ae:{name:"United Arab Emirates",overlays:[{type:"rect",x:0,y:0,w:60,h:13.33,fill:"#00732F"},{type:"rect",x:0,y:13.33,w:60,h:13.33,fill:"#fff"},{type:"rect",x:0,y:26.66,w:60,h:13.34,fill:"#000"},{type:"rect",x:0,y:0,w:15,h:40,fill:"#FF0000"}]},qa:{name:"Qatar",bg:"#FFFFFF",overlays:[{type:"path",d:"M22,0 H60 V40 H22 L27,36 L22,32 L27,28 L22,24 L27,20 L22,16 L27,12 L22,8 L27,4 Z",fill:"#8A1538"}]},id:{name:"Indonesia",stripes:{dir:"h",colors:["#FF0000","#FFFFFF"]}},th:{name:"Thailand",stripes:{dir:"h",colors:["#A51931","#F4F5F8","#2D2A4A","#F4F5F8","#A51931"],weights:[1,1,2,1,1]}},vn:{name:"Vietnam",bg:"#DA251D",overlays:[{type:"star",cx:30,cy:20,r:9,fill:"#FFFF00"}]},tr:{name:"Turkey",bg:"#E30A17",overlays:[{type:"crescent",cx:24,cy:20,r:8,off:3.2,fill:"#fff"},{type:"star",cx:35,cy:20,r:4,rotation:-54,fill:"#fff"}]},il:{name:"Israel",bg:"#FFFFFF",overlays:[{type:"rect",x:0,y:4,w:60,h:4,fill:"#0038B8"},{type:"rect",x:0,y:32,w:60,h:4,fill:"#0038B8"},{type:"path",d:"M30,13 L33.5,19 H26.5 Z",fill:"none",stroke:"#0038B8",strokeWidth:1},{type:"path",d:"M30,27 L33.5,21 H26.5 Z",fill:"none",stroke:"#0038B8",strokeWidth:1}]}},l='<g transform="scale(0.5)"><rect width="60" height="40" fill="#012169"/><path d="M0,0 60,40 M60,0 0,40" stroke="#fff" stroke-width="8"/><path d="M0,0 60,40 M60,0 0,40" stroke="#C8102E" stroke-width="4"/><path d="M30,0 V40 M0,20 H60" stroke="#fff" stroke-width="13"/><path d="M30,0 V40 M0,20 H60" stroke="#C8102E" stroke-width="8"/></g>',c={au:{name:"Australia",svg:'<rect width="60" height="40" fill="#012169"/>'+l+'<path fill="#fff" d="M15,25 l1.3,3.9 4.1,0 -3.3,2.4 1.3,3.9 -3.4,-2.4 -3.4,2.4 1.3,-3.9 -3.3,-2.4 4.1,0 Z"/><g fill="#fff"><path d="M47,7 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><path d="M40,19 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><path d="M47,31 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><path d="M54,18 l0.9,2.7 2.8,0 -2.3,1.7 0.9,2.7 -2.3,-1.7 -2.3,1.7 0.9,-2.7 -2.3,-1.7 2.8,0 Z"/><circle cx="49" cy="24" r="1.2"/></g>'},nz:{name:"New Zealand",svg:'<rect width="60" height="40" fill="#00247D"/>'+l+'<g><path fill="#fff" d="M47,7 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M47,8.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/><path fill="#fff" d="M41,20 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M41,21.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/><path fill="#fff" d="M53,18 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M53,19.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/><path fill="#fff" d="M47,32 l1,2.9 3,0 -2.5,1.9 1,2.9 -2.5,-1.8 -2.5,1.8 1,-2.9 -2.5,-1.9 3,0 Z"/><path fill="#CC142B" d="M47,33.5 l0.6,1.9 2,0 -1.6,1.2 0.6,1.9 -1.6,-1.2 -1.6,1.2 0.6,-1.9 -1.6,-1.2 2,0 Z"/></g>'}},s={...e,...t,...r,...i,...c},a={europe:{name:"Europe",description:"European nations",codes:Object.keys(e)},americas:{name:"Americas",description:"North, Central & South America",codes:Object.keys(t)},africa:{name:"Africa",description:"African nations",codes:Object.keys(r)},asia:{name:"Asia & Middle East",description:"Asian and Middle Eastern nations",codes:Object.keys(i)},oceania:{name:"Oceania",description:"Australia, New Zealand & the Pacific",codes:Object.keys(c)}};let o=0;function n(e){return String(e).replace(/"/g,"&quot;")}function f(e){const t=void 0!==e.fill?` fill="${n(e.fill)}"`:"",r=e.stroke?` stroke="${n(e.stroke)}"`:"",i=void 0!==e.strokeWidth?` stroke-width="${e.strokeWidth}"`:"",l=r+i+(r&&!e.fill?' fill="none"':"");switch(e.type){case"rect":return`<rect x="${e.x}" y="${e.y}" width="${e.w}" height="${e.h}"${e.rx?` rx="${e.rx}"`:""}${t}${l}/>`;case"circle":return`<circle cx="${e.cx}" cy="${e.cy}" r="${e.r}"${t}${l}/>`;case"ellipse":return`<ellipse cx="${e.cx}" cy="${e.cy}" rx="${e.rx}" ry="${e.ry}"${t}${l}/>`;case"line":return`<line x1="${e.x1}" y1="${e.y1}" x2="${e.x2}" y2="${e.y2}"${r}${i}/>`;case"path":return`<path d="${e.d}"${t}${l}/>`;case"star":return`<path d="${function(e,t,r,i=5,l=.382,c=-90){const s=r*l,a=Math.PI/i,o=c*Math.PI/180;let n="";for(let l=0;l<2*i;l++){const i=l%2==0?r:s,c=o+l*a;n+=(0===l?"M":"L")+(e+i*Math.cos(c)).toFixed(2)+","+(t+i*Math.sin(c)).toFixed(2)}return n+"Z"}(e.cx,e.cy,e.r,e.points||5,e.innerRatio||.382,void 0===e.rotation?-90:e.rotation)}"${t||' fill="#fff"'}${l}/>`;case"crescent":return`<path d="${function(e,t,r,i=.45*r){const l=Math.sqrt(i*i+r*r),c=(t-r).toFixed(2),s=(t+r).toFixed(2),a=e.toFixed(2);return`M${a},${c} A${r},${r} 0 1 0 ${a},${s} A${l.toFixed(2)},${l.toFixed(2)} 0 0 1 ${a},${c}Z`}(e.cx,e.cy,e.r,e.off)}"${t||' fill="#fff"'}${l}/>`;case"group":return`<g${e.transform?` transform="${n(e.transform)}"`:""}>${(e.children||[]).map(f).join("")}</g>`;default:return""}}function h(e){if(e.svg)return e.svg;let t="";return e.stripes&&(t+=function({dir:e="h",colors:t=[],weights:r=null}){const i=r?r.reduce((e,t)=>e+t,0):t.length;let l=0,c="";return t.forEach((t,s)=>{const a=r?r[s]:1;if("v"===e){const e=60*a/i;c+=`<rect x="${(60*l/i).toFixed(3)}" y="0" width="${e.toFixed(3)}" height="40" fill="${n(t)}"/>`}else{const e=40*a/i;c+=`<rect x="0" y="${(40*l/i).toFixed(3)}" width="60" height="${e.toFixed(3)}" fill="${n(t)}"/>`}l+=a}),c}(e.stripes)),e.cross&&(t+=function({bg:e,colour:t,border:r=null,thickness:i=8}){const l=i,c=20-l/2;let s=`<rect x="0" y="0" width="60" height="40" fill="${n(e)}"/>`;if(r){const e=2;s+=`<rect x="${16-e}" y="0" width="${l+2*e}" height="40" fill="${n(r)}"/>`,s+=`<rect x="0" y="${c-e}" width="60" height="${l+2*e}" fill="${n(r)}"/>`}return s+=`<rect x="16" y="0" width="${l}" height="40" fill="${n(t)}"/>`,s+=`<rect x="0" y="${c}" width="60" height="${l}" fill="${n(t)}"/>`,s}(e.cross)),!e.bg||e.stripes||e.cross||(t=`<rect x="0" y="0" width="60" height="40" fill="${n(e.bg)}"/>`+t),e.overlays&&(t+=e.overlays.map(f).join("")),t}class d{constructor(){this._flags={...s},this._regions={...a},this._cache={}}_markup(e){if(void 0!==this._cache[e])return this._cache[e];const t=this._flags[e],r=t?h(t):null;return this._cache[e]=r,r}render(e,t={}){e=String(e||"").toLowerCase();const r=this._flags[e];if(!r)return console.warn(`Flag "${e}" not found`),null;const{size:i=24,width:l=null,height:c=null,shape:s="rect",border:a=!1,class:f="",title:h=null,attrs:d={}}=t,y="square"===s||"circle"===s,F=c||i,p=l||(y?F:1.5*F),g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox",y?"10 0 40 40":"0 0 60 40"),g.setAttribute("width",p),g.setAttribute("height",F),g.setAttribute("role","img");const x=h||r.name||e.toUpperCase();g.setAttribute("aria-label",x);const u=["dm-flag",`dm-flag-${s}`];f&&u.push(f),g.setAttribute("class",u.join(" ")),Object.entries(d).forEach(([e,t])=>g.setAttribute(e,t));const w="dm-flag-clip-"+ ++o;let m=`<title>${n(x)}</title>`;const $=this._markup(e)||"";if("circle"===s){if(m+=`<defs><clipPath id="${w}"><circle cx="30" cy="20" r="20"/></clipPath></defs>`,m+=`<g clip-path="url(#${w})">${$}</g>`,a){m+=`<circle cx="30" cy="20" r="19.25" fill="none" stroke="${n("string"==typeof a?a:"rgba(0,0,0,0.15)")}" stroke-width="1.5"/>`}}else if("rounded"===s){if(m+=`<defs><clipPath id="${w}"><rect x="0" y="0" width="60" height="40" rx="6"/></clipPath></defs>`,m+=`<g clip-path="url(#${w})">${$}</g>`,a){m+=`<rect x="0.75" y="0.75" width="58.5" height="38.5" rx="5.25" fill="none" stroke="${n("string"==typeof a?a:"rgba(0,0,0,0.15)")}" stroke-width="1.5"/>`}}else if(m+=$,a){const e="string"==typeof a?a:"rgba(0,0,0,0.15)",t=y?{x:10.5,y:.5,w:39,h:39}:{x:.5,y:.5,w:59,h:39};m+=`<rect x="${t.x}" y="${t.y}" width="${t.w}" height="${t.h}" fill="none" stroke="${n(e)}" stroke-width="1"/>`}return g.innerHTML=m,g}html(e,t={}){const r=this.render(e,t);if(!r)return"";const i=document.createElement("div");return i.appendChild(r),i.innerHTML}inject(e,t,r={}){const{position:i="prepend",...l}=r,c="string"==typeof e?document.querySelector(e):e;if(!c)return console.warn(`Target element not found: ${e}`),null;const s=this.render(t,l);return s?("append"===i?c.appendChild(s):"replace"===i?(c.innerHTML="",c.appendChild(s)):c.insertBefore(s,c.firstChild),s):null}scan(e=document){const t="string"==typeof e?document.querySelector(e):e;if(!t)return 0;const r=t.querySelectorAll("[data-flag]:not([data-flag-processed])");let i=0;return r.forEach(e=>{if("svg"===e.tagName.toLowerCase()||e.querySelector("svg"))return;const t=e.dataset.flag,r=parseInt(e.dataset.flagSize,10)||24,l=e.dataset.flagShape||"rect",c=e.dataset.flagClass||"",s=void 0!==e.dataset.flagBorder&&(""===e.dataset.flagBorder||"true"===e.dataset.flagBorder||e.dataset.flagBorder),a=e.dataset.flagTitle||null,o=this.render(t,{size:r,shape:l,class:c,border:s,title:a});o?(e.className&&o.classList.add(...e.className.split(" ").filter(Boolean)),o.setAttribute("data-flag",t),o.setAttribute("data-flag-processed","true"),e.replaceWith(o),i++):e.setAttribute("data-flag-processed","true")}),i}register(e,t){if(!e||!t)return console.warn("Invalid flag registration: code and definition required"),this;e=String(e).toLowerCase(),this._flags[e]=t,delete this._cache[e];const r=t.region||"custom";return this._regions[r]||(this._regions[r]={name:r.charAt(0).toUpperCase()+r.slice(1),codes:[]}),this._regions[r].codes.includes(e)||this._regions[r].codes.push(e),this}unregister(e){return e=String(e||"").toLowerCase(),!!this._flags[e]&&(delete this._flags[e],delete this._cache[e],Object.values(this._regions).forEach(t=>{const r=t.codes.indexOf(e);r>-1&&t.codes.splice(r,1)}),!0)}has(e){return!!this._flags[String(e||"").toLowerCase()]}get(e){return this._flags[String(e||"").toLowerCase()]||null}name(e){const t=this.get(e);return t?t.name:null}list(e=null){return e&&this._regions[e]?[...this._regions[e].codes]:Object.keys(this._flags)}listRegions(){return{...this._regions}}count(){return Object.keys(this._flags).length}search(e){const t=String(e||"").toLowerCase().trim();return t?Object.keys(this._flags).filter(e=>e.includes(t)||(this._flags[e].name||"").toLowerCase().includes(t)):[]}}const y=new d;"undefined"!=typeof window&&window.Domma&&(window.Domma.flags=y,window.Domma.FL=y),"undefined"!=typeof window&&(window.FL=y);export{d as FlagRegistry,y as default,y as flags};
11
+ //# sourceMappingURL=domma-flags.esm.js.map