@ui0/icon 0.1.2 → 0.1.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 (37) hide show
  1. package/dist/icon.module.css +1 -1
  2. package/dist/icon.vue.d.ts +3 -1
  3. package/dist/icon.vue.d.ts.map +1 -1
  4. package/dist/index.js +345 -269
  5. package/dist/interactions.vue.d.ts +10 -0
  6. package/dist/interactions.vue.d.ts.map +1 -0
  7. package/dist/modifiers.d.ts +21 -0
  8. package/dist/modifiers.d.ts.map +1 -0
  9. package/dist/style.css +1 -1
  10. package/dist/types.d.ts +4 -2
  11. package/dist/types.d.ts.map +1 -1
  12. package/dist/util.d.ts.map +1 -1
  13. package/dist/vite/compose.d.ts.map +1 -1
  14. package/dist/vite/index.d.ts +2 -3
  15. package/dist/vite/index.d.ts.map +1 -1
  16. package/dist/vite/index.js +704 -500
  17. package/dist/vite/next/compose.d.ts +15 -0
  18. package/dist/vite/next/compose.d.ts.map +1 -0
  19. package/dist/vite/next/plugin.d.ts +5 -0
  20. package/dist/vite/next/plugin.d.ts.map +1 -0
  21. package/dist/vite/next/sources.d.ts +27 -0
  22. package/dist/vite/next/sources.d.ts.map +1 -0
  23. package/dist/vite/options.d.ts +2 -0
  24. package/dist/vite/options.d.ts.map +1 -1
  25. package/dist/vite/progress/compiler.d.ts +25 -0
  26. package/dist/vite/progress/compiler.d.ts.map +1 -0
  27. package/dist/vite/progress/runtime.d.ts +3 -0
  28. package/dist/vite/progress/runtime.d.ts.map +1 -0
  29. package/dist/vite/progress/types.d.ts +21 -0
  30. package/dist/vite/progress/types.d.ts.map +1 -0
  31. package/dist/vite/transformer-next.d.ts +16 -0
  32. package/dist/vite/transformer-next.d.ts.map +1 -0
  33. package/dist/vite/transformer.d.ts +3 -0
  34. package/dist/vite/transformer.d.ts.map +1 -1
  35. package/dist/vite/types.d.ts +22 -3
  36. package/dist/vite/types.d.ts.map +1 -1
  37. package/package.json +11 -10
@@ -1,138 +1,70 @@
1
- var et = Object.defineProperty;
2
- var st = (i, t, s) => t in i ? et(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
3
- var M = (i, t, s) => st(i, typeof t != "symbol" ? t + "" : t, s);
4
- import I from "node:path";
5
- import { createFilter as z } from "vite";
6
- import J from "node:fs";
7
- const it = `<svg width="960" height="960" viewBox="0 0 960 960">>
8
- <path class="no-fill" d="M340 340 C494.6 340 620 465.4 620 620" />
9
- </svg>
10
- `, rt = `<svg width="960" height="960" viewBox="0 0 960 960">
11
- <path class="no-fill" d="M480 600 L480 360 M480 360 L395.1 444.9 M480 360 L564.9 444.9"/>
12
- </svg>
13
- `, at = `<svg width="960" height="960" viewBox="0 0 960 960">
14
-
15
- <polyline points="347.69,546.155 480,413.845 612.31,546.155"/>
16
-
17
- </svg>
18
- `, nt = `<svg viewBox="0 0 960 960">
19
- <circle cx="480" cy="480" r="320"/>
20
- </svg>
21
- `, ot = `<svg>
22
- <path class="no-fill" d="M480,480h280c0,74.2-29.5,145.5-82,198-52.5,52.5-123.8,82-198,82v-280Z"/>
23
- </svg>
24
- `, ct = `<svg viewBox="0 0 960 960"><circle cx="480" cy="480" r="60"/></svg>
25
- `, lt = `<svg data-icon="utility no-progress" viewBox="0 0 960 960">
26
- <path d="M441.3,253.9c17.2-29.8,60.2-29.8,77.4,0l117.6,203.8,117.6,203.8c17.2,29.8-4.3,67-38.7,67H244.7c-34.4,0-55.9-37.2-38.7-67l117.6-203.8,117.6-203.8Z"/>
27
- </svg>
28
- `, j = {
29
- "arc-90": it,
30
- arrow: rt,
31
- chevron: at,
32
- circle: nt,
33
- "pie-90": ot,
34
- point: ct,
35
- triangle: lt
36
- };
37
- function k(i) {
38
- return "file" in i;
39
- }
40
- const y = ".svg", A = "ui0-icon:";
41
- function P(i, t, s, r = 480, e = 480) {
42
- const c = i.split(/[\s,]+/).map(parseFloat), l = i.includes(",") ? "," : " ";
43
- return c.map((u, p) => {
44
- const o = p % 2 === 0, g = o ? r : e, d = o ? t : s;
45
- return ((u - g) * d + g).toFixed(2);
46
- }).reduce((u, p, o) => u + (o > 0 ? o % 2 === 0 ? " " : l : "") + p, "");
47
- }
48
- function Y(i, t) {
49
- return i.replace(/([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/g, (s) => (parseFloat(s) * t).toFixed(2));
50
- }
51
- function G(i, t, s) {
52
- const [r = 0, e = 0] = s, { x1: c, y1: l, x2: u, y2: p, ...o } = i, g = parseFloat(c).toFixed(3), d = parseFloat(l).toFixed(3), n = parseFloat(u).toFixed(3), h = parseFloat(p).toFixed(3), a = (f, x) => (x + (f - x) * t).toFixed(3);
1
+ var At = Object.defineProperty;
2
+ var St = (r, t, e) => t in r ? At(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var I = (r, t, e) => St(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { createHash as Nt } from "node:crypto";
5
+ import { createRequire as kt } from "node:module";
6
+ import k from "node:path";
7
+ import { parse as Ct, compileTemplate as Et, compileStyle as Pt } from "vue/compiler-sfc";
8
+ import { readdirSync as Ft, readFileSync as z } from "node:fs";
9
+ function X(r, t, e, s = 480, i = 480) {
10
+ const f = r.split(/[\s,]+/).map(parseFloat), l = r.includes(",") ? "," : " ";
11
+ return f.map((a, o) => {
12
+ const u = o % 2 === 0, p = u ? s : i, g = u ? t : e;
13
+ return ((a - p) * g + p).toFixed(2);
14
+ }).reduce((a, o, u) => a + (u > 0 ? u % 2 === 0 ? " " : l : "") + o, "");
15
+ }
16
+ function at(r, t) {
17
+ return r.replace(/([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/g, (e) => (parseFloat(e) * t).toFixed(2));
18
+ }
19
+ function tt(r, t, e) {
20
+ const [s = 0, i = 0] = e, { x1: f, y1: l, x2: a, y2: o, ...u } = r, p = parseFloat(f).toFixed(3), g = parseFloat(l).toFixed(3), n = parseFloat(a).toFixed(3), m = parseFloat(o).toFixed(3), c = (h, d) => (d + (h - d) * t).toFixed(3);
53
21
  return {
54
- ...o,
22
+ ...u,
55
23
  // Сохраняем остальные атрибуты
56
- x1: a(+g, r),
57
- y1: a(+d, e),
58
- x2: a(+n, r),
59
- y2: a(+h, e)
24
+ x1: c(+p, s),
25
+ y1: c(+g, i),
26
+ x2: c(+n, s),
27
+ y2: c(+m, i)
60
28
  };
61
29
  }
62
- function V(i, t, s) {
63
- const [r = 0, e = 0] = s, { x: c, y: l, width: u, height: p, ...o } = i, g = (d, n) => (n + (d - n) * t).toFixed(3);
30
+ function et(r, t, e) {
31
+ const [s = 0, i = 0] = e, { x: f, y: l, width: a, height: o, ...u } = r, p = (g, n) => (n + (g - n) * t).toFixed(3);
64
32
  return {
65
- ...o,
66
- x: g(+c, r),
67
- y: g(+l, e),
68
- width: (+u * t).toFixed(3),
69
- height: (+p * t).toFixed(3)
33
+ ...u,
34
+ x: p(+f, s),
35
+ y: p(+l, i),
36
+ width: (+a * t).toFixed(3),
37
+ height: (+o * t).toFixed(3)
70
38
  };
71
39
  }
72
- function T(i, t, s) {
73
- return isNaN(t) || isNaN(s) ? i : i.replace(/([MLHVCSQTZmlhvcsqtaz])([^MLHVCSQTZmlhvcsqtaz]*)/gi, (r, e, c) => {
74
- if (/^[Zz]$/.test(e)) return e;
75
- const l = e === e.toLowerCase();
76
- let u = e, p = 0;
77
- return c.split(/[\s,]+/).filter(Boolean).forEach((o) => {
78
- const g = parseFloat(o);
79
- let d = o;
80
- isNaN(g) || (l || (d = (p % 2 === 0 ? g + t : g + s).toFixed(3)), p++), u += (u === e ? "" : " ") + d;
81
- }), u;
40
+ function D(r, t, e) {
41
+ return isNaN(t) || isNaN(e) ? r : r.replace(/([MLHVCSQTZmlhvcsqtaz])([^MLHVCSQTZmlhvcsqtaz]*)/gi, (s, i, f) => {
42
+ if (/^[Zz]$/.test(i)) return i;
43
+ const l = i === i.toLowerCase();
44
+ let a = i, o = 0;
45
+ return f.split(/[\s,]+/).filter(Boolean).forEach((u) => {
46
+ const p = parseFloat(u);
47
+ let g = u;
48
+ isNaN(p) || (l || (g = (o % 2 === 0 ? p + t : p + e).toFixed(3)), o++), a += (a === i ? "" : " ") + g;
49
+ }), a;
82
50
  });
83
51
  }
84
- function ut(i) {
85
- return i.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, s) => (s ? "-" : "") + t.toLowerCase());
86
- }
87
- function Z(i) {
88
- return i.startsWith("@") || i.startsWith(":") ? i : i.replace(/[^a-zA-Z0-9]+(.)/g, (t, s) => s.toUpperCase()).replace(/^[A-Z]/, (t) => t.toLowerCase());
89
- }
90
- function ft(i) {
91
- if (i.startsWith(A)) return i;
92
- const t = i.split("?", 1)[0];
93
- if (t) {
94
- const r = t.replace(A, "").replace(y, "");
95
- return `${A}${r}`;
96
- }
97
- return i;
98
- }
99
- function K(i) {
100
- return i.split(/(\\|\/)/g).pop();
52
+ function It(r) {
53
+ return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
101
54
  }
102
- function dt(i) {
103
- return i.replace(K(i) || "", "");
55
+ function st(r) {
56
+ return r.startsWith("@") || r.startsWith(":") ? r : r.replace(/[^a-zA-Z0-9]+(.)/g, (t, e) => e.toUpperCase()).replace(/^[A-Z]/, (t) => t.toLowerCase());
104
57
  }
105
- function ht(i) {
106
- const t = K(i);
107
- return t == null ? void 0 : t.split("?", 1)[0].replace(y, "");
108
- }
109
- function pt(i) {
110
- let t;
111
- try {
112
- t = J.readFileSync(i);
113
- } catch {
114
- console.error(`${i} couldn't be loaded by loader, fallback to default loader`);
115
- return;
116
- }
117
- return Buffer.from(t).toString();
118
- }
119
- function C(i) {
120
- try {
121
- return Buffer.from(J.readFileSync(i)).toString();
122
- } catch {
123
- return;
124
- }
125
- }
126
- function gt(i, t, s) {
127
- const r = [];
128
- for (let e = 0; e < i.length; e++) {
129
- const c = i.indexOf(">", e);
130
- if (i.startsWith(`<${t}`, e) && c > -1 && i[c - 1] !== "/" && r.push(e), i.startsWith(`</${t}>`, e) && r.length > 0 && r.pop() === s)
131
- return e;
58
+ function Ot(r, t, e) {
59
+ const s = [];
60
+ for (let i = 0; i < r.length; i++) {
61
+ const f = r.indexOf(">", i);
62
+ if (r.startsWith(`<${t}`, i) && f > -1 && r[f - 1] !== "/" && s.push(i), r.startsWith(`</${t}>`, i) && s.length > 0 && s.pop() === e)
63
+ return i;
132
64
  }
133
65
  return -1;
134
66
  }
135
- const xt = [
67
+ const _t = [
136
68
  "attributeName",
137
69
  "repeatCount",
138
70
  "repeatDur",
@@ -148,7 +80,7 @@ const xt = [
148
80
  "lengthAdjust",
149
81
  "ariaHidden",
150
82
  "ariaLabel"
151
- ], bt = [
83
+ ], Mt = [
152
84
  "svg",
153
85
  "g",
154
86
  "path",
@@ -212,10 +144,10 @@ const xt = [
212
144
  "a",
213
145
  "switch"
214
146
  ];
215
- function mt(i, t) {
216
- return bt.includes(i.tag) ? !xt.includes(t) : !0;
147
+ function Bt(r, t) {
148
+ return Mt.includes(r.tag) ? !_t.includes(t) : !0;
217
149
  }
218
- class $ {
150
+ class x {
219
151
  static createNode(t = {}) {
220
152
  return {
221
153
  tag: "node",
@@ -225,102 +157,102 @@ class $ {
225
157
  content: "",
226
158
  raw: "",
227
159
  ...t,
228
- getAttr(s) {
229
- return this.attributes[s] ?? null;
160
+ getAttr(e) {
161
+ return this.attributes[e] ?? null;
230
162
  },
231
- setAttr(s, r) {
232
- this.attributes[s] = r;
163
+ setAttr(e, s) {
164
+ this.attributes[e] = s;
233
165
  },
234
- hasAttr(s) {
235
- return Z(s) in this.attributes;
166
+ hasAttr(e) {
167
+ return st(e) in this.attributes;
236
168
  },
237
169
  /**
238
170
  * Is node is child of node or any of nodes
239
171
  * @param child
240
172
  * @param parent
241
173
  */
242
- isChildOf(s) {
243
- if (!s) return !1;
244
- const r = Array.isArray(s) ? s : [s];
245
- for (const e of r) {
246
- let c = this.parent;
247
- for (; c !== null; ) {
248
- if (c === e)
174
+ isChildOf(e) {
175
+ if (!e) return !1;
176
+ const s = Array.isArray(e) ? e : [e];
177
+ for (const i of s) {
178
+ let f = this.parent;
179
+ for (; f !== null; ) {
180
+ if (f === i)
249
181
  return !0;
250
- c = c.parent;
182
+ f = f.parent;
251
183
  }
252
184
  }
253
185
  return !1;
254
186
  },
255
- hasClass(s) {
256
- return !!(this.attributes.class && this.attributes.class.split(" ").includes(s));
187
+ hasClass(e) {
188
+ return !!(this.attributes.class && this.attributes.class.split(" ").includes(e));
257
189
  },
258
- walk(s) {
259
- return $.walk(this, s);
190
+ walk(e) {
191
+ return x.walk(this, e);
260
192
  },
261
193
  serialize() {
262
- return $.serialize(this);
194
+ return x.serialize(this);
263
195
  },
264
- addClass(s) {
265
- const r = this.attributes.class.split(" ");
266
- r.includes(s) || (r.push(s), this.attributes.class = r.join(" "));
196
+ addClass(e) {
197
+ const s = this.attributes.class.split(" ");
198
+ s.includes(e) || (s.push(e), this.attributes.class = s.join(" "));
267
199
  },
268
- addStyle(s) {
269
- this.hasAttr("style") ? this.attributes.style += s + ";" : this.attributes.style = s + ";";
200
+ addStyle(e) {
201
+ this.hasAttr("style") ? this.attributes.style += e + ";" : this.attributes.style = e + ";";
270
202
  },
271
- removeClass(s) {
272
- const r = this.attributes.class.split(" ");
273
- r.includes(s) && (r.splice(r.indexOf(s), 1), this.attributes.class = r.join(" "));
203
+ removeClass(e) {
204
+ const s = this.attributes.class.split(" ");
205
+ s.includes(e) && (s.splice(s.indexOf(e), 1), this.attributes.class = s.join(" "));
274
206
  }
275
207
  };
276
208
  }
277
209
  // todo when exists end tag between quotes - "something >" parser have issues
278
- static parse(t, s, r = {}) {
279
- let e = t.replace(/\r?\n/g, " ").replace(/\s+/g, " ").trim();
280
- const c = [], { parent: l = null } = r;
281
- for (; e.length > 0; ) {
282
- if (e.startsWith("<!--")) {
283
- const x = e.indexOf("-->") + 3;
284
- e = e.slice(x).trim();
210
+ static parse(t, e, s = {}) {
211
+ let i = t.replace(/\r?\n/g, " ").replace(/\s+/g, " ").trim();
212
+ const f = [], { parent: l = null } = s;
213
+ for (; i.length > 0; ) {
214
+ if (i.startsWith("<!--")) {
215
+ const d = i.indexOf("-->") + 3;
216
+ i = i.slice(d).trim();
285
217
  continue;
286
218
  }
287
- if (e.startsWith("<?")) {
288
- const x = e.indexOf("?>") + 2;
289
- e = e.slice(x).trim();
219
+ if (i.startsWith("<?")) {
220
+ const d = i.indexOf("?>") + 2;
221
+ i = i.slice(d).trim();
290
222
  continue;
291
223
  }
292
- if (e.startsWith("<![CDATA[")) {
293
- const x = e.indexOf("]]>") + 3;
294
- e = e.slice(x).trim();
224
+ if (i.startsWith("<![CDATA[")) {
225
+ const d = i.indexOf("]]>") + 3;
226
+ i = i.slice(d).trim();
295
227
  continue;
296
228
  }
297
- if (e.startsWith("<!")) {
298
- const x = e.indexOf(">") + 1;
299
- e = e.slice(x).trim();
229
+ if (i.startsWith("<!")) {
230
+ const d = i.indexOf(">") + 1;
231
+ i = i.slice(d).trim();
300
232
  continue;
301
233
  }
302
- if (e.startsWith("</")) {
303
- const x = e.indexOf(">");
304
- if (x === -1) break;
305
- e = e.slice(x + 1).trim();
234
+ if (i.startsWith("</")) {
235
+ const d = i.indexOf(">");
236
+ if (d === -1) break;
237
+ i = i.slice(d + 1).trim();
306
238
  continue;
307
239
  }
308
- if (!e.startsWith("<")) {
309
- const x = e.indexOf("<"), b = x === -1 ? e : e.slice(0, x), v = this.createNode({
240
+ if (!i.startsWith("<")) {
241
+ const d = i.indexOf("<"), b = d === -1 ? i : i.slice(0, d), y = this.createNode({
310
242
  tag: "#text",
311
243
  attributes: {},
312
244
  children: [],
313
245
  parent: l,
314
246
  content: b,
315
247
  raw: b
316
- }), m = s ? s(v) : v;
317
- m && c.push(...Array.isArray(m) ? m : [m]), e = x === -1 ? "" : e.slice(x);
248
+ }), v = e ? e(y) : y;
249
+ v && f.push(...Array.isArray(v) ? v : [v]), i = d === -1 ? "" : i.slice(d);
318
250
  continue;
319
251
  }
320
- const u = e.indexOf(">");
321
- if (u === -1) break;
322
- const p = e[u - 1] === "/", o = e.slice(1, p ? u - 1 : u), g = o.indexOf(" "), d = g === -1 ? o : o.slice(0, g), n = g === -1 ? "" : o.slice(g + 1), h = this.createNode({
323
- tag: d,
252
+ const a = i.indexOf(">");
253
+ if (a === -1) break;
254
+ const o = i[a - 1] === "/", u = i.slice(1, o ? a - 1 : a), p = u.indexOf(" "), g = p === -1 ? u : u.slice(0, p), n = p === -1 ? "" : u.slice(p + 1), m = this.createNode({
255
+ tag: g,
324
256
  attributes: this.parseAttributes(n),
325
257
  children: [],
326
258
  parent: l,
@@ -328,18 +260,18 @@ class $ {
328
260
  raw: ""
329
261
  // Will be set later
330
262
  });
331
- let a = u + 1;
332
- if (!p) {
333
- const x = `</${d}>`, b = gt(e, d, 0);
334
- b !== -1 && (h.raw = e.slice(a, b), h.content = h.raw.slice(0, b - a), h.raw.includes("<") && (h.children = this.parse(h.raw, s, { parent: h })), a = b + x.length);
263
+ let c = a + 1;
264
+ if (!o) {
265
+ const d = `</${g}>`, b = Ot(i, g, 0);
266
+ b !== -1 && (m.raw = i.slice(c, b), m.content = m.raw.slice(0, b - c), m.raw.includes("<") && (m.children = this.parse(m.raw, e, { parent: m })), c = b + d.length);
335
267
  }
336
- const f = s ? s(h) : h;
337
- f ? c.push(...Array.isArray(f) ? f : [f]) : h.parent && (h.parent.content = h.parent.content.replace(this.serialize(h), "")), e = e.slice(a).trim();
268
+ const h = e ? e(m) : m;
269
+ h ? f.push(...Array.isArray(h) ? h : [h]) : m.parent && (m.parent.content = m.parent.content.replace(this.serialize(m), "")), i = i.slice(c).trim();
338
270
  }
339
- return c;
271
+ return f;
340
272
  }
341
- static parseAsSingle(t, s, r = {}) {
342
- return this.parse(t, s, r)[0];
273
+ static parseAsSingle(t, e, s = {}) {
274
+ return this.parse(t, e, s)[0];
343
275
  }
344
276
  /**
345
277
  * Serialize
@@ -348,9 +280,9 @@ class $ {
348
280
  */
349
281
  static serialize(t) {
350
282
  if (Array.isArray(t))
351
- return t.map((e) => this.serialize(e)).join("");
352
- const s = Object.entries(t.attributes).map(([e, c]) => ` ${mt(t, e) ? ut(e) : e}="${c}"`).join(""), r = t.children.map((e) => this.serialize(e)).join("");
353
- return t.children.length === 0 ? t.content ? `<${t.tag}${s}>${t.content}</${t.tag}>` : `<${t.tag}${s}/>` : `<${t.tag}${s}>${r}</${t.tag}>`;
283
+ return t.map((i) => this.serialize(i)).join("");
284
+ const e = Object.entries(t.attributes).map(([i, f]) => ` ${Bt(t, i) ? It(i) : i}="${f}"`).join(""), s = t.children.map((i) => this.serialize(i)).join("");
285
+ return t.children.length === 0 ? t.content ? `<${t.tag}${e}>${t.content}</${t.tag}>` : `<${t.tag}${e}/>` : `<${t.tag}${e}>${s}</${t.tag}>`;
354
286
  }
355
287
  /**
356
288
  * walk nodes with callback
@@ -359,156 +291,178 @@ class $ {
359
291
  * @param onEntry
360
292
  * @param options Optional traversal options
361
293
  */
362
- static walk(t, s, r) {
363
- const e = Array.isArray(t) ? t : [t], c = (r == null ? void 0 : r.includeText) ?? !0, l = (u) => {
364
- (u.tag !== "#text" || c) && s(u) === !1 || u.children.forEach((p) => l(p));
294
+ static walk(t, e, s) {
295
+ const i = Array.isArray(t) ? t : [t], f = (s == null ? void 0 : s.includeText) ?? !0, l = (a) => {
296
+ (a.tag !== "#text" || f) && e(a) === !1 || a.children.forEach((o) => l(o));
365
297
  };
366
- e.forEach(l);
298
+ i.forEach(l);
367
299
  }
368
- static clone(t, s = null) {
369
- const r = this.createNode({
300
+ static clone(t, e = null) {
301
+ const s = this.createNode({
370
302
  tag: t.tag,
371
303
  attributes: { ...t.attributes },
372
304
  children: [],
373
- parent: s,
305
+ parent: e,
374
306
  content: t.content,
375
307
  raw: t.raw
376
308
  });
377
- return r.children = t.children.map((e) => this.clone(e, r)), r;
309
+ return s.children = t.children.map((i) => this.clone(i, s)), s;
378
310
  }
379
311
  static parseAttributes(t) {
380
- const s = {}, r = /([^\s=]+)="([^"]*)"/g;
381
- let e;
382
- for (; (e = r.exec(t)) !== null; )
383
- s[Z(e[1])] = e[2];
384
- return s;
312
+ const e = {}, s = /([^\s=]+)="([^"]*)"/g;
313
+ let i;
314
+ for (; (i = s.exec(t)) !== null; )
315
+ e[st(i[1])] = i[2];
316
+ return e;
385
317
  }
386
318
  }
387
- const D = 90, H = 720, U = 8 / 9;
388
- function B(i, t, s) {
389
- const [r, e] = s.split("-").map(Number), c = H / t, l = H / i;
390
- return { x: D + (e - 1) * c, y: D + (r - 1) * l, width: c, height: l };
319
+ const Lt = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"]), nt = ["dataProgressAt", "dataProgressInactive", "dataProgressActive"];
320
+ function $(r, t) {
321
+ throw new Error(`[ui0-icon] ${r}: ${t}`);
391
322
  }
392
- function X(i) {
393
- const t = i.width * U, s = i.height * U;
394
- return {
395
- x: i.x + (i.width - t) / 2,
396
- y: i.y + (i.height - s) / 2,
397
- width: t,
398
- height: s
399
- };
323
+ function B(r, t, e, s) {
324
+ if (r === void 0) return t;
325
+ if (typeof r != "number" && typeof r != "string" || String(r).trim() === "")
326
+ return $(s, "expected a number");
327
+ const i = Number(r);
328
+ return !Number.isFinite(i) || i < 0 || i > e ? $(s, `expected a finite number between 0 and ${e}`) : i;
400
329
  }
401
- const w = 960;
402
- function vt(i) {
403
- const t = i.indexOf("?"), s = t === -1 ? void 0 : i.slice(t), r = t === -1 ? i : i.slice(0, t), e = r.indexOf("#"), c = e === -1 ? r : r.slice(0, e), [l, ...u] = c.split("."), p = e === -1 ? void 0 : r.slice(e + 1);
330
+ function U(r, t, e) {
404
331
  return {
405
- name: l,
406
- cell: p,
407
- query: s,
408
- modifiers: u.length ? u.map((o) => o.replace(/:/g, "-")) : void 0
332
+ inactive: B(r.inactive, t.inactive ?? 0.2, 1, `${e} inactive`),
333
+ active: B(r.active, t.active ?? 1, 1, `${e} active`)
409
334
  };
410
335
  }
411
- function wt(i) {
412
- return i ? Object.fromEntries(
413
- i.replace(/^\?/, "").split("&").filter(Boolean).map((t) => t.split("=", 2))
414
- ) : {};
415
- }
416
- const $t = { default: 1, small: 0.84210526, large: 1.16666667 };
417
- function _(i) {
418
- const t = $.parseAsSingle(i);
419
- return !t || t.tag !== "svg" ? i : t.children.map((s) => $.serialize(s)).join("");
420
- }
421
- function At(i, t, s, r) {
422
- const e = $.parseAsSingle(i);
423
- if (!e) return;
424
- let c;
425
- const l = (p) => {
426
- var o;
427
- if (((o = p.attributes) == null ? void 0 : o.dataCell) === t) {
428
- c = p;
336
+ function P(r) {
337
+ return nt.some((t) => r.attributes[t] !== void 0);
338
+ }
339
+ function J(r, t) {
340
+ P(r) && $(t, "progress declaration inside an excluded subtree"), r.children.forEach((e) => J(e, t));
341
+ }
342
+ function it(r) {
343
+ return JSON.stringify(nt.map((t) => r.attributes[t]));
344
+ }
345
+ function Rt(r, t) {
346
+ const e = [], s = r.attributes.dataProgressBy === "layers";
347
+ r.attributes.dataProgressBy !== void 0 && !s && $(t, `unknown progress target mode '${r.attributes.dataProgressBy}'`);
348
+ const f = (r.attributes.dataIcon ?? "").split(/[\s,]+/).includes("no-progress") || r.hasClass("no-progress"), l = (r.attributes.dataLayers ?? "").split(/[\s,]+/).filter(Boolean);
349
+ s && (!l.length || new Set(l).size !== l.length) && $(t, "layer progress requires a nonempty, unique data-layers list");
350
+ const a = new Map(l.map((n) => [n, []])), o = (n, m, c) => {
351
+ if (["defs", "mask", "clipPath"].includes(n.tag)) {
352
+ J(n, t);
429
353
  return;
430
354
  }
431
- p.children.forEach(l);
432
- };
433
- return l(e), c ? { markup: c.children.map((p) => $.serialize(p)).join(""), rect: X(B(s, r, t)) } : void 0;
434
- }
435
- function O(i, t, s = 0, r = 1) {
436
- const e = s % 180 !== 0, c = e ? t.height : t.width, l = e ? t.width : t.height, u = Math.min(i.width / c, i.height / l) * r, p = i.x + i.width / 2, o = i.y + i.height / 2;
437
- if (t.x === 0 && t.y === 0 && t.width === w && t.height === w)
438
- return `translate(${p} ${o}) scale(${u}) rotate(${s}) translate(${-w / 2} ${-w / 2})`;
439
- const g = p - c * u / 2 - (e ? t.y : t.x) * u, d = o - l * u / 2 - (e ? t.x : t.y) * u, n = t.x + c / 2, h = t.y + l / 2;
440
- return `translate(${g} ${d}) scale(${u}) rotate(${s} ${n} ${h})`;
441
- }
442
- function E(i, t, s, r = /* @__PURE__ */ new Set()) {
443
- var c;
444
- if (r.has(i))
445
- return console.warn(`[ui0-icon] virtual '${i}': circular composition skipped`), `<svg viewBox="0 0 ${w} ${w}"/>`;
446
- r.add(i);
447
- const e = [];
448
- for (const [l, u] of Object.entries(t.cells)) {
449
- const p = typeof u == "string" ? { value: u } : u, o = vt(p.value), g = wt(o.query);
450
- g.weight !== void 0 && console.warn(`[ui0-icon] virtual '${i}': 'weight' is not supported yet (source '${p.value}')`);
451
- const d = p.rotate ?? (g.rotate !== void 0 ? Number(g.rotate) : 0), n = $t[g.fit] ?? 1, h = (c = o.modifiers) != null && c.length ? ` class="${o.modifiers.join(" ")}"` : "", a = s(o.name);
452
- if (!a) {
453
- console.warn(`[ui0-icon] virtual '${i}': source '${p.value}' not found`);
454
- continue;
455
- }
456
- const f = p.cell === "full" ? B(t.rows, t.cols, l) : X(B(t.rows, t.cols, l));
457
- if (a.def && !k(a.def) && !a.svg) {
458
- const b = E(o.name, a.def, s, new Set(r)), v = O(
459
- f,
460
- { x: 0, y: 0, width: w, height: w },
461
- d,
462
- n
463
- );
464
- e.push(`<g transform="${v}"${h}>${_(b)}</g>`);
465
- continue;
355
+ if (f || n.hasClass("no-progress") || n.hasAttr("data-skip")) {
356
+ J(n, t);
357
+ return;
466
358
  }
467
- if (!a.svg) continue;
468
- if (o.cell) {
469
- const b = a.def;
470
- if (!b || !k(b)) {
471
- console.warn(
472
- `[ui0-icon] virtual '${i}': '#${o.cell}' addresses a part of '${o.name}', which is not a template`
473
- );
474
- continue;
475
- }
476
- const v = At(a.svg, o.cell, b.rows, b.cols);
477
- if (!v) {
478
- console.warn(`[ui0-icon] virtual '${i}': template '${o.name}' has no <g data-cell="${o.cell}"> part`);
479
- continue;
359
+ const h = n.tag === "g" && n.hasAttr("data-group");
360
+ if (m && (h || P(n)) && $(t, "nested progress targets conflict with their containing group"), s) {
361
+ const d = n.attributes.dataLayer;
362
+ d !== void 0 ? (a.has(d) || $(t, `unknown layer '${d}'`), c !== void 0 && $(t, "nested progress layers overlap"), a.get(d).push(n)) : P(n) && n !== r && $(t, "layer progress declarations must be placed on a data-layer node"), n.children.forEach((b) => o(b, !1, d ?? c));
363
+ } else {
364
+ const d = h || Lt.has(n.tag);
365
+ if (n.attributes[":opacity"] !== void 0 || n.attributes[":data-p-on"] !== void 0) {
366
+ P(n) && $(t, "progress conflicts with an existing :opacity binding");
367
+ return;
480
368
  }
481
- const m = O(f, v.rect, d, n);
482
- e.push(`<g transform="${m}"${h}>${v.markup}</g>`);
483
- continue;
369
+ !m && d && e.push([n]), !d && P(n) && n !== r && $(t, "progress declaration requires a paint node or data-group"), n.children.forEach((b) => o(b, m || h));
484
370
  }
485
- const x = O(
486
- f,
487
- { x: 0, y: 0, width: w, height: w },
488
- d,
489
- n
490
- );
491
- e.push(`<g transform="${x}"${h}>${_(a.svg)}</g>`);
371
+ };
372
+ if (o(r, !1), s && !f)
373
+ for (const [n, m] of a)
374
+ m.length || $(t, `layer '${n}' has no progress targets`), e.push(m);
375
+ const u = e.map((n) => n.filter(P)), p = u.some((n) => n.length);
376
+ return { steps: e.map((n, m) => {
377
+ var b;
378
+ const c = u[m];
379
+ c.some((y) => it(y) !== it(c[0])) && $(t, "conflicting declarations for the same layer");
380
+ const h = ((b = c[0]) == null ? void 0 : b.attributes) ?? {};
381
+ p && h.dataProgressAt === void 0 && $(t, "explicit and automatic progress thresholds cannot be mixed");
382
+ const d = p ? B(h.dataProgressAt, 0, 100, `${t} at`) : Number((100 * (m + 1) / e.length).toFixed(3));
383
+ return {
384
+ targets: n,
385
+ at: d,
386
+ ...U({ inactive: h.dataProgressInactive, active: h.dataProgressActive }, {}, t)
387
+ };
388
+ }) };
389
+ }
390
+ function jt(r, t, e) {
391
+ if (!r) return { steps: [] };
392
+ Array.isArray(r.steps) || $(e, "progress.steps must be an array");
393
+ const s = U(r, {}, e), i = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), l = (o) => {
394
+ if (["defs", "mask", "clipPath"].includes(o.tag) || o.hasClass("no-progress") || o.hasAttr("data-skip")) return;
395
+ const u = o.attributes.dataLayer;
396
+ u && f.set(u, [...f.get(u) ?? [], o]), o.children.forEach(l);
397
+ };
398
+ return t.forEach(l), { steps: r.steps.map((o, u) => {
399
+ const p = `${e} progress step ${u + 1}`;
400
+ o.at === void 0 && $(p, "at is required");
401
+ const g = o.cells !== void 0;
402
+ g === (o.layers !== void 0) && $(p, "use either cells or layers");
403
+ const n = g ? o.cells : o.layers;
404
+ n.length || $(p, "target list cannot be empty");
405
+ const m = [];
406
+ for (const c of n) {
407
+ const h = g ? t.has(c) ? [t.get(c)] : [] : f.get(c) ?? [];
408
+ h.length || $(p, `unknown ${g ? "cell" : "layer"} '${c}'`);
409
+ for (const d of h)
410
+ [...i].some((b) => b === d || d.isChildOf(b) || b.isChildOf(d)) && $(p, `overlapping target '${c}'`), i.add(d), m.push(d);
411
+ }
412
+ return { targets: m, at: B(o.at, 0, 100, `${p} at`), ...U(o, s, p) };
413
+ }) };
414
+ }
415
+ function ct(r) {
416
+ for (const t of r.steps)
417
+ for (const e of t.targets) {
418
+ if (!e.parent) throw new Error("[ui0-icon] progress target has no parent");
419
+ const s = e.parent, i = s.children.indexOf(e);
420
+ if (i < 0) throw new Error("[ui0-icon] progress target is detached");
421
+ const f = x.createNode({
422
+ tag: "g",
423
+ parent: s,
424
+ children: [e],
425
+ attributes: { ":opacity": `iconProgressValue &gt;= ${t.at} ? ${t.active} : ${t.inactive}` }
426
+ });
427
+ s.children[i] = f, e.parent = f;
428
+ }
429
+ }
430
+ function lt(r, t) {
431
+ const e = x.parseAsSingle(r);
432
+ return (!e || e.tag !== "svg") && $(t, "expected an SVG root"), ct(Rt(e, t)), e.serialize();
433
+ }
434
+ function ft(r, t, e) {
435
+ const s = x.parseAsSingle(r);
436
+ (!s || s.tag !== "svg") && $(e, "expected an SVG root");
437
+ const i = /* @__PURE__ */ new Map();
438
+ for (const f of s.children) {
439
+ const l = f.attributes.dataCell;
440
+ l !== void 0 && (i.has(l) && $(e, `duplicate placement cell '${l}'`), i.set(l, f));
492
441
  }
493
- return `<svg viewBox="0 0 ${w} ${w}" xmlns="http://www.w3.org/2000/svg">${e.join("")}</svg>`;
442
+ return ct(jt(t.progress, i, e)), s.serialize();
443
+ }
444
+ function Tt(r, t) {
445
+ if (r === void 0) return 100;
446
+ const s = typeof r == "number" || typeof r == "string" && r.trim() !== "" ? Number(r) : NaN;
447
+ return Number.isFinite(s) ? Math.max(0, Math.min(100, s)) : (t == null || t("[ui0-icon] invalid progress value, using 100"), 100);
494
448
  }
495
- const L = /\s|,/, q = ["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"], F = (i) => (960 * i - 960) / 2;
496
- function Q(i, t = 1) {
497
- return t !== 1 ? T(Y(i, t), -F(t), -F(t)) : i;
449
+ const W = /\s|,/, rt = ["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"], F = (r) => (960 * r - 960) / 2;
450
+ function ot(r, t = 1) {
451
+ return t !== 1 ? D(at(r, t), -F(t), -F(t)) : r;
498
452
  }
499
- class St {
453
+ class zt {
500
454
  constructor(t = {}) {
501
- M(this, "options");
502
- M(this, "name");
503
- M(this, "result");
504
- const { fit: s = !0, process: r = !0, rescaling: e = !0 } = t;
455
+ I(this, "options");
456
+ I(this, "name");
457
+ I(this, "result");
458
+ const { fit: e = !0, process: s = !0, rescaling: i = !0 } = t;
505
459
  this.result = {}, this.options = {
506
- fit: s,
507
- process: r,
508
- rescaling: e
460
+ fit: e,
461
+ process: s,
462
+ rescaling: i
509
463
  }, this.name = "";
510
464
  }
511
- process(t, s = "", r = this.options) {
465
+ process(t, e = "", s = this.options) {
512
466
  this.result[t] = {
513
467
  sfc: {
514
468
  template: "",
@@ -522,22 +476,22 @@ class St {
522
476
  modifiers: []
523
477
  }
524
478
  };
525
- let e = "", c = {
479
+ let i = "", f = {
526
480
  x: 1,
527
481
  y: 1
528
482
  }, l = this.result[t].options;
529
483
  l.flags ?? (l.flags = []), l.modifiers ?? (l.modifiers = []), l.layers ?? (l.layers = []);
530
- const u = $.parseAsSingle(s, (n) => {
531
- var h;
484
+ const a = x.parseAsSingle(e, (n) => {
485
+ var m;
532
486
  if (n.tag === "svg" || n.tag === "g") {
533
487
  if (n.tag === "svg" && n.hasAttr("viewBox")) {
534
- const [, , a = "960", f = "960"] = n.attributes.viewBox.split(" ");
535
- (a !== "960" || f !== "960") && (c.x = 960 / +a, c.y = 960 / +f);
488
+ const [, , c = "960", h = "960"] = n.attributes.viewBox.split(" ");
489
+ (c !== "960" || h !== "960") && (f.x = 960 / +c, f.y = 960 / +h);
536
490
  }
537
- n.hasAttr("data-icon") && (l.flags = n.attributes.dataIcon.split(L)), n.hasAttr("data-layers") && (l.layers = n.attributes.dataLayers.split(L)), n.hasAttr("data-modifiers") && (l.modifiers = n.attributes.dataModifiers.split(L));
491
+ n.hasAttr("data-icon") && (l.flags = n.attributes.dataIcon.split(W)), n.hasAttr("data-layers") && (l.layers = n.attributes.dataLayers.split(W)), n.hasAttr("data-modifiers") && (l.modifiers = n.attributes.dataModifiers.split(W));
538
492
  }
539
493
  if (n.tag === "template")
540
- return $.createNode({
494
+ return x.createNode({
541
495
  tag: "template",
542
496
  attributes: n.attributes,
543
497
  content: n.raw,
@@ -545,22 +499,22 @@ class St {
545
499
  parent: n.parent,
546
500
  raw: ""
547
501
  });
548
- if (n.tag === "style" && ((h = n.parent) == null ? void 0 : h.tag) === "defs")
549
- return e += n.content, null;
550
- if (q.includes(n.tag) || n.tag === "g") {
551
- const { id: a } = n.attributes;
552
- a && (a.startsWith("r-icon") || a.startsWith("no-")) && (n.attributes.class = a + " " + (n.attributes.class ?? ""), delete n.attributes.id);
502
+ if (n.tag === "style" && ((m = n.parent) == null ? void 0 : m.tag) === "defs")
503
+ return i += n.content, null;
504
+ if (rt.includes(n.tag) || n.tag === "g") {
505
+ const { id: c } = n.attributes;
506
+ c && (c.startsWith("r-icon") || c.startsWith("no-")) && (n.attributes.class = c + " " + (n.attributes.class ?? ""), delete n.attributes.id);
553
507
  }
554
508
  return n;
555
509
  });
556
- !l.flags.includes("no-rescale") && this.options.rescaling && u.walk((n) => {
557
- (n.tag !== "g" && c && c.x !== 1 || c.y !== 1) && this.processBoxScaling(n, c.x, c.y);
510
+ !l.flags.includes("no-rescale") && this.options.rescaling && a.walk((n) => {
511
+ (n.tag !== "g" && f && f.x !== 1 || f.y !== 1) && this.processBoxScaling(n, f.x, f.y);
558
512
  });
559
- const p = this.processNode(t, u);
560
- delete u.attributes.id, delete u.attributes.viewBox;
561
- const o = {};
562
- u.children.unshift(
563
- $.createNode({
513
+ const o = this.processNode(t, a);
514
+ delete a.attributes.id, delete a.attributes.viewBox;
515
+ const u = {};
516
+ a.children.unshift(
517
+ x.createNode({
564
518
  tag: "rect",
565
519
  children: [],
566
520
  attributes: {
@@ -570,55 +524,55 @@ class St {
570
524
  }
571
525
  })
572
526
  );
573
- const g = $.createNode({
527
+ const p = x.createNode({
574
528
  tag: "g",
575
- content: u.content,
576
- raw: u.raw,
577
- children: u.children,
529
+ content: a.content,
530
+ raw: a.raw,
531
+ children: a.children,
578
532
  attributes: {
579
- ...o,
533
+ ...u,
580
534
  ":class": "modifiers",
581
535
  "data-icon-body": ""
582
536
  },
583
537
  parent: null
584
538
  });
585
- u.hasAttr("class") && (g.attributes.class = u.attributes.class), u.hasAttr("style") && (g.attributes.style = u.attributes.style), this.options.fit && (g.attributes[":style"] = "'--r-icon-fit-ratio: ' + fitRatios[fit]");
586
- let d = $.serialize(g);
539
+ a.hasAttr("class") && (p.attributes.class = a.attributes.class), a.hasAttr("style") && (p.attributes.style = a.attributes.style), this.options.fit && (p.attributes[":style"] = "'--r-icon-fit-ratio: ' + fitRatios[fit]");
540
+ let g = x.serialize(p);
587
541
  return this.result[t].sfc = {
588
- template: d,
589
- style: e,
590
- script: p
542
+ template: g,
543
+ style: i,
544
+ script: o
591
545
  }, this.result[t].sfc;
592
546
  }
593
547
  render(t) {
594
548
  if (!this.result) return "";
595
- const { template: s = "", style: r = "", script: e = "" } = this.result[t].sfc;
596
- let c = "";
597
- return s && (c += `
549
+ const { template: e = "", style: s = "", script: i = "" } = this.result[t].sfc;
550
+ let f = "";
551
+ return e && (f += `
598
552
  <template>
599
- ${s}
600
- </template>`), r && (c += `
553
+ ${e}
554
+ </template>`), s && (f += `
601
555
  <style scoped lang="scss">
602
- ${r.trim()}
603
- </style>`), e && (c += `
556
+ ${s.trim()}
557
+ </style>`), i && (f += `
604
558
  <script>
605
- ${e}
606
- <\/script>`), c;
559
+ ${i}
560
+ <\/script>`), f;
607
561
  }
608
- processBoxScaling(t, s = 1, r = 1) {
609
- if (!(s === 1 && r === 1))
562
+ processBoxScaling(t, e = 1, s = 1) {
563
+ if (!(e === 1 && s === 1))
610
564
  switch (t.tag) {
611
565
  case "path":
612
- t.hasAttr("d") && t.setAttr("d", Y(t.attributes.d, s));
566
+ t.hasAttr("d") && t.setAttr("d", at(t.attributes.d, e));
613
567
  break;
614
568
  }
615
569
  }
616
- processNode(t, s) {
617
- const r = this.result[t].options, e = ["fit", "progress", "rendering", "modifiers"], { layers: c = [] } = this.processFeatures(t, s);
618
- r.layers = [...r.layers, ...c];
570
+ processNode(t, e) {
571
+ const s = this.result[t].options, i = ["fit", "progress", "rendering", "modifiers"], { layers: f = [] } = this.processFeatures(t, e);
572
+ s.layers = [...s.layers, ...f];
619
573
  const l = {
620
- ...this.processFit(s),
621
- layers: c,
574
+ ...this.processFit(e),
575
+ layers: f,
622
576
  fitRatios: {
623
577
  default: 1,
624
578
  small: 0.84210526,
@@ -627,203 +581,453 @@ ${e}
627
581
  };
628
582
  return Array.isArray(this.options.fit) && (this.options.fit.length === 2 && ([l.fitRatios.small, l.fitRatios.large] = this.options.fit), this.options.fit[2] && ([l.fitRatios.small, l.fitRatios.default, l.fitRatios.large] = this.options.fit)), `export default {
629
583
  setup: () => (${JSON.stringify(l)}),
630
- props: ${JSON.stringify(e)},
631
- customOptions: ${JSON.stringify(r)}
584
+ props: ${JSON.stringify(i)},
585
+ customOptions: ${JSON.stringify(s)}
632
586
  }`;
633
587
  }
634
588
  processNodesIfModifiers(t) {
635
- (Array.isArray(t) ? t : [t]).forEach((r) => {
636
- r.hasAttr("data-mod") && (r.attributes.dataMod === "default" ? r.attributes.vIf = "modifiers.includes('default') || modifiers.length === 0" : r.attributes.vIf = `modifiers.includes('${r.attributes.dataMod}')`, delete r.attributes.dataMod);
589
+ (Array.isArray(t) ? t : [t]).forEach((s) => {
590
+ s.hasAttr("data-mod") && (s.attributes.dataMod === "default" ? s.attributes.vIf = "modifiers.includes('default') || modifiers.length === 0" : s.attributes.vIf = `modifiers.includes('${s.attributes.dataMod}')`, delete s.attributes.dataMod);
637
591
  });
638
592
  }
639
593
  processPointNodes(t) {
640
- t.forEach((s, r) => {
641
- s.attributes["data-p-i"] = `${r}`, s.addStyle(`--r-icon-p-i: ${r}`);
594
+ t.forEach((e, s) => {
595
+ e.attributes["data-p-i"] = `${s}`, e.addStyle(`--r-icon-p-i: ${s}`);
642
596
  });
643
597
  }
644
598
  processRendering(t) {
645
- var r;
646
- const s = ((r = t.attributes.dataSkipAttr) == null ? void 0 : r.split(",")) ?? [];
647
- t.attributes.fill && !s.includes("fill") && (t.attributes[":fill"] = `rendering === 'original' ? '${t.attributes.fill}' : undefined`, delete t.attributes.fill), t.attributes.stroke && !s.includes("stroke") && (t.attributes[":stroke"] = `rendering === 'original' ? '${t.attributes.stroke}' : undefined`, delete t.attributes.stroke);
599
+ var s;
600
+ const e = ((s = t.attributes.dataSkipAttr) == null ? void 0 : s.split(",")) ?? [];
601
+ t.attributes.fill && !e.includes("fill") && (t.attributes[":fill"] = `rendering === 'original' ? '${t.attributes.fill}' : undefined`, delete t.attributes.fill), t.attributes.stroke && !e.includes("stroke") && (t.attributes[":stroke"] = `rendering === 'original' ? '${t.attributes.stroke}' : undefined`, delete t.attributes.stroke);
648
602
  }
649
603
  processFit(t) {
650
- let s = 0, r = 0, e = 0, c = 0, l = 0;
651
- const u = [], p = [], o = [], g = [], d = [], [n = 0.84210526, h = 1.16666667] = Array.isArray(this.options.fit) ? this.options.fit : [];
652
- return t.walk((a) => {
653
- var f;
654
- if (!a.hasClass("no-fit") && ((f = a.parent) == null ? void 0 : f.tag) !== "mask") {
655
- if (a.tag === "line") {
656
- const { x1: x = "0", x2: b = "0", y1: v = "0", y2: m = "0" } = a.attributes;
657
- o.push({
658
- x1: x,
604
+ let e = 0, s = 0, i = 0, f = 0, l = 0;
605
+ const a = [], o = [], u = [], p = [], g = [], [n = 0.84210526, m = 1.16666667] = Array.isArray(this.options.fit) ? this.options.fit : [];
606
+ return t.walk((c) => {
607
+ var h;
608
+ if (!c.hasClass("no-fit") && ((h = c.parent) == null ? void 0 : h.tag) !== "mask") {
609
+ if (c.tag === "line") {
610
+ const { x1: d = "0", x2: b = "0", y1: y = "0", y2: v = "0" } = c.attributes;
611
+ u.push({
612
+ x1: d,
659
613
  x2: b,
660
- y1: v,
661
- y2: m
662
- }), a.attributes[":x1"] = `fitLine[${e}][this.fit].x1`, a.attributes[":x2"] = `fitLine[${e}][this.fit].x2`, a.attributes[":y1"] = `fitLine[${e}][this.fit].y1`, a.attributes[":y2"] = `fitLine[${e}][this.fit].y2`, delete a.attributes.x1, delete a.attributes.x2, delete a.attributes.y1, delete a.attributes.y2, e++;
614
+ y1: y,
615
+ y2: v
616
+ }), c.attributes[":x1"] = `fitLine[${i}][this.fit].x1`, c.attributes[":x2"] = `fitLine[${i}][this.fit].x2`, c.attributes[":y1"] = `fitLine[${i}][this.fit].y1`, c.attributes[":y2"] = `fitLine[${i}][this.fit].y2`, delete c.attributes.x1, delete c.attributes.x2, delete c.attributes.y1, delete c.attributes.y2, i++;
663
617
  }
664
- if (a.tag === "path" && a.hasAttr("d") && (u.push(a.attributes.d), a.attributes[":d"] = `fitPath[${r}][this.fit]`, r++, delete a.attributes.d), a.tag === "polyline" && (g.push(a.attributes.points), a.attributes[":points"] = `fitPolyline[${s}][this.fit]`, delete a.attributes.points, s++), a.tag === "circle" && a.hasAttr("r") && (d.push(a.attributes.r), a.attributes[":r"] = `fitCircle[${c}][this.fit]`, c++, delete a.attributes.r), a.tag === "rect" && a.hasAttr("width") && a.hasAttr("height")) {
665
- const { width: x, height: b, x: v, y: m } = a.attributes;
666
- p.push({ width: x, height: b, x: v, y: m }), a.attributes[":width"] = `fitRect[${l}][this.fit].width`, a.attributes[":height"] = `fitRect[${l}][this.fit].height`, a.attributes[":x"] = `fitRect[${l}][this.fit].x`, a.attributes[":y"] = `fitRect[${l}][this.fit].y`, l++, delete a.attributes.width, delete a.attributes.height, delete a.attributes.x, delete a.attributes.y;
618
+ if (c.tag === "path" && c.hasAttr("d") && (a.push(c.attributes.d), c.attributes[":d"] = `fitPath[${s}][this.fit]`, s++, delete c.attributes.d), c.tag === "polyline" && (p.push(c.attributes.points), c.attributes[":points"] = `fitPolyline[${e}][this.fit]`, delete c.attributes.points, e++), c.tag === "circle" && c.hasAttr("r") && (g.push(c.attributes.r), c.attributes[":r"] = `fitCircle[${f}][this.fit]`, f++, delete c.attributes.r), c.tag === "rect" && c.hasAttr("width") && c.hasAttr("height")) {
619
+ const { width: d, height: b, x: y, y: v } = c.attributes;
620
+ o.push({ width: d, height: b, x: y, y: v }), c.attributes[":width"] = `fitRect[${l}][this.fit].width`, c.attributes[":height"] = `fitRect[${l}][this.fit].height`, c.attributes[":x"] = `fitRect[${l}][this.fit].x`, c.attributes[":y"] = `fitRect[${l}][this.fit].y`, l++, delete c.attributes.width, delete c.attributes.height, delete c.attributes.x, delete c.attributes.y;
667
621
  }
668
622
  }
669
623
  }), {
670
- fitPolyline: g.reduce((a, f) => [
671
- ...a,
624
+ fitPolyline: p.reduce((c, h) => [
625
+ ...c,
672
626
  {
673
- default: f,
674
- small: T(P(f, n, n), -F(n), -F(n)),
675
- large: T(P(f, h, h), -F(h), -F(h))
627
+ default: h,
628
+ small: D(X(h, n, n), -F(n), -F(n)),
629
+ large: D(X(h, m, m), -F(m), -F(m))
676
630
  }
677
631
  ], []),
678
- fitLine: o.reduce((a, f) => [
679
- ...a,
632
+ fitLine: u.reduce((c, h) => [
633
+ ...c,
680
634
  {
681
- default: f,
682
- small: G(f, n, [480, 480]),
683
- large: G(f, h, [480, 480])
635
+ default: h,
636
+ small: tt(h, n, [480, 480]),
637
+ large: tt(h, m, [480, 480])
684
638
  }
685
639
  ], []),
686
- fitPath: u.reduce((a, f) => [
687
- ...a,
640
+ fitPath: a.reduce((c, h) => [
641
+ ...c,
688
642
  {
689
- default: f,
690
- small: Q(f, n),
691
- large: Q(f, h)
643
+ default: h,
644
+ small: ot(h, n),
645
+ large: ot(h, m)
692
646
  }
693
647
  ], []),
694
- fitRect: p.reduce((a, f) => [
695
- ...a,
648
+ fitRect: o.reduce((c, h) => [
649
+ ...c,
696
650
  {
697
- default: f,
698
- small: V(f, n, [480, 480]),
699
- large: V(f, h, [480, 480])
651
+ default: h,
652
+ small: et(h, n, [480, 480]),
653
+ large: et(h, m, [480, 480])
700
654
  }
701
655
  ], []),
702
- fitCircle: d.reduce((a, f) => [
703
- ...a,
656
+ fitCircle: g.reduce((c, h) => [
657
+ ...c,
704
658
  {
705
- default: f,
706
- small: (+f * n).toFixed(3),
707
- large: (+f * h).toFixed(3)
659
+ default: h,
660
+ small: (+h * n).toFixed(3),
661
+ large: (+h * m).toFixed(3)
708
662
  }
709
663
  ], [])
710
664
  };
711
665
  }
712
- processFeatures(t, s) {
713
- const r = [], e = [], c = [], { options: l } = this.result[t], u = [], p = /* @__PURE__ */ new Set();
714
- return s.walk((o) => {
715
- const g = q.includes(o.tag), d = o.tag === "g";
666
+ processFeatures(t, e) {
667
+ const s = [], i = [], f = [], l = [], a = /* @__PURE__ */ new Set();
668
+ return e.walk((o) => {
669
+ const u = rt.includes(o.tag), p = o.tag === "g";
716
670
  if (!o.hasAttr("data-skip")) {
717
671
  if (o.hasAttr("data-layer")) {
718
- p.add(o.attributes.dataLayer);
719
- const n = [...p].indexOf(o.attributes.dataLayer);
720
- o.addStyle(`--r-icon-l-i: ${n}`), o.attributes["data-l-i"] = n.toString();
672
+ a.add(o.attributes.dataLayer);
673
+ const g = [...a].indexOf(o.attributes.dataLayer);
674
+ o.addStyle(`--r-icon-l-i: ${g}`), o.attributes["data-l-i"] = g.toString();
721
675
  }
722
- if (o.hasClass("no-progress") && c.push(o), o.tag === "mask" && u.push(o), g || d) {
723
- const n = o.attributes.class && o.attributes.class.indexOf("no-progress") > -1;
724
- d && o.hasAttr("data-group") && (r.push(o), e.push(o), delete o.attributes.dataGroup), g && !o.isChildOf(e) && (n || r.push(o)), o.isChildOf(u) || this.processRendering(o);
676
+ if (o.hasClass("no-progress") && f.push(o), o.tag === "mask" && l.push(o), u || p) {
677
+ const g = o.attributes.class && o.attributes.class.indexOf("no-progress") > -1;
678
+ p && o.hasAttr("data-group") && (s.push(o), i.push(o), delete o.attributes.dataGroup), u && !o.isChildOf(i) && (g || s.push(o)), o.isChildOf(l) || this.processRendering(o);
725
679
  }
726
680
  this.processNodesIfModifiers(o);
727
681
  }
728
- }), s.addStyle(`--r-icon-l-c: ${p.size}`), s.addStyle(`--r-icon-p-c: ${r.length}`), this.processPointNodes(r), l.flags.includes("no-progress") || r.forEach((o, g) => {
729
- if (!o.isChildOf([...c, ...u])) {
730
- const d = ((100 / r.length || 1) * (g + 1)).toFixed(3);
731
- o.attributes["data-p-on"] = d, o.attributes[":opacity"] = `(progress ?? 100) >= ${d} ? 1 : .2`;
732
- }
733
- }), {
734
- layers: p
682
+ }), e.addStyle(`--r-icon-l-c: ${a.size}`), e.addStyle(`--r-icon-p-c: ${s.length}`), this.processPointNodes(s), this.applyProgress(t, s, f, l), {
683
+ layers: a
735
684
  };
736
685
  }
686
+ /** Applies the legacy progress behavior; the next transformer supplies its own compiled program. */
687
+ applyProgress(t, e, s, i) {
688
+ this.result[t].options.flags.includes("no-progress") || e.forEach((f, l) => {
689
+ if (!f.isChildOf([...s, ...i])) {
690
+ const a = ((100 / e.length || 1) * (l + 1)).toFixed(3);
691
+ f.attributes["data-p-on"] = a, f.attributes[":opacity"] = `(progress ?? 100) >= ${a} ? 1 : .2`;
692
+ }
693
+ });
694
+ }
737
695
  }
738
- const yt = /\.svg\?icon*$/, N = (i) => i.replace(/^.*\//, "").split(".")[0];
739
- function Mt(i = {}) {
740
- const { fit: t = [0.84210526, 1.16666667], include: s = "", exclude: r = "" } = i;
741
- let e = /* @__PURE__ */ new Map();
742
- const c = /* @__PURE__ */ new Map(), l = z(s || /\.svg\?icon.*$/, r), u = z(s || /\.svg$/, r), p = new St({ fit: t }), o = (d) => {
743
- var b, v;
744
- const n = d.includes("/") ? d.slice(0, d.indexOf("/")) : void 0, h = N(d), a = n ? (b = i.packs) == null ? void 0 : b[n] : void 0;
745
- if (n && typeof a == "string") {
746
- const m = C(I.join(a, h + y));
747
- if (m) return { svg: m };
696
+ class Wt extends zt {
697
+ /** Consumes an already compiled progress template from the next loader. */
698
+ processPrepared(t, e) {
699
+ return this.processCompiled(t, e, this.options);
700
+ }
701
+ /** Transforms author declarations into a component with one shared reactive progress value. */
702
+ process(t, e = "", s = this.options) {
703
+ return this.processCompiled(t, lt(e, t), s);
704
+ }
705
+ /** Compiles composition-owned progress without automatically progressing each source body. */
706
+ processVirtual(t, e, s) {
707
+ return this.processCompiled(t, ft(e, s, t), this.options);
708
+ }
709
+ /** Adds one computed normalization per component while preserving the existing generated setup data. */
710
+ processCompiled(t, e, s) {
711
+ const i = x.parseAsSingle(e), f = i == null ? void 0 : i.attributes.transform, l = super.process(t, e, s);
712
+ if (f && (l.template = l.template.replace(/^<g(?=[\s>])/, `<g transform="${f}"`)), i != null && i.attributes.dataModifiers) {
713
+ const a = x.parseAsSingle(l.template);
714
+ a.walk((o) => {
715
+ if (!["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"].includes(o.tag)) return;
716
+ const u = "{ '--ui0-icon-state': modifiers.join('|') }", p = o.attributes[":style"];
717
+ o.attributes[":style"] = p ? `[${p}, ${u}]` : u;
718
+ }), l.template = a.serialize();
748
719
  }
749
- if (n === "blocks" && j[h])
750
- return { svg: j[h] };
751
- const f = (v = i.virtual) == null ? void 0 : v[h];
752
- if (f && (n === void 0 || n === "blocks" || n === "virtual")) {
753
- if (k(f)) {
754
- const S = f.file.trimStart().startsWith("<") ? f.file : C(f.file);
755
- return S || console.warn(`[ui0-icon] template not found: ${f.file.slice(0, 80)}`), { def: f, svg: S };
720
+ return l.script = `import { computed as __iconComputed } from 'vue'
721
+ const __iconNormalize = ${Tt.toString()}
722
+ ${l.script}`.replace(
723
+ /setup: \(\) => \((.*?)\),\n props:/s,
724
+ (a, o) => {
725
+ const u = JSON.parse(o);
726
+ for (const p of Object.values(u)) {
727
+ const g = Array.isArray(p) ? p : [p];
728
+ for (const n of g)
729
+ n && typeof n == "object" && "default" in n && (n.normal = n.default);
730
+ }
731
+ return `setup: (__props) => ({ ...(${JSON.stringify(u)}), iconProgressValue: __iconComputed(() => __iconNormalize(__props.progress, import.meta.env.DEV ? console.warn : undefined)) }),
732
+ props:`;
733
+ }
734
+ ), l;
735
+ }
736
+ /** Declarative progress is already compiled; skip the legacy automatic opacity rewrite. */
737
+ applyProgress() {
738
+ }
739
+ }
740
+ function ut(r) {
741
+ return "file" in r;
742
+ }
743
+ function Vt(r) {
744
+ const t = r.indexOf("?"), e = t === -1 ? void 0 : r.slice(t), s = t === -1 ? r : r.slice(0, t), i = s.indexOf("#"), f = i === -1 ? s : s.slice(0, i), [l, ...a] = f.split("."), o = i === -1 ? void 0 : s.slice(i + 1);
745
+ return {
746
+ name: l,
747
+ cell: o,
748
+ query: e,
749
+ modifiers: a.length ? a.map((u) => u.replace(/:/g, "-")) : void 0
750
+ };
751
+ }
752
+ const Gt = `<svg width="960" height="960" viewBox="0 0 960 960">>
753
+ <path class="no-fill" d="M340 340 C494.6 340 620 465.4 620 620" />
754
+ </svg>
755
+ `, qt = `<svg width="960" height="960" viewBox="0 0 960 960">
756
+ <path class="no-fill" d="M480 600 L480 360 M480 360 L395.1 444.9 M480 360 L564.9 444.9"/>
757
+ </svg>
758
+ `, Dt = `<svg width="960" height="960" viewBox="0 0 960 960">
759
+
760
+ <polyline points="347.69,546.155 480,413.845 612.31,546.155"/>
761
+
762
+ </svg>
763
+ `, Ut = `<svg viewBox="0 0 960 960">
764
+ <circle cx="480" cy="480" r="320"/>
765
+ </svg>
766
+ `, Jt = `<svg>
767
+ <path class="no-fill" d="M480,480h280c0,74.2-29.5,145.5-82,198-52.5,52.5-123.8,82-198,82v-280Z"/>
768
+ </svg>
769
+ `, Zt = `<svg viewBox="0 0 960 960"><circle cx="480" cy="480" r="60"/></svg>
770
+ `, Ht = `<svg data-icon="utility no-progress" viewBox="0 0 960 960">
771
+ <path d="M441.3,253.9c17.2-29.8,60.2-29.8,77.4,0l117.6,203.8,117.6,203.8c17.2,29.8-4.3,67-38.7,67H244.7c-34.4,0-55.9-37.2-38.7-67l117.6-203.8,117.6-203.8Z"/>
772
+ </svg>
773
+ `, V = {
774
+ "arc-90": Gt,
775
+ arrow: qt,
776
+ chevron: Dt,
777
+ circle: Ut,
778
+ "pie-90": Jt,
779
+ point: Zt,
780
+ triangle: Ht
781
+ };
782
+ class Kt {
783
+ constructor(t, e, s) {
784
+ I(this, "files", /* @__PURE__ */ new Map());
785
+ this.options = t, this.root = e, this.warn = s;
786
+ }
787
+ /** Indexes configured directories and rejects duplicate assets or reserved pack overrides. */
788
+ scan() {
789
+ var e;
790
+ if (this.files.clear(), ((e = this.options.packs) == null ? void 0 : e.blocks) !== void 0) throw new Error("[ui0-icon] packs.blocks cannot override the built-in pack");
791
+ const t = typeof this.options.dir == "string" ? [this.options.dir] : this.options.dir ?? [];
792
+ for (const s of t) this.scanDirectory("assets", k.resolve(this.root, s));
793
+ for (const [s, i] of Object.entries(this.options.packs ?? {}))
794
+ typeof i == "string" && this.scanDirectory(s, k.resolve(this.root, i));
795
+ }
796
+ /** Registers every nested SVG with a path relative to its configured directory. */
797
+ scanDirectory(t, e, s = "") {
798
+ for (const i of Ft(k.join(e, s), { withFileTypes: !0 })) {
799
+ const f = k.posix.join(s, i.name);
800
+ if (i.isDirectory()) this.scanDirectory(t, e, f);
801
+ else if (i.isFile() && f.endsWith(".svg")) {
802
+ const l = `${t}/${f.slice(0, -4)}`, a = k.join(e, f);
803
+ if (this.files.has(l)) throw new Error(`[ui0-icon] duplicate source '${l}'`);
804
+ this.files.set(l, a);
756
805
  }
757
- const m = (i.sources ?? []).map((S) => C(I.join(S, h + y))).find(Boolean);
758
- return { def: f, svg: m };
759
806
  }
760
- const x = (i.sources ?? []).map((m) => C(I.join(m, h + y))).find(Boolean);
761
- return x ? { svg: x } : void 0;
762
- }, g = (d) => {
807
+ }
808
+ /** Finds a file-backed icon name for ordinary imports within the configured source roots. */
809
+ nameOfFile(t) {
810
+ for (const [e, s] of this.files) if (k.resolve(s) === k.resolve(t)) return e;
811
+ }
812
+ /** Checks whether the next loader owns a complete icon name. */
813
+ has(t) {
763
814
  var f;
764
- const n = N(d), h = C(d + y);
765
- if (h) return h;
766
- const a = (f = i.virtual) == null ? void 0 : f[n];
767
- return a && !k(a) ? E(n, a, o) : pt(d + y);
768
- };
815
+ const e = t.indexOf("/"), s = t.slice(0, e), i = t.slice(e + 1);
816
+ return this.files.has(t) || s === "blocks" && i in V || s === "virtual" && i in (this.options.virtual ?? {}) || typeof ((f = this.options.packs) == null ? void 0 : f[s]) == "object" && i in this.options.packs[s];
817
+ }
818
+ /** Reads one registered source and records its actual filesystem dependencies. */
819
+ read(t) {
820
+ var a, o;
821
+ const e = t.indexOf("/"), s = t.slice(0, e), i = t.slice(e + 1);
822
+ if (s === "virtual") {
823
+ const u = (a = this.options.virtual) == null ? void 0 : a[i];
824
+ if (!u) throw new Error(`[ui0-icon] unknown source '${t}'`);
825
+ if (ut(u)) {
826
+ if (u.file.trimStart().startsWith("<")) return { svg: u.file, definition: u, files: /* @__PURE__ */ new Set() };
827
+ const p = k.resolve(this.root, u.file);
828
+ return { svg: z(p, "utf8"), definition: u, files: /* @__PURE__ */ new Set([p]) };
829
+ }
830
+ return { definition: u, files: /* @__PURE__ */ new Set() };
831
+ }
832
+ if (s === "blocks" && V[i]) return { svg: V[i], files: /* @__PURE__ */ new Set() };
833
+ const f = (o = this.options.packs) == null ? void 0 : o[s];
834
+ if (f && typeof f == "object" && i in f) {
835
+ const u = f[i];
836
+ if (this.files.has(t) && this.warn(`[ui0-icon] packs.${s}.${i} overrides the directory source`), typeof u != "string") throw new Error(`[ui0-icon] '${t}' must retain an SVG file reference`);
837
+ const p = k.resolve(this.root, u);
838
+ return { svg: z(p, "utf8"), files: /* @__PURE__ */ new Set([p]) };
839
+ }
840
+ const l = this.files.get(t);
841
+ if (!l) throw new Error(`[ui0-icon] unknown source '${t}'`);
842
+ return { svg: z(l, "utf8"), files: /* @__PURE__ */ new Set([l]) };
843
+ }
844
+ }
845
+ function pt(r, t, e) {
846
+ const s = r.attributes.viewBox === void 0 ? [0, 0, t, t] : r.attributes.viewBox.trim().split(/[\s,]+/).map(Number);
847
+ if (s.length !== 4 || s.some((i) => !Number.isFinite(i)) || s[2] <= 0 || s[3] <= 0)
848
+ throw new Error(`[ui0-icon] ${e}: invalid viewBox`);
849
+ return s;
850
+ }
851
+ function Qt(r) {
852
+ const t = { ...r.attributes };
853
+ return delete t.viewBox, delete t.width, delete t.height, x.createNode({ tag: "g", attributes: t, children: r.children, content: r.content }).serialize();
854
+ }
855
+ function dt(r, t, e, s, i = /* @__PURE__ */ new Set()) {
856
+ var m;
857
+ if (i.has(r)) throw new Error(`[ui0-icon] ${r}: cyclic composition`);
858
+ const f = new Set(i).add(r), l = t.read(r);
859
+ if (!l.definition || ut(l.definition))
860
+ return { svg: l.svg, files: l.files, virtual: !1 };
861
+ const a = l.definition, { rows: o, cols: u } = a;
862
+ if (![o, u].every((c) => Number.isSafeInteger(c) && c > 0))
863
+ throw new Error(`[ui0-icon] ${r}: rows and cols must be positive integers`);
864
+ const p = [], g = new Set(l.files);
865
+ for (const [c, h] of Object.entries(a.cells)) {
866
+ if (h === void 0) continue;
867
+ const d = `${r} cell ${c}`, b = c.split("-").map(Number), [y, v] = b;
868
+ if (b.length !== 2 || !b.every(Number.isSafeInteger) || y < 1 || y > o || v < 1 || v > u)
869
+ throw new Error(`[ui0-icon] ${d}: cell is outside ${o}x${u}`);
870
+ const w = typeof h == "string" ? { value: h } : h, { rows: E, cols: N } = w.span ?? { rows: 1, cols: 1 };
871
+ if (![E, N].every((A) => Number.isSafeInteger(A) && A > 0))
872
+ throw new Error(`[ui0-icon] ${d}: span rows and cols must be positive integers`);
873
+ if (E > o - y + 1 || N > u - v + 1)
874
+ throw new Error(`[ui0-icon] ${d}: span ${E}x${N} is outside ${o}x${u}`);
875
+ const S = Vt(w.value), C = Object.fromEntries(new URLSearchParams(S.query));
876
+ if ("weight" in w || C.weight !== void 0) throw new Error(`[ui0-icon] ${d}: local weight is forbidden`);
877
+ if ("shape" in w || "badge" in w || C.shape !== void 0 || C.badge !== void 0)
878
+ throw new Error(`[ui0-icon] ${d}: shape and badge belong to the complete icon`);
879
+ if ("progress" in w || C.progress !== void 0)
880
+ throw new Error(`[ui0-icon] ${d}: progress belongs to the composition program`);
881
+ w.cell === "full" && s(`[ui0-icon] ${d}: cell:'full' is deprecated and has no placement effect`);
882
+ for (const A of ["fit", "rotate", "flipped", "filled", "rendering", "modifiers"])
883
+ w[A] !== void 0 && C[A] !== void 0 && String(w[A]) !== C[A] && s(`[ui0-icon] ${d}: ${A}=${String(w[A])} overrides value parameter ${C[A]}`);
884
+ let L;
885
+ try {
886
+ L = dt(S.name, t, e, s, f);
887
+ } catch (A) {
888
+ throw new Error(`[ui0-icon] ${d} source '${S.name}': ${String(A)}`);
889
+ }
890
+ L.files.forEach((A) => g.add(A));
891
+ const Z = x.parseAsSingle(L.svg), [ht, gt, _, M] = pt(Z, e, `${d} source ${S.name}`), R = w.rotate ?? Number(C.rotate ?? 0);
892
+ if (!Number.isFinite(R)) throw new Error(`[ui0-icon] ${d}: invalid rotate`);
893
+ const H = Math.abs(R % 180) === 90, mt = H ? M / _ : _ / M, bt = N * o / (E * u);
894
+ if (Math.abs(mt - bt) > 1e-6)
895
+ throw new Error(`[ui0-icon] ${d} source ${S.name}: source proportions do not match the placement area`);
896
+ const j = w.fit ?? C.fit ?? "normal", K = { normal: 1, default: 1, small: 0.84210526, large: 1.16666667 };
897
+ if (!(j in K)) throw new Error(`[ui0-icon] ${d}: unknown fit '${j}'`);
898
+ const T = e * 0.75 * N / u / ((H ? M : _) * 0.75) * K[j], vt = e * 0.125 + (v - 1 + N / 2) * e * 0.75 / u, wt = e * 0.125 + (y - 1 + E / 2) * e * 0.75 / o, $t = w.flipped ?? C.flipped === "true", Q = w.filled ?? (C.filled === "true" || ((m = S.modifiers) == null ? void 0 : m.some((A) => ["fill", "filled"].includes(A)))), yt = typeof w.modifiers == "string" ? w.modifiers.split(/[\s,]+/) : w.modifiers ?? [], Y = {
899
+ dataCell: c,
900
+ transform: `translate(${vt} ${wt}) scale(${$t ? -T : T} ${T}) rotate(${R}) translate(${-ht - _ / 2} ${-gt - M / 2})`,
901
+ class: [...S.modifiers ?? [], ...yt].join(" ")
902
+ };
903
+ Q !== void 0 && (Y.style = `fill:${Q ? "var(--0-icon-fill-color, currentColor)" : "none"}`);
904
+ const xt = Qt(Z).replaceAll("iconProgressValue", "100");
905
+ p.push(x.createNode({ tag: "g", attributes: Y, content: xt }).serialize());
906
+ }
907
+ const n = `<svg viewBox="0 0 ${e} ${e}">${p.join("")}</svg>`;
908
+ return { svg: ft(n, a, r), files: g, virtual: !0 };
909
+ }
910
+ function Yt(r, t, e) {
911
+ const s = x.parseAsSingle(r);
912
+ if (!s || s.tag !== "svg") throw new Error(`[ui0-icon] ${e}: expected SVG root`);
913
+ const [i, f, l, a] = pt(s, t, e), o = 960 / Math.max(l, a);
914
+ if (s.attributes.viewBox = "0 0 960 960", i !== 0 || f !== 0 || l !== 960 || a !== 960) {
915
+ const u = `translate(480 480) scale(${o}) translate(${-i - l / 2} ${-f - a / 2})`;
916
+ s.attributes.transform = `${u} ${s.attributes.transform ?? ""}`.trim();
917
+ }
918
+ return s.serialize();
919
+ }
920
+ const G = "virtual:ui0-icon-next/", O = "\0ui0-icon-next/", q = "/@ui0-icon-next/";
921
+ function oe(r = {}) {
922
+ let t = "";
923
+ const e = r.size ?? 960;
924
+ if (!Number.isFinite(e) || e <= 0) throw new Error("[ui0-icon] size must be a positive number");
925
+ let s;
926
+ const i = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), l = new Wt({ fit: r.fit ?? !0, rescaling: !1 });
769
927
  return {
770
928
  name: "vite:ui0-icon",
771
929
  enforce: "pre",
772
- resolveId(d, n) {
773
- if (e.has(d) || d.indexOf("?vue") > -1)
774
- return d;
775
- if (yt.test(d)) {
776
- const h = ht(d);
777
- if (n) return `${A}${dt(n) + h}`;
778
- }
930
+ configResolved(a) {
931
+ t = a.root, s = new Kt(r, t, (o) => a.logger.warn(o)), s.scan();
779
932
  },
780
- async load(d) {
781
- var a, f, x;
782
- const h = d.split("?", 1)[0].replace(A, "");
783
- if (d.startsWith(A) && d.indexOf("?vue") === -1) {
784
- const b = g(h);
785
- return b !== void 0 && ((a = i.virtual) != null && a[N(h)]) && c.set(d, N(h)), b;
786
- }
787
- if (d.startsWith(A) && d.indexOf("?vue") > -1) {
788
- const b = g(h);
789
- return b !== void 0 && ((f = i.virtual) != null && f[N(h)]) && c.set(d, N(h)), p.process(h, b ?? ""), ((x = p.result[h]) == null ? void 0 : x.sfc.style) ?? "";
790
- }
933
+ resolveId(a, o) {
934
+ if (a.startsWith(q) || a.startsWith(O)) return a;
935
+ if (a.startsWith(G)) return O + decodeURIComponent(a.slice(G.length));
936
+ if (!o || !/\.svg(?:\?icon)?$/.test(a)) return;
937
+ const u = a.replace(/\?icon$/, ""), p = k.isAbsolute(u) ? u : k.resolve(k.dirname(o.split("?")[0]), u), g = s.nameOfFile(p) ?? (u.startsWith("/") ? s.nameOfFile(k.join(t, u)) : void 0);
938
+ if (g) return O + g;
791
939
  },
792
- async transform(d, n) {
793
- if (!n.startsWith(A) && !l(n))
794
- return;
795
- if (n.indexOf("?vue") > -1)
796
- return d;
797
- if (!n.split("?", 1)[0]) return;
798
- const a = d || "";
799
- p.process(n, a || "");
800
- const f = p.render(n);
801
- return e.set(n, f), f;
940
+ load(a) {
941
+ if (a.startsWith(q)) return f.get(a) ?? "";
942
+ if (!a.startsWith(O)) return;
943
+ const o = a.slice(O.length), u = dt(o, s, e, (d) => this.warn(d));
944
+ i.set(a, u.files), u.files.forEach((d) => this.addWatchFile(d));
945
+ const p = u.virtual ? u.svg : lt(u.svg, o), g = l.processPrepared(o, Yt(p, e, o)), n = Nt("sha256").update(o).digest("hex").slice(0, 12), m = `data-v-${n}`, c = Et({ source: g.template, filename: `${o}.vue`, id: m, scoped: !!g.style });
946
+ if (c.errors.length) throw c.errors[0];
947
+ let h = "";
948
+ if (g.style) {
949
+ const d = kt(k.join(t, "package.json")), b = Pt({
950
+ source: g.style,
951
+ filename: `${o}.scss`,
952
+ id: m,
953
+ scoped: !0,
954
+ preprocessLang: "scss",
955
+ preprocessCustomRequire: (v) => {
956
+ if (v !== "sass") return d(v);
957
+ try {
958
+ return d("sass-embedded");
959
+ } catch {
960
+ return d("sass");
961
+ }
962
+ }
963
+ });
964
+ if (b.errors.length) throw b.errors[0];
965
+ const y = `${q}${n}.css`;
966
+ f.set(y, b.code), h += `import ${JSON.stringify(y)}
967
+ `;
968
+ }
969
+ return h += g.script.replace("export default", "const _body =") + `
970
+ `, h += c.code.replace("export function render", "function render"), h += `
971
+ _body.render = render
972
+ `, g.style && (h += `_body.__scopeId = ${JSON.stringify(m)}
973
+ `), h + `export default _body
974
+ `;
802
975
  },
803
- async handleHotUpdate(d) {
804
- var v;
805
- const { file: n, read: h, server: a } = d;
806
- if (!u(n)) return;
807
- const f = ft(n);
808
- p.process(f, await h()), e.set(f, p.render(f));
809
- const x = [];
810
- for (const [m, S] of c) {
811
- const R = (v = i.virtual) == null ? void 0 : v[S];
812
- if (!R || k(R)) continue;
813
- const tt = E(S, R, o);
814
- p.process(m, tt), e.set(m, p.render(m));
815
- const W = a.moduleGraph.getModuleById(m);
816
- W && x.push(W);
976
+ transform(a, o) {
977
+ var b, y;
978
+ if (!o.endsWith(".vue")) return;
979
+ const { descriptor: u, errors: p } = Ct(a, { filename: o });
980
+ if (p.length || !((b = u.template) != null && b.ast)) return;
981
+ const g = /* @__PURE__ */ new Set(), n = (v) => {
982
+ var w, E;
983
+ if (v.type === 1 && ["Icon", "icon", "Ui0Icon", "ui0-icon"].includes(v.tag ?? ""))
984
+ for (const N of v.props ?? []) {
985
+ if (N.type === 6 && ["value", "badge"].includes(N.name) && N.value) {
986
+ const S = N.value.content.split(/[.?]/, 1)[0];
987
+ if (s.has(S)) g.add(S);
988
+ else if (/^(assets|virtual|blocks)\//.test(S) || S.split("/")[0] in (r.packs ?? {}))
989
+ throw new Error(`[ui0-icon] ${o}: unknown source '${S}'`);
990
+ }
991
+ if (N.type === 7 && N.name === "bind" && ((w = N.arg) == null ? void 0 : w.content) === "value")
992
+ for (const S of Object.keys(r.virtual ?? {})) g.add(`virtual/${S}`);
993
+ }
994
+ (E = v.children) == null || E.forEach(n);
995
+ };
996
+ if (n(u.template.ast), !g.size) return;
997
+ const m = [...g].map((v, w) => `import __ui0Body${w} from ${JSON.stringify(G + encodeURIComponent(v))}`).join(`
998
+ `), c = [...g].map((v, w) => `${JSON.stringify(v)}: __ui0Body${w}`).join(","), h = `
999
+ import { provide as __ui0Provide, inject as __ui0Inject } from 'vue'
1000
+ ${m}
1001
+ const __ui0Key = Symbol.for('ui0-icon-generated')
1002
+ __ui0Provide(__ui0Key, { ...__ui0Inject(__ui0Key, {}), ${c} })
1003
+ `;
1004
+ if (u.scriptSetup) {
1005
+ const v = u.scriptSetup.loc.start.offset;
1006
+ return { code: a.slice(0, v) + h + a.slice(v), map: null };
817
1007
  }
818
- const b = a.moduleGraph.getModuleById(f);
819
- return !b && !x.length ? [] : [...b ? [b] : [], ...x];
1008
+ const d = (y = u.script) != null && y.lang ? ` lang="${u.script.lang}"` : "";
1009
+ return { code: `${a}
1010
+ <script setup${d}>${h}<\/script>`, map: null };
820
1011
  },
821
- buildStart() {
822
- e = /* @__PURE__ */ new Map(), c.clear();
1012
+ handleHotUpdate(a) {
1013
+ s.scan();
1014
+ const o = [];
1015
+ for (const [u, p] of i) {
1016
+ if (!p.has(a.file)) continue;
1017
+ const g = a.server.moduleGraph.getModuleById(u);
1018
+ g && o.push(g);
1019
+ }
1020
+ for (const u of f.keys()) {
1021
+ const p = a.server.moduleGraph.getModuleById(u);
1022
+ p && o.length && o.push(p);
1023
+ }
1024
+ if (o.length) return o;
823
1025
  }
824
1026
  };
825
1027
  }
826
1028
  export {
827
- Mt as default,
828
- k as isVirtualTemplate
1029
+ oe as ViteUi0Icon,
1030
+ oe as ViteUi0IconNext,
1031
+ oe as default,
1032
+ ut as isVirtualTemplate
829
1033
  };