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.mjs
CHANGED
|
@@ -439,8 +439,8 @@ function inspectNamespaces(root2, check) {
|
|
|
439
439
|
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))
|
|
440
440
|
fail("INVALID_XML", "Invalid reserved XML namespace binding");
|
|
441
441
|
}
|
|
442
|
-
for (const
|
|
443
|
-
if (
|
|
442
|
+
for (const child3 of Array.from(element2.childNodes))
|
|
443
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
|
|
@@ -695,7 +695,7 @@ function metadataAttributes(node2) {
|
|
|
695
695
|
var VISIO_NS = "http://schemas.microsoft.com/office/visio/2012/main";
|
|
696
696
|
var VISIO_LEGACY_NS = "http://schemas.microsoft.com/office/visio/2011/1/core";
|
|
697
697
|
var children2 = (node2, name3) => node2 ? elements(node2).filter(
|
|
698
|
-
(
|
|
698
|
+
(child3) => child3.localName === name3 && (child3.namespaceURI === VISIO_NS || child3.namespaceURI === VISIO_LEGACY_NS)
|
|
699
699
|
) : [];
|
|
700
700
|
var child = (node2, name3) => children2(node2, name3)[0];
|
|
701
701
|
var attribute2 = (node2, name3) => node2?.getAttribute(name3) ?? void 0;
|
|
@@ -2263,7 +2263,7 @@ function setCell(shape, name3, value, formula) {
|
|
|
2263
2263
|
node2 = shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
|
|
2264
2264
|
node2.setAttribute("N", name3);
|
|
2265
2265
|
const before = Array.from(shape.childNodes).find(
|
|
2266
|
-
(
|
|
2266
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
2267
2267
|
);
|
|
2268
2268
|
shape.insertBefore(node2, before ?? null);
|
|
2269
2269
|
}
|
|
@@ -4101,7 +4101,7 @@ function assertUnlayeredShape(shape, document) {
|
|
|
4101
4101
|
}
|
|
4102
4102
|
|
|
4103
4103
|
// visio/edit-text-target.ts
|
|
4104
|
-
function
|
|
4104
|
+
function textTarget(root2, shapeId2, check) {
|
|
4105
4105
|
const shapeChildren = (parent) => {
|
|
4106
4106
|
const containers = children2(parent, "Shapes");
|
|
4107
4107
|
if (containers.length > 1)
|
|
@@ -4109,35 +4109,145 @@ function localTextTarget(root2, document, shapeId2, check) {
|
|
|
4109
4109
|
return children2(containers[0], "Shape");
|
|
4110
4110
|
};
|
|
4111
4111
|
const shapes = /* @__PURE__ */ new Map();
|
|
4112
|
-
const pending = shapeChildren(root2).map((node2) => ({
|
|
4112
|
+
const pending = shapeChildren(root2).map((node2) => ({
|
|
4113
|
+
node: node2,
|
|
4114
|
+
masterId: void 0,
|
|
4115
|
+
deleted: false
|
|
4116
|
+
}));
|
|
4113
4117
|
while (pending.length) {
|
|
4114
4118
|
check();
|
|
4115
4119
|
const item = pending.pop(), id3 = attribute2(item.node, "ID");
|
|
4116
4120
|
if (!id3 || shapes.has(id3))
|
|
4117
4121
|
fail("INVALID_SHAPE_ID", "Local shape IDs must be present and unique.");
|
|
4118
|
-
const
|
|
4122
|
+
const masterId = attribute2(item.node, "Master") ?? item.masterId;
|
|
4119
4123
|
const deleted = item.deleted || ["1", "true"].includes(attribute2(item.node, "Del") ?? "");
|
|
4120
|
-
shapes.set(id3, { node: item.node,
|
|
4121
|
-
for (const node2 of shapeChildren(item.node)) pending.push({ node: node2,
|
|
4124
|
+
shapes.set(id3, { node: item.node, masterId, deleted });
|
|
4125
|
+
for (const node2 of shapeChildren(item.node)) pending.push({ node: node2, masterId, deleted });
|
|
4122
4126
|
}
|
|
4123
4127
|
const target2 = shapes.get(shapeId2);
|
|
4124
4128
|
if (!target2) fail("EDIT_TARGET_NOT_FOUND", "Local shape does not exist.");
|
|
4125
|
-
if (target2.
|
|
4126
|
-
|
|
4129
|
+
if (target2.deleted) fail("UNSUPPORTED_TEXT_EDIT", "Deleted shapes cannot be edited.");
|
|
4130
|
+
const masterShapeId = attribute2(target2.node, "MasterShape");
|
|
4131
|
+
if (masterShapeId !== void 0 && target2.masterId === void 0)
|
|
4132
|
+
fail("UNSUPPORTED_TEXT_EDIT", "The shape refers to a master that is not on this page.");
|
|
4133
|
+
return {
|
|
4134
|
+
node: target2.node,
|
|
4135
|
+
...target2.masterId !== void 0 ? { masterId: target2.masterId } : {},
|
|
4136
|
+
...masterShapeId !== void 0 ? { masterShapeId } : {}
|
|
4137
|
+
};
|
|
4138
|
+
}
|
|
4139
|
+
function localTextTarget(root2, document, shapeId2, check) {
|
|
4140
|
+
const target2 = textTarget(root2, shapeId2, check);
|
|
4141
|
+
if (target2.masterId !== void 0)
|
|
4142
|
+
fail("UNSUPPORTED_TEXT_EDIT", "Text ranges and fields of stencil shapes cannot be edited.");
|
|
4127
4143
|
assertShapeLocks(target2.node, document, ["LockTextEdit"]);
|
|
4128
4144
|
return target2.node;
|
|
4129
4145
|
}
|
|
4130
4146
|
|
|
4147
|
+
// visio/edit-text-instance.ts
|
|
4148
|
+
var fieldSections = (shape) => children2(shape, "Section").filter((section2) => attribute2(section2, "N") === "Field");
|
|
4149
|
+
var isMarkup = (node2) => node2.nodeType !== 3 && node2.nodeType !== 4;
|
|
4150
|
+
var knownMarkup = (text3) => Array.from(text3.childNodes).every(
|
|
4151
|
+
(node2) => !isMarkup(node2) || ["cp", "pp", "tp", "fld"].includes(node2.localName)
|
|
4152
|
+
);
|
|
4153
|
+
function assertUnlocked(shape, template) {
|
|
4154
|
+
const local = children2(shape, "Cell").some((cell) => attribute2(cell, "N") === "LockTextEdit");
|
|
4155
|
+
for (const cell of children2(local ? shape : template, "Cell")) {
|
|
4156
|
+
if (attribute2(cell, "N") !== "LockTextEdit") continue;
|
|
4157
|
+
if (cell.hasAttribute("E") || cell.hasAttribute("F") || Number(attribute2(cell, "V")) !== 0)
|
|
4158
|
+
fail("EDIT_PROTECTED_CELL", "The shape is protected against text editing.");
|
|
4159
|
+
}
|
|
4160
|
+
}
|
|
4161
|
+
function single(shape, what) {
|
|
4162
|
+
const texts = children2(shape, "Text");
|
|
4163
|
+
if (texts.length > 1) fail("UNSUPPORTED_TEXT_EDIT", `${what} has more than one Text element.`);
|
|
4164
|
+
return texts[0];
|
|
4165
|
+
}
|
|
4166
|
+
function insertBeforeTail(shape, node2, tail) {
|
|
4167
|
+
const after = Array.from(shape.childNodes).find(
|
|
4168
|
+
(child3) => child3.nodeType === 1 && tail.includes(child3.localName)
|
|
4169
|
+
);
|
|
4170
|
+
shape.insertBefore(node2, after ?? null);
|
|
4171
|
+
}
|
|
4172
|
+
var AFTER_TEXT = ["Data1", "Data2", "Data3", "ForeignData", "Shapes"];
|
|
4173
|
+
function replaceInstanceText(shape, template, text3) {
|
|
4174
|
+
const local = single(shape, "The shape");
|
|
4175
|
+
const inherited = single(template, "The master shape");
|
|
4176
|
+
if (local && Array.from(local.childNodes).some(isMarkup))
|
|
4177
|
+
fail(
|
|
4178
|
+
"UNSUPPORTED_TEXT_EDIT",
|
|
4179
|
+
"This stencil shape has its own formatted text; edit part of the text instead."
|
|
4180
|
+
);
|
|
4181
|
+
if (!local && inherited && !knownMarkup(inherited))
|
|
4182
|
+
fail("UNSUPPORTED_TEXT_EDIT", "The master text has markup this editor does not know.");
|
|
4183
|
+
if (fieldSections(shape).length)
|
|
4184
|
+
fail("UNSUPPORTED_TEXT_EDIT", "This stencil shape has its own text fields; edit around them.");
|
|
4185
|
+
assertUnlocked(shape, template);
|
|
4186
|
+
const fields = local ? [] : fieldSections(template).flatMap((section2) => children2(section2, "Row"));
|
|
4187
|
+
const current = local ?? inherited;
|
|
4188
|
+
if (!fields.length && current && !Array.from(current.childNodes).some(isMarkup)) {
|
|
4189
|
+
if (decodeVisioPlainText(current.textContent ?? "") === text3) return false;
|
|
4190
|
+
}
|
|
4191
|
+
const document = shape.ownerDocument;
|
|
4192
|
+
if (fields.length) {
|
|
4193
|
+
const section2 = document.createElementNS(shape.namespaceURI, "Section");
|
|
4194
|
+
section2.setAttribute("N", "Field");
|
|
4195
|
+
for (const row2 of fields) {
|
|
4196
|
+
const index = attribute2(row2, "IX");
|
|
4197
|
+
if (index === void 0)
|
|
4198
|
+
fail("UNSUPPORTED_TEXT_EDIT", "The master text fields cannot be identified.");
|
|
4199
|
+
const removed = document.createElementNS(shape.namespaceURI, "Row");
|
|
4200
|
+
removed.setAttribute("IX", index);
|
|
4201
|
+
removed.setAttribute("Del", "1");
|
|
4202
|
+
section2.appendChild(removed);
|
|
4203
|
+
}
|
|
4204
|
+
insertBeforeTail(shape, section2, ["Text", ...AFTER_TEXT]);
|
|
4205
|
+
}
|
|
4206
|
+
let node2 = local;
|
|
4207
|
+
if (!node2) {
|
|
4208
|
+
node2 = document.createElementNS(shape.namespaceURI, "Text");
|
|
4209
|
+
insertBeforeTail(shape, node2, AFTER_TEXT);
|
|
4210
|
+
}
|
|
4211
|
+
while (node2.firstChild) node2.removeChild(node2.firstChild);
|
|
4212
|
+
node2.appendChild(document.createTextNode(encodeVisioPlainText(text3)));
|
|
4213
|
+
return true;
|
|
4214
|
+
}
|
|
4215
|
+
function instanceTextNode(shape, template) {
|
|
4216
|
+
const local = single(shape, "The shape");
|
|
4217
|
+
assertUnlocked(shape, template);
|
|
4218
|
+
if (local) return { text: local, discard: () => {
|
|
4219
|
+
} };
|
|
4220
|
+
const inherited = single(template, "The master shape");
|
|
4221
|
+
if (!inherited) fail("UNSUPPORTED_TEXT_RANGE", "The stencil shape has no text to edit.");
|
|
4222
|
+
if (!knownMarkup(inherited))
|
|
4223
|
+
fail("UNSUPPORTED_TEXT_RANGE", "The master text has markup this editor does not know.");
|
|
4224
|
+
if (fieldSections(shape).length)
|
|
4225
|
+
fail("UNSUPPORTED_TEXT_RANGE", "This stencil shape overrides its master text fields.");
|
|
4226
|
+
const text3 = shape.ownerDocument.importNode(inherited, true);
|
|
4227
|
+
insertBeforeTail(shape, text3, AFTER_TEXT);
|
|
4228
|
+
return { text: text3, discard: () => void shape.removeChild(text3) };
|
|
4229
|
+
}
|
|
4230
|
+
|
|
4131
4231
|
// visio/edit-text.ts
|
|
4132
|
-
|
|
4232
|
+
var plain = (node2) => Array.from(node2.childNodes).every((item) => item.nodeType === 3 || item.nodeType === 4);
|
|
4233
|
+
var hasFields = (shape) => children2(shape, "Section").some((section2) => attribute2(section2, "N") === "Field");
|
|
4234
|
+
async function replacePlainText(root2, document, shapeId2, text3, check, assertDependencies2, masterTemplate2) {
|
|
4235
|
+
const found = textTarget(root2, shapeId2, check);
|
|
4236
|
+
if (found.masterId !== void 0) {
|
|
4237
|
+
if (!masterTemplate2)
|
|
4238
|
+
fail("UNSUPPORTED_TEXT_EDIT", "Stencil shapes cannot be edited without their masters.");
|
|
4239
|
+
const template = await masterTemplate2(found.masterId, found.masterShapeId);
|
|
4240
|
+
check();
|
|
4241
|
+
return replaceInstanceText(found.node, template, text3);
|
|
4242
|
+
}
|
|
4133
4243
|
const target2 = localTextTarget(root2, document, shapeId2, check);
|
|
4134
4244
|
const texts = children2(target2, "Text");
|
|
4135
4245
|
if (texts.length !== 1)
|
|
4136
4246
|
fail("UNSUPPORTED_TEXT_EDIT", "Editing requires one existing local Text element.");
|
|
4137
4247
|
const node2 = texts[0];
|
|
4138
|
-
if (
|
|
4248
|
+
if (!plain(node2))
|
|
4139
4249
|
fail("UNSUPPORTED_TEXT_EDIT", "Rich text, fields and unknown text markup cannot be edited.");
|
|
4140
|
-
if (
|
|
4250
|
+
if (hasFields(target2))
|
|
4141
4251
|
fail(
|
|
4142
4252
|
"UNSUPPORTED_TEXT_EDIT",
|
|
4143
4253
|
"Replacing all text would remove its text fields; edit the text around the fields instead."
|
|
@@ -4162,7 +4272,7 @@ function serializeEditedXml(root2, limits, check) {
|
|
|
4162
4272
|
if (/[\t\r\n]/.test(attr2.value))
|
|
4163
4273
|
fail("UNSUPPORTED_XML_EDIT", "Attribute whitespace cannot be preserved by this writer.");
|
|
4164
4274
|
}
|
|
4165
|
-
for (const
|
|
4275
|
+
for (const child3 of Array.from(node2.childNodes)) pending.push(child3);
|
|
4166
4276
|
}
|
|
4167
4277
|
let xml = buildXml(root2.ownerDocument);
|
|
4168
4278
|
xml = xml.replace(
|
|
@@ -5891,7 +6001,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5891
6001
|
const p = target2.paint;
|
|
5892
6002
|
characters += p.fill.length + p.stroke.length + p.fillRule.length + p.strokeLinecap.length + p.strokeLinejoin.length;
|
|
5893
6003
|
}
|
|
5894
|
-
} else for (const
|
|
6004
|
+
} else for (const child3 of target2.items) strings(child3);
|
|
5895
6005
|
if (characters > limits.maxCharacters) limit("Retained vector character limit exceeded.");
|
|
5896
6006
|
}
|
|
5897
6007
|
for (const clip of scene.clips) strings(clip);
|
|
@@ -5937,7 +6047,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5937
6047
|
finite2(extent2 * (Math.abs(matrix3[0]) + Math.abs(matrix3[2])), limits.maxCoordinate);
|
|
5938
6048
|
finite2(extent2 * (Math.abs(matrix3[1]) + Math.abs(matrix3[3])), limits.maxCoordinate);
|
|
5939
6049
|
}
|
|
5940
|
-
} else for (const
|
|
6050
|
+
} else for (const child3 of target2.items) content2(child3, matrix3, depth + 1);
|
|
5941
6051
|
if (target2.clipIndex !== void 0) content2(scene.clips[target2.clipIndex], matrix3, depth + 1);
|
|
5942
6052
|
}
|
|
5943
6053
|
for (const clip of scene.clips) content2(clip, IDENTITY, 1);
|
|
@@ -6068,7 +6178,7 @@ function validate(value, limits) {
|
|
|
6068
6178
|
kind: "group",
|
|
6069
6179
|
...base(node2),
|
|
6070
6180
|
items: Object.freeze(
|
|
6071
|
-
array(node2.items, limits.maxNodes - nodes).map((
|
|
6181
|
+
array(node2.items, limits.maxNodes - nodes).map((child3) => item(child3, depth + 1))
|
|
6072
6182
|
)
|
|
6073
6183
|
});
|
|
6074
6184
|
}
|
|
@@ -6076,11 +6186,11 @@ function validate(value, limits) {
|
|
|
6076
6186
|
const node2 = own(input, ["matrix", "clipIndex", "items"], depth);
|
|
6077
6187
|
const items2 = [];
|
|
6078
6188
|
for (const value2 of array(node2.items, limits.maxNodes - nodes)) {
|
|
6079
|
-
const
|
|
6080
|
-
if (
|
|
6189
|
+
const child3 = own(value2, ["matrix", "clipIndex", "commands", "clipRule"], depth + 1);
|
|
6190
|
+
if (child3.clipRule !== "nonzero" && child3.clipRule !== "evenodd")
|
|
6081
6191
|
unsafe("Invalid normalized clip rule.");
|
|
6082
6192
|
items2.push(
|
|
6083
|
-
Object.freeze({ ...base(
|
|
6193
|
+
Object.freeze({ ...base(child3), commands: path(child3.commands), clipRule: child3.clipRule })
|
|
6084
6194
|
);
|
|
6085
6195
|
}
|
|
6086
6196
|
return Object.freeze({ ...base(node2), items: Object.freeze(items2) });
|
|
@@ -6206,7 +6316,7 @@ function sanitize(root2, limits) {
|
|
|
6206
6316
|
paint: paint(data2.attrs)
|
|
6207
6317
|
}) : Object.assign(target2, {
|
|
6208
6318
|
kind: "group",
|
|
6209
|
-
items: Object.freeze(children5(data2.children).map((
|
|
6319
|
+
items: Object.freeze(children5(data2.children).map((child3) => item(child3, depth + 1)))
|
|
6210
6320
|
});
|
|
6211
6321
|
freezeLater.push(result);
|
|
6212
6322
|
return result;
|
|
@@ -6223,8 +6333,8 @@ function sanitize(root2, limits) {
|
|
|
6223
6333
|
ids.set(id3, clips.length);
|
|
6224
6334
|
const target2 = base(data2.attrs);
|
|
6225
6335
|
const paths = [];
|
|
6226
|
-
for (const
|
|
6227
|
-
const part = node2(
|
|
6336
|
+
for (const child3 of children5(data2.children)) {
|
|
6337
|
+
const part = node2(child3, depth + 1, true);
|
|
6228
6338
|
if (part.tag !== "path") unsafe("Clip content must be a path.");
|
|
6229
6339
|
const path = Object.assign(base(part.attrs), {
|
|
6230
6340
|
commands: leaf(part),
|
|
@@ -6248,12 +6358,12 @@ function sanitize(root2, limits) {
|
|
|
6248
6358
|
if (viewBox[0] !== 0 || viewBox[1] !== 0 || viewBox[2] !== width || viewBox[3] !== height)
|
|
6249
6359
|
unsafe("Viewport differs from dimensions.");
|
|
6250
6360
|
const items = [];
|
|
6251
|
-
for (const
|
|
6252
|
-
const peek = record(
|
|
6361
|
+
for (const child3 of children5(data.children)) {
|
|
6362
|
+
const peek = record(child3, ["tag", "attrs", "children"]);
|
|
6253
6363
|
if (peek.tag === "defs") {
|
|
6254
|
-
const defs = node2(
|
|
6364
|
+
const defs = node2(child3, 1);
|
|
6255
6365
|
for (const value of children5(defs.children)) definition(value, 2);
|
|
6256
|
-
} else items.push(item(
|
|
6366
|
+
} else items.push(item(child3, 1));
|
|
6257
6367
|
}
|
|
6258
6368
|
for (const { target: target2, id: id3 } of pending) {
|
|
6259
6369
|
const index = ids.get(id3);
|
|
@@ -7079,9 +7189,9 @@ function parseDrawingColor(element2) {
|
|
|
7079
7189
|
const color2 = {
|
|
7080
7190
|
kind,
|
|
7081
7191
|
value: colorValue(kind, element2),
|
|
7082
|
-
transforms: elements(element2).map((
|
|
7083
|
-
name:
|
|
7084
|
-
value:
|
|
7192
|
+
transforms: elements(element2).map((child3) => ({
|
|
7193
|
+
name: child3.localName,
|
|
7194
|
+
value: child3.getAttribute("val") ?? ""
|
|
7085
7195
|
}))
|
|
7086
7196
|
};
|
|
7087
7197
|
const fallback = kind === "system" ? element2.getAttribute("lastClr") : null;
|
|
@@ -7262,7 +7372,7 @@ function drawingThemeXml(theme2, parts) {
|
|
|
7262
7372
|
const color2 = theme2.colorScheme.colors[slot];
|
|
7263
7373
|
if (!color2) throw new Error(`The theme colour scheme has no ${slot} colour.`);
|
|
7264
7374
|
const node2 = doc.createElementNS(NS.a, `a:${slot}`);
|
|
7265
|
-
for (const
|
|
7375
|
+
for (const child3 of fragment(node2, drawingColorXml(color2), namespaces)) node2.appendChild(child3);
|
|
7266
7376
|
scheme.appendChild(node2);
|
|
7267
7377
|
}
|
|
7268
7378
|
extensionList(scheme, parts.colorSchemeExtensions, namespaces);
|
|
@@ -7746,7 +7856,7 @@ function legacyFillGradient(cells4, width, height, resolve) {
|
|
|
7746
7856
|
};
|
|
7747
7857
|
}
|
|
7748
7858
|
|
|
7749
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
7859
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
|
|
7750
7860
|
var CRC_TABLE = (() => {
|
|
7751
7861
|
const table2 = new Uint32Array(256);
|
|
7752
7862
|
for (let n = 0; n < 256; n++) {
|
|
@@ -8467,31 +8577,32 @@ var DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "S
|
|
|
8467
8577
|
var pad = (value, length = 2) => String(value).padStart(length, "0");
|
|
8468
8578
|
function formatDate(date2, picture) {
|
|
8469
8579
|
const hours = date2.getUTCHours();
|
|
8470
|
-
const tokens2 =
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8580
|
+
const tokens2 = new Map(
|
|
8581
|
+
Object.entries({
|
|
8582
|
+
yyyy: () => pad(date2.getUTCFullYear(), 4),
|
|
8583
|
+
yy: () => pad(date2.getUTCFullYear() % 100),
|
|
8584
|
+
MMMM: () => MONTHS[date2.getUTCMonth()],
|
|
8585
|
+
MMM: () => MONTHS[date2.getUTCMonth()].slice(0, 3),
|
|
8586
|
+
MM: () => pad(date2.getUTCMonth() + 1),
|
|
8587
|
+
M: () => String(date2.getUTCMonth() + 1),
|
|
8588
|
+
dddd: () => DAYS[date2.getUTCDay()],
|
|
8589
|
+
ddd: () => DAYS[date2.getUTCDay()].slice(0, 3),
|
|
8590
|
+
dd: () => pad(date2.getUTCDate()),
|
|
8591
|
+
d: () => String(date2.getUTCDate()),
|
|
8592
|
+
HH: () => pad(hours),
|
|
8593
|
+
H: () => String(hours),
|
|
8594
|
+
hh: () => pad(hours % 12 || 12),
|
|
8595
|
+
h: () => String(hours % 12 || 12),
|
|
8596
|
+
mm: () => pad(date2.getUTCMinutes()),
|
|
8597
|
+
ss: () => pad(date2.getUTCSeconds()),
|
|
8598
|
+
tt: () => hours < 12 ? "AM" : "PM"
|
|
8599
|
+
})
|
|
8600
|
+
);
|
|
8489
8601
|
return picture.replace(
|
|
8490
8602
|
/yyyy|yy|MMMM|MMM|MM|M|dddd|ddd|dd|d|HH|H|hh|h|mm|ss|tt|"[^"]*"/g,
|
|
8491
8603
|
(token) => {
|
|
8492
8604
|
if (token.startsWith('"')) return token.slice(1, -1);
|
|
8493
|
-
|
|
8494
|
-
return typeof format === "function" ? format() : token;
|
|
8605
|
+
return tokens2.get(token)?.() ?? token;
|
|
8495
8606
|
}
|
|
8496
8607
|
);
|
|
8497
8608
|
}
|
|
@@ -10519,7 +10630,7 @@ function cloneInherited(shape, parentId, context) {
|
|
|
10519
10630
|
return {
|
|
10520
10631
|
...shape,
|
|
10521
10632
|
id: id3,
|
|
10522
|
-
children: shape.children.map((
|
|
10633
|
+
children: shape.children.map((child3) => cloneInherited(child3, id3, context))
|
|
10523
10634
|
};
|
|
10524
10635
|
}
|
|
10525
10636
|
function normalizeShapes(raw, context, depth = 0, masterStack = []) {
|
|
@@ -10902,7 +11013,7 @@ function scan(xml) {
|
|
|
10902
11013
|
}
|
|
10903
11014
|
const children5 = [];
|
|
10904
11015
|
let depth = 0;
|
|
10905
|
-
let
|
|
11016
|
+
let child3;
|
|
10906
11017
|
i = openEnd;
|
|
10907
11018
|
for (; ; ) {
|
|
10908
11019
|
const lt = xml.indexOf("<", i);
|
|
@@ -10920,13 +11031,13 @@ function scan(xml) {
|
|
|
10920
11031
|
return { root: root2, children: children5 };
|
|
10921
11032
|
}
|
|
10922
11033
|
depth--;
|
|
10923
|
-
if (depth === 0 &&
|
|
10924
|
-
children5.push({ ...
|
|
11034
|
+
if (depth === 0 && child3)
|
|
11035
|
+
children5.push({ ...child3, closeStart: lt, end, selfClosing: false });
|
|
10925
11036
|
} else if (xml[end - 2] === "/") {
|
|
10926
11037
|
if (depth === 0)
|
|
10927
11038
|
children5.push({ start: lt, openEnd: end, closeStart: end, end, selfClosing: true });
|
|
10928
11039
|
} else {
|
|
10929
|
-
if (depth === 0)
|
|
11040
|
+
if (depth === 0) child3 = { start: lt, openEnd: end };
|
|
10930
11041
|
depth++;
|
|
10931
11042
|
}
|
|
10932
11043
|
}
|
|
@@ -11589,7 +11700,7 @@ function getVisioPageLayers(document, pageId2) {
|
|
|
11589
11700
|
return result.reverse();
|
|
11590
11701
|
}
|
|
11591
11702
|
|
|
11592
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11703
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
|
|
11593
11704
|
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
11594
11705
|
var ENDOFCHAIN = 4294967294;
|
|
11595
11706
|
var FREESECT = 4294967295;
|
|
@@ -11597,7 +11708,9 @@ var FATSECT = 4294967293;
|
|
|
11597
11708
|
var DIFSECT = 4294967292;
|
|
11598
11709
|
var MAXREGSECT = 4294967290;
|
|
11599
11710
|
var ENTRY_TYPE_EMPTY = 0;
|
|
11711
|
+
var ENTRY_TYPE_STORAGE = 1;
|
|
11600
11712
|
var ENTRY_TYPE_STREAM = 2;
|
|
11713
|
+
var NOSTREAM = 4294967295;
|
|
11601
11714
|
var ENTRY_TYPE_ROOT = 5;
|
|
11602
11715
|
var DIR_ENTRY_SIZE = 128;
|
|
11603
11716
|
var Ole2ParseError = class extends Error {
|
|
@@ -11607,10 +11720,174 @@ var Ole2ParseError = class extends Error {
|
|
|
11607
11720
|
}
|
|
11608
11721
|
};
|
|
11609
11722
|
|
|
11610
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
const
|
|
11723
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
|
|
11724
|
+
var FILETIME_UNIX_EPOCH = 116444736000000000n;
|
|
11725
|
+
function readFileTime(view2, offset) {
|
|
11726
|
+
const ticks = view2.getBigUint64(offset, true);
|
|
11727
|
+
if (ticks === 0n)
|
|
11728
|
+
return void 0;
|
|
11729
|
+
const ms = Number((ticks - FILETIME_UNIX_EPOCH) / 10000n);
|
|
11730
|
+
const date2 = new Date(ms);
|
|
11731
|
+
return Number.isNaN(date2.getTime()) ? void 0 : date2;
|
|
11732
|
+
}
|
|
11733
|
+
function decodeSlot(dir, id3, majorVersion, warnings) {
|
|
11734
|
+
const view2 = new DataView(dir.buffer, dir.byteOffset + id3 * DIR_ENTRY_SIZE, DIR_ENTRY_SIZE);
|
|
11735
|
+
const nameLen = view2.getUint16(64, true);
|
|
11736
|
+
const type = view2.getUint8(66);
|
|
11737
|
+
const nameValid = nameLen >= 2 && nameLen <= 64 && nameLen % 2 === 0 && view2.getUint16(nameLen - 2, true) === 0;
|
|
11738
|
+
let name3 = "";
|
|
11739
|
+
if (nameValid)
|
|
11740
|
+
for (let j = 0; j < nameLen - 2; j += 2)
|
|
11741
|
+
name3 += String.fromCharCode(view2.getUint16(j, true));
|
|
11742
|
+
const link = (offset) => {
|
|
11743
|
+
const value = view2.getUint32(offset, true);
|
|
11744
|
+
return value === NOSTREAM ? -1 : value;
|
|
11745
|
+
};
|
|
11746
|
+
const sizeLow = view2.getUint32(120, true);
|
|
11747
|
+
const sizeHigh = view2.getUint32(124, true);
|
|
11748
|
+
let size3 = sizeLow;
|
|
11749
|
+
if (majorVersion === 4)
|
|
11750
|
+
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11751
|
+
else if (sizeHigh !== 0 && type !== ENTRY_TYPE_EMPTY) {
|
|
11752
|
+
warnings.push({ code: "size-high-bits", message: `Ignored v3 stream-size high bits on directory entry ${id3}` });
|
|
11753
|
+
}
|
|
11754
|
+
return {
|
|
11755
|
+
id: id3,
|
|
11756
|
+
type,
|
|
11757
|
+
nameValid,
|
|
11758
|
+
entry: {
|
|
11759
|
+
id: id3,
|
|
11760
|
+
name: name3,
|
|
11761
|
+
type,
|
|
11762
|
+
color: view2.getUint8(67),
|
|
11763
|
+
leftSiblingId: link(68),
|
|
11764
|
+
rightSiblingId: link(72),
|
|
11765
|
+
childId: link(76),
|
|
11766
|
+
clsid: new Uint8Array(view2.buffer.slice(view2.byteOffset + 80, view2.byteOffset + 96)),
|
|
11767
|
+
stateBits: view2.getUint32(96, true),
|
|
11768
|
+
created: readFileTime(view2, 100),
|
|
11769
|
+
modified: readFileTime(view2, 108),
|
|
11770
|
+
startSector: view2.getUint32(116, true),
|
|
11771
|
+
size: size3,
|
|
11772
|
+
parentId: -1
|
|
11773
|
+
}
|
|
11774
|
+
};
|
|
11775
|
+
}
|
|
11776
|
+
function readDirectory(dir, majorVersion, strict, warnings) {
|
|
11777
|
+
const count = Math.floor(dir.length / DIR_ENTRY_SIZE);
|
|
11778
|
+
const slots = [];
|
|
11779
|
+
for (let id3 = 0; id3 < count; id3++)
|
|
11780
|
+
slots.push(decodeSlot(dir, id3, majorVersion, warnings));
|
|
11781
|
+
const roots = slots.filter((slot) => slot.type === ENTRY_TYPE_ROOT);
|
|
11782
|
+
if (roots.length !== 1 || !roots[0].nameValid)
|
|
11783
|
+
throw new Ole2ParseError("Invalid root directory entry");
|
|
11784
|
+
const root2 = roots[0];
|
|
11785
|
+
root2.entry.path = [];
|
|
11786
|
+
const reached = /* @__PURE__ */ new Set([root2.id]);
|
|
11787
|
+
const fail3 = (message) => {
|
|
11788
|
+
if (strict)
|
|
11789
|
+
throw new Ole2ParseError(message);
|
|
11790
|
+
warnings.push({ code: "directory-link", message });
|
|
11791
|
+
};
|
|
11792
|
+
const pending = [];
|
|
11793
|
+
const push = (id3, parent, from) => {
|
|
11794
|
+
if (id3 === -1)
|
|
11795
|
+
return;
|
|
11796
|
+
const target2 = slots[id3];
|
|
11797
|
+
if (!target2 || target2.type === ENTRY_TYPE_EMPTY || target2.type === ENTRY_TYPE_ROOT) {
|
|
11798
|
+
fail3(`Directory entry ${from} links to invalid entry ${id3}`);
|
|
11799
|
+
return;
|
|
11800
|
+
}
|
|
11801
|
+
if (reached.has(id3)) {
|
|
11802
|
+
fail3(`Cyclic directory tree at entry ${id3}`);
|
|
11803
|
+
return;
|
|
11804
|
+
}
|
|
11805
|
+
reached.add(id3);
|
|
11806
|
+
pending.push({ id: id3, parent });
|
|
11807
|
+
};
|
|
11808
|
+
push(root2.entry.childId, root2, root2.id);
|
|
11809
|
+
while (pending.length) {
|
|
11810
|
+
const { id: id3, parent } = pending.pop();
|
|
11811
|
+
const slot = slots[id3];
|
|
11812
|
+
if (!slot.nameValid)
|
|
11813
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11814
|
+
slot.entry.parentId = parent.id;
|
|
11815
|
+
slot.entry.path = [...parent.entry.path, slot.entry.name];
|
|
11816
|
+
push(slot.entry.leftSiblingId, parent, id3);
|
|
11817
|
+
push(slot.entry.rightSiblingId, parent, id3);
|
|
11818
|
+
if (slot.type === ENTRY_TYPE_STORAGE)
|
|
11819
|
+
push(slot.entry.childId, slot, id3);
|
|
11820
|
+
}
|
|
11821
|
+
const entries = [];
|
|
11822
|
+
for (const slot of slots) {
|
|
11823
|
+
if (slot.type === ENTRY_TYPE_EMPTY)
|
|
11824
|
+
continue;
|
|
11825
|
+
if (!reached.has(slot.id)) {
|
|
11826
|
+
if (!slot.nameValid) {
|
|
11827
|
+
if (strict)
|
|
11828
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11829
|
+
warnings.push({ code: "invalid-unreachable-entry", message: `Skipped undecodable stale directory entry ${slot.id}` });
|
|
11830
|
+
continue;
|
|
11831
|
+
}
|
|
11832
|
+
if (strict)
|
|
11833
|
+
throw new Ole2ParseError(`Directory entry ${slot.id} is not reachable from the root`);
|
|
11834
|
+
warnings.push({ code: "unreachable-entry", message: `Directory entry ${slot.id} (${slot.entry.name}) is not reachable from the root` });
|
|
11835
|
+
}
|
|
11836
|
+
entries.push(slot.entry);
|
|
11837
|
+
}
|
|
11838
|
+
return entries;
|
|
11839
|
+
}
|
|
11840
|
+
function sameName(a, b) {
|
|
11841
|
+
return a.length === b.length && a.toUpperCase() === b.toUpperCase();
|
|
11842
|
+
}
|
|
11843
|
+
function bareName(name3) {
|
|
11844
|
+
return name3.replace(/^[\u0001-\u0006]/, "");
|
|
11845
|
+
}
|
|
11846
|
+
function normalizePath(path, rootName) {
|
|
11847
|
+
const parts = typeof path === "string" ? path.split("/").filter((part) => part !== "") : [...path];
|
|
11848
|
+
if (parts.length && sameName(parts[0], rootName) && typeof path === "string")
|
|
11849
|
+
parts.shift();
|
|
11850
|
+
return parts;
|
|
11851
|
+
}
|
|
11852
|
+
function child2(entries, parentId, name3) {
|
|
11853
|
+
const children5 = entries.filter((entry) => entry.parentId === parentId && entry.path !== void 0);
|
|
11854
|
+
const pick = (matches) => matches.length === 1 ? matches[0] : void 0;
|
|
11855
|
+
const exact = children5.filter((entry) => entry.name === name3);
|
|
11856
|
+
if (exact.length)
|
|
11857
|
+
return pick(exact);
|
|
11858
|
+
const folded = children5.filter((entry) => sameName(entry.name, name3));
|
|
11859
|
+
if (folded.length)
|
|
11860
|
+
return pick(folded);
|
|
11861
|
+
return pick(children5.filter((entry) => sameName(bareName(entry.name), bareName(name3))));
|
|
11862
|
+
}
|
|
11863
|
+
function findDirectoryEntry(entries, path) {
|
|
11864
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11865
|
+
if (!root2)
|
|
11866
|
+
return void 0;
|
|
11867
|
+
let current = root2;
|
|
11868
|
+
for (const name3 of normalizePath(path, root2.name)) {
|
|
11869
|
+
if (current.type !== ENTRY_TYPE_ROOT && current.type !== ENTRY_TYPE_STORAGE)
|
|
11870
|
+
return void 0;
|
|
11871
|
+
current = child2(entries, current.id, name3);
|
|
11872
|
+
if (!current)
|
|
11873
|
+
return void 0;
|
|
11874
|
+
}
|
|
11875
|
+
return current;
|
|
11876
|
+
}
|
|
11877
|
+
function findStreamByName(entries, name3, isReadable) {
|
|
11878
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11879
|
+
if (root2 && root2.name === name3)
|
|
11880
|
+
return root2;
|
|
11881
|
+
const top = entries.filter((entry) => entry.parentId === root2?.id && isReadable(entry));
|
|
11882
|
+
return top.find((entry) => entry.name === name3) ?? top.find((entry) => sameName(entry.name, name3)) ?? entries.find((entry) => entry.name === name3 && isReadable(entry));
|
|
11883
|
+
}
|
|
11884
|
+
|
|
11885
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
11886
|
+
function parseOle2(buffer, options = {}) {
|
|
11887
|
+
const strict = options.strict === true;
|
|
11888
|
+
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
11889
|
+
const view2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
11890
|
+
const warnings = [];
|
|
11614
11891
|
if (data.length < 512) {
|
|
11615
11892
|
throw new Ole2ParseError("Truncated OLE2 compound file header");
|
|
11616
11893
|
}
|
|
@@ -11619,11 +11896,12 @@ function parseOle2(buffer) {
|
|
|
11619
11896
|
throw new Ole2ParseError("Not a valid OLE2 compound file");
|
|
11620
11897
|
}
|
|
11621
11898
|
}
|
|
11622
|
-
view2.getUint16(24, true);
|
|
11623
11899
|
const majorVersion = view2.getUint16(26, true);
|
|
11624
11900
|
const byteOrder = view2.getUint16(28, true);
|
|
11625
11901
|
if (byteOrder !== 65534) {
|
|
11626
|
-
|
|
11902
|
+
if (strict)
|
|
11903
|
+
throw new Ole2ParseError("Invalid byte order mark");
|
|
11904
|
+
warnings.push({ code: "byte-order", message: `Ignored byte order mark 0x${byteOrder.toString(16)}` });
|
|
11627
11905
|
}
|
|
11628
11906
|
const sectorSizePower = view2.getUint16(30, true);
|
|
11629
11907
|
const miniSectorSizePower = view2.getUint16(32, true);
|
|
@@ -11632,10 +11910,14 @@ function parseOle2(buffer) {
|
|
|
11632
11910
|
}
|
|
11633
11911
|
const sectorSize = 1 << sectorSizePower;
|
|
11634
11912
|
const miniSectorSize = 1 << miniSectorSizePower;
|
|
11635
|
-
if (data.length < sectorSize
|
|
11913
|
+
if (data.length < sectorSize)
|
|
11636
11914
|
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11915
|
+
if (data.length % sectorSize !== 0) {
|
|
11916
|
+
if (strict)
|
|
11917
|
+
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11918
|
+
warnings.push({ code: "unaligned-length", message: `File length ${data.length} is not a multiple of ${sectorSize}` });
|
|
11637
11919
|
}
|
|
11638
|
-
const sectorCount = data.length / sectorSize - 1;
|
|
11920
|
+
const sectorCount = Math.ceil(data.length / sectorSize) - 1;
|
|
11639
11921
|
const totalFATSectors = view2.getUint32(44, true);
|
|
11640
11922
|
const firstDirectorySector = view2.getUint32(48, true);
|
|
11641
11923
|
const miniStreamCutoff = view2.getUint32(56, true);
|
|
@@ -11656,6 +11938,13 @@ function parseOle2(buffer) {
|
|
|
11656
11938
|
}
|
|
11657
11939
|
return data.subarray(offset, offset + sectorSize);
|
|
11658
11940
|
}
|
|
11941
|
+
function copySector(sector, target2, at2, want) {
|
|
11942
|
+
const offset = sectorOffset(sector);
|
|
11943
|
+
if (sector >= sectorCount || offset + want > data.length) {
|
|
11944
|
+
throw new Ole2ParseError(`Sector ${sector} at offset ${offset} exceeds file size ${data.length}`);
|
|
11945
|
+
}
|
|
11946
|
+
target2.set(data.subarray(offset, offset + want), at2);
|
|
11947
|
+
}
|
|
11659
11948
|
const fatSectors = [];
|
|
11660
11949
|
for (let i = 0; i < 109 && fatSectors.length < totalFATSectors; i++) {
|
|
11661
11950
|
const sector = view2.getUint32(76 + i * 4, true);
|
|
@@ -11691,29 +11980,36 @@ function parseOle2(buffer) {
|
|
|
11691
11980
|
fatEntries.push(fatView.getUint32(i * 4, true));
|
|
11692
11981
|
}
|
|
11693
11982
|
}
|
|
11694
|
-
function
|
|
11695
|
-
const
|
|
11696
|
-
let current = startSector;
|
|
11983
|
+
function followChain(table2, start, label, needed) {
|
|
11984
|
+
const ids = [];
|
|
11697
11985
|
const visited = /* @__PURE__ */ new Set();
|
|
11986
|
+
let current = start;
|
|
11698
11987
|
while (current <= MAXREGSECT) {
|
|
11988
|
+
if (!strict && needed !== void 0 && ids.length >= needed)
|
|
11989
|
+
return ids;
|
|
11699
11990
|
if (visited.has(current)) {
|
|
11700
|
-
throw new Ole2ParseError(`Circular reference in
|
|
11991
|
+
throw new Ole2ParseError(`Circular reference in ${label} chain at sector ${current}`);
|
|
11701
11992
|
}
|
|
11702
11993
|
visited.add(current);
|
|
11703
|
-
|
|
11704
|
-
if (
|
|
11705
|
-
throw new Ole2ParseError(
|
|
11706
|
-
current =
|
|
11707
|
-
}
|
|
11708
|
-
if (current !== ENDOFCHAIN)
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
for (const sector of sectors) {
|
|
11714
|
-
result.set(sector, offset);
|
|
11715
|
-
offset += sectorSize;
|
|
11994
|
+
ids.push(current);
|
|
11995
|
+
if (table2[current] === void 0)
|
|
11996
|
+
throw new Ole2ParseError(`Missing ${label} chain entry`);
|
|
11997
|
+
current = table2[current];
|
|
11998
|
+
}
|
|
11999
|
+
if (current !== ENDOFCHAIN) {
|
|
12000
|
+
if (strict || needed === void 0 || ids.length < needed) {
|
|
12001
|
+
throw new Ole2ParseError(`Invalid ${label} chain terminator`);
|
|
12002
|
+
}
|
|
12003
|
+
warnings.push({ code: "chain-terminator", message: `Accepted ${label} chain ending in 0x${current.toString(16)}` });
|
|
11716
12004
|
}
|
|
12005
|
+
return ids;
|
|
12006
|
+
}
|
|
12007
|
+
function readMetadataChain(startSector, label) {
|
|
12008
|
+
if (startSector > MAXREGSECT)
|
|
12009
|
+
return new Uint8Array(0);
|
|
12010
|
+
const ids = followChain(fatEntries, startSector, label === "directory" ? "FAT" : label);
|
|
12011
|
+
const result = new Uint8Array(ids.length * sectorSize);
|
|
12012
|
+
ids.forEach((id3, i) => result.set(readSector(id3), i * sectorSize));
|
|
11717
12013
|
return result;
|
|
11718
12014
|
}
|
|
11719
12015
|
function readStream(startSector, size3) {
|
|
@@ -11721,68 +12017,44 @@ function parseOle2(buffer) {
|
|
|
11721
12017
|
return new Uint8Array(0);
|
|
11722
12018
|
if (size3 > sectorCount * sectorSize)
|
|
11723
12019
|
throw new Ole2ParseError("Stream size exceeds file size");
|
|
11724
|
-
const
|
|
11725
|
-
|
|
12020
|
+
const needed = Math.ceil(size3 / sectorSize);
|
|
12021
|
+
const ids = followChain(fatEntries, startSector, "FAT", needed);
|
|
12022
|
+
if (ids.length < needed)
|
|
11726
12023
|
throw new Ole2ParseError("Truncated stream sector chain");
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
|
|
11731
|
-
const entries = [];
|
|
11732
|
-
for (let i = 0; i < numEntries; i++) {
|
|
11733
|
-
const entryOffset = i * DIR_ENTRY_SIZE;
|
|
11734
|
-
const entryView = new DataView(dirRaw.buffer, dirRaw.byteOffset + entryOffset, DIR_ENTRY_SIZE);
|
|
11735
|
-
const nameLen = entryView.getUint16(64, true);
|
|
11736
|
-
const objectType = entryView.getUint8(66);
|
|
11737
|
-
if (objectType === ENTRY_TYPE_EMPTY) {
|
|
11738
|
-
continue;
|
|
12024
|
+
const result = new Uint8Array(size3);
|
|
12025
|
+
for (let i = 0; i < needed; i++) {
|
|
12026
|
+
copySector(ids[i], result, i * sectorSize, Math.min(sectorSize, size3 - i * sectorSize));
|
|
11739
12027
|
}
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
const leftSiblingId = entryView.getUint32(68, true);
|
|
11749
|
-
const rightSiblingId = entryView.getUint32(72, true);
|
|
11750
|
-
const childId = entryView.getUint32(76, true);
|
|
11751
|
-
const clsid = new Uint8Array(entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96));
|
|
11752
|
-
const startSector = entryView.getUint32(116, true);
|
|
11753
|
-
const sizeLow = entryView.getUint32(120, true);
|
|
11754
|
-
let size3 = sizeLow;
|
|
11755
|
-
if (majorVersion === 4) {
|
|
11756
|
-
const sizeHigh = entryView.getUint32(124, true);
|
|
11757
|
-
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11758
|
-
if (!Number.isSafeInteger(size3) || size3 > sectorCount * sectorSize) {
|
|
11759
|
-
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11760
|
-
}
|
|
12028
|
+
return result;
|
|
12029
|
+
}
|
|
12030
|
+
if (firstDirectorySector > MAXREGSECT)
|
|
12031
|
+
throw new Ole2ParseError("Missing directory chain");
|
|
12032
|
+
const entries = readDirectory(readMetadataChain(firstDirectorySector, "directory"), majorVersion, strict, warnings);
|
|
12033
|
+
for (const entry of entries) {
|
|
12034
|
+
if (majorVersion === 4 && (!Number.isSafeInteger(entry.size) || entry.size > sectorCount * sectorSize)) {
|
|
12035
|
+
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11761
12036
|
}
|
|
11762
|
-
entries.push({
|
|
11763
|
-
name: name3,
|
|
11764
|
-
type: objectType,
|
|
11765
|
-
startSector,
|
|
11766
|
-
size: size3,
|
|
11767
|
-
childId: childId === 4294967295 ? -1 : childId,
|
|
11768
|
-
leftSiblingId: leftSiblingId === 4294967295 ? -1 : leftSiblingId,
|
|
11769
|
-
rightSiblingId: rightSiblingId === 4294967295 ? -1 : rightSiblingId,
|
|
11770
|
-
clsid
|
|
11771
|
-
});
|
|
11772
12037
|
}
|
|
11773
12038
|
const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
|
|
11774
|
-
if (!rootEntry || entries.filter((e) => e.type === ENTRY_TYPE_ROOT).length !== 1) {
|
|
11775
|
-
throw new Ole2ParseError("Invalid root directory entry");
|
|
11776
|
-
}
|
|
11777
12039
|
let miniStreamData;
|
|
11778
|
-
if (rootEntry
|
|
12040
|
+
if (rootEntry.startSector <= MAXREGSECT) {
|
|
11779
12041
|
miniStreamData = readStream(rootEntry.startSector, rootEntry.size);
|
|
11780
12042
|
}
|
|
11781
12043
|
const miniFatEntries = [];
|
|
11782
|
-
if (firstMiniFATSector
|
|
11783
|
-
|
|
11784
|
-
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
12044
|
+
if (firstMiniFATSector > MAXREGSECT && totalMiniFATSectors > 0) {
|
|
12045
|
+
if (strict)
|
|
11785
12046
|
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
12047
|
+
warnings.push({ code: "mini-fat-count", message: `Header lists ${totalMiniFATSectors} mini FAT sectors but no chain` });
|
|
12048
|
+
}
|
|
12049
|
+
if (firstMiniFATSector <= MAXREGSECT && (totalMiniFATSectors > 0 || !strict)) {
|
|
12050
|
+
const miniFatRaw = readMetadataChain(firstMiniFATSector, "mini FAT");
|
|
12051
|
+
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
12052
|
+
if (strict)
|
|
12053
|
+
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
12054
|
+
warnings.push({
|
|
12055
|
+
code: "mini-fat-count",
|
|
12056
|
+
message: `Header lists ${totalMiniFATSectors} mini FAT sectors; chain has ${miniFatRaw.length / sectorSize}`
|
|
12057
|
+
});
|
|
11786
12058
|
}
|
|
11787
12059
|
const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
|
|
11788
12060
|
const miniCapacity = Math.floor((miniStreamData?.length ?? 0) / miniSectorSize);
|
|
@@ -11796,48 +12068,67 @@ function parseOle2(buffer) {
|
|
|
11796
12068
|
if (!miniStreamData) {
|
|
11797
12069
|
throw new Ole2ParseError("Mini stream container not found");
|
|
11798
12070
|
}
|
|
11799
|
-
const
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
12071
|
+
const needed = Math.ceil(size3 / miniSectorSize);
|
|
12072
|
+
const capacity = miniStreamData.length / miniSectorSize;
|
|
12073
|
+
let ids;
|
|
12074
|
+
try {
|
|
12075
|
+
ids = followChain(miniFatEntries, startSector, "mini FAT", needed);
|
|
12076
|
+
} catch (error) {
|
|
12077
|
+
if (error instanceof Ole2ParseError && /Missing mini FAT/.test(error.message)) {
|
|
12078
|
+
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11805
12079
|
}
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
12080
|
+
throw error;
|
|
12081
|
+
}
|
|
12082
|
+
const result = new Uint8Array(size3);
|
|
12083
|
+
for (let i = 0; i < ids.length && i < needed; i++) {
|
|
12084
|
+
const id3 = ids[i];
|
|
12085
|
+
if (id3 >= capacity || (id3 + 1) * miniSectorSize > miniStreamData.length) {
|
|
11809
12086
|
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11810
12087
|
}
|
|
11811
|
-
|
|
11812
|
-
|
|
12088
|
+
const want = Math.min(miniSectorSize, size3 - i * miniSectorSize);
|
|
12089
|
+
result.set(miniStreamData.subarray(id3 * miniSectorSize, id3 * miniSectorSize + want), i * miniSectorSize);
|
|
11813
12090
|
}
|
|
11814
|
-
if (
|
|
11815
|
-
throw new Ole2ParseError("Invalid mini FAT chain terminator");
|
|
11816
|
-
const totalLength = sectors.length * miniSectorSize;
|
|
11817
|
-
if (totalLength < size3)
|
|
12091
|
+
if (ids.length < needed)
|
|
11818
12092
|
throw new Ole2ParseError("Truncated mini stream sector chain");
|
|
11819
|
-
|
|
11820
|
-
let offset = 0;
|
|
11821
|
-
for (const sector of sectors) {
|
|
11822
|
-
result.set(sector, offset);
|
|
11823
|
-
offset += miniSectorSize;
|
|
11824
|
-
}
|
|
11825
|
-
return result.subarray(0, size3);
|
|
12093
|
+
return result;
|
|
11826
12094
|
}
|
|
11827
|
-
function
|
|
11828
|
-
const entry = entries.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name3);
|
|
11829
|
-
if (!entry) {
|
|
11830
|
-
return void 0;
|
|
11831
|
-
}
|
|
12095
|
+
function readEntry(entry) {
|
|
11832
12096
|
if (entry.size < miniStreamCutoff && entry.type !== ENTRY_TYPE_ROOT) {
|
|
11833
12097
|
return readMiniStream(entry.startSector, entry.size);
|
|
11834
12098
|
}
|
|
11835
12099
|
return readStream(entry.startSector, entry.size);
|
|
11836
12100
|
}
|
|
11837
|
-
|
|
12101
|
+
const readable = (entry) => entry.type === ENTRY_TYPE_STREAM || entry.type === ENTRY_TYPE_ROOT;
|
|
12102
|
+
return {
|
|
12103
|
+
entries,
|
|
12104
|
+
warnings,
|
|
12105
|
+
getStream(name3) {
|
|
12106
|
+
const entry = findStreamByName(entries, name3, readable);
|
|
12107
|
+
return entry ? readEntry(entry) : void 0;
|
|
12108
|
+
},
|
|
12109
|
+
getStreamByPath(path) {
|
|
12110
|
+
const entry = findDirectoryEntry(entries, path);
|
|
12111
|
+
return entry && entry.type === ENTRY_TYPE_STREAM ? readEntry(entry) : void 0;
|
|
12112
|
+
},
|
|
12113
|
+
getStreamById(id3) {
|
|
12114
|
+
const entry = entries.find((candidate) => candidate.id === id3);
|
|
12115
|
+
return entry && readable(entry) ? readEntry(entry) : void 0;
|
|
12116
|
+
},
|
|
12117
|
+
findEntry(path) {
|
|
12118
|
+
return findDirectoryEntry(entries, path);
|
|
12119
|
+
}
|
|
12120
|
+
};
|
|
11838
12121
|
}
|
|
11839
12122
|
|
|
11840
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12123
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document-base.js
|
|
12124
|
+
var copyOf = (bytes) => bytes === void 0 ? void 0 : new Uint8Array(bytes);
|
|
12125
|
+
var detachEntry = (entry) => ({
|
|
12126
|
+
...entry,
|
|
12127
|
+
clsid: new Uint8Array(entry.clsid),
|
|
12128
|
+
path: entry.path && [...entry.path],
|
|
12129
|
+
created: entry.created && new Date(entry.created),
|
|
12130
|
+
modified: entry.modified && new Date(entry.modified)
|
|
12131
|
+
});
|
|
11841
12132
|
var Ole2DocumentError = class extends Error {
|
|
11842
12133
|
code;
|
|
11843
12134
|
constructor(code, message) {
|
|
@@ -11870,16 +12161,31 @@ var Ole2DocumentBase = class {
|
|
|
11870
12161
|
return this.#revision;
|
|
11871
12162
|
}
|
|
11872
12163
|
get entries() {
|
|
11873
|
-
return this.#container.entries.map(
|
|
12164
|
+
return this.#container.entries.map(detachEntry);
|
|
12165
|
+
}
|
|
12166
|
+
get warnings() {
|
|
12167
|
+
return this.#container.warnings.map((warning) => ({ ...warning }));
|
|
11874
12168
|
}
|
|
11875
|
-
#getStream = (name3) =>
|
|
11876
|
-
|
|
11877
|
-
|
|
12169
|
+
#getStream = (name3) => copyOf(this.#container.getStream(name3));
|
|
12170
|
+
#getStreamByPath = (path) => copyOf(this.#container.getStreamByPath(path));
|
|
12171
|
+
#getStreamById = (id3) => copyOf(this.#container.getStreamById(id3));
|
|
12172
|
+
#findEntry = (path) => {
|
|
12173
|
+
const entry = this.#container.findEntry(path);
|
|
12174
|
+
return entry && detachEntry(entry);
|
|
11878
12175
|
};
|
|
11879
12176
|
/** Retain the original detachable callback API while observing current state. */
|
|
11880
12177
|
get getStream() {
|
|
11881
12178
|
return this.#getStream;
|
|
11882
12179
|
}
|
|
12180
|
+
get getStreamByPath() {
|
|
12181
|
+
return this.#getStreamByPath;
|
|
12182
|
+
}
|
|
12183
|
+
get getStreamById() {
|
|
12184
|
+
return this.#getStreamById;
|
|
12185
|
+
}
|
|
12186
|
+
get findEntry() {
|
|
12187
|
+
return this.#findEntry;
|
|
12188
|
+
}
|
|
11883
12189
|
/** Isolated working input: codecs cannot accidentally mutate current state. */
|
|
11884
12190
|
getBytes() {
|
|
11885
12191
|
return new Uint8Array(this.#bytes);
|
|
@@ -11902,7 +12208,7 @@ var Ole2DocumentBase = class {
|
|
|
11902
12208
|
}
|
|
11903
12209
|
};
|
|
11904
12210
|
|
|
11905
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12211
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
|
|
11906
12212
|
var END = 4294967294;
|
|
11907
12213
|
var MAX = 4294967290;
|
|
11908
12214
|
var NIL = 4294967295;
|
|
@@ -11937,6 +12243,58 @@ function chainToEnd(table2, start, max) {
|
|
|
11937
12243
|
}
|
|
11938
12244
|
return out;
|
|
11939
12245
|
}
|
|
12246
|
+
function chainPrefix(table2, start, needed) {
|
|
12247
|
+
const out = [], seen = /* @__PURE__ */ new Set();
|
|
12248
|
+
let id3 = start;
|
|
12249
|
+
while (out.length < needed) {
|
|
12250
|
+
if (id3 > MAX || id3 >= table2.length || seen.has(id3))
|
|
12251
|
+
throw new Error("Invalid CFB chain");
|
|
12252
|
+
seen.add(id3);
|
|
12253
|
+
out.push(id3);
|
|
12254
|
+
id3 = table2[id3];
|
|
12255
|
+
}
|
|
12256
|
+
return out;
|
|
12257
|
+
}
|
|
12258
|
+
function readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32) {
|
|
12259
|
+
const size3 = target2.size;
|
|
12260
|
+
if (size3 === 0)
|
|
12261
|
+
return new Uint8Array(0);
|
|
12262
|
+
const out = new Uint8Array(size3);
|
|
12263
|
+
const copyPhysical = (at2, want, into) => {
|
|
12264
|
+
if (at2 + want > input.length)
|
|
12265
|
+
throw new Error("Stream data exceeds file size");
|
|
12266
|
+
out.set(input.subarray(at2, at2 + want), into);
|
|
12267
|
+
};
|
|
12268
|
+
if (size3 >= read32(56)) {
|
|
12269
|
+
if (size3 > sectorCount * sectorSize)
|
|
12270
|
+
throw new Error("Stream size exceeds file size");
|
|
12271
|
+
chainPrefix(fat, target2.start, Math.ceil(size3 / sectorSize)).forEach((id3, i) => {
|
|
12272
|
+
if (id3 >= sectorCount)
|
|
12273
|
+
throw new Error("Invalid sector");
|
|
12274
|
+
copyPhysical((id3 + 1) * sectorSize, Math.min(sectorSize, size3 - i * sectorSize), i * sectorSize);
|
|
12275
|
+
});
|
|
12276
|
+
return out;
|
|
12277
|
+
}
|
|
12278
|
+
const miniFatSectors = chainToEnd(fat, read32(60), sectorCount);
|
|
12279
|
+
const miniCapacity = Math.floor(Math.min(root2.size, sectorCount * sectorSize) / miniSize);
|
|
12280
|
+
const miniFat = [];
|
|
12281
|
+
for (const id3 of miniFatSectors) {
|
|
12282
|
+
const bytes = sector(id3), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
12283
|
+
for (let j = 0; j < sectorSize / 4 && miniFat.length < miniCapacity; j++)
|
|
12284
|
+
miniFat.push(dv.getUint32(j * 4, true));
|
|
12285
|
+
}
|
|
12286
|
+
const rootSectors = chainPrefix(fat, root2.start, Math.ceil(root2.size / sectorSize));
|
|
12287
|
+
chainPrefix(miniFat, target2.start, Math.ceil(size3 / miniSize)).forEach((id3, i) => {
|
|
12288
|
+
const start = id3 * miniSize, want = Math.min(miniSize, size3 - i * miniSize);
|
|
12289
|
+
if (start + want > root2.size)
|
|
12290
|
+
throw new Error("Mini stream out of bounds");
|
|
12291
|
+
const rootSector = rootSectors[Math.floor(start / sectorSize)];
|
|
12292
|
+
if (rootSector >= sectorCount)
|
|
12293
|
+
throw new Error("Invalid sector");
|
|
12294
|
+
copyPhysical((rootSector + 1) * sectorSize + start % sectorSize, want, i * miniSize);
|
|
12295
|
+
});
|
|
12296
|
+
return out;
|
|
12297
|
+
}
|
|
11940
12298
|
function processCompoundFileStream(input, path, replacement) {
|
|
11941
12299
|
const reject2 = () => replacement ? input : void 0;
|
|
11942
12300
|
try {
|
|
@@ -11944,18 +12302,19 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
11944
12302
|
return reject2();
|
|
11945
12303
|
const view2 = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
11946
12304
|
const read32 = (offset2) => view2.getUint32(offset2, true);
|
|
11947
|
-
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 ||
|
|
12305
|
+
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.
|
|
12306
|
+
replacement && view2.getUint16(28, true) !== 65534)
|
|
11948
12307
|
return reject2();
|
|
11949
12308
|
const major = view2.getUint16(26, true), shift = view2.getUint16(30, true), miniShift = view2.getUint16(32, true);
|
|
11950
12309
|
if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
11951
12310
|
return reject2();
|
|
11952
12311
|
const sectorSize = 1 << shift, miniSize = 1 << miniShift;
|
|
11953
|
-
if (input.length % sectorSize !== 0)
|
|
12312
|
+
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
11954
12313
|
return reject2();
|
|
11955
|
-
const sectorCount = input.length / sectorSize - 1;
|
|
12314
|
+
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|
|
11956
12315
|
const offset = (id3) => (id3 + 1) * sectorSize;
|
|
11957
12316
|
const sector = (id3) => {
|
|
11958
|
-
if (id3 > MAX || id3 >= sectorCount)
|
|
12317
|
+
if (id3 > MAX || id3 >= sectorCount || offset(id3) + sectorSize > input.length)
|
|
11959
12318
|
throw new Error("Invalid sector");
|
|
11960
12319
|
return input.subarray(offset(id3), offset(id3) + sectorSize);
|
|
11961
12320
|
};
|
|
@@ -12005,7 +12364,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12005
12364
|
for (let i = 0; i < nameLength - 2; i += 2)
|
|
12006
12365
|
name3 += String.fromCharCode(dvDir.getUint16(p + i, true));
|
|
12007
12366
|
const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
|
|
12008
|
-
if (sizeHigh !== 0)
|
|
12367
|
+
if (sizeHigh !== 0 && (replacement || major === 4))
|
|
12009
12368
|
return reject2();
|
|
12010
12369
|
entries.push({
|
|
12011
12370
|
id: id3,
|
|
@@ -12052,6 +12411,8 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12052
12411
|
}
|
|
12053
12412
|
if (!target2)
|
|
12054
12413
|
return reject2();
|
|
12414
|
+
if (!replacement)
|
|
12415
|
+
return readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32);
|
|
12055
12416
|
const names = entries.map((e) => e.name.toLowerCase());
|
|
12056
12417
|
if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
|
|
12057
12418
|
return reject2();
|
|
@@ -12175,7 +12536,7 @@ function replaceCompoundFileStream(input, path, replacement) {
|
|
|
12175
12536
|
return processCompoundFileStream(input, path, replacement) ?? input;
|
|
12176
12537
|
}
|
|
12177
12538
|
|
|
12178
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12539
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
|
|
12179
12540
|
var END2 = 4294967294;
|
|
12180
12541
|
var FREE = 4294967295;
|
|
12181
12542
|
var FAT = 4294967293;
|
|
@@ -12363,7 +12724,7 @@ function resizeCompoundFileStreamV4(input, path, replacement) {
|
|
|
12363
12724
|
}
|
|
12364
12725
|
}
|
|
12365
12726
|
|
|
12366
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12727
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
12367
12728
|
function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
|
|
12368
12729
|
const sectorCount = input.length / sectorSize - 1;
|
|
12369
12730
|
const entriesPerFat = sectorSize / 4;
|
|
@@ -12410,7 +12771,7 @@ function followCompoundAllocation(table2, start) {
|
|
|
12410
12771
|
return ids;
|
|
12411
12772
|
}
|
|
12412
12773
|
|
|
12413
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12774
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
|
|
12414
12775
|
var END3 = 4294967294;
|
|
12415
12776
|
var FREE2 = 4294967295;
|
|
12416
12777
|
var SECTOR = 512;
|
|
@@ -12482,7 +12843,7 @@ function resizeMiniCompoundStream(input, fat, fatIds, root2, target2, replacemen
|
|
|
12482
12843
|
return output.bytes;
|
|
12483
12844
|
}
|
|
12484
12845
|
|
|
12485
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12846
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
|
|
12486
12847
|
var END4 = 4294967294;
|
|
12487
12848
|
var FREE3 = 4294967295;
|
|
12488
12849
|
var FAT2 = 4294967293;
|
|
@@ -12647,7 +13008,7 @@ function resizeCompoundFileStream(input, path, replacement) {
|
|
|
12647
13008
|
}
|
|
12648
13009
|
}
|
|
12649
13010
|
|
|
12650
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13011
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
|
|
12651
13012
|
var FC_LCB_INDEX = {
|
|
12652
13013
|
plcfbteChpx: 12,
|
|
12653
13014
|
plcfbtePapx: 13,
|
|
@@ -12743,7 +13104,7 @@ function patchDocFib(wordDoc, fib, patch) {
|
|
|
12743
13104
|
view2.setUint32(papxOff + 4, patch.plcfbtePapx.lcb, true);
|
|
12744
13105
|
}
|
|
12745
13106
|
|
|
12746
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13107
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
|
|
12747
13108
|
var DocCfbRewriteError = class extends Error {
|
|
12748
13109
|
constructor(message) {
|
|
12749
13110
|
super(message);
|
|
@@ -12798,7 +13159,7 @@ function unwrapDocBytes(bytes) {
|
|
|
12798
13159
|
}
|
|
12799
13160
|
}
|
|
12800
13161
|
|
|
12801
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13162
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
|
|
12802
13163
|
var PAGE_SIZE = 512;
|
|
12803
13164
|
function parseBteTable(tableStream, at2) {
|
|
12804
13165
|
const view2 = new DataView(tableStream.buffer, tableStream.byteOffset, tableStream.byteLength);
|
|
@@ -12939,7 +13300,7 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
|
|
|
12939
13300
|
return page;
|
|
12940
13301
|
}
|
|
12941
13302
|
|
|
12942
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13303
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
|
|
12943
13304
|
var CP1252_HIGH_BLOCK = [
|
|
12944
13305
|
8364,
|
|
12945
13306
|
129,
|
|
@@ -13007,7 +13368,7 @@ function encodeCp1252(text3) {
|
|
|
13007
13368
|
return Uint8Array.from(bytes);
|
|
13008
13369
|
}
|
|
13009
13370
|
|
|
13010
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13371
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
|
|
13011
13372
|
var CLXT_PRC = 1;
|
|
13012
13373
|
var CLXT_PCDT = 2;
|
|
13013
13374
|
var DocResourceLimitError = class extends Error {
|
|
@@ -13219,7 +13580,7 @@ function buildClxBytes(pieces, prcBytes = new Uint8Array()) {
|
|
|
13219
13580
|
return result;
|
|
13220
13581
|
}
|
|
13221
13582
|
|
|
13222
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13583
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
|
|
13223
13584
|
var UnsupportedDocFieldEditError = class extends Error {
|
|
13224
13585
|
constructor(message) {
|
|
13225
13586
|
super(message);
|
|
@@ -13303,7 +13664,7 @@ function shiftDocMainFieldCps(table2, at2, body, editStart, editEnd, delta, maxF
|
|
|
13303
13664
|
return result;
|
|
13304
13665
|
}
|
|
13305
13666
|
|
|
13306
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13667
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
|
|
13307
13668
|
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];
|
|
13308
13669
|
var RISKY_STTB_INDICES = [21, 22, 23];
|
|
13309
13670
|
var SAFE_EXTENDED_FC_LCB_INDICES = /* @__PURE__ */ new Set([93, 94, 113, 181, 182]);
|
|
@@ -13572,7 +13933,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text3, limits) {
|
|
|
13572
13933
|
}
|
|
13573
13934
|
}
|
|
13574
13935
|
|
|
13575
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13936
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-runs.js
|
|
13576
13937
|
var LIMIT = 65536;
|
|
13577
13938
|
var SAFE_OPERANDS = /* @__PURE__ */ new Set([
|
|
13578
13939
|
2101,
|
|
@@ -13810,7 +14171,7 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value) {
|
|
|
13810
14171
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
13811
14172
|
}
|
|
13812
14173
|
|
|
13813
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14174
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-paragraph-format.js
|
|
13814
14175
|
var LIMIT2 = 65536;
|
|
13815
14176
|
var SPRM_LIMIT = 262144;
|
|
13816
14177
|
var PAGE_NUMBER_MASK = 4194303;
|
|
@@ -13998,7 +14359,7 @@ function writeDocParagraphAlignment(input, index, alignment) {
|
|
|
13998
14359
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
13999
14360
|
}
|
|
14000
14361
|
|
|
14001
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14362
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/doc-document.js
|
|
14002
14363
|
var DOC_CAPABILITIES = Object.freeze({
|
|
14003
14364
|
read: Object.freeze(["paragraph-text", "character-runs", "direct-character-formatting", "paragraph-style-index", "direct-paragraph-alignment", "compound-streams"]),
|
|
14004
14365
|
write: Object.freeze(["paragraph-text", "existing-direct-bold-italic", "existing-direct-font-size", "existing-direct-underline", "existing-direct-paragraph-alignment"]),
|
|
@@ -14194,7 +14555,7 @@ var DocDocument = class extends Ole2DocumentBase {
|
|
|
14194
14555
|
}
|
|
14195
14556
|
};
|
|
14196
14557
|
|
|
14197
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14558
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
|
|
14198
14559
|
function compareDirEntryNames(a, b) {
|
|
14199
14560
|
const ua = a.toUpperCase();
|
|
14200
14561
|
const ub = b.toUpperCase();
|
|
@@ -14261,7 +14622,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
|
|
|
14261
14622
|
}
|
|
14262
14623
|
}
|
|
14263
14624
|
|
|
14264
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14625
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
|
|
14265
14626
|
function writeHeader(outView, outBytes, params) {
|
|
14266
14627
|
outBytes.set(OLE_MAGIC, 0);
|
|
14267
14628
|
outView.setUint16(24, 62, true);
|
|
@@ -14354,7 +14715,7 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
|
|
|
14354
14715
|
}
|
|
14355
14716
|
}
|
|
14356
14717
|
|
|
14357
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14718
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
14358
14719
|
function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
14359
14720
|
const sectorSize = 512;
|
|
14360
14721
|
const miniSectorSize = 64;
|
|
@@ -14535,7 +14896,7 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
14535
14896
|
return output;
|
|
14536
14897
|
}
|
|
14537
14898
|
|
|
14538
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14899
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
|
|
14539
14900
|
var WORKBOOK_STREAM_NAMES = ["workbook", "book"];
|
|
14540
14901
|
function unwrapXlsBytes(bytes) {
|
|
14541
14902
|
if (!isCfb(bytes)) {
|
|
@@ -14602,7 +14963,7 @@ function isCfb(bytes) {
|
|
|
14602
14963
|
return OLE_MAGIC.every((value, index) => bytes[index] === value);
|
|
14603
14964
|
}
|
|
14604
14965
|
|
|
14605
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14966
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
|
|
14606
14967
|
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`;
|
|
14607
14968
|
var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
14608
14969
|
const [id3, name3, argc] = entry.split(" ");
|
|
@@ -14610,7 +14971,7 @@ var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
|
14610
14971
|
}));
|
|
14611
14972
|
var XLS_USER_FUNCTION_ID = 255;
|
|
14612
14973
|
|
|
14613
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14974
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg-text.js
|
|
14614
14975
|
var BIFF_ERRORS = {
|
|
14615
14976
|
0: "#NULL!",
|
|
14616
14977
|
7: "#DIV/0!",
|
|
@@ -14645,8 +15006,8 @@ function columnName(col) {
|
|
|
14645
15006
|
return name3;
|
|
14646
15007
|
}
|
|
14647
15008
|
function quoteSheetName(name3) {
|
|
14648
|
-
const
|
|
14649
|
-
return
|
|
15009
|
+
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);
|
|
15010
|
+
return plain2 ? name3 : `'${name3.replace(/'/g, "''")}'`;
|
|
14650
15011
|
}
|
|
14651
15012
|
function formatNumber2(value) {
|
|
14652
15013
|
return String(value).replace("e", "E");
|
|
@@ -14705,7 +15066,7 @@ function readArrayConstant(extra) {
|
|
|
14705
15066
|
return `{${lines2.join(";")}}`;
|
|
14706
15067
|
}
|
|
14707
15068
|
|
|
14708
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15069
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-records.js
|
|
14709
15070
|
var RT_CONTINUE = 60;
|
|
14710
15071
|
function readXlsRecords(bytes, start = 0, end = bytes.length) {
|
|
14711
15072
|
const records = [];
|
|
@@ -14871,7 +15232,7 @@ function joinedData(record5) {
|
|
|
14871
15232
|
return out;
|
|
14872
15233
|
}
|
|
14873
15234
|
|
|
14874
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15235
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
|
|
14875
15236
|
function decodeFormula(rgce, extra, context, options) {
|
|
14876
15237
|
try {
|
|
14877
15238
|
return decode(rgce, new ByteReader(extra), context, options);
|
|
@@ -15102,7 +15463,7 @@ function readAttr(reader, stack, whitespace) {
|
|
|
15102
15463
|
}
|
|
15103
15464
|
}
|
|
15104
15465
|
|
|
15105
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15466
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sst.js
|
|
15106
15467
|
function parseSharedStrings(record5) {
|
|
15107
15468
|
const reader = SegmentReader.of(record5);
|
|
15108
15469
|
reader.u32();
|
|
@@ -15119,7 +15480,7 @@ function parseSharedStrings(record5) {
|
|
|
15119
15480
|
return strings;
|
|
15120
15481
|
}
|
|
15121
15482
|
|
|
15122
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15483
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-styles.js
|
|
15123
15484
|
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(" ");
|
|
15124
15485
|
var XLS_BUILTIN_FORMATS = {
|
|
15125
15486
|
0: "General",
|
|
@@ -15376,7 +15737,7 @@ function applyXfExt(data, xfs, palette) {
|
|
|
15376
15737
|
}
|
|
15377
15738
|
}
|
|
15378
15739
|
|
|
15379
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15740
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-types.js
|
|
15380
15741
|
var XlsReadError = class extends Error {
|
|
15381
15742
|
code;
|
|
15382
15743
|
constructor(code, message) {
|
|
@@ -15386,7 +15747,7 @@ var XlsReadError = class extends Error {
|
|
|
15386
15747
|
}
|
|
15387
15748
|
};
|
|
15388
15749
|
|
|
15389
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15750
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-globals.js
|
|
15390
15751
|
var RT = {
|
|
15391
15752
|
BOF: 2057,
|
|
15392
15753
|
EOF: 10,
|
|
@@ -15475,8 +15836,8 @@ function parseSupBook(data) {
|
|
|
15475
15836
|
function sheetRange(first2, last) {
|
|
15476
15837
|
if (first2 === last)
|
|
15477
15838
|
return quoteSheetName(first2);
|
|
15478
|
-
const
|
|
15479
|
-
return
|
|
15839
|
+
const plain2 = quoteSheetName(first2) === first2 && quoteSheetName(last) === last;
|
|
15840
|
+
return plain2 ? `${first2}:${last}` : `'${`${first2}:${last}`.replace(/'/g, "''")}'`;
|
|
15480
15841
|
}
|
|
15481
15842
|
function parseGlobals(records) {
|
|
15482
15843
|
const first2 = records[0];
|
|
@@ -15624,7 +15985,7 @@ function parseGlobals(records) {
|
|
|
15624
15985
|
return out;
|
|
15625
15986
|
}
|
|
15626
15987
|
|
|
15627
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15988
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
|
|
15628
15989
|
function encodeRkExact(value) {
|
|
15629
15990
|
if (!Number.isFinite(value))
|
|
15630
15991
|
return void 0;
|
|
@@ -15789,7 +16150,7 @@ function editXlsNumericCell(input, edit) {
|
|
|
15789
16150
|
}
|
|
15790
16151
|
}
|
|
15791
16152
|
|
|
15792
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16153
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
|
|
15793
16154
|
var OPCODE_BOF = 2057;
|
|
15794
16155
|
var OPCODE_EOF = 10;
|
|
15795
16156
|
var OPCODE_FILEPASS = 47;
|
|
@@ -15836,7 +16197,7 @@ function decodeRk(rk) {
|
|
|
15836
16197
|
return isDiv100 ? value / 100 : value;
|
|
15837
16198
|
}
|
|
15838
16199
|
|
|
15839
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16200
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-formulas.js
|
|
15840
16201
|
function readRefU(r) {
|
|
15841
16202
|
return { firstRow: r.u16(), lastRow: r.u16(), firstCol: r.u8(), lastCol: r.u8() };
|
|
15842
16203
|
}
|
|
@@ -15894,7 +16255,7 @@ function resolveFormulas(formulas, shared, arrays, globals) {
|
|
|
15894
16255
|
}
|
|
15895
16256
|
}
|
|
15896
16257
|
|
|
15897
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16258
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet-extras.js
|
|
15898
16259
|
function parseMergedCells(data) {
|
|
15899
16260
|
const r = new ByteReader(data);
|
|
15900
16261
|
const count = r.u16();
|
|
@@ -16089,7 +16450,7 @@ function parseNote(data) {
|
|
|
16089
16450
|
return { row: row2, col, visible: (flags & 2) !== 0, id: id3, author: r.xlString() };
|
|
16090
16451
|
}
|
|
16091
16452
|
|
|
16092
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16453
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet.js
|
|
16093
16454
|
var UNSUPPORTED = {
|
|
16094
16455
|
432: "conditional formatting",
|
|
16095
16456
|
2169: "conditional formatting",
|
|
@@ -16345,7 +16706,7 @@ function parseSheet(bound2, records, start, globals) {
|
|
|
16345
16706
|
return sheet;
|
|
16346
16707
|
}
|
|
16347
16708
|
|
|
16348
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16709
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook.js
|
|
16349
16710
|
function compoundStreamNames(bytes) {
|
|
16350
16711
|
if (!OLE_MAGIC.every((value, index) => bytes[index] === value))
|
|
16351
16712
|
return [];
|
|
@@ -16415,7 +16776,7 @@ function readXlsWorkbook(bytes) {
|
|
|
16415
16776
|
};
|
|
16416
16777
|
}
|
|
16417
16778
|
|
|
16418
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16779
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-sst.js
|
|
16419
16780
|
var SstCursor = class {
|
|
16420
16781
|
segments;
|
|
16421
16782
|
segment = 0;
|
|
@@ -16538,7 +16899,7 @@ function appendXlsSstString(value) {
|
|
|
16538
16899
|
return Uint8Array.from(records);
|
|
16539
16900
|
}
|
|
16540
16901
|
|
|
16541
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16902
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js
|
|
16542
16903
|
var CELL_OPS = /* @__PURE__ */ new Set([6, 513, 515, 516, 517, 638, 253, 189, 190, 214]);
|
|
16543
16904
|
function record2(opcode, data) {
|
|
16544
16905
|
const out = new Uint8Array(data.length + 4), view2 = new DataView(out.buffer);
|
|
@@ -16630,7 +16991,7 @@ function relocateXlsDbCells(input, out, records, replacement, map) {
|
|
|
16630
16991
|
}
|
|
16631
16992
|
}
|
|
16632
16993
|
|
|
16633
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16994
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js
|
|
16634
16995
|
var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
16635
16996
|
6,
|
|
16636
16997
|
10,
|
|
@@ -16988,7 +17349,7 @@ var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
|
16988
17349
|
]);
|
|
16989
17350
|
var XLS_FRT_WRAPPER = 2129;
|
|
16990
17351
|
|
|
16991
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17352
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js
|
|
16992
17353
|
var EditError = class extends Error {
|
|
16993
17354
|
reason;
|
|
16994
17355
|
constructor(reason) {
|
|
@@ -17112,7 +17473,7 @@ function findTarget(bytes, m, edit, allowed = [253, 638, 515, 189]) {
|
|
|
17112
17473
|
return target2;
|
|
17113
17474
|
}
|
|
17114
17475
|
|
|
17115
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17476
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-edit.js
|
|
17116
17477
|
function extSst(entries, map) {
|
|
17117
17478
|
const interval = Math.max(Math.floor(entries.length / 128) + 1, 8);
|
|
17118
17479
|
const count = Math.ceil(entries.length / interval);
|
|
@@ -17248,7 +17609,7 @@ function editXlsStringWorkbookStream(input, edit) {
|
|
|
17248
17609
|
}
|
|
17249
17610
|
}
|
|
17250
17611
|
|
|
17251
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17612
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-cell.js
|
|
17252
17613
|
function editXlsPreservedStringCell(input, edit) {
|
|
17253
17614
|
if (!OLE_MAGIC.every((value, index) => input[index] === value))
|
|
17254
17615
|
return editXlsStringWorkbookStream(input, edit);
|
|
@@ -17267,7 +17628,7 @@ function editXlsPreservedStringCell(input, edit) {
|
|
|
17267
17628
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17268
17629
|
}
|
|
17269
17630
|
|
|
17270
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17631
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-edit.js
|
|
17271
17632
|
var ERRORS = Object.freeze({
|
|
17272
17633
|
"#NULL!": 0,
|
|
17273
17634
|
"#DIV/0!": 7,
|
|
@@ -17385,7 +17746,7 @@ function editXlsBoolErrorCell(input, edit) {
|
|
|
17385
17746
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17386
17747
|
}
|
|
17387
17748
|
|
|
17388
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17749
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-record.js
|
|
17389
17750
|
function record3(opcode, data) {
|
|
17390
17751
|
const out = new Uint8Array(4 + data.length), view2 = new DataView(out.buffer);
|
|
17391
17752
|
view2.setUint16(0, opcode, true);
|
|
@@ -17431,7 +17792,7 @@ function replaceXlsBlankRecord(input, target2, col, value) {
|
|
|
17431
17792
|
return { start: target2.headerOffset, end: p + target2.length, bytes };
|
|
17432
17793
|
}
|
|
17433
17794
|
|
|
17434
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17795
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-stored-cell-edit.js
|
|
17435
17796
|
function applyXlsCellRecordReplacement(input, m, replacement) {
|
|
17436
17797
|
if (!Number.isSafeInteger(replacement.start) || !Number.isSafeInteger(replacement.end) || replacement.start < 0 || replacement.end <= replacement.start || replacement.end > input.length || !(replacement.bytes instanceof Uint8Array))
|
|
17437
17798
|
reject("malformed-records");
|
|
@@ -17543,17 +17904,17 @@ function editXlsStoredCell(input, edit, sourceKind) {
|
|
|
17543
17904
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17544
17905
|
}
|
|
17545
17906
|
|
|
17546
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17907
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-edit.js
|
|
17547
17908
|
function editXlsBlankCell(input, edit) {
|
|
17548
17909
|
return editXlsStoredCell(input, edit, "blank");
|
|
17549
17910
|
}
|
|
17550
17911
|
|
|
17551
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17912
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-conversion.js
|
|
17552
17913
|
function editXlsBoolErrorScalarCell(input, edit) {
|
|
17553
17914
|
return editXlsStoredCell(input, edit, "bool-error");
|
|
17554
17915
|
}
|
|
17555
17916
|
|
|
17556
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17917
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/xls-document.js
|
|
17557
17918
|
function cellType(cell) {
|
|
17558
17919
|
if (cell.formula !== void 0 || cell.formulaUndecoded || cell.arrayRange || cell.sharedFormula)
|
|
17559
17920
|
return "formula";
|
|
@@ -17750,7 +18111,7 @@ var XlsDocument = class extends Ole2DocumentBase {
|
|
|
17750
18111
|
}
|
|
17751
18112
|
};
|
|
17752
18113
|
|
|
17753
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18114
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
|
|
17754
18115
|
var PptParseError = class extends Error {
|
|
17755
18116
|
constructor(message) {
|
|
17756
18117
|
super(message);
|
|
@@ -17784,7 +18145,7 @@ function readRecordOrThrow(view2, offset) {
|
|
|
17784
18145
|
return rec;
|
|
17785
18146
|
}
|
|
17786
18147
|
|
|
17787
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18148
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
|
|
17788
18149
|
var RT2 = {
|
|
17789
18150
|
Document: 1e3,
|
|
17790
18151
|
DocumentAtom: 1001,
|
|
@@ -17879,7 +18240,7 @@ var OA = {
|
|
|
17879
18240
|
var HEADER_TOKEN_PLAIN = 3817979999;
|
|
17880
18241
|
var HEADER_TOKEN_ENCRYPTED = 4090610911;
|
|
17881
18242
|
|
|
17882
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18243
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
|
|
17883
18244
|
var DEFAULT_MAX_EDITS = 1e4;
|
|
17884
18245
|
var DEFAULT_MAX_ENTRIES = 1e6;
|
|
17885
18246
|
function checkedLimit(value) {
|
|
@@ -17996,7 +18357,7 @@ function buildPersistDirectory(view2, offsetToCurrentEdit, limits = {}) {
|
|
|
17996
18357
|
return { currentEdit: edits[0], directory };
|
|
17997
18358
|
}
|
|
17998
18359
|
|
|
17999
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18360
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text.js
|
|
18000
18361
|
var PptTextError = class extends PptParseError {
|
|
18001
18362
|
code;
|
|
18002
18363
|
constructor(code, message) {
|
|
@@ -18251,7 +18612,7 @@ function editPptSlideText(input, edit) {
|
|
|
18251
18612
|
}
|
|
18252
18613
|
}
|
|
18253
18614
|
|
|
18254
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18615
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-reader.js
|
|
18255
18616
|
var DEFAULT_LIMITS = { maxRecords: 1e5, maxShapes: 1e4, maxProperties: 1e5, maxNameChars: 1e6, maxTextBytes: 16 * 1024 * 1024 };
|
|
18256
18617
|
var GEOMETRY_PROPERTY_IDS = /* @__PURE__ */ new Set([4, 127, 128, 191, 385, 447, 448, 459, 511, 896, 959]);
|
|
18257
18618
|
function pptShapeChildren(view2, parent) {
|
|
@@ -18331,8 +18692,8 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18331
18692
|
}
|
|
18332
18693
|
}
|
|
18333
18694
|
if (rec.recVer === 15 || rec.recType === OA.ClientTextbox)
|
|
18334
|
-
for (const
|
|
18335
|
-
preflight.push({ rec:
|
|
18695
|
+
for (const child3 of pptShapeChildren(view2, rec))
|
|
18696
|
+
preflight.push({ rec: child3, depth: depth + 1 });
|
|
18336
18697
|
}
|
|
18337
18698
|
const textModel = readPptSlideTexts(input);
|
|
18338
18699
|
return textModel.slides.map((slide) => {
|
|
@@ -18470,7 +18831,7 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18470
18831
|
});
|
|
18471
18832
|
}
|
|
18472
18833
|
|
|
18473
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18834
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-edit.js
|
|
18474
18835
|
function equalPptShapeBounds(a, b) {
|
|
18475
18836
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
18476
18837
|
}
|
|
@@ -18559,7 +18920,7 @@ function editPptShapeBounds(input, edit) {
|
|
|
18559
18920
|
}
|
|
18560
18921
|
}
|
|
18561
18922
|
|
|
18562
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18923
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-notes.js
|
|
18563
18924
|
var viewOf2 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18564
18925
|
function fail2(message) {
|
|
18565
18926
|
throw new PptTextError("corrupt", message);
|
|
@@ -18598,11 +18959,11 @@ function inspect5(input, limits = {}) {
|
|
|
18598
18959
|
fail2("Notes record budget exceeded");
|
|
18599
18960
|
if (end - pos < 8)
|
|
18600
18961
|
fail2("Truncated notes child header");
|
|
18601
|
-
const
|
|
18602
|
-
if (
|
|
18962
|
+
const child3 = record5(pos);
|
|
18963
|
+
if (child3.dataOffset + child3.recLen > end)
|
|
18603
18964
|
fail2("Notes child exceeds parent");
|
|
18604
|
-
result.push(
|
|
18605
|
-
pos =
|
|
18965
|
+
result.push(child3);
|
|
18966
|
+
pos = child3.dataOffset + child3.recLen;
|
|
18606
18967
|
}
|
|
18607
18968
|
return result;
|
|
18608
18969
|
};
|
|
@@ -18845,7 +19206,7 @@ function editPptNotesText(input, edit) {
|
|
|
18845
19206
|
}
|
|
18846
19207
|
}
|
|
18847
19208
|
|
|
18848
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19209
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text-style.js
|
|
18849
19210
|
var viewOf3 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18850
19211
|
var MAX_RECORDS = 1e5;
|
|
18851
19212
|
var MAX_RUNS = 2e4;
|
|
@@ -19028,22 +19389,22 @@ function readPptCharacterRuns(input, limits = {}) {
|
|
|
19028
19389
|
associations.set(atom, { styles: group.styles, textCount: group.atoms.length });
|
|
19029
19390
|
}
|
|
19030
19391
|
};
|
|
19031
|
-
for (const
|
|
19032
|
-
if (textParent && (
|
|
19392
|
+
for (const child3 of list2) {
|
|
19393
|
+
if (textParent && (child3.recType === RT2.TextHeaderAtom || child3.recType === RT2.SlidePersistAtom)) {
|
|
19033
19394
|
finish();
|
|
19034
|
-
group =
|
|
19035
|
-
if (group && (
|
|
19395
|
+
group = child3.recType === RT2.TextHeaderAtom ? { atoms: [], styles: [] } : void 0;
|
|
19396
|
+
if (group && (child3.recVer !== 0 || child3.recInstance > (record5.recType === OA.ClientTextbox ? 0 : 5) || child3.recLen !== 4))
|
|
19036
19397
|
throw new Error("Invalid formatting TextHeaderAtom");
|
|
19037
|
-
} else if (group && (
|
|
19038
|
-
group.atoms.push(
|
|
19039
|
-
else if (group &&
|
|
19040
|
-
styleBytes +=
|
|
19398
|
+
} else if (group && (child3.recType === RT2.TextCharsAtom || child3.recType === RT2.TextBytesAtom))
|
|
19399
|
+
group.atoms.push(child3.headerOffset);
|
|
19400
|
+
else if (group && child3.recType === RT2.StyleTextPropAtom) {
|
|
19401
|
+
styleBytes += child3.recLen;
|
|
19041
19402
|
if (styleBytes > maxStyleBytes)
|
|
19042
19403
|
throw new Error("Formatting payload budget exceeded");
|
|
19043
|
-
group.styles.push(
|
|
19404
|
+
group.styles.push(child3);
|
|
19044
19405
|
}
|
|
19045
|
-
if (
|
|
19046
|
-
stack.push({ record:
|
|
19406
|
+
if (child3.recVer === 15 || child3.recType === OA.ClientTextbox)
|
|
19407
|
+
stack.push({ record: child3, depth: depth + 1 });
|
|
19047
19408
|
}
|
|
19048
19409
|
finish();
|
|
19049
19410
|
}
|
|
@@ -19131,7 +19492,7 @@ function editPptCharacterFontSize(input, edit) {
|
|
|
19131
19492
|
}
|
|
19132
19493
|
}
|
|
19133
19494
|
|
|
19134
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19495
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt-document.js
|
|
19135
19496
|
var PPT_CAPABILITIES = Object.freeze({
|
|
19136
19497
|
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"]),
|
|
19137
19498
|
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"]),
|
|
@@ -19567,7 +19928,7 @@ var PptDocument = class extends Ole2DocumentBase {
|
|
|
19567
19928
|
}
|
|
19568
19929
|
};
|
|
19569
19930
|
|
|
19570
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19931
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression.js
|
|
19571
19932
|
function decodeVsdBlock(input, limit3 = 32 * 1024 * 1024) {
|
|
19572
19933
|
if (!Number.isSafeInteger(limit3) || limit3 < 0 || limit3 > 64 * 1024 * 1024)
|
|
19573
19934
|
throw new Error("Invalid VSD decompression limit");
|
|
@@ -19614,7 +19975,7 @@ function encodeVsdBlock(input) {
|
|
|
19614
19975
|
return output;
|
|
19615
19976
|
}
|
|
19616
19977
|
|
|
19617
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19978
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-reader.js
|
|
19618
19979
|
var VsdError = class extends Error {
|
|
19619
19980
|
reason;
|
|
19620
19981
|
constructor(reason) {
|
|
@@ -19988,7 +20349,7 @@ function readVsdDrawing(input) {
|
|
|
19988
20349
|
return data;
|
|
19989
20350
|
}
|
|
19990
20351
|
|
|
19991
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20352
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression-fit.js
|
|
19992
20353
|
var VSD_COMPRESSION_FIT_MAX_BYTES = 8 * 1024 * 1024;
|
|
19993
20354
|
var MAX_INPUT = VSD_COMPRESSION_FIT_MAX_BYTES;
|
|
19994
20355
|
var MAX_GAP = 4096;
|
|
@@ -20163,7 +20524,7 @@ function encodeVsdBlockToSize(input, capacity) {
|
|
|
20163
20524
|
return { bytes: output, paddingBytes: 0 };
|
|
20164
20525
|
}
|
|
20165
20526
|
|
|
20166
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20527
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-writer.js
|
|
20167
20528
|
function replaceRecord(input, drawing, record5, replacement) {
|
|
20168
20529
|
if (!drawing.writable)
|
|
20169
20530
|
throw new VsdError("shared-or-overlapping-allocation");
|
|
@@ -20247,7 +20608,7 @@ function replaceVsdShapeTransform(input, pageId2, shapeId2, transform2) {
|
|
|
20247
20608
|
return candidate;
|
|
20248
20609
|
}
|
|
20249
20610
|
|
|
20250
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20611
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-document.js
|
|
20251
20612
|
var VsdShape = class {
|
|
20252
20613
|
id;
|
|
20253
20614
|
#read;
|
|
@@ -20398,7 +20759,7 @@ var VsdDocument = class extends Ole2DocumentBase {
|
|
|
20398
20759
|
}
|
|
20399
20760
|
};
|
|
20400
20761
|
|
|
20401
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20762
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document.js
|
|
20402
20763
|
var CfbDocument = class extends Ole2DocumentBase {
|
|
20403
20764
|
get kind() {
|
|
20404
20765
|
return "cfb";
|
|
@@ -20845,98 +21206,293 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
|
|
|
20845
21206
|
}
|
|
20846
21207
|
}
|
|
20847
21208
|
|
|
20848
|
-
// visio/edit-
|
|
20849
|
-
function
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
|
|
20853
|
-
|
|
20854
|
-
|
|
20855
|
-
|
|
20856
|
-
|
|
20857
|
-
|
|
20858
|
-
|
|
20859
|
-
|
|
20860
|
-
edit.pageId,
|
|
20861
|
-
shape,
|
|
20862
|
-
/* @__PURE__ */ new Map([["TheText", text3]]),
|
|
20863
|
-
check
|
|
20864
|
-
)
|
|
20865
|
-
);
|
|
20866
|
-
}
|
|
20867
|
-
|
|
20868
|
-
// visio/edit-text-range-plan.ts
|
|
20869
|
-
function textRangeNodes(node2, edit) {
|
|
20870
|
-
const tokens2 = [];
|
|
20871
|
-
let stored = "";
|
|
20872
|
-
for (const part of Array.from(node2.childNodes)) {
|
|
20873
|
-
const start = stored.length;
|
|
20874
|
-
const field2 = part.nodeType === 1 && part.localName === "fld";
|
|
20875
|
-
if (part.nodeType === 3 || part.nodeType === 4) stored += part.nodeValue ?? "";
|
|
20876
|
-
else if (field2) stored += part.textContent ?? "";
|
|
20877
|
-
tokens2.push({ node: part, start, end: stored.length, ...field2 ? { field: field2 } : {} });
|
|
20878
|
-
}
|
|
20879
|
-
if (decodeVisioPlainText(stored) !== edit.expectedText)
|
|
20880
|
-
fail("EDIT_STALE_TEXT", "Original text no longer matches the range command.");
|
|
20881
|
-
const changed = edit.ranges.some(
|
|
20882
|
-
(range2) => edit.expectedText.slice(range2.start, range2.end) !== range2.text
|
|
20883
|
-
);
|
|
20884
|
-
if (!changed) return { changed: false, nodes: [] };
|
|
20885
|
-
for (const token of tokens2)
|
|
20886
|
-
if (token.field && edit.ranges.some((range2) => range2.start < token.end && range2.end > token.start))
|
|
21209
|
+
// visio/edit-master-index.ts
|
|
21210
|
+
function inheritedProtection(node2, ancestor) {
|
|
21211
|
+
try {
|
|
21212
|
+
const boolean2 = (cell) => {
|
|
21213
|
+
if (!cell || cell.hasAttribute("E"))
|
|
21214
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection has an unresolved or error cache.");
|
|
21215
|
+
const value = visioFormulaCachedValue(attribute2(cell, "V") ?? "", attribute2(cell, "U"));
|
|
21216
|
+
if (value.unit !== "scalar" || ![0, 1].includes(value.value))
|
|
21217
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection requires scalar boolean caches.");
|
|
21218
|
+
return value.value;
|
|
21219
|
+
};
|
|
21220
|
+
if (boolean2(node2) !== boolean2(ancestor))
|
|
20887
21221
|
fail(
|
|
20888
|
-
"
|
|
20889
|
-
"
|
|
21222
|
+
"EDIT_PROTECTED_CELL",
|
|
21223
|
+
"Delegated master style protection cache disagrees with its ancestor."
|
|
20890
21224
|
);
|
|
20891
|
-
|
|
20892
|
-
let delta = 0;
|
|
20893
|
-
for (const range2 of edit.ranges) {
|
|
20894
|
-
starts.push(range2.start + delta);
|
|
20895
|
-
delta += range2.text.length - (range2.end - range2.start);
|
|
20896
|
-
deltas.push(delta);
|
|
20897
|
-
}
|
|
20898
|
-
const length = edit.expectedText.length + delta;
|
|
20899
|
-
if (!length && tokens2.some((token) => token.node.nodeType === 1))
|
|
21225
|
+
} catch (error) {
|
|
20900
21226
|
fail(
|
|
20901
|
-
"
|
|
20902
|
-
|
|
21227
|
+
"EDIT_PROTECTED_CELL",
|
|
21228
|
+
`Inherited master style protection cannot be proven: ${error instanceof Error ? error.message : "invalid cache"}`
|
|
20903
21229
|
);
|
|
20904
|
-
if (tokens2.some((token) => token.node.nodeType === 1)) {
|
|
20905
|
-
let start = 0, index = 0;
|
|
20906
|
-
while (start < edit.expectedText.length) {
|
|
20907
|
-
const newline = edit.expectedText.indexOf("\n", start), end = newline < 0 ? edit.expectedText.length : newline;
|
|
20908
|
-
let bodyLength = end - start;
|
|
20909
|
-
while (index < edit.ranges.length && edit.ranges[index].start < end) {
|
|
20910
|
-
const range2 = edit.ranges[index++];
|
|
20911
|
-
bodyLength += range2.text.length - (range2.end - range2.start);
|
|
20912
|
-
}
|
|
20913
|
-
if (end > start && !bodyLength)
|
|
20914
|
-
fail(
|
|
20915
|
-
"UNSUPPORTED_TEXT_RANGE",
|
|
20916
|
-
"Deleting an entire rich paragraph body has unproven native insertion-style behavior."
|
|
20917
|
-
);
|
|
20918
|
-
start = end + 1;
|
|
20919
|
-
}
|
|
20920
21230
|
}
|
|
20921
|
-
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
|
|
20928
|
-
const
|
|
20929
|
-
if (
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
};
|
|
20933
|
-
const
|
|
20934
|
-
const
|
|
20935
|
-
|
|
20936
|
-
const
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
21231
|
+
}
|
|
21232
|
+
function masterCells(sheet, charge = () => {
|
|
21233
|
+
}) {
|
|
21234
|
+
const result = /* @__PURE__ */ new Map();
|
|
21235
|
+
if (!sheet) return result;
|
|
21236
|
+
const add = (name3, node2) => {
|
|
21237
|
+
charge();
|
|
21238
|
+
const id3 = name3.toLowerCase();
|
|
21239
|
+
if (result.has(id3) && result.get(id3) !== node2)
|
|
21240
|
+
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous effective master cells.");
|
|
21241
|
+
result.set(id3, node2);
|
|
21242
|
+
};
|
|
21243
|
+
for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
|
|
21244
|
+
for (const section2 of children2(sheet, "Section")) {
|
|
21245
|
+
const name3 = attribute2(section2, "N") ?? "";
|
|
21246
|
+
const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section2, "IX") ?? "0") + 1}` : name3 === "Control" ? "Controls" : name3;
|
|
21247
|
+
for (const node2 of children2(section2, "Cell"))
|
|
21248
|
+
add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
|
|
21249
|
+
for (const row2 of children2(section2, "Row"))
|
|
21250
|
+
for (const node2 of children2(row2, "Cell")) {
|
|
21251
|
+
const n = attribute2(node2, "N") ?? "";
|
|
21252
|
+
const rowName = attribute2(row2, "N");
|
|
21253
|
+
const index = attribute2(row2, "IX") ?? (prefix2 === "Controls" && /^Row_\d+$/.test(rowName ?? "") ? String(Number(rowName.slice(4)) - 1) : void 0);
|
|
21254
|
+
const ix = index ?? "0", r = rowName ?? (prefix2 === "Controls" ? `Row_${Number(ix) + 1}` : ix);
|
|
21255
|
+
add(
|
|
21256
|
+
name3 === "Geometry" || ["Controls", "Scratch", "Connection"].includes(prefix2) ? `${prefix2}.${n}${ix}` : n === "Value" && ["User", "Prop"].includes(name3) ? `${prefix2}.${r}` : `${prefix2}.${r}.${n}`,
|
|
21257
|
+
node2
|
|
21258
|
+
);
|
|
21259
|
+
if (name3 !== "Geometry") add(`${prefix2}.${r}.${n}`, node2);
|
|
21260
|
+
if (prefix2 === "Controls" && n === "X") add(`${prefix2}.${r}`, node2);
|
|
21261
|
+
if (name3 !== "Geometry" && index !== void 0) add(`${prefix2}.$row${ix}.${n}`, node2);
|
|
21262
|
+
}
|
|
21263
|
+
}
|
|
21264
|
+
return result;
|
|
21265
|
+
}
|
|
21266
|
+
function masterShapes(root2) {
|
|
21267
|
+
const result = [], pending = [root2];
|
|
21268
|
+
while (pending.length) {
|
|
21269
|
+
const parent = pending.pop();
|
|
21270
|
+
for (const container of children2(parent, "Shapes"))
|
|
21271
|
+
for (const shape of children2(container, "Shape")) {
|
|
21272
|
+
result.push(shape);
|
|
21273
|
+
pending.push(shape);
|
|
21274
|
+
}
|
|
21275
|
+
}
|
|
21276
|
+
return result;
|
|
21277
|
+
}
|
|
21278
|
+
function assertMasterMarkup(root2, known, check) {
|
|
21279
|
+
for (const node2 of [root2, ...Array.from(root2.getElementsByTagName("*"))]) {
|
|
21280
|
+
check();
|
|
21281
|
+
if (node2.namespaceURI === root2.namespaceURI && node2.hasAttribute("F") && !known.has(node2))
|
|
21282
|
+
fail(
|
|
21283
|
+
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
21284
|
+
"Master formula outside admitted sheet cells has unknown scope."
|
|
21285
|
+
);
|
|
21286
|
+
}
|
|
21287
|
+
}
|
|
21288
|
+
function masterStyleCells(document, template, instance, check, charge = () => {
|
|
21289
|
+
}, verifyMovementProtection = false) {
|
|
21290
|
+
const styles = /* @__PURE__ */ new Map();
|
|
21291
|
+
for (const container of children2(document, "StyleSheets"))
|
|
21292
|
+
for (const style2 of children2(container, "StyleSheet")) {
|
|
21293
|
+
charge();
|
|
21294
|
+
const id3 = attribute2(style2, "ID");
|
|
21295
|
+
if (!id3 || styles.has(id3))
|
|
21296
|
+
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous master style IDs.");
|
|
21297
|
+
styles.set(id3, style2);
|
|
21298
|
+
}
|
|
21299
|
+
const defaults = children2(document, "DocumentSheet")[0];
|
|
21300
|
+
const collect = (id3, category, seen = /* @__PURE__ */ new Set()) => {
|
|
21301
|
+
check();
|
|
21302
|
+
if (seen.has(id3) || seen.size >= 64)
|
|
21303
|
+
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Invalid inherited master style ancestry.");
|
|
21304
|
+
seen.add(id3);
|
|
21305
|
+
const style2 = styles.get(id3);
|
|
21306
|
+
if (!style2) fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Missing inherited master style.");
|
|
21307
|
+
const own = masterCells(style2, charge);
|
|
21308
|
+
assertMasterMarkup(style2, new Set(own.values()), check);
|
|
21309
|
+
const parent = attribute2(style2, category);
|
|
21310
|
+
const result2 = parent !== void 0 && parent !== id3 ? collect(parent, category, seen) : /* @__PURE__ */ new Map();
|
|
21311
|
+
for (const [name3, node2] of own) {
|
|
21312
|
+
charge();
|
|
21313
|
+
if (attribute2(node2, "F") !== "Inh") result2.set(name3, node2);
|
|
21314
|
+
else if (verifyMovementProtection && /^lock(move[xy]|width|height|aspect|delete)$/.test(name3)) {
|
|
21315
|
+
charge();
|
|
21316
|
+
inheritedProtection(node2, result2.get(name3));
|
|
21317
|
+
}
|
|
21318
|
+
}
|
|
21319
|
+
return result2;
|
|
21320
|
+
};
|
|
21321
|
+
const result = /* @__PURE__ */ new Map();
|
|
21322
|
+
for (const category of ["LineStyle", "FillStyle", "TextStyle"]) {
|
|
21323
|
+
const id3 = attribute2(instance, category) ?? attribute2(template, category) ?? attribute2(defaults, category) ?? (styles.has("0") ? "0" : void 0);
|
|
21324
|
+
if (id3 !== void 0)
|
|
21325
|
+
for (const [name3, node2] of collect(id3, category)) {
|
|
21326
|
+
charge();
|
|
21327
|
+
if (result.has(name3) && result.get(name3) !== node2)
|
|
21328
|
+
fail(
|
|
21329
|
+
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
21330
|
+
"Master style categories have ambiguous overlapping inputs."
|
|
21331
|
+
);
|
|
21332
|
+
result.set(name3, node2);
|
|
21333
|
+
}
|
|
21334
|
+
}
|
|
21335
|
+
return result;
|
|
21336
|
+
}
|
|
21337
|
+
function overlay(cells4, additions, kind, charge) {
|
|
21338
|
+
const aliases = /* @__PURE__ */ new Map(), inherited = /* @__PURE__ */ new Map();
|
|
21339
|
+
for (const [name3, source] of cells4) {
|
|
21340
|
+
charge();
|
|
21341
|
+
const names = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
21342
|
+
names.add(name3);
|
|
21343
|
+
aliases.set(source.node, names);
|
|
21344
|
+
}
|
|
21345
|
+
for (const [name3, node2] of additions) {
|
|
21346
|
+
charge();
|
|
21347
|
+
const source = cells4.get(name3);
|
|
21348
|
+
if (source) inherited.set(node2, source);
|
|
21349
|
+
}
|
|
21350
|
+
for (const [name3, node2] of additions) {
|
|
21351
|
+
charge();
|
|
21352
|
+
if (attribute2(node2, "F") === "Inh") {
|
|
21353
|
+
const source = cells4.get(name3) ?? inherited.get(node2);
|
|
21354
|
+
if (!source)
|
|
21355
|
+
fail(
|
|
21356
|
+
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
21357
|
+
"Inherited master cell has no effective source."
|
|
21358
|
+
);
|
|
21359
|
+
cells4.set(name3, source);
|
|
21360
|
+
const names2 = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
21361
|
+
names2.add(name3);
|
|
21362
|
+
aliases.set(source.node, names2);
|
|
21363
|
+
continue;
|
|
21364
|
+
}
|
|
21365
|
+
const previous = cells4.get(name3), names = aliases.get(node2) ?? /* @__PURE__ */ new Set();
|
|
21366
|
+
if (previous && previous.node !== node2) {
|
|
21367
|
+
for (const alias of aliases.get(previous.node) ?? []) {
|
|
21368
|
+
charge();
|
|
21369
|
+
cells4.set(alias, { node: node2, kind });
|
|
21370
|
+
names.add(alias);
|
|
21371
|
+
}
|
|
21372
|
+
aliases.delete(previous.node);
|
|
21373
|
+
}
|
|
21374
|
+
cells4.set(name3, { node: node2, kind });
|
|
21375
|
+
names.add(name3);
|
|
21376
|
+
aliases.set(node2, names);
|
|
21377
|
+
}
|
|
21378
|
+
}
|
|
21379
|
+
|
|
21380
|
+
// visio/edit-text-scope.ts
|
|
21381
|
+
function masterTemplate(pkg) {
|
|
21382
|
+
const missing = () => fail("UNSUPPORTED_TEXT_EDIT", "The master of this stencil shape cannot be resolved.");
|
|
21383
|
+
return async (masterId, masterShapeId) => {
|
|
21384
|
+
const documentPart2 = await related(pkg, "", "document");
|
|
21385
|
+
const mastersPart = documentPart2 && await related(pkg, documentPart2, "masters", false);
|
|
21386
|
+
if (!mastersPart) return missing();
|
|
21387
|
+
const definitions = children2(await visioXml(pkg, mastersPart, "Masters"), "Master").filter(
|
|
21388
|
+
(node2) => attribute2(node2, "ID") === masterId
|
|
21389
|
+
);
|
|
21390
|
+
if (definitions.length !== 1) return missing();
|
|
21391
|
+
const root2 = await visioXml(
|
|
21392
|
+
pkg,
|
|
21393
|
+
await indexedPart(pkg, mastersPart, definitions[0], "master"),
|
|
21394
|
+
"MasterContents"
|
|
21395
|
+
);
|
|
21396
|
+
if (masterShapeId === void 0) {
|
|
21397
|
+
const tops = children2(children2(root2, "Shapes")[0], "Shape");
|
|
21398
|
+
return tops.length === 1 ? tops[0] : missing();
|
|
21399
|
+
}
|
|
21400
|
+
const matches = masterShapes(root2).filter((shape) => attribute2(shape, "ID") === masterShapeId);
|
|
21401
|
+
return matches.length === 1 ? matches[0] : missing();
|
|
21402
|
+
};
|
|
21403
|
+
}
|
|
21404
|
+
function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check) {
|
|
21405
|
+
return replacePlainText(
|
|
21406
|
+
roots.get(edit.pageId),
|
|
21407
|
+
document,
|
|
21408
|
+
edit.shapeId,
|
|
21409
|
+
edit.text,
|
|
21410
|
+
check,
|
|
21411
|
+
(shape, text3) => assertFormattingDependencies(
|
|
21412
|
+
pkg,
|
|
21413
|
+
pagePaths,
|
|
21414
|
+
roots,
|
|
21415
|
+
edit.pageId,
|
|
21416
|
+
shape,
|
|
21417
|
+
/* @__PURE__ */ new Map([["TheText", text3]]),
|
|
21418
|
+
check
|
|
21419
|
+
),
|
|
21420
|
+
masterTemplate(pkg)
|
|
21421
|
+
);
|
|
21422
|
+
}
|
|
21423
|
+
|
|
21424
|
+
// visio/edit-text-range-plan.ts
|
|
21425
|
+
function textRangeNodes(node2, edit) {
|
|
21426
|
+
const tokens2 = [];
|
|
21427
|
+
let stored = "";
|
|
21428
|
+
for (const part of Array.from(node2.childNodes)) {
|
|
21429
|
+
const start = stored.length;
|
|
21430
|
+
const field2 = part.nodeType === 1 && part.localName === "fld";
|
|
21431
|
+
if (part.nodeType === 3 || part.nodeType === 4) stored += part.nodeValue ?? "";
|
|
21432
|
+
else if (field2) stored += part.textContent ?? "";
|
|
21433
|
+
tokens2.push({ node: part, start, end: stored.length, ...field2 ? { field: field2 } : {} });
|
|
21434
|
+
}
|
|
21435
|
+
if (decodeVisioPlainText(stored) !== edit.expectedText)
|
|
21436
|
+
fail("EDIT_STALE_TEXT", "Original text no longer matches the range command.");
|
|
21437
|
+
const changed = edit.ranges.some(
|
|
21438
|
+
(range2) => edit.expectedText.slice(range2.start, range2.end) !== range2.text
|
|
21439
|
+
);
|
|
21440
|
+
if (!changed) return { changed: false, nodes: [] };
|
|
21441
|
+
for (const token of tokens2)
|
|
21442
|
+
if (token.field && edit.ranges.some((range2) => range2.start < token.end && range2.end > token.start))
|
|
21443
|
+
fail(
|
|
21444
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
21445
|
+
"Text fields are atomic: edit the text around a field, not the field itself."
|
|
21446
|
+
);
|
|
21447
|
+
const starts = [], deltas = [];
|
|
21448
|
+
let delta = 0;
|
|
21449
|
+
for (const range2 of edit.ranges) {
|
|
21450
|
+
starts.push(range2.start + delta);
|
|
21451
|
+
delta += range2.text.length - (range2.end - range2.start);
|
|
21452
|
+
deltas.push(delta);
|
|
21453
|
+
}
|
|
21454
|
+
const length = edit.expectedText.length + delta;
|
|
21455
|
+
if (!length && tokens2.some((token) => token.node.nodeType === 1))
|
|
21456
|
+
fail(
|
|
21457
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
21458
|
+
"Deleting all rich text has unproven native insertion-style behavior."
|
|
21459
|
+
);
|
|
21460
|
+
if (tokens2.some((token) => token.node.nodeType === 1)) {
|
|
21461
|
+
let start = 0, index = 0;
|
|
21462
|
+
while (start < edit.expectedText.length) {
|
|
21463
|
+
const newline = edit.expectedText.indexOf("\n", start), end = newline < 0 ? edit.expectedText.length : newline;
|
|
21464
|
+
let bodyLength = end - start;
|
|
21465
|
+
while (index < edit.ranges.length && edit.ranges[index].start < end) {
|
|
21466
|
+
const range2 = edit.ranges[index++];
|
|
21467
|
+
bodyLength += range2.text.length - (range2.end - range2.start);
|
|
21468
|
+
}
|
|
21469
|
+
if (end > start && !bodyLength)
|
|
21470
|
+
fail(
|
|
21471
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
21472
|
+
"Deleting an entire rich paragraph body has unproven native insertion-style behavior."
|
|
21473
|
+
);
|
|
21474
|
+
start = end + 1;
|
|
21475
|
+
}
|
|
21476
|
+
}
|
|
21477
|
+
const position = (offset) => {
|
|
21478
|
+
let low = 0, high = edit.ranges.length;
|
|
21479
|
+
while (low < high) {
|
|
21480
|
+
const middle = low + high >>> 1;
|
|
21481
|
+
if (edit.ranges[middle].start < offset) low = middle + 1;
|
|
21482
|
+
else high = middle;
|
|
21483
|
+
}
|
|
21484
|
+
const index = low - 1;
|
|
21485
|
+
if (index < 0) return offset;
|
|
21486
|
+
const range2 = edit.ranges[index];
|
|
21487
|
+
return offset <= range2.end ? starts[index] + range2.text.length : offset + deltas[index];
|
|
21488
|
+
};
|
|
21489
|
+
const output = [];
|
|
21490
|
+
const append = (token, start, end) => {
|
|
21491
|
+
if (end <= start) return;
|
|
21492
|
+
const part = start === token.start && end === token.end ? token.node : token.node.cloneNode(false);
|
|
21493
|
+
if (part !== token.node)
|
|
21494
|
+
part.nodeValue = (token.node.nodeValue ?? "").slice(start - token.start, end - token.start);
|
|
21495
|
+
output.push({ position: position(start), priority: 2, node: part });
|
|
20940
21496
|
};
|
|
20941
21497
|
let first2 = 0;
|
|
20942
21498
|
for (const token of tokens2) {
|
|
@@ -20985,12 +21541,17 @@ function textRangeNodes(node2, edit) {
|
|
|
20985
21541
|
|
|
20986
21542
|
// visio/edit-text-ranges.ts
|
|
20987
21543
|
async function replaceScopedTextRanges(pkg, pagePaths, roots, document, edit, check) {
|
|
20988
|
-
const
|
|
21544
|
+
const found = textTarget(roots.get(edit.pageId), edit.shapeId, check);
|
|
21545
|
+
const instance = found.masterId === void 0 ? void 0 : instanceTextNode(
|
|
21546
|
+
found.node,
|
|
21547
|
+
await masterTemplate(pkg)(found.masterId, found.masterShapeId)
|
|
21548
|
+
);
|
|
21549
|
+
const shape = instance ? found.node : localTextTarget(roots.get(edit.pageId), document, edit.shapeId, check);
|
|
20989
21550
|
const texts = children2(shape, "Text");
|
|
20990
21551
|
if (texts.length !== 1)
|
|
20991
21552
|
fail("UNSUPPORTED_TEXT_RANGE", "Range editing requires one existing local Text element.");
|
|
20992
21553
|
const text3 = texts[0];
|
|
20993
|
-
if (Array.from(text3.childNodes).some((node2) => ![3, 4].includes(node2.nodeType))) {
|
|
21554
|
+
if (!instance && Array.from(text3.childNodes).some((node2) => ![3, 4].includes(node2.nodeType))) {
|
|
20994
21555
|
const characters = effectiveFormattingRows(shape, document, "Character"), paragraphs = effectiveFormattingRows(shape, document, "Paragraph");
|
|
20995
21556
|
assertFormattingText(shape, characters, paragraphs);
|
|
20996
21557
|
}
|
|
@@ -21007,16 +21568,20 @@ async function replaceScopedTextRanges(pkg, pagePaths, roots, document, edit, ch
|
|
|
21007
21568
|
}
|
|
21008
21569
|
}
|
|
21009
21570
|
const plan = textRangeNodes(text3, edit);
|
|
21010
|
-
if (!plan.changed)
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21571
|
+
if (!plan.changed) {
|
|
21572
|
+
instance?.discard();
|
|
21573
|
+
return false;
|
|
21574
|
+
}
|
|
21575
|
+
if (!instance)
|
|
21576
|
+
await assertFormattingDependencies(
|
|
21577
|
+
pkg,
|
|
21578
|
+
pagePaths,
|
|
21579
|
+
roots,
|
|
21580
|
+
edit.pageId,
|
|
21581
|
+
shape,
|
|
21582
|
+
/* @__PURE__ */ new Map([["TheText", text3]]),
|
|
21583
|
+
check
|
|
21584
|
+
);
|
|
21020
21585
|
check();
|
|
21021
21586
|
while (text3.firstChild) text3.removeChild(text3.firstChild);
|
|
21022
21587
|
for (const node2 of plan.nodes) text3.appendChild(node2);
|
|
@@ -22028,6 +22593,96 @@ function snapshotAssignLayers(edit) {
|
|
|
22028
22593
|
};
|
|
22029
22594
|
}
|
|
22030
22595
|
|
|
22596
|
+
// visio/edit-layer-properties.ts
|
|
22597
|
+
var FLAGS = [
|
|
22598
|
+
["visible", "Visible"],
|
|
22599
|
+
["print", "Print"],
|
|
22600
|
+
["lock", "Lock"]
|
|
22601
|
+
];
|
|
22602
|
+
function snapshotLayerProperties(edit) {
|
|
22603
|
+
if (typeof edit.pageId !== "string" || !edit.pageId || edit.pageId.length > 256)
|
|
22604
|
+
fail("INVALID_EDIT", "Invalid edit target.");
|
|
22605
|
+
if (typeof edit.layerId !== "string" || !/^(0|[1-9]\d{0,9})$/.test(edit.layerId))
|
|
22606
|
+
fail("INVALID_EDIT", "Layer IDs must be canonical unsigned integers.");
|
|
22607
|
+
const result = {
|
|
22608
|
+
type: "set-layer-properties",
|
|
22609
|
+
pageId: edit.pageId,
|
|
22610
|
+
layerId: edit.layerId
|
|
22611
|
+
};
|
|
22612
|
+
for (const [key2] of FLAGS) {
|
|
22613
|
+
const value = edit[key2];
|
|
22614
|
+
if (value === void 0) continue;
|
|
22615
|
+
if (typeof value !== "boolean") fail("INVALID_EDIT", "Layer flags are true or false.");
|
|
22616
|
+
result[key2] = value;
|
|
22617
|
+
}
|
|
22618
|
+
if (!FLAGS.some(([key2]) => result[key2] !== void 0))
|
|
22619
|
+
fail("INVALID_EDIT", "A layer edit needs at least one flag.");
|
|
22620
|
+
return result;
|
|
22621
|
+
}
|
|
22622
|
+
async function editVsdxLayerProperties(pkg, parts, pages, edits, limits, maxOutput, deadline, check) {
|
|
22623
|
+
const documentPart2 = await related(pkg, "", "document");
|
|
22624
|
+
const pagesPart = await related(pkg, documentPart2, "pages");
|
|
22625
|
+
const source = await visioXml(pkg, pagesPart, "Pages");
|
|
22626
|
+
const pageList = source.ownerDocument.cloneNode(true).documentElement;
|
|
22627
|
+
let changed = false;
|
|
22628
|
+
for (const edit of edits) {
|
|
22629
|
+
check();
|
|
22630
|
+
if (!pages.has(edit.pageId)) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
22631
|
+
const page = children2(pageList, "Page").find((node2) => attribute2(node2, "ID") === edit.pageId);
|
|
22632
|
+
const sheets = page ? children2(page, "PageSheet") : [];
|
|
22633
|
+
if (sheets.length !== 1) fail("UNSUPPORTED_LAYER_EDIT", "One explicit PageSheet is required.");
|
|
22634
|
+
const sections = children2(sheets[0], "Section").filter(
|
|
22635
|
+
(node2) => attribute2(node2, "N") === "Layer"
|
|
22636
|
+
);
|
|
22637
|
+
if (sections.length !== 1)
|
|
22638
|
+
fail("EDIT_TARGET_NOT_FOUND", "The layer does not belong to this page.");
|
|
22639
|
+
const rows = children2(sections[0], "Row").filter(
|
|
22640
|
+
(row3) => attribute2(row3, "IX") === edit.layerId
|
|
22641
|
+
);
|
|
22642
|
+
if (rows.length !== 1 || rows[0].hasAttribute("Del"))
|
|
22643
|
+
fail("EDIT_TARGET_NOT_FOUND", "The layer does not belong to this page.");
|
|
22644
|
+
const row2 = rows[0];
|
|
22645
|
+
for (const [key2, name3] of FLAGS) {
|
|
22646
|
+
const value = edit[key2];
|
|
22647
|
+
if (value === void 0) continue;
|
|
22648
|
+
const cells4 = children2(row2, "Cell").filter((cell2) => attribute2(cell2, "N") === name3);
|
|
22649
|
+
if (cells4.length > 1) fail("UNSUPPORTED_LAYER_EDIT", `Duplicate layer ${name3} cells.`);
|
|
22650
|
+
let cell = cells4[0];
|
|
22651
|
+
if (cell && (cell.hasAttribute("E") || executableCellFormula(attribute2(cell, "F"))))
|
|
22652
|
+
fail("UNSUPPORTED_LAYER_EDIT", `The layer's ${name3} flag is set by a formula.`);
|
|
22653
|
+
const next = value ? "1" : "0";
|
|
22654
|
+
if (cell && attribute2(cell, "V") === next) continue;
|
|
22655
|
+
if (!cell) {
|
|
22656
|
+
cell = row2.ownerDocument.createElementNS(row2.namespaceURI, "Cell");
|
|
22657
|
+
cell.setAttribute("N", name3);
|
|
22658
|
+
row2.appendChild(cell);
|
|
22659
|
+
}
|
|
22660
|
+
cell.setAttribute("V", next);
|
|
22661
|
+
changed = true;
|
|
22662
|
+
}
|
|
22663
|
+
}
|
|
22664
|
+
const original = parts.get(pagesPart);
|
|
22665
|
+
if (!changed)
|
|
22666
|
+
return {
|
|
22667
|
+
bytes: await writeEditedPackage(parts, maxOutput, deadline, check),
|
|
22668
|
+
changedParts: [],
|
|
22669
|
+
diagnostics: []
|
|
22670
|
+
};
|
|
22671
|
+
const serialized = serializeEditedXml(pageList, limits, check);
|
|
22672
|
+
const total = [...parts.values()].reduce((sum, bytes2) => sum + bytes2.length, 0) + serialized.bytes.length - (original?.length ?? 0);
|
|
22673
|
+
if (total > limits.maxTotalBytes) fail("LIMIT_TOTAL", "Edited package total exceeds limit.");
|
|
22674
|
+
parts.set(pagesPart, serialized.bytes);
|
|
22675
|
+
const bytes = await writeEditedPackage(parts, maxOutput, deadline, check);
|
|
22676
|
+
const verified = await openEditablePackage(
|
|
22677
|
+
bytes,
|
|
22678
|
+
{ ...limits, maxInputBytes: maxOutput, maxRuntimeMs: Math.max(1, deadline - Date.now()) },
|
|
22679
|
+
check
|
|
22680
|
+
);
|
|
22681
|
+
await visioXml(verified.pkg, pagesPart, "Pages");
|
|
22682
|
+
check();
|
|
22683
|
+
return { bytes, changedParts: [pagesPart], diagnostics: [] };
|
|
22684
|
+
}
|
|
22685
|
+
|
|
22031
22686
|
// visio/edit-guide-commands.ts
|
|
22032
22687
|
var isVisioGuideEdit = (edit) => edit.type === "create-guide" || edit.type === "move-guide" || edit.type === "delete-guide";
|
|
22033
22688
|
function snapshotGuideEdit(edit) {
|
|
@@ -22610,6 +23265,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
22610
23265
|
if (edit.type === "insert-picture") return snapshotPictureInsert(edit);
|
|
22611
23266
|
if (edit.type === "set-page-theme") return snapshotPageTheme(edit);
|
|
22612
23267
|
if (edit.type === "assign-layers") return snapshotAssignLayers(edit);
|
|
23268
|
+
if (edit.type === "set-layer-properties") return snapshotLayerProperties(edit);
|
|
22613
23269
|
if (isVisioGuideEdit(edit)) return snapshotGuideEdit(edit);
|
|
22614
23270
|
if (isVisioMetadataEdit(edit)) return snapshotMetadataEdit(edit);
|
|
22615
23271
|
if (isVisioGroupEdit(edit)) return snapshotGroupEdit(edit);
|
|
@@ -24396,8 +25052,8 @@ async function assertShapeOrderPackageScope(pkg, check) {
|
|
|
24396
25052
|
);
|
|
24397
25053
|
}
|
|
24398
25054
|
}
|
|
24399
|
-
for (const
|
|
24400
|
-
if (
|
|
25055
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
25056
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
24401
25057
|
}
|
|
24402
25058
|
}
|
|
24403
25059
|
}
|
|
@@ -24520,177 +25176,6 @@ function analyzeVisioMasterFormula(source, options) {
|
|
|
24520
25176
|
return { ...analysis, references: [...references.values()], dynamic: dynamic2, readsText, readsTheme };
|
|
24521
25177
|
}
|
|
24522
25178
|
|
|
24523
|
-
// visio/edit-master-index.ts
|
|
24524
|
-
function inheritedProtection(node2, ancestor) {
|
|
24525
|
-
try {
|
|
24526
|
-
const boolean2 = (cell) => {
|
|
24527
|
-
if (!cell || cell.hasAttribute("E"))
|
|
24528
|
-
fail("EDIT_PROTECTED_CELL", "Inherited protection has an unresolved or error cache.");
|
|
24529
|
-
const value = visioFormulaCachedValue(attribute2(cell, "V") ?? "", attribute2(cell, "U"));
|
|
24530
|
-
if (value.unit !== "scalar" || ![0, 1].includes(value.value))
|
|
24531
|
-
fail("EDIT_PROTECTED_CELL", "Inherited protection requires scalar boolean caches.");
|
|
24532
|
-
return value.value;
|
|
24533
|
-
};
|
|
24534
|
-
if (boolean2(node2) !== boolean2(ancestor))
|
|
24535
|
-
fail(
|
|
24536
|
-
"EDIT_PROTECTED_CELL",
|
|
24537
|
-
"Delegated master style protection cache disagrees with its ancestor."
|
|
24538
|
-
);
|
|
24539
|
-
} catch (error) {
|
|
24540
|
-
fail(
|
|
24541
|
-
"EDIT_PROTECTED_CELL",
|
|
24542
|
-
`Inherited master style protection cannot be proven: ${error instanceof Error ? error.message : "invalid cache"}`
|
|
24543
|
-
);
|
|
24544
|
-
}
|
|
24545
|
-
}
|
|
24546
|
-
function masterCells(sheet, charge = () => {
|
|
24547
|
-
}) {
|
|
24548
|
-
const result = /* @__PURE__ */ new Map();
|
|
24549
|
-
if (!sheet) return result;
|
|
24550
|
-
const add = (name3, node2) => {
|
|
24551
|
-
charge();
|
|
24552
|
-
const id3 = name3.toLowerCase();
|
|
24553
|
-
if (result.has(id3) && result.get(id3) !== node2)
|
|
24554
|
-
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous effective master cells.");
|
|
24555
|
-
result.set(id3, node2);
|
|
24556
|
-
};
|
|
24557
|
-
for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
|
|
24558
|
-
for (const section2 of children2(sheet, "Section")) {
|
|
24559
|
-
const name3 = attribute2(section2, "N") ?? "";
|
|
24560
|
-
const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section2, "IX") ?? "0") + 1}` : name3 === "Control" ? "Controls" : name3;
|
|
24561
|
-
for (const node2 of children2(section2, "Cell"))
|
|
24562
|
-
add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
|
|
24563
|
-
for (const row2 of children2(section2, "Row"))
|
|
24564
|
-
for (const node2 of children2(row2, "Cell")) {
|
|
24565
|
-
const n = attribute2(node2, "N") ?? "";
|
|
24566
|
-
const rowName = attribute2(row2, "N");
|
|
24567
|
-
const index = attribute2(row2, "IX") ?? (prefix2 === "Controls" && /^Row_\d+$/.test(rowName ?? "") ? String(Number(rowName.slice(4)) - 1) : void 0);
|
|
24568
|
-
const ix = index ?? "0", r = rowName ?? (prefix2 === "Controls" ? `Row_${Number(ix) + 1}` : ix);
|
|
24569
|
-
add(
|
|
24570
|
-
name3 === "Geometry" || ["Controls", "Scratch", "Connection"].includes(prefix2) ? `${prefix2}.${n}${ix}` : n === "Value" && ["User", "Prop"].includes(name3) ? `${prefix2}.${r}` : `${prefix2}.${r}.${n}`,
|
|
24571
|
-
node2
|
|
24572
|
-
);
|
|
24573
|
-
if (name3 !== "Geometry") add(`${prefix2}.${r}.${n}`, node2);
|
|
24574
|
-
if (prefix2 === "Controls" && n === "X") add(`${prefix2}.${r}`, node2);
|
|
24575
|
-
if (name3 !== "Geometry" && index !== void 0) add(`${prefix2}.$row${ix}.${n}`, node2);
|
|
24576
|
-
}
|
|
24577
|
-
}
|
|
24578
|
-
return result;
|
|
24579
|
-
}
|
|
24580
|
-
function masterShapes(root2) {
|
|
24581
|
-
const result = [], pending = [root2];
|
|
24582
|
-
while (pending.length) {
|
|
24583
|
-
const parent = pending.pop();
|
|
24584
|
-
for (const container of children2(parent, "Shapes"))
|
|
24585
|
-
for (const shape of children2(container, "Shape")) {
|
|
24586
|
-
result.push(shape);
|
|
24587
|
-
pending.push(shape);
|
|
24588
|
-
}
|
|
24589
|
-
}
|
|
24590
|
-
return result;
|
|
24591
|
-
}
|
|
24592
|
-
function assertMasterMarkup(root2, known, check) {
|
|
24593
|
-
for (const node2 of [root2, ...Array.from(root2.getElementsByTagName("*"))]) {
|
|
24594
|
-
check();
|
|
24595
|
-
if (node2.namespaceURI === root2.namespaceURI && node2.hasAttribute("F") && !known.has(node2))
|
|
24596
|
-
fail(
|
|
24597
|
-
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
24598
|
-
"Master formula outside admitted sheet cells has unknown scope."
|
|
24599
|
-
);
|
|
24600
|
-
}
|
|
24601
|
-
}
|
|
24602
|
-
function masterStyleCells(document, template, instance, check, charge = () => {
|
|
24603
|
-
}, verifyMovementProtection = false) {
|
|
24604
|
-
const styles = /* @__PURE__ */ new Map();
|
|
24605
|
-
for (const container of children2(document, "StyleSheets"))
|
|
24606
|
-
for (const style2 of children2(container, "StyleSheet")) {
|
|
24607
|
-
charge();
|
|
24608
|
-
const id3 = attribute2(style2, "ID");
|
|
24609
|
-
if (!id3 || styles.has(id3))
|
|
24610
|
-
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous master style IDs.");
|
|
24611
|
-
styles.set(id3, style2);
|
|
24612
|
-
}
|
|
24613
|
-
const defaults = children2(document, "DocumentSheet")[0];
|
|
24614
|
-
const collect = (id3, category, seen = /* @__PURE__ */ new Set()) => {
|
|
24615
|
-
check();
|
|
24616
|
-
if (seen.has(id3) || seen.size >= 64)
|
|
24617
|
-
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Invalid inherited master style ancestry.");
|
|
24618
|
-
seen.add(id3);
|
|
24619
|
-
const style2 = styles.get(id3);
|
|
24620
|
-
if (!style2) fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Missing inherited master style.");
|
|
24621
|
-
const own = masterCells(style2, charge);
|
|
24622
|
-
assertMasterMarkup(style2, new Set(own.values()), check);
|
|
24623
|
-
const parent = attribute2(style2, category);
|
|
24624
|
-
const result2 = parent !== void 0 && parent !== id3 ? collect(parent, category, seen) : /* @__PURE__ */ new Map();
|
|
24625
|
-
for (const [name3, node2] of own) {
|
|
24626
|
-
charge();
|
|
24627
|
-
if (attribute2(node2, "F") !== "Inh") result2.set(name3, node2);
|
|
24628
|
-
else if (verifyMovementProtection && /^lock(move[xy]|width|height|aspect|delete)$/.test(name3)) {
|
|
24629
|
-
charge();
|
|
24630
|
-
inheritedProtection(node2, result2.get(name3));
|
|
24631
|
-
}
|
|
24632
|
-
}
|
|
24633
|
-
return result2;
|
|
24634
|
-
};
|
|
24635
|
-
const result = /* @__PURE__ */ new Map();
|
|
24636
|
-
for (const category of ["LineStyle", "FillStyle", "TextStyle"]) {
|
|
24637
|
-
const id3 = attribute2(instance, category) ?? attribute2(template, category) ?? attribute2(defaults, category) ?? (styles.has("0") ? "0" : void 0);
|
|
24638
|
-
if (id3 !== void 0)
|
|
24639
|
-
for (const [name3, node2] of collect(id3, category)) {
|
|
24640
|
-
charge();
|
|
24641
|
-
if (result.has(name3) && result.get(name3) !== node2)
|
|
24642
|
-
fail(
|
|
24643
|
-
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
24644
|
-
"Master style categories have ambiguous overlapping inputs."
|
|
24645
|
-
);
|
|
24646
|
-
result.set(name3, node2);
|
|
24647
|
-
}
|
|
24648
|
-
}
|
|
24649
|
-
return result;
|
|
24650
|
-
}
|
|
24651
|
-
function overlay(cells4, additions, kind, charge) {
|
|
24652
|
-
const aliases = /* @__PURE__ */ new Map(), inherited = /* @__PURE__ */ new Map();
|
|
24653
|
-
for (const [name3, source] of cells4) {
|
|
24654
|
-
charge();
|
|
24655
|
-
const names = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
24656
|
-
names.add(name3);
|
|
24657
|
-
aliases.set(source.node, names);
|
|
24658
|
-
}
|
|
24659
|
-
for (const [name3, node2] of additions) {
|
|
24660
|
-
charge();
|
|
24661
|
-
const source = cells4.get(name3);
|
|
24662
|
-
if (source) inherited.set(node2, source);
|
|
24663
|
-
}
|
|
24664
|
-
for (const [name3, node2] of additions) {
|
|
24665
|
-
charge();
|
|
24666
|
-
if (attribute2(node2, "F") === "Inh") {
|
|
24667
|
-
const source = cells4.get(name3) ?? inherited.get(node2);
|
|
24668
|
-
if (!source)
|
|
24669
|
-
fail(
|
|
24670
|
-
"EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY",
|
|
24671
|
-
"Inherited master cell has no effective source."
|
|
24672
|
-
);
|
|
24673
|
-
cells4.set(name3, source);
|
|
24674
|
-
const names2 = aliases.get(source.node) ?? /* @__PURE__ */ new Set();
|
|
24675
|
-
names2.add(name3);
|
|
24676
|
-
aliases.set(source.node, names2);
|
|
24677
|
-
continue;
|
|
24678
|
-
}
|
|
24679
|
-
const previous = cells4.get(name3), names = aliases.get(node2) ?? /* @__PURE__ */ new Set();
|
|
24680
|
-
if (previous && previous.node !== node2) {
|
|
24681
|
-
for (const alias of aliases.get(previous.node) ?? []) {
|
|
24682
|
-
charge();
|
|
24683
|
-
cells4.set(alias, { node: node2, kind });
|
|
24684
|
-
names.add(alias);
|
|
24685
|
-
}
|
|
24686
|
-
aliases.delete(previous.node);
|
|
24687
|
-
}
|
|
24688
|
-
cells4.set(name3, { node: node2, kind });
|
|
24689
|
-
names.add(name3);
|
|
24690
|
-
aliases.set(node2, names);
|
|
24691
|
-
}
|
|
24692
|
-
}
|
|
24693
|
-
|
|
24694
25179
|
// visio/edit-master-scope.ts
|
|
24695
25180
|
function problem(message) {
|
|
24696
25181
|
return fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", message);
|
|
@@ -25054,10 +25539,10 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
25054
25539
|
))
|
|
25055
25540
|
fail("EDIT_REFERENCED_DELETE", "Scoped metadata references the deleted shape.");
|
|
25056
25541
|
}
|
|
25057
|
-
for (const
|
|
25058
|
-
if (
|
|
25542
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
25543
|
+
if (child3.nodeType === 1)
|
|
25059
25544
|
pending.push({
|
|
25060
|
-
node:
|
|
25545
|
+
node: child3,
|
|
25061
25546
|
style: style2,
|
|
25062
25547
|
...pageId2 === void 0 ? {} : { pageId: pageId2 }
|
|
25063
25548
|
});
|
|
@@ -27256,7 +27741,7 @@ function changeVisioShape(roots, document, edit, check) {
|
|
|
27256
27741
|
const outline = target2 === "ellipse" || target2 === "circle" ? void 0 : visioBasicShapeOutline(target2);
|
|
27257
27742
|
const replacement = outline ? outlineGeometrySections(shape, outline) : [ellipseGeometrySection(shape, width, height)];
|
|
27258
27743
|
const old = geometrySections(shape);
|
|
27259
|
-
const anchor = old[0] ?? Array.from(shape.children).find((
|
|
27744
|
+
const anchor = old[0] ?? Array.from(shape.children).find((child3) => AFTER_SECTIONS.has(child3.localName)) ?? null;
|
|
27260
27745
|
const changed = [];
|
|
27261
27746
|
const rounding = outline?.rounding ? outline.rounding * Math.min(width, height) : 0;
|
|
27262
27747
|
const roundingCell = local.get("Rounding");
|
|
@@ -28555,7 +29040,7 @@ function valueCell2(parent, name3, value, unit2) {
|
|
|
28555
29040
|
cell.setAttribute("V", value);
|
|
28556
29041
|
if (unit2) cell.setAttribute("U", unit2);
|
|
28557
29042
|
const before = Array.from(parent.childNodes).find(
|
|
28558
|
-
(
|
|
29043
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
28559
29044
|
);
|
|
28560
29045
|
parent.insertBefore(cell, before ?? null);
|
|
28561
29046
|
}
|
|
@@ -29078,6 +29563,21 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
|
|
|
29078
29563
|
check
|
|
29079
29564
|
);
|
|
29080
29565
|
}
|
|
29566
|
+
const layerFlags = allCommands.filter((command2) => command2.type === "set-layer-properties");
|
|
29567
|
+
if (layerFlags.length) {
|
|
29568
|
+
if (layerFlags.length !== allCommands.length)
|
|
29569
|
+
fail("EDIT_MIXED_LAYER_TRANSACTION", "Layer properties require their own transaction.");
|
|
29570
|
+
return editVsdxLayerProperties(
|
|
29571
|
+
pkg,
|
|
29572
|
+
parts,
|
|
29573
|
+
pages,
|
|
29574
|
+
layerFlags,
|
|
29575
|
+
limits,
|
|
29576
|
+
maxOutput,
|
|
29577
|
+
deadline,
|
|
29578
|
+
check
|
|
29579
|
+
);
|
|
29580
|
+
}
|
|
29081
29581
|
const layers = allCommands.filter((command2) => command2.type === "assign-layers");
|
|
29082
29582
|
if (layers.length) {
|
|
29083
29583
|
if (layers.length !== allCommands.length)
|
|
@@ -29259,7 +29759,7 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
|
|
|
29259
29759
|
))
|
|
29260
29760
|
dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
29261
29761
|
duplicateChanged = true;
|
|
29262
|
-
} else if (command2.type !== "insert-picture" && command2.type !== "set-page-theme" && command2.type !== "create-subprocess" && !isVisioCommentEdit(command2) && !isVisioDataEdit(command2) && command2.type !== "assign-layers") {
|
|
29762
|
+
} 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") {
|
|
29263
29763
|
for (const pageId2 of applyGeometryEdit(roots, document, command2, check, masterMovePins))
|
|
29264
29764
|
dirty.set(pages.get(pageId2), roots.get(pageId2));
|
|
29265
29765
|
}
|
|
@@ -29390,10 +29890,10 @@ function buildContentTypesXml(types) {
|
|
|
29390
29890
|
|
|
29391
29891
|
// visio/create-document.ts
|
|
29392
29892
|
function element(parent, name3, attributes = {}) {
|
|
29393
|
-
const
|
|
29394
|
-
for (const [key2, value] of Object.entries(attributes))
|
|
29395
|
-
parent.appendChild(
|
|
29396
|
-
return
|
|
29893
|
+
const child3 = parent.ownerDocument.createElementNS(VISIO_NS, name3);
|
|
29894
|
+
for (const [key2, value] of Object.entries(attributes)) child3.setAttribute(key2, value);
|
|
29895
|
+
parent.appendChild(child3);
|
|
29896
|
+
return child3;
|
|
29397
29897
|
}
|
|
29398
29898
|
function root(name3) {
|
|
29399
29899
|
const result = parseXml(`<${name3} xmlns="${VISIO_NS}"/>`).documentElement;
|