@harbour-enterprises/superdoc 0.29.0-next.7 → 0.29.0-next.9

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 (156) hide show
  1. package/dist/chunks/{PdfViewer-D2cnJhM1.es.js → PdfViewer-BV-ij_Jn.es.js} +2 -2
  2. package/dist/chunks/{PdfViewer-DyUG4__F.cjs → PdfViewer-DpviVXfb.cjs} +1 -1
  3. package/dist/chunks/{eventemitter3-xrnx5jJP.es.js → eventemitter3-D4gv5QOO.es.js} +1 -1
  4. package/dist/chunks/{index-DZIAPuKc.cjs → index-B5hIswvq.cjs} +164 -119
  5. package/dist/chunks/{index-DC11bH-A.es.js → index-UVpS_47e.es.js} +166 -121
  6. package/dist/chunks/{index-BqhJhdcP-Dm9pUO-L.cjs → index-sJFE-5Sw-Chv1r9bA.cjs} +1 -1
  7. package/dist/chunks/{index-BqhJhdcP-B9XbOefk.es.js → index-sJFE-5Sw-r5deiWbP.es.js} +1 -1
  8. package/dist/chunks/{jszip-9Y3n05fi.es.js → jszip-Bhl-Iudl.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-DNPslOnx.es.js → super-editor.es-C9OTu_pS.es.js} +143 -111
  10. package/dist/chunks/{super-editor.es-607cvQXw.cjs → super-editor.es-Cw1FmXd7.cjs} +141 -109
  11. package/dist/chunks/{vue-DVNiXx7E.es.js → vue-D1vcEBAQ.es.js} +17 -17
  12. package/dist/chunks/xml-js-jMPlIVKT.es.js +2 -0
  13. package/dist/packages/superdoc/src/components/CommentsLayer/comment-schemas.d.ts.map +1 -0
  14. package/dist/packages/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts.map +1 -0
  15. package/dist/packages/superdoc/src/components/CommentsLayer/helpers.d.ts.map +1 -0
  16. package/dist/packages/superdoc/src/components/CommentsLayer/types.d.ts.map +1 -0
  17. package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -0
  18. package/dist/packages/superdoc/src/components/CommentsLayer/use-conversation.d.ts.map +1 -0
  19. package/dist/packages/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts.map +1 -0
  20. package/dist/packages/superdoc/src/components/PdfViewer/helpers/range.d.ts.map +1 -0
  21. package/dist/packages/superdoc/src/components/PdfViewer/helpers/read-file.d.ts.map +1 -0
  22. package/dist/packages/superdoc/src/components/PdfViewer/pdf/pdf-adapter.d.ts.map +1 -0
  23. package/dist/packages/superdoc/src/composables/use-ai.d.ts.map +1 -0
  24. package/dist/packages/superdoc/src/composables/use-document.d.ts.map +1 -0
  25. package/dist/packages/superdoc/src/composables/use-field.d.ts.map +1 -0
  26. package/dist/packages/superdoc/src/composables/use-high-contrast-mode.d.ts.map +1 -0
  27. package/dist/packages/superdoc/src/composables/use-selected-text.d.ts.map +1 -0
  28. package/dist/{core → packages/superdoc/src/core}/SuperDoc.d.ts +1 -1
  29. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -0
  30. package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts.map +1 -0
  31. package/dist/packages/superdoc/src/core/collaboration/collaboration.d.ts.map +1 -0
  32. package/dist/packages/superdoc/src/core/collaboration/helpers.d.ts.map +1 -0
  33. package/dist/packages/superdoc/src/core/collaboration/permissions.d.ts.map +1 -0
  34. package/dist/packages/superdoc/src/core/create-app.d.ts.map +1 -0
  35. package/dist/packages/superdoc/src/core/helpers/export.d.ts.map +1 -0
  36. package/dist/packages/superdoc/src/core/helpers/file.d.ts.map +1 -0
  37. package/dist/{core → packages/superdoc/src/core}/index.d.ts.map +1 -1
  38. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -0
  39. package/dist/packages/superdoc/src/helpers/floor.d.ts.map +1 -0
  40. package/dist/packages/superdoc/src/helpers/group-changes.d.ts.map +1 -0
  41. package/dist/packages/superdoc/src/helpers/use-selection.d.ts.map +1 -0
  42. package/dist/{icons.d.ts.map → packages/superdoc/src/icons.d.ts.map} +1 -1
  43. package/dist/{index.d.ts → packages/superdoc/src/index.d.ts} +5 -5
  44. package/dist/packages/superdoc/src/index.d.ts.map +1 -0
  45. package/dist/packages/superdoc/src/main.d.ts.map +1 -0
  46. package/dist/{stores → packages/superdoc/src/stores}/comments-store.d.ts +36 -36
  47. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -0
  48. package/dist/packages/superdoc/src/stores/hrbr-fields-store.d.ts.map +1 -0
  49. package/dist/{stores → packages/superdoc/src/stores}/superdoc-store.d.ts +110 -110
  50. package/dist/{stores → packages/superdoc/src/stores}/superdoc-store.d.ts.map +1 -1
  51. package/dist/{super-editor.d.ts.map → packages/superdoc/src/super-editor.d.ts.map} +1 -1
  52. package/dist/shared/common/Telemetry.d.ts +237 -0
  53. package/dist/shared/common/Telemetry.d.ts.map +1 -0
  54. package/dist/shared/common/collaboration/awareness.d.ts +39 -0
  55. package/dist/shared/common/collaboration/awareness.d.ts.map +1 -0
  56. package/dist/shared/common/document-types.d.ts +10 -0
  57. package/dist/shared/common/document-types.d.ts.map +1 -0
  58. package/dist/shared/common/event-types.d.ts +14 -0
  59. package/dist/shared/common/event-types.d.ts.map +1 -0
  60. package/dist/shared/common/helpers/compare-superdoc-versions.d.ts +8 -0
  61. package/dist/shared/common/helpers/compare-superdoc-versions.d.ts.map +1 -0
  62. package/dist/shared/common/helpers/get-file-object.d.ts +50 -0
  63. package/dist/shared/common/helpers/get-file-object.d.ts.map +1 -0
  64. package/dist/shared/common/helpers/v-click-outside.d.ts +11 -0
  65. package/dist/shared/common/helpers/v-click-outside.d.ts.map +1 -0
  66. package/dist/shared/common/index.d.ts +10 -0
  67. package/dist/shared/common/index.d.ts.map +1 -0
  68. package/dist/shared/common/key-transform.d.ts +44 -0
  69. package/dist/shared/common/key-transform.d.ts.map +1 -0
  70. package/dist/style.css +56 -56
  71. package/dist/super-editor/ai-writer.es.js +3 -3
  72. package/dist/super-editor/chunks/{converter--SREdiqQ.js → converter-D6qfGG_6.js} +329 -51
  73. package/dist/super-editor/chunks/{docx-zipper-BRGsc2Y2.js → docx-zipper-BqmHhBsY.js} +1 -1
  74. package/dist/super-editor/chunks/{editor-DsKLhlKe.js → editor-5q11lIMq.js} +4 -4
  75. package/dist/super-editor/chunks/{index-BqhJhdcP.js → index-sJFE-5Sw.js} +1 -1
  76. package/dist/super-editor/chunks/{toolbar-Dqed7MP7.js → toolbar-BV-1nlen.js} +2 -2
  77. package/dist/super-editor/converter.es.js +1 -2
  78. package/dist/super-editor/docx-zipper.es.js +2 -2
  79. package/dist/super-editor/editor.es.js +3 -3
  80. package/dist/super-editor/file-zipper.es.js +1 -1
  81. package/dist/super-editor/style.css +29 -29
  82. package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts.map +1 -1
  83. package/dist/super-editor/super-editor/src/index.d.ts +0 -1
  84. package/dist/super-editor/super-editor/src/index.d.ts.map +1 -1
  85. package/dist/super-editor/super-editor.es.js +77 -50
  86. package/dist/super-editor/toolbar.es.js +2 -2
  87. package/dist/super-editor.cjs +3 -3
  88. package/dist/super-editor.es.js +2 -2
  89. package/dist/superdoc.cjs +2 -3
  90. package/dist/superdoc.es.js +2 -3
  91. package/dist/superdoc.umd.js +44218 -44141
  92. package/dist/superdoc.umd.js.map +1 -1
  93. package/package.json +3 -3
  94. package/dist/chunks/xml-js-ByyNjzYS.es.js +0 -2
  95. package/dist/components/CommentsLayer/comment-schemas.d.ts.map +0 -1
  96. package/dist/components/CommentsLayer/commentsList/super-comments-list.d.ts.map +0 -1
  97. package/dist/components/CommentsLayer/helpers.d.ts.map +0 -1
  98. package/dist/components/CommentsLayer/types.d.ts.map +0 -1
  99. package/dist/components/CommentsLayer/use-comment.d.ts.map +0 -1
  100. package/dist/components/CommentsLayer/use-conversation.d.ts.map +0 -1
  101. package/dist/components/CommentsLayer/use-floating-comment.d.ts.map +0 -1
  102. package/dist/components/PdfViewer/helpers/range.d.ts.map +0 -1
  103. package/dist/components/PdfViewer/helpers/read-file.d.ts.map +0 -1
  104. package/dist/components/PdfViewer/pdf/pdf-adapter.d.ts.map +0 -1
  105. package/dist/composables/use-ai.d.ts.map +0 -1
  106. package/dist/composables/use-document.d.ts.map +0 -1
  107. package/dist/composables/use-field.d.ts.map +0 -1
  108. package/dist/composables/use-high-contrast-mode.d.ts.map +0 -1
  109. package/dist/composables/use-selected-text.d.ts.map +0 -1
  110. package/dist/core/SuperDoc.d.ts.map +0 -1
  111. package/dist/core/collaboration/collaboration-comments.d.ts.map +0 -1
  112. package/dist/core/collaboration/collaboration.d.ts.map +0 -1
  113. package/dist/core/collaboration/helpers.d.ts.map +0 -1
  114. package/dist/core/collaboration/permissions.d.ts.map +0 -1
  115. package/dist/core/create-app.d.ts.map +0 -1
  116. package/dist/core/helpers/export.d.ts.map +0 -1
  117. package/dist/core/helpers/file.d.ts.map +0 -1
  118. package/dist/core/types/index.d.ts.map +0 -1
  119. package/dist/helpers/floor.d.ts.map +0 -1
  120. package/dist/helpers/group-changes.d.ts.map +0 -1
  121. package/dist/helpers/use-selection.d.ts.map +0 -1
  122. package/dist/index.d.ts.map +0 -1
  123. package/dist/main.d.ts.map +0 -1
  124. package/dist/stores/comments-store.d.ts.map +0 -1
  125. package/dist/stores/hrbr-fields-store.d.ts.map +0 -1
  126. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/comment-schemas.d.ts +0 -0
  127. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/commentsList/super-comments-list.d.ts +0 -0
  128. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/helpers.d.ts +0 -0
  129. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/types.d.ts +0 -0
  130. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-comment.d.ts +0 -0
  131. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-conversation.d.ts +0 -0
  132. /package/dist/{components → packages/superdoc/src/components}/CommentsLayer/use-floating-comment.d.ts +0 -0
  133. /package/dist/{components → packages/superdoc/src/components}/PdfViewer/helpers/range.d.ts +0 -0
  134. /package/dist/{components → packages/superdoc/src/components}/PdfViewer/helpers/read-file.d.ts +0 -0
  135. /package/dist/{components → packages/superdoc/src/components}/PdfViewer/pdf/pdf-adapter.d.ts +0 -0
  136. /package/dist/{composables → packages/superdoc/src/composables}/use-ai.d.ts +0 -0
  137. /package/dist/{composables → packages/superdoc/src/composables}/use-document.d.ts +0 -0
  138. /package/dist/{composables → packages/superdoc/src/composables}/use-field.d.ts +0 -0
  139. /package/dist/{composables → packages/superdoc/src/composables}/use-high-contrast-mode.d.ts +0 -0
  140. /package/dist/{composables → packages/superdoc/src/composables}/use-selected-text.d.ts +0 -0
  141. /package/dist/{core → packages/superdoc/src/core}/collaboration/collaboration-comments.d.ts +0 -0
  142. /package/dist/{core → packages/superdoc/src/core}/collaboration/collaboration.d.ts +0 -0
  143. /package/dist/{core → packages/superdoc/src/core}/collaboration/helpers.d.ts +0 -0
  144. /package/dist/{core → packages/superdoc/src/core}/collaboration/permissions.d.ts +0 -0
  145. /package/dist/{core → packages/superdoc/src/core}/create-app.d.ts +0 -0
  146. /package/dist/{core → packages/superdoc/src/core}/helpers/export.d.ts +0 -0
  147. /package/dist/{core → packages/superdoc/src/core}/helpers/file.d.ts +0 -0
  148. /package/dist/{core → packages/superdoc/src/core}/index.d.ts +0 -0
  149. /package/dist/{core → packages/superdoc/src/core}/types/index.d.ts +0 -0
  150. /package/dist/{helpers → packages/superdoc/src/helpers}/floor.d.ts +0 -0
  151. /package/dist/{helpers → packages/superdoc/src/helpers}/group-changes.d.ts +0 -0
  152. /package/dist/{helpers → packages/superdoc/src/helpers}/use-selection.d.ts +0 -0
  153. /package/dist/{icons.d.ts → packages/superdoc/src/icons.d.ts} +0 -0
  154. /package/dist/{main.d.ts → packages/superdoc/src/main.d.ts} +0 -0
  155. /package/dist/{stores → packages/superdoc/src/stores}/hrbr-fields-store.d.ts +0 -0
  156. /package/dist/{super-editor.d.ts → packages/superdoc/src/super-editor.d.ts} +0 -0
@@ -8,7 +8,6 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
8
8
  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);
9
9
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
10
10
  var _a, _DocxExporter_instances, generate_xml_as_list_fn, replaceSpecialCharacters_fn, generateXml_fn, _SuperConverter_instances, generateDocumentHash_fn, exportNumberingFile_fn, prepareCommentsXmlFilesForExport_fn, exportProcessHeadersFooters_fn, exportProcessNewRelationships_fn, exportProcessMediaFiles_fn;
11
- import { createElementBlock, openBlock, createElementVNode } from "vue";
12
11
  var buffer = {};
13
12
  var base64Js = {};
14
13
  base64Js.byteLength = byteLength;
@@ -33127,72 +33126,351 @@ const DocxHelpers = {
33127
33126
  getNewRelationshipId
33128
33127
  };
33129
33128
  const kebabCase = (str) => str.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
33130
- const comments_module_events = Object.freeze({
33131
- RESOLVED: "resolved",
33132
- NEW: "new",
33129
+ const comments_module_events = {
33133
33130
  ADD: "add",
33134
33131
  UPDATE: "update",
33135
- DELETED: "deleted",
33136
- PENDING: "pending",
33137
- SELECTED: "selected",
33138
- // Comments list
33139
- COMMENTS_LIST: "comments-list",
33140
- // Tracked changes
33141
- CHANGE_ACCEPTED: "change-accepted",
33142
- CHANGE_REJECTED: "change-rejected"
33143
- });
33132
+ SELECTED: "selected"
33133
+ };
33134
+ class FileObjectError extends Error {
33135
+ constructor(message, cause) {
33136
+ super(message);
33137
+ this.cause = cause;
33138
+ this.name = "FileObjectError";
33139
+ if (typeof Error.captureStackTrace === "function") {
33140
+ Error.captureStackTrace(this, FileObjectError);
33141
+ }
33142
+ }
33143
+ }
33144
+ class InvalidDataUriError extends FileObjectError {
33145
+ constructor(uri2) {
33146
+ super(`Invalid data URI format: URI must contain exactly one comma separator`);
33147
+ this.uri = uri2;
33148
+ this.name = "InvalidDataUriError";
33149
+ }
33150
+ }
33151
+ class FetchFailedError extends FileObjectError {
33152
+ constructor(url, cause) {
33153
+ super(`Failed to fetch file from URL: ${url}`, cause);
33154
+ this.url = url;
33155
+ this.name = "FetchFailedError";
33156
+ }
33157
+ }
33144
33158
  const getFileObject = async (fileUrl, name, type2) => {
33145
- if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
33146
- const binary = atob(fileUrl.split(",")[1]);
33147
- const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
33148
- return new File([bytes], name, { type: type2 });
33159
+ try {
33160
+ if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
33161
+ const parts = fileUrl.split(",");
33162
+ if (parts.length !== 2) {
33163
+ throw new InvalidDataUriError(fileUrl);
33164
+ }
33165
+ const binary = atob(parts[1]);
33166
+ const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
33167
+ return new File([bytes], name, { type: type2 });
33168
+ }
33169
+ const response = await fetch(fileUrl);
33170
+ if (!response.ok) {
33171
+ throw new FetchFailedError(fileUrl, new Error(`HTTP ${response.status}: ${response.statusText}`));
33172
+ }
33173
+ const blob = await response.blob();
33174
+ return new File([blob], name, { type: type2 });
33175
+ } catch (error) {
33176
+ if (error instanceof FileObjectError) {
33177
+ throw error;
33178
+ }
33179
+ throw new FileObjectError("Failed to create file object", error);
33149
33180
  }
33150
- const response = await fetch(fileUrl);
33151
- const blob = await response.blob();
33152
- return new File([blob], name, { type: type2 });
33153
33181
  };
33154
33182
  const vClickOutside = {
33155
33183
  mounted(el, binding) {
33156
33184
  const clickOutsideHandler = (event) => {
33157
33185
  if (!el.contains(event.target)) {
33158
- binding.value(event);
33186
+ binding.value?.(event);
33159
33187
  }
33160
33188
  };
33161
33189
  document.addEventListener("click", clickOutsideHandler);
33162
33190
  el.__clickOutsideHandler = clickOutsideHandler;
33163
33191
  },
33164
33192
  unmounted(el) {
33165
- document.removeEventListener("click", el.__clickOutsideHandler);
33166
- delete el.__clickOutsideHandler;
33193
+ if (el.__clickOutsideHandler) {
33194
+ document.removeEventListener("click", el.__clickOutsideHandler);
33195
+ delete el.__clickOutsideHandler;
33196
+ }
33167
33197
  }
33168
33198
  };
33169
- const _hoisted_1 = ["accept"];
33170
- const _sfc_main = {
33171
- __name: "BasicUpload",
33172
- props: {
33173
- accept: {
33174
- type: String,
33175
- default: ".docx, .pdf, .html, .md"
33199
+ function getCrypto() {
33200
+ if (typeof globalThis === "undefined") {
33201
+ return void 0;
33202
+ }
33203
+ const cryptoObj = globalThis.crypto ?? globalThis.msCrypto;
33204
+ if (cryptoObj?.getRandomValues) {
33205
+ return cryptoObj;
33206
+ }
33207
+ return void 0;
33208
+ }
33209
+ function randomBytes(length) {
33210
+ const array = new Uint8Array(length);
33211
+ const cryptoObj = getCrypto();
33212
+ if (cryptoObj) {
33213
+ cryptoObj.getRandomValues(array);
33214
+ return array;
33215
+ }
33216
+ for (let i = 0; i < length; i++) {
33217
+ array[i] = Math.floor(Math.random() * 256);
33218
+ }
33219
+ return array;
33220
+ }
33221
+ const _Telemetry = class _Telemetry {
33222
+ /**
33223
+ * Initialize telemetry service
33224
+ * @param config - Telemetry configuration
33225
+ */
33226
+ constructor(config2) {
33227
+ this.statistics = {
33228
+ nodeTypes: {},
33229
+ markTypes: {},
33230
+ attributes: {},
33231
+ errorCount: 0
33232
+ };
33233
+ this.unknownElements = [];
33234
+ this.errors = [];
33235
+ this.fileStructure = {
33236
+ totalFiles: 0,
33237
+ maxDepth: 0,
33238
+ totalNodes: 0,
33239
+ files: []
33240
+ };
33241
+ this.documentInfo = null;
33242
+ this.enabled = config2.enabled ?? true;
33243
+ this.licenseKey = config2.licenseKey ?? _Telemetry.COMMUNITY_LICENSE_KEY;
33244
+ this.endpoint = config2.endpoint ?? _Telemetry.DEFAULT_ENDPOINT;
33245
+ this.documentGuid = config2.documentGuid;
33246
+ this.documentIdentifier = config2.documentIdentifier;
33247
+ this.superdocVersion = config2.superdocVersion;
33248
+ this.sessionId = this.generateId();
33249
+ }
33250
+ /**
33251
+ * Get browser environment information
33252
+ * @returns Browser information
33253
+ */
33254
+ getBrowserInfo() {
33255
+ return {
33256
+ userAgent: window.navigator.userAgent,
33257
+ currentUrl: window.location.href,
33258
+ hostname: window.location.hostname,
33259
+ referrerUrl: document.referrer,
33260
+ screenSize: {
33261
+ width: window.screen.width,
33262
+ height: window.screen.height
33263
+ }
33264
+ };
33265
+ }
33266
+ /**
33267
+ * Track document usage event
33268
+ * @param name - Event name (use TelemetryEventNames for standard events)
33269
+ * @param properties - Additional properties
33270
+ */
33271
+ async trackUsage(name, properties = {}) {
33272
+ if (!this.enabled) return;
33273
+ const event = {
33274
+ id: this.generateId(),
33275
+ type: "usage",
33276
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
33277
+ sessionId: this.sessionId,
33278
+ documentGuid: this.documentGuid,
33279
+ // Updated field name
33280
+ documentIdentifier: this.documentIdentifier,
33281
+ // Include both
33282
+ superdocVersion: this.superdocVersion,
33283
+ file: this.documentInfo,
33284
+ browser: this.getBrowserInfo(),
33285
+ name,
33286
+ properties
33287
+ };
33288
+ await this.sendDataToTelemetry(event);
33289
+ }
33290
+ trackStatistic(categoryOrData, legacyData) {
33291
+ let data;
33292
+ if (typeof categoryOrData === "string") {
33293
+ data = { ...legacyData, category: categoryOrData };
33294
+ } else {
33295
+ data = categoryOrData;
33296
+ }
33297
+ if (data.category === "node") {
33298
+ this.statistics.nodeTypes[data.elementName] = (this.statistics.nodeTypes[data.elementName] || 0) + 1;
33299
+ this.fileStructure.totalNodes++;
33300
+ } else if (data.category === "unknown") {
33301
+ const addedElement = this.unknownElements.find((e) => e.elementName === data.elementName);
33302
+ if (addedElement) {
33303
+ addedElement.count += 1;
33304
+ addedElement.attributes = {
33305
+ ...addedElement.attributes,
33306
+ ...data.attributes
33307
+ };
33308
+ } else {
33309
+ this.unknownElements.push({
33310
+ elementName: data.elementName,
33311
+ count: 1,
33312
+ attributes: data.attributes
33313
+ });
33314
+ }
33315
+ } else if (data.category === "error") {
33316
+ this.errors.push(data);
33317
+ this.statistics.errorCount++;
33176
33318
  }
33177
- },
33178
- emits: ["file-change"],
33179
- setup(__props, { emit: __emit }) {
33180
- const emit = __emit;
33181
- const onFileChange = (event) => {
33182
- emit("file-change", event.target.files[0]);
33319
+ if (data.category === "node" && data.marks?.length) {
33320
+ data.marks.forEach((mark) => {
33321
+ this.statistics.markTypes[mark.type] = (this.statistics.markTypes[mark.type] || 0) + 1;
33322
+ });
33323
+ }
33324
+ if (data.attributes && Object.keys(data.attributes).length) {
33325
+ const styleAttributes = [
33326
+ "textIndent",
33327
+ "textAlign",
33328
+ "spacing",
33329
+ "lineHeight",
33330
+ "indent",
33331
+ "list-style-type",
33332
+ "listLevel",
33333
+ "textStyle",
33334
+ "order",
33335
+ "lvlText",
33336
+ "lvlJc",
33337
+ "listNumberingType",
33338
+ "numId"
33339
+ ];
33340
+ Object.keys(data.attributes).forEach((attribute) => {
33341
+ if (!styleAttributes.includes(attribute)) return;
33342
+ this.statistics.attributes[attribute] = (this.statistics.attributes[attribute] || 0) + 1;
33343
+ });
33344
+ }
33345
+ }
33346
+ /**
33347
+ * Track file structure
33348
+ * @param structure - File structure information
33349
+ * @param fileSource - original file
33350
+ * @param documentId - document GUID
33351
+ * @param documentIdentifier - document identifier (GUID or hash)
33352
+ * @param internalId - document ID from settings.xml
33353
+ */
33354
+ async trackFileStructure(structure, fileSource, documentId, documentIdentifier, internalId) {
33355
+ this.fileStructure = structure;
33356
+ this.documentInfo = await this.processDocument(fileSource, {
33357
+ guid: documentId,
33358
+ // Updated parameter name
33359
+ identifier: documentIdentifier,
33360
+ // New parameter
33361
+ internalId
33362
+ });
33363
+ }
33364
+ /**
33365
+ * Process document metadata
33366
+ * @param file - Document file
33367
+ * @param options - Additional options
33368
+ * @returns Document metadata
33369
+ */
33370
+ async processDocument(file, options = {}) {
33371
+ if (!file) {
33372
+ console.warn("Telemetry: missing file source");
33373
+ return null;
33374
+ }
33375
+ return {
33376
+ guid: options.guid,
33377
+ // Updated from 'id'
33378
+ identifier: options.identifier,
33379
+ // New field
33380
+ name: file.name,
33381
+ size: file.size,
33382
+ lastModified: file.lastModified ? new Date(file.lastModified).toISOString() : null,
33383
+ type: file.type || "docx",
33384
+ internalId: options.internalId
33385
+ // Microsoft's GUID if present
33183
33386
  };
33184
- return (_ctx, _cache) => {
33185
- return openBlock(), createElementBlock("div", null, [
33186
- createElementVNode("input", {
33187
- type: "file",
33188
- id: "fileInput",
33189
- onChange: onFileChange,
33190
- accept: __props.accept
33191
- }, null, 40, _hoisted_1)
33192
- ]);
33387
+ }
33388
+ isTelemetryDataChanged() {
33389
+ if (Object.keys(this.statistics.nodeTypes).length <= 1) return false;
33390
+ return Object.keys(this.statistics.nodeTypes).length > 0 || Object.keys(this.statistics.markTypes).length > 0 || Object.keys(this.statistics.attributes).length > 0 || this.statistics.errorCount > 0 || this.fileStructure.totalFiles > 0 || this.fileStructure.maxDepth > 0 || this.fileStructure.totalNodes > 0 || this.fileStructure.files.length > 0 || this.errors.length > 0 || this.unknownElements.length > 0;
33391
+ }
33392
+ /**
33393
+ * Sends current report
33394
+ * @returns Promise that resolves when report is sent
33395
+ */
33396
+ async sendReport() {
33397
+ if (!this.enabled || !this.isTelemetryDataChanged()) return;
33398
+ const report = [
33399
+ {
33400
+ id: this.generateId(),
33401
+ type: "parsing",
33402
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
33403
+ sessionId: this.sessionId,
33404
+ documentGuid: this.documentGuid,
33405
+ documentIdentifier: this.documentIdentifier,
33406
+ superdocVersion: this.superdocVersion,
33407
+ file: this.documentInfo,
33408
+ browser: this.getBrowserInfo(),
33409
+ statistics: this.statistics,
33410
+ fileStructure: this.fileStructure,
33411
+ unknownElements: this.unknownElements,
33412
+ errors: this.errors
33413
+ }
33414
+ ];
33415
+ await this.sendDataToTelemetry(report);
33416
+ }
33417
+ /**
33418
+ * Sends data to the service
33419
+ * @param data - Payload to send
33420
+ * @returns Promise that resolves when data is sent
33421
+ */
33422
+ async sendDataToTelemetry(data) {
33423
+ try {
33424
+ const response = await fetch(this.endpoint, {
33425
+ method: "POST",
33426
+ headers: {
33427
+ "Content-Type": "application/json",
33428
+ "X-License-Key": this.licenseKey
33429
+ },
33430
+ body: JSON.stringify(data)
33431
+ });
33432
+ if (!response.ok) {
33433
+ throw new Error(`Upload failed: ${response.statusText}`);
33434
+ } else {
33435
+ this.resetStatistics();
33436
+ }
33437
+ } catch (error) {
33438
+ console.error("Failed to upload telemetry:", error);
33439
+ }
33440
+ }
33441
+ /**
33442
+ * Generate unique identifier
33443
+ * @returns Unique ID
33444
+ * @private
33445
+ */
33446
+ generateId() {
33447
+ const timestamp = Date.now();
33448
+ const random = Array.from(randomBytes(4)).map((b2) => b2.toString(16).padStart(2, "0")).join("");
33449
+ return `${timestamp}-${random}`;
33450
+ }
33451
+ /**
33452
+ * Reset statistics
33453
+ */
33454
+ resetStatistics() {
33455
+ this.statistics = {
33456
+ nodeTypes: {},
33457
+ markTypes: {},
33458
+ attributes: {},
33459
+ errorCount: 0
33193
33460
  };
33461
+ this.fileStructure = {
33462
+ totalFiles: 0,
33463
+ maxDepth: 0,
33464
+ totalNodes: 0,
33465
+ files: []
33466
+ };
33467
+ this.unknownElements = [];
33468
+ this.errors = [];
33194
33469
  }
33195
33470
  };
33471
+ _Telemetry.COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
33472
+ _Telemetry.DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
33473
+ let Telemetry = _Telemetry;
33196
33474
  const getDefaultStyleDefinition = (defaultStyleId, docx) => {
33197
33475
  const result = { lineSpaceBefore: null, lineSpaceAfter: null };
33198
33476
  if (!defaultStyleId) return result;
@@ -35380,13 +35658,14 @@ const mergeRelationshipElements = (existingRelationships = [], newRelationships
35380
35658
  const currentId = attributes.Id || "";
35381
35659
  attributes.Target = attributes?.Target?.replace(/&/g, "&amp;");
35382
35660
  const existingTarget = existingRelationships.find((el) => el.attributes.Target === attributes.Target);
35383
- const isMedia = attributes.Target?.startsWith("media/");
35661
+ attributes.Target?.startsWith("media/");
35384
35662
  const isNewHyperlink = attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && currentId.length > 6;
35385
35663
  const isNewHeadFoot = (attributes.Type === HEADER_RELATIONSHIP_TYPE || attributes.Type === FOOTER_RELATIONSHIP_TYPE) && currentId.length > 6;
35386
35664
  const hasSeenId = currentId && seenIds.has(currentId);
35387
- const shouldSkip = !isNewHyperlink && !isNewHeadFoot && (hasSeenId || existingTarget);
35388
- if (shouldSkip) return;
35389
- attributes.Id = currentId.length > 6 || isMedia ? currentId : `rId${++largestId}`;
35665
+ if (!isNewHyperlink && !isNewHeadFoot && existingTarget) return;
35666
+ if (!currentId || hasSeenId) {
35667
+ attributes.Id = `rId${++largestId}`;
35668
+ }
35390
35669
  seenIds.add(attributes.Id);
35391
35670
  additions.push(rel);
35392
35671
  });
@@ -35600,7 +35879,7 @@ const _SuperConverter = class _SuperConverter {
35600
35879
  static getStoredSuperdocVersion(docx) {
35601
35880
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
35602
35881
  }
35603
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.29.0-next.7") {
35882
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.29.0-next.9") {
35604
35883
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
35605
35884
  }
35606
35885
  /**
@@ -36341,7 +36620,6 @@ export {
36341
36620
  translator$1e as bz,
36342
36621
  DOMParser$1 as c,
36343
36622
  translator$1 as c0,
36344
- _sfc_main as c1,
36345
36623
  Mark as d,
36346
36624
  dropPoint as e,
36347
36625
  callOrGet as f,
@@ -1,4 +1,4 @@
1
- import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter--SREdiqQ.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-D6qfGG_6.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, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_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, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, applyIndentStyling_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_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 updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter--SREdiqQ.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 updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-D6qfGG_6.js";
16
+ import { D as DocxZipper } from "./docx-zipper-BqmHhBsY.js";
16
17
  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-BRGsc2Y2.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -15072,7 +15072,7 @@ const _Editor = class _Editor extends EventEmitter {
15072
15072
  { default: remarkStringify },
15073
15073
  { default: remarkGfm }
15074
15074
  ] = await Promise.all([
15075
- import("./index-BqhJhdcP.js"),
15075
+ import("./index-sJFE-5Sw.js"),
15076
15076
  import("./index-DRCvimau.js"),
15077
15077
  import("./index-C_x_N6Uh.js"),
15078
15078
  import("./index-D_sWOSiG.js"),
@@ -15290,7 +15290,7 @@ const _Editor = class _Editor extends EventEmitter {
15290
15290
  * @returns {Object | void} Migration results
15291
15291
  */
15292
15292
  processCollaborationMigrations() {
15293
- console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.7");
15293
+ console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.9");
15294
15294
  if (!this.options.ydoc) return;
15295
15295
  const metaMap = this.options.ydoc.getMap("meta");
15296
15296
  let docVersion = metaMap.get("version");
@@ -1,4 +1,4 @@
1
- import { aA as getDefaultExportFromCjs } from "./converter--SREdiqQ.js";
1
+ import { aA as getDefaultExportFromCjs } from "./converter-D6qfGG_6.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -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--SREdiqQ.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DsKLhlKe.js";
2
+ import { p as process$1 } from "./converter-D6qfGG_6.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-5q11lIMq.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,5 +1,4 @@
1
- import { a5 } from "./chunks/converter--SREdiqQ.js";
2
- import "vue";
1
+ import { a5 } from "./chunks/converter-D6qfGG_6.js";
3
2
  export {
4
3
  a5 as SuperConverter
5
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter--SREdiqQ.js";
2
- import { D } from "./chunks/docx-zipper-BRGsc2Y2.js";
1
+ import "./chunks/converter-D6qfGG_6.js";
2
+ import { D } from "./chunks/docx-zipper-BqmHhBsY.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-DsKLhlKe.js";
2
- import "./chunks/converter--SREdiqQ.js";
3
- import "./chunks/docx-zipper-BRGsc2Y2.js";
1
+ import { E } from "./chunks/editor-5q11lIMq.js";
2
+ import "./chunks/converter-D6qfGG_6.js";
3
+ import "./chunks/docx-zipper-BqmHhBsY.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-BRGsc2Y2.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BqmHhBsY.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {