@superdoc-dev/mcp 0.6.0-next.15 → 0.6.0-next.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1453 -140
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
51891
51891
  emptyOptions2 = {};
51892
51892
  });
51893
51893
 
51894
- // ../../packages/superdoc/dist/chunks/SuperConverter-BLUJyRB9.es.js
51894
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CzwJ7ds9.es.js
51895
51895
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
51896
51896
  const fieldValue = extension$1.config[field];
51897
51897
  if (typeof fieldValue === "function")
@@ -56710,7 +56710,13 @@ function buildDispatchTable(api2) {
56710
56710
  "customXml.parts.get": (input) => api2.customXml.parts.get(input),
56711
56711
  "customXml.parts.create": (input, options) => api2.customXml.parts.create(input, options),
56712
56712
  "customXml.parts.patch": (input, options) => api2.customXml.parts.patch(input, options),
56713
- "customXml.parts.remove": (input, options) => api2.customXml.parts.remove(input, options)
56713
+ "customXml.parts.remove": (input, options) => api2.customXml.parts.remove(input, options),
56714
+ "metadata.attach": (input, options) => api2.metadata.attach(input, options),
56715
+ "metadata.list": (input) => api2.metadata.list(input),
56716
+ "metadata.get": (input) => api2.metadata.get(input),
56717
+ "metadata.update": (input, options) => api2.metadata.update(input, options),
56718
+ "metadata.remove": (input, options) => api2.metadata.remove(input, options),
56719
+ "metadata.resolve": (input) => api2.metadata.resolve(input)
56714
56720
  };
56715
56721
  }
56716
56722
  function executeHistoryGet(adapter) {
@@ -58318,6 +58324,84 @@ function executeCustomXmlPartsRemove(adapter, input, options) {
58318
58324
  validateTarget(input.target, "customXml.parts.remove");
58319
58325
  return adapter.remove(input, normalizeMutationOptions(options));
58320
58326
  }
58327
+ function validateId(id, operationName) {
58328
+ if (typeof id !== "string" || id.length === 0)
58329
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} requires a non-empty 'id' string.`, { idType: typeof id });
58330
+ }
58331
+ function validateNamespace(namespace, operationName) {
58332
+ if (typeof namespace !== "string" || namespace.length === 0)
58333
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} requires a non-empty 'namespace' string.`, { namespaceType: typeof namespace });
58334
+ }
58335
+ function validatePayload(payload, operationName) {
58336
+ let serialized;
58337
+ try {
58338
+ serialized = JSON.stringify(payload);
58339
+ } catch (err$1) {
58340
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'payload' must be JSON-serializable (no cycles, no BigInt).`, { error: err$1 instanceof Error ? err$1.message : String(err$1) });
58341
+ }
58342
+ if (serialized === undefined)
58343
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'payload' must be a JSON-serializable value (was undefined / function / symbol).`);
58344
+ }
58345
+ function validateAnchorTarget(target, operationName) {
58346
+ if (!isSelectionTarget(target))
58347
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a 'target' SelectionTarget describing the anchor range.`, { target });
58348
+ if (target.start.kind !== "text" || target.end.kind !== "text")
58349
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a text-range target. v1 does not support nodeEdge anchors.`, {
58350
+ startKind: target.start.kind,
58351
+ endKind: target.end.kind
58352
+ });
58353
+ if (target.start.blockId !== target.end.blockId)
58354
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must stay within a single paragraph. v1 anchors are hidden inline SDTs and cannot span block boundaries.`, {
58355
+ startBlockId: target.start.blockId,
58356
+ endBlockId: target.end.blockId
58357
+ });
58358
+ }
58359
+ function validateWithin(within, operationName) {
58360
+ if (!isSelectionTarget(within))
58361
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'within' must be a SelectionTarget when provided.`, { within });
58362
+ if (within.start.kind !== "text" || within.end.kind !== "text")
58363
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'within' must be a text-range target (no nodeEdge endpoints).`, {
58364
+ startKind: within.start.kind,
58365
+ endKind: within.end.kind
58366
+ });
58367
+ if (within.start.blockId !== within.end.blockId)
58368
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'within' must stay within a single paragraph in v1.`, {
58369
+ startBlockId: within.start.blockId,
58370
+ endBlockId: within.end.blockId
58371
+ });
58372
+ }
58373
+ function executeAnchoredMetadataAttach(adapter, input, options) {
58374
+ validateAnchorTarget(input.target, "metadata.attach");
58375
+ validateNamespace(input.namespace, "metadata.attach");
58376
+ validatePayload(input.payload, "metadata.attach");
58377
+ if (input.id !== undefined)
58378
+ validateId(input.id, "metadata.attach");
58379
+ return adapter.attach(input, normalizeMutationOptions(options));
58380
+ }
58381
+ function executeAnchoredMetadataList(adapter, query) {
58382
+ if (query?.namespace !== undefined && typeof query.namespace !== "string")
58383
+ throw new DocumentApiValidationError("INVALID_INPUT", `metadata.list 'namespace' must be a string when provided.`);
58384
+ if (query?.within !== undefined)
58385
+ validateWithin(query.within, "metadata.list");
58386
+ return adapter.list(query);
58387
+ }
58388
+ function executeAnchoredMetadataGet(adapter, input) {
58389
+ validateId(input.id, "metadata.get");
58390
+ return adapter.get(input);
58391
+ }
58392
+ function executeAnchoredMetadataUpdate(adapter, input, options) {
58393
+ validateId(input.id, "metadata.update");
58394
+ validatePayload(input.payload, "metadata.update");
58395
+ return adapter.update(input, normalizeMutationOptions(options));
58396
+ }
58397
+ function executeAnchoredMetadataRemove(adapter, input, options) {
58398
+ validateId(input.id, "metadata.remove");
58399
+ return adapter.remove(input, normalizeMutationOptions(options));
58400
+ }
58401
+ function executeAnchoredMetadataResolve(adapter, input) {
58402
+ validateId(input.id, "metadata.resolve");
58403
+ return adapter.resolve(input);
58404
+ }
58321
58405
  function validateSetEditingRestrictionInput(input) {
58322
58406
  if (!input || typeof input !== "object")
58323
58407
  throw new DocumentApiValidationError("INVALID_INPUT", "protection.setEditingRestriction requires an object with a mode property.");
@@ -59943,6 +60027,26 @@ function createDocumentApi(adapters) {
59943
60027
  return executeCustomXmlPartsRemove(requireAdapter(adapters.customXml, "customXml").parts, input, options);
59944
60028
  }
59945
60029
  } },
60030
+ metadata: {
60031
+ attach(input, options) {
60032
+ return executeAnchoredMetadataAttach(requireAdapter(adapters.metadata, "metadata"), input, options);
60033
+ },
60034
+ list(input) {
60035
+ return executeAnchoredMetadataList(requireAdapter(adapters.metadata, "metadata"), input);
60036
+ },
60037
+ get(input) {
60038
+ return executeAnchoredMetadataGet(requireAdapter(adapters.metadata, "metadata"), input);
60039
+ },
60040
+ update(input, options) {
60041
+ return executeAnchoredMetadataUpdate(requireAdapter(adapters.metadata, "metadata"), input, options);
60042
+ },
60043
+ remove(input, options) {
60044
+ return executeAnchoredMetadataRemove(requireAdapter(adapters.metadata, "metadata"), input, options);
60045
+ },
60046
+ resolve(input) {
60047
+ return executeAnchoredMetadataResolve(requireAdapter(adapters.metadata, "metadata"), input);
60048
+ }
60049
+ },
59946
60050
  invoke(request) {
59947
60051
  if (!Object.prototype.hasOwnProperty.call(dispatch, request.operationId))
59948
60052
  throw new Error(`Unknown operationId: "${request.operationId}"`);
@@ -90894,7 +90998,7 @@ var isRegExp = (value) => {
90894
90998
  tracked: false,
90895
90999
  carrier: runAttributeCarrier(runPropertyKey ?? key),
90896
91000
  schema
90897
- }), INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, UNDERLINE_OBJECT_ALLOWED_KEYS, SHADING_ALLOWED_KEYS, BORDER_ALLOWED_KEYS, FIT_TEXT_ALLOWED_KEYS, LANG_ALLOWED_KEYS, RFONTS_ALLOWED_KEYS, EAST_ASIAN_LAYOUT_ALLOWED_KEYS, STYLISTIC_SET_ALLOWED_KEYS, VERT_ALIGN_VALUES, PROPERTY_VALIDATOR_MAP, NONE_FAILURES, NONE_THROWS, T_NOT_FOUND, T_NOT_FOUND_CAPABLE, T_PLAN_ENGINE, T_NOT_FOUND_COMMAND, T_IMAGE_COMMAND, T_CC_READ, T_CC_MUTATION, T_CC_TYPED, T_CC_TYPED_READ, T_CC_RAW, T_QUERY_MATCH, T_SECTION_CREATE, T_SECTION_READ, T_PARAGRAPH_MUTATION, T_SECTION_MUTATION, T_SECTION_SETTINGS_MUTATION, T_HEADER_FOOTER_MUTATION, T_STORY, T_REF_READ_LIST, T_REF_MUTATION, T_REF_MUTATION_REMOVE, T_REF_INSERT, T_PROTECTION_READ, T_PROTECTION_MUTATION, T_PERM_RANGE_READ, T_PERM_RANGE_MUTATION, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS, OPERATION_DEFINITIONS, OPERATION_IDS, COMMAND_CATALOG, TABLE_COLOR_PATTERN_SOURCE = "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$", TABLE_COLOR_PATTERN, PARAGRAPH_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TAB_STOP_LEADERS, BORDER_SIDES, CLEAR_BORDER_SIDES, LINE_RULES, PARAGRAPH_DIRECTIONS, ALIGNMENT_POLICIES, PARAGRAPH_BLOCK_TYPES, SET_STYLE_KEYS, CLEAR_STYLE_KEYS, RESET_DIRECT_FORMATTING_KEYS, SET_ALIGNMENT_KEYS, CLEAR_ALIGNMENT_KEYS, SET_INDENTATION_KEYS, CLEAR_INDENTATION_KEYS, SET_SPACING_KEYS, CLEAR_SPACING_KEYS, SET_KEEP_OPTIONS_KEYS, SET_OUTLINE_LEVEL_KEYS, SET_FLOW_OPTIONS_KEYS, SET_TAB_STOP_KEYS, CLEAR_TAB_STOP_KEYS, CLEAR_ALL_TAB_STOPS_KEYS, SET_BORDER_KEYS, CLEAR_BORDER_KEYS, SET_SHADING_KEYS, CLEAR_SHADING_KEYS, SET_DIRECTION_KEYS, CLEAR_DIRECTION_KEYS, ST_ON_OFF_ON_VALUES, ST_ON_OFF_OFF_VALUES, ST_UNDERLINE_VALUES, ST_UNDERLINE_VALUE_SET, ST_VERTICAL_ALIGN_RUN, ST_EM, ST_TEXT_ALIGNMENT, ST_TEXT_DIRECTION, ST_TEXTBOX_TIGHT_WRAP, ST_TEXT_TRANSFORM, ST_JUSTIFICATION, FONT_FAMILY_SCHEMA, COLOR_SCHEMA, SPACING_SCHEMA, INDENT_SCHEMA, UNDERLINE_SCHEMA, BORDER_PROPERTIES_SCHEMA, SHADING_SCHEMA, LANG_SCHEMA, EAST_ASIAN_LAYOUT_SCHEMA, FIT_TEXT_SCHEMA, NUMBERING_PROPERTIES_SCHEMA, FRAME_PR_SCHEMA, PARAGRAPH_BORDERS_SCHEMA, TAB_STOP_SCHEMA, PROPERTY_REGISTRY, ALLOWED_KEYS_BY_CHANNEL, PROPERTY_INDEX, EXCLUDED_KEYS, INPUT_ALLOWED_KEYS, TARGET_ALLOWED_KEYS, OPTIONS_ALLOWED_KEYS, VALID_CHANNELS, Z_ORDER_RELATIVE_HEIGHT_MAX = 4294967295, nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, rangeSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, tableAddressSchema, tableRowAddressSchema, tableCellAddressSchema, tableOrCellAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchBlockSchema, storyLocatorSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, textSelectorSchema, nodeSelectorSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentStylesSchema, documentDefaultsSchema, listKindSchema, listInsertPositionSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, trackChangeWordRevisionIdsSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, tableBorderColorPattern, nullableTableBorderSpecSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, tableCreateLocationSchema, formatInlineAliasOperationSchemas, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refListQueryProperties, refFailureSchema, bookmarkAddressSchema, bookmarkMutation, customXmlPartTargetSchema, customXmlPartMutation, customXmlPartCreateMutation, footnoteAddressSchema, footnoteConfigScopeSchema, footnoteNumberingSchema, footnoteMutation, footnoteConfig, crossRefAddressSchema, crossRefTargetSchema, crossRefDisplaySchema, crossRefMutation, indexAddressSchema, indexEntryAddressSchema, indexConfigSchema, indexEntryDataSchema, indexEntryPatchSchema, indexMutation, indexEntryMutation, captionAddressSchema, captionMutation, captionConfig, fieldAddressSchema, fieldMutation, citationAddressSchema, citationSourceAddressSchema, bibliographyAddressSchema, citationMutation, citationSourceMutation, bibliographyMutation, citationPersonSchema, citationSourceFieldsSchema, tocCreateLocationSchema, authoritiesAddressSchema, authorityEntryAddressSchema, authoritiesConfigSchema, authorityEntryDataSchema, authorityEntryPatchSchema, authoritiesMutation, authorityEntryMutation, diffCoverageSchema, diffSummarySchema, diffSnapshotSchema, diffPayloadSchema, GROUP_METADATA, STEP_OP_CATALOG_UNFROZEN, PUBLIC_STEP_OP_CATALOG_UNFROZEN, PUBLIC_MUTATION_STEP_OP_IDS, PUBLIC_MUTATION_STEP_OP_SET, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES, VALID_EDGE_NODE_TYPES, VALID_DOCUMENT_EDGES, VALID_REF_BOUNDARIES, VALID_ANCHOR_KINDS, RESOLVE_RANGE_ALLOWED_KEYS, SELECTION_CURRENT_ALLOWED_KEYS, CREATE_COMMENT_ALLOWED_KEYS, PATCH_COMMENT_ALLOWED_KEYS, STYLE_APPLY_INPUT_ALLOWED_KEYS, INLINE_ALIAS_INPUT_ALLOWED_KEYS, DELETE_INPUT_ALLOWED_KEYS, VALID_BEHAVIORS, CONTENT_KIND_SET, INLINE_KIND_SET, LEGACY_TOP_LEVEL_TYPES, TEXT_INSERT_ALLOWED_KEYS, STRUCTURAL_INSERT_ALLOWED_KEYS, VALID_INSERT_TYPES, LIST_KINDS, LIST_INSERT_POSITIONS, JOIN_DIRECTIONS, MUTATION_SCOPES, LEVEL_ALIGNMENTS, TRAILING_CHARACTERS, LIST_PRESET_IDS, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS, VALID_INSERT_POSITIONS, VALID_JOIN_DIRECTIONS, VALID_MUTATION_SCOPES, VALID_LEVEL_ALIGNMENTS, VALID_TRAILING_CHARACTERS, VALID_LIST_PRESETS, VALID_CONTINUITY_VALUES, VALID_SEQUENCE_MODES, VALID_LIST_CREATE_MODES, TEXT_REPLACE_ALLOWED_KEYS, STRUCTURAL_REPLACE_ALLOWED_KEYS, VALID_HEADING_LEVELS, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES, VALID_BLOCK_NODE_TYPES, SNAPSHOT_VERSIONS, PAYLOAD_VERSIONS, VALID_STYLE_OPTION_FLAGS, VALID_APPLY_TO_VALUES, VALID_BORDER_EDGE_KEYS, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT = 250, SECTION_BREAK_TYPES, SECTION_ORIENTATIONS, SECTION_VERTICAL_ALIGNS, SECTION_DIRECTIONS, HEADER_FOOTER_KINDS, HEADER_FOOTER_VARIANTS, LINE_NUMBER_RESTARTS, PAGE_NUMBER_FORMATS, PAGE_BORDER_DISPLAYS, PAGE_BORDER_OFFSET_FROM_VALUES, PAGE_BORDER_Z_ORDER_VALUES, VALID_WRAP_TYPES, VALID_WRAP_SIDES, VALID_IMAGE_SIZE_UNITS, VALID_TOC_UPDATE_MODES, EDIT_ENTRY_PATCH_ALLOWED_KEYS, PATCH_FIELDS, CONTENT_CONTROL_TYPES, LOCK_MODES, CONTENT_CONTROL_APPEARANCES, VALID_NODE_KINDS, VALID_LOCK_MODES$1, VALID_CC_TYPES, VALID_CC_APPEARANCES, VALID_CONTENT_FORMATS, VALID_RAW_PATCH_OPS, VALID_SET_MODES, VALID_CREATE_LOCATION_KINDS, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$218) => ({
91001
+ }), INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, UNDERLINE_OBJECT_ALLOWED_KEYS, SHADING_ALLOWED_KEYS, BORDER_ALLOWED_KEYS, FIT_TEXT_ALLOWED_KEYS, LANG_ALLOWED_KEYS, RFONTS_ALLOWED_KEYS, EAST_ASIAN_LAYOUT_ALLOWED_KEYS, STYLISTIC_SET_ALLOWED_KEYS, VERT_ALIGN_VALUES, PROPERTY_VALIDATOR_MAP, NONE_FAILURES, NONE_THROWS, T_NOT_FOUND, T_NOT_FOUND_CAPABLE, T_PLAN_ENGINE, T_NOT_FOUND_COMMAND, T_IMAGE_COMMAND, T_CC_READ, T_CC_MUTATION, T_CC_TYPED, T_CC_TYPED_READ, T_CC_RAW, T_QUERY_MATCH, T_SECTION_CREATE, T_SECTION_READ, T_PARAGRAPH_MUTATION, T_SECTION_MUTATION, T_SECTION_SETTINGS_MUTATION, T_HEADER_FOOTER_MUTATION, T_STORY, T_REF_READ_LIST, T_REF_MUTATION, T_REF_MUTATION_REMOVE, T_REF_INSERT, T_PROTECTION_READ, T_PROTECTION_MUTATION, T_PERM_RANGE_READ, T_PERM_RANGE_MUTATION, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS, OPERATION_DEFINITIONS, OPERATION_IDS, COMMAND_CATALOG, TABLE_COLOR_PATTERN_SOURCE = "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$", TABLE_COLOR_PATTERN, PARAGRAPH_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TAB_STOP_LEADERS, BORDER_SIDES, CLEAR_BORDER_SIDES, LINE_RULES, PARAGRAPH_DIRECTIONS, ALIGNMENT_POLICIES, PARAGRAPH_BLOCK_TYPES, SET_STYLE_KEYS, CLEAR_STYLE_KEYS, RESET_DIRECT_FORMATTING_KEYS, SET_ALIGNMENT_KEYS, CLEAR_ALIGNMENT_KEYS, SET_INDENTATION_KEYS, CLEAR_INDENTATION_KEYS, SET_SPACING_KEYS, CLEAR_SPACING_KEYS, SET_KEEP_OPTIONS_KEYS, SET_OUTLINE_LEVEL_KEYS, SET_FLOW_OPTIONS_KEYS, SET_TAB_STOP_KEYS, CLEAR_TAB_STOP_KEYS, CLEAR_ALL_TAB_STOPS_KEYS, SET_BORDER_KEYS, CLEAR_BORDER_KEYS, SET_SHADING_KEYS, CLEAR_SHADING_KEYS, SET_DIRECTION_KEYS, CLEAR_DIRECTION_KEYS, ST_ON_OFF_ON_VALUES, ST_ON_OFF_OFF_VALUES, ST_UNDERLINE_VALUES, ST_UNDERLINE_VALUE_SET, ST_VERTICAL_ALIGN_RUN, ST_EM, ST_TEXT_ALIGNMENT, ST_TEXT_DIRECTION, ST_TEXTBOX_TIGHT_WRAP, ST_TEXT_TRANSFORM, ST_JUSTIFICATION, FONT_FAMILY_SCHEMA, COLOR_SCHEMA, SPACING_SCHEMA, INDENT_SCHEMA, UNDERLINE_SCHEMA, BORDER_PROPERTIES_SCHEMA, SHADING_SCHEMA, LANG_SCHEMA, EAST_ASIAN_LAYOUT_SCHEMA, FIT_TEXT_SCHEMA, NUMBERING_PROPERTIES_SCHEMA, FRAME_PR_SCHEMA, PARAGRAPH_BORDERS_SCHEMA, TAB_STOP_SCHEMA, PROPERTY_REGISTRY, ALLOWED_KEYS_BY_CHANNEL, PROPERTY_INDEX, EXCLUDED_KEYS, INPUT_ALLOWED_KEYS, TARGET_ALLOWED_KEYS, OPTIONS_ALLOWED_KEYS, VALID_CHANNELS, Z_ORDER_RELATIVE_HEIGHT_MAX = 4294967295, nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, rangeSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, tableAddressSchema, tableRowAddressSchema, tableCellAddressSchema, tableOrCellAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchBlockSchema, storyLocatorSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, textSelectorSchema, nodeSelectorSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentStylesSchema, documentDefaultsSchema, listKindSchema, listInsertPositionSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, trackChangeWordRevisionIdsSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, tableBorderColorPattern, nullableTableBorderSpecSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, tableCreateLocationSchema, formatInlineAliasOperationSchemas, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refListQueryProperties, refFailureSchema, bookmarkAddressSchema, bookmarkMutation, customXmlPartTargetSchema, customXmlPartMutation, customXmlPartCreateMutation, anchoredMetadataAttachMutation, anchoredMetadataMutation, footnoteAddressSchema, footnoteConfigScopeSchema, footnoteNumberingSchema, footnoteMutation, footnoteConfig, crossRefAddressSchema, crossRefTargetSchema, crossRefDisplaySchema, crossRefMutation, indexAddressSchema, indexEntryAddressSchema, indexConfigSchema, indexEntryDataSchema, indexEntryPatchSchema, indexMutation, indexEntryMutation, captionAddressSchema, captionMutation, captionConfig, fieldAddressSchema, fieldMutation, citationAddressSchema, citationSourceAddressSchema, bibliographyAddressSchema, citationMutation, citationSourceMutation, bibliographyMutation, citationPersonSchema, citationSourceFieldsSchema, tocCreateLocationSchema, authoritiesAddressSchema, authorityEntryAddressSchema, authoritiesConfigSchema, authorityEntryDataSchema, authorityEntryPatchSchema, authoritiesMutation, authorityEntryMutation, diffCoverageSchema, diffSummarySchema, diffSnapshotSchema, diffPayloadSchema, GROUP_METADATA, STEP_OP_CATALOG_UNFROZEN, PUBLIC_STEP_OP_CATALOG_UNFROZEN, PUBLIC_MUTATION_STEP_OP_IDS, PUBLIC_MUTATION_STEP_OP_SET, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES, VALID_EDGE_NODE_TYPES, VALID_DOCUMENT_EDGES, VALID_REF_BOUNDARIES, VALID_ANCHOR_KINDS, RESOLVE_RANGE_ALLOWED_KEYS, SELECTION_CURRENT_ALLOWED_KEYS, CREATE_COMMENT_ALLOWED_KEYS, PATCH_COMMENT_ALLOWED_KEYS, STYLE_APPLY_INPUT_ALLOWED_KEYS, INLINE_ALIAS_INPUT_ALLOWED_KEYS, DELETE_INPUT_ALLOWED_KEYS, VALID_BEHAVIORS, CONTENT_KIND_SET, INLINE_KIND_SET, LEGACY_TOP_LEVEL_TYPES, TEXT_INSERT_ALLOWED_KEYS, STRUCTURAL_INSERT_ALLOWED_KEYS, VALID_INSERT_TYPES, LIST_KINDS, LIST_INSERT_POSITIONS, JOIN_DIRECTIONS, MUTATION_SCOPES, LEVEL_ALIGNMENTS, TRAILING_CHARACTERS, LIST_PRESET_IDS, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS, VALID_INSERT_POSITIONS, VALID_JOIN_DIRECTIONS, VALID_MUTATION_SCOPES, VALID_LEVEL_ALIGNMENTS, VALID_TRAILING_CHARACTERS, VALID_LIST_PRESETS, VALID_CONTINUITY_VALUES, VALID_SEQUENCE_MODES, VALID_LIST_CREATE_MODES, TEXT_REPLACE_ALLOWED_KEYS, STRUCTURAL_REPLACE_ALLOWED_KEYS, VALID_HEADING_LEVELS, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES, VALID_BLOCK_NODE_TYPES, SNAPSHOT_VERSIONS, PAYLOAD_VERSIONS, VALID_STYLE_OPTION_FLAGS, VALID_APPLY_TO_VALUES, VALID_BORDER_EDGE_KEYS, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT = 250, SECTION_BREAK_TYPES, SECTION_ORIENTATIONS, SECTION_VERTICAL_ALIGNS, SECTION_DIRECTIONS, HEADER_FOOTER_KINDS, HEADER_FOOTER_VARIANTS, LINE_NUMBER_RESTARTS, PAGE_NUMBER_FORMATS, PAGE_BORDER_DISPLAYS, PAGE_BORDER_OFFSET_FROM_VALUES, PAGE_BORDER_Z_ORDER_VALUES, VALID_WRAP_TYPES, VALID_WRAP_SIDES, VALID_IMAGE_SIZE_UNITS, VALID_TOC_UPDATE_MODES, EDIT_ENTRY_PATCH_ALLOWED_KEYS, PATCH_FIELDS, CONTENT_CONTROL_TYPES, LOCK_MODES, CONTENT_CONTROL_APPEARANCES, VALID_NODE_KINDS, VALID_LOCK_MODES$1, VALID_CC_TYPES, VALID_CC_APPEARANCES, VALID_CONTENT_FORMATS, VALID_RAW_PATCH_OPS, VALID_SET_MODES, VALID_CREATE_LOCATION_KINDS, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$218) => ({
90898
91002
  handlerName,
90899
91003
  handler: (params) => {
90900
91004
  const { nodes } = params;
@@ -105729,7 +105833,7 @@ var isRegExp = (value) => {
105729
105833
  if (id)
105730
105834
  return trackedChanges.filter(({ mark }) => mark.attrs.id === id);
105731
105835
  return trackedChanges;
105732
- }, DERIVED_ID_LENGTH = 24, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.33.1", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
105836
+ }, DERIVED_ID_LENGTH = 24, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.33.1", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
105733
105837
  if (!runProps?.elements?.length || !state)
105734
105838
  return;
105735
105839
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -105763,7 +105867,7 @@ var isRegExp = (value) => {
105763
105867
  state.kern = kernNode.attributes["w:val"];
105764
105868
  }
105765
105869
  }, SuperConverter;
105766
- var init_SuperConverter_BLUJyRB9_es = __esm(() => {
105870
+ var init_SuperConverter_CzwJ7ds9_es = __esm(() => {
105767
105871
  init_rolldown_runtime_Bg48TavK_es();
105768
105872
  init_jszip_C49i9kUs_es();
105769
105873
  init_xml_js_CqGKpaft_es();
@@ -114335,6 +114439,85 @@ var init_SuperConverter_BLUJyRB9_es = __esm(() => {
114335
114439
  }),
114336
114440
  referenceDocPath: "custom-xml/parts/remove.mdx",
114337
114441
  referenceGroup: "customXml"
114442
+ },
114443
+ "metadata.attach": {
114444
+ memberPath: "metadata.attach",
114445
+ description: "Anchor a JSON metadata payload to a span of text. Wraps the target range in a hidden inline content control whose w:tag carries a stable id, and stores the payload in a namespaced Custom XML Data Storage Part. v1 supports text-range anchors only.",
114446
+ expectedResult: "Returns an AnchoredMetadataAttachResult with the assigned id and the backing Storage Part name on success.",
114447
+ requiresDocumentContext: true,
114448
+ metadata: mutationOperation({
114449
+ idempotency: "non-idempotent",
114450
+ supportsDryRun: true,
114451
+ supportsTrackedMode: false,
114452
+ possibleFailureCodes: [
114453
+ "TARGET_NOT_FOUND",
114454
+ "INVALID_TARGET",
114455
+ "INVALID_INPUT"
114456
+ ],
114457
+ throws: [...T_REF_INSERT, "REVISION_MISMATCH"]
114458
+ }),
114459
+ referenceDocPath: "metadata/attach.mdx",
114460
+ referenceGroup: "metadata"
114461
+ },
114462
+ "metadata.list": {
114463
+ memberPath: "metadata.list",
114464
+ description: "List anchored-metadata entries in the document, optionally filtered by consumer namespace and/or a `within` selection (returns only entries whose anchor overlaps `within`).",
114465
+ expectedResult: "Returns an AnchoredMetadataListResult with summary entries (no payload); fetch payload via get.",
114466
+ requiresDocumentContext: true,
114467
+ metadata: readOperation({
114468
+ idempotency: "idempotent",
114469
+ throws: T_REF_READ_LIST
114470
+ }),
114471
+ referenceDocPath: "metadata/list.mdx",
114472
+ referenceGroup: "metadata"
114473
+ },
114474
+ "metadata.get": {
114475
+ memberPath: "metadata.get",
114476
+ description: "Get a single anchored-metadata entry by id, including its JSON payload.",
114477
+ expectedResult: "Returns an AnchoredMetadataInfo with id, namespace, partName, and payload; or null if not found.",
114478
+ requiresDocumentContext: true,
114479
+ metadata: readOperation({ throws: T_NOT_FOUND_CAPABLE }),
114480
+ referenceDocPath: "metadata/get.mdx",
114481
+ referenceGroup: "metadata"
114482
+ },
114483
+ "metadata.update": {
114484
+ memberPath: "metadata.update",
114485
+ description: "Replace the JSON payload of an existing anchored-metadata entry. Replace semantics; no merge. The anchor is left untouched.",
114486
+ expectedResult: "Returns an AnchoredMetadataMutationResult with the entry id on success or a failure.",
114487
+ requiresDocumentContext: true,
114488
+ metadata: mutationOperation({
114489
+ idempotency: "idempotent",
114490
+ supportsDryRun: true,
114491
+ supportsTrackedMode: false,
114492
+ possibleFailureCodes: ["TARGET_NOT_FOUND", "INVALID_INPUT"],
114493
+ throws: [...T_REF_MUTATION, "REVISION_MISMATCH"]
114494
+ }),
114495
+ referenceDocPath: "metadata/update.mdx",
114496
+ referenceGroup: "metadata"
114497
+ },
114498
+ "metadata.remove": {
114499
+ memberPath: "metadata.remove",
114500
+ description: "Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed.",
114501
+ expectedResult: "Returns an AnchoredMetadataMutationResult with the removed entry id on success or a failure.",
114502
+ requiresDocumentContext: true,
114503
+ metadata: mutationOperation({
114504
+ idempotency: "non-idempotent",
114505
+ supportsDryRun: true,
114506
+ supportsTrackedMode: false,
114507
+ possibleFailureCodes: ["TARGET_NOT_FOUND"],
114508
+ throws: [...T_REF_MUTATION_REMOVE, "REVISION_MISMATCH"]
114509
+ }),
114510
+ referenceDocPath: "metadata/remove.mdx",
114511
+ referenceGroup: "metadata"
114512
+ },
114513
+ "metadata.resolve": {
114514
+ memberPath: "metadata.resolve",
114515
+ description: "Find where an anchored-metadata entry is anchored in the document. Returns the SelectionTarget covering the anchor content.",
114516
+ expectedResult: "Returns an AnchoredMetadataResolveInfo with id and target SelectionTarget; or null if the anchor is no longer present.",
114517
+ requiresDocumentContext: true,
114518
+ metadata: readOperation({ throws: T_NOT_FOUND_CAPABLE }),
114519
+ referenceDocPath: "metadata/resolve.mdx",
114520
+ referenceGroup: "metadata"
114338
114521
  }
114339
114522
  };
114340
114523
  OPERATION_IDS = Object.freeze(Object.keys(OPERATION_DEFINITIONS));
@@ -116613,6 +116796,28 @@ var init_SuperConverter_BLUJyRB9_es = __esm(() => {
116613
116796
  "partName",
116614
116797
  "propsPartName"
116615
116798
  ]);
116799
+ anchoredMetadataAttachMutation = refMutationSchemas({
116800
+ id: {
116801
+ type: "string",
116802
+ minLength: 1
116803
+ },
116804
+ namespace: {
116805
+ type: "string",
116806
+ minLength: 1
116807
+ },
116808
+ partName: {
116809
+ type: "string",
116810
+ minLength: 1
116811
+ }
116812
+ }, [
116813
+ "id",
116814
+ "namespace",
116815
+ "partName"
116816
+ ]);
116817
+ anchoredMetadataMutation = refMutationSchemas({ id: {
116818
+ type: "string",
116819
+ minLength: 1
116820
+ } }, ["id"]);
116616
116821
  footnoteAddressSchema = objectSchema({
116617
116822
  kind: { const: "entity" },
116618
116823
  entityType: { const: "footnote" },
@@ -120533,7 +120738,41 @@ var init_SuperConverter_BLUJyRB9_es = __esm(() => {
120533
120738
  minLength: 1
120534
120739
  }
120535
120740
  }
120536
- }, ["content"]), { ...customXmlPartCreateMutation }, { ...customXmlPartMutation }, objectSchema({ target: customXmlPartTargetSchema }, ["target"]), { ...customXmlPartMutation };
120741
+ }, ["content"]), { ...customXmlPartCreateMutation }, { ...customXmlPartMutation }, objectSchema({ target: customXmlPartTargetSchema }, ["target"]), { ...customXmlPartMutation }, objectSchema({
120742
+ target: selectionTargetSchema,
120743
+ namespace: {
120744
+ type: "string",
120745
+ minLength: 1
120746
+ },
120747
+ payload: {},
120748
+ id: {
120749
+ type: "string",
120750
+ minLength: 1
120751
+ }
120752
+ }, [
120753
+ "target",
120754
+ "namespace",
120755
+ "payload"
120756
+ ]), { ...anchoredMetadataAttachMutation }, objectSchema({
120757
+ ...refListQueryProperties,
120758
+ namespace: { type: "string" },
120759
+ within: selectionTargetSchema
120760
+ }), objectSchema({ id: {
120761
+ type: "string",
120762
+ minLength: 1
120763
+ } }, ["id"]), objectSchema({
120764
+ id: {
120765
+ type: "string",
120766
+ minLength: 1
120767
+ },
120768
+ payload: {}
120769
+ }, ["id", "payload"]), { ...anchoredMetadataMutation }, objectSchema({ id: {
120770
+ type: "string",
120771
+ minLength: 1
120772
+ } }, ["id"]), { ...anchoredMetadataMutation }, objectSchema({ id: {
120773
+ type: "string",
120774
+ minLength: 1
120775
+ } }, ["id"]);
120537
120776
  projectFromDefinitions((_id, entry) => entry.memberPath);
120538
120777
  [...new Set(OPERATION_IDS.map((id) => OPERATION_DEFINITIONS[id].memberPath))];
120539
120778
  projectFromDefinitions((_id, entry) => entry.referenceDocPath);
@@ -120712,6 +120951,11 @@ var init_SuperConverter_BLUJyRB9_es = __esm(() => {
120712
120951
  title: "Custom XML",
120713
120952
  description: "Custom XML Data Storage Part operations (ECMA-376 §15.2.5, §15.2.6). Raw read and write of custom XML parts in the OOXML package.",
120714
120953
  pagePath: "custom-xml/index.mdx"
120954
+ },
120955
+ metadata: {
120956
+ title: "Anchored Metadata",
120957
+ description: "Attach a JSON payload to a span of text and read it back across DOCX round-trips. Backed by hidden inline content controls and namespaced Custom XML Data Storage Parts; consumers see one operation set.",
120958
+ pagePath: "metadata/index.mdx"
120715
120959
  }
120716
120960
  };
120717
120961
  Object.keys(GROUP_METADATA).map((key) => ({
@@ -143800,7 +144044,7 @@ var init_SuperConverter_BLUJyRB9_es = __esm(() => {
143800
144044
  };
143801
144045
  });
143802
144046
 
143803
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B-8QJyHX.es.js
144047
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BQTnHkb4.es.js
143804
144048
  function parseSizeUnit(val = "0") {
143805
144049
  const length = val.toString() || "0";
143806
144050
  const value = Number.parseFloat(length);
@@ -153810,8 +154054,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153810
154054
  }
153811
154055
  };
153812
154056
  };
153813
- var init_create_headless_toolbar_B_8QJyHX_es = __esm(() => {
153814
- init_SuperConverter_BLUJyRB9_es();
154057
+ var init_create_headless_toolbar_BQTnHkb4_es = __esm(() => {
154058
+ init_SuperConverter_CzwJ7ds9_es();
153815
154059
  init_uuid_qzgm05fK_es();
153816
154060
  init_constants_DrU4EASo_es();
153817
154061
  init_dist_B8HfvhaK_es();
@@ -208537,7 +208781,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
208537
208781
  init_remark_gfm_BhnWr3yf_es();
208538
208782
  });
208539
208783
 
208540
- // ../../packages/superdoc/dist/chunks/src-DFDWy3T0.es.js
208784
+ // ../../packages/superdoc/dist/chunks/src-D_jA08Jh.es.js
208541
208785
  function deleteProps(obj, propOrProps) {
208542
208786
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
208543
208787
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -210882,11 +211126,11 @@ function syncSplitParagraphRunProperties(attrs, runProperties) {
210882
211126
  paragraphProperties: nextParagraphProperties
210883
211127
  };
210884
211128
  }
210885
- function getConverter$82(editor) {
211129
+ function getConverter$92(editor) {
210886
211130
  return editor.converter;
210887
211131
  }
210888
211132
  function readTranslatedLinkedStyles(editor) {
210889
- return getConverter$82(editor)?.translatedLinkedStyles ?? null;
211133
+ return getConverter$92(editor)?.translatedLinkedStyles ?? null;
210890
211134
  }
210891
211135
  function isHeadingStyleId$1(styleId) {
210892
211136
  return typeof styleId === "string" && /^heading\s*[1-6]$/i.test(styleId.trim());
@@ -225621,7 +225865,7 @@ function makeTrackedChangeAnchorKey(ref$1) {
225621
225865
  function makeCommentAnchorKey(commentId) {
225622
225866
  return `${COMMENT_ANCHOR_KEY_PREFIX}${commentId}`;
225623
225867
  }
225624
- function getConverter$72(editor) {
225868
+ function getConverter$82(editor) {
225625
225869
  return editor.converter;
225626
225870
  }
225627
225871
  function toRevisionCapableNoteId(note) {
@@ -225638,7 +225882,7 @@ function enumerateRevisionCapableStories(editor) {
225638
225882
  kind: "story",
225639
225883
  storyType: "body"
225640
225884
  }];
225641
- const converter = getConverter$72(editor);
225885
+ const converter = getConverter$82(editor);
225642
225886
  if (!converter)
225643
225887
  return stories;
225644
225888
  if (converter.headers)
@@ -229728,15 +229972,15 @@ function previewPlan(editor, input2) {
229728
229972
  }
229729
229973
  stepPreviews.push(preview);
229730
229974
  }
229731
- for (const failure$1 of assertFailures)
229975
+ for (const failure$2 of assertFailures)
229732
229976
  failures.push({
229733
229977
  code: "PRECONDITION_FAILED",
229734
- stepId: failure$1.stepId,
229978
+ stepId: failure$2.stepId,
229735
229979
  phase: "assert",
229736
- message: `assert "${failure$1.stepId}" expected ${failure$1.expectedCount} matches but found ${failure$1.actualCount}`,
229980
+ message: `assert "${failure$2.stepId}" expected ${failure$2.expectedCount} matches but found ${failure$2.actualCount}`,
229737
229981
  details: {
229738
- expectedCount: failure$1.expectedCount,
229739
- actualCount: failure$1.actualCount
229982
+ expectedCount: failure$2.expectedCount,
229983
+ actualCount: failure$2.actualCount
229740
229984
  }
229741
229985
  });
229742
229986
  } catch (error48) {
@@ -234128,10 +234372,10 @@ function registerBuiltInExecutors() {
234128
234372
  };
234129
234373
  } });
234130
234374
  }
234131
- function getConverter$62(editor) {
234375
+ function getConverter$72(editor) {
234132
234376
  return editor.converter;
234133
234377
  }
234134
- function getConverter$52(editor) {
234378
+ function getConverter$62(editor) {
234135
234379
  return editor.converter;
234136
234380
  }
234137
234381
  function createEmptyHeaderFooterJson() {
@@ -234144,7 +234388,7 @@ function createEmptyHeaderFooterJson() {
234144
234388
  };
234145
234389
  }
234146
234390
  function syncHeaderFooterCaches(editor, part) {
234147
- const converter = getConverter$52(editor);
234391
+ const converter = getConverter$62(editor);
234148
234392
  if (!converter)
234149
234393
  return;
234150
234394
  const relsRoot = getRelationshipsRoot(part);
@@ -234206,7 +234450,7 @@ function createTableWrapper(editor, input2, options) {
234206
234450
  });
234207
234451
  return adapterResult;
234208
234452
  }
234209
- function getConverter$42(editor) {
234453
+ function getConverter$52(editor) {
234210
234454
  return editor.converter;
234211
234455
  }
234212
234456
  function toSectionFailure2(code7, message) {
@@ -234274,7 +234518,7 @@ function buildSectionMarginsForAttrs2(sectPr) {
234274
234518
  };
234275
234519
  }
234276
234520
  function syncConverterBodySection2(editor, sectPr) {
234277
- const converter = getConverter$42(editor);
234521
+ const converter = getConverter$52(editor);
234278
234522
  if (!converter)
234279
234523
  return;
234280
234524
  converter.bodySectPr = cloneXmlElement(sectPr);
@@ -234394,7 +234638,7 @@ function createSectionBreakNode(editor, breakParagraphId, input2) {
234394
234638
  return paragraphNode;
234395
234639
  }
234396
234640
  function updateGlobalTitlePageFlag(editor) {
234397
- const converter = getConverter$42(editor);
234641
+ const converter = getConverter$52(editor);
234398
234642
  if (!converter)
234399
234643
  return;
234400
234644
  const anyTitlePage = resolveSectionProjections(editor).some((entry) => entry.domain.titlePage === true);
@@ -234478,7 +234722,7 @@ function sectionsSetTitlePageAdapter(editor, input2, options) {
234478
234722
  }
234479
234723
  function sectionsSetOddEvenHeadersFootersAdapter(editor, input2, options) {
234480
234724
  rejectTrackedMode("sections.setOddEvenHeadersFooters", options);
234481
- const converter = getConverter$42(editor);
234725
+ const converter = getConverter$52(editor);
234482
234726
  if (!converter)
234483
234727
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "sections.setOddEvenHeadersFooters requires an active document converter.");
234484
234728
  return mutatePart({
@@ -234514,13 +234758,13 @@ function sectionsSetSectionDirectionAdapter(editor, input2, options) {
234514
234758
  }
234515
234759
  function sectionsSetHeaderFooterRefAdapter(editor, input2, options) {
234516
234760
  return sectionMutationBySectPr$1(editor, input2, options, "sections.setHeaderFooterRef", (sectPr, _projection, _sections, dryRun) => {
234517
- const converter = getConverter$42(editor) ?? null;
234761
+ const converter = getConverter$52(editor) ?? null;
234518
234762
  return setHeaderFooterRefMutation(sectPr, input2.kind, input2.variant, input2.refId, converter, "sections.setHeaderFooterRef", dryRun);
234519
234763
  });
234520
234764
  }
234521
234765
  function sectionsClearHeaderFooterRefAdapter(editor, input2, options) {
234522
234766
  return sectionMutationBySectPr$1(editor, input2, options, "sections.clearHeaderFooterRef", (sectPr, _projection, _sections, dryRun) => {
234523
- const converter = getConverter$42(editor) ?? null;
234767
+ const converter = getConverter$52(editor) ?? null;
234524
234768
  clearHeaderFooterRefMutation(sectPr, input2.kind, input2.variant, converter, dryRun);
234525
234769
  });
234526
234770
  }
@@ -236456,13 +236700,13 @@ function getLinkMarkType(editor) {
236456
236700
  throw new Error("Link mark type is not defined in the editor schema.");
236457
236701
  return markType;
236458
236702
  }
236459
- function dispatchTransaction$1(editor, tr) {
236703
+ function dispatchTransaction$2(editor, tr) {
236460
236704
  editor.dispatch(tr);
236461
236705
  }
236462
236706
  function dispatchIfChanged(editor, tr) {
236463
236707
  if (!tr.docChanged)
236464
236708
  return false;
236465
- dispatchTransaction$1(editor, tr);
236709
+ dispatchTransaction$2(editor, tr);
236466
236710
  return true;
236467
236711
  }
236468
236712
  function createRelationshipId(editor, href) {
@@ -236506,7 +236750,7 @@ function wrapWithLink(editor, from$1, to, spec) {
236506
236750
  const tr = editor.state.tr;
236507
236751
  tr.addMark(from$1, to, linkMarkType.create(attrs));
236508
236752
  applyDirectMutationMeta(tr);
236509
- dispatchTransaction$1(editor, tr);
236753
+ dispatchTransaction$2(editor, tr);
236510
236754
  return true;
236511
236755
  }
236512
236756
  function insertLinkedText(editor, pos, text5, spec) {
@@ -236517,7 +236761,7 @@ function insertLinkedText(editor, pos, text5, spec) {
236517
236761
  tr.insertText(text5, pos);
236518
236762
  tr.addMark(pos, pos + text5.length, mark2);
236519
236763
  applyDirectMutationMeta(tr);
236520
- dispatchTransaction$1(editor, tr);
236764
+ dispatchTransaction$2(editor, tr);
236521
236765
  return true;
236522
236766
  }
236523
236767
  function patchLinkMark(editor, from$1, to, existingMark, patch3) {
@@ -236563,7 +236807,7 @@ function deleteLinkedText(editor, from$1, to) {
236563
236807
  const tr = editor.state.tr;
236564
236808
  tr.delete(from$1, to);
236565
236809
  applyDirectMutationMeta(tr);
236566
- dispatchTransaction$1(editor, tr);
236810
+ dispatchTransaction$2(editor, tr);
236567
236811
  return true;
236568
236812
  }
236569
236813
  function normalizeReadProperties(attrs) {
@@ -236892,8 +237136,8 @@ function hyperlinksPatchWrapper(editor, input2, options) {
236892
237136
  const mergedHref = input2.patch.href === undefined ? oldAttrs.href : input2.patch.href;
236893
237137
  const mergedAnchor = input2.patch.anchor === undefined ? oldAttrs.anchor : input2.patch.anchor;
236894
237138
  const hasHref = typeof mergedHref === "string" && mergedHref.length > 0;
236895
- const hasAnchor = typeof mergedAnchor === "string" && mergedAnchor.length > 0;
236896
- if (!hasHref && !hasAnchor)
237139
+ const hasAnchor$1 = typeof mergedAnchor === "string" && mergedAnchor.length > 0;
237140
+ if (!hasHref && !hasAnchor$1)
236897
237141
  throw new DocumentApiAdapterError("INVALID_INPUT", "hyperlinks.patch: resulting destination must have at least one of href or anchor.");
236898
237142
  if (typeof input2.patch.href === "string")
236899
237143
  sanitizeHrefOrThrow(input2.patch.href);
@@ -236991,7 +237235,7 @@ function executeSdtMutation(editor, target, options, handler2) {
236991
237235
  return buildMutationFailure("NO_OP", "The mutation had no effect.");
236992
237236
  return buildMutationSuccess(target, updatedRef);
236993
237237
  }
236994
- function dispatchTransaction2(editor, tr) {
237238
+ function dispatchTransaction$1(editor, tr) {
236995
237239
  if (editor.view?.dispatch) {
236996
237240
  editor.view.dispatch(tr);
236997
237241
  return;
@@ -237066,7 +237310,7 @@ function replaceSdtTextContent(editor, target, text5) {
237066
237310
  tr.replaceWith(innerFrom, innerTo, textNode);
237067
237311
  } else
237068
237312
  tr.delete(innerFrom, innerTo);
237069
- dispatchTransaction2(editor, tr);
237313
+ dispatchTransaction$1(editor, tr);
237070
237314
  return true;
237071
237315
  }
237072
237316
  const paragraph2 = buildEmptyBlockContent(editor, resolved.node);
@@ -237075,7 +237319,7 @@ function replaceSdtTextContent(editor, target, text5) {
237075
237319
  const paragraphText = text5.length > 0 ? buildTextWithTabs(editor.schema, text5, undefined) : null;
237076
237320
  const updatedParagraph = paragraph2.type.create(paragraph2.attrs ?? null, paragraphText, paragraph2.marks);
237077
237321
  tr.replaceWith(innerFrom, innerTo, updatedParagraph);
237078
- dispatchTransaction2(editor, tr);
237322
+ dispatchTransaction$1(editor, tr);
237079
237323
  return true;
237080
237324
  }
237081
237325
  function listWrapper(editor, query) {
@@ -237164,7 +237408,7 @@ function wrapWrapper(editor, input2, options) {
237164
237408
  }, resolved.node);
237165
237409
  const { tr } = editor.state;
237166
237410
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, wrapperNode);
237167
- dispatchTransaction2(editor, tr);
237411
+ dispatchTransaction$1(editor, tr);
237168
237412
  return wrapperTarget;
237169
237413
  });
237170
237414
  }
@@ -237175,7 +237419,7 @@ function unwrapWrapper(editor, input2, options) {
237175
237419
  const resolved = resolveSdtByTarget(editor.state.doc, input2.target);
237176
237420
  const { tr } = editor.state;
237177
237421
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, resolved.node.content);
237178
- dispatchTransaction2(editor, tr);
237422
+ dispatchTransaction$1(editor, tr);
237179
237423
  return true;
237180
237424
  });
237181
237425
  }
@@ -237204,7 +237448,7 @@ function copyWrapper(editor, input2, options) {
237204
237448
  const { tr } = editor.state;
237205
237449
  const insertPos = dest.pos + dest.node.nodeSize;
237206
237450
  tr.insert(insertPos, cloned);
237207
- dispatchTransaction2(editor, tr);
237451
+ dispatchTransaction$1(editor, tr);
237208
237452
  return {
237209
237453
  kind: source.kind,
237210
237454
  nodeType: "sdt",
@@ -237222,7 +237466,7 @@ function moveWrapper(editor, input2, options) {
237222
237466
  const destAfterDelete = resolveSdtByTarget(tr.doc, input2.destination);
237223
237467
  const insertPos = destAfterDelete.pos + destAfterDelete.node.nodeSize;
237224
237468
  tr.insert(insertPos, source.node);
237225
- dispatchTransaction2(editor, tr);
237469
+ dispatchTransaction$1(editor, tr);
237226
237470
  return true;
237227
237471
  });
237228
237472
  }
@@ -237553,7 +237797,7 @@ function insertTextAroundSdt(editor, target, content3, resolvePos) {
237553
237797
  const tabType = editor.schema.nodes?.tab;
237554
237798
  const parentAllowsTab = tabType && content3.includes("\t") ? parentAllowsNodeAt(tr, pos, tabType) : false;
237555
237799
  tr.insert(pos, buildTextWithTabs(editor.schema, content3, undefined, { parentAllowsTab }));
237556
- dispatchTransaction2(editor, tr);
237800
+ dispatchTransaction$1(editor, tr);
237557
237801
  return true;
237558
237802
  }
237559
237803
  function insertBeforeWrapper(editor, input2, options) {
@@ -237968,7 +238212,7 @@ function repeatingSectionInsertItemBeforeWrapper(editor, input2, options) {
237968
238212
  }, paragraph2);
237969
238213
  const { tr } = editor.state;
237970
238214
  tr.insert(insertPos, newItem);
237971
- dispatchTransaction2(editor, tr);
238215
+ dispatchTransaction$1(editor, tr);
237972
238216
  return true;
237973
238217
  });
237974
238218
  }
@@ -237991,7 +238235,7 @@ function repeatingSectionInsertItemAfterWrapper(editor, input2, options) {
237991
238235
  }, paragraph2);
237992
238236
  const { tr } = editor.state;
237993
238237
  tr.insert(insertPos, newItem);
237994
- dispatchTransaction2(editor, tr);
238238
+ dispatchTransaction$1(editor, tr);
237995
238239
  return true;
237996
238240
  });
237997
238241
  }
@@ -238011,7 +238255,7 @@ function repeatingSectionCloneItemWrapper(editor, input2, options) {
238011
238255
  const insertPos = sourceItem.pos + sourceItem.node.nodeSize;
238012
238256
  const { tr } = editor.state;
238013
238257
  tr.insert(insertPos, cloned);
238014
- dispatchTransaction2(editor, tr);
238258
+ dispatchTransaction$1(editor, tr);
238015
238259
  return true;
238016
238260
  });
238017
238261
  }
@@ -238026,7 +238270,7 @@ function repeatingSectionDeleteItemWrapper(editor, input2, options) {
238026
238270
  const item = items[input2.index];
238027
238271
  const { tr } = editor.state;
238028
238272
  tr.delete(item.pos, item.pos + item.node.nodeSize);
238029
- dispatchTransaction2(editor, tr);
238273
+ dispatchTransaction$1(editor, tr);
238030
238274
  return true;
238031
238275
  });
238032
238276
  }
@@ -238054,7 +238298,7 @@ function groupWrapWrapper(editor, input2, options) {
238054
238298
  }, resolved.node);
238055
238299
  const { tr } = editor.state;
238056
238300
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, groupNode);
238057
- dispatchTransaction2(editor, tr);
238301
+ dispatchTransaction$1(editor, tr);
238058
238302
  return {
238059
238303
  kind: "block",
238060
238304
  nodeType: "sdt",
@@ -238070,7 +238314,7 @@ function groupUngroupWrapper(editor, input2, options) {
238070
238314
  const resolved = resolveSdtByTarget(editor.state.doc, input2.target);
238071
238315
  const { tr } = editor.state;
238072
238316
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, resolved.node.content);
238073
- dispatchTransaction2(editor, tr);
238317
+ dispatchTransaction$1(editor, tr);
238074
238318
  return true;
238075
238319
  });
238076
238320
  }
@@ -238127,14 +238371,14 @@ function createWrapper(editor, input2, options) {
238127
238371
  const insertPos = ref$1.pos + ref$1.node.nodeSize;
238128
238372
  const { tr } = editor.state;
238129
238373
  tr.insert(insertPos, newNode);
238130
- dispatchTransaction2(editor, tr);
238374
+ dispatchTransaction$1(editor, tr);
238131
238375
  return true;
238132
238376
  }
238133
238377
  if (input2.at) {
238134
238378
  const { absFrom, absTo } = resolveSelectionTarget(editor, input2.at);
238135
238379
  const { tr } = editor.state;
238136
238380
  tr.setSelection(TextSelection.create(tr.doc, absFrom, absTo));
238137
- dispatchTransaction2(editor, tr);
238381
+ dispatchTransaction$1(editor, tr);
238138
238382
  }
238139
238383
  const cmd = editor.commands?.[commandName];
238140
238384
  if (typeof cmd !== "function")
@@ -238244,11 +238488,11 @@ function createContentControlsAdapter(editor) {
238244
238488
  create: (input2, options) => createWrapper(editor, input2, options)
238245
238489
  };
238246
238490
  }
238247
- function getConverter$32(editor) {
238491
+ function getConverter$42(editor) {
238248
238492
  return editor.converter;
238249
238493
  }
238250
238494
  function requireConverter$1(editor, operationName) {
238251
- const converter = getConverter$32(editor);
238495
+ const converter = getConverter$42(editor);
238252
238496
  if (!converter)
238253
238497
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${operationName} requires an active document converter.`);
238254
238498
  return converter;
@@ -238354,7 +238598,7 @@ function headerFootersResolveAdapter(editor, input2) {
238354
238598
  function headerFootersRefsSetAdapter(editor, input2, options) {
238355
238599
  const { section, headerFooterKind, variant } = input2.target;
238356
238600
  const result = sectionMutationBySectPr(editor, { target: section }, options, "headerFooters.refs.set", (sectPr, _projection, _sections, dryRun) => {
238357
- const converter = getConverter$32(editor) ?? null;
238601
+ const converter = getConverter$42(editor) ?? null;
238358
238602
  return setHeaderFooterRefMutation(sectPr, headerFooterKind, variant, input2.refId, converter, "headerFooters.refs.set", dryRun);
238359
238603
  });
238360
238604
  invalidateSlotRuntimesAfterRefChange(editor, result, options);
@@ -238363,7 +238607,7 @@ function headerFootersRefsSetAdapter(editor, input2, options) {
238363
238607
  function headerFootersRefsClearAdapter(editor, input2, options) {
238364
238608
  const { section, headerFooterKind, variant } = input2.target;
238365
238609
  const result = sectionMutationBySectPr(editor, { target: section }, options, "headerFooters.refs.clear", (sectPr, _projection, _sections, dryRun) => {
238366
- clearHeaderFooterRefMutation(sectPr, headerFooterKind, variant, getConverter$32(editor) ?? null, dryRun);
238610
+ clearHeaderFooterRefMutation(sectPr, headerFooterKind, variant, getConverter$42(editor) ?? null, dryRun);
238367
238611
  });
238368
238612
  invalidateSlotRuntimesAfterRefChange(editor, result, options);
238369
238613
  return result;
@@ -239226,15 +239470,15 @@ function getLocalName2(name) {
239226
239470
  const i4 = name.indexOf(":");
239227
239471
  return i4 >= 0 ? name.slice(i4 + 1) : name;
239228
239472
  }
239229
- function findFirstElement(parent, localName) {
239473
+ function findFirstElement(parent, localName$1) {
239230
239474
  if (!parent?.elements?.length)
239231
239475
  return null;
239232
- return parent.elements.find((el) => el?.type === "element" && getLocalName2(el.name) === localName) ?? null;
239476
+ return parent.elements.find((el) => el?.type === "element" && getLocalName2(el.name) === localName$1) ?? null;
239233
239477
  }
239234
- function findAllElements(parent, localName) {
239478
+ function findAllElements(parent, localName$1) {
239235
239479
  if (!parent?.elements?.length)
239236
239480
  return [];
239237
- return parent.elements.filter((el) => el?.type === "element" && getLocalName2(el.name) === localName);
239481
+ return parent.elements.filter((el) => el?.type === "element" && getLocalName2(el.name) === localName$1);
239238
239482
  }
239239
239483
  function partNameFromIndex(index2) {
239240
239484
  return `customXml/item${index2}.xml`;
@@ -239604,13 +239848,13 @@ function invalidateConverterCachesForPath(converter, partName) {
239604
239848
  version: null
239605
239849
  };
239606
239850
  }
239607
- function getConverter$22(editor) {
239851
+ function getConverter$32(editor) {
239608
239852
  return editor.converter ?? null;
239609
239853
  }
239610
- function getConvertedXml2(editor) {
239611
- return getConverter$22(editor)?.convertedXml ?? {};
239854
+ function getConvertedXml$1(editor) {
239855
+ return getConverter$32(editor)?.convertedXml ?? {};
239612
239856
  }
239613
- function toSummary(record3) {
239857
+ function toSummary$1(record3) {
239614
239858
  const summary = {
239615
239859
  partName: record3.partName,
239616
239860
  schemaRefs: record3.schemaRefs
@@ -239625,13 +239869,13 @@ function toSummary(record3) {
239625
239869
  }
239626
239870
  function customXmlPartsListWrapper(editor, query) {
239627
239871
  const revision = getRevision(editor);
239628
- let filtered = listCustomXmlParts(getConvertedXml2(editor));
239872
+ let filtered = listCustomXmlParts(getConvertedXml$1(editor));
239629
239873
  if (query?.rootNamespace !== undefined)
239630
239874
  filtered = filtered.filter((p$12) => p$12.rootNamespace === query.rootNamespace);
239631
239875
  if (query?.schemaRef !== undefined)
239632
239876
  filtered = filtered.filter((p$12) => p$12.schemaRefs.includes(query.schemaRef));
239633
239877
  const { total, items: paged } = paginate(filtered.map((record3) => {
239634
- const summary = toSummary(record3);
239878
+ const summary = toSummary$1(record3);
239635
239879
  const stableId = summary.id ?? summary.partName;
239636
239880
  return buildDiscoveryItem(stableId, buildResolvedHandle(`customXml:${stableId}`, "ephemeral", "ext:customXmlPart"), summary);
239637
239881
  }), query?.offset, query?.limit);
@@ -239647,7 +239891,7 @@ function customXmlPartsListWrapper(editor, query) {
239647
239891
  });
239648
239892
  }
239649
239893
  function customXmlPartsGetWrapper(editor, input2) {
239650
- const record3 = readCustomXmlPart(getConvertedXml2(editor), input2.target);
239894
+ const record3 = readCustomXmlPart(getConvertedXml$1(editor), input2.target);
239651
239895
  if (!record3)
239652
239896
  return null;
239653
239897
  const info = {
@@ -239662,7 +239906,7 @@ function customXmlPartsGetWrapper(editor, input2) {
239662
239906
  info.propsPartName = record3.propsPartName;
239663
239907
  return info;
239664
239908
  }
239665
- function failure(code7, message) {
239909
+ function failure$1(code7, message) {
239666
239910
  return {
239667
239911
  success: false,
239668
239912
  failure: {
@@ -239720,10 +239964,10 @@ function customXmlPartsCreateWrapper(editor, input2, options) {
239720
239964
  }
239721
239965
  };
239722
239966
  }
239723
- const probe = safeValidate(() => createCustomXmlPart(getConvertedXml2(editor), {
239967
+ const probe = safeValidate(() => createCustomXmlPart(getConvertedXml$1(editor), {
239724
239968
  content: input2.content,
239725
239969
  schemaRefs: input2.schemaRefs
239726
- }, getConverter$22(editor)));
239970
+ }, getConverter$32(editor)));
239727
239971
  if (isWriteFailure(probe))
239728
239972
  return {
239729
239973
  changed: false,
@@ -239741,7 +239985,7 @@ function customXmlPartsCreateWrapper(editor, input2, options) {
239741
239985
  expectedRevision: options?.expectedRevision
239742
239986
  });
239743
239987
  if (isWriteFailure(outcome))
239744
- return failure(outcome.code, outcome.message);
239988
+ return failure$1(outcome.code, outcome.message);
239745
239989
  return {
239746
239990
  success: true,
239747
239991
  id: outcome.payload.id,
@@ -239753,7 +239997,7 @@ function customXmlPartsPatchWrapper(editor, input2, options) {
239753
239997
  rejectTrackedMode("customXml.parts.patch", options);
239754
239998
  const outcome = executeOutOfBandMutation(editor, (dryRun) => {
239755
239999
  if (dryRun) {
239756
- if (!resolveTargetPartName(getConvertedXml2(editor), input2.target))
240000
+ if (!resolveTargetPartName(getConvertedXml$1(editor), input2.target))
239757
240001
  return {
239758
240002
  changed: false,
239759
240003
  payload: targetNotFound()
@@ -239777,15 +240021,15 @@ function customXmlPartsPatchWrapper(editor, input2, options) {
239777
240021
  }
239778
240022
  };
239779
240023
  }
239780
- if (!resolveTargetPartName(getConvertedXml2(editor), input2.target))
240024
+ if (!resolveTargetPartName(getConvertedXml$1(editor), input2.target))
239781
240025
  return {
239782
240026
  changed: false,
239783
240027
  payload: targetNotFound()
239784
240028
  };
239785
- const probe = safeValidate(() => patchCustomXmlPart(getConvertedXml2(editor), input2.target, {
240029
+ const probe = safeValidate(() => patchCustomXmlPart(getConvertedXml$1(editor), input2.target, {
239786
240030
  content: input2.content,
239787
240031
  schemaRefs: input2.schemaRefs
239788
- }, getConverter$22(editor)));
240032
+ }, getConverter$32(editor)));
239789
240033
  if (isWriteFailure(probe))
239790
240034
  return {
239791
240035
  changed: false,
@@ -239808,7 +240052,7 @@ function customXmlPartsPatchWrapper(editor, input2, options) {
239808
240052
  expectedRevision: options?.expectedRevision
239809
240053
  });
239810
240054
  if (isWriteFailure(outcome))
239811
- return failure(outcome.code, outcome.message);
240055
+ return failure$1(outcome.code, outcome.message);
239812
240056
  const result = {
239813
240057
  success: true,
239814
240058
  target: input2.target
@@ -239821,7 +240065,7 @@ function customXmlPartsRemoveWrapper(editor, input2, options) {
239821
240065
  rejectTrackedMode("customXml.parts.remove", options);
239822
240066
  const outcome = executeOutOfBandMutation(editor, (dryRun) => {
239823
240067
  if (dryRun)
239824
- return resolveTargetPartName(getConvertedXml2(editor), input2.target) ? {
240068
+ return resolveTargetPartName(getConvertedXml$1(editor), input2.target) ? {
239825
240069
  changed: false,
239826
240070
  payload: {
239827
240071
  ok: true,
@@ -239831,7 +240075,7 @@ function customXmlPartsRemoveWrapper(editor, input2, options) {
239831
240075
  changed: false,
239832
240076
  payload: targetNotFound()
239833
240077
  };
239834
- if (!removeCustomXmlPart(getConvertedXml2(editor), input2.target, getConverter$22(editor)))
240078
+ if (!removeCustomXmlPart(getConvertedXml$1(editor), input2.target, getConverter$32(editor)))
239835
240079
  return {
239836
240080
  changed: false,
239837
240081
  payload: targetNotFound()
@@ -239848,7 +240092,7 @@ function customXmlPartsRemoveWrapper(editor, input2, options) {
239848
240092
  expectedRevision: options?.expectedRevision
239849
240093
  });
239850
240094
  if (isWriteFailure(outcome))
239851
- return failure(outcome.code, outcome.message);
240095
+ return failure$1(outcome.code, outcome.message);
239852
240096
  return {
239853
240097
  success: true,
239854
240098
  target: input2.target
@@ -239863,6 +240107,429 @@ function createCustomXmlPartsAdapter(editor) {
239863
240107
  remove: (input2, options) => customXmlPartsRemoveWrapper(editor, input2, options)
239864
240108
  };
239865
240109
  }
240110
+ function failure(code7, message) {
240111
+ return {
240112
+ success: false,
240113
+ failure: {
240114
+ code: code7,
240115
+ message
240116
+ }
240117
+ };
240118
+ }
240119
+ function getConverter$22(editor) {
240120
+ return editor.converter ?? null;
240121
+ }
240122
+ function getConvertedXml2(editor) {
240123
+ return getConverter$22(editor)?.convertedXml ?? {};
240124
+ }
240125
+ function markConverterDirty(editor) {
240126
+ const converter = getConverter$22(editor);
240127
+ if (!converter)
240128
+ return;
240129
+ converter.documentModified = true;
240130
+ if (!converter.documentGuid && typeof converter.promoteToGuid === "function")
240131
+ converter.promoteToGuid();
240132
+ }
240133
+ function getRootElement2(doc$12) {
240134
+ return doc$12?.elements?.find((el) => el?.type === "element") ?? null;
240135
+ }
240136
+ function localName(name) {
240137
+ if (!name)
240138
+ return "";
240139
+ const idx = name.indexOf(":");
240140
+ return idx >= 0 ? name.slice(idx + 1) : name;
240141
+ }
240142
+ function getTextContent(node2) {
240143
+ if (!node2)
240144
+ return "";
240145
+ if (node2.type === "text")
240146
+ return node2.text ?? "";
240147
+ if (node2.type === "cdata")
240148
+ return node2.cdata ?? "";
240149
+ return (node2.elements ?? []).map((child) => getTextContent(child)).join("");
240150
+ }
240151
+ function escapeXmlText(value) {
240152
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
240153
+ }
240154
+ function escapeXmlAttribute(value) {
240155
+ return escapeXmlText(value).replace(/"/g, "&quot;").replace(/'/g, "&apos;");
240156
+ }
240157
+ function buildEnvelopeXml(namespace, entries) {
240158
+ const children = entries.map((entry) => {
240159
+ const json2 = JSON.stringify(entry.payload);
240160
+ return `<ref id="${escapeXmlAttribute(entry.id)}" encoding="json">${escapeXmlText(json2)}</ref>`;
240161
+ }).join("");
240162
+ return `<refs xmlns="${escapeXmlAttribute(namespace)}">${children}</refs>`;
240163
+ }
240164
+ function parseMetadataPart(convertedXml, partName) {
240165
+ const root3 = getRootElement2(convertedXml[partName]);
240166
+ if (!root3 || localName(root3.name) !== "refs")
240167
+ return null;
240168
+ const namespace = parseStoragePartRootNamespace(convertedXml[partName]);
240169
+ if (typeof namespace !== "string" || namespace.length === 0)
240170
+ return null;
240171
+ const entries = [];
240172
+ for (const child of root3.elements ?? []) {
240173
+ if (child?.type !== "element" || localName(child.name) !== "ref")
240174
+ continue;
240175
+ if (child.attributes?.encoding !== "json")
240176
+ continue;
240177
+ const id2 = child.attributes?.id;
240178
+ if (typeof id2 !== "string" || id2.length === 0)
240179
+ continue;
240180
+ try {
240181
+ entries.push({
240182
+ id: id2,
240183
+ namespace,
240184
+ partName,
240185
+ payload: JSON.parse(getTextContent(child))
240186
+ });
240187
+ } catch {
240188
+ continue;
240189
+ }
240190
+ }
240191
+ return {
240192
+ namespace,
240193
+ partName,
240194
+ entries
240195
+ };
240196
+ }
240197
+ function listMetadataParts(convertedXml) {
240198
+ return listCustomXmlParts(convertedXml).map((part) => parseMetadataPart(convertedXml, part.partName)).filter((part) => part !== null);
240199
+ }
240200
+ function findPartByNamespace(convertedXml, namespace) {
240201
+ return listMetadataParts(convertedXml).find((part) => part.namespace === namespace) ?? null;
240202
+ }
240203
+ function findEntry(convertedXml, id2) {
240204
+ for (const part of listMetadataParts(convertedXml)) {
240205
+ const entry = part.entries.find((candidate) => candidate.id === id2);
240206
+ if (entry)
240207
+ return entry;
240208
+ }
240209
+ return null;
240210
+ }
240211
+ function hasPayloadEntry(convertedXml, id2) {
240212
+ return findEntry(convertedXml, id2) !== null;
240213
+ }
240214
+ function predictPartName(convertedXml, converter) {
240215
+ return `customXml/item${nextCustomXmlItemIndex(convertedXml, converter)}.xml`;
240216
+ }
240217
+ function buildAnchorAttrs(id2) {
240218
+ return {
240219
+ id: generateRandomSigned32BitIntStrId(),
240220
+ tag: id2,
240221
+ alias: "Anchored metadata",
240222
+ appearance: "hidden",
240223
+ controlType: "richText",
240224
+ type: "richText",
240225
+ sdtPr: {
240226
+ name: "w:sdtPr",
240227
+ type: "element",
240228
+ elements: [{
240229
+ name: "w:richText",
240230
+ type: "element"
240231
+ }, {
240232
+ name: "w15:appearance",
240233
+ type: "element",
240234
+ attributes: { "w15:val": "hidden" }
240235
+ }]
240236
+ }
240237
+ };
240238
+ }
240239
+ function dispatchTransaction2(editor, tr) {
240240
+ if (editor.view?.dispatch) {
240241
+ editor.view.dispatch(tr);
240242
+ return;
240243
+ }
240244
+ if (typeof editor.dispatch === "function") {
240245
+ editor.dispatch(tr);
240246
+ return;
240247
+ }
240248
+ throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "metadata.* requires an editor dispatch function.");
240249
+ }
240250
+ function findAnchorsById(editor, id2) {
240251
+ return findAllSdtNodes(editor.state.doc).filter((sdt) => sdt.kind === "inline" && sdt.node.attrs?.tag === id2);
240252
+ }
240253
+ function hasAnchor(editor, id2) {
240254
+ return findAllSdtNodes(editor.state.doc).some((sdt) => sdt.node.attrs?.tag === id2);
240255
+ }
240256
+ function wrapRangeInAnchor(editor, target, id2) {
240257
+ const { absFrom, absTo } = resolveSelectionTarget(editor, target);
240258
+ if (absFrom >= absTo)
240259
+ throw new DocumentApiAdapterError("INVALID_TARGET", "metadata.attach requires a non-empty text range.");
240260
+ const nodeType = editor.schema.nodes[SDT_INLINE_NAME];
240261
+ if (!nodeType)
240262
+ throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "Inline content-control node is not available.");
240263
+ const { tr } = editor.state;
240264
+ const attrs = buildAnchorAttrs(id2);
240265
+ const runType = editor.schema.nodes.run;
240266
+ const $from = tr.doc.resolve(absFrom);
240267
+ const $to = tr.doc.resolve(absTo);
240268
+ if (runType && $from.parent.type === runType && $from.parent === $to.parent) {
240269
+ const runDepth = $from.depth;
240270
+ const runStart = $from.before(runDepth);
240271
+ const runEnd = $from.after(runDepth);
240272
+ const parentRun = $from.parent;
240273
+ const selectedContent = parentRun.content.cut($from.parentOffset, $to.parentOffset);
240274
+ const leftContent = parentRun.content.cut(0, $from.parentOffset);
240275
+ const rightContent = parentRun.content.cut($to.parentOffset);
240276
+ const sdtNode = nodeType.create(attrs, selectedContent);
240277
+ const replacement = [];
240278
+ if (leftContent.size > 0)
240279
+ replacement.push(runType.create(parentRun.attrs, leftContent, parentRun.marks));
240280
+ replacement.push(sdtNode);
240281
+ if (rightContent.size > 0)
240282
+ replacement.push(runType.create(parentRun.attrs, rightContent, parentRun.marks));
240283
+ tr.replaceWith(runStart, runEnd, replacement);
240284
+ } else {
240285
+ const selected = tr.doc.slice(absFrom, absTo);
240286
+ const sdtNode = nodeType.create(attrs, selected.content);
240287
+ tr.replaceWith(absFrom, absTo, sdtNode);
240288
+ }
240289
+ dispatchTransaction2(editor, tr);
240290
+ clearIndexCache(editor);
240291
+ return true;
240292
+ }
240293
+ function unwrapAnchor(editor, id2) {
240294
+ const anchor = findAnchorsById(editor, id2)[0];
240295
+ if (!anchor)
240296
+ return false;
240297
+ const { tr } = editor.state;
240298
+ tr.replaceWith(anchor.pos, anchor.pos + anchor.node.nodeSize, anchor.node.content);
240299
+ dispatchTransaction2(editor, tr);
240300
+ clearIndexCache(editor);
240301
+ return true;
240302
+ }
240303
+ function pointFromPmPosition(editor, pos) {
240304
+ const index2 = getBlockIndex(editor);
240305
+ for (const candidate of index2.candidates) {
240306
+ if (!isTextBlockCandidate(candidate))
240307
+ continue;
240308
+ const contentStart = candidate.pos + 1;
240309
+ const contentEnd = candidate.end - 1;
240310
+ if (pos >= contentStart && pos <= contentEnd)
240311
+ return {
240312
+ kind: "text",
240313
+ blockId: candidate.nodeId,
240314
+ offset: pmPositionToTextOffset(candidate.node, candidate.pos, pos)
240315
+ };
240316
+ }
240317
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Could not resolve metadata anchor to a text range.");
240318
+ }
240319
+ function resolveAnchorTarget(editor, id2) {
240320
+ const anchor = findAnchorsById(editor, id2)[0];
240321
+ if (!anchor)
240322
+ return null;
240323
+ return {
240324
+ kind: "selection",
240325
+ start: pointFromPmPosition(editor, anchor.pos + 1),
240326
+ end: pointFromPmPosition(editor, anchor.pos + anchor.node.nodeSize - 1)
240327
+ };
240328
+ }
240329
+ function rangesOverlap$1(aFrom, aTo, bFrom, bTo) {
240330
+ if (aFrom === aTo || bFrom === bTo)
240331
+ return aFrom <= bTo && bFrom <= aTo;
240332
+ return aFrom < bTo && bFrom < aTo;
240333
+ }
240334
+ function anchorOverlaps(editor, id2, within$1) {
240335
+ const anchor = findAnchorsById(editor, id2)[0];
240336
+ if (!anchor)
240337
+ return false;
240338
+ const query = resolveSelectionTarget(editor, within$1);
240339
+ return rangesOverlap$1(anchor.pos + 1, anchor.pos + anchor.node.nodeSize - 1, query.absFrom, query.absTo);
240340
+ }
240341
+ function writeEntry(editor, namespace, id2, payload, dryRun) {
240342
+ const convertedXml = getConvertedXml2(editor);
240343
+ const converter = getConverter$22(editor);
240344
+ const existing = findPartByNamespace(convertedXml, namespace);
240345
+ const entries = existing?.entries.filter((entry) => entry.id !== id2) ?? [];
240346
+ const next2 = {
240347
+ id: id2,
240348
+ namespace,
240349
+ partName: existing?.partName ?? predictPartName(convertedXml, converter),
240350
+ payload
240351
+ };
240352
+ const xml2 = buildEnvelopeXml(namespace, [...entries, next2]);
240353
+ if (dryRun)
240354
+ return { partName: next2.partName };
240355
+ if (existing) {
240356
+ patchCustomXmlPart(convertedXml, { partName: existing.partName }, {
240357
+ content: xml2,
240358
+ schemaRefs: undefined
240359
+ }, converter ?? undefined);
240360
+ markConverterDirty(editor);
240361
+ return { partName: existing.partName };
240362
+ }
240363
+ const created = createCustomXmlPart(convertedXml, {
240364
+ content: xml2,
240365
+ schemaRefs: undefined
240366
+ }, converter ?? undefined);
240367
+ markConverterDirty(editor);
240368
+ return { partName: created.partName };
240369
+ }
240370
+ function removeEntry(editor, id2, dryRun) {
240371
+ const convertedXml = getConvertedXml2(editor);
240372
+ const converter = getConverter$22(editor);
240373
+ const part = listMetadataParts(convertedXml).find((candidate) => candidate.entries.some((entry) => entry.id === id2));
240374
+ if (!part)
240375
+ return false;
240376
+ if (dryRun)
240377
+ return true;
240378
+ const remaining = part.entries.filter((entry) => entry.id !== id2);
240379
+ if (remaining.length === 0)
240380
+ removeCustomXmlPart(convertedXml, { partName: part.partName }, converter ?? undefined);
240381
+ else
240382
+ patchCustomXmlPart(convertedXml, { partName: part.partName }, {
240383
+ content: buildEnvelopeXml(part.namespace, remaining),
240384
+ schemaRefs: undefined
240385
+ }, converter ?? undefined);
240386
+ markConverterDirty(editor);
240387
+ return true;
240388
+ }
240389
+ function toSummary(entry) {
240390
+ return {
240391
+ id: entry.id,
240392
+ namespace: entry.namespace,
240393
+ partName: entry.partName
240394
+ };
240395
+ }
240396
+ function listEntries(editor, query) {
240397
+ let entries = listMetadataParts(getConvertedXml2(editor)).flatMap((part) => part.entries);
240398
+ if (query?.namespace !== undefined)
240399
+ entries = entries.filter((entry) => entry.namespace === query.namespace);
240400
+ if (query?.within !== undefined)
240401
+ entries = entries.filter((entry) => anchorOverlaps(editor, entry.id, query.within));
240402
+ return entries;
240403
+ }
240404
+ function metadataListWrapper(editor, query) {
240405
+ const { total, items } = paginate(listEntries(editor, query).map((entry) => {
240406
+ const summary = toSummary(entry);
240407
+ return buildDiscoveryItem(summary.id, buildResolvedHandle(`metadata:${summary.id}`, "ephemeral", "ext:anchoredMetadata"), summary);
240408
+ }), query?.offset, query?.limit);
240409
+ return buildDiscoveryResult({
240410
+ evaluatedRevision: getRevision(editor),
240411
+ total,
240412
+ items,
240413
+ page: {
240414
+ limit: query?.limit ?? total,
240415
+ offset: query?.offset ?? 0,
240416
+ returned: items.length
240417
+ }
240418
+ });
240419
+ }
240420
+ function metadataGetWrapper(editor, input2) {
240421
+ return findEntry(getConvertedXml2(editor), input2.id);
240422
+ }
240423
+ function metadataResolveWrapper(editor, input2) {
240424
+ const target = resolveAnchorTarget(editor, input2.id);
240425
+ return target ? {
240426
+ id: input2.id,
240427
+ target
240428
+ } : null;
240429
+ }
240430
+ function metadataAttachWrapper(editor, input2, options) {
240431
+ rejectTrackedMode("metadata.attach", options);
240432
+ const id2 = input2.id ?? v4_default();
240433
+ const convertedXml = getConvertedXml2(editor);
240434
+ try {
240435
+ resolveSelectionTarget(editor, input2.target);
240436
+ } catch (error48) {
240437
+ return failure("INVALID_TARGET", error48 instanceof Error ? error48.message : String(error48));
240438
+ }
240439
+ if (hasPayloadEntry(convertedXml, id2) || hasAnchor(editor, id2))
240440
+ return failure("INVALID_INPUT", `Anchored metadata id "${id2}" already exists.`);
240441
+ const preview = writeEntry(editor, input2.namespace, id2, input2.payload, true);
240442
+ if (options?.dryRun) {
240443
+ checkRevision(editor, options.expectedRevision);
240444
+ return {
240445
+ success: true,
240446
+ id: id2,
240447
+ namespace: input2.namespace,
240448
+ partName: preview.partName
240449
+ };
240450
+ }
240451
+ if (executeDomainCommand(editor, () => {
240452
+ wrapRangeInAnchor(editor, input2.target, id2);
240453
+ writeEntry(editor, input2.namespace, id2, input2.payload, false);
240454
+ return true;
240455
+ }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
240456
+ return failure("INVALID_TARGET", "metadata.attach did not change the document.");
240457
+ const entry = findEntry(getConvertedXml2(editor), id2);
240458
+ return {
240459
+ success: true,
240460
+ id: id2,
240461
+ namespace: input2.namespace,
240462
+ partName: entry?.partName ?? preview.partName
240463
+ };
240464
+ }
240465
+ function metadataUpdateWrapper(editor, input2, options) {
240466
+ rejectTrackedMode("metadata.update", options);
240467
+ const existing = findEntry(getConvertedXml2(editor), input2.id);
240468
+ if (!existing)
240469
+ return failure("TARGET_NOT_FOUND", `Anchored metadata entry "${input2.id}" not found.`);
240470
+ return executeOutOfBandMutation(editor, (dryRun) => {
240471
+ if (!dryRun)
240472
+ writeEntry(editor, existing.namespace, input2.id, input2.payload, false);
240473
+ return {
240474
+ changed: true,
240475
+ payload: {
240476
+ success: true,
240477
+ id: input2.id
240478
+ }
240479
+ };
240480
+ }, {
240481
+ dryRun: options?.dryRun ?? false,
240482
+ expectedRevision: options?.expectedRevision
240483
+ });
240484
+ }
240485
+ function metadataRemoveWrapper(editor, input2, options) {
240486
+ rejectTrackedMode("metadata.remove", options);
240487
+ const payloadExists = hasPayloadEntry(getConvertedXml2(editor), input2.id);
240488
+ const anchorExists = hasAnchor(editor, input2.id);
240489
+ if (!payloadExists && !anchorExists)
240490
+ return failure("TARGET_NOT_FOUND", `Anchored metadata entry "${input2.id}" not found.`);
240491
+ if (options?.dryRun) {
240492
+ checkRevision(editor, options.expectedRevision);
240493
+ return {
240494
+ success: true,
240495
+ id: input2.id
240496
+ };
240497
+ }
240498
+ if (!anchorExists)
240499
+ return executeOutOfBandMutation(editor, (dryRun) => {
240500
+ return {
240501
+ changed: removeEntry(editor, input2.id, dryRun),
240502
+ payload: {
240503
+ success: true,
240504
+ id: input2.id
240505
+ }
240506
+ };
240507
+ }, {
240508
+ dryRun: false,
240509
+ expectedRevision: options?.expectedRevision
240510
+ });
240511
+ if (executeDomainCommand(editor, () => {
240512
+ unwrapAnchor(editor, input2.id);
240513
+ removeEntry(editor, input2.id, false);
240514
+ markConverterDirty(editor);
240515
+ return true;
240516
+ }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
240517
+ return failure("TARGET_NOT_FOUND", `Anchored metadata entry "${input2.id}" not found.`);
240518
+ return {
240519
+ success: true,
240520
+ id: input2.id
240521
+ };
240522
+ }
240523
+ function createAnchoredMetadataAdapter(editor) {
240524
+ return {
240525
+ attach: (input2, options) => metadataAttachWrapper(editor, input2, options),
240526
+ list: (query) => metadataListWrapper(editor, query),
240527
+ get: (input2) => metadataGetWrapper(editor, input2),
240528
+ update: (input2, options) => metadataUpdateWrapper(editor, input2, options),
240529
+ remove: (input2, options) => metadataRemoveWrapper(editor, input2, options),
240530
+ resolve: (input2) => metadataResolveWrapper(editor, input2)
240531
+ };
240532
+ }
239866
240533
  function getConverter$12(editor) {
239867
240534
  return editor.converter ?? undefined;
239868
240535
  }
@@ -243477,6 +244144,7 @@ function assembleDocumentApiAdapters(editor) {
243477
244144
  remove: (input2, options) => bookmarksRemoveWrapper(editor, input2, options)
243478
244145
  },
243479
244146
  customXml: { parts: createCustomXmlPartsAdapter(editor) },
244147
+ metadata: createAnchoredMetadataAdapter(editor),
243480
244148
  footnotes: {
243481
244149
  list: (query) => footnotesListWrapper(editor, query),
243482
244150
  get: (input2) => footnotesGetWrapper(editor, input2),
@@ -268671,15 +269339,15 @@ var Node$13 = class Node$14 {
268671
269339
  return false;
268672
269340
  if ($from.parent.type.name !== "run")
268673
269341
  return false;
268674
- let dispatchTransaction$2 = null;
269342
+ let dispatchTransaction$3 = null;
268675
269343
  if (view?.dispatch)
268676
- dispatchTransaction$2 = view.dispatch.bind(view);
269344
+ dispatchTransaction$3 = view.dispatch.bind(view);
268677
269345
  else if (editor?.dispatch)
268678
- dispatchTransaction$2 = editor.dispatch.bind(editor);
268679
- if (!dispatchTransaction$2)
269346
+ dispatchTransaction$3 = editor.dispatch.bind(editor);
269347
+ if (!dispatchTransaction$3)
268680
269348
  return false;
268681
269349
  const handled = splitBlockPatch(state, (transaction) => {
268682
- dispatchTransaction$2(transaction);
269350
+ dispatchTransaction$3(transaction);
268683
269351
  }, editor);
268684
269352
  if (handled)
268685
269353
  tr.setMeta("preventDispatch", true);
@@ -279450,11 +280118,11 @@ var Node$13 = class Node$14 {
279450
280118
  this.eventListenerCleanups = [];
279451
280119
  this.resizeTimeoutId = null;
279452
280120
  }
279453
- attach({ element: element3, state, editorProps = {}, dispatchTransaction: dispatchTransaction$2, handleClick: handleClick$1 }) {
280121
+ attach({ element: element3, state, editorProps = {}, dispatchTransaction: dispatchTransaction$3, handleClick: handleClick$1 }) {
279454
280122
  this.view?.destroy();
279455
280123
  this.view = new EditorView(element3, {
279456
280124
  ...editorProps && typeof editorProps === "object" ? editorProps : {},
279457
- dispatchTransaction: dispatchTransaction$2,
280125
+ dispatchTransaction: dispatchTransaction$3,
279458
280126
  state,
279459
280127
  handleClick: handleClick$1
279460
280128
  });
@@ -296352,13 +297020,13 @@ menclose::after {
296352
297020
  return;
296353
297021
  console.log(...args$1);
296354
297022
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
296355
- var init_src_DFDWy3T0_es = __esm(() => {
297023
+ var init_src_D_jA08Jh_es = __esm(() => {
296356
297024
  init_rolldown_runtime_Bg48TavK_es();
296357
- init_SuperConverter_BLUJyRB9_es();
297025
+ init_SuperConverter_CzwJ7ds9_es();
296358
297026
  init_jszip_C49i9kUs_es();
296359
297027
  init_xml_js_CqGKpaft_es();
296360
297028
  init_uuid_qzgm05fK_es();
296361
- init_create_headless_toolbar_B_8QJyHX_es();
297029
+ init_create_headless_toolbar_BQTnHkb4_es();
296362
297030
  init_constants_DrU4EASo_es();
296363
297031
  init_dist_B8HfvhaK_es();
296364
297032
  init_unified_Dsuw2be5_es();
@@ -319845,7 +320513,7 @@ function print() { __p += __j.call(arguments, '') }
319845
320513
  stylesPartDescriptor = {
319846
320514
  id: STYLES_PART_ID,
319847
320515
  ensurePart(editor) {
319848
- const converter = getConverter$62(editor);
320516
+ const converter = getConverter$72(editor);
319849
320517
  if (converter?.convertedXml[STYLES_PART_ID])
319850
320518
  return converter.convertedXml[STYLES_PART_ID];
319851
320519
  return {
@@ -319860,7 +320528,7 @@ function print() { __p += __j.call(arguments, '') }
319860
320528
  },
319861
320529
  afterCommit(ctx$1) {
319862
320530
  if (ctx$1.source.startsWith("collab:remote:")) {
319863
- const converter = getConverter$62(ctx$1.editor);
320531
+ const converter = getConverter$72(ctx$1.editor);
319864
320532
  if (converter)
319865
320533
  try {
319866
320534
  converter.translatedLinkedStyles = translateStyleDefinitions(converter.convertedXml);
@@ -320505,14 +321173,14 @@ function print() { __p += __j.call(arguments, '') }
320505
321173
  if (!allowed.includes(this.#editorLifecycleState))
320506
321174
  throw new InvalidStateError(`Invalid operation: editor is in '${this.#editorLifecycleState}' state, expected one of: ${allowed.join(", ")}`);
320507
321175
  }
320508
- async#withState(during, success2, failure$1, operation) {
321176
+ async#withState(during, success2, failure$2, operation) {
320509
321177
  this.#editorLifecycleState = during;
320510
321178
  try {
320511
321179
  const result = await operation();
320512
321180
  this.#editorLifecycleState = success2;
320513
321181
  return result;
320514
321182
  } catch (error48) {
320515
- this.#editorLifecycleState = failure$1;
321183
+ this.#editorLifecycleState = failure$2;
320516
321184
  throw error48;
320517
321185
  }
320518
321186
  }
@@ -334051,11 +334719,11 @@ function print() { __p += __j.call(arguments, '') }
334051
334719
  ];
334052
334720
  });
334053
334721
 
334054
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BwjbzdvS.es.js
334722
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BNIXtF7U.es.js
334055
334723
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
334056
- var init_create_super_doc_ui_BwjbzdvS_es = __esm(() => {
334057
- init_SuperConverter_BLUJyRB9_es();
334058
- init_create_headless_toolbar_B_8QJyHX_es();
334724
+ var init_create_super_doc_ui_BNIXtF7U_es = __esm(() => {
334725
+ init_SuperConverter_CzwJ7ds9_es();
334726
+ init_create_headless_toolbar_BQTnHkb4_es();
334059
334727
  MOD_ALIASES = new Set([
334060
334728
  "Mod",
334061
334729
  "Meta",
@@ -334097,16 +334765,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
334097
334765
 
334098
334766
  // ../../packages/superdoc/dist/super-editor.es.js
334099
334767
  var init_super_editor_es = __esm(() => {
334100
- init_src_DFDWy3T0_es();
334101
- init_SuperConverter_BLUJyRB9_es();
334768
+ init_src_D_jA08Jh_es();
334769
+ init_SuperConverter_CzwJ7ds9_es();
334102
334770
  init_jszip_C49i9kUs_es();
334103
334771
  init_xml_js_CqGKpaft_es();
334104
- init_create_headless_toolbar_B_8QJyHX_es();
334772
+ init_create_headless_toolbar_BQTnHkb4_es();
334105
334773
  init_constants_DrU4EASo_es();
334106
334774
  init_dist_B8HfvhaK_es();
334107
334775
  init_unified_Dsuw2be5_es();
334108
334776
  init_DocxZipper_DoY5OEjc_es();
334109
- init_create_super_doc_ui_BwjbzdvS_es();
334777
+ init_create_super_doc_ui_BNIXtF7U_es();
334110
334778
  init_ui_C5PAS9hY_es();
334111
334779
  init_eventemitter3_BnGqBE_Q_es();
334112
334780
  init_errors_CNaD6vcg_es();
@@ -341205,6 +341873,85 @@ More content with **bold** and *italic*.`
341205
341873
  }),
341206
341874
  referenceDocPath: "custom-xml/parts/remove.mdx",
341207
341875
  referenceGroup: "customXml"
341876
+ },
341877
+ "metadata.attach": {
341878
+ memberPath: "metadata.attach",
341879
+ description: "Anchor a JSON metadata payload to a span of text. " + "Wraps the target range in a hidden inline content control whose w:tag carries a stable id, and stores the payload in a namespaced Custom XML Data Storage Part. " + "v1 supports text-range anchors only.",
341880
+ expectedResult: "Returns an AnchoredMetadataAttachResult with the assigned id and the backing Storage Part name on success.",
341881
+ requiresDocumentContext: true,
341882
+ metadata: mutationOperation2({
341883
+ idempotency: "non-idempotent",
341884
+ supportsDryRun: true,
341885
+ supportsTrackedMode: false,
341886
+ possibleFailureCodes: ["TARGET_NOT_FOUND", "INVALID_TARGET", "INVALID_INPUT"],
341887
+ throws: [...T_REF_INSERT2, "REVISION_MISMATCH"]
341888
+ }),
341889
+ referenceDocPath: "metadata/attach.mdx",
341890
+ referenceGroup: "metadata"
341891
+ },
341892
+ "metadata.list": {
341893
+ memberPath: "metadata.list",
341894
+ description: "List anchored-metadata entries in the document, optionally filtered by consumer namespace and/or a `within` selection (returns only entries whose anchor overlaps `within`).",
341895
+ expectedResult: "Returns an AnchoredMetadataListResult with summary entries (no payload); fetch payload via get.",
341896
+ requiresDocumentContext: true,
341897
+ metadata: readOperation2({
341898
+ idempotency: "idempotent",
341899
+ throws: T_REF_READ_LIST2
341900
+ }),
341901
+ referenceDocPath: "metadata/list.mdx",
341902
+ referenceGroup: "metadata"
341903
+ },
341904
+ "metadata.get": {
341905
+ memberPath: "metadata.get",
341906
+ description: "Get a single anchored-metadata entry by id, including its JSON payload.",
341907
+ expectedResult: "Returns an AnchoredMetadataInfo with id, namespace, partName, and payload; or null if not found.",
341908
+ requiresDocumentContext: true,
341909
+ metadata: readOperation2({
341910
+ throws: T_NOT_FOUND_CAPABLE2
341911
+ }),
341912
+ referenceDocPath: "metadata/get.mdx",
341913
+ referenceGroup: "metadata"
341914
+ },
341915
+ "metadata.update": {
341916
+ memberPath: "metadata.update",
341917
+ description: "Replace the JSON payload of an existing anchored-metadata entry. Replace semantics; no merge. The anchor is left untouched.",
341918
+ expectedResult: "Returns an AnchoredMetadataMutationResult with the entry id on success or a failure.",
341919
+ requiresDocumentContext: true,
341920
+ metadata: mutationOperation2({
341921
+ idempotency: "idempotent",
341922
+ supportsDryRun: true,
341923
+ supportsTrackedMode: false,
341924
+ possibleFailureCodes: ["TARGET_NOT_FOUND", "INVALID_INPUT"],
341925
+ throws: [...T_REF_MUTATION2, "REVISION_MISMATCH"]
341926
+ }),
341927
+ referenceDocPath: "metadata/update.mdx",
341928
+ referenceGroup: "metadata"
341929
+ },
341930
+ "metadata.remove": {
341931
+ memberPath: "metadata.remove",
341932
+ description: "Remove an anchored-metadata entry. Strips the anchor content-control wrapper (its content stays in the document) and deletes the payload entry from the Storage Part. In v1 these writes are sequenced, not transactional: the adapter resolves the target up-front so missing-target failures land before any state change, but a crash strictly between the two writes can leave a dangling payload. When the backing part has no remaining entries, the part itself is removed.",
341933
+ expectedResult: "Returns an AnchoredMetadataMutationResult with the removed entry id on success or a failure.",
341934
+ requiresDocumentContext: true,
341935
+ metadata: mutationOperation2({
341936
+ idempotency: "non-idempotent",
341937
+ supportsDryRun: true,
341938
+ supportsTrackedMode: false,
341939
+ possibleFailureCodes: ["TARGET_NOT_FOUND"],
341940
+ throws: [...T_REF_MUTATION_REMOVE2, "REVISION_MISMATCH"]
341941
+ }),
341942
+ referenceDocPath: "metadata/remove.mdx",
341943
+ referenceGroup: "metadata"
341944
+ },
341945
+ "metadata.resolve": {
341946
+ memberPath: "metadata.resolve",
341947
+ description: "Find where an anchored-metadata entry is anchored in the document. Returns the SelectionTarget covering the anchor content.",
341948
+ expectedResult: "Returns an AnchoredMetadataResolveInfo with id and target SelectionTarget; or null if the anchor is no longer present.",
341949
+ requiresDocumentContext: true,
341950
+ metadata: readOperation2({
341951
+ throws: T_NOT_FOUND_CAPABLE2
341952
+ }),
341953
+ referenceDocPath: "metadata/resolve.mdx",
341954
+ referenceGroup: "metadata"
341208
341955
  }
341209
341956
  };
341210
341957
  OPERATION_IDS2 = Object.freeze(Object.keys(OPERATION_DEFINITIONS2));
@@ -342943,7 +343690,7 @@ function refConfigSchemas2() {
342943
343690
  failure: refFailureSchema2
342944
343691
  };
342945
343692
  }
342946
- var nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, knownTargetKindValues, SHARED_DEFS, rangeSchema2, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, inlineNodeAddressSchema, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, targetLocatorSchema, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchRunSchema, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema2, nodeSelectorSchema2, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStyleInfoSchema, documentStylesSchema2, documentDefaultsSchema2, documentInfoSchema, listKindSchema2, listInsertPositionSchema2, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeWordRevisionIdsSchema2, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, capabilitiesOutputSchema, strictEmptyObjectSchema, tableBorderColorPattern2, tableBorderSpecSchema, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, insertInputSchema, tableLocatorSchema, cellLocatorSchema, cellOrTableScopedCellLocatorSchema, tableOrCellLocatorSchema, mergeRangeLocatorSchema, tableCreateLocationSchema2, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas2, tocMutationFailureCodes, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkDestinationSchema, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema2, hyperlinkInfoSchema, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refListQueryProperties2, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, customXmlPartTargetSchema2, customXmlPartMutation2, customXmlPartCreateMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, diffApplyResultSchema, operationSchemas;
343693
+ var nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, knownTargetKindValues, SHARED_DEFS, rangeSchema2, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, inlineNodeAddressSchema, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, targetLocatorSchema, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchRunSchema, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema2, nodeSelectorSchema2, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStyleInfoSchema, documentStylesSchema2, documentDefaultsSchema2, documentInfoSchema, listKindSchema2, listInsertPositionSchema2, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeWordRevisionIdsSchema2, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, capabilitiesOutputSchema, strictEmptyObjectSchema, tableBorderColorPattern2, tableBorderSpecSchema, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, insertInputSchema, tableLocatorSchema, cellLocatorSchema, cellOrTableScopedCellLocatorSchema, tableOrCellLocatorSchema, mergeRangeLocatorSchema, tableCreateLocationSchema2, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas2, tocMutationFailureCodes, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkDestinationSchema, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema2, hyperlinkInfoSchema, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refListQueryProperties2, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, customXmlPartTargetSchema2, customXmlPartMutation2, customXmlPartCreateMutation2, anchoredMetadataAttachMutation2, anchoredMetadataMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, diffApplyResultSchema, operationSchemas;
342947
343694
  var init_schemas4 = __esm(() => {
342948
343695
  init_command_catalog();
342949
343696
  init_types4();
@@ -344060,6 +344807,12 @@ var init_schemas4 = __esm(() => {
344060
344807
  partName: { type: "string" },
344061
344808
  propsPartName: { type: "string" }
344062
344809
  }, ["id", "partName", "propsPartName"]);
344810
+ anchoredMetadataAttachMutation2 = refMutationSchemas2({
344811
+ id: { type: "string", minLength: 1 },
344812
+ namespace: { type: "string", minLength: 1 },
344813
+ partName: { type: "string", minLength: 1 }
344814
+ }, ["id", "namespace", "partName"]);
344815
+ anchoredMetadataMutation2 = refMutationSchemas2({ id: { type: "string", minLength: 1 } }, ["id"]);
344063
344816
  footnoteAddressSchema2 = objectSchema2({ kind: { const: "entity" }, entityType: { const: "footnote" }, noteId: { type: "string" } }, ["kind", "entityType", "noteId"]);
344064
344817
  footnoteConfigScopeSchema2 = {
344065
344818
  oneOf: [
@@ -347965,6 +348718,39 @@ var init_schemas4 = __esm(() => {
347965
348718
  "customXml.parts.remove": {
347966
348719
  input: objectSchema2({ target: customXmlPartTargetSchema2 }, ["target"]),
347967
348720
  ...customXmlPartMutation2
348721
+ },
348722
+ "metadata.attach": {
348723
+ input: objectSchema2({
348724
+ target: selectionTargetSchema2,
348725
+ namespace: { type: "string", minLength: 1 },
348726
+ payload: {},
348727
+ id: { type: "string", minLength: 1 }
348728
+ }, ["target", "namespace", "payload"]),
348729
+ ...anchoredMetadataAttachMutation2
348730
+ },
348731
+ "metadata.list": {
348732
+ input: objectSchema2({
348733
+ ...refListQueryProperties2,
348734
+ namespace: { type: "string" },
348735
+ within: selectionTargetSchema2
348736
+ }),
348737
+ output: discoveryOutputSchema
348738
+ },
348739
+ "metadata.get": {
348740
+ input: objectSchema2({ id: { type: "string", minLength: 1 } }, ["id"]),
348741
+ output: { oneOf: [{ type: "object" }, { type: "null" }] }
348742
+ },
348743
+ "metadata.update": {
348744
+ input: objectSchema2({ id: { type: "string", minLength: 1 }, payload: {} }, ["id", "payload"]),
348745
+ ...anchoredMetadataMutation2
348746
+ },
348747
+ "metadata.remove": {
348748
+ input: objectSchema2({ id: { type: "string", minLength: 1 } }, ["id"]),
348749
+ ...anchoredMetadataMutation2
348750
+ },
348751
+ "metadata.resolve": {
348752
+ input: objectSchema2({ id: { type: "string", minLength: 1 } }, ["id"]),
348753
+ output: { oneOf: [{ type: "object" }, { type: "null" }] }
347968
348754
  }
347969
348755
  };
347970
348756
  });
@@ -348159,6 +348945,11 @@ var init_reference_doc_map = __esm(() => {
348159
348945
  title: "Custom XML",
348160
348946
  description: "Custom XML Data Storage Part operations (ECMA-376 §15.2.5, §15.2.6). Raw read and write of custom XML parts in the OOXML package.",
348161
348947
  pagePath: "custom-xml/index.mdx"
348948
+ },
348949
+ metadata: {
348950
+ title: "Anchored Metadata",
348951
+ description: "Attach a JSON payload to a span of text and read it back across DOCX round-trips. Backed by hidden inline content controls and namespaced Custom XML Data Storage Parts; consumers see one operation set.",
348952
+ pagePath: "metadata/index.mdx"
348162
348953
  }
348163
348954
  };
348164
348955
  REFERENCE_OPERATION_GROUPS = Object.keys(GROUP_METADATA2).map((key2) => ({
@@ -350976,7 +351767,13 @@ function buildDispatchTable2(api2) {
350976
351767
  "customXml.parts.get": (input2) => api2.customXml.parts.get(input2),
350977
351768
  "customXml.parts.create": (input2, options) => api2.customXml.parts.create(input2, options),
350978
351769
  "customXml.parts.patch": (input2, options) => api2.customXml.parts.patch(input2, options),
350979
- "customXml.parts.remove": (input2, options) => api2.customXml.parts.remove(input2, options)
351770
+ "customXml.parts.remove": (input2, options) => api2.customXml.parts.remove(input2, options),
351771
+ "metadata.attach": (input2, options) => api2.metadata.attach(input2, options),
351772
+ "metadata.list": (input2) => api2.metadata.list(input2),
351773
+ "metadata.get": (input2) => api2.metadata.get(input2),
351774
+ "metadata.update": (input2, options) => api2.metadata.update(input2, options),
351775
+ "metadata.remove": (input2, options) => api2.metadata.remove(input2, options),
351776
+ "metadata.resolve": (input2) => api2.metadata.resolve(input2)
350980
351777
  };
350981
351778
  }
350982
351779
  var init_invoke = __esm(() => {
@@ -352175,8 +352972,8 @@ function validateDestination2(destination, operationName) {
352175
352972
  throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} requires a destination object.`);
352176
352973
  }
352177
352974
  const hasHref = typeof destination.href === "string" && destination.href.length > 0;
352178
- const hasAnchor = typeof destination.anchor === "string" && destination.anchor.length > 0;
352179
- if (!hasHref && !hasAnchor) {
352975
+ const hasAnchor2 = typeof destination.anchor === "string" && destination.anchor.length > 0;
352976
+ if (!hasHref && !hasAnchor2) {
352180
352977
  throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} destination must have at least one of 'href' or 'anchor'.`);
352181
352978
  }
352182
352979
  }
@@ -352858,6 +353655,94 @@ var init_customXml = __esm(() => {
352858
353655
  init_errors5();
352859
353656
  });
352860
353657
 
353658
+ // ../../packages/document-api/src/metadata/anchored-metadata.ts
353659
+ function validateId2(id2, operationName) {
353660
+ if (typeof id2 !== "string" || id2.length === 0) {
353661
+ throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} requires a non-empty 'id' string.`, {
353662
+ idType: typeof id2
353663
+ });
353664
+ }
353665
+ }
353666
+ function validateNamespace2(namespace, operationName) {
353667
+ if (typeof namespace !== "string" || namespace.length === 0) {
353668
+ throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} requires a non-empty 'namespace' string.`, {
353669
+ namespaceType: typeof namespace
353670
+ });
353671
+ }
353672
+ }
353673
+ function validatePayload2(payload, operationName) {
353674
+ let serialized;
353675
+ try {
353676
+ serialized = JSON.stringify(payload);
353677
+ } catch (err) {
353678
+ throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'payload' must be JSON-serializable (no cycles, no BigInt).`, { error: err instanceof Error ? err.message : String(err) });
353679
+ }
353680
+ if (serialized === undefined) {
353681
+ throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'payload' must be a JSON-serializable value (was undefined / function / symbol).`);
353682
+ }
353683
+ }
353684
+ function validateAnchorTarget2(target, operationName) {
353685
+ if (!isSelectionTarget2(target)) {
353686
+ throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName} requires a 'target' SelectionTarget describing the anchor range.`, { target });
353687
+ }
353688
+ if (target.start.kind !== "text" || target.end.kind !== "text") {
353689
+ throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName} requires a text-range target. v1 does not support nodeEdge anchors.`, { startKind: target.start.kind, endKind: target.end.kind });
353690
+ }
353691
+ if (target.start.blockId !== target.end.blockId) {
353692
+ throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName} target must stay within a single paragraph. ` + `v1 anchors are hidden inline SDTs and cannot span block boundaries.`, { startBlockId: target.start.blockId, endBlockId: target.end.blockId });
353693
+ }
353694
+ }
353695
+ function validateWithin2(within2, operationName) {
353696
+ if (!isSelectionTarget2(within2)) {
353697
+ throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'within' must be a SelectionTarget when provided.`, { within: within2 });
353698
+ }
353699
+ if (within2.start.kind !== "text" || within2.end.kind !== "text") {
353700
+ throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'within' must be a text-range target (no nodeEdge endpoints).`, { startKind: within2.start.kind, endKind: within2.end.kind });
353701
+ }
353702
+ if (within2.start.blockId !== within2.end.blockId) {
353703
+ throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'within' must stay within a single paragraph in v1.`, { startBlockId: within2.start.blockId, endBlockId: within2.end.blockId });
353704
+ }
353705
+ }
353706
+ function executeAnchoredMetadataAttach2(adapter, input2, options) {
353707
+ validateAnchorTarget2(input2.target, "metadata.attach");
353708
+ validateNamespace2(input2.namespace, "metadata.attach");
353709
+ validatePayload2(input2.payload, "metadata.attach");
353710
+ if (input2.id !== undefined) {
353711
+ validateId2(input2.id, "metadata.attach");
353712
+ }
353713
+ return adapter.attach(input2, normalizeMutationOptions2(options));
353714
+ }
353715
+ function executeAnchoredMetadataList2(adapter, query2) {
353716
+ if (query2?.namespace !== undefined && typeof query2.namespace !== "string") {
353717
+ throw new DocumentApiValidationError3("INVALID_INPUT", `metadata.list 'namespace' must be a string when provided.`);
353718
+ }
353719
+ if (query2?.within !== undefined) {
353720
+ validateWithin2(query2.within, "metadata.list");
353721
+ }
353722
+ return adapter.list(query2);
353723
+ }
353724
+ function executeAnchoredMetadataGet2(adapter, input2) {
353725
+ validateId2(input2.id, "metadata.get");
353726
+ return adapter.get(input2);
353727
+ }
353728
+ function executeAnchoredMetadataUpdate2(adapter, input2, options) {
353729
+ validateId2(input2.id, "metadata.update");
353730
+ validatePayload2(input2.payload, "metadata.update");
353731
+ return adapter.update(input2, normalizeMutationOptions2(options));
353732
+ }
353733
+ function executeAnchoredMetadataRemove2(adapter, input2, options) {
353734
+ validateId2(input2.id, "metadata.remove");
353735
+ return adapter.remove(input2, normalizeMutationOptions2(options));
353736
+ }
353737
+ function executeAnchoredMetadataResolve2(adapter, input2) {
353738
+ validateId2(input2.id, "metadata.resolve");
353739
+ return adapter.resolve(input2);
353740
+ }
353741
+ var init_anchored_metadata = __esm(() => {
353742
+ init_errors5();
353743
+ init_selection_target_validator();
353744
+ });
353745
+
352861
353746
  // ../../packages/document-api/src/protection/protection.ts
352862
353747
  function validateSetEditingRestrictionInput2(input2) {
352863
353748
  if (!input2 || typeof input2 !== "object") {
@@ -354608,6 +355493,26 @@ function createDocumentApi2(adapters) {
354608
355493
  }
354609
355494
  }
354610
355495
  },
355496
+ metadata: {
355497
+ attach(input2, options) {
355498
+ return executeAnchoredMetadataAttach2(requireAdapter2(adapters.metadata, "metadata"), input2, options);
355499
+ },
355500
+ list(input2) {
355501
+ return executeAnchoredMetadataList2(requireAdapter2(adapters.metadata, "metadata"), input2);
355502
+ },
355503
+ get(input2) {
355504
+ return executeAnchoredMetadataGet2(requireAdapter2(adapters.metadata, "metadata"), input2);
355505
+ },
355506
+ update(input2, options) {
355507
+ return executeAnchoredMetadataUpdate2(requireAdapter2(adapters.metadata, "metadata"), input2, options);
355508
+ },
355509
+ remove(input2, options) {
355510
+ return executeAnchoredMetadataRemove2(requireAdapter2(adapters.metadata, "metadata"), input2, options);
355511
+ },
355512
+ resolve(input2) {
355513
+ return executeAnchoredMetadataResolve2(requireAdapter2(adapters.metadata, "metadata"), input2);
355514
+ }
355515
+ },
354611
355516
  invoke(request) {
354612
355517
  if (!Object.prototype.hasOwnProperty.call(dispatch, request.operationId)) {
354613
355518
  throw new Error(`Unknown operationId: "${request.operationId}"`);
@@ -354655,6 +355560,7 @@ var init_src = __esm(() => {
354655
355560
  init_content_controls();
354656
355561
  init_bookmarks();
354657
355562
  init_customXml();
355563
+ init_anchored_metadata();
354658
355564
  init_protection();
354659
355565
  init_permission_ranges();
354660
355566
  init_footnotes();
@@ -372650,11 +373556,11 @@ var init_header_footer_story_runtime = __esm(() => {
372650
373556
  function getConverter11(editor) {
372651
373557
  return editor.converter;
372652
373558
  }
372653
- function getRootElement2(part) {
373559
+ function getRootElement3(part) {
372654
373560
  return part?.elements?.[0];
372655
373561
  }
372656
373562
  function getNoteElements2(part, childElementName) {
372657
- const root3 = getRootElement2(part);
373563
+ const root3 = getRootElement3(part);
372658
373564
  if (!root3?.elements)
372659
373565
  return [];
372660
373566
  return root3.elements.filter((el) => el.name === childElementName);
@@ -372711,7 +373617,7 @@ function ensureFootnoteRefRun2(elements, childElementName) {
372711
373617
  firstParagraph.elements.splice(pPrIndex >= 0 ? pPrIndex + 1 : 0, 0, refRun);
372712
373618
  }
372713
373619
  function addNoteElement2(part, config3, noteId, text5) {
372714
- const root3 = getRootElement2(part);
373620
+ const root3 = getRootElement3(part);
372715
373621
  if (!root3)
372716
373622
  throw new Error(`addNoteElement: missing root element in ${config3.partId}`);
372717
373623
  if (!root3.elements)
@@ -372742,7 +373648,7 @@ function updateNoteElement2(part, config3, noteId, text5) {
372742
373648
  return true;
372743
373649
  }
372744
373650
  function removeNoteElement2(part, config3, noteId) {
372745
- const root3 = getRootElement2(part);
373651
+ const root3 = getRootElement3(part);
372746
373652
  if (!root3?.elements)
372747
373653
  return false;
372748
373654
  const index2 = root3.elements.findIndex((el) => el.name === config3.childElementName && el.attributes?.["w:id"] === noteId);
@@ -372831,7 +373737,7 @@ function createNotePartDescriptor2(config3) {
372831
373737
  return createInitialNotesPart2(config3);
372832
373738
  },
372833
373739
  normalizePart(part) {
372834
- const root3 = getRootElement2(part);
373740
+ const root3 = getRootElement3(part);
372835
373741
  if (!root3?.elements)
372836
373742
  return;
372837
373743
  root3.elements.sort((a2, b2) => {
@@ -373379,7 +374285,7 @@ function resolveSdtByTarget2(doc6, target) {
373379
374285
  }
373380
374286
  return matches3[0];
373381
374287
  }
373382
- var SDT_NODE_NAMES2, SDT_BLOCK_NAME2 = "structuredContentBlock";
374288
+ var SDT_NODE_NAMES2, SDT_BLOCK_NAME2 = "structuredContentBlock", SDT_INLINE_NAME2 = "structuredContent";
373383
374289
  var init_target_resolution = __esm(() => {
373384
374290
  init_errors4();
373385
374291
  SDT_NODE_NAMES2 = ["structuredContent", "structuredContentBlock"];
@@ -399247,22 +400153,22 @@ var getLocalName3 = (name) => {
399247
400153
  return "";
399248
400154
  const parts = name.split(":");
399249
400155
  return parts.length ? parts[parts.length - 1] : name;
399250
- }, hasLocalName2 = (node4, localName) => {
400156
+ }, hasLocalName2 = (node4, localName2) => {
399251
400157
  if (!node4 || typeof node4 !== "object")
399252
400158
  return false;
399253
- return getLocalName3(node4.name) === localName;
399254
- }, findChildByLocalName2 = (elements, localName) => {
400159
+ return getLocalName3(node4.name) === localName2;
400160
+ }, findChildByLocalName2 = (elements, localName2) => {
399255
400161
  if (!Array.isArray(elements))
399256
400162
  return;
399257
- return elements.find((el) => hasLocalName2(el, localName));
399258
- }, filterChildrenByLocalName2 = (elements, localName) => {
400163
+ return elements.find((el) => hasLocalName2(el, localName2));
400164
+ }, filterChildrenByLocalName2 = (elements, localName2) => {
399259
400165
  if (!Array.isArray(elements))
399260
400166
  return [];
399261
- return elements.filter((el) => hasLocalName2(el, localName));
399262
- }, someChildHasLocalName2 = (elements, localName) => {
400167
+ return elements.filter((el) => hasLocalName2(el, localName2));
400168
+ }, someChildHasLocalName2 = (elements, localName2) => {
399263
400169
  if (!Array.isArray(elements))
399264
400170
  return false;
399265
- return elements.some((el) => hasLocalName2(el, localName));
400171
+ return elements.some((el) => hasLocalName2(el, localName2));
399266
400172
  };
399267
400173
 
399268
400174
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/wp/helpers/vector-shape-helpers.js
@@ -399521,8 +400427,8 @@ function extractLineEnds2(spPr) {
399521
400427
  const ln = findChildByLocalName2(spPr?.elements, "ln");
399522
400428
  if (!ln?.elements)
399523
400429
  return null;
399524
- const parseEnd = (localName) => {
399525
- const end = findChildByLocalName2(ln.elements, localName);
400430
+ const parseEnd = (localName2) => {
400431
+ const end = findChildByLocalName2(ln.elements, localName2);
399526
400432
  if (!end?.attributes)
399527
400433
  return null;
399528
400434
  const type = end.attributes?.["type"];
@@ -428943,15 +429849,15 @@ function parsePersonNode2(personNode) {
428943
429849
  for (const child of personNode?.elements ?? []) {
428944
429850
  if (!child || child.type !== "element")
428945
429851
  continue;
428946
- const localName = getLocalName4(child.name);
429852
+ const localName2 = getLocalName4(child.name);
428947
429853
  const value = readTextNode2(child);
428948
429854
  if (!value)
428949
429855
  continue;
428950
- if (localName === "First")
429856
+ if (localName2 === "First")
428951
429857
  person.first = value;
428952
- if (localName === "Middle")
429858
+ if (localName2 === "Middle")
428953
429859
  person.middle = value;
428954
- if (localName === "Last")
429860
+ if (localName2 === "Last")
428955
429861
  person.last = value;
428956
429862
  }
428957
429863
  return typeof person.last === "string" && person.last.length > 0 ? person : null;
@@ -429070,16 +429976,16 @@ function parseSourceNode2(sourceNode) {
429070
429976
  for (const child of sourceNode?.elements ?? []) {
429071
429977
  if (!child || child.type !== "element")
429072
429978
  continue;
429073
- const localName = getLocalName4(child.name);
429074
- if (localName === "Tag") {
429979
+ const localName2 = getLocalName4(child.name);
429980
+ if (localName2 === "Tag") {
429075
429981
  tag = readTextNode2(child);
429076
429982
  continue;
429077
429983
  }
429078
- if (localName === "SourceType") {
429984
+ if (localName2 === "SourceType") {
429079
429985
  sourceType = mapOoxmlTypeToApi2(readTextNode2(child));
429080
429986
  continue;
429081
429987
  }
429082
- const fieldName = XML_TAG_TO_SIMPLE_FIELD2[localName];
429988
+ const fieldName = XML_TAG_TO_SIMPLE_FIELD2[localName2];
429083
429989
  if (!fieldName)
429084
429990
  continue;
429085
429991
  const value = readTextNode2(child);
@@ -460460,8 +461366,8 @@ function hyperlinksPatchWrapper2(editor, input2, options) {
460460
461366
  const mergedHref = input2.patch.href === undefined ? oldAttrs.href : input2.patch.href;
460461
461367
  const mergedAnchor = input2.patch.anchor === undefined ? oldAttrs.anchor : input2.patch.anchor;
460462
461368
  const hasHref = typeof mergedHref === "string" && mergedHref.length > 0;
460463
- const hasAnchor = typeof mergedAnchor === "string" && mergedAnchor.length > 0;
460464
- if (!hasHref && !hasAnchor) {
461369
+ const hasAnchor2 = typeof mergedAnchor === "string" && mergedAnchor.length > 0;
461370
+ if (!hasHref && !hasAnchor2) {
460465
461371
  throw new DocumentApiAdapterError3("INVALID_INPUT", "hyperlinks.patch: resulting destination must have at least one of href or anchor.");
460466
461372
  }
460467
461373
  if (typeof input2.patch.href === "string") {
@@ -462814,15 +463720,15 @@ function getLocalName5(name) {
462814
463720
  const i5 = name.indexOf(":");
462815
463721
  return i5 >= 0 ? name.slice(i5 + 1) : name;
462816
463722
  }
462817
- function findFirstElement2(parent, localName) {
463723
+ function findFirstElement2(parent, localName2) {
462818
463724
  if (!parent?.elements?.length)
462819
463725
  return null;
462820
- return parent.elements.find((el) => el?.type === "element" && getLocalName5(el.name) === localName) ?? null;
463726
+ return parent.elements.find((el) => el?.type === "element" && getLocalName5(el.name) === localName2) ?? null;
462821
463727
  }
462822
- function findAllElements2(parent, localName) {
463728
+ function findAllElements2(parent, localName2) {
462823
463729
  if (!parent?.elements?.length)
462824
463730
  return [];
462825
- return parent.elements.filter((el) => el?.type === "element" && getLocalName5(el.name) === localName);
463731
+ return parent.elements.filter((el) => el?.type === "element" && getLocalName5(el.name) === localName2);
462826
463732
  }
462827
463733
  function partNameFromIndex2(index3) {
462828
463734
  return `customXml/item${index3}.xml`;
@@ -463383,12 +464289,417 @@ var init_custom_xml_wrappers = __esm(() => {
463383
464289
  init_custom_xml_parts();
463384
464290
  });
463385
464291
 
463386
- // ../../packages/super-editor/src/editors/v1/document-api-adapters/protection-adapter.ts
464292
+ // ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/anchored-metadata-wrappers.ts
464293
+ function failure3(code10, message) {
464294
+ return { success: false, failure: { code: code10, message } };
464295
+ }
463387
464296
  function getConverter20(editor) {
464297
+ return editor.converter ?? null;
464298
+ }
464299
+ function getConvertedXml5(editor) {
464300
+ return getConverter20(editor)?.convertedXml ?? {};
464301
+ }
464302
+ function markConverterDirty2(editor) {
464303
+ const converter = getConverter20(editor);
464304
+ if (!converter)
464305
+ return;
464306
+ converter.documentModified = true;
464307
+ if (!converter.documentGuid && typeof converter.promoteToGuid === "function") {
464308
+ converter.promoteToGuid();
464309
+ }
464310
+ }
464311
+ function getRootElement4(doc6) {
464312
+ const xmlDoc = doc6;
464313
+ return xmlDoc?.elements?.find((el) => el?.type === "element") ?? null;
464314
+ }
464315
+ function localName2(name) {
464316
+ if (!name)
464317
+ return "";
464318
+ const idx = name.indexOf(":");
464319
+ return idx >= 0 ? name.slice(idx + 1) : name;
464320
+ }
464321
+ function getTextContent2(node4) {
464322
+ if (!node4)
464323
+ return "";
464324
+ if (node4.type === "text")
464325
+ return node4.text ?? "";
464326
+ if (node4.type === "cdata")
464327
+ return node4.cdata ?? "";
464328
+ return (node4.elements ?? []).map((child) => getTextContent2(child)).join("");
464329
+ }
464330
+ function escapeXmlText2(value) {
464331
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
464332
+ }
464333
+ function escapeXmlAttribute2(value) {
464334
+ return escapeXmlText2(value).replace(/"/g, "&quot;").replace(/'/g, "&apos;");
464335
+ }
464336
+ function buildEnvelopeXml2(namespace, entries) {
464337
+ const children = entries.map((entry) => {
464338
+ const json2 = JSON.stringify(entry.payload);
464339
+ return `<ref id="${escapeXmlAttribute2(entry.id)}" encoding="json">${escapeXmlText2(json2)}</ref>`;
464340
+ }).join("");
464341
+ return `<refs xmlns="${escapeXmlAttribute2(namespace)}">${children}</refs>`;
464342
+ }
464343
+ function parseMetadataPart2(convertedXml, partName) {
464344
+ const root4 = getRootElement4(convertedXml[partName]);
464345
+ if (!root4 || localName2(root4.name) !== "refs")
464346
+ return null;
464347
+ const namespace = parseStoragePartRootNamespace2(convertedXml[partName]);
464348
+ if (typeof namespace !== "string" || namespace.length === 0)
464349
+ return null;
464350
+ const entries = [];
464351
+ for (const child of root4.elements ?? []) {
464352
+ if (child?.type !== "element" || localName2(child.name) !== "ref")
464353
+ continue;
464354
+ if (child.attributes?.encoding !== "json")
464355
+ continue;
464356
+ const id2 = child.attributes?.id;
464357
+ if (typeof id2 !== "string" || id2.length === 0)
464358
+ continue;
464359
+ try {
464360
+ entries.push({
464361
+ id: id2,
464362
+ namespace,
464363
+ partName,
464364
+ payload: JSON.parse(getTextContent2(child))
464365
+ });
464366
+ } catch {
464367
+ continue;
464368
+ }
464369
+ }
464370
+ return { namespace, partName, entries };
464371
+ }
464372
+ function listMetadataParts2(convertedXml) {
464373
+ return listCustomXmlParts2(convertedXml).map((part) => parseMetadataPart2(convertedXml, part.partName)).filter((part) => part !== null);
464374
+ }
464375
+ function findPartByNamespace2(convertedXml, namespace) {
464376
+ return listMetadataParts2(convertedXml).find((part) => part.namespace === namespace) ?? null;
464377
+ }
464378
+ function findEntry2(convertedXml, id2) {
464379
+ for (const part of listMetadataParts2(convertedXml)) {
464380
+ const entry = part.entries.find((candidate) => candidate.id === id2);
464381
+ if (entry)
464382
+ return entry;
464383
+ }
464384
+ return null;
464385
+ }
464386
+ function hasPayloadEntry2(convertedXml, id2) {
464387
+ return findEntry2(convertedXml, id2) !== null;
464388
+ }
464389
+ function predictPartName2(convertedXml, converter) {
464390
+ return `customXml/item${nextCustomXmlItemIndex2(convertedXml, converter)}.xml`;
464391
+ }
464392
+ function buildAnchorAttrs2(id2) {
464393
+ return {
464394
+ id: generateRandomSigned32BitIntStrId2(),
464395
+ tag: id2,
464396
+ alias: "Anchored metadata",
464397
+ appearance: "hidden",
464398
+ controlType: "richText",
464399
+ type: "richText",
464400
+ sdtPr: {
464401
+ name: "w:sdtPr",
464402
+ type: "element",
464403
+ elements: [
464404
+ { name: "w:richText", type: "element" },
464405
+ { name: "w15:appearance", type: "element", attributes: { "w15:val": "hidden" } }
464406
+ ]
464407
+ }
464408
+ };
464409
+ }
464410
+ function dispatchTransaction6(editor, tr) {
464411
+ if (editor.view?.dispatch) {
464412
+ editor.view.dispatch(tr);
464413
+ return;
464414
+ }
464415
+ if (typeof editor.dispatch === "function") {
464416
+ editor.dispatch(tr);
464417
+ return;
464418
+ }
464419
+ throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "metadata.* requires an editor dispatch function.");
464420
+ }
464421
+ function findAnchorsById2(editor, id2) {
464422
+ return findAllSdtNodes2(editor.state.doc).filter((sdt) => sdt.kind === "inline" && sdt.node.attrs?.tag === id2);
464423
+ }
464424
+ function hasAnchor2(editor, id2) {
464425
+ return findAllSdtNodes2(editor.state.doc).some((sdt) => sdt.node.attrs?.tag === id2);
464426
+ }
464427
+ function wrapRangeInAnchor2(editor, target, id2) {
464428
+ const { absFrom, absTo } = resolveSelectionTarget2(editor, target);
464429
+ if (absFrom >= absTo) {
464430
+ throw new DocumentApiAdapterError3("INVALID_TARGET", "metadata.attach requires a non-empty text range.");
464431
+ }
464432
+ const nodeType = editor.schema.nodes[SDT_INLINE_NAME2];
464433
+ if (!nodeType) {
464434
+ throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "Inline content-control node is not available.");
464435
+ }
464436
+ const { tr } = editor.state;
464437
+ const attrs = buildAnchorAttrs2(id2);
464438
+ const runType = editor.schema.nodes.run;
464439
+ const $from = tr.doc.resolve(absFrom);
464440
+ const $to = tr.doc.resolve(absTo);
464441
+ const sameRun = runType && $from.parent.type === runType && $from.parent === $to.parent;
464442
+ if (sameRun) {
464443
+ const runDepth = $from.depth;
464444
+ const runStart = $from.before(runDepth);
464445
+ const runEnd = $from.after(runDepth);
464446
+ const parentRun = $from.parent;
464447
+ const selectedContent = parentRun.content.cut($from.parentOffset, $to.parentOffset);
464448
+ const leftContent = parentRun.content.cut(0, $from.parentOffset);
464449
+ const rightContent = parentRun.content.cut($to.parentOffset);
464450
+ const sdtNode = nodeType.create(attrs, selectedContent);
464451
+ const replacement = [];
464452
+ if (leftContent.size > 0)
464453
+ replacement.push(runType.create(parentRun.attrs, leftContent, parentRun.marks));
464454
+ replacement.push(sdtNode);
464455
+ if (rightContent.size > 0)
464456
+ replacement.push(runType.create(parentRun.attrs, rightContent, parentRun.marks));
464457
+ tr.replaceWith(runStart, runEnd, replacement);
464458
+ } else {
464459
+ const selected = tr.doc.slice(absFrom, absTo);
464460
+ const sdtNode = nodeType.create(attrs, selected.content);
464461
+ tr.replaceWith(absFrom, absTo, sdtNode);
464462
+ }
464463
+ dispatchTransaction6(editor, tr);
464464
+ clearIndexCache2(editor);
464465
+ return true;
464466
+ }
464467
+ function unwrapAnchor2(editor, id2) {
464468
+ const anchor = findAnchorsById2(editor, id2)[0];
464469
+ if (!anchor)
464470
+ return false;
464471
+ const { tr } = editor.state;
464472
+ tr.replaceWith(anchor.pos, anchor.pos + anchor.node.nodeSize, anchor.node.content);
464473
+ dispatchTransaction6(editor, tr);
464474
+ clearIndexCache2(editor);
464475
+ return true;
464476
+ }
464477
+ function pointFromPmPosition2(editor, pos) {
464478
+ const index3 = getBlockIndex2(editor);
464479
+ for (const candidate of index3.candidates) {
464480
+ if (!isTextBlockCandidate2(candidate))
464481
+ continue;
464482
+ const contentStart = candidate.pos + 1;
464483
+ const contentEnd = candidate.end - 1;
464484
+ if (pos >= contentStart && pos <= contentEnd) {
464485
+ return {
464486
+ kind: "text",
464487
+ blockId: candidate.nodeId,
464488
+ offset: pmPositionToTextOffset2(candidate.node, candidate.pos, pos)
464489
+ };
464490
+ }
464491
+ }
464492
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "Could not resolve metadata anchor to a text range.");
464493
+ }
464494
+ function resolveAnchorTarget2(editor, id2) {
464495
+ const anchor = findAnchorsById2(editor, id2)[0];
464496
+ if (!anchor)
464497
+ return null;
464498
+ return {
464499
+ kind: "selection",
464500
+ start: pointFromPmPosition2(editor, anchor.pos + 1),
464501
+ end: pointFromPmPosition2(editor, anchor.pos + anchor.node.nodeSize - 1)
464502
+ };
464503
+ }
464504
+ function rangesOverlap2(aFrom, aTo, bFrom, bTo) {
464505
+ if (aFrom === aTo || bFrom === bTo) {
464506
+ return aFrom <= bTo && bFrom <= aTo;
464507
+ }
464508
+ return aFrom < bTo && bFrom < aTo;
464509
+ }
464510
+ function anchorOverlaps2(editor, id2, within2) {
464511
+ const anchor = findAnchorsById2(editor, id2)[0];
464512
+ if (!anchor)
464513
+ return false;
464514
+ const query2 = resolveSelectionTarget2(editor, within2);
464515
+ const anchorFrom = anchor.pos + 1;
464516
+ const anchorTo = anchor.pos + anchor.node.nodeSize - 1;
464517
+ return rangesOverlap2(anchorFrom, anchorTo, query2.absFrom, query2.absTo);
464518
+ }
464519
+ function writeEntry2(editor, namespace, id2, payload, dryRun) {
464520
+ const convertedXml = getConvertedXml5(editor);
464521
+ const converter = getConverter20(editor);
464522
+ const existing = findPartByNamespace2(convertedXml, namespace);
464523
+ const entries = existing?.entries.filter((entry) => entry.id !== id2) ?? [];
464524
+ const next2 = {
464525
+ id: id2,
464526
+ namespace,
464527
+ partName: existing?.partName ?? predictPartName2(convertedXml, converter),
464528
+ payload
464529
+ };
464530
+ const xml2 = buildEnvelopeXml2(namespace, [...entries, next2]);
464531
+ if (dryRun) {
464532
+ return { partName: next2.partName };
464533
+ }
464534
+ if (existing) {
464535
+ patchCustomXmlPart2(convertedXml, { partName: existing.partName }, { content: xml2, schemaRefs: undefined }, converter ?? undefined);
464536
+ markConverterDirty2(editor);
464537
+ return { partName: existing.partName };
464538
+ }
464539
+ const created = createCustomXmlPart2(convertedXml, { content: xml2, schemaRefs: undefined }, converter ?? undefined);
464540
+ markConverterDirty2(editor);
464541
+ return { partName: created.partName };
464542
+ }
464543
+ function removeEntry2(editor, id2, dryRun) {
464544
+ const convertedXml = getConvertedXml5(editor);
464545
+ const converter = getConverter20(editor);
464546
+ const part = listMetadataParts2(convertedXml).find((candidate) => candidate.entries.some((entry) => entry.id === id2));
464547
+ if (!part)
464548
+ return false;
464549
+ if (dryRun)
464550
+ return true;
464551
+ const remaining = part.entries.filter((entry) => entry.id !== id2);
464552
+ if (remaining.length === 0) {
464553
+ removeCustomXmlPart2(convertedXml, { partName: part.partName }, converter ?? undefined);
464554
+ } else {
464555
+ patchCustomXmlPart2(convertedXml, { partName: part.partName }, { content: buildEnvelopeXml2(part.namespace, remaining), schemaRefs: undefined }, converter ?? undefined);
464556
+ }
464557
+ markConverterDirty2(editor);
464558
+ return true;
464559
+ }
464560
+ function toSummary3(entry) {
464561
+ return {
464562
+ id: entry.id,
464563
+ namespace: entry.namespace,
464564
+ partName: entry.partName
464565
+ };
464566
+ }
464567
+ function listEntries2(editor, query2) {
464568
+ let entries = listMetadataParts2(getConvertedXml5(editor)).flatMap((part) => part.entries);
464569
+ if (query2?.namespace !== undefined) {
464570
+ entries = entries.filter((entry) => entry.namespace === query2.namespace);
464571
+ }
464572
+ if (query2?.within !== undefined) {
464573
+ entries = entries.filter((entry) => anchorOverlaps2(editor, entry.id, query2.within));
464574
+ }
464575
+ return entries;
464576
+ }
464577
+ function metadataListWrapper2(editor, query2) {
464578
+ const allItems = listEntries2(editor, query2).map((entry) => {
464579
+ const summary = toSummary3(entry);
464580
+ return buildDiscoveryItem2(summary.id, buildResolvedHandle2(`metadata:${summary.id}`, "ephemeral", "ext:anchoredMetadata"), summary);
464581
+ });
464582
+ const { total, items } = paginate2(allItems, query2?.offset, query2?.limit);
464583
+ return buildDiscoveryResult2({
464584
+ evaluatedRevision: getRevision2(editor),
464585
+ total,
464586
+ items,
464587
+ page: {
464588
+ limit: query2?.limit ?? total,
464589
+ offset: query2?.offset ?? 0,
464590
+ returned: items.length
464591
+ }
464592
+ });
464593
+ }
464594
+ function metadataGetWrapper2(editor, input2) {
464595
+ return findEntry2(getConvertedXml5(editor), input2.id);
464596
+ }
464597
+ function metadataResolveWrapper2(editor, input2) {
464598
+ const target = resolveAnchorTarget2(editor, input2.id);
464599
+ return target ? { id: input2.id, target } : null;
464600
+ }
464601
+ function metadataAttachWrapper2(editor, input2, options) {
464602
+ rejectTrackedMode2("metadata.attach", options);
464603
+ const id2 = input2.id ?? v42();
464604
+ const convertedXml = getConvertedXml5(editor);
464605
+ try {
464606
+ resolveSelectionTarget2(editor, input2.target);
464607
+ } catch (error48) {
464608
+ const message = error48 instanceof Error ? error48.message : String(error48);
464609
+ return failure3("INVALID_TARGET", message);
464610
+ }
464611
+ if (hasPayloadEntry2(convertedXml, id2) || hasAnchor2(editor, id2)) {
464612
+ return failure3("INVALID_INPUT", `Anchored metadata id "${id2}" already exists.`);
464613
+ }
464614
+ const preview = writeEntry2(editor, input2.namespace, id2, input2.payload, true);
464615
+ if (options?.dryRun) {
464616
+ checkRevision2(editor, options.expectedRevision);
464617
+ return { success: true, id: id2, namespace: input2.namespace, partName: preview.partName };
464618
+ }
464619
+ const receipt2 = executeDomainCommand2(editor, () => {
464620
+ wrapRangeInAnchor2(editor, input2.target, id2);
464621
+ writeEntry2(editor, input2.namespace, id2, input2.payload, false);
464622
+ return true;
464623
+ }, { expectedRevision: options?.expectedRevision });
464624
+ if (receipt2.steps[0]?.effect !== "changed") {
464625
+ return failure3("INVALID_TARGET", "metadata.attach did not change the document.");
464626
+ }
464627
+ const entry = findEntry2(getConvertedXml5(editor), id2);
464628
+ return { success: true, id: id2, namespace: input2.namespace, partName: entry?.partName ?? preview.partName };
464629
+ }
464630
+ function metadataUpdateWrapper2(editor, input2, options) {
464631
+ rejectTrackedMode2("metadata.update", options);
464632
+ const existing = findEntry2(getConvertedXml5(editor), input2.id);
464633
+ if (!existing) {
464634
+ return failure3("TARGET_NOT_FOUND", `Anchored metadata entry "${input2.id}" not found.`);
464635
+ }
464636
+ return executeOutOfBandMutation2(editor, (dryRun) => {
464637
+ if (!dryRun) {
464638
+ writeEntry2(editor, existing.namespace, input2.id, input2.payload, false);
464639
+ }
464640
+ return { changed: true, payload: { success: true, id: input2.id } };
464641
+ }, { dryRun: options?.dryRun ?? false, expectedRevision: options?.expectedRevision });
464642
+ }
464643
+ function metadataRemoveWrapper2(editor, input2, options) {
464644
+ rejectTrackedMode2("metadata.remove", options);
464645
+ const payloadExists = hasPayloadEntry2(getConvertedXml5(editor), input2.id);
464646
+ const anchorExists = hasAnchor2(editor, input2.id);
464647
+ if (!payloadExists && !anchorExists) {
464648
+ return failure3("TARGET_NOT_FOUND", `Anchored metadata entry "${input2.id}" not found.`);
464649
+ }
464650
+ if (options?.dryRun) {
464651
+ checkRevision2(editor, options.expectedRevision);
464652
+ return { success: true, id: input2.id };
464653
+ }
464654
+ if (!anchorExists) {
464655
+ return executeOutOfBandMutation2(editor, (dryRun) => {
464656
+ const changed = removeEntry2(editor, input2.id, dryRun);
464657
+ return { changed, payload: { success: true, id: input2.id } };
464658
+ }, { dryRun: false, expectedRevision: options?.expectedRevision });
464659
+ }
464660
+ const receipt2 = executeDomainCommand2(editor, () => {
464661
+ unwrapAnchor2(editor, input2.id);
464662
+ removeEntry2(editor, input2.id, false);
464663
+ markConverterDirty2(editor);
464664
+ return true;
464665
+ }, { expectedRevision: options?.expectedRevision });
464666
+ if (receipt2.steps[0]?.effect !== "changed") {
464667
+ return failure3("TARGET_NOT_FOUND", `Anchored metadata entry "${input2.id}" not found.`);
464668
+ }
464669
+ return { success: true, id: input2.id };
464670
+ }
464671
+ function createAnchoredMetadataAdapter2(editor) {
464672
+ return {
464673
+ attach: (input2, options) => metadataAttachWrapper2(editor, input2, options),
464674
+ list: (query2) => metadataListWrapper2(editor, query2),
464675
+ get: (input2) => metadataGetWrapper2(editor, input2),
464676
+ update: (input2, options) => metadataUpdateWrapper2(editor, input2, options),
464677
+ remove: (input2, options) => metadataRemoveWrapper2(editor, input2, options),
464678
+ resolve: (input2) => metadataResolveWrapper2(editor, input2)
464679
+ };
464680
+ }
464681
+ var init_anchored_metadata_wrappers = __esm(() => {
464682
+ init_wrapper();
464683
+ init_src();
464684
+ init_custom_xml_parts();
464685
+ init_errors4();
464686
+ init_index_cache();
464687
+ init_node_address_resolver();
464688
+ init_selection_target_resolver();
464689
+ init_mutation_helpers();
464690
+ init_adapter_utils();
464691
+ init_content_controls2();
464692
+ init_out_of_band_mutation();
464693
+ init_plan_wrappers();
464694
+ init_revision_tracker();
464695
+ });
464696
+
464697
+ // ../../packages/super-editor/src/editors/v1/document-api-adapters/protection-adapter.ts
464698
+ function getConverter21(editor) {
463388
464699
  return editor.converter ?? undefined;
463389
464700
  }
463390
464701
  function requireConverter3(editor, operationName) {
463391
- const converter = getConverter20(editor);
464702
+ const converter = getConverter21(editor);
463392
464703
  if (!converter) {
463393
464704
  throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", `${operationName} requires an active document converter.`);
463394
464705
  }
@@ -463414,7 +464725,7 @@ function protectionGetAdapter2(editor) {
463414
464725
  if (stored?.initialized) {
463415
464726
  return stored.state;
463416
464727
  }
463417
- const converter = getConverter20(editor);
464728
+ const converter = getConverter21(editor);
463418
464729
  const settingsRoot = converter ? readSettingsRoot2(converter) : null;
463419
464730
  return parseProtectionState2(settingsRoot);
463420
464731
  }
@@ -464190,7 +465501,7 @@ function footnoteFailure2(code10, message) {
464190
465501
  function configSuccess2() {
464191
465502
  return { success: true };
464192
465503
  }
464193
- function getConverter21(editor) {
465504
+ function getConverter22(editor) {
464194
465505
  const converter = editor.converter;
464195
465506
  if (!converter) {
464196
465507
  throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "converter not available.");
@@ -464257,7 +465568,7 @@ function footnotesGetWrapper2(editor, input2) {
464257
465568
  function footnotesInsertWrapper2(editor, input2, options) {
464258
465569
  rejectTrackedMode2("footnotes.insert", options);
464259
465570
  checkRevision2(editor, options?.expectedRevision);
464260
- const converter = getConverter21(editor);
465571
+ const converter = getConverter22(editor);
464261
465572
  const notesConfig = getNotesConfig2(input2.type);
464262
465573
  const noteId = allocateNextNoteId2(editor, converter, input2.type);
464263
465574
  const address2 = { kind: "entity", entityType: "footnote", noteId };
@@ -464411,7 +465722,7 @@ function footnotesConfigureWrapper2(editor, input2, options) {
464411
465722
  return configSuccess2();
464412
465723
  }
464413
465724
  function syncFootnotePropertiesCache2(editor) {
464414
- const converter = getConverter21(editor);
465725
+ const converter = getConverter22(editor);
464415
465726
  if (!converter?.footnoteProperties || converter.footnoteProperties.source !== "settings")
464416
465727
  return;
464417
465728
  const settingsPart = converter.convertedXml?.["word/settings.xml"];
@@ -467339,6 +468650,7 @@ function assembleDocumentApiAdapters2(editor) {
467339
468650
  customXml: {
467340
468651
  parts: createCustomXmlPartsAdapter2(editor)
467341
468652
  },
468653
+ metadata: createAnchoredMetadataAdapter2(editor),
467342
468654
  footnotes: {
467343
468655
  list: (query2) => footnotesListWrapper2(editor, query2),
467344
468656
  get: (input2) => footnotesGetWrapper2(editor, input2),
@@ -467497,6 +468809,7 @@ var init_assemble_adapters = __esm(() => {
467497
468809
  init_header_footers_adapter();
467498
468810
  init_bookmark_wrappers();
467499
468811
  init_custom_xml_wrappers();
468812
+ init_anchored_metadata_wrappers();
467500
468813
  init_protection_adapter();
467501
468814
  init_permission_ranges_adapter();
467502
468815
  init_footnote_wrappers();