@qwanyx/stack 0.2.103 → 0.2.105
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/auth/index.d.ts +8 -0
- package/dist/index.cjs.js +22 -22
- package/dist/index.esm.js +105 -70
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -4117,7 +4117,7 @@ class S2 {
|
|
|
4117
4117
|
}
|
|
4118
4118
|
}
|
|
4119
4119
|
const Fi = "qwanyx_auth_token", Ri = "qwanyx_refresh_token", Li = "qwanyx_auth_user";
|
|
4120
|
-
class
|
|
4120
|
+
class et {
|
|
4121
4121
|
/**
|
|
4122
4122
|
* Store authentication token
|
|
4123
4123
|
*/
|
|
@@ -4208,7 +4208,7 @@ class uu {
|
|
|
4208
4208
|
async register(e, t, n) {
|
|
4209
4209
|
var s, i;
|
|
4210
4210
|
try {
|
|
4211
|
-
const l = await (await fetch(`${this.config.apiUrl}/spu/invoke`, {
|
|
4211
|
+
const o = n != null && n.tenantDomain ? [n.tenantDomain] : [], l = (n == null ? void 0 : n.tenantDomain) || null, u = await (await fetch(`${this.config.apiUrl}/spu/invoke`, {
|
|
4212
4212
|
method: "POST",
|
|
4213
4213
|
headers: { "Content-Type": "application/json" },
|
|
4214
4214
|
body: JSON.stringify({
|
|
@@ -4219,17 +4219,21 @@ class uu {
|
|
|
4219
4219
|
email: e,
|
|
4220
4220
|
password: t,
|
|
4221
4221
|
...n,
|
|
4222
|
+
domains: o,
|
|
4223
|
+
// Array of domains user belongs to
|
|
4224
|
+
primaryDomain: l,
|
|
4225
|
+
// First domain where user registered
|
|
4222
4226
|
system_id: this.config.systemId
|
|
4223
4227
|
// Auto-add as member of this system
|
|
4224
4228
|
}
|
|
4225
4229
|
})
|
|
4226
4230
|
})).json();
|
|
4227
|
-
return
|
|
4231
|
+
return u.success && ((s = u.result) != null && s.success) ? {
|
|
4228
4232
|
success: !0,
|
|
4229
|
-
userId:
|
|
4230
|
-
email:
|
|
4231
|
-
requiresVerification:
|
|
4232
|
-
} : { success: !1, error: ((i =
|
|
4233
|
+
userId: u.result.user_id,
|
|
4234
|
+
email: u.result.email,
|
|
4235
|
+
requiresVerification: u.result.requiresVerification
|
|
4236
|
+
} : { success: !1, error: ((i = u.result) == null ? void 0 : i.message) || u.error || "Registration failed" };
|
|
4233
4237
|
} catch (o) {
|
|
4234
4238
|
return {
|
|
4235
4239
|
success: !1,
|
|
@@ -4256,7 +4260,7 @@ class uu {
|
|
|
4256
4260
|
})).json();
|
|
4257
4261
|
if (a.success && ((n = a.result) != null && n.token)) {
|
|
4258
4262
|
const { token: u, user: c } = a.result;
|
|
4259
|
-
return
|
|
4263
|
+
return et.setToken(u), et.setUser(c), (i = (s = this.config).onLogin) == null || i.call(s, c), { success: !0, user: c, token: u };
|
|
4260
4264
|
} else
|
|
4261
4265
|
return { success: !1, error: ((o = a.result) == null ? void 0 : o.error) || a.error || "Verification failed" };
|
|
4262
4266
|
} catch (l) {
|
|
@@ -4309,7 +4313,7 @@ class uu {
|
|
|
4309
4313
|
})).json();
|
|
4310
4314
|
if (u.success && ((s = u.result) != null && s.token)) {
|
|
4311
4315
|
const { token: c, user: d } = u.result;
|
|
4312
|
-
return
|
|
4316
|
+
return et.setToken(c), et.setUser(d), (o = (i = this.config).onLogin) == null || o.call(i, d), { success: !0, user: d, token: c };
|
|
4313
4317
|
} else
|
|
4314
4318
|
return { success: !1, error: ((l = u.result) == null ? void 0 : l.message) || u.error || "Password reset failed" };
|
|
4315
4319
|
} catch (a) {
|
|
@@ -4325,9 +4329,9 @@ class uu {
|
|
|
4325
4329
|
* Auto-adds user as member of configured system on first login
|
|
4326
4330
|
*/
|
|
4327
4331
|
async login(e, t, n) {
|
|
4328
|
-
var s, i, o, l, a, u;
|
|
4332
|
+
var s, i, o, l, a, u, c;
|
|
4329
4333
|
try {
|
|
4330
|
-
const
|
|
4334
|
+
const f = await (await fetch(`${this.config.apiUrl}/spu/invoke`, {
|
|
4331
4335
|
method: "POST",
|
|
4332
4336
|
headers: { "Content-Type": "application/json" },
|
|
4333
4337
|
body: JSON.stringify({
|
|
@@ -4343,21 +4347,22 @@ class uu {
|
|
|
4343
4347
|
}
|
|
4344
4348
|
})
|
|
4345
4349
|
})).json();
|
|
4346
|
-
if ((s =
|
|
4350
|
+
if ((s = f.result) != null && s.requiresVerification || f.requiresVerification)
|
|
4347
4351
|
return {
|
|
4348
4352
|
success: !1,
|
|
4349
|
-
error: ((i =
|
|
4353
|
+
error: ((i = f.result) == null ? void 0 : i.error) || f.error || "Please verify your email first",
|
|
4350
4354
|
requiresVerification: !0
|
|
4351
4355
|
};
|
|
4352
|
-
if (
|
|
4353
|
-
const { token:
|
|
4354
|
-
return
|
|
4356
|
+
if (f.success && ((o = f.result) != null && o.token)) {
|
|
4357
|
+
const { token: p, user: g } = f.result;
|
|
4358
|
+
return et.setToken(p), et.setUser(g), n != null && n.tenantDomain && !((l = g.domains) != null && l.includes(n.tenantDomain)) && this.addDomainToUser(g._id || g.id, n.tenantDomain).catch(() => {
|
|
4359
|
+
}), (u = (a = this.config).onLogin) == null || u.call(a, g), { success: !0, user: g, token: p };
|
|
4355
4360
|
} else
|
|
4356
|
-
return { success: !1, error: ((
|
|
4357
|
-
} catch (
|
|
4361
|
+
return { success: !1, error: ((c = f.result) == null ? void 0 : c.error) || f.error || "Login failed" };
|
|
4362
|
+
} catch (d) {
|
|
4358
4363
|
return {
|
|
4359
4364
|
success: !1,
|
|
4360
|
-
error:
|
|
4365
|
+
error: d instanceof Error ? d.message : "Network error"
|
|
4361
4366
|
};
|
|
4362
4367
|
}
|
|
4363
4368
|
}
|
|
@@ -4373,7 +4378,7 @@ class uu {
|
|
|
4373
4378
|
*/
|
|
4374
4379
|
logout() {
|
|
4375
4380
|
var e, t;
|
|
4376
|
-
|
|
4381
|
+
et.clearAll(), (t = (e = this.config).onLogout) == null || t.call(e);
|
|
4377
4382
|
}
|
|
4378
4383
|
/**
|
|
4379
4384
|
* Check if user has a specific role in a group
|
|
@@ -4385,7 +4390,7 @@ class uu {
|
|
|
4385
4390
|
method: "POST",
|
|
4386
4391
|
headers: {
|
|
4387
4392
|
"Content-Type": "application/json",
|
|
4388
|
-
...
|
|
4393
|
+
...et.getAuthHeader()
|
|
4389
4394
|
},
|
|
4390
4395
|
body: JSON.stringify({
|
|
4391
4396
|
system_id: this.config.systemId || "system",
|
|
@@ -4412,15 +4417,45 @@ class uu {
|
|
|
4412
4417
|
* Get current user from storage
|
|
4413
4418
|
*/
|
|
4414
4419
|
getCurrentUser() {
|
|
4415
|
-
return
|
|
4420
|
+
return et.getUser();
|
|
4416
4421
|
}
|
|
4417
4422
|
/**
|
|
4418
4423
|
* Check if user is authenticated
|
|
4419
4424
|
*/
|
|
4420
4425
|
isAuthenticated() {
|
|
4421
|
-
return
|
|
4426
|
+
return et.isAuthenticated();
|
|
4422
4427
|
}
|
|
4423
4428
|
// ===== USER MANAGEMENT =====
|
|
4429
|
+
/**
|
|
4430
|
+
* Add a domain to user's domains array
|
|
4431
|
+
* Called after successful login to track which domains a user has accessed
|
|
4432
|
+
*/
|
|
4433
|
+
async addDomainToUser(e, t) {
|
|
4434
|
+
try {
|
|
4435
|
+
const s = await (await fetch(`${this.config.apiUrl}/spu/invoke`, {
|
|
4436
|
+
method: "POST",
|
|
4437
|
+
headers: {
|
|
4438
|
+
"Content-Type": "application/json",
|
|
4439
|
+
...et.getAuthHeader()
|
|
4440
|
+
},
|
|
4441
|
+
body: JSON.stringify({
|
|
4442
|
+
system_id: "system",
|
|
4443
|
+
coprocessor: "auth",
|
|
4444
|
+
method: "add_domain_to_user",
|
|
4445
|
+
params: {
|
|
4446
|
+
user_id: e,
|
|
4447
|
+
domain: t
|
|
4448
|
+
}
|
|
4449
|
+
})
|
|
4450
|
+
})).json();
|
|
4451
|
+
return { success: s.success || !1, error: s.error };
|
|
4452
|
+
} catch (n) {
|
|
4453
|
+
return {
|
|
4454
|
+
success: !1,
|
|
4455
|
+
error: n instanceof Error ? n.message : "Network error"
|
|
4456
|
+
};
|
|
4457
|
+
}
|
|
4458
|
+
}
|
|
4424
4459
|
/**
|
|
4425
4460
|
* List all users in the platform (from system.db)
|
|
4426
4461
|
*/
|
|
@@ -4430,7 +4465,7 @@ class uu {
|
|
|
4430
4465
|
method: "POST",
|
|
4431
4466
|
headers: {
|
|
4432
4467
|
"Content-Type": "application/json",
|
|
4433
|
-
...
|
|
4468
|
+
...et.getAuthHeader()
|
|
4434
4469
|
},
|
|
4435
4470
|
body: JSON.stringify({
|
|
4436
4471
|
system_id: "system",
|
|
@@ -4465,7 +4500,7 @@ class uu {
|
|
|
4465
4500
|
method: "POST",
|
|
4466
4501
|
headers: {
|
|
4467
4502
|
"Content-Type": "application/json",
|
|
4468
|
-
...
|
|
4503
|
+
...et.getAuthHeader()
|
|
4469
4504
|
},
|
|
4470
4505
|
body: JSON.stringify({
|
|
4471
4506
|
system_id: "system",
|
|
@@ -4501,7 +4536,7 @@ class uu {
|
|
|
4501
4536
|
method: "POST",
|
|
4502
4537
|
headers: {
|
|
4503
4538
|
"Content-Type": "application/json",
|
|
4504
|
-
...
|
|
4539
|
+
...et.getAuthHeader()
|
|
4505
4540
|
},
|
|
4506
4541
|
body: JSON.stringify({
|
|
4507
4542
|
system_id: "system",
|
|
@@ -4533,7 +4568,7 @@ class uu {
|
|
|
4533
4568
|
method: "POST",
|
|
4534
4569
|
headers: {
|
|
4535
4570
|
"Content-Type": "application/json",
|
|
4536
|
-
...
|
|
4571
|
+
...et.getAuthHeader()
|
|
4537
4572
|
},
|
|
4538
4573
|
body: JSON.stringify({
|
|
4539
4574
|
system_id: "system",
|
|
@@ -4563,7 +4598,7 @@ class uu {
|
|
|
4563
4598
|
method: "POST",
|
|
4564
4599
|
headers: {
|
|
4565
4600
|
"Content-Type": "application/json",
|
|
4566
|
-
...
|
|
4601
|
+
...et.getAuthHeader()
|
|
4567
4602
|
},
|
|
4568
4603
|
body: JSON.stringify({
|
|
4569
4604
|
system_id: "system",
|
|
@@ -4594,7 +4629,7 @@ class uu {
|
|
|
4594
4629
|
method: "POST",
|
|
4595
4630
|
headers: {
|
|
4596
4631
|
"Content-Type": "application/json",
|
|
4597
|
-
...
|
|
4632
|
+
...et.getAuthHeader()
|
|
4598
4633
|
},
|
|
4599
4634
|
body: JSON.stringify({
|
|
4600
4635
|
system_id: "system",
|
|
@@ -4607,10 +4642,10 @@ class uu {
|
|
|
4607
4642
|
})
|
|
4608
4643
|
})).json();
|
|
4609
4644
|
if (s.success && s.result) {
|
|
4610
|
-
const i =
|
|
4645
|
+
const i = et.getUser();
|
|
4611
4646
|
if (i && (i._id === e || i.id === e)) {
|
|
4612
4647
|
const o = { ...i, ...t };
|
|
4613
|
-
|
|
4648
|
+
et.setUser(o);
|
|
4614
4649
|
}
|
|
4615
4650
|
return { success: !0 };
|
|
4616
4651
|
}
|
|
@@ -4633,7 +4668,7 @@ class uu {
|
|
|
4633
4668
|
method: "POST",
|
|
4634
4669
|
headers: {
|
|
4635
4670
|
"Content-Type": "application/json",
|
|
4636
|
-
...
|
|
4671
|
+
...et.getAuthHeader()
|
|
4637
4672
|
},
|
|
4638
4673
|
body: JSON.stringify({
|
|
4639
4674
|
system_id: "system",
|
|
@@ -4698,7 +4733,7 @@ class Kd {
|
|
|
4698
4733
|
params: o
|
|
4699
4734
|
} = t, l = `${this.config.baseUrl}/${e}${this.buildQueryString(o)}`, a = {
|
|
4700
4735
|
...this.config.headers,
|
|
4701
|
-
...
|
|
4736
|
+
...et.getAuthHeader(),
|
|
4702
4737
|
...s
|
|
4703
4738
|
}, u = {
|
|
4704
4739
|
method: n,
|
|
@@ -5405,7 +5440,7 @@ function A2({ apiUrl: r, systemId: e, children: t }) {
|
|
|
5405
5440
|
const k = await d.isAdmin(E);
|
|
5406
5441
|
a(k);
|
|
5407
5442
|
}, [d]), p = re(() => {
|
|
5408
|
-
const E =
|
|
5443
|
+
const E = et.getToken(), k = et.getUser();
|
|
5409
5444
|
E && k ? (o(E), s(k), f(k._id).finally(() => c(!1))) : c(!1);
|
|
5410
5445
|
}, [f]);
|
|
5411
5446
|
_e(() => {
|
|
@@ -7956,9 +7991,9 @@ function Lu(r) {
|
|
|
7956
7991
|
return r._pendingDecorators = t, t;
|
|
7957
7992
|
}
|
|
7958
7993
|
function Fa(r) {
|
|
7959
|
-
return r.read(() =>
|
|
7994
|
+
return r.read(() => tt().getTextContent());
|
|
7960
7995
|
}
|
|
7961
|
-
function
|
|
7996
|
+
function tt() {
|
|
7962
7997
|
return Pu(fr());
|
|
7963
7998
|
}
|
|
7964
7999
|
function Pu(r) {
|
|
@@ -8079,7 +8114,7 @@ function za(r, e, t) {
|
|
|
8079
8114
|
return r.toLowerCase() === "a" && kn(e, t);
|
|
8080
8115
|
}
|
|
8081
8116
|
function Zf() {
|
|
8082
|
-
const r =
|
|
8117
|
+
const r = tt();
|
|
8083
8118
|
Zt(ju(r.select(0, r.getChildrenSize())));
|
|
8084
8119
|
}
|
|
8085
8120
|
function Mn(r, e) {
|
|
@@ -8668,7 +8703,7 @@ const ir = Object.freeze({}), co = 30, fo = [["keydown", function(r, e) {
|
|
|
8668
8703
|
if (n) {
|
|
8669
8704
|
if (Y(t)) {
|
|
8670
8705
|
const i = t.anchor, o = i.getNode();
|
|
8671
|
-
i.type === "element" && i.offset === 0 && t.isCollapsed() && !_t(o) &&
|
|
8706
|
+
i.type === "element" && i.offset === 0 && t.isCollapsed() && !_t(o) && tt().getChildrenSize() === 1 && o.getTopLevelElementOrThrow().isEmpty() && s !== null && t.is(s) ? (n.removeAllRanges(), t.dirty = !0) : r.detail === 3 && !t.isCollapsed() && o !== t.focus.getNode() && (P(o) ? o.select(0) : o.getParentOrThrow().select(0));
|
|
8672
8707
|
} else if (r.pointerType === "touch") {
|
|
8673
8708
|
const i = n.anchorNode;
|
|
8674
8709
|
if (i !== null) {
|
|
@@ -8810,7 +8845,7 @@ function Ha(r, e, t) {
|
|
|
8810
8845
|
const a = l.anchor, u = a.getNode();
|
|
8811
8846
|
if (l.isCollapsed()) {
|
|
8812
8847
|
r.type === "Range" && r.anchorNode === r.focusNode && (l.dirty = !0);
|
|
8813
|
-
const c = yi(e).event, d = c ? c.timeStamp : performance.now(), [f, p, g, m, y] = Ju, v =
|
|
8848
|
+
const c = yi(e).event, d = c ? c.timeStamp : performance.now(), [f, p, g, m, y] = Ju, v = tt(), x = e.isComposing() === !1 && v.getTextContent() === "";
|
|
8814
8849
|
if (d < y + 200 && a.offset === g && a.key === m) l.format = f, l.style = p;
|
|
8815
8850
|
else if (a.type === "text") te(u) || X(141), l.format = u.getFormat(), l.style = u.getStyle();
|
|
8816
8851
|
else if (a.type === "element" && !x) {
|
|
@@ -10126,7 +10161,7 @@ class Sr {
|
|
|
10126
10161
|
insertParagraph() {
|
|
10127
10162
|
if (this.anchor.key === "root") {
|
|
10128
10163
|
const o = ut();
|
|
10129
|
-
return
|
|
10164
|
+
return tt().splice(this.anchor.offset, 0, [o]), o.select(), o;
|
|
10130
10165
|
}
|
|
10131
10166
|
const e = Vi(this), t = bn(this.anchor.getNode(), gr);
|
|
10132
10167
|
P(t) || X(213);
|
|
@@ -10535,7 +10570,7 @@ function vh(r, e, t, n, s, i, o) {
|
|
|
10535
10570
|
}
|
|
10536
10571
|
function ac(r) {
|
|
10537
10572
|
let e = ce() || ss();
|
|
10538
|
-
e === null && (e =
|
|
10573
|
+
e === null && (e = tt().selectEnd()), e.insertNodes(r);
|
|
10539
10574
|
}
|
|
10540
10575
|
function Vi(r) {
|
|
10541
10576
|
let e = r;
|
|
@@ -10551,7 +10586,7 @@ function _h(r, e) {
|
|
|
10551
10586
|
const t = r.getParent();
|
|
10552
10587
|
if (!t) {
|
|
10553
10588
|
const s = ut();
|
|
10554
|
-
return
|
|
10589
|
+
return tt().append(s), s.select(), [tt(), 0];
|
|
10555
10590
|
}
|
|
10556
10591
|
if (te(r)) {
|
|
10557
10592
|
const s = r.splitText(e);
|
|
@@ -11326,7 +11361,7 @@ class os extends hr {
|
|
|
11326
11361
|
return super.append(...e);
|
|
11327
11362
|
}
|
|
11328
11363
|
static importJSON(e) {
|
|
11329
|
-
const t =
|
|
11364
|
+
const t = tt();
|
|
11330
11365
|
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
|
|
11331
11366
|
}
|
|
11332
11367
|
exportJSON() {
|
|
@@ -11373,7 +11408,7 @@ class _i {
|
|
|
11373
11408
|
return t._readOnly = !0, t;
|
|
11374
11409
|
}
|
|
11375
11410
|
toJSON() {
|
|
11376
|
-
return ll(null, this, () => ({ root: pc(
|
|
11411
|
+
return ll(null, this, () => ({ root: pc(tt()) }));
|
|
11377
11412
|
}
|
|
11378
11413
|
}
|
|
11379
11414
|
class aa extends hr {
|
|
@@ -11596,7 +11631,7 @@ class wi {
|
|
|
11596
11631
|
return o = this, l = e.getType(), Bt(o, () => {
|
|
11597
11632
|
const a = fr();
|
|
11598
11633
|
if (a.isEmpty()) return;
|
|
11599
|
-
if (l === "root") return void
|
|
11634
|
+
if (l === "root") return void tt().markDirty();
|
|
11600
11635
|
const u = a._nodeMap;
|
|
11601
11636
|
for (const [, c] of u) c.markDirty();
|
|
11602
11637
|
}, o._pendingEditorState === null ? { tag: "history-merge" } : void 0), () => {
|
|
@@ -11708,7 +11743,7 @@ class wi {
|
|
|
11708
11743
|
focus(e, t = {}) {
|
|
11709
11744
|
const n = this._rootElement;
|
|
11710
11745
|
n !== null && (n.setAttribute("autocapitalize", "off"), Bt(this, () => {
|
|
11711
|
-
const s = ce(), i =
|
|
11746
|
+
const s = ce(), i = tt();
|
|
11712
11747
|
s !== null ? s.dirty = !0 : i.getChildrenSize() !== 0 && (t.defaultSelection === "rootStart" ? i.selectStart() : i.selectEnd());
|
|
11713
11748
|
}, { onUpdate: () => {
|
|
11714
11749
|
n.removeAttribute("autocapitalize"), e && e();
|
|
@@ -11738,7 +11773,7 @@ function Ah({ initialConfig: r, children: e }) {
|
|
|
11738
11773
|
return function(d, f) {
|
|
11739
11774
|
if (f !== null) {
|
|
11740
11775
|
if (f === void 0) d.update(() => {
|
|
11741
|
-
const p =
|
|
11776
|
+
const p = tt();
|
|
11742
11777
|
if (p.isEmpty()) {
|
|
11743
11778
|
const g = ut();
|
|
11744
11779
|
p.append(g);
|
|
@@ -11757,7 +11792,7 @@ function Ah({ initialConfig: r, children: e }) {
|
|
|
11757
11792
|
break;
|
|
11758
11793
|
case "function":
|
|
11759
11794
|
d.update(() => {
|
|
11760
|
-
|
|
11795
|
+
tt().isEmpty() && f(d);
|
|
11761
11796
|
}, ys);
|
|
11762
11797
|
}
|
|
11763
11798
|
}
|
|
@@ -11784,7 +11819,7 @@ function Bh() {
|
|
|
11784
11819
|
}(Nh);
|
|
11785
11820
|
}
|
|
11786
11821
|
function jh() {
|
|
11787
|
-
return
|
|
11822
|
+
return tt().getTextContent();
|
|
11788
11823
|
}
|
|
11789
11824
|
function Mh(r, e = !0) {
|
|
11790
11825
|
if (r) return !1;
|
|
@@ -11793,7 +11828,7 @@ function Mh(r, e = !0) {
|
|
|
11793
11828
|
}
|
|
11794
11829
|
function Fh(r) {
|
|
11795
11830
|
if (!Mh(r, !1)) return !1;
|
|
11796
|
-
const e =
|
|
11831
|
+
const e = tt().getChildren(), t = e.length;
|
|
11797
11832
|
if (t > 1) return !1;
|
|
11798
11833
|
for (let n = 0; n < t; n++) {
|
|
11799
11834
|
const s = e[n];
|
|
@@ -11861,7 +11896,7 @@ function $h(r, e) {
|
|
|
11861
11896
|
if (r === null) return;
|
|
11862
11897
|
const t = r.getStartEndPoints(), n = t ? t[0] : null;
|
|
11863
11898
|
if (n !== null && n.key === "root") {
|
|
11864
|
-
const o = e(), l =
|
|
11899
|
+
const o = e(), l = tt(), a = l.getFirstChild();
|
|
11865
11900
|
return void (a ? a.replace(o, !0) : l.append(o));
|
|
11866
11901
|
}
|
|
11867
11902
|
const s = r.getNodes(), i = n !== null && function(o, l) {
|
|
@@ -11942,7 +11977,7 @@ function Kh(r) {
|
|
|
11942
11977
|
}
|
|
11943
11978
|
const Ci = (r, e) => {
|
|
11944
11979
|
let t = r;
|
|
11945
|
-
for (; t !==
|
|
11980
|
+
for (; t !== tt() && t != null; ) {
|
|
11946
11981
|
if (e(t)) return t;
|
|
11947
11982
|
t = t.getParent();
|
|
11948
11983
|
}
|
|
@@ -12014,7 +12049,7 @@ function wc(r, e) {
|
|
|
12014
12049
|
}
|
|
12015
12050
|
function Cc(r, e) {
|
|
12016
12051
|
if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
|
|
12017
|
-
const t = document.createElement("div"), n =
|
|
12052
|
+
const t = document.createElement("div"), n = tt().getChildren();
|
|
12018
12053
|
for (let s = 0; s < n.length; s++)
|
|
12019
12054
|
Sc(r, n[s], t, e);
|
|
12020
12055
|
return t.innerHTML;
|
|
@@ -12174,7 +12209,7 @@ function Dc(r, e, t, n = []) {
|
|
|
12174
12209
|
return s;
|
|
12175
12210
|
}
|
|
12176
12211
|
function ep(r, e) {
|
|
12177
|
-
const t = [], n =
|
|
12212
|
+
const t = [], n = tt().getChildren();
|
|
12178
12213
|
for (let s = 0; s < n.length; s++)
|
|
12179
12214
|
Dc(r, e, n[s], t);
|
|
12180
12215
|
return { namespace: r._config.namespace, nodes: t };
|
|
@@ -12478,7 +12513,7 @@ function dp(r) {
|
|
|
12478
12513
|
} else if (Y(t)) {
|
|
12479
12514
|
if (function(s) {
|
|
12480
12515
|
const i = s.focus;
|
|
12481
|
-
return i.key === "root" && i.offset ===
|
|
12516
|
+
return i.key === "root" && i.offset === tt().getChildrenSize();
|
|
12482
12517
|
}(t)) return e.preventDefault(), !0;
|
|
12483
12518
|
const n = qn(t.focus, !1);
|
|
12484
12519
|
if (!e.shiftKey && Ge(n) && !n.isIsolated() && !n.isInline()) return n.selectNext(), e.preventDefault(), !0;
|
|
@@ -14109,7 +14144,7 @@ var Or;
|
|
|
14109
14144
|
if (!l)
|
|
14110
14145
|
throw new Error("Assertion error");
|
|
14111
14146
|
}
|
|
14112
|
-
const i = class
|
|
14147
|
+
const i = class rt {
|
|
14113
14148
|
/*-- Constructor (low level) and fields --*/
|
|
14114
14149
|
// Creates a new QR Code segment with the given attributes and data.
|
|
14115
14150
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
@@ -14127,36 +14162,36 @@ var Or;
|
|
|
14127
14162
|
let u = [];
|
|
14128
14163
|
for (const c of a)
|
|
14129
14164
|
t(c, 8, u);
|
|
14130
|
-
return new
|
|
14165
|
+
return new rt(rt.Mode.BYTE, a.length, u);
|
|
14131
14166
|
}
|
|
14132
14167
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
14133
14168
|
static makeNumeric(a) {
|
|
14134
|
-
if (!
|
|
14169
|
+
if (!rt.isNumeric(a))
|
|
14135
14170
|
throw new RangeError("String contains non-numeric characters");
|
|
14136
14171
|
let u = [];
|
|
14137
14172
|
for (let c = 0; c < a.length; ) {
|
|
14138
14173
|
const d = Math.min(a.length - c, 3);
|
|
14139
14174
|
t(parseInt(a.substring(c, c + d), 10), d * 3 + 1, u), c += d;
|
|
14140
14175
|
}
|
|
14141
|
-
return new
|
|
14176
|
+
return new rt(rt.Mode.NUMERIC, a.length, u);
|
|
14142
14177
|
}
|
|
14143
14178
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
14144
14179
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
14145
14180
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
14146
14181
|
static makeAlphanumeric(a) {
|
|
14147
|
-
if (!
|
|
14182
|
+
if (!rt.isAlphanumeric(a))
|
|
14148
14183
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
14149
14184
|
let u = [], c;
|
|
14150
14185
|
for (c = 0; c + 2 <= a.length; c += 2) {
|
|
14151
|
-
let d =
|
|
14152
|
-
d +=
|
|
14186
|
+
let d = rt.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c)) * 45;
|
|
14187
|
+
d += rt.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c + 1)), t(d, 11, u);
|
|
14153
14188
|
}
|
|
14154
|
-
return c < a.length && t(
|
|
14189
|
+
return c < a.length && t(rt.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c)), 6, u), new rt(rt.Mode.ALPHANUMERIC, a.length, u);
|
|
14155
14190
|
}
|
|
14156
14191
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
14157
14192
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
14158
14193
|
static makeSegments(a) {
|
|
14159
|
-
return a == "" ? [] :
|
|
14194
|
+
return a == "" ? [] : rt.isNumeric(a) ? [rt.makeNumeric(a)] : rt.isAlphanumeric(a) ? [rt.makeAlphanumeric(a)] : [rt.makeBytes(rt.toUtf8ByteArray(a))];
|
|
14160
14195
|
}
|
|
14161
14196
|
// Returns a segment representing an Extended Channel Interpretation
|
|
14162
14197
|
// (ECI) designator with the given assignment value.
|
|
@@ -14172,18 +14207,18 @@ var Or;
|
|
|
14172
14207
|
t(6, 3, u), t(a, 21, u);
|
|
14173
14208
|
else
|
|
14174
14209
|
throw new RangeError("ECI assignment value out of range");
|
|
14175
|
-
return new
|
|
14210
|
+
return new rt(rt.Mode.ECI, 0, u);
|
|
14176
14211
|
}
|
|
14177
14212
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
14178
14213
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
14179
14214
|
static isNumeric(a) {
|
|
14180
|
-
return
|
|
14215
|
+
return rt.NUMERIC_REGEX.test(a);
|
|
14181
14216
|
}
|
|
14182
14217
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
14183
14218
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
14184
14219
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
14185
14220
|
static isAlphanumeric(a) {
|
|
14186
|
-
return
|
|
14221
|
+
return rt.ALPHANUMERIC_REGEX.test(a);
|
|
14187
14222
|
}
|
|
14188
14223
|
/*-- Methods --*/
|
|
14189
14224
|
// Returns a new copy of the data bits of this segment.
|
|
@@ -14942,7 +14977,7 @@ function ug({ html: r, isExternalUpdate: e, onImportComplete: t }) {
|
|
|
14942
14977
|
return _e(() => {
|
|
14943
14978
|
r && (s.current && !e || (s.current = !0, n.update(
|
|
14944
14979
|
() => {
|
|
14945
|
-
const i =
|
|
14980
|
+
const i = tt();
|
|
14946
14981
|
i.clear();
|
|
14947
14982
|
const o = ut();
|
|
14948
14983
|
i.append(o), o.select();
|
|
@@ -14966,7 +15001,7 @@ function cg({ text: r, trigger: e }) {
|
|
|
14966
15001
|
if (Y(i))
|
|
14967
15002
|
i.insertText(s);
|
|
14968
15003
|
else {
|
|
14969
|
-
const o =
|
|
15004
|
+
const o = tt(), l = o.getLastChild();
|
|
14970
15005
|
if (l) {
|
|
14971
15006
|
l.selectEnd();
|
|
14972
15007
|
const a = ce();
|
|
@@ -21100,7 +21135,7 @@ export {
|
|
|
21100
21135
|
Dg as AudioEditor,
|
|
21101
21136
|
of as AuthFlow,
|
|
21102
21137
|
B2 as AuthFlowModal,
|
|
21103
|
-
|
|
21138
|
+
et as AuthManager,
|
|
21104
21139
|
A2 as AuthProvider,
|
|
21105
21140
|
uu as AuthService,
|
|
21106
21141
|
F2 as Card,
|
package/package.json
CHANGED