figma-lupa 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -380,26 +380,26 @@ var require_permessage_deflate = __commonJS({
380
380
  value = value[0];
381
381
  if (key === "client_max_window_bits") {
382
382
  if (value !== true) {
383
- const num2 = +value;
384
- if (!Number.isInteger(num2) || num2 < 8 || num2 > 15) {
383
+ const num3 = +value;
384
+ if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
385
385
  throw new TypeError(
386
386
  `Invalid value for parameter "${key}": ${value}`
387
387
  );
388
388
  }
389
- value = num2;
389
+ value = num3;
390
390
  } else if (!this._isServer) {
391
391
  throw new TypeError(
392
392
  `Invalid value for parameter "${key}": ${value}`
393
393
  );
394
394
  }
395
395
  } else if (key === "server_max_window_bits") {
396
- const num2 = +value;
397
- if (!Number.isInteger(num2) || num2 < 8 || num2 > 15) {
396
+ const num3 = +value;
397
+ if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
398
398
  throw new TypeError(
399
399
  `Invalid value for parameter "${key}": ${value}`
400
400
  );
401
401
  }
402
- value = num2;
402
+ value = num3;
403
403
  } else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
404
404
  if (value !== true) {
405
405
  throw new TypeError(
@@ -1113,8 +1113,8 @@ var require_receiver = __commonJS({
1113
1113
  return;
1114
1114
  }
1115
1115
  const buf = this.consume(8);
1116
- const num2 = buf.readUInt32BE(0);
1117
- if (num2 > Math.pow(2, 53 - 32) - 1) {
1116
+ const num3 = buf.readUInt32BE(0);
1117
+ if (num3 > Math.pow(2, 53 - 32) - 1) {
1118
1118
  const error62 = this.createError(
1119
1119
  RangeError,
1120
1120
  "Unsupported WebSocket frame: payload length > 2^53 - 1",
@@ -1125,7 +1125,7 @@ var require_receiver = __commonJS({
1125
1125
  cb(error62);
1126
1126
  return;
1127
1127
  }
1128
- this._payloadLength = num2 * Math.pow(2, 32) + buf.readUInt32BE(4);
1128
+ this._payloadLength = num3 * Math.pow(2, 32) + buf.readUInt32BE(4);
1129
1129
  this.haveLength(cb);
1130
1130
  }
1131
1131
  /**
@@ -2257,9 +2257,9 @@ var require_extension = __commonJS({
2257
2257
  return configurations.map((params) => {
2258
2258
  return [extension2].concat(
2259
2259
  Object.keys(params).map((k) => {
2260
- let values = params[k];
2261
- if (!Array.isArray(values)) values = [values];
2262
- return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
2260
+ let values2 = params[k];
2261
+ if (!Array.isArray(values2)) values2 = [values2];
2262
+ return values2.map((v) => v === true ? k : `${k}=${v}`).join("; ");
2263
2263
  })
2264
2264
  ).join("; ");
2265
2265
  }).join(", ");
@@ -3743,17 +3743,17 @@ var init_package = __esm({
3743
3743
  "package.json"() {
3744
3744
  package_default = {
3745
3745
  name: "figma-lupa",
3746
- version: "0.2.2",
3746
+ version: "0.3.1",
3747
3747
  description: "Read-only Figma CLI, MCP server and plugin for pixel-faithful design-to-code with a small context footprint.",
3748
3748
  type: "module",
3749
3749
  license: "GPL-3.0-or-later",
3750
3750
  repository: {
3751
3751
  type: "git",
3752
- url: "git+https://github.com/wjkba/lupa.git"
3752
+ url: "git+https://github.com/wjkba/figma-lupa.git"
3753
3753
  },
3754
- homepage: "https://github.com/wjkba/lupa#readme",
3754
+ homepage: "https://github.com/wjkba/figma-lupa#readme",
3755
3755
  bugs: {
3756
- url: "https://github.com/wjkba/lupa/issues"
3756
+ url: "https://github.com/wjkba/figma-lupa/issues"
3757
3757
  },
3758
3758
  bin: {
3759
3759
  lupa: "dist/cli.js"
@@ -4258,7 +4258,7 @@ var init_legend = __esm({
4258
4258
  "+N more like \u2191" / "+N more alternating like the 2 above" = siblings with the same structure as the layer(s) just printed; the lines under it give each one's id and its own texts/images.
4259
4259
  "\u2026 +N layers not shown \u2192 get_design #id" = cut by the token budget; fetch that subtree when you need it.
4260
4260
  // lines = designer notes, prototype interactions, component props, exports.
4261
- Codebase: "\u2192 var(--x)" after a colour or font = the project's own variable for that value; "\u2192 .class" after a typography token = its text style class. "// project has: \u2026" = where the project defines that component. A src: outside the assets folder = the project's own icon with the same drawing.
4261
+ Codebase: "\u2192 var(--x)" after a colour or font = the project's own variable for that value; "\u2192 .class" after a typography token = its text style class. Tailwind theme (v4 @theme or v3 tailwind.config): "\u2192 *-grey-200" = that colour's utilities (bg-grey-200, text-grey-200, border-grey-200\u2026), "\u2192 font-sans" = the font utility, "\u2192 text-sm font-medium leading-[20px]" = utility classes for a typography token. "// project has: \u2026" = where the project defines that component, with its props when Lupa can read them (<Button variant="default*|outline"> for React cva/tv variants or string-union props, <.button variant="primary"> <:actions> for Phoenix attrs and slots; * = default). A src: outside the assets folder = the project's own icon with the same drawing; src:<PlusIcon /> (components/icons/plus.tsx) = the project's own icon component; src:<ChevronDown /> from lucide-react or src:<.icon name="hero-x-mark" /> = that icon from the project's icon library (no file written).
4262
4262
  Reproduce exact values (sizes, spacing, colours, type). Before writing any colour, $token or raw (#hex, rgba), look for the codebase's own token with that name or value (Tailwind theme, CSS variables, theme object) and use it; hardcode only when none matches.`;
4263
4263
  }
4264
4264
  });
@@ -4924,9 +4924,9 @@ var init_build = __esm({
4924
4924
  LINE: "line"
4925
4925
  };
4926
4926
  Builder = class {
4927
- constructor(snap, files) {
4927
+ constructor(snap, files2) {
4928
4928
  this.snap = snap;
4929
- this.files = files;
4929
+ this.files = files2;
4930
4930
  this.reg = new Registry(snap);
4931
4931
  }
4932
4932
  reg;
@@ -5053,18 +5053,18 @@ var init_build = __esm({
5053
5053
  if (!raw.layoutMode || raw.graphic) return;
5054
5054
  const L = ir.layout;
5055
5055
  const bv = raw.boundVariables ?? {};
5056
- const num2 = (key) => this.reg.number(raw[key] ?? 0, bv[key]?.id);
5056
+ const num3 = (key) => this.reg.number(raw[key] ?? 0, bv[key]?.id);
5057
5057
  if (raw.layoutMode === "GRID") {
5058
5058
  const tracks = (t, count) => (t?.length ? t : Array.from({ length: count ?? 0 }, () => ({ type: "FLEX", value: 1 }))).map((s) => s.type === "FIXED" ? n(s.value ?? 0) : s.type === "HUG" ? "auto" : `${n(s.value ?? 1)}fr`).join(",");
5059
5059
  L.grid = "";
5060
5060
  L.cols = emptyTracks(raw, "col", tracks(raw.gridColumnSizes, raw.gridColumnCount));
5061
5061
  L.rows = emptyTracks(raw, "row", tracks(raw.gridRowSizes, raw.gridRowCount));
5062
- if (raw.gridColumnGap) L.gap = num2("gridColumnGap");
5063
- if (raw.gridRowGap) L.rowgap = num2("gridRowGap");
5062
+ if (raw.gridColumnGap) L.gap = num3("gridColumnGap");
5063
+ if (raw.gridRowGap) L.rowgap = num3("gridRowGap");
5064
5064
  } else {
5065
5065
  L[raw.layoutMode === "VERTICAL" ? "col" : "row"] = "";
5066
5066
  if (raw.primaryAxisAlignItems === "SPACE_BETWEEN") L.justify = "between";
5067
- else if (raw.itemSpacing) L.gap = num2("itemSpacing");
5067
+ else if (raw.itemSpacing) L.gap = num3("itemSpacing");
5068
5068
  if (raw.layoutWrap) {
5069
5069
  L.wrap = "";
5070
5070
  if (raw.counterAxisSpacing) L.rowgap = this.reg.number(raw.counterAxisSpacing, bv.counterAxisSpacing?.id);
@@ -5080,8 +5080,8 @@ var init_build = __esm({
5080
5080
  const pad = (key, side) => {
5081
5081
  const v = raw[key] ?? 0;
5082
5082
  const w = inset?.[side] ?? 0;
5083
- if (!w || v < w) return num2(key);
5084
- const ref = num2(key);
5083
+ if (!w || v < w) return num3(key);
5084
+ const ref = num3(key);
5085
5085
  return ref.startsWith("$") ? `calc(${ref} - ${n(w)})` : n(v - w);
5086
5086
  };
5087
5087
  const p = sides(pad("paddingTop", 0), pad("paddingRight", 1), pad("paddingBottom", 2), pad("paddingLeft", 3));
@@ -5165,8 +5165,8 @@ var init_build = __esm({
5165
5165
  const full = raw.cornerRadius >= Math.min(raw.w, raw.h) / 2 - 0.01 && Math.min(raw.w, raw.h) > 0;
5166
5166
  S.radius = bv.cornerRadius ? this.reg.number(raw.cornerRadius, bv.cornerRadius.id) : full ? "full" : n(raw.cornerRadius);
5167
5167
  } else if (raw.radii) {
5168
- const keys = ["topLeftRadius", "topRightRadius", "bottomRightRadius", "bottomLeftRadius"];
5169
- S.radius = raw.radii.map((r, i) => this.reg.number(r, bv[keys[i]]?.id)).join(",");
5168
+ const keys2 = ["topLeftRadius", "topRightRadius", "bottomRightRadius", "bottomLeftRadius"];
5169
+ S.radius = raw.radii.map((r, i) => this.reg.number(r, bv[keys2[i]]?.id)).join(",");
5170
5170
  }
5171
5171
  if (raw.cornerSmoothing && S.radius) S.smooth = `${n(raw.cornerSmoothing * 100, 0)}%`;
5172
5172
  }
@@ -5449,7 +5449,7 @@ var init_components = __esm({
5449
5449
  this.diffChildren(inst, def, "", out, keyOf, resized);
5450
5450
  return out;
5451
5451
  }
5452
- diffChildren(a, d, path6, out, keyOf, resized) {
5452
+ diffChildren(a, d, path7, out, keyOf, resized) {
5453
5453
  const defByKey = new Map(d.children.map((c) => [keyOf(c, true), c]));
5454
5454
  const matched = /* @__PURE__ */ new Set();
5455
5455
  const names = pathNames(d.children);
@@ -5460,7 +5460,7 @@ var init_components = __esm({
5460
5460
  const cand = d.children[a.children.indexOf(child)];
5461
5461
  dc = ok(cand) ? cand : d.children.find(ok);
5462
5462
  }
5463
- const p = joinPath(path6, dc ? names.get(dc) ?? dc.name : child.name);
5463
+ const p = joinPath(path7, dc ? names.get(dc) ?? dc.name : child.name);
5464
5464
  if (!dc) {
5465
5465
  out.push({ path: p, changes: ["added"], sub: child });
5466
5466
  continue;
@@ -5471,20 +5471,20 @@ var init_components = __esm({
5471
5471
  for (const dc of d.children) {
5472
5472
  if (matched.has(dc) || dc.hidden) continue;
5473
5473
  if (dc.propRefs?.visible) continue;
5474
- out.push({ path: joinPath(path6, names.get(dc) ?? dc.name), changes: ["hidden"] });
5474
+ out.push({ path: joinPath(path7, names.get(dc) ?? dc.name), changes: ["hidden"] });
5475
5475
  }
5476
5476
  }
5477
- diffNode(a, d, path6, out, keyOf, resized) {
5477
+ diffNode(a, d, path7, out, keyOf, resized) {
5478
5478
  if (a.hidden && !d.hidden) {
5479
- if (!d.propRefs?.visible) out.push({ path: path6, changes: ["hidden"] });
5479
+ if (!d.propRefs?.visible) out.push({ path: path7, changes: ["hidden"] });
5480
5480
  return;
5481
5481
  }
5482
5482
  if (!a.hidden && d.hidden) {
5483
5483
  if (d.propRefs?.visible) {
5484
5484
  const changes2 = this.nodeChanges(a, d, resized);
5485
- if (changes2.length) out.push({ path: path6, changes: changes2 });
5486
- this.diffChildren(a, d, path6, out, keyOf, resized);
5487
- } else out.push({ path: path6, changes: ["shown"], sub: a });
5485
+ if (changes2.length) out.push({ path: path7, changes: changes2 });
5486
+ this.diffChildren(a, d, path7, out, keyOf, resized);
5487
+ } else out.push({ path: path7, changes: ["shown"], sub: a });
5488
5488
  return;
5489
5489
  }
5490
5490
  if (a.hidden) return;
@@ -5498,22 +5498,22 @@ var init_components = __esm({
5498
5498
  if (a.kind === "svg" || !a.children.length) {
5499
5499
  if (a.kind === "svg" && a.style.src !== d.style.src && a.style.src) changes2.push(`src:${a.style.src}`);
5500
5500
  if (a.kind === "svg" && a.style.color !== d.style.color && a.style.color) changes2.push(`color:${a.style.color}`);
5501
- if (changes2.length) out.push({ path: path6, changes: changes2 });
5501
+ if (changes2.length) out.push({ path: path7, changes: changes2 });
5502
5502
  } else if (def) {
5503
5503
  changes2.push(...this.rootChanges(a, def.ir));
5504
- if (changes2.length) out.push({ path: path6, changes: changes2 });
5504
+ if (changes2.length) out.push({ path: path7, changes: changes2 });
5505
5505
  const nested = this.overrides(a, def.ir);
5506
- for (const o2 of nested) out.push({ ...o2, path: joinPath(path6, o2.path) });
5506
+ for (const o2 of nested) out.push({ ...o2, path: joinPath(path7, o2.path) });
5507
5507
  } else {
5508
- out.push({ path: path6, changes: changes2.length ? changes2 : [`swap\u2192${label}`], sub: a });
5508
+ out.push({ path: path7, changes: changes2.length ? changes2 : [`swap\u2192${label}`], sub: a });
5509
5509
  }
5510
5510
  return;
5511
5511
  }
5512
5512
  const changes = this.nodeChanges(a, d, resized);
5513
- const o = { path: path6, changes };
5513
+ const o = { path: path7, changes };
5514
5514
  if (a.runs && JSON.stringify(a.runs) !== JSON.stringify(d.runs)) o.runs = a.runs;
5515
5515
  if (changes.length || o.runs) out.push(o);
5516
- if (a.kind !== "svg") this.diffChildren(a, d, path6, out, keyOf, resized);
5516
+ if (a.kind !== "svg") this.diffChildren(a, d, path7, out, keyOf, resized);
5517
5517
  }
5518
5518
  nodeChanges(a, d, resized) {
5519
5519
  const changes = [];
@@ -5697,12 +5697,12 @@ var init_render = __esm({
5697
5697
  const fonts = this.fonts([...roots, ...[...this.comps.defs.values()].filter((d) => charged.has(d.mainId)).map((d) => d.ir)]);
5698
5698
  if (fonts) head.push(`fonts: ${fonts}`);
5699
5699
  const assets = this.assets(roots);
5700
- const files = this.opts.files;
5701
- if (files) {
5702
- const own2 = files.reused?.size ?? 0;
5703
- const count = (/* @__PURE__ */ new Set([...files.byNode.values(), ...files.byImage.values()])).size - own2;
5700
+ const files2 = this.opts.files;
5701
+ if (files2) {
5702
+ const own2 = files2.reused?.size ?? 0;
5703
+ const count = (/* @__PURE__ */ new Set([...files2.byNode.values(), ...files2.byImage.values()])).size - own2;
5704
5704
  const ownNote = own2 ? ` + ${own2} icon${own2 === 1 ? "" : "s"} the project already has` : "";
5705
- head.push(`assets: ${count} file${count === 1 ? "" : "s"} in ${files.dir}/${ownNote}, named by src: on each layer${files.failures.length ? ` (${files.failures.length} failed \u2192 export_assets)` : ""}`);
5705
+ head.push(`assets: ${count} file${count === 1 ? "" : "s"} in ${files2.dir}/${ownNote}, named by src: on each layer${files2.failures.length ? ` (${files2.failures.length} failed \u2192 export_assets)` : ""}`);
5706
5706
  } else if (assets) head.push(`assets: ${assets} \u2192 export_assets`);
5707
5707
  if (cut) head.push(`budget: tree cut breadth-first at ~${Math.round(this.budgetChars / CHARS_PER_TOKEN)} tokens \u2014 "not shown" markers say how to expand`);
5708
5708
  if (this.snap.stats.truncated) head.push(`warning: snapshot hit the node limit; some layers were not loaded`);
@@ -6041,9 +6041,9 @@ function formatOutline(o) {
6041
6041
  function formatMatches(r) {
6042
6042
  if (!r.matches.length) return "No matches.";
6043
6043
  const out = r.matches.map((m) => {
6044
- const path6 = [m.page, ...m.path].filter(Boolean).join(" \u203A ");
6044
+ const path7 = [m.page, ...m.path].filter(Boolean).join(" \u203A ");
6045
6045
  const text2 = m.text !== void 0 ? ` ${JSON.stringify(m.text)}` : "";
6046
- return `${m.type.toLowerCase()} "${m.name}" #${m.id} ${m.w}\xD7${m.h}${text2} \u2014 ${path6}`;
6046
+ return `${m.type.toLowerCase()} "${m.name}" #${m.id} ${m.w}\xD7${m.h}${text2} \u2014 ${path7}`;
6047
6047
  });
6048
6048
  if (r.truncated) out.push("\u2026 more matches; narrow the query, page or type.");
6049
6049
  return out.join("\n");
@@ -6102,9 +6102,9 @@ function formatTokens(t, format, filter) {
6102
6102
  if (!vars.length) continue;
6103
6103
  lines.push(`${c.name}${c.remote ? " (library)" : ""} \u2014 modes: ${c.modes.map((m) => m.name).join(" | ")}`);
6104
6104
  for (const v of vars) {
6105
- const values = c.modes.map((m) => tokenValue(v.values[m.id], v.type));
6106
- const uniq = new Set(values);
6107
- lines.push(` ${v.name} = ${uniq.size === 1 ? values[0] : values.join(" | ")}${v.web ? ` ${v.web}` : ""}${v.description ? ` \u2014 ${v.description.slice(0, 80)}` : ""}`);
6105
+ const values2 = c.modes.map((m) => tokenValue(v.values[m.id], v.type));
6106
+ const uniq = new Set(values2);
6107
+ lines.push(` ${v.name} = ${uniq.size === 1 ? values2[0] : values2.join(" | ")}${v.web ? ` ${v.web}` : ""}${v.description ? ` \u2014 ${v.description.slice(0, 80)}` : ""}`);
6108
6108
  }
6109
6109
  }
6110
6110
  }
@@ -6141,32 +6141,1685 @@ var init_format = __esm({
6141
6141
  }
6142
6142
  });
6143
6143
 
6144
+ // src/tools/icons.ts
6145
+ import { readdir, readFile as readFile2, stat as stat2 } from "node:fs/promises";
6146
+ import path3 from "node:path";
6147
+ async function exists(p) {
6148
+ try {
6149
+ await stat2(p);
6150
+ return true;
6151
+ } catch {
6152
+ return false;
6153
+ }
6154
+ }
6155
+ async function installed(from, root, pkg) {
6156
+ for (let dir = from; ; dir = path3.dirname(dir)) {
6157
+ const p = path3.join(dir, "node_modules", pkg);
6158
+ if (await exists(p)) return p;
6159
+ if (dir === root || path3.dirname(dir) === dir || !dir.startsWith(root)) return void 0;
6160
+ }
6161
+ }
6162
+ async function files(dir, re) {
6163
+ try {
6164
+ return (await readdir(dir)).filter((f) => re.test(f)).sort().map((f) => path3.join(dir, f));
6165
+ } catch {
6166
+ return [];
6167
+ }
6168
+ }
6169
+ function once(f) {
6170
+ let p;
6171
+ return () => p ??= f();
6172
+ }
6173
+ async function svgFolder(dir, usage) {
6174
+ const out = [];
6175
+ for (const f of await files(dir, /\.svg$/i)) {
6176
+ const svg = await readFile2(f, "utf8").catch(() => "");
6177
+ const points = pointsOf(svg);
6178
+ const name = path3.basename(f, ".svg");
6179
+ if (points) out.push({ usage: usage(name), name, points });
6180
+ }
6181
+ return out;
6182
+ }
6183
+ async function lucideModules(pkgDir, pkg) {
6184
+ const out = [];
6185
+ for (const f of await files(path3.join(pkgDir, "dist/esm/icons"), /\.m?js$/)) {
6186
+ const js = await readFile2(f, "utf8").catch(() => "");
6187
+ const els = [...js.matchAll(/\[\s*"(path|circle|rect|ellipse|line|polyline|polygon)"\s*,\s*\{([^}]*)\}\s*\]/g)];
6188
+ if (!els.length) continue;
6189
+ const body = els.map((m) => `<${m[1]} ${[...m[2].matchAll(/(\w+)\s*:\s*"([^"]*)"/g)].filter((a) => a[1] !== "key").map((a) => `${a[1]}="${a[2]}"`).join(" ")}/>`).join("");
6190
+ const points = pointsOf(`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">${body}</svg>`);
6191
+ const name = path3.basename(f).replace(/\.m?js$/, "");
6192
+ if (points) out.push({ usage: `<${pascal(name)} /> from ${pkg}`, name, points });
6193
+ }
6194
+ return out;
6195
+ }
6196
+ async function heroReact(pkgDir) {
6197
+ const out = [];
6198
+ for (const set2 of HERO_SETS) {
6199
+ for (const f of await files(path3.join(pkgDir, set2.dir), /Icon\.js$/)) {
6200
+ const js = await readFile2(f, "utf8").catch(() => "");
6201
+ const ds = [...js.matchAll(/\bd:\s*"([^"]+)"/g)].map((m) => `<path d="${m[1]}"/>`).join("");
6202
+ const size = set2.dir.split("/")[0];
6203
+ const points = pointsOf(`<svg viewBox="0 0 ${size} ${size}" ${set2.stroke ? 'fill="none" stroke="currentColor"' : ""}>${ds}</svg>`);
6204
+ const comp = path3.basename(f, ".js");
6205
+ const name = comp.replace(/Icon$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
6206
+ if (points) out.push({ usage: `<${comp} /> from @heroicons/react/${set2.dir}`, name, points });
6207
+ }
6208
+ }
6209
+ return out;
6210
+ }
6211
+ function genSvg(n2) {
6212
+ const attrs3 = Object.entries(n2.attr ?? {}).map(([k, v]) => `${k === "viewBox" ? k : k.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}="${String(v).replace(/"/g, "&quot;")}"`).join(" ");
6213
+ return `<${n2.tag} ${attrs3}>${(n2.child ?? []).map(genSvg).join("")}</${n2.tag}>`;
6214
+ }
6215
+ async function reactIcons(pkgDir, set2) {
6216
+ const out = [];
6217
+ const js = await readFile2(path3.join(pkgDir, set2, "index.mjs"), "utf8").catch(() => "");
6218
+ for (const m of js.matchAll(/export function (\w+) \(props\) \{\s*return GenIcon\((\{.*\})\)\(props\)/g)) {
6219
+ let tree;
6220
+ try {
6221
+ tree = JSON.parse(m[2]);
6222
+ } catch {
6223
+ continue;
6224
+ }
6225
+ const points = pointsOf(genSvg({ ...tree, attr: { fill: "currentColor", ...tree.attr } }));
6226
+ const comp = m[1];
6227
+ if (points) out.push({ usage: `<${comp} /> from react-icons/${set2}`, name: kebab(comp.replace(/^[A-Z][a-z]*/, "")), points });
6228
+ }
6229
+ return out;
6230
+ }
6231
+ async function heroPhoenix(base) {
6232
+ const out = [];
6233
+ for (const set2 of HERO_SETS) out.push(...await svgFolder(path3.join(base, set2.dir), (n2) => `<.icon name="hero-${n2}${set2.suffix}" />`));
6234
+ return out;
6235
+ }
6236
+ function codeIcons(src, file2, phoenix = false) {
6237
+ const out = [];
6238
+ if (!src.includes("<svg")) return out;
6239
+ if (phoenix) {
6240
+ for (const m of src.matchAll(/\bdef\s+(\w+)\(assigns\)[^~]*?~H"""\s*(<svg\b[\s\S]*?<\/svg>)\s*"""/g)) {
6241
+ out.push({ usage: `<.${m[1]} /> (${file2})`, name: kebab(m[1]).replace(/-?icon-?/, ""), svg: plainSvg(m[2]) });
6242
+ }
6243
+ return out;
6244
+ }
6245
+ const defs = [...src.matchAll(/(?:function\s+([A-Z]\w*)|(?:const|let)\s+([A-Z]\w*)\s*(?::[^=]+)?=)/g)];
6246
+ for (const m of src.matchAll(/(?:return|=>)\s*\(?\s*(<svg\b[\s\S]*?<\/svg>)/g)) {
6247
+ const def = defs.filter((d) => d.index < m.index).pop();
6248
+ const name = def?.[1] ?? def?.[2];
6249
+ if (!name || !new RegExp(`export\\b[^\\n]*\\b${name}\\b`).test(src) || out.some((o) => o.usage.startsWith(`<${name} `))) continue;
6250
+ out.push({ usage: `<${name} /> (${file2})`, name: kebab(name.replace(/Icon$/, "")), svg: plainSvg(m[1]) });
6251
+ }
6252
+ return out;
6253
+ }
6254
+ function bracketed(t, open2) {
6255
+ let depth = 0;
6256
+ for (let i = open2; i < t.length; i++) {
6257
+ const c = t[i];
6258
+ if (c === '"' || c === "'" || c === "`") {
6259
+ for (i++; i < t.length && t[i] !== c; i++) if (t[i] === "\\") i++;
6260
+ } else if (c === "[" || c === "{") depth++;
6261
+ else if ((c === "]" || c === "}") && --depth === 0) return t.slice(open2, i + 1);
6262
+ }
6263
+ return t.slice(open2);
6264
+ }
6265
+ async function bannedImports(root, pkgs) {
6266
+ const out = /* @__PURE__ */ new Set();
6267
+ const quoted = (t, p) => t.includes(`'${p}'`) || t.includes(`"${p}"`);
6268
+ const names = [".oxlintrc.json", ".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.cjs", "eslint.config.js", "eslint.config.mjs", "eslint.config.cjs", "eslint.config.ts", "biome.json", "biome.jsonc"];
6269
+ for (const n2 of names) {
6270
+ const t = await readFile2(path3.join(root, n2), "utf8").catch(() => "");
6271
+ for (const m of t.matchAll(/(?:no-restricted-imports|noRestrictedImports)["']?\s*[:=]\s*/g)) {
6272
+ const at = m.index + m[0].length;
6273
+ if (t[at] !== "[" && t[at] !== "{") continue;
6274
+ const opts = bracketed(t, at);
6275
+ if (/^\[\s*["']off["']|^\[\s*0\b/.test(opts)) continue;
6276
+ for (const p of pkgs) if (quoted(opts, p)) out.add(p);
6277
+ }
6278
+ }
6279
+ const sg = await readFile2(path3.join(root, "sgconfig.yml"), "utf8").catch(() => "");
6280
+ const dirs = [...(/ruleDirs:\s*((?:\n\s*-\s*.+)+)/.exec(sg)?.[1] ?? "").matchAll(/-\s*["']?([^"'\n]+)/g)].map((m) => m[1].trim());
6281
+ for (const d of dirs) {
6282
+ for (const f of await files(path3.join(root, d), /\.ya?ml$/)) {
6283
+ const t = await readFile2(f, "utf8").catch(() => "");
6284
+ if (/^\s*severity:\s*off\b/m.test(t)) continue;
6285
+ for (const line of t.split("\n").filter((l) => /^\s*(?:-\s*)?pattern:/.test(l))) {
6286
+ for (const p of pkgs) if (/\b(?:from|import|require\s*\()/.test(line) && quoted(line, p)) out.add(p);
6287
+ }
6288
+ }
6289
+ }
6290
+ return out;
6291
+ }
6292
+ async function iconLibraries(root, manifests, own2 = [], reactIconSets = []) {
6293
+ const libs = /* @__PURE__ */ new Map();
6294
+ if (own2.length) {
6295
+ libs.set("project", {
6296
+ name: "project",
6297
+ load: once(async () => own2.flatMap((i) => {
6298
+ const points = pointsOf(i.svg);
6299
+ return points ? [{ usage: i.usage, name: i.name, points }] : [];
6300
+ }))
6301
+ });
6302
+ }
6303
+ const banned = await bannedImports(root, ICON_PACKAGES);
6304
+ const add = (name, load) => {
6305
+ if (!libs.has(name)) libs.set(name, { name, load: once(load) });
6306
+ };
6307
+ const phoenix = manifests.some((m) => path3.basename(m) === "mix.exs");
6308
+ for (const m of manifests) {
6309
+ const dir = path3.dirname(m);
6310
+ const text2 = await readFile2(m, "utf8").catch(() => "");
6311
+ if (path3.basename(m) === "mix.exs") {
6312
+ if (/\{:heroicons\b/.test(text2)) {
6313
+ const base = path3.join(root, "deps/heroicons/optimized");
6314
+ if (await exists(base)) add("heroicons (Phoenix)", () => heroPhoenix(base));
6315
+ }
6316
+ if (/\{:lucide_icons\b/.test(text2)) {
6317
+ const base = path3.join(root, "deps/lucide_icons/priv/node_modules/lucide-static/icons");
6318
+ if (await exists(base)) add("lucide_icons", () => svgFolder(base, (n2) => `<Lucideicons.${n2.replace(/-/g, "_")} />`));
6319
+ }
6320
+ continue;
6321
+ }
6322
+ let deps = {};
6323
+ try {
6324
+ const pkg = JSON.parse(text2);
6325
+ deps = { ...pkg.dependencies, ...pkg.devDependencies };
6326
+ } catch {
6327
+ continue;
6328
+ }
6329
+ for (const pkg of ICON_PACKAGES) {
6330
+ if (!(pkg in deps) || banned.has(pkg)) continue;
6331
+ const at = await installed(dir, root, pkg);
6332
+ if (!at) continue;
6333
+ if (pkg === "lucide-react" || pkg === "lucide-vue-next") add(pkg, () => lucideModules(at, pkg));
6334
+ else if (pkg === "@heroicons/react") add(pkg, () => heroReact(at));
6335
+ else if (pkg === "heroicons" && phoenix) add("heroicons (Phoenix)", () => heroPhoenix(at));
6336
+ else if (pkg === "lucide-static") {
6337
+ add(pkg, () => svgFolder(path3.join(at, "icons"), (n2) => `lucide-static/icons/${n2}.svg`));
6338
+ } else if (pkg === "react-icons") {
6339
+ for (const set2 of reactIconSets) {
6340
+ if (/^[a-z0-9]+$/.test(set2) && await exists(path3.join(at, set2, "index.mjs"))) add(`react-icons/${set2}`, () => reactIcons(at, set2));
6341
+ }
6342
+ }
6343
+ }
6344
+ }
6345
+ return [...libs.values()];
6346
+ }
6347
+ async function matchLibraryIcon(libs, svg, layerName = "") {
6348
+ if (!libs.length) return void 0;
6349
+ const p = pointsOf(svg);
6350
+ if (!p) return void 0;
6351
+ const wanted = layerName.split("/").pop().trim().toLowerCase().replace(/icon$/i, "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
6352
+ const icons = (await Promise.all(libs.map(async (lib) => (await lib.load()).map((icon) => ({ icon, own: lib.name === "project" }))))).flat();
6353
+ for (const fit of [false, true]) {
6354
+ const a = fit ? fitted(p) : p;
6355
+ let best;
6356
+ for (const { icon, own: own2 } of icons) {
6357
+ if (fit && icon.points.kind !== p.kind) continue;
6358
+ const q = fit ? fitted(icon.points) : icon.points;
6359
+ if (q.box.some((v, i) => Math.abs(v - a.box[i]) > 0.12)) continue;
6360
+ const score = compare(a, q, best?.score);
6361
+ if (score === void 0) continue;
6362
+ const s = score - (icon.name === wanted ? 0.01 : 0) - (own2 ? 0.01 : 0);
6363
+ if (!best || s < best.score) best = { icon, score: s };
6364
+ }
6365
+ if (best) return best.icon;
6366
+ }
6367
+ return void 0;
6368
+ }
6369
+ function fitted(p) {
6370
+ let f = fits.get(p);
6371
+ if (f) return f;
6372
+ const [x0, y0, x1, y1] = p.box;
6373
+ const size = Math.max(x1 - x0, y1 - y0) || 1;
6374
+ const cx = (x0 + x1) / 2;
6375
+ const cy = (y0 + y1) / 2;
6376
+ const xy = p.xy.map((v, i) => (v - (i % 2 ? cy : cx)) / size + 0.5);
6377
+ f = { xy, box: [(x0 - cx) / size + 0.5, (y0 - cy) / size + 0.5, (x1 - cx) / size + 0.5, (y1 - cy) / size + 0.5], kind: p.kind, len: p.len / size };
6378
+ fits.set(p, f);
6379
+ return f;
6380
+ }
6381
+ function compare(a, b, beat = Infinity) {
6382
+ const d1 = nearest(a.xy, b.xy, MAX_OFFSET + SPREAD);
6383
+ if (!d1) return void 0;
6384
+ const d2 = nearest(b.xy, a.xy, MAX_OFFSET + SPREAD);
6385
+ if (!d2) return void 0;
6386
+ const all = Float64Array.from([...d1, ...d2]).sort();
6387
+ const offset = all[all.length >> 1];
6388
+ const spread = all[all.length - 1] - offset;
6389
+ const maxOffset = a.kind === b.kind && a.kind !== "mixed" ? SAME_KIND_OFFSET : MAX_OFFSET;
6390
+ if (offset > maxOffset || spread > SPREAD) return void 0;
6391
+ const designStroke = a.kind === "stroke" && b.kind === "fill";
6392
+ if (designStroke || a.kind === "fill" && b.kind === "stroke") {
6393
+ const [fill, line] = designStroke ? [b, a] : [a, b];
6394
+ if (fill.len < line.len * MIN_OUTLINE_RATIO) return void 0;
6395
+ if (designStroke && Float64Array.from(d1).sort()[Math.floor(d1.length * 0.15)] < offset * 0.8) return void 0;
6396
+ }
6397
+ const score = spread + offset / 4;
6398
+ return score < beat + 0.01 ? score : void 0;
6399
+ }
6400
+ function nearest(a, b, limit) {
6401
+ const out = [];
6402
+ const lim2 = limit * limit;
6403
+ const stride = 14;
6404
+ for (let s = 0; s < stride; s += 2) {
6405
+ for (let i = s; i < a.length; i += stride) {
6406
+ const x = a[i];
6407
+ const y = a[i + 1];
6408
+ let m = Infinity;
6409
+ for (let j = 0; j < b.length; j += 2) {
6410
+ const dx = b[j] - x;
6411
+ const dy = b[j + 1] - y;
6412
+ const d = dx * dx + dy * dy;
6413
+ if (d < m) m = d;
6414
+ }
6415
+ if (m > lim2) return void 0;
6416
+ out.push(Math.sqrt(m));
6417
+ }
6418
+ }
6419
+ return out;
6420
+ }
6421
+ function pointsOf(svg) {
6422
+ const rootTag = /<svg\b[^>]*>/i.exec(svg)?.[0];
6423
+ if (!rootTag) return void 0;
6424
+ const root = attrs(rootTag);
6425
+ const vb = (root.viewBox ?? `0 0 ${parseFloat(root.width ?? "")} ${parseFloat(root.height ?? "")}`).split(/[\s,]+/).map(Number);
6426
+ const [vx, vy, vw, vh] = vb;
6427
+ if (vb.length !== 4 || !(vw > 0) || !(vh > 0)) return void 0;
6428
+ const size = Math.max(vw, vh);
6429
+ const body = svg.replace(/<(mask|clipPath|defs|title|desc)\b[\s\S]*?<\/\1>/gi, "");
6430
+ const polys = [];
6431
+ let stroked = false;
6432
+ let filled = false;
6433
+ for (const m of body.matchAll(/<(path|rect|circle|ellipse|line|polyline|polygon)\b([^>]*)>/gi)) {
6434
+ const a = attrs(m[2]);
6435
+ const fill = a.fill ?? root.fill ?? "black";
6436
+ const stroke = a.stroke ?? root.stroke ?? "none";
6437
+ if ((fill === "none" || fill === "transparent") && (stroke === "none" || stroke === "transparent")) continue;
6438
+ if (a.opacity === "0" || a.visibility === "hidden" || a.display === "none") continue;
6439
+ const lines = shapeLines(m[1].toLowerCase(), a);
6440
+ if (!lines) return void 0;
6441
+ const t = a.transform ? matrix(a.transform) : void 0;
6442
+ for (const l of lines) polys.push(t ? apply2(t, l) : l);
6443
+ if (stroke !== "none" && stroke !== "transparent") stroked = true;
6444
+ if (fill !== "none" && fill !== "transparent" && !/^(line|polyline)$/i.test(m[1])) filled = true;
6445
+ }
6446
+ const pts = [];
6447
+ let len = 0;
6448
+ for (const l of polys) for (let i = 2; i < l.length; i += 2) len += Math.hypot(l[i] - l[i - 2], l[i + 1] - l[i - 1]);
6449
+ if (!len) return void 0;
6450
+ const step = Math.max(STEP * size, len / MAX_POINTS);
6451
+ for (const l of polys) {
6452
+ pts.push(l[0], l[1]);
6453
+ let carry = 0;
6454
+ for (let i = 2; i < l.length; i += 2) {
6455
+ const x0 = l[i - 2], y0 = l[i - 1], x1 = l[i], y1 = l[i + 1];
6456
+ const seg = Math.hypot(x1 - x0, y1 - y0);
6457
+ let s = step - carry;
6458
+ for (; s <= seg; s += step) pts.push(x0 + (x1 - x0) * s / seg, y0 + (y1 - y0) * s / seg);
6459
+ carry = seg - (s - step);
6460
+ }
6461
+ if (carry > 0) pts.push(l[l.length - 2], l[l.length - 1]);
6462
+ }
6463
+ const xy = new Float64Array(pts.length);
6464
+ const box = [Infinity, Infinity, -Infinity, -Infinity];
6465
+ for (let i = 0; i < pts.length; i += 2) {
6466
+ const x = (pts[i] - vx) / size;
6467
+ const y = (pts[i + 1] - vy) / size;
6468
+ xy[i] = x;
6469
+ xy[i + 1] = y;
6470
+ box[0] = Math.min(box[0], x);
6471
+ box[1] = Math.min(box[1], y);
6472
+ box[2] = Math.max(box[2], x);
6473
+ box[3] = Math.max(box[3], y);
6474
+ }
6475
+ return { xy, box, kind: stroked && filled ? "mixed" : stroked ? "stroke" : "fill", len: len / size };
6476
+ }
6477
+ function attrs(tag) {
6478
+ const out = {};
6479
+ for (const m of tag.matchAll(/([\w:-]+)\s*=\s*("([^"]*)"|'([^']*)')/g)) out[m[1]] = m[3] ?? m[4] ?? "";
6480
+ for (const d of (out.style ?? "").split(";")) {
6481
+ const [k, v] = d.split(":").map((s) => s?.trim());
6482
+ if (k && v) out[k] = v;
6483
+ }
6484
+ return out;
6485
+ }
6486
+ function shapeLines(tag, a) {
6487
+ const f = (k) => parseFloat(a[k] ?? "0") || 0;
6488
+ switch (tag) {
6489
+ case "path":
6490
+ return a.d ? pathLines(a.d) : void 0;
6491
+ case "rect": {
6492
+ const x = f("x"), y = f("y"), w = f("width"), h = f("height");
6493
+ const r = Math.min(f("rx") || f("ry"), w / 2, h / 2);
6494
+ if (!r) return [[x, y, x + w, y, x + w, y + h, x, y + h, x, y]];
6495
+ return pathLines(`M${x + r} ${y}H${x + w - r}A${r} ${r} 0 0 1 ${x + w} ${y + r}V${y + h - r}A${r} ${r} 0 0 1 ${x + w - r} ${y + h}H${x + r}A${r} ${r} 0 0 1 ${x} ${y + h - r}V${y + r}A${r} ${r} 0 0 1 ${x + r} ${y}Z`);
6496
+ }
6497
+ case "circle":
6498
+ case "ellipse": {
6499
+ const cx = f("cx"), cy = f("cy");
6500
+ const rx = tag === "circle" ? f("r") : f("rx");
6501
+ const ry = tag === "circle" ? f("r") : f("ry");
6502
+ const l = [];
6503
+ for (let k = 0; k <= 48; k++) l.push(cx + rx * Math.cos(k / 48 * 2 * Math.PI), cy + ry * Math.sin(k / 48 * 2 * Math.PI));
6504
+ return [l];
6505
+ }
6506
+ case "line":
6507
+ return [[f("x1"), f("y1"), f("x2"), f("y2")]];
6508
+ default: {
6509
+ const pts = (a.points ?? "").trim().split(/[\s,]+/).map(Number);
6510
+ if (pts.length < 4 || pts.some(Number.isNaN)) return void 0;
6511
+ return [tag === "polygon" ? [...pts, pts[0], pts[1]] : pts];
6512
+ }
6513
+ }
6514
+ }
6515
+ function pathLines(d) {
6516
+ const NUM = /[\s,]*([-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/y;
6517
+ const FLAG = /[\s,]*([01])/y;
6518
+ const CMD = /[\s,]*([MmLlHhVvCcSsQqTtAaZz])/y;
6519
+ let i = 0;
6520
+ const read = (re) => {
6521
+ re.lastIndex = i;
6522
+ const m = re.exec(d);
6523
+ if (!m) return void 0;
6524
+ i = re.lastIndex;
6525
+ return m[1];
6526
+ };
6527
+ const out = [];
6528
+ let cur = [];
6529
+ let x = 0, y = 0, sx = 0, sy = 0;
6530
+ let cx = 0, cy = 0;
6531
+ let prev = "";
6532
+ let cmd = "";
6533
+ const num3 = () => {
6534
+ const t = read(NUM);
6535
+ if (t === void 0) throw new Error("bad path");
6536
+ return parseFloat(t);
6537
+ };
6538
+ const flag = () => {
6539
+ const t = read(FLAG);
6540
+ if (t === void 0) throw new Error("bad path");
6541
+ return Number(t);
6542
+ };
6543
+ const lineTo = (nx, ny) => {
6544
+ cur.push(nx, ny);
6545
+ x = nx;
6546
+ y = ny;
6547
+ };
6548
+ const curve = (pts) => {
6549
+ const n2 = pts.length / 2;
6550
+ for (let k = 1; k <= 12; k++) {
6551
+ const t = k / 12;
6552
+ const p = pts.slice();
6553
+ for (let r = n2 - 1; r > 0; r--) for (let j = 0; j < r; j++) {
6554
+ p[2 * j] = p[2 * j] + (p[2 * j + 2] - p[2 * j]) * t;
6555
+ p[2 * j + 1] = p[2 * j + 1] + (p[2 * j + 3] - p[2 * j + 1]) * t;
6556
+ }
6557
+ cur.push(p[0], p[1]);
6558
+ }
6559
+ x = pts[pts.length - 2];
6560
+ y = pts[pts.length - 1];
6561
+ };
6562
+ try {
6563
+ while (!/^[\s,]*$/.test(d.slice(i))) {
6564
+ const c = read(CMD);
6565
+ if (c) cmd = c;
6566
+ else if (!cmd || /z/i.test(cmd)) return void 0;
6567
+ const up = cmd.toUpperCase();
6568
+ const rel = cmd !== up;
6569
+ const ox = rel ? x : 0;
6570
+ const oy = rel ? y : 0;
6571
+ if (up === "Z") {
6572
+ if (cur.length) cur.push(sx, sy);
6573
+ x = sx;
6574
+ y = sy;
6575
+ prev = "Z";
6576
+ continue;
6577
+ }
6578
+ if (ARGS[up] === void 0) return void 0;
6579
+ if (up === "M") {
6580
+ if (cur.length > 2) out.push(cur);
6581
+ x = num3() + ox;
6582
+ y = num3() + oy;
6583
+ sx = x;
6584
+ sy = y;
6585
+ cur = [x, y];
6586
+ cmd = rel ? "l" : "L";
6587
+ } else if (up === "L") lineTo(num3() + ox, num3() + oy);
6588
+ else if (up === "H") lineTo(num3() + ox, y);
6589
+ else if (up === "V") lineTo(x, num3() + oy);
6590
+ else if (up === "C") {
6591
+ const p = [num3() + ox, num3() + oy, num3() + ox, num3() + oy, num3() + ox, num3() + oy];
6592
+ curve([x, y, ...p]);
6593
+ cx = p[2];
6594
+ cy = p[3];
6595
+ } else if (up === "S") {
6596
+ const [rx, ry] = /[CS]/.test(prev) ? [2 * x - cx, 2 * y - cy] : [x, y];
6597
+ const p = [num3() + ox, num3() + oy, num3() + ox, num3() + oy];
6598
+ curve([x, y, rx, ry, ...p]);
6599
+ cx = p[0];
6600
+ cy = p[1];
6601
+ } else if (up === "Q") {
6602
+ const p = [num3() + ox, num3() + oy, num3() + ox, num3() + oy];
6603
+ curve([x, y, ...p]);
6604
+ cx = p[0];
6605
+ cy = p[1];
6606
+ } else if (up === "T") {
6607
+ const [rx, ry] = /[QT]/.test(prev) ? [2 * x - cx, 2 * y - cy] : [x, y];
6608
+ curve([x, y, rx, ry, num3() + ox, num3() + oy]);
6609
+ cx = rx;
6610
+ cy = ry;
6611
+ } else if (up === "A") {
6612
+ const rx = num3(), ry = num3(), rot = num3(), large = flag(), sweep = flag();
6613
+ arc(x, y, rx, ry, rot, large, sweep, num3() + ox, num3() + oy, lineTo);
6614
+ }
6615
+ prev = up;
6616
+ }
6617
+ } catch {
6618
+ return void 0;
6619
+ }
6620
+ if (cur.length > 2) out.push(cur);
6621
+ return out;
6622
+ }
6623
+ function arc(x1, y1, rx, ry, rotDeg, large, sweep, x2, y2, lineTo) {
6624
+ rx = Math.abs(rx);
6625
+ ry = Math.abs(ry);
6626
+ if (!rx || !ry || x1 === x2 && y1 === y2) return lineTo(x2, y2);
6627
+ const phi = rotDeg * Math.PI / 180;
6628
+ const cos = Math.cos(phi), sin = Math.sin(phi);
6629
+ const dx = (x1 - x2) / 2, dy = (y1 - y2) / 2;
6630
+ const x1p = cos * dx + sin * dy, y1p = -sin * dx + cos * dy;
6631
+ const lambda = x1p * x1p / (rx * rx) + y1p * y1p / (ry * ry);
6632
+ if (lambda > 1) {
6633
+ rx *= Math.sqrt(lambda);
6634
+ ry *= Math.sqrt(lambda);
6635
+ }
6636
+ const num3 = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
6637
+ const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
6638
+ let k = Math.sqrt(Math.max(0, num3 / den));
6639
+ if (large === sweep) k = -k;
6640
+ const cxp = k * rx * y1p / ry, cyp = -k * ry * x1p / rx;
6641
+ const cx = cos * cxp - sin * cyp + (x1 + x2) / 2;
6642
+ const cy = sin * cxp + cos * cyp + (y1 + y2) / 2;
6643
+ const ang = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
6644
+ const t1 = ang(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);
6645
+ let dt = ang((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);
6646
+ if (!sweep && dt > 0) dt -= 2 * Math.PI;
6647
+ else if (sweep && dt < 0) dt += 2 * Math.PI;
6648
+ const n2 = Math.max(4, Math.ceil(Math.abs(dt) / (Math.PI / 12)));
6649
+ for (let s = 1; s <= n2; s++) {
6650
+ const t = t1 + dt * s / n2;
6651
+ const ex = rx * Math.cos(t), ey = ry * Math.sin(t);
6652
+ lineTo(cos * ex - sin * ey + cx, sin * ex + cos * ey + cy);
6653
+ }
6654
+ }
6655
+ function matrix(t) {
6656
+ let m = [1, 0, 0, 1, 0, 0];
6657
+ const mul = (a, b) => [
6658
+ a[0] * b[0] + a[2] * b[1],
6659
+ a[1] * b[0] + a[3] * b[1],
6660
+ a[0] * b[2] + a[2] * b[3],
6661
+ a[1] * b[2] + a[3] * b[3],
6662
+ a[0] * b[4] + a[2] * b[5] + a[4],
6663
+ a[1] * b[4] + a[3] * b[5] + a[5]
6664
+ ];
6665
+ for (const f of t.matchAll(/(matrix|translate|scale|rotate)\s*\(([^)]*)\)/g)) {
6666
+ const v = f[2].split(/[\s,]+/).filter(Boolean).map(Number);
6667
+ let n2;
6668
+ if (f[1] === "matrix") n2 = v;
6669
+ else if (f[1] === "translate") n2 = [1, 0, 0, 1, v[0] ?? 0, v[1] ?? 0];
6670
+ else if (f[1] === "scale") n2 = [v[0] ?? 1, 0, 0, v[1] ?? v[0] ?? 1, 0, 0];
6671
+ else {
6672
+ const r = (v[0] ?? 0) * Math.PI / 180;
6673
+ const [c, s, px2, py] = [Math.cos(r), Math.sin(r), v[1] ?? 0, v[2] ?? 0];
6674
+ n2 = [c, s, -s, c, px2 - c * px2 + s * py, py - s * px2 - c * py];
6675
+ }
6676
+ m = mul(m, n2);
6677
+ }
6678
+ return m;
6679
+ }
6680
+ function apply2(m, l) {
6681
+ const out = [];
6682
+ for (let i = 0; i < l.length; i += 2) out.push(m[0] * l[i] + m[2] * l[i + 1] + m[4], m[1] * l[i] + m[3] * l[i + 1] + m[5]);
6683
+ return out;
6684
+ }
6685
+ var pascal, HERO_SETS, kebab, plainSvg, ICON_PACKAGES, fits, MAX_OFFSET, SAME_KIND_OFFSET, SPREAD, MIN_OUTLINE_RATIO, STEP, MAX_POINTS, ARGS;
6686
+ var init_icons = __esm({
6687
+ "src/tools/icons.ts"() {
6688
+ "use strict";
6689
+ pascal = (s) => s.replace(/(^|[-_])([a-z0-9])/g, (_, __, c) => c.toUpperCase());
6690
+ HERO_SETS = [
6691
+ { dir: "24/outline", suffix: "", stroke: true },
6692
+ { dir: "24/solid", suffix: "-solid", stroke: false },
6693
+ { dir: "20/solid", suffix: "-mini", stroke: false },
6694
+ { dir: "16/solid", suffix: "-micro", stroke: false }
6695
+ ];
6696
+ kebab = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
6697
+ plainSvg = (svg) => svg.replace(/\{\.\.\.[^{}]*\}/g, "").replace(/([\w:-]+)=\{[^{}]*\}/g, '$1="currentColor"');
6698
+ ICON_PACKAGES = ["lucide-react", "lucide-vue-next", "@heroicons/react", "heroicons", "lucide-static", "react-icons"];
6699
+ fits = /* @__PURE__ */ new WeakMap();
6700
+ MAX_OFFSET = 0.09;
6701
+ SAME_KIND_OFFSET = 0.02;
6702
+ SPREAD = 0.025;
6703
+ MIN_OUTLINE_RATIO = 1.3;
6704
+ STEP = 0.02;
6705
+ MAX_POINTS = 240;
6706
+ ARGS = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };
6707
+ }
6708
+ });
6709
+
6710
+ // src/tools/code-components.ts
6711
+ function values(list, def) {
6712
+ const shown = list.slice(0, MAX_VALUES).map((v) => v === def ? `${v}*` : v);
6713
+ return shown.join("|") + (list.length > MAX_VALUES ? "|\u2026" : "");
6714
+ }
6715
+ function closing(src, open2) {
6716
+ let depth = 0;
6717
+ for (let i = open2; i < src.length; i++) {
6718
+ const c = src[i];
6719
+ if (c === '"' || c === "'" || c === "`") {
6720
+ for (i++; i < src.length && src[i] !== c; i++) if (src[i] === "\\") i++;
6721
+ } else if (c === "/" && src[i + 1] === "/") i = src.indexOf("\n", i) < 0 ? src.length : src.indexOf("\n", i);
6722
+ else if (c === "/" && src[i + 1] === "*") i = src.indexOf("*/", i) < 0 ? src.length : src.indexOf("*/", i) + 1;
6723
+ else if (c === "{") depth++;
6724
+ else if (c === "}" && --depth === 0) return i + 1;
6725
+ }
6726
+ return src.length;
6727
+ }
6728
+ function keys(src, open2) {
6729
+ const end = closing(src, open2);
6730
+ const out = [];
6731
+ let i = open2 + 1;
6732
+ while (i < end - 1) {
6733
+ const m = /^\s*(?:(["'])([^"']*)\1|([\w$-]+))\s*:\s*/.exec(src.slice(i, end));
6734
+ if (!m) break;
6735
+ out.push({ key: m[2] ?? m[3], at: i + m[0].length });
6736
+ let j = i + m[0].length;
6737
+ for (; j < end - 1; j++) {
6738
+ const c = src[j];
6739
+ if (c === "{" || c === "[" || c === "(") {
6740
+ const close = c === "{" ? "}" : c === "[" ? "]" : ")";
6741
+ let d = 0;
6742
+ for (; j < end; j++) {
6743
+ const x = src[j];
6744
+ if (x === '"' || x === "'" || x === "`") {
6745
+ for (j++; j < end && src[j] !== x; j++) if (src[j] === "\\") j++;
6746
+ } else if (x === c) d++;
6747
+ else if (x === close && --d === 0) break;
6748
+ }
6749
+ } else if (c === '"' || c === "'" || c === "`") {
6750
+ for (j++; j < end && src[j] !== c; j++) if (src[j] === "\\") j++;
6751
+ } else if (c === ",") break;
6752
+ }
6753
+ i = j + 1;
6754
+ }
6755
+ return out;
6756
+ }
6757
+ function variantCalls(src) {
6758
+ const out = /* @__PURE__ */ new Map();
6759
+ for (const m of src.matchAll(/(?:const|let)\s+(\w+)\s*=\s*(?:cva|tv)\s*\(/g)) {
6760
+ const v = /\bvariants\s*:\s*\{/.exec(src.slice(m.index));
6761
+ if (!v) continue;
6762
+ const open2 = m.index + v.index + v[0].length - 1;
6763
+ const defaults = /* @__PURE__ */ new Map();
6764
+ const dv = /\bdefaultVariants\s*:\s*\{/.exec(src.slice(m.index));
6765
+ if (dv) {
6766
+ const at = m.index + dv.index + dv[0].length - 1;
6767
+ for (const k of keys(src, at)) {
6768
+ const val = /^\s*(["'])([^"']*)\1/.exec(src.slice(k.at))?.[2] ?? /^\s*(true|false)\b/.exec(src.slice(k.at))?.[1];
6769
+ if (val) defaults.set(k.key, val);
6770
+ }
6771
+ }
6772
+ const props = [];
6773
+ for (const k of keys(src, open2)) {
6774
+ if (src[k.at] !== "{") continue;
6775
+ const opts = keys(src, k.at).map((o) => o.key);
6776
+ if (!opts.length) continue;
6777
+ props.push(opts.every((o) => o === "true" || o === "false") ? k.key : `${k.key}="${values(opts, defaults.get(k.key))}"`);
6778
+ }
6779
+ if (props.length) out.set(m[1], props);
6780
+ }
6781
+ return out;
6782
+ }
6783
+ function reactComponents(src) {
6784
+ const exported = /* @__PURE__ */ new Set();
6785
+ for (const m of src.matchAll(/export\s+(?:default\s+)?(?:async\s+)?(?:function|const|let|class)\s+([A-Z]\w*)/g)) exported.add(m[1]);
6786
+ for (const m of src.matchAll(/export\s*\{([^}]*)\}/g)) {
6787
+ for (const part of m[1].split(",")) {
6788
+ const name = part.trim().split(/\s+as\s+/)[0].trim();
6789
+ if (/^[A-Z]\w*$/.test(name)) exported.add(name);
6790
+ }
6791
+ }
6792
+ const defined = [];
6793
+ for (const m of src.matchAll(/(?:^|\n)\s*(?:export\s+)?(?:default\s+)?(?:function\s+([A-Z]\w*)\s*[(<]|(?:const|let)\s+([A-Z]\w*)\s*(?::[^=]+)?=\s*(?:React\.)?(?:forwardRef|memo|\(|function|<))/g)) {
6794
+ const name = m[1] ?? m[2];
6795
+ if (exported.has(name)) defined.push({ name, at: m.index });
6796
+ }
6797
+ if (!defined.length) return [];
6798
+ const calls = variantCalls(src);
6799
+ const unions = [];
6800
+ for (const m of src.matchAll(/\b(\w+)\??\s*:\s*((?:["'][\w-]+["']\s*\|\s*)+["'][\w-]+["'])/g)) {
6801
+ const opts = [...m[2].matchAll(/["']([\w-]+)["']/g)].map((x) => x[1]);
6802
+ unions.push(`${m[1]}="${values(opts)}"`);
6803
+ }
6804
+ return defined.map(({ name, at }, i) => {
6805
+ const body = src.slice(at, defined[i + 1]?.at ?? src.length);
6806
+ const props = [...calls].filter(([fn]) => new RegExp(`\\b${fn}\\s*\\(`).test(body)).flatMap(([, p]) => p);
6807
+ if (!props.length && defined.length === 1) props.push(...unions);
6808
+ return { name, api: `<${name}${props.length ? ` ${[...new Set(props)].join(" ")}` : ""}>` };
6809
+ });
6810
+ }
6811
+ function elixirList(v) {
6812
+ const w = /^~w[([{<]([^)\]}>]*)[)\]}>]/.exec(v);
6813
+ if (w) return w[1].trim().split(/\s+/).filter(Boolean);
6814
+ const l = /^\[([^\]]*)\]/.exec(v);
6815
+ if (!l) return void 0;
6816
+ const out = [...l[1].matchAll(/(?:"([^"]*)"|:(\w+))/g)].map((m) => m[1] ?? m[2]);
6817
+ return out.length ? out : void 0;
6818
+ }
6819
+ function phoenixComponents(src) {
6820
+ const attrs3 = /* @__PURE__ */ new Map();
6821
+ for (const m of src.matchAll(/^\s*@(\w+)\s+(.+)$/gm)) {
6822
+ const list = elixirList(m[2].trim());
6823
+ if (list) attrs3.set(m[1], list);
6824
+ else if (m[2].trim().startsWith("%{")) {
6825
+ const ks = [...m[2].matchAll(/(?:^%\{|,)\s*(?:(\w+):|"([^"]+)"\s*=>|:(\w+)\s*=>)/g)].map((k) => k[1] ?? k[2] ?? k[3]);
6826
+ if (ks.length) attrs3.set(m[1], ks);
6827
+ }
6828
+ }
6829
+ const resolve = (v) => {
6830
+ v = v.trim();
6831
+ const direct = elixirList(v);
6832
+ if (direct) return direct.filter((x) => x !== "nil");
6833
+ const a = /^(?:Map\.keys\()?@(\w+)\)?/.exec(v);
6834
+ if (a) return attrs3.get(a[1]);
6835
+ const withNil = /^\[nil\s*\|\s*(.+)\]$/.exec(v);
6836
+ return withNil ? resolve(withNil[1]) : void 0;
6837
+ };
6838
+ const out = [];
6839
+ let props = [];
6840
+ let slots = [];
6841
+ let any2 = false;
6842
+ const joined = src.replace(/([,[(])[ \t]*\r?\n\s*/g, (_, c) => c === "," ? ", " : c).replace(/\r?\n\s*(?=[\])])/g, "");
6843
+ for (const line of joined.split("\n")) {
6844
+ const a = /^\s*attr\s+:(\w+)\s*,\s*:(\w+)(.*)$/.exec(line);
6845
+ if (a) {
6846
+ any2 = true;
6847
+ const [, name, type, rest] = a;
6848
+ const vals = /\bvalues:\s*(.+?)(?:,\s*\w+:|\s*$)/.exec(rest)?.[1];
6849
+ const def = /\bdefault:\s*(?:"([^"]*)"|:(\w+))/.exec(rest);
6850
+ const list = vals ? resolve(vals) : void 0;
6851
+ if (list?.length) props.push(`${name}="${values(list, def?.[1] ?? def?.[2])}"`);
6852
+ else if (type === "boolean") props.push(name);
6853
+ continue;
6854
+ }
6855
+ const s = /^\s*slot\s+:(\w+)/.exec(line);
6856
+ if (s) {
6857
+ any2 = true;
6858
+ if (s[1] !== "inner_block") slots.push(`<:${s[1]}>`);
6859
+ continue;
6860
+ }
6861
+ const d = /^\s*(defp?)\s+(\w+)\s*\(/.exec(line);
6862
+ if (d) {
6863
+ if (d[1] === "def" && any2 && !out.some((c) => c.name === d[2])) {
6864
+ out.push({ name: d[2], api: [`<.${d[2]}${props.length ? ` ${props.join(" ")}` : ""}>`, ...slots].join(" ") });
6865
+ }
6866
+ if (d[1] === "defp" || any2) {
6867
+ props = [];
6868
+ slots = [];
6869
+ any2 = false;
6870
+ }
6871
+ }
6872
+ }
6873
+ return out;
6874
+ }
6875
+ var MAX_VALUES;
6876
+ var init_code_components = __esm({
6877
+ "src/tools/code-components.ts"() {
6878
+ "use strict";
6879
+ MAX_VALUES = 8;
6880
+ }
6881
+ });
6882
+
6883
+ // src/tools/tailwind-v3-theme.ts
6884
+ var TAILWIND_V3_THEME;
6885
+ var init_tailwind_v3_theme = __esm({
6886
+ "src/tools/tailwind-v3-theme.ts"() {
6887
+ "use strict";
6888
+ TAILWIND_V3_THEME = {
6889
+ "--color-black": "#000",
6890
+ "--color-white": "#fff",
6891
+ "--color-slate-50": "#f8fafc",
6892
+ "--color-slate-100": "#f1f5f9",
6893
+ "--color-slate-200": "#e2e8f0",
6894
+ "--color-slate-300": "#cbd5e1",
6895
+ "--color-slate-400": "#94a3b8",
6896
+ "--color-slate-500": "#64748b",
6897
+ "--color-slate-600": "#475569",
6898
+ "--color-slate-700": "#334155",
6899
+ "--color-slate-800": "#1e293b",
6900
+ "--color-slate-900": "#0f172a",
6901
+ "--color-slate-950": "#020617",
6902
+ "--color-gray-50": "#f9fafb",
6903
+ "--color-gray-100": "#f3f4f6",
6904
+ "--color-gray-200": "#e5e7eb",
6905
+ "--color-gray-300": "#d1d5db",
6906
+ "--color-gray-400": "#9ca3af",
6907
+ "--color-gray-500": "#6b7280",
6908
+ "--color-gray-600": "#4b5563",
6909
+ "--color-gray-700": "#374151",
6910
+ "--color-gray-800": "#1f2937",
6911
+ "--color-gray-900": "#111827",
6912
+ "--color-gray-950": "#030712",
6913
+ "--color-zinc-50": "#fafafa",
6914
+ "--color-zinc-100": "#f4f4f5",
6915
+ "--color-zinc-200": "#e4e4e7",
6916
+ "--color-zinc-300": "#d4d4d8",
6917
+ "--color-zinc-400": "#a1a1aa",
6918
+ "--color-zinc-500": "#71717a",
6919
+ "--color-zinc-600": "#52525b",
6920
+ "--color-zinc-700": "#3f3f46",
6921
+ "--color-zinc-800": "#27272a",
6922
+ "--color-zinc-900": "#18181b",
6923
+ "--color-zinc-950": "#09090b",
6924
+ "--color-neutral-50": "#fafafa",
6925
+ "--color-neutral-100": "#f5f5f5",
6926
+ "--color-neutral-200": "#e5e5e5",
6927
+ "--color-neutral-300": "#d4d4d4",
6928
+ "--color-neutral-400": "#a3a3a3",
6929
+ "--color-neutral-500": "#737373",
6930
+ "--color-neutral-600": "#525252",
6931
+ "--color-neutral-700": "#404040",
6932
+ "--color-neutral-800": "#262626",
6933
+ "--color-neutral-900": "#171717",
6934
+ "--color-neutral-950": "#0a0a0a",
6935
+ "--color-stone-50": "#fafaf9",
6936
+ "--color-stone-100": "#f5f5f4",
6937
+ "--color-stone-200": "#e7e5e4",
6938
+ "--color-stone-300": "#d6d3d1",
6939
+ "--color-stone-400": "#a8a29e",
6940
+ "--color-stone-500": "#78716c",
6941
+ "--color-stone-600": "#57534e",
6942
+ "--color-stone-700": "#44403c",
6943
+ "--color-stone-800": "#292524",
6944
+ "--color-stone-900": "#1c1917",
6945
+ "--color-stone-950": "#0c0a09",
6946
+ "--color-red-50": "#fef2f2",
6947
+ "--color-red-100": "#fee2e2",
6948
+ "--color-red-200": "#fecaca",
6949
+ "--color-red-300": "#fca5a5",
6950
+ "--color-red-400": "#f87171",
6951
+ "--color-red-500": "#ef4444",
6952
+ "--color-red-600": "#dc2626",
6953
+ "--color-red-700": "#b91c1c",
6954
+ "--color-red-800": "#991b1b",
6955
+ "--color-red-900": "#7f1d1d",
6956
+ "--color-red-950": "#450a0a",
6957
+ "--color-orange-50": "#fff7ed",
6958
+ "--color-orange-100": "#ffedd5",
6959
+ "--color-orange-200": "#fed7aa",
6960
+ "--color-orange-300": "#fdba74",
6961
+ "--color-orange-400": "#fb923c",
6962
+ "--color-orange-500": "#f97316",
6963
+ "--color-orange-600": "#ea580c",
6964
+ "--color-orange-700": "#c2410c",
6965
+ "--color-orange-800": "#9a3412",
6966
+ "--color-orange-900": "#7c2d12",
6967
+ "--color-orange-950": "#431407",
6968
+ "--color-amber-50": "#fffbeb",
6969
+ "--color-amber-100": "#fef3c7",
6970
+ "--color-amber-200": "#fde68a",
6971
+ "--color-amber-300": "#fcd34d",
6972
+ "--color-amber-400": "#fbbf24",
6973
+ "--color-amber-500": "#f59e0b",
6974
+ "--color-amber-600": "#d97706",
6975
+ "--color-amber-700": "#b45309",
6976
+ "--color-amber-800": "#92400e",
6977
+ "--color-amber-900": "#78350f",
6978
+ "--color-amber-950": "#451a03",
6979
+ "--color-yellow-50": "#fefce8",
6980
+ "--color-yellow-100": "#fef9c3",
6981
+ "--color-yellow-200": "#fef08a",
6982
+ "--color-yellow-300": "#fde047",
6983
+ "--color-yellow-400": "#facc15",
6984
+ "--color-yellow-500": "#eab308",
6985
+ "--color-yellow-600": "#ca8a04",
6986
+ "--color-yellow-700": "#a16207",
6987
+ "--color-yellow-800": "#854d0e",
6988
+ "--color-yellow-900": "#713f12",
6989
+ "--color-yellow-950": "#422006",
6990
+ "--color-lime-50": "#f7fee7",
6991
+ "--color-lime-100": "#ecfccb",
6992
+ "--color-lime-200": "#d9f99d",
6993
+ "--color-lime-300": "#bef264",
6994
+ "--color-lime-400": "#a3e635",
6995
+ "--color-lime-500": "#84cc16",
6996
+ "--color-lime-600": "#65a30d",
6997
+ "--color-lime-700": "#4d7c0f",
6998
+ "--color-lime-800": "#3f6212",
6999
+ "--color-lime-900": "#365314",
7000
+ "--color-lime-950": "#1a2e05",
7001
+ "--color-green-50": "#f0fdf4",
7002
+ "--color-green-100": "#dcfce7",
7003
+ "--color-green-200": "#bbf7d0",
7004
+ "--color-green-300": "#86efac",
7005
+ "--color-green-400": "#4ade80",
7006
+ "--color-green-500": "#22c55e",
7007
+ "--color-green-600": "#16a34a",
7008
+ "--color-green-700": "#15803d",
7009
+ "--color-green-800": "#166534",
7010
+ "--color-green-900": "#14532d",
7011
+ "--color-green-950": "#052e16",
7012
+ "--color-emerald-50": "#ecfdf5",
7013
+ "--color-emerald-100": "#d1fae5",
7014
+ "--color-emerald-200": "#a7f3d0",
7015
+ "--color-emerald-300": "#6ee7b7",
7016
+ "--color-emerald-400": "#34d399",
7017
+ "--color-emerald-500": "#10b981",
7018
+ "--color-emerald-600": "#059669",
7019
+ "--color-emerald-700": "#047857",
7020
+ "--color-emerald-800": "#065f46",
7021
+ "--color-emerald-900": "#064e3b",
7022
+ "--color-emerald-950": "#022c22",
7023
+ "--color-teal-50": "#f0fdfa",
7024
+ "--color-teal-100": "#ccfbf1",
7025
+ "--color-teal-200": "#99f6e4",
7026
+ "--color-teal-300": "#5eead4",
7027
+ "--color-teal-400": "#2dd4bf",
7028
+ "--color-teal-500": "#14b8a6",
7029
+ "--color-teal-600": "#0d9488",
7030
+ "--color-teal-700": "#0f766e",
7031
+ "--color-teal-800": "#115e59",
7032
+ "--color-teal-900": "#134e4a",
7033
+ "--color-teal-950": "#042f2e",
7034
+ "--color-cyan-50": "#ecfeff",
7035
+ "--color-cyan-100": "#cffafe",
7036
+ "--color-cyan-200": "#a5f3fc",
7037
+ "--color-cyan-300": "#67e8f9",
7038
+ "--color-cyan-400": "#22d3ee",
7039
+ "--color-cyan-500": "#06b6d4",
7040
+ "--color-cyan-600": "#0891b2",
7041
+ "--color-cyan-700": "#0e7490",
7042
+ "--color-cyan-800": "#155e75",
7043
+ "--color-cyan-900": "#164e63",
7044
+ "--color-cyan-950": "#083344",
7045
+ "--color-sky-50": "#f0f9ff",
7046
+ "--color-sky-100": "#e0f2fe",
7047
+ "--color-sky-200": "#bae6fd",
7048
+ "--color-sky-300": "#7dd3fc",
7049
+ "--color-sky-400": "#38bdf8",
7050
+ "--color-sky-500": "#0ea5e9",
7051
+ "--color-sky-600": "#0284c7",
7052
+ "--color-sky-700": "#0369a1",
7053
+ "--color-sky-800": "#075985",
7054
+ "--color-sky-900": "#0c4a6e",
7055
+ "--color-sky-950": "#082f49",
7056
+ "--color-blue-50": "#eff6ff",
7057
+ "--color-blue-100": "#dbeafe",
7058
+ "--color-blue-200": "#bfdbfe",
7059
+ "--color-blue-300": "#93c5fd",
7060
+ "--color-blue-400": "#60a5fa",
7061
+ "--color-blue-500": "#3b82f6",
7062
+ "--color-blue-600": "#2563eb",
7063
+ "--color-blue-700": "#1d4ed8",
7064
+ "--color-blue-800": "#1e40af",
7065
+ "--color-blue-900": "#1e3a8a",
7066
+ "--color-blue-950": "#172554",
7067
+ "--color-indigo-50": "#eef2ff",
7068
+ "--color-indigo-100": "#e0e7ff",
7069
+ "--color-indigo-200": "#c7d2fe",
7070
+ "--color-indigo-300": "#a5b4fc",
7071
+ "--color-indigo-400": "#818cf8",
7072
+ "--color-indigo-500": "#6366f1",
7073
+ "--color-indigo-600": "#4f46e5",
7074
+ "--color-indigo-700": "#4338ca",
7075
+ "--color-indigo-800": "#3730a3",
7076
+ "--color-indigo-900": "#312e81",
7077
+ "--color-indigo-950": "#1e1b4b",
7078
+ "--color-violet-50": "#f5f3ff",
7079
+ "--color-violet-100": "#ede9fe",
7080
+ "--color-violet-200": "#ddd6fe",
7081
+ "--color-violet-300": "#c4b5fd",
7082
+ "--color-violet-400": "#a78bfa",
7083
+ "--color-violet-500": "#8b5cf6",
7084
+ "--color-violet-600": "#7c3aed",
7085
+ "--color-violet-700": "#6d28d9",
7086
+ "--color-violet-800": "#5b21b6",
7087
+ "--color-violet-900": "#4c1d95",
7088
+ "--color-violet-950": "#2e1065",
7089
+ "--color-purple-50": "#faf5ff",
7090
+ "--color-purple-100": "#f3e8ff",
7091
+ "--color-purple-200": "#e9d5ff",
7092
+ "--color-purple-300": "#d8b4fe",
7093
+ "--color-purple-400": "#c084fc",
7094
+ "--color-purple-500": "#a855f7",
7095
+ "--color-purple-600": "#9333ea",
7096
+ "--color-purple-700": "#7e22ce",
7097
+ "--color-purple-800": "#6b21a8",
7098
+ "--color-purple-900": "#581c87",
7099
+ "--color-purple-950": "#3b0764",
7100
+ "--color-fuchsia-50": "#fdf4ff",
7101
+ "--color-fuchsia-100": "#fae8ff",
7102
+ "--color-fuchsia-200": "#f5d0fe",
7103
+ "--color-fuchsia-300": "#f0abfc",
7104
+ "--color-fuchsia-400": "#e879f9",
7105
+ "--color-fuchsia-500": "#d946ef",
7106
+ "--color-fuchsia-600": "#c026d3",
7107
+ "--color-fuchsia-700": "#a21caf",
7108
+ "--color-fuchsia-800": "#86198f",
7109
+ "--color-fuchsia-900": "#701a75",
7110
+ "--color-fuchsia-950": "#4a044e",
7111
+ "--color-pink-50": "#fdf2f8",
7112
+ "--color-pink-100": "#fce7f3",
7113
+ "--color-pink-200": "#fbcfe8",
7114
+ "--color-pink-300": "#f9a8d4",
7115
+ "--color-pink-400": "#f472b6",
7116
+ "--color-pink-500": "#ec4899",
7117
+ "--color-pink-600": "#db2777",
7118
+ "--color-pink-700": "#be185d",
7119
+ "--color-pink-800": "#9d174d",
7120
+ "--color-pink-900": "#831843",
7121
+ "--color-pink-950": "#500724",
7122
+ "--color-rose-50": "#fff1f2",
7123
+ "--color-rose-100": "#ffe4e6",
7124
+ "--color-rose-200": "#fecdd3",
7125
+ "--color-rose-300": "#fda4af",
7126
+ "--color-rose-400": "#fb7185",
7127
+ "--color-rose-500": "#f43f5e",
7128
+ "--color-rose-600": "#e11d48",
7129
+ "--color-rose-700": "#be123c",
7130
+ "--color-rose-800": "#9f1239",
7131
+ "--color-rose-900": "#881337",
7132
+ "--color-rose-950": "#4c0519",
7133
+ "--text-xs": "0.75rem",
7134
+ "--text-xs--line-height": "1rem",
7135
+ "--text-sm": "0.875rem",
7136
+ "--text-sm--line-height": "1.25rem",
7137
+ "--text-base": "1rem",
7138
+ "--text-base--line-height": "1.5rem",
7139
+ "--text-lg": "1.125rem",
7140
+ "--text-lg--line-height": "1.75rem",
7141
+ "--text-xl": "1.25rem",
7142
+ "--text-xl--line-height": "1.75rem",
7143
+ "--text-2xl": "1.5rem",
7144
+ "--text-2xl--line-height": "2rem",
7145
+ "--text-3xl": "1.875rem",
7146
+ "--text-3xl--line-height": "2.25rem",
7147
+ "--text-4xl": "2.25rem",
7148
+ "--text-4xl--line-height": "2.5rem",
7149
+ "--text-5xl": "3rem",
7150
+ "--text-5xl--line-height": "1",
7151
+ "--text-6xl": "3.75rem",
7152
+ "--text-6xl--line-height": "1",
7153
+ "--text-7xl": "4.5rem",
7154
+ "--text-7xl--line-height": "1",
7155
+ "--text-8xl": "6rem",
7156
+ "--text-8xl--line-height": "1",
7157
+ "--text-9xl": "8rem",
7158
+ "--text-9xl--line-height": "1",
7159
+ "--font-weight-thin": "100",
7160
+ "--font-weight-extralight": "200",
7161
+ "--font-weight-light": "300",
7162
+ "--font-weight-normal": "400",
7163
+ "--font-weight-medium": "500",
7164
+ "--font-weight-semibold": "600",
7165
+ "--font-weight-bold": "700",
7166
+ "--font-weight-extrabold": "800",
7167
+ "--font-weight-black": "900",
7168
+ "--tracking-tighter": "-0.05em",
7169
+ "--tracking-tight": "-0.025em",
7170
+ "--tracking-normal": "0em",
7171
+ "--tracking-wide": "0.025em",
7172
+ "--tracking-wider": "0.05em",
7173
+ "--tracking-widest": "0.1em",
7174
+ "--font-sans": 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
7175
+ "--font-serif": 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
7176
+ "--font-mono": 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
7177
+ };
7178
+ }
7179
+ });
7180
+
7181
+ // src/tools/tailwind-config.ts
7182
+ function configObject(src) {
7183
+ const anchor2 = /(?:module\.exports\s*=|export\s+default)\s*/.exec(src);
7184
+ if (!anchor2) return void 0;
7185
+ let i = anchor2.index + anchor2[0].length;
7186
+ const wrapper = /^[\w$.]+\s*\(\s*/.exec(src.slice(i));
7187
+ if (wrapper) i += wrapper[0].length;
7188
+ if (src[i] === "{") return parseAt(src, i);
7189
+ const name = /^[\w$]+/.exec(src.slice(i))?.[0];
7190
+ const decl = name && new RegExp(`(?:const|let|var)\\s+${name}\\s*(?::[^=\\n]+)?=\\s*(?:[\\w$.]+\\s*\\(\\s*)?\\{`).exec(src);
7191
+ return decl ? parseAt(src, decl.index + decl[0].length - 1) : void 0;
7192
+ }
7193
+ function localObject(src, name) {
7194
+ const m = new RegExp(`(?:const|let|var)\\s+${name}\\s*(?::[^=\\n]+)?=\\s*\\{`).exec(src);
7195
+ return m ? parseAt(src, m.index + m[0].length - 1) : void 0;
7196
+ }
7197
+ function paletteNames(src) {
7198
+ const names = /* @__PURE__ */ new Set();
7199
+ for (const m of src.matchAll(/(?:(?:const|let|var)\s+([\w$]+)\s*=\s*require\(|import\s+([\w$]+)\s+from\s+)\s*["']tailwindcss\/colors(?:\.js)?["']/g)) names.add(m[1] ?? m[2]);
7200
+ return names;
7201
+ }
7202
+ function replacedBy(name, replaced) {
7203
+ return [...replaced].some((p) => name.startsWith(p) && !(p === "--font-" && name.startsWith("--font-weight-")));
7204
+ }
7205
+ function tailwindV3Defaults(replaced) {
7206
+ return Object.entries(TAILWIND_V3_THEME).filter(([k]) => !replacedBy(k, replaced));
7207
+ }
7208
+ function tailwindConfigTheme(src, channel) {
7209
+ const out = { vars: [], replaced: /* @__PURE__ */ new Set() };
7210
+ const root = configObject(src);
7211
+ const theme = get(root, "theme");
7212
+ if (theme?.t !== "obj") return out;
7213
+ const palettes = paletteNames(src);
7214
+ const colorValue = (v) => {
7215
+ const fn = /^(hsl|rgb)a?\(\s*var\(\s*(--[\w-]+)\s*\)\s*(?:\/\s*([^)]*))?\)$/i.exec(v.trim());
7216
+ if (fn) {
7217
+ const ch = channel(fn[2]);
7218
+ if (!ch) return void 0;
7219
+ if (/^(hsl|rgb)a?\(/i.test(ch)) return ch;
7220
+ const alpha = fn[3]?.trim();
7221
+ return `${fn[1].toLowerCase()}(${ch}${alpha && !alpha.includes("<alpha-value>") ? ` / ${alpha}` : ""})`;
7222
+ }
7223
+ const plain = /^var\(\s*(--[\w-]+)\s*\)$/.exec(v.trim());
7224
+ return plain ? channel(plain[1]) : v;
7225
+ };
7226
+ const colors = (prefix, n2, depth = 0) => {
7227
+ if (depth > 6) return;
7228
+ if (n2.t === "str") {
7229
+ const v = colorValue(n2.v);
7230
+ if (v) out.vars.push([prefix, v]);
7231
+ } else if (n2.t === "obj") {
7232
+ for (const [k, x] of n2.props) colors(k === "DEFAULT" ? prefix : `${prefix}-${k}`, x, depth + 1);
7233
+ } else if (n2.t === "ref") {
7234
+ if (palettes.has(n2.path[0]) && n2.path.length > 1) {
7235
+ const base = `--color-${n2.path.slice(1).join("-")}`;
7236
+ for (const [k, v] of Object.entries(TAILWIND_V3_THEME)) {
7237
+ if (k === base || k.startsWith(`${base}-`)) out.vars.push([prefix + k.slice(base.length), v]);
7238
+ }
7239
+ } else if (n2.path.length === 1) {
7240
+ const local = localObject(src, n2.path[0]);
7241
+ if (local) colors(prefix, local, depth + 1);
7242
+ }
7243
+ }
7244
+ };
7245
+ const family = (n2) => {
7246
+ if (n2.t === "str") return n2.v;
7247
+ if (n2.t !== "arr") return void 0;
7248
+ const first = n2.items[0];
7249
+ const list = first?.t === "arr" ? first.items : n2.items;
7250
+ const names = list.flatMap((x) => x.t === "str" ? [/\s/.test(x.v) && !/[",]/.test(x.v) ? `"${x.v}"` : x.v] : []);
7251
+ return names.length ? names.join(", ") : void 0;
7252
+ };
7253
+ const sizes = (key, n2) => {
7254
+ const size = n2.t === "str" ? n2 : n2.t === "arr" ? n2.items[0] : void 0;
7255
+ if (size?.t !== "str") return;
7256
+ out.vars.push([`--text-${key}`, size.v]);
7257
+ const spec = n2.t === "arr" ? n2.items[1] : void 0;
7258
+ if (spec?.t === "str") out.vars.push([`--text-${key}--line-height`, spec.v]);
7259
+ else if (spec?.t === "obj") {
7260
+ for (const [prop2, name] of [["lineHeight", "line-height"], ["letterSpacing", "letter-spacing"], ["fontWeight", "font-weight"]]) {
7261
+ const x = spec.props.get(prop2);
7262
+ if (x?.t === "str") out.vars.push([`--text-${key}--${name}`, x.v]);
7263
+ }
7264
+ }
7265
+ };
7266
+ for (const layer of [theme, get(theme, "extend")]) {
7267
+ if (layer?.t !== "obj") continue;
7268
+ for (const [group, prefix] of GROUPS) {
7269
+ const n2 = layer.props.get(group);
7270
+ if (!n2) continue;
7271
+ if (layer === theme) out.replaced.add(prefix);
7272
+ if (n2.t !== "obj") continue;
7273
+ for (const [k, x] of n2.props) {
7274
+ if (group === "colors") colors(`--color-${k}`, x);
7275
+ else if (k === "DEFAULT") continue;
7276
+ else if (group === "fontSize") sizes(k, x);
7277
+ else if (group === "fontFamily") {
7278
+ const f = family(x);
7279
+ if (f) out.vars.push([`--font-${k}`, f]);
7280
+ } else if (x.t === "str") out.vars.push([`${prefix}${k}`, x.v]);
7281
+ }
7282
+ }
7283
+ }
7284
+ return out;
7285
+ }
7286
+ var OTHER, IDENT, Reader, parseAt, get, GROUPS;
7287
+ var init_tailwind_config = __esm({
7288
+ "src/tools/tailwind-config.ts"() {
7289
+ "use strict";
7290
+ init_tailwind_v3_theme();
7291
+ OTHER = { t: "other" };
7292
+ IDENT = /[\w$]/;
7293
+ Reader = class {
7294
+ constructor(s, i = 0) {
7295
+ this.s = s;
7296
+ this.i = i;
7297
+ }
7298
+ ws() {
7299
+ const s = this.s;
7300
+ for (; ; ) {
7301
+ while (this.i < s.length && /\s/.test(s[this.i])) this.i++;
7302
+ if (s[this.i] === "/" && s[this.i + 1] === "/") {
7303
+ const nl = s.indexOf("\n", this.i);
7304
+ this.i = nl < 0 ? s.length : nl;
7305
+ } else if (s[this.i] === "/" && s[this.i + 1] === "*") {
7306
+ const end = s.indexOf("*/", this.i + 2);
7307
+ this.i = end < 0 ? s.length : end + 2;
7308
+ } else return;
7309
+ }
7310
+ }
7311
+ quoted() {
7312
+ const s = this.s;
7313
+ const q = s[this.i++];
7314
+ let out = "";
7315
+ for (; this.i < s.length && s[this.i] !== q; this.i++) {
7316
+ if (s[this.i] === "\\") this.i++;
7317
+ out += s[this.i] ?? "";
7318
+ }
7319
+ this.i++;
7320
+ return out;
7321
+ }
7322
+ /** Moves to the next `,` or closing bracket at this depth, without consuming it. */
7323
+ skipExpr() {
7324
+ const s = this.s;
7325
+ let depth = 0;
7326
+ for (; this.i < s.length; this.i++) {
7327
+ const c = s[this.i];
7328
+ if (c === '"' || c === "'" || c === "`") this.quoted(), this.i--;
7329
+ else if (c === "/" && (s[this.i + 1] === "/" || s[this.i + 1] === "*")) this.ws(), this.i--;
7330
+ else if (c === "{" || c === "[" || c === "(") depth++;
7331
+ else if (c === "}" || c === "]" || c === ")") {
7332
+ if (depth === 0) return;
7333
+ depth--;
7334
+ } else if (c === "," && depth === 0) return;
7335
+ }
7336
+ }
7337
+ /** A value; anything that isn't a literal, an object, an array or a plain reference is `other`. */
7338
+ value() {
7339
+ this.ws();
7340
+ const s = this.s;
7341
+ const c = s[this.i];
7342
+ let node2 = OTHER;
7343
+ if (c === "{") node2 = this.object();
7344
+ else if (c === "[") {
7345
+ this.i++;
7346
+ const items = [];
7347
+ for (; ; ) {
7348
+ this.ws();
7349
+ if (this.i >= s.length || s[this.i] === "]") break;
7350
+ if (s[this.i] === ",") {
7351
+ this.i++;
7352
+ continue;
7353
+ }
7354
+ const before = this.i;
7355
+ items.push(s.startsWith("...", this.i) ? (this.skipExpr(), OTHER) : this.value());
7356
+ if (this.i === before) this.i++;
7357
+ }
7358
+ this.i++;
7359
+ node2 = { t: "arr", items };
7360
+ } else if (c === '"' || c === "'") node2 = { t: "str", v: this.quoted() };
7361
+ else if (c === "`") {
7362
+ const v = this.quoted();
7363
+ node2 = v.includes("${") ? OTHER : { t: "str", v };
7364
+ } else if (c !== void 0 && /[\d.-]/.test(c)) {
7365
+ const m = /^-?[\d.]+/.exec(s.slice(this.i, this.i + 24));
7366
+ if (m) {
7367
+ this.i += m[0].length;
7368
+ node2 = { t: "str", v: m[0] };
7369
+ }
7370
+ } else if (c !== void 0 && IDENT.test(c)) {
7371
+ const path7 = [];
7372
+ for (; ; ) {
7373
+ const m = /^[\w$]+/.exec(s.slice(this.i, this.i + 80));
7374
+ if (!m) break;
7375
+ path7.push(m[0]);
7376
+ this.i += m[0].length;
7377
+ if (s[this.i] === ".") {
7378
+ this.i++;
7379
+ continue;
7380
+ }
7381
+ const lit = /^\[\s*(["']?)([\w-]+)\1\s*\]/.exec(s.slice(this.i, this.i + 40));
7382
+ if (!lit) break;
7383
+ path7.push(lit[2]);
7384
+ this.i += lit[0].length;
7385
+ if (s[this.i] === ".") this.i++;
7386
+ else break;
7387
+ }
7388
+ node2 = path7.length ? { t: "ref", path: path7 } : OTHER;
7389
+ }
7390
+ this.ws();
7391
+ if (node2 !== OTHER && /^(?:as|satisfies)\s/.test(s.slice(this.i, this.i + 11))) {
7392
+ this.skipExpr();
7393
+ return node2;
7394
+ }
7395
+ if (this.i < s.length && ![",", "}", "]", ")"].includes(s[this.i])) {
7396
+ this.skipExpr();
7397
+ return OTHER;
7398
+ }
7399
+ return node2;
7400
+ }
7401
+ object() {
7402
+ const s = this.s;
7403
+ this.i++;
7404
+ const props = /* @__PURE__ */ new Map();
7405
+ for (; ; ) {
7406
+ this.ws();
7407
+ if (this.i >= s.length || s[this.i] === "}") break;
7408
+ if (s[this.i] === ",") {
7409
+ this.i++;
7410
+ continue;
7411
+ }
7412
+ const before = this.i;
7413
+ let key;
7414
+ if (s[this.i] === '"' || s[this.i] === "'") key = this.quoted();
7415
+ else {
7416
+ const m = /^[\w$-]+/.exec(s.slice(this.i, this.i + 80));
7417
+ if (m) {
7418
+ key = m[0];
7419
+ this.i += m[0].length;
7420
+ }
7421
+ }
7422
+ this.ws();
7423
+ if (key !== void 0 && s[this.i] === ":") {
7424
+ this.i++;
7425
+ props.set(key, this.value());
7426
+ } else if (key !== void 0 && (s[this.i] === "," || s[this.i] === "}")) {
7427
+ props.set(key, { t: "ref", path: [key] });
7428
+ } else this.skipExpr();
7429
+ if (this.i === before) this.i++;
7430
+ }
7431
+ this.i++;
7432
+ return { t: "obj", props };
7433
+ }
7434
+ };
7435
+ parseAt = (src, open2) => new Reader(src, open2).value();
7436
+ get = (n2, key) => n2?.t === "obj" ? n2.props.get(key) : void 0;
7437
+ GROUPS = [
7438
+ ["colors", "--color-"],
7439
+ ["fontFamily", "--font-"],
7440
+ ["fontSize", "--text-"],
7441
+ ["fontWeight", "--font-weight-"],
7442
+ ["letterSpacing", "--tracking-"]
7443
+ ];
7444
+ }
7445
+ });
7446
+
7447
+ // src/tools/tailwind-theme.ts
7448
+ var TAILWIND_THEME;
7449
+ var init_tailwind_theme = __esm({
7450
+ "src/tools/tailwind-theme.ts"() {
7451
+ "use strict";
7452
+ TAILWIND_THEME = {
7453
+ "--color-red-50": "oklch(97.1% 0.013 17.38)",
7454
+ "--color-red-100": "oklch(93.6% 0.032 17.717)",
7455
+ "--color-red-200": "oklch(88.5% 0.062 18.334)",
7456
+ "--color-red-300": "oklch(80.8% 0.114 19.571)",
7457
+ "--color-red-400": "oklch(70.4% 0.191 22.216)",
7458
+ "--color-red-500": "oklch(63.7% 0.237 25.331)",
7459
+ "--color-red-600": "oklch(57.7% 0.245 27.325)",
7460
+ "--color-red-700": "oklch(50.5% 0.213 27.518)",
7461
+ "--color-red-800": "oklch(44.4% 0.177 26.899)",
7462
+ "--color-red-900": "oklch(39.6% 0.141 25.723)",
7463
+ "--color-red-950": "oklch(25.8% 0.092 26.042)",
7464
+ "--color-orange-50": "oklch(98% 0.016 73.684)",
7465
+ "--color-orange-100": "oklch(95.4% 0.038 75.164)",
7466
+ "--color-orange-200": "oklch(90.1% 0.076 70.697)",
7467
+ "--color-orange-300": "oklch(83.7% 0.128 66.29)",
7468
+ "--color-orange-400": "oklch(75% 0.183 55.934)",
7469
+ "--color-orange-500": "oklch(70.5% 0.213 47.604)",
7470
+ "--color-orange-600": "oklch(64.6% 0.222 41.116)",
7471
+ "--color-orange-700": "oklch(55.3% 0.195 38.402)",
7472
+ "--color-orange-800": "oklch(47% 0.157 37.304)",
7473
+ "--color-orange-900": "oklch(40.8% 0.123 38.172)",
7474
+ "--color-orange-950": "oklch(26.6% 0.079 36.259)",
7475
+ "--color-amber-50": "oklch(98.7% 0.022 95.277)",
7476
+ "--color-amber-100": "oklch(96.2% 0.059 95.617)",
7477
+ "--color-amber-200": "oklch(92.4% 0.12 95.746)",
7478
+ "--color-amber-300": "oklch(87.9% 0.169 91.605)",
7479
+ "--color-amber-400": "oklch(82.8% 0.189 84.429)",
7480
+ "--color-amber-500": "oklch(76.9% 0.188 70.08)",
7481
+ "--color-amber-600": "oklch(66.6% 0.179 58.318)",
7482
+ "--color-amber-700": "oklch(55.5% 0.163 48.998)",
7483
+ "--color-amber-800": "oklch(47.3% 0.137 46.201)",
7484
+ "--color-amber-900": "oklch(41.4% 0.112 45.904)",
7485
+ "--color-amber-950": "oklch(27.9% 0.077 45.635)",
7486
+ "--color-yellow-50": "oklch(98.7% 0.026 102.212)",
7487
+ "--color-yellow-100": "oklch(97.3% 0.071 103.193)",
7488
+ "--color-yellow-200": "oklch(94.5% 0.129 101.54)",
7489
+ "--color-yellow-300": "oklch(90.5% 0.182 98.111)",
7490
+ "--color-yellow-400": "oklch(85.2% 0.199 91.936)",
7491
+ "--color-yellow-500": "oklch(79.5% 0.184 86.047)",
7492
+ "--color-yellow-600": "oklch(68.1% 0.162 75.834)",
7493
+ "--color-yellow-700": "oklch(55.4% 0.135 66.442)",
7494
+ "--color-yellow-800": "oklch(47.6% 0.114 61.907)",
7495
+ "--color-yellow-900": "oklch(42.1% 0.095 57.708)",
7496
+ "--color-yellow-950": "oklch(28.6% 0.066 53.813)",
7497
+ "--color-lime-50": "oklch(98.6% 0.031 120.757)",
7498
+ "--color-lime-100": "oklch(96.7% 0.067 122.328)",
7499
+ "--color-lime-200": "oklch(93.8% 0.127 124.321)",
7500
+ "--color-lime-300": "oklch(89.7% 0.196 126.665)",
7501
+ "--color-lime-400": "oklch(84.1% 0.238 128.85)",
7502
+ "--color-lime-500": "oklch(76.8% 0.233 130.85)",
7503
+ "--color-lime-600": "oklch(64.8% 0.2 131.684)",
7504
+ "--color-lime-700": "oklch(53.2% 0.157 131.589)",
7505
+ "--color-lime-800": "oklch(45.3% 0.124 130.933)",
7506
+ "--color-lime-900": "oklch(40.5% 0.101 131.063)",
7507
+ "--color-lime-950": "oklch(27.4% 0.072 132.109)",
7508
+ "--color-green-50": "oklch(98.2% 0.018 155.826)",
7509
+ "--color-green-100": "oklch(96.2% 0.044 156.743)",
7510
+ "--color-green-200": "oklch(92.5% 0.084 155.995)",
7511
+ "--color-green-300": "oklch(87.1% 0.15 154.449)",
7512
+ "--color-green-400": "oklch(79.2% 0.209 151.711)",
7513
+ "--color-green-500": "oklch(72.3% 0.219 149.579)",
7514
+ "--color-green-600": "oklch(62.7% 0.194 149.214)",
7515
+ "--color-green-700": "oklch(52.7% 0.154 150.069)",
7516
+ "--color-green-800": "oklch(44.8% 0.119 151.328)",
7517
+ "--color-green-900": "oklch(39.3% 0.095 152.535)",
7518
+ "--color-green-950": "oklch(26.6% 0.065 152.934)",
7519
+ "--color-emerald-50": "oklch(97.9% 0.021 166.113)",
7520
+ "--color-emerald-100": "oklch(95% 0.052 163.051)",
7521
+ "--color-emerald-200": "oklch(90.5% 0.093 164.15)",
7522
+ "--color-emerald-300": "oklch(84.5% 0.143 164.978)",
7523
+ "--color-emerald-400": "oklch(76.5% 0.177 163.223)",
7524
+ "--color-emerald-500": "oklch(69.6% 0.17 162.48)",
7525
+ "--color-emerald-600": "oklch(59.6% 0.145 163.225)",
7526
+ "--color-emerald-700": "oklch(50.8% 0.118 165.612)",
7527
+ "--color-emerald-800": "oklch(43.2% 0.095 166.913)",
7528
+ "--color-emerald-900": "oklch(37.8% 0.077 168.94)",
7529
+ "--color-emerald-950": "oklch(26.2% 0.051 172.552)",
7530
+ "--color-teal-50": "oklch(98.4% 0.014 180.72)",
7531
+ "--color-teal-100": "oklch(95.3% 0.051 180.801)",
7532
+ "--color-teal-200": "oklch(91% 0.096 180.426)",
7533
+ "--color-teal-300": "oklch(85.5% 0.138 181.071)",
7534
+ "--color-teal-400": "oklch(77.7% 0.152 181.912)",
7535
+ "--color-teal-500": "oklch(70.4% 0.14 182.503)",
7536
+ "--color-teal-600": "oklch(60% 0.118 184.704)",
7537
+ "--color-teal-700": "oklch(51.1% 0.096 186.391)",
7538
+ "--color-teal-800": "oklch(43.7% 0.078 188.216)",
7539
+ "--color-teal-900": "oklch(38.6% 0.063 188.416)",
7540
+ "--color-teal-950": "oklch(27.7% 0.046 192.524)",
7541
+ "--color-cyan-50": "oklch(98.4% 0.019 200.873)",
7542
+ "--color-cyan-100": "oklch(95.6% 0.045 203.388)",
7543
+ "--color-cyan-200": "oklch(91.7% 0.08 205.041)",
7544
+ "--color-cyan-300": "oklch(86.5% 0.127 207.078)",
7545
+ "--color-cyan-400": "oklch(78.9% 0.154 211.53)",
7546
+ "--color-cyan-500": "oklch(71.5% 0.143 215.221)",
7547
+ "--color-cyan-600": "oklch(60.9% 0.126 221.723)",
7548
+ "--color-cyan-700": "oklch(52% 0.105 223.128)",
7549
+ "--color-cyan-800": "oklch(45% 0.085 224.283)",
7550
+ "--color-cyan-900": "oklch(39.8% 0.07 227.392)",
7551
+ "--color-cyan-950": "oklch(30.2% 0.056 229.695)",
7552
+ "--color-sky-50": "oklch(97.7% 0.013 236.62)",
7553
+ "--color-sky-100": "oklch(95.1% 0.026 236.824)",
7554
+ "--color-sky-200": "oklch(90.1% 0.058 230.902)",
7555
+ "--color-sky-300": "oklch(82.8% 0.111 230.318)",
7556
+ "--color-sky-400": "oklch(74.6% 0.16 232.661)",
7557
+ "--color-sky-500": "oklch(68.5% 0.169 237.323)",
7558
+ "--color-sky-600": "oklch(58.8% 0.158 241.966)",
7559
+ "--color-sky-700": "oklch(50% 0.134 242.749)",
7560
+ "--color-sky-800": "oklch(44.3% 0.11 240.79)",
7561
+ "--color-sky-900": "oklch(39.1% 0.09 240.876)",
7562
+ "--color-sky-950": "oklch(29.3% 0.066 243.157)",
7563
+ "--color-blue-50": "oklch(97% 0.014 254.604)",
7564
+ "--color-blue-100": "oklch(93.2% 0.032 255.585)",
7565
+ "--color-blue-200": "oklch(88.2% 0.059 254.128)",
7566
+ "--color-blue-300": "oklch(80.9% 0.105 251.813)",
7567
+ "--color-blue-400": "oklch(70.7% 0.165 254.624)",
7568
+ "--color-blue-500": "oklch(62.3% 0.214 259.815)",
7569
+ "--color-blue-600": "oklch(54.6% 0.245 262.881)",
7570
+ "--color-blue-700": "oklch(48.8% 0.243 264.376)",
7571
+ "--color-blue-800": "oklch(42.4% 0.199 265.638)",
7572
+ "--color-blue-900": "oklch(37.9% 0.146 265.522)",
7573
+ "--color-blue-950": "oklch(28.2% 0.091 267.935)",
7574
+ "--color-indigo-50": "oklch(96.2% 0.018 272.314)",
7575
+ "--color-indigo-100": "oklch(93% 0.034 272.788)",
7576
+ "--color-indigo-200": "oklch(87% 0.065 274.039)",
7577
+ "--color-indigo-300": "oklch(78.5% 0.115 274.713)",
7578
+ "--color-indigo-400": "oklch(67.3% 0.182 276.935)",
7579
+ "--color-indigo-500": "oklch(58.5% 0.233 277.117)",
7580
+ "--color-indigo-600": "oklch(51.1% 0.262 276.966)",
7581
+ "--color-indigo-700": "oklch(45.7% 0.24 277.023)",
7582
+ "--color-indigo-800": "oklch(39.8% 0.195 277.366)",
7583
+ "--color-indigo-900": "oklch(35.9% 0.144 278.697)",
7584
+ "--color-indigo-950": "oklch(25.7% 0.09 281.288)",
7585
+ "--color-violet-50": "oklch(96.9% 0.016 293.756)",
7586
+ "--color-violet-100": "oklch(94.3% 0.029 294.588)",
7587
+ "--color-violet-200": "oklch(89.4% 0.057 293.283)",
7588
+ "--color-violet-300": "oklch(81.1% 0.111 293.571)",
7589
+ "--color-violet-400": "oklch(70.2% 0.183 293.541)",
7590
+ "--color-violet-500": "oklch(60.6% 0.25 292.717)",
7591
+ "--color-violet-600": "oklch(54.1% 0.281 293.009)",
7592
+ "--color-violet-700": "oklch(49.1% 0.27 292.581)",
7593
+ "--color-violet-800": "oklch(43.2% 0.232 292.759)",
7594
+ "--color-violet-900": "oklch(38% 0.189 293.745)",
7595
+ "--color-violet-950": "oklch(28.3% 0.141 291.089)",
7596
+ "--color-purple-50": "oklch(97.7% 0.014 308.299)",
7597
+ "--color-purple-100": "oklch(94.6% 0.033 307.174)",
7598
+ "--color-purple-200": "oklch(90.2% 0.063 306.703)",
7599
+ "--color-purple-300": "oklch(82.7% 0.119 306.383)",
7600
+ "--color-purple-400": "oklch(71.4% 0.203 305.504)",
7601
+ "--color-purple-500": "oklch(62.7% 0.265 303.9)",
7602
+ "--color-purple-600": "oklch(55.8% 0.288 302.321)",
7603
+ "--color-purple-700": "oklch(49.6% 0.265 301.924)",
7604
+ "--color-purple-800": "oklch(43.8% 0.218 303.724)",
7605
+ "--color-purple-900": "oklch(38.1% 0.176 304.987)",
7606
+ "--color-purple-950": "oklch(29.1% 0.149 302.717)",
7607
+ "--color-fuchsia-50": "oklch(97.7% 0.017 320.058)",
7608
+ "--color-fuchsia-100": "oklch(95.2% 0.037 318.852)",
7609
+ "--color-fuchsia-200": "oklch(90.3% 0.076 319.62)",
7610
+ "--color-fuchsia-300": "oklch(83.3% 0.145 321.434)",
7611
+ "--color-fuchsia-400": "oklch(74% 0.238 322.16)",
7612
+ "--color-fuchsia-500": "oklch(66.7% 0.295 322.15)",
7613
+ "--color-fuchsia-600": "oklch(59.1% 0.293 322.896)",
7614
+ "--color-fuchsia-700": "oklch(51.8% 0.253 323.949)",
7615
+ "--color-fuchsia-800": "oklch(45.2% 0.211 324.591)",
7616
+ "--color-fuchsia-900": "oklch(40.1% 0.17 325.612)",
7617
+ "--color-fuchsia-950": "oklch(29.3% 0.136 325.661)",
7618
+ "--color-pink-50": "oklch(97.1% 0.014 343.198)",
7619
+ "--color-pink-100": "oklch(94.8% 0.028 342.258)",
7620
+ "--color-pink-200": "oklch(89.9% 0.061 343.231)",
7621
+ "--color-pink-300": "oklch(82.3% 0.12 346.018)",
7622
+ "--color-pink-400": "oklch(71.8% 0.202 349.761)",
7623
+ "--color-pink-500": "oklch(65.6% 0.241 354.308)",
7624
+ "--color-pink-600": "oklch(59.2% 0.249 0.584)",
7625
+ "--color-pink-700": "oklch(52.5% 0.223 3.958)",
7626
+ "--color-pink-800": "oklch(45.9% 0.187 3.815)",
7627
+ "--color-pink-900": "oklch(40.8% 0.153 2.432)",
7628
+ "--color-pink-950": "oklch(28.4% 0.109 3.907)",
7629
+ "--color-rose-50": "oklch(96.9% 0.015 12.422)",
7630
+ "--color-rose-100": "oklch(94.1% 0.03 12.58)",
7631
+ "--color-rose-200": "oklch(89.2% 0.058 10.001)",
7632
+ "--color-rose-300": "oklch(81% 0.117 11.638)",
7633
+ "--color-rose-400": "oklch(71.2% 0.194 13.428)",
7634
+ "--color-rose-500": "oklch(64.5% 0.246 16.439)",
7635
+ "--color-rose-600": "oklch(58.6% 0.253 17.585)",
7636
+ "--color-rose-700": "oklch(51.4% 0.222 16.935)",
7637
+ "--color-rose-800": "oklch(45.5% 0.188 13.697)",
7638
+ "--color-rose-900": "oklch(41% 0.159 10.272)",
7639
+ "--color-rose-950": "oklch(27.1% 0.105 12.094)",
7640
+ "--color-slate-50": "oklch(98.4% 0.003 247.858)",
7641
+ "--color-slate-100": "oklch(96.8% 0.007 247.896)",
7642
+ "--color-slate-200": "oklch(92.9% 0.013 255.508)",
7643
+ "--color-slate-300": "oklch(86.9% 0.022 252.894)",
7644
+ "--color-slate-400": "oklch(70.4% 0.04 256.788)",
7645
+ "--color-slate-500": "oklch(55.4% 0.046 257.417)",
7646
+ "--color-slate-600": "oklch(44.6% 0.043 257.281)",
7647
+ "--color-slate-700": "oklch(37.2% 0.044 257.287)",
7648
+ "--color-slate-800": "oklch(27.9% 0.041 260.031)",
7649
+ "--color-slate-900": "oklch(20.8% 0.042 265.755)",
7650
+ "--color-slate-950": "oklch(12.9% 0.042 264.695)",
7651
+ "--color-gray-50": "oklch(98.5% 0.002 247.839)",
7652
+ "--color-gray-100": "oklch(96.7% 0.003 264.542)",
7653
+ "--color-gray-200": "oklch(92.8% 0.006 264.531)",
7654
+ "--color-gray-300": "oklch(87.2% 0.01 258.338)",
7655
+ "--color-gray-400": "oklch(70.7% 0.022 261.325)",
7656
+ "--color-gray-500": "oklch(55.1% 0.027 264.364)",
7657
+ "--color-gray-600": "oklch(44.6% 0.03 256.802)",
7658
+ "--color-gray-700": "oklch(37.3% 0.034 259.733)",
7659
+ "--color-gray-800": "oklch(27.8% 0.033 256.848)",
7660
+ "--color-gray-900": "oklch(21% 0.034 264.665)",
7661
+ "--color-gray-950": "oklch(13% 0.028 261.692)",
7662
+ "--color-zinc-50": "oklch(98.5% 0 none)",
7663
+ "--color-zinc-100": "oklch(96.7% 0.001 286.375)",
7664
+ "--color-zinc-200": "oklch(92% 0.004 286.32)",
7665
+ "--color-zinc-300": "oklch(87.1% 0.006 286.286)",
7666
+ "--color-zinc-400": "oklch(70.5% 0.015 286.067)",
7667
+ "--color-zinc-500": "oklch(55.2% 0.016 285.938)",
7668
+ "--color-zinc-600": "oklch(44.2% 0.017 285.786)",
7669
+ "--color-zinc-700": "oklch(37% 0.013 285.805)",
7670
+ "--color-zinc-800": "oklch(27.4% 0.006 286.033)",
7671
+ "--color-zinc-900": "oklch(21% 0.006 285.885)",
7672
+ "--color-zinc-950": "oklch(14.1% 0.005 285.823)",
7673
+ "--color-neutral-50": "oklch(98.5% 0 none)",
7674
+ "--color-neutral-100": "oklch(97% 0 none)",
7675
+ "--color-neutral-200": "oklch(92.2% 0 none)",
7676
+ "--color-neutral-300": "oklch(87% 0 none)",
7677
+ "--color-neutral-400": "oklch(70.8% 0 none)",
7678
+ "--color-neutral-500": "oklch(55.6% 0 none)",
7679
+ "--color-neutral-600": "oklch(43.9% 0 none)",
7680
+ "--color-neutral-700": "oklch(37.1% 0 none)",
7681
+ "--color-neutral-800": "oklch(26.9% 0 none)",
7682
+ "--color-neutral-900": "oklch(20.5% 0 none)",
7683
+ "--color-neutral-950": "oklch(14.5% 0 none)",
7684
+ "--color-stone-50": "oklch(98.5% 0.001 106.423)",
7685
+ "--color-stone-100": "oklch(97% 0.001 106.424)",
7686
+ "--color-stone-200": "oklch(92.3% 0.003 48.717)",
7687
+ "--color-stone-300": "oklch(86.9% 0.005 56.366)",
7688
+ "--color-stone-400": "oklch(70.9% 0.01 56.259)",
7689
+ "--color-stone-500": "oklch(55.3% 0.013 58.071)",
7690
+ "--color-stone-600": "oklch(44.4% 0.011 73.639)",
7691
+ "--color-stone-700": "oklch(37.4% 0.01 67.558)",
7692
+ "--color-stone-800": "oklch(26.8% 0.007 34.298)",
7693
+ "--color-stone-900": "oklch(21.6% 0.006 56.043)",
7694
+ "--color-stone-950": "oklch(14.7% 0.004 49.25)",
7695
+ "--color-mauve-50": "oklch(98.5% 0 none)",
7696
+ "--color-mauve-100": "oklch(96% 0.003 325.6)",
7697
+ "--color-mauve-200": "oklch(92.2% 0.005 325.62)",
7698
+ "--color-mauve-300": "oklch(86.5% 0.012 325.68)",
7699
+ "--color-mauve-400": "oklch(71.1% 0.019 323.02)",
7700
+ "--color-mauve-500": "oklch(54.2% 0.034 322.5)",
7701
+ "--color-mauve-600": "oklch(43.5% 0.029 321.78)",
7702
+ "--color-mauve-700": "oklch(36.4% 0.029 323.89)",
7703
+ "--color-mauve-800": "oklch(26.3% 0.024 320.12)",
7704
+ "--color-mauve-900": "oklch(21.2% 0.019 322.12)",
7705
+ "--color-mauve-950": "oklch(14.5% 0.008 326)",
7706
+ "--color-olive-50": "oklch(98.8% 0.003 106.5)",
7707
+ "--color-olive-100": "oklch(96.6% 0.005 106.5)",
7708
+ "--color-olive-200": "oklch(93% 0.007 106.5)",
7709
+ "--color-olive-300": "oklch(88% 0.011 106.6)",
7710
+ "--color-olive-400": "oklch(73.7% 0.021 106.9)",
7711
+ "--color-olive-500": "oklch(58% 0.031 107.3)",
7712
+ "--color-olive-600": "oklch(46.6% 0.025 107.3)",
7713
+ "--color-olive-700": "oklch(39.4% 0.023 107.4)",
7714
+ "--color-olive-800": "oklch(28.6% 0.016 107.4)",
7715
+ "--color-olive-900": "oklch(22.8% 0.013 107.4)",
7716
+ "--color-olive-950": "oklch(15.3% 0.006 107.1)",
7717
+ "--color-mist-50": "oklch(98.7% 0.002 197.1)",
7718
+ "--color-mist-100": "oklch(96.3% 0.002 197.1)",
7719
+ "--color-mist-200": "oklch(92.5% 0.005 214.3)",
7720
+ "--color-mist-300": "oklch(87.2% 0.007 219.6)",
7721
+ "--color-mist-400": "oklch(72.3% 0.014 214.4)",
7722
+ "--color-mist-500": "oklch(56% 0.021 213.5)",
7723
+ "--color-mist-600": "oklch(45% 0.017 213.2)",
7724
+ "--color-mist-700": "oklch(37.8% 0.015 216)",
7725
+ "--color-mist-800": "oklch(27.5% 0.011 216.9)",
7726
+ "--color-mist-900": "oklch(21.8% 0.008 223.9)",
7727
+ "--color-mist-950": "oklch(14.8% 0.004 228.8)",
7728
+ "--color-taupe-50": "oklch(98.6% 0.002 67.8)",
7729
+ "--color-taupe-100": "oklch(96% 0.002 17.2)",
7730
+ "--color-taupe-200": "oklch(92.2% 0.005 34.3)",
7731
+ "--color-taupe-300": "oklch(86.8% 0.007 39.5)",
7732
+ "--color-taupe-400": "oklch(71.4% 0.014 41.2)",
7733
+ "--color-taupe-500": "oklch(54.7% 0.021 43.1)",
7734
+ "--color-taupe-600": "oklch(43.8% 0.017 39.3)",
7735
+ "--color-taupe-700": "oklch(36.7% 0.016 35.7)",
7736
+ "--color-taupe-800": "oklch(26.8% 0.011 36.5)",
7737
+ "--color-taupe-900": "oklch(21.4% 0.009 43.1)",
7738
+ "--color-taupe-950": "oklch(14.7% 0.004 49.3)",
7739
+ "--color-black": "#000",
7740
+ "--color-white": "#fff",
7741
+ "--text-xs": "0.75rem",
7742
+ "--text-xs--line-height": "calc(1 / 0.75)",
7743
+ "--text-sm": "0.875rem",
7744
+ "--text-sm--line-height": "calc(1.25 / 0.875)",
7745
+ "--text-base": "1rem",
7746
+ "--text-base--line-height": "calc(1.5 / 1)",
7747
+ "--text-lg": "1.125rem",
7748
+ "--text-lg--line-height": "calc(1.75 / 1.125)",
7749
+ "--text-xl": "1.25rem",
7750
+ "--text-xl--line-height": "calc(1.75 / 1.25)",
7751
+ "--text-2xl": "1.5rem",
7752
+ "--text-2xl--line-height": "calc(2 / 1.5)",
7753
+ "--text-3xl": "1.875rem",
7754
+ "--text-3xl--line-height": "calc(2.25 / 1.875)",
7755
+ "--text-4xl": "2.25rem",
7756
+ "--text-4xl--line-height": "calc(2.5 / 2.25)",
7757
+ "--text-5xl": "3rem",
7758
+ "--text-5xl--line-height": "1",
7759
+ "--text-6xl": "3.75rem",
7760
+ "--text-6xl--line-height": "1",
7761
+ "--text-7xl": "4.5rem",
7762
+ "--text-7xl--line-height": "1",
7763
+ "--text-8xl": "6rem",
7764
+ "--text-8xl--line-height": "1",
7765
+ "--text-9xl": "8rem",
7766
+ "--text-9xl--line-height": "1",
7767
+ "--font-weight-thin": "100",
7768
+ "--font-weight-extralight": "200",
7769
+ "--font-weight-light": "300",
7770
+ "--font-weight-normal": "400",
7771
+ "--font-weight-medium": "500",
7772
+ "--font-weight-semibold": "600",
7773
+ "--font-weight-bold": "700",
7774
+ "--font-weight-extrabold": "800",
7775
+ "--font-weight-black": "900",
7776
+ "--tracking-tighter": "-0.05em",
7777
+ "--tracking-tight": "-0.025em",
7778
+ "--tracking-normal": "0em",
7779
+ "--tracking-wide": "0.025em",
7780
+ "--tracking-wider": "0.05em",
7781
+ "--tracking-widest": "0.1em",
7782
+ "--text-shadow-2xs": "0px 1px 0px rgb(0 0 0 / 0.15)",
7783
+ "--text-shadow-xs": "0px 1px 1px rgb(0 0 0 / 0.2)",
7784
+ "--text-shadow-sm": "0px 1px 0px rgb(0 0 0 / 0.075), 0px 1px 1px rgb(0 0 0 / 0.075), 0px 2px 2px rgb(0 0 0 / 0.075)",
7785
+ "--text-shadow-md": "0px 1px 1px rgb(0 0 0 / 0.1), 0px 1px 2px rgb(0 0 0 / 0.1), 0px 2px 4px rgb(0 0 0 / 0.1)",
7786
+ "--text-shadow-lg": "0px 1px 2px rgb(0 0 0 / 0.1), 0px 3px 2px rgb(0 0 0 / 0.1), 0px 4px 8px rgb(0 0 0 / 0.1)"
7787
+ };
7788
+ }
7789
+ });
7790
+
6144
7791
  // src/tools/project.ts
6145
7792
  import { execFile } from "node:child_process";
6146
- import { readdir, readFile as readFile2 } from "node:fs/promises";
7793
+ import { readdir as readdir2, readFile as readFile3 } from "node:fs/promises";
6147
7794
  import os3 from "node:os";
6148
- import path3 from "node:path";
7795
+ import path4 from "node:path";
6149
7796
  import { promisify } from "node:util";
6150
7797
  async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
6151
- root = path3.resolve(root);
6152
- if (root === path3.parse(root).root || root === os3.homedir()) return void 0;
6153
- const skip = [...new Set(exclude.map((e) => path3.resolve(e)))];
7798
+ root = path4.resolve(root);
7799
+ if (root === path4.parse(root).root || root === os3.homedir()) return void 0;
7800
+ const skip = [...new Set(exclude.map((e) => path4.resolve(e)))];
6154
7801
  const styles = [];
6155
7802
  const svgs = [];
6156
7803
  const comps = [];
6157
- const shown = (p) => path3.relative(process.cwd(), p).split(path3.sep).join("/");
7804
+ const manifests = [];
7805
+ const elixir = [];
7806
+ const twConfigs = [];
7807
+ const shown = (p) => path4.relative(process.cwd(), p).split(path4.sep).join("/");
6158
7808
  let incomplete;
6159
7809
  const sort = (p) => {
6160
- const name = path3.basename(p);
7810
+ const name = path4.basename(p);
6161
7811
  if (STYLE.test(name)) styles.push(p);
6162
7812
  else if (/\.svg$/i.test(name)) svgs.push(p);
6163
7813
  else if (COMPONENT_FILE.test(name)) comps.push(p);
7814
+ else if (name === "package.json" || name === "mix.exs") manifests.push(p);
7815
+ else if (name.endsWith(".ex")) elixir.push(p);
7816
+ else if (/^tailwind\.config\.(js|cjs|mjs|ts)$/.test(name)) twConfigs.push(p);
6164
7817
  };
6165
- const skipped = (p) => skip.some((s) => p === s || p.startsWith(s + path3.sep));
7818
+ const skipped = (p) => skip.some((s) => p === s || p.startsWith(s + path4.sep));
6166
7819
  const tracked = await gitFiles(root);
6167
7820
  if (tracked?.length) {
6168
7821
  for (const p of tracked) {
6169
- const dirs = path3.relative(root, p).split(path3.sep).slice(0, -1);
7822
+ const dirs = path4.relative(root, p).split(path4.sep).slice(0, -1);
6170
7823
  if (!dirs.some((d) => d.startsWith(".") || SKIP_DIRS.has(d)) && !skipped(p)) sort(p);
6171
7824
  }
6172
7825
  } else {
@@ -6180,14 +7833,14 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
6180
7833
  }
6181
7834
  let list;
6182
7835
  try {
6183
- list = await readdir(dir, { withFileTypes: true });
7836
+ list = await readdir2(dir, { withFileTypes: true });
6184
7837
  } catch {
6185
7838
  return;
6186
7839
  }
6187
7840
  entries += list.length;
6188
7841
  list.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
6189
7842
  for (const e of list) {
6190
- const p = path3.join(dir, e.name);
7843
+ const p = path4.join(dir, e.name);
6191
7844
  if (e.isDirectory()) {
6192
7845
  if (!e.name.startsWith(".") && !SKIP_DIRS.has(e.name) && !skipped(p)) await walk(p, depth + 1);
6193
7846
  } else if (e.isFile()) sort(p);
@@ -6205,17 +7858,25 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
6205
7858
  };
6206
7859
  const vars = /* @__PURE__ */ new Map();
6207
7860
  const classes = /* @__PURE__ */ new Map();
7861
+ let tailwind = false;
7862
+ const theme = /* @__PURE__ */ new Set();
7863
+ const resets = [];
6208
7864
  for (const f of styles.slice(0, MAX_STYLES)) {
6209
7865
  const css = await readText(f, 1e6);
6210
7866
  if (!css) continue;
6211
7867
  const text2 = css.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
7868
+ if (/@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[\w-]+\.css)?["']|@theme\b/.test(text2)) tailwind = true;
7869
+ for (const block of themeBlocks(text2)) {
7870
+ for (const m of block.matchAll(/(?<=(?:^|[{;])\s*)(--[\w-]+)\s*:/g)) theme.add(m[1]);
7871
+ for (const m of block.matchAll(/(--[\w-]*)\*\s*:\s*initial/g)) resets.push(m[1]);
7872
+ }
6212
7873
  const define = (re) => {
6213
7874
  for (const m of text2.matchAll(re)) if (!vars.has(m[1])) vars.set(m[1], m[2].trim());
6214
7875
  };
6215
7876
  define(/(?<=(?:^|[{;])\s*)(--[\w-]+)\s*:\s*([^;{}]+)/g);
6216
7877
  if (/\.(scss|sass)$/i.test(f)) define(/^\s*(\$[\w-]+)\s*:\s*([^;\n]+)/gm);
6217
7878
  if (/\.less$/i.test(f)) define(/^\s*(@[\w-]+)\s*:\s*([^;\n]+)/gm);
6218
- const stem = slug2(path3.basename(f).replace(/\.[^.]+$/, ""));
7879
+ const stem = slug2(path4.basename(f).replace(/\.[^.]+$/, ""));
6219
7880
  for (const m of text2.matchAll(/(?<=^|[{};])\s*\.(-?[_a-zA-Z][\w-]*)\s*\{([^{}]*)\}/g)) {
6220
7881
  if (!/__|--/.test(m[1])) rules.push({ cls: m[1], decls: m[2], file: shown(f) });
6221
7882
  }
@@ -6226,12 +7887,28 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
6226
7887
  }
6227
7888
  }
6228
7889
  }
7890
+ const defaults = /* @__PURE__ */ new Set();
7891
+ if (tailwind) {
7892
+ for (const [k, v] of Object.entries(TAILWIND_THEME)) {
7893
+ if (vars.has(k) || resets.some((r) => k.startsWith(r) && !(r === "--font-" && k.startsWith("--font-weight-")))) continue;
7894
+ vars.set(k, v);
7895
+ theme.add(k);
7896
+ defaults.add(k);
7897
+ }
7898
+ }
7899
+ const utility = (name) => {
7900
+ if (!theme.has(name)) return void 0;
7901
+ const m = /^--(color|font)-([\w-]+)$/.exec(name);
7902
+ if (!m || m[1] === "font" && m[2].startsWith("weight-")) return void 0;
7903
+ return m[1] === "color" ? `*-${m[2]}` : `font-${m[2]}`;
7904
+ };
6229
7905
  const ref = (name, wrap) => {
7906
+ const u = utility(name);
7907
+ if (u) return u;
6230
7908
  const r = name.startsWith("--") ? `var(${name})` : name;
6231
7909
  return wrap ? `${wrap}(${r})` : r;
6232
7910
  };
6233
- const resolved = [];
6234
- for (const [name, value] of vars) {
7911
+ const resolve = (value) => {
6235
7912
  let v = value;
6236
7913
  let alias = false;
6237
7914
  for (let hops = 0; hops < 5; hops++) {
@@ -6241,19 +7918,48 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
6241
7918
  v = next;
6242
7919
  alias = true;
6243
7920
  }
6244
- resolved.push([name, v, alias]);
6245
- }
6246
- for (const pass of [true, false]) {
6247
- for (const [name, v, alias] of resolved) {
6248
- if (alias !== pass) continue;
6249
- const c = parseColor(v);
6250
- if (c) add(idx.colors, c.hex, ref(name, c.wrap));
6251
- else if (/font|family|typeface/i.test(name)) {
6252
- const fam = firstFamily(v);
6253
- if (fam && !/^\d|^var\(/.test(fam)) add(idx.fonts, fam, ref(name));
6254
- }
6255
- }
6256
- }
7921
+ return { v, alias };
7922
+ };
7923
+ if (twConfigs.length) {
7924
+ const channel = (name) => resolve(vars.get(name) ?? "").v || void 0;
7925
+ const replaced = /* @__PURE__ */ new Set();
7926
+ const own2 = [];
7927
+ for (const f of twConfigs.slice(0, 8)) {
7928
+ const src = await readText(f, 2e5);
7929
+ if (!src) continue;
7930
+ const c = tailwindConfigTheme(src, channel);
7931
+ c.replaced.forEach((p) => replaced.add(p));
7932
+ own2.push(...c.vars);
7933
+ }
7934
+ const add2 = (k, v, isDefault) => {
7935
+ if (vars.has(k)) return;
7936
+ vars.set(k, v);
7937
+ theme.add(k);
7938
+ if (isDefault) defaults.add(k);
7939
+ };
7940
+ for (const [k, v] of own2) add2(k, v, false);
7941
+ if (!tailwind) for (const [k, v] of tailwindV3Defaults(replaced)) add2(k, v, true);
7942
+ tailwind = true;
7943
+ }
7944
+ const ranked = [];
7945
+ for (const [name, value] of vars) {
7946
+ const { v, alias } = resolve(value);
7947
+ const rank2 = defaults.has(name) ? 3 : utility(name) ? 0 : alias ? 1 : 2;
7948
+ ranked.push({ name, v, rank: rank2 });
7949
+ }
7950
+ ranked.sort((a, b) => a.rank - b.rank);
7951
+ for (const { name, v } of ranked) {
7952
+ const c = parseColor(v);
7953
+ if (c) add(idx.colors, c.hex, ref(name, c.wrap));
7954
+ else if (/font|family|typeface/i.test(name) && !/^--(font-weight|text)-/.test(name)) {
7955
+ const fam = firstFamily(v);
7956
+ if (fam && !/^\d|^var\(/.test(fam)) add(idx.fonts, fam, ref(name));
7957
+ }
7958
+ }
7959
+ if (tailwind) idx.tailwind = tailwindTheme(theme, defaults, (name) => {
7960
+ const raw = vars.get(name);
7961
+ return raw === void 0 ? void 0 : resolve(raw).v;
7962
+ });
6257
7963
  const family = (v) => {
6258
7964
  let x = v?.trim();
6259
7965
  for (let hops = 0; x && hops < 5; hops++) {
@@ -6275,16 +7981,33 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
6275
7981
  list.push({ file: shown(f), nums: s.nums });
6276
7982
  idx.icons.set(s.key, list);
6277
7983
  }
6278
- for (const f of comps) {
6279
- let stem = path3.basename(f).replace(/\.[^.]+$/, "");
6280
- if (/^index$/i.test(stem)) stem = path3.basename(path3.dirname(f));
6281
- if (NOT_COMPONENT.test(stem)) continue;
6282
- add(idx.components, slug2(stem), shown(f));
7984
+ const ownIcons = [];
7985
+ const reactIconSets = /* @__PURE__ */ new Set();
7986
+ for (const [k, f] of comps.entries()) {
7987
+ let stem = path4.basename(f).replace(/\.[^.]+$/, "");
7988
+ if (/^index$/i.test(stem)) stem = path4.basename(path4.dirname(f));
7989
+ if (/\.(test|spec|stories|story)$/i.test(stem)) continue;
7990
+ const text2 = /\.(tsx|jsx)$/i.test(f) && k < MAX_CODE ? await readText(f, 2e5) : void 0;
7991
+ const found = text2 ? reactComponents(text2) : [];
7992
+ if (text2) ownIcons.push(...codeIcons(text2, shown(f)));
7993
+ for (const m of text2?.matchAll(/from\s+["']react-icons\/(\w+)["']/g) ?? []) reactIconSets.add(m[1]);
7994
+ for (const c of found) add(idx.components, slug2(c.name), `${c.api} (${shown(f)})`);
7995
+ if (!found.some((c) => slug2(c.name) === slug2(stem)) && !NOT_COMPONENT.test(stem)) add(idx.components, slug2(stem), shown(f));
7996
+ }
7997
+ for (const f of elixir.filter((f2) => !/(^|[/\\])test[/\\]/.test(path4.relative(root, f2))).slice(0, MAX_CODE)) {
7998
+ const text2 = await readText(f, 4e5);
7999
+ if (text2) ownIcons.push(...codeIcons(text2, shown(f), true));
8000
+ if (!text2 || !/^\s*(attr|slot)\s+:/m.test(text2)) continue;
8001
+ for (const c of phoenixComponents(text2)) add(idx.components, slug2(c.name), `${c.api} (${shown(f)})`);
6283
8002
  }
6284
8003
  for (const [c, f] of classes) add(idx.components, c.toLowerCase(), `.${c} (${f})`);
8004
+ const rank = (ref2) => /components?[/\\]ui[/\\]|core_components|_ui[/\\]|[/\\]components[/\\]/.test(ref2) ? 0 : /mail|email|stories|example/i.test(ref2) ? 2 : 1;
8005
+ for (const list of idx.components.values()) list.sort((a, b) => rank(a) - rank(b));
8006
+ const libs = await iconLibraries(root, manifests, ownIcons, reactIconSets).catch(() => []);
8007
+ if (libs.length) idx.iconLibs = libs;
6285
8008
  if (svgs.length > MAX_SVGS) incomplete ??= `read only the first ${MAX_SVGS} of ${svgs.length} SVG files`;
6286
8009
  if (incomplete) idx.incomplete = `project scan of ${shown(root) || "."} ${incomplete}`;
6287
- const empty = !idx.colors.size && !idx.fonts.size && !idx.icons.size && !idx.components.size && !idx.textStyles.length;
8010
+ const empty = !idx.colors.size && !idx.fonts.size && !idx.icons.size && !idx.components.size && !idx.textStyles.length && !idx.tailwind?.text.length && !idx.iconLibs;
6288
8011
  return empty && !incomplete ? void 0 : idx;
6289
8012
  }
6290
8013
  async function gitFiles(root) {
@@ -6294,7 +8017,7 @@ async function gitFiles(root) {
6294
8017
  maxBuffer: 256 * 1024 * 1024,
6295
8018
  timeout: 1e4
6296
8019
  });
6297
- return stdout.split("\0").filter(Boolean).map((f) => path3.join(root, f));
8020
+ return stdout.split("\0").filter(Boolean).map((f) => path4.join(root, f));
6298
8021
  } catch {
6299
8022
  return void 0;
6300
8023
  }
@@ -6306,12 +8029,76 @@ function withScanNote(text2, idx) {
6306
8029
  ## project scan incomplete
6307
8030
  ${idx.incomplete}: a colour, font, icon or component without a project match may still exist, so search the code before adding a copy`;
6308
8031
  }
8032
+ function themeBlocks(css) {
8033
+ const out = [];
8034
+ for (const m of css.matchAll(/@(?:theme|plugin)\b[^{;]*\{/g)) {
8035
+ let depth = 1;
8036
+ let i = m.index + m[0].length;
8037
+ const start = i;
8038
+ for (; i < css.length && depth; i++) {
8039
+ if (css[i] === "{") depth++;
8040
+ else if (css[i] === "}") depth--;
8041
+ }
8042
+ out.push(css.slice(start, i - 1));
8043
+ }
8044
+ return out;
8045
+ }
8046
+ function lineHeightPx(v, size) {
8047
+ const c = /^calc\(\s*([\d.]+)\s*\/\s*([\d.]+)\s*\)$/.exec(v.trim());
8048
+ return c ? parseFloat(c[1]) / parseFloat(c[2]) * size : px(v, size);
8049
+ }
8050
+ function tailwindTheme(theme, defaults, value) {
8051
+ const out = { text: [], weights: /* @__PURE__ */ new Map(), tracking: /* @__PURE__ */ new Map() };
8052
+ for (const name of theme) {
8053
+ const v = value(name);
8054
+ if (v === void 0) continue;
8055
+ let m;
8056
+ if (m = /^--font-weight-([\w-]+)$/.exec(name)) {
8057
+ const w = parseInt(v, 10);
8058
+ if (w && !out.weights.has(w)) out.weights.set(w, m[1]);
8059
+ } else if (m = /^--tracking-([\w-]+)$/.exec(name)) {
8060
+ const em = /^(-?[\d.]+)em$/.exec(v.trim());
8061
+ if (em && !out.tracking.has(parseFloat(em[1]))) out.tracking.set(parseFloat(em[1]), m[1]);
8062
+ } else if ((m = /^--text-([\w-]+)$/.exec(name)) && !m[1].includes("--")) {
8063
+ const size = /[a-z%]$/i.test(v.trim()) ? px(v, 16) : void 0;
8064
+ if (!size) continue;
8065
+ const lh = value(`${name}--line-height`);
8066
+ const fw = value(`${name}--font-weight`);
8067
+ const ls = value(`${name}--letter-spacing`);
8068
+ out.text.push({
8069
+ cls: `text-${m[1]}`,
8070
+ size,
8071
+ lineHeight: lh === void 0 ? void 0 : lineHeightPx(lh, size),
8072
+ weight: fw === void 0 ? void 0 : parseInt(fw, 10) || void 0,
8073
+ letterSpacing: ls === void 0 ? void 0 : px(ls, size),
8074
+ own: !defaults.has(name)
8075
+ });
8076
+ }
8077
+ }
8078
+ return out;
8079
+ }
8080
+ function tailwindText(tw, t) {
8081
+ const sized = tw.text.filter((x) => Math.abs(x.size - t.size) <= 0.01);
8082
+ const own2 = sized.filter((x) => x.own);
8083
+ return (own2.length ? own2 : sized).map((x) => {
8084
+ const parts = [x.cls];
8085
+ if ((x.weight ?? 400) !== t.weight) parts.push(`font-${tw.weights.get(t.weight) ?? `[${t.weight}]`}`);
8086
+ if (t.italic) parts.push("italic");
8087
+ if (t.lh !== void 0 && (x.lineHeight === void 0 || Math.abs(x.lineHeight - t.lh) > 0.5)) parts.push(`leading-[${num(t.lh)}px]`);
8088
+ if (Math.abs((x.letterSpacing ?? 0) - t.ls) > 0.05) {
8089
+ const named = [...tw.tracking].find(([em]) => Math.abs(em * t.size - t.ls) <= 0.05);
8090
+ parts.push(named ? `tracking-${named[1]}` : `tracking-[${t.lsText ?? `${num(t.ls)}px`}]`);
8091
+ }
8092
+ if (t.transform !== "none") parts.push(t.transform);
8093
+ return parts.join(" ");
8094
+ });
8095
+ }
6309
8096
  function firstFamily(stack) {
6310
8097
  return stack.split(",")[0].trim().replace(/^["']|["']$/g, "").toLowerCase();
6311
8098
  }
6312
8099
  async function readText(file2, max) {
6313
8100
  try {
6314
- const buf = await readFile2(file2);
8101
+ const buf = await readFile3(file2);
6315
8102
  return buf.length > max ? void 0 : buf.toString("utf8");
6316
8103
  } catch {
6317
8104
  return void 0;
@@ -6412,7 +8199,8 @@ function textRefs(idx, spec) {
6412
8199
  const ls = lsm ? lsm[2] === "em" ? parseFloat(lsm[1]) * size : parseFloat(lsm[1]) : 0;
6413
8200
  const transform2 = /\b(uppercase|lowercase|capitalize)\b/.exec(g.rest)?.[1] ?? "none";
6414
8201
  const fam = g.family.toLowerCase();
6415
- return idx.textStyles.filter((t) => {
8202
+ const tw = idx.tailwind ? tailwindText(idx.tailwind, { size, weight: Number(g.weight), italic: !!g.italic, lh, ls, lsText: lsm ? `${lsm[1]}${lsm[2]}` : void 0, transform: transform2 }) : [];
8203
+ const classes = idx.textStyles.filter((t) => {
6416
8204
  if (t.size !== size && Math.abs(t.size - size) > 0.01) return false;
6417
8205
  if (t.weight !== Number(g.weight) || t.italic !== !!g.italic || t.transform !== transform2) return false;
6418
8206
  if (Math.abs(t.letterSpacing - ls) > 0.05) return false;
@@ -6420,7 +8208,8 @@ function textRefs(idx, spec) {
6420
8208
  if (t.lineHeight === "normal") return g.lh === "normal";
6421
8209
  if (lh === void 0) return true;
6422
8210
  return typeof t.lineHeight === "number" && Math.abs(t.lineHeight - lh) <= 0.5;
6423
- }).map((t) => t.ref).slice(0, 3);
8211
+ }).map((t) => t.ref);
8212
+ return [...classes, ...tw].slice(0, 3);
6424
8213
  }
6425
8214
  function normHex(h) {
6426
8215
  const m = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(h.trim());
@@ -6480,28 +8269,28 @@ function parseColor(value) {
6480
8269
  function shapeOf(svg) {
6481
8270
  const rootTag = /<svg\b[^>]*>/i.exec(svg)?.[0];
6482
8271
  if (!rootTag) return void 0;
6483
- const root = attrs(rootTag);
8272
+ const root = attrs2(rootTag);
6484
8273
  const vb = (root.viewBox ?? `0 0 ${parseFloat(root.width ?? "")} ${parseFloat(root.height ?? "")}`).split(/[\s,]+/).map(Number);
6485
8274
  const [vx, vy, vw, vh] = vb;
6486
8275
  if (vb.length !== 4 || !(vw > 0) || !(vh > 0)) return void 0;
6487
8276
  const body = svg.replace(/<(mask|clipPath|defs|title|desc)\b[\s\S]*?<\/\1>/gi, "");
6488
8277
  const scaled = { x: (v) => (v - vx) / vw, y: (v) => (v - vy) / vh, s: (v) => v / vw, r: (v) => v };
6489
- const keys = [];
8278
+ const keys2 = [];
6490
8279
  const nums = [];
6491
8280
  for (const m of body.matchAll(/<(path|rect|circle|ellipse|line|polyline|polygon)\b([^>]*)>/gi)) {
6492
- const a = attrs(m[2]);
8281
+ const a = attrs2(m[2]);
6493
8282
  const fill = a.fill ?? root.fill ?? "black";
6494
8283
  const stroke = a.stroke ?? root.stroke ?? "none";
6495
8284
  if ((fill === "none" || fill === "transparent") && (stroke === "none" || stroke === "transparent")) continue;
6496
8285
  if (a.opacity === "0" || a.visibility === "hidden" || a.display === "none") continue;
6497
8286
  const g = geometry(m[1].toLowerCase(), a);
6498
8287
  if (!g) return void 0;
6499
- keys.push(g.key);
8288
+ keys2.push(g.key);
6500
8289
  for (const [v, axis] of g.vals) nums.push(scaled[axis](v));
6501
8290
  }
6502
- return keys.length ? { key: keys.join("|"), nums } : void 0;
8291
+ return keys2.length ? { key: keys2.join("|"), nums } : void 0;
6503
8292
  }
6504
- function attrs(tag) {
8293
+ function attrs2(tag) {
6505
8294
  const out = {};
6506
8295
  for (const m of tag.matchAll(/([\w:-]+)\s*=\s*("([^"]*)"|'([^']*)')/g)) out[m[1]] = m[3] ?? m[4] ?? "";
6507
8296
  for (const d of (out.style ?? "").split(";")) {
@@ -6565,7 +8354,7 @@ function absolutePath(d) {
6565
8354
  continue;
6566
8355
  }
6567
8356
  const n2 = [];
6568
- for (let k = 0; k < ARGS[up]; k++) {
8357
+ for (let k = 0; k < ARGS2[up]; k++) {
6569
8358
  const s = up === "A" && (k === 3 || k === 4) ? read(FLAG) : read(NUM);
6570
8359
  if (s === void 0) return k === 0 && !c && atEnd() ? { key, vals } : void 0;
6571
8360
  n2.push(Number(s));
@@ -6598,10 +8387,14 @@ function absolutePath(d) {
6598
8387
  }
6599
8388
  return { key, vals };
6600
8389
  }
6601
- var TEXT_PROPS, SKIP_DIRS, STYLE, COMPONENT_FILE, NOT_COMPONENT, MAX_ENTRIES, MAX_MS, MAX_STYLES, MAX_SVGS, WEIGHTS, hex22, pct, ARGS;
8390
+ var TEXT_PROPS, SKIP_DIRS, STYLE, COMPONENT_FILE, NOT_COMPONENT, MAX_ENTRIES, MAX_MS, MAX_STYLES, MAX_SVGS, MAX_CODE, num, WEIGHTS, hex22, pct, ARGS2;
6602
8391
  var init_project = __esm({
6603
8392
  "src/tools/project.ts"() {
6604
8393
  "use strict";
8394
+ init_code_components();
8395
+ init_icons();
8396
+ init_tailwind_config();
8397
+ init_tailwind_theme();
6605
8398
  TEXT_PROPS = /^(font(-[\w-]+)?|line-height|letter-spacing|text-transform|text-decoration[\w-]*|color|-webkit-font-smoothing|-moz-osx-font-smoothing|text-rendering)$/;
6606
8399
  SKIP_DIRS = /* @__PURE__ */ new Set([
6607
8400
  "node_modules",
@@ -6629,10 +8422,12 @@ var init_project = __esm({
6629
8422
  MAX_MS = 2e3;
6630
8423
  MAX_STYLES = 600;
6631
8424
  MAX_SVGS = 3e3;
8425
+ MAX_CODE = 4e3;
8426
+ num = (x) => String(+x.toFixed(2));
6632
8427
  WEIGHTS = { normal: 400, bold: 700, lighter: 300, bolder: 700 };
6633
8428
  hex22 = (v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0");
6634
8429
  pct = (s, full) => s.endsWith("%") ? parseFloat(s) / 100 * full : parseFloat(s);
6635
- ARGS = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };
8430
+ ARGS2 = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };
6636
8431
  }
6637
8432
  });
6638
8433
 
@@ -9067,8 +10862,8 @@ var init_png = __esm({
9067
10862
  });
9068
10863
 
9069
10864
  // src/tools/media.ts
9070
- import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
9071
- import path4 from "node:path";
10865
+ import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
10866
+ import path5 from "node:path";
9072
10867
  function rasterWaitMs(frozen) {
9073
10868
  return Number(process.env.LUPA_RASTER_WAIT_MS) || (frozen ? 2500 : 1e4);
9074
10869
  }
@@ -9113,9 +10908,9 @@ async function screenshot(bridge, ids, file2, opts) {
9113
10908
  const raster = decodePng(buf);
9114
10909
  if (opts.saveTo) {
9115
10910
  const target = ids.length > 1 || head.roots.length > 1 ? withSuffix(opts.saveTo, slug(root.name) || root.id) : opts.saveTo;
9116
- await mkdir2(path4.dirname(path4.resolve(target)), { recursive: true });
10911
+ await mkdir2(path5.dirname(path5.resolve(target)), { recursive: true });
9117
10912
  await writeFile2(target, buf);
9118
- lines.push(`saved ${path4.resolve(target)} (${raster.width}\xD7${raster.height}px)`);
10913
+ lines.push(`saved ${path5.resolve(target)} (${raster.width}\xD7${raster.height}px)`);
9119
10914
  }
9120
10915
  const parts = tiles(raster);
9121
10916
  const visionScale = scale * parts[0].scale;
@@ -9129,8 +10924,8 @@ async function screenshot(bridge, ids, file2, opts) {
9129
10924
  return { text: lines.join("\n"), images };
9130
10925
  }
9131
10926
  function withSuffix(file2, suffix) {
9132
- const ext = path4.extname(file2) || ".png";
9133
- return `${file2.slice(0, file2.length - path4.extname(file2).length)}-${suffix}${ext}`;
10927
+ const ext = path5.extname(file2) || ".png";
10928
+ return `${file2.slice(0, file2.length - path5.extname(file2).length)}-${suffix}${ext}`;
9134
10929
  }
9135
10930
  function collect(snap, defs = []) {
9136
10931
  const graphics = [];
@@ -9200,7 +10995,7 @@ function fileNamer() {
9200
10995
  }
9201
10996
  async function exportAssets(bridge, ids, file2, opts) {
9202
10997
  if (opts.as !== "auto") {
9203
- const dir = path4.resolve(opts.dir);
10998
+ const dir = path5.resolve(opts.dir);
9204
10999
  await mkdir2(dir, { recursive: true });
9205
11000
  const fileName = fileNamer();
9206
11001
  const lines = [];
@@ -9209,7 +11004,7 @@ async function exportAssets(bridge, ids, file2, opts) {
9209
11004
  for (const b of res2.blobs) {
9210
11005
  const name = fileName(b.name, opts.as);
9211
11006
  const data = b.encoding === "utf8" ? opts.currentColor ? toCurrentColor(b.data) : b.data : Buffer.from(b.data, "base64");
9212
- await writeFile2(path4.join(dir, name), data);
11007
+ await writeFile2(path5.join(dir, name), data);
9213
11008
  lines.push(`${name} \u2190 "${b.name}" #${b.id} ${n(b.w)}\xD7${n(b.h)}${opts.as === "png" ? ` @${opts.scale ?? 2}x` : ""}`);
9214
11009
  }
9215
11010
  for (const e of res2.errors) lines.push(`failed #${e.id}: ${e.error}`);
@@ -9223,10 +11018,10 @@ async function exportAssets(bridge, ids, file2, opts) {
9223
11018
  return res.report;
9224
11019
  }
9225
11020
  async function writeAssets(bridge, snap, file2, opts) {
9226
- const dir = path4.resolve(opts.dir);
11021
+ const dir = path5.resolve(opts.dir);
9227
11022
  await mkdir2(dir, { recursive: true });
9228
11023
  const fileName = fileNamer();
9229
- const rel = (name) => path4.join(opts.dir, name).split(path4.sep).join("/");
11024
+ const rel = (name) => path5.join(opts.dir, name).split(path5.sep).join("/");
9230
11025
  const lines = [];
9231
11026
  const failures = [];
9232
11027
  const fail2 = (line) => {
@@ -9262,13 +11057,14 @@ async function writeAssets(bridge, snap, file2, opts) {
9262
11057
  continue;
9263
11058
  }
9264
11059
  const own3 = opts.project && iconFile(opts.project, svg);
9265
- const name = own3 || fileName(g.base, "svg");
9266
- if (own3) reused.add(own3);
9267
- else await writeFile2(path4.join(dir, name), svg);
11060
+ const lib = !own3 && opts.project?.iconLibs ? (await matchLibraryIcon(opts.project.iconLibs, svg, g.name))?.usage : void 0;
11061
+ const name = own3 || lib || fileName(g.base, "svg");
11062
+ if (own3 || lib) reused.add(name);
11063
+ else await writeFile2(path5.join(dir, name), svg);
9268
11064
  written.set(key, { name, line: lines.length, uses: 1, component: g.component, also: [] });
9269
- byNode.set(g.nodeId, own3 || rel(name));
11065
+ byNode.set(g.nodeId, own3 || lib || rel(name));
9270
11066
  if (g.sig) bySig.set(g.sig, name);
9271
- lines.push(`${name} \u2190 svg "${g.name}" #${g.nodeId} ${n(b.w)}\xD7${n(b.h)}${own3 ? " (the project's own icon: not written)" : ""}`);
11067
+ lines.push(`${name} \u2190 svg "${g.name}" #${g.nodeId} ${n(b.w)}\xD7${n(b.h)}${own3 ? " (the project's own icon: not written)" : lib ? " (from the project's icon library: not written)" : ""}`);
9272
11068
  }
9273
11069
  }
9274
11070
  for (const { g, error: error62 } of failed) {
@@ -9299,7 +11095,7 @@ async function writeAssets(bridge, snap, file2, opts) {
9299
11095
  }
9300
11096
  const buf = Buffer.from(got.data, "base64");
9301
11097
  const name = fileName(img.base, imageExt(buf));
9302
- await writeFile2(path4.join(dir, name), buf);
11098
+ await writeFile2(path5.join(dir, name), buf);
9303
11099
  byImage.set(img.hash, rel(name));
9304
11100
  lines.push(`${name} \u2190 src:${img.hash.slice(0, 10)} "${img.name}" #${img.nodeId}${got.w ? ` ${got.w}\xD7${got.h}px original` : ""}${img.uses > 1 ? ` (used ${img.uses}\xD7)` : ""}`);
9305
11101
  }
@@ -9367,8 +11163,8 @@ function ignoreEdges(a, b, band) {
9367
11163
  }
9368
11164
  }
9369
11165
  }
9370
- async function compare(bridge, root, file2, opts) {
9371
- const actualBuf = typeof opts.image === "string" ? await readFile3(opts.image) : opts.image;
11166
+ async function compare2(bridge, root, file2, opts) {
11167
+ const actualBuf = typeof opts.image === "string" ? await readFile4(opts.image) : opts.image;
9372
11168
  const actual = flatten(decodePng(actualBuf));
9373
11169
  const scale = actual.width / root.w;
9374
11170
  const res = await renderNode(bridge, root, file2, { scale, width: actual.width }, {});
@@ -9410,9 +11206,9 @@ async function compare(bridge, root, file2, opts) {
9410
11206
  if (d.regions.length > 10) lines.push(` \u2026 +${d.regions.length - 10} smaller regions`);
9411
11207
  let strip = sideBySide([a, b, d.diff]);
9412
11208
  if (opts.saveDiff) {
9413
- await mkdir2(path4.dirname(path4.resolve(opts.saveDiff)), { recursive: true });
11209
+ await mkdir2(path5.dirname(path5.resolve(opts.saveDiff)), { recursive: true });
9414
11210
  await writeFile2(opts.saveDiff, encodePng(strip));
9415
- lines.push(`saved ${path4.resolve(opts.saveDiff)}`);
11211
+ lines.push(`saved ${path5.resolve(opts.saveDiff)}`);
9416
11212
  }
9417
11213
  if (strip.width > VISION_MAX_EDGE || strip.height > VISION_MAX_EDGE) {
9418
11214
  const s = Math.min(VISION_MAX_EDGE / strip.width, VISION_MAX_EDGE / strip.height);
@@ -9429,6 +11225,7 @@ var init_media = __esm({
9429
11225
  init_build();
9430
11226
  init_css();
9431
11227
  init_browser();
11228
+ init_icons();
9432
11229
  init_project();
9433
11230
  init_png();
9434
11231
  SVG_FALLBACK_NOTE = "Figma didn't render a PNG (its window is hidden or covered), so this image is Figma's SVG export rendered in Chromium. SVG export can leave out background blur, newer effects and occasionally a stroke: check a region against `lupa design` before changing it. Bring Figma to the front for an exact render.";
@@ -9601,7 +11398,7 @@ ${Object.entries(x.css).map(([k, v]) => `${k}: ${v};`).join("\n")}`).join("\n\n"
9601
11398
  note = `fonts not available to the page: ${page.missingFonts.map((f) => `"${f}"`).join(", ")}. The browser uses fallbacks, so text and the hug boxes around it differ in width. Load the fonts (@font-face or local install) for an exact comparison.`;
9602
11399
  }
9603
11400
  }
9604
- return compare(this.bridge, root, r.file, { image, threshold: o.threshold, saveDiff: o.saveDiff, note });
11401
+ return compare2(this.bridge, root, r.file, { image, threshold: o.threshold, saveDiff: o.saveDiff, note });
9605
11402
  }
9606
11403
  };
9607
11404
  }
@@ -9642,13 +11439,13 @@ var init_util = __esm({
9642
11439
  });
9643
11440
  };
9644
11441
  util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
9645
- const keys = [];
11442
+ const keys2 = [];
9646
11443
  for (const key in object3) {
9647
11444
  if (Object.prototype.hasOwnProperty.call(object3, key)) {
9648
- keys.push(key);
11445
+ keys2.push(key);
9649
11446
  }
9650
11447
  }
9651
- return keys;
11448
+ return keys2;
9652
11449
  };
9653
11450
  util2.find = (arr, checker) => {
9654
11451
  for (const item of arr) {
@@ -10027,8 +11824,8 @@ var init_parseUtil = __esm({
10027
11824
  init_errors();
10028
11825
  init_en();
10029
11826
  makeIssue = (params) => {
10030
- const { data, path: path6, errorMaps, issueData } = params;
10031
- const fullPath = [...path6, ...issueData.path || []];
11827
+ const { data, path: path7, errorMaps, issueData } = params;
11828
+ const fullPath = [...path7, ...issueData.path || []];
10032
11829
  const fullIssue = {
10033
11830
  ...issueData,
10034
11831
  path: fullPath
@@ -10296,9 +12093,9 @@ function mergeValues(a, b) {
10296
12093
  return { valid: false };
10297
12094
  }
10298
12095
  }
10299
- function createZodEnum(values, params) {
12096
+ function createZodEnum(values2, params) {
10300
12097
  return new ZodEnum({
10301
- values,
12098
+ values: values2,
10302
12099
  typeName: ZodFirstPartyTypeKind.ZodEnum,
10303
12100
  ...processCreateParams(params)
10304
12101
  });
@@ -10312,11 +12109,11 @@ var init_types = __esm({
10312
12109
  init_parseUtil();
10313
12110
  init_util();
10314
12111
  ParseInputLazyPath = class {
10315
- constructor(parent, value, path6, key) {
12112
+ constructor(parent, value, path7, key) {
10316
12113
  this._cachedPath = [];
10317
12114
  this.parent = parent;
10318
12115
  this.data = value;
10319
- this._path = path6;
12116
+ this._path = path7;
10320
12117
  this._key = key;
10321
12118
  }
10322
12119
  get path() {
@@ -11976,8 +13773,8 @@ var init_types = __esm({
11976
13773
  if (this._cached !== null)
11977
13774
  return this._cached;
11978
13775
  const shape = this._def.shape();
11979
- const keys = util.objectKeys(shape);
11980
- this._cached = { shape, keys };
13776
+ const keys2 = util.objectKeys(shape);
13777
+ this._cached = { shape, keys: keys2 };
11981
13778
  return this._cached;
11982
13779
  }
11983
13780
  _parse(input2) {
@@ -13022,14 +14819,14 @@ var init_types = __esm({
13022
14819
  }
13023
14820
  return enumValues;
13024
14821
  }
13025
- extract(values, newDef = this._def) {
13026
- return _ZodEnum.create(values, {
14822
+ extract(values2, newDef = this._def) {
14823
+ return _ZodEnum.create(values2, {
13027
14824
  ...this._def,
13028
14825
  ...newDef
13029
14826
  });
13030
14827
  }
13031
- exclude(values, newDef = this._def) {
13032
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
14828
+ exclude(values2, newDef = this._def) {
14829
+ return _ZodEnum.create(this.options.filter((opt) => !values2.includes(opt)), {
13033
14830
  ...this._def,
13034
14831
  ...newDef
13035
14832
  });
@@ -13067,9 +14864,9 @@ var init_types = __esm({
13067
14864
  return this._def.values;
13068
14865
  }
13069
14866
  };
13070
- ZodNativeEnum.create = (values, params) => {
14867
+ ZodNativeEnum.create = (values2, params) => {
13071
14868
  return new ZodNativeEnum({
13072
- values,
14869
+ values: values2,
13073
14870
  typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
13074
14871
  ...processCreateParams(params)
13075
14872
  });
@@ -13667,8 +15464,8 @@ function assert(_) {
13667
15464
  }
13668
15465
  function getEnumValues(entries) {
13669
15466
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
13670
- const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
13671
- return values;
15467
+ const values2 = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
15468
+ return values2;
13672
15469
  }
13673
15470
  function joinValues(array2, separator = "|") {
13674
15471
  return array2.map((val) => stringifyPrimitive(val)).join(separator);
@@ -13754,9 +15551,9 @@ function putProp(target, key, value) {
13754
15551
  else
13755
15552
  target[key] = value;
13756
15553
  }
13757
- function mirrorShape(target, source, keys, wrap) {
15554
+ function mirrorShape(target, source, keys2, wrap) {
13758
15555
  const raw = sourceShape(source);
13759
- for (const key of keys) {
15556
+ for (const key of keys2) {
13760
15557
  const desc = Object.getOwnPropertyDescriptor(raw, key);
13761
15558
  if (!desc.enumerable)
13762
15559
  continue;
@@ -13791,18 +15588,18 @@ function mergeDefs(...defs) {
13791
15588
  function cloneDef(schema) {
13792
15589
  return mergeDefs(schema._zod.def);
13793
15590
  }
13794
- function getElementAtPath(obj, path6) {
13795
- if (!path6)
15591
+ function getElementAtPath(obj, path7) {
15592
+ if (!path7)
13796
15593
  return obj;
13797
- return path6.reduce((acc, key) => acc?.[key], obj);
15594
+ return path7.reduce((acc, key) => acc?.[key], obj);
13798
15595
  }
13799
15596
  function promiseAllObject(promisesObj) {
13800
- const keys = Object.keys(promisesObj);
13801
- const promises = keys.map((key) => promisesObj[key]);
15597
+ const keys2 = Object.keys(promisesObj);
15598
+ const promises = keys2.map((key) => promisesObj[key]);
13802
15599
  return Promise.all(promises).then((results) => {
13803
15600
  const resolvedObj = {};
13804
- for (let i = 0; i < keys.length; i++) {
13805
- resolvedObj[keys[i]] = results[i];
15601
+ for (let i = 0; i < keys2.length; i++) {
15602
+ resolvedObj[keys2[i]] = results[i];
13806
15603
  }
13807
15604
  return resolvedObj;
13808
15605
  });
@@ -13943,15 +15740,15 @@ function pick(schema, mask) {
13943
15740
  }
13944
15741
  function maskedKeys(schema, mask) {
13945
15742
  const raw = sourceShape(schema);
13946
- const keys = [];
15743
+ const keys2 = [];
13947
15744
  for (const key of Reflect.ownKeys(mask)) {
13948
15745
  if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
13949
15746
  throw new Error(`Unrecognized key: "${String(key)}"`);
13950
15747
  }
13951
15748
  if (mask[key])
13952
- keys.push(key);
15749
+ keys2.push(key);
13953
15750
  }
13954
- return keys;
15751
+ return keys2;
13955
15752
  }
13956
15753
  function omit(schema, mask) {
13957
15754
  const currDef = schema._zod.def;
@@ -14053,11 +15850,11 @@ function explicitlyAborted(x, startIndex = 0) {
14053
15850
  }
14054
15851
  return false;
14055
15852
  }
14056
- function prefixIssues(path6, issues) {
15853
+ function prefixIssues(path7, issues) {
14057
15854
  return issues.map((iss) => {
14058
15855
  var _a3;
14059
15856
  (_a3 = iss).path ?? (_a3.path = []);
14060
- iss.path.unshift(path6);
15857
+ iss.path.unshift(path7);
14061
15858
  return iss;
14062
15859
  });
14063
15860
  }
@@ -14590,16 +16387,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
14590
16387
  }
14591
16388
  function formatError(error62, mapper = (issue2) => issue2.message) {
14592
16389
  const fieldErrors = { _errors: [] };
14593
- const processError = (error63, path6 = []) => {
16390
+ const processError = (error63, path7 = []) => {
14594
16391
  for (const issue2 of error63.issues) {
14595
16392
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14596
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
16393
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
14597
16394
  } else if (issue2.code === "invalid_key") {
14598
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
16395
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14599
16396
  } else if (issue2.code === "invalid_element") {
14600
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
16397
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14601
16398
  } else {
14602
- const fullpath = [...path6, ...issue2.path];
16399
+ const fullpath = [...path7, ...issue2.path];
14603
16400
  if (fullpath.length === 0) {
14604
16401
  fieldErrors._errors.push(mapper(issue2));
14605
16402
  } else {
@@ -14638,17 +16435,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
14638
16435
  }
14639
16436
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
14640
16437
  const result = { errors: [] };
14641
- const processError = (error63, path6 = []) => {
16438
+ const processError = (error63, path7 = []) => {
14642
16439
  var _a3;
14643
16440
  for (const issue2 of error63.issues) {
14644
16441
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14645
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
16442
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
14646
16443
  } else if (issue2.code === "invalid_key") {
14647
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
16444
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14648
16445
  } else if (issue2.code === "invalid_element") {
14649
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
16446
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14650
16447
  } else {
14651
- const fullpath = [...path6, ...issue2.path];
16448
+ const fullpath = [...path7, ...issue2.path];
14652
16449
  if (fullpath.length === 0) {
14653
16450
  result.errors.push(mapper(issue2));
14654
16451
  continue;
@@ -14687,8 +16484,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
14687
16484
  }
14688
16485
  function toDotPath(_path) {
14689
16486
  const segs = [];
14690
- const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14691
- for (const seg of path6) {
16487
+ const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16488
+ for (const seg of path7) {
14692
16489
  if (typeof seg === "number")
14693
16490
  segs.push(`[${seg}]`);
14694
16491
  else if (typeof seg === "symbol")
@@ -15861,10 +17658,10 @@ function handlePropertyResult(result, final, key, input2, optin, optout) {
15861
17658
  }
15862
17659
  }
15863
17660
  function normalizeDef(def) {
15864
- const keys = Object.keys(def.shape);
17661
+ const keys2 = Object.keys(def.shape);
15865
17662
  const ownSymbols = Object.getOwnPropertySymbols(def.shape);
15866
17663
  const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
15867
- const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
17664
+ const allKeys = symbolKeys.length ? [...keys2, ...symbolKeys] : keys2;
15868
17665
  for (const k of allKeys) {
15869
17666
  if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
15870
17667
  throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
@@ -15876,8 +17673,8 @@ function normalizeDef(def) {
15876
17673
  allKeys,
15877
17674
  symbolKeys,
15878
17675
  // string-only: handleCatchall matches it against `for...in`, which never yields a symbol
15879
- keySet: new Set(keys),
15880
- numKeys: keys.length,
17676
+ keySet: new Set(keys2),
17677
+ numKeys: keys2.length,
15881
17678
  optionalKeys: new Set(okeys)
15882
17679
  };
15883
17680
  }
@@ -15993,10 +17790,10 @@ function getDiscriminatedOption(union2, value) {
15993
17790
  function discriminatorMap(def) {
15994
17791
  const map2 = /* @__PURE__ */ new Map();
15995
17792
  for (const option of def.options) {
15996
- const values = option._zod.propValues?.[def.discriminator];
15997
- if (!values || values.size === 0)
17793
+ const values2 = option._zod.propValues?.[def.discriminator];
17794
+ if (!values2 || values2.size === 0)
15998
17795
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
15999
- for (const value of values) {
17796
+ for (const value of values2) {
16000
17797
  if (map2.has(value)) {
16001
17798
  if (value !== void 0)
16002
17799
  throw new Error(`Duplicate discriminator value "${String(value)}"`);
@@ -16061,19 +17858,19 @@ function handleIntersectionResults(result, left, right) {
16061
17858
  let unrecIssue;
16062
17859
  const keyIssues = /* @__PURE__ */ new Map();
16063
17860
  const collect2 = (iss, side) => {
16064
- let keys;
17861
+ let keys2;
16065
17862
  if (iss.code === "unrecognized_keys" && !iss.path?.length) {
16066
17863
  unrecIssue ?? (unrecIssue = iss);
16067
- keys = iss.keys;
17864
+ keys2 = iss.keys;
16068
17865
  } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
16069
17866
  const k = String(iss.path[0]);
16070
17867
  if (!keyIssues.has(k))
16071
17868
  keyIssues.set(k, iss);
16072
- keys = [k];
17869
+ keys2 = [k];
16073
17870
  } else {
16074
17871
  return false;
16075
17872
  }
16076
- for (const k of keys) {
17873
+ for (const k of keys2) {
16077
17874
  if (!unrecKeys.has(k))
16078
17875
  unrecKeys.set(k, {});
16079
17876
  unrecKeys.get(k)[side] = true;
@@ -16978,14 +18775,14 @@ var init_schemas = __esm({
16978
18775
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
16979
18776
  const sh = desc?.get ? desc.get.raw : def.shape ?? {};
16980
18777
  if (sh) {
16981
- const get = () => {
18778
+ const get2 = () => {
16982
18779
  const newSh = { ...sh };
16983
18780
  Object.defineProperty(def, "shape", { value: newSh });
16984
- get.raw = newSh;
18781
+ get2.raw = newSh;
16985
18782
  return newSh;
16986
18783
  };
16987
- get.raw = sh;
16988
- Object.defineProperty(def, "shape", { get });
18784
+ get2.raw = sh;
18785
+ Object.defineProperty(def, "shape", { get: get2 });
16989
18786
  }
16990
18787
  const _normalized = cached(() => normalizeDef(def));
16991
18788
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -17431,11 +19228,11 @@ var init_schemas = __esm({
17431
19228
  return payload;
17432
19229
  }
17433
19230
  const proms = [];
17434
- const values = def.keyType._zod.values;
17435
- if (values && !def.partial) {
19231
+ const values2 = def.keyType._zod.values;
19232
+ if (values2 && !def.partial) {
17436
19233
  payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
17437
19234
  const recordKeys = /* @__PURE__ */ new Set();
17438
- for (const key of values) {
19235
+ for (const key of values2) {
17439
19236
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
17440
19237
  recordKeys.add(typeof key === "number" ? key.toString() : key);
17441
19238
  if (key === "__proto__")
@@ -17521,7 +19318,7 @@ var init_schemas = __esm({
17521
19318
  if (keyResult.issues.length) {
17522
19319
  if (def.mode === "loose") {
17523
19320
  payload.value[key] = input2[key];
17524
- } else if (values) {
19321
+ } else if (values2) {
17525
19322
  unrecognized = unrecognized ?? [];
17526
19323
  unrecognized.push(key);
17527
19324
  } else {
@@ -17650,8 +19447,8 @@ var init_schemas = __esm({
17650
19447
  });
17651
19448
  $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
17652
19449
  $ZodType.init(inst, def);
17653
- const values = getEnumValues(def.entries);
17654
- const valuesSet = new Set(values);
19450
+ const values2 = getEnumValues(def.entries);
19451
+ const valuesSet = new Set(values2);
17655
19452
  inst._zod.values = valuesSet;
17656
19453
  defineLazyInternal(inst, "pattern", (zod) => {
17657
19454
  const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
@@ -17664,7 +19461,7 @@ var init_schemas = __esm({
17664
19461
  }
17665
19462
  payload.issues.push({
17666
19463
  code: "invalid_value",
17667
- values,
19464
+ values: values2,
17668
19465
  input: input2,
17669
19466
  inst
17670
19467
  });
@@ -17673,15 +19470,15 @@ var init_schemas = __esm({
17673
19470
  });
17674
19471
  $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
17675
19472
  $ZodType.init(inst, def);
17676
- const values = new Set(def.values);
17677
- inst._zod.values = values;
19473
+ const values2 = new Set(def.values);
19474
+ inst._zod.values = values2;
17678
19475
  defineLazyInternal(inst, "pattern", (zod) => {
17679
19476
  const vals = zod.def.values;
17680
19477
  return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
17681
19478
  });
17682
19479
  inst._zod.parse = (payload, _ctx) => {
17683
19480
  const input2 = payload.value;
17684
- if (values.has(input2)) {
19481
+ if (values2.has(input2)) {
17685
19482
  return payload;
17686
19483
  }
17687
19484
  payload.issues.push({
@@ -17736,8 +19533,8 @@ var init_schemas = __esm({
17736
19533
  defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
17737
19534
  inst._zod.optout = "optional";
17738
19535
  defineLazyInternal(inst, "values", (zod) => {
17739
- const values = zod.def.innerType._zod.values;
17740
- return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
19536
+ const values2 = zod.def.innerType._zod.values;
19537
+ return values2 ? /* @__PURE__ */ new Set([...values2, void 0]) : void 0;
17741
19538
  });
17742
19539
  defineLazyInternal(inst, "pattern", (zod) => {
17743
19540
  const pattern = zod.def.innerType._zod.pattern;
@@ -27156,13 +28953,13 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
27156
28953
  const def = schema._zod.def;
27157
28954
  doc.write(`if (typeof ${accessor} !== "object" || ${accessor} === null || Array.isArray(${accessor})) return INVALID;`);
27158
28955
  const shape = def.shape;
27159
- const keys = Object.keys(shape);
28956
+ const keys2 = Object.keys(shape);
27160
28957
  const symbolKeys = Object.getOwnPropertySymbols(shape);
27161
- const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
28958
+ const allKeys = symbolKeys.length ? [...keys2, ...symbolKeys] : keys2;
27162
28959
  const keyExpr = (k) => typeof k === "symbol" ? addConstant(ctx, k) : esc(k);
27163
28960
  const propKey = (k) => typeof k === "symbol" ? `[${keyExpr(k)}]` : esc(k);
27164
28961
  const propShape = shape;
27165
- if (keys.includes("__proto__")) {
28962
+ if (keys2.includes("__proto__")) {
27166
28963
  throw new ZodCompileUnsupportedError('object shape key "__proto__"');
27167
28964
  }
27168
28965
  const propOutputs = /* @__PURE__ */ new Map();
@@ -27204,7 +29001,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
27204
29001
  if (catchall) {
27205
29002
  const catchallType = catchall._zod.def.type;
27206
29003
  if (catchallType === "never") {
27207
- const condition = keys.map((k) => `k !== ${esc(k)}`).join(" && ") || "true";
29004
+ const condition = keys2.map((k) => `k !== ${esc(k)}`).join(" && ") || "true";
27208
29005
  doc.write(`for (const k in ${accessor}) {`);
27209
29006
  doc.indented((d) => {
27210
29007
  d.write(`if (${condition}) return INVALID;`);
@@ -27220,7 +29017,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
27220
29017
  const hasConditionalKeys = allKeys.some((k) => mayOmitUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
27221
29018
  if (!buildsValue) {
27222
29019
  if (unknownKeysMode === "schema") {
27223
- const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null;
29020
+ const knownSet = keys2.length > 0 ? addConstant(ctx, new Set(keys2)) : null;
27224
29021
  doc.write(`for (const k in ${accessor}) {`);
27225
29022
  doc.indented((d) => {
27226
29023
  d.write(`if (k === "__proto__") continue;`);
@@ -27252,7 +29049,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
27252
29049
  }
27253
29050
  }
27254
29051
  if (unknownKeysMode !== "none") {
27255
- const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null;
29052
+ const knownSet = keys2.length > 0 ? addConstant(ctx, new Set(keys2)) : null;
27256
29053
  doc.write(`for (const k in ${accessor}) {`);
27257
29054
  doc.indented((d) => {
27258
29055
  d.write(`if (k === "__proto__") continue;`);
@@ -27462,15 +29259,15 @@ function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
27462
29259
  }
27463
29260
  function generateLiteralCheck(doc, ctx, schema, accessor) {
27464
29261
  const def = schema._zod.def;
27465
- const values = def.values;
27466
- if (values.length !== 1) {
27467
- const literalSet = addConstant(ctx, new Set(values));
29262
+ const values2 = def.values;
29263
+ if (values2.length !== 1) {
29264
+ const literalSet = addConstant(ctx, new Set(values2));
27468
29265
  doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`);
27469
29266
  return accessor;
27470
29267
  }
27471
- const value = values[0];
29268
+ const value = values2[0];
27472
29269
  if (typeof value === "number" && Number.isNaN(value)) {
27473
- const literalSet = addConstant(ctx, new Set(values));
29270
+ const literalSet = addConstant(ctx, new Set(values2));
27474
29271
  doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`);
27475
29272
  return accessor;
27476
29273
  }
@@ -27490,11 +29287,11 @@ function generateLiteralCheck(doc, ctx, schema, accessor) {
27490
29287
  return accessor;
27491
29288
  }
27492
29289
  function generateEnumCheck(doc, ctx, schema, accessor) {
27493
- const values = schema._zod.values;
27494
- if (!values) {
29290
+ const values2 = schema._zod.values;
29291
+ if (!values2) {
27495
29292
  throw new ZodCompileUnsupportedError("enum schema without enumerated values");
27496
29293
  }
27497
- const enumSet = addConstant(ctx, values);
29294
+ const enumSet = addConstant(ctx, values2);
27498
29295
  doc.write(`if (!${enumSet}.has(${accessor})) return INVALID;`);
27499
29296
  return accessor;
27500
29297
  }
@@ -27643,8 +29440,8 @@ function generateUnionCheck(doc, ctx, schema, accessor) {
27643
29440
  }
27644
29441
  const allLiterals = options.every((opt) => opt._zod.def.type === "literal" && !opt._zod.def.checks?.length);
27645
29442
  if (allLiterals) {
27646
- const values = new Set(options.flatMap((opt) => opt._zod.def.values));
27647
- const valuesConst = addConstant(ctx, values);
29443
+ const values2 = new Set(options.flatMap((opt) => opt._zod.def.values));
29444
+ const valuesConst = addConstant(ctx, values2);
27648
29445
  doc.write(`if (!${valuesConst}.has(${accessor})) return INVALID;`);
27649
29446
  return accessor;
27650
29447
  }
@@ -27681,17 +29478,17 @@ function generateDiscriminatedUnionCheck(doc, ctx, def, accessor) {
27681
29478
  let firstBranch = true;
27682
29479
  const claimed = /* @__PURE__ */ new Set();
27683
29480
  for (const option of def.options) {
27684
- const values = option._zod.propValues?.[def.discriminator];
27685
- if (!values || values.size === 0) {
29481
+ const values2 = option._zod.propValues?.[def.discriminator];
29482
+ if (!values2 || values2.size === 0) {
27686
29483
  throw new ZodCompileUnsupportedError("discriminated union option without static discriminator values");
27687
29484
  }
27688
- for (const value of values) {
29485
+ for (const value of values2) {
27689
29486
  if (claimed.has(value)) {
27690
29487
  throw new ZodCompileUnsupportedError(`duplicate discriminator value ${String(value)}`);
27691
29488
  }
27692
29489
  claimed.add(value);
27693
29490
  }
27694
- const conditions = Array.from(values, (value) => literalEquality(ctx, discVar, value));
29491
+ const conditions = Array.from(values2, (value) => literalEquality(ctx, discVar, value));
27695
29492
  const prefix = firstBranch ? "if" : "else if";
27696
29493
  doc.write(`${prefix} (${conditions.join(" || ")}) {`);
27697
29494
  doc.indented((d) => {
@@ -28846,8 +30643,8 @@ function _set(Class2, valueType, params) {
28846
30643
  });
28847
30644
  }
28848
30645
  // @__NO_SIDE_EFFECTS__
28849
- function _enum(Class2, values, params) {
28850
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
30646
+ function _enum(Class2, values2, params) {
30647
+ const entries = Array.isArray(values2) ? Object.fromEntries(values2.map((v) => [v, v])) : values2;
28851
30648
  return new Class2({
28852
30649
  type: "enum",
28853
30650
  entries,
@@ -29340,8 +31137,8 @@ function compactTypeUnion(schema) {
29340
31137
  if (!option || typeof option !== "object")
29341
31138
  return;
29342
31139
  compactTypeUnion(option);
29343
- const keys = Object.keys(option);
29344
- if (keys.length !== 1 || keys[0] !== "type")
31140
+ const keys2 = Object.keys(option);
31141
+ if (keys2.length !== 1 || keys2[0] !== "type")
29345
31142
  return;
29346
31143
  const type = option.type;
29347
31144
  for (const member of Array.isArray(type) ? type : [type]) {
@@ -29731,8 +31528,8 @@ function stringifyKeyNames(bySchema, json2, visited) {
29731
31528
  }
29732
31529
  const types = Array.isArray(json2.type) ? json2.type : [json2.type];
29733
31530
  const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
29734
- const values = json2.enum ?? (json2.const !== void 0 ? [json2.const] : void 0);
29735
- if (!numericType && !values?.some((v) => typeof v === "number"))
31531
+ const values2 = json2.enum ?? (json2.const !== void 0 ? [json2.const] : void 0);
31532
+ if (!numericType && !values2?.some((v) => typeof v === "number"))
29736
31533
  return json2;
29737
31534
  const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json2;
29738
31535
  if (rest.enum)
@@ -29742,7 +31539,7 @@ function stringifyKeyNames(bySchema, json2, visited) {
29742
31539
  if (!numericType)
29743
31540
  return rest;
29744
31541
  rest.type = "string";
29745
- if (!values)
31542
+ if (!values2)
29746
31543
  rest.pattern = (types.includes("number") ? number : integer).source;
29747
31544
  return rest;
29748
31545
  }
@@ -30009,16 +31806,16 @@ var init_json_schema_processors = __esm({
30009
31806
  };
30010
31807
  enumProcessor = (schema, _ctx, json2, _params) => {
30011
31808
  const def = schema._zod.def;
30012
- const values = getEnumValues(def.entries);
30013
- if (values.length === 0) {
31809
+ const values2 = getEnumValues(def.entries);
31810
+ if (values2.length === 0) {
30014
31811
  json2.not = {};
30015
31812
  return;
30016
31813
  }
30017
- if (values.every((v) => typeof v === "number"))
31814
+ if (values2.every((v) => typeof v === "number"))
30018
31815
  json2.type = "number";
30019
- if (values.every((v) => typeof v === "string"))
31816
+ if (values2.every((v) => typeof v === "string"))
30020
31817
  json2.type = "string";
30021
- json2.enum = values;
31818
+ json2.enum = values2;
30022
31819
  };
30023
31820
  literalProcessor = (schema, ctx, json2, params) => {
30024
31821
  const def = schema._zod.def;
@@ -30976,10 +32773,10 @@ function visit(schema, fnOrHandlers) {
30976
32773
  switch (kind) {
30977
32774
  case "object": {
30978
32775
  const oldShape = def.shape;
30979
- const keys = Object.keys(oldShape);
32776
+ const keys2 = Object.keys(oldShape);
30980
32777
  let changed = false;
30981
32778
  const newShape = {};
30982
- for (const k of keys) {
32779
+ for (const k of keys2) {
30983
32780
  const mapped = run2(oldShape[k]);
30984
32781
  if (mapped !== oldShape[k])
30985
32782
  changed = true;
@@ -31148,11 +32945,11 @@ function isZ4Schema(s) {
31148
32945
  return !!schema._zod;
31149
32946
  }
31150
32947
  function objectFromShape(shape) {
31151
- const values = Object.values(shape);
31152
- if (values.length === 0)
32948
+ const values2 = Object.values(shape);
32949
+ if (values2.length === 0)
31153
32950
  return object({});
31154
- const allV4 = values.every(isZ4Schema);
31155
- const allV3 = values.every((s) => !isZ4Schema(s));
32951
+ const allV4 = values2.every(isZ4Schema);
32952
+ const allV3 = values2.every((s) => !isZ4Schema(s));
31156
32953
  if (allV4)
31157
32954
  return object(shape);
31158
32955
  if (allV3)
@@ -31206,8 +33003,8 @@ function normalizeObjectSchema(schema) {
31206
33003
  const asV3 = schema;
31207
33004
  const asV4 = schema;
31208
33005
  if (!asV3._def && !asV4._zod) {
31209
- const values = Object.values(schema);
31210
- if (values.length > 0 && values.every((v) => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) {
33006
+ const values2 = Object.values(schema);
33007
+ if (values2.length > 0 && values2.every((v) => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) {
31211
33008
  return objectFromShape(schema);
31212
33009
  }
31213
33010
  }
@@ -31226,11 +33023,11 @@ function normalizeObjectSchema(schema) {
31226
33023
  }
31227
33024
  return void 0;
31228
33025
  }
31229
- function getDotPath(path6) {
31230
- if (path6.length === 0) {
33026
+ function getDotPath(path7) {
33027
+ if (path7.length === 0) {
31231
33028
  return "object root";
31232
33029
  }
31233
- return path6.reduce((acc, seg, index) => {
33030
+ return path7.reduce((acc, seg, index) => {
31234
33031
  if (index === 0) {
31235
33032
  return String(seg);
31236
33033
  }
@@ -31892,8 +33689,8 @@ function set(valueType, params) {
31892
33689
  ...util_exports.normalizeParams(params)
31893
33690
  });
31894
33691
  }
31895
- function _enum2(values, params) {
31896
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
33692
+ function _enum2(values2, params) {
33693
+ const entries = Array.isArray(values2) ? Object.fromEntries(values2.map((v) => [v, v])) : values2;
31897
33694
  return new ZodEnum2({
31898
33695
  type: "enum",
31899
33696
  entries,
@@ -32873,11 +34670,11 @@ var init_schemas3 = __esm({
32873
34670
  inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
32874
34671
  inst.enum = def.entries;
32875
34672
  inst.options = [...inst._zod.values];
32876
- const keys = new Set(Object.keys(def.entries));
32877
- inst.extract = (values, params) => {
34673
+ const keys2 = new Set(Object.keys(def.entries));
34674
+ inst.extract = (values2, params) => {
32878
34675
  const newEntries = {};
32879
- for (const value of values) {
32880
- if (keys.has(value)) {
34676
+ for (const value of values2) {
34677
+ if (keys2.has(value)) {
32881
34678
  newEntries[value] = def.entries[value];
32882
34679
  } else
32883
34680
  throw new Error(`Key ${value} not found in enum`);
@@ -32889,10 +34686,10 @@ var init_schemas3 = __esm({
32889
34686
  entries: newEntries
32890
34687
  });
32891
34688
  };
32892
- inst.exclude = (values, params) => {
34689
+ inst.exclude = (values2, params) => {
32893
34690
  const newEntries = { ...def.entries };
32894
- for (const value of values) {
32895
- if (keys.has(value)) {
34691
+ for (const value of values2) {
34692
+ if (keys2.has(value)) {
32896
34693
  delete newEntries[value];
32897
34694
  } else
32898
34695
  throw new Error(`Key ${value} not found in enum`);
@@ -33168,13 +34965,13 @@ function resolveRef(ref, ctx) {
33168
34965
  if (!ref.startsWith("#")) {
33169
34966
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
33170
34967
  }
33171
- const path6 = ref.slice(1).split("/").filter(Boolean);
33172
- if (path6.length === 0) {
34968
+ const path7 = ref.slice(1).split("/").filter(Boolean);
34969
+ if (path7.length === 0) {
33173
34970
  return ctx.rootSchema;
33174
34971
  }
33175
34972
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
33176
- if (path6[0] === defsKey) {
33177
- const key = path6[1] === void 0 ? void 0 : decodeJSONPointerSegment(path6[1]);
34973
+ if (path7[0] === defsKey) {
34974
+ const key = path7[1] === void 0 ? void 0 : decodeJSONPointerSegment(path7[1]);
33178
34975
  if (!key || !ctx.defs[key]) {
33179
34976
  throw new Error(`Reference not found: ${ref}`);
33180
34977
  }
@@ -33187,8 +34984,8 @@ function checkObjectGuards(objectSchema, guards) {
33187
34984
  const value = payload.value;
33188
34985
  if (typeof value !== "object" || value === null || Array.isArray(value))
33189
34986
  return;
33190
- const keys = Object.getOwnPropertyNames(value);
33191
- if (guards.minProperties !== void 0 && keys.length < guards.minProperties) {
34987
+ const keys2 = Object.getOwnPropertyNames(value);
34988
+ if (guards.minProperties !== void 0 && keys2.length < guards.minProperties) {
33192
34989
  payload.issues.push({
33193
34990
  origin: "object",
33194
34991
  code: "too_small",
@@ -33200,7 +34997,7 @@ function checkObjectGuards(objectSchema, guards) {
33200
34997
  continue: true
33201
34998
  });
33202
34999
  }
33203
- if (guards.maxProperties !== void 0 && keys.length > guards.maxProperties) {
35000
+ if (guards.maxProperties !== void 0 && keys2.length > guards.maxProperties) {
33204
35001
  payload.issues.push({
33205
35002
  origin: "object",
33206
35003
  code: "too_big",
@@ -33213,7 +35010,7 @@ function checkObjectGuards(objectSchema, guards) {
33213
35010
  });
33214
35011
  }
33215
35012
  if (guards.keySchema) {
33216
- for (const key of keys) {
35013
+ for (const key of keys2) {
33217
35014
  const result = guards.keySchema.safeParse(key);
33218
35015
  if (result.success)
33219
35016
  continue;
@@ -33254,9 +35051,9 @@ function canonicalKey(value, seen) {
33254
35051
  }
33255
35052
  return `a${parts2.length}:[${parts2.join(",")}]`;
33256
35053
  }
33257
- const keys = Object.keys(value).sort();
35054
+ const keys2 = Object.keys(value).sort();
33258
35055
  const parts = [];
33259
- for (const k of keys) {
35056
+ for (const k of keys2) {
33260
35057
  const key = canonicalKey(value[k], seen);
33261
35058
  if (key === null)
33262
35059
  return null;
@@ -36620,11 +38417,11 @@ function parseMapDef(def, refs) {
36620
38417
  if (refs.mapStrategy === "record") {
36621
38418
  return parseRecordDef(def, refs);
36622
38419
  }
36623
- const keys = parseDef(def.keyType._def, {
38420
+ const keys2 = parseDef(def.keyType._def, {
36624
38421
  ...refs,
36625
38422
  currentPath: [...refs.currentPath, "items", "items", "0"]
36626
38423
  }) || parseAnyDef(refs);
36627
- const values = parseDef(def.valueType._def, {
38424
+ const values2 = parseDef(def.valueType._def, {
36628
38425
  ...refs,
36629
38426
  currentPath: [...refs.currentPath, "items", "items", "1"]
36630
38427
  }) || parseAnyDef(refs);
@@ -36633,7 +38430,7 @@ function parseMapDef(def, refs) {
36633
38430
  maxItems: 125,
36634
38431
  items: {
36635
38432
  type: "array",
36636
- items: [keys, values],
38433
+ items: [keys2, values2],
36637
38434
  minItems: 2,
36638
38435
  maxItems: 2
36639
38436
  }
@@ -36654,7 +38451,7 @@ function parseNativeEnumDef(def) {
36654
38451
  return typeof object3[object3[key]] !== "number";
36655
38452
  });
36656
38453
  const actualValues = actualKeys.map((key) => object3[key]);
36657
- const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
38454
+ const parsedTypes = Array.from(new Set(actualValues.map((values2) => typeof values2)));
36658
38455
  return {
36659
38456
  type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
36660
38457
  enum: actualValues
@@ -38677,24 +40474,24 @@ var require_scope = __commonJS({
38677
40474
  return;
38678
40475
  return vs.get(keyOrRef);
38679
40476
  }
38680
- scopeRefs(scopeName, values = this._values) {
38681
- return this._reduceValues(values, (name) => {
40477
+ scopeRefs(scopeName, values2 = this._values) {
40478
+ return this._reduceValues(values2, (name) => {
38682
40479
  if (name.scopePath === void 0)
38683
40480
  throw new Error(`CodeGen: name "${name}" has no value`);
38684
40481
  return (0, code_1._)`${scopeName}${name.scopePath}`;
38685
40482
  });
38686
40483
  }
38687
- scopeCode(values = this._values, usedValues, getCode) {
38688
- return this._reduceValues(values, (name) => {
40484
+ scopeCode(values2 = this._values, usedValues, getCode) {
40485
+ return this._reduceValues(values2, (name) => {
38689
40486
  if (name.value === void 0)
38690
40487
  throw new Error(`CodeGen: name "${name}" has no value`);
38691
40488
  return name.value.code;
38692
40489
  }, usedValues, getCode);
38693
40490
  }
38694
- _reduceValues(values, valueCode, usedValues = {}, getCode) {
40491
+ _reduceValues(values2, valueCode, usedValues = {}, getCode) {
38695
40492
  let code = code_1.nil;
38696
- for (const prefix in values) {
38697
- const vs = values[prefix];
40493
+ for (const prefix in values2) {
40494
+ const vs = values2[prefix];
38698
40495
  if (!vs)
38699
40496
  continue;
38700
40497
  const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
@@ -40437,7 +42234,7 @@ var require_fast_deep_equal = __commonJS({
40437
42234
  if (a === b) return true;
40438
42235
  if (a && b && typeof a == "object" && typeof b == "object") {
40439
42236
  if (a.constructor !== b.constructor) return false;
40440
- var length, i, keys;
42237
+ var length, i, keys2;
40441
42238
  if (Array.isArray(a)) {
40442
42239
  length = a.length;
40443
42240
  if (length != b.length) return false;
@@ -40448,13 +42245,13 @@ var require_fast_deep_equal = __commonJS({
40448
42245
  if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
40449
42246
  if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
40450
42247
  if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
40451
- keys = Object.keys(a);
40452
- length = keys.length;
42248
+ keys2 = Object.keys(a);
42249
+ length = keys2.length;
40453
42250
  if (length !== Object.keys(b).length) return false;
40454
42251
  for (i = length; i-- !== 0; )
40455
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
42252
+ if (!Object.prototype.hasOwnProperty.call(b, keys2[i])) return false;
40456
42253
  for (i = length; i-- !== 0; ) {
40457
- var key = keys[i];
42254
+ var key = keys2[i];
40458
42255
  if (!equal(a[key], b[key])) return false;
40459
42256
  }
40460
42257
  return true;
@@ -41617,16 +43414,16 @@ var require_utils = __commonJS({
41617
43414
  return compressIPv6ZeroRun(expanded);
41618
43415
  }
41619
43416
  function normalizeIPv6(host) {
41620
- const bracketed = host[0] === "[" && host[host.length - 1] === "]";
43417
+ const bracketed2 = host[0] === "[" && host[host.length - 1] === "]";
41621
43418
  const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
41622
- if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
41623
- let input2 = bracketed ? host.slice(1, -1) : host;
41624
- if (bracketed && isIPvFuture(input2)) {
43419
+ if (hasBracket && !bracketed2) return { host, isIPV6: false, error: true };
43420
+ let input2 = bracketed2 ? host.slice(1, -1) : host;
43421
+ if (bracketed2 && isIPvFuture(input2)) {
41625
43422
  input2 = input2.toLowerCase();
41626
43423
  return { host: `[${input2}]`, escapedHost: input2, isIPV6: false, isIPVFuture: true };
41627
43424
  }
41628
43425
  if (findToken(input2, ":") < 2) {
41629
- return { host, isIPV6: false, error: bracketed };
43426
+ return { host, isIPV6: false, error: bracketed2 };
41630
43427
  }
41631
43428
  let zoneIdentifier = "";
41632
43429
  const zoneSeparator = input2.indexOf("%");
@@ -41651,8 +43448,8 @@ var require_utils = __commonJS({
41651
43448
  }
41652
43449
  return ind;
41653
43450
  }
41654
- function removeDotSegments(path6) {
41655
- let input2 = path6;
43451
+ function removeDotSegments(path7) {
43452
+ let input2 = path7;
41656
43453
  const output2 = [];
41657
43454
  let nextSlash = -1;
41658
43455
  let len = 0;
@@ -41726,11 +43523,11 @@ var require_utils = __commonJS({
41726
43523
  }
41727
43524
  return output2.join("");
41728
43525
  }
41729
- function removeDotSegmentsRelative(path6) {
41730
- if (path6 === "" || path6[0] === "/") {
41731
- return removeDotSegments(path6);
43526
+ function removeDotSegmentsRelative(path7) {
43527
+ if (path7 === "" || path7[0] === "/") {
43528
+ return removeDotSegments(path7);
41732
43529
  }
41733
- const segments = path6.split("/");
43530
+ const segments = path7.split("/");
41734
43531
  const last = segments.length - 1;
41735
43532
  const output2 = [];
41736
43533
  let trailingDirectory = false;
@@ -42093,8 +43890,8 @@ var require_schemes = __commonJS({
42093
43890
  }
42094
43891
  if (wsComponent.resourceName) {
42095
43892
  const queryIndex = wsComponent.resourceName.indexOf("?");
42096
- const path6 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
42097
- wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
43893
+ const path7 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
43894
+ wsComponent.path = path7 && path7 !== "/" ? path7 : void 0;
42098
43895
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
42099
43896
  wsComponent.resourceName = void 0;
42100
43897
  }
@@ -45333,8 +47130,8 @@ var require_formats = __commonJS({
45333
47130
  "use strict";
45334
47131
  Object.defineProperty(exports, "__esModule", { value: true });
45335
47132
  exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
45336
- function fmtDef(validate2, compare2) {
45337
- return { validate: validate2, compare: compare2 };
47133
+ function fmtDef(validate2, compare3) {
47134
+ return { validate: validate2, compare: compare3 };
45338
47135
  }
45339
47136
  exports.fullFormats = {
45340
47137
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
@@ -47711,7 +49508,7 @@ import { spawn } from "node:child_process";
47711
49508
  import { mkdirSync as mkdirSync2, openSync, writeFileSync as writeFileSync2 } from "node:fs";
47712
49509
  import net from "node:net";
47713
49510
  import os4 from "node:os";
47714
- import path5 from "node:path";
49511
+ import path6 from "node:path";
47715
49512
  import { fileURLToPath as fileURLToPath3 } from "node:url";
47716
49513
  import { parseArgs } from "node:util";
47717
49514
 
@@ -47798,18 +49595,18 @@ function skillsDirs() {
47798
49595
  }
47799
49596
  function linkSkill(skillsDir, source = path.join(packageRoot(), "skills", SKILL)) {
47800
49597
  const link = path.join(skillsDir, SKILL);
47801
- let stat2;
49598
+ let stat3;
47802
49599
  try {
47803
- stat2 = lstatSync(link);
49600
+ stat3 = lstatSync(link);
47804
49601
  } catch {
47805
49602
  }
47806
49603
  let note = "";
47807
- if (stat2?.isSymbolicLink()) {
49604
+ if (stat3?.isSymbolicLink()) {
47808
49605
  const target = path.resolve(skillsDir, readlinkSync(link));
47809
49606
  if (target === source) return `\u2713 Claude skill: ${link} \u2192 ${source}`;
47810
49607
  rmSync(link);
47811
49608
  note = ` (it pointed at ${target})`;
47812
- } else if (stat2) {
49609
+ } else if (stat3) {
47813
49610
  const backup = `${link}.old-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`;
47814
49611
  rmSync(backup, { recursive: true, force: true });
47815
49612
  renameSync(link, backup);
@@ -47973,7 +49770,7 @@ var SPECS = {
47973
49770
  };
47974
49771
  var UsageError = class extends Error {
47975
49772
  };
47976
- function num(v, key, min, max) {
49773
+ function num2(v, key, min, max) {
47977
49774
  const raw = v[key];
47978
49775
  if (raw === void 0) return void 0;
47979
49776
  const x = Number(raw);
@@ -47988,20 +49785,20 @@ function oneOf(v, key, allowed) {
47988
49785
  }
47989
49786
  var str = (v, key) => v[key];
47990
49787
  function imageDir() {
47991
- return path5.join(os4.tmpdir(), "lupa");
49788
+ return path6.join(os4.tmpdir(), "lupa");
47992
49789
  }
47993
49790
  function deliver(v, out, kind) {
47994
49791
  if (!v.images.length) return v.text;
47995
- const base = out ?? path5.join(imageDir(), `${kind}-${Date.now().toString(36)}.png`);
47996
- mkdirSync2(path5.dirname(path5.resolve(base)), { recursive: true });
47997
- const ext = path5.extname(base) || ".png";
47998
- const stem = base.slice(0, base.length - path5.extname(base).length);
47999
- const files = v.images.map((png, i) => {
48000
- const f = path5.resolve(i === 0 ? `${stem}${ext}` : `${stem}-${i + 1}${ext}`);
49792
+ const base = out ?? path6.join(imageDir(), `${kind}-${Date.now().toString(36)}.png`);
49793
+ mkdirSync2(path6.dirname(path6.resolve(base)), { recursive: true });
49794
+ const ext = path6.extname(base) || ".png";
49795
+ const stem = base.slice(0, base.length - path6.extname(base).length);
49796
+ const files2 = v.images.map((png, i) => {
49797
+ const f = path6.resolve(i === 0 ? `${stem}${ext}` : `${stem}-${i + 1}${ext}`);
48001
49798
  writeFileSync2(f, png);
48002
49799
  return f;
48003
49800
  });
48004
- return [v.text, ...files.map((f) => `image: ${f}`)].join("\n");
49801
+ return [v.text, ...files2.map((f) => `image: ${f}`)].join("\n");
48005
49802
  }
48006
49803
  async function run(cmd, v, pos, lupa) {
48007
49804
  const target = pos.length ? pos.join(" ") : void 0;
@@ -48013,9 +49810,9 @@ async function run(cmd, v, pos, lupa) {
48013
49810
  const text2 = await lupa.design({
48014
49811
  target,
48015
49812
  file: file2,
48016
- budget: num(v, "budget", 500, 1e5),
49813
+ budget: num2(v, "budget", 500, 1e5),
48017
49814
  components: oneOf(v, "components", ["auto", "inline", "names"]),
48018
- depth: num(v, "depth", 0, 1e3),
49815
+ depth: num2(v, "depth", 0, 1e3),
48019
49816
  includeHidden: v.hidden === true,
48020
49817
  expandVectors: v.vectors === true,
48021
49818
  assetsDir: str(v, "dir"),
@@ -48029,14 +49826,14 @@ async function run(cmd, v, pos, lupa) {
48029
49826
  ${deliver(await lupa.screenshot({ target, file: file2 }), void 0, "screenshot")}`;
48030
49827
  }
48031
49828
  case "screenshot":
48032
- return deliver(await lupa.screenshot({ target, file: file2, scale: num(v, "scale", 0.1, 4), saveTo: str(v, "full") }), str(v, "out"), "screenshot");
49829
+ return deliver(await lupa.screenshot({ target, file: file2, scale: num2(v, "scale", 0.1, 4), saveTo: str(v, "full") }), str(v, "out"), "screenshot");
48033
49830
  case "assets":
48034
49831
  return lupa.assets({
48035
49832
  target,
48036
49833
  file: file2,
48037
49834
  dir: str(v, "dir"),
48038
49835
  as: oneOf(v, "as", ["auto", "svg", "png"]),
48039
- scale: num(v, "scale", 0.5, 4),
49836
+ scale: num2(v, "scale", 0.5, 4),
48040
49837
  currentColor: v["current-color"] === true
48041
49838
  });
48042
49839
  case "tokens":
@@ -48045,7 +49842,7 @@ ${deliver(await lupa.screenshot({ target, file: file2 }), void 0, "screenshot")}
48045
49842
  if (!target) throw new UsageError("css needs a target (node id or URL)");
48046
49843
  return lupa.css({ target, file: file2 });
48047
49844
  case "outline":
48048
- return lupa.outline({ file: file2, page: str(v, "page"), depth: num(v, "depth", 1, 4) });
49845
+ return lupa.outline({ file: file2, page: str(v, "page"), depth: num2(v, "depth", 1, 4) });
48049
49846
  case "find":
48050
49847
  if (!target) throw new UsageError("find needs a query");
48051
49848
  return lupa.find({
@@ -48055,7 +49852,7 @@ ${deliver(await lupa.screenshot({ target, file: file2 }), void 0, "screenshot")}
48055
49852
  types: v.type?.map((t) => t.toUpperCase()),
48056
49853
  page: str(v, "page"),
48057
49854
  within: str(v, "within"),
48058
- limit: num(v, "limit", 1, 200)
49855
+ limit: num2(v, "limit", 1, 200)
48059
49856
  });
48060
49857
  case "compare": {
48061
49858
  if (!v.url === !v.image) throw new UsageError("compare needs --url (your running page) or --image (a PNG screenshot)");
@@ -48066,7 +49863,7 @@ ${deliver(await lupa.screenshot({ target, file: file2 }), void 0, "screenshot")}
48066
49863
  selector: str(v, "selector"),
48067
49864
  waitFor: str(v, "wait-for"),
48068
49865
  image: str(v, "image"),
48069
- threshold: num(v, "threshold", 0, 1)
49866
+ threshold: num2(v, "threshold", 0, 1)
48070
49867
  });
48071
49868
  return deliver(res, str(v, "out"), "compare");
48072
49869
  }
@@ -48078,7 +49875,7 @@ var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
48078
49875
  function spawnHub(port) {
48079
49876
  const dir = imageDir();
48080
49877
  mkdirSync2(dir, { recursive: true });
48081
- const logFile = path5.join(dir, "hub.log");
49878
+ const logFile = path6.join(dir, "hub.log");
48082
49879
  const log = openSync(logFile, "a");
48083
49880
  const entry = fileURLToPath3(import.meta.url);
48084
49881
  spawn(process.execPath, [...process.execArgv, entry, "serve", "--port", String(port)], {
@@ -48179,16 +49976,16 @@ async function runCli(argv, io = { out: (t) => process.stdout.write(`${t}
48179
49976
  ${USAGE}`);
48180
49977
  return 2;
48181
49978
  }
48182
- let values;
49979
+ let values2;
48183
49980
  let positionals;
48184
49981
  try {
48185
- ({ values, positionals } = parseArgs({ args: rest, options: { ...GLOBAL, ...spec }, allowPositionals: true, strict: true }));
49982
+ ({ values: values2, positionals } = parseArgs({ args: rest, options: { ...GLOBAL, ...spec }, allowPositionals: true, strict: true }));
48186
49983
  } catch (e) {
48187
49984
  io.err(`${e.message}
48188
49985
  Run lupa help.`);
48189
49986
  return 2;
48190
49987
  }
48191
- if (values.help) {
49988
+ if (values2.help) {
48192
49989
  io.out(USAGE);
48193
49990
  return 0;
48194
49991
  }
@@ -48197,7 +49994,7 @@ Run lupa help.`);
48197
49994
  return 0;
48198
49995
  }
48199
49996
  if (cmd === "setup") {
48200
- io.out(await setup({ skillsDir: str(values, "skills-dir"), checkBrowser }));
49997
+ io.out(await setup({ skillsDir: str(values2, "skills-dir"), checkBrowser }));
48201
49998
  return 0;
48202
49999
  }
48203
50000
  if (cmd === "update") {
@@ -48209,8 +50006,8 @@ Run lupa help.`);
48209
50006
  let port;
48210
50007
  let idle;
48211
50008
  try {
48212
- port = num(values, "port", 1, 65535) ?? Number(process.env.LUPA_PORT ?? DEFAULT_PORT);
48213
- idle = num(values, "idle", 0, 7 * 24 * 60) ?? 60;
50009
+ port = num2(values2, "port", 1, 65535) ?? Number(process.env.LUPA_PORT ?? DEFAULT_PORT);
50010
+ idle = num2(values2, "idle", 0, 7 * 24 * 60) ?? 60;
48214
50011
  } catch (e) {
48215
50012
  io.err(e.message);
48216
50013
  return 2;
@@ -48232,7 +50029,7 @@ Run lupa help.`);
48232
50029
  if (!bridge) ({ bridge, fresh } = await joinHub(port, (m) => debug && io.err(`[lupa] ${m}`)));
48233
50030
  const lupa = new Lupa(bridge);
48234
50031
  if (fresh) lupa.pluginWaitMs = 8e3;
48235
- io.out(await run(cmd, values, positionals, lupa));
50032
+ io.out(await run(cmd, values2, positionals, lupa));
48236
50033
  for (const line of [...pluginWarnings(bridge.list()), updateNotice()]) if (line) io.err(`lupa: ${line}`);
48237
50034
  return 0;
48238
50035
  } catch (e) {