@clevertask/scribe 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2509 +0,0 @@
1
- import { P as Ur, a as Fr, B as kr, y as qr, C as zr, E as Kr, G as Gr } from "./index-DzExyr-e.js";
2
- import P, { useRef as Yr, useState as At, useDebugValue as lr, useEffect as _t, forwardRef as Xr, useLayoutEffect as Jr, useContext as dr, createContext as fr } from "react";
3
- import Qr, { flushSync as Zr } from "react-dom";
4
- var U = "top", G = "bottom", Y = "right", F = "left", Rt = "auto", Fe = [U, G, Y, F], Te = "start", He = "end", en = "clippingParents", pr = "viewport", je = "popper", tn = "reference", Wt = /* @__PURE__ */ Fe.reduce(function(t, e) {
5
- return t.concat([e + "-" + Te, e + "-" + He]);
6
- }, []), vr = /* @__PURE__ */ [].concat(Fe, [Rt]).reduce(function(t, e) {
7
- return t.concat([e, e + "-" + Te, e + "-" + He]);
8
- }, []), rn = "beforeRead", nn = "read", on = "afterRead", an = "beforeMain", sn = "main", un = "afterMain", cn = "beforeWrite", ln = "write", dn = "afterWrite", fn = [rn, nn, on, an, sn, un, cn, ln, dn];
9
- function re(t) {
10
- return t ? (t.nodeName || "").toLowerCase() : null;
11
- }
12
- function q(t) {
13
- if (t == null)
14
- return window;
15
- if (t.toString() !== "[object Window]") {
16
- var e = t.ownerDocument;
17
- return e && e.defaultView || window;
18
- }
19
- return t;
20
- }
21
- function ge(t) {
22
- var e = q(t).Element;
23
- return t instanceof e || t instanceof Element;
24
- }
25
- function K(t) {
26
- var e = q(t).HTMLElement;
27
- return t instanceof e || t instanceof HTMLElement;
28
- }
29
- function Lt(t) {
30
- if (typeof ShadowRoot > "u")
31
- return !1;
32
- var e = q(t).ShadowRoot;
33
- return t instanceof e || t instanceof ShadowRoot;
34
- }
35
- function pn(t) {
36
- var e = t.state;
37
- Object.keys(e.elements).forEach(function(r) {
38
- var n = e.styles[r] || {}, i = e.attributes[r] || {}, a = e.elements[r];
39
- !K(a) || !re(a) || (Object.assign(a.style, n), Object.keys(i).forEach(function(c) {
40
- var u = i[c];
41
- u === !1 ? a.removeAttribute(c) : a.setAttribute(c, u === !0 ? "" : u);
42
- }));
43
- });
44
- }
45
- function vn(t) {
46
- var e = t.state, r = {
47
- popper: {
48
- position: e.options.strategy,
49
- left: "0",
50
- top: "0",
51
- margin: "0"
52
- },
53
- arrow: {
54
- position: "absolute"
55
- },
56
- reference: {}
57
- };
58
- return Object.assign(e.elements.popper.style, r.popper), e.styles = r, e.elements.arrow && Object.assign(e.elements.arrow.style, r.arrow), function() {
59
- Object.keys(e.elements).forEach(function(n) {
60
- var i = e.elements[n], a = e.attributes[n] || {}, c = Object.keys(e.styles.hasOwnProperty(n) ? e.styles[n] : r[n]), u = c.reduce(function(s, p) {
61
- return s[p] = "", s;
62
- }, {});
63
- !K(i) || !re(i) || (Object.assign(i.style, u), Object.keys(a).forEach(function(s) {
64
- i.removeAttribute(s);
65
- }));
66
- });
67
- };
68
- }
69
- const hr = {
70
- name: "applyStyles",
71
- enabled: !0,
72
- phase: "write",
73
- fn: pn,
74
- effect: vn,
75
- requires: ["computeStyles"]
76
- };
77
- function te(t) {
78
- return t.split("-")[0];
79
- }
80
- var ye = Math.max, at = Math.min, Ce = Math.round;
81
- function Et() {
82
- var t = navigator.userAgentData;
83
- return t != null && t.brands && Array.isArray(t.brands) ? t.brands.map(function(e) {
84
- return e.brand + "/" + e.version;
85
- }).join(" ") : navigator.userAgent;
86
- }
87
- function mr() {
88
- return !/^((?!chrome|android).)*safari/i.test(Et());
89
- }
90
- function Ae(t, e, r) {
91
- e === void 0 && (e = !1), r === void 0 && (r = !1);
92
- var n = t.getBoundingClientRect(), i = 1, a = 1;
93
- e && K(t) && (i = t.offsetWidth > 0 && Ce(n.width) / t.offsetWidth || 1, a = t.offsetHeight > 0 && Ce(n.height) / t.offsetHeight || 1);
94
- var c = ge(t) ? q(t) : window, u = c.visualViewport, s = !mr() && r, p = (n.left + (s && u ? u.offsetLeft : 0)) / i, d = (n.top + (s && u ? u.offsetTop : 0)) / a, v = n.width / i, y = n.height / a;
95
- return {
96
- width: v,
97
- height: y,
98
- top: d,
99
- right: p + v,
100
- bottom: d + y,
101
- left: p,
102
- x: p,
103
- y: d
104
- };
105
- }
106
- function Mt(t) {
107
- var e = Ae(t), r = t.offsetWidth, n = t.offsetHeight;
108
- return Math.abs(e.width - r) <= 1 && (r = e.width), Math.abs(e.height - n) <= 1 && (n = e.height), {
109
- x: t.offsetLeft,
110
- y: t.offsetTop,
111
- width: r,
112
- height: n
113
- };
114
- }
115
- function yr(t, e) {
116
- var r = e.getRootNode && e.getRootNode();
117
- if (t.contains(e))
118
- return !0;
119
- if (r && Lt(r)) {
120
- var n = e;
121
- do {
122
- if (n && t.isSameNode(n))
123
- return !0;
124
- n = n.parentNode || n.host;
125
- } while (n);
126
- }
127
- return !1;
128
- }
129
- function ue(t) {
130
- return q(t).getComputedStyle(t);
131
- }
132
- function hn(t) {
133
- return ["table", "td", "th"].indexOf(re(t)) >= 0;
134
- }
135
- function de(t) {
136
- return ((ge(t) ? t.ownerDocument : (
137
- // $FlowFixMe[prop-missing]
138
- t.document
139
- )) || window.document).documentElement;
140
- }
141
- function ut(t) {
142
- return re(t) === "html" ? t : (
143
- // this is a quicker (but less type safe) way to save quite some bytes from the bundle
144
- // $FlowFixMe[incompatible-return]
145
- // $FlowFixMe[prop-missing]
146
- t.assignedSlot || // step into the shadow DOM of the parent of a slotted node
147
- t.parentNode || // DOM Element detected
148
- (Lt(t) ? t.host : null) || // ShadowRoot detected
149
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
150
- de(t)
151
- );
152
- }
153
- function $t(t) {
154
- return !K(t) || // https://github.com/popperjs/popper-core/issues/837
155
- ue(t).position === "fixed" ? null : t.offsetParent;
156
- }
157
- function mn(t) {
158
- var e = /firefox/i.test(Et()), r = /Trident/i.test(Et());
159
- if (r && K(t)) {
160
- var n = ue(t);
161
- if (n.position === "fixed")
162
- return null;
163
- }
164
- var i = ut(t);
165
- for (Lt(i) && (i = i.host); K(i) && ["html", "body"].indexOf(re(i)) < 0; ) {
166
- var a = ue(i);
167
- if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || e && a.willChange === "filter" || e && a.filter && a.filter !== "none")
168
- return i;
169
- i = i.parentNode;
170
- }
171
- return null;
172
- }
173
- function ke(t) {
174
- for (var e = q(t), r = $t(t); r && hn(r) && ue(r).position === "static"; )
175
- r = $t(r);
176
- return r && (re(r) === "html" || re(r) === "body" && ue(r).position === "static") ? e : r || mn(t) || e;
177
- }
178
- function Nt(t) {
179
- return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
180
- }
181
- function Be(t, e, r) {
182
- return ye(t, at(e, r));
183
- }
184
- function yn(t, e, r) {
185
- var n = Be(t, e, r);
186
- return n > r ? r : n;
187
- }
188
- function gr() {
189
- return {
190
- top: 0,
191
- right: 0,
192
- bottom: 0,
193
- left: 0
194
- };
195
- }
196
- function br(t) {
197
- return Object.assign({}, gr(), t);
198
- }
199
- function Er(t, e) {
200
- return e.reduce(function(r, n) {
201
- return r[n] = t, r;
202
- }, {});
203
- }
204
- var gn = function(e, r) {
205
- return e = typeof e == "function" ? e(Object.assign({}, r.rects, {
206
- placement: r.placement
207
- })) : e, br(typeof e != "number" ? e : Er(e, Fe));
208
- };
209
- function bn(t) {
210
- var e, r = t.state, n = t.name, i = t.options, a = r.elements.arrow, c = r.modifiersData.popperOffsets, u = te(r.placement), s = Nt(u), p = [F, Y].indexOf(u) >= 0, d = p ? "height" : "width";
211
- if (!(!a || !c)) {
212
- var v = gn(i.padding, r), y = Mt(a), h = s === "y" ? U : F, b = s === "y" ? G : Y, m = r.rects.reference[d] + r.rects.reference[s] - c[s] - r.rects.popper[d], E = c[s] - r.rects.reference[s], D = ke(a), T = D ? s === "y" ? D.clientHeight || 0 : D.clientWidth || 0 : 0, w = m / 2 - E / 2, o = v[h], O = T - y[d] - v[b], f = T / 2 - y[d] / 2 + w, x = Be(o, f, O), _ = s;
213
- r.modifiersData[n] = (e = {}, e[_] = x, e.centerOffset = x - f, e);
214
- }
215
- }
216
- function En(t) {
217
- var e = t.state, r = t.options, n = r.element, i = n === void 0 ? "[data-popper-arrow]" : n;
218
- i != null && (typeof i == "string" && (i = e.elements.popper.querySelector(i), !i) || yr(e.elements.popper, i) && (e.elements.arrow = i));
219
- }
220
- const wn = {
221
- name: "arrow",
222
- enabled: !0,
223
- phase: "main",
224
- fn: bn,
225
- effect: En,
226
- requires: ["popperOffsets"],
227
- requiresIfExists: ["preventOverflow"]
228
- };
229
- function _e(t) {
230
- return t.split("-")[1];
231
- }
232
- var On = {
233
- top: "auto",
234
- right: "auto",
235
- bottom: "auto",
236
- left: "auto"
237
- };
238
- function Sn(t, e) {
239
- var r = t.x, n = t.y, i = e.devicePixelRatio || 1;
240
- return {
241
- x: Ce(r * i) / i || 0,
242
- y: Ce(n * i) / i || 0
243
- };
244
- }
245
- function Ut(t) {
246
- var e, r = t.popper, n = t.popperRect, i = t.placement, a = t.variation, c = t.offsets, u = t.position, s = t.gpuAcceleration, p = t.adaptive, d = t.roundOffsets, v = t.isFixed, y = c.x, h = y === void 0 ? 0 : y, b = c.y, m = b === void 0 ? 0 : b, E = typeof d == "function" ? d({
247
- x: h,
248
- y: m
249
- }) : {
250
- x: h,
251
- y: m
252
- };
253
- h = E.x, m = E.y;
254
- var D = c.hasOwnProperty("x"), T = c.hasOwnProperty("y"), w = F, o = U, O = window;
255
- if (p) {
256
- var f = ke(r), x = "clientHeight", _ = "clientWidth";
257
- if (f === q(r) && (f = de(r), ue(f).position !== "static" && u === "absolute" && (x = "scrollHeight", _ = "scrollWidth")), f = f, i === U || (i === F || i === Y) && a === He) {
258
- o = G;
259
- var C = v && f === O && O.visualViewport ? O.visualViewport.height : (
260
- // $FlowFixMe[prop-missing]
261
- f[x]
262
- );
263
- m -= C - n.height, m *= s ? 1 : -1;
264
- }
265
- if (i === F || (i === U || i === G) && a === He) {
266
- w = Y;
267
- var L = v && f === O && O.visualViewport ? O.visualViewport.width : (
268
- // $FlowFixMe[prop-missing]
269
- f[_]
270
- );
271
- h -= L - n.width, h *= s ? 1 : -1;
272
- }
273
- }
274
- var V = Object.assign({
275
- position: u
276
- }, p && On), M = d === !0 ? Sn({
277
- x: h,
278
- y: m
279
- }, q(r)) : {
280
- x: h,
281
- y: m
282
- };
283
- if (h = M.x, m = M.y, s) {
284
- var N;
285
- return Object.assign({}, V, (N = {}, N[o] = T ? "0" : "", N[w] = D ? "0" : "", N.transform = (O.devicePixelRatio || 1) <= 1 ? "translate(" + h + "px, " + m + "px)" : "translate3d(" + h + "px, " + m + "px, 0)", N));
286
- }
287
- return Object.assign({}, V, (e = {}, e[o] = T ? m + "px" : "", e[w] = D ? h + "px" : "", e.transform = "", e));
288
- }
289
- function xn(t) {
290
- var e = t.state, r = t.options, n = r.gpuAcceleration, i = n === void 0 ? !0 : n, a = r.adaptive, c = a === void 0 ? !0 : a, u = r.roundOffsets, s = u === void 0 ? !0 : u, p = {
291
- placement: te(e.placement),
292
- variation: _e(e.placement),
293
- popper: e.elements.popper,
294
- popperRect: e.rects.popper,
295
- gpuAcceleration: i,
296
- isFixed: e.options.strategy === "fixed"
297
- };
298
- e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, Ut(Object.assign({}, p, {
299
- offsets: e.modifiersData.popperOffsets,
300
- position: e.options.strategy,
301
- adaptive: c,
302
- roundOffsets: s
303
- })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, Ut(Object.assign({}, p, {
304
- offsets: e.modifiersData.arrow,
305
- position: "absolute",
306
- adaptive: !1,
307
- roundOffsets: s
308
- })))), e.attributes.popper = Object.assign({}, e.attributes.popper, {
309
- "data-popper-placement": e.placement
310
- });
311
- }
312
- const Dn = {
313
- name: "computeStyles",
314
- enabled: !0,
315
- phase: "beforeWrite",
316
- fn: xn,
317
- data: {}
318
- };
319
- var nt = {
320
- passive: !0
321
- };
322
- function Tn(t) {
323
- var e = t.state, r = t.instance, n = t.options, i = n.scroll, a = i === void 0 ? !0 : i, c = n.resize, u = c === void 0 ? !0 : c, s = q(e.elements.popper), p = [].concat(e.scrollParents.reference, e.scrollParents.popper);
324
- return a && p.forEach(function(d) {
325
- d.addEventListener("scroll", r.update, nt);
326
- }), u && s.addEventListener("resize", r.update, nt), function() {
327
- a && p.forEach(function(d) {
328
- d.removeEventListener("scroll", r.update, nt);
329
- }), u && s.removeEventListener("resize", r.update, nt);
330
- };
331
- }
332
- const Cn = {
333
- name: "eventListeners",
334
- enabled: !0,
335
- phase: "write",
336
- fn: function() {
337
- },
338
- effect: Tn,
339
- data: {}
340
- };
341
- var An = {
342
- left: "right",
343
- right: "left",
344
- bottom: "top",
345
- top: "bottom"
346
- };
347
- function ot(t) {
348
- return t.replace(/left|right|bottom|top/g, function(e) {
349
- return An[e];
350
- });
351
- }
352
- var _n = {
353
- start: "end",
354
- end: "start"
355
- };
356
- function Ft(t) {
357
- return t.replace(/start|end/g, function(e) {
358
- return _n[e];
359
- });
360
- }
361
- function Vt(t) {
362
- var e = q(t), r = e.pageXOffset, n = e.pageYOffset;
363
- return {
364
- scrollLeft: r,
365
- scrollTop: n
366
- };
367
- }
368
- function jt(t) {
369
- return Ae(de(t)).left + Vt(t).scrollLeft;
370
- }
371
- function Rn(t, e) {
372
- var r = q(t), n = de(t), i = r.visualViewport, a = n.clientWidth, c = n.clientHeight, u = 0, s = 0;
373
- if (i) {
374
- a = i.width, c = i.height;
375
- var p = mr();
376
- (p || !p && e === "fixed") && (u = i.offsetLeft, s = i.offsetTop);
377
- }
378
- return {
379
- width: a,
380
- height: c,
381
- x: u + jt(t),
382
- y: s
383
- };
384
- }
385
- function Ln(t) {
386
- var e, r = de(t), n = Vt(t), i = (e = t.ownerDocument) == null ? void 0 : e.body, a = ye(r.scrollWidth, r.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), c = ye(r.scrollHeight, r.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), u = -n.scrollLeft + jt(t), s = -n.scrollTop;
387
- return ue(i || r).direction === "rtl" && (u += ye(r.clientWidth, i ? i.clientWidth : 0) - a), {
388
- width: a,
389
- height: c,
390
- x: u,
391
- y: s
392
- };
393
- }
394
- function Bt(t) {
395
- var e = ue(t), r = e.overflow, n = e.overflowX, i = e.overflowY;
396
- return /auto|scroll|overlay|hidden/.test(r + i + n);
397
- }
398
- function wr(t) {
399
- return ["html", "body", "#document"].indexOf(re(t)) >= 0 ? t.ownerDocument.body : K(t) && Bt(t) ? t : wr(ut(t));
400
- }
401
- function Pe(t, e) {
402
- var r;
403
- e === void 0 && (e = []);
404
- var n = wr(t), i = n === ((r = t.ownerDocument) == null ? void 0 : r.body), a = q(n), c = i ? [a].concat(a.visualViewport || [], Bt(n) ? n : []) : n, u = e.concat(c);
405
- return i ? u : (
406
- // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
407
- u.concat(Pe(ut(c)))
408
- );
409
- }
410
- function wt(t) {
411
- return Object.assign({}, t, {
412
- left: t.x,
413
- top: t.y,
414
- right: t.x + t.width,
415
- bottom: t.y + t.height
416
- });
417
- }
418
- function Mn(t, e) {
419
- var r = Ae(t, !1, e === "fixed");
420
- return r.top = r.top + t.clientTop, r.left = r.left + t.clientLeft, r.bottom = r.top + t.clientHeight, r.right = r.left + t.clientWidth, r.width = t.clientWidth, r.height = t.clientHeight, r.x = r.left, r.y = r.top, r;
421
- }
422
- function kt(t, e, r) {
423
- return e === pr ? wt(Rn(t, r)) : ge(e) ? Mn(e, r) : wt(Ln(de(t)));
424
- }
425
- function Nn(t) {
426
- var e = Pe(ut(t)), r = ["absolute", "fixed"].indexOf(ue(t).position) >= 0, n = r && K(t) ? ke(t) : t;
427
- return ge(n) ? e.filter(function(i) {
428
- return ge(i) && yr(i, n) && re(i) !== "body";
429
- }) : [];
430
- }
431
- function Vn(t, e, r, n) {
432
- var i = e === "clippingParents" ? Nn(t) : [].concat(e), a = [].concat(i, [r]), c = a[0], u = a.reduce(function(s, p) {
433
- var d = kt(t, p, n);
434
- return s.top = ye(d.top, s.top), s.right = at(d.right, s.right), s.bottom = at(d.bottom, s.bottom), s.left = ye(d.left, s.left), s;
435
- }, kt(t, c, n));
436
- return u.width = u.right - u.left, u.height = u.bottom - u.top, u.x = u.left, u.y = u.top, u;
437
- }
438
- function Or(t) {
439
- var e = t.reference, r = t.element, n = t.placement, i = n ? te(n) : null, a = n ? _e(n) : null, c = e.x + e.width / 2 - r.width / 2, u = e.y + e.height / 2 - r.height / 2, s;
440
- switch (i) {
441
- case U:
442
- s = {
443
- x: c,
444
- y: e.y - r.height
445
- };
446
- break;
447
- case G:
448
- s = {
449
- x: c,
450
- y: e.y + e.height
451
- };
452
- break;
453
- case Y:
454
- s = {
455
- x: e.x + e.width,
456
- y: u
457
- };
458
- break;
459
- case F:
460
- s = {
461
- x: e.x - r.width,
462
- y: u
463
- };
464
- break;
465
- default:
466
- s = {
467
- x: e.x,
468
- y: e.y
469
- };
470
- }
471
- var p = i ? Nt(i) : null;
472
- if (p != null) {
473
- var d = p === "y" ? "height" : "width";
474
- switch (a) {
475
- case Te:
476
- s[p] = s[p] - (e[d] / 2 - r[d] / 2);
477
- break;
478
- case He:
479
- s[p] = s[p] + (e[d] / 2 - r[d] / 2);
480
- break;
481
- }
482
- }
483
- return s;
484
- }
485
- function We(t, e) {
486
- e === void 0 && (e = {});
487
- var r = e, n = r.placement, i = n === void 0 ? t.placement : n, a = r.strategy, c = a === void 0 ? t.strategy : a, u = r.boundary, s = u === void 0 ? en : u, p = r.rootBoundary, d = p === void 0 ? pr : p, v = r.elementContext, y = v === void 0 ? je : v, h = r.altBoundary, b = h === void 0 ? !1 : h, m = r.padding, E = m === void 0 ? 0 : m, D = br(typeof E != "number" ? E : Er(E, Fe)), T = y === je ? tn : je, w = t.rects.popper, o = t.elements[b ? T : y], O = Vn(ge(o) ? o : o.contextElement || de(t.elements.popper), s, d, c), f = Ae(t.elements.reference), x = Or({
488
- reference: f,
489
- element: w,
490
- placement: i
491
- }), _ = wt(Object.assign({}, w, x)), C = y === je ? _ : f, L = {
492
- top: O.top - C.top + D.top,
493
- bottom: C.bottom - O.bottom + D.bottom,
494
- left: O.left - C.left + D.left,
495
- right: C.right - O.right + D.right
496
- }, V = t.modifiersData.offset;
497
- if (y === je && V) {
498
- var M = V[i];
499
- Object.keys(L).forEach(function(N) {
500
- var I = [Y, G].indexOf(N) >= 0 ? 1 : -1, W = [U, G].indexOf(N) >= 0 ? "y" : "x";
501
- L[N] += M[W] * I;
502
- });
503
- }
504
- return L;
505
- }
506
- function jn(t, e) {
507
- e === void 0 && (e = {});
508
- var r = e, n = r.placement, i = r.boundary, a = r.rootBoundary, c = r.padding, u = r.flipVariations, s = r.allowedAutoPlacements, p = s === void 0 ? vr : s, d = _e(n), v = d ? u ? Wt : Wt.filter(function(b) {
509
- return _e(b) === d;
510
- }) : Fe, y = v.filter(function(b) {
511
- return p.indexOf(b) >= 0;
512
- });
513
- y.length === 0 && (y = v);
514
- var h = y.reduce(function(b, m) {
515
- return b[m] = We(t, {
516
- placement: m,
517
- boundary: i,
518
- rootBoundary: a,
519
- padding: c
520
- })[te(m)], b;
521
- }, {});
522
- return Object.keys(h).sort(function(b, m) {
523
- return h[b] - h[m];
524
- });
525
- }
526
- function Bn(t) {
527
- if (te(t) === Rt)
528
- return [];
529
- var e = ot(t);
530
- return [Ft(t), e, Ft(e)];
531
- }
532
- function Pn(t) {
533
- var e = t.state, r = t.options, n = t.name;
534
- if (!e.modifiersData[n]._skip) {
535
- for (var i = r.mainAxis, a = i === void 0 ? !0 : i, c = r.altAxis, u = c === void 0 ? !0 : c, s = r.fallbackPlacements, p = r.padding, d = r.boundary, v = r.rootBoundary, y = r.altBoundary, h = r.flipVariations, b = h === void 0 ? !0 : h, m = r.allowedAutoPlacements, E = e.options.placement, D = te(E), T = D === E, w = s || (T || !b ? [ot(E)] : Bn(E)), o = [E].concat(w).reduce(function(ne, X) {
536
- return ne.concat(te(X) === Rt ? jn(e, {
537
- placement: X,
538
- boundary: d,
539
- rootBoundary: v,
540
- padding: p,
541
- flipVariations: b,
542
- allowedAutoPlacements: m
543
- }) : X);
544
- }, []), O = e.rects.reference, f = e.rects.popper, x = /* @__PURE__ */ new Map(), _ = !0, C = o[0], L = 0; L < o.length; L++) {
545
- var V = o[L], M = te(V), N = _e(V) === Te, I = [U, G].indexOf(M) >= 0, W = I ? "width" : "height", j = We(e, {
546
- placement: V,
547
- boundary: d,
548
- rootBoundary: v,
549
- altBoundary: y,
550
- padding: p
551
- }), B = I ? N ? Y : F : N ? G : U;
552
- O[W] > f[W] && (B = ot(B));
553
- var H = ot(B), J = [];
554
- if (a && J.push(j[M] <= 0), u && J.push(j[B] <= 0, j[H] <= 0), J.every(function(ne) {
555
- return ne;
556
- })) {
557
- C = V, _ = !1;
558
- break;
559
- }
560
- x.set(V, J);
561
- }
562
- if (_)
563
- for (var Q = b ? 3 : 1, fe = function(X) {
564
- var ie = o.find(function(be) {
565
- var oe = x.get(be);
566
- if (oe)
567
- return oe.slice(0, X).every(function(Ee) {
568
- return Ee;
569
- });
570
- });
571
- if (ie)
572
- return C = ie, "break";
573
- }, Z = Q; Z > 0; Z--) {
574
- var pe = fe(Z);
575
- if (pe === "break") break;
576
- }
577
- e.placement !== C && (e.modifiersData[n]._skip = !0, e.placement = C, e.reset = !0);
578
- }
579
- }
580
- const In = {
581
- name: "flip",
582
- enabled: !0,
583
- phase: "main",
584
- fn: Pn,
585
- requiresIfExists: ["offset"],
586
- data: {
587
- _skip: !1
588
- }
589
- };
590
- function qt(t, e, r) {
591
- return r === void 0 && (r = {
592
- x: 0,
593
- y: 0
594
- }), {
595
- top: t.top - e.height - r.y,
596
- right: t.right - e.width + r.x,
597
- bottom: t.bottom - e.height + r.y,
598
- left: t.left - e.width - r.x
599
- };
600
- }
601
- function zt(t) {
602
- return [U, Y, G, F].some(function(e) {
603
- return t[e] >= 0;
604
- });
605
- }
606
- function Hn(t) {
607
- var e = t.state, r = t.name, n = e.rects.reference, i = e.rects.popper, a = e.modifiersData.preventOverflow, c = We(e, {
608
- elementContext: "reference"
609
- }), u = We(e, {
610
- altBoundary: !0
611
- }), s = qt(c, n), p = qt(u, i, a), d = zt(s), v = zt(p);
612
- e.modifiersData[r] = {
613
- referenceClippingOffsets: s,
614
- popperEscapeOffsets: p,
615
- isReferenceHidden: d,
616
- hasPopperEscaped: v
617
- }, e.attributes.popper = Object.assign({}, e.attributes.popper, {
618
- "data-popper-reference-hidden": d,
619
- "data-popper-escaped": v
620
- });
621
- }
622
- const Wn = {
623
- name: "hide",
624
- enabled: !0,
625
- phase: "main",
626
- requiresIfExists: ["preventOverflow"],
627
- fn: Hn
628
- };
629
- function $n(t, e, r) {
630
- var n = te(t), i = [F, U].indexOf(n) >= 0 ? -1 : 1, a = typeof r == "function" ? r(Object.assign({}, e, {
631
- placement: t
632
- })) : r, c = a[0], u = a[1];
633
- return c = c || 0, u = (u || 0) * i, [F, Y].indexOf(n) >= 0 ? {
634
- x: u,
635
- y: c
636
- } : {
637
- x: c,
638
- y: u
639
- };
640
- }
641
- function Un(t) {
642
- var e = t.state, r = t.options, n = t.name, i = r.offset, a = i === void 0 ? [0, 0] : i, c = vr.reduce(function(d, v) {
643
- return d[v] = $n(v, e.rects, a), d;
644
- }, {}), u = c[e.placement], s = u.x, p = u.y;
645
- e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += s, e.modifiersData.popperOffsets.y += p), e.modifiersData[n] = c;
646
- }
647
- const Fn = {
648
- name: "offset",
649
- enabled: !0,
650
- phase: "main",
651
- requires: ["popperOffsets"],
652
- fn: Un
653
- };
654
- function kn(t) {
655
- var e = t.state, r = t.name;
656
- e.modifiersData[r] = Or({
657
- reference: e.rects.reference,
658
- element: e.rects.popper,
659
- placement: e.placement
660
- });
661
- }
662
- const qn = {
663
- name: "popperOffsets",
664
- enabled: !0,
665
- phase: "read",
666
- fn: kn,
667
- data: {}
668
- };
669
- function zn(t) {
670
- return t === "x" ? "y" : "x";
671
- }
672
- function Kn(t) {
673
- var e = t.state, r = t.options, n = t.name, i = r.mainAxis, a = i === void 0 ? !0 : i, c = r.altAxis, u = c === void 0 ? !1 : c, s = r.boundary, p = r.rootBoundary, d = r.altBoundary, v = r.padding, y = r.tether, h = y === void 0 ? !0 : y, b = r.tetherOffset, m = b === void 0 ? 0 : b, E = We(e, {
674
- boundary: s,
675
- rootBoundary: p,
676
- padding: v,
677
- altBoundary: d
678
- }), D = te(e.placement), T = _e(e.placement), w = !T, o = Nt(D), O = zn(o), f = e.modifiersData.popperOffsets, x = e.rects.reference, _ = e.rects.popper, C = typeof m == "function" ? m(Object.assign({}, e.rects, {
679
- placement: e.placement
680
- })) : m, L = typeof C == "number" ? {
681
- mainAxis: C,
682
- altAxis: C
683
- } : Object.assign({
684
- mainAxis: 0,
685
- altAxis: 0
686
- }, C), V = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, M = {
687
- x: 0,
688
- y: 0
689
- };
690
- if (f) {
691
- if (a) {
692
- var N, I = o === "y" ? U : F, W = o === "y" ? G : Y, j = o === "y" ? "height" : "width", B = f[o], H = B + E[I], J = B - E[W], Q = h ? -_[j] / 2 : 0, fe = T === Te ? x[j] : _[j], Z = T === Te ? -_[j] : -x[j], pe = e.elements.arrow, ne = h && pe ? Mt(pe) : {
693
- width: 0,
694
- height: 0
695
- }, X = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : gr(), ie = X[I], be = X[W], oe = Be(0, x[j], ne[j]), Ee = w ? x[j] / 2 - Q - oe - ie - L.mainAxis : fe - oe - ie - L.mainAxis, ce = w ? -x[j] / 2 + Q + oe + be + L.mainAxis : Z + oe + be + L.mainAxis, we = e.elements.arrow && ke(e.elements.arrow), ze = we ? o === "y" ? we.clientTop || 0 : we.clientLeft || 0 : 0, Re = (N = V == null ? void 0 : V[o]) != null ? N : 0, Ke = B + Ee - Re - ze, Ge = B + ce - Re, Le = Be(h ? at(H, Ke) : H, B, h ? ye(J, Ge) : J);
696
- f[o] = Le, M[o] = Le - B;
697
- }
698
- if (u) {
699
- var Me, Ye = o === "x" ? U : F, Xe = o === "x" ? G : Y, ae = f[O], le = O === "y" ? "height" : "width", Ne = ae + E[Ye], ve = ae - E[Xe], Ve = [U, F].indexOf(D) !== -1, Je = (Me = V == null ? void 0 : V[O]) != null ? Me : 0, Qe = Ve ? Ne : ae - x[le] - _[le] - Je + L.altAxis, Ze = Ve ? ae + x[le] + _[le] - Je - L.altAxis : ve, et = h && Ve ? yn(Qe, ae, Ze) : Be(h ? Qe : Ne, ae, h ? Ze : ve);
700
- f[O] = et, M[O] = et - ae;
701
- }
702
- e.modifiersData[n] = M;
703
- }
704
- }
705
- const Gn = {
706
- name: "preventOverflow",
707
- enabled: !0,
708
- phase: "main",
709
- fn: Kn,
710
- requiresIfExists: ["offset"]
711
- };
712
- function Yn(t) {
713
- return {
714
- scrollLeft: t.scrollLeft,
715
- scrollTop: t.scrollTop
716
- };
717
- }
718
- function Xn(t) {
719
- return t === q(t) || !K(t) ? Vt(t) : Yn(t);
720
- }
721
- function Jn(t) {
722
- var e = t.getBoundingClientRect(), r = Ce(e.width) / t.offsetWidth || 1, n = Ce(e.height) / t.offsetHeight || 1;
723
- return r !== 1 || n !== 1;
724
- }
725
- function Qn(t, e, r) {
726
- r === void 0 && (r = !1);
727
- var n = K(e), i = K(e) && Jn(e), a = de(e), c = Ae(t, i, r), u = {
728
- scrollLeft: 0,
729
- scrollTop: 0
730
- }, s = {
731
- x: 0,
732
- y: 0
733
- };
734
- return (n || !n && !r) && ((re(e) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
735
- Bt(a)) && (u = Xn(e)), K(e) ? (s = Ae(e, !0), s.x += e.clientLeft, s.y += e.clientTop) : a && (s.x = jt(a))), {
736
- x: c.left + u.scrollLeft - s.x,
737
- y: c.top + u.scrollTop - s.y,
738
- width: c.width,
739
- height: c.height
740
- };
741
- }
742
- function Zn(t) {
743
- var e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), n = [];
744
- t.forEach(function(a) {
745
- e.set(a.name, a);
746
- });
747
- function i(a) {
748
- r.add(a.name);
749
- var c = [].concat(a.requires || [], a.requiresIfExists || []);
750
- c.forEach(function(u) {
751
- if (!r.has(u)) {
752
- var s = e.get(u);
753
- s && i(s);
754
- }
755
- }), n.push(a);
756
- }
757
- return t.forEach(function(a) {
758
- r.has(a.name) || i(a);
759
- }), n;
760
- }
761
- function ei(t) {
762
- var e = Zn(t);
763
- return fn.reduce(function(r, n) {
764
- return r.concat(e.filter(function(i) {
765
- return i.phase === n;
766
- }));
767
- }, []);
768
- }
769
- function ti(t) {
770
- var e;
771
- return function() {
772
- return e || (e = new Promise(function(r) {
773
- Promise.resolve().then(function() {
774
- e = void 0, r(t());
775
- });
776
- })), e;
777
- };
778
- }
779
- function ri(t) {
780
- var e = t.reduce(function(r, n) {
781
- var i = r[n.name];
782
- return r[n.name] = i ? Object.assign({}, i, n, {
783
- options: Object.assign({}, i.options, n.options),
784
- data: Object.assign({}, i.data, n.data)
785
- }) : n, r;
786
- }, {});
787
- return Object.keys(e).map(function(r) {
788
- return e[r];
789
- });
790
- }
791
- var Kt = {
792
- placement: "bottom",
793
- modifiers: [],
794
- strategy: "absolute"
795
- };
796
- function Gt() {
797
- for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++)
798
- e[r] = arguments[r];
799
- return !e.some(function(n) {
800
- return !(n && typeof n.getBoundingClientRect == "function");
801
- });
802
- }
803
- function ni(t) {
804
- t === void 0 && (t = {});
805
- var e = t, r = e.defaultModifiers, n = r === void 0 ? [] : r, i = e.defaultOptions, a = i === void 0 ? Kt : i;
806
- return function(u, s, p) {
807
- p === void 0 && (p = a);
808
- var d = {
809
- placement: "bottom",
810
- orderedModifiers: [],
811
- options: Object.assign({}, Kt, a),
812
- modifiersData: {},
813
- elements: {
814
- reference: u,
815
- popper: s
816
- },
817
- attributes: {},
818
- styles: {}
819
- }, v = [], y = !1, h = {
820
- state: d,
821
- setOptions: function(D) {
822
- var T = typeof D == "function" ? D(d.options) : D;
823
- m(), d.options = Object.assign({}, a, d.options, T), d.scrollParents = {
824
- reference: ge(u) ? Pe(u) : u.contextElement ? Pe(u.contextElement) : [],
825
- popper: Pe(s)
826
- };
827
- var w = ei(ri([].concat(n, d.options.modifiers)));
828
- return d.orderedModifiers = w.filter(function(o) {
829
- return o.enabled;
830
- }), b(), h.update();
831
- },
832
- // Sync update – it will always be executed, even if not necessary. This
833
- // is useful for low frequency updates where sync behavior simplifies the
834
- // logic.
835
- // For high frequency updates (e.g. `resize` and `scroll` events), always
836
- // prefer the async Popper#update method
837
- forceUpdate: function() {
838
- if (!y) {
839
- var D = d.elements, T = D.reference, w = D.popper;
840
- if (Gt(T, w)) {
841
- d.rects = {
842
- reference: Qn(T, ke(w), d.options.strategy === "fixed"),
843
- popper: Mt(w)
844
- }, d.reset = !1, d.placement = d.options.placement, d.orderedModifiers.forEach(function(L) {
845
- return d.modifiersData[L.name] = Object.assign({}, L.data);
846
- });
847
- for (var o = 0; o < d.orderedModifiers.length; o++) {
848
- if (d.reset === !0) {
849
- d.reset = !1, o = -1;
850
- continue;
851
- }
852
- var O = d.orderedModifiers[o], f = O.fn, x = O.options, _ = x === void 0 ? {} : x, C = O.name;
853
- typeof f == "function" && (d = f({
854
- state: d,
855
- options: _,
856
- name: C,
857
- instance: h
858
- }) || d);
859
- }
860
- }
861
- }
862
- },
863
- // Async and optimistically optimized update – it will not be executed if
864
- // not necessary (debounced to run at most once-per-tick)
865
- update: ti(function() {
866
- return new Promise(function(E) {
867
- h.forceUpdate(), E(d);
868
- });
869
- }),
870
- destroy: function() {
871
- m(), y = !0;
872
- }
873
- };
874
- if (!Gt(u, s))
875
- return h;
876
- h.setOptions(p).then(function(E) {
877
- !y && p.onFirstUpdate && p.onFirstUpdate(E);
878
- });
879
- function b() {
880
- d.orderedModifiers.forEach(function(E) {
881
- var D = E.name, T = E.options, w = T === void 0 ? {} : T, o = E.effect;
882
- if (typeof o == "function") {
883
- var O = o({
884
- state: d,
885
- name: D,
886
- instance: h,
887
- options: w
888
- }), f = function() {
889
- };
890
- v.push(O || f);
891
- }
892
- });
893
- }
894
- function m() {
895
- v.forEach(function(E) {
896
- return E();
897
- }), v = [];
898
- }
899
- return h;
900
- };
901
- }
902
- var ii = [Cn, qn, Dn, hr, Fn, In, Gn, wn, Wn], oi = /* @__PURE__ */ ni({
903
- defaultModifiers: ii
904
- }), ai = "tippy-box", Sr = "tippy-content", si = "tippy-backdrop", xr = "tippy-arrow", Dr = "tippy-svg-arrow", me = {
905
- passive: !0,
906
- capture: !0
907
- }, Tr = function() {
908
- return document.body;
909
- };
910
- function ui(t, e) {
911
- return {}.hasOwnProperty.call(t, e);
912
- }
913
- function ft(t, e, r) {
914
- if (Array.isArray(t)) {
915
- var n = t[e];
916
- return n ?? (Array.isArray(r) ? r[e] : r);
917
- }
918
- return t;
919
- }
920
- function Pt(t, e) {
921
- var r = {}.toString.call(t);
922
- return r.indexOf("[object") === 0 && r.indexOf(e + "]") > -1;
923
- }
924
- function Cr(t, e) {
925
- return typeof t == "function" ? t.apply(void 0, e) : t;
926
- }
927
- function Yt(t, e) {
928
- if (e === 0)
929
- return t;
930
- var r;
931
- return function(n) {
932
- clearTimeout(r), r = setTimeout(function() {
933
- t(n);
934
- }, e);
935
- };
936
- }
937
- function ci(t, e) {
938
- var r = Object.assign({}, t);
939
- return e.forEach(function(n) {
940
- delete r[n];
941
- }), r;
942
- }
943
- function li(t) {
944
- return t.split(/\s+/).filter(Boolean);
945
- }
946
- function De(t) {
947
- return [].concat(t);
948
- }
949
- function Xt(t, e) {
950
- t.indexOf(e) === -1 && t.push(e);
951
- }
952
- function di(t) {
953
- return t.filter(function(e, r) {
954
- return t.indexOf(e) === r;
955
- });
956
- }
957
- function fi(t) {
958
- return t.split("-")[0];
959
- }
960
- function st(t) {
961
- return [].slice.call(t);
962
- }
963
- function Jt(t) {
964
- return Object.keys(t).reduce(function(e, r) {
965
- return t[r] !== void 0 && (e[r] = t[r]), e;
966
- }, {});
967
- }
968
- function Ie() {
969
- return document.createElement("div");
970
- }
971
- function $e(t) {
972
- return ["Element", "Fragment"].some(function(e) {
973
- return Pt(t, e);
974
- });
975
- }
976
- function pi(t) {
977
- return Pt(t, "NodeList");
978
- }
979
- function vi(t) {
980
- return Pt(t, "MouseEvent");
981
- }
982
- function hi(t) {
983
- return !!(t && t._tippy && t._tippy.reference === t);
984
- }
985
- function mi(t) {
986
- return $e(t) ? [t] : pi(t) ? st(t) : Array.isArray(t) ? t : st(document.querySelectorAll(t));
987
- }
988
- function pt(t, e) {
989
- t.forEach(function(r) {
990
- r && (r.style.transitionDuration = e + "ms");
991
- });
992
- }
993
- function Qt(t, e) {
994
- t.forEach(function(r) {
995
- r && r.setAttribute("data-state", e);
996
- });
997
- }
998
- function yi(t) {
999
- var e, r = De(t), n = r[0];
1000
- return n != null && (e = n.ownerDocument) != null && e.body ? n.ownerDocument : document;
1001
- }
1002
- function gi(t, e) {
1003
- var r = e.clientX, n = e.clientY;
1004
- return t.every(function(i) {
1005
- var a = i.popperRect, c = i.popperState, u = i.props, s = u.interactiveBorder, p = fi(c.placement), d = c.modifiersData.offset;
1006
- if (!d)
1007
- return !0;
1008
- var v = p === "bottom" ? d.top.y : 0, y = p === "top" ? d.bottom.y : 0, h = p === "right" ? d.left.x : 0, b = p === "left" ? d.right.x : 0, m = a.top - n + v > s, E = n - a.bottom - y > s, D = a.left - r + h > s, T = r - a.right - b > s;
1009
- return m || E || D || T;
1010
- });
1011
- }
1012
- function vt(t, e, r) {
1013
- var n = e + "EventListener";
1014
- ["transitionend", "webkitTransitionEnd"].forEach(function(i) {
1015
- t[n](i, r);
1016
- });
1017
- }
1018
- function Zt(t, e) {
1019
- for (var r = e; r; ) {
1020
- var n;
1021
- if (t.contains(r))
1022
- return !0;
1023
- r = r.getRootNode == null || (n = r.getRootNode()) == null ? void 0 : n.host;
1024
- }
1025
- return !1;
1026
- }
1027
- var ee = {
1028
- isTouch: !1
1029
- }, er = 0;
1030
- function bi() {
1031
- ee.isTouch || (ee.isTouch = !0, window.performance && document.addEventListener("mousemove", Ar));
1032
- }
1033
- function Ar() {
1034
- var t = performance.now();
1035
- t - er < 20 && (ee.isTouch = !1, document.removeEventListener("mousemove", Ar)), er = t;
1036
- }
1037
- function Ei() {
1038
- var t = document.activeElement;
1039
- if (hi(t)) {
1040
- var e = t._tippy;
1041
- t.blur && !e.state.isVisible && t.blur();
1042
- }
1043
- }
1044
- function wi() {
1045
- document.addEventListener("touchstart", bi, me), window.addEventListener("blur", Ei);
1046
- }
1047
- var Oi = typeof window < "u" && typeof document < "u", Si = Oi ? (
1048
- // @ts-ignore
1049
- !!window.msCrypto
1050
- ) : !1;
1051
- function xe(t) {
1052
- var e = t === "destroy" ? "n already-" : " ";
1053
- return [t + "() was called on a" + e + "destroyed instance. This is a no-op but", "indicates a potential memory leak."].join(" ");
1054
- }
1055
- function tr(t) {
1056
- var e = /[ \t]{2,}/g, r = /^[ \t]*/gm;
1057
- return t.replace(e, " ").replace(r, "").trim();
1058
- }
1059
- function xi(t) {
1060
- return tr(`
1061
- %ctippy.js
1062
-
1063
- %c` + tr(t) + `
1064
-
1065
- %c👷‍ This is a development-only message. It will be removed in production.
1066
- `);
1067
- }
1068
- function _r(t) {
1069
- return [
1070
- xi(t),
1071
- // title
1072
- "color: #00C584; font-size: 1.3em; font-weight: bold;",
1073
- // message
1074
- "line-height: 1.5",
1075
- // footer
1076
- "color: #a6a095;"
1077
- ];
1078
- }
1079
- var Ue;
1080
- process.env.NODE_ENV !== "production" && Di();
1081
- function Di() {
1082
- Ue = /* @__PURE__ */ new Set();
1083
- }
1084
- function se(t, e) {
1085
- if (t && !Ue.has(e)) {
1086
- var r;
1087
- Ue.add(e), (r = console).warn.apply(r, _r(e));
1088
- }
1089
- }
1090
- function Ot(t, e) {
1091
- if (t && !Ue.has(e)) {
1092
- var r;
1093
- Ue.add(e), (r = console).error.apply(r, _r(e));
1094
- }
1095
- }
1096
- function Ti(t) {
1097
- var e = !t, r = Object.prototype.toString.call(t) === "[object Object]" && !t.addEventListener;
1098
- Ot(e, ["tippy() was passed", "`" + String(t) + "`", "as its targets (first) argument. Valid types are: String, Element,", "Element[], or NodeList."].join(" ")), Ot(r, ["tippy() was passed a plain object which is not supported as an argument", "for virtual positioning. Use props.getReferenceClientRect instead."].join(" "));
1099
- }
1100
- var Rr = {
1101
- animateFill: !1,
1102
- followCursor: !1,
1103
- inlinePositioning: !1,
1104
- sticky: !1
1105
- }, Ci = {
1106
- allowHTML: !1,
1107
- animation: "fade",
1108
- arrow: !0,
1109
- content: "",
1110
- inertia: !1,
1111
- maxWidth: 350,
1112
- role: "tooltip",
1113
- theme: "",
1114
- zIndex: 9999
1115
- }, k = Object.assign({
1116
- appendTo: Tr,
1117
- aria: {
1118
- content: "auto",
1119
- expanded: "auto"
1120
- },
1121
- delay: 0,
1122
- duration: [300, 250],
1123
- getReferenceClientRect: null,
1124
- hideOnClick: !0,
1125
- ignoreAttributes: !1,
1126
- interactive: !1,
1127
- interactiveBorder: 2,
1128
- interactiveDebounce: 0,
1129
- moveTransition: "",
1130
- offset: [0, 10],
1131
- onAfterUpdate: function() {
1132
- },
1133
- onBeforeUpdate: function() {
1134
- },
1135
- onCreate: function() {
1136
- },
1137
- onDestroy: function() {
1138
- },
1139
- onHidden: function() {
1140
- },
1141
- onHide: function() {
1142
- },
1143
- onMount: function() {
1144
- },
1145
- onShow: function() {
1146
- },
1147
- onShown: function() {
1148
- },
1149
- onTrigger: function() {
1150
- },
1151
- onUntrigger: function() {
1152
- },
1153
- onClickOutside: function() {
1154
- },
1155
- placement: "top",
1156
- plugins: [],
1157
- popperOptions: {},
1158
- render: null,
1159
- showOnCreate: !1,
1160
- touch: !0,
1161
- trigger: "mouseenter focus",
1162
- triggerTarget: null
1163
- }, Rr, Ci), Ai = Object.keys(k), _i = function(e) {
1164
- process.env.NODE_ENV !== "production" && Mr(e, []);
1165
- var r = Object.keys(e);
1166
- r.forEach(function(n) {
1167
- k[n] = e[n];
1168
- });
1169
- };
1170
- function Lr(t) {
1171
- var e = t.plugins || [], r = e.reduce(function(n, i) {
1172
- var a = i.name, c = i.defaultValue;
1173
- if (a) {
1174
- var u;
1175
- n[a] = t[a] !== void 0 ? t[a] : (u = k[a]) != null ? u : c;
1176
- }
1177
- return n;
1178
- }, {});
1179
- return Object.assign({}, t, r);
1180
- }
1181
- function Ri(t, e) {
1182
- var r = e ? Object.keys(Lr(Object.assign({}, k, {
1183
- plugins: e
1184
- }))) : Ai, n = r.reduce(function(i, a) {
1185
- var c = (t.getAttribute("data-tippy-" + a) || "").trim();
1186
- if (!c)
1187
- return i;
1188
- if (a === "content")
1189
- i[a] = c;
1190
- else
1191
- try {
1192
- i[a] = JSON.parse(c);
1193
- } catch {
1194
- i[a] = c;
1195
- }
1196
- return i;
1197
- }, {});
1198
- return n;
1199
- }
1200
- function rr(t, e) {
1201
- var r = Object.assign({}, e, {
1202
- content: Cr(e.content, [t])
1203
- }, e.ignoreAttributes ? {} : Ri(t, e.plugins));
1204
- return r.aria = Object.assign({}, k.aria, r.aria), r.aria = {
1205
- expanded: r.aria.expanded === "auto" ? e.interactive : r.aria.expanded,
1206
- content: r.aria.content === "auto" ? e.interactive ? null : "describedby" : r.aria.content
1207
- }, r;
1208
- }
1209
- function Mr(t, e) {
1210
- t === void 0 && (t = {}), e === void 0 && (e = []);
1211
- var r = Object.keys(t);
1212
- r.forEach(function(n) {
1213
- var i = ci(k, Object.keys(Rr)), a = !ui(i, n);
1214
- a && (a = e.filter(function(c) {
1215
- return c.name === n;
1216
- }).length === 0), se(a, ["`" + n + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", "a plugin, forgot to pass it in an array as props.plugins.", `
1217
-
1218
- `, `All props: https://atomiks.github.io/tippyjs/v6/all-props/
1219
- `, "Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "));
1220
- });
1221
- }
1222
- var Li = function() {
1223
- return "innerHTML";
1224
- };
1225
- function St(t, e) {
1226
- t[Li()] = e;
1227
- }
1228
- function nr(t) {
1229
- var e = Ie();
1230
- return t === !0 ? e.className = xr : (e.className = Dr, $e(t) ? e.appendChild(t) : St(e, t)), e;
1231
- }
1232
- function ir(t, e) {
1233
- $e(e.content) ? (St(t, ""), t.appendChild(e.content)) : typeof e.content != "function" && (e.allowHTML ? St(t, e.content) : t.textContent = e.content);
1234
- }
1235
- function xt(t) {
1236
- var e = t.firstElementChild, r = st(e.children);
1237
- return {
1238
- box: e,
1239
- content: r.find(function(n) {
1240
- return n.classList.contains(Sr);
1241
- }),
1242
- arrow: r.find(function(n) {
1243
- return n.classList.contains(xr) || n.classList.contains(Dr);
1244
- }),
1245
- backdrop: r.find(function(n) {
1246
- return n.classList.contains(si);
1247
- })
1248
- };
1249
- }
1250
- function Nr(t) {
1251
- var e = Ie(), r = Ie();
1252
- r.className = ai, r.setAttribute("data-state", "hidden"), r.setAttribute("tabindex", "-1");
1253
- var n = Ie();
1254
- n.className = Sr, n.setAttribute("data-state", "hidden"), ir(n, t.props), e.appendChild(r), r.appendChild(n), i(t.props, t.props);
1255
- function i(a, c) {
1256
- var u = xt(e), s = u.box, p = u.content, d = u.arrow;
1257
- c.theme ? s.setAttribute("data-theme", c.theme) : s.removeAttribute("data-theme"), typeof c.animation == "string" ? s.setAttribute("data-animation", c.animation) : s.removeAttribute("data-animation"), c.inertia ? s.setAttribute("data-inertia", "") : s.removeAttribute("data-inertia"), s.style.maxWidth = typeof c.maxWidth == "number" ? c.maxWidth + "px" : c.maxWidth, c.role ? s.setAttribute("role", c.role) : s.removeAttribute("role"), (a.content !== c.content || a.allowHTML !== c.allowHTML) && ir(p, t.props), c.arrow ? d ? a.arrow !== c.arrow && (s.removeChild(d), s.appendChild(nr(c.arrow))) : s.appendChild(nr(c.arrow)) : d && s.removeChild(d);
1258
- }
1259
- return {
1260
- popper: e,
1261
- onUpdate: i
1262
- };
1263
- }
1264
- Nr.$$tippy = !0;
1265
- var Mi = 1, it = [], ht = [];
1266
- function Ni(t, e) {
1267
- var r = rr(t, Object.assign({}, k, Lr(Jt(e)))), n, i, a, c = !1, u = !1, s = !1, p = !1, d, v, y, h = [], b = Yt(Ke, r.interactiveDebounce), m, E = Mi++, D = null, T = di(r.plugins), w = {
1268
- // Is the instance currently enabled?
1269
- isEnabled: !0,
1270
- // Is the tippy currently showing and not transitioning out?
1271
- isVisible: !1,
1272
- // Has the instance been destroyed?
1273
- isDestroyed: !1,
1274
- // Is the tippy currently mounted to the DOM?
1275
- isMounted: !1,
1276
- // Has the tippy finished transitioning in?
1277
- isShown: !1
1278
- }, o = {
1279
- // properties
1280
- id: E,
1281
- reference: t,
1282
- popper: Ie(),
1283
- popperInstance: D,
1284
- props: r,
1285
- state: w,
1286
- plugins: T,
1287
- // methods
1288
- clearDelayTimeouts: Qe,
1289
- setProps: Ze,
1290
- setContent: et,
1291
- show: Br,
1292
- hide: Pr,
1293
- hideWithInteractivity: Ir,
1294
- enable: Ve,
1295
- disable: Je,
1296
- unmount: Hr,
1297
- destroy: Wr
1298
- };
1299
- if (!r.render)
1300
- return process.env.NODE_ENV !== "production" && Ot(!0, "render() function has not been supplied."), o;
1301
- var O = r.render(o), f = O.popper, x = O.onUpdate;
1302
- f.setAttribute("data-tippy-root", ""), f.id = "tippy-" + o.id, o.popper = f, t._tippy = o, f._tippy = o;
1303
- var _ = T.map(function(l) {
1304
- return l.fn(o);
1305
- }), C = t.hasAttribute("aria-expanded");
1306
- return we(), Q(), B(), H("onCreate", [o]), r.showOnCreate && Ne(), f.addEventListener("mouseenter", function() {
1307
- o.props.interactive && o.state.isVisible && o.clearDelayTimeouts();
1308
- }), f.addEventListener("mouseleave", function() {
1309
- o.props.interactive && o.props.trigger.indexOf("mouseenter") >= 0 && I().addEventListener("mousemove", b);
1310
- }), o;
1311
- function L() {
1312
- var l = o.props.touch;
1313
- return Array.isArray(l) ? l : [l, 0];
1314
- }
1315
- function V() {
1316
- return L()[0] === "hold";
1317
- }
1318
- function M() {
1319
- var l;
1320
- return !!((l = o.props.render) != null && l.$$tippy);
1321
- }
1322
- function N() {
1323
- return m || t;
1324
- }
1325
- function I() {
1326
- var l = N().parentNode;
1327
- return l ? yi(l) : document;
1328
- }
1329
- function W() {
1330
- return xt(f);
1331
- }
1332
- function j(l) {
1333
- return o.state.isMounted && !o.state.isVisible || ee.isTouch || d && d.type === "focus" ? 0 : ft(o.props.delay, l ? 0 : 1, k.delay);
1334
- }
1335
- function B(l) {
1336
- l === void 0 && (l = !1), f.style.pointerEvents = o.props.interactive && !l ? "" : "none", f.style.zIndex = "" + o.props.zIndex;
1337
- }
1338
- function H(l, g, S) {
1339
- if (S === void 0 && (S = !0), _.forEach(function(A) {
1340
- A[l] && A[l].apply(A, g);
1341
- }), S) {
1342
- var R;
1343
- (R = o.props)[l].apply(R, g);
1344
- }
1345
- }
1346
- function J() {
1347
- var l = o.props.aria;
1348
- if (l.content) {
1349
- var g = "aria-" + l.content, S = f.id, R = De(o.props.triggerTarget || t);
1350
- R.forEach(function(A) {
1351
- var $ = A.getAttribute(g);
1352
- if (o.state.isVisible)
1353
- A.setAttribute(g, $ ? $ + " " + S : S);
1354
- else {
1355
- var z = $ && $.replace(S, "").trim();
1356
- z ? A.setAttribute(g, z) : A.removeAttribute(g);
1357
- }
1358
- });
1359
- }
1360
- }
1361
- function Q() {
1362
- if (!(C || !o.props.aria.expanded)) {
1363
- var l = De(o.props.triggerTarget || t);
1364
- l.forEach(function(g) {
1365
- o.props.interactive ? g.setAttribute("aria-expanded", o.state.isVisible && g === N() ? "true" : "false") : g.removeAttribute("aria-expanded");
1366
- });
1367
- }
1368
- }
1369
- function fe() {
1370
- I().removeEventListener("mousemove", b), it = it.filter(function(l) {
1371
- return l !== b;
1372
- });
1373
- }
1374
- function Z(l) {
1375
- if (!(ee.isTouch && (s || l.type === "mousedown"))) {
1376
- var g = l.composedPath && l.composedPath()[0] || l.target;
1377
- if (!(o.props.interactive && Zt(f, g))) {
1378
- if (De(o.props.triggerTarget || t).some(function(S) {
1379
- return Zt(S, g);
1380
- })) {
1381
- if (ee.isTouch || o.state.isVisible && o.props.trigger.indexOf("click") >= 0)
1382
- return;
1383
- } else
1384
- H("onClickOutside", [o, l]);
1385
- o.props.hideOnClick === !0 && (o.clearDelayTimeouts(), o.hide(), u = !0, setTimeout(function() {
1386
- u = !1;
1387
- }), o.state.isMounted || ie());
1388
- }
1389
- }
1390
- }
1391
- function pe() {
1392
- s = !0;
1393
- }
1394
- function ne() {
1395
- s = !1;
1396
- }
1397
- function X() {
1398
- var l = I();
1399
- l.addEventListener("mousedown", Z, !0), l.addEventListener("touchend", Z, me), l.addEventListener("touchstart", ne, me), l.addEventListener("touchmove", pe, me);
1400
- }
1401
- function ie() {
1402
- var l = I();
1403
- l.removeEventListener("mousedown", Z, !0), l.removeEventListener("touchend", Z, me), l.removeEventListener("touchstart", ne, me), l.removeEventListener("touchmove", pe, me);
1404
- }
1405
- function be(l, g) {
1406
- Ee(l, function() {
1407
- !o.state.isVisible && f.parentNode && f.parentNode.contains(f) && g();
1408
- });
1409
- }
1410
- function oe(l, g) {
1411
- Ee(l, g);
1412
- }
1413
- function Ee(l, g) {
1414
- var S = W().box;
1415
- function R(A) {
1416
- A.target === S && (vt(S, "remove", R), g());
1417
- }
1418
- if (l === 0)
1419
- return g();
1420
- vt(S, "remove", v), vt(S, "add", R), v = R;
1421
- }
1422
- function ce(l, g, S) {
1423
- S === void 0 && (S = !1);
1424
- var R = De(o.props.triggerTarget || t);
1425
- R.forEach(function(A) {
1426
- A.addEventListener(l, g, S), h.push({
1427
- node: A,
1428
- eventType: l,
1429
- handler: g,
1430
- options: S
1431
- });
1432
- });
1433
- }
1434
- function we() {
1435
- V() && (ce("touchstart", Re, {
1436
- passive: !0
1437
- }), ce("touchend", Ge, {
1438
- passive: !0
1439
- })), li(o.props.trigger).forEach(function(l) {
1440
- if (l !== "manual")
1441
- switch (ce(l, Re), l) {
1442
- case "mouseenter":
1443
- ce("mouseleave", Ge);
1444
- break;
1445
- case "focus":
1446
- ce(Si ? "focusout" : "blur", Le);
1447
- break;
1448
- case "focusin":
1449
- ce("focusout", Le);
1450
- break;
1451
- }
1452
- });
1453
- }
1454
- function ze() {
1455
- h.forEach(function(l) {
1456
- var g = l.node, S = l.eventType, R = l.handler, A = l.options;
1457
- g.removeEventListener(S, R, A);
1458
- }), h = [];
1459
- }
1460
- function Re(l) {
1461
- var g, S = !1;
1462
- if (!(!o.state.isEnabled || Me(l) || u)) {
1463
- var R = ((g = d) == null ? void 0 : g.type) === "focus";
1464
- d = l, m = l.currentTarget, Q(), !o.state.isVisible && vi(l) && it.forEach(function(A) {
1465
- return A(l);
1466
- }), l.type === "click" && (o.props.trigger.indexOf("mouseenter") < 0 || c) && o.props.hideOnClick !== !1 && o.state.isVisible ? S = !0 : Ne(l), l.type === "click" && (c = !S), S && !R && ve(l);
1467
- }
1468
- }
1469
- function Ke(l) {
1470
- var g = l.target, S = N().contains(g) || f.contains(g);
1471
- if (!(l.type === "mousemove" && S)) {
1472
- var R = le().concat(f).map(function(A) {
1473
- var $, z = A._tippy, Oe = ($ = z.popperInstance) == null ? void 0 : $.state;
1474
- return Oe ? {
1475
- popperRect: A.getBoundingClientRect(),
1476
- popperState: Oe,
1477
- props: r
1478
- } : null;
1479
- }).filter(Boolean);
1480
- gi(R, l) && (fe(), ve(l));
1481
- }
1482
- }
1483
- function Ge(l) {
1484
- var g = Me(l) || o.props.trigger.indexOf("click") >= 0 && c;
1485
- if (!g) {
1486
- if (o.props.interactive) {
1487
- o.hideWithInteractivity(l);
1488
- return;
1489
- }
1490
- ve(l);
1491
- }
1492
- }
1493
- function Le(l) {
1494
- o.props.trigger.indexOf("focusin") < 0 && l.target !== N() || o.props.interactive && l.relatedTarget && f.contains(l.relatedTarget) || ve(l);
1495
- }
1496
- function Me(l) {
1497
- return ee.isTouch ? V() !== l.type.indexOf("touch") >= 0 : !1;
1498
- }
1499
- function Ye() {
1500
- Xe();
1501
- var l = o.props, g = l.popperOptions, S = l.placement, R = l.offset, A = l.getReferenceClientRect, $ = l.moveTransition, z = M() ? xt(f).arrow : null, Oe = A ? {
1502
- getBoundingClientRect: A,
1503
- contextElement: A.contextElement || N()
1504
- } : t, Ht = {
1505
- name: "$$tippy",
1506
- enabled: !0,
1507
- phase: "beforeWrite",
1508
- requires: ["computeStyles"],
1509
- fn: function(tt) {
1510
- var Se = tt.state;
1511
- if (M()) {
1512
- var $r = W(), dt = $r.box;
1513
- ["placement", "reference-hidden", "escaped"].forEach(function(rt) {
1514
- rt === "placement" ? dt.setAttribute("data-placement", Se.placement) : Se.attributes.popper["data-popper-" + rt] ? dt.setAttribute("data-" + rt, "") : dt.removeAttribute("data-" + rt);
1515
- }), Se.attributes.popper = {};
1516
- }
1517
- }
1518
- }, he = [{
1519
- name: "offset",
1520
- options: {
1521
- offset: R
1522
- }
1523
- }, {
1524
- name: "preventOverflow",
1525
- options: {
1526
- padding: {
1527
- top: 2,
1528
- bottom: 2,
1529
- left: 5,
1530
- right: 5
1531
- }
1532
- }
1533
- }, {
1534
- name: "flip",
1535
- options: {
1536
- padding: 5
1537
- }
1538
- }, {
1539
- name: "computeStyles",
1540
- options: {
1541
- adaptive: !$
1542
- }
1543
- }, Ht];
1544
- M() && z && he.push({
1545
- name: "arrow",
1546
- options: {
1547
- element: z,
1548
- padding: 3
1549
- }
1550
- }), he.push.apply(he, (g == null ? void 0 : g.modifiers) || []), o.popperInstance = oi(Oe, f, Object.assign({}, g, {
1551
- placement: S,
1552
- onFirstUpdate: y,
1553
- modifiers: he
1554
- }));
1555
- }
1556
- function Xe() {
1557
- o.popperInstance && (o.popperInstance.destroy(), o.popperInstance = null);
1558
- }
1559
- function ae() {
1560
- var l = o.props.appendTo, g, S = N();
1561
- o.props.interactive && l === Tr || l === "parent" ? g = S.parentNode : g = Cr(l, [S]), g.contains(f) || g.appendChild(f), o.state.isMounted = !0, Ye(), process.env.NODE_ENV !== "production" && se(o.props.interactive && l === k.appendTo && S.nextElementSibling !== f, ["Interactive tippy element may not be accessible via keyboard", "navigation because it is not directly after the reference element", "in the DOM source order.", `
1562
-
1563
- `, "Using a wrapper <div> or <span> tag around the reference element", "solves this by creating a new parentNode context.", `
1564
-
1565
- `, "Specifying `appendTo: document.body` silences this warning, but it", "assumes you are using a focus management solution to handle", "keyboard navigation.", `
1566
-
1567
- `, "See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "));
1568
- }
1569
- function le() {
1570
- return st(f.querySelectorAll("[data-tippy-root]"));
1571
- }
1572
- function Ne(l) {
1573
- o.clearDelayTimeouts(), l && H("onTrigger", [o, l]), X();
1574
- var g = j(!0), S = L(), R = S[0], A = S[1];
1575
- ee.isTouch && R === "hold" && A && (g = A), g ? n = setTimeout(function() {
1576
- o.show();
1577
- }, g) : o.show();
1578
- }
1579
- function ve(l) {
1580
- if (o.clearDelayTimeouts(), H("onUntrigger", [o, l]), !o.state.isVisible) {
1581
- ie();
1582
- return;
1583
- }
1584
- if (!(o.props.trigger.indexOf("mouseenter") >= 0 && o.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(l.type) >= 0 && c)) {
1585
- var g = j(!1);
1586
- g ? i = setTimeout(function() {
1587
- o.state.isVisible && o.hide();
1588
- }, g) : a = requestAnimationFrame(function() {
1589
- o.hide();
1590
- });
1591
- }
1592
- }
1593
- function Ve() {
1594
- o.state.isEnabled = !0;
1595
- }
1596
- function Je() {
1597
- o.hide(), o.state.isEnabled = !1;
1598
- }
1599
- function Qe() {
1600
- clearTimeout(n), clearTimeout(i), cancelAnimationFrame(a);
1601
- }
1602
- function Ze(l) {
1603
- if (process.env.NODE_ENV !== "production" && se(o.state.isDestroyed, xe("setProps")), !o.state.isDestroyed) {
1604
- H("onBeforeUpdate", [o, l]), ze();
1605
- var g = o.props, S = rr(t, Object.assign({}, g, Jt(l), {
1606
- ignoreAttributes: !0
1607
- }));
1608
- o.props = S, we(), g.interactiveDebounce !== S.interactiveDebounce && (fe(), b = Yt(Ke, S.interactiveDebounce)), g.triggerTarget && !S.triggerTarget ? De(g.triggerTarget).forEach(function(R) {
1609
- R.removeAttribute("aria-expanded");
1610
- }) : S.triggerTarget && t.removeAttribute("aria-expanded"), Q(), B(), x && x(g, S), o.popperInstance && (Ye(), le().forEach(function(R) {
1611
- requestAnimationFrame(R._tippy.popperInstance.forceUpdate);
1612
- })), H("onAfterUpdate", [o, l]);
1613
- }
1614
- }
1615
- function et(l) {
1616
- o.setProps({
1617
- content: l
1618
- });
1619
- }
1620
- function Br() {
1621
- process.env.NODE_ENV !== "production" && se(o.state.isDestroyed, xe("show"));
1622
- var l = o.state.isVisible, g = o.state.isDestroyed, S = !o.state.isEnabled, R = ee.isTouch && !o.props.touch, A = ft(o.props.duration, 0, k.duration);
1623
- if (!(l || g || S || R) && !N().hasAttribute("disabled") && (H("onShow", [o], !1), o.props.onShow(o) !== !1)) {
1624
- if (o.state.isVisible = !0, M() && (f.style.visibility = "visible"), B(), X(), o.state.isMounted || (f.style.transition = "none"), M()) {
1625
- var $ = W(), z = $.box, Oe = $.content;
1626
- pt([z, Oe], 0);
1627
- }
1628
- y = function() {
1629
- var he;
1630
- if (!(!o.state.isVisible || p)) {
1631
- if (p = !0, f.offsetHeight, f.style.transition = o.props.moveTransition, M() && o.props.animation) {
1632
- var lt = W(), tt = lt.box, Se = lt.content;
1633
- pt([tt, Se], A), Qt([tt, Se], "visible");
1634
- }
1635
- J(), Q(), Xt(ht, o), (he = o.popperInstance) == null || he.forceUpdate(), H("onMount", [o]), o.props.animation && M() && oe(A, function() {
1636
- o.state.isShown = !0, H("onShown", [o]);
1637
- });
1638
- }
1639
- }, ae();
1640
- }
1641
- }
1642
- function Pr() {
1643
- process.env.NODE_ENV !== "production" && se(o.state.isDestroyed, xe("hide"));
1644
- var l = !o.state.isVisible, g = o.state.isDestroyed, S = !o.state.isEnabled, R = ft(o.props.duration, 1, k.duration);
1645
- if (!(l || g || S) && (H("onHide", [o], !1), o.props.onHide(o) !== !1)) {
1646
- if (o.state.isVisible = !1, o.state.isShown = !1, p = !1, c = !1, M() && (f.style.visibility = "hidden"), fe(), ie(), B(!0), M()) {
1647
- var A = W(), $ = A.box, z = A.content;
1648
- o.props.animation && (pt([$, z], R), Qt([$, z], "hidden"));
1649
- }
1650
- J(), Q(), o.props.animation ? M() && be(R, o.unmount) : o.unmount();
1651
- }
1652
- }
1653
- function Ir(l) {
1654
- process.env.NODE_ENV !== "production" && se(o.state.isDestroyed, xe("hideWithInteractivity")), I().addEventListener("mousemove", b), Xt(it, b), b(l);
1655
- }
1656
- function Hr() {
1657
- process.env.NODE_ENV !== "production" && se(o.state.isDestroyed, xe("unmount")), o.state.isVisible && o.hide(), o.state.isMounted && (Xe(), le().forEach(function(l) {
1658
- l._tippy.unmount();
1659
- }), f.parentNode && f.parentNode.removeChild(f), ht = ht.filter(function(l) {
1660
- return l !== o;
1661
- }), o.state.isMounted = !1, H("onHidden", [o]));
1662
- }
1663
- function Wr() {
1664
- process.env.NODE_ENV !== "production" && se(o.state.isDestroyed, xe("destroy")), !o.state.isDestroyed && (o.clearDelayTimeouts(), o.unmount(), ze(), delete t._tippy, o.state.isDestroyed = !0, H("onDestroy", [o]));
1665
- }
1666
- }
1667
- function qe(t, e) {
1668
- e === void 0 && (e = {});
1669
- var r = k.plugins.concat(e.plugins || []);
1670
- process.env.NODE_ENV !== "production" && (Ti(t), Mr(e, r)), wi();
1671
- var n = Object.assign({}, e, {
1672
- plugins: r
1673
- }), i = mi(t);
1674
- if (process.env.NODE_ENV !== "production") {
1675
- var a = $e(n.content), c = i.length > 1;
1676
- se(a && c, ["tippy() was passed an Element as the `content` prop, but more than", "one tippy instance was created by this invocation. This means the", "content element will only be appended to the last tippy instance.", `
1677
-
1678
- `, "Instead, pass the .innerHTML of the element, or use a function that", "returns a cloned version of the element instead.", `
1679
-
1680
- `, `1) content: element.innerHTML
1681
- `, "2) content: () => element.cloneNode(true)"].join(" "));
1682
- }
1683
- var u = i.reduce(function(s, p) {
1684
- var d = p && Ni(p, n);
1685
- return d && s.push(d), s;
1686
- }, []);
1687
- return $e(t) ? u[0] : u;
1688
- }
1689
- qe.defaultProps = k;
1690
- qe.setDefaultProps = _i;
1691
- qe.currentInput = ee;
1692
- Object.assign({}, hr, {
1693
- effect: function(e) {
1694
- var r = e.state, n = {
1695
- popper: {
1696
- position: r.options.strategy,
1697
- left: "0",
1698
- top: "0",
1699
- margin: "0"
1700
- },
1701
- arrow: {
1702
- position: "absolute"
1703
- },
1704
- reference: {}
1705
- };
1706
- Object.assign(r.elements.popper.style, n.popper), r.styles = n, r.elements.arrow && Object.assign(r.elements.arrow.style, n.arrow);
1707
- }
1708
- });
1709
- qe.setDefaultProps({
1710
- render: Nr
1711
- });
1712
- class Vi {
1713
- constructor({ editor: e, element: r, view: n, tippyOptions: i = {}, updateDelay: a = 250, shouldShow: c }) {
1714
- this.preventHide = !1, this.shouldShow = ({ view: u, state: s, from: p, to: d }) => {
1715
- const { doc: v, selection: y } = s, { empty: h } = y, b = !v.textBetween(p, d).length && kr(s.selection), m = this.element.contains(document.activeElement);
1716
- return !(!(u.hasFocus() || m) || h || b || !this.editor.isEditable);
1717
- }, this.mousedownHandler = () => {
1718
- this.preventHide = !0;
1719
- }, this.dragstartHandler = () => {
1720
- this.hide();
1721
- }, this.focusHandler = () => {
1722
- setTimeout(() => this.update(this.editor.view));
1723
- }, this.blurHandler = ({ event: u }) => {
1724
- var s;
1725
- if (this.preventHide) {
1726
- this.preventHide = !1;
1727
- return;
1728
- }
1729
- u != null && u.relatedTarget && (!((s = this.element.parentNode) === null || s === void 0) && s.contains(u.relatedTarget)) || (u == null ? void 0 : u.relatedTarget) !== this.editor.view.dom && this.hide();
1730
- }, this.tippyBlurHandler = (u) => {
1731
- this.blurHandler({ event: u });
1732
- }, this.handleDebouncedUpdate = (u, s) => {
1733
- const p = !(s != null && s.selection.eq(u.state.selection)), d = !(s != null && s.doc.eq(u.state.doc));
1734
- !p && !d || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
1735
- this.updateHandler(u, p, d, s);
1736
- }, this.updateDelay));
1737
- }, this.updateHandler = (u, s, p, d) => {
1738
- var v, y, h;
1739
- const { state: b, composing: m } = u, { selection: E } = b;
1740
- if (m || !s && !p)
1741
- return;
1742
- this.createTooltip();
1743
- const { ranges: T } = E, w = Math.min(...T.map((f) => f.$from.pos)), o = Math.max(...T.map((f) => f.$to.pos));
1744
- if (!((v = this.shouldShow) === null || v === void 0 ? void 0 : v.call(this, {
1745
- editor: this.editor,
1746
- element: this.element,
1747
- view: u,
1748
- state: b,
1749
- oldState: d,
1750
- from: w,
1751
- to: o
1752
- }))) {
1753
- this.hide();
1754
- return;
1755
- }
1756
- (y = this.tippy) === null || y === void 0 || y.setProps({
1757
- getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
1758
- if (qr(b.selection)) {
1759
- let f = u.nodeDOM(w);
1760
- if (f) {
1761
- const x = f.dataset.nodeViewWrapper ? f : f.querySelector("[data-node-view-wrapper]");
1762
- if (x && (f = x.firstChild), f)
1763
- return f.getBoundingClientRect();
1764
- }
1765
- }
1766
- return zr(u, w, o);
1767
- })
1768
- }), this.show();
1769
- }, this.editor = e, this.element = r, this.view = n, this.updateDelay = a, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = i, this.element.remove(), this.element.style.visibility = "visible";
1770
- }
1771
- createTooltip() {
1772
- const { element: e } = this.editor.options, r = !!e.parentElement;
1773
- this.tippy || !r || (this.tippy = qe(e, {
1774
- duration: 0,
1775
- getReferenceClientRect: null,
1776
- content: this.element,
1777
- interactive: !0,
1778
- trigger: "manual",
1779
- placement: "top",
1780
- hideOnClick: "toggle",
1781
- ...this.tippyOptions
1782
- }), this.tippy.popper.firstChild && this.tippy.popper.firstChild.addEventListener("blur", this.tippyBlurHandler));
1783
- }
1784
- update(e, r) {
1785
- const { state: n } = e, i = n.selection.from !== n.selection.to;
1786
- if (this.updateDelay > 0 && i) {
1787
- this.handleDebouncedUpdate(e, r);
1788
- return;
1789
- }
1790
- const a = !(r != null && r.selection.eq(e.state.selection)), c = !(r != null && r.doc.eq(e.state.doc));
1791
- this.updateHandler(e, a, c, r);
1792
- }
1793
- show() {
1794
- var e;
1795
- (e = this.tippy) === null || e === void 0 || e.show();
1796
- }
1797
- hide() {
1798
- var e;
1799
- (e = this.tippy) === null || e === void 0 || e.hide();
1800
- }
1801
- destroy() {
1802
- var e, r;
1803
- !((e = this.tippy) === null || e === void 0) && e.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (r = this.tippy) === null || r === void 0 || r.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
1804
- }
1805
- }
1806
- const Vr = (t) => new Ur({
1807
- key: typeof t.pluginKey == "string" ? new Fr(t.pluginKey) : t.pluginKey,
1808
- view: (e) => new Vi({ view: e, ...t })
1809
- });
1810
- Kr.create({
1811
- name: "bubbleMenu",
1812
- addOptions() {
1813
- return {
1814
- element: null,
1815
- tippyOptions: {},
1816
- pluginKey: "bubbleMenu",
1817
- updateDelay: void 0,
1818
- shouldShow: null
1819
- };
1820
- },
1821
- addProseMirrorPlugins() {
1822
- return this.options.element ? [
1823
- Vr({
1824
- pluginKey: this.options.pluginKey,
1825
- editor: this.editor,
1826
- element: this.options.element,
1827
- tippyOptions: this.options.tippyOptions,
1828
- updateDelay: this.options.updateDelay,
1829
- shouldShow: this.options.shouldShow
1830
- })
1831
- ] : [];
1832
- }
1833
- });
1834
- function ji(t) {
1835
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1836
- }
1837
- var Dt = { exports: {} }, mt = {};
1838
- /**
1839
- * @license React
1840
- * use-sync-external-store-shim.production.min.js
1841
- *
1842
- * Copyright (c) Facebook, Inc. and its affiliates.
1843
- *
1844
- * This source code is licensed under the MIT license found in the
1845
- * LICENSE file in the root directory of this source tree.
1846
- */
1847
- var or;
1848
- function Bi() {
1849
- if (or) return mt;
1850
- or = 1;
1851
- var t = P;
1852
- function e(v, y) {
1853
- return v === y && (v !== 0 || 1 / v === 1 / y) || v !== v && y !== y;
1854
- }
1855
- var r = typeof Object.is == "function" ? Object.is : e, n = t.useState, i = t.useEffect, a = t.useLayoutEffect, c = t.useDebugValue;
1856
- function u(v, y) {
1857
- var h = y(), b = n({ inst: { value: h, getSnapshot: y } }), m = b[0].inst, E = b[1];
1858
- return a(function() {
1859
- m.value = h, m.getSnapshot = y, s(m) && E({ inst: m });
1860
- }, [v, h, y]), i(function() {
1861
- return s(m) && E({ inst: m }), v(function() {
1862
- s(m) && E({ inst: m });
1863
- });
1864
- }, [v]), c(h), h;
1865
- }
1866
- function s(v) {
1867
- var y = v.getSnapshot;
1868
- v = v.value;
1869
- try {
1870
- var h = y();
1871
- return !r(v, h);
1872
- } catch {
1873
- return !0;
1874
- }
1875
- }
1876
- function p(v, y) {
1877
- return y();
1878
- }
1879
- var d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? p : u;
1880
- return mt.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : d, mt;
1881
- }
1882
- var yt = {};
1883
- /**
1884
- * @license React
1885
- * use-sync-external-store-shim.development.js
1886
- *
1887
- * Copyright (c) Facebook, Inc. and its affiliates.
1888
- *
1889
- * This source code is licensed under the MIT license found in the
1890
- * LICENSE file in the root directory of this source tree.
1891
- */
1892
- var ar;
1893
- function Pi() {
1894
- return ar || (ar = 1, process.env.NODE_ENV !== "production" && function() {
1895
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
1896
- var t = P, e = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1897
- function r(w) {
1898
- {
1899
- for (var o = arguments.length, O = new Array(o > 1 ? o - 1 : 0), f = 1; f < o; f++)
1900
- O[f - 1] = arguments[f];
1901
- n("error", w, O);
1902
- }
1903
- }
1904
- function n(w, o, O) {
1905
- {
1906
- var f = e.ReactDebugCurrentFrame, x = f.getStackAddendum();
1907
- x !== "" && (o += "%s", O = O.concat([x]));
1908
- var _ = O.map(function(C) {
1909
- return String(C);
1910
- });
1911
- _.unshift("Warning: " + o), Function.prototype.apply.call(console[w], console, _);
1912
- }
1913
- }
1914
- function i(w, o) {
1915
- return w === o && (w !== 0 || 1 / w === 1 / o) || w !== w && o !== o;
1916
- }
1917
- var a = typeof Object.is == "function" ? Object.is : i, c = t.useState, u = t.useEffect, s = t.useLayoutEffect, p = t.useDebugValue, d = !1, v = !1;
1918
- function y(w, o, O) {
1919
- d || t.startTransition !== void 0 && (d = !0, r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
1920
- var f = o();
1921
- if (!v) {
1922
- var x = o();
1923
- a(f, x) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), v = !0);
1924
- }
1925
- var _ = c({
1926
- inst: {
1927
- value: f,
1928
- getSnapshot: o
1929
- }
1930
- }), C = _[0].inst, L = _[1];
1931
- return s(function() {
1932
- C.value = f, C.getSnapshot = o, h(C) && L({
1933
- inst: C
1934
- });
1935
- }, [w, f, o]), u(function() {
1936
- h(C) && L({
1937
- inst: C
1938
- });
1939
- var V = function() {
1940
- h(C) && L({
1941
- inst: C
1942
- });
1943
- };
1944
- return w(V);
1945
- }, [w]), p(f), f;
1946
- }
1947
- function h(w) {
1948
- var o = w.getSnapshot, O = w.value;
1949
- try {
1950
- var f = o();
1951
- return !a(O, f);
1952
- } catch {
1953
- return !0;
1954
- }
1955
- }
1956
- function b(w, o, O) {
1957
- return o();
1958
- }
1959
- var m = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", E = !m, D = E ? b : y, T = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : D;
1960
- yt.useSyncExternalStore = T, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
1961
- }()), yt;
1962
- }
1963
- process.env.NODE_ENV === "production" ? Dt.exports = Bi() : Dt.exports = Pi();
1964
- var ct = Dt.exports;
1965
- const Ii = (...t) => (e) => {
1966
- t.forEach((r) => {
1967
- typeof r == "function" ? r(e) : r && (r.current = e);
1968
- });
1969
- }, Hi = ({ contentComponent: t }) => {
1970
- const e = ct.useSyncExternalStore(t.subscribe, t.getSnapshot, t.getServerSnapshot);
1971
- return P.createElement(P.Fragment, null, Object.values(e));
1972
- };
1973
- function Wi() {
1974
- const t = /* @__PURE__ */ new Set();
1975
- let e = {};
1976
- return {
1977
- /**
1978
- * Subscribe to the editor instance's changes.
1979
- */
1980
- subscribe(r) {
1981
- return t.add(r), () => {
1982
- t.delete(r);
1983
- };
1984
- },
1985
- getSnapshot() {
1986
- return e;
1987
- },
1988
- getServerSnapshot() {
1989
- return e;
1990
- },
1991
- /**
1992
- * Adds a new NodeView Renderer to the editor.
1993
- */
1994
- setRenderer(r, n) {
1995
- e = {
1996
- ...e,
1997
- [r]: Qr.createPortal(n.reactElement, n.element, r)
1998
- }, t.forEach((i) => i());
1999
- },
2000
- /**
2001
- * Removes a NodeView Renderer from the editor.
2002
- */
2003
- removeRenderer(r) {
2004
- const n = { ...e };
2005
- delete n[r], e = n, t.forEach((i) => i());
2006
- }
2007
- };
2008
- }
2009
- class $i extends P.Component {
2010
- constructor(e) {
2011
- var r;
2012
- super(e), this.editorContentRef = P.createRef(), this.initialized = !1, this.state = {
2013
- hasContentComponentInitialized: !!(!((r = e.editor) === null || r === void 0) && r.contentComponent)
2014
- };
2015
- }
2016
- componentDidMount() {
2017
- this.init();
2018
- }
2019
- componentDidUpdate() {
2020
- this.init();
2021
- }
2022
- init() {
2023
- const e = this.props.editor;
2024
- if (e && !e.isDestroyed && e.options.element) {
2025
- if (e.contentComponent)
2026
- return;
2027
- const r = this.editorContentRef.current;
2028
- r.append(...e.options.element.childNodes), e.setOptions({
2029
- element: r
2030
- }), e.contentComponent = Wi(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = e.contentComponent.subscribe(() => {
2031
- this.setState((n) => n.hasContentComponentInitialized ? n : {
2032
- hasContentComponentInitialized: !0
2033
- }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
2034
- })), e.createNodeViews(), this.initialized = !0;
2035
- }
2036
- }
2037
- componentWillUnmount() {
2038
- const e = this.props.editor;
2039
- if (!e || (this.initialized = !1, e.isDestroyed || e.view.setProps({
2040
- nodeViews: {}
2041
- }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(), e.contentComponent = null, !e.options.element.firstChild))
2042
- return;
2043
- const r = document.createElement("div");
2044
- r.append(...e.options.element.childNodes), e.setOptions({
2045
- element: r
2046
- });
2047
- }
2048
- render() {
2049
- const { editor: e, innerRef: r, ...n } = this.props;
2050
- return P.createElement(
2051
- P.Fragment,
2052
- null,
2053
- P.createElement("div", { ref: Ii(r, this.editorContentRef), ...n }),
2054
- (e == null ? void 0 : e.contentComponent) && P.createElement(Hi, { contentComponent: e.contentComponent })
2055
- );
2056
- }
2057
- }
2058
- const Ui = Xr((t, e) => {
2059
- const r = P.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [t.editor]);
2060
- return P.createElement($i, {
2061
- key: r,
2062
- innerRef: e,
2063
- ...t
2064
- });
2065
- }), ao = P.memo(Ui);
2066
- var Fi = function t(e, r) {
2067
- if (e === r) return !0;
2068
- if (e && r && typeof e == "object" && typeof r == "object") {
2069
- if (e.constructor !== r.constructor) return !1;
2070
- var n, i, a;
2071
- if (Array.isArray(e)) {
2072
- if (n = e.length, n != r.length) return !1;
2073
- for (i = n; i-- !== 0; )
2074
- if (!t(e[i], r[i])) return !1;
2075
- return !0;
2076
- }
2077
- if (e instanceof Map && r instanceof Map) {
2078
- if (e.size !== r.size) return !1;
2079
- for (i of e.entries())
2080
- if (!r.has(i[0])) return !1;
2081
- for (i of e.entries())
2082
- if (!t(i[1], r.get(i[0]))) return !1;
2083
- return !0;
2084
- }
2085
- if (e instanceof Set && r instanceof Set) {
2086
- if (e.size !== r.size) return !1;
2087
- for (i of e.entries())
2088
- if (!r.has(i[0])) return !1;
2089
- return !0;
2090
- }
2091
- if (ArrayBuffer.isView(e) && ArrayBuffer.isView(r)) {
2092
- if (n = e.length, n != r.length) return !1;
2093
- for (i = n; i-- !== 0; )
2094
- if (e[i] !== r[i]) return !1;
2095
- return !0;
2096
- }
2097
- if (e.constructor === RegExp) return e.source === r.source && e.flags === r.flags;
2098
- if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === r.valueOf();
2099
- if (e.toString !== Object.prototype.toString) return e.toString() === r.toString();
2100
- if (a = Object.keys(e), n = a.length, n !== Object.keys(r).length) return !1;
2101
- for (i = n; i-- !== 0; )
2102
- if (!Object.prototype.hasOwnProperty.call(r, a[i])) return !1;
2103
- for (i = n; i-- !== 0; ) {
2104
- var c = a[i];
2105
- if (!(c === "_owner" && e.$$typeof) && !t(e[c], r[c]))
2106
- return !1;
2107
- }
2108
- return !0;
2109
- }
2110
- return e !== e && r !== r;
2111
- }, ki = /* @__PURE__ */ ji(Fi), Tt = { exports: {} }, gt = {};
2112
- /**
2113
- * @license React
2114
- * use-sync-external-store-shim/with-selector.production.min.js
2115
- *
2116
- * Copyright (c) Facebook, Inc. and its affiliates.
2117
- *
2118
- * This source code is licensed under the MIT license found in the
2119
- * LICENSE file in the root directory of this source tree.
2120
- */
2121
- var sr;
2122
- function qi() {
2123
- if (sr) return gt;
2124
- sr = 1;
2125
- var t = P, e = ct;
2126
- function r(p, d) {
2127
- return p === d && (p !== 0 || 1 / p === 1 / d) || p !== p && d !== d;
2128
- }
2129
- var n = typeof Object.is == "function" ? Object.is : r, i = e.useSyncExternalStore, a = t.useRef, c = t.useEffect, u = t.useMemo, s = t.useDebugValue;
2130
- return gt.useSyncExternalStoreWithSelector = function(p, d, v, y, h) {
2131
- var b = a(null);
2132
- if (b.current === null) {
2133
- var m = { hasValue: !1, value: null };
2134
- b.current = m;
2135
- } else m = b.current;
2136
- b = u(function() {
2137
- function D(f) {
2138
- if (!T) {
2139
- if (T = !0, w = f, f = y(f), h !== void 0 && m.hasValue) {
2140
- var x = m.value;
2141
- if (h(x, f)) return o = x;
2142
- }
2143
- return o = f;
2144
- }
2145
- if (x = o, n(w, f)) return x;
2146
- var _ = y(f);
2147
- return h !== void 0 && h(x, _) ? x : (w = f, o = _);
2148
- }
2149
- var T = !1, w, o, O = v === void 0 ? null : v;
2150
- return [function() {
2151
- return D(d());
2152
- }, O === null ? void 0 : function() {
2153
- return D(O());
2154
- }];
2155
- }, [d, v, y, h]);
2156
- var E = i(p, b[0], b[1]);
2157
- return c(function() {
2158
- m.hasValue = !0, m.value = E;
2159
- }, [E]), s(E), E;
2160
- }, gt;
2161
- }
2162
- var bt = {};
2163
- /**
2164
- * @license React
2165
- * use-sync-external-store-shim/with-selector.development.js
2166
- *
2167
- * Copyright (c) Facebook, Inc. and its affiliates.
2168
- *
2169
- * This source code is licensed under the MIT license found in the
2170
- * LICENSE file in the root directory of this source tree.
2171
- */
2172
- var ur;
2173
- function zi() {
2174
- return ur || (ur = 1, process.env.NODE_ENV !== "production" && function() {
2175
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2176
- var t = P, e = ct;
2177
- function r(d, v) {
2178
- return d === v && (d !== 0 || 1 / d === 1 / v) || d !== d && v !== v;
2179
- }
2180
- var n = typeof Object.is == "function" ? Object.is : r, i = e.useSyncExternalStore, a = t.useRef, c = t.useEffect, u = t.useMemo, s = t.useDebugValue;
2181
- function p(d, v, y, h, b) {
2182
- var m = a(null), E;
2183
- m.current === null ? (E = {
2184
- hasValue: !1,
2185
- value: null
2186
- }, m.current = E) : E = m.current;
2187
- var D = u(function() {
2188
- var O = !1, f, x, _ = function(M) {
2189
- if (!O) {
2190
- O = !0, f = M;
2191
- var N = h(M);
2192
- if (b !== void 0 && E.hasValue) {
2193
- var I = E.value;
2194
- if (b(I, N))
2195
- return x = I, I;
2196
- }
2197
- return x = N, N;
2198
- }
2199
- var W = f, j = x;
2200
- if (n(W, M))
2201
- return j;
2202
- var B = h(M);
2203
- return b !== void 0 && b(j, B) ? j : (f = M, x = B, B);
2204
- }, C = y === void 0 ? null : y, L = function() {
2205
- return _(v());
2206
- }, V = C === null ? void 0 : function() {
2207
- return _(C());
2208
- };
2209
- return [L, V];
2210
- }, [v, y, h, b]), T = D[0], w = D[1], o = i(d, T, w);
2211
- return c(function() {
2212
- E.hasValue = !0, E.value = o;
2213
- }, [o]), s(o), o;
2214
- }
2215
- bt.useSyncExternalStoreWithSelector = p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2216
- }()), bt;
2217
- }
2218
- process.env.NODE_ENV === "production" ? Tt.exports = qi() : Tt.exports = zi();
2219
- var Ki = Tt.exports;
2220
- const Gi = typeof window < "u" ? Jr : _t;
2221
- class Yi {
2222
- constructor(e) {
2223
- this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = { editor: e, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
2224
- }
2225
- /**
2226
- * Get the current editor instance.
2227
- */
2228
- getSnapshot() {
2229
- return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber }, this.lastSnapshot);
2230
- }
2231
- /**
2232
- * Always disable the editor on the server-side.
2233
- */
2234
- getServerSnapshot() {
2235
- return { editor: null, transactionNumber: 0 };
2236
- }
2237
- /**
2238
- * Subscribe to the editor instance's changes.
2239
- */
2240
- subscribe(e) {
2241
- return this.subscribers.add(e), () => {
2242
- this.subscribers.delete(e);
2243
- };
2244
- }
2245
- /**
2246
- * Watch the editor instance for changes.
2247
- */
2248
- watch(e) {
2249
- if (this.editor = e, this.editor) {
2250
- const r = () => {
2251
- this.transactionNumber += 1, this.subscribers.forEach((i) => i());
2252
- }, n = this.editor;
2253
- return n.on("transaction", r), () => {
2254
- n.off("transaction", r);
2255
- };
2256
- }
2257
- }
2258
- }
2259
- function Xi(t) {
2260
- var e;
2261
- const [r] = At(() => new Yi(t.editor)), n = Ki.useSyncExternalStoreWithSelector(r.subscribe, r.getSnapshot, r.getServerSnapshot, t.selector, (e = t.equalityFn) !== null && e !== void 0 ? e : ki);
2262
- return Gi(() => r.watch(t.editor), [t.editor, r]), lr(n), n;
2263
- }
2264
- const cr = process.env.NODE_ENV !== "production", Ct = typeof window > "u", Ji = Ct || !!(typeof window < "u" && window.next);
2265
- class It {
2266
- constructor(e) {
2267
- this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = e, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
2268
- }
2269
- setEditor(e) {
2270
- this.editor = e, this.instanceId = Math.random().toString(36).slice(2, 9), this.subscriptions.forEach((r) => r());
2271
- }
2272
- getInitialEditor() {
2273
- if (this.options.current.immediatelyRender === void 0)
2274
- return Ct || Ji ? (cr && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
2275
- if (this.options.current.immediatelyRender && Ct && cr)
2276
- throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");
2277
- return this.options.current.immediatelyRender ? this.createEditor() : null;
2278
- }
2279
- /**
2280
- * Create a new editor instance. And attach event listeners.
2281
- */
2282
- createEditor() {
2283
- const e = {
2284
- ...this.options.current,
2285
- // Always call the most recent version of the callback function by default
2286
- onBeforeCreate: (...n) => {
2287
- var i, a;
2288
- return (a = (i = this.options.current).onBeforeCreate) === null || a === void 0 ? void 0 : a.call(i, ...n);
2289
- },
2290
- onBlur: (...n) => {
2291
- var i, a;
2292
- return (a = (i = this.options.current).onBlur) === null || a === void 0 ? void 0 : a.call(i, ...n);
2293
- },
2294
- onCreate: (...n) => {
2295
- var i, a;
2296
- return (a = (i = this.options.current).onCreate) === null || a === void 0 ? void 0 : a.call(i, ...n);
2297
- },
2298
- onDestroy: (...n) => {
2299
- var i, a;
2300
- return (a = (i = this.options.current).onDestroy) === null || a === void 0 ? void 0 : a.call(i, ...n);
2301
- },
2302
- onFocus: (...n) => {
2303
- var i, a;
2304
- return (a = (i = this.options.current).onFocus) === null || a === void 0 ? void 0 : a.call(i, ...n);
2305
- },
2306
- onSelectionUpdate: (...n) => {
2307
- var i, a;
2308
- return (a = (i = this.options.current).onSelectionUpdate) === null || a === void 0 ? void 0 : a.call(i, ...n);
2309
- },
2310
- onTransaction: (...n) => {
2311
- var i, a;
2312
- return (a = (i = this.options.current).onTransaction) === null || a === void 0 ? void 0 : a.call(i, ...n);
2313
- },
2314
- onUpdate: (...n) => {
2315
- var i, a;
2316
- return (a = (i = this.options.current).onUpdate) === null || a === void 0 ? void 0 : a.call(i, ...n);
2317
- },
2318
- onContentError: (...n) => {
2319
- var i, a;
2320
- return (a = (i = this.options.current).onContentError) === null || a === void 0 ? void 0 : a.call(i, ...n);
2321
- },
2322
- onDrop: (...n) => {
2323
- var i, a;
2324
- return (a = (i = this.options.current).onDrop) === null || a === void 0 ? void 0 : a.call(i, ...n);
2325
- },
2326
- onPaste: (...n) => {
2327
- var i, a;
2328
- return (a = (i = this.options.current).onPaste) === null || a === void 0 ? void 0 : a.call(i, ...n);
2329
- }
2330
- };
2331
- return new Gr(e);
2332
- }
2333
- /**
2334
- * Get the current editor instance.
2335
- */
2336
- getEditor() {
2337
- return this.editor;
2338
- }
2339
- /**
2340
- * Always disable the editor on the server-side.
2341
- */
2342
- getServerSnapshot() {
2343
- return null;
2344
- }
2345
- /**
2346
- * Subscribe to the editor instance's changes.
2347
- */
2348
- subscribe(e) {
2349
- return this.subscriptions.add(e), () => {
2350
- this.subscriptions.delete(e);
2351
- };
2352
- }
2353
- static compareOptions(e, r) {
2354
- return Object.keys(e).every((n) => ["onCreate", "onBeforeCreate", "onDestroy", "onUpdate", "onTransaction", "onFocus", "onBlur", "onSelectionUpdate", "onContentError", "onDrop", "onPaste"].includes(n) ? !0 : n === "extensions" && e.extensions && r.extensions ? e.extensions.length !== r.extensions.length ? !1 : e.extensions.every((i, a) => {
2355
- var c;
2356
- return i === ((c = r.extensions) === null || c === void 0 ? void 0 : c[a]);
2357
- }) : e[n] === r[n]);
2358
- }
2359
- /**
2360
- * On each render, we will create, update, or destroy the editor instance.
2361
- * @param deps The dependencies to watch for changes
2362
- * @returns A cleanup function
2363
- */
2364
- onRender(e) {
2365
- return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && e.length === 0 ? It.compareOptions(this.options.current, this.editor.options) || this.editor.setOptions({
2366
- ...this.options.current,
2367
- editable: this.editor.isEditable
2368
- }) : this.refreshEditorInstance(e), () => {
2369
- this.isComponentMounted = !1, this.scheduleDestroy();
2370
- });
2371
- }
2372
- /**
2373
- * Recreate the editor instance if the dependencies have changed.
2374
- */
2375
- refreshEditorInstance(e) {
2376
- if (this.editor && !this.editor.isDestroyed) {
2377
- if (this.previousDeps === null) {
2378
- this.previousDeps = e;
2379
- return;
2380
- }
2381
- if (this.previousDeps.length === e.length && this.previousDeps.every((n, i) => n === e[i]))
2382
- return;
2383
- }
2384
- this.editor && !this.editor.isDestroyed && this.editor.destroy(), this.setEditor(this.createEditor()), this.previousDeps = e;
2385
- }
2386
- /**
2387
- * Schedule the destruction of the editor instance.
2388
- * This will only destroy the editor if it was not mounted on the next tick.
2389
- * This is to avoid destroying the editor instance when it's actually still mounted.
2390
- */
2391
- scheduleDestroy() {
2392
- const e = this.instanceId, r = this.editor;
2393
- this.scheduledDestructionTimeout = setTimeout(() => {
2394
- if (this.isComponentMounted && this.instanceId === e) {
2395
- r && r.setOptions(this.options.current);
2396
- return;
2397
- }
2398
- r && !r.isDestroyed && (r.destroy(), this.instanceId === e && this.setEditor(null));
2399
- }, 1);
2400
- }
2401
- }
2402
- function so(t = {}, e = []) {
2403
- const r = Yr(t);
2404
- r.current = t;
2405
- const [n] = At(() => new It(r)), i = ct.useSyncExternalStore(n.subscribe, n.getEditor, n.getServerSnapshot);
2406
- return lr(i), _t(n.onRender(e)), Xi({
2407
- editor: i,
2408
- selector: ({ transactionNumber: a }) => t.shouldRerenderOnTransaction === !1 ? null : t.immediatelyRender && a === 0 ? 0 : a + 1
2409
- }), i;
2410
- }
2411
- const jr = fr({
2412
- editor: null
2413
- });
2414
- jr.Consumer;
2415
- const Qi = () => dr(jr), uo = (t) => {
2416
- const [e, r] = At(null), { editor: n } = Qi();
2417
- return _t(() => {
2418
- var i;
2419
- if (!e || !((i = t.editor) === null || i === void 0) && i.isDestroyed || n != null && n.isDestroyed)
2420
- return;
2421
- const { pluginKey: a = "bubbleMenu", editor: c, tippyOptions: u = {}, updateDelay: s, shouldShow: p = null } = t, d = c || n;
2422
- if (!d) {
2423
- console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
2424
- return;
2425
- }
2426
- const v = Vr({
2427
- updateDelay: s,
2428
- editor: d,
2429
- element: e,
2430
- pluginKey: a,
2431
- shouldShow: p,
2432
- tippyOptions: u
2433
- });
2434
- return d.registerPlugin(v), () => {
2435
- d.unregisterPlugin(a);
2436
- };
2437
- }, [t.editor, n, e]), P.createElement("div", { ref: r, className: t.className, style: { visibility: "hidden" } }, t.children);
2438
- }, Zi = fr({
2439
- onDragStart: void 0
2440
- }), eo = () => dr(Zi);
2441
- P.forwardRef((t, e) => {
2442
- const { onDragStart: r } = eo(), n = t.as || "div";
2443
- return (
2444
- // @ts-ignore
2445
- P.createElement(n, { ...t, ref: e, "data-node-view-wrapper": "", onDragStart: r, style: {
2446
- whiteSpace: "normal",
2447
- ...t.style
2448
- } })
2449
- );
2450
- });
2451
- function to(t) {
2452
- return !!(typeof t == "function" && t.prototype && t.prototype.isReactComponent);
2453
- }
2454
- function ro(t) {
2455
- var e;
2456
- return typeof t == "object" && ((e = t.$$typeof) === null || e === void 0 ? void 0 : e.toString()) === "Symbol(react.forward_ref)";
2457
- }
2458
- class co {
2459
- /**
2460
- * Immediately creates element and renders the provided React component.
2461
- */
2462
- constructor(e, { editor: r, props: n = {}, as: i = "div", className: a = "" }) {
2463
- this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = r, this.props = n, this.element = document.createElement(i), this.element.classList.add("react-renderer"), a && this.element.classList.add(...a.split(" ")), this.editor.isInitialized ? Zr(() => {
2464
- this.render();
2465
- }) : this.render();
2466
- }
2467
- /**
2468
- * Render the React component.
2469
- */
2470
- render() {
2471
- var e;
2472
- const r = this.component, n = this.props, i = this.editor;
2473
- (to(r) || ro(r)) && (n.ref = (a) => {
2474
- this.ref = a;
2475
- }), this.reactElement = P.createElement(r, { ...n }), (e = i == null ? void 0 : i.contentComponent) === null || e === void 0 || e.setRenderer(this.id, this);
2476
- }
2477
- /**
2478
- * Re-renders the React component with new props.
2479
- */
2480
- updateProps(e = {}) {
2481
- this.props = {
2482
- ...this.props,
2483
- ...e
2484
- }, this.render();
2485
- }
2486
- /**
2487
- * Destroy the React component.
2488
- */
2489
- destroy() {
2490
- var e;
2491
- const r = this.editor;
2492
- (e = r == null ? void 0 : r.contentComponent) === null || e === void 0 || e.removeRenderer(this.id);
2493
- }
2494
- /**
2495
- * Update the attributes of the element that holds the React component.
2496
- */
2497
- updateAttributes(e) {
2498
- Object.keys(e).forEach((r) => {
2499
- this.element.setAttribute(r, e[r]);
2500
- });
2501
- }
2502
- }
2503
- export {
2504
- uo as B,
2505
- ao as E,
2506
- co as R,
2507
- qe as t,
2508
- so as u
2509
- };