@qwanyx/stack 0.2.49 → 0.2.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +20 -20
- package/dist/index.esm.js +788 -773
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ var Oa = Object.defineProperty;
|
|
|
2
2
|
var Ma = (r, e, t) => e in r ? Oa(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var Wr = (r, e, t) => Ma(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as ks from "react";
|
|
5
|
-
import tt, { useState as H, useCallback as re, useEffect as
|
|
5
|
+
import tt, { useState as H, useCallback as re, useEffect as Se, useMemo as Et, useRef as ye, createContext as Ia, useContext as $a, useLayoutEffect as Ir, Suspense as za, forwardRef as dl } from "react";
|
|
6
6
|
import { flushSync as qa, createPortal as Ua } from "react-dom";
|
|
7
7
|
class xf {
|
|
8
8
|
constructor(e) {
|
|
@@ -3630,11 +3630,11 @@ class uu {
|
|
|
3630
3630
|
for (const h of c.messages)
|
|
3631
3631
|
h.uid && d.set(h.uid, h);
|
|
3632
3632
|
const f = a.map((h) => {
|
|
3633
|
-
var A, C, E,
|
|
3633
|
+
var A, C, E, y, _;
|
|
3634
3634
|
const g = d.get(h);
|
|
3635
3635
|
if (!g) return null;
|
|
3636
|
-
const m = ((A = g.flags) == null ? void 0 : A.some((D) => D.includes("Seen"))) || !1,
|
|
3637
|
-
return { uid: h, from:
|
|
3636
|
+
const m = ((A = g.flags) == null ? void 0 : A.some((D) => D.includes("Seen"))) || !1, b = ((E = (C = g.envelope) == null ? void 0 : C.from) == null ? void 0 : E.email) || "Unknown", w = ((y = g.envelope) == null ? void 0 : y.subject) || "(No subject)", v = ((_ = g.envelope) == null ? void 0 : _.date) || "";
|
|
3637
|
+
return { uid: h, from: b, subject: w, date: v, seen: m };
|
|
3638
3638
|
}).filter(Boolean);
|
|
3639
3639
|
return {
|
|
3640
3640
|
account: { id: e, label: "", email: "" },
|
|
@@ -3682,7 +3682,7 @@ class uu {
|
|
|
3682
3682
|
* This handles CID embedded images by converting them to base64 data URIs
|
|
3683
3683
|
*/
|
|
3684
3684
|
async getEmailParsed(e, t, n = "INBOX") {
|
|
3685
|
-
var g, m,
|
|
3685
|
+
var g, m, b, w, v, A;
|
|
3686
3686
|
const o = (await this.imapExec(e, [
|
|
3687
3687
|
`SELECT "${n}"`,
|
|
3688
3688
|
`UID FETCH ${t} (FLAGS BODY[])`
|
|
@@ -3693,17 +3693,17 @@ class uu {
|
|
|
3693
3693
|
if (!l)
|
|
3694
3694
|
return console.error("No raw email content in response"), null;
|
|
3695
3695
|
const u = await new Un().parse(l);
|
|
3696
|
-
console.log("[MailClient] Parsed email - attachments count:", ((m = u.attachments) == null ? void 0 : m.length) || 0), console.log("[MailClient] Parsed attachments:", (
|
|
3696
|
+
console.log("[MailClient] Parsed email - attachments count:", ((m = u.attachments) == null ? void 0 : m.length) || 0), console.log("[MailClient] Parsed attachments:", (b = u.attachments) == null ? void 0 : b.map((C) => ({ filename: C.filename, mimeType: C.mimeType, contentId: C.contentId })));
|
|
3697
3697
|
const c = /* @__PURE__ */ new Map();
|
|
3698
3698
|
for (const C of u.attachments || [])
|
|
3699
3699
|
if (C.contentId) {
|
|
3700
|
-
const E = this.contentToBase64(C.content),
|
|
3701
|
-
c.set(_,
|
|
3700
|
+
const E = this.contentToBase64(C.content), y = `data:${C.mimeType};base64,${E}`, _ = C.contentId.replace(/^<|>$/g, "");
|
|
3701
|
+
c.set(_, y), c.set(`<${_}>`, y);
|
|
3702
3702
|
}
|
|
3703
3703
|
let d = u.html || "";
|
|
3704
3704
|
d && c.size > 0 && (d = d.replace(/src=["']cid:([^"']+)["']/gi, (C, E) => {
|
|
3705
|
-
const
|
|
3706
|
-
return
|
|
3705
|
+
const y = c.get(E) || c.get(`<${E}>`);
|
|
3706
|
+
return y ? `src="${y}"` : C;
|
|
3707
3707
|
}));
|
|
3708
3708
|
const f = ((w = i.flags) == null ? void 0 : w.some((C) => C.toLowerCase().includes("seen"))) || !1, h = ((v = u.from) == null ? void 0 : v.address) || ((A = u.from) == null ? void 0 : A.name) || "Unknown";
|
|
3709
3709
|
return {
|
|
@@ -3978,7 +3978,7 @@ function fu(r, e, t = {}) {
|
|
|
3978
3978
|
}
|
|
3979
3979
|
}
|
|
3980
3980
|
}, [r, JSON.stringify(e), n, o, i]);
|
|
3981
|
-
return
|
|
3981
|
+
return Se(() => {
|
|
3982
3982
|
s && h();
|
|
3983
3983
|
}, [h, s]), {
|
|
3984
3984
|
data: l,
|
|
@@ -4068,57 +4068,57 @@ var Xi;
|
|
|
4068
4068
|
function pu() {
|
|
4069
4069
|
return Xi || (Xi = 1, process.env.NODE_ENV !== "production" && function() {
|
|
4070
4070
|
var r = tt, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), l = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), h = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
|
|
4071
|
-
function x
|
|
4072
|
-
if (
|
|
4071
|
+
function b(x) {
|
|
4072
|
+
if (x === null || typeof x != "object")
|
|
4073
4073
|
return null;
|
|
4074
|
-
var L = g &&
|
|
4074
|
+
var L = g && x[g] || x[m];
|
|
4075
4075
|
return typeof L == "function" ? L : null;
|
|
4076
4076
|
}
|
|
4077
4077
|
var w = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
4078
|
-
function v(
|
|
4078
|
+
function v(x) {
|
|
4079
4079
|
{
|
|
4080
4080
|
for (var L = arguments.length, q = new Array(L > 1 ? L - 1 : 0), Y = 1; Y < L; Y++)
|
|
4081
4081
|
q[Y - 1] = arguments[Y];
|
|
4082
|
-
A("error",
|
|
4082
|
+
A("error", x, q);
|
|
4083
4083
|
}
|
|
4084
4084
|
}
|
|
4085
|
-
function A(
|
|
4085
|
+
function A(x, L, q) {
|
|
4086
4086
|
{
|
|
4087
4087
|
var Y = w.ReactDebugCurrentFrame, le = Y.getStackAddendum();
|
|
4088
4088
|
le !== "" && (L += "%s", q = q.concat([le]));
|
|
4089
4089
|
var me = q.map(function(ie) {
|
|
4090
4090
|
return String(ie);
|
|
4091
4091
|
});
|
|
4092
|
-
me.unshift("Warning: " + L), Function.prototype.apply.call(console[
|
|
4092
|
+
me.unshift("Warning: " + L), Function.prototype.apply.call(console[x], console, me);
|
|
4093
4093
|
}
|
|
4094
4094
|
}
|
|
4095
|
-
var C = !1, E = !1,
|
|
4095
|
+
var C = !1, E = !1, y = !1, _ = !1, D = !1, S;
|
|
4096
4096
|
S = Symbol.for("react.module.reference");
|
|
4097
|
-
function M(
|
|
4098
|
-
return !!(typeof
|
|
4097
|
+
function M(x) {
|
|
4098
|
+
return !!(typeof x == "string" || typeof x == "function" || x === n || x === o || D || x === s || x === u || x === c || _ || x === h || C || E || y || typeof x == "object" && x !== null && (x.$$typeof === f || x.$$typeof === d || x.$$typeof === i || x.$$typeof === l || x.$$typeof === a || // This needs to include all possible module reference object
|
|
4099
4099
|
// types supported by any Flight configuration anywhere since
|
|
4100
4100
|
// we don't know which Flight build this will end up being used
|
|
4101
4101
|
// with.
|
|
4102
|
-
|
|
4102
|
+
x.$$typeof === S || x.getModuleId !== void 0));
|
|
4103
4103
|
}
|
|
4104
|
-
function T(
|
|
4105
|
-
var Y =
|
|
4104
|
+
function T(x, L, q) {
|
|
4105
|
+
var Y = x.displayName;
|
|
4106
4106
|
if (Y)
|
|
4107
4107
|
return Y;
|
|
4108
4108
|
var le = L.displayName || L.name || "";
|
|
4109
4109
|
return le !== "" ? q + "(" + le + ")" : q;
|
|
4110
4110
|
}
|
|
4111
|
-
function B(
|
|
4112
|
-
return
|
|
4111
|
+
function B(x) {
|
|
4112
|
+
return x.displayName || "Context";
|
|
4113
4113
|
}
|
|
4114
|
-
function F(
|
|
4115
|
-
if (
|
|
4114
|
+
function F(x) {
|
|
4115
|
+
if (x == null)
|
|
4116
4116
|
return null;
|
|
4117
|
-
if (typeof
|
|
4118
|
-
return
|
|
4119
|
-
if (typeof
|
|
4120
|
-
return
|
|
4121
|
-
switch (
|
|
4117
|
+
if (typeof x.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof x == "function")
|
|
4118
|
+
return x.displayName || x.name || null;
|
|
4119
|
+
if (typeof x == "string")
|
|
4120
|
+
return x;
|
|
4121
|
+
switch (x) {
|
|
4122
4122
|
case n:
|
|
4123
4123
|
return "Fragment";
|
|
4124
4124
|
case t:
|
|
@@ -4132,21 +4132,21 @@ function pu() {
|
|
|
4132
4132
|
case c:
|
|
4133
4133
|
return "SuspenseList";
|
|
4134
4134
|
}
|
|
4135
|
-
if (typeof
|
|
4136
|
-
switch (
|
|
4135
|
+
if (typeof x == "object")
|
|
4136
|
+
switch (x.$$typeof) {
|
|
4137
4137
|
case l:
|
|
4138
|
-
var L =
|
|
4138
|
+
var L = x;
|
|
4139
4139
|
return B(L) + ".Consumer";
|
|
4140
4140
|
case i:
|
|
4141
|
-
var q =
|
|
4141
|
+
var q = x;
|
|
4142
4142
|
return B(q._context) + ".Provider";
|
|
4143
4143
|
case a:
|
|
4144
|
-
return T(
|
|
4144
|
+
return T(x, x.render, "ForwardRef");
|
|
4145
4145
|
case d:
|
|
4146
|
-
var Y =
|
|
4147
|
-
return Y !== null ? Y : F(
|
|
4146
|
+
var Y = x.displayName || null;
|
|
4147
|
+
return Y !== null ? Y : F(x.type) || "Memo";
|
|
4148
4148
|
case f: {
|
|
4149
|
-
var le =
|
|
4149
|
+
var le = x, me = le._payload, ie = le._init;
|
|
4150
4150
|
try {
|
|
4151
4151
|
return F(ie(me));
|
|
4152
4152
|
} catch {
|
|
@@ -4156,70 +4156,70 @@ function pu() {
|
|
|
4156
4156
|
}
|
|
4157
4157
|
return null;
|
|
4158
4158
|
}
|
|
4159
|
-
var j = Object.assign,
|
|
4159
|
+
var j = Object.assign, I = 0, X, de, Ce, ae, Oe, xe, pe;
|
|
4160
4160
|
function be() {
|
|
4161
4161
|
}
|
|
4162
4162
|
be.__reactDisabledLog = !0;
|
|
4163
4163
|
function _e() {
|
|
4164
4164
|
{
|
|
4165
|
-
if (
|
|
4165
|
+
if (I === 0) {
|
|
4166
4166
|
X = console.log, de = console.info, Ce = console.warn, ae = console.error, Oe = console.group, xe = console.groupCollapsed, pe = console.groupEnd;
|
|
4167
|
-
var
|
|
4167
|
+
var x = {
|
|
4168
4168
|
configurable: !0,
|
|
4169
4169
|
enumerable: !0,
|
|
4170
4170
|
value: be,
|
|
4171
4171
|
writable: !0
|
|
4172
4172
|
};
|
|
4173
4173
|
Object.defineProperties(console, {
|
|
4174
|
-
info:
|
|
4175
|
-
log:
|
|
4176
|
-
warn:
|
|
4177
|
-
error:
|
|
4178
|
-
group:
|
|
4179
|
-
groupCollapsed:
|
|
4180
|
-
groupEnd:
|
|
4174
|
+
info: x,
|
|
4175
|
+
log: x,
|
|
4176
|
+
warn: x,
|
|
4177
|
+
error: x,
|
|
4178
|
+
group: x,
|
|
4179
|
+
groupCollapsed: x,
|
|
4180
|
+
groupEnd: x
|
|
4181
4181
|
});
|
|
4182
4182
|
}
|
|
4183
|
-
|
|
4183
|
+
I++;
|
|
4184
4184
|
}
|
|
4185
4185
|
}
|
|
4186
|
-
function
|
|
4186
|
+
function ke() {
|
|
4187
4187
|
{
|
|
4188
|
-
if (
|
|
4189
|
-
var
|
|
4188
|
+
if (I--, I === 0) {
|
|
4189
|
+
var x = {
|
|
4190
4190
|
configurable: !0,
|
|
4191
4191
|
enumerable: !0,
|
|
4192
4192
|
writable: !0
|
|
4193
4193
|
};
|
|
4194
4194
|
Object.defineProperties(console, {
|
|
4195
|
-
log: j({},
|
|
4195
|
+
log: j({}, x, {
|
|
4196
4196
|
value: X
|
|
4197
4197
|
}),
|
|
4198
|
-
info: j({},
|
|
4198
|
+
info: j({}, x, {
|
|
4199
4199
|
value: de
|
|
4200
4200
|
}),
|
|
4201
|
-
warn: j({},
|
|
4201
|
+
warn: j({}, x, {
|
|
4202
4202
|
value: Ce
|
|
4203
4203
|
}),
|
|
4204
|
-
error: j({},
|
|
4204
|
+
error: j({}, x, {
|
|
4205
4205
|
value: ae
|
|
4206
4206
|
}),
|
|
4207
|
-
group: j({},
|
|
4207
|
+
group: j({}, x, {
|
|
4208
4208
|
value: Oe
|
|
4209
4209
|
}),
|
|
4210
|
-
groupCollapsed: j({},
|
|
4210
|
+
groupCollapsed: j({}, x, {
|
|
4211
4211
|
value: xe
|
|
4212
4212
|
}),
|
|
4213
|
-
groupEnd: j({},
|
|
4213
|
+
groupEnd: j({}, x, {
|
|
4214
4214
|
value: pe
|
|
4215
4215
|
})
|
|
4216
4216
|
});
|
|
4217
4217
|
}
|
|
4218
|
-
|
|
4218
|
+
I < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
4219
4219
|
}
|
|
4220
4220
|
}
|
|
4221
4221
|
var ge = w.ReactCurrentDispatcher, De;
|
|
4222
|
-
function Le(
|
|
4222
|
+
function Le(x, L, q) {
|
|
4223
4223
|
{
|
|
4224
4224
|
if (De === void 0)
|
|
4225
4225
|
try {
|
|
@@ -4229,7 +4229,7 @@ function pu() {
|
|
|
4229
4229
|
De = Y && Y[1] || "";
|
|
4230
4230
|
}
|
|
4231
4231
|
return `
|
|
4232
|
-
` + De +
|
|
4232
|
+
` + De + x;
|
|
4233
4233
|
}
|
|
4234
4234
|
}
|
|
4235
4235
|
var ue = !1, Me;
|
|
@@ -4237,11 +4237,11 @@ function pu() {
|
|
|
4237
4237
|
var ct = typeof WeakMap == "function" ? WeakMap : Map;
|
|
4238
4238
|
Me = new ct();
|
|
4239
4239
|
}
|
|
4240
|
-
function Bt(
|
|
4241
|
-
if (!
|
|
4240
|
+
function Bt(x, L) {
|
|
4241
|
+
if (!x || ue)
|
|
4242
4242
|
return "";
|
|
4243
4243
|
{
|
|
4244
|
-
var q = Me.get(
|
|
4244
|
+
var q = Me.get(x);
|
|
4245
4245
|
if (q !== void 0)
|
|
4246
4246
|
return q;
|
|
4247
4247
|
}
|
|
@@ -4266,14 +4266,14 @@ function pu() {
|
|
|
4266
4266
|
} catch (ot) {
|
|
4267
4267
|
Y = ot;
|
|
4268
4268
|
}
|
|
4269
|
-
Reflect.construct(
|
|
4269
|
+
Reflect.construct(x, [], ie);
|
|
4270
4270
|
} else {
|
|
4271
4271
|
try {
|
|
4272
4272
|
ie.call();
|
|
4273
4273
|
} catch (ot) {
|
|
4274
4274
|
Y = ot;
|
|
4275
4275
|
}
|
|
4276
|
-
|
|
4276
|
+
x.call(ie.prototype);
|
|
4277
4277
|
}
|
|
4278
4278
|
} else {
|
|
4279
4279
|
try {
|
|
@@ -4281,7 +4281,7 @@ function pu() {
|
|
|
4281
4281
|
} catch (ot) {
|
|
4282
4282
|
Y = ot;
|
|
4283
4283
|
}
|
|
4284
|
-
|
|
4284
|
+
x();
|
|
4285
4285
|
}
|
|
4286
4286
|
} catch (ot) {
|
|
4287
4287
|
if (ot && Y && typeof ot.stack == "string") {
|
|
@@ -4296,46 +4296,46 @@ function pu() {
|
|
|
4296
4296
|
if (ze--, Ue--, Ue < 0 || oe[ze] !== et[Ue]) {
|
|
4297
4297
|
var mt = `
|
|
4298
4298
|
` + oe[ze].replace(" at new ", " at ");
|
|
4299
|
-
return
|
|
4299
|
+
return x.displayName && mt.includes("<anonymous>") && (mt = mt.replace("<anonymous>", x.displayName)), typeof x == "function" && Me.set(x, mt), mt;
|
|
4300
4300
|
}
|
|
4301
4301
|
while (ze >= 1 && Ue >= 0);
|
|
4302
4302
|
break;
|
|
4303
4303
|
}
|
|
4304
4304
|
}
|
|
4305
4305
|
} finally {
|
|
4306
|
-
ue = !1, ge.current = me,
|
|
4306
|
+
ue = !1, ge.current = me, ke(), Error.prepareStackTrace = le;
|
|
4307
4307
|
}
|
|
4308
|
-
var Ar =
|
|
4309
|
-
return typeof
|
|
4308
|
+
var Ar = x ? x.displayName || x.name : "", cr = Ar ? Le(Ar) : "";
|
|
4309
|
+
return typeof x == "function" && Me.set(x, cr), cr;
|
|
4310
4310
|
}
|
|
4311
|
-
function Ut(
|
|
4312
|
-
return Bt(
|
|
4311
|
+
function Ut(x, L, q) {
|
|
4312
|
+
return Bt(x, !1);
|
|
4313
4313
|
}
|
|
4314
|
-
function it(
|
|
4315
|
-
var L =
|
|
4314
|
+
function it(x) {
|
|
4315
|
+
var L = x.prototype;
|
|
4316
4316
|
return !!(L && L.isReactComponent);
|
|
4317
4317
|
}
|
|
4318
|
-
function xt(
|
|
4319
|
-
if (
|
|
4318
|
+
function xt(x, L, q) {
|
|
4319
|
+
if (x == null)
|
|
4320
4320
|
return "";
|
|
4321
|
-
if (typeof
|
|
4322
|
-
return Bt(
|
|
4323
|
-
if (typeof
|
|
4324
|
-
return Le(
|
|
4325
|
-
switch (
|
|
4321
|
+
if (typeof x == "function")
|
|
4322
|
+
return Bt(x, it(x));
|
|
4323
|
+
if (typeof x == "string")
|
|
4324
|
+
return Le(x);
|
|
4325
|
+
switch (x) {
|
|
4326
4326
|
case u:
|
|
4327
4327
|
return Le("Suspense");
|
|
4328
4328
|
case c:
|
|
4329
4329
|
return Le("SuspenseList");
|
|
4330
4330
|
}
|
|
4331
|
-
if (typeof
|
|
4332
|
-
switch (
|
|
4331
|
+
if (typeof x == "object")
|
|
4332
|
+
switch (x.$$typeof) {
|
|
4333
4333
|
case a:
|
|
4334
|
-
return Ut(
|
|
4334
|
+
return Ut(x.render);
|
|
4335
4335
|
case d:
|
|
4336
|
-
return xt(
|
|
4336
|
+
return xt(x.type, L, q);
|
|
4337
4337
|
case f: {
|
|
4338
|
-
var Y =
|
|
4338
|
+
var Y = x, le = Y._payload, me = Y._init;
|
|
4339
4339
|
try {
|
|
4340
4340
|
return xt(me(le), L, q);
|
|
4341
4341
|
} catch {
|
|
@@ -4345,25 +4345,25 @@ function pu() {
|
|
|
4345
4345
|
return "";
|
|
4346
4346
|
}
|
|
4347
4347
|
var pt = Object.prototype.hasOwnProperty, Zt = {}, Wt = w.ReactDebugCurrentFrame;
|
|
4348
|
-
function Nt(
|
|
4349
|
-
if (
|
|
4350
|
-
var L =
|
|
4348
|
+
function Nt(x) {
|
|
4349
|
+
if (x) {
|
|
4350
|
+
var L = x._owner, q = xt(x.type, x._source, L ? L.type : null);
|
|
4351
4351
|
Wt.setExtraStackFrame(q);
|
|
4352
4352
|
} else
|
|
4353
4353
|
Wt.setExtraStackFrame(null);
|
|
4354
4354
|
}
|
|
4355
|
-
function Ft(
|
|
4355
|
+
function Ft(x, L, q, Y, le) {
|
|
4356
4356
|
{
|
|
4357
4357
|
var me = Function.call.bind(pt);
|
|
4358
|
-
for (var ie in
|
|
4359
|
-
if (me(
|
|
4358
|
+
for (var ie in x)
|
|
4359
|
+
if (me(x, ie)) {
|
|
4360
4360
|
var oe = void 0;
|
|
4361
4361
|
try {
|
|
4362
|
-
if (typeof
|
|
4363
|
-
var et = Error((Y || "React class") + ": " + q + " type `" + ie + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof
|
|
4362
|
+
if (typeof x[ie] != "function") {
|
|
4363
|
+
var et = Error((Y || "React class") + ": " + q + " type `" + ie + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof x[ie] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
4364
4364
|
throw et.name = "Invariant Violation", et;
|
|
4365
4365
|
}
|
|
4366
|
-
oe =
|
|
4366
|
+
oe = x[ie](L, ie, Y, q, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
4367
4367
|
} catch (ze) {
|
|
4368
4368
|
oe = ze;
|
|
4369
4369
|
}
|
|
@@ -4372,28 +4372,28 @@ function pu() {
|
|
|
4372
4372
|
}
|
|
4373
4373
|
}
|
|
4374
4374
|
var dt = Array.isArray;
|
|
4375
|
-
function bt(
|
|
4376
|
-
return dt(
|
|
4375
|
+
function bt(x) {
|
|
4376
|
+
return dt(x);
|
|
4377
4377
|
}
|
|
4378
|
-
function
|
|
4378
|
+
function U(x) {
|
|
4379
4379
|
{
|
|
4380
|
-
var L = typeof Symbol == "function" && Symbol.toStringTag, q = L &&
|
|
4380
|
+
var L = typeof Symbol == "function" && Symbol.toStringTag, q = L && x[Symbol.toStringTag] || x.constructor.name || "Object";
|
|
4381
4381
|
return q;
|
|
4382
4382
|
}
|
|
4383
4383
|
}
|
|
4384
|
-
function
|
|
4384
|
+
function Ae(x) {
|
|
4385
4385
|
try {
|
|
4386
|
-
return Be(
|
|
4386
|
+
return Be(x), !1;
|
|
4387
4387
|
} catch {
|
|
4388
4388
|
return !0;
|
|
4389
4389
|
}
|
|
4390
4390
|
}
|
|
4391
|
-
function Be(
|
|
4392
|
-
return "" +
|
|
4391
|
+
function Be(x) {
|
|
4392
|
+
return "" + x;
|
|
4393
4393
|
}
|
|
4394
|
-
function
|
|
4395
|
-
if (
|
|
4396
|
-
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
4394
|
+
function Te(x) {
|
|
4395
|
+
if (Ae(x))
|
|
4396
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", U(x)), Be(x);
|
|
4397
4397
|
}
|
|
4398
4398
|
var jt = w.ReactCurrentOwner, Lt = {
|
|
4399
4399
|
key: !0,
|
|
@@ -4401,53 +4401,53 @@ function pu() {
|
|
|
4401
4401
|
__self: !0,
|
|
4402
4402
|
__source: !0
|
|
4403
4403
|
}, Gt, G;
|
|
4404
|
-
function J(
|
|
4405
|
-
if (pt.call(
|
|
4406
|
-
var L = Object.getOwnPropertyDescriptor(
|
|
4404
|
+
function J(x) {
|
|
4405
|
+
if (pt.call(x, "ref")) {
|
|
4406
|
+
var L = Object.getOwnPropertyDescriptor(x, "ref").get;
|
|
4407
4407
|
if (L && L.isReactWarning)
|
|
4408
4408
|
return !1;
|
|
4409
4409
|
}
|
|
4410
|
-
return
|
|
4410
|
+
return x.ref !== void 0;
|
|
4411
4411
|
}
|
|
4412
|
-
function Ne(
|
|
4413
|
-
if (pt.call(
|
|
4414
|
-
var L = Object.getOwnPropertyDescriptor(
|
|
4412
|
+
function Ne(x) {
|
|
4413
|
+
if (pt.call(x, "key")) {
|
|
4414
|
+
var L = Object.getOwnPropertyDescriptor(x, "key").get;
|
|
4415
4415
|
if (L && L.isReactWarning)
|
|
4416
4416
|
return !1;
|
|
4417
4417
|
}
|
|
4418
|
-
return
|
|
4418
|
+
return x.key !== void 0;
|
|
4419
4419
|
}
|
|
4420
|
-
function Ie(
|
|
4421
|
-
typeof
|
|
4420
|
+
function Ie(x, L) {
|
|
4421
|
+
typeof x.ref == "string" && jt.current;
|
|
4422
4422
|
}
|
|
4423
|
-
function $e(
|
|
4423
|
+
function $e(x, L) {
|
|
4424
4424
|
{
|
|
4425
4425
|
var q = function() {
|
|
4426
4426
|
Gt || (Gt = !0, v("%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://reactjs.org/link/special-props)", L));
|
|
4427
4427
|
};
|
|
4428
|
-
q.isReactWarning = !0, Object.defineProperty(
|
|
4428
|
+
q.isReactWarning = !0, Object.defineProperty(x, "key", {
|
|
4429
4429
|
get: q,
|
|
4430
4430
|
configurable: !0
|
|
4431
4431
|
});
|
|
4432
4432
|
}
|
|
4433
4433
|
}
|
|
4434
|
-
function _t(
|
|
4434
|
+
function _t(x, L) {
|
|
4435
4435
|
{
|
|
4436
4436
|
var q = function() {
|
|
4437
4437
|
G || (G = !0, v("%s: `ref` 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://reactjs.org/link/special-props)", L));
|
|
4438
4438
|
};
|
|
4439
|
-
q.isReactWarning = !0, Object.defineProperty(
|
|
4439
|
+
q.isReactWarning = !0, Object.defineProperty(x, "ref", {
|
|
4440
4440
|
get: q,
|
|
4441
4441
|
configurable: !0
|
|
4442
4442
|
});
|
|
4443
4443
|
}
|
|
4444
4444
|
}
|
|
4445
|
-
var z = function(
|
|
4445
|
+
var z = function(x, L, q, Y, le, me, ie) {
|
|
4446
4446
|
var oe = {
|
|
4447
4447
|
// This tag allows us to uniquely identify this as a React Element
|
|
4448
4448
|
$$typeof: e,
|
|
4449
4449
|
// Built-in properties that belong on the element
|
|
4450
|
-
type:
|
|
4450
|
+
type: x,
|
|
4451
4451
|
key: L,
|
|
4452
4452
|
ref: q,
|
|
4453
4453
|
props: ie,
|
|
@@ -4471,58 +4471,58 @@ function pu() {
|
|
|
4471
4471
|
value: le
|
|
4472
4472
|
}), Object.freeze && (Object.freeze(oe.props), Object.freeze(oe)), oe;
|
|
4473
4473
|
};
|
|
4474
|
-
function k(
|
|
4474
|
+
function k(x, L, q, Y, le) {
|
|
4475
4475
|
{
|
|
4476
4476
|
var me, ie = {}, oe = null, et = null;
|
|
4477
|
-
q !== void 0 && (
|
|
4477
|
+
q !== void 0 && (Te(q), oe = "" + q), Ne(L) && (Te(L.key), oe = "" + L.key), J(L) && (et = L.ref, Ie(L, le));
|
|
4478
4478
|
for (me in L)
|
|
4479
4479
|
pt.call(L, me) && !Lt.hasOwnProperty(me) && (ie[me] = L[me]);
|
|
4480
|
-
if (
|
|
4481
|
-
var ze =
|
|
4480
|
+
if (x && x.defaultProps) {
|
|
4481
|
+
var ze = x.defaultProps;
|
|
4482
4482
|
for (me in ze)
|
|
4483
4483
|
ie[me] === void 0 && (ie[me] = ze[me]);
|
|
4484
4484
|
}
|
|
4485
4485
|
if (oe || et) {
|
|
4486
|
-
var Ue = typeof
|
|
4486
|
+
var Ue = typeof x == "function" ? x.displayName || x.name || "Unknown" : x;
|
|
4487
4487
|
oe && $e(ie, Ue), et && _t(ie, Ue);
|
|
4488
4488
|
}
|
|
4489
|
-
return z(
|
|
4489
|
+
return z(x, oe, et, le, Y, jt.current, ie);
|
|
4490
4490
|
}
|
|
4491
4491
|
}
|
|
4492
4492
|
var K = w.ReactCurrentOwner, Q = w.ReactDebugCurrentFrame;
|
|
4493
|
-
function R(
|
|
4494
|
-
if (
|
|
4495
|
-
var L =
|
|
4493
|
+
function R(x) {
|
|
4494
|
+
if (x) {
|
|
4495
|
+
var L = x._owner, q = xt(x.type, x._source, L ? L.type : null);
|
|
4496
4496
|
Q.setExtraStackFrame(q);
|
|
4497
4497
|
} else
|
|
4498
4498
|
Q.setExtraStackFrame(null);
|
|
4499
4499
|
}
|
|
4500
4500
|
var ne;
|
|
4501
4501
|
ne = !1;
|
|
4502
|
-
function Z(
|
|
4503
|
-
return typeof
|
|
4502
|
+
function Z(x) {
|
|
4503
|
+
return typeof x == "object" && x !== null && x.$$typeof === e;
|
|
4504
4504
|
}
|
|
4505
4505
|
function ee() {
|
|
4506
4506
|
{
|
|
4507
4507
|
if (K.current) {
|
|
4508
|
-
var
|
|
4509
|
-
if (
|
|
4508
|
+
var x = F(K.current.type);
|
|
4509
|
+
if (x)
|
|
4510
4510
|
return `
|
|
4511
4511
|
|
|
4512
|
-
Check the render method of \`` +
|
|
4512
|
+
Check the render method of \`` + x + "`.";
|
|
4513
4513
|
}
|
|
4514
4514
|
return "";
|
|
4515
4515
|
}
|
|
4516
4516
|
}
|
|
4517
|
-
function fe(
|
|
4517
|
+
function fe(x) {
|
|
4518
4518
|
return "";
|
|
4519
4519
|
}
|
|
4520
|
-
var
|
|
4521
|
-
function te(
|
|
4520
|
+
var Ee = {};
|
|
4521
|
+
function te(x) {
|
|
4522
4522
|
{
|
|
4523
4523
|
var L = ee();
|
|
4524
4524
|
if (!L) {
|
|
4525
|
-
var q = typeof
|
|
4525
|
+
var q = typeof x == "string" ? x : x.displayName || x.name;
|
|
4526
4526
|
q && (L = `
|
|
4527
4527
|
|
|
4528
4528
|
Check the top-level render call using <` + q + ">.");
|
|
@@ -4530,41 +4530,41 @@ Check the top-level render call using <` + q + ">.");
|
|
|
4530
4530
|
return L;
|
|
4531
4531
|
}
|
|
4532
4532
|
}
|
|
4533
|
-
function se(
|
|
4533
|
+
function se(x, L) {
|
|
4534
4534
|
{
|
|
4535
|
-
if (!
|
|
4535
|
+
if (!x._store || x._store.validated || x.key != null)
|
|
4536
4536
|
return;
|
|
4537
|
-
|
|
4537
|
+
x._store.validated = !0;
|
|
4538
4538
|
var q = te(L);
|
|
4539
|
-
if (
|
|
4539
|
+
if (Ee[q])
|
|
4540
4540
|
return;
|
|
4541
|
-
|
|
4541
|
+
Ee[q] = !0;
|
|
4542
4542
|
var Y = "";
|
|
4543
|
-
|
|
4543
|
+
x && x._owner && x._owner !== K.current && (Y = " It was passed a child from " + F(x._owner.type) + "."), R(x), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', q, Y), R(null);
|
|
4544
4544
|
}
|
|
4545
4545
|
}
|
|
4546
|
-
function qe(
|
|
4546
|
+
function qe(x, L) {
|
|
4547
4547
|
{
|
|
4548
|
-
if (typeof
|
|
4548
|
+
if (typeof x != "object")
|
|
4549
4549
|
return;
|
|
4550
|
-
if (bt(
|
|
4551
|
-
for (var q = 0; q <
|
|
4552
|
-
var Y =
|
|
4550
|
+
if (bt(x))
|
|
4551
|
+
for (var q = 0; q < x.length; q++) {
|
|
4552
|
+
var Y = x[q];
|
|
4553
4553
|
Z(Y) && se(Y, L);
|
|
4554
4554
|
}
|
|
4555
|
-
else if (Z(
|
|
4556
|
-
|
|
4557
|
-
else if (
|
|
4558
|
-
var le = x
|
|
4559
|
-
if (typeof le == "function" && le !==
|
|
4560
|
-
for (var me = le.call(
|
|
4555
|
+
else if (Z(x))
|
|
4556
|
+
x._store && (x._store.validated = !0);
|
|
4557
|
+
else if (x) {
|
|
4558
|
+
var le = b(x);
|
|
4559
|
+
if (typeof le == "function" && le !== x.entries)
|
|
4560
|
+
for (var me = le.call(x), ie; !(ie = me.next()).done; )
|
|
4561
4561
|
Z(ie.value) && se(ie.value, L);
|
|
4562
4562
|
}
|
|
4563
4563
|
}
|
|
4564
4564
|
}
|
|
4565
|
-
function Ge(
|
|
4565
|
+
function Ge(x) {
|
|
4566
4566
|
{
|
|
4567
|
-
var L =
|
|
4567
|
+
var L = x.type;
|
|
4568
4568
|
if (L == null || typeof L == "string")
|
|
4569
4569
|
return;
|
|
4570
4570
|
var q;
|
|
@@ -4578,7 +4578,7 @@ Check the top-level render call using <` + q + ">.");
|
|
|
4578
4578
|
return;
|
|
4579
4579
|
if (q) {
|
|
4580
4580
|
var Y = F(L);
|
|
4581
|
-
Ft(q,
|
|
4581
|
+
Ft(q, x.props, "prop", Y, x);
|
|
4582
4582
|
} else if (L.PropTypes !== void 0 && !ne) {
|
|
4583
4583
|
ne = !0;
|
|
4584
4584
|
var le = F(L);
|
|
@@ -4587,31 +4587,31 @@ Check the top-level render call using <` + q + ">.");
|
|
|
4587
4587
|
typeof L.getDefaultProps == "function" && !L.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
4588
4588
|
}
|
|
4589
4589
|
}
|
|
4590
|
-
function Fe(
|
|
4590
|
+
function Fe(x) {
|
|
4591
4591
|
{
|
|
4592
|
-
for (var L = Object.keys(
|
|
4592
|
+
for (var L = Object.keys(x.props), q = 0; q < L.length; q++) {
|
|
4593
4593
|
var Y = L[q];
|
|
4594
4594
|
if (Y !== "children" && Y !== "key") {
|
|
4595
|
-
R(
|
|
4595
|
+
R(x), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Y), R(null);
|
|
4596
4596
|
break;
|
|
4597
4597
|
}
|
|
4598
4598
|
}
|
|
4599
|
-
|
|
4599
|
+
x.ref !== null && (R(x), v("Invalid attribute `ref` supplied to `React.Fragment`."), R(null));
|
|
4600
4600
|
}
|
|
4601
4601
|
}
|
|
4602
4602
|
var ve = {};
|
|
4603
|
-
function Ye(
|
|
4603
|
+
function Ye(x, L, q, Y, le, me) {
|
|
4604
4604
|
{
|
|
4605
|
-
var ie = M(
|
|
4605
|
+
var ie = M(x);
|
|
4606
4606
|
if (!ie) {
|
|
4607
4607
|
var oe = "";
|
|
4608
|
-
(
|
|
4608
|
+
(x === void 0 || typeof x == "object" && x !== null && Object.keys(x).length === 0) && (oe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
4609
4609
|
var et = fe();
|
|
4610
4610
|
et ? oe += et : oe += ee();
|
|
4611
4611
|
var ze;
|
|
4612
|
-
|
|
4612
|
+
x === null ? ze = "null" : bt(x) ? ze = "array" : x !== void 0 && x.$$typeof === e ? (ze = "<" + (F(x.type) || "Unknown") + " />", oe = " Did you accidentally export a JSX literal instead of a component?") : ze = typeof x, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ze, oe);
|
|
4613
4613
|
}
|
|
4614
|
-
var Ue = k(
|
|
4614
|
+
var Ue = k(x, L, q, le, me);
|
|
4615
4615
|
if (Ue == null)
|
|
4616
4616
|
return Ue;
|
|
4617
4617
|
if (ie) {
|
|
@@ -4620,15 +4620,15 @@ Check the top-level render call using <` + q + ">.");
|
|
|
4620
4620
|
if (Y)
|
|
4621
4621
|
if (bt(mt)) {
|
|
4622
4622
|
for (var Ar = 0; Ar < mt.length; Ar++)
|
|
4623
|
-
qe(mt[Ar],
|
|
4623
|
+
qe(mt[Ar], x);
|
|
4624
4624
|
Object.freeze && Object.freeze(mt);
|
|
4625
4625
|
} else
|
|
4626
4626
|
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
4627
4627
|
else
|
|
4628
|
-
qe(mt,
|
|
4628
|
+
qe(mt, x);
|
|
4629
4629
|
}
|
|
4630
4630
|
if (pt.call(L, "key")) {
|
|
4631
|
-
var cr = F(
|
|
4631
|
+
var cr = F(x), ot = Object.keys(L).filter(function(Ra) {
|
|
4632
4632
|
return Ra !== "key";
|
|
4633
4633
|
}), Ss = ot.length > 0 ? "{key: someKey, " + ot.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
4634
4634
|
if (!ve[cr + Ss]) {
|
|
@@ -4641,14 +4641,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
4641
4641
|
<%s key={someKey} {...props} />`, Ss, cr, Pa, cr), ve[cr + Ss] = !0;
|
|
4642
4642
|
}
|
|
4643
4643
|
}
|
|
4644
|
-
return
|
|
4644
|
+
return x === n ? Fe(Ue) : Ge(Ue), Ue;
|
|
4645
4645
|
}
|
|
4646
4646
|
}
|
|
4647
|
-
function Xe(
|
|
4648
|
-
return Ye(
|
|
4647
|
+
function Xe(x, L, q) {
|
|
4648
|
+
return Ye(x, L, q, !0);
|
|
4649
4649
|
}
|
|
4650
|
-
function gt(
|
|
4651
|
-
return Ye(
|
|
4650
|
+
function gt(x, L, q) {
|
|
4651
|
+
return Ye(x, L, q, !1);
|
|
4652
4652
|
}
|
|
4653
4653
|
var Vt = gt, vt = Xe;
|
|
4654
4654
|
Vr.Fragment = n, Vr.jsx = Vt, Vr.jsxs = vt;
|
|
@@ -4748,7 +4748,7 @@ function vf({
|
|
|
4748
4748
|
title: n,
|
|
4749
4749
|
emptyMessage: s = "No items found",
|
|
4750
4750
|
renderItem: o,
|
|
4751
|
-
keyExtractor: i = (m,
|
|
4751
|
+
keyExtractor: i = (m, b) => m.id || m._id || String(b),
|
|
4752
4752
|
searchable: l = !1,
|
|
4753
4753
|
searchFields: a = [],
|
|
4754
4754
|
searchPlaceholder: u = "Search...",
|
|
@@ -4758,16 +4758,16 @@ function vf({
|
|
|
4758
4758
|
onRefresh: h,
|
|
4759
4759
|
theme: g = {}
|
|
4760
4760
|
}) {
|
|
4761
|
-
const { data: m, loading:
|
|
4761
|
+
const { data: m, loading: b, error: w, refetch: v } = fu(r, e), [A, C] = H(""), [E, y] = H({}), [_, D] = H(1), S = Et(() => {
|
|
4762
4762
|
if (!m) return { data: [], total: 0, totalPages: 0 };
|
|
4763
4763
|
let j = m;
|
|
4764
4764
|
return l && A && a.length > 0 && (j = js.search(j, A, a)), Object.keys(E).length > 0 && (j = js.filterByFields(j, E)), js.paginate(j, _, d);
|
|
4765
4765
|
}, [m, A, E, _, d, l, a]);
|
|
4766
|
-
|
|
4766
|
+
Se(() => {
|
|
4767
4767
|
D(1);
|
|
4768
4768
|
}, [A, E]);
|
|
4769
4769
|
const M = () => {
|
|
4770
|
-
C(""),
|
|
4770
|
+
C(""), y({}), D(1), v(), h == null || h();
|
|
4771
4771
|
}, T = {
|
|
4772
4772
|
background: g.background || "#ffffff",
|
|
4773
4773
|
cardBackground: g.cardBackground || "#f9fafb",
|
|
@@ -4782,7 +4782,7 @@ function vf({
|
|
|
4782
4782
|
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: T.text }, children: j.title || j.name || j.label || "Untitled" }),
|
|
4783
4783
|
j.description && /* @__PURE__ */ p.jsx("div", { style: { fontSize: "13px", color: T.textSecondary, marginTop: "4px" }, children: j.description })
|
|
4784
4784
|
] }));
|
|
4785
|
-
return
|
|
4785
|
+
return b && !m ? /* @__PURE__ */ p.jsx("div", { style: {
|
|
4786
4786
|
display: "flex",
|
|
4787
4787
|
alignItems: "center",
|
|
4788
4788
|
justifyContent: "center",
|
|
@@ -4877,7 +4877,7 @@ function vf({
|
|
|
4877
4877
|
padding: "48px",
|
|
4878
4878
|
textAlign: "center",
|
|
4879
4879
|
color: T.textSecondary
|
|
4880
|
-
}, children: s }) : S.data.map((j,
|
|
4880
|
+
}, children: s }) : S.data.map((j, I) => /* @__PURE__ */ p.jsx(
|
|
4881
4881
|
"div",
|
|
4882
4882
|
{
|
|
4883
4883
|
onClick: () => f == null ? void 0 : f(j),
|
|
@@ -4893,9 +4893,9 @@ function vf({
|
|
|
4893
4893
|
onMouseLeave: (X) => {
|
|
4894
4894
|
X.currentTarget.style.background = T.cardBackground;
|
|
4895
4895
|
},
|
|
4896
|
-
children: F(j,
|
|
4896
|
+
children: F(j, I)
|
|
4897
4897
|
},
|
|
4898
|
-
i(j,
|
|
4898
|
+
i(j, I)
|
|
4899
4899
|
)) }),
|
|
4900
4900
|
S.totalPages > 1 && /* @__PURE__ */ p.jsxs("div", { style: {
|
|
4901
4901
|
padding: "16px",
|
|
@@ -5049,81 +5049,81 @@ function Df({
|
|
|
5049
5049
|
cardSize: o = "medium",
|
|
5050
5050
|
className: i = ""
|
|
5051
5051
|
}) {
|
|
5052
|
-
const l = Math.min(Math.max(e, 1), 5), [a, u] = H([]), [c, d] = H([]), [f, h] = H(Array(l).fill(!1)), [g, m] = H(Array(l).fill(!1)),
|
|
5053
|
-
const _ = r.filter((S) => !
|
|
5052
|
+
const l = Math.min(Math.max(e, 1), 5), [a, u] = H([]), [c, d] = H([]), [f, h] = H(Array(l).fill(!1)), [g, m] = H(Array(l).fill(!1)), b = ye([]), w = re((y) => {
|
|
5053
|
+
const _ = r.filter((S) => !y.includes(S._id));
|
|
5054
5054
|
if (_.length === 0) return null;
|
|
5055
5055
|
const D = Math.floor(Math.random() * _.length);
|
|
5056
5056
|
return _[D];
|
|
5057
5057
|
}, [r]), v = re(() => Math.random() * (n - t) + t, [t, n]);
|
|
5058
|
-
|
|
5058
|
+
Se(() => {
|
|
5059
5059
|
if (r.length === 0) {
|
|
5060
5060
|
u([]), d([]);
|
|
5061
5061
|
return;
|
|
5062
5062
|
}
|
|
5063
|
-
const
|
|
5063
|
+
const y = [], _ = [], D = [];
|
|
5064
5064
|
for (let S = 0; S < l && S < r.length; S++) {
|
|
5065
5065
|
const M = w(D);
|
|
5066
|
-
M && (
|
|
5066
|
+
M && (y.push(M), D.push(M._id));
|
|
5067
5067
|
}
|
|
5068
|
-
for (let S = 0; S <
|
|
5068
|
+
for (let S = 0; S < y.length; S++) {
|
|
5069
5069
|
const M = [
|
|
5070
|
-
|
|
5071
|
-
...
|
|
5070
|
+
y[S]._id,
|
|
5071
|
+
...y.filter((B, F) => F !== S).map((B) => B._id)
|
|
5072
5072
|
], T = w(M);
|
|
5073
|
-
T ? _.push(T) : _.push(
|
|
5073
|
+
T ? _.push(T) : _.push(y[S]);
|
|
5074
5074
|
}
|
|
5075
|
-
u(
|
|
5075
|
+
u(y), d(_);
|
|
5076
5076
|
}, [r, l, w]);
|
|
5077
|
-
const A = re((
|
|
5077
|
+
const A = re((y) => {
|
|
5078
5078
|
const _ = v(), D = setTimeout(() => {
|
|
5079
5079
|
h((S) => {
|
|
5080
5080
|
const M = [...S];
|
|
5081
|
-
return M[
|
|
5081
|
+
return M[y] = !M[y], M;
|
|
5082
5082
|
}), setTimeout(() => {
|
|
5083
5083
|
m((S) => {
|
|
5084
5084
|
const M = [...S];
|
|
5085
|
-
return M[
|
|
5085
|
+
return M[y] = !M[y], M;
|
|
5086
5086
|
}), setTimeout(() => {
|
|
5087
|
-
const S = !g[
|
|
5087
|
+
const S = !g[y];
|
|
5088
5088
|
S && u((M) => {
|
|
5089
5089
|
const T = [...M];
|
|
5090
|
-
return T[
|
|
5090
|
+
return T[y] = c[y], T;
|
|
5091
5091
|
}), d((M) => {
|
|
5092
5092
|
const T = [...M], F = [
|
|
5093
|
-
(S ? c[
|
|
5094
|
-
...a.filter((
|
|
5095
|
-
...M.filter((
|
|
5093
|
+
(S ? c[y] : a[y])._id,
|
|
5094
|
+
...a.filter((I, X) => X !== y).map((I) => I._id),
|
|
5095
|
+
...M.filter((I, X) => X !== y).map((I) => I._id)
|
|
5096
5096
|
], j = w(F);
|
|
5097
|
-
return j && (T[
|
|
5097
|
+
return j && (T[y] = j), T;
|
|
5098
5098
|
}), setTimeout(() => {
|
|
5099
|
-
A(
|
|
5099
|
+
A(y);
|
|
5100
5100
|
}, 150);
|
|
5101
5101
|
}, 200);
|
|
5102
5102
|
}, 150);
|
|
5103
5103
|
}, _);
|
|
5104
|
-
|
|
5104
|
+
b.current[y] = D;
|
|
5105
5105
|
}, [v, w, a, c, g]), C = ye(!1);
|
|
5106
|
-
|
|
5106
|
+
Se(() => {
|
|
5107
5107
|
if (!(a.length === 0 || r.length <= 1) && !C.current) {
|
|
5108
5108
|
C.current = !0;
|
|
5109
|
-
for (let
|
|
5110
|
-
A(
|
|
5109
|
+
for (let y = 0; y < a.length; y++)
|
|
5110
|
+
A(y);
|
|
5111
5111
|
return () => {
|
|
5112
|
-
|
|
5112
|
+
b.current.forEach((y) => clearTimeout(y)), b.current = [], C.current = !1;
|
|
5113
5113
|
};
|
|
5114
5114
|
}
|
|
5115
5115
|
}, [a.length, r.length]);
|
|
5116
|
-
const E = (
|
|
5117
|
-
s && s(
|
|
5116
|
+
const E = (y) => {
|
|
5117
|
+
s && s(y);
|
|
5118
5118
|
};
|
|
5119
|
-
return r.length === 0 ? /* @__PURE__ */ p.jsx("div", { className: `flex items-center justify-center p-8 ${i}`, children: /* @__PURE__ */ p.jsx("p", { className: "text-gray-500", children: "No nodes available" }) }) : a.length === 0 ? /* @__PURE__ */ p.jsx("div", { className: `flex items-center justify-center p-8 ${i}`, children: /* @__PURE__ */ p.jsx("p", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ p.jsx("div", { className: `flex gap-4 justify-center items-center flex-wrap ${i}`, children: a.map((
|
|
5119
|
+
return r.length === 0 ? /* @__PURE__ */ p.jsx("div", { className: `flex items-center justify-center p-8 ${i}`, children: /* @__PURE__ */ p.jsx("p", { className: "text-gray-500", children: "No nodes available" }) }) : a.length === 0 ? /* @__PURE__ */ p.jsx("div", { className: `flex items-center justify-center p-8 ${i}`, children: /* @__PURE__ */ p.jsx("p", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ p.jsx("div", { className: `flex gap-4 justify-center items-center flex-wrap ${i}`, children: a.map((y, _) => {
|
|
5120
5120
|
const D = c[_], S = g[_];
|
|
5121
5121
|
return /* @__PURE__ */ p.jsx(
|
|
5122
5122
|
"div",
|
|
5123
5123
|
{
|
|
5124
5124
|
className: `relative ${gu[o]}`,
|
|
5125
5125
|
style: { perspective: "1000px" },
|
|
5126
|
-
onClick: () => E(S ? D :
|
|
5126
|
+
onClick: () => E(S ? D : y),
|
|
5127
5127
|
children: /* @__PURE__ */ p.jsxs(
|
|
5128
5128
|
"div",
|
|
5129
5129
|
{
|
|
@@ -5153,12 +5153,12 @@ function Df({
|
|
|
5153
5153
|
/* @__PURE__ */ p.jsx(
|
|
5154
5154
|
"img",
|
|
5155
5155
|
{
|
|
5156
|
-
src:
|
|
5157
|
-
alt:
|
|
5156
|
+
src: y.data.image,
|
|
5157
|
+
alt: y.title,
|
|
5158
5158
|
className: "w-full h-full object-cover"
|
|
5159
5159
|
}
|
|
5160
5160
|
),
|
|
5161
|
-
/* @__PURE__ */ p.jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2", children: /* @__PURE__ */ p.jsx("p", { className: "text-white text-sm font-medium truncate", children:
|
|
5161
|
+
/* @__PURE__ */ p.jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2", children: /* @__PURE__ */ p.jsx("p", { className: "text-white text-sm font-medium truncate", children: y.title }) })
|
|
5162
5162
|
]
|
|
5163
5163
|
}
|
|
5164
5164
|
)
|
|
@@ -5251,16 +5251,16 @@ function Af({
|
|
|
5251
5251
|
onSelectionChange: h,
|
|
5252
5252
|
onDelete: g,
|
|
5253
5253
|
onError: m,
|
|
5254
|
-
onLoad:
|
|
5254
|
+
onLoad: b,
|
|
5255
5255
|
renderItem: w,
|
|
5256
5256
|
renderDetail: v,
|
|
5257
5257
|
renderActions: A,
|
|
5258
5258
|
renderEmpty: C,
|
|
5259
5259
|
renderLoading: E,
|
|
5260
|
-
theme:
|
|
5260
|
+
theme: y = {}
|
|
5261
5261
|
}) {
|
|
5262
|
-
const _ = { ...mu, ...
|
|
5263
|
-
u ? u(G) :
|
|
5262
|
+
const _ = { ...mu, ...y }, [D, S] = H([]), [M, T] = H(!1), [B, F] = H(null), [j, I] = H(/* @__PURE__ */ new Set()), [X, de] = H(null), [Ce, ae] = H(null), [Oe, xe] = H(null), [pe, be] = H(!1), [_e, ke] = H(""), ge = a !== void 0 ? a : _e, De = (G) => {
|
|
5263
|
+
u ? u(G) : ke(G);
|
|
5264
5264
|
}, Le = Et(() => {
|
|
5265
5265
|
if (!ge.trim()) return D;
|
|
5266
5266
|
const G = ge.toLowerCase();
|
|
@@ -5272,16 +5272,16 @@ function Af({
|
|
|
5272
5272
|
T(!0), F(null);
|
|
5273
5273
|
try {
|
|
5274
5274
|
const G = await ue.listEmails(t, n, s);
|
|
5275
|
-
G != null && G.messages && (S(G.messages),
|
|
5275
|
+
G != null && G.messages && (S(G.messages), b == null || b(G.messages));
|
|
5276
5276
|
} catch (G) {
|
|
5277
5277
|
const J = G instanceof Error ? G : new Error("Failed to fetch emails");
|
|
5278
5278
|
F(J.message), m == null || m(J);
|
|
5279
5279
|
}
|
|
5280
5280
|
T(!1);
|
|
5281
5281
|
}
|
|
5282
|
-
}, [ue, t, n, s, m,
|
|
5283
|
-
|
|
5284
|
-
S([]),
|
|
5282
|
+
}, [ue, t, n, s, m, b]);
|
|
5283
|
+
Se(() => {
|
|
5284
|
+
S([]), I(/* @__PURE__ */ new Set()), ae(null), F(null), a === void 0 && ke(""), d && Me();
|
|
5285
5285
|
}, [s, d]);
|
|
5286
5286
|
const ct = re(async (G) => {
|
|
5287
5287
|
if (ue) {
|
|
@@ -5304,15 +5304,15 @@ function Af({
|
|
|
5304
5304
|
const Ie = G.uid;
|
|
5305
5305
|
if (Ne.shiftKey && X !== null) {
|
|
5306
5306
|
const $e = Math.min(X, J), _t = Math.max(X, J), z = D.slice($e, _t + 1).map((K) => K.uid), k = new Set(z);
|
|
5307
|
-
|
|
5307
|
+
I(k), h == null || h(Array.from(k));
|
|
5308
5308
|
} else if (Ne.ctrlKey || Ne.metaKey)
|
|
5309
|
-
|
|
5309
|
+
I(($e) => {
|
|
5310
5310
|
const _t = new Set($e);
|
|
5311
5311
|
return _t.has(Ie) ? _t.delete(Ie) : _t.add(Ie), h == null || h(Array.from(_t)), _t;
|
|
5312
5312
|
}), de(J);
|
|
5313
5313
|
else {
|
|
5314
5314
|
const $e = /* @__PURE__ */ new Set([Ie]);
|
|
5315
|
-
|
|
5315
|
+
I($e), de(J), h == null || h(Array.from($e));
|
|
5316
5316
|
}
|
|
5317
5317
|
}, [o, X, D, j, f, h, i]), it = re(async () => {
|
|
5318
5318
|
if (!ue || j.size === 0) return;
|
|
@@ -5322,7 +5322,7 @@ function Af({
|
|
|
5322
5322
|
if (console.log("Trash result:", J), J.success && J.moved > 0) {
|
|
5323
5323
|
S((Ie) => Ie.filter(($e) => !j.has($e.uid)));
|
|
5324
5324
|
const Ne = Array.from(j);
|
|
5325
|
-
|
|
5325
|
+
I(/* @__PURE__ */ new Set()), g == null || g(Ne);
|
|
5326
5326
|
} else
|
|
5327
5327
|
F("Failed to move emails to trash");
|
|
5328
5328
|
} catch (J) {
|
|
@@ -5337,7 +5337,7 @@ function Af({
|
|
|
5337
5337
|
if (console.log("Archive result:", J), J.success && J.archived > 0) {
|
|
5338
5338
|
S((Ie) => Ie.filter(($e) => !j.has($e.uid)));
|
|
5339
5339
|
const Ne = Array.from(j);
|
|
5340
|
-
|
|
5340
|
+
I(/* @__PURE__ */ new Set()), g == null || g(Ne);
|
|
5341
5341
|
} else
|
|
5342
5342
|
F("Failed to archive emails");
|
|
5343
5343
|
} catch (J) {
|
|
@@ -5346,13 +5346,13 @@ function Af({
|
|
|
5346
5346
|
}
|
|
5347
5347
|
}, [ue, t, j, s, g, m]), pt = re(() => {
|
|
5348
5348
|
if (j.size === D.length)
|
|
5349
|
-
|
|
5349
|
+
I(/* @__PURE__ */ new Set()), h == null || h([]);
|
|
5350
5350
|
else {
|
|
5351
5351
|
const G = new Set(D.map((J) => J.uid));
|
|
5352
|
-
|
|
5352
|
+
I(G), h == null || h(Array.from(G));
|
|
5353
5353
|
}
|
|
5354
5354
|
}, [D, j.size, h]), Zt = re(() => {
|
|
5355
|
-
|
|
5355
|
+
I(/* @__PURE__ */ new Set()), h == null || h([]);
|
|
5356
5356
|
}, [h]), Wt = {
|
|
5357
5357
|
delete: it,
|
|
5358
5358
|
archive: xt,
|
|
@@ -5500,15 +5500,15 @@ function Af({
|
|
|
5500
5500
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "refresh" })
|
|
5501
5501
|
}
|
|
5502
5502
|
)
|
|
5503
|
-
] }),
|
|
5503
|
+
] }), U = () => /* @__PURE__ */ p.jsx("div", { style: {
|
|
5504
5504
|
padding: "48px",
|
|
5505
5505
|
textAlign: "center",
|
|
5506
5506
|
color: _.textSecondary
|
|
5507
|
-
}, children: c }),
|
|
5507
|
+
}, children: c }), Ae = () => /* @__PURE__ */ p.jsx("div", { style: {
|
|
5508
5508
|
padding: "48px",
|
|
5509
5509
|
textAlign: "center",
|
|
5510
5510
|
color: _.textSecondary
|
|
5511
|
-
}, children: "Loading..." }), Be = w || Ft,
|
|
5511
|
+
}, children: "Loading..." }), Be = w || Ft, Te = v || dt, jt = A || bt, Lt = C || U, Gt = E || Ae;
|
|
5512
5512
|
return M && D.length === 0 ? /* @__PURE__ */ p.jsx("div", { style: { background: _.background, width: "100%", height: "100%" }, children: Gt() }) : /* @__PURE__ */ p.jsxs("div", { style: { display: "flex", background: _.background, width: "100%", height: "100%" }, children: [
|
|
5513
5513
|
/* @__PURE__ */ p.jsxs("div", { style: {
|
|
5514
5514
|
flex: i && Ce ? "0 0 50%" : "1",
|
|
@@ -5585,7 +5585,7 @@ function Af({
|
|
|
5585
5585
|
G.uid
|
|
5586
5586
|
)) })
|
|
5587
5587
|
] }),
|
|
5588
|
-
i && Ce && /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children:
|
|
5588
|
+
i && Ce && /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: Te(Ce) })
|
|
5589
5589
|
] });
|
|
5590
5590
|
}
|
|
5591
5591
|
function Ef({
|
|
@@ -5601,10 +5601,10 @@ function Ef({
|
|
|
5601
5601
|
}) {
|
|
5602
5602
|
const [u, c] = H(/* @__PURE__ */ new Set()), [d, f] = H(-1), h = r.filter((C) => u.has(C.id)), g = d >= 0 && d < h.length ? h[d] : null, m = re((C) => {
|
|
5603
5603
|
c((E) => {
|
|
5604
|
-
const
|
|
5605
|
-
return
|
|
5604
|
+
const y = new Set(E);
|
|
5605
|
+
return y.has(C) ? y.delete(C) : y.add(C), t == null || t(Array.from(y)), y;
|
|
5606
5606
|
});
|
|
5607
|
-
}, [t]),
|
|
5607
|
+
}, [t]), b = re(() => {
|
|
5608
5608
|
if (u.size === r.length)
|
|
5609
5609
|
c(/* @__PURE__ */ new Set()), f(-1), t == null || t([]);
|
|
5610
5610
|
else {
|
|
@@ -5630,7 +5630,7 @@ function Ef({
|
|
|
5630
5630
|
l && /* @__PURE__ */ p.jsxs(
|
|
5631
5631
|
"button",
|
|
5632
5632
|
{
|
|
5633
|
-
onClick:
|
|
5633
|
+
onClick: b,
|
|
5634
5634
|
className: "flex items-center gap-1 hover:text-neutral-700 transition-colors",
|
|
5635
5635
|
children: [
|
|
5636
5636
|
/* @__PURE__ */ p.jsx("span", { className: "material-icons text-sm", children: u.size === r.length ? "check_box" : u.size > 0 ? "indeterminate_check_box" : "check_box_outline_blank" }),
|
|
@@ -5671,23 +5671,23 @@ function Ef({
|
|
|
5671
5671
|
] })
|
|
5672
5672
|
] }),
|
|
5673
5673
|
/* @__PURE__ */ p.jsx("div", { className: "space-y-1", children: r.map((C) => {
|
|
5674
|
-
const E = u.has(C.id),
|
|
5674
|
+
const E = u.has(C.id), y = (g == null ? void 0 : g.id) === C.id;
|
|
5675
5675
|
return /* @__PURE__ */ p.jsxs(
|
|
5676
5676
|
"div",
|
|
5677
5677
|
{
|
|
5678
|
-
className: `flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${
|
|
5678
|
+
className: `flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${y ? "bg-blue-50 ring-1 ring-blue-200" : E ? "bg-neutral-100" : "hover:bg-neutral-50"}`,
|
|
5679
5679
|
onClick: () => m(C.id),
|
|
5680
5680
|
children: [
|
|
5681
5681
|
/* @__PURE__ */ p.jsx("span", { className: `material-icons text-lg ${E ? "text-blue-500" : "text-neutral-300"}`, children: E ? "check_box" : "check_box_outline_blank" }),
|
|
5682
|
-
/* @__PURE__ */ p.jsx("div", { className: "flex-1 min-w-0", children: e(C, E,
|
|
5682
|
+
/* @__PURE__ */ p.jsx("div", { className: "flex-1 min-w-0", children: e(C, E, y) })
|
|
5683
5683
|
]
|
|
5684
5684
|
},
|
|
5685
5685
|
C.id
|
|
5686
5686
|
);
|
|
5687
5687
|
}) }),
|
|
5688
5688
|
o.length > 0 && u.size > 0 && /* @__PURE__ */ p.jsx("div", { className: "flex items-center gap-2 pt-2 border-t border-neutral-100", children: o.map((C) => {
|
|
5689
|
-
var
|
|
5690
|
-
const E = ((
|
|
5689
|
+
var y;
|
|
5690
|
+
const E = ((y = C.disabled) == null ? void 0 : y.call(C, h)) ?? !1;
|
|
5691
5691
|
return /* @__PURE__ */ p.jsxs(
|
|
5692
5692
|
"button",
|
|
5693
5693
|
{
|
|
@@ -5788,15 +5788,15 @@ function Nl(r, e, t) {
|
|
|
5788
5788
|
}(r), o = /* @__PURE__ */ new Map(), i = r.getRootElement(), l = r._editorState, a = r._blockCursorElement;
|
|
5789
5789
|
let u = !1, c = "";
|
|
5790
5790
|
for (let f = 0; f < e.length; f++) {
|
|
5791
|
-
const h = e[f], g = h.type, m = h.target,
|
|
5792
|
-
if (!
|
|
5793
|
-
const [w, v] =
|
|
5794
|
-
if (g === "characterData") n &&
|
|
5791
|
+
const h = e[f], g = h.type, m = h.target, b = ec(m, r, l, i);
|
|
5792
|
+
if (!b) continue;
|
|
5793
|
+
const [w, v] = b;
|
|
5794
|
+
if (g === "characterData") n && $(v) && Zu(s, m, v) && Xu(m, v, r);
|
|
5795
5795
|
else if (g === "childList") {
|
|
5796
5796
|
u = !0;
|
|
5797
5797
|
const A = h.addedNodes;
|
|
5798
|
-
for (let
|
|
5799
|
-
const _ = A[
|
|
5798
|
+
for (let y = 0; y < A.length; y++) {
|
|
5799
|
+
const _ = A[y], D = Ol(_), S = _.parentNode;
|
|
5800
5800
|
if (S != null && _ !== a && D === null && !Ls(_, S, r)) {
|
|
5801
5801
|
if (or) {
|
|
5802
5802
|
const M = _.innerText || _.nodeValue;
|
|
@@ -5807,12 +5807,12 @@ function Nl(r, e, t) {
|
|
|
5807
5807
|
}
|
|
5808
5808
|
const C = h.removedNodes, E = C.length;
|
|
5809
5809
|
if (E > 0) {
|
|
5810
|
-
let
|
|
5810
|
+
let y = 0;
|
|
5811
5811
|
for (let _ = 0; _ < E; _++) {
|
|
5812
5812
|
const D = C[_];
|
|
5813
|
-
(Ls(D, m, r) || a === D) && (m.appendChild(D),
|
|
5813
|
+
(Ls(D, m, r) || a === D) && (m.appendChild(D), y++);
|
|
5814
5814
|
}
|
|
5815
|
-
E !==
|
|
5815
|
+
E !== y && o.set(w, v);
|
|
5816
5816
|
}
|
|
5817
5817
|
}
|
|
5818
5818
|
}
|
|
@@ -5821,8 +5821,8 @@ function Nl(r, e, t) {
|
|
|
5821
5821
|
if (d.length > 0) {
|
|
5822
5822
|
for (let f = 0; f < d.length; f++) {
|
|
5823
5823
|
const h = d[f], g = h.addedNodes, m = h.target;
|
|
5824
|
-
for (let
|
|
5825
|
-
const w = g[
|
|
5824
|
+
for (let b = 0; b < g.length; b++) {
|
|
5825
|
+
const w = g[b], v = w.parentNode;
|
|
5826
5826
|
v == null || w.nodeName !== "BR" || Ls(w, m, r) || v.removeChild(w);
|
|
5827
5827
|
}
|
|
5828
5828
|
}
|
|
@@ -5856,7 +5856,7 @@ function ro(r, e) {
|
|
|
5856
5856
|
function no(r) {
|
|
5857
5857
|
let e, t, n = r;
|
|
5858
5858
|
if (n.__text !== "" || !n.isSimpleText() || n.isUnmergeable()) {
|
|
5859
|
-
for (; (e = n.getPreviousSibling()) !== null &&
|
|
5859
|
+
for (; (e = n.getPreviousSibling()) !== null && $(e) && e.isSimpleText() && !e.isUnmergeable(); ) {
|
|
5860
5860
|
if (e.__text !== "") {
|
|
5861
5861
|
if (to(e, n)) {
|
|
5862
5862
|
n = ro(e, n);
|
|
@@ -5866,7 +5866,7 @@ function no(r) {
|
|
|
5866
5866
|
}
|
|
5867
5867
|
e.remove();
|
|
5868
5868
|
}
|
|
5869
|
-
for (; (t = n.getNextSibling()) !== null &&
|
|
5869
|
+
for (; (t = n.getNextSibling()) !== null && $(t) && t.isSimpleText() && !t.isUnmergeable(); ) {
|
|
5870
5870
|
if (t.__text !== "") {
|
|
5871
5871
|
if (to(n, t)) {
|
|
5872
5872
|
n = ro(n, t);
|
|
@@ -5885,7 +5885,7 @@ function so(r) {
|
|
|
5885
5885
|
for (; r.type === "element"; ) {
|
|
5886
5886
|
const e = r.getNode(), t = r.offset;
|
|
5887
5887
|
let n, s;
|
|
5888
|
-
if (t === e.getChildrenSize() ? (n = e.getChildAtIndex(t - 1), s = !0) : (n = e.getChildAtIndex(t), s = !1),
|
|
5888
|
+
if (t === e.getChildrenSize() ? (n = e.getChildAtIndex(t - 1), s = !0) : (n = e.getChildAtIndex(t), s = !1), $(n)) {
|
|
5889
5889
|
r.set(n.__key, s ? n.getTextContentSize() : 0, "text");
|
|
5890
5890
|
break;
|
|
5891
5891
|
}
|
|
@@ -5947,7 +5947,7 @@ function Yn(r, e, t) {
|
|
|
5947
5947
|
return e === "subscript" ? s &= -65 : e === "superscript" && (s &= -33), s;
|
|
5948
5948
|
}
|
|
5949
5949
|
function Rl(r) {
|
|
5950
|
-
return
|
|
5950
|
+
return $(r) || mr(r) || we(r);
|
|
5951
5951
|
}
|
|
5952
5952
|
function sc(r, e) {
|
|
5953
5953
|
if (e != null) return void (r.__key = e);
|
|
@@ -6094,7 +6094,7 @@ function Ni(r, e, t) {
|
|
|
6094
6094
|
if (s !== null) {
|
|
6095
6095
|
let l = ql(s);
|
|
6096
6096
|
const a = Or(s);
|
|
6097
|
-
if (l !== null &&
|
|
6097
|
+
if (l !== null && $(a)) {
|
|
6098
6098
|
if (l === ps && t) {
|
|
6099
6099
|
const u = t.length;
|
|
6100
6100
|
l = t, o = u, i = u;
|
|
@@ -6141,7 +6141,7 @@ function ic(r, e) {
|
|
|
6141
6141
|
const t = r.anchor.offset, n = e.getParentOrThrow(), s = e.isToken();
|
|
6142
6142
|
return t === 0 ? !e.canInsertTextBefore() || !n.canInsertTextBefore() && !e.isComposing() || s || function(o) {
|
|
6143
6143
|
const i = o.getPreviousSibling();
|
|
6144
|
-
return (
|
|
6144
|
+
return ($(i) || N(i) && i.isInline()) && !i.canInsertTextAfter();
|
|
6145
6145
|
}(e) : t === e.getTextContentSize() && (!e.canInsertTextAfter() || !n.canInsertTextAfter() && !e.isComposing() || s);
|
|
6146
6146
|
}
|
|
6147
6147
|
function lo(r) {
|
|
@@ -6212,7 +6212,7 @@ function Ul(r) {
|
|
|
6212
6212
|
const e = xs(r).event, t = e && e.inputType;
|
|
6213
6213
|
return t === "insertFromPaste" || t === "insertFromPasteAsQuotation";
|
|
6214
6214
|
}
|
|
6215
|
-
function
|
|
6215
|
+
function W(r, e, t) {
|
|
6216
6216
|
return ha(r, e, t);
|
|
6217
6217
|
}
|
|
6218
6218
|
function ys(r) {
|
|
@@ -6326,7 +6326,7 @@ function es(r) {
|
|
|
6326
6326
|
function tr(r) {
|
|
6327
6327
|
if (we(r) && !r.isInline()) return !0;
|
|
6328
6328
|
if (!N(r) || $t(r)) return !1;
|
|
6329
|
-
const e = r.getFirstChild(), t = e === null || mr(e) ||
|
|
6329
|
+
const e = r.getFirstChild(), t = e === null || mr(e) || $(e) || e.isInline();
|
|
6330
6330
|
return !r.isInline() && r.canBeEmpty() !== !1 && t;
|
|
6331
6331
|
}
|
|
6332
6332
|
function Jr(r, e) {
|
|
@@ -6416,7 +6416,7 @@ function rs(r, e) {
|
|
|
6416
6416
|
(function(a, u, c) {
|
|
6417
6417
|
a[`__lexicalKey_${u._key}`] = c;
|
|
6418
6418
|
})(o, i, s), l.set(s, o);
|
|
6419
|
-
}(r, n, st),
|
|
6419
|
+
}(r, n, st), $(t) ? n.setAttribute("data-lexical-text", "true") : we(t) && n.setAttribute("data-lexical-decorator", "true"), N(t)) {
|
|
6420
6420
|
const s = t.__indent, o = t.__size;
|
|
6421
6421
|
if (s !== 0 && Vl(n, s), o !== 0) {
|
|
6422
6422
|
const l = o - 1;
|
|
@@ -6432,7 +6432,7 @@ function rs(r, e) {
|
|
|
6432
6432
|
if (we(t)) {
|
|
6433
6433
|
const o = t.decorate(st, lr);
|
|
6434
6434
|
o !== null && Ql(r, o), n.contentEditable = "false";
|
|
6435
|
-
} else
|
|
6435
|
+
} else $(t) && (t.isDirectionless() || (rt += s));
|
|
6436
6436
|
Ke += s, Ht += s;
|
|
6437
6437
|
}
|
|
6438
6438
|
return e !== null && e.insertChild(n), ji(yn, mn, bs, t, "created"), n;
|
|
@@ -6444,7 +6444,7 @@ function ti(r, e, t, n, s) {
|
|
|
6444
6444
|
for (; i <= n; ++i) {
|
|
6445
6445
|
rs(r[i], s);
|
|
6446
6446
|
const l = St.get(r[i]);
|
|
6447
|
-
l !== null &&
|
|
6447
|
+
l !== null && $(l) && (Pt === null && (Pt = l.getFormat()), Ct === "" && (Ct = l.getStyle()));
|
|
6448
6448
|
}
|
|
6449
6449
|
ys(e) && (Ke += Jt), s.element.__lexicalTextContent = Ke, Ke = o + Ke;
|
|
6450
6450
|
}
|
|
@@ -6505,12 +6505,12 @@ function gc(r, e, t) {
|
|
|
6505
6505
|
const f = o.__first, h = i.__first;
|
|
6506
6506
|
if (f === h) en(f, d);
|
|
6507
6507
|
else {
|
|
6508
|
-
const m = ri(f),
|
|
6508
|
+
const m = ri(f), b = rs(h, null);
|
|
6509
6509
|
try {
|
|
6510
|
-
d.replaceChild(
|
|
6510
|
+
d.replaceChild(b, m);
|
|
6511
6511
|
} catch (w) {
|
|
6512
6512
|
if (typeof w == "object" && w != null) {
|
|
6513
|
-
const v = `${w.toString()} Parent: ${d.tagName}, new child: {tag: ${
|
|
6513
|
+
const v = `${w.toString()} Parent: ${d.tagName}, new child: {tag: ${b.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;
|
|
6514
6514
|
throw new Error(v);
|
|
6515
6515
|
}
|
|
6516
6516
|
throw w;
|
|
@@ -6518,7 +6518,7 @@ function gc(r, e, t) {
|
|
|
6518
6518
|
ts(f, null);
|
|
6519
6519
|
}
|
|
6520
6520
|
const g = St.get(h);
|
|
6521
|
-
|
|
6521
|
+
$(g) && (Pt === null && (Pt = g.getFormat()), Ct === "" && (Ct = g.getStyle()));
|
|
6522
6522
|
} else {
|
|
6523
6523
|
const f = ns(o, br), h = ns(i, St);
|
|
6524
6524
|
if (f.length !== u && O(227), h.length !== c && O(228), u === 0) c !== 0 && ti(h, i, 0, c - 1, l);
|
|
@@ -6527,28 +6527,28 @@ function gc(r, e, t) {
|
|
|
6527
6527
|
const g = l.after == null && l.before == null && l.element.__lexicalLineBreak == null;
|
|
6528
6528
|
ei(f, 0, u - 1, g ? null : d), g && (d.textContent = "");
|
|
6529
6529
|
}
|
|
6530
|
-
} else (function(g, m,
|
|
6530
|
+
} else (function(g, m, b, w, v, A) {
|
|
6531
6531
|
const C = w - 1, E = v - 1;
|
|
6532
|
-
let
|
|
6532
|
+
let y, _, D = A.getFirstChild(), S = 0, M = 0;
|
|
6533
6533
|
for (; S <= C && M <= E; ) {
|
|
6534
|
-
const F = m[S], j =
|
|
6534
|
+
const F = m[S], j = b[M];
|
|
6535
6535
|
if (F === j) D = Os(en(j, A.element)), S++, M++;
|
|
6536
6536
|
else {
|
|
6537
|
-
|
|
6538
|
-
const X = _.has(F), de =
|
|
6537
|
+
y === void 0 && (y = new Set(m)), _ === void 0 && (_ = new Set(b));
|
|
6538
|
+
const X = _.has(F), de = y.has(j);
|
|
6539
6539
|
if (X) if (de) {
|
|
6540
6540
|
const Ce = Zn(st, j);
|
|
6541
6541
|
Ce === D ? D = Os(en(j, A.element)) : (A.withBefore(D).insertChild(Ce), en(j, A.element)), S++, M++;
|
|
6542
6542
|
} else rs(j, A.withBefore(D)), M++;
|
|
6543
6543
|
else D = Os(ri(F)), ts(F, A.element), S++;
|
|
6544
6544
|
}
|
|
6545
|
-
const
|
|
6546
|
-
|
|
6545
|
+
const I = St.get(j);
|
|
6546
|
+
I !== null && $(I) && (Pt === null && (Pt = I.getFormat()), Ct === "" && (Ct = I.getStyle()));
|
|
6547
6547
|
}
|
|
6548
6548
|
const T = S > C, B = M > E;
|
|
6549
6549
|
if (T && !B) {
|
|
6550
|
-
const F =
|
|
6551
|
-
ti(
|
|
6550
|
+
const F = b[E + 1], j = F === void 0 ? null : st.getElementByKey(F);
|
|
6551
|
+
ti(b, g, M, E, A.withBefore(j));
|
|
6552
6552
|
} else B && !T && ei(m, S, C, A.element);
|
|
6553
6553
|
})(i, f, h, u, c, l);
|
|
6554
6554
|
}
|
|
@@ -6579,7 +6579,7 @@ function en(r, e) {
|
|
|
6579
6579
|
l !== void 0 && (rt += l);
|
|
6580
6580
|
} else {
|
|
6581
6581
|
const i = t.getTextContent();
|
|
6582
|
-
|
|
6582
|
+
$(t) && !t.isDirectionless() && (rt += i), Ht += i, Ke += i;
|
|
6583
6583
|
}
|
|
6584
6584
|
return o;
|
|
6585
6585
|
}
|
|
@@ -6597,7 +6597,7 @@ function en(r, e) {
|
|
|
6597
6597
|
if (we(n)) {
|
|
6598
6598
|
const l = n.decorate(st, lr);
|
|
6599
6599
|
l !== null && Ql(r, l);
|
|
6600
|
-
} else
|
|
6600
|
+
} else $(n) && !n.isDirectionless() && (rt += i);
|
|
6601
6601
|
Ke += i, Ht += i;
|
|
6602
6602
|
}
|
|
6603
6603
|
if (!xn && nt(n) && n.__cachedText !== Ht) {
|
|
@@ -6631,91 +6631,91 @@ function ri(r) {
|
|
|
6631
6631
|
const Kt = Object.freeze({}), ni = 30, si = [["keydown", function(r, e) {
|
|
6632
6632
|
if (an = r.timeStamp, Yl = r.key, e.isComposing()) return;
|
|
6633
6633
|
const { key: t, shiftKey: n, ctrlKey: s, metaKey: o, altKey: i } = r;
|
|
6634
|
-
if (!
|
|
6634
|
+
if (!W(e, vu, r) && t != null) {
|
|
6635
6635
|
if (function(l, a, u, c) {
|
|
6636
6636
|
return ao(l) && !a && !c && !u;
|
|
6637
|
-
}(t, s, i, o))
|
|
6637
|
+
}(t, s, i, o)) W(e, yl, r);
|
|
6638
6638
|
else if (function(l, a, u, c, d) {
|
|
6639
6639
|
return ao(l) && !c && !u && (a || d);
|
|
6640
|
-
}(t, s, n, i, o))
|
|
6640
|
+
}(t, s, n, i, o)) W(e, wu, r);
|
|
6641
6641
|
else if (function(l, a, u, c) {
|
|
6642
6642
|
return lo(l) && !a && !c && !u;
|
|
6643
|
-
}(t, s, i, o))
|
|
6643
|
+
}(t, s, i, o)) W(e, xl, r);
|
|
6644
6644
|
else if (function(l, a, u, c, d) {
|
|
6645
6645
|
return lo(l) && !c && !u && (a || d);
|
|
6646
|
-
}(t, s, n, i, o))
|
|
6646
|
+
}(t, s, n, i, o)) W(e, Cu, r);
|
|
6647
6647
|
else if (/* @__PURE__ */ function(l, a, u) {
|
|
6648
6648
|
return /* @__PURE__ */ function(c) {
|
|
6649
6649
|
return c === "ArrowUp";
|
|
6650
6650
|
}(l) && !a && !u;
|
|
6651
|
-
}(t, s, o))
|
|
6651
|
+
}(t, s, o)) W(e, bl, r);
|
|
6652
6652
|
else if (/* @__PURE__ */ function(l, a, u) {
|
|
6653
6653
|
return /* @__PURE__ */ function(c) {
|
|
6654
6654
|
return c === "ArrowDown";
|
|
6655
6655
|
}(l) && !a && !u;
|
|
6656
|
-
}(t, s, o))
|
|
6656
|
+
}(t, s, o)) W(e, _l, r);
|
|
6657
6657
|
else if (function(l, a) {
|
|
6658
6658
|
return uo(l) && a;
|
|
6659
|
-
}(t, n)) un = !0,
|
|
6659
|
+
}(t, n)) un = !0, W(e, Gn, r);
|
|
6660
6660
|
else if (/* @__PURE__ */ function(l) {
|
|
6661
6661
|
return l === " ";
|
|
6662
|
-
}(t))
|
|
6662
|
+
}(t)) W(e, Du, r);
|
|
6663
6663
|
else if (function(l, a) {
|
|
6664
6664
|
return wt && a && l.toLowerCase() === "o";
|
|
6665
|
-
}(t, s)) r.preventDefault(), un = !0,
|
|
6665
|
+
}(t, s)) r.preventDefault(), un = !0, W(e, Fr, !0);
|
|
6666
6666
|
else if (function(l, a) {
|
|
6667
6667
|
return uo(l) && !a;
|
|
6668
|
-
}(t, n)) un = !1,
|
|
6668
|
+
}(t, n)) un = !1, W(e, Gn, r);
|
|
6669
6669
|
else if (function(l, a, u, c) {
|
|
6670
6670
|
return wt ? !a && !u && (Kr(l) || l.toLowerCase() === "h" && c) : !(c || a || u) && Kr(l);
|
|
6671
|
-
}(t, i, o, s)) Kr(t) ?
|
|
6671
|
+
}(t, i, o, s)) Kr(t) ? W(e, vl, r) : (r.preventDefault(), W(e, pr, !0));
|
|
6672
6672
|
else if (/* @__PURE__ */ function(l) {
|
|
6673
6673
|
return l === "Escape";
|
|
6674
|
-
}(t))
|
|
6674
|
+
}(t)) W(e, wl, r);
|
|
6675
6675
|
else if (function(l, a, u, c, d) {
|
|
6676
6676
|
return wt ? !(u || c || d) && (Hr(l) || l.toLowerCase() === "d" && a) : !(a || c || d) && Hr(l);
|
|
6677
|
-
}(t, s, n, i, o)) Hr(t) ?
|
|
6677
|
+
}(t, s, n, i, o)) Hr(t) ? W(e, Cl, r) : (r.preventDefault(), W(e, pr, !1));
|
|
6678
6678
|
else if (function(l, a, u) {
|
|
6679
6679
|
return Kr(l) && (wt ? a : u);
|
|
6680
|
-
}(t, i, s)) r.preventDefault(),
|
|
6680
|
+
}(t, i, s)) r.preventDefault(), W(e, hn, !0);
|
|
6681
6681
|
else if (function(l, a, u) {
|
|
6682
6682
|
return Hr(l) && (wt ? a : u);
|
|
6683
|
-
}(t, i, s)) r.preventDefault(),
|
|
6683
|
+
}(t, i, s)) r.preventDefault(), W(e, hn, !1);
|
|
6684
6684
|
else if (function(l, a) {
|
|
6685
6685
|
return wt && a && Kr(l);
|
|
6686
|
-
}(t, o)) r.preventDefault(),
|
|
6686
|
+
}(t, o)) r.preventDefault(), W(e, pn, !0);
|
|
6687
6687
|
else if (function(l, a) {
|
|
6688
6688
|
return wt && a && Hr(l);
|
|
6689
|
-
}(t, o)) r.preventDefault(),
|
|
6689
|
+
}(t, o)) r.preventDefault(), W(e, pn, !1);
|
|
6690
6690
|
else if (function(l, a, u, c) {
|
|
6691
6691
|
return l.toLowerCase() === "b" && !a && Zr(u, c);
|
|
6692
|
-
}(t, i, o, s)) r.preventDefault(),
|
|
6692
|
+
}(t, i, o, s)) r.preventDefault(), W(e, At, "bold");
|
|
6693
6693
|
else if (function(l, a, u, c) {
|
|
6694
6694
|
return l.toLowerCase() === "u" && !a && Zr(u, c);
|
|
6695
|
-
}(t, i, o, s)) r.preventDefault(),
|
|
6695
|
+
}(t, i, o, s)) r.preventDefault(), W(e, At, "underline");
|
|
6696
6696
|
else if (function(l, a, u, c) {
|
|
6697
6697
|
return l.toLowerCase() === "i" && !a && Zr(u, c);
|
|
6698
|
-
}(t, i, o, s)) r.preventDefault(),
|
|
6698
|
+
}(t, i, o, s)) r.preventDefault(), W(e, At, "italic");
|
|
6699
6699
|
else if (/* @__PURE__ */ function(l, a, u, c) {
|
|
6700
6700
|
return l === "Tab" && !a && !u && !c;
|
|
6701
|
-
}(t, i, s, o))
|
|
6701
|
+
}(t, i, s, o)) W(e, Au, r);
|
|
6702
6702
|
else if (function(l, a, u, c) {
|
|
6703
6703
|
return l.toLowerCase() === "z" && !a && Zr(u, c);
|
|
6704
|
-
}(t, n, o, s)) r.preventDefault(),
|
|
6704
|
+
}(t, n, o, s)) r.preventDefault(), W(e, mi, void 0);
|
|
6705
6705
|
else if (function(l, a, u, c) {
|
|
6706
6706
|
return wt ? l.toLowerCase() === "z" && u && a : l.toLowerCase() === "y" && c || l.toLowerCase() === "z" && c && a;
|
|
6707
|
-
}(t, n, o, s)) r.preventDefault(),
|
|
6707
|
+
}(t, n, o, s)) r.preventDefault(), W(e, yi, void 0);
|
|
6708
6708
|
else {
|
|
6709
6709
|
const l = e._editorState._selection;
|
|
6710
|
-
l === null || P(l) ? !or && co(t, o, s) && (r.preventDefault(),
|
|
6710
|
+
l === null || P(l) ? !or && co(t, o, s) && (r.preventDefault(), W(e, Hs, r)) : function(a, u, c, d) {
|
|
6711
6711
|
return !u && a.toLowerCase() === "c" && (wt ? c : d);
|
|
6712
|
-
}(t, n, o, s) ? (r.preventDefault(),
|
|
6712
|
+
}(t, n, o, s) ? (r.preventDefault(), W(e, fs, r)) : function(a, u, c, d) {
|
|
6713
6713
|
return !u && a.toLowerCase() === "x" && (wt ? c : d);
|
|
6714
|
-
}(t, n, o, s) ? (r.preventDefault(),
|
|
6714
|
+
}(t, n, o, s) ? (r.preventDefault(), W(e, xi, r)) : co(t, o, s) && (r.preventDefault(), W(e, Hs, r));
|
|
6715
6715
|
}
|
|
6716
6716
|
/* @__PURE__ */ (function(l, a, u, c) {
|
|
6717
6717
|
return l || a || u || c;
|
|
6718
|
-
})(s, n, i, o) &&
|
|
6718
|
+
})(s, n, i, o) && W(e, Lu, r);
|
|
6719
6719
|
}
|
|
6720
6720
|
}], ["pointerdown", function(r, e) {
|
|
6721
6721
|
const t = r.target, n = r.pointerType;
|
|
@@ -6727,7 +6727,7 @@ const Kt = Object.freeze({}), ni = 30, si = [["keydown", function(r, e) {
|
|
|
6727
6727
|
const t = V();
|
|
6728
6728
|
if (P(t) && !e.isComposing()) {
|
|
6729
6729
|
const n = t.anchor, s = t.anchor.getNode();
|
|
6730
|
-
Qe(n.key), (r.timeStamp < an + ni || n.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format ||
|
|
6730
|
+
Qe(n.key), (r.timeStamp < an + ni || n.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || $(s) && s.getStyle() !== t.style) && W(e, jr, qu);
|
|
6731
6731
|
}
|
|
6732
6732
|
});
|
|
6733
6733
|
}], ["compositionend", function(r, e) {
|
|
@@ -6742,7 +6742,7 @@ const Kt = Object.freeze({}), ni = 30, si = [["keydown", function(r, e) {
|
|
|
6742
6742
|
const o = t.anchor.getNode(), i = yt(e._window);
|
|
6743
6743
|
if (i === null) return;
|
|
6744
6744
|
const l = t.isBackward(), a = l ? t.anchor.offset : t.focus.offset, u = l ? t.focus.offset : t.anchor.offset;
|
|
6745
|
-
Vn && !t.isCollapsed() &&
|
|
6745
|
+
Vn && !t.isCollapsed() && $(o) && i.anchorNode !== null && o.getTextContent().slice(0, a) + n + o.getTextContent().slice(a + u) === ql(i.anchorNode) || W(e, jr, n);
|
|
6746
6746
|
const c = n.length;
|
|
6747
6747
|
or && c > 1 && r.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= c), hs || _n || bi || !e.isComposing() || (an = 0, Qe(null));
|
|
6748
6748
|
} else
|
|
@@ -6764,7 +6764,7 @@ const Kt = Object.freeze({}), ni = 30, si = [["keydown", function(r, e) {
|
|
|
6764
6764
|
}
|
|
6765
6765
|
}
|
|
6766
6766
|
}
|
|
6767
|
-
|
|
6767
|
+
W(e, ml, r);
|
|
6768
6768
|
});
|
|
6769
6769
|
}], ["cut", Kt], ["copy", Kt], ["dragstart", Kt], ["dragover", Kt], ["dragend", Kt], ["paste", Kt], ["focus", Kt], ["blur", Kt], ["drop", Kt]];
|
|
6770
6770
|
Vn && si.push(["beforeinput", (r, e) => function(t, n) {
|
|
@@ -6786,12 +6786,12 @@ Vn && si.push(["beforeinput", (r, e) => function(t, n) {
|
|
|
6786
6786
|
});
|
|
6787
6787
|
}, ni), P(i)) {
|
|
6788
6788
|
const g = i.anchor.getNode();
|
|
6789
|
-
g.markDirty(), i.format = g.getFormat(),
|
|
6789
|
+
g.markDirty(), i.format = g.getFormat(), $(g) || O(142), i.style = g.getStyle();
|
|
6790
6790
|
}
|
|
6791
6791
|
} else {
|
|
6792
6792
|
Qe(null), t.preventDefault();
|
|
6793
|
-
const g = i.anchor.getNode(), m = g.getTextContent(),
|
|
6794
|
-
Ou && h && !w &&
|
|
6793
|
+
const g = i.anchor.getNode(), m = g.getTextContent(), b = g.canInsertTextAfter(), w = i.anchor.offset === 0 && i.focus.offset === m.length;
|
|
6794
|
+
Ou && h && !w && b || W(n, pr, !0);
|
|
6795
6795
|
}
|
|
6796
6796
|
return;
|
|
6797
6797
|
}
|
|
@@ -6805,74 +6805,74 @@ Vn && si.push(["beforeinput", (r, e) => function(t, n) {
|
|
|
6805
6805
|
case "insertFromYank":
|
|
6806
6806
|
case "insertFromDrop":
|
|
6807
6807
|
case "insertReplacementText":
|
|
6808
|
-
|
|
6808
|
+
W(n, jr, t);
|
|
6809
6809
|
break;
|
|
6810
6810
|
case "insertFromComposition":
|
|
6811
|
-
Qe(null),
|
|
6811
|
+
Qe(null), W(n, jr, t);
|
|
6812
6812
|
break;
|
|
6813
6813
|
case "insertLineBreak":
|
|
6814
|
-
Qe(null),
|
|
6814
|
+
Qe(null), W(n, Fr, !1);
|
|
6815
6815
|
break;
|
|
6816
6816
|
case "insertParagraph":
|
|
6817
|
-
Qe(null), un && !_n ? (un = !1,
|
|
6817
|
+
Qe(null), un && !_n ? (un = !1, W(n, Fr, !1)) : W(n, fn, void 0);
|
|
6818
6818
|
break;
|
|
6819
6819
|
case "insertFromPaste":
|
|
6820
6820
|
case "insertFromPasteAsQuotation":
|
|
6821
|
-
|
|
6821
|
+
W(n, ds, t);
|
|
6822
6822
|
break;
|
|
6823
6823
|
case "deleteByComposition":
|
|
6824
6824
|
(function(h, g) {
|
|
6825
6825
|
return h !== g || N(h) || N(g) || !h.isToken() || !g.isToken();
|
|
6826
|
-
})(d, f) &&
|
|
6826
|
+
})(d, f) && W(n, Ks, t);
|
|
6827
6827
|
break;
|
|
6828
6828
|
case "deleteByDrag":
|
|
6829
6829
|
case "deleteByCut":
|
|
6830
|
-
|
|
6830
|
+
W(n, Ks, t);
|
|
6831
6831
|
break;
|
|
6832
6832
|
case "deleteContent":
|
|
6833
|
-
|
|
6833
|
+
W(n, pr, !1);
|
|
6834
6834
|
break;
|
|
6835
6835
|
case "deleteWordBackward":
|
|
6836
|
-
|
|
6836
|
+
W(n, hn, !0);
|
|
6837
6837
|
break;
|
|
6838
6838
|
case "deleteWordForward":
|
|
6839
|
-
|
|
6839
|
+
W(n, hn, !1);
|
|
6840
6840
|
break;
|
|
6841
6841
|
case "deleteHardLineBackward":
|
|
6842
6842
|
case "deleteSoftLineBackward":
|
|
6843
|
-
|
|
6843
|
+
W(n, pn, !0);
|
|
6844
6844
|
break;
|
|
6845
6845
|
case "deleteContentForward":
|
|
6846
6846
|
case "deleteHardLineForward":
|
|
6847
6847
|
case "deleteSoftLineForward":
|
|
6848
|
-
|
|
6848
|
+
W(n, pn, !1);
|
|
6849
6849
|
break;
|
|
6850
6850
|
case "formatStrikeThrough":
|
|
6851
|
-
|
|
6851
|
+
W(n, At, "strikethrough");
|
|
6852
6852
|
break;
|
|
6853
6853
|
case "formatBold":
|
|
6854
|
-
|
|
6854
|
+
W(n, At, "bold");
|
|
6855
6855
|
break;
|
|
6856
6856
|
case "formatItalic":
|
|
6857
|
-
|
|
6857
|
+
W(n, At, "italic");
|
|
6858
6858
|
break;
|
|
6859
6859
|
case "formatUnderline":
|
|
6860
|
-
|
|
6860
|
+
W(n, At, "underline");
|
|
6861
6861
|
break;
|
|
6862
6862
|
case "historyUndo":
|
|
6863
|
-
|
|
6863
|
+
W(n, mi, void 0);
|
|
6864
6864
|
break;
|
|
6865
6865
|
case "historyRedo":
|
|
6866
|
-
|
|
6866
|
+
W(n, yi, void 0);
|
|
6867
6867
|
}
|
|
6868
6868
|
else {
|
|
6869
6869
|
if (a === `
|
|
6870
|
-
`) t.preventDefault(),
|
|
6871
|
-
else if (a === Jt) t.preventDefault(),
|
|
6870
|
+
`) t.preventDefault(), W(n, Fr, !1);
|
|
6871
|
+
else if (a === Jt) t.preventDefault(), W(n, fn, void 0);
|
|
6872
6872
|
else if (a == null && t.dataTransfer) {
|
|
6873
6873
|
const h = t.dataTransfer.getData("text/plain");
|
|
6874
6874
|
t.preventDefault(), i.insertRawText(h);
|
|
6875
|
-
} else a != null && ea(i, o, a, t.timeStamp, !0) ? (t.preventDefault(),
|
|
6875
|
+
} else a != null && ea(i, o, a, t.timeStamp, !0) ? (t.preventDefault(), W(n, jr, a)) : Tr = a;
|
|
6876
6876
|
Xl = t.timeStamp;
|
|
6877
6877
|
}
|
|
6878
6878
|
});
|
|
@@ -6882,7 +6882,7 @@ const ss = /* @__PURE__ */ new WeakMap();
|
|
|
6882
6882
|
let ii = !1, oi = !1, un = !1, Qr = !1, Zl = [0, "", 0, "root", 0];
|
|
6883
6883
|
function ea(r, e, t, n, s) {
|
|
6884
6884
|
const o = r.anchor, i = r.focus, l = o.getNode(), a = Re(), u = yt(a._window), c = u !== null ? u.anchorNode : null, d = o.key, f = a.getElementByKey(d), h = t.length;
|
|
6885
|
-
return d !== i.key ||
|
|
6885
|
+
return d !== i.key || !$(l) || (!s && (!Vn || Xl < n + 50) || l.isDirty() && h < 2 || $l(t)) && o.offset !== i.offset && !l.isComposing() || fr(l) || l.isDirty() && h > 1 || (s || !Vn) && f !== null && !l.isComposing() && c !== Qn(f) || u !== null && e !== null && (!e.collapsed || e.startContainer !== u.anchorNode || e.startOffset !== u.anchorOffset) || l.getFormat() !== r.format || l.getStyle() !== r.style || ic(r, l);
|
|
6886
6886
|
}
|
|
6887
6887
|
function mo(r, e) {
|
|
6888
6888
|
return r !== null && r.nodeValue !== null && r.nodeType === ar && e !== 0 && e !== r.nodeValue.length;
|
|
@@ -6897,24 +6897,24 @@ function yo(r, e, t) {
|
|
|
6897
6897
|
const a = l.anchor, u = a.getNode();
|
|
6898
6898
|
if (l.isCollapsed()) {
|
|
6899
6899
|
r.type === "Range" && r.anchorNode === r.focusNode && (l.dirty = !0);
|
|
6900
|
-
const c = xs(e).event, d = c ? c.timeStamp : performance.now(), [f, h, g, m,
|
|
6901
|
-
if (d <
|
|
6902
|
-
else if (a.type === "text")
|
|
6900
|
+
const c = xs(e).event, d = c ? c.timeStamp : performance.now(), [f, h, g, m, b] = Zl, w = je(), v = e.isComposing() === !1 && w.getTextContent() === "";
|
|
6901
|
+
if (d < b + 200 && a.offset === g && a.key === m) l.format = f, l.style = h;
|
|
6902
|
+
else if (a.type === "text") $(u) || O(141), l.format = u.getFormat(), l.style = u.getStyle();
|
|
6903
6903
|
else if (a.type === "element" && !v) {
|
|
6904
6904
|
const A = a.getNode();
|
|
6905
6905
|
l.style = "", A instanceof zr && A.getChildrenSize() === 0 ? (l.format = A.getTextFormat(), l.style = A.getTextStyle()) : l.format = 0;
|
|
6906
6906
|
}
|
|
6907
6907
|
} else {
|
|
6908
|
-
const c = a.key, d = l.focus.key, f = l.getNodes(), h = f.length, g = l.isBackward(), m = g ? i : s,
|
|
6908
|
+
const c = a.key, d = l.focus.key, f = l.getNodes(), h = f.length, g = l.isBackward(), m = g ? i : s, b = g ? s : i, w = g ? d : c, v = g ? c : d;
|
|
6909
6909
|
let A = zu, C = !1;
|
|
6910
6910
|
for (let E = 0; E < h; E++) {
|
|
6911
|
-
const
|
|
6912
|
-
if (
|
|
6911
|
+
const y = f[E], _ = y.getTextContentSize();
|
|
6912
|
+
if ($(y) && _ !== 0 && !(E === 0 && y.__key === w && m === _ || E === h - 1 && y.__key === v && b === 0) && (C = !0, A &= y.getFormat(), A === 0)) break;
|
|
6913
6913
|
}
|
|
6914
6914
|
l.format = C ? A : 0;
|
|
6915
6915
|
}
|
|
6916
6916
|
}
|
|
6917
|
-
|
|
6917
|
+
W(e, gi, void 0);
|
|
6918
6918
|
});
|
|
6919
6919
|
}
|
|
6920
6920
|
function ta(r) {
|
|
@@ -6927,14 +6927,14 @@ function Ms(r, e) {
|
|
|
6927
6927
|
if (Qe(null), t !== null && e != null) {
|
|
6928
6928
|
if (e === "") {
|
|
6929
6929
|
const n = Ze(t), s = Qn(r.getElementByKey(t));
|
|
6930
|
-
return void (s !== null && s.nodeValue !== null &&
|
|
6930
|
+
return void (s !== null && s.nodeValue !== null && $(n) && Fi(n, s.nodeValue, null, null, !0));
|
|
6931
6931
|
}
|
|
6932
6932
|
if (e[e.length - 1] === `
|
|
6933
6933
|
`) {
|
|
6934
6934
|
const n = V();
|
|
6935
6935
|
if (P(n)) {
|
|
6936
6936
|
const s = n.focus;
|
|
6937
|
-
return n.anchor.set(s.key, s.offset, s.type), void
|
|
6937
|
+
return n.anchor.set(s.key, s.offset, s.type), void W(r, Gn, null);
|
|
6938
6938
|
}
|
|
6939
6939
|
}
|
|
6940
6940
|
}
|
|
@@ -7035,7 +7035,7 @@ class _s {
|
|
|
7035
7035
|
const t = e || V();
|
|
7036
7036
|
if (t == null) return !1;
|
|
7037
7037
|
const n = t.getNodes().some((s) => s.__key === this.__key);
|
|
7038
|
-
if (
|
|
7038
|
+
if ($(this)) return n;
|
|
7039
7039
|
if (P(t) && t.anchor.type === "element" && t.focus.type === "element") {
|
|
7040
7040
|
if (t.isCollapsed()) return !1;
|
|
7041
7041
|
const s = this.getParent();
|
|
@@ -7242,8 +7242,8 @@ class _s {
|
|
|
7242
7242
|
l.append(m);
|
|
7243
7243
|
})), P(n)) {
|
|
7244
7244
|
It(n);
|
|
7245
|
-
const m = n.anchor,
|
|
7246
|
-
m.key === o && Co(m, l),
|
|
7245
|
+
const m = n.anchor, b = n.focus;
|
|
7246
|
+
m.key === o && Co(m, l), b.key === o && Co(b, l);
|
|
7247
7247
|
}
|
|
7248
7248
|
return nr() === o && Qe(i), l;
|
|
7249
7249
|
}
|
|
@@ -7254,8 +7254,8 @@ class _s {
|
|
|
7254
7254
|
if (o !== null) {
|
|
7255
7255
|
const h = e.getIndexWithinParent();
|
|
7256
7256
|
if (gr(s), P(i)) {
|
|
7257
|
-
const g = o.__key, m = i.anchor,
|
|
7258
|
-
l = m.type === "element" && m.key === g && m.offset === h + 1, a =
|
|
7257
|
+
const g = o.__key, m = i.anchor, b = i.focus;
|
|
7258
|
+
l = m.type === "element" && m.key === g && m.offset === h + 1, a = b.type === "element" && b.key === g && b.offset === h + 1;
|
|
7259
7259
|
}
|
|
7260
7260
|
}
|
|
7261
7261
|
const u = this.getNextSibling(), c = this.getParentOrThrow().getWritable(), d = s.__key, f = n.__next;
|
|
@@ -7293,7 +7293,7 @@ class _s {
|
|
|
7293
7293
|
const n = this.getPreviousSibling(), s = this.getParentOrThrow();
|
|
7294
7294
|
if (n === null) return s.select(0, 0);
|
|
7295
7295
|
if (N(n)) return n.select();
|
|
7296
|
-
if (
|
|
7296
|
+
if (!$(n)) {
|
|
7297
7297
|
const o = n.getIndexWithinParent() + 1;
|
|
7298
7298
|
return s.select(o, o);
|
|
7299
7299
|
}
|
|
@@ -7304,7 +7304,7 @@ class _s {
|
|
|
7304
7304
|
const n = this.getNextSibling(), s = this.getParentOrThrow();
|
|
7305
7305
|
if (n === null) return s.select();
|
|
7306
7306
|
if (N(n)) return n.select(0, 0);
|
|
7307
|
-
if (
|
|
7307
|
+
if (!$(n)) {
|
|
7308
7308
|
const o = n.getIndexWithinParent();
|
|
7309
7309
|
return s.select(o, o);
|
|
7310
7310
|
}
|
|
@@ -7498,8 +7498,8 @@ class $r extends _s {
|
|
|
7498
7498
|
if (l === a && u !== c) {
|
|
7499
7499
|
const m = t.firstChild;
|
|
7500
7500
|
m == null && O(48);
|
|
7501
|
-
const
|
|
7502
|
-
return _o(
|
|
7501
|
+
const b = document.createElement(c);
|
|
7502
|
+
return _o(b, this, 0, i, s, n), t.replaceChild(b, m), !1;
|
|
7503
7503
|
}
|
|
7504
7504
|
let d = t;
|
|
7505
7505
|
a !== null && l !== null && (d = t.firstChild, d == null && O(49)), ia(s, d, this);
|
|
@@ -7610,14 +7610,14 @@ class $r extends _s {
|
|
|
7610
7610
|
if (l[0] === n) return [t];
|
|
7611
7611
|
const d = l[0], f = t.getParent();
|
|
7612
7612
|
let h;
|
|
7613
|
-
const g = t.getFormat(), m = t.getStyle(),
|
|
7613
|
+
const g = t.getFormat(), m = t.getStyle(), b = t.__detail;
|
|
7614
7614
|
let w = !1;
|
|
7615
|
-
t.isSegmented() ? (h = Ve(d), h.__format = g, h.__style = m, h.__detail =
|
|
7615
|
+
t.isSegmented() ? (h = Ve(d), h.__format = g, h.__style = m, h.__detail = b, w = !0) : (h = t.getWritable(), h.__text = d);
|
|
7616
7616
|
const v = V(), A = [h];
|
|
7617
7617
|
let C = d.length;
|
|
7618
7618
|
for (let E = 1; E < c; E++) {
|
|
7619
|
-
const
|
|
7620
|
-
D.__format = g, D.__style = m, D.__detail =
|
|
7619
|
+
const y = l[E], _ = y.length, D = Ve(y).getWritable();
|
|
7620
|
+
D.__format = g, D.__style = m, D.__detail = b;
|
|
7621
7621
|
const S = D.__key, M = C + _;
|
|
7622
7622
|
if (P(v)) {
|
|
7623
7623
|
const T = v.anchor, B = v.focus;
|
|
@@ -7630,8 +7630,8 @@ class $r extends _s {
|
|
|
7630
7630
|
const D = _.getPreviousSibling(), S = _.getNextSibling();
|
|
7631
7631
|
D !== null && Xn(D), S !== null && Xn(S);
|
|
7632
7632
|
})(this);
|
|
7633
|
-
const E = f.getWritable(),
|
|
7634
|
-
w ? (E.splice(
|
|
7633
|
+
const E = f.getWritable(), y = this.getIndexWithinParent();
|
|
7634
|
+
w ? (E.splice(y, 0, A), this.remove()) : E.splice(y, 1, A), P(v) && is(v, f, y, c - 1);
|
|
7635
7635
|
}
|
|
7636
7636
|
return A;
|
|
7637
7637
|
}
|
|
@@ -7736,12 +7736,12 @@ function er(r) {
|
|
|
7736
7736
|
function Ve(r = "") {
|
|
7737
7737
|
return qt(new $r(r));
|
|
7738
7738
|
}
|
|
7739
|
-
function
|
|
7739
|
+
function $(r) {
|
|
7740
7740
|
return r instanceof $r;
|
|
7741
7741
|
}
|
|
7742
7742
|
function Oi(r, e) {
|
|
7743
7743
|
const t = r.fontWeight, n = r.textDecoration.split(" "), s = t === "700" || t === "bold", o = n.includes("line-through"), i = r.fontStyle === "italic", l = n.includes("underline"), a = r.verticalAlign;
|
|
7744
|
-
return (u) => (
|
|
7744
|
+
return (u) => ($(u) && (s && !u.hasFormat("bold") && u.toggleFormat("bold"), o && !u.hasFormat("strikethrough") && u.toggleFormat("strikethrough"), i && !u.hasFormat("italic") && u.toggleFormat("italic"), l && !u.hasFormat("underline") && u.toggleFormat("underline"), a !== "sub" || u.hasFormat("subscript") || u.toggleFormat("subscript"), a !== "super" || u.hasFormat("superscript") || u.toggleFormat("superscript"), e && !u.hasFormat(e) && u.toggleFormat(e)), u);
|
|
7745
7745
|
}
|
|
7746
7746
|
class An extends $r {
|
|
7747
7747
|
static getType() {
|
|
@@ -7822,13 +7822,13 @@ function zt(r, e, t) {
|
|
|
7822
7822
|
}
|
|
7823
7823
|
function zs(r, e) {
|
|
7824
7824
|
let t = e.__key, n = r.offset, s = "element";
|
|
7825
|
-
if (
|
|
7825
|
+
if ($(e)) {
|
|
7826
7826
|
s = "text";
|
|
7827
7827
|
const o = e.getTextContentSize();
|
|
7828
7828
|
n > o && (n = o);
|
|
7829
7829
|
} else if (!N(e)) {
|
|
7830
7830
|
const o = e.getNextSibling();
|
|
7831
|
-
if (
|
|
7831
|
+
if ($(o)) t = o.__key, n = 0, s = "text";
|
|
7832
7832
|
else {
|
|
7833
7833
|
const i = e.getParent();
|
|
7834
7834
|
i && (t = i.__key, n = e.getIndexWithinParent() + 1);
|
|
@@ -7839,7 +7839,7 @@ function zs(r, e) {
|
|
|
7839
7839
|
function Co(r, e) {
|
|
7840
7840
|
if (N(e)) {
|
|
7841
7841
|
const t = e.getLastDescendant();
|
|
7842
|
-
N(t) ||
|
|
7842
|
+
N(t) || $(t) ? zs(r, t) : zs(r, e);
|
|
7843
7843
|
} else zs(r, e);
|
|
7844
7844
|
}
|
|
7845
7845
|
function rr(r, e, t, n) {
|
|
@@ -7894,7 +7894,7 @@ class vs {
|
|
|
7894
7894
|
insertNodes(e) {
|
|
7895
7895
|
const t = this.getNodes(), n = t.length, s = t[n - 1];
|
|
7896
7896
|
let o;
|
|
7897
|
-
if (
|
|
7897
|
+
if ($(s)) o = s.select();
|
|
7898
7898
|
else {
|
|
7899
7899
|
const i = s.getIndexWithinParent() + 1;
|
|
7900
7900
|
o = s.getParentOrThrow().select(i, i);
|
|
@@ -7967,7 +7967,7 @@ class ur {
|
|
|
7967
7967
|
const f = e[d];
|
|
7968
7968
|
if (N(f) && !f.isInline()) c || (u += `
|
|
7969
7969
|
`), c = !f.isEmpty();
|
|
7970
|
-
else if (c = !1,
|
|
7970
|
+
else if (c = !1, $(f)) {
|
|
7971
7971
|
let h = f.getTextContent();
|
|
7972
7972
|
f === t ? f === n ? s.type === "element" && o.type === "element" && o.offset !== s.offset || (h = l < a ? h.slice(l, a) : h.slice(a, l)) : h = i ? h.slice(l) : h.slice(a) : f === n && (h = i ? h.slice(0, a) : h.slice(0, l)), u += h;
|
|
7973
7973
|
} else !we(f) && !mr(f) || f === n && this.isCollapsed() || (u += f.getTextContent());
|
|
@@ -8007,37 +8007,37 @@ class ur {
|
|
|
8007
8007
|
insertText(e) {
|
|
8008
8008
|
const t = this.anchor, n = this.focus, s = this.format, o = this.style;
|
|
8009
8009
|
let i = t, l = n;
|
|
8010
|
-
!this.isCollapsed() && n.isBefore(t) && (i = n, l = t), i.type === "element" && function(
|
|
8011
|
-
const C =
|
|
8012
|
-
|
|
8010
|
+
!this.isCollapsed() && n.isBefore(t) && (i = n, l = t), i.type === "element" && function(b, w, v, A) {
|
|
8011
|
+
const C = b.getNode(), E = C.getChildAtIndex(b.offset), y = Ve(), _ = nt(C) ? We().append(y) : y;
|
|
8012
|
+
y.setFormat(v), y.setStyle(A), E === null ? C.append(_) : E.insertBefore(_), b.is(w) && w.set(y.__key, 0, "text"), b.set(y.__key, 0, "text");
|
|
8013
8013
|
}(i, l, s, o);
|
|
8014
8014
|
const a = i.offset;
|
|
8015
8015
|
let u = l.offset;
|
|
8016
8016
|
const c = this.getNodes(), d = c.length;
|
|
8017
8017
|
let f = c[0];
|
|
8018
|
-
|
|
8018
|
+
$(f) || O(26);
|
|
8019
8019
|
const h = f.getTextContent().length, g = f.getParentOrThrow();
|
|
8020
8020
|
let m = c[d - 1];
|
|
8021
8021
|
if (d === 1 && l.type === "element" && (u = h, l.set(i.key, u, "text")), this.isCollapsed() && a === h && (f.isSegmented() || f.isToken() || !f.canInsertTextAfter() || !g.canInsertTextAfter() && f.getNextSibling() === null)) {
|
|
8022
|
-
let
|
|
8023
|
-
if (
|
|
8022
|
+
let b = f.getNextSibling();
|
|
8023
|
+
if ($(b) && b.canInsertTextBefore() && !fr(b) || (b = Ve(), b.setFormat(s), b.setStyle(o), g.canInsertTextAfter() ? f.insertAfter(b) : g.insertAfter(b)), b.select(0, 0), f = b, e !== "") return void this.insertText(e);
|
|
8024
8024
|
} else if (this.isCollapsed() && a === 0 && (f.isSegmented() || f.isToken() || !f.canInsertTextBefore() || !g.canInsertTextBefore() && f.getPreviousSibling() === null)) {
|
|
8025
|
-
let
|
|
8026
|
-
if (
|
|
8025
|
+
let b = f.getPreviousSibling();
|
|
8026
|
+
if ($(b) && !fr(b) || (b = Ve(), b.setFormat(s), g.canInsertTextBefore() ? f.insertBefore(b) : g.insertBefore(b)), b.select(), f = b, e !== "") return void this.insertText(e);
|
|
8027
8027
|
} else if (f.isSegmented() && a !== h) {
|
|
8028
|
-
const
|
|
8029
|
-
|
|
8028
|
+
const b = Ve(f.getTextContent());
|
|
8029
|
+
b.setFormat(s), f.replace(b), f = b;
|
|
8030
8030
|
} else if (!this.isCollapsed() && e !== "") {
|
|
8031
|
-
const
|
|
8032
|
-
if (!g.canInsertTextBefore() || !g.canInsertTextAfter() || N(
|
|
8031
|
+
const b = m.getParent();
|
|
8032
|
+
if (!g.canInsertTextBefore() || !g.canInsertTextAfter() || N(b) && (!b.canInsertTextBefore() || !b.canInsertTextAfter())) return this.insertText(""), oa(this.anchor, this.focus, null), void this.insertText(e);
|
|
8033
8033
|
}
|
|
8034
8034
|
if (d === 1) {
|
|
8035
8035
|
if (f.isToken()) {
|
|
8036
8036
|
const A = Ve(e);
|
|
8037
8037
|
return A.select(), void f.replace(A);
|
|
8038
8038
|
}
|
|
8039
|
-
const
|
|
8040
|
-
if (a !== u ||
|
|
8039
|
+
const b = f.getFormat(), w = f.getStyle();
|
|
8040
|
+
if (a !== u || b === s && w === o) {
|
|
8041
8041
|
if (Dc(f)) {
|
|
8042
8042
|
const A = Ve(e);
|
|
8043
8043
|
return A.setFormat(s), A.setStyle(o), A.select(), void f.replace(A);
|
|
@@ -8055,35 +8055,35 @@ class ur {
|
|
|
8055
8055
|
f.setFormat(s), f.setStyle(o);
|
|
8056
8056
|
}
|
|
8057
8057
|
const v = u - a;
|
|
8058
|
-
f = f.spliceText(a, v, e, !0), f.getTextContent() === "" ? f.remove() : this.anchor.type === "text" && (f.isComposing() ? this.anchor.offset -= e.length : (this.format =
|
|
8058
|
+
f = f.spliceText(a, v, e, !0), f.getTextContent() === "" ? f.remove() : this.anchor.type === "text" && (f.isComposing() ? this.anchor.offset -= e.length : (this.format = b, this.style = w));
|
|
8059
8059
|
} else {
|
|
8060
|
-
const
|
|
8060
|
+
const b = /* @__PURE__ */ new Set([...f.getParentKeys(), ...m.getParentKeys()]), w = N(f) ? f : f.getParentOrThrow();
|
|
8061
8061
|
let v = N(m) ? m : m.getParentOrThrow(), A = m;
|
|
8062
8062
|
if (!w.is(v) && v.isInline()) do
|
|
8063
8063
|
A = v, v = v.getParentOrThrow();
|
|
8064
8064
|
while (v.isInline());
|
|
8065
|
-
if (l.type === "text" && (u !== 0 || m.getTextContent() === "") || l.type === "element" && m.getIndexWithinParent() < u) if (
|
|
8065
|
+
if (l.type === "text" && (u !== 0 || m.getTextContent() === "") || l.type === "element" && m.getIndexWithinParent() < u) if ($(m) && !m.isToken() && u !== m.getTextContentSize()) {
|
|
8066
8066
|
if (m.isSegmented()) {
|
|
8067
8067
|
const D = Ve(m.getTextContent());
|
|
8068
8068
|
m.replace(D), m = D;
|
|
8069
8069
|
}
|
|
8070
|
-
nt(l.getNode()) || l.type !== "text" || (m = m.spliceText(0, u, "")),
|
|
8070
|
+
nt(l.getNode()) || l.type !== "text" || (m = m.spliceText(0, u, "")), b.add(m.__key);
|
|
8071
8071
|
} else {
|
|
8072
8072
|
const D = m.getParentOrThrow();
|
|
8073
8073
|
D.canBeEmpty() || D.getChildrenSize() !== 1 ? m.remove() : D.remove();
|
|
8074
8074
|
}
|
|
8075
|
-
else
|
|
8076
|
-
const C = v.getChildren(), E = new Set(c),
|
|
8075
|
+
else b.add(m.__key);
|
|
8076
|
+
const C = v.getChildren(), E = new Set(c), y = w.is(v), _ = w.isInline() && f.getNextSibling() === null ? w : f;
|
|
8077
8077
|
for (let D = C.length - 1; D >= 0; D--) {
|
|
8078
8078
|
const S = C[D];
|
|
8079
8079
|
if (S.is(f) || N(S) && S.isParentOf(f)) break;
|
|
8080
|
-
S.isAttached() && (!E.has(S) || S.is(A) ?
|
|
8080
|
+
S.isAttached() && (!E.has(S) || S.is(A) ? y || _.insertAfter(S, !1) : S.remove());
|
|
8081
8081
|
}
|
|
8082
|
-
if (!
|
|
8082
|
+
if (!y) {
|
|
8083
8083
|
let D = v, S = null;
|
|
8084
8084
|
for (; D !== null; ) {
|
|
8085
8085
|
const M = D.getChildren(), T = M.length;
|
|
8086
|
-
(T === 0 || M[T - 1].is(S)) && (
|
|
8086
|
+
(T === 0 || M[T - 1].is(S)) && (b.delete(D.__key), S = D), D = D.getParent();
|
|
8087
8087
|
}
|
|
8088
8088
|
}
|
|
8089
8089
|
if (f.isToken()) if (a === h) f.select();
|
|
@@ -8094,7 +8094,7 @@ class ur {
|
|
|
8094
8094
|
else f = f.spliceText(a, h - a, e, !0), f.getTextContent() === "" ? f.remove() : f.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length);
|
|
8095
8095
|
for (let D = 1; D < d; D++) {
|
|
8096
8096
|
const S = c[D], M = S.__key;
|
|
8097
|
-
|
|
8097
|
+
b.has(M) || S.remove();
|
|
8098
8098
|
}
|
|
8099
8099
|
}
|
|
8100
8100
|
}
|
|
@@ -8103,7 +8103,7 @@ class ur {
|
|
|
8103
8103
|
const { anchor: e, focus: t } = this, n = this.getNodes(), s = this.isBackward() ? t : e, o = this.isBackward() ? e : t;
|
|
8104
8104
|
let i = s.getNode(), l = o.getNode();
|
|
8105
8105
|
const a = Jr(i, tr), u = Jr(l, tr);
|
|
8106
|
-
|
|
8106
|
+
$(i) && i.isToken() && s.offset < i.getTextContentSize() && (s.offset = 0), o.offset > 0 && $(l) && l.isToken() && (o.offset = l.getTextContentSize()), n.forEach((d) => {
|
|
8107
8107
|
ln(i, d) || ln(l, d) || d.getKey() === i.getKey() || d.getKey() === l.getKey() || d.remove();
|
|
8108
8108
|
});
|
|
8109
8109
|
const c = (d, f) => {
|
|
@@ -8113,25 +8113,25 @@ class ur {
|
|
|
8113
8113
|
return h.setFormat(d.getFormat()), h.setStyle(d.getStyle()), d.replace(h);
|
|
8114
8114
|
}
|
|
8115
8115
|
};
|
|
8116
|
-
if (i === l &&
|
|
8116
|
+
if (i === l && $(i)) {
|
|
8117
8117
|
const d = Math.abs(t.offset - e.offset);
|
|
8118
8118
|
return i.spliceText(s.offset, d, "", !0), void c(i, d);
|
|
8119
8119
|
}
|
|
8120
|
-
if (
|
|
8120
|
+
if ($(i)) {
|
|
8121
8121
|
const d = i.getTextContentSize() - s.offset;
|
|
8122
8122
|
i.spliceText(s.offset, d, ""), i = c(i, d) || i;
|
|
8123
8123
|
}
|
|
8124
|
-
|
|
8124
|
+
$(l) && (l.spliceText(0, o.offset, ""), l = c(l, o.offset) || l), i.isAttached() && $(i) ? i.selectEnd() : l.isAttached() && $(l) && l.selectStart(), N(a) && N(u) && a !== u && (a.append(...u.getChildren()), u.remove(), o.set(s.key, s.offset, s.type));
|
|
8125
8125
|
}
|
|
8126
8126
|
formatText(e, t = null) {
|
|
8127
8127
|
if (this.isCollapsed()) return this.toggleFormat(e), void Qe(null);
|
|
8128
8128
|
const n = this.getNodes(), s = [];
|
|
8129
|
-
for (const C of n)
|
|
8129
|
+
for (const C of n) $(C) && s.push(C);
|
|
8130
8130
|
const o = (C) => {
|
|
8131
8131
|
n.forEach((E) => {
|
|
8132
8132
|
if (Mr(E)) {
|
|
8133
|
-
const
|
|
8134
|
-
E.setTextFormat(
|
|
8133
|
+
const y = E.getFormatFlags(e, C);
|
|
8134
|
+
E.setTextFormat(y);
|
|
8135
8135
|
}
|
|
8136
8136
|
});
|
|
8137
8137
|
}, i = s.length;
|
|
@@ -8141,8 +8141,8 @@ class ur {
|
|
|
8141
8141
|
if (c.type === "text" && g === h.getTextContentSize() && (f = 1, h = s[1], g = 0), h == null) return;
|
|
8142
8142
|
const m = h.getFormatFlags(e, t);
|
|
8143
8143
|
o(m);
|
|
8144
|
-
const
|
|
8145
|
-
let w = s[
|
|
8144
|
+
const b = i - 1;
|
|
8145
|
+
let w = s[b];
|
|
8146
8146
|
const v = d.type === "text" ? d.offset : w.getTextContentSize();
|
|
8147
8147
|
if (h.is(w)) {
|
|
8148
8148
|
if (g === v) return;
|
|
@@ -8156,9 +8156,9 @@ class ur {
|
|
|
8156
8156
|
g === 0 || fr(h) || ([, h] = h.splitText(g), g = 0), h.setFormat(m);
|
|
8157
8157
|
const A = w.getFormatFlags(e, m);
|
|
8158
8158
|
v > 0 && (v === w.getTextContentSize() || fr(w) || ([w] = w.splitText(v)), w.setFormat(A));
|
|
8159
|
-
for (let C = f + 1; C <
|
|
8160
|
-
const E = s[C],
|
|
8161
|
-
E.setFormat(
|
|
8159
|
+
for (let C = f + 1; C < b; C++) {
|
|
8160
|
+
const E = s[C], y = E.getFormatFlags(e, A);
|
|
8161
|
+
E.setFormat(y);
|
|
8162
8162
|
}
|
|
8163
8163
|
c.type === "text" && c.set(h.__key, g, "text"), d.type === "text" && d.set(w.__key, v, "text"), this.format = m | A;
|
|
8164
8164
|
}
|
|
@@ -8185,19 +8185,19 @@ class ur {
|
|
|
8185
8185
|
}
|
|
8186
8186
|
const o = function(g) {
|
|
8187
8187
|
const m = We();
|
|
8188
|
-
let
|
|
8188
|
+
let b = null;
|
|
8189
8189
|
for (let w = 0; w < g.length; w++) {
|
|
8190
8190
|
const v = g[w], A = mr(v);
|
|
8191
|
-
if (A || we(v) && v.isInline() || N(v) && v.isInline() ||
|
|
8192
|
-
if (
|
|
8193
|
-
|
|
8194
|
-
} else m.append(v),
|
|
8191
|
+
if (A || we(v) && v.isInline() || N(v) && v.isInline() || $(v) || v.isParentRequired()) {
|
|
8192
|
+
if (b === null && (b = v.createParentElementNode(), m.append(b), A)) continue;
|
|
8193
|
+
b !== null && b.append(v);
|
|
8194
|
+
} else m.append(v), b = null;
|
|
8195
8195
|
}
|
|
8196
8196
|
return m;
|
|
8197
8197
|
}(e), i = o.getLastDescendant(), l = o.getChildren(), a = !N(n) || !n.isEmpty() ? this.insertParagraph() : null, u = l[l.length - 1];
|
|
8198
8198
|
let c = l[0];
|
|
8199
8199
|
var d;
|
|
8200
|
-
N(d = c) && tr(d) && !d.isEmpty() && N(n) && (!n.isEmpty() || n.canMergeWhenEmpty()) && (N(n) || O(211, t.constructor.name, t.getType()), n.append(...c.getChildren()), c = l[1]), c && (n === null && O(212, t.constructor.name, t.getType()), function(g, m,
|
|
8200
|
+
N(d = c) && tr(d) && !d.isEmpty() && N(n) && (!n.isEmpty() || n.canMergeWhenEmpty()) && (N(n) || O(211, t.constructor.name, t.getType()), n.append(...c.getChildren()), c = l[1]), c && (n === null && O(212, t.constructor.name, t.getType()), function(g, m, b) {
|
|
8201
8201
|
const w = m.getParentOrThrow().getLastChild();
|
|
8202
8202
|
let v = m;
|
|
8203
8203
|
const A = [m];
|
|
@@ -8233,18 +8233,18 @@ class ur {
|
|
|
8233
8233
|
const [a, u] = ai(this);
|
|
8234
8234
|
if (t === 0) return [];
|
|
8235
8235
|
if (t === 1) {
|
|
8236
|
-
if (
|
|
8236
|
+
if ($(i) && !this.isCollapsed()) {
|
|
8237
8237
|
const d = a > u ? u : a, f = a > u ? a : u, h = i.splitText(d, f), g = d === 0 ? h[0] : h[1];
|
|
8238
8238
|
return g != null ? [g] : [];
|
|
8239
8239
|
}
|
|
8240
8240
|
return [i];
|
|
8241
8241
|
}
|
|
8242
8242
|
const c = s.isBefore(o);
|
|
8243
|
-
if (
|
|
8243
|
+
if ($(i)) {
|
|
8244
8244
|
const d = c ? a : u;
|
|
8245
8245
|
d === i.getTextContentSize() ? e.shift() : d !== 0 && ([, i] = i.splitText(d), e[0] = i);
|
|
8246
8246
|
}
|
|
8247
|
-
if (
|
|
8247
|
+
if ($(l)) {
|
|
8248
8248
|
const d = l.getTextContent().length, f = c ? u : a;
|
|
8249
8249
|
f === 0 ? e.pop() : f !== d && ([l] = l.splitText(f), e[n] = l);
|
|
8250
8250
|
}
|
|
@@ -8258,7 +8258,7 @@ class ur {
|
|
|
8258
8258
|
return h.add(l.__key), void It(h);
|
|
8259
8259
|
}
|
|
8260
8260
|
const f = t ? l.getPreviousSibling() : l.getNextSibling();
|
|
8261
|
-
if (
|
|
8261
|
+
if ($(f)) {
|
|
8262
8262
|
const h = f.__key, g = t ? f.getTextContent().length : 0;
|
|
8263
8263
|
return s.set(h, g, "text"), void (i && o.set(h, g, "text"));
|
|
8264
8264
|
}
|
|
@@ -8276,22 +8276,22 @@ class ur {
|
|
|
8276
8276
|
}(u, e, t ? "backward" : "forward", n), u.rangeCount > 0) {
|
|
8277
8277
|
const f = u.getRangeAt(0), h = this.anchor.getNode(), g = nt(h) ? h : lc(h);
|
|
8278
8278
|
if (this.applyDOMRange(f), this.dirty = !0, !i) {
|
|
8279
|
-
const m = this.getNodes(),
|
|
8279
|
+
const m = this.getNodes(), b = [];
|
|
8280
8280
|
let w = !1;
|
|
8281
8281
|
for (let v = 0; v < m.length; v++) {
|
|
8282
8282
|
const A = m[v];
|
|
8283
|
-
ln(A, g) ?
|
|
8283
|
+
ln(A, g) ? b.push(A) : w = !0;
|
|
8284
8284
|
}
|
|
8285
|
-
if (w &&
|
|
8286
|
-
const v =
|
|
8285
|
+
if (w && b.length > 0) if (t) {
|
|
8286
|
+
const v = b[0];
|
|
8287
8287
|
N(v) ? v.selectStart() : v.getParentOrThrow().selectStart();
|
|
8288
8288
|
} else {
|
|
8289
|
-
const v =
|
|
8289
|
+
const v = b[b.length - 1];
|
|
8290
8290
|
N(v) ? v.selectEnd() : v.getParentOrThrow().selectEnd();
|
|
8291
8291
|
}
|
|
8292
8292
|
u.anchorNode === f.startContainer && u.anchorOffset === f.startOffset || function(v) {
|
|
8293
|
-
const A = v.focus, C = v.anchor, E = C.key,
|
|
8294
|
-
rr(C, A.key, A.offset, A.type), rr(A, E,
|
|
8293
|
+
const A = v.focus, C = v.anchor, E = C.key, y = C.offset, _ = C.type;
|
|
8294
|
+
rr(C, A.key, A.offset, A.type), rr(A, E, y, _), v._cachedNodes = null;
|
|
8295
8295
|
}(this);
|
|
8296
8296
|
}
|
|
8297
8297
|
}
|
|
@@ -8335,7 +8335,7 @@ class ur {
|
|
|
8335
8335
|
(function(a, u) {
|
|
8336
8336
|
const c = a.anchor, d = a.focus, f = c.getNode(), h = d.getNode();
|
|
8337
8337
|
if (f === h && c.type === "text" && d.type === "text") {
|
|
8338
|
-
const g = c.offset, m = d.offset,
|
|
8338
|
+
const g = c.offset, m = d.offset, b = g < m, w = b ? g : m, v = b ? m : g, A = v - 1;
|
|
8339
8339
|
w !== A && ($l(f.getTextContent().slice(w, v)) || (u ? d.offset = A : c.offset = A));
|
|
8340
8340
|
}
|
|
8341
8341
|
})(this, e);
|
|
@@ -8411,7 +8411,7 @@ function Eo(r, e, t, n) {
|
|
|
8411
8411
|
const f = u.parentNode;
|
|
8412
8412
|
r === f && e > Array.prototype.indexOf.call(f.children, u) && o--;
|
|
8413
8413
|
}
|
|
8414
|
-
if (s = Br(c),
|
|
8414
|
+
if (s = Br(c), $(s)) o = oo(s, i);
|
|
8415
8415
|
else {
|
|
8416
8416
|
let f = Br(r);
|
|
8417
8417
|
if (f === null) return null;
|
|
@@ -8419,14 +8419,14 @@ function Eo(r, e, t, n) {
|
|
|
8419
8419
|
const h = n.getElementByKey(f.getKey());
|
|
8420
8420
|
h === null && O(214), [f, o] = f.getDOMSlot(h).resolveChildIndex(f, h, r, e), N(f) || O(215), i && o >= f.getChildrenSize() && (o = Math.max(0, f.getChildrenSize() - 1));
|
|
8421
8421
|
let m = f.getChildAtIndex(o);
|
|
8422
|
-
if (N(m) && function(
|
|
8423
|
-
const A =
|
|
8422
|
+
if (N(m) && function(b, w, v) {
|
|
8423
|
+
const A = b.getParent();
|
|
8424
8424
|
return v === null || A === null || !A.canBeEmpty() || A !== v.getNode();
|
|
8425
8425
|
}(m, 0, t)) {
|
|
8426
|
-
const
|
|
8427
|
-
|
|
8426
|
+
const b = i ? m.getLastDescendant() : m.getFirstDescendant();
|
|
8427
|
+
b === null ? f = m : (m = b, f = N(m) ? m : m.getParentOrThrow()), o = 0;
|
|
8428
8428
|
}
|
|
8429
|
-
|
|
8429
|
+
$(m) ? (s = m, f = null, o = oo(m, i)) : m !== f && i && !d && (N(f) || O(216), o = Math.min(f.getChildrenSize(), o + 1));
|
|
8430
8430
|
} else {
|
|
8431
8431
|
const h = f.getIndexWithinParent();
|
|
8432
8432
|
o = e === 0 && we(f) && Br(r) === f ? h : h + 1, f = f.getParentOrThrow();
|
|
@@ -8434,7 +8434,7 @@ function Eo(r, e, t, n) {
|
|
|
8434
8434
|
if (N(f)) return zt(f.__key, o, "element");
|
|
8435
8435
|
}
|
|
8436
8436
|
} else s = Br(r);
|
|
8437
|
-
return
|
|
8437
|
+
return $(s) ? zt(s.__key, o, "text") : null;
|
|
8438
8438
|
}
|
|
8439
8439
|
function So(r, e, t) {
|
|
8440
8440
|
const n = r.offset, s = r.getNode();
|
|
@@ -8443,15 +8443,15 @@ function So(r, e, t) {
|
|
|
8443
8443
|
if (e) {
|
|
8444
8444
|
if ((t || !e) && o === null && N(i) && i.isInline()) {
|
|
8445
8445
|
const l = i.getPreviousSibling();
|
|
8446
|
-
|
|
8446
|
+
$(l) && (r.key = l.__key, r.offset = l.getTextContent().length);
|
|
8447
8447
|
}
|
|
8448
|
-
} else N(o) && !t && o.isInline() ? (r.key = o.__key, r.offset = o.getChildrenSize(), r.type = "element") :
|
|
8448
|
+
} else N(o) && !t && o.isInline() ? (r.key = o.__key, r.offset = o.getChildrenSize(), r.type = "element") : $(o) && (r.key = o.__key, r.offset = o.getTextContent().length);
|
|
8449
8449
|
} else if (n === s.getTextContent().length) {
|
|
8450
8450
|
const o = s.getNextSibling(), i = s.getParent();
|
|
8451
8451
|
if (e && N(o) && o.isInline()) r.key = o.__key, r.offset = 0, r.type = "element";
|
|
8452
8452
|
else if ((t || e) && o === null && N(i) && i.isInline() && !i.canInsertTextAfter()) {
|
|
8453
8453
|
const l = i.getNextSibling();
|
|
8454
|
-
|
|
8454
|
+
$(l) && (r.key = l.__key, r.offset = 0);
|
|
8455
8455
|
}
|
|
8456
8456
|
}
|
|
8457
8457
|
}
|
|
@@ -8539,21 +8539,21 @@ function To(r) {
|
|
|
8539
8539
|
if (r.isCollapsed()) {
|
|
8540
8540
|
if (!N(o)) return;
|
|
8541
8541
|
const l = o.getChildrenSize(), a = t >= l, u = a ? o.getChildAtIndex(l - 1) : o.getChildAtIndex(t);
|
|
8542
|
-
if (
|
|
8542
|
+
if ($(u)) {
|
|
8543
8543
|
let c = 0;
|
|
8544
8544
|
a && (c = u.getTextContentSize()), e.set(u.__key, c, "text"), n.set(u.__key, c, "text");
|
|
8545
8545
|
}
|
|
8546
8546
|
} else {
|
|
8547
8547
|
if (N(o)) {
|
|
8548
8548
|
const l = o.getChildrenSize(), a = t >= l, u = a ? o.getChildAtIndex(l - 1) : o.getChildAtIndex(t);
|
|
8549
|
-
if (
|
|
8549
|
+
if ($(u)) {
|
|
8550
8550
|
let c = 0;
|
|
8551
8551
|
a && (c = u.getTextContentSize()), e.set(u.__key, c, "text");
|
|
8552
8552
|
}
|
|
8553
8553
|
}
|
|
8554
8554
|
if (N(i)) {
|
|
8555
8555
|
const l = i.getChildrenSize(), a = s >= l, u = a ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(s);
|
|
8556
|
-
if (
|
|
8556
|
+
if ($(u)) {
|
|
8557
8557
|
let c = 0;
|
|
8558
8558
|
a && (c = u.getTextContentSize()), n.set(u.__key, c, "text");
|
|
8559
8559
|
}
|
|
@@ -8562,7 +8562,7 @@ function To(r) {
|
|
|
8562
8562
|
}
|
|
8563
8563
|
function os(r, e, t, n, s) {
|
|
8564
8564
|
let o = null, i = 0, l = null;
|
|
8565
|
-
n !== null ? (o = n.__key,
|
|
8565
|
+
n !== null ? (o = n.__key, $(n) ? (i = n.getTextContentSize(), l = "text") : N(n) && (i = n.getChildrenSize(), l = "element")) : s !== null && (o = s.__key, $(s) ? l = "text" : N(s) && (l = "element")), o !== null && l !== null ? r.set(o, i, l) : (i = e.getIndexWithinParent(), i === -1 && (i = t.getChildrenSize()), r.set(t.__key, i, "element"));
|
|
8566
8566
|
}
|
|
8567
8567
|
function Bo(r, e, t, n, s) {
|
|
8568
8568
|
r.type === "text" ? (r.key = t, e || (r.offset += s)) : r.offset > n.getIndexWithinParent() && (r.offset -= 1);
|
|
@@ -8571,40 +8571,40 @@ function Sc(r, e, t, n, s, o, i) {
|
|
|
8571
8571
|
const l = n.anchorNode, a = n.focusNode, u = n.anchorOffset, c = n.focusOffset, d = document.activeElement;
|
|
8572
8572
|
if (s.has("collaboration") && d !== o || d !== null && ki(d)) return;
|
|
8573
8573
|
if (!P(e)) return void (r !== null && wn(t, l, a) && n.removeAllRanges());
|
|
8574
|
-
const f = e.anchor, h = e.focus, g = f.key, m = h.key,
|
|
8575
|
-
let _ =
|
|
8574
|
+
const f = e.anchor, h = e.focus, g = f.key, m = h.key, b = Zn(t, g), w = Zn(t, m), v = f.offset, A = h.offset, C = e.format, E = e.style, y = e.isCollapsed();
|
|
8575
|
+
let _ = b, D = w, S = !1;
|
|
8576
8576
|
if (f.type === "text") {
|
|
8577
|
-
_ = Qn(
|
|
8578
|
-
const
|
|
8579
|
-
S =
|
|
8577
|
+
_ = Qn(b);
|
|
8578
|
+
const I = f.getNode();
|
|
8579
|
+
S = I.getFormat() !== C || I.getStyle() !== E;
|
|
8580
8580
|
} else P(r) && r.anchor.type === "text" && (S = !0);
|
|
8581
8581
|
var M, T, B, F, j;
|
|
8582
|
-
if (h.type === "text" && (D = Qn(w)), _ !== null && D !== null && (
|
|
8582
|
+
if (h.type === "text" && (D = Qn(w)), _ !== null && D !== null && (y && (r === null || S || P(r) && (r.format !== C || r.style !== E)) && (M = C, T = E, B = v, F = g, j = performance.now(), Zl = [M, T, B, F, j]), u !== v || c !== A || l !== _ || a !== D || n.type === "Range" && y || (d !== null && o.contains(d) || o.focus({ preventScroll: !0 }), f.type === "element"))) {
|
|
8583
8583
|
try {
|
|
8584
8584
|
n.setBaseAndExtent(_, v, D, A);
|
|
8585
8585
|
} catch {
|
|
8586
8586
|
}
|
|
8587
8587
|
if (!s.has("skip-scroll-into-view") && e.isCollapsed() && o !== null && o === document.activeElement) {
|
|
8588
|
-
const
|
|
8589
|
-
if (
|
|
8588
|
+
const I = e instanceof ur && e.anchor.type === "element" ? _.childNodes[v] || null : n.rangeCount > 0 ? n.getRangeAt(0) : null;
|
|
8589
|
+
if (I !== null) {
|
|
8590
8590
|
let X;
|
|
8591
|
-
if (
|
|
8591
|
+
if (I instanceof Text) {
|
|
8592
8592
|
const de = document.createRange();
|
|
8593
|
-
de.selectNode(
|
|
8594
|
-
} else X =
|
|
8593
|
+
de.selectNode(I), X = de.getBoundingClientRect();
|
|
8594
|
+
} else X = I.getBoundingClientRect();
|
|
8595
8595
|
(function(de, Ce, ae) {
|
|
8596
8596
|
const Oe = ae.ownerDocument, xe = Oe.defaultView;
|
|
8597
8597
|
if (xe === null) return;
|
|
8598
|
-
let { top: pe, bottom: be } = Ce, _e = 0,
|
|
8598
|
+
let { top: pe, bottom: be } = Ce, _e = 0, ke = 0, ge = ae;
|
|
8599
8599
|
for (; ge !== null; ) {
|
|
8600
8600
|
const De = ge === Oe.body;
|
|
8601
|
-
if (De) _e = 0,
|
|
8601
|
+
if (De) _e = 0, ke = xs(de).innerHeight;
|
|
8602
8602
|
else {
|
|
8603
8603
|
const ue = ge.getBoundingClientRect();
|
|
8604
|
-
_e = ue.top,
|
|
8604
|
+
_e = ue.top, ke = ue.bottom;
|
|
8605
8605
|
}
|
|
8606
8606
|
let Le = 0;
|
|
8607
|
-
if (pe < _e ? Le = -(_e - pe) : be >
|
|
8607
|
+
if (pe < _e ? Le = -(_e - pe) : be > ke && (Le = be - ke), Le !== 0) if (De) xe.scrollBy(0, Le);
|
|
8608
8608
|
else {
|
|
8609
8609
|
const ue = ge.scrollTop;
|
|
8610
8610
|
ge.scrollTop += Le;
|
|
@@ -8640,7 +8640,7 @@ function kc(r, e) {
|
|
|
8640
8640
|
const s = We();
|
|
8641
8641
|
return je().append(s), s.select(), [je(), 0];
|
|
8642
8642
|
}
|
|
8643
|
-
if (
|
|
8643
|
+
if ($(r)) {
|
|
8644
8644
|
const s = r.splitText(e);
|
|
8645
8645
|
if (s.length === 0) return [t, r.getIndexWithinParent()];
|
|
8646
8646
|
const o = e === 0 ? 0 : 1;
|
|
@@ -8740,65 +8740,65 @@ function sr(r, e) {
|
|
|
8740
8740
|
if (r._pendingEditorState = null, r._editorState = t, !s && a && h !== null) {
|
|
8741
8741
|
Je = r, He = t, at = !1, r._updating = !0;
|
|
8742
8742
|
try {
|
|
8743
|
-
const
|
|
8744
|
-
h.disconnect(), g = mc(o, t, r,
|
|
8745
|
-
} catch (
|
|
8746
|
-
if (
|
|
8743
|
+
const y = r._dirtyType, _ = r._dirtyElements, D = r._dirtyLeaves;
|
|
8744
|
+
h.disconnect(), g = mc(o, t, r, y, _, D);
|
|
8745
|
+
} catch (y) {
|
|
8746
|
+
if (y instanceof Error && r._onError(y), Us) throw y;
|
|
8747
8747
|
return ya(r, null, n, t), jl(r), r._dirtyType = Rr, Us = !0, sr(r, o), void (Us = !1);
|
|
8748
8748
|
} finally {
|
|
8749
8749
|
h.observe(n, No), r._updating = f, He = u, at = c, Je = d;
|
|
8750
8750
|
}
|
|
8751
8751
|
}
|
|
8752
8752
|
t._readOnly || (t._readOnly = !0);
|
|
8753
|
-
const m = r._dirtyLeaves,
|
|
8754
|
-
a && (r._dirtyType = yr, r._cloneNotNeeded.clear(), r._dirtyLeaves = /* @__PURE__ */ new Set(), r._dirtyElements = /* @__PURE__ */ new Map(), r._normalizedNodes = /* @__PURE__ */ new Set(), r._updateTags = /* @__PURE__ */ new Set()), function(
|
|
8755
|
-
const D =
|
|
8756
|
-
let S =
|
|
8753
|
+
const m = r._dirtyLeaves, b = r._dirtyElements, w = r._normalizedNodes, v = r._updateTags, A = r._deferred;
|
|
8754
|
+
a && (r._dirtyType = yr, r._cloneNotNeeded.clear(), r._dirtyLeaves = /* @__PURE__ */ new Set(), r._dirtyElements = /* @__PURE__ */ new Map(), r._normalizedNodes = /* @__PURE__ */ new Set(), r._updateTags = /* @__PURE__ */ new Set()), function(y, _) {
|
|
8755
|
+
const D = y._decorators;
|
|
8756
|
+
let S = y._pendingDecorators || D;
|
|
8757
8757
|
const M = _._nodeMap;
|
|
8758
8758
|
let T;
|
|
8759
|
-
for (T in S) M.has(T) || (S === D && (S = Ml(
|
|
8759
|
+
for (T in S) M.has(T) || (S === D && (S = Ml(y)), delete S[T]);
|
|
8760
8760
|
}(r, t);
|
|
8761
8761
|
const C = s ? null : yt(r._window);
|
|
8762
8762
|
if (r._editable && C !== null && (a || l === null || l.dirty)) {
|
|
8763
8763
|
Je = r, He = t;
|
|
8764
8764
|
try {
|
|
8765
8765
|
if (h !== null && h.disconnect(), a || l === null || l.dirty) {
|
|
8766
|
-
const
|
|
8767
|
-
|
|
8766
|
+
const y = r._blockCursorElement;
|
|
8767
|
+
y !== null && Li(y, r, n), Sc(i, l, r, C, v, n);
|
|
8768
8768
|
}
|
|
8769
8769
|
ac(r, n, l), h !== null && h.observe(n, No);
|
|
8770
8770
|
} finally {
|
|
8771
8771
|
Je = d, He = u;
|
|
8772
8772
|
}
|
|
8773
8773
|
}
|
|
8774
|
-
g !== null && function(
|
|
8775
|
-
const T = Array.from(
|
|
8774
|
+
g !== null && function(y, _, D, S, M) {
|
|
8775
|
+
const T = Array.from(y._listeners.mutation), B = T.length;
|
|
8776
8776
|
for (let F = 0; F < B; F++) {
|
|
8777
|
-
const [j,
|
|
8777
|
+
const [j, I] = T[F], X = _.get(I);
|
|
8778
8778
|
X !== void 0 && j(X, { dirtyLeaves: S, prevEditorState: M, updateTags: D });
|
|
8779
8779
|
}
|
|
8780
8780
|
}(r, g, v, m, o), P(l) || l === null || i !== null && i.is(l) || r.dispatchCommand(gi, void 0);
|
|
8781
8781
|
const E = r._pendingDecorators;
|
|
8782
|
-
E !== null && (r._decorators = E, r._pendingDecorators = null, cn("decorator", r, !0, E)), function(
|
|
8782
|
+
E !== null && (r._decorators = E, r._pendingDecorators = null, cn("decorator", r, !0, E)), function(y, _, D) {
|
|
8783
8783
|
const S = io(_), M = io(D);
|
|
8784
|
-
S !== M && cn("textcontent",
|
|
8785
|
-
}(r, e || o, t), cn("update", r, !0, { dirtyElements:
|
|
8786
|
-
if (
|
|
8787
|
-
const D =
|
|
8788
|
-
|
|
8784
|
+
S !== M && cn("textcontent", y, !0, M);
|
|
8785
|
+
}(r, e || o, t), cn("update", r, !0, { dirtyElements: b, dirtyLeaves: m, editorState: t, normalizedNodes: w, prevEditorState: e || o, tags: v }), function(y, _) {
|
|
8786
|
+
if (y._deferred = [], _.length !== 0) {
|
|
8787
|
+
const D = y._updating;
|
|
8788
|
+
y._updating = !0;
|
|
8789
8789
|
try {
|
|
8790
8790
|
for (let S = 0; S < _.length; S++) _[S]();
|
|
8791
8791
|
} finally {
|
|
8792
|
-
|
|
8792
|
+
y._updating = D;
|
|
8793
8793
|
}
|
|
8794
8794
|
}
|
|
8795
|
-
}(r, A), function(
|
|
8796
|
-
const _ =
|
|
8795
|
+
}(r, A), function(y) {
|
|
8796
|
+
const _ = y._updates;
|
|
8797
8797
|
if (_.length !== 0) {
|
|
8798
8798
|
const D = _.shift();
|
|
8799
8799
|
if (D) {
|
|
8800
8800
|
const [S, M] = D;
|
|
8801
|
-
pa(
|
|
8801
|
+
pa(y, S, M);
|
|
8802
8802
|
}
|
|
8803
8803
|
}
|
|
8804
8804
|
}(r);
|
|
@@ -8871,28 +8871,28 @@ function pa(r, e, t) {
|
|
|
8871
8871
|
e(), o = Po(r, o), function(w, v) {
|
|
8872
8872
|
const A = v.getEditorState()._selection, C = w._selection;
|
|
8873
8873
|
if (P(C)) {
|
|
8874
|
-
const E = C.anchor,
|
|
8874
|
+
const E = C.anchor, y = C.focus;
|
|
8875
8875
|
let _;
|
|
8876
|
-
if (E.type === "text" && (_ = E.getNode(), _.selectionTransform(A, C)),
|
|
8877
|
-
const D =
|
|
8876
|
+
if (E.type === "text" && (_ = E.getNode(), _.selectionTransform(A, C)), y.type === "text") {
|
|
8877
|
+
const D = y.getNode();
|
|
8878
8878
|
_ !== D && D.selectionTransform(A, C);
|
|
8879
8879
|
}
|
|
8880
8880
|
}
|
|
8881
8881
|
}(a, r), r._dirtyType !== yr && (o ? function(w, v) {
|
|
8882
8882
|
const A = v._dirtyLeaves, C = w._nodeMap;
|
|
8883
8883
|
for (const E of A) {
|
|
8884
|
-
const
|
|
8885
|
-
|
|
8884
|
+
const y = C.get(E);
|
|
8885
|
+
$(y) && y.isAttached() && y.isSimpleText() && !y.isUnmergeable() && no(y);
|
|
8886
8886
|
}
|
|
8887
8887
|
}(a, r) : function(w, v) {
|
|
8888
|
-
const A = v._dirtyLeaves, C = v._dirtyElements, E = w._nodeMap,
|
|
8888
|
+
const A = v._dirtyLeaves, C = v._dirtyElements, E = w._nodeMap, y = nr(), _ = /* @__PURE__ */ new Map();
|
|
8889
8889
|
let D = A, S = D.size, M = C, T = M.size;
|
|
8890
8890
|
for (; S > 0 || T > 0; ) {
|
|
8891
8891
|
if (S > 0) {
|
|
8892
8892
|
v._dirtyLeaves = /* @__PURE__ */ new Set();
|
|
8893
8893
|
for (const B of D) {
|
|
8894
8894
|
const F = E.get(B);
|
|
8895
|
-
|
|
8895
|
+
$(F) && F.isAttached() && F.isSimpleText() && !F.isUnmergeable() && no(F), F !== void 0 && jo(F, y) && Fo(v, F, _), A.add(B);
|
|
8896
8896
|
}
|
|
8897
8897
|
if (D = v._dirtyLeaves, S = D.size, S > 0) {
|
|
8898
8898
|
qn++;
|
|
@@ -8903,36 +8903,36 @@ function pa(r, e, t) {
|
|
|
8903
8903
|
for (const B of M) {
|
|
8904
8904
|
const F = B[0], j = B[1];
|
|
8905
8905
|
if (F !== "root" && !j) continue;
|
|
8906
|
-
const
|
|
8907
|
-
|
|
8906
|
+
const I = E.get(F);
|
|
8907
|
+
I !== void 0 && jo(I, y) && Fo(v, I, _), C.set(F, j);
|
|
8908
8908
|
}
|
|
8909
8909
|
D = v._dirtyLeaves, S = D.size, M = v._dirtyElements, T = M.size, qn++;
|
|
8910
8910
|
}
|
|
8911
8911
|
v._dirtyLeaves = A, v._dirtyElements = C;
|
|
8912
8912
|
}(a, r), Po(r), function(w, v, A, C) {
|
|
8913
|
-
const E = w._nodeMap,
|
|
8913
|
+
const E = w._nodeMap, y = v._nodeMap, _ = [];
|
|
8914
8914
|
for (const [D] of C) {
|
|
8915
|
-
const S =
|
|
8916
|
-
S !== void 0 && (S.isAttached() || (N(S) && Wl(S, D, E,
|
|
8915
|
+
const S = y.get(D);
|
|
8916
|
+
S !== void 0 && (S.isAttached() || (N(S) && Wl(S, D, E, y, _, C), E.has(D) || C.delete(D), _.push(D)));
|
|
8917
8917
|
}
|
|
8918
|
-
for (const D of _)
|
|
8918
|
+
for (const D of _) y.delete(D);
|
|
8919
8919
|
for (const D of A) {
|
|
8920
|
-
const S =
|
|
8921
|
-
S === void 0 || S.isAttached() || (E.has(D) || A.delete(D),
|
|
8920
|
+
const S = y.get(D);
|
|
8921
|
+
S === void 0 || S.isAttached() || (E.has(D) || A.delete(D), y.delete(D));
|
|
8922
8922
|
}
|
|
8923
8923
|
}(l, a, r._dirtyLeaves, r._dirtyElements)), m !== r._compositionKey && (a._flushSync = !0);
|
|
8924
|
-
const
|
|
8925
|
-
if (P(
|
|
8926
|
-
const w = a._nodeMap, v =
|
|
8924
|
+
const b = a._selection;
|
|
8925
|
+
if (P(b)) {
|
|
8926
|
+
const w = a._nodeMap, v = b.anchor.key, A = b.focus.key;
|
|
8927
8927
|
w.get(v) !== void 0 && w.get(A) !== void 0 || O(19);
|
|
8928
|
-
} else Rt(
|
|
8928
|
+
} else Rt(b) && b._nodes.size === 0 && (a._selection = null);
|
|
8929
8929
|
} catch (m) {
|
|
8930
8930
|
return m instanceof Error && r._onError(m), r._pendingEditorState = l, r._dirtyType = Rr, r._cloneNotNeeded.clear(), r._dirtyLeaves = /* @__PURE__ */ new Set(), r._dirtyElements.clear(), void sr(r);
|
|
8931
8931
|
} finally {
|
|
8932
8932
|
He = c, at = d, Je = f, r._updating = h, qn = 0;
|
|
8933
8933
|
}
|
|
8934
|
-
r._dirtyType !== yr || function(m,
|
|
8935
|
-
const w =
|
|
8934
|
+
r._dirtyType !== yr || function(m, b) {
|
|
8935
|
+
const w = b.getEditorState()._selection, v = m._selection;
|
|
8936
8936
|
if (v !== null) {
|
|
8937
8937
|
if (v.dirty || !v.is(w)) return !0;
|
|
8938
8938
|
} else if (w !== null) return !0;
|
|
@@ -9085,7 +9085,7 @@ class Xt extends _s {
|
|
|
9085
9085
|
const e = [];
|
|
9086
9086
|
let t = this.getFirstChild();
|
|
9087
9087
|
for (; t !== null; ) {
|
|
9088
|
-
if (
|
|
9088
|
+
if ($(t) && e.push(t), N(t)) {
|
|
9089
9089
|
const n = t.getAllTextNodes();
|
|
9090
9090
|
e.push(...n);
|
|
9091
9091
|
}
|
|
@@ -9188,10 +9188,10 @@ class Xt extends _s {
|
|
|
9188
9188
|
if (!this.canBeEmpty()) {
|
|
9189
9189
|
if (e === 0 && t === 0) {
|
|
9190
9190
|
const a = this.getFirstChild();
|
|
9191
|
-
if (
|
|
9191
|
+
if ($(a) || N(a)) return a.select(0, 0);
|
|
9192
9192
|
} else if (!(e !== void 0 && e !== i || t !== void 0 && t !== i)) {
|
|
9193
9193
|
const a = this.getLastChild();
|
|
9194
|
-
if (
|
|
9194
|
+
if ($(a) || N(a)) return a.select();
|
|
9195
9195
|
}
|
|
9196
9196
|
}
|
|
9197
9197
|
s === void 0 && (s = i), o === void 0 && (o = i);
|
|
@@ -9240,23 +9240,23 @@ class Xt extends _s {
|
|
|
9240
9240
|
let g = d === null ? this.getFirstChild() : d.getNextSibling();
|
|
9241
9241
|
for (let m = 0; m < t; m++) {
|
|
9242
9242
|
g === null && O(100);
|
|
9243
|
-
const
|
|
9244
|
-
gr(g.getWritable()), u.push(w), g =
|
|
9243
|
+
const b = g.getNextSibling(), w = g.__key;
|
|
9244
|
+
gr(g.getWritable()), u.push(w), g = b;
|
|
9245
9245
|
}
|
|
9246
9246
|
}
|
|
9247
9247
|
let h = d;
|
|
9248
9248
|
for (let g = 0; g < s; g++) {
|
|
9249
9249
|
const m = n[g];
|
|
9250
9250
|
h !== null && m.is(h) && (d = h = h.getPreviousSibling());
|
|
9251
|
-
const
|
|
9252
|
-
|
|
9251
|
+
const b = m.getWritable();
|
|
9252
|
+
b.__parent === l && f--, gr(b);
|
|
9253
9253
|
const w = m.__key;
|
|
9254
|
-
if (h === null) i.__first = w,
|
|
9254
|
+
if (h === null) i.__first = w, b.__prev = null;
|
|
9255
9255
|
else {
|
|
9256
9256
|
const v = h.getWritable();
|
|
9257
|
-
v.__next = w,
|
|
9257
|
+
v.__next = w, b.__prev = v.__key;
|
|
9258
9258
|
}
|
|
9259
|
-
m.__key === l && O(76),
|
|
9259
|
+
m.__key === l && O(76), b.__parent = l, a.push(w), h = m;
|
|
9260
9260
|
}
|
|
9261
9261
|
if (e + t === o)
|
|
9262
9262
|
h !== null && (h.getWritable().__next = null, i.__last = h.__key);
|
|
@@ -9270,8 +9270,8 @@ class Xt extends _s {
|
|
|
9270
9270
|
if (i.__size = f, u.length) {
|
|
9271
9271
|
const g = V();
|
|
9272
9272
|
if (P(g)) {
|
|
9273
|
-
const m = new Set(u),
|
|
9274
|
-
Oo(w, m,
|
|
9273
|
+
const m = new Set(u), b = new Set(a), { anchor: w, focus: v } = g;
|
|
9274
|
+
Oo(w, m, b) && os(w, w.getNode(), this, d, c), Oo(v, m, b) && os(v, v.getNode(), this, d, c), f !== 0 || this.canBeEmpty() || $t(this) || this.remove();
|
|
9275
9275
|
}
|
|
9276
9276
|
}
|
|
9277
9277
|
return i;
|
|
@@ -9541,7 +9541,7 @@ class zr extends Xt {
|
|
|
9541
9541
|
}
|
|
9542
9542
|
collapseAtStart() {
|
|
9543
9543
|
const e = this.getChildren();
|
|
9544
|
-
if (e.length === 0 ||
|
|
9544
|
+
if (e.length === 0 || $(e[0]) && e[0].getTextContent().trim() === "") {
|
|
9545
9545
|
if (this.getNextSibling() !== null) return this.selectNext(), this.remove(), !0;
|
|
9546
9546
|
if (this.getPreviousSibling() !== null) return this.selectPrevious(), this.remove(), !0;
|
|
9547
9547
|
}
|
|
@@ -9572,29 +9572,29 @@ function Lc(r) {
|
|
|
9572
9572
|
else {
|
|
9573
9573
|
h = /* @__PURE__ */ new Map();
|
|
9574
9574
|
for (let m = 0; m < u.length; m++) {
|
|
9575
|
-
let
|
|
9576
|
-
if (typeof
|
|
9577
|
-
const
|
|
9578
|
-
|
|
9575
|
+
let b = u[m], w = null, v = null;
|
|
9576
|
+
if (typeof b != "function") {
|
|
9577
|
+
const y = b;
|
|
9578
|
+
b = y.replace, w = y.with, v = y.withKlass || null;
|
|
9579
9579
|
}
|
|
9580
|
-
const A =
|
|
9581
|
-
C !== null && E.add(C), h.set(A, { exportDOM: d && d.export ? d.export.get(
|
|
9580
|
+
const A = b.getType(), C = b.transform(), E = /* @__PURE__ */ new Set();
|
|
9581
|
+
C !== null && E.add(C), h.set(A, { exportDOM: d && d.export ? d.export.get(b) : void 0, klass: b, replace: w, replaceWithKlass: v, transforms: E });
|
|
9582
9582
|
}
|
|
9583
9583
|
}
|
|
9584
|
-
const g = new Cs(i, s, h, { disableEvents: o, namespace: l, theme: n }, c || console.error, function(m,
|
|
9584
|
+
const g = new Cs(i, s, h, { disableEvents: o, namespace: l, theme: n }, c || console.error, function(m, b) {
|
|
9585
9585
|
const w = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set(), A = (C) => {
|
|
9586
9586
|
Object.keys(C).forEach((E) => {
|
|
9587
|
-
let
|
|
9588
|
-
|
|
9587
|
+
let y = w.get(E);
|
|
9588
|
+
y === void 0 && (y = [], w.set(E, y)), y.push(C[E]);
|
|
9589
9589
|
});
|
|
9590
9590
|
};
|
|
9591
9591
|
return m.forEach((C) => {
|
|
9592
9592
|
const E = C.klass.importDOM;
|
|
9593
9593
|
if (E == null || v.has(E)) return;
|
|
9594
9594
|
v.add(E);
|
|
9595
|
-
const
|
|
9596
|
-
|
|
9597
|
-
}),
|
|
9595
|
+
const y = E.call(C.klass);
|
|
9596
|
+
y !== null && A(y);
|
|
9597
|
+
}), b && A(b), w;
|
|
9598
9598
|
}(h, d ? d.import : void 0), f);
|
|
9599
9599
|
return a !== void 0 && (g._pendingEditorState = a, g._dirtyType = Rr), g;
|
|
9600
9600
|
}
|
|
@@ -9697,7 +9697,7 @@ class Cs {
|
|
|
9697
9697
|
return e.every(this.hasNode.bind(this));
|
|
9698
9698
|
}
|
|
9699
9699
|
dispatchCommand(e, t) {
|
|
9700
|
-
return
|
|
9700
|
+
return W(this, e, t);
|
|
9701
9701
|
}
|
|
9702
9702
|
getDecorators() {
|
|
9703
9703
|
return this._decorators;
|
|
@@ -9722,31 +9722,31 @@ class Cs {
|
|
|
9722
9722
|
(c === void 0 || c < 1) && u.addEventListener("selectionchange", na), ss.set(u, (c || 0) + 1), l.__lexicalEditor = a;
|
|
9723
9723
|
const d = ra(l);
|
|
9724
9724
|
for (let f = 0; f < si.length; f++) {
|
|
9725
|
-
const [h, g] = si[f], m = typeof g == "function" ? (
|
|
9726
|
-
bo(
|
|
9727
|
-
} : (
|
|
9728
|
-
if (bo(
|
|
9729
|
-
xo(
|
|
9725
|
+
const [h, g] = si[f], m = typeof g == "function" ? (b) => {
|
|
9726
|
+
bo(b) || (xo(b), (a.isEditable() || h === "click") && g(b, a));
|
|
9727
|
+
} : (b) => {
|
|
9728
|
+
if (bo(b)) return;
|
|
9729
|
+
xo(b);
|
|
9730
9730
|
const w = a.isEditable();
|
|
9731
9731
|
switch (h) {
|
|
9732
9732
|
case "cut":
|
|
9733
|
-
return w &&
|
|
9733
|
+
return w && W(a, xi, b);
|
|
9734
9734
|
case "copy":
|
|
9735
|
-
return
|
|
9735
|
+
return W(a, fs, b);
|
|
9736
9736
|
case "paste":
|
|
9737
|
-
return w &&
|
|
9737
|
+
return w && W(a, ds, b);
|
|
9738
9738
|
case "dragstart":
|
|
9739
|
-
return w &&
|
|
9739
|
+
return w && W(a, Al, b);
|
|
9740
9740
|
case "dragover":
|
|
9741
|
-
return w &&
|
|
9741
|
+
return w && W(a, El, b);
|
|
9742
9742
|
case "dragend":
|
|
9743
|
-
return w &&
|
|
9743
|
+
return w && W(a, Tu, b);
|
|
9744
9744
|
case "focus":
|
|
9745
|
-
return w &&
|
|
9745
|
+
return w && W(a, Fu, b);
|
|
9746
9746
|
case "blur":
|
|
9747
|
-
return w &&
|
|
9747
|
+
return w && W(a, ju, b);
|
|
9748
9748
|
case "drop":
|
|
9749
|
-
return w &&
|
|
9749
|
+
return w && W(a, Dl, b);
|
|
9750
9750
|
}
|
|
9751
9751
|
};
|
|
9752
9752
|
l.addEventListener(h, m), d.push(() => {
|
|
@@ -9818,7 +9818,7 @@ class Cs {
|
|
|
9818
9818
|
}
|
|
9819
9819
|
}
|
|
9820
9820
|
Cs.version = "0.21.0+prod.esm";
|
|
9821
|
-
const xa = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Pc = xa ? Ir :
|
|
9821
|
+
const xa = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Pc = xa ? Ir : Se, On = { tag: "history-merge" };
|
|
9822
9822
|
function Rc({ initialConfig: r, children: e }) {
|
|
9823
9823
|
const t = Et(() => {
|
|
9824
9824
|
const { theme: n, namespace: s, nodes: o, onError: i, editorState: l, html: a } = r, u = bu(null, n), c = Lc({ editable: r.editable, html: a, namespace: s, nodes: o, onError: (d) => i(d, c), theme: n });
|
|
@@ -9855,7 +9855,7 @@ function Rc({ initialConfig: r, children: e }) {
|
|
|
9855
9855
|
s.setEditable(n === void 0 || n);
|
|
9856
9856
|
}, []), p.jsx(gl.Provider, { value: t, children: e });
|
|
9857
9857
|
}
|
|
9858
|
-
const Oc = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir :
|
|
9858
|
+
const Oc = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir : Se;
|
|
9859
9859
|
function Mc(r) {
|
|
9860
9860
|
return { initialValueFn: () => r.isEditable(), subscribe: (e) => r.registerEditableListener(e) };
|
|
9861
9861
|
}
|
|
@@ -9890,7 +9890,7 @@ function qc(r) {
|
|
|
9890
9890
|
const o = s.getChildren(), i = o.length;
|
|
9891
9891
|
for (let l = 0; l < i; l++) {
|
|
9892
9892
|
const a = o[n];
|
|
9893
|
-
if (
|
|
9893
|
+
if (!$(a)) return !1;
|
|
9894
9894
|
}
|
|
9895
9895
|
}
|
|
9896
9896
|
}
|
|
@@ -9934,8 +9934,8 @@ function _a(r, e) {
|
|
|
9934
9934
|
const [n, s] = t, o = r.isBackward(), i = n.getNode(), l = s.getNode(), a = e.is(i), u = e.is(l);
|
|
9935
9935
|
if (a || u) {
|
|
9936
9936
|
const [c, d] = ai(r), f = i.is(l), h = e.is(o ? l : i), g = e.is(o ? i : l);
|
|
9937
|
-
let m,
|
|
9938
|
-
return f ? (
|
|
9937
|
+
let m, b = 0;
|
|
9938
|
+
return f ? (b = c > d ? d : c, m = c > d ? c : d) : h ? (b = o ? d : c, m = void 0) : g && (b = 0, m = o ? c : d), e.__text = e.__text.slice(b, m), e;
|
|
9939
9939
|
}
|
|
9940
9940
|
}
|
|
9941
9941
|
return e;
|
|
@@ -9982,7 +9982,7 @@ function Io(r, e, t) {
|
|
|
9982
9982
|
}
|
|
9983
9983
|
function $o(r) {
|
|
9984
9984
|
if (we(r) || !N(r) || $t(r)) return !1;
|
|
9985
|
-
const e = r.getFirstChild(), t = e === null || mr(e) ||
|
|
9985
|
+
const e = r.getFirstChild(), t = e === null || mr(e) || $(e) || e.isInline();
|
|
9986
9986
|
return !r.isInline() && r.canBeEmpty() !== !1 && t;
|
|
9987
9987
|
}
|
|
9988
9988
|
function Xc(r) {
|
|
@@ -10060,9 +10060,9 @@ function nd(r) {
|
|
|
10060
10060
|
r.update(() => {
|
|
10061
10061
|
const m = V();
|
|
10062
10062
|
if (P(m)) {
|
|
10063
|
-
const
|
|
10064
|
-
let w =
|
|
10065
|
-
if (
|
|
10063
|
+
const b = m.anchor;
|
|
10064
|
+
let w = b.getNode(), v = 0, A = 0;
|
|
10065
|
+
if ($(w) && u >= 0 && c >= 0 && (v = u, A = u + c, m.setTextNodeRange(w, v, w, A)), v === A && d === "" || (m.insertRawText(d), w = b.getNode()), $(w)) {
|
|
10066
10066
|
v = f, A = f + h;
|
|
10067
10067
|
const C = w.getTextContentSize();
|
|
10068
10068
|
v = v > C ? C : v, A = A > C ? C : A, m.setTextNodeRange(w, v, w, A);
|
|
@@ -10112,7 +10112,7 @@ function Ea(r, e, t, n = null) {
|
|
|
10112
10112
|
let i = e;
|
|
10113
10113
|
if (n !== null) {
|
|
10114
10114
|
let h = Pi(e);
|
|
10115
|
-
h =
|
|
10115
|
+
h = $(h) && n !== null ? _a(n, h) : h, i = h;
|
|
10116
10116
|
}
|
|
10117
10117
|
const l = N(i) ? i.getChildren() : [], a = r._nodes.get(i.getType());
|
|
10118
10118
|
let u;
|
|
@@ -10138,7 +10138,7 @@ function ka(r, e, t, n, s = /* @__PURE__ */ new Map(), o) {
|
|
|
10138
10138
|
if (Sa.has(r.nodeName)) return i;
|
|
10139
10139
|
let l = null;
|
|
10140
10140
|
const a = function(g, m) {
|
|
10141
|
-
const { nodeName:
|
|
10141
|
+
const { nodeName: b } = g, w = m._htmlConversions.get(b.toLowerCase());
|
|
10142
10142
|
let v = null;
|
|
10143
10143
|
if (w !== void 0) for (const A of w) {
|
|
10144
10144
|
const C = A(g);
|
|
@@ -10235,7 +10235,7 @@ function Ta(r, e, t, n = []) {
|
|
|
10235
10235
|
let i = t;
|
|
10236
10236
|
if (e !== null) {
|
|
10237
10237
|
let u = Pi(t);
|
|
10238
|
-
u =
|
|
10238
|
+
u = $(u) && e !== null ? _a(e, u) : u, i = u;
|
|
10239
10239
|
}
|
|
10240
10240
|
const l = N(i) ? i.getChildren() : [], a = function(u) {
|
|
10241
10241
|
const c = u.exportJSON(), d = u.constructor;
|
|
@@ -10245,7 +10245,7 @@ function Ta(r, e, t, n = []) {
|
|
|
10245
10245
|
}
|
|
10246
10246
|
return c;
|
|
10247
10247
|
}(i);
|
|
10248
|
-
if (
|
|
10248
|
+
if ($(i)) {
|
|
10249
10249
|
const u = i.__text;
|
|
10250
10250
|
u.length > 0 ? a.text = u : s = !1;
|
|
10251
10251
|
}
|
|
@@ -10270,7 +10270,7 @@ function ud(r) {
|
|
|
10270
10270
|
const e = [];
|
|
10271
10271
|
for (let t = 0; t < r.length; t++) {
|
|
10272
10272
|
const n = r[t], s = Bc(n);
|
|
10273
|
-
|
|
10273
|
+
$(s) && Hc(s), e.push(s);
|
|
10274
10274
|
}
|
|
10275
10275
|
return e;
|
|
10276
10276
|
}
|
|
@@ -10621,7 +10621,7 @@ function bd(r) {
|
|
|
10621
10621
|
const { offset: o, node: i } = s, l = Or(i);
|
|
10622
10622
|
if (l !== null) {
|
|
10623
10623
|
const a = Ec();
|
|
10624
|
-
if (
|
|
10624
|
+
if ($(l)) a.anchor.set(l.getKey(), o, "text"), a.focus.set(l.getKey(), o, "text");
|
|
10625
10625
|
else {
|
|
10626
10626
|
const c = l.getParentOrThrow().getKey(), d = l.getIndexWithinParent() + 1;
|
|
10627
10627
|
a.anchor.set(c, d, "element"), a.focus.set(c, d, "element");
|
|
@@ -10662,7 +10662,7 @@ function bd(r) {
|
|
|
10662
10662
|
}(e, r), !0);
|
|
10663
10663
|
}, he));
|
|
10664
10664
|
}
|
|
10665
|
-
const ci = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir :
|
|
10665
|
+
const ci = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir : Se;
|
|
10666
10666
|
function Qo(r) {
|
|
10667
10667
|
return r.getEditorState().read(ba(r.isComposing()));
|
|
10668
10668
|
}
|
|
@@ -10673,7 +10673,7 @@ function _d({ contentEditable: r, placeholder: e = null, ErrorBoundary: t }) {
|
|
|
10673
10673
|
qa(() => {
|
|
10674
10674
|
a(u);
|
|
10675
10675
|
});
|
|
10676
|
-
}), [o]),
|
|
10676
|
+
}), [o]), Se(() => {
|
|
10677
10677
|
a(o.getDecorators());
|
|
10678
10678
|
}, [o]), Et(() => {
|
|
10679
10679
|
const u = [], c = Object.keys(l);
|
|
@@ -10705,8 +10705,8 @@ function vd({ content: r }) {
|
|
|
10705
10705
|
}(e), n = Ic();
|
|
10706
10706
|
return t ? typeof r == "function" ? r(n) : r : null;
|
|
10707
10707
|
}
|
|
10708
|
-
const Ba = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir :
|
|
10709
|
-
function wd({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: n, ariaDescribedBy: s, ariaErrorMessage: o, ariaExpanded: i, ariaInvalid: l, ariaLabel: a, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: f, autoCapitalize: h, className: g, id: m, role:
|
|
10708
|
+
const Ba = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir : Se;
|
|
10709
|
+
function wd({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: n, ariaDescribedBy: s, ariaErrorMessage: o, ariaExpanded: i, ariaInvalid: l, ariaLabel: a, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: f, autoCapitalize: h, className: g, id: m, role: b = "textbox", spellCheck: w = !0, style: v, tabIndex: A, "data-testid": C, ...E }, y) {
|
|
10710
10710
|
const [_, D] = H(r.isEditable()), S = re((T) => {
|
|
10711
10711
|
T && T.ownerDocument && T.ownerDocument.defaultView ? r.setRootElement(T) : r.setRootElement(null);
|
|
10712
10712
|
}, [r]), M = Et(() => /* @__PURE__ */ function(...T) {
|
|
@@ -10715,10 +10715,10 @@ function wd({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaContr
|
|
|
10715
10715
|
typeof F == "function" ? F(B) : F != null && (F.current = B);
|
|
10716
10716
|
});
|
|
10717
10717
|
};
|
|
10718
|
-
}(
|
|
10718
|
+
}(y, S), [S, y]);
|
|
10719
10719
|
return Ba(() => (D(r.isEditable()), r.registerEditableListener((T) => {
|
|
10720
10720
|
D(T);
|
|
10721
|
-
})), [r]), p.jsx("div", { "aria-activedescendant": _ ? e : void 0, "aria-autocomplete": _ ? t : "none", "aria-controls": _ ? n : void 0, "aria-describedby": s, ...o != null ? { "aria-errormessage": o } : {}, "aria-expanded": _ &&
|
|
10721
|
+
})), [r]), p.jsx("div", { "aria-activedescendant": _ ? e : void 0, "aria-autocomplete": _ ? t : "none", "aria-controls": _ ? n : void 0, "aria-describedby": s, ...o != null ? { "aria-errormessage": o } : {}, "aria-expanded": _ && b === "combobox" ? !!i : void 0, ...l != null ? { "aria-invalid": l } : {}, "aria-label": a, "aria-labelledby": u, "aria-multiline": c, "aria-owns": _ ? d : void 0, "aria-readonly": !_ || void 0, "aria-required": f, autoCapitalize: h, className: g, contentEditable: _, "data-testid": C, id: m, ref: M, role: _ ? b : void 0, spellCheck: w, style: v, tabIndex: A, ...E });
|
|
10722
10722
|
}
|
|
10723
10723
|
const Cd = dl(wd);
|
|
10724
10724
|
function Yo(r) {
|
|
@@ -10758,13 +10758,13 @@ function Bd(r, e, t, n, s) {
|
|
|
10758
10758
|
if (!(P(o) && P(i) && i.isCollapsed() && o.isCollapsed())) return Dt;
|
|
10759
10759
|
const l = function(w, v, A) {
|
|
10760
10760
|
const C = w._nodeMap, E = [];
|
|
10761
|
-
for (const
|
|
10762
|
-
const _ = C.get(
|
|
10761
|
+
for (const y of v) {
|
|
10762
|
+
const _ = C.get(y);
|
|
10763
10763
|
_ !== void 0 && E.push(_);
|
|
10764
10764
|
}
|
|
10765
|
-
for (const [
|
|
10765
|
+
for (const [y, _] of A) {
|
|
10766
10766
|
if (!_) continue;
|
|
10767
|
-
const D = C.get(
|
|
10767
|
+
const D = C.get(y);
|
|
10768
10768
|
D === void 0 || nt(D) || E.push(D);
|
|
10769
10769
|
}
|
|
10770
10770
|
return E;
|
|
@@ -10772,16 +10772,16 @@ function Bd(r, e, t, n, s) {
|
|
|
10772
10772
|
if (l.length === 0) return Dt;
|
|
10773
10773
|
if (l.length > 1) {
|
|
10774
10774
|
const w = e._nodeMap, v = w.get(o.anchor.key), A = w.get(i.anchor.key);
|
|
10775
|
-
return v && A && !r._nodeMap.has(v.__key) &&
|
|
10775
|
+
return v && A && !r._nodeMap.has(v.__key) && $(v) && v.__text.length === 1 && o.anchor.offset === 1 ? Xo : Dt;
|
|
10776
10776
|
}
|
|
10777
10777
|
const a = l[0], u = r._nodeMap.get(a.__key);
|
|
10778
|
-
if (
|
|
10778
|
+
if (!$(u) || !$(a) || u.__mode !== a.__mode) return Dt;
|
|
10779
10779
|
const c = u.__text, d = a.__text;
|
|
10780
10780
|
if (c === d) return Dt;
|
|
10781
10781
|
const f = o.anchor, h = i.anchor;
|
|
10782
10782
|
if (f.key !== h.key || f.type !== "text") return Dt;
|
|
10783
|
-
const g = f.offset, m = h.offset,
|
|
10784
|
-
return
|
|
10783
|
+
const g = f.offset, m = h.offset, b = d.length - c.length;
|
|
10784
|
+
return b === 1 && m === g - 1 ? Xo : b === -1 && m === g + 1 ? kd : b === -1 && m === g ? Td : Dt;
|
|
10785
10785
|
}
|
|
10786
10786
|
function Nd(r, e) {
|
|
10787
10787
|
let t = Date.now(), n = Dt;
|
|
@@ -10793,9 +10793,9 @@ function Nd(r, e) {
|
|
|
10793
10793
|
if (!g && h && u.has("history-merge")) return $n;
|
|
10794
10794
|
if (s === null) return di;
|
|
10795
10795
|
const m = o._selection;
|
|
10796
|
-
return l.size > 0 || a.size > 0 ? g === !1 && d !== Dt && d === n && c < t + e && h || l.size === 1 && function(
|
|
10797
|
-
const A = w._nodeMap.get(
|
|
10798
|
-
return !(P(E) && P(
|
|
10796
|
+
return l.size > 0 || a.size > 0 ? g === !1 && d !== Dt && d === n && c < t + e && h || l.size === 1 && function(b, w, v) {
|
|
10797
|
+
const A = w._nodeMap.get(b), C = v._nodeMap.get(b), E = w._selection, y = v._selection;
|
|
10798
|
+
return !(P(E) && P(y) && E.anchor.type === "element" && E.focus.type === "element" && y.anchor.type === "text" && y.focus.type === "text" || !$(A) || !$(C) || A.__parent !== C.__parent) && JSON.stringify(w.read(() => A.exportJSON())) === JSON.stringify(v.read(() => C.exportJSON()));
|
|
10799
10799
|
}(Array.from(l)[0], s, o) ? $n : di : m !== null ? $n : fi;
|
|
10800
10800
|
})();
|
|
10801
10801
|
return t = c, n = d, f;
|
|
@@ -10836,10 +10836,10 @@ function Ld({ delay: r, externalHistoryState: e }) {
|
|
|
10836
10836
|
const [t] = kt();
|
|
10837
10837
|
return function(n, s, o = 1e3) {
|
|
10838
10838
|
const i = Et(() => s || jd(), [s]);
|
|
10839
|
-
|
|
10839
|
+
Se(() => Fd(n, i, o), [o, n, i]);
|
|
10840
10840
|
}(t, e, r), null;
|
|
10841
10841
|
}
|
|
10842
|
-
const Pd = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir :
|
|
10842
|
+
const Pd = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? Ir : Se;
|
|
10843
10843
|
function Rd({ ignoreHistoryMergeTagChange: r = !0, ignoreSelectionChange: e = !1, onChange: t }) {
|
|
10844
10844
|
const [n] = kt();
|
|
10845
10845
|
return Pd(() => {
|
|
@@ -11447,10 +11447,10 @@ function Jd(r) {
|
|
|
11447
11447
|
}
|
|
11448
11448
|
function Qd() {
|
|
11449
11449
|
const [r] = kt();
|
|
11450
|
-
return
|
|
11450
|
+
return Se(() => {
|
|
11451
11451
|
if (!r.hasNodes([Ur, Cr])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
|
|
11452
11452
|
}, [r]), function(e) {
|
|
11453
|
-
|
|
11453
|
+
Se(() => Jd(e), [e]);
|
|
11454
11454
|
}(r), null;
|
|
11455
11455
|
}
|
|
11456
11456
|
const Yd = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
|
|
@@ -11651,7 +11651,7 @@ function Ws(r, e = {}) {
|
|
|
11651
11651
|
}
|
|
11652
11652
|
function ef({ validateUrl: r, attributes: e }) {
|
|
11653
11653
|
const [t] = kt();
|
|
11654
|
-
return
|
|
11654
|
+
return Se(() => {
|
|
11655
11655
|
if (!t.hasNodes([Dr])) throw new Error("LinkPlugin: LinkNode not registered on editor");
|
|
11656
11656
|
return wr(t.registerCommand(cl, (n) => {
|
|
11657
11657
|
if (n === null) return Ws(n), !0;
|
|
@@ -11705,7 +11705,7 @@ function nf({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
|
|
|
11705
11705
|
u.dispatchCommand(At, "bold");
|
|
11706
11706
|
}, [u]), m = re(() => {
|
|
11707
11707
|
u.dispatchCommand(At, "italic");
|
|
11708
|
-
}, [u]),
|
|
11708
|
+
}, [u]), b = re(() => {
|
|
11709
11709
|
u.dispatchCommand(At, "underline");
|
|
11710
11710
|
}, [u]), w = re(() => {
|
|
11711
11711
|
u.dispatchCommand(ja, void 0);
|
|
@@ -11734,7 +11734,7 @@ function nf({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
|
|
|
11734
11734
|
.mail-editor-toolbar-btn:hover:not(:disabled) {
|
|
11735
11735
|
background: ${r.border};
|
|
11736
11736
|
}
|
|
11737
|
-
`,
|
|
11737
|
+
`, y = () => {
|
|
11738
11738
|
setTimeout(() => {
|
|
11739
11739
|
var _;
|
|
11740
11740
|
(_ = f.current) != null && _.contains(document.activeElement) || d(!1);
|
|
@@ -11783,7 +11783,7 @@ function nf({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
|
|
|
11783
11783
|
{
|
|
11784
11784
|
type: "button",
|
|
11785
11785
|
className: "mail-editor-toolbar-btn",
|
|
11786
|
-
onClick:
|
|
11786
|
+
onClick: b,
|
|
11787
11787
|
disabled: e,
|
|
11788
11788
|
style: { ...C, textDecoration: "underline" },
|
|
11789
11789
|
title: "Underline (Ctrl+U)",
|
|
@@ -11870,7 +11870,7 @@ function nf({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
|
|
|
11870
11870
|
type: "button",
|
|
11871
11871
|
onClick: () => d(!c),
|
|
11872
11872
|
disabled: o || !a || e,
|
|
11873
|
-
onBlur:
|
|
11873
|
+
onBlur: y,
|
|
11874
11874
|
style: {
|
|
11875
11875
|
display: "flex",
|
|
11876
11876
|
alignItems: "center",
|
|
@@ -12013,7 +12013,7 @@ function nf({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
|
|
|
12013
12013
|
}
|
|
12014
12014
|
function sf({ html: r, isExternalUpdate: e, onImportComplete: t }) {
|
|
12015
12015
|
const [n] = kt(), s = tt.useRef(!1);
|
|
12016
|
-
return
|
|
12016
|
+
return Se(() => {
|
|
12017
12017
|
r && (s.current && !e || (s.current = !0, n.update(
|
|
12018
12018
|
() => {
|
|
12019
12019
|
const o = je();
|
|
@@ -12031,7 +12031,7 @@ function sf({ html: r, isExternalUpdate: e, onImportComplete: t }) {
|
|
|
12031
12031
|
}
|
|
12032
12032
|
function of({ text: r, trigger: e }) {
|
|
12033
12033
|
const [t] = kt(), n = tt.useRef(void 0);
|
|
12034
|
-
return
|
|
12034
|
+
return Se(() => {
|
|
12035
12035
|
if (e === void 0 || e === n.current || !r) return;
|
|
12036
12036
|
n.current = e;
|
|
12037
12037
|
const s = r.trim();
|
|
@@ -12126,15 +12126,15 @@ function af({
|
|
|
12126
12126
|
onAiRewrite: h,
|
|
12127
12127
|
aiProcessing: g,
|
|
12128
12128
|
aiProcessingAction: m,
|
|
12129
|
-
renderAboveToolbar:
|
|
12129
|
+
renderAboveToolbar: b
|
|
12130
12130
|
}) {
|
|
12131
|
-
const w = { ...tf, ...s }, [v, A] = tt.useState(!1), C = tt.useRef(void 0), [E,
|
|
12131
|
+
const w = { ...tf, ...s }, [v, A] = tt.useState(!1), C = tt.useRef(void 0), [E, y] = tt.useState(r), [_, D] = tt.useState(!1), [S, M] = tt.useState(null), T = g ?? _, B = m ?? S;
|
|
12132
12132
|
tt.useEffect(() => {
|
|
12133
12133
|
a !== void 0 && a !== C.current && (C.current = a, A(!0));
|
|
12134
12134
|
}, [a]);
|
|
12135
12135
|
const F = re(() => {
|
|
12136
12136
|
A(!1);
|
|
12137
|
-
}, []), j = (xe) => xe.replace(/<[^>]*>/g, "").trim(),
|
|
12137
|
+
}, []), j = (xe) => xe.replace(/<[^>]*>/g, "").trim(), I = (xe) => xe.split(`
|
|
12138
12138
|
`).map((pe) => `<p>${pe || "<br>"}</p>`).join(""), X = async (xe) => {
|
|
12139
12139
|
const pe = j(E);
|
|
12140
12140
|
if (!pe) return;
|
|
@@ -12142,8 +12142,8 @@ function af({
|
|
|
12142
12142
|
if (be) {
|
|
12143
12143
|
D(!0), M(xe);
|
|
12144
12144
|
try {
|
|
12145
|
-
const _e = await be(pe),
|
|
12146
|
-
|
|
12145
|
+
const _e = await be(pe), ke = I(_e);
|
|
12146
|
+
y(ke), e == null || e(ke), C.current = Date.now(), A(!0);
|
|
12147
12147
|
} catch (_e) {
|
|
12148
12148
|
console.error(`AI ${xe} failed:`, _e);
|
|
12149
12149
|
} finally {
|
|
@@ -12162,7 +12162,7 @@ function af({
|
|
|
12162
12162
|
(xe, pe) => {
|
|
12163
12163
|
xe.read(() => {
|
|
12164
12164
|
const be = Aa(pe, null);
|
|
12165
|
-
|
|
12165
|
+
y(be), e == null || e(be);
|
|
12166
12166
|
});
|
|
12167
12167
|
},
|
|
12168
12168
|
[e]
|
|
@@ -12253,7 +12253,7 @@ function af({
|
|
|
12253
12253
|
},
|
|
12254
12254
|
children: [
|
|
12255
12255
|
/* @__PURE__ */ p.jsx("style", { children: Oe }),
|
|
12256
|
-
|
|
12256
|
+
b,
|
|
12257
12257
|
/* @__PURE__ */ p.jsxs(Rc, { initialConfig: Ce, children: [
|
|
12258
12258
|
/* @__PURE__ */ p.jsx(
|
|
12259
12259
|
nf,
|
|
@@ -12352,39 +12352,39 @@ function Sf({
|
|
|
12352
12352
|
placeholder: h = "Write your message...",
|
|
12353
12353
|
className: g = "",
|
|
12354
12354
|
minHeight: m = "200px",
|
|
12355
|
-
sendButtonText:
|
|
12355
|
+
sendButtonText: b = "Send",
|
|
12356
12356
|
hideCancelButton: w = !1,
|
|
12357
12357
|
onAiRestructure: v,
|
|
12358
12358
|
onAiProofread: A,
|
|
12359
12359
|
onAiRewrite: C,
|
|
12360
12360
|
renderAboveToolbar: E
|
|
12361
12361
|
}) {
|
|
12362
|
-
const
|
|
12362
|
+
const y = { ...uf, ...c }, [_, D] = H(r), [S, M] = H(""), [T, B] = H(""), [F, j] = H(e), [I, X] = H(t), [de, Ce] = H([]), [ae, Oe] = H(!1), [xe, pe] = H(""), [be, _e] = H(f), [ke, ge] = H(!1), De = tt.useRef(void 0);
|
|
12363
12363
|
tt.useEffect(() => {
|
|
12364
12364
|
l !== void 0 && l !== De.current && (De.current = l, X(t), ge(!0));
|
|
12365
12365
|
}, [l, t]);
|
|
12366
|
-
const Le = (
|
|
12367
|
-
X(
|
|
12368
|
-
}, ue = ye(null), [Me, ct] = H(!1), Bt = (
|
|
12369
|
-
const
|
|
12370
|
-
if (
|
|
12371
|
-
const Be = Array.from(
|
|
12372
|
-
console.log("[MailComposer] Files selected:", Be.map((
|
|
12366
|
+
const Le = (U) => {
|
|
12367
|
+
X(U), ge(!1), i == null || i(U);
|
|
12368
|
+
}, ue = ye(null), [Me, ct] = H(!1), Bt = (U) => {
|
|
12369
|
+
const Ae = U.target.files;
|
|
12370
|
+
if (Ae) {
|
|
12371
|
+
const Be = Array.from(Ae);
|
|
12372
|
+
console.log("[MailComposer] Files selected:", Be.map((Te) => ({ name: Te.name, size: Te.size, type: Te.type }))), Ce((Te) => [...Te, ...Be]);
|
|
12373
12373
|
}
|
|
12374
12374
|
ue.current && (ue.current.value = "");
|
|
12375
|
-
}, Ut = (
|
|
12376
|
-
|
|
12377
|
-
}, it = (
|
|
12378
|
-
|
|
12379
|
-
}, xt = (
|
|
12380
|
-
if (
|
|
12381
|
-
const
|
|
12382
|
-
console.log("[MailComposer] Files dropped:",
|
|
12375
|
+
}, Ut = (U) => {
|
|
12376
|
+
U.preventDefault(), U.stopPropagation(), ct(!0);
|
|
12377
|
+
}, it = (U) => {
|
|
12378
|
+
U.preventDefault(), U.stopPropagation(), ct(!1);
|
|
12379
|
+
}, xt = (U) => {
|
|
12380
|
+
if (U.preventDefault(), U.stopPropagation(), ct(!1), U.dataTransfer.files && U.dataTransfer.files.length > 0) {
|
|
12381
|
+
const Ae = Array.from(U.dataTransfer.files);
|
|
12382
|
+
console.log("[MailComposer] Files dropped:", Ae.map((Be) => ({ name: Be.name, size: Be.size, type: Be.type }))), Ce((Be) => [...Be, ...Ae]);
|
|
12383
12383
|
} else
|
|
12384
|
-
console.log("[MailComposer] Drop event but no files:",
|
|
12385
|
-
}, pt = (
|
|
12386
|
-
Ce((
|
|
12387
|
-
}, Wt = (
|
|
12384
|
+
console.log("[MailComposer] Drop event but no files:", U.dataTransfer.types);
|
|
12385
|
+
}, pt = (U) => U.type.startsWith("image/") ? "image" : U.type === "application/pdf" ? "picture_as_pdf" : U.type.includes("spreadsheet") || U.type.includes("excel") ? "table_chart" : U.type.includes("document") || U.type.includes("word") ? "description" : "attach_file", Zt = (U) => {
|
|
12386
|
+
Ce((Ae) => Ae.filter((Be, Te) => Te !== U));
|
|
12387
|
+
}, Wt = (U) => U < 1024 ? `${U} B` : U < 1024 * 1024 ? `${(U / 1024).toFixed(1)} KB` : `${(U / (1024 * 1024)).toFixed(1)} MB`, Nt = async () => {
|
|
12388
12388
|
if (!_.trim()) {
|
|
12389
12389
|
pe("Recipient email is required");
|
|
12390
12390
|
return;
|
|
@@ -12395,33 +12395,33 @@ function Sf({
|
|
|
12395
12395
|
}
|
|
12396
12396
|
Oe(!0), pe("");
|
|
12397
12397
|
try {
|
|
12398
|
-
const
|
|
12399
|
-
de.map(async (
|
|
12400
|
-
const jt = await
|
|
12398
|
+
const U = await Promise.all(
|
|
12399
|
+
de.map(async (Te) => {
|
|
12400
|
+
const jt = await Te.arrayBuffer(), Lt = btoa(
|
|
12401
12401
|
new Uint8Array(jt).reduce((Gt, G) => Gt + String.fromCharCode(G), "")
|
|
12402
12402
|
);
|
|
12403
12403
|
return {
|
|
12404
|
-
filename:
|
|
12405
|
-
content_type:
|
|
12404
|
+
filename: Te.name,
|
|
12405
|
+
content_type: Te.type || "application/octet-stream",
|
|
12406
12406
|
data: Lt,
|
|
12407
|
-
size:
|
|
12407
|
+
size: Te.size
|
|
12408
12408
|
};
|
|
12409
12409
|
})
|
|
12410
|
-
),
|
|
12410
|
+
), Ae = I.replace(/>\n+</g, "><").replace(/<p class="[^"]*"><\/p>/g, "<br>").trim(), Be = {
|
|
12411
12411
|
to: _.trim(),
|
|
12412
12412
|
cc: S.trim() || void 0,
|
|
12413
12413
|
bcc: T.trim() || void 0,
|
|
12414
12414
|
subject: F.trim(),
|
|
12415
|
-
html:
|
|
12416
|
-
attachments:
|
|
12415
|
+
html: Ae,
|
|
12416
|
+
attachments: U,
|
|
12417
12417
|
inReplyTo: n == null ? void 0 : n.messageId
|
|
12418
12418
|
};
|
|
12419
|
-
console.log("[MailComposer] Sending email - to:", Be.to, "subject:", Be.subject, "attachmentsCount:", Be.attachments.length), Be.attachments.length > 0 && Be.attachments.forEach((
|
|
12419
|
+
console.log("[MailComposer] Sending email - to:", Be.to, "subject:", Be.subject, "attachmentsCount:", Be.attachments.length), Be.attachments.length > 0 && Be.attachments.forEach((Te, jt) => {
|
|
12420
12420
|
var Lt;
|
|
12421
|
-
console.log(`[MailComposer] Attachment ${jt + 1}:`,
|
|
12421
|
+
console.log(`[MailComposer] Attachment ${jt + 1}:`, Te.filename, "size:", Te.size, "type:", Te.content_type, "data length:", ((Lt = Te.data) == null ? void 0 : Lt.length) || 0);
|
|
12422
12422
|
}), await s(Be), D(""), M(""), B(""), j(""), X(""), Ce([]);
|
|
12423
|
-
} catch (
|
|
12424
|
-
pe(
|
|
12423
|
+
} catch (U) {
|
|
12424
|
+
pe(U instanceof Error ? U.message : "Failed to send email");
|
|
12425
12425
|
} finally {
|
|
12426
12426
|
Oe(!1);
|
|
12427
12427
|
}
|
|
@@ -12429,28 +12429,28 @@ function Sf({
|
|
|
12429
12429
|
width: "100%",
|
|
12430
12430
|
padding: "8px 12px",
|
|
12431
12431
|
fontSize: "14px",
|
|
12432
|
-
border: `1px solid ${
|
|
12432
|
+
border: `1px solid ${y.inputBorder}`,
|
|
12433
12433
|
borderRadius: "6px",
|
|
12434
|
-
background:
|
|
12435
|
-
color:
|
|
12434
|
+
background: y.inputBackground,
|
|
12435
|
+
color: y.text,
|
|
12436
12436
|
outline: "none"
|
|
12437
12437
|
}, dt = {
|
|
12438
12438
|
display: "block",
|
|
12439
12439
|
fontSize: "12px",
|
|
12440
12440
|
fontWeight: 500,
|
|
12441
|
-
color:
|
|
12441
|
+
color: y.textSecondary,
|
|
12442
12442
|
marginBottom: "4px",
|
|
12443
12443
|
textTransform: "uppercase"
|
|
12444
|
-
}, bt = (
|
|
12444
|
+
}, bt = (U, Ae = !1) => ({
|
|
12445
12445
|
padding: "10px 20px",
|
|
12446
12446
|
fontSize: "14px",
|
|
12447
12447
|
fontWeight: 500,
|
|
12448
12448
|
border: "none",
|
|
12449
12449
|
borderRadius: "6px",
|
|
12450
|
-
cursor:
|
|
12451
|
-
opacity:
|
|
12452
|
-
background:
|
|
12453
|
-
color:
|
|
12450
|
+
cursor: Ae ? "not-allowed" : "pointer",
|
|
12451
|
+
opacity: Ae ? 0.6 : 1,
|
|
12452
|
+
background: U ? y.buttonPrimary : y.buttonSecondary,
|
|
12453
|
+
color: U ? "#ffffff" : y.text,
|
|
12454
12454
|
display: "flex",
|
|
12455
12455
|
alignItems: "center",
|
|
12456
12456
|
gap: "8px"
|
|
@@ -12464,7 +12464,7 @@ function Sf({
|
|
|
12464
12464
|
flexDirection: "column",
|
|
12465
12465
|
gap: "16px",
|
|
12466
12466
|
padding: "16px",
|
|
12467
|
-
background:
|
|
12467
|
+
background: y.background
|
|
12468
12468
|
},
|
|
12469
12469
|
children: [
|
|
12470
12470
|
xe && /* @__PURE__ */ p.jsx(
|
|
@@ -12488,7 +12488,7 @@ function Sf({
|
|
|
12488
12488
|
{
|
|
12489
12489
|
type: "email",
|
|
12490
12490
|
value: _,
|
|
12491
|
-
onChange: (
|
|
12491
|
+
onChange: (U) => D(U.target.value),
|
|
12492
12492
|
placeholder: "recipient@example.com",
|
|
12493
12493
|
disabled: d || ae,
|
|
12494
12494
|
style: Ft
|
|
@@ -12506,7 +12506,7 @@ function Sf({
|
|
|
12506
12506
|
border: "none",
|
|
12507
12507
|
padding: 0,
|
|
12508
12508
|
fontSize: "12px",
|
|
12509
|
-
color:
|
|
12509
|
+
color: y.primary,
|
|
12510
12510
|
cursor: "pointer",
|
|
12511
12511
|
textAlign: "left"
|
|
12512
12512
|
},
|
|
@@ -12521,7 +12521,7 @@ function Sf({
|
|
|
12521
12521
|
{
|
|
12522
12522
|
type: "email",
|
|
12523
12523
|
value: S,
|
|
12524
|
-
onChange: (
|
|
12524
|
+
onChange: (U) => M(U.target.value),
|
|
12525
12525
|
placeholder: "cc@example.com",
|
|
12526
12526
|
disabled: d || ae,
|
|
12527
12527
|
style: Ft
|
|
@@ -12535,7 +12535,7 @@ function Sf({
|
|
|
12535
12535
|
{
|
|
12536
12536
|
type: "email",
|
|
12537
12537
|
value: T,
|
|
12538
|
-
onChange: (
|
|
12538
|
+
onChange: (U) => B(U.target.value),
|
|
12539
12539
|
placeholder: "bcc@example.com",
|
|
12540
12540
|
disabled: d || ae,
|
|
12541
12541
|
style: Ft
|
|
@@ -12550,7 +12550,7 @@ function Sf({
|
|
|
12550
12550
|
{
|
|
12551
12551
|
type: "text",
|
|
12552
12552
|
value: F,
|
|
12553
|
-
onChange: (
|
|
12553
|
+
onChange: (U) => j(U.target.value),
|
|
12554
12554
|
placeholder: "Email subject",
|
|
12555
12555
|
disabled: d || ae,
|
|
12556
12556
|
style: Ft
|
|
@@ -12560,14 +12560,14 @@ function Sf({
|
|
|
12560
12560
|
/* @__PURE__ */ p.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ p.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ p.jsx(
|
|
12561
12561
|
af,
|
|
12562
12562
|
{
|
|
12563
|
-
value:
|
|
12563
|
+
value: I,
|
|
12564
12564
|
onChange: Le,
|
|
12565
12565
|
placeholder: h,
|
|
12566
12566
|
replyTo: n,
|
|
12567
|
-
theme:
|
|
12567
|
+
theme: y,
|
|
12568
12568
|
disabled: d || ae,
|
|
12569
12569
|
minHeight: m,
|
|
12570
|
-
externalUpdate:
|
|
12570
|
+
externalUpdate: ke ? l : void 0,
|
|
12571
12571
|
insertText: a,
|
|
12572
12572
|
insertTextTrigger: u,
|
|
12573
12573
|
onAiRestructure: v,
|
|
@@ -12592,8 +12592,8 @@ function Sf({
|
|
|
12592
12592
|
"div",
|
|
12593
12593
|
{
|
|
12594
12594
|
onClick: () => {
|
|
12595
|
-
var
|
|
12596
|
-
return (
|
|
12595
|
+
var U;
|
|
12596
|
+
return (U = ue.current) == null ? void 0 : U.click();
|
|
12597
12597
|
},
|
|
12598
12598
|
onDragOver: Ut,
|
|
12599
12599
|
onDragLeave: it,
|
|
@@ -12601,10 +12601,10 @@ function Sf({
|
|
|
12601
12601
|
style: {
|
|
12602
12602
|
width: "100%",
|
|
12603
12603
|
padding: "24px 16px",
|
|
12604
|
-
border: `2px dashed ${Me ?
|
|
12604
|
+
border: `2px dashed ${Me ? y.primary : y.border}`,
|
|
12605
12605
|
borderRadius: "8px",
|
|
12606
|
-
background: Me ? `${
|
|
12607
|
-
color: Me ?
|
|
12606
|
+
background: Me ? `${y.primary}10` : "transparent",
|
|
12607
|
+
color: Me ? y.primary : y.textSecondary,
|
|
12608
12608
|
cursor: d || ae ? "not-allowed" : "pointer",
|
|
12609
12609
|
display: "flex",
|
|
12610
12610
|
flexDirection: "column",
|
|
@@ -12620,7 +12620,7 @@ function Sf({
|
|
|
12620
12620
|
]
|
|
12621
12621
|
}
|
|
12622
12622
|
),
|
|
12623
|
-
de.length > 0 && /* @__PURE__ */ p.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: de.map((
|
|
12623
|
+
de.length > 0 && /* @__PURE__ */ p.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: de.map((U, Ae) => /* @__PURE__ */ p.jsxs(
|
|
12624
12624
|
"div",
|
|
12625
12625
|
{
|
|
12626
12626
|
style: {
|
|
@@ -12628,27 +12628,27 @@ function Sf({
|
|
|
12628
12628
|
alignItems: "center",
|
|
12629
12629
|
gap: "8px",
|
|
12630
12630
|
padding: "8px 12px",
|
|
12631
|
-
background:
|
|
12631
|
+
background: y.attachmentBackground,
|
|
12632
12632
|
borderRadius: "8px"
|
|
12633
12633
|
},
|
|
12634
12634
|
children: [
|
|
12635
|
-
/* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color:
|
|
12635
|
+
/* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: y.textSecondary }, children: pt(U) }),
|
|
12636
12636
|
/* @__PURE__ */ p.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
12637
|
-
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color:
|
|
12638
|
-
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "12px", color:
|
|
12637
|
+
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: y.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: U.name }),
|
|
12638
|
+
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "12px", color: y.textSecondary }, children: Wt(U.size) })
|
|
12639
12639
|
] }),
|
|
12640
12640
|
/* @__PURE__ */ p.jsx(
|
|
12641
12641
|
"button",
|
|
12642
12642
|
{
|
|
12643
12643
|
type: "button",
|
|
12644
|
-
onClick: () => Zt(
|
|
12644
|
+
onClick: () => Zt(Ae),
|
|
12645
12645
|
disabled: d || ae,
|
|
12646
12646
|
style: {
|
|
12647
12647
|
background: "none",
|
|
12648
12648
|
border: "none",
|
|
12649
12649
|
padding: "4px",
|
|
12650
12650
|
cursor: "pointer",
|
|
12651
|
-
color:
|
|
12651
|
+
color: y.textSecondary,
|
|
12652
12652
|
display: "flex",
|
|
12653
12653
|
borderRadius: "4px"
|
|
12654
12654
|
},
|
|
@@ -12657,7 +12657,7 @@ function Sf({
|
|
|
12657
12657
|
)
|
|
12658
12658
|
]
|
|
12659
12659
|
},
|
|
12660
|
-
`${
|
|
12660
|
+
`${U.name}-${Ae}`
|
|
12661
12661
|
)) })
|
|
12662
12662
|
] }),
|
|
12663
12663
|
/* @__PURE__ */ p.jsxs("div", { style: { display: "flex", justifyContent: "flex-end", gap: "12px" }, children: [
|
|
@@ -12690,7 +12690,7 @@ function Sf({
|
|
|
12690
12690
|
children: ae ? "sync" : "send"
|
|
12691
12691
|
}
|
|
12692
12692
|
),
|
|
12693
|
-
ae ? "Sending..." :
|
|
12693
|
+
ae ? "Sending..." : b
|
|
12694
12694
|
]
|
|
12695
12695
|
}
|
|
12696
12696
|
)
|
|
@@ -12730,8 +12730,8 @@ function kf({
|
|
|
12730
12730
|
theme: d = {},
|
|
12731
12731
|
className: f = ""
|
|
12732
12732
|
}) {
|
|
12733
|
-
const h = { ...cf, ...d }, [g, m] = H(!1), [
|
|
12734
|
-
|
|
12733
|
+
const h = { ...cf, ...d }, [g, m] = H(!1), [b, w] = H(""), v = ye(null), A = ye(null);
|
|
12734
|
+
Se(() => {
|
|
12735
12735
|
function T(B) {
|
|
12736
12736
|
v.current && !v.current.contains(B.target) && (m(!1), w(""));
|
|
12737
12737
|
}
|
|
@@ -12740,23 +12740,23 @@ function kf({
|
|
|
12740
12740
|
const C = r.filter(
|
|
12741
12741
|
(T) => {
|
|
12742
12742
|
var B;
|
|
12743
|
-
return ((B = T.label) == null ? void 0 : B.toLowerCase().includes(
|
|
12743
|
+
return ((B = T.label) == null ? void 0 : B.toLowerCase().includes(b.toLowerCase())) && !e.includes(T.id);
|
|
12744
12744
|
}
|
|
12745
|
-
), E = s &&
|
|
12745
|
+
), E = s && b.trim() && !r.some((T) => {
|
|
12746
12746
|
var B;
|
|
12747
|
-
return ((B = T.label) == null ? void 0 : B.toLowerCase()) ===
|
|
12748
|
-
}),
|
|
12747
|
+
return ((B = T.label) == null ? void 0 : B.toLowerCase()) === b.toLowerCase();
|
|
12748
|
+
}), y = e.map((T) => r.find((B) => B.id === T)).filter(Boolean), _ = re((T) => {
|
|
12749
12749
|
var B;
|
|
12750
12750
|
c > 0 && e.length >= c || (t([...e, T]), w(""), (B = A.current) == null || B.focus());
|
|
12751
12751
|
}, [e, t, c]), D = re((T) => {
|
|
12752
12752
|
t(e.filter((B) => B !== T));
|
|
12753
12753
|
}, [e, t]), S = re(async () => {
|
|
12754
12754
|
if (!E) return;
|
|
12755
|
-
const T = await (o == null ? void 0 : o(
|
|
12755
|
+
const T = await (o == null ? void 0 : o(b.trim()));
|
|
12756
12756
|
T && _(T.id), w("");
|
|
12757
|
-
}, [E,
|
|
12758
|
-
T.key === "Enter" ? (T.preventDefault(), E ? S() : C.length > 0 && _(C[0].id)) : T.key === "Backspace" && !
|
|
12759
|
-
}, [E, C,
|
|
12757
|
+
}, [E, b, o, _]), M = re((T) => {
|
|
12758
|
+
T.key === "Enter" ? (T.preventDefault(), E ? S() : C.length > 0 && _(C[0].id)) : T.key === "Backspace" && !b && e.length > 0 ? D(e[e.length - 1]) : T.key === "Escape" && (m(!1), w(""));
|
|
12759
|
+
}, [E, C, b, e, S, _, D]);
|
|
12760
12760
|
return /* @__PURE__ */ p.jsxs("div", { ref: v, className: f, style: { position: "relative" }, children: [
|
|
12761
12761
|
a && /* @__PURE__ */ p.jsx(
|
|
12762
12762
|
"label",
|
|
@@ -12788,7 +12788,7 @@ function kf({
|
|
|
12788
12788
|
alignItems: "center"
|
|
12789
12789
|
},
|
|
12790
12790
|
children: [
|
|
12791
|
-
|
|
12791
|
+
y.map((T) => /* @__PURE__ */ p.jsxs(
|
|
12792
12792
|
"span",
|
|
12793
12793
|
{
|
|
12794
12794
|
style: {
|
|
@@ -12831,13 +12831,13 @@ function kf({
|
|
|
12831
12831
|
{
|
|
12832
12832
|
ref: A,
|
|
12833
12833
|
type: "text",
|
|
12834
|
-
value:
|
|
12834
|
+
value: b,
|
|
12835
12835
|
onChange: (T) => {
|
|
12836
12836
|
w(T.target.value), g || m(!0);
|
|
12837
12837
|
},
|
|
12838
12838
|
onFocus: () => m(!0),
|
|
12839
12839
|
onKeyDown: M,
|
|
12840
|
-
placeholder:
|
|
12840
|
+
placeholder: y.length === 0 ? n : "",
|
|
12841
12841
|
disabled: u || c > 0 && e.length >= c,
|
|
12842
12842
|
style: {
|
|
12843
12843
|
flex: 1,
|
|
@@ -12879,7 +12879,7 @@ function kf({
|
|
|
12879
12879
|
color: h.textSecondary,
|
|
12880
12880
|
textAlign: "center"
|
|
12881
12881
|
},
|
|
12882
|
-
children:
|
|
12882
|
+
children: b ? "No matches" : "No options available"
|
|
12883
12883
|
}
|
|
12884
12884
|
) : /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
12885
12885
|
C.map((T) => /* @__PURE__ */ p.jsxs(
|
|
@@ -12951,7 +12951,7 @@ function kf({
|
|
|
12951
12951
|
},
|
|
12952
12952
|
children: [
|
|
12953
12953
|
'+ Create "',
|
|
12954
|
-
|
|
12954
|
+
b.trim(),
|
|
12955
12955
|
'"'
|
|
12956
12956
|
]
|
|
12957
12957
|
}
|
|
@@ -12977,12 +12977,12 @@ function Tf({
|
|
|
12977
12977
|
columnClassName: f = "",
|
|
12978
12978
|
itemClassName: h = ""
|
|
12979
12979
|
}) {
|
|
12980
|
-
const [g, m] = H(null), [
|
|
12981
|
-
let j = r.filter((
|
|
12982
|
-
return s && (j = j.sort((
|
|
12983
|
-
}, {}),
|
|
12984
|
-
const j = t(F),
|
|
12985
|
-
m(j), C.current =
|
|
12980
|
+
const [g, m] = H(null), [b, w] = H(null), [v, A] = H(null), C = ye(null), E = e.reduce((B, F) => {
|
|
12981
|
+
let j = r.filter((I) => n(I) === F.id);
|
|
12982
|
+
return s && (j = j.sort((I, X) => s(I) - s(X))), B[F.id] = j, B;
|
|
12983
|
+
}, {}), y = re((B, F) => {
|
|
12984
|
+
const j = t(F), I = n(F);
|
|
12985
|
+
m(j), C.current = I, B.dataTransfer.effectAllowed = "move", B.dataTransfer.setData("text/plain", j), requestAnimationFrame(() => {
|
|
12986
12986
|
const X = B.target;
|
|
12987
12987
|
X.style.opacity = "0.5";
|
|
12988
12988
|
});
|
|
@@ -12996,8 +12996,8 @@ function Tf({
|
|
|
12996
12996
|
F != null && F.closest("[data-kanban-column]") || (w(null), A(null));
|
|
12997
12997
|
}, []), M = re((B, F, j) => {
|
|
12998
12998
|
if (B.preventDefault(), !g) return;
|
|
12999
|
-
const
|
|
13000
|
-
|
|
12999
|
+
const I = C.current;
|
|
13000
|
+
I === F ? l == null || l(g, F, j) : I && i(g, I, F, j), m(null), w(null), A(null), C.current = null;
|
|
13001
13001
|
}, [g, i, l]), T = (B, F) => /* @__PURE__ */ p.jsxs("div", { className: "flex items-center justify-between px-3 py-2", children: [
|
|
13002
13002
|
/* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13003
13003
|
B.color && /* @__PURE__ */ p.jsx(
|
|
@@ -13017,17 +13017,17 @@ function Tf({
|
|
|
13017
13017
|
className: `flex gap-4 overflow-x-auto pb-4 ${d}`,
|
|
13018
13018
|
style: { minHeight: "400px" },
|
|
13019
13019
|
children: e.map((B) => {
|
|
13020
|
-
const F = E[B.id] || [], j =
|
|
13020
|
+
const F = E[B.id] || [], j = b === B.id;
|
|
13021
13021
|
return /* @__PURE__ */ p.jsxs(
|
|
13022
13022
|
"div",
|
|
13023
13023
|
{
|
|
13024
13024
|
"data-kanban-column": B.id,
|
|
13025
13025
|
className: `flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,
|
|
13026
|
-
onDragOver: (
|
|
13027
|
-
|
|
13026
|
+
onDragOver: (I) => {
|
|
13027
|
+
I.preventDefault(), g && !j && w(B.id);
|
|
13028
13028
|
},
|
|
13029
13029
|
onDragLeave: S,
|
|
13030
|
-
onDrop: (
|
|
13030
|
+
onDrop: (I) => M(I, B.id, v ?? F.length),
|
|
13031
13031
|
children: [
|
|
13032
13032
|
/* @__PURE__ */ p.jsx("div", { className: "flex-shrink-0 border-b border-neutral-200", children: u ? u(B, F.length) : T(B, F.length) }),
|
|
13033
13033
|
/* @__PURE__ */ p.jsxs(
|
|
@@ -13035,20 +13035,20 @@ function Tf({
|
|
|
13035
13035
|
{
|
|
13036
13036
|
className: `flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${j ? "bg-blue-50" : ""}`,
|
|
13037
13037
|
children: [
|
|
13038
|
-
F.map((
|
|
13039
|
-
const de = t(
|
|
13038
|
+
F.map((I, X) => {
|
|
13039
|
+
const de = t(I), Ce = g === de, ae = j && v === X && !Ce;
|
|
13040
13040
|
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
13041
13041
|
ae && /* @__PURE__ */ p.jsx("div", { className: "h-1 bg-blue-500 rounded-full mb-2 mx-1" }),
|
|
13042
13042
|
/* @__PURE__ */ p.jsx(
|
|
13043
13043
|
"div",
|
|
13044
13044
|
{
|
|
13045
13045
|
draggable: !0,
|
|
13046
|
-
onDragStart: (Oe) =>
|
|
13046
|
+
onDragStart: (Oe) => y(Oe, I),
|
|
13047
13047
|
onDragEnd: _,
|
|
13048
13048
|
onDragOver: (Oe) => D(Oe, B.id, X),
|
|
13049
|
-
onClick: () => a == null ? void 0 : a(
|
|
13049
|
+
onClick: () => a == null ? void 0 : a(I),
|
|
13050
13050
|
className: `cursor-grab active:cursor-grabbing transition-all ${Ce ? "opacity-50 scale-95" : ""} ${h}`,
|
|
13051
|
-
children: o(
|
|
13051
|
+
children: o(I, Ce)
|
|
13052
13052
|
}
|
|
13053
13053
|
)
|
|
13054
13054
|
] }, de);
|
|
@@ -13057,8 +13057,8 @@ function Tf({
|
|
|
13057
13057
|
"div",
|
|
13058
13058
|
{
|
|
13059
13059
|
className: "min-h-[40px] flex-1",
|
|
13060
|
-
onDragOver: (
|
|
13061
|
-
|
|
13060
|
+
onDragOver: (I) => {
|
|
13061
|
+
I.preventDefault(), D(I, B.id, F.length);
|
|
13062
13062
|
},
|
|
13063
13063
|
children: j && v === F.length && /* @__PURE__ */ p.jsx("div", { className: "h-1 bg-blue-500 rounded-full mx-1 mt-1" })
|
|
13064
13064
|
}
|
|
@@ -13117,7 +13117,7 @@ function Bf({
|
|
|
13117
13117
|
className: h = "",
|
|
13118
13118
|
theme: g = {}
|
|
13119
13119
|
}) {
|
|
13120
|
-
const m = { ...df, ...g }, { allDayItems:
|
|
13120
|
+
const m = { ...df, ...g }, { allDayItems: b, timedItems: w } = Et(() => {
|
|
13121
13121
|
const _ = [], D = [];
|
|
13122
13122
|
for (const S of r)
|
|
13123
13123
|
l(S) ? _.push(S) : D.push(S);
|
|
@@ -13133,7 +13133,7 @@ function Bf({
|
|
|
13133
13133
|
if (!D) return null;
|
|
13134
13134
|
const S = ff(D);
|
|
13135
13135
|
if (!S) return null;
|
|
13136
|
-
const { hours: M, minutes: T } = S, B = Math.max(t, Math.min(n, M)), F = M < t ? 0 : T, j = (B - t) * s + F / 60 * s,
|
|
13136
|
+
const { hours: M, minutes: T } = S, B = Math.max(t, Math.min(n, M)), F = M < t ? 0 : T, j = (B - t) * s + F / 60 * s, I = i(_), X = Math.max(20, I / 60 * s);
|
|
13137
13137
|
return { top: j, height: X };
|
|
13138
13138
|
},
|
|
13139
13139
|
[o, i, t, n, s]
|
|
@@ -13141,16 +13141,16 @@ function Bf({
|
|
|
13141
13141
|
if (!f || !pf(e)) return null;
|
|
13142
13142
|
const _ = /* @__PURE__ */ new Date(), D = _.getHours(), S = _.getMinutes();
|
|
13143
13143
|
return D < t || D > n ? null : (D - t) * s + S / 60 * s;
|
|
13144
|
-
}, [e, f, t, n, s]),
|
|
13144
|
+
}, [e, f, t, n, s]), y = re(
|
|
13145
13145
|
(_) => {
|
|
13146
13146
|
if (!d) return;
|
|
13147
|
-
const D = _.currentTarget.getBoundingClientRect(), M = (_.clientY - D.top) / s * 60, T = Math.floor(M / 60) + t, B = Math.round(M % 60 / 15) * 15, F = Math.min(n, Math.max(t, T)), j = B >= 60 ? 0 : B,
|
|
13148
|
-
d(
|
|
13147
|
+
const D = _.currentTarget.getBoundingClientRect(), M = (_.clientY - D.top) / s * 60, T = Math.floor(M / 60) + t, B = Math.round(M % 60 / 15) * 15, F = Math.min(n, Math.max(t, T)), j = B >= 60 ? 0 : B, I = `${F.toString().padStart(2, "0")}:${j.toString().padStart(2, "0")}`;
|
|
13148
|
+
d(I);
|
|
13149
13149
|
},
|
|
13150
13150
|
[d, s, t, n]
|
|
13151
13151
|
);
|
|
13152
13152
|
return /* @__PURE__ */ p.jsxs("div", { className: h, style: { background: m.background }, children: [
|
|
13153
|
-
|
|
13153
|
+
b.length > 0 && /* @__PURE__ */ p.jsxs(
|
|
13154
13154
|
"div",
|
|
13155
13155
|
{
|
|
13156
13156
|
style: {
|
|
@@ -13172,7 +13172,7 @@ function Bf({
|
|
|
13172
13172
|
children: "All Day"
|
|
13173
13173
|
}
|
|
13174
13174
|
),
|
|
13175
|
-
/* @__PURE__ */ p.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children:
|
|
13175
|
+
/* @__PURE__ */ p.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: b.map((_) => /* @__PURE__ */ p.jsx(
|
|
13176
13176
|
"div",
|
|
13177
13177
|
{
|
|
13178
13178
|
onClick: () => c == null ? void 0 : c(_),
|
|
@@ -13240,7 +13240,7 @@ function Bf({
|
|
|
13240
13240
|
bottom: 0,
|
|
13241
13241
|
cursor: d ? "pointer" : "default"
|
|
13242
13242
|
},
|
|
13243
|
-
onClick:
|
|
13243
|
+
onClick: y
|
|
13244
13244
|
}
|
|
13245
13245
|
),
|
|
13246
13246
|
E !== null && /* @__PURE__ */ p.jsxs(
|
|
@@ -13308,18 +13308,18 @@ function Bf({
|
|
|
13308
13308
|
] });
|
|
13309
13309
|
}
|
|
13310
13310
|
function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComplete: n, variant: s = "widget", hideSaveButton: o = !1, maxDuration: i = 180 }) {
|
|
13311
|
-
const l = s === "widget", [a, u] = H("idle"), [c, d] = H(0), [f, h] = H(0), [g, m] = H(!1), [
|
|
13312
|
-
|
|
13313
|
-
|
|
13311
|
+
const l = s === "widget", [a, u] = H("idle"), [c, d] = H(0), [f, h] = H(0), [g, m] = H(!1), [b, w] = H(0), [v, A] = H(null), [C, E] = H(!1), [y, _] = H(null), [D, S] = H(!1), [M, T] = H([]), [B, F] = H({ completed: 0, total: 0 }), j = ye(!1), I = ye(!1);
|
|
13312
|
+
Se(() => {
|
|
13313
|
+
I.current = D;
|
|
13314
13314
|
}, [D]);
|
|
13315
|
-
const X = ye(null), de = ye(null), Ce = ye(null), ae = ye(null), Oe = ye(null), xe = ye([]), pe = ye(null), be = ye(null), _e = ye(null),
|
|
13315
|
+
const X = ye(null), de = ye(null), Ce = ye(null), ae = ye(null), Oe = ye(null), xe = ye([]), pe = ye(null), be = ye(null), _e = ye(null), ke = ye(null), ge = ye(!1), De = ye([]), Le = ye(null), ue = ye(null), Me = ye([]), ct = ye([]), Bt = ye("insert"), Ut = ye(!1), it = ye(0), xt = ye(0), pt = ye(0), Zt = (z) => {
|
|
13316
13316
|
const k = Math.floor(z / 60), K = Math.floor(z % 60);
|
|
13317
13317
|
return `${k.toString().padStart(2, "0")}:${K.toString().padStart(2, "0")}`;
|
|
13318
13318
|
}, Wt = async (z) => {
|
|
13319
13319
|
const k = await z.arrayBuffer(), K = new AudioContext(), Q = await K.decodeAudioData(k);
|
|
13320
13320
|
return await K.close(), Q;
|
|
13321
13321
|
}, Nt = (z) => {
|
|
13322
|
-
const k = z.numberOfChannels, K = z.sampleRate, Q = 1, R = 16, ne = R / 8, Z = k * ne, ee = K * Z, fe = z.length * Z,
|
|
13322
|
+
const k = z.numberOfChannels, K = z.sampleRate, Q = 1, R = 16, ne = R / 8, Z = k * ne, ee = K * Z, fe = z.length * Z, Ee = new ArrayBuffer(44 + fe), te = new DataView(Ee), se = (Fe, ve) => {
|
|
13323
13323
|
for (let Ye = 0; Ye < ve.length; Ye++)
|
|
13324
13324
|
te.setUint8(Fe + Ye, ve.charCodeAt(Ye));
|
|
13325
13325
|
};
|
|
@@ -13333,9 +13333,9 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13333
13333
|
const Ye = Math.max(-1, Math.min(1, qe[ve][Fe])), Xe = Ye < 0 ? Ye * 32768 : Ye * 32767;
|
|
13334
13334
|
te.setInt16(Ge, Xe, !0), Ge += 2;
|
|
13335
13335
|
}
|
|
13336
|
-
return new Blob([
|
|
13336
|
+
return new Blob([Ee], { type: "audio/wav" });
|
|
13337
13337
|
}, Ft = async (z, k, K, Q) => {
|
|
13338
|
-
const R = new AudioContext(), ne = z.sampleRate, Z = Math.max(z.numberOfChannels, k.numberOfChannels), ee = Math.min(K, z.length), fe = Math.max(0, z.length - K),
|
|
13338
|
+
const R = new AudioContext(), ne = z.sampleRate, Z = Math.max(z.numberOfChannels, k.numberOfChannels), ee = Math.min(K, z.length), fe = Math.max(0, z.length - K), Ee = Q === "insert" ? ee + k.length + fe : ee + k.length, te = R.createBuffer(Z, Ee, ne);
|
|
13339
13339
|
for (let se = 0; se < Z; se++) {
|
|
13340
13340
|
const qe = te.getChannelData(se), Ge = se < z.numberOfChannels ? z.getChannelData(se) : z.getChannelData(0);
|
|
13341
13341
|
for (let ve = 0; ve < ee; ve++)
|
|
@@ -13353,36 +13353,36 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13353
13353
|
if (!z) return;
|
|
13354
13354
|
const k = z.getContext("2d");
|
|
13355
13355
|
if (!k) return;
|
|
13356
|
-
const K = z.getBoundingClientRect(), Q = K.width, R = K.height, ne = De.current, Z = f || c || 1, ee = a === "recording" ? c :
|
|
13356
|
+
const K = z.getBoundingClientRect(), Q = K.width, R = K.height, ne = De.current, Z = f || c || 1, ee = a === "recording" ? c : b;
|
|
13357
13357
|
k.fillStyle = "#2d3b35", k.fillRect(0, 0, Q, R);
|
|
13358
|
-
const fe = 8,
|
|
13359
|
-
te.addColorStop(0,
|
|
13358
|
+
const fe = 8, Ee = "rgba(0, 0, 0, 0.4)", te = k.createLinearGradient(0, 0, 0, fe);
|
|
13359
|
+
te.addColorStop(0, Ee), te.addColorStop(1, "transparent"), k.fillStyle = te, k.fillRect(0, 0, Q, fe);
|
|
13360
13360
|
const se = k.createLinearGradient(0, R - fe, 0, R);
|
|
13361
|
-
se.addColorStop(0, "transparent"), se.addColorStop(1,
|
|
13361
|
+
se.addColorStop(0, "transparent"), se.addColorStop(1, Ee), k.fillStyle = se, k.fillRect(0, R - fe, Q, fe);
|
|
13362
13362
|
const qe = k.createLinearGradient(0, 0, fe, 0);
|
|
13363
|
-
qe.addColorStop(0,
|
|
13363
|
+
qe.addColorStop(0, Ee), qe.addColorStop(1, "transparent"), k.fillStyle = qe, k.fillRect(0, 0, fe, R);
|
|
13364
13364
|
const Ge = k.createLinearGradient(Q - fe, 0, Q, 0);
|
|
13365
|
-
Ge.addColorStop(0, "transparent"), Ge.addColorStop(1,
|
|
13365
|
+
Ge.addColorStop(0, "transparent"), Ge.addColorStop(1, Ee), k.fillStyle = Ge, k.fillRect(Q - fe, 0, fe, R), k.strokeStyle = "#5a6b62", k.lineWidth = 1, k.beginPath(), k.moveTo(0, R / 2), k.lineTo(Q, R / 2), k.stroke();
|
|
13366
13366
|
const Fe = Q / 2;
|
|
13367
13367
|
if (ne.length > 0)
|
|
13368
13368
|
if (a === "recording")
|
|
13369
13369
|
for (let Xe = 0; Xe < ne.length; Xe++) {
|
|
13370
13370
|
const gt = ne.length - 1 - Xe, Vt = Fe - gt * 4;
|
|
13371
13371
|
if (Vt < -3 || Vt > Q) continue;
|
|
13372
|
-
const vt = ne[Xe] * (R / 2 - 12),
|
|
13373
|
-
k.fillStyle = "#10b981", k.fillRect(Vt,
|
|
13372
|
+
const vt = ne[Xe] * (R / 2 - 12), x = R / 2 - vt;
|
|
13373
|
+
k.fillStyle = "#10b981", k.fillRect(Vt, x, 3, vt * 2);
|
|
13374
13374
|
}
|
|
13375
13375
|
else {
|
|
13376
13376
|
const Xe = Z > 0 ? ee / Z * ne.length : 0;
|
|
13377
13377
|
for (let gt = 0; gt < ne.length; gt++) {
|
|
13378
13378
|
const Vt = Xe - gt, vt = Fe - Vt * 4;
|
|
13379
13379
|
if (vt < -3 || vt > Q) continue;
|
|
13380
|
-
const
|
|
13381
|
-
k.fillStyle = gt <= Xe ? "#10b981" : "#4b5563", k.fillRect(vt, L, 3,
|
|
13380
|
+
const x = ne[gt] * (R / 2 - 12), L = R / 2 - x;
|
|
13381
|
+
k.fillStyle = gt <= Xe ? "#10b981" : "#4b5563", k.fillRect(vt, L, 3, x * 2);
|
|
13382
13382
|
}
|
|
13383
13383
|
}
|
|
13384
13384
|
k.strokeStyle = "#ef4444", k.lineWidth = 1, k.beginPath(), k.moveTo(Fe, 0), k.lineTo(Fe, R), k.stroke(), k.fillStyle = "#fff", k.font = "bold 18px monospace", k.textAlign = "center", k.fillText(Zt(ee), Fe, R - 6), a === "recording" && (k.fillStyle = "#ef4444", k.beginPath(), k.arc(20, 20, 8, 0, Math.PI * 2), k.fill(), k.fillStyle = "#fff", k.font = "10px sans-serif", k.textAlign = "left", k.fillText("REC", 34, 24)), k.textAlign = "left";
|
|
13385
|
-
}, [a,
|
|
13385
|
+
}, [a, b, c, f]), bt = () => {
|
|
13386
13386
|
const z = Oe.current;
|
|
13387
13387
|
if (!z || !ge.current) return;
|
|
13388
13388
|
const k = z.frequencyBinCount, K = new Uint8Array(k);
|
|
@@ -13394,7 +13394,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13394
13394
|
}
|
|
13395
13395
|
const R = Math.sqrt(Q / k), ne = Math.min(1, R * 3);
|
|
13396
13396
|
De.current.push(ne), dt(), ge.current && (be.current = requestAnimationFrame(bt));
|
|
13397
|
-
},
|
|
13397
|
+
}, U = async () => {
|
|
13398
13398
|
try {
|
|
13399
13399
|
A(null), E(!1), Le.current === null && (De.current = []);
|
|
13400
13400
|
const z = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
@@ -13431,16 +13431,16 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13431
13431
|
}
|
|
13432
13432
|
else
|
|
13433
13433
|
Z = ne, ee = it.current > 0 ? it.current : 1;
|
|
13434
|
-
if (
|
|
13435
|
-
T((te) => [...te, Z]), F((te) => ({ ...te, total: te.total + 1 })),
|
|
13434
|
+
if (ke.current = Z, z.getTracks().forEach((te) => te.stop()), I.current && t) {
|
|
13435
|
+
T((te) => [...te, Z]), F((te) => ({ ...te, total: te.total + 1 })), ke.current = null, De.current = [], w(0), h(0), d(0), u("idle");
|
|
13436
13436
|
return;
|
|
13437
13437
|
}
|
|
13438
|
-
const fe = URL.createObjectURL(Z),
|
|
13439
|
-
|
|
13440
|
-
w(
|
|
13441
|
-
},
|
|
13438
|
+
const fe = URL.createObjectURL(Z), Ee = new Audio(fe);
|
|
13439
|
+
Ee.ontimeupdate = () => {
|
|
13440
|
+
w(Ee.currentTime);
|
|
13441
|
+
}, Ee.onended = () => {
|
|
13442
13442
|
m(!1);
|
|
13443
|
-
}, _e.current =
|
|
13443
|
+
}, _e.current = Ee, h(ee), w(ee), u("editing");
|
|
13444
13444
|
} catch {
|
|
13445
13445
|
A("Failed to process recording"), u("idle");
|
|
13446
13446
|
}
|
|
@@ -13452,7 +13452,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13452
13452
|
} catch {
|
|
13453
13453
|
A("Could not access microphone. Please allow microphone access.");
|
|
13454
13454
|
}
|
|
13455
|
-
},
|
|
13455
|
+
}, Ae = () => {
|
|
13456
13456
|
ge.current = !1, E(!1), _(null), be.current && (cancelAnimationFrame(be.current), be.current = null), pe.current && (clearInterval(pe.current), pe.current = null), de.current && de.current.state !== "inactive" && de.current.stop();
|
|
13457
13457
|
}, Be = (z) => {
|
|
13458
13458
|
const k = X.current;
|
|
@@ -13461,39 +13461,39 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13461
13461
|
if (K <= 0) return;
|
|
13462
13462
|
const Q = De.current;
|
|
13463
13463
|
if (Q.length === 0) return;
|
|
13464
|
-
const R = k.getBoundingClientRect(), ne = z - xt.current, Z = 4, ee = R.width / k.width, fe = Q.length / K * Z,
|
|
13464
|
+
const R = k.getBoundingClientRect(), ne = z - xt.current, Z = 4, ee = R.width / k.width, fe = Q.length / K * Z, Ee = -ne / (fe * ee), te = pt.current + Ee, se = Math.max(0, Math.min(te, K));
|
|
13465
13465
|
_e.current && (_e.current.currentTime = se), w(se);
|
|
13466
|
-
},
|
|
13466
|
+
}, Te = () => {
|
|
13467
13467
|
_e.current && (_e.current.currentTime = 0), w(0);
|
|
13468
13468
|
}, jt = () => {
|
|
13469
13469
|
const z = f || c;
|
|
13470
13470
|
_e.current && (_e.current.currentTime = z), w(z);
|
|
13471
13471
|
}, Lt = () => {
|
|
13472
13472
|
const z = _e.current;
|
|
13473
|
-
z && (g ? (z.pause(), w(z.currentTime), m(!1)) : (z.currentTime =
|
|
13473
|
+
z && (g ? (z.pause(), w(z.currentTime), m(!1)) : (z.currentTime = b, z.play().catch(() => {
|
|
13474
13474
|
}), m(!0)));
|
|
13475
13475
|
}, Gt = async (z) => {
|
|
13476
|
-
if (!
|
|
13477
|
-
|
|
13476
|
+
if (!ke.current) {
|
|
13477
|
+
U();
|
|
13478
13478
|
return;
|
|
13479
13479
|
}
|
|
13480
13480
|
try {
|
|
13481
|
-
_e.current && (_e.current.pause(), m(!1)), Bt.current = z, ue.current = await Wt(
|
|
13481
|
+
_e.current && (_e.current.pause(), m(!1)), Bt.current = z, ue.current = await Wt(ke.current);
|
|
13482
13482
|
const k = f || c;
|
|
13483
|
-
Le.current =
|
|
13484
|
-
const K = k > 0 ?
|
|
13485
|
-
Me.current = De.current.slice(0, Q), ct.current = De.current.slice(Q), De.current = [...Me.current],
|
|
13483
|
+
Le.current = b;
|
|
13484
|
+
const K = k > 0 ? b / k : 0, Q = Math.floor(K * De.current.length);
|
|
13485
|
+
Me.current = De.current.slice(0, Q), ct.current = De.current.slice(Q), De.current = [...Me.current], U();
|
|
13486
13486
|
} catch {
|
|
13487
13487
|
A("Failed to prepare recording. Please try again.");
|
|
13488
13488
|
}
|
|
13489
13489
|
}, G = () => {
|
|
13490
|
-
_e.current && (_e.current.pause(), _e.current = null),
|
|
13490
|
+
_e.current && (_e.current.pause(), _e.current = null), ke.current = null, ue.current = null, Le.current = null, Me.current = [], m(!1), w(0), h(0), d(0), U();
|
|
13491
13491
|
}, J = () => {
|
|
13492
|
-
|
|
13492
|
+
ke.current ? r(ke.current, f || c) : alert("No audio recorded yet!");
|
|
13493
13493
|
};
|
|
13494
|
-
|
|
13494
|
+
Se(() => {
|
|
13495
13495
|
a === "recording" && X.current && Oe.current && ge.current && (be.current = requestAnimationFrame(bt));
|
|
13496
|
-
}, [a]),
|
|
13496
|
+
}, [a]), Se(() => {
|
|
13497
13497
|
const z = X.current;
|
|
13498
13498
|
if (!z) return;
|
|
13499
13499
|
const k = () => {
|
|
@@ -13503,7 +13503,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13503
13503
|
R && R.scale(K, K);
|
|
13504
13504
|
};
|
|
13505
13505
|
return k(), window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
|
|
13506
|
-
}, []),
|
|
13506
|
+
}, []), Se(() => {
|
|
13507
13507
|
if (a === "idle") {
|
|
13508
13508
|
const z = X.current;
|
|
13509
13509
|
if (!z) return;
|
|
@@ -13515,8 +13515,8 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13515
13515
|
ee.addColorStop(0, Z), ee.addColorStop(1, "transparent"), k.fillStyle = ee, k.fillRect(0, 0, Q, ne);
|
|
13516
13516
|
const fe = k.createLinearGradient(0, R - ne, 0, R);
|
|
13517
13517
|
fe.addColorStop(0, "transparent"), fe.addColorStop(1, Z), k.fillStyle = fe, k.fillRect(0, R - ne, Q, ne);
|
|
13518
|
-
const
|
|
13519
|
-
|
|
13518
|
+
const Ee = k.createLinearGradient(0, 0, ne, 0);
|
|
13519
|
+
Ee.addColorStop(0, Z), Ee.addColorStop(1, "transparent"), k.fillStyle = Ee, k.fillRect(0, 0, ne, R);
|
|
13520
13520
|
const te = k.createLinearGradient(Q - ne, 0, Q, 0);
|
|
13521
13521
|
te.addColorStop(0, "transparent"), te.addColorStop(1, Z), k.fillStyle = te, k.fillRect(Q - ne, 0, ne, R), k.strokeStyle = "#5a6b62", k.lineWidth = 1, k.beginPath(), k.moveTo(0, R / 2), k.lineTo(Q, R / 2), k.stroke();
|
|
13522
13522
|
const se = Q / 2;
|
|
@@ -13526,7 +13526,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13526
13526
|
const Ne = re((z) => {
|
|
13527
13527
|
T((k) => [...k, z]), F((k) => ({ ...k, total: k.total + 1 }));
|
|
13528
13528
|
}, []);
|
|
13529
|
-
if (
|
|
13529
|
+
if (Se(() => {
|
|
13530
13530
|
(async () => {
|
|
13531
13531
|
if (j.current || M.length === 0 || !t) return;
|
|
13532
13532
|
j.current = !0;
|
|
@@ -13540,9 +13540,9 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13540
13540
|
T((K) => K.slice(1)), F((K) => ({ ...K, completed: K.completed + 1 })), j.current = !1;
|
|
13541
13541
|
}
|
|
13542
13542
|
})();
|
|
13543
|
-
}, [M, t, n]),
|
|
13543
|
+
}, [M, t, n]), Se(() => () => {
|
|
13544
13544
|
ge.current = !1, pe.current && clearInterval(pe.current), be.current && cancelAnimationFrame(be.current), Ce.current && Ce.current.getTracks().forEach((z) => z.stop()), ae.current && ae.current.state !== "closed" && ae.current.close();
|
|
13545
|
-
}, []),
|
|
13545
|
+
}, []), Se(() => {
|
|
13546
13546
|
if (a === "editing" && g) {
|
|
13547
13547
|
let z;
|
|
13548
13548
|
const k = () => {
|
|
@@ -13552,7 +13552,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13552
13552
|
if (Q) {
|
|
13553
13553
|
const R = Q.getContext("2d");
|
|
13554
13554
|
if (R) {
|
|
13555
|
-
const ne = Q.getBoundingClientRect(), Z = ne.width, ee = ne.height, fe = De.current,
|
|
13555
|
+
const ne = Q.getBoundingClientRect(), Z = ne.width, ee = ne.height, fe = De.current, Ee = f || c || 1, te = K.currentTime;
|
|
13556
13556
|
R.fillStyle = "#2d3b35", R.fillRect(0, 0, Z, ee);
|
|
13557
13557
|
const se = 8, qe = "rgba(0, 0, 0, 0.4)", Ge = R.createLinearGradient(0, 0, 0, se);
|
|
13558
13558
|
Ge.addColorStop(0, qe), Ge.addColorStop(1, "transparent"), R.fillStyle = Ge, R.fillRect(0, 0, Z, se);
|
|
@@ -13562,7 +13562,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13562
13562
|
ve.addColorStop(0, qe), ve.addColorStop(1, "transparent"), R.fillStyle = ve, R.fillRect(0, 0, se, ee);
|
|
13563
13563
|
const Ye = R.createLinearGradient(Z - se, 0, Z, 0);
|
|
13564
13564
|
Ye.addColorStop(0, "transparent"), Ye.addColorStop(1, qe), R.fillStyle = Ye, R.fillRect(Z - se, 0, se, ee), R.strokeStyle = "#5a6b62", R.lineWidth = 1, R.beginPath(), R.moveTo(0, ee / 2), R.lineTo(Z, ee / 2), R.stroke();
|
|
13565
|
-
const Xe = Z / 2, gt = 3, Vt = 4, vt =
|
|
13565
|
+
const Xe = Z / 2, gt = 3, Vt = 4, vt = Ee > 0 ? te / Ee * fe.length : 0;
|
|
13566
13566
|
for (let q = 0; q < fe.length; q++) {
|
|
13567
13567
|
const Y = vt - q, le = Xe - Y * Vt;
|
|
13568
13568
|
if (le < -gt || le > Z) continue;
|
|
@@ -13570,8 +13570,8 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13570
13570
|
R.fillStyle = q <= vt ? "#10b981" : "#4b5563", R.fillRect(le, ie, gt, me * 2);
|
|
13571
13571
|
}
|
|
13572
13572
|
R.strokeStyle = "#ef4444", R.lineWidth = 1, R.beginPath(), R.moveTo(Xe, 0), R.lineTo(Xe, ee), R.stroke(), R.fillStyle = "#fff", R.font = "bold 18px monospace", R.textAlign = "center";
|
|
13573
|
-
const
|
|
13574
|
-
R.fillText(`${
|
|
13573
|
+
const x = Math.floor(te / 60), L = Math.floor(te % 60);
|
|
13574
|
+
R.fillText(`${x.toString().padStart(2, "0")}:${L.toString().padStart(2, "0")}`, Xe, ee - 6), R.textAlign = "left";
|
|
13575
13575
|
}
|
|
13576
13576
|
}
|
|
13577
13577
|
z = requestAnimationFrame(k);
|
|
@@ -13579,16 +13579,16 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13579
13579
|
};
|
|
13580
13580
|
return z = requestAnimationFrame(k), () => cancelAnimationFrame(z);
|
|
13581
13581
|
}
|
|
13582
|
-
}, [a, g, f, c]),
|
|
13582
|
+
}, [a, g, f, c]), Se(() => {
|
|
13583
13583
|
a === "editing" && !g && dt();
|
|
13584
|
-
}, [a,
|
|
13584
|
+
}, [a, b, g, dt]), v)
|
|
13585
13585
|
return /* @__PURE__ */ p.jsxs("div", { style: { border: "1px solid #fecaca", borderRadius: "12px", padding: "16px", background: "#fef2f2" }, children: [
|
|
13586
13586
|
/* @__PURE__ */ p.jsx("p", { style: { fontSize: "14px", color: "#dc2626", marginBottom: "12px" }, children: v }),
|
|
13587
13587
|
/* @__PURE__ */ p.jsx(
|
|
13588
13588
|
"button",
|
|
13589
13589
|
{
|
|
13590
13590
|
onClick: () => {
|
|
13591
|
-
A(null),
|
|
13591
|
+
A(null), U();
|
|
13592
13592
|
},
|
|
13593
13593
|
style: { padding: "8px 16px", fontSize: "14px", background: "#171717", color: "white", borderRadius: "8px", border: "none", cursor: "pointer" },
|
|
13594
13594
|
children: "Try Again"
|
|
@@ -13618,7 +13618,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13618
13618
|
style: { width: "100%", height: "32px", cursor: "pointer", flexShrink: 0 },
|
|
13619
13619
|
onMouseDown: (z) => {
|
|
13620
13620
|
if (a === "editing") {
|
|
13621
|
-
Ut.current = !0, xt.current = z.clientX, pt.current =
|
|
13621
|
+
Ut.current = !0, xt.current = z.clientX, pt.current = b;
|
|
13622
13622
|
const k = (Q) => {
|
|
13623
13623
|
Ut.current && Be(Q.clientX);
|
|
13624
13624
|
}, K = () => {
|
|
@@ -13647,7 +13647,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13647
13647
|
/* @__PURE__ */ p.jsx(
|
|
13648
13648
|
"button",
|
|
13649
13649
|
{
|
|
13650
|
-
onClick:
|
|
13650
|
+
onClick: Te,
|
|
13651
13651
|
disabled: a === "idle" || a === "recording",
|
|
13652
13652
|
style: a === "idle" || a === "recording" ? $e : Ie,
|
|
13653
13653
|
title: "Go to start",
|
|
@@ -13685,36 +13685,51 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13685
13685
|
"button",
|
|
13686
13686
|
{
|
|
13687
13687
|
onClick: () => {
|
|
13688
|
-
|
|
13688
|
+
y === "insert" ? Ae() : a === "idle" ? (_("insert"), U()) : a === "editing" && (_("insert"), Gt("insert"));
|
|
13689
13689
|
},
|
|
13690
|
-
disabled: a === "recording" &&
|
|
13691
|
-
style: a === "recording" &&
|
|
13692
|
-
title:
|
|
13693
|
-
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color:
|
|
13690
|
+
disabled: a === "recording" && y !== "insert" || g,
|
|
13691
|
+
style: a === "recording" && y !== "insert" || g ? $e : Ie,
|
|
13692
|
+
title: y === "insert" ? "Stop recording" : "Insert recording",
|
|
13693
|
+
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: y === "insert" ? "#ef4444" : "#171717" }, children: "add" })
|
|
13694
13694
|
}
|
|
13695
13695
|
),
|
|
13696
13696
|
/* @__PURE__ */ p.jsx(
|
|
13697
13697
|
"button",
|
|
13698
13698
|
{
|
|
13699
13699
|
onClick: () => {
|
|
13700
|
-
|
|
13700
|
+
I.current || (y === "mic" ? Ae() : a === "idle" ? (_("mic"), U()) : a === "editing" && (_("mic"), Gt("replace")));
|
|
13701
|
+
},
|
|
13702
|
+
onMouseDown: () => {
|
|
13703
|
+
I.current && a === "idle" && !g && (_("mic"), U());
|
|
13704
|
+
},
|
|
13705
|
+
onMouseUp: () => {
|
|
13706
|
+
I.current && a === "recording" && y === "mic" && Ae();
|
|
13707
|
+
},
|
|
13708
|
+
onMouseLeave: () => {
|
|
13709
|
+
I.current && a === "recording" && y === "mic" && Ae();
|
|
13710
|
+
},
|
|
13711
|
+
onTouchStart: () => {
|
|
13712
|
+
I.current && a === "idle" && !g && (_("mic"), U());
|
|
13713
|
+
},
|
|
13714
|
+
onTouchEnd: () => {
|
|
13715
|
+
I.current && a === "recording" && y === "mic" && Ae();
|
|
13701
13716
|
},
|
|
13702
|
-
disabled: a === "recording" &&
|
|
13703
|
-
style: a === "recording" &&
|
|
13704
|
-
title:
|
|
13705
|
-
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color:
|
|
13717
|
+
disabled: a === "recording" && y !== "mic" || g,
|
|
13718
|
+
style: a === "recording" && y !== "mic" || g ? $e : Ie,
|
|
13719
|
+
title: D ? "Hold to record (walkie-talkie)" : y === "mic" ? "Stop recording" : "Record",
|
|
13720
|
+
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: y === "mic" ? "#ef4444" : "#171717" }, children: "mic" })
|
|
13706
13721
|
}
|
|
13707
13722
|
),
|
|
13708
13723
|
/* @__PURE__ */ p.jsx(
|
|
13709
13724
|
"button",
|
|
13710
13725
|
{
|
|
13711
13726
|
onClick: () => {
|
|
13712
|
-
|
|
13727
|
+
y === "startover" ? Ae() : a === "editing" && (_("startover"), G());
|
|
13713
13728
|
},
|
|
13714
|
-
disabled: a === "idle" || a === "recording" &&
|
|
13715
|
-
style: a === "idle" || a === "recording" &&
|
|
13716
|
-
title:
|
|
13717
|
-
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color:
|
|
13729
|
+
disabled: a === "idle" || a === "recording" && y !== "startover" || g,
|
|
13730
|
+
style: a === "idle" || a === "recording" && y !== "startover" || g ? $e : Ie,
|
|
13731
|
+
title: y === "startover" ? "Stop recording" : "Start over",
|
|
13732
|
+
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: y === "startover" ? "#ef4444" : "#171717" }, children: "refresh" })
|
|
13718
13733
|
}
|
|
13719
13734
|
)
|
|
13720
13735
|
] }),
|
|
@@ -13771,7 +13786,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13771
13786
|
"button",
|
|
13772
13787
|
{
|
|
13773
13788
|
onClick: () => {
|
|
13774
|
-
a === "editing" &&
|
|
13789
|
+
a === "editing" && ke.current && Ne(ke.current);
|
|
13775
13790
|
},
|
|
13776
13791
|
disabled: a !== "editing",
|
|
13777
13792
|
style: a !== "editing" ? $e : Ie,
|