sa-spell-checker 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -0
- package/dist/sa-spell-checker.mjs +173 -159
- package/dist/sa-spell-checker.umd.js +49 -38
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# SA Spell Checker
|
|
2
|
+
|
|
3
|
+
A custom spell-checker web component for SuperAnnotate's labeling interface.
|
|
4
|
+
Powered by [nspell](https://github.com/wooorm/nspell) + Hunspell dictionaries.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **P0** — Red squiggle underline on misspelled words
|
|
11
|
+
- **P1** — Toggle spell check on/off
|
|
12
|
+
- **P2** — Language switching (English US/UK, French, German, Spanish, Korean)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Usage in SuperAnnotate
|
|
17
|
+
|
|
18
|
+
Paste `spell_checker.html` into SA's web component editor:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<!DOCTYPE html>
|
|
22
|
+
<html lang="en">
|
|
23
|
+
<head>
|
|
24
|
+
<meta charset="UTF-8" />
|
|
25
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/sa-spell-checker@1.0.4/dist/sa-spell-checker.mjs"></script>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<sa-spell-checker placeholder="Type here..." rows="4"></sa-spell-checker>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Local Development
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install
|
|
39
|
+
npm run dev # starts localhost dev server with hot-reload
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Build & Publish to CDN
|
|
45
|
+
|
|
46
|
+
### 1. Bump version in `package.json`
|
|
47
|
+
```json
|
|
48
|
+
"version": "1.0.5"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Build
|
|
52
|
+
```bash
|
|
53
|
+
npm run build
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Generate npm token (one-time setup)
|
|
57
|
+
|
|
58
|
+
1. Go to **npmjs.com** → profile → **Access Tokens**
|
|
59
|
+
2. **Generate New Token → Granular Access Token**
|
|
60
|
+
3. Settings:
|
|
61
|
+
- ✅ **Bypass two-factor authentication (2FA)** — check this
|
|
62
|
+
- **Packages and scopes → Permissions**: `Read and write`
|
|
63
|
+
- **Select packages**: `All packages`
|
|
64
|
+
- **Organizations**: leave as `No access` (do not touch)
|
|
65
|
+
4. Click **Generate Token** → copy the token
|
|
66
|
+
|
|
67
|
+
### 4. Publish
|
|
68
|
+
```bash
|
|
69
|
+
bash publish.sh YOUR_NPM_TOKEN
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 5. Update version in `spell_checker.html`
|
|
73
|
+
```html
|
|
74
|
+
src="https://cdn.jsdelivr.net/npm/sa-spell-checker@1.0.5/dist/sa-spell-checker.mjs"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Project Structure
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Spell-Checker/
|
|
83
|
+
├── src/
|
|
84
|
+
│ ├── spell-checker.ts — Lit component (logic + template)
|
|
85
|
+
│ ├── spell-checker.css — styles
|
|
86
|
+
│ └── spellcheck.ts — nspell dictionary loading & word checking
|
|
87
|
+
├── dist/ — built output (published to npm)
|
|
88
|
+
├── spell_checker.html — paste this into SA
|
|
89
|
+
├── index.html — local dev test page
|
|
90
|
+
├── package.json
|
|
91
|
+
├── vite.config.js
|
|
92
|
+
├── tsconfig.json
|
|
93
|
+
├── publish.sh
|
|
94
|
+
└── BENEFITS.md — why this approach
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Tech Stack
|
|
100
|
+
|
|
101
|
+
| Tool | Role |
|
|
102
|
+
|------|------|
|
|
103
|
+
| [Lit](https://lit.dev) | Web Component framework |
|
|
104
|
+
| [TypeScript](https://typescriptlang.org) | Type safety |
|
|
105
|
+
| [Vite](https://vitejs.dev) | Bundler |
|
|
106
|
+
| [nspell](https://github.com/wooorm/nspell) | Spell checking engine |
|
|
107
|
+
| [jsDelivr](https://jsdelivr.com) | Free CDN (serves from npm) |
|
|
@@ -38,7 +38,7 @@ const Ze = (r) => new ft(typeof r == "string" ? r : r + "", void 0, Xe), gt = (r
|
|
|
38
38
|
* Copyright 2017 Google LLC
|
|
39
39
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
40
|
*/
|
|
41
|
-
const { is: vt, defineProperty: $t, getOwnPropertyDescriptor: _t, getOwnPropertyNames: mt, getOwnPropertySymbols: yt, getPrototypeOf: bt } = Object,
|
|
41
|
+
const { is: vt, defineProperty: $t, getOwnPropertyDescriptor: _t, getOwnPropertyNames: mt, getOwnPropertySymbols: yt, getPrototypeOf: bt } = Object, U = globalThis, Re = U.trustedTypes, At = Re ? Re.emptyScript : "", ce = U.reactiveElementPolyfillSupport, G = (r, e) => r, se = { toAttribute(r, e) {
|
|
42
42
|
switch (e) {
|
|
43
43
|
case Boolean:
|
|
44
44
|
r = r ? At : null;
|
|
@@ -66,8 +66,8 @@ const { is: vt, defineProperty: $t, getOwnPropertyDescriptor: _t, getOwnProperty
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
return t;
|
|
69
|
-
} }, be = (r, e) => !vt(r, e),
|
|
70
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
69
|
+
} }, be = (r, e) => !vt(r, e), ke = { attribute: !0, type: String, converter: se, reflect: !1, useDefault: !1, hasChanged: be };
|
|
70
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), U.litPropertyMetadata ?? (U.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
71
71
|
let j = class extends HTMLElement {
|
|
72
72
|
static addInitializer(e) {
|
|
73
73
|
this._$Ei(), (this.l ?? (this.l = [])).push(e);
|
|
@@ -75,7 +75,7 @@ let j = class extends HTMLElement {
|
|
|
75
75
|
static get observedAttributes() {
|
|
76
76
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
77
77
|
}
|
|
78
|
-
static createProperty(e, t =
|
|
78
|
+
static createProperty(e, t = ke) {
|
|
79
79
|
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
80
80
|
const s = Symbol(), i = this.getPropertyDescriptor(e, s, t);
|
|
81
81
|
i !== void 0 && $t(this.prototype, e, i);
|
|
@@ -93,7 +93,7 @@ let j = class extends HTMLElement {
|
|
|
93
93
|
}, configurable: !0, enumerable: !0 };
|
|
94
94
|
}
|
|
95
95
|
static getPropertyOptions(e) {
|
|
96
|
-
return this.elementProperties.get(e) ??
|
|
96
|
+
return this.elementProperties.get(e) ?? ke;
|
|
97
97
|
}
|
|
98
98
|
static _$Ei() {
|
|
99
99
|
if (this.hasOwnProperty(G("elementProperties"))) return;
|
|
@@ -187,8 +187,8 @@ let j = class extends HTMLElement {
|
|
|
187
187
|
if (i !== void 0 && this._$Em !== i) {
|
|
188
188
|
const h = s.getPropertyOptions(i), a = typeof h.converter == "function" ? { fromAttribute: h.converter } : ((n = h.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? h.converter : se;
|
|
189
189
|
this._$Em = i;
|
|
190
|
-
const
|
|
191
|
-
this[i] =
|
|
190
|
+
const p = a.fromAttribute(t, h.type);
|
|
191
|
+
this[i] = p ?? ((o = this._$Ej) == null ? void 0 : o.get(i)) ?? p, this._$Em = null;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
requestUpdate(e, t, s, i = !1, n) {
|
|
@@ -271,28 +271,28 @@ let j = class extends HTMLElement {
|
|
|
271
271
|
firstUpdated(e) {
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
|
-
j.elementStyles = [], j.shadowRootOptions = { mode: "open" }, j[G("elementProperties")] = /* @__PURE__ */ new Map(), j[G("finalized")] = /* @__PURE__ */ new Map(), ce == null || ce({ ReactiveElement: j }), (
|
|
274
|
+
j.elementStyles = [], j.shadowRootOptions = { mode: "open" }, j[G("elementProperties")] = /* @__PURE__ */ new Map(), j[G("finalized")] = /* @__PURE__ */ new Map(), ce == null || ce({ ReactiveElement: j }), (U.reactiveElementVersions ?? (U.reactiveElementVersions = [])).push("2.1.2");
|
|
275
275
|
/**
|
|
276
276
|
* @license
|
|
277
277
|
* Copyright 2017 Google LLC
|
|
278
278
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
279
279
|
*/
|
|
280
|
-
const Y = globalThis,
|
|
281
|
-
\f\r]`, W = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
282
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
280
|
+
const Y = globalThis, Ne = (r) => r, ie = Y.trustedTypes, Te = ie ? ie.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Je = "$lit$", T = `lit$${Math.random().toFixed(9).slice(2)}$`, Qe = "?" + T, wt = `<${Qe}>`, I = document, V = () => I.createComment(""), X = (r) => r === null || typeof r != "object" && typeof r != "function", Ae = Array.isArray, xt = (r) => Ae(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", pe = `[
|
|
281
|
+
\f\r]`, W = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ue = /-->/g, Pe = />/g, D = RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^
|
|
282
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Me = /'/g, De = /"/g, et = /^(?:script|style|textarea|title)$/i, Et = (r) => (e, ...t) => ({ _$litType$: r, strings: e, values: t }), de = Et(1), P = Symbol.for("lit-noChange"), $ = Symbol.for("lit-nothing"), Le = /* @__PURE__ */ new WeakMap(), L = I.createTreeWalker(I, 129);
|
|
283
283
|
function tt(r, e) {
|
|
284
284
|
if (!Ae(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
285
|
-
return
|
|
285
|
+
return Te !== void 0 ? Te.createHTML(e) : e;
|
|
286
286
|
}
|
|
287
|
-
const
|
|
287
|
+
const Ct = (r, e) => {
|
|
288
288
|
const t = r.length - 1, s = [];
|
|
289
289
|
let i, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = W;
|
|
290
290
|
for (let h = 0; h < t; h++) {
|
|
291
291
|
const a = r[h];
|
|
292
|
-
let
|
|
293
|
-
for (; u < a.length && (o.lastIndex = u, l = o.exec(a), l !== null); ) u = o.lastIndex, o === W ? l[1] === "!--" ? o =
|
|
294
|
-
const
|
|
295
|
-
n += o === W ? a + wt : c >= 0 ? (s.push(
|
|
292
|
+
let p, l, c = -1, u = 0;
|
|
293
|
+
for (; u < a.length && (o.lastIndex = u, l = o.exec(a), l !== null); ) u = o.lastIndex, o === W ? l[1] === "!--" ? o = Ue : l[1] !== void 0 ? o = Pe : l[2] !== void 0 ? (et.test(l[2]) && (i = RegExp("</" + l[2], "g")), o = D) : l[3] !== void 0 && (o = D) : o === D ? l[0] === ">" ? (o = i ?? W, c = -1) : l[1] === void 0 ? c = -2 : (c = o.lastIndex - l[2].length, p = l[1], o = l[3] === void 0 ? D : l[3] === '"' ? De : Me) : o === De || o === Me ? o = D : o === Ue || o === Pe ? o = W : (o = D, i = void 0);
|
|
294
|
+
const d = o === D && r[h + 1].startsWith("/>") ? " " : "";
|
|
295
|
+
n += o === W ? a + wt : c >= 0 ? (s.push(p), a.slice(0, c) + Je + a.slice(c) + T + d) : a + T + (c === -2 ? h : d);
|
|
296
296
|
}
|
|
297
297
|
return [tt(r, n + (r[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
298
298
|
};
|
|
@@ -301,29 +301,29 @@ class Z {
|
|
|
301
301
|
let i;
|
|
302
302
|
this.parts = [];
|
|
303
303
|
let n = 0, o = 0;
|
|
304
|
-
const h = e.length - 1, a = this.parts, [
|
|
305
|
-
if (this.el = Z.createElement(
|
|
304
|
+
const h = e.length - 1, a = this.parts, [p, l] = Ct(e, t);
|
|
305
|
+
if (this.el = Z.createElement(p, s), L.currentNode = this.el.content, t === 2 || t === 3) {
|
|
306
306
|
const c = this.el.content.firstChild;
|
|
307
307
|
c.replaceWith(...c.childNodes);
|
|
308
308
|
}
|
|
309
309
|
for (; (i = L.nextNode()) !== null && a.length < h; ) {
|
|
310
310
|
if (i.nodeType === 1) {
|
|
311
311
|
if (i.hasAttributes()) for (const c of i.getAttributeNames()) if (c.endsWith(Je)) {
|
|
312
|
-
const u = l[o++],
|
|
313
|
-
a.push({ type: 1, index: n, name: f[2], strings:
|
|
314
|
-
} else c.startsWith(
|
|
312
|
+
const u = l[o++], d = i.getAttribute(c).split(T), f = /([.?@])?(.*)/.exec(u);
|
|
313
|
+
a.push({ type: 1, index: n, name: f[2], strings: d, ctor: f[1] === "." ? St : f[1] === "?" ? Rt : f[1] === "@" ? kt : oe }), i.removeAttribute(c);
|
|
314
|
+
} else c.startsWith(T) && (a.push({ type: 6, index: n }), i.removeAttribute(c));
|
|
315
315
|
if (et.test(i.tagName)) {
|
|
316
|
-
const c = i.textContent.split(
|
|
316
|
+
const c = i.textContent.split(T), u = c.length - 1;
|
|
317
317
|
if (u > 0) {
|
|
318
318
|
i.textContent = ie ? ie.emptyScript : "";
|
|
319
|
-
for (let
|
|
319
|
+
for (let d = 0; d < u; d++) i.append(c[d], V()), L.nextNode(), a.push({ type: 2, index: ++n });
|
|
320
320
|
i.append(c[u], V());
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
} else if (i.nodeType === 8) if (i.data === Qe) a.push({ type: 2, index: n });
|
|
324
324
|
else {
|
|
325
325
|
let c = -1;
|
|
326
|
-
for (; (c = i.data.indexOf(
|
|
326
|
+
for (; (c = i.data.indexOf(T, c + 1)) !== -1; ) a.push({ type: 7, index: n }), c += T.length - 1;
|
|
327
327
|
}
|
|
328
328
|
n++;
|
|
329
329
|
}
|
|
@@ -335,7 +335,7 @@ class Z {
|
|
|
335
335
|
}
|
|
336
336
|
function B(r, e, t = r, s) {
|
|
337
337
|
var o, h;
|
|
338
|
-
if (e ===
|
|
338
|
+
if (e === P) return e;
|
|
339
339
|
let i = s !== void 0 ? (o = t._$Co) == null ? void 0 : o[s] : t._$Cl;
|
|
340
340
|
const n = X(e) ? void 0 : e._$litDirective$;
|
|
341
341
|
return (i == null ? void 0 : i.constructor) !== n && ((h = i == null ? void 0 : i._$AO) == null || h.call(i, !1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, t, s)), s !== void 0 ? (t._$Co ?? (t._$Co = []))[s] = i : t._$Cl = i), i !== void 0 && (e = B(r, i._$AS(r, e.values), i, s)), e;
|
|
@@ -356,8 +356,8 @@ class Ot {
|
|
|
356
356
|
let n = L.nextNode(), o = 0, h = 0, a = s[0];
|
|
357
357
|
for (; a !== void 0; ) {
|
|
358
358
|
if (o === a.index) {
|
|
359
|
-
let
|
|
360
|
-
a.type === 2 ?
|
|
359
|
+
let p;
|
|
360
|
+
a.type === 2 ? p = new J(n, n.nextSibling, this, e) : a.type === 1 ? p = new a.ctor(n, a.name, a.strings, this, e) : a.type === 6 && (p = new Nt(n, this, e)), this._$AV.push(p), a = s[++h];
|
|
361
361
|
}
|
|
362
362
|
o !== (a == null ? void 0 : a.index) && (n = L.nextNode(), o++);
|
|
363
363
|
}
|
|
@@ -388,7 +388,7 @@ class J {
|
|
|
388
388
|
return this._$AB;
|
|
389
389
|
}
|
|
390
390
|
_$AI(e, t = this) {
|
|
391
|
-
e = B(this, e, t), X(e) ? e === $ || e == null || e === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : e !== this._$AH && e !==
|
|
391
|
+
e = B(this, e, t), X(e) ? e === $ || e == null || e === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : e !== this._$AH && e !== P && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : xt(e) ? this.k(e) : this._(e);
|
|
392
392
|
}
|
|
393
393
|
O(e) {
|
|
394
394
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -422,8 +422,8 @@ class J {
|
|
|
422
422
|
_$AR(e = this._$AA.nextSibling, t) {
|
|
423
423
|
var s;
|
|
424
424
|
for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, t); e !== this._$AB; ) {
|
|
425
|
-
const i =
|
|
426
|
-
|
|
425
|
+
const i = Ne(e).nextSibling;
|
|
426
|
+
Ne(e).remove(), e = i;
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
setConnected(e) {
|
|
@@ -444,11 +444,11 @@ class oe {
|
|
|
444
444
|
_$AI(e, t = this, s, i) {
|
|
445
445
|
const n = this.strings;
|
|
446
446
|
let o = !1;
|
|
447
|
-
if (n === void 0) e = B(this, e, t, 0), o = !X(e) || e !== this._$AH && e !==
|
|
447
|
+
if (n === void 0) e = B(this, e, t, 0), o = !X(e) || e !== this._$AH && e !== P, o && (this._$AH = e);
|
|
448
448
|
else {
|
|
449
449
|
const h = e;
|
|
450
|
-
let a,
|
|
451
|
-
for (e = n[0], a = 0; a < n.length - 1; a++)
|
|
450
|
+
let a, p;
|
|
451
|
+
for (e = n[0], a = 0; a < n.length - 1; a++) p = B(this, h[s + a], t, a), p === P && (p = this._$AH[a]), o || (o = !X(p) || p !== this._$AH[a]), p === $ ? e = $ : e !== $ && (e += (p ?? "") + n[a + 1]), this._$AH[a] = p;
|
|
452
452
|
}
|
|
453
453
|
o && !i && this.j(e);
|
|
454
454
|
}
|
|
@@ -472,12 +472,12 @@ class Rt extends oe {
|
|
|
472
472
|
this.element.toggleAttribute(this.name, !!e && e !== $);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
class
|
|
475
|
+
class kt extends oe {
|
|
476
476
|
constructor(e, t, s, i, n) {
|
|
477
477
|
super(e, t, s, i, n), this.type = 5;
|
|
478
478
|
}
|
|
479
479
|
_$AI(e, t = this) {
|
|
480
|
-
if ((e = B(this, e, t, 0) ?? $) ===
|
|
480
|
+
if ((e = B(this, e, t, 0) ?? $) === P) return;
|
|
481
481
|
const s = this._$AH, i = e === $ && s !== $ || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, n = e !== $ && (s === $ || i);
|
|
482
482
|
i && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
483
483
|
}
|
|
@@ -486,7 +486,7 @@ class Nt extends oe {
|
|
|
486
486
|
typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e);
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
class
|
|
489
|
+
class Nt {
|
|
490
490
|
constructor(e, t, s) {
|
|
491
491
|
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
492
492
|
}
|
|
@@ -499,7 +499,7 @@ class Ut {
|
|
|
499
499
|
}
|
|
500
500
|
const ue = Y.litHtmlPolyfillSupport;
|
|
501
501
|
ue == null || ue(Z, J), (Y.litHtmlVersions ?? (Y.litHtmlVersions = [])).push("3.3.2");
|
|
502
|
-
const
|
|
502
|
+
const Tt = (r, e, t) => {
|
|
503
503
|
const s = (t == null ? void 0 : t.renderBefore) ?? e;
|
|
504
504
|
let i = s._$litPart$;
|
|
505
505
|
if (i === void 0) {
|
|
@@ -525,7 +525,7 @@ let q = class extends j {
|
|
|
525
525
|
}
|
|
526
526
|
update(e) {
|
|
527
527
|
const t = this.render();
|
|
528
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do =
|
|
528
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Tt(t, this.renderRoot, this.renderOptions);
|
|
529
529
|
}
|
|
530
530
|
connectedCallback() {
|
|
531
531
|
var e;
|
|
@@ -536,7 +536,7 @@ let q = class extends j {
|
|
|
536
536
|
super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
|
|
537
537
|
}
|
|
538
538
|
render() {
|
|
539
|
-
return
|
|
539
|
+
return P;
|
|
540
540
|
}
|
|
541
541
|
};
|
|
542
542
|
var Ve;
|
|
@@ -549,7 +549,7 @@ fe == null || fe({ LitElement: q });
|
|
|
549
549
|
* Copyright 2017 Google LLC
|
|
550
550
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
551
551
|
*/
|
|
552
|
-
const
|
|
552
|
+
const Ut = (r) => (e, t) => {
|
|
553
553
|
t !== void 0 ? t.addInitializer(() => {
|
|
554
554
|
customElements.define(r, e);
|
|
555
555
|
}) : customElements.define(r, e);
|
|
@@ -559,7 +559,7 @@ const Tt = (r) => (e, t) => {
|
|
|
559
559
|
* Copyright 2017 Google LLC
|
|
560
560
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
561
561
|
*/
|
|
562
|
-
const
|
|
562
|
+
const Pt = { attribute: !0, type: String, converter: se, reflect: !1, hasChanged: be }, Mt = (r = Pt, e, t) => {
|
|
563
563
|
const { kind: s, metadata: i } = t;
|
|
564
564
|
let n = globalThis.litPropertyMetadata.get(i);
|
|
565
565
|
if (n === void 0 && globalThis.litPropertyMetadata.set(i, n = /* @__PURE__ */ new Map()), s === "setter" && ((r = Object.create(r)).wrapped = !0), n.set(t.name, r), s === "accessor") {
|
|
@@ -581,7 +581,7 @@ const Mt = { attribute: !0, type: String, converter: se, reflect: !1, hasChanged
|
|
|
581
581
|
throw Error("Unsupported decorator location: " + s);
|
|
582
582
|
};
|
|
583
583
|
function F(r) {
|
|
584
|
-
return (e, t) => typeof t == "object" ?
|
|
584
|
+
return (e, t) => typeof t == "object" ? Mt(r, e, t) : ((s, i, n) => {
|
|
585
585
|
const o = i.hasOwnProperty(n);
|
|
586
586
|
return i.constructor.createProperty(n, s), o ? Object.getOwnPropertyDescriptor(i, n) : void 0;
|
|
587
587
|
})(r, e, t);
|
|
@@ -649,7 +649,7 @@ let $e = class extends nt {
|
|
|
649
649
|
}
|
|
650
650
|
render(e) {
|
|
651
651
|
if (e === $ || e == null) return this._t = void 0, this.it = e;
|
|
652
|
-
if (e ===
|
|
652
|
+
if (e === P) return e;
|
|
653
653
|
if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
654
654
|
if (e === this.it) return this._t;
|
|
655
655
|
this.it = e;
|
|
@@ -685,9 +685,9 @@ const Ht = it(class extends nt {
|
|
|
685
685
|
const o = !!e[n];
|
|
686
686
|
o === this.st.has(n) || (i = this.nt) != null && i.has(n) || (o ? (t.add(n), this.st.add(n)) : (t.remove(n), this.st.delete(n)));
|
|
687
687
|
}
|
|
688
|
-
return
|
|
688
|
+
return P;
|
|
689
689
|
}
|
|
690
|
-
}), It =
|
|
690
|
+
}), It = `:host{display:block;width:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.controls{display:flex;gap:16px;align-items:center;margin-bottom:8px;flex-wrap:wrap}.control-group{display:flex;align-items:center;gap:8px}.control-label{font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:#6b7280}.toggle-track{position:relative;display:inline-flex;align-items:center;width:36px;height:20px;border-radius:10px;background:#e5e7eb;cursor:pointer;border:none;padding:0;transition:background .2s;flex-shrink:0}.toggle-track.on{background:#76b900}.toggle-thumb{position:absolute;left:3px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;transition:transform .2s}.toggle-track.on .toggle-thumb{transform:translate(16px)}.toggle-label{font-size:12px;font-weight:600;color:#374151;min-width:24px}select{font-size:12px;font-family:inherit;padding:4px 24px 4px 8px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;color:#374151;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;-moz-appearance:none;appearance:none;-webkit-appearance:none;transition:border-color .15s}select:hover{border-color:#d1d5db}select:focus{outline:none;border-color:#76b900}.editor-wrapper{position:relative;background:#fff;border:1.5px solid #e5e7eb;border-left:3px solid #76b900;border-radius:8px;transition:border-color .15s,box-shadow .15s}.editor-wrapper:focus-within{border-color:#d1d5db;border-left-color:#76b900;box-shadow:0 1px 6px #0000000f}.highlight-layer,textarea{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:13.5px;line-height:1.6;padding:10px 14px;width:100%;box-sizing:border-box;white-space:pre-wrap;word-break:break-word;overflow-wrap:break-word}.highlight-layer{position:absolute;top:0;left:0;height:100%;color:transparent;pointer-events:none;overflow:hidden;border:none;background:transparent;border-radius:8px;margin:0}.highlight-layer mark{background:transparent;color:transparent;text-decoration:underline wavy #ef4444}textarea{position:relative;display:block;min-height:88px;outline:none;background:transparent;color:#111827;caret-color:#111827;border:none;border-radius:8px;resize:vertical;margin:0}textarea::placeholder{color:#c4c9d4}.loading-hint{font-size:11px;color:#9ca3af;margin-top:5px;display:flex;align-items:center;gap:5px}.loading-dot{width:5px;height:5px;border-radius:50%;background:#76b900;animation:pulse 1s infinite}@keyframes pulse{0%,to{opacity:.3}50%{opacity:1}}`;
|
|
691
691
|
function zt(r) {
|
|
692
692
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
693
693
|
}
|
|
@@ -737,28 +737,28 @@ var Wt = ot, Kt = qt, Gt = [].push, ee = "etaoinshrdlcumwfgypbvkjxqz".split(""),
|
|
|
737
737
|
"lkm"
|
|
738
738
|
];
|
|
739
739
|
function qt(r) {
|
|
740
|
-
var e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), s = /* @__PURE__ */ Object.create(null), i = [], n = { in: [], out: [] }, o = [], h = r.toString("utf8"), a = [],
|
|
741
|
-
`), c, u,
|
|
740
|
+
var e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), s = /* @__PURE__ */ Object.create(null), i = [], n = { in: [], out: [] }, o = [], h = r.toString("utf8"), a = [], p = 0, l = h.indexOf(`
|
|
741
|
+
`), c, u, d, f, m, w, b, A, S, v, E, g, C;
|
|
742
742
|
for (s.KEY = []; l > -1; )
|
|
743
|
-
y(h.slice(
|
|
744
|
-
`,
|
|
745
|
-
for (y(h.slice(
|
|
746
|
-
if (u = a[l], c = u.split(K),
|
|
743
|
+
y(h.slice(p, l)), p = l + 1, l = h.indexOf(`
|
|
744
|
+
`, p);
|
|
745
|
+
for (y(h.slice(p)), l = -1; ++l < a.length; )
|
|
746
|
+
if (u = a[l], c = u.split(K), d = c[0], d === "REP") {
|
|
747
747
|
for (f = l + parseInt(c[1], 10); ++l <= f; )
|
|
748
748
|
c = a[l].split(K), i.push([c[1], c[2]]);
|
|
749
749
|
l--;
|
|
750
|
-
} else if (
|
|
751
|
-
for (f = l + parseInt(c[1], 10), A = n[
|
|
750
|
+
} else if (d === "ICONV" || d === "OCONV") {
|
|
751
|
+
for (f = l + parseInt(c[1], 10), A = n[d === "ICONV" ? "in" : "out"]; ++l <= f; )
|
|
752
752
|
c = a[l].split(K), A.push([new RegExp(c[1], "g"), c[2]]);
|
|
753
753
|
l--;
|
|
754
|
-
} else if (
|
|
754
|
+
} else if (d === "COMPOUNDRULE") {
|
|
755
755
|
for (f = l + parseInt(c[1], 10); ++l <= f; )
|
|
756
756
|
for (v = a[l].split(K)[1], S = -1, o.push(v); ++S < v.length; )
|
|
757
757
|
t[v.charAt(S)] = [];
|
|
758
758
|
l--;
|
|
759
|
-
} else if (
|
|
759
|
+
} else if (d === "PFX" || d === "SFX") {
|
|
760
760
|
for (f = l + parseInt(c[3], 10), v = {
|
|
761
|
-
type:
|
|
761
|
+
type: d,
|
|
762
762
|
combineable: c[2] === "Y",
|
|
763
763
|
entries: []
|
|
764
764
|
}, e[c[1]] = v; ++l <= f; ) {
|
|
@@ -769,20 +769,20 @@ function qt(r) {
|
|
|
769
769
|
continuation: Wt(s, w[1])
|
|
770
770
|
}, w && w[0] !== "0" && (A.add = w[0]);
|
|
771
771
|
try {
|
|
772
|
-
m !== "0" && (A.remove =
|
|
772
|
+
m !== "0" && (A.remove = d === "SFX" ? He(m) : m), b && b !== "." && (A.match = d === "SFX" ? He(b) : Vt(b));
|
|
773
773
|
} catch {
|
|
774
774
|
A = null;
|
|
775
775
|
}
|
|
776
776
|
A && v.entries.push(A);
|
|
777
777
|
}
|
|
778
778
|
l--;
|
|
779
|
-
} else if (
|
|
780
|
-
for (b = c[1], g = -1,
|
|
781
|
-
|
|
779
|
+
} else if (d === "TRY") {
|
|
780
|
+
for (b = c[1], g = -1, E = []; ++g < b.length; )
|
|
781
|
+
C = b.charAt(g), C.toLowerCase() === C && E.push(C);
|
|
782
782
|
for (g = -1; ++g < ee.length; )
|
|
783
|
-
b.indexOf(ee[g]) < 0 &&
|
|
784
|
-
s[
|
|
785
|
-
} else
|
|
783
|
+
b.indexOf(ee[g]) < 0 && E.push(ee[g]);
|
|
784
|
+
s[d] = E;
|
|
785
|
+
} else d === "KEY" ? Gt.apply(s[d], c[1].split("|")) : d === "COMPOUNDMIN" ? s[d] = Number(c[1]) : d === "ONLYINCOMPOUND" ? (s[d] = c[1], t[c[1]] = []) : s[d] = c[1];
|
|
786
786
|
return isNaN(s.COMPOUNDMIN) && (s.COMPOUNDMIN = 3), s.KEY.length || (s.KEY = Yt), s.TRY || (s.TRY = ee.concat()), s.KEEPCASE || (s.KEEPCASE = !1), {
|
|
787
787
|
compoundRuleCodes: t,
|
|
788
788
|
replacementTable: i,
|
|
@@ -823,7 +823,7 @@ function er(r, e) {
|
|
|
823
823
|
}
|
|
824
824
|
return !1;
|
|
825
825
|
}
|
|
826
|
-
var tr = at, ge = Qt, _e = ae,
|
|
826
|
+
var tr = at, ge = Qt, _e = ae, xe = rr;
|
|
827
827
|
function rr(r, e, t) {
|
|
828
828
|
var s = e.trim(), i;
|
|
829
829
|
if (!s)
|
|
@@ -847,7 +847,7 @@ function rr(r, e, t) {
|
|
|
847
847
|
function Ie(r, e, t) {
|
|
848
848
|
return _e(r, "KEEPCASE", e) || t || _e(r, "FORBIDDENWORD", e);
|
|
849
849
|
}
|
|
850
|
-
var sr =
|
|
850
|
+
var sr = xe, ir = nr;
|
|
851
851
|
function nr(r) {
|
|
852
852
|
return !!sr(this, r);
|
|
853
853
|
}
|
|
@@ -859,74 +859,74 @@ function ar(r) {
|
|
|
859
859
|
function ze(r) {
|
|
860
860
|
return r === r.toLowerCase() ? "l" : r === r.toUpperCase() ? "u" : null;
|
|
861
861
|
}
|
|
862
|
-
var re = or, je = at, lr = ae, hr =
|
|
863
|
-
function
|
|
864
|
-
var e = this, t = {}, s = [], i = {}, n, o, h = [], a,
|
|
862
|
+
var re = or, je = at, lr = ae, hr = xe, cr = dr, pr = [].push;
|
|
863
|
+
function dr(r) {
|
|
864
|
+
var e = this, t = {}, s = [], i = {}, n, o, h = [], a, p, l, c, u, d, f, m, w, b, A, S, v, E, g, C, y, _, N, z, le, he, Q;
|
|
865
865
|
if (r = je(r.trim(), e.conversion.in), !r || e.correct(r))
|
|
866
866
|
return [];
|
|
867
|
-
for (Q = re(r),
|
|
868
|
-
for (o = e.replacementTable[
|
|
867
|
+
for (Q = re(r), p = -1; ++p < e.replacementTable.length; )
|
|
868
|
+
for (o = e.replacementTable[p], l = r.indexOf(o[0]); l > -1; )
|
|
869
869
|
h.push(r.replace(o[0], o[1])), l = r.indexOf(o[0], l + 1);
|
|
870
|
-
for (
|
|
871
|
-
for (m = r.charAt(
|
|
870
|
+
for (p = -1; ++p < r.length; )
|
|
871
|
+
for (m = r.charAt(p), b = r.slice(0, p), A = r.slice(p + 1), v = m.toLowerCase(), S = v !== m, t = {}, l = -1; ++l < e.flags.KEY.length; )
|
|
872
872
|
if (w = e.flags.KEY[l], c = w.indexOf(v), !(c < 0)) {
|
|
873
|
-
for (
|
|
874
|
-
if (
|
|
875
|
-
if (f = w.charAt(
|
|
873
|
+
for (d = -1; ++d < w.length; )
|
|
874
|
+
if (d !== c) {
|
|
875
|
+
if (f = w.charAt(d), t[f])
|
|
876
876
|
continue;
|
|
877
877
|
t[f] = !0, S && (f = f.toUpperCase()), h.push(b + f + A);
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
|
-
for (
|
|
881
|
-
for (m = y, y = r.charAt(
|
|
880
|
+
for (p = -1, y = r.charAt(0), a = [""], _ = 1, N = 0; ++p < r.length; ) {
|
|
881
|
+
for (m = y, y = r.charAt(p + 1), b = r.slice(0, p), o = m === y ? "" : m + m, l = -1, u = a.length; ++l < u; )
|
|
882
882
|
l <= _ && a.push(a[l] + o), a[l] += m;
|
|
883
|
-
++
|
|
883
|
+
++N < 3 && (_ = a.length);
|
|
884
884
|
}
|
|
885
|
-
for (
|
|
885
|
+
for (pr.apply(h, a), a = [r], o = r.toLowerCase(), (r === o || Q === null) && a.push(r.charAt(0).toUpperCase() + o.slice(1)), o = r.toUpperCase(), r !== o && a.push(o), n = {
|
|
886
886
|
state: {},
|
|
887
887
|
weighted: i,
|
|
888
888
|
suggestions: s
|
|
889
|
-
},
|
|
890
|
-
|
|
891
|
-
for (s.sort(ct), a = [], le = [],
|
|
892
|
-
he = je(s[
|
|
889
|
+
}, E = Be(e, n, a, h), g = 0, _ = Math.min(E.length, Math.pow(Math.max(15 - r.length, 3), 3)), z = Math.max(Math.pow(10 - r.length, 3), 1); !s.length && g < _; )
|
|
890
|
+
C = g + z, Be(e, n, E.slice(g, C)), g = C;
|
|
891
|
+
for (s.sort(ct), a = [], le = [], p = -1; ++p < s.length; )
|
|
892
|
+
he = je(s[p], e.conversion.out), o = he.toLowerCase(), le.indexOf(o) < 0 && (a.push(he), le.push(o));
|
|
893
893
|
return a;
|
|
894
|
-
function ct(R,
|
|
895
|
-
return
|
|
894
|
+
function ct(R, k) {
|
|
895
|
+
return pt(R, k) || dt(R, k) || ut(R, k);
|
|
896
896
|
}
|
|
897
|
-
function
|
|
898
|
-
return i[R] === i[
|
|
897
|
+
function pt(R, k) {
|
|
898
|
+
return i[R] === i[k] ? 0 : i[R] > i[k] ? -1 : 1;
|
|
899
899
|
}
|
|
900
|
-
function
|
|
901
|
-
var
|
|
902
|
-
return
|
|
900
|
+
function dt(R, k) {
|
|
901
|
+
var Ee = re(R), Ce = re(k);
|
|
902
|
+
return Ee === Ce ? 0 : Ee === Q ? -1 : Ce === Q ? 1 : void 0;
|
|
903
903
|
}
|
|
904
|
-
function ut(R,
|
|
905
|
-
return R.localeCompare(
|
|
904
|
+
function ut(R, k) {
|
|
905
|
+
return R.localeCompare(k);
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
908
|
function Be(r, e, t, s) {
|
|
909
|
-
var i = r.flags.TRY, n = r.data, o = r.flags, h = [], a = -1,
|
|
909
|
+
var i = r.flags.TRY, n = r.data, o = r.flags, h = [], a = -1, p, l, c, u, d, f, m, w, b, A, S, v, E;
|
|
910
910
|
if (s)
|
|
911
911
|
for (; ++a < s.length; )
|
|
912
912
|
g(s[a], !0);
|
|
913
913
|
for (a = -1; ++a < t.length; )
|
|
914
|
-
for (
|
|
915
|
-
for (l += c, A =
|
|
916
|
-
l +
|
|
917
|
-
)), g(l +
|
|
918
|
-
v = i[
|
|
914
|
+
for (p = t[a], l = "", c = "", u = p.charAt(0), d = p, f = p.slice(1), m = u.toLowerCase() !== u, w = re(p), b = -1; ++b <= p.length; )
|
|
915
|
+
for (l += c, A = d, d = f, f = d.slice(1), c = u, u = p.charAt(b + 1), S = m, u && (m = u.toLowerCase() !== u), d && S !== m && (g(l + C(d)), g(
|
|
916
|
+
l + C(u) + C(c) + f
|
|
917
|
+
)), g(l + d), d && g(l + u + c + f), E = -1; ++E < i.length; )
|
|
918
|
+
v = i[E], S && v !== v.toUpperCase() ? (w !== "s" && (g(l + v + A), g(l + v + d)), v = v.toUpperCase(), g(l + v + A), g(l + v + d)) : (g(l + v + A), g(l + v + d));
|
|
919
919
|
return h;
|
|
920
920
|
function g(y, _) {
|
|
921
|
-
var
|
|
922
|
-
|
|
921
|
+
var N = e.state[y], z;
|
|
922
|
+
N !== !!N && (h.push(y), z = hr(r, y), N = z && !lr(o, "NOSUGGEST", n[z]), e.state[y] = N, N && (e.weighted[y] = _ ? 10 : 0, e.suggestions.push(y))), N && e.weighted[y]++;
|
|
923
923
|
}
|
|
924
|
-
function
|
|
924
|
+
function C(y) {
|
|
925
925
|
var _ = y.charAt(0);
|
|
926
926
|
return (_.toLowerCase() === _ ? _.toUpperCase() : _.toLowerCase()) + y.slice(1);
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
|
-
var ur =
|
|
929
|
+
var ur = xe, Fe = ae, fr = gr;
|
|
930
930
|
function gr(r) {
|
|
931
931
|
var e = this, t = ur(e, r, !0);
|
|
932
932
|
return {
|
|
@@ -937,10 +937,10 @@ function gr(r) {
|
|
|
937
937
|
}
|
|
938
938
|
var vr = lt;
|
|
939
939
|
function lt(r, e, t, s) {
|
|
940
|
-
for (var i = -1, n, o, h, a,
|
|
941
|
-
if (n = e.entries[i], a = n.continuation,
|
|
942
|
-
for (; ++
|
|
943
|
-
h = t[a[
|
|
940
|
+
for (var i = -1, n, o, h, a, p; ++i < e.entries.length; )
|
|
941
|
+
if (n = e.entries[i], a = n.continuation, p = -1, (!n.match || n.match.test(r)) && (o = n.remove ? r.replace(n.remove, "") : r, o = e.type === "SFX" ? o + n.add : n.add + o, s.push(o), a && a.length))
|
|
942
|
+
for (; ++p < a.length; )
|
|
943
|
+
h = t[a[p]], h && lt(o, h, t, s);
|
|
944
944
|
return s;
|
|
945
945
|
}
|
|
946
946
|
var We = vr, ht = mr, $r = [].push, me = [];
|
|
@@ -949,16 +949,16 @@ function _r(r, e, t) {
|
|
|
949
949
|
e in r ? s === me ? r[e] = t.concat() : $r.apply(s, t) : r[e] = t.concat();
|
|
950
950
|
}
|
|
951
951
|
function mr(r, e, t, s) {
|
|
952
|
-
var i = -1, n, o, h, a,
|
|
952
|
+
var i = -1, n, o, h, a, p, l, c;
|
|
953
953
|
for ((!("NEEDAFFIX" in s.flags) || t.indexOf(s.flags.NEEDAFFIX) < 0) && _r(r, e, t); ++i < t.length; )
|
|
954
954
|
if (n = s.rules[t[i]], t[i] in s.compoundRuleCodes && s.compoundRuleCodes[t[i]].push(e), n) {
|
|
955
955
|
for (l = We(e, n, s.rules, []), o = -1; ++o < l.length; )
|
|
956
956
|
if (l[o] in r || (r[l[o]] = me), n.combineable) {
|
|
957
957
|
for (h = i; ++h < t.length; )
|
|
958
|
-
if (
|
|
958
|
+
if (p = s.rules[t[h]], p && p.combineable && n.type !== p.type)
|
|
959
959
|
for (c = We(
|
|
960
960
|
l[o],
|
|
961
|
-
|
|
961
|
+
p,
|
|
962
962
|
s.rules,
|
|
963
963
|
[]
|
|
964
964
|
), a = -1; ++a < c.length; )
|
|
@@ -971,17 +971,17 @@ function wr(r, e) {
|
|
|
971
971
|
var t = this;
|
|
972
972
|
return yr(t.data, r, t.data[e] || Ar, t), t;
|
|
973
973
|
}
|
|
974
|
-
var
|
|
975
|
-
function
|
|
974
|
+
var xr = Er;
|
|
975
|
+
function Er(r) {
|
|
976
976
|
var e = this;
|
|
977
977
|
return delete e.data[r], e;
|
|
978
978
|
}
|
|
979
|
-
var
|
|
979
|
+
var Cr = Or;
|
|
980
980
|
function Or() {
|
|
981
981
|
return this.flags.WORDCHARS || null;
|
|
982
982
|
}
|
|
983
|
-
var Sr = ot, Rr = ht,
|
|
984
|
-
function
|
|
983
|
+
var Sr = ot, Rr = ht, kr = Nr, Ke = /\s/g;
|
|
984
|
+
function Nr(r, e, t) {
|
|
985
985
|
for (var s = r.toString("utf8"), i = s.indexOf(`
|
|
986
986
|
`) + 1, n = s.indexOf(`
|
|
987
987
|
`, i); n > -1; )
|
|
@@ -994,17 +994,17 @@ function Ge(r, e, t) {
|
|
|
994
994
|
r = r.slice(0, s - 1) + r.slice(s), s = r.indexOf("/", s);
|
|
995
995
|
i > -1 ? s > -1 && s < i ? (o = r.slice(0, s), Ke.lastIndex = s + 1, h = Ke.exec(r), n = r.slice(s + 1, h ? h.index : void 0)) : o = r.slice(0, i) : s > -1 ? (o = r.slice(0, s), n = r.slice(s + 1)) : o = r, o = o.trim(), o && Rr(t, o, Sr(e.flags, n.trim()), e);
|
|
996
996
|
}
|
|
997
|
-
var
|
|
998
|
-
function
|
|
997
|
+
var Tr = kr, Ur = Pr;
|
|
998
|
+
function Pr(r) {
|
|
999
999
|
var e = this, t = -1, s, i, n, o;
|
|
1000
|
-
for (
|
|
1000
|
+
for (Tr(r, e, e.data); ++t < e.compoundRules.length; ) {
|
|
1001
1001
|
for (s = e.compoundRules[t], i = "", o = -1; ++o < s.length; )
|
|
1002
1002
|
n = s.charAt(o), i += e.compoundRuleCodes[n].length ? "(?:" + e.compoundRuleCodes[n].join("|") + ")" : n;
|
|
1003
1003
|
e.compoundRules[t] = new RegExp(i, "i");
|
|
1004
1004
|
}
|
|
1005
1005
|
return e;
|
|
1006
1006
|
}
|
|
1007
|
-
var
|
|
1007
|
+
var Mr = Dr;
|
|
1008
1008
|
function Dr(r) {
|
|
1009
1009
|
var e = this, t = r.toString("utf8").split(`
|
|
1010
1010
|
`), s = -1, i, n, o, h;
|
|
@@ -1012,15 +1012,15 @@ function Dr(r) {
|
|
|
1012
1012
|
i = t[s].trim(), i && (i = i.split("/"), o = i[0], n = o.charAt(0) === "*", n && (o = o.slice(1)), e.add(o, i[1]), n && e.data[o].push(h));
|
|
1013
1013
|
return e;
|
|
1014
1014
|
}
|
|
1015
|
-
var Ye = jt, Lr = Kt, Hr = ne,
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1015
|
+
var Ye = jt, Lr = Kt, Hr = ne, M = ne.prototype;
|
|
1016
|
+
M.correct = ir;
|
|
1017
|
+
M.suggest = cr;
|
|
1018
|
+
M.spell = fr;
|
|
1019
|
+
M.add = br;
|
|
1020
|
+
M.remove = xr;
|
|
1021
|
+
M.wordCharacters = Cr;
|
|
1022
|
+
M.dictionary = Ur;
|
|
1023
|
+
M.personal = Mr;
|
|
1024
1024
|
function ne(r, e) {
|
|
1025
1025
|
var t = -1, s;
|
|
1026
1026
|
if (!(this instanceof ne))
|
|
@@ -1069,7 +1069,7 @@ const Kr = [
|
|
|
1069
1069
|
{ value: "es", label: "Spanish" },
|
|
1070
1070
|
{ value: "ko", label: "Korean" }
|
|
1071
1071
|
];
|
|
1072
|
-
let
|
|
1072
|
+
let x = class extends q {
|
|
1073
1073
|
constructor() {
|
|
1074
1074
|
super(...arguments), this.spellcheck = !0, this.lang = "en-US", this.placeholder = "Type here...", this.value = "", this.rows = 4, this._spellcheckOn = !0, this._loading = !1, this._highlightHTML = `
|
|
1075
1075
|
`, this._checker = null, this._debounceTimer = null;
|
|
@@ -1083,6 +1083,9 @@ let E = class extends q {
|
|
|
1083
1083
|
firstUpdated() {
|
|
1084
1084
|
this._resizeObserver.observe(this._textarea);
|
|
1085
1085
|
}
|
|
1086
|
+
updated(r) {
|
|
1087
|
+
r.has("value") && !this._debounceTimer && this._updateHighlight();
|
|
1088
|
+
}
|
|
1086
1089
|
async _loadDict() {
|
|
1087
1090
|
this._loading = !0;
|
|
1088
1091
|
try {
|
|
@@ -1111,21 +1114,28 @@ let E = class extends q {
|
|
|
1111
1114
|
this.lang = r.target.value, this._loadDict();
|
|
1112
1115
|
}
|
|
1113
1116
|
render() {
|
|
1114
|
-
return
|
|
1117
|
+
return de`
|
|
1115
1118
|
<div class="controls">
|
|
1116
|
-
<
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1119
|
+
<div class="control-group">
|
|
1120
|
+
<span class="control-label">Spellcheck</span>
|
|
1121
|
+
<button
|
|
1122
|
+
class=${Ht({ "toggle-track": !0, on: this._spellcheckOn })}
|
|
1123
|
+
@click=${this._onToggle}
|
|
1124
|
+
title=${this._spellcheckOn ? "Turn off spell check" : "Turn on spell check"}
|
|
1125
|
+
>
|
|
1126
|
+
<span class="toggle-thumb"></span>
|
|
1127
|
+
</button>
|
|
1128
|
+
<span class="toggle-label">${this._spellcheckOn ? "ON" : "OFF"}</span>
|
|
1129
|
+
</div>
|
|
1130
|
+
|
|
1131
|
+
<div class="control-group">
|
|
1132
|
+
<span class="control-label">Language</span>
|
|
1133
|
+
<select @change=${this._onLangChange}>
|
|
1134
|
+
${Kr.map(({ value: r, label: e }) => de`
|
|
1135
|
+
<option value=${r} ?selected=${r === this.lang}>${e}</option>
|
|
1136
|
+
`)}
|
|
1137
|
+
</select>
|
|
1138
|
+
</div>
|
|
1129
1139
|
</div>
|
|
1130
1140
|
|
|
1131
1141
|
<div class="editor-wrapper">
|
|
@@ -1140,44 +1150,48 @@ let E = class extends q {
|
|
|
1140
1150
|
></textarea>
|
|
1141
1151
|
</div>
|
|
1142
1152
|
|
|
1143
|
-
${this._loading ?
|
|
1153
|
+
${this._loading ? de`
|
|
1154
|
+
<p class="loading-hint">
|
|
1155
|
+
<span class="loading-dot"></span>
|
|
1156
|
+
Loading dictionary...
|
|
1157
|
+
</p>` : ""}
|
|
1144
1158
|
`;
|
|
1145
1159
|
}
|
|
1146
1160
|
};
|
|
1147
|
-
|
|
1161
|
+
x.styles = Ze(It);
|
|
1148
1162
|
O([
|
|
1149
1163
|
F({ type: Boolean })
|
|
1150
|
-
],
|
|
1164
|
+
], x.prototype, "spellcheck", 2);
|
|
1151
1165
|
O([
|
|
1152
1166
|
F()
|
|
1153
|
-
],
|
|
1167
|
+
], x.prototype, "lang", 2);
|
|
1154
1168
|
O([
|
|
1155
1169
|
F()
|
|
1156
|
-
],
|
|
1170
|
+
], x.prototype, "placeholder", 2);
|
|
1157
1171
|
O([
|
|
1158
1172
|
F()
|
|
1159
|
-
],
|
|
1173
|
+
], x.prototype, "value", 2);
|
|
1160
1174
|
O([
|
|
1161
1175
|
F({ type: Number })
|
|
1162
|
-
],
|
|
1176
|
+
], x.prototype, "rows", 2);
|
|
1163
1177
|
O([
|
|
1164
1178
|
we()
|
|
1165
|
-
],
|
|
1179
|
+
], x.prototype, "_spellcheckOn", 2);
|
|
1166
1180
|
O([
|
|
1167
1181
|
we()
|
|
1168
|
-
],
|
|
1182
|
+
], x.prototype, "_loading", 2);
|
|
1169
1183
|
O([
|
|
1170
1184
|
we()
|
|
1171
|
-
],
|
|
1185
|
+
], x.prototype, "_highlightHTML", 2);
|
|
1172
1186
|
O([
|
|
1173
1187
|
rt("textarea")
|
|
1174
|
-
],
|
|
1188
|
+
], x.prototype, "_textarea", 2);
|
|
1175
1189
|
O([
|
|
1176
1190
|
rt(".highlight-layer")
|
|
1177
|
-
],
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
],
|
|
1191
|
+
], x.prototype, "_overlay", 2);
|
|
1192
|
+
x = O([
|
|
1193
|
+
Ut("sa-spell-checker")
|
|
1194
|
+
], x);
|
|
1181
1195
|
export {
|
|
1182
|
-
|
|
1196
|
+
x as SaSpellChecker
|
|
1183
1197
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
(function(_,
|
|
1
|
+
(function(_,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(_=typeof globalThis<"u"?globalThis:_||self,N(_.SaSpellChecker={}))})(this,function(_){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var at;const
|
|
5
|
+
*/var at;const N=globalThis,le=N.ShadowRoot&&(N.ShadyCSS===void 0||N.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Se=Symbol(),Ee=new WeakMap;let ct=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==Se)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(le&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ee.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ee.set(t,e))}return e}toString(){return this.cssText}};const xe=r=>new ct(typeof r=="string"?r:r+"",void 0,Se),pt=(r,e)=>{if(le)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=N.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},Oe=le?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return xe(t)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
9
|
+
*/const{is:dt,defineProperty:ut,getOwnPropertyDescriptor:ft,getOwnPropertyNames:gt,getOwnPropertySymbols:vt,getPrototypeOf:$t}=Object,P=globalThis,ke=P.trustedTypes,_t=ke?ke.emptyScript:"",he=P.reactiveElementPolyfillSupport,K=(r,e)=>r,ee={toAttribute(r,e){switch(e){case Boolean:r=r?_t:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},ce=(r,e)=>!dt(r,e),Re={attribute:!0,type:String,converter:ee,reflect:!1,useDefault:!1,hasChanged:ce};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),P.litPropertyMetadata??(P.litPropertyMetadata=new WeakMap);let j=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Re){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&ut(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=ft(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const h=i==null?void 0:i.call(this);n==null||n.call(this,o),this.requestUpdate(e,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Re}static _$Ei(){if(this.hasOwnProperty(K("elementProperties")))return;const e=$t(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(K("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(K("properties"))){const t=this.properties,s=[...gt(t),...vt(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(Oe(i))}else e!==void 0&&t.push(Oe(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return pt(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostConnected)==null?void 0:s.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostDisconnected)==null?void 0:s.call(t)})}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){var n;const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const o=(((n=s.converter)==null?void 0:n.toAttribute)!==void 0?s.converter:ee).toAttribute(t,s.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){var n,o;const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const h=s.getPropertyOptions(i),a=typeof h.converter=="function"?{fromAttribute:h.converter}:((n=h.converter)==null?void 0:n.fromAttribute)!==void 0?h.converter:ee;this._$Em=i;const p=a.fromAttribute(t,h.type);this[i]=p??((o=this._$Ej)==null?void 0:o.get(i))??p,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){var o;if(e!==void 0){const h=this.constructor;if(i===!1&&(n=this[e]),s??(s=h.getPropertyOptions(e)),!((s.hasChanged??ce)(n,t)||s.useDefault&&s.reflect&&n===((o=this._$Ej)==null?void 0:o.get(e))&&!this.hasAttribute(h._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i){const{wrapped:h}=o,a=this[n];h!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,o,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(s=this._$EO)==null||s.forEach(i=>{var n;return(n=i.hostUpdate)==null?void 0:n.call(i)}),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};j.elementStyles=[],j.shadowRootOptions={mode:"open"},j[K("elementProperties")]=new Map,j[K("finalized")]=new Map,he==null||he({ReactiveElement:j}),(P.reactiveElementVersions??(P.reactiveElementVersions=[])).push("2.1.2");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const G=globalThis,
|
|
14
|
-
\f\r]`,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Me=/-->/g,De=/>/g,H=RegExp(`>|${
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Le=/'/g,He=/"/g,Ie=/^(?:script|style|textarea|title)$/i,bt=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ue=bt(1),M=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),ze=new WeakMap,I=L.createTreeWalker(L,129);function je(r,e){if(!
|
|
13
|
+
*/const G=globalThis,Te=r=>r,te=G.trustedTypes,Ne=te?te.createPolicy("lit-html",{createHTML:r=>r}):void 0,Pe="$lit$",U=`lit$${Math.random().toFixed(9).slice(2)}$`,Ue="?"+U,mt=`<${Ue}>`,L=document,Y=()=>L.createComment(""),q=r=>r===null||typeof r!="object"&&typeof r!="function",pe=Array.isArray,yt=r=>pe(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",de=`[
|
|
14
|
+
\f\r]`,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Me=/-->/g,De=/>/g,H=RegExp(`>|${de}(?:([^\\s"'>=/]+)(${de}*=${de}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Le=/'/g,He=/"/g,Ie=/^(?:script|style|textarea|title)$/i,bt=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ue=bt(1),M=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),ze=new WeakMap,I=L.createTreeWalker(L,129);function je(r,e){if(!pe(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ne!==void 0?Ne.createHTML(e):e}const At=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=V;for(let h=0;h<t;h++){const a=r[h];let p,l,c=-1,u=0;for(;u<a.length&&(o.lastIndex=u,l=o.exec(a),l!==null);)u=o.lastIndex,o===V?l[1]==="!--"?o=Me:l[1]!==void 0?o=De:l[2]!==void 0?(Ie.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=H):l[3]!==void 0&&(o=H):o===H?l[0]===">"?(o=i??V,c=-1):l[1]===void 0?c=-2:(c=o.lastIndex-l[2].length,p=l[1],o=l[3]===void 0?H:l[3]==='"'?He:Le):o===He||o===Le?o=H:o===Me||o===De?o=V:(o=H,i=void 0);const d=o===H&&r[h+1].startsWith("/>")?" ":"";n+=o===V?a+mt:c>=0?(s.push(p),a.slice(0,c)+Pe+a.slice(c)+U+d):a+U+(c===-2?h:d)}return[je(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class X{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const h=e.length-1,a=this.parts,[p,l]=At(e,t);if(this.el=X.createElement(p,s),I.currentNode=this.el.content,t===2||t===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=I.nextNode())!==null&&a.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(Pe)){const u=l[o++],d=i.getAttribute(c).split(U),f=/([.?@])?(.*)/.exec(u);a.push({type:1,index:n,name:f[2],strings:d,ctor:f[1]==="."?Ct:f[1]==="?"?St:f[1]==="@"?Et:re}),i.removeAttribute(c)}else c.startsWith(U)&&(a.push({type:6,index:n}),i.removeAttribute(c));if(Ie.test(i.tagName)){const c=i.textContent.split(U),u=c.length-1;if(u>0){i.textContent=te?te.emptyScript:"";for(let d=0;d<u;d++)i.append(c[d],Y()),I.nextNode(),a.push({type:2,index:++n});i.append(c[u],Y())}}}else if(i.nodeType===8)if(i.data===Ue)a.push({type:2,index:n});else{let c=-1;for(;(c=i.data.indexOf(U,c+1))!==-1;)a.push({type:7,index:n}),c+=U.length-1}n++}}static createElement(e,t){const s=L.createElement("template");return s.innerHTML=e,s}}function B(r,e,t=r,s){var o,h;if(e===M)return e;let i=s!==void 0?(o=t._$Co)==null?void 0:o[s]:t._$Cl;const n=q(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==n&&((h=i==null?void 0:i._$AO)==null||h.call(i,!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??(t._$Co=[]))[s]=i:t._$Cl=i),i!==void 0&&(e=B(r,i._$AS(r,e.values),i,s)),e}class wt{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=((e==null?void 0:e.creationScope)??L).importNode(t,!0);I.currentNode=i;let n=I.nextNode(),o=0,h=0,a=s[0];for(;a!==void 0;){if(o===a.index){let p;a.type===2?p=new Z(n,n.nextSibling,this,e):a.type===1?p=new a.ctor(n,a.name,a.strings,this,e):a.type===6&&(p=new xt(n,this,e)),this._$AV.push(p),a=s[++h]}o!==(a==null?void 0:a.index)&&(n=I.nextNode(),o++)}return I.currentNode=L,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class Z{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=$,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=B(this,e,t),q(e)?e===$||e==null||e===""?(this._$AH!==$&&this._$AR(),this._$AH=$):e!==this._$AH&&e!==M&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):yt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==$&&q(this._$AH)?this._$AA.nextSibling.data=e:this.T(L.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=X.createElement(je(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===i)this._$AH.p(t);else{const o=new wt(i,this),h=o.u(this.options);o.p(t),this.T(h),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new X(e)),t}k(e){pe(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new Z(this.O(Y()),this.O(Y()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){const i=Te(e).nextSibling;Te(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class re{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=$,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=$}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=B(this,e,t,0),o=!q(e)||e!==this._$AH&&e!==M,o&&(this._$AH=e);else{const h=e;let a,p;for(e=n[0],a=0;a<n.length-1;a++)p=B(this,h[s+a],t,a),p===M&&(p=this._$AH[a]),o||(o=!q(p)||p!==this._$AH[a]),p===$?e=$:e!==$&&(e+=(p??"")+n[a+1]),this._$AH[a]=p}o&&!i&&this.j(e)}j(e){e===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Ct extends re{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===$?void 0:e}}class St extends re{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==$)}}class Et extends re{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=B(this,e,t,0)??$)===M)return;const s=this._$AH,i=e===$&&s!==$||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==$&&(s===$||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class xt{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){B(this,e)}}const fe=G.litHtmlPolyfillSupport;fe==null||fe(X,Z),(G.litHtmlVersions??(G.litHtmlVersions=[])).push("3.3.2");const Ot=(r,e,t)=>{const s=(t==null?void 0:t.renderBefore)??e;let i=s._$litPart$;if(i===void 0){const n=(t==null?void 0:t.renderBefore)??null;s._$litPart$=i=new Z(e.insertBefore(Y(),n),n,void 0,t??{})}return i._$AI(r),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const z=globalThis;let J=class extends j{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=
|
|
19
|
+
*/const z=globalThis;let J=class extends j{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ot(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return M}};J._$litElement$=!0,J.finalized=!0,(at=z.litElementHydrateSupport)==null||at.call(z,{LitElement:J});const ge=z.litElementPolyfillSupport;ge==null||ge({LitElement:J}),(z.litElementVersions??(z.litElementVersions=[])).push("4.2.2");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const kt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const Rt={attribute:!0,type:String,converter:ee,reflect:!1,hasChanged:ce},Tt=(r=Rt,e,t)=>{const{kind:s,metadata:i}=t;let n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),s==="setter"&&((r=Object.create(r)).wrapped=!0),n.set(t.name,r),s==="accessor"){const{name:o}=t;return{set(h){const a=e.get.call(this);e.set.call(this,h),this.requestUpdate(o,a,r,!0,h)},init(h){return h!==void 0&&this.C(o,void 0,r,h),h}}}if(s==="setter"){const{name:o}=t;return function(h){const a=this[o];e.call(this,h),this.requestUpdate(o,a,r,!0,h)}}throw Error("Unsupported decorator location: "+s)};function F(r){return(e,t)=>typeof t=="object"?Tt(r,e,t):((s,i,n)=>{const o=i.hasOwnProperty(n);return i.constructor.createProperty(n,s),o?Object.getOwnPropertyDescriptor(i,n):void 0})(r,e,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2017 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
-
*/const
|
|
35
|
+
*/const Nt=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2017 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
-
*/function Be(r,e){return(t,i
|
|
39
|
+
*/function Be(r,e){return(t,s,i)=>{const n=o=>{var h;return((h=o.renderRoot)==null?void 0:h.querySelector(r))??null};return Nt(t,s,{get(){return n(this)}})}}/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/const Fe={ATTRIBUTE:1,CHILD:2},We=r=>(...e)=>({_$litDirective$:r,values:e});class Ke{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,
|
|
43
|
+
*/const Fe={ATTRIBUTE:1,CHILD:2},We=r=>(...e)=>({_$litDirective$:r,values:e});class Ke{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -48,35 +48,42 @@
|
|
|
48
48
|
* @license
|
|
49
49
|
* Copyright 2018 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
-
*/const Ut=We(class extends Ke{constructor(r){var e;if(super(r),r.type!==Fe.ATTRIBUTE||r.name!=="class"||((e=r.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var i
|
|
51
|
+
*/const Ut=We(class extends Ke{constructor(r){var e;if(super(r),r.type!==Fe.ATTRIBUTE||r.name!=="class"||((e=r.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var s,i;if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in e)e[n]&&!((s=this.nt)!=null&&s.has(n))&&this.st.add(n);return this.render(e)}const t=r.element.classList;for(const n of this.st)n in e||(t.remove(n),this.st.delete(n));for(const n in e){const o=!!e[n];o===this.st.has(n)||(i=this.nt)!=null&&i.has(n)||(o?(t.add(n),this.st.add(n)):(t.remove(n),this.st.delete(n)))}return M}}),Mt=`:host{display:block;width:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.controls{display:flex;gap:16px;align-items:center;margin-bottom:8px;flex-wrap:wrap}.control-group{display:flex;align-items:center;gap:8px}.control-label{font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:#6b7280}.toggle-track{position:relative;display:inline-flex;align-items:center;width:36px;height:20px;border-radius:10px;background:#e5e7eb;cursor:pointer;border:none;padding:0;transition:background .2s;flex-shrink:0}.toggle-track.on{background:#76b900}.toggle-thumb{position:absolute;left:3px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;transition:transform .2s}.toggle-track.on .toggle-thumb{transform:translate(16px)}.toggle-label{font-size:12px;font-weight:600;color:#374151;min-width:24px}select{font-size:12px;font-family:inherit;padding:4px 24px 4px 8px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;color:#374151;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;-moz-appearance:none;appearance:none;-webkit-appearance:none;transition:border-color .15s}select:hover{border-color:#d1d5db}select:focus{outline:none;border-color:#76b900}.editor-wrapper{position:relative;background:#fff;border:1.5px solid #e5e7eb;border-left:3px solid #76b900;border-radius:8px;transition:border-color .15s,box-shadow .15s}.editor-wrapper:focus-within{border-color:#d1d5db;border-left-color:#76b900;box-shadow:0 1px 6px #0000000f}.highlight-layer,textarea{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:13.5px;line-height:1.6;padding:10px 14px;width:100%;box-sizing:border-box;white-space:pre-wrap;word-break:break-word;overflow-wrap:break-word}.highlight-layer{position:absolute;top:0;left:0;height:100%;color:transparent;pointer-events:none;overflow:hidden;border:none;background:transparent;border-radius:8px;margin:0}.highlight-layer mark{background:transparent;color:transparent;text-decoration:underline wavy #ef4444}textarea{position:relative;display:block;min-height:88px;outline:none;background:transparent;color:#111827;caret-color:#111827;border:none;border-radius:8px;resize:vertical;margin:0}textarea::placeholder{color:#c4c9d4}.loading-hint{font-size:11px;color:#9ca3af;margin-top:5px;display:flex;align-items:center;gap:5px}.loading-dot{width:5px;height:5px;border-radius:50%;background:#76b900;animation:pulse 1s infinite}@keyframes pulse{0%,to{opacity:.3}50%{opacity:1}}`;function Dt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}/*!
|
|
52
52
|
* Determine if an object is a Buffer
|
|
53
53
|
*
|
|
54
54
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
55
55
|
* @license MIT
|
|
56
|
-
*/var Lt=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},Ge=It,Ht=[];function It(r,e){var t=0,
|
|
57
|
-
`),c,u,
|
|
58
|
-
`,
|
|
59
|
-
`)+1,n=
|
|
60
|
-
`,
|
|
61
|
-
`,
|
|
62
|
-
`),
|
|
63
|
-
`:
|
|
64
|
-
`}var Ir=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,
|
|
65
|
-
`,this._checker=null,this._debounceTimer=null}connectedCallback(){super.connectedCallback(),this._spellcheckOn=this.spellcheck,this._resizeObserver=new ResizeObserver(()=>this._syncScroll()),this._loadDict()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect()}firstUpdated(){this._resizeObserver.observe(this._textarea)}async _loadDict(){this._loading=!0;try{this._checker=await Lr(this.lang),this._updateHighlight()}finally{this._loading=!1}}_updateHighlight(){this._highlightHTML=Hr(this.value,this._checker,this._spellcheckOn)}_syncScroll(){this._overlay&&this._textarea&&(this._overlay.scrollTop=this._textarea.scrollTop)}_onInput(e){this.value=e.target.value,this._syncScroll(),this.dispatchEvent(new CustomEvent("sa-change",{detail:{value:this.value},bubbles:!0,composed:!0})),this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateHighlight(),400)}_onToggle(){this._spellcheckOn=!this._spellcheckOn,this._updateHighlight()}_onLangChange(e){this.lang=e.target.value,this._loadDict()}render(){return ue`
|
|
56
|
+
*/var Lt=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},Ge=It,Ht=[];function It(r,e){var t=0,s;if(!e)return Ht;if(r.FLAG==="long"){for(s=new Array(Math.ceil(e.length/2));t<e.length;)s[t/2]=e.slice(t,t+2),t+=2;return s}return e.split(r.FLAG==="num"?",":"")}var zt=Ge,jt=Wt,Bt=[].push,se="etaoinshrdlcumwfgypbvkjxqz".split(""),Q=/\s+/,Ft=["qwertzuop","yxcvbnm","qaw","say","wse","dsx","sy","edr","fdc","dx","rft","gfv","fc","tgz","hgb","gv","zhu","jhn","hb","uji","kjm","jn","iko","lkm"];function Wt(r){var e=Object.create(null),t=Object.create(null),s=Object.create(null),i=[],n={in:[],out:[]},o=[],h=r.toString("utf8"),a=[],p=0,l=h.indexOf(`
|
|
57
|
+
`),c,u,d,f,y,C,A,w,O,v,S,g,E;for(s.KEY=[];l>-1;)b(h.slice(p,l)),p=l+1,l=h.indexOf(`
|
|
58
|
+
`,p);for(b(h.slice(p)),l=-1;++l<a.length;)if(u=a[l],c=u.split(Q),d=c[0],d==="REP"){for(f=l+parseInt(c[1],10);++l<=f;)c=a[l].split(Q),i.push([c[1],c[2]]);l--}else if(d==="ICONV"||d==="OCONV"){for(f=l+parseInt(c[1],10),w=n[d==="ICONV"?"in":"out"];++l<=f;)c=a[l].split(Q),w.push([new RegExp(c[1],"g"),c[2]]);l--}else if(d==="COMPOUNDRULE"){for(f=l+parseInt(c[1],10);++l<=f;)for(v=a[l].split(Q)[1],O=-1,o.push(v);++O<v.length;)t[v.charAt(O)]=[];l--}else if(d==="PFX"||d==="SFX"){for(f=l+parseInt(c[3],10),v={type:d,combineable:c[2]==="Y",entries:[]},e[c[1]]=v;++l<=f;){c=a[l].split(Q),y=c[2],C=c[3].split("/"),A=c[4],w={add:"",remove:"",match:"",continuation:zt(s,C[1])},C&&C[0]!=="0"&&(w.add=C[0]);try{y!=="0"&&(w.remove=d==="SFX"?Ye(y):y),A&&A!=="."&&(w.match=d==="SFX"?Ye(A):Kt(A))}catch{w=null}w&&v.entries.push(w)}l--}else if(d==="TRY"){for(A=c[1],g=-1,S=[];++g<A.length;)E=A.charAt(g),E.toLowerCase()===E&&S.push(E);for(g=-1;++g<se.length;)A.indexOf(se[g])<0&&S.push(se[g]);s[d]=S}else d==="KEY"?Bt.apply(s[d],c[1].split("|")):d==="COMPOUNDMIN"?s[d]=Number(c[1]):d==="ONLYINCOMPOUND"?(s[d]=c[1],t[c[1]]=[]):s[d]=c[1];return isNaN(s.COMPOUNDMIN)&&(s.COMPOUNDMIN=3),s.KEY.length||(s.KEY=Ft),s.TRY||(s.TRY=se.concat()),s.KEEPCASE||(s.KEEPCASE=!1),{compoundRuleCodes:t,replacementTable:i,conversion:n,compoundRules:o,rules:e,flags:s};function b(m){m=m.trim(),m&&m.charCodeAt(0)!==35&&a.push(m)}}function Ye(r){return new RegExp(r+"$")}function Kt(r){return new RegExp("^"+r)}var qe=Gt;function Gt(r,e){for(var t=-1;++t<e.length;)r=r.replace(e[t][0],e[t][1]);return r}var ie=Yt;function Yt(r,e,t){return t&&e in r&&t.indexOf(r[e])>-1}var qt=ie,Vt=Xt;function Xt(r,e){var t=-1;if(r.data[e])return!qt(r.flags,"ONLYINCOMPOUND",r.data[e]);if(e.length>=r.flags.COMPOUNDMIN){for(;++t<r.compoundRules.length;)if(r.compoundRules[t].test(e))return!0}return!1}var Zt=qe,_e=Vt,me=ie,ye=Jt;function Jt(r,e,t){var s=e.trim(),i;if(!s)return null;if(s=Zt(s,r.conversion.in),_e(r,s))return!t&&me(r.flags,"FORBIDDENWORD",r.data[s])?null:s;if(s.toUpperCase()===s){if(i=s.charAt(0)+s.slice(1).toLowerCase(),Ve(r.flags,r.data[i],t))return null;if(_e(r,i))return i}if(i=s.toLowerCase(),i!==s){if(Ve(r.flags,r.data[i],t))return null;if(_e(r,i))return i}return null}function Ve(r,e,t){return me(r,"KEEPCASE",e)||t||me(r,"FORBIDDENWORD",e)}var Qt=ye,er=tr;function tr(r){return!!Qt(this,r)}var rr=sr;function sr(r){var e=Xe(r.charAt(0)),t=r.slice(1);return!t||(t=Xe(t),e===t)?e:e==="u"&&t==="l"?"s":null}function Xe(r){return r===r.toLowerCase()?"l":r===r.toUpperCase()?"u":null}var ne=rr,Ze=qe,ir=ie,nr=ye,or=lr,ar=[].push;function lr(r){var e=this,t={},s=[],i={},n,o,h=[],a,p,l,c,u,d,f,y,C,A,w,O,v,S,g,E,b,m,T,W,we,Ce,ae;if(r=Ze(r.trim(),e.conversion.in),!r||e.correct(r))return[];for(ae=ne(r),p=-1;++p<e.replacementTable.length;)for(o=e.replacementTable[p],l=r.indexOf(o[0]);l>-1;)h.push(r.replace(o[0],o[1])),l=r.indexOf(o[0],l+1);for(p=-1;++p<r.length;)for(y=r.charAt(p),A=r.slice(0,p),w=r.slice(p+1),v=y.toLowerCase(),O=v!==y,t={},l=-1;++l<e.flags.KEY.length;)if(C=e.flags.KEY[l],c=C.indexOf(v),!(c<0)){for(d=-1;++d<C.length;)if(d!==c){if(f=C.charAt(d),t[f])continue;t[f]=!0,O&&(f=f.toUpperCase()),h.push(A+f+w)}}for(p=-1,b=r.charAt(0),a=[""],m=1,T=0;++p<r.length;){for(y=b,b=r.charAt(p+1),A=r.slice(0,p),o=y===b?"":y+y,l=-1,u=a.length;++l<u;)l<=m&&a.push(a[l]+o),a[l]+=y;++T<3&&(m=a.length)}for(ar.apply(h,a),a=[r],o=r.toLowerCase(),(r===o||ae===null)&&a.push(r.charAt(0).toUpperCase()+o.slice(1)),o=r.toUpperCase(),r!==o&&a.push(o),n={state:{},weighted:i,suggestions:s},S=Je(e,n,a,h),g=0,m=Math.min(S.length,Math.pow(Math.max(15-r.length,3),3)),W=Math.max(Math.pow(10-r.length,3),1);!s.length&&g<m;)E=g+W,Je(e,n,S.slice(g,E)),g=E;for(s.sort(Br),a=[],we=[],p=-1;++p<s.length;)Ce=Ze(s[p],e.conversion.out),o=Ce.toLowerCase(),we.indexOf(o)<0&&(a.push(Ce),we.push(o));return a;function Br(k,R){return Fr(k,R)||Wr(k,R)||Kr(k,R)}function Fr(k,R){return i[k]===i[R]?0:i[k]>i[R]?-1:1}function Wr(k,R){var lt=ne(k),ht=ne(R);return lt===ht?0:lt===ae?-1:ht===ae?1:void 0}function Kr(k,R){return k.localeCompare(R)}}function Je(r,e,t,s){var i=r.flags.TRY,n=r.data,o=r.flags,h=[],a=-1,p,l,c,u,d,f,y,C,A,w,O,v,S;if(s)for(;++a<s.length;)g(s[a],!0);for(a=-1;++a<t.length;)for(p=t[a],l="",c="",u=p.charAt(0),d=p,f=p.slice(1),y=u.toLowerCase()!==u,C=ne(p),A=-1;++A<=p.length;)for(l+=c,w=d,d=f,f=d.slice(1),c=u,u=p.charAt(A+1),O=y,u&&(y=u.toLowerCase()!==u),d&&O!==y&&(g(l+E(d)),g(l+E(u)+E(c)+f)),g(l+d),d&&g(l+u+c+f),S=-1;++S<i.length;)v=i[S],O&&v!==v.toUpperCase()?(C!=="s"&&(g(l+v+w),g(l+v+d)),v=v.toUpperCase(),g(l+v+w),g(l+v+d)):(g(l+v+w),g(l+v+d));return h;function g(b,m){var T=e.state[b],W;T!==!!T&&(h.push(b),W=nr(r,b),T=W&&!ir(o,"NOSUGGEST",n[W]),e.state[b]=T,T&&(e.weighted[b]=m?10:0,e.suggestions.push(b))),T&&e.weighted[b]++}function E(b){var m=b.charAt(0);return(m.toLowerCase()===m?m.toUpperCase():m.toLowerCase())+b.slice(1)}}var hr=ye,Qe=ie,cr=pr;function pr(r){var e=this,t=hr(e,r,!0);return{correct:e.correct(r),forbidden:!!(t&&Qe(e.flags,"FORBIDDENWORD",e.data[t])),warn:!!(t&&Qe(e.flags,"WARN",e.data[t]))}}var dr=et;function et(r,e,t,s){for(var i=-1,n,o,h,a,p;++i<e.entries.length;)if(n=e.entries[i],a=n.continuation,p=-1,(!n.match||n.match.test(r))&&(o=n.remove?r.replace(n.remove,""):r,o=e.type==="SFX"?o+n.add:n.add+o,s.push(o),a&&a.length))for(;++p<a.length;)h=t[a[p]],h&&et(o,h,t,s);return s}var tt=dr,rt=gr,ur=[].push,be=[];function fr(r,e,t){var s=r[e];e in r?s===be?r[e]=t.concat():ur.apply(s,t):r[e]=t.concat()}function gr(r,e,t,s){var i=-1,n,o,h,a,p,l,c;for((!("NEEDAFFIX"in s.flags)||t.indexOf(s.flags.NEEDAFFIX)<0)&&fr(r,e,t);++i<t.length;)if(n=s.rules[t[i]],t[i]in s.compoundRuleCodes&&s.compoundRuleCodes[t[i]].push(e),n){for(l=tt(e,n,s.rules,[]),o=-1;++o<l.length;)if(l[o]in r||(r[l[o]]=be),n.combineable){for(h=i;++h<t.length;)if(p=s.rules[t[h]],p&&p.combineable&&n.type!==p.type)for(c=tt(l[o],p,s.rules,[]),a=-1;++a<c.length;)c[a]in r||(r[c[a]]=be)}}}var vr=rt,$r=mr,_r=[];function mr(r,e){var t=this;return vr(t.data,r,t.data[e]||_r,t),t}var yr=br;function br(r){var e=this;return delete e.data[r],e}var Ar=wr;function wr(){return this.flags.WORDCHARS||null}var Cr=Ge,Sr=rt,Er=xr,st=/\s/g;function xr(r,e,t){for(var s=r.toString("utf8"),i=s.indexOf(`
|
|
59
|
+
`)+1,n=s.indexOf(`
|
|
60
|
+
`,i);n>-1;)s.charCodeAt(i)!==9&&it(s.slice(i,n),e,t),i=n+1,n=s.indexOf(`
|
|
61
|
+
`,i);it(s.slice(i),e,t)}function it(r,e,t){for(var s=r.indexOf("/"),i=r.indexOf("#"),n="",o,h;s>-1&&r.charCodeAt(s-1)===92;)r=r.slice(0,s-1)+r.slice(s),s=r.indexOf("/",s);i>-1?s>-1&&s<i?(o=r.slice(0,s),st.lastIndex=s+1,h=st.exec(r),n=r.slice(s+1,h?h.index:void 0)):o=r.slice(0,i):s>-1?(o=r.slice(0,s),n=r.slice(s+1)):o=r,o=o.trim(),o&&Sr(t,o,Cr(e.flags,n.trim()),e)}var Or=Er,kr=Rr;function Rr(r){var e=this,t=-1,s,i,n,o;for(Or(r,e,e.data);++t<e.compoundRules.length;){for(s=e.compoundRules[t],i="",o=-1;++o<s.length;)n=s.charAt(o),i+=e.compoundRuleCodes[n].length?"(?:"+e.compoundRuleCodes[n].join("|")+")":n;e.compoundRules[t]=new RegExp(i,"i")}return e}var Tr=Nr;function Nr(r){var e=this,t=r.toString("utf8").split(`
|
|
62
|
+
`),s=-1,i,n,o,h;for(e.flags.FORBIDDENWORD===void 0&&(e.flags.FORBIDDENWORD=!1),h=e.flags.FORBIDDENWORD;++s<t.length;)i=t[s].trim(),i&&(i=i.split("/"),o=i[0],n=o.charAt(0)==="*",n&&(o=o.slice(1)),e.add(o,i[1]),n&&e.data[o].push(h));return e}var nt=Lt,Pr=jt,Ur=oe,D=oe.prototype;D.correct=er,D.suggest=or,D.spell=cr,D.add=$r,D.remove=yr,D.wordCharacters=Ar,D.dictionary=kr,D.personal=Tr;function oe(r,e){var t=-1,s;if(!(this instanceof oe))return new oe(r,e);if(typeof r=="string"||nt(r)?(typeof e=="string"||nt(e))&&(s=[{dic:e}]):r&&("length"in r?(s=r,r=r[0]&&r[0].aff):(r.dic&&(s=[r]),r=r.aff)),!r)throw new Error("Missing `aff` in dictionary");if(r=Pr(r),this.data=Object.create(null),this.compoundRuleCodes=r.compoundRuleCodes,this.replacementTable=r.replacementTable,this.conversion=r.conversion,this.compoundRules=r.compoundRules,this.rules=r.rules,this.flags=r.flags,s)for(;++t<s.length;)s[t].dic&&this.dictionary(s[t].dic)}const Mr=Dt(Ur),ot="https://cdn.jsdelivr.net/npm",Dr={"en-US":"dictionary-en","en-GB":"dictionary-en-gb",fr:"dictionary-fr",de:"dictionary-de",es:"dictionary-es",ko:"dictionary-ko"},Ae=new Map;async function Lr(r){if(Ae.has(r))return Ae.get(r);const e=Dr[r]??"dictionary-en",[t,s]=await Promise.all([fetch(`${ot}/${e}/index.aff`).then(n=>n.text()),fetch(`${ot}/${e}/index.dic`).then(n=>n.text())]),i=Mr({aff:t,dic:s});return Ae.set(r,i),i}function Hr(r,e,t){const s=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return!e||!t?s+`
|
|
63
|
+
`:s.replace(/[a-zA-ZÀ-ÿ\u3131-\uD79D][a-zA-ZÀ-ÿ\u3131-\uD79D'']*/g,n=>{const o=n.replace(/^'+|'+$/g,"");return!o||e.correct(o)?n:`<mark>${n}</mark>`})+`
|
|
64
|
+
`}var Ir=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,x=(r,e,t,s)=>{for(var i=s>1?void 0:s?zr(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&Ir(e,t,i),i};const jr=[{value:"en-US",label:"English (US)"},{value:"en-GB",label:"English (UK)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"ko",label:"Korean"}];_.SaSpellChecker=class extends J{constructor(){super(...arguments),this.spellcheck=!0,this.lang="en-US",this.placeholder="Type here...",this.value="",this.rows=4,this._spellcheckOn=!0,this._loading=!1,this._highlightHTML=`
|
|
65
|
+
`,this._checker=null,this._debounceTimer=null}connectedCallback(){super.connectedCallback(),this._spellcheckOn=this.spellcheck,this._resizeObserver=new ResizeObserver(()=>this._syncScroll()),this._loadDict()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect()}firstUpdated(){this._resizeObserver.observe(this._textarea)}updated(e){e.has("value")&&!this._debounceTimer&&this._updateHighlight()}async _loadDict(){this._loading=!0;try{this._checker=await Lr(this.lang),this._updateHighlight()}finally{this._loading=!1}}_updateHighlight(){this._highlightHTML=Hr(this.value,this._checker,this._spellcheckOn)}_syncScroll(){this._overlay&&this._textarea&&(this._overlay.scrollTop=this._textarea.scrollTop)}_onInput(e){this.value=e.target.value,this._syncScroll(),this.dispatchEvent(new CustomEvent("sa-change",{detail:{value:this.value},bubbles:!0,composed:!0})),this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateHighlight(),400)}_onToggle(){this._spellcheckOn=!this._spellcheckOn,this._updateHighlight()}_onLangChange(e){this.lang=e.target.value,this._loadDict()}render(){return ue`
|
|
66
66
|
<div class="controls">
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
<div class="control-group">
|
|
68
|
+
<span class="control-label">Spellcheck</span>
|
|
69
|
+
<button
|
|
70
|
+
class=${Ut({"toggle-track":!0,on:this._spellcheckOn})}
|
|
71
|
+
@click=${this._onToggle}
|
|
72
|
+
title=${this._spellcheckOn?"Turn off spell check":"Turn on spell check"}
|
|
73
|
+
>
|
|
74
|
+
<span class="toggle-thumb"></span>
|
|
75
|
+
</button>
|
|
76
|
+
<span class="toggle-label">${this._spellcheckOn?"ON":"OFF"}</span>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="control-group">
|
|
80
|
+
<span class="control-label">Language</span>
|
|
81
|
+
<select @change=${this._onLangChange}>
|
|
82
|
+
${jr.map(({value:e,label:t})=>ue`
|
|
83
|
+
<option value=${e} ?selected=${e===this.lang}>${t}</option>
|
|
84
|
+
`)}
|
|
85
|
+
</select>
|
|
86
|
+
</div>
|
|
80
87
|
</div>
|
|
81
88
|
|
|
82
89
|
<div class="editor-wrapper">
|
|
@@ -91,5 +98,9 @@
|
|
|
91
98
|
></textarea>
|
|
92
99
|
</div>
|
|
93
100
|
|
|
94
|
-
${this._loading?ue
|
|
95
|
-
|
|
101
|
+
${this._loading?ue`
|
|
102
|
+
<p class="loading-hint">
|
|
103
|
+
<span class="loading-dot"></span>
|
|
104
|
+
Loading dictionary...
|
|
105
|
+
</p>`:""}
|
|
106
|
+
`}},_.SaSpellChecker.styles=xe(Mt),x([F({type:Boolean})],_.SaSpellChecker.prototype,"spellcheck",2),x([F()],_.SaSpellChecker.prototype,"lang",2),x([F()],_.SaSpellChecker.prototype,"placeholder",2),x([F()],_.SaSpellChecker.prototype,"value",2),x([F({type:Number})],_.SaSpellChecker.prototype,"rows",2),x([ve()],_.SaSpellChecker.prototype,"_spellcheckOn",2),x([ve()],_.SaSpellChecker.prototype,"_loading",2),x([ve()],_.SaSpellChecker.prototype,"_highlightHTML",2),x([Be("textarea")],_.SaSpellChecker.prototype,"_textarea",2),x([Be(".highlight-layer")],_.SaSpellChecker.prototype,"_overlay",2),_.SaSpellChecker=x([kt("sa-spell-checker")],_.SaSpellChecker),Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|