react-pdf-viewer-wasm 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +121 -121
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -10,12 +10,12 @@ var l = Object.defineProperty, u = /* @__PURE__ */ ((e, t) => {
10
10
  return t || l(n, Symbol.toStringTag, { value: "Module" }), n;
11
11
  })({
12
12
  close_document: () => d,
13
- default: () => J,
13
+ default: () => K,
14
14
  extract_text: () => f,
15
15
  get_page_count: () => p,
16
16
  get_page_dimensions: () => m,
17
17
  get_text_chars: () => h,
18
- initSync: () => re,
18
+ initSync: () => G,
19
19
  initialize: () => g,
20
20
  initialize_pdfium_render: () => _,
21
21
  open_document: () => v,
@@ -25,59 +25,59 @@ var l = Object.defineProperty, u = /* @__PURE__ */ ((e, t) => {
25
25
  write_block_from_callback_wasm: () => S
26
26
  });
27
27
  function d(e) {
28
- let t = G.close_document(e);
29
- if (t[1]) throw R(t[0]);
28
+ let t = H.close_document(e);
29
+ if (t[1]) throw I(t[0]);
30
30
  }
31
31
  function f(e, t) {
32
- let n = G.extract_text(e, t);
33
- if (n[3]) throw R(n[2]);
32
+ let n = H.extract_text(e, t);
33
+ if (n[3]) throw I(n[2]);
34
34
  var r = D(n[0], n[1]);
35
- return n[0] !== 0 && G.__wbindgen_free(n[0], n[1], 1), r;
35
+ return n[0] !== 0 && H.__wbindgen_free(n[0], n[1], 1), r;
36
36
  }
37
37
  function p(e) {
38
- let t = G.get_page_count(e);
39
- if (t[2]) throw R(t[1]);
38
+ let t = H.get_page_count(e);
39
+ if (t[2]) throw I(t[1]);
40
40
  return t[0] >>> 0;
41
41
  }
42
42
  function m(e, t) {
43
- let n = G.get_page_dimensions(e, t);
44
- if (n[3]) throw R(n[2]);
43
+ let n = H.get_page_dimensions(e, t);
44
+ if (n[3]) throw I(n[2]);
45
45
  var r = ee(n[0], n[1]).slice();
46
- return G.__wbindgen_free(n[0], n[1] * 4, 4), r;
46
+ return H.__wbindgen_free(n[0], n[1] * 4, 4), r;
47
47
  }
48
48
  function h(e, t) {
49
- let n = G.get_text_chars(e, t);
50
- if (n[3]) throw R(n[2]);
49
+ let n = H.get_text_chars(e, t);
50
+ if (n[3]) throw I(n[2]);
51
51
  var r = D(n[0], n[1]);
52
- return n[0] !== 0 && G.__wbindgen_free(n[0], n[1], 1), r;
52
+ return n[0] !== 0 && H.__wbindgen_free(n[0], n[1], 1), r;
53
53
  }
54
54
  function g() {
55
- let e = G.initialize();
56
- if (e[1]) throw R(e[0]);
55
+ let e = H.initialize();
56
+ if (e[1]) throw I(e[0]);
57
57
  }
58
58
  function _(e, t, n) {
59
- return G.initialize_pdfium_render(e, t, n) !== 0;
59
+ return H.initialize_pdfium_render(e, t, n) !== 0;
60
60
  }
61
61
  function v(e, t) {
62
- let n = I(e, G.__wbindgen_malloc), r = W;
63
- var i = F(t) ? 0 : L(t, G.__wbindgen_malloc, G.__wbindgen_realloc), a = W;
64
- let o = G.open_document(n, r, i, a);
65
- if (o[2]) throw R(o[1]);
62
+ let n = ie(e, H.__wbindgen_malloc), r = V;
63
+ var i = P(t) ? 0 : F(t, H.__wbindgen_malloc, H.__wbindgen_realloc), a = V;
64
+ let o = H.open_document(n, r, i, a);
65
+ if (o[2]) throw I(o[1]);
66
66
  return o[0] >>> 0;
67
67
  }
68
68
  function y(e, t, n, r) {
69
- return G.read_block_from_callback_wasm(e, t, n, r);
69
+ return H.read_block_from_callback_wasm(e, t, n, r);
70
70
  }
71
71
  function b(e, t, n, r) {
72
- let i = G.render_page(e, t, n, r);
73
- if (i[2]) throw R(i[1]);
74
- return R(i[0]);
72
+ let i = H.render_page(e, t, n, r);
73
+ if (i[2]) throw I(i[1]);
74
+ return I(i[0]);
75
75
  }
76
76
  function x() {
77
- G.start();
77
+ H.start();
78
78
  }
79
79
  function S(e, t, n) {
80
- return G.write_block_from_callback_wasm(e, t, n);
80
+ return H.write_block_from_callback_wasm(e, t, n);
81
81
  }
82
82
  function C() {
83
83
  return {
@@ -85,7 +85,7 @@ function C() {
85
85
  "./pdf_core_bg.js": {
86
86
  __proto__: null,
87
87
  __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(e, t) {
88
- let n = L(T(t), G.__wbindgen_malloc, G.__wbindgen_realloc), r = W;
88
+ let n = F(T(t), H.__wbindgen_malloc, H.__wbindgen_realloc), r = V;
89
89
  k().setInt32(e + 4, r, !0), k().setInt32(e + 0, n, !0);
90
90
  },
91
91
  __wbg___wbindgen_is_object_edb6b15aa3afe12e: function(e) {
@@ -100,11 +100,11 @@ function C() {
100
100
  },
101
101
  __wbg___wbindgen_number_get_1dc732b810cb937c: function(e, t) {
102
102
  let n = t, r = typeof n == "number" ? n : void 0;
103
- k().setFloat64(e + 8, F(r) ? 0 : r, !0), k().setInt32(e + 0, !F(r), !0);
103
+ k().setFloat64(e + 8, P(r) ? 0 : r, !0), k().setInt32(e + 0, !P(r), !0);
104
104
  },
105
105
  __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(e, t) {
106
106
  let n = t, r = typeof n == "string" ? n : void 0;
107
- var i = F(r) ? 0 : L(r, G.__wbindgen_malloc, G.__wbindgen_realloc), a = W;
107
+ var i = P(r) ? 0 : F(r, H.__wbindgen_malloc, H.__wbindgen_realloc), a = V;
108
108
  k().setInt32(e + 4, a, !0), k().setInt32(e + 0, i, !0);
109
109
  },
110
110
  __wbg___wbindgen_throw_5d9e815e6fdf150f: function(e, t) {
@@ -112,12 +112,12 @@ function C() {
112
112
  throw Error(n);
113
113
  },
114
114
  __wbg_apply_5d9aa7604c2490a8: function() {
115
- return P(function(e, t, n) {
115
+ return N(function(e, t, n) {
116
116
  return e.apply(t, n);
117
117
  }, arguments);
118
118
  },
119
119
  __wbg_call_6bcf8d3e20937e46: function() {
120
- return P(function(e, t, n) {
120
+ return N(function(e, t, n) {
121
121
  return e.call(t, n);
122
122
  }, arguments);
123
123
  },
@@ -125,8 +125,8 @@ function C() {
125
125
  console.debug(e);
126
126
  },
127
127
  __wbg_decode_ec8279b49e2f79cf: function() {
128
- return P(function(e, t, n, r) {
129
- let i = L(t.decode(E(n, r)), G.__wbindgen_malloc, G.__wbindgen_realloc), a = W;
128
+ return N(function(e, t, n, r) {
129
+ let i = F(t.decode(E(n, r)), H.__wbindgen_malloc, H.__wbindgen_realloc), a = V;
130
130
  k().setInt32(e + 4, a, !0), k().setInt32(e + 0, i, !0);
131
131
  }, arguments);
132
132
  },
@@ -135,7 +135,7 @@ function C() {
135
135
  },
136
136
  __wbg_error_757e9472f8410341: function(e, t) {
137
137
  var n = D(e, t);
138
- e !== 0 && G.__wbindgen_free(e, t, 1), console.error(n);
138
+ e !== 0 && H.__wbindgen_free(e, t, 1), console.error(n);
139
139
  },
140
140
  __wbg_from_a39669ce566077da: function(e) {
141
141
  return Array.from(e);
@@ -144,12 +144,12 @@ function C() {
144
144
  return e.getTime();
145
145
  },
146
146
  __wbg_get_97dc2df9d87d0f6a: function() {
147
- return P(function(e, t) {
147
+ return N(function(e, t) {
148
148
  return e.get(t >>> 0);
149
149
  }, arguments);
150
150
  },
151
151
  __wbg_get_989d0a1309644f2b: function() {
152
- return P(function(e, t) {
152
+ return N(function(e, t) {
153
153
  return Reflect.get(e, t);
154
154
  }, arguments);
155
155
  },
@@ -193,7 +193,7 @@ function C() {
193
193
  return new Uint8Array(E(e, t));
194
194
  },
195
195
  __wbg_new_with_label_aad02dde1eb03f9b: function() {
196
- return P(function(e, t) {
196
+ return N(function(e, t) {
197
197
  var n = D(e, t);
198
198
  return new TextDecoder(n);
199
199
  }, arguments);
@@ -241,7 +241,7 @@ function C() {
241
241
  e[t >>> 0] = n;
242
242
  },
243
243
  __wbg_set_361ed22a3b8802e9: function() {
244
- return P(function(e, t, n) {
244
+ return N(function(e, t, n) {
245
245
  e.set(t >>> 0, n);
246
246
  }, arguments);
247
247
  },
@@ -252,24 +252,24 @@ function C() {
252
252
  return e.slice(t >>> 0, n >>> 0);
253
253
  },
254
254
  __wbg_stack_3b0d974bbf31e44f: function(e, t) {
255
- let n = t.stack, r = L(n, G.__wbindgen_malloc, G.__wbindgen_realloc), i = W;
255
+ let n = t.stack, r = F(n, H.__wbindgen_malloc, H.__wbindgen_realloc), i = V;
256
256
  k().setInt32(e + 4, i, !0), k().setInt32(e + 0, r, !0);
257
257
  },
258
258
  __wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
259
259
  let e = typeof global > "u" ? null : global;
260
- return F(e) ? 0 : w(e);
260
+ return P(e) ? 0 : w(e);
261
261
  },
262
262
  __wbg_static_accessor_GLOBAL_THIS_1e7044f654e934db: function() {
263
263
  let e = typeof globalThis > "u" ? null : globalThis;
264
- return F(e) ? 0 : w(e);
264
+ return P(e) ? 0 : w(e);
265
265
  },
266
266
  __wbg_static_accessor_SELF_d8b50611246a6d92: function() {
267
267
  let e = typeof self > "u" ? null : self;
268
- return F(e) ? 0 : w(e);
268
+ return P(e) ? 0 : w(e);
269
269
  },
270
270
  __wbg_static_accessor_WINDOW_fd0bc376bf0f8b42: function() {
271
271
  let e = typeof window > "u" ? null : window;
272
- return F(e) ? 0 : w(e);
272
+ return P(e) ? 0 : w(e);
273
273
  },
274
274
  __wbg_subarray_1daff70dde20c145: function(e, t, n) {
275
275
  return e.subarray(t >>> 0, n >>> 0);
@@ -287,15 +287,15 @@ function C() {
287
287
  return E(e, t);
288
288
  },
289
289
  __wbindgen_init_externref_table: function() {
290
- let e = G.__wbindgen_externrefs, t = e.grow(4);
290
+ let e = H.__wbindgen_externrefs, t = e.grow(4);
291
291
  e.set(0, void 0), e.set(t + 0, void 0), e.set(t + 1, null), e.set(t + 2, !0), e.set(t + 3, !1);
292
292
  }
293
293
  }
294
294
  };
295
295
  }
296
296
  function w(e) {
297
- let t = G.__externref_table_alloc();
298
- return G.__wbindgen_externrefs.set(t, e), t;
297
+ let t = H.__externref_table_alloc();
298
+ return H.__wbindgen_externrefs.set(t, e), t;
299
299
  }
300
300
  function T(e) {
301
301
  let t = typeof e;
@@ -326,53 +326,53 @@ function T(e) {
326
326
  return e instanceof Error ? `${e.name}: ${e.message}\n${e.stack}` : r;
327
327
  }
328
328
  function ee(e, t) {
329
- return e >>>= 0, j().subarray(e / 4, e / 4 + t);
329
+ return e >>>= 0, te().subarray(e / 4, e / 4 + t);
330
330
  }
331
331
  function E(e, t) {
332
- return e >>>= 0, N().subarray(e / 1, e / 1 + t);
332
+ return e >>>= 0, M().subarray(e / 1, e / 1 + t);
333
333
  }
334
334
  function D(e, t) {
335
- return e === 0 ? te(t) : ne(e, t);
335
+ return e === 0 ? ne(t) : re(e, t);
336
336
  }
337
337
  var O = null;
338
338
  function k() {
339
- return (O === null || O.buffer.detached === !0 || O.buffer.detached === void 0 && O.buffer !== G.memory.buffer) && (O = new DataView(G.memory.buffer)), O;
339
+ return (O === null || O.buffer.detached === !0 || O.buffer.detached === void 0 && O.buffer !== H.memory.buffer) && (O = new DataView(H.memory.buffer)), O;
340
340
  }
341
341
  var A = null;
342
- function j() {
343
- return (A === null || A.byteLength === 0) && (A = new Float32Array(G.memory.buffer)), A;
342
+ function te() {
343
+ return (A === null || A.byteLength === 0) && (A = new Float32Array(H.memory.buffer)), A;
344
344
  }
345
- function te(e) {
346
- return G.__wbindgen_externrefs.get(e);
345
+ function ne(e) {
346
+ return H.__wbindgen_externrefs.get(e);
347
347
  }
348
- function ne(e, t) {
349
- return H(e >>> 0, t);
348
+ function re(e, t) {
349
+ return ae(e >>> 0, t);
350
350
  }
351
- var M = null;
352
- function N() {
353
- return (M === null || M.byteLength === 0) && (M = new Uint8Array(G.memory.buffer)), M;
351
+ var j = null;
352
+ function M() {
353
+ return (j === null || j.byteLength === 0) && (j = new Uint8Array(H.memory.buffer)), j;
354
354
  }
355
- function P(e, t) {
355
+ function N(e, t) {
356
356
  try {
357
357
  return e.apply(this, t);
358
358
  } catch (e) {
359
359
  let t = w(e);
360
- G.__wbindgen_exn_store(t);
360
+ H.__wbindgen_exn_store(t);
361
361
  }
362
362
  }
363
- function F(e) {
363
+ function P(e) {
364
364
  return e == null;
365
365
  }
366
- function I(e, t) {
366
+ function ie(e, t) {
367
367
  let n = t(e.length * 1, 1) >>> 0;
368
- return N().set(e, n / 1), W = e.length, n;
368
+ return M().set(e, n / 1), V = e.length, n;
369
369
  }
370
- function L(e, t, n) {
370
+ function F(e, t, n) {
371
371
  if (n === void 0) {
372
- let n = U.encode(e), r = t(n.length, 1) >>> 0;
373
- return N().subarray(r, r + n.length).set(n), W = n.length, r;
372
+ let n = B.encode(e), r = t(n.length, 1) >>> 0;
373
+ return M().subarray(r, r + n.length).set(n), V = n.length, r;
374
374
  }
375
- let r = e.length, i = t(r, 1) >>> 0, a = N(), o = 0;
375
+ let r = e.length, i = t(r, 1) >>> 0, a = M(), o = 0;
376
376
  for (; o < r; o++) {
377
377
  let t = e.charCodeAt(o);
378
378
  if (t > 127) break;
@@ -380,40 +380,40 @@ function L(e, t, n) {
380
380
  }
381
381
  if (o !== r) {
382
382
  o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
383
- let t = N().subarray(i + o, i + r), a = U.encodeInto(e, t);
383
+ let t = M().subarray(i + o, i + r), a = B.encodeInto(e, t);
384
384
  o += a.written, i = n(i, r, o, 1) >>> 0;
385
385
  }
386
- return W = o, i;
386
+ return V = o, i;
387
387
  }
388
- function R(e) {
389
- let t = G.__wbindgen_externrefs.get(e);
390
- return G.__externref_table_dealloc(e), t;
388
+ function I(e) {
389
+ let t = H.__wbindgen_externrefs.get(e);
390
+ return H.__externref_table_dealloc(e), t;
391
391
  }
392
- var z = new TextDecoder("utf-8", {
392
+ var L = new TextDecoder("utf-8", {
393
393
  ignoreBOM: !0,
394
394
  fatal: !0
395
395
  });
396
- z.decode();
397
- var B = 2146435072, V = 0;
398
- function H(e, t) {
399
- return V += t, V >= B && (z = new TextDecoder("utf-8", {
396
+ L.decode();
397
+ var R = 2146435072, z = 0;
398
+ function ae(e, t) {
399
+ return z += t, z >= R && (L = new TextDecoder("utf-8", {
400
400
  ignoreBOM: !0,
401
401
  fatal: !0
402
- }), z.decode(), V = t), z.decode(N().subarray(e, e + t));
402
+ }), L.decode(), z = t), L.decode(M().subarray(e, e + t));
403
403
  }
404
- var U = new TextEncoder();
405
- "encodeInto" in U || (U.encodeInto = function(e, t) {
406
- let n = U.encode(e);
404
+ var B = new TextEncoder();
405
+ "encodeInto" in B || (B.encodeInto = function(e, t) {
406
+ let n = B.encode(e);
407
407
  return t.set(n), {
408
408
  read: e.length,
409
409
  written: n.length
410
410
  };
411
411
  });
412
- var W = 0, G;
413
- function K(e, t) {
414
- return G = e.exports, O = null, A = null, M = null, G.__wbindgen_start(), G;
412
+ var V = 0, H;
413
+ function U(e, t) {
414
+ return H = e.exports, O = null, A = null, j = null, H.__wbindgen_start(), H;
415
415
  }
416
- async function q(e, t) {
416
+ async function W(e, t) {
417
417
  if (typeof Response == "function" && e instanceof Response) {
418
418
  if (!e.ok) throw Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);
419
419
  if (typeof WebAssembly.instantiateStreaming == "function") try {
@@ -441,28 +441,28 @@ async function q(e, t) {
441
441
  return !1;
442
442
  }
443
443
  }
444
- function re(e) {
445
- if (G !== void 0) return G;
444
+ function G(e) {
445
+ if (H !== void 0) return H;
446
446
  e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module: e} = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
447
447
  let t = C();
448
- return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), K(new WebAssembly.Instance(e, t), e);
448
+ return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), U(new WebAssembly.Instance(e, t), e);
449
449
  }
450
- async function J(e) {
451
- if (G !== void 0) return G;
450
+ async function K(e) {
451
+ if (H !== void 0) return H;
452
452
  e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module_or_path: e} = e : console.warn("using deprecated parameters for the initialization function; pass a single object instead")), e === void 0 && (e = new URL("/pdf_core_bg.wasm", "" + import.meta.url));
453
453
  let t = C();
454
454
  (typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
455
- let { instance: n, module: r } = await q(await e, t);
456
- return K(n, r);
455
+ let { instance: n, module: r } = await W(await e, t);
456
+ return U(n, r);
457
457
  }
458
458
  //#endregion
459
- //#region src/pdf-core/loadPdfEngine.ts
460
- var ie = "https://cdn.jsdelivr.net/npm/pdf-viewer-assets@1.0.0/pdfium.js", ae = "https://cdn.jsdelivr.net/npm/pdf-viewer-assets@1.0.0/pdfium.wasm", Y = ie, X = ae, Z = null;
461
- function oe(e) {
462
- if (Z) throw Error("setPdfiumSource() must be called before the first <Document> is rendered. The pdfium engine has already started loading.");
463
- Y = e.jsUrl, X = e.wasmUrl;
459
+ //#region src/pdf-core/pdf_core_bg.wasm?no-inline
460
+ var q = "/pdf_core_bg.wasm", oe = "https://cdn.jsdelivr.net/npm/pdf-viewer-assets@1.0.0/pdfium.js", se = "https://cdn.jsdelivr.net/npm/pdf-viewer-assets@1.0.0/pdfium.wasm", J = oe, Y = se, X = null;
461
+ function ce(e) {
462
+ if (X) throw Error("setPdfiumSource() must be called before the first <Document> is rendered. The pdfium engine has already started loading.");
463
+ J = e.jsUrl, Y = e.wasmUrl;
464
464
  }
465
- function se(e) {
465
+ function le(e) {
466
466
  return new Promise((t, n) => {
467
467
  if (document.querySelector(`script[src="${e}"]`)) {
468
468
  t();
@@ -472,23 +472,23 @@ function se(e) {
472
472
  r.src = e, r.onload = () => t(), r.onerror = () => n(/* @__PURE__ */ Error(`Failed to load script: ${e}`)), document.head.appendChild(r);
473
473
  });
474
474
  }
475
- function Q() {
476
- return Z || (Z = (async () => {
477
- await se(Y);
478
- let e = await window.PDFiumModule({ locateFile: () => X });
479
- if (await J(), !_(e, u, !1)) throw Error("Failed to initialize pdfium-render");
475
+ function Z() {
476
+ return X || (X = (async () => {
477
+ await le(J);
478
+ let e = await window.PDFiumModule({ locateFile: () => Y });
479
+ if (await K({ module_or_path: new URL(q, import.meta.url) }), !_(e, u, !1)) throw Error("Failed to initialize pdfium-render");
480
480
  return g(), u;
481
- })(), Z);
481
+ })(), X);
482
482
  }
483
483
  //#endregion
484
484
  //#region src/components/Document.tsx
485
- var $ = e(null);
486
- function ce() {
487
- let e = n($);
485
+ var Q = e(null);
486
+ function $() {
487
+ let e = n(Q);
488
488
  if (!e) throw Error("Page must be used inside a Document");
489
489
  return e;
490
490
  }
491
- async function le(e, t) {
491
+ async function ue(e, t) {
492
492
  if (e instanceof Uint8Array) return e;
493
493
  if (e instanceof File) return new Uint8Array(await e.arrayBuffer());
494
494
  let n = await fetch(e);
@@ -505,7 +505,7 @@ async function le(e, t) {
505
505
  for (let e of a) s.set(e, c), c += e.length;
506
506
  return s;
507
507
  }
508
- var ue = t(function({ file: e, className: t, scale: n = 1, rotate: c = 0, error: l = "Failed to load PDF file.", loading: u = "Loading PDF…", noData: d = "No PDF file specified.", children: f, onLoadSuccess: p, onLoadError: m, onLoadProgress: h, onSourceSuccess: g, onSourceError: _, onPassword: v }, y) {
508
+ var de = t(function({ file: e, className: t, scale: n = 1, rotate: c = 0, error: l = "Failed to load PDF file.", loading: u = "Loading PDF…", noData: d = "No PDF file specified.", children: f, onLoadSuccess: p, onLoadError: m, onLoadProgress: h, onSourceSuccess: g, onSourceError: _, onPassword: v }, y) {
509
509
  let [b, x] = o(null), [S, C] = o("loading"), w = a(null);
510
510
  i(y, () => w.current), r(() => {
511
511
  if (!e) {
@@ -515,7 +515,7 @@ var ue = t(function({ file: e, className: t, scale: n = 1, rotate: c = 0, error:
515
515
  let t = !1;
516
516
  return C("loading"), (async () => {
517
517
  try {
518
- let n = await Q(), r = await le(e, (e, t) => {
518
+ let n = await Z(), r = await ue(e, (e, t) => {
519
519
  h?.({
520
520
  loaded: e,
521
521
  total: t
@@ -565,7 +565,7 @@ var ue = t(function({ file: e, className: t, scale: n = 1, rotate: c = 0, error:
565
565
  }) : /* @__PURE__ */ s("div", {
566
566
  className: T,
567
567
  ref: w,
568
- children: /* @__PURE__ */ s($.Provider, {
568
+ children: /* @__PURE__ */ s(Q.Provider, {
569
569
  value: {
570
570
  docHandle: b,
571
571
  scale: n,
@@ -581,12 +581,12 @@ var ue = t(function({ file: e, className: t, scale: n = 1, rotate: c = 0, error:
581
581
  });
582
582
  //#endregion
583
583
  //#region src/components/TextLayer.tsx
584
- function de({ docHandle: e, pageIndex: t, scale: n, pageWidthPts: i, pageHeightPts: a }) {
584
+ function fe({ docHandle: e, pageIndex: t, scale: n, pageWidthPts: i, pageHeightPts: a }) {
585
585
  let [c, l] = o([]);
586
586
  return r(() => {
587
587
  let n = !1;
588
588
  return (async () => {
589
- let r = (await Q()).get_text_chars(e, t);
589
+ let r = (await Z()).get_text_chars(e, t);
590
590
  n || l(JSON.parse(r));
591
591
  })(), () => {
592
592
  n = !0;
@@ -621,12 +621,12 @@ function de({ docHandle: e, pageIndex: t, scale: n, pageWidthPts: i, pageHeightP
621
621
  }
622
622
  //#endregion
623
623
  //#region src/components/Page.tsx
624
- function fe({ pageIndex: e, scale: t, rotate: n, textSelectable: i = !0 }) {
625
- let l = ce(), u = t ?? l.scale, d = n ?? l.rotate, f = a(null), [p, m] = o(null);
624
+ function pe({ pageIndex: e, scale: t, rotate: n, textSelectable: i = !0 }) {
625
+ let l = $(), u = t ?? l.scale, d = n ?? l.rotate, f = a(null), [p, m] = o(null);
626
626
  return r(() => {
627
627
  let t = !1;
628
628
  return (async () => {
629
- let n = await Q(), [r, i] = n.get_page_dimensions(l.docHandle, e), a = d === 90 || d === 270, o = a ? i : r, s = a ? r : i, c = Math.round(o * u), p = Math.round(s * u), h = n.render_page(l.docHandle, e, u, d);
629
+ let n = await Z(), [r, i] = n.get_page_dimensions(l.docHandle, e), a = d === 90 || d === 270, o = a ? i : r, s = a ? r : i, c = Math.round(o * u), p = Math.round(s * u), h = n.render_page(l.docHandle, e, u, d);
630
630
  if (t || !f.current) return;
631
631
  let g = f.current;
632
632
  g.width = c, g.height = p, g.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(h), c, p), 0, 0), m({
@@ -649,7 +649,7 @@ function fe({ pageIndex: e, scale: t, rotate: n, textSelectable: i = !0 }) {
649
649
  children: [/* @__PURE__ */ s("canvas", {
650
650
  ref: f,
651
651
  style: { display: "block" }
652
- }), i && p && /* @__PURE__ */ s(de, {
652
+ }), i && p && /* @__PURE__ */ s(fe, {
653
653
  docHandle: l.docHandle,
654
654
  pageIndex: e,
655
655
  scale: u,
@@ -659,4 +659,4 @@ function fe({ pageIndex: e, scale: t, rotate: n, textSelectable: i = !0 }) {
659
659
  });
660
660
  }
661
661
  //#endregion
662
- export { ue as Document, fe as Page, oe as setPdfiumSource };
662
+ export { de as Document, pe as Page, ce as setPdfiumSource };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-pdf-viewer-wasm",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A React PDF viewer powered by Rust + WebAssembly, using pdfium as the rendering backend.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",