@kubohiroya/turbowarp-bubble 0.10.0 → 0.12.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/LICENSE +370 -5
- package/{README_ja.md → README.ja.md} +48 -20
- package/README.md +49 -21
- package/dist/composition.js +844 -710
- package/dist/reveal.js +100 -32
- package/dist/turbowarp-adapter.js +570 -431
- package/dist/turbowarp-bubble.js +249 -60
- package/dist/types/composition.d.ts +6 -3
- package/dist/types/content-run.d.ts +38 -0
- package/dist/types/reveal.d.ts +10 -0
- package/dist/types/text-capability.d.ts +29 -1
- package/dist/types/turbowarp-svg-text-adapter.d.ts +1 -1
- package/docs/block-manual.ja.md +6 -6
- package/docs/block-manual.md +7 -7
- package/docs/index.html +12 -12
- package/docs/ja/index.html +10 -10
- package/docs/release-notes-0.11.0.md +21 -0
- package/package.json +21 -17
|
@@ -4685,22 +4685,84 @@ function Fi(e) {
|
|
|
4685
4685
|
});
|
|
4686
4686
|
}
|
|
4687
4687
|
//#endregion
|
|
4688
|
+
//#region src/content-run.ts
|
|
4689
|
+
function Ii(e) {
|
|
4690
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4691
|
+
}
|
|
4692
|
+
function Li(e, t) {
|
|
4693
|
+
let n = /* @__PURE__ */ new Set(["type", ...t]), r = Object.keys(e).filter((e) => !n.has(e));
|
|
4694
|
+
if (r.length > 0) throw TypeError(`Bubble content run has unknown properties: ${r.join(", ")}.`);
|
|
4695
|
+
for (let n of t) if (typeof e[n] != "string") throw TypeError(`Bubble content run ${n} must be a string.`);
|
|
4696
|
+
}
|
|
4697
|
+
function Ri(e) {
|
|
4698
|
+
if (!Ii(e)) throw TypeError("Bubble content run must be an object.");
|
|
4699
|
+
if (e.type === "text") return Li(e, ["text"]), Object.freeze({
|
|
4700
|
+
text: e.text,
|
|
4701
|
+
type: "text"
|
|
4702
|
+
});
|
|
4703
|
+
if (e.type === "ruby") {
|
|
4704
|
+
Li(e, ["base", "reading"]);
|
|
4705
|
+
let t = e.base, n = e.reading;
|
|
4706
|
+
if (t.length === 0) throw TypeError("Bubble ruby run base must not be empty.");
|
|
4707
|
+
if (n.length === 0) throw TypeError("Bubble ruby run reading must not be empty.");
|
|
4708
|
+
return Object.freeze({
|
|
4709
|
+
base: t,
|
|
4710
|
+
reading: n,
|
|
4711
|
+
type: "ruby"
|
|
4712
|
+
});
|
|
4713
|
+
}
|
|
4714
|
+
throw TypeError("Bubble content run type must be text or ruby.");
|
|
4715
|
+
}
|
|
4716
|
+
function zi(e) {
|
|
4717
|
+
if (typeof e == "string") return Object.freeze([Object.freeze({
|
|
4718
|
+
text: e,
|
|
4719
|
+
type: "text"
|
|
4720
|
+
})]);
|
|
4721
|
+
if (!Array.isArray(e)) throw TypeError("Bubble text must be a string or content run array.");
|
|
4722
|
+
let t = e.map((e) => Ri(e)).filter((e) => e.type !== "text" || e.text.length > 0);
|
|
4723
|
+
return t.length === 0 ? Object.freeze([Object.freeze({
|
|
4724
|
+
text: "",
|
|
4725
|
+
type: "text"
|
|
4726
|
+
})]) : Object.freeze(t);
|
|
4727
|
+
}
|
|
4728
|
+
function Bi(e) {
|
|
4729
|
+
return e.every((e) => e.type === "text");
|
|
4730
|
+
}
|
|
4731
|
+
function Vi(e) {
|
|
4732
|
+
return e.map((e) => e.type === "ruby" ? e.base : e.text).join("");
|
|
4733
|
+
}
|
|
4734
|
+
function Hi(e) {
|
|
4735
|
+
let t = [];
|
|
4736
|
+
for (let n of e) {
|
|
4737
|
+
let e = t[t.length - 1];
|
|
4738
|
+
if (n.type === "text" && e?.type === "text") {
|
|
4739
|
+
t[t.length - 1] = Object.freeze({
|
|
4740
|
+
text: `${e.text}${n.text}`,
|
|
4741
|
+
type: "text"
|
|
4742
|
+
});
|
|
4743
|
+
continue;
|
|
4744
|
+
}
|
|
4745
|
+
t.push(n);
|
|
4746
|
+
}
|
|
4747
|
+
return Object.freeze(t);
|
|
4748
|
+
}
|
|
4749
|
+
//#endregion
|
|
4688
4750
|
//#region src/reveal.ts
|
|
4689
|
-
var
|
|
4751
|
+
var Ui = Object.freeze([
|
|
4690
4752
|
"CHARACTER",
|
|
4691
4753
|
"WORD",
|
|
4692
4754
|
"LINE",
|
|
4693
4755
|
"BLOCK"
|
|
4694
4756
|
]);
|
|
4695
|
-
function
|
|
4757
|
+
function Wi(e) {
|
|
4696
4758
|
let t = globalThis.Intl?.Segmenter;
|
|
4697
4759
|
return typeof t == "function" ? [...new t(void 0, { granularity: "grapheme" }).segment(e)].map(({ segment: e }) => e) : Array.from(e);
|
|
4698
4760
|
}
|
|
4699
|
-
function
|
|
4700
|
-
if (typeof e != "string" || !
|
|
4761
|
+
function Gi(e) {
|
|
4762
|
+
if (typeof e != "string" || !Ui.includes(e)) throw TypeError("Bubble reveal unit must be CHARACTER, WORD, LINE, or BLOCK.");
|
|
4701
4763
|
return e;
|
|
4702
4764
|
}
|
|
4703
|
-
function
|
|
4765
|
+
function Ki(e) {
|
|
4704
4766
|
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("Bubble reveal must be an object.");
|
|
4705
4767
|
let t = e, n = /* @__PURE__ */ new Set([
|
|
4706
4768
|
"unit",
|
|
@@ -4711,7 +4773,7 @@ function zi(e) {
|
|
|
4711
4773
|
"sound"
|
|
4712
4774
|
]);
|
|
4713
4775
|
if (Object.keys(t).filter((e) => !n.has(e)).length > 0 || t.unit === void 0) throw TypeError("Bubble reveal has unknown or missing properties.");
|
|
4714
|
-
let r =
|
|
4776
|
+
let r = Gi(t.unit), i = t.delimiters ?? " \r\n";
|
|
4715
4777
|
if (typeof i != "string" || i.length === 0) throw TypeError("Bubble WORD delimiters must be a non-empty string.");
|
|
4716
4778
|
let a = t.showDelimiters ?? !1;
|
|
4717
4779
|
if (typeof a != "boolean") throw TypeError("Bubble reveal showDelimiters must be boolean.");
|
|
@@ -4730,16 +4792,16 @@ function zi(e) {
|
|
|
4730
4792
|
...c === void 0 ? {} : { sound: c }
|
|
4731
4793
|
});
|
|
4732
4794
|
}
|
|
4733
|
-
function
|
|
4795
|
+
function qi(e, t, n) {
|
|
4734
4796
|
let r = new Set(Array.from(t)), i = [], a = "";
|
|
4735
|
-
for (let t of
|
|
4797
|
+
for (let t of Wi(e)) a += t, r.has(t) && ((n || a.slice(0, -t.length).length > 0) && i.push(n ? a : a.slice(0, -t.length)), a = "");
|
|
4736
4798
|
return a.length > 0 && i.push(a), i.filter((e) => e.length > 0);
|
|
4737
4799
|
}
|
|
4738
|
-
function
|
|
4800
|
+
function Ji(e, t) {
|
|
4739
4801
|
if (e.length === 0) return Object.freeze([""]);
|
|
4740
|
-
if (t.unit === "CHARACTER") return Object.freeze(
|
|
4802
|
+
if (t.unit === "CHARACTER") return Object.freeze(Wi(e));
|
|
4741
4803
|
if (t.unit === "WORD") {
|
|
4742
|
-
let n =
|
|
4804
|
+
let n = qi(e, t.delimiters, t.showDelimiters);
|
|
4743
4805
|
if (t.showDelimiters) return Object.freeze(n);
|
|
4744
4806
|
let r = [], i = 0;
|
|
4745
4807
|
for (let a of n) {
|
|
@@ -4757,30 +4819,72 @@ function Vi(e, t) {
|
|
|
4757
4819
|
let i = r;
|
|
4758
4820
|
return Object.freeze(i.length > 0 ? i : [e]);
|
|
4759
4821
|
}
|
|
4760
|
-
function
|
|
4761
|
-
return
|
|
4822
|
+
function Yi(e) {
|
|
4823
|
+
return Object.freeze(Hi(Object.freeze([...e])));
|
|
4824
|
+
}
|
|
4825
|
+
function Xi(e) {
|
|
4826
|
+
return Object.freeze({
|
|
4827
|
+
text: e,
|
|
4828
|
+
type: "text"
|
|
4829
|
+
});
|
|
4830
|
+
}
|
|
4831
|
+
function Zi(e, t) {
|
|
4832
|
+
let n = [], r = [], i = () => {
|
|
4833
|
+
r.length !== 0 && (n.push(Yi(r)), r = []);
|
|
4834
|
+
};
|
|
4835
|
+
for (let n of e) {
|
|
4836
|
+
if (n.type === "ruby") {
|
|
4837
|
+
r.push(n);
|
|
4838
|
+
continue;
|
|
4839
|
+
}
|
|
4840
|
+
if (t === "LINE") {
|
|
4841
|
+
for (let e of n.text.split(/(?<=\n)/u)) e.length !== 0 && (r.push(Xi(e)), e.endsWith("\n") && i());
|
|
4842
|
+
continue;
|
|
4843
|
+
}
|
|
4844
|
+
let e = n.text.split(/(\n{2,})/u);
|
|
4845
|
+
for (let [t, n] of e.entries()) n.length !== 0 && (r.push(Xi(n)), t % 2 == 1 && i());
|
|
4846
|
+
}
|
|
4847
|
+
return i(), Object.freeze(n.length > 0 ? n : [Yi(e)]);
|
|
4848
|
+
}
|
|
4849
|
+
function Qi(e, t) {
|
|
4850
|
+
if (Bi(e)) return Object.freeze(Ji(Vi(e), t).map((e) => Object.freeze([Xi(e)])));
|
|
4851
|
+
if (t.unit === "LINE" || t.unit === "BLOCK") return Zi(e, t.unit);
|
|
4852
|
+
let n = [];
|
|
4853
|
+
for (let r of e) {
|
|
4854
|
+
if (r.type === "ruby") {
|
|
4855
|
+
n.push(Object.freeze([r]));
|
|
4856
|
+
continue;
|
|
4857
|
+
}
|
|
4858
|
+
let e = t.unit === "CHARACTER" ? Wi(r.text) : qi(r.text, t.delimiters, t.showDelimiters);
|
|
4859
|
+
for (let t of e) n.push(Object.freeze([Xi(t)]));
|
|
4860
|
+
}
|
|
4861
|
+
return Object.freeze(n.length > 0 ? n : [Object.freeze([Xi("")])]);
|
|
4862
|
+
}
|
|
4863
|
+
function $i(e, t) {
|
|
4864
|
+
let n = e.slice(0, Math.max(0, Math.min(t, e.length)));
|
|
4865
|
+
return Hi(Object.freeze(n.flat()));
|
|
4762
4866
|
}
|
|
4763
4867
|
//#endregion
|
|
4764
4868
|
//#region src/portrait-layout.ts
|
|
4765
|
-
var
|
|
4869
|
+
var ea = Object.freeze([
|
|
4766
4870
|
"left",
|
|
4767
4871
|
"right",
|
|
4768
4872
|
"top-left",
|
|
4769
4873
|
"top-right",
|
|
4770
4874
|
"bottom-left",
|
|
4771
4875
|
"bottom-right"
|
|
4772
|
-
]),
|
|
4876
|
+
]), ta = Object.freeze({
|
|
4773
4877
|
x: 0,
|
|
4774
4878
|
y: 0,
|
|
4775
4879
|
zoomPercent: 100
|
|
4776
4880
|
});
|
|
4777
|
-
function
|
|
4881
|
+
function na(e) {
|
|
4778
4882
|
if (typeof e != "string") throw TypeError("Bubble portrait placement must be a string.");
|
|
4779
4883
|
let t = e.trim().toLowerCase().replaceAll("_", "-");
|
|
4780
|
-
if (!
|
|
4884
|
+
if (!ea.includes(t)) throw TypeError(`Unsupported Bubble portrait placement: ${e}`);
|
|
4781
4885
|
return t;
|
|
4782
4886
|
}
|
|
4783
|
-
function
|
|
4887
|
+
function ra(e) {
|
|
4784
4888
|
if (!Array.isArray(e) || e.length !== 2 && e.length !== 3) throw TypeError("Bubble portrait offset must be [x, y] or [x, y, zoom].");
|
|
4785
4889
|
let [t, n, r = 100] = e;
|
|
4786
4890
|
if (![
|
|
@@ -4794,11 +4898,11 @@ function Ki(e) {
|
|
|
4794
4898
|
zoomPercent: r
|
|
4795
4899
|
});
|
|
4796
4900
|
}
|
|
4797
|
-
function
|
|
4901
|
+
function ia(e) {
|
|
4798
4902
|
if (typeof e != "number" || !Number.isFinite(e) || e < 0) throw TypeError("Bubble portrait corner radius must be zero or greater.");
|
|
4799
4903
|
return e;
|
|
4800
4904
|
}
|
|
4801
|
-
var
|
|
4905
|
+
var aa = Object.freeze([
|
|
4802
4906
|
"placement",
|
|
4803
4907
|
"maxWidth",
|
|
4804
4908
|
"textLocale",
|
|
@@ -4813,13 +4917,13 @@ var Ji = Object.freeze([
|
|
|
4813
4917
|
"showAnimation",
|
|
4814
4918
|
"hideAnimation"
|
|
4815
4919
|
]);
|
|
4816
|
-
function
|
|
4920
|
+
function oa(e) {
|
|
4817
4921
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4818
4922
|
}
|
|
4819
|
-
function
|
|
4820
|
-
return !
|
|
4923
|
+
function sa(e) {
|
|
4924
|
+
return !oa(e) || typeof e.textStyle != "string" || e.textStyle.trim() !== "default" ? "custom" : aa.every((t) => e[t] === void 0) ? "scratch-default" : "custom";
|
|
4821
4925
|
}
|
|
4822
|
-
function
|
|
4926
|
+
function ca(e) {
|
|
4823
4927
|
let t = 0;
|
|
4824
4928
|
for (let n of e) if (!/\p{Mark}/u.test(n)) {
|
|
4825
4929
|
if (/\s/u.test(n)) {
|
|
@@ -4830,7 +4934,7 @@ function Zi(e) {
|
|
|
4830
4934
|
}
|
|
4831
4935
|
return t * 14;
|
|
4832
4936
|
}
|
|
4833
|
-
function
|
|
4937
|
+
function la(e, t = ca) {
|
|
4834
4938
|
let n = Fi({
|
|
4835
4939
|
text: e.slice(0, 330),
|
|
4836
4940
|
maxWidth: 170,
|
|
@@ -4839,9 +4943,9 @@ function Qi(e, t = Zi) {
|
|
|
4839
4943
|
try {
|
|
4840
4944
|
n = t(e);
|
|
4841
4945
|
} catch {
|
|
4842
|
-
return
|
|
4946
|
+
return ca(e);
|
|
4843
4947
|
}
|
|
4844
|
-
return Number.isFinite(n) && n >= 0 ? n :
|
|
4948
|
+
return Number.isFinite(n) && n >= 0 ? n : ca(e);
|
|
4845
4949
|
}
|
|
4846
4950
|
}), r = Object.freeze(n.lines.map((e) => Object.freeze({
|
|
4847
4951
|
text: e.text,
|
|
@@ -4853,7 +4957,7 @@ function Qi(e, t = Zi) {
|
|
|
4853
4957
|
text: r.map((e) => e.text).join("\n")
|
|
4854
4958
|
});
|
|
4855
4959
|
}
|
|
4856
|
-
function
|
|
4960
|
+
function ua(e) {
|
|
4857
4961
|
let t = Math.max(1, e.lines.length), n = Math.max(e.maxLineWidth, 50) + 20, r = 16 * t + 20;
|
|
4858
4962
|
return Object.freeze({
|
|
4859
4963
|
bodyHeight: r + 4,
|
|
@@ -4864,7 +4968,7 @@ function $i(e) {
|
|
|
4864
4968
|
width: n + 4
|
|
4865
4969
|
});
|
|
4866
4970
|
}
|
|
4867
|
-
function
|
|
4971
|
+
function da(e) {
|
|
4868
4972
|
let t = -e.stageWidth / 2, n = e.stageWidth / 2, r = e.stageHeight / 2, i = e.pointsLeft;
|
|
4869
4973
|
!i && e.width + e.bounds.right > n && e.bounds.left - e.width > t ? i = !0 : i && e.bounds.left - e.width < t && e.width + e.bounds.right < n && (i = !1);
|
|
4870
4974
|
let a = i ? Math.min(n - e.width, Math.max(t, e.bounds.left - e.width)) : Math.max(t, Math.min(n - e.width, e.bounds.right)), o = Math.min(r, e.bounds.bottom + e.height);
|
|
@@ -4876,10 +4980,10 @@ function ea(e) {
|
|
|
4876
4980
|
top: o
|
|
4877
4981
|
});
|
|
4878
4982
|
}
|
|
4879
|
-
function
|
|
4983
|
+
function fa(e) {
|
|
4880
4984
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
4881
4985
|
}
|
|
4882
|
-
function
|
|
4986
|
+
function pa(e) {
|
|
4883
4987
|
let { paddedHeight: t, paddedWidth: n } = e, r = Math.min(16, n / 2, t / 2);
|
|
4884
4988
|
return [
|
|
4885
4989
|
`M ${r} ${t}`,
|
|
@@ -4892,16 +4996,16 @@ function na(e) {
|
|
|
4892
4996
|
`Q ${n} ${t} ${n - r} ${t}`
|
|
4893
4997
|
].join(" ");
|
|
4894
4998
|
}
|
|
4895
|
-
function
|
|
4999
|
+
function ma(e) {
|
|
4896
5000
|
let { paddedHeight: t, paddedWidth: n } = e;
|
|
4897
|
-
return `<path d="${`${
|
|
5001
|
+
return `<path d="${`${pa(e)} C ${n - 16} ${t + 4} ${n - 12} ${t + 8} ${n - 12} ${t + 10} Q ${n - 12} ${t + 12} ${n - 14} ${t + 12} C ${n - 17} ${t + 12} ${n - 27} ${t + 8} ${n - 32} ${t} Z`}" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" stroke-linejoin="round" paint-order="stroke fill"/>`;
|
|
4898
5002
|
}
|
|
4899
|
-
function
|
|
5003
|
+
function ha(e) {
|
|
4900
5004
|
let { paddedHeight: t, paddedWidth: n } = e;
|
|
4901
|
-
return `<path d="${`${
|
|
5005
|
+
return `<path d="${`${pa(e)} L ${n - 28} ${t} A 4 4 0 0 1 ${n - 36} ${t} Z`}" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" stroke-linejoin="round" paint-order="stroke fill"/><circle cx="${n - 25.25}" cy="${t + 7.25}" r="2.25" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" paint-order="stroke fill"/><circle cx="${n - 17.5}" cy="${t + 9.5}" r="1.5" fill="white" stroke="rgba(0, 0, 0, 0.15)" stroke-width="4" paint-order="stroke fill"/>`;
|
|
4902
5006
|
}
|
|
4903
|
-
function
|
|
4904
|
-
let t =
|
|
5007
|
+
function ga(e) {
|
|
5008
|
+
let t = ua(e.layout), n = e.kind === "say" ? ma(t) : ha(t), r = e.pointsLeft ? "translate(2 2)" : `translate(${t.width} 0) scale(-1 1) translate(2 2)`, i = e.layout.lines.map((e, t) => `<text x="12" y="${24.6 + 16 * t}" fill="#575E75" font-family="Helvetica, sans-serif" font-size="14" xml:space="preserve">${fa(e.text)}</text>`).join(""), a = fa(e.title ?? `${e.kind} bubble`);
|
|
4905
5009
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${t.width}" height="${t.height}" viewBox="0 0 ${t.width} ${t.height}" role="img" data-bubble-profile="scratch-default" data-bubble-kind="${e.kind}"><title>${a}</title><g transform="${r}">${n}</g>${i}</svg>`;
|
|
4906
5010
|
}
|
|
4907
5011
|
//#endregion
|
|
@@ -4911,11 +5015,11 @@ var Z = class extends Error {
|
|
|
4911
5015
|
constructor(e, t) {
|
|
4912
5016
|
super(t), this.name = "BubbleCompositionError", this.code = e;
|
|
4913
5017
|
}
|
|
4914
|
-
},
|
|
5018
|
+
}, _a = /* @__PURE__ */ new Set(["say", "think"]), va = /* @__PURE__ */ new Set([
|
|
4915
5019
|
"idle",
|
|
4916
5020
|
"talking",
|
|
4917
5021
|
"awaiting-continue"
|
|
4918
|
-
]),
|
|
5022
|
+
]), ya = /* @__PURE__ */ new Set([
|
|
4919
5023
|
"fadeIn",
|
|
4920
5024
|
"fadeOut",
|
|
4921
5025
|
"floatIn",
|
|
@@ -4927,7 +5031,7 @@ var Z = class extends Error {
|
|
|
4927
5031
|
"shake",
|
|
4928
5032
|
"explode",
|
|
4929
5033
|
"animateBubbleShape"
|
|
4930
|
-
]),
|
|
5034
|
+
]), ba = /* @__PURE__ */ new Set([
|
|
4931
5035
|
"linear",
|
|
4932
5036
|
"easeIn",
|
|
4933
5037
|
"easeOut",
|
|
@@ -4936,45 +5040,45 @@ var Z = class extends Error {
|
|
|
4936
5040
|
function Q(e) {
|
|
4937
5041
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4938
5042
|
}
|
|
4939
|
-
function
|
|
5043
|
+
function xa(e, t, n, r) {
|
|
4940
5044
|
let i = /* @__PURE__ */ new Set([...t, ...n]), a = t.filter((t) => !Object.prototype.hasOwnProperty.call(e, t)), o = Object.keys(e).filter((e) => !i.has(e));
|
|
4941
5045
|
if (a.length > 0 || o.length > 0) throw new Z("BUBBLE-COMPOSITION-001", `${r} has missing or unknown properties.`);
|
|
4942
5046
|
}
|
|
4943
|
-
function
|
|
5047
|
+
function Sa(e, t) {
|
|
4944
5048
|
if (typeof e != "string" || e.trim().length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4945
5049
|
return e.trim();
|
|
4946
5050
|
}
|
|
4947
|
-
function
|
|
5051
|
+
function Ca(e, t) {
|
|
4948
5052
|
if (typeof e != "string" || e.length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4949
5053
|
return e;
|
|
4950
5054
|
}
|
|
4951
|
-
function
|
|
5055
|
+
function wa(e, t, n) {
|
|
4952
5056
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4953
|
-
if (
|
|
4954
|
-
let r = Object.freeze(e.frames.map((e, n) =>
|
|
5057
|
+
if (xa(e, ["frames", "frameIntervalSeconds"], [], t), !Array.isArray(e.frames) || e.frames.length < n) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frames must contain at least ${n} image asset name${n === 1 ? "" : "s"}.`);
|
|
5058
|
+
let r = Object.freeze(e.frames.map((e, n) => Ca(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
|
|
4955
5059
|
if (typeof i != "number" || !Number.isFinite(i) || i <= 0) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frameIntervalSeconds must be a positive finite number.`);
|
|
4956
5060
|
return Object.freeze({
|
|
4957
5061
|
frames: r,
|
|
4958
5062
|
frameIntervalSeconds: i
|
|
4959
5063
|
});
|
|
4960
5064
|
}
|
|
4961
|
-
function
|
|
5065
|
+
function Ta(e) {
|
|
4962
5066
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
|
|
4963
|
-
|
|
5067
|
+
xa(e, ["base"], [
|
|
4964
5068
|
"blink",
|
|
4965
5069
|
"lipSync",
|
|
4966
5070
|
"placement",
|
|
4967
5071
|
"offset",
|
|
4968
5072
|
"cornerRadius"
|
|
4969
5073
|
], "Bubble portrait");
|
|
4970
|
-
let t = e.blink === void 0 ? void 0 :
|
|
5074
|
+
let t = e.blink === void 0 ? void 0 : wa(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : wa(e.lipSync, "Bubble portrait lip-sync", 1), r, i, a;
|
|
4971
5075
|
try {
|
|
4972
|
-
r =
|
|
5076
|
+
r = na(e.placement ?? "left"), i = e.offset === void 0 ? ta : ra(e.offset), a = ia(e.cornerRadius ?? 0);
|
|
4973
5077
|
} catch (e) {
|
|
4974
5078
|
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble portrait layout is invalid.");
|
|
4975
5079
|
}
|
|
4976
5080
|
return Object.freeze({
|
|
4977
|
-
base:
|
|
5081
|
+
base: Ca(e.base, "Bubble portrait base"),
|
|
4978
5082
|
...t === void 0 ? {} : { blink: t },
|
|
4979
5083
|
...n === void 0 ? {} : { lipSync: n },
|
|
4980
5084
|
placement: r,
|
|
@@ -4982,9 +5086,9 @@ function ma(e) {
|
|
|
4982
5086
|
cornerRadius: a
|
|
4983
5087
|
});
|
|
4984
5088
|
}
|
|
4985
|
-
function
|
|
5089
|
+
function Ea(e, t) {
|
|
4986
5090
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4987
|
-
if (
|
|
5091
|
+
if (xa(e, ["name"], [
|
|
4988
5092
|
"durationSeconds",
|
|
4989
5093
|
"ease",
|
|
4990
5094
|
"direction",
|
|
@@ -4992,7 +5096,7 @@ function ha(e, t) {
|
|
|
4992
5096
|
"relativeScale",
|
|
4993
5097
|
"speed",
|
|
4994
5098
|
"visualStyle"
|
|
4995
|
-
], t), !
|
|
5099
|
+
], t), !ya.has(e.name)) throw new Z("BUBBLE-COMPOSITION-001", `${t}.name is not a supported Bubble motion.`);
|
|
4996
5100
|
let n = (n, r, i = !1) => {
|
|
4997
5101
|
let a = e[n];
|
|
4998
5102
|
if (a !== void 0) {
|
|
@@ -5002,7 +5106,7 @@ function ha(e, t) {
|
|
|
5002
5106
|
}, r = n("durationSeconds", 0), i = n("count", 1, !0), a = n("relativeScale", 0), o = n("speed", 0), s = e.direction;
|
|
5003
5107
|
if (s !== void 0 && typeof s != "number" && typeof s != "string") throw new Z("BUBBLE-COMPOSITION-001", `${t}.direction is invalid.`);
|
|
5004
5108
|
let c = e.ease ?? "easeInOut";
|
|
5005
|
-
if (typeof c != "string" || !
|
|
5109
|
+
if (typeof c != "string" || !ba.has(c)) throw new Z("BUBBLE-COMPOSITION-001", `${t}.ease is invalid.`);
|
|
5006
5110
|
let l = e.visualStyle;
|
|
5007
5111
|
if (l !== void 0 && (typeof l != "string" || !$e.includes(l))) throw new Z("BUBBLE-COMPOSITION-001", `${t}.visualStyle is invalid.`);
|
|
5008
5112
|
return Object.freeze({
|
|
@@ -5016,10 +5120,10 @@ function ha(e, t) {
|
|
|
5016
5120
|
...l === void 0 ? {} : { visualStyle: l }
|
|
5017
5121
|
});
|
|
5018
5122
|
}
|
|
5019
|
-
function
|
|
5123
|
+
function Da(e) {
|
|
5020
5124
|
if (e === void 0) return;
|
|
5021
5125
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
|
|
5022
|
-
|
|
5126
|
+
xa(e, [], [
|
|
5023
5127
|
"voice",
|
|
5024
5128
|
"reveal",
|
|
5025
5129
|
"finish"
|
|
@@ -5031,13 +5135,13 @@ function ga(e) {
|
|
|
5031
5135
|
"finish"
|
|
5032
5136
|
]) {
|
|
5033
5137
|
let r = e[n];
|
|
5034
|
-
r !== void 0 && (t[n] =
|
|
5138
|
+
r !== void 0 && (t[n] = Ca(r, `Bubble audio ${n}`));
|
|
5035
5139
|
}
|
|
5036
5140
|
return Object.freeze(t);
|
|
5037
5141
|
}
|
|
5038
|
-
function
|
|
5142
|
+
function Oa(e) {
|
|
5039
5143
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
|
|
5040
|
-
|
|
5144
|
+
xa(e, ["name", "textStyle"], [
|
|
5041
5145
|
"placement",
|
|
5042
5146
|
"maxWidth",
|
|
5043
5147
|
"textLocale",
|
|
@@ -5052,13 +5156,13 @@ function _a(e) {
|
|
|
5052
5156
|
"showAnimation",
|
|
5053
5157
|
"hideAnimation"
|
|
5054
5158
|
], "Bubble style");
|
|
5055
|
-
let t = e.portrait === void 0 ? void 0 :
|
|
5159
|
+
let t = e.portrait === void 0 ? void 0 : Ta(e.portrait), n = e.continueIndicator === void 0 ? void 0 : wa(e.continueIndicator, "Bubble continue indicator", 2), r;
|
|
5056
5160
|
if (e.reveal !== void 0) try {
|
|
5057
|
-
r =
|
|
5161
|
+
r = Ki(e.reveal);
|
|
5058
5162
|
} catch (e) {
|
|
5059
5163
|
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
|
|
5060
5164
|
}
|
|
5061
|
-
let i =
|
|
5165
|
+
let i = Da(e.audio), a = e.showAnimation === void 0 ? void 0 : Ea(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : Ea(e.hideAnimation, "Bubble hideAnimation"), s;
|
|
5062
5166
|
try {
|
|
5063
5167
|
s = ze(e.placement ?? "up-right");
|
|
5064
5168
|
} catch (e) {
|
|
@@ -5077,10 +5181,10 @@ function _a(e) {
|
|
|
5077
5181
|
if (typeof e.maxWidth != "number" || !Number.isFinite(e.maxWidth) || e.maxWidth <= 0) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style maxWidth must be a positive finite number.");
|
|
5078
5182
|
f = e.maxWidth;
|
|
5079
5183
|
}
|
|
5080
|
-
let p = e.textLocale === void 0 ? void 0 :
|
|
5184
|
+
let p = e.textLocale === void 0 ? void 0 : Sa(e.textLocale, "Bubble style text locale"), m = sa(e);
|
|
5081
5185
|
return Object.freeze({
|
|
5082
|
-
name:
|
|
5083
|
-
textStyle:
|
|
5186
|
+
name: Sa(e.name, "Bubble style name"),
|
|
5187
|
+
textStyle: Sa(e.textStyle, "Bubble text style name"),
|
|
5084
5188
|
layoutProfile: m,
|
|
5085
5189
|
...f === void 0 ? {} : { maxWidth: f },
|
|
5086
5190
|
...p === void 0 ? {} : { textLocale: p },
|
|
@@ -5097,13 +5201,13 @@ function _a(e) {
|
|
|
5097
5201
|
...o === void 0 ? {} : { hideAnimation: o }
|
|
5098
5202
|
});
|
|
5099
5203
|
}
|
|
5100
|
-
function
|
|
5204
|
+
function ka(e) {
|
|
5101
5205
|
if (e !== void 0) {
|
|
5102
5206
|
if (!Q(e) || typeof e.applyToTarget != "function" || typeof e.getMimeType != "function" || typeof e.isRegistered != "function") throw TypeError("Bubble image capability must provide applyToTarget, getMimeType, and isRegistered.");
|
|
5103
5207
|
return e;
|
|
5104
5208
|
}
|
|
5105
5209
|
}
|
|
5106
|
-
function
|
|
5210
|
+
function Aa(e) {
|
|
5107
5211
|
if (e !== void 0) {
|
|
5108
5212
|
if (!Q(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
|
|
5109
5213
|
if (e.isRegistered !== void 0 && typeof e.isRegistered != "function") throw TypeError("Bubble audio capability isRegistered must be a function.");
|
|
@@ -5111,65 +5215,77 @@ function ya(e) {
|
|
|
5111
5215
|
return e;
|
|
5112
5216
|
}
|
|
5113
5217
|
}
|
|
5114
|
-
function
|
|
5218
|
+
function ja(e) {
|
|
5115
5219
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", "Bubble image assets require an image capability. Provide options.imageResolver.");
|
|
5116
5220
|
return e;
|
|
5117
5221
|
}
|
|
5118
|
-
function
|
|
5222
|
+
function Ma(e) {
|
|
5119
5223
|
if (!Q(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble text capability must provide setText and releaseTarget.");
|
|
5120
5224
|
return e;
|
|
5121
5225
|
}
|
|
5122
|
-
function
|
|
5226
|
+
function Na() {
|
|
5123
5227
|
return Object.freeze({
|
|
5124
5228
|
setTimeout: (e, t) => globalThis.setTimeout(e, t),
|
|
5125
5229
|
clearTimeout: (e) => globalThis.clearTimeout(e)
|
|
5126
5230
|
});
|
|
5127
5231
|
}
|
|
5128
|
-
function
|
|
5232
|
+
function Pa(e) {
|
|
5129
5233
|
if (!Q(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
|
|
5130
5234
|
return e;
|
|
5131
5235
|
}
|
|
5132
|
-
function
|
|
5236
|
+
function Fa(e, t) {
|
|
5133
5237
|
if (!Q(e) || typeof e.id != "string" || e.id.length === 0 || typeof e.isStage != "boolean") throw new Z("BUBBLE-COMPOSITION-004", `${t} must provide id and isStage.`);
|
|
5134
5238
|
return e;
|
|
5135
5239
|
}
|
|
5136
|
-
function
|
|
5240
|
+
function Ia(e) {
|
|
5137
5241
|
if (typeof e != "object" || !e) throw new Z("BUBBLE-COMPOSITION-004", "Bubble text target must be a non-null object.");
|
|
5138
5242
|
return e;
|
|
5139
5243
|
}
|
|
5140
|
-
function
|
|
5244
|
+
function La(e, t) {
|
|
5141
5245
|
if (!Q(e) || !Q(e.targets) || typeof e.setLayerVisible != "function" || typeof e.updateStyle != "function" || typeof e.show != "function" || typeof e.hide != "function" || typeof e.dispose != "function") throw new Z("BUBBLE-COMPOSITION-004", "Bubble surface is invalid.");
|
|
5142
5246
|
let n = e.targets;
|
|
5143
|
-
|
|
5247
|
+
Ia(n.text);
|
|
5144
5248
|
let r = /* @__PURE__ */ new Set(), i = (e, t) => {
|
|
5145
5249
|
let i = n[e];
|
|
5146
5250
|
if (!t && i === void 0) return;
|
|
5147
|
-
let a =
|
|
5251
|
+
let a = Fa(i, `Bubble surface ${e}`);
|
|
5148
5252
|
if (r.has(a.id)) throw new Z("BUBBLE-COMPOSITION-004", "Bubble image layers must use distinct target IDs.");
|
|
5149
5253
|
r.add(a.id);
|
|
5150
5254
|
};
|
|
5151
5255
|
return i("portraitBase", t.portrait !== void 0), i("portraitBlink", t.portrait?.blink !== void 0), i("portraitLipSync", t.portrait?.lipSync !== void 0), i("continueIndicator", t.continueIndicator !== void 0), e;
|
|
5152
5256
|
}
|
|
5153
|
-
function
|
|
5257
|
+
function Ra(e, t) {
|
|
5154
5258
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble image capability is required for: ${t}. Provide options.imageResolver.`);
|
|
5155
5259
|
if (!e.isRegistered(t)) throw new Z("BUBBLE-COMPOSITION-003", `Bubble image asset is not registered: ${t}`);
|
|
5156
5260
|
if (!e.getMimeType(t).startsWith("image/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not an image: ${t}`);
|
|
5157
5261
|
}
|
|
5158
|
-
function
|
|
5262
|
+
function za(e, t) {
|
|
5159
5263
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble audio assets require an audio capability: ${t}. Provide options.audio.`);
|
|
5160
5264
|
if (e.isRegistered?.(t) === !1) throw new Z("BUBBLE-COMPOSITION-003", `Bubble audio asset is not registered: ${t}`);
|
|
5161
5265
|
let n = e.getMimeType?.(t);
|
|
5162
5266
|
if (n !== void 0 && !n.startsWith("audio/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not audio: ${t}`);
|
|
5163
5267
|
}
|
|
5164
|
-
function
|
|
5268
|
+
function Ba(e) {
|
|
5165
5269
|
return [...e.portrait === void 0 ? [] : [
|
|
5166
5270
|
e.portrait.base,
|
|
5167
5271
|
...e.portrait.blink?.frames ?? [],
|
|
5168
5272
|
...e.portrait.lipSync?.frames ?? []
|
|
5169
5273
|
], ...e.continueIndicator?.frames ?? []];
|
|
5170
5274
|
}
|
|
5171
|
-
function
|
|
5172
|
-
|
|
5275
|
+
function Va(e) {
|
|
5276
|
+
let t = e.setRichText;
|
|
5277
|
+
if (typeof t != "function") throw new Z("BUBBLE-COMPOSITION-007", "Bubble ruby content requires the text capability setRichText method.");
|
|
5278
|
+
return t;
|
|
5279
|
+
}
|
|
5280
|
+
function Ha(e, t, n, r) {
|
|
5281
|
+
return !Bi(e) && typeof r.splitRichText == "function" ? r.splitRichText({
|
|
5282
|
+
reveal: t,
|
|
5283
|
+
runs: e,
|
|
5284
|
+
styleName: n
|
|
5285
|
+
}) : Qi(e, t);
|
|
5286
|
+
}
|
|
5287
|
+
function Ua(e, t, n) {
|
|
5288
|
+
if (t.layoutProfile === "scratch-default") return la(e, (e) => typeof n.measureText == "function" ? n.measureText({
|
|
5173
5289
|
styleName: t.textStyle,
|
|
5174
5290
|
text: e
|
|
5175
5291
|
}) : NaN).text;
|
|
@@ -5185,11 +5301,11 @@ function Aa(e, t, n) {
|
|
|
5185
5301
|
}) ?? 0
|
|
5186
5302
|
}).lines.map(({ text: e }) => e).join("\n");
|
|
5187
5303
|
}
|
|
5188
|
-
function
|
|
5304
|
+
function Wa(e, t) {
|
|
5189
5305
|
if (e.length === 1) throw e[0];
|
|
5190
5306
|
if (e.length > 1) throw AggregateError(e, t);
|
|
5191
5307
|
}
|
|
5192
|
-
function
|
|
5308
|
+
function Ga(e) {
|
|
5193
5309
|
let t = !1, n = 0, r = 0, i, a = Promise.resolve(), o = async (t) => {
|
|
5194
5310
|
let n = e.animation.frames[t];
|
|
5195
5311
|
n !== void 0 && await e.imageResolver.applyToTarget(n, e.target);
|
|
@@ -5224,40 +5340,45 @@ function Ma(e) {
|
|
|
5224
5340
|
}
|
|
5225
5341
|
});
|
|
5226
5342
|
}
|
|
5227
|
-
function
|
|
5343
|
+
function Ka(e) {
|
|
5228
5344
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
|
|
5229
|
-
if (
|
|
5345
|
+
if (xa(e, [
|
|
5230
5346
|
"actor",
|
|
5231
5347
|
"actorKey",
|
|
5232
5348
|
"kind",
|
|
5233
5349
|
"text",
|
|
5234
5350
|
"styleName"
|
|
5235
|
-
], ["animationMode", "reveal"], "Show bubble input"), !
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5351
|
+
], ["animationMode", "reveal"], "Show bubble input"), !_a.has(e.kind)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble kind must be say or think.");
|
|
5352
|
+
let t;
|
|
5353
|
+
try {
|
|
5354
|
+
t = zi(e.text);
|
|
5355
|
+
} catch (e) {
|
|
5356
|
+
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble text is invalid.");
|
|
5357
|
+
}
|
|
5358
|
+
let n = e.animationMode ?? "talking";
|
|
5359
|
+
if (!va.has(n)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid.");
|
|
5360
|
+
let r;
|
|
5240
5361
|
if (e.reveal !== void 0) try {
|
|
5241
|
-
|
|
5362
|
+
r = Ki(e.reveal);
|
|
5242
5363
|
} catch (e) {
|
|
5243
5364
|
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
|
|
5244
5365
|
}
|
|
5245
5366
|
return {
|
|
5246
5367
|
actor: e.actor,
|
|
5247
|
-
actorKey:
|
|
5368
|
+
actorKey: Sa(e.actorKey, "Bubble actor key"),
|
|
5248
5369
|
kind: e.kind,
|
|
5249
|
-
|
|
5250
|
-
styleName:
|
|
5251
|
-
animationMode:
|
|
5252
|
-
...
|
|
5370
|
+
content: t,
|
|
5371
|
+
styleName: Sa(e.styleName, "Bubble style name"),
|
|
5372
|
+
animationMode: n,
|
|
5373
|
+
...r === void 0 ? {} : { reveal: r }
|
|
5253
5374
|
};
|
|
5254
5375
|
}
|
|
5255
|
-
function
|
|
5376
|
+
function qa(e) {
|
|
5256
5377
|
if (!Q(e)) throw TypeError("Bubble composition options must be an object.");
|
|
5257
|
-
let t =
|
|
5378
|
+
let t = ka(e.imageResolver), n = Aa(e.audio), r = Ma(e.textCapability);
|
|
5258
5379
|
if (typeof e.createSurface != "function") throw TypeError("Bubble composition createSurface must be a function.");
|
|
5259
5380
|
if (e.onAnimationError !== void 0 && typeof e.onAnimationError != "function") throw TypeError("Bubble composition onAnimationError must be a function.");
|
|
5260
|
-
let i =
|
|
5381
|
+
let i = Pa(e.scheduler ?? Na()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
|
|
5261
5382
|
if (c) throw new Z("BUBBLE-COMPOSITION-005", "Bubble composition has been disposed.");
|
|
5262
5383
|
}, u = async (e, t) => {
|
|
5263
5384
|
let n = (s.get(e) ?? Promise.resolve()).catch(() => void 0).then(t);
|
|
@@ -5277,9 +5398,9 @@ function Pa(e) {
|
|
|
5277
5398
|
layoutProfile: "custom",
|
|
5278
5399
|
reveal: s.reveal
|
|
5279
5400
|
}));
|
|
5280
|
-
let d = s.
|
|
5281
|
-
let n = new Set(
|
|
5282
|
-
for (let e of n)
|
|
5401
|
+
let d = s.content, f = (e) => {
|
|
5402
|
+
let n = new Set(Ba(e)), r = n.size === 0 ? void 0 : ja(t);
|
|
5403
|
+
for (let e of n) Ra(r, e);
|
|
5283
5404
|
return r;
|
|
5284
5405
|
}, p = f(u);
|
|
5285
5406
|
for (let e of [
|
|
@@ -5287,13 +5408,13 @@ function Pa(e) {
|
|
|
5287
5408
|
u.audio?.reveal,
|
|
5288
5409
|
u.audio?.finish,
|
|
5289
5410
|
u.reveal?.sound
|
|
5290
|
-
]) e !== void 0 &&
|
|
5411
|
+
]) e !== void 0 && za(n, e);
|
|
5291
5412
|
let m = async (e, t = !1) => {
|
|
5292
5413
|
e !== void 0 && n !== void 0 && await n.playSound(e, { untilDone: t });
|
|
5293
5414
|
}, h = async (e, t, n) => {
|
|
5294
|
-
let r =
|
|
5415
|
+
let r = Ba(e).length === 0 ? void 0 : ja(t), i = [];
|
|
5295
5416
|
if (e.portrait) {
|
|
5296
|
-
let t =
|
|
5417
|
+
let t = ja(r);
|
|
5297
5418
|
i.push(Promise.resolve(t.applyToTarget(e.portrait.base, n.targets.portraitBase)));
|
|
5298
5419
|
let a = e.portrait.blink?.frames[0];
|
|
5299
5420
|
a !== void 0 && i.push(Promise.resolve(t.applyToTarget(a, n.targets.portraitBlink)));
|
|
@@ -5302,169 +5423,176 @@ function Pa(e) {
|
|
|
5302
5423
|
}
|
|
5303
5424
|
let a = e.continueIndicator?.frames[0];
|
|
5304
5425
|
if (a !== void 0) {
|
|
5305
|
-
let e =
|
|
5426
|
+
let e = ja(r);
|
|
5306
5427
|
i.push(Promise.resolve(e.applyToTarget(a, n.targets.continueIndicator)));
|
|
5307
5428
|
}
|
|
5308
5429
|
await Promise.all(i);
|
|
5309
5430
|
}, g = (t, n, r) => {
|
|
5310
|
-
x = t.portrait?.blink === void 0 ? void 0 :
|
|
5431
|
+
x = t.portrait?.blink === void 0 ? void 0 : Ga({
|
|
5311
5432
|
actorKey: s.actorKey,
|
|
5312
5433
|
layer: "portraitBlink",
|
|
5313
5434
|
animation: t.portrait.blink,
|
|
5314
5435
|
target: r.targets.portraitBlink,
|
|
5315
|
-
imageResolver:
|
|
5436
|
+
imageResolver: ja(n),
|
|
5316
5437
|
scheduler: i,
|
|
5317
5438
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
5318
|
-
}), S = t.portrait?.lipSync === void 0 ? void 0 :
|
|
5439
|
+
}), S = t.portrait?.lipSync === void 0 ? void 0 : Ga({
|
|
5319
5440
|
actorKey: s.actorKey,
|
|
5320
5441
|
layer: "portraitLipSync",
|
|
5321
5442
|
animation: t.portrait.lipSync,
|
|
5322
5443
|
target: r.targets.portraitLipSync,
|
|
5323
|
-
imageResolver:
|
|
5444
|
+
imageResolver: ja(n),
|
|
5324
5445
|
scheduler: i,
|
|
5325
5446
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
5326
|
-
}), C = t.continueIndicator === void 0 ? void 0 :
|
|
5447
|
+
}), C = t.continueIndicator === void 0 ? void 0 : Ga({
|
|
5327
5448
|
actorKey: s.actorKey,
|
|
5328
5449
|
layer: "continueIndicator",
|
|
5329
5450
|
animation: t.continueIndicator,
|
|
5330
5451
|
target: r.targets.continueIndicator,
|
|
5331
|
-
imageResolver:
|
|
5452
|
+
imageResolver: ja(n),
|
|
5332
5453
|
scheduler: i,
|
|
5333
5454
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
5334
5455
|
});
|
|
5335
5456
|
}, _ = o.get(s.actorKey);
|
|
5336
5457
|
_ && await _.close();
|
|
5337
|
-
let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ?
|
|
5458
|
+
let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? Ha(s.content, w, u.textStyle, r) : Object.freeze([s.content]), E = w ? Math.min(1, T.length) : 1, D, O = 0;
|
|
5338
5459
|
try {
|
|
5339
|
-
v =
|
|
5460
|
+
v = La(await e.createSurface(Object.freeze({
|
|
5340
5461
|
actor: s.actor,
|
|
5341
5462
|
actorKey: s.actorKey,
|
|
5342
5463
|
kind: s.kind,
|
|
5343
5464
|
style: u
|
|
5344
5465
|
})), u);
|
|
5345
|
-
let t =
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5466
|
+
let t = (e, t, n) => {
|
|
5467
|
+
Va(r)({
|
|
5468
|
+
runs: e,
|
|
5469
|
+
styleName: t.textStyle,
|
|
5470
|
+
target: n,
|
|
5471
|
+
...t.maxWidth === void 0 ? {} : { maxWidth: t.maxWidth }
|
|
5472
|
+
}), y = !0;
|
|
5473
|
+
}, a = () => !Bi(d), c = async (e, n = u) => {
|
|
5474
|
+
if (a()) {
|
|
5475
|
+
if (!v) return;
|
|
5476
|
+
if (n.layoutProfile === "scratch-default" && v.renderScratchText) throw new Z("BUBBLE-COMPOSITION-007", "Bubble ruby content requires a rich text capability; the scratch-default surface renders plain text only.");
|
|
5477
|
+
t(e, n, v.targets.text);
|
|
5478
|
+
return;
|
|
5479
|
+
}
|
|
5480
|
+
let i = Vi(e);
|
|
5481
|
+
if (n.layoutProfile === "scratch-default" && v?.renderScratchText) {
|
|
5482
|
+
let e = la(i, (e) => typeof r.measureText == "function" ? r.measureText({
|
|
5483
|
+
styleName: n.textStyle,
|
|
5349
5484
|
text: e
|
|
5350
5485
|
}) : NaN);
|
|
5351
|
-
await v.renderScratchText(
|
|
5486
|
+
await v.renderScratchText(e);
|
|
5352
5487
|
return;
|
|
5353
5488
|
}
|
|
5354
5489
|
v && (r.setText({
|
|
5355
|
-
styleName:
|
|
5490
|
+
styleName: n.textStyle,
|
|
5356
5491
|
target: v.targets.text,
|
|
5357
|
-
text:
|
|
5492
|
+
text: Ua(i, n, r)
|
|
5358
5493
|
}), y = !0);
|
|
5359
|
-
}
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
r.setText({
|
|
5363
|
-
styleName: u.textStyle,
|
|
5494
|
+
}, l = (e, n = u) => {
|
|
5495
|
+
v && (a() ? t(e, n, v.targets.text) : (r.setText({
|
|
5496
|
+
styleName: n.textStyle,
|
|
5364
5497
|
target: v.targets.text,
|
|
5365
|
-
text: e
|
|
5366
|
-
}), y = !0, v.captureTextLayout?.();
|
|
5367
|
-
}
|
|
5368
|
-
await
|
|
5369
|
-
let
|
|
5498
|
+
text: Ua(Vi(e), n, r)
|
|
5499
|
+
}), y = !0), v.captureTextLayout?.());
|
|
5500
|
+
};
|
|
5501
|
+
w?.layout === "RESERVED" && l(s.content), await c(w ? $i(T, E) : s.content), await h(u, p, v), g(u, p, v);
|
|
5502
|
+
let _ = "idle", k = !1, A = Promise.resolve(), j = async () => {
|
|
5370
5503
|
if (!v) return;
|
|
5371
|
-
let e = w ?
|
|
5372
|
-
await
|
|
5373
|
-
},
|
|
5504
|
+
let e = w ? $i(T, E) : d;
|
|
5505
|
+
await c(e), await v.show();
|
|
5506
|
+
}, M = () => {
|
|
5374
5507
|
O += 1, D !== void 0 && i.clearTimeout(D), D = void 0;
|
|
5375
|
-
},
|
|
5508
|
+
}, N = async () => !w || E >= T.length ? !1 : (E += 1, await j(), await m(w.sound ?? u.audio?.reveal), E >= T.length && M(), !0), P = () => {
|
|
5376
5509
|
if (!w || w.intervalSeconds <= 0 || E >= T.length) return;
|
|
5377
5510
|
let e = O;
|
|
5378
5511
|
D = i.setTimeout(() => {
|
|
5379
|
-
D = void 0, !(
|
|
5512
|
+
D = void 0, !(k || e !== O) && (A = A.then(() => N()).then(() => P()));
|
|
5380
5513
|
}, w.intervalSeconds * 1e3);
|
|
5381
|
-
},
|
|
5382
|
-
e !==
|
|
5514
|
+
}, F = async (e) => {
|
|
5515
|
+
e !== _ && (e === "talking" ? (await C?.stop(), await v?.setLayerVisible("continueIndicator", !1), await v?.setLayerVisible("portraitLipSync", S !== void 0), await S?.start({ primed: !0 })) : e === "awaiting-continue" ? (await S?.stop({ reset: !0 }), await v?.setLayerVisible("portraitLipSync", !1), await v?.setLayerVisible("continueIndicator", C !== void 0), await C?.start({ primed: !0 })) : (await Promise.all([S?.stop({ reset: !0 }), C?.stop()]), await Promise.all([v?.setLayerVisible("portraitLipSync", !1), v?.setLayerVisible("continueIndicator", !1)])), _ = e);
|
|
5383
5516
|
};
|
|
5384
5517
|
await Promise.all([
|
|
5385
5518
|
v.setLayerVisible("portraitBase", u.portrait !== void 0),
|
|
5386
5519
|
v.setLayerVisible("portraitBlink", u.portrait?.blink !== void 0),
|
|
5387
5520
|
v.setLayerVisible("portraitLipSync", !1),
|
|
5388
5521
|
v.setLayerVisible("continueIndicator", !1)
|
|
5389
|
-
]), await v.show(), b = !0, await m(u.audio?.voice), w !== void 0 && await m(w.sound ?? u.audio?.reveal), await x?.start({ primed: !0 }), await
|
|
5390
|
-
let
|
|
5522
|
+
]), await v.show(), b = !0, await m(u.audio?.voice), w !== void 0 && await m(w.sound ?? u.audio?.reveal), await x?.start({ primed: !0 }), await F(s.animationMode);
|
|
5523
|
+
let I = Object.freeze({
|
|
5391
5524
|
actorKey: s.actorKey,
|
|
5392
5525
|
kind: s.kind,
|
|
5393
5526
|
get animationMode() {
|
|
5394
|
-
return
|
|
5527
|
+
return _;
|
|
5395
5528
|
},
|
|
5396
5529
|
setText(e) {
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
}
|
|
5530
|
+
if (k) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
5531
|
+
let t;
|
|
5532
|
+
try {
|
|
5533
|
+
t = zi(e);
|
|
5534
|
+
} catch (e) {
|
|
5535
|
+
return Promise.reject(new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble text is invalid."));
|
|
5536
|
+
}
|
|
5537
|
+
return A = A.then(async () => {
|
|
5538
|
+
v && (M(), d = t, w ? (T = Ha(t, w, u.textStyle, r), E = Math.min(1, T.length), w.layout === "RESERVED" && l(t), await j(), P()) : await j());
|
|
5539
|
+
}), A;
|
|
5404
5540
|
},
|
|
5405
5541
|
updateStyle(e) {
|
|
5406
|
-
if (
|
|
5407
|
-
let
|
|
5542
|
+
if (k) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
5543
|
+
let t;
|
|
5408
5544
|
try {
|
|
5409
|
-
|
|
5545
|
+
t = Oa(e);
|
|
5410
5546
|
} catch (e) {
|
|
5411
5547
|
return Promise.reject(e);
|
|
5412
5548
|
}
|
|
5413
|
-
return
|
|
5549
|
+
return A = A.then(async () => {
|
|
5414
5550
|
if (!v) return;
|
|
5415
|
-
|
|
5416
|
-
let e = f(
|
|
5551
|
+
La(v, t);
|
|
5552
|
+
let e = f(t);
|
|
5417
5553
|
for (let e of [
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
]) e !== void 0 &&
|
|
5554
|
+
t.audio?.voice,
|
|
5555
|
+
t.audio?.reveal,
|
|
5556
|
+
t.audio?.finish,
|
|
5557
|
+
t.reveal?.sound
|
|
5558
|
+
]) e !== void 0 && za(n, e);
|
|
5423
5559
|
await Promise.all([
|
|
5424
5560
|
x?.stop(),
|
|
5425
5561
|
S?.stop(),
|
|
5426
5562
|
C?.stop()
|
|
5427
|
-
]), await h(
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
text: Aa(d, i, r)
|
|
5431
|
-
}), y = !0, v.captureTextLayout?.()), await t(d, i), g(i, e, v), await Promise.all([
|
|
5432
|
-
v.setLayerVisible("portraitBase", i.portrait !== void 0),
|
|
5433
|
-
v.setLayerVisible("portraitBlink", i.portrait?.blink !== void 0),
|
|
5563
|
+
]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? Ha(d, w, t.textStyle, r) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, M(), w?.layout === "RESERVED" && l(d, t), await c(d, t), g(t, e, v), await Promise.all([
|
|
5564
|
+
v.setLayerVisible("portraitBase", t.portrait !== void 0),
|
|
5565
|
+
v.setLayerVisible("portraitBlink", t.portrait?.blink !== void 0),
|
|
5434
5566
|
v.setLayerVisible("portraitLipSync", !1),
|
|
5435
5567
|
v.setLayerVisible("continueIndicator", !1)
|
|
5436
5568
|
]);
|
|
5437
|
-
let
|
|
5438
|
-
|
|
5439
|
-
}),
|
|
5569
|
+
let i = _;
|
|
5570
|
+
_ = "idle", await x?.start({ primed: !0 }), await F(i), await j(), P(), await m(u.audio?.voice);
|
|
5571
|
+
}), A;
|
|
5440
5572
|
},
|
|
5441
5573
|
setAnimationMode(e) {
|
|
5442
|
-
return
|
|
5574
|
+
return k ? Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : va.has(e) ? (A = A.then(() => F(e)), A) : Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble animation mode is invalid."));
|
|
5443
5575
|
},
|
|
5444
5576
|
revealNext() {
|
|
5445
|
-
if (
|
|
5577
|
+
if (k) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
5446
5578
|
let e = !1;
|
|
5447
|
-
return
|
|
5448
|
-
e = await
|
|
5449
|
-
}),
|
|
5579
|
+
return A = A.then(async () => {
|
|
5580
|
+
e = await N(), e && P();
|
|
5581
|
+
}), A.then(() => e);
|
|
5450
5582
|
},
|
|
5451
5583
|
revealAll() {
|
|
5452
|
-
return
|
|
5453
|
-
if (
|
|
5454
|
-
}),
|
|
5584
|
+
return k ? Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`)) : (A = A.then(async () => {
|
|
5585
|
+
if (M(), w) for (; await N(););
|
|
5586
|
+
}), A);
|
|
5455
5587
|
},
|
|
5456
5588
|
finish(e = {}) {
|
|
5457
|
-
if (
|
|
5589
|
+
if (k) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
5458
5590
|
let t = e.timeoutSeconds ?? 0;
|
|
5459
|
-
return !Number.isFinite(t) || t < 0 ? Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble finish timeoutSeconds must be zero or greater.")) : e.condition !== void 0 && typeof e.condition != "function" ? Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble finish condition must be a function.")) : (
|
|
5460
|
-
if (
|
|
5591
|
+
return !Number.isFinite(t) || t < 0 ? Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble finish timeoutSeconds must be zero or greater.")) : e.condition !== void 0 && typeof e.condition != "function" ? Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble finish condition must be a function.")) : (A = A.then(async () => {
|
|
5592
|
+
if (M(), e.unit !== void 0 && (w = Ki({
|
|
5461
5593
|
...w ?? {},
|
|
5462
5594
|
unit: e.unit
|
|
5463
|
-
}), T =
|
|
5464
|
-
styleName: u.textStyle,
|
|
5465
|
-
target: v.targets.text,
|
|
5466
|
-
text: Aa(d, u, r)
|
|
5467
|
-
}), y = !0, v.captureTextLayout?.())), w) for (; await A(););
|
|
5595
|
+
}), T = Ha(d, w, u.textStyle, r), E = Math.min(1, T.length), w.layout === "RESERVED" && v && l(d)), w) for (; await N(););
|
|
5468
5596
|
let n = e.condition;
|
|
5469
5597
|
if (n === void 0 && t === 0) {
|
|
5470
5598
|
await m(u.audio?.finish);
|
|
@@ -5491,38 +5619,38 @@ function Pa(e) {
|
|
|
5491
5619
|
};
|
|
5492
5620
|
l();
|
|
5493
5621
|
});
|
|
5494
|
-
}),
|
|
5622
|
+
}), A);
|
|
5495
5623
|
},
|
|
5496
5624
|
animate(e) {
|
|
5497
|
-
if (
|
|
5498
|
-
let
|
|
5625
|
+
if (k) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
5626
|
+
let t;
|
|
5499
5627
|
try {
|
|
5500
|
-
|
|
5628
|
+
t = Ea(e, "Bubble motion");
|
|
5501
5629
|
} catch (e) {
|
|
5502
5630
|
return Promise.reject(e);
|
|
5503
5631
|
}
|
|
5504
|
-
return
|
|
5505
|
-
if (
|
|
5632
|
+
return A = A.then(async () => {
|
|
5633
|
+
if (t.name === "animateBubbleShape" && t.visualStyle) {
|
|
5506
5634
|
let e = Object.freeze({
|
|
5507
5635
|
...u,
|
|
5508
5636
|
layoutProfile: "custom"
|
|
5509
|
-
}),
|
|
5637
|
+
}), n = Object.freeze({
|
|
5510
5638
|
...e,
|
|
5511
|
-
visualStyle:
|
|
5639
|
+
visualStyle: t.visualStyle
|
|
5512
5640
|
});
|
|
5513
|
-
u.layoutProfile === "scratch-default" && (await v?.updateStyle(e), await
|
|
5641
|
+
u.layoutProfile === "scratch-default" && (await v?.updateStyle(e), await c(d, e), await v?.show()), await v?.animate?.(t), u = n, await v?.updateStyle(u);
|
|
5514
5642
|
return;
|
|
5515
5643
|
}
|
|
5516
|
-
await v?.animate?.(
|
|
5517
|
-
}),
|
|
5644
|
+
await v?.animate?.(t);
|
|
5645
|
+
}), A;
|
|
5518
5646
|
},
|
|
5519
5647
|
async close() {
|
|
5520
|
-
if (
|
|
5521
|
-
|
|
5648
|
+
if (k) return;
|
|
5649
|
+
k = !0;
|
|
5522
5650
|
let e = [];
|
|
5523
|
-
|
|
5651
|
+
M();
|
|
5524
5652
|
try {
|
|
5525
|
-
await
|
|
5653
|
+
await A;
|
|
5526
5654
|
} catch (t) {
|
|
5527
5655
|
e.push(t);
|
|
5528
5656
|
}
|
|
@@ -5543,10 +5671,10 @@ function Pa(e) {
|
|
|
5543
5671
|
} catch (t) {
|
|
5544
5672
|
e.push(t);
|
|
5545
5673
|
}
|
|
5546
|
-
o.get(s.actorKey) ===
|
|
5674
|
+
o.get(s.actorKey) === I && o.delete(s.actorKey), Wa(e, `Failed to close bubble: ${s.actorKey}`);
|
|
5547
5675
|
}
|
|
5548
5676
|
});
|
|
5549
|
-
return o.set(s.actorKey,
|
|
5677
|
+
return o.set(s.actorKey, I), P(), u.showAnimation !== void 0 && await I.animate(u.showAnimation), I;
|
|
5550
5678
|
} catch (e) {
|
|
5551
5679
|
o.delete(s.actorKey);
|
|
5552
5680
|
let t = [], n = await Promise.allSettled([
|
|
@@ -5575,85 +5703,85 @@ function Pa(e) {
|
|
|
5575
5703
|
return Object.freeze({
|
|
5576
5704
|
defineStyle(e) {
|
|
5577
5705
|
l();
|
|
5578
|
-
let t =
|
|
5706
|
+
let t = Oa(e);
|
|
5579
5707
|
a.set(t.name, t);
|
|
5580
5708
|
},
|
|
5581
5709
|
hasActiveBubble(e) {
|
|
5582
|
-
return o.has(
|
|
5710
|
+
return o.has(Sa(e, "Bubble actor key"));
|
|
5583
5711
|
},
|
|
5584
5712
|
async show(e) {
|
|
5585
5713
|
l();
|
|
5586
|
-
let t =
|
|
5714
|
+
let t = Ka(e);
|
|
5587
5715
|
return u(t.actorKey, () => d(t));
|
|
5588
5716
|
},
|
|
5589
5717
|
releaseTarget(e) {
|
|
5590
5718
|
l();
|
|
5591
|
-
let t =
|
|
5719
|
+
let t = Sa(e, "Bubble actor key");
|
|
5592
5720
|
return u(t, async () => {
|
|
5593
5721
|
await o.get(t)?.close();
|
|
5594
5722
|
});
|
|
5595
5723
|
},
|
|
5596
5724
|
async releaseAll() {
|
|
5597
|
-
l(), await Promise.allSettled([...s.values()]),
|
|
5725
|
+
l(), await Promise.allSettled([...s.values()]), Wa((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
|
|
5598
5726
|
},
|
|
5599
5727
|
async dispose() {
|
|
5600
5728
|
if (c) return;
|
|
5601
5729
|
c = !0, await Promise.allSettled([...s.values()]);
|
|
5602
5730
|
let e = await Promise.allSettled([...o.values()].map((e) => e.close()));
|
|
5603
|
-
a.clear(),
|
|
5731
|
+
a.clear(), Wa(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
|
|
5604
5732
|
}
|
|
5605
5733
|
});
|
|
5606
5734
|
}
|
|
5607
5735
|
//#endregion
|
|
5608
5736
|
//#region src/turbowarp-svg-text-adapter.ts
|
|
5609
|
-
function
|
|
5737
|
+
function Ja(e) {
|
|
5610
5738
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
5611
5739
|
}
|
|
5612
|
-
function
|
|
5613
|
-
if (!
|
|
5740
|
+
function Ya(e) {
|
|
5741
|
+
if (!Ja(e) || typeof e.setText != "function" || typeof e.releaseTextActor != "function") throw TypeError("TurboWarp-SVG-Text adapter requires setText and releaseTextActor.");
|
|
5614
5742
|
return e;
|
|
5615
5743
|
}
|
|
5616
|
-
function
|
|
5617
|
-
if (!
|
|
5744
|
+
function Xa(e) {
|
|
5745
|
+
if (!Ja(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("SVG Text composition adapter requires setText and releaseTarget.");
|
|
5618
5746
|
return e;
|
|
5619
5747
|
}
|
|
5620
|
-
function
|
|
5621
|
-
if (!
|
|
5748
|
+
function Za(e) {
|
|
5749
|
+
if (!Ja(e) || typeof e.layoutText != "function") throw TypeError("SVG Text overlay adapter requires the layoutText composition API.");
|
|
5622
5750
|
return e;
|
|
5623
5751
|
}
|
|
5624
|
-
function
|
|
5752
|
+
function Qa(e, t) {
|
|
5625
5753
|
let n = Number(e);
|
|
5626
5754
|
if (!Number.isFinite(n)) throw TypeError(`${t} must be a finite number.`);
|
|
5627
5755
|
return n;
|
|
5628
5756
|
}
|
|
5629
|
-
function
|
|
5630
|
-
if (!
|
|
5757
|
+
function $a(e) {
|
|
5758
|
+
if (!Ja(e) || !Ja(e.style) || !Array.isArray(e.lines)) throw TypeError("SVG Text layout result is invalid.");
|
|
5631
5759
|
let t = e.style, n = t.alignment;
|
|
5632
5760
|
if (n !== "left" && n !== "center" && n !== "right") throw TypeError("SVG Text layout alignment is invalid.");
|
|
5633
|
-
let r =
|
|
5634
|
-
if (!
|
|
5761
|
+
let r = Qa(e.width, "SVG Text layout width"), i = Qa(e.height, "SVG Text layout height"), a = Object.freeze(e.lines.map((e) => {
|
|
5762
|
+
if (!Ja(e) || typeof e.text != "string") throw TypeError("SVG Text layout line is invalid.");
|
|
5635
5763
|
return Object.freeze({
|
|
5636
|
-
baseline:
|
|
5764
|
+
baseline: Qa(e.baseline, "SVG Text line baseline") - i / 2,
|
|
5637
5765
|
text: e.text,
|
|
5638
|
-
x:
|
|
5766
|
+
x: Qa(e.x, "SVG Text line x") - r / 2
|
|
5639
5767
|
});
|
|
5640
5768
|
}));
|
|
5641
5769
|
return Object.freeze({
|
|
5642
5770
|
alignment: n,
|
|
5643
5771
|
backgroundColor: String(t.backgroundColor),
|
|
5644
|
-
backgroundCornerRadius:
|
|
5772
|
+
backgroundCornerRadius: Qa(t.cornerRadius, "SVG Text corner radius"),
|
|
5645
5773
|
fill: String(t.textColor),
|
|
5646
5774
|
fontFamily: String(t.font),
|
|
5647
|
-
fontSize:
|
|
5775
|
+
fontSize: Qa(t.fontSize, "SVG Text font size"),
|
|
5648
5776
|
height: i,
|
|
5649
|
-
lineHeight:
|
|
5777
|
+
lineHeight: Qa(t.lineHeight, "SVG Text line height"),
|
|
5650
5778
|
lines: a,
|
|
5651
5779
|
preserveWhitespace: e.preserveWhitespace !== !1,
|
|
5652
5780
|
width: r
|
|
5653
5781
|
});
|
|
5654
5782
|
}
|
|
5655
|
-
function
|
|
5656
|
-
let t =
|
|
5783
|
+
function eo(e) {
|
|
5784
|
+
let t = Ya(e);
|
|
5657
5785
|
return Object.freeze({
|
|
5658
5786
|
setText({ styleName: e, target: n, text: r }) {
|
|
5659
5787
|
t.setText({
|
|
@@ -5665,13 +5793,13 @@ function Va(e) {
|
|
|
5665
5793
|
t.releaseTextActor(e);
|
|
5666
5794
|
},
|
|
5667
5795
|
measureText({ styleName: e, text: n }) {
|
|
5668
|
-
if (typeof t.measureText != "function") throw Error("TurboWarp
|
|
5796
|
+
if (typeof t.measureText != "function") throw Error("TurboWarp-SVG-Text does not provide text measurement.");
|
|
5669
5797
|
return t.measureText(e, n);
|
|
5670
5798
|
}
|
|
5671
5799
|
});
|
|
5672
5800
|
}
|
|
5673
|
-
function
|
|
5674
|
-
let t =
|
|
5801
|
+
function to(e) {
|
|
5802
|
+
let t = Xa(e), n = {
|
|
5675
5803
|
setText({ styleName: e, target: n, text: r }) {
|
|
5676
5804
|
t.setText({
|
|
5677
5805
|
styleName: e,
|
|
@@ -5686,13 +5814,24 @@ function Ha(e) {
|
|
|
5686
5814
|
return typeof t.measureText == "function" && (n.measureText = ({ styleName: e, text: n }) => t.measureText?.({
|
|
5687
5815
|
styleName: e,
|
|
5688
5816
|
text: n
|
|
5817
|
+
}) ?? 0), typeof t.setRichText == "function" && (n.setRichText = ({ maxWidth: e, runs: n, styleName: r, target: i }) => {
|
|
5818
|
+
t.setRichText?.({
|
|
5819
|
+
runs: n,
|
|
5820
|
+
styleName: r,
|
|
5821
|
+
target: i,
|
|
5822
|
+
...e === void 0 ? {} : { maxWidth: e }
|
|
5823
|
+
});
|
|
5824
|
+
}), typeof t.measureRichText == "function" && (n.measureRichText = ({ maxWidth: e, runs: n, styleName: r }) => t.measureRichText?.({
|
|
5825
|
+
runs: n,
|
|
5826
|
+
styleName: r,
|
|
5827
|
+
...e === void 0 ? {} : { maxWidth: e }
|
|
5689
5828
|
}) ?? 0), Object.freeze(n);
|
|
5690
5829
|
}
|
|
5691
|
-
function
|
|
5692
|
-
let t =
|
|
5830
|
+
function no(e) {
|
|
5831
|
+
let t = Za(e);
|
|
5693
5832
|
return Object.freeze({
|
|
5694
5833
|
layoutText({ nativeSize: e, styleName: n, text: r }) {
|
|
5695
|
-
return
|
|
5834
|
+
return $a(t.layoutText({
|
|
5696
5835
|
nativeSize: [e.width, e.height],
|
|
5697
5836
|
styleName: n,
|
|
5698
5837
|
text: r
|
|
@@ -5704,17 +5843,17 @@ function Ua(e) {
|
|
|
5704
5843
|
styleName: n,
|
|
5705
5844
|
text: r
|
|
5706
5845
|
});
|
|
5707
|
-
return Math.max(1, ...i.lines.map((e) =>
|
|
5846
|
+
return Math.max(1, ...i.lines.map((e) => Qa(e.width, "SVG Text line width")));
|
|
5708
5847
|
}
|
|
5709
5848
|
});
|
|
5710
5849
|
}
|
|
5711
|
-
function
|
|
5712
|
-
if (!
|
|
5713
|
-
return
|
|
5850
|
+
function ro(e) {
|
|
5851
|
+
if (!Ja(e) || typeof e.getLayoutCapability != "function") throw TypeError("TurboWarp-SVG-Text overlay adapter requires SVG Text 0.8.1 getLayoutCapability().");
|
|
5852
|
+
return no(e.getLayoutCapability());
|
|
5714
5853
|
}
|
|
5715
5854
|
//#endregion
|
|
5716
5855
|
//#region src/asset-manager-image-adapter.ts
|
|
5717
|
-
var
|
|
5856
|
+
var io = /* @__PURE__ */ new Set([
|
|
5718
5857
|
"image/avif",
|
|
5719
5858
|
"image/gif",
|
|
5720
5859
|
"image/jpeg",
|
|
@@ -5722,37 +5861,37 @@ var Ga = /* @__PURE__ */ new Set([
|
|
|
5722
5861
|
"image/svg+xml",
|
|
5723
5862
|
"image/webp"
|
|
5724
5863
|
]);
|
|
5725
|
-
function
|
|
5864
|
+
function ao(e) {
|
|
5726
5865
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
5727
5866
|
}
|
|
5728
|
-
function
|
|
5867
|
+
function oo(e) {
|
|
5729
5868
|
let t = e.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
5730
5869
|
return t === "image/jpg" || t === "image/pjpeg" ? "image/jpeg" : t === "image/x-png" ? "image/png" : t;
|
|
5731
5870
|
}
|
|
5732
|
-
function
|
|
5733
|
-
return
|
|
5871
|
+
function so(e) {
|
|
5872
|
+
return io.has(oo(e));
|
|
5734
5873
|
}
|
|
5735
|
-
function
|
|
5736
|
-
if (!
|
|
5874
|
+
function co(e) {
|
|
5875
|
+
if (!ao(e) || typeof e.url != "string" || !e.url.startsWith("blob:") || typeof e.mimeType != "string" || !so(e.mimeType) || typeof e.width != "number" || !Number.isFinite(e.width) || e.width <= 0 || typeof e.height != "number" || !Number.isFinite(e.height) || e.height <= 0 || typeof e.release != "function") throw TypeError("Asset Manager DOM image resources must provide a supported MIME type, positive intrinsic dimensions, a blob URL, and release().");
|
|
5737
5876
|
return e;
|
|
5738
5877
|
}
|
|
5739
|
-
function
|
|
5740
|
-
if (!
|
|
5878
|
+
function lo(e) {
|
|
5879
|
+
if (!ao(e) || typeof e.isRegistered != "function" || typeof e.getMimeType != "function" || typeof e.resolveDOMImageResource != "function") throw TypeError("Asset Manager DOM image capability is invalid.");
|
|
5741
5880
|
let t = e;
|
|
5742
5881
|
return Object.freeze({
|
|
5743
5882
|
isRegistered(e) {
|
|
5744
|
-
return t.isRegistered(e) &&
|
|
5883
|
+
return t.isRegistered(e) && so(t.getMimeType(e));
|
|
5745
5884
|
},
|
|
5746
5885
|
getMimeType(e) {
|
|
5747
|
-
return
|
|
5886
|
+
return oo(t.getMimeType(e));
|
|
5748
5887
|
},
|
|
5749
5888
|
async resolveImage(e) {
|
|
5750
|
-
let n =
|
|
5751
|
-
if (!t.isRegistered(e) || !
|
|
5889
|
+
let n = oo(t.getMimeType(e));
|
|
5890
|
+
if (!t.isRegistered(e) || !so(n)) throw TypeError("Asset Manager image is not registered with a Bubble-compatible MIME type.");
|
|
5752
5891
|
let r = await t.resolveDOMImageResource(e);
|
|
5753
5892
|
try {
|
|
5754
|
-
|
|
5755
|
-
let e =
|
|
5893
|
+
co(r);
|
|
5894
|
+
let e = oo(r.mimeType);
|
|
5756
5895
|
if (e !== n) throw TypeError("Asset Manager DOM image resource MIME type changed during resolution.");
|
|
5757
5896
|
return Object.freeze({
|
|
5758
5897
|
height: r.height,
|
|
@@ -5770,11 +5909,11 @@ function Xa(e) {
|
|
|
5770
5909
|
}
|
|
5771
5910
|
//#endregion
|
|
5772
5911
|
//#region src/surface-motion.ts
|
|
5773
|
-
function
|
|
5912
|
+
function uo(e) {
|
|
5774
5913
|
return Math.max(0, Math.min(1, e));
|
|
5775
5914
|
}
|
|
5776
|
-
function
|
|
5777
|
-
let n =
|
|
5915
|
+
function fo(e, t) {
|
|
5916
|
+
let n = uo(e);
|
|
5778
5917
|
switch (t) {
|
|
5779
5918
|
case "linear": return n;
|
|
5780
5919
|
case "easeIn": return n * n;
|
|
@@ -5783,14 +5922,14 @@ function Qa(e, t) {
|
|
|
5783
5922
|
default: return n;
|
|
5784
5923
|
}
|
|
5785
5924
|
}
|
|
5786
|
-
function
|
|
5925
|
+
function po(e, t, n) {
|
|
5787
5926
|
let r = Math.max(0, t * 1e3);
|
|
5788
5927
|
return r === 0 ? (n(1), Promise.resolve()) : new Promise((t, i) => {
|
|
5789
5928
|
let a = 0, o, s = () => {
|
|
5790
5929
|
let c = Math.min(16, r - a);
|
|
5791
5930
|
a += c;
|
|
5792
5931
|
try {
|
|
5793
|
-
n(
|
|
5932
|
+
n(uo(a / r));
|
|
5794
5933
|
} catch (t) {
|
|
5795
5934
|
o !== void 0 && e.clearTimeout(o), i(t);
|
|
5796
5935
|
return;
|
|
@@ -5806,33 +5945,33 @@ function $a(e, t, n) {
|
|
|
5806
5945
|
}
|
|
5807
5946
|
//#endregion
|
|
5808
5947
|
//#region src/svg-overlay-surface.ts
|
|
5809
|
-
var
|
|
5810
|
-
function
|
|
5948
|
+
var mo = "http://www.w3.org/2000/svg", ho = "http://www.w3.org/XML/1998/namespace", go = 96, _o = 18, vo = 8, yo = 16, bo = Symbol("BubbleSvgOverlayTextTarget"), xo = Symbol("BubbleSvgOverlayImageTarget"), So = 0, Co = Object.freeze(["scratch-render", "svg-overlay"]), wo = "svg-overlay", To = "error";
|
|
5949
|
+
function Eo(e) {
|
|
5811
5950
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
5812
5951
|
}
|
|
5813
|
-
function
|
|
5952
|
+
function Do(e) {
|
|
5814
5953
|
let t = e.getNativeSize(), n = Array.isArray(t) ? Number(t[0]) : NaN, r = Array.isArray(t) ? Number(t[1]) : NaN;
|
|
5815
5954
|
return Object.freeze({
|
|
5816
5955
|
width: n > 0 ? n : 480,
|
|
5817
5956
|
height: r > 0 ? r : 360
|
|
5818
5957
|
});
|
|
5819
5958
|
}
|
|
5820
|
-
function
|
|
5959
|
+
function Oo(e, t) {
|
|
5821
5960
|
let n = Number(e);
|
|
5822
5961
|
if (!Number.isFinite(n) || n <= 0) throw TypeError(`${t} must be a positive finite number.`);
|
|
5823
5962
|
return n;
|
|
5824
5963
|
}
|
|
5825
|
-
function
|
|
5964
|
+
function ko(e, t) {
|
|
5826
5965
|
if (typeof e != "string" || e.length === 0 || e.length > 128) throw TypeError(`${t} must be a non-empty color string.`);
|
|
5827
5966
|
if (/url\s*\(|[<>;]/iu.test(e)) throw TypeError(`${t} contains a disallowed SVG value.`);
|
|
5828
5967
|
return e;
|
|
5829
5968
|
}
|
|
5830
|
-
function
|
|
5969
|
+
function Ao(e) {
|
|
5831
5970
|
if (typeof e != "string" || e.length === 0 || e.length > 256 || /url\s*\(|[<>{};]/iu.test(e)) throw TypeError("SVG overlay fontFamily is invalid.");
|
|
5832
5971
|
return e;
|
|
5833
5972
|
}
|
|
5834
|
-
function
|
|
5835
|
-
if (!
|
|
5973
|
+
function jo(e) {
|
|
5974
|
+
if (!Eo(e) || !Array.isArray(e.lines)) throw TypeError("SVG overlay text layout is invalid.");
|
|
5836
5975
|
let t = e.alignment;
|
|
5837
5976
|
if (t !== "left" && t !== "center" && t !== "right") throw TypeError("SVG overlay text alignment is invalid.");
|
|
5838
5977
|
let n = e.fontStyle;
|
|
@@ -5841,7 +5980,7 @@ function vo(e) {
|
|
|
5841
5980
|
if (r !== void 0 && r !== "normal" && r !== "bold" && (!Number.isFinite(r) || Number(r) < 1 || Number(r) > 1e3)) throw TypeError("SVG overlay fontWeight is invalid.");
|
|
5842
5981
|
let i = Object.freeze(e.lines.map((e) => {
|
|
5843
5982
|
if (typeof e == "string") return e;
|
|
5844
|
-
if (!
|
|
5983
|
+
if (!Eo(e) || typeof e.text != "string") throw TypeError("SVG overlay text lines must be strings or positioned line records.");
|
|
5845
5984
|
let t = e.x !== void 0;
|
|
5846
5985
|
if (t !== (e.baseline !== void 0)) throw TypeError("SVG overlay positioned text lines require both x and baseline.");
|
|
5847
5986
|
if (t && (!Number.isFinite(e.x) || !Number.isFinite(e.baseline))) throw TypeError("SVG overlay text line coordinates must be finite numbers.");
|
|
@@ -5852,19 +5991,19 @@ function vo(e) {
|
|
|
5852
5991
|
baseline: Number(e.baseline)
|
|
5853
5992
|
} : {}
|
|
5854
5993
|
});
|
|
5855
|
-
})), a = e.backgroundColor === void 0 ? void 0 :
|
|
5994
|
+
})), a = e.backgroundColor === void 0 ? void 0 : ko(e.backgroundColor, "SVG overlay backgroundColor"), o = e.backgroundCornerRadius === void 0 ? void 0 : Number(e.backgroundCornerRadius);
|
|
5856
5995
|
if (o !== void 0 && (!Number.isFinite(o) || o < 0)) throw TypeError("SVG overlay backgroundCornerRadius must be a non-negative finite number.");
|
|
5857
5996
|
let s = e.preserveWhitespace;
|
|
5858
5997
|
if (s !== void 0 && typeof s != "boolean") throw TypeError("SVG overlay preserveWhitespace must be a boolean.");
|
|
5859
5998
|
return Object.freeze({
|
|
5860
5999
|
alignment: t,
|
|
5861
|
-
fill:
|
|
5862
|
-
fontFamily:
|
|
5863
|
-
fontSize:
|
|
5864
|
-
height:
|
|
5865
|
-
lineHeight:
|
|
6000
|
+
fill: ko(e.fill, "SVG overlay text fill"),
|
|
6001
|
+
fontFamily: Ao(e.fontFamily),
|
|
6002
|
+
fontSize: Oo(e.fontSize, "SVG overlay fontSize"),
|
|
6003
|
+
height: Oo(e.height, "SVG overlay text height"),
|
|
6004
|
+
lineHeight: Oo(e.lineHeight, "SVG overlay lineHeight"),
|
|
5866
6005
|
lines: i,
|
|
5867
|
-
width:
|
|
6006
|
+
width: Oo(e.width, "SVG overlay text width"),
|
|
5868
6007
|
...a === void 0 ? {} : { backgroundColor: a },
|
|
5869
6008
|
...o === void 0 ? {} : { backgroundCornerRadius: o },
|
|
5870
6009
|
...n === void 0 ? {} : { fontStyle: n },
|
|
@@ -5872,21 +6011,21 @@ function vo(e) {
|
|
|
5872
6011
|
...s === void 0 ? {} : { preserveWhitespace: s }
|
|
5873
6012
|
});
|
|
5874
6013
|
}
|
|
5875
|
-
function
|
|
6014
|
+
function Mo(e, t) {
|
|
5876
6015
|
let n = {
|
|
5877
6016
|
width: 180,
|
|
5878
6017
|
height: 48
|
|
5879
6018
|
}, r, i, a, o = (r) => {
|
|
5880
|
-
let i =
|
|
6019
|
+
let i = jo(r), a = [];
|
|
5881
6020
|
if (i.backgroundColor !== void 0 && i.backgroundColor !== "transparent") {
|
|
5882
|
-
let t = e.createElementNS(
|
|
6021
|
+
let t = e.createElementNS(mo, "rect");
|
|
5883
6022
|
t.setAttribute("x", String(-i.width / 2)), t.setAttribute("y", String(-i.height / 2)), t.setAttribute("width", String(i.width)), t.setAttribute("height", String(i.height)), t.setAttribute("fill", i.backgroundColor), i.backgroundCornerRadius !== void 0 && t.setAttribute("rx", String(i.backgroundCornerRadius)), a.push(t);
|
|
5884
6023
|
}
|
|
5885
|
-
let o = e.createElementNS(
|
|
5886
|
-
o.setAttribute("text-anchor", s), o.setAttribute("fill", i.fill), o.setAttribute("font-family", i.fontFamily), o.setAttribute("font-size", String(i.fontSize)), i.preserveWhitespace !== !1 && o.setAttributeNS(
|
|
6024
|
+
let o = e.createElementNS(mo, "text"), s = i.alignment === "left" ? "start" : i.alignment === "right" ? "end" : "middle", c = i.alignment === "left" ? -i.width / 2 : i.alignment === "right" ? i.width / 2 : 0;
|
|
6025
|
+
o.setAttribute("text-anchor", s), o.setAttribute("fill", i.fill), o.setAttribute("font-family", i.fontFamily), o.setAttribute("font-size", String(i.fontSize)), i.preserveWhitespace !== !1 && o.setAttributeNS(ho, "xml:space", "preserve"), i.fontStyle !== void 0 && o.setAttribute("font-style", i.fontStyle), i.fontWeight !== void 0 && o.setAttribute("font-weight", String(i.fontWeight));
|
|
5887
6026
|
let l = -Math.max(i.fontSize, (i.lines.length - 1) * i.lineHeight + i.fontSize) / 2 + i.fontSize;
|
|
5888
6027
|
i.lines.forEach((t, n) => {
|
|
5889
|
-
let r = e.createElementNS(
|
|
6028
|
+
let r = e.createElementNS(mo, "tspan"), a = typeof t == "string" ? void 0 : t;
|
|
5890
6029
|
r.setAttribute("x", String(a?.x ?? c)), r.setAttribute("y", String(a?.baseline ?? l + n * i.lineHeight)), r.textContent = typeof t == "string" ? t : t.text, o.appendChild(r);
|
|
5891
6030
|
}), a.push(o), t.replaceChildren(...a), n = {
|
|
5892
6031
|
width: i.width,
|
|
@@ -5894,7 +6033,7 @@ function yo(e, t) {
|
|
|
5894
6033
|
};
|
|
5895
6034
|
};
|
|
5896
6035
|
return Object.freeze({
|
|
5897
|
-
[
|
|
6036
|
+
[bo]: !0,
|
|
5898
6037
|
group: t,
|
|
5899
6038
|
captureLayout() {
|
|
5900
6039
|
i = r, a = { ...n };
|
|
@@ -5916,7 +6055,7 @@ function yo(e, t) {
|
|
|
5916
6055
|
},
|
|
5917
6056
|
refresh() {
|
|
5918
6057
|
if (i !== void 0) {
|
|
5919
|
-
let e =
|
|
6058
|
+
let e = jo(i());
|
|
5920
6059
|
a = {
|
|
5921
6060
|
width: e.width,
|
|
5922
6061
|
height: e.height
|
|
@@ -5929,29 +6068,29 @@ function yo(e, t) {
|
|
|
5929
6068
|
}
|
|
5930
6069
|
});
|
|
5931
6070
|
}
|
|
5932
|
-
function
|
|
6071
|
+
function No(e) {
|
|
5933
6072
|
let t = e;
|
|
5934
|
-
if (t?.[
|
|
6073
|
+
if (t?.[bo] !== !0) throw TypeError("SVG overlay text target is invalid.");
|
|
5935
6074
|
return t;
|
|
5936
6075
|
}
|
|
5937
|
-
function
|
|
5938
|
-
if (!
|
|
6076
|
+
function Po(e, t) {
|
|
6077
|
+
if (!Eo(e) || typeof e.layoutText != "function") throw TypeError("SVG overlay backend requires a text layout capability.");
|
|
5939
6078
|
let n = e;
|
|
5940
6079
|
return Object.freeze({
|
|
5941
6080
|
setText({ styleName: e, target: r, text: i }) {
|
|
5942
|
-
let a =
|
|
5943
|
-
nativeSize:
|
|
6081
|
+
let a = No(r), o = () => n.layoutText({
|
|
6082
|
+
nativeSize: Do(t),
|
|
5944
6083
|
styleName: e,
|
|
5945
6084
|
text: i
|
|
5946
6085
|
});
|
|
5947
6086
|
a.render(o(), o);
|
|
5948
6087
|
},
|
|
5949
6088
|
releaseTarget(e) {
|
|
5950
|
-
|
|
6089
|
+
No(e).clear();
|
|
5951
6090
|
},
|
|
5952
6091
|
measureText({ styleName: e, text: r }) {
|
|
5953
|
-
let i =
|
|
5954
|
-
return
|
|
6092
|
+
let i = Do(t);
|
|
6093
|
+
return Oo(n.measureText?.({
|
|
5955
6094
|
nativeSize: i,
|
|
5956
6095
|
styleName: e,
|
|
5957
6096
|
text: r
|
|
@@ -5963,7 +6102,7 @@ function xo(e, t) {
|
|
|
5963
6102
|
}
|
|
5964
6103
|
});
|
|
5965
6104
|
}
|
|
5966
|
-
function
|
|
6105
|
+
function Fo(e) {
|
|
5967
6106
|
return !(/* @__PURE__ */ new Set([
|
|
5968
6107
|
"image/avif",
|
|
5969
6108
|
"image/gif",
|
|
@@ -5973,11 +6112,11 @@ function So(e) {
|
|
|
5973
6112
|
"image/webp"
|
|
5974
6113
|
])).has(e.mimeType.toLowerCase()) || e.mimeType.toLowerCase() === "image/svg+xml" && e.svgSecurity !== "sanitized" ? !1 : e.src.startsWith("blob:") ? typeof e.release == "function" : /^data:image\/(?:avif|gif|jpeg|png|webp);base64,/iu.test(e.src);
|
|
5975
6114
|
}
|
|
5976
|
-
async function
|
|
6115
|
+
async function Io(e) {
|
|
5977
6116
|
await e?.release?.();
|
|
5978
6117
|
}
|
|
5979
|
-
function
|
|
5980
|
-
let r = e.createElementNS(
|
|
6118
|
+
function Lo(e, t, n) {
|
|
6119
|
+
let r = e.createElementNS(mo, "image");
|
|
5981
6120
|
r.setAttribute("preserveAspectRatio", "xMidYMid meet"), n.appendChild(r);
|
|
5982
6121
|
let i, a = {
|
|
5983
6122
|
width: 1,
|
|
@@ -5988,22 +6127,22 @@ function wo(e, t, n) {
|
|
|
5988
6127
|
return s(), Object.freeze({
|
|
5989
6128
|
id: t,
|
|
5990
6129
|
isStage: !1,
|
|
5991
|
-
[
|
|
6130
|
+
[xo]: !0,
|
|
5992
6131
|
group: n,
|
|
5993
6132
|
async applyResource(e) {
|
|
5994
6133
|
let t = o + 1;
|
|
5995
6134
|
o = t;
|
|
5996
6135
|
try {
|
|
5997
|
-
if (
|
|
6136
|
+
if (Oo(e.width, "SVG overlay image width"), Oo(e.height, "SVG overlay image height"), typeof e.mimeType != "string" || !e.mimeType.startsWith("image/") || typeof e.src != "string" || !Fo(e)) throw TypeError("SVG overlay image resources must use a supported MIME type, a releasable blob URL or approved raster data URL, and sanitized SVG metadata when applicable.");
|
|
5998
6137
|
} catch (t) {
|
|
5999
|
-
throw await
|
|
6138
|
+
throw await Io(e), t;
|
|
6000
6139
|
}
|
|
6001
6140
|
if (t !== o) {
|
|
6002
|
-
await
|
|
6141
|
+
await Io(e);
|
|
6003
6142
|
return;
|
|
6004
6143
|
}
|
|
6005
6144
|
let n = i;
|
|
6006
|
-
i = e, r.setAttribute("href", e.src), await
|
|
6145
|
+
i = e, r.setAttribute("href", e.src), await Io(n);
|
|
6007
6146
|
},
|
|
6008
6147
|
getSize() {
|
|
6009
6148
|
return i ? {
|
|
@@ -6017,7 +6156,7 @@ function wo(e, t, n) {
|
|
|
6017
6156
|
async release() {
|
|
6018
6157
|
o += 1;
|
|
6019
6158
|
let e = i;
|
|
6020
|
-
i = void 0, r.removeAttribute("href"), await
|
|
6159
|
+
i = void 0, r.removeAttribute("href"), await Io(e);
|
|
6021
6160
|
},
|
|
6022
6161
|
setDisplaySize(e) {
|
|
6023
6162
|
a = e, s();
|
|
@@ -6027,13 +6166,13 @@ function wo(e, t, n) {
|
|
|
6027
6166
|
}
|
|
6028
6167
|
});
|
|
6029
6168
|
}
|
|
6030
|
-
function
|
|
6169
|
+
function Ro(e) {
|
|
6031
6170
|
let t = e;
|
|
6032
|
-
if (t?.[
|
|
6171
|
+
if (t?.[xo] !== !0) throw TypeError("SVG overlay image target is invalid.");
|
|
6033
6172
|
return t;
|
|
6034
6173
|
}
|
|
6035
|
-
function
|
|
6036
|
-
if (!
|
|
6174
|
+
function zo(e) {
|
|
6175
|
+
if (!Eo(e) || typeof e.isRegistered != "function" || typeof e.getMimeType != "function" || typeof e.resolveImage != "function") throw TypeError("SVG overlay image capability is invalid.");
|
|
6037
6176
|
let t = e;
|
|
6038
6177
|
return Object.freeze({
|
|
6039
6178
|
isRegistered(e) {
|
|
@@ -6043,15 +6182,15 @@ function Eo(e) {
|
|
|
6043
6182
|
return t.getMimeType(e);
|
|
6044
6183
|
},
|
|
6045
6184
|
async applyToTarget(e, n) {
|
|
6046
|
-
await
|
|
6185
|
+
await Ro(n).applyResource(await t.resolveImage(e));
|
|
6047
6186
|
}
|
|
6048
6187
|
});
|
|
6049
6188
|
}
|
|
6050
|
-
function
|
|
6051
|
-
let n = t.createElementNS(
|
|
6052
|
-
n.setAttribute("xmlns",
|
|
6189
|
+
function Bo(e, t) {
|
|
6190
|
+
let n = t.createElementNS(mo, "svg");
|
|
6191
|
+
n.setAttribute("xmlns", mo), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.setAttribute("data-bubble-render-backend", "svg-overlay"), n.style.display = "block", n.style.overflow = "hidden", n.style.pointerEvents = "none";
|
|
6053
6192
|
let r = /* @__PURE__ */ new Set(), i = !1, a = () => {
|
|
6054
|
-
let t =
|
|
6193
|
+
let t = Do(e);
|
|
6055
6194
|
return n.setAttribute("width", String(t.width)), n.setAttribute("height", String(t.height)), n.setAttribute("viewBox", `0 0 ${t.width} ${t.height}`), t;
|
|
6056
6195
|
};
|
|
6057
6196
|
return Object.freeze({
|
|
@@ -6073,7 +6212,7 @@ function Do(e, t) {
|
|
|
6073
6212
|
updateNativeSize: a
|
|
6074
6213
|
});
|
|
6075
6214
|
}
|
|
6076
|
-
function
|
|
6215
|
+
function Vo(e) {
|
|
6077
6216
|
try {
|
|
6078
6217
|
let t = e.getBoundsForBubble?.();
|
|
6079
6218
|
if (t && [
|
|
@@ -6091,21 +6230,21 @@ function Oo(e) {
|
|
|
6091
6230
|
top: n
|
|
6092
6231
|
};
|
|
6093
6232
|
}
|
|
6094
|
-
function
|
|
6233
|
+
function Ho(e, t, n) {
|
|
6095
6234
|
return n < t ? (t + n) / 2 : Math.min(n, Math.max(t, e));
|
|
6096
6235
|
}
|
|
6097
|
-
function
|
|
6236
|
+
function Uo(e) {
|
|
6098
6237
|
let t = Be(e);
|
|
6099
6238
|
return (Math.atan2(-t.x, -t.y) * 180 / Math.PI % 360 + 360) % 360;
|
|
6100
6239
|
}
|
|
6101
|
-
var
|
|
6240
|
+
var Wo = /* @__PURE__ */ new Set([
|
|
6102
6241
|
"circle",
|
|
6103
6242
|
"g",
|
|
6104
6243
|
"path",
|
|
6105
6244
|
"rect",
|
|
6106
6245
|
"text",
|
|
6107
6246
|
"title"
|
|
6108
|
-
]),
|
|
6247
|
+
]), Go = /* @__PURE__ */ new Set([
|
|
6109
6248
|
"cx",
|
|
6110
6249
|
"cy",
|
|
6111
6250
|
"d",
|
|
@@ -6130,46 +6269,46 @@ var jo = /* @__PURE__ */ new Set([
|
|
|
6130
6269
|
"x",
|
|
6131
6270
|
"y"
|
|
6132
6271
|
]);
|
|
6133
|
-
function
|
|
6272
|
+
function Ko(e, t) {
|
|
6134
6273
|
let n = e.localName;
|
|
6135
|
-
if (!
|
|
6136
|
-
let r = t.createElementNS(
|
|
6274
|
+
if (!Wo.has(n)) throw TypeError(`Bubble body SVG element is not allowed: ${n}`);
|
|
6275
|
+
let r = t.createElementNS(mo, n);
|
|
6137
6276
|
for (let t of e.getAttributeNames()) {
|
|
6138
|
-
if (!
|
|
6277
|
+
if (!Go.has(t)) throw TypeError(`Bubble body SVG attribute is not allowed: ${t}`);
|
|
6139
6278
|
let n = e.getAttribute(t) ?? "";
|
|
6140
6279
|
if (/javascript:|url\s*\(/iu.test(n)) throw TypeError("Bubble body SVG contains an unsafe attribute value.");
|
|
6141
6280
|
r.setAttribute(t, n);
|
|
6142
6281
|
}
|
|
6143
6282
|
(n === "title" || n === "text") && (r.textContent = e.textContent ?? "");
|
|
6144
|
-
for (let n of Array.from(e.children)) r.appendChild(
|
|
6283
|
+
for (let n of Array.from(e.children)) r.appendChild(Ko(n, t));
|
|
6145
6284
|
return r;
|
|
6146
6285
|
}
|
|
6147
|
-
function
|
|
6286
|
+
function qo(e, t, n) {
|
|
6148
6287
|
let r = n.defaultView?.DOMParser;
|
|
6149
6288
|
if (!r) throw TypeError("SVG overlay backend requires DOMParser.");
|
|
6150
6289
|
let i = new r().parseFromString(t, "image/svg+xml");
|
|
6151
6290
|
if (i.querySelector("parsererror")) throw TypeError("Canonical Bubble body SVG could not be parsed.");
|
|
6152
|
-
let a = Array.from(i.documentElement.children).map((e) =>
|
|
6291
|
+
let a = Array.from(i.documentElement.children).map((e) => Ko(e, n));
|
|
6153
6292
|
e.replaceChildren(...a);
|
|
6154
6293
|
}
|
|
6155
|
-
function
|
|
6294
|
+
function Jo(e, t, n = 1) {
|
|
6156
6295
|
let r = e.getSize(), i = Math.min(t / r.width, t / r.height), a = {
|
|
6157
6296
|
width: r.width * i * n,
|
|
6158
6297
|
height: r.height * i * n
|
|
6159
6298
|
};
|
|
6160
6299
|
return e.setDisplaySize(a), a;
|
|
6161
6300
|
}
|
|
6162
|
-
function
|
|
6163
|
-
let { document: o, renderer: s } = e, c =
|
|
6164
|
-
|
|
6165
|
-
let l = o.createElementNS(
|
|
6301
|
+
function Yo(e, t, n, r, i, a) {
|
|
6302
|
+
let { document: o, renderer: s } = e, c = So;
|
|
6303
|
+
So += 1;
|
|
6304
|
+
let l = o.createElementNS(mo, "g");
|
|
6166
6305
|
l.setAttribute("data-bubble-surface", `${n}:${c}`);
|
|
6167
|
-
let u = o.createElementNS(
|
|
6306
|
+
let u = o.createElementNS(mo, "g");
|
|
6168
6307
|
u.setAttribute("data-bubble-layer", "body"), l.appendChild(u);
|
|
6169
6308
|
let d = (e) => {
|
|
6170
|
-
let t = o.createElementNS(
|
|
6309
|
+
let t = o.createElementNS(mo, "g");
|
|
6171
6310
|
return t.setAttribute("data-bubble-layer", e), t.setAttribute("visibility", "hidden"), l.appendChild(t), t;
|
|
6172
|
-
}, f =
|
|
6311
|
+
}, f = Lo(o, `bubble:${n}:${c}:portrait-base`, d("portrait-base")), p = Lo(o, `bubble:${n}:${c}:portrait-blink`, d("portrait-blink")), m = Lo(o, `bubble:${n}:${c}:portrait-lip-sync`, d("portrait-lip-sync")), h = d("text"), g = Mo(o, h), _ = Lo(o, `bubble:${n}:${c}:continue-indicator`, d("continue-indicator")), v = Object.freeze({
|
|
6173
6312
|
text: g,
|
|
6174
6313
|
portraitBase: f,
|
|
6175
6314
|
portraitBlink: p,
|
|
@@ -6180,7 +6319,7 @@ function Io(e, t, n, r, i, a) {
|
|
|
6180
6319
|
["portraitBlink", p],
|
|
6181
6320
|
["portraitLipSync", m],
|
|
6182
6321
|
["continueIndicator", _]
|
|
6183
|
-
]), b = /* @__PURE__ */ new Map(), x = `bubble-portrait-clip-${c}`, S = o.createElementNS(
|
|
6322
|
+
]), b = /* @__PURE__ */ new Map(), x = `bubble-portrait-clip-${c}`, S = o.createElementNS(mo, "defs"), C = o.createElementNS(mo, "clipPath"), w = o.createElementNS(mo, "rect");
|
|
6184
6323
|
C.setAttribute("id", x), C.appendChild(w), S.appendChild(C), l.insertBefore(S, u);
|
|
6185
6324
|
let T = i, E = !1, D = !1, O = "", k = [0, 0], A = 1, j = 1, M = [0, 0], N, P, F = !1, I = (t = e.updateNativeSize()) => {
|
|
6186
6325
|
let n = t.width / 2 + M[0], r = t.height / 2 - M[1], i = n + k[0], a = r - k[1];
|
|
@@ -6194,8 +6333,8 @@ function Io(e, t, n, r, i, a) {
|
|
|
6194
6333
|
if (E) return;
|
|
6195
6334
|
let n = e.updateNativeSize();
|
|
6196
6335
|
if (T.layoutProfile === "scratch-default" && P !== void 0) {
|
|
6197
|
-
let e =
|
|
6198
|
-
bounds:
|
|
6336
|
+
let e = ua(P), i = da({
|
|
6337
|
+
bounds: Vo(t),
|
|
6199
6338
|
height: e.height,
|
|
6200
6339
|
pointsLeft: F,
|
|
6201
6340
|
stageHeight: n.height,
|
|
@@ -6208,7 +6347,7 @@ function Io(e, t, n, r, i, a) {
|
|
|
6208
6347
|
layout: P,
|
|
6209
6348
|
pointsLeft: F
|
|
6210
6349
|
});
|
|
6211
|
-
a !== O && (
|
|
6350
|
+
a !== O && (qo(u, ga({
|
|
6212
6351
|
kind: r,
|
|
6213
6352
|
layout: P,
|
|
6214
6353
|
pointsLeft: F,
|
|
@@ -6220,16 +6359,16 @@ function Io(e, t, n, r, i, a) {
|
|
|
6220
6359
|
let i = T.placement.basis === "actor" ? T.offset.scalePercent / 100 : 1, a = g.getCapturedSize() ?? g.getSize(), s = {
|
|
6221
6360
|
width: a.width * i,
|
|
6222
6361
|
height: a.height * i
|
|
6223
|
-
}, c = (T.portrait?.offset.zoomPercent ?? 100) / 100, l = T.portrait !== void 0, d = l ?
|
|
6362
|
+
}, c = (T.portrait?.offset.zoomPercent ?? 100) / 100, l = T.portrait !== void 0, d = l ? Jo(f, go * c, i) : {
|
|
6224
6363
|
width: 0,
|
|
6225
6364
|
height: 0
|
|
6226
6365
|
};
|
|
6227
|
-
for (let e of [p, m]) l &&
|
|
6228
|
-
let v =
|
|
6229
|
-
if (T.placement.basis === "background") z = 0, B = T.placement.region === "HEADER_LIKE" ? ee -
|
|
6366
|
+
for (let e of [p, m]) l && Jo(e, go * c, i);
|
|
6367
|
+
let v = Jo(_, _o, i), y = d.width + (l ? vo * i : 0) + s.width, b = Math.max(d.height, s.height), S = nt(T.visualStyle, ...N === void 0 ? [] : [N.from, N.to]), C = Math.max(y / i + 48, S.width), D = Math.max(b / i + 48, S.height), k = Math.max(y, (C - 48) * i), A = Math.max(b, (D - 48) * i), j = -n.width / 2, I = n.width / 2, ee = n.height / 2, R = -n.height / 2, z, B;
|
|
6368
|
+
if (T.placement.basis === "background") z = 0, B = T.placement.region === "HEADER_LIKE" ? ee - yo - A / 2 : T.placement.region === "FOOTER_LIKE" ? R + yo + A / 2 : 0;
|
|
6230
6369
|
else {
|
|
6231
6370
|
let e = Ke({
|
|
6232
|
-
bounds:
|
|
6371
|
+
bounds: Vo(t),
|
|
6233
6372
|
bubbleWidth: k,
|
|
6234
6373
|
bubbleHeight: A,
|
|
6235
6374
|
direction: T.placement.direction,
|
|
@@ -6239,8 +6378,8 @@ function Io(e, t, n, r, i, a) {
|
|
|
6239
6378
|
});
|
|
6240
6379
|
z = e.x, B = e.y;
|
|
6241
6380
|
}
|
|
6242
|
-
z =
|
|
6243
|
-
let te = T.placement.basis === "actor" ?
|
|
6381
|
+
z = Ho(z, j + k / 2, I - k / 2), B = Ho(B, R + A / 2, ee - A / 2), M = [z, B];
|
|
6382
|
+
let te = T.placement.basis === "actor" ? Uo(T.placement.direction) : null, ne = T.placement.basis === "actor" ? [
|
|
6244
6383
|
T.offset.x,
|
|
6245
6384
|
T.offset.y,
|
|
6246
6385
|
T.offset.scalePercent
|
|
@@ -6267,7 +6406,7 @@ function Io(e, t, n, r, i, a) {
|
|
|
6267
6406
|
tailLength: T.tailLength,
|
|
6268
6407
|
visualStyle: T.visualStyle
|
|
6269
6408
|
});
|
|
6270
|
-
ie !== O && (
|
|
6409
|
+
ie !== O && (qo(u, Tt({
|
|
6271
6410
|
style: T.visualStyle,
|
|
6272
6411
|
lines: [],
|
|
6273
6412
|
width: C,
|
|
@@ -6280,16 +6419,16 @@ function Io(e, t, n, r, i, a) {
|
|
|
6280
6419
|
}), o), O = ie), u.setAttribute("data-bubble-style", T.visualStyle), u.setAttribute("data-bubble-body-width", String(C)), u.setAttribute("data-bubble-body-height", String(D)), N === void 0 ? (u.removeAttribute("data-bubble-shape-transition-from"), u.removeAttribute("data-bubble-shape-transition-to"), u.removeAttribute("data-bubble-shape-transition-progress")) : (u.setAttribute("data-bubble-shape-transition-from", N.from), u.setAttribute("data-bubble-shape-transition-to", N.to), u.setAttribute("data-bubble-shape-transition-progress", String(N.progress)));
|
|
6281
6420
|
let ae = z - re.x, oe = B + re.y;
|
|
6282
6421
|
u.setAttribute("transform", `translate(${n.width / 2 + ae - C / 2} ${n.height / 2 - oe - D / 2})`);
|
|
6283
|
-
let se = z - y / 2, ce = T.portrait?.placement ?? "left", le = ce.endsWith("right"), V = (T.portrait?.offset.x ?? 0) * i, ue = (T.portrait?.offset.y ?? 0) * i, de = (le ? se + s.width +
|
|
6422
|
+
let se = z - y / 2, ce = T.portrait?.placement ?? "left", le = ce.endsWith("right"), V = (T.portrait?.offset.x ?? 0) * i, ue = (T.portrait?.offset.y ?? 0) * i, de = (le ? se + s.width + vo * i : se) + d.width / 2 + V, fe = B;
|
|
6284
6423
|
ce.startsWith("top-") ? fe = B + b / 2 - d.height / 2 : ce.startsWith("bottom-") && (fe = B - b / 2 + d.height / 2), fe += ue;
|
|
6285
|
-
let pe = (le || !l ? se : se + d.width +
|
|
6424
|
+
let pe = (le || !l ? se : se + d.width + vo * i) + s.width / 2, H = (e, t) => `translate(${n.width / 2 + e} ${n.height / 2 - t})`;
|
|
6286
6425
|
for (let e of [
|
|
6287
6426
|
f,
|
|
6288
6427
|
p,
|
|
6289
6428
|
m
|
|
6290
6429
|
]) e.group.setAttribute("transform", H(de, fe));
|
|
6291
6430
|
h.setAttribute("transform", `${H(pe, B)} scale(${i})`);
|
|
6292
|
-
let U = pe + s.width / 2 - v.width / 2 -
|
|
6431
|
+
let U = pe + s.width / 2 - v.width / 2 - vo * i, W = B - s.height / 2 + v.height / 2 + vo * i;
|
|
6293
6432
|
_.group.setAttribute("transform", H(U, W));
|
|
6294
6433
|
let me = Math.min(T.portrait?.cornerRadius ?? 0, d.width / 2, d.height / 2);
|
|
6295
6434
|
w.setAttribute("x", String(-d.width / 2)), w.setAttribute("y", String(-d.height / 2)), w.setAttribute("width", String(d.width)), w.setAttribute("height", String(d.height)), w.setAttribute("rx", String(me));
|
|
@@ -6335,11 +6474,11 @@ function Io(e, t, n, r, i, a) {
|
|
|
6335
6474
|
if (E) return;
|
|
6336
6475
|
let t = Math.max(0, e.durationSeconds ?? 0), n = () => {
|
|
6337
6476
|
E || L();
|
|
6338
|
-
}, r = (t) =>
|
|
6477
|
+
}, r = (t) => fo(t, e.ease ?? "easeInOut");
|
|
6339
6478
|
if (e.name === "fadeIn" || e.name === "floatIn" || e.name === "zoomIn" || e.name === "riseUp") {
|
|
6340
6479
|
D = !0;
|
|
6341
6480
|
let i = e.name === "floatIn" || e.name === "riseUp" ? [0, 16] : [0, 0], o = e.name === "zoomIn" ? .01 : 1;
|
|
6342
|
-
k = i, A = o, j = e.name === "fadeIn" ? 0 : 1, n(), await
|
|
6481
|
+
k = i, A = o, j = e.name === "fadeIn" ? 0 : 1, n(), await po(a, t, (t) => {
|
|
6343
6482
|
let a = r(t);
|
|
6344
6483
|
k = [i[0] * (1 - a), i[1] * (1 - a)], A = o + (1 - o) * a, j = e.name === "fadeIn" ? a : 1, n();
|
|
6345
6484
|
}), k = [0, 0], A = 1, j = 1, R();
|
|
@@ -6347,7 +6486,7 @@ function Io(e, t, n, r, i, a) {
|
|
|
6347
6486
|
}
|
|
6348
6487
|
if (e.name === "fadeOut" || e.name === "floatOut" || e.name === "zoomOut" || e.name === "sink") {
|
|
6349
6488
|
let i = e.name === "floatOut" || e.name === "sink" ? [0, -16] : [0, 0], o = e.name === "zoomOut" ? .01 : 1;
|
|
6350
|
-
await
|
|
6489
|
+
await po(a, t, (t) => {
|
|
6351
6490
|
let a = r(t);
|
|
6352
6491
|
k = [i[0] * a, i[1] * a], A = 1 + (o - 1) * a, j = e.name === "fadeOut" ? 1 - a : 1, n();
|
|
6353
6492
|
}), D = !1, L(), k = [0, 0], A = 1, j = 1;
|
|
@@ -6355,7 +6494,7 @@ function Io(e, t, n, r, i, a) {
|
|
|
6355
6494
|
}
|
|
6356
6495
|
if (e.name === "shake") {
|
|
6357
6496
|
let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .08, s = Be(typeof e.direction == "number" ? e.direction : e.direction ?? "right");
|
|
6358
|
-
await
|
|
6497
|
+
await po(a, o, (e) => {
|
|
6359
6498
|
let t = Math.sin(r(e) * i * Math.PI * 2) * 5;
|
|
6360
6499
|
k = [s.x * t, s.y * t], n();
|
|
6361
6500
|
}), k = [0, 0], R();
|
|
@@ -6363,7 +6502,7 @@ function Io(e, t, n, r, i, a) {
|
|
|
6363
6502
|
}
|
|
6364
6503
|
if (e.name === "explode") {
|
|
6365
6504
|
let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .12, s = e.relativeScale ?? 1.15;
|
|
6366
|
-
await
|
|
6505
|
+
await po(a, o, (e) => {
|
|
6367
6506
|
let t = Math.abs(Math.sin(r(e) * i * Math.PI));
|
|
6368
6507
|
A = 1 + (s - 1) * t, n();
|
|
6369
6508
|
}), A = 1, R();
|
|
@@ -6375,12 +6514,12 @@ function Io(e, t, n, r, i, a) {
|
|
|
6375
6514
|
from: r,
|
|
6376
6515
|
to: n,
|
|
6377
6516
|
progress: 0
|
|
6378
|
-
}, R(), await
|
|
6379
|
-
let o = t === 0 ? 1 :
|
|
6517
|
+
}, R(), await po(a, t, (a) => {
|
|
6518
|
+
let o = t === 0 ? 1 : uo(a * Math.max(i, 1));
|
|
6380
6519
|
N = {
|
|
6381
6520
|
from: r,
|
|
6382
6521
|
to: n,
|
|
6383
|
-
progress:
|
|
6522
|
+
progress: fo(o, e.ease ?? "easeInOut")
|
|
6384
6523
|
}, O = "", R();
|
|
6385
6524
|
}), N = void 0, O = "", R();
|
|
6386
6525
|
}
|
|
@@ -6412,17 +6551,17 @@ function Io(e, t, n, r, i, a) {
|
|
|
6412
6551
|
}
|
|
6413
6552
|
//#endregion
|
|
6414
6553
|
//#region src/turbowarp-adapter.ts
|
|
6415
|
-
var
|
|
6554
|
+
var Xo = "sprite", Zo = 96, Qo = 18, $o = 8, es = 16, ts = 0, $ = class extends Error {
|
|
6416
6555
|
code;
|
|
6417
6556
|
constructor(e, t) {
|
|
6418
6557
|
super(t), this.name = "BubbleRuntimeAdapterError", this.code = e;
|
|
6419
6558
|
}
|
|
6420
6559
|
};
|
|
6421
|
-
function
|
|
6560
|
+
function ns(e) {
|
|
6422
6561
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
6423
6562
|
}
|
|
6424
|
-
function
|
|
6425
|
-
if (!
|
|
6563
|
+
function rs(e) {
|
|
6564
|
+
if (!ns(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp renderer.");
|
|
6426
6565
|
let t = [
|
|
6427
6566
|
"createSVGSkin",
|
|
6428
6567
|
"createDrawable",
|
|
@@ -6438,41 +6577,41 @@ function Wo(e) {
|
|
|
6438
6577
|
if (t.some((t) => typeof e[t] != "function")) throw new $("BUBBLE-RUNTIME-001", `Bubble renderer must provide ${t.join(", ")}.`);
|
|
6439
6578
|
return e;
|
|
6440
6579
|
}
|
|
6441
|
-
function
|
|
6580
|
+
function is(e) {
|
|
6442
6581
|
let t = e ?? "svg-overlay";
|
|
6443
6582
|
if (t !== "scratch-render" && t !== "svg-overlay") throw new $("BUBBLE-RUNTIME-004", "Bubble bubbleRenderBackend must be scratch-render or svg-overlay.");
|
|
6444
6583
|
return t;
|
|
6445
6584
|
}
|
|
6446
|
-
function
|
|
6585
|
+
function as(e) {
|
|
6447
6586
|
let t = e ?? "error";
|
|
6448
6587
|
if (t !== "error" && t !== "fallback") throw new $("BUBBLE-RUNTIME-004", "Bubble svgOverlayUnsupportedBehavior must be error or fallback.");
|
|
6449
6588
|
return t;
|
|
6450
6589
|
}
|
|
6451
|
-
function
|
|
6590
|
+
function os(e) {
|
|
6452
6591
|
let t = e ?? (globalThis.document === void 0 ? void 0 : globalThis.document);
|
|
6453
6592
|
if (t !== void 0) {
|
|
6454
|
-
if (!
|
|
6593
|
+
if (!ns(t) || typeof t.createElementNS != "function") throw new $("BUBBLE-RUNTIME-004", "Bubble SVG overlay document must provide createElementNS().");
|
|
6455
6594
|
return t;
|
|
6456
6595
|
}
|
|
6457
6596
|
}
|
|
6458
|
-
function
|
|
6597
|
+
function ss(e, t, n) {
|
|
6459
6598
|
if (typeof e.addOverlay != "function" || typeof e.removeOverlay != "function") return "the renderer does not provide addOverlay() and removeOverlay()";
|
|
6460
6599
|
if (t === void 0) return "the host does not provide a DOM document";
|
|
6461
6600
|
if (typeof t.defaultView?.DOMParser != "function") return "the host document does not provide DOMParser";
|
|
6462
|
-
if (!
|
|
6601
|
+
if (!ns(n) || typeof n.layoutText != "function") return "a host-neutral svgOverlayTextCapability is not available";
|
|
6463
6602
|
}
|
|
6464
|
-
function
|
|
6603
|
+
function cs() {
|
|
6465
6604
|
let e = ke(), t = /* @__PURE__ */ new Set(), n = (n) => {
|
|
6466
6605
|
e.defineStyle({
|
|
6467
6606
|
name: n,
|
|
6468
6607
|
backgroundColor: "transparent"
|
|
6469
6608
|
}), t.add(n);
|
|
6470
6609
|
};
|
|
6471
|
-
return n("default"),
|
|
6610
|
+
return n("default"), no(Object.freeze({ layoutText(r) {
|
|
6472
6611
|
return t.has(r.styleName) || n(r.styleName), e.layoutText(r);
|
|
6473
6612
|
} }));
|
|
6474
6613
|
}
|
|
6475
|
-
function
|
|
6614
|
+
function ls(e) {
|
|
6476
6615
|
let t = Ae({ runtime: e }), n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
6477
6616
|
t.defineStyle({
|
|
6478
6617
|
name: e,
|
|
@@ -6481,7 +6620,7 @@ function Xo(e) {
|
|
|
6481
6620
|
}, i = (e) => {
|
|
6482
6621
|
n.has(e) || r(e);
|
|
6483
6622
|
};
|
|
6484
|
-
return r("default"),
|
|
6623
|
+
return r("default"), to(Object.freeze({
|
|
6485
6624
|
setText(e) {
|
|
6486
6625
|
i(e.styleName), t.setText(e);
|
|
6487
6626
|
},
|
|
@@ -6493,17 +6632,17 @@ function Xo(e) {
|
|
|
6493
6632
|
}
|
|
6494
6633
|
}));
|
|
6495
6634
|
}
|
|
6496
|
-
function
|
|
6497
|
-
if (!
|
|
6635
|
+
function us(e) {
|
|
6636
|
+
if (!ns(e) || typeof e.isLoaded != "function" || typeof e.getAssetMimeType != "function" || typeof e.resolveSkin != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-manager or provide options.imageResolver before using image features.");
|
|
6498
6637
|
return e;
|
|
6499
6638
|
}
|
|
6500
|
-
function
|
|
6501
|
-
if (!
|
|
6639
|
+
function ds(e) {
|
|
6640
|
+
if (!ns(e) || typeof e.getDOMImageCapability != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble SVG overlay image assets require @kubohiroya/turbowarp-asset-manager 0.12.1 or a host-provided options.svgOverlayImageCapability.");
|
|
6502
6641
|
let t = e.getDOMImageCapability();
|
|
6503
|
-
if (!
|
|
6642
|
+
if (!ns(t) || typeof t.isRegistered != "function" || typeof t.getMimeType != "function" || typeof t.resolveDOMImageResource != "function") throw new $("BUBBLE-RUNTIME-002", "Asset Manager did not provide a valid DOM image capability.");
|
|
6504
6643
|
return t;
|
|
6505
6644
|
}
|
|
6506
|
-
function
|
|
6645
|
+
function fs(e) {
|
|
6507
6646
|
try {
|
|
6508
6647
|
let t = e.getBoundsForBubble?.();
|
|
6509
6648
|
if (t && [
|
|
@@ -6521,7 +6660,7 @@ function $o(e) {
|
|
|
6521
6660
|
top: n
|
|
6522
6661
|
};
|
|
6523
6662
|
}
|
|
6524
|
-
function
|
|
6663
|
+
function ps(e, t, n) {
|
|
6525
6664
|
let r = e.getCurrentSkinSize(t.drawableID);
|
|
6526
6665
|
if (!Array.isArray(r) || r.length < 2) return n;
|
|
6527
6666
|
let i = Number(r[0]), a = Number(r[1]);
|
|
@@ -6530,8 +6669,8 @@ function es(e, t, n) {
|
|
|
6530
6669
|
height: a
|
|
6531
6670
|
};
|
|
6532
6671
|
}
|
|
6533
|
-
function
|
|
6534
|
-
let i =
|
|
6672
|
+
function ms(e, t, n, r = 1) {
|
|
6673
|
+
let i = ps(e, t, {
|
|
6535
6674
|
width: n,
|
|
6536
6675
|
height: n
|
|
6537
6676
|
}), a = Math.min(n / i.width, n / i.height) * r;
|
|
@@ -6541,35 +6680,35 @@ function ts(e, t, n, r = 1) {
|
|
|
6541
6680
|
scalePercent: a * 100
|
|
6542
6681
|
};
|
|
6543
6682
|
}
|
|
6544
|
-
function
|
|
6683
|
+
function hs(e, t, n) {
|
|
6545
6684
|
let r = Math.min(n, e / 2, t / 2), i = e - r, a = t - r;
|
|
6546
6685
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}" viewBox="0 0 ${e} ${t}">
|
|
6547
6686
|
<path d="M0 0H${e}V${t}H0Z M${r} 0H${i}A${r} ${r} 0 0 1 ${e} ${r}V${a}A${r} ${r} 0 0 1 ${i} ${t}H${r}A${r} ${r} 0 0 1 0 ${a}V${r}A${r} ${r} 0 0 1 ${r} 0Z" fill="#fff4cc" fill-rule="evenodd" data-bubble-portrait-corner-radius="${r}"/>
|
|
6548
6687
|
</svg>`;
|
|
6549
6688
|
}
|
|
6550
|
-
function
|
|
6689
|
+
function gs(e, t, n) {
|
|
6551
6690
|
return n < t ? (t + n) / 2 : Math.min(n, Math.max(t, e));
|
|
6552
6691
|
}
|
|
6553
|
-
function
|
|
6692
|
+
function _s(e, t, n, r, i) {
|
|
6554
6693
|
let a = t + r * 2, o = n + i * 2;
|
|
6555
6694
|
return e.replace(/<svg\b[^>]*>/u, (e) => e.replace(/\bwidth="[^"]*"/u, `width="${a}"`).replace(/\bheight="[^"]*"/u, `height="${o}"`).replace(/\bviewBox="[^"]*"/u, `viewBox="${-r} ${-i} ${a} ${o}"`));
|
|
6556
6695
|
}
|
|
6557
|
-
function
|
|
6696
|
+
function vs(e) {
|
|
6558
6697
|
let t = Be(e);
|
|
6559
6698
|
return (Math.atan2(-t.x, -t.y) * 180 / Math.PI % 360 + 360) % 360;
|
|
6560
6699
|
}
|
|
6561
|
-
function
|
|
6562
|
-
let o = e.renderer, s =
|
|
6563
|
-
|
|
6700
|
+
function ys(e, t, n, r, i, a) {
|
|
6701
|
+
let o = e.renderer, s = ts;
|
|
6702
|
+
ts += 1;
|
|
6564
6703
|
let c = [], l, u, d = (e) => {
|
|
6565
|
-
let t = o.createDrawable(
|
|
6704
|
+
let t = o.createDrawable(Xo);
|
|
6566
6705
|
if (!Number.isInteger(t) || t < 0) throw new $("BUBBLE-RUNTIME-001", `TurboWarp did not create the Bubble ${e} drawable.`);
|
|
6567
6706
|
let r = Object.freeze({
|
|
6568
6707
|
id: `bubble:${n}:${s}:${e}`,
|
|
6569
6708
|
isStage: !1,
|
|
6570
6709
|
drawableID: t
|
|
6571
6710
|
});
|
|
6572
|
-
return c.push(r), o.updateDrawableVisible(t, !1), o.setDrawableOrder?.(t, Infinity,
|
|
6711
|
+
return c.push(r), o.updateDrawableVisible(t, !1), o.setDrawableOrder?.(t, Infinity, Xo), r;
|
|
6573
6712
|
};
|
|
6574
6713
|
try {
|
|
6575
6714
|
let n = d("body"), s = i.portrait ? d("portrait-base") : void 0, f = i.portrait?.blink ? d("portrait-blink") : void 0, p = i.portrait?.lipSync ? d("portrait-lip-sync") : void 0, m = i.portrait ? d("portrait-corner-mask") : void 0, h = d("text"), g = i.continueIndicator ? d("continue-indicator") : void 0, _ = Object.freeze({
|
|
@@ -6595,8 +6734,8 @@ function os(e, t, n, r, i, a) {
|
|
|
6595
6734
|
}, I = () => {
|
|
6596
6735
|
if (x) return;
|
|
6597
6736
|
if (w.layoutProfile === "scratch-default" && M !== void 0) {
|
|
6598
|
-
let e = o.getNativeSize(), i = Array.isArray(e) && Number(e[0]) > 0 ? Number(e[0]) : 480, a = Array.isArray(e) && Number(e[1]) > 0 ? Number(e[1]) : 360, s =
|
|
6599
|
-
bounds:
|
|
6737
|
+
let e = o.getNativeSize(), i = Array.isArray(e) && Number(e[0]) > 0 ? Number(e[0]) : 480, a = Array.isArray(e) && Number(e[1]) > 0 ? Number(e[1]) : 360, s = ua(M), c = da({
|
|
6738
|
+
bounds: fs(t),
|
|
6600
6739
|
height: s.height,
|
|
6601
6740
|
pointsLeft: N,
|
|
6602
6741
|
stageHeight: a,
|
|
@@ -6610,7 +6749,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6610
6749
|
pointsLeft: N
|
|
6611
6750
|
});
|
|
6612
6751
|
if (u !== S) {
|
|
6613
|
-
let e = o.createSVGSkin(
|
|
6752
|
+
let e = o.createSVGSkin(ga({
|
|
6614
6753
|
kind: r,
|
|
6615
6754
|
layout: M,
|
|
6616
6755
|
pointsLeft: N,
|
|
@@ -6628,7 +6767,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6628
6767
|
o.updateDrawableScale(n.drawableID, [100, 100]), o.updateDrawablePosition(n.drawableID, [c.centerX, c.centerY]), E.set(n.drawableID, [c.centerX, c.centerY]), D.set(n.drawableID, [100, 100]), F();
|
|
6629
6768
|
return;
|
|
6630
6769
|
}
|
|
6631
|
-
let e = w.placement.basis === "actor" ? w.offset.scalePercent / 100 : 1, i = T ??
|
|
6770
|
+
let e = w.placement.basis === "actor" ? w.offset.scalePercent / 100 : 1, i = T ?? ps(o, h, {
|
|
6632
6771
|
width: 180,
|
|
6633
6772
|
height: 48
|
|
6634
6773
|
});
|
|
@@ -6636,25 +6775,25 @@ function os(e, t, n, r, i, a) {
|
|
|
6636
6775
|
let a = {
|
|
6637
6776
|
width: i.width * e,
|
|
6638
6777
|
height: i.height * e
|
|
6639
|
-
}, c =
|
|
6778
|
+
}, c = Zo * ((w.portrait?.offset.zoomPercent ?? 100) / 100), d = s !== void 0 && w.portrait !== void 0, _ = d ? ms(o, s, c, e) : {
|
|
6640
6779
|
width: 0,
|
|
6641
6780
|
height: 0,
|
|
6642
6781
|
scalePercent: 0
|
|
6643
6782
|
}, v = /* @__PURE__ */ new Map();
|
|
6644
6783
|
d && v.set(s.drawableID, _.scalePercent);
|
|
6645
6784
|
for (let t of [f, p]) if (t && d) {
|
|
6646
|
-
let n =
|
|
6785
|
+
let n = ms(o, t, c, e);
|
|
6647
6786
|
v.set(t.drawableID, n.scalePercent);
|
|
6648
6787
|
}
|
|
6649
|
-
let y = g ?
|
|
6788
|
+
let y = g ? ms(o, g, Qo, e) : {
|
|
6650
6789
|
width: 0,
|
|
6651
6790
|
height: 0,
|
|
6652
6791
|
scalePercent: 0
|
|
6653
|
-
}, b = _.width + (d ?
|
|
6654
|
-
if (w.placement.basis === "background") le = 0, V = w.placement.region === "HEADER_LIKE" ? re -
|
|
6792
|
+
}, b = _.width + (d ? $o * e : 0) + a.width, O = Math.max(_.height, a.height), k = nt(w.visualStyle, ...j === void 0 ? [] : [j.from, j.to]), A = Math.max(b / e + 48, k.width), I = Math.max(O / e + 48, k.height), ee = Math.max(b, (A - 48) * e), L = Math.max(O, (I - 48) * e), R = o.getNativeSize(), z = Array.isArray(R) && Number(R[0]) > 0 ? Number(R[0]) : 480, B = Array.isArray(R) && Number(R[1]) > 0 ? Number(R[1]) : 360, te = -z / 2, ne = z / 2, re = B / 2, ie = -B / 2, ae = te + ee / 2, oe = ne - ee / 2, se = ie + L / 2, ce = re - L / 2, le, V;
|
|
6793
|
+
if (w.placement.basis === "background") le = 0, V = w.placement.region === "HEADER_LIKE" ? re - es - L / 2 : w.placement.region === "FOOTER_LIKE" ? ie + es + L / 2 : 0;
|
|
6655
6794
|
else {
|
|
6656
6795
|
let e = Ke({
|
|
6657
|
-
bounds:
|
|
6796
|
+
bounds: fs(t),
|
|
6658
6797
|
bubbleWidth: ee,
|
|
6659
6798
|
bubbleHeight: L,
|
|
6660
6799
|
direction: w.placement.direction,
|
|
@@ -6664,8 +6803,8 @@ function os(e, t, n, r, i, a) {
|
|
|
6664
6803
|
});
|
|
6665
6804
|
le = e.x, V = e.y;
|
|
6666
6805
|
}
|
|
6667
|
-
le =
|
|
6668
|
-
let ue = w.placement.basis === "actor" ?
|
|
6806
|
+
le = gs(le, ae, oe), V = gs(V, se, ce);
|
|
6807
|
+
let ue = w.placement.basis === "actor" ? vs(w.placement.direction) : null, de = w.placement.basis === "actor" ? [
|
|
6669
6808
|
w.offset.x,
|
|
6670
6809
|
w.offset.y,
|
|
6671
6810
|
w.offset.scalePercent
|
|
@@ -6695,7 +6834,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6695
6834
|
shapeTransition: j
|
|
6696
6835
|
});
|
|
6697
6836
|
if (U !== S) {
|
|
6698
|
-
let e =
|
|
6837
|
+
let e = _s(Tt({
|
|
6699
6838
|
style: w.visualStyle,
|
|
6700
6839
|
lines: [],
|
|
6701
6840
|
width: A,
|
|
@@ -6716,9 +6855,9 @@ function os(e, t, n, r, i, a) {
|
|
|
6716
6855
|
l = t, S = U, r !== void 0 && o.destroySkin(r);
|
|
6717
6856
|
}
|
|
6718
6857
|
o.updateDrawableScale(n.drawableID, [100, 100]), o.updateDrawablePosition(n.drawableID, [le - fe.x, V + fe.y]);
|
|
6719
|
-
let W = le - b / 2, me = w.portrait?.placement ?? "left", he = me.endsWith("right"), ge = (w.portrait?.offset.x ?? 0) * e, _e = (w.portrait?.offset.y ?? 0) * e, ve = (he ? W + a.width +
|
|
6858
|
+
let W = le - b / 2, me = w.portrait?.placement ?? "left", he = me.endsWith("right"), ge = (w.portrait?.offset.x ?? 0) * e, _e = (w.portrait?.offset.y ?? 0) * e, ve = (he ? W + a.width + $o * e : W) + _.width / 2 + ge, ye = V;
|
|
6720
6859
|
me.startsWith("top-") ? ye = V + O / 2 - _.height / 2 : me.startsWith("bottom-") && (ye = V - O / 2 + _.height / 2), ye += _e;
|
|
6721
|
-
let be = (he || !d ? W : W + _.width +
|
|
6860
|
+
let be = (he || !d ? W : W + _.width + $o * e) + a.width / 2;
|
|
6722
6861
|
for (let e of [
|
|
6723
6862
|
s,
|
|
6724
6863
|
f,
|
|
@@ -6733,7 +6872,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6733
6872
|
if (i !== C) {
|
|
6734
6873
|
let e = u;
|
|
6735
6874
|
if (u = void 0, C = i, r > 0) {
|
|
6736
|
-
let e = o.createSVGSkin(
|
|
6875
|
+
let e = o.createSVGSkin(hs(t, n, r));
|
|
6737
6876
|
if (!Number.isInteger(e) || e < 0) throw new $("BUBBLE-RUNTIME-001", "TurboWarp did not create the Bubble portrait corner mask SVG skin.");
|
|
6738
6877
|
try {
|
|
6739
6878
|
o.updateDrawableSkinId(m.drawableID, e), u = e;
|
|
@@ -6745,7 +6884,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6745
6884
|
}
|
|
6746
6885
|
o.updateDrawablePosition(m.drawableID, [ve, ye]);
|
|
6747
6886
|
}
|
|
6748
|
-
o.updateDrawablePosition(h.drawableID, [be, V]), g && o.updateDrawablePosition(g.drawableID, [be + a.width / 2 - y.width / 2 -
|
|
6887
|
+
o.updateDrawablePosition(h.drawableID, [be, V]), g && o.updateDrawablePosition(g.drawableID, [be + a.width / 2 - y.width / 2 - $o * e, V - a.height / 2 + y.height / 2 + $o * e]);
|
|
6749
6888
|
let xe = (e, t) => {
|
|
6750
6889
|
e && E.set(e.drawableID, t);
|
|
6751
6890
|
};
|
|
@@ -6759,7 +6898,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6759
6898
|
let t = v.get(e.drawableID) ?? 0;
|
|
6760
6899
|
D.set(e.drawableID, [t, t]);
|
|
6761
6900
|
}
|
|
6762
|
-
m && D.set(m.drawableID, [e * 100, e * 100]), g && D.set(g.drawableID, [y.scalePercent, y.scalePercent]), g && xe(g, [be + a.width / 2 - y.width / 2 -
|
|
6901
|
+
m && D.set(m.drawableID, [e * 100, e * 100]), g && D.set(g.drawableID, [y.scalePercent, y.scalePercent]), g && xe(g, [be + a.width / 2 - y.width / 2 - $o * e, V - a.height / 2 + y.height / 2 + $o * e]), P(), F();
|
|
6763
6902
|
}, ee = t.onTargetVisualChange, L = (e) => {
|
|
6764
6903
|
ee?.(e), I();
|
|
6765
6904
|
}, R = () => I();
|
|
@@ -6776,7 +6915,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6776
6915
|
n && !r ? t.onTargetVisualChange === L && (t.onTargetVisualChange = ee ?? null) : !n && r && (t.onTargetVisualChange = L), I();
|
|
6777
6916
|
},
|
|
6778
6917
|
captureTextLayout() {
|
|
6779
|
-
x || (T =
|
|
6918
|
+
x || (T = ps(o, h, {
|
|
6780
6919
|
width: 180,
|
|
6781
6920
|
height: 48
|
|
6782
6921
|
}), I());
|
|
@@ -6791,11 +6930,11 @@ function os(e, t, n, r, i, a) {
|
|
|
6791
6930
|
if (x) return;
|
|
6792
6931
|
let t = Math.max(0, e.durationSeconds ?? 0), n = () => {
|
|
6793
6932
|
x || (P(), F());
|
|
6794
|
-
}, r = (t) =>
|
|
6933
|
+
}, r = (t) => fo(t, e.ease ?? "easeInOut");
|
|
6795
6934
|
if (e.name === "fadeIn" || e.name === "floatIn" || e.name === "zoomIn" || e.name === "riseUp") {
|
|
6796
6935
|
b = !0;
|
|
6797
6936
|
let i = e.name === "floatIn" || e.name === "riseUp" ? [0, 16] : [0, 0], o = e.name === "zoomIn" ? .01 : 1;
|
|
6798
|
-
O = i, k = o, A = e.name === "fadeIn" ? 0 : 1, n(), await
|
|
6937
|
+
O = i, k = o, A = e.name === "fadeIn" ? 0 : 1, n(), await po(a, t, (t) => {
|
|
6799
6938
|
let a = r(t);
|
|
6800
6939
|
O = [i[0] * (1 - a), i[1] * (1 - a)], k = o + (1 - o) * a, A = e.name === "fadeIn" ? a : 1, n();
|
|
6801
6940
|
}), O = [0, 0], k = 1, A = 1, I();
|
|
@@ -6803,7 +6942,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6803
6942
|
}
|
|
6804
6943
|
if (e.name === "fadeOut" || e.name === "floatOut" || e.name === "zoomOut" || e.name === "sink") {
|
|
6805
6944
|
let i = e.name === "floatOut" || e.name === "sink" ? [0, -16] : [0, 0], o = e.name === "zoomOut" ? .01 : 1;
|
|
6806
|
-
O = [0, 0], k = 1, A = 1, n(), await
|
|
6945
|
+
O = [0, 0], k = 1, A = 1, n(), await po(a, t, (t) => {
|
|
6807
6946
|
let a = r(t);
|
|
6808
6947
|
O = [i[0] * a, i[1] * a], k = 1 + (o - 1) * a, A = e.name === "fadeOut" ? 1 - a : 1, n();
|
|
6809
6948
|
}), O = i, k = o, A = e.name === "fadeOut" ? 0 : 1, n(), b = !1, F(), O = [0, 0], k = 1, A = 1;
|
|
@@ -6811,7 +6950,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6811
6950
|
}
|
|
6812
6951
|
if (e.name === "shake") {
|
|
6813
6952
|
let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .08, s = Be(typeof e.direction == "number" ? e.direction : e.direction ?? "right") ?? Be("right");
|
|
6814
|
-
O = [0, 0], await
|
|
6953
|
+
O = [0, 0], await po(a, o, (e) => {
|
|
6815
6954
|
let t = r(e) * i * Math.PI * 2, a = Math.sin(t) * 5;
|
|
6816
6955
|
O = [s.x * a, s.y * a], n();
|
|
6817
6956
|
}), O = [0, 0], I();
|
|
@@ -6819,7 +6958,7 @@ function os(e, t, n, r, i, a) {
|
|
|
6819
6958
|
}
|
|
6820
6959
|
if (e.name === "explode") {
|
|
6821
6960
|
let i = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : i * .12, s = e.relativeScale ?? 1.15;
|
|
6822
|
-
await
|
|
6961
|
+
await po(a, o, (e) => {
|
|
6823
6962
|
let t = r(e), a = Math.abs(Math.sin(t * i * Math.PI));
|
|
6824
6963
|
k = 1 + (s - 1) * a, n();
|
|
6825
6964
|
}), k = 1, I();
|
|
@@ -6831,12 +6970,12 @@ function os(e, t, n, r, i, a) {
|
|
|
6831
6970
|
from: r,
|
|
6832
6971
|
to: n,
|
|
6833
6972
|
progress: 0
|
|
6834
|
-
}, I(), await
|
|
6835
|
-
let o = t === 0 ? 1 :
|
|
6973
|
+
}, I(), await po(a, t, (a) => {
|
|
6974
|
+
let o = t === 0 ? 1 : uo(a * Math.max(i, 1) / 1);
|
|
6836
6975
|
j = {
|
|
6837
6976
|
from: r,
|
|
6838
6977
|
to: n,
|
|
6839
|
-
progress:
|
|
6978
|
+
progress: fo(o, e.ease ?? "easeInOut")
|
|
6840
6979
|
}, I();
|
|
6841
6980
|
}), j = void 0, I();
|
|
6842
6981
|
return;
|
|
@@ -6851,48 +6990,48 @@ function os(e, t, n, r, i, a) {
|
|
|
6851
6990
|
dispose() {
|
|
6852
6991
|
if (!x) {
|
|
6853
6992
|
x = !0, o.off?.("NativeSizeChanged", R), w.placement.basis === "actor" && t.onTargetVisualChange === L && (t.onTargetVisualChange = ee ?? null);
|
|
6854
|
-
for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID,
|
|
6993
|
+
for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID, Xo);
|
|
6855
6994
|
l !== void 0 && (o.destroySkin(l), l = void 0), u !== void 0 && (o.destroySkin(u), u = void 0), e.requestRedraw?.();
|
|
6856
6995
|
}
|
|
6857
6996
|
}
|
|
6858
6997
|
});
|
|
6859
6998
|
} catch (e) {
|
|
6860
|
-
for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID,
|
|
6999
|
+
for (let e of [...c].reverse()) o.destroyDrawable(e.drawableID, Xo);
|
|
6861
7000
|
throw l !== void 0 && o.destroySkin(l), u !== void 0 && o.destroySkin(u), e;
|
|
6862
7001
|
}
|
|
6863
7002
|
}
|
|
6864
|
-
function
|
|
6865
|
-
if (!
|
|
6866
|
-
let n = e, r =
|
|
7003
|
+
function bs(e, t = {}) {
|
|
7004
|
+
if (!ns(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp runtime.");
|
|
7005
|
+
let n = e, r = rs(n.renderer), i = is(t.bubbleRenderBackend), a, o;
|
|
6867
7006
|
if (i === "svg-overlay") {
|
|
6868
7007
|
if (t.svgOverlayTextCapability !== void 0) a = t.svgOverlayTextCapability;
|
|
6869
|
-
else if (n.ext_kubohiroyasvgtext === void 0) a =
|
|
7008
|
+
else if (n.ext_kubohiroyasvgtext === void 0) a = cs();
|
|
6870
7009
|
else try {
|
|
6871
|
-
a =
|
|
7010
|
+
a = ro(n.ext_kubohiroyasvgtext);
|
|
6872
7011
|
} catch (e) {
|
|
6873
7012
|
o = e instanceof Error ? e.message : String(e);
|
|
6874
7013
|
}
|
|
6875
7014
|
}
|
|
6876
|
-
let s =
|
|
7015
|
+
let s = as(t.svgOverlayUnsupportedBehavior), c = i === "svg-overlay" ? os(t.document) : void 0, l = i === "svg-overlay" ? o ?? ss(r, c, a) : void 0;
|
|
6877
7016
|
if (i === "svg-overlay" && l !== void 0 && s === "error") throw new $("BUBBLE-RUNTIME-004", `Bubble SVG overlay backend is unavailable because ${l}. Use scratch-render or install the required public upstream capability.`);
|
|
6878
7017
|
let u = i === "svg-overlay" && l === void 0 ? "svg-overlay" : "scratch-render", d = t.scheduler ?? {
|
|
6879
7018
|
setTimeout: (e, t) => globalThis.setTimeout(e, t),
|
|
6880
7019
|
clearTimeout: (e) => globalThis.clearTimeout(e)
|
|
6881
|
-
}, f = () =>
|
|
7020
|
+
}, f = () => us(n.ext_kubohiroyaassetmanager), p, m = () => (p ??= ds(n.ext_kubohiroyaassetmanager), p), h;
|
|
6882
7021
|
if (u === "svg-overlay") try {
|
|
6883
|
-
h =
|
|
7022
|
+
h = Po(a, r);
|
|
6884
7023
|
} catch (e) {
|
|
6885
7024
|
throw new $("BUBBLE-RUNTIME-004", `Bubble SVG overlay text capability is invalid: ${e instanceof Error ? e.message : String(e)}`);
|
|
6886
7025
|
}
|
|
6887
7026
|
else if (t.textCapability !== void 0) h = t.textCapability;
|
|
6888
7027
|
else try {
|
|
6889
|
-
h = n.ext_kubohiroyasvgtext === void 0 ?
|
|
7028
|
+
h = n.ext_kubohiroyasvgtext === void 0 ? ls(n) : eo(n.ext_kubohiroyasvgtext);
|
|
6890
7029
|
} catch (e) {
|
|
6891
7030
|
throw new $("BUBBLE-RUNTIME-003", `Bubble could not initialize the scratch-render text provider: ${e instanceof Error ? e.message : String(e)}`);
|
|
6892
7031
|
}
|
|
6893
7032
|
let g;
|
|
6894
7033
|
if (u === "svg-overlay") try {
|
|
6895
|
-
g =
|
|
7034
|
+
g = zo(t.svgOverlayImageCapability ?? lo(Object.freeze({
|
|
6896
7035
|
isRegistered(e) {
|
|
6897
7036
|
return m().isRegistered(e);
|
|
6898
7037
|
},
|
|
@@ -6917,7 +7056,7 @@ function ss(e, t = {}) {
|
|
|
6917
7056
|
let i = t.drawableID;
|
|
6918
7057
|
if (!Number.isInteger(i) || i < 0) throw new $("BUBBLE-RUNTIME-001", "Bubble image target drawable is invalid.");
|
|
6919
7058
|
let a = await f().resolveSkin(e);
|
|
6920
|
-
if (!
|
|
7059
|
+
if (!ns(a) || !Number.isInteger(a.skinId) || a.skinId < 0) throw new $("BUBBLE-RUNTIME-002", `Asset Manager did not resolve an image skin: ${String(e)}`);
|
|
6921
7060
|
r.updateDrawableSkinId(i, a.skinId), n.requestRedraw?.();
|
|
6922
7061
|
}
|
|
6923
7062
|
};
|
|
@@ -6930,21 +7069,21 @@ function ss(e, t = {}) {
|
|
|
6930
7069
|
},
|
|
6931
7070
|
async playSound(e, t = {}) {
|
|
6932
7071
|
let n = f(), r = t.untilDone ? n?.playSoundUntilDone : n?.playSound;
|
|
6933
|
-
if (typeof r != "function") throw new $("BUBBLE-RUNTIME-002", "TurboWarp
|
|
7072
|
+
if (typeof r != "function") throw new $("BUBBLE-RUNTIME-002", "TurboWarp-Asset-Manager does not provide audio playback.");
|
|
6934
7073
|
await r.call(n, { NAME: e });
|
|
6935
7074
|
}
|
|
6936
|
-
}, v = u === "svg-overlay" ?
|
|
6937
|
-
return
|
|
7075
|
+
}, v = u === "svg-overlay" ? Bo(r, c) : void 0;
|
|
7076
|
+
return qa({
|
|
6938
7077
|
...g === void 0 ? {} : { imageResolver: g },
|
|
6939
7078
|
audio: _,
|
|
6940
7079
|
textCapability: h,
|
|
6941
7080
|
createSurface({ actor: e, actorKey: t, kind: r, style: i }) {
|
|
6942
|
-
if (!
|
|
6943
|
-
return u === "svg-overlay" ?
|
|
7081
|
+
if (!ns(e) || typeof e.id != "string") throw new $("BUBBLE-RUNTIME-001", "Bubble actor target is invalid.");
|
|
7082
|
+
return u === "svg-overlay" ? Yo(v, e, t, r, i, d) : ys(n, e, t, r, i, d);
|
|
6944
7083
|
},
|
|
6945
7084
|
...t.scheduler === void 0 ? {} : { scheduler: t.scheduler },
|
|
6946
7085
|
...t.onAnimationError === void 0 ? {} : { onAnimationError: t.onAnimationError }
|
|
6947
7086
|
});
|
|
6948
7087
|
}
|
|
6949
7088
|
//#endregion
|
|
6950
|
-
export { $ as BubbleRuntimeAdapterError,
|
|
7089
|
+
export { $ as BubbleRuntimeAdapterError, Co as bubbleRenderBackends, lo as createAssetManagerSvgOverlayImageCapability, zo as createSvgOverlayImageAdapter, Yo as createSvgOverlaySurface, Bo as createSvgOverlaySurfaceManager, Po as createSvgOverlayTextAdapter, to as createSvgTextCompositionCapability, no as createSvgTextOverlayTextCapability, bs as createTurboWarpBubbleComposition, eo as createTurboWarpSvgTextCapability, ro as createTurboWarpSvgTextOverlayTextCapability, To as defaultBubbleOverlayUnsupportedBehavior, wo as defaultBubbleRenderBackend };
|