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