template-replacement 3.2.4 → 3.3.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/assets/template_replacement_core_wasm_bg.wasm +0 -0
- package/dist/assets/template_replacement_sign_core_wasm_bg.wasm +0 -0
- package/dist/{base-DIR-qpD-.js → base-ByF_YUTt.js} +94 -42
- package/dist/index-5nrkfdR0.js +61 -0
- package/dist/main/general.js +1711 -1568
- package/dist/main/sign.js +1866 -1717
- package/dist/replace/general.js +240 -214
- package/dist/replace/sign.js +321 -289
- package/package.json +6 -6
- package/replace/base.ts +82 -5
- package/replace/general.ts +10 -1
- package/replace/interface.ts +3 -0
- package/replace/paramsData.ts +1 -2
- package/replace/sign.ts +27 -6
- package/worker/child/agency.ts +37 -2
- package/worker/child/base.ts +27 -14
- package/worker/index.ts +4 -3
- package/worker/main/index.ts +38 -21
- package/dist/index-BkwrGCka.js +0 -61
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var w = (r) => {
|
|
2
|
+
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
class
|
|
4
|
+
var y = (r, e, t) => e.has(r) || w("Cannot " + t);
|
|
5
|
+
var o = (r, e, t) => (y(r, e, "read from private field"), t ? t.call(r) : e.get(r)), m = (r, e, t) => e.has(r) ? w("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), p = (r, e, t, s) => (y(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t);
|
|
6
|
+
class b {
|
|
7
7
|
//表配置
|
|
8
8
|
// 构造函数
|
|
9
9
|
constructor() {
|
|
@@ -95,44 +95,44 @@ class p {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
new
|
|
99
|
-
var
|
|
100
|
-
class
|
|
98
|
+
new b();
|
|
99
|
+
var f = /* @__PURE__ */ ((r) => (r.word = "word", r.excel = "excel", r.unknown = "unknown", r))(f || {}), l, h;
|
|
100
|
+
class P {
|
|
101
101
|
constructor(e) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
m(this, l, []);
|
|
103
|
+
m(this, h);
|
|
104
|
+
p(this, h, e);
|
|
105
105
|
}
|
|
106
106
|
addTempFile(e) {
|
|
107
|
-
|
|
107
|
+
o(this, l).push(e);
|
|
108
108
|
}
|
|
109
109
|
clear() {
|
|
110
|
-
|
|
110
|
+
o(this, l).length = 0;
|
|
111
111
|
}
|
|
112
112
|
async extractVariables(e) {
|
|
113
|
-
e || (e =
|
|
113
|
+
e || (e = o(this, l));
|
|
114
114
|
const t = {}, s = [];
|
|
115
115
|
for (const a of e)
|
|
116
|
-
s.push(new Promise(async (i,
|
|
117
|
-
const
|
|
118
|
-
|
|
116
|
+
s.push(new Promise(async (i, c) => {
|
|
117
|
+
const n = await a.getBuffer();
|
|
118
|
+
n && (a.isDecode || await a.type() !== f.unknown) && (t[a.name] = await o(this, h).extract_one_file_variable_names(n, a.isDecode)), i();
|
|
119
119
|
}));
|
|
120
120
|
return await Promise.all(s), t;
|
|
121
121
|
}
|
|
122
122
|
async extractMedias(e) {
|
|
123
|
-
e || (e =
|
|
123
|
+
e || (e = o(this, l));
|
|
124
124
|
const t = {}, s = [];
|
|
125
125
|
for (const a of e)
|
|
126
|
-
s.push(new Promise(async (i,
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
let
|
|
130
|
-
t[a.name] = [],
|
|
131
|
-
|
|
132
|
-
id
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
s.push(new Promise(async (i, c) => {
|
|
127
|
+
const n = await a.getBuffer();
|
|
128
|
+
if (n && (a.isDecode || await a.type() !== f.unknown)) {
|
|
129
|
+
let u = await o(this, h).extract_one_file_medias(n, a.isDecode);
|
|
130
|
+
if (t[a.name] = [], u && Array.isArray(u))
|
|
131
|
+
for (const d of u)
|
|
132
|
+
d.id && d.data && t[a.name].push({
|
|
133
|
+
id: d.id,
|
|
134
|
+
data: new Uint8Array(d.data)
|
|
135
|
+
});
|
|
136
136
|
}
|
|
137
137
|
i();
|
|
138
138
|
}));
|
|
@@ -141,14 +141,17 @@ class D {
|
|
|
141
141
|
async handle(e, t, s = !1) {
|
|
142
142
|
return [];
|
|
143
143
|
}
|
|
144
|
+
async handleMultipleParams(e, t, s = !1) {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
144
147
|
async sign(e) {
|
|
145
148
|
return "";
|
|
146
149
|
}
|
|
147
150
|
async execute(e, t) {
|
|
148
|
-
t || (t =
|
|
151
|
+
t || (t = o(this, l));
|
|
149
152
|
const s = [];
|
|
150
|
-
for (const
|
|
151
|
-
s.push(
|
|
153
|
+
for (const c of t)
|
|
154
|
+
s.push(c.getBuffer());
|
|
152
155
|
await Promise.all(s);
|
|
153
156
|
const a = {
|
|
154
157
|
//需要解密的文件
|
|
@@ -162,8 +165,8 @@ class D {
|
|
|
162
165
|
uint8Arrays: []
|
|
163
166
|
}
|
|
164
167
|
};
|
|
165
|
-
for (const
|
|
166
|
-
|
|
168
|
+
for (const c of t)
|
|
169
|
+
c.uint8Array && (c.isDecode ? (a.decode.names.push(c.name), a.decode.uint8Arrays.push(c.uint8Array)) : (a.noDecode.names.push(c.name), a.noDecode.uint8Arrays.push(c.uint8Array)));
|
|
167
170
|
const i = await Promise.all([
|
|
168
171
|
this._execute(e, a.noDecode.names, a.noDecode.uint8Arrays, !1),
|
|
169
172
|
this._execute(e, a.decode.names, a.decode.uint8Arrays, !0)
|
|
@@ -175,19 +178,68 @@ class D {
|
|
|
175
178
|
}
|
|
176
179
|
async _execute(e, t, s, a = !1) {
|
|
177
180
|
const i = {};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
if (!s.length)
|
|
182
|
+
return i;
|
|
183
|
+
const c = await this.handle(e, s, a);
|
|
184
|
+
for (let n = 0; n < c.length; n++) {
|
|
185
|
+
const u = c[n];
|
|
186
|
+
u.length && (i[t[n]] = u);
|
|
187
|
+
}
|
|
188
|
+
return i;
|
|
189
|
+
}
|
|
190
|
+
async executeMultipleParams(e, t) {
|
|
191
|
+
t || (t = o(this, l));
|
|
192
|
+
const s = [];
|
|
193
|
+
for (const n of t)
|
|
194
|
+
s.push(n.getBuffer());
|
|
195
|
+
await Promise.all(s);
|
|
196
|
+
const a = {
|
|
197
|
+
//需要解密的文件
|
|
198
|
+
decode: {
|
|
199
|
+
names: [],
|
|
200
|
+
uint8Arrays: []
|
|
201
|
+
},
|
|
202
|
+
//不需要解密的文件
|
|
203
|
+
noDecode: {
|
|
204
|
+
names: [],
|
|
205
|
+
uint8Arrays: []
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
for (const n of t)
|
|
209
|
+
n.uint8Array && (n.isDecode ? (a.decode.names.push(n.name), a.decode.uint8Arrays.push(n.uint8Array)) : (a.noDecode.names.push(n.name), a.noDecode.uint8Arrays.push(n.uint8Array)));
|
|
210
|
+
const i = await Promise.all([
|
|
211
|
+
this._executeMultipleParams(e, a.noDecode.names, a.noDecode.uint8Arrays, !1),
|
|
212
|
+
this._executeMultipleParams(e, a.decode.names, a.decode.uint8Arrays, !0)
|
|
213
|
+
]), c = [];
|
|
214
|
+
for (let n = 0; n < i[0].length; n++)
|
|
215
|
+
c.push({ ...i[0][n], ...i[1][n] });
|
|
216
|
+
return c;
|
|
217
|
+
}
|
|
218
|
+
async _executeMultipleParams(e, t, s, a = !1) {
|
|
219
|
+
const i = Array(e.length);
|
|
220
|
+
if (!s.length)
|
|
221
|
+
return i;
|
|
222
|
+
const c = await this.handleMultipleParams(e, s, a);
|
|
223
|
+
let n = 0;
|
|
224
|
+
for (let u = 0; u < e.length; u++) {
|
|
225
|
+
const d = {};
|
|
226
|
+
for (const D of t) {
|
|
227
|
+
const _ = c[n++];
|
|
228
|
+
_.length && (d[D] = _);
|
|
229
|
+
}
|
|
230
|
+
i[u] = d;
|
|
231
|
+
}
|
|
232
|
+
return i;
|
|
181
233
|
}
|
|
182
234
|
async fileEncrypt(e) {
|
|
183
|
-
return await
|
|
235
|
+
return await o(this, h).file_encrypt(e);
|
|
184
236
|
}
|
|
185
237
|
async filesEncrypt(e) {
|
|
186
|
-
return await
|
|
238
|
+
return await o(this, h).files_encrypt(e);
|
|
187
239
|
}
|
|
188
240
|
}
|
|
189
|
-
|
|
190
|
-
class
|
|
241
|
+
l = new WeakMap(), h = new WeakMap();
|
|
242
|
+
class A {
|
|
191
243
|
constructor(e, t) {
|
|
192
244
|
this.awaitInit = e, this.module = t;
|
|
193
245
|
}
|
|
@@ -220,6 +272,6 @@ class x {
|
|
|
220
272
|
}
|
|
221
273
|
}
|
|
222
274
|
export {
|
|
223
|
-
|
|
224
|
-
|
|
275
|
+
P as B,
|
|
276
|
+
A as b
|
|
225
277
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var l = (r) => {
|
|
2
|
+
throw TypeError(r);
|
|
3
|
+
};
|
|
4
|
+
var d = (r, s, t) => s.has(r) || l("Cannot " + t);
|
|
5
|
+
var e = (r, s, t) => (d(r, s, "read from private field"), t ? t.call(r) : s.get(r)), h = (r, s, t) => s.has(r) ? l("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), c = (r, s, t, o) => (d(r, s, "write to private field"), o ? o.call(r, t) : s.set(r, t), t), y = (r, s, t) => (d(r, s, "access private method"), t);
|
|
6
|
+
var g = (r, s, t, o) => ({
|
|
7
|
+
set _(f) {
|
|
8
|
+
c(r, s, f, t);
|
|
9
|
+
},
|
|
10
|
+
get _() {
|
|
11
|
+
return e(r, s, o);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var i, a, u, n, w, k;
|
|
15
|
+
class L {
|
|
16
|
+
constructor(s, t) {
|
|
17
|
+
h(this, w);
|
|
18
|
+
h(this, i);
|
|
19
|
+
h(this, a, 0);
|
|
20
|
+
h(this, u, []);
|
|
21
|
+
h(this, n, []);
|
|
22
|
+
if (c(this, i, Number(t)), !e(this, i) || e(this, i) < 1)
|
|
23
|
+
try {
|
|
24
|
+
c(this, i, navigator.hardwareConcurrency < 8 ? navigator.hardwareConcurrency : 8);
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
(!e(this, i) || e(this, i) < 1) && c(this, i, 1);
|
|
28
|
+
for (let o = 0; o < e(this, i); o++)
|
|
29
|
+
y(this, w, k).call(this, s);
|
|
30
|
+
}
|
|
31
|
+
concurrency() {
|
|
32
|
+
return e(this, i);
|
|
33
|
+
}
|
|
34
|
+
postMessage(s, t) {
|
|
35
|
+
e(this, u)[++g(this, a)._] || c(this, a, 0), e(this, u)[e(this, a)].postMessage(s, t);
|
|
36
|
+
}
|
|
37
|
+
addListener(s) {
|
|
38
|
+
e(this, n).push(s);
|
|
39
|
+
}
|
|
40
|
+
removeListener(s) {
|
|
41
|
+
for (const t in e(this, n))
|
|
42
|
+
if (e(this, n)[t] == s) {
|
|
43
|
+
e(this, n).splice(t, 1);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
i = new WeakMap(), a = new WeakMap(), u = new WeakMap(), n = new WeakMap(), w = new WeakSet(), k = function(s) {
|
|
49
|
+
const t = new s();
|
|
50
|
+
t.onmessage = async (o) => {
|
|
51
|
+
const f = [];
|
|
52
|
+
for (const p of e(this, n))
|
|
53
|
+
f.push(p(o));
|
|
54
|
+
const m = await Promise.all(f);
|
|
55
|
+
for (const p of m)
|
|
56
|
+
p && t.postMessage(p);
|
|
57
|
+
}, e(this, u).push(t);
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
L as w
|
|
61
|
+
};
|