@superdoc-dev/cli 0.2.0-next.18 → 0.2.0-next.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +671 -325
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -20029,7 +20029,7 @@ var init_uuid_2IzDu5nl_es = __esm(() => {
20029
20029
  v4_default = v4;
20030
20030
  });
20031
20031
 
20032
- // ../../packages/superdoc/dist/chunks/constants-DBKi0Amm.es.js
20032
+ // ../../packages/superdoc/dist/chunks/constants-Dw0kAsLd.es.js
20033
20033
  function computeCrc32Hex(data) {
20034
20034
  let crc = 4294967295;
20035
20035
  for (let i2 = 0;i2 < data.length; i2++)
@@ -20382,8 +20382,35 @@ var import_lib, CRC32_TABLE, REMOTE_RESOURCE_PATTERN, DATA_URI_PATTERN, getArray
20382
20382
  dta[i2] ^= guidBytes[gi];
20383
20383
  }
20384
20384
  return dta.buffer;
20385
+ }, detectImageType = (data) => {
20386
+ let bytes;
20387
+ if (typeof data === "string")
20388
+ try {
20389
+ bytes = base64ToUint8Array(data);
20390
+ } catch {
20391
+ return null;
20392
+ }
20393
+ else if (data instanceof Uint8Array)
20394
+ bytes = data;
20395
+ else
20396
+ return null;
20397
+ if (bytes.length < 12)
20398
+ return null;
20399
+ if (bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71 && bytes[4] === 13 && bytes[5] === 10 && bytes[6] === 26 && bytes[7] === 10)
20400
+ return "png";
20401
+ if (bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255)
20402
+ return "jpeg";
20403
+ if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 56)
20404
+ return "gif";
20405
+ if (bytes[0] === 66 && bytes[1] === 77)
20406
+ return "bmp";
20407
+ if (bytes[0] === 73 && bytes[1] === 73 && bytes[2] === 42 && bytes[3] === 0 || bytes[0] === 77 && bytes[1] === 77 && bytes[2] === 0 && bytes[3] === 42)
20408
+ return "tiff";
20409
+ if (bytes.length >= 12 && bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70 && bytes[8] === 87 && bytes[9] === 69 && bytes[10] === 66 && bytes[11] === 80)
20410
+ return "webp";
20411
+ return null;
20385
20412
  }, COMMENT_FILE_BASENAMES, COMMENT_RELATIONSHIP_TYPES;
20386
- var init_constants_DBKi0Amm_es = __esm(() => {
20413
+ var init_constants_Dw0kAsLd_es = __esm(() => {
20387
20414
  init_xml_js_DLE8mr0n_es();
20388
20415
  import_lib = require_lib();
20389
20416
  CRC32_TABLE = new Uint32Array(256);
@@ -26591,7 +26618,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
26591
26618
  emptyOptions2 = {};
26592
26619
  });
26593
26620
 
26594
- // ../../packages/superdoc/dist/chunks/SuperConverter-D7fmxDmw.es.js
26621
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CRrxAa8F.es.js
26595
26622
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
26596
26623
  const fieldValue = extension$1.config[field];
26597
26624
  if (typeof fieldValue === "function")
@@ -31604,6 +31631,7 @@ function handleImageNode(node3, params, isAnchor) {
31604
31631
  const blip = blipFill?.elements.find((el) => el.name === "a:blip");
31605
31632
  if (!blip)
31606
31633
  return null;
31634
+ const hasGrayscale = blip.elements?.some((el) => el.name === "a:grayscl");
31607
31635
  const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
31608
31636
  const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
31609
31637
  const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
@@ -31704,7 +31732,8 @@ function handleImageNode(node3, params, isAnchor) {
31704
31732
  originalAttributes: node3.attributes,
31705
31733
  rId: relAttributes["Id"],
31706
31734
  ...order2.length ? { drawingChildOrder: order2 } : {},
31707
- ...originalChildren.length ? { originalDrawingChildren: originalChildren } : {}
31735
+ ...originalChildren.length ? { originalDrawingChildren: originalChildren } : {},
31736
+ ...hasGrayscale ? { grayscale: true } : {}
31708
31737
  }
31709
31738
  };
31710
31739
  }
@@ -44885,6 +44914,162 @@ var isRegExp = (value) => {
44885
44914
  }
44886
44915
  return ret;
44887
44916
  }
44917
+ }, BitmapCoreHeader$1 = class {
44918
+ constructor(reader, skipsize) {
44919
+ if (skipsize)
44920
+ reader.skip(4);
44921
+ this.width = reader.readUint16();
44922
+ this.height = reader.readUint16();
44923
+ this.planes = reader.readUint16();
44924
+ this.bitcount = reader.readUint16();
44925
+ }
44926
+ colors() {
44927
+ return this.bitcount <= 8 ? 1 << this.bitcount : 0;
44928
+ }
44929
+ }, BitmapInfoHeader$1 = class {
44930
+ constructor(reader, skipsize) {
44931
+ if (skipsize)
44932
+ reader.skip(4);
44933
+ this.width = reader.readInt32();
44934
+ this.height = reader.readInt32();
44935
+ this.planes = reader.readUint16();
44936
+ this.bitcount = reader.readUint16();
44937
+ this.compression = reader.readUint32();
44938
+ this.sizeimage = reader.readUint32();
44939
+ this.xpelspermeter = reader.readInt32();
44940
+ this.ypelspermeter = reader.readInt32();
44941
+ this.clrused = reader.readUint32();
44942
+ this.clrimportant = reader.readUint32();
44943
+ }
44944
+ colors() {
44945
+ if (this.clrused !== 0)
44946
+ return this.clrused < 256 ? this.clrused : 256;
44947
+ else
44948
+ return this.bitcount > 8 ? 0 : 1 << this.bitcount;
44949
+ }
44950
+ }, BitmapInfo$1 = class {
44951
+ constructor(reader, usergb) {
44952
+ this._usergb = usergb;
44953
+ const hdrsize = reader.readUint32();
44954
+ this._infosize = hdrsize;
44955
+ if (hdrsize === Helper$1.GDI.BITMAPCOREHEADER_SIZE) {
44956
+ this._header = new BitmapCoreHeader$1(reader, false);
44957
+ this._infosize += this._header.colors() * (usergb ? 3 : 2);
44958
+ } else {
44959
+ this._header = new BitmapInfoHeader$1(reader, false);
44960
+ const masks = this._header.compression === Helper$1.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;
44961
+ if (hdrsize <= Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4)
44962
+ this._infosize = Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4;
44963
+ this._infosize += this._header.colors() * (usergb ? 4 : 2);
44964
+ }
44965
+ }
44966
+ getWidth() {
44967
+ return this._header.width;
44968
+ }
44969
+ getHeight() {
44970
+ return Math.abs(this._header.height);
44971
+ }
44972
+ infosize() {
44973
+ return this._infosize;
44974
+ }
44975
+ header() {
44976
+ return this._header;
44977
+ }
44978
+ }, DIBitmap$1 = class {
44979
+ constructor(reader, bitmapInfo) {
44980
+ this._reader = reader;
44981
+ this._offset = reader.pos;
44982
+ this._location = bitmapInfo;
44983
+ this._info = new BitmapInfo$1(reader, true);
44984
+ }
44985
+ getWidth() {
44986
+ return this._info.getWidth();
44987
+ }
44988
+ getHeight() {
44989
+ return this._info.getHeight();
44990
+ }
44991
+ totalSize() {
44992
+ return this._location.header.size + this._location.data.size;
44993
+ }
44994
+ makeBitmapFileHeader() {
44995
+ const buf = /* @__PURE__ */ new ArrayBuffer(14);
44996
+ const view = new Uint8Array(buf);
44997
+ view[0] = 66;
44998
+ view[1] = 77;
44999
+ Helper$1._writeUint32Val(view, 2, this.totalSize() + 14);
45000
+ Helper$1._writeUint32Val(view, 10, this._info.infosize() + 14);
45001
+ return Helper$1._blobToBinary(view);
45002
+ }
45003
+ convertToPNG(bitmapData, width, height, hasAlpha) {
45004
+ const canvas = document.createElement("canvas");
45005
+ canvas.width = width;
45006
+ canvas.height = Math.abs(height);
45007
+ const ctx = canvas.getContext("2d");
45008
+ if (!ctx)
45009
+ throw new Error("Unable to get canvas context for PNG conversion");
45010
+ const imageData = ctx.createImageData(width, Math.abs(height));
45011
+ const pixels = imageData.data;
45012
+ const rowSize = width * 32 + 31 >>> 5 << 2;
45013
+ const absHeight = Math.abs(height);
45014
+ const topDown = height < 0;
45015
+ let alphaUsed = false;
45016
+ if (hasAlpha)
45017
+ for (let y = 0;y < absHeight && !alphaUsed; y++) {
45018
+ const srcY = topDown ? y : absHeight - 1 - y;
45019
+ for (let x = 0;x < width && !alphaUsed; x++)
45020
+ if (bitmapData[srcY * rowSize + x * 4 + 3] > 0)
45021
+ alphaUsed = true;
45022
+ }
45023
+ for (let y = 0;y < absHeight; y++) {
45024
+ const srcY = topDown ? y : absHeight - 1 - y;
45025
+ for (let x = 0;x < width; x++) {
45026
+ const srcOffset = srcY * rowSize + x * 4;
45027
+ const dstOffset = (y * width + x) * 4;
45028
+ pixels[dstOffset] = bitmapData[srcOffset + 2];
45029
+ pixels[dstOffset + 1] = bitmapData[srcOffset + 1];
45030
+ pixels[dstOffset + 2] = bitmapData[srcOffset];
45031
+ pixels[dstOffset + 3] = alphaUsed ? bitmapData[srcOffset + 3] : 255;
45032
+ }
45033
+ }
45034
+ ctx.putImageData(imageData, 0, 0);
45035
+ return canvas.toDataURL("image/png");
45036
+ }
45037
+ base64ref() {
45038
+ const prevpos = this._reader.pos;
45039
+ this._reader.seek(this._offset);
45040
+ const header = this._info.header();
45041
+ if (header instanceof BitmapInfoHeader$1 && header.compression != null)
45042
+ switch (header.compression) {
45043
+ case Helper$1.GDI.BitmapCompression.BI_JPEG:
45044
+ this._reader.seek(this._location.data.off);
45045
+ const jpegData = "data:image/jpeg;base64," + btoa(this._reader.readBinary(this._location.data.size));
45046
+ this._reader.seek(prevpos);
45047
+ return jpegData;
45048
+ case Helper$1.GDI.BitmapCompression.BI_PNG:
45049
+ this._reader.seek(this._location.data.off);
45050
+ const pngData = "data:image/png;base64," + btoa(this._reader.readBinary(this._location.data.size));
45051
+ this._reader.seek(prevpos);
45052
+ return pngData;
45053
+ }
45054
+ if (header instanceof BitmapInfoHeader$1 && header.bitcount === 32) {
45055
+ this._reader.seek(this._location.data.off);
45056
+ const bitmapBytes = new Uint8Array(this._location.data.size);
45057
+ const bitmapData = this._reader.readBinary(this._location.data.size);
45058
+ for (let i2 = 0;i2 < this._location.data.size; i2++)
45059
+ bitmapBytes[i2] = bitmapData.charCodeAt(i2);
45060
+ const pngDataUrl = this.convertToPNG(bitmapBytes, header.width, header.height, true);
45061
+ this._reader.seek(prevpos);
45062
+ return pngDataUrl;
45063
+ }
45064
+ let data = this.makeBitmapFileHeader();
45065
+ this._reader.seek(this._location.header.off);
45066
+ data += this._reader.readBinary(this._location.header.size);
45067
+ this._reader.seek(this._location.data.off);
45068
+ data += this._reader.readBinary(this._location.data.size);
45069
+ const ref2 = "data:image/bmp;base64," + btoa(data);
45070
+ this._reader.seek(prevpos);
45071
+ return ref2;
45072
+ }
44888
45073
  }, PointS$1 = class PointS$12 {
44889
45074
  constructor(reader, x, y) {
44890
45075
  if (reader != null) {
@@ -45065,123 +45250,6 @@ var isRegExp = (value) => {
45065
45250
  }
45066
45251
  return this.scanlines.length > 0;
45067
45252
  }
45068
- }, BitmapCoreHeader$1 = class {
45069
- constructor(reader, skipsize) {
45070
- if (skipsize)
45071
- reader.skip(4);
45072
- this.width = reader.readUint16();
45073
- this.height = reader.readUint16();
45074
- this.planes = reader.readUint16();
45075
- this.bitcount = reader.readUint16();
45076
- }
45077
- colors() {
45078
- return this.bitcount <= 8 ? 1 << this.bitcount : 0;
45079
- }
45080
- }, BitmapInfoHeader$1 = class {
45081
- constructor(reader, skipsize) {
45082
- if (skipsize)
45083
- reader.skip(4);
45084
- this.width = reader.readInt32();
45085
- this.height = reader.readInt32();
45086
- this.planes = reader.readUint16();
45087
- this.bitcount = reader.readUint16();
45088
- this.compression = reader.readUint32();
45089
- this.sizeimage = reader.readUint32();
45090
- this.xpelspermeter = reader.readInt32();
45091
- this.ypelspermeter = reader.readInt32();
45092
- this.clrused = reader.readUint32();
45093
- this.clrimportant = reader.readUint32();
45094
- }
45095
- colors() {
45096
- if (this.clrused !== 0)
45097
- return this.clrused < 256 ? this.clrused : 256;
45098
- else
45099
- return this.bitcount > 8 ? 0 : 1 << this.bitcount;
45100
- }
45101
- }, BitmapInfo$1 = class {
45102
- constructor(reader, usergb) {
45103
- this._usergb = usergb;
45104
- const hdrsize = reader.readUint32();
45105
- this._infosize = hdrsize;
45106
- if (hdrsize === Helper$1.GDI.BITMAPCOREHEADER_SIZE) {
45107
- this._header = new BitmapCoreHeader$1(reader, false);
45108
- this._infosize += this._header.colors() * (usergb ? 3 : 2);
45109
- } else {
45110
- this._header = new BitmapInfoHeader$1(reader, false);
45111
- const masks = this._header.compression === Helper$1.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;
45112
- if (hdrsize <= Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4)
45113
- this._infosize = Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4;
45114
- this._infosize += this._header.colors() * (usergb ? 4 : 2);
45115
- }
45116
- }
45117
- getWidth() {
45118
- return this._header.width;
45119
- }
45120
- getHeight() {
45121
- return Math.abs(this._header.height);
45122
- }
45123
- infosize() {
45124
- return this._infosize;
45125
- }
45126
- header() {
45127
- return this._header;
45128
- }
45129
- }, DIBitmap$1 = class {
45130
- constructor(reader, bitmapInfo) {
45131
- this._reader = reader;
45132
- this._offset = reader.pos;
45133
- this._location = bitmapInfo;
45134
- this._info = new BitmapInfo$1(reader, true);
45135
- }
45136
- getWidth() {
45137
- return this._info.getWidth();
45138
- }
45139
- getHeight() {
45140
- return this._info.getHeight();
45141
- }
45142
- totalSize() {
45143
- return this._location.header.size + this._location.data.size;
45144
- }
45145
- makeBitmapFileHeader() {
45146
- const buf = /* @__PURE__ */ new ArrayBuffer(14);
45147
- const view = new Uint8Array(buf);
45148
- view[0] = 66;
45149
- view[1] = 77;
45150
- Helper$1._writeUint32Val(view, 2, this.totalSize() + 14);
45151
- Helper$1._writeUint32Val(view, 10, this._info.infosize() + 14);
45152
- return Helper$1._blobToBinary(view);
45153
- }
45154
- base64ref() {
45155
- const prevpos = this._reader.pos;
45156
- this._reader.seek(this._offset);
45157
- let mime = "image/bmp";
45158
- const header = this._info.header();
45159
- let data;
45160
- if (header instanceof BitmapInfoHeader$1 && header.compression != null)
45161
- switch (header.compression) {
45162
- case Helper$1.GDI.BitmapCompression.BI_JPEG:
45163
- mime = "data:image/jpeg";
45164
- break;
45165
- case Helper$1.GDI.BitmapCompression.BI_PNG:
45166
- mime = "data:image/png";
45167
- break;
45168
- default:
45169
- data = this.makeBitmapFileHeader();
45170
- break;
45171
- }
45172
- else
45173
- data = this.makeBitmapFileHeader();
45174
- this._reader.seek(this._location.header.offset);
45175
- if (data != null)
45176
- data += this._reader.readBinary(this._location.header.size);
45177
- else
45178
- data = this._reader.readBinary(this._location.header.size);
45179
- this._reader.seek(this._location.data.offset);
45180
- data += this._reader.readBinary(this._location.data.size);
45181
- const ref2 = "data:" + mime + ";base64," + btoa(data);
45182
- this._reader.seek(prevpos);
45183
- return ref2;
45184
- }
45185
45253
  }, ColorRef$1 = class ColorRef$12 {
45186
45254
  constructor(reader, r, g, b) {
45187
45255
  if (reader != null) {
@@ -45255,6 +45323,9 @@ var isRegExp = (value) => {
45255
45323
  }
45256
45324
  }
45257
45325
  }
45326
+ getBounds() {
45327
+ return this.bounds;
45328
+ }
45258
45329
  toString() {
45259
45330
  return "{bounds: " + this.bounds.toString() + ", frame: " + this.frame.toString() + ", description: " + this.description + "}";
45260
45331
  }
@@ -45364,11 +45435,11 @@ var isRegExp = (value) => {
45364
45435
  const cbBits = reader.readUint32();
45365
45436
  const pen = new Pen$1(reader, {
45366
45437
  header: {
45367
- off: offBmi,
45438
+ off: curpos + offBmi,
45368
45439
  size: cbBmi
45369
45440
  },
45370
45441
  data: {
45371
- off: offBits,
45442
+ off: curpos + offBits,
45372
45443
  size: cbBits
45373
45444
  }
45374
45445
  });
@@ -45608,6 +45679,37 @@ var isRegExp = (value) => {
45608
45679
  });
45609
45680
  break;
45610
45681
  }
45682
+ case Helper$1.GDI.RecordType.EMR_STRETCHDIBITS: {
45683
+ new RectL(reader);
45684
+ const xDest = reader.readInt32();
45685
+ const yDest = reader.readInt32();
45686
+ const xSrc = reader.readInt32();
45687
+ const ySrc = reader.readInt32();
45688
+ const cxSrc = reader.readInt32();
45689
+ const cySrc = reader.readInt32();
45690
+ const offBmiSrc = reader.readUint32();
45691
+ const cbBmiSrc = reader.readUint32();
45692
+ const offBitsSrc = reader.readUint32();
45693
+ const cbBitsSrc = reader.readUint32();
45694
+ const iUsageSrc = reader.readUint32();
45695
+ const dwRop = reader.readUint32();
45696
+ const cxDest = reader.readInt32();
45697
+ const cyDest = reader.readInt32();
45698
+ const dib = new DIBitmap$1(reader, {
45699
+ header: {
45700
+ off: curpos + offBmiSrc,
45701
+ size: cbBmiSrc
45702
+ },
45703
+ data: {
45704
+ off: curpos + offBitsSrc,
45705
+ size: cbBitsSrc
45706
+ }
45707
+ });
45708
+ this._records.push((gdi) => {
45709
+ gdi.stretchDibBits(xSrc, ySrc, cxSrc, cySrc, xDest, yDest, cxDest, cyDest, dwRop, iUsageSrc, dib);
45710
+ });
45711
+ break;
45712
+ }
45611
45713
  case Helper$1.GDI.RecordType.EMR_POLYLINE:
45612
45714
  case Helper$1.GDI.RecordType.EMR_POLYLINETO:
45613
45715
  case Helper$1.GDI.RecordType.EMR_POLYPOLYLINE:
@@ -45650,7 +45752,6 @@ var isRegExp = (value) => {
45650
45752
  case Helper$1.GDI.RecordType.EMR_MASKBLT:
45651
45753
  case Helper$1.GDI.RecordType.EMR_PLGBLT:
45652
45754
  case Helper$1.GDI.RecordType.EMR_SETDIBITSTODEVICE:
45653
- case Helper$1.GDI.RecordType.EMR_STRETCHDIBITS:
45654
45755
  case Helper$1.GDI.RecordType.EMR_EXTCREATEFONTINDIRECTW:
45655
45756
  case Helper$1.GDI.RecordType.EMR_EXTTEXTOUTA:
45656
45757
  case Helper$1.GDI.RecordType.EMR_EXTTEXTOUTW:
@@ -45699,6 +45800,9 @@ var isRegExp = (value) => {
45699
45800
  if (!all2)
45700
45801
  throw new EMFJSError("Could not read all records");
45701
45802
  }
45803
+ getBounds() {
45804
+ return this._header.getBounds();
45805
+ }
45702
45806
  play(gdi) {
45703
45807
  const len2 = this._records.length;
45704
45808
  for (let i2 = 0;i2 < len2; i2++)
@@ -45798,6 +45902,9 @@ var isRegExp = (value) => {
45798
45902
  this.state.mapmode = mode;
45799
45903
  this.state._svggroup = null;
45800
45904
  }
45905
+ getMapMode() {
45906
+ return this.state.mapmode;
45907
+ }
45801
45908
  setWindowOrgEx(x, y) {
45802
45909
  Helper$1.log("[gdi] setWindowOrgEx: x=" + x + " y=" + y);
45803
45910
  this.state.wx = x;
@@ -45850,6 +45957,20 @@ var isRegExp = (value) => {
45850
45957
  setStretchBltMode(stretchMode) {
45851
45958
  Helper$1.log("[gdi] setStretchBltMode: stretchMode=" + stretchMode);
45852
45959
  }
45960
+ stretchDibBits(srcX, srcY, srcW, srcH, dstX, dstY, dstW, dstH, rasterOp, colorUsage, dib) {
45961
+ Helper$1.log("[gdi] stretchDibBits: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH + " rasterOp=0x" + rasterOp.toString(16));
45962
+ srcX = this._todevX(srcX);
45963
+ srcY = this._todevY(srcY);
45964
+ srcW = this._todevW(srcW);
45965
+ srcH = this._todevH(srcH);
45966
+ dstX = this._todevX(dstX);
45967
+ dstY = this._todevY(dstY);
45968
+ dstW = this._todevW(dstW);
45969
+ dstH = this._todevH(dstH);
45970
+ Helper$1.log("[gdi] stretchDibBits: TRANSLATED: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH + " rasterOp=0x" + rasterOp.toString(16));
45971
+ this._pushGroup();
45972
+ this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());
45973
+ }
45853
45974
  rectangle(rect, rw, rh) {
45854
45975
  Helper$1.log("[gdi] rectangle: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString() + " and brush " + this.state.selected.brush.toString());
45855
45976
  const bottom = this._todevY(rect.bottom);
@@ -46328,14 +46449,16 @@ var isRegExp = (value) => {
46328
46449
  }
46329
46450
  render(info) {
46330
46451
  const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
46331
- this._render(new SVG(svgElement), info.mapMode, info.wExt, info.hExt, info.xExt, info.yExt);
46452
+ const emfBounds = this._img.getBounds();
46453
+ const gdi = this._render(new SVG(svgElement), info.mapMode, emfBounds.width, emfBounds.height, emfBounds.width, emfBounds.height);
46332
46454
  svgElement.setAttribute("viewBox", [
46333
46455
  0,
46334
46456
  0,
46335
- info.xExt,
46336
- info.yExt
46457
+ emfBounds.width,
46458
+ emfBounds.height
46337
46459
  ].join(" "));
46338
- svgElement.setAttribute("preserveAspectRatio", "none");
46460
+ const preserveAspectRatio = gdi.getMapMode() === Helper$1.GDI.MapMode.MM_ANISOTROPIC ? "none" : "xMidYMid meet";
46461
+ svgElement.setAttribute("preserveAspectRatio", preserveAspectRatio);
46339
46462
  svgElement.setAttribute("width", info.width);
46340
46463
  svgElement.setAttribute("height", info.height);
46341
46464
  return svgElement;
@@ -46360,6 +46483,7 @@ var isRegExp = (value) => {
46360
46483
  Helper$1.log("[EMF] BEGIN RENDERING --->");
46361
46484
  this._img.render(gdi);
46362
46485
  Helper$1.log("[EMF] <--- DONE RENDERING");
46486
+ return gdi;
46363
46487
  }
46364
46488
  }, EMF = class {
46365
46489
  constructor(reader, hdrsize) {
@@ -46369,6 +46493,13 @@ var isRegExp = (value) => {
46369
46493
  render(gdi) {
46370
46494
  this._records.play(gdi);
46371
46495
  }
46496
+ getBounds() {
46497
+ const bounds = this._records.getBounds();
46498
+ return {
46499
+ width: bounds.right - bounds.left,
46500
+ height: bounds.bottom - bounds.top
46501
+ };
46502
+ }
46372
46503
  }, WMFJSError, isLoggingEnabled = true, Helper, Blob$1 = class Blob$12 {
46373
46504
  constructor(blob, offset) {
46374
46505
  if (blob instanceof Blob$12) {
@@ -50368,7 +50499,8 @@ var isRegExp = (value) => {
50368
50499
  elements: [
50369
50500
  {
50370
50501
  name: "a:blip",
50371
- attributes: { "r:embed": imageId }
50502
+ attributes: { "r:embed": imageId },
50503
+ ...attrs.grayscale ? { elements: [{ name: "a:grayscl" }] } : {}
50372
50504
  },
50373
50505
  ...rawSrcRect ? [rawSrcRect] : [],
50374
50506
  {
@@ -53599,12 +53731,12 @@ var isRegExp = (value) => {
53599
53731
  state.kern = kernNode.attributes["w:val"];
53600
53732
  }
53601
53733
  }, SuperConverter;
53602
- var init_SuperConverter_D7fmxDmw_es = __esm(() => {
53734
+ var init_SuperConverter_CRrxAa8F_es = __esm(() => {
53603
53735
  init_rolldown_runtime_B2q5OVn9_es();
53604
53736
  init_jszip_ChlR43oI_es();
53605
53737
  init_xml_js_DLE8mr0n_es();
53606
53738
  init_uuid_2IzDu5nl_es();
53607
- init_constants_DBKi0Amm_es();
53739
+ init_constants_Dw0kAsLd_es();
53608
53740
  init_unified_BRHLwnjP_es();
53609
53741
  init_lib_HnbxUP96_es();
53610
53742
  init_lib_DAB30bX1_es();
@@ -66617,7 +66749,7 @@ var init_SuperConverter_D7fmxDmw_es = __esm(() => {
66617
66749
  };
66618
66750
  });
66619
66751
 
66620
- // ../../packages/superdoc/dist/chunks/DocxZipper-CXjNiywL.es.js
66752
+ // ../../packages/superdoc/dist/chunks/DocxZipper-B9Uo1uiZ.es.js
66621
66753
  function getLens2(b64) {
66622
66754
  var len$1 = b64.length;
66623
66755
  if (len$1 % 4 > 0)
@@ -66756,8 +66888,8 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
66756
66888
  this.mediaFiles[name] = fileBase64;
66757
66889
  } else {
66758
66890
  const fileBase64 = await zipEntry.async("base64");
66759
- const extension2 = this.getFileExtension(name)?.toLowerCase();
66760
- if (new Set([
66891
+ let extension2 = this.getFileExtension(name)?.toLowerCase();
66892
+ const imageTypes = new Set([
66761
66893
  "png",
66762
66894
  "jpg",
66763
66895
  "jpeg",
@@ -66768,7 +66900,14 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
66768
66900
  "wmf",
66769
66901
  "svg",
66770
66902
  "webp"
66771
- ]).has(extension2)) {
66903
+ ]);
66904
+ let detectedType = null;
66905
+ if (!imageTypes.has(extension2) || extension2 === "tmp") {
66906
+ detectedType = detectImageType(fileBase64);
66907
+ if (detectedType)
66908
+ extension2 = detectedType;
66909
+ }
66910
+ if (imageTypes.has(extension2)) {
66772
66911
  this.mediaFiles[name] = `data:image/${extension2};base64,${fileBase64}`;
66773
66912
  const blob = await zipEntry.async("blob");
66774
66913
  const fileObj = new File([blob], name, { type: blob.type });
@@ -67001,11 +67140,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
67001
67140
  return unzippedOriginalDocx;
67002
67141
  }
67003
67142
  }, DocxZipper_default;
67004
- var init_DocxZipper_CXjNiywL_es = __esm(() => {
67143
+ var init_DocxZipper_B9Uo1uiZ_es = __esm(() => {
67005
67144
  init_rolldown_runtime_B2q5OVn9_es();
67006
67145
  init_jszip_ChlR43oI_es();
67007
67146
  init_xml_js_DLE8mr0n_es();
67008
- init_constants_DBKi0Amm_es();
67147
+ init_constants_Dw0kAsLd_es();
67009
67148
  buffer2 = {};
67010
67149
  base64Js2 = {};
67011
67150
  base64Js2.byteLength = byteLength2;
@@ -92869,9 +93008,9 @@ var init_remark_gfm_CQ3Jg4PR_es = __esm(() => {
92869
93008
  init_remark_gfm_z_sDF4ss_es();
92870
93009
  });
92871
93010
 
92872
- // ../../packages/superdoc/dist/chunks/src-BFDJrY7q.es.js
92873
- var exports_src_BFDJrY7q_es = {};
92874
- __export(exports_src_BFDJrY7q_es, {
93011
+ // ../../packages/superdoc/dist/chunks/src-R57grOTY.es.js
93012
+ var exports_src_R57grOTY_es = {};
93013
+ __export(exports_src_R57grOTY_es, {
92875
93014
  zt: () => defineMark,
92876
93015
  z: () => cM,
92877
93016
  yt: () => removeAwarenessStates,
@@ -120496,6 +120635,24 @@ function imageNodeToRun({ node: node3, positions, sdtMetadata }) {
120496
120635
  }
120497
120636
  if (sdtMetadata)
120498
120637
  run2.sdt = sdtMetadata;
120638
+ const transformData = isPlainObject$2(attrs.transformData) ? attrs.transformData : undefined;
120639
+ if (transformData) {
120640
+ const rotation = typeof transformData.rotation === "number" ? transformData.rotation : undefined;
120641
+ if (rotation !== undefined)
120642
+ run2.rotation = rotation;
120643
+ const flipH = typeof transformData.horizontalFlip === "boolean" ? transformData.horizontalFlip : undefined;
120644
+ if (flipH !== undefined)
120645
+ run2.flipH = flipH;
120646
+ const flipV = typeof transformData.verticalFlip === "boolean" ? transformData.verticalFlip : undefined;
120647
+ if (flipV !== undefined)
120648
+ run2.flipV = flipV;
120649
+ }
120650
+ if (typeof attrs.gain === "string" || typeof attrs.gain === "number")
120651
+ run2.gain = attrs.gain;
120652
+ if (typeof attrs.blacklevel === "string" || typeof attrs.blacklevel === "number")
120653
+ run2.blacklevel = attrs.blacklevel;
120654
+ if (typeof attrs.grayscale === "boolean")
120655
+ run2.grayscale = attrs.grayscale;
120499
120656
  return run2;
120500
120657
  }
120501
120658
  function isInlineImage(node3) {
@@ -120726,6 +120883,10 @@ function imageNodeToBlock(node3, nextBlockId, positions, _trackedMeta, _trackedC
120726
120883
  const objectFit = isAllowedObjectFit(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
120727
120884
  const zIndexFromRelativeHeight = normalizeZIndex(attrs.originalAttributes);
120728
120885
  const zIndex = resolveFloatingZIndex(anchor?.behindDoc === true, zIndexFromRelativeHeight);
120886
+ const transformData = isPlainObject$1(attrs.transformData) ? attrs.transformData : undefined;
120887
+ const rotation = typeof transformData?.rotation === "number" ? transformData.rotation : undefined;
120888
+ const flipH = typeof transformData?.horizontalFlip === "boolean" ? transformData.horizontalFlip : undefined;
120889
+ const flipV = typeof transformData?.verticalFlip === "boolean" ? transformData.verticalFlip : undefined;
120729
120890
  return {
120730
120891
  kind: "image",
120731
120892
  id: nextBlockId("image"),
@@ -120743,7 +120904,11 @@ function imageNodeToBlock(node3, nextBlockId, positions, _trackedMeta, _trackedC
120743
120904
  ...zIndex !== undefined && { zIndex },
120744
120905
  attrs: attrsWithPm,
120745
120906
  gain: typeof attrs.gain === "string" || typeof attrs.gain === "number" ? attrs.gain : undefined,
120746
- blacklevel: typeof attrs.blacklevel === "string" || typeof attrs.blacklevel === "number" ? attrs.blacklevel : undefined
120907
+ blacklevel: typeof attrs.blacklevel === "string" || typeof attrs.blacklevel === "number" ? attrs.blacklevel : undefined,
120908
+ grayscale: typeof attrs.grayscale === "boolean" ? attrs.grayscale : undefined,
120909
+ ...rotation !== undefined && { rotation },
120910
+ ...flipH !== undefined && { flipH },
120911
+ ...flipV !== undefined && { flipV }
120747
120912
  };
120748
120913
  }
120749
120914
  function handleImageNode2(node3, context) {
@@ -162227,13 +162392,13 @@ var Node$13 = class Node$14 {
162227
162392
  trackedChanges: context.trackedChanges ?? []
162228
162393
  });
162229
162394
  }, _hoisted_1$6, _hoisted_2$1, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
162230
- var init_src_BFDJrY7q_es = __esm(() => {
162395
+ var init_src_R57grOTY_es = __esm(() => {
162231
162396
  init_rolldown_runtime_B2q5OVn9_es();
162232
- init_SuperConverter_D7fmxDmw_es();
162397
+ init_SuperConverter_CRrxAa8F_es();
162233
162398
  init_jszip_ChlR43oI_es();
162234
162399
  init_uuid_2IzDu5nl_es();
162235
- init_constants_DBKi0Amm_es();
162236
- init_DocxZipper_CXjNiywL_es();
162400
+ init_constants_Dw0kAsLd_es();
162401
+ init_DocxZipper_B9Uo1uiZ_es();
162237
162402
  init_vue_UXsVEdB5_es();
162238
162403
  init__plugin_vue_export_helper_CUZ1eWFO_es();
162239
162404
  init_eventemitter3_U_DLl_Mg_es();
@@ -164928,10 +165093,6 @@ ${err.toString()}`);
164928
165093
  };
164929
165094
  shouldUpdate = true;
164930
165095
  editor.emit("commentsUpdate", update);
164931
- const { tr: newTr } = editor.view.state;
164932
- const { dispatch } = editor.view;
164933
- newTr.setMeta(CommentsPluginKey, { type: "force" });
164934
- dispatch(newTr);
164935
165096
  }
164936
165097
  }
164937
165098
  return pluginState;
@@ -180351,7 +180512,29 @@ function print() { __p += __j.call(arguments, '') }
180351
180512
  img2.style.objectPosition = "left top";
180352
180513
  applyImageClipPath(img2, resolveBlockClipPath(block), { clipContainer: fragmentEl });
180353
180514
  img2.style.display = block.display === "inline" ? "inline-block" : "block";
180515
+ const transforms = [];
180516
+ if (block.rotation != null && block.rotation !== 0) {
180517
+ const angleRad = block.rotation * Math.PI / 180;
180518
+ const w = block.width ?? fragment.width;
180519
+ const h$2 = block.height ?? fragment.height;
180520
+ const cosA = Math.cos(angleRad);
180521
+ const sinA = Math.sin(angleRad);
180522
+ const newTopLeftX = w / 2 * (1 - cosA) + h$2 / 2 * sinA;
180523
+ const newTopLeftY = w / 2 * sinA + h$2 / 2 * (1 - cosA);
180524
+ transforms.push(`translate(${-newTopLeftX}px, ${-newTopLeftY}px)`);
180525
+ transforms.push(`rotate(${block.rotation}deg)`);
180526
+ }
180527
+ if (block.flipH)
180528
+ transforms.push("scaleX(-1)");
180529
+ if (block.flipV)
180530
+ transforms.push("scaleY(-1)");
180531
+ if (transforms.length > 0) {
180532
+ img2.style.transform = transforms.join(" ");
180533
+ img2.style.transformOrigin = "center";
180534
+ }
180354
180535
  const filters = [];
180536
+ if (block.grayscale)
180537
+ filters.push("grayscale(100%)");
180355
180538
  if (block.gain != null || block.blacklevel != null) {
180356
180539
  if (block.gain && typeof block.gain === "string" && block.gain.endsWith("f")) {
180357
180540
  const contrast = Math.max(0, parseInt(block.gain) / 65536) * (2 / 3);
@@ -180363,9 +180546,9 @@ function print() { __p += __j.call(arguments, '') }
180363
180546
  if (brightness > 0)
180364
180547
  filters.push(`brightness(${brightness})`);
180365
180548
  }
180366
- if (filters.length > 0)
180367
- img2.style.filter = filters.join(" ");
180368
180549
  }
180550
+ if (filters.length > 0)
180551
+ img2.style.filter = filters.join(" ");
180369
180552
  fragmentEl.appendChild(img2);
180370
180553
  return fragmentEl;
180371
180554
  } catch (error) {
@@ -181222,6 +181405,43 @@ function print() { __p += __j.call(arguments, '') }
181222
181405
  img2.style.position = "relative";
181223
181406
  img2.style.zIndex = "1";
181224
181407
  }
181408
+ const transforms = [];
181409
+ if (run2.rotation != null && run2.rotation !== 0) {
181410
+ const angleRad = run2.rotation * Math.PI / 180;
181411
+ const w = run2.width;
181412
+ const h$2 = run2.height;
181413
+ const cosA = Math.cos(angleRad);
181414
+ const sinA = Math.sin(angleRad);
181415
+ const newTopLeftX = w / 2 * (1 - cosA) + h$2 / 2 * sinA;
181416
+ const newTopLeftY = w / 2 * sinA + h$2 / 2 * (1 - cosA);
181417
+ transforms.push(`translate(${-newTopLeftX}px, ${-newTopLeftY}px)`);
181418
+ transforms.push(`rotate(${run2.rotation}deg)`);
181419
+ }
181420
+ if (run2.flipH)
181421
+ transforms.push("scaleX(-1)");
181422
+ if (run2.flipV)
181423
+ transforms.push("scaleY(-1)");
181424
+ if (transforms.length > 0) {
181425
+ img2.style.transform = transforms.join(" ");
181426
+ img2.style.transformOrigin = "center";
181427
+ }
181428
+ const filters = [];
181429
+ if (run2.grayscale)
181430
+ filters.push("grayscale(100%)");
181431
+ if (run2.gain != null || run2.blacklevel != null) {
181432
+ if (run2.gain && typeof run2.gain === "string" && run2.gain.endsWith("f")) {
181433
+ const contrast = Math.max(0, parseInt(run2.gain) / 65536) * (2 / 3);
181434
+ if (contrast > 0)
181435
+ filters.push(`contrast(${contrast})`);
181436
+ }
181437
+ if (run2.blacklevel && typeof run2.blacklevel === "string" && run2.blacklevel.endsWith("f")) {
181438
+ const brightness = Math.max(0, 1 + parseInt(run2.blacklevel) / 327 / 100) * 1.3;
181439
+ if (brightness > 0)
181440
+ filters.push(`brightness(${brightness})`);
181441
+ }
181442
+ }
181443
+ if (filters.length > 0)
181444
+ img2.style.filter = filters.join(" ");
181225
181445
  assertPmPositions(run2, "inline image run");
181226
181446
  if (useWrapper) {
181227
181447
  const wrapper = this.doc.createElement("span");
@@ -189671,6 +189891,18 @@ function print() { __p += __j.call(arguments, '') }
189671
189891
  return { style: `transform: ${style$1};` };
189672
189892
  }
189673
189893
  },
189894
+ grayscale: {
189895
+ default: false,
189896
+ rendered: false
189897
+ },
189898
+ gain: {
189899
+ default: null,
189900
+ rendered: false
189901
+ },
189902
+ blacklevel: {
189903
+ default: null,
189904
+ rendered: false
189905
+ },
189674
189906
  simplePos: { rendered: false },
189675
189907
  extension: { rendered: false },
189676
189908
  originalExtension: { rendered: false },
@@ -195675,8 +195907,8 @@ function print() { __p += __j.call(arguments, '') }
195675
195907
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
195676
195908
  };
195677
195909
  stubFalse_default = stubFalse;
195678
- freeExports$2 = typeof exports_src_BFDJrY7q_es == "object" && exports_src_BFDJrY7q_es && !exports_src_BFDJrY7q_es.nodeType && exports_src_BFDJrY7q_es;
195679
- freeModule$2 = freeExports$2 && typeof module_src_BFDJrY7q_es == "object" && module_src_BFDJrY7q_es && !module_src_BFDJrY7q_es.nodeType && module_src_BFDJrY7q_es;
195910
+ freeExports$2 = typeof exports_src_R57grOTY_es == "object" && exports_src_R57grOTY_es && !exports_src_R57grOTY_es.nodeType && exports_src_R57grOTY_es;
195911
+ freeModule$2 = freeExports$2 && typeof module_src_R57grOTY_es == "object" && module_src_R57grOTY_es && !module_src_R57grOTY_es.nodeType && module_src_R57grOTY_es;
195680
195912
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
195681
195913
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
195682
195914
  typedArrayTags = {};
@@ -195684,8 +195916,8 @@ function print() { __p += __j.call(arguments, '') }
195684
195916
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
195685
195917
  _baseIsTypedArray_default = baseIsTypedArray;
195686
195918
  _baseUnary_default = baseUnary;
195687
- freeExports$1 = typeof exports_src_BFDJrY7q_es == "object" && exports_src_BFDJrY7q_es && !exports_src_BFDJrY7q_es.nodeType && exports_src_BFDJrY7q_es;
195688
- freeModule$1 = freeExports$1 && typeof module_src_BFDJrY7q_es == "object" && module_src_BFDJrY7q_es && !module_src_BFDJrY7q_es.nodeType && module_src_BFDJrY7q_es;
195919
+ freeExports$1 = typeof exports_src_R57grOTY_es == "object" && exports_src_R57grOTY_es && !exports_src_R57grOTY_es.nodeType && exports_src_R57grOTY_es;
195920
+ freeModule$1 = freeExports$1 && typeof module_src_R57grOTY_es == "object" && module_src_R57grOTY_es && !module_src_R57grOTY_es.nodeType && module_src_R57grOTY_es;
195689
195921
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
195690
195922
  _nodeUtil_default = function() {
195691
195923
  try {
@@ -195790,8 +196022,8 @@ function print() { __p += __j.call(arguments, '') }
195790
196022
  Stack.prototype.has = _stackHas_default;
195791
196023
  Stack.prototype.set = _stackSet_default;
195792
196024
  _Stack_default = Stack;
195793
- freeExports = typeof exports_src_BFDJrY7q_es == "object" && exports_src_BFDJrY7q_es && !exports_src_BFDJrY7q_es.nodeType && exports_src_BFDJrY7q_es;
195794
- freeModule = freeExports && typeof module_src_BFDJrY7q_es == "object" && module_src_BFDJrY7q_es && !module_src_BFDJrY7q_es.nodeType && module_src_BFDJrY7q_es;
196025
+ freeExports = typeof exports_src_R57grOTY_es == "object" && exports_src_R57grOTY_es && !exports_src_R57grOTY_es.nodeType && exports_src_R57grOTY_es;
196026
+ freeModule = freeExports && typeof module_src_R57grOTY_es == "object" && module_src_R57grOTY_es && !module_src_R57grOTY_es.nodeType && module_src_R57grOTY_es;
195795
196027
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
195796
196028
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
195797
196029
  _cloneBuffer_default = cloneBuffer;
@@ -203443,13 +203675,13 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
203443
203675
 
203444
203676
  // ../../packages/superdoc/dist/super-editor.es.js
203445
203677
  var init_super_editor_es = __esm(() => {
203446
- init_src_BFDJrY7q_es();
203447
- init_SuperConverter_D7fmxDmw_es();
203678
+ init_src_R57grOTY_es();
203679
+ init_SuperConverter_CRrxAa8F_es();
203448
203680
  init_jszip_ChlR43oI_es();
203449
203681
  init_xml_js_DLE8mr0n_es();
203450
- init_constants_DBKi0Amm_es();
203682
+ init_constants_Dw0kAsLd_es();
203451
203683
  init_unified_BRHLwnjP_es();
203452
- init_DocxZipper_CXjNiywL_es();
203684
+ init_DocxZipper_B9Uo1uiZ_es();
203453
203685
  init_vue_UXsVEdB5_es();
203454
203686
  init_eventemitter3_U_DLl_Mg_es();
203455
203687
  init_zipper_Cnk_HjM2_es();
@@ -237289,6 +237521,206 @@ var init_Blob = __esm(() => {
237289
237521
  init_Helper();
237290
237522
  });
237291
237523
 
237524
+ // ../../packages/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/Bitmap.ts
237525
+ class BitmapCoreHeader2 {
237526
+ width;
237527
+ height;
237528
+ planes;
237529
+ bitcount;
237530
+ constructor(reader, skipsize) {
237531
+ if (skipsize) {
237532
+ reader.skip(4);
237533
+ }
237534
+ this.width = reader.readUint16();
237535
+ this.height = reader.readUint16();
237536
+ this.planes = reader.readUint16();
237537
+ this.bitcount = reader.readUint16();
237538
+ }
237539
+ colors() {
237540
+ return this.bitcount <= 8 ? 1 << this.bitcount : 0;
237541
+ }
237542
+ }
237543
+
237544
+ class BitmapInfoHeader2 {
237545
+ width;
237546
+ height;
237547
+ planes;
237548
+ bitcount;
237549
+ compression;
237550
+ sizeimage;
237551
+ xpelspermeter;
237552
+ ypelspermeter;
237553
+ clrused;
237554
+ clrimportant;
237555
+ constructor(reader, skipsize) {
237556
+ if (skipsize) {
237557
+ reader.skip(4);
237558
+ }
237559
+ this.width = reader.readInt32();
237560
+ this.height = reader.readInt32();
237561
+ this.planes = reader.readUint16();
237562
+ this.bitcount = reader.readUint16();
237563
+ this.compression = reader.readUint32();
237564
+ this.sizeimage = reader.readUint32();
237565
+ this.xpelspermeter = reader.readInt32();
237566
+ this.ypelspermeter = reader.readInt32();
237567
+ this.clrused = reader.readUint32();
237568
+ this.clrimportant = reader.readUint32();
237569
+ }
237570
+ colors() {
237571
+ if (this.clrused !== 0) {
237572
+ return this.clrused < 256 ? this.clrused : 256;
237573
+ } else {
237574
+ return this.bitcount > 8 ? 0 : 1 << this.bitcount;
237575
+ }
237576
+ }
237577
+ }
237578
+
237579
+ class BitmapInfo2 {
237580
+ _usergb;
237581
+ _infosize;
237582
+ _header;
237583
+ constructor(reader, usergb) {
237584
+ this._usergb = usergb;
237585
+ const hdrsize = reader.readUint32();
237586
+ this._infosize = hdrsize;
237587
+ if (hdrsize === Helper2.GDI.BITMAPCOREHEADER_SIZE) {
237588
+ this._header = new BitmapCoreHeader2(reader, false);
237589
+ this._infosize += this._header.colors() * (usergb ? 3 : 2);
237590
+ } else {
237591
+ this._header = new BitmapInfoHeader2(reader, false);
237592
+ const masks = this._header.compression === Helper2.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;
237593
+ if (hdrsize <= Helper2.GDI.BITMAPINFOHEADER_SIZE + masks * 4) {
237594
+ this._infosize = Helper2.GDI.BITMAPINFOHEADER_SIZE + masks * 4;
237595
+ }
237596
+ this._infosize += this._header.colors() * (usergb ? 4 : 2);
237597
+ }
237598
+ }
237599
+ getWidth() {
237600
+ return this._header.width;
237601
+ }
237602
+ getHeight() {
237603
+ return Math.abs(this._header.height);
237604
+ }
237605
+ infosize() {
237606
+ return this._infosize;
237607
+ }
237608
+ header() {
237609
+ return this._header;
237610
+ }
237611
+ }
237612
+
237613
+ class DIBitmap2 {
237614
+ _reader;
237615
+ _offset;
237616
+ _location;
237617
+ _info;
237618
+ constructor(reader, bitmapInfo) {
237619
+ this._reader = reader;
237620
+ this._offset = reader.pos;
237621
+ this._location = bitmapInfo;
237622
+ this._info = new BitmapInfo2(reader, true);
237623
+ }
237624
+ getWidth() {
237625
+ return this._info.getWidth();
237626
+ }
237627
+ getHeight() {
237628
+ return this._info.getHeight();
237629
+ }
237630
+ totalSize() {
237631
+ return this._location.header.size + this._location.data.size;
237632
+ }
237633
+ makeBitmapFileHeader() {
237634
+ const buf = new ArrayBuffer(14);
237635
+ const view = new Uint8Array(buf);
237636
+ view[0] = 66;
237637
+ view[1] = 77;
237638
+ Helper2._writeUint32Val(view, 2, this.totalSize() + 14);
237639
+ Helper2._writeUint32Val(view, 10, this._info.infosize() + 14);
237640
+ return Helper2._blobToBinary(view);
237641
+ }
237642
+ convertToPNG(bitmapData, width, height, hasAlpha) {
237643
+ const canvas2 = document.createElement("canvas");
237644
+ canvas2.width = width;
237645
+ canvas2.height = Math.abs(height);
237646
+ const ctx2 = canvas2.getContext("2d");
237647
+ if (!ctx2) {
237648
+ throw new Error("Unable to get canvas context for PNG conversion");
237649
+ }
237650
+ const imageData = ctx2.createImageData(width, Math.abs(height));
237651
+ const pixels = imageData.data;
237652
+ const rowSize = width * 32 + 31 >>> 5 << 2;
237653
+ const absHeight = Math.abs(height);
237654
+ const topDown = height < 0;
237655
+ let alphaUsed = false;
237656
+ if (hasAlpha) {
237657
+ for (let y2 = 0;y2 < absHeight && !alphaUsed; y2++) {
237658
+ const srcY = topDown ? y2 : absHeight - 1 - y2;
237659
+ for (let x = 0;x < width && !alphaUsed; x++) {
237660
+ const srcOffset = srcY * rowSize + x * 4;
237661
+ if (bitmapData[srcOffset + 3] > 0) {
237662
+ alphaUsed = true;
237663
+ }
237664
+ }
237665
+ }
237666
+ }
237667
+ for (let y2 = 0;y2 < absHeight; y2++) {
237668
+ const srcY = topDown ? y2 : absHeight - 1 - y2;
237669
+ for (let x = 0;x < width; x++) {
237670
+ const srcOffset = srcY * rowSize + x * 4;
237671
+ const dstOffset = (y2 * width + x) * 4;
237672
+ pixels[dstOffset] = bitmapData[srcOffset + 2];
237673
+ pixels[dstOffset + 1] = bitmapData[srcOffset + 1];
237674
+ pixels[dstOffset + 2] = bitmapData[srcOffset];
237675
+ pixels[dstOffset + 3] = alphaUsed ? bitmapData[srcOffset + 3] : 255;
237676
+ }
237677
+ }
237678
+ ctx2.putImageData(imageData, 0, 0);
237679
+ return canvas2.toDataURL("image/png");
237680
+ }
237681
+ base64ref() {
237682
+ const prevpos = this._reader.pos;
237683
+ this._reader.seek(this._offset);
237684
+ const header = this._info.header();
237685
+ if (header instanceof BitmapInfoHeader2 && header.compression != null) {
237686
+ switch (header.compression) {
237687
+ case Helper2.GDI.BitmapCompression.BI_JPEG:
237688
+ this._reader.seek(this._location.data.off);
237689
+ const jpegData = "data:image/jpeg;base64," + btoa(this._reader.readBinary(this._location.data.size));
237690
+ this._reader.seek(prevpos);
237691
+ return jpegData;
237692
+ case Helper2.GDI.BitmapCompression.BI_PNG:
237693
+ this._reader.seek(this._location.data.off);
237694
+ const pngData = "data:image/png;base64," + btoa(this._reader.readBinary(this._location.data.size));
237695
+ this._reader.seek(prevpos);
237696
+ return pngData;
237697
+ }
237698
+ }
237699
+ if (header instanceof BitmapInfoHeader2 && header.bitcount === 32) {
237700
+ this._reader.seek(this._location.data.off);
237701
+ const bitmapBytes = new Uint8Array(this._location.data.size);
237702
+ const bitmapData = this._reader.readBinary(this._location.data.size);
237703
+ for (let i4 = 0;i4 < this._location.data.size; i4++) {
237704
+ bitmapBytes[i4] = bitmapData.charCodeAt(i4);
237705
+ }
237706
+ const pngDataUrl = this.convertToPNG(bitmapBytes, header.width, header.height, true);
237707
+ this._reader.seek(prevpos);
237708
+ return pngDataUrl;
237709
+ }
237710
+ let data = this.makeBitmapFileHeader();
237711
+ this._reader.seek(this._location.header.off);
237712
+ data += this._reader.readBinary(this._location.header.size);
237713
+ this._reader.seek(this._location.data.off);
237714
+ data += this._reader.readBinary(this._location.data.size);
237715
+ const ref3 = "data:image/bmp;base64," + btoa(data);
237716
+ this._reader.seek(prevpos);
237717
+ return ref3;
237718
+ }
237719
+ }
237720
+ var init_Bitmap = __esm(() => {
237721
+ init_Helper();
237722
+ });
237723
+
237292
237724
  // ../../packages/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/Primitives.ts
237293
237725
  class PointS3 {
237294
237726
  x;
@@ -237764,162 +238196,6 @@ var init_Region = __esm(() => {
237764
238196
  };
237765
238197
  });
237766
238198
 
237767
- // ../../packages/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/Bitmap.ts
237768
- class BitmapCoreHeader2 {
237769
- width;
237770
- height;
237771
- planes;
237772
- bitcount;
237773
- constructor(reader, skipsize) {
237774
- if (skipsize) {
237775
- reader.skip(4);
237776
- }
237777
- this.width = reader.readUint16();
237778
- this.height = reader.readUint16();
237779
- this.planes = reader.readUint16();
237780
- this.bitcount = reader.readUint16();
237781
- }
237782
- colors() {
237783
- return this.bitcount <= 8 ? 1 << this.bitcount : 0;
237784
- }
237785
- }
237786
-
237787
- class BitmapInfoHeader2 {
237788
- width;
237789
- height;
237790
- planes;
237791
- bitcount;
237792
- compression;
237793
- sizeimage;
237794
- xpelspermeter;
237795
- ypelspermeter;
237796
- clrused;
237797
- clrimportant;
237798
- constructor(reader, skipsize) {
237799
- if (skipsize) {
237800
- reader.skip(4);
237801
- }
237802
- this.width = reader.readInt32();
237803
- this.height = reader.readInt32();
237804
- this.planes = reader.readUint16();
237805
- this.bitcount = reader.readUint16();
237806
- this.compression = reader.readUint32();
237807
- this.sizeimage = reader.readUint32();
237808
- this.xpelspermeter = reader.readInt32();
237809
- this.ypelspermeter = reader.readInt32();
237810
- this.clrused = reader.readUint32();
237811
- this.clrimportant = reader.readUint32();
237812
- }
237813
- colors() {
237814
- if (this.clrused !== 0) {
237815
- return this.clrused < 256 ? this.clrused : 256;
237816
- } else {
237817
- return this.bitcount > 8 ? 0 : 1 << this.bitcount;
237818
- }
237819
- }
237820
- }
237821
-
237822
- class BitmapInfo2 {
237823
- _usergb;
237824
- _infosize;
237825
- _header;
237826
- constructor(reader, usergb) {
237827
- this._usergb = usergb;
237828
- const hdrsize = reader.readUint32();
237829
- this._infosize = hdrsize;
237830
- if (hdrsize === Helper2.GDI.BITMAPCOREHEADER_SIZE) {
237831
- this._header = new BitmapCoreHeader2(reader, false);
237832
- this._infosize += this._header.colors() * (usergb ? 3 : 2);
237833
- } else {
237834
- this._header = new BitmapInfoHeader2(reader, false);
237835
- const masks = this._header.compression === Helper2.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;
237836
- if (hdrsize <= Helper2.GDI.BITMAPINFOHEADER_SIZE + masks * 4) {
237837
- this._infosize = Helper2.GDI.BITMAPINFOHEADER_SIZE + masks * 4;
237838
- }
237839
- this._infosize += this._header.colors() * (usergb ? 4 : 2);
237840
- }
237841
- }
237842
- getWidth() {
237843
- return this._header.width;
237844
- }
237845
- getHeight() {
237846
- return Math.abs(this._header.height);
237847
- }
237848
- infosize() {
237849
- return this._infosize;
237850
- }
237851
- header() {
237852
- return this._header;
237853
- }
237854
- }
237855
-
237856
- class DIBitmap2 {
237857
- _reader;
237858
- _offset;
237859
- _location;
237860
- _info;
237861
- constructor(reader, bitmapInfo) {
237862
- this._reader = reader;
237863
- this._offset = reader.pos;
237864
- this._location = bitmapInfo;
237865
- this._info = new BitmapInfo2(reader, true);
237866
- }
237867
- getWidth() {
237868
- return this._info.getWidth();
237869
- }
237870
- getHeight() {
237871
- return this._info.getHeight();
237872
- }
237873
- totalSize() {
237874
- return this._location.header.size + this._location.data.size;
237875
- }
237876
- makeBitmapFileHeader() {
237877
- const buf = new ArrayBuffer(14);
237878
- const view = new Uint8Array(buf);
237879
- view[0] = 66;
237880
- view[1] = 77;
237881
- Helper2._writeUint32Val(view, 2, this.totalSize() + 14);
237882
- Helper2._writeUint32Val(view, 10, this._info.infosize() + 14);
237883
- return Helper2._blobToBinary(view);
237884
- }
237885
- base64ref() {
237886
- const prevpos = this._reader.pos;
237887
- this._reader.seek(this._offset);
237888
- let mime = "image/bmp";
237889
- const header = this._info.header();
237890
- let data;
237891
- if (header instanceof BitmapInfoHeader2 && header.compression != null) {
237892
- switch (header.compression) {
237893
- case Helper2.GDI.BitmapCompression.BI_JPEG:
237894
- mime = "data:image/jpeg";
237895
- break;
237896
- case Helper2.GDI.BitmapCompression.BI_PNG:
237897
- mime = "data:image/png";
237898
- break;
237899
- default:
237900
- data = this.makeBitmapFileHeader();
237901
- break;
237902
- }
237903
- } else {
237904
- data = this.makeBitmapFileHeader();
237905
- }
237906
- this._reader.seek(this._location.header.offset);
237907
- if (data != null) {
237908
- data += this._reader.readBinary(this._location.header.size);
237909
- } else {
237910
- data = this._reader.readBinary(this._location.header.size);
237911
- }
237912
- this._reader.seek(this._location.data.offset);
237913
- data += this._reader.readBinary(this._location.data.size);
237914
- const ref3 = "data:" + mime + ";base64," + btoa(data);
237915
- this._reader.seek(prevpos);
237916
- return ref3;
237917
- }
237918
- }
237919
- var init_Bitmap = __esm(() => {
237920
- init_Helper();
237921
- });
237922
-
237923
238199
  // ../../packages/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/Style.ts
237924
238200
  class ColorRef3 {
237925
238201
  r;
@@ -238203,6 +238479,9 @@ class EmfHeader2 {
238203
238479
  }
238204
238480
  }
238205
238481
  }
238482
+ getBounds() {
238483
+ return this.bounds;
238484
+ }
238206
238485
  toString() {
238207
238486
  return "{bounds: " + this.bounds.toString() + ", frame: " + this.frame.toString() + ", description: " + this.description + "}";
238208
238487
  }
@@ -238318,11 +238597,11 @@ class EMFRecords2 {
238318
238597
  const cbBits = reader.readUint32();
238319
238598
  const pen = new Pen3(reader, {
238320
238599
  header: {
238321
- off: offBmi,
238600
+ off: curpos + offBmi,
238322
238601
  size: cbBmi
238323
238602
  },
238324
238603
  data: {
238325
- off: offBits,
238604
+ off: curpos + offBits,
238326
238605
  size: cbBits
238327
238606
  }
238328
238607
  });
@@ -238568,6 +238847,37 @@ class EMFRecords2 {
238568
238847
  });
238569
238848
  break;
238570
238849
  }
238850
+ case Helper2.GDI.RecordType.EMR_STRETCHDIBITS: {
238851
+ const bounds = new RectL3(reader);
238852
+ const xDest = reader.readInt32();
238853
+ const yDest = reader.readInt32();
238854
+ const xSrc = reader.readInt32();
238855
+ const ySrc = reader.readInt32();
238856
+ const cxSrc = reader.readInt32();
238857
+ const cySrc = reader.readInt32();
238858
+ const offBmiSrc = reader.readUint32();
238859
+ const cbBmiSrc = reader.readUint32();
238860
+ const offBitsSrc = reader.readUint32();
238861
+ const cbBitsSrc = reader.readUint32();
238862
+ const iUsageSrc = reader.readUint32();
238863
+ const dwRop = reader.readUint32();
238864
+ const cxDest = reader.readInt32();
238865
+ const cyDest = reader.readInt32();
238866
+ const dib = new DIBitmap2(reader, {
238867
+ header: {
238868
+ off: curpos + offBmiSrc,
238869
+ size: cbBmiSrc
238870
+ },
238871
+ data: {
238872
+ off: curpos + offBitsSrc,
238873
+ size: cbBitsSrc
238874
+ }
238875
+ });
238876
+ this._records.push((gdi) => {
238877
+ gdi.stretchDibBits(xSrc, ySrc, cxSrc, cySrc, xDest, yDest, cxDest, cyDest, dwRop, iUsageSrc, dib);
238878
+ });
238879
+ break;
238880
+ }
238571
238881
  case Helper2.GDI.RecordType.EMR_POLYLINE:
238572
238882
  case Helper2.GDI.RecordType.EMR_POLYLINETO:
238573
238883
  case Helper2.GDI.RecordType.EMR_POLYPOLYLINE:
@@ -238610,7 +238920,6 @@ class EMFRecords2 {
238610
238920
  case Helper2.GDI.RecordType.EMR_MASKBLT:
238611
238921
  case Helper2.GDI.RecordType.EMR_PLGBLT:
238612
238922
  case Helper2.GDI.RecordType.EMR_SETDIBITSTODEVICE:
238613
- case Helper2.GDI.RecordType.EMR_STRETCHDIBITS:
238614
238923
  case Helper2.GDI.RecordType.EMR_EXTCREATEFONTINDIRECTW:
238615
238924
  case Helper2.GDI.RecordType.EMR_EXTTEXTOUTA:
238616
238925
  case Helper2.GDI.RecordType.EMR_EXTTEXTOUTW:
@@ -238662,6 +238971,9 @@ class EMFRecords2 {
238662
238971
  throw new EMFJSError2("Could not read all records");
238663
238972
  }
238664
238973
  }
238974
+ getBounds() {
238975
+ return this._header.getBounds();
238976
+ }
238665
238977
  play(gdi) {
238666
238978
  const len3 = this._records.length;
238667
238979
  for (let i4 = 0;i4 < len3; i4++) {
@@ -238670,6 +238982,7 @@ class EMFRecords2 {
238670
238982
  }
238671
238983
  }
238672
238984
  var init_EMFRecords = __esm(() => {
238985
+ init_Bitmap();
238673
238986
  init_Helper();
238674
238987
  init_Primitives();
238675
238988
  init_Region();
@@ -238851,6 +239164,9 @@ class GDIContext2 {
238851
239164
  this.state.mapmode = mode;
238852
239165
  this.state._svggroup = null;
238853
239166
  }
239167
+ getMapMode() {
239168
+ return this.state.mapmode;
239169
+ }
238854
239170
  setWindowOrgEx(x, y2) {
238855
239171
  Helper2.log("[gdi] setWindowOrgEx: x=" + x + " y=" + y2);
238856
239172
  this.state.wx = x;
@@ -238905,6 +239221,20 @@ class GDIContext2 {
238905
239221
  setStretchBltMode(stretchMode) {
238906
239222
  Helper2.log("[gdi] setStretchBltMode: stretchMode=" + stretchMode);
238907
239223
  }
239224
+ stretchDibBits(srcX, srcY, srcW, srcH, dstX, dstY, dstW, dstH, rasterOp, colorUsage, dib) {
239225
+ Helper2.log("[gdi] stretchDibBits: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH + " rasterOp=0x" + rasterOp.toString(16));
239226
+ srcX = this._todevX(srcX);
239227
+ srcY = this._todevY(srcY);
239228
+ srcW = this._todevW(srcW);
239229
+ srcH = this._todevH(srcH);
239230
+ dstX = this._todevX(dstX);
239231
+ dstY = this._todevY(dstY);
239232
+ dstW = this._todevW(dstW);
239233
+ dstH = this._todevH(dstH);
239234
+ Helper2.log("[gdi] stretchDibBits: TRANSLATED:" + " srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH + " rasterOp=0x" + rasterOp.toString(16));
239235
+ this._pushGroup();
239236
+ this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());
239237
+ }
238908
239238
  rectangle(rect, rw, rh) {
238909
239239
  Helper2.log("[gdi] rectangle: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString() + " and brush " + this.state.selected.brush.toString());
238910
239240
  const bottom2 = this._todevY(rect.bottom);
@@ -239421,9 +239751,12 @@ class Renderer2 {
239421
239751
  }
239422
239752
  render(info) {
239423
239753
  const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
239424
- this._render(new SVG2(svgElement), info.mapMode, info.wExt, info.hExt, info.xExt, info.yExt);
239425
- svgElement.setAttribute("viewBox", [0, 0, info.xExt, info.yExt].join(" "));
239426
- svgElement.setAttribute("preserveAspectRatio", "none");
239754
+ const emfBounds = this._img.getBounds();
239755
+ const gdi = this._render(new SVG2(svgElement), info.mapMode, emfBounds.width, emfBounds.height, emfBounds.width, emfBounds.height);
239756
+ svgElement.setAttribute("viewBox", [0, 0, emfBounds.width, emfBounds.height].join(" "));
239757
+ const finalMapMode = gdi.getMapMode();
239758
+ const preserveAspectRatio = finalMapMode === Helper2.GDI.MapMode.MM_ANISOTROPIC ? "none" : "xMidYMid meet";
239759
+ svgElement.setAttribute("preserveAspectRatio", preserveAspectRatio);
239427
239760
  svgElement.setAttribute("width", info.width);
239428
239761
  svgElement.setAttribute("height", info.height);
239429
239762
  return svgElement;
@@ -239452,6 +239785,7 @@ class Renderer2 {
239452
239785
  Helper2.log("[EMF] BEGIN RENDERING --->");
239453
239786
  this._img.render(gdi);
239454
239787
  Helper2.log("[EMF] <--- DONE RENDERING");
239788
+ return gdi;
239455
239789
  }
239456
239790
  }
239457
239791
 
@@ -239465,6 +239799,13 @@ class EMF2 {
239465
239799
  render(gdi) {
239466
239800
  this._records.play(gdi);
239467
239801
  }
239802
+ getBounds() {
239803
+ const bounds = this._records.getBounds();
239804
+ return {
239805
+ width: bounds.right - bounds.left,
239806
+ height: bounds.bottom - bounds.top
239807
+ };
239808
+ }
239468
239809
  }
239469
239810
  var init_Renderer = __esm(() => {
239470
239811
  init_util();
@@ -243529,6 +243870,7 @@ function handleImageNode3(node4, params3, isAnchor) {
243529
243870
  if (!blip) {
243530
243871
  return null;
243531
243872
  }
243873
+ const hasGrayscale = blip.elements?.some((el) => el.name === "a:grayscl");
243532
243874
  const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
243533
243875
  const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
243534
243876
  const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
@@ -243629,7 +243971,8 @@ function handleImageNode3(node4, params3, isAnchor) {
243629
243971
  originalAttributes: node4.attributes,
243630
243972
  rId: relAttributes["Id"],
243631
243973
  ...order4.length ? { drawingChildOrder: order4 } : {},
243632
- ...originalChildren.length ? { originalDrawingChildren: originalChildren } : {}
243974
+ ...originalChildren.length ? { originalDrawingChildren: originalChildren } : {},
243975
+ ...hasGrayscale ? { grayscale: true } : {}
243633
243976
  };
243634
243977
  return {
243635
243978
  type: "image",
@@ -244467,7 +244810,10 @@ var translateImageNode2 = (params3) => {
244467
244810
  name: "a:blip",
244468
244811
  attributes: {
244469
244812
  "r:embed": imageId
244470
- }
244813
+ },
244814
+ ...attrs.grayscale ? {
244815
+ elements: [{ name: "a:grayscl" }]
244816
+ } : {}
244471
244817
  },
244472
244818
  ...rawSrcRect ? [rawSrcRect] : [],
244473
244819
  {