@pretextbook/import 0.10.0 → 0.12.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/engine-routing-08ynicii.cjs +3 -0
- package/dist/engine-routing-Bu0zM4aw.js +179 -0
- package/dist/index.cjs +4 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +353 -308
- package/dist/lib/engine-routing.d.ts +65 -0
- package/dist/lib/paste/place-markup.d.ts +41 -0
- package/dist/react/import-wizard.d.ts +9 -3
- package/dist/react.cjs +2 -2
- package/dist/react.js +502 -495
- package/package.json +5 -5
- package/dist/import-mode-CV7gCDzF.cjs +0 -3
- package/dist/import-mode-DQ8g5P8P.js +0 -122
package/dist/react.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Y as
|
|
3
|
-
import { D as
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
var r = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
10
|
-
function d(u, x,
|
|
11
|
-
var
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
for (var
|
|
15
|
-
|
|
16
|
-
} else
|
|
17
|
-
return x =
|
|
1
|
+
import He, { useState as h, useRef as ge, useEffect as Ze, useMemo as H } from "react";
|
|
2
|
+
import { Y as Ue, a8 as Qe, a3 as et, D as tt, m as st, j as rt, g as nt, h as Ye, K as at, G as lt } from "./upload-H_OCZBBn.js";
|
|
3
|
+
import { D as ot, a as ct, b as it, d as dt, q as De, k as ut, n as Oe, r as mt, l as Le, u as xt } from "./engine-routing-Bu0zM4aw.js";
|
|
4
|
+
var be = { exports: {} }, le = {};
|
|
5
|
+
var Ie;
|
|
6
|
+
function pt() {
|
|
7
|
+
if (Ie) return le;
|
|
8
|
+
Ie = 1;
|
|
9
|
+
var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), c = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
10
|
+
function d(u, x, i) {
|
|
11
|
+
var y = null;
|
|
12
|
+
if (i !== void 0 && (y = "" + i), x.key !== void 0 && (y = "" + x.key), "key" in x) {
|
|
13
|
+
i = {};
|
|
14
|
+
for (var P in x)
|
|
15
|
+
P !== "key" && (i[P] = x[P]);
|
|
16
|
+
} else i = x;
|
|
17
|
+
return x = i.ref, {
|
|
18
18
|
$$typeof: r,
|
|
19
19
|
type: u,
|
|
20
|
-
key:
|
|
20
|
+
key: y,
|
|
21
21
|
ref: x !== void 0 ? x : null,
|
|
22
|
-
props:
|
|
22
|
+
props: i
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return le.Fragment = c, le.jsx = d, le.jsxs = d, le;
|
|
26
26
|
}
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
return
|
|
27
|
+
var oe = {};
|
|
28
|
+
var $e;
|
|
29
|
+
function ht() {
|
|
30
|
+
return $e || ($e = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
31
31
|
function r(t) {
|
|
32
32
|
if (t == null) return null;
|
|
33
33
|
if (typeof t == "function")
|
|
34
|
-
return t.$$typeof ===
|
|
34
|
+
return t.$$typeof === q ? null : t.displayName || t.name || null;
|
|
35
35
|
if (typeof t == "string") return t;
|
|
36
36
|
switch (t) {
|
|
37
|
-
case
|
|
37
|
+
case W:
|
|
38
38
|
return "Fragment";
|
|
39
|
-
case
|
|
39
|
+
case K:
|
|
40
40
|
return "Profiler";
|
|
41
|
-
case
|
|
41
|
+
case C:
|
|
42
42
|
return "StrictMode";
|
|
43
|
-
case
|
|
43
|
+
case re:
|
|
44
44
|
return "Suspense";
|
|
45
|
-
case
|
|
45
|
+
case ce:
|
|
46
46
|
return "SuspenseList";
|
|
47
|
-
case
|
|
47
|
+
case ve:
|
|
48
48
|
return "Activity";
|
|
49
49
|
}
|
|
50
50
|
if (typeof t == "object")
|
|
51
51
|
switch (typeof t.tag == "number" && console.error(
|
|
52
52
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
53
53
|
), t.$$typeof) {
|
|
54
|
-
case
|
|
54
|
+
case F:
|
|
55
55
|
return "Portal";
|
|
56
|
-
case
|
|
56
|
+
case R:
|
|
57
57
|
return t.displayName || "Context";
|
|
58
|
-
case
|
|
58
|
+
case b:
|
|
59
59
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
60
|
-
case
|
|
60
|
+
case _:
|
|
61
61
|
var l = t.render;
|
|
62
62
|
return t = t.displayName, t || (t = l.displayName || l.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
63
|
-
case
|
|
63
|
+
case ie:
|
|
64
64
|
return l = t.displayName || null, l !== null ? l : r(t.type) || "Memo";
|
|
65
|
-
case
|
|
65
|
+
case ne:
|
|
66
66
|
l = t._payload, t = t._init;
|
|
67
67
|
try {
|
|
68
68
|
return r(t(l));
|
|
@@ -71,29 +71,29 @@ function nt() {
|
|
|
71
71
|
}
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function c(t) {
|
|
75
75
|
return "" + t;
|
|
76
76
|
}
|
|
77
77
|
function d(t) {
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
c(t);
|
|
80
80
|
var l = !1;
|
|
81
81
|
} catch {
|
|
82
82
|
l = !0;
|
|
83
83
|
}
|
|
84
84
|
if (l) {
|
|
85
85
|
l = console;
|
|
86
|
-
var
|
|
87
|
-
return
|
|
86
|
+
var f = l.error, g = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
87
|
+
return f.call(
|
|
88
88
|
l,
|
|
89
89
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
90
|
-
|
|
91
|
-
),
|
|
90
|
+
g
|
|
91
|
+
), c(t);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
function u(t) {
|
|
95
|
-
if (t ===
|
|
96
|
-
if (typeof t == "object" && t !== null && t.$$typeof ===
|
|
95
|
+
if (t === W) return "<>";
|
|
96
|
+
if (typeof t == "object" && t !== null && t.$$typeof === ne)
|
|
97
97
|
return "<...>";
|
|
98
98
|
try {
|
|
99
99
|
var l = r(t);
|
|
@@ -103,46 +103,46 @@ function nt() {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
function x() {
|
|
106
|
-
var t =
|
|
106
|
+
var t = V.A;
|
|
107
107
|
return t === null ? null : t.getOwner();
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function i() {
|
|
110
110
|
return Error("react-stack-top-frame");
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
if (
|
|
112
|
+
function y(t) {
|
|
113
|
+
if (de.call(t, "key")) {
|
|
114
114
|
var l = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
115
115
|
if (l && l.isReactWarning) return !1;
|
|
116
116
|
}
|
|
117
117
|
return t.key !== void 0;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
function
|
|
121
|
-
|
|
119
|
+
function P(t, l) {
|
|
120
|
+
function f() {
|
|
121
|
+
ae || (ae = !0, console.error(
|
|
122
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)",
|
|
123
123
|
l
|
|
124
124
|
));
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
get:
|
|
126
|
+
f.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
127
|
+
get: f,
|
|
128
128
|
configurable: !0
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
function p() {
|
|
132
132
|
var t = r(this.type);
|
|
133
|
-
return
|
|
133
|
+
return me[t] || (me[t] = !0, console.error(
|
|
134
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."
|
|
135
135
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
var
|
|
137
|
+
function E(t, l, f, g, Y, D) {
|
|
138
|
+
var v = f.ref;
|
|
139
139
|
return t = {
|
|
140
|
-
$$typeof:
|
|
140
|
+
$$typeof: S,
|
|
141
141
|
type: t,
|
|
142
142
|
key: l,
|
|
143
|
-
props:
|
|
144
|
-
_owner:
|
|
145
|
-
}, (
|
|
143
|
+
props: f,
|
|
144
|
+
_owner: g
|
|
145
|
+
}, (v !== void 0 ? v : null) !== null ? Object.defineProperty(t, "ref", {
|
|
146
146
|
enumerable: !1,
|
|
147
147
|
get: p
|
|
148
148
|
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
@@ -159,125 +159,125 @@ function nt() {
|
|
|
159
159
|
configurable: !1,
|
|
160
160
|
enumerable: !1,
|
|
161
161
|
writable: !0,
|
|
162
|
-
value:
|
|
162
|
+
value: Y
|
|
163
163
|
}), Object.defineProperty(t, "_debugTask", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
166
166
|
writable: !0,
|
|
167
|
-
value:
|
|
167
|
+
value: D
|
|
168
168
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
169
169
|
}
|
|
170
|
-
function T(t, l,
|
|
171
|
-
var
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
if (
|
|
175
|
-
for (
|
|
176
|
-
|
|
177
|
-
Object.freeze && Object.freeze(
|
|
170
|
+
function T(t, l, f, g, Y, D) {
|
|
171
|
+
var v = l.children;
|
|
172
|
+
if (v !== void 0)
|
|
173
|
+
if (g)
|
|
174
|
+
if (ue(v)) {
|
|
175
|
+
for (g = 0; g < v.length; g++)
|
|
176
|
+
w(v[g]);
|
|
177
|
+
Object.freeze && Object.freeze(v);
|
|
178
178
|
} else
|
|
179
179
|
console.error(
|
|
180
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."
|
|
181
181
|
);
|
|
182
|
-
else
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
var
|
|
186
|
-
return
|
|
182
|
+
else w(v);
|
|
183
|
+
if (de.call(l, "key")) {
|
|
184
|
+
v = r(t);
|
|
185
|
+
var O = Object.keys(l).filter(function(te) {
|
|
186
|
+
return te !== "key";
|
|
187
187
|
});
|
|
188
|
-
|
|
188
|
+
g = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", ee[v + g] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
189
189
|
`A props object containing a "key" prop is being spread into JSX:
|
|
190
190
|
let props = %s;
|
|
191
191
|
<%s {...props} />
|
|
192
192
|
React keys must be passed directly to JSX without using spread:
|
|
193
193
|
let props = %s;
|
|
194
194
|
<%s key={someKey} {...props} />`,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
),
|
|
195
|
+
g,
|
|
196
|
+
v,
|
|
197
|
+
O,
|
|
198
|
+
v
|
|
199
|
+
), ee[v + g] = !0);
|
|
200
200
|
}
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
for (var
|
|
204
|
-
|
|
205
|
-
} else
|
|
206
|
-
return
|
|
207
|
-
|
|
201
|
+
if (v = null, f !== void 0 && (d(f), v = "" + f), y(l) && (d(l.key), v = "" + l.key), "key" in l) {
|
|
202
|
+
f = {};
|
|
203
|
+
for (var L in l)
|
|
204
|
+
L !== "key" && (f[L] = l[L]);
|
|
205
|
+
} else f = l;
|
|
206
|
+
return v && P(
|
|
207
|
+
f,
|
|
208
208
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
209
|
-
),
|
|
209
|
+
), E(
|
|
210
210
|
t,
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
v,
|
|
212
|
+
f,
|
|
213
213
|
x(),
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
Y,
|
|
215
|
+
D
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
218
|
+
function w(t) {
|
|
219
|
+
j(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === ne && (t._payload.status === "fulfilled" ? j(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
221
|
+
function j(t) {
|
|
222
|
+
return typeof t == "object" && t !== null && t.$$typeof === S;
|
|
223
223
|
}
|
|
224
|
-
var
|
|
224
|
+
var A = He, S = /* @__PURE__ */ Symbol.for("react.transitional.element"), F = /* @__PURE__ */ Symbol.for("react.portal"), W = /* @__PURE__ */ Symbol.for("react.fragment"), C = /* @__PURE__ */ Symbol.for("react.strict_mode"), K = /* @__PURE__ */ Symbol.for("react.profiler"), b = /* @__PURE__ */ Symbol.for("react.consumer"), R = /* @__PURE__ */ Symbol.for("react.context"), _ = /* @__PURE__ */ Symbol.for("react.forward_ref"), re = /* @__PURE__ */ Symbol.for("react.suspense"), ce = /* @__PURE__ */ Symbol.for("react.suspense_list"), ie = /* @__PURE__ */ Symbol.for("react.memo"), ne = /* @__PURE__ */ Symbol.for("react.lazy"), ve = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), V = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, de = Object.prototype.hasOwnProperty, ue = Array.isArray, U = console.createTask ? console.createTask : function() {
|
|
225
225
|
return null;
|
|
226
226
|
};
|
|
227
|
-
|
|
227
|
+
A = {
|
|
228
228
|
react_stack_bottom_frame: function(t) {
|
|
229
229
|
return t();
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
|
-
var
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
)(),
|
|
236
|
-
|
|
237
|
-
var
|
|
232
|
+
var ae, me = {}, Z = A.react_stack_bottom_frame.bind(
|
|
233
|
+
A,
|
|
234
|
+
i
|
|
235
|
+
)(), Q = U(u(i)), ee = {};
|
|
236
|
+
oe.Fragment = W, oe.jsx = function(t, l, f) {
|
|
237
|
+
var g = 1e4 > V.recentlyCreatedOwnerStacks++;
|
|
238
238
|
return T(
|
|
239
239
|
t,
|
|
240
240
|
l,
|
|
241
|
-
|
|
241
|
+
f,
|
|
242
242
|
!1,
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
g ? Error("react-stack-top-frame") : Z,
|
|
244
|
+
g ? U(u(t)) : Q
|
|
245
245
|
);
|
|
246
|
-
},
|
|
247
|
-
var
|
|
246
|
+
}, oe.jsxs = function(t, l, f) {
|
|
247
|
+
var g = 1e4 > V.recentlyCreatedOwnerStacks++;
|
|
248
248
|
return T(
|
|
249
249
|
t,
|
|
250
250
|
l,
|
|
251
|
-
|
|
251
|
+
f,
|
|
252
252
|
!0,
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
g ? Error("react-stack-top-frame") : Z,
|
|
254
|
+
g ? U(u(t)) : Q
|
|
255
255
|
);
|
|
256
256
|
};
|
|
257
|
-
})()),
|
|
257
|
+
})()), oe;
|
|
258
258
|
}
|
|
259
|
-
var
|
|
260
|
-
function
|
|
261
|
-
return
|
|
259
|
+
var Me;
|
|
260
|
+
function ft() {
|
|
261
|
+
return Me || (Me = 1, process.env.NODE_ENV === "production" ? be.exports = pt() : be.exports = ht()), be.exports;
|
|
262
262
|
}
|
|
263
|
-
var e =
|
|
264
|
-
function
|
|
265
|
-
const [r,
|
|
266
|
-
return
|
|
263
|
+
var e = ft();
|
|
264
|
+
function bt() {
|
|
265
|
+
const [r, c] = h(0), d = ge(Date.now());
|
|
266
|
+
return Ze(() => {
|
|
267
267
|
const u = setInterval(() => {
|
|
268
|
-
|
|
268
|
+
c(Math.floor((Date.now() - d.current) / 1e3));
|
|
269
269
|
}, 1e3);
|
|
270
270
|
return () => clearInterval(u);
|
|
271
271
|
}, []), r;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function gt(r) {
|
|
274
274
|
return `${Math.floor(r / 60)}:${String(r % 60).padStart(2, "0")}`;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function vt({
|
|
277
277
|
message: r = "Processing your file…",
|
|
278
|
-
onCancel:
|
|
278
|
+
onCancel: c
|
|
279
279
|
}) {
|
|
280
|
-
const d =
|
|
280
|
+
const d = bt();
|
|
281
281
|
return /* @__PURE__ */ e.jsxs(
|
|
282
282
|
"div",
|
|
283
283
|
{
|
|
@@ -287,13 +287,13 @@ function ct({
|
|
|
287
287
|
children: [
|
|
288
288
|
/* @__PURE__ */ e.jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-blue-700 border-t-transparent" }),
|
|
289
289
|
/* @__PURE__ */ e.jsx("p", { className: "text-sm", children: r }),
|
|
290
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-xs tabular-nums text-slate-500", children:
|
|
290
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-xs tabular-nums text-slate-500", children: gt(d) }),
|
|
291
291
|
d >= 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
|
-
|
|
292
|
+
c ? /* @__PURE__ */ e.jsx(
|
|
293
293
|
"button",
|
|
294
294
|
{
|
|
295
295
|
type: "button",
|
|
296
|
-
onClick:
|
|
296
|
+
onClick: c,
|
|
297
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
298
|
children: "Cancel"
|
|
299
299
|
}
|
|
@@ -302,37 +302,27 @@ function ct({
|
|
|
302
302
|
}
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
".tex",
|
|
307
|
-
".md",
|
|
308
|
-
".markdown",
|
|
309
|
-
".ptx",
|
|
310
|
-
".xml",
|
|
311
|
-
".zip",
|
|
312
|
-
".gz",
|
|
313
|
-
".tar.gz",
|
|
314
|
-
".tgz"
|
|
315
|
-
], it = {
|
|
305
|
+
const jt = {
|
|
316
306
|
id: "builtin",
|
|
317
307
|
label: "Built-in converter",
|
|
318
|
-
description: "
|
|
319
|
-
acceptExtensions:
|
|
320
|
-
convertFile:
|
|
308
|
+
description: "Converts LaTeX, Markdown, and PreTeXt without any other tools.",
|
|
309
|
+
acceptExtensions: ot,
|
|
310
|
+
convertFile: Ue,
|
|
321
311
|
prepare: async (r) => {
|
|
322
|
-
const { files:
|
|
312
|
+
const { files: c, assets: d } = await nt(r);
|
|
323
313
|
return {
|
|
324
314
|
fileName: r.name,
|
|
325
|
-
files:
|
|
315
|
+
files: c,
|
|
326
316
|
assets: d,
|
|
327
|
-
analysis:
|
|
317
|
+
analysis: Ye(c)
|
|
328
318
|
};
|
|
329
319
|
},
|
|
330
|
-
convertPrepared: (r,
|
|
331
|
-
...
|
|
320
|
+
convertPrepared: (r, c) => rt(r.files, {
|
|
321
|
+
...c,
|
|
332
322
|
assets: r.assets
|
|
333
323
|
})
|
|
334
324
|
};
|
|
335
|
-
function
|
|
325
|
+
function Ee() {
|
|
336
326
|
return new Promise((r) => {
|
|
337
327
|
if (typeof requestAnimationFrame != "function") {
|
|
338
328
|
setTimeout(r, 0);
|
|
@@ -341,161 +331,186 @@ function Ne() {
|
|
|
341
331
|
requestAnimationFrame(() => setTimeout(r, 0));
|
|
342
332
|
});
|
|
343
333
|
}
|
|
344
|
-
const
|
|
334
|
+
const Xe = {
|
|
345
335
|
pretext: "PreTeXt",
|
|
346
336
|
latex: "LaTeX",
|
|
347
337
|
markdown: "Markdown"
|
|
348
338
|
};
|
|
349
|
-
function
|
|
350
|
-
const
|
|
351
|
-
return r.title ? `${r.title} — ${
|
|
339
|
+
function Nt(r) {
|
|
340
|
+
const c = r.reason === "manifest-target" ? `project.ptx target “${r.targetName}”` : r.reason === "latex-root" ? "LaTeX document" : r.reason === "pretext-root" ? "PreTeXt document" : r.reason === "markdown-root" ? "Markdown document" : "possible document";
|
|
341
|
+
return r.title ? `${r.title} — ${c}` : c;
|
|
352
342
|
}
|
|
353
|
-
function
|
|
343
|
+
function yt(r) {
|
|
354
344
|
return r.candidates.filter(
|
|
355
345
|
(d) => d.reason === "manifest-target"
|
|
356
346
|
).length > 1 ? !0 : r.manifest && r.primary?.reason === "manifest-target" ? !1 : r.formats.length > 1 || r.candidates.length > 1 || r.extraRoots.length > 0;
|
|
357
347
|
}
|
|
358
|
-
function
|
|
348
|
+
function Rt({
|
|
359
349
|
onConfirm: r,
|
|
360
|
-
onCancel:
|
|
350
|
+
onCancel: c,
|
|
361
351
|
importOptions: d,
|
|
362
352
|
defaultDocumentKind: u = "auto",
|
|
363
|
-
defaultImportMode: x =
|
|
364
|
-
lockImportMode:
|
|
365
|
-
onImportModeChange:
|
|
366
|
-
engines:
|
|
353
|
+
defaultImportMode: x = ct,
|
|
354
|
+
lockImportMode: i = !1,
|
|
355
|
+
onImportModeChange: y,
|
|
356
|
+
engines: P,
|
|
367
357
|
insertTarget: p
|
|
368
358
|
}) {
|
|
369
|
-
const
|
|
359
|
+
const E = P && P.length > 0 ? P : [jt], T = ge(null), [w, j] = h({ name: "upload" }), [A, S] = h(!1), [F, W] = h(u), [C, K] = h(null), [b, R] = h(null), [_, re] = h([]), [ce, ie] = h(/* @__PURE__ */ new Set()), [ne, ve] = h(E[0].id), [q, V] = h(null), [de, ue] = h(x), [U, ae] = h(!1), [me, Z] = h(/* @__PURE__ */ new Set()), [Q, ee] = h(null), [t, l] = h(
|
|
370
360
|
"auto"
|
|
371
|
-
), [
|
|
372
|
-
() =>
|
|
373
|
-
splitLevel:
|
|
374
|
-
targetTag:
|
|
375
|
-
selection:
|
|
376
|
-
}) :
|
|
377
|
-
[
|
|
378
|
-
),
|
|
379
|
-
() =>
|
|
380
|
-
[
|
|
381
|
-
),
|
|
361
|
+
), [f, g] = h(null), [Y, D] = h({}), [v, O] = h(!1), L = ge(!1), te = E.find((n) => n.id === ne) ?? E[0], Te = it(E), B = q ? dt(E, q.name) : void 0, Se = B ? te.id === B.id : !1, xe = B ? Se ? De(E, q.name) ?? null : B : null, G = w.name === "review" ? w.result : null, pe = H(
|
|
362
|
+
() => G && (C !== null || b !== null || _.length > 0) ? Qe(G, {
|
|
363
|
+
splitLevel: C ?? void 0,
|
|
364
|
+
targetTag: b ?? void 0,
|
|
365
|
+
selection: _
|
|
366
|
+
}) : G,
|
|
367
|
+
[G, C, b, _]
|
|
368
|
+
), je = H(
|
|
369
|
+
() => G ? et(G.pretextSource) : [],
|
|
370
|
+
[G]
|
|
371
|
+
), z = H(
|
|
382
372
|
() => new Map(
|
|
383
|
-
|
|
373
|
+
pe ? ut(pe).map((n) => [n.path, n]) : []
|
|
384
374
|
),
|
|
385
|
-
[
|
|
386
|
-
),
|
|
375
|
+
[pe]
|
|
376
|
+
), Pe = H(
|
|
387
377
|
() => p ? {
|
|
388
378
|
kind: "insert",
|
|
389
|
-
targetTag:
|
|
379
|
+
targetTag: b ?? p.defaultTargetTag,
|
|
390
380
|
takenIds: new Set(p.takenIds),
|
|
391
381
|
hrefBase: p.hrefBase
|
|
392
382
|
} : void 0,
|
|
393
|
-
[p,
|
|
394
|
-
),
|
|
383
|
+
[p, b]
|
|
384
|
+
), Ne = () => ({
|
|
395
385
|
...d ?? {
|
|
396
|
-
documentKind:
|
|
386
|
+
documentKind: F === "auto" ? void 0 : F
|
|
397
387
|
},
|
|
398
|
-
...
|
|
388
|
+
...Pe ? { destination: Pe } : {},
|
|
399
389
|
...p?.externalDir ? { externalDir: p.externalDir } : {}
|
|
400
|
-
}),
|
|
401
|
-
sourceFormat:
|
|
402
|
-
mainFile:
|
|
403
|
-
}),
|
|
404
|
-
|
|
390
|
+
}), Ce = (n) => Ye(n.files, {
|
|
391
|
+
sourceFormat: t === "auto" ? void 0 : t,
|
|
392
|
+
mainFile: f ?? void 0
|
|
393
|
+
}), We = (n) => {
|
|
394
|
+
L.current = !0, te.cancel?.(), j(
|
|
405
395
|
n ? { name: "sources", prepared: n } : { name: "upload" }
|
|
406
396
|
);
|
|
407
|
-
},
|
|
408
|
-
|
|
397
|
+
}, Ke = async (n) => {
|
|
398
|
+
L.current = !1, j({ name: "processing" }), await Ee();
|
|
409
399
|
try {
|
|
410
|
-
const a =
|
|
411
|
-
path:
|
|
412
|
-
include:
|
|
413
|
-
level:
|
|
414
|
-
})),
|
|
415
|
-
...
|
|
416
|
-
sourceFormat:
|
|
417
|
-
mainFile:
|
|
400
|
+
const a = Ce(n).extraRoots.map((o) => ({
|
|
401
|
+
path: o.path,
|
|
402
|
+
include: Y[o.path]?.include ?? !0,
|
|
403
|
+
level: Y[o.path]?.level
|
|
404
|
+
})), N = await te.convertPrepared(n, {
|
|
405
|
+
...Ne(),
|
|
406
|
+
sourceFormat: t === "auto" ? void 0 : t,
|
|
407
|
+
mainFile: f ?? void 0,
|
|
418
408
|
attachRoots: a
|
|
419
409
|
});
|
|
420
|
-
"pretextError" in
|
|
421
|
-
} catch (
|
|
422
|
-
if (
|
|
410
|
+
"pretextError" in N ? j({ name: "error", message: N.pretextError }) : j({ name: "review", result: N });
|
|
411
|
+
} catch (m) {
|
|
412
|
+
if (L.current)
|
|
423
413
|
return;
|
|
424
|
-
|
|
414
|
+
j({
|
|
425
415
|
name: "error",
|
|
426
|
-
message:
|
|
416
|
+
message: m instanceof Error ? m.message : "An unexpected error occurred."
|
|
427
417
|
});
|
|
428
418
|
}
|
|
429
|
-
},
|
|
430
|
-
|
|
419
|
+
}, ye = async (n, m) => {
|
|
420
|
+
const a = m ?? De(E, n.name);
|
|
421
|
+
if (!a) {
|
|
422
|
+
V(n), j({
|
|
423
|
+
name: "error",
|
|
424
|
+
message: xt(n.name, E)
|
|
425
|
+
});
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
V(n), ve(a.id), Re(), L.current = !1, j({ name: "processing" }), await Ee();
|
|
431
429
|
try {
|
|
432
|
-
if (
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
435
|
-
|
|
430
|
+
if (a.prepare && a.convertPrepared) {
|
|
431
|
+
const o = await a.prepare(n);
|
|
432
|
+
if (ee(o), l("auto"), g(null), D({}), yt(o.analysis)) {
|
|
433
|
+
j({ name: "sources", prepared: o });
|
|
436
434
|
return;
|
|
437
435
|
}
|
|
438
|
-
await
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
);
|
|
443
|
-
v(
|
|
444
|
-
"pretextError" in k ? { name: "error", message: k.pretextError } : { name: "review", result: k }
|
|
436
|
+
await Ee();
|
|
437
|
+
const I = await a.convertPrepared(o, Ne());
|
|
438
|
+
j(
|
|
439
|
+
"pretextError" in I ? { name: "error", message: I.pretextError } : { name: "review", result: I }
|
|
445
440
|
);
|
|
446
441
|
return;
|
|
447
442
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
443
|
+
ee(null);
|
|
444
|
+
const N = await a.convertFile(n, Ne());
|
|
445
|
+
"pretextError" in N ? j({ name: "error", message: N.pretextError }) : j({ name: "review", result: N });
|
|
446
|
+
} catch (N) {
|
|
447
|
+
if (L.current)
|
|
452
448
|
return;
|
|
453
|
-
|
|
449
|
+
j({
|
|
454
450
|
name: "error",
|
|
455
|
-
message:
|
|
451
|
+
message: N instanceof Error ? N.message : "An unexpected error occurred."
|
|
456
452
|
});
|
|
457
453
|
}
|
|
458
|
-
},
|
|
459
|
-
|
|
454
|
+
}, Re = () => {
|
|
455
|
+
ue(x), ae(!1), Z(/* @__PURE__ */ new Set()), ie(/* @__PURE__ */ new Set()), K(null), R(null), re([]);
|
|
456
|
+
}, we = () => {
|
|
457
|
+
j({ name: "upload" }), Re(), ee(null), V(null);
|
|
458
|
+
}, _e = () => {
|
|
459
|
+
q && xe && ye(q, xe);
|
|
460
460
|
};
|
|
461
|
-
function
|
|
462
|
-
return [...n].sort((a,
|
|
461
|
+
function Ae(n, m) {
|
|
462
|
+
return [...n].sort((a, N) => a === m ? -1 : N === m ? 1 : a.localeCompare(N));
|
|
463
463
|
}
|
|
464
|
-
function
|
|
465
|
-
const a =
|
|
466
|
-
|
|
464
|
+
function Fe(n, m) {
|
|
465
|
+
const a = Le(n, m), N = m === "converted" ? n.projectLayout.mainSourcePath : n.sourcePath, o = Ae(Object.keys(a), N)[0];
|
|
466
|
+
Z(o ? /* @__PURE__ */ new Set([o]) : /* @__PURE__ */ new Set());
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
|
|
470
|
-
const a = new Set(
|
|
468
|
+
function qe(n) {
|
|
469
|
+
Z((m) => {
|
|
470
|
+
const a = new Set(m);
|
|
471
471
|
return a.has(n) ? a.delete(n) : a.add(n), a;
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
|
-
if (
|
|
474
|
+
if (w.name === "processing")
|
|
475
475
|
return /* @__PURE__ */ e.jsx(
|
|
476
|
-
|
|
476
|
+
vt,
|
|
477
477
|
{
|
|
478
|
-
onCancel:
|
|
478
|
+
onCancel: te.cancel ? () => We(Q) : void 0
|
|
479
479
|
}
|
|
480
480
|
);
|
|
481
|
-
if (
|
|
481
|
+
if (w.name === "error")
|
|
482
482
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
483
483
|
/* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-800", children: [
|
|
484
484
|
/* @__PURE__ */ e.jsx("p", { className: "font-semibold", children: "Import failed" }),
|
|
485
|
-
/* @__PURE__ */ e.jsx("p", { className: "mt-1", children:
|
|
485
|
+
/* @__PURE__ */ e.jsx("p", { className: "mt-1", children: w.message })
|
|
486
486
|
] }),
|
|
487
|
-
/* @__PURE__ */ e.
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
487
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
488
|
+
xe ? /* @__PURE__ */ e.jsxs(
|
|
489
|
+
"button",
|
|
490
|
+
{
|
|
491
|
+
type: "button",
|
|
492
|
+
onClick: _e,
|
|
493
|
+
className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
|
|
494
|
+
children: [
|
|
495
|
+
"Try ",
|
|
496
|
+
xe.label,
|
|
497
|
+
" Instead"
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
) : null,
|
|
501
|
+
/* @__PURE__ */ e.jsx(
|
|
502
|
+
"button",
|
|
503
|
+
{
|
|
504
|
+
type: "button",
|
|
505
|
+
onClick: we,
|
|
506
|
+
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
507
|
+
children: "Try Another File"
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
] })
|
|
496
511
|
] });
|
|
497
|
-
if (
|
|
498
|
-
const n =
|
|
512
|
+
if (w.name === "sources") {
|
|
513
|
+
const n = w.prepared, m = Ce(n), a = m.manifest, N = m.primary?.path ?? "";
|
|
499
514
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
500
515
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
501
516
|
/* @__PURE__ */ e.jsx("h3", { className: "text-sm font-semibold text-slate-700", children: "Choose what to import" }),
|
|
@@ -513,7 +528,7 @@ function jt({
|
|
|
513
528
|
/* @__PURE__ */ e.jsxs("p", { className: "mt-1 text-blue-800", children: [
|
|
514
529
|
"Its publication file, assets, and directory layout will be kept as they are. Targets:",
|
|
515
530
|
" ",
|
|
516
|
-
a.targets.map((
|
|
531
|
+
a.targets.map((o) => o.name).join(", "),
|
|
517
532
|
"."
|
|
518
533
|
] })
|
|
519
534
|
] }) : null,
|
|
@@ -522,24 +537,24 @@ function jt({
|
|
|
522
537
|
/* @__PURE__ */ e.jsxs(
|
|
523
538
|
"select",
|
|
524
539
|
{
|
|
525
|
-
value:
|
|
526
|
-
onChange: (
|
|
527
|
-
|
|
540
|
+
value: t,
|
|
541
|
+
onChange: (o) => {
|
|
542
|
+
l(o.currentTarget.value), g(null), D({});
|
|
528
543
|
},
|
|
529
544
|
className: "rounded border border-slate-300 px-2 py-1 text-sm",
|
|
530
545
|
children: [
|
|
531
546
|
/* @__PURE__ */ e.jsxs("option", { value: "auto", children: [
|
|
532
547
|
"Auto detect",
|
|
533
|
-
|
|
548
|
+
m.primary ? ` (${Xe[m.primary.format]})` : ""
|
|
534
549
|
] }),
|
|
535
|
-
|
|
550
|
+
m.formats.map((o) => /* @__PURE__ */ e.jsx("option", { value: o, children: Xe[o] }, o))
|
|
536
551
|
]
|
|
537
552
|
}
|
|
538
553
|
)
|
|
539
554
|
] }) }),
|
|
540
|
-
|
|
555
|
+
m.candidates.length > 1 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
541
556
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Main document" }),
|
|
542
|
-
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-2", children:
|
|
557
|
+
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-2", children: m.candidates.map((o) => /* @__PURE__ */ e.jsxs(
|
|
543
558
|
"label",
|
|
544
559
|
{
|
|
545
560
|
className: "flex cursor-pointer items-start gap-3 text-sm",
|
|
@@ -549,28 +564,28 @@ function jt({
|
|
|
549
564
|
{
|
|
550
565
|
type: "radio",
|
|
551
566
|
name: "main-file",
|
|
552
|
-
value:
|
|
553
|
-
checked:
|
|
567
|
+
value: o.path,
|
|
568
|
+
checked: N === o.path,
|
|
554
569
|
onChange: () => {
|
|
555
|
-
|
|
570
|
+
g(o.path), D({});
|
|
556
571
|
},
|
|
557
572
|
className: "mt-0.5"
|
|
558
573
|
}
|
|
559
574
|
),
|
|
560
575
|
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
561
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs text-slate-900", children:
|
|
562
|
-
/* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children:
|
|
576
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs text-slate-900", children: o.path }),
|
|
577
|
+
/* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: Nt(o) })
|
|
563
578
|
] })
|
|
564
579
|
]
|
|
565
580
|
},
|
|
566
|
-
|
|
581
|
+
o.path
|
|
567
582
|
)) })
|
|
568
583
|
] }) : null,
|
|
569
|
-
|
|
584
|
+
m.extraRoots.length > 0 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
570
585
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Other documents" }),
|
|
571
586
|
/* @__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." }),
|
|
572
|
-
/* @__PURE__ */ e.jsx("div", { className: "mt-3 flex flex-col gap-2", children:
|
|
573
|
-
const
|
|
587
|
+
/* @__PURE__ */ e.jsx("div", { className: "mt-3 flex flex-col gap-2", children: m.extraRoots.map((o) => {
|
|
588
|
+
const I = Y[o.path], $ = I?.include ?? !0;
|
|
574
589
|
return /* @__PURE__ */ e.jsxs(
|
|
575
590
|
"div",
|
|
576
591
|
{
|
|
@@ -581,20 +596,20 @@ function jt({
|
|
|
581
596
|
"input",
|
|
582
597
|
{
|
|
583
598
|
type: "checkbox",
|
|
584
|
-
checked:
|
|
585
|
-
onChange: (
|
|
586
|
-
...
|
|
587
|
-
[
|
|
588
|
-
...
|
|
589
|
-
include:
|
|
599
|
+
checked: $,
|
|
600
|
+
onChange: (J) => D((M) => ({
|
|
601
|
+
...M,
|
|
602
|
+
[o.path]: {
|
|
603
|
+
...M[o.path],
|
|
604
|
+
include: J.currentTarget.checked
|
|
590
605
|
}
|
|
591
606
|
}))
|
|
592
607
|
}
|
|
593
608
|
),
|
|
594
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs text-slate-900", children:
|
|
595
|
-
|
|
609
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs text-slate-900", children: o.path }),
|
|
610
|
+
o.title ? /* @__PURE__ */ e.jsxs("span", { className: "text-slate-500", children: [
|
|
596
611
|
"— ",
|
|
597
|
-
|
|
612
|
+
o.title
|
|
598
613
|
] }) : null
|
|
599
614
|
] }),
|
|
600
615
|
/* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2 text-slate-700", children: [
|
|
@@ -602,13 +617,13 @@ function jt({
|
|
|
602
617
|
/* @__PURE__ */ e.jsxs(
|
|
603
618
|
"select",
|
|
604
619
|
{
|
|
605
|
-
value:
|
|
606
|
-
disabled:
|
|
607
|
-
onChange: (
|
|
608
|
-
...
|
|
609
|
-
[
|
|
610
|
-
include:
|
|
611
|
-
level:
|
|
620
|
+
value: I?.level ?? "auto",
|
|
621
|
+
disabled: !$,
|
|
622
|
+
onChange: (J) => D((M) => ({
|
|
623
|
+
...M,
|
|
624
|
+
[o.path]: {
|
|
625
|
+
include: M[o.path]?.include ?? !0,
|
|
626
|
+
level: J.currentTarget.value === "auto" ? void 0 : J.currentTarget.value
|
|
612
627
|
}
|
|
613
628
|
})),
|
|
614
629
|
className: "rounded border border-slate-300 px-2 py-1 text-sm disabled:opacity-50",
|
|
@@ -622,7 +637,7 @@ function jt({
|
|
|
622
637
|
] })
|
|
623
638
|
]
|
|
624
639
|
},
|
|
625
|
-
|
|
640
|
+
o.path
|
|
626
641
|
);
|
|
627
642
|
}) })
|
|
628
643
|
] }) : null,
|
|
@@ -631,7 +646,7 @@ function jt({
|
|
|
631
646
|
"button",
|
|
632
647
|
{
|
|
633
648
|
type: "button",
|
|
634
|
-
onClick:
|
|
649
|
+
onClick: we,
|
|
635
650
|
className: "px-4 py-2 text-sm text-slate-600 hover:text-slate-900",
|
|
636
651
|
children: "Start Over"
|
|
637
652
|
}
|
|
@@ -640,7 +655,7 @@ function jt({
|
|
|
640
655
|
"button",
|
|
641
656
|
{
|
|
642
657
|
type: "button",
|
|
643
|
-
onClick: () =>
|
|
658
|
+
onClick: () => Ke(n),
|
|
644
659
|
className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
|
|
645
660
|
children: "Continue"
|
|
646
661
|
}
|
|
@@ -648,18 +663,18 @@ function jt({
|
|
|
648
663
|
] })
|
|
649
664
|
] });
|
|
650
665
|
}
|
|
651
|
-
if (
|
|
666
|
+
if (w.name === "review") {
|
|
652
667
|
let n = function(s) {
|
|
653
|
-
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
return
|
|
668
|
+
ue(s), y?.(s), U && Fe(a, s);
|
|
669
|
+
}, m = function(s) {
|
|
670
|
+
ie((k) => {
|
|
671
|
+
const se = new Set(k);
|
|
672
|
+
return se.has(s) ? se.delete(s) : se.add(s), se;
|
|
658
673
|
});
|
|
659
674
|
};
|
|
660
|
-
const a =
|
|
661
|
-
Object.keys(
|
|
662
|
-
|
|
675
|
+
const a = pe ?? w.result, N = a.splitLevel, o = _.length > 0, I = Oe(a) && !o, $ = I ? mt(a, de) : "converted", J = a.detectedSourceFormat === "markdown" ? "Markdown" : "LaTeX", M = a.warnings.length, Ve = Object.keys(a.outputFiles).length, X = a.insert, he = a.destination.kind === "insert" ? a.destination.targetTag : void 0, Ge = p?.targetTags ?? [...tt], ke = Le(a, $), Je = $ === "converted" ? a.projectLayout.mainSourcePath : a.sourcePath, fe = Ae(
|
|
676
|
+
Object.keys(ke),
|
|
677
|
+
Je
|
|
663
678
|
);
|
|
664
679
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
665
680
|
/* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-4", children: [
|
|
@@ -672,7 +687,7 @@ function jt({
|
|
|
672
687
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Document kind" }),
|
|
673
688
|
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: a.documentKind }),
|
|
674
689
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Output files" }),
|
|
675
|
-
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children:
|
|
690
|
+
/* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: Ve }),
|
|
676
691
|
p ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
677
692
|
/* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Destination" }),
|
|
678
693
|
/* @__PURE__ */ e.jsxs("dd", { className: "font-medium text-slate-900", children: [
|
|
@@ -690,21 +705,40 @@ function jt({
|
|
|
690
705
|
] }) : null
|
|
691
706
|
] })
|
|
692
707
|
] }),
|
|
693
|
-
|
|
708
|
+
B ? /* @__PURE__ */ e.jsxs("label", { className: "flex cursor-pointer items-start gap-3 rounded-lg border border-slate-200 p-4 text-sm", children: [
|
|
709
|
+
/* @__PURE__ */ e.jsx(
|
|
710
|
+
"input",
|
|
711
|
+
{
|
|
712
|
+
type: "checkbox",
|
|
713
|
+
checked: Se,
|
|
714
|
+
onChange: _e,
|
|
715
|
+
className: "mt-0.5"
|
|
716
|
+
}
|
|
717
|
+
),
|
|
718
|
+
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
719
|
+
/* @__PURE__ */ e.jsxs("span", { className: "font-medium text-slate-900", children: [
|
|
720
|
+
"Convert with ",
|
|
721
|
+
B.label,
|
|
722
|
+
" instead"
|
|
723
|
+
] }),
|
|
724
|
+
/* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: B.description ?? `Runs ${a.sourceName} through ${B.label} and rebuilds this preview.` })
|
|
725
|
+
] })
|
|
726
|
+
] }) : null,
|
|
727
|
+
M > 0 ? /* @__PURE__ */ e.jsxs("details", { className: "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm", children: [
|
|
694
728
|
/* @__PURE__ */ e.jsxs("summary", { className: "cursor-pointer font-semibold text-amber-800", children: [
|
|
695
|
-
|
|
729
|
+
M,
|
|
696
730
|
" conversion",
|
|
697
731
|
" ",
|
|
698
|
-
|
|
732
|
+
M === 1 ? "warning" : "warnings"
|
|
699
733
|
] }),
|
|
700
|
-
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children: a.warnings.map((s,
|
|
734
|
+
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children: a.warnings.map((s, k) => /* @__PURE__ */ e.jsxs("li", { children: [
|
|
701
735
|
/* @__PURE__ */ e.jsx("code", { className: "rounded bg-amber-100 px-1 py-0.5 text-xs", children: s.macro }),
|
|
702
736
|
" — ",
|
|
703
737
|
s.action === "replace" || s.action === "rewrite" ? `replaced with \`${s.replacement}\`` : s.message ?? s.action,
|
|
704
738
|
s.occurrences > 1 ? ` (×${s.occurrences})` : null
|
|
705
|
-
] },
|
|
739
|
+
] }, k)) })
|
|
706
740
|
] }) : /* @__PURE__ */ e.jsx("p", { className: "text-sm text-green-700", children: "No conversion warnings." }),
|
|
707
|
-
|
|
741
|
+
I && !i ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
708
742
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Import mode" }),
|
|
709
743
|
/* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-col gap-3", children: [
|
|
710
744
|
/* @__PURE__ */ e.jsxs("label", { className: "flex cursor-pointer items-start gap-3 text-sm", children: [
|
|
@@ -714,7 +748,7 @@ function jt({
|
|
|
714
748
|
type: "radio",
|
|
715
749
|
name: "import-mode",
|
|
716
750
|
value: "converted",
|
|
717
|
-
checked:
|
|
751
|
+
checked: $ === "converted",
|
|
718
752
|
onChange: () => n("converted"),
|
|
719
753
|
className: "mt-0.5"
|
|
720
754
|
}
|
|
@@ -731,7 +765,7 @@ function jt({
|
|
|
731
765
|
type: "radio",
|
|
732
766
|
name: "import-mode",
|
|
733
767
|
value: "native",
|
|
734
|
-
checked:
|
|
768
|
+
checked: $ === "native",
|
|
735
769
|
onChange: () => n("native"),
|
|
736
770
|
className: "mt-0.5"
|
|
737
771
|
}
|
|
@@ -739,58 +773,58 @@ function jt({
|
|
|
739
773
|
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
740
774
|
/* @__PURE__ */ e.jsxs("span", { className: "font-medium text-slate-900", children: [
|
|
741
775
|
"Keep as ",
|
|
742
|
-
|
|
776
|
+
J
|
|
743
777
|
] }),
|
|
744
778
|
/* @__PURE__ */ e.jsxs("span", { className: "block text-slate-500", children: [
|
|
745
779
|
"Preserve the original ",
|
|
746
|
-
|
|
780
|
+
J,
|
|
747
781
|
" source. The conversion will not be applied."
|
|
748
782
|
] })
|
|
749
783
|
] })
|
|
750
784
|
] })
|
|
751
785
|
] })
|
|
752
786
|
] }) : null,
|
|
753
|
-
|
|
787
|
+
je.length > 1 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
754
788
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Divisions to import" }),
|
|
755
789
|
/* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-2 text-sm", children: [
|
|
756
790
|
/* @__PURE__ */ e.jsx(
|
|
757
791
|
"button",
|
|
758
792
|
{
|
|
759
793
|
type: "button",
|
|
760
|
-
onClick: () =>
|
|
794
|
+
onClick: () => re([]),
|
|
761
795
|
className: "rounded border border-slate-300 px-3 py-1 text-slate-700 hover:bg-slate-50",
|
|
762
796
|
children: "Everything"
|
|
763
797
|
}
|
|
764
798
|
),
|
|
765
|
-
/* @__PURE__ */ e.jsx("span", { className: "text-slate-500", children:
|
|
799
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-slate-500", children: _.length === 0 ? "The whole document" : `${_.length} of ${Be(je)} divisions` })
|
|
766
800
|
] }),
|
|
767
801
|
/* @__PURE__ */ e.jsx("div", { className: "mt-3 max-h-56 overflow-auto", children: /* @__PURE__ */ e.jsx(
|
|
768
|
-
|
|
802
|
+
ze,
|
|
769
803
|
{
|
|
770
|
-
items:
|
|
771
|
-
selection:
|
|
772
|
-
onToggle: (s) =>
|
|
773
|
-
(
|
|
804
|
+
items: je,
|
|
805
|
+
selection: _,
|
|
806
|
+
onToggle: (s) => re(
|
|
807
|
+
(k) => k.includes(s) ? k.filter((se) => se !== s) : [...k, s].sort(wt)
|
|
774
808
|
)
|
|
775
809
|
}
|
|
776
810
|
) }),
|
|
777
|
-
|
|
811
|
+
_.length > 0 ? /* @__PURE__ */ e.jsxs("p", { className: "mt-2 text-sm text-slate-500", children: [
|
|
778
812
|
"A selected division is imported whole, with everything inside it. Divisions above one you selected are kept as structure.",
|
|
779
|
-
|
|
813
|
+
Oe(w.result) ? " Selecting divisions imports the converted PreTeXt; keeping the original source imports the document whole." : ""
|
|
780
814
|
] }) : null
|
|
781
815
|
] }) : null,
|
|
782
|
-
|
|
816
|
+
X && p ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
783
817
|
/* @__PURE__ */ e.jsxs("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: [
|
|
784
818
|
"Attach to ",
|
|
785
819
|
p.documentLabel
|
|
786
820
|
] }),
|
|
787
|
-
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-wrap items-center gap-2", children:
|
|
821
|
+
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: Ge.map((s) => /* @__PURE__ */ e.jsxs(
|
|
788
822
|
"button",
|
|
789
823
|
{
|
|
790
824
|
type: "button",
|
|
791
|
-
onClick: () =>
|
|
792
|
-
"aria-pressed":
|
|
793
|
-
className:
|
|
825
|
+
onClick: () => R(s),
|
|
826
|
+
"aria-pressed": he === s,
|
|
827
|
+
className: he === s ? "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",
|
|
794
828
|
children: [
|
|
795
829
|
"<",
|
|
796
830
|
s,
|
|
@@ -800,55 +834,55 @@ function jt({
|
|
|
800
834
|
s
|
|
801
835
|
)) }),
|
|
802
836
|
/* @__PURE__ */ e.jsxs("p", { className: "mt-3 text-sm text-slate-600", children: [
|
|
803
|
-
|
|
804
|
-
|
|
837
|
+
X.includes.length === 1 ? `One <${he}> is added to ${p.documentLabel}, ` : `${X.includes.length} <${he}> divisions are added to ${p.documentLabel}, `,
|
|
838
|
+
X.includes.length === 1 ? "included from a new file beside it." : "each included from a new file beside it."
|
|
805
839
|
] }),
|
|
806
|
-
|
|
807
|
-
|
|
840
|
+
X.renamed.length > 0 ? /* @__PURE__ */ e.jsxs("p", { className: "mt-2 text-sm text-amber-700", children: [
|
|
841
|
+
X.renamed.length,
|
|
808
842
|
" id",
|
|
809
|
-
|
|
843
|
+
X.renamed.length === 1 ? "" : "s",
|
|
810
844
|
" already used in this project",
|
|
811
845
|
" ",
|
|
812
|
-
|
|
846
|
+
X.renamed.length === 1 ? "was" : "were",
|
|
813
847
|
" renamed:",
|
|
814
848
|
" ",
|
|
815
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs", children:
|
|
849
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs", children: X.renamed.map((s) => `${s.from} → ${s.to}`).join(", ") })
|
|
816
850
|
] }) : null
|
|
817
851
|
] }) : null,
|
|
818
852
|
!d && a.cleanChunks.length > 0 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
819
853
|
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Split into files" }),
|
|
820
854
|
/* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: [
|
|
821
855
|
Array.from(
|
|
822
|
-
{ length:
|
|
823
|
-
(s,
|
|
856
|
+
{ length: st + 1 },
|
|
857
|
+
(s, k) => /* @__PURE__ */ e.jsx(
|
|
824
858
|
"button",
|
|
825
859
|
{
|
|
826
860
|
type: "button",
|
|
827
|
-
onClick: () =>
|
|
828
|
-
"aria-pressed":
|
|
829
|
-
className:
|
|
830
|
-
children:
|
|
861
|
+
onClick: () => K(k),
|
|
862
|
+
"aria-pressed": N === k,
|
|
863
|
+
className: N === k ? "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",
|
|
864
|
+
children: k === 0 ? "One file" : `${k} level${k === 1 ? "" : "s"}`
|
|
831
865
|
},
|
|
832
|
-
|
|
866
|
+
k
|
|
833
867
|
)
|
|
834
868
|
),
|
|
835
869
|
/* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-sm text-slate-500", children: [
|
|
836
|
-
|
|
870
|
+
fe.length,
|
|
837
871
|
" file",
|
|
838
|
-
|
|
872
|
+
fe.length === 1 ? "" : "s"
|
|
839
873
|
] })
|
|
840
874
|
] }),
|
|
841
|
-
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 max-h-48 overflow-auto font-mono text-xs text-slate-600", children:
|
|
875
|
+
/* @__PURE__ */ e.jsx("ul", { className: "mt-3 max-h-48 overflow-auto font-mono text-xs text-slate-600", children: fe.map((s) => /* @__PURE__ */ e.jsxs("li", { className: "truncate py-0.5", children: [
|
|
842
876
|
s,
|
|
843
|
-
|
|
844
|
-
|
|
877
|
+
z.get(s)?.fixCount ? /* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-amber-700", children: [
|
|
878
|
+
z.get(s).fixCount,
|
|
845
879
|
" change",
|
|
846
|
-
|
|
880
|
+
z.get(s).fixCount === 1 ? "" : "s"
|
|
847
881
|
] }) : null
|
|
848
882
|
] }, s)) })
|
|
849
883
|
] }) : null,
|
|
850
|
-
|
|
851
|
-
const
|
|
884
|
+
U ? /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-lg border border-slate-200 text-sm", children: fe.map((s) => {
|
|
885
|
+
const k = me.has(s);
|
|
852
886
|
return /* @__PURE__ */ e.jsxs(
|
|
853
887
|
"div",
|
|
854
888
|
{
|
|
@@ -858,38 +892,38 @@ function jt({
|
|
|
858
892
|
"button",
|
|
859
893
|
{
|
|
860
894
|
type: "button",
|
|
861
|
-
onClick: () =>
|
|
895
|
+
onClick: () => qe(s),
|
|
862
896
|
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",
|
|
863
897
|
children: [
|
|
864
|
-
/* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-slate-400", children:
|
|
898
|
+
/* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-slate-400", children: k ? "▾" : "▸" }),
|
|
865
899
|
/* @__PURE__ */ e.jsx("span", { className: "flex-1 truncate", children: s }),
|
|
866
900
|
/* @__PURE__ */ e.jsxs("span", { className: "shrink-0 text-slate-400", children: [
|
|
867
|
-
(
|
|
901
|
+
(ke[s].length / 1024).toFixed(1),
|
|
868
902
|
" KB"
|
|
869
903
|
] })
|
|
870
904
|
]
|
|
871
905
|
}
|
|
872
906
|
),
|
|
873
|
-
|
|
874
|
-
|
|
907
|
+
k ? /* @__PURE__ */ e.jsxs("div", { className: "bg-white", children: [
|
|
908
|
+
z.get(s)?.hunks.length ? /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 border-b border-slate-200 px-4 py-2", children: [
|
|
875
909
|
/* @__PURE__ */ e.jsx(
|
|
876
910
|
"button",
|
|
877
911
|
{
|
|
878
912
|
type: "button",
|
|
879
|
-
onClick: () =>
|
|
913
|
+
onClick: () => m(s),
|
|
880
914
|
className: "rounded border border-slate-300 px-2 py-0.5 text-xs text-slate-700 hover:bg-slate-50",
|
|
881
|
-
children:
|
|
915
|
+
children: ce.has(s) ? "Show converted file" : "Show what changed"
|
|
882
916
|
}
|
|
883
917
|
),
|
|
884
918
|
/* @__PURE__ */ e.jsxs("span", { className: "text-xs text-slate-500", children: [
|
|
885
919
|
"+",
|
|
886
|
-
|
|
920
|
+
z.get(s).stats.added,
|
|
887
921
|
" −",
|
|
888
|
-
|
|
922
|
+
z.get(s).stats.removed,
|
|
889
923
|
" in the LaTeX source"
|
|
890
924
|
] })
|
|
891
925
|
] }) : null,
|
|
892
|
-
|
|
926
|
+
ce.has(s) && z.has(s) ? /* @__PURE__ */ e.jsx(kt, { hunks: z.get(s).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: ke[s] })
|
|
893
927
|
] }) : null
|
|
894
928
|
]
|
|
895
929
|
},
|
|
@@ -901,17 +935,17 @@ function jt({
|
|
|
901
935
|
"button",
|
|
902
936
|
{
|
|
903
937
|
type: "button",
|
|
904
|
-
onClick:
|
|
938
|
+
onClick: c ?? we,
|
|
905
939
|
className: "px-4 py-2 text-sm text-slate-600 hover:text-slate-900",
|
|
906
|
-
children:
|
|
940
|
+
children: c ? "Cancel" : "Start Over"
|
|
907
941
|
}
|
|
908
942
|
),
|
|
909
943
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
910
|
-
|
|
944
|
+
Q ? /* @__PURE__ */ e.jsx(
|
|
911
945
|
"button",
|
|
912
946
|
{
|
|
913
947
|
type: "button",
|
|
914
|
-
onClick: () =>
|
|
948
|
+
onClick: () => j({ name: "sources", prepared: Q }),
|
|
915
949
|
className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
|
|
916
950
|
children: "Change Sources"
|
|
917
951
|
}
|
|
@@ -921,29 +955,29 @@ function jt({
|
|
|
921
955
|
{
|
|
922
956
|
type: "button",
|
|
923
957
|
onClick: () => {
|
|
924
|
-
|
|
958
|
+
U || Fe(a, $), ae((s) => !s);
|
|
925
959
|
},
|
|
926
960
|
className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
|
|
927
|
-
children:
|
|
961
|
+
children: U ? "Hide Preview" : "Preview"
|
|
928
962
|
}
|
|
929
963
|
),
|
|
930
964
|
/* @__PURE__ */ e.jsxs(
|
|
931
965
|
"button",
|
|
932
966
|
{
|
|
933
967
|
type: "button",
|
|
934
|
-
disabled:
|
|
968
|
+
disabled: v,
|
|
935
969
|
onClick: async () => {
|
|
936
|
-
|
|
970
|
+
O(!0);
|
|
937
971
|
try {
|
|
938
|
-
await r(a,
|
|
972
|
+
await r(a, $);
|
|
939
973
|
} finally {
|
|
940
|
-
|
|
974
|
+
O(!1);
|
|
941
975
|
}
|
|
942
976
|
},
|
|
943
977
|
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",
|
|
944
978
|
children: [
|
|
945
|
-
|
|
946
|
-
|
|
979
|
+
v ? /* @__PURE__ */ e.jsx("span", { className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent" }) : null,
|
|
980
|
+
v ? p ? "Inserting…" : "Importing…" : p ? "Confirm Insert" : "Confirm Import"
|
|
947
981
|
]
|
|
948
982
|
}
|
|
949
983
|
)
|
|
@@ -952,40 +986,13 @@ function jt({
|
|
|
952
986
|
] });
|
|
953
987
|
}
|
|
954
988
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
955
|
-
S.length > 1 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
|
|
956
|
-
/* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Converter" }),
|
|
957
|
-
/* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-3", children: S.map((n) => /* @__PURE__ */ e.jsxs(
|
|
958
|
-
"label",
|
|
959
|
-
{
|
|
960
|
-
className: "flex cursor-pointer items-start gap-3 text-sm",
|
|
961
|
-
children: [
|
|
962
|
-
/* @__PURE__ */ e.jsx(
|
|
963
|
-
"input",
|
|
964
|
-
{
|
|
965
|
-
type: "radio",
|
|
966
|
-
name: "import-engine",
|
|
967
|
-
value: n.id,
|
|
968
|
-
checked: V === n.id,
|
|
969
|
-
onChange: () => he(n.id),
|
|
970
|
-
className: "mt-0.5"
|
|
971
|
-
}
|
|
972
|
-
),
|
|
973
|
-
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
974
|
-
/* @__PURE__ */ e.jsx("span", { className: "font-medium text-slate-900", children: n.label }),
|
|
975
|
-
n.description ? /* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: n.description }) : null
|
|
976
|
-
] })
|
|
977
|
-
]
|
|
978
|
-
},
|
|
979
|
-
n.id
|
|
980
|
-
)) })
|
|
981
|
-
] }) : null,
|
|
982
989
|
d ? 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: [
|
|
983
990
|
/* @__PURE__ */ e.jsx("span", { className: "text-slate-500", children: "Document kind" }),
|
|
984
991
|
/* @__PURE__ */ e.jsxs(
|
|
985
992
|
"select",
|
|
986
993
|
{
|
|
987
|
-
value:
|
|
988
|
-
onChange: (n) =>
|
|
994
|
+
value: F,
|
|
995
|
+
onChange: (n) => W(
|
|
989
996
|
n.currentTarget.value
|
|
990
997
|
),
|
|
991
998
|
className: "rounded border border-slate-300 px-2 py-1 text-sm",
|
|
@@ -1005,15 +1012,15 @@ function jt({
|
|
|
1005
1012
|
onKeyDown: (n) => n.key === "Enter" && T.current?.click(),
|
|
1006
1013
|
onClick: () => T.current?.click(),
|
|
1007
1014
|
onDragOver: (n) => {
|
|
1008
|
-
n.preventDefault(),
|
|
1015
|
+
n.preventDefault(), S(!0);
|
|
1009
1016
|
},
|
|
1010
|
-
onDragLeave: () =>
|
|
1017
|
+
onDragLeave: () => S(!1),
|
|
1011
1018
|
onDrop: (n) => {
|
|
1012
|
-
n.preventDefault(),
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1019
|
+
n.preventDefault(), S(!1);
|
|
1020
|
+
const m = n.dataTransfer.files?.[0];
|
|
1021
|
+
m && ye(m);
|
|
1015
1022
|
},
|
|
1016
|
-
className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${
|
|
1023
|
+
className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${A ? "border-blue-500 bg-blue-50" : "border-slate-300 bg-slate-50 hover:border-slate-400"}`,
|
|
1017
1024
|
children: [
|
|
1018
1025
|
/* @__PURE__ */ e.jsx("p", { className: "text-slate-600", children: "Drop a file here, or click to select." }),
|
|
1019
1026
|
/* @__PURE__ */ e.jsx(
|
|
@@ -1029,7 +1036,7 @@ function jt({
|
|
|
1029
1036
|
),
|
|
1030
1037
|
/* @__PURE__ */ e.jsxs("p", { className: "text-xs text-slate-400", children: [
|
|
1031
1038
|
"Supports ",
|
|
1032
|
-
|
|
1039
|
+
Te.join(", ")
|
|
1033
1040
|
] }),
|
|
1034
1041
|
/* @__PURE__ */ e.jsx(
|
|
1035
1042
|
"input",
|
|
@@ -1037,10 +1044,10 @@ function jt({
|
|
|
1037
1044
|
ref: T,
|
|
1038
1045
|
type: "file",
|
|
1039
1046
|
hidden: !0,
|
|
1040
|
-
accept:
|
|
1047
|
+
accept: Te.join(","),
|
|
1041
1048
|
onChange: (n) => {
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1049
|
+
const m = n.currentTarget.files?.[0];
|
|
1050
|
+
m && ye(m), n.currentTarget.value = "";
|
|
1044
1051
|
}
|
|
1045
1052
|
}
|
|
1046
1053
|
)
|
|
@@ -1049,29 +1056,29 @@ function jt({
|
|
|
1049
1056
|
)
|
|
1050
1057
|
] });
|
|
1051
1058
|
}
|
|
1052
|
-
function
|
|
1059
|
+
function Be(r) {
|
|
1053
1060
|
return r.reduce(
|
|
1054
|
-
(
|
|
1061
|
+
(c, d) => c + 1 + Be(d.children),
|
|
1055
1062
|
0
|
|
1056
1063
|
);
|
|
1057
1064
|
}
|
|
1058
|
-
function
|
|
1059
|
-
const d = r.split(".").map(Number), u =
|
|
1065
|
+
function wt(r, c) {
|
|
1066
|
+
const d = r.split(".").map(Number), u = c.split(".").map(Number);
|
|
1060
1067
|
for (let x = 0; x < Math.max(d.length, u.length); x++) {
|
|
1061
|
-
const
|
|
1062
|
-
if (
|
|
1063
|
-
return
|
|
1068
|
+
const i = (d[x] ?? -1) - (u[x] ?? -1);
|
|
1069
|
+
if (i !== 0)
|
|
1070
|
+
return i;
|
|
1064
1071
|
}
|
|
1065
1072
|
return 0;
|
|
1066
1073
|
}
|
|
1067
|
-
function
|
|
1074
|
+
function ze({
|
|
1068
1075
|
items: r,
|
|
1069
|
-
selection:
|
|
1076
|
+
selection: c,
|
|
1070
1077
|
onToggle: d
|
|
1071
1078
|
}) {
|
|
1072
1079
|
return /* @__PURE__ */ e.jsx("ul", { className: "space-y-0.5 text-sm", children: r.map((u) => {
|
|
1073
|
-
const x =
|
|
1074
|
-
(
|
|
1080
|
+
const x = c.includes(u.path), i = c.some(
|
|
1081
|
+
(y) => u.path.startsWith(`${y}.`)
|
|
1075
1082
|
);
|
|
1076
1083
|
return /* @__PURE__ */ e.jsxs("li", { children: [
|
|
1077
1084
|
/* @__PURE__ */ e.jsxs("label", { className: "flex items-baseline gap-2", children: [
|
|
@@ -1079,12 +1086,12 @@ function Ie({
|
|
|
1079
1086
|
"input",
|
|
1080
1087
|
{
|
|
1081
1088
|
type: "checkbox",
|
|
1082
|
-
checked: x ||
|
|
1083
|
-
disabled:
|
|
1089
|
+
checked: x || i,
|
|
1090
|
+
disabled: i,
|
|
1084
1091
|
onChange: () => d(u.path)
|
|
1085
1092
|
}
|
|
1086
1093
|
),
|
|
1087
|
-
/* @__PURE__ */ e.jsxs("span", { className:
|
|
1094
|
+
/* @__PURE__ */ e.jsxs("span", { className: i ? "text-slate-400" : "text-slate-700", children: [
|
|
1088
1095
|
u.title || /* @__PURE__ */ e.jsx("em", { children: "Untitled" }),
|
|
1089
1096
|
/* @__PURE__ */ e.jsxs("span", { className: "ml-2 font-mono text-xs text-slate-400", children: [
|
|
1090
1097
|
"<",
|
|
@@ -1094,20 +1101,20 @@ function Ie({
|
|
|
1094
1101
|
] })
|
|
1095
1102
|
] }),
|
|
1096
1103
|
u.children.length > 0 ? /* @__PURE__ */ e.jsx("div", { className: "ml-5 border-l border-slate-200 pl-3", children: /* @__PURE__ */ e.jsx(
|
|
1097
|
-
|
|
1104
|
+
ze,
|
|
1098
1105
|
{
|
|
1099
1106
|
items: u.children,
|
|
1100
|
-
selection:
|
|
1107
|
+
selection: c,
|
|
1101
1108
|
onToggle: d
|
|
1102
1109
|
}
|
|
1103
1110
|
) }) : null
|
|
1104
1111
|
] }, u.path);
|
|
1105
1112
|
}) });
|
|
1106
1113
|
}
|
|
1107
|
-
function
|
|
1108
|
-
return r.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: r.map((
|
|
1114
|
+
function kt({ hunks: r }) {
|
|
1115
|
+
return r.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: r.map((c, d) => /* @__PURE__ */ e.jsxs("div", { className: "border-b border-slate-100 last:border-b-0", children: [
|
|
1109
1116
|
d > 0 ? /* @__PURE__ */ e.jsx("div", { className: "bg-slate-50 px-4 py-1 text-slate-400", children: "⋯" }) : null,
|
|
1110
|
-
|
|
1117
|
+
c.lines.map((u, x) => /* @__PURE__ */ e.jsxs(
|
|
1111
1118
|
"div",
|
|
1112
1119
|
{
|
|
1113
1120
|
className: u.op === "add" ? "bg-green-50 px-4 text-green-900" : u.op === "remove" ? "bg-red-50 px-4 text-red-900" : "px-4 text-slate-600",
|
|
@@ -1120,7 +1127,7 @@ function xt({ hunks: r }) {
|
|
|
1120
1127
|
))
|
|
1121
1128
|
] }, d)) });
|
|
1122
1129
|
}
|
|
1123
|
-
const
|
|
1130
|
+
const Et = {
|
|
1124
1131
|
title: "Import Source Content",
|
|
1125
1132
|
description: "Paste LaTeX, Markdown, or PreTeXt source to convert into PreTeXt.",
|
|
1126
1133
|
sourceLabel: "Source",
|
|
@@ -1131,59 +1138,59 @@ const pt = {
|
|
|
1131
1138
|
successPrefix: "Ready",
|
|
1132
1139
|
errorPrefix: "Error"
|
|
1133
1140
|
};
|
|
1134
|
-
function
|
|
1141
|
+
function _t({
|
|
1135
1142
|
initialSource: r = "",
|
|
1136
|
-
initialSourceFormat:
|
|
1143
|
+
initialSourceFormat: c,
|
|
1137
1144
|
labels: d,
|
|
1138
1145
|
disabled: u = !1,
|
|
1139
1146
|
onImport: x
|
|
1140
1147
|
}) {
|
|
1141
|
-
const
|
|
1142
|
-
() => ({ ...
|
|
1148
|
+
const i = H(
|
|
1149
|
+
() => ({ ...Et, ...d ?? {} }),
|
|
1143
1150
|
[d]
|
|
1144
|
-
), [
|
|
1145
|
-
|
|
1146
|
-
), [T,
|
|
1151
|
+
), [y, P] = h(r), [p, E] = h(
|
|
1152
|
+
c ?? "auto"
|
|
1153
|
+
), [T, w] = h(
|
|
1147
1154
|
null
|
|
1148
|
-
),
|
|
1149
|
-
() =>
|
|
1150
|
-
[
|
|
1151
|
-
),
|
|
1155
|
+
), j = H(
|
|
1156
|
+
() => at(y),
|
|
1157
|
+
[y]
|
|
1158
|
+
), A = u || !y.trim();
|
|
1152
1159
|
return /* @__PURE__ */ e.jsx(
|
|
1153
1160
|
"form",
|
|
1154
1161
|
{
|
|
1155
|
-
onSubmit: (
|
|
1156
|
-
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1162
|
+
onSubmit: (S) => {
|
|
1163
|
+
S.preventDefault();
|
|
1164
|
+
const F = lt(
|
|
1165
|
+
y,
|
|
1159
1166
|
p === "auto" ? void 0 : p
|
|
1160
1167
|
);
|
|
1161
|
-
|
|
1168
|
+
w(F), x(F);
|
|
1162
1169
|
},
|
|
1163
1170
|
"aria-label": "Import source form",
|
|
1164
1171
|
children: /* @__PURE__ */ e.jsxs("fieldset", { disabled: u, children: [
|
|
1165
|
-
/* @__PURE__ */ e.jsx("legend", { children:
|
|
1166
|
-
/* @__PURE__ */ e.jsx("p", { children:
|
|
1172
|
+
/* @__PURE__ */ e.jsx("legend", { children: i.title }),
|
|
1173
|
+
/* @__PURE__ */ e.jsx("p", { children: i.description }),
|
|
1167
1174
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
1168
|
-
|
|
1175
|
+
i.sourceLabel,
|
|
1169
1176
|
/* @__PURE__ */ e.jsx(
|
|
1170
1177
|
"textarea",
|
|
1171
1178
|
{
|
|
1172
|
-
value:
|
|
1173
|
-
onChange: (
|
|
1174
|
-
placeholder:
|
|
1179
|
+
value: y,
|
|
1180
|
+
onChange: (S) => P(S.currentTarget.value),
|
|
1181
|
+
placeholder: i.sourcePlaceholder,
|
|
1175
1182
|
rows: 12
|
|
1176
1183
|
}
|
|
1177
1184
|
)
|
|
1178
1185
|
] }),
|
|
1179
1186
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
1180
|
-
|
|
1187
|
+
i.formatLabel,
|
|
1181
1188
|
/* @__PURE__ */ e.jsxs(
|
|
1182
1189
|
"select",
|
|
1183
1190
|
{
|
|
1184
1191
|
value: p,
|
|
1185
|
-
onChange: (
|
|
1186
|
-
|
|
1192
|
+
onChange: (S) => E(
|
|
1193
|
+
S.currentTarget.value
|
|
1187
1194
|
),
|
|
1188
1195
|
children: [
|
|
1189
1196
|
/* @__PURE__ */ e.jsx("option", { value: "auto", children: "Auto detect" }),
|
|
@@ -1195,17 +1202,17 @@ function vt({
|
|
|
1195
1202
|
)
|
|
1196
1203
|
] }),
|
|
1197
1204
|
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
1198
|
-
|
|
1205
|
+
i.detectedFormatPrefix,
|
|
1199
1206
|
": ",
|
|
1200
|
-
/* @__PURE__ */ e.jsx("strong", { children:
|
|
1207
|
+
/* @__PURE__ */ e.jsx("strong", { children: j })
|
|
1201
1208
|
] }),
|
|
1202
|
-
/* @__PURE__ */ e.jsx("button", { type: "submit", disabled:
|
|
1209
|
+
/* @__PURE__ */ e.jsx("button", { type: "submit", disabled: A, children: i.convertButton }),
|
|
1203
1210
|
T ? "pretextError" in T ? /* @__PURE__ */ e.jsxs("p", { role: "alert", children: [
|
|
1204
|
-
|
|
1211
|
+
i.errorPrefix,
|
|
1205
1212
|
": ",
|
|
1206
1213
|
T.pretextError
|
|
1207
1214
|
] }) : /* @__PURE__ */ e.jsxs("p", { children: [
|
|
1208
|
-
|
|
1215
|
+
i.successPrefix,
|
|
1209
1216
|
": ",
|
|
1210
1217
|
T.pretextSource.length,
|
|
1211
1218
|
" characters of PreTeXt generated."
|
|
@@ -1214,7 +1221,7 @@ function vt({
|
|
|
1214
1221
|
}
|
|
1215
1222
|
);
|
|
1216
1223
|
}
|
|
1217
|
-
const
|
|
1224
|
+
const Tt = {
|
|
1218
1225
|
title: "Upload Source File",
|
|
1219
1226
|
hint: "Supports .tex, .md, .ptx, .xml, .zip, and .tar.gz files.",
|
|
1220
1227
|
selectButton: "Select File",
|
|
@@ -1222,43 +1229,43 @@ const ht = {
|
|
|
1222
1229
|
documentKindLabel: "Document kind",
|
|
1223
1230
|
splitSectionsLabel: "Split each chapter into sections"
|
|
1224
1231
|
};
|
|
1225
|
-
function
|
|
1232
|
+
function At({
|
|
1226
1233
|
labels: r,
|
|
1227
|
-
disabled:
|
|
1234
|
+
disabled: c = !1,
|
|
1228
1235
|
defaultDocumentKind: d = "auto",
|
|
1229
1236
|
importOptions: u,
|
|
1230
1237
|
onImport: x
|
|
1231
1238
|
}) {
|
|
1232
|
-
const
|
|
1233
|
-
() => ({ ...
|
|
1239
|
+
const i = H(
|
|
1240
|
+
() => ({ ...Tt, ...r ?? {} }),
|
|
1234
1241
|
[r]
|
|
1235
|
-
),
|
|
1242
|
+
), y = ge(null), [P, p] = h(!1), [E, T] = h(!1), [w, j] = h(
|
|
1236
1243
|
[]
|
|
1237
|
-
), [
|
|
1244
|
+
), [A, S] = h(d), [F, W] = h(!1), C = c || E, K = async (b) => {
|
|
1238
1245
|
T(!0);
|
|
1239
1246
|
try {
|
|
1240
|
-
const
|
|
1241
|
-
documentKind:
|
|
1242
|
-
splitSections:
|
|
1247
|
+
const _ = await Ue(b, u ?? {
|
|
1248
|
+
documentKind: A === "auto" ? void 0 : A,
|
|
1249
|
+
splitSections: F
|
|
1243
1250
|
});
|
|
1244
|
-
|
|
1251
|
+
j(_.statusMessages), x(_);
|
|
1245
1252
|
} finally {
|
|
1246
1253
|
T(!1);
|
|
1247
1254
|
}
|
|
1248
1255
|
};
|
|
1249
1256
|
return /* @__PURE__ */ e.jsxs("section", { "aria-label": "Import upload panel", children: [
|
|
1250
|
-
/* @__PURE__ */ e.jsx("h3", { children:
|
|
1251
|
-
/* @__PURE__ */ e.jsx("p", { children:
|
|
1257
|
+
/* @__PURE__ */ e.jsx("h3", { children: i.title }),
|
|
1258
|
+
/* @__PURE__ */ e.jsx("p", { children: i.hint }),
|
|
1252
1259
|
u ? null : /* @__PURE__ */ e.jsxs("div", { className: "import-options", children: [
|
|
1253
1260
|
/* @__PURE__ */ e.jsxs("label", { children: [
|
|
1254
|
-
|
|
1261
|
+
i.documentKindLabel,
|
|
1255
1262
|
/* @__PURE__ */ e.jsxs(
|
|
1256
1263
|
"select",
|
|
1257
1264
|
{
|
|
1258
|
-
value:
|
|
1259
|
-
disabled:
|
|
1260
|
-
onChange: (
|
|
1261
|
-
|
|
1265
|
+
value: A,
|
|
1266
|
+
disabled: C,
|
|
1267
|
+
onChange: (b) => S(
|
|
1268
|
+
b.currentTarget.value
|
|
1262
1269
|
),
|
|
1263
1270
|
children: [
|
|
1264
1271
|
/* @__PURE__ */ e.jsx("option", { value: "auto", children: "Auto detect" }),
|
|
@@ -1273,73 +1280,73 @@ function Nt({
|
|
|
1273
1280
|
"input",
|
|
1274
1281
|
{
|
|
1275
1282
|
type: "checkbox",
|
|
1276
|
-
checked:
|
|
1277
|
-
disabled:
|
|
1278
|
-
onChange: (
|
|
1283
|
+
checked: F,
|
|
1284
|
+
disabled: C,
|
|
1285
|
+
onChange: (b) => W(b.currentTarget.checked)
|
|
1279
1286
|
}
|
|
1280
1287
|
),
|
|
1281
|
-
|
|
1288
|
+
i.splitSectionsLabel
|
|
1282
1289
|
] })
|
|
1283
1290
|
] }),
|
|
1284
1291
|
/* @__PURE__ */ e.jsxs(
|
|
1285
1292
|
"div",
|
|
1286
1293
|
{
|
|
1287
|
-
onDragOver: (
|
|
1288
|
-
|
|
1294
|
+
onDragOver: (b) => {
|
|
1295
|
+
b.preventDefault(), C || p(!0);
|
|
1289
1296
|
},
|
|
1290
1297
|
onDragLeave: () => p(!1),
|
|
1291
|
-
onDrop: (
|
|
1292
|
-
if (
|
|
1298
|
+
onDrop: (b) => {
|
|
1299
|
+
if (b.preventDefault(), p(!1), C)
|
|
1293
1300
|
return;
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1301
|
+
const R = b.dataTransfer.files?.[0];
|
|
1302
|
+
R && K(R);
|
|
1296
1303
|
},
|
|
1297
1304
|
children: [
|
|
1298
|
-
/* @__PURE__ */ e.jsx("p", { children:
|
|
1305
|
+
/* @__PURE__ */ e.jsx("p", { children: i.dropHint }),
|
|
1299
1306
|
/* @__PURE__ */ e.jsxs(
|
|
1300
1307
|
"button",
|
|
1301
1308
|
{
|
|
1302
1309
|
type: "button",
|
|
1303
|
-
disabled:
|
|
1304
|
-
onClick: () =>
|
|
1310
|
+
disabled: C,
|
|
1311
|
+
onClick: () => y.current?.click(),
|
|
1305
1312
|
className: "inline-flex items-center gap-2",
|
|
1306
1313
|
children: [
|
|
1307
|
-
|
|
1314
|
+
E ? /* @__PURE__ */ e.jsx(
|
|
1308
1315
|
"span",
|
|
1309
1316
|
{
|
|
1310
1317
|
className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent",
|
|
1311
1318
|
"aria-hidden": "true"
|
|
1312
1319
|
}
|
|
1313
1320
|
) : null,
|
|
1314
|
-
|
|
1321
|
+
E ? "Processing…" : i.selectButton
|
|
1315
1322
|
]
|
|
1316
1323
|
}
|
|
1317
1324
|
),
|
|
1318
1325
|
/* @__PURE__ */ e.jsx(
|
|
1319
1326
|
"input",
|
|
1320
1327
|
{
|
|
1321
|
-
ref:
|
|
1328
|
+
ref: y,
|
|
1322
1329
|
type: "file",
|
|
1323
1330
|
hidden: !0,
|
|
1324
|
-
disabled:
|
|
1331
|
+
disabled: C,
|
|
1325
1332
|
accept: ".tex,.md,.markdown,.ptx,.xml,.zip,.gz,.tar.gz,.tgz",
|
|
1326
|
-
onChange: (
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1333
|
+
onChange: (b) => {
|
|
1334
|
+
const R = b.currentTarget.files?.[0];
|
|
1335
|
+
R && K(R), b.currentTarget.value = "";
|
|
1329
1336
|
}
|
|
1330
1337
|
}
|
|
1331
1338
|
)
|
|
1332
1339
|
]
|
|
1333
1340
|
}
|
|
1334
1341
|
),
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1342
|
+
E ? /* @__PURE__ */ e.jsx("p", { role: "status", "aria-live": "polite", children: "Converting your file — this can take a while for a long document." }) : null,
|
|
1343
|
+
w.length > 0 ? /* @__PURE__ */ e.jsx("ul", { "aria-live": "polite", children: w.map((b, R) => /* @__PURE__ */ e.jsx("li", { children: b.message }, `${b.type}-${R}`)) }) : null,
|
|
1344
|
+
P && !C ? /* @__PURE__ */ e.jsx("p", { children: "Release to upload the file." }) : null
|
|
1338
1345
|
] });
|
|
1339
1346
|
}
|
|
1340
1347
|
export {
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1348
|
+
_t as ImportSourceForm,
|
|
1349
|
+
At as ImportUploadPanel,
|
|
1350
|
+
Rt as ImportWizard,
|
|
1351
|
+
vt as ProcessingPanel
|
|
1345
1352
|
};
|