@pretextbook/import 0.6.0 → 0.8.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/convert-worker.cjs +1 -0
- package/dist/convert-worker.js +29 -0
- package/dist/import-mode-BCGuSwkM.js +112 -0
- package/dist/import-mode-D1gOJw3N.cjs +3 -0
- package/dist/import.css +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +240 -156
- package/dist/lib/clean/latex-preamble.d.ts +21 -4
- package/dist/react/import-wizard.d.ts +22 -4
- package/dist/react/index.d.ts +2 -0
- package/dist/react/processing-panel.d.ts +6 -0
- package/dist/react.cjs +2 -2
- package/dist/react.js +498 -409
- package/dist/{import-mode-C0KIll3S.js → upload-BmErkg8I.js} +2382 -2265
- package/dist/upload-BtS22hIH.cjs +135 -0
- package/dist/worker/convert-worker.d.ts +1 -0
- package/dist/worker/protocol.d.ts +30 -0
- package/dist/worker/worker-engine.d.ts +52 -0
- package/package.json +7 -2
- package/dist/import-mode-Bu7Pi9k4.cjs +0 -135
package/dist/react.js
CHANGED
|
@@ -1,149 +1,150 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import Te, { useState as h, useRef as ue, useEffect as ke, useMemo as ae } from "react";
|
|
2
|
+
import { S as Ne, $ as Se, j as Pe, T as Ce, g as Re, h as ye, E as _e, A as Ae } from "./upload-BmErkg8I.js";
|
|
3
|
+
import { f as Fe, e as he } from "./import-mode-BCGuSwkM.js";
|
|
4
|
+
var de = { exports: {} }, re = {};
|
|
5
|
+
var be;
|
|
6
|
+
function Oe() {
|
|
7
|
+
if (be) return re;
|
|
8
|
+
be = 1;
|
|
9
|
+
var s = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
10
|
+
function x(b, g, c) {
|
|
10
11
|
var v = null;
|
|
11
|
-
if (c !== void 0 && (v = "" + c),
|
|
12
|
+
if (c !== void 0 && (v = "" + c), g.key !== void 0 && (v = "" + g.key), "key" in g) {
|
|
12
13
|
c = {};
|
|
13
|
-
for (var N in
|
|
14
|
-
N !== "key" && (c[N] =
|
|
15
|
-
} else c =
|
|
16
|
-
return
|
|
17
|
-
$$typeof:
|
|
18
|
-
type:
|
|
14
|
+
for (var N in g)
|
|
15
|
+
N !== "key" && (c[N] = g[N]);
|
|
16
|
+
} else c = g;
|
|
17
|
+
return g = c.ref, {
|
|
18
|
+
$$typeof: s,
|
|
19
|
+
type: b,
|
|
19
20
|
key: v,
|
|
20
|
-
ref:
|
|
21
|
+
ref: g !== void 0 ? g : null,
|
|
21
22
|
props: c
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
|
-
return
|
|
25
|
+
return re.Fragment = d, re.jsx = x, re.jsxs = x, re;
|
|
25
26
|
}
|
|
26
27
|
var se = {};
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
30
|
-
function
|
|
28
|
+
var ge;
|
|
29
|
+
function Le() {
|
|
30
|
+
return ge || (ge = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
31
|
+
function s(t) {
|
|
31
32
|
if (t == null) return null;
|
|
32
33
|
if (typeof t == "function")
|
|
33
|
-
return t.$$typeof ===
|
|
34
|
+
return t.$$typeof === Y ? null : t.displayName || t.name || null;
|
|
34
35
|
if (typeof t == "string") return t;
|
|
35
36
|
switch (t) {
|
|
36
|
-
case
|
|
37
|
+
case L:
|
|
37
38
|
return "Fragment";
|
|
38
|
-
case
|
|
39
|
+
case W:
|
|
39
40
|
return "Profiler";
|
|
40
41
|
case P:
|
|
41
42
|
return "StrictMode";
|
|
42
|
-
case
|
|
43
|
+
case ne:
|
|
43
44
|
return "Suspense";
|
|
44
|
-
case
|
|
45
|
+
case me:
|
|
45
46
|
return "SuspenseList";
|
|
46
|
-
case
|
|
47
|
+
case le:
|
|
47
48
|
return "Activity";
|
|
48
49
|
}
|
|
49
50
|
if (typeof t == "object")
|
|
50
51
|
switch (typeof t.tag == "number" && console.error(
|
|
51
52
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
53
|
), t.$$typeof) {
|
|
53
|
-
case
|
|
54
|
+
case A:
|
|
54
55
|
return "Portal";
|
|
55
56
|
case S:
|
|
56
57
|
return t.displayName || "Context";
|
|
57
|
-
case
|
|
58
|
+
case p:
|
|
58
59
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
59
|
-
case
|
|
60
|
-
var
|
|
61
|
-
return t = t.displayName, t || (t =
|
|
62
|
-
case
|
|
63
|
-
return
|
|
64
|
-
case
|
|
65
|
-
|
|
60
|
+
case F:
|
|
61
|
+
var a = t.render;
|
|
62
|
+
return t = t.displayName, t || (t = a.displayName || a.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
63
|
+
case H:
|
|
64
|
+
return a = t.displayName || null, a !== null ? a : s(t.type) || "Memo";
|
|
65
|
+
case z:
|
|
66
|
+
a = t._payload, t = t._init;
|
|
66
67
|
try {
|
|
67
|
-
return
|
|
68
|
+
return s(t(a));
|
|
68
69
|
} catch {
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
return null;
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function d(t) {
|
|
74
75
|
return "" + t;
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
+
function x(t) {
|
|
77
78
|
try {
|
|
78
|
-
|
|
79
|
-
var
|
|
79
|
+
d(t);
|
|
80
|
+
var a = !1;
|
|
80
81
|
} catch {
|
|
81
|
-
|
|
82
|
+
a = !0;
|
|
82
83
|
}
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
return
|
|
87
|
-
|
|
84
|
+
if (a) {
|
|
85
|
+
a = console;
|
|
86
|
+
var m = a.error, u = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
87
|
+
return m.call(
|
|
88
|
+
a,
|
|
88
89
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
-
|
|
90
|
-
),
|
|
90
|
+
u
|
|
91
|
+
), d(t);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
-
if (t ===
|
|
95
|
-
if (typeof t == "object" && t !== null && t.$$typeof ===
|
|
94
|
+
function b(t) {
|
|
95
|
+
if (t === L) return "<>";
|
|
96
|
+
if (typeof t == "object" && t !== null && t.$$typeof === z)
|
|
96
97
|
return "<...>";
|
|
97
98
|
try {
|
|
98
|
-
var
|
|
99
|
-
return
|
|
99
|
+
var a = s(t);
|
|
100
|
+
return a ? "<" + a + ">" : "<...>";
|
|
100
101
|
} catch {
|
|
101
102
|
return "<...>";
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
-
var t =
|
|
105
|
+
function g() {
|
|
106
|
+
var t = K.A;
|
|
106
107
|
return t === null ? null : t.getOwner();
|
|
107
108
|
}
|
|
108
109
|
function c() {
|
|
109
110
|
return Error("react-stack-top-frame");
|
|
110
111
|
}
|
|
111
112
|
function v(t) {
|
|
112
|
-
if (
|
|
113
|
-
var
|
|
114
|
-
if (
|
|
113
|
+
if (Z.call(t, "key")) {
|
|
114
|
+
var a = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
115
|
+
if (a && a.isReactWarning) return !1;
|
|
115
116
|
}
|
|
116
117
|
return t.key !== void 0;
|
|
117
118
|
}
|
|
118
|
-
function N(t,
|
|
119
|
-
function
|
|
120
|
-
|
|
119
|
+
function N(t, a) {
|
|
120
|
+
function m() {
|
|
121
|
+
D || (D = !0, console.error(
|
|
121
122
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
122
|
-
|
|
123
|
+
a
|
|
123
124
|
));
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
-
get:
|
|
126
|
+
m.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
127
|
+
get: m,
|
|
127
128
|
configurable: !0
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
-
var t =
|
|
132
|
-
return
|
|
131
|
+
function f() {
|
|
132
|
+
var t = s(this.type);
|
|
133
|
+
return q[t] || (q[t] = !0, console.error(
|
|
133
134
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
134
135
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
-
var
|
|
137
|
+
function _(t, a, m, u, $, V) {
|
|
138
|
+
var j = m.ref;
|
|
138
139
|
return t = {
|
|
139
140
|
$$typeof: k,
|
|
140
141
|
type: t,
|
|
141
|
-
key:
|
|
142
|
-
props:
|
|
143
|
-
_owner:
|
|
144
|
-
}, (
|
|
142
|
+
key: a,
|
|
143
|
+
props: m,
|
|
144
|
+
_owner: u
|
|
145
|
+
}, (j !== void 0 ? j : null) !== null ? Object.defineProperty(t, "ref", {
|
|
145
146
|
enumerable: !1,
|
|
146
|
-
get:
|
|
147
|
+
get: f
|
|
147
148
|
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
148
149
|
configurable: !1,
|
|
149
150
|
enumerable: !1,
|
|
@@ -158,109 +159,150 @@ function _e() {
|
|
|
158
159
|
configurable: !1,
|
|
159
160
|
enumerable: !1,
|
|
160
161
|
writable: !0,
|
|
161
|
-
value:
|
|
162
|
+
value: $
|
|
162
163
|
}), Object.defineProperty(t, "_debugTask", {
|
|
163
164
|
configurable: !1,
|
|
164
165
|
enumerable: !1,
|
|
165
166
|
writable: !0,
|
|
166
|
-
value:
|
|
167
|
+
value: V
|
|
167
168
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
for (
|
|
175
|
-
|
|
176
|
-
Object.freeze && Object.freeze(
|
|
170
|
+
function w(t, a, m, u, $, V) {
|
|
171
|
+
var j = a.children;
|
|
172
|
+
if (j !== void 0)
|
|
173
|
+
if (u)
|
|
174
|
+
if (Q(j)) {
|
|
175
|
+
for (u = 0; u < j.length; u++)
|
|
176
|
+
R(j[u]);
|
|
177
|
+
Object.freeze && Object.freeze(j);
|
|
177
178
|
} else
|
|
178
179
|
console.error(
|
|
179
180
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
181
|
);
|
|
181
|
-
else
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
return
|
|
182
|
+
else R(j);
|
|
183
|
+
if (Z.call(a, "key")) {
|
|
184
|
+
j = s(t);
|
|
185
|
+
var M = Object.keys(a).filter(function(te) {
|
|
186
|
+
return te !== "key";
|
|
186
187
|
});
|
|
187
|
-
|
|
188
|
+
u = 0 < M.length ? "{key: someKey, " + M.join(": ..., ") + ": ...}" : "{key: someKey}", C[j + u] || (M = 0 < M.length ? "{" + M.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
189
|
`A props object containing a "key" prop is being spread into JSX:
|
|
189
190
|
let props = %s;
|
|
190
191
|
<%s {...props} />
|
|
191
192
|
React keys must be passed directly to JSX without using spread:
|
|
192
193
|
let props = %s;
|
|
193
194
|
<%s key={someKey} {...props} />`,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
),
|
|
195
|
+
u,
|
|
196
|
+
j,
|
|
197
|
+
M,
|
|
198
|
+
j
|
|
199
|
+
), C[j + u] = !0);
|
|
199
200
|
}
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
for (var
|
|
203
|
-
|
|
204
|
-
} else
|
|
205
|
-
return
|
|
206
|
-
|
|
201
|
+
if (j = null, m !== void 0 && (x(m), j = "" + m), v(a) && (x(a.key), j = "" + a.key), "key" in a) {
|
|
202
|
+
m = {};
|
|
203
|
+
for (var G in a)
|
|
204
|
+
G !== "key" && (m[G] = a[G]);
|
|
205
|
+
} else m = a;
|
|
206
|
+
return j && N(
|
|
207
|
+
m,
|
|
207
208
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
208
|
-
),
|
|
209
|
+
), _(
|
|
209
210
|
t,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
j,
|
|
212
|
+
m,
|
|
213
|
+
g(),
|
|
214
|
+
$,
|
|
215
|
+
V
|
|
215
216
|
);
|
|
216
217
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
218
|
+
function R(t) {
|
|
219
|
+
O(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === z && (t._payload.status === "fulfilled" ? O(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
+
function O(t) {
|
|
221
222
|
return typeof t == "object" && t !== null && t.$$typeof === k;
|
|
222
223
|
}
|
|
223
|
-
var
|
|
224
|
+
var E = Te, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), L = /* @__PURE__ */ Symbol.for("react.fragment"), P = /* @__PURE__ */ Symbol.for("react.strict_mode"), W = /* @__PURE__ */ Symbol.for("react.profiler"), p = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), F = /* @__PURE__ */ Symbol.for("react.forward_ref"), ne = /* @__PURE__ */ Symbol.for("react.suspense"), me = /* @__PURE__ */ Symbol.for("react.suspense_list"), H = /* @__PURE__ */ Symbol.for("react.memo"), z = /* @__PURE__ */ Symbol.for("react.lazy"), le = /* @__PURE__ */ Symbol.for("react.activity"), Y = /* @__PURE__ */ Symbol.for("react.client.reference"), K = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Z = Object.prototype.hasOwnProperty, Q = Array.isArray, U = console.createTask ? console.createTask : function() {
|
|
224
225
|
return null;
|
|
225
226
|
};
|
|
226
|
-
|
|
227
|
+
E = {
|
|
227
228
|
react_stack_bottom_frame: function(t) {
|
|
228
229
|
return t();
|
|
229
230
|
}
|
|
230
231
|
};
|
|
231
|
-
var
|
|
232
|
-
|
|
232
|
+
var D, q = {}, ee = E.react_stack_bottom_frame.bind(
|
|
233
|
+
E,
|
|
233
234
|
c
|
|
234
|
-
)(),
|
|
235
|
-
se.Fragment =
|
|
236
|
-
var
|
|
237
|
-
return
|
|
235
|
+
)(), I = U(b(c)), C = {};
|
|
236
|
+
se.Fragment = L, se.jsx = function(t, a, m) {
|
|
237
|
+
var u = 1e4 > K.recentlyCreatedOwnerStacks++;
|
|
238
|
+
return w(
|
|
238
239
|
t,
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
a,
|
|
241
|
+
m,
|
|
241
242
|
!1,
|
|
242
|
-
|
|
243
|
-
|
|
243
|
+
u ? Error("react-stack-top-frame") : ee,
|
|
244
|
+
u ? U(b(t)) : I
|
|
244
245
|
);
|
|
245
|
-
}, se.jsxs = function(t,
|
|
246
|
-
var
|
|
247
|
-
return
|
|
246
|
+
}, se.jsxs = function(t, a, m) {
|
|
247
|
+
var u = 1e4 > K.recentlyCreatedOwnerStacks++;
|
|
248
|
+
return w(
|
|
248
249
|
t,
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
a,
|
|
251
|
+
m,
|
|
251
252
|
!0,
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
u ? Error("react-stack-top-frame") : ee,
|
|
254
|
+
u ? U(b(t)) : I
|
|
254
255
|
);
|
|
255
256
|
};
|
|
256
257
|
})()), se;
|
|
257
258
|
}
|
|
258
|
-
var
|
|
259
|
-
function
|
|
260
|
-
return
|
|
259
|
+
var je;
|
|
260
|
+
function De() {
|
|
261
|
+
return je || (je = 1, process.env.NODE_ENV === "production" ? de.exports = Oe() : de.exports = Le()), de.exports;
|
|
262
|
+
}
|
|
263
|
+
var e = De();
|
|
264
|
+
function Ie() {
|
|
265
|
+
const [s, d] = h(0), x = ue(Date.now());
|
|
266
|
+
return ke(() => {
|
|
267
|
+
const b = setInterval(() => {
|
|
268
|
+
d(Math.floor((Date.now() - x.current) / 1e3));
|
|
269
|
+
}, 1e3);
|
|
270
|
+
return () => clearInterval(b);
|
|
271
|
+
}, []), s;
|
|
272
|
+
}
|
|
273
|
+
function $e(s) {
|
|
274
|
+
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
275
|
+
}
|
|
276
|
+
function Me({
|
|
277
|
+
message: s = "Processing your file…",
|
|
278
|
+
onCancel: d
|
|
279
|
+
}) {
|
|
280
|
+
const x = Ie();
|
|
281
|
+
return /* @__PURE__ */ e.jsxs(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
className: "flex flex-col items-center justify-center gap-3 py-16 text-slate-600",
|
|
285
|
+
role: "status",
|
|
286
|
+
"aria-live": "polite",
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-blue-700 border-t-transparent" }),
|
|
289
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-sm", children: s }),
|
|
290
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-xs tabular-nums text-slate-500", children: $e(x) }),
|
|
291
|
+
x >= 10 ? /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-xs text-slate-500", children: "Large documents can take a while. You can keep working in other tabs." }) : null,
|
|
292
|
+
d ? /* @__PURE__ */ e.jsx(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
type: "button",
|
|
296
|
+
onClick: d,
|
|
297
|
+
className: "mt-2 rounded border border-slate-300 px-3 py-1.5 text-xs font-medium text-slate-700 hover:bg-slate-50",
|
|
298
|
+
children: "Cancel"
|
|
299
|
+
}
|
|
300
|
+
) : null
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
);
|
|
261
304
|
}
|
|
262
|
-
|
|
263
|
-
const je = [
|
|
305
|
+
const we = [
|
|
264
306
|
".tex",
|
|
265
307
|
".md",
|
|
266
308
|
".markdown",
|
|
@@ -270,125 +312,149 @@ const je = [
|
|
|
270
312
|
".gz",
|
|
271
313
|
".tar.gz",
|
|
272
314
|
".tgz"
|
|
273
|
-
],
|
|
315
|
+
], Xe = {
|
|
274
316
|
id: "builtin",
|
|
275
317
|
label: "Built-in converter",
|
|
276
318
|
description: "Create a new project starting with LaTeX, Markdown, or PreTeXt files.",
|
|
277
|
-
acceptExtensions:
|
|
278
|
-
convertFile:
|
|
279
|
-
prepare: async (
|
|
280
|
-
const { files:
|
|
319
|
+
acceptExtensions: we,
|
|
320
|
+
convertFile: Ne,
|
|
321
|
+
prepare: async (s) => {
|
|
322
|
+
const { files: d, assets: x } = await Re(s);
|
|
281
323
|
return {
|
|
282
|
-
fileName:
|
|
283
|
-
files:
|
|
284
|
-
assets:
|
|
285
|
-
analysis:
|
|
324
|
+
fileName: s.name,
|
|
325
|
+
files: d,
|
|
326
|
+
assets: x,
|
|
327
|
+
analysis: ye(d)
|
|
286
328
|
};
|
|
287
329
|
},
|
|
288
|
-
convertPrepared: (
|
|
289
|
-
...
|
|
290
|
-
assets:
|
|
330
|
+
convertPrepared: (s, d) => Ce(s.files, {
|
|
331
|
+
...d,
|
|
332
|
+
assets: s.assets
|
|
291
333
|
})
|
|
292
|
-
}
|
|
334
|
+
};
|
|
335
|
+
function xe() {
|
|
336
|
+
return new Promise((s) => {
|
|
337
|
+
if (typeof requestAnimationFrame != "function") {
|
|
338
|
+
setTimeout(s, 0);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
requestAnimationFrame(() => setTimeout(s, 0));
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
const ve = {
|
|
293
345
|
pretext: "PreTeXt",
|
|
294
346
|
latex: "LaTeX",
|
|
295
347
|
markdown: "Markdown"
|
|
296
348
|
};
|
|
297
|
-
function
|
|
298
|
-
const
|
|
299
|
-
return
|
|
349
|
+
function ze(s) {
|
|
350
|
+
const d = s.reason === "manifest-target" ? `project.ptx target “${s.targetName}”` : s.reason === "latex-root" ? "LaTeX document" : s.reason === "pretext-root" ? "PreTeXt document" : s.reason === "markdown-root" ? "Markdown document" : "possible document";
|
|
351
|
+
return s.title ? `${s.title} — ${d}` : d;
|
|
300
352
|
}
|
|
301
|
-
function
|
|
302
|
-
return
|
|
303
|
-
(
|
|
304
|
-
).length > 1 ? !0 :
|
|
353
|
+
function Ye(s) {
|
|
354
|
+
return s.candidates.filter(
|
|
355
|
+
(x) => x.reason === "manifest-target"
|
|
356
|
+
).length > 1 ? !0 : s.manifest && s.primary?.reason === "manifest-target" ? !1 : s.formats.length > 1 || s.candidates.length > 1 || s.extraRoots.length > 0;
|
|
305
357
|
}
|
|
306
|
-
function
|
|
307
|
-
onConfirm:
|
|
308
|
-
onCancel:
|
|
309
|
-
importOptions:
|
|
310
|
-
defaultDocumentKind:
|
|
311
|
-
engines:
|
|
358
|
+
function Ge({
|
|
359
|
+
onConfirm: s,
|
|
360
|
+
onCancel: d,
|
|
361
|
+
importOptions: x,
|
|
362
|
+
defaultDocumentKind: b = "auto",
|
|
363
|
+
engines: g
|
|
312
364
|
}) {
|
|
313
|
-
const c =
|
|
365
|
+
const c = g && g.length > 0 ? g : [Xe], v = ue(null), [N, f] = h({ name: "upload" }), [_, w] = h(!1), [R, O] = h(b), [E, k] = h(null), [A, L] = h(/* @__PURE__ */ new Set()), [P, W] = h(c[0].id), [p, S] = h("converted"), [F, ne] = h(!1), [me, H] = h(/* @__PURE__ */ new Set()), [z, le] = h(null), [Y, K] = h(
|
|
314
366
|
"auto"
|
|
315
|
-
), [
|
|
316
|
-
() =>
|
|
317
|
-
[
|
|
318
|
-
),
|
|
367
|
+
), [Z, Q] = h(null), [U, D] = h({}), [q, ee] = h(!1), I = ue(!1), C = c.find((r) => r.id === P) ?? c[0], t = C.acceptExtensions ?? we, a = N.name === "review" ? N.result : null, m = ae(
|
|
368
|
+
() => a && E !== null ? Se(a, E) : a,
|
|
369
|
+
[a, E]
|
|
370
|
+
), u = ae(
|
|
319
371
|
() => new Map(
|
|
320
|
-
|
|
372
|
+
m ? Fe(m).map((r) => [r.path, r]) : []
|
|
321
373
|
),
|
|
322
|
-
[
|
|
323
|
-
),
|
|
324
|
-
documentKind:
|
|
325
|
-
},
|
|
326
|
-
sourceFormat:
|
|
327
|
-
mainFile:
|
|
328
|
-
}),
|
|
329
|
-
|
|
374
|
+
[m]
|
|
375
|
+
), $ = () => x ?? {
|
|
376
|
+
documentKind: R === "auto" ? void 0 : R
|
|
377
|
+
}, V = (r) => ye(r.files, {
|
|
378
|
+
sourceFormat: Y === "auto" ? void 0 : Y,
|
|
379
|
+
mainFile: Z ?? void 0
|
|
380
|
+
}), j = (r) => {
|
|
381
|
+
I.current = !0, C.cancel?.(), f(
|
|
382
|
+
r ? { name: "sources", prepared: r } : { name: "upload" }
|
|
383
|
+
);
|
|
384
|
+
}, M = async (r) => {
|
|
385
|
+
I.current = !1, f({ name: "processing" }), await xe();
|
|
330
386
|
try {
|
|
331
|
-
const
|
|
387
|
+
const l = V(r).extraRoots.map((i) => ({
|
|
332
388
|
path: i.path,
|
|
333
|
-
include:
|
|
334
|
-
level:
|
|
335
|
-
})), y = C.convertPrepared(
|
|
336
|
-
|
|
337
|
-
sourceFormat:
|
|
338
|
-
mainFile:
|
|
339
|
-
attachRoots:
|
|
389
|
+
include: U[i.path]?.include ?? !0,
|
|
390
|
+
level: U[i.path]?.level
|
|
391
|
+
})), y = await C.convertPrepared(r, {
|
|
392
|
+
...$(),
|
|
393
|
+
sourceFormat: Y === "auto" ? void 0 : Y,
|
|
394
|
+
mainFile: Z ?? void 0,
|
|
395
|
+
attachRoots: l
|
|
340
396
|
});
|
|
341
|
-
"pretextError" in y ?
|
|
397
|
+
"pretextError" in y ? f({ name: "error", message: y.pretextError }) : f({ name: "review", result: y });
|
|
342
398
|
} catch (o) {
|
|
343
|
-
|
|
399
|
+
if (I.current)
|
|
400
|
+
return;
|
|
401
|
+
f({
|
|
344
402
|
name: "error",
|
|
345
403
|
message: o instanceof Error ? o.message : "An unexpected error occurred."
|
|
346
404
|
});
|
|
347
405
|
}
|
|
348
|
-
},
|
|
349
|
-
|
|
406
|
+
}, G = async (r) => {
|
|
407
|
+
I.current = !1, f({ name: "processing" }), await xe();
|
|
350
408
|
try {
|
|
351
409
|
if (C.prepare && C.convertPrepared) {
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
|
|
410
|
+
const l = await C.prepare(r);
|
|
411
|
+
if (le(l), K("auto"), Q(null), D({}), Ye(l.analysis)) {
|
|
412
|
+
f({ name: "sources", prepared: l });
|
|
355
413
|
return;
|
|
356
414
|
}
|
|
357
|
-
|
|
358
|
-
|
|
415
|
+
await xe();
|
|
416
|
+
const y = await C.convertPrepared(
|
|
417
|
+
l,
|
|
418
|
+
$()
|
|
419
|
+
);
|
|
420
|
+
f(
|
|
359
421
|
"pretextError" in y ? { name: "error", message: y.pretextError } : { name: "review", result: y }
|
|
360
422
|
);
|
|
361
423
|
return;
|
|
362
424
|
}
|
|
363
|
-
const o = await C.convertFile(
|
|
364
|
-
"pretextError" in o ?
|
|
425
|
+
const o = await C.convertFile(r, $());
|
|
426
|
+
"pretextError" in o ? f({ name: "error", message: o.pretextError }) : f({ name: "review", result: o });
|
|
365
427
|
} catch (o) {
|
|
366
|
-
|
|
428
|
+
if (I.current)
|
|
429
|
+
return;
|
|
430
|
+
f({
|
|
367
431
|
name: "error",
|
|
368
432
|
message: o instanceof Error ? o.message : "An unexpected error occurred."
|
|
369
433
|
});
|
|
370
434
|
}
|
|
371
|
-
},
|
|
372
|
-
|
|
435
|
+
}, te = () => {
|
|
436
|
+
f({ name: "upload" }), S("converted"), ne(!1), H(/* @__PURE__ */ new Set()), L(/* @__PURE__ */ new Set()), k(null), le(null);
|
|
373
437
|
};
|
|
374
|
-
function
|
|
375
|
-
return [...
|
|
438
|
+
function pe(r, o) {
|
|
439
|
+
return [...r].sort((l, y) => l === o ? -1 : y === o ? 1 : l.localeCompare(y));
|
|
376
440
|
}
|
|
377
|
-
function
|
|
378
|
-
const
|
|
379
|
-
|
|
441
|
+
function fe(r, o) {
|
|
442
|
+
const l = he(r, o), y = o === "converted" ? r.projectLayout.mainSourcePath : r.sourcePath, i = pe(Object.keys(l), y)[0];
|
|
443
|
+
H(i ? /* @__PURE__ */ new Set([i]) : /* @__PURE__ */ new Set());
|
|
380
444
|
}
|
|
381
|
-
function
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
return
|
|
445
|
+
function Ee(r) {
|
|
446
|
+
H((o) => {
|
|
447
|
+
const l = new Set(o);
|
|
448
|
+
return l.has(r) ? l.delete(r) : l.add(r), l;
|
|
385
449
|
});
|
|
386
450
|
}
|
|
387
451
|
if (N.name === "processing")
|
|
388
|
-
return /* @__PURE__ */ e.
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
452
|
+
return /* @__PURE__ */ e.jsx(
|
|
453
|
+
Me,
|
|
454
|
+
{
|
|
455
|
+
onCancel: C.cancel ? () => j(z) : void 0
|
|
456
|
+
}
|
|
457
|
+
);
|
|
392
458
|
if (N.name === "error")
|
|
393
459
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
394
460
|
/* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-800", children: [
|
|
@@ -399,32 +465,32 @@ function Me({
|
|
|
399
465
|
"button",
|
|
400
466
|
{
|
|
401
467
|
type: "button",
|
|
402
|
-
onClick:
|
|
468
|
+
onClick: te,
|
|
403
469
|
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
404
470
|
children: "Try Another File"
|
|
405
471
|
}
|
|
406
472
|
) })
|
|
407
473
|
] });
|
|
408
474
|
if (N.name === "sources") {
|
|
409
|
-
const
|
|
475
|
+
const r = N.prepared, o = V(r), l = o.manifest, y = o.primary?.path ?? "";
|
|
410
476
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
411
477
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
412
478
|
/* @__PURE__ */ e.jsx("h3", { className: "text-sm font-semibold text-slate-700", children: "Choose what to import" }),
|
|
413
479
|
/* @__PURE__ */ e.jsxs("p", { className: "mt-1 text-sm text-slate-500", children: [
|
|
414
|
-
|
|
480
|
+
r.fileName,
|
|
415
481
|
" contains more than one possible starting point."
|
|
416
482
|
] })
|
|
417
483
|
] }),
|
|
418
|
-
|
|
484
|
+
l ? /* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-blue-200 bg-blue-50 p-4 text-sm text-blue-900", children: [
|
|
419
485
|
/* @__PURE__ */ e.jsxs("p", { className: "font-medium", children: [
|
|
420
486
|
"Found ",
|
|
421
|
-
|
|
487
|
+
l.manifestPath,
|
|
422
488
|
" — an existing PreTeXt project."
|
|
423
489
|
] }),
|
|
424
490
|
/* @__PURE__ */ e.jsxs("p", { className: "mt-1 text-blue-800", children: [
|
|
425
491
|
"Its publication file, assets, and directory layout will be kept as they are. Targets:",
|
|
426
492
|
" ",
|
|
427
|
-
|
|
493
|
+
l.targets.map((i) => i.name).join(", "),
|
|
428
494
|
"."
|
|
429
495
|
] })
|
|
430
496
|
] }) : null,
|
|
@@ -433,17 +499,17 @@ function Me({
|
|
|
433
499
|
/* @__PURE__ */ e.jsxs(
|
|
434
500
|
"select",
|
|
435
501
|
{
|
|
436
|
-
value:
|
|
502
|
+
value: Y,
|
|
437
503
|
onChange: (i) => {
|
|
438
|
-
|
|
504
|
+
K(i.currentTarget.value), Q(null), D({});
|
|
439
505
|
},
|
|
440
506
|
className: "rounded border border-slate-300 px-2 py-1 text-sm",
|
|
441
507
|
children: [
|
|
442
508
|
/* @__PURE__ */ e.jsxs("option", { value: "auto", children: [
|
|
443
509
|
"Auto detect",
|
|
444
|
-
o.primary ? ` (${
|
|
510
|
+
o.primary ? ` (${ve[o.primary.format]})` : ""
|
|
445
511
|
] }),
|
|
446
|
-
o.formats.map((i) => /* @__PURE__ */ e.jsx("option", { value: i, children:
|
|
512
|
+
o.formats.map((i) => /* @__PURE__ */ e.jsx("option", { value: i, children: ve[i] }, i))
|
|
447
513
|
]
|
|
448
514
|
}
|
|
449
515
|
)
|
|
@@ -463,14 +529,14 @@ function Me({
|
|
|
463
529
|
value: i.path,
|
|
464
530
|
checked: y === i.path,
|
|
465
531
|
onChange: () => {
|
|
466
|
-
|
|
532
|
+
Q(i.path), D({});
|
|
467
533
|
},
|
|
468
534
|
className: "mt-0.5"
|
|
469
535
|
}
|
|
470
536
|
),
|
|
471
537
|
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
472
538
|
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs text-slate-900", children: i.path }),
|
|
473
|
-
/* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children:
|
|
539
|
+
/* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: ze(i) })
|
|
474
540
|
] })
|
|
475
541
|
]
|
|
476
542
|
},
|
|
@@ -481,7 +547,7 @@ function Me({
|
|
|
481
547
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Other documents" }),
|
|
482
548
|
/* @__PURE__ */ e.jsx("p", { className: "mt-1 text-sm text-slate-500", children: "These files also stand on their own. Attach them to the main document, or leave them out." }),
|
|
483
549
|
/* @__PURE__ */ e.jsx("div", { className: "mt-3 flex flex-col gap-2", children: o.extraRoots.map((i) => {
|
|
484
|
-
const
|
|
550
|
+
const J = U[i.path], oe = J?.include ?? !0;
|
|
485
551
|
return /* @__PURE__ */ e.jsxs(
|
|
486
552
|
"div",
|
|
487
553
|
{
|
|
@@ -492,12 +558,12 @@ function Me({
|
|
|
492
558
|
"input",
|
|
493
559
|
{
|
|
494
560
|
type: "checkbox",
|
|
495
|
-
checked:
|
|
496
|
-
onChange: (
|
|
497
|
-
...
|
|
561
|
+
checked: oe,
|
|
562
|
+
onChange: (X) => D((B) => ({
|
|
563
|
+
...B,
|
|
498
564
|
[i.path]: {
|
|
499
|
-
...
|
|
500
|
-
include:
|
|
565
|
+
...B[i.path],
|
|
566
|
+
include: X.currentTarget.checked
|
|
501
567
|
}
|
|
502
568
|
}))
|
|
503
569
|
}
|
|
@@ -513,13 +579,13 @@ function Me({
|
|
|
513
579
|
/* @__PURE__ */ e.jsxs(
|
|
514
580
|
"select",
|
|
515
581
|
{
|
|
516
|
-
value:
|
|
517
|
-
disabled: !
|
|
518
|
-
onChange: (
|
|
519
|
-
...
|
|
582
|
+
value: J?.level ?? "auto",
|
|
583
|
+
disabled: !oe,
|
|
584
|
+
onChange: (X) => D((B) => ({
|
|
585
|
+
...B,
|
|
520
586
|
[i.path]: {
|
|
521
|
-
include:
|
|
522
|
-
level:
|
|
587
|
+
include: B[i.path]?.include ?? !0,
|
|
588
|
+
level: X.currentTarget.value === "auto" ? void 0 : X.currentTarget.value
|
|
523
589
|
}
|
|
524
590
|
})),
|
|
525
591
|
className: "rounded border border-slate-300 px-2 py-1 text-sm disabled:opacity-50",
|
|
@@ -542,7 +608,7 @@ function Me({
|
|
|
542
608
|
"button",
|
|
543
609
|
{
|
|
544
610
|
type: "button",
|
|
545
|
-
onClick:
|
|
611
|
+
onClick: te,
|
|
546
612
|
className: "px-4 py-2 text-sm text-slate-600 hover:text-slate-900",
|
|
547
613
|
children: "Start Over"
|
|
548
614
|
}
|
|
@@ -551,7 +617,7 @@ function Me({
|
|
|
551
617
|
"button",
|
|
552
618
|
{
|
|
553
619
|
type: "button",
|
|
554
|
-
onClick: () =>
|
|
620
|
+
onClick: () => M(r),
|
|
555
621
|
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
556
622
|
children: "Continue"
|
|
557
623
|
}
|
|
@@ -560,53 +626,53 @@ function Me({
|
|
|
560
626
|
] });
|
|
561
627
|
}
|
|
562
628
|
if (N.name === "review") {
|
|
563
|
-
let
|
|
564
|
-
S(
|
|
565
|
-
}, o = function(
|
|
566
|
-
|
|
567
|
-
const
|
|
568
|
-
return
|
|
629
|
+
let r = function(n) {
|
|
630
|
+
S(n), F && fe(l, n);
|
|
631
|
+
}, o = function(n) {
|
|
632
|
+
L((T) => {
|
|
633
|
+
const ie = new Set(T);
|
|
634
|
+
return ie.has(n) ? ie.delete(n) : ie.add(n), ie;
|
|
569
635
|
});
|
|
570
636
|
};
|
|
571
|
-
const
|
|
572
|
-
Object.keys(
|
|
573
|
-
|
|
637
|
+
const l = m ?? N.result, y = l.splitLevel, i = l.detectedSourceFormat === "latex", J = l.warnings.length, oe = Object.keys(l.outputFiles).length, X = he(l, p), B = p === "converted" ? l.projectLayout.mainSourcePath : l.sourcePath, ce = pe(
|
|
638
|
+
Object.keys(X),
|
|
639
|
+
B
|
|
574
640
|
);
|
|
575
641
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
576
642
|
/* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-4", children: [
|
|
577
643
|
/* @__PURE__ */ e.jsx("h3", { className: "mb-3 text-sm font-semibold text-slate-700", children: "Import Summary" }),
|
|
578
644
|
/* @__PURE__ */ e.jsxs("dl", { className: "grid grid-cols-2 gap-x-6 gap-y-2 text-sm", children: [
|
|
579
645
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Source" }),
|
|
580
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children:
|
|
646
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: l.sourceName }),
|
|
581
647
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Detected format" }),
|
|
582
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children:
|
|
648
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: l.detectedSourceFormat }),
|
|
583
649
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Document kind" }),
|
|
584
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children:
|
|
650
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: l.documentKind }),
|
|
585
651
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Output files" }),
|
|
586
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children:
|
|
587
|
-
|
|
652
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: oe }),
|
|
653
|
+
l.projectLayout.preserved ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
588
654
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Existing project" }),
|
|
589
655
|
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: "Kept publication file, assets, and layout" })
|
|
590
656
|
] }) : null,
|
|
591
|
-
|
|
657
|
+
l.attachedRoots.length > 0 ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
592
658
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Attached" }),
|
|
593
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children:
|
|
659
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: l.attachedRoots.map((n) => `${n.title} (${n.level})`).join(", ") })
|
|
594
660
|
] }) : null
|
|
595
661
|
] })
|
|
596
662
|
] }),
|
|
597
|
-
|
|
663
|
+
J > 0 ? /* @__PURE__ */ e.jsxs("details", { className: "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm", children: [
|
|
598
664
|
/* @__PURE__ */ e.jsxs("summary", { className: "cursor-pointer font-semibold text-amber-800", children: [
|
|
599
|
-
|
|
665
|
+
J,
|
|
600
666
|
" conversion",
|
|
601
667
|
" ",
|
|
602
|
-
|
|
668
|
+
J === 1 ? "warning" : "warnings"
|
|
603
669
|
] }),
|
|
604
|
-
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children:
|
|
605
|
-
/* @__PURE__ */ e.jsx("code", { className: "rounded bg-amber-100 px-1 py-0.5 text-xs", children:
|
|
670
|
+
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children: l.warnings.map((n, T) => /* @__PURE__ */ e.jsxs("li", { children: [
|
|
671
|
+
/* @__PURE__ */ e.jsx("code", { className: "rounded bg-amber-100 px-1 py-0.5 text-xs", children: n.macro }),
|
|
606
672
|
" — ",
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
] },
|
|
673
|
+
n.action === "replace" || n.action === "rewrite" ? `replaced with \`${n.replacement}\`` : n.message ?? n.action,
|
|
674
|
+
n.occurrences > 1 ? ` (×${n.occurrences})` : null
|
|
675
|
+
] }, T)) })
|
|
610
676
|
] }) : /* @__PURE__ */ e.jsx("p", { className: "text-sm text-green-700", children: "No conversion warnings." }),
|
|
611
677
|
i ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
612
678
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Import mode" }),
|
|
@@ -618,8 +684,8 @@ function Me({
|
|
|
618
684
|
type: "radio",
|
|
619
685
|
name: "import-mode",
|
|
620
686
|
value: "converted",
|
|
621
|
-
checked:
|
|
622
|
-
onChange: () =>
|
|
687
|
+
checked: p === "converted",
|
|
688
|
+
onChange: () => r("converted"),
|
|
623
689
|
className: "mt-0.5"
|
|
624
690
|
}
|
|
625
691
|
),
|
|
@@ -635,8 +701,8 @@ function Me({
|
|
|
635
701
|
type: "radio",
|
|
636
702
|
name: "import-mode",
|
|
637
703
|
value: "native",
|
|
638
|
-
checked:
|
|
639
|
-
onChange: () =>
|
|
704
|
+
checked: p === "native",
|
|
705
|
+
onChange: () => r("native"),
|
|
640
706
|
className: "mt-0.5"
|
|
641
707
|
}
|
|
642
708
|
),
|
|
@@ -647,40 +713,40 @@ function Me({
|
|
|
647
713
|
] })
|
|
648
714
|
] })
|
|
649
715
|
] }) : null,
|
|
650
|
-
!
|
|
716
|
+
!x && l.cleanChunks.length > 0 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
651
717
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Split into files" }),
|
|
652
718
|
/* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: [
|
|
653
719
|
Array.from(
|
|
654
|
-
{ length:
|
|
655
|
-
(
|
|
720
|
+
{ length: Pe + 1 },
|
|
721
|
+
(n, T) => /* @__PURE__ */ e.jsx(
|
|
656
722
|
"button",
|
|
657
723
|
{
|
|
658
724
|
type: "button",
|
|
659
|
-
onClick: () => k(
|
|
660
|
-
"aria-pressed": y ===
|
|
661
|
-
className: y ===
|
|
662
|
-
children:
|
|
725
|
+
onClick: () => k(T),
|
|
726
|
+
"aria-pressed": y === T,
|
|
727
|
+
className: y === T ? "rounded bg-blue-700 px-3 py-1 text-sm font-medium text-white" : "rounded border border-slate-300 px-3 py-1 text-sm text-slate-700 hover:bg-slate-50",
|
|
728
|
+
children: T === 0 ? "One file" : `${T} level${T === 1 ? "" : "s"}`
|
|
663
729
|
},
|
|
664
|
-
|
|
730
|
+
T
|
|
665
731
|
)
|
|
666
732
|
),
|
|
667
733
|
/* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-sm text-slate-500", children: [
|
|
668
|
-
|
|
734
|
+
ce.length,
|
|
669
735
|
" file",
|
|
670
|
-
|
|
736
|
+
ce.length === 1 ? "" : "s"
|
|
671
737
|
] })
|
|
672
738
|
] }),
|
|
673
|
-
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 max-h-48 overflow-auto font-mono text-xs text-slate-600", children:
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
739
|
+
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 max-h-48 overflow-auto font-mono text-xs text-slate-600", children: ce.map((n) => /* @__PURE__ */ e.jsxs("li", { className: "truncate py-0.5", children: [
|
|
740
|
+
n,
|
|
741
|
+
u.get(n)?.fixCount ? /* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-amber-700", children: [
|
|
742
|
+
u.get(n).fixCount,
|
|
677
743
|
" change",
|
|
678
|
-
|
|
744
|
+
u.get(n).fixCount === 1 ? "" : "s"
|
|
679
745
|
] }) : null
|
|
680
|
-
] },
|
|
746
|
+
] }, n)) })
|
|
681
747
|
] }) : null,
|
|
682
|
-
|
|
683
|
-
const
|
|
748
|
+
F ? /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-lg border border-slate-200 text-sm", children: ce.map((n) => {
|
|
749
|
+
const T = me.has(n);
|
|
684
750
|
return /* @__PURE__ */ e.jsxs(
|
|
685
751
|
"div",
|
|
686
752
|
{
|
|
@@ -690,42 +756,42 @@ function Me({
|
|
|
690
756
|
"button",
|
|
691
757
|
{
|
|
692
758
|
type: "button",
|
|
693
|
-
onClick: () =>
|
|
759
|
+
onClick: () => Ee(n),
|
|
694
760
|
className: "flex w-full items-center gap-2 bg-slate-100 px-4 py-2 text-left font-mono text-xs text-slate-700 hover:bg-slate-200",
|
|
695
761
|
children: [
|
|
696
|
-
/* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-slate-400", children:
|
|
697
|
-
/* @__PURE__ */ e.jsx("span", { className: "flex-1 truncate", children:
|
|
762
|
+
/* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-slate-400", children: T ? "▾" : "▸" }),
|
|
763
|
+
/* @__PURE__ */ e.jsx("span", { className: "flex-1 truncate", children: n }),
|
|
698
764
|
/* @__PURE__ */ e.jsxs("span", { className: "shrink-0 text-slate-400", children: [
|
|
699
|
-
(
|
|
765
|
+
(X[n].length / 1024).toFixed(1),
|
|
700
766
|
" KB"
|
|
701
767
|
] })
|
|
702
768
|
]
|
|
703
769
|
}
|
|
704
770
|
),
|
|
705
|
-
|
|
706
|
-
|
|
771
|
+
T ? /* @__PURE__ */ e.jsxs("div", { className: "bg-white", children: [
|
|
772
|
+
u.get(n)?.hunks.length ? /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 border-b border-slate-200 px-4 py-2", children: [
|
|
707
773
|
/* @__PURE__ */ e.jsx(
|
|
708
774
|
"button",
|
|
709
775
|
{
|
|
710
776
|
type: "button",
|
|
711
|
-
onClick: () => o(
|
|
777
|
+
onClick: () => o(n),
|
|
712
778
|
className: "rounded border border-slate-300 px-2 py-0.5 text-xs text-slate-700 hover:bg-slate-50",
|
|
713
|
-
children:
|
|
779
|
+
children: A.has(n) ? "Show converted file" : "Show what changed"
|
|
714
780
|
}
|
|
715
781
|
),
|
|
716
782
|
/* @__PURE__ */ e.jsxs("span", { className: "text-xs text-slate-500", children: [
|
|
717
783
|
"+",
|
|
718
|
-
|
|
784
|
+
u.get(n).stats.added,
|
|
719
785
|
" −",
|
|
720
|
-
|
|
786
|
+
u.get(n).stats.removed,
|
|
721
787
|
" in the LaTeX source"
|
|
722
788
|
] })
|
|
723
789
|
] }) : null,
|
|
724
|
-
|
|
790
|
+
A.has(n) && u.has(n) ? /* @__PURE__ */ e.jsx(Ue, { hunks: u.get(n).hunks }) : /* @__PURE__ */ e.jsx("pre", { className: "m-0 max-h-72 overflow-auto p-4 font-mono text-xs leading-relaxed text-slate-800", children: X[n] })
|
|
725
791
|
] }) : null
|
|
726
792
|
]
|
|
727
793
|
},
|
|
728
|
-
|
|
794
|
+
n
|
|
729
795
|
);
|
|
730
796
|
}) }) : null,
|
|
731
797
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-3 pt-1", children: [
|
|
@@ -733,17 +799,17 @@ function Me({
|
|
|
733
799
|
"button",
|
|
734
800
|
{
|
|
735
801
|
type: "button",
|
|
736
|
-
onClick:
|
|
802
|
+
onClick: d ?? te,
|
|
737
803
|
className: "px-4 py-2 text-sm text-slate-600 hover:text-slate-900",
|
|
738
|
-
children:
|
|
804
|
+
children: d ? "Cancel" : "Start Over"
|
|
739
805
|
}
|
|
740
806
|
),
|
|
741
807
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
742
|
-
|
|
808
|
+
z ? /* @__PURE__ */ e.jsx(
|
|
743
809
|
"button",
|
|
744
810
|
{
|
|
745
811
|
type: "button",
|
|
746
|
-
onClick: () =>
|
|
812
|
+
onClick: () => f({ name: "sources", prepared: z }),
|
|
747
813
|
className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
|
|
748
814
|
children: "Change Sources"
|
|
749
815
|
}
|
|
@@ -753,19 +819,30 @@ function Me({
|
|
|
753
819
|
{
|
|
754
820
|
type: "button",
|
|
755
821
|
onClick: () => {
|
|
756
|
-
|
|
822
|
+
F || fe(l, p), ne((n) => !n);
|
|
757
823
|
},
|
|
758
824
|
className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
|
|
759
|
-
children:
|
|
825
|
+
children: F ? "Hide Preview" : "Preview"
|
|
760
826
|
}
|
|
761
827
|
),
|
|
762
|
-
/* @__PURE__ */ e.
|
|
828
|
+
/* @__PURE__ */ e.jsxs(
|
|
763
829
|
"button",
|
|
764
830
|
{
|
|
765
831
|
type: "button",
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
832
|
+
disabled: q,
|
|
833
|
+
onClick: async () => {
|
|
834
|
+
ee(!0);
|
|
835
|
+
try {
|
|
836
|
+
await s(l, p);
|
|
837
|
+
} finally {
|
|
838
|
+
ee(!1);
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
className: "flex items-center gap-2 rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600 disabled:opacity-60",
|
|
842
|
+
children: [
|
|
843
|
+
q ? /* @__PURE__ */ e.jsx("span", { className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent" }) : null,
|
|
844
|
+
q ? "Importing…" : "Confirm Import"
|
|
845
|
+
]
|
|
769
846
|
}
|
|
770
847
|
)
|
|
771
848
|
] })
|
|
@@ -775,7 +852,7 @@ function Me({
|
|
|
775
852
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
776
853
|
c.length > 1 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
777
854
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Converter" }),
|
|
778
|
-
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-3", children: c.map((
|
|
855
|
+
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-3", children: c.map((r) => /* @__PURE__ */ e.jsxs(
|
|
779
856
|
"label",
|
|
780
857
|
{
|
|
781
858
|
className: "flex cursor-pointer items-start gap-3 text-sm",
|
|
@@ -785,29 +862,29 @@ function Me({
|
|
|
785
862
|
{
|
|
786
863
|
type: "radio",
|
|
787
864
|
name: "import-engine",
|
|
788
|
-
value:
|
|
789
|
-
checked: P ===
|
|
790
|
-
onChange: () =>
|
|
865
|
+
value: r.id,
|
|
866
|
+
checked: P === r.id,
|
|
867
|
+
onChange: () => W(r.id),
|
|
791
868
|
className: "mt-0.5"
|
|
792
869
|
}
|
|
793
870
|
),
|
|
794
871
|
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
795
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-medium text-slate-900", children:
|
|
796
|
-
|
|
872
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-medium text-slate-900", children: r.label }),
|
|
873
|
+
r.description ? /* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: r.description }) : null
|
|
797
874
|
] })
|
|
798
875
|
]
|
|
799
876
|
},
|
|
800
|
-
|
|
877
|
+
r.id
|
|
801
878
|
)) })
|
|
802
879
|
] }) : null,
|
|
803
|
-
|
|
880
|
+
x ? null : /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-4 text-sm", children: /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2 text-slate-700", children: [
|
|
804
881
|
/* @__PURE__ */ e.jsx("span", { className: "text-slate-500", children: "Document kind" }),
|
|
805
882
|
/* @__PURE__ */ e.jsxs(
|
|
806
883
|
"select",
|
|
807
884
|
{
|
|
808
|
-
value:
|
|
809
|
-
onChange: (
|
|
810
|
-
|
|
885
|
+
value: R,
|
|
886
|
+
onChange: (r) => O(
|
|
887
|
+
r.currentTarget.value
|
|
811
888
|
),
|
|
812
889
|
className: "rounded border border-slate-300 px-2 py-1 text-sm",
|
|
813
890
|
children: [
|
|
@@ -823,26 +900,26 @@ function Me({
|
|
|
823
900
|
{
|
|
824
901
|
role: "button",
|
|
825
902
|
tabIndex: 0,
|
|
826
|
-
onKeyDown: (
|
|
903
|
+
onKeyDown: (r) => r.key === "Enter" && v.current?.click(),
|
|
827
904
|
onClick: () => v.current?.click(),
|
|
828
|
-
onDragOver: (
|
|
829
|
-
|
|
905
|
+
onDragOver: (r) => {
|
|
906
|
+
r.preventDefault(), w(!0);
|
|
830
907
|
},
|
|
831
|
-
onDragLeave: () =>
|
|
832
|
-
onDrop: (
|
|
833
|
-
|
|
834
|
-
const o =
|
|
835
|
-
o &&
|
|
908
|
+
onDragLeave: () => w(!1),
|
|
909
|
+
onDrop: (r) => {
|
|
910
|
+
r.preventDefault(), w(!1);
|
|
911
|
+
const o = r.dataTransfer.files?.[0];
|
|
912
|
+
o && G(o);
|
|
836
913
|
},
|
|
837
|
-
className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${
|
|
914
|
+
className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${_ ? "border-blue-500 bg-blue-50" : "border-slate-300 bg-slate-50 hover:border-slate-400"}`,
|
|
838
915
|
children: [
|
|
839
916
|
/* @__PURE__ */ e.jsx("p", { className: "text-slate-600", children: "Drop a file here, or click to select." }),
|
|
840
917
|
/* @__PURE__ */ e.jsx(
|
|
841
918
|
"button",
|
|
842
919
|
{
|
|
843
920
|
type: "button",
|
|
844
|
-
onClick: (
|
|
845
|
-
|
|
921
|
+
onClick: (r) => {
|
|
922
|
+
r.stopPropagation(), v.current?.click();
|
|
846
923
|
},
|
|
847
924
|
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
848
925
|
children: "Select File"
|
|
@@ -850,7 +927,7 @@ function Me({
|
|
|
850
927
|
),
|
|
851
928
|
/* @__PURE__ */ e.jsxs("p", { className: "text-xs text-slate-400", children: [
|
|
852
929
|
"Supports ",
|
|
853
|
-
|
|
930
|
+
t.join(", ")
|
|
854
931
|
] }),
|
|
855
932
|
/* @__PURE__ */ e.jsx(
|
|
856
933
|
"input",
|
|
@@ -858,10 +935,10 @@ function Me({
|
|
|
858
935
|
ref: v,
|
|
859
936
|
type: "file",
|
|
860
937
|
hidden: !0,
|
|
861
|
-
accept:
|
|
862
|
-
onChange: (
|
|
863
|
-
const o =
|
|
864
|
-
o &&
|
|
938
|
+
accept: t.join(","),
|
|
939
|
+
onChange: (r) => {
|
|
940
|
+
const o = r.currentTarget.files?.[0];
|
|
941
|
+
o && G(o), r.currentTarget.value = "";
|
|
865
942
|
}
|
|
866
943
|
}
|
|
867
944
|
)
|
|
@@ -870,23 +947,23 @@ function Me({
|
|
|
870
947
|
)
|
|
871
948
|
] });
|
|
872
949
|
}
|
|
873
|
-
function
|
|
874
|
-
return
|
|
875
|
-
|
|
876
|
-
|
|
950
|
+
function Ue({ hunks: s }) {
|
|
951
|
+
return s.length === 0 ? /* @__PURE__ */ e.jsx("p", { className: "m-0 px-4 py-3 text-xs text-slate-500", children: "Nothing was changed in this file." }) : /* @__PURE__ */ e.jsx("div", { className: "max-h-72 overflow-auto bg-white font-mono text-xs leading-relaxed", children: s.map((d, x) => /* @__PURE__ */ e.jsxs("div", { className: "border-b border-slate-100 last:border-b-0", children: [
|
|
952
|
+
x > 0 ? /* @__PURE__ */ e.jsx("div", { className: "bg-slate-50 px-4 py-1 text-slate-400", children: "⋯" }) : null,
|
|
953
|
+
d.lines.map((b, g) => /* @__PURE__ */ e.jsxs(
|
|
877
954
|
"div",
|
|
878
955
|
{
|
|
879
|
-
className:
|
|
956
|
+
className: b.op === "add" ? "bg-green-50 px-4 text-green-900" : b.op === "remove" ? "bg-red-50 px-4 text-red-900" : "px-4 text-slate-600",
|
|
880
957
|
children: [
|
|
881
|
-
/* @__PURE__ */ e.jsx("span", { className: "mr-2 select-none text-slate-400", children:
|
|
882
|
-
|
|
958
|
+
/* @__PURE__ */ e.jsx("span", { className: "mr-2 select-none text-slate-400", children: b.op === "add" ? "+" : b.op === "remove" ? "−" : " " }),
|
|
959
|
+
b.text || " "
|
|
883
960
|
]
|
|
884
961
|
},
|
|
885
|
-
|
|
962
|
+
g
|
|
886
963
|
))
|
|
887
|
-
] },
|
|
964
|
+
] }, x)) });
|
|
888
965
|
}
|
|
889
|
-
const
|
|
966
|
+
const Be = {
|
|
890
967
|
title: "Import Source Content",
|
|
891
968
|
description: "Paste LaTeX, Markdown, or PreTeXt source to convert into PreTeXt.",
|
|
892
969
|
sourceLabel: "Source",
|
|
@@ -897,37 +974,37 @@ const Le = {
|
|
|
897
974
|
successPrefix: "Ready",
|
|
898
975
|
errorPrefix: "Error"
|
|
899
976
|
};
|
|
900
|
-
function
|
|
901
|
-
initialSource:
|
|
902
|
-
initialSourceFormat:
|
|
903
|
-
labels:
|
|
904
|
-
disabled:
|
|
905
|
-
onImport:
|
|
977
|
+
function Je({
|
|
978
|
+
initialSource: s = "",
|
|
979
|
+
initialSourceFormat: d,
|
|
980
|
+
labels: x,
|
|
981
|
+
disabled: b = !1,
|
|
982
|
+
onImport: g
|
|
906
983
|
}) {
|
|
907
|
-
const c =
|
|
908
|
-
() => ({ ...
|
|
909
|
-
[
|
|
910
|
-
), [v, N] =
|
|
911
|
-
|
|
912
|
-
), [
|
|
984
|
+
const c = ae(
|
|
985
|
+
() => ({ ...Be, ...x ?? {} }),
|
|
986
|
+
[x]
|
|
987
|
+
), [v, N] = h(s), [f, _] = h(
|
|
988
|
+
d ?? "auto"
|
|
989
|
+
), [w, R] = h(
|
|
913
990
|
null
|
|
914
|
-
),
|
|
915
|
-
() =>
|
|
991
|
+
), O = ae(
|
|
992
|
+
() => _e(v),
|
|
916
993
|
[v]
|
|
917
|
-
),
|
|
994
|
+
), E = b || !v.trim();
|
|
918
995
|
return /* @__PURE__ */ e.jsx(
|
|
919
996
|
"form",
|
|
920
997
|
{
|
|
921
998
|
onSubmit: (k) => {
|
|
922
999
|
k.preventDefault();
|
|
923
|
-
const
|
|
1000
|
+
const A = Ae(
|
|
924
1001
|
v,
|
|
925
|
-
|
|
1002
|
+
f === "auto" ? void 0 : f
|
|
926
1003
|
);
|
|
927
|
-
|
|
1004
|
+
R(A), g(A);
|
|
928
1005
|
},
|
|
929
1006
|
"aria-label": "Import source form",
|
|
930
|
-
children: /* @__PURE__ */ e.jsxs("fieldset", { disabled:
|
|
1007
|
+
children: /* @__PURE__ */ e.jsxs("fieldset", { disabled: b, children: [
|
|
931
1008
|
/* @__PURE__ */ e.jsx("legend", { children: c.title }),
|
|
932
1009
|
/* @__PURE__ */ e.jsx("p", { children: c.description }),
|
|
933
1010
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
@@ -947,8 +1024,8 @@ function Xe({
|
|
|
947
1024
|
/* @__PURE__ */ e.jsxs(
|
|
948
1025
|
"select",
|
|
949
1026
|
{
|
|
950
|
-
value:
|
|
951
|
-
onChange: (k) =>
|
|
1027
|
+
value: f,
|
|
1028
|
+
onChange: (k) => _(
|
|
952
1029
|
k.currentTarget.value
|
|
953
1030
|
),
|
|
954
1031
|
children: [
|
|
@@ -963,24 +1040,24 @@ function Xe({
|
|
|
963
1040
|
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
964
1041
|
c.detectedFormatPrefix,
|
|
965
1042
|
": ",
|
|
966
|
-
/* @__PURE__ */ e.jsx("strong", { children:
|
|
1043
|
+
/* @__PURE__ */ e.jsx("strong", { children: O })
|
|
967
1044
|
] }),
|
|
968
|
-
/* @__PURE__ */ e.jsx("button", { type: "submit", disabled:
|
|
969
|
-
|
|
1045
|
+
/* @__PURE__ */ e.jsx("button", { type: "submit", disabled: E, children: c.convertButton }),
|
|
1046
|
+
w ? "pretextError" in w ? /* @__PURE__ */ e.jsxs("p", { role: "alert", children: [
|
|
970
1047
|
c.errorPrefix,
|
|
971
1048
|
": ",
|
|
972
|
-
|
|
1049
|
+
w.pretextError
|
|
973
1050
|
] }) : /* @__PURE__ */ e.jsxs("p", { children: [
|
|
974
1051
|
c.successPrefix,
|
|
975
1052
|
": ",
|
|
976
|
-
|
|
1053
|
+
w.pretextSource.length,
|
|
977
1054
|
" characters of PreTeXt generated."
|
|
978
1055
|
] }) : null
|
|
979
1056
|
] })
|
|
980
1057
|
}
|
|
981
1058
|
);
|
|
982
1059
|
}
|
|
983
|
-
const
|
|
1060
|
+
const We = {
|
|
984
1061
|
title: "Upload Source File",
|
|
985
1062
|
hint: "Supports .tex, .md, .ptx, .xml, .zip, and .tar.gz files.",
|
|
986
1063
|
selectButton: "Select File",
|
|
@@ -988,43 +1065,43 @@ const De = {
|
|
|
988
1065
|
documentKindLabel: "Document kind",
|
|
989
1066
|
splitSectionsLabel: "Split each chapter into sections"
|
|
990
1067
|
};
|
|
991
|
-
function
|
|
992
|
-
labels:
|
|
993
|
-
disabled:
|
|
994
|
-
defaultDocumentKind:
|
|
995
|
-
importOptions:
|
|
996
|
-
onImport:
|
|
1068
|
+
function He({
|
|
1069
|
+
labels: s,
|
|
1070
|
+
disabled: d = !1,
|
|
1071
|
+
defaultDocumentKind: x = "auto",
|
|
1072
|
+
importOptions: b,
|
|
1073
|
+
onImport: g
|
|
997
1074
|
}) {
|
|
998
|
-
const c =
|
|
999
|
-
() => ({ ...
|
|
1000
|
-
[
|
|
1001
|
-
), v =
|
|
1075
|
+
const c = ae(
|
|
1076
|
+
() => ({ ...We, ...s ?? {} }),
|
|
1077
|
+
[s]
|
|
1078
|
+
), v = ue(null), [N, f] = h(!1), [_, w] = h(!1), [R, O] = h(
|
|
1002
1079
|
[]
|
|
1003
|
-
), [
|
|
1004
|
-
|
|
1080
|
+
), [E, k] = h(x), [A, L] = h(!1), P = d || _, W = async (p) => {
|
|
1081
|
+
w(!0);
|
|
1005
1082
|
try {
|
|
1006
|
-
const
|
|
1007
|
-
documentKind:
|
|
1008
|
-
splitSections:
|
|
1083
|
+
const F = await Ne(p, b ?? {
|
|
1084
|
+
documentKind: E === "auto" ? void 0 : E,
|
|
1085
|
+
splitSections: A
|
|
1009
1086
|
});
|
|
1010
|
-
|
|
1087
|
+
O(F.statusMessages), g(F);
|
|
1011
1088
|
} finally {
|
|
1012
|
-
|
|
1089
|
+
w(!1);
|
|
1013
1090
|
}
|
|
1014
1091
|
};
|
|
1015
1092
|
return /* @__PURE__ */ e.jsxs("section", { "aria-label": "Import upload panel", children: [
|
|
1016
1093
|
/* @__PURE__ */ e.jsx("h3", { children: c.title }),
|
|
1017
1094
|
/* @__PURE__ */ e.jsx("p", { children: c.hint }),
|
|
1018
|
-
|
|
1095
|
+
b ? null : /* @__PURE__ */ e.jsxs("div", { className: "import-options", children: [
|
|
1019
1096
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
1020
1097
|
c.documentKindLabel,
|
|
1021
1098
|
/* @__PURE__ */ e.jsxs(
|
|
1022
1099
|
"select",
|
|
1023
1100
|
{
|
|
1024
|
-
value:
|
|
1101
|
+
value: E,
|
|
1025
1102
|
disabled: P,
|
|
1026
|
-
onChange: (
|
|
1027
|
-
|
|
1103
|
+
onChange: (p) => k(
|
|
1104
|
+
p.currentTarget.value
|
|
1028
1105
|
),
|
|
1029
1106
|
children: [
|
|
1030
1107
|
/* @__PURE__ */ e.jsx("option", { value: "auto", children: "Auto detect" }),
|
|
@@ -1039,9 +1116,9 @@ function ze({
|
|
|
1039
1116
|
"input",
|
|
1040
1117
|
{
|
|
1041
1118
|
type: "checkbox",
|
|
1042
|
-
checked:
|
|
1119
|
+
checked: A,
|
|
1043
1120
|
disabled: P,
|
|
1044
|
-
onChange: (
|
|
1121
|
+
onChange: (p) => L(p.currentTarget.checked)
|
|
1045
1122
|
}
|
|
1046
1123
|
),
|
|
1047
1124
|
c.splitSectionsLabel
|
|
@@ -1050,25 +1127,35 @@ function ze({
|
|
|
1050
1127
|
/* @__PURE__ */ e.jsxs(
|
|
1051
1128
|
"div",
|
|
1052
1129
|
{
|
|
1053
|
-
onDragOver: (
|
|
1054
|
-
|
|
1130
|
+
onDragOver: (p) => {
|
|
1131
|
+
p.preventDefault(), P || f(!0);
|
|
1055
1132
|
},
|
|
1056
|
-
onDragLeave: () =>
|
|
1057
|
-
onDrop: (
|
|
1058
|
-
if (
|
|
1133
|
+
onDragLeave: () => f(!1),
|
|
1134
|
+
onDrop: (p) => {
|
|
1135
|
+
if (p.preventDefault(), f(!1), P)
|
|
1059
1136
|
return;
|
|
1060
|
-
const S =
|
|
1061
|
-
S &&
|
|
1137
|
+
const S = p.dataTransfer.files?.[0];
|
|
1138
|
+
S && W(S);
|
|
1062
1139
|
},
|
|
1063
1140
|
children: [
|
|
1064
1141
|
/* @__PURE__ */ e.jsx("p", { children: c.dropHint }),
|
|
1065
|
-
/* @__PURE__ */ e.
|
|
1142
|
+
/* @__PURE__ */ e.jsxs(
|
|
1066
1143
|
"button",
|
|
1067
1144
|
{
|
|
1068
1145
|
type: "button",
|
|
1069
1146
|
disabled: P,
|
|
1070
1147
|
onClick: () => v.current?.click(),
|
|
1071
|
-
|
|
1148
|
+
className: "inline-flex items-center gap-2",
|
|
1149
|
+
children: [
|
|
1150
|
+
_ ? /* @__PURE__ */ e.jsx(
|
|
1151
|
+
"span",
|
|
1152
|
+
{
|
|
1153
|
+
className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent",
|
|
1154
|
+
"aria-hidden": "true"
|
|
1155
|
+
}
|
|
1156
|
+
) : null,
|
|
1157
|
+
_ ? "Processing…" : c.selectButton
|
|
1158
|
+
]
|
|
1072
1159
|
}
|
|
1073
1160
|
),
|
|
1074
1161
|
/* @__PURE__ */ e.jsx(
|
|
@@ -1079,21 +1166,23 @@ function ze({
|
|
|
1079
1166
|
hidden: !0,
|
|
1080
1167
|
disabled: P,
|
|
1081
1168
|
accept: ".tex,.md,.markdown,.ptx,.xml,.zip,.gz,.tar.gz,.tgz",
|
|
1082
|
-
onChange: (
|
|
1083
|
-
const S =
|
|
1084
|
-
S &&
|
|
1169
|
+
onChange: (p) => {
|
|
1170
|
+
const S = p.currentTarget.files?.[0];
|
|
1171
|
+
S && W(S), p.currentTarget.value = "";
|
|
1085
1172
|
}
|
|
1086
1173
|
}
|
|
1087
1174
|
)
|
|
1088
1175
|
]
|
|
1089
1176
|
}
|
|
1090
1177
|
),
|
|
1091
|
-
_
|
|
1178
|
+
_ ? /* @__PURE__ */ e.jsx("p", { role: "status", "aria-live": "polite", children: "Converting your file — this can take a while for a long document." }) : null,
|
|
1179
|
+
R.length > 0 ? /* @__PURE__ */ e.jsx("ul", { "aria-live": "polite", children: R.map((p, S) => /* @__PURE__ */ e.jsx("li", { children: p.message }, `${p.type}-${S}`)) }) : null,
|
|
1092
1180
|
N && !P ? /* @__PURE__ */ e.jsx("p", { children: "Release to upload the file." }) : null
|
|
1093
1181
|
] });
|
|
1094
1182
|
}
|
|
1095
1183
|
export {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1184
|
+
Je as ImportSourceForm,
|
|
1185
|
+
He as ImportUploadPanel,
|
|
1186
|
+
Ge as ImportWizard,
|
|
1187
|
+
Me as ProcessingPanel
|
|
1099
1188
|
};
|