@pretextbook/import 0.0.1 → 0.2.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/README.md +118 -121
- package/dist/{import-mode-iBDd9oQY.js → import-mode-BDY8WcYJ.js} +21 -10
- package/dist/import.css +1 -1
- package/dist/index.js +8 -3
- package/dist/react/import-source-form.d.ts +1 -1
- package/dist/react/import-upload-panel.d.ts +1 -1
- package/dist/react/import-wizard.d.ts +25 -2
- package/dist/react/index.d.ts +1 -1
- package/dist/react.cjs +2 -2
- package/dist/react.js +372 -309
- package/index.cjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +5 -2
package/dist/react.js
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
var
|
|
1
|
+
import oe, { useRef as re, useState as f, useMemo as H } from "react";
|
|
2
|
+
import { v as se, q as Z, m as le, l as ce } from "./import-mode-BDY8WcYJ.js";
|
|
3
|
+
var J = { exports: {} }, z = {};
|
|
4
4
|
var Q;
|
|
5
|
-
function
|
|
5
|
+
function ie() {
|
|
6
6
|
if (Q) return z;
|
|
7
7
|
Q = 1;
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
for (var
|
|
14
|
-
|
|
15
|
-
} else
|
|
16
|
-
return
|
|
17
|
-
$$typeof:
|
|
18
|
-
type:
|
|
19
|
-
key:
|
|
20
|
-
ref:
|
|
21
|
-
props:
|
|
8
|
+
var b = /* @__PURE__ */ Symbol.for("react.transitional.element"), k = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
9
|
+
function j(g, c, a) {
|
|
10
|
+
var i = null;
|
|
11
|
+
if (a !== void 0 && (i = "" + a), c.key !== void 0 && (i = "" + c.key), "key" in c) {
|
|
12
|
+
a = {};
|
|
13
|
+
for (var p in c)
|
|
14
|
+
p !== "key" && (a[p] = c[p]);
|
|
15
|
+
} else a = c;
|
|
16
|
+
return c = a.ref, {
|
|
17
|
+
$$typeof: b,
|
|
18
|
+
type: g,
|
|
19
|
+
key: i,
|
|
20
|
+
ref: c !== void 0 ? c : null,
|
|
21
|
+
props: a
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
return z.Fragment =
|
|
24
|
+
return z.Fragment = k, z.jsx = j, z.jsxs = j, z;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var M = {};
|
|
27
27
|
var ee;
|
|
28
|
-
function
|
|
28
|
+
function de() {
|
|
29
29
|
return ee || (ee = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
|
-
function
|
|
30
|
+
function b(t) {
|
|
31
31
|
if (t == null) return null;
|
|
32
32
|
if (typeof t == "function")
|
|
33
|
-
return t.$$typeof ===
|
|
33
|
+
return t.$$typeof === B ? null : t.displayName || t.name || null;
|
|
34
34
|
if (typeof t == "string") return t;
|
|
35
35
|
switch (t) {
|
|
36
|
-
case
|
|
36
|
+
case R:
|
|
37
37
|
return "Fragment";
|
|
38
38
|
case C:
|
|
39
39
|
return "Profiler";
|
|
40
|
-
case
|
|
40
|
+
case x:
|
|
41
41
|
return "StrictMode";
|
|
42
|
-
case
|
|
42
|
+
case $:
|
|
43
43
|
return "Suspense";
|
|
44
|
-
case
|
|
44
|
+
case X:
|
|
45
45
|
return "SuspenseList";
|
|
46
|
-
case
|
|
46
|
+
case U:
|
|
47
47
|
return "Activity";
|
|
48
48
|
}
|
|
49
49
|
if (typeof t == "object")
|
|
50
50
|
switch (typeof t.tag == "number" && console.error(
|
|
51
51
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
52
|
), t.$$typeof) {
|
|
53
|
-
case
|
|
53
|
+
case _:
|
|
54
54
|
return "Portal";
|
|
55
|
-
case
|
|
55
|
+
case E:
|
|
56
56
|
return t.displayName || "Context";
|
|
57
|
-
case
|
|
57
|
+
case l:
|
|
58
58
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
59
|
-
case
|
|
59
|
+
case O:
|
|
60
60
|
var r = t.render;
|
|
61
61
|
return t = t.displayName, t || (t = r.displayName || r.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
62
|
-
case
|
|
63
|
-
return r = t.displayName || null, r !== null ? r :
|
|
64
|
-
case
|
|
62
|
+
case Y:
|
|
63
|
+
return r = t.displayName || null, r !== null ? r : b(t.type) || "Memo";
|
|
64
|
+
case F:
|
|
65
65
|
r = t._payload, t = t._init;
|
|
66
66
|
try {
|
|
67
|
-
return
|
|
67
|
+
return b(t(r));
|
|
68
68
|
} catch {
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function k(t) {
|
|
74
74
|
return "" + t;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function j(t) {
|
|
77
77
|
try {
|
|
78
|
-
|
|
78
|
+
k(t);
|
|
79
79
|
var r = !1;
|
|
80
80
|
} catch {
|
|
81
81
|
r = !0;
|
|
82
82
|
}
|
|
83
83
|
if (r) {
|
|
84
84
|
r = console;
|
|
85
|
-
var
|
|
86
|
-
return
|
|
85
|
+
var o = r.error, d = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
86
|
+
return o.call(
|
|
87
87
|
r,
|
|
88
88
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
89
|
d
|
|
90
|
-
),
|
|
90
|
+
), k(t);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
if (t ===
|
|
95
|
-
if (typeof t == "object" && t !== null && t.$$typeof ===
|
|
93
|
+
function g(t) {
|
|
94
|
+
if (t === R) return "<>";
|
|
95
|
+
if (typeof t == "object" && t !== null && t.$$typeof === F)
|
|
96
96
|
return "<...>";
|
|
97
97
|
try {
|
|
98
|
-
var r =
|
|
98
|
+
var r = b(t);
|
|
99
99
|
return r ? "<" + r + ">" : "<...>";
|
|
100
100
|
} catch {
|
|
101
101
|
return "<...>";
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
var t =
|
|
104
|
+
function c() {
|
|
105
|
+
var t = D.A;
|
|
106
106
|
return t === null ? null : t.getOwner();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function a() {
|
|
109
109
|
return Error("react-stack-top-frame");
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (
|
|
111
|
+
function i(t) {
|
|
112
|
+
if (W.call(t, "key")) {
|
|
113
113
|
var r = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
114
114
|
if (r && r.isReactWarning) return !1;
|
|
115
115
|
}
|
|
116
116
|
return t.key !== void 0;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
function
|
|
120
|
-
|
|
118
|
+
function p(t, r) {
|
|
119
|
+
function o() {
|
|
120
|
+
m || (m = !0, console.error(
|
|
121
121
|
"%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
122
|
r
|
|
123
123
|
));
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
get:
|
|
125
|
+
o.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
126
|
+
get: o,
|
|
127
127
|
configurable: !0
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
var t =
|
|
132
|
-
return
|
|
130
|
+
function h() {
|
|
131
|
+
var t = b(this.type);
|
|
132
|
+
return y[t] || (y[t] = !0, console.error(
|
|
133
133
|
"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
134
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
var
|
|
136
|
+
function w(t, r, o, d, q, V) {
|
|
137
|
+
var u = o.ref;
|
|
138
138
|
return t = {
|
|
139
|
-
$$typeof:
|
|
139
|
+
$$typeof: T,
|
|
140
140
|
type: t,
|
|
141
141
|
key: r,
|
|
142
|
-
props:
|
|
142
|
+
props: o,
|
|
143
143
|
_owner: d
|
|
144
|
-
}, (
|
|
144
|
+
}, (u !== void 0 ? u : null) !== null ? Object.defineProperty(t, "ref", {
|
|
145
145
|
enumerable: !1,
|
|
146
|
-
get:
|
|
146
|
+
get: h
|
|
147
147
|
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
148
148
|
configurable: !1,
|
|
149
149
|
enumerable: !1,
|
|
@@ -158,33 +158,33 @@ function ie() {
|
|
|
158
158
|
configurable: !1,
|
|
159
159
|
enumerable: !1,
|
|
160
160
|
writable: !0,
|
|
161
|
-
value:
|
|
161
|
+
value: q
|
|
162
162
|
}), Object.defineProperty(t, "_debugTask", {
|
|
163
163
|
configurable: !1,
|
|
164
164
|
enumerable: !1,
|
|
165
165
|
writable: !0,
|
|
166
|
-
value:
|
|
166
|
+
value: V
|
|
167
167
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
169
|
+
function v(t, r, o, d, q, V) {
|
|
170
|
+
var u = r.children;
|
|
171
|
+
if (u !== void 0)
|
|
172
172
|
if (d)
|
|
173
|
-
if (
|
|
174
|
-
for (d = 0; d <
|
|
175
|
-
|
|
176
|
-
Object.freeze && Object.freeze(
|
|
173
|
+
if (s(u)) {
|
|
174
|
+
for (d = 0; d < u.length; d++)
|
|
175
|
+
S(u[d]);
|
|
176
|
+
Object.freeze && Object.freeze(u);
|
|
177
177
|
} else
|
|
178
178
|
console.error(
|
|
179
179
|
"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
180
|
);
|
|
181
|
-
else
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
var I = Object.keys(r).filter(function(
|
|
185
|
-
return
|
|
181
|
+
else S(u);
|
|
182
|
+
if (W.call(r, "key")) {
|
|
183
|
+
u = b(t);
|
|
184
|
+
var I = Object.keys(r).filter(function(ae) {
|
|
185
|
+
return ae !== "key";
|
|
186
186
|
});
|
|
187
|
-
d = 0 < I.length ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
187
|
+
d = 0 < I.length ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}", K[u + d] || (I = 0 < I.length ? "{" + I.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
188
|
`A props object containing a "key" prop is being spread into JSX:
|
|
189
189
|
let props = %s;
|
|
190
190
|
<%s {...props} />
|
|
@@ -192,164 +192,186 @@ React keys must be passed directly to JSX without using spread:
|
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s key={someKey} {...props} />`,
|
|
194
194
|
d,
|
|
195
|
-
|
|
195
|
+
u,
|
|
196
196
|
I,
|
|
197
|
-
|
|
198
|
-
),
|
|
197
|
+
u
|
|
198
|
+
), K[u + d] = !0);
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
for (var
|
|
203
|
-
|
|
204
|
-
} else
|
|
205
|
-
return
|
|
206
|
-
|
|
200
|
+
if (u = null, o !== void 0 && (j(o), u = "" + o), i(r) && (j(r.key), u = "" + r.key), "key" in r) {
|
|
201
|
+
o = {};
|
|
202
|
+
for (var G in r)
|
|
203
|
+
G !== "key" && (o[G] = r[G]);
|
|
204
|
+
} else o = r;
|
|
205
|
+
return u && p(
|
|
206
|
+
o,
|
|
207
207
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
208
|
-
),
|
|
208
|
+
), w(
|
|
209
209
|
t,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
u,
|
|
211
|
+
o,
|
|
212
|
+
c(),
|
|
213
|
+
q,
|
|
214
|
+
V
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
217
|
+
function S(t) {
|
|
218
|
+
P(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === F && (t._payload.status === "fulfilled" ? P(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
220
|
+
function P(t) {
|
|
221
|
+
return typeof t == "object" && t !== null && t.$$typeof === T;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var N = oe, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), _ = /* @__PURE__ */ Symbol.for("react.portal"), R = /* @__PURE__ */ Symbol.for("react.fragment"), x = /* @__PURE__ */ Symbol.for("react.strict_mode"), C = /* @__PURE__ */ Symbol.for("react.profiler"), l = /* @__PURE__ */ Symbol.for("react.consumer"), E = /* @__PURE__ */ Symbol.for("react.context"), O = /* @__PURE__ */ Symbol.for("react.forward_ref"), $ = /* @__PURE__ */ Symbol.for("react.suspense"), X = /* @__PURE__ */ Symbol.for("react.suspense_list"), Y = /* @__PURE__ */ Symbol.for("react.memo"), F = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), B = /* @__PURE__ */ Symbol.for("react.client.reference"), D = N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, s = Array.isArray, n = console.createTask ? console.createTask : function() {
|
|
224
224
|
return null;
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
N = {
|
|
227
227
|
react_stack_bottom_frame: function(t) {
|
|
228
228
|
return t();
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
)(),
|
|
235
|
-
|
|
236
|
-
var d = 1e4 >
|
|
237
|
-
return
|
|
231
|
+
var m, y = {}, A = N.react_stack_bottom_frame.bind(
|
|
232
|
+
N,
|
|
233
|
+
a
|
|
234
|
+
)(), L = n(g(a)), K = {};
|
|
235
|
+
M.Fragment = R, M.jsx = function(t, r, o) {
|
|
236
|
+
var d = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
237
|
+
return v(
|
|
238
238
|
t,
|
|
239
239
|
r,
|
|
240
|
-
|
|
240
|
+
o,
|
|
241
241
|
!1,
|
|
242
|
-
d ? Error("react-stack-top-frame") :
|
|
243
|
-
d ?
|
|
242
|
+
d ? Error("react-stack-top-frame") : A,
|
|
243
|
+
d ? n(g(t)) : L
|
|
244
244
|
);
|
|
245
|
-
},
|
|
246
|
-
var d = 1e4 >
|
|
247
|
-
return
|
|
245
|
+
}, M.jsxs = function(t, r, o) {
|
|
246
|
+
var d = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
247
|
+
return v(
|
|
248
248
|
t,
|
|
249
249
|
r,
|
|
250
|
-
|
|
250
|
+
o,
|
|
251
251
|
!0,
|
|
252
|
-
d ? Error("react-stack-top-frame") :
|
|
253
|
-
d ?
|
|
252
|
+
d ? Error("react-stack-top-frame") : A,
|
|
253
|
+
d ? n(g(t)) : L
|
|
254
254
|
);
|
|
255
255
|
};
|
|
256
|
-
})()),
|
|
256
|
+
})()), M;
|
|
257
257
|
}
|
|
258
258
|
var te;
|
|
259
259
|
function ue() {
|
|
260
|
-
return te || (te = 1, process.env.NODE_ENV === "production" ?
|
|
260
|
+
return te || (te = 1, process.env.NODE_ENV === "production" ? J.exports = ie() : J.exports = de()), J.exports;
|
|
261
261
|
}
|
|
262
262
|
var e = ue();
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
const ne = [
|
|
264
|
+
".tex",
|
|
265
|
+
".md",
|
|
266
|
+
".markdown",
|
|
267
|
+
".ptx",
|
|
268
|
+
".xml",
|
|
269
|
+
".zip",
|
|
270
|
+
".gz",
|
|
271
|
+
".tar.gz",
|
|
272
|
+
".tgz"
|
|
273
|
+
], me = {
|
|
274
|
+
id: "builtin",
|
|
275
|
+
label: "Built-in converter",
|
|
276
|
+
description: "Create a new project starting with LaTeX, Markdown, or PreTeXt files.",
|
|
277
|
+
acceptExtensions: ne,
|
|
278
|
+
convertFile: se
|
|
279
|
+
};
|
|
280
|
+
function be({
|
|
281
|
+
onConfirm: b,
|
|
282
|
+
onCancel: k,
|
|
283
|
+
importOptions: j,
|
|
284
|
+
defaultDocumentKind: g = "auto",
|
|
285
|
+
engines: c
|
|
268
286
|
}) {
|
|
269
|
-
const i = re(null), [
|
|
270
|
-
|
|
287
|
+
const a = c && c.length > 0 ? c : [me], i = re(null), [p, h] = f({ name: "upload" }), [w, v] = f(!1), [S, P] = f(g), [N, T] = f(!1), [_, R] = f(a[0].id), [x, C] = f("converted"), [l, E] = f(!1), [O, $] = f(/* @__PURE__ */ new Set()), X = a.find((s) => s.id === _) ?? a[0], Y = X.acceptExtensions ?? ne, F = async (s) => {
|
|
288
|
+
h({ name: "processing" });
|
|
271
289
|
try {
|
|
272
|
-
const
|
|
273
|
-
documentKind:
|
|
274
|
-
splitSections:
|
|
275
|
-
});
|
|
276
|
-
"pretextError" in
|
|
277
|
-
} catch (
|
|
278
|
-
|
|
290
|
+
const n = j ?? {
|
|
291
|
+
documentKind: S === "auto" ? void 0 : S,
|
|
292
|
+
splitSections: N
|
|
293
|
+
}, m = await X.convertFile(s, n);
|
|
294
|
+
"pretextError" in m ? h({ name: "error", message: m.pretextError }) : h({ name: "review", result: m });
|
|
295
|
+
} catch (n) {
|
|
296
|
+
h({
|
|
279
297
|
name: "error",
|
|
280
|
-
message:
|
|
298
|
+
message: n instanceof Error ? n.message : "An unexpected error occurred."
|
|
281
299
|
});
|
|
282
300
|
}
|
|
283
|
-
},
|
|
284
|
-
|
|
301
|
+
}, U = () => {
|
|
302
|
+
h({ name: "upload" }), C("converted"), E(!1), $(/* @__PURE__ */ new Set());
|
|
285
303
|
};
|
|
286
|
-
function
|
|
287
|
-
return [...
|
|
304
|
+
function B(s, n) {
|
|
305
|
+
return [...s].sort((m, y) => m === n ? -1 : y === n ? 1 : m.localeCompare(y));
|
|
288
306
|
}
|
|
289
|
-
function
|
|
290
|
-
const
|
|
291
|
-
|
|
307
|
+
function D(s, n) {
|
|
308
|
+
const m = Z(s, n), y = n === "converted" ? "source/main.ptx" : s.sourcePath, A = B(Object.keys(m), y)[0];
|
|
309
|
+
$(A ? /* @__PURE__ */ new Set([A]) : /* @__PURE__ */ new Set());
|
|
292
310
|
}
|
|
293
|
-
function
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
return
|
|
311
|
+
function W(s) {
|
|
312
|
+
$((n) => {
|
|
313
|
+
const m = new Set(n);
|
|
314
|
+
return m.has(s) ? m.delete(s) : m.add(s), m;
|
|
297
315
|
});
|
|
298
316
|
}
|
|
299
|
-
if (
|
|
317
|
+
if (p.name === "processing")
|
|
300
318
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-slate-600", children: [
|
|
301
319
|
/* @__PURE__ */ e.jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-blue-700 border-t-transparent" }),
|
|
302
320
|
/* @__PURE__ */ e.jsx("p", { className: "text-sm", children: "Processing your file…" })
|
|
303
321
|
] });
|
|
304
|
-
if (
|
|
322
|
+
if (p.name === "error")
|
|
305
323
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
306
324
|
/* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-800", children: [
|
|
307
325
|
/* @__PURE__ */ e.jsx("p", { className: "font-semibold", children: "Import failed" }),
|
|
308
|
-
/* @__PURE__ */ e.jsx("p", { className: "mt-1", children:
|
|
326
|
+
/* @__PURE__ */ e.jsx("p", { className: "mt-1", children: p.message })
|
|
309
327
|
] }),
|
|
310
328
|
/* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ e.jsx(
|
|
311
329
|
"button",
|
|
312
330
|
{
|
|
313
331
|
type: "button",
|
|
314
|
-
onClick:
|
|
332
|
+
onClick: U,
|
|
315
333
|
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
316
334
|
children: "Try Another File"
|
|
317
335
|
}
|
|
318
336
|
) })
|
|
319
337
|
] });
|
|
320
|
-
if (
|
|
321
|
-
let
|
|
322
|
-
|
|
338
|
+
if (p.name === "review") {
|
|
339
|
+
let s = function(r) {
|
|
340
|
+
C(r), l && D(n, r);
|
|
323
341
|
};
|
|
324
|
-
const { result:
|
|
342
|
+
const { result: n } = p, m = n.detectedSourceFormat === "latex", y = n.warnings.length, A = Object.keys(n.outputFiles).length, L = Z(n, x), K = x === "converted" ? "source/main.ptx" : n.sourcePath, t = B(
|
|
343
|
+
Object.keys(L),
|
|
344
|
+
K
|
|
345
|
+
);
|
|
325
346
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
326
347
|
/* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-4", children: [
|
|
327
348
|
/* @__PURE__ */ e.jsx("h3", { className: "mb-3 text-sm font-semibold text-slate-700", children: "Import Summary" }),
|
|
328
349
|
/* @__PURE__ */ e.jsxs("dl", { className: "grid grid-cols-2 gap-x-6 gap-y-2 text-sm", children: [
|
|
329
350
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Source" }),
|
|
330
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children:
|
|
351
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: n.sourceName }),
|
|
331
352
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Detected format" }),
|
|
332
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children:
|
|
353
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: n.detectedSourceFormat }),
|
|
333
354
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Document kind" }),
|
|
334
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children:
|
|
355
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: n.documentKind }),
|
|
335
356
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Output files" }),
|
|
336
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children:
|
|
357
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: A })
|
|
337
358
|
] })
|
|
338
359
|
] }),
|
|
339
|
-
|
|
360
|
+
y > 0 ? /* @__PURE__ */ e.jsxs("details", { className: "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm", children: [
|
|
340
361
|
/* @__PURE__ */ e.jsxs("summary", { className: "cursor-pointer font-semibold text-amber-800", children: [
|
|
341
|
-
|
|
342
|
-
" conversion
|
|
343
|
-
|
|
362
|
+
y,
|
|
363
|
+
" conversion",
|
|
364
|
+
" ",
|
|
365
|
+
y === 1 ? "warning" : "warnings"
|
|
344
366
|
] }),
|
|
345
|
-
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children:
|
|
346
|
-
/* @__PURE__ */ e.jsx("code", { className: "rounded bg-amber-100 px-1 py-0.5 text-xs", children:
|
|
367
|
+
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children: n.warnings.map((r, o) => /* @__PURE__ */ e.jsxs("li", { children: [
|
|
368
|
+
/* @__PURE__ */ e.jsx("code", { className: "rounded bg-amber-100 px-1 py-0.5 text-xs", children: r.macro }),
|
|
347
369
|
" — ",
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
] },
|
|
370
|
+
r.action === "replace" || r.action === "rewrite" ? `replaced with \`${r.replacement}\`` : r.message ?? r.action,
|
|
371
|
+
r.occurrences > 1 ? ` (×${r.occurrences})` : null
|
|
372
|
+
] }, o)) })
|
|
351
373
|
] }) : /* @__PURE__ */ e.jsx("p", { className: "text-sm text-green-700", children: "No conversion warnings." }),
|
|
352
|
-
|
|
374
|
+
m ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
353
375
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Import mode" }),
|
|
354
376
|
/* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-col gap-3", children: [
|
|
355
377
|
/* @__PURE__ */ e.jsxs("label", { className: "flex cursor-pointer items-start gap-3 text-sm", children: [
|
|
@@ -360,7 +382,7 @@ function pe({
|
|
|
360
382
|
name: "import-mode",
|
|
361
383
|
value: "converted",
|
|
362
384
|
checked: x === "converted",
|
|
363
|
-
onChange: () =>
|
|
385
|
+
onChange: () => s("converted"),
|
|
364
386
|
className: "mt-0.5"
|
|
365
387
|
}
|
|
366
388
|
),
|
|
@@ -377,7 +399,7 @@ function pe({
|
|
|
377
399
|
name: "import-mode",
|
|
378
400
|
value: "native",
|
|
379
401
|
checked: x === "native",
|
|
380
|
-
onChange: () =>
|
|
402
|
+
onChange: () => s("native"),
|
|
381
403
|
className: "mt-0.5"
|
|
382
404
|
}
|
|
383
405
|
),
|
|
@@ -388,36 +410,43 @@ function pe({
|
|
|
388
410
|
] })
|
|
389
411
|
] })
|
|
390
412
|
] }) : null,
|
|
391
|
-
|
|
392
|
-
const
|
|
393
|
-
return /* @__PURE__ */ e.jsxs(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
413
|
+
l ? /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-lg border border-slate-200 text-sm", children: t.map((r) => {
|
|
414
|
+
const o = O.has(r);
|
|
415
|
+
return /* @__PURE__ */ e.jsxs(
|
|
416
|
+
"div",
|
|
417
|
+
{
|
|
418
|
+
className: "border-b border-slate-200 last:border-b-0",
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ e.jsxs(
|
|
421
|
+
"button",
|
|
422
|
+
{
|
|
423
|
+
type: "button",
|
|
424
|
+
onClick: () => W(r),
|
|
425
|
+
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",
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-slate-400", children: o ? "▾" : "▸" }),
|
|
428
|
+
/* @__PURE__ */ e.jsx("span", { className: "flex-1 truncate", children: r }),
|
|
429
|
+
/* @__PURE__ */ e.jsxs("span", { className: "shrink-0 text-slate-400", children: [
|
|
430
|
+
(L[r].length / 1024).toFixed(1),
|
|
431
|
+
" KB"
|
|
432
|
+
] })
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
o ? /* @__PURE__ */ e.jsx("pre", { className: "m-0 max-h-72 overflow-auto bg-white p-4 font-mono text-xs leading-relaxed text-slate-800", children: L[r] }) : null
|
|
437
|
+
]
|
|
438
|
+
},
|
|
439
|
+
r
|
|
440
|
+
);
|
|
412
441
|
}) }) : null,
|
|
413
442
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-3 pt-1", children: [
|
|
414
443
|
/* @__PURE__ */ e.jsx(
|
|
415
444
|
"button",
|
|
416
445
|
{
|
|
417
446
|
type: "button",
|
|
418
|
-
onClick:
|
|
447
|
+
onClick: k ?? U,
|
|
419
448
|
className: "px-4 py-2 text-sm text-slate-600 hover:text-slate-900",
|
|
420
|
-
children:
|
|
449
|
+
children: k ? "Cancel" : "Start Over"
|
|
421
450
|
}
|
|
422
451
|
),
|
|
423
452
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
@@ -426,17 +455,17 @@ function pe({
|
|
|
426
455
|
{
|
|
427
456
|
type: "button",
|
|
428
457
|
onClick: () => {
|
|
429
|
-
|
|
458
|
+
l || D(n, x), E((r) => !r);
|
|
430
459
|
},
|
|
431
460
|
className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
|
|
432
|
-
children:
|
|
461
|
+
children: l ? "Hide Preview" : "Preview"
|
|
433
462
|
}
|
|
434
463
|
),
|
|
435
464
|
/* @__PURE__ */ e.jsx(
|
|
436
465
|
"button",
|
|
437
466
|
{
|
|
438
467
|
type: "button",
|
|
439
|
-
onClick: () =>
|
|
468
|
+
onClick: () => b(n, x),
|
|
440
469
|
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
441
470
|
children: "Confirm Import"
|
|
442
471
|
}
|
|
@@ -446,14 +475,43 @@ function pe({
|
|
|
446
475
|
] });
|
|
447
476
|
}
|
|
448
477
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
449
|
-
|
|
478
|
+
a.length > 1 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
479
|
+
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Converter" }),
|
|
480
|
+
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-3", children: a.map((s) => /* @__PURE__ */ e.jsxs(
|
|
481
|
+
"label",
|
|
482
|
+
{
|
|
483
|
+
className: "flex cursor-pointer items-start gap-3 text-sm",
|
|
484
|
+
children: [
|
|
485
|
+
/* @__PURE__ */ e.jsx(
|
|
486
|
+
"input",
|
|
487
|
+
{
|
|
488
|
+
type: "radio",
|
|
489
|
+
name: "import-engine",
|
|
490
|
+
value: s.id,
|
|
491
|
+
checked: _ === s.id,
|
|
492
|
+
onChange: () => R(s.id),
|
|
493
|
+
className: "mt-0.5"
|
|
494
|
+
}
|
|
495
|
+
),
|
|
496
|
+
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
497
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-medium text-slate-900", children: s.label }),
|
|
498
|
+
s.description ? /* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: s.description }) : null
|
|
499
|
+
] })
|
|
500
|
+
]
|
|
501
|
+
},
|
|
502
|
+
s.id
|
|
503
|
+
)) })
|
|
504
|
+
] }) : null,
|
|
505
|
+
j ? null : /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap gap-4 text-sm", children: [
|
|
450
506
|
/* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2 text-slate-700", children: [
|
|
451
507
|
/* @__PURE__ */ e.jsx("span", { className: "text-slate-500", children: "Document kind" }),
|
|
452
508
|
/* @__PURE__ */ e.jsxs(
|
|
453
509
|
"select",
|
|
454
510
|
{
|
|
455
|
-
value:
|
|
456
|
-
onChange: (
|
|
511
|
+
value: S,
|
|
512
|
+
onChange: (s) => P(
|
|
513
|
+
s.currentTarget.value
|
|
514
|
+
),
|
|
457
515
|
className: "rounded border border-slate-300 px-2 py-1 text-sm",
|
|
458
516
|
children: [
|
|
459
517
|
/* @__PURE__ */ e.jsx("option", { value: "auto", children: "Auto detect" }),
|
|
@@ -468,8 +526,8 @@ function pe({
|
|
|
468
526
|
"input",
|
|
469
527
|
{
|
|
470
528
|
type: "checkbox",
|
|
471
|
-
checked:
|
|
472
|
-
onChange: (
|
|
529
|
+
checked: N,
|
|
530
|
+
onChange: (s) => T(s.currentTarget.checked)
|
|
473
531
|
}
|
|
474
532
|
),
|
|
475
533
|
"Split sections into separate files"
|
|
@@ -480,42 +538,45 @@ function pe({
|
|
|
480
538
|
{
|
|
481
539
|
role: "button",
|
|
482
540
|
tabIndex: 0,
|
|
483
|
-
onKeyDown: (
|
|
541
|
+
onKeyDown: (s) => s.key === "Enter" && i.current?.click(),
|
|
484
542
|
onClick: () => i.current?.click(),
|
|
485
|
-
onDragOver: (
|
|
486
|
-
|
|
543
|
+
onDragOver: (s) => {
|
|
544
|
+
s.preventDefault(), v(!0);
|
|
487
545
|
},
|
|
488
|
-
onDragLeave: () =>
|
|
489
|
-
onDrop: (
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
|
|
546
|
+
onDragLeave: () => v(!1),
|
|
547
|
+
onDrop: (s) => {
|
|
548
|
+
s.preventDefault(), v(!1);
|
|
549
|
+
const n = s.dataTransfer.files?.[0];
|
|
550
|
+
n && F(n);
|
|
493
551
|
},
|
|
494
|
-
className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${
|
|
552
|
+
className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${w ? "border-blue-500 bg-blue-50" : "border-slate-300 bg-slate-50 hover:border-slate-400"}`,
|
|
495
553
|
children: [
|
|
496
554
|
/* @__PURE__ */ e.jsx("p", { className: "text-slate-600", children: "Drop a file here, or click to select." }),
|
|
497
555
|
/* @__PURE__ */ e.jsx(
|
|
498
556
|
"button",
|
|
499
557
|
{
|
|
500
558
|
type: "button",
|
|
501
|
-
onClick: (
|
|
502
|
-
|
|
559
|
+
onClick: (s) => {
|
|
560
|
+
s.stopPropagation(), i.current?.click();
|
|
503
561
|
},
|
|
504
562
|
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
505
563
|
children: "Select File"
|
|
506
564
|
}
|
|
507
565
|
),
|
|
508
|
-
/* @__PURE__ */ e.
|
|
566
|
+
/* @__PURE__ */ e.jsxs("p", { className: "text-xs text-slate-400", children: [
|
|
567
|
+
"Supports ",
|
|
568
|
+
Y.join(", ")
|
|
569
|
+
] }),
|
|
509
570
|
/* @__PURE__ */ e.jsx(
|
|
510
571
|
"input",
|
|
511
572
|
{
|
|
512
573
|
ref: i,
|
|
513
574
|
type: "file",
|
|
514
575
|
hidden: !0,
|
|
515
|
-
accept:
|
|
516
|
-
onChange: (
|
|
517
|
-
const
|
|
518
|
-
|
|
576
|
+
accept: Y.join(","),
|
|
577
|
+
onChange: (s) => {
|
|
578
|
+
const n = s.currentTarget.files?.[0];
|
|
579
|
+
n && F(n), s.currentTarget.value = "";
|
|
519
580
|
}
|
|
520
581
|
}
|
|
521
582
|
)
|
|
@@ -524,7 +585,7 @@ function pe({
|
|
|
524
585
|
)
|
|
525
586
|
] });
|
|
526
587
|
}
|
|
527
|
-
const
|
|
588
|
+
const xe = {
|
|
528
589
|
title: "Import Source Content",
|
|
529
590
|
description: "Paste LaTeX, Markdown, or PreTeXt source to convert into PreTeXt.",
|
|
530
591
|
sourceLabel: "Source",
|
|
@@ -535,57 +596,59 @@ const de = {
|
|
|
535
596
|
successPrefix: "Ready",
|
|
536
597
|
errorPrefix: "Error"
|
|
537
598
|
};
|
|
538
|
-
function
|
|
539
|
-
initialSource:
|
|
540
|
-
initialSourceFormat:
|
|
541
|
-
labels:
|
|
542
|
-
disabled:
|
|
543
|
-
onImport:
|
|
599
|
+
function ve({
|
|
600
|
+
initialSource: b = "",
|
|
601
|
+
initialSourceFormat: k,
|
|
602
|
+
labels: j,
|
|
603
|
+
disabled: g = !1,
|
|
604
|
+
onImport: c
|
|
544
605
|
}) {
|
|
545
|
-
const
|
|
546
|
-
() => ({ ...
|
|
547
|
-
[
|
|
548
|
-
), [
|
|
549
|
-
|
|
550
|
-
), [
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
606
|
+
const a = H(
|
|
607
|
+
() => ({ ...xe, ...j ?? {} }),
|
|
608
|
+
[j]
|
|
609
|
+
), [i, p] = f(b), [h, w] = f(
|
|
610
|
+
k ?? "auto"
|
|
611
|
+
), [v, S] = f(
|
|
612
|
+
null
|
|
613
|
+
), P = H(
|
|
614
|
+
() => le(i),
|
|
615
|
+
[i]
|
|
616
|
+
), N = g || !i.trim();
|
|
554
617
|
return /* @__PURE__ */ e.jsx(
|
|
555
618
|
"form",
|
|
556
619
|
{
|
|
557
|
-
onSubmit: (
|
|
558
|
-
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
|
|
620
|
+
onSubmit: (T) => {
|
|
621
|
+
T.preventDefault();
|
|
622
|
+
const _ = ce(
|
|
623
|
+
i,
|
|
624
|
+
h === "auto" ? void 0 : h
|
|
562
625
|
);
|
|
563
|
-
|
|
626
|
+
S(_), c(_);
|
|
564
627
|
},
|
|
565
628
|
"aria-label": "Import source form",
|
|
566
|
-
children: /* @__PURE__ */ e.jsxs("fieldset", { disabled:
|
|
567
|
-
/* @__PURE__ */ e.jsx("legend", { children:
|
|
568
|
-
/* @__PURE__ */ e.jsx("p", { children:
|
|
629
|
+
children: /* @__PURE__ */ e.jsxs("fieldset", { disabled: g, children: [
|
|
630
|
+
/* @__PURE__ */ e.jsx("legend", { children: a.title }),
|
|
631
|
+
/* @__PURE__ */ e.jsx("p", { children: a.description }),
|
|
569
632
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
570
|
-
|
|
633
|
+
a.sourceLabel,
|
|
571
634
|
/* @__PURE__ */ e.jsx(
|
|
572
635
|
"textarea",
|
|
573
636
|
{
|
|
574
|
-
value:
|
|
575
|
-
onChange: (
|
|
576
|
-
placeholder:
|
|
637
|
+
value: i,
|
|
638
|
+
onChange: (T) => p(T.currentTarget.value),
|
|
639
|
+
placeholder: a.sourcePlaceholder,
|
|
577
640
|
rows: 12
|
|
578
641
|
}
|
|
579
642
|
)
|
|
580
643
|
] }),
|
|
581
644
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
582
|
-
|
|
645
|
+
a.formatLabel,
|
|
583
646
|
/* @__PURE__ */ e.jsxs(
|
|
584
647
|
"select",
|
|
585
648
|
{
|
|
586
|
-
value:
|
|
587
|
-
onChange: (
|
|
588
|
-
|
|
649
|
+
value: h,
|
|
650
|
+
onChange: (T) => w(
|
|
651
|
+
T.currentTarget.value
|
|
589
652
|
),
|
|
590
653
|
children: [
|
|
591
654
|
/* @__PURE__ */ e.jsx("option", { value: "auto", children: "Auto detect" }),
|
|
@@ -597,26 +660,26 @@ function he({
|
|
|
597
660
|
)
|
|
598
661
|
] }),
|
|
599
662
|
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
600
|
-
|
|
663
|
+
a.detectedFormatPrefix,
|
|
601
664
|
": ",
|
|
602
|
-
/* @__PURE__ */ e.jsx("strong", { children:
|
|
665
|
+
/* @__PURE__ */ e.jsx("strong", { children: P })
|
|
603
666
|
] }),
|
|
604
|
-
/* @__PURE__ */ e.jsx("button", { type: "submit", disabled:
|
|
605
|
-
|
|
606
|
-
|
|
667
|
+
/* @__PURE__ */ e.jsx("button", { type: "submit", disabled: N, children: a.convertButton }),
|
|
668
|
+
v ? "pretextError" in v ? /* @__PURE__ */ e.jsxs("p", { role: "alert", children: [
|
|
669
|
+
a.errorPrefix,
|
|
607
670
|
": ",
|
|
608
|
-
|
|
671
|
+
v.pretextError
|
|
609
672
|
] }) : /* @__PURE__ */ e.jsxs("p", { children: [
|
|
610
|
-
|
|
673
|
+
a.successPrefix,
|
|
611
674
|
": ",
|
|
612
|
-
|
|
675
|
+
v.pretextSource.length,
|
|
613
676
|
" characters of PreTeXt generated."
|
|
614
677
|
] }) : null
|
|
615
678
|
] })
|
|
616
679
|
}
|
|
617
680
|
);
|
|
618
681
|
}
|
|
619
|
-
const
|
|
682
|
+
const fe = {
|
|
620
683
|
title: "Upload Source File",
|
|
621
684
|
hint: "Supports .tex, .md, .ptx, .xml, .zip, and .tar.gz files.",
|
|
622
685
|
selectButton: "Select File",
|
|
@@ -624,43 +687,43 @@ const me = {
|
|
|
624
687
|
documentKindLabel: "Document kind",
|
|
625
688
|
splitSectionsLabel: "Split each chapter into sections"
|
|
626
689
|
};
|
|
627
|
-
function
|
|
628
|
-
labels:
|
|
629
|
-
disabled:
|
|
630
|
-
defaultDocumentKind:
|
|
631
|
-
importOptions:
|
|
632
|
-
onImport:
|
|
690
|
+
function je({
|
|
691
|
+
labels: b,
|
|
692
|
+
disabled: k = !1,
|
|
693
|
+
defaultDocumentKind: j = "auto",
|
|
694
|
+
importOptions: g,
|
|
695
|
+
onImport: c
|
|
633
696
|
}) {
|
|
634
|
-
const
|
|
635
|
-
() => ({ ...
|
|
636
|
-
[
|
|
637
|
-
),
|
|
697
|
+
const a = H(
|
|
698
|
+
() => ({ ...fe, ...b ?? {} }),
|
|
699
|
+
[b]
|
|
700
|
+
), i = re(null), [p, h] = f(!1), [w, v] = f(!1), [S, P] = f(
|
|
638
701
|
[]
|
|
639
|
-
), [
|
|
640
|
-
|
|
702
|
+
), [N, T] = f(j), [_, R] = f(!1), x = k || w, C = async (l) => {
|
|
703
|
+
v(!0);
|
|
641
704
|
try {
|
|
642
|
-
const
|
|
643
|
-
documentKind:
|
|
644
|
-
splitSections:
|
|
705
|
+
const O = await se(l, g ?? {
|
|
706
|
+
documentKind: N === "auto" ? void 0 : N,
|
|
707
|
+
splitSections: _
|
|
645
708
|
});
|
|
646
|
-
|
|
709
|
+
P(O.statusMessages), c(O);
|
|
647
710
|
} finally {
|
|
648
|
-
|
|
711
|
+
v(!1);
|
|
649
712
|
}
|
|
650
713
|
};
|
|
651
714
|
return /* @__PURE__ */ e.jsxs("section", { "aria-label": "Import upload panel", children: [
|
|
652
|
-
/* @__PURE__ */ e.jsx("h3", { children:
|
|
653
|
-
/* @__PURE__ */ e.jsx("p", { children:
|
|
654
|
-
|
|
715
|
+
/* @__PURE__ */ e.jsx("h3", { children: a.title }),
|
|
716
|
+
/* @__PURE__ */ e.jsx("p", { children: a.hint }),
|
|
717
|
+
g ? null : /* @__PURE__ */ e.jsxs("div", { className: "import-options", children: [
|
|
655
718
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
656
|
-
|
|
719
|
+
a.documentKindLabel,
|
|
657
720
|
/* @__PURE__ */ e.jsxs(
|
|
658
721
|
"select",
|
|
659
722
|
{
|
|
660
|
-
value:
|
|
661
|
-
disabled:
|
|
662
|
-
onChange: (
|
|
663
|
-
|
|
723
|
+
value: N,
|
|
724
|
+
disabled: x,
|
|
725
|
+
onChange: (l) => T(
|
|
726
|
+
l.currentTarget.value
|
|
664
727
|
),
|
|
665
728
|
children: [
|
|
666
729
|
/* @__PURE__ */ e.jsx("option", { value: "auto", children: "Auto detect" }),
|
|
@@ -675,61 +738,61 @@ function be({
|
|
|
675
738
|
"input",
|
|
676
739
|
{
|
|
677
740
|
type: "checkbox",
|
|
678
|
-
checked:
|
|
679
|
-
disabled:
|
|
680
|
-
onChange: (
|
|
741
|
+
checked: _,
|
|
742
|
+
disabled: x,
|
|
743
|
+
onChange: (l) => R(l.currentTarget.checked)
|
|
681
744
|
}
|
|
682
745
|
),
|
|
683
|
-
|
|
746
|
+
a.splitSectionsLabel
|
|
684
747
|
] })
|
|
685
748
|
] }),
|
|
686
749
|
/* @__PURE__ */ e.jsxs(
|
|
687
750
|
"div",
|
|
688
751
|
{
|
|
689
|
-
onDragOver: (
|
|
690
|
-
|
|
752
|
+
onDragOver: (l) => {
|
|
753
|
+
l.preventDefault(), x || h(!0);
|
|
691
754
|
},
|
|
692
|
-
onDragLeave: () =>
|
|
693
|
-
onDrop: (
|
|
694
|
-
if (
|
|
755
|
+
onDragLeave: () => h(!1),
|
|
756
|
+
onDrop: (l) => {
|
|
757
|
+
if (l.preventDefault(), h(!1), x)
|
|
695
758
|
return;
|
|
696
|
-
const
|
|
697
|
-
|
|
759
|
+
const E = l.dataTransfer.files?.[0];
|
|
760
|
+
E && C(E);
|
|
698
761
|
},
|
|
699
762
|
children: [
|
|
700
|
-
/* @__PURE__ */ e.jsx("p", { children:
|
|
763
|
+
/* @__PURE__ */ e.jsx("p", { children: a.dropHint }),
|
|
701
764
|
/* @__PURE__ */ e.jsx(
|
|
702
765
|
"button",
|
|
703
766
|
{
|
|
704
767
|
type: "button",
|
|
705
|
-
disabled:
|
|
706
|
-
onClick: () =>
|
|
707
|
-
children:
|
|
768
|
+
disabled: x,
|
|
769
|
+
onClick: () => i.current?.click(),
|
|
770
|
+
children: w ? "Processing..." : a.selectButton
|
|
708
771
|
}
|
|
709
772
|
),
|
|
710
773
|
/* @__PURE__ */ e.jsx(
|
|
711
774
|
"input",
|
|
712
775
|
{
|
|
713
|
-
ref:
|
|
776
|
+
ref: i,
|
|
714
777
|
type: "file",
|
|
715
778
|
hidden: !0,
|
|
716
|
-
disabled:
|
|
779
|
+
disabled: x,
|
|
717
780
|
accept: ".tex,.md,.markdown,.ptx,.xml,.zip,.gz,.tar.gz,.tgz",
|
|
718
|
-
onChange: (
|
|
719
|
-
const
|
|
720
|
-
|
|
781
|
+
onChange: (l) => {
|
|
782
|
+
const E = l.currentTarget.files?.[0];
|
|
783
|
+
E && C(E), l.currentTarget.value = "";
|
|
721
784
|
}
|
|
722
785
|
}
|
|
723
786
|
)
|
|
724
787
|
]
|
|
725
788
|
}
|
|
726
789
|
),
|
|
727
|
-
|
|
728
|
-
|
|
790
|
+
S.length > 0 ? /* @__PURE__ */ e.jsx("ul", { "aria-live": "polite", children: S.map((l, E) => /* @__PURE__ */ e.jsx("li", { children: l.message }, `${l.type}-${E}`)) }) : null,
|
|
791
|
+
p && !x ? /* @__PURE__ */ e.jsx("p", { children: "Release to upload the file." }) : null
|
|
729
792
|
] });
|
|
730
793
|
}
|
|
731
794
|
export {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
795
|
+
ve as ImportSourceForm,
|
|
796
|
+
je as ImportUploadPanel,
|
|
797
|
+
be as ImportWizard
|
|
735
798
|
};
|