@harbour-enterprises/superdoc 0.22.0-next.5 → 0.22.0-next.7

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 (26) hide show
  1. package/dist/chunks/{PdfViewer-dsL5uHg1.es.js → PdfViewer-DUbqS8Es.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-Badqoc1e.cjs → PdfViewer-Db-KJKqC.cjs} +1 -1
  3. package/dist/chunks/{index-DBNzXf1D.es.js → index-BobTY60h.es.js} +2 -2
  4. package/dist/chunks/{index-DVrbZM76.cjs → index-CUTF_PqT.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-DruRanWK.es.js → super-editor.es-68D48VWo.es.js} +92 -3
  6. package/dist/chunks/{super-editor.es-p3eqHXlj.cjs → super-editor.es-Csy-KPwx.cjs} +92 -3
  7. package/dist/core/types/index.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-DujfV3Zn.js → converter-D9kK7Smo.js} +90 -2
  10. package/dist/super-editor/chunks/{docx-zipper-DccEqL60.js → docx-zipper-D8HnWWpv.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-Dq3xPdti.js → editor-IHdqoVXS.js} +4 -3
  12. package/dist/super-editor/chunks/{toolbar-u5oyT_9K.js → toolbar-CZuqQ0AA.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/super-converter/helpers/tableFallbackHelpers.d.ts +24 -0
  18. package/dist/super-editor/super-editor.es.js +6 -6
  19. package/dist/super-editor/toolbar.es.js +2 -2
  20. package/dist/super-editor.cjs +1 -1
  21. package/dist/super-editor.es.js +1 -1
  22. package/dist/superdoc.cjs +2 -2
  23. package/dist/superdoc.es.js +2 -2
  24. package/dist/superdoc.umd.js +92 -3
  25. package/dist/superdoc.umd.js.map +1 -1
  26. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-CXxsqYcP.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DBNzXf1D.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-BobTY60h.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DWle4Cai.cjs");
4
- const superdoc = require("./index-DVrbZM76.cjs");
4
+ const superdoc = require("./index-CUTF_PqT.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DruRanWK.es.js";
1
+ import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-68D48VWo.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-CXxsqYcP.es.js";
3
3
  import { B as Buffer$2 } from "./jszip-B8KIZSNe.es.js";
4
4
  import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
@@ -17392,7 +17392,7 @@ const _sfc_main = {
17392
17392
  __name: "SuperDoc",
17393
17393
  emits: ["selection-update"],
17394
17394
  setup(__props, { emit: __emit }) {
17395
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-dsL5uHg1.es.js"));
17395
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DUbqS8Es.es.js"));
17396
17396
  const superdocStore = useSuperdocStore();
17397
17397
  const commentsStore = useCommentsStore();
17398
17398
  const {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-p3eqHXlj.cjs");
2
+ const superEditor_es = require("./super-editor.es-Csy-KPwx.cjs");
3
3
  const vue = require("./vue-DWle4Cai.cjs");
4
4
  const jszip = require("./jszip-b7l8QkfH.cjs");
5
5
  const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
@@ -17409,7 +17409,7 @@ const _sfc_main = {
17409
17409
  __name: "SuperDoc",
17410
17410
  emits: ["selection-update"],
17411
17411
  setup(__props, { emit: __emit }) {
17412
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Badqoc1e.cjs")));
17412
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Db-KJKqC.cjs")));
17413
17413
  const superdocStore = useSuperdocStore();
17414
17414
  const commentsStore = useCommentsStore();
17415
17415
  const {
@@ -27160,6 +27160,68 @@ const config$a = {
27160
27160
  decode: decode$h
27161
27161
  };
27162
27162
  const translator$a = NodeTranslator.from(config$a);
27163
+ const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27164
+ const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27165
+ const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
27166
+ const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
27167
+ const pctToPercent = (value) => {
27168
+ if (value == null) return null;
27169
+ return value / 50;
27170
+ };
27171
+ const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
27172
+ const resolveMeasurementWidthPx = (measurement) => {
27173
+ if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
27174
+ const { value, type: type2 } = measurement;
27175
+ if (!type2 || type2 === "auto") return null;
27176
+ if (type2 === "dxa") return twipsToPixels(value);
27177
+ if (type2 === "pct") {
27178
+ const percent2 = pctToPercent(value);
27179
+ if (percent2 == null || percent2 <= 0) return null;
27180
+ const widthTwips = resolveContentWidthTwips() * percent2 / 100;
27181
+ return twipsToPixels(widthTwips);
27182
+ }
27183
+ return null;
27184
+ };
27185
+ const countColumnsInRow = (row) => {
27186
+ if (!row?.elements?.length) return 0;
27187
+ return row.elements.reduce((count, element) => {
27188
+ if (element.name !== "w:tc") return count;
27189
+ const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
27190
+ const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
27191
+ const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
27192
+ return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
27193
+ }, 0);
27194
+ };
27195
+ const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
27196
+ const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
27197
+ const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWidthMeasurement }) => {
27198
+ const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
27199
+ const columnCount = countColumnsInRow(firstRow);
27200
+ if (!columnCount) return null;
27201
+ const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
27202
+ /** @type {any} */
27203
+ params2
27204
+ );
27205
+ const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
27206
+ let totalWidthPx;
27207
+ if (tableWidthMeasurement) {
27208
+ const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
27209
+ if (resolved != null) totalWidthPx = resolved;
27210
+ }
27211
+ if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) {
27212
+ totalWidthPx = tableWidth.width;
27213
+ }
27214
+ if (totalWidthPx == null) {
27215
+ totalWidthPx = minimumColumnWidthPx * columnCount;
27216
+ }
27217
+ const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
27218
+ const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
27219
+ const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
27220
+ return {
27221
+ grid: createFallbackGrid(columnCount, columnWidthTwips),
27222
+ columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27223
+ };
27224
+ };
27163
27225
  const XML_NODE_NAME$9 = "w:tbl";
27164
27226
  const SD_NODE_NAME$9 = "table";
27165
27227
  const encode$g = (params2, encodedAttrs) => {
@@ -27179,7 +27241,6 @@ const encode$g = (params2, encodedAttrs) => {
27179
27241
  "justification",
27180
27242
  "tableLayout",
27181
27243
  ["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
27182
- ["tableWidth", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
27183
27244
  ["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
27184
27245
  ].forEach((prop) => {
27185
27246
  let key2;
@@ -27197,6 +27258,21 @@ const encode$g = (params2, encodedAttrs) => {
27197
27258
  if (encodedAttrs.tableCellSpacing) {
27198
27259
  encodedAttrs["borderCollapse"] = "separate";
27199
27260
  }
27261
+ if (encodedAttrs.tableProperties?.tableWidth) {
27262
+ const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
27263
+ const widthPx = twipsToPixels(tableWidthMeasurement.value);
27264
+ if (widthPx != null) {
27265
+ encodedAttrs.tableWidth = {
27266
+ width: widthPx,
27267
+ type: tableWidthMeasurement.type
27268
+ };
27269
+ } else if (tableWidthMeasurement.type === "auto") {
27270
+ encodedAttrs.tableWidth = {
27271
+ width: 0,
27272
+ type: tableWidthMeasurement.type
27273
+ };
27274
+ }
27275
+ }
27200
27276
  const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
27201
27277
  const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
27202
27278
  if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
@@ -27210,7 +27286,19 @@ const encode$g = (params2, encodedAttrs) => {
27210
27286
  const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
27211
27287
  encodedAttrs["borders"] = borderData;
27212
27288
  const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
27213
- const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
27289
+ let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
27290
+ if (!columnWidths.length) {
27291
+ const fallback = buildFallbackGridForTable({
27292
+ params: params2,
27293
+ rows,
27294
+ tableWidth: encodedAttrs.tableWidth,
27295
+ tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
27296
+ });
27297
+ if (fallback) {
27298
+ encodedAttrs.grid = fallback.grid;
27299
+ columnWidths = fallback.columnWidths;
27300
+ }
27301
+ }
27214
27302
  const content = [];
27215
27303
  rows.forEach((row) => {
27216
27304
  const result = translator$G.encode({
@@ -49160,6 +49248,7 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
49160
49248
  const mappedRowStart = tr.mapping.map(absoluteRowStart);
49161
49249
  const rowEnd = mappedRowStart + rowNode.nodeSize;
49162
49250
  tr.replaceWith(mappedRowStart, rowEnd, Fragment.from(newRows));
49251
+ tr.setMeta("tableGeneration", true);
49163
49252
  } catch (error) {
49164
49253
  console.error("Error during row generation:", error);
49165
49254
  throw error;
@@ -49564,7 +49653,7 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
49564
49653
  }
49565
49654
  function findRemovedFieldAnnotations(tr) {
49566
49655
  let removedNodes = [];
49567
- if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true) {
49656
+ if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true || tr.getMeta("tableGeneration") === true) {
49568
49657
  return removedNodes;
49569
49658
  }
49570
49659
  const hasDeletion = transactionDeletedAnything(tr);
@@ -27177,6 +27177,68 @@ const config$a = {
27177
27177
  decode: decode$h
27178
27178
  };
27179
27179
  const translator$a = NodeTranslator.from(config$a);
27180
+ const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27181
+ const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27182
+ const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
27183
+ const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
27184
+ const pctToPercent = (value) => {
27185
+ if (value == null) return null;
27186
+ return value / 50;
27187
+ };
27188
+ const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
27189
+ const resolveMeasurementWidthPx = (measurement) => {
27190
+ if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
27191
+ const { value, type: type2 } = measurement;
27192
+ if (!type2 || type2 === "auto") return null;
27193
+ if (type2 === "dxa") return twipsToPixels(value);
27194
+ if (type2 === "pct") {
27195
+ const percent2 = pctToPercent(value);
27196
+ if (percent2 == null || percent2 <= 0) return null;
27197
+ const widthTwips = resolveContentWidthTwips() * percent2 / 100;
27198
+ return twipsToPixels(widthTwips);
27199
+ }
27200
+ return null;
27201
+ };
27202
+ const countColumnsInRow = (row) => {
27203
+ if (!row?.elements?.length) return 0;
27204
+ return row.elements.reduce((count, element) => {
27205
+ if (element.name !== "w:tc") return count;
27206
+ const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
27207
+ const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
27208
+ const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
27209
+ return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
27210
+ }, 0);
27211
+ };
27212
+ const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
27213
+ const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
27214
+ const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWidthMeasurement }) => {
27215
+ const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
27216
+ const columnCount = countColumnsInRow(firstRow);
27217
+ if (!columnCount) return null;
27218
+ const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
27219
+ /** @type {any} */
27220
+ params2
27221
+ );
27222
+ const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
27223
+ let totalWidthPx;
27224
+ if (tableWidthMeasurement) {
27225
+ const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
27226
+ if (resolved != null) totalWidthPx = resolved;
27227
+ }
27228
+ if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) {
27229
+ totalWidthPx = tableWidth.width;
27230
+ }
27231
+ if (totalWidthPx == null) {
27232
+ totalWidthPx = minimumColumnWidthPx * columnCount;
27233
+ }
27234
+ const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
27235
+ const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
27236
+ const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
27237
+ return {
27238
+ grid: createFallbackGrid(columnCount, columnWidthTwips),
27239
+ columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27240
+ };
27241
+ };
27180
27242
  const XML_NODE_NAME$9 = "w:tbl";
27181
27243
  const SD_NODE_NAME$9 = "table";
27182
27244
  const encode$g = (params2, encodedAttrs) => {
@@ -27196,7 +27258,6 @@ const encode$g = (params2, encodedAttrs) => {
27196
27258
  "justification",
27197
27259
  "tableLayout",
27198
27260
  ["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
27199
- ["tableWidth", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
27200
27261
  ["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
27201
27262
  ].forEach((prop) => {
27202
27263
  let key2;
@@ -27214,6 +27275,21 @@ const encode$g = (params2, encodedAttrs) => {
27214
27275
  if (encodedAttrs.tableCellSpacing) {
27215
27276
  encodedAttrs["borderCollapse"] = "separate";
27216
27277
  }
27278
+ if (encodedAttrs.tableProperties?.tableWidth) {
27279
+ const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
27280
+ const widthPx = twipsToPixels(tableWidthMeasurement.value);
27281
+ if (widthPx != null) {
27282
+ encodedAttrs.tableWidth = {
27283
+ width: widthPx,
27284
+ type: tableWidthMeasurement.type
27285
+ };
27286
+ } else if (tableWidthMeasurement.type === "auto") {
27287
+ encodedAttrs.tableWidth = {
27288
+ width: 0,
27289
+ type: tableWidthMeasurement.type
27290
+ };
27291
+ }
27292
+ }
27217
27293
  const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
27218
27294
  const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
27219
27295
  if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
@@ -27227,7 +27303,19 @@ const encode$g = (params2, encodedAttrs) => {
27227
27303
  const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
27228
27304
  encodedAttrs["borders"] = borderData;
27229
27305
  const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
27230
- const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
27306
+ let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
27307
+ if (!columnWidths.length) {
27308
+ const fallback = buildFallbackGridForTable({
27309
+ params: params2,
27310
+ rows,
27311
+ tableWidth: encodedAttrs.tableWidth,
27312
+ tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
27313
+ });
27314
+ if (fallback) {
27315
+ encodedAttrs.grid = fallback.grid;
27316
+ columnWidths = fallback.columnWidths;
27317
+ }
27318
+ }
27231
27319
  const content = [];
27232
27320
  rows.forEach((row) => {
27233
27321
  const result = translator$G.encode({
@@ -49177,6 +49265,7 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
49177
49265
  const mappedRowStart = tr.mapping.map(absoluteRowStart);
49178
49266
  const rowEnd = mappedRowStart + rowNode.nodeSize;
49179
49267
  tr.replaceWith(mappedRowStart, rowEnd, Fragment.from(newRows));
49268
+ tr.setMeta("tableGeneration", true);
49180
49269
  } catch (error) {
49181
49270
  console.error("Error during row generation:", error);
49182
49271
  throw error;
@@ -49581,7 +49670,7 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
49581
49670
  }
49582
49671
  function findRemovedFieldAnnotations(tr) {
49583
49672
  let removedNodes = [];
49584
- if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true) {
49673
+ if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true || tr.getMeta("tableGeneration") === true) {
49585
49674
  return removedNodes;
49586
49675
  }
49587
49676
  const hasDeletion = transactionDeletedAnything(tr);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.js"],"names":[],"mappings":";;;;;;;UAEc,MAAM;;;;WACN,MAAM;;;;YACN,MAAM,GAAG,IAAI;;;;;;;;;cAKb,OAAO;;;;iBACP,MAAM;;;;eACN,MAAM;;;;sBACN,MAAM;;;;;;SAKN,MAAM;;;;UACN,MAAM;;;;WACN,IAAI,GAAG,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;;;;YACP,MAAM;;;;oBACN,KAAQ;;;;eACR,OAAO;;;;wBACP,CAAS,IAAI,EAAJ,IAAI,KAAG,OAAO,CAAC,MAAM,CAAC;;;;eAC/B,IAAI;;;;aACJ,OAAO;;;;gCACP,OAAO;;;;;;;;yBAEP,OAAO;;;;WACP,MAAM;;;;eACN,MAAM;;;;cACN,OAAO"}
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-DujfV3Zn.js";
3
- import { _ as _export_sfc } from "./chunks/editor-Dq3xPdti.js";
2
+ import { T as TextSelection } from "./chunks/converter-D9kK7Smo.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-IHdqoVXS.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -27167,6 +27167,68 @@ const config$a = {
27167
27167
  decode: decode$h
27168
27168
  };
27169
27169
  const translator$a = NodeTranslator.from(config$a);
27170
+ const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
27171
+ const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
27172
+ const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
27173
+ const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
27174
+ const pctToPercent = (value) => {
27175
+ if (value == null) return null;
27176
+ return value / 50;
27177
+ };
27178
+ const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
27179
+ const resolveMeasurementWidthPx = (measurement) => {
27180
+ if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
27181
+ const { value, type: type2 } = measurement;
27182
+ if (!type2 || type2 === "auto") return null;
27183
+ if (type2 === "dxa") return twipsToPixels(value);
27184
+ if (type2 === "pct") {
27185
+ const percent = pctToPercent(value);
27186
+ if (percent == null || percent <= 0) return null;
27187
+ const widthTwips = resolveContentWidthTwips() * percent / 100;
27188
+ return twipsToPixels(widthTwips);
27189
+ }
27190
+ return null;
27191
+ };
27192
+ const countColumnsInRow = (row) => {
27193
+ if (!row?.elements?.length) return 0;
27194
+ return row.elements.reduce((count, element) => {
27195
+ if (element.name !== "w:tc") return count;
27196
+ const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
27197
+ const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
27198
+ const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
27199
+ return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
27200
+ }, 0);
27201
+ };
27202
+ const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
27203
+ const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
27204
+ const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasurement }) => {
27205
+ const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
27206
+ const columnCount = countColumnsInRow(firstRow);
27207
+ if (!columnCount) return null;
27208
+ const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
27209
+ /** @type {any} */
27210
+ params
27211
+ );
27212
+ const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
27213
+ let totalWidthPx;
27214
+ if (tableWidthMeasurement) {
27215
+ const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
27216
+ if (resolved != null) totalWidthPx = resolved;
27217
+ }
27218
+ if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) {
27219
+ totalWidthPx = tableWidth.width;
27220
+ }
27221
+ if (totalWidthPx == null) {
27222
+ totalWidthPx = minimumColumnWidthPx * columnCount;
27223
+ }
27224
+ const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
27225
+ const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
27226
+ const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
27227
+ return {
27228
+ grid: createFallbackGrid(columnCount, columnWidthTwips),
27229
+ columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
27230
+ };
27231
+ };
27170
27232
  const XML_NODE_NAME$9 = "w:tbl";
27171
27233
  const SD_NODE_NAME$9 = "table";
27172
27234
  const encode$g = (params, encodedAttrs) => {
@@ -27186,7 +27248,6 @@ const encode$g = (params, encodedAttrs) => {
27186
27248
  "justification",
27187
27249
  "tableLayout",
27188
27250
  ["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
27189
- ["tableWidth", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
27190
27251
  ["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
27191
27252
  ].forEach((prop) => {
27192
27253
  let key;
@@ -27204,6 +27265,21 @@ const encode$g = (params, encodedAttrs) => {
27204
27265
  if (encodedAttrs.tableCellSpacing) {
27205
27266
  encodedAttrs["borderCollapse"] = "separate";
27206
27267
  }
27268
+ if (encodedAttrs.tableProperties?.tableWidth) {
27269
+ const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
27270
+ const widthPx = twipsToPixels(tableWidthMeasurement.value);
27271
+ if (widthPx != null) {
27272
+ encodedAttrs.tableWidth = {
27273
+ width: widthPx,
27274
+ type: tableWidthMeasurement.type
27275
+ };
27276
+ } else if (tableWidthMeasurement.type === "auto") {
27277
+ encodedAttrs.tableWidth = {
27278
+ width: 0,
27279
+ type: tableWidthMeasurement.type
27280
+ };
27281
+ }
27282
+ }
27207
27283
  const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
27208
27284
  const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params);
27209
27285
  if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
@@ -27217,7 +27293,19 @@ const encode$g = (params, encodedAttrs) => {
27217
27293
  const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
27218
27294
  encodedAttrs["borders"] = borderData;
27219
27295
  const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
27220
- const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
27296
+ let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
27297
+ if (!columnWidths.length) {
27298
+ const fallback = buildFallbackGridForTable({
27299
+ params,
27300
+ rows,
27301
+ tableWidth: encodedAttrs.tableWidth,
27302
+ tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
27303
+ });
27304
+ if (fallback) {
27305
+ encodedAttrs.grid = fallback.grid;
27306
+ columnWidths = fallback.columnWidths;
27307
+ }
27308
+ }
27221
27309
  const content = [];
27222
27310
  rows.forEach((row) => {
27223
27311
  const result = translator$G.encode({
@@ -1,4 +1,4 @@
1
- import { p as process$1, au as commonjsGlobal, B as Buffer, av as getDefaultExportFromCjs, aw as getContentTypesFromXml, ax as xmljs } from "./converter-DujfV3Zn.js";
1
+ import { p as process$1, au as commonjsGlobal, B as Buffer, av as getDefaultExportFromCjs, aw as getContentTypesFromXml, ax as xmljs } from "./converter-D9kK7Smo.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-DujfV3Zn.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-D9kK7Smo.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-DccEqL60.js";
17
+ import { D as DocxZipper } from "./docx-zipper-D8HnWWpv.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -12709,6 +12709,7 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state }) =>
12709
12709
  const mappedRowStart = tr.mapping.map(absoluteRowStart);
12710
12710
  const rowEnd = mappedRowStart + rowNode.nodeSize;
12711
12711
  tr.replaceWith(mappedRowStart, rowEnd, Fragment.from(newRows));
12712
+ tr.setMeta("tableGeneration", true);
12712
12713
  } catch (error) {
12713
12714
  console.error("Error during row generation:", error);
12714
12715
  throw error;
@@ -13113,7 +13114,7 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
13113
13114
  }
13114
13115
  function findRemovedFieldAnnotations(tr) {
13115
13116
  let removedNodes = [];
13116
- if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true) {
13117
+ if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true || tr.getMeta("tableGeneration") === true) {
13117
13118
  return removedNodes;
13118
13119
  }
13119
13120
  const hasDeletion = transactionDeletedAnything(tr);
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-DujfV3Zn.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Dq3xPdti.js";
2
+ import { p as process$1 } from "./converter-D9kK7Smo.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-IHdqoVXS.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-DujfV3Zn.js";
1
+ import { a5 } from "./chunks/converter-D9kK7Smo.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DujfV3Zn.js";
2
- import { D } from "./chunks/docx-zipper-DccEqL60.js";
1
+ import "./chunks/converter-D9kK7Smo.js";
2
+ import { D } from "./chunks/docx-zipper-D8HnWWpv.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-Dq3xPdti.js";
2
- import "./chunks/converter-DujfV3Zn.js";
3
- import "./chunks/docx-zipper-DccEqL60.js";
1
+ import { E } from "./chunks/editor-IHdqoVXS.js";
2
+ import "./chunks/converter-D9kK7Smo.js";
3
+ import "./chunks/docx-zipper-D8HnWWpv.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-DccEqL60.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-D8HnWWpv.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -0,0 +1,24 @@
1
+ export const DEFAULT_PAGE_WIDTH_TWIPS: 12240;
2
+ export const DEFAULT_PAGE_MARGIN_TWIPS: 1440;
3
+ export const DEFAULT_CONTENT_WIDTH_TWIPS: number;
4
+ export const MIN_COLUMN_WIDTH_TWIPS: number;
5
+ export function pctToPercent(value: any): number;
6
+ export function resolveContentWidthTwips(): number;
7
+ export function resolveMeasurementWidthPx(measurement: any): number;
8
+ export function countColumnsInRow(row: any): any;
9
+ export function buildFallbackGridForTable({ params, rows, tableWidth, tableWidthMeasurement }: {
10
+ params: Partial<import("@translator").SCDecoderConfig>;
11
+ rows: any[];
12
+ tableWidth?: {
13
+ width?: number | null;
14
+ };
15
+ tableWidthMeasurement?: {
16
+ value?: number;
17
+ type?: string;
18
+ };
19
+ }): {
20
+ grid: Array<{
21
+ col: number;
22
+ }>;
23
+ columnWidths: number[];
24
+ } | null;
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { av as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, ay as vClickOutside, H as findParentNode, az as getActiveFormatting, ap as isInTable, aA as readFromClipboard, aB as handleClipboardPaste, aC as getFileObject, aD as runPropertyTranslators, aE as translator, aF as translator$1, aG as translator$2, aH as translator$3, aI as translator$4, aJ as translator$5, aK as translator$6, aL as translator$7, aM as translator$8, aN as translator$9, aO as translator$a, aP as translator$b, aQ as translator$c, aR as translator$d, aS as translator$e, aT as translator$f, aU as translator$g, aV as translator$h, aW as translator$i, aX as translator$j, aY as translator$k, aZ as translator$l, a_ as translator$m, a$ as translator$n, b0 as translator$o, b1 as translator$p, b2 as translator$q, b3 as translator$r, b4 as translator$s, b5 as translator$t, b6 as translator$u, b7 as translator$v, b8 as translator$w, b9 as translator$x, ba as translator$y, bb as translator$z, bc as translator$A, bd as translator$B, be as translator$C, bf as translator$D, bg as translator$E, bh as translator$F, bi as translator$G, bj as translator$H, bk as translator$I, bl as translator$J, bm as translator$K, bn as translator$L, bo as translator$M, bp as translator$N, bq as translator$O, br as translator$P, bs as translator$Q, bt as translator$R, bu as translator$S, bv as translator$T, bw as translator$U, bx as translator$V, by as translator$W, bz as translator$X, bA as translator$Y, bB as translator$Z, bC as translator$_, bD as translator$$, bE as translator$10, a as Plugin } from "./chunks/converter-DujfV3Zn.js";
13
- import { bF, a5, i, a2 } from "./chunks/converter-DujfV3Zn.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-Dq3xPdti.js";
15
- import { n, C, o, T, l, p, m } from "./chunks/editor-Dq3xPdti.js";
12
+ import { av as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, ay as vClickOutside, H as findParentNode, az as getActiveFormatting, ap as isInTable, aA as readFromClipboard, aB as handleClipboardPaste, aC as getFileObject, aD as runPropertyTranslators, aE as translator, aF as translator$1, aG as translator$2, aH as translator$3, aI as translator$4, aJ as translator$5, aK as translator$6, aL as translator$7, aM as translator$8, aN as translator$9, aO as translator$a, aP as translator$b, aQ as translator$c, aR as translator$d, aS as translator$e, aT as translator$f, aU as translator$g, aV as translator$h, aW as translator$i, aX as translator$j, aY as translator$k, aZ as translator$l, a_ as translator$m, a$ as translator$n, b0 as translator$o, b1 as translator$p, b2 as translator$q, b3 as translator$r, b4 as translator$s, b5 as translator$t, b6 as translator$u, b7 as translator$v, b8 as translator$w, b9 as translator$x, ba as translator$y, bb as translator$z, bc as translator$A, bd as translator$B, be as translator$C, bf as translator$D, bg as translator$E, bh as translator$F, bi as translator$G, bj as translator$H, bk as translator$I, bl as translator$J, bm as translator$K, bn as translator$L, bo as translator$M, bp as translator$N, bq as translator$O, br as translator$P, bs as translator$Q, bt as translator$R, bu as translator$S, bv as translator$T, bw as translator$U, bx as translator$V, by as translator$W, bz as translator$X, bA as translator$Y, bB as translator$Z, bC as translator$_, bD as translator$$, bE as translator$10, a as Plugin } from "./chunks/converter-D9kK7Smo.js";
13
+ import { bF, a5, i, a2 } from "./chunks/converter-D9kK7Smo.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-IHdqoVXS.js";
15
+ import { n, C, o, T, l, p, m } from "./chunks/editor-IHdqoVXS.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-u5oyT_9K.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-CZuqQ0AA.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-DccEqL60.js";
19
+ import { D } from "./chunks/docx-zipper-D8HnWWpv.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-u5oyT_9K.js";
3
- import "./chunks/editor-Dq3xPdti.js";
2
+ import { T } from "./chunks/toolbar-CZuqQ0AA.js";
3
+ import "./chunks/editor-IHdqoVXS.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-p3eqHXlj.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Csy-KPwx.cjs");
4
4
  require("./chunks/vue-DWle4Cai.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;