@superdoc-dev/cli 0.5.0-next.25 → 0.5.0-next.26
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.
- package/dist/index.js +796 -366
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -63346,7 +63346,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
|
|
|
63346
63346
|
emptyOptions2 = {};
|
|
63347
63347
|
});
|
|
63348
63348
|
|
|
63349
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
63349
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-B9oNf3OB.es.js
|
|
63350
63350
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
63351
63351
|
const fieldValue = extension$1.config[field];
|
|
63352
63352
|
if (typeof fieldValue === "function")
|
|
@@ -90407,6 +90407,26 @@ function importEndnoteData({ docx, editor, converter, nodeListHandler, numbering
|
|
|
90407
90407
|
numbering
|
|
90408
90408
|
});
|
|
90409
90409
|
}
|
|
90410
|
+
function extractMathText(node3) {
|
|
90411
|
+
if (!node3)
|
|
90412
|
+
return "";
|
|
90413
|
+
if (node3.type === "text" && typeof node3.text === "string")
|
|
90414
|
+
return node3.text;
|
|
90415
|
+
if (node3.name === "m:t" && Array.isArray(node3.elements))
|
|
90416
|
+
return node3.elements.map((child) => extractMathText(child)).join("");
|
|
90417
|
+
if (Array.isArray(node3.elements))
|
|
90418
|
+
return node3.elements.map((child) => extractMathText(child)).join("");
|
|
90419
|
+
return "";
|
|
90420
|
+
}
|
|
90421
|
+
function extractJustification(oMathParaNode) {
|
|
90422
|
+
const paraPr = (oMathParaNode.elements || []).find((el) => el.name === "m:oMathParaPr");
|
|
90423
|
+
if (!paraPr || !Array.isArray(paraPr.elements))
|
|
90424
|
+
return "centerGroup";
|
|
90425
|
+
const jc = paraPr.elements.find((el) => el.name === "m:jc");
|
|
90426
|
+
if (!jc || !jc.attributes)
|
|
90427
|
+
return "centerGroup";
|
|
90428
|
+
return jc.attributes["m:val"] || "center";
|
|
90429
|
+
}
|
|
90410
90430
|
function toIdentityValue(value) {
|
|
90411
90431
|
if (typeof value === "string" && value.length > 0)
|
|
90412
90432
|
return value;
|
|
@@ -92051,6 +92071,8 @@ function exportSchemaToJson(params3) {
|
|
|
92051
92071
|
tableOfContents: translator$22,
|
|
92052
92072
|
index: translator$23,
|
|
92053
92073
|
indexEntry: translator$24,
|
|
92074
|
+
mathBlock: translatePassthroughNode,
|
|
92075
|
+
mathInline: translatePassthroughNode,
|
|
92054
92076
|
passthroughBlock: translatePassthroughNode,
|
|
92055
92077
|
passthroughInline: translatePassthroughNode
|
|
92056
92078
|
}[type];
|
|
@@ -112784,7 +112806,51 @@ var isRegExp = (value) => {
|
|
|
112784
112806
|
nodes: [translator$3.encode(params3)],
|
|
112785
112807
|
consumed: 1
|
|
112786
112808
|
};
|
|
112787
|
-
}, tabNodeEntityHandler, footnoteReferenceHandlerEntity, tableNodeHandlerEntity, tableOfContentsHandlerEntity, indexHandlerEntity, indexEntryHandlerEntity, bibliographyHandlerEntity, commentRangeStartHandlerEntity, commentRangeEndHandlerEntity, permStartHandlerEntity, permEndHandlerEntity,
|
|
112809
|
+
}, tabNodeEntityHandler, footnoteReferenceHandlerEntity, tableNodeHandlerEntity, tableOfContentsHandlerEntity, indexHandlerEntity, indexEntryHandlerEntity, bibliographyHandlerEntity, commentRangeStartHandlerEntity, commentRangeEndHandlerEntity, permStartHandlerEntity, permEndHandlerEntity, handleMathPara = (params3) => {
|
|
112810
|
+
const { nodes } = params3;
|
|
112811
|
+
if (!nodes.length || nodes[0].name !== "m:oMathPara")
|
|
112812
|
+
return {
|
|
112813
|
+
nodes: [],
|
|
112814
|
+
consumed: 0
|
|
112815
|
+
};
|
|
112816
|
+
const xmlNode = nodes[0];
|
|
112817
|
+
return {
|
|
112818
|
+
nodes: [{
|
|
112819
|
+
type: "mathBlock",
|
|
112820
|
+
attrs: {
|
|
112821
|
+
originalXml: carbonCopy(xmlNode),
|
|
112822
|
+
textContent: extractMathText(xmlNode),
|
|
112823
|
+
justification: extractJustification(xmlNode)
|
|
112824
|
+
},
|
|
112825
|
+
marks: []
|
|
112826
|
+
}],
|
|
112827
|
+
consumed: 1
|
|
112828
|
+
};
|
|
112829
|
+
}, handleMathInline = (params3) => {
|
|
112830
|
+
const { nodes } = params3;
|
|
112831
|
+
if (!nodes.length || nodes[0].name !== "m:oMath")
|
|
112832
|
+
return {
|
|
112833
|
+
nodes: [],
|
|
112834
|
+
consumed: 0
|
|
112835
|
+
};
|
|
112836
|
+
const xmlNode = nodes[0];
|
|
112837
|
+
return {
|
|
112838
|
+
nodes: [{
|
|
112839
|
+
type: "mathInline",
|
|
112840
|
+
attrs: {
|
|
112841
|
+
originalXml: carbonCopy(xmlNode),
|
|
112842
|
+
textContent: extractMathText(xmlNode)
|
|
112843
|
+
},
|
|
112844
|
+
marks: []
|
|
112845
|
+
}],
|
|
112846
|
+
consumed: 1
|
|
112847
|
+
};
|
|
112848
|
+
}, handleMathNode = (params3) => {
|
|
112849
|
+
const result = handleMathPara(params3);
|
|
112850
|
+
if (result.consumed > 0)
|
|
112851
|
+
return result;
|
|
112852
|
+
return handleMathInline(params3);
|
|
112853
|
+
}, mathNodeHandlerEntity, PARAGRAPH_IDENTITY_ATTRS, TABLE_IDENTITY_ATTRS, DEFAULT_BLOCK_IDENTITY_ATTRS, SYNTHETIC_PARA_ID_TYPES, DOCX_ID_LENGTH = 8, MAX_DOCX_ID = 4294967295, BLOCK_IDENTITY_ATTRS, WORD_2012_NAMESPACE = "http://schemas.microsoft.com/office/word/2012/wordml", deepClone2 = (value) => JSON.parse(JSON.stringify(value)), getNumberingRoot = (numberingXml) => {
|
|
112788
112854
|
if (!numberingXml?.elements?.length)
|
|
112789
112855
|
return null;
|
|
112790
112856
|
return numberingXml.elements.find((el) => el?.name === "w:numbering") || numberingXml.elements[0] || null;
|
|
@@ -112944,6 +113010,7 @@ var isRegExp = (value) => {
|
|
|
112944
113010
|
pageReferenceEntity,
|
|
112945
113011
|
permStartHandlerEntity,
|
|
112946
113012
|
permEndHandlerEntity,
|
|
113013
|
+
mathNodeHandlerEntity,
|
|
112947
113014
|
passthroughNodeHandlerEntity
|
|
112948
113015
|
];
|
|
112949
113016
|
return {
|
|
@@ -113995,7 +114062,7 @@ var isRegExp = (value) => {
|
|
|
113995
114062
|
state.kern = kernNode.attributes["w:val"];
|
|
113996
114063
|
}
|
|
113997
114064
|
}, SuperConverter;
|
|
113998
|
-
var
|
|
114065
|
+
var init_SuperConverter_B9oNf3OB_es = __esm(() => {
|
|
113999
114066
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
114000
114067
|
init_jszip_ChlR43oI_es();
|
|
114001
114068
|
init_xml_js_40FWvL78_es();
|
|
@@ -129289,6 +129356,7 @@ var init_SuperConverter_CYbYOJeZ_es = __esm(() => {
|
|
|
129289
129356
|
"endnoteReference",
|
|
129290
129357
|
"fieldAnnotation",
|
|
129291
129358
|
"structuredContent",
|
|
129359
|
+
"mathInline",
|
|
129292
129360
|
"passthroughInline",
|
|
129293
129361
|
"page-number",
|
|
129294
129362
|
"total-page-number",
|
|
@@ -149643,6 +149711,10 @@ var init_SuperConverter_CYbYOJeZ_es = __esm(() => {
|
|
|
149643
149711
|
commentRangeEndHandlerEntity = generateV2HandlerEntity("commentRangeEndHandler", commentRangeEndTranslator);
|
|
149644
149712
|
permStartHandlerEntity = generateV2HandlerEntity("permStartHandler", translator$13);
|
|
149645
149713
|
permEndHandlerEntity = generateV2HandlerEntity("permEndHandler", translator$14);
|
|
149714
|
+
mathNodeHandlerEntity = {
|
|
149715
|
+
handlerName: "mathNodeHandler",
|
|
149716
|
+
handler: handleMathNode
|
|
149717
|
+
};
|
|
149646
149718
|
PARAGRAPH_IDENTITY_ATTRS = ["sdBlockId", "paraId"];
|
|
149647
149719
|
TABLE_IDENTITY_ATTRS = [
|
|
149648
149720
|
"sdBlockId",
|
|
@@ -172511,7 +172583,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
172511
172583
|
init_remark_gfm_z_sDF4ss_es();
|
|
172512
172584
|
});
|
|
172513
172585
|
|
|
172514
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
172586
|
+
// ../../packages/superdoc/dist/chunks/src-0P3ZlqDX.es.js
|
|
172515
172587
|
function deleteProps(obj, propOrProps) {
|
|
172516
172588
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
172517
172589
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -182802,6 +182874,15 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
182802
182874
|
result.totalWidth += imageWidth;
|
|
182803
182875
|
continue;
|
|
182804
182876
|
}
|
|
182877
|
+
if (run2.kind === "math") {
|
|
182878
|
+
const mathWidth = run2.width ?? 20;
|
|
182879
|
+
result.runs.push({
|
|
182880
|
+
runIndex: i4,
|
|
182881
|
+
width: mathWidth
|
|
182882
|
+
});
|
|
182883
|
+
result.totalWidth += mathWidth;
|
|
182884
|
+
continue;
|
|
182885
|
+
}
|
|
182805
182886
|
if (isFieldAnnotationRun(run2)) {
|
|
182806
182887
|
const fontSize = run2.fontSize ?? DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
182807
182888
|
const { font } = buildFontString({
|
|
@@ -183335,6 +183416,27 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
183335
183416
|
pendingRunSpacing = 0;
|
|
183336
183417
|
continue;
|
|
183337
183418
|
}
|
|
183419
|
+
if (run2.kind === "math") {
|
|
183420
|
+
const mathRun = run2;
|
|
183421
|
+
const mathWidth = mathRun.width ?? 20;
|
|
183422
|
+
const mathHeight = mathRun.height ?? 24;
|
|
183423
|
+
if (currentLine) {
|
|
183424
|
+
currentLine.toRun = runIndex;
|
|
183425
|
+
currentLine.toChar = 1;
|
|
183426
|
+
currentLine.width = roundValue(currentLine.width + mathWidth);
|
|
183427
|
+
currentLine.maxImageHeight = Math.max(currentLine.maxImageHeight ?? 0, mathHeight);
|
|
183428
|
+
if (!currentLine.segments)
|
|
183429
|
+
currentLine.segments = [];
|
|
183430
|
+
currentLine.segments.push({
|
|
183431
|
+
runIndex,
|
|
183432
|
+
fromChar: 0,
|
|
183433
|
+
toChar: 1,
|
|
183434
|
+
width: mathWidth
|
|
183435
|
+
});
|
|
183436
|
+
}
|
|
183437
|
+
pendingRunSpacing = 0;
|
|
183438
|
+
continue;
|
|
183439
|
+
}
|
|
183338
183440
|
if (isFieldAnnotationRun(run2)) {
|
|
183339
183441
|
const displayText = applyTextTransform$2(run2.displayLabel || "", run2);
|
|
183340
183442
|
const annotationFontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
@@ -189221,6 +189323,86 @@ function applyParagraphBordersAndShading(paraWrapper, block) {
|
|
|
189221
189323
|
function sdtElementsById(root3, sdtId) {
|
|
189222
189324
|
return root3.querySelectorAll(`.${DOM_CLASS_NAMES.BLOCK_SDT}[data-sdt-id="${sdtId}"]`);
|
|
189223
189325
|
}
|
|
189326
|
+
function classifyMathText(text5) {
|
|
189327
|
+
if (/^\d*\.?\d+$/.test(text5))
|
|
189328
|
+
return "mn";
|
|
189329
|
+
if (text5.length === 1 && OPERATOR_CHARS.has(text5))
|
|
189330
|
+
return "mo";
|
|
189331
|
+
return "mi";
|
|
189332
|
+
}
|
|
189333
|
+
function convertChildNodes(children, doc$12) {
|
|
189334
|
+
const fragment2 = doc$12.createDocumentFragment();
|
|
189335
|
+
for (const child of children) {
|
|
189336
|
+
const result = convertNode(child, doc$12);
|
|
189337
|
+
if (result)
|
|
189338
|
+
fragment2.appendChild(result);
|
|
189339
|
+
}
|
|
189340
|
+
return fragment2;
|
|
189341
|
+
}
|
|
189342
|
+
function convertNode(node3, doc$12) {
|
|
189343
|
+
if (!node3)
|
|
189344
|
+
return null;
|
|
189345
|
+
if (node3.type === "text" && typeof node3.text === "string")
|
|
189346
|
+
return doc$12.createTextNode(node3.text);
|
|
189347
|
+
const name = node3.name;
|
|
189348
|
+
if (!name)
|
|
189349
|
+
return null;
|
|
189350
|
+
if (name.endsWith("Pr"))
|
|
189351
|
+
return null;
|
|
189352
|
+
const converter = MATH_OBJECT_REGISTRY[name];
|
|
189353
|
+
if (converter)
|
|
189354
|
+
return converter(node3, doc$12, (children) => convertChildNodes(children, doc$12));
|
|
189355
|
+
if (ARGUMENT_ELEMENTS.has(name)) {
|
|
189356
|
+
const children = node3.elements ?? [];
|
|
189357
|
+
if (children.length === 1)
|
|
189358
|
+
return convertNode(children[0], doc$12);
|
|
189359
|
+
const mrow = doc$12.createElementNS(MATHML_NS, "mrow");
|
|
189360
|
+
for (const child of children) {
|
|
189361
|
+
const result = convertNode(child, doc$12);
|
|
189362
|
+
if (result)
|
|
189363
|
+
mrow.appendChild(result);
|
|
189364
|
+
}
|
|
189365
|
+
return mrow.childNodes.length > 0 ? mrow : null;
|
|
189366
|
+
}
|
|
189367
|
+
if (name === "m:mr") {
|
|
189368
|
+
const fragment$1 = doc$12.createDocumentFragment();
|
|
189369
|
+
for (const child of node3.elements ?? []) {
|
|
189370
|
+
const result = convertNode(child, doc$12);
|
|
189371
|
+
if (result)
|
|
189372
|
+
fragment$1.appendChild(result);
|
|
189373
|
+
}
|
|
189374
|
+
return fragment$1.childNodes.length > 0 ? fragment$1 : null;
|
|
189375
|
+
}
|
|
189376
|
+
if (name in MATH_OBJECT_REGISTRY && MATH_OBJECT_REGISTRY[name] === null) {
|
|
189377
|
+
const mrow = doc$12.createElementNS(MATHML_NS, "mrow");
|
|
189378
|
+
for (const child of node3.elements ?? []) {
|
|
189379
|
+
const result = convertNode(child, doc$12);
|
|
189380
|
+
if (result)
|
|
189381
|
+
mrow.appendChild(result);
|
|
189382
|
+
}
|
|
189383
|
+
return mrow.childNodes.length > 0 ? mrow : null;
|
|
189384
|
+
}
|
|
189385
|
+
const fragment2 = doc$12.createDocumentFragment();
|
|
189386
|
+
for (const child of node3.elements ?? []) {
|
|
189387
|
+
const result = convertNode(child, doc$12);
|
|
189388
|
+
if (result)
|
|
189389
|
+
fragment2.appendChild(result);
|
|
189390
|
+
}
|
|
189391
|
+
return fragment2.childNodes.length > 0 ? fragment2 : null;
|
|
189392
|
+
}
|
|
189393
|
+
function convertOmmlToMathml(ommlJson, doc$12) {
|
|
189394
|
+
if (!ommlJson || typeof ommlJson !== "object")
|
|
189395
|
+
return null;
|
|
189396
|
+
const root3 = ommlJson;
|
|
189397
|
+
const mathEl = doc$12.createElementNS(MATHML_NS, "math");
|
|
189398
|
+
const children = root3.elements ?? [];
|
|
189399
|
+
for (const child of children) {
|
|
189400
|
+
const result = convertNode(child, doc$12);
|
|
189401
|
+
if (result)
|
|
189402
|
+
mathEl.appendChild(result);
|
|
189403
|
+
}
|
|
189404
|
+
return mathEl.childNodes.length > 0 ? mathEl : null;
|
|
189405
|
+
}
|
|
189224
189406
|
function isMinimalWordLayout(value) {
|
|
189225
189407
|
if (typeof value !== "object" || value === null)
|
|
189226
189408
|
return false;
|
|
@@ -219451,7 +219633,7 @@ function getMeasurementContext() {
|
|
|
219451
219633
|
return measurementCtx;
|
|
219452
219634
|
}
|
|
219453
219635
|
function getRunFontString(run2) {
|
|
219454
|
-
if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || "src" in run2)
|
|
219636
|
+
if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" || "src" in run2)
|
|
219455
219637
|
return "normal normal 16px Arial";
|
|
219456
219638
|
return `${run2.italic ? "italic" : "normal"} ${run2.bold ? "bold" : "normal"} ${run2.fontSize ?? 16}px ${run2.fontFamily ?? "Arial"}`;
|
|
219457
219639
|
}
|
|
@@ -219483,6 +219665,10 @@ function sliceRunsForLine(block, line) {
|
|
|
219483
219665
|
result.push(run2);
|
|
219484
219666
|
continue;
|
|
219485
219667
|
}
|
|
219668
|
+
if (run2.kind === "math") {
|
|
219669
|
+
result.push(run2);
|
|
219670
|
+
continue;
|
|
219671
|
+
}
|
|
219486
219672
|
const text5 = run2.text ?? "";
|
|
219487
219673
|
const isFirstRun = runIndex === line.fromRun;
|
|
219488
219674
|
const isLastRun = runIndex === line.toRun;
|
|
@@ -219518,7 +219704,7 @@ function measureCharacterX(block, line, charOffset, availableWidthOverride, alig
|
|
|
219518
219704
|
return charOffset / Math.max(1, runs$1.reduce((sum, run2) => {
|
|
219519
219705
|
if (isTabRun(run2))
|
|
219520
219706
|
return sum + TAB_CHAR_LENGTH;
|
|
219521
|
-
if ("src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation")
|
|
219707
|
+
if ("src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math")
|
|
219522
219708
|
return sum;
|
|
219523
219709
|
return sum + (run2.text ?? "").length;
|
|
219524
219710
|
}, 0)) * renderedLineWidth;
|
|
@@ -219539,9 +219725,9 @@ function measureCharacterX(block, line, charOffset, availableWidthOverride, alig
|
|
|
219539
219725
|
currentCharOffset += runLength$1;
|
|
219540
219726
|
continue;
|
|
219541
219727
|
}
|
|
219542
|
-
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
219728
|
+
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? "" : run2.text ?? "";
|
|
219543
219729
|
const runLength = text5.length;
|
|
219544
|
-
const displayText = applyTextTransform$1(text5, isTabRun(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? undefined : run2.textTransform);
|
|
219730
|
+
const displayText = applyTextTransform$1(text5, isTabRun(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? undefined : run2.textTransform);
|
|
219545
219731
|
if (currentCharOffset + runLength >= charOffset) {
|
|
219546
219732
|
const offsetInRun = charOffset - currentCharOffset;
|
|
219547
219733
|
ctx$1.font = getRunFontString(run2);
|
|
@@ -219588,7 +219774,7 @@ function measureCharacterXSegmentBased(block, line, charOffset, ctx$1) {
|
|
|
219588
219774
|
}
|
|
219589
219775
|
if (isTabRun(run2))
|
|
219590
219776
|
return segmentBaseX + (offsetInSegment > 0 ? segment.width ?? 0 : 0);
|
|
219591
|
-
if ("src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation")
|
|
219777
|
+
if ("src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math")
|
|
219592
219778
|
return segmentBaseX + (offsetInSegment >= segmentChars ? segment.width ?? 0 : 0);
|
|
219593
219779
|
const textUpToTarget = applyTextTransform$1(run2.text ?? "", "textTransform" in run2 ? run2.textTransform : undefined).slice(segment.fromChar, segment.toChar).slice(0, offsetInSegment);
|
|
219594
219780
|
ctx$1.font = getRunFontString(run2);
|
|
@@ -219616,7 +219802,7 @@ function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
|
|
|
219616
219802
|
let lastPm = fallbackPmStart;
|
|
219617
219803
|
for (const run2 of runs2) {
|
|
219618
219804
|
const isTab = isTabRun(run2);
|
|
219619
|
-
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
219805
|
+
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? "" : run2.text ?? "";
|
|
219620
219806
|
const runLength = isTab ? TAB_CHAR_LENGTH : text5.length;
|
|
219621
219807
|
const runPmStart = typeof run2.pmStart === "number" ? run2.pmStart : null;
|
|
219622
219808
|
const runPmEnd = typeof run2.pmEnd === "number" ? run2.pmEnd : runPmStart != null ? runPmStart + runLength : null;
|
|
@@ -219645,7 +219831,7 @@ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride, align
|
|
|
219645
219831
|
const charsInLine = Math.max(1, runs$1.reduce((sum, run2) => {
|
|
219646
219832
|
if (isTabRun(run2))
|
|
219647
219833
|
return sum + TAB_CHAR_LENGTH;
|
|
219648
|
-
if ("src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation")
|
|
219834
|
+
if ("src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math")
|
|
219649
219835
|
return sum;
|
|
219650
219836
|
return sum + (run2.text ?? "").length;
|
|
219651
219837
|
}, 0));
|
|
@@ -219678,9 +219864,9 @@ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride, align
|
|
|
219678
219864
|
currentCharOffset += TAB_CHAR_LENGTH;
|
|
219679
219865
|
continue;
|
|
219680
219866
|
}
|
|
219681
|
-
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
219867
|
+
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? "" : run2.text ?? "";
|
|
219682
219868
|
const runLength = text5.length;
|
|
219683
|
-
const displayText = applyTextTransform$1(text5, isTabRun(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? undefined : run2.textTransform);
|
|
219869
|
+
const displayText = applyTextTransform$1(text5, isTabRun(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? undefined : run2.textTransform);
|
|
219684
219870
|
if (runLength === 0)
|
|
219685
219871
|
continue;
|
|
219686
219872
|
ctx$1.font = getRunFontString(run2);
|
|
@@ -219726,13 +219912,13 @@ function isRtlLine(lineEl) {
|
|
|
219726
219912
|
function isVisibleRect(rect) {
|
|
219727
219913
|
return rect.width > 0 && rect.height > 0;
|
|
219728
219914
|
}
|
|
219729
|
-
function clickToPositionDom(domContainer, clientX, clientY) {
|
|
219915
|
+
function clickToPositionDom$1(domContainer, clientX, clientY) {
|
|
219730
219916
|
log2("=== clickToPositionDom START ===");
|
|
219731
219917
|
log2("Input coords:", {
|
|
219732
219918
|
clientX,
|
|
219733
219919
|
clientY
|
|
219734
219920
|
});
|
|
219735
|
-
const pageEl = findPageElement(domContainer, clientX, clientY);
|
|
219921
|
+
const pageEl = findPageElement$1(domContainer, clientX, clientY);
|
|
219736
219922
|
if (!pageEl) {
|
|
219737
219923
|
log2("No page element found");
|
|
219738
219924
|
return null;
|
|
@@ -219843,7 +220029,7 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
219843
220029
|
log2("=== clickToPositionDom END ===", { result });
|
|
219844
220030
|
return result;
|
|
219845
220031
|
}
|
|
219846
|
-
function findPageElement(domContainer, clientX, clientY) {
|
|
220032
|
+
function findPageElement$1(domContainer, clientX, clientY) {
|
|
219847
220033
|
if (domContainer.classList?.contains?.(CLASS_NAMES.page))
|
|
219848
220034
|
return domContainer;
|
|
219849
220035
|
const doc$12 = document;
|
|
@@ -220531,7 +220717,7 @@ function extractBlockText(block) {
|
|
|
220531
220717
|
let pmStart = Infinity;
|
|
220532
220718
|
let pmEnd = 0;
|
|
220533
220719
|
for (const run2 of block.runs) {
|
|
220534
|
-
text5 += "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text;
|
|
220720
|
+
text5 += "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? "" : run2.text;
|
|
220535
220721
|
if (run2.pmStart !== undefined)
|
|
220536
220722
|
pmStart = Math.min(pmStart, run2.pmStart);
|
|
220537
220723
|
if (run2.pmEnd !== undefined)
|
|
@@ -220588,7 +220774,7 @@ function fontString(run2) {
|
|
|
220588
220774
|
return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$1}px ${family}`.trim();
|
|
220589
220775
|
}
|
|
220590
220776
|
function runText(run2) {
|
|
220591
|
-
return "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
220777
|
+
return "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? "" : run2.text ?? "";
|
|
220592
220778
|
}
|
|
220593
220779
|
function measureRunSliceWidth(run2, fromChar, toChar) {
|
|
220594
220780
|
const context = getCtx();
|
|
@@ -220862,7 +221048,9 @@ function computeHeaderFooterContentHash(blocks2) {
|
|
|
220862
221048
|
parts.push(block.id);
|
|
220863
221049
|
if (block.kind === "paragraph")
|
|
220864
221050
|
for (const run2 of block.runs) {
|
|
220865
|
-
if (
|
|
221051
|
+
if (run2.kind === "math")
|
|
221052
|
+
parts.push(`math:${run2.textContent}`);
|
|
221053
|
+
else if (!("src" in run2) && run2.kind !== "lineBreak" && run2.kind !== "break" && run2.kind !== "fieldAnnotation")
|
|
220866
221054
|
parts.push(run2.text ?? "");
|
|
220867
221055
|
if ("bold" in run2 && run2.bold)
|
|
220868
221056
|
parts.push("b");
|
|
@@ -221974,6 +222162,36 @@ function snapToNearestFragment(pageHit, blocks2, measures, pageRelativePoint) {
|
|
|
221974
222162
|
}
|
|
221975
222163
|
return nearestHit;
|
|
221976
222164
|
}
|
|
222165
|
+
function findBlockIndexByFragmentId(blocks2, fragmentBlockId, targetPmRange) {
|
|
222166
|
+
const index2 = blocks2.findIndex((block) => block.id === fragmentBlockId && block.kind !== "pageBreak" && block.kind !== "sectionBreak");
|
|
222167
|
+
if (index2 !== -1)
|
|
222168
|
+
return index2;
|
|
222169
|
+
const baseBlockId = fragmentBlockId.replace(/-\d+$/, "");
|
|
222170
|
+
if (baseBlockId === fragmentBlockId)
|
|
222171
|
+
return -1;
|
|
222172
|
+
const matchingIndices = [];
|
|
222173
|
+
blocks2.forEach((block, idx) => {
|
|
222174
|
+
if (block.id === baseBlockId && block.kind === "paragraph")
|
|
222175
|
+
matchingIndices.push(idx);
|
|
222176
|
+
});
|
|
222177
|
+
if (matchingIndices.length === 0)
|
|
222178
|
+
return -1;
|
|
222179
|
+
if (matchingIndices.length === 1)
|
|
222180
|
+
return matchingIndices[0];
|
|
222181
|
+
if (targetPmRange)
|
|
222182
|
+
for (const idx of matchingIndices) {
|
|
222183
|
+
const block = blocks2[idx];
|
|
222184
|
+
if (block.kind !== "paragraph")
|
|
222185
|
+
continue;
|
|
222186
|
+
if (block.runs.some((run2) => {
|
|
222187
|
+
if (run2.pmStart == null || run2.pmEnd == null)
|
|
222188
|
+
return false;
|
|
222189
|
+
return run2.pmEnd > targetPmRange.from && run2.pmStart < targetPmRange.to;
|
|
222190
|
+
}))
|
|
222191
|
+
return idx;
|
|
222192
|
+
}
|
|
222193
|
+
return matchingIndices[0];
|
|
222194
|
+
}
|
|
221977
222195
|
function hitTestPage(layout, point5, geometryHelper) {
|
|
221978
222196
|
if (geometryHelper) {
|
|
221979
222197
|
const pageIndex = geometryHelper.getPageIndexAtY(point5.y);
|
|
@@ -222052,137 +222270,92 @@ function hitTestFragment(layout, pageHit, blocks2, measures, point5) {
|
|
|
222052
222270
|
}
|
|
222053
222271
|
return null;
|
|
222054
222272
|
}
|
|
222055
|
-
function
|
|
222056
|
-
|
|
222057
|
-
|
|
222058
|
-
|
|
222059
|
-
|
|
222060
|
-
|
|
222061
|
-
|
|
222062
|
-
|
|
222063
|
-
|
|
222064
|
-
|
|
222065
|
-
|
|
222066
|
-
|
|
222067
|
-
|
|
222068
|
-
|
|
222069
|
-
|
|
222070
|
-
|
|
222071
|
-
|
|
222072
|
-
|
|
222073
|
-
|
|
222074
|
-
|
|
222075
|
-
|
|
222076
|
-
|
|
222077
|
-
|
|
222078
|
-
|
|
222079
|
-
|
|
222080
|
-
|
|
222081
|
-
|
|
222082
|
-
blockId = fragment2.blockId;
|
|
222083
|
-
pageIndex = pi;
|
|
222084
|
-
column = determineColumn(layout, fragment2.x);
|
|
222085
|
-
const blockIndex = findBlockIndexByFragmentId(blocks2, fragment2.blockId);
|
|
222086
|
-
if (blockIndex !== -1) {
|
|
222087
|
-
const measure = measures[blockIndex];
|
|
222088
|
-
if (measure && measure.kind === "paragraph")
|
|
222089
|
-
if (fragment2.lines && fragment2.lines.length > 0)
|
|
222090
|
-
for (let localIndex = 0;localIndex < fragment2.lines.length; localIndex++) {
|
|
222091
|
-
const line = fragment2.lines[localIndex];
|
|
222092
|
-
if (!line)
|
|
222093
|
-
continue;
|
|
222094
|
-
const range = computeLinePmRange(blocks2[blockIndex], line);
|
|
222095
|
-
if (range.pmStart != null && range.pmEnd != null) {
|
|
222096
|
-
if (domPos >= range.pmStart && domPos <= range.pmEnd) {
|
|
222097
|
-
lineIndex = fragment2.fromLine + localIndex;
|
|
222098
|
-
break;
|
|
222099
|
-
}
|
|
222100
|
-
}
|
|
222273
|
+
function resolvePositionHitFromDomPosition(layout, blocks2, measures, domPos, layoutEpoch) {
|
|
222274
|
+
let blockId = "";
|
|
222275
|
+
let pageIndex = 0;
|
|
222276
|
+
let column = 0;
|
|
222277
|
+
let lineIndex = -1;
|
|
222278
|
+
for (let pi = 0;pi < layout.pages.length; pi++) {
|
|
222279
|
+
const page = layout.pages[pi];
|
|
222280
|
+
for (const fragment2 of page.fragments)
|
|
222281
|
+
if (fragment2.kind === "para" && fragment2.pmStart != null && fragment2.pmEnd != null) {
|
|
222282
|
+
if (domPos >= fragment2.pmStart && domPos <= fragment2.pmEnd) {
|
|
222283
|
+
blockId = fragment2.blockId;
|
|
222284
|
+
pageIndex = pi;
|
|
222285
|
+
column = determineColumn(layout, fragment2.x);
|
|
222286
|
+
const blockIndex = findBlockIndexByFragmentId(blocks2, fragment2.blockId);
|
|
222287
|
+
if (blockIndex !== -1) {
|
|
222288
|
+
const measure = measures[blockIndex];
|
|
222289
|
+
if (measure && measure.kind === "paragraph")
|
|
222290
|
+
if (fragment2.lines && fragment2.lines.length > 0)
|
|
222291
|
+
for (let localIndex = 0;localIndex < fragment2.lines.length; localIndex++) {
|
|
222292
|
+
const line = fragment2.lines[localIndex];
|
|
222293
|
+
if (!line)
|
|
222294
|
+
continue;
|
|
222295
|
+
const range = computeLinePmRange$1(blocks2[blockIndex], line);
|
|
222296
|
+
if (range.pmStart != null && range.pmEnd != null) {
|
|
222297
|
+
if (domPos >= range.pmStart && domPos <= range.pmEnd) {
|
|
222298
|
+
lineIndex = fragment2.fromLine + localIndex;
|
|
222299
|
+
break;
|
|
222101
222300
|
}
|
|
222102
|
-
|
|
222103
|
-
|
|
222104
|
-
|
|
222105
|
-
|
|
222106
|
-
|
|
222107
|
-
|
|
222108
|
-
|
|
222109
|
-
|
|
222110
|
-
|
|
222111
|
-
|
|
222112
|
-
|
|
222113
|
-
|
|
222301
|
+
}
|
|
222302
|
+
}
|
|
222303
|
+
else
|
|
222304
|
+
for (let li2 = fragment2.fromLine;li2 < fragment2.toLine; li2++) {
|
|
222305
|
+
const line = measure.lines[li2];
|
|
222306
|
+
if (!line)
|
|
222307
|
+
continue;
|
|
222308
|
+
const range = computeLinePmRange$1(blocks2[blockIndex], line);
|
|
222309
|
+
if (range.pmStart != null && range.pmEnd != null) {
|
|
222310
|
+
if (domPos >= range.pmStart && domPos <= range.pmEnd) {
|
|
222311
|
+
lineIndex = li2;
|
|
222312
|
+
break;
|
|
222114
222313
|
}
|
|
222115
|
-
|
|
222116
|
-
|
|
222117
|
-
blockId,
|
|
222118
|
-
pos: domPos,
|
|
222119
|
-
pageIndex,
|
|
222120
|
-
column,
|
|
222121
|
-
lineIndex,
|
|
222122
|
-
usedMethod: "DOM"
|
|
222123
|
-
});
|
|
222124
|
-
return {
|
|
222125
|
-
pos: domPos,
|
|
222126
|
-
layoutEpoch: domLayoutEpoch,
|
|
222127
|
-
blockId,
|
|
222128
|
-
pageIndex,
|
|
222129
|
-
column,
|
|
222130
|
-
lineIndex
|
|
222131
|
-
};
|
|
222132
|
-
}
|
|
222314
|
+
}
|
|
222315
|
+
}
|
|
222133
222316
|
}
|
|
222317
|
+
return {
|
|
222318
|
+
pos: domPos,
|
|
222319
|
+
layoutEpoch,
|
|
222320
|
+
blockId,
|
|
222321
|
+
pageIndex,
|
|
222322
|
+
column,
|
|
222323
|
+
lineIndex
|
|
222324
|
+
};
|
|
222325
|
+
}
|
|
222134
222326
|
}
|
|
222135
|
-
logClickStage("log", "success", {
|
|
222136
|
-
pos: domPos,
|
|
222137
|
-
usedMethod: "DOM",
|
|
222138
|
-
note: "position found but fragment not located"
|
|
222139
|
-
});
|
|
222140
|
-
return {
|
|
222141
|
-
pos: domPos,
|
|
222142
|
-
layoutEpoch: domLayoutEpoch,
|
|
222143
|
-
blockId: "",
|
|
222144
|
-
pageIndex: 0,
|
|
222145
|
-
column: 0,
|
|
222146
|
-
lineIndex: -1
|
|
222147
|
-
};
|
|
222148
|
-
}
|
|
222149
|
-
logClickStage("log", "dom-fallback", { reason: "DOM mapping returned null, trying geometry" });
|
|
222150
222327
|
}
|
|
222151
|
-
|
|
222328
|
+
return {
|
|
222329
|
+
pos: domPos,
|
|
222330
|
+
layoutEpoch,
|
|
222331
|
+
blockId: "",
|
|
222332
|
+
pageIndex: 0,
|
|
222333
|
+
column: 0,
|
|
222334
|
+
lineIndex: -1
|
|
222335
|
+
};
|
|
222336
|
+
}
|
|
222337
|
+
function clickToPositionGeometry(layout, blocks2, measures, containerPoint, options) {
|
|
222338
|
+
const layoutEpoch = layout.layoutEpoch ?? 0;
|
|
222339
|
+
const geometryHelper = options?.geometryHelper;
|
|
222340
|
+
const pageHint = options?.pageHint;
|
|
222152
222341
|
let pageHit = null;
|
|
222153
|
-
|
|
222154
|
-
|
|
222155
|
-
|
|
222156
|
-
|
|
222157
|
-
|
|
222158
|
-
|
|
222159
|
-
|
|
222160
|
-
pageIndex: domPageIndex,
|
|
222161
|
-
page: layout.pages[domPageIndex]
|
|
222162
|
-
};
|
|
222163
|
-
const pageRect = pageEl.getBoundingClientRect();
|
|
222164
|
-
const layoutPageHeight = pageHit.page.size?.h ?? layout.pageSize.h;
|
|
222165
|
-
const domPageHeight = pageRect.height;
|
|
222166
|
-
const effectiveZoom = domPageHeight > 0 && layoutPageHeight > 0 ? domPageHeight / layoutPageHeight : 1;
|
|
222167
|
-
domPageRelativeY = (clientY - pageRect.top) / effectiveZoom;
|
|
222168
|
-
}
|
|
222169
|
-
}
|
|
222342
|
+
if (pageHint != null) {
|
|
222343
|
+
const pi = pageHint.pageIndex;
|
|
222344
|
+
if (pi >= 0 && pi < layout.pages.length)
|
|
222345
|
+
pageHit = {
|
|
222346
|
+
pageIndex: pi,
|
|
222347
|
+
page: layout.pages[pi]
|
|
222348
|
+
};
|
|
222170
222349
|
}
|
|
222171
222350
|
if (!pageHit)
|
|
222172
222351
|
pageHit = hitTestPage(layout, containerPoint, geometryHelper);
|
|
222173
|
-
if (!pageHit)
|
|
222174
|
-
logClickStage("warn", "no-page", { point: containerPoint });
|
|
222352
|
+
if (!pageHit)
|
|
222175
222353
|
return null;
|
|
222176
|
-
}
|
|
222177
222354
|
const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageHit.pageIndex) : calculatePageTopFallback(layout, pageHit.pageIndex);
|
|
222178
222355
|
const pageRelativePoint = {
|
|
222179
222356
|
x: containerPoint.x,
|
|
222180
|
-
y:
|
|
222357
|
+
y: pageHint?.pageRelativeY ?? containerPoint.y - pageTopY
|
|
222181
222358
|
};
|
|
222182
|
-
logClickStage("log", "page-hit", {
|
|
222183
|
-
pageIndex: pageHit.pageIndex,
|
|
222184
|
-
pageRelativePoint
|
|
222185
|
-
});
|
|
222186
222359
|
let fragmentHit = hitTestFragment(layout, pageHit, blocks2, measures, pageRelativePoint);
|
|
222187
222360
|
if (!fragmentHit) {
|
|
222188
222361
|
if (!pageHit.page.fragments.filter((f2) => f2.kind === "table").some((f2) => {
|
|
@@ -222196,14 +222369,8 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
|
|
|
222196
222369
|
if (fragment2.kind === "para" && measure.kind === "paragraph" && block.kind === "paragraph") {
|
|
222197
222370
|
const lines = fragment2.lines ?? measure.lines.slice(fragment2.fromLine, fragment2.toLine);
|
|
222198
222371
|
const lineIndex = findLineIndexAtY(lines, pageY, 0, lines.length);
|
|
222199
|
-
if (lineIndex == null)
|
|
222200
|
-
logClickStage("warn", "no-line", {
|
|
222201
|
-
blockId: fragment2.blockId,
|
|
222202
|
-
pageIndex,
|
|
222203
|
-
pageY
|
|
222204
|
-
});
|
|
222372
|
+
if (lineIndex == null)
|
|
222205
222373
|
return null;
|
|
222206
|
-
}
|
|
222207
222374
|
const line = lines[lineIndex];
|
|
222208
222375
|
const isRTL = isRtlBlock(block);
|
|
222209
222376
|
const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
|
|
@@ -222216,34 +222383,9 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
|
|
|
222216
222383
|
const isJustified = block.attrs?.alignment === "justify";
|
|
222217
222384
|
const alignmentOverride = isListItem$1 && !isJustified ? "left" : undefined;
|
|
222218
222385
|
const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment2.x, isRTL, availableWidth, alignmentOverride);
|
|
222219
|
-
if (pos == null)
|
|
222220
|
-
logClickStage("warn", "no-position", {
|
|
222221
|
-
blockId: fragment2.blockId,
|
|
222222
|
-
lineIndex,
|
|
222223
|
-
isRTL
|
|
222224
|
-
});
|
|
222386
|
+
if (pos == null)
|
|
222225
222387
|
return null;
|
|
222226
|
-
}
|
|
222227
222388
|
const column = determineColumn(layout, fragment2.x);
|
|
222228
|
-
logPositionDebug({
|
|
222229
|
-
origin: "geometry",
|
|
222230
|
-
pos,
|
|
222231
|
-
blockId: fragment2.blockId,
|
|
222232
|
-
pageIndex,
|
|
222233
|
-
column,
|
|
222234
|
-
lineIndex,
|
|
222235
|
-
x: pageRelativePoint.x - fragment2.x,
|
|
222236
|
-
y: pageRelativePoint.y,
|
|
222237
|
-
isRTL
|
|
222238
|
-
});
|
|
222239
|
-
logClickStage("log", "success", {
|
|
222240
|
-
blockId: fragment2.blockId,
|
|
222241
|
-
pos,
|
|
222242
|
-
pageIndex,
|
|
222243
|
-
column,
|
|
222244
|
-
lineIndex,
|
|
222245
|
-
origin: "paragraph"
|
|
222246
|
-
});
|
|
222247
222389
|
return {
|
|
222248
222390
|
pos,
|
|
222249
222391
|
layoutEpoch,
|
|
@@ -222256,18 +222398,8 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
|
|
|
222256
222398
|
if (isAtomicFragment(fragment2)) {
|
|
222257
222399
|
const pmRange = getAtomicPmRange(fragment2, block);
|
|
222258
222400
|
const pos = pmRange.pmStart ?? pmRange.pmEnd ?? null;
|
|
222259
|
-
if (pos == null)
|
|
222260
|
-
logClickStage("warn", "atomic-without-range", { fragmentId: fragment2.blockId });
|
|
222401
|
+
if (pos == null)
|
|
222261
222402
|
return null;
|
|
222262
|
-
}
|
|
222263
|
-
logClickStage("log", "success", {
|
|
222264
|
-
blockId: fragment2.blockId,
|
|
222265
|
-
pos,
|
|
222266
|
-
pageIndex,
|
|
222267
|
-
column: determineColumn(layout, fragment2.x),
|
|
222268
|
-
lineIndex: -1,
|
|
222269
|
-
origin: "atomic-fragment-hit"
|
|
222270
|
-
});
|
|
222271
222403
|
return {
|
|
222272
222404
|
pos,
|
|
222273
222405
|
layoutEpoch,
|
|
@@ -222294,15 +222426,7 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
|
|
|
222294
222426
|
const isListItem$1 = (cellMeasure.marker?.markerWidth ?? 0) > 0;
|
|
222295
222427
|
const isJustified = cellBlock.attrs?.alignment === "justify";
|
|
222296
222428
|
const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, isListItem$1 && !isJustified ? "left" : undefined);
|
|
222297
|
-
if (pos != null)
|
|
222298
|
-
logClickStage("log", "success", {
|
|
222299
|
-
blockId: tableHit.fragment.blockId,
|
|
222300
|
-
pos,
|
|
222301
|
-
pageIndex,
|
|
222302
|
-
column: determineColumn(layout, tableHit.fragment.x),
|
|
222303
|
-
lineIndex,
|
|
222304
|
-
origin: "table-cell"
|
|
222305
|
-
});
|
|
222429
|
+
if (pos != null)
|
|
222306
222430
|
return {
|
|
222307
222431
|
pos,
|
|
222308
222432
|
layoutEpoch,
|
|
@@ -222311,18 +222435,9 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
|
|
|
222311
222435
|
column: determineColumn(layout, tableHit.fragment.x),
|
|
222312
222436
|
lineIndex
|
|
222313
222437
|
};
|
|
222314
|
-
}
|
|
222315
222438
|
}
|
|
222316
222439
|
const firstRun = cellBlock.runs?.[0];
|
|
222317
|
-
if (firstRun && firstRun.pmStart != null)
|
|
222318
|
-
logClickStage("log", "success", {
|
|
222319
|
-
blockId: tableHit.fragment.blockId,
|
|
222320
|
-
pos: firstRun.pmStart,
|
|
222321
|
-
pageIndex,
|
|
222322
|
-
column: determineColumn(layout, tableHit.fragment.x),
|
|
222323
|
-
lineIndex: 0,
|
|
222324
|
-
origin: "table-cell-fallback"
|
|
222325
|
-
});
|
|
222440
|
+
if (firstRun && firstRun.pmStart != null)
|
|
222326
222441
|
return {
|
|
222327
222442
|
pos: firstRun.pmStart,
|
|
222328
222443
|
layoutEpoch,
|
|
@@ -222331,30 +222446,14 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
|
|
|
222331
222446
|
column: determineColumn(layout, tableHit.fragment.x),
|
|
222332
222447
|
lineIndex: 0
|
|
222333
222448
|
};
|
|
222334
|
-
}
|
|
222335
|
-
logClickStage("warn", "table-cell-no-position", {
|
|
222336
|
-
blockId: tableHit.fragment.blockId,
|
|
222337
|
-
cellRow: tableHit.cellRowIndex,
|
|
222338
|
-
cellCol: tableHit.cellColIndex
|
|
222339
|
-
});
|
|
222340
222449
|
}
|
|
222341
222450
|
const atomicHit = hitTestAtomicFragment(pageHit, blocks2, measures, pageRelativePoint);
|
|
222342
222451
|
if (atomicHit && isAtomicFragment(atomicHit.fragment)) {
|
|
222343
222452
|
const { fragment: fragment2, block, pageIndex } = atomicHit;
|
|
222344
222453
|
const pmRange = getAtomicPmRange(fragment2, block);
|
|
222345
222454
|
const pos = pmRange.pmStart ?? pmRange.pmEnd ?? null;
|
|
222346
|
-
if (pos == null)
|
|
222347
|
-
logClickStage("warn", "atomic-without-range", { fragmentId: fragment2.blockId });
|
|
222455
|
+
if (pos == null)
|
|
222348
222456
|
return null;
|
|
222349
|
-
}
|
|
222350
|
-
logClickStage("log", "success", {
|
|
222351
|
-
blockId: fragment2.blockId,
|
|
222352
|
-
pos,
|
|
222353
|
-
pageIndex,
|
|
222354
|
-
column: determineColumn(layout, fragment2.x),
|
|
222355
|
-
lineIndex: -1,
|
|
222356
|
-
origin: "atomic-direct-hit"
|
|
222357
|
-
});
|
|
222358
222457
|
return {
|
|
222359
222458
|
pos,
|
|
222360
222459
|
layoutEpoch,
|
|
@@ -222364,42 +222463,8 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
|
|
|
222364
222463
|
lineIndex: -1
|
|
222365
222464
|
};
|
|
222366
222465
|
}
|
|
222367
|
-
logClickStage("warn", "no-fragment", {
|
|
222368
|
-
pageIndex: pageHit.pageIndex,
|
|
222369
|
-
pageRelativePoint
|
|
222370
|
-
});
|
|
222371
222466
|
return null;
|
|
222372
222467
|
}
|
|
222373
|
-
function findBlockIndexByFragmentId(blocks2, fragmentBlockId, targetPmRange) {
|
|
222374
|
-
const index2 = blocks2.findIndex((block) => block.id === fragmentBlockId && block.kind !== "pageBreak" && block.kind !== "sectionBreak");
|
|
222375
|
-
if (index2 !== -1)
|
|
222376
|
-
return index2;
|
|
222377
|
-
const baseBlockId = fragmentBlockId.replace(/-\d+$/, "");
|
|
222378
|
-
if (baseBlockId === fragmentBlockId)
|
|
222379
|
-
return -1;
|
|
222380
|
-
const matchingIndices = [];
|
|
222381
|
-
blocks2.forEach((block, idx) => {
|
|
222382
|
-
if (block.id === baseBlockId && block.kind === "paragraph")
|
|
222383
|
-
matchingIndices.push(idx);
|
|
222384
|
-
});
|
|
222385
|
-
if (matchingIndices.length === 0)
|
|
222386
|
-
return -1;
|
|
222387
|
-
if (matchingIndices.length === 1)
|
|
222388
|
-
return matchingIndices[0];
|
|
222389
|
-
if (targetPmRange)
|
|
222390
|
-
for (const idx of matchingIndices) {
|
|
222391
|
-
const block = blocks2[idx];
|
|
222392
|
-
if (block.kind !== "paragraph")
|
|
222393
|
-
continue;
|
|
222394
|
-
if (block.runs.some((run2) => {
|
|
222395
|
-
if (run2.pmStart == null || run2.pmEnd == null)
|
|
222396
|
-
return false;
|
|
222397
|
-
return run2.pmEnd > targetPmRange.from && run2.pmStart < targetPmRange.to;
|
|
222398
|
-
}))
|
|
222399
|
-
return idx;
|
|
222400
|
-
}
|
|
222401
|
-
return matchingIndices[0];
|
|
222402
|
-
}
|
|
222403
222468
|
function selectionToRects(layout, blocks2, measures, from$1, to, geometryHelper) {
|
|
222404
222469
|
if (from$1 === to)
|
|
222405
222470
|
return [];
|
|
@@ -222782,7 +222847,7 @@ function pmPosToCharOffset(block, line, pmPos) {
|
|
|
222782
222847
|
const run2 = block.runs[runIndex];
|
|
222783
222848
|
if (!run2)
|
|
222784
222849
|
continue;
|
|
222785
|
-
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
222850
|
+
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math" ? "" : run2.text ?? "";
|
|
222786
222851
|
const runTextLength = text5.length;
|
|
222787
222852
|
const runPmStart = run2.pmStart ?? null;
|
|
222788
222853
|
const runPmEnd = run2.pmEnd ?? (runPmStart != null ? runPmStart + runTextLength : null);
|
|
@@ -224956,6 +225021,31 @@ function citationNodeToRun(params$1) {
|
|
|
224956
225021
|
function authorityEntryNodeToRun(_params) {
|
|
224957
225022
|
return null;
|
|
224958
225023
|
}
|
|
225024
|
+
function estimateMathDimensions(textContent$1) {
|
|
225025
|
+
return {
|
|
225026
|
+
width: Math.max(textContent$1.length * 10, 20),
|
|
225027
|
+
height: 24
|
|
225028
|
+
};
|
|
225029
|
+
}
|
|
225030
|
+
function mathInlineNodeToRun({ node: node3, positions, sdtMetadata }) {
|
|
225031
|
+
const textContent$1 = String(node3.attrs?.textContent ?? "");
|
|
225032
|
+
const { width, height } = estimateMathDimensions(textContent$1);
|
|
225033
|
+
const run2 = {
|
|
225034
|
+
kind: "math",
|
|
225035
|
+
ommlJson: node3.attrs?.originalXml ?? null,
|
|
225036
|
+
textContent: textContent$1,
|
|
225037
|
+
width,
|
|
225038
|
+
height
|
|
225039
|
+
};
|
|
225040
|
+
const pos = positions.get(node3);
|
|
225041
|
+
if (pos) {
|
|
225042
|
+
run2.pmStart = pos.start;
|
|
225043
|
+
run2.pmEnd = pos.end;
|
|
225044
|
+
}
|
|
225045
|
+
if (sdtMetadata)
|
|
225046
|
+
run2.sdt = sdtMetadata;
|
|
225047
|
+
return run2;
|
|
225048
|
+
}
|
|
224959
225049
|
function lineBreakNodeToRun({ node: node3, positions, sdtMetadata }) {
|
|
224960
225050
|
const attrs = node3.attrs ?? {};
|
|
224961
225051
|
const breakType = attrs.pageBreakType ?? attrs.lineBreakType ?? "line";
|
|
@@ -225860,6 +225950,30 @@ function handleParagraphNode2(node3, context) {
|
|
|
225860
225950
|
});
|
|
225861
225951
|
sectionState.currentParagraphIndex++;
|
|
225862
225952
|
}
|
|
225953
|
+
function handleMathBlockNode(node3, context) {
|
|
225954
|
+
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
225955
|
+
const textContent$1 = String(node3.attrs?.textContent ?? "");
|
|
225956
|
+
const justification = String(node3.attrs?.justification ?? "centerGroup");
|
|
225957
|
+
const { width, height } = estimateMathDimensions(textContent$1);
|
|
225958
|
+
const pos = positions.get(node3);
|
|
225959
|
+
const mathRun = {
|
|
225960
|
+
kind: "math",
|
|
225961
|
+
ommlJson: node3.attrs?.originalXml ?? null,
|
|
225962
|
+
textContent: textContent$1,
|
|
225963
|
+
width,
|
|
225964
|
+
height,
|
|
225965
|
+
pmStart: pos?.start,
|
|
225966
|
+
pmEnd: pos?.end
|
|
225967
|
+
};
|
|
225968
|
+
const block = {
|
|
225969
|
+
kind: "paragraph",
|
|
225970
|
+
id: nextBlockId("paragraph"),
|
|
225971
|
+
runs: [mathRun],
|
|
225972
|
+
attrs: { alignment: JUSTIFICATION_TO_ALIGN[justification] ?? "center" }
|
|
225973
|
+
};
|
|
225974
|
+
blocks2.push(block);
|
|
225975
|
+
recordBlockKind?.(block.kind);
|
|
225976
|
+
}
|
|
225863
225977
|
function toFlowBlocks(pmDoc, options) {
|
|
225864
225978
|
const defaultFont = options?.defaultFont ?? DEFAULT_FONT;
|
|
225865
225979
|
const defaultSize = options?.defaultSize ?? DEFAULT_SIZE2;
|
|
@@ -226385,6 +226499,68 @@ function renderRemoteSelection(options) {
|
|
|
226385
226499
|
});
|
|
226386
226500
|
options.renderCaret();
|
|
226387
226501
|
}
|
|
226502
|
+
function clickToPositionDom(domContainer, clientX, clientY) {
|
|
226503
|
+
return clickToPositionDom$1(domContainer, clientX, clientY);
|
|
226504
|
+
}
|
|
226505
|
+
function findPageElement(domContainer, clientX, clientY) {
|
|
226506
|
+
return findPageElement$1(domContainer, clientX, clientY);
|
|
226507
|
+
}
|
|
226508
|
+
function readLayoutEpochFromDom(domContainer, clientX, clientY) {
|
|
226509
|
+
const doc$12 = domContainer.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
226510
|
+
if (!doc$12 || typeof doc$12.elementsFromPoint !== "function")
|
|
226511
|
+
return null;
|
|
226512
|
+
let hitChain = [];
|
|
226513
|
+
try {
|
|
226514
|
+
hitChain = doc$12.elementsFromPoint(clientX, clientY) ?? [];
|
|
226515
|
+
} catch {
|
|
226516
|
+
return null;
|
|
226517
|
+
}
|
|
226518
|
+
let latestEpoch = null;
|
|
226519
|
+
for (const el of hitChain) {
|
|
226520
|
+
if (!(el instanceof HTMLElement))
|
|
226521
|
+
continue;
|
|
226522
|
+
if (!domContainer.contains(el))
|
|
226523
|
+
continue;
|
|
226524
|
+
const raw = el.dataset.layoutEpoch;
|
|
226525
|
+
if (raw == null)
|
|
226526
|
+
continue;
|
|
226527
|
+
const epoch = Number(raw);
|
|
226528
|
+
if (!Number.isFinite(epoch))
|
|
226529
|
+
continue;
|
|
226530
|
+
if (latestEpoch == null || epoch > latestEpoch)
|
|
226531
|
+
latestEpoch = epoch;
|
|
226532
|
+
}
|
|
226533
|
+
return latestEpoch;
|
|
226534
|
+
}
|
|
226535
|
+
function resolvePointerPositionHit(options) {
|
|
226536
|
+
const { layout, blocks: blocks2, measures, containerPoint, domContainer, clientX, clientY, geometryHelper } = options;
|
|
226537
|
+
const layoutEpoch = layout.layoutEpoch ?? 0;
|
|
226538
|
+
if (domContainer != null && clientX != null && clientY != null) {
|
|
226539
|
+
const domPos = clickToPositionDom(domContainer, clientX, clientY);
|
|
226540
|
+
const domLayoutEpoch = readLayoutEpochFromDom(domContainer, clientX, clientY) ?? layoutEpoch;
|
|
226541
|
+
if (domPos != null)
|
|
226542
|
+
return resolvePositionHitFromDomPosition(layout, blocks2, measures, domPos, domLayoutEpoch);
|
|
226543
|
+
const pageEl = findPageElement(domContainer, clientX, clientY);
|
|
226544
|
+
if (pageEl) {
|
|
226545
|
+
const domPageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
226546
|
+
if (Number.isFinite(domPageIndex) && domPageIndex >= 0 && domPageIndex < layout.pages.length) {
|
|
226547
|
+
const page = layout.pages[domPageIndex];
|
|
226548
|
+
const pageRect = pageEl.getBoundingClientRect();
|
|
226549
|
+
const layoutPageHeight = page.size?.h ?? layout.pageSize.h;
|
|
226550
|
+
const domPageHeight = pageRect.height;
|
|
226551
|
+
const effectiveZoom = domPageHeight > 0 && layoutPageHeight > 0 ? domPageHeight / layoutPageHeight : 1;
|
|
226552
|
+
return clickToPositionGeometry(layout, blocks2, measures, containerPoint, {
|
|
226553
|
+
geometryHelper,
|
|
226554
|
+
pageHint: {
|
|
226555
|
+
pageIndex: domPageIndex,
|
|
226556
|
+
pageRelativeY: (clientY - pageRect.top) / effectiveZoom
|
|
226557
|
+
}
|
|
226558
|
+
});
|
|
226559
|
+
}
|
|
226560
|
+
}
|
|
226561
|
+
}
|
|
226562
|
+
return clickToPositionGeometry(layout, blocks2, measures, containerPoint, { geometryHelper });
|
|
226563
|
+
}
|
|
226388
226564
|
function getCellPosFromTableHit(tableHit, doc$12, blocks2) {
|
|
226389
226565
|
if (!tableHit || !tableHit.block || typeof tableHit.block.id !== "string") {
|
|
226390
226566
|
console.warn("[getCellPosFromTableHit] Invalid tableHit input:", tableHit);
|
|
@@ -236528,7 +236704,7 @@ var Node$13 = class Node$14 {
|
|
|
236528
236704
|
update() {
|
|
236529
236705
|
return false;
|
|
236530
236706
|
}
|
|
236531
|
-
}, ShapeGroup, CHART_IMMUTABILITY_KEY, chartPositionCache, Chart, sharedAttributes$2 = () => ({
|
|
236707
|
+
}, ShapeGroup, CHART_IMMUTABILITY_KEY, chartPositionCache, Chart, MathInline, MathBlock, sharedAttributes$2 = () => ({
|
|
236532
236708
|
originalName: { default: null },
|
|
236533
236709
|
originalXml: { default: null }
|
|
236534
236710
|
}), hiddenRender = (type) => ["sd-passthrough", {
|
|
@@ -241895,7 +242071,34 @@ var Node$13 = class Node$14 {
|
|
|
241895
242071
|
}
|
|
241896
242072
|
element3.style.textAlign = resolveTextAlign(attrs?.alignment, rtl);
|
|
241897
242073
|
return rtl;
|
|
241898
|
-
}, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl,
|
|
242074
|
+
}, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl, MATHML_NS$2 = "http://www.w3.org/1998/Math/MathML", OPERATOR_CHARS, convertMathRun = (node3, doc$12) => {
|
|
242075
|
+
const elements = node3.elements ?? [];
|
|
242076
|
+
let text5 = "";
|
|
242077
|
+
for (const child of elements)
|
|
242078
|
+
if (child.name === "m:t") {
|
|
242079
|
+
const textChildren = child.elements ?? [];
|
|
242080
|
+
for (const tc of textChildren)
|
|
242081
|
+
if (tc.type === "text" && typeof tc.text === "string")
|
|
242082
|
+
text5 += tc.text;
|
|
242083
|
+
}
|
|
242084
|
+
if (!text5)
|
|
242085
|
+
return null;
|
|
242086
|
+
const isNormalText = elements.find((el$1) => el$1.name === "m:rPr")?.elements?.some((el$1) => el$1.name === "m:nor") ?? false;
|
|
242087
|
+
const tag = classifyMathText(text5);
|
|
242088
|
+
const el = doc$12.createElementNS(MATHML_NS$2, tag);
|
|
242089
|
+
el.textContent = text5;
|
|
242090
|
+
if (tag === "mi" && isNormalText)
|
|
242091
|
+
el.setAttribute("mathvariant", "normal");
|
|
242092
|
+
return el;
|
|
242093
|
+
}, MATHML_NS$1 = "http://www.w3.org/1998/Math/MathML", convertFraction = (node3, doc$12, convertChildren) => {
|
|
242094
|
+
const elements = node3.elements ?? [];
|
|
242095
|
+
const num = elements.find((e) => e.name === "m:num");
|
|
242096
|
+
const den = elements.find((e) => e.name === "m:den");
|
|
242097
|
+
const frac = doc$12.createElementNS(MATHML_NS$1, "mfrac");
|
|
242098
|
+
frac.appendChild(convertChildren(num?.elements ?? []));
|
|
242099
|
+
frac.appendChild(convertChildren(den?.elements ?? []));
|
|
242100
|
+
return frac;
|
|
242101
|
+
}, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, cssToken = (varName, fallback) => ({
|
|
241899
242102
|
css: `var(${varName}, ${fallback})`,
|
|
241900
242103
|
fallback
|
|
241901
242104
|
}), LIST_MARKER_GAP = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, COMMENT_HIGHLIGHT_EXTERNAL, COMMENT_HIGHLIGHT_EXTERNAL_ACTIVE, COMMENT_HIGHLIGHT_EXTERNAL_FADED, COMMENT_HIGHLIGHT_INTERNAL, COMMENT_HIGHLIGHT_INTERNAL_ACTIVE, COMMENT_HIGHLIGHT_INTERNAL_FADED, COMMENT_HIGHLIGHT_EXTERNAL_NESTED_BORDER, COMMENT_HIGHLIGHT_INTERNAL_NESTED_BORDER, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_FOCUSED_CLASS = "track-change-focused", TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
|
|
@@ -242474,7 +242677,7 @@ var Node$13 = class Node$14 {
|
|
|
242474
242677
|
}
|
|
242475
242678
|
return block.id;
|
|
242476
242679
|
}, applyRunStyles = (element3, run2, _isLink = false) => {
|
|
242477
|
-
if (run2.kind === "tab" || run2.kind === "image" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation")
|
|
242680
|
+
if (run2.kind === "tab" || run2.kind === "image" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math")
|
|
242478
242681
|
return;
|
|
242479
242682
|
element3.style.fontFamily = run2.fontFamily;
|
|
242480
242683
|
element3.style.fontSize = `${run2.fontSize}px`;
|
|
@@ -242908,6 +243111,8 @@ var Node$13 = class Node$14 {
|
|
|
242908
243111
|
Image,
|
|
242909
243112
|
NodeResizer,
|
|
242910
243113
|
CustomSelection,
|
|
243114
|
+
MathInline,
|
|
243115
|
+
MathBlock,
|
|
242911
243116
|
PassthroughInline,
|
|
242912
243117
|
PassthroughBlock
|
|
242913
243118
|
];
|
|
@@ -243004,6 +243209,8 @@ var Node$13 = class Node$14 {
|
|
|
243004
243209
|
PermissionRanges,
|
|
243005
243210
|
Protection,
|
|
243006
243211
|
VerticalNavigation,
|
|
243212
|
+
MathInline,
|
|
243213
|
+
MathBlock,
|
|
243007
243214
|
PassthroughInline,
|
|
243008
243215
|
PassthroughBlock,
|
|
243009
243216
|
Diffing
|
|
@@ -246339,7 +246546,7 @@ var Node$13 = class Node$14 {
|
|
|
246339
246546
|
let totalSpaces = line.spaceCount ?? 0;
|
|
246340
246547
|
if (totalSpaces === 0)
|
|
246341
246548
|
totalSpaces = sliceRunsForLine(block, line).reduce((sum, run2) => {
|
|
246342
|
-
if (isTabRun(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation")
|
|
246549
|
+
if (isTabRun(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math")
|
|
246343
246550
|
return sum;
|
|
246344
246551
|
return sum + countSpaces(run2.text ?? "");
|
|
246345
246552
|
}, 0);
|
|
@@ -246698,6 +246905,8 @@ var Node$13 = class Node$14 {
|
|
|
246698
246905
|
}
|
|
246699
246906
|
if (run2.kind === "fieldAnnotation")
|
|
246700
246907
|
return `fa:${fieldAnnotationKey(run2)}`;
|
|
246908
|
+
if (run2.kind === "math")
|
|
246909
|
+
return `math:${run2.textContent}:${run2.width}:${run2.height}`;
|
|
246701
246910
|
const text5 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
|
|
246702
246911
|
const marks = hashRunVisualMarks(run2);
|
|
246703
246912
|
let trackedKey = "";
|
|
@@ -247427,6 +247636,15 @@ var Node$13 = class Node$14 {
|
|
|
247427
247636
|
for (let i4 = 0;i4 < a2.runs.length; i4 += 1) {
|
|
247428
247637
|
const runA = a2.runs[i4];
|
|
247429
247638
|
const runB = b$1.runs[i4];
|
|
247639
|
+
if (runA.kind === "math" || runB.kind === "math") {
|
|
247640
|
+
if (runA.kind !== runB.kind)
|
|
247641
|
+
return false;
|
|
247642
|
+
if (runA.kind === "math" && runB.kind === "math") {
|
|
247643
|
+
if (runA.textContent !== runB.textContent)
|
|
247644
|
+
return false;
|
|
247645
|
+
}
|
|
247646
|
+
continue;
|
|
247647
|
+
}
|
|
247430
247648
|
if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || fieldAnnotationKey(runA) !== fieldAnnotationKey(runB) || hashRunVisualMarks(runA) !== hashRunVisualMarks(runB) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB) || getCommentKey(runA) !== getCommentKey(runB))
|
|
247431
247649
|
return false;
|
|
247432
247650
|
}
|
|
@@ -248294,7 +248512,7 @@ var Node$13 = class Node$14 {
|
|
|
248294
248512
|
}
|
|
248295
248513
|
}, isAtomicFragment = (fragment2) => {
|
|
248296
248514
|
return fragment2.kind === "drawing" || fragment2.kind === "image";
|
|
248297
|
-
},
|
|
248515
|
+
}, blockPmRangeFromAttrs = (block) => {
|
|
248298
248516
|
const attrs = block?.attrs;
|
|
248299
248517
|
const pmStart = typeof attrs?.pmStart === "number" ? attrs.pmStart : undefined;
|
|
248300
248518
|
return {
|
|
@@ -248306,10 +248524,65 @@ var Node$13 = class Node$14 {
|
|
|
248306
248524
|
pmStart: typeof fragment2.pmStart === "number" ? fragment2.pmStart : blockPmRangeFromAttrs(block).pmStart,
|
|
248307
248525
|
pmEnd: typeof fragment2.pmEnd === "number" ? fragment2.pmEnd : blockPmRangeFromAttrs(block).pmEnd
|
|
248308
248526
|
};
|
|
248309
|
-
},
|
|
248310
|
-
if (
|
|
248527
|
+
}, isRtlBlock = (block) => {
|
|
248528
|
+
if (block.kind !== "paragraph")
|
|
248311
248529
|
return false;
|
|
248312
|
-
|
|
248530
|
+
const attrs = block.attrs;
|
|
248531
|
+
if (!attrs)
|
|
248532
|
+
return false;
|
|
248533
|
+
const directionAttr = attrs.direction ?? attrs.dir ?? attrs.textDirection;
|
|
248534
|
+
if (typeof directionAttr === "string" && directionAttr.toLowerCase() === "rtl")
|
|
248535
|
+
return true;
|
|
248536
|
+
if (typeof attrs.rtl === "boolean")
|
|
248537
|
+
return attrs.rtl;
|
|
248538
|
+
return false;
|
|
248539
|
+
}, determineColumn = (layout, fragmentX) => {
|
|
248540
|
+
const columns = layout.columns;
|
|
248541
|
+
if (!columns || columns.count <= 1)
|
|
248542
|
+
return 0;
|
|
248543
|
+
const span = (layout.pageSize.w - columns.gap * (columns.count - 1)) / columns.count + columns.gap;
|
|
248544
|
+
const relative = fragmentX;
|
|
248545
|
+
const raw = Math.floor(relative / Math.max(span, 1));
|
|
248546
|
+
return Math.max(0, Math.min(columns.count - 1, raw));
|
|
248547
|
+
}, findLineIndexAtY = (lines, offsetY, fromLine, toLine) => {
|
|
248548
|
+
if (!lines || lines.length === 0)
|
|
248549
|
+
return null;
|
|
248550
|
+
const lineCount = lines.length;
|
|
248551
|
+
if (fromLine < 0 || toLine > lineCount || fromLine >= toLine)
|
|
248552
|
+
return null;
|
|
248553
|
+
let cursor = 0;
|
|
248554
|
+
for (let i4 = fromLine;i4 < toLine; i4 += 1) {
|
|
248555
|
+
const line = lines[i4];
|
|
248556
|
+
if (!line)
|
|
248557
|
+
return null;
|
|
248558
|
+
const next2 = cursor + line.lineHeight;
|
|
248559
|
+
if (offsetY >= cursor && offsetY < next2)
|
|
248560
|
+
return i4;
|
|
248561
|
+
cursor = next2;
|
|
248562
|
+
}
|
|
248563
|
+
return toLine - 1;
|
|
248564
|
+
}, mapPointToPm = (block, line, x, isRTL, availableWidthOverride, alignmentOverride) => {
|
|
248565
|
+
if (block.kind !== "paragraph")
|
|
248566
|
+
return null;
|
|
248567
|
+
const range = computeLinePmRange$1(block, line);
|
|
248568
|
+
if (range.pmStart == null || range.pmEnd == null)
|
|
248569
|
+
return null;
|
|
248570
|
+
const result = findCharacterAtX(block, line, x, range.pmStart, availableWidthOverride, alignmentOverride);
|
|
248571
|
+
let pmPosition = result.pmPosition;
|
|
248572
|
+
if (isRTL) {
|
|
248573
|
+
const charOffset = result.charOffset;
|
|
248574
|
+
const charsInLine = Math.max(1, line.toChar - line.fromChar);
|
|
248575
|
+
pmPosition = charOffsetToPm(block, line, Math.max(0, Math.min(charsInLine, charsInLine - charOffset)), range.pmStart);
|
|
248576
|
+
}
|
|
248577
|
+
return pmPosition;
|
|
248578
|
+
}, calculatePageTopFallback = (layout, pageIndex) => {
|
|
248579
|
+
const pageGap = layout.pageGap ?? 0;
|
|
248580
|
+
let y$1 = 0;
|
|
248581
|
+
for (let i4 = 0;i4 < pageIndex; i4++) {
|
|
248582
|
+
const pageHeight = layout.pages[i4]?.size?.h ?? layout.pageSize.h;
|
|
248583
|
+
y$1 += pageHeight + pageGap;
|
|
248584
|
+
}
|
|
248585
|
+
return y$1;
|
|
248313
248586
|
}, hitTestAtomicFragment = (pageHit, blocks2, measures, point5) => {
|
|
248314
248587
|
for (const fragment2 of pageHit.page.fragments) {
|
|
248315
248588
|
if (!isAtomicFragment(fragment2))
|
|
@@ -248458,32 +248731,10 @@ var Node$13 = class Node$14 {
|
|
|
248458
248731
|
}
|
|
248459
248732
|
}
|
|
248460
248733
|
return null;
|
|
248461
|
-
},
|
|
248462
|
-
|
|
248463
|
-
|
|
248464
|
-
|
|
248465
|
-
let hitChain = [];
|
|
248466
|
-
try {
|
|
248467
|
-
hitChain = doc$12.elementsFromPoint(clientX, clientY) ?? [];
|
|
248468
|
-
} catch {
|
|
248469
|
-
return null;
|
|
248470
|
-
}
|
|
248471
|
-
let latestEpoch = null;
|
|
248472
|
-
for (const el of hitChain) {
|
|
248473
|
-
if (!(el instanceof HTMLElement))
|
|
248474
|
-
continue;
|
|
248475
|
-
if (!domContainer.contains(el))
|
|
248476
|
-
continue;
|
|
248477
|
-
const raw = el.dataset.layoutEpoch;
|
|
248478
|
-
if (raw == null)
|
|
248479
|
-
continue;
|
|
248480
|
-
const epoch = Number(raw);
|
|
248481
|
-
if (!Number.isFinite(epoch))
|
|
248482
|
-
continue;
|
|
248483
|
-
if (latestEpoch == null || epoch > latestEpoch)
|
|
248484
|
-
latestEpoch = epoch;
|
|
248485
|
-
}
|
|
248486
|
-
return latestEpoch;
|
|
248734
|
+
}, logSelectionMapDebug = (payload) => {}, rangesOverlap = (startA, endA, startB, endB) => {
|
|
248735
|
+
if (startA == null)
|
|
248736
|
+
return false;
|
|
248737
|
+
return (endA ?? startA + 1) > startB && startA < endB;
|
|
248487
248738
|
}, DEFAULT_CELL_PADDING, getCellPaddingFromRow = (cellIdx, row2) => {
|
|
248488
248739
|
const padding = row2?.cells?.[cellIdx]?.attrs?.padding ?? {};
|
|
248489
248740
|
return {
|
|
@@ -248515,39 +248766,6 @@ var Node$13 = class Node$14 {
|
|
|
248515
248766
|
for (let i4 = fromLine;i4 < toLine && i4 < measure.lines.length; i4 += 1)
|
|
248516
248767
|
height += measure.lines[i4]?.lineHeight ?? 0;
|
|
248517
248768
|
return height;
|
|
248518
|
-
}, calculatePageTopFallback = (layout, pageIndex) => {
|
|
248519
|
-
const pageGap = layout.pageGap ?? 0;
|
|
248520
|
-
let y$1 = 0;
|
|
248521
|
-
for (let i4 = 0;i4 < pageIndex; i4++) {
|
|
248522
|
-
const pageHeight = layout.pages[i4]?.size?.h ?? layout.pageSize.h;
|
|
248523
|
-
y$1 += pageHeight + pageGap;
|
|
248524
|
-
}
|
|
248525
|
-
return y$1;
|
|
248526
|
-
}, determineColumn = (layout, fragmentX) => {
|
|
248527
|
-
const columns = layout.columns;
|
|
248528
|
-
if (!columns || columns.count <= 1)
|
|
248529
|
-
return 0;
|
|
248530
|
-
const span = (layout.pageSize.w - columns.gap * (columns.count - 1)) / columns.count + columns.gap;
|
|
248531
|
-
const relative = fragmentX;
|
|
248532
|
-
const raw = Math.floor(relative / Math.max(span, 1));
|
|
248533
|
-
return Math.max(0, Math.min(columns.count - 1, raw));
|
|
248534
|
-
}, findLineIndexAtY = (lines, offsetY, fromLine, toLine) => {
|
|
248535
|
-
if (!lines || lines.length === 0)
|
|
248536
|
-
return null;
|
|
248537
|
-
const lineCount = lines.length;
|
|
248538
|
-
if (fromLine < 0 || toLine > lineCount || fromLine >= toLine)
|
|
248539
|
-
return null;
|
|
248540
|
-
let cursor = 0;
|
|
248541
|
-
for (let i4 = fromLine;i4 < toLine; i4 += 1) {
|
|
248542
|
-
const line = lines[i4];
|
|
248543
|
-
if (!line)
|
|
248544
|
-
return null;
|
|
248545
|
-
const next2 = cursor + line.lineHeight;
|
|
248546
|
-
if (offsetY >= cursor && offsetY < next2)
|
|
248547
|
-
return i4;
|
|
248548
|
-
cursor = next2;
|
|
248549
|
-
}
|
|
248550
|
-
return toLine - 1;
|
|
248551
248769
|
}, lineHeightBeforeIndex$1 = (measure, absoluteLineIndex) => {
|
|
248552
248770
|
if (measure.kind !== "paragraph")
|
|
248553
248771
|
return 0;
|
|
@@ -248555,20 +248773,6 @@ var Node$13 = class Node$14 {
|
|
|
248555
248773
|
for (let i4 = 0;i4 < absoluteLineIndex; i4 += 1)
|
|
248556
248774
|
height += measure.lines[i4]?.lineHeight ?? 0;
|
|
248557
248775
|
return height;
|
|
248558
|
-
}, mapPointToPm = (block, line, x, isRTL, availableWidthOverride, alignmentOverride) => {
|
|
248559
|
-
if (block.kind !== "paragraph")
|
|
248560
|
-
return null;
|
|
248561
|
-
const range = computeLinePmRange(block, line);
|
|
248562
|
-
if (range.pmStart == null || range.pmEnd == null)
|
|
248563
|
-
return null;
|
|
248564
|
-
const result = findCharacterAtX(block, line, x, range.pmStart, availableWidthOverride, alignmentOverride);
|
|
248565
|
-
let pmPosition = result.pmPosition;
|
|
248566
|
-
if (isRTL) {
|
|
248567
|
-
const charOffset = result.charOffset;
|
|
248568
|
-
const charsInLine = Math.max(1, line.toChar - line.fromChar);
|
|
248569
|
-
pmPosition = charOffsetToPm(block, line, Math.max(0, Math.min(charsInLine, charsInLine - charOffset)), range.pmStart);
|
|
248570
|
-
}
|
|
248571
|
-
return pmPosition;
|
|
248572
248776
|
}, mapPmToX = (block, line, offset$1, fragmentWidth, alignmentOverride) => {
|
|
248573
248777
|
if (fragmentWidth <= 0 || line.width <= 0)
|
|
248574
248778
|
return 0;
|
|
@@ -248593,18 +248797,6 @@ var Node$13 = class Node$14 {
|
|
|
248593
248797
|
if (totalIndent > fragmentWidth)
|
|
248594
248798
|
console.warn(`[mapPmToX] Paragraph indents (${totalIndent}px) exceed fragment width (${fragmentWidth}px) for block ${block.id}. This may indicate a layout miscalculation. Available width clamped to 0.`);
|
|
248595
248799
|
return measureCharacterX(block, line, offset$1, availableWidth, alignmentOverride);
|
|
248596
|
-
}, isRtlBlock = (block) => {
|
|
248597
|
-
if (block.kind !== "paragraph")
|
|
248598
|
-
return false;
|
|
248599
|
-
const attrs = block.attrs;
|
|
248600
|
-
if (!attrs)
|
|
248601
|
-
return false;
|
|
248602
|
-
const directionAttr = attrs.direction ?? attrs.dir ?? attrs.textDirection;
|
|
248603
|
-
if (typeof directionAttr === "string" && directionAttr.toLowerCase() === "rtl")
|
|
248604
|
-
return true;
|
|
248605
|
-
if (typeof attrs.rtl === "boolean")
|
|
248606
|
-
return attrs.rtl;
|
|
248607
|
-
return false;
|
|
248608
248800
|
}, WORD_CHARACTER_REGEX, EpochPositionMapper = class {
|
|
248609
248801
|
#currentEpoch = 0;
|
|
248610
248802
|
#mapsByFromEpoch = /* @__PURE__ */ new Map;
|
|
@@ -251206,7 +251398,7 @@ var Node$13 = class Node$14 {
|
|
|
251206
251398
|
return;
|
|
251207
251399
|
updateGhostListMarkerOffsets(node3, paragraphBlocks, context);
|
|
251208
251400
|
applyGhostListMarkerOffsets(node3, paragraphBlocks, context);
|
|
251209
|
-
}, INLINE_CONVERTERS_REGISTRY, SHAPE_CONVERTERS_REGISTRY, DEFAULT_FONT = "Times New Roman", DEFAULT_SIZE2, nodeHandlers2, converters, SCROLL_DEBOUNCE_MS = 32, DEFAULT_STALE_TIMEOUT_MS, THROTTLE_MS = 16, RemoteCursorManager = class {
|
|
251401
|
+
}, INLINE_CONVERTERS_REGISTRY, SHAPE_CONVERTERS_REGISTRY, JUSTIFICATION_TO_ALIGN, DEFAULT_FONT = "Times New Roman", DEFAULT_SIZE2, nodeHandlers2, converters, SCROLL_DEBOUNCE_MS = 32, DEFAULT_STALE_TIMEOUT_MS, THROTTLE_MS = 16, RemoteCursorManager = class {
|
|
251210
251402
|
#options;
|
|
251211
251403
|
#remoteCursorState = /* @__PURE__ */ new Map;
|
|
251212
251404
|
#remoteCursorElements = /* @__PURE__ */ new Map;
|
|
@@ -251939,10 +252131,19 @@ var Node$13 = class Node$14 {
|
|
|
251939
252131
|
}
|
|
251940
252132
|
const viewportHost = this.#deps.getViewportHost();
|
|
251941
252133
|
const pageGeometryHelper = this.#deps.getPageGeometryHelper();
|
|
251942
|
-
const rawHit =
|
|
251943
|
-
|
|
251944
|
-
|
|
251945
|
-
|
|
252134
|
+
const rawHit = resolvePointerPositionHit({
|
|
252135
|
+
layout: layoutState.layout,
|
|
252136
|
+
blocks: layoutState.blocks,
|
|
252137
|
+
measures: layoutState.measures,
|
|
252138
|
+
containerPoint: {
|
|
252139
|
+
x,
|
|
252140
|
+
y: y$1
|
|
252141
|
+
},
|
|
252142
|
+
domContainer: viewportHost,
|
|
252143
|
+
clientX: event.clientX,
|
|
252144
|
+
clientY: event.clientY,
|
|
252145
|
+
geometryHelper: pageGeometryHelper ?? undefined
|
|
252146
|
+
});
|
|
251946
252147
|
const doc$12 = editor.state?.doc;
|
|
251947
252148
|
const epochMapper = this.#deps.getEpochMapper();
|
|
251948
252149
|
const mapped = rawHit && doc$12 ? epochMapper.mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1) : null;
|
|
@@ -252538,10 +252739,19 @@ var Node$13 = class Node$14 {
|
|
|
252538
252739
|
};
|
|
252539
252740
|
const viewportHost = this.#deps.getViewportHost();
|
|
252540
252741
|
const pageGeometryHelper = this.#deps.getPageGeometryHelper();
|
|
252541
|
-
const rawHit =
|
|
252542
|
-
|
|
252543
|
-
|
|
252544
|
-
|
|
252742
|
+
const rawHit = resolvePointerPositionHit({
|
|
252743
|
+
layout: layoutState.layout,
|
|
252744
|
+
blocks: layoutState.blocks,
|
|
252745
|
+
measures: layoutState.measures,
|
|
252746
|
+
containerPoint: {
|
|
252747
|
+
x: normalized.x,
|
|
252748
|
+
y: normalized.y
|
|
252749
|
+
},
|
|
252750
|
+
domContainer: viewportHost,
|
|
252751
|
+
clientX,
|
|
252752
|
+
clientY,
|
|
252753
|
+
geometryHelper: pageGeometryHelper ?? undefined
|
|
252754
|
+
});
|
|
252545
252755
|
if (!rawHit)
|
|
252546
252756
|
return;
|
|
252547
252757
|
if (isFootnoteBlockId(rawHit.blockId))
|
|
@@ -254882,9 +255092,9 @@ var Node$13 = class Node$14 {
|
|
|
254882
255092
|
return;
|
|
254883
255093
|
console.log(...args$1);
|
|
254884
255094
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
254885
|
-
var
|
|
255095
|
+
var init_src_0P3ZlqDX_es = __esm(() => {
|
|
254886
255096
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
254887
|
-
|
|
255097
|
+
init_SuperConverter_B9oNf3OB_es();
|
|
254888
255098
|
init_jszip_ChlR43oI_es();
|
|
254889
255099
|
init_uuid_qzgm05fK_es();
|
|
254890
255100
|
init_constants_CIF8yzNk_es();
|
|
@@ -264885,6 +265095,63 @@ ${err.toString()}`);
|
|
|
264885
265095
|
return [createChartImmutabilityPlugin()];
|
|
264886
265096
|
}
|
|
264887
265097
|
});
|
|
265098
|
+
MathInline = Node$13.create({
|
|
265099
|
+
name: "mathInline",
|
|
265100
|
+
group: "inline",
|
|
265101
|
+
inline: true,
|
|
265102
|
+
atom: true,
|
|
265103
|
+
marks: "",
|
|
265104
|
+
draggable: false,
|
|
265105
|
+
selectable: true,
|
|
265106
|
+
parseDOM() {
|
|
265107
|
+
return [{ tag: "sd-math-inline" }];
|
|
265108
|
+
},
|
|
265109
|
+
renderDOM() {
|
|
265110
|
+
return ["sd-math-inline", { style: "display: inline;" }];
|
|
265111
|
+
},
|
|
265112
|
+
addAttributes() {
|
|
265113
|
+
return {
|
|
265114
|
+
originalXml: {
|
|
265115
|
+
default: null,
|
|
265116
|
+
rendered: false
|
|
265117
|
+
},
|
|
265118
|
+
textContent: {
|
|
265119
|
+
default: "",
|
|
265120
|
+
rendered: false
|
|
265121
|
+
}
|
|
265122
|
+
};
|
|
265123
|
+
}
|
|
265124
|
+
});
|
|
265125
|
+
MathBlock = Node$13.create({
|
|
265126
|
+
name: "mathBlock",
|
|
265127
|
+
group: "block",
|
|
265128
|
+
atom: true,
|
|
265129
|
+
draggable: false,
|
|
265130
|
+
selectable: true,
|
|
265131
|
+
defining: true,
|
|
265132
|
+
parseDOM() {
|
|
265133
|
+
return [{ tag: "sd-math-block" }];
|
|
265134
|
+
},
|
|
265135
|
+
renderDOM() {
|
|
265136
|
+
return ["sd-math-block", { style: "display: block; text-align: center;" }];
|
|
265137
|
+
},
|
|
265138
|
+
addAttributes() {
|
|
265139
|
+
return {
|
|
265140
|
+
originalXml: {
|
|
265141
|
+
default: null,
|
|
265142
|
+
rendered: false
|
|
265143
|
+
},
|
|
265144
|
+
textContent: {
|
|
265145
|
+
default: "",
|
|
265146
|
+
rendered: false
|
|
265147
|
+
},
|
|
265148
|
+
justification: {
|
|
265149
|
+
default: "centerGroup",
|
|
265150
|
+
rendered: false
|
|
265151
|
+
}
|
|
265152
|
+
};
|
|
265153
|
+
}
|
|
265154
|
+
});
|
|
264888
265155
|
PassthroughBlock = Node$13.create({
|
|
264889
265156
|
name: "passthroughBlock",
|
|
264890
265157
|
group: "block",
|
|
@@ -273162,6 +273429,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273162
273429
|
"indexEntry",
|
|
273163
273430
|
"tab",
|
|
273164
273431
|
"footnoteReference",
|
|
273432
|
+
"mathInline",
|
|
273165
273433
|
"passthroughInline",
|
|
273166
273434
|
"bookmarkEnd",
|
|
273167
273435
|
"fieldAnnotation",
|
|
@@ -273213,6 +273481,100 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273213
273481
|
]);
|
|
273214
273482
|
SDT_BLOCK_SELECTOR = `.${DOM_CLASS_NAMES.BLOCK_SDT}[data-sdt-id]`;
|
|
273215
273483
|
HOVER_CLASS = DOM_CLASS_NAMES.SDT_HOVER;
|
|
273484
|
+
OPERATOR_CHARS = new Set([
|
|
273485
|
+
"+",
|
|
273486
|
+
"-",
|
|
273487
|
+
"=",
|
|
273488
|
+
"<",
|
|
273489
|
+
">",
|
|
273490
|
+
"(",
|
|
273491
|
+
")",
|
|
273492
|
+
"[",
|
|
273493
|
+
"]",
|
|
273494
|
+
"{",
|
|
273495
|
+
"}",
|
|
273496
|
+
"|",
|
|
273497
|
+
"/",
|
|
273498
|
+
"\\",
|
|
273499
|
+
",",
|
|
273500
|
+
".",
|
|
273501
|
+
";",
|
|
273502
|
+
":",
|
|
273503
|
+
"!",
|
|
273504
|
+
"~",
|
|
273505
|
+
"^",
|
|
273506
|
+
"_",
|
|
273507
|
+
"±",
|
|
273508
|
+
"×",
|
|
273509
|
+
"÷",
|
|
273510
|
+
"←",
|
|
273511
|
+
"↑",
|
|
273512
|
+
"→",
|
|
273513
|
+
"↓",
|
|
273514
|
+
"↔",
|
|
273515
|
+
"∀",
|
|
273516
|
+
"∁",
|
|
273517
|
+
"∂",
|
|
273518
|
+
"∃",
|
|
273519
|
+
"∄",
|
|
273520
|
+
"∅",
|
|
273521
|
+
"∈",
|
|
273522
|
+
"∉",
|
|
273523
|
+
"∋",
|
|
273524
|
+
"∌",
|
|
273525
|
+
"∑",
|
|
273526
|
+
"∏",
|
|
273527
|
+
"√",
|
|
273528
|
+
"∞",
|
|
273529
|
+
"∧",
|
|
273530
|
+
"∨",
|
|
273531
|
+
"∩",
|
|
273532
|
+
"∪",
|
|
273533
|
+
"∫",
|
|
273534
|
+
"∬",
|
|
273535
|
+
"∭",
|
|
273536
|
+
"≠",
|
|
273537
|
+
"≡",
|
|
273538
|
+
"≤",
|
|
273539
|
+
"≥",
|
|
273540
|
+
"⊂",
|
|
273541
|
+
"⊃",
|
|
273542
|
+
"⊆",
|
|
273543
|
+
"⊇"
|
|
273544
|
+
]);
|
|
273545
|
+
MATH_OBJECT_REGISTRY = {
|
|
273546
|
+
"m:r": convertMathRun,
|
|
273547
|
+
"m:acc": null,
|
|
273548
|
+
"m:bar": null,
|
|
273549
|
+
"m:borderBox": null,
|
|
273550
|
+
"m:box": null,
|
|
273551
|
+
"m:d": null,
|
|
273552
|
+
"m:eqArr": null,
|
|
273553
|
+
"m:f": convertFraction,
|
|
273554
|
+
"m:func": null,
|
|
273555
|
+
"m:groupChr": null,
|
|
273556
|
+
"m:limLow": null,
|
|
273557
|
+
"m:limUpp": null,
|
|
273558
|
+
"m:m": null,
|
|
273559
|
+
"m:nary": null,
|
|
273560
|
+
"m:phant": null,
|
|
273561
|
+
"m:rad": null,
|
|
273562
|
+
"m:sPre": null,
|
|
273563
|
+
"m:sSub": null,
|
|
273564
|
+
"m:sSubSup": null,
|
|
273565
|
+
"m:sSup": null
|
|
273566
|
+
};
|
|
273567
|
+
ARGUMENT_ELEMENTS = new Set([
|
|
273568
|
+
"m:e",
|
|
273569
|
+
"m:num",
|
|
273570
|
+
"m:den",
|
|
273571
|
+
"m:sub",
|
|
273572
|
+
"m:sup",
|
|
273573
|
+
"m:deg",
|
|
273574
|
+
"m:lim",
|
|
273575
|
+
"m:fName",
|
|
273576
|
+
"m:oMath"
|
|
273577
|
+
]);
|
|
273216
273578
|
init_dist4();
|
|
273217
273579
|
COMMENT_HIGHLIGHT_EXTERNAL = cssToken("--sd-comments-highlight-external", "#B1124B40");
|
|
273218
273580
|
COMMENT_HIGHLIGHT_EXTERNAL_ACTIVE = cssToken("--sd-comments-highlight-external-active", "#B1124B66");
|
|
@@ -275382,7 +275744,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
275382
275744
|
});
|
|
275383
275745
|
}
|
|
275384
275746
|
extractLinkData(run2) {
|
|
275385
|
-
if (run2.kind === "tab" || run2.kind === "image" || run2.kind === "lineBreak")
|
|
275747
|
+
if (run2.kind === "tab" || run2.kind === "image" || run2.kind === "lineBreak" || run2.kind === "math")
|
|
275386
275748
|
return null;
|
|
275387
275749
|
const link2 = run2.link;
|
|
275388
275750
|
if (!link2)
|
|
@@ -275526,11 +275888,37 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
275526
275888
|
isFieldAnnotationRun(run2) {
|
|
275527
275889
|
return run2.kind === "fieldAnnotation";
|
|
275528
275890
|
}
|
|
275891
|
+
isMathRun(run2) {
|
|
275892
|
+
return run2.kind === "math";
|
|
275893
|
+
}
|
|
275894
|
+
renderMathRun(run2) {
|
|
275895
|
+
if (!this.doc)
|
|
275896
|
+
return null;
|
|
275897
|
+
const wrapper = this.doc.createElement("span");
|
|
275898
|
+
wrapper.className = "sd-math";
|
|
275899
|
+
wrapper.style.display = "inline-block";
|
|
275900
|
+
wrapper.style.verticalAlign = "middle";
|
|
275901
|
+
wrapper.style.width = `${run2.width}px`;
|
|
275902
|
+
wrapper.style.height = `${run2.height}px`;
|
|
275903
|
+
wrapper.dataset.layoutEpoch = String(this.layoutEpoch ?? 0);
|
|
275904
|
+
const mathEl = convertOmmlToMathml(run2.ommlJson, this.doc);
|
|
275905
|
+
if (mathEl)
|
|
275906
|
+
wrapper.appendChild(mathEl);
|
|
275907
|
+
else
|
|
275908
|
+
wrapper.textContent = run2.textContent || "";
|
|
275909
|
+
if (run2.pmStart != null)
|
|
275910
|
+
wrapper.dataset.pmStart = String(run2.pmStart);
|
|
275911
|
+
if (run2.pmEnd != null)
|
|
275912
|
+
wrapper.dataset.pmEnd = String(run2.pmEnd);
|
|
275913
|
+
return wrapper;
|
|
275914
|
+
}
|
|
275529
275915
|
renderRun(run2, context, trackedConfig) {
|
|
275530
275916
|
if (this.isImageRun(run2))
|
|
275531
275917
|
return this.renderImageRun(run2);
|
|
275532
275918
|
if (this.isFieldAnnotationRun(run2))
|
|
275533
275919
|
return this.renderFieldAnnotationRun(run2);
|
|
275920
|
+
if (this.isMathRun(run2))
|
|
275921
|
+
return this.renderMathRun(run2);
|
|
275534
275922
|
if (this.isLineBreakRun(run2))
|
|
275535
275923
|
return null;
|
|
275536
275924
|
if (this.isBreakRun(run2))
|
|
@@ -276282,6 +276670,22 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
276282
276670
|
}
|
|
276283
276671
|
continue;
|
|
276284
276672
|
}
|
|
276673
|
+
if (this.isMathRun(baseRun)) {
|
|
276674
|
+
const elem = this.renderRun(baseRun, context, trackedConfig);
|
|
276675
|
+
if (elem) {
|
|
276676
|
+
if (styleId)
|
|
276677
|
+
elem.setAttribute("styleid", styleId);
|
|
276678
|
+
const runSegments$1 = segmentsByRun.get(runIndex);
|
|
276679
|
+
const baseSegX = runSegments$1 && runSegments$1[0]?.x !== undefined ? runSegments$1[0].x : cumulativeX;
|
|
276680
|
+
const segX = baseSegX + indentOffset;
|
|
276681
|
+
const segWidth = (runSegments$1 && runSegments$1[0]?.width !== undefined ? runSegments$1[0].width : baseRun.width) ?? 0;
|
|
276682
|
+
elem.style.position = "absolute";
|
|
276683
|
+
elem.style.left = `${segX}px`;
|
|
276684
|
+
appendToLineGeo(elem, baseRun, segX, segWidth);
|
|
276685
|
+
cumulativeX = baseSegX + segWidth;
|
|
276686
|
+
}
|
|
276687
|
+
continue;
|
|
276688
|
+
}
|
|
276285
276689
|
const runSegments = segmentsByRun.get(runIndex);
|
|
276286
276690
|
if (!runSegments || runSegments.length === 0)
|
|
276287
276691
|
continue;
|
|
@@ -284269,7 +284673,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
284269
284673
|
inlineConverter: lineBreakNodeToRun,
|
|
284270
284674
|
blockConverter: lineBreakNodeToBreakBlock
|
|
284271
284675
|
},
|
|
284272
|
-
table: { blockConverter: tableNodeToBlock }
|
|
284676
|
+
table: { blockConverter: tableNodeToBlock },
|
|
284677
|
+
mathInline: { inlineConverter: mathInlineNodeToRun }
|
|
284273
284678
|
};
|
|
284274
284679
|
for (const type of TOKEN_INLINE_TYPES.keys())
|
|
284275
284680
|
INLINE_CONVERTERS_REGISTRY[type] = { inlineConverter: tokenNodeToRun };
|
|
@@ -284280,6 +284685,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
284280
284685
|
shapeTextbox: shapeTextboxNodeToDrawingBlock,
|
|
284281
284686
|
chart: chartNodeToDrawingBlock
|
|
284282
284687
|
};
|
|
284688
|
+
JUSTIFICATION_TO_ALIGN = {
|
|
284689
|
+
center: "center",
|
|
284690
|
+
centerGroup: "center",
|
|
284691
|
+
left: "left",
|
|
284692
|
+
right: "right"
|
|
284693
|
+
};
|
|
284283
284694
|
DEFAULT_SIZE2 = 10 / 0.75;
|
|
284284
284695
|
nodeHandlers2 = {
|
|
284285
284696
|
paragraph: handleParagraphNode2,
|
|
@@ -284296,7 +284707,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
284296
284707
|
shapeGroup: handleShapeGroupNode,
|
|
284297
284708
|
shapeContainer: handleShapeContainerNode,
|
|
284298
284709
|
shapeTextbox: handleShapeTextboxNode,
|
|
284299
|
-
chart: handleChartNode
|
|
284710
|
+
chart: handleChartNode,
|
|
284711
|
+
mathBlock: handleMathBlockNode
|
|
284300
284712
|
};
|
|
284301
284713
|
converters = {
|
|
284302
284714
|
contentBlockNodeToDrawingBlock,
|
|
@@ -285863,11 +286275,20 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
285863
286275
|
x: localX,
|
|
285864
286276
|
y: headerPageIndex * headerPageHeight + (localY - headerPageIndex * headerPageHeight)
|
|
285865
286277
|
};
|
|
285866
|
-
return
|
|
286278
|
+
return clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
|
|
285867
286279
|
}
|
|
285868
286280
|
if (!this.#layoutState.layout)
|
|
285869
286281
|
return null;
|
|
285870
|
-
const rawHit =
|
|
286282
|
+
const rawHit = resolvePointerPositionHit({
|
|
286283
|
+
layout: this.#layoutState.layout,
|
|
286284
|
+
blocks: this.#layoutState.blocks,
|
|
286285
|
+
measures: this.#layoutState.measures,
|
|
286286
|
+
containerPoint: normalized,
|
|
286287
|
+
domContainer: this.#viewportHost,
|
|
286288
|
+
clientX,
|
|
286289
|
+
clientY,
|
|
286290
|
+
geometryHelper: this.#pageGeometryHelper ?? undefined
|
|
286291
|
+
}) ?? null;
|
|
285871
286292
|
if (!rawHit)
|
|
285872
286293
|
return null;
|
|
285873
286294
|
const doc$12 = this.#editor.state?.doc;
|
|
@@ -288168,10 +288589,19 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
288168
288589
|
includeDragBuffer: false,
|
|
288169
288590
|
extraPages: dragLastRawHit ? [dragLastRawHit.pageIndex] : undefined
|
|
288170
288591
|
});
|
|
288171
|
-
const refined =
|
|
288172
|
-
|
|
288173
|
-
|
|
288174
|
-
|
|
288592
|
+
const refined = resolvePointerPositionHit({
|
|
288593
|
+
layout,
|
|
288594
|
+
blocks: this.#layoutState.blocks,
|
|
288595
|
+
measures: this.#layoutState.measures,
|
|
288596
|
+
containerPoint: {
|
|
288597
|
+
x: normalized.x,
|
|
288598
|
+
y: normalized.y
|
|
288599
|
+
},
|
|
288600
|
+
domContainer: this.#viewportHost,
|
|
288601
|
+
clientX: pointer.clientX,
|
|
288602
|
+
clientY: pointer.clientY,
|
|
288603
|
+
geometryHelper: this.#pageGeometryHelper ?? undefined
|
|
288604
|
+
});
|
|
288175
288605
|
if (!refined)
|
|
288176
288606
|
return;
|
|
288177
288607
|
if (this.#isSelectionAwareVirtualizationEnabled() && this.#getPageElement(refined.pageIndex) == null) {
|
|
@@ -288874,8 +289304,8 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
|
|
|
288874
289304
|
|
|
288875
289305
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
288876
289306
|
var init_super_editor_es = __esm(() => {
|
|
288877
|
-
|
|
288878
|
-
|
|
289307
|
+
init_src_0P3ZlqDX_es();
|
|
289308
|
+
init_SuperConverter_B9oNf3OB_es();
|
|
288879
289309
|
init_jszip_ChlR43oI_es();
|
|
288880
289310
|
init_xml_js_40FWvL78_es();
|
|
288881
289311
|
init_constants_CIF8yzNk_es();
|