ooxml-core 1.6.1 → 1.7.0
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/{PptxHandler-BTXB54UC.mjs → PptxHandler-BL4B7CZO.mjs} +2 -2
- package/dist/automation/index.cjs +482 -232
- package/dist/automation/index.mjs +482 -232
- package/dist/{chunk-CS7HRNHL.mjs → chunk-GAGSCAR3.mjs} +43 -43
- package/dist/{chunk-5CJRDY7Q.mjs → chunk-NIHPA63A.mjs} +1 -1
- package/dist/{chunk-Q5LESLDA.mjs → chunk-TTPZITQN.mjs} +841 -614
- package/dist/{chunk-4L4UB3RQ.mjs → chunk-Z7IQR4S4.mjs} +3 -3
- package/dist/{chunk-RIFVZP2S.mjs → chunk-ZAP5WLEN.mjs} +1 -1
- package/dist/crypto/index.cjs +281 -109
- package/dist/crypto/index.mjs +281 -109
- package/dist/docx/load/index.cjs +481 -254
- package/dist/docx/load/index.mjs +481 -254
- package/dist/geometry/index.cjs +25 -0
- package/dist/geometry/index.d.ts +1 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +24 -1
- package/dist/geometry/nudge.d.ts +12 -0
- package/dist/geometry/nudge.d.ts.map +1 -0
- package/dist/geometry/rotation-drag.d.ts +6 -0
- package/dist/geometry/rotation-drag.d.ts.map +1 -1
- package/dist/index.cjs +25 -0
- package/dist/index.mjs +25 -0
- package/dist/pptx/automation/index.cjs +1395 -1156
- package/dist/pptx/automation/index.d.ts +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-DkHgeV1p.d.ts → index-Cn-GzYGp.d.ts} +62 -13
- package/dist/pptx/chunks/{index-DkHgeV1p.d.ts.map → index-Cn-GzYGp.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +1274 -1090
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +7 -2
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/index.cjs +1415 -1176
- package/dist/pptx/index.d.ts +1 -1
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +7 -2
- package/dist/teams/index.mjs +7 -2
- package/dist/visio/edit-commands.d.ts +3 -1
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-layer-properties.d.ts +22 -0
- package/dist/visio/edit-layer-properties.d.ts.map +1 -0
- package/dist/visio/edit-text-instance.d.ts +21 -0
- package/dist/visio/edit-text-instance.d.ts.map +1 -0
- package/dist/visio/edit-text-ranges.d.ts.map +1 -1
- package/dist/visio/edit-text-scope.d.ts +6 -1
- package/dist/visio/edit-text-scope.d.ts.map +1 -1
- package/dist/visio/edit-text-target.d.ts +11 -1
- package/dist/visio/edit-text-target.d.ts.map +1 -1
- package/dist/visio/edit-text.d.ts +2 -1
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +1038 -538
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +1038 -538
- package/dist/visio/text-fields.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/edit-error.d.ts +4 -1
- package/dist/visio/ui/edit-error.d.ts.map +1 -1
- package/dist/visio/ui/guides.d.ts +5 -0
- package/dist/visio/ui/guides.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +19768 -1874
- package/dist/visio/ui/index.d.ts +1 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +19765 -1877
- package/dist/visio/ui/sample-drawing.d.ts +8 -0
- package/dist/visio/ui/sample-drawing.d.ts.map +1 -0
- package/dist/visio/ui/shape-move.d.ts +6 -0
- package/dist/visio/ui/shape-move.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +415 -188
- package/dist/xlsx/load/index.mjs +415 -188
- package/package.json +6 -5
package/dist/visio/index.cjs
CHANGED
|
@@ -445,8 +445,8 @@ function inspectNamespaces(root2, check) {
|
|
|
445
445
|
if (attr2.namespaceURI === xmlns && (attr2.name === "xmlns:xmlns" || attr2.value === xmlns || (attr2.name === "xmlns:xml" ? attr2.value !== xml : attr2.value === xml) || attr2.name !== "xmlns" && !attr2.value))
|
|
446
446
|
fail("INVALID_XML", "Invalid reserved XML namespace binding");
|
|
447
447
|
}
|
|
448
|
-
for (const
|
|
449
|
-
if (
|
|
448
|
+
for (const child3 of Array.from(element2.childNodes))
|
|
449
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
|
|
@@ -701,7 +701,7 @@ function metadataAttributes(node2) {
|
|
|
701
701
|
var VISIO_NS = "http://schemas.microsoft.com/office/visio/2012/main";
|
|
702
702
|
var VISIO_LEGACY_NS = "http://schemas.microsoft.com/office/visio/2011/1/core";
|
|
703
703
|
var children2 = (node2, name3) => node2 ? elements(node2).filter(
|
|
704
|
-
(
|
|
704
|
+
(child3) => child3.localName === name3 && (child3.namespaceURI === VISIO_NS || child3.namespaceURI === VISIO_LEGACY_NS)
|
|
705
705
|
) : [];
|
|
706
706
|
var child = (node2, name3) => children2(node2, name3)[0];
|
|
707
707
|
var attribute2 = (node2, name3) => node2?.getAttribute(name3) ?? void 0;
|
|
@@ -2269,7 +2269,7 @@ function setCell(shape, name3, value, formula) {
|
|
|
2269
2269
|
node2 = shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
|
|
2270
2270
|
node2.setAttribute("N", name3);
|
|
2271
2271
|
const before = Array.from(shape.childNodes).find(
|
|
2272
|
-
(
|
|
2272
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
2273
2273
|
);
|
|
2274
2274
|
shape.insertBefore(node2, before ?? null);
|
|
2275
2275
|
}
|
|
@@ -4107,7 +4107,7 @@ function assertUnlayeredShape(shape, document) {
|
|
|
4107
4107
|
}
|
|
4108
4108
|
|
|
4109
4109
|
// visio/edit-text-target.ts
|
|
4110
|
-
function
|
|
4110
|
+
function textTarget(root2, shapeId2, check) {
|
|
4111
4111
|
const shapeChildren = (parent) => {
|
|
4112
4112
|
const containers = children2(parent, "Shapes");
|
|
4113
4113
|
if (containers.length > 1)
|
|
@@ -4115,35 +4115,145 @@ function localTextTarget(root2, document, shapeId2, check) {
|
|
|
4115
4115
|
return children2(containers[0], "Shape");
|
|
4116
4116
|
};
|
|
4117
4117
|
const shapes = /* @__PURE__ */ new Map();
|
|
4118
|
-
const pending = shapeChildren(root2).map((node2) => ({
|
|
4118
|
+
const pending = shapeChildren(root2).map((node2) => ({
|
|
4119
|
+
node: node2,
|
|
4120
|
+
masterId: void 0,
|
|
4121
|
+
deleted: false
|
|
4122
|
+
}));
|
|
4119
4123
|
while (pending.length) {
|
|
4120
4124
|
check();
|
|
4121
4125
|
const item = pending.pop(), id3 = attribute2(item.node, "ID");
|
|
4122
4126
|
if (!id3 || shapes.has(id3))
|
|
4123
4127
|
fail("INVALID_SHAPE_ID", "Local shape IDs must be present and unique.");
|
|
4124
|
-
const
|
|
4128
|
+
const masterId = attribute2(item.node, "Master") ?? item.masterId;
|
|
4125
4129
|
const deleted = item.deleted || ["1", "true"].includes(attribute2(item.node, "Del") ?? "");
|
|
4126
|
-
shapes.set(id3, { node: item.node,
|
|
4127
|
-
for (const node2 of shapeChildren(item.node)) pending.push({ node: node2,
|
|
4130
|
+
shapes.set(id3, { node: item.node, masterId, deleted });
|
|
4131
|
+
for (const node2 of shapeChildren(item.node)) pending.push({ node: node2, masterId, deleted });
|
|
4128
4132
|
}
|
|
4129
4133
|
const target2 = shapes.get(shapeId2);
|
|
4130
4134
|
if (!target2) fail("EDIT_TARGET_NOT_FOUND", "Local shape does not exist.");
|
|
4131
|
-
if (target2.
|
|
4132
|
-
|
|
4135
|
+
if (target2.deleted) fail("UNSUPPORTED_TEXT_EDIT", "Deleted shapes cannot be edited.");
|
|
4136
|
+
const masterShapeId = attribute2(target2.node, "MasterShape");
|
|
4137
|
+
if (masterShapeId !== void 0 && target2.masterId === void 0)
|
|
4138
|
+
fail("UNSUPPORTED_TEXT_EDIT", "The shape refers to a master that is not on this page.");
|
|
4139
|
+
return {
|
|
4140
|
+
node: target2.node,
|
|
4141
|
+
...target2.masterId !== void 0 ? { masterId: target2.masterId } : {},
|
|
4142
|
+
...masterShapeId !== void 0 ? { masterShapeId } : {}
|
|
4143
|
+
};
|
|
4144
|
+
}
|
|
4145
|
+
function localTextTarget(root2, document, shapeId2, check) {
|
|
4146
|
+
const target2 = textTarget(root2, shapeId2, check);
|
|
4147
|
+
if (target2.masterId !== void 0)
|
|
4148
|
+
fail("UNSUPPORTED_TEXT_EDIT", "Text ranges and fields of stencil shapes cannot be edited.");
|
|
4133
4149
|
assertShapeLocks(target2.node, document, ["LockTextEdit"]);
|
|
4134
4150
|
return target2.node;
|
|
4135
4151
|
}
|
|
4136
4152
|
|
|
4153
|
+
// visio/edit-text-instance.ts
|
|
4154
|
+
var fieldSections = (shape) => children2(shape, "Section").filter((section2) => attribute2(section2, "N") === "Field");
|
|
4155
|
+
var isMarkup = (node2) => node2.nodeType !== 3 && node2.nodeType !== 4;
|
|
4156
|
+
var knownMarkup = (text3) => Array.from(text3.childNodes).every(
|
|
4157
|
+
(node2) => !isMarkup(node2) || ["cp", "pp", "tp", "fld"].includes(node2.localName)
|
|
4158
|
+
);
|
|
4159
|
+
function assertUnlocked(shape, template) {
|
|
4160
|
+
const local = children2(shape, "Cell").some((cell) => attribute2(cell, "N") === "LockTextEdit");
|
|
4161
|
+
for (const cell of children2(local ? shape : template, "Cell")) {
|
|
4162
|
+
if (attribute2(cell, "N") !== "LockTextEdit") continue;
|
|
4163
|
+
if (cell.hasAttribute("E") || cell.hasAttribute("F") || Number(attribute2(cell, "V")) !== 0)
|
|
4164
|
+
fail("EDIT_PROTECTED_CELL", "The shape is protected against text editing.");
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
function single(shape, what) {
|
|
4168
|
+
const texts = children2(shape, "Text");
|
|
4169
|
+
if (texts.length > 1) fail("UNSUPPORTED_TEXT_EDIT", `${what} has more than one Text element.`);
|
|
4170
|
+
return texts[0];
|
|
4171
|
+
}
|
|
4172
|
+
function insertBeforeTail(shape, node2, tail) {
|
|
4173
|
+
const after = Array.from(shape.childNodes).find(
|
|
4174
|
+
(child3) => child3.nodeType === 1 && tail.includes(child3.localName)
|
|
4175
|
+
);
|
|
4176
|
+
shape.insertBefore(node2, after ?? null);
|
|
4177
|
+
}
|
|
4178
|
+
var AFTER_TEXT = ["Data1", "Data2", "Data3", "ForeignData", "Shapes"];
|
|
4179
|
+
function replaceInstanceText(shape, template, text3) {
|
|
4180
|
+
const local = single(shape, "The shape");
|
|
4181
|
+
const inherited = single(template, "The master shape");
|
|
4182
|
+
if (local && Array.from(local.childNodes).some(isMarkup))
|
|
4183
|
+
fail(
|
|
4184
|
+
"UNSUPPORTED_TEXT_EDIT",
|
|
4185
|
+
"This stencil shape has its own formatted text; edit part of the text instead."
|
|
4186
|
+
);
|
|
4187
|
+
if (!local && inherited && !knownMarkup(inherited))
|
|
4188
|
+
fail("UNSUPPORTED_TEXT_EDIT", "The master text has markup this editor does not know.");
|
|
4189
|
+
if (fieldSections(shape).length)
|
|
4190
|
+
fail("UNSUPPORTED_TEXT_EDIT", "This stencil shape has its own text fields; edit around them.");
|
|
4191
|
+
assertUnlocked(shape, template);
|
|
4192
|
+
const fields = local ? [] : fieldSections(template).flatMap((section2) => children2(section2, "Row"));
|
|
4193
|
+
const current = local ?? inherited;
|
|
4194
|
+
if (!fields.length && current && !Array.from(current.childNodes).some(isMarkup)) {
|
|
4195
|
+
if (decodeVisioPlainText(current.textContent ?? "") === text3) return false;
|
|
4196
|
+
}
|
|
4197
|
+
const document = shape.ownerDocument;
|
|
4198
|
+
if (fields.length) {
|
|
4199
|
+
const section2 = document.createElementNS(shape.namespaceURI, "Section");
|
|
4200
|
+
section2.setAttribute("N", "Field");
|
|
4201
|
+
for (const row2 of fields) {
|
|
4202
|
+
const index = attribute2(row2, "IX");
|
|
4203
|
+
if (index === void 0)
|
|
4204
|
+
fail("UNSUPPORTED_TEXT_EDIT", "The master text fields cannot be identified.");
|
|
4205
|
+
const removed = document.createElementNS(shape.namespaceURI, "Row");
|
|
4206
|
+
removed.setAttribute("IX", index);
|
|
4207
|
+
removed.setAttribute("Del", "1");
|
|
4208
|
+
section2.appendChild(removed);
|
|
4209
|
+
}
|
|
4210
|
+
insertBeforeTail(shape, section2, ["Text", ...AFTER_TEXT]);
|
|
4211
|
+
}
|
|
4212
|
+
let node2 = local;
|
|
4213
|
+
if (!node2) {
|
|
4214
|
+
node2 = document.createElementNS(shape.namespaceURI, "Text");
|
|
4215
|
+
insertBeforeTail(shape, node2, AFTER_TEXT);
|
|
4216
|
+
}
|
|
4217
|
+
while (node2.firstChild) node2.removeChild(node2.firstChild);
|
|
4218
|
+
node2.appendChild(document.createTextNode(encodeVisioPlainText(text3)));
|
|
4219
|
+
return true;
|
|
4220
|
+
}
|
|
4221
|
+
function instanceTextNode(shape, template) {
|
|
4222
|
+
const local = single(shape, "The shape");
|
|
4223
|
+
assertUnlocked(shape, template);
|
|
4224
|
+
if (local) return { text: local, discard: () => {
|
|
4225
|
+
} };
|
|
4226
|
+
const inherited = single(template, "The master shape");
|
|
4227
|
+
if (!inherited) fail("UNSUPPORTED_TEXT_RANGE", "The stencil shape has no text to edit.");
|
|
4228
|
+
if (!knownMarkup(inherited))
|
|
4229
|
+
fail("UNSUPPORTED_TEXT_RANGE", "The master text has markup this editor does not know.");
|
|
4230
|
+
if (fieldSections(shape).length)
|
|
4231
|
+
fail("UNSUPPORTED_TEXT_RANGE", "This stencil shape overrides its master text fields.");
|
|
4232
|
+
const text3 = shape.ownerDocument.importNode(inherited, true);
|
|
4233
|
+
insertBeforeTail(shape, text3, AFTER_TEXT);
|
|
4234
|
+
return { text: text3, discard: () => void shape.removeChild(text3) };
|
|
4235
|
+
}
|
|
4236
|
+
|
|
4137
4237
|
// visio/edit-text.ts
|
|
4138
|
-
|
|
4238
|
+
var plain = (node2) => Array.from(node2.childNodes).every((item) => item.nodeType === 3 || item.nodeType === 4);
|
|
4239
|
+
var hasFields = (shape) => children2(shape, "Section").some((section2) => attribute2(section2, "N") === "Field");
|
|
4240
|
+
async function replacePlainText(root2, document, shapeId2, text3, check, assertDependencies2, masterTemplate2) {
|
|
4241
|
+
const found = textTarget(root2, shapeId2, check);
|
|
4242
|
+
if (found.masterId !== void 0) {
|
|
4243
|
+
if (!masterTemplate2)
|
|
4244
|
+
fail("UNSUPPORTED_TEXT_EDIT", "Stencil shapes cannot be edited without their masters.");
|
|
4245
|
+
const template = await masterTemplate2(found.masterId, found.masterShapeId);
|
|
4246
|
+
check();
|
|
4247
|
+
return replaceInstanceText(found.node, template, text3);
|
|
4248
|
+
}
|
|
4139
4249
|
const target2 = localTextTarget(root2, document, shapeId2, check);
|
|
4140
4250
|
const texts = children2(target2, "Text");
|
|
4141
4251
|
if (texts.length !== 1)
|
|
4142
4252
|
fail("UNSUPPORTED_TEXT_EDIT", "Editing requires one existing local Text element.");
|
|
4143
4253
|
const node2 = texts[0];
|
|
4144
|
-
if (
|
|
4254
|
+
if (!plain(node2))
|
|
4145
4255
|
fail("UNSUPPORTED_TEXT_EDIT", "Rich text, fields and unknown text markup cannot be edited.");
|
|
4146
|
-
if (
|
|
4256
|
+
if (hasFields(target2))
|
|
4147
4257
|
fail(
|
|
4148
4258
|
"UNSUPPORTED_TEXT_EDIT",
|
|
4149
4259
|
"Replacing all text would remove its text fields; edit the text around the fields instead."
|
|
@@ -4168,7 +4278,7 @@ function serializeEditedXml(root2, limits, check) {
|
|
|
4168
4278
|
if (/[\t\r\n]/.test(attr2.value))
|
|
4169
4279
|
fail("UNSUPPORTED_XML_EDIT", "Attribute whitespace cannot be preserved by this writer.");
|
|
4170
4280
|
}
|
|
4171
|
-
for (const
|
|
4281
|
+
for (const child3 of Array.from(node2.childNodes)) pending.push(child3);
|
|
4172
4282
|
}
|
|
4173
4283
|
let xml = buildXml(root2.ownerDocument);
|
|
4174
4284
|
xml = xml.replace(
|
|
@@ -5897,7 +6007,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5897
6007
|
const p = target2.paint;
|
|
5898
6008
|
characters += p.fill.length + p.stroke.length + p.fillRule.length + p.strokeLinecap.length + p.strokeLinejoin.length;
|
|
5899
6009
|
}
|
|
5900
|
-
} else for (const
|
|
6010
|
+
} else for (const child3 of target2.items) strings(child3);
|
|
5901
6011
|
if (characters > limits.maxCharacters) limit("Retained vector character limit exceeded.");
|
|
5902
6012
|
}
|
|
5903
6013
|
for (const clip of scene.clips) strings(clip);
|
|
@@ -5943,7 +6053,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5943
6053
|
finite2(extent2 * (Math.abs(matrix3[0]) + Math.abs(matrix3[2])), limits.maxCoordinate);
|
|
5944
6054
|
finite2(extent2 * (Math.abs(matrix3[1]) + Math.abs(matrix3[3])), limits.maxCoordinate);
|
|
5945
6055
|
}
|
|
5946
|
-
} else for (const
|
|
6056
|
+
} else for (const child3 of target2.items) content2(child3, matrix3, depth + 1);
|
|
5947
6057
|
if (target2.clipIndex !== void 0) content2(scene.clips[target2.clipIndex], matrix3, depth + 1);
|
|
5948
6058
|
}
|
|
5949
6059
|
for (const clip of scene.clips) content2(clip, IDENTITY, 1);
|
|
@@ -6074,7 +6184,7 @@ function validate(value, limits) {
|
|
|
6074
6184
|
kind: "group",
|
|
6075
6185
|
...base(node2),
|
|
6076
6186
|
items: Object.freeze(
|
|
6077
|
-
array(node2.items, limits.maxNodes - nodes).map((
|
|
6187
|
+
array(node2.items, limits.maxNodes - nodes).map((child3) => item(child3, depth + 1))
|
|
6078
6188
|
)
|
|
6079
6189
|
});
|
|
6080
6190
|
}
|
|
@@ -6082,11 +6192,11 @@ function validate(value, limits) {
|
|
|
6082
6192
|
const node2 = own(input, ["matrix", "clipIndex", "items"], depth);
|
|
6083
6193
|
const items2 = [];
|
|
6084
6194
|
for (const value2 of array(node2.items, limits.maxNodes - nodes)) {
|
|
6085
|
-
const
|
|
6086
|
-
if (
|
|
6195
|
+
const child3 = own(value2, ["matrix", "clipIndex", "commands", "clipRule"], depth + 1);
|
|
6196
|
+
if (child3.clipRule !== "nonzero" && child3.clipRule !== "evenodd")
|
|
6087
6197
|
unsafe("Invalid normalized clip rule.");
|
|
6088
6198
|
items2.push(
|
|
6089
|
-
Object.freeze({ ...base(
|
|
6199
|
+
Object.freeze({ ...base(child3), commands: path(child3.commands), clipRule: child3.clipRule })
|
|
6090
6200
|
);
|
|
6091
6201
|
}
|
|
6092
6202
|
return Object.freeze({ ...base(node2), items: Object.freeze(items2) });
|
|
@@ -6212,7 +6322,7 @@ function sanitize(root2, limits) {
|
|
|
6212
6322
|
paint: paint(data2.attrs)
|
|
6213
6323
|
}) : Object.assign(target2, {
|
|
6214
6324
|
kind: "group",
|
|
6215
|
-
items: Object.freeze(children5(data2.children).map((
|
|
6325
|
+
items: Object.freeze(children5(data2.children).map((child3) => item(child3, depth + 1)))
|
|
6216
6326
|
});
|
|
6217
6327
|
freezeLater.push(result);
|
|
6218
6328
|
return result;
|
|
@@ -6229,8 +6339,8 @@ function sanitize(root2, limits) {
|
|
|
6229
6339
|
ids.set(id3, clips.length);
|
|
6230
6340
|
const target2 = base(data2.attrs);
|
|
6231
6341
|
const paths = [];
|
|
6232
|
-
for (const
|
|
6233
|
-
const part = node2(
|
|
6342
|
+
for (const child3 of children5(data2.children)) {
|
|
6343
|
+
const part = node2(child3, depth + 1, true);
|
|
6234
6344
|
if (part.tag !== "path") unsafe("Clip content must be a path.");
|
|
6235
6345
|
const path = Object.assign(base(part.attrs), {
|
|
6236
6346
|
commands: leaf(part),
|
|
@@ -6254,12 +6364,12 @@ function sanitize(root2, limits) {
|
|
|
6254
6364
|
if (viewBox[0] !== 0 || viewBox[1] !== 0 || viewBox[2] !== width || viewBox[3] !== height)
|
|
6255
6365
|
unsafe("Viewport differs from dimensions.");
|
|
6256
6366
|
const items = [];
|
|
6257
|
-
for (const
|
|
6258
|
-
const peek = record(
|
|
6367
|
+
for (const child3 of children5(data.children)) {
|
|
6368
|
+
const peek = record(child3, ["tag", "attrs", "children"]);
|
|
6259
6369
|
if (peek.tag === "defs") {
|
|
6260
|
-
const defs = node2(
|
|
6370
|
+
const defs = node2(child3, 1);
|
|
6261
6371
|
for (const value of children5(defs.children)) definition(value, 2);
|
|
6262
|
-
} else items.push(item(
|
|
6372
|
+
} else items.push(item(child3, 1));
|
|
6263
6373
|
}
|
|
6264
6374
|
for (const { target: target2, id: id3 } of pending) {
|
|
6265
6375
|
const index = ids.get(id3);
|
|
@@ -7085,9 +7195,9 @@ function parseDrawingColor(element2) {
|
|
|
7085
7195
|
const color2 = {
|
|
7086
7196
|
kind,
|
|
7087
7197
|
value: colorValue(kind, element2),
|
|
7088
|
-
transforms: elements(element2).map((
|
|
7089
|
-
name:
|
|
7090
|
-
value:
|
|
7198
|
+
transforms: elements(element2).map((child3) => ({
|
|
7199
|
+
name: child3.localName,
|
|
7200
|
+
value: child3.getAttribute("val") ?? ""
|
|
7091
7201
|
}))
|
|
7092
7202
|
};
|
|
7093
7203
|
const fallback = kind === "system" ? element2.getAttribute("lastClr") : null;
|
|
@@ -7268,7 +7378,7 @@ function drawingThemeXml(theme2, parts) {
|
|
|
7268
7378
|
const color2 = theme2.colorScheme.colors[slot];
|
|
7269
7379
|
if (!color2) throw new Error(`The theme colour scheme has no ${slot} colour.`);
|
|
7270
7380
|
const node2 = doc.createElementNS(NS.a, `a:${slot}`);
|
|
7271
|
-
for (const
|
|
7381
|
+
for (const child3 of fragment(node2, drawingColorXml(color2), namespaces)) node2.appendChild(child3);
|
|
7272
7382
|
scheme.appendChild(node2);
|
|
7273
7383
|
}
|
|
7274
7384
|
extensionList(scheme, parts.colorSchemeExtensions, namespaces);
|
|
@@ -7752,7 +7862,7 @@ function legacyFillGradient(cells4, width, height, resolve) {
|
|
|
7752
7862
|
};
|
|
7753
7863
|
}
|
|
7754
7864
|
|
|
7755
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
7865
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
|
|
7756
7866
|
var CRC_TABLE = (() => {
|
|
7757
7867
|
const table2 = new Uint32Array(256);
|
|
7758
7868
|
for (let n = 0; n < 256; n++) {
|
|
@@ -8473,31 +8583,32 @@ var DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "S
|
|
|
8473
8583
|
var pad = (value, length = 2) => String(value).padStart(length, "0");
|
|
8474
8584
|
function formatDate(date2, picture) {
|
|
8475
8585
|
const hours = date2.getUTCHours();
|
|
8476
|
-
const tokens2 =
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8586
|
+
const tokens2 = new Map(
|
|
8587
|
+
Object.entries({
|
|
8588
|
+
yyyy: () => pad(date2.getUTCFullYear(), 4),
|
|
8589
|
+
yy: () => pad(date2.getUTCFullYear() % 100),
|
|
8590
|
+
MMMM: () => MONTHS[date2.getUTCMonth()],
|
|
8591
|
+
MMM: () => MONTHS[date2.getUTCMonth()].slice(0, 3),
|
|
8592
|
+
MM: () => pad(date2.getUTCMonth() + 1),
|
|
8593
|
+
M: () => String(date2.getUTCMonth() + 1),
|
|
8594
|
+
dddd: () => DAYS[date2.getUTCDay()],
|
|
8595
|
+
ddd: () => DAYS[date2.getUTCDay()].slice(0, 3),
|
|
8596
|
+
dd: () => pad(date2.getUTCDate()),
|
|
8597
|
+
d: () => String(date2.getUTCDate()),
|
|
8598
|
+
HH: () => pad(hours),
|
|
8599
|
+
H: () => String(hours),
|
|
8600
|
+
hh: () => pad(hours % 12 || 12),
|
|
8601
|
+
h: () => String(hours % 12 || 12),
|
|
8602
|
+
mm: () => pad(date2.getUTCMinutes()),
|
|
8603
|
+
ss: () => pad(date2.getUTCSeconds()),
|
|
8604
|
+
tt: () => hours < 12 ? "AM" : "PM"
|
|
8605
|
+
})
|
|
8606
|
+
);
|
|
8495
8607
|
return picture.replace(
|
|
8496
8608
|
/yyyy|yy|MMMM|MMM|MM|M|dddd|ddd|dd|d|HH|H|hh|h|mm|ss|tt|"[^"]*"/g,
|
|
8497
8609
|
(token) => {
|
|
8498
8610
|
if (token.startsWith('"')) return token.slice(1, -1);
|
|
8499
|
-
|
|
8500
|
-
return typeof format === "function" ? format() : token;
|
|
8611
|
+
return tokens2.get(token)?.() ?? token;
|
|
8501
8612
|
}
|
|
8502
8613
|
);
|
|
8503
8614
|
}
|
|
@@ -10525,7 +10636,7 @@ function cloneInherited(shape, parentId, context) {
|
|
|
10525
10636
|
return {
|
|
10526
10637
|
...shape,
|
|
10527
10638
|
id: id3,
|
|
10528
|
-
children: shape.children.map((
|
|
10639
|
+
children: shape.children.map((child3) => cloneInherited(child3, id3, context))
|
|
10529
10640
|
};
|
|
10530
10641
|
}
|
|
10531
10642
|
function normalizeShapes(raw, context, depth = 0, masterStack = []) {
|
|
@@ -10908,7 +11019,7 @@ function scan(xml) {
|
|
|
10908
11019
|
}
|
|
10909
11020
|
const children5 = [];
|
|
10910
11021
|
let depth = 0;
|
|
10911
|
-
let
|
|
11022
|
+
let child3;
|
|
10912
11023
|
i = openEnd;
|
|
10913
11024
|
for (; ; ) {
|
|
10914
11025
|
const lt = xml.indexOf("<", i);
|
|
@@ -10926,13 +11037,13 @@ function scan(xml) {
|
|
|
10926
11037
|
return { root: root2, children: children5 };
|
|
10927
11038
|
}
|
|
10928
11039
|
depth--;
|
|
10929
|
-
if (depth === 0 &&
|
|
10930
|
-
children5.push({ ...
|
|
11040
|
+
if (depth === 0 && child3)
|
|
11041
|
+
children5.push({ ...child3, closeStart: lt, end, selfClosing: false });
|
|
10931
11042
|
} else if (xml[end - 2] === "/") {
|
|
10932
11043
|
if (depth === 0)
|
|
10933
11044
|
children5.push({ start: lt, openEnd: end, closeStart: end, end, selfClosing: true });
|
|
10934
11045
|
} else {
|
|
10935
|
-
if (depth === 0)
|
|
11046
|
+
if (depth === 0) child3 = { start: lt, openEnd: end };
|
|
10936
11047
|
depth++;
|
|
10937
11048
|
}
|
|
10938
11049
|
}
|
|
@@ -11595,7 +11706,7 @@ function getVisioPageLayers(document, pageId2) {
|
|
|
11595
11706
|
return result.reverse();
|
|
11596
11707
|
}
|
|
11597
11708
|
|
|
11598
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11709
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
|
|
11599
11710
|
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
11600
11711
|
var ENDOFCHAIN = 4294967294;
|
|
11601
11712
|
var FREESECT = 4294967295;
|
|
@@ -11603,7 +11714,9 @@ var FATSECT = 4294967293;
|
|
|
11603
11714
|
var DIFSECT = 4294967292;
|
|
11604
11715
|
var MAXREGSECT = 4294967290;
|
|
11605
11716
|
var ENTRY_TYPE_EMPTY = 0;
|
|
11717
|
+
var ENTRY_TYPE_STORAGE = 1;
|
|
11606
11718
|
var ENTRY_TYPE_STREAM = 2;
|
|
11719
|
+
var NOSTREAM = 4294967295;
|
|
11607
11720
|
var ENTRY_TYPE_ROOT = 5;
|
|
11608
11721
|
var DIR_ENTRY_SIZE = 128;
|
|
11609
11722
|
var Ole2ParseError = class extends Error {
|
|
@@ -11613,10 +11726,174 @@ var Ole2ParseError = class extends Error {
|
|
|
11613
11726
|
}
|
|
11614
11727
|
};
|
|
11615
11728
|
|
|
11616
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
const
|
|
11729
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
|
|
11730
|
+
var FILETIME_UNIX_EPOCH = 116444736000000000n;
|
|
11731
|
+
function readFileTime(view2, offset) {
|
|
11732
|
+
const ticks = view2.getBigUint64(offset, true);
|
|
11733
|
+
if (ticks === 0n)
|
|
11734
|
+
return void 0;
|
|
11735
|
+
const ms = Number((ticks - FILETIME_UNIX_EPOCH) / 10000n);
|
|
11736
|
+
const date2 = new Date(ms);
|
|
11737
|
+
return Number.isNaN(date2.getTime()) ? void 0 : date2;
|
|
11738
|
+
}
|
|
11739
|
+
function decodeSlot(dir, id3, majorVersion, warnings) {
|
|
11740
|
+
const view2 = new DataView(dir.buffer, dir.byteOffset + id3 * DIR_ENTRY_SIZE, DIR_ENTRY_SIZE);
|
|
11741
|
+
const nameLen = view2.getUint16(64, true);
|
|
11742
|
+
const type = view2.getUint8(66);
|
|
11743
|
+
const nameValid = nameLen >= 2 && nameLen <= 64 && nameLen % 2 === 0 && view2.getUint16(nameLen - 2, true) === 0;
|
|
11744
|
+
let name3 = "";
|
|
11745
|
+
if (nameValid)
|
|
11746
|
+
for (let j = 0; j < nameLen - 2; j += 2)
|
|
11747
|
+
name3 += String.fromCharCode(view2.getUint16(j, true));
|
|
11748
|
+
const link = (offset) => {
|
|
11749
|
+
const value = view2.getUint32(offset, true);
|
|
11750
|
+
return value === NOSTREAM ? -1 : value;
|
|
11751
|
+
};
|
|
11752
|
+
const sizeLow = view2.getUint32(120, true);
|
|
11753
|
+
const sizeHigh = view2.getUint32(124, true);
|
|
11754
|
+
let size3 = sizeLow;
|
|
11755
|
+
if (majorVersion === 4)
|
|
11756
|
+
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11757
|
+
else if (sizeHigh !== 0 && type !== ENTRY_TYPE_EMPTY) {
|
|
11758
|
+
warnings.push({ code: "size-high-bits", message: `Ignored v3 stream-size high bits on directory entry ${id3}` });
|
|
11759
|
+
}
|
|
11760
|
+
return {
|
|
11761
|
+
id: id3,
|
|
11762
|
+
type,
|
|
11763
|
+
nameValid,
|
|
11764
|
+
entry: {
|
|
11765
|
+
id: id3,
|
|
11766
|
+
name: name3,
|
|
11767
|
+
type,
|
|
11768
|
+
color: view2.getUint8(67),
|
|
11769
|
+
leftSiblingId: link(68),
|
|
11770
|
+
rightSiblingId: link(72),
|
|
11771
|
+
childId: link(76),
|
|
11772
|
+
clsid: new Uint8Array(view2.buffer.slice(view2.byteOffset + 80, view2.byteOffset + 96)),
|
|
11773
|
+
stateBits: view2.getUint32(96, true),
|
|
11774
|
+
created: readFileTime(view2, 100),
|
|
11775
|
+
modified: readFileTime(view2, 108),
|
|
11776
|
+
startSector: view2.getUint32(116, true),
|
|
11777
|
+
size: size3,
|
|
11778
|
+
parentId: -1
|
|
11779
|
+
}
|
|
11780
|
+
};
|
|
11781
|
+
}
|
|
11782
|
+
function readDirectory(dir, majorVersion, strict, warnings) {
|
|
11783
|
+
const count = Math.floor(dir.length / DIR_ENTRY_SIZE);
|
|
11784
|
+
const slots = [];
|
|
11785
|
+
for (let id3 = 0; id3 < count; id3++)
|
|
11786
|
+
slots.push(decodeSlot(dir, id3, majorVersion, warnings));
|
|
11787
|
+
const roots = slots.filter((slot) => slot.type === ENTRY_TYPE_ROOT);
|
|
11788
|
+
if (roots.length !== 1 || !roots[0].nameValid)
|
|
11789
|
+
throw new Ole2ParseError("Invalid root directory entry");
|
|
11790
|
+
const root2 = roots[0];
|
|
11791
|
+
root2.entry.path = [];
|
|
11792
|
+
const reached = /* @__PURE__ */ new Set([root2.id]);
|
|
11793
|
+
const fail3 = (message) => {
|
|
11794
|
+
if (strict)
|
|
11795
|
+
throw new Ole2ParseError(message);
|
|
11796
|
+
warnings.push({ code: "directory-link", message });
|
|
11797
|
+
};
|
|
11798
|
+
const pending = [];
|
|
11799
|
+
const push = (id3, parent, from) => {
|
|
11800
|
+
if (id3 === -1)
|
|
11801
|
+
return;
|
|
11802
|
+
const target2 = slots[id3];
|
|
11803
|
+
if (!target2 || target2.type === ENTRY_TYPE_EMPTY || target2.type === ENTRY_TYPE_ROOT) {
|
|
11804
|
+
fail3(`Directory entry ${from} links to invalid entry ${id3}`);
|
|
11805
|
+
return;
|
|
11806
|
+
}
|
|
11807
|
+
if (reached.has(id3)) {
|
|
11808
|
+
fail3(`Cyclic directory tree at entry ${id3}`);
|
|
11809
|
+
return;
|
|
11810
|
+
}
|
|
11811
|
+
reached.add(id3);
|
|
11812
|
+
pending.push({ id: id3, parent });
|
|
11813
|
+
};
|
|
11814
|
+
push(root2.entry.childId, root2, root2.id);
|
|
11815
|
+
while (pending.length) {
|
|
11816
|
+
const { id: id3, parent } = pending.pop();
|
|
11817
|
+
const slot = slots[id3];
|
|
11818
|
+
if (!slot.nameValid)
|
|
11819
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11820
|
+
slot.entry.parentId = parent.id;
|
|
11821
|
+
slot.entry.path = [...parent.entry.path, slot.entry.name];
|
|
11822
|
+
push(slot.entry.leftSiblingId, parent, id3);
|
|
11823
|
+
push(slot.entry.rightSiblingId, parent, id3);
|
|
11824
|
+
if (slot.type === ENTRY_TYPE_STORAGE)
|
|
11825
|
+
push(slot.entry.childId, slot, id3);
|
|
11826
|
+
}
|
|
11827
|
+
const entries = [];
|
|
11828
|
+
for (const slot of slots) {
|
|
11829
|
+
if (slot.type === ENTRY_TYPE_EMPTY)
|
|
11830
|
+
continue;
|
|
11831
|
+
if (!reached.has(slot.id)) {
|
|
11832
|
+
if (!slot.nameValid) {
|
|
11833
|
+
if (strict)
|
|
11834
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11835
|
+
warnings.push({ code: "invalid-unreachable-entry", message: `Skipped undecodable stale directory entry ${slot.id}` });
|
|
11836
|
+
continue;
|
|
11837
|
+
}
|
|
11838
|
+
if (strict)
|
|
11839
|
+
throw new Ole2ParseError(`Directory entry ${slot.id} is not reachable from the root`);
|
|
11840
|
+
warnings.push({ code: "unreachable-entry", message: `Directory entry ${slot.id} (${slot.entry.name}) is not reachable from the root` });
|
|
11841
|
+
}
|
|
11842
|
+
entries.push(slot.entry);
|
|
11843
|
+
}
|
|
11844
|
+
return entries;
|
|
11845
|
+
}
|
|
11846
|
+
function sameName(a, b) {
|
|
11847
|
+
return a.length === b.length && a.toUpperCase() === b.toUpperCase();
|
|
11848
|
+
}
|
|
11849
|
+
function bareName(name3) {
|
|
11850
|
+
return name3.replace(/^[\u0001-\u0006]/, "");
|
|
11851
|
+
}
|
|
11852
|
+
function normalizePath(path, rootName) {
|
|
11853
|
+
const parts = typeof path === "string" ? path.split("/").filter((part) => part !== "") : [...path];
|
|
11854
|
+
if (parts.length && sameName(parts[0], rootName) && typeof path === "string")
|
|
11855
|
+
parts.shift();
|
|
11856
|
+
return parts;
|
|
11857
|
+
}
|
|
11858
|
+
function child2(entries, parentId, name3) {
|
|
11859
|
+
const children5 = entries.filter((entry) => entry.parentId === parentId && entry.path !== void 0);
|
|
11860
|
+
const pick = (matches) => matches.length === 1 ? matches[0] : void 0;
|
|
11861
|
+
const exact = children5.filter((entry) => entry.name === name3);
|
|
11862
|
+
if (exact.length)
|
|
11863
|
+
return pick(exact);
|
|
11864
|
+
const folded = children5.filter((entry) => sameName(entry.name, name3));
|
|
11865
|
+
if (folded.length)
|
|
11866
|
+
return pick(folded);
|
|
11867
|
+
return pick(children5.filter((entry) => sameName(bareName(entry.name), bareName(name3))));
|
|
11868
|
+
}
|
|
11869
|
+
function findDirectoryEntry(entries, path) {
|
|
11870
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11871
|
+
if (!root2)
|
|
11872
|
+
return void 0;
|
|
11873
|
+
let current = root2;
|
|
11874
|
+
for (const name3 of normalizePath(path, root2.name)) {
|
|
11875
|
+
if (current.type !== ENTRY_TYPE_ROOT && current.type !== ENTRY_TYPE_STORAGE)
|
|
11876
|
+
return void 0;
|
|
11877
|
+
current = child2(entries, current.id, name3);
|
|
11878
|
+
if (!current)
|
|
11879
|
+
return void 0;
|
|
11880
|
+
}
|
|
11881
|
+
return current;
|
|
11882
|
+
}
|
|
11883
|
+
function findStreamByName(entries, name3, isReadable) {
|
|
11884
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11885
|
+
if (root2 && root2.name === name3)
|
|
11886
|
+
return root2;
|
|
11887
|
+
const top = entries.filter((entry) => entry.parentId === root2?.id && isReadable(entry));
|
|
11888
|
+
return top.find((entry) => entry.name === name3) ?? top.find((entry) => sameName(entry.name, name3)) ?? entries.find((entry) => entry.name === name3 && isReadable(entry));
|
|
11889
|
+
}
|
|
11890
|
+
|
|
11891
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
11892
|
+
function parseOle2(buffer, options = {}) {
|
|
11893
|
+
const strict = options.strict === true;
|
|
11894
|
+
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
11895
|
+
const view2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
11896
|
+
const warnings = [];
|
|
11620
11897
|
if (data.length < 512) {
|
|
11621
11898
|
throw new Ole2ParseError("Truncated OLE2 compound file header");
|
|
11622
11899
|
}
|
|
@@ -11625,11 +11902,12 @@ function parseOle2(buffer) {
|
|
|
11625
11902
|
throw new Ole2ParseError("Not a valid OLE2 compound file");
|
|
11626
11903
|
}
|
|
11627
11904
|
}
|
|
11628
|
-
view2.getUint16(24, true);
|
|
11629
11905
|
const majorVersion = view2.getUint16(26, true);
|
|
11630
11906
|
const byteOrder = view2.getUint16(28, true);
|
|
11631
11907
|
if (byteOrder !== 65534) {
|
|
11632
|
-
|
|
11908
|
+
if (strict)
|
|
11909
|
+
throw new Ole2ParseError("Invalid byte order mark");
|
|
11910
|
+
warnings.push({ code: "byte-order", message: `Ignored byte order mark 0x${byteOrder.toString(16)}` });
|
|
11633
11911
|
}
|
|
11634
11912
|
const sectorSizePower = view2.getUint16(30, true);
|
|
11635
11913
|
const miniSectorSizePower = view2.getUint16(32, true);
|
|
@@ -11638,10 +11916,14 @@ function parseOle2(buffer) {
|
|
|
11638
11916
|
}
|
|
11639
11917
|
const sectorSize = 1 << sectorSizePower;
|
|
11640
11918
|
const miniSectorSize = 1 << miniSectorSizePower;
|
|
11641
|
-
if (data.length < sectorSize
|
|
11919
|
+
if (data.length < sectorSize)
|
|
11642
11920
|
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11921
|
+
if (data.length % sectorSize !== 0) {
|
|
11922
|
+
if (strict)
|
|
11923
|
+
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11924
|
+
warnings.push({ code: "unaligned-length", message: `File length ${data.length} is not a multiple of ${sectorSize}` });
|
|
11643
11925
|
}
|
|
11644
|
-
const sectorCount = data.length / sectorSize - 1;
|
|
11926
|
+
const sectorCount = Math.ceil(data.length / sectorSize) - 1;
|
|
11645
11927
|
const totalFATSectors = view2.getUint32(44, true);
|
|
11646
11928
|
const firstDirectorySector = view2.getUint32(48, true);
|
|
11647
11929
|
const miniStreamCutoff = view2.getUint32(56, true);
|
|
@@ -11662,6 +11944,13 @@ function parseOle2(buffer) {
|
|
|
11662
11944
|
}
|
|
11663
11945
|
return data.subarray(offset, offset + sectorSize);
|
|
11664
11946
|
}
|
|
11947
|
+
function copySector(sector, target2, at2, want) {
|
|
11948
|
+
const offset = sectorOffset(sector);
|
|
11949
|
+
if (sector >= sectorCount || offset + want > data.length) {
|
|
11950
|
+
throw new Ole2ParseError(`Sector ${sector} at offset ${offset} exceeds file size ${data.length}`);
|
|
11951
|
+
}
|
|
11952
|
+
target2.set(data.subarray(offset, offset + want), at2);
|
|
11953
|
+
}
|
|
11665
11954
|
const fatSectors = [];
|
|
11666
11955
|
for (let i = 0; i < 109 && fatSectors.length < totalFATSectors; i++) {
|
|
11667
11956
|
const sector = view2.getUint32(76 + i * 4, true);
|
|
@@ -11697,29 +11986,36 @@ function parseOle2(buffer) {
|
|
|
11697
11986
|
fatEntries.push(fatView.getUint32(i * 4, true));
|
|
11698
11987
|
}
|
|
11699
11988
|
}
|
|
11700
|
-
function
|
|
11701
|
-
const
|
|
11702
|
-
let current = startSector;
|
|
11989
|
+
function followChain(table2, start, label, needed) {
|
|
11990
|
+
const ids = [];
|
|
11703
11991
|
const visited = /* @__PURE__ */ new Set();
|
|
11992
|
+
let current = start;
|
|
11704
11993
|
while (current <= MAXREGSECT) {
|
|
11994
|
+
if (!strict && needed !== void 0 && ids.length >= needed)
|
|
11995
|
+
return ids;
|
|
11705
11996
|
if (visited.has(current)) {
|
|
11706
|
-
throw new Ole2ParseError(`Circular reference in
|
|
11997
|
+
throw new Ole2ParseError(`Circular reference in ${label} chain at sector ${current}`);
|
|
11707
11998
|
}
|
|
11708
11999
|
visited.add(current);
|
|
11709
|
-
|
|
11710
|
-
if (
|
|
11711
|
-
throw new Ole2ParseError(
|
|
11712
|
-
current =
|
|
11713
|
-
}
|
|
11714
|
-
if (current !== ENDOFCHAIN)
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
for (const sector of sectors) {
|
|
11720
|
-
result.set(sector, offset);
|
|
11721
|
-
offset += sectorSize;
|
|
12000
|
+
ids.push(current);
|
|
12001
|
+
if (table2[current] === void 0)
|
|
12002
|
+
throw new Ole2ParseError(`Missing ${label} chain entry`);
|
|
12003
|
+
current = table2[current];
|
|
12004
|
+
}
|
|
12005
|
+
if (current !== ENDOFCHAIN) {
|
|
12006
|
+
if (strict || needed === void 0 || ids.length < needed) {
|
|
12007
|
+
throw new Ole2ParseError(`Invalid ${label} chain terminator`);
|
|
12008
|
+
}
|
|
12009
|
+
warnings.push({ code: "chain-terminator", message: `Accepted ${label} chain ending in 0x${current.toString(16)}` });
|
|
11722
12010
|
}
|
|
12011
|
+
return ids;
|
|
12012
|
+
}
|
|
12013
|
+
function readMetadataChain(startSector, label) {
|
|
12014
|
+
if (startSector > MAXREGSECT)
|
|
12015
|
+
return new Uint8Array(0);
|
|
12016
|
+
const ids = followChain(fatEntries, startSector, label === "directory" ? "FAT" : label);
|
|
12017
|
+
const result = new Uint8Array(ids.length * sectorSize);
|
|
12018
|
+
ids.forEach((id3, i) => result.set(readSector(id3), i * sectorSize));
|
|
11723
12019
|
return result;
|
|
11724
12020
|
}
|
|
11725
12021
|
function readStream(startSector, size3) {
|
|
@@ -11727,68 +12023,44 @@ function parseOle2(buffer) {
|
|
|
11727
12023
|
return new Uint8Array(0);
|
|
11728
12024
|
if (size3 > sectorCount * sectorSize)
|
|
11729
12025
|
throw new Ole2ParseError("Stream size exceeds file size");
|
|
11730
|
-
const
|
|
11731
|
-
|
|
12026
|
+
const needed = Math.ceil(size3 / sectorSize);
|
|
12027
|
+
const ids = followChain(fatEntries, startSector, "FAT", needed);
|
|
12028
|
+
if (ids.length < needed)
|
|
11732
12029
|
throw new Ole2ParseError("Truncated stream sector chain");
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
|
|
11737
|
-
const entries = [];
|
|
11738
|
-
for (let i = 0; i < numEntries; i++) {
|
|
11739
|
-
const entryOffset = i * DIR_ENTRY_SIZE;
|
|
11740
|
-
const entryView = new DataView(dirRaw.buffer, dirRaw.byteOffset + entryOffset, DIR_ENTRY_SIZE);
|
|
11741
|
-
const nameLen = entryView.getUint16(64, true);
|
|
11742
|
-
const objectType = entryView.getUint8(66);
|
|
11743
|
-
if (objectType === ENTRY_TYPE_EMPTY) {
|
|
11744
|
-
continue;
|
|
12030
|
+
const result = new Uint8Array(size3);
|
|
12031
|
+
for (let i = 0; i < needed; i++) {
|
|
12032
|
+
copySector(ids[i], result, i * sectorSize, Math.min(sectorSize, size3 - i * sectorSize));
|
|
11745
12033
|
}
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
const leftSiblingId = entryView.getUint32(68, true);
|
|
11755
|
-
const rightSiblingId = entryView.getUint32(72, true);
|
|
11756
|
-
const childId = entryView.getUint32(76, true);
|
|
11757
|
-
const clsid = new Uint8Array(entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96));
|
|
11758
|
-
const startSector = entryView.getUint32(116, true);
|
|
11759
|
-
const sizeLow = entryView.getUint32(120, true);
|
|
11760
|
-
let size3 = sizeLow;
|
|
11761
|
-
if (majorVersion === 4) {
|
|
11762
|
-
const sizeHigh = entryView.getUint32(124, true);
|
|
11763
|
-
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11764
|
-
if (!Number.isSafeInteger(size3) || size3 > sectorCount * sectorSize) {
|
|
11765
|
-
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11766
|
-
}
|
|
12034
|
+
return result;
|
|
12035
|
+
}
|
|
12036
|
+
if (firstDirectorySector > MAXREGSECT)
|
|
12037
|
+
throw new Ole2ParseError("Missing directory chain");
|
|
12038
|
+
const entries = readDirectory(readMetadataChain(firstDirectorySector, "directory"), majorVersion, strict, warnings);
|
|
12039
|
+
for (const entry of entries) {
|
|
12040
|
+
if (majorVersion === 4 && (!Number.isSafeInteger(entry.size) || entry.size > sectorCount * sectorSize)) {
|
|
12041
|
+
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11767
12042
|
}
|
|
11768
|
-
entries.push({
|
|
11769
|
-
name: name3,
|
|
11770
|
-
type: objectType,
|
|
11771
|
-
startSector,
|
|
11772
|
-
size: size3,
|
|
11773
|
-
childId: childId === 4294967295 ? -1 : childId,
|
|
11774
|
-
leftSiblingId: leftSiblingId === 4294967295 ? -1 : leftSiblingId,
|
|
11775
|
-
rightSiblingId: rightSiblingId === 4294967295 ? -1 : rightSiblingId,
|
|
11776
|
-
clsid
|
|
11777
|
-
});
|
|
11778
12043
|
}
|
|
11779
12044
|
const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
|
|
11780
|
-
if (!rootEntry || entries.filter((e) => e.type === ENTRY_TYPE_ROOT).length !== 1) {
|
|
11781
|
-
throw new Ole2ParseError("Invalid root directory entry");
|
|
11782
|
-
}
|
|
11783
12045
|
let miniStreamData;
|
|
11784
|
-
if (rootEntry
|
|
12046
|
+
if (rootEntry.startSector <= MAXREGSECT) {
|
|
11785
12047
|
miniStreamData = readStream(rootEntry.startSector, rootEntry.size);
|
|
11786
12048
|
}
|
|
11787
12049
|
const miniFatEntries = [];
|
|
11788
|
-
if (firstMiniFATSector
|
|
11789
|
-
|
|
11790
|
-
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
12050
|
+
if (firstMiniFATSector > MAXREGSECT && totalMiniFATSectors > 0) {
|
|
12051
|
+
if (strict)
|
|
11791
12052
|
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
12053
|
+
warnings.push({ code: "mini-fat-count", message: `Header lists ${totalMiniFATSectors} mini FAT sectors but no chain` });
|
|
12054
|
+
}
|
|
12055
|
+
if (firstMiniFATSector <= MAXREGSECT && (totalMiniFATSectors > 0 || !strict)) {
|
|
12056
|
+
const miniFatRaw = readMetadataChain(firstMiniFATSector, "mini FAT");
|
|
12057
|
+
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
12058
|
+
if (strict)
|
|
12059
|
+
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
12060
|
+
warnings.push({
|
|
12061
|
+
code: "mini-fat-count",
|
|
12062
|
+
message: `Header lists ${totalMiniFATSectors} mini FAT sectors; chain has ${miniFatRaw.length / sectorSize}`
|
|
12063
|
+
});
|
|
11792
12064
|
}
|
|
11793
12065
|
const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
|
|
11794
12066
|
const miniCapacity = Math.floor((miniStreamData?.length ?? 0) / miniSectorSize);
|
|
@@ -11802,48 +12074,67 @@ function parseOle2(buffer) {
|
|
|
11802
12074
|
if (!miniStreamData) {
|
|
11803
12075
|
throw new Ole2ParseError("Mini stream container not found");
|
|
11804
12076
|
}
|
|
11805
|
-
const
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
12077
|
+
const needed = Math.ceil(size3 / miniSectorSize);
|
|
12078
|
+
const capacity = miniStreamData.length / miniSectorSize;
|
|
12079
|
+
let ids;
|
|
12080
|
+
try {
|
|
12081
|
+
ids = followChain(miniFatEntries, startSector, "mini FAT", needed);
|
|
12082
|
+
} catch (error) {
|
|
12083
|
+
if (error instanceof Ole2ParseError && /Missing mini FAT/.test(error.message)) {
|
|
12084
|
+
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11811
12085
|
}
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
12086
|
+
throw error;
|
|
12087
|
+
}
|
|
12088
|
+
const result = new Uint8Array(size3);
|
|
12089
|
+
for (let i = 0; i < ids.length && i < needed; i++) {
|
|
12090
|
+
const id3 = ids[i];
|
|
12091
|
+
if (id3 >= capacity || (id3 + 1) * miniSectorSize > miniStreamData.length) {
|
|
11815
12092
|
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11816
12093
|
}
|
|
11817
|
-
|
|
11818
|
-
|
|
12094
|
+
const want = Math.min(miniSectorSize, size3 - i * miniSectorSize);
|
|
12095
|
+
result.set(miniStreamData.subarray(id3 * miniSectorSize, id3 * miniSectorSize + want), i * miniSectorSize);
|
|
11819
12096
|
}
|
|
11820
|
-
if (
|
|
11821
|
-
throw new Ole2ParseError("Invalid mini FAT chain terminator");
|
|
11822
|
-
const totalLength = sectors.length * miniSectorSize;
|
|
11823
|
-
if (totalLength < size3)
|
|
12097
|
+
if (ids.length < needed)
|
|
11824
12098
|
throw new Ole2ParseError("Truncated mini stream sector chain");
|
|
11825
|
-
|
|
11826
|
-
let offset = 0;
|
|
11827
|
-
for (const sector of sectors) {
|
|
11828
|
-
result.set(sector, offset);
|
|
11829
|
-
offset += miniSectorSize;
|
|
11830
|
-
}
|
|
11831
|
-
return result.subarray(0, size3);
|
|
12099
|
+
return result;
|
|
11832
12100
|
}
|
|
11833
|
-
function
|
|
11834
|
-
const entry = entries.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name3);
|
|
11835
|
-
if (!entry) {
|
|
11836
|
-
return void 0;
|
|
11837
|
-
}
|
|
12101
|
+
function readEntry(entry) {
|
|
11838
12102
|
if (entry.size < miniStreamCutoff && entry.type !== ENTRY_TYPE_ROOT) {
|
|
11839
12103
|
return readMiniStream(entry.startSector, entry.size);
|
|
11840
12104
|
}
|
|
11841
12105
|
return readStream(entry.startSector, entry.size);
|
|
11842
12106
|
}
|
|
11843
|
-
|
|
12107
|
+
const readable = (entry) => entry.type === ENTRY_TYPE_STREAM || entry.type === ENTRY_TYPE_ROOT;
|
|
12108
|
+
return {
|
|
12109
|
+
entries,
|
|
12110
|
+
warnings,
|
|
12111
|
+
getStream(name3) {
|
|
12112
|
+
const entry = findStreamByName(entries, name3, readable);
|
|
12113
|
+
return entry ? readEntry(entry) : void 0;
|
|
12114
|
+
},
|
|
12115
|
+
getStreamByPath(path) {
|
|
12116
|
+
const entry = findDirectoryEntry(entries, path);
|
|
12117
|
+
return entry && entry.type === ENTRY_TYPE_STREAM ? readEntry(entry) : void 0;
|
|
12118
|
+
},
|
|
12119
|
+
getStreamById(id3) {
|
|
12120
|
+
const entry = entries.find((candidate) => candidate.id === id3);
|
|
12121
|
+
return entry && readable(entry) ? readEntry(entry) : void 0;
|
|
12122
|
+
},
|
|
12123
|
+
findEntry(path) {
|
|
12124
|
+
return findDirectoryEntry(entries, path);
|
|
12125
|
+
}
|
|
12126
|
+
};
|
|
11844
12127
|
}
|
|
11845
12128
|
|
|
11846
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12129
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document-base.js
|
|
12130
|
+
var copyOf = (bytes) => bytes === void 0 ? void 0 : new Uint8Array(bytes);
|
|
12131
|
+
var detachEntry = (entry) => ({
|
|
12132
|
+
...entry,
|
|
12133
|
+
clsid: new Uint8Array(entry.clsid),
|
|
12134
|
+
path: entry.path && [...entry.path],
|
|
12135
|
+
created: entry.created && new Date(entry.created),
|
|
12136
|
+
modified: entry.modified && new Date(entry.modified)
|
|
12137
|
+
});
|
|
11847
12138
|
var Ole2DocumentError = class extends Error {
|
|
11848
12139
|
code;
|
|
11849
12140
|
constructor(code, message) {
|
|
@@ -11876,16 +12167,31 @@ var Ole2DocumentBase = class {
|
|
|
11876
12167
|
return this.#revision;
|
|
11877
12168
|
}
|
|
11878
12169
|
get entries() {
|
|
11879
|
-
return this.#container.entries.map(
|
|
12170
|
+
return this.#container.entries.map(detachEntry);
|
|
12171
|
+
}
|
|
12172
|
+
get warnings() {
|
|
12173
|
+
return this.#container.warnings.map((warning) => ({ ...warning }));
|
|
11880
12174
|
}
|
|
11881
|
-
#getStream = (name3) =>
|
|
11882
|
-
|
|
11883
|
-
|
|
12175
|
+
#getStream = (name3) => copyOf(this.#container.getStream(name3));
|
|
12176
|
+
#getStreamByPath = (path) => copyOf(this.#container.getStreamByPath(path));
|
|
12177
|
+
#getStreamById = (id3) => copyOf(this.#container.getStreamById(id3));
|
|
12178
|
+
#findEntry = (path) => {
|
|
12179
|
+
const entry = this.#container.findEntry(path);
|
|
12180
|
+
return entry && detachEntry(entry);
|
|
11884
12181
|
};
|
|
11885
12182
|
/** Retain the original detachable callback API while observing current state. */
|
|
11886
12183
|
get getStream() {
|
|
11887
12184
|
return this.#getStream;
|
|
11888
12185
|
}
|
|
12186
|
+
get getStreamByPath() {
|
|
12187
|
+
return this.#getStreamByPath;
|
|
12188
|
+
}
|
|
12189
|
+
get getStreamById() {
|
|
12190
|
+
return this.#getStreamById;
|
|
12191
|
+
}
|
|
12192
|
+
get findEntry() {
|
|
12193
|
+
return this.#findEntry;
|
|
12194
|
+
}
|
|
11889
12195
|
/** Isolated working input: codecs cannot accidentally mutate current state. */
|
|
11890
12196
|
getBytes() {
|
|
11891
12197
|
return new Uint8Array(this.#bytes);
|
|
@@ -11908,7 +12214,7 @@ var Ole2DocumentBase = class {
|
|
|
11908
12214
|
}
|
|
11909
12215
|
};
|
|
11910
12216
|
|
|
11911
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12217
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
|
|
11912
12218
|
var END = 4294967294;
|
|
11913
12219
|
var MAX = 4294967290;
|
|
11914
12220
|
var NIL = 4294967295;
|
|
@@ -11943,6 +12249,58 @@ function chainToEnd(table2, start, max) {
|
|
|
11943
12249
|
}
|
|
11944
12250
|
return out;
|
|
11945
12251
|
}
|
|
12252
|
+
function chainPrefix(table2, start, needed) {
|
|
12253
|
+
const out = [], seen = /* @__PURE__ */ new Set();
|
|
12254
|
+
let id3 = start;
|
|
12255
|
+
while (out.length < needed) {
|
|
12256
|
+
if (id3 > MAX || id3 >= table2.length || seen.has(id3))
|
|
12257
|
+
throw new Error("Invalid CFB chain");
|
|
12258
|
+
seen.add(id3);
|
|
12259
|
+
out.push(id3);
|
|
12260
|
+
id3 = table2[id3];
|
|
12261
|
+
}
|
|
12262
|
+
return out;
|
|
12263
|
+
}
|
|
12264
|
+
function readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32) {
|
|
12265
|
+
const size3 = target2.size;
|
|
12266
|
+
if (size3 === 0)
|
|
12267
|
+
return new Uint8Array(0);
|
|
12268
|
+
const out = new Uint8Array(size3);
|
|
12269
|
+
const copyPhysical = (at2, want, into) => {
|
|
12270
|
+
if (at2 + want > input.length)
|
|
12271
|
+
throw new Error("Stream data exceeds file size");
|
|
12272
|
+
out.set(input.subarray(at2, at2 + want), into);
|
|
12273
|
+
};
|
|
12274
|
+
if (size3 >= read32(56)) {
|
|
12275
|
+
if (size3 > sectorCount * sectorSize)
|
|
12276
|
+
throw new Error("Stream size exceeds file size");
|
|
12277
|
+
chainPrefix(fat, target2.start, Math.ceil(size3 / sectorSize)).forEach((id3, i) => {
|
|
12278
|
+
if (id3 >= sectorCount)
|
|
12279
|
+
throw new Error("Invalid sector");
|
|
12280
|
+
copyPhysical((id3 + 1) * sectorSize, Math.min(sectorSize, size3 - i * sectorSize), i * sectorSize);
|
|
12281
|
+
});
|
|
12282
|
+
return out;
|
|
12283
|
+
}
|
|
12284
|
+
const miniFatSectors = chainToEnd(fat, read32(60), sectorCount);
|
|
12285
|
+
const miniCapacity = Math.floor(Math.min(root2.size, sectorCount * sectorSize) / miniSize);
|
|
12286
|
+
const miniFat = [];
|
|
12287
|
+
for (const id3 of miniFatSectors) {
|
|
12288
|
+
const bytes = sector(id3), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
12289
|
+
for (let j = 0; j < sectorSize / 4 && miniFat.length < miniCapacity; j++)
|
|
12290
|
+
miniFat.push(dv.getUint32(j * 4, true));
|
|
12291
|
+
}
|
|
12292
|
+
const rootSectors = chainPrefix(fat, root2.start, Math.ceil(root2.size / sectorSize));
|
|
12293
|
+
chainPrefix(miniFat, target2.start, Math.ceil(size3 / miniSize)).forEach((id3, i) => {
|
|
12294
|
+
const start = id3 * miniSize, want = Math.min(miniSize, size3 - i * miniSize);
|
|
12295
|
+
if (start + want > root2.size)
|
|
12296
|
+
throw new Error("Mini stream out of bounds");
|
|
12297
|
+
const rootSector = rootSectors[Math.floor(start / sectorSize)];
|
|
12298
|
+
if (rootSector >= sectorCount)
|
|
12299
|
+
throw new Error("Invalid sector");
|
|
12300
|
+
copyPhysical((rootSector + 1) * sectorSize + start % sectorSize, want, i * miniSize);
|
|
12301
|
+
});
|
|
12302
|
+
return out;
|
|
12303
|
+
}
|
|
11946
12304
|
function processCompoundFileStream(input, path, replacement) {
|
|
11947
12305
|
const reject2 = () => replacement ? input : void 0;
|
|
11948
12306
|
try {
|
|
@@ -11950,18 +12308,19 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
11950
12308
|
return reject2();
|
|
11951
12309
|
const view2 = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
11952
12310
|
const read32 = (offset2) => view2.getUint32(offset2, true);
|
|
11953
|
-
if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 ||
|
|
12311
|
+
if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 || // Readers tolerate a non-canonical byte-order mark; edits do not.
|
|
12312
|
+
replacement && view2.getUint16(28, true) !== 65534)
|
|
11954
12313
|
return reject2();
|
|
11955
12314
|
const major = view2.getUint16(26, true), shift = view2.getUint16(30, true), miniShift = view2.getUint16(32, true);
|
|
11956
12315
|
if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
11957
12316
|
return reject2();
|
|
11958
12317
|
const sectorSize = 1 << shift, miniSize = 1 << miniShift;
|
|
11959
|
-
if (input.length % sectorSize !== 0)
|
|
12318
|
+
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
11960
12319
|
return reject2();
|
|
11961
|
-
const sectorCount = input.length / sectorSize - 1;
|
|
12320
|
+
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|
|
11962
12321
|
const offset = (id3) => (id3 + 1) * sectorSize;
|
|
11963
12322
|
const sector = (id3) => {
|
|
11964
|
-
if (id3 > MAX || id3 >= sectorCount)
|
|
12323
|
+
if (id3 > MAX || id3 >= sectorCount || offset(id3) + sectorSize > input.length)
|
|
11965
12324
|
throw new Error("Invalid sector");
|
|
11966
12325
|
return input.subarray(offset(id3), offset(id3) + sectorSize);
|
|
11967
12326
|
};
|
|
@@ -12011,7 +12370,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12011
12370
|
for (let i = 0; i < nameLength - 2; i += 2)
|
|
12012
12371
|
name3 += String.fromCharCode(dvDir.getUint16(p + i, true));
|
|
12013
12372
|
const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
|
|
12014
|
-
if (sizeHigh !== 0)
|
|
12373
|
+
if (sizeHigh !== 0 && (replacement || major === 4))
|
|
12015
12374
|
return reject2();
|
|
12016
12375
|
entries.push({
|
|
12017
12376
|
id: id3,
|
|
@@ -12058,6 +12417,8 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12058
12417
|
}
|
|
12059
12418
|
if (!target2)
|
|
12060
12419
|
return reject2();
|
|
12420
|
+
if (!replacement)
|
|
12421
|
+
return readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32);
|
|
12061
12422
|
const names = entries.map((e) => e.name.toLowerCase());
|
|
12062
12423
|
if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
|
|
12063
12424
|
return reject2();
|
|
@@ -12181,7 +12542,7 @@ function replaceCompoundFileStream(input, path, replacement) {
|
|
|
12181
12542
|
return processCompoundFileStream(input, path, replacement) ?? input;
|
|
12182
12543
|
}
|
|
12183
12544
|
|
|
12184
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12545
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
|
|
12185
12546
|
var END2 = 4294967294;
|
|
12186
12547
|
var FREE = 4294967295;
|
|
12187
12548
|
var FAT = 4294967293;
|
|
@@ -12369,7 +12730,7 @@ function resizeCompoundFileStreamV4(input, path, replacement) {
|
|
|
12369
12730
|
}
|
|
12370
12731
|
}
|
|
12371
12732
|
|
|
12372
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12733
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
12373
12734
|
function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
|
|
12374
12735
|
const sectorCount = input.length / sectorSize - 1;
|
|
12375
12736
|
const entriesPerFat = sectorSize / 4;
|
|
@@ -12416,7 +12777,7 @@ function followCompoundAllocation(table2, start) {
|
|
|
12416
12777
|
return ids;
|
|
12417
12778
|
}
|
|
12418
12779
|
|
|
12419
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12780
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
|
|
12420
12781
|
var END3 = 4294967294;
|
|
12421
12782
|
var FREE2 = 4294967295;
|
|
12422
12783
|
var SECTOR = 512;
|
|
@@ -12488,7 +12849,7 @@ function resizeMiniCompoundStream(input, fat, fatIds, root2, target2, replacemen
|
|
|
12488
12849
|
return output.bytes;
|
|
12489
12850
|
}
|
|
12490
12851
|
|
|
12491
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12852
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
|
|
12492
12853
|
var END4 = 4294967294;
|
|
12493
12854
|
var FREE3 = 4294967295;
|
|
12494
12855
|
var FAT2 = 4294967293;
|
|
@@ -12653,7 +13014,7 @@ function resizeCompoundFileStream(input, path, replacement) {
|
|
|
12653
13014
|
}
|
|
12654
13015
|
}
|
|
12655
13016
|
|
|
12656
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13017
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
|
|
12657
13018
|
var FC_LCB_INDEX = {
|
|
12658
13019
|
plcfbteChpx: 12,
|
|
12659
13020
|
plcfbtePapx: 13,
|
|
@@ -12749,7 +13110,7 @@ function patchDocFib(wordDoc, fib, patch) {
|
|
|
12749
13110
|
view2.setUint32(papxOff + 4, patch.plcfbtePapx.lcb, true);
|
|
12750
13111
|
}
|
|
12751
13112
|
|
|
12752
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13113
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
|
|
12753
13114
|
var DocCfbRewriteError = class extends Error {
|
|
12754
13115
|
constructor(message) {
|
|
12755
13116
|
super(message);
|
|
@@ -12804,7 +13165,7 @@ function unwrapDocBytes(bytes) {
|
|
|
12804
13165
|
}
|
|
12805
13166
|
}
|
|
12806
13167
|
|
|
12807
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13168
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
|
|
12808
13169
|
var PAGE_SIZE = 512;
|
|
12809
13170
|
function parseBteTable(tableStream, at2) {
|
|
12810
13171
|
const view2 = new DataView(tableStream.buffer, tableStream.byteOffset, tableStream.byteLength);
|
|
@@ -12945,7 +13306,7 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
|
|
|
12945
13306
|
return page;
|
|
12946
13307
|
}
|
|
12947
13308
|
|
|
12948
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13309
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
|
|
12949
13310
|
var CP1252_HIGH_BLOCK = [
|
|
12950
13311
|
8364,
|
|
12951
13312
|
129,
|
|
@@ -13013,7 +13374,7 @@ function encodeCp1252(text3) {
|
|
|
13013
13374
|
return Uint8Array.from(bytes);
|
|
13014
13375
|
}
|
|
13015
13376
|
|
|
13016
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13377
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
|
|
13017
13378
|
var CLXT_PRC = 1;
|
|
13018
13379
|
var CLXT_PCDT = 2;
|
|
13019
13380
|
var DocResourceLimitError = class extends Error {
|
|
@@ -13225,7 +13586,7 @@ function buildClxBytes(pieces, prcBytes = new Uint8Array()) {
|
|
|
13225
13586
|
return result;
|
|
13226
13587
|
}
|
|
13227
13588
|
|
|
13228
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13589
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
|
|
13229
13590
|
var UnsupportedDocFieldEditError = class extends Error {
|
|
13230
13591
|
constructor(message) {
|
|
13231
13592
|
super(message);
|
|
@@ -13309,7 +13670,7 @@ function shiftDocMainFieldCps(table2, at2, body, editStart, editEnd, delta, maxF
|
|
|
13309
13670
|
return result;
|
|
13310
13671
|
}
|
|
13311
13672
|
|
|
13312
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13673
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
|
|
13313
13674
|
var RISKY_PLCF_INDICES = [2, 3, 4, 5, 17, 18, 19, 20, 40, 41, 42, 43, 46, 47, 48, 54, 55, 56, 57, 58, 59, 75, 76, 89, 90];
|
|
13314
13675
|
var RISKY_STTB_INDICES = [21, 22, 23];
|
|
13315
13676
|
var SAFE_EXTENDED_FC_LCB_INDICES = /* @__PURE__ */ new Set([93, 94, 113, 181, 182]);
|
|
@@ -13578,7 +13939,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text3, limits) {
|
|
|
13578
13939
|
}
|
|
13579
13940
|
}
|
|
13580
13941
|
|
|
13581
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13942
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-runs.js
|
|
13582
13943
|
var LIMIT = 65536;
|
|
13583
13944
|
var SAFE_OPERANDS = /* @__PURE__ */ new Set([
|
|
13584
13945
|
2101,
|
|
@@ -13816,7 +14177,7 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value) {
|
|
|
13816
14177
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
13817
14178
|
}
|
|
13818
14179
|
|
|
13819
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14180
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-paragraph-format.js
|
|
13820
14181
|
var LIMIT2 = 65536;
|
|
13821
14182
|
var SPRM_LIMIT = 262144;
|
|
13822
14183
|
var PAGE_NUMBER_MASK = 4194303;
|
|
@@ -14004,7 +14365,7 @@ function writeDocParagraphAlignment(input, index, alignment) {
|
|
|
14004
14365
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
14005
14366
|
}
|
|
14006
14367
|
|
|
14007
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14368
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/doc-document.js
|
|
14008
14369
|
var DOC_CAPABILITIES = Object.freeze({
|
|
14009
14370
|
read: Object.freeze(["paragraph-text", "character-runs", "direct-character-formatting", "paragraph-style-index", "direct-paragraph-alignment", "compound-streams"]),
|
|
14010
14371
|
write: Object.freeze(["paragraph-text", "existing-direct-bold-italic", "existing-direct-font-size", "existing-direct-underline", "existing-direct-paragraph-alignment"]),
|
|
@@ -14200,7 +14561,7 @@ var DocDocument = class extends Ole2DocumentBase {
|
|
|
14200
14561
|
}
|
|
14201
14562
|
};
|
|
14202
14563
|
|
|
14203
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14564
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
|
|
14204
14565
|
function compareDirEntryNames(a, b) {
|
|
14205
14566
|
const ua = a.toUpperCase();
|
|
14206
14567
|
const ub = b.toUpperCase();
|
|
@@ -14267,7 +14628,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
|
|
|
14267
14628
|
}
|
|
14268
14629
|
}
|
|
14269
14630
|
|
|
14270
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14631
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
|
|
14271
14632
|
function writeHeader(outView, outBytes, params) {
|
|
14272
14633
|
outBytes.set(OLE_MAGIC, 0);
|
|
14273
14634
|
outView.setUint16(24, 62, true);
|
|
@@ -14360,7 +14721,7 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
|
|
|
14360
14721
|
}
|
|
14361
14722
|
}
|
|
14362
14723
|
|
|
14363
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14724
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
14364
14725
|
function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
14365
14726
|
const sectorSize = 512;
|
|
14366
14727
|
const miniSectorSize = 64;
|
|
@@ -14541,7 +14902,7 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
14541
14902
|
return output;
|
|
14542
14903
|
}
|
|
14543
14904
|
|
|
14544
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14905
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
|
|
14545
14906
|
var WORKBOOK_STREAM_NAMES = ["workbook", "book"];
|
|
14546
14907
|
function unwrapXlsBytes(bytes) {
|
|
14547
14908
|
if (!isCfb(bytes)) {
|
|
@@ -14608,7 +14969,7 @@ function isCfb(bytes) {
|
|
|
14608
14969
|
return OLE_MAGIC.every((value, index) => bytes[index] === value);
|
|
14609
14970
|
}
|
|
14610
14971
|
|
|
14611
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14972
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
|
|
14612
14973
|
var TABLE = `0 COUNT -1|1 IF -1|2 ISNA 1|3 ISERROR 1|4 SUM -1|5 AVERAGE -1|6 MIN -1|7 MAX -1|8 ROW -1|9 COLUMN -1|10 NA 0|11 NPV -1|12 STDEV -1|13 DOLLAR -1|14 FIXED -1|15 SIN 1|16 COS 1|17 TAN 1|18 ATAN 1|19 PI 0|20 SQRT 1|21 EXP 1|22 LN 1|23 LOG10 1|24 ABS 1|25 INT 1|26 SIGN 1|27 ROUND 2|28 LOOKUP -1|29 INDEX -1|30 REPT 2|31 MID 3|32 LEN 1|33 VALUE 1|34 TRUE 0|35 FALSE 0|36 AND -1|37 OR -1|38 NOT 1|39 MOD 2|40 DCOUNT 3|41 DSUM 3|42 DAVERAGE 3|43 DMIN 3|44 DMAX 3|45 DSTDEV 3|46 VAR -1|47 DVAR 3|48 TEXT 2|49 LINEST -1|50 TREND -1|51 LOGEST -1|52 GROWTH -1|56 PV -1|57 FV -1|58 NPER -1|59 PMT -1|60 RATE -1|61 MIRR 3|62 IRR -1|63 RAND 0|64 MATCH -1|65 DATE 3|66 TIME 3|67 DAY 1|68 MONTH 1|69 YEAR 1|70 WEEKDAY -1|71 HOUR 1|72 MINUTE 1|73 SECOND 1|74 NOW 0|75 AREAS 1|76 ROWS 1|77 COLUMNS 1|78 OFFSET -1|82 SEARCH -1|83 TRANSPOSE 1|86 TYPE 1|97 ATAN2 2|98 ASIN 1|99 ACOS 1|100 CHOOSE -1|101 HLOOKUP -1|102 VLOOKUP -1|105 ISREF 1|109 LOG -1|111 CHAR 1|112 LOWER 1|113 UPPER 1|114 PROPER 1|115 LEFT -1|116 RIGHT -1|117 EXACT 2|118 TRIM 1|119 REPLACE 4|120 SUBSTITUTE -1|121 CODE 1|124 FIND -1|125 CELL -1|126 ISERR 1|127 ISTEXT 1|128 ISNUMBER 1|129 ISBLANK 1|130 T 1|131 N 1|140 DATEVALUE 1|141 TIMEVALUE 1|142 SLN 3|143 SYD 4|144 DDB -1|148 INDIRECT -1|150 CALL -1|162 CLEAN 1|163 MDETERM 1|164 MINVERSE 1|165 MMULT 2|167 IPMT -1|168 PPMT -1|169 COUNTA -1|183 PRODUCT -1|184 FACT 1|189 DPRODUCT 3|190 ISNONTEXT 1|193 STDEVP -1|194 VARP -1|195 DSTDEVP 3|196 DVARP 3|197 TRUNC -1|198 ISLOGICAL 1|199 DCOUNTA 3|204 USDOLLAR -1|205 FINDB -1|206 SEARCHB -1|207 REPLACEB 4|208 LEFTB -1|209 RIGHTB -1|210 MIDB 3|211 LENB 1|212 ROUNDUP 2|213 ROUNDDOWN 2|214 ASC 1|215 DBCS 1|216 RANK -1|219 ADDRESS -1|220 DAYS360 -1|221 TODAY 0|222 VDB -1|227 MEDIAN -1|228 SUMPRODUCT -1|229 SINH 1|230 COSH 1|231 TANH 1|232 ASINH 1|233 ACOSH 1|234 ATANH 1|235 DGET 3|244 INFO 1|247 DB -1|252 FREQUENCY 2|261 ERROR.TYPE 1|269 AVEDEV -1|270 BETADIST -1|271 GAMMALN 1|272 BETAINV -1|273 BINOMDIST 4|274 CHIDIST 2|275 CHIINV 2|276 COMBIN 2|277 CONFIDENCE 3|278 CRITBINOM 3|279 EVEN 1|280 EXPONDIST 3|281 FDIST 3|282 FINV 3|283 FISHER 1|284 FISHERINV 1|285 FLOOR 2|286 GAMMADIST 4|287 GAMMAINV 3|288 CEILING 2|289 HYPGEOMDIST 4|290 LOGNORMDIST 3|291 LOGINV 3|292 NEGBINOMDIST 3|293 NORMDIST 4|294 NORMSDIST 1|295 NORMINV 3|296 NORMSINV 1|297 STANDARDIZE 3|298 ODD 1|299 PERMUT 2|300 POISSON 3|301 TDIST 3|302 WEIBULL 4|303 SUMXMY2 2|304 SUMX2MY2 2|305 SUMX2PY2 2|306 CHITEST 2|307 CORREL 2|308 COVAR 2|309 FORECAST 3|310 FTEST 2|311 INTERCEPT 2|312 PEARSON 2|313 RSQ 2|314 STEYX 2|315 SLOPE 2|316 TTEST 4|317 PROB -1|318 DEVSQ -1|319 GEOMEAN -1|320 HARMEAN -1|321 SUMSQ -1|322 KURT -1|323 SKEW -1|324 ZTEST -1|325 LARGE 2|326 SMALL 2|327 QUARTILE 2|328 PERCENTILE 2|329 PERCENTRANK -1|330 MODE -1|331 TRIMMEAN 2|332 TINV 2|336 CONCATENATE -1|337 POWER 2|342 RADIANS 1|343 DEGREES 1|344 SUBTOTAL -1|345 SUMIF -1|346 COUNTIF 2|347 COUNTBLANK 1|350 ISPMT 4|351 DATEDIF 3|352 DATESTRING 1|353 NUMBERSTRING 2|354 ROMAN -1|358 GETPIVOTDATA -1|359 HYPERLINK -1|360 PHONETIC 1|361 AVERAGEA -1|362 MAXA -1|363 MINA -1|364 STDEVPA -1|365 VARPA -1|366 STDEVA -1|367 VARA -1|368 BAHTTEXT 1`;
|
|
14613
14974
|
var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
14614
14975
|
const [id3, name3, argc] = entry.split(" ");
|
|
@@ -14616,7 +14977,7 @@ var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
|
14616
14977
|
}));
|
|
14617
14978
|
var XLS_USER_FUNCTION_ID = 255;
|
|
14618
14979
|
|
|
14619
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14980
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg-text.js
|
|
14620
14981
|
var BIFF_ERRORS = {
|
|
14621
14982
|
0: "#NULL!",
|
|
14622
14983
|
7: "#DIV/0!",
|
|
@@ -14651,8 +15012,8 @@ function columnName(col) {
|
|
|
14651
15012
|
return name3;
|
|
14652
15013
|
}
|
|
14653
15014
|
function quoteSheetName(name3) {
|
|
14654
|
-
const
|
|
14655
|
-
return
|
|
15015
|
+
const plain2 = /^[A-Za-z_][A-Za-z0-9_.]*$/.test(name3) && !/^[A-Za-z]{1,3}[0-9]+$/.test(name3) && !/^[Rr][0-9]*([Cc][0-9]*)?$/.test(name3) && !/^(TRUE|FALSE)$/i.test(name3);
|
|
15016
|
+
return plain2 ? name3 : `'${name3.replace(/'/g, "''")}'`;
|
|
14656
15017
|
}
|
|
14657
15018
|
function formatNumber2(value) {
|
|
14658
15019
|
return String(value).replace("e", "E");
|
|
@@ -14711,7 +15072,7 @@ function readArrayConstant(extra) {
|
|
|
14711
15072
|
return `{${lines2.join(";")}}`;
|
|
14712
15073
|
}
|
|
14713
15074
|
|
|
14714
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15075
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-records.js
|
|
14715
15076
|
var RT_CONTINUE = 60;
|
|
14716
15077
|
function readXlsRecords(bytes, start = 0, end = bytes.length) {
|
|
14717
15078
|
const records = [];
|
|
@@ -14877,7 +15238,7 @@ function joinedData(record5) {
|
|
|
14877
15238
|
return out;
|
|
14878
15239
|
}
|
|
14879
15240
|
|
|
14880
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15241
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
|
|
14881
15242
|
function decodeFormula(rgce, extra, context, options) {
|
|
14882
15243
|
try {
|
|
14883
15244
|
return decode(rgce, new ByteReader(extra), context, options);
|
|
@@ -15108,7 +15469,7 @@ function readAttr(reader, stack, whitespace) {
|
|
|
15108
15469
|
}
|
|
15109
15470
|
}
|
|
15110
15471
|
|
|
15111
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15472
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sst.js
|
|
15112
15473
|
function parseSharedStrings(record5) {
|
|
15113
15474
|
const reader = SegmentReader.of(record5);
|
|
15114
15475
|
reader.u32();
|
|
@@ -15125,7 +15486,7 @@ function parseSharedStrings(record5) {
|
|
|
15125
15486
|
return strings;
|
|
15126
15487
|
}
|
|
15127
15488
|
|
|
15128
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15489
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-styles.js
|
|
15129
15490
|
var DEFAULT_XLS_PALETTE = "000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 800000 008000 000080 808000 800080 008080 C0C0C0 808080 9999FF 993366 FFFFCC CCFFFF 660066 FF8080 0066CC CCCCFF 000080 FF00FF FFFF00 00FFFF 800080 800000 008080 0000FF 00CCFF CCFFFF CCFFCC FFFF99 99CCFF FF99CC CC99FF FFCC99 3366FF 33CCCC 99CC00 FFCC00 FF9900 FF6600 666699 969696 003366 339966 003300 333300 993300 993366 333399 333333".split(" ");
|
|
15130
15491
|
var XLS_BUILTIN_FORMATS = {
|
|
15131
15492
|
0: "General",
|
|
@@ -15382,7 +15743,7 @@ function applyXfExt(data, xfs, palette) {
|
|
|
15382
15743
|
}
|
|
15383
15744
|
}
|
|
15384
15745
|
|
|
15385
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15746
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-types.js
|
|
15386
15747
|
var XlsReadError = class extends Error {
|
|
15387
15748
|
code;
|
|
15388
15749
|
constructor(code, message) {
|
|
@@ -15392,7 +15753,7 @@ var XlsReadError = class extends Error {
|
|
|
15392
15753
|
}
|
|
15393
15754
|
};
|
|
15394
15755
|
|
|
15395
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15756
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-globals.js
|
|
15396
15757
|
var RT = {
|
|
15397
15758
|
BOF: 2057,
|
|
15398
15759
|
EOF: 10,
|
|
@@ -15481,8 +15842,8 @@ function parseSupBook(data) {
|
|
|
15481
15842
|
function sheetRange(first2, last) {
|
|
15482
15843
|
if (first2 === last)
|
|
15483
15844
|
return quoteSheetName(first2);
|
|
15484
|
-
const
|
|
15485
|
-
return
|
|
15845
|
+
const plain2 = quoteSheetName(first2) === first2 && quoteSheetName(last) === last;
|
|
15846
|
+
return plain2 ? `${first2}:${last}` : `'${`${first2}:${last}`.replace(/'/g, "''")}'`;
|
|
15486
15847
|
}
|
|
15487
15848
|
function parseGlobals(records) {
|
|
15488
15849
|
const first2 = records[0];
|
|
@@ -15630,7 +15991,7 @@ function parseGlobals(records) {
|
|
|
15630
15991
|
return out;
|
|
15631
15992
|
}
|
|
15632
15993
|
|
|
15633
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15994
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
|
|
15634
15995
|
function encodeRkExact(value) {
|
|
15635
15996
|
if (!Number.isFinite(value))
|
|
15636
15997
|
return void 0;
|
|
@@ -15795,7 +16156,7 @@ function editXlsNumericCell(input, edit) {
|
|
|
15795
16156
|
}
|
|
15796
16157
|
}
|
|
15797
16158
|
|
|
15798
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16159
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
|
|
15799
16160
|
var OPCODE_BOF = 2057;
|
|
15800
16161
|
var OPCODE_EOF = 10;
|
|
15801
16162
|
var OPCODE_FILEPASS = 47;
|
|
@@ -15842,7 +16203,7 @@ function decodeRk(rk) {
|
|
|
15842
16203
|
return isDiv100 ? value / 100 : value;
|
|
15843
16204
|
}
|
|
15844
16205
|
|
|
15845
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16206
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-formulas.js
|
|
15846
16207
|
function readRefU(r) {
|
|
15847
16208
|
return { firstRow: r.u16(), lastRow: r.u16(), firstCol: r.u8(), lastCol: r.u8() };
|
|
15848
16209
|
}
|
|
@@ -15900,7 +16261,7 @@ function resolveFormulas(formulas, shared, arrays, globals) {
|
|
|
15900
16261
|
}
|
|
15901
16262
|
}
|
|
15902
16263
|
|
|
15903
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16264
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet-extras.js
|
|
15904
16265
|
function parseMergedCells(data) {
|
|
15905
16266
|
const r = new ByteReader(data);
|
|
15906
16267
|
const count = r.u16();
|
|
@@ -16095,7 +16456,7 @@ function parseNote(data) {
|
|
|
16095
16456
|
return { row: row2, col, visible: (flags & 2) !== 0, id: id3, author: r.xlString() };
|
|
16096
16457
|
}
|
|
16097
16458
|
|
|
16098
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16459
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet.js
|
|
16099
16460
|
var UNSUPPORTED = {
|
|
16100
16461
|
432: "conditional formatting",
|
|
16101
16462
|
2169: "conditional formatting",
|
|
@@ -16351,7 +16712,7 @@ function parseSheet(bound2, records, start, globals) {
|
|
|
16351
16712
|
return sheet;
|
|
16352
16713
|
}
|
|
16353
16714
|
|
|
16354
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16715
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook.js
|
|
16355
16716
|
function compoundStreamNames(bytes) {
|
|
16356
16717
|
if (!OLE_MAGIC.every((value, index) => bytes[index] === value))
|
|
16357
16718
|
return [];
|
|
@@ -16421,7 +16782,7 @@ function readXlsWorkbook(bytes) {
|
|
|
16421
16782
|
};
|
|
16422
16783
|
}
|
|
16423
16784
|
|
|
16424
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16785
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-sst.js
|
|
16425
16786
|
var SstCursor = class {
|
|
16426
16787
|
segments;
|
|
16427
16788
|
segment = 0;
|
|
@@ -16544,7 +16905,7 @@ function appendXlsSstString(value) {
|
|
|
16544
16905
|
return Uint8Array.from(records);
|
|
16545
16906
|
}
|
|
16546
16907
|
|
|
16547
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16908
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js
|
|
16548
16909
|
var CELL_OPS = /* @__PURE__ */ new Set([6, 513, 515, 516, 517, 638, 253, 189, 190, 214]);
|
|
16549
16910
|
function record2(opcode, data) {
|
|
16550
16911
|
const out = new Uint8Array(data.length + 4), view2 = new DataView(out.buffer);
|
|
@@ -16636,7 +16997,7 @@ function relocateXlsDbCells(input, out, records, replacement, map) {
|
|
|
16636
16997
|
}
|
|
16637
16998
|
}
|
|
16638
16999
|
|
|
16639
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17000
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js
|
|
16640
17001
|
var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
16641
17002
|
6,
|
|
16642
17003
|
10,
|
|
@@ -16994,7 +17355,7 @@ var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
|
16994
17355
|
]);
|
|
16995
17356
|
var XLS_FRT_WRAPPER = 2129;
|
|
16996
17357
|
|
|
16997
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17358
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js
|
|
16998
17359
|
var EditError = class extends Error {
|
|
16999
17360
|
reason;
|
|
17000
17361
|
constructor(reason) {
|
|
@@ -17118,7 +17479,7 @@ function findTarget(bytes, m, edit, allowed = [253, 638, 515, 189]) {
|
|
|
17118
17479
|
return target2;
|
|
17119
17480
|
}
|
|
17120
17481
|
|
|
17121
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17482
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-edit.js
|
|
17122
17483
|
function extSst(entries, map) {
|
|
17123
17484
|
const interval = Math.max(Math.floor(entries.length / 128) + 1, 8);
|
|
17124
17485
|
const count = Math.ceil(entries.length / interval);
|
|
@@ -17254,7 +17615,7 @@ function editXlsStringWorkbookStream(input, edit) {
|
|
|
17254
17615
|
}
|
|
17255
17616
|
}
|
|
17256
17617
|
|
|
17257
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17618
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-cell.js
|
|
17258
17619
|
function editXlsPreservedStringCell(input, edit) {
|
|
17259
17620
|
if (!OLE_MAGIC.every((value, index) => input[index] === value))
|
|
17260
17621
|
return editXlsStringWorkbookStream(input, edit);
|
|
@@ -17273,7 +17634,7 @@ function editXlsPreservedStringCell(input, edit) {
|
|
|
17273
17634
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17274
17635
|
}
|
|
17275
17636
|
|
|
17276
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17637
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-edit.js
|
|
17277
17638
|
var ERRORS = Object.freeze({
|
|
17278
17639
|
"#NULL!": 0,
|
|
17279
17640
|
"#DIV/0!": 7,
|
|
@@ -17391,7 +17752,7 @@ function editXlsBoolErrorCell(input, edit) {
|
|
|
17391
17752
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17392
17753
|
}
|
|
17393
17754
|
|
|
17394
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17755
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-record.js
|
|
17395
17756
|
function record3(opcode, data) {
|
|
17396
17757
|
const out = new Uint8Array(4 + data.length), view2 = new DataView(out.buffer);
|
|
17397
17758
|
view2.setUint16(0, opcode, true);
|
|
@@ -17437,7 +17798,7 @@ function replaceXlsBlankRecord(input, target2, col, value) {
|
|
|
17437
17798
|
return { start: target2.headerOffset, end: p + target2.length, bytes };
|
|
17438
17799
|
}
|
|
17439
17800
|
|
|
17440
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17801
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-stored-cell-edit.js
|
|
17441
17802
|
function applyXlsCellRecordReplacement(input, m, replacement) {
|
|
17442
17803
|
if (!Number.isSafeInteger(replacement.start) || !Number.isSafeInteger(replacement.end) || replacement.start < 0 || replacement.end <= replacement.start || replacement.end > input.length || !(replacement.bytes instanceof Uint8Array))
|
|
17443
17804
|
reject("malformed-records");
|
|
@@ -17549,17 +17910,17 @@ function editXlsStoredCell(input, edit, sourceKind) {
|
|
|
17549
17910
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17550
17911
|
}
|
|
17551
17912
|
|
|
17552
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17913
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-edit.js
|
|
17553
17914
|
function editXlsBlankCell(input, edit) {
|
|
17554
17915
|
return editXlsStoredCell(input, edit, "blank");
|
|
17555
17916
|
}
|
|
17556
17917
|
|
|
17557
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17918
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-conversion.js
|
|
17558
17919
|
function editXlsBoolErrorScalarCell(input, edit) {
|
|
17559
17920
|
return editXlsStoredCell(input, edit, "bool-error");
|
|
17560
17921
|
}
|
|
17561
17922
|
|
|
17562
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17923
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/xls-document.js
|
|
17563
17924
|
function cellType(cell) {
|
|
17564
17925
|
if (cell.formula !== void 0 || cell.formulaUndecoded || cell.arrayRange || cell.sharedFormula)
|
|
17565
17926
|
return "formula";
|
|
@@ -17756,7 +18117,7 @@ var XlsDocument = class extends Ole2DocumentBase {
|
|
|
17756
18117
|
}
|
|
17757
18118
|
};
|
|
17758
18119
|
|
|
17759
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18120
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
|
|
17760
18121
|
var PptParseError = class extends Error {
|
|
17761
18122
|
constructor(message) {
|
|
17762
18123
|
super(message);
|
|
@@ -17790,7 +18151,7 @@ function readRecordOrThrow(view2, offset) {
|
|
|
17790
18151
|
return rec;
|
|
17791
18152
|
}
|
|
17792
18153
|
|
|
17793
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18154
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
|
|
17794
18155
|
var RT2 = {
|
|
17795
18156
|
Document: 1e3,
|
|
17796
18157
|
DocumentAtom: 1001,
|
|
@@ -17885,7 +18246,7 @@ var OA = {
|
|
|
17885
18246
|
var HEADER_TOKEN_PLAIN = 3817979999;
|
|
17886
18247
|
var HEADER_TOKEN_ENCRYPTED = 4090610911;
|
|
17887
18248
|
|
|
17888
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18249
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
|
|
17889
18250
|
var DEFAULT_MAX_EDITS = 1e4;
|
|
17890
18251
|
var DEFAULT_MAX_ENTRIES = 1e6;
|
|
17891
18252
|
function checkedLimit(value) {
|
|
@@ -18002,7 +18363,7 @@ function buildPersistDirectory(view2, offsetToCurrentEdit, limits = {}) {
|
|
|
18002
18363
|
return { currentEdit: edits[0], directory };
|
|
18003
18364
|
}
|
|
18004
18365
|
|
|
18005
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18366
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text.js
|
|
18006
18367
|
var PptTextError = class extends PptParseError {
|
|
18007
18368
|
code;
|
|
18008
18369
|
constructor(code, message) {
|
|
@@ -18257,7 +18618,7 @@ function editPptSlideText(input, edit) {
|
|
|
18257
18618
|
}
|
|
18258
18619
|
}
|
|
18259
18620
|
|
|
18260
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18621
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-reader.js
|
|
18261
18622
|
var DEFAULT_LIMITS = { maxRecords: 1e5, maxShapes: 1e4, maxProperties: 1e5, maxNameChars: 1e6, maxTextBytes: 16 * 1024 * 1024 };
|
|
18262
18623
|
var GEOMETRY_PROPERTY_IDS = /* @__PURE__ */ new Set([4, 127, 128, 191, 385, 447, 448, 459, 511, 896, 959]);
|
|
18263
18624
|
function pptShapeChildren(view2, parent) {
|
|
@@ -18337,8 +18698,8 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18337
18698
|
}
|
|
18338
18699
|
}
|
|
18339
18700
|
if (rec.recVer === 15 || rec.recType === OA.ClientTextbox)
|
|
18340
|
-
for (const
|
|
18341
|
-
preflight.push({ rec:
|
|
18701
|
+
for (const child3 of pptShapeChildren(view2, rec))
|
|
18702
|
+
preflight.push({ rec: child3, depth: depth + 1 });
|
|
18342
18703
|
}
|
|
18343
18704
|
const textModel = readPptSlideTexts(input);
|
|
18344
18705
|
return textModel.slides.map((slide) => {
|
|
@@ -18476,7 +18837,7 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18476
18837
|
});
|
|
18477
18838
|
}
|
|
18478
18839
|
|
|
18479
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18840
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-edit.js
|
|
18480
18841
|
function equalPptShapeBounds(a, b) {
|
|
18481
18842
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
18482
18843
|
}
|
|
@@ -18565,7 +18926,7 @@ function editPptShapeBounds(input, edit) {
|
|
|
18565
18926
|
}
|
|
18566
18927
|
}
|
|
18567
18928
|
|
|
18568
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18929
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-notes.js
|
|
18569
18930
|
var viewOf2 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18570
18931
|
function fail2(message) {
|
|
18571
18932
|
throw new PptTextError("corrupt", message);
|
|
@@ -18604,11 +18965,11 @@ function inspect5(input, limits = {}) {
|
|
|
18604
18965
|
fail2("Notes record budget exceeded");
|
|
18605
18966
|
if (end - pos < 8)
|
|
18606
18967
|
fail2("Truncated notes child header");
|
|
18607
|
-
const
|
|
18608
|
-
if (
|
|
18968
|
+
const child3 = record5(pos);
|
|
18969
|
+
if (child3.dataOffset + child3.recLen > end)
|
|
18609
18970
|
fail2("Notes child exceeds parent");
|
|
18610
|
-
result.push(
|
|
18611
|
-
pos =
|
|
18971
|
+
result.push(child3);
|
|
18972
|
+
pos = child3.dataOffset + child3.recLen;
|
|
18612
18973
|
}
|
|
18613
18974
|
return result;
|
|
18614
18975
|
};
|
|
@@ -18851,7 +19212,7 @@ function editPptNotesText(input, edit) {
|
|
|
18851
19212
|
}
|
|
18852
19213
|
}
|
|
18853
19214
|
|
|
18854
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19215
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text-style.js
|
|
18855
19216
|
var viewOf3 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18856
19217
|
var MAX_RECORDS = 1e5;
|
|
18857
19218
|
var MAX_RUNS = 2e4;
|
|
@@ -19034,22 +19395,22 @@ function readPptCharacterRuns(input, limits = {}) {
|
|
|
19034
19395
|
associations.set(atom, { styles: group.styles, textCount: group.atoms.length });
|
|
19035
19396
|
}
|
|
19036
19397
|
};
|
|
19037
|
-
for (const
|
|
19038
|
-
if (textParent && (
|
|
19398
|
+
for (const child3 of list2) {
|
|
19399
|
+
if (textParent && (child3.recType === RT2.TextHeaderAtom || child3.recType === RT2.SlidePersistAtom)) {
|
|
19039
19400
|
finish();
|
|
19040
|
-
group =
|
|
19041
|
-
if (group && (
|
|
19401
|
+
group = child3.recType === RT2.TextHeaderAtom ? { atoms: [], styles: [] } : void 0;
|
|
19402
|
+
if (group && (child3.recVer !== 0 || child3.recInstance > (record5.recType === OA.ClientTextbox ? 0 : 5) || child3.recLen !== 4))
|
|
19042
19403
|
throw new Error("Invalid formatting TextHeaderAtom");
|
|
19043
|
-
} else if (group && (
|
|
19044
|
-
group.atoms.push(
|
|
19045
|
-
else if (group &&
|
|
19046
|
-
styleBytes +=
|
|
19404
|
+
} else if (group && (child3.recType === RT2.TextCharsAtom || child3.recType === RT2.TextBytesAtom))
|
|
19405
|
+
group.atoms.push(child3.headerOffset);
|
|
19406
|
+
else if (group && child3.recType === RT2.StyleTextPropAtom) {
|
|
19407
|
+
styleBytes += child3.recLen;
|
|
19047
19408
|
if (styleBytes > maxStyleBytes)
|
|
19048
19409
|
throw new Error("Formatting payload budget exceeded");
|
|
19049
|
-
group.styles.push(
|
|
19410
|
+
group.styles.push(child3);
|
|
19050
19411
|
}
|
|
19051
|
-
if (
|
|
19052
|
-
stack.push({ record:
|
|
19412
|
+
if (child3.recVer === 15 || child3.recType === OA.ClientTextbox)
|
|
19413
|
+
stack.push({ record: child3, depth: depth + 1 });
|
|
19053
19414
|
}
|
|
19054
19415
|
finish();
|
|
19055
19416
|
}
|
|
@@ -19137,7 +19498,7 @@ function editPptCharacterFontSize(input, edit) {
|
|
|
19137
19498
|
}
|
|
19138
19499
|
}
|
|
19139
19500
|
|
|
19140
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19501
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt-document.js
|
|
19141
19502
|
var PPT_CAPABILITIES = Object.freeze({
|
|
19142
19503
|
read: Object.freeze(["active-slide-ids", "active-outline-and-inline-text", "text-encoding", "direct-character-run-spans-and-font-size", "active-shape-ids-and-flags", "primitive-shape-kind", "explicit-anchor-geometry", "validated-inline-shape-text", "active-notes-identities-and-inline-text", "opaque-streams"]),
|
|
19143
19504
|
write: Object.freeze(["existing-text-fixed-utf16-length", "existing-literal-inline-text-box-font-size", "unmirrored-top-level-small-anchor-bounds", "existing-notes-body-fixed-utf16-length"]),
|
|
@@ -19573,7 +19934,7 @@ var PptDocument = class extends Ole2DocumentBase {
|
|
|
19573
19934
|
}
|
|
19574
19935
|
};
|
|
19575
19936
|
|
|
19576
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19937
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression.js
|
|
19577
19938
|
function decodeVsdBlock(input, limit3 = 32 * 1024 * 1024) {
|
|
19578
19939
|
if (!Number.isSafeInteger(limit3) || limit3 < 0 || limit3 > 64 * 1024 * 1024)
|
|
19579
19940
|
throw new Error("Invalid VSD decompression limit");
|
|
@@ -19620,7 +19981,7 @@ function encodeVsdBlock(input) {
|
|
|
19620
19981
|
return output;
|
|
19621
19982
|
}
|
|
19622
19983
|
|
|
19623
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19984
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-reader.js
|
|
19624
19985
|
var VsdError = class extends Error {
|
|
19625
19986
|
reason;
|
|
19626
19987
|
constructor(reason) {
|
|
@@ -19994,7 +20355,7 @@ function readVsdDrawing(input) {
|
|
|
19994
20355
|
return data;
|
|
19995
20356
|
}
|
|
19996
20357
|
|
|
19997
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20358
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression-fit.js
|
|
19998
20359
|
var VSD_COMPRESSION_FIT_MAX_BYTES = 8 * 1024 * 1024;
|
|
19999
20360
|
var MAX_INPUT = VSD_COMPRESSION_FIT_MAX_BYTES;
|
|
20000
20361
|
var MAX_GAP = 4096;
|
|
@@ -20169,7 +20530,7 @@ function encodeVsdBlockToSize(input, capacity) {
|
|
|
20169
20530
|
return { bytes: output, paddingBytes: 0 };
|
|
20170
20531
|
}
|
|
20171
20532
|
|
|
20172
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20533
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-writer.js
|
|
20173
20534
|
function replaceRecord(input, drawing, record5, replacement) {
|
|
20174
20535
|
if (!drawing.writable)
|
|
20175
20536
|
throw new VsdError("shared-or-overlapping-allocation");
|
|
@@ -20253,7 +20614,7 @@ function replaceVsdShapeTransform(input, pageId2, shapeId2, transform2) {
|
|
|
20253
20614
|
return candidate;
|
|
20254
20615
|
}
|
|
20255
20616
|
|
|
20256
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20617
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-document.js
|
|
20257
20618
|
var VsdShape = class {
|
|
20258
20619
|
id;
|
|
20259
20620
|
#read;
|
|
@@ -20404,7 +20765,7 @@ var VsdDocument = class extends Ole2DocumentBase {
|
|
|
20404
20765
|
}
|
|
20405
20766
|
};
|
|
20406
20767
|
|
|
20407
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20768
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document.js
|
|
20408
20769
|
var CfbDocument = class extends Ole2DocumentBase {
|
|
20409
20770
|
get kind() {
|
|
20410
20771
|
return "cfb";
|
|
@@ -20851,98 +21212,293 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
20851
21212
|
}
|
|
20852
21213
|
}
|
|
20853
21214
|
|
|
20854
|
-
// visio/edit-
|
|
20855
|
-
function
|
|
20856
|
-
|
|
20857
|
-
|
|
20858
|
-
|
|
20859
|
-
|
|
20860
|
-
|
|
20861
|
-
|
|
20862
|
-
|
|
20863
|
-
|
|
20864
|
-
|
|
20865
|
-
|
|
20866
|
-
edit.pageId,
|
|
20867
|
-
shape,
|
|
20868
|
-
/* @__PURE__ */ new Map([["TheText", text3]]),
|
|
20869
|
-
check
|
|
20870
|
-
)
|
|
20871
|
-
);
|
|
20872
|
-
}
|
|
20873
|
-
|
|
20874
|
-
// visio/edit-text-range-plan.ts
|
|
20875
|
-
function textRangeNodes(node2, edit) {
|
|
20876
|
-
const tokens2 = [];
|
|
20877
|
-
let stored = "";
|
|
20878
|
-
for (const part of Array.from(node2.childNodes)) {
|
|
20879
|
-
const start = stored.length;
|
|
20880
|
-
const field2 = part.nodeType === 1 && part.localName === "fld";
|
|
20881
|
-
if (part.nodeType === 3 || part.nodeType === 4) stored += part.nodeValue ?? "";
|
|
20882
|
-
else if (field2) stored += part.textContent ?? "";
|
|
20883
|
-
tokens2.push({ node: part, start, end: stored.length, ...field2 ? { field: field2 } : {} });
|
|
20884
|
-
}
|
|
20885
|
-
if (decodeVisioPlainText(stored) !== edit.expectedText)
|
|
20886
|
-
fail("EDIT_STALE_TEXT", "Original text no longer matches the range command.");
|
|
20887
|
-
const changed = edit.ranges.some(
|
|
20888
|
-
(range2) => edit.expectedText.slice(range2.start, range2.end) !== range2.text
|
|
20889
|
-
);
|
|
20890
|
-
if (!changed) return { changed: false, nodes: [] };
|
|
20891
|
-
for (const token of tokens2)
|
|
20892
|
-
if (token.field && edit.ranges.some((range2) => range2.start < token.end && range2.end > token.start))
|
|
21215
|
+
// visio/edit-master-index.ts
|
|
21216
|
+
function inheritedProtection(node2, ancestor) {
|
|
21217
|
+
try {
|
|
21218
|
+
const boolean2 = (cell) => {
|
|
21219
|
+
if (!cell || cell.hasAttribute("E"))
|
|
21220
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection has an unresolved or error cache.");
|
|
21221
|
+
const value = visioFormulaCachedValue(attribute2(cell, "V") ?? "", attribute2(cell, "U"));
|
|
21222
|
+
if (value.unit !== "scalar" || ![0, 1].includes(value.value))
|
|
21223
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection requires scalar boolean caches.");
|
|
21224
|
+
return value.value;
|
|
21225
|
+
};
|
|
21226
|
+
if (boolean2(node2) !== boolean2(ancestor))
|
|
20893
21227
|
fail(
|
|
20894
|
-
"
|
|
20895
|
-
"
|
|
21228
|
+
"EDIT_PROTECTED_CELL",
|
|
21229
|
+
"Delegated master style protection cache disagrees with its ancestor."
|
|
20896
21230
|
);
|
|
20897
|
-
|
|
20898
|
-
let delta = 0;
|
|
20899
|
-
for (const range2 of edit.ranges) {
|
|
20900
|
-
starts.push(range2.start + delta);
|
|
20901
|
-
delta += range2.text.length - (range2.end - range2.start);
|
|
20902
|
-
deltas.push(delta);
|
|
20903
|
-
}
|
|
20904
|
-
const length = edit.expectedText.length + delta;
|
|
20905
|
-
if (!length && tokens2.some((token) => token.node.nodeType === 1))
|
|
21231
|
+
} catch (error) {
|
|
20906
21232
|
fail(
|
|
20907
|
-
"
|
|
20908
|
-
|
|
21233
|
+
"EDIT_PROTECTED_CELL",
|
|
21234
|
+
`Inherited master style protection cannot be proven: ${error instanceof Error ? error.message : "invalid cache"}`
|
|
20909
21235
|
);
|
|
20910
|
-
if (tokens2.some((token) => token.node.nodeType === 1)) {
|
|
20911
|
-
let start = 0, index = 0;
|
|
20912
|
-
while (start < edit.expectedText.length) {
|
|
20913
|
-
const newline = edit.expectedText.indexOf("\n", start), end = newline < 0 ? edit.expectedText.length : newline;
|
|
20914
|
-
let bodyLength = end - start;
|
|
20915
|
-
while (index < edit.ranges.length && edit.ranges[index].start < end) {
|
|
20916
|
-
const range2 = edit.ranges[index++];
|
|
20917
|
-
bodyLength += range2.text.length - (range2.end - range2.start);
|
|
20918
|
-
}
|
|
20919
|
-
if (end > start && !bodyLength)
|
|
20920
|
-
fail(
|
|
20921
|
-
"UNSUPPORTED_TEXT_RANGE",
|
|
20922
|
-
"Deleting an entire rich paragraph body has unproven native insertion-style behavior."
|
|
20923
|
-
);
|
|
20924
|
-
start = end + 1;
|
|
20925
|
-
}
|
|
20926
21236
|
}
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
const
|
|
20935
|
-
if (
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
};
|
|
20939
|
-
const
|
|
20940
|
-
const
|
|
20941
|
-
|
|
20942
|
-
const
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
21237
|
+
}
|
|
21238
|
+
function masterCells(sheet, charge = () => {
|
|
21239
|
+
}) {
|
|
21240
|
+
const result = /* @__PURE__ */ new Map();
|
|
21241
|
+
if (!sheet) return result;
|
|
21242
|
+
const add = (name3, node2) => {
|
|
21243
|
+
charge();
|
|
21244
|
+
const id3 = name3.toLowerCase();
|
|
21245
|
+
if (result.has(id3) && result.get(id3) !== node2)
|
|
21246
|
+
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous effective master cells.");
|
|
21247
|
+
result.set(id3, node2);
|
|
21248
|
+
};
|
|
21249
|
+
for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
|
|
21250
|
+
for (const section2 of children2(sheet, "Section")) {
|
|
21251
|
+
const name3 = attribute2(section2, "N") ?? "";
|
|
21252
|
+
const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section2, "IX") ?? "0") + 1}` : name3 === "Control" ? "Controls" : name3;
|
|
21253
|
+
for (const node2 of children2(section2, "Cell"))
|
|
21254
|
+
add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
|
|
21255
|
+
for (const row2 of children2(section2, "Row"))
|
|
21256
|
+
for (const node2 of children2(row2, "Cell")) {
|
|
21257
|
+
const n = attribute2(node2, "N") ?? "";
|
|
21258
|
+
const rowName = attribute2(row2, "N");
|
|
21259
|
+
const index = attribute2(row2, "IX") ?? (prefix2 === "Controls" && /^Row_\d+$/.test(rowName ?? "") ? String(Number(rowName.slice(4)) - 1) : void 0);
|
|
21260
|
+
const ix = index ?? "0", r = rowName ?? (prefix2 === "Controls" ? `Row_${Number(ix) + 1}` : ix);
|
|
21261
|
+
add(
|
|
21262
|
+
name3 === "Geometry" || ["Controls", "Scratch", "Connection"].includes(prefix2) ? `${prefix2}.${n}${ix}` : n === "Value" && ["User", "Prop"].includes(name3) ? `${prefix2}.${r}` : `${prefix2}.${r}.${n}`,
|
|
21263
|
+
node2
|
|
21264
|
+
);
|
|
21265
|
+
if (name3 !== "Geometry") add(`${prefix2}.${r}.${n}`, node2);
|
|
21266
|
+
if (prefix2 === "Controls" && n === "X") add(`${prefix2}.${r}`, node2);
|
|
21267
|
+
if (name3 !== "Geometry" && index !== void 0) add(`${prefix2}.$row${ix}.${n}`, node2);
|
|
21268
|
+
}
|
|
21269
|
+
}
|
|
21270
|
+
return result;
|
|
21271
|
+
}
|
|
21272
|
+
function masterShapes(root2) {
|
|
21273
|
+
const result = [], pending = [root2];
|
|
21274
|
+
while (pending.length) {
|
|
21275
|
+
const parent = pending.pop();
|
|
21276
|
+
for (const container of children2(parent, "Shapes"))
|
|
21277
|
+
for (const shape of children2(container, "Shape")) {
|
|
21278
|
+
result.push(shape);
|
|
21279
|
+
pending.push(shape);
|
|
21280
|
+
}
|
|
21281
|
+
}
|
|
21282
|
+
return result;
|
|
21283
|
+
}
|
|
21284
|
+
function assertMasterMarkup(root2, known, check) {
|
|
21285
|
+
for (const node2 of [root2, ...Array.from(root2.getElementsByTagName("*"))]) {
|
|
21286
|
+
check();
|
|
21287
|
+
if (node2.namespaceURI === root2.namespaceURI && node2.hasAttribute("F") && !known.has(node2))
|
|
21288
|
+
fail(
|
|
21289
|
+
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
21290
|
+
"Master formula outside admitted sheet cells has unknown scope."
|
|
21291
|
+
);
|
|
21292
|
+
}
|
|
21293
|
+
}
|
|
21294
|
+
function masterStyleCells(document, template, instance, check, charge = () => {
|
|
21295
|
+
}, verifyMovementProtection = false) {
|
|
21296
|
+
const styles = /* @__PURE__ */ new Map();
|
|
21297
|
+
for (const container of children2(document, "StyleSheets"))
|
|
21298
|
+
for (const style2 of children2(container, "StyleSheet")) {
|
|
21299
|
+
charge();
|
|
21300
|
+
const id3 = attribute2(style2, "ID");
|
|
21301
|
+
if (!id3 || styles.has(id3))
|
|
21302
|
+
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous master style IDs.");
|
|
21303
|
+
styles.set(id3, style2);
|
|
21304
|
+
}
|
|
21305
|
+
const defaults = children2(document, "DocumentSheet")[0];
|
|
21306
|
+
const collect = (id3, category, seen = /* @__PURE__ */ new Set()) => {
|
|
21307
|
+
check();
|
|
21308
|
+
if (seen.has(id3) || seen.size >= 64)
|
|
21309
|
+
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Invalid inherited master style ancestry.");
|
|
21310
|
+
seen.add(id3);
|
|
21311
|
+
const style2 = styles.get(id3);
|
|
21312
|
+
if (!style2) fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Missing inherited master style.");
|
|
21313
|
+
const own = masterCells(style2, charge);
|
|
21314
|
+
assertMasterMarkup(style2, new Set(own.values()), check);
|
|
21315
|
+
const parent = attribute2(style2, category);
|
|
21316
|
+
const result2 = parent !== void 0 && parent !== id3 ? collect(parent, category, seen) : /* @__PURE__ */ new Map();
|
|
21317
|
+
for (const [name3, node2] of own) {
|
|
21318
|
+
charge();
|
|
21319
|
+
if (attribute2(node2, "F") !== "Inh") result2.set(name3, node2);
|
|
21320
|
+
else if (verifyMovementProtection && /^lock(move[xy]|width|height|aspect|delete)$/.test(name3)) {
|
|
21321
|
+
charge();
|
|
21322
|
+
inheritedProtection(node2, result2.get(name3));
|
|
21323
|
+
}
|
|
21324
|
+
}
|
|
21325
|
+
return result2;
|
|
21326
|
+
};
|
|
21327
|
+
const result = /* @__PURE__ */ new Map();
|
|
21328
|
+
for (const category of ["LineStyle", "FillStyle", "TextStyle"]) {
|
|
21329
|
+
const id3 = attribute2(instance, category) ?? attribute2(template, category) ?? attribute2(defaults, category) ?? (styles.has("0") ? "0" : void 0);
|
|
21330
|
+
if (id3 !== void 0)
|
|
21331
|
+
for (const [name3, node2] of collect(id3, category)) {
|
|
21332
|
+
charge();
|
|
21333
|
+
if (result.has(name3) && result.get(name3) !== node2)
|
|
21334
|
+
fail(
|
|
21335
|
+
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
21336
|
+
"Master style categories have ambiguous overlapping inputs."
|
|
21337
|
+
);
|
|
21338
|
+
result.set(name3, node2);
|
|
21339
|
+
}
|
|
21340
|
+
}
|
|
21341
|
+
return result;
|
|
21342
|
+
}
|
|
21343
|
+
function overlay(cells4, additions, kind, charge) {
|
|
21344
|
+
const aliases = /* @__PURE__ */ new Map(), inherited = /* @__PURE__ */ new Map();
|
|
21345
|
+
for (const [name3, source] of cells4) {
|
|
21346
|
+
charge();
|
|
21347
|
+
const names = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
21348
|
+
names.add(name3);
|
|
21349
|
+
aliases.set(source.node, names);
|
|
21350
|
+
}
|
|
21351
|
+
for (const [name3, node2] of additions) {
|
|
21352
|
+
charge();
|
|
21353
|
+
const source = cells4.get(name3);
|
|
21354
|
+
if (source) inherited.set(node2, source);
|
|
21355
|
+
}
|
|
21356
|
+
for (const [name3, node2] of additions) {
|
|
21357
|
+
charge();
|
|
21358
|
+
if (attribute2(node2, "F") === "Inh") {
|
|
21359
|
+
const source = cells4.get(name3) ?? inherited.get(node2);
|
|
21360
|
+
if (!source)
|
|
21361
|
+
fail(
|
|
21362
|
+
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
21363
|
+
"Inherited master cell has no effective source."
|
|
21364
|
+
);
|
|
21365
|
+
cells4.set(name3, source);
|
|
21366
|
+
const names2 = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
21367
|
+
names2.add(name3);
|
|
21368
|
+
aliases.set(source.node, names2);
|
|
21369
|
+
continue;
|
|
21370
|
+
}
|
|
21371
|
+
const previous = cells4.get(name3), names = aliases.get(node2) ?? /* @__PURE__ */ new Set();
|
|
21372
|
+
if (previous && previous.node !== node2) {
|
|
21373
|
+
for (const alias of aliases.get(previous.node) ?? []) {
|
|
21374
|
+
charge();
|
|
21375
|
+
cells4.set(alias, { node: node2, kind });
|
|
21376
|
+
names.add(alias);
|
|
21377
|
+
}
|
|
21378
|
+
aliases.delete(previous.node);
|
|
21379
|
+
}
|
|
21380
|
+
cells4.set(name3, { node: node2, kind });
|
|
21381
|
+
names.add(name3);
|
|
21382
|
+
aliases.set(node2, names);
|
|
21383
|
+
}
|
|
21384
|
+
}
|
|
21385
|
+
|
|
21386
|
+
// visio/edit-text-scope.ts
|
|
21387
|
+
function masterTemplate(pkg) {
|
|
21388
|
+
const missing = () => fail("UNSUPPORTED_TEXT_EDIT", "The master of this stencil shape cannot be resolved.");
|
|
21389
|
+
return async (masterId, masterShapeId) => {
|
|
21390
|
+
const documentPart2 = await related(pkg, "", "document");
|
|
21391
|
+
const mastersPart = documentPart2 && await related(pkg, documentPart2, "masters", false);
|
|
21392
|
+
if (!mastersPart) return missing();
|
|
21393
|
+
const definitions = children2(await visioXml(pkg, mastersPart, "Masters"), "Master").filter(
|
|
21394
|
+
(node2) => attribute2(node2, "ID") === masterId
|
|
21395
|
+
);
|
|
21396
|
+
if (definitions.length !== 1) return missing();
|
|
21397
|
+
const root2 = await visioXml(
|
|
21398
|
+
pkg,
|
|
21399
|
+
await indexedPart(pkg, mastersPart, definitions[0], "master"),
|
|
21400
|
+
"MasterContents"
|
|
21401
|
+
);
|
|
21402
|
+
if (masterShapeId === void 0) {
|
|
21403
|
+
const tops = children2(children2(root2, "Shapes")[0], "Shape");
|
|
21404
|
+
return tops.length === 1 ? tops[0] : missing();
|
|
21405
|
+
}
|
|
21406
|
+
const matches = masterShapes(root2).filter((shape) => attribute2(shape, "ID") === masterShapeId);
|
|
21407
|
+
return matches.length === 1 ? matches[0] : missing();
|
|
21408
|
+
};
|
|
21409
|
+
}
|
|
21410
|
+
function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check) {
|
|
21411
|
+
return replacePlainText(
|
|
21412
|
+
roots.get(edit.pageId),
|
|
21413
|
+
document,
|
|
21414
|
+
edit.shapeId,
|
|
21415
|
+
edit.text,
|
|
21416
|
+
check,
|
|
21417
|
+
(shape, text3) => assertFormattingDependencies(
|
|
21418
|
+
pkg,
|
|
21419
|
+
pagePaths,
|
|
21420
|
+
roots,
|
|
21421
|
+
edit.pageId,
|
|
21422
|
+
shape,
|
|
21423
|
+
/* @__PURE__ */ new Map([["TheText", text3]]),
|
|
21424
|
+
check
|
|
21425
|
+
),
|
|
21426
|
+
masterTemplate(pkg)
|
|
21427
|
+
);
|
|
21428
|
+
}
|
|
21429
|
+
|
|
21430
|
+
// visio/edit-text-range-plan.ts
|
|
21431
|
+
function textRangeNodes(node2, edit) {
|
|
21432
|
+
const tokens2 = [];
|
|
21433
|
+
let stored = "";
|
|
21434
|
+
for (const part of Array.from(node2.childNodes)) {
|
|
21435
|
+
const start = stored.length;
|
|
21436
|
+
const field2 = part.nodeType === 1 && part.localName === "fld";
|
|
21437
|
+
if (part.nodeType === 3 || part.nodeType === 4) stored += part.nodeValue ?? "";
|
|
21438
|
+
else if (field2) stored += part.textContent ?? "";
|
|
21439
|
+
tokens2.push({ node: part, start, end: stored.length, ...field2 ? { field: field2 } : {} });
|
|
21440
|
+
}
|
|
21441
|
+
if (decodeVisioPlainText(stored) !== edit.expectedText)
|
|
21442
|
+
fail("EDIT_STALE_TEXT", "Original text no longer matches the range command.");
|
|
21443
|
+
const changed = edit.ranges.some(
|
|
21444
|
+
(range2) => edit.expectedText.slice(range2.start, range2.end) !== range2.text
|
|
21445
|
+
);
|
|
21446
|
+
if (!changed) return { changed: false, nodes: [] };
|
|
21447
|
+
for (const token of tokens2)
|
|
21448
|
+
if (token.field && edit.ranges.some((range2) => range2.start < token.end && range2.end > token.start))
|
|
21449
|
+
fail(
|
|
21450
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
21451
|
+
"Text fields are atomic: edit the text around a field, not the field itself."
|
|
21452
|
+
);
|
|
21453
|
+
const starts = [], deltas = [];
|
|
21454
|
+
let delta = 0;
|
|
21455
|
+
for (const range2 of edit.ranges) {
|
|
21456
|
+
starts.push(range2.start + delta);
|
|
21457
|
+
delta += range2.text.length - (range2.end - range2.start);
|
|
21458
|
+
deltas.push(delta);
|
|
21459
|
+
}
|
|
21460
|
+
const length = edit.expectedText.length + delta;
|
|
21461
|
+
if (!length && tokens2.some((token) => token.node.nodeType === 1))
|
|
21462
|
+
fail(
|
|
21463
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
21464
|
+
"Deleting all rich text has unproven native insertion-style behavior."
|
|
21465
|
+
);
|
|
21466
|
+
if (tokens2.some((token) => token.node.nodeType === 1)) {
|
|
21467
|
+
let start = 0, index = 0;
|
|
21468
|
+
while (start < edit.expectedText.length) {
|
|
21469
|
+
const newline = edit.expectedText.indexOf("\n", start), end = newline < 0 ? edit.expectedText.length : newline;
|
|
21470
|
+
let bodyLength = end - start;
|
|
21471
|
+
while (index < edit.ranges.length && edit.ranges[index].start < end) {
|
|
21472
|
+
const range2 = edit.ranges[index++];
|
|
21473
|
+
bodyLength += range2.text.length - (range2.end - range2.start);
|
|
21474
|
+
}
|
|
21475
|
+
if (end > start && !bodyLength)
|
|
21476
|
+
fail(
|
|
21477
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
21478
|
+
"Deleting an entire rich paragraph body has unproven native insertion-style behavior."
|
|
21479
|
+
);
|
|
21480
|
+
start = end + 1;
|
|
21481
|
+
}
|
|
21482
|
+
}
|
|
21483
|
+
const position = (offset) => {
|
|
21484
|
+
let low = 0, high = edit.ranges.length;
|
|
21485
|
+
while (low < high) {
|
|
21486
|
+
const middle = low + high >>> 1;
|
|
21487
|
+
if (edit.ranges[middle].start < offset) low = middle + 1;
|
|
21488
|
+
else high = middle;
|
|
21489
|
+
}
|
|
21490
|
+
const index = low - 1;
|
|
21491
|
+
if (index < 0) return offset;
|
|
21492
|
+
const range2 = edit.ranges[index];
|
|
21493
|
+
return offset <= range2.end ? starts[index] + range2.text.length : offset + deltas[index];
|
|
21494
|
+
};
|
|
21495
|
+
const output = [];
|
|
21496
|
+
const append = (token, start, end) => {
|
|
21497
|
+
if (end <= start) return;
|
|
21498
|
+
const part = start === token.start && end === token.end ? token.node : token.node.cloneNode(false);
|
|
21499
|
+
if (part !== token.node)
|
|
21500
|
+
part.nodeValue = (token.node.nodeValue ?? "").slice(start - token.start, end - token.start);
|
|
21501
|
+
output.push({ position: position(start), priority: 2, node: part });
|
|
20946
21502
|
};
|
|
20947
21503
|
let first2 = 0;
|
|
20948
21504
|
for (const token of tokens2) {
|
|
@@ -20991,12 +21547,17 @@ function textRangeNodes(node2, edit) {
|
|
|
20991
21547
|
|
|
20992
21548
|
// visio/edit-text-ranges.ts
|
|
20993
21549
|
async function replaceScopedTextRanges(pkg, pagePaths, roots, document, edit, check) {
|
|
20994
|
-
const
|
|
21550
|
+
const found = textTarget(roots.get(edit.pageId), edit.shapeId, check);
|
|
21551
|
+
const instance = found.masterId === void 0 ? void 0 : instanceTextNode(
|
|
21552
|
+
found.node,
|
|
21553
|
+
await masterTemplate(pkg)(found.masterId, found.masterShapeId)
|
|
21554
|
+
);
|
|
21555
|
+
const shape = instance ? found.node : localTextTarget(roots.get(edit.pageId), document, edit.shapeId, check);
|
|
20995
21556
|
const texts = children2(shape, "Text");
|
|
20996
21557
|
if (texts.length !== 1)
|
|
20997
21558
|
fail("UNSUPPORTED_TEXT_RANGE", "Range editing requires one existing local Text element.");
|
|
20998
21559
|
const text3 = texts[0];
|
|
20999
|
-
if (Array.from(text3.childNodes).some((node2) => ![3, 4].includes(node2.nodeType))) {
|
|
21560
|
+
if (!instance && Array.from(text3.childNodes).some((node2) => ![3, 4].includes(node2.nodeType))) {
|
|
21000
21561
|
const characters = effectiveFormattingRows(shape, document, "Character"), paragraphs = effectiveFormattingRows(shape, document, "Paragraph");
|
|
21001
21562
|
assertFormattingText(shape, characters, paragraphs);
|
|
21002
21563
|
}
|
|
@@ -21013,16 +21574,20 @@ async function replaceScopedTextRanges(pkg, pagePaths, roots, document, edit, ch
|
|
|
21013
21574
|
}
|
|
21014
21575
|
}
|
|
21015
21576
|
const plan = textRangeNodes(text3, edit);
|
|
21016
|
-
if (!plan.changed)
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21020
|
-
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21577
|
+
if (!plan.changed) {
|
|
21578
|
+
instance?.discard();
|
|
21579
|
+
return false;
|
|
21580
|
+
}
|
|
21581
|
+
if (!instance)
|
|
21582
|
+
await assertFormattingDependencies(
|
|
21583
|
+
pkg,
|
|
21584
|
+
pagePaths,
|
|
21585
|
+
roots,
|
|
21586
|
+
edit.pageId,
|
|
21587
|
+
shape,
|
|
21588
|
+
/* @__PURE__ */ new Map([["TheText", text3]]),
|
|
21589
|
+
check
|
|
21590
|
+
);
|
|
21026
21591
|
check();
|
|
21027
21592
|
while (text3.firstChild) text3.removeChild(text3.firstChild);
|
|
21028
21593
|
for (const node2 of plan.nodes) text3.appendChild(node2);
|
|
@@ -22034,6 +22599,96 @@ function snapshotAssignLayers(edit) {
|
|
|
22034
22599
|
};
|
|
22035
22600
|
}
|
|
22036
22601
|
|
|
22602
|
+
// visio/edit-layer-properties.ts
|
|
22603
|
+
var FLAGS = [
|
|
22604
|
+
["visible", "Visible"],
|
|
22605
|
+
["print", "Print"],
|
|
22606
|
+
["lock", "Lock"]
|
|
22607
|
+
];
|
|
22608
|
+
function snapshotLayerProperties(edit) {
|
|
22609
|
+
if (typeof edit.pageId !== "string" || !edit.pageId || edit.pageId.length > 256)
|
|
22610
|
+
fail("INVALID_EDIT", "Invalid edit target.");
|
|
22611
|
+
if (typeof edit.layerId !== "string" || !/^(0|[1-9]\d{0,9})$/.test(edit.layerId))
|
|
22612
|
+
fail("INVALID_EDIT", "Layer IDs must be canonical unsigned integers.");
|
|
22613
|
+
const result = {
|
|
22614
|
+
type: "set-layer-properties",
|
|
22615
|
+
pageId: edit.pageId,
|
|
22616
|
+
layerId: edit.layerId
|
|
22617
|
+
};
|
|
22618
|
+
for (const [key2] of FLAGS) {
|
|
22619
|
+
const value = edit[key2];
|
|
22620
|
+
if (value === void 0) continue;
|
|
22621
|
+
if (typeof value !== "boolean") fail("INVALID_EDIT", "Layer flags are true or false.");
|
|
22622
|
+
result[key2] = value;
|
|
22623
|
+
}
|
|
22624
|
+
if (!FLAGS.some(([key2]) => result[key2] !== void 0))
|
|
22625
|
+
fail("INVALID_EDIT", "A layer edit needs at least one flag.");
|
|
22626
|
+
return result;
|
|
22627
|
+
}
|
|
22628
|
+
async function editVsdxLayerProperties(pkg, parts, pages, edits, limits, maxOutput, deadline, check) {
|
|
22629
|
+
const documentPart2 = await related(pkg, "", "document");
|
|
22630
|
+
const pagesPart = await related(pkg, documentPart2, "pages");
|
|
22631
|
+
const source = await visioXml(pkg, pagesPart, "Pages");
|
|
22632
|
+
const pageList = source.ownerDocument.cloneNode(true).documentElement;
|
|
22633
|
+
let changed = false;
|
|
22634
|
+
for (const edit of edits) {
|
|
22635
|
+
check();
|
|
22636
|
+
if (!pages.has(edit.pageId)) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
22637
|
+
const page = children2(pageList, "Page").find((node2) => attribute2(node2, "ID") === edit.pageId);
|
|
22638
|
+
const sheets = page ? children2(page, "PageSheet") : [];
|
|
22639
|
+
if (sheets.length !== 1) fail("UNSUPPORTED_LAYER_EDIT", "One explicit PageSheet is required.");
|
|
22640
|
+
const sections = children2(sheets[0], "Section").filter(
|
|
22641
|
+
(node2) => attribute2(node2, "N") === "Layer"
|
|
22642
|
+
);
|
|
22643
|
+
if (sections.length !== 1)
|
|
22644
|
+
fail("EDIT_TARGET_NOT_FOUND", "The layer does not belong to this page.");
|
|
22645
|
+
const rows = children2(sections[0], "Row").filter(
|
|
22646
|
+
(row3) => attribute2(row3, "IX") === edit.layerId
|
|
22647
|
+
);
|
|
22648
|
+
if (rows.length !== 1 || rows[0].hasAttribute("Del"))
|
|
22649
|
+
fail("EDIT_TARGET_NOT_FOUND", "The layer does not belong to this page.");
|
|
22650
|
+
const row2 = rows[0];
|
|
22651
|
+
for (const [key2, name3] of FLAGS) {
|
|
22652
|
+
const value = edit[key2];
|
|
22653
|
+
if (value === void 0) continue;
|
|
22654
|
+
const cells4 = children2(row2, "Cell").filter((cell2) => attribute2(cell2, "N") === name3);
|
|
22655
|
+
if (cells4.length > 1) fail("UNSUPPORTED_LAYER_EDIT", `Duplicate layer ${name3} cells.`);
|
|
22656
|
+
let cell = cells4[0];
|
|
22657
|
+
if (cell && (cell.hasAttribute("E") || executableCellFormula(attribute2(cell, "F"))))
|
|
22658
|
+
fail("UNSUPPORTED_LAYER_EDIT", `The layer's ${name3} flag is set by a formula.`);
|
|
22659
|
+
const next = value ? "1" : "0";
|
|
22660
|
+
if (cell && attribute2(cell, "V") === next) continue;
|
|
22661
|
+
if (!cell) {
|
|
22662
|
+
cell = row2.ownerDocument.createElementNS(row2.namespaceURI, "Cell");
|
|
22663
|
+
cell.setAttribute("N", name3);
|
|
22664
|
+
row2.appendChild(cell);
|
|
22665
|
+
}
|
|
22666
|
+
cell.setAttribute("V", next);
|
|
22667
|
+
changed = true;
|
|
22668
|
+
}
|
|
22669
|
+
}
|
|
22670
|
+
const original = parts.get(pagesPart);
|
|
22671
|
+
if (!changed)
|
|
22672
|
+
return {
|
|
22673
|
+
bytes: await writeEditedPackage(parts, maxOutput, deadline, check),
|
|
22674
|
+
changedParts: [],
|
|
22675
|
+
diagnostics: []
|
|
22676
|
+
};
|
|
22677
|
+
const serialized = serializeEditedXml(pageList, limits, check);
|
|
22678
|
+
const total = [...parts.values()].reduce((sum, bytes2) => sum + bytes2.length, 0) + serialized.bytes.length - (original?.length ?? 0);
|
|
22679
|
+
if (total > limits.maxTotalBytes) fail("LIMIT_TOTAL", "Edited package total exceeds limit.");
|
|
22680
|
+
parts.set(pagesPart, serialized.bytes);
|
|
22681
|
+
const bytes = await writeEditedPackage(parts, maxOutput, deadline, check);
|
|
22682
|
+
const verified = await openEditablePackage(
|
|
22683
|
+
bytes,
|
|
22684
|
+
{ ...limits, maxInputBytes: maxOutput, maxRuntimeMs: Math.max(1, deadline - Date.now()) },
|
|
22685
|
+
check
|
|
22686
|
+
);
|
|
22687
|
+
await visioXml(verified.pkg, pagesPart, "Pages");
|
|
22688
|
+
check();
|
|
22689
|
+
return { bytes, changedParts: [pagesPart], diagnostics: [] };
|
|
22690
|
+
}
|
|
22691
|
+
|
|
22037
22692
|
// visio/edit-guide-commands.ts
|
|
22038
22693
|
var isVisioGuideEdit = (edit) => edit.type === "create-guide" || edit.type === "move-guide" || edit.type === "delete-guide";
|
|
22039
22694
|
function snapshotGuideEdit(edit) {
|
|
@@ -22616,6 +23271,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
22616
23271
|
if (edit.type === "insert-picture") return snapshotPictureInsert(edit);
|
|
22617
23272
|
if (edit.type === "set-page-theme") return snapshotPageTheme(edit);
|
|
22618
23273
|
if (edit.type === "assign-layers") return snapshotAssignLayers(edit);
|
|
23274
|
+
if (edit.type === "set-layer-properties") return snapshotLayerProperties(edit);
|
|
22619
23275
|
if (isVisioGuideEdit(edit)) return snapshotGuideEdit(edit);
|
|
22620
23276
|
if (isVisioMetadataEdit(edit)) return snapshotMetadataEdit(edit);
|
|
22621
23277
|
if (isVisioGroupEdit(edit)) return snapshotGroupEdit(edit);
|
|
@@ -24402,8 +25058,8 @@ async function assertShapeOrderPackageScope(pkg, check) {
|
|
|
24402
25058
|
);
|
|
24403
25059
|
}
|
|
24404
25060
|
}
|
|
24405
|
-
for (const
|
|
24406
|
-
if (
|
|
25061
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
25062
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
24407
25063
|
}
|
|
24408
25064
|
}
|
|
24409
25065
|
}
|
|
@@ -24526,177 +25182,6 @@ function analyzeVisioMasterFormula(source, options) {
|
|
|
24526
25182
|
return { ...analysis, references: [...references.values()], dynamic: dynamic2, readsText, readsTheme };
|
|
24527
25183
|
}
|
|
24528
25184
|
|
|
24529
|
-
// visio/edit-master-index.ts
|
|
24530
|
-
function inheritedProtection(node2, ancestor) {
|
|
24531
|
-
try {
|
|
24532
|
-
const boolean2 = (cell) => {
|
|
24533
|
-
if (!cell || cell.hasAttribute("E"))
|
|
24534
|
-
fail("EDIT_PROTECTED_CELL", "Inherited protection has an unresolved or error cache.");
|
|
24535
|
-
const value = visioFormulaCachedValue(attribute2(cell, "V") ?? "", attribute2(cell, "U"));
|
|
24536
|
-
if (value.unit !== "scalar" || ![0, 1].includes(value.value))
|
|
24537
|
-
fail("EDIT_PROTECTED_CELL", "Inherited protection requires scalar boolean caches.");
|
|
24538
|
-
return value.value;
|
|
24539
|
-
};
|
|
24540
|
-
if (boolean2(node2) !== boolean2(ancestor))
|
|
24541
|
-
fail(
|
|
24542
|
-
"EDIT_PROTECTED_CELL",
|
|
24543
|
-
"Delegated master style protection cache disagrees with its ancestor."
|
|
24544
|
-
);
|
|
24545
|
-
} catch (error) {
|
|
24546
|
-
fail(
|
|
24547
|
-
"EDIT_PROTECTED_CELL",
|
|
24548
|
-
`Inherited master style protection cannot be proven: ${error instanceof Error ? error.message : "invalid cache"}`
|
|
24549
|
-
);
|
|
24550
|
-
}
|
|
24551
|
-
}
|
|
24552
|
-
function masterCells(sheet, charge = () => {
|
|
24553
|
-
}) {
|
|
24554
|
-
const result = /* @__PURE__ */ new Map();
|
|
24555
|
-
if (!sheet) return result;
|
|
24556
|
-
const add = (name3, node2) => {
|
|
24557
|
-
charge();
|
|
24558
|
-
const id3 = name3.toLowerCase();
|
|
24559
|
-
if (result.has(id3) && result.get(id3) !== node2)
|
|
24560
|
-
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous effective master cells.");
|
|
24561
|
-
result.set(id3, node2);
|
|
24562
|
-
};
|
|
24563
|
-
for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
|
|
24564
|
-
for (const section2 of children2(sheet, "Section")) {
|
|
24565
|
-
const name3 = attribute2(section2, "N") ?? "";
|
|
24566
|
-
const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section2, "IX") ?? "0") + 1}` : name3 === "Control" ? "Controls" : name3;
|
|
24567
|
-
for (const node2 of children2(section2, "Cell"))
|
|
24568
|
-
add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
|
|
24569
|
-
for (const row2 of children2(section2, "Row"))
|
|
24570
|
-
for (const node2 of children2(row2, "Cell")) {
|
|
24571
|
-
const n = attribute2(node2, "N") ?? "";
|
|
24572
|
-
const rowName = attribute2(row2, "N");
|
|
24573
|
-
const index = attribute2(row2, "IX") ?? (prefix2 === "Controls" && /^Row_\d+$/.test(rowName ?? "") ? String(Number(rowName.slice(4)) - 1) : void 0);
|
|
24574
|
-
const ix = index ?? "0", r = rowName ?? (prefix2 === "Controls" ? `Row_${Number(ix) + 1}` : ix);
|
|
24575
|
-
add(
|
|
24576
|
-
name3 === "Geometry" || ["Controls", "Scratch", "Connection"].includes(prefix2) ? `${prefix2}.${n}${ix}` : n === "Value" && ["User", "Prop"].includes(name3) ? `${prefix2}.${r}` : `${prefix2}.${r}.${n}`,
|
|
24577
|
-
node2
|
|
24578
|
-
);
|
|
24579
|
-
if (name3 !== "Geometry") add(`${prefix2}.${r}.${n}`, node2);
|
|
24580
|
-
if (prefix2 === "Controls" && n === "X") add(`${prefix2}.${r}`, node2);
|
|
24581
|
-
if (name3 !== "Geometry" && index !== void 0) add(`${prefix2}.$row${ix}.${n}`, node2);
|
|
24582
|
-
}
|
|
24583
|
-
}
|
|
24584
|
-
return result;
|
|
24585
|
-
}
|
|
24586
|
-
function masterShapes(root2) {
|
|
24587
|
-
const result = [], pending = [root2];
|
|
24588
|
-
while (pending.length) {
|
|
24589
|
-
const parent = pending.pop();
|
|
24590
|
-
for (const container of children2(parent, "Shapes"))
|
|
24591
|
-
for (const shape of children2(container, "Shape")) {
|
|
24592
|
-
result.push(shape);
|
|
24593
|
-
pending.push(shape);
|
|
24594
|
-
}
|
|
24595
|
-
}
|
|
24596
|
-
return result;
|
|
24597
|
-
}
|
|
24598
|
-
function assertMasterMarkup(root2, known, check) {
|
|
24599
|
-
for (const node2 of [root2, ...Array.from(root2.getElementsByTagName("*"))]) {
|
|
24600
|
-
check();
|
|
24601
|
-
if (node2.namespaceURI === root2.namespaceURI && node2.hasAttribute("F") && !known.has(node2))
|
|
24602
|
-
fail(
|
|
24603
|
-
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
24604
|
-
"Master formula outside admitted sheet cells has unknown scope."
|
|
24605
|
-
);
|
|
24606
|
-
}
|
|
24607
|
-
}
|
|
24608
|
-
function masterStyleCells(document, template, instance, check, charge = () => {
|
|
24609
|
-
}, verifyMovementProtection = false) {
|
|
24610
|
-
const styles = /* @__PURE__ */ new Map();
|
|
24611
|
-
for (const container of children2(document, "StyleSheets"))
|
|
24612
|
-
for (const style2 of children2(container, "StyleSheet")) {
|
|
24613
|
-
charge();
|
|
24614
|
-
const id3 = attribute2(style2, "ID");
|
|
24615
|
-
if (!id3 || styles.has(id3))
|
|
24616
|
-
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous master style IDs.");
|
|
24617
|
-
styles.set(id3, style2);
|
|
24618
|
-
}
|
|
24619
|
-
const defaults = children2(document, "DocumentSheet")[0];
|
|
24620
|
-
const collect = (id3, category, seen = /* @__PURE__ */ new Set()) => {
|
|
24621
|
-
check();
|
|
24622
|
-
if (seen.has(id3) || seen.size >= 64)
|
|
24623
|
-
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Invalid inherited master style ancestry.");
|
|
24624
|
-
seen.add(id3);
|
|
24625
|
-
const style2 = styles.get(id3);
|
|
24626
|
-
if (!style2) fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Missing inherited master style.");
|
|
24627
|
-
const own = masterCells(style2, charge);
|
|
24628
|
-
assertMasterMarkup(style2, new Set(own.values()), check);
|
|
24629
|
-
const parent = attribute2(style2, category);
|
|
24630
|
-
const result2 = parent !== void 0 && parent !== id3 ? collect(parent, category, seen) : /* @__PURE__ */ new Map();
|
|
24631
|
-
for (const [name3, node2] of own) {
|
|
24632
|
-
charge();
|
|
24633
|
-
if (attribute2(node2, "F") !== "Inh") result2.set(name3, node2);
|
|
24634
|
-
else if (verifyMovementProtection && /^lock(move[xy]|width|height|aspect|delete)$/.test(name3)) {
|
|
24635
|
-
charge();
|
|
24636
|
-
inheritedProtection(node2, result2.get(name3));
|
|
24637
|
-
}
|
|
24638
|
-
}
|
|
24639
|
-
return result2;
|
|
24640
|
-
};
|
|
24641
|
-
const result = /* @__PURE__ */ new Map();
|
|
24642
|
-
for (const category of ["LineStyle", "FillStyle", "TextStyle"]) {
|
|
24643
|
-
const id3 = attribute2(instance, category) ?? attribute2(template, category) ?? attribute2(defaults, category) ?? (styles.has("0") ? "0" : void 0);
|
|
24644
|
-
if (id3 !== void 0)
|
|
24645
|
-
for (const [name3, node2] of collect(id3, category)) {
|
|
24646
|
-
charge();
|
|
24647
|
-
if (result.has(name3) && result.get(name3) !== node2)
|
|
24648
|
-
fail(
|
|
24649
|
-
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
24650
|
-
"Master style categories have ambiguous overlapping inputs."
|
|
24651
|
-
);
|
|
24652
|
-
result.set(name3, node2);
|
|
24653
|
-
}
|
|
24654
|
-
}
|
|
24655
|
-
return result;
|
|
24656
|
-
}
|
|
24657
|
-
function overlay(cells4, additions, kind, charge) {
|
|
24658
|
-
const aliases = /* @__PURE__ */ new Map(), inherited = /* @__PURE__ */ new Map();
|
|
24659
|
-
for (const [name3, source] of cells4) {
|
|
24660
|
-
charge();
|
|
24661
|
-
const names = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
24662
|
-
names.add(name3);
|
|
24663
|
-
aliases.set(source.node, names);
|
|
24664
|
-
}
|
|
24665
|
-
for (const [name3, node2] of additions) {
|
|
24666
|
-
charge();
|
|
24667
|
-
const source = cells4.get(name3);
|
|
24668
|
-
if (source) inherited.set(node2, source);
|
|
24669
|
-
}
|
|
24670
|
-
for (const [name3, node2] of additions) {
|
|
24671
|
-
charge();
|
|
24672
|
-
if (attribute2(node2, "F") === "Inh") {
|
|
24673
|
-
const source = cells4.get(name3) ?? inherited.get(node2);
|
|
24674
|
-
if (!source)
|
|
24675
|
-
fail(
|
|
24676
|
-
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
24677
|
-
"Inherited master cell has no effective source."
|
|
24678
|
-
);
|
|
24679
|
-
cells4.set(name3, source);
|
|
24680
|
-
const names2 = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
24681
|
-
names2.add(name3);
|
|
24682
|
-
aliases.set(source.node, names2);
|
|
24683
|
-
continue;
|
|
24684
|
-
}
|
|
24685
|
-
const previous = cells4.get(name3), names = aliases.get(node2) ?? /* @__PURE__ */ new Set();
|
|
24686
|
-
if (previous && previous.node !== node2) {
|
|
24687
|
-
for (const alias of aliases.get(previous.node) ?? []) {
|
|
24688
|
-
charge();
|
|
24689
|
-
cells4.set(alias, { node: node2, kind });
|
|
24690
|
-
names.add(alias);
|
|
24691
|
-
}
|
|
24692
|
-
aliases.delete(previous.node);
|
|
24693
|
-
}
|
|
24694
|
-
cells4.set(name3, { node: node2, kind });
|
|
24695
|
-
names.add(name3);
|
|
24696
|
-
aliases.set(node2, names);
|
|
24697
|
-
}
|
|
24698
|
-
}
|
|
24699
|
-
|
|
24700
25185
|
// visio/edit-master-scope.ts
|
|
24701
25186
|
function problem(message) {
|
|
24702
25187
|
return fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", message);
|
|
@@ -25060,10 +25545,10 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
25060
25545
|
))
|
|
25061
25546
|
fail("EDIT_REFERENCED_DELETE", "Scoped metadata references the deleted shape.");
|
|
25062
25547
|
}
|
|
25063
|
-
for (const
|
|
25064
|
-
if (
|
|
25548
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
25549
|
+
if (child3.nodeType === 1)
|
|
25065
25550
|
pending.push({
|
|
25066
|
-
node:
|
|
25551
|
+
node: child3,
|
|
25067
25552
|
style: style2,
|
|
25068
25553
|
...pageId2 === void 0 ? {} : { pageId: pageId2 }
|
|
25069
25554
|
});
|
|
@@ -27262,7 +27747,7 @@ function changeVisioShape(roots, document, edit, check) {
|
|
|
27262
27747
|
const outline = target2 === "ellipse" || target2 === "circle" ? void 0 : visioBasicShapeOutline(target2);
|
|
27263
27748
|
const replacement = outline ? outlineGeometrySections(shape, outline) : [ellipseGeometrySection(shape, width, height)];
|
|
27264
27749
|
const old = geometrySections(shape);
|
|
27265
|
-
const anchor = old[0] ?? Array.from(shape.children).find((
|
|
27750
|
+
const anchor = old[0] ?? Array.from(shape.children).find((child3) => AFTER_SECTIONS.has(child3.localName)) ?? null;
|
|
27266
27751
|
const changed = [];
|
|
27267
27752
|
const rounding = outline?.rounding ? outline.rounding * Math.min(width, height) : 0;
|
|
27268
27753
|
const roundingCell = local.get("Rounding");
|
|
@@ -28561,7 +29046,7 @@ function valueCell2(parent, name3, value, unit2) {
|
|
|
28561
29046
|
cell.setAttribute("V", value);
|
|
28562
29047
|
if (unit2) cell.setAttribute("U", unit2);
|
|
28563
29048
|
const before = Array.from(parent.childNodes).find(
|
|
28564
|
-
(
|
|
29049
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
28565
29050
|
);
|
|
28566
29051
|
parent.insertBefore(cell, before ?? null);
|
|
28567
29052
|
}
|
|
@@ -29084,6 +29569,21 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
|
|
|
29084
29569
|
check
|
|
29085
29570
|
);
|
|
29086
29571
|
}
|
|
29572
|
+
const layerFlags = allCommands.filter((command2) => command2.type === "set-layer-properties");
|
|
29573
|
+
if (layerFlags.length) {
|
|
29574
|
+
if (layerFlags.length !== allCommands.length)
|
|
29575
|
+
fail("EDIT_MIXED_LAYER_TRANSACTION", "Layer properties require their own transaction.");
|
|
29576
|
+
return editVsdxLayerProperties(
|
|
29577
|
+
pkg,
|
|
29578
|
+
parts,
|
|
29579
|
+
pages,
|
|
29580
|
+
layerFlags,
|
|
29581
|
+
limits,
|
|
29582
|
+
maxOutput,
|
|
29583
|
+
deadline,
|
|
29584
|
+
check
|
|
29585
|
+
);
|
|
29586
|
+
}
|
|
29087
29587
|
const layers = allCommands.filter((command2) => command2.type === "assign-layers");
|
|
29088
29588
|
if (layers.length) {
|
|
29089
29589
|
if (layers.length !== allCommands.length)
|
|
@@ -29265,7 +29765,7 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
|
|
|
29265
29765
|
))
|
|
29266
29766
|
dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
29267
29767
|
duplicateChanged = true;
|
|
29268
|
-
} else if (command2.type !== "insert-picture" && command2.type !== "set-page-theme" && command2.type !== "create-subprocess" && !isVisioCommentEdit(command2) && !isVisioDataEdit(command2) && command2.type !== "assign-layers") {
|
|
29768
|
+
} else if (command2.type !== "insert-picture" && command2.type !== "set-page-theme" && command2.type !== "create-subprocess" && !isVisioCommentEdit(command2) && !isVisioDataEdit(command2) && command2.type !== "assign-layers" && command2.type !== "set-layer-properties") {
|
|
29269
29769
|
for (const pageId2 of applyGeometryEdit(roots, document, command2, check, masterMovePins))
|
|
29270
29770
|
dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
29271
29771
|
}
|
|
@@ -29396,10 +29896,10 @@ function buildContentTypesXml(types) {
|
|
|
29396
29896
|
|
|
29397
29897
|
// visio/create-document.ts
|
|
29398
29898
|
function element(parent, name3, attributes = {}) {
|
|
29399
|
-
const
|
|
29400
|
-
for (const [key2, value] of Object.entries(attributes))
|
|
29401
|
-
parent.appendChild(
|
|
29402
|
-
return
|
|
29899
|
+
const child3 = parent.ownerDocument.createElementNS(VISIO_NS, name3);
|
|
29900
|
+
for (const [key2, value] of Object.entries(attributes)) child3.setAttribute(key2, value);
|
|
29901
|
+
parent.appendChild(child3);
|
|
29902
|
+
return child3;
|
|
29403
29903
|
}
|
|
29404
29904
|
function root(name3) {
|
|
29405
29905
|
const result = parseXml(`<${name3} xmlns="${VISIO_NS}"/>`).documentElement;
|