@halo-dev/shiki-code-element 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +442 -465
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,208 +1,208 @@
|
|
|
1
|
-
var
|
|
2
|
-
constructor(
|
|
3
|
-
if (this._$cssResult$ = !0,
|
|
4
|
-
this.cssText =
|
|
1
|
+
var e = "*,:before,:after{box-sizing:border-box;border-style:solid;border-width:0;border-color:var(--un-default-border-color,#e5e7eb)}:before,:after{--un-content:\"\"}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}", t = globalThis, n = t.ShadowRoot && (t.ShadyCSS === void 0 || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, r = Symbol(), i = new WeakMap(), a = class {
|
|
2
|
+
constructor(e, t, n) {
|
|
3
|
+
if (this._$cssResult$ = !0, n !== r) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
4
|
+
this.cssText = e, this.t = t;
|
|
5
5
|
}
|
|
6
6
|
get styleSheet() {
|
|
7
|
-
let
|
|
8
|
-
if (
|
|
9
|
-
let
|
|
10
|
-
|
|
7
|
+
let e = this.o, t = this.t;
|
|
8
|
+
if (n && e === void 0) {
|
|
9
|
+
let n = t !== void 0 && t.length === 1;
|
|
10
|
+
n && (e = i.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && i.set(t, e));
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return e;
|
|
13
13
|
}
|
|
14
14
|
toString() {
|
|
15
15
|
return this.cssText;
|
|
16
16
|
}
|
|
17
|
-
},
|
|
18
|
-
if (!0 ===
|
|
19
|
-
if (typeof
|
|
20
|
-
throw Error("Value passed to 'css' function must be a 'css' function result: " +
|
|
21
|
-
})(
|
|
22
|
-
if (
|
|
23
|
-
else for (let
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
let
|
|
29
|
-
for (let
|
|
30
|
-
return
|
|
31
|
-
})(
|
|
32
|
-
toAttribute(
|
|
33
|
-
switch (
|
|
17
|
+
}, o = (e) => new a(typeof e == "string" ? e : e + "", void 0, r), s = (e, ...t) => new a(e.length === 1 ? e[0] : t.reduce(((t, n, r) => t + ((e) => {
|
|
18
|
+
if (!0 === e._$cssResult$) return e.cssText;
|
|
19
|
+
if (typeof e == "number") return e;
|
|
20
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
21
|
+
})(n) + e[r + 1]), e[0]), e, r), c = (e, r) => {
|
|
22
|
+
if (n) e.adoptedStyleSheets = r.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
|
|
23
|
+
else for (let n of r) {
|
|
24
|
+
let r = document.createElement("style"), i = t.litNonce;
|
|
25
|
+
i !== void 0 && r.setAttribute("nonce", i), r.textContent = n.cssText, e.appendChild(r);
|
|
26
|
+
}
|
|
27
|
+
}, l = n ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
|
|
28
|
+
let t = "";
|
|
29
|
+
for (let n of e.cssRules) t += n.cssText;
|
|
30
|
+
return o(t);
|
|
31
|
+
})(e) : e, { is: u, defineProperty: d, getOwnPropertyDescriptor: ee, getOwnPropertyNames: te, getOwnPropertySymbols: ne, getPrototypeOf: re } = Object, f = globalThis, p = f.trustedTypes, ie = p ? p.emptyScript : "", ae = f.reactiveElementPolyfillSupport, m = (e, t) => e, h = {
|
|
32
|
+
toAttribute(e, t) {
|
|
33
|
+
switch (t) {
|
|
34
34
|
case Boolean:
|
|
35
|
-
|
|
35
|
+
e = e ? ie : null;
|
|
36
36
|
break;
|
|
37
37
|
case Object:
|
|
38
|
-
case Array:
|
|
38
|
+
case Array: e = e == null ? e : JSON.stringify(e);
|
|
39
39
|
}
|
|
40
|
-
return
|
|
40
|
+
return e;
|
|
41
41
|
},
|
|
42
|
-
fromAttribute(
|
|
43
|
-
let
|
|
44
|
-
switch (
|
|
42
|
+
fromAttribute(e, t) {
|
|
43
|
+
let n = e;
|
|
44
|
+
switch (t) {
|
|
45
45
|
case Boolean:
|
|
46
|
-
|
|
46
|
+
n = e !== null;
|
|
47
47
|
break;
|
|
48
48
|
case Number:
|
|
49
|
-
|
|
49
|
+
n = e === null ? null : Number(e);
|
|
50
50
|
break;
|
|
51
51
|
case Object:
|
|
52
52
|
case Array: try {
|
|
53
|
-
|
|
53
|
+
n = JSON.parse(e);
|
|
54
54
|
} catch {
|
|
55
|
-
|
|
55
|
+
n = null;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
return
|
|
58
|
+
return n;
|
|
59
59
|
}
|
|
60
|
-
},
|
|
60
|
+
}, g = (e, t) => !u(e, t), _ = {
|
|
61
61
|
attribute: !0,
|
|
62
62
|
type: String,
|
|
63
|
-
converter:
|
|
63
|
+
converter: h,
|
|
64
64
|
reflect: !1,
|
|
65
65
|
useDefault: !1,
|
|
66
|
-
hasChanged:
|
|
66
|
+
hasChanged: g
|
|
67
67
|
};
|
|
68
|
-
Symbol.metadata ??= Symbol("metadata"),
|
|
69
|
-
var
|
|
70
|
-
static addInitializer(
|
|
71
|
-
this._$Ei(), (this.l ??= []).push(
|
|
68
|
+
Symbol.metadata ??= Symbol("metadata"), f.litPropertyMetadata ??= new WeakMap();
|
|
69
|
+
var v = class extends HTMLElement {
|
|
70
|
+
static addInitializer(e) {
|
|
71
|
+
this._$Ei(), (this.l ??= []).push(e);
|
|
72
72
|
}
|
|
73
73
|
static get observedAttributes() {
|
|
74
74
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
75
75
|
}
|
|
76
|
-
static createProperty(
|
|
77
|
-
if (
|
|
78
|
-
let
|
|
79
|
-
|
|
76
|
+
static createProperty(e, t = _) {
|
|
77
|
+
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) {
|
|
78
|
+
let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
|
|
79
|
+
r !== void 0 && d(this.prototype, e, r);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
static getPropertyDescriptor(
|
|
83
|
-
let { get:
|
|
82
|
+
static getPropertyDescriptor(e, t, n) {
|
|
83
|
+
let { get: r, set: i } = ee(this.prototype, e) ?? {
|
|
84
84
|
get() {
|
|
85
|
-
return this[
|
|
85
|
+
return this[t];
|
|
86
86
|
},
|
|
87
|
-
set(
|
|
88
|
-
this[
|
|
87
|
+
set(e) {
|
|
88
|
+
this[t] = e;
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
return {
|
|
92
|
-
get:
|
|
93
|
-
set(
|
|
94
|
-
let
|
|
95
|
-
|
|
92
|
+
get: r,
|
|
93
|
+
set(t) {
|
|
94
|
+
let a = r?.call(this);
|
|
95
|
+
i?.call(this, t), this.requestUpdate(e, a, n);
|
|
96
96
|
},
|
|
97
97
|
configurable: !0,
|
|
98
98
|
enumerable: !0
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
static getPropertyOptions(
|
|
102
|
-
return this.elementProperties.get(
|
|
101
|
+
static getPropertyOptions(e) {
|
|
102
|
+
return this.elementProperties.get(e) ?? _;
|
|
103
103
|
}
|
|
104
104
|
static _$Ei() {
|
|
105
|
-
if (this.hasOwnProperty(
|
|
106
|
-
let
|
|
107
|
-
|
|
105
|
+
if (this.hasOwnProperty(m("elementProperties"))) return;
|
|
106
|
+
let e = re(this);
|
|
107
|
+
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
108
108
|
}
|
|
109
109
|
static finalize() {
|
|
110
|
-
if (this.hasOwnProperty(
|
|
111
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
112
|
-
let
|
|
113
|
-
for (let
|
|
110
|
+
if (this.hasOwnProperty(m("finalized"))) return;
|
|
111
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(m("properties"))) {
|
|
112
|
+
let e = this.properties, t = [...te(e), ...ne(e)];
|
|
113
|
+
for (let n of t) this.createProperty(n, e[n]);
|
|
114
114
|
}
|
|
115
|
-
let
|
|
116
|
-
if (
|
|
117
|
-
let
|
|
118
|
-
if (
|
|
115
|
+
let e = this[Symbol.metadata];
|
|
116
|
+
if (e !== null) {
|
|
117
|
+
let t = litPropertyMetadata.get(e);
|
|
118
|
+
if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
|
|
119
119
|
}
|
|
120
|
-
this._$Eh =
|
|
121
|
-
for (let [
|
|
122
|
-
let
|
|
123
|
-
|
|
120
|
+
this._$Eh = new Map();
|
|
121
|
+
for (let [e, t] of this.elementProperties) {
|
|
122
|
+
let n = this._$Eu(e, t);
|
|
123
|
+
n !== void 0 && this._$Eh.set(n, e);
|
|
124
124
|
}
|
|
125
125
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
126
126
|
}
|
|
127
|
-
static finalizeStyles(
|
|
128
|
-
let
|
|
129
|
-
if (Array.isArray(
|
|
130
|
-
let
|
|
131
|
-
for (let
|
|
132
|
-
} else
|
|
133
|
-
return
|
|
127
|
+
static finalizeStyles(e) {
|
|
128
|
+
let t = [];
|
|
129
|
+
if (Array.isArray(e)) {
|
|
130
|
+
let n = new Set(e.flat(Infinity).reverse());
|
|
131
|
+
for (let e of n) t.unshift(l(e));
|
|
132
|
+
} else e !== void 0 && t.push(l(e));
|
|
133
|
+
return t;
|
|
134
134
|
}
|
|
135
|
-
static _$Eu(
|
|
136
|
-
let
|
|
137
|
-
return !1 ===
|
|
135
|
+
static _$Eu(e, t) {
|
|
136
|
+
let n = t.attribute;
|
|
137
|
+
return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
138
138
|
}
|
|
139
139
|
constructor() {
|
|
140
140
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
141
141
|
}
|
|
142
142
|
_$Ev() {
|
|
143
|
-
this._$ES = new Promise(((
|
|
143
|
+
this._$ES = new Promise(((e) => this.enableUpdating = e)), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((e) => e(this)));
|
|
144
144
|
}
|
|
145
|
-
addController(
|
|
146
|
-
(this._$EO ??=
|
|
145
|
+
addController(e) {
|
|
146
|
+
(this._$EO ??= new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
147
147
|
}
|
|
148
|
-
removeController(
|
|
149
|
-
this._$EO?.delete(
|
|
148
|
+
removeController(e) {
|
|
149
|
+
this._$EO?.delete(e);
|
|
150
150
|
}
|
|
151
151
|
_$E_() {
|
|
152
|
-
let
|
|
153
|
-
for (let
|
|
154
|
-
|
|
152
|
+
let e = new Map(), t = this.constructor.elementProperties;
|
|
153
|
+
for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
|
|
154
|
+
e.size > 0 && (this._$Ep = e);
|
|
155
155
|
}
|
|
156
156
|
createRenderRoot() {
|
|
157
|
-
let
|
|
158
|
-
return
|
|
157
|
+
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
158
|
+
return c(e, this.constructor.elementStyles), e;
|
|
159
159
|
}
|
|
160
160
|
connectedCallback() {
|
|
161
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((
|
|
161
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((e) => e.hostConnected?.()));
|
|
162
162
|
}
|
|
163
|
-
enableUpdating(
|
|
163
|
+
enableUpdating(e) {}
|
|
164
164
|
disconnectedCallback() {
|
|
165
|
-
this._$EO?.forEach(((
|
|
165
|
+
this._$EO?.forEach(((e) => e.hostDisconnected?.()));
|
|
166
166
|
}
|
|
167
|
-
attributeChangedCallback(
|
|
168
|
-
this._$AK(
|
|
167
|
+
attributeChangedCallback(e, t, n) {
|
|
168
|
+
this._$AK(e, n);
|
|
169
169
|
}
|
|
170
|
-
_$ET(
|
|
171
|
-
let
|
|
172
|
-
if (
|
|
173
|
-
let
|
|
174
|
-
this._$Em =
|
|
170
|
+
_$ET(e, t) {
|
|
171
|
+
let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
|
|
172
|
+
if (r !== void 0 && !0 === n.reflect) {
|
|
173
|
+
let i = (n.converter?.toAttribute === void 0 ? h : n.converter).toAttribute(t, n.type);
|
|
174
|
+
this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
_$AK(
|
|
178
|
-
let
|
|
179
|
-
if (
|
|
180
|
-
let
|
|
181
|
-
this._$Em =
|
|
182
|
-
let
|
|
183
|
-
this[
|
|
177
|
+
_$AK(e, t) {
|
|
178
|
+
let n = this.constructor, r = n._$Eh.get(e);
|
|
179
|
+
if (r !== void 0 && this._$Em !== r) {
|
|
180
|
+
let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? h : e.converter;
|
|
181
|
+
this._$Em = r;
|
|
182
|
+
let a = i.fromAttribute(t, e.type);
|
|
183
|
+
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
requestUpdate(
|
|
187
|
-
if (
|
|
188
|
-
let
|
|
189
|
-
if (
|
|
190
|
-
this.C(
|
|
186
|
+
requestUpdate(e, t, n) {
|
|
187
|
+
if (e !== void 0) {
|
|
188
|
+
let r = this.constructor, i = this[e];
|
|
189
|
+
if (n ??= r.getPropertyOptions(e), !((n.hasChanged ?? g)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(r._$Eu(e, n)))) return;
|
|
190
|
+
this.C(e, t, n);
|
|
191
191
|
}
|
|
192
192
|
!1 === this.isUpdatePending && (this._$ES = this._$EP());
|
|
193
193
|
}
|
|
194
|
-
C(
|
|
195
|
-
|
|
194
|
+
C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
|
|
195
|
+
n && !(this._$Ej ??= new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= new Set()).add(e));
|
|
196
196
|
}
|
|
197
197
|
async _$EP() {
|
|
198
198
|
this.isUpdatePending = !0;
|
|
199
199
|
try {
|
|
200
200
|
await this._$ES;
|
|
201
|
-
} catch (
|
|
202
|
-
Promise.reject(
|
|
201
|
+
} catch (e) {
|
|
202
|
+
Promise.reject(e);
|
|
203
203
|
}
|
|
204
|
-
let
|
|
205
|
-
return
|
|
204
|
+
let e = this.scheduleUpdate();
|
|
205
|
+
return e != null && await e, !this.isUpdatePending;
|
|
206
206
|
}
|
|
207
207
|
scheduleUpdate() {
|
|
208
208
|
return this.performUpdate();
|
|
@@ -211,29 +211,29 @@ var y$1 = class extends HTMLElement {
|
|
|
211
211
|
if (!this.isUpdatePending) return;
|
|
212
212
|
if (!this.hasUpdated) {
|
|
213
213
|
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
214
|
-
for (let [
|
|
214
|
+
for (let [e, t] of this._$Ep) this[e] = t;
|
|
215
215
|
this._$Ep = void 0;
|
|
216
216
|
}
|
|
217
|
-
let
|
|
218
|
-
if (
|
|
219
|
-
let { wrapped:
|
|
220
|
-
!0 !==
|
|
217
|
+
let e = this.constructor.elementProperties;
|
|
218
|
+
if (e.size > 0) for (let [t, n] of e) {
|
|
219
|
+
let { wrapped: e } = n, r = this[t];
|
|
220
|
+
!0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
let
|
|
223
|
+
let e = !1, t = this._$AL;
|
|
224
224
|
try {
|
|
225
|
-
|
|
226
|
-
} catch (
|
|
227
|
-
throw
|
|
225
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach(((e) => e.hostUpdate?.())), this.update(t)) : this._$EM();
|
|
226
|
+
} catch (t) {
|
|
227
|
+
throw e = !1, this._$EM(), t;
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
e && this._$AE(t);
|
|
230
230
|
}
|
|
231
|
-
willUpdate(
|
|
232
|
-
_$AE(
|
|
233
|
-
this._$EO?.forEach(((
|
|
231
|
+
willUpdate(e) {}
|
|
232
|
+
_$AE(e) {
|
|
233
|
+
this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
234
234
|
}
|
|
235
235
|
_$EM() {
|
|
236
|
-
this._$AL =
|
|
236
|
+
this._$AL = new Map(), this.isUpdatePending = !1;
|
|
237
237
|
}
|
|
238
238
|
get updateComplete() {
|
|
239
239
|
return this.getUpdateComplete();
|
|
@@ -241,101 +241,96 @@ var y$1 = class extends HTMLElement {
|
|
|
241
241
|
getUpdateComplete() {
|
|
242
242
|
return this._$ES;
|
|
243
243
|
}
|
|
244
|
-
shouldUpdate(
|
|
244
|
+
shouldUpdate(e) {
|
|
245
245
|
return !0;
|
|
246
246
|
}
|
|
247
|
-
update(
|
|
248
|
-
this._$Eq &&= this._$Eq.forEach(((
|
|
247
|
+
update(e) {
|
|
248
|
+
this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM();
|
|
249
249
|
}
|
|
250
|
-
updated(
|
|
251
|
-
firstUpdated(
|
|
250
|
+
updated(e) {}
|
|
251
|
+
firstUpdated(e) {}
|
|
252
252
|
};
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
values: U
|
|
263
|
-
}))(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$2.createTreeWalker(r$2, 129);
|
|
264
|
-
function P(y, F) {
|
|
265
|
-
if (!a(y) || !y.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
266
|
-
return s$1 === void 0 ? F : s$1.createHTML(F);
|
|
253
|
+
v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[m("elementProperties")] = new Map(), v[m("finalized")] = new Map(), ae?.({ ReactiveElement: v }), (f.reactiveElementVersions ??= []).push("2.1.1");
|
|
254
|
+
var y = globalThis, b = y.trustedTypes, x = b ? b.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, oe = "$lit$", S = `lit$${Math.random().toFixed(9).slice(2)}$`, C = "?" + S, se = `<${C}>`, w = document, T = () => w.createComment(""), E = (e) => e === null || typeof e != "object" && typeof e != "function", D = Array.isArray, ce = (e) => D(e) || typeof e?.[Symbol.iterator] == "function", O = "[ \n\f\r]", k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, A = /-->/g, j = />/g, M = RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), le = /'/g, ue = /"/g, N = /^(?:script|style|textarea|title)$/i, P = ((e) => (t, ...n) => ({
|
|
255
|
+
_$litType$: e,
|
|
256
|
+
strings: t,
|
|
257
|
+
values: n
|
|
258
|
+
}))(1), F = Symbol.for("lit-noChange"), I = Symbol.for("lit-nothing"), L = new WeakMap(), R = w.createTreeWalker(w, 129);
|
|
259
|
+
function z(e, t) {
|
|
260
|
+
if (!D(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
261
|
+
return x === void 0 ? t : x.createHTML(t);
|
|
267
262
|
}
|
|
268
|
-
var
|
|
269
|
-
let
|
|
270
|
-
for (let
|
|
271
|
-
let
|
|
272
|
-
for (;
|
|
273
|
-
let
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
return [
|
|
277
|
-
},
|
|
278
|
-
constructor({ strings:
|
|
279
|
-
let
|
|
263
|
+
var de = (e, t) => {
|
|
264
|
+
let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = k;
|
|
265
|
+
for (let t = 0; t < n; t++) {
|
|
266
|
+
let n = e[t], s, c, l = -1, u = 0;
|
|
267
|
+
for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === k ? c[1] === "!--" ? o = A : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = M) : (N.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = M) : o = j : o === M ? c[0] === ">" ? (o = i ?? k, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? M : c[3] === "\"" ? ue : le) : o === ue || o === le ? o = M : o === A || o === j ? o = k : (o = M, i = void 0);
|
|
268
|
+
let d = o === M && e[t + 1].startsWith("/>") ? " " : "";
|
|
269
|
+
a += o === k ? n + se : l >= 0 ? (r.push(s), n.slice(0, l) + oe + n.slice(l) + S + d) : n + S + (l === -2 ? t : d);
|
|
270
|
+
}
|
|
271
|
+
return [z(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
272
|
+
}, B = class e {
|
|
273
|
+
constructor({ strings: t, _$litType$: n }, r) {
|
|
274
|
+
let i;
|
|
280
275
|
this.parts = [];
|
|
281
|
-
let
|
|
282
|
-
if (this.el =
|
|
283
|
-
let
|
|
284
|
-
|
|
276
|
+
let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = de(t, n);
|
|
277
|
+
if (this.el = e.createElement(l, r), R.currentNode = this.el.content, n === 2 || n === 3) {
|
|
278
|
+
let e = this.el.content.firstChild;
|
|
279
|
+
e.replaceWith(...e.childNodes);
|
|
285
280
|
}
|
|
286
|
-
for (; (
|
|
287
|
-
if (
|
|
288
|
-
if (
|
|
289
|
-
let
|
|
290
|
-
|
|
281
|
+
for (; (i = R.nextNode()) !== null && c.length < s;) {
|
|
282
|
+
if (i.nodeType === 1) {
|
|
283
|
+
if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(oe)) {
|
|
284
|
+
let t = u[o++], n = i.getAttribute(e).split(S), r = /([.?@])?(.*)/.exec(t);
|
|
285
|
+
c.push({
|
|
291
286
|
type: 1,
|
|
292
|
-
index:
|
|
293
|
-
name:
|
|
294
|
-
strings:
|
|
295
|
-
ctor:
|
|
296
|
-
}),
|
|
297
|
-
} else
|
|
287
|
+
index: a,
|
|
288
|
+
name: r[2],
|
|
289
|
+
strings: n,
|
|
290
|
+
ctor: r[1] === "." ? pe : r[1] === "?" ? me : r[1] === "@" ? he : U
|
|
291
|
+
}), i.removeAttribute(e);
|
|
292
|
+
} else e.startsWith(S) && (c.push({
|
|
298
293
|
type: 6,
|
|
299
|
-
index:
|
|
300
|
-
}),
|
|
301
|
-
if (
|
|
302
|
-
let
|
|
303
|
-
if (
|
|
304
|
-
|
|
305
|
-
for (let
|
|
294
|
+
index: a
|
|
295
|
+
}), i.removeAttribute(e));
|
|
296
|
+
if (N.test(i.tagName)) {
|
|
297
|
+
let e = i.textContent.split(S), t = e.length - 1;
|
|
298
|
+
if (t > 0) {
|
|
299
|
+
i.textContent = b ? b.emptyScript : "";
|
|
300
|
+
for (let n = 0; n < t; n++) i.append(e[n], T()), R.nextNode(), c.push({
|
|
306
301
|
type: 2,
|
|
307
|
-
index: ++
|
|
302
|
+
index: ++a
|
|
308
303
|
});
|
|
309
|
-
|
|
304
|
+
i.append(e[t], T());
|
|
310
305
|
}
|
|
311
306
|
}
|
|
312
|
-
} else if (
|
|
307
|
+
} else if (i.nodeType === 8) if (i.data === C) c.push({
|
|
313
308
|
type: 2,
|
|
314
|
-
index:
|
|
309
|
+
index: a
|
|
315
310
|
});
|
|
316
311
|
else {
|
|
317
|
-
let
|
|
318
|
-
for (; (
|
|
312
|
+
let e = -1;
|
|
313
|
+
for (; (e = i.data.indexOf(S, e + 1)) !== -1;) c.push({
|
|
319
314
|
type: 7,
|
|
320
|
-
index:
|
|
321
|
-
}),
|
|
315
|
+
index: a
|
|
316
|
+
}), e += S.length - 1;
|
|
322
317
|
}
|
|
323
|
-
|
|
318
|
+
a++;
|
|
324
319
|
}
|
|
325
320
|
}
|
|
326
|
-
static createElement(
|
|
327
|
-
let
|
|
328
|
-
return
|
|
321
|
+
static createElement(e, t) {
|
|
322
|
+
let n = w.createElement("template");
|
|
323
|
+
return n.innerHTML = e, n;
|
|
329
324
|
}
|
|
330
325
|
};
|
|
331
|
-
function
|
|
332
|
-
if (
|
|
333
|
-
let
|
|
334
|
-
return
|
|
326
|
+
function V(e, t, n = e, r) {
|
|
327
|
+
if (t === F) return t;
|
|
328
|
+
let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = E(t) ? void 0 : t._$litDirective$;
|
|
329
|
+
return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = V(e, i._$AS(e, t.values), i, r)), t;
|
|
335
330
|
}
|
|
336
|
-
var
|
|
337
|
-
constructor(
|
|
338
|
-
this._$AV = [], this._$AN = void 0, this._$AD =
|
|
331
|
+
var fe = class {
|
|
332
|
+
constructor(e, t) {
|
|
333
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
339
334
|
}
|
|
340
335
|
get parentNode() {
|
|
341
336
|
return this._$AM.parentNode;
|
|
@@ -343,33 +338,33 @@ var M = class {
|
|
|
343
338
|
get _$AU() {
|
|
344
339
|
return this._$AM._$AU;
|
|
345
340
|
}
|
|
346
|
-
u(
|
|
347
|
-
let { el: { content:
|
|
348
|
-
|
|
349
|
-
let
|
|
350
|
-
for (;
|
|
351
|
-
if (
|
|
352
|
-
let
|
|
353
|
-
|
|
341
|
+
u(e) {
|
|
342
|
+
let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? w).importNode(t, !0);
|
|
343
|
+
R.currentNode = r;
|
|
344
|
+
let i = R.nextNode(), a = 0, o = 0, s = n[0];
|
|
345
|
+
for (; s !== void 0;) {
|
|
346
|
+
if (a === s.index) {
|
|
347
|
+
let t;
|
|
348
|
+
s.type === 2 ? t = new H(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new ge(i, this, e)), this._$AV.push(t), s = n[++o];
|
|
354
349
|
}
|
|
355
|
-
|
|
350
|
+
a !== s?.index && (i = R.nextNode(), a++);
|
|
356
351
|
}
|
|
357
|
-
return
|
|
352
|
+
return R.currentNode = w, r;
|
|
358
353
|
}
|
|
359
|
-
p(
|
|
360
|
-
let
|
|
361
|
-
for (let
|
|
354
|
+
p(e) {
|
|
355
|
+
let t = 0;
|
|
356
|
+
for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
|
|
362
357
|
}
|
|
363
|
-
},
|
|
358
|
+
}, H = class e {
|
|
364
359
|
get _$AU() {
|
|
365
360
|
return this._$AM?._$AU ?? this._$Cv;
|
|
366
361
|
}
|
|
367
|
-
constructor(
|
|
368
|
-
this.type = 2, this._$AH =
|
|
362
|
+
constructor(e, t, n, r) {
|
|
363
|
+
this.type = 2, this._$AH = I, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
|
|
369
364
|
}
|
|
370
365
|
get parentNode() {
|
|
371
|
-
let
|
|
372
|
-
return
|
|
366
|
+
let e = this._$AA.parentNode, t = this._$AM;
|
|
367
|
+
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
373
368
|
}
|
|
374
369
|
get startNode() {
|
|
375
370
|
return this._$AA;
|
|
@@ -377,123 +372,123 @@ var M = class {
|
|
|
377
372
|
get endNode() {
|
|
378
373
|
return this._$AB;
|
|
379
374
|
}
|
|
380
|
-
_$AI(
|
|
381
|
-
|
|
375
|
+
_$AI(e, t = this) {
|
|
376
|
+
e = V(this, e, t), E(e) ? e === I || e == null || e === "" ? (this._$AH !== I && this._$AR(), this._$AH = I) : e !== this._$AH && e !== F && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? ce(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
|
|
382
377
|
}
|
|
383
|
-
O(
|
|
384
|
-
return this._$AA.parentNode.insertBefore(
|
|
378
|
+
O(e) {
|
|
379
|
+
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
385
380
|
}
|
|
386
|
-
T(
|
|
387
|
-
this._$AH !==
|
|
381
|
+
T(e) {
|
|
382
|
+
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
388
383
|
}
|
|
389
|
-
_(
|
|
390
|
-
this._$AH !==
|
|
384
|
+
_(e) {
|
|
385
|
+
this._$AH !== I && E(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
|
|
391
386
|
}
|
|
392
|
-
$(
|
|
393
|
-
let { values:
|
|
394
|
-
if (this._$AH?._$AD ===
|
|
387
|
+
$(e) {
|
|
388
|
+
let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = B.createElement(z(n.h, n.h[0]), this.options)), n);
|
|
389
|
+
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
395
390
|
else {
|
|
396
|
-
let
|
|
397
|
-
|
|
391
|
+
let e = new fe(r, this), n = e.u(this.options);
|
|
392
|
+
e.p(t), this.T(n), this._$AH = e;
|
|
398
393
|
}
|
|
399
394
|
}
|
|
400
|
-
_$AC(
|
|
401
|
-
let
|
|
402
|
-
return
|
|
395
|
+
_$AC(e) {
|
|
396
|
+
let t = L.get(e.strings);
|
|
397
|
+
return t === void 0 && L.set(e.strings, t = new B(e)), t;
|
|
403
398
|
}
|
|
404
|
-
k(
|
|
405
|
-
|
|
406
|
-
let
|
|
407
|
-
for (let
|
|
408
|
-
|
|
399
|
+
k(t) {
|
|
400
|
+
D(this._$AH) || (this._$AH = [], this._$AR());
|
|
401
|
+
let n = this._$AH, r, i = 0;
|
|
402
|
+
for (let a of t) i === n.length ? n.push(r = new e(this.O(T()), this.O(T()), this, this.options)) : r = n[i], r._$AI(a), i++;
|
|
403
|
+
i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
|
|
409
404
|
}
|
|
410
|
-
_$AR(
|
|
411
|
-
for (this._$AP?.(!1, !0,
|
|
412
|
-
let
|
|
413
|
-
|
|
405
|
+
_$AR(e = this._$AA.nextSibling, t) {
|
|
406
|
+
for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
|
|
407
|
+
let t = e.nextSibling;
|
|
408
|
+
e.remove(), e = t;
|
|
414
409
|
}
|
|
415
410
|
}
|
|
416
|
-
setConnected(
|
|
417
|
-
this._$AM === void 0 && (this._$Cv =
|
|
411
|
+
setConnected(e) {
|
|
412
|
+
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
418
413
|
}
|
|
419
|
-
},
|
|
414
|
+
}, U = class {
|
|
420
415
|
get tagName() {
|
|
421
416
|
return this.element.tagName;
|
|
422
417
|
}
|
|
423
418
|
get _$AU() {
|
|
424
419
|
return this._$AM._$AU;
|
|
425
420
|
}
|
|
426
|
-
constructor(
|
|
427
|
-
this.type = 1, this._$AH =
|
|
421
|
+
constructor(e, t, n, r, i) {
|
|
422
|
+
this.type = 1, this._$AH = I, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(new String()), this.strings = n) : this._$AH = I;
|
|
428
423
|
}
|
|
429
|
-
_$AI(
|
|
430
|
-
let
|
|
431
|
-
if (
|
|
424
|
+
_$AI(e, t = this, n, r) {
|
|
425
|
+
let i = this.strings, a = !1;
|
|
426
|
+
if (i === void 0) e = V(this, e, t, 0), a = !E(e) || e !== this._$AH && e !== F, a && (this._$AH = e);
|
|
432
427
|
else {
|
|
433
|
-
let
|
|
434
|
-
for (
|
|
428
|
+
let r = e, o, s;
|
|
429
|
+
for (e = i[0], o = 0; o < i.length - 1; o++) s = V(this, r[n + o], t, o), s === F && (s = this._$AH[o]), a ||= !E(s) || s !== this._$AH[o], s === I ? e = I : e !== I && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
|
|
435
430
|
}
|
|
436
|
-
|
|
431
|
+
a && !r && this.j(e);
|
|
437
432
|
}
|
|
438
|
-
j(
|
|
439
|
-
|
|
433
|
+
j(e) {
|
|
434
|
+
e === I ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
440
435
|
}
|
|
441
|
-
},
|
|
436
|
+
}, pe = class extends U {
|
|
442
437
|
constructor() {
|
|
443
438
|
super(...arguments), this.type = 3;
|
|
444
439
|
}
|
|
445
|
-
j(
|
|
446
|
-
this.element[this.name] =
|
|
440
|
+
j(e) {
|
|
441
|
+
this.element[this.name] = e === I ? void 0 : e;
|
|
447
442
|
}
|
|
448
|
-
},
|
|
443
|
+
}, me = class extends U {
|
|
449
444
|
constructor() {
|
|
450
445
|
super(...arguments), this.type = 4;
|
|
451
446
|
}
|
|
452
|
-
j(
|
|
453
|
-
this.element.toggleAttribute(this.name, !!
|
|
447
|
+
j(e) {
|
|
448
|
+
this.element.toggleAttribute(this.name, !!e && e !== I);
|
|
454
449
|
}
|
|
455
|
-
},
|
|
456
|
-
constructor(
|
|
457
|
-
super(
|
|
450
|
+
}, he = class extends U {
|
|
451
|
+
constructor(e, t, n, r, i) {
|
|
452
|
+
super(e, t, n, r, i), this.type = 5;
|
|
458
453
|
}
|
|
459
|
-
_$AI(
|
|
460
|
-
if ((
|
|
461
|
-
let
|
|
462
|
-
|
|
454
|
+
_$AI(e, t = this) {
|
|
455
|
+
if ((e = V(this, e, t, 0) ?? I) === F) return;
|
|
456
|
+
let n = this._$AH, r = e === I && n !== I || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== I && (n === I || r);
|
|
457
|
+
r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
463
458
|
}
|
|
464
|
-
handleEvent(
|
|
465
|
-
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element,
|
|
459
|
+
handleEvent(e) {
|
|
460
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
466
461
|
}
|
|
467
|
-
},
|
|
468
|
-
constructor(
|
|
469
|
-
this.element =
|
|
462
|
+
}, ge = class {
|
|
463
|
+
constructor(e, t, n) {
|
|
464
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
|
|
470
465
|
}
|
|
471
466
|
get _$AU() {
|
|
472
467
|
return this._$AM._$AU;
|
|
473
468
|
}
|
|
474
|
-
_$AI(
|
|
475
|
-
|
|
469
|
+
_$AI(e) {
|
|
470
|
+
V(this, e);
|
|
476
471
|
}
|
|
477
|
-
},
|
|
478
|
-
|
|
479
|
-
var
|
|
480
|
-
let
|
|
481
|
-
if (
|
|
482
|
-
let
|
|
483
|
-
|
|
472
|
+
}, _e = y.litHtmlPolyfillSupport;
|
|
473
|
+
_e?.(B, H), (y.litHtmlVersions ??= []).push("3.3.1");
|
|
474
|
+
var ve = (e, t, n) => {
|
|
475
|
+
let r = n?.renderBefore ?? t, i = r._$litPart$;
|
|
476
|
+
if (i === void 0) {
|
|
477
|
+
let e = n?.renderBefore ?? null;
|
|
478
|
+
r._$litPart$ = i = new H(t.insertBefore(T(), e), e, void 0, n ?? {});
|
|
484
479
|
}
|
|
485
|
-
return
|
|
486
|
-
},
|
|
480
|
+
return i._$AI(e), i;
|
|
481
|
+
}, W = globalThis, G = class extends v {
|
|
487
482
|
constructor() {
|
|
488
483
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
489
484
|
}
|
|
490
485
|
createRenderRoot() {
|
|
491
|
-
let
|
|
492
|
-
return this.renderOptions.renderBefore ??=
|
|
486
|
+
let e = super.createRenderRoot();
|
|
487
|
+
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
493
488
|
}
|
|
494
|
-
update(
|
|
495
|
-
let
|
|
496
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(
|
|
489
|
+
update(e) {
|
|
490
|
+
let t = this.render();
|
|
491
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = ve(t, this.renderRoot, this.renderOptions);
|
|
497
492
|
}
|
|
498
493
|
connectedCallback() {
|
|
499
494
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -502,144 +497,126 @@ var B = (y, F, U) => {
|
|
|
502
497
|
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
503
498
|
}
|
|
504
499
|
render() {
|
|
505
|
-
return
|
|
500
|
+
return F;
|
|
506
501
|
}
|
|
507
502
|
};
|
|
508
|
-
|
|
509
|
-
var
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
* @license
|
|
513
|
-
* Copyright 2017 Google LLC
|
|
514
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
515
|
-
*/ var o$1 = {
|
|
503
|
+
G._$litElement$ = !0, G.finalized = !0, W.litElementHydrateSupport?.({ LitElement: G });
|
|
504
|
+
var ye = W.litElementPolyfillSupport;
|
|
505
|
+
ye?.({ LitElement: G }), (W.litElementVersions ??= []).push("4.2.1");
|
|
506
|
+
var be = {
|
|
516
507
|
attribute: !0,
|
|
517
508
|
type: String,
|
|
518
|
-
converter:
|
|
509
|
+
converter: h,
|
|
519
510
|
reflect: !1,
|
|
520
|
-
hasChanged:
|
|
521
|
-
},
|
|
522
|
-
let { kind:
|
|
523
|
-
if (
|
|
524
|
-
let { name:
|
|
511
|
+
hasChanged: g
|
|
512
|
+
}, xe = (e = be, t, n) => {
|
|
513
|
+
let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
|
|
514
|
+
if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
|
|
515
|
+
let { name: r } = n;
|
|
525
516
|
return {
|
|
526
|
-
set(
|
|
527
|
-
let
|
|
528
|
-
|
|
517
|
+
set(n) {
|
|
518
|
+
let i = t.get.call(this);
|
|
519
|
+
t.set.call(this, n), this.requestUpdate(r, i, e);
|
|
529
520
|
},
|
|
530
|
-
init(
|
|
531
|
-
return
|
|
521
|
+
init(t) {
|
|
522
|
+
return t !== void 0 && this.C(r, void 0, e, t), t;
|
|
532
523
|
}
|
|
533
524
|
};
|
|
534
525
|
}
|
|
535
|
-
if (
|
|
536
|
-
let { name:
|
|
537
|
-
return function(
|
|
538
|
-
let
|
|
539
|
-
|
|
526
|
+
if (r === "setter") {
|
|
527
|
+
let { name: r } = n;
|
|
528
|
+
return function(n) {
|
|
529
|
+
let i = this[r];
|
|
530
|
+
t.call(this, n), this.requestUpdate(r, i, e);
|
|
540
531
|
};
|
|
541
532
|
}
|
|
542
|
-
throw Error("Unsupported decorator location: " +
|
|
533
|
+
throw Error("Unsupported decorator location: " + r);
|
|
543
534
|
};
|
|
544
|
-
function
|
|
545
|
-
return (
|
|
546
|
-
let
|
|
547
|
-
return
|
|
548
|
-
})(
|
|
535
|
+
function K(e) {
|
|
536
|
+
return (t, n) => typeof n == "object" ? xe(e, t, n) : ((e, t, n) => {
|
|
537
|
+
let r = t.hasOwnProperty(n);
|
|
538
|
+
return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0;
|
|
539
|
+
})(e, t, n);
|
|
549
540
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
554
|
-
*/ function r(y) {
|
|
555
|
-
return n$1({
|
|
556
|
-
...y,
|
|
541
|
+
function q(e) {
|
|
542
|
+
return K({
|
|
543
|
+
...e,
|
|
557
544
|
state: !0,
|
|
558
545
|
attribute: !1
|
|
559
546
|
});
|
|
560
547
|
}
|
|
561
|
-
|
|
562
|
-
* @license
|
|
563
|
-
* Copyright 2017 Google LLC
|
|
564
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
565
|
-
*/
|
|
566
|
-
var t = {
|
|
548
|
+
var Se = {
|
|
567
549
|
ATTRIBUTE: 1,
|
|
568
550
|
CHILD: 2,
|
|
569
551
|
PROPERTY: 3,
|
|
570
552
|
BOOLEAN_ATTRIBUTE: 4,
|
|
571
553
|
EVENT: 5,
|
|
572
554
|
ELEMENT: 6
|
|
573
|
-
},
|
|
574
|
-
_$litDirective$:
|
|
575
|
-
values:
|
|
576
|
-
}),
|
|
577
|
-
constructor(
|
|
555
|
+
}, Ce = (e) => (...t) => ({
|
|
556
|
+
_$litDirective$: e,
|
|
557
|
+
values: t
|
|
558
|
+
}), we = class {
|
|
559
|
+
constructor(e) {}
|
|
578
560
|
get _$AU() {
|
|
579
561
|
return this._$AM._$AU;
|
|
580
562
|
}
|
|
581
|
-
_$AT(
|
|
582
|
-
this._$Ct =
|
|
563
|
+
_$AT(e, t, n) {
|
|
564
|
+
this._$Ct = e, this._$AM = t, this._$Ci = n;
|
|
583
565
|
}
|
|
584
|
-
_$AS(
|
|
585
|
-
return this.update(
|
|
566
|
+
_$AS(e, t) {
|
|
567
|
+
return this.update(e, t);
|
|
586
568
|
}
|
|
587
|
-
update(
|
|
588
|
-
return this.render(...
|
|
569
|
+
update(e, t) {
|
|
570
|
+
return this.render(...t);
|
|
589
571
|
}
|
|
590
|
-
},
|
|
591
|
-
constructor(
|
|
592
|
-
if (super(
|
|
572
|
+
}, J = class extends we {
|
|
573
|
+
constructor(e) {
|
|
574
|
+
if (super(e), this.it = I, e.type !== Se.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
593
575
|
}
|
|
594
|
-
render(
|
|
595
|
-
if (
|
|
596
|
-
if (
|
|
597
|
-
if (typeof
|
|
598
|
-
if (
|
|
599
|
-
this.it =
|
|
600
|
-
let
|
|
601
|
-
return
|
|
576
|
+
render(e) {
|
|
577
|
+
if (e === I || e == null) return this._t = void 0, this.it = e;
|
|
578
|
+
if (e === F) return e;
|
|
579
|
+
if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
580
|
+
if (e === this.it) return this._t;
|
|
581
|
+
this.it = e;
|
|
582
|
+
let t = [e];
|
|
583
|
+
return t.raw = t, this._t = {
|
|
602
584
|
_$litType$: this.constructor.resultType,
|
|
603
|
-
strings:
|
|
585
|
+
strings: t,
|
|
604
586
|
values: []
|
|
605
587
|
};
|
|
606
588
|
}
|
|
607
589
|
};
|
|
608
|
-
|
|
609
|
-
var
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
* Copyright 2021 Google LLC
|
|
613
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
614
|
-
*/
|
|
615
|
-
function n(y, F, U) {
|
|
616
|
-
return y ? F(y) : U?.(y);
|
|
590
|
+
J.directiveName = "unsafeHTML", J.resultType = 1;
|
|
591
|
+
var Y = Ce(J);
|
|
592
|
+
function X(e, t, n) {
|
|
593
|
+
return e ? t(e) : n?.(e);
|
|
617
594
|
}
|
|
618
|
-
var
|
|
619
|
-
function
|
|
620
|
-
if (navigator.clipboard) navigator.clipboard.writeText(
|
|
621
|
-
|
|
595
|
+
var Te = ".shiki{color-scheme:var(--shiki-theme-type,light);padding:.875em;overflow-x:auto}code{z-index:0;width:max-content;min-width:100%;font-size:var(--font-size,.875em);counter-reset:step;counter-increment:step 0;display:block;position:relative}code .line:before{content:counter(step);counter-increment:step;text-align:right;color:#738a9480;width:1rem;margin-right:1.5rem;display:inline-block}code .line:last-child:empty:before{content:none;counter-increment:none}.has-diff .diff,.has-highlighted .highlighted{width:100%;display:inline-block;position:relative}.has-diff .diff.remove:before{content:\"-\"}.has-diff .diff.add:before{content:\"+\"}.has-diff .diff.remove:after{content:\"\";z-index:-1;background:#ef444426;border-left:1px solid #ef4444cc;position:absolute;inset:0 -.875em}.has-diff .diff.add:after{content:\"\";z-index:-1;background:#22c55e26;border-left:1px solid #22c55ecc;position:absolute;inset:0 -.875em}.has-focused .line:not(.focused){opacity:.7;filter:blur(.095rem);transition:filter .35s,opacity .35s}.has-focused:hover .line:not(.focused){opacity:1;filter:blur()}.has-highlighted .highlighted:after{content:\"\";z-index:-1;background:#65758529;border-left:1px solid #22c55ecc;position:absolute;inset:0 -.875em}.has-highlighted .highlighted.error:after{background:#f43f5e29!important;border-left:1px solid #f43f5ecc!important}.has-highlighted .highlighted.warning:after{background:#eab30829!important;border-left:1px solid #eab308cc!important}.has-highlighted .highlighted.info:after{background:#65758529!important;border-left:1px solid #657585cc!important}:host([color-scheme=dark]) .shiki,:host([color-scheme=dark]) .shiki span{color:var(--shiki-dark)!important}:host([color-scheme=dark]) .shiki{background-color:var(--shiki-dark-bg)!important}";
|
|
596
|
+
function Ee(e, t) {
|
|
597
|
+
if (navigator.clipboard) navigator.clipboard.writeText(e).then(() => {
|
|
598
|
+
t();
|
|
622
599
|
});
|
|
623
600
|
else {
|
|
624
|
-
let
|
|
625
|
-
|
|
601
|
+
let n = document.createElement("textarea");
|
|
602
|
+
n.value = e, n.style.position = "fixed", n.style.opacity = "0", document.body.appendChild(n), n.focus(), n.select();
|
|
626
603
|
try {
|
|
627
|
-
document.execCommand("copy") &&
|
|
628
|
-
} catch (
|
|
629
|
-
console.error("Fallback: Oops, unable to copy",
|
|
604
|
+
document.execCommand("copy") && t();
|
|
605
|
+
} catch (e) {
|
|
606
|
+
console.error("Fallback: Oops, unable to copy", e);
|
|
630
607
|
}
|
|
631
|
-
document.body.removeChild(
|
|
608
|
+
document.body.removeChild(n);
|
|
632
609
|
}
|
|
633
610
|
}
|
|
634
|
-
function
|
|
635
|
-
var
|
|
636
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
637
|
-
else for (var
|
|
638
|
-
return
|
|
611
|
+
function Z(e, t, n, r) {
|
|
612
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
613
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
614
|
+
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
615
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
639
616
|
}
|
|
640
|
-
var
|
|
641
|
-
constructor(...
|
|
642
|
-
super(...
|
|
617
|
+
var Q = class extends G {
|
|
618
|
+
constructor(...e) {
|
|
619
|
+
super(...e), this.options = {
|
|
643
620
|
html: "",
|
|
644
621
|
languageName: "Unknown",
|
|
645
622
|
colorScheme: "light",
|
|
@@ -647,24 +624,24 @@ var ShikiCodeBaseVariant = class extends i$1 {
|
|
|
647
624
|
fontSize: "0.875em"
|
|
648
625
|
}, this.copied = !1;
|
|
649
626
|
}
|
|
650
|
-
updated(
|
|
651
|
-
|
|
627
|
+
updated(e) {
|
|
628
|
+
e.has("options") && (this.setAttribute("color-scheme", this.options.colorScheme), this.style.setProperty("--shiki-theme-type", this.options.theme?.type || "light"), this.style.setProperty("--font-size", this.options.fontSize || "0.875em"));
|
|
652
629
|
}
|
|
653
630
|
handleCopyCode() {
|
|
654
|
-
let
|
|
655
|
-
|
|
631
|
+
let e = this.shadowRoot?.querySelector("pre");
|
|
632
|
+
Ee(e?.innerText || e?.textContent || "", () => {
|
|
656
633
|
this.copied = !0, setTimeout(() => {
|
|
657
634
|
this.copied = !1;
|
|
658
635
|
}, 2e3);
|
|
659
636
|
});
|
|
660
637
|
}
|
|
661
638
|
};
|
|
662
|
-
|
|
663
|
-
var
|
|
639
|
+
Z([K({ type: Object })], Q.prototype, "options", void 0), Z([q()], Q.prototype, "copied", void 0);
|
|
640
|
+
var De = class extends Q {
|
|
664
641
|
render() {
|
|
665
|
-
return
|
|
642
|
+
return P`
|
|
666
643
|
<div class="shadow rounded-lg relative group">
|
|
667
|
-
${
|
|
644
|
+
${Y(this.options.html)}
|
|
668
645
|
<div
|
|
669
646
|
class="absolute select-none top-1 text-xs right-2 group-hover:opacity-0 transition-opacity"
|
|
670
647
|
style="color: ${this.options.theme?.fg}"
|
|
@@ -677,16 +654,16 @@ var ShikiCodeSimpleVariant = class extends ShikiCodeBaseVariant {
|
|
|
677
654
|
@click=${this.handleCopyCode}
|
|
678
655
|
tabindex="-1"
|
|
679
656
|
>
|
|
680
|
-
${
|
|
657
|
+
${X(this.copied, () => P`<i class="i-tabler-check block" style="color: ${this.options.theme?.fg}"></i>`, () => P`<i class="i-tabler-copy block" style="color: ${this.options.theme?.fg}"></i>`)}
|
|
681
658
|
</button>
|
|
682
659
|
</div>
|
|
683
660
|
`;
|
|
684
661
|
}
|
|
685
662
|
static {
|
|
686
663
|
this.styles = [
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
664
|
+
o(e),
|
|
665
|
+
o(Te),
|
|
666
|
+
s`
|
|
690
667
|
.shiki {
|
|
691
668
|
border-radius: inherit;
|
|
692
669
|
}
|
|
@@ -721,13 +698,13 @@ var ShikiCodeSimpleVariant = class extends ShikiCodeBaseVariant {
|
|
|
721
698
|
];
|
|
722
699
|
}
|
|
723
700
|
};
|
|
724
|
-
customElements.get("shiki-code-simple-variant") || customElements.define("shiki-code-simple-variant",
|
|
725
|
-
var
|
|
726
|
-
constructor(...
|
|
727
|
-
super(...
|
|
701
|
+
customElements.get("shiki-code-simple-variant") || customElements.define("shiki-code-simple-variant", De);
|
|
702
|
+
var Oe = class extends Q {
|
|
703
|
+
constructor(...e) {
|
|
704
|
+
super(...e), this.fold = !1;
|
|
728
705
|
}
|
|
729
706
|
render() {
|
|
730
|
-
return
|
|
707
|
+
return P`
|
|
731
708
|
<div class="shadow rounded-lg overflow-hidden relative group">
|
|
732
709
|
<header
|
|
733
710
|
class="flex items-center h-10 justify-between px-4.5 opacity-95"
|
|
@@ -749,28 +726,28 @@ var ShikiCodeMacVariant = class extends ShikiCodeBaseVariant {
|
|
|
749
726
|
this.fold = !this.fold;
|
|
750
727
|
}}
|
|
751
728
|
>
|
|
752
|
-
${
|
|
729
|
+
${X(this.fold, () => P`<i
|
|
753
730
|
class="i-mingcute-left-line block"
|
|
754
731
|
style="color: ${this.options.theme?.fg}"
|
|
755
|
-
></i>`, () =>
|
|
732
|
+
></i>`, () => P`<i
|
|
756
733
|
class="i-mingcute-down-line block"
|
|
757
734
|
style="color: ${this.options.theme?.fg}"
|
|
758
735
|
></i>`)}
|
|
759
736
|
</button>
|
|
760
737
|
<button class="select-none" tabindex="-1" @click=${this.handleCopyCode}>
|
|
761
|
-
${
|
|
738
|
+
${X(this.copied, () => P`<i class="i-tabler-check block" style="color: ${this.options.theme?.fg}"></i>`, () => P`<i class="i-tabler-copy block" style="color: ${this.options.theme?.fg}"></i>`)}
|
|
762
739
|
</button>
|
|
763
740
|
</div>
|
|
764
741
|
</header>
|
|
765
|
-
${
|
|
742
|
+
${X(this.fold, () => P``, () => P`${Y(this.options.html)}`)}
|
|
766
743
|
</div>
|
|
767
744
|
`;
|
|
768
745
|
}
|
|
769
746
|
static {
|
|
770
747
|
this.styles = [
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
748
|
+
o(e),
|
|
749
|
+
o(Te),
|
|
750
|
+
s`
|
|
774
751
|
/* layer: preflights */
|
|
775
752
|
*,::before,::after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}
|
|
776
753
|
/* layer: icons */
|
|
@@ -804,10 +781,10 @@ var ShikiCodeMacVariant = class extends ShikiCodeBaseVariant {
|
|
|
804
781
|
];
|
|
805
782
|
}
|
|
806
783
|
};
|
|
807
|
-
|
|
808
|
-
var
|
|
809
|
-
constructor(...
|
|
810
|
-
super(...
|
|
784
|
+
Z([q()], Oe.prototype, "fold", void 0), customElements.get("shiki-code-mac-variant") || customElements.define("shiki-code-mac-variant", Oe);
|
|
785
|
+
var $ = class extends G {
|
|
786
|
+
constructor(...e) {
|
|
787
|
+
super(...e), this.lightTheme = "github-light", this.darkTheme = "github-dark", this.variant = "simple", this.fontSize = "0.875em", this.loading = !0, this.html = "", this.languageCode = "", this.languageName = "", this.lightThemeRegistration = null, this.darkThemeRegistration = null, this.code = "", this.copied = !1, this.error = "", this._observer = null, this._media = null, this._colorScheme = "light";
|
|
811
788
|
}
|
|
812
789
|
get _themeRegistration() {
|
|
813
790
|
return this._colorScheme === "dark" ? this.darkThemeRegistration : this.lightThemeRegistration;
|
|
@@ -825,79 +802,79 @@ var ShikiCode = class extends i$1 {
|
|
|
825
802
|
this._observer?.disconnect(), this._media?.removeEventListener("change", () => this.updateTheme()), super.disconnectedCallback();
|
|
826
803
|
}
|
|
827
804
|
isDarkMode() {
|
|
828
|
-
let
|
|
829
|
-
return
|
|
805
|
+
let e = document.documentElement, t = document.body, n = (e, t) => e?.classList.contains(t), r = (e, t, n) => e?.getAttribute(t) === n;
|
|
806
|
+
return n(e, "color-scheme-auto") || n(t, "color-scheme-auto") || r(e, "data-color-scheme", "auto") || r(t, "data-color-scheme", "auto") ? this._media?.matches : !!(n(e, "color-scheme-dark") || n(e, "dark") || r(e, "data-color-scheme", "dark") || n(t, "color-scheme-dark") || n(t, "dark") || r(t, "data-color-scheme", "dark"));
|
|
830
807
|
}
|
|
831
808
|
updateTheme() {
|
|
832
809
|
this._colorScheme = this.isDarkMode() ? "dark" : "light";
|
|
833
810
|
}
|
|
834
811
|
render() {
|
|
835
|
-
return
|
|
812
|
+
return P`<slot @slotchange=${this.handleSlotchange}></slot> ${this.renderCodeBlockBody()}`;
|
|
836
813
|
}
|
|
837
814
|
renderCodeBlockBody() {
|
|
838
|
-
if (this.loading) return
|
|
839
|
-
if (this.error) return
|
|
840
|
-
let
|
|
815
|
+
if (this.loading) return P``;
|
|
816
|
+
if (this.error) return P`<div class="text-sm text-red-500">错误: ${this.error}</div>`;
|
|
817
|
+
let e = {
|
|
841
818
|
html: this.html,
|
|
842
819
|
languageName: this.languageName,
|
|
843
820
|
colorScheme: this._colorScheme,
|
|
844
821
|
theme: this._themeRegistration,
|
|
845
822
|
fontSize: this.fontSize
|
|
846
823
|
};
|
|
847
|
-
if (this.variant === "mac") return
|
|
848
|
-
if (this.variant === "simple") return
|
|
849
|
-
}
|
|
850
|
-
handleSlotchange(
|
|
851
|
-
let
|
|
852
|
-
if (!
|
|
853
|
-
let
|
|
854
|
-
if (
|
|
855
|
-
let
|
|
856
|
-
|
|
824
|
+
if (this.variant === "mac") return P`<shiki-code-mac-variant .options=${e}></shiki-code-mac-variant>`;
|
|
825
|
+
if (this.variant === "simple") return P`<shiki-code-simple-variant .options=${e}></shiki-code-simple-variant>`;
|
|
826
|
+
}
|
|
827
|
+
handleSlotchange(e) {
|
|
828
|
+
let t = e.target.assignedElements({ flatten: !0 });
|
|
829
|
+
if (!t.length) return;
|
|
830
|
+
let n = t[0];
|
|
831
|
+
if (n.tagName === "PRE") {
|
|
832
|
+
let e = n.querySelector("code");
|
|
833
|
+
e && this.process(e);
|
|
857
834
|
}
|
|
858
835
|
}
|
|
859
|
-
async process(
|
|
836
|
+
async process(e) {
|
|
860
837
|
try {
|
|
861
|
-
this.languageCode = this.extractLanguageCode(
|
|
862
|
-
let { getSingletonHighlighter:
|
|
863
|
-
this.languageCode === "plaintext" ? this.languageName = "plaintext" : this.languageName =
|
|
864
|
-
} catch (
|
|
865
|
-
|
|
838
|
+
this.languageCode = this.extractLanguageCode(e.classList) || "plaintext", this.languageCode === "auto" && (this.languageCode = "plaintext"), this.languageCode === "text" && (this.languageCode = "plaintext"), this.code = e.textContent || "", this.html = await this.renderCodeAsHtml(this.code || "", this.languageCode);
|
|
839
|
+
let { getSingletonHighlighter: t } = await import("shiki"), n = await t();
|
|
840
|
+
this.languageCode === "plaintext" ? this.languageName = "plaintext" : this.languageName = n.getLanguage(this.languageCode).name, this.lightThemeRegistration = n.getTheme(this.lightTheme), this.darkThemeRegistration = n.getTheme(this.darkTheme || this.lightTheme);
|
|
841
|
+
} catch (e) {
|
|
842
|
+
e instanceof Error && (this.error = e.message);
|
|
866
843
|
} finally {
|
|
867
|
-
this.shadowRoot?.querySelector("slot")?.assignedElements().forEach((
|
|
868
|
-
|
|
844
|
+
this.shadowRoot?.querySelector("slot")?.assignedElements().forEach((e) => {
|
|
845
|
+
e instanceof HTMLElement && e.setAttribute("style", "display: none !important;");
|
|
869
846
|
}), this.loading = !1;
|
|
870
847
|
}
|
|
871
848
|
}
|
|
872
|
-
extractLanguageCode(
|
|
873
|
-
let
|
|
874
|
-
for (let
|
|
875
|
-
let
|
|
876
|
-
for (let
|
|
877
|
-
let
|
|
878
|
-
if (
|
|
849
|
+
extractLanguageCode(e) {
|
|
850
|
+
let t = ["language-", "lang-"];
|
|
851
|
+
for (let n = 0; n < e.length; n++) {
|
|
852
|
+
let r = e[n];
|
|
853
|
+
for (let e = 0; e < t.length; e++) {
|
|
854
|
+
let n = t[e];
|
|
855
|
+
if (r.startsWith(n)) return r.substring(n.length).toLowerCase();
|
|
879
856
|
}
|
|
880
857
|
}
|
|
881
858
|
return null;
|
|
882
859
|
}
|
|
883
|
-
async renderCodeAsHtml(
|
|
884
|
-
let { codeToHtml:
|
|
885
|
-
return await
|
|
886
|
-
lang:
|
|
860
|
+
async renderCodeAsHtml(e, t) {
|
|
861
|
+
let { codeToHtml: n } = await import("shiki"), { transformerNotationDiff: r, transformerNotationHighlight: i, transformerNotationFocus: a, transformerNotationErrorLevel: o } = await import("@shikijs/transformers");
|
|
862
|
+
return await n(e, {
|
|
863
|
+
lang: t,
|
|
887
864
|
themes: {
|
|
888
865
|
light: this.lightTheme,
|
|
889
866
|
dark: this.darkTheme || this.lightTheme
|
|
890
867
|
},
|
|
891
868
|
transformers: [
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
869
|
+
r(),
|
|
870
|
+
i(),
|
|
871
|
+
a(),
|
|
872
|
+
o()
|
|
896
873
|
]
|
|
897
874
|
});
|
|
898
875
|
}
|
|
899
876
|
static {
|
|
900
|
-
this.styles = [
|
|
877
|
+
this.styles = [o(e), s`
|
|
901
878
|
:host {
|
|
902
879
|
display: block;
|
|
903
880
|
margin: 1rem 0 !important;
|
|
@@ -915,14 +892,14 @@ var ShikiCode = class extends i$1 {
|
|
|
915
892
|
`];
|
|
916
893
|
}
|
|
917
894
|
};
|
|
918
|
-
|
|
895
|
+
Z([K({
|
|
919
896
|
type: String,
|
|
920
897
|
attribute: "light-theme"
|
|
921
|
-
})],
|
|
898
|
+
})], $.prototype, "lightTheme", void 0), Z([K({
|
|
922
899
|
type: String,
|
|
923
900
|
attribute: "dark-theme"
|
|
924
|
-
})],
|
|
901
|
+
})], $.prototype, "darkTheme", void 0), Z([K({ type: String })], $.prototype, "variant", void 0), Z([K({
|
|
925
902
|
type: String,
|
|
926
903
|
attribute: "font-size"
|
|
927
|
-
})],
|
|
928
|
-
export { ShikiCode };
|
|
904
|
+
})], $.prototype, "fontSize", void 0), Z([q()], $.prototype, "loading", void 0), Z([q()], $.prototype, "html", void 0), Z([q()], $.prototype, "languageCode", void 0), Z([q()], $.prototype, "languageName", void 0), Z([q()], $.prototype, "lightThemeRegistration", void 0), Z([q()], $.prototype, "darkThemeRegistration", void 0), Z([q()], $.prototype, "code", void 0), Z([q()], $.prototype, "copied", void 0), Z([q()], $.prototype, "error", void 0), Z([q()], $.prototype, "_colorScheme", void 0), customElements.get("shiki-code") || customElements.define("shiki-code", $);
|
|
905
|
+
export { $ as ShikiCode };
|