dopaminejs 3.6.0 → 3.7.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/README.md +39 -0
- package/dist/celebrate.cjs +1 -1
- package/dist/celebrate.js +6 -3
- package/dist/certificate.cjs +1 -0
- package/dist/certificate.js +234 -0
- package/dist/dopamine.cjs +1 -1
- package/dist/dopamine.global.js +4 -4
- package/dist/dopamine.js +1 -1
- package/dist/host-BWKiYtjY.cjs +37 -0
- package/dist/{host-B-Gn-Zg_.js → host-Bhf9EqSk.js} +103 -183
- package/dist/icon-BakWSiz_.js +89 -0
- package/dist/icon-gkpxMw48.cjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.js +1 -1
- package/package.json +6 -1
- package/src/celebrate.js +11 -6
- package/src/certificate.js +391 -0
- package/src/dopamine/ui/RewardUI.js +3 -148
- package/src/dopamine/ui/icon.js +157 -0
- package/types/celebrate.d.ts +8 -0
- package/types/certificate.d.ts +30 -0
- package/dist/host-D6suk7Ci.cjs +0 -37
|
@@ -1,119 +1,39 @@
|
|
|
1
1
|
import { a as e, n as t, o as n, t as r } from "./DataService-B5noGvMr.js";
|
|
2
|
-
import { n as i
|
|
3
|
-
import { n as s } from "./
|
|
2
|
+
import { n as i } from "./icon-BakWSiz_.js";
|
|
3
|
+
import { n as a, r as o, t as s } from "./SoundManager-C6VdZEFo.js";
|
|
4
|
+
import { n as c } from "./storage-C2s4Da9b.js";
|
|
4
5
|
// src/dopamine/ui/dopamine.css?inline
|
|
5
|
-
var
|
|
6
|
+
var l = "#game-ui-overlay,.game-ui-overlay{pointer-events:none;z-index:1000;width:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;position:fixed;top:0;left:0}.game-ui-top-bar{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#0000004d;align-items:center;gap:12px;padding:12px 16px;display:flex}.level-badge{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);border-radius:12px;flex-direction:column;align-items:center;min-width:60px;padding:8px 12px;display:flex;box-shadow:0 4px 12px #667eea66}.level-label{color:#fffc;letter-spacing:.5px;font-size:10px;font-weight:600}.level-number{color:#fff;font-size:24px;font-weight:800;line-height:1}.xp-container{flex-direction:column;flex:1;gap:4px;display:flex}.xp-bar-bg{background:#fff3;border-radius:6px;height:12px;overflow:hidden;box-shadow:inset 0 2px 4px #0003}.xp-bar-fill{background:linear-gradient(90deg,#4facfe 0%,#00f2fe 100%);border-radius:6px;height:100%;transition:width .5s ease-out;box-shadow:0 0 10px #4facfe99}.xp-text{color:#fff;text-align:center;text-shadow:0 1px 2px #00000080;font-size:11px;font-weight:600}.streak-badge{background:linear-gradient(135deg,#f80 0%,#f40 100%);border-radius:12px;align-items:center;gap:6px;padding:8px 12px;display:flex;box-shadow:0 4px 12px #f806}.streak-icon{font-size:20px;animation:2s infinite flicker}.streak-number{color:#fff;font-size:18px;font-weight:800}.achievement-popup{top:calc(var(--dopamine-toast-top,80px) + env(safe-area-inset-top,0px));right:var(--dopamine-toast-right,20px);left:var(--dopamine-toast-left,auto);background:var(--dopamine-toast-bg,linear-gradient(135deg, #667eea 0%, #764ba2 100%));border-radius:var(--dopamine-toast-radius,16px);box-shadow:var(--dopamine-toast-shadow,0 8px 32px #0006);z-index:10000;max-width:var(--dopamine-toast-max-width,320px);padding:16px;animation:.5s cubic-bezier(.68,-.55,.265,1.55) slideIn;position:fixed;overflow:hidden}.achievement-shine{background:linear-gradient(90deg,#0000,#ffffff4d,#0000);width:100%;height:100%;animation:2s infinite shine;position:absolute;top:0;left:-100%}.achievement-content{align-items:center;gap:12px;display:flex;position:relative}.achievement-icon{font-size:48px;animation:.6s ease-out bounce}.achievement-info{flex:1}.achievement-title{color:var(--dopamine-toast-muted,#ffffffe6);text-transform:uppercase;letter-spacing:.5px;font-size:12px;font-weight:600}.achievement-name{color:var(--dopamine-toast-text,white);margin:2px 0;font-size:18px;font-weight:800}.achievement-desc{color:var(--dopamine-toast-muted,#fffc);margin-bottom:4px;font-size:13px}.achievement-xp{color:var(--dopamine-toast-accent,gold);background:#fff3;border-radius:8px;padding:4px 8px;font-size:12px;font-weight:700;display:inline-block}.level-up-overlay{z-index:10001;background:#000000d9;justify-content:center;align-items:center;width:100%;height:100%;animation:.3s ease-out fadeIn;display:flex;position:fixed;top:0;left:0}.level-up-content{text-align:center;animation:.5s cubic-bezier(.68,-.55,.265,1.55) scaleIn}.level-up-title{background:linear-gradient(135deg,gold 0%,#ffed4e 100%);-webkit-text-fill-color:transparent;text-transform:uppercase;letter-spacing:4px;-webkit-background-clip:text;background-clip:text;margin-bottom:16px;font-size:32px;font-weight:800}.level-up-number{color:#fff;text-shadow:0 0 20px #ffd700cc,0 0 40px #ffd70099,0 0 60px #ffd70066;font-size:120px;font-weight:900;animation:1s ease-in-out infinite alternate glow}.level-up-subtitle{color:#fffc;margin-top:16px;font-size:24px;font-weight:600}.floating-text{text-shadow:2px 2px #000,-1px -1px #000,1px -1px #000,-1px 1px #000;pointer-events:none;z-index:9998;font-weight:800;animation:2s ease-out forwards floatUp;position:fixed}@keyframes slideIn{0%{opacity:0;transform:translate(400px)}to{opacity:1;transform:translate(0)}}@keyframes slideOut{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(400px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes scaleIn{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}@keyframes bounce{0%,to{transform:translateY(0)}50%{transform:translateY(-10px)}}@keyframes glow{0%{text-shadow:0 0 20px #ffd700cc,0 0 40px #ffd70099,0 0 60px #ffd70066}to{text-shadow:0 0 30px gold,0 0 60px #ffd700cc,0 0 90px #ffd70099}}@keyframes shine{0%{left:-100%}30%{left:100%}to{left:100%}}@keyframes flicker{0%,to{opacity:1}50%{opacity:.8}}@keyframes floatUp{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-100px)}}@keyframes xp-pulse{0%{transform:scaleY(1)}50%{transform:scaleY(1.2)}to{transform:scaleY(1)}}@keyframes level-pulse{0%{transform:scale(1)}50%{transform:scale(1.1)}to{transform:scale(1)}}@media (width<=480px){.game-ui-top-bar{gap:8px;padding:10px 12px}.level-badge{min-width:50px;padding:6px 10px}.level-number{font-size:20px}.xp-bar-bg{height:10px}.xp-text{font-size:10px}.achievement-popup{right:var(--dopamine-toast-right,12px);max-width:min(var(--dopamine-toast-max-width,320px), calc(100% - 24px))}.level-up-number{font-size:80px}}@media (prefers-reduced-motion:reduce){.game-ui-overlay *,.achievement-popup,.achievement-popup *,.level-up-overlay,.level-up-overlay *{transition:none!important;animation:none!important}.floating-text{animation:none!important}}", u = "game-ui-overlay", d = {
|
|
6
7
|
levelUp: "LEVEL UP!",
|
|
7
8
|
achievementUnlocked: "Achievement Unlocked!"
|
|
8
|
-
},
|
|
9
|
-
"svg",
|
|
10
|
-
"g",
|
|
11
|
-
"path",
|
|
12
|
-
"circle",
|
|
13
|
-
"ellipse",
|
|
14
|
-
"rect",
|
|
15
|
-
"line",
|
|
16
|
-
"polyline",
|
|
17
|
-
"polygon",
|
|
18
|
-
"text",
|
|
19
|
-
"tspan",
|
|
20
|
-
"title",
|
|
21
|
-
"desc",
|
|
22
|
-
"defs",
|
|
23
|
-
"linearGradient",
|
|
24
|
-
"radialGradient",
|
|
25
|
-
"stop",
|
|
26
|
-
"clipPath",
|
|
27
|
-
"mask"
|
|
28
|
-
]), v = /* @__PURE__ */ new Set(/* @__PURE__ */ "viewBox.width.height.x.y.x1.y1.x2.y2.cx.cy.r.rx.ry.d.points.transform.fill.fill-opacity.fill-rule.stroke.stroke-width.stroke-linecap.stroke-linejoin.stroke-opacity.opacity.offset.stop-color.stop-opacity.gradientUnits.gradientTransform.clip-path.mask.clip-rule.font-size.font-family.font-weight.text-anchor.id.aria-hidden.aria-label.role".split(".")), y = /* @__PURE__ */ new Set([
|
|
29
|
-
"fill",
|
|
30
|
-
"stroke",
|
|
31
|
-
"clip-path",
|
|
32
|
-
"mask"
|
|
33
|
-
]), b = /* @__PURE__ */ new Set(["transform", "gradientTransform"]), x = /^url\(\s*#([A-Za-z][\w.:-]*)\s*\)$/, S = /^[#a-zA-Z0-9(),.%\s-]+$/, C = /^[a-zA-Z0-9(),.\s-]+$/, w = /^[A-Za-z][\w.:-]*$/, T = 0;
|
|
34
|
-
function E(e, t) {
|
|
35
|
-
if (e.nodeType !== 1 || e.namespaceURI !== g || !_.has(e.localName)) return;
|
|
36
|
-
let n = e.getAttribute("id");
|
|
37
|
-
n && w.test(n) && t.add(n);
|
|
38
|
-
for (let n of Array.from(e.childNodes)) E(n, t);
|
|
39
|
-
}
|
|
40
|
-
function D(e, t, n) {
|
|
41
|
-
if (t.includes("\\")) return null;
|
|
42
|
-
let r = t.trim();
|
|
43
|
-
if (e === "id") return w.test(r) ? n.prefix + r : null;
|
|
44
|
-
if (y.has(e)) {
|
|
45
|
-
let e = x.exec(r);
|
|
46
|
-
return e ? n.ids.has(e[1]) ? `url(#${n.prefix}${e[1]})` : null : S.test(r) && !/url/i.test(r) ? r : null;
|
|
47
|
-
}
|
|
48
|
-
return b.has(e) ? C.test(r) && !/url/i.test(r) ? r : null : t.includes("(") ? e === "stop-color" && S.test(r) && !/url/i.test(r) ? r : null : t;
|
|
49
|
-
}
|
|
50
|
-
function O(e, t) {
|
|
51
|
-
if (e.nodeType === 3 || e.nodeType === 4) return document.createTextNode(e.data);
|
|
52
|
-
if (e.nodeType !== 1 || e.namespaceURI !== g || !_.has(e.localName)) return null;
|
|
53
|
-
let n = document.createElementNS(g, e.localName);
|
|
54
|
-
for (let r of Array.from(e.attributes)) {
|
|
55
|
-
if (r.namespaceURI !== null || !v.has(r.name)) continue;
|
|
56
|
-
let e = D(r.name, r.value, t);
|
|
57
|
-
e !== null && n.setAttribute(r.name, e);
|
|
58
|
-
}
|
|
59
|
-
for (let r of Array.from(e.childNodes)) {
|
|
60
|
-
let e = O(r, t);
|
|
61
|
-
e && n.appendChild(e);
|
|
62
|
-
}
|
|
63
|
-
return n;
|
|
64
|
-
}
|
|
65
|
-
function k(e) {
|
|
66
|
-
let t, n = /^\s*<svg[\s>]/.test(e) && !/^\s*<svg\b[^>]*\sxmlns\s*=/.test(e) ? e.replace(/^(\s*<svg)/, `$1 xmlns="${g}"`) : e;
|
|
67
|
-
try {
|
|
68
|
-
t = new DOMParser().parseFromString(n, "image/svg+xml");
|
|
69
|
-
} catch {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
let r = t.documentElement;
|
|
73
|
-
if (!r || r.localName !== "svg" || t.getElementsByTagName("parsererror").length > 0) return null;
|
|
74
|
-
let i = /* @__PURE__ */ new Set();
|
|
75
|
-
return E(r, i), O(r, {
|
|
76
|
-
ids: i,
|
|
77
|
-
prefix: `dj-icon-${++T}-`
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
var A = class {
|
|
9
|
+
}, f = "dopamine-reward-ui-css", p = "🔥", m = (e) => e == null ? "" : String(e), h = (e, t) => Object.prototype.hasOwnProperty.call(e, t), g = (e, t) => typeof e == "object" && e && h(e, t) ? e[t] : void 0, _ = class {
|
|
81
10
|
constructor(e = {}, t = {}) {
|
|
82
11
|
this.parts = e || {};
|
|
83
|
-
let n =
|
|
84
|
-
this.strings = { ...
|
|
85
|
-
for (let e of Object.keys(
|
|
86
|
-
let t =
|
|
12
|
+
let n = g(t, "text");
|
|
13
|
+
this.strings = { ...d };
|
|
14
|
+
for (let e of Object.keys(d)) {
|
|
15
|
+
let t = g(n, e);
|
|
87
16
|
typeof t == "string" && (this.strings[e] = t);
|
|
88
17
|
}
|
|
89
|
-
this.safeIcons =
|
|
18
|
+
this.safeIcons = g(t, "safeIcons") !== !1, this._streakIcon = g(g(t, "icons"), "streak") ?? p, this._injectCss = g(t, "injectCss"), this.container = null, this.xpBar = null, this.levelDisplay = null, this.streakDisplay = null, this._style = null, this._xp = null, this._level = null, this._timers = /* @__PURE__ */ new Set(), this._detached = [], this._cardQueue = [], this._cardActive = !1, this._build();
|
|
90
19
|
}
|
|
91
20
|
get root() {
|
|
92
21
|
return this.container;
|
|
93
22
|
}
|
|
94
23
|
_build() {
|
|
95
|
-
this._injectCss && this._addStyles(), this.container = document.createElement("div"), this.container.className = "game-ui-overlay", document.getElementById(
|
|
24
|
+
this._injectCss && this._addStyles(), this.container = document.createElement("div"), this.container.className = "game-ui-overlay", document.getElementById(u) || (this.container.id = u), this.container.innerHTML = "\n <div class=\"game-ui-top-bar\">\n <div class=\"level-badge\">\n <span class=\"level-label\">LVL</span>\n <span class=\"level-number\">1</span>\n </div>\n\n <div class=\"xp-container\">\n <div class=\"xp-bar-bg\">\n <div class=\"xp-bar-fill\" style=\"width: 0%\"></div>\n </div>\n <div class=\"xp-text\">0 / 100 XP</div>\n </div>\n\n <div class=\"streak-badge\">\n <span class=\"streak-icon\"></span>\n <span class=\"streak-number\">1</span>\n </div>\n </div>\n ", this.liveRegion = document.createElement("div"), this.liveRegion.className = "dopamine-live-region", this.liveRegion.setAttribute("aria-live", "polite"), this.liveRegion.setAttribute("role", "status"), Object.assign(this.liveRegion.style, {
|
|
96
25
|
position: "absolute",
|
|
97
26
|
width: "1px",
|
|
98
27
|
height: "1px",
|
|
99
28
|
overflow: "hidden",
|
|
100
29
|
clipPath: "inset(50%)",
|
|
101
30
|
whiteSpace: "nowrap"
|
|
102
|
-
}), this.container.appendChild(this.liveRegion), document.body.appendChild(this.container), this.levelBadge = this.container.querySelector(".level-badge"), this.streakBadge = this.container.querySelector(".streak-badge"), this.xpBar = this.container.querySelector(".xp-bar-fill"), this.xpText = this.container.querySelector(".xp-text"), this.levelDisplay = this.container.querySelector(".level-number"), this.streakDisplay = this.container.querySelector(".streak-number"),
|
|
31
|
+
}), this.container.appendChild(this.liveRegion), document.body.appendChild(this.container), this.levelBadge = this.container.querySelector(".level-badge"), this.streakBadge = this.container.querySelector(".streak-badge"), this.xpBar = this.container.querySelector(".xp-bar-fill"), this.xpText = this.container.querySelector(".xp-text"), this.levelDisplay = this.container.querySelector(".level-number"), this.streakDisplay = this.container.querySelector(".streak-number"), i(this.container.querySelector(".streak-icon"), this._streakIcon, this.safeIcons);
|
|
103
32
|
}
|
|
104
33
|
_addStyles() {
|
|
105
|
-
if (document.getElementById(
|
|
106
|
-
let e = typeof this._injectCss == "string" ? this._injectCss :
|
|
107
|
-
this._style = document.createElement("style"), this._style.id =
|
|
108
|
-
}
|
|
109
|
-
_setIcon(e, t) {
|
|
110
|
-
if (e.textContent = "", typeof Node < "u" && t instanceof Node) e.appendChild(t);
|
|
111
|
-
else if (typeof t != "string") return;
|
|
112
|
-
else if (!this.safeIcons) e.innerHTML = t;
|
|
113
|
-
else {
|
|
114
|
-
let n = k(t);
|
|
115
|
-
n ? e.appendChild(n) : e.textContent = t;
|
|
116
|
-
}
|
|
34
|
+
if (document.getElementById(f)) return;
|
|
35
|
+
let e = typeof this._injectCss == "string" ? this._injectCss : l;
|
|
36
|
+
this._style = document.createElement("style"), this._style.id = f, this._style.textContent = e, document.head.appendChild(this._style);
|
|
117
37
|
}
|
|
118
38
|
_defer(e, t) {
|
|
119
39
|
let n = setTimeout(() => {
|
|
@@ -142,7 +62,7 @@ var A = class {
|
|
|
142
62
|
}
|
|
143
63
|
popup(e) {
|
|
144
64
|
if (!this.container || !e || typeof e != "object") return;
|
|
145
|
-
let t =
|
|
65
|
+
let t = g(e, "kind");
|
|
146
66
|
t === "level" ? this._levelPopup(e) : t === "notice" ? this._notice(e) : this._card(e, t === "achievement");
|
|
147
67
|
}
|
|
148
68
|
_card(e, t) {
|
|
@@ -152,7 +72,7 @@ var A = class {
|
|
|
152
72
|
body: r,
|
|
153
73
|
meta: i,
|
|
154
74
|
icon: a,
|
|
155
|
-
burst:
|
|
75
|
+
burst: g(e, "burst")
|
|
156
76
|
}, t]), this._nextCard();
|
|
157
77
|
}
|
|
158
78
|
_nextCard() {
|
|
@@ -170,8 +90,8 @@ var A = class {
|
|
|
170
90
|
_showCard(e, t) {
|
|
171
91
|
let n = document.createElement("div");
|
|
172
92
|
n.className = "achievement-popup", n.innerHTML = "\n <div class=\"achievement-shine\"></div>\n <div class=\"achievement-content\">\n <div class=\"achievement-icon\"></div>\n <div class=\"achievement-info\">\n <div class=\"achievement-title\"></div>\n <div class=\"achievement-name\"></div>\n <div class=\"achievement-desc\"></div>\n <div class=\"achievement-xp\"></div>\n </div>\n </div>\n ";
|
|
173
|
-
let r =
|
|
174
|
-
n.querySelector(".achievement-title").textContent = t ? this.strings.achievementUnlocked : "",
|
|
93
|
+
let r = m(e.title);
|
|
94
|
+
n.querySelector(".achievement-title").textContent = t ? this.strings.achievementUnlocked : "", i(n.querySelector(".achievement-icon"), e.icon, this.safeIcons), n.querySelector(".achievement-name").textContent = r, n.querySelector(".achievement-desc").textContent = m(e.body), n.querySelector(".achievement-xp").textContent = m(e.meta), this._mount(n), this._announce(t ? `${this.strings.achievementUnlocked}: ${r}` : r), e.burst !== !1 && this._defer(() => {
|
|
175
95
|
let e = n.getBoundingClientRect();
|
|
176
96
|
this._burst("confetti", {
|
|
177
97
|
x: e.left + e.width / 2,
|
|
@@ -184,7 +104,7 @@ var A = class {
|
|
|
184
104
|
}, 4e3);
|
|
185
105
|
}
|
|
186
106
|
_levelPopup(e) {
|
|
187
|
-
let t = typeof e.title == "string" && e.title !== "" ? e.title : this.strings.levelUp, n =
|
|
107
|
+
let t = typeof e.title == "string" && e.title !== "" ? e.title : this.strings.levelUp, n = m(e.body), r = document.createElement("div");
|
|
188
108
|
r.className = "level-up-overlay", r.innerHTML = "\n <div class=\"level-up-content\">\n <div class=\"level-up-title\"></div>\n <div class=\"level-up-number\"></div>\n <div class=\"level-up-subtitle\">Amazing progress!</div>\n </div>\n ", r.querySelector(".level-up-title").textContent = t, r.querySelector(".level-up-number").textContent = n, this._mount(r), this._announce(`Level up: ${n}`), this._defer(() => {
|
|
189
109
|
for (let e = 0; e < 5; e++) this._defer(() => {
|
|
190
110
|
this._burst("confetti", {
|
|
@@ -197,7 +117,7 @@ var A = class {
|
|
|
197
117
|
}, 2500);
|
|
198
118
|
}
|
|
199
119
|
_notice(e) {
|
|
200
|
-
let t = window.innerWidth / 2, n = window.innerHeight / 3, r =
|
|
120
|
+
let t = window.innerWidth / 2, n = window.innerHeight / 3, r = m(e.title);
|
|
201
121
|
e.tier === "legendary" ? (this._floatText({
|
|
202
122
|
text: r,
|
|
203
123
|
x: t,
|
|
@@ -233,7 +153,7 @@ var A = class {
|
|
|
233
153
|
_floatText({ text: e, x: t, y: n, color: r = "#ffd700", size: i = "24px" }) {
|
|
234
154
|
if (!this.container) return;
|
|
235
155
|
let a = document.createElement("div");
|
|
236
|
-
a.className = "floating-text", a.textContent =
|
|
156
|
+
a.className = "floating-text", a.textContent = m(e), a.style.left = (Number.isFinite(t) ? t : window.innerWidth / 2) + "px", a.style.top = (Number.isFinite(n) ? n : window.innerHeight / 3) + "px", a.style.color = r, a.style.fontSize = i, this._mount(a), this._defer(() => this._remove(a), 2e3);
|
|
237
157
|
}
|
|
238
158
|
_remove(e) {
|
|
239
159
|
e.remove();
|
|
@@ -248,7 +168,7 @@ var A = class {
|
|
|
248
168
|
}
|
|
249
169
|
};
|
|
250
170
|
// src/dopamine/feel/haptics.js
|
|
251
|
-
function
|
|
171
|
+
function v({ nav: e = globalThis.navigator, enabled: t = !0 } = {}) {
|
|
252
172
|
let n = !!t, r = (t) => {
|
|
253
173
|
if (n) try {
|
|
254
174
|
e.vibrate(t);
|
|
@@ -267,27 +187,27 @@ function j({ nav: e = globalThis.navigator, enabled: t = !0 } = {}) {
|
|
|
267
187
|
};
|
|
268
188
|
}
|
|
269
189
|
// src/dopamine/host.js
|
|
270
|
-
var
|
|
190
|
+
var y = 3, b = [
|
|
271
191
|
"ui",
|
|
272
192
|
"particles",
|
|
273
193
|
"sound",
|
|
274
194
|
"haptics"
|
|
275
|
-
],
|
|
276
|
-
|
|
195
|
+
], x = (e) => typeof e == "object" && !!e && typeof e.then == "function", S = (e, t) => {
|
|
196
|
+
x(e) && e.then(void 0, (e) => t.error(e));
|
|
277
197
|
};
|
|
278
|
-
function
|
|
198
|
+
function C() {
|
|
279
199
|
let e = typeof document < "u" && typeof window < "u";
|
|
280
200
|
return {
|
|
281
201
|
hasDom: e,
|
|
282
|
-
reducedMotion: e ?
|
|
202
|
+
reducedMotion: e ? o(window).matches === !0 : !1
|
|
283
203
|
};
|
|
284
204
|
}
|
|
285
|
-
function
|
|
205
|
+
function w(e, t, n) {
|
|
286
206
|
if (e === !1) return null;
|
|
287
207
|
let r = e;
|
|
288
208
|
return typeof e == "function" && (r = e(t)), r ?? n();
|
|
289
209
|
}
|
|
290
|
-
function
|
|
210
|
+
function T(e, t) {
|
|
291
211
|
let n = `dopamine_plugin_${t}:`;
|
|
292
212
|
return {
|
|
293
213
|
getItem: (t) => e.getItem(n + t),
|
|
@@ -295,20 +215,20 @@ function R(e, t) {
|
|
|
295
215
|
removeItem: (t) => e.removeItem(n + t)
|
|
296
216
|
};
|
|
297
217
|
}
|
|
298
|
-
function
|
|
299
|
-
let
|
|
218
|
+
function E(i = {}) {
|
|
219
|
+
let o = i || {}, l = C(), u = {
|
|
300
220
|
debug: () => {},
|
|
301
221
|
info: () => {},
|
|
302
222
|
warn: (...e) => console.warn(...e),
|
|
303
223
|
error: (...e) => console.error(...e),
|
|
304
|
-
...
|
|
305
|
-
}, d =
|
|
224
|
+
...o.log || {}
|
|
225
|
+
}, d = o.storage || c(), f = o.clock || e, p = {
|
|
306
226
|
ui: null,
|
|
307
227
|
particles: null,
|
|
308
228
|
sound: null,
|
|
309
229
|
haptics: null
|
|
310
230
|
}, m = {};
|
|
311
|
-
for (let e of
|
|
231
|
+
for (let e of b) Object.defineProperty(m, e, {
|
|
312
232
|
enumerable: !0,
|
|
313
233
|
get: () => p[e]
|
|
314
234
|
});
|
|
@@ -318,33 +238,33 @@ function z(a = {}) {
|
|
|
318
238
|
parts: m,
|
|
319
239
|
storage: d,
|
|
320
240
|
clock: f
|
|
321
|
-
}, g =
|
|
241
|
+
}, g = w(o.progress, h, () => new t(new r({ storage: d }), {
|
|
322
242
|
clock: f,
|
|
323
|
-
streakDays:
|
|
324
|
-
builtinAchievements:
|
|
325
|
-
loadRetryMs:
|
|
243
|
+
streakDays: o.streakDays,
|
|
244
|
+
builtinAchievements: o.builtinAchievements,
|
|
245
|
+
loadRetryMs: o.loadRetryMs
|
|
326
246
|
}));
|
|
327
247
|
if (typeof g?.on != "function" || typeof g?.off != "function") throw new n("invalid_progress", "progress needs on() and off()");
|
|
328
|
-
p.particles =
|
|
248
|
+
p.particles = w(o.particles, h, () => l.hasDom ? new a() : null), p.sound = w(o.sound, h, () => new s({ storage: d })), p.haptics = w(o.haptics, h, () => v());
|
|
329
249
|
try {
|
|
330
|
-
p.ui =
|
|
250
|
+
p.ui = w(o.ui, h, () => l.hasDom ? new _(m) : null);
|
|
331
251
|
} catch (e) {
|
|
332
|
-
throw
|
|
252
|
+
throw y(), e;
|
|
333
253
|
}
|
|
334
|
-
function
|
|
335
|
-
for (let e of
|
|
254
|
+
function y() {
|
|
255
|
+
for (let e of b) try {
|
|
336
256
|
p[e]?.destroy?.();
|
|
337
257
|
} catch (e) {
|
|
338
258
|
u.error(e);
|
|
339
259
|
}
|
|
340
260
|
}
|
|
341
|
-
let
|
|
261
|
+
let E = g, D = [], O = !1, k = (e) => (t) => {
|
|
342
262
|
try {
|
|
343
|
-
|
|
263
|
+
S(e(t), u);
|
|
344
264
|
} catch (e) {
|
|
345
265
|
u.error(e);
|
|
346
266
|
}
|
|
347
|
-
},
|
|
267
|
+
}, A = () => {
|
|
348
268
|
let e = p.ui;
|
|
349
269
|
if (!e || typeof g.snapshot != "function" || typeof g.getXPForNextLevel != "function") return;
|
|
350
270
|
let t = g.snapshot(), { total: n, progress: r } = g.getXPForNextLevel();
|
|
@@ -356,15 +276,15 @@ function z(a = {}) {
|
|
|
356
276
|
next: n
|
|
357
277
|
});
|
|
358
278
|
};
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
})),
|
|
362
|
-
|
|
279
|
+
D.push(E.on("xp_gained", k((e) => {
|
|
280
|
+
A(), e.leveledUp || p.sound?.play("xp");
|
|
281
|
+
})), E.on("level_up", k((e) => {
|
|
282
|
+
A(), p.ui?.popup({
|
|
363
283
|
kind: "level",
|
|
364
284
|
title: "",
|
|
365
285
|
body: String(e.newLevel)
|
|
366
286
|
}), p.sound?.play("level_up");
|
|
367
|
-
})),
|
|
287
|
+
})), E.on("achievement_unlocked", k((e) => {
|
|
368
288
|
p.ui?.popup({
|
|
369
289
|
kind: "achievement",
|
|
370
290
|
title: e.name,
|
|
@@ -372,28 +292,28 @@ function z(a = {}) {
|
|
|
372
292
|
icon: e.icon,
|
|
373
293
|
meta: `+${e.xp ?? 0} XP`
|
|
374
294
|
}), p.sound?.play("achievement");
|
|
375
|
-
})),
|
|
295
|
+
})), E.on("streak_updated", k(A)), E.on("player_reset", k(A)), E.on("load_recovered", k(A)), E.on("personal_best", k((e) => {
|
|
376
296
|
p.ui?.popup({
|
|
377
297
|
kind: "notice",
|
|
378
298
|
title: `New High Score: ${e.score}!`,
|
|
379
299
|
tier: "legendary"
|
|
380
300
|
}), p.sound?.play("personal_best");
|
|
381
301
|
})));
|
|
382
|
-
let
|
|
383
|
-
function
|
|
302
|
+
let j = /* @__PURE__ */ new Map(), M = [];
|
|
303
|
+
function N(e) {
|
|
384
304
|
if (typeof e != "object" || !e || typeof e.name != "string" || !/^[a-z0-9-]+$/.test(e.name) || typeof e.install != "function") throw new n("plugin_invalid", "a plugin needs a name (a-z, 0-9 and -) and an install function");
|
|
385
305
|
if (e.api !== 3) throw new n("plugin_api", `${e.name} was built for api ${e.api}, this host is api 3`);
|
|
386
|
-
if (
|
|
387
|
-
for (let t of e.after || []) if (!
|
|
388
|
-
for (let t of e.requires || []) if (!
|
|
306
|
+
if (j.has(e.name)) throw new n("plugin_duplicate", `${e.name} is already installed`);
|
|
307
|
+
for (let t of e.after || []) if (!j.has(t) || !j.get(t).done) throw new n("plugin_order", `${e.name} must come after ${t}`);
|
|
308
|
+
for (let t of e.requires || []) if (!b.includes(t) || p[t] === null) throw new n("plugin_requires", `${e.name} requires the ${t} part, which is not set`);
|
|
389
309
|
}
|
|
390
|
-
function
|
|
310
|
+
function P(e) {
|
|
391
311
|
for (let t of e.offs) t();
|
|
392
|
-
e.offs.clear(),
|
|
393
|
-
let t =
|
|
394
|
-
t > -1 &&
|
|
312
|
+
e.offs.clear(), j.delete(e.name);
|
|
313
|
+
let t = M.indexOf(e);
|
|
314
|
+
t > -1 && M.splice(t, 1);
|
|
395
315
|
}
|
|
396
|
-
function
|
|
316
|
+
function F(e) {
|
|
397
317
|
if (e.removed) return;
|
|
398
318
|
e.removed = !0;
|
|
399
319
|
let t = e.disposer;
|
|
@@ -403,42 +323,42 @@ function z(a = {}) {
|
|
|
403
323
|
} catch (e) {
|
|
404
324
|
u.error(e);
|
|
405
325
|
}
|
|
406
|
-
|
|
326
|
+
P(e);
|
|
407
327
|
}
|
|
408
|
-
function
|
|
328
|
+
function I(e) {
|
|
409
329
|
let { name: t } = e;
|
|
410
330
|
return {
|
|
411
331
|
progress: g,
|
|
412
332
|
parts: m,
|
|
413
333
|
events: {
|
|
414
334
|
on(t, n) {
|
|
415
|
-
let r =
|
|
335
|
+
let r = E.on(t, n), i = () => {
|
|
416
336
|
r(), e.offs.delete(i);
|
|
417
337
|
};
|
|
418
338
|
return e.offs.add(i), i;
|
|
419
339
|
},
|
|
420
|
-
off: (e, t) =>
|
|
340
|
+
off: (e, t) => E.off(e, t),
|
|
421
341
|
emit(e, r) {
|
|
422
342
|
if (typeof e != "string" || !e.startsWith(`${t}:`)) throw new n("plugin_event", `${t} may only emit events named ${t}:<event>`);
|
|
423
|
-
|
|
343
|
+
E.emit(e, r);
|
|
424
344
|
}
|
|
425
345
|
},
|
|
426
|
-
storage:
|
|
346
|
+
storage: T(d, t),
|
|
427
347
|
clock: f,
|
|
428
348
|
log: u,
|
|
429
349
|
env: {
|
|
430
350
|
hasDom: l.hasDom,
|
|
431
351
|
reducedMotion: l.reducedMotion
|
|
432
352
|
},
|
|
433
|
-
plugin: (e) =>
|
|
353
|
+
plugin: (e) => j.has(e) && j.get(e).done ? j.get(e).handle : null,
|
|
434
354
|
expose: (t) => {
|
|
435
355
|
e.handle = t;
|
|
436
356
|
}
|
|
437
357
|
};
|
|
438
358
|
}
|
|
439
|
-
function
|
|
440
|
-
if (
|
|
441
|
-
|
|
359
|
+
function L(e) {
|
|
360
|
+
if (O) throw new n("disposed", "the host was disposed");
|
|
361
|
+
N(e);
|
|
442
362
|
let t = {
|
|
443
363
|
name: e.name,
|
|
444
364
|
done: !1,
|
|
@@ -447,30 +367,30 @@ function z(a = {}) {
|
|
|
447
367
|
handle: null,
|
|
448
368
|
offs: /* @__PURE__ */ new Set()
|
|
449
369
|
};
|
|
450
|
-
|
|
451
|
-
let r = (e) => (t.done = !0, typeof e == "function" && (t.disposer = e), t.removed ||
|
|
452
|
-
throw
|
|
370
|
+
j.set(e.name, t);
|
|
371
|
+
let r = (e) => (t.done = !0, typeof e == "function" && (t.disposer = e), t.removed || O ? (t.removed = !1, F(t), t) : (M.push(t), t)), i = (e) => {
|
|
372
|
+
throw P(t), e;
|
|
453
373
|
}, a;
|
|
454
374
|
try {
|
|
455
|
-
a = e.install(
|
|
375
|
+
a = e.install(I(t));
|
|
456
376
|
} catch (e) {
|
|
457
377
|
return i(e);
|
|
458
378
|
}
|
|
459
|
-
return
|
|
379
|
+
return x(a) ? a.then(r, i) : r(a);
|
|
460
380
|
}
|
|
461
|
-
let
|
|
381
|
+
let R = null;
|
|
462
382
|
function z(e) {
|
|
463
|
-
if (
|
|
464
|
-
if (
|
|
465
|
-
let t =
|
|
466
|
-
if (
|
|
383
|
+
if (O) throw new n("disposed", "the host was disposed");
|
|
384
|
+
if (R === null) {
|
|
385
|
+
let t = L(e);
|
|
386
|
+
if (x(t)) {
|
|
467
387
|
let e = t.then((e) => e, (e) => {
|
|
468
388
|
throw e;
|
|
469
389
|
});
|
|
470
|
-
return
|
|
471
|
-
|
|
390
|
+
return R = e.then(() => {
|
|
391
|
+
R = null;
|
|
472
392
|
}, () => {
|
|
473
|
-
|
|
393
|
+
R = null;
|
|
474
394
|
}), {
|
|
475
395
|
record: null,
|
|
476
396
|
done: e
|
|
@@ -481,11 +401,11 @@ function z(a = {}) {
|
|
|
481
401
|
done: Promise.resolve(t)
|
|
482
402
|
};
|
|
483
403
|
}
|
|
484
|
-
let t =
|
|
485
|
-
return
|
|
486
|
-
|
|
404
|
+
let t = R.then(() => L(e));
|
|
405
|
+
return R = t.then(() => {
|
|
406
|
+
R = null;
|
|
487
407
|
}, () => {
|
|
488
|
-
|
|
408
|
+
R = null;
|
|
489
409
|
}), {
|
|
490
410
|
record: null,
|
|
491
411
|
done: t
|
|
@@ -493,17 +413,17 @@ function z(a = {}) {
|
|
|
493
413
|
}
|
|
494
414
|
function B(e) {
|
|
495
415
|
let { record: t, done: n } = z(e);
|
|
496
|
-
if (t) return () =>
|
|
416
|
+
if (t) return () => F(t);
|
|
497
417
|
let r = null, i = !1;
|
|
498
418
|
return n.then((e) => {
|
|
499
|
-
r = e, i &&
|
|
419
|
+
r = e, i && F(e);
|
|
500
420
|
}, (e) => u.error(e)), () => {
|
|
501
|
-
r ?
|
|
421
|
+
r ? F(r) : i = !0;
|
|
502
422
|
};
|
|
503
423
|
}
|
|
504
424
|
let V = Promise.resolve();
|
|
505
425
|
try {
|
|
506
|
-
for (let e of
|
|
426
|
+
for (let e of o.plugins || []) {
|
|
507
427
|
let { done: t } = z(e);
|
|
508
428
|
V = V.then(() => t);
|
|
509
429
|
}
|
|
@@ -514,24 +434,24 @@ function z(a = {}) {
|
|
|
514
434
|
throw H(), e;
|
|
515
435
|
});
|
|
516
436
|
function H() {
|
|
517
|
-
if (!
|
|
518
|
-
|
|
519
|
-
for (let e of [...
|
|
520
|
-
for (let e of [...
|
|
521
|
-
for (let e of
|
|
522
|
-
|
|
437
|
+
if (!O) {
|
|
438
|
+
O = !0;
|
|
439
|
+
for (let e of [...M].reverse()) F(e);
|
|
440
|
+
for (let e of [...j.values()]) F(e);
|
|
441
|
+
for (let e of D) e();
|
|
442
|
+
D.length = 0, y(), g.clear?.();
|
|
523
443
|
}
|
|
524
444
|
}
|
|
525
|
-
let U = V.then(() => typeof g.init == "function" ? g.init() : void 0).then(() => (
|
|
445
|
+
let U = V.then(() => typeof g.init == "function" ? g.init() : void 0).then(() => (O || A(), W));
|
|
526
446
|
U.catch(() => {});
|
|
527
447
|
let W = {
|
|
528
448
|
progress: g,
|
|
529
449
|
parts: m,
|
|
530
|
-
events:
|
|
450
|
+
events: E,
|
|
531
451
|
ready: U,
|
|
532
452
|
use: B,
|
|
533
453
|
dispose: H
|
|
534
454
|
};
|
|
535
455
|
return W;
|
|
536
456
|
}
|
|
537
|
-
export {
|
|
457
|
+
export { _ as i, E as n, v as r, y as t };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/dopamine/ui/icon.js
|
|
2
|
+
var e = "http://www.w3.org/2000/svg", t = /* @__PURE__ */ new Set([
|
|
3
|
+
"svg",
|
|
4
|
+
"g",
|
|
5
|
+
"path",
|
|
6
|
+
"circle",
|
|
7
|
+
"ellipse",
|
|
8
|
+
"rect",
|
|
9
|
+
"line",
|
|
10
|
+
"polyline",
|
|
11
|
+
"polygon",
|
|
12
|
+
"text",
|
|
13
|
+
"tspan",
|
|
14
|
+
"title",
|
|
15
|
+
"desc",
|
|
16
|
+
"defs",
|
|
17
|
+
"linearGradient",
|
|
18
|
+
"radialGradient",
|
|
19
|
+
"stop",
|
|
20
|
+
"clipPath",
|
|
21
|
+
"mask"
|
|
22
|
+
]), n = /* @__PURE__ */ new Set(/* @__PURE__ */ "viewBox.width.height.x.y.x1.y1.x2.y2.cx.cy.r.rx.ry.d.points.transform.fill.fill-opacity.fill-rule.stroke.stroke-width.stroke-linecap.stroke-linejoin.stroke-opacity.opacity.offset.stop-color.stop-opacity.gradientUnits.gradientTransform.clip-path.mask.clip-rule.font-size.font-family.font-weight.text-anchor.id.aria-hidden.aria-label.role".split(".")), r = /* @__PURE__ */ new Set([
|
|
23
|
+
"fill",
|
|
24
|
+
"stroke",
|
|
25
|
+
"clip-path",
|
|
26
|
+
"mask"
|
|
27
|
+
]), i = /* @__PURE__ */ new Set(["transform", "gradientTransform"]), a = /^url\(\s*#([A-Za-z][\w.:-]*)\s*\)$/, o = /^[#a-zA-Z0-9(),.%\s-]+$/, s = /^[a-zA-Z0-9(),.\s-]+$/, c = /^[A-Za-z][\w.:-]*$/, l = 0;
|
|
28
|
+
function u(n, r) {
|
|
29
|
+
if (n.nodeType !== 1 || n.namespaceURI !== e || !t.has(n.localName)) return;
|
|
30
|
+
let i = n.getAttribute("id");
|
|
31
|
+
i && c.test(i) && r.add(i);
|
|
32
|
+
for (let e of Array.from(n.childNodes)) u(e, r);
|
|
33
|
+
}
|
|
34
|
+
function d(e, t, n) {
|
|
35
|
+
if (t.includes("\\")) return null;
|
|
36
|
+
let l = t.trim();
|
|
37
|
+
if (e === "id") return c.test(l) ? n.prefix + l : null;
|
|
38
|
+
if (r.has(e)) {
|
|
39
|
+
let e = a.exec(l);
|
|
40
|
+
return e ? n.ids.has(e[1]) ? `url(#${n.prefix}${e[1]})` : null : o.test(l) && !/url/i.test(l) ? l : null;
|
|
41
|
+
}
|
|
42
|
+
return i.has(e) ? s.test(l) && !/url/i.test(l) ? l : null : t.includes("(") ? e === "stop-color" && o.test(l) && !/url/i.test(l) ? l : null : t;
|
|
43
|
+
}
|
|
44
|
+
function f(r, i) {
|
|
45
|
+
if (r.nodeType === 3 || r.nodeType === 4) return document.createTextNode(r.data);
|
|
46
|
+
if (r.nodeType !== 1 || r.namespaceURI !== e || !t.has(r.localName)) return null;
|
|
47
|
+
let a = document.createElementNS(e, r.localName);
|
|
48
|
+
for (let e of Array.from(r.attributes)) {
|
|
49
|
+
if (e.namespaceURI !== null || !n.has(e.name)) continue;
|
|
50
|
+
let t = d(e.name, e.value, i);
|
|
51
|
+
t !== null && a.setAttribute(e.name, t);
|
|
52
|
+
}
|
|
53
|
+
for (let e of Array.from(r.childNodes)) {
|
|
54
|
+
let t = f(e, i);
|
|
55
|
+
t && a.appendChild(t);
|
|
56
|
+
}
|
|
57
|
+
return a;
|
|
58
|
+
}
|
|
59
|
+
function p(t) {
|
|
60
|
+
let n, r = /^\s*<svg[\s>]/.test(t) && !/^\s*<svg\b[^>]*\sxmlns\s*=/.test(t) ? t.replace(/^(\s*<svg)/, `$1 xmlns="${e}"`) : t;
|
|
61
|
+
try {
|
|
62
|
+
n = new DOMParser().parseFromString(r, "image/svg+xml");
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
let i = n.documentElement;
|
|
67
|
+
if (!i || i.localName !== "svg" || n.getElementsByTagName("parsererror").length > 0) return null;
|
|
68
|
+
let a = /* @__PURE__ */ new Set();
|
|
69
|
+
return u(i, a), f(i, {
|
|
70
|
+
ids: a,
|
|
71
|
+
prefix: `dj-icon-${++l}-`
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function m(e) {
|
|
75
|
+
if (typeof e != "object" || !e) return !1;
|
|
76
|
+
if (typeof Node < "u" && e instanceof Node) return !0;
|
|
77
|
+
let t = e.ownerDocument?.defaultView?.Node;
|
|
78
|
+
return typeof t == "function" && e instanceof t;
|
|
79
|
+
}
|
|
80
|
+
function h(e, t, n) {
|
|
81
|
+
if (e.textContent = "", m(t)) e.appendChild(t);
|
|
82
|
+
else if (typeof t != "string") return;
|
|
83
|
+
else if (!n) e.innerHTML = t;
|
|
84
|
+
else {
|
|
85
|
+
let n = p(t);
|
|
86
|
+
n ? e.appendChild(n) : e.textContent = t;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export { h as n, m as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`http://www.w3.org/2000/svg`,t=new Set([`svg`,`g`,`path`,`circle`,`ellipse`,`rect`,`line`,`polyline`,`polygon`,`text`,`tspan`,`title`,`desc`,`defs`,`linearGradient`,`radialGradient`,`stop`,`clipPath`,`mask`]),n=new Set(`viewBox.width.height.x.y.x1.y1.x2.y2.cx.cy.r.rx.ry.d.points.transform.fill.fill-opacity.fill-rule.stroke.stroke-width.stroke-linecap.stroke-linejoin.stroke-opacity.opacity.offset.stop-color.stop-opacity.gradientUnits.gradientTransform.clip-path.mask.clip-rule.font-size.font-family.font-weight.text-anchor.id.aria-hidden.aria-label.role`.split(`.`)),r=new Set([`fill`,`stroke`,`clip-path`,`mask`]),i=new Set([`transform`,`gradientTransform`]),a=/^url\(\s*#([A-Za-z][\w.:-]*)\s*\)$/,o=/^[#a-zA-Z0-9(),.%\s-]+$/,s=/^[a-zA-Z0-9(),.\s-]+$/,c=/^[A-Za-z][\w.:-]*$/,l=0;function u(n,r){if(n.nodeType!==1||n.namespaceURI!==e||!t.has(n.localName))return;let i=n.getAttribute(`id`);i&&c.test(i)&&r.add(i);for(let e of Array.from(n.childNodes))u(e,r)}function d(e,t,n){if(t.includes(`\\`))return null;let l=t.trim();if(e===`id`)return c.test(l)?n.prefix+l:null;if(r.has(e)){let e=a.exec(l);return e?n.ids.has(e[1])?`url(#${n.prefix}${e[1]})`:null:o.test(l)&&!/url/i.test(l)?l:null}return i.has(e)?s.test(l)&&!/url/i.test(l)?l:null:t.includes(`(`)?e===`stop-color`&&o.test(l)&&!/url/i.test(l)?l:null:t}function f(r,i){if(r.nodeType===3||r.nodeType===4)return document.createTextNode(r.data);if(r.nodeType!==1||r.namespaceURI!==e||!t.has(r.localName))return null;let a=document.createElementNS(e,r.localName);for(let e of Array.from(r.attributes)){if(e.namespaceURI!==null||!n.has(e.name))continue;let t=d(e.name,e.value,i);t!==null&&a.setAttribute(e.name,t)}for(let e of Array.from(r.childNodes)){let t=f(e,i);t&&a.appendChild(t)}return a}function p(t){let n,r=/^\s*<svg[\s>]/.test(t)&&!/^\s*<svg\b[^>]*\sxmlns\s*=/.test(t)?t.replace(/^(\s*<svg)/,`$1 xmlns="${e}"`):t;try{n=new DOMParser().parseFromString(r,`image/svg+xml`)}catch{return null}let i=n.documentElement;if(!i||i.localName!==`svg`||n.getElementsByTagName(`parsererror`).length>0)return null;let a=new Set;return u(i,a),f(i,{ids:a,prefix:`dj-icon-${++l}-`})}function m(e){if(typeof e!=`object`||!e)return!1;if(typeof Node<`u`&&e instanceof Node)return!0;let t=e.ownerDocument?.defaultView?.Node;return typeof t==`function`&&e instanceof t}function h(e,t,n){if(e.textContent=``,m(t))e.appendChild(t);else if(typeof t!=`string`)return;else if(!n)e.innerHTML=t;else{let n=p(t);n?e.appendChild(n):e.textContent=t}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
|