@famibee/skynovel 1.65.0 → 2.0.1

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.
Files changed (176) hide show
  1. package/README.md +3 -3
  2. package/dist/Button.js +131 -163
  3. package/dist/Button.js.map +1 -1
  4. package/dist/CallStack.js +19 -22
  5. package/dist/CallStack.js.map +1 -1
  6. package/dist/CmnInterface.js +91 -0
  7. package/dist/CmnInterface.js.map +1 -0
  8. package/dist/CmnLib.js +94 -0
  9. package/dist/CmnLib.js.map +1 -0
  10. package/dist/Config.js +26 -0
  11. package/dist/Config.js.map +1 -0
  12. package/dist/ConfigBase.js +152 -0
  13. package/dist/ConfigBase.js.map +1 -0
  14. package/dist/DebugMng.js +89 -102
  15. package/dist/DebugMng.js.map +1 -1
  16. package/dist/EventListenerCtn.js +21 -0
  17. package/dist/EventListenerCtn.js.map +1 -0
  18. package/dist/EventMng.js +1435 -1577
  19. package/dist/EventMng.js.map +1 -1
  20. package/dist/Grammar.js +194 -0
  21. package/dist/Grammar.js.map +1 -0
  22. package/dist/GrpLayer.js +163 -195
  23. package/dist/GrpLayer.js.map +1 -1
  24. package/dist/Layer.js +260 -0
  25. package/dist/Layer.js.map +1 -0
  26. package/dist/LayerMng.js +810 -991
  27. package/dist/LayerMng.js.map +1 -1
  28. package/dist/Main.js +144 -393
  29. package/dist/Main.js.map +1 -1
  30. package/dist/PropParser.js +936 -834
  31. package/dist/PropParser.js.map +1 -1
  32. package/dist/Reading.js +917 -786
  33. package/dist/Reading.js.map +1 -1
  34. package/dist/RubySpliter.js +59 -92
  35. package/dist/RubySpliter.js.map +1 -1
  36. package/dist/ScriptIterator.js +805 -1034
  37. package/dist/ScriptIterator.js.map +1 -1
  38. package/dist/SndBuf.js +1097 -1332
  39. package/dist/SndBuf.js.map +1 -1
  40. package/dist/SoundMng.js +124 -135
  41. package/dist/SoundMng.js.map +1 -1
  42. package/dist/SpritesMng.js +220 -232
  43. package/dist/SpritesMng.js.map +1 -1
  44. package/dist/SysBase.js +1729 -0
  45. package/dist/SysBase.js.map +1 -0
  46. package/dist/TxtLayer.js +1212 -1397
  47. package/dist/TxtLayer.js.map +1 -1
  48. package/dist/Variable.js +398 -466
  49. package/dist/Variable.js.map +1 -1
  50. package/dist/chunk.js +18 -0
  51. package/dist/gamepad.js +723 -511
  52. package/dist/gamepad.js.map +1 -1
  53. package/dist/pixi.js +13422 -0
  54. package/dist/pixi.js.map +1 -0
  55. package/dist/platform.js +424 -369
  56. package/dist/platform.js.map +1 -1
  57. package/dist/sn/AnalyzeTagArg.d.ts +1 -1
  58. package/dist/sn/AnalyzeTagArg.d.ts.map +1 -1
  59. package/dist/sn/CmnInterface.d.ts +3 -1
  60. package/dist/sn/CmnInterface.d.ts.map +1 -1
  61. package/dist/sn/CmnLib.d.ts.map +1 -1
  62. package/dist/sn/CmnTween.d.ts +3 -3
  63. package/dist/sn/CmnTween.d.ts.map +1 -1
  64. package/dist/sn/EventMng.d.ts.map +1 -1
  65. package/dist/sn/Grammar.d.ts +1 -1
  66. package/dist/sn/Grammar.d.ts.map +1 -1
  67. package/dist/sn/PropParser.d.ts +2 -2
  68. package/dist/sn/PropParser.d.ts.map +1 -1
  69. package/dist/sn/Reading.d.ts +6 -0
  70. package/dist/sn/Reading.d.ts.map +1 -1
  71. package/dist/sn/ScriptIterator.d.ts.map +1 -1
  72. package/dist/sn/SndBuf.d.ts +27 -16
  73. package/dist/sn/SndBuf.d.ts.map +1 -1
  74. package/dist/sn/SoundMng.d.ts +4 -1
  75. package/dist/sn/SoundMng.d.ts.map +1 -1
  76. package/dist/sn/SysBase.d.ts.map +1 -1
  77. package/dist/sn/TxtStage.d.ts +2 -1
  78. package/dist/sn/TxtStage.d.ts.map +1 -1
  79. package/dist/test/ValTest.d.ts +1 -1
  80. package/dist/test/ValTest.d.ts.map +1 -1
  81. package/dist/web.js +653 -8
  82. package/dist/web.js.map +1 -1
  83. package/dist_app/Button.js +131 -163
  84. package/dist_app/Button.js.map +1 -1
  85. package/dist_app/CallStack.js +19 -22
  86. package/dist_app/CallStack.js.map +1 -1
  87. package/dist_app/CmnInterface.js +91 -0
  88. package/dist_app/CmnInterface.js.map +1 -0
  89. package/dist_app/CmnLib.js +94 -0
  90. package/dist_app/CmnLib.js.map +1 -0
  91. package/dist_app/Config.js +26 -0
  92. package/dist_app/Config.js.map +1 -0
  93. package/dist_app/ConfigBase.js +152 -0
  94. package/dist_app/ConfigBase.js.map +1 -0
  95. package/dist_app/DebugMng.js +92 -0
  96. package/dist_app/DebugMng.js.map +1 -0
  97. package/dist_app/EventListenerCtn.js +21 -0
  98. package/dist_app/EventListenerCtn.js.map +1 -0
  99. package/dist_app/EventMng.js +1435 -1577
  100. package/dist_app/EventMng.js.map +1 -1
  101. package/dist_app/Grammar.js +194 -0
  102. package/dist_app/Grammar.js.map +1 -0
  103. package/dist_app/GrpLayer.js +163 -195
  104. package/dist_app/GrpLayer.js.map +1 -1
  105. package/dist_app/Layer.js +260 -0
  106. package/dist_app/Layer.js.map +1 -0
  107. package/dist_app/LayerMng.js +810 -991
  108. package/dist_app/LayerMng.js.map +1 -1
  109. package/dist_app/Main.js +144 -392
  110. package/dist_app/Main.js.map +1 -1
  111. package/dist_app/PropParser.js +936 -834
  112. package/dist_app/PropParser.js.map +1 -1
  113. package/dist_app/Reading.js +917 -786
  114. package/dist_app/Reading.js.map +1 -1
  115. package/dist_app/RubySpliter.js +59 -92
  116. package/dist_app/RubySpliter.js.map +1 -1
  117. package/dist_app/ScriptIterator.js +805 -1033
  118. package/dist_app/ScriptIterator.js.map +1 -1
  119. package/dist_app/SndBuf.js +1097 -1332
  120. package/dist_app/SndBuf.js.map +1 -1
  121. package/dist_app/SoundMng.js +124 -135
  122. package/dist_app/SoundMng.js.map +1 -1
  123. package/dist_app/SpritesMng.js +220 -231
  124. package/dist_app/SpritesMng.js.map +1 -1
  125. package/dist_app/SysBase.js +1729 -0
  126. package/dist_app/SysBase.js.map +1 -0
  127. package/dist_app/TxtLayer.js +1212 -1396
  128. package/dist_app/TxtLayer.js.map +1 -1
  129. package/dist_app/Variable.js +398 -466
  130. package/dist_app/Variable.js.map +1 -1
  131. package/dist_app/app.js +211 -8
  132. package/dist_app/app.js.map +1 -1
  133. package/dist_app/appMain.js +20 -21
  134. package/dist_app/appMain.js.map +1 -1
  135. package/dist_app/chunk.js +18 -0
  136. package/dist_app/gamepad.js +723 -511
  137. package/dist_app/gamepad.js.map +1 -1
  138. package/dist_app/pixi.js +11181 -0
  139. package/dist_app/pixi.js.map +1 -0
  140. package/dist_app/platform.js +424 -369
  141. package/dist_app/platform.js.map +1 -1
  142. package/dist_app/preload.js +2 -2
  143. package/dist_app/preload.js.map +1 -1
  144. package/dist_app/sn/AnalyzeTagArg.d.ts +1 -1
  145. package/dist_app/sn/AnalyzeTagArg.d.ts.map +1 -1
  146. package/dist_app/sn/CmnInterface.d.ts +3 -1
  147. package/dist_app/sn/CmnInterface.d.ts.map +1 -1
  148. package/dist_app/sn/CmnLib.d.ts.map +1 -1
  149. package/dist_app/sn/CmnTween.d.ts +3 -3
  150. package/dist_app/sn/CmnTween.d.ts.map +1 -1
  151. package/dist_app/sn/EventMng.d.ts.map +1 -1
  152. package/dist_app/sn/Grammar.d.ts +1 -1
  153. package/dist_app/sn/Grammar.d.ts.map +1 -1
  154. package/dist_app/sn/PropParser.d.ts +2 -2
  155. package/dist_app/sn/PropParser.d.ts.map +1 -1
  156. package/dist_app/sn/Reading.d.ts +6 -0
  157. package/dist_app/sn/Reading.d.ts.map +1 -1
  158. package/dist_app/sn/ScriptIterator.d.ts.map +1 -1
  159. package/dist_app/sn/SndBuf.d.ts +27 -16
  160. package/dist_app/sn/SndBuf.d.ts.map +1 -1
  161. package/dist_app/sn/SoundMng.d.ts +4 -1
  162. package/dist_app/sn/SoundMng.d.ts.map +1 -1
  163. package/dist_app/sn/SysBase.d.ts.map +1 -1
  164. package/dist_app/sn/TxtStage.d.ts +2 -1
  165. package/dist_app/sn/TxtStage.d.ts.map +1 -1
  166. package/dist_app/test/ValTest.d.ts +1 -1
  167. package/dist_app/test/ValTest.d.ts.map +1 -1
  168. package/package.json +23 -13
  169. package/dist/CmnTween.js +0 -1005
  170. package/dist/CmnTween.js.map +0 -1
  171. package/dist/web2.js +0 -21644
  172. package/dist/web2.js.map +0 -1
  173. package/dist_app/CmnTween.js +0 -1005
  174. package/dist_app/CmnTween.js.map +0 -1
  175. package/dist_app/app2.js +0 -18547
  176. package/dist_app/app2.js.map +0 -1
@@ -1,1415 +1,1231 @@
1
- import { e as F, k as S, y as ot, D as K, o as P, a as T, R as A, G as B, x as q, N as X, z as tt, O as ct, w as V, S as et, u as M, r as dt } from "./app2.js";
2
- import { a as I, C as st, G as pt, T as ft } from "./CmnTween.js";
3
- import { S as W } from "./SpritesMng.js";
4
- import { R as it } from "./RubySpliter.js";
5
- import { Button as ut } from "./Button.js";
6
- const H = "、。,.)]}〉」』】〕”〟ぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ!?!?‼⁉・ーゝゞヽヾ々", G = "[({〈「『【〔“〝", U = "─‥…", Y = H, nt = new RegExp(`[${H}]`), gt = new RegExp(`[${G}]`), _t = new RegExp(`[${U}]`), yt = nt;
7
- class mt {
8
- #c = H;
9
- #n = G;
10
- #r = U;
11
- #a = Y;
12
- get 行頭禁則() {
13
- return this.#c;
14
- }
15
- get 行末禁則() {
16
- return this.#n;
17
- }
18
- get 分割禁止() {
19
- return this.#r;
20
- }
21
- get ぶら下げ() {
22
- return this.#a;
23
- }
24
- #e = nt;
25
- #h = gt;
26
- #p = _t;
27
- #k = yt;
28
- break_fixed = !1;
29
- break_fixed_left = 0;
30
- break_fixed_top = 0;
31
- bura = !1;
32
- lay(t) {
33
- t.kinsoku_sol && (this.#c = t.kinsoku_sol, this.#e = new RegExp(`[${this.#c}]`)), t.kinsoku_eol && (this.#n = t.kinsoku_eol, this.#l(), this.#h = new RegExp(`[${this.#n}]`)), t.kinsoku_dns && (this.#r = t.kinsoku_dns, this.#g(), this.#p = new RegExp(`[${this.#r}]`)), t.kinsoku_bura && (this.#a = t.kinsoku_bura, this.#l(), this.#g(), this.#k = new RegExp(`[${this.#a}]`)), "bura" in t && (this.bura = F(t, "bura", !1)), this.break_fixed = F(t, "break_fixed", this.break_fixed), this.break_fixed_left = S(t, "break_fixed_left", this.break_fixed_left), this.break_fixed_top = S(t, "break_fixed_top", this.break_fixed_top);
34
- }
35
- // 禁則の競合(ぶら下げ と 行末禁則 の両方に含まれる文字があってはならない)
36
- #l() {
37
- const t = this.#n.length, e = this.#a.length;
38
- if (t < e)
39
- for (let s = 0; s < t; ++s) {
40
- const i = this.#n[s];
41
- if (this.#a.includes(i)) throw `禁則の競合があります。文字 ${String(i)} がぶら下げ 行末禁則 の両方に含まれます`;
42
- }
43
- else
44
- for (let s = 0; s < e; ++s) {
45
- const i = this.#a[s];
46
- if (this.#n.includes(i)) throw `禁則の競合があります。文字 ${String(i)} がぶら下げ と 行末禁則 の両方に含まれます`;
47
- }
48
- }
49
- // 禁則の競合(ぶら下げ と 分割禁止 の両方に含まれる文字があってはならない)
50
- #g() {
51
- const t = this.#r.length, e = this.#a.length;
52
- if (t < e)
53
- for (let s = 0; s < t; ++s) {
54
- const i = this.#r[s];
55
- if (this.#a.includes(i)) throw `禁則の競合があります。文字 ${String(i)} がぶら下げ と 分割禁止 の両方に含まれます`;
56
- }
57
- else
58
- for (let s = 0; s < e; ++s) {
59
- const i = this.#a[s];
60
- if (this.#r.includes(i)) throw `禁則の競合があります。文字 ${String(i)} がぶら下げ と 分割禁止 の両方に含まれます`;
61
- }
62
- }
63
- reNew(t) {
64
- t.#t(this.#c, this.#n, this.#r, this.#a), t.break_fixed = this.break_fixed, t.break_fixed_left = this.break_fixed_left, t.break_fixed_top = this.break_fixed_top, t.bura = this.bura;
65
- }
66
- #t(t, e, s, i) {
67
- this.#c !== t && (this.#c = t, this.#e = new RegExp(`[${t}]`)), this.#n !== e && (this.#n = e, this.#h = new RegExp(`[${e}]`)), this.#r !== s && (this.#r = s, this.#p = new RegExp(`[${s}]`)), this.#a !== i && (this.#a = i, this.#k = new RegExp(`[${i}]`));
68
- }
69
- record() {
70
- const t = {
71
- break_fixed: this.break_fixed,
72
- break_fixed_left: this.break_fixed_left,
73
- break_fixed_top: this.break_fixed_top,
74
- bura: this.bura
75
- };
76
- return this.#c === H && (t.行頭禁則 = this.#c), this.#n === G && (t.行末禁則 = this.#n), this.#r === U && (t.分割禁止 = this.#r), this.#a === Y && (t.ぶら下げ = this.#a), t;
77
- }
78
- playback(t) {
79
- t && (this.#t(
80
- t.行頭禁則 ?? H,
81
- t.行末禁則 ?? G,
82
- t.分割禁止 ?? U,
83
- t.ぶら下げ ?? Y
84
- ), this.break_fixed = t.break_fixed, this.break_fixed_left = t.break_fixed_left, this.break_fixed_top = t.break_fixed_top, this.bura = t.bura);
85
- }
86
- hyph(t, e, s, i, a) {
87
- let n, l = 0, h = 2, r = (b) => (r = () => !1, i === b ? (i > 0 && (t.innerHTML = a.replaceAll('class="sn_ch"', 'class="sn_ch sn_ch_in_default"')), !0) : b < 2);
88
- do {
89
- if (n = this.#_(t, e), l = n.length, r(l)) break;
90
- let b = -1 / 0;
91
- for (; h < l; ++h) {
92
- const { elm: y, rect: w, ch: C } = n[h];
93
- if (y.tagName === "RT") continue;
94
- const x = s ? w.y : w.x;
95
- if (b <= x || y.previousElementSibling?.tagName === "SPAN" && y.previousElementSibling?.innerHTML.includes("<br>") || y.parentElement?.previousElementSibling?.tagName === "SPAN" && y.parentElement?.previousElementSibling?.innerHTML.includes("<br>")) {
96
- b = x, this.break_fixed || (this.break_fixed_left = w.x, this.break_fixed_top = w.y);
97
- continue;
98
- }
99
- const N = this.#u(n, h), { elm: g, rect: $, ch: o } = n[N];
100
- if (!this.break_fixed) {
101
- this.break_fixed_left = $.x, this.break_fixed_top = $.y;
102
- const p = globalThis.getComputedStyle(g), E = parseFloat(p.fontSize);
103
- s ? this.break_fixed_top += E : this.break_fixed_left += E;
104
- }
105
- b = -1 / 0;
106
- const d = h, { cont: u, ins: m } = this.bura ? this.hyph_alg_bura(n, N, o, h) : this.hyph_alg(n, N, o, h, C);
107
- if (h = m, u) continue;
108
- const v = n[h].elm, _ = v.parentElement, f = document.createElement("br");
109
- if (_.classList.contains("sn_tx")) _.insertBefore(f, v);
110
- else {
111
- const p = _.parentElement;
112
- p.classList.contains("sn_ch") ? p.parentElement.insertBefore(f, p) : p.insertBefore(f, _);
113
- }
114
- h += 2, h < d && (h = d), l = -1;
115
- break;
116
- }
117
- } while (l < 0);
118
- return [n, l];
119
- }
120
- // 一つ前の要素を探す(ルビ対応)
121
- #u(t, e) {
122
- const s = e - 1, { elm: i } = t[s];
123
- return i.tagName !== "RT" ? s - (i.style.textCombineUpright === "all" ? Array.from(i.textContent).length - 1 : 0) : s - Array.from(i.textContent).length;
124
- }
125
- #_(t, e) {
126
- const s = [];
127
- if (t.nodeType !== t.TEXT_NODE) return Array.from(t.childNodes).map((l) => this.#_(l, e)).flat();
128
- const i = t.ownerDocument.createRange();
129
- i.selectNodeContents(t);
130
- let a = 0;
131
- const n = i.endOffset;
132
- for (; a < n; ) {
133
- i.setStart(t, a), i.setEnd(t, ++a);
134
- const l = i.toString();
135
- s.push({
136
- ch: l,
137
- rect: e(i, l),
138
- elm: i.startContainer.parentElement
139
- });
140
- }
141
- return i.detach(), s;
142
- }
143
- /**
144
- * 抽象化した禁則処理アルゴリズム
145
- * @method hyph_alg
146
- * @param {IChRect[]} a - 文章の抽象化配列
147
- * @param {number} p_i - 処理要素の一つ前の添字
148
- * @param {string} p_ch - 処理要素の一つ前の文字
149
- * @param {number} i - 処理要素の添字
150
- * @param {string} ch - 処理要素の文字
151
- * @return {Object} result 戻り値
152
- * @return {boolean} result.cont - true: 呼び元で改行挿入せず continue
153
- * @return {number} result.ins - 手前に改行を挿入すべき要素の添字
154
- */
155
- hyph_alg(t, e, s, i, a) {
156
- let n = i;
157
- if (!this.#h.test(s)) {
158
- if (this.#e.test(a))
159
- for (; (n = this.#u(t, n)) >= 0 && this.#e.test(t[n].ch); )
160
- ;
161
- else if (!(s === a && this.#p.test(s))) return { cont: !0, ins: n + 1 };
162
- }
163
- for (n = e; (n = this.#u(t, n)) >= 0 && this.#h.test(t[n].ch); )
164
- ;
165
- return { cont: !1, ins: n + 1 };
166
- }
167
- /**
168
- * 抽象化した禁則処理アルゴリズム
169
- * @method hyph_alg
170
- * @param {IChRect[]} a - 文章の抽象化配列
171
- * @param {number} p_i - 処理要素の一つ前の添字
172
- * @param {string} p_ch - 処理要素の一つ前の文字
173
- * @param {number} i - 処理要素の添字
174
- * @return {Object} result 戻り値
175
- * @return {boolean} result.cont - true: 呼び元で改行挿入せず continue
176
- * @return {number} result.ins - 手前に改行を挿入すべき要素の添字
177
- */
178
- hyph_alg_bura(t, e, s, i) {
179
- const a = this.#u(t, e), { ch: n } = t[a];
180
- if (this.#k.test(n) || this.#e.test(n)) {
181
- let h = e;
182
- (this.#k.test(s) || this.#e.test(s)) && ++h;
183
- const r = this.#u(t, h), { ch: b } = t[r], { ch: y } = t[h];
184
- if (b === y && this.#p.test(y)) return { cont: !1, ins: r };
185
- if (!this.#h.test(b)) return { cont: !1, ins: h };
186
- h = r;
187
- do
188
- if (!this.#h.test(t[h].ch)) break;
189
- while ((h = this.#u(t, h)) >= 0);
190
- return { cont: !1, ins: h + 1 };
191
- }
192
- const l = this.#u(t, a);
193
- if (i >= 3) {
194
- const { ch: h } = t[l];
195
- if (this.#p.test(n) && h === n)
196
- return { cont: !1, ins: l };
197
- if (this.#h.test(h)) {
198
- let r = l;
199
- for (; (r = this.#u(t, r)) >= 0 && this.#h.test(t[r].ch); )
200
- ;
201
- return { cont: !1, ins: r + 1 };
202
- }
203
- }
204
- return { cont: !1, ins: a };
205
- }
206
- }
207
- function bt(Q, t, e, s, i, a = !0) {
208
- const n = {
209
- escape: (o) => o.replaceAll(/([.*+?^${}()|[\]/\\])/g, "\\$1"),
210
- mimeType: (o) => {
211
- const d = y(o).toLowerCase();
212
- return l()[d] || "";
213
- },
214
- dataAsUrl: N,
215
- isDataUrl: w,
216
- resolveUrl: C,
217
- getAndEncode: x,
218
- asArray: (o) => {
219
- const d = [], u = o.length;
220
- for (let m = 0; m < u; ++m) d.push(o[m]);
221
- return d;
222
- }
223
- };
224
- function l() {
225
- const o = "application/font-woff", d = "image/jpeg";
226
- return {
227
- woff: o,
228
- woff2: o,
229
- ttf: "application/font-truetype",
230
- eot: "application/vnd.ms-fontobject",
231
- png: "image/png",
232
- jpg: d,
233
- jpeg: d,
234
- gif: "image/gif",
235
- tiff: "image/tiff",
236
- svg: "image/svg+xml"
237
- };
238
- }
239
- const h = g(), r = $();
240
- function b(o) {
241
- return r.resolveAll().then((d) => {
242
- const u = document.createElement("style");
243
- return o.appendChild(u), u.appendChild(document.createTextNode(d)), o;
244
- });
245
- }
246
- function y(o) {
247
- return /\.([^./]*?)$/g.exec(o)?.[1] ?? "";
248
- }
249
- function w(o) {
250
- return o.search(/^(data:)/) !== -1;
251
- }
252
- function C(o, d) {
253
- const u = document.implementation.createHTMLDocument(), m = u.createElement("base");
254
- u.head.appendChild(m);
255
- const v = u.createElement("a");
256
- return u.body.appendChild(v), m.href = d, v.href = o, v.href;
257
- }
258
- function x(o) {
259
- return new Promise(function(u) {
260
- const m = new XMLHttpRequest();
261
- m.onreadystatechange = v, m.ontimeout = _, m.responseType = "blob", m.timeout = 3e4, m.open("GET", o, !0), m.send();
262
- function v() {
263
- if (m.readyState !== 4) return;
264
- if (m.status !== 200) {
265
- f("cannot fetch resource: " + o + ", status: " + m.status);
266
- return;
267
- }
268
- const p = new FileReader();
269
- p.onloadend = function() {
270
- const E = p.result.toString().split(/,/)[1];
271
- u(E);
272
- }, p.readAsDataURL(m.response);
273
- }
274
- function _() {
275
- f("timeout of 30000ms occured while fetching resource: " + o);
276
- }
277
- function f(p) {
278
- console.error(p), u("");
279
- }
280
- });
281
- }
282
- function N(o, d) {
283
- return "data:" + d + ";base64," + o;
284
- }
285
- function g() {
286
- const o = /url\(['"]?([^'"]+?)['"]?\)/g;
287
- return {
288
- inlineAll: v,
289
- shouldProcess: d
290
- };
291
- function d(_) {
292
- return _.search(o) !== -1;
293
- }
294
- function u(_) {
295
- const f = [];
296
- let p;
297
- for (; p = o.exec(_); )
298
- f.push(p[1]);
299
- return f.filter(function(E) {
300
- return !n.isDataUrl(E);
301
- });
302
- }
303
- function m(_, f, p, E) {
304
- return Promise.resolve(f).then((R) => p ? n.resolveUrl(R, p) : R).then(E || n.getAndEncode).then((R) => n.dataAsUrl(R, n.mimeType(f))).then((R) => _.replace(j(f), "$1" + R + "$3"));
305
- function j(R) {
306
- return new RegExp(`(url\\(['"]?)(` + n.escape(R) + `)(['"]?\\))`, "g");
307
- }
308
- }
309
- function v(_, f, p) {
310
- if (E()) return Promise.resolve(_);
311
- return Promise.resolve(_).then(u).then((j) => {
312
- let R = Promise.resolve(_);
313
- for (const J of j) R = R.then((O) => m(O, J, f, p));
314
- return R;
315
- });
316
- function E() {
317
- return !d(_);
318
- }
319
- }
320
- }
321
- function $() {
322
- return {
323
- resolveAll: o,
324
- impl: { readAll: d }
325
- };
326
- function o() {
327
- return d().then((u) => Promise.allSettled(
328
- u.map((m) => m.resolve())
329
- )).then((u) => u.join(`
330
- `));
331
- }
332
- function d() {
333
- return Promise.resolve(n.asArray(document.styleSheets)).then(m).then(u).then((_) => _.map(v));
334
- function u(_) {
335
- return _.filter((f) => f.type === CSSRule.FONT_FACE_RULE).filter((f) => h.shouldProcess(f.style.getPropertyValue("src")));
336
- }
337
- function m(_) {
338
- const f = [];
339
- for (const p of _)
340
- try {
341
- if (p.href) continue;
342
- n.asArray(p.cssRules || []).forEach(f.push.bind(f));
343
- } catch (E) {
344
- console.error("Error while reading CSS rules from " + p.href, String(E));
345
- }
346
- return f;
347
- }
348
- function v(_) {
349
- return {
350
- resolve: function() {
351
- const p = (_.parentStyleSheet || {}).href;
352
- return h.inlineAll(_.cssText, p);
353
- },
354
- src() {
355
- return _.style.getPropertyValue("src");
356
- }
357
- };
358
- }
359
- }
360
- }
361
- Promise.resolve(t).then((o) => {
362
- const d = o.cloneNode(!0);
363
- return d.style.padding = "0px", d.style.paddingRight = s + "px", d.style.paddingTop = i + "px", d.style.left = "0px", d.style.top = "0px", d.style.width = e.$width - e.pad_left - e.pad_right + "px", d.style.height = e.$height - e.pad_top - e.pad_bottom + "px", t.hidden = a, d;
364
- }).then(b).then((o) => {
365
- o.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
366
- const d = new Image();
367
- return d.src = `data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="${String(e.$width)}px" height="${String(e.$height)}px"><foreignObject x="0" y="0" width="100%" height="100%">${new XMLSerializer().serializeToString(o).replaceAll("#", "%23").replaceAll(`
368
- `, "%0A")}</foreignObject></svg>`, new Promise((u) => {
369
- d.onload = () => u(d);
370
- });
371
- }).then((o) => new Promise((d) => setTimeout(() => d(o), 100))).then((o) => {
372
- const d = document.createElement("canvas");
373
- d.width = e.$width, d.height = e.$height, d.getContext("2d").drawImage(o, 0, 0), Q(ot.from(d));
374
- }).catch((o) => K.myTrace(`goTxt() = ${String(o)}`));
375
- }
376
- class c extends P {
377
- constructor(t, e, s) {
378
- super(), this.ctn = t, this.canFocus = e, this.sys = s, this.#e.classList.add("sn_tx"), this.#e.style.position = "absolute", c.#n.view.parentElement.appendChild(this.#e), this.addChild(this.#h), this.addChild(this.#p), this.#p.name = "grpDbgMasume";
379
- const i = T.debugLog ? ({ ch: a, rect: { x: n, y: l, width: h, height: r } }) => console.log(`🍌 masume ch:${a} x:${String(n)} y:${String(l)} w:${String(h)} h:${String(r)}`) : () => {
380
- };
381
- this.#g = c.#c.oCfg.debug.masume ? (a) => {
382
- i(a);
383
- const { x: n, y: l, width: h, height: r } = a.rect;
384
- this.#p.beginFill(6737151, 0.5).lineStyle(2, 16724736, 1).drawRect(n, l, h, r).endFill();
385
- } : () => {
386
- }, this.noticeCompTxt = s.isApp && c.#c.oCfg.debug.dumpHtm ? () => {
387
- I.notifyEndProc(A);
388
- const a = this.#e.innerHTML;
389
- if (a === "") return;
390
- const { fn: n, ln: l } = c.#a.nowScrFnLn(), h = `dumpHtm ${t.name.slice(0, -7).replaceAll(":", "=")}(fn=${n} line=${String(l)})`;
391
- s.outputFile(
392
- s.path_downloads + h + ".htm",
393
- `<!doctype html><html><head><meta charset=utf-8><title>${h}</title>
394
- <h1>${h}</h1>${a.replaceAll(/ class="sn_ch"|animation-delay: \d+ms; ?| data-add="{&quot;ch_in_style&quot;:&quot;default&quot;, &quot;ch_out_style&quot;:&quot;default&quot;}"/g, "").replaceAll(' style=""', "").replaceAll(/(<\/?ruby>)/g, `
395
- $1
396
- `).replaceAll(/<(br|\/span)>/g, `<$1>
397
- `)}`
398
- );
399
- } : () => I.notifyEndProc(A);
400
- }
401
- static #c;
402
- static #n;
403
- static init(t, e) {
404
- c.#c = t, c.#n = e, st.addGrp(c.grp);
405
- }
406
- static grp = new pt();
407
- static #r;
408
- static #a;
409
- static setEvtMng(t, e) {
410
- c.#r = t, c.#a = e;
411
- }
412
- static destroy() {
413
- c.#$ = /* @__PURE__ */ Object.create(null), c.#E = /* @__PURE__ */ Object.create(null), c.delBreak();
414
- }
415
- #e = document.createElement("span");
416
- // サンプリング元
417
- #h = new P();
418
- // サンプリング先
419
- #p = new B();
420
- static #k = {
421
- "background-color": 0,
422
- "border-bottom-width": 0,
423
- "border-left-width": 0,
424
- "border-right-width": 0,
425
- "border-top-width": 0,
426
- "margin-bottom": 0,
427
- "margin-left": 0,
428
- "margin-right": 0,
429
- "margin-top": 0
430
- };
431
- #l = new mt();
432
- noticeCompTxt = () => {
433
- };
434
- #g;
435
- // readonly #idc :TxtLayDesignCast;
436
- // readonly #idcCh = new TxtLayPadDesignCast(this);
437
- #t = {
438
- fontsize: 24,
439
- $width: 0,
440
- // レイヤサイズであり、背景色(画像)サイズ
441
- $height: 0,
442
- pad_left: 0,
443
- // paddingLeft(レイヤサイズの内側のスペーサー)
444
- pad_right: 0,
445
- // paddingRight
446
- pad_top: 0,
447
- // paddingTop
448
- pad_bottom: 0
449
- // paddingBottom
450
- };
451
- lay(t) {
452
- const e = this.#e.style;
453
- if ("style" in t)
454
- if (t.style) {
455
- const s = document.createElement("span");
456
- s.style.cssText = t.style;
457
- const i = s.style.length;
458
- for (let a = 0; a < i; ++a) {
459
- const n = s.style[a];
460
- if (n in c.#k) {
461
- K.myTrace(`${String(n)}は指定できません`, "W");
462
- continue;
463
- }
464
- e[n] = s.style[n];
465
- }
466
- !s.style.opacity && "alpha" in t && (e.opacity = String(this.ctn.alpha));
467
- } else this.#e.style.cssText = "";
468
- else "alpha" in t && (e.opacity = String(this.ctn.alpha));
469
- if ("width" in t && (e.width = String(t.width ?? "0") + "px"), "height" in t && (e.height = String(t.height ?? "0") + "px"), "pl" in t && (e.paddingLeft = String(t.pl ?? "0") + "px"), "pr" in t && (e.paddingRight = String(t.pr ?? "0") + "px"), "pt" in t && (e.paddingTop = String(t.pt ?? "0") + "px"), "pb" in t && (e.paddingBottom = String(t.pb ?? "0") + "px"), this.#l.lay(t), this.#_(), this.#o = this.ctn.position.x, e.transformOrigin = `${String(this.ctn.pivot.x)}px ${String(this.ctn.pivot.y)}px`, this.cvsResize(), e.display = this.ctn.visible ? "inline" : "none", ":redraw" in t && this.#y > 0) {
470
- const s = [
471
- this.#e.innerHTML.replaceAll(/(animation-delay: )\d+ms/g, "$10ms"),
472
- `<span class='sn_ch' data-add='{"ch_in_style":"default"}'>&emsp;</span>`
473
- ];
474
- this.#z(), this.goTxt(s, !0);
475
- }
476
- }
477
- // oxlint-disable-next-line no-unused-private-class-members
478
- #u = 0;
479
- // 「g」などで下が欠ける問題対策
480
- #_() {
481
- const t = this.#e.style, e = parseFloat(t.fontSize || "0");
482
- this.#t.fontsize = e, this.#t.pad_left = parseFloat(t.paddingLeft || "0"), this.#t.pad_right = parseFloat(t.paddingRight || "0"), this.#t.pad_top = parseFloat(t.paddingTop || "0"), this.#t.pad_bottom = parseFloat(t.paddingBottom || "0"), this.#t.$width = parseFloat(t.width || "0"), this.#t.$height = parseFloat(t.height || "0"), this.position.set(this.#t.pad_left, this.#t.pad_top), this.#f = t.writingMode === "vertical-rl", this.#i = 0, this.#b = 0;
483
- const s = t.lineHeight ?? "0";
484
- this.#u = this.#f ? 0 : (s.endsWith("px") ? parseFloat(s) : e * parseFloat(s) - e) / 2;
485
- }
486
- cvsResize() {
487
- const t = this.#e.style, e = this.sys.cvsScale;
488
- t.left = `${String(this.sys.ofsLeft4elm + this.#o * e)}px`, t.top = `${String(this.sys.ofsTop4elm + this.ctn.position.y * e)}px`, t.transform = `rotate(${String(this.ctn.angle)}deg) scale(${String(this.ctn.scale.x * e)}, ${String(this.ctn.scale.y * e)})`;
489
- }
490
- #o = 0;
491
- #f = !1;
492
- get tategaki() {
493
- return this.#f;
494
- }
495
- #i = 0;
496
- #b = 0;
497
- get infTL() {
498
- return this.#t;
499
- }
500
- get getWidth() {
501
- return this.#t.$width;
502
- }
503
- get getHeight() {
504
- return this.#t.$height;
505
- }
506
- setMySize(t, e) {
507
- this.#t.$width = t, this.#t.$height = e, this.#e.style.width = String(this.#t.$width) + "px", this.#e.style.height = String(this.#t.$height) + "px";
508
- }
509
- #s = [];
510
- // FIFO実行バッファ
511
- goTxt(t, e) {
512
- const s = () => this.#m(t, e);
513
- this.#s.push(s) === 1 && s();
514
- }
515
- #v = [];
516
- #y = 0;
517
- static #G = "<span class='sn_ch sn_ch_last'>&emsp;</span>";
518
- #m(t, e) {
519
- c.#O.visible = !1;
520
- let s = this.#v.length, i = "";
521
- if (s === 0) {
522
- if (c.#c.oCfg.debug.masume && (T.debugLog && console.log(`🍌 masume ${this.name} v:${String(this.visible)} l:${String(this.x)} t:${String(this.y)} a:${String(this.alpha)} pl:${String(this.#t.pad_left)} pr:${String(this.#t.pad_right)} pt:${String(this.#t.pad_top)} pb:${String(this.#t.pad_bottom)} w:${String(this.#t.$width)} h:${String(this.#t.$height)}`), this.#p.clear().beginFill(3407616, 0.2).lineStyle(1, 3407616, 1).drawRect(-this.#t.pad_left, -this.#t.pad_top, this.#t.$width, this.#t.$height).endFill().beginFill(13311, 0.2).lineStyle(2, 13311, 1).drawRect(
523
- 0,
524
- 0,
525
- this.#t.$width - this.#t.pad_left - this.#t.pad_right,
526
- this.#t.$height - this.#t.pad_top - this.#t.pad_bottom
527
- ).endFill()), this.#e.innerHTML = [...t].join("").replaceAll(/[\n\t]/g, "") + c.#G, !this.#l.break_fixed) {
528
- const g = globalThis.getComputedStyle(this.#e), $ = parseFloat(g.fontSize);
529
- this.#f ? (this.#l.break_fixed_left = (this.#t.$width - this.#t.pad_left - this.#t.pad_right - $ * 1.5) * this.sys.cvsScale, this.#l.break_fixed_top = 0) : (this.#l.break_fixed_left = 0, this.#l.break_fixed_top = $ / 2 * this.sys.cvsScale);
530
- }
531
- } else
532
- i = this.#e.innerHTML, --s, this.#e.getElementsByClassName("sn_ch_last").item(0)?.remove(), this.#e.querySelectorAll(":scope > br").forEach((g) => g.remove()), this.#e.insertAdjacentHTML(
533
- "beforeend",
534
- t.slice(this.#y).join("").replaceAll(/[\n\t]/g, "") + c.#G
535
- // 末尾改行削除挙動対策
536
- );
537
- this.#e.querySelectorAll(".sn_ch:has(> ruby)").forEach((g) => {
538
- g.style.background = "";
539
- }), this.#y = t.length;
540
- const a = this.sys.cvsScale, n = this.#e.getBoundingClientRect(), l = n.left + this.#t.pad_left, h = n.top + this.#t.pad_top;
541
- let r;
542
- if (a === 1) r = (g, $) => {
543
- const o = g.getBoundingClientRect();
544
- return new X(
545
- o.left - l,
546
- o.top - h,
547
- o.width,
548
- o.height + ("gjqy".includes($) ? this.#u : 0)
549
- );
550
- };
551
- else {
552
- const g = this.sys.ofsPadLeft_Dom2PIXI + n.left * (1 - a), $ = this.sys.ofsPadTop_Dom2PIXI + n.top * (1 - a);
553
- r = (o, d) => {
554
- const u = o.getBoundingClientRect();
555
- return new X(
556
- (u.left - g) / a - l,
557
- (u.top - $) / a - h,
558
- u.width / a,
559
- (u.height + ("gjqy".includes(d) ? this.#u : 0)) / a
560
- );
561
- };
562
- }
563
- const [b, y] = this.#l.hyph(this.#e, r, this.#f, s, i);
564
- this.#v = b;
565
- const w = st.ease(this.#C);
566
- for (let g = s; g < y; ++g) {
567
- const $ = this.#v[g], { elm: { dataset: o, parentElement: d }, rect: u } = $, m = JSON.parse(o.arg ?? '{"delay": 0}'), v = JSON.parse(o.add ?? "{}"), _ = c.#$[v.ch_in_style];
568
- if (this.#g($), o.cmd === "grp") {
569
- const f = new P();
570
- this.#h.addChild(f), new W(m.pic, f, (p) => {
571
- this.#B(f, m, v, u, w, _ ?? {}), f.parent || f.removeChild(p);
572
- });
573
- }
574
- if (o.lnk) {
575
- const f = d.closest("[data-arg]"), p = JSON.parse(f.dataset.arg ?? "{}");
576
- p.key = `lnk=[${String(g)}] ` + this.name;
577
- const E = new q();
578
- this.#B(E, p, v, u, w, _ ?? {});
579
- const j = p.style ?? "", R = j + (p.style_hover ?? ""), J = j + (p.style_clicked ?? ""), O = p.r_style ?? "", at = O + (p.r_style_hover ?? ""), ht = O + (p.r_style_clicked ?? ""), Z = Array.from(f.getElementsByTagName("rt"));
580
- for (const z of Z) z.dataset.st_r_bk = z.style.cssText;
581
- const lt = f.style.cssText, D = (z, rt) => {
582
- f.style.cssText = lt + z;
583
- for (const L of Z) L.style.cssText = L.dataset.st_r_bk + rt;
584
- };
585
- F(p, "enabled", !0) ? c.#r.button(
586
- p,
587
- E,
588
- () => D(j, O),
589
- () => this.canFocus() ? (D(R, at), !0) : !1,
590
- () => D(J, ht)
591
- ) : D(
592
- j + (p.style_disable ?? "color: gray;"),
593
- O + (p.r_style_disable ?? "color: gray;")
594
- ), this.#h.addChild(E);
595
- }
596
- }
597
- const C = Array.from(this.#e.getElementsByClassName("sn_ch_yet"));
598
- this.#S = () => {
599
- this.#S = () => !1;
600
- for (const $ of C) $.className = "sn_ch";
601
- c.#O.position.set(
602
- this.#l.break_fixed_left,
603
- this.#l.break_fixed_top
604
- ), c.#O.visible = !0, this.noticeCompTxt();
605
- const g = this.#s.shift();
606
- return this.#s.length > 0 && g(), !0;
607
- };
608
- for (const g of C) g.className = g.className.replace("sn_ch_yet sn", "go");
609
- s > 0 && ++s;
610
- let x;
611
- for (let g = y - 2; g >= 0; --g) {
612
- const { elm: $ } = this.#v[g];
613
- if ($.tagName === "SPAN") {
614
- x = $.parentElement?.tagName === "RUBY" ? $.parentElement.parentElement ?? $ : $;
615
- break;
616
- }
617
- }
618
- if (!x || e || s === y) {
619
- this.#S();
620
- return;
621
- }
622
- const N = () => {
623
- x.removeEventListener("animationend", N), this.#S();
624
- };
625
- x.addEventListener("animationend", N, { once: !0, signal: this.#N.signal });
626
- }
627
- #S = () => !1;
628
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
629
- #B(t, e, s, i, a, n) {
630
- t.alpha = 0, e.x && (i.x = e.x.startsWith("=") ? i.x + parseInt(e.x.slice(1)) : parseInt(e.x)), e.y && (i.y = e.y.startsWith("=") ? i.y + parseInt(e.y.slice(1)) : parseInt(e.y)), e.width && (i.width = parseInt(e.width)), e.height && (i.height = parseInt(e.height)), e.wait && (n.wait = e.wait), t.width = i.width, t.height = i.height, n.x ? t.position.set(
631
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
632
- n.x.startsWith("=") ? i.x + t.width * n.nx : n.nx,
633
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
634
- n.y.startsWith("=") ? i.y + t.height * n.ny : n.ny
635
- ) : t.position.set(i.x, i.y);
636
- const l = new ft(t).to({ alpha: 1, x: i.x, y: i.y, width: i.width, height: i.height, angle: 0 }, n.wait ?? 0).easing(a).delay((s.wait ?? 0) + (e.delay ?? 0)).onComplete(() => {
637
- h.tw = void 0;
638
- }).start();
639
- c.grp.add(l);
640
- const h = { sp: t, tw: l };
641
- this.#P.push(h);
642
- }
643
- #P = [];
644
- skipChIn() {
645
- let t = this.#S();
646
- for (const e of this.#P)
647
- e.tw && (e.tw.stop().end(), t = !0);
648
- return this.#P = [], t;
649
- }
650
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
651
- static #$ = /* @__PURE__ */ Object.create(null);
652
- static #W = /[{\s.,*{]/;
653
- // https://regex101.com/r/APC91I/1
654
- static initChStyle() {
655
- c.#$ = /* @__PURE__ */ Object.create(null), c.#E = /* @__PURE__ */ Object.create(null);
656
- }
657
- static getChInStyle(t) {
658
- return c.#$[t];
659
- }
660
- static ch_in_style(t) {
661
- const { name: e } = t;
662
- if (!e) throw "nameは必須です";
663
- if (c.#W.test(e)) throw `name【${e}】に使えない文字が含まれます`;
664
- if (e in c.#$) throw `name【${e}】はすでにあります`;
665
- const s = String(t.x ?? "=0"), i = String(t.y ?? "=0");
666
- return c.#$[e] = {
667
- wait: S(t, "wait", 500),
668
- // アニメ・FI時間
669
- alpha: S(t, "alpha", 0),
670
- x: s,
671
- // 初期x値
672
- y: i,
673
- // [tsy]と同様に絶対・相対指定可能
674
- // {x:500} X位置を500に
675
- // {x:'=500'} 現在のX位置に+500加算した位置
676
- // {x:'=-500'} 現在のX位置に-500加算した位置
677
- // {x:'250,500'} +250から+500までの間でランダムな値をX位置に
678
- // {x:'=250,500'} +250から+500までの間でランダムな値を現在のX位置に加算
679
- nx: parseFloat(s.at(0) === "=" ? s.slice(1) : s),
680
- ny: parseFloat(i.at(0) === "=" ? i.slice(1) : i),
681
- scale_x: S(t, "scale_x", 1),
682
- scale_y: S(t, "scale_y", 1),
683
- rotate: S(t, "rotate", 0),
684
- join: F(t, "join", !0),
685
- // 文字を順番に出すか(true)同時か(false)
686
- ease: t.ease ?? "ease-out"
687
- };
688
- }
689
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
690
- static #E = /* @__PURE__ */ Object.create(null);
691
- static getChOutStyle(t) {
692
- return c.#E[t];
693
- }
694
- static ch_out_style(t) {
695
- const { name: e } = t;
696
- if (!e) throw "nameは必須です";
697
- if (c.#W.test(e)) throw `name【${e}】に使えない文字が含まれます`;
698
- if (e in c.#E) throw `name【${e}】はすでにあります`;
699
- const s = String(t.x ?? "=0"), i = String(t.y ?? "=0");
700
- return c.#E[e] = {
701
- wait: S(t, "wait", 500),
702
- // アニメ・FI時間
703
- alpha: S(t, "alpha", 0),
704
- x: s,
705
- // 初期x値
706
- y: i,
707
- // [tsy]と同様に絶対・相対指定可能
708
- // {x:500} X位置を500に
709
- // {x:'=500'} 現在のX位置に+500加算した位置
710
- // {x:'=-500'} 現在のX位置に-500加算した位置
711
- // {x:'250,500'} +250から+500までの間でランダムな値をX位置に
712
- // {x:'=250,500'} +250から+500までの間でランダムな値を現在のX位置に加算
713
- nx: parseFloat(s.at(0) === "=" ? s.slice(1) : s),
714
- ny: parseFloat(i.at(0) === "=" ? i.slice(1) : i),
715
- scale_x: S(t, "scale_x", 1),
716
- scale_y: S(t, "scale_y", 1),
717
- rotate: S(t, "rotate", 0),
718
- join: F(t, "join", !1),
719
- // 文字を順番に出すか(true)同時か(false)
720
- ease: t.ease ?? "ease-out"
721
- };
722
- }
723
- static #O = new P();
724
- static #H = new W();
725
- dispBreak(t) {
726
- c.delBreak();
727
- const e = c.#O;
728
- e.visible = !1, this.addChild(e), c.#H.destroy(), c.#H = new W(t.pic, e, (s) => {
729
- e.parent ? (s.x = S(t, "x", 0), s.y = S(t, "y", 0), s.width = S(t, "width", this.#t.fontsize), s.height = S(t, "height", this.#t.fontsize)) : e.removeChild(s);
730
- });
731
- }
732
- static delBreak() {
733
- const t = c.#O;
734
- t.parent?.removeChild(t), c.#H.destroy();
735
- }
736
- #C = "Quadratic.Out";
737
- #R = "Quadratic.Out";
738
- #N = new AbortController();
739
- #z() {
740
- this.#p.clear(), this.#v = [], this.#y = 0, this.#s = [], this.#N.abort(), this.#N = new AbortController(), this.skipChIn();
741
- const t = document.createElement("span");
742
- t.style.cssText = this.#e.style.cssText, t.classList.value = this.#e.classList.value;
743
- const e = this.#e, s = Array.from(e.getElementsByClassName("sn_ch"));
744
- e.parentElement.insertBefore(t, e);
745
- let i = 0;
746
- s.forEach((n) => {
747
- const l = JSON.parse(
748
- n.dataset.add ?? // 通常文字
749
- n.children[0]?.getAttribute("data-add") ?? // ルビ
750
- n.children[0]?.children[0]?.getAttribute("data-add") ?? "{}"
751
- // 縦中横
752
- );
753
- if (!l.ch_out_style) return;
754
- const h = c.#E[l.ch_out_style];
755
- if (h) {
756
- if (h.wait === 0) {
757
- n.style.display = "none";
758
- return;
759
- }
760
- i += h.wait, h.join || (n.style.animationDelay = "0ms"), n.classList.add(`go_ch_out_${String(l.ch_out_style)}`);
761
- }
762
- });
763
- const a = () => {
764
- e.parentElement.removeChild(e);
765
- for (const n of this.#h.removeChildren())
766
- n instanceof P && c.#r.unButton(n), n.destroy();
767
- };
768
- if (i === 0)
769
- this.#e.textContent = "", this.#e = document.createElement("span"), a();
770
- else {
771
- const n = e.lastElementChild;
772
- if (n) {
773
- const l = () => {
774
- n.removeEventListener("animationend", l), a();
775
- };
776
- n.addEventListener("animationend", l, { once: !0, signal: this.#N.signal });
777
- } else a();
778
- }
779
- this.#e = t;
780
- }
781
- reNew() {
782
- this.#z();
783
- const t = new c(this.ctn, this.canFocus, this.sys);
784
- return t.#t = this.#t, t.#e.style.cssText = this.#e.style.cssText, t.#o = this.#o, t.name = this.name, t.#_(), t.#F = this.#F, t.#C = this.#C, t.#R = this.#R, this.#l.reNew(t.#l), this.destroy(), t;
785
- }
786
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
787
- #F = void 0;
788
- // 文字にかけるフィルター
789
- record() {
790
- return {
791
- infTL: this.#t,
792
- cssText: this.#e.style.cssText,
793
- left: this.#o,
794
- // idc_hArg : this.#idc.gethArg(),
795
- ch_filter: this.#F,
796
- fi_easing: this.#C,
797
- fo_easing: this.#R,
798
- hyph: this.#l.record()
799
- };
800
- }
801
- playback(t) {
802
- this.#t = t.infTL, this.position.set(this.#t.pad_left, this.#t.pad_top), this.#e.style.cssText = t.cssText, this.#o = t.left, this.#_(), this.#F = t.ch_filter, this.#C = t.fi_easing, this.#R = t.fo_easing, this.#l.playback(t.hyph);
803
- }
804
- get cssText() {
805
- return this.#e.style.cssText;
806
- }
807
- set cssText(t) {
808
- this.#e.style.cssText = t;
809
- }
810
- #d = void 0;
811
- snapshot(t, e) {
812
- bt((s) => {
813
- this.#d = q.from(s), this.#f && (this.#d.x += T.stageW - (this.#o + this.#t.$width)), this.#d.y -= this.#b, this.#d.texture.frame = new X(
814
- 0,
815
- 0,
816
- Math.min(this.#d.width, this.#t.$width - this.#o),
817
- Math.min(this.#d.height, this.#t.$height)
818
- ), this.#h.addChild(this.#d), t.render(this.#d, { clear: !1 }), e();
819
- }, this.#e, this.#t, this.#i, this.#b, !1);
820
- }
821
- snapshot_end() {
822
- this.#d && (this.#h.removeChild(this.#d), this.#d = void 0);
823
- }
824
- makeDesignCast(t) {
825
- }
826
- showDesignCast() {
827
- }
828
- // showDesignCast() {this.#idc.visible = true; this.#idcCh.visible = true}
829
- dump() {
830
- const t = [], e = this.#e.style, s = e.length;
831
- for (let i = 0; i < s; ++i) {
832
- const a = e[i];
833
- t.push(`"${String(a)}":"${e[a].replaceAll(/(["\\])/g, "\\$1")}"`);
834
- }
835
- return `"txt":"${this.#e.textContent.replaceAll(/(["\\])/g, "\\$1")}", "style":{${t.join(",")}}`;
836
- }
837
- destroy() {
838
- c.delBreak(), this.#e.parentElement.removeChild(this.#e), this.#e = document.createElement("span"), this.removeChild(this.#h), this.removeChild(this.#p), this.#p.clear(), this.#g = () => {
839
- }, this.#s = [], this.#v = [], this.#y = 0, this.#P = [], this.#N.abort(), this.#F = void 0, super.destroy();
840
- }
1
+ import { a as RPN_COMP_CHIN, c as argChk_Color, f as initStyle, g as uint, l as argChk_Num, o as addStyle, s as argChk_Boolean, t as CmnLib } from "./CmnLib.js";
2
+ import { f as Texture, h as Rectangle, m as Container, o as Sprite, s as Graphics } from "./pixi.js";
3
+ import "./EventListenerCtn.js";
4
+ import { n as SEARCH_PATH_ARG_EXT } from "./ConfigBase.js";
5
+ import { t as DebugMng } from "./DebugMng.js";
6
+ import { t as Layer } from "./Layer.js";
7
+ import { a as Group, o as Tween, r as CmnTween, t as Reading } from "./Reading.js";
8
+ import { t as SpritesMng } from "./SpritesMng.js";
9
+ import { Button } from "./Button.js";
10
+ import { t as RubySpliter } from "./RubySpliter.js";
11
+ var def行頭禁則 = "、。,.)]}〉」』】〕”〟ぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ!?!?‼⁉・ーゝゞヽヾ々", def行末禁則 = "[({〈「『【〔“〝", def分割禁止 = "─‥…", defぶら下げ = def行頭禁則, defReg行頭禁則 = /* @__PURE__ */ RegExp(`[${def行頭禁則}]`), defReg行末禁則 = /* @__PURE__ */ RegExp(`[${def行末禁則}]`), defReg分割禁止 = /* @__PURE__ */ RegExp(`[${def分割禁止}]`), defRegぶら下げ = defReg行頭禁則, Hyphenation = class {
12
+ #e = def行頭禁則;
13
+ #t = def行末禁則;
14
+ #n = def分割禁止;
15
+ #r = defぶら下げ;
16
+ get 行頭禁則() {
17
+ return this.#e;
18
+ }
19
+ get 行末禁則() {
20
+ return this.#t;
21
+ }
22
+ get 分割禁止() {
23
+ return this.#n;
24
+ }
25
+ get ぶら下げ() {
26
+ return this.#r;
27
+ }
28
+ #i = defReg行頭禁則;
29
+ #a = defReg行末禁則;
30
+ #o = defReg分割禁止;
31
+ #s = defRegぶら下げ;
32
+ break_fixed = !1;
33
+ break_fixed_left = 0;
34
+ break_fixed_top = 0;
35
+ bura = !1;
36
+ lay(e) {
37
+ e.kinsoku_sol && (this.#e = e.kinsoku_sol, this.#i = /* @__PURE__ */ RegExp(`[${this.#e}]`)), e.kinsoku_eol && (this.#t = e.kinsoku_eol, this.#c(), this.#a = /* @__PURE__ */ RegExp(`[${this.#t}]`)), e.kinsoku_dns && (this.#n = e.kinsoku_dns, this.#l(), this.#o = /* @__PURE__ */ RegExp(`[${this.#n}]`)), e.kinsoku_bura && (this.#r = e.kinsoku_bura, this.#c(), this.#l(), this.#s = /* @__PURE__ */ RegExp(`[${this.#r}]`)), "bura" in e && (this.bura = argChk_Boolean(e, "bura", !1)), this.break_fixed = argChk_Boolean(e, "break_fixed", this.break_fixed), this.break_fixed_left = argChk_Num(e, "break_fixed_left", this.break_fixed_left), this.break_fixed_top = argChk_Num(e, "break_fixed_top", this.break_fixed_top);
38
+ }
39
+ #c() {
40
+ let e = this.#t.length, p = this.#r.length;
41
+ if (e < p) for (let p = 0; p < e; ++p) {
42
+ let e = this.#t[p];
43
+ if (this.#r.includes(e)) throw `禁則の競合があります。文字 ${String(e)} がぶら下げ と 行末禁則 の両方に含まれます`;
44
+ }
45
+ else for (let e = 0; e < p; ++e) {
46
+ let p = this.#r[e];
47
+ if (this.#t.includes(p)) throw `禁則の競合があります。文字 ${String(p)} がぶら下げ と 行末禁則 の両方に含まれます`;
48
+ }
49
+ }
50
+ #l() {
51
+ let e = this.#n.length, p = this.#r.length;
52
+ if (e < p) for (let p = 0; p < e; ++p) {
53
+ let e = this.#n[p];
54
+ if (this.#r.includes(e)) throw `禁則の競合があります。文字 ${String(e)} がぶら下げ と 分割禁止 の両方に含まれます`;
55
+ }
56
+ else for (let e = 0; e < p; ++e) {
57
+ let p = this.#r[e];
58
+ if (this.#n.includes(p)) throw `禁則の競合があります。文字 ${String(p)} がぶら下げ 分割禁止 の両方に含まれます`;
59
+ }
60
+ }
61
+ reNew(e) {
62
+ e.#u(this.#e, this.#t, this.#n, this.#r), e.break_fixed = this.break_fixed, e.break_fixed_left = this.break_fixed_left, e.break_fixed_top = this.break_fixed_top, e.bura = this.bura;
63
+ }
64
+ #u(e, p, m, h) {
65
+ this.#e !== e && (this.#e = e, this.#i = /* @__PURE__ */ RegExp(`[${e}]`)), this.#t !== p && (this.#t = p, this.#a = /* @__PURE__ */ RegExp(`[${p}]`)), this.#n !== m && (this.#n = m, this.#o = /* @__PURE__ */ RegExp(`[${m}]`)), this.#r !== h && (this.#r = h, this.#s = /* @__PURE__ */ RegExp(`[${h}]`));
66
+ }
67
+ record() {
68
+ let e = {
69
+ break_fixed: this.break_fixed,
70
+ break_fixed_left: this.break_fixed_left,
71
+ break_fixed_top: this.break_fixed_top,
72
+ bura: this.bura
73
+ };
74
+ return this.#e === def行頭禁則 && (e.行頭禁則 = this.#e), this.#t === def行末禁則 && (e.行末禁則 = this.#t), this.#n === def分割禁止 && (e.分割禁止 = this.#n), this.#r === defぶら下げ && (e.ぶら下げ = this.#r), e;
75
+ }
76
+ playback(e) {
77
+ e && (this.#u(e.行頭禁則 ?? def行頭禁則, e.行末禁則 ?? def行末禁則, e.分割禁止 ?? def分割禁止, e.ぶら下げ ?? defぶら下げ), this.break_fixed = e.break_fixed, this.break_fixed_left = e.break_fixed_left, this.break_fixed_top = e.break_fixed_top, this.bura = e.bura);
78
+ }
79
+ hyph(e, p, m, h, g) {
80
+ let _, v = 0, y = 2, b = (p) => (b = () => !1, h === p ? (h > 0 && (e.innerHTML = g.replaceAll("class=\"sn_ch\"", "class=\"sn_ch sn_ch_in_default\"")), !0) : p < 2);
81
+ do {
82
+ if (_ = this.#f(e, p), v = _.length, b(v)) break;
83
+ let h = -Infinity;
84
+ for (; y < v; ++y) {
85
+ let { elm: e, rect: p, ch: g } = _[y];
86
+ if (e.tagName === "RT") continue;
87
+ let b = m ? p.y : p.x;
88
+ if (h <= b || e.previousElementSibling?.tagName === "SPAN" && e.previousElementSibling?.innerHTML.includes("<br>") || e.parentElement?.previousElementSibling?.tagName === "SPAN" && e.parentElement?.previousElementSibling?.innerHTML.includes("<br>")) {
89
+ h = b, this.break_fixed || (this.break_fixed_left = p.x, this.break_fixed_top = p.y);
90
+ continue;
91
+ }
92
+ let x = this.#d(_, y), { elm: S, rect: C, ch: w } = _[x];
93
+ if (!this.break_fixed) {
94
+ this.break_fixed_left = C.x, this.break_fixed_top = C.y;
95
+ let e = globalThis.getComputedStyle(S), p = parseFloat(e.fontSize);
96
+ m ? this.break_fixed_top += p : this.break_fixed_left += p;
97
+ }
98
+ h = -Infinity;
99
+ let T = y, { cont: E, ins: D } = this.bura ? this.hyph_alg_bura(_, x, w, y) : this.hyph_alg(_, x, w, y, g);
100
+ if (y = D, E) continue;
101
+ let O = _[y].elm, k = O.parentElement, A = document.createElement("br");
102
+ if (k.classList.contains("sn_tx")) k.insertBefore(A, O);
103
+ else {
104
+ let e = k.parentElement;
105
+ e.classList.contains("sn_ch") ? e.parentElement.insertBefore(A, e) : e.insertBefore(A, k);
106
+ }
107
+ y += 2, y < T && (y = T), v = -1;
108
+ break;
109
+ }
110
+ } while (v < 0);
111
+ return [_, v];
112
+ }
113
+ #d(e, p) {
114
+ let m = p - 1, { elm: h } = e[m];
115
+ return h.tagName === "RT" ? m - Array.from(h.textContent).length : m - (h.style.textCombineUpright === "all" ? Array.from(h.textContent).length - 1 : 0);
116
+ }
117
+ #f(e, p) {
118
+ let m = [];
119
+ if (e.nodeType !== e.TEXT_NODE) return Array.from(e.childNodes).map((e) => this.#f(e, p)).flat();
120
+ let h = e.ownerDocument.createRange();
121
+ h.selectNodeContents(e);
122
+ let g = 0, _ = h.endOffset;
123
+ for (; g < _;) {
124
+ h.setStart(e, g), h.setEnd(e, ++g);
125
+ let _ = h.toString();
126
+ m.push({
127
+ ch: _,
128
+ rect: p(h, _),
129
+ elm: h.startContainer.parentElement
130
+ });
131
+ }
132
+ return h.detach(), m;
133
+ }
134
+ hyph_alg(e, p, m, h, g) {
135
+ let _ = h;
136
+ if (!this.#a.test(m)) {
137
+ if (this.#i.test(g)) for (; (_ = this.#d(e, _)) >= 0 && this.#i.test(e[_].ch););
138
+ else if (!(m === g && this.#o.test(m))) return {
139
+ cont: !0,
140
+ ins: _ + 1
141
+ };
142
+ }
143
+ for (_ = p; (_ = this.#d(e, _)) >= 0 && this.#a.test(e[_].ch););
144
+ return {
145
+ cont: !1,
146
+ ins: _ + 1
147
+ };
148
+ }
149
+ hyph_alg_bura(e, p, m, h) {
150
+ let g = this.#d(e, p), { ch: _ } = e[g];
151
+ if (this.#s.test(_) || this.#i.test(_)) {
152
+ let h = p;
153
+ (this.#s.test(m) || this.#i.test(m)) && ++h;
154
+ let g = this.#d(e, h), { ch: _ } = e[g], { ch: v } = e[h];
155
+ if (_ === v && this.#o.test(v)) return {
156
+ cont: !1,
157
+ ins: g
158
+ };
159
+ if (!this.#a.test(_)) return {
160
+ cont: !1,
161
+ ins: h
162
+ };
163
+ h = g;
164
+ do
165
+ if (!this.#a.test(e[h].ch)) break;
166
+ while ((h = this.#d(e, h)) >= 0);
167
+ return {
168
+ cont: !1,
169
+ ins: h + 1
170
+ };
171
+ }
172
+ let v = this.#d(e, g);
173
+ if (h >= 3) {
174
+ let { ch: p } = e[v];
175
+ if (this.#o.test(_) && p === _) return {
176
+ cont: !1,
177
+ ins: v
178
+ };
179
+ if (this.#a.test(p)) {
180
+ let p = v;
181
+ for (; (p = this.#d(e, p)) >= 0 && this.#a.test(e[p].ch););
182
+ return {
183
+ cont: !1,
184
+ ins: p + 1
185
+ };
186
+ }
187
+ }
188
+ return {
189
+ cont: !1,
190
+ ins: g
191
+ };
192
+ }
193
+ };
194
+ function htm2tx(e, p, m, h, g, _ = !0) {
195
+ let v = {
196
+ escape: (e) => e.replaceAll(/([.*+?^${}()|[\]/\\])/g, "\\$1"),
197
+ mimeType: (e) => {
198
+ let p = w(e).toLowerCase();
199
+ return y()[p] || "";
200
+ },
201
+ dataAsUrl: k,
202
+ isDataUrl: T,
203
+ resolveUrl: D,
204
+ getAndEncode: O,
205
+ asArray: (e) => {
206
+ let p = [], m = e.length;
207
+ for (let h = 0; h < m; ++h) p.push(e[h]);
208
+ return p;
209
+ }
210
+ };
211
+ function y() {
212
+ let e = "application/font-woff", p = "image/jpeg";
213
+ return {
214
+ woff: e,
215
+ woff2: e,
216
+ ttf: "application/font-truetype",
217
+ eot: "application/vnd.ms-fontobject",
218
+ png: "image/png",
219
+ jpg: p,
220
+ jpeg: p,
221
+ gif: "image/gif",
222
+ tiff: "image/tiff",
223
+ svg: "image/svg+xml"
224
+ };
225
+ }
226
+ let x = A(), S = j();
227
+ function C(e) {
228
+ return S.resolveAll().then((p) => {
229
+ let m = document.createElement("style");
230
+ return e.appendChild(m), m.appendChild(document.createTextNode(p)), e;
231
+ });
232
+ }
233
+ function w(e) {
234
+ return /\.([^./]*?)$/g.exec(e)?.[1] ?? "";
235
+ }
236
+ function T(e) {
237
+ return e.search(/^(data:)/) !== -1;
238
+ }
239
+ function D(e, p) {
240
+ let m = document.implementation.createHTMLDocument(), h = m.createElement("base");
241
+ m.head.appendChild(h);
242
+ let g = m.createElement("a");
243
+ return m.body.appendChild(g), h.href = p, g.href = e, g.href;
244
+ }
245
+ function O(e) {
246
+ let p = 3e4;
247
+ return new Promise(function(m) {
248
+ let h = new XMLHttpRequest();
249
+ h.onreadystatechange = g, h.ontimeout = _, h.responseType = "blob", h.timeout = p, h.open("GET", e, !0), h.send();
250
+ function g() {
251
+ if (h.readyState !== 4) return;
252
+ if (h.status !== 200) {
253
+ v("cannot fetch resource: " + e + ", status: " + h.status);
254
+ return;
255
+ }
256
+ let p = new FileReader();
257
+ p.onloadend = function() {
258
+ let e = p.result.toString().split(/,/)[1];
259
+ m(e);
260
+ }, p.readAsDataURL(h.response);
261
+ }
262
+ function _() {
263
+ v("timeout of " + p + "ms occured while fetching resource: " + e);
264
+ }
265
+ function v(e) {
266
+ console.error(e), m("");
267
+ }
268
+ });
269
+ }
270
+ function k(e, p) {
271
+ return "data:" + p + ";base64," + e;
272
+ }
273
+ function A() {
274
+ let e = /url\(['"]?([^'"]+?)['"]?\)/g;
275
+ return {
276
+ inlineAll: g,
277
+ shouldProcess: p
278
+ };
279
+ function p(p) {
280
+ return p.search(e) !== -1;
281
+ }
282
+ function m(p) {
283
+ let m = [], h;
284
+ for (; h = e.exec(p);) m.push(h[1]);
285
+ return m.filter(function(e) {
286
+ return !v.isDataUrl(e);
287
+ });
288
+ }
289
+ function h(e, p, m, h) {
290
+ return Promise.resolve(p).then((e) => m ? v.resolveUrl(e, m) : e).then(h || v.getAndEncode).then((e) => v.dataAsUrl(e, v.mimeType(p))).then((m) => e.replace(g(p), "$1" + m + "$3"));
291
+ function g(e) {
292
+ return RegExp("(url\\(['\"]?)(" + v.escape(e) + ")(['\"]?\\))", "g");
293
+ }
294
+ }
295
+ function g(e, g, _) {
296
+ if (v()) return Promise.resolve(e);
297
+ return Promise.resolve(e).then(m).then((p) => {
298
+ let m = Promise.resolve(e);
299
+ for (let e of p) m = m.then((p) => h(p, e, g, _));
300
+ return m;
301
+ });
302
+ function v() {
303
+ return !p(e);
304
+ }
305
+ }
306
+ }
307
+ function j() {
308
+ return {
309
+ resolveAll: e,
310
+ impl: { readAll: p }
311
+ };
312
+ function e() {
313
+ return p().then((e) => Promise.allSettled(e.map((e) => e.resolve()))).then((e) => e.join("\n"));
314
+ }
315
+ function p() {
316
+ return Promise.resolve(v.asArray(document.styleSheets)).then(p).then(e).then((e) => e.map(m));
317
+ function e(e) {
318
+ return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => x.shouldProcess(e.style.getPropertyValue("src")));
319
+ }
320
+ function p(e) {
321
+ let p = [];
322
+ for (let m of e) try {
323
+ if (m.href) continue;
324
+ v.asArray(m.cssRules || []).forEach(p.push.bind(p));
325
+ } catch (e) {
326
+ console.error("Error while reading CSS rules from " + m.href, String(e));
327
+ }
328
+ return p;
329
+ }
330
+ function m(e) {
331
+ return {
332
+ resolve: function() {
333
+ let p = (e.parentStyleSheet || {}).href;
334
+ return x.inlineAll(e.cssText, p);
335
+ },
336
+ src() {
337
+ return e.style.getPropertyValue("src");
338
+ }
339
+ };
340
+ }
341
+ }
342
+ }
343
+ Promise.resolve(p).then((e) => {
344
+ let v = e.cloneNode(!0);
345
+ return v.style.padding = "0px", v.style.paddingRight = h + "px", v.style.paddingTop = g + "px", v.style.left = "0px", v.style.top = "0px", v.style.width = m.$width - m.pad_left - m.pad_right + "px", v.style.height = m.$height - m.pad_top - m.pad_bottom + "px", p.hidden = _, v;
346
+ }).then(C).then((e) => {
347
+ e.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
348
+ let p = new Image();
349
+ return p.src = `data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="${String(m.$width)}px" height="${String(m.$height)}px"><foreignObject x="0" y="0" width="100%" height="100%">${new XMLSerializer().serializeToString(e).replaceAll("#", "%23").replaceAll("\n", "%0A")}</foreignObject></svg>`, new Promise((e) => {
350
+ p.onload = () => e(p);
351
+ });
352
+ }).then((e) => new Promise((p) => setTimeout(() => p(e), 100))).then((p) => {
353
+ let h = document.createElement("canvas");
354
+ h.width = m.$width, h.height = m.$height, h.getContext("2d").drawImage(p, 0, 0), e(Texture.from(h));
355
+ }).catch((e) => DebugMng.myTrace(`goTxt() = ${String(e)}`));
841
356
  }
842
- class k extends tt {
843
- static #c;
844
- static #n;
845
- static #r;
846
- static #a;
847
- static init(t, e, s, i, a, n) {
848
- this.#c = t, c.init(t, n), this.#n = s, this.#a = i, this.#r = a, s.setDoRecProc((l) => this.chgDoRec(l)), e.autowc = (l) => this.#u(l), e.autowc({ enabled: !1, text: "", time: 0 }), e.ch_in_style = (l) => this.#e(l), e.ch_out_style = (l) => this.#h(l), c.initChStyle(), ct(), V(
849
- t.matchPath(".+", et.FONT).flatMap((l) => Object.values(l).map((h) => `
357
+ var TxtStage = class p extends Container {
358
+ static #e;
359
+ static #t;
360
+ static init(e, m) {
361
+ p.#e = e, p.#t = m, CmnTween.addGrp(p.grp);
362
+ }
363
+ static grp = new Group();
364
+ static #n;
365
+ static #r;
366
+ static setEvtMng(e, m) {
367
+ p.#n = e, p.#r = m;
368
+ }
369
+ static destroy() {
370
+ p.grp.removeAll(), p.#T = Object.create(null), p.#D = Object.create(null), p.delBreak();
371
+ }
372
+ #i = document.createElement("span");
373
+ #a = new Container();
374
+ #o = new Graphics();
375
+ static #s = {
376
+ "background-color": 0,
377
+ "border-bottom-width": 0,
378
+ "border-left-width": 0,
379
+ "border-right-width": 0,
380
+ "border-top-width": 0,
381
+ "margin-bottom": 0,
382
+ "margin-left": 0,
383
+ "margin-right": 0,
384
+ "margin-top": 0
385
+ };
386
+ #c = new Hyphenation();
387
+ noticeCompTxt = () => {};
388
+ #l;
389
+ constructor(m, h, g) {
390
+ super(), this.ctn = m, this.canFocus = h, this.sys = g, this.#i.classList.add("sn_tx"), this.#i.style.position = "absolute", p.#t.view.parentElement.appendChild(this.#i), this.addChild(this.#a), this.addChild(this.#o), this.#o.name = "grpDbgMasume";
391
+ let _ = CmnLib.debugLog ? ({ ch: e, rect: { x: p, y: m, width: h, height: g } }) => console.log(`🍌 masume ch:${e} x:${String(p)} y:${String(m)} w:${String(h)} h:${String(g)}`) : () => {};
392
+ this.#l = p.#e.oCfg.debug.masume ? (e) => {
393
+ _(e);
394
+ let { x: p, y: m, width: h, height: g } = e.rect;
395
+ this.#o.beginFill(6737151, .5).lineStyle(2, 16724736, 1).drawRect(p, m, h, g).endFill();
396
+ } : () => {}, this.noticeCompTxt = g.isApp && p.#e.oCfg.debug.dumpHtm ? () => {
397
+ Reading.notifyEndProc(RPN_COMP_CHIN);
398
+ let h = this.#i.innerHTML;
399
+ if (h === "") return;
400
+ let { fn: _, ln: v } = p.#r.nowScrFnLn(), y = `dumpHtm ${m.name.slice(0, -7).replaceAll(":", "=")}(fn=${_} line=${String(v)})`;
401
+ g.outputFile(g.path_downloads + y + ".htm", `<!doctype html><html><head><meta charset=utf-8><title>${y}</title>
402
+ <h1>${y}</h1>${h.replaceAll(/ class="sn_ch"|animation-delay: \d+ms; ?| data-add="{&quot;ch_in_style&quot;:&quot;default&quot;, &quot;ch_out_style&quot;:&quot;default&quot;}"/g, "").replaceAll(" style=\"\"", "").replaceAll(/(<\/?ruby>)/g, "\n$1\n").replaceAll(/<(br|\/span)>/g, "<$1>\n")}`);
403
+ } : () => Reading.notifyEndProc(RPN_COMP_CHIN);
404
+ }
405
+ #u = {
406
+ fontsize: 24,
407
+ $width: 0,
408
+ $height: 0,
409
+ pad_left: 0,
410
+ pad_right: 0,
411
+ pad_top: 0,
412
+ pad_bottom: 0
413
+ };
414
+ lay(e) {
415
+ let m = this.#i.style;
416
+ if ("style" in e) if (e.style) {
417
+ let h = document.createElement("span");
418
+ h.style.cssText = e.style;
419
+ let g = h.style.length;
420
+ for (let e = 0; e < g; ++e) {
421
+ let g = h.style[e];
422
+ if (g in p.#s) {
423
+ DebugMng.myTrace(`${String(g)}は指定できません`, "W");
424
+ continue;
425
+ }
426
+ m[g] = h.style[g];
427
+ }
428
+ !h.style.opacity && "alpha" in e && (m.opacity = String(this.ctn.alpha));
429
+ } else this.#i.style.cssText = "";
430
+ else "alpha" in e && (m.opacity = String(this.ctn.alpha));
431
+ if ("width" in e && (m.width = String(e.width ?? "0") + "px"), "height" in e && (m.height = String(e.height ?? "0") + "px"), "pl" in e && (m.paddingLeft = String(e.pl ?? "0") + "px"), "pr" in e && (m.paddingRight = String(e.pr ?? "0") + "px"), "pt" in e && (m.paddingTop = String(e.pt ?? "0") + "px"), "pb" in e && (m.paddingBottom = String(e.pb ?? "0") + "px"), this.#c.lay(e), this.#f(), this.#p = this.ctn.position.x, m.transformOrigin = `${String(this.ctn.pivot.x)}px ${String(this.ctn.pivot.y)}px`, this.cvsResize(), m.display = this.ctn.visible ? "inline" : "none", ":redraw" in e && this.#y > 0) {
432
+ let e = [this.#i.innerHTML.replaceAll(/(animation-delay: )\d+ms/g, "$10ms"), "<span class='sn_ch' data-add='{\"ch_in_style\":\"default\"}'>&emsp;</span>"];
433
+ this.#N(), this.goTxt(e, !0);
434
+ }
435
+ }
436
+ #d = 0;
437
+ #f() {
438
+ let e = this.#i.style, p = parseFloat(e.fontSize || "0");
439
+ this.#u.fontsize = p, this.#u.pad_left = parseFloat(e.paddingLeft || "0"), this.#u.pad_right = parseFloat(e.paddingRight || "0"), this.#u.pad_top = parseFloat(e.paddingTop || "0"), this.#u.pad_bottom = parseFloat(e.paddingBottom || "0"), this.#u.$width = parseFloat(e.width || "0"), this.#u.$height = parseFloat(e.height || "0"), this.position.set(this.#u.pad_left, this.#u.pad_top), this.#m = e.writingMode === "vertical-rl", this.#h = 0, this.#g = 0;
440
+ let m = e.lineHeight ?? "0";
441
+ this.#d = this.#m ? 0 : (m.endsWith("px") ? parseFloat(m) : p * parseFloat(m) - p) / 2;
442
+ }
443
+ cvsResize() {
444
+ let e = this.#i.style, p = this.sys.cvsScale;
445
+ e.left = `${String(this.sys.ofsLeft4elm + this.#p * p)}px`, e.top = `${String(this.sys.ofsTop4elm + this.ctn.position.y * p)}px`, e.transform = `rotate(${String(this.ctn.angle)}deg) scale(${String(this.ctn.scale.x * p)}, ${String(this.ctn.scale.y * p)})`;
446
+ }
447
+ #p = 0;
448
+ #m = !1;
449
+ get tategaki() {
450
+ return this.#m;
451
+ }
452
+ #h = 0;
453
+ #g = 0;
454
+ get infTL() {
455
+ return this.#u;
456
+ }
457
+ get getWidth() {
458
+ return this.#u.$width;
459
+ }
460
+ get getHeight() {
461
+ return this.#u.$height;
462
+ }
463
+ setMySize(e, p) {
464
+ this.#u.$width = e, this.#u.$height = p, this.#i.style.width = String(this.#u.$width) + "px", this.#i.style.height = String(this.#u.$height) + "px";
465
+ }
466
+ #_ = [];
467
+ goTxt(e, p) {
468
+ let m = () => this.#x(e, p);
469
+ this.#_.push(m) === 1 && m();
470
+ }
471
+ #v = [];
472
+ #y = 0;
473
+ static #b = "<span class='sn_ch sn_ch_last'>&emsp;</span>";
474
+ #x(e, m) {
475
+ p.#O.visible = !1;
476
+ let h = this.#v.length, g = "";
477
+ if (h === 0) {
478
+ if (p.#e.oCfg.debug.masume && (CmnLib.debugLog && console.log(`🍌 masume ${this.name} v:${String(this.visible)} l:${String(this.x)} t:${String(this.y)} a:${String(this.alpha)} pl:${String(this.#u.pad_left)} pr:${String(this.#u.pad_right)} pt:${String(this.#u.pad_top)} pb:${String(this.#u.pad_bottom)} w:${String(this.#u.$width)} h:${String(this.#u.$height)}`), this.#o.clear().beginFill(3407616, .2).lineStyle(1, 3407616, 1).drawRect(-this.#u.pad_left, -this.#u.pad_top, this.#u.$width, this.#u.$height).endFill().beginFill(13311, .2).lineStyle(2, 13311, 1).drawRect(0, 0, this.#u.$width - this.#u.pad_left - this.#u.pad_right, this.#u.$height - this.#u.pad_top - this.#u.pad_bottom).endFill()), this.#i.innerHTML = [...e].join("").replaceAll(/[\n\t]/g, "") + p.#b, !this.#c.break_fixed) {
479
+ let e = globalThis.getComputedStyle(this.#i), p = parseFloat(e.fontSize);
480
+ this.#m ? (this.#c.break_fixed_left = (this.#u.$width - this.#u.pad_left - this.#u.pad_right - p * 1.5) * this.sys.cvsScale, this.#c.break_fixed_top = 0) : (this.#c.break_fixed_left = 0, this.#c.break_fixed_top = p / 2 * this.sys.cvsScale);
481
+ }
482
+ } else g = this.#i.innerHTML, --h, this.#i.getElementsByClassName("sn_ch_last").item(0)?.remove(), this.#i.querySelectorAll(":scope > br").forEach((e) => e.remove()), this.#i.insertAdjacentHTML("beforeend", e.slice(this.#y).join("").replaceAll(/[\n\t]/g, "") + p.#b);
483
+ this.#i.querySelectorAll(".sn_ch:has(> ruby)").forEach((e) => {
484
+ e.style.background = "";
485
+ }), this.#y = e.length;
486
+ let _ = this.sys.cvsScale, b = this.#i.getBoundingClientRect(), w = b.left + this.#u.pad_left, T = b.top + this.#u.pad_top, E;
487
+ if (_ === 1) E = (e, p) => {
488
+ let m = e.getBoundingClientRect();
489
+ return new Rectangle(m.left - w, m.top - T, m.width, m.height + ("gjqy".includes(p) ? this.#d : 0));
490
+ };
491
+ else {
492
+ let e = this.sys.ofsPadLeft_Dom2PIXI + b.left * (1 - _), p = this.sys.ofsPadTop_Dom2PIXI + b.top * (1 - _);
493
+ E = (m, h) => {
494
+ let g = m.getBoundingClientRect();
495
+ return new Rectangle((g.left - e) / _ - w, (g.top - p) / _ - T, g.width / _, (g.height + ("gjqy".includes(h) ? this.#d : 0)) / _);
496
+ };
497
+ }
498
+ let [D, O] = this.#c.hyph(this.#i, E, this.#m, h, g);
499
+ this.#v = D;
500
+ let k = CmnTween.ease(this.#A);
501
+ for (let e = h; e < O; ++e) {
502
+ let m = this.#v[e], { elm: { dataset: h, parentElement: g }, rect: _ } = m, y = JSON.parse(h.arg ?? "{\"delay\": 0}"), b = JSON.parse(h.add ?? "{}"), x = p.#T[b.ch_in_style];
503
+ if (this.#l(m), h.cmd === "grp") {
504
+ let e = new Container();
505
+ this.#a.addChild(e), new SpritesMng(y.pic, e, (p) => {
506
+ this.#C(e, y, b, _, k, x ?? {}), e.parent || e.removeChild(p);
507
+ });
508
+ }
509
+ if (h.lnk) {
510
+ let m = g.closest("[data-arg]"), h = JSON.parse(m.dataset.arg ?? "{}");
511
+ h.key = `lnk=[${String(e)}] ` + this.name;
512
+ let y = new Sprite();
513
+ this.#C(y, h, b, _, k, x ?? {});
514
+ let S = h.style ?? "", w = S + (h.style_hover ?? ""), T = S + (h.style_clicked ?? ""), E = h.r_style ?? "", D = E + (h.r_style_hover ?? ""), O = E + (h.r_style_clicked ?? ""), A = Array.from(m.getElementsByTagName("rt"));
515
+ for (let e of A) e.dataset.st_r_bk = e.style.cssText;
516
+ let j = m.style.cssText, M = (e, p) => {
517
+ m.style.cssText = j + e;
518
+ for (let e of A) e.style.cssText = e.dataset.st_r_bk + p;
519
+ };
520
+ argChk_Boolean(h, "enabled", !0) ? p.#n.button(h, y, () => M(S, E), () => this.canFocus() ? (M(w, D), !0) : !1, () => M(T, O)) : M(S + (h.style_disable ?? "color: gray;"), E + (h.r_style_disable ?? "color: gray;")), this.#a.addChild(y);
521
+ }
522
+ }
523
+ let j = Array.from(this.#i.getElementsByClassName("sn_ch_yet"));
524
+ this.#S = () => {
525
+ this.#S = () => !1;
526
+ for (let e of j) e.className = "sn_ch";
527
+ p.#O.position.set(this.#c.break_fixed_left, this.#c.break_fixed_top), p.#O.visible = !0, this.noticeCompTxt();
528
+ let e = this.#_.shift();
529
+ return this.#_.length > 0 && e(), !0;
530
+ };
531
+ for (let e of j) e.className = e.className.replace("sn_ch_yet sn", "go");
532
+ h > 0 && ++h;
533
+ let N;
534
+ for (let e = O - 2; e >= 0; --e) {
535
+ let { elm: p } = this.#v[e];
536
+ if (p.tagName === "SPAN") {
537
+ N = p.parentElement?.tagName === "RUBY" ? p.parentElement.parentElement ?? p : p;
538
+ break;
539
+ }
540
+ }
541
+ if (!N || m || h === O) {
542
+ this.#S();
543
+ return;
544
+ }
545
+ let P = () => {
546
+ N.removeEventListener("animationend", P), this.#S();
547
+ };
548
+ N.addEventListener("animationend", P, {
549
+ once: !0,
550
+ signal: this.#M.signal
551
+ });
552
+ }
553
+ #S = () => !1;
554
+ #C(e, m, h, g, _, v) {
555
+ e.alpha = 0, m.x && (g.x = m.x.startsWith("=") ? g.x + parseInt(m.x.slice(1)) : parseInt(m.x)), m.y && (g.y = m.y.startsWith("=") ? g.y + parseInt(m.y.slice(1)) : parseInt(m.y)), m.width && (g.width = parseInt(m.width)), m.height && (g.height = parseInt(m.height)), m.wait && (v.wait = m.wait), e.width = g.width, e.height = g.height, v.x ? e.position.set(v.x.startsWith("=") ? g.x + e.width * v.nx : v.nx, v.y.startsWith("=") ? g.y + e.height * v.ny : v.ny) : e.position.set(g.x, g.y);
556
+ let y = new Tween(e).to({
557
+ alpha: 1,
558
+ x: g.x,
559
+ y: g.y,
560
+ width: g.width,
561
+ height: g.height,
562
+ angle: 0
563
+ }, v.wait ?? 0).easing(_).delay((h.wait ?? 0) + (m.delay ?? 0)).onComplete(() => {
564
+ b.tw = void 0;
565
+ }).start();
566
+ p.grp.add(y);
567
+ let b = {
568
+ sp: e,
569
+ tw: y
570
+ };
571
+ this.#w.push(b);
572
+ }
573
+ #w = [];
574
+ skipChIn() {
575
+ let e = this.#S();
576
+ for (let p of this.#w) p.tw && (p.tw.stop().end(), e = !0);
577
+ return this.#w = [], e;
578
+ }
579
+ static #T = Object.create(null);
580
+ static #E = /[{\s.,*{]/;
581
+ static initChStyle() {
582
+ p.#T = Object.create(null), p.#D = Object.create(null);
583
+ }
584
+ static getChInStyle(e) {
585
+ return p.#T[e];
586
+ }
587
+ static ch_in_style(e) {
588
+ let { name: m } = e;
589
+ if (!m) throw "nameは必須です";
590
+ if (p.#E.test(m)) throw `name【${m}】に使えない文字が含まれます`;
591
+ if (m in p.#T) throw `name【${m}】はすでにあります`;
592
+ let h = String(e.x ?? "=0"), _ = String(e.y ?? "=0");
593
+ return p.#T[m] = {
594
+ wait: argChk_Num(e, "wait", 500),
595
+ alpha: argChk_Num(e, "alpha", 0),
596
+ x: h,
597
+ y: _,
598
+ nx: parseFloat(h.at(0) === "=" ? h.slice(1) : h),
599
+ ny: parseFloat(_.at(0) === "=" ? _.slice(1) : _),
600
+ scale_x: argChk_Num(e, "scale_x", 1),
601
+ scale_y: argChk_Num(e, "scale_y", 1),
602
+ rotate: argChk_Num(e, "rotate", 0),
603
+ join: argChk_Boolean(e, "join", !0),
604
+ ease: e.ease ?? "ease-out"
605
+ };
606
+ }
607
+ static #D = Object.create(null);
608
+ static getChOutStyle(e) {
609
+ return p.#D[e];
610
+ }
611
+ static ch_out_style(e) {
612
+ let { name: m } = e;
613
+ if (!m) throw "nameは必須です";
614
+ if (p.#E.test(m)) throw `name【${m}】に使えない文字が含まれます`;
615
+ if (m in p.#D) throw `name【${m}】はすでにあります`;
616
+ let h = String(e.x ?? "=0"), _ = String(e.y ?? "=0");
617
+ return p.#D[m] = {
618
+ wait: argChk_Num(e, "wait", 500),
619
+ alpha: argChk_Num(e, "alpha", 0),
620
+ x: h,
621
+ y: _,
622
+ nx: parseFloat(h.at(0) === "=" ? h.slice(1) : h),
623
+ ny: parseFloat(_.at(0) === "=" ? _.slice(1) : _),
624
+ scale_x: argChk_Num(e, "scale_x", 1),
625
+ scale_y: argChk_Num(e, "scale_y", 1),
626
+ rotate: argChk_Num(e, "rotate", 0),
627
+ join: argChk_Boolean(e, "join", !1),
628
+ ease: e.ease ?? "ease-out"
629
+ };
630
+ }
631
+ static #O = new Container();
632
+ static #k = new SpritesMng();
633
+ dispBreak(e) {
634
+ p.delBreak();
635
+ let m = p.#O;
636
+ m.visible = !1, this.addChild(m), p.#k.destroy(), p.#k = new SpritesMng(e.pic, m, (p) => {
637
+ m.parent ? (p.x = argChk_Num(e, "x", 0), p.y = argChk_Num(e, "y", 0), p.width = argChk_Num(e, "width", this.#u.fontsize), p.height = argChk_Num(e, "height", this.#u.fontsize)) : m.removeChild(p);
638
+ });
639
+ }
640
+ static delBreak() {
641
+ let e = p.#O;
642
+ e.parent?.removeChild(e), p.#k.destroy();
643
+ }
644
+ #A = "Quadratic.Out";
645
+ #j = "Quadratic.Out";
646
+ #M = new AbortController();
647
+ #N() {
648
+ this.#o.clear(), this.#v = [], this.#y = 0, this.#_ = [], this.#M.abort(), this.#M = new AbortController(), this.skipChIn();
649
+ let e = document.createElement("span");
650
+ e.style.cssText = this.#i.style.cssText, e.classList.value = this.#i.classList.value;
651
+ let m = this.#i, h = Array.from(m.getElementsByClassName("sn_ch"));
652
+ m.parentElement.insertBefore(e, m);
653
+ let g = 0;
654
+ h.forEach((e) => {
655
+ let m = JSON.parse(e.dataset.add ?? e.children[0]?.getAttribute("data-add") ?? e.children[0]?.children[0]?.getAttribute("data-add") ?? "{}");
656
+ if (!m.ch_out_style) return;
657
+ let h = p.#D[m.ch_out_style];
658
+ if (h) {
659
+ if (h.wait === 0) {
660
+ e.style.display = "none";
661
+ return;
662
+ }
663
+ g += h.wait, h.join || (e.style.animationDelay = "0ms"), e.classList.add(`go_ch_out_${String(m.ch_out_style)}`);
664
+ }
665
+ });
666
+ let _ = () => {
667
+ m.parentElement.removeChild(m);
668
+ for (let e of this.#a.removeChildren()) e instanceof Container && p.#n.unButton(e), e.destroy();
669
+ };
670
+ if (g === 0) this.#i.textContent = "", this.#i = document.createElement("span"), _();
671
+ else {
672
+ let e = m.lastElementChild;
673
+ if (e) {
674
+ let p = () => {
675
+ e.removeEventListener("animationend", p), _();
676
+ };
677
+ e.addEventListener("animationend", p, {
678
+ once: !0,
679
+ signal: this.#M.signal
680
+ });
681
+ } else _();
682
+ }
683
+ this.#i = e;
684
+ }
685
+ reNew() {
686
+ this.#N();
687
+ let e = new p(this.ctn, this.canFocus, this.sys);
688
+ return e.#u = this.#u, e.#i.style.cssText = this.#i.style.cssText, e.#p = this.#p, e.name = this.name, e.#f(), e.#P = this.#P, e.#A = this.#A, e.#j = this.#j, this.#c.reNew(e.#c), this.destroy(), e;
689
+ }
690
+ #P = void 0;
691
+ record() {
692
+ return {
693
+ infTL: this.#u,
694
+ cssText: this.#i.style.cssText,
695
+ left: this.#p,
696
+ ch_filter: this.#P,
697
+ fi_easing: this.#A,
698
+ fo_easing: this.#j,
699
+ hyph: this.#c.record()
700
+ };
701
+ }
702
+ playback(e) {
703
+ this.#u = e.infTL, this.position.set(this.#u.pad_left, this.#u.pad_top), this.#i.style.cssText = e.cssText, this.#p = e.left, this.#f(), this.#P = e.ch_filter, this.#A = e.fi_easing, this.#j = e.fo_easing, this.#c.playback(e.hyph);
704
+ }
705
+ get cssText() {
706
+ return this.#i.style.cssText;
707
+ }
708
+ set cssText(e) {
709
+ this.#i.style.cssText = e;
710
+ }
711
+ #F = void 0;
712
+ snapshot(e, p) {
713
+ htm2tx((m) => {
714
+ this.#F = Sprite.from(m), this.#m && (this.#F.x += CmnLib.stageW - (this.#p + this.#u.$width)), this.#F.y -= this.#g, this.#F.texture.frame = new Rectangle(0, 0, Math.min(this.#F.width, this.#u.$width - this.#p), Math.min(this.#F.height, this.#u.$height)), this.#a.addChild(this.#F), e.render(this.#F, { clear: !1 }), p();
715
+ }, this.#i, this.#u, this.#h, this.#g, !1);
716
+ }
717
+ snapshot_end() {
718
+ this.#F &&= (this.#a.removeChild(this.#F), void 0);
719
+ }
720
+ makeDesignCast(e) {}
721
+ showDesignCast() {}
722
+ dump() {
723
+ let e = [], p = this.#i.style, m = p.length;
724
+ for (let h = 0; h < m; ++h) {
725
+ let m = p[h];
726
+ e.push(`"${String(m)}":"${p[m].replaceAll(/(["\\])/g, "\\$1")}"`);
727
+ }
728
+ return `"txt":"${this.#i.textContent.replaceAll(/(["\\])/g, "\\$1")}", "style":{${e.join(",")}}`;
729
+ }
730
+ destroy() {
731
+ p.delBreak(), this.#i.parentElement.removeChild(this.#i), this.#i = document.createElement("span"), this.removeChild(this.#a), this.removeChild(this.#o), this.#o.clear(), this.#l = () => {}, this.#_ = [], this.#v = [], this.#y = 0, this.#w = [], this.#M.abort(), this.#P = void 0, super.destroy();
732
+ }
733
+ }, TxtLayer = class e extends Layer {
734
+ static #e;
735
+ static #t;
736
+ static #n;
737
+ static #r;
738
+ static init(e, p, h, g, v, y) {
739
+ this.#e = e, TxtStage.init(e, y), this.#t = h, this.#r = g, this.#n = v, h.setDoRecProc((e) => this.chgDoRec(e)), p.autowc = (e) => this.#d(e), p.autowc({
740
+ enabled: !1,
741
+ text: "",
742
+ time: 0
743
+ }), p.ch_in_style = (e) => this.#i(e), p.ch_out_style = (e) => this.#a(e), TxtStage.initChStyle(), initStyle(), addStyle(e.matchPath(".+", SEARCH_PATH_ARG_EXT.FONT).flatMap((e) => Object.values(e).map((e) => `
850
744
  @font-face {
851
- font-family: '${String(h)}';
852
- src: url('${this.#c.searchPath(String(h), et.FONT)}');
853
- }
854
- `)).join("") + `
855
- .sn_tx {
856
- pointer-events: none;
857
- user-select: none;
858
- -webkit-touch-callout: none;
859
- box-sizing: border-box;
745
+ font-family: '${String(e)}';
746
+ src: url('${this.#e.searchPath(String(e), SEARCH_PATH_ARG_EXT.FONT)}');
860
747
  }
861
- .sn_ch {
862
- position: relative;
863
- display: inline-block;
864
- }
865
- `
866
- // 「sn_ch」と「sn_ch_in_〜」の中身が重複しているが、これは必須
867
- ), this.#e({
868
- name: "default",
869
- wait: 500,
870
- alpha: 0,
871
- x: "=0.3",
872
- y: "=0",
873
- scale_x: 1,
874
- scale_y: 1,
875
- rotate: 0,
876
- join: !0,
877
- ease: "ease-out"
878
- }), this.#h({
879
- name: "default",
880
- wait: 0,
881
- alpha: 0,
882
- x: "=0",
883
- y: "=0",
884
- scale_x: 1,
885
- scale_y: 1,
886
- rotate: 0,
887
- join: !1,
888
- ease: "ease-out"
889
- });
890
- }
891
- // 文字出現演出
892
- static #e(t) {
893
- const { x: e, y: s, nx: i, ny: a, alpha: n, wait: l, ease: h, rotate: r, scale_x: b, scale_y: y } = c.ch_in_style(t), w = e.startsWith("=") ? `${String(i * 100)}%` : `${String(i)}px`, C = s.startsWith("=") ? `${String(a * 100)}%` : `${String(a)}px`, { name: x = "" } = t;
894
- return V(`
895
- .sn_ch_in_${x} {
748
+ `)).join("") + "\n.sn_tx {\n pointer-events: none;\n user-select: none;\n -webkit-touch-callout: none;\n box-sizing: border-box;\n}\n.sn_ch {\n position: relative;\n display: inline-block;\n}\n"), this.#i({
749
+ name: "default",
750
+ wait: 500,
751
+ alpha: 0,
752
+ x: "=0.3",
753
+ y: "=0",
754
+ scale_x: 1,
755
+ scale_y: 1,
756
+ rotate: 0,
757
+ join: !0,
758
+ ease: "ease-out"
759
+ }), this.#a({
760
+ name: "default",
761
+ wait: 0,
762
+ alpha: 0,
763
+ x: "=0",
764
+ y: "=0",
765
+ scale_x: 1,
766
+ scale_y: 1,
767
+ rotate: 0,
768
+ join: !1,
769
+ ease: "ease-out"
770
+ });
771
+ }
772
+ static #i(e) {
773
+ let { x: p, y: m, nx: h, ny: g, alpha: v, wait: y, ease: b, rotate: x, scale_x: S, scale_y: C } = TxtStage.ch_in_style(e), w = p.startsWith("=") ? `${String(h * 100)}%` : `${String(h)}px`, T = m.startsWith("=") ? `${String(g * 100)}%` : `${String(g)}px`, { name: E = "" } = e;
774
+ return addStyle(`
775
+ .sn_ch_in_${E} {
896
776
  position: relative;
897
777
  display: inline-block;
898
778
  }
899
- .go_ch_in_${x} {
900
- opacity: ${String(n)};
779
+ .go_ch_in_${E} {
780
+ opacity: ${String(v)};
901
781
  position: relative;
902
782
  display: inline-block;
903
- animation: sn_ch_in_${x} ${String(l)}ms ${h} 0s both;
783
+ animation: sn_ch_in_${E} ${String(y)}ms ${b} 0s both;
904
784
  }
905
- @keyframes sn_ch_in_${x} {
906
- from {transform: rotate(${String(r)}deg) scale(${String(b)}, ${String(y)}) translate(${w}, ${C})}
785
+ @keyframes sn_ch_in_${E} {
786
+ from {transform: rotate(${String(x)}deg) scale(${String(S)}, ${String(C)}) translate(${w}, ${T})}
907
787
  to {opacity: 1; transform: none;}
908
788
  }
909
789
  `), !1;
910
- }
911
- // 文字消去演出
912
- static #h(t) {
913
- const { x: e, y: s, nx: i, ny: a, alpha: n, wait: l, ease: h, rotate: r, scale_x: b, scale_y: y } = c.ch_out_style(t), w = e.startsWith("=") ? `${String(i * 100)}%` : `${String(i)}px`, C = s.startsWith("=") ? `${String(a * 100)}%` : `${String(a)}px`, { name: x = "" } = t;
914
- return V(`
915
- .go_ch_out_${x} {
790
+ }
791
+ static #a(e) {
792
+ let { x: p, y: m, nx: h, ny: g, alpha: v, wait: y, ease: b, rotate: x, scale_x: S, scale_y: C } = TxtStage.ch_out_style(e), w = p.startsWith("=") ? `${String(h * 100)}%` : `${String(h)}px`, T = m.startsWith("=") ? `${String(g * 100)}%` : `${String(g)}px`, { name: E = "" } = e;
793
+ return addStyle(`
794
+ .go_ch_out_${E} {
916
795
  position: relative;
917
796
  display: inline-block;
918
- animation: go_ch_out_${x} ${String(l)}ms ${h} 0s both;
797
+ animation: go_ch_out_${E} ${String(y)}ms ${b} 0s both;
919
798
  }
920
- @keyframes go_ch_out_${x} {
799
+ @keyframes go_ch_out_${E} {
921
800
  to {
922
- opacity: ${String(n)};
923
- transform: rotate(${String(r)}deg) scale(${String(b)}, ${String(y)}) translate(${w}, ${C});
801
+ opacity: ${String(v)};
802
+ transform: rotate(${String(x)}deg) scale(${String(S)}, ${String(C)}) translate(${w}, ${T});
924
803
  }
925
804
  `), !1;
926
- }
927
- static #p = 10;
928
- static set msecChWait(t) {
929
- k.#p = t;
930
- }
931
- static get msecChWait() {
932
- return k.#p;
933
- }
934
- static #k;
935
- static #l;
936
- static setEvtMng(t, e, s) {
937
- this.#k = t, this.#l = e, c.setEvtMng(t, s);
938
- }
939
- // 文字ごとのウェイト
940
- static #g = !1;
941
- static #t = {};
942
- static #u(t) {
943
- this.#g = F(t, "enabled", this.#g), this.#n.setVal_Nochk("save", "const.sn.autowc.enabled", this.#g);
944
- const { text: e } = t;
945
- if ("text" in t != "time" in t) throw "[autowc] textとtimeは同時指定必須です";
946
- if (this.#n.setVal_Nochk("save", "const.sn.autowc.text", e), !e)
947
- return this.#n.setVal_Nochk("save", "const.sn.autowc.time", ""), !1;
948
- const s = e.length;
949
- if (this.#g && s === 0) throw '[autowc] enabled === false かつ text === "" は許されません';
950
- const i = String(t.time).split(",");
951
- if (i.length !== s) throw "[autowc] text文字数とtimeに記述された待ち時間(コンマ区切り)は同数にして下さい";
952
- this.#t = {};
953
- for (let a = 0; a < s; ++a) this.#t[e[a]] = M(i[a]);
954
- return this.#n.setVal_Nochk("save", "const.sn.autowc.time", t.time), !1;
955
- }
956
- // バック
957
- #_ = 0;
958
- #o = 0;
959
- #f = !1;
960
- #i = void 0;
961
- #b = "";
962
- // 背景画像無し(=単色塗り)
963
- // 文字表示
964
- #s = new c(this.ctn, () => this.canFocus(), k.#l);
965
- #v = new it();
966
- #y = document.createElement("span");
967
- // cssチェック・保存用
968
- static #G = {
969
- "text-align": 0,
970
- "text-align-last": 0,
971
- height: 0,
972
- width: 0,
973
- "padding-left": 0,
974
- "padding-right": 0,
975
- "padding-top": 0,
976
- "padding-bottom": 0
977
- };
978
- #m = new P();
979
- constructor() {
980
- super(), this.ctn.addChild(this.#s), this.#v.init(this.#Y), this.ctn.addChild(this.#m), this.#m.name = "cntBtn", this.lay({ style: `width: ${String(T.stageW)}px; height: ${String(T.stageH)}px; font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', '游ゴシック Medium', meiryo, sans-serif; color: white; font-size: 24px; line-height: 1.5; padding: ${String(16)}px;`, in_style: "default", out_style: "default", back_clear: "true" });
981
- }
982
- destroy() {
983
- this.#i && (this.ctn.removeChild(this.#i).destroy(), this.#i = void 0), k.#a.pagebreak(), this.#s.destroy();
984
- }
985
- static destroy() {
986
- this.#g = !1, this.#t = {}, this.#F = (t) => t;
987
- }
988
- set name(t) {
989
- this.name_ = t, this.#s.name = t;
990
- }
991
- get name() {
992
- return this.name_;
993
- }
994
- // getは継承しないらしい
995
- cvsResize() {
996
- this.#s.cvsResize();
997
- }
998
- cvsResizeChildren() {
999
- for (const t of this.#m.children) t.cvsResize();
1000
- }
1001
- procSetX(t) {
1002
- this.#s.lay({ x: t });
1003
- }
1004
- procSetY(t) {
1005
- this.#s.lay({ y: t });
1006
- }
1007
- lay(t) {
1008
- if (super.lay(t), tt.setXY(this.ctn, t, this.ctn), t[":id_tag"] = this.name_.slice(0, -7), it.setting(t), this.#H(t), this.#s.lay(t), "r_align" in t && (this.#x = t.r_align ?? ""), this.#d = T.isSafari ? this.#s.tategaki ? (i, a) => `text-align: start; height: ${String(a)}em; padding-top: ${i}; padding-bottom: ${i};` : (i, a) => `text-align: start; width: ${String(a)}em; padding-left: ${i}; padding-right: ${i};` : this.#s.tategaki ? (i) => `text-align: justify; text-align-last: justify; padding-top: ${i}; padding-bottom: ${i};` : (i) => `text-align: justify; text-align-last: justify; padding-left: ${i}; padding-right: ${i};`, T.isFirefox && (this.#U = this.#Z), "r_style" in t)
1009
- if (t.r_style) {
1010
- const i = document.createElement("span");
1011
- i.style.cssText = t.r_style;
1012
- const a = i.style.length, n = this.#y.style;
1013
- for (let l = 0; l < a; ++l) {
1014
- const h = i.style[l];
1015
- if (h in k.#G) {
1016
- K.myTrace(`${String(h)}は指定できません`, "W");
1017
- continue;
1018
- }
1019
- const r = i.style[h];
1020
- r && (n[h] = r);
1021
- }
1022
- } else this.#y.style.cssText = "";
1023
- if ("alpha" in t) for (const i of this.#m.children) i.alpha = this.ctn.alpha;
1024
- this.#S(t), this.#$(t);
1025
- const e = I.procID + `TxtLayer lay name:${this.name_}`, s = this.#O(t, (i) => {
1026
- i && I.endProc(e);
1027
- });
1028
- return s && I.beginProc(e), s;
1029
- }
1030
- #S(t) {
1031
- const { in_style: e } = t;
1032
- if (!e) return;
1033
- const s = c.getChInStyle(e);
1034
- if (!s) throw `存在しないin_style【${e}】です`;
1035
- this.#B = e, this.#P = s.join;
1036
- }
1037
- #B = "";
1038
- #P = !0;
1039
- get width() {
1040
- return this.#s.getWidth;
1041
- }
1042
- get height() {
1043
- return this.#s.getHeight;
1044
- }
1045
- #$(t) {
1046
- const { out_style: e } = t;
1047
- if (!e) return;
1048
- if (!c.getChOutStyle(e)) throw `存在しないout_style【${e}】です`;
1049
- this.#W = e;
1050
- }
1051
- #W = "";
1052
- #E = new W();
1053
- #O(t, e) {
1054
- if ("back_clear" in t)
1055
- return F(t, "back_clear", !1) && (this.#_ = 0, this.#o = 0, this.#f = !1, this.#b = ""), e(!1), !1;
1056
- this.#o = S(t, "b_alpha", this.#o), this.#f = F(t, "b_alpha_isfixed", this.#f);
1057
- const s = (this.#f ? 1 : Number(k.#n.getVal("sys:TextLayer.Back.Alpha"))) * this.#o;
1058
- if (t.b_pic) {
1059
- if (this.#b !== t.b_pic)
1060
- return this.#b = t.b_pic, this.#i && (this.ctn.removeChild(this.#i), this.#i.destroy()), this.#E = new W(this.#b, this.ctn, (i) => {
1061
- this.#i = i, i.name = "back(pic)", i.visible = s > 0, i.alpha = s, this.#s.setMySize(i.width, i.height), this.ctn.setChildIndex(i, 0), e(!0);
1062
- }), this.#E.ret;
1063
- } else "b_color" in t && (this.#_ = dt(t, "b_color", 0), this.#i && (this.ctn.removeChild(this.#i), this.#i.destroy()), this.#b = "", this.ctn.addChildAt(
1064
- (this.#i = new B()).beginFill(this.#_, s).lineStyle(void 0).drawRect(0, 0, this.#s.getWidth, this.#s.getHeight).endFill(),
1065
- 0
1066
- ), this.#i.name = "back(color)");
1067
- return this.#i && (this.#i.visible = s > 0, this.#i.alpha = s), e(!1), !1;
1068
- }
1069
- chgBackAlpha(t) {
1070
- const e = this.#f ? this.#o : t * this.#o;
1071
- this.#i instanceof B && (this.#i && (this.ctn.removeChild(this.#i), this.#i.destroy()), this.ctn.addChildAt(
1072
- (this.#i = new B()).beginFill(this.#_, e).lineStyle(void 0).drawRect(0, 0, this.#s.getWidth, this.#s.getHeight).endFill(),
1073
- 0
1074
- ), this.#i.name = "back(color)"), this.#i && (this.#i.visible = e > 0, this.#i.alpha = e);
1075
- }
1076
- #H(t) {
1077
- "noffs" in t && (this.#N = t.noffs ?? "", this.#z = new RegExp(`[ ${this.#N}]`)), "ffs" in t && (this.#C ??= "", this.#R = this.#C === "" ? () => "" : (e) => this.#z.test(e) ? "" : ` font-feature-settings: ${this.#C};`);
1078
- }
1079
- #C = "";
1080
- #R = (t) => "";
1081
- #N = "";
1082
- // eslint-disable-next-line no-irregular-whitespace
1083
- #z = /[ ]/;
1084
- // Safariが全体に「font-feature-settings」した後、特定文字の「font-feature-settings: initial;」を受け付けてくれないのでわざわざ一つずつ指定
1085
- static chgDoRec(t) {
1086
- this.#F = t ? (e) => e : (e) => `<span class='offrec'>${e}</span>`;
1087
- }
1088
- static #F = (t) => t;
1089
- isCur = !1;
1090
- #d = () => "";
1091
- #U = (t, e, s, i = "") => {
1092
- if (!s) return ` style='${i}'`;
1093
- const a = t.length * 2;
1094
- if (a - e.length < 0) return ` style='text-align: ${s}; ${i}'`;
1095
- let n = "";
1096
- switch (s) {
1097
- case "justify":
1098
- n = this.#d("0", a);
1099
- break;
1100
- case "121":
1101
- n = this.#d(`calc(${String((a - e.length) / (e.length * 2))}em)`, a);
1102
- break;
1103
- case "even":
1104
- n = this.#d(`calc(${String((a - e.length) / (e.length + 1))}em)`, a);
1105
- break;
1106
- case "1ruby":
1107
- n = this.#d("1em", a);
1108
- break;
1109
- default:
1110
- n = `text-align: ${s};`;
1111
- }
1112
- return ` style='${n} ${i}'`;
1113
- };
1114
- #x = "";
1115
- #Z(t, e, s, i = "") {
1116
- if (!s) return ` style='${i}'`;
1117
- const a = t.length * 2;
1118
- if (a - e.length < 0) return ` style='text-align: ${s}; ${i}'`;
1119
- let n = "";
1120
- switch (s) {
1121
- case "left":
1122
- n = "ruby-align: start;";
1123
- break;
1124
- case "center":
1125
- n = "ruby-align: center;";
1126
- break;
1127
- case "right":
1128
- n = "ruby-align: start;";
1129
- break;
1130
- case "justify":
1131
- n = "ruby-align: space-between;";
1132
- break;
1133
- case "121":
1134
- n = "ruby-align: space-around;";
1135
- break;
1136
- case "even":
1137
- {
1138
- const l = ` ${String((a - e.length) / (e.length + 1))}em;`;
1139
- n = "ruby-align: space-between; " + (this.#s.tategaki ? `padding-top:${l} padding-bottom:${l}` : `padding-left:${l} padding-right:${l}`);
1140
- }
1141
- break;
1142
- case "1ruby":
1143
- n = "ruby-align: space-between; " + (this.#s.tategaki ? "padding-top: 1em; padding-bottom: 1em;" : "padding-left: 1em; padding-right: 1em;");
1144
- break;
1145
- default:
1146
- n = `text-align: ${s};`;
1147
- }
1148
- return ` style='${n} ${i}'`;
1149
- }
1150
- tagCh(t) {
1151
- this.#v.putTxt(t);
1152
- }
1153
- #w = !1;
1154
- get needGoTxt() {
1155
- return this.#w;
1156
- }
1157
- #Y = (t, e) => {
1158
- let s = e;
1159
- k.#c.oCfg.debug.putCh && console.log(`🖊 文字表示 text:\`${t}\`(${t.charCodeAt(0).toString(16)}) ruby:\`${s}\` name:\`${this.name_}\``);
1160
- const i = s.split("");
1161
- let a = "";
1162
- const [n, ...l] = i, h = l.join("");
1163
- switch (i.length) {
1164
- case 1:
1165
- if (this.#w = !0, t === `
1166
- `) {
1167
- this.#M ? (this.#M = !1, a = "<ruby>&emsp;<rt>&emsp;</rt></ruby><br/>") : a = "<br/>";
1168
- break;
1169
- }
1170
- this.#M && (this.#M = !1, s === "" && (s = "&emsp;")), a = this.#X(t, s, this.#x);
1171
- break;
1172
- default:
1173
- switch (n) {
1174
- // ルビ揃え指定と同時シリーズ
1175
- case "start":
1176
- // 初期値
1177
- case "left":
1178
- //(肩付き)先頭親文字から、ルビ間は密着
1179
- case "center":
1180
- //(中付き)センター合わせ、〃
1181
- case "right":
1182
- //(右/下揃え)末尾親文字から、〃
1183
- case "justify":
1184
- //(両端揃え)先頭から末尾親文字間に、ルビ間は均等にあける
1185
- case "121":
1186
- //(1-2-1(JIS))ルビの前後を比率1、ルビ間を比率2であける
1187
- case "even":
1188
- //(均等アキ)ルビの前後、ルビ間も均等にあける
1189
- case "1ruby":
1190
- this.#M = !1, this.#w = !0, a = this.#X(t, h, n);
1191
- break;
1192
- case "gotxt":
1193
- this.#V(), this.#w ? (this.isCur && k.#a.recText(
1194
- this.#j.join("").replace(/^<ruby>&emsp;<rt>&emsp;<\/rt><\/ruby>(<br\/>)+/, "").replaceAll(/style='(anim\S+ [^;]+;\s*)+/g, "style='").replaceAll(/( style=''| data-(add|arg|cmd)='[^']+'|\n+|\t+)/g, "").replaceAll(/class='sn_ch[^']+/g, "class='sn_ch").replaceAll("display: none;", "").replaceAll("class='offrec'", "style='display: none;'")
1195
- ), this.#s.goTxt(this.#j, this.#I === 0), this.#w = !1, this.#I = 0) : this.isCur && this.#s.noticeCompTxt();
1196
- return;
1197
- // breakではない
1198
- case "add":
1199
- {
1200
- const r = JSON.parse(h), { style: b = "", wait: y = null } = r, { cl: w, sty: C } = this.#D(!0, y ? M(y) : null);
1201
- this.#j.push(`<span${w} style='${C} display: inline; ${b}'>`), delete r.style, this.#K(r);
1202
- }
1203
- return;
1204
- // breakではない
1205
- case "add_close":
1206
- this.#j.push("</span>"), this.#V();
1207
- return;
1208
- // breakではない
1209
- case "grp":
1210
- this.#w = !0;
1211
- {
1212
- const r = JSON.parse(h);
1213
- if (r.id ??= String(this.#j.length), r.id === "break") {
1214
- this.#s.dispBreak(r);
1215
- return;
1216
- }
1217
- this.#M = !1, r.delay = this.#I, r.r ??= "", r.style ??= "", r.r_style ??= "";
1218
- const { r: b, wait: y = null, r_style: w } = r, { cl: C, sty: x, lnk: N } = this.#D(!0, y ? M(y) : null);
1219
- a = `<span${C} style='${x} ${r.style}'><ruby><span data-cmd='grp' data-arg='${JSON.stringify(r)}'${N} style='${x} display: inline;'>&emsp;</span><rt${N}${this.#U(
1220
- " ",
1221
- b,
1222
- this.#x,
1223
- this.#y.style.cssText + (this.#T.at(-1)?.o.r_style ?? "") + w
1224
- )}>${r.r}</rt></ruby></span>`;
1225
- }
1226
- break;
1227
- case "tcy":
1228
- this.#M = !1, this.#w = !0;
1229
- {
1230
- const { t: r = "", r: b = "", wait: y = null, style: w = "", r_style: C = "" } = JSON.parse(h);
1231
- k.#n.doRecLog() && (this.#q += t + (s ? `《${s}》` : ""), this.#J += r);
1232
- const x = T.isSafari ? b.replaceAll(/[A-Za-z0-9]/g, (o) => String.fromCharCode(o.charCodeAt(0) + 65248)) : b, { cl: N, sty: g, lnk: $ } = this.#D(!0, y ? M(y) : null);
1233
- a = `<span${N} style='${g}${this.#R(r)} ${w}'><ruby><span${$} style='${g} display: inline; text-combine-upright: all;'>${r}</span><rt${$}${this.#U(
1234
- r,
1235
- x,
1236
- this.#x,
1237
- this.#y.style.cssText + (this.#T.at(-1)?.o.r_style ?? "") + C
1238
- )}>${x}</rt></ruby></span>`;
1239
- }
1240
- break;
1241
- case "del":
1242
- c.delBreak();
1243
- return;
1244
- // breakではない
1245
- case "span":
1246
- this.#w = !0, this.#Q(JSON.parse(h));
1247
- return;
1248
- // breakではない
1249
- case "link":
1250
- this.#w = !0;
1251
- {
1252
- const r = JSON.parse(h);
1253
- r[":link"] = " data-lnk='@'";
1254
- const { cl: b, sty: y, curpos: w } = this.#D(!1, r.wait ? M(r.wait) : null);
1255
- this.#j.push(`<span${b} style='${y} display: inline; ${r.style ?? ""}' ${w} data-arg='${h}'>`), delete r.style, this.#Q(r);
1256
- }
1257
- return;
1258
- // breakではない
1259
- case "endlink":
1260
- this.#w = !0, this.#j.push("</span>"), this.#V();
1261
- return;
1262
- // breakではない
1263
- default:
1264
- this.#w = !0, a = this.#X(t, s, this.#x);
1265
- }
1266
- break;
1267
- }
1268
- this.#j.push(k.#F(a));
1269
- };
1270
- #X(t, e, s) {
1271
- const i = t === " " ? "&nbsp;" : t === " " ? "&emsp;" : t;
1272
- k.#n.doRecLog() && (this.#q += i + (e ? `《${e}》` : ""), t !== " " && (this.#J += t));
1273
- const { cl: a, sty: n, lnk: l } = this.#D(!0, null, t);
1274
- return e ? `<span${a} style='${n} ${this.#R(t)}'><ruby>${// 文字個別に出現させるため以下にも ${cl} が必要
1275
- Array.from(t).map((h, r) => `<span${a}${l} style='${r > 0 ? this.#D(!0, null, t).sty : n} display: inline;'>${h === " " ? "&nbsp;" : h === " " ? "&emsp;" : h}</span>`).join("")}<rt${l}${this.#U(
1276
- t,
1277
- e,
1278
- s,
1279
- this.#y.style.cssText + (this.#T.at(-1)?.o.r_style ?? "")
1280
- )}>${e}</rt></ruby></span>` : `<span${a} style='${n} ${this.#R(t)}'${l}>${i}</span>`;
1281
- }
1282
- #D(t, e, s = `
1283
- `) {
1284
- const i = this.#P ? e ?? this.#T.at(0)?.o.wait ?? (k.#g ? k.#t[s.at(0) ?? ""] ?? 0 : k.msecChWait) : 0;
1285
- k.#k.isSkipping ? this.#I = 0 : t && this.#P && (this.#I += M(i));
1286
- const a = `data-add='{"ch_in_style":"${this.#B}", "ch_out_style":"${this.#W}"}'`;
1287
- return {
1288
- cl: ` class='sn_ch sn_ch_yet sn_ch_in_${this.#B}'`,
1289
- // TxtStage.goTxt()はこれ単位で文字出現させる
1290
- sty: `animation-delay: ${String(this.#I)}ms;${this.#T.at(-1)?.o.style ?? ""}`,
1291
- // TxtStage.goTxt()はこれ単位で文字出現させる
1292
- lnk: (this.#T.at(0)?.o[":link"] ?? "") + " " + a,
1293
- curpos: a
1294
- };
1295
- }
1296
- #I = 0;
1297
- #M = !0;
1298
- #j = [];
1299
- #T = [];
1300
- #K(t) {
1301
- this.#T.push({
1302
- o: t,
1303
- r_align: this.#x,
1304
- ch_in_style: this.#B,
1305
- ch_out_style: this.#W
1306
- }), t.r_align && (this.#x = t.r_align), this.#S(t), this.#$(t);
1307
- }
1308
- #V() {
1309
- const t = this.#T.pop();
1310
- t && (this.#x = t.r_align, this.#S({ in_style: t.ch_in_style }), this.#$({ out_style: t.ch_out_style }));
1311
- }
1312
- #Q(t) {
1313
- const e = this.#T.at(-1);
1314
- if (!e) {
1315
- this.#K(t);
1316
- return;
1317
- }
1318
- e.o = { ...e.o, ...t }, !t.style && !t.r_style && (e.o.style = "", e.o.r_style = ""), t.r_align && (this.#x = t.r_align), this.#S(t), this.#$(t);
1319
- }
1320
- click = () => !this.ctn.interactiveChildren || !this.ctn.visible ? !1 : this.#s.skipChIn();
1321
- clearText() {
1322
- this.ctn.removeChild(this.#s), this.ctn.addChild(this.#s = this.#s.reNew()), this.#I = 0, this.#M = !0, this.#j = [], this.#q = "", this.#J = "", k.#a.pagebreak();
1323
- }
1324
- #q = "";
1325
- #J = "";
1326
- get pageText() {
1327
- return this.#q.replace("《&emsp;》", "");
1328
- }
1329
- get pagePlainText() {
1330
- return this.#J;
1331
- }
1332
- get enabled() {
1333
- return this.ctn.interactiveChildren;
1334
- }
1335
- set enabled(t) {
1336
- this.ctn.interactiveChildren = t;
1337
- }
1338
- addButton = (t) => new Promise((e) => {
1339
- t.key = `btn=[${String(this.#m.children.length)}] ` + this.name_, t[":id_tag"] = t.key.slice(0, -7), F(t, "hint_tate", this.#s.tategaki);
1340
- const s = new ut(t, k.#k, () => e(), () => this.canFocus());
1341
- s.name = JSON.stringify(t).replaceAll('"', "'"), this.#m.addChild(s);
1342
- });
1343
- canFocus() {
1344
- return (this.ctn.interactiveChildren ?? !1) && this.ctn.visible && k.#r(this);
1345
- }
1346
- clearLay(t) {
1347
- super.clearLay(t), this.clearText();
1348
- for (const e of this.#m.removeChildren()) e.destroy();
1349
- }
1350
- record = () => ({
1351
- ...super.record(),
1352
- enabled: this.enabled,
1353
- r_cssText: this.#y.style.cssText,
1354
- r_align: this.#x,
1355
- // バック
1356
- b_do: this.#i === void 0 ? void 0 : this.#i instanceof q ? "Sprite" : "Graphics",
1357
- b_pic: this.#b,
1358
- b_color: this.#_,
1359
- b_alpha: this.#o,
1360
- b_alpha_isfixed: this.#f,
1361
- ffs: this.#C,
1362
- txs: this.#s.record(),
1363
- strNoFFS: this.#N,
1364
- btns: this.#m.children.map((t) => t.name)
1365
- });
1366
- playback(t, e) {
1367
- super.playback(t, e), this.enabled = t.enabled, this.#y.style.cssText = t.r_cssText, this.#x = t.r_align, this.cvsResize(), this.#H(t), this.#s.playback(t.txs), this.#o = t.b_alpha, this.#f = t.b_alpha_isfixed, e.push(
1368
- new Promise((s) => {
1369
- const i = t.b_do ? t.b_do === "Sprite" ? { b_pic: t.b_pic } : { b_color: t.b_color } : { b_pic: "" };
1370
- i.b_alpha = t.b_alpha, i.b_alpha_isfixed = t.b_alpha_isfixed, this.#O(i, (a) => {
1371
- a && s();
1372
- }) || s();
1373
- }),
1374
- ...t.btns.map((s) => this.addButton(JSON.parse(s.replaceAll("'", '"')))).flat()
1375
- );
1376
- }
1377
- get cssText() {
1378
- return this.#s.cssText;
1379
- }
1380
- set cssText(t) {
1381
- this.#s.cssText = t;
1382
- }
1383
- snapshot(t, e) {
1384
- t.render(this.ctn, { clear: !1 }), this.#s.snapshot(t, e);
1385
- }
1386
- snapshot_end() {
1387
- this.#s.snapshot_end();
1388
- }
1389
- makeDesignCast(t) {
1390
- this.ctn.visible && this.#s.makeDesignCast(t);
1391
- }
1392
- makeDesignCastChildren(t) {
1393
- if (this.ctn.visible)
1394
- for (const e of this.#m.children) e.makeDesignCast(t);
1395
- }
1396
- showDesignCast() {
1397
- this.#s.showDesignCast();
1398
- }
1399
- showDesignCastChildren() {
1400
- for (const t of this.#m.children) t.showDesignCast();
1401
- }
1402
- dump() {
1403
- return this.#Y("", "gotxt|"), super.dump() + `, "enabled":"${String(this.enabled)}", ${this.#s.dump()}, "b_pic":"${this.#b}", "b_color":"${String(this.#_)}", "b_alpha":${String(this.#o)}, "b_alpha_isfixed":"${String(this.#f)}", "width":${String(this.#s.getWidth)}, "height":${String(this.#s.getHeight)}, "pixi_obj":[${this.ctn.children.map((t) => `{"class":"${t instanceof q ? "Sprite" : t instanceof B ? "Graphics" : t instanceof P ? "Container" : "?"}", "name":"${t.name}", "alpha":${String(t.alpha)}, "x":${String(t.x)}, "y":${String(t.y)}, "visible":"${String(t.visible)}"}`).join(",")}], "button":[${this.#m.children.map((t) => t.children[0]?.name ?? "{}").join(",")}]`;
1404
- }
1405
- }
1406
- const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1407
- __proto__: null,
1408
- TxtLayer: k
1409
- }, Symbol.toStringTag, { value: "Module" }));
1410
- export {
1411
- k as T,
1412
- c as a,
1413
- vt as b
805
+ }
806
+ static #o = 10;
807
+ static set msecChWait(p) {
808
+ e.#o = p;
809
+ }
810
+ static get msecChWait() {
811
+ return e.#o;
812
+ }
813
+ static #s;
814
+ static #c;
815
+ static setEvtMng(e, p, m) {
816
+ this.#s = e, this.#c = p, TxtStage.setEvtMng(e, m);
817
+ }
818
+ static #l = !1;
819
+ static #u = {};
820
+ static #d(e) {
821
+ this.#l = argChk_Boolean(e, "enabled", this.#l), this.#t.setVal_Nochk("save", "const.sn.autowc.enabled", this.#l);
822
+ let { text: p } = e;
823
+ if ("text" in e != "time" in e) throw "[autowc] textとtimeは同時指定必須です";
824
+ if (this.#t.setVal_Nochk("save", "const.sn.autowc.text", p), !p) return this.#t.setVal_Nochk("save", "const.sn.autowc.time", ""), !1;
825
+ let m = p.length;
826
+ if (this.#l && m === 0) throw "[autowc] enabled === false かつ text === \"\" は許されません";
827
+ let g = String(e.time).split(",");
828
+ if (g.length !== m) throw "[autowc] text文字数とtimeに記述された待ち時間(コンマ区切り)は同数にして下さい";
829
+ this.#u = {};
830
+ for (let e = 0; e < m; ++e) this.#u[p[e]] = uint(g[e]);
831
+ return this.#t.setVal_Nochk("save", "const.sn.autowc.time", e.time), !1;
832
+ }
833
+ #f = 0;
834
+ #p = 0;
835
+ #m = !1;
836
+ #h = void 0;
837
+ #g = "";
838
+ #_ = new TxtStage(this.ctn, () => this.canFocus(), e.#c);
839
+ #v = new RubySpliter();
840
+ #y = document.createElement("span");
841
+ static #b = {
842
+ "text-align": 0,
843
+ "text-align-last": 0,
844
+ height: 0,
845
+ width: 0,
846
+ "padding-left": 0,
847
+ "padding-right": 0,
848
+ "padding-top": 0,
849
+ "padding-bottom": 0
850
+ };
851
+ #x = new Container();
852
+ constructor() {
853
+ super(), this.ctn.addChild(this.#_), this.#v.init(this.#B), this.ctn.addChild(this.#x), this.#x.name = "cntBtn", this.lay({
854
+ style: `width: ${String(CmnLib.stageW)}px; height: ${String(CmnLib.stageH)}px; font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', '游ゴシック Medium', meiryo, sans-serif; color: white; font-size: 24px; line-height: 1.5; padding: 16px;`,
855
+ in_style: "default",
856
+ out_style: "default",
857
+ back_clear: "true"
858
+ });
859
+ }
860
+ destroy() {
861
+ this.#h &&= (this.ctn.removeChild(this.#h).destroy(), void 0), e.#r.pagebreak(), this.#_.destroy();
862
+ }
863
+ static destroy() {
864
+ this.#l = !1, this.#u = {}, this.#P = (e) => e;
865
+ }
866
+ set name(e) {
867
+ this.name_ = e, this.#_.name = e;
868
+ }
869
+ get name() {
870
+ return this.name_;
871
+ }
872
+ cvsResize() {
873
+ this.#_.cvsResize();
874
+ }
875
+ cvsResizeChildren() {
876
+ for (let e of this.#x.children) e.cvsResize();
877
+ }
878
+ procSetX(e) {
879
+ this.#_.lay({ x: e });
880
+ }
881
+ procSetY(e) {
882
+ this.#_.lay({ y: e });
883
+ }
884
+ lay(p) {
885
+ if (super.lay(p), Layer.setXY(this.ctn, p, this.ctn), p[":id_tag"] = this.name_.slice(0, -7), RubySpliter.setting(p), this.#k(p), this.#_.lay(p), "r_align" in p && (this.#L = p.r_align ?? ""), this.#F = CmnLib.isSafari ? this.#_.tategaki ? (e, p) => `text-align: start; height: ${String(p)}em; padding-top: ${e}; padding-bottom: ${e};` : (e, p) => `text-align: start; width: ${String(p)}em; padding-left: ${e}; padding-right: ${e};` : this.#_.tategaki ? (e) => `text-align: justify; text-align-last: justify; padding-top: ${e}; padding-bottom: ${e};` : (e) => `text-align: justify; text-align-last: justify; padding-left: ${e}; padding-right: ${e};`, CmnLib.isFirefox && (this.#I = this.#R), "r_style" in p) if (p.r_style) {
886
+ let m = document.createElement("span");
887
+ m.style.cssText = p.r_style;
888
+ let h = m.style.length, g = this.#y.style;
889
+ for (let p = 0; p < h; ++p) {
890
+ let h = m.style[p];
891
+ if (h in e.#b) {
892
+ DebugMng.myTrace(`${String(h)}は指定できません`, "W");
893
+ continue;
894
+ }
895
+ let _ = m.style[h];
896
+ _ && (g[h] = _);
897
+ }
898
+ } else this.#y.style.cssText = "";
899
+ if ("alpha" in p) for (let e of this.#x.children) e.alpha = this.ctn.alpha;
900
+ this.#S(p), this.#T(p);
901
+ let m = Reading.procID + `TxtLayer lay name:${this.name_}`, h = this.#O(p, (e) => {
902
+ e && Reading.endProc(m);
903
+ });
904
+ return h && Reading.beginProc(m), h;
905
+ }
906
+ #S(e) {
907
+ let { in_style: p } = e;
908
+ if (!p) return;
909
+ let m = TxtStage.getChInStyle(p);
910
+ if (!m) throw `存在しないin_style【${p}】です`;
911
+ this.#C = p, this.#w = m.join;
912
+ }
913
+ #C = "";
914
+ #w = !0;
915
+ get width() {
916
+ return this.#_.getWidth;
917
+ }
918
+ get height() {
919
+ return this.#_.getHeight;
920
+ }
921
+ #T(e) {
922
+ let { out_style: p } = e;
923
+ if (p) {
924
+ if (!TxtStage.getChOutStyle(p)) throw `存在しないout_style【${p}】です`;
925
+ this.#E = p;
926
+ }
927
+ }
928
+ #E = "";
929
+ #D = new SpritesMng();
930
+ #O(m, h) {
931
+ if ("back_clear" in m) return argChk_Boolean(m, "back_clear", !1) && (this.#f = 0, this.#p = 0, this.#m = !1, this.#g = ""), h(!1), !1;
932
+ this.#p = argChk_Num(m, "b_alpha", this.#p), this.#m = argChk_Boolean(m, "b_alpha_isfixed", this.#m);
933
+ let _ = (this.#m ? 1 : Number(e.#t.getVal("sys:TextLayer.Back.Alpha"))) * this.#p;
934
+ if (m.b_pic) {
935
+ if (this.#g !== m.b_pic) return this.#g = m.b_pic, this.#h && (this.ctn.removeChild(this.#h), this.#h.destroy()), this.#D = new SpritesMng(this.#g, this.ctn, (e) => {
936
+ this.#h = e, e.name = "back(pic)", e.visible = _ > 0, e.alpha = _, this.#_.setMySize(e.width, e.height), this.ctn.setChildIndex(e, 0), h(!0);
937
+ }), this.#D.ret;
938
+ } else "b_color" in m && (this.#f = argChk_Color(m, "b_color", 0), this.#h && (this.ctn.removeChild(this.#h), this.#h.destroy()), this.#g = "", this.ctn.addChildAt((this.#h = new Graphics()).beginFill(this.#f, _).lineStyle(void 0).drawRect(0, 0, this.#_.getWidth, this.#_.getHeight).endFill(), 0), this.#h.name = "back(color)");
939
+ return this.#h && (this.#h.visible = _ > 0, this.#h.alpha = _), h(!1), !1;
940
+ }
941
+ chgBackAlpha(e) {
942
+ let p = this.#m ? this.#p : e * this.#p;
943
+ this.#h instanceof Graphics && (this.#h && (this.ctn.removeChild(this.#h), this.#h.destroy()), this.ctn.addChildAt((this.#h = new Graphics()).beginFill(this.#f, p).lineStyle(void 0).drawRect(0, 0, this.#_.getWidth, this.#_.getHeight).endFill(), 0), this.#h.name = "back(color)"), this.#h && (this.#h.visible = p > 0, this.#h.alpha = p);
944
+ }
945
+ #k(e) {
946
+ "noffs" in e && (this.#M = e.noffs ?? "", this.#N = /* @__PURE__ */ RegExp(`[ ${this.#M}]`)), "ffs" in e && (this.#A ??= "", this.#j = this.#A === "" ? () => "" : (e) => this.#N.test(e) ? "" : ` font-feature-settings: ${this.#A};`);
947
+ }
948
+ #A = "";
949
+ #j = (e) => "";
950
+ #M = "";
951
+ #N = /[ ]/;
952
+ static chgDoRec(e) {
953
+ this.#P = e ? (e) => e : (e) => `<span class='offrec'>${e}</span>`;
954
+ }
955
+ static #P = (e) => e;
956
+ isCur = !1;
957
+ #F = () => "";
958
+ #I = (e, p, m, h = "") => {
959
+ if (!m) return ` style='${h}'`;
960
+ let g = e.length * 2;
961
+ if (g - p.length < 0) return ` style='text-align: ${m}; ${h}'`;
962
+ let _ = "";
963
+ switch (m) {
964
+ case "justify":
965
+ _ = this.#F("0", g);
966
+ break;
967
+ case "121":
968
+ _ = this.#F(`calc(${String((g - p.length) / (p.length * 2))}em)`, g);
969
+ break;
970
+ case "even":
971
+ _ = this.#F(`calc(${String((g - p.length) / (p.length + 1))}em)`, g);
972
+ break;
973
+ case "1ruby":
974
+ _ = this.#F("1em", g);
975
+ break;
976
+ default: _ = `text-align: ${m};`;
977
+ }
978
+ return ` style='${_} ${h}'`;
979
+ };
980
+ #L = "";
981
+ #R(e, p, m, h = "") {
982
+ if (!m) return ` style='${h}'`;
983
+ let g = e.length * 2;
984
+ if (g - p.length < 0) return ` style='text-align: ${m}; ${h}'`;
985
+ let _ = "";
986
+ switch (m) {
987
+ case "left":
988
+ _ = "ruby-align: start;";
989
+ break;
990
+ case "center":
991
+ _ = "ruby-align: center;";
992
+ break;
993
+ case "right":
994
+ _ = "ruby-align: start;";
995
+ break;
996
+ case "justify":
997
+ _ = "ruby-align: space-between;";
998
+ break;
999
+ case "121":
1000
+ _ = "ruby-align: space-around;";
1001
+ break;
1002
+ case "even":
1003
+ {
1004
+ let e = ` ${String((g - p.length) / (p.length + 1))}em;`;
1005
+ _ = "ruby-align: space-between; " + (this.#_.tategaki ? `padding-top:${e} padding-bottom:${e}` : `padding-left:${e} padding-right:${e}`);
1006
+ }
1007
+ break;
1008
+ case "1ruby":
1009
+ _ = "ruby-align: space-between; " + (this.#_.tategaki ? "padding-top: 1em; padding-bottom: 1em;" : "padding-left: 1em; padding-right: 1em;");
1010
+ break;
1011
+ default: _ = `text-align: ${m};`;
1012
+ }
1013
+ return ` style='${_} ${h}'`;
1014
+ }
1015
+ tagCh(e) {
1016
+ this.#v.putTxt(e);
1017
+ }
1018
+ #z = !1;
1019
+ get needGoTxt() {
1020
+ return this.#z;
1021
+ }
1022
+ #B = (p, m) => {
1023
+ let g = m;
1024
+ e.#e.oCfg.debug.putCh && console.log(`🖊 文字表示 text:\`${p}\`(${p.charCodeAt(0).toString(16)}) ruby:\`${g}\` name:\`${this.name_}\``);
1025
+ let _ = g.split("|"), v = "", [b, ...x] = _, S = x.join("|");
1026
+ switch (_.length) {
1027
+ case 1:
1028
+ if (this.#z = !0, p === "\n") {
1029
+ this.#W ? (this.#W = !1, v = "<ruby>&emsp;<rt>&emsp;</rt></ruby><br/>") : v = "<br/>";
1030
+ break;
1031
+ }
1032
+ this.#W && (this.#W = !1, g === "" && (g = "&emsp;")), v = this.#V(p, g, this.#L);
1033
+ break;
1034
+ default:
1035
+ switch (b) {
1036
+ case "start":
1037
+ case "left":
1038
+ case "center":
1039
+ case "right":
1040
+ case "justify":
1041
+ case "121":
1042
+ case "even":
1043
+ case "1ruby":
1044
+ this.#W = !1, this.#z = !0, v = this.#V(p, S, b);
1045
+ break;
1046
+ case "gotxt":
1047
+ this.#J(), this.#z ? (this.isCur && e.#r.recText(this.#G.join("").replace(/^<ruby>&emsp;<rt>&emsp;<\/rt><\/ruby>(<br\/>)+/, "").replaceAll(/style='(anim\S+ [^;]+;\s*)+/g, "style='").replaceAll(/( style=''| data-(add|arg|cmd)='[^']+'|\n+|\t+)/g, "").replaceAll(/class='sn_ch[^']+/g, "class='sn_ch").replaceAll("display: none;", "").replaceAll("class='offrec'", "style='display: none;'")), this.#_.goTxt(this.#G, this.#U === 0), this.#z = !1, this.#U = 0) : this.isCur && this.#_.noticeCompTxt();
1048
+ return;
1049
+ case "add":
1050
+ {
1051
+ let e = JSON.parse(S), { style: p = "", wait: m = null } = e, { cl: g, sty: _ } = this.#H(!0, m ? uint(m) : null);
1052
+ this.#G.push(`<span${g} style='${_} display: inline; ${p}'>`), delete e.style, this.#q(e);
1053
+ }
1054
+ return;
1055
+ case "add_close":
1056
+ this.#G.push("</span>"), this.#J();
1057
+ return;
1058
+ case "grp":
1059
+ this.#z = !0;
1060
+ {
1061
+ let e = JSON.parse(S);
1062
+ if (e.id ??= String(this.#G.length), e.id === "break") {
1063
+ this.#_.dispBreak(e);
1064
+ return;
1065
+ }
1066
+ this.#W = !1, e.delay = this.#U, e.r ??= "", e.style ??= "", e.r_style ??= "";
1067
+ let { r: p, wait: m = null, r_style: g } = e, { cl: _, sty: y, lnk: b } = this.#H(!0, m ? uint(m) : null);
1068
+ v = `<span${_} style='${y} ${e.style}'><ruby><span data-cmd='grp' data-arg='${JSON.stringify(e)}'${b} style='${y} display: inline;'>&emsp;</span><rt${b}${this.#I(" ", p, this.#L, this.#y.style.cssText + (this.#K.at(-1)?.o.r_style ?? "") + g)}>${e.r}</rt></ruby></span>`;
1069
+ }
1070
+ break;
1071
+ case "tcy":
1072
+ this.#W = !1, this.#z = !0;
1073
+ {
1074
+ let { t: m = "", r: _ = "", wait: b = null, style: x = "", r_style: C = "" } = JSON.parse(S);
1075
+ e.#t.doRecLog() && (this.#X += p + (g ? `《${g}》` : ""), this.#Z += m);
1076
+ let w = CmnLib.isSafari ? _.replaceAll(/[A-Za-z0-9]/g, (e) => String.fromCharCode(e.charCodeAt(0) + 65248)) : _, { cl: T, sty: E, lnk: D } = this.#H(!0, b ? uint(b) : null);
1077
+ v = `<span${T} style='${E}${this.#j(m)} ${x}'><ruby><span${D} style='${E} display: inline; text-combine-upright: all;'>${m}</span><rt${D}${this.#I(m, w, this.#L, this.#y.style.cssText + (this.#K.at(-1)?.o.r_style ?? "") + C)}>${w}</rt></ruby></span>`;
1078
+ }
1079
+ break;
1080
+ case "del":
1081
+ TxtStage.delBreak();
1082
+ return;
1083
+ case "span":
1084
+ this.#z = !0, this.#Y(JSON.parse(S));
1085
+ return;
1086
+ case "link":
1087
+ this.#z = !0;
1088
+ {
1089
+ let e = JSON.parse(S);
1090
+ e[":link"] = " data-lnk='@'";
1091
+ let { cl: p, sty: m, curpos: g } = this.#H(!1, e.wait ? uint(e.wait) : null);
1092
+ this.#G.push(`<span${p} style='${m} display: inline; ${e.style ?? ""}' ${g} data-arg='${S}'>`), delete e.style, this.#Y(e);
1093
+ }
1094
+ return;
1095
+ case "endlink":
1096
+ this.#z = !0, this.#G.push("</span>"), this.#J();
1097
+ return;
1098
+ default: this.#z = !0, v = this.#V(p, g, this.#L);
1099
+ }
1100
+ break;
1101
+ }
1102
+ this.#G.push(e.#P(v));
1103
+ };
1104
+ #V(p, m, h) {
1105
+ let g = p === " " ? "&nbsp;" : p === " " ? "&emsp;" : p;
1106
+ e.#t.doRecLog() && (this.#X += g + (m ? `《${m}》` : ""), p !== " " && (this.#Z += p));
1107
+ let { cl: _, sty: v, lnk: y } = this.#H(!0, null, p);
1108
+ return m ? `<span${_} style='${v} ${this.#j(p)}'><ruby>${Array.from(p).map((e, m) => `<span${_}${y} style='${m > 0 ? this.#H(!0, null, p).sty : v} display: inline;'>${e === " " ? "&nbsp;" : e === " " ? "&emsp;" : e}</span>`).join("")}<rt${y}${this.#I(p, m, h, this.#y.style.cssText + (this.#K.at(-1)?.o.r_style ?? ""))}>${m}</rt></ruby></span>` : `<span${_} style='${v} ${this.#j(p)}'${y}>${g}</span>`;
1109
+ }
1110
+ #H(p, m, g = "\n") {
1111
+ let _ = this.#w ? m ?? this.#K.at(0)?.o.wait ?? (e.#l ? e.#u[g.at(0) ?? ""] ?? 0 : e.msecChWait) : 0;
1112
+ e.#s.isSkipping ? this.#U = 0 : p && this.#w && (this.#U += uint(_));
1113
+ let v = `data-add='{"ch_in_style":"${this.#C}", "ch_out_style":"${this.#E}"}'`;
1114
+ return {
1115
+ cl: ` class='sn_ch sn_ch_yet sn_ch_in_${this.#C}'`,
1116
+ sty: `animation-delay: ${String(this.#U)}ms;${this.#K.at(-1)?.o.style ?? ""}`,
1117
+ lnk: (this.#K.at(0)?.o[":link"] ?? "") + " " + v,
1118
+ curpos: v
1119
+ };
1120
+ }
1121
+ #U = 0;
1122
+ #W = !0;
1123
+ #G = [];
1124
+ #K = [];
1125
+ #q(e) {
1126
+ this.#K.push({
1127
+ o: e,
1128
+ r_align: this.#L,
1129
+ ch_in_style: this.#C,
1130
+ ch_out_style: this.#E
1131
+ }), e.r_align && (this.#L = e.r_align), this.#S(e), this.#T(e);
1132
+ }
1133
+ #J() {
1134
+ let e = this.#K.pop();
1135
+ e && (this.#L = e.r_align, this.#S({ in_style: e.ch_in_style }), this.#T({ out_style: e.ch_out_style }));
1136
+ }
1137
+ #Y(e) {
1138
+ let p = this.#K.at(-1);
1139
+ if (!p) {
1140
+ this.#q(e);
1141
+ return;
1142
+ }
1143
+ p.o = {
1144
+ ...p.o,
1145
+ ...e
1146
+ }, !e.style && !e.r_style && (p.o.style = "", p.o.r_style = ""), e.r_align && (this.#L = e.r_align), this.#S(e), this.#T(e);
1147
+ }
1148
+ click = () => !this.ctn.interactiveChildren || !this.ctn.visible ? !1 : this.#_.skipChIn();
1149
+ clearText() {
1150
+ this.ctn.removeChild(this.#_), this.ctn.addChild(this.#_ = this.#_.reNew()), this.#U = 0, this.#W = !0, this.#G = [], this.#X = "", this.#Z = "", e.#r.pagebreak();
1151
+ }
1152
+ #X = "";
1153
+ #Z = "";
1154
+ get pageText() {
1155
+ return this.#X.replace("《&emsp;》", "");
1156
+ }
1157
+ get pagePlainText() {
1158
+ return this.#Z;
1159
+ }
1160
+ get enabled() {
1161
+ return this.ctn.interactiveChildren;
1162
+ }
1163
+ set enabled(e) {
1164
+ this.ctn.interactiveChildren = e;
1165
+ }
1166
+ addButton = (p) => new Promise((m) => {
1167
+ p.key = `btn=[${String(this.#x.children.length)}] ` + this.name_, p[":id_tag"] = p.key.slice(0, -7), argChk_Boolean(p, "hint_tate", this.#_.tategaki);
1168
+ let h = new Button(p, e.#s, () => m(), () => this.canFocus());
1169
+ h.name = JSON.stringify(p).replaceAll("\"", "'"), this.#x.addChild(h);
1170
+ });
1171
+ canFocus() {
1172
+ return (this.ctn.interactiveChildren ?? !1) && this.ctn.visible && e.#n(this);
1173
+ }
1174
+ clearLay(e) {
1175
+ super.clearLay(e), this.clearText();
1176
+ for (let e of this.#x.removeChildren()) e.destroy();
1177
+ }
1178
+ record = () => ({
1179
+ ...super.record(),
1180
+ enabled: this.enabled,
1181
+ r_cssText: this.#y.style.cssText,
1182
+ r_align: this.#L,
1183
+ b_do: this.#h === void 0 ? void 0 : this.#h instanceof Sprite ? "Sprite" : "Graphics",
1184
+ b_pic: this.#g,
1185
+ b_color: this.#f,
1186
+ b_alpha: this.#p,
1187
+ b_alpha_isfixed: this.#m,
1188
+ ffs: this.#A,
1189
+ txs: this.#_.record(),
1190
+ strNoFFS: this.#M,
1191
+ btns: this.#x.children.map((e) => e.name)
1192
+ });
1193
+ playback(e, p) {
1194
+ super.playback(e, p), this.enabled = e.enabled, this.#y.style.cssText = e.r_cssText, this.#L = e.r_align, this.cvsResize(), this.#k(e), this.#_.playback(e.txs), this.#p = e.b_alpha, this.#m = e.b_alpha_isfixed, p.push(new Promise((p) => {
1195
+ let m = e.b_do ? e.b_do === "Sprite" ? { b_pic: e.b_pic } : { b_color: e.b_color } : { b_pic: "" };
1196
+ m.b_alpha = e.b_alpha, m.b_alpha_isfixed = e.b_alpha_isfixed, this.#O(m, (e) => {
1197
+ e && p();
1198
+ }) || p();
1199
+ }), ...e.btns.map((e) => this.addButton(JSON.parse(e.replaceAll("'", "\"")))).flat());
1200
+ }
1201
+ get cssText() {
1202
+ return this.#_.cssText;
1203
+ }
1204
+ set cssText(e) {
1205
+ this.#_.cssText = e;
1206
+ }
1207
+ snapshot(e, p) {
1208
+ e.render(this.ctn, { clear: !1 }), this.#_.snapshot(e, p);
1209
+ }
1210
+ snapshot_end() {
1211
+ this.#_.snapshot_end();
1212
+ }
1213
+ makeDesignCast(e) {
1214
+ this.ctn.visible && this.#_.makeDesignCast(e);
1215
+ }
1216
+ makeDesignCastChildren(e) {
1217
+ if (this.ctn.visible) for (let p of this.#x.children) p.makeDesignCast(e);
1218
+ }
1219
+ showDesignCast() {
1220
+ this.#_.showDesignCast();
1221
+ }
1222
+ showDesignCastChildren() {
1223
+ for (let e of this.#x.children) e.showDesignCast();
1224
+ }
1225
+ dump() {
1226
+ return this.#B("", "gotxt|"), super.dump() + `, "enabled":"${String(this.enabled)}", ${this.#_.dump()}, "b_pic":"${this.#g}", "b_color":"${String(this.#f)}", "b_alpha":${String(this.#p)}, "b_alpha_isfixed":"${String(this.#m)}", "width":${String(this.#_.getWidth)}, "height":${String(this.#_.getHeight)}, "pixi_obj":[${this.ctn.children.map((e) => `{"class":"${e instanceof Sprite ? "Sprite" : e instanceof Graphics ? "Graphics" : e instanceof Container ? "Container" : "?"}", "name":"${e.name}", "alpha":${String(e.alpha)}, "x":${String(e.x)}, "y":${String(e.y)}, "visible":"${String(e.visible)}"}`).join(",")}], "button":[${this.#x.children.map((e) => e.children[0]?.name ?? "{}").join(",")}]`;
1227
+ }
1414
1228
  };
1415
- //# sourceMappingURL=TxtLayer.js.map
1229
+ export { TxtLayer, TxtStage as t };
1230
+
1231
+ //# sourceMappingURL=TxtLayer.js.map