@harbour-enterprises/superdoc 0.14.6-next.4 → 0.14.6-next.5

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 (29) hide show
  1. package/dist/chunks/{index-BMwK7kM5.es.js → index-BvK-G6B1.es.js} +2 -2
  2. package/dist/chunks/{index-CZuIe8A3.cjs → index-CCRVYhTn.cjs} +1 -1
  3. package/dist/chunks/{index-Oz4X1zyg.cjs → index-CgJ5KVh6.cjs} +2 -2
  4. package/dist/chunks/{index-MJ-5Yknb.es.js → index-oHslWah4.es.js} +1 -1
  5. package/dist/chunks/{super-editor.es-BSwiXGrJ.es.js → super-editor.es-BYiQ5Sba.es.js} +130 -39
  6. package/dist/chunks/{super-editor.es-Bmml9Uk7.cjs → super-editor.es-MF7rUP6m.cjs} +130 -39
  7. package/dist/chunks/{url-CRVat8D5.cjs → url-BG1Z_Z2_.cjs} +1 -1
  8. package/dist/chunks/{url-Cqg2Hljl.es.js → url-Dvx6wrNT.es.js} +1 -1
  9. package/dist/chunks/{xml-js-t28wMlyv.cjs → xml-js-BHJlXtfU.cjs} +11 -4
  10. package/dist/chunks/{xml-js-D78KIQHL.es.js → xml-js-DNISVjNF.es.js} +11 -4
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-B6n6gLBy.js → converter-CBjKXKtl.js} +2 -2
  13. package/dist/super-editor/chunks/{docx-zipper-CSMGmfdk.js → docx-zipper-CW7ZrG_n.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-BBuhT-Hl.js → editor-CUhB7mWQ.js} +130 -39
  15. package/dist/super-editor/chunks/{toolbar-DQKVvAMM.js → toolbar-CGArQvBn.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  18. package/dist/super-editor/docx-zipper.es.js +2 -2
  19. package/dist/super-editor/editor.es.js +3 -3
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/super-editor.es.js +6 -6
  22. package/dist/super-editor/toolbar.es.js +2 -2
  23. package/dist/super-editor.cjs +1 -1
  24. package/dist/super-editor.es.js +1 -1
  25. package/dist/superdoc.cjs +5 -5
  26. package/dist/superdoc.es.js +6 -6
  27. package/dist/superdoc.umd.js +131 -40
  28. package/dist/superdoc.umd.js.map +1 -1
  29. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./jszip-CYDYUNnI.es.js";
2
2
  import { p as process$1 } from "./vue-lU0o_RlU.es.js";
3
- import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-D78KIQHL.es.js";
4
- import { u as url } from "./url-Cqg2Hljl.es.js";
3
+ import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-DNISVjNF.es.js";
4
+ import { u as url } from "./url-Dvx6wrNT.es.js";
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
7
7
  const e = m[i];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-D5XoMX4C.cjs");
3
- const index$2 = require("./index-Oz4X1zyg.cjs");
3
+ const index$2 = require("./index-CgJ5KVh6.cjs");
4
4
  function _mergeNamespaces(n, m) {
5
5
  for (var i = 0; i < m.length; i++) {
6
6
  const e = m[i];
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-D5XoMX4C.cjs");
3
3
  const vue = require("./vue-tQYF719J.cjs");
4
- const xmlJs = require("./xml-js-t28wMlyv.cjs");
5
- const url = require("./url-CRVat8D5.cjs");
4
+ const xmlJs = require("./xml-js-BHJlXtfU.cjs");
5
+ const url = require("./url-BG1Z_Z2_.cjs");
6
6
  function _mergeNamespaces(n, m) {
7
7
  for (var i = 0; i < m.length; i++) {
8
8
  const e = m[i];
@@ -1,5 +1,5 @@
1
1
  import { g as getDefaultExportFromCjs } from "./jszip-CYDYUNnI.es.js";
2
- import { s as streamHttp, r as require$$1 } from "./index-BMwK7kM5.es.js";
2
+ import { s as streamHttp, r as require$$1 } from "./index-BvK-G6B1.es.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -24305,7 +24305,7 @@ const _SuperConverter = class _SuperConverter2 {
24305
24305
  return;
24306
24306
  }
24307
24307
  }
24308
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.6-next.4") {
24308
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.6-next.5") {
24309
24309
  const customLocation = "docProps/custom.xml";
24310
24310
  if (!docx[customLocation]) {
24311
24311
  docx[customLocation] = generateCustomXml();
@@ -24781,7 +24781,7 @@ function storeSuperdocVersion(docx) {
24781
24781
  function generateCustomXml() {
24782
24782
  return DEFAULT_CUSTOM_XML;
24783
24783
  }
24784
- function generateSuperdocVersion(pid = 2, version2 = "0.14.6-next.4") {
24784
+ function generateSuperdocVersion(pid = 2, version2 = "0.14.6-next.5") {
24785
24785
  return {
24786
24786
  type: "element",
24787
24787
  name: "property",
@@ -40997,33 +40997,46 @@ const processTables = ({ state: state2, tr, annotationValues }) => {
40997
40997
  tables.reverse().forEach(({ pos }) => {
40998
40998
  const currentTableNode = tr.doc.nodeAt(pos);
40999
40999
  if (!currentTableNode || currentTableNode.type.name !== "table") return;
41000
- generateTableIfNecessary({ tableNode: { node: currentTableNode, pos }, annotationValues, tr, state: state2 });
41000
+ try {
41001
+ generateTableIfNecessary({ tableNode: { node: currentTableNode, pos }, annotationValues, tr, state: state2 });
41002
+ } catch (error) {
41003
+ console.error("Error generating table at pos", pos, ":", error);
41004
+ }
41001
41005
  });
41002
41006
  return tr;
41003
41007
  };
41004
41008
  const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: state2 }) => {
41005
- let rowNodeToGenerate = null;
41006
- let currentRow = null;
41007
41009
  const {
41008
41010
  tableRow: RowType,
41009
41011
  tableCell: CellType,
41010
41012
  fieldAnnotation: FieldType,
41011
41013
  paragraph: ParaType
41012
41014
  } = state2.schema.nodes;
41015
+ const rows = [];
41013
41016
  tableNode.node.descendants((node2, pos) => {
41014
- if (rowNodeToGenerate) return true;
41015
- if (node2.type === RowType) currentRow = { node: node2, pos };
41016
- if (node2.type === FieldType) {
41017
- const annotationValue = getAnnotationValue(node2.attrs.fieldId, annotationValues);
41018
- if (Array.isArray(annotationValue) && node2.attrs.generatorIndex === null) {
41019
- rowNodeToGenerate = currentRow;
41020
- }
41017
+ if (node2.type === RowType) {
41018
+ rows.push({ node: node2, pos });
41021
41019
  }
41022
41020
  });
41021
+ let rowNodeToGenerate = null;
41022
+ for (const row of rows) {
41023
+ let hasArrayAnnotation = false;
41024
+ row.node.descendants((node2, pos) => {
41025
+ if (node2.type === FieldType) {
41026
+ const annotationValue = getAnnotationValue(node2.attrs.fieldId, annotationValues);
41027
+ if (Array.isArray(annotationValue) && node2.attrs.generatorIndex === null) {
41028
+ hasArrayAnnotation = true;
41029
+ }
41030
+ }
41031
+ });
41032
+ if (hasArrayAnnotation) {
41033
+ rowNodeToGenerate = row;
41034
+ break;
41035
+ }
41036
+ }
41023
41037
  if (!rowNodeToGenerate) return;
41024
41038
  const { node: rowNode, pos: rowStartPos } = rowNodeToGenerate;
41025
- const absoluteRowStart = tr.mapping.map(tableNode.pos + rowStartPos);
41026
- const absoluteRowEnd = absoluteRowStart + rowNode.nodeSize;
41039
+ const absoluteRowStart = tableNode.pos + 1 + rowStartPos;
41027
41040
  let rowsToGenerate = 0;
41028
41041
  rowNode.descendants((childNode, childPos) => {
41029
41042
  if (childNode.type === FieldType) {
@@ -41034,34 +41047,112 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
41034
41047
  }
41035
41048
  });
41036
41049
  if (rowsToGenerate <= 1) return;
41050
+ const validateAttributes = (attrs) => {
41051
+ const cleaned = {};
41052
+ for (const [key, value] of Object.entries(attrs)) {
41053
+ if (value !== void 0 && value !== null) {
41054
+ if (key === "displayLabel") {
41055
+ cleaned[key] = String(value);
41056
+ } else if (key === "rawHtml" || key === "linkUrl" || key === "imageSrc") {
41057
+ cleaned[key] = String(value);
41058
+ } else if (typeof value === "string" && value.length > 0) {
41059
+ cleaned[key] = value;
41060
+ } else if (typeof value !== "string") {
41061
+ cleaned[key] = value;
41062
+ }
41063
+ }
41064
+ }
41065
+ return cleaned;
41066
+ };
41037
41067
  const rebuildCell = (cellNode, rowIndex) => {
41038
- const updatedBlocks = cellNode.content.content.map((blockNode) => {
41039
- if (blockNode.type !== ParaType) return blockNode;
41040
- const updatedInlines = blockNode.content.content.map((inlineNode) => {
41041
- if (inlineNode.type !== FieldType) return inlineNode;
41042
- let matchedAnnotationValues = getAnnotationValue(inlineNode.attrs.fieldId, annotationValues);
41043
- if (!Array.isArray(matchedAnnotationValues)) matchedAnnotationValues = [matchedAnnotationValues];
41044
- const value = matchedAnnotationValues?.[rowIndex];
41045
- const extraAttrs = getFieldAttrs(inlineNode, value);
41046
- return FieldType.create(
41047
- { ...inlineNode.attrs, ...extraAttrs, generatorIndex: rowIndex },
41048
- inlineNode.content,
41049
- inlineNode.marks
41050
- );
41068
+ try {
41069
+ const updatedBlocks = cellNode.content.content.map((blockNode) => {
41070
+ if (blockNode.type !== ParaType) return blockNode;
41071
+ const updatedInlines = blockNode.content.content.map((inlineNode) => {
41072
+ if (inlineNode.type !== FieldType) return inlineNode;
41073
+ let matchedAnnotationValues = getAnnotationValue(inlineNode.attrs.fieldId, annotationValues);
41074
+ if (!Array.isArray(matchedAnnotationValues)) {
41075
+ matchedAnnotationValues = [matchedAnnotationValues];
41076
+ }
41077
+ const value = matchedAnnotationValues[rowIndex];
41078
+ let extraAttrs = {};
41079
+ try {
41080
+ const rawExtraAttrs = getFieldAttrs(inlineNode, value, null);
41081
+ extraAttrs = validateAttributes(rawExtraAttrs || {});
41082
+ } catch (error) {
41083
+ console.error("Error getting field attrs:", error);
41084
+ extraAttrs = {};
41085
+ }
41086
+ const baseAttrs = validateAttributes(inlineNode.attrs || {});
41087
+ const newAttrs = {
41088
+ ...baseAttrs,
41089
+ ...extraAttrs,
41090
+ generatorIndex: rowIndex
41091
+ };
41092
+ try {
41093
+ return FieldType.create(
41094
+ newAttrs,
41095
+ inlineNode.content || Fragment.empty,
41096
+ inlineNode.marks || []
41097
+ );
41098
+ } catch (error) {
41099
+ console.error("Error creating field node:", error);
41100
+ try {
41101
+ const fallbackAttrs = {
41102
+ ...baseAttrs,
41103
+ generatorIndex: rowIndex,
41104
+ displayLabel: String(value || "")
41105
+ };
41106
+ return FieldType.create(
41107
+ validateAttributes(fallbackAttrs),
41108
+ inlineNode.content || Fragment.empty,
41109
+ inlineNode.marks || []
41110
+ );
41111
+ } catch (fallbackError) {
41112
+ console.error("Fallback also failed:", fallbackError);
41113
+ return inlineNode;
41114
+ }
41115
+ }
41116
+ });
41117
+ try {
41118
+ return ParaType.create(
41119
+ validateAttributes(blockNode.attrs || {}),
41120
+ Fragment.from(updatedInlines),
41121
+ blockNode.marks || []
41122
+ );
41123
+ } catch (error) {
41124
+ console.error("Error creating paragraph node:", error);
41125
+ return blockNode;
41126
+ }
41051
41127
  });
41052
- return ParaType.create(blockNode.attrs, Fragment.from(updatedInlines), blockNode.marks);
41053
- });
41054
- return CellType.create(cellNode.attrs, Fragment.from(updatedBlocks), cellNode.marks);
41128
+ return CellType.create(
41129
+ validateAttributes(cellNode.attrs || {}),
41130
+ Fragment.from(updatedBlocks),
41131
+ cellNode.marks || []
41132
+ );
41133
+ } catch (error) {
41134
+ console.error(`Failed to rebuild cell for row ${rowIndex}:`, error);
41135
+ throw error;
41136
+ }
41055
41137
  };
41056
- for (let rowIndex = rowsToGenerate - 1; rowIndex >= 0; rowIndex--) {
41057
- const mappedInsertPos = tr.mapping.map(absoluteRowEnd) + 1;
41058
- const newCells = rowNode.content.content.map((cellNode) => rebuildCell(cellNode, rowIndex));
41059
- const newRow = RowType.create(rowNode.attrs, Fragment.from(newCells), rowNode.marks);
41060
- tr.insert(mappedInsertPos, Fragment.from(newRow));
41138
+ try {
41139
+ const newRows = [];
41140
+ for (let rowIndex = 0; rowIndex < rowsToGenerate; rowIndex++) {
41141
+ const newCells = rowNode.content.content.map((cellNode) => rebuildCell(cellNode, rowIndex));
41142
+ const newRow = RowType.create(
41143
+ validateAttributes(rowNode.attrs || {}),
41144
+ Fragment.from(newCells),
41145
+ rowNode.marks || []
41146
+ );
41147
+ newRows.push(newRow);
41148
+ }
41149
+ const mappedRowStart = tr.mapping.map(absoluteRowStart);
41150
+ const rowEnd = mappedRowStart + rowNode.nodeSize;
41151
+ tr.replaceWith(mappedRowStart, rowEnd, Fragment.from(newRows));
41152
+ } catch (error) {
41153
+ console.error("Error during row generation:", error);
41154
+ throw error;
41061
41155
  }
41062
- const mappedDeleteStart = tr.mapping.map(absoluteRowStart);
41063
- const mappedDeleteEnd = mappedDeleteStart + rowNode.nodeSize;
41064
- tr.delete(mappedDeleteStart - 1, mappedDeleteEnd + 1);
41065
41156
  };
41066
41157
  const getAnnotationValue = (id, annotationValues) => {
41067
41158
  return annotationValues.find((value) => value.input_id === id)?.input_value || null;
@@ -42385,7 +42476,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
42385
42476
  * @returns {Object | void} Migration results
42386
42477
  */
42387
42478
  processCollaborationMigrations() {
42388
- console.debug("[checkVersionMigrations] Current editor version", "0.14.6-next.4");
42479
+ console.debug("[checkVersionMigrations] Current editor version", "0.14.6-next.5");
42389
42480
  if (!this.options.ydoc) return;
42390
42481
  const metaMap = this.options.ydoc.getMap("meta");
42391
42482
  let docVersion = metaMap.get("version");
@@ -24322,7 +24322,7 @@ const _SuperConverter = class _SuperConverter2 {
24322
24322
  return;
24323
24323
  }
24324
24324
  }
24325
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.6-next.4") {
24325
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.6-next.5") {
24326
24326
  const customLocation = "docProps/custom.xml";
24327
24327
  if (!docx[customLocation]) {
24328
24328
  docx[customLocation] = generateCustomXml();
@@ -24798,7 +24798,7 @@ function storeSuperdocVersion(docx) {
24798
24798
  function generateCustomXml() {
24799
24799
  return DEFAULT_CUSTOM_XML;
24800
24800
  }
24801
- function generateSuperdocVersion(pid = 2, version2 = "0.14.6-next.4") {
24801
+ function generateSuperdocVersion(pid = 2, version2 = "0.14.6-next.5") {
24802
24802
  return {
24803
24803
  type: "element",
24804
24804
  name: "property",
@@ -41014,33 +41014,46 @@ const processTables = ({ state: state2, tr, annotationValues }) => {
41014
41014
  tables.reverse().forEach(({ pos }) => {
41015
41015
  const currentTableNode = tr.doc.nodeAt(pos);
41016
41016
  if (!currentTableNode || currentTableNode.type.name !== "table") return;
41017
- generateTableIfNecessary({ tableNode: { node: currentTableNode, pos }, annotationValues, tr, state: state2 });
41017
+ try {
41018
+ generateTableIfNecessary({ tableNode: { node: currentTableNode, pos }, annotationValues, tr, state: state2 });
41019
+ } catch (error) {
41020
+ console.error("Error generating table at pos", pos, ":", error);
41021
+ }
41018
41022
  });
41019
41023
  return tr;
41020
41024
  };
41021
41025
  const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: state2 }) => {
41022
- let rowNodeToGenerate = null;
41023
- let currentRow = null;
41024
41026
  const {
41025
41027
  tableRow: RowType,
41026
41028
  tableCell: CellType,
41027
41029
  fieldAnnotation: FieldType,
41028
41030
  paragraph: ParaType
41029
41031
  } = state2.schema.nodes;
41032
+ const rows = [];
41030
41033
  tableNode.node.descendants((node2, pos) => {
41031
- if (rowNodeToGenerate) return true;
41032
- if (node2.type === RowType) currentRow = { node: node2, pos };
41033
- if (node2.type === FieldType) {
41034
- const annotationValue = getAnnotationValue(node2.attrs.fieldId, annotationValues);
41035
- if (Array.isArray(annotationValue) && node2.attrs.generatorIndex === null) {
41036
- rowNodeToGenerate = currentRow;
41037
- }
41034
+ if (node2.type === RowType) {
41035
+ rows.push({ node: node2, pos });
41038
41036
  }
41039
41037
  });
41038
+ let rowNodeToGenerate = null;
41039
+ for (const row of rows) {
41040
+ let hasArrayAnnotation = false;
41041
+ row.node.descendants((node2, pos) => {
41042
+ if (node2.type === FieldType) {
41043
+ const annotationValue = getAnnotationValue(node2.attrs.fieldId, annotationValues);
41044
+ if (Array.isArray(annotationValue) && node2.attrs.generatorIndex === null) {
41045
+ hasArrayAnnotation = true;
41046
+ }
41047
+ }
41048
+ });
41049
+ if (hasArrayAnnotation) {
41050
+ rowNodeToGenerate = row;
41051
+ break;
41052
+ }
41053
+ }
41040
41054
  if (!rowNodeToGenerate) return;
41041
41055
  const { node: rowNode, pos: rowStartPos } = rowNodeToGenerate;
41042
- const absoluteRowStart = tr.mapping.map(tableNode.pos + rowStartPos);
41043
- const absoluteRowEnd = absoluteRowStart + rowNode.nodeSize;
41056
+ const absoluteRowStart = tableNode.pos + 1 + rowStartPos;
41044
41057
  let rowsToGenerate = 0;
41045
41058
  rowNode.descendants((childNode, childPos) => {
41046
41059
  if (childNode.type === FieldType) {
@@ -41051,34 +41064,112 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
41051
41064
  }
41052
41065
  });
41053
41066
  if (rowsToGenerate <= 1) return;
41067
+ const validateAttributes = (attrs) => {
41068
+ const cleaned = {};
41069
+ for (const [key, value] of Object.entries(attrs)) {
41070
+ if (value !== void 0 && value !== null) {
41071
+ if (key === "displayLabel") {
41072
+ cleaned[key] = String(value);
41073
+ } else if (key === "rawHtml" || key === "linkUrl" || key === "imageSrc") {
41074
+ cleaned[key] = String(value);
41075
+ } else if (typeof value === "string" && value.length > 0) {
41076
+ cleaned[key] = value;
41077
+ } else if (typeof value !== "string") {
41078
+ cleaned[key] = value;
41079
+ }
41080
+ }
41081
+ }
41082
+ return cleaned;
41083
+ };
41054
41084
  const rebuildCell = (cellNode, rowIndex) => {
41055
- const updatedBlocks = cellNode.content.content.map((blockNode) => {
41056
- if (blockNode.type !== ParaType) return blockNode;
41057
- const updatedInlines = blockNode.content.content.map((inlineNode) => {
41058
- if (inlineNode.type !== FieldType) return inlineNode;
41059
- let matchedAnnotationValues = getAnnotationValue(inlineNode.attrs.fieldId, annotationValues);
41060
- if (!Array.isArray(matchedAnnotationValues)) matchedAnnotationValues = [matchedAnnotationValues];
41061
- const value = matchedAnnotationValues?.[rowIndex];
41062
- const extraAttrs = getFieldAttrs(inlineNode, value);
41063
- return FieldType.create(
41064
- { ...inlineNode.attrs, ...extraAttrs, generatorIndex: rowIndex },
41065
- inlineNode.content,
41066
- inlineNode.marks
41067
- );
41085
+ try {
41086
+ const updatedBlocks = cellNode.content.content.map((blockNode) => {
41087
+ if (blockNode.type !== ParaType) return blockNode;
41088
+ const updatedInlines = blockNode.content.content.map((inlineNode) => {
41089
+ if (inlineNode.type !== FieldType) return inlineNode;
41090
+ let matchedAnnotationValues = getAnnotationValue(inlineNode.attrs.fieldId, annotationValues);
41091
+ if (!Array.isArray(matchedAnnotationValues)) {
41092
+ matchedAnnotationValues = [matchedAnnotationValues];
41093
+ }
41094
+ const value = matchedAnnotationValues[rowIndex];
41095
+ let extraAttrs = {};
41096
+ try {
41097
+ const rawExtraAttrs = getFieldAttrs(inlineNode, value, null);
41098
+ extraAttrs = validateAttributes(rawExtraAttrs || {});
41099
+ } catch (error) {
41100
+ console.error("Error getting field attrs:", error);
41101
+ extraAttrs = {};
41102
+ }
41103
+ const baseAttrs = validateAttributes(inlineNode.attrs || {});
41104
+ const newAttrs = {
41105
+ ...baseAttrs,
41106
+ ...extraAttrs,
41107
+ generatorIndex: rowIndex
41108
+ };
41109
+ try {
41110
+ return FieldType.create(
41111
+ newAttrs,
41112
+ inlineNode.content || Fragment.empty,
41113
+ inlineNode.marks || []
41114
+ );
41115
+ } catch (error) {
41116
+ console.error("Error creating field node:", error);
41117
+ try {
41118
+ const fallbackAttrs = {
41119
+ ...baseAttrs,
41120
+ generatorIndex: rowIndex,
41121
+ displayLabel: String(value || "")
41122
+ };
41123
+ return FieldType.create(
41124
+ validateAttributes(fallbackAttrs),
41125
+ inlineNode.content || Fragment.empty,
41126
+ inlineNode.marks || []
41127
+ );
41128
+ } catch (fallbackError) {
41129
+ console.error("Fallback also failed:", fallbackError);
41130
+ return inlineNode;
41131
+ }
41132
+ }
41133
+ });
41134
+ try {
41135
+ return ParaType.create(
41136
+ validateAttributes(blockNode.attrs || {}),
41137
+ Fragment.from(updatedInlines),
41138
+ blockNode.marks || []
41139
+ );
41140
+ } catch (error) {
41141
+ console.error("Error creating paragraph node:", error);
41142
+ return blockNode;
41143
+ }
41068
41144
  });
41069
- return ParaType.create(blockNode.attrs, Fragment.from(updatedInlines), blockNode.marks);
41070
- });
41071
- return CellType.create(cellNode.attrs, Fragment.from(updatedBlocks), cellNode.marks);
41145
+ return CellType.create(
41146
+ validateAttributes(cellNode.attrs || {}),
41147
+ Fragment.from(updatedBlocks),
41148
+ cellNode.marks || []
41149
+ );
41150
+ } catch (error) {
41151
+ console.error(`Failed to rebuild cell for row ${rowIndex}:`, error);
41152
+ throw error;
41153
+ }
41072
41154
  };
41073
- for (let rowIndex = rowsToGenerate - 1; rowIndex >= 0; rowIndex--) {
41074
- const mappedInsertPos = tr.mapping.map(absoluteRowEnd) + 1;
41075
- const newCells = rowNode.content.content.map((cellNode) => rebuildCell(cellNode, rowIndex));
41076
- const newRow = RowType.create(rowNode.attrs, Fragment.from(newCells), rowNode.marks);
41077
- tr.insert(mappedInsertPos, Fragment.from(newRow));
41155
+ try {
41156
+ const newRows = [];
41157
+ for (let rowIndex = 0; rowIndex < rowsToGenerate; rowIndex++) {
41158
+ const newCells = rowNode.content.content.map((cellNode) => rebuildCell(cellNode, rowIndex));
41159
+ const newRow = RowType.create(
41160
+ validateAttributes(rowNode.attrs || {}),
41161
+ Fragment.from(newCells),
41162
+ rowNode.marks || []
41163
+ );
41164
+ newRows.push(newRow);
41165
+ }
41166
+ const mappedRowStart = tr.mapping.map(absoluteRowStart);
41167
+ const rowEnd = mappedRowStart + rowNode.nodeSize;
41168
+ tr.replaceWith(mappedRowStart, rowEnd, Fragment.from(newRows));
41169
+ } catch (error) {
41170
+ console.error("Error during row generation:", error);
41171
+ throw error;
41078
41172
  }
41079
- const mappedDeleteStart = tr.mapping.map(absoluteRowStart);
41080
- const mappedDeleteEnd = mappedDeleteStart + rowNode.nodeSize;
41081
- tr.delete(mappedDeleteStart - 1, mappedDeleteEnd + 1);
41082
41173
  };
41083
41174
  const getAnnotationValue = (id, annotationValues) => {
41084
41175
  return annotationValues.find((value) => value.input_id === id)?.input_value || null;
@@ -42402,7 +42493,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
42402
42493
  * @returns {Object | void} Migration results
42403
42494
  */
42404
42495
  processCollaborationMigrations() {
42405
- console.debug("[checkVersionMigrations] Current editor version", "0.14.6-next.4");
42496
+ console.debug("[checkVersionMigrations] Current editor version", "0.14.6-next.5");
42406
42497
  if (!this.options.ydoc) return;
42407
42498
  const metaMap = this.options.ydoc.getMap("meta");
42408
42499
  let docVersion = metaMap.get("version");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-D5XoMX4C.cjs");
3
- const xmlJs = require("./xml-js-t28wMlyv.cjs");
3
+ const xmlJs = require("./xml-js-BHJlXtfU.cjs");
4
4
  const __viteBrowserExternal = require("./__vite-browser-external-DWbQq7bv.cjs");
5
5
  var punycode$1 = { exports: {} };
6
6
  /*! https://mths.be/punycode v1.4.1 by @mathias */
@@ -1,5 +1,5 @@
1
1
  import { c as commonjsGlobal, g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./jszip-CYDYUNnI.es.js";
2
- import { t as type, g as getIntrinsic, c as callBound$2 } from "./xml-js-D78KIQHL.es.js";
2
+ import { t as type, g as getIntrinsic, c as callBound$2 } from "./xml-js-DNISVjNF.es.js";
3
3
  import { _ as __viteBrowserExternal } from "./__vite-browser-external-CURh0WXD.es.js";
4
4
  var punycode$1 = { exports: {} };
5
5
  /*! https://mths.be/punycode v1.4.1 by @mathias */
@@ -515,8 +515,15 @@ function requireHasSymbols() {
515
515
  return hasSymbols$1;
516
516
  }
517
517
  var Reflect_getPrototypeOf = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
518
- var $Object$2 = esObjectAtoms;
519
- var Object_getPrototypeOf = $Object$2.getPrototypeOf || null;
518
+ var Object_getPrototypeOf;
519
+ var hasRequiredObject_getPrototypeOf;
520
+ function requireObject_getPrototypeOf() {
521
+ if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
522
+ hasRequiredObject_getPrototypeOf = 1;
523
+ var $Object2 = esObjectAtoms;
524
+ Object_getPrototypeOf = $Object2.getPrototypeOf || null;
525
+ return Object_getPrototypeOf;
526
+ }
520
527
  var implementation;
521
528
  var hasRequiredImplementation;
522
529
  function requireImplementation() {
@@ -659,7 +666,7 @@ var get = desc && typeof desc.get === "function" ? callBind$2([desc.get]) : type
659
666
  }
660
667
  ) : false;
661
668
  var reflectGetProto = Reflect_getPrototypeOf;
662
- var originalGetProto = Object_getPrototypeOf;
669
+ var originalGetProto = requireObject_getPrototypeOf();
663
670
  var getDunderProto = get;
664
671
  var getProto$3 = reflectGetProto ? function getProto(O) {
665
672
  return reflectGetProto(O);
@@ -724,7 +731,7 @@ var ThrowTypeError = $gOPD ? function() {
724
731
  }() : throwTypeError;
725
732
  var hasSymbols2 = requireHasSymbols()();
726
733
  var getProto$2 = getProto$3;
727
- var $ObjectGPO = Object_getPrototypeOf;
734
+ var $ObjectGPO = requireObject_getPrototypeOf();
728
735
  var $ReflectGPO = Reflect_getPrototypeOf;
729
736
  var $apply$1 = requireFunctionApply();
730
737
  var $call = requireFunctionCall();
@@ -514,8 +514,15 @@ function requireHasSymbols() {
514
514
  return hasSymbols$1;
515
515
  }
516
516
  var Reflect_getPrototypeOf = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
517
- var $Object$2 = esObjectAtoms;
518
- var Object_getPrototypeOf = $Object$2.getPrototypeOf || null;
517
+ var Object_getPrototypeOf;
518
+ var hasRequiredObject_getPrototypeOf;
519
+ function requireObject_getPrototypeOf() {
520
+ if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
521
+ hasRequiredObject_getPrototypeOf = 1;
522
+ var $Object2 = esObjectAtoms;
523
+ Object_getPrototypeOf = $Object2.getPrototypeOf || null;
524
+ return Object_getPrototypeOf;
525
+ }
519
526
  var implementation;
520
527
  var hasRequiredImplementation;
521
528
  function requireImplementation() {
@@ -658,7 +665,7 @@ var get = desc && typeof desc.get === "function" ? callBind$2([desc.get]) : type
658
665
  }
659
666
  ) : false;
660
667
  var reflectGetProto = Reflect_getPrototypeOf;
661
- var originalGetProto = Object_getPrototypeOf;
668
+ var originalGetProto = requireObject_getPrototypeOf();
662
669
  var getDunderProto = get;
663
670
  var getProto$3 = reflectGetProto ? function getProto(O) {
664
671
  return reflectGetProto(O);
@@ -723,7 +730,7 @@ var ThrowTypeError = $gOPD ? function() {
723
730
  }() : throwTypeError;
724
731
  var hasSymbols2 = requireHasSymbols()();
725
732
  var getProto$2 = getProto$3;
726
- var $ObjectGPO = Object_getPrototypeOf;
733
+ var $ObjectGPO = requireObject_getPrototypeOf();
727
734
  var $ReflectGPO = Reflect_getPrototypeOf;
728
735
  var $apply$1 = requireFunctionApply();
729
736
  var $call = requireFunctionCall();
@@ -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-B6n6gLBy.js";
3
- import { _ as _export_sfc } from "./chunks/editor-BBuhT-Hl.js";
2
+ import { T as TextSelection } from "./chunks/converter-CBjKXKtl.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CUhB7mWQ.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 = {}) {
@@ -24324,7 +24324,7 @@ const _SuperConverter = class _SuperConverter {
24324
24324
  return;
24325
24325
  }
24326
24326
  }
24327
- static updateDocumentVersion(docx = this.convertedXml, version = "0.14.6-next.4") {
24327
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.14.6-next.5") {
24328
24328
  const customLocation = "docProps/custom.xml";
24329
24329
  if (!docx[customLocation]) {
24330
24330
  docx[customLocation] = generateCustomXml();
@@ -24803,7 +24803,7 @@ function storeSuperdocVersion(docx) {
24803
24803
  function generateCustomXml() {
24804
24804
  return DEFAULT_CUSTOM_XML;
24805
24805
  }
24806
- function generateSuperdocVersion(pid = 2, version = "0.14.6-next.4") {
24806
+ function generateSuperdocVersion(pid = 2, version = "0.14.6-next.5") {
24807
24807
  return {
24808
24808
  type: "element",
24809
24809
  name: "property",
@@ -1,4 +1,4 @@
1
- import { C as process$1, aa as commonjsGlobal, E as Buffer, ab as getDefaultExportFromCjs, ac as getContentTypesFromXml, ad as xmljs } from "./converter-B6n6gLBy.js";
1
+ import { C as process$1, aa as commonjsGlobal, E as Buffer, ab as getDefaultExportFromCjs, ac as getContentTypesFromXml, ad as xmljs } from "./converter-CBjKXKtl.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
  }