quickspeadsheet 1.0.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.
@@ -0,0 +1,82 @@
1
+ import { hQ as I } from "./dragMerge-DHUQYNgo.js";
2
+ function c(e) {
3
+ let t = "";
4
+ for (let n = 0; n < e.length; n++) t += String.fromCharCode(e[n]);
5
+ return btoa(t);
6
+ }
7
+ function o(e) {
8
+ const t = new Uint8Array(e);
9
+ if (typeof crypto < "u" && crypto.getRandomValues)
10
+ crypto.getRandomValues(t);
11
+ else
12
+ for (let n = 0; n < e; n++) t[n] = Math.floor(Math.random() * 256);
13
+ return t;
14
+ }
15
+ const T = () => new Promise((e) => typeof queueMicrotask == "function" ? queueMicrotask(e) : setTimeout(e, 0));
16
+ async function V(e, t, n, s, a) {
17
+ const y = new TextEncoder().encode(e), p = "SHA-1";
18
+ let r = new Uint8Array(t.length + y.length);
19
+ r.set(t), r.set(y, t.length), r = new Uint8Array(await crypto.subtle.digest(p, r));
20
+ const l = 1e4;
21
+ for (let i = 1; i <= n; i++) {
22
+ i % l === 0 && await T();
23
+ const u = new Uint8Array(4);
24
+ new DataView(u.buffer).setUint32(0, i, !0);
25
+ const h = new Uint8Array(4 + r.length);
26
+ h.set(u), h.set(r, 4), r = new Uint8Array(await crypto.subtle.digest(p, h));
27
+ }
28
+ return crypto.subtle.importKey("raw", r.slice(0, s / 8), { name: "AES-CBC" }, !1, ["encrypt"]);
29
+ }
30
+ function H(e, t) {
31
+ const n = t - e.length % t, s = new Uint8Array(e.length + n);
32
+ s.set(e);
33
+ for (let a = e.length; a < s.length; a++) s[a] = n;
34
+ return s;
35
+ }
36
+ async function z(e, t) {
37
+ const m = o(16), y = o(128 / 8), p = o(16), r = new Uint8Array(await crypto.subtle.digest("SHA-1", p)).slice(0, 20), l = await V(t, m, 1e5, 128), i = o(16), u = new Uint8Array(await crypto.subtle.encrypt(
38
+ { name: "AES-CBC", iv: i },
39
+ l,
40
+ p
41
+ )), h = new Uint8Array(await crypto.subtle.encrypt(
42
+ { name: "AES-CBC", iv: i },
43
+ l,
44
+ r
45
+ )), d = o(16), E = await crypto.subtle.encrypt(
46
+ { name: "AES-CBC", iv: d },
47
+ l,
48
+ y
49
+ ), A = new Uint8Array(d.length + E.byteLength);
50
+ A.set(d), A.set(new Uint8Array(E), d.length);
51
+ const g = o(16), b = await crypto.subtle.importKey("raw", y, { name: "AES-CBC" }, !1, ["encrypt"]), U = e instanceof ArrayBuffer ? new Uint8Array(e) : e, v = H(U, 16), x = await crypto.subtle.encrypt(
52
+ { name: "AES-CBC", iv: g },
53
+ b,
54
+ v
55
+ ), w = new Uint8Array(8 + g.length + x.byteLength);
56
+ new DataView(w.buffer).setBigUint64(0, BigInt(U.length), !0), w.set(g, 8), w.set(new Uint8Array(x), 8 + g.length);
57
+ const B = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
58
+ <encryption xmlns="http://schemas.microsoft.com/office/2006/encryption" xmlns:p="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
59
+ <keyData saltSize="16" blockSize="16" keyBits="128" hashSize="20" cipherAlgorithm="AES" cipherChaining="ChainingModeCBC" hashAlgorithm="SHA1" saltValue="${c(m)}"/>
60
+ <dataIntegrity encryptedHmacKey="${c(o(32))}" encryptedHmacValue="${c(o(32))}"/>
61
+ <keyEncryptors><keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
62
+ <p:encryptedKey spinCount="100000" saltSize="16" blockSize="16" keyBits="128" hashSize="20" cipherAlgorithm="AES" cipherChaining="ChainingModeCBC" hashAlgorithm="SHA1" saltValue="${c(m)}" encryptedVerifierHashInput="${c(u)}" encryptedVerifierHashValue="${c(h)}" encryptedKeyValue="${c(A)}"/>
63
+ </keyEncryptor></keyEncryptors>
64
+ </encryption>`, S = new ArrayBuffer(8), C = new DataView(S);
65
+ C.setUint16(0, 4, !0), C.setUint16(2, 4, !0), C.setUint32(4, 64, !0);
66
+ const k = new Uint8Array(8 + new TextEncoder().encode(B).length);
67
+ k.set(new Uint8Array(S)), k.set(new TextEncoder().encode(B), 8);
68
+ const f = new I();
69
+ return f.file("EncryptionInfo", k), f.file("EncryptedPackage", w), f.file("[Content_Types].xml", `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
70
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
71
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
72
+ <Default Extension="xml" ContentType="application/xml"/>
73
+ <Override PartName="/EncryptionInfo" ContentType="application/vnd.ms-office.encryptionInfo"/>
74
+ <Override PartName="/EncryptedPackage" ContentType="application/vnd.ms-office.encryptedPackage"/>
75
+ </Types>`), f.file("_rels/.rels", `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
76
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
77
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/encryptedPackage" Target="EncryptedPackage"/>
78
+ </Relationships>`), f;
79
+ }
80
+ export {
81
+ z as encryptOoxml
82
+ };