docxmlater 10.3.0 → 10.3.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipManager.d.ts","sourceRoot":"","sources":["../../src/core/RelationshipManager.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMhE,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,MAAM,CAAS;;IAevB,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY;IAmBzD,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAOrD,mBAAmB,IAAI,YAAY,EAAE;IAQrC,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,YAAY,EAAE;IAQvE,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IASpC,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAOvC,QAAQ,IAAI,MAAM;IAOlB,KAAK,IAAI,IAAI;IAUb,UAAU,IAAI,MAAM;IAQpB,SAAS,IAAI,YAAY;IASzB,YAAY,IAAI,YAAY;IAS5B,YAAY,IAAI,YAAY;IAS5B,WAAW,IAAI,YAAY;IAS3B,cAAc,IAAI,YAAY;IAS9B,QAAQ,IAAI,YAAY;IAUxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAUtC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAUvC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAUvC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;IAgBvC,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAyBtE,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG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AAG,YAAY;IAUtC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAUvC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAUvC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;IAgBvC,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAyBtE,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAgBlE,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;IAqB/C,wBAAwB,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM;IAyB5D,WAAW,IAAI,YAAY;IAS3B,YAAY,IAAI,YAAY;IAS5B,WAAW,IAAI,YAAY;IAS3B,SAAS,IAAI,YAAY;IASzB,WAAW,IAAI,MAAM;IAmBrB,MAAM,CAAC,iBAAiB,IAAI,mBAAmB;IAe/C,MAAM,CAAC,MAAM,IAAI,mBAAmB;IASpC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB;CAyDjD"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RelationshipManager = void 0;
4
4
  const Relationship_1 = require("./Relationship");
5
5
  const XMLParser_1 = require("../xml/XMLParser");
6
+ const validation_1 = require("../utils/validation");
6
7
  class RelationshipManager {
7
8
  relationships;
8
9
  nextId;
@@ -181,10 +182,17 @@ class RelationshipManager {
181
182
  const validatedTargetMode = targetMode === 'Internal' || targetMode === 'External' || targetMode === undefined
182
183
  ? targetMode
183
184
  : undefined;
185
+ let sanitizedTarget = target;
186
+ if (type.endsWith('/hyperlink')) {
187
+ const result = (0, validation_1.sanitizeHyperlinkUrl)(target);
188
+ if (result) {
189
+ sanitizedTarget = result.url;
190
+ }
191
+ }
184
192
  const relationship = Relationship_1.Relationship.create({
185
193
  id,
186
194
  type,
187
- target,
195
+ target: sanitizedTarget,
188
196
  targetMode: validatedTargetMode || 'Internal',
189
197
  });
190
198
  manager.addRelationship(relationship);
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipManager.js","sourceRoot":"","sources":["../../src/core/RelationshipManager.ts"],"names":[],"mappings":";;;AAOA,iDAAgE;AAChE,gDAA6C;AAK7C,MAAa,mBAAmB;IACtB,aAAa,CAA4B;IACzC,MAAM,CAAS;IAKvB;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IAOD,eAAe,CAAC,YAA0B;QACxC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,YAAY,CAAC,CAAC;QAG3D,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC;QACxD,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjB,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBACzB,IAAI,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAMD,eAAe,CAAC,EAAU;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAKD,mBAAmB;QACjB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAMD,sBAAsB,CAAC,IAA+B;QACpD,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,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SAAS;oBAChF,CAAC,CAAC,UAAU;oBACZ,CAAC,CAAC,SAAS,CAAC;gBAGhB,MAAM,YAAY,GAAG,2BAAY,CAAC,MAAM,CAAC;oBACvC,EAAE;oBACF,IAAI;oBACJ,MAAM;oBACN,UAAU,EAAE,mBAAmB,IAAI,UAAU;iBAC9C,CAAC,CAAC;gBAEH,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/ZD,kDA+ZC","sourcesContent":["/**\n * RelationshipManager - Manages collections of relationships\n *\n * Handles relationship creation, tracking, and XML generation for various\n * document parts (document.xml, header.xml, footer.xml, etc.)\n */\n\nimport { Relationship, RelationshipType } from './Relationship';\nimport { XMLParser } from '../xml/XMLParser';\n\n/**\n * Manages relationships for a document or document part\n */\nexport class RelationshipManager {\n private relationships: Map<string, Relationship>;\n private nextId: number;\n\n /**\n * Creates a new relationship manager\n */\n constructor() {\n this.relationships = new Map();\n this.nextId = 1;\n }\n\n /**\n * Adds a relationship\n * @param relationship The relationship to add\n * @returns The relationship that was added\n */\n addRelationship(relationship: Relationship): Relationship {\n this.relationships.set(relationship.getId(), relationship);\n\n // Update next ID if necessary\n const idMatch = /^rId(\\d+)$/.exec(relationship.getId());\n if (idMatch?.[1]) {\n const idNum = parseInt(idMatch[1], 10);\n if (idNum >= this.nextId) {\n this.nextId = idNum + 1;\n }\n }\n\n return relationship;\n }\n\n /**\n * Gets a relationship by ID\n * @param id The relationship ID\n */\n getRelationship(id: string): Relationship | undefined {\n return this.relationships.get(id);\n }\n\n /**\n * Gets all relationships\n */\n getAllRelationships(): Relationship[] {\n return Array.from(this.relationships.values());\n }\n\n /**\n * Gets relationships of a specific type\n * @param type The relationship type\n */\n getRelationshipsByType(type: string | RelationshipType): Relationship[] {\n return this.getAllRelationships().filter((rel) => rel.getType() === type);\n }\n\n /**\n * Checks if a relationship exists\n * @param id The relationship ID\n */\n hasRelationship(id: string): boolean {\n return this.relationships.has(id);\n }\n\n /**\n * Removes a relationship\n * @param id The relationship ID\n * @returns True if removed, false if not found\n */\n removeRelationship(id: string): boolean {\n return this.relationships.delete(id);\n }\n\n /**\n * Gets the number of relationships\n */\n getCount(): number {\n return this.relationships.size;\n }\n\n /**\n * Clears all relationships\n */\n clear(): this {\n this.relationships.clear();\n this.nextId = 1;\n return this;\n }\n\n /**\n * Generates a new unique relationship ID\n * @returns New relationship ID (e.g., 'rId1', 'rId2')\n */\n generateId(): string {\n return `rId${this.nextId++}`;\n }\n\n /**\n * Adds a styles relationship\n * @returns The created relationship\n */\n addStyles(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createStyles(id));\n }\n\n /**\n * Adds a numbering relationship\n * @returns The created relationship\n */\n addNumbering(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createNumbering(id));\n }\n\n /**\n * Adds a fontTable relationship\n * @returns The created relationship\n */\n addFontTable(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createFontTable(id));\n }\n\n /**\n * Adds a settings relationship\n * @returns The created relationship\n */\n addSettings(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createSettings(id));\n }\n\n /**\n * Adds a webSettings relationship\n * @returns The created relationship\n */\n addWebSettings(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createWebSettings(id));\n }\n\n /**\n * Adds a theme relationship\n * @returns The created relationship\n */\n addTheme(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createTheme(id));\n }\n\n /**\n * Adds an image relationship\n * @param target Image path relative to the part (e.g., 'media/image1.png')\n * @returns The created relationship\n */\n addImage(target: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createImage(id, target));\n }\n\n /**\n * Adds a header relationship\n * @param target Header file path (e.g., 'header1.xml')\n * @returns The created relationship\n */\n addHeader(target: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createHeader(id, target));\n }\n\n /**\n * Adds a footer relationship\n * @param target Footer file path (e.g., 'footer1.xml')\n * @returns The created relationship\n */\n addFooter(target: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createFooter(id, target));\n }\n\n /**\n * Adds a hyperlink relationship\n * @param url The hyperlink URL\n * @returns The created relationship\n */\n addHyperlink(url: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createHyperlink(id, url));\n }\n\n /**\n * Updates the target URL of an existing hyperlink relationship\n *\n * This method modifies an existing relationship's target in-place, maintaining\n * the same relationship ID. This is crucial for proper OpenXML compliance\n * per ECMA-376 §17.16.22, as it prevents orphaned relationships.\n *\n * @param relationshipId The ID of the relationship to update\n * @param newUrl The new URL to set\n * @returns True if updated, false if relationship not found\n */\n updateHyperlinkTarget(relationshipId: string, newUrl: string): boolean {\n const relationship = this.getRelationship(relationshipId);\n if (!relationship) {\n return false;\n }\n\n // Verify this is a hyperlink relationship\n if (relationship.getType() !== RelationshipType.HYPERLINK) {\n throw new Error(\n `Relationship ${relationshipId} is not a hyperlink relationship. ` +\n `Type is ${relationship.getType()}, expected ${RelationshipType.HYPERLINK}`\n );\n }\n\n // Update the target URL\n relationship.setTarget(newUrl);\n return true;\n }\n\n /**\n * Finds a hyperlink relationship by its target URL\n *\n * @param targetUrl The URL to search for\n * @returns The matching relationship, or undefined if not found\n */\n findHyperlinkByTarget(targetUrl: string): Relationship | undefined {\n return this.getAllRelationships().find(\n (rel) => rel.getType() === RelationshipType.HYPERLINK && rel.getTarget() === targetUrl\n );\n }\n\n /**\n * Gets or creates a hyperlink relationship for the given URL\n *\n * This method ensures we don't create duplicate relationships for the same URL.\n * If a relationship already exists for the URL, it returns the existing one.\n * Otherwise, it creates a new relationship.\n *\n * @param url The hyperlink URL\n * @returns The existing or newly created relationship\n */\n getOrCreateHyperlink(url: string): Relationship {\n // Check if relationship already exists for this URL\n const existing = this.findHyperlinkByTarget(url);\n if (existing) {\n return existing;\n }\n\n // Create new relationship\n return this.addHyperlink(url);\n }\n\n /**\n * Removes orphaned hyperlink relationships\n *\n * This method removes hyperlink relationships that are no longer referenced\n * by any hyperlink in the document. Call this after updating URLs to clean\n * up any orphaned relationships.\n *\n * @param referencedIds Set of relationship IDs that are still in use\n * @returns Number of relationships removed\n */\n removeOrphanedHyperlinks(referencedIds: Set<string>): number {\n let removed = 0;\n const toRemove: string[] = [];\n\n // Find orphaned relationships\n for (const rel of this.getAllRelationships()) {\n if (rel.getType() === RelationshipType.HYPERLINK && !referencedIds.has(rel.getId())) {\n toRemove.push(rel.getId());\n }\n }\n\n // Remove orphaned relationships\n for (const id of toRemove) {\n if (this.removeRelationship(id)) {\n removed++;\n }\n }\n\n return removed;\n }\n\n /**\n * Adds a comments relationship\n * @returns The created relationship\n */\n addComments(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createComments(id));\n }\n\n /**\n * Adds a footnotes relationship\n * @returns The created relationship\n */\n addFootnotes(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createFootnotes(id));\n }\n\n /**\n * Adds an endnotes relationship\n * @returns The created relationship\n */\n addEndnotes(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createEndnotes(id));\n }\n\n /**\n * Adds a people relationship (track changes authors)\n * @returns The created relationship\n */\n addPeople(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createPeople(id));\n }\n\n /**\n * Generates the relationships XML file content\n * @returns Complete XML string for .rels file\n */\n generateXml(): string {\n const relationships = this.getAllRelationships();\n\n let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\\n';\n xml += '<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\\n';\n\n for (const rel of relationships) {\n xml += rel.toXML() + '\\n';\n }\n\n xml += '</Relationships>';\n\n return xml;\n }\n\n /**\n * Creates a new relationship manager with common document relationships\n * @returns RelationshipManager with styles, numbering, fontTable, settings, and theme relationships\n */\n static createForDocument(): RelationshipManager {\n const manager = new RelationshipManager();\n manager.addStyles();\n manager.addNumbering();\n manager.addFontTable();\n manager.addSettings();\n manager.addWebSettings();\n manager.addTheme();\n return manager;\n }\n\n /**\n * Creates an empty relationship manager\n * @returns Empty RelationshipManager\n */\n static create(): RelationshipManager {\n return new RelationshipManager();\n }\n\n /**\n * Parses relationships from XML string and creates a populated manager\n * @param xml The relationships XML content (.rels file)\n * @returns RelationshipManager with parsed relationships\n */\n static fromXml(xml: string): RelationshipManager {\n const manager = new RelationshipManager();\n\n // Prevent ReDoS: validate input size (typical .rels files are < 10KB)\n if (xml.length > 100000) {\n throw new Error(\n 'Relationships XML file too large (>100KB). Possible malicious input or corrupted file.'\n );\n }\n\n // Use XMLParser to extract all Relationship elements\n const relationshipElements = XMLParser.extractElements(xml, 'Relationship');\n\n // Prevent infinite loops: check relationship count\n if (relationshipElements.length > 1000) {\n throw new Error('Too many relationships in XML file (>1000). Possible malicious input.');\n }\n\n // Process each relationship element\n for (const relationshipElement of relationshipElements) {\n // Extract attributes using XMLParser\n const id = XMLParser.extractAttribute(relationshipElement, 'Id');\n const type = XMLParser.extractAttribute(relationshipElement, 'Type');\n const target = XMLParser.extractAttribute(relationshipElement, 'Target');\n const targetMode = XMLParser.extractAttribute(relationshipElement, 'TargetMode');\n\n // Only create relationship if all required attributes present\n if (id && type && target) {\n // Validate targetMode before type assertion\n const validatedTargetMode =\n targetMode === 'Internal' || targetMode === 'External' || targetMode === undefined\n ? targetMode\n : undefined;\n\n // Create and add relationship\n const relationship = Relationship.create({\n id,\n type,\n target,\n targetMode: validatedTargetMode || 'Internal',\n });\n\n manager.addRelationship(relationship);\n }\n }\n\n return manager;\n }\n}\n"]}
1
+ {"version":3,"file":"RelationshipManager.js","sourceRoot":"","sources":["../../src/core/RelationshipManager.ts"],"names":[],"mappings":";;;AAOA,iDAAgE;AAChE,gDAA6C;AAC7C,oDAA2D;AAK3D,MAAa,mBAAmB;IACtB,aAAa,CAA4B;IACzC,MAAM,CAAS;IAKvB;QACE,IAAI,CAAC,aAAa,GAA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,CAAC,GAAG,CAAC;oBAC/B,CAAC;gBACH,CAAC;gBAGD,MAAM,YAAY,GAAG,2BAAY,CAAC,MAAM,CAAC;oBACvC,EAAE;oBACF,IAAI;oBACJ,MAAM,EAAE,eAAe;oBACvB,UAAU,EAAE,mBAAmB,IAAI,UAAU;iBAC9C,CAAC,CAAC;gBAEH,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAxaD,kDAwaC","sourcesContent":["/**\n * RelationshipManager - Manages collections of relationships\n *\n * Handles relationship creation, tracking, and XML generation for various\n * document parts (document.xml, header.xml, footer.xml, etc.)\n */\n\nimport { Relationship, RelationshipType } from './Relationship';\nimport { XMLParser } from '../xml/XMLParser';\nimport { sanitizeHyperlinkUrl } from '../utils/validation';\n\n/**\n * Manages relationships for a document or document part\n */\nexport class RelationshipManager {\n private relationships: Map<string, Relationship>;\n private nextId: number;\n\n /**\n * Creates a new relationship manager\n */\n constructor() {\n this.relationships = new Map();\n this.nextId = 1;\n }\n\n /**\n * Adds a relationship\n * @param relationship The relationship to add\n * @returns The relationship that was added\n */\n addRelationship(relationship: Relationship): Relationship {\n this.relationships.set(relationship.getId(), relationship);\n\n // Update next ID if necessary\n const idMatch = /^rId(\\d+)$/.exec(relationship.getId());\n if (idMatch?.[1]) {\n const idNum = parseInt(idMatch[1], 10);\n if (idNum >= this.nextId) {\n this.nextId = idNum + 1;\n }\n }\n\n return relationship;\n }\n\n /**\n * Gets a relationship by ID\n * @param id The relationship ID\n */\n getRelationship(id: string): Relationship | undefined {\n return this.relationships.get(id);\n }\n\n /**\n * Gets all relationships\n */\n getAllRelationships(): Relationship[] {\n return Array.from(this.relationships.values());\n }\n\n /**\n * Gets relationships of a specific type\n * @param type The relationship type\n */\n getRelationshipsByType(type: string | RelationshipType): Relationship[] {\n return this.getAllRelationships().filter((rel) => rel.getType() === type);\n }\n\n /**\n * Checks if a relationship exists\n * @param id The relationship ID\n */\n hasRelationship(id: string): boolean {\n return this.relationships.has(id);\n }\n\n /**\n * Removes a relationship\n * @param id The relationship ID\n * @returns True if removed, false if not found\n */\n removeRelationship(id: string): boolean {\n return this.relationships.delete(id);\n }\n\n /**\n * Gets the number of relationships\n */\n getCount(): number {\n return this.relationships.size;\n }\n\n /**\n * Clears all relationships\n */\n clear(): this {\n this.relationships.clear();\n this.nextId = 1;\n return this;\n }\n\n /**\n * Generates a new unique relationship ID\n * @returns New relationship ID (e.g., 'rId1', 'rId2')\n */\n generateId(): string {\n return `rId${this.nextId++}`;\n }\n\n /**\n * Adds a styles relationship\n * @returns The created relationship\n */\n addStyles(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createStyles(id));\n }\n\n /**\n * Adds a numbering relationship\n * @returns The created relationship\n */\n addNumbering(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createNumbering(id));\n }\n\n /**\n * Adds a fontTable relationship\n * @returns The created relationship\n */\n addFontTable(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createFontTable(id));\n }\n\n /**\n * Adds a settings relationship\n * @returns The created relationship\n */\n addSettings(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createSettings(id));\n }\n\n /**\n * Adds a webSettings relationship\n * @returns The created relationship\n */\n addWebSettings(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createWebSettings(id));\n }\n\n /**\n * Adds a theme relationship\n * @returns The created relationship\n */\n addTheme(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createTheme(id));\n }\n\n /**\n * Adds an image relationship\n * @param target Image path relative to the part (e.g., 'media/image1.png')\n * @returns The created relationship\n */\n addImage(target: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createImage(id, target));\n }\n\n /**\n * Adds a header relationship\n * @param target Header file path (e.g., 'header1.xml')\n * @returns The created relationship\n */\n addHeader(target: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createHeader(id, target));\n }\n\n /**\n * Adds a footer relationship\n * @param target Footer file path (e.g., 'footer1.xml')\n * @returns The created relationship\n */\n addFooter(target: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createFooter(id, target));\n }\n\n /**\n * Adds a hyperlink relationship\n * @param url The hyperlink URL\n * @returns The created relationship\n */\n addHyperlink(url: string): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createHyperlink(id, url));\n }\n\n /**\n * Updates the target URL of an existing hyperlink relationship\n *\n * This method modifies an existing relationship's target in-place, maintaining\n * the same relationship ID. This is crucial for proper OpenXML compliance\n * per ECMA-376 §17.16.22, as it prevents orphaned relationships.\n *\n * @param relationshipId The ID of the relationship to update\n * @param newUrl The new URL to set\n * @returns True if updated, false if relationship not found\n */\n updateHyperlinkTarget(relationshipId: string, newUrl: string): boolean {\n const relationship = this.getRelationship(relationshipId);\n if (!relationship) {\n return false;\n }\n\n // Verify this is a hyperlink relationship\n if (relationship.getType() !== RelationshipType.HYPERLINK) {\n throw new Error(\n `Relationship ${relationshipId} is not a hyperlink relationship. ` +\n `Type is ${relationship.getType()}, expected ${RelationshipType.HYPERLINK}`\n );\n }\n\n // Update the target URL\n relationship.setTarget(newUrl);\n return true;\n }\n\n /**\n * Finds a hyperlink relationship by its target URL\n *\n * @param targetUrl The URL to search for\n * @returns The matching relationship, or undefined if not found\n */\n findHyperlinkByTarget(targetUrl: string): Relationship | undefined {\n return this.getAllRelationships().find(\n (rel) => rel.getType() === RelationshipType.HYPERLINK && rel.getTarget() === targetUrl\n );\n }\n\n /**\n * Gets or creates a hyperlink relationship for the given URL\n *\n * This method ensures we don't create duplicate relationships for the same URL.\n * If a relationship already exists for the URL, it returns the existing one.\n * Otherwise, it creates a new relationship.\n *\n * @param url The hyperlink URL\n * @returns The existing or newly created relationship\n */\n getOrCreateHyperlink(url: string): Relationship {\n // Check if relationship already exists for this URL\n const existing = this.findHyperlinkByTarget(url);\n if (existing) {\n return existing;\n }\n\n // Create new relationship\n return this.addHyperlink(url);\n }\n\n /**\n * Removes orphaned hyperlink relationships\n *\n * This method removes hyperlink relationships that are no longer referenced\n * by any hyperlink in the document. Call this after updating URLs to clean\n * up any orphaned relationships.\n *\n * @param referencedIds Set of relationship IDs that are still in use\n * @returns Number of relationships removed\n */\n removeOrphanedHyperlinks(referencedIds: Set<string>): number {\n let removed = 0;\n const toRemove: string[] = [];\n\n // Find orphaned relationships\n for (const rel of this.getAllRelationships()) {\n if (rel.getType() === RelationshipType.HYPERLINK && !referencedIds.has(rel.getId())) {\n toRemove.push(rel.getId());\n }\n }\n\n // Remove orphaned relationships\n for (const id of toRemove) {\n if (this.removeRelationship(id)) {\n removed++;\n }\n }\n\n return removed;\n }\n\n /**\n * Adds a comments relationship\n * @returns The created relationship\n */\n addComments(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createComments(id));\n }\n\n /**\n * Adds a footnotes relationship\n * @returns The created relationship\n */\n addFootnotes(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createFootnotes(id));\n }\n\n /**\n * Adds an endnotes relationship\n * @returns The created relationship\n */\n addEndnotes(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createEndnotes(id));\n }\n\n /**\n * Adds a people relationship (track changes authors)\n * @returns The created relationship\n */\n addPeople(): Relationship {\n const id = this.generateId();\n return this.addRelationship(Relationship.createPeople(id));\n }\n\n /**\n * Generates the relationships XML file content\n * @returns Complete XML string for .rels file\n */\n generateXml(): string {\n const relationships = this.getAllRelationships();\n\n let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\\n';\n xml += '<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\\n';\n\n for (const rel of relationships) {\n xml += rel.toXML() + '\\n';\n }\n\n xml += '</Relationships>';\n\n return xml;\n }\n\n /**\n * Creates a new relationship manager with common document relationships\n * @returns RelationshipManager with styles, numbering, fontTable, settings, and theme relationships\n */\n static createForDocument(): RelationshipManager {\n const manager = new RelationshipManager();\n manager.addStyles();\n manager.addNumbering();\n manager.addFontTable();\n manager.addSettings();\n manager.addWebSettings();\n manager.addTheme();\n return manager;\n }\n\n /**\n * Creates an empty relationship manager\n * @returns Empty RelationshipManager\n */\n static create(): RelationshipManager {\n return new RelationshipManager();\n }\n\n /**\n * Parses relationships from XML string and creates a populated manager\n * @param xml The relationships XML content (.rels file)\n * @returns RelationshipManager with parsed relationships\n */\n static fromXml(xml: string): RelationshipManager {\n const manager = new RelationshipManager();\n\n // Prevent ReDoS: validate input size (typical .rels files are < 10KB)\n if (xml.length > 100000) {\n throw new Error(\n 'Relationships XML file too large (>100KB). Possible malicious input or corrupted file.'\n );\n }\n\n // Use XMLParser to extract all Relationship elements\n const relationshipElements = XMLParser.extractElements(xml, 'Relationship');\n\n // Prevent infinite loops: check relationship count\n if (relationshipElements.length > 1000) {\n throw new Error('Too many relationships in XML file (>1000). Possible malicious input.');\n }\n\n // Process each relationship element\n for (const relationshipElement of relationshipElements) {\n // Extract attributes using XMLParser\n const id = XMLParser.extractAttribute(relationshipElement, 'Id');\n const type = XMLParser.extractAttribute(relationshipElement, 'Type');\n const target = XMLParser.extractAttribute(relationshipElement, 'Target');\n const targetMode = XMLParser.extractAttribute(relationshipElement, 'TargetMode');\n\n // Only create relationship if all required attributes present\n if (id && type && target) {\n // Validate targetMode before type assertion\n const validatedTargetMode =\n targetMode === 'Internal' || targetMode === 'External' || targetMode === undefined\n ? targetMode\n : undefined;\n\n // Sanitize hyperlink URLs (strip browser extension prefixes)\n let sanitizedTarget = target;\n if (type.endsWith('/hyperlink')) {\n const result = sanitizeHyperlinkUrl(target);\n if (result) {\n sanitizedTarget = result.url;\n }\n }\n\n // Create and add relationship\n const relationship = Relationship.create({\n id,\n type,\n target: sanitizedTarget,\n targetMode: validatedTargetMode || 'Internal',\n });\n\n manager.addRelationship(relationship);\n }\n }\n\n return manager;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Hyperlink.d.ts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AO,CAAC;QACf,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IAgJF,yBAAyB,IAAI,IAAI;IAkBjC,UAAU,IAAI,OAAO;IAOrB,UAAU,IAAI,OAAO;IAyBrB,KAAK,IAAI,SAAS;IAqClB,KAAK,IAAI,UAAU;IAgFnB,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS;IAUvF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS;IAU1F,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS;IAcvF,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS;IAYvF,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,mBAAmB,GAAG,SAAS;CAG1D"}
@@ -396,6 +396,11 @@ class Hyperlink {
396
396
  return { valid: false, issues, fixed, originalUrl };
397
397
  }
398
398
  if (fixCommonIssues && fixedUrl) {
399
+ const sanitizeResult = (0, validation_1.sanitizeHyperlinkUrl)(fixedUrl);
400
+ if (sanitizeResult) {
401
+ fixedUrl = sanitizeResult.url;
402
+ fixed.push(...sanitizeResult.fixes);
403
+ }
399
404
  if (!/^[a-z]+:\/\//i.exec(fixedUrl)) {
400
405
  fixedUrl = 'https://' + fixedUrl;
401
406
  fixed.push('Added missing protocol (https://)');
@@ -1 +1 @@
1
- {"version":3,"file":"Hyperlink.js","sourceRo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a,CAAC,GAAW,EAAE,IAAa,EAAE,UAA0B;QACzE,OAAO,IAAI,SAAS,CAAC;YACnB,GAAG;YACH,IAAI,EAAE,IAAI,IAAI,GAAG;YACjB,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAQD,MAAM,CAAC,WAAW,CAAC,KAAa,EAAE,IAAa,EAAE,UAA0B;QACzE,OAAO,IAAI,SAAS,CAAC;YACnB,GAAG,EAAE,UAAU,KAAK,EAAE;YACtB,IAAI,EAAE,IAAI,IAAI,KAAK;YACnB,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAMD,MAAM,CAAC,MAAM,CAAC,UAA+B;QAC3C,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;CACF;AAlrCD,8BAkrCC","sourcesContent":["/**\n * Hyperlink - Represents a hyperlink in a Word document\n *\n * Hyperlinks can be external (to websites, files) or internal (to bookmarks within the document).\n * They are represented using the `<w:hyperlink>` element.\n *\n * ## Important: Relationship ID Requirement\n *\n * **External hyperlinks REQUIRE a relationship ID to be set before XML generation.**\n * Per ECMA-376 Part 1 §17.16.22, `<w:hyperlink>` elements with external targets must have\n * an `r:id` attribute that references a relationship in `word/_rels/document.xml.rels`.\n *\n * ### Correct Usage Pattern:\n *\n * ```typescript\n * // RECOMMENDED: Use Document.save() - automatically handles relationships\n * const doc = Document.create();\n * const para = doc.createParagraph();\n * para.addHyperlink(Hyperlink.createExternal('https://example.com', 'Link'));\n * await doc.save('document.docx'); // ✅ Relationships auto-registered\n * ```\n *\n * ### Manual Relationship Registration (Advanced):\n *\n * ```typescript\n * const link = Hyperlink.createExternal('https://example.com', 'Link');\n * const relationship = relationshipManager.addHyperlink('https://example.com');\n * link.setRelationshipId(relationship.getId());\n * link.toXML(); // ✅ Now valid\n * ```\n *\n * ### What NOT to Do:\n *\n * ```typescript\n * const link = Hyperlink.createExternal('https://example.com', 'Link');\n * link.toXML(); // ❌ ERROR: Missing relationship ID\n * ```\n *\n * ## Internal Hyperlinks\n *\n * Internal hyperlinks (bookmarks) do NOT require relationships:\n *\n * ```typescript\n * const link = Hyperlink.createInternal('Section1', 'Go to Section 1');\n * link.toXML(); // ✅ Valid - uses w:anchor attribute\n * ```\n *\n * @see {@link https://www.ecma-international.org/publications-and-standards/standards/ecma-376/ | ECMA-376 Part 1 §17.16.22}\n */\n\nimport { XMLElement } from '../xml/XMLBuilder';\nimport { Run, RunFormatting } from './Run';\nimport { Revision } from './Revision';\nimport { validateRunText } from '../utils/validation';\nimport { defaultLogger } from '../utils/logger';\n\n/**\n * Hyperlink properties\n */\nexport interface HyperlinkProperties {\n /** Hyperlink URL (for external links) */\n url?: string;\n /** Bookmark anchor (for internal links) */\n anchor?: string;\n /** Display text (optional for empty/invisible hyperlinks) */\n text?: string;\n /** Text formatting */\n formatting?: RunFormatting;\n /** Tooltip text */\n tooltip?: string;\n /** Relationship ID (set by Document when saving) */\n relationshipId?: string;\n /** Whether this is an empty/invisible hyperlink with no display text */\n isEmpty?: boolean;\n /** Target frame attribute (e.g., \"_blank\" for new window) */\n tgtFrame?: string;\n /** History tracking attribute */\n history?: string;\n /** Document location for within-document navigation in external files (ECMA-376 §17.16.22) */\n docLocation?: string;\n}\n\n/**\n * Represents a hyperlink\n */\nexport class Hyperlink {\n private url?: string;\n private anchor?: string;\n private text: string;\n private run: Run;\n private tooltip?: string;\n private relationshipId?: string;\n private formatting: RunFormatting;\n /** Whether this is an empty/invisible hyperlink with no display text */\n private _isEmpty = false;\n /** Target frame attribute (e.g., \"_blank\" for new window) */\n private tgtFrame?: string;\n /** History tracking attribute */\n private history?: string;\n /** Document location for within-document navigation in external files */\n private docLocation?: string;\n /** Tracking context for automatic change tracking */\n private trackingContext?: import('../tracking/TrackingContext').TrackingContext;\n /** Parent paragraph reference for automatic tracking */\n private _parentParagraph?: import('./Paragraph').Paragraph;\n /** Baseline formatting captured before first tracked formatting change */\n private _preTrackingFormatting?: RunFormatting;\n\n /**\n * Creates a new hyperlink\n *\n * **Note:** A hyperlink must have either a URL (external) or anchor (internal), but not both.\n * If both are provided, the URL takes precedence and a warning is logged.\n *\n * @param properties Hyperlink properties\n */\n constructor(properties: HyperlinkProperties) {\n this.url = properties.url;\n this.anchor = properties.anchor;\n this.tooltip = properties.tooltip;\n this.relationshipId = properties.relationshipId;\n this.tgtFrame = properties.tgtFrame;\n this.history = properties.history;\n this.docLocation = properties.docLocation;\n this._isEmpty = properties.isEmpty ?? false;\n\n // VALIDATION: Warn about hybrid links (url + anchor)\n if (this.url && this.anchor) {\n defaultLogger.warn(\n `DocXML Warning: Hyperlink has both URL (\"${this.url}\") and anchor (\"${this.anchor}\"). ` +\n `This is ambiguous per ECMA-376 spec. URL will take precedence. ` +\n `Use Hyperlink.createExternal() or Hyperlink.createInternal() to avoid ambiguity.`\n );\n }\n\n // Handle empty/invisible hyperlinks (no display text)\n if (this._isEmpty) {\n this.text = '';\n this.formatting = {};\n this.run = new Run('', {});\n return;\n }\n\n // Text fallback: properties.text → url → 'Link'\n // NOTE: Do NOT use anchor (bookmark ID) as display text - it should only be used for navigation\n // Using bookmark IDs as visible text causes TOC corruption (Issue: TOC shows \"HEADING=II.MNKE7E8NA385_\" instead of proper headings)\n this.text = properties.text || this.url || 'Link';\n\n // Validate text for XML patterns\n // Default to auto-cleaning XML patterns unless explicitly disabled (matches Run behavior)\n const validation = validateRunText(this.text, {\n context: 'Hyperlink text',\n autoClean: properties.formatting?.cleanXmlFromText !== false,\n warnToConsole: true,\n });\n\n // Use cleaned text if available and cleaning was requested\n if (validation.cleanedText) {\n this.text = validation.cleanedText;\n }\n\n // Create run with default hyperlink styling (Verdana 12pt blue underlined)\n this.formatting = {\n font: 'Verdana',\n size: 12,\n color: '0000FF', // Standard hyperlink blue\n underline: 'single',\n ...properties.formatting,\n };\n\n this.run = new Run(this.text, this.formatting);\n }\n\n /**\n * Sets the tracking context for automatic change tracking.\n * Called by Document when track changes is enabled.\n * @internal\n */\n _setTrackingContext(context: import('../tracking/TrackingContext').TrackingContext): void {\n this.trackingContext = context;\n }\n\n /**\n * Sets the parent paragraph reference for automatic tracking.\n * Called by Paragraph when hyperlink is added.\n * @internal\n */\n _setParentParagraph(paragraph: import('./Paragraph').Paragraph): void {\n this._parentParagraph = paragraph;\n }\n\n /**\n * Gets the parent paragraph reference.\n * @internal\n */\n _getParentParagraph(): import('./Paragraph').Paragraph | undefined {\n return this._parentParagraph;\n }\n\n /**\n * Applies an rPrChange to the inner Run, tracking the delta between\n * the baseline formatting and the current formatting.\n *\n * On first call, captures `previousFormatting` as the baseline.\n * Subsequent calls always compare against the same baseline so that\n * multiple sequential formatting changes produce a single merged rPrChange.\n *\n * @internal\n */\n private _applyFormattingRPrChange(previousFormatting: RunFormatting): void {\n // Capture baseline on first tracked formatting change\n if (!this._preTrackingFormatting) {\n this._preTrackingFormatting = { ...previousFormatting };\n }\n\n // Build previousProperties from the baseline (only changed keys)\n const baseline = this._preTrackingFormatting;\n const current = this.formatting;\n const previousProperties: Partial<RunFormatting> = {};\n let hasChanges = false;\n\n for (const key of Object.keys(baseline) as (keyof RunFormatting)[]) {\n if (baseline[key] !== current[key]) {\n (previousProperties as Record<string, unknown>)[key] = baseline[key];\n hasChanges = true;\n }\n }\n // Also check for keys in current that weren't in baseline (new properties)\n for (const key of Object.keys(current) as (keyof RunFormatting)[]) {\n if (!(key in baseline) && current[key] !== undefined) {\n // Property didn't exist before — previous value is undefined\n (previousProperties as Record<string, unknown>)[key] = undefined;\n hasChanges = true;\n }\n }\n\n if (!hasChanges) return;\n\n const revisionId = this.trackingContext!.getRevisionManager().consumeNextId();\n const author = this.trackingContext!.getAuthor();\n\n this.run.setPropertyChangeRevision({\n id: revisionId,\n author,\n date: new Date(),\n previousProperties,\n });\n }\n\n /**\n * Gets the hyperlink URL\n */\n getUrl(): string | undefined {\n return this.url;\n }\n\n /**\n * Gets the complete URL including any anchor fragment.\n *\n * For external links that also have an anchor (e.g., internal bookmark within external page),\n * this returns the URL with the anchor appended as a fragment.\n * For internal-only links (anchor without URL), returns undefined.\n *\n * Note: As of v7.2.0, DocumentParser automatically combines external URLs with anchors\n * during parsing, so getUrl() typically returns the full URL. This method is provided\n * for cases where URL and anchor are set separately via the API.\n *\n * @returns The complete URL with fragment, or undefined for internal-only links\n *\n * @example\n * ```typescript\n * // External link with anchor fragment\n * const link = new Hyperlink({ url: 'https://example.com/', anchor: '!/view?id=123', text: 'Link' });\n * link.getUrl(); // 'https://example.com/'\n * link.getAnchor(); // '!/view?id=123'\n * link.getFullUrl(); // 'https://example.com/#!/view?id=123'\n *\n * // External link without anchor\n * const link2 = Hyperlink.createExternal('https://example.com/page', 'Link');\n * link2.getFullUrl(); // 'https://example.com/page'\n *\n * // Internal link (bookmark reference)\n * const link3 = Hyperlink.createInternal('Section1', 'Go to Section 1');\n * link3.getFullUrl(); // undefined\n * ```\n */\n getFullUrl(): string | undefined {\n if (this.url && this.anchor) {\n return this.url + '#' + this.anchor;\n }\n return this.url;\n }\n\n /**\n * Gets the anchor (for internal links)\n */\n getAnchor(): string | undefined {\n return this.anchor;\n }\n\n /**\n * Returns whether this is an empty/invisible hyperlink (has no display text).\n * Empty hyperlinks are self-closing elements in the XML.\n */\n isEmpty(): boolean {\n return this._isEmpty;\n }\n\n /**\n * Gets the target frame attribute (e.g., \"_blank\" for new window)\n */\n getTgtFrame(): string | undefined {\n return this.tgtFrame;\n }\n\n /**\n * Gets the history tracking attribute\n */\n getHistory(): string | undefined {\n return this.history;\n }\n\n /**\n * Sets the target frame attribute\n * @param tgtFrame Target frame (e.g., \"_blank\" for new window)\n */\n setTgtFrame(tgtFrame: string | undefined): this {\n this.tgtFrame = tgtFrame;\n return this;\n }\n\n /**\n * Sets the history tracking attribute\n * @param history History value (e.g., \"1\" to add to history)\n */\n setHistory(history: string | undefined): this {\n this.history = history;\n return this;\n }\n\n /**\n * Gets the document location attribute (ECMA-376 §17.16.22)\n */\n getDocLocation(): string | undefined {\n return this.docLocation;\n }\n\n /**\n * Sets the document location for within-document navigation in external files\n * @param docLocation Location string\n */\n setDocLocation(docLocation: string | undefined): this {\n this.docLocation = docLocation;\n return this;\n }\n\n /**\n * Gets the display text\n *\n * This method delegates to the internal run to ensure the returned text\n * is always accurate and matches what will be in the generated XML,\n * per ECMA-376 Part 1 §17.16.22.\n *\n * @returns The display text including any special characters (tabs, breaks, etc.)\n */\n getText(): string {\n return this.run.getText();\n }\n\n /**\n * Sets the display text\n */\n setText(text: string): this {\n // Validate text for XML patterns\n // Default to auto-cleaning unless explicitly disabled (matches Run behavior)\n const validation = validateRunText(text, {\n context: 'Hyperlink.setText',\n autoClean: this.formatting.cleanXmlFromText !== false,\n warnToConsole: true,\n });\n\n // Use cleaned text if available\n const cleanedText = validation.cleanedText || text;\n\n const previousValue = this.text;\n\n // Skip if text unchanged\n if (previousValue === cleanedText) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create delete/insert revision pair\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.text = cleanedText;\n this.run.setText(cleanedText);\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n // Clear baseline formatting (fresh start inside insertion)\n this._preTrackingFormatting = undefined;\n\n return this;\n }\n\n // Non-tracking path (original behavior)\n this.text = cleanedText;\n this.run.setText(cleanedText);\n return this;\n }\n\n /**\n * Sets the internal run directly (for advanced use cases like TOC parsing)\n * Used by DocumentParser to preserve run content (tabs, breaks, etc.)\n * @param run - The run to use for this hyperlink\n */\n setRun(run: Run): this {\n this.run = run;\n this.text = run.getText();\n return this;\n }\n\n /**\n * Gets the tooltip\n */\n getTooltip(): string | undefined {\n return this.tooltip;\n }\n\n /**\n * Sets the tooltip\n */\n setTooltip(tooltip: string): this {\n const previousValue = this.tooltip;\n\n // Skip if tooltip unchanged\n if (previousValue === tooltip) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create delete/insert revision pair\n // Tooltip is a w:hyperlink attribute — no OOXML property-change element exists for it\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.tooltip = tooltip;\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n // Clear baseline formatting (fresh start inside insertion)\n this._preTrackingFormatting = undefined;\n\n return this;\n }\n\n // Non-tracking path\n this.tooltip = tooltip;\n return this;\n }\n\n /**\n * Gets the relationship ID\n */\n getRelationshipId(): string | undefined {\n return this.relationshipId;\n }\n\n /**\n * Sets the relationship ID (called by Document during save)\n */\n setRelationshipId(id: string): this {\n this.relationshipId = id;\n return this;\n }\n\n /**\n * Sets or updates the hyperlink URL\n *\n * When URL is updated, we mark that the relationship needs updating.\n * The actual relationship update happens during Document.save() to ensure\n * proper coordination with the RelationshipManager.\n *\n * **Important:** This method maintains the relationship ID but flags it for update.\n * The RelationshipManager will update the existing relationship's target URL\n * during save, preventing orphaned relationships per ECMA-376 §17.16.22.\n *\n * @param url - The new URL (or undefined to clear)\n * @returns This hyperlink for chaining\n * @throws {Error} If clearing URL would create empty hyperlink (no URL and no anchor)\n *\n * @example\n * ```typescript\n * const link = Hyperlink.createExternal('https://old.com', 'Link');\n * link.setUrl('https://new.com'); // Marks for relationship update\n * await doc.save('updated.docx'); // Updates relationship target\n * ```\n */\n setUrl(url: string | undefined): this {\n // Validate that clearing URL doesn't create empty hyperlink\n if (!url && !this.anchor) {\n throw new Error(\n `Cannot set URL to undefined: Hyperlink \"${this.run.getText()}\" has no anchor. ` +\n `Clearing the URL would create an invalid hyperlink per ECMA-376 §17.16.22. ` +\n `Either provide a new URL or delete the hyperlink entirely.`\n );\n }\n\n // Save old URL before updating (for text fallback logic)\n const oldUrl = this.url;\n\n // Skip if URL unchanged (optimization)\n if (oldUrl === url) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create revision pair\n // OOXML has no w:hyperlinkChange element - Word tracks hyperlink changes as delete/insert pairs\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.url = url;\n this.relationshipId = undefined;\n if (this.run.getText() === oldUrl) {\n this.text = url || this.anchor || 'Link';\n this.run.setText(this.text);\n }\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n return this;\n }\n\n // Non-tracking path (original behavior)\n this.url = url;\n\n // Clear the relationship ID so it will be re-registered during save\n // This ensures the relationship target is updated to point to the new URL\n this.relationshipId = undefined;\n\n // Update text ONLY if it was auto-generated from the old URL\n // This preserves user-provided text (even if it's \"Link\")\n // Use run.getText() to ensure we check the actual current text, not stale cache\n if (this.run.getText() === oldUrl) {\n this.text = url || this.anchor || 'Link';\n this.run.setText(this.text);\n }\n\n return this;\n }\n\n /**\n * Sets the anchor (for internal links)\n * @param anchor Bookmark name to link to\n * @returns This hyperlink for chaining\n * @throws {Error} If clearing anchor would create empty hyperlink (no URL and no anchor)\n * @example\n * ```typescript\n * const link = Hyperlink.createInternal('OldBookmark', 'Go there');\n * link.setAnchor('NewBookmark'); // Update internal link target\n * ```\n */\n setAnchor(anchor: string | undefined): this {\n // Validate that clearing anchor doesn't create empty hyperlink\n if (!anchor && !this.url) {\n throw new Error(\n `Cannot set anchor to undefined: Hyperlink \"${this.run.getText()}\" has no URL. ` +\n `Clearing the anchor would create an invalid hyperlink per ECMA-376 §17.16.22. ` +\n `Either provide a new anchor or delete the hyperlink entirely.`\n );\n }\n\n // Save old anchor before updating\n const oldAnchor = this.anchor;\n\n // Skip if anchor unchanged (optimization)\n if (oldAnchor === anchor) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create revision pair\n // OOXML has no w:hyperlinkChange element - Word tracks hyperlink changes as delete/insert pairs\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.anchor = anchor;\n if (anchor && this.url) {\n defaultLogger.warn(\n `DocXML Warning: Setting anchor \"${anchor}\" on hyperlink that has URL \"${this.url}\". ` +\n `Clearing URL to make this an internal link. Use separate hyperlinks for external and internal links.`\n );\n this.url = undefined;\n this.relationshipId = undefined;\n }\n if (this.run.getText() === oldAnchor) {\n this.text = anchor || this.url || 'Link';\n this.run.setText(this.text);\n }\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n return this;\n }\n\n // Non-tracking path (original behavior)\n this.anchor = anchor;\n\n // If converting from external to internal, clear URL and relationship\n if (anchor && this.url) {\n defaultLogger.warn(\n `DocXML Warning: Setting anchor \"${anchor}\" on hyperlink that has URL \"${this.url}\". ` +\n `Clearing URL to make this an internal link. Use separate hyperlinks for external and internal links.`\n );\n this.url = undefined;\n this.relationshipId = undefined;\n }\n\n // Update text ONLY if it was auto-generated from the old anchor\n // Use run.getText() to ensure we check the actual current text, not stale cache\n if (this.run.getText() === oldAnchor) {\n this.text = anchor || this.url || 'Link';\n this.run.setText(this.text);\n }\n\n return this;\n }\n\n /**\n * Gets the run\n */\n getRun(): Run {\n return this.run;\n }\n\n /**\n * Sets run formatting\n *\n * @param formatting - The formatting to apply\n * @param options - Optional settings\n * @param options.replace - If true, replaces ALL existing formatting instead of merging.\n * Use this when you want to clear inherited styles like characterStyle.\n *\n * @example\n * ```typescript\n * // Merge mode (default): adds/updates properties while preserving others\n * hyperlink.setFormatting({ bold: true });\n *\n * // Replace mode: clears all existing formatting and applies only the new properties\n * hyperlink.setFormatting({ font: \"Verdana\", size: 12 }, { replace: true });\n * ```\n */\n setFormatting(formatting: RunFormatting, options?: { replace?: boolean }): this {\n // Update stored formatting\n const previousFormatting = { ...this.formatting };\n if (options?.replace) {\n // Replace mode: new formatting replaces ALL existing properties\n this.formatting = { ...formatting };\n } else {\n // Merge mode (default, backwards-compatible): merge with existing\n this.formatting = { ...this.formatting, ...formatting };\n }\n // Create new run with updated formatting, preserving current text\n const currentText = this.run.getText();\n this.run = new Run(currentText, this.formatting);\n this.text = currentText; // Keep cache in sync\n if (this.trackingContext?.isEnabled()) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Gets run formatting (returns this hyperlink for fluent API)\n * @returns This hyperlink for method chaining\n *\n * @example\n * ```typescript\n * hyperlink.getFormatting().setColor('0563C1').setUnderline('single');\n * ```\n */\n getFormatting(): this {\n return this;\n }\n\n /**\n * Gets the raw formatting object (for direct access)\n * @returns RunFormatting object\n */\n getRawFormatting(): RunFormatting {\n return this.formatting;\n }\n\n // ============================================================================\n // Individual Formatting Getters\n // ============================================================================\n\n /**\n * Gets the text color\n * @returns Color hex string or undefined\n */\n getColor(): string | undefined {\n return this.formatting.color;\n }\n\n /**\n * Gets the underline style\n * @returns Underline style or undefined\n */\n getUnderline(): string | boolean | undefined {\n return this.formatting.underline;\n }\n\n /**\n * Gets whether the hyperlink is bold\n * @returns True if bold, false otherwise\n */\n getBold(): boolean {\n return this.formatting.bold ?? false;\n }\n\n /**\n * Gets whether the hyperlink is italic\n * @returns True if italic, false otherwise\n */\n getItalic(): boolean {\n return this.formatting.italic ?? false;\n }\n\n /**\n * Gets the font family\n * @returns Font name or undefined\n */\n getFont(): string | undefined {\n return this.formatting.font;\n }\n\n /**\n * Gets the font size\n * @returns Font size in points or undefined\n */\n getSize(): number | undefined {\n return this.formatting.size;\n }\n\n /**\n * Sets text color\n * @param color Color in hex format (e.g., '0563C1')\n * @returns This hyperlink for chaining\n */\n setColor(color: string): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.color = color;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.color !== color) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets underline style\n * @param underline Underline style ('single', 'double', etc.)\n * @returns This hyperlink for chaining\n */\n setUnderline(underline: boolean | 'single' | 'double' | 'dotted' | 'thick' | 'dash'): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.underline = underline;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.underline !== underline) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets bold formatting\n * @param bold Bold state (default: true)\n * @returns This hyperlink for chaining\n */\n setBold(bold = true): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.bold = bold;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.bold !== bold) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets italic formatting\n * @param italic Italic state (default: true)\n * @returns This hyperlink for chaining\n */\n setItalic(italic = true): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.italic = italic;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.italic !== italic) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets font family\n * @param font Font name (e.g., 'Arial', 'Verdana')\n * @returns This hyperlink for chaining\n */\n setFont(font: string): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.font = font;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.font !== font) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets font size\n * @param size Font size in points (e.g., 12, 14)\n * @returns This hyperlink for chaining\n */\n setSize(size: number): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.size = size;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.size !== size) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Validates the hyperlink URL and optionally fixes common issues\n *\n * Performs validation and fixing of hyperlink URLs including:\n * - Checking URL accessibility (HTTP HEAD request for external links)\n * - Fixing common URL issues (missing protocol, double slashes, spaces)\n * - Validating internal bookmark references\n * - Detecting broken links\n *\n * **Note:** This method is async due to network requests for accessibility checks.\n *\n * @param options - Validation options\n * @returns Promise with validation results\n *\n * @example\n * ```typescript\n * // Basic URL fixing without network check\n * const result = await link.validateAndFix({\n * fixCommonIssues: true,\n * checkAccessibility: false\n * });\n * console.log(`Fixed: ${result.fixed.join(', ')}`);\n *\n * // Full validation with accessibility check\n * const validation = await link.validateAndFix({\n * checkAccessibility: true,\n * timeout: 5000\n * });\n * if (!validation.valid) {\n * console.log(`Issues: ${validation.issues.join(', ')}`);\n * }\n *\n * // Batch validate all hyperlinks in document\n * for (const { hyperlink } of doc.getHyperlinks()) {\n * const result = await hyperlink.validateAndFix();\n * if (result.fixed.length > 0) {\n * console.log(`Fixed ${hyperlink.getUrl()}: ${result.fixed.join(', ')}`);\n * }\n * }\n * ```\n */\n async validateAndFix(options?: {\n checkAccessibility?: boolean;\n fixCommonIssues?: boolean;\n timeout?: number;\n bookmarkManager?: { hasBookmark(name: string): boolean };\n }): Promise<{\n valid: boolean;\n issues: string[];\n fixed: string[];\n originalUrl?: string;\n fixedUrl?: string;\n }> {\n const {\n checkAccessibility = false,\n fixCommonIssues = true,\n timeout = 5000,\n bookmarkManager,\n } = options || {};\n\n const issues: string[] = [];\n const fixed: string[] = [];\n let fixedUrl = this.url;\n const originalUrl = this.url;\n\n // Internal link validation (bookmarks)\n if (this.anchor) {\n if (bookmarkManager) {\n const bookmarkExists = bookmarkManager.hasBookmark(this.anchor);\n if (!bookmarkExists) {\n issues.push(`Internal bookmark \"${this.anchor}\" not found`);\n }\n }\n return {\n valid: issues.length === 0,\n issues,\n fixed,\n originalUrl,\n };\n }\n\n // External link validation\n if (!this.url) {\n issues.push('No URL or anchor specified');\n return { valid: false, issues, fixed, originalUrl };\n }\n\n // Fix common issues\n if (fixCommonIssues && fixedUrl) {\n // Fix 1: Add missing protocol\n if (!/^[a-z]+:\\/\\//i.exec(fixedUrl)) {\n fixedUrl = 'https://' + fixedUrl;\n fixed.push('Added missing protocol (https://)');\n }\n\n // Fix 2: Fix double slashes (except after protocol)\n const protocolMatch = /^([a-z]+:\\/\\/)/i.exec(fixedUrl);\n if (protocolMatch?.[1]) {\n const protocol = protocolMatch[1];\n const rest = fixedUrl.substring(protocol.length);\n const fixedRest = rest.replace(/\\/\\//g, '/');\n if (rest !== fixedRest) {\n fixedUrl = protocol + fixedRest;\n fixed.push('Fixed double slashes');\n }\n }\n\n // Fix 3: Encode spaces\n if (fixedUrl.includes(' ')) {\n fixedUrl = fixedUrl.replace(/ /g, '%20');\n fixed.push('Encoded spaces as %20');\n }\n\n // Fix 4: Remove trailing slashes for non-root URLs\n if (/^https?:\\/\\/[^/]+\\/.+\\/$/.exec(fixedUrl)) {\n fixedUrl = fixedUrl.replace(/\\/$/, '');\n fixed.push('Removed trailing slash');\n }\n\n // Fix 5: Fix common typos\n fixedUrl = fixedUrl.replace(/^http:\\/\\//i, 'https://'); // Prefer HTTPS\n if (fixedUrl !== this.url && fixedUrl.startsWith('https://')) {\n fixed.push('Upgraded HTTP to HTTPS');\n }\n\n // Update URL if fixes were applied\n if (fixedUrl !== this.url) {\n this.setUrl(fixedUrl);\n }\n }\n\n // Check accessibility (HTTP HEAD request)\n if (checkAccessibility && fixedUrl?.match(/^https?:\\/\\//i)) {\n // Check if fetch is available (Node.js 18+ or browser)\n if (typeof fetch === 'undefined') {\n issues.push('Network validation unavailable: fetch API not supported in this environment');\n } else {\n try {\n // Use fetch with AbortController for timeout\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n const response = await fetch(fixedUrl, {\n method: 'HEAD',\n signal: controller.signal,\n redirect: 'follow',\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n issues.push(`HTTP ${response.status}: ${response.statusText || 'Error'}`);\n }\n } catch (error: unknown) {\n // Type guard for error objects with name and message properties\n const isErrorWithName = (err: unknown): err is { name: string } => {\n return typeof err === 'object' && err !== null && 'name' in err;\n };\n const isErrorWithMessage = (err: unknown): err is { message: string } => {\n return typeof err === 'object' && err !== null && 'message' in err;\n };\n\n if (isErrorWithName(error) && error.name === 'AbortError') {\n issues.push(`Timeout after ${timeout}ms`);\n } else if (isErrorWithMessage(error) && error.message?.includes('fetch')) {\n issues.push(`Unreachable: ${error.message}`);\n } else if (isErrorWithMessage(error)) {\n issues.push(`Network error: ${error.message}`);\n } else {\n issues.push('Network error: Unknown error');\n }\n }\n }\n }\n\n return {\n valid: issues.length === 0,\n issues,\n fixed,\n originalUrl,\n fixedUrl: fixedUrl !== originalUrl ? fixedUrl : undefined,\n };\n }\n\n /**\n * Resets hyperlink formatting to standard style (Calibri, blue, underline)\n * This is useful for fixing corrupted hyperlinks from Google Docs or other sources\n * @returns this for method chaining\n */\n resetToStandardFormatting(): this {\n const standardFormatting: RunFormatting = {\n font: 'Verdana',\n color: '0000FF', // Standard hyperlink blue\n underline: 'single',\n // Clear any other formatting that might be causing issues\n bold: false,\n italic: false,\n strike: false,\n };\n\n this.setFormatting(standardFormatting);\n return this;\n }\n\n /**\n * Checks if this is an external link\n */\n isExternal(): boolean {\n return this.url !== undefined;\n }\n\n /**\n * Checks if this is an internal link (anchor)\n */\n isInternal(): boolean {\n return this.anchor !== undefined;\n }\n\n /**\n * Creates a deep copy of this hyperlink\n *\n * This is useful for preserving the original state before modifications,\n * particularly when creating tracked changes (revisions) where both the\n * old and new states need to be preserved.\n *\n * @returns A new Hyperlink instance with the same properties\n *\n * @example\n * ```typescript\n * // Clone before modifying for tracked changes\n * const originalLink = hyperlink.clone();\n * hyperlink.setUrl('https://new-url.com');\n * hyperlink.setText('New Text');\n *\n * // Now originalLink has old URL/text, hyperlink has new\n * const deletion = Revision.createDeletion(author, [originalLink]);\n * const insertion = Revision.createInsertion(author, [hyperlink]);\n * ```\n */\n clone(): Hyperlink {\n const cloned = new Hyperlink({\n url: this.url,\n anchor: this.anchor,\n text: this.text,\n tooltip: this.tooltip,\n relationshipId: this.relationshipId,\n formatting: { ...this.formatting },\n tgtFrame: this.tgtFrame,\n history: this.history,\n docLocation: this.docLocation,\n });\n\n // Copy the run with its formatting\n if (this.run) {\n cloned.run = new Run(this.run.getText(), { ...this.run.getFormatting() });\n\n // Preserve rPrChange from the original run (formatting tracked changes)\n const existingRPrChange = this.run.getPropertyChangeRevision();\n if (existingRPrChange) {\n cloned.run.setPropertyChangeRevision({ ...existingRPrChange });\n }\n }\n\n return cloned;\n }\n\n /**\n * Generates XML for the hyperlink\n *\n * **CRITICAL:** For external links, relationshipId MUST be set before calling toXML().\n * This happens automatically when saving via Document.save(), but manual usage requires\n * registering the hyperlink with RelationshipManager first.\n *\n * @throws {Error} If external link (has url) is missing relationshipId\n * @throws {Error} If hyperlink has neither url nor anchor (empty hyperlink)\n */\n toXML(): XMLElement {\n // VALIDATION: Hyperlink must have url OR anchor (unless it's an empty hyperlink with relationshipId)\n if (!this.url && !this.anchor && !this.relationshipId) {\n throw new Error(\n 'CRITICAL: Hyperlink must have either a URL (external link), anchor (internal link), or relationshipId. ' +\n 'Cannot generate valid XML for hyperlink without destination.'\n );\n }\n\n // VALIDATION: External links MUST have relationship ID\n // Per ECMA-376 Part 1 §17.16.22, <w:hyperlink> with external target requires r:id attribute\n if (this.url && !this.relationshipId) {\n throw new Error(\n `CRITICAL: External hyperlink to \"${this.url}\" is missing relationship ID. ` +\n `This would create an invalid OpenXML document per ECMA-376 §17.16.22. ` +\n `Solution: Use Document.save() which automatically registers relationships, ` +\n `or manually call relationshipManager.addHyperlink(url) and set the relationship ID.`\n );\n }\n\n const attributes: Record<string, string> = {};\n\n // External link - add relationship ID\n if (this.relationshipId) {\n attributes['r:id'] = this.relationshipId;\n }\n\n // Internal link - uses anchor\n if (this.anchor) {\n attributes['w:anchor'] = this.anchor;\n }\n\n // Tooltip - explicitly escape attribute value for safety\n // XMLBuilder will handle escaping, but we document this for clarity\n if (this.tooltip) {\n // Note: XMLBuilder.elementToString() will escape this via escapeXmlAttribute()\n // when generating the actual XML string. We store the raw value here.\n attributes['w:tooltip'] = this.tooltip;\n }\n\n // Target frame attribute (e.g., \"_blank\" for new window)\n if (this.tgtFrame) {\n attributes['w:tgtFrame'] = this.tgtFrame;\n }\n\n // History tracking attribute\n if (this.history) {\n attributes['w:history'] = this.history;\n }\n\n // Document location attribute (ECMA-376 §17.16.22)\n if (this.docLocation) {\n attributes['w:docLocation'] = this.docLocation;\n }\n\n // Empty/invisible hyperlinks have no children (self-closing element)\n if (this._isEmpty) {\n return {\n name: 'w:hyperlink',\n attributes,\n children: [],\n };\n }\n\n // Generate run XML\n const runXml = this.run.toXML();\n\n return {\n name: 'w:hyperlink',\n attributes,\n children: [runXml],\n };\n }\n\n /**\n * Creates an external hyperlink\n * @param url The URL\n * @param text Display text\n * @param formatting Optional formatting\n */\n static createExternal(url: string, text: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({ url, text, formatting });\n }\n\n /**\n * Creates an internal hyperlink (to a bookmark)\n * @param anchor Bookmark name\n * @param text Display text\n * @param formatting Optional formatting\n */\n static createInternal(anchor: string, text: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({ anchor, text, formatting });\n }\n\n /**\n * Creates a web link (convenience method for URLs)\n * @param url The URL\n * @param text Display text (defaults to URL)\n * @param formatting Optional formatting\n */\n static createWebLink(url: string, text?: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({\n url,\n text: text || url,\n formatting,\n });\n }\n\n /**\n * Creates an email link\n * @param email Email address\n * @param text Display text (defaults to email)\n * @param formatting Optional formatting\n */\n static createEmail(email: string, text?: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({\n url: `mailto:${email}`,\n text: text || email,\n formatting,\n });\n }\n\n /**\n * Creates a hyperlink with properties\n * @param properties Hyperlink properties\n */\n static create(properties: HyperlinkProperties): Hyperlink {\n return new Hyperlink(properties);\n }\n}\n"]}
1
+ {"version":3,"file":"Hyperlink.js","sourceRoot":"","sources":["../../src/elements/Hyperlink.ts"],"names":[],"mappings":";;;AAmDA,+BAA2C;AAC3C,yCAAsC;AACtC,oDAA4E;AAC5E,4CAAgD;AA+BhD,MAAa,SAAS;IACZ,GAAG,CAAU;IACb,MAAM,CAAU;IAChB,IAAI,CAAS;IACb,GAAG,CAAM;IACT,OAAO,CAAU;IACjB,cAAc,CAAU;IACxB,UAAU,CAAgB;IAE1B,QAAQ,GAAG,KAAK,CAAC;IAEjB,QAAQ,CAAU;IAElB,OAAO,CAAU;IAEjB,WAAW,CAAU;IAErB,eAAe,CAAyD;IAExE,gBAAgB,CAAmC;IAEnD,sBAAsB,CAAiB;IAU/C,YAAY,UAA+B;QACzC,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAA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8BAyrCC","sourcesContent":["/**\n * Hyperlink - Represents a hyperlink in a Word document\n *\n * Hyperlinks can be external (to websites, files) or internal (to bookmarks within the document).\n * They are represented using the `<w:hyperlink>` element.\n *\n * ## Important: Relationship ID Requirement\n *\n * **External hyperlinks REQUIRE a relationship ID to be set before XML generation.**\n * Per ECMA-376 Part 1 §17.16.22, `<w:hyperlink>` elements with external targets must have\n * an `r:id` attribute that references a relationship in `word/_rels/document.xml.rels`.\n *\n * ### Correct Usage Pattern:\n *\n * ```typescript\n * // RECOMMENDED: Use Document.save() - automatically handles relationships\n * const doc = Document.create();\n * const para = doc.createParagraph();\n * para.addHyperlink(Hyperlink.createExternal('https://example.com', 'Link'));\n * await doc.save('document.docx'); // ✅ Relationships auto-registered\n * ```\n *\n * ### Manual Relationship Registration (Advanced):\n *\n * ```typescript\n * const link = Hyperlink.createExternal('https://example.com', 'Link');\n * const relationship = relationshipManager.addHyperlink('https://example.com');\n * link.setRelationshipId(relationship.getId());\n * link.toXML(); // ✅ Now valid\n * ```\n *\n * ### What NOT to Do:\n *\n * ```typescript\n * const link = Hyperlink.createExternal('https://example.com', 'Link');\n * link.toXML(); // ❌ ERROR: Missing relationship ID\n * ```\n *\n * ## Internal Hyperlinks\n *\n * Internal hyperlinks (bookmarks) do NOT require relationships:\n *\n * ```typescript\n * const link = Hyperlink.createInternal('Section1', 'Go to Section 1');\n * link.toXML(); // ✅ Valid - uses w:anchor attribute\n * ```\n *\n * @see {@link https://www.ecma-international.org/publications-and-standards/standards/ecma-376/ | ECMA-376 Part 1 §17.16.22}\n */\n\nimport { XMLElement } from '../xml/XMLBuilder';\nimport { Run, RunFormatting } from './Run';\nimport { Revision } from './Revision';\nimport { validateRunText, sanitizeHyperlinkUrl } from '../utils/validation';\nimport { defaultLogger } from '../utils/logger';\n\n/**\n * Hyperlink properties\n */\nexport interface HyperlinkProperties {\n /** Hyperlink URL (for external links) */\n url?: string;\n /** Bookmark anchor (for internal links) */\n anchor?: string;\n /** Display text (optional for empty/invisible hyperlinks) */\n text?: string;\n /** Text formatting */\n formatting?: RunFormatting;\n /** Tooltip text */\n tooltip?: string;\n /** Relationship ID (set by Document when saving) */\n relationshipId?: string;\n /** Whether this is an empty/invisible hyperlink with no display text */\n isEmpty?: boolean;\n /** Target frame attribute (e.g., \"_blank\" for new window) */\n tgtFrame?: string;\n /** History tracking attribute */\n history?: string;\n /** Document location for within-document navigation in external files (ECMA-376 §17.16.22) */\n docLocation?: string;\n}\n\n/**\n * Represents a hyperlink\n */\nexport class Hyperlink {\n private url?: string;\n private anchor?: string;\n private text: string;\n private run: Run;\n private tooltip?: string;\n private relationshipId?: string;\n private formatting: RunFormatting;\n /** Whether this is an empty/invisible hyperlink with no display text */\n private _isEmpty = false;\n /** Target frame attribute (e.g., \"_blank\" for new window) */\n private tgtFrame?: string;\n /** History tracking attribute */\n private history?: string;\n /** Document location for within-document navigation in external files */\n private docLocation?: string;\n /** Tracking context for automatic change tracking */\n private trackingContext?: import('../tracking/TrackingContext').TrackingContext;\n /** Parent paragraph reference for automatic tracking */\n private _parentParagraph?: import('./Paragraph').Paragraph;\n /** Baseline formatting captured before first tracked formatting change */\n private _preTrackingFormatting?: RunFormatting;\n\n /**\n * Creates a new hyperlink\n *\n * **Note:** A hyperlink must have either a URL (external) or anchor (internal), but not both.\n * If both are provided, the URL takes precedence and a warning is logged.\n *\n * @param properties Hyperlink properties\n */\n constructor(properties: HyperlinkProperties) {\n this.url = properties.url;\n this.anchor = properties.anchor;\n this.tooltip = properties.tooltip;\n this.relationshipId = properties.relationshipId;\n this.tgtFrame = properties.tgtFrame;\n this.history = properties.history;\n this.docLocation = properties.docLocation;\n this._isEmpty = properties.isEmpty ?? false;\n\n // VALIDATION: Warn about hybrid links (url + anchor)\n if (this.url && this.anchor) {\n defaultLogger.warn(\n `DocXML Warning: Hyperlink has both URL (\"${this.url}\") and anchor (\"${this.anchor}\"). ` +\n `This is ambiguous per ECMA-376 spec. URL will take precedence. ` +\n `Use Hyperlink.createExternal() or Hyperlink.createInternal() to avoid ambiguity.`\n );\n }\n\n // Handle empty/invisible hyperlinks (no display text)\n if (this._isEmpty) {\n this.text = '';\n this.formatting = {};\n this.run = new Run('', {});\n return;\n }\n\n // Text fallback: properties.text → url → 'Link'\n // NOTE: Do NOT use anchor (bookmark ID) as display text - it should only be used for navigation\n // Using bookmark IDs as visible text causes TOC corruption (Issue: TOC shows \"HEADING=II.MNKE7E8NA385_\" instead of proper headings)\n this.text = properties.text || this.url || 'Link';\n\n // Validate text for XML patterns\n // Default to auto-cleaning XML patterns unless explicitly disabled (matches Run behavior)\n const validation = validateRunText(this.text, {\n context: 'Hyperlink text',\n autoClean: properties.formatting?.cleanXmlFromText !== false,\n warnToConsole: true,\n });\n\n // Use cleaned text if available and cleaning was requested\n if (validation.cleanedText) {\n this.text = validation.cleanedText;\n }\n\n // Create run with default hyperlink styling (Verdana 12pt blue underlined)\n this.formatting = {\n font: 'Verdana',\n size: 12,\n color: '0000FF', // Standard hyperlink blue\n underline: 'single',\n ...properties.formatting,\n };\n\n this.run = new Run(this.text, this.formatting);\n }\n\n /**\n * Sets the tracking context for automatic change tracking.\n * Called by Document when track changes is enabled.\n * @internal\n */\n _setTrackingContext(context: import('../tracking/TrackingContext').TrackingContext): void {\n this.trackingContext = context;\n }\n\n /**\n * Sets the parent paragraph reference for automatic tracking.\n * Called by Paragraph when hyperlink is added.\n * @internal\n */\n _setParentParagraph(paragraph: import('./Paragraph').Paragraph): void {\n this._parentParagraph = paragraph;\n }\n\n /**\n * Gets the parent paragraph reference.\n * @internal\n */\n _getParentParagraph(): import('./Paragraph').Paragraph | undefined {\n return this._parentParagraph;\n }\n\n /**\n * Applies an rPrChange to the inner Run, tracking the delta between\n * the baseline formatting and the current formatting.\n *\n * On first call, captures `previousFormatting` as the baseline.\n * Subsequent calls always compare against the same baseline so that\n * multiple sequential formatting changes produce a single merged rPrChange.\n *\n * @internal\n */\n private _applyFormattingRPrChange(previousFormatting: RunFormatting): void {\n // Capture baseline on first tracked formatting change\n if (!this._preTrackingFormatting) {\n this._preTrackingFormatting = { ...previousFormatting };\n }\n\n // Build previousProperties from the baseline (only changed keys)\n const baseline = this._preTrackingFormatting;\n const current = this.formatting;\n const previousProperties: Partial<RunFormatting> = {};\n let hasChanges = false;\n\n for (const key of Object.keys(baseline) as (keyof RunFormatting)[]) {\n if (baseline[key] !== current[key]) {\n (previousProperties as Record<string, unknown>)[key] = baseline[key];\n hasChanges = true;\n }\n }\n // Also check for keys in current that weren't in baseline (new properties)\n for (const key of Object.keys(current) as (keyof RunFormatting)[]) {\n if (!(key in baseline) && current[key] !== undefined) {\n // Property didn't exist before — previous value is undefined\n (previousProperties as Record<string, unknown>)[key] = undefined;\n hasChanges = true;\n }\n }\n\n if (!hasChanges) return;\n\n const revisionId = this.trackingContext!.getRevisionManager().consumeNextId();\n const author = this.trackingContext!.getAuthor();\n\n this.run.setPropertyChangeRevision({\n id: revisionId,\n author,\n date: new Date(),\n previousProperties,\n });\n }\n\n /**\n * Gets the hyperlink URL\n */\n getUrl(): string | undefined {\n return this.url;\n }\n\n /**\n * Gets the complete URL including any anchor fragment.\n *\n * For external links that also have an anchor (e.g., internal bookmark within external page),\n * this returns the URL with the anchor appended as a fragment.\n * For internal-only links (anchor without URL), returns undefined.\n *\n * Note: As of v7.2.0, DocumentParser automatically combines external URLs with anchors\n * during parsing, so getUrl() typically returns the full URL. This method is provided\n * for cases where URL and anchor are set separately via the API.\n *\n * @returns The complete URL with fragment, or undefined for internal-only links\n *\n * @example\n * ```typescript\n * // External link with anchor fragment\n * const link = new Hyperlink({ url: 'https://example.com/', anchor: '!/view?id=123', text: 'Link' });\n * link.getUrl(); // 'https://example.com/'\n * link.getAnchor(); // '!/view?id=123'\n * link.getFullUrl(); // 'https://example.com/#!/view?id=123'\n *\n * // External link without anchor\n * const link2 = Hyperlink.createExternal('https://example.com/page', 'Link');\n * link2.getFullUrl(); // 'https://example.com/page'\n *\n * // Internal link (bookmark reference)\n * const link3 = Hyperlink.createInternal('Section1', 'Go to Section 1');\n * link3.getFullUrl(); // undefined\n * ```\n */\n getFullUrl(): string | undefined {\n if (this.url && this.anchor) {\n return this.url + '#' + this.anchor;\n }\n return this.url;\n }\n\n /**\n * Gets the anchor (for internal links)\n */\n getAnchor(): string | undefined {\n return this.anchor;\n }\n\n /**\n * Returns whether this is an empty/invisible hyperlink (has no display text).\n * Empty hyperlinks are self-closing elements in the XML.\n */\n isEmpty(): boolean {\n return this._isEmpty;\n }\n\n /**\n * Gets the target frame attribute (e.g., \"_blank\" for new window)\n */\n getTgtFrame(): string | undefined {\n return this.tgtFrame;\n }\n\n /**\n * Gets the history tracking attribute\n */\n getHistory(): string | undefined {\n return this.history;\n }\n\n /**\n * Sets the target frame attribute\n * @param tgtFrame Target frame (e.g., \"_blank\" for new window)\n */\n setTgtFrame(tgtFrame: string | undefined): this {\n this.tgtFrame = tgtFrame;\n return this;\n }\n\n /**\n * Sets the history tracking attribute\n * @param history History value (e.g., \"1\" to add to history)\n */\n setHistory(history: string | undefined): this {\n this.history = history;\n return this;\n }\n\n /**\n * Gets the document location attribute (ECMA-376 §17.16.22)\n */\n getDocLocation(): string | undefined {\n return this.docLocation;\n }\n\n /**\n * Sets the document location for within-document navigation in external files\n * @param docLocation Location string\n */\n setDocLocation(docLocation: string | undefined): this {\n this.docLocation = docLocation;\n return this;\n }\n\n /**\n * Gets the display text\n *\n * This method delegates to the internal run to ensure the returned text\n * is always accurate and matches what will be in the generated XML,\n * per ECMA-376 Part 1 §17.16.22.\n *\n * @returns The display text including any special characters (tabs, breaks, etc.)\n */\n getText(): string {\n return this.run.getText();\n }\n\n /**\n * Sets the display text\n */\n setText(text: string): this {\n // Validate text for XML patterns\n // Default to auto-cleaning unless explicitly disabled (matches Run behavior)\n const validation = validateRunText(text, {\n context: 'Hyperlink.setText',\n autoClean: this.formatting.cleanXmlFromText !== false,\n warnToConsole: true,\n });\n\n // Use cleaned text if available\n const cleanedText = validation.cleanedText || text;\n\n const previousValue = this.text;\n\n // Skip if text unchanged\n if (previousValue === cleanedText) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create delete/insert revision pair\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.text = cleanedText;\n this.run.setText(cleanedText);\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n // Clear baseline formatting (fresh start inside insertion)\n this._preTrackingFormatting = undefined;\n\n return this;\n }\n\n // Non-tracking path (original behavior)\n this.text = cleanedText;\n this.run.setText(cleanedText);\n return this;\n }\n\n /**\n * Sets the internal run directly (for advanced use cases like TOC parsing)\n * Used by DocumentParser to preserve run content (tabs, breaks, etc.)\n * @param run - The run to use for this hyperlink\n */\n setRun(run: Run): this {\n this.run = run;\n this.text = run.getText();\n return this;\n }\n\n /**\n * Gets the tooltip\n */\n getTooltip(): string | undefined {\n return this.tooltip;\n }\n\n /**\n * Sets the tooltip\n */\n setTooltip(tooltip: string): this {\n const previousValue = this.tooltip;\n\n // Skip if tooltip unchanged\n if (previousValue === tooltip) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create delete/insert revision pair\n // Tooltip is a w:hyperlink attribute — no OOXML property-change element exists for it\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.tooltip = tooltip;\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n // Clear baseline formatting (fresh start inside insertion)\n this._preTrackingFormatting = undefined;\n\n return this;\n }\n\n // Non-tracking path\n this.tooltip = tooltip;\n return this;\n }\n\n /**\n * Gets the relationship ID\n */\n getRelationshipId(): string | undefined {\n return this.relationshipId;\n }\n\n /**\n * Sets the relationship ID (called by Document during save)\n */\n setRelationshipId(id: string): this {\n this.relationshipId = id;\n return this;\n }\n\n /**\n * Sets or updates the hyperlink URL\n *\n * When URL is updated, we mark that the relationship needs updating.\n * The actual relationship update happens during Document.save() to ensure\n * proper coordination with the RelationshipManager.\n *\n * **Important:** This method maintains the relationship ID but flags it for update.\n * The RelationshipManager will update the existing relationship's target URL\n * during save, preventing orphaned relationships per ECMA-376 §17.16.22.\n *\n * @param url - The new URL (or undefined to clear)\n * @returns This hyperlink for chaining\n * @throws {Error} If clearing URL would create empty hyperlink (no URL and no anchor)\n *\n * @example\n * ```typescript\n * const link = Hyperlink.createExternal('https://old.com', 'Link');\n * link.setUrl('https://new.com'); // Marks for relationship update\n * await doc.save('updated.docx'); // Updates relationship target\n * ```\n */\n setUrl(url: string | undefined): this {\n // Validate that clearing URL doesn't create empty hyperlink\n if (!url && !this.anchor) {\n throw new Error(\n `Cannot set URL to undefined: Hyperlink \"${this.run.getText()}\" has no anchor. ` +\n `Clearing the URL would create an invalid hyperlink per ECMA-376 §17.16.22. ` +\n `Either provide a new URL or delete the hyperlink entirely.`\n );\n }\n\n // Save old URL before updating (for text fallback logic)\n const oldUrl = this.url;\n\n // Skip if URL unchanged (optimization)\n if (oldUrl === url) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create revision pair\n // OOXML has no w:hyperlinkChange element - Word tracks hyperlink changes as delete/insert pairs\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.url = url;\n this.relationshipId = undefined;\n if (this.run.getText() === oldUrl) {\n this.text = url || this.anchor || 'Link';\n this.run.setText(this.text);\n }\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n return this;\n }\n\n // Non-tracking path (original behavior)\n this.url = url;\n\n // Clear the relationship ID so it will be re-registered during save\n // This ensures the relationship target is updated to point to the new URL\n this.relationshipId = undefined;\n\n // Update text ONLY if it was auto-generated from the old URL\n // This preserves user-provided text (even if it's \"Link\")\n // Use run.getText() to ensure we check the actual current text, not stale cache\n if (this.run.getText() === oldUrl) {\n this.text = url || this.anchor || 'Link';\n this.run.setText(this.text);\n }\n\n return this;\n }\n\n /**\n * Sets the anchor (for internal links)\n * @param anchor Bookmark name to link to\n * @returns This hyperlink for chaining\n * @throws {Error} If clearing anchor would create empty hyperlink (no URL and no anchor)\n * @example\n * ```typescript\n * const link = Hyperlink.createInternal('OldBookmark', 'Go there');\n * link.setAnchor('NewBookmark'); // Update internal link target\n * ```\n */\n setAnchor(anchor: string | undefined): this {\n // Validate that clearing anchor doesn't create empty hyperlink\n if (!anchor && !this.url) {\n throw new Error(\n `Cannot set anchor to undefined: Hyperlink \"${this.run.getText()}\" has no URL. ` +\n `Clearing the anchor would create an invalid hyperlink per ECMA-376 §17.16.22. ` +\n `Either provide a new anchor or delete the hyperlink entirely.`\n );\n }\n\n // Save old anchor before updating\n const oldAnchor = this.anchor;\n\n // Skip if anchor unchanged (optimization)\n if (oldAnchor === anchor) {\n return this;\n }\n\n // If tracking enabled AND has parent paragraph, create revision pair\n // OOXML has no w:hyperlinkChange element - Word tracks hyperlink changes as delete/insert pairs\n if (this.trackingContext?.isEnabled() && this._parentParagraph) {\n const author = this.trackingContext.getAuthor();\n\n // Clone current state for deletion (before applying changes)\n const oldHyperlink = this.clone();\n\n // Apply the change to this hyperlink\n this.anchor = anchor;\n if (anchor && this.url) {\n defaultLogger.warn(\n `DocXML Warning: Setting anchor \"${anchor}\" on hyperlink that has URL \"${this.url}\". ` +\n `Clearing URL to make this an internal link. Use separate hyperlinks for external and internal links.`\n );\n this.url = undefined;\n this.relationshipId = undefined;\n }\n if (this.run.getText() === oldAnchor) {\n this.text = anchor || this.url || 'Link';\n this.run.setText(this.text);\n }\n\n // Create delete/insert revision pair\n const deletion = Revision.createDeletion(author, [oldHyperlink]);\n const insertion = Revision.createInsertion(author, [this]);\n\n // Replace this hyperlink with the revision pair in parent paragraph\n this._parentParagraph.replaceContent(this, [deletion, insertion]);\n\n // Clear parent reference since we're now inside a revision\n this._parentParagraph = undefined;\n\n return this;\n }\n\n // Non-tracking path (original behavior)\n this.anchor = anchor;\n\n // If converting from external to internal, clear URL and relationship\n if (anchor && this.url) {\n defaultLogger.warn(\n `DocXML Warning: Setting anchor \"${anchor}\" on hyperlink that has URL \"${this.url}\". ` +\n `Clearing URL to make this an internal link. Use separate hyperlinks for external and internal links.`\n );\n this.url = undefined;\n this.relationshipId = undefined;\n }\n\n // Update text ONLY if it was auto-generated from the old anchor\n // Use run.getText() to ensure we check the actual current text, not stale cache\n if (this.run.getText() === oldAnchor) {\n this.text = anchor || this.url || 'Link';\n this.run.setText(this.text);\n }\n\n return this;\n }\n\n /**\n * Gets the run\n */\n getRun(): Run {\n return this.run;\n }\n\n /**\n * Sets run formatting\n *\n * @param formatting - The formatting to apply\n * @param options - Optional settings\n * @param options.replace - If true, replaces ALL existing formatting instead of merging.\n * Use this when you want to clear inherited styles like characterStyle.\n *\n * @example\n * ```typescript\n * // Merge mode (default): adds/updates properties while preserving others\n * hyperlink.setFormatting({ bold: true });\n *\n * // Replace mode: clears all existing formatting and applies only the new properties\n * hyperlink.setFormatting({ font: \"Verdana\", size: 12 }, { replace: true });\n * ```\n */\n setFormatting(formatting: RunFormatting, options?: { replace?: boolean }): this {\n // Update stored formatting\n const previousFormatting = { ...this.formatting };\n if (options?.replace) {\n // Replace mode: new formatting replaces ALL existing properties\n this.formatting = { ...formatting };\n } else {\n // Merge mode (default, backwards-compatible): merge with existing\n this.formatting = { ...this.formatting, ...formatting };\n }\n // Create new run with updated formatting, preserving current text\n const currentText = this.run.getText();\n this.run = new Run(currentText, this.formatting);\n this.text = currentText; // Keep cache in sync\n if (this.trackingContext?.isEnabled()) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Gets run formatting (returns this hyperlink for fluent API)\n * @returns This hyperlink for method chaining\n *\n * @example\n * ```typescript\n * hyperlink.getFormatting().setColor('0563C1').setUnderline('single');\n * ```\n */\n getFormatting(): this {\n return this;\n }\n\n /**\n * Gets the raw formatting object (for direct access)\n * @returns RunFormatting object\n */\n getRawFormatting(): RunFormatting {\n return this.formatting;\n }\n\n // ============================================================================\n // Individual Formatting Getters\n // ============================================================================\n\n /**\n * Gets the text color\n * @returns Color hex string or undefined\n */\n getColor(): string | undefined {\n return this.formatting.color;\n }\n\n /**\n * Gets the underline style\n * @returns Underline style or undefined\n */\n getUnderline(): string | boolean | undefined {\n return this.formatting.underline;\n }\n\n /**\n * Gets whether the hyperlink is bold\n * @returns True if bold, false otherwise\n */\n getBold(): boolean {\n return this.formatting.bold ?? false;\n }\n\n /**\n * Gets whether the hyperlink is italic\n * @returns True if italic, false otherwise\n */\n getItalic(): boolean {\n return this.formatting.italic ?? false;\n }\n\n /**\n * Gets the font family\n * @returns Font name or undefined\n */\n getFont(): string | undefined {\n return this.formatting.font;\n }\n\n /**\n * Gets the font size\n * @returns Font size in points or undefined\n */\n getSize(): number | undefined {\n return this.formatting.size;\n }\n\n /**\n * Sets text color\n * @param color Color in hex format (e.g., '0563C1')\n * @returns This hyperlink for chaining\n */\n setColor(color: string): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.color = color;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.color !== color) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets underline style\n * @param underline Underline style ('single', 'double', etc.)\n * @returns This hyperlink for chaining\n */\n setUnderline(underline: boolean | 'single' | 'double' | 'dotted' | 'thick' | 'dash'): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.underline = underline;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.underline !== underline) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets bold formatting\n * @param bold Bold state (default: true)\n * @returns This hyperlink for chaining\n */\n setBold(bold = true): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.bold = bold;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.bold !== bold) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets italic formatting\n * @param italic Italic state (default: true)\n * @returns This hyperlink for chaining\n */\n setItalic(italic = true): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.italic = italic;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.italic !== italic) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets font family\n * @param font Font name (e.g., 'Arial', 'Verdana')\n * @returns This hyperlink for chaining\n */\n setFont(font: string): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.font = font;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.font !== font) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Sets font size\n * @param size Font size in points (e.g., 12, 14)\n * @returns This hyperlink for chaining\n */\n setSize(size: number): this {\n const previousFormatting = { ...this.formatting };\n this.formatting.size = size;\n this.run = new Run(this.text, this.formatting);\n if (this.trackingContext?.isEnabled() && previousFormatting.size !== size) {\n this._applyFormattingRPrChange(previousFormatting);\n }\n return this;\n }\n\n /**\n * Validates the hyperlink URL and optionally fixes common issues\n *\n * Performs validation and fixing of hyperlink URLs including:\n * - Checking URL accessibility (HTTP HEAD request for external links)\n * - Fixing common URL issues (missing protocol, double slashes, spaces)\n * - Validating internal bookmark references\n * - Detecting broken links\n *\n * **Note:** This method is async due to network requests for accessibility checks.\n *\n * @param options - Validation options\n * @returns Promise with validation results\n *\n * @example\n * ```typescript\n * // Basic URL fixing without network check\n * const result = await link.validateAndFix({\n * fixCommonIssues: true,\n * checkAccessibility: false\n * });\n * console.log(`Fixed: ${result.fixed.join(', ')}`);\n *\n * // Full validation with accessibility check\n * const validation = await link.validateAndFix({\n * checkAccessibility: true,\n * timeout: 5000\n * });\n * if (!validation.valid) {\n * console.log(`Issues: ${validation.issues.join(', ')}`);\n * }\n *\n * // Batch validate all hyperlinks in document\n * for (const { hyperlink } of doc.getHyperlinks()) {\n * const result = await hyperlink.validateAndFix();\n * if (result.fixed.length > 0) {\n * console.log(`Fixed ${hyperlink.getUrl()}: ${result.fixed.join(', ')}`);\n * }\n * }\n * ```\n */\n async validateAndFix(options?: {\n checkAccessibility?: boolean;\n fixCommonIssues?: boolean;\n timeout?: number;\n bookmarkManager?: { hasBookmark(name: string): boolean };\n }): Promise<{\n valid: boolean;\n issues: string[];\n fixed: string[];\n originalUrl?: string;\n fixedUrl?: string;\n }> {\n const {\n checkAccessibility = false,\n fixCommonIssues = true,\n timeout = 5000,\n bookmarkManager,\n } = options || {};\n\n const issues: string[] = [];\n const fixed: string[] = [];\n let fixedUrl = this.url;\n const originalUrl = this.url;\n\n // Internal link validation (bookmarks)\n if (this.anchor) {\n if (bookmarkManager) {\n const bookmarkExists = bookmarkManager.hasBookmark(this.anchor);\n if (!bookmarkExists) {\n issues.push(`Internal bookmark \"${this.anchor}\" not found`);\n }\n }\n return {\n valid: issues.length === 0,\n issues,\n fixed,\n originalUrl,\n };\n }\n\n // External link validation\n if (!this.url) {\n issues.push('No URL or anchor specified');\n return { valid: false, issues, fixed, originalUrl };\n }\n\n // Fix common issues\n if (fixCommonIssues && fixedUrl) {\n // Fix 0: Strip browser extension URL prefixes\n const sanitizeResult = sanitizeHyperlinkUrl(fixedUrl);\n if (sanitizeResult) {\n fixedUrl = sanitizeResult.url;\n fixed.push(...sanitizeResult.fixes);\n }\n\n // Fix 1: Add missing protocol\n if (!/^[a-z]+:\\/\\//i.exec(fixedUrl)) {\n fixedUrl = 'https://' + fixedUrl;\n fixed.push('Added missing protocol (https://)');\n }\n\n // Fix 2: Fix double slashes (except after protocol)\n const protocolMatch = /^([a-z]+:\\/\\/)/i.exec(fixedUrl);\n if (protocolMatch?.[1]) {\n const protocol = protocolMatch[1];\n const rest = fixedUrl.substring(protocol.length);\n const fixedRest = rest.replace(/\\/\\//g, '/');\n if (rest !== fixedRest) {\n fixedUrl = protocol + fixedRest;\n fixed.push('Fixed double slashes');\n }\n }\n\n // Fix 3: Encode spaces\n if (fixedUrl.includes(' ')) {\n fixedUrl = fixedUrl.replace(/ /g, '%20');\n fixed.push('Encoded spaces as %20');\n }\n\n // Fix 4: Remove trailing slashes for non-root URLs\n if (/^https?:\\/\\/[^/]+\\/.+\\/$/.exec(fixedUrl)) {\n fixedUrl = fixedUrl.replace(/\\/$/, '');\n fixed.push('Removed trailing slash');\n }\n\n // Fix 5: Fix common typos\n fixedUrl = fixedUrl.replace(/^http:\\/\\//i, 'https://'); // Prefer HTTPS\n if (fixedUrl !== this.url && fixedUrl.startsWith('https://')) {\n fixed.push('Upgraded HTTP to HTTPS');\n }\n\n // Update URL if fixes were applied\n if (fixedUrl !== this.url) {\n this.setUrl(fixedUrl);\n }\n }\n\n // Check accessibility (HTTP HEAD request)\n if (checkAccessibility && fixedUrl?.match(/^https?:\\/\\//i)) {\n // Check if fetch is available (Node.js 18+ or browser)\n if (typeof fetch === 'undefined') {\n issues.push('Network validation unavailable: fetch API not supported in this environment');\n } else {\n try {\n // Use fetch with AbortController for timeout\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n const response = await fetch(fixedUrl, {\n method: 'HEAD',\n signal: controller.signal,\n redirect: 'follow',\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n issues.push(`HTTP ${response.status}: ${response.statusText || 'Error'}`);\n }\n } catch (error: unknown) {\n // Type guard for error objects with name and message properties\n const isErrorWithName = (err: unknown): err is { name: string } => {\n return typeof err === 'object' && err !== null && 'name' in err;\n };\n const isErrorWithMessage = (err: unknown): err is { message: string } => {\n return typeof err === 'object' && err !== null && 'message' in err;\n };\n\n if (isErrorWithName(error) && error.name === 'AbortError') {\n issues.push(`Timeout after ${timeout}ms`);\n } else if (isErrorWithMessage(error) && error.message?.includes('fetch')) {\n issues.push(`Unreachable: ${error.message}`);\n } else if (isErrorWithMessage(error)) {\n issues.push(`Network error: ${error.message}`);\n } else {\n issues.push('Network error: Unknown error');\n }\n }\n }\n }\n\n return {\n valid: issues.length === 0,\n issues,\n fixed,\n originalUrl,\n fixedUrl: fixedUrl !== originalUrl ? fixedUrl : undefined,\n };\n }\n\n /**\n * Resets hyperlink formatting to standard style (Calibri, blue, underline)\n * This is useful for fixing corrupted hyperlinks from Google Docs or other sources\n * @returns this for method chaining\n */\n resetToStandardFormatting(): this {\n const standardFormatting: RunFormatting = {\n font: 'Verdana',\n color: '0000FF', // Standard hyperlink blue\n underline: 'single',\n // Clear any other formatting that might be causing issues\n bold: false,\n italic: false,\n strike: false,\n };\n\n this.setFormatting(standardFormatting);\n return this;\n }\n\n /**\n * Checks if this is an external link\n */\n isExternal(): boolean {\n return this.url !== undefined;\n }\n\n /**\n * Checks if this is an internal link (anchor)\n */\n isInternal(): boolean {\n return this.anchor !== undefined;\n }\n\n /**\n * Creates a deep copy of this hyperlink\n *\n * This is useful for preserving the original state before modifications,\n * particularly when creating tracked changes (revisions) where both the\n * old and new states need to be preserved.\n *\n * @returns A new Hyperlink instance with the same properties\n *\n * @example\n * ```typescript\n * // Clone before modifying for tracked changes\n * const originalLink = hyperlink.clone();\n * hyperlink.setUrl('https://new-url.com');\n * hyperlink.setText('New Text');\n *\n * // Now originalLink has old URL/text, hyperlink has new\n * const deletion = Revision.createDeletion(author, [originalLink]);\n * const insertion = Revision.createInsertion(author, [hyperlink]);\n * ```\n */\n clone(): Hyperlink {\n const cloned = new Hyperlink({\n url: this.url,\n anchor: this.anchor,\n text: this.text,\n tooltip: this.tooltip,\n relationshipId: this.relationshipId,\n formatting: { ...this.formatting },\n tgtFrame: this.tgtFrame,\n history: this.history,\n docLocation: this.docLocation,\n });\n\n // Copy the run with its formatting\n if (this.run) {\n cloned.run = new Run(this.run.getText(), { ...this.run.getFormatting() });\n\n // Preserve rPrChange from the original run (formatting tracked changes)\n const existingRPrChange = this.run.getPropertyChangeRevision();\n if (existingRPrChange) {\n cloned.run.setPropertyChangeRevision({ ...existingRPrChange });\n }\n }\n\n return cloned;\n }\n\n /**\n * Generates XML for the hyperlink\n *\n * **CRITICAL:** For external links, relationshipId MUST be set before calling toXML().\n * This happens automatically when saving via Document.save(), but manual usage requires\n * registering the hyperlink with RelationshipManager first.\n *\n * @throws {Error} If external link (has url) is missing relationshipId\n * @throws {Error} If hyperlink has neither url nor anchor (empty hyperlink)\n */\n toXML(): XMLElement {\n // VALIDATION: Hyperlink must have url OR anchor (unless it's an empty hyperlink with relationshipId)\n if (!this.url && !this.anchor && !this.relationshipId) {\n throw new Error(\n 'CRITICAL: Hyperlink must have either a URL (external link), anchor (internal link), or relationshipId. ' +\n 'Cannot generate valid XML for hyperlink without destination.'\n );\n }\n\n // VALIDATION: External links MUST have relationship ID\n // Per ECMA-376 Part 1 §17.16.22, <w:hyperlink> with external target requires r:id attribute\n if (this.url && !this.relationshipId) {\n throw new Error(\n `CRITICAL: External hyperlink to \"${this.url}\" is missing relationship ID. ` +\n `This would create an invalid OpenXML document per ECMA-376 §17.16.22. ` +\n `Solution: Use Document.save() which automatically registers relationships, ` +\n `or manually call relationshipManager.addHyperlink(url) and set the relationship ID.`\n );\n }\n\n const attributes: Record<string, string> = {};\n\n // External link - add relationship ID\n if (this.relationshipId) {\n attributes['r:id'] = this.relationshipId;\n }\n\n // Internal link - uses anchor\n if (this.anchor) {\n attributes['w:anchor'] = this.anchor;\n }\n\n // Tooltip - explicitly escape attribute value for safety\n // XMLBuilder will handle escaping, but we document this for clarity\n if (this.tooltip) {\n // Note: XMLBuilder.elementToString() will escape this via escapeXmlAttribute()\n // when generating the actual XML string. We store the raw value here.\n attributes['w:tooltip'] = this.tooltip;\n }\n\n // Target frame attribute (e.g., \"_blank\" for new window)\n if (this.tgtFrame) {\n attributes['w:tgtFrame'] = this.tgtFrame;\n }\n\n // History tracking attribute\n if (this.history) {\n attributes['w:history'] = this.history;\n }\n\n // Document location attribute (ECMA-376 §17.16.22)\n if (this.docLocation) {\n attributes['w:docLocation'] = this.docLocation;\n }\n\n // Empty/invisible hyperlinks have no children (self-closing element)\n if (this._isEmpty) {\n return {\n name: 'w:hyperlink',\n attributes,\n children: [],\n };\n }\n\n // Generate run XML\n const runXml = this.run.toXML();\n\n return {\n name: 'w:hyperlink',\n attributes,\n children: [runXml],\n };\n }\n\n /**\n * Creates an external hyperlink\n * @param url The URL\n * @param text Display text\n * @param formatting Optional formatting\n */\n static createExternal(url: string, text: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({ url, text, formatting });\n }\n\n /**\n * Creates an internal hyperlink (to a bookmark)\n * @param anchor Bookmark name\n * @param text Display text\n * @param formatting Optional formatting\n */\n static createInternal(anchor: string, text: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({ anchor, text, formatting });\n }\n\n /**\n * Creates a web link (convenience method for URLs)\n * @param url The URL\n * @param text Display text (defaults to URL)\n * @param formatting Optional formatting\n */\n static createWebLink(url: string, text?: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({\n url,\n text: text || url,\n formatting,\n });\n }\n\n /**\n * Creates an email link\n * @param email Email address\n * @param text Display text (defaults to email)\n * @param formatting Optional formatting\n */\n static createEmail(email: string, text?: string, formatting?: RunFormatting): Hyperlink {\n return new Hyperlink({\n url: `mailto:${email}`,\n text: text || email,\n formatting,\n });\n }\n\n /**\n * Creates a hyperlink with properties\n * @param properties Hyperlink properties\n */\n static create(properties: HyperlinkProperties): Hyperlink {\n return new Hyperlink(properties);\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export { DocumentProtection, RevisionViewSettings, TrackChangesSettings, WebSett
60
60
  export { CompatibilityUpgrader, UpgradeReport } from './utils/CompatibilityUpgrader';
61
61
  export { LEGACY_COMPAT_ELEMENTS, LEGACY_COMPAT_ELEMENT_NAMES, MODERN_COMPAT_SETTINGS, MS_WORD_COMPAT_URI, } from './constants/legacyCompatFlags';
62
62
  export { STANDARD_DPI, UNITS, PAGE_SIZES, COMMON_MARGINS, twipsToPoints, twipsToInches, twipsToCm, twipsToEmus, emusToTwips, emusToInches, emusToCm, emusToPoints, emusToPixels, pointsToTwips, pointsToEmus, pointsToInches, pointsToCm, pointsToHalfPoints, halfPointsToPoints, inchesToTwips, inchesToEmus, inchesToPoints, inchesToCm, inchesToPixels, cmToTwips, cmToEmus, cmToInches, cmToPoints, cmToPixels, pixelsToEmus, pixelsToInches, pixelsToTwips, pixelsToCm, pixelsToPoints, } from './utils/units';
63
- export { validateDocxStructure, isBinaryFile, normalizePath, isValidZipBuffer, isTextContent, validateTwips, validateColor, validateHexColor, normalizeColor, validateNumberingId, validateLevel, validateAlignment, validateFontSize, validateNonEmptyString, validatePercentage, validateEmus, detectXmlInText, cleanXmlFromText, validateRunText, TextValidationResult, } from './utils/validation';
63
+ export { validateDocxStructure, isBinaryFile, normalizePath, isValidZipBuffer, isTextContent, validateTwips, validateColor, validateHexColor, normalizeColor, validateNumberingId, validateLevel, validateAlignment, validateFontSize, validateNonEmptyString, validatePercentage, validateEmus, detectXmlInText, cleanXmlFromText, validateRunText, sanitizeHyperlinkUrl, SanitizeHyperlinkUrlResult, TextValidationResult, } from './utils/validation';
64
64
  export { detectCorruptionInDocument, detectCorruptionInText, suggestFix, looksCorrupted, CorruptionReport, CorruptionLocation, CorruptionType, } from './utils/corruptionDetection';
65
65
  export { isError, toError, wrapError, getErrorMessage } from './utils/errorHandling';
66
66
  export { REVISION_RULES, ValidationSeverity, ValidationIssue, ValidationRule, ValidationOptions, AutoFixOptions, ValidationResult as RevisionValidationResult, FixAction, AutoFixResult, createIssueFromRule, getRuleByCode, getRulesBySeverity, getAutoFixableRules, RevisionValidator, RevisionAutoFixer, } from './validation';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,GACV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EACL,OAAO,EACP,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,UAAU,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C;AACjE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAM7D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMtE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PreservedElement = exports.CustomXmlBlock = exports.MathExpression = exports.MathParagraph = exports.AlternateContent = exports.TableOfContentsElement = exports.TableOfContents = exports.StructuredDocumentTag = exports.isHyperlinkInstruction = exports.buildHyperlinkInstruction = exports.parseHyperlinkInstruction = exports.createNestedField = exports.createIFField = exports.createRefField = exports.createMergeField = exports.createNestedIFMergeField = exports.createTOCField = exports.ComplexField = exports.Field = exports.EndnoteType = exports.Endnote = exports.FootnoteType = exports.Footnote = exports.Comment = exports.RangeMarker = exports.Bookmark = exports.Hyperlink = exports.Footer = exports.Header = exports.TextBox = exports.Shape = exports.ImageRun = exports.Image = exports.TableGridChange = exports.TableCell = exports.TableRow = exports.Table = exports.Section = exports.Run = exports.isTextBox = exports.isShape = exports.isRangeMarker = exports.isRevision = exports.isHyperlink = exports.isComplexField = exports.isSimpleField = exports.isField = exports.isRun = exports.Paragraph = exports.Document = void 0;
4
4
  exports.UNITS = exports.STANDARD_DPI = exports.MS_WORD_COMPAT_URI = exports.MODERN_COMPAT_SETTINGS = exports.LEGACY_COMPAT_ELEMENT_NAMES = exports.LEGACY_COMPAT_ELEMENTS = exports.CompatibilityUpgrader = exports.CompatibilityMode = exports.NO_BORDER = exports.DEFAULT_BORDER = exports.isWidthType = exports.isParagraphAlignment = exports.isVerticalAlignment = exports.isHorizontalAlignment = exports.isBorderStyle = exports.isShadingPattern = exports.buildShadingAttributes = exports.DrawingManager = exports.FontManager = exports.HeaderFooterManager = exports.EndnoteManager = exports.FootnoteManager = exports.CommentManager = exports.BookmarkManager = exports.ImageManager = exports.RevisionManager = exports.NumberingManager = exports.NumberingInstance = exports.AbstractNumbering = exports.WORD_NATIVE_BULLETS = exports.NumberingLevel = exports.StylesManager = exports.Style = exports.ChangelogGenerator = exports.RevisionAwareProcessor = exports.SelectiveRevisionAcceptor = exports.MoveOperationHelper = exports.stripRevisionsFromXml = exports.countRevisionsByType = exports.getRevisionsFromParagraph = exports.paragraphHasRevisions = exports.acceptRevisionsInMemory = exports.isNumberingChange = exports.isSectionPropertyChange = exports.isTablePropertyChange = exports.isParagraphPropertyChange = exports.isRunPropertyChange = exports.isHyperlinkContent = exports.isRunContent = exports.Revision = void 0;
5
5
  exports.cleanXmlFromText = exports.detectXmlInText = exports.validateEmus = exports.validatePercentage = exports.validateNonEmptyString = exports.validateFontSize = exports.validateAlignment = exports.validateLevel = exports.validateNumberingId = exports.normalizeColor = exports.validateHexColor = exports.validateColor = exports.validateTwips = exports.isTextContent = exports.isValidZipBuffer = exports.normalizePath = exports.isBinaryFile = exports.validateDocxStructure = exports.pixelsToPoints = exports.pixelsToCm = exports.pixelsToTwips = exports.pixelsToInches = exports.pixelsToEmus = exports.cmToPixels = exports.cmToPoints = exports.cmToInches = exports.cmToEmus = exports.cmToTwips = exports.inchesToPixels = exports.inchesToCm = exports.inchesToPoints = exports.inchesToEmus = exports.inchesToTwips = exports.halfPointsToPoints = exports.pointsToHalfPoints = exports.pointsToCm = exports.pointsToInches = exports.pointsToEmus = exports.pointsToTwips = exports.emusToPixels = exports.emusToPoints = exports.emusToCm = exports.emusToInches = exports.emusToTwips = exports.twipsToEmus = exports.twipsToCm = exports.twipsToInches = exports.twipsToPoints = exports.COMMON_MARGINS = exports.PAGE_SIZES = void 0;
6
- exports.setGlobalLogger = exports.getGlobalLogger = exports.createComponentLogger = exports.createScopedLogger = exports.defaultLogger = exports.CollectingLogger = exports.SilentLogger = exports.ConsoleLogger = exports.LogLevel = exports.FORMAT_TO_LEVEL = exports.PATTERN_TO_CATEGORY = exports.TYPED_LIST_PATTERNS = exports.getLevelFromFormat = exports.getListCategoryFromFormat = exports.validateListSequence = exports.getParagraphIndentation = exports.inferLevelFromIndentation = exports.detectListType = exports.detectTypedPrefix = exports.XML_CONTROL_CHARS = exports.hasInvalidXmlChars = exports.findInvalidXmlChars = exports.removeInvalidXmlChars = exports.parseOnOffAttribute = exports.parseNumericAttribute = exports.isExplicitlySet = exports.parseOoxmlBoolean = exports.safeParseInt = exports.applyDefaults = exports.isEqualFormatting = exports.cleanFormatting = exports.hasFormatting = exports.cloneFormatting = exports.mergeFormatting = exports.RevisionAutoFixer = exports.RevisionValidator = exports.getAutoFixableRules = exports.getRulesBySeverity = exports.getRuleByCode = exports.createIssueFromRule = exports.REVISION_RULES = exports.getErrorMessage = exports.wrapError = exports.toError = exports.isError = exports.looksCorrupted = exports.suggestFix = exports.detectCorruptionInText = exports.detectCorruptionInDocument = exports.validateRunText = void 0;
7
- exports.LIMITS = exports.DocumentContent = exports.DocumentIdManager = exports.DocumentValidator = exports.DocumentGenerator = exports.DocumentParser = exports.RelationshipManager = exports.RelationshipType = exports.Relationship = exports.DEFAULT_MAX_NESTING_DEPTH = exports.XMLParser = exports.XMLBuilder = exports.FileOperationError = exports.MissingRequiredFileError = exports.CorruptedArchiveError = exports.InvalidDocxError = exports.DocxNotFoundError = exports.DocxError = exports.DOCX_PATHS = exports.REQUIRED_DOCX_FILES = exports.DEFAULT_SIZE_LIMITS = exports.ZipWriter = exports.ZipReader = exports.ZipHandler = exports.CleanupHelper = exports.getActiveConditionalsInPriorityOrder = exports.decodeCnfStyle = exports.resolveCellShading = exports.RevisionWalker = exports.resetGlobalLogger = void 0;
6
+ exports.getGlobalLogger = exports.createComponentLogger = exports.createScopedLogger = exports.defaultLogger = exports.CollectingLogger = exports.SilentLogger = exports.ConsoleLogger = exports.LogLevel = exports.FORMAT_TO_LEVEL = exports.PATTERN_TO_CATEGORY = exports.TYPED_LIST_PATTERNS = exports.getLevelFromFormat = exports.getListCategoryFromFormat = exports.validateListSequence = exports.getParagraphIndentation = exports.inferLevelFromIndentation = exports.detectListType = exports.detectTypedPrefix = exports.XML_CONTROL_CHARS = exports.hasInvalidXmlChars = exports.findInvalidXmlChars = exports.removeInvalidXmlChars = exports.parseOnOffAttribute = exports.parseNumericAttribute = exports.isExplicitlySet = exports.parseOoxmlBoolean = exports.safeParseInt = exports.applyDefaults = exports.isEqualFormatting = exports.cleanFormatting = exports.hasFormatting = exports.cloneFormatting = exports.mergeFormatting = exports.RevisionAutoFixer = exports.RevisionValidator = exports.getAutoFixableRules = exports.getRulesBySeverity = exports.getRuleByCode = exports.createIssueFromRule = exports.REVISION_RULES = exports.getErrorMessage = exports.wrapError = exports.toError = exports.isError = exports.looksCorrupted = exports.suggestFix = exports.detectCorruptionInText = exports.detectCorruptionInDocument = exports.sanitizeHyperlinkUrl = exports.validateRunText = void 0;
7
+ exports.LIMITS = exports.DocumentContent = exports.DocumentIdManager = exports.DocumentValidator = exports.DocumentGenerator = exports.DocumentParser = exports.RelationshipManager = exports.RelationshipType = exports.Relationship = exports.DEFAULT_MAX_NESTING_DEPTH = exports.XMLParser = exports.XMLBuilder = exports.FileOperationError = exports.MissingRequiredFileError = exports.CorruptedArchiveError = exports.InvalidDocxError = exports.DocxNotFoundError = exports.DocxError = exports.DOCX_PATHS = exports.REQUIRED_DOCX_FILES = exports.DEFAULT_SIZE_LIMITS = exports.ZipWriter = exports.ZipReader = exports.ZipHandler = exports.CleanupHelper = exports.getActiveConditionalsInPriorityOrder = exports.decodeCnfStyle = exports.resolveCellShading = exports.RevisionWalker = exports.resetGlobalLogger = exports.setGlobalLogger = void 0;
8
8
  var Document_1 = require("./core/Document");
9
9
  Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return Document_1.Document; } });
10
10
  var Paragraph_1 = require("./elements/Paragraph");
@@ -214,6 +214,7 @@ Object.defineProperty(exports, "validateEmus", { enumerable: true, get: function
214
214
  Object.defineProperty(exports, "detectXmlInText", { enumerable: true, get: function () { return validation_1.detectXmlInText; } });
215
215
  Object.defineProperty(exports, "cleanXmlFromText", { enumerable: true, get: function () { return validation_1.cleanXmlFromText; } });
216
216
  Object.defineProperty(exports, "validateRunText", { enumerable: true, get: function () { return validation_1.validateRunText; } });
217
+ Object.defineProperty(exports, "sanitizeHyperlinkUrl", { enumerable: true, get: function () { return validation_1.sanitizeHyperlinkUrl; } });
217
218
  var corruptionDetection_1 = require("./utils/corruptionDetection");
218
219
  Object.defineProperty(exports, "detectCorruptionInDocument", { enumerable: true, get: function () { return corruptionDetection_1.detectCorruptionInDocument; } });
219
220
  Object.defineProperty(exports, "detectCorruptionInText", { enumerable: true, get: function () { return corruptionDetection_1.detectCorruptionInText; } });