jassub 2.5.2 → 2.5.4
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/wasm/jassub-worker-modern.wasm +0 -0
- package/dist/wasm/jassub-worker.js +15 -11
- package/dist/wasm/jassub-worker.js.map +1 -1
- package/dist/wasm/jassub-worker.wasm +0 -0
- package/dist/worker/extern-pre-worker.d.ts +0 -0
- package/dist/worker/extern-pre-worker.js +11 -0
- package/dist/worker/extern-pre-worker.js.map +1 -0
- package/package.json +1 -1
- package/dist/default.woff2 +0 -0
- package/dist/wasm/types.d.ts +0 -134
- package/dist/worker/webgl-renderer.d.ts +0 -51
- package/dist/worker/webgl-renderer.js +0 -417
- package/dist/worker/webgl-renderer.js.map +0 -1
- package/dist/worker/webgpu-renderer.d.ts +0 -50
- package/dist/worker/webgpu-renderer.js +0 -404
- package/dist/worker/webgpu-renderer.js.map +0 -1
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
// WARN:
|
|
2
|
-
// This has been deprecated as WebGL is simply faster
|
|
3
|
-
// Know how to optimise this to beat WebGL? submit a PR!
|
|
4
|
-
const IDENTITY_MATRIX = new Float32Array([
|
|
5
|
-
1, 0, 0, 0,
|
|
6
|
-
0, 1, 0, 0,
|
|
7
|
-
0, 0, 1, 0
|
|
8
|
-
]);
|
|
9
|
-
// Color matrix conversion map - mat3x3 pre-padded for WGSL (each column padded to vec4f)
|
|
10
|
-
// Each matrix converts FROM the key color space TO the nested key color space
|
|
11
|
-
export const colorMatrixConversionMap = {
|
|
12
|
-
BT601: {
|
|
13
|
-
BT709: new Float32Array([
|
|
14
|
-
1.0863, 0.0965, -0.0141, 0,
|
|
15
|
-
-0.0723, 0.8451, -0.0277, 0,
|
|
16
|
-
-0.014, 0.0584, 1.0418, 0
|
|
17
|
-
]),
|
|
18
|
-
BT601: IDENTITY_MATRIX
|
|
19
|
-
},
|
|
20
|
-
BT709: {
|
|
21
|
-
BT601: new Float32Array([
|
|
22
|
-
0.9137, -0.1049, 0.0096, 0,
|
|
23
|
-
0.0784, 1.1722, 0.0322, 0,
|
|
24
|
-
0.0079, -0.0671, 0.9582, 0
|
|
25
|
-
]),
|
|
26
|
-
BT709: IDENTITY_MATRIX
|
|
27
|
-
},
|
|
28
|
-
FCC: {
|
|
29
|
-
BT709: new Float32Array([
|
|
30
|
-
1.0873, 0.0974, -0.0127, 0,
|
|
31
|
-
-0.0736, 0.8494, -0.0251, 0,
|
|
32
|
-
-0.0137, 0.0531, 1.0378, 0
|
|
33
|
-
]),
|
|
34
|
-
BT601: new Float32Array([
|
|
35
|
-
1.001, 0.0009, 0.0013, 0,
|
|
36
|
-
-0.0008, 1.005, 0.0027, 0,
|
|
37
|
-
-0.0002, -0.006, 0.996, 0
|
|
38
|
-
])
|
|
39
|
-
},
|
|
40
|
-
SMPTE240M: {
|
|
41
|
-
BT709: new Float32Array([
|
|
42
|
-
0.9993, -0.0004, -0.0034, 0,
|
|
43
|
-
0.0006, 0.9812, -0.0114, 0,
|
|
44
|
-
0.0001, 0.0192, 1.0148, 0
|
|
45
|
-
]),
|
|
46
|
-
BT601: new Float32Array([
|
|
47
|
-
0.913, -0.1051, 0.0063, 0,
|
|
48
|
-
0.0774, 1.1508, 0.0207, 0,
|
|
49
|
-
0.0096, -0.0456, 0.973, 0
|
|
50
|
-
])
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
// WGSL Vertex Shader
|
|
54
|
-
const VERTEX_SHADER = /* wgsl */ `
|
|
55
|
-
struct VertexOutput {
|
|
56
|
-
@builtin(position) position: vec4f,
|
|
57
|
-
@location(0) @interpolate(flat) destXY: vec2f, // destination top-left (flat, no interpolation)
|
|
58
|
-
@location(1) @interpolate(flat) color: vec4f,
|
|
59
|
-
@location(2) @interpolate(flat) texSize: vec2f,
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
struct Uniforms {
|
|
63
|
-
resolution: vec2f,
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
struct ImageData {
|
|
67
|
-
destRect: vec4f, // x, y, w, h
|
|
68
|
-
srcInfo: vec4f, // texW, texH, stride, 0
|
|
69
|
-
color: vec4f, // RGBA
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
|
|
73
|
-
@group(0) @binding(1) var<storage, read> imageData: ImageData;
|
|
74
|
-
|
|
75
|
-
// Quad vertices (two triangles)
|
|
76
|
-
const QUAD_POSITIONS = array<vec2f, 6>(
|
|
77
|
-
vec2f(0.0, 0.0),
|
|
78
|
-
vec2f(1.0, 0.0),
|
|
79
|
-
vec2f(0.0, 1.0),
|
|
80
|
-
vec2f(1.0, 0.0),
|
|
81
|
-
vec2f(1.0, 1.0),
|
|
82
|
-
vec2f(0.0, 1.0)
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
@vertex
|
|
86
|
-
fn vertexMain(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
|
|
87
|
-
var output: VertexOutput;
|
|
88
|
-
|
|
89
|
-
let quadPos = QUAD_POSITIONS[vertexIndex];
|
|
90
|
-
let wh = imageData.destRect.zw;
|
|
91
|
-
|
|
92
|
-
// Calculate pixel position
|
|
93
|
-
let pixelPos = imageData.destRect.xy + quadPos * wh;
|
|
94
|
-
|
|
95
|
-
// Convert to clip space (-1 to 1)
|
|
96
|
-
var clipPos = (pixelPos / uniforms.resolution) * 2.0 - 1.0;
|
|
97
|
-
clipPos.y = -clipPos.y; // Flip Y for canvas coordinates
|
|
98
|
-
|
|
99
|
-
output.position = vec4f(clipPos, 0.0, 1.0);
|
|
100
|
-
output.destXY = imageData.destRect.xy;
|
|
101
|
-
output.color = imageData.color;
|
|
102
|
-
output.texSize = imageData.srcInfo.xy;
|
|
103
|
-
|
|
104
|
-
return output;
|
|
105
|
-
}
|
|
106
|
-
`;
|
|
107
|
-
// WGSL Fragment Shader - use textureLoad with integer coords for pixel-perfect sampling
|
|
108
|
-
const FRAGMENT_SHADER = /* wgsl */ `
|
|
109
|
-
@group(0) @binding(3) var tex: texture_2d<f32>;
|
|
110
|
-
@group(0) @binding(4) var<uniform> colorMatrix: mat3x3f;
|
|
111
|
-
|
|
112
|
-
struct FragmentInput {
|
|
113
|
-
@builtin(position) fragCoord: vec4f,
|
|
114
|
-
@location(0) @interpolate(flat) destXY: vec2f,
|
|
115
|
-
@location(1) @interpolate(flat) color: vec4f,
|
|
116
|
-
@location(2) @interpolate(flat) texSize: vec2f,
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@fragment
|
|
120
|
-
fn fragmentMain(input: FragmentInput) -> @location(0) vec4f {
|
|
121
|
-
// Calculate integer texel coordinates from fragment position
|
|
122
|
-
// fragCoord.xy is the pixel center (e.g., 0.5, 1.5, 2.5...)
|
|
123
|
-
let texCoord = vec2i(floor(input.fragCoord.xy - input.destXY));
|
|
124
|
-
|
|
125
|
-
// Bounds check (should not be needed but prevents any out-of-bounds access)
|
|
126
|
-
let texSizeI = vec2i(input.texSize);
|
|
127
|
-
if (texCoord.x < 0 || texCoord.y < 0 || texCoord.x >= texSizeI.x || texCoord.y >= texSizeI.y) {
|
|
128
|
-
return vec4f(0.0);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Load texel directly using integer coordinates - no interpolation, no precision issues
|
|
132
|
-
let mask = textureLoad(tex, texCoord, 0).r;
|
|
133
|
-
|
|
134
|
-
// Apply color matrix conversion (identity if no conversion needed)
|
|
135
|
-
let correctedColor = colorMatrix * input.color.rgb;
|
|
136
|
-
|
|
137
|
-
// libass color alpha: 0 = opaque, 255 = transparent (inverted)
|
|
138
|
-
let colorAlpha = 1.0 - input.color.a;
|
|
139
|
-
|
|
140
|
-
// Final alpha = colorAlpha * mask (like libass: alpha * mask)
|
|
141
|
-
let a = colorAlpha * mask;
|
|
142
|
-
|
|
143
|
-
// Premultiplied alpha output
|
|
144
|
-
return vec4f(correctedColor * a, a);
|
|
145
|
-
}
|
|
146
|
-
`;
|
|
147
|
-
export class WebGPURenderer {
|
|
148
|
-
device = null;
|
|
149
|
-
context = null;
|
|
150
|
-
pipeline = null;
|
|
151
|
-
bindGroupLayout = null;
|
|
152
|
-
// Uniform buffer
|
|
153
|
-
uniformBuffer = null;
|
|
154
|
-
// Color matrix buffer (mat3x3f = 48 bytes with padding)
|
|
155
|
-
colorMatrixBuffer = null;
|
|
156
|
-
// Image data buffers (created on-demand, one per image)
|
|
157
|
-
imageDataBuffers = [];
|
|
158
|
-
// Textures created on-demand (no fixed limit)
|
|
159
|
-
textures = [];
|
|
160
|
-
pendingDestroyTextures = [];
|
|
161
|
-
// eslint-disable-next-line no-undef
|
|
162
|
-
format = 'bgra8unorm';
|
|
163
|
-
constructor(device) {
|
|
164
|
-
this.device = device;
|
|
165
|
-
this.format = navigator.gpu.getPreferredCanvasFormat();
|
|
166
|
-
// Create shader modules
|
|
167
|
-
const vertexModule = this.device.createShaderModule({
|
|
168
|
-
code: VERTEX_SHADER
|
|
169
|
-
});
|
|
170
|
-
const fragmentModule = this.device.createShaderModule({
|
|
171
|
-
code: FRAGMENT_SHADER
|
|
172
|
-
});
|
|
173
|
-
// Create uniform buffer
|
|
174
|
-
this.uniformBuffer = this.device.createBuffer({
|
|
175
|
-
size: 16, // vec2f resolution + padding
|
|
176
|
-
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
177
|
-
});
|
|
178
|
-
// Create color matrix buffer (mat3x3f requires 48 bytes: 3 vec3f padded to vec4f each)
|
|
179
|
-
this.colorMatrixBuffer = this.device.createBuffer({
|
|
180
|
-
size: 48, // 3 x vec4f (each column is vec3f padded to 16 bytes)
|
|
181
|
-
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
182
|
-
});
|
|
183
|
-
// Initialize with identity matrix
|
|
184
|
-
this.device.queue.writeBuffer(this.colorMatrixBuffer, 0, IDENTITY_MATRIX);
|
|
185
|
-
// Create bind group layout (no sampler needed - using textureLoad for pixel-perfect sampling)
|
|
186
|
-
this.bindGroupLayout = this.device.createBindGroupLayout({
|
|
187
|
-
entries: [
|
|
188
|
-
{
|
|
189
|
-
binding: 0,
|
|
190
|
-
visibility: GPUShaderStage.VERTEX,
|
|
191
|
-
buffer: { type: 'uniform' }
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
binding: 1,
|
|
195
|
-
visibility: GPUShaderStage.VERTEX,
|
|
196
|
-
buffer: { type: 'read-only-storage' }
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
binding: 3,
|
|
200
|
-
visibility: GPUShaderStage.FRAGMENT,
|
|
201
|
-
texture: { sampleType: 'unfilterable-float' } // textureLoad requires unfilterable
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
binding: 4,
|
|
205
|
-
visibility: GPUShaderStage.FRAGMENT,
|
|
206
|
-
buffer: { type: 'uniform' }
|
|
207
|
-
}
|
|
208
|
-
]
|
|
209
|
-
});
|
|
210
|
-
// Create pipeline layout
|
|
211
|
-
const pipelineLayout = this.device.createPipelineLayout({
|
|
212
|
-
bindGroupLayouts: [this.bindGroupLayout]
|
|
213
|
-
});
|
|
214
|
-
// Create render pipeline
|
|
215
|
-
this.pipeline = this.device.createRenderPipeline({
|
|
216
|
-
layout: pipelineLayout,
|
|
217
|
-
vertex: {
|
|
218
|
-
module: vertexModule,
|
|
219
|
-
entryPoint: 'vertexMain'
|
|
220
|
-
},
|
|
221
|
-
fragment: {
|
|
222
|
-
module: fragmentModule,
|
|
223
|
-
entryPoint: 'fragmentMain',
|
|
224
|
-
targets: [
|
|
225
|
-
{
|
|
226
|
-
format: this.format,
|
|
227
|
-
blend: {
|
|
228
|
-
color: {
|
|
229
|
-
srcFactor: 'one',
|
|
230
|
-
dstFactor: 'one-minus-src-alpha',
|
|
231
|
-
operation: 'add'
|
|
232
|
-
},
|
|
233
|
-
alpha: {
|
|
234
|
-
srcFactor: 'one',
|
|
235
|
-
dstFactor: 'one-minus-src-alpha',
|
|
236
|
-
operation: 'add'
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
},
|
|
242
|
-
primitive: {
|
|
243
|
-
topology: 'triangle-list'
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
setCanvas(canvas, width, height) {
|
|
248
|
-
if (!this.device)
|
|
249
|
-
return;
|
|
250
|
-
// WebGPU doesn't allow 0-sized textures/swapchains
|
|
251
|
-
if (width <= 0 || height <= 0)
|
|
252
|
-
return;
|
|
253
|
-
canvas.width = width;
|
|
254
|
-
canvas.height = height;
|
|
255
|
-
if (!this.context) {
|
|
256
|
-
// Get canvas context
|
|
257
|
-
this.context = canvas.getContext('webgpu');
|
|
258
|
-
if (!this.context) {
|
|
259
|
-
throw new Error('Could not get WebGPU context');
|
|
260
|
-
}
|
|
261
|
-
this.context.configure({
|
|
262
|
-
device: this.device,
|
|
263
|
-
format: this.format,
|
|
264
|
-
alphaMode: 'premultiplied'
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
// Update uniform buffer with resolution
|
|
268
|
-
this.device.queue.writeBuffer(this.uniformBuffer, 0, new Float32Array([width, height]));
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Set the color matrix for color space conversion.
|
|
272
|
-
* Pass null or undefined to use identity (no conversion).
|
|
273
|
-
* Matrix should be a pre-padded Float32Array with 12 values (3 columns × 4 floats each).
|
|
274
|
-
*/
|
|
275
|
-
setColorMatrix(subtitleColorSpace, videoColorSpace) {
|
|
276
|
-
if (!this.device)
|
|
277
|
-
return;
|
|
278
|
-
const colorMatrix = (subtitleColorSpace && videoColorSpace && colorMatrixConversionMap[subtitleColorSpace]?.[videoColorSpace]) ?? IDENTITY_MATRIX;
|
|
279
|
-
this.device.queue.writeBuffer(this.colorMatrixBuffer, 0, colorMatrix);
|
|
280
|
-
}
|
|
281
|
-
createTextureInfo(width, height) {
|
|
282
|
-
const texture = this.device.createTexture({
|
|
283
|
-
size: [width, height],
|
|
284
|
-
format: 'r8unorm',
|
|
285
|
-
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST
|
|
286
|
-
});
|
|
287
|
-
return {
|
|
288
|
-
texture,
|
|
289
|
-
view: texture.createView(),
|
|
290
|
-
width,
|
|
291
|
-
height
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
render(images, heap) {
|
|
295
|
-
if (!this.device || !this.context || !this.pipeline)
|
|
296
|
-
return;
|
|
297
|
-
// getCurrentTexture fails if canvas has 0 dimensions
|
|
298
|
-
const currentTexture = this.context.getCurrentTexture();
|
|
299
|
-
if (currentTexture.width === 0 || currentTexture.height === 0)
|
|
300
|
-
return;
|
|
301
|
-
const commandEncoder = this.device.createCommandEncoder();
|
|
302
|
-
const textureView = currentTexture.createView();
|
|
303
|
-
// Begin render pass
|
|
304
|
-
const renderPass = commandEncoder.beginRenderPass({
|
|
305
|
-
colorAttachments: [
|
|
306
|
-
{
|
|
307
|
-
view: textureView,
|
|
308
|
-
clearValue: { r: 0, g: 0, b: 0, a: 0 },
|
|
309
|
-
loadOp: 'clear',
|
|
310
|
-
storeOp: 'store'
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
|
-
});
|
|
314
|
-
renderPass.setPipeline(this.pipeline);
|
|
315
|
-
// Grow arrays if needed
|
|
316
|
-
while (this.textures.length < images.length) {
|
|
317
|
-
this.textures.push(this.createTextureInfo(64, 64));
|
|
318
|
-
}
|
|
319
|
-
while (this.imageDataBuffers.length < images.length) {
|
|
320
|
-
this.imageDataBuffers.push(this.device.createBuffer({
|
|
321
|
-
size: 48, // 3 x vec4f
|
|
322
|
-
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST
|
|
323
|
-
}));
|
|
324
|
-
}
|
|
325
|
-
// Render each image
|
|
326
|
-
for (let i = 0, texIndex = -1; i < images.length; i++) {
|
|
327
|
-
const img = images[i];
|
|
328
|
-
// Skip images with invalid dimensions (WebGPU doesn't allow 0-sized textures)
|
|
329
|
-
if (img.w <= 0 || img.h <= 0)
|
|
330
|
-
continue;
|
|
331
|
-
let texInfo = this.textures[++texIndex];
|
|
332
|
-
// Recreate texture if size changed (use actual w, not stride)
|
|
333
|
-
if (texInfo.width !== img.w || texInfo.height !== img.h) {
|
|
334
|
-
// Defer destruction until after submit to avoid destroying textures still in use
|
|
335
|
-
this.pendingDestroyTextures.push(texInfo.texture);
|
|
336
|
-
texInfo = this.createTextureInfo(img.w, img.h);
|
|
337
|
-
this.textures[texIndex] = texInfo;
|
|
338
|
-
}
|
|
339
|
-
// Upload bitmap data using bytesPerRow to handle stride
|
|
340
|
-
// Only need stride * (h-1) + w bytes per ASS spec
|
|
341
|
-
// this... didnt work, is the used alternative bad?
|
|
342
|
-
// const dataSize = img.stride * (img.h - 1) + img.w
|
|
343
|
-
// const bitmapData = heap.subarray(img.bitmap, img.bitmap + dataSize)
|
|
344
|
-
// this.device.queue.writeTexture(
|
|
345
|
-
// { texture: texInfo.texture },
|
|
346
|
-
// bitmapData as unknown as ArrayBuffer,
|
|
347
|
-
// { bytesPerRow: img.stride }, // Source rows are stride bytes apart
|
|
348
|
-
// { width: img.w, height: img.h } // But we only copy w pixels per row
|
|
349
|
-
// )
|
|
350
|
-
this.device.queue.writeTexture({ texture: texInfo.texture }, heap.buffer, { bytesPerRow: img.stride, offset: img.bitmap }, // Source rows are stride bytes apart
|
|
351
|
-
{ width: img.w, height: img.h } // But we only copy w pixels per row
|
|
352
|
-
);
|
|
353
|
-
// Update image data buffer
|
|
354
|
-
const imageData = new Float32Array([
|
|
355
|
-
// destRect
|
|
356
|
-
img.dst_x, img.dst_y, img.w, img.h,
|
|
357
|
-
// srcInfo
|
|
358
|
-
img.w, img.h, img.stride, 0,
|
|
359
|
-
// color (RGBA from 0xRRGGBBAA)
|
|
360
|
-
((img.color >>> 24) & 0xFF) / 255,
|
|
361
|
-
((img.color >>> 16) & 0xFF) / 255,
|
|
362
|
-
((img.color >>> 8) & 0xFF) / 255,
|
|
363
|
-
(img.color & 0xFF) / 255
|
|
364
|
-
]);
|
|
365
|
-
const imageBuffer = this.imageDataBuffers[texIndex];
|
|
366
|
-
this.device.queue.writeBuffer(imageBuffer, 0, imageData);
|
|
367
|
-
// Create bind group for this image (no sampler - using textureLoad)
|
|
368
|
-
const bindGroup = this.device.createBindGroup({
|
|
369
|
-
layout: this.bindGroupLayout,
|
|
370
|
-
entries: [
|
|
371
|
-
{ binding: 0, resource: { buffer: this.uniformBuffer } },
|
|
372
|
-
{ binding: 1, resource: { buffer: imageBuffer } },
|
|
373
|
-
{ binding: 3, resource: texInfo.view },
|
|
374
|
-
{ binding: 4, resource: { buffer: this.colorMatrixBuffer } }
|
|
375
|
-
]
|
|
376
|
-
});
|
|
377
|
-
renderPass.setBindGroup(0, bindGroup);
|
|
378
|
-
renderPass.draw(6); // 6 vertices for quad
|
|
379
|
-
}
|
|
380
|
-
renderPass.end();
|
|
381
|
-
this.device.queue.submit([commandEncoder.finish()]);
|
|
382
|
-
// Now safe to destroy old textures
|
|
383
|
-
for (const tex of this.pendingDestroyTextures) {
|
|
384
|
-
tex.destroy();
|
|
385
|
-
}
|
|
386
|
-
this.pendingDestroyTextures = [];
|
|
387
|
-
}
|
|
388
|
-
destroy() {
|
|
389
|
-
for (const tex of this.textures) {
|
|
390
|
-
tex.texture.destroy();
|
|
391
|
-
}
|
|
392
|
-
this.textures = [];
|
|
393
|
-
this.uniformBuffer?.destroy();
|
|
394
|
-
this.colorMatrixBuffer?.destroy();
|
|
395
|
-
for (const buf of this.imageDataBuffers) {
|
|
396
|
-
buf.destroy();
|
|
397
|
-
}
|
|
398
|
-
this.imageDataBuffers = [];
|
|
399
|
-
this.device?.destroy();
|
|
400
|
-
this.device = null;
|
|
401
|
-
this.context = null;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
//# sourceMappingURL=webgpu-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-renderer.js","sourceRoot":"","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