@pixerate/editor 0.191.0 → 0.192.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.
@@ -9346,6 +9346,62 @@ var ImageEditorController = (_class10 = class {
9346
9346
  * text wrapped in `box`. Refused without a text shaper. Returns its id.
9347
9347
  */
9348
9348
  addTextLayer(init) {
9349
+ const layer = this.layoutTypeLayer(init);
9350
+ if (init.opacity !== void 0 && !(Number.isFinite(init.opacity) && init.opacity >= 0 && init.opacity <= 1)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("opacity must be between 0 and 1.");
9351
+ if (init.blend !== void 0 && !_chunkCWM3CUUXcjs.isBlendMode.call(void 0, init.blend)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)(`Unknown blend mode "${String(init.blend)}".`);
9352
+ if (init.opacity !== void 0) layer.opacity = init.opacity;
9353
+ if (init.blend !== void 0) layer.blend = init.blend;
9354
+ const next = _chunk2UR4OX3Bcjs.placeLayer.call(void 0, this.state.layers, layer, this.newLayerPlacement(init));
9355
+ this.commitLayers(next, () => {
9356
+ this.state.activeLayerId = layer.id;
9357
+ this.state.activeTarget = "pixels";
9358
+ });
9359
+ return layer.id;
9360
+ }
9361
+ /**
9362
+ * Type Mask (horizontal or vertical): a selection in the shape of `text`, laid out and drawn as
9363
+ * `addTextLayer` would place it (font, size, tracking, box, rotation), combined with the current
9364
+ * selection by `mode`. Vertical type stacks the characters top to bottom, centred on `x`. No
9365
+ * layer is added. One undo step. Returns whether anything is selected.
9366
+ */
9367
+ selectTextShape(init) {
9368
+ const vertical = init.orientation === "vertical";
9369
+ if (init.orientation !== void 0 && init.orientation !== "horizontal" && !vertical) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("orientation must be horizontal or vertical.");
9370
+ if (init.feather !== void 0 && !(init.feather >= 0 && init.feather <= 1e3)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("feather must be from 0 to 1000 px.");
9371
+ let text = _chunk2UR4OX3Bcjs.normalizeText.call(void 0, init.text);
9372
+ if (!text.trim()) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("The text is empty, so there is nothing to select; give some characters.");
9373
+ let paragraph = init.paragraph;
9374
+ if (vertical) {
9375
+ if (/\n/.test(text)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("Vertical type masks take one column; select each column separately (mode add) instead of line breaks.");
9376
+ if (init.box) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("Vertical type masks are point text; leave out box.");
9377
+ text = Array.from(text).join("\n");
9378
+ paragraph = { align: "center", ..._nullishCoalesce(paragraph, () => ( {})) };
9379
+ }
9380
+ const layer = this.layoutTypeLayer({ ...init, text, paragraph });
9381
+ const { width, height } = this.naturalSize;
9382
+ const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
9383
+ const x0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _374 => _374.x]), () => ( 0)));
9384
+ const y0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _375 => _375.y]), () => ( 0)));
9385
+ const x1 = Math.min(width, b ? b.x + b.width : 0);
9386
+ const y1 = Math.min(height, b ? b.y + b.height : 0);
9387
+ let mask;
9388
+ if (!b || x1 <= x0 || y1 <= y0) mask = _chunk2UR4OX3Bcjs.createSelectionMask.call(void 0, width, height);
9389
+ else {
9390
+ const rect = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
9391
+ const rgba = _chunkCWM3CUUXcjs.readRegion.call(void 0, layer.surface, rect);
9392
+ const bytes = new Uint8Array(rect.width * rect.height);
9393
+ const hard = init.antiAlias === false;
9394
+ for (let i = 0; i < bytes.length; i++) {
9395
+ const a = rgba[i * 4 + 3];
9396
+ bytes[i] = hard ? a >= 128 ? 255 : 0 : a;
9397
+ }
9398
+ mask = _chunk2UR4OX3Bcjs.selectionFromRegion.call(void 0, width, height, rect, bytes);
9399
+ }
9400
+ if ((_nullishCoalesce(init.feather, () => ( 0))) > 0 && mask.bounds) mask = _chunk2UR4OX3Bcjs.modifySelection.call(void 0, mask, "feather", init.feather);
9401
+ return this.setSelection(mask.bounds ? mask : null, _nullishCoalesce(init.mode, () => ( "replace")));
9402
+ }
9403
+ /** A type layer laid out and drawn from `init` (not added): the shared part of `addTextLayer` and the type masks. */
9404
+ layoutTypeLayer(init) {
9349
9405
  const text = _chunk2UR4OX3Bcjs.normalizeText.call(void 0, init.text);
9350
9406
  if (!Number.isFinite(init.x) || !Number.isFinite(init.y)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("x and y must be numbers (document pixels).");
9351
9407
  const style = _chunk2UR4OX3Bcjs.patchTextStyle.call(void 0, { ..._chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE, color: this.state.paint.foreground }, _nullishCoalesce(init.style, () => ( {})));
@@ -9357,19 +9413,9 @@ var ImageEditorController = (_class10 = class {
9357
9413
  frame = { kind: "box", width, height };
9358
9414
  }
9359
9415
  if (init.rotation !== void 0 && !Number.isFinite(init.rotation)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("rotation must be a number of degrees.");
9360
- if (init.opacity !== void 0 && !(Number.isFinite(init.opacity) && init.opacity >= 0 && init.opacity <= 1)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("opacity must be between 0 and 1.");
9361
- if (init.blend !== void 0 && !_chunkCWM3CUUXcjs.isBlendMode.call(void 0, init.blend)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)(`Unknown blend mode "${String(init.blend)}".`);
9362
9416
  const t = [1, 0, 0, 1, init.x, init.y];
9363
9417
  const transform = init.rotation ? _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, t, _chunkEGZM52EOcjs.rotateMatrix.call(void 0, init.rotation, { x: init.x, y: init.y })) : t;
9364
- const layer = _chunk2UR4OX3Bcjs.createTypeLayer.call(void 0, { text, runs: [{ length: text.length, style }], paragraphs: [{ length: text.length, style: paragraph }], frame, transform, name: _nullishCoalesce(init.name, () => ( _chunk2UR4OX3Bcjs.typeLayerName.call(void 0, text))) }, this.textEnv());
9365
- if (init.opacity !== void 0) layer.opacity = init.opacity;
9366
- if (init.blend !== void 0) layer.blend = init.blend;
9367
- const next = _chunk2UR4OX3Bcjs.placeLayer.call(void 0, this.state.layers, layer, this.newLayerPlacement(init));
9368
- this.commitLayers(next, () => {
9369
- this.state.activeLayerId = layer.id;
9370
- this.state.activeTarget = "pixels";
9371
- });
9372
- return layer.id;
9418
+ return _chunk2UR4OX3Bcjs.createTypeLayer.call(void 0, { text, runs: [{ length: text.length, style }], paragraphs: [{ length: text.length, style: paragraph }], frame, transform, name: _nullishCoalesce(init.name, () => ( _chunk2UR4OX3Bcjs.typeLayerName.call(void 0, text))) }, this.textEnv());
9373
9419
  }
9374
9420
  /**
9375
9421
  * Replaces text [start, end) (default all of it) with `text`; inserted text takes the style at
@@ -9479,7 +9525,7 @@ var ImageEditorController = (_class10 = class {
9479
9525
  if (colors.size > 1) warnings.push("The text had several colours; the shape takes the first one.");
9480
9526
  const missing = _chunkEGZM52EOcjs.layoutText.call(void 0, layer, shaper).missingFonts;
9481
9527
  if (missing.length) warnings.push(`Missing fonts were drawn with a fallback: ${missing.join(", ")}.`);
9482
- const first = _nullishCoalesce(_optionalChain([layer, 'access', _374 => _374.runs, 'access', _375 => _375.find, 'call', _376 => _376((r) => r.length > 0), 'optionalAccess', _377 => _377.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE));
9528
+ const first = _nullishCoalesce(_optionalChain([layer, 'access', _376 => _376.runs, 'access', _377 => _377.find, 'call', _378 => _378((r) => r.length > 0), 'optionalAccess', _379 => _379.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE));
9483
9529
  const fill = first.opacity !== void 0 && first.opacity !== 1 ? { type: "color", color: first.color, opacity: first.opacity } : { type: "color", color: first.color };
9484
9530
  const shape = _chunk2UR4OX3Bcjs.createShapeLayer.call(void 0, { components: [{ op: "combine", subpaths }], fill, stroke: null, name: layer.name }, this.shapeEnv(), layer.id);
9485
9531
  const keep = { visible: layer.visible, opacity: layer.opacity, blend: layer.blend };
@@ -9512,7 +9558,7 @@ var ImageEditorController = (_class10 = class {
9512
9558
  // --- Shape layers ---
9513
9559
  /** What shape rendering needs: the canvas size and the document's patterns. */
9514
9560
  shapeEnv() {
9515
- return { ...this.naturalSize, pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _378 => _378.state, 'access', _379 => _379.patterns, 'optionalAccess', _380 => _380.find, 'call', _381 => _381((p) => p.id === id)]), () => ( null)) };
9561
+ return { ...this.naturalSize, pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _380 => _380.state, 'access', _381 => _381.patterns, 'optionalAccess', _382 => _382.find, 'call', _383 => _383((p) => p.id === id)]), () => ( null)) };
9516
9562
  }
9517
9563
  /** One component from tool or UI input (validated). */
9518
9564
  componentFrom(spec, path) {
@@ -9555,9 +9601,9 @@ var ImageEditorController = (_class10 = class {
9555
9601
  * open path) and stroked with `stroke`. Goes above the active layer unless placed. Returns its id.
9556
9602
  */
9557
9603
  addShapeLayer(init) {
9558
- const specs = _optionalChain([init, 'access', _382 => _382.components, 'optionalAccess', _383 => _383.length]) ? init.components : [init];
9559
- if (_optionalChain([init, 'access', _384 => _384.components, 'optionalAccess', _385 => _385.length]) && (init.shape !== void 0 || init.subpaths !== void 0)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("Give components, or shape / subpaths, not both.");
9560
- const components = specs.map((c, i) => this.componentFrom(c, _optionalChain([init, 'access', _386 => _386.components, 'optionalAccess', _387 => _387.length]) ? `components[${i}].` : ""));
9604
+ const specs = _optionalChain([init, 'access', _384 => _384.components, 'optionalAccess', _385 => _385.length]) ? init.components : [init];
9605
+ if (_optionalChain([init, 'access', _386 => _386.components, 'optionalAccess', _387 => _387.length]) && (init.shape !== void 0 || init.subpaths !== void 0)) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)("Give components, or shape / subpaths, not both.");
9606
+ const components = specs.map((c, i) => this.componentFrom(c, _optionalChain([init, 'access', _388 => _388.components, 'optionalAccess', _389 => _389.length]) ? `components[${i}].` : ""));
9561
9607
  const stroke = init.stroke ? _chunk2UR4OX3Bcjs.normalizeShapeStroke.call(void 0, init.stroke, "stroke") : null;
9562
9608
  const openOnly = components.every((c) => !c.live && c.subpaths.every((sp) => !sp.closed));
9563
9609
  const fill = init.fill === void 0 ? stroke && openOnly ? null : _chunk2UR4OX3Bcjs.normalizeShapePaint.call(void 0, this.state.paint.foreground, "fill") : init.fill === null ? null : _chunk2UR4OX3Bcjs.normalizeShapePaint.call(void 0, init.fill, "fill");
@@ -9668,7 +9714,7 @@ var ImageEditorController = (_class10 = class {
9668
9714
  if (layer.locks) next.locks = layer.locks;
9669
9715
  if (this.state.selectedAnnotationId === layer.annotation.id) this.state.selectedAnnotationId = null;
9670
9716
  } else if (layer.type === "pixel") {
9671
- if (!_optionalChain([layer, 'access', _388 => _388.filters, 'optionalAccess', _389 => _389.length])) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)(`Layer "${layer.name || id}" is already pixels with no filters to bake.`);
9717
+ if (!_optionalChain([layer, 'access', _390 => _390.filters, 'optionalAccess', _391 => _391.length])) throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)(`Layer "${layer.name || id}" is already pixels with no filters to bake.`);
9672
9718
  _chunk2UR4OX3Bcjs.requireUnlocked.call(void 0, layer, "pixels", "rasterize it");
9673
9719
  const spatial = layer.filters.some((f) => f.enabled && f.kind === "blur");
9674
9720
  const content = { ...layer, visible: true, opacity: 1, blend: "normal" };
@@ -9687,7 +9733,7 @@ var ImageEditorController = (_class10 = class {
9687
9733
  return this.rasterizeSmartObject(id);
9688
9734
  } else if (layer.type === "shape" || layer.type === "type") {
9689
9735
  next = layer.type === "shape" ? _chunk2UR4OX3Bcjs.shapeAsPixelLayer.call(void 0, layer) : _chunk2UR4OX3Bcjs.typeAsPixelLayer.call(void 0, layer);
9690
- if (this.state.selectedAnnotationId && this.state.selectedAnnotationId === _optionalChain([layer, 'access', _390 => _390.annotation, 'optionalAccess', _391 => _391.id])) this.state.selectedAnnotationId = null;
9736
+ if (this.state.selectedAnnotationId && this.state.selectedAnnotationId === _optionalChain([layer, 'access', _392 => _392.annotation, 'optionalAccess', _393 => _393.id])) this.state.selectedAnnotationId = null;
9691
9737
  } else {
9692
9738
  throw new (0, _chunk2UR4OX3Bcjs.LayerOperationError)(`Only shape, type and annotation layers, smart objects and pixel layers with filters rasterize; "${layer.name || id}" is a ${layer.type} layer. Merge it down or flatten instead.`);
9693
9739
  }
@@ -9701,8 +9747,8 @@ var ImageEditorController = (_class10 = class {
9701
9747
  const doc = this.state.colorProfile;
9702
9748
  const p = resolveProfile(doc);
9703
9749
  const m = this.state.colorMode;
9704
- const out = { name: _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _392 => _392.name]), () => ( p.description)), builtin: doc ? _nullishCoalesce(doc.builtin, () => ( null)) : "srgb", colorSpace: p.colorSpace, srgb: isSrgb(doc), mode: _nullishCoalesce(_optionalChain([m, 'optionalAccess', _393 => _393.mode]), () => ( "rgb")) };
9705
- if (_optionalChain([m, 'optionalAccess', _394 => _394.mode]) === "cmyk") out.cmykProfile = { name: m.profile.name, builtin: _nullishCoalesce(m.profile.builtin, () => ( null)), intent: m.intent };
9750
+ const out = { name: _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _394 => _394.name]), () => ( p.description)), builtin: doc ? _nullishCoalesce(doc.builtin, () => ( null)) : "srgb", colorSpace: p.colorSpace, srgb: isSrgb(doc), mode: _nullishCoalesce(_optionalChain([m, 'optionalAccess', _395 => _395.mode]), () => ( "rgb")) };
9751
+ if (_optionalChain([m, 'optionalAccess', _396 => _396.mode]) === "cmyk") out.cmykProfile = { name: m.profile.name, builtin: _nullishCoalesce(m.profile.builtin, () => ( null)), intent: m.intent };
9706
9752
  return out;
9707
9753
  }
9708
9754
  /**
@@ -9792,7 +9838,7 @@ var ImageEditorController = (_class10 = class {
9792
9838
  const textEnv = this.textEnv();
9793
9839
  const walk = (layers) => layers.map((l) => {
9794
9840
  let next2 = l;
9795
- if (_optionalChain([l, 'access', _395 => _395.effects, 'optionalAccess', _396 => _396.items, 'access', _397 => _397.length])) next2 = { ...next2, effects: convertColorFields(l.effects, hex) };
9841
+ if (_optionalChain([l, 'access', _397 => _397.effects, 'optionalAccess', _398 => _398.items, 'access', _399 => _399.length])) next2 = { ...next2, effects: convertColorFields(l.effects, hex) };
9796
9842
  if (l.type === "group") {
9797
9843
  if (next2 !== l) converted.push(l.id);
9798
9844
  return { ...next2, children: walk(l.children) };
@@ -9976,8 +10022,8 @@ var ImageEditorController = (_class10 = class {
9976
10022
  else delete s.bitDepth;
9977
10023
  delete s.colorProfile;
9978
10024
  delete s.colorMode;
9979
- if (_optionalChain([result, 'access', _398 => _398.sourceMode, 'optionalAccess', _399 => _399.mode]) === "cmyk") s.colorMode = { mode: "cmyk", profile: result.sourceMode.profile, intent: "relative" };
9980
- else if (_optionalChain([result, 'access', _400 => _400.sourceMode, 'optionalAccess', _401 => _401.mode]) === "lab") s.colorMode = { mode: "lab" };
10025
+ if (_optionalChain([result, 'access', _400 => _400.sourceMode, 'optionalAccess', _401 => _401.mode]) === "cmyk") s.colorMode = { mode: "cmyk", profile: result.sourceMode.profile, intent: "relative" };
10026
+ else if (_optionalChain([result, 'access', _402 => _402.sourceMode, 'optionalAccess', _403 => _403.mode]) === "lab") s.colorMode = { mode: "lab" };
9981
10027
  else if (result.iccProfile) {
9982
10028
  try {
9983
10029
  const doc = documentProfile(result.iccProfile);
@@ -10041,7 +10087,7 @@ var ImageEditorController = (_class10 = class {
10041
10087
  const compositor = new (0, _chunk2UR4OX3Bcjs.LayerCompositor)();
10042
10088
  const bakeMask = (layer) => {
10043
10089
  const mask = layer.mask;
10044
- if (!_optionalChain([mask, 'optionalAccess', _402 => _402.source])) return mask;
10090
+ if (!_optionalChain([mask, 'optionalAccess', _404 => _404.source])) return mask;
10045
10091
  add2("Parametric (depth) masks were baked into pixel masks", layer.name);
10046
10092
  const plain3 = { ...layer, mask: { ...mask, density: 1, feather: 0, enabled: true } };
10047
10093
  const ox = layer.type === "pixel" ? layer.offset.x : 0;
@@ -10058,7 +10104,7 @@ var ImageEditorController = (_class10 = class {
10058
10104
  };
10059
10105
  const prepare = async (layer) => {
10060
10106
  const p = await prepareLayer(layer);
10061
- if (_optionalChain([p, 'optionalAccess', _403 => _403.blend]) === "pigment") add2("The Pigment blend mode has no PSD equivalent and was written as Normal", layer.name);
10107
+ if (_optionalChain([p, 'optionalAccess', _405 => _405.blend]) === "pigment") add2("The Pigment blend mode has no PSD equivalent and was written as Normal", layer.name);
10062
10108
  return p;
10063
10109
  };
10064
10110
  const prepareLayer = async (layer) => {
@@ -10101,7 +10147,7 @@ var ImageEditorController = (_class10 = class {
10101
10147
  return out2;
10102
10148
  }
10103
10149
  if (layer.type === "shape" || layer.type === "type") {
10104
- if (layer.type === "type" && _optionalChain([layer, 'access', _404 => _404.missingFonts, 'optionalAccess', _405 => _405.length])) add2(`Type layers drawn with a fallback for missing fonts (${layer.missingFonts.join(", ")}) keep the font names, so Photoshop may draw them differently`, layer.name);
10150
+ if (layer.type === "type" && _optionalChain([layer, 'access', _406 => _406.missingFonts, 'optionalAccess', _407 => _407.length])) add2(`Type layers drawn with a fallback for missing fonts (${layer.missingFonts.join(", ")}) keep the font names, so Photoshop may draw them differently`, layer.name);
10105
10151
  const out2 = { ...layer };
10106
10152
  const mask2 = bakeMask(layer);
10107
10153
  if (mask2) out2.mask = mask2;
@@ -10120,7 +10166,7 @@ var ImageEditorController = (_class10 = class {
10120
10166
  out.surface = this.surfaceOf(layer);
10121
10167
  delete out.source;
10122
10168
  }
10123
- const active = _nullishCoalesce(_optionalChain([layer, 'access', _406 => _406.filters, 'optionalAccess', _407 => _407.filter, 'call', _408 => _408(_chunk2UR4OX3Bcjs.isActiveFilter)]), () => ( []));
10169
+ const active = _nullishCoalesce(_optionalChain([layer, 'access', _408 => _408.filters, 'optionalAccess', _409 => _409.filter, 'call', _410 => _410(_chunk2UR4OX3Bcjs.isActiveFilter)]), () => ( []));
10124
10170
  if (active.length) {
10125
10171
  add2("Layer filters (develop, blur) were baked into the pixels", layer.name);
10126
10172
  const content = { ...out, visible: true, opacity: 1, blend: "normal" };
@@ -10131,7 +10177,7 @@ var ImageEditorController = (_class10 = class {
10131
10177
  const data = compositor.composite([content], canvas, sources);
10132
10178
  out = { ...out, surface: _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, -layer.offset.x, -layer.offset.y) };
10133
10179
  }
10134
- if (_optionalChain([layer, 'access', _409 => _409.filters, 'optionalAccess', _410 => _410.some, 'call', _411 => _411((f) => !f.enabled)])) add2("Disabled layer filters were left out", layer.name);
10180
+ if (_optionalChain([layer, 'access', _411 => _411.filters, 'optionalAccess', _412 => _412.some, 'call', _413 => _413((f) => !f.enabled)])) add2("Disabled layer filters were left out", layer.name);
10135
10181
  delete out.filters;
10136
10182
  const mask = bakeMask(layer);
10137
10183
  if (mask) out.mask = mask;
@@ -10195,7 +10241,7 @@ var ImageEditorController = (_class10 = class {
10195
10241
  );
10196
10242
  }
10197
10243
  layers = resizeLegacyMasks(layers, prev, next.dimensions);
10198
- const env = { ...next.dimensions, pattern: (pid) => _nullishCoalesce(_optionalChain([this, 'access', _412 => _412.state, 'access', _413 => _413.patterns, 'optionalAccess', _414 => _414.find, 'call', _415 => _415((p) => p.id === pid)]), () => ( null)) };
10244
+ const env = { ...next.dimensions, pattern: (pid) => _nullishCoalesce(_optionalChain([this, 'access', _414 => _414.state, 'access', _415 => _415.patterns, 'optionalAccess', _416 => _416.find, 'call', _417 => _417((p) => p.id === pid)]), () => ( null)) };
10199
10245
  for (const l of _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers)) {
10200
10246
  if (l.type === "annotation") {
10201
10247
  layers = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, l.id, () => ({ ...l, annotation: scaleAnnotation(l.annotation, sx, sy) }));
@@ -10204,7 +10250,7 @@ var ImageEditorController = (_class10 = class {
10204
10250
  const scaled = a ? scaleAnnotation(a, sx, sy) : null;
10205
10251
  const fromAnnotation = scaled ? _chunk2UR4OX3Bcjs.shapeFromAnnotation.call(void 0, scaled) : null;
10206
10252
  const m = [sx, 0, 0, sy, 0, 0];
10207
- const components = _nullishCoalesce(_optionalChain([fromAnnotation, 'optionalAccess', _416 => _416.components]), () => ( _chunk2UR4OX3Bcjs.transformShapeComponents.call(void 0, l.components, (p) => ({ x: p.x * sx, y: p.y * sy }), m)));
10253
+ const components = _nullishCoalesce(_optionalChain([fromAnnotation, 'optionalAccess', _418 => _418.components]), () => ( _chunk2UR4OX3Bcjs.transformShapeComponents.call(void 0, l.components, (p) => ({ x: p.x * sx, y: p.y * sy }), m)));
10208
10254
  const moved = { ...l, components, ...fromAnnotation ? { fill: fromAnnotation.fill, stroke: fromAnnotation.stroke } : {} };
10209
10255
  if (scaled && fromAnnotation) moved.annotation = scaled;
10210
10256
  else delete moved.annotation;
@@ -10222,7 +10268,7 @@ var ImageEditorController = (_class10 = class {
10222
10268
  this.notify();
10223
10269
  }
10224
10270
  toJSON(options) {
10225
- const root = _optionalChain([this, 'access', _417 => _417.contentsStack, 'access', _418 => _418[0], 'optionalAccess', _419 => _419.saved]);
10271
+ const root = _optionalChain([this, 'access', _419 => _419.contentsStack, 'access', _420 => _420[0], 'optionalAccess', _421 => _421.saved]);
10226
10272
  const current = this.state;
10227
10273
  const element = this.imageElement;
10228
10274
  if (root) {
@@ -10233,8 +10279,8 @@ var ImageEditorController = (_class10 = class {
10233
10279
  let out;
10234
10280
  try {
10235
10281
  out = this.serializeState();
10236
- if (_optionalChain([this, 'access', _420 => _420.state, 'access', _421 => _421.selection, 'optionalAccess', _422 => _422.bounds])) out.selection = _chunk2UR4OX3Bcjs.serializeSelection.call(void 0, this.state.selection);
10237
- if (_optionalChain([this, 'access', _423 => _423.state, 'access', _424 => _424.channels, 'optionalAccess', _425 => _425.length])) out.channels = serializeChannels(this.state.channels);
10282
+ if (_optionalChain([this, 'access', _422 => _422.state, 'access', _423 => _423.selection, 'optionalAccess', _424 => _424.bounds])) out.selection = _chunk2UR4OX3Bcjs.serializeSelection.call(void 0, this.state.selection);
10283
+ if (_optionalChain([this, 'access', _425 => _425.state, 'access', _426 => _426.channels, 'optionalAccess', _427 => _427.length])) out.channels = serializeChannels(this.state.channels);
10238
10284
  } finally {
10239
10285
  if (root) {
10240
10286
  this.state = current;
@@ -10348,10 +10394,10 @@ var ImageEditorController = (_class10 = class {
10348
10394
  serializeState() {
10349
10395
  const { width, height } = this.naturalSize;
10350
10396
  const view = _chunk2UR4OX3Bcjs.legacyView.call(void 0, this.stack(), width, height, null);
10351
- if (view.exact && !this.state.globalLight && !_optionalChain([this, 'access', _426 => _426.state, 'access', _427 => _427.patterns, 'optionalAccess', _428 => _428.length]) && this.bitDepth === 8 && !this.state.colorProfile && !this.state.colorMode) {
10397
+ if (view.exact && !this.state.globalLight && !_optionalChain([this, 'access', _428 => _428.state, 'access', _429 => _429.patterns, 'optionalAccess', _430 => _430.length]) && this.bitDepth === 8 && !this.state.colorProfile && !this.state.colorMode) {
10352
10398
  return {
10353
10399
  // States without adjustment layers keep schema 1, so they round-trip unchanged.
10354
- version: _optionalChain([view, 'access', _429 => _429.adjustments, 'access', _430 => _430.layers, 'optionalAccess', _431 => _431.length]) ? 2 : 1,
10400
+ version: _optionalChain([view, 'access', _431 => _431.adjustments, 'access', _432 => _432.layers, 'optionalAccess', _433 => _433.length]) ? 2 : 1,
10355
10401
  crop: this.state.crop ? { ...this.state.crop } : null,
10356
10402
  transform: { ...this.state.transform },
10357
10403
  adjustments: serializeAdjustments(view.adjustments),
@@ -10376,7 +10422,7 @@ var ImageEditorController = (_class10 = class {
10376
10422
  };
10377
10423
  if (this.state.legacyOutputBlur !== void 0) out.legacyOutputBlur = this.state.legacyOutputBlur;
10378
10424
  if (this.state.globalLight) out.globalLight = { ...this.state.globalLight };
10379
- if (_optionalChain([this, 'access', _432 => _432.state, 'access', _433 => _433.patterns, 'optionalAccess', _434 => _434.length])) out.patterns = _chunk2UR4OX3Bcjs.serializePatterns.call(void 0, this.state.patterns);
10425
+ if (_optionalChain([this, 'access', _434 => _434.state, 'access', _435 => _435.patterns, 'optionalAccess', _436 => _436.length])) out.patterns = _chunk2UR4OX3Bcjs.serializePatterns.call(void 0, this.state.patterns);
10380
10426
  if (smartContents) out.smartContents = smartContents;
10381
10427
  if (this.state.bitDepth === 16 || this.state.bitDepth === 32) out.bitDepth = this.state.bitDepth;
10382
10428
  if (this.state.colorProfile) out.colorProfile = serializeColorProfile(this.state.colorProfile);
@@ -10386,7 +10432,7 @@ var ImageEditorController = (_class10 = class {
10386
10432
  }, _class10);
10387
10433
  function serializeAdjustments(adjustments) {
10388
10434
  const out = { ...adjustments };
10389
- if (_optionalChain([out, 'access', _435 => _435.layers, 'optionalAccess', _436 => _436.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
10435
+ if (_optionalChain([out, 'access', _437 => _437.layers, 'optionalAccess', _438 => _438.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
10390
10436
  else delete out.layers;
10391
10437
  if (_chunk2UR4OX3Bcjs.normalizeProcessVersion.call(void 0, out.process) === _chunk2UR4OX3Bcjs.LEGACY_PROCESS_VERSION) {
10392
10438
  delete out.process;
@@ -10422,11 +10468,11 @@ function withDevelop(layer, partial) {
10422
10468
  return { ...layer, filters };
10423
10469
  }
10424
10470
  function withBlur(layer, radius) {
10425
- const existing = _optionalChain([layer, 'access', _437 => _437.filters, 'optionalAccess', _438 => _438.find, 'call', _439 => _439((f) => f.kind === "blur")]);
10471
+ const existing = _optionalChain([layer, 'access', _439 => _439.filters, 'optionalAccess', _440 => _440.find, 'call', _441 => _441((f) => f.kind === "blur")]);
10426
10472
  const filters = (_nullishCoalesce(layer.filters, () => ( []))).filter((f) => f.kind !== "blur");
10427
10473
  if (radius > 0) {
10428
10474
  filters.push({
10429
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _440 => _440.id]), () => ( (layer.source === "document" ? _chunk2UR4OX3Bcjs.BLUR_FILTER_ID : _chunk2UR4OX3Bcjs.newLayerId.call(void 0, "flt")))),
10475
+ id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _442 => _442.id]), () => ( (layer.source === "document" ? _chunk2UR4OX3Bcjs.BLUR_FILTER_ID : _chunk2UR4OX3Bcjs.newLayerId.call(void 0, "flt")))),
10430
10476
  kind: "blur",
10431
10477
  enabled: true,
10432
10478
  radius
@@ -10522,7 +10568,7 @@ function collectStateTiles(layers, into) {
10522
10568
  if (l.type === "shape" || l.type === "type") _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.surface, into);
10523
10569
  if (l.type === "smart") {
10524
10570
  _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.surface, into);
10525
- if (_optionalChain([l, 'access', _441 => _441.smartFilters, 'optionalAccess', _442 => _442.mask])) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.smartFilters.mask.surface, into);
10571
+ if (_optionalChain([l, 'access', _443 => _443.smartFilters, 'optionalAccess', _444 => _444.mask])) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.smartFilters.mask.surface, into);
10526
10572
  if (l.contents.raster) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.contents.raster, into);
10527
10573
  if (l.contents.document) collectStateTiles(l.contents.document.layers, into);
10528
10574
  }
@@ -10554,7 +10600,7 @@ function pixelsOnly(layers) {
10554
10600
  for (const l of layers) {
10555
10601
  if (l.type === "adjustment") continue;
10556
10602
  if (l.type === "group") out.push({ ...l, children: pixelsOnly(l.children) });
10557
- else if (l.type === "pixel" && _optionalChain([l, 'access', _443 => _443.filters, 'optionalAccess', _444 => _444.length])) {
10603
+ else if (l.type === "pixel" && _optionalChain([l, 'access', _445 => _445.filters, 'optionalAccess', _446 => _446.length])) {
10558
10604
  const p = { ...l };
10559
10605
  delete p.filters;
10560
10606
  out.push(p);
@@ -10620,7 +10666,7 @@ function toHex(c) {
10620
10666
  return "#" + [c[0], c[1], c[2]].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("");
10621
10667
  }
10622
10668
  function normalizeSelection(mask) {
10623
- return _optionalChain([mask, 'optionalAccess', _445 => _445.bounds]) ? mask : null;
10669
+ return _optionalChain([mask, 'optionalAccess', _447 => _447.bounds]) ? mask : null;
10624
10670
  }
10625
10671
  function sameSelection(a, b) {
10626
10672
  if (a.width !== b.width || a.height !== b.height) return false;
@@ -10830,7 +10876,7 @@ function loadImageEditorDocument(input) {
10830
10876
  }
10831
10877
  const state = { version: 1, ...result.value };
10832
10878
  if (isV2) {
10833
- if (_optionalChain([state, 'access', _446 => _446.adjustments, 'access', _447 => _447.layers, 'optionalAccess', _448 => _448.length])) state.version = 2;
10879
+ if (_optionalChain([state, 'access', _448 => _448.adjustments, 'access', _449 => _449.layers, 'optionalAccess', _450 => _450.length])) state.version = 2;
10834
10880
  result.report.version = 2;
10835
10881
  }
10836
10882
  if (state.selection === void 0) delete state.selection;
@@ -11038,7 +11084,7 @@ function findAdjustmentControl(id) {
11038
11084
  }
11039
11085
  function findLayerControl(kind, id) {
11040
11086
  if (id === "opacity") return ADJUSTMENT_LAYER_OPACITY_CONTROL;
11041
- return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access', _449 => _449[kind], 'optionalAccess', _450 => _450.find, 'call', _451 => _451((c) => c.id === id)]);
11087
+ return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access', _451 => _451[kind], 'optionalAccess', _452 => _452.find, 'call', _453 => _453((c) => c.id === id)]);
11042
11088
  }
11043
11089
  function clampControlValue(spec, v) {
11044
11090
  if (typeof v !== "number" || !Number.isFinite(v)) return spec.default;
@@ -11255,7 +11301,7 @@ var DEPTH_MASK_CONTROLS = [
11255
11301
  // src/image-editor/playback.ts
11256
11302
  var IMAGE_PLAYBACK_KIND = "layer";
11257
11303
  var PAINT = /^(paint_stroke|clone_stamp|heal_brush|spot_heal|dodge|burn|sponge|smudge|blur_stroke|sharpen_stroke|history_brush|set_clone_source|set_clone_transform|fill_pixels|clear_pixels|set_paint|set_retouch_options|load_mixer_brush|clean_mixer_brush)$/;
11258
- var SELECT = /^(select_region|select_subject|select_by_color|select_all|deselect|invert_selection|select_rect|select_ellipse|select_polygon|select_line|magic_wand|grow_selection|select_similar|reselect|select_layer_transparency|select_color_range|load_selection_from_image|load_selection_from_mask|set_selection_display|modify_selection|refine_selection|transform_selection|apply_selection_as_mask|layer_via_copy|stroke_selection|content_aware_fill|copy_pixels|cut_pixels|paste_pixels|save_selection|load_selection_from_channel|set_channel_properties|duplicate_channel|delete_channel|load_channel_from_image|set_quick_mask|path_to_selection)$/;
11304
+ var SELECT = /^(select_region|select_subject|select_by_color|select_all|deselect|invert_selection|select_rect|select_ellipse|select_polygon|select_line|magic_wand|grow_selection|select_similar|reselect|select_layer_transparency|select_color_range|load_selection_from_image|load_selection_from_mask|set_selection_display|modify_selection|refine_selection|transform_selection|apply_selection_as_mask|layer_via_copy|stroke_selection|content_aware_fill|copy_pixels|cut_pixels|paste_pixels|save_selection|load_selection_from_channel|set_channel_properties|duplicate_channel|delete_channel|load_channel_from_image|set_quick_mask|path_to_selection|select_text_shape)$/;
11259
11305
  var ANNOTATE = /^(add_shape_layer|update_shape|add_shape_component|set_shape_component|remove_shape_component|merge_shape_components|add_text_layer|set_text|set_text_style|set_paragraph_style|set_text_frame|convert_text_to_shape)$/;
11260
11306
  var CROP = /^(set_crop|crop_to_selection|reset_crop|set_rotation|flip_image|transform_layer|warp_layer|flip_layer|offset_layer)$/;
11261
11307
  var ADJUST = /^(set_adjustments|add_adjustment_layer|update_adjustment_layer|remove_adjustment_layer|move_adjustment_layer)$/;
@@ -11376,7 +11422,9 @@ var SELECTION_TOOLS = [
11376
11422
  { id: "column", label: "Single Column" },
11377
11423
  { id: "lasso", label: "Lasso" },
11378
11424
  { id: "polygon", label: "Polygonal Lasso" },
11379
- { id: "range", label: "Color Range" }
11425
+ { id: "range", label: "Color Range" },
11426
+ { id: "type", label: "Type Mask" },
11427
+ { id: "type-vertical", label: "Vertical Type Mask" }
11380
11428
  ];
11381
11429
  var COLOR_RANGE_PRESET_LABELS = {
11382
11430
  reds: "Reds",
@@ -11407,7 +11455,10 @@ var DEFAULT_SELECTION_TOOL_OPTIONS = {
11407
11455
  feather: 0,
11408
11456
  fuzziness: 40,
11409
11457
  localized: 0,
11410
- rangeInvert: false
11458
+ rangeInvert: false,
11459
+ typeText: "Type",
11460
+ typeSize: 72,
11461
+ typeFamily: "sans-serif"
11411
11462
  };
11412
11463
  function selectionModeFromModifiers(modifiers, fallback) {
11413
11464
  if (modifiers.shiftKey && modifiers.altKey) return "intersect";
@@ -11477,7 +11528,7 @@ function summary(controller) {
11477
11528
  const area = _chunk2UR4OX3Bcjs.selectionArea.call(void 0, sel);
11478
11529
  return {
11479
11530
  empty: !sel,
11480
- bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _452 => _452.bounds]), () => ( null)),
11531
+ bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _454 => _454.bounds]), () => ( null)),
11481
11532
  /** Σ coverage in pixels. */
11482
11533
  area: Math.round(area),
11483
11534
  percent: Math.round(area / Math.max(1, width * height) * 1e4) / 100,
@@ -11553,7 +11604,7 @@ function createImageSelectionTools(controller) {
11553
11604
  break;
11554
11605
  }
11555
11606
  case "polygon": {
11556
- const list = Array.isArray(points) ? points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _453 => _453.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _454 => _454.y]), NaN) })) : [];
11607
+ const list = Array.isArray(points) ? points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _455 => _455.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _456 => _456.y]), NaN) })) : [];
11557
11608
  if (list.length < 3 || !list.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y))) {
11558
11609
  throw new Error("polygon needs points: at least 3 { x, y } vertices.");
11559
11610
  }
@@ -11781,7 +11832,7 @@ function createImageSelectionTools(controller) {
11781
11832
  },
11782
11833
  annotations: writeAnnotations("Select a polygon (lasso)", true),
11783
11834
  handler: (args) => {
11784
- const list = Array.isArray(args.points) ? args.points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _455 => _455.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _456 => _456.y]), NaN) })) : [];
11835
+ const list = Array.isArray(args.points) ? args.points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _457 => _457.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _458 => _458.y]), NaN) })) : [];
11785
11836
  if (list.length < 3 || !list.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y))) {
11786
11837
  throw new Error("points needs at least 3 { x, y } vertices in natural image pixels.");
11787
11838
  }
@@ -11882,7 +11933,7 @@ function createImageSelectionTools(controller) {
11882
11933
  await controller.selectColorRangePreset(args.preset, { ...common, falloff: num2(args.fuzziness, 20) });
11883
11934
  } else {
11884
11935
  const samples = args.samples.map((s, i) => {
11885
- if (typeof _optionalChain([s, 'optionalAccess', _457 => _457.color]) !== "string" || !/^#?[0-9a-f]{6}$/i.test(s.color.trim())) throw new Error(`samples[${i}].color must be #rrggbb.`);
11936
+ if (typeof _optionalChain([s, 'optionalAccess', _459 => _459.color]) !== "string" || !/^#?[0-9a-f]{6}$/i.test(s.color.trim())) throw new Error(`samples[${i}].color must be #rrggbb.`);
11886
11937
  const at = typeof s.x === "number" && typeof s.y === "number" ? { x: s.x, y: s.y } : void 0;
11887
11938
  return at ? { color: s.color, at } : { color: s.color };
11888
11939
  });
@@ -12397,12 +12448,12 @@ function createImageSubjectSelectionTool(controller) {
12397
12448
  annotations: { ...writeAnnotations("Select a subject"), openWorldHint: true },
12398
12449
  handler: async ({ target, maxSegments, mode, feather }, context) => {
12399
12450
  if (typeof target !== "string" || !target.trim()) throw new Error("target must describe what to select.");
12400
- const perform = _optionalChain([context, 'optionalAccess', _458 => _458.perform]);
12451
+ const perform = _optionalChain([context, 'optionalAccess', _460 => _460.perform]);
12401
12452
  const { segments } = await controller.selectSubject(target, {
12402
12453
  mode: _chunk2UR4OX3Bcjs.parseSelectionMode.call(void 0, mode),
12403
12454
  feather: num2(feather, 0),
12404
12455
  maxSegments: typeof maxSegments === "number" ? Math.max(1, Math.round(maxSegments)) : void 0,
12405
- signal: _optionalChain([context, 'optionalAccess', _459 => _459.signal]),
12456
+ signal: _optionalChain([context, 'optionalAccess', _461 => _461.signal]),
12406
12457
  // Under playback the cursor traces what the model found, as a lasso, before it is selected.
12407
12458
  beforeApply: perform ? (outlines) => perform(planOutlineTrace(outlines)) : void 0
12408
12459
  });
@@ -12481,7 +12532,7 @@ async function renderImageRegion(controller, request) {
12481
12532
  const maskView = maskViewCanvas(controller, document);
12482
12533
  if (maskView) context.drawImage(maskView, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
12483
12534
  const selection = state.selection;
12484
- if (_optionalChain([selection, 'optionalAccess', _460 => _460.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
12535
+ if (_optionalChain([selection, 'optionalAccess', _462 => _462.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
12485
12536
  const shade = selectionShade(selection, document);
12486
12537
  if (shade) context.drawImage(shade, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
12487
12538
  }
@@ -12506,7 +12557,7 @@ function createImageCaptureSurface(controller) {
12506
12557
  return {
12507
12558
  units: "image pixels",
12508
12559
  content: whole,
12509
- selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access', _461 => _461.getState, 'call', _462 => _462(), 'access', _463 => _463.selection, 'optionalAccess', _464 => _464.bounds]), () => ( null)) }),
12560
+ selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access', _463 => _463.getState, 'call', _464 => _464(), 'access', _465 => _465.selection, 'optionalAccess', _466 => _466.bounds]), () => ( null)) }),
12510
12561
  overlays: "a shade over unselected pixels, the crop box outline and a layer mask view (set_mask_view)",
12511
12562
  maxScale: 8,
12512
12563
  render: (request) => renderImageRegion(controller, request)
@@ -12840,7 +12891,7 @@ function describeLayer(layer, activeId, boundsOf) {
12840
12891
  out.bounds = boundsOf(layer);
12841
12892
  out.fillOpacity = round3(_nullishCoalesce(layer.fillOpacity, () => ( 1)));
12842
12893
  out.shape = {
12843
- components: layer.components.map((c) => ({ op: c.op, kind: _nullishCoalesce(_optionalChain([c, 'access', _465 => _465.live, 'optionalAccess', _466 => _466.kind]), () => ( "path")) })),
12894
+ components: layer.components.map((c) => ({ op: c.op, kind: _nullishCoalesce(_optionalChain([c, 'access', _467 => _467.live, 'optionalAccess', _468 => _468.kind]), () => ( "path")) })),
12844
12895
  fill: layer.fill ? layer.fill.type : null,
12845
12896
  stroke: layer.stroke ? { width: layer.stroke.width, paint: layer.stroke.paint.type } : null
12846
12897
  };
@@ -12862,8 +12913,8 @@ function describeLayer(layer, activeId, boundsOf) {
12862
12913
  out.bounds = boundsOf(layer);
12863
12914
  out.fillOpacity = round3(_nullishCoalesce(layer.fillOpacity, () => ( 1)));
12864
12915
  out.contents = { id: layer.contents.id, name: layer.contents.name, kind: layer.contents.kind, width: layer.contents.width, height: layer.contents.height };
12865
- out.smartFilters = (_nullishCoalesce(_optionalChain([layer, 'access', _467 => _467.smartFilters, 'optionalAccess', _468 => _468.filters]), () => ( []))).map((f) => ({ id: f.id, kind: f.kind, enabled: f.enabled }));
12866
- out.filterMask = maskSummary(_optionalChain([layer, 'access', _469 => _469.smartFilters, 'optionalAccess', _470 => _470.mask]));
12916
+ out.smartFilters = (_nullishCoalesce(_optionalChain([layer, 'access', _469 => _469.smartFilters, 'optionalAccess', _470 => _470.filters]), () => ( []))).map((f) => ({ id: f.id, kind: f.kind, enabled: f.enabled }));
12917
+ out.filterMask = maskSummary(_optionalChain([layer, 'access', _471 => _471.smartFilters, 'optionalAccess', _472 => _472.mask]));
12867
12918
  break;
12868
12919
  }
12869
12920
  return out;
@@ -12891,7 +12942,7 @@ function createImageLayerTools(controller) {
12891
12942
  if (!loc) return null;
12892
12943
  return {
12893
12944
  ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)),
12894
- parentId: _nullishCoalesce(_optionalChain([loc, 'access', _471 => _471.parent, 'optionalAccess', _472 => _472.id]), () => ( null)),
12945
+ parentId: _nullishCoalesce(_optionalChain([loc, 'access', _473 => _473.parent, 'optionalAccess', _474 => _474.id]), () => ( null)),
12895
12946
  index: loc.index
12896
12947
  };
12897
12948
  };
@@ -13214,7 +13265,7 @@ function createImageLayerTools(controller) {
13214
13265
  if (view !== "gray" && view !== "overlay" && view !== "off") throw new Error(`Unknown view "${String(view)}". Use gray, overlay or off.`);
13215
13266
  const id = view === "off" || layerId === void 0 ? void 0 : exists(layerId);
13216
13267
  const shown = controller.setMaskView(view, id);
13217
- return { view: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _473 => _473.mode]), () => ( "off")), layerId: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _474 => _474.layerId]), () => ( null)) };
13268
+ return { view: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _475 => _475.mode]), () => ( "off")), layerId: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _476 => _476.layerId]), () => ( null)) };
13218
13269
  }
13219
13270
  };
13220
13271
  const maskProps = {
@@ -13789,6 +13840,24 @@ var SelectionGesture = (_class11 = class {
13789
13840
  }
13790
13841
  return;
13791
13842
  }
13843
+ if (options.tool === "type" || options.tool === "type-vertical") {
13844
+ this.start = null;
13845
+ try {
13846
+ this.controller.selectTextShape({
13847
+ text: options.typeText || "Type",
13848
+ x: point.x,
13849
+ y: point.y,
13850
+ orientation: options.tool === "type-vertical" ? "vertical" : "horizontal",
13851
+ style: { fontSize: _nullishCoalesce(options.typeSize, () => ( 72)), fontFamily: options.typeFamily || "sans-serif" },
13852
+ mode: selectionModeFromModifiers(modifiers, options.mode),
13853
+ feather: _nullishCoalesce(options.feather, () => ( 0)),
13854
+ antiAlias: options.antiAlias
13855
+ });
13856
+ } catch (err) {
13857
+ this.error = err instanceof Error ? err.message : String(err);
13858
+ }
13859
+ return;
13860
+ }
13792
13861
  if (options.tool === "wand" || options.tool === "range") {
13793
13862
  this.start = null;
13794
13863
  const common = {
@@ -13922,7 +13991,7 @@ function handleSelectionShortcut(controller, e, onError) {
13922
13991
  try {
13923
13992
  fn();
13924
13993
  } catch (err) {
13925
- _optionalChain([onError, 'optionalCall', _475 => _475(err instanceof Error ? err.message : String(err))]);
13994
+ _optionalChain([onError, 'optionalCall', _477 => _477(err instanceof Error ? err.message : String(err))]);
13926
13995
  }
13927
13996
  return true;
13928
13997
  };
@@ -13937,9 +14006,9 @@ function handleMaskViewKey(controller, e) {
13937
14006
  if (e.ctrlKey || e.metaKey || e.altKey || e.key !== "\\") return false;
13938
14007
  const id = controller.getState().activeLayerId;
13939
14008
  const layer = id ? controller.getLayer(id) : null;
13940
- if (!_optionalChain([layer, 'optionalAccess', _476 => _476.mask]) || layer.mask.source) return false;
14009
+ if (!_optionalChain([layer, 'optionalAccess', _478 => _478.mask]) || layer.mask.source) return false;
13941
14010
  const view = controller.getMaskView();
13942
- controller.setMaskView(_optionalChain([view, 'optionalAccess', _477 => _477.layerId]) === layer.id && view.mode === "overlay" ? "off" : "overlay", layer.id);
14011
+ controller.setMaskView(_optionalChain([view, 'optionalAccess', _479 => _479.layerId]) === layer.id && view.mode === "overlay" ? "off" : "overlay", layer.id);
13943
14012
  return true;
13944
14013
  }
13945
14014
  function handleQuickMaskKey(controller, e) {
@@ -14153,7 +14222,7 @@ var PaintGesture = (_class12 = class {
14153
14222
  const layer = this.controller.getActiveLayer();
14154
14223
  if (!layer) throw new Error("Select a layer to move in the Layers panel.");
14155
14224
  if (layer.type !== "pixel" && layer.type !== "shape" && layer.type !== "smart") throw new Error(`Only pixel, shape and smart object layers move; "${layer.name}" is a ${layer.type} layer.`);
14156
- if (_optionalChain([layer, 'access', _478 => _478.locks, 'optionalAccess', _479 => _479.all]) || _optionalChain([layer, 'access', _480 => _480.locks, 'optionalAccess', _481 => _481.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
14225
+ if (_optionalChain([layer, 'access', _480 => _480.locks, 'optionalAccess', _481 => _481.all]) || _optionalChain([layer, 'access', _482 => _482.locks, 'optionalAccess', _483 => _483.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
14157
14226
  const origin = layer.type === "pixel" ? { ...layer.offset } : layer.type === "smart" ? { ...layer.placement.corners[0] } : (() => {
14158
14227
  const b = _chunk2UR4OX3Bcjs.shapeGeometryBounds.call(void 0, layer);
14159
14228
  return b ? { x: b.x, y: b.y } : { x: 0, y: 0 };
@@ -14210,7 +14279,7 @@ var PaintGesture = (_class12 = class {
14210
14279
  this.move = null;
14211
14280
  }
14212
14281
  cancel() {
14213
- _optionalChain([this, 'access', _482 => _482.stroke, 'optionalAccess', _483 => _483.cancel, 'call', _484 => _484()]);
14282
+ _optionalChain([this, 'access', _484 => _484.stroke, 'optionalAccess', _485 => _485.cancel, 'call', _486 => _486()]);
14214
14283
  this.stroke = null;
14215
14284
  this.move = null;
14216
14285
  }
@@ -15291,7 +15360,7 @@ function createImageSmartObjectTools(controller) {
15291
15360
  const layerSummary = (id) => {
15292
15361
  const s = controller.getState();
15293
15362
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
15294
- return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _485 => _485.parent, 'optionalAccess', _486 => _486.id]), () => ( null)), index: loc.index } : null;
15363
+ return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _487 => _487.parent, 'optionalAccess', _488 => _488.id]), () => ( null)), index: loc.index } : null;
15295
15364
  };
15296
15365
  const getSmart = {
15297
15366
  name: "get_smart_object",
@@ -15848,7 +15917,7 @@ function createImageShapeTools(controller) {
15848
15917
  const layerSummary = (id) => {
15849
15918
  const s = controller.getState();
15850
15919
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
15851
- return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _487 => _487.parent, 'optionalAccess', _488 => _488.id]), () => ( null)), index: loc.index } : null;
15920
+ return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _489 => _489.parent, 'optionalAccess', _490 => _490.id]), () => ( null)), index: loc.index } : null;
15852
15921
  };
15853
15922
  const get = {
15854
15923
  name: "get_shape_layer",
@@ -16065,7 +16134,7 @@ function createImageShapeTools(controller) {
16065
16134
  const mode = args.mode;
16066
16135
  controller.pathToSelection(pathSpec(args), { feather: args.feather, antiAlias: args.antiAlias, mode });
16067
16136
  const sel = controller.getSelection();
16068
- return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _489 => _489.bounds]), () => ( null)), area: Math.round(sel ? _chunk2UR4OX3Bcjs.selectionArea.call(void 0, sel) : 0) };
16137
+ return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _491 => _491.bounds]), () => ( null)), area: Math.round(sel ? _chunk2UR4OX3Bcjs.selectionArea.call(void 0, sel) : 0) };
16069
16138
  }
16070
16139
  };
16071
16140
  const getVectorMask = {
@@ -16096,7 +16165,7 @@ function createImageShapeTools(controller) {
16096
16165
  handler: (args) => {
16097
16166
  const id = layerArg(args.layerId);
16098
16167
  const spec = pathSpec(args);
16099
- const hasPath = _optionalChain([spec, 'access', _490 => _490.components, 'optionalAccess', _491 => _491.length]) || spec.shape !== void 0 || spec.subpaths !== void 0;
16168
+ const hasPath = _optionalChain([spec, 'access', _492 => _492.components, 'optionalAccess', _493 => _493.length]) || spec.shape !== void 0 || spec.subpaths !== void 0;
16100
16169
  const from = _nullishCoalesce(args.from, () => ( (hasPath ? "path" : "reveal-all")));
16101
16170
  if (from !== "selection" && TRACE_KEYS.some((k) => args[k] !== void 0)) throw new Error("tolerance, cornerRoundness and minArea apply only to from selection.");
16102
16171
  controller.addVectorMask(id, from, spec, traceOptions(args));
@@ -16210,7 +16279,7 @@ function createImageTypeTools(controller) {
16210
16279
  const layerSummary = (id) => {
16211
16280
  const s = controller.getState();
16212
16281
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
16213
- return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _492 => _492.parent, 'optionalAccess', _493 => _493.id]), () => ( null)), index: loc.index } : null;
16282
+ return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _494 => _494.parent, 'optionalAccess', _495 => _495.id]), () => ( null)), index: loc.index } : null;
16214
16283
  };
16215
16284
  const range = (args) => ({ start: args.start, end: args.end });
16216
16285
  const listFonts = {
@@ -16219,7 +16288,7 @@ function createImageTypeTools(controller) {
16219
16288
  description: "Returns the font families type layers can use here (generic families such as sans-serif always work). Changes nothing.",
16220
16289
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
16221
16290
  annotations: { title: "List fonts", ...READ11 },
16222
- handler: () => ({ families: controller.listFonts(), shaper: _nullishCoalesce(_optionalChain([controller, 'access', _494 => _494.getTextShaper, 'call', _495 => _495(), 'optionalAccess', _496 => _496.id]), () => ( null)) })
16291
+ handler: () => ({ families: controller.listFonts(), shaper: _nullishCoalesce(_optionalChain([controller, 'access', _496 => _496.getTextShaper, 'call', _497 => _497(), 'optionalAccess', _498 => _498.id]), () => ( null)) })
16223
16292
  };
16224
16293
  const get = {
16225
16294
  name: "get_text_layer",
@@ -16333,7 +16402,43 @@ function createImageTypeTools(controller) {
16333
16402
  return { layer: layerSummary(id), shape: controller.getShapeLayer(id), warnings };
16334
16403
  }
16335
16404
  };
16336
- return [listFonts, get, add2, setText, setStyle, setParagraph, setFrame, toShape];
16405
+ const typeMask = {
16406
+ name: "select_text_shape",
16407
+ title: "Select the shape of text",
16408
+ description: "Horizontal / Vertical Type Mask: selects the shape of text laid out as add_text_layer would place it (font family, size, weight, tracking, box, rotation; colour is ignored), combined with the current selection by mode. No layer is added. Vertical stacks the characters top to bottom, centred on x (one column; add more with mode add). Use it to cut text out of an image (layer_via_copy), fill letters with a photo (add_layer_mask), or mask an adjustment. Check fonts with list_fonts first. One undo step. Returns the selection.",
16409
+ inputSchema: {
16410
+ type: "object",
16411
+ properties: {
16412
+ text: { type: "string", minLength: 1, description: "The text; \\n starts a new line (horizontal only)." },
16413
+ x: { type: "number", description: "Document x of the origin, pixels (vertical: the column centre)." },
16414
+ y: { type: "number", description: "Document y of the origin (the first baseline), pixels." },
16415
+ orientation: { type: "string", enum: ["horizontal", "vertical"], description: "horizontal (default) or vertical (characters stacked top to bottom)." },
16416
+ box: {
16417
+ type: "object",
16418
+ description: "Horizontal only: wrap in this box, pixels.",
16419
+ properties: { width: { type: "number", minimum: 1, description: "Box width, pixels." }, height: { type: "number", minimum: 1, description: "Box height, pixels." } },
16420
+ required: ["width", "height"],
16421
+ additionalProperties: false
16422
+ },
16423
+ style: { type: "object", description: "Character style (size in px, family, weight, tracking\u2026; colour is ignored).", properties: STYLE, additionalProperties: false },
16424
+ paragraph: { type: "object", description: "Paragraph style (alignment, leading\u2026).", properties: PARAGRAPH, additionalProperties: false },
16425
+ rotation: { type: "number", description: "Degrees clockwise about the origin (default 0)." },
16426
+ mode: { type: "string", enum: ["replace", "add", "subtract", "intersect"], description: "How it combines with the current selection (default replace)." },
16427
+ feather: { type: "number", minimum: 0, maximum: 1e3, description: "Feather radius in px (default 0)." },
16428
+ antiAlias: { type: "boolean", description: "Soft glyph edges (default true)." }
16429
+ },
16430
+ required: ["text", "x", "y"],
16431
+ additionalProperties: false
16432
+ },
16433
+ annotations: { title: "Select the shape of text", ...WRITE9 },
16434
+ handler: (args) => {
16435
+ const init = pick2(args, ["text", "x", "y", "orientation", "box", "style", "paragraph", "rotation", "mode", "feather", "antiAlias"]);
16436
+ controller.selectTextShape(init);
16437
+ const sel = controller.getSelection();
16438
+ return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _499 => _499.bounds]), () => ( null)), area: Math.round(sel ? _chunk2UR4OX3Bcjs.selectionArea.call(void 0, sel) : 0) };
16439
+ }
16440
+ };
16441
+ return [listFonts, get, add2, setText, setStyle, setParagraph, setFrame, toShape, typeMask];
16337
16442
  }
16338
16443
 
16339
16444
  // src/image-editor/tools.ts
@@ -16509,7 +16614,7 @@ function createImageEditorToolProvider(controller, options = {}) {
16509
16614
  for (const ref of [aboveId, parentId]) {
16510
16615
  if (ref !== void 0 && !controller.getLayer(ref)) throw new Error(`Unknown layer "${ref}". Call list_layers for ids.`);
16511
16616
  }
16512
- if (parentId !== void 0 && _optionalChain([controller, 'access', _497 => _497.getLayer, 'call', _498 => _498(parentId), 'optionalAccess', _499 => _499.type]) !== "group") throw new Error(`Layer "${parentId}" is not a group.`);
16617
+ if (parentId !== void 0 && _optionalChain([controller, 'access', _500 => _500.getLayer, 'call', _501 => _501(parentId), 'optionalAccess', _502 => _502.type]) !== "group") throw new Error(`Layer "${parentId}" is not a group.`);
16513
16618
  const id = controller.addAdjustmentLayer({ kind, params, opacity, blend, name, aboveId, parentId, useSelection: useSelection !== false });
16514
16619
  const layer = controller.getAdjustmentLayer(id);
16515
16620
  return { layer: JSON.parse(JSON.stringify(layer)), index: controller.getAdjustmentLayers().findIndex((l) => l.id === id), masked: Boolean(layer.mask) };
@@ -16823,7 +16928,7 @@ function maskThumbnailClick(controller, layer, e) {
16823
16928
  } else if (e.altKey && !layer.mask.source) {
16824
16929
  const mode = e.shiftKey ? "overlay" : "gray";
16825
16930
  const view = controller.getMaskView();
16826
- controller.setMaskView(_optionalChain([view, 'optionalAccess', _500 => _500.layerId]) === layer.id && view.mode === mode ? "off" : mode, layer.id);
16931
+ controller.setMaskView(_optionalChain([view, 'optionalAccess', _503 => _503.layerId]) === layer.id && view.mode === mode ? "off" : mode, layer.id);
16827
16932
  } else if (e.shiftKey) {
16828
16933
  controller.setLayerMaskProps(layer.id, { enabled: layer.mask.enabled === false });
16829
16934
  } else {
@@ -16887,7 +16992,7 @@ function layerHasThumbnail(layer) {
16887
16992
  return layer.type === "pixel" || layer.type === "shape" || layer.type === "type";
16888
16993
  }
16889
16994
  function layerWarning(layer) {
16890
- if (layer.type === "type" && _optionalChain([layer, 'access', _501 => _501.missingFonts, 'optionalAccess', _502 => _502.length])) {
16995
+ if (layer.type === "type" && _optionalChain([layer, 'access', _504 => _504.missingFonts, 'optionalAccess', _505 => _505.length])) {
16891
16996
  return `Missing ${layer.missingFonts.length === 1 ? "font" : "fonts"}: ${layer.missingFonts.join(", ")}. ${layer.rendering === "stored" ? "Showing the saved pixels until the text is edited." : "Drawn with a fallback font."}`;
16892
16997
  }
16893
16998
  return null;
@@ -16910,16 +17015,16 @@ function layerMenu(controller) {
16910
17015
  const siblings = loc ? loc.parent ? loc.parent.children : s.layers : [];
16911
17016
  const below = loc ? siblings[loc.index - 1] : void 0;
16912
17017
  const hasSel = controller.hasSelection;
16913
- const isPixel = _optionalChain([active, 'optionalAccess', _503 => _503.type]) === "pixel";
16914
- const hasOwnPixels = _optionalChain([active, 'optionalAccess', _504 => _504.type]) === "pixel" || _optionalChain([active, 'optionalAccess', _505 => _505.type]) === "shape" || _optionalChain([active, 'optionalAccess', _506 => _506.type]) === "type" || _optionalChain([active, 'optionalAccess', _507 => _507.type]) === "smart";
17018
+ const isPixel = _optionalChain([active, 'optionalAccess', _506 => _506.type]) === "pixel";
17019
+ const hasOwnPixels = _optionalChain([active, 'optionalAccess', _507 => _507.type]) === "pixel" || _optionalChain([active, 'optionalAccess', _508 => _508.type]) === "shape" || _optionalChain([active, 'optionalAccess', _509 => _509.type]) === "type" || _optionalChain([active, 'optionalAccess', _510 => _510.type]) === "smart";
16915
17020
  return [
16916
17021
  { action: "new-layer", label: "New Layer", enabled: true },
16917
17022
  { action: "new-group", label: "New Group", enabled: true },
16918
17023
  { action: "duplicate", label: "Duplicate Layer", enabled: Boolean(active) },
16919
17024
  { action: "delete", label: "Delete Layer", enabled: Boolean(active) },
16920
17025
  { action: "group-selected", label: "Group Layer", enabled: Boolean(active) },
16921
- { action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess', _508 => _508.type]) === "group" },
16922
- { action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess', _509 => _509.visible]) && _optionalChain([below, 'optionalAccess', _510 => _510.type]) === "pixel") },
17026
+ { action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess', _511 => _511.type]) === "group" },
17027
+ { action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess', _512 => _512.visible]) && _optionalChain([below, 'optionalAccess', _513 => _513.type]) === "pixel") },
16923
17028
  { action: "merge-visible", label: "Merge Visible", enabled: s.layers.some((l) => l.visible) },
16924
17029
  { action: "flatten", label: "Flatten Image", enabled: s.layers.length > 0 },
16925
17030
  { action: "via-copy", label: "Layer via Copy", enabled: isPixel && hasSel },
@@ -16929,27 +17034,27 @@ function layerMenu(controller) {
16929
17034
  { action: "add-mask-hide-selection", label: "Add Mask Hiding Selection", enabled: Boolean(active) && hasSel },
16930
17035
  { action: "add-mask-transparency", label: "Add Mask from Transparency", enabled: hasOwnPixels },
16931
17036
  { action: "select-transparency", label: "Select Layer Pixels", enabled: hasOwnPixels },
16932
- { action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess', _511 => _511.mask])) },
16933
- { action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _512 => _512.mask])) },
16934
- { action: "toggle-mask", label: _optionalChain([active, 'optionalAccess', _513 => _513.mask, 'optionalAccess', _514 => _514.enabled]) === false ? "Enable Layer Mask" : "Disable Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _515 => _515.mask])) },
16935
- { action: "toggle-mask-link", label: _optionalChain([active, 'optionalAccess', _516 => _516.mask, 'optionalAccess', _517 => _517.linked]) === false ? "Link Layer Mask" : "Unlink Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _518 => _518.mask]) && !active.mask.source) },
16936
- { action: "add-vector-mask", label: "Add Vector Mask (Reveal All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _519 => _519.mask, 'optionalAccess', _520 => _520.source])) },
16937
- { action: "add-vector-mask-hide", label: "Add Vector Mask (Hide All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _521 => _521.mask, 'optionalAccess', _522 => _522.source])) },
16938
- { action: "add-vector-mask-selection", label: "Add Vector Mask from Selection", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _523 => _523.mask, 'optionalAccess', _524 => _524.source])) && hasSel },
16939
- { action: "delete-vector-mask", label: "Delete Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _525 => _525.vectorMask])) },
16940
- { action: "toggle-vector-mask", label: _optionalChain([active, 'optionalAccess', _526 => _526.vectorMask, 'optionalAccess', _527 => _527.enabled]) === false ? "Enable Vector Mask" : "Disable Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _528 => _528.vectorMask])) },
16941
- { action: "rasterize-vector-mask", label: "Rasterize Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _529 => _529.vectorMask])) },
16942
- { action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess', _530 => _530.type]) === "annotation" || _optionalChain([active, 'optionalAccess', _531 => _531.type]) === "smart" || _optionalChain([active, 'optionalAccess', _532 => _532.type]) === "shape" || _optionalChain([active, 'optionalAccess', _533 => _533.type]) === "type" || isPixel && Boolean(_optionalChain([active, 'optionalAccess', _534 => _534.type]) === "pixel" && _optionalChain([active, 'access', _535 => _535.filters, 'optionalAccess', _536 => _536.length])) },
17037
+ { action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess', _514 => _514.mask])) },
17038
+ { action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _515 => _515.mask])) },
17039
+ { action: "toggle-mask", label: _optionalChain([active, 'optionalAccess', _516 => _516.mask, 'optionalAccess', _517 => _517.enabled]) === false ? "Enable Layer Mask" : "Disable Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _518 => _518.mask])) },
17040
+ { action: "toggle-mask-link", label: _optionalChain([active, 'optionalAccess', _519 => _519.mask, 'optionalAccess', _520 => _520.linked]) === false ? "Link Layer Mask" : "Unlink Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _521 => _521.mask]) && !active.mask.source) },
17041
+ { action: "add-vector-mask", label: "Add Vector Mask (Reveal All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _522 => _522.mask, 'optionalAccess', _523 => _523.source])) },
17042
+ { action: "add-vector-mask-hide", label: "Add Vector Mask (Hide All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _524 => _524.mask, 'optionalAccess', _525 => _525.source])) },
17043
+ { action: "add-vector-mask-selection", label: "Add Vector Mask from Selection", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _526 => _526.mask, 'optionalAccess', _527 => _527.source])) && hasSel },
17044
+ { action: "delete-vector-mask", label: "Delete Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _528 => _528.vectorMask])) },
17045
+ { action: "toggle-vector-mask", label: _optionalChain([active, 'optionalAccess', _529 => _529.vectorMask, 'optionalAccess', _530 => _530.enabled]) === false ? "Enable Vector Mask" : "Disable Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _531 => _531.vectorMask])) },
17046
+ { action: "rasterize-vector-mask", label: "Rasterize Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _532 => _532.vectorMask])) },
17047
+ { action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess', _533 => _533.type]) === "annotation" || _optionalChain([active, 'optionalAccess', _534 => _534.type]) === "smart" || _optionalChain([active, 'optionalAccess', _535 => _535.type]) === "shape" || _optionalChain([active, 'optionalAccess', _536 => _536.type]) === "type" || isPixel && Boolean(_optionalChain([active, 'optionalAccess', _537 => _537.type]) === "pixel" && _optionalChain([active, 'access', _538 => _538.filters, 'optionalAccess', _539 => _539.length])) },
16943
17048
  { action: "convert-smart", label: "Convert to Smart Object", enabled: Boolean(active && active.type !== "annotation") },
16944
- { action: "edit-contents", label: "Edit Contents", enabled: _optionalChain([active, 'optionalAccess', _537 => _537.type]) === "smart" },
16945
- { action: "smart-via-copy", label: "New Smart Object via Copy", enabled: _optionalChain([active, 'optionalAccess', _538 => _538.type]) === "smart" },
16946
- { action: "add-filter-mask", label: "Add Smart Filter Mask", enabled: _optionalChain([active, 'optionalAccess', _539 => _539.type]) === "smart" && !_optionalChain([active, 'access', _540 => _540.smartFilters, 'optionalAccess', _541 => _541.mask]) },
16947
- { action: "toggle-clip", label: _optionalChain([active, 'optionalAccess', _542 => _542.clipped]) ? "Release Clipping Mask" : "Create Clipping Mask", enabled: Boolean(loc && loc.index > 0) }
17049
+ { action: "edit-contents", label: "Edit Contents", enabled: _optionalChain([active, 'optionalAccess', _540 => _540.type]) === "smart" },
17050
+ { action: "smart-via-copy", label: "New Smart Object via Copy", enabled: _optionalChain([active, 'optionalAccess', _541 => _541.type]) === "smart" },
17051
+ { action: "add-filter-mask", label: "Add Smart Filter Mask", enabled: _optionalChain([active, 'optionalAccess', _542 => _542.type]) === "smart" && !_optionalChain([active, 'access', _543 => _543.smartFilters, 'optionalAccess', _544 => _544.mask]) },
17052
+ { action: "toggle-clip", label: _optionalChain([active, 'optionalAccess', _545 => _545.clipped]) ? "Release Clipping Mask" : "Create Clipping Mask", enabled: Boolean(loc && loc.index > 0) }
16948
17053
  ];
16949
17054
  }
16950
17055
  async function runLayerMenuAction(controller, action) {
16951
17056
  const active = controller.getActiveLayer();
16952
- const id = _optionalChain([active, 'optionalAccess', _543 => _543.id]);
17057
+ const id = _optionalChain([active, 'optionalAccess', _546 => _546.id]);
16953
17058
  try {
16954
17059
  switch (action) {
16955
17060
  case "new-layer":
@@ -17005,10 +17110,10 @@ async function runLayerMenuAction(controller, action) {
17005
17110
  if (id) controller.removeLayerMask(id);
17006
17111
  break;
17007
17112
  case "toggle-mask":
17008
- if (id && _optionalChain([active, 'optionalAccess', _544 => _544.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
17113
+ if (id && _optionalChain([active, 'optionalAccess', _547 => _547.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
17009
17114
  break;
17010
17115
  case "toggle-mask-link":
17011
- if (id && _optionalChain([active, 'optionalAccess', _545 => _545.mask])) controller.setLayerMaskProps(id, { linked: active.mask.linked === false });
17116
+ if (id && _optionalChain([active, 'optionalAccess', _548 => _548.mask])) controller.setLayerMaskProps(id, { linked: active.mask.linked === false });
17012
17117
  break;
17013
17118
  case "add-vector-mask":
17014
17119
  case "add-vector-mask-hide":
@@ -17021,7 +17126,7 @@ async function runLayerMenuAction(controller, action) {
17021
17126
  if (id) controller.removeVectorMask(id);
17022
17127
  break;
17023
17128
  case "toggle-vector-mask":
17024
- if (id && _optionalChain([active, 'optionalAccess', _546 => _546.vectorMask])) controller.setVectorMaskProps(id, { enabled: active.vectorMask.enabled === false });
17129
+ if (id && _optionalChain([active, 'optionalAccess', _549 => _549.vectorMask])) controller.setVectorMaskProps(id, { enabled: active.vectorMask.enabled === false });
17025
17130
  break;
17026
17131
  case "rasterize-vector-mask":
17027
17132
  if (id) controller.rasterizeVectorMask(id);
@@ -17042,7 +17147,7 @@ async function runLayerMenuAction(controller, action) {
17042
17147
  if (id) controller.setSmartFilterMask(id, "reveal-all");
17043
17148
  break;
17044
17149
  case "toggle-clip":
17045
- if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _547 => _547.clipped]) });
17150
+ if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _550 => _550.clipped]) });
17046
17151
  break;
17047
17152
  }
17048
17153
  return null;
@@ -17052,7 +17157,7 @@ async function runLayerMenuAction(controller, action) {
17052
17157
  }
17053
17158
  function smartFilterRows(layer) {
17054
17159
  if (layer.type !== "smart") return [];
17055
- const list = _nullishCoalesce(_optionalChain([layer, 'access', _548 => _548.smartFilters, 'optionalAccess', _549 => _549.filters]), () => ( []));
17160
+ const list = _nullishCoalesce(_optionalChain([layer, 'access', _551 => _551.smartFilters, 'optionalAccess', _552 => _552.filters]), () => ( []));
17056
17161
  const rows = list.map((f, index) => ({
17057
17162
  filter: f,
17058
17163
  index,
@@ -17078,8 +17183,8 @@ function extractNormalizedLayerItems(controller, fallbackImageUrl = "") {
17078
17183
  };
17079
17184
  collectSerialized(_nullishCoalesce(serialized.layers, () => ( [])));
17080
17185
  const sLayerMap = new Map(allSerializedLayers.map((sl) => [sl.id, sl]));
17081
- const imgW = _optionalChain([state, 'access', _550 => _550.imageDimensions, 'optionalAccess', _551 => _551.width]) || 1;
17082
- const imgH = _optionalChain([state, 'access', _552 => _552.imageDimensions, 'optionalAccess', _553 => _553.height]) || 1;
17186
+ const imgW = _optionalChain([state, 'access', _553 => _553.imageDimensions, 'optionalAccess', _554 => _554.width]) || 1;
17187
+ const imgH = _optionalChain([state, 'access', _555 => _555.imageDimensions, 'optionalAccess', _556 => _556.height]) || 1;
17083
17188
  return ctrlLayers.map((l) => {
17084
17189
  const bounds = controller.getLayerBounds(l.id) || {
17085
17190
  x: 0,
@@ -17088,8 +17193,8 @@ function extractNormalizedLayerItems(controller, fallbackImageUrl = "") {
17088
17193
  height: imgH
17089
17194
  };
17090
17195
  const sLayer = sLayerMap.get(l.id);
17091
- const assetKey = _optionalChain([sLayer, 'optionalAccess', _554 => _554.asset]);
17092
- const layerDataUrl = assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess', _555 => _555.source]) === "document" ? fallbackImageUrl : "");
17196
+ const assetKey = _optionalChain([sLayer, 'optionalAccess', _557 => _557.asset]);
17197
+ const layerDataUrl = assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess', _558 => _558.source]) === "document" ? fallbackImageUrl : "");
17093
17198
  return {
17094
17199
  id: l.id,
17095
17200
  name: l.name || "Untitled Layer",
@@ -17143,9 +17248,9 @@ async function addLayerOfKind(controller, id, init) {
17143
17248
  const cx = Math.round(canvas.width / 2);
17144
17249
  const cy = Math.round(canvas.height / 2);
17145
17250
  return controller.addTextLayer({
17146
- text: _optionalChain([init, 'optionalAccess', _556 => _556.text]) || "New Text",
17147
- x: typeof _optionalChain([init, 'optionalAccess', _557 => _557.x]) === "number" ? init.x : cx - 100,
17148
- y: typeof _optionalChain([init, 'optionalAccess', _558 => _558.y]) === "number" ? init.y : cy,
17251
+ text: _optionalChain([init, 'optionalAccess', _559 => _559.text]) || "New Text",
17252
+ x: typeof _optionalChain([init, 'optionalAccess', _560 => _560.x]) === "number" ? init.x : cx - 100,
17253
+ y: typeof _optionalChain([init, 'optionalAccess', _561 => _561.y]) === "number" ? init.y : cy,
17149
17254
  ...init
17150
17255
  });
17151
17256
  }
@@ -17158,10 +17263,10 @@ async function addLayerOfKind(controller, id, init) {
17158
17263
  return controller.addShapeLayer({
17159
17264
  shape: {
17160
17265
  kind: "rect",
17161
- x: typeof _optionalChain([init, 'optionalAccess', _559 => _559.x]) === "number" ? init.x : cx - Math.round(w / 2),
17162
- y: typeof _optionalChain([init, 'optionalAccess', _560 => _560.y]) === "number" ? init.y : cy - Math.round(h / 2),
17163
- width: typeof _optionalChain([init, 'optionalAccess', _561 => _561.width]) === "number" ? init.width : w,
17164
- height: typeof _optionalChain([init, 'optionalAccess', _562 => _562.height]) === "number" ? init.height : h
17266
+ x: typeof _optionalChain([init, 'optionalAccess', _562 => _562.x]) === "number" ? init.x : cx - Math.round(w / 2),
17267
+ y: typeof _optionalChain([init, 'optionalAccess', _563 => _563.y]) === "number" ? init.y : cy - Math.round(h / 2),
17268
+ width: typeof _optionalChain([init, 'optionalAccess', _564 => _564.width]) === "number" ? init.width : w,
17269
+ height: typeof _optionalChain([init, 'optionalAccess', _565 => _565.height]) === "number" ? init.height : h
17165
17270
  },
17166
17271
  name: "Rectangle",
17167
17272
  ...init
@@ -17176,10 +17281,10 @@ async function addLayerOfKind(controller, id, init) {
17176
17281
  return controller.addShapeLayer({
17177
17282
  shape: {
17178
17283
  kind: "ellipse",
17179
- x: typeof _optionalChain([init, 'optionalAccess', _563 => _563.x]) === "number" ? init.x : cx - Math.round(w / 2),
17180
- y: typeof _optionalChain([init, 'optionalAccess', _564 => _564.y]) === "number" ? init.y : cy - Math.round(h / 2),
17181
- width: typeof _optionalChain([init, 'optionalAccess', _565 => _565.width]) === "number" ? init.width : w,
17182
- height: typeof _optionalChain([init, 'optionalAccess', _566 => _566.height]) === "number" ? init.height : h
17284
+ x: typeof _optionalChain([init, 'optionalAccess', _566 => _566.x]) === "number" ? init.x : cx - Math.round(w / 2),
17285
+ y: typeof _optionalChain([init, 'optionalAccess', _567 => _567.y]) === "number" ? init.y : cy - Math.round(h / 2),
17286
+ width: typeof _optionalChain([init, 'optionalAccess', _568 => _568.width]) === "number" ? init.width : w,
17287
+ height: typeof _optionalChain([init, 'optionalAccess', _569 => _569.height]) === "number" ? init.height : h
17183
17288
  },
17184
17289
  name: "Ellipse",
17185
17290
  ...init
@@ -17240,18 +17345,18 @@ function layerEffectsPanel(layer) {
17240
17345
  if (!layer) return { ...empty, available: false, reason: "Select a layer to add a layer style." };
17241
17346
  if (layer.type === "adjustment") return { ...empty, available: false, reason: "Adjustment layers cannot have a layer style." };
17242
17347
  const fx = layer.effects;
17243
- const readOnly = Boolean(_optionalChain([layer, 'access', _567 => _567.locks, 'optionalAccess', _568 => _568.all]));
17348
+ const readOnly = Boolean(_optionalChain([layer, 'access', _570 => _570.locks, 'optionalAccess', _571 => _571.all]));
17244
17349
  return {
17245
17350
  available: true,
17246
17351
  readOnly,
17247
17352
  reason: readOnly ? "The layer is locked; unlock it to change its layer style." : void 0,
17248
- enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _569 => _569.enabled]), () => ( true)),
17249
- scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _570 => _570.scale]), () => ( 1)),
17250
- rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess', _571 => _571.items]), () => ( []))).map((e) => ({ id: e.id, kind: e.kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, e.kind), enabled: e.enabled }))
17353
+ enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _572 => _572.enabled]), () => ( true)),
17354
+ scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _573 => _573.scale]), () => ( 1)),
17355
+ rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess', _574 => _574.items]), () => ( []))).map((e) => ({ id: e.id, kind: e.kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, e.kind), enabled: e.enabled }))
17251
17356
  };
17252
17357
  }
17253
17358
  function layerEffectsBadge(layer) {
17254
- if (!_optionalChain([layer, 'access', _572 => _572.effects, 'optionalAccess', _573 => _573.items, 'access', _574 => _574.length])) return null;
17359
+ if (!_optionalChain([layer, 'access', _575 => _575.effects, 'optionalAccess', _576 => _576.items, 'access', _577 => _577.length])) return null;
17255
17360
  return _chunkHGTDMKNEcjs.hasActiveEffects.call(void 0, layer.effects) ? "on" : "off";
17256
17361
  }
17257
17362
  var LAYER_EFFECT_MENU = _chunkHGTDMKNEcjs.LAYER_EFFECT_KINDS.map((kind) => ({ kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, kind) }));
@@ -17296,8 +17401,8 @@ function fillControls(f, allowPattern, patterns) {
17296
17401
  }
17297
17402
  function gradientControls(prefix, g) {
17298
17403
  return [
17299
- { key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _575 => _575.stops, 'access', _576 => _576[0], 'optionalAccess', _577 => _577.color]), () => ( "#000000")) },
17300
- { key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _578 => _578.stops, 'access', _579 => _579[g.stops.length - 1], 'optionalAccess', _580 => _580.color]), () => ( "#ffffff")) },
17404
+ { key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _578 => _578.stops, 'access', _579 => _579[0], 'optionalAccess', _580 => _580.color]), () => ( "#000000")) },
17405
+ { key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _581 => _581.stops, 'access', _582 => _582[g.stops.length - 1], 'optionalAccess', _583 => _583.color]), () => ( "#ffffff")) },
17301
17406
  { key: `${prefix}.style`, label: "Style", type: "select", value: g.style, options: opt(["linear", "Linear"], ["radial", "Radial"], ["angle", "Angle"], ["reflected", "Reflected"], ["diamond", "Diamond"]) },
17302
17407
  { key: `${prefix}.angle`, label: "Angle", type: "range", min: -180, max: 180, step: 1, value: g.angle, unit: "\xB0" },
17303
17408
  { key: `${prefix}.scale`, label: "Scale", type: "range", min: 0.1, max: 1.5, step: 0.01, value: g.scale, percent: true, unit: "%" },
@@ -17389,19 +17494,19 @@ function layerEffectControls(e, patterns = []) {
17389
17494
  }
17390
17495
  function fillOfType(current, type, patterns) {
17391
17496
  if (type === "gradient") return { type: "gradient", gradient: _chunkHGTDMKNEcjs.defaultEffectGradient.call(void 0, ) };
17392
- if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access', _581 => _581[0], 'optionalAccess', _582 => _582.id]), () => ( "checker")), scale: 1 };
17497
+ if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access', _584 => _584[0], 'optionalAccess', _585 => _585.id]), () => ( "checker")), scale: 1 };
17393
17498
  return { type: "color", color: current.type === "color" ? current.color : "#000000" };
17394
17499
  }
17395
17500
  function effectControlChange(effect, key, value, patterns = []) {
17396
17501
  const [top, ...rest] = key.split(".");
17397
17502
  if (top === "fill" && rest[0] === "type") return { fill: fillOfType(effect.fill, String(value), patterns) };
17398
17503
  if (top === "patternId" && !rest.length) {
17399
- const name = _optionalChain([patternOptions, 'call', _583 => _583(patterns), 'access', _584 => _584.find, 'call', _585 => _585((o) => o.value === value), 'optionalAccess', _586 => _586.label]);
17504
+ const name = _optionalChain([patternOptions, 'call', _586 => _586(patterns), 'access', _587 => _587.find, 'call', _588 => _588((o) => o.value === value), 'optionalAccess', _589 => _589.label]);
17400
17505
  return name ? { patternId: value, name } : { patternId: value };
17401
17506
  }
17402
17507
  if (!rest.length) return { [top]: value };
17403
17508
  if (top === "fill" && rest[0] === "patternId") {
17404
- const name = _optionalChain([patternOptions, 'call', _587 => _587(patterns), 'access', _588 => _588.find, 'call', _589 => _589((o) => o.value === value), 'optionalAccess', _590 => _590.label]);
17509
+ const name = _optionalChain([patternOptions, 'call', _590 => _590(patterns), 'access', _591 => _591.find, 'call', _592 => _592((o) => o.value === value), 'optionalAccess', _593 => _593.label]);
17405
17510
  return { fill: { ...effect.fill, patternId: value, ...name ? { name } : {} } };
17406
17511
  }
17407
17512
  return { [top]: setPath(getPath(effect, top), rest, value) };
@@ -17428,7 +17533,7 @@ function colorPanelView(controller) {
17428
17533
  profileName: profile.name,
17429
17534
  workingSpace: profile.builtin,
17430
17535
  mode: profile.mode,
17431
- cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access', _591 => _591.cmykProfile, 'optionalAccess', _592 => _592.name]), () => ( null)),
17536
+ cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access', _594 => _594.cmykProfile, 'optionalAccess', _595 => _595.name]), () => ( null)),
17432
17537
  proof: proof ? { id: _nullishCoalesce(proof.profile.builtin, () => ( null)), name: proof.profile.name, intent: proof.intent, simulatePaper: proof.simulatePaper, gamutWarning: proof.gamutWarning, bpc: proof.bpc } : null
17433
17538
  };
17434
17539
  }
@@ -17636,7 +17741,7 @@ var FreeTransformTool = (_class13 = class {
17636
17741
  __init121() {this.error = null}
17637
17742
  __init122() {this.lastResult = null}
17638
17743
  get active() {
17639
- return Boolean(_optionalChain([this, 'access', _593 => _593.sessionRef, 'optionalAccess', _594 => _594.isOpen]));
17744
+ return Boolean(_optionalChain([this, 'access', _596 => _596.sessionRef, 'optionalAccess', _597 => _597.isOpen]));
17640
17745
  }
17641
17746
  get session() {
17642
17747
  return this.active ? this.sessionRef : null;
@@ -17645,7 +17750,7 @@ var FreeTransformTool = (_class13 = class {
17645
17750
  return this.modeValue;
17646
17751
  }
17647
17752
  get interpolation() {
17648
- return _nullishCoalesce(_optionalChain([this, 'access', _595 => _595.sessionRef, 'optionalAccess', _596 => _596.interpolation]), () => ( "bicubic"));
17753
+ return _nullishCoalesce(_optionalChain([this, 'access', _598 => _598.sessionRef, 'optionalAccess', _599 => _599.interpolation]), () => ( "bicubic"));
17649
17754
  }
17650
17755
  /** Whether the open transform has changed anything yet (a commit would add an undo step). */
17651
17756
  get modified() {
@@ -17664,7 +17769,7 @@ var FreeTransformTool = (_class13 = class {
17664
17769
  };
17665
17770
  }
17666
17771
  changed() {
17667
- _optionalChain([this, 'access', _597 => _597.options, 'access', _598 => _598.onChange, 'optionalCall', _599 => _599()]);
17772
+ _optionalChain([this, 'access', _600 => _600.options, 'access', _601 => _601.onChange, 'optionalCall', _602 => _602()]);
17668
17773
  for (const l of this.listeners) l();
17669
17774
  }
17670
17775
  /** Opens a Free Transform (default: the selected pixels of the active layer, or the whole layer). Returns an error message or `null`. */
@@ -18057,7 +18162,7 @@ var FreeTransformTool = (_class13 = class {
18057
18162
  }
18058
18163
  /** Abandons the transform and restores everything. */
18059
18164
  cancel() {
18060
- _optionalChain([this, 'access', _600 => _600.sessionRef, 'optionalAccess', _601 => _601.cancel, 'call', _602 => _602()]);
18165
+ _optionalChain([this, 'access', _603 => _603.sessionRef, 'optionalAccess', _604 => _604.cancel, 'call', _605 => _605()]);
18061
18166
  this.sessionRef = null;
18062
18167
  this.corners = null;
18063
18168
  this.mesh = null;
@@ -18113,7 +18218,7 @@ function imageLayerAppliedEffects(layer) {
18113
18218
  const ref = (r) => ({ effect: r.effect, ...r.name ? { name: r.name } : {}, ...r.provider ? { provider: r.provider } : {} });
18114
18219
  if (layer.type === "pixel" && layer.generator) out.push({ id: "generator", ...ref(layer.generator), role: "effect layer", enabled: true, values: layer.generator.values, ...layer.generator.time ? { time: layer.generator.time } : {}, ...layer.generator.animate ? { animate: layer.generator.animate } : {} });
18115
18220
  if (layer.type === "smart")
18116
- (_nullishCoalesce(_optionalChain([layer, 'access', _603 => _603.smartFilters, 'optionalAccess', _604 => _604.filters]), () => ( []))).forEach((f, index) => {
18221
+ (_nullishCoalesce(_optionalChain([layer, 'access', _606 => _606.smartFilters, 'optionalAccess', _607 => _607.filters]), () => ( []))).forEach((f, index) => {
18117
18222
  if (f.kind === "effect") out.push({ id: f.id, ...ref(f), role: "smart filter", enabled: f.enabled && layer.smartFilters.enabled, opacity: f.opacity, blend: f.blend, values: f.values, index });
18118
18223
  });
18119
18224
  return out;