@pixerate/editor 0.249.0 → 0.251.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/agent/index.cjs +40 -41
  2. package/dist/agent/index.js +9 -10
  3. package/dist/animation/index.cjs +6 -7
  4. package/dist/animation/index.js +5 -6
  5. package/dist/animation-editor/index.cjs +124 -123
  6. package/dist/animation-editor/index.js +15 -14
  7. package/dist/brushes/index.cjs +1406 -0
  8. package/dist/brushes/index.d.cts +12 -0
  9. package/dist/brushes/index.d.ts +12 -0
  10. package/dist/brushes/index.js +1406 -0
  11. package/dist/brushes/migrate.d.cts +17 -0
  12. package/dist/brushes/migrate.d.ts +17 -0
  13. package/dist/brushes/normalize.d.cts +15 -0
  14. package/dist/brushes/normalize.d.ts +15 -0
  15. package/dist/brushes/presets.d.cts +12 -0
  16. package/dist/brushes/presets.d.ts +12 -0
  17. package/dist/brushes/resolve.d.cts +56 -0
  18. package/dist/brushes/resolve.d.ts +56 -0
  19. package/dist/brushes/schema.d.cts +29 -0
  20. package/dist/brushes/schema.d.ts +29 -0
  21. package/dist/brushes/types.d.cts +323 -0
  22. package/dist/brushes/types.d.ts +323 -0
  23. package/dist/{brushstrokeRender-T3JZST44.js → brushstrokeRender-5PYSKZIJ.js} +9 -8
  24. package/dist/{brushstrokeRender-GCKK7V2I.cjs → brushstrokeRender-7FLLSQEC.cjs} +15 -14
  25. package/dist/canvas/index.cjs +120 -65
  26. package/dist/canvas/index.d.cts +1 -0
  27. package/dist/canvas/index.d.ts +1 -0
  28. package/dist/canvas/index.js +88 -33
  29. package/dist/canvas/stickers.d.cts +35 -0
  30. package/dist/canvas/stickers.d.ts +35 -0
  31. package/dist/chart/index.cjs +159 -160
  32. package/dist/chart/index.js +9 -10
  33. package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
  34. package/dist/{chunk-DOIU7VJG.js → chunk-2ZJ4DT3M.js} +1 -1
  35. package/dist/{chunk-XZNU4DUX.cjs → chunk-3NS5C7FB.cjs} +76 -76
  36. package/dist/{chunk-UTI5IITZ.cjs → chunk-4ZC5QJE2.cjs} +3 -3
  37. package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
  38. package/dist/{chunk-6BIDVPED.js → chunk-5JNA6LLY.js} +1 -1
  39. package/dist/{chunk-RD7RX52G.cjs → chunk-5UEFBM2M.cjs} +207 -18
  40. package/dist/{chunk-WA44NKPF.js → chunk-62Z5WLRA.js} +1 -1
  41. package/dist/{chunk-BVRRIW7F.js → chunk-6GRUVGKU.js} +3 -3
  42. package/dist/{chunk-QARCM66V.js → chunk-6ZZKRH7R.js} +3 -3
  43. package/dist/{chunk-BP6KSGVD.js → chunk-7272D3K2.js} +4 -6
  44. package/dist/{chunk-O75V4ZS3.js → chunk-7P6VF3FG.js} +2 -2
  45. package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
  46. package/dist/{chunk-5RH3VXAK.js → chunk-APX63ILU.js} +4 -100
  47. package/dist/{chunk-W7L4HUT2.cjs → chunk-CJ6TBL2N.cjs} +16 -16
  48. package/dist/{chunk-7PT4RJL5.cjs → chunk-EUIDTZNQ.cjs} +111 -113
  49. package/dist/{chunk-CXXXAZ7H.js → chunk-F6R67I3A.js} +1 -1
  50. package/dist/{chunk-I7NJPHWV.cjs → chunk-FQPUF2W2.cjs} +35 -606
  51. package/dist/{chunk-D5KGAO4Z.js → chunk-GCVFEPJG.js} +2 -573
  52. package/dist/{chunk-LEQKZGQI.js → chunk-GOBOCZZI.js} +1 -1
  53. package/dist/{chunk-PZP2SZIZ.js → chunk-GYMMNCFT.js} +3 -3
  54. package/dist/{chunk-NUTMINJZ.cjs → chunk-H7ET2ISK.cjs} +52 -52
  55. package/dist/chunk-HS6QDWDF.cjs +1029 -0
  56. package/dist/{chunk-T7KQEMAE.cjs → chunk-HUAISCUX.cjs} +18 -18
  57. package/dist/{chunk-YGQVCQTG.js → chunk-ILP77UD6.js} +1 -1
  58. package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
  59. package/dist/{chunk-S6OT6CTS.cjs → chunk-IWEVV63O.cjs} +31 -33
  60. package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
  61. package/dist/{chunk-LP2MCSBE.cjs → chunk-JFHBXNR2.cjs} +88 -88
  62. package/dist/{chunk-IOFVM3L3.cjs → chunk-JPEHXIB5.cjs} +10 -10
  63. package/dist/chunk-JSDND7DF.cjs +173 -0
  64. package/dist/{chunk-36ZTV7WO.js → chunk-L6Y7TSQ4.js} +1 -1
  65. package/dist/{chunk-KYX7NZ5V.cjs → chunk-LFMKWGFL.cjs} +1 -1
  66. package/dist/{chunk-V6DT2CDH.js → chunk-M2TPMYJE.js} +1 -1
  67. package/dist/{chunk-LJZRHVZV.cjs → chunk-M5GLQQWG.cjs} +2 -2
  68. package/dist/{chunk-JEGJP4OW.js → chunk-MHLU6GRJ.js} +196 -7
  69. package/dist/{chunk-KMPM5JM5.js → chunk-MONXNVZK.js} +4 -6
  70. package/dist/chunk-MTKY6K3Q.js +1029 -0
  71. package/dist/{chunk-MOW3JMNG.cjs → chunk-N76AMOKE.cjs} +42 -42
  72. package/dist/{chunk-75K3W4D6.cjs → chunk-NKGB64CW.cjs} +16 -16
  73. package/dist/{chunk-SGPIVHJB.js → chunk-P3K2JCJA.js} +3 -3
  74. package/dist/chunk-PXDIAYB6.cjs +594 -0
  75. package/dist/{chunk-UBRJOIR5.js → chunk-QC3OXRE4.js} +9 -9
  76. package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
  77. package/dist/{chunk-WLJZZHUZ.cjs → chunk-QLSGTCYT.cjs} +23 -23
  78. package/dist/{chunk-7YW7T5TJ.js → chunk-RHPSE2YR.js} +2 -2
  79. package/dist/{chunk-44BMJJVA.cjs → chunk-RUONPPMC.cjs} +8 -8
  80. package/dist/{chunk-LJRCU3BJ.cjs → chunk-SABJMH6M.cjs} +150 -15
  81. package/dist/{chunk-XWOLPNBW.cjs → chunk-SOSBOS5T.cjs} +22 -22
  82. package/dist/chunk-SZTI6EER.js +13 -0
  83. package/dist/{chunk-PPFJHTW5.cjs → chunk-TFF2GTGN.cjs} +22 -24
  84. package/dist/{chunk-2SMMZDMG.cjs → chunk-TLOGFIIV.cjs} +37 -37
  85. package/dist/chunk-TXFWZ5ZJ.js +594 -0
  86. package/dist/chunk-U67EN7GG.cjs +13 -0
  87. package/dist/{chunk-GXAK6Q5J.js → chunk-UFEDHACQ.js} +2 -2
  88. package/dist/{chunk-GA4EU4P3.cjs → chunk-UXETV2NC.cjs} +4 -4
  89. package/dist/{chunk-N4DFDI73.js → chunk-WKMUBATU.js} +1 -1
  90. package/dist/{chunk-3R5P3DVY.cjs → chunk-WRZ6C4TU.cjs} +6 -6
  91. package/dist/{chunk-EJLRBS5Q.js → chunk-WZOGDKCQ.js} +137 -2
  92. package/dist/{chunk-6ADHGQ73.js → chunk-YBAPT7NL.js} +2 -4
  93. package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
  94. package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
  95. package/dist/color/index.cjs +4 -6
  96. package/dist/color/index.js +7 -9
  97. package/dist/effects/helpers.d.cts +6 -0
  98. package/dist/effects/helpers.d.ts +6 -0
  99. package/dist/effects/index.cjs +62 -60
  100. package/dist/effects/index.js +5 -3
  101. package/dist/effects/tools.d.cts +6 -0
  102. package/dist/effects/tools.d.ts +6 -0
  103. package/dist/export/index.cjs +7 -8
  104. package/dist/export/index.js +6 -7
  105. package/dist/extensions/index.cjs +10 -11
  106. package/dist/extensions/index.js +9 -10
  107. package/dist/gradient/index.cjs +33 -34
  108. package/dist/gradient/index.js +4 -5
  109. package/dist/image-editor/effects.d.cts +1 -1
  110. package/dist/image-editor/effects.d.ts +1 -1
  111. package/dist/image-editor/index.cjs +887 -863
  112. package/dist/image-editor/index.d.cts +1 -0
  113. package/dist/image-editor/index.d.ts +1 -0
  114. package/dist/image-editor/index.js +69 -45
  115. package/dist/image-editor/stickers.d.cts +9 -0
  116. package/dist/image-editor/stickers.d.ts +9 -0
  117. package/dist/index.cjs +16 -17
  118. package/dist/index.js +10 -11
  119. package/dist/paint/index.cjs +6 -4
  120. package/dist/paint/index.js +21 -19
  121. package/dist/paint-editor/brushes.d.cts +1 -2
  122. package/dist/paint-editor/brushes.d.ts +1 -2
  123. package/dist/paint-editor/index.cjs +2199 -699
  124. package/dist/paint-editor/index.js +1577 -77
  125. package/dist/paint-editor/mark-settings.d.cts +104 -0
  126. package/dist/paint-editor/mark-settings.d.ts +104 -0
  127. package/dist/paint-editor/procedural.d.cts +2 -75
  128. package/dist/paint-editor/procedural.d.ts +2 -75
  129. package/dist/paint-editor/stickers.d.cts +1 -22
  130. package/dist/paint-editor/stickers.d.ts +1 -22
  131. package/dist/raster/index.cjs +2 -2
  132. package/dist/raster/index.js +9 -9
  133. package/dist/stickers/index.cjs +22 -16
  134. package/dist/stickers/index.d.cts +1 -1
  135. package/dist/stickers/index.d.ts +1 -1
  136. package/dist/stickers/index.js +14 -8
  137. package/dist/stickers/tools.d.cts +57 -1
  138. package/dist/stickers/tools.d.ts +57 -1
  139. package/dist/tokens/index.cjs +3 -4
  140. package/dist/tokens/index.js +2 -3
  141. package/dist/typography/index.cjs +7 -8
  142. package/dist/typography/index.js +2 -3
  143. package/dist/vector/index.cjs +1011 -977
  144. package/dist/vector/index.d.cts +1 -0
  145. package/dist/vector/index.d.ts +1 -0
  146. package/dist/vector/index.js +47 -13
  147. package/dist/vector/stickers.d.cts +11 -0
  148. package/dist/vector/stickers.d.ts +11 -0
  149. package/dist/video-editor/index.cjs +349 -350
  150. package/dist/video-editor/index.js +9 -10
  151. package/package.json +11 -1
  152. package/skills/pixerate-image-editor/SKILL.md +1 -1
  153. package/skills/pixerate-stickers/SKILL.md +13 -1
  154. package/dist/chunk-7AHBW2CQ.cjs +0 -200
  155. package/dist/chunk-F67XMVDI.js +0 -200
  156. package/dist/chunk-H4AOUUBE.cjs +0 -2635
  157. package/dist/chunk-J7T5QZ45.js +0 -2635
  158. package/dist/chunk-ZEYMKDYS.cjs +0 -269
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkGHCSC2WPcjs = require('./chunk-GHCSC2WP.cjs');
6
+ var _chunkISIO63Q5cjs = require('./chunk-ISIO63Q5.cjs');
7
7
 
8
8
 
9
9
  var _chunkWKPXOGZZcjs = require('./chunk-WKPXOGZZ.cjs');
@@ -26,7 +26,7 @@ function documentErrors(doc, description) {
26
26
  const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
27
27
  if (doc.values !== void 0) {
28
28
  if (!isRecord(doc.values)) errors.push({ path: "/values", message: "must be an object of control values" });
29
- else errors.push(..._chunkGHCSC2WPcjs.effectValueErrors.call(void 0, description, doc.values).map((e) => ({ ...e, path: `/values${e.path}` })));
29
+ else errors.push(..._chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, doc.values).map((e) => ({ ...e, path: `/values${e.path}` })));
30
30
  }
31
31
  if (doc.tracks !== void 0) {
32
32
  if (!isRecord(doc.tracks)) errors.push({ path: "/tracks", message: "must be an object of keyframe lists" });
@@ -39,7 +39,7 @@ function documentErrors(doc, description) {
39
39
  kfs.forEach((kf, i) => {
40
40
  if (!isRecord(kf)) return errors.push({ path: `${at}/${i}`, message: "must be a keyframe object" });
41
41
  if (typeof kf.time !== "number" || !Number.isFinite(kf.time) || kf.time < 0) errors.push({ path: `${at}/${i}/time`, message: "must be a finite number of ms >= 0" });
42
- errors.push(..._chunkGHCSC2WPcjs.effectValueErrors.call(void 0, description, { [control]: kf.value }).map((e) => ({ ...e, path: `${at}/${i}/value` })));
42
+ errors.push(..._chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [control]: kf.value }).map((e) => ({ ...e, path: `${at}/${i}/value` })));
43
43
  if (kf.easing !== void 0 && !_chunkDWJJI6RTcjs.isAnimationEasing.call(void 0, kf.easing)) errors.push({ path: `${at}/${i}/easing`, message: "is not a valid easing" });
44
44
  });
45
45
  }
@@ -49,7 +49,7 @@ function documentErrors(doc, description) {
49
49
  else
50
50
  doc.presets.forEach((p, i) => {
51
51
  if (!isRecord(p) || typeof p.name !== "string" || !p.name) return errors.push({ path: `/presets/${i}`, message: "must have a name" });
52
- errors.push(..._chunkGHCSC2WPcjs.effectValueErrors.call(void 0, description, p.values).map((e) => ({ ...e, path: `/presets/${i}/values${e.path}` })));
52
+ errors.push(..._chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, p.values).map((e) => ({ ...e, path: `/presets/${i}/values${e.path}` })));
53
53
  });
54
54
  }
55
55
  if (doc.duration !== void 0 && (typeof doc.duration !== "number" || !Number.isFinite(doc.duration) || !(doc.duration > 0))) {
@@ -170,7 +170,7 @@ async function createEffectAuthoringSession(source, options) {
170
170
  if (isDocumentSource(source)) {
171
171
  const doc = source.document;
172
172
  if (doc.version !== 1 || !doc.effectId) {
173
- throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)("Invalid effect authoring document: version 1 required");
173
+ throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)("Invalid effect authoring document: version 1 required");
174
174
  }
175
175
  effectId = doc.effectId;
176
176
  initialDoc = doc;
@@ -178,15 +178,15 @@ async function createEffectAuthoringSession(source, options) {
178
178
  effectId = source.effectId;
179
179
  requestedPreset = source.preset;
180
180
  } else {
181
- throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)("Invalid effect authoring source");
181
+ throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)("Invalid effect authoring source");
182
182
  }
183
183
  const description = await provider.describe(effectId);
184
184
  if (initialDoc) {
185
185
  const problems = documentErrors(initialDoc, description);
186
- if (problems.length) throw new (0, _chunkGHCSC2WPcjs.EffectControlError)(effectId, problems);
186
+ if (problems.length) throw new (0, _chunkISIO63Q5cjs.EffectControlError)(effectId, problems);
187
187
  }
188
188
  if (description.kind === "motion") {
189
- throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)("Motion effects cannot be authored as pixel effects", effectId);
189
+ throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)("Motion effects cannot be authored as pixel effects", effectId);
190
190
  }
191
191
  let disposed = false;
192
192
  let playing = false;
@@ -207,7 +207,7 @@ async function createEffectAuthoringSession(source, options) {
207
207
  const found = description.presets.find((p) => p.name === requestedPreset);
208
208
  if (!found) {
209
209
  const validNames = description.presets.map((p) => `"${p.name}"`).join(", ");
210
- throw new (0, _chunkGHCSC2WPcjs.EffectUnsupportedError)(
210
+ throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(
211
211
  `Unknown preset "${requestedPreset}" for effect "${effectId}". Valid presets are: ${validNames || "none"}`,
212
212
  effectId
213
213
  );
@@ -321,7 +321,7 @@ async function createEffectAuthoringSession(source, options) {
321
321
  if (!validNames.includes(name)) {
322
322
  return { ok: false, message: `there is no control "${name}"; the controls are ${validNames.join(", ")}` };
323
323
  }
324
- const errors = _chunkGHCSC2WPcjs.effectValueErrors.call(void 0, description, { [name]: value });
324
+ const errors = _chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [name]: value });
325
325
  if (errors.length > 0) {
326
326
  return { ok: false, message: valueErrorMessage(errors) };
327
327
  }
@@ -391,7 +391,7 @@ async function createEffectAuthoringSession(source, options) {
391
391
  if (!validNames.includes(k)) {
392
392
  return { ok: false, message: `there is no control "${k}"; the controls are ${validNames.join(", ")}` };
393
393
  }
394
- const errors = _chunkGHCSC2WPcjs.effectValueErrors.call(void 0, description, { [k]: v });
394
+ const errors = _chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [k]: v });
395
395
  if (errors.length > 0) {
396
396
  return { ok: false, message: valueErrorMessage(errors) };
397
397
  }
@@ -528,7 +528,7 @@ async function createEffectAuthoringSession(source, options) {
528
528
  return { ok: false, message: `invalid easing: ${String(easing)}` };
529
529
  }
530
530
  const targetValue = value !== void 0 ? value : valuesAtTime(time, baseValues, tracks)[name];
531
- const errors = _chunkGHCSC2WPcjs.effectValueErrors.call(void 0, description, { [name]: targetValue });
531
+ const errors = _chunkISIO63Q5cjs.effectValueErrors.call(void 0, description, { [name]: targetValue });
532
532
  if (errors.length > 0) {
533
533
  return { ok: false, message: valueErrorMessage(errors) };
534
534
  }
@@ -705,7 +705,7 @@ async function createEffectAuthoringSession(source, options) {
705
705
  },
706
706
  async createPreview(opts) {
707
707
  if (disposed) {
708
- throw new (0, _chunkGHCSC2WPcjs.EffectDisposedError)(effectId);
708
+ throw new (0, _chunkISIO63Q5cjs.EffectDisposedError)(effectId);
709
709
  }
710
710
  let renderer;
711
711
  try {
@@ -730,7 +730,7 @@ async function createEffectAuthoringSession(source, options) {
730
730
  height: renderer.height,
731
731
  depth: renderer.depth,
732
732
  render: async (req) => {
733
- if (disposed) throw new (0, _chunkGHCSC2WPcjs.EffectDisposedError)(effectId);
733
+ if (disposed) throw new (0, _chunkISIO63Q5cjs.EffectDisposedError)(effectId);
734
734
  const effectiveValues = _nullishCoalesce(req.values, () => ( valuesAtTime(req.time, baseValues, tracks)));
735
735
  const pixels = await renderer.render({
736
736
  ...req,
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkIOFVM3L3cjs = require('./chunk-IOFVM3L3.cjs');
8
+ var _chunkJPEHXIB5cjs = require('./chunk-JPEHXIB5.cjs');
9
9
 
10
10
 
11
11
  var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
@@ -1361,12 +1361,12 @@ var unit = (x, y) => {
1361
1361
  return l > 1e-12 && Number.isFinite(l) ? [x / l, y / l] : null;
1362
1362
  };
1363
1363
  function cubicOf(sp, i) {
1364
- const s = _chunkIOFVM3L3cjs.subpathSegment.call(void 0, sp, i);
1364
+ const s = _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, i);
1365
1365
  if (s.length === 4) return s;
1366
1366
  const [a, b] = s;
1367
1367
  return [a, [a[0] + (b[0] - a[0]) / 3, a[1] + (b[1] - a[1]) / 3], [a[0] + 2 * (b[0] - a[0]) / 3, a[1] + 2 * (b[1] - a[1]) / 3], b];
1368
1368
  }
1369
- var isLine = (sp, i) => _chunkIOFVM3L3cjs.subpathSegment.call(void 0, sp, i).length === 2;
1369
+ var isLine = (sp, i) => _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, i).length === 2;
1370
1370
  function startTangent(c) {
1371
1371
  for (let k = 1; k < 4; k++) {
1372
1372
  const u = unit(c[k][0] - c[0][0], c[k][1] - c[0][1]);
@@ -1386,10 +1386,10 @@ function sample(c, n, out, withStart) {
1386
1386
  }
1387
1387
  var onAnchor = (a, h) => !h || Math.abs(h.x - a.x) < EPS && Math.abs(h.y - a.y) < EPS;
1388
1388
  function tidy(a, keepType = true) {
1389
- const next = _chunkIOFVM3L3cjs.cloneAnchor.call(void 0, a);
1389
+ const next = _chunkJPEHXIB5cjs.cloneAnchor.call(void 0, a);
1390
1390
  if (onAnchor(next, next.in)) delete next.in;
1391
1391
  if (onAnchor(next, next.out)) delete next.out;
1392
- const shown = _chunkIOFVM3L3cjs.inferAnchorType.call(void 0, next);
1392
+ const shown = _chunkJPEHXIB5cjs.inferAnchorType.call(void 0, next);
1393
1393
  const type = keepType && a.type ? a.type === "symmetric" && shown !== "symmetric" ? shown === "corner" ? "corner" : "smooth" : a.type === "smooth" && shown === "corner" ? "corner" : a.type : shown;
1394
1394
  if (type === "corner") delete next.type;
1395
1395
  else next.type = type;
@@ -1433,7 +1433,7 @@ function fitAcross(pts, N, t0, t1) {
1433
1433
  return goldenMin(fit, 0, 1);
1434
1434
  }
1435
1435
  function removeAnchorKeepingShape(sp, index) {
1436
- const anchors = sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor);
1436
+ const anchors = sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor);
1437
1437
  const n = anchors.length;
1438
1438
  if (index < 0 || index >= n) return { anchors, closed: sp.closed };
1439
1439
  if ((sp.closed || index > 0 && index < n - 1) && n >= 3) {
@@ -1467,12 +1467,12 @@ function removeAnchorKeepingShape(sp, index) {
1467
1467
  }
1468
1468
  function removeAnchorsKeepingShape(sp, indices) {
1469
1469
  const order = [...new Set(indices)].filter((i) => i >= 0 && i < sp.anchors.length).sort((a, b) => b - a);
1470
- return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor), closed: sp.closed });
1470
+ return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed });
1471
1471
  }
1472
1472
  function bendSegment(sp, segment, t, p) {
1473
- const anchors = sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor);
1473
+ const anchors = sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor);
1474
1474
  const n = anchors.length;
1475
- if (segment < 0 || segment >= _chunkIOFVM3L3cjs.subpathSegmentCount.call(void 0, sp) || !Number.isFinite(t) || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return { anchors, closed: sp.closed };
1475
+ if (segment < 0 || segment >= _chunkJPEHXIB5cjs.subpathSegmentCount.call(void 0, sp) || !Number.isFinite(t) || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return { anchors, closed: sp.closed };
1476
1476
  const tc = Math.min(0.95, Math.max(0.05, t));
1477
1477
  const ia = segment;
1478
1478
  const ib = (segment + 1) % n;
@@ -1483,16 +1483,16 @@ function bendSegment(sp, segment, t, p) {
1483
1483
  const oy = (p.y - (a.y + (b.y - a.y) * tc)) / k;
1484
1484
  const c1 = { x: a.x + (b.x - a.x) / 3 + ox, y: a.y + (b.y - a.y) / 3 + oy };
1485
1485
  const c2 = { x: b.x + (a.x - b.x) / 3 + ox, y: b.y + (a.y - b.y) / 3 + oy };
1486
- anchors[ia] = _chunkIOFVM3L3cjs.moveAnchorHandle.call(void 0, a, "out", c1);
1487
- anchors[ib] = _chunkIOFVM3L3cjs.moveAnchorHandle.call(void 0, b, "in", c2);
1486
+ anchors[ia] = _chunkJPEHXIB5cjs.moveAnchorHandle.call(void 0, a, "out", c1);
1487
+ anchors[ib] = _chunkJPEHXIB5cjs.moveAnchorHandle.call(void 0, b, "in", c2);
1488
1488
  return { anchors, closed: sp.closed };
1489
1489
  }
1490
1490
  function subpathPointAt(sp, segment, t) {
1491
- const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0, _chunkIOFVM3L3cjs.subpathSegment.call(void 0, sp, segment), t);
1491
+ const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0, _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, segment), t);
1492
1492
  return { x, y };
1493
1493
  }
1494
1494
  function curvatureMoveAnchor(sp, index, q) {
1495
- const anchors = sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor);
1495
+ const anchors = sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor);
1496
1496
  const a = sp.anchors[index];
1497
1497
  if (!a) return { anchors, closed: sp.closed };
1498
1498
  const own = [
@@ -1538,7 +1538,7 @@ function curvatureMoveAnchor(sp, index, q) {
1538
1538
  function cutSubpathAt(sp, at) {
1539
1539
  const n = sp.anchors.length;
1540
1540
  const cuts = [...new Set(at)].filter((i) => Number.isInteger(i) && i >= 0 && i < n && (sp.closed || i > 0 && i < n - 1)).sort((a, b) => a - b);
1541
- if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor), closed: sp.closed }];
1541
+ if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed }];
1542
1542
  const first = cuts[0];
1543
1543
  const run = sp.closed ? Array.from({ length: n + 1 }, (_, i) => sp.anchors[(first + i) % n]) : sp.anchors;
1544
1544
  const cutSet = new Set(sp.closed ? [...cuts.map((c) => (c - first + n) % n), n] : cuts);
@@ -1546,7 +1546,7 @@ function cutSubpathAt(sp, at) {
1546
1546
  let cur = [];
1547
1547
  run.forEach((a, i) => {
1548
1548
  if (!cutSet.has(i)) {
1549
- cur.push(_chunkIOFVM3L3cjs.cloneAnchor.call(void 0, a));
1549
+ cur.push(_chunkJPEHXIB5cjs.cloneAnchor.call(void 0, a));
1550
1550
  return;
1551
1551
  }
1552
1552
  if (cur.length) {
@@ -1561,10 +1561,10 @@ function cutSubpathAt(sp, at) {
1561
1561
  }
1562
1562
  function splitSubpathAt(sp, segment, t, endTolerance = 1e-6) {
1563
1563
  const n = sp.anchors.length;
1564
- if (segment < 0 || segment >= _chunkIOFVM3L3cjs.subpathSegmentCount.call(void 0, sp)) return [{ anchors: sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor), closed: sp.closed }];
1564
+ if (segment < 0 || segment >= _chunkJPEHXIB5cjs.subpathSegmentCount.call(void 0, sp)) return [{ anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed }];
1565
1565
  if (t <= endTolerance) return cutSubpathAt(sp, [segment]);
1566
1566
  if (t >= 1 - endTolerance) return cutSubpathAt(sp, [(segment + 1) % n]);
1567
- const { subpath, index } = _chunkIOFVM3L3cjs.insertAnchor.call(void 0, sp, segment, t);
1567
+ const { subpath, index } = _chunkJPEHXIB5cjs.insertAnchor.call(void 0, sp, segment, t);
1568
1568
  return cutSubpathAt(subpath, [index]);
1569
1569
  }
1570
1570
  var endOf = (sp, last) => sp.anchors[last ? sp.anchors.length - 1 : 0];
@@ -1587,7 +1587,7 @@ function joinSubpaths(subpaths, tolerance) {
1587
1587
  const closed = [];
1588
1588
  let open = [];
1589
1589
  for (const sp of subpaths) {
1590
- const copy = { anchors: sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor), closed: sp.closed };
1590
+ const copy = { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed };
1591
1591
  if (sp.closed || sp.anchors.length < 2) {
1592
1592
  if (sp.anchors.length) closed.push(copy);
1593
1593
  } else open.push(copy);
@@ -1642,7 +1642,7 @@ function smoothSubpath(sp, amount = 1, only) {
1642
1642
  const t = Math.min(1, Math.max(0, amount));
1643
1643
  const orig = sp.anchors;
1644
1644
  const n = orig.length;
1645
- const anchors = orig.map(_chunkIOFVM3L3cjs.cloneAnchor);
1645
+ const anchors = orig.map(_chunkJPEHXIB5cjs.cloneAnchor);
1646
1646
  if (n < 3 || t === 0) return { anchors, closed: sp.closed };
1647
1647
  for (let i = 0; i < n; i++) {
1648
1648
  if (!sp.closed && (i === 0 || i === n - 1)) continue;
@@ -1671,8 +1671,8 @@ function smoothSubpath(sp, amount = 1, only) {
1671
1671
  }
1672
1672
  function segsOf(sp) {
1673
1673
  const out = [];
1674
- for (let i = 0; i < _chunkIOFVM3L3cjs.subpathSegmentCount.call(void 0, sp); i++) {
1675
- const s = _chunkIOFVM3L3cjs.subpathSegment.call(void 0, sp, i);
1674
+ for (let i = 0; i < _chunkJPEHXIB5cjs.subpathSegmentCount.call(void 0, sp); i++) {
1675
+ const s = _chunkJPEHXIB5cjs.subpathSegment.call(void 0, sp, i);
1676
1676
  out.push(s.length === 2 ? { c: s, line: true } : { c: s, line: false });
1677
1677
  }
1678
1678
  return out;
@@ -1729,7 +1729,7 @@ function removeRedundantPoints(sp, tolerance) {
1729
1729
  const tol = Math.max(tolerance, 1e-9);
1730
1730
  const types = new Map(sp.anchors.filter((a) => a.type).map((a) => [`${a.x},${a.y}`, a.type]));
1731
1731
  const segs = segsOf(sp).filter((s) => !isZeroSeg(s));
1732
- if (!segs.length) return { anchors: sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor), closed: sp.closed };
1732
+ if (!segs.length) return { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed };
1733
1733
  const minSegs = sp.closed ? 2 : 1;
1734
1734
  let changed = true;
1735
1735
  while (changed && segs.length > minSegs) {
@@ -1747,7 +1747,7 @@ function removeRedundantPoints(sp, tolerance) {
1747
1747
  break;
1748
1748
  }
1749
1749
  }
1750
- return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(_chunkIOFVM3L3cjs.cloneAnchor), closed: sp.closed }));
1750
+ return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(_chunkJPEHXIB5cjs.cloneAnchor), closed: sp.closed }));
1751
1751
  }
1752
1752
 
1753
1753
 
@@ -14,7 +14,7 @@ import {
14
14
  r2,
15
15
  sameChartSelection,
16
16
  summarizeChartSeries
17
- } from "./chunk-N4DFDI73.js";
17
+ } from "./chunk-WKMUBATU.js";
18
18
  import {
19
19
  CHART_TYPE_LABELS,
20
20
  DEFAULT_CHART_PALETTE,
@@ -47,7 +47,7 @@ import {
47
47
  parseChartValue,
48
48
  shadeChartColor,
49
49
  uniqueChartSeriesId
50
- } from "./chunk-QARCM66V.js";
50
+ } from "./chunk-6ZZKRH7R.js";
51
51
  import {
52
52
  parseCsv,
53
53
  parseTsv
@@ -11,10 +11,10 @@ var _chunkYN6JKAUEcjs = require('./chunk-YN6JKAUE.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunkT7KQEMAEcjs = require('./chunk-T7KQEMAE.cjs');
14
+ var _chunkHUAISCUXcjs = require('./chunk-HUAISCUX.cjs');
15
15
 
16
16
 
17
- var _chunk3R5P3DVYcjs = require('./chunk-3R5P3DVY.cjs');
17
+ var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
18
18
 
19
19
  // src/export/images.ts
20
20
  var DOCX_IMAGE_TYPES = {
@@ -1028,12 +1028,12 @@ var DocxBuilder = (_class2 = class {
1028
1028
  this.drop("node", "chart", "chart has no spec");
1029
1029
  return;
1030
1030
  }
1031
- const spec = _chunk3R5P3DVYcjs.normalizeChartSpec.call(void 0, raw).spec;
1032
- const written = _chunkT7KQEMAEcjs.chartToOoxml.call(void 0, spec);
1031
+ const spec = _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, raw).spec;
1032
+ const written = _chunkHUAISCUXcjs.chartToOoxml.call(void 0, spec);
1033
1033
  for (const issue of written.issues) this.drop("node", "chart", issue);
1034
1034
  const name = `chart${this.charts.length + 1}.xml`;
1035
1035
  this.charts.push(written.xml);
1036
- const relId = this.rels.add(_chunkT7KQEMAEcjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
1036
+ const relId = this.rels.add(_chunkHUAISCUXcjs.CHART_OOXML_RELATIONSHIP, `charts/${name}`);
1037
1037
  let width = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _91 => _91.attrs, 'optionalAccess', _92 => _92.width])), () => ( MAX_IMAGE_WIDTH_PX));
1038
1038
  let height = _nullishCoalesce(pixelAttr(_optionalChain([node, 'access', _93 => _93.attrs, 'optionalAccess', _94 => _94.height])), () => ( 320));
1039
1039
  if (width > MAX_IMAGE_WIDTH_PX) {
@@ -1050,8 +1050,8 @@ var DocxBuilder = (_class2 = class {
1050
1050
  drawing.empty("wp:extent", { cx, cy }).empty("wp:effectExtent", { l: 0, t: 0, r: 0, b: 0 });
1051
1051
  drawing.empty("wp:docPr", { id, name: `Chart ${id}`, descr: title || void 0, title: title || void 0 });
1052
1052
  drawing.empty("wp:cNvGraphicFramePr");
1053
- drawing.open("a:graphic").open("a:graphicData", { uri: _chunkT7KQEMAEcjs.CHART_OOXML_NS });
1054
- drawing.empty("c:chart", { "xmlns:c": _chunkT7KQEMAEcjs.CHART_OOXML_NS, "r:id": relId });
1053
+ drawing.open("a:graphic").open("a:graphicData", { uri: _chunkHUAISCUXcjs.CHART_OOXML_NS });
1054
+ drawing.empty("c:chart", { "xmlns:c": _chunkHUAISCUXcjs.CHART_OOXML_NS, "r:id": relId });
1055
1055
  drawing.close("a:graphicData").close("a:graphic").close("wp:inline").close("w:drawing").close("w:r");
1056
1056
  this.report.written.paragraphs++;
1057
1057
  w.open("w:p");
@@ -1384,7 +1384,7 @@ var DocxBuilder = (_class2 = class {
1384
1384
  if (people) add("word/people.xml", people, `${CT_WML}people+xml`);
1385
1385
  parts.push({ name: "word/_rels/document.xml.rels", data: this.rels.xml() });
1386
1386
  for (const file of this.media) parts.push({ name: `word/media/${file.name}`, data: file.bytes });
1387
- this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunkT7KQEMAEcjs.CHART_OOXML_CONTENT_TYPE));
1387
+ this.charts.forEach((xml, i) => add(`word/charts/chart${i + 1}.xml`, xml, _chunkHUAISCUXcjs.CHART_OOXML_CONTENT_TYPE));
1388
1388
  add("docProps/core.xml", this.coreXml(now), "application/vnd.openxmlformats-package.core-properties+xml");
1389
1389
  const app = new XmlWriter();
1390
1390
  app.open("Properties", { xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" });
@@ -5,11 +5,140 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkZEYMKDYScjs = require('./chunk-ZEYMKDYS.cjs');
8
+
9
+
10
+
11
+ var _chunkJSDND7DFcjs = require('./chunk-JSDND7DF.cjs');
12
+
13
+
14
+ var _chunkU67EN7GGcjs = require('./chunk-U67EN7GG.cjs');
9
15
 
10
16
 
11
17
  var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
12
18
 
19
+ // src/stickers/tools.ts
20
+ var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
21
+ var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
22
+ function stickerForAgent(provider, s) {
23
+ const { id, thumbnail: _thumbnail, ...rest } = s;
24
+ return { ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, id), ...rest };
25
+ }
26
+ async function knownRefs(provider, cap = 500) {
27
+ const refs = [];
28
+ let after;
29
+ while (refs.length < cap) {
30
+ const page = await provider.list({ limit: _chunkJSDND7DFcjs.MAX_STICKER_PAGE, ...after ? { after } : {} });
31
+ refs.push(...page.items.map((s) => _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, s.id)));
32
+ if (!page.next || !page.items.length) break;
33
+ after = page.next;
34
+ }
35
+ return refs;
36
+ }
37
+ async function describeStickerRef(provider, ref) {
38
+ _chunkJSDND7DFcjs.parseStickerRef.call(void 0, ref);
39
+ const id = _chunkJSDND7DFcjs.stickerIdFor.call(void 0, provider, ref);
40
+ const found = id === null ? void 0 : await provider.describe(id);
41
+ if (found) return found;
42
+ const near = _chunkJSDND7DFcjs.closestStickerRefs.call(void 0, ref, await knownRefs(provider));
43
+ const owner = _chunkJSDND7DFcjs.parseStickerRef.call(void 0, ref).provider;
44
+ const where = id === null && !provider.namespaced ? ` The sticker library is "${provider.id}", not "${owner}".` : "";
45
+ throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `No sticker "${ref}".${where} Closest: ${near.join(", ") || "none"}; find_stickers lists them.`);
46
+ }
47
+ function createStickerTools(options) {
48
+ const find = {
49
+ name: "find_stickers",
50
+ title: "Find stickers",
51
+ description: "Searches the sticker library (the editor's own stamps unless the host plugged in its own): words in the name, tags, category or description, filtered by category, tags and commercial licence, a small page at a time. Returns each sticker's ref (provider:id, for the tools that spray or place stickers), name, category, tags, natural width and height, formats, whether it is tintable (recoloured to the paint colour) and its licence, plus total and next (pass as after for the next page) and the categories. Changes nothing.",
52
+ inputSchema: {
53
+ type: "object",
54
+ properties: {
55
+ query: { type: "string", maxLength: 200, description: "Words to match (default: list everything)." },
56
+ category: { type: "string", description: "Only this category (the result lists them)." },
57
+ tags: { type: "array", maxItems: 10, items: { type: "string", description: "A tag." }, description: "Only stickers with every one of these tags." },
58
+ commercial: { type: "boolean", description: "true: only stickers whose licence allows commercial use." },
59
+ limit: { type: "integer", minimum: 1, maximum: _chunkJSDND7DFcjs.MAX_STICKER_PAGE, description: "Page size (default 24)." },
60
+ after: { type: "string", description: "next from the previous page." }
61
+ },
62
+ additionalProperties: false
63
+ },
64
+ annotations: { title: "Find stickers", ...READ },
65
+ handler: async ({ query, category, tags, commercial, limit, after }) => {
66
+ const p = options.provider();
67
+ const categories = await _asyncNullishCoalesce(await _optionalChain([p, 'access', _2 => _2.categories, 'optionalCall', _3 => _3()]), async () => ( null));
68
+ if (category !== void 0 && categories && !categories.some((c) => c.id === category)) {
69
+ throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `No category "${category}" in "${p.name}"; categories: ${categories.map((c) => c.id).join(", ")}.`);
70
+ }
71
+ const o = { ...category !== void 0 ? { category } : {}, ...tags ? { tags } : {}, ...commercial ? { licence: { commercial: true } } : {}, ...limit !== void 0 ? { limit } : {}, ...after !== void 0 ? { after } : {} };
72
+ const q = typeof query === "string" ? query.trim() : "";
73
+ if (q && !p.capabilities.supportsSearch) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `"${p.name}" can't search; leave query out and filter by category instead.`);
74
+ const page = q ? await p.search(q, o) : await p.list(o);
75
+ return { provider: p.id, items: page.items.map((s) => stickerForAgent(p, s)), total: page.total, ...page.next ? { next: page.next } : {}, ...categories ? { categories } : {} };
76
+ }
77
+ };
78
+ const describe = {
79
+ name: "describe_sticker",
80
+ title: "Describe a sticker",
81
+ description: "Everything about one sticker by ref (from find_stickers): name, category, tags, natural size, formats, tintable, licence (with any attribution it asks for), dominant colours, variants and its outline as SVG path data (silhouette). An unknown ref is refused with the closest refs. Changes nothing.",
82
+ inputSchema: { type: "object", properties: { ref: { type: "string", description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." } }, required: ["ref"], additionalProperties: false },
83
+ annotations: { title: "Describe a sticker", ...READ },
84
+ handler: async ({ ref }) => {
85
+ const p = options.provider();
86
+ const d = await describeStickerRef(p, ref);
87
+ const { thumbnail: _thumbnail, id, ...rest } = d;
88
+ return { ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, p, id), ...rest };
89
+ }
90
+ };
91
+ return options.insert ? [find, describe, createInsertStickerTool(options.provider, options.insert)] : [find, describe];
92
+ }
93
+ async function loadForHost(provider, ref, d, host, colour, size) {
94
+ const id = _chunkJSDND7DFcjs.stickerIdFor.call(void 0, provider, ref);
95
+ const format = d.formats.includes(host.format) ? host.format : _nullishCoalesce(d.formats[0], () => ( host.format));
96
+ return provider.load(id, { format, ...format === "png" ? { size: Math.max(8, Math.min(_nullishCoalesce(provider.capabilities.maxSize, () => ( 1024)), Math.round(size))) } : {}, ...colour && d.tintable ? { colour } : {} });
97
+ }
98
+ async function insertSticker(provider, host, options) {
99
+ const d = await describeStickerRef(provider, options.ref);
100
+ if (options.color !== void 0 && !d.tintable) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `"${options.ref}" is not tintable (its art has its own colours); leave color out, or pick a tintable sticker (find_stickers lists tintable).`);
101
+ if (options.width !== void 0 && !(options.width > 0)) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `width must be a positive size, got ${options.width}.`);
102
+ const w = _nullishCoalesce(options.width, () => ( d.width));
103
+ const h = w * d.height / d.width;
104
+ const centre = host.defaultCentre();
105
+ const asset = await loadForHost(provider, options.ref, d, host, options.color, Math.max(w, h));
106
+ const ref = _chunkJSDND7DFcjs.stickerRefOf.call(void 0, provider, d.id);
107
+ const made = await host.insert({ ref, description: d, asset, x: _nullishCoalesce(options.x, () => ( centre.x)), y: _nullishCoalesce(options.y, () => ( centre.y)), width: w, height: h, ...options.color ? { colour: options.color.toLowerCase() } : {} });
108
+ return { ...made, ref, width: w, height: h, licence: d.licence };
109
+ }
110
+ function createInsertStickerTool(provider, host) {
111
+ return {
112
+ name: "insert_sticker",
113
+ title: "Insert a sticker",
114
+ description: `Puts one sticker from the sticker library (ref from find_stickers) into the document as a new ${host.noun}, centred at x, y and width wide (its natural aspect kept; default its natural size), tinted to color when the sticker is tintable. Its art is loaded first; an unknown ref is refused with the closest ones. One undo step. Returns the new ${host.noun}'s id (for the editor's own tools, such as effects on it), the ref and its licence (credit any attribution it asks for).`,
115
+ inputSchema: {
116
+ type: "object",
117
+ properties: {
118
+ ref: { type: "string", minLength: 1, description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." },
119
+ x: { type: "number", description: "Centre x in document units (default the middle of the view or document)." },
120
+ y: { type: "number", description: "Centre y in document units (default the middle of the view or document)." },
121
+ width: { type: "number", exclusiveMinimum: 0, maximum: 1e4, description: "Width in document units (default the natural width); the height follows the aspect." },
122
+ color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "Tint #rrggbb for tintable stickers (default the sticker's own colour); refused for stickers that are not tintable." }
123
+ },
124
+ required: ["ref"],
125
+ additionalProperties: false
126
+ },
127
+ annotations: { title: "Insert a sticker", ...WRITE },
128
+ handler: ({ ref, x, y, width, color }) => insertSticker(provider(), host, { ref, x, y, width, color })
129
+ };
130
+ }
131
+ function createStickerToolProvider(options) {
132
+ return {
133
+ id: _nullishCoalesce(options.id, () => ( "stickers")),
134
+ namespace: options.namespace,
135
+ title: "Stickers",
136
+ description: "Find and describe stickers from the sticker library, by ref (provider:id), for the editors that spray or place them.",
137
+ skill: "pixerate-stickers",
138
+ tools: createStickerTools(options)
139
+ };
140
+ }
141
+
13
142
  // src/stickers/editor.ts
14
143
  var BOX = 100;
15
144
  var GRID = 128;
@@ -30,7 +159,7 @@ var HEX = /^#[0-9a-fA-F]{6}$/;
30
159
  function stampOutline(kind) {
31
160
  const n = GRID;
32
161
  const f = new Float32Array((n + 1) * (n + 1));
33
- for (let j = 0; j <= n; j++) for (let i = 0; i <= n; i++) f[j * (n + 1) + i] = _chunkZEYMKDYScjs.stampCoverage.call(void 0, kind, i / n * 2 - 1, j / n * 2 - 1, SHAPE_SEED) - 0.5;
162
+ for (let j = 0; j <= n; j++) for (let i = 0; i <= n; i++) f[j * (n + 1) + i] = _chunkJSDND7DFcjs.stampCoverage.call(void 0, kind, i / n * 2 - 1, j / n * 2 - 1, SHAPE_SEED) - 0.5;
34
163
  const at = (i, j) => f[j * (n + 1) + i];
35
164
  const points = /* @__PURE__ */ new Map();
36
165
  const point = (key, i0, j0, i1, j1) => {
@@ -167,7 +296,7 @@ function stampPixels(kind, size, colour) {
167
296
  for (let y = 0; y < size; y++) {
168
297
  for (let x = 0; x < size; x++) {
169
298
  let c = 0;
170
- for (let sy = 0; sy < ss; sy++) for (let sx = 0; sx < ss; sx++) c += _chunkZEYMKDYScjs.stampCoverage.call(void 0, kind, (x + (sx + 0.5) / ss) / size * 2 - 1, (y + (sy + 0.5) / ss) / size * 2 - 1, SHAPE_SEED);
299
+ for (let sy = 0; sy < ss; sy++) for (let sx = 0; sx < ss; sx++) c += _chunkJSDND7DFcjs.stampCoverage.call(void 0, kind, (x + (sx + 0.5) / ss) / size * 2 - 1, (y + (sy + 0.5) / ss) / size * 2 - 1, SHAPE_SEED);
171
300
  const a = Math.round(c / (ss * ss) * 255);
172
301
  if (!a) continue;
173
302
  const i = (y * size + x) * 4;
@@ -189,32 +318,32 @@ function editorStickers() {
189
318
  return { id: k, name: m.name, category: m.category, tags: m.tags, description: m.description, width: BOX, height: BOX, thumbnail: thumbs.get(k), formats: ["svg", "png"], licence: { ...LICENCE }, tintable: true };
190
319
  };
191
320
  const kind = (id) => {
192
- if (!_chunkZEYMKDYScjs.STAMP_KINDS.includes(id)) throw new (0, _chunkZEYMKDYScjs.StickerError)("unknown_sticker", `The editor has no sticker "${id}"; its stickers are ${_chunkZEYMKDYScjs.STAMP_KINDS.join(", ")}.`);
321
+ if (!_chunkJSDND7DFcjs.STAMP_KINDS.includes(id)) throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `The editor has no sticker "${id}"; its stickers are ${_chunkJSDND7DFcjs.STAMP_KINDS.join(", ")}.`);
193
322
  return id;
194
323
  };
195
324
  return {
196
- id: _chunkZEYMKDYScjs.EDITOR_STICKERS_ID,
325
+ id: _chunkJSDND7DFcjs.EDITOR_STICKERS_ID,
197
326
  name: "Editor stickers",
198
327
  version: "1",
199
328
  capabilities: { supportsSearch: true, supportsSvg: true, supportsRaster: true, maxSize: 1024 },
200
- list: (options) => _chunkZEYMKDYScjs.stickerPage.call(void 0, _chunkZEYMKDYScjs.STAMP_KINDS.map(summary), options),
201
- search: (query, options) => _chunkZEYMKDYScjs.stickerPage.call(void 0, _chunkZEYMKDYScjs.STAMP_KINDS.map(summary), options, query),
329
+ list: (options) => _chunkJSDND7DFcjs.stickerPage.call(void 0, _chunkJSDND7DFcjs.STAMP_KINDS.map(summary), options),
330
+ search: (query, options) => _chunkJSDND7DFcjs.stickerPage.call(void 0, _chunkJSDND7DFcjs.STAMP_KINDS.map(summary), options, query),
202
331
  describe(id) {
203
- if (!_chunkZEYMKDYScjs.STAMP_KINDS.includes(id)) return void 0;
332
+ if (!_chunkJSDND7DFcjs.STAMP_KINDS.includes(id)) return void 0;
204
333
  const k = id;
205
334
  return { ...summary(k), silhouette: outline(k), colours: [META[k].colour] };
206
335
  },
207
- categories: () => [...new Set(_chunkZEYMKDYScjs.STAMP_KINDS.map((k) => META[k].category))].map((c) => ({ id: c, name: c[0].toUpperCase() + c.slice(1), count: _chunkZEYMKDYScjs.STAMP_KINDS.filter((k) => META[k].category === c).length })),
336
+ categories: () => [...new Set(_chunkJSDND7DFcjs.STAMP_KINDS.map((k) => META[k].category))].map((c) => ({ id: c, name: c[0].toUpperCase() + c.slice(1), count: _chunkJSDND7DFcjs.STAMP_KINDS.filter((k) => META[k].category === c).length })),
208
337
  load(id, options = {}) {
209
338
  const k = kind(id);
210
339
  const colour = _nullishCoalesce(options.colour, () => ( META[k].colour));
211
- if (!HEX.test(colour)) throw new (0, _chunkZEYMKDYScjs.StickerError)("invalid_argument", `colour ${JSON.stringify(colour)} must be #rrggbb.`);
340
+ if (!HEX.test(colour)) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `colour ${JSON.stringify(colour)} must be #rrggbb.`);
212
341
  if (options.format === "png") {
213
342
  const size = _nullishCoalesce(options.size, () => ( 256));
214
- if (!(Number.isInteger(size) && size >= 8 && size <= 1024)) throw new (0, _chunkZEYMKDYScjs.StickerError)("invalid_argument", `size must be a whole number of px from 8 to 1024, got ${size}.`);
343
+ if (!(Number.isInteger(size) && size >= 8 && size <= 1024)) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `size must be a whole number of px from 8 to 1024, got ${size}.`);
215
344
  return { kind: "image", url: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, size, size, stampPixels(k, size, colour.toLowerCase())), width: size, height: size };
216
345
  }
217
- if (options.format !== void 0 && options.format !== "svg") throw new (0, _chunkZEYMKDYScjs.StickerError)("unsupported_format", `format must be svg or png, got ${JSON.stringify(options.format)}.`);
346
+ if (options.format !== void 0 && options.format !== "svg") throw new (0, _chunkU67EN7GGcjs.StickerError)("unsupported_format", `format must be svg or png, got ${JSON.stringify(options.format)}.`);
218
347
  const d = outline(k);
219
348
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${BOX} ${BOX}" width="${BOX}" height="${BOX}"><path fill="${colour.toLowerCase()}" fill-rule="evenodd" d="${d}"/></svg>`;
220
349
  return { kind: "svg", svg, silhouette: d };
@@ -253,7 +382,7 @@ var StickerBrowser = (_class = class {
253
382
  this.next = void 0;
254
383
  this.set({ loading: true, error: null, items: [], total: 0, hasMore: false, provider: p.name });
255
384
  try {
256
- const categories = await _asyncNullishCoalesce(await _optionalChain([p, 'access', _2 => _2.categories, 'optionalCall', _3 => _3()]), async () => ( []));
385
+ const categories = await _asyncNullishCoalesce(await _optionalChain([p, 'access', _4 => _4.categories, 'optionalCall', _5 => _5()]), async () => ( []));
257
386
  if (run !== this.run) return;
258
387
  this.set({ categories });
259
388
  await this.page(run, p, true);
@@ -288,7 +417,7 @@ var StickerBrowser = (_class = class {
288
417
  const res = q && p.capabilities.supportsSearch ? await p.search(q, options) : await p.list(options);
289
418
  if (run !== this.run) return;
290
419
  this.next = res.next;
291
- const items = res.items.map((s) => ({ ...s, ref: _chunkZEYMKDYScjs.stickerRefOf.call(void 0, p, s.id) }));
420
+ const items = res.items.map((s) => ({ ...s, ref: _chunkJSDND7DFcjs.stickerRefOf.call(void 0, p, s.id) }));
292
421
  this.set({ items: first ? items : [...this.s.items, ...items], total: res.total, hasMore: Boolean(res.next), loading: false });
293
422
  }
294
423
  }, _class);
@@ -298,4 +427,10 @@ var StickerBrowser = (_class = class {
298
427
 
299
428
 
300
429
 
301
- exports.stampOutline = stampOutline; exports.stampPixels = stampPixels; exports.editorStickers = editorStickers; exports.StickerBrowser = StickerBrowser;
430
+
431
+
432
+
433
+
434
+
435
+
436
+ exports.stickerForAgent = stickerForAgent; exports.describeStickerRef = describeStickerRef; exports.createStickerTools = createStickerTools; exports.insertSticker = insertSticker; exports.createInsertStickerTool = createInsertStickerTool; exports.createStickerToolProvider = createStickerToolProvider; exports.stampOutline = stampOutline; exports.stampPixels = stampPixels; exports.editorStickers = editorStickers; exports.StickerBrowser = StickerBrowser;