eddyter 1.4.1-beta.1 → 1.4.1-beta.3

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.
@@ -1,4 +1,4 @@
1
- import { s as Tt, v as Se, J as Ce, h as xe } from "./index-DJjthzdy.js";
1
+ import { s as Tt, v as Se, J as Ce, h as xe } from "./index-CU0dESjk.js";
2
2
  import { h as Ee } from "./html2canvas.esm-C2wu93Kq.js";
3
3
  function Ft(c) {
4
4
  throw new Error('Could not dynamically require "' + c + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
@@ -0,0 +1,69 @@
1
+ import { J as u, h as b } from "./index-CU0dESjk.js";
2
+ const m = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174";
3
+ let w = null;
4
+ async function C() {
5
+ if (w)
6
+ return w;
7
+ await new Promise((n, o) => {
8
+ if (window.pdfjsLib) {
9
+ n();
10
+ return;
11
+ }
12
+ const a = document.createElement("script");
13
+ a.src = `${m}/pdf.min.js`, a.onload = () => n(), a.onerror = () => o(new Error("Failed to load pdf.js from CDN")), document.head.appendChild(a);
14
+ });
15
+ const t = window.pdfjsLib;
16
+ if (!t)
17
+ throw new Error("pdfjsLib not found on window after loading CDN script");
18
+ return t.GlobalWorkerOptions.workerSrc = `${m}/pdf.worker.min.js`, w = t, t;
19
+ }
20
+ async function j(t) {
21
+ if (t.startsWith("data:application/pdf;base64,") || t.startsWith("data:application/pdf,")) {
22
+ const r = t.split(",")[1] ?? "", i = atob(r), c = new Uint8Array(i.length);
23
+ for (let e = 0; e < i.length; e++)
24
+ c[e] = i.charCodeAt(e);
25
+ return c;
26
+ }
27
+ const n = `${u}${b.project.proxyPdf}?url=${encodeURIComponent(t)}`, o = await fetch(n);
28
+ if (!o.ok)
29
+ throw new Error(`PDF fetch failed: ${o.status}`);
30
+ const a = await o.arrayBuffer();
31
+ return new Uint8Array(a);
32
+ }
33
+ const p = 240, h = 176;
34
+ async function D(t) {
35
+ try {
36
+ const n = await C(), o = await j(t), r = await (await n.getDocument({ data: o }).promise).getPage(1), i = r.getViewport({ scale: 1 }), c = p / i.width, e = r.getViewport({ scale: c }), s = document.createElement("canvas");
37
+ s.width = e.width, s.height = e.height;
38
+ const l = s.getContext("2d");
39
+ if (!l)
40
+ throw new Error("Could not get 2d context");
41
+ await r.render({
42
+ canvasContext: l,
43
+ viewport: e
44
+ }).promise;
45
+ const d = document.createElement("canvas");
46
+ d.width = p, d.height = h;
47
+ const f = d.getContext("2d");
48
+ if (!f)
49
+ return s.toDataURL("image/png");
50
+ f.fillStyle = "#ffffff", f.fillRect(0, 0, p, h);
51
+ const g = Math.min(e.height, h);
52
+ return f.drawImage(
53
+ s,
54
+ 0,
55
+ 0,
56
+ e.width,
57
+ g,
58
+ 0,
59
+ 0,
60
+ p,
61
+ g
62
+ ), d.toDataURL("image/png");
63
+ } catch (n) {
64
+ throw console.error("[generatePdfThumbnail] Error", n), n;
65
+ }
66
+ }
67
+ export {
68
+ D as generatePdfThumbnail
69
+ };
@@ -1,5 +1,5 @@
1
1
  import { h as Ci } from "./html2canvas.esm-C2wu93Kq.js";
2
- import { J as yi, h as Di } from "./index-DJjthzdy.js";
2
+ import { J as yi, h as Di } from "./index-CU0dESjk.js";
3
3
  var In = 1252, Oi = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1e4], Zt = {
4
4
  /*::[*/
5
5
  0: 1252,
@@ -1,4 +1,4 @@
1
- import { s as Ka, v as $u } from "./index-DJjthzdy.js";
1
+ import { s as Ka, v as $u } from "./index-CU0dESjk.js";
2
2
  function tl(Qa, iu) {
3
3
  for (var jo = 0; jo < iu.length; jo++) {
4
4
  const qs = iu[jo];
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
2
  import { useLexicalComposerContext as B } from "@lexical/react/LexicalComposerContext";
3
3
  import { $getNodeByKey as b } from "lexical";
4
4
  import { useState as E, useEffect as N } from "react";
5
- import { w as y, x as k, y as I, F as x, z as T, G as W } from "./index-DJjthzdy.js";
5
+ import { w as y, x as k, y as I, F as x, z as T, G as W } from "./index-CU0dESjk.js";
6
6
  function $(e, t) {
7
7
  const c = e.split(".").pop()?.toLowerCase();
8
8
  return c === "pdf" || t.startsWith("data:application/pdf") ? "pdf" : c === "docx" || t.startsWith("data:application/vnd.openxmlformats") && e.toLowerCase().endsWith(".docx") ? "docx" : c === "xlsx" || c === "xls" || t.startsWith("data:application/vnd.openxmlformats-officedocument.spreadsheetml") || t.startsWith("data:application/vnd.ms-excel") ? "xlsx" : null;
@@ -16,15 +16,15 @@ function z(e, t) {
16
16
  return;
17
17
  }
18
18
  let l = !1;
19
- return d === "pdf" ? import("./generatePdfThumbnail-BllzxUNM.js").then(({ generatePdfThumbnail: o }) => o(e)).then((o) => {
19
+ return d === "pdf" ? import("./generatePdfThumbnail-CMIKG-Xq.js").then(({ generatePdfThumbnail: o }) => o(e)).then((o) => {
20
20
  l || n(o);
21
21
  }).catch(() => {
22
22
  l || n(null);
23
- }) : d === "docx" ? import("./generateDocxThumbnail-Dka6P9vZ.js").then(({ generateDocxThumbnail: o }) => o(e)).then((o) => {
23
+ }) : d === "docx" ? import("./generateDocxThumbnail-KuVknHKp.js").then(({ generateDocxThumbnail: o }) => o(e)).then((o) => {
24
24
  l || n(o);
25
25
  }).catch(() => {
26
26
  l || n(null);
27
- }) : d === "xlsx" && import("./generateXlsxThumbnail-DjPc9AwZ.js").then(({ generateXlsxThumbnail: o }) => o(e)).then((o) => {
27
+ }) : d === "xlsx" && import("./generateXlsxThumbnail-BmJZYUO5.js").then(({ generateXlsxThumbnail: o }) => o(e)).then((o) => {
28
28
  l || n(o);
29
29
  }).catch(() => {
30
30
  l || n(null);
@@ -16,7 +16,7 @@ import { useLexicalNodeSelection as Te } from "@lexical/react/useLexicalNodeSele
16
16
  import { mergeRegister as _e } from "@lexical/utils";
17
17
  import { RootNode as Qt, TextNode as Zt, LineBreakNode as te, ParagraphNode as ee, $getSelection as et, $isNodeSelection as ct, $isParagraphNode as Pt, $setSelection as gt, $isRangeSelection as je, SELECTION_CHANGE_COMMAND as Ye, COMMAND_PRIORITY_LOW as K, CLICK_COMMAND as Oe, DRAGSTART_COMMAND as He, KEY_DELETE_COMMAND as Fe, KEY_BACKSPACE_COMMAND as Xe, KEY_ENTER_COMMAND as Be, KEY_ESCAPE_COMMAND as Ue, $getNodeByKey as rt, createCommand as Ke } from "lexical";
18
18
  import ht, { useState as S, useRef as G, useMemo as _t, useCallback as I, useEffect as V, useLayoutEffect as qe, Suspense as Ge } from "react";
19
- import { c as ft, D as re, a as oe, b as ie, d as ae, e as ne, f as se, B as jt, L as de, i as ce, C as xt, I as Ve, S as Je, u as Qe, $ as q, t as z, g as Ze, h as tr, W as er, j as rr, A as or, k as ir, l as ar, T as nr, m as sr, n as dr, E as cr, o as lr, p as ur, q as mr, r as gr } from "./index-DJjthzdy.js";
19
+ import { c as ft, D as re, a as oe, b as ie, d as ae, e as ne, f as se, B as jt, L as de, i as ce, C as xt, I as Ve, S as Je, u as Qe, $ as q, t as z, g as Ze, h as tr, W as er, j as rr, A as or, k as ir, l as ar, T as nr, m as sr, n as dr, E as cr, o as lr, p as ur, q as mr, r as gr } from "./index-CU0dESjk.js";
20
20
  import "react-dom";
21
21
  const le = ft("Crop", [
22
22
  ["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],