@imagemagick/magick-wasm
Version:
The WASM library for ImageMagick
2,542 lines • 377 kB
JavaScript
function dr(S) {
return S instanceof Int8Array || S instanceof Uint8Array || S instanceof Uint8ClampedArray;
}
class sr {
fileName;
data;
constructor(a, s) {
this.fileName = a, this.data = s;
}
}
const or = {
XmlResourceFiles: {
log: `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE logmap [
<!ELEMENT logmap (log)+>
<!ELEMENT log (#PCDATA)>
<!ATTLIST log events CDATA #IMPLIED>
<!ATTLIST log output CDATA #IMPLIED>
<!ATTLIST log filename CDATA #IMPLIED>
<!ATTLIST log generations CDATA #IMPLIED>
<!ATTLIST log limit CDATA #IMPLIED>
<!ATTLIST log format CDATA #IMPLIED>
]>
<logmap>
<log events="None"/>
<log output="Debug"/>
<log filename="Magick-%g.log"/>
<log generations="3"/>
<log limit="2000"/>
<log format="%t %r %u %v %d %c[%p]: %m/%f/%l/%d
%e"/>
</logmap>
`,
policy: `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
<!ELEMENT policymap (policy)*>
<!ATTLIST policymap xmlns CDATA #FIXED "">
<!ELEMENT policy EMPTY>
<!ATTLIST policy xmlns CDATA #FIXED "">
<!ATTLIST policy domain NMTOKEN #REQUIRED>
<!ATTLIST policy name NMTOKEN #IMPLIED>
<!ATTLIST policy pattern CDATA #IMPLIED>
<!ATTLIST policy rights NMTOKEN #IMPLIED>
<!ATTLIST policy stealth NMTOKEN #IMPLIED>
<!ATTLIST policy value CDATA #IMPLIED>
]>
<policymap>
<policy domain="cache" name="shared-secret" value="passphrase"/>
<policy domain="coder" rights="none" pattern="EPHEMERAL" />
<policy domain="coder" rights="none" pattern="MVG" />
<policy domain="coder" rights="none" pattern="MSL" />
<policy domain="path" rights="none" pattern="@*" />
<policy domain="path" rights="none" pattern="|*" />
</policymap>
`
}
};
class ni {
constructor() {
this.log = new sr("log.xml", or.XmlResourceFiles.log), this.policy = new sr("policy.xml", or.XmlResourceFiles.policy);
}
/**
* Gets the default configuration.
*/
static default = new ni();
/**
* Gets all the configuration files.
*/
*all() {
yield this.log, yield this.policy;
}
/// <summary>
/// Gets the log configuration.
/// </summary>
log;
/// <summary>
/// Gets the policy configuration.
/// </summary>
policy;
}
class ei {
/**
* Initializes a new instance of the {@link MagickDefine} class.
* @param format
* @param name The name of the define.
* @param value The value of the define.
*/
constructor(a, s, i) {
this.format = a, this.name = s, this.value = i;
}
/**
* Gets the format to set the define for.
*/
format;
/**
* Gets the name of the define.
*/
name;
/**
* Gets the value of the define.
*/
value;
}
class Js {
format;
constructor(a) {
this.format = a;
}
createDefine(a, s) {
return typeof s == "boolean" ? new ei(this.format, a, s ? "true" : "false") : typeof s == "string" ? new ei(this.format, a, s) : new ei(this.format, a, s.toString());
}
hasValue(a) {
return a != null;
}
}
class jo {
_x;
_y;
_paintMethod;
/**
* Initializes a new instance of the {@link DrawableColor} class.
* @param x The X coordinate.
* @param y The Y coordinate.
* @param paintMethod The paint method to use.
*/
constructor(a, s, i) {
this._x = a, this._y = s, this._paintMethod = i;
}
draw(a) {
a.color(this._x, this._y, this._paintMethod);
}
}
class Zs {
_color;
/**
* Initializes a new instance of the {@link DrawableFillColor} class.
* @param color The color to use.
*/
constructor(a) {
this._color = a;
}
draw(a) {
a.fillColor(this._color);
}
}
class eo {
_opacity;
/**
* Initializes a new instance of the {@link DrawableFillOpacity} class.
* @param opacity The opacity.
*/
constructor(a) {
this._opacity = a;
}
draw(a) {
a.fillOpacity(this._opacity.toDouble() / 100);
}
}
class to {
_pointSize;
/**
* Initializes a new instance of the {@link DrawableFontPointSize} class.
* @param pointSize The point size.
*/
constructor(a) {
this._pointSize = a;
}
draw(a) {
a.fontPointSize(this._pointSize);
}
}
class io {
/**
* Initializes a new instance of the {@link LogEvent} class.
* @param eventType - The type of the log message.
* @param message - The log message.
*/
constructor(a, s) {
this.eventType = a, this.message = s ?? "";
}
/**
* Gets the type of the log message.
*/
eventType;
/**
* Gets the log message.
*/
message;
}
const ro = {
/**
* Undefined.
*/
Undefined: 0,
/**
* Enable the image's transparency channel. Note that normally Set should be used instead of
* this, unless you specifically need to preserve the existing (but specifically turned Off)
* transparency channel.
*/
Activate: 1,
/**
* Associate the alpha channel with the image.
*/
Associate: 2,
/**
* Set any fully-transparent pixel to the background color, while leaving it fully-transparent.
* This can make some image file formats, such as PNG, smaller as the RGB values of transparent
* pixels are more uniform, and thus can compress better.
*/
Background: 3,
/**
* Turns 'On' the alpha/matte channel, then copies the grayscale intensity of the image, into
* the alpha channel, converting a grayscale mask into a transparent shaped mask ready to be
* colored appropriately. The color channels are not modified.
*/
Copy: 4,
/**
* Disables the image's transparency channel. This does not delete or change the existing data,
* it just turns off the use of that data.
*/
Deactivate: 5,
/**
* Discrete.
*/
Discrete: 6,
/**
* Disassociate the alpha channel from the image.
*/
Disassociate: 7,
/**
* Copies the alpha channel values into all the color channels and turns 'Off' the image's
* transparency, so as to generate a grayscale mask of the image's shape. The alpha channel
* data is left intact just deactivated. This is the inverse of 'Copy'.
*/
Extract: 8,
/**
* Off.
*/
Off: 9,
/**
* On.
*/
On: 10,
/**
* Enables the alpha/matte channel and forces it to be fully opaque.
*/
Opaque: 11,
/**
* Composite the image over the background color.
*/
Remove: 12,
/**
* Activates the alpha/matte channel. If it was previously turned off then it also
* resets the channel to opaque. If the image already had the alpha channel turned on,
* it will have no effect.
*/
Set: 13,
/**
* As per 'Copy' but also colors the resulting shape mask with the current background color.
* That is the RGB color channels is replaced, with appropriate alpha shape.
*/
Shape: 14,
/**
* Activates the alpha/matte channel and forces it to be fully transparent. This effectively
* creates a fully transparent image the same size as the original and with all its original
* RGB data still intact, but fully transparent.
*/
Transparent: 15,
/**
* Removes the alpha channel when the alpha value is opaque for all pixels.
*/
OffIfOpaque: 16
}, F = {
/**
* Red.
*/
Red: 0,
/**
* Cyan.
*/
Cyan: 0,
/**
* Gray.
*/
Gray: 0,
/**
* Green.
*/
Green: 1,
/**
* Magenta.
*/
Magenta: 1,
/**
* Blue.
*/
Blue: 2,
/**
* Yellow.
*/
Yellow: 2,
/**
* Black.
*/
Black: 3,
/**
* Alpha.
*/
Alpha: 4,
/**
* Index.
*/
Index: 5,
/**
* Meta 0.
*/
Meta0: 10,
/**
* Meta 1.
*/
Meta1: 11,
/**
* Meta 2.
*/
Meta2: 12,
/**
* Meta 3.
*/
Meta3: 13,
/**
* Meta 4.
*/
Meta4: 14,
/**
* Meta 5.
*/
Meta5: 15,
/**
* Meta 6.
*/
Meta6: 16,
/**
* Meta 7.
*/
Meta7: 17,
/**
* Meta 8.
*/
Meta8: 18,
/**
* Meta 9.
*/
Meta9: 19,
/**
* Meta 10.
*/
Meta10: 20,
/**
* Meta 11.
*/
Meta11: 21,
/**
* Meta 12.
*/
Meta12: 22,
/**
* Meta 13.
*/
Meta13: 23,
/**
* Meta 14.
*/
Meta14: 24,
/**
* Meta 15.
*/
Meta15: 25,
/**
* Meta 16.
*/
Meta16: 26,
/**
* Meta 17.
*/
Meta17: 27,
/**
* Meta 18.
*/
Meta18: 28,
/**
* Meta 19.
*/
Meta19: 29,
/**
* Meta 20.
*/
Meta20: 30,
/**
* Meta 21.
*/
Meta21: 31,
/**
* Meta 22.
*/
Meta22: 32,
/**
* Meta 23.
*/
Meta23: 33,
/**
* Meta 24.
*/
Meta24: 34,
/**
* Meta 25.
*/
Meta25: 35,
/**
* Meta 26.
*/
Meta26: 36,
/**
* Meta 27.
*/
Meta27: 37,
/**
* Meta 28.
*/
Meta28: 38,
/**
* Meta 29.
*/
Meta29: 39,
/**
* Meta 30.
*/
Meta30: 40,
/**
* Meta 31.
*/
Meta31: 41,
/**
* Meta 32.
*/
Meta32: 42,
/**
* Meta 33.
*/
Meta33: 43,
/**
* Meta 34.
*/
Meta34: 44,
/**
* Meta 35.
*/
Meta35: 45,
/**
* Meta 36.
*/
Meta36: 46,
/**
* Meta 37.
*/
Meta37: 47,
/**
* Meta 38.
*/
Meta38: 48,
/**
* Meta 39.
*/
Meta39: 49,
/**
* Meta 40.
*/
Meta40: 50,
/**
* Meta 41.
*/
Meta41: 51,
/**
* Meta 42.
*/
Meta42: 52,
/**
* Meta 43.
*/
Meta43: 53,
/**
* Meta 44.
*/
Meta44: 54,
/**
* Meta 45.
*/
Meta45: 55,
/**
* Meta 46.
*/
Meta46: 56,
/**
* Meta 47.
*/
Meta47: 57,
/**
* Meta 48.
*/
Meta48: 58,
/**
* Meta 49.
*/
Meta49: 59,
/**
* Meta 50.
*/
Meta50: 60,
/**
* Meta 51.
*/
Meta51: 61,
/**
* Meta 52.
*/
Meta52: 62,
/**
* Composite.
*/
Composite: 64
}, X = {
/**
* Undefined.
*/
Undefined: 0,
/**
* Red.
*/
Red: 1,
/**
* Gray.
*/
Gray: 1,
/**
* Cyan.
*/
Cyan: 1,
/**
* Green.
*/
Green: 2,
/**
* Magenta.
*/
Magenta: 2,
/**
* Blue.
*/
Blue: 4,
/**
* Yellow.
*/
Yellow: 4,
/**
* Black.
*/
Black: 8,
/**
* Alpha.
*/
Alpha: 16,
/**
* Opacity.
*/
Opacity: 16,
/**
* Index.
*/
Index: 32,
/**
* Composite.
*/
Composite: 31,
/**
* TrueAlpha.
*/
TrueAlpha: 256,
/**
* RGB.
*/
get RGB() {
return this.Red | this.Green | this.Blue;
},
/**
* CMYK.
*/
get CMYK() {
return this.Cyan | this.Magenta | this.Yellow | this.Black;
},
/**
* CMYKA.
*/
get CMYKA() {
return this.Cyan | this.Magenta | this.Yellow | this.Black | this.Alpha;
},
/**
* Meta 0
*/
Meta0: 1 << F.Meta0,
/**
* Meta 1
*/
Meta1: 1 << F.Meta1,
/**
* Meta 2
*/
Meta2: 1 << F.Meta2,
/**
* Meta 3
*/
Meta3: 1 << F.Meta3,
/**
* Meta 4
*/
Meta4: 1 << F.Meta4,
/**
* Meta 5
*/
Meta5: 1 << F.Meta5,
/**
* Meta 6
*/
Meta6: 1 << F.Meta6,
/**
* Meta 7
*/
Meta7: 1 << F.Meta7,
/**
* Meta 8
*/
Meta8: 1 << F.Meta8,
/**
* Meta 9
*/
Meta9: 1 << F.Meta9,
/**
* Meta 10
*/
Meta10: 1 << F.Meta10,
/**
* Meta 11
*/
Meta11: 1 << F.Meta11,
/**
* Meta 12
*/
Meta12: 1 << F.Meta12,
/**
* Meta 13
*/
Meta13: 1 << F.Meta13,
/**
* Meta 14
*/
Meta14: 1 << F.Meta14,
/**
* Meta 15
*/
Meta15: 1 << F.Meta15,
/**
* Meta 16
*/
Meta16: 1 << F.Meta16,
/**
* Meta 17
*/
Meta17: 1 << F.Meta17,
/**
* Meta 18
*/
Meta18: 1 << F.Meta18,
/**
* Meta 19
*/
Meta19: 1 << F.Meta19,
/**
* Meta 20
*/
Meta20: 1 << F.Meta20,
/**
* Meta 21
*/
Meta21: 1 << F.Meta21,
/**
* All.
*/
All: 134217727
};
class ao {
constructor(a, s, i, g) {
this.red = a, this.green = s, this.blue = i, this.white = g;
}
/**
* Gets the chromaticity red primary point.
*/
red;
/**
* Gets the chromaticity green primary point.
*/
green;
/**
* Gets the chromaticity blue primary point.
*/
blue;
/**
* Gets the chromaticity white primary point.
*/
white;
}
const E = {
/**
* Undefined.
*/
Undefined: 0,
/**
* CMY.
*/
CMY: 1,
/**
* CMYK.
*/
CMYK: 2,
/**
* Gray.
*/
Gray: 3,
/**
* HCL.
*/
HCL: 4,
/**
* HCLp.
*/
HCLp: 5,
/**
* HSB.
*/
HSB: 6,
/**
* HSI.
*/
HSI: 7,
/**
* HSL.
*/
HSL: 8,
/**
* HSV.
*/
HSV: 9,
/**
* HWB.
*/
HWB: 10,
/**
* Lab
*/
Lab: 11,
/**
* LCH.
*/
LCH: 12,
/**
* LCHab.
*/
LCHab: 13,
/**
* LCHuv.
*/
LCHuv: 14,
/**
* Log.
*/
Log: 15,
/**
* LMS.
*/
LMS: 16,
/**
* Luv.
*/
Luv: 17,
/**
* OHTA.
*/
OHTA: 18,
/**
* Rec601YCbCr.
*/
Rec601YCbCr: 19,
/**
* Rec709YCbCr.
*/
Rec709YCbCr: 20,
/**
* RGB.
*/
RGB: 21,
/**
* scRGB.
*/
scRGB: 22,
/**
* sRGB.
*/
sRGB: 23,
/**
* Transparent.
*/
Transparent: 24,
/**
* XyY.
*/
XyY: 25,
/**
* XYZ.
*/
XYZ: 26,
/**
* YCbCr.
*/
YCbCr: 27,
/**
* YCC.
*/
YCC: 28,
/**
* YDbDr.
*/
YDbDr: 29,
/**
* YIQ.
*/
YIQ: 30,
/**
* YPbPr.
*/
YPbPr: 31,
/**
* YUV.
*/
YUV: 32,
/**
* LinearGray.
*/
LinearGray: 33,
/**
* Jzazbz.
*/
Jzazbz: 34,
/**
* DisplayP3.
*/
DisplayP3: 35,
/**
* Adobe98.
*/
Adobe98: 36,
/**
* ProPhoto.
*/
ProPhoto: 37,
/**
* Oklab.
*/
Oklab: 38,
/**
* Oklch.
*/
Oklch: 39,
/**
* CAT02LMS.
*/
CAT02LMSC: 40
}, _r = {
[E.Undefined]: "Undefined",
[E.CMY]: "CMY",
[E.CMYK]: "CMYK",
[E.Gray]: "Gray",
[E.HCL]: "HCL",
[E.HCLp]: "HCLp",
[E.HSB]: "HSB",
[E.HSI]: "HSI",
[E.HSL]: "HSL",
[E.HSV]: "HSV",
[E.HWB]: "HWB",
[E.Lab]: "Lab",
[E.LCH]: "LCH",
[E.LCHab]: "LCHab",
[E.LCHuv]: "LCHuv",
[E.Log]: "Log",
[E.LMS]: "LMS",
[E.Luv]: "Luv",
[E.OHTA]: "OHTA",
[E.Rec601YCbCr]: "Rec601YCbCr",
[E.Rec709YCbCr]: "Rec709YCbCr",
[E.RGB]: "RGB",
[E.scRGB]: "scRGB",
[E.sRGB]: "sRGB",
[E.Transparent]: "Transparent",
[E.XyY]: "XyY",
[E.XYZ]: "XYZ",
[E.YCbCr]: "YCbCr",
[E.YCC]: "YCC",
[E.YDbDr]: "YDbDr",
[E.YIQ]: "YIQ",
[E.YPbPr]: "YPbPr",
[E.YUV]: "YUV",
[E.LinearGray]: "LinearGray",
[E.Jzazbz]: "Jzazbz",
[E.DisplayP3]: "DisplayP3",
[E.Adobe98]: "Adobe98",
[E.ProPhoto]: "ProPhoto",
[E.Oklab]: "Oklab",
[E.Oklch]: "Oklch",
[E.CAT02LMSC]: "CAT02LMS"
};
class no {
colorSpace = E.Undefined;
copyright = null;
description = null;
manufacturer = null;
model = null;
}
class so {
_data;
_index;
constructor(a) {
this._data = a, this._index = 0, this.isLittleEndian = !1;
}
get index() {
return this._index;
}
isLittleEndian;
readLong() {
return this.canRead(4) ? this.isLittleEndian ? this.readLongLSB() : this.readLongMSB() : null;
}
readString(a) {
if (a == 0)
return "";
if (!this.canRead(a))
return null;
let i = new TextDecoder("utf-8").decode(this._data.subarray(this._index, this._index + a));
const g = i.indexOf("\0");
return g != -1 && (i = i.substring(0, g)), this._index += a, i;
}
seek(a) {
return a >= this._data.length ? !1 : (this._index = a, !0);
}
skip(a) {
return this._index + a >= this._data.length ? !1 : (this._index += a, !0);
}
canRead(a) {
return a > this._data.length ? !1 : this._index + a <= this._data.length;
}
readLongLSB() {
let a = this._data[this._index];
return a |= this._data[this._index + 1] << 8, a |= this._data[this._index + 2] << 16, a |= this._data[this._index + 3] << 24, this._index += 4, a;
}
readLongMSB() {
let a = this._data[this._index] << 24;
return a |= this._data[this._index + 1] << 16, a |= this._data[this._index + 2] << 8, a |= this._data[this._index + 3], this._index += 4, a;
}
}
class si {
_data = new no();
_reader;
constructor(a) {
this._reader = new so(a);
}
static read(a) {
const s = new si(a);
return s.readColorSpace(), s.readTagTable(), s._data;
}
readColorSpace() {
this._reader.seek(16);
const a = this._reader.readString(4);
a != null && (this._data.colorSpace = this.determineColorSpace(a.trimEnd()));
}
determineColorSpace(a) {
switch (a) {
case "CMY":
return E.CMY;
case "CMYK":
return E.CMYK;
case "GRAY":
return E.Gray;
case "HSL":
return E.HSL;
case "HSV":
return E.HSV;
case "Lab":
return E.Lab;
case "Luv":
return E.Luv;
case "RGB":
return E.sRGB;
case "XYZ":
return E.XYZ;
case "YCbr":
return E.YCbCr;
default:
return E.Undefined;
}
}
readTagTable() {
if (!this._reader.seek(128))
return;
const a = this._reader.readLong();
if (a != null)
for (let s = 0; s < a; s++)
switch (this._reader.readLong()) {
case 1668313716:
this._data.copyright = this.readTag();
break;
case 1684370275:
this._data.description = this.readTag();
break;
case 1684893284:
this._data.manufacturer = this.readTag();
break;
case 1684890724:
this._data.model = this.readTag();
break;
default:
this._reader.skip(8);
break;
}
}
readTag() {
const a = this._reader.readLong(), s = this._reader.readLong();
if (a === null || s === null)
return null;
const i = this._reader.index;
if (!this._reader.seek(a))
return null;
const g = this.readTagValue(s);
return this._reader.seek(i), g;
}
readTagValue(a) {
switch (this._reader.readString(4)) {
case "desc":
return this.readTextDescriptionTypeValue();
case "text":
return this.readTextTypeValue(a);
default:
return null;
}
}
readTextDescriptionTypeValue() {
if (!this._reader.skip(4))
return null;
const a = this._reader.readLong();
return a == null ? null : this._reader.readString(a);
}
readTextTypeValue(a) {
return this._reader.skip(4) ? this._reader.readString(a) : null;
}
}
class mr {
constructor(a, s) {
this.name = a, this.data = s;
}
name;
data;
}
class oo extends mr {
_data;
constructor(a) {
super("icc", a);
}
/**
* Gets the color space of the profile.
*/
get colorSpace() {
return this.initialize(), this._data.colorSpace;
}
/**
* Gets the copyright of the profile.
*/
get copyright() {
return this.initialize(), this._data.copyright;
}
/**
* Gets the description of the profile.
*/
get description() {
return this.initialize(), this._data.description;
}
/**
* Gets the manufacturer of the profile.
*/
get manufacturer() {
return this.initialize(), this._data.manufacturer;
}
/**
* Gets the model of the profile.
*/
get model() {
return this.initialize(), this._data.model;
}
initialize() {
this._data || (this._data = si.read(this.data));
}
}
const cr = {
/**
* High resolution (double).
*/
HighRes: 0,
/**
* Quantum.
*/
Quantum: 1
};
class oi {
constructor(a, s) {
this.distortion = a, this.difference = s;
}
/**
* Gets the difference image.
*/
difference;
/**
* Gets the distortion.
*/
distortion;
/** @internal */
static _create(a, s) {
return new oi(a, s);
}
}
class _o {
constructor(a) {
this.metric = a;
}
/**
* Gets the distortion method to use.
*/
metric;
/**
* Gets or sets the color that emphasize pixel differences.
*/
highlightColor;
/**
* Gets or sets the color that de-emphasize pixel differences.
*/
lowlightColor;
/**
* Gets or sets the color of pixels that are inside the read mask.
*/
masklightColor;
/** @internal */
_setArtifacts(a) {
this.highlightColor !== void 0 && a.setArtifact("compare:highlight-color", this.highlightColor), this.lowlightColor !== void 0 && a.setArtifact("compare:lowlight-color", this.lowlightColor), this.masklightColor !== void 0 && a.setArtifact("compare:masklight-color", this.masklightColor);
}
}
const ti = {
/**
* Undefined.
*/
Undefined: 0,
/**
* Alpha.
*/
Alpha: 1,
/**
* Atop.
*/
Atop: 2,
/**
* Blend.
*/
Blend: 3,
/**
* Blur.
*/
Blur: 4,
/**
* Bumpmap.
*/
Bumpmap: 5,
/**
* Change mask.
*/
ChangeMask: 6,
/**
* Clear.
*/
Clear: 7,
/**
* Color burn.
*/
ColorBurn: 8,
/**
* Color dodge.
*/
ColorDodge: 9,
/**
* Colorize.
*/
Colorize: 10,
/**
* Copy black.
*/
CopyBlack: 11,
/**
* Copy blue.
*/
CopyBlue: 12,
/**
* Copy.
*/
Copy: 13,
/**
* Copy cyan.
*/
CopyCyan: 14,
/**
* Copy green.
*/
CopyGreen: 15,
/**
* Copy magenta.
*/
CopyMagenta: 16,
/**
* Copy alpha.
*/
CopyAlpha: 17,
/**
* Copy red.
*/
CopyRed: 18,
/**
* Copy yellow.
*/
CopyYellow: 19,
/**
* Darken.
*/
Darken: 20,
/**
* Darken intensity.
*/
DarkenIntensity: 21,
/**
* Difference.
*/
Difference: 22,
/**
* Displace.
*/
Displace: 23,
/**
* Dissolve.
*/
Dissolve: 24,
/**
* Distort.
*/
Distort: 25,
/**
* Divide dst.
*/
DivideDst: 26,
/**
* Divide src.
*/
DivideSrc: 27,
/**
* Dst atop.
*/
DstAtop: 28,
/**
* Dst.
*/
Dst: 29,
/**
* Dst in.
*/
DstIn: 30,
/**
* Dst out.
*/
DstOut: 31,
/**
* Dst over.
*/
DstOver: 32,
/**
* Exclusion.
*/
Exclusion: 33,
/**
* Hard light.
*/
HardLight: 34,
/**
* Hard mix.
*/
HardMix: 35,
/**
* Hue.
*/
Hue: 36,
/**
* In.
*/
In: 37,
/**
* Intensity.
*/
Intensity: 38,
/**
* Lighten.
*/
Lighten: 39,
/**
* Lighten intensity.
*/
LightenIntensity: 40,
/**
* Linear burn.
*/
LinearBurn: 41,
/**
* Linear dodge.
*/
LinearDodge: 42,
/**
* Linear light.
*/
LinearLight: 43,
/**
* Luminize.
*/
Luminize: 44,
/**
* Mathematics.
*/
Mathematics: 45,
/**
* Minus dst.
*/
MinusDst: 46,
/**
* Minus src.
*/
MinusSrc: 47,
/**
* Modulate.
*/
Modulate: 48,
/**
* Modulus add.
*/
ModulusAdd: 49,
/**
* Modulus subtract.
*/
ModulusSubtract: 50,
/**
* Multiply.
*/
Multiply: 51,
/**
* No.
*/
No: 52,
/**
* Out.
*/
Out: 53,
/**
* Over.
*/
Over: 54,
/**
* Overlay.
*/
Overlay: 55,
/**
* Pegtop light.
*/
PegtopLight: 56,
/**
* Pin light.
*/
PinLight: 57,
/**
* Plus.
*/
Plus: 58,
/**
* Replace.
*/
Replace: 59,
/**
* Saturate.
*/
Saturate: 60,
/**
* Screen.
*/
Screen: 61,
/**
* Soft light.
*/
SoftLight: 62,
/**
* Src atop.
*/
SrcAtop: 63,
/**
* Src.
*/
Src: 64,
/**
* Src in.
*/
SrcIn: 65,
/**
* Src out.
*/
SrcOut: 66,
/**
* Src over.
*/
SrcOver: 67,
/**
* Threshold.
*/
Threshold: 68,
/**
* Vivid light.
*/
VividLight: 69,
/**
* Xor.
*/
Xor: 70,
/**
* Stereo.
*/
Stereo: 71,
/**
* Freeze.
*/
Freeze: 72,
/**
* Interpolate.
*/
Interpolate: 73,
/**
* Negate.
*/
Negate: 74,
/**
* Reflect.
*/
Reflect: 75,
/**
* Soft burn.
*/
SoftBurn: 76,
/**
* Soft dodge.
*/
SoftDodge: 77,
/**
* Stamp.
*/
Stamp: 78,
/**
* Root-mean-square error.
*/
RMSE: 79,
/**
* Saliency blend.
*/
SaliencyBlend: 80,
/**
* Seamless blend.
*/
SeamlessBlend: 81
}, ii = {
/**
* Warning.
*/
Warning: 300,
/**
* Resource limit warning.
*/
ResourceLimitWarning: 300,
/**
* Type warning.
*/
TypeWarning: 305,
/**
* Option warning.
*/
OptionWarning: 310,
/**
* Delegate warning.
*/
DelegateWarning: 315,
/**
* Missing delegate warning.
*/
MissingDelegateWarning: 320,
/**
* Corrupt image warning.
*/
CorruptImageWarning: 325,
/**
* File open warning.
*/
FileOpenWarning: 330,
/**
* Blob warning.
*/
BlobWarning: 335,
/**
* Stream warning.
*/
StreamWarning: 340,
/**
* Cache warning.
*/
CacheWarning: 345,
/**
* Coder warning.
*/
CoderWarning: 350,
/**
* Filter warning.
*/
FilterWarning: 352,
/**
* Module warning.
*/
ModuleWarning: 355,
/**
* Draw warning.
*/
DrawWarning: 360,
/**
* Image warning.
*/
ImageWarning: 365,
/**
* Wand warning.
*/
WandWarning: 370,
/**
* Random warning.
*/
RandomWarning: 375,
/**
* X server warning.
*/
XServerWarning: 380,
/**
* Monitor warning.
*/
MonitorWarning: 385,
/**
* Registry warning.
*/
RegistryWarning: 390,
/**
* Configure warning.
*/
ConfigureWarning: 395,
/**
* Policy warning.
*/
PolicyWarning: 399,
/**
* Error.
*/
Error: 400,
/**
* Resource limit error.
*/
ResourceLimitError: 400,
/**
* Type error.
*/
TypeError: 405,
/**
* Option error.
*/
OptionError: 410,
/**
* Delegate error.
*/
DelegateError: 415,
/**
* Missing delegate error.
*/
MissingDelegateError: 420,
/**
* Corrupt image error.
*/
CorruptImageError: 425,
/**
* File open error.
*/
FileOpenError: 430,
/**
* Blob error.
*/
BlobError: 435,
/**
* Stream error.
*/
StreamError: 440,
/**
* Cache error.
*/
CacheError: 445,
/**
* Coder error.
*/
CoderError: 450,
/**
* Filter error.
*/
FilterError: 452,
/**
* Module error.
*/
ModuleError: 455,
/**
* Draw error.
*/
DrawError: 460,
/**
* Image error.
*/
ImageError: 465,
/**
* Wand error.
*/
WandError: 470,
/**
* Random error.
*/
RandomError: 475,
/**
* X server error.
*/
XServerError: 480,
/**
* Monitor error.
*/
MonitorError: 485,
/**
* Registry error.
*/
RegistryError: 490,
/**
* Configure error.
*/
ConfigureError: 495,
/**
* Policy error.
*/
PolicyError: 499
};
class U extends Error {
_relatedErrors = [];
/** @internal */
constructor(a, s = ii.Error) {
super(a), this.severity = s;
}
/**
* Gets the severity of an exception.
*/
severity;
/**
* Gets the exceptions that are related to this exception.
*/
get relatedErrors() {
return this._relatedErrors;
}
/** @internal */
_setRelatedErrors(a) {
this._relatedErrors = a;
}
}
class $e {
/**
* Gets the quantum depth.
*/
static get depth() {
return l._api._Quantum_Depth_Get();
}
/**
* Gets the maximum value of the quantum.
*/
static get max() {
return l._api._Quantum_Max_Get();
}
}
function he(S, a) {
return S === 0 ? a ?? null : l._api.UTF8ToString(S);
}
function co(S, a) {
const s = he(a);
return S._MagickMemory_Relinquish(a), s;
}
function ri(S, a, s) {
const i = S.lengthBytesUTF8(a) + 1, g = S._malloc(i);
try {
return S.stringToUTF8(a, g, i), s(g);
} finally {
S._free(g);
}
}
function b(S, a) {
return S === null ? a(0) : ri(l._api, S, a);
}
class k {
constructor(a, s, i, g, m) {
if (a !== void 0)
if (typeof a == "string") {
let p = 0;
try {
p = l._api._MagickColor_Create(), b(a, (M) => {
if (l._api._MagickColor_Initialize(p, M) === 0)
throw new U("invalid color specified");
this.initialize(p);
});
} finally {
l._api._free(p);
}
} else
this.r = a, this.g = s ?? 0, this.b = i ?? 0, m === void 0 ? this.a = g ?? $e.max : (this.k = g ?? 0, this.a = m, this.isCmyk = !0);
}
r = 0;
g = 0;
b = 0;
a = 0;
k = 0;
isCmyk = !1;
/** @internal */
static _create(a) {
const s = new k();
return s.initialize(a), s;
}
toShortString() {
return this.a !== $e.max ? this.toString() : this.isCmyk ? `cmyka(${this.r},${this.g},${this.b},${this.k})` : `#${this.toHex(this.r)}${this.toHex(this.g)}${this.toHex(this.b)}`;
}
toString() {
return this.isCmyk ? `cmyka(${this.r},${this.g},${this.b},${this.k},${(this.a / $e.max).toFixed(4)})` : `#${this.toHex(this.r)}${this.toHex(this.g)}${this.toHex(this.b)}${this.toHex(this.a)}`;
}
/** @internal */
_use(a) {
let s = 0;
try {
s = l._api._MagickColor_Create(), l._api._MagickColor_Red_Set(s, this.r), l._api._MagickColor_Green_Set(s, this.g), l._api._MagickColor_Blue_Set(s, this.b), l._api._MagickColor_Alpha_Set(s, this.a), l._api._MagickColor_IsCMYK_Set(s, this.isCmyk ? 1 : 0), a(s);
} finally {
l._api._free(s);
}
}
initialize(a) {
this.r = l._api._MagickColor_Red_Get(a), this.g = l._api._MagickColor_Green_Get(a), this.b = l._api._MagickColor_Blue_Get(a), this.a = l._api._MagickColor_Alpha_Get(a), this.isCmyk = l._api._MagickColor_IsCMYK_Get(a) === 1;
}
toHex(a) {
return a.toString(16).padStart(2, "0");
}
}
var ye = /* @__PURE__ */ ((S) => (S[S.NoValue = 0] = "NoValue", S[S.PercentValue = 4096] = "PercentValue", S[S.IgnoreAspectRatio = 8192] = "IgnoreAspectRatio", S[S.Less = 16384] = "Less", S[S.Greater = 32768] = "Greater", S[S.FillArea = 65536] = "FillArea", S[S.LimitPixels = 131072] = "LimitPixels", S[S.AspectRatio = 1048576] = "AspectRatio", S))(ye || {});
class _e {
_includeXyInToString;
_width = 0;
_height = 0;
_x = 0;
_y = 0;
_aspectRatio = !1;
_fillArea = !1;
_greater = !1;
_isPercentage = !1;
_ignoreAspectRatio = !1;
_less = !1;
_limitPixels = !1;
constructor(a, s, i, g) {
if (typeof a == "number") {
if (i !== void 0 && g !== void 0 ? (this._width = i, this._height = g, this._x = a, this._y = s ?? 0, this._includeXyInToString = !0) : (this._width = a, this._height = s ?? this._width, this._x = 0, this._y = 0, this._includeXyInToString = !1), this._width < 0)
throw new U("negative width is not allowed");
if (this._height < 0)
throw new U("negative height is not allowed");
} else {
this._includeXyInToString = a.indexOf("+") >= 0 || a.indexOf("-") >= 0;
const m = l._api._MagickGeometry_Create();
try {
b(a, (p) => {
const M = l._api._MagickGeometry_Initialize(m, p);
if (M === ye.NoValue)
throw new U("invalid geometry specified");
this.hasFlag(M, ye.AspectRatio) ? this.initializeFromAspectRation(m, a) : this.initialize(m, M);
});
} finally {
l._api._MagickGeometry_Dispose(m);
}
}
}
get aspectRatio() {
return this._aspectRatio;
}
get fillArea() {
return this._fillArea;
}
set fillArea(a) {
this._fillArea = a;
}
get greater() {
return this._greater;
}
set greater(a) {
this._greater = a;
}
get height() {
return this._height;
}
set height(a) {
this._height = a;
}
get ignoreAspectRatio() {
return this._ignoreAspectRatio;
}
set ignoreAspectRatio(a) {
this._ignoreAspectRatio = a;
}
get isPercentage() {
return this._isPercentage;
}
set isPercentage(a) {
this._isPercentage = a;
}
get less() {
return this._less;
}
set less(a) {
this._less = a;
}
get limitPixels() {
return this._limitPixels;
}
set limitPixels(a) {
this._limitPixels = a;
}
get width() {
return this._width;
}
set width(a) {
this._width = a;
}
get x() {
return this._x;
}
set x(a) {
this._x = a;
}
get y() {
return this._y;
}
set y(a) {
this._y = a;
}
toString() {
if (this._aspectRatio)
return this._width + ":" + this._height;
let a = "";
return this._width == 0 && this._height == 0 ? a += "0x0" : (this._width > 0 && (a += this._width.toString()), this._height > 0 ? a += "x" + this._height.toString() : a += "x"), (this._x != 0 || this._y != 0 || this._includeXyInToString) && (this._x >= 0 && (a += "+"), a += this._x, this.y >= 0 && (a += "+"), a += this.y), this._fillArea && (a += "^"), this._greater && (a += ">"), this._isPercentage && (a += "%"), this._ignoreAspectRatio && (a += "!"), this._less && (a += "<"), this._limitPixels && (a += "@"), a;
}
/** @internal */
static _fromRectangle(a) {
if (a === 0)
throw new U("unable to allocate memory");
try {
const s = l._api._MagickRectangle_Width_Get(a), i = l._api._MagickRectangle_Height_Get(a), g = l._api._MagickRectangle_X_Get(a), m = l._api._MagickRectangle_Y_Get(a);
return new _e(g, m, s, i);
} finally {
l._api._MagickRectangle_Dispose(a);
}
}
/** @internal */
_toRectangle(a) {
const s = l._api._MagickRectangle_Create();
if (s === 0)
throw new U("unable to allocate memory");
try {
l._api._MagickRectangle_Width_Set(s, this._width), l._api._MagickRectangle_Height_Set(s, this._height), l._api._MagickRectangle_X_Set(s, this._x), l._api._MagickRectangle_Y_Set(s, this._y), a(s);
} finally {
l._api._MagickRectangle_Dispose(s);
}
}
initialize(a, s) {
this._width = l._api._MagickGeometry_Width_Get(a), this._height = l._api._MagickGeometry_Height_Get(a), this._x = l._api._MagickGeometry_X_Get(a), this._y = l._api._MagickGeometry_Y_Get(a), this._ignoreAspectRatio = this.hasFlag(s, ye.IgnoreAspectRatio), this._isPercentage = this.hasFlag(s, ye.PercentValue), this._fillArea = this.hasFlag(s, ye.FillArea), this._greater = this.hasFlag(s, ye.Greater), this._less = this.hasFlag(s, ye.Less), this._limitPixels = this.hasFlag(s, ye.LimitPixels);
}
initializeFromAspectRation(a, s) {
this._aspectRatio = !0;
const i = s.split(":");
this._width = this.parseNumber(i[0]), this._height = this.parseNumber(i[1]), this._x = l._api._MagickGeometry_X_Get(a), this._y = l._api._MagickGeometry_Y_Get(a);
}
parseNumber(a) {
let s = 0;
for (; s < a.length && !this.isNumber(a[s]); )
s++;
const i = s;
for (; s < a.length && this.isNumber(a[s]); )
s++;
return parseInt(a.substr(i, s - i));
}
isNumber(a) {
return a >= "0" && a <= "9";
}
hasFlag(a, s) {
return (a & s) === s;
}
}
class De {
constructor(a, s) {
this.x = a, this.y = s ?? a;
}
/**
* Gets the x-coordinate of this point.
*/
x;
/**
* Gets the y-coordinate of this point.
*/
y;
/** @internal */
static _create(a) {
return a === 0 ? new De(0, 0) : new De(l._api._PointInfo_X_Get(a), l._api._PointInfo_Y_Get(a));
}
}
class _i {
constructor(a) {
this.area = l._api._ConnectedComponent_GetArea(a), this.centroid = De._create(l._api._ConnectedComponent_GetCentroid(a)), this.color = k._create(l._api._ConnectedComponent_GetColor(a)), this.height = l._api._ConnectedComponent_GetHeight(a), this.id = l._api._ConnectedComponent_GetId(a), this.width = l._api._ConnectedComponent_GetWidth(a), this.x = l._api._ConnectedComponent_GetX(a), this.y = l._api._ConnectedComponent_GetY(a);
}
/**
* The pixel count of the area.
*/
area;
/**
* The centroid of the area.
*/
centroid;
/**
* The color of the area.
*/
color;
/**
* The height of the area.
*/
height;
/**
* The id of the area.
*/
id;
/**
* The width of the area.
*/
width;
/**
* The X offset from origin.
*/
x;
/**
* The Y offset from origin.
*/
y;
/** @internal */
static _create(a, s) {
const i = [];
if (a === 0)
return i;
for (let g = 0; g < s; g++) {
const m = l._api._ConnectedComponent_GetInstance(a, g);
m === 0 || l._api._ConnectedComponent_GetArea(m) < Number.EPSILON || i.push(new _i(m));
}
return i;
}
/**
* Returns the geometry of the area of the connected component.
*/
toGeometry() {
return new _e(this.x, this.y, this.width, this.height);
}
}
class lo {
/**
* The threshold that merges any object not within the min and max angle
* threshold.
**/
angleThreshold;
/**
* The threshold that eliminates small objects by merging them with their
* larger neighbors.
*/
areaThreshold;
/**
* The threshold that merges any object not within the min and max
* circularity threshold.
*/
circularityThreshold;
/**
* The number of neighbors to visit (4 or 8).
*/
connectivity;
/**
* The threshold that merges any object not within the min and max diameter
* threshold.
*/
diameterThreshold;
/**
* The threshold that merges any object not within the min and max
* eccentricity threshold.
*/
eccentricityThreshold;
/**
* The threshold that merges any object not within the min and max ellipse
* major threshold.
*/
majorAxisThreshold;
/**
* Whether the object color in the component labeled image will be replaced
* with the mean color from the source image (defaults to grayscale).
*/
meanColor;
/**
* The threshold that merges any object not within the min and max ellipse
* minor threshold.
*/
minorAxisThreshold;
/**
* The threshold that merges any object not within the min and max perimeter
* threshold.
*/
perimeterThreshold;
constructor(a) {
this.connectivity = a;
}
/** @internal */
_setArtifacts(a) {
this.angleThreshold !== void 0 && a.setArtifact("connected-components:angle-threshold", this.angleThreshold.toString()), this.areaThreshold !== void 0 && a.setArtifact("connected-components:area-threshold", this.areaThreshold.toString()), this.circularityThreshold !== void 0 && a.setArtifact("connected-components:circularity-threshold", this.circularityThreshold.toString()), this.diameterThreshold !== void 0 && a.setArtifact("connected-components:diameter-threshold", this.diameterThreshold.toString()), this.eccentricityThreshold !== void 0 && a.setArtifact("connected-components:eccentricity-threshold", this.eccentricityThreshold.toString()), this.majorAxisThreshold !== void 0 && a.setArtifact("connected-components:major-axis-threshold", this.majorAxisThreshold.toString()), this.meanColor !== void 0 && a.setArtifact("connected-components:mean-color", this.meanColor.toString()), this.minorAxisThreshold !== void 0 && a.setArtifact("connected-components:minor-axis-threshold", this.minorAxisThreshold.toString()), this.perimeterThreshold !== void 0 && a.setArtifact("connected-components:perimeter-threshold", this.perimeterThreshold.toString());
}
}
const Ne = {
/**
* Undefined.
*/
Undefined: 0,
/**
* Pixels per inch.
*/
PixelsPerInch: 1,
/**
* Pixels per centimeter.
*/
PixelsPerCentimeter: 2
};
class tt {
constructor(a, s, i) {
s === void 0 ? (this.x = a, this.y = a, this.units = Ne.PixelsPerInch) : i !== void 0 ? (this.x = a, this.y = s, this.units = i) : (this.x = a, this.y = a, this.units = s);
}
/**
* Gets the x resolution.
*/
x;
/**
* Gets the y resolution.
*/
y;
/**
* Gets the units.
*/
units;
/**
* Returns a string that represents the current {@link Density} object.
*/
toString(a) {
return a == this.units || a === Ne.Undefined || a === void 0 ? tt.toString(this.x, this.y, a ?? Ne.Undefined) : this.units == Ne.PixelsPerCentimeter && a == Ne.PixelsPerInch ? tt.toString(this.x * 2.54, this.y * 2.54, a) : tt.toString(this.x / 2.54, this.y / 2.54, a);
}
static toString(a, s, i) {
let g = `${a}x${s}`;
switch (i) {
case Ne.PixelsPerCentimeter:
g += "cm";
break;
case Ne.PixelsPerInch:
g += "inch";
break;
}
return g;
}
}
class ce {
static _disposeAfterExecution(a, s) {
try {
const i = s(a);
return i instanceof Promise ? Promise.resolve(i).then((g) => (a.dispose(), ce.checkResult(a, g), g)) : (a.dispose(), ce.checkResult(a, i), i);
} catch (i) {
throw a.dispose(), i;
}
}
static checkResult(a, s) {
if (s === a)
throw new U("The result of the function cannot be the instance that has been disposed.");
return s;
}
}
class pr {
_pointer;
_bytes;
_func;
constructor(a, s, i) {
this._pointer = a, this._func = i, this._bytes = l._api.HEAPU8.subarray(a, a + s);
}
func(a) {
return a._bytes === void 0 ? a._func(new Uint8Array()) : a._func(a._bytes);
}
dispose() {
this._pointer = l._api._MagickMemory_Relinquish(this._pointer);
}
}
class Ue {
disposeMethod;
instance;
/** @internal */
constructor(a, s) {
this.instance = a, this.disposeMethod = s;
}
/** @internal */
get _instance() {
if (this.instance > 0)
return this.instance;
throw this.instance === -1 && this._instanceNotInitialized(), new U("instance is disposed");
}
/** @internal */
set _instance(a) {
this.disposeInstance(this.instance), this.instance = a;
}
dispose() {
this.instance = this.disposeInstance(this.instance);
}
/** @internal */
_instanceNotInitialized() {
throw new U("instance is not initialized");
}
/** @internal */
_setInstance(a, s) {
return s.check(() => this.instance === 0 ? !1 : (this.dispose(), this.instance = a, !0), () => (this.disposeInstance(a), !0));
}
disposeInstance(a) {
return a > 0 && (this.onDispose !== void 0 && this.onDispose(), this.disposeMethod(a)), 0;
}
}
class go extends Ue {
constructor(a) {
const s = l._api._DrawingSettings_Create(), i = l._api._DrawingSettings_Dispose;
if (super(s, i), a.fillColor !== void 0 && a.fillColor._use((g) => {
l._api._DrawingSettings_FillColor_Set(this._instance, g);
}), a.font !== void 0) {
const g = Te._getFontFileName(a.font);
b(g, (m) => {
l._api._DrawingSettings_Font_Set(this._instance, m);
});
}
a.fontPointsize !== void 0 && l._api._DrawingSettings_FontPointsize_Set(this._instance, a.fontPointsize), a.strokeColor !== void 0 && a.strokeColor._use((g) => {
l._api._DrawingSettings_StrokeColor_Set(this._instance, g);
}), a.strokeWidth !== void 0 && l._api._DrawingSettings_StrokeWidth_Set(this._instance, a.strokeWidth);
}
}
class Tt {
backgroundColor;
fillColor;
font;
fontPointsize;
strokeColor;
strokeWidth;
static _create(a) {
const s = new Tt();
return s.fillColor = a.fillColor, s.font = a.font, s.fontPointsize = a.fontPointsize, s.strokeColor = a.strokeColor, s.strokeWidth = a.strokeWidth, s;
}
_use(a) {
const s = new go(this);
return ce._disposeAfterExecution(s, a);
}
}
class fr {
instance;
type;
constructor(a, s) {
this.instance = l._api._malloc(a), this.type = s, l._api.setValue(this.instance, 0, this.type);
}
get ptr() {
return this.instance;
}
get value() {
return l._api.getValue(this.instance, this.type);
}
}
class Ge extends fr {
constructor() {
super(4, "i32");
}
static use(a) {
const s = new Ge();
try {
return a(s);
} finally {
l._api._free(s.ptr);
}
}
}
class T {
pointer;
constructor(a) {
this.pointer = a;
}
get ptr() {
return this.pointer.ptr;
}
check(a, s) {
return this.isError() ? s() : a();
}
static usePointer(a, s) {
return Ge.use((i) => {
const g = a(i.ptr);
return T.checkException(i, g, s);
});
}
static use(a, s) {
return Ge.use((i) => {
const g = a(new T(i));
return T.checkException(i, g, s);
});
}
static checkException(a, s, i) {
if (!T.isRaised(a))
return s;
const g = T.getErrorSeverity(a.value);
if (g >= ii.Error)
T.throw(a, g);
else if (i !== void 0) {
const m = T.createError(a.value, g);
i(m);
} else
T.dispose(a);
return s;
}
isError() {
return T.isRaised(this.pointer) ? T.getErrorSeverity(this.pointer.value) >= ii.Error : !1;
}
static getErrorSeverity(a) {
return l._api._MagickExceptionHelper_Severity(a);
}
static isRaised(a) {
return a.value !== 0;
}
static throw(a, s) {
const i = T.createError(a.value, s);
throw T.dispose(a), i;
}
static createError(a, s) {
const i = T.getMessage(a), g = new U(i, s), m = l._api._MagickExceptionHelper_RelatedCount(a);
if (m === 0)
return g;
const p = [];
for (let M = 0; M < m; M++) {
const I = l._api._MagickExceptionHelper_Related(a, M), R = T.getErrorSeverity(I), B = T.createError(I, R);
p.push(B);
}
return g._setRelatedErrors(p), g;
}
static getMessage(a) {
const s = l._api._MagickExceptionHelper_Message(a), i = l._api._MagickExceptionHelper_Description(a);
let g = he(s, "Unknown error");
return i !== 0 && (g += `(${l._api.UTF8ToString(i)})`), g;
}
static dispose(a) {
l._api._MagickExceptionHelper_Dispose(a.value);
}
}
class ci {
constructor(a, s, i, g, m, p, M) {
this.ascent = a, this.descent = s, this.maxHorizontalAdvance = i, this.textHeight = g, this.textWidth = m, this.underlinePosition = p, this.underlineThickness = M;
}
/**
* Gets the ascent, the distance in pixels from the text baseline to the highest/upper grid coordinate
* used to place an outline point.
*/
ascent;
/**
* Gets the descent, the distance in pixels from the baseline to the lowest grid coordinate used to
* place an outline point. Always a negative value.
*/
descent;
/**
* Gets the maximum horizontal advance in pixels.
*/
maxHorizontalAdvance;
/**
* Gets the text height in pixels.
*/
textHeight;
/**
* Gets the text width in pixels.
*/
textWidth;
/**
* Gets the underline position.
*/
underlinePosition;
/**
* Gets the underline thickness.
*/
underlineThickness;
/** @internal */
static _create(a) {
if (a == 0)
return null;
try {
const s = l._api._TypeMetric_Ascent_Get(a), i = l._api._TypeMetric_Descent_Get(a), g = l._api._TypeMetric_MaxHorizontalAdvance_Get(a), m = l._api._TypeMetric_TextHeight_Get(a), p = l._api._TypeMetric_TextWidth_Get(a), M = l._api._TypeMetric_UnderlinePosition_Get(a), I = l._api._TypeMetric_UnderlineThickness_Get(a);
return new ci(s, i, g, m, p, M, I);
} finally {
l._api._TypeMetric_Dispose(a);
}
}
}
class Gt extends Ue {
constructor(a, s) {
const g = Tt._create(s)._use((p) => l._api._DrawingWand_Create(a._instance, p._instance)), m = l._api._DrawingWand_Dispose;
super(g, m);
}
color(a, s, i) {
T.usePointer((g) => {
l._api._DrawingWand_Color(this._instance, a, s, i, g);
});
}
draw(a) {
a.forEach((s) => {
s.draw(this);
}), T.usePointer((s) => {
l._api._DrawingWand_Render(this._instance, s);
});
}
fillColor(a) {
T.usePointer((s) => {
a._use((i) => {
l._api._DrawingWand_FillColor(this._instance, i, s);
});
});
}
fillOpacity(a) {
T.usePointer((s) => {
l._api._DrawingWand_FillOpacity(this._instance, a, s);
});
}
font(a) {
T.usePointer((s) => {
b(a, (i) => {
l._api._DrawingWand_Font(this._instance, i, s);
});
});
}
fontPointSize(a) {
T.usePointer((s) => {
l._api._DrawingWand_FontPointSize(this._instance, a, s);
});
}
/** @internal */
fontTypeMetrics(a, s) {
return T.usePointer((i) => b(a, (g) => {
const m = l._api._DrawingWand_FontTypeMetrics(this._instance, g, s ? 1 : 0, i);
return ci._create(m);
}));
}
gravity(a) {
T.usePointer((s) => {
l._api._DrawingWand_Gravity(this._instance, a, s);
});
}
line(a, s, i, g) {
T.usePointer((m) => {
l._api._DrawingWand_Line(this._instance, a, s, i, g, m);
});
}
point(a, s) {
T.usePointer((i) => {
l._api._DrawingWand_Point(this._instance, a, s, i);
});
}
rectangle(a, s, i, g) {
T.usePointer((m) => {
l._api._DrawingWand_Rectangle(this._instance, a, s, i, g, m);
});
}
roundRectangle(a, s, i, g, m, p) {
T.usePointer((M) => {
l._api._DrawingWand_RoundRectangle(this._instance, a, s, i, g, m, p, M);
});
}
strokeColor(a) {
T.usePointer((s) => {
a._use((i) => {
l._api._DrawingWand_StrokeColor(this._instance, i, s);
});
});
}
strokeWidth(a) {
T.usePointer((s) => {
l._api._DrawingWand_StrokeWidth(this._instance, a, s);
});
}
text(a, s, i) {
T.usePointer((g) => {
b(i, (m) => {
l._api._DrawingWand_Text(this._instance, a, s, m, g);
});
});
}
textAlignment(a) {
T.usePointer((s) => {
l._api._DrawingWand_TextAlignment(this._instance, a, s);
});
}
textAntialias(a) {
T.usePointer((s) => {
l._api._DrawingWand_TextAntialias(this._instance, a ? 1 : 0, s);
});
}
textDecoration(a) {
T.usePointer((s) => {
l._api._DrawingWand_TextDecoration(this._instance, a, s);
});
}
textInterlineSpacing(a) {
T.usePointer((s) => {
l._api._DrawingWand_TextInterlineSpacing(this._instance, a, s);
});
}
textInterwordspacing(a) {
T.usePointer((s) => {
l._api._DrawingWand_TextInterwordSpacing(this._instance, a, s);
});
}
textKerning(a) {
T.usePointer((s) => {
l._api._DrawingWand_TextKerning(this._instance, a, s);
});
}
textUnderColor(a) {
T.usePointer((s) => {
a._use((i) => {
l._api._DrawingWand_TextUnderColor(this._instance, i, s);
});
});
}
/** @internal */
static _use(a, s) {
const i = new Gt(a, a.settings);
return ce._disposeAfterExecution(i, s);
}
}
class li extends fr {
constructor() {
super(8, "double");
}
static use(a) {
const s = new li();
try {
return a(s);
} finally {
l._api._free(s.ptr);
}
}
}
const de = {
/**
* Undefined.
*/
Undefined: 0,
/**
* Forget.
*/
Forget: 0,
/**
* Northwest
*/
Northwest: 1,
/**
* North
*/
North: 2,
/**
* Northeast
*/
Northeast: 3,
/**
* West
*/
West: 4,
/**
* Center
*/
Center: 5,
/**
* East
*/
East: 6,
/**
* Southwest
*/
Southwest: 7,
/**
* South
*/
South: 8,
/**
* Southeast
*/
Southeast: 9
};
function* uo(S) {
for (