@famibee/skynovel 1.64.22 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) 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 -992
  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 +918 -786
  33. package/dist/Reading.js.map +1 -1
  34. package/dist/RubySpliter.js +59 -89
  35. package/dist/RubySpliter.js.map +1 -1
  36. package/dist/ScriptIterator.js +805 -1035
  37. package/dist/ScriptIterator.js.map +1 -1
  38. package/dist/SndBuf.js +1097 -1326
  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 -1398
  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 +7 -7
  63. package/dist/sn/CmnTween.d.ts.map +1 -1
  64. package/dist/sn/EventMng.d.ts.map +1 -1
  65. package/dist/sn/FocusMng.d.ts.map +1 -1
  66. package/dist/sn/Grammar.d.ts +1 -1
  67. package/dist/sn/Grammar.d.ts.map +1 -1
  68. package/dist/sn/Log.d.ts.map +1 -1
  69. package/dist/sn/Main.d.ts.map +1 -1
  70. package/dist/sn/Pages.d.ts.map +1 -1
  71. package/dist/sn/PropParser.d.ts +2 -2
  72. package/dist/sn/PropParser.d.ts.map +1 -1
  73. package/dist/sn/Reading.d.ts +7 -0
  74. package/dist/sn/Reading.d.ts.map +1 -1
  75. package/dist/sn/RubySpliter.d.ts.map +1 -1
  76. package/dist/sn/ScriptIterator.d.ts.map +1 -1
  77. package/dist/sn/SndBuf.d.ts +27 -16
  78. package/dist/sn/SndBuf.d.ts.map +1 -1
  79. package/dist/sn/SoundMng.d.ts +4 -1
  80. package/dist/sn/SoundMng.d.ts.map +1 -1
  81. package/dist/sn/SysBase.d.ts.map +1 -1
  82. package/dist/sn/TxtStage.d.ts +4 -1
  83. package/dist/sn/TxtStage.d.ts.map +1 -1
  84. package/dist/test/ValTest.d.ts +1 -1
  85. package/dist/test/ValTest.d.ts.map +1 -1
  86. package/dist/web.js +653 -8
  87. package/dist/web.js.map +1 -1
  88. package/dist_app/Button.js +131 -163
  89. package/dist_app/Button.js.map +1 -1
  90. package/dist_app/CallStack.js +19 -22
  91. package/dist_app/CallStack.js.map +1 -1
  92. package/dist_app/CmnInterface.js +91 -0
  93. package/dist_app/CmnInterface.js.map +1 -0
  94. package/dist_app/CmnLib.js +94 -0
  95. package/dist_app/CmnLib.js.map +1 -0
  96. package/dist_app/Config.js +26 -0
  97. package/dist_app/Config.js.map +1 -0
  98. package/dist_app/ConfigBase.js +152 -0
  99. package/dist_app/ConfigBase.js.map +1 -0
  100. package/dist_app/DebugMng.js +92 -0
  101. package/dist_app/DebugMng.js.map +1 -0
  102. package/dist_app/EventListenerCtn.js +21 -0
  103. package/dist_app/EventListenerCtn.js.map +1 -0
  104. package/dist_app/EventMng.js +1435 -1577
  105. package/dist_app/EventMng.js.map +1 -1
  106. package/dist_app/Grammar.js +194 -0
  107. package/dist_app/Grammar.js.map +1 -0
  108. package/dist_app/GrpLayer.js +163 -195
  109. package/dist_app/GrpLayer.js.map +1 -1
  110. package/dist_app/Layer.js +260 -0
  111. package/dist_app/Layer.js.map +1 -0
  112. package/dist_app/LayerMng.js +810 -992
  113. package/dist_app/LayerMng.js.map +1 -1
  114. package/dist_app/Main.js +144 -392
  115. package/dist_app/Main.js.map +1 -1
  116. package/dist_app/PropParser.js +936 -834
  117. package/dist_app/PropParser.js.map +1 -1
  118. package/dist_app/Reading.js +918 -786
  119. package/dist_app/Reading.js.map +1 -1
  120. package/dist_app/RubySpliter.js +59 -89
  121. package/dist_app/RubySpliter.js.map +1 -1
  122. package/dist_app/ScriptIterator.js +805 -1034
  123. package/dist_app/ScriptIterator.js.map +1 -1
  124. package/dist_app/SndBuf.js +1097 -1326
  125. package/dist_app/SndBuf.js.map +1 -1
  126. package/dist_app/SoundMng.js +124 -135
  127. package/dist_app/SoundMng.js.map +1 -1
  128. package/dist_app/SpritesMng.js +220 -231
  129. package/dist_app/SpritesMng.js.map +1 -1
  130. package/dist_app/SysBase.js +1729 -0
  131. package/dist_app/SysBase.js.map +1 -0
  132. package/dist_app/TxtLayer.js +1212 -1397
  133. package/dist_app/TxtLayer.js.map +1 -1
  134. package/dist_app/Variable.js +398 -466
  135. package/dist_app/Variable.js.map +1 -1
  136. package/dist_app/app.js +211 -8
  137. package/dist_app/app.js.map +1 -1
  138. package/dist_app/appMain.js +20 -21
  139. package/dist_app/appMain.js.map +1 -1
  140. package/dist_app/chunk.js +18 -0
  141. package/dist_app/gamepad.js +723 -511
  142. package/dist_app/gamepad.js.map +1 -1
  143. package/dist_app/pixi.js +11181 -0
  144. package/dist_app/pixi.js.map +1 -0
  145. package/dist_app/platform.js +424 -369
  146. package/dist_app/platform.js.map +1 -1
  147. package/dist_app/preload.js +2 -2
  148. package/dist_app/preload.js.map +1 -1
  149. package/dist_app/sn/AnalyzeTagArg.d.ts +1 -1
  150. package/dist_app/sn/AnalyzeTagArg.d.ts.map +1 -1
  151. package/dist_app/sn/CmnInterface.d.ts +3 -1
  152. package/dist_app/sn/CmnInterface.d.ts.map +1 -1
  153. package/dist_app/sn/CmnLib.d.ts.map +1 -1
  154. package/dist_app/sn/CmnTween.d.ts +7 -7
  155. package/dist_app/sn/CmnTween.d.ts.map +1 -1
  156. package/dist_app/sn/EventMng.d.ts.map +1 -1
  157. package/dist_app/sn/FocusMng.d.ts.map +1 -1
  158. package/dist_app/sn/Grammar.d.ts +1 -1
  159. package/dist_app/sn/Grammar.d.ts.map +1 -1
  160. package/dist_app/sn/Log.d.ts.map +1 -1
  161. package/dist_app/sn/Main.d.ts.map +1 -1
  162. package/dist_app/sn/Pages.d.ts.map +1 -1
  163. package/dist_app/sn/PropParser.d.ts +2 -2
  164. package/dist_app/sn/PropParser.d.ts.map +1 -1
  165. package/dist_app/sn/Reading.d.ts +7 -0
  166. package/dist_app/sn/Reading.d.ts.map +1 -1
  167. package/dist_app/sn/RubySpliter.d.ts.map +1 -1
  168. package/dist_app/sn/ScriptIterator.d.ts.map +1 -1
  169. package/dist_app/sn/SndBuf.d.ts +27 -16
  170. package/dist_app/sn/SndBuf.d.ts.map +1 -1
  171. package/dist_app/sn/SoundMng.d.ts +4 -1
  172. package/dist_app/sn/SoundMng.d.ts.map +1 -1
  173. package/dist_app/sn/SysBase.d.ts.map +1 -1
  174. package/dist_app/sn/TxtStage.d.ts +4 -1
  175. package/dist_app/sn/TxtStage.d.ts.map +1 -1
  176. package/dist_app/test/ValTest.d.ts +1 -1
  177. package/dist_app/test/ValTest.d.ts.map +1 -1
  178. package/package.json +24 -14
  179. package/dist/CmnTween.js +0 -193
  180. package/dist/CmnTween.js.map +0 -1
  181. package/dist/web2.js +0 -21644
  182. package/dist/web2.js.map +0 -1
  183. package/dist_app/CmnTween.js +0 -193
  184. package/dist_app/CmnTween.js.map +0 -1
  185. package/dist_app/app2.js +0 -18547
  186. package/dist_app/app2.js.map +0 -1
package/dist/LayerMng.js CHANGED
@@ -1,994 +1,812 @@
1
- import { e as g, S as H, L as F, n as B, l as x, a as _, p as M, G, q as U, E as A, f as tt, r as et, t as st, v as W, w as it, x as q, y as at, F as nt, u as O, z as J } from "./web2.js";
2
- import { C as w, T as R } from "./CmnTween.js";
3
- import { G as X, D as Y } from "./GrpLayer.js";
4
- import { S as E } from "./SpritesMng.js";
5
- import { T as N, a as rt } from "./TxtLayer.js";
6
- import { R as ot } from "./RubySpliter.js";
7
- import { P as ct, b as K } from "./Main.js";
8
- import { a as C } from "./Reading.js";
9
- import { Button as Q } from "./Button.js";
10
- class I {
11
- constructor(t, e, s, i, n, o, r, c) {
12
- this.cls = e, this.hArg = n, this.sys = o, this.val = r, this.ret = c;
13
- const h = o.hFactoryCls[e];
14
- if (!h) throw `属性 class【${e}】が不正です`;
15
- const f = h(), l = h();
16
- f.layname = l.layname = t;
17
- const d = n[":id_tag"] = `layer:${t} cls:${e} page:`;
18
- f.ctn.name = f.name = d + "A", l.ctn.name = l.name = d + "B", s.addChild(f.ctn), i.addChild(l.ctn), g(n, "visible", !0), g(n, "visible", !0), c.isWait = f.lay(n) || l.lay(n), this.#e = { fore: f, back: l }, i.visible = !1;
19
- const u = `const.sn.lay.${t}`;
20
- r.setVal_Nochk("tmp", u, !0), r.defTmp(u + ".fore.alpha", () => this.#e.fore.alpha), r.defTmp(u + ".back.alpha", () => this.#e.back.alpha), r.defTmp(u + ".fore.height", () => this.#e.fore.height), r.defTmp(u + ".back.height", () => this.#e.back.height), r.defTmp(u + ".fore.visible", () => this.#e.fore.ctn.visible), r.defTmp(u + ".back.visible", () => this.#e.back.ctn.visible), r.defTmp(u + ".fore.width", () => this.#e.fore.width), r.defTmp(u + ".back.width", () => this.#e.back.width), r.defTmp(u + ".fore.x", () => this.#e.fore.x), r.defTmp(u + ".back.x", () => this.#e.back.x), r.defTmp(u + ".fore.y", () => this.#e.fore.y), r.defTmp(u + ".back.y", () => this.#e.back.y);
21
- }
22
- #e;
23
- destroy() {
24
- this.#e.fore.destroy(), this.#e.back.destroy();
25
- }
26
- lay = (t) => this.getPage(t).lay(t);
27
- getPage = (t) => I.argChk_page(t, "fore") !== "back" ? this.#e.fore : this.#e.back;
28
- static argChk_page(t, e) {
29
- const s = t.page ?? e;
30
- if (s === "fore" || s === "back")
31
- return t.page = s, s;
32
- throw Error("属性 page【" + s + "】が不正です");
33
- }
34
- get fore() {
35
- return this.#e.fore;
36
- }
37
- get back() {
38
- return this.#e.back;
39
- }
40
- transPage(t) {
41
- [this.#e.back, this.#e.fore] = [this.#e.fore, this.#e.back], this.#e.back.copy(this.#e.fore, t);
42
- }
43
- }
44
- class p {
45
- constructor(t, e, s) {
46
- this.appPixi = e, this.val = s, t.add_frame = (i) => this.#k(i), t.let_frame = (i) => this.#d(i), t.set_frame = (i) => this.#N(i), t.frame = (i) => this.#$(i), t.tsy_frame = (i) => this.#w(i);
47
- }
48
- static #e;
49
- static #t;
50
- static #i;
51
- static init(t, e, s) {
52
- p.#e = t, p.#t = e, p.#i = s;
53
- }
54
- #o;
55
- setEvtMng(t) {
56
- this.#o = t;
57
- }
58
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
59
- #c = /* @__PURE__ */ Object.create(null);
60
- destroy() {
61
- for (const t of Object.values(this.#c)) t.parentElement.removeChild(t);
62
- this.#c = /* @__PURE__ */ Object.create(null);
63
- }
64
- hideAllFrame() {
65
- for (const [t, { style: e }] of Object.entries(this.#c))
66
- this.#l[t] = e.display !== "none", e.display = "none";
67
- }
68
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
69
- #l = /* @__PURE__ */ Object.create(null);
70
- restoreAllFrame() {
71
- for (const [t, e] of Object.entries(this.#l)) {
72
- const s = this.#c[t];
73
- s && (s.style.display = e ? "inline" : "none");
74
- }
75
- this.#l = /* @__PURE__ */ Object.create(null);
76
- }
77
- // HTMLフレーム
78
- // フレーム追加
79
- #k(t) {
80
- const { id: e, src: s, alpha: i = 1, scale_x: n = 1, scale_y: o = 1, rotate: r = 0 } = t;
81
- if (!e) throw "idは必須です";
82
- if (!s) throw "srcは必須です";
83
- const c = "const.sn.frm." + e;
84
- if (this.val.getVal(`tmp:${c}`)) throw `frame【${e}】はすでにあります`;
85
- const h = g(t, "visible", !0), f = t.b_color ? ` background-color: ${t.b_color};` : "", l = this.#b(t);
86
- p.#i.cvs.insertAdjacentHTML("beforebegin", `<iframe id="${e}" style="opacity: ${String(i)}; ${f} position: absolute; left:${String(p.#t.ofsLeft4elm + l.x * p.#t.cvsScale)}px; top: ${String(p.#t.ofsTop4elm + l.y * p.#t.cvsScale)}px; z-index: 1; border: 0px; overflow: hidden; display: ${h ? "inline" : "none"}; transform: scale(${String(n)}, ${String(o)}) rotate(${String(r)}deg);" width="${String(l.width * p.#t.cvsScale)}" height="${String(l.height * p.#t.cvsScale)}"></iframe>`);
87
- const d = C.procID + `add_frame id:${e}`;
88
- C.beginProc(d);
89
- const u = p.#e.searchPath(s, H.HTML), a = new F().add({ name: s, url: u, xhrType: B.XHR_RESPONSE_TYPE.TEXT });
90
- return p.#t.arg.crypto && a.use(
91
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
92
- (b, k) => void p.#t.dec(b.extension, b.data).then((v) => {
93
- b.data = v, k();
94
- }).catch((v) => {
95
- p.#i.errScript(`[add_frame]Html ロード失敗です src:${b.name} ${String(v)}`, !1), k();
96
- })
97
- ), a.load((b, k) => {
98
- const v = document.getElementById(e);
99
- this.#c[e] = v, this.#y[e] = !1;
100
- const S = u.lastIndexOf("/") + 1, V = u.slice(0, S), m = V.slice(0, S);
101
- v.srcdoc = String(k[s]?.data).replace("sn_repRes();", "").replaceAll(
102
- /\s(?:src|href)=(["'])(\S+?)\1/g,
103
- // 【\s】が大事、data-src弾く
104
- (y, $, T) => T.startsWith("../") ? m + y.slice(3) : y.replace("./", "").replace($, $ + V)
105
- ), v.srcdoc.includes("true/*WEBP*/;") && (v.srcdoc = v.srcdoc.replaceAll(
106
- /data-src="(.+?\.)(?:jpe?g|png)/g,
107
- (y, $) => `data-src="${$}webp`
108
- )), v.onload = () => {
109
- C.endProc(d), this.val.setVal_Nochk("tmp", c, !0), this.val.setVal_Nochk("tmp", c + ".alpha", i), this.val.setVal_Nochk("tmp", c + ".x", l.x), this.val.setVal_Nochk("tmp", c + ".y", l.y), this.val.setVal_Nochk("tmp", c + ".scale_x", n), this.val.setVal_Nochk("tmp", c + ".scale_y", o), this.val.setVal_Nochk("tmp", c + ".rotate", r), this.val.setVal_Nochk("tmp", c + ".width", l.width), this.val.setVal_Nochk("tmp", c + ".height", l.height), this.val.setVal_Nochk("tmp", c + ".visible", h);
110
- const y = v.contentWindow;
111
- this.#o.resvFlameEvent(y.document.body), y.sn_repRes?.(($) => p.#_($.dataset.src ?? "", $));
112
- };
113
- }), !0;
114
- }
115
- #y = {};
116
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
117
- getFrmDisabled(t) {
118
- return this.#y[t];
119
- }
120
- #b(t) {
121
- const e = { ...t };
122
- return new DOMRect(
123
- x(e, "x", 0),
124
- x(e, "y", 0),
125
- x(e, "width", _.stageW),
126
- x(e, "height", _.stageH)
127
- );
128
- }
129
- static #_(t, e, s) {
130
- const i = this.#f[t];
131
- if (i) {
132
- e.src = i, s && (e.onload = () => s(e));
133
- return;
134
- }
135
- const n = this.#m[t];
136
- if (n) {
137
- n.push(e);
138
- return;
139
- }
140
- this.#m[t] = [e];
141
- const [o = "", r = ""] = t.split("?"), c = p.#e.searchPath(o, H.SP_GSM), h = new F().add({ name: t, url: c, xhrType: B.XHR_RESPONSE_TYPE.BUFFER });
142
- p.#t.use4ViteElectron(t, c, h, p.#i) || p.#t.arg.crypto && c.endsWith(".bin") && h.use((f, l) => {
143
- if (f.extension !== "bin") {
144
- l();
145
- return;
146
- }
147
- p.#t.decAB(f.data).then((d) => {
148
- f.data = d, d instanceof HTMLImageElement && (f.type = B.TYPE.IMAGE), l();
149
- }).catch((d) => {
150
- p.#i.errScript(`FrameMng loadPic ロード失敗です fn:${f.name} ${String(d)}`, !1), l();
151
- });
152
- }), h.load((f, l) => {
153
- for (const [d, { data: { src: u } }] of Object.entries(l)) {
154
- const a = this.#f[d] = u + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
155
- (u.startsWith("blob:") || u.startsWith("data:") ? "" : r ? "?" + r : ""), b = this.#m[d];
156
- if (b) for (const k of b)
157
- k.src = a, s && (k.onload = () => s(k));
158
- delete this.#m[d];
159
- }
160
- });
161
- }
162
- static #m = {};
163
- static #f = {};
164
- cvsResize() {
165
- for (const [t, e] of Object.entries(this.#c)) {
166
- const s = "const.sn.frm." + t, i = Number(this.val.getVal(s + ".x")), n = Number(this.val.getVal(s + ".y")), o = Number(this.val.getVal(s + ".width")), r = Number(this.val.getVal(s + ".height"));
167
- e.style.left = `${String(
168
- p.#t.ofsLeft4elm + i * p.#t.cvsScale
169
- )}px`, e.style.top = `${String(
170
- p.#t.ofsTop4elm + n * p.#t.cvsScale
171
- )}px`, e.width = String(o * p.#t.cvsScale), e.height = String(r * p.#t.cvsScale);
172
- }
173
- }
174
- // フレーム変数を取得
175
- #d(t) {
176
- const { id: e, var_name: s } = t;
177
- if (!e) throw "idは必須です";
178
- const i = document.getElementById(e);
179
- if (!i) throw `id【${e}】はフレームではありません`;
180
- const n = "const.sn.frm." + e;
181
- if (!this.val.getVal(`tmp:${n}`)) throw `frame【${e}】が読み込まれていません`;
182
- if (!s) throw "var_nameは必須です";
183
- const o = i.contentWindow;
184
- if (!Object.hasOwn(o, s)) throw `frame【${e}】に変数/関数【${s}】がありません。変数は var付きにして下さい`;
185
- const r = o[s];
186
- return this.val.setVal_Nochk(
187
- "tmp",
188
- n + "." + s,
189
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
190
- g(t, "function", !1) ? r() : r
191
- ), !1;
192
- }
193
- // フレーム変数に設定
194
- #N(t) {
195
- const { id: e, var_name: s, text: i } = t;
196
- if (!e) throw "idは必須です";
197
- const n = document.getElementById(e);
198
- if (!n) throw `id【${e}】はフレームではありません`;
199
- const o = "const.sn.frm." + e;
200
- if (!this.val.getVal(`tmp:${o}`)) throw `frame【${e}】が読み込まれていません`;
201
- if (!s) throw "var_nameは必須です";
202
- if (!i) throw "textは必須です";
203
- this.val.setVal_Nochk("tmp", o + "." + s, i);
204
- const r = n.contentWindow;
205
- return r[s] = i, !1;
206
- }
207
- // フレームに設定
208
- #n = 1;
209
- #$(t) {
210
- const { id: e } = t;
211
- if (!e) throw "idは必須です";
212
- const s = document.getElementById(e);
213
- if (!s) throw `id【${e}】はフレームではありません`;
214
- const i = "const.sn.frm." + e;
215
- if (!this.val.getVal("tmp:" + i)) throw `frame【${e}】が読み込まれていません`;
216
- const n = s.style;
217
- if (g(t, "float", !1) ? n.zIndex = String(++this.#n) : "index" in t ? n.zIndex = String(x(t, "index", 0)) : t.dive && (n.zIndex = String(-++this.#n)), "alpha" in t) {
218
- const r = n.opacity = String(t.alpha);
219
- this.val.setVal_Nochk("tmp", i + ".alpha", r);
220
- }
221
- const o = this.#b(t);
222
- if (("x" in t || "y" in t) && (n.left = `${String(
223
- p.#t.ofsLeft4elm + o.x * p.#t.cvsScale
224
- )}px`, n.top = `${String(
225
- p.#t.ofsTop4elm + o.y * p.#t.cvsScale
226
- )}px`, this.val.setVal_Nochk("tmp", i + ".x", o.x), this.val.setVal_Nochk("tmp", i + ".y", o.y)), "scale_x" in t || "scale_y" in t || "rotate" in t) {
227
- const r = x(t, "scale_x", 1), c = x(t, "scale_y", 1), h = x(t, "rotate", 0);
228
- n.transform = `scale(${String(r)}, ${String(c)}) rotate(${String(h)}deg)`, this.val.setVal_Nochk("tmp", i + ".scale_x", r), this.val.setVal_Nochk("tmp", i + ".scale_y", c), this.val.setVal_Nochk("tmp", i + ".rotate", h);
229
- }
230
- if ("width" in t && (s.width = String(o.width * p.#t.cvsScale), this.val.setVal_Nochk("tmp", i + ".width", o.width)), "height" in t && (s.height = String(o.height * p.#t.cvsScale), this.val.setVal_Nochk("tmp", i + ".height", o.height)), "visible" in t) {
231
- const r = g(t, "visible", !0);
232
- n.display = r ? "inline" : "none", this.val.setVal_Nochk("tmp", i + ".visible", r);
233
- }
234
- if ("b_color" in t && (n.backgroundColor = t.b_color), "disabled" in t) {
235
- const r = this.#y[e] = g(t, "disabled", !0), c = s.contentDocument.body;
236
- for (const h of [
237
- ...Array.from(c.getElementsByTagName("input")),
238
- ...Array.from(c.getElementsByTagName("select"))
239
- ]) h.disabled = r;
240
- }
241
- return !1;
242
- }
243
- // フレームをトゥイーン開始
244
- #w(t) {
245
- const { id: e, alpha: s, x: i, y: n, scale_x: o, scale_y: r, rotate: c, width: h, height: f } = t;
246
- if (!e) throw "idは必須です";
247
- const l = document.getElementById(e);
248
- if (!l) throw `id【${e}】はフレームではありません`;
249
- const d = "const.sn.frm." + e;
250
- if (!this.val.getVal(`tmp:${d}`, 0)) throw `frame【${e}】が読み込まれていません`;
251
- const u = {};
252
- s && (u.a = Number(l.style.opacity)), (i || n || o || r || c) && (u.x = Number(this.val.getVal(`tmp:${d}.x`)), u.y = Number(this.val.getVal(`tmp:${d}.y`)), u.sx = Number(this.val.getVal(`tmp:${d}.scale_x`)), u.sy = Number(this.val.getVal(`tmp:${d}.scale_y`)), u.r = Number(this.val.getVal(`tmp:${d}.rotate`))), h && (u.w = Number(this.val.getVal(`tmp:${d}.width`))), f && (u.h = Number(this.val.getVal(`tmp:${d}.height`)));
253
- const a = w.cnvTweenArg(t, u);
254
- let b = (m) => {
255
- };
256
- s && (x(a, "alpha", 0), b = (m) => {
257
- l.style.opacity = String(m.a), this.val.setVal_Nochk("tmp", "alpha", m.a);
258
- });
259
- let k = (m) => {
260
- };
261
- const v = this.#b(a);
262
- (i || n || o || r || c) && (v.x, v.y, x(a, "scale_x", 1), x(a, "scale_y", 1), x(a, "rotate", 0), k = (m) => {
263
- l.style.left = `${String(
264
- p.#t.ofsLeft4elm + m.x * p.#t.cvsScale
265
- )} px`, l.style.top = `${String(
266
- p.#t.ofsTop4elm + m.y * p.#t.cvsScale
267
- )} px`, l.style.transform = `scale(${String(m.sx)}, ${String(m.sy)}) rotate(${String(m.r)}deg)`, this.val.setVal_Nochk("tmp", d + ".x", m.x), this.val.setVal_Nochk("tmp", d + ".y", m.y), this.val.setVal_Nochk("tmp", d + ".scale_x", m.sx), this.val.setVal_Nochk("tmp", d + ".scale_y", m.sy), this.val.setVal_Nochk("tmp", d + ".rotate", m.r);
268
- });
269
- let S = (m) => {
270
- };
271
- h && (v.width, S = (m) => {
272
- l.width = `${String(m.w * p.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", d + ".width", m.w);
273
- });
274
- let V = (m) => {
275
- };
276
- return f && (v.height, V = (m) => {
277
- l.height = `${String(m.h * p.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", d + ".height", m.h);
278
- }), this.appPixi.stage.interactive = !1, w.tween(`frm
279
- ${e}`, t, u, w.cnvTweenArg(t, u), (m) => {
280
- b(m), k(m), S(m), V(m);
281
- }, () => {
282
- this.appPixi.stage.interactive = !0;
283
- }, () => {
284
- }), !1;
285
- }
286
- }
287
- class lt {
288
- // 🍚
289
- constructor(t, e, s) {
290
- this.oCfg = t, this.hTag = e, this.val = s, e.rec_ch = (i) => this.#i(i), e.rec_r = (i) => this.#o(i), e.reset_rec = (i) => this.#c(i), s.defTmp("const.sn.log.json", () => {
291
- this.#e.text = // 🌾
292
- this.#e.text.replaceAll("</span><span class='sn_ch'>", "");
293
- const i = [...this.#t, this.#e];
294
- return JSON.stringify(i);
295
- }), this.recText("");
296
- }
297
- #e = { text: "" };
298
- // 🌾
299
- #t = [];
300
- // [ch] からコールされる
301
- // [ch] // 文字を追加する
302
- // recText(text: string) コール
303
- // 🌾this.#LastLog = {text}; // 置換でよい
304
- // 🍊save:const.sn.sLog = 🦀const.sn.log.json // これを起動したい
305
- recText(t) {
306
- this.#e.text = t, this.val.setVal_Nochk(
307
- "save",
308
- "const.sn.sLog",
309
- // 🍊 リプレイ時の回復用
310
- String(this.val.getVal("const.sn.log.json"))
311
- // これを起動したい
312
- );
313
- }
314
- //MARK: 履歴書き込み
315
- // 🌾this.#LastLog = {...hArg, text: 🌾this.#LastLog.text};
316
- #i(t) {
317
- return this.#e = { ...t, text: this.#e.text }, t.text ? (t.record = !0, t.style ??= "", t.style += "display: none;", t.wait = 0, this.hTag.ch(t)) : (this.val.setVal_Nochk(
318
- "save",
319
- "const.sn.sLog",
320
- // 🍊 リプレイ時の回復用
321
- String(this.val.getVal("const.sn.log.json"))
322
- // これを起動したい
323
- ), !1);
324
- }
325
- //MARK: 履歴改行
326
- #o(t) {
327
- return this.#i({ ...t, text: "[r]" });
328
- }
329
- //MARK: 履歴リセット
330
- // 以下をクリア。text で置き換え値を設定できる
331
- // 🌾this.#LastLog = {text: hArg.text ?? ''};
332
- // 🍚this.#aLog = []
333
- // 🍊save:const.sn.sLog= hArg.text ?[{text:"${hArg.text}"}] : []
334
- #c(t) {
335
- return this.#t = [], t.text ??= "", this.#e = { text: t.text }, this.val.setVal_Nochk("save", "const.sn.sLog", JSON.stringify([this.#e])), !1;
336
- }
337
- //MARK: 履歴改ページ
338
- pagebreak() {
339
- this.#e.text = // 🌾
340
- this.#e.text.replaceAll("</span><span class='sn_ch'>", ""), this.#e.text && (this.#t.push(this.#e) > this.oCfg.log.max_len && (this.#t = this.#t.slice(-this.oCfg.log.max_len)), this.#e = { text: "" });
341
- }
342
- //MARK: 履歴回復
343
- // save:const.sn.sLog からの復帰
344
- playback() {
345
- this.#t = JSON.parse(String(this.val.getVal("save:const.sn.sLog"))), this.#e = { text: "" };
346
- }
347
- }
348
- function L(j) {
349
- return encodeURIComponent(JSON.stringify(j));
350
- }
351
- class Z {
352
- //MARK: コンストラクタ
353
- constructor(t, e, s, i, n, o, r, c, h) {
354
- this.cfg = t, this.hTag = e, this.appPixi = s, this.val = i, this.main = n, this.scrItr = o, this.sys = r;
355
- const f = () => {
356
- if (r.cvsResize(), this.cvsResizeDesign(), this.#_) for (const a of this.#r)
357
- this.#s[a].fore.cvsResizeChildren();
358
- else for (const a of this.#r)
359
- this.#s[a].fore.cvsResize();
360
- this.#o.cvsResize(), this.#d.cvsResize();
361
- };
362
- if (_.isMobile)
363
- this.#k.add(globalThis, "orientationchange", f, { passive: !0 });
364
- else {
365
- let a;
366
- this.#k.add(globalThis, "resize", () => {
367
- a || (a = setTimeout(() => {
368
- a = void 0, f();
369
- }, 1e3 / 60 * 10));
370
- }, { passive: !0 });
371
- }
372
- r.cvsResize(), this.#l = new lt(this.cfg.oCfg, e, i), N.init(t, e, i, this.#l, (a) => this.#s[a.layname].fore === a, s), X.init(n, t, s, r, c, i), p.init(t, r, n), this.#o = new p(e, s, i), e.loadplugin = (a) => this.#O(a), e.snapshot = (a) => this.#$(a), this.#w = this.sys.isApp ? (a, b, k, v, S) => this.#B(a, b, k, v, S) : (a, b, k, v, S) => this.#W(a, b, k, v, S), e.add_lay = (a) => this.#j(a), e.clear_lay = (a) => this.#H(a), e.finish_trans = () => !1, e.lay = (a) => this.#z(a), e.trans = (a) => this.#G(a), e.wt = (a) => w.wt(a), e.quake = (a) => this.#q(a), e.stop_quake = e.finish_trans, e.wq = e.wt, e.pause_tsy = (a) => w.pause_tsy(a), e.resume_tsy = (a) => w.resume_tsy(a), e.stop_tsy = (a) => w.stop_tsy(a), e.tsy = (a) => this.#J(a), e.wait_tsy = (a) => w.wait_tsy(a), e.add_filter = (a) => this.#X(a), e.clear_filter = (a) => this.#Y(a), e.enable_filter = (a) => this.#K(a), e.ch = (a) => this.#I(a), e.clear_text = (a) => this.#M(a), e.current = (a) => this.#D(a), e.endlink = (a) => this.#A(a), e.er = (a) => this.#tt(a), e.graph = (a) => this.#et(a), e.link = (a) => this.#st(a), e.r = (a) => this.#it(a), e.ruby2 = (a) => this.#at(a), e.span = (a) => this.#nt(a), e.tcy = (a) => this.#rt(a), e.add_face = (a) => E.add_face(a), e.wv = (a) => E.wv(a), e.dump_lay = (a) => this.#ot(a), e.enable_event = (a) => this.#ct(a), e.button = (a) => this.#lt(a), t.existsBreakline && (this.breakLine = (a) => {
373
- delete a.visible, a.id = "break", a.pic = "breakline", this.#n("grp|" + L(a));
374
- }), t.existsBreakpage && (this.breakPage = (a) => {
375
- delete a.visible, a.id = "break", a.pic = "breakpage", this.#n("grp|" + L(a));
376
- }), this.#c = M(String(t.oCfg.init.bg_color));
377
- const l = new G();
378
- l.beginFill(this.#c).lineStyle(0, this.#c).drawRect(0, 0, _.stageW, _.stageH).endFill(), this.#t.addChild(l.clone()), this.#i.addChild(l), this.#i.visible = !1, this.#t.name = "page:A", this.#i.name = "page:B", this.#e = s.stage, this.#e.addChild(this.#i), this.#e.addChild(this.#t), this.#e.addChild(this.#T), this.#e.addChild(this.#a), this.#e.name = "stage";
379
- const d = (a, b) => {
380
- this.#N(Number(b));
381
- };
382
- d("", i.getVal("sys:TextLayer.Back.Alpha", 1)), i.defValTrg("sys:TextLayer.Back.Alpha", d);
383
- const u = (a, b) => {
384
- Q.fontFamily = b;
385
- };
386
- u("", i.getVal("tmp:sn.button.fontFamily", Q.fontFamily)), i.defValTrg("tmp:sn.button.fontFamily", u), i.defTmp("const.sn.last_page_text", () => this.currentTxtlayFore?.pageText ?? ""), i.defTmp("const.sn.last_page_plain_text", () => this.currentTxtlayFore?.pagePlainText ?? ""), _.isDbg && (Y.init(s, r, o, h, t, this.#s), this.cvsResizeDesign = () => Y.cvsResizeDesign(), r.addHook((a, b) => {
387
- this.#y[a]?.(a, b) && delete this.#y[a];
388
- }));
389
- }
390
- #e;
391
- #t = new U();
392
- #i = new U();
393
- #o;
394
- #c;
395
- #l;
396
- #k = new A();
397
- cvsResizeDesign() {
398
- }
399
- #y = {
400
- attach: (t) => !1,
401
- continue: (t) => !1,
402
- disconnect: (t) => !1,
403
- _enterDesign: (t) => {
404
- for (const e of this.#r) {
405
- const s = this.#s[e].fore;
406
- s.makeDesignCastChildren((i) => i.make()), s.makeDesignCast((i) => i.make());
407
- }
408
- return this.#m(this.#v), !1;
409
- },
410
- _replaceToken: (t, e) => !1,
411
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
412
- _selectNode: (t, e) => (this.#m(e.node), !1)
413
- };
414
- #b = "";
415
- #_ = "";
416
- #m(t) {
417
- [this.#b = "", this.#_ = ""] = t.split("/");
418
- const e = this.#s[this.#b];
419
- e && (this.#_ ? e.fore.showDesignCastChildren() : e.fore.showDesignCast());
420
- }
421
- getFrmDisabled = (t) => this.#o.getFrmDisabled(t);
422
- #f = void 0;
423
- cover(t, e = 0) {
424
- this.#f && (this.#e.removeChild(this.#f), this.#f.destroy(), this.#f = void 0), t && this.#e.addChild(
425
- (this.#f = new G()).beginFill(e).lineStyle(0, e).drawRect(0, 0, _.stageW, _.stageH).endFill()
426
- );
427
- }
428
- #d;
429
- setEvtMng(t) {
430
- this.#d = t, this.#o.setEvtMng(t), E.setEvtMng(t), w.init(t, this.appPixi);
431
- }
432
- destroy() {
433
- for (const t of Object.values(this.#s)) t.destroy();
434
- this.#k.clear(), X.destroy(), ot.destroy(), rt.destroy(), N.destroy(), this.#o.destroy(), w.destroy(), N.msecChWait = 10;
435
- }
436
- // 既存の全文字レイヤの実際のバック不透明度、を再計算
437
- #N(t) {
438
- for (const e of this.#r) {
439
- const { fore: s, back: i } = this.#s[e];
440
- s instanceof N && (s.chgBackAlpha(t), i.chgBackAlpha(t));
441
- }
442
- }
443
- #n = (t, e = this.currentTxtlayForeNeedErr, s = !0) => e.tagCh("|&emsp;《" + t + "》");
444
- goTxt = () => {
445
- };
446
- get needGoTxt() {
447
- return this.currentTxtlayFore?.needGoTxt ?? !1;
448
- }
449
- breakLine = (t) => {
450
- };
451
- breakPage = (t) => {
452
- };
453
- clearBreak() {
454
- this.currentTxtlayFore && (this.clearBreak = () => this.#n("del|break"), this.clearBreak());
455
- }
456
- clickTxtLay() {
457
- return this.currentTxtlayFore ? this.#r.map((t) => this.#s[t].fore).some((t) => t instanceof N && t.click()) : !1;
458
- }
459
- // // システム
460
- //MARK: スナップショット
461
- #$(t) {
462
- const e = tt("-", "_", "", "_"), s = t.fn ? t.fn.startsWith(ct) ? t.fn : `${K + t.fn + e}.png` : `${K}snapshot${e}.png`, i = this.cfg.searchPath(s), n = x(t, "width", _.stageW), o = x(t, "height", _.stageH);
463
- return this.#w(t, i, n, o, `snapshot dt:${e}`);
464
- }
465
- #w = () => !1;
466
- #B({ layer: t }, e, s, i, n) {
467
- if (this.#o.hideAllFrame(), C.beginProc(n), !t)
468
- return this.sys.capturePage(e, s, i, () => {
469
- this.#o.restoreAllFrame(), C.endProc(n);
470
- }), !0;
471
- const o = this.#r.map((r) => {
472
- const { ctn: c } = this.#s[r].fore, h = [c, c.visible];
473
- return c.visible = !1, h;
474
- });
475
- for (const r of this.#p(t)) this.#s[r].fore.ctn.visible = !0;
476
- return this.sys.capturePage(e, s, i, () => {
477
- for (const [r, c] of o) r.visible = c;
478
- this.#o.restoreAllFrame(), C.endProc(n);
479
- }), !0;
480
- }
481
- #W(t, e, s, i, n) {
482
- C.beginProc(n);
483
- const o = et(t, "b_color", this.#c), r = st({
484
- width: s,
485
- height: i,
486
- backgroundAlpha: o > 16777216 && e.endsWith(".png") ? 0 : 1,
487
- antialias: g(t, "smoothing", !1),
488
- preserveDrawingBuffer: !0,
489
- backgroundColor: o & 16777215,
490
- autoDensity: !0
491
- }), c = t.page !== "back" ? "fore" : "back", { layer: h } = t;
492
- return Promise.allSettled(
493
- this.#p(h).map((f) => new Promise(
494
- (l) => this.#s[f][c].snapshot(r, l)
495
- ))
496
- ).then(async () => {
497
- const f = W.create({ width: r.width, height: r.height });
498
- r.render(this.#e, { renderTexture: f }), await this.sys.savePic(
499
- e,
500
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
501
- r.plugins.extract.base64(f)
502
- ), f.destroy();
503
- for (const l of this.#p(h)) this.#s[l][c].snapshot_end();
504
- r.destroy(!0), C.endProc(n);
505
- }), !0;
506
- }
507
- //MARK: プラグインの読み込み
508
- #O(t) {
509
- const { fn: e } = t;
510
- if (!e) throw "fnは必須です";
511
- if (!e.endsWith(".css")) throw "サポートされない拡張子です";
512
- const s = g(t, "join", !0), i = C.procID + `loadplugin fn:${e}`;
513
- return s && C.beginProc(i), (async () => {
514
- const n = await fetch(e);
515
- if (!n.ok) throw new Error("Network response was not ok.");
516
- it(await n.text()), s && C.endProc(i);
517
- })(), s;
518
- }
519
- // // レイヤ共通
520
- //MARK: レイヤを追加する
521
- #j(t) {
522
- const { layer: e, class: s } = t;
523
- if (!e) throw "layerは必須です";
524
- if (e.includes(",")) throw "layer名に「,」は使えません";
525
- if (e in this.#s) throw `layer【${e}】はすでにあります`;
526
- if (!s) throw "clsは必須です";
527
- const i = { isWait: !1 };
528
- switch (this.#s[e] = new I(e, s, this.#t, this.#i, t, this.sys, this.val, i), this.#r.push(e), s) {
529
- case "txt":
530
- this.#v || (this.#C = () => {
531
- }, this.#h = (n) => this.#Q(n), this.#D = (n) => this.#Z(n), this.hTag.current({ layer: e }), this.goTxt = () => {
532
- this.#d.isSkipping ? N.msecChWait = 0 : this.setNormalChWait();
533
- for (const n of this.#r) {
534
- const o = this.#s[n].fore;
535
- o instanceof N && this.#n("gotxt|", o, !1);
536
- }
537
- }), this.val.setVal_Nochk("save", "const.sn.layer." + e + ".enabled", !0);
538
- break;
539
- case "grp":
540
- if (this.#E) break;
541
- this.#E = e;
542
- break;
543
- }
544
- return this.scrItr.recodeDesign(t), i.isWait;
545
- }
546
- #s = {
547
- /* empty */
548
- };
549
- // しおりLoad時再読込
550
- #r = [];
551
- // 最適化用・重なり順つき全レイヤ名
552
- #v = "";
553
- #E = "";
554
- #z(t) {
555
- const e = this.#u(t), s = this.#s[e], i = s.back.ctn, n = s.fore.ctn;
556
- if (g(t, "float", !1))
557
- this.#i.setChildIndex(i, this.#i.children.length - 1), this.#t.setChildIndex(n, this.#t.children.length - 1), this.#V();
558
- else if (t.index)
559
- x(t, "index", 0) && (this.#i.setChildIndex(i, t.index), this.#t.setChildIndex(n, t.index), this.#V());
560
- else if (t.dive) {
561
- const { dive: o } = t;
562
- let r = 0;
563
- if (e === o) throw "[lay] 属性 layerとdiveが同じ【" + o + "】です";
564
- const c = this.#s[o];
565
- if (!c) throw "[lay] 属性 dive【" + o + "】が不正です。レイヤーがありません";
566
- const h = c.back, f = c.fore, l = this.#i.getChildIndex(h.ctn), d = this.#t.getChildIndex(f.ctn);
567
- r = l < d ? l : d, r > this.#i.getChildIndex(i) && --r, this.#t.setChildIndex(n, r), this.#i.setChildIndex(i, r), this.#V();
568
- }
569
- return t[":id_tag"] = s.fore.name.slice(0, -7), this.scrItr.recodeDesign(t), s.lay(t);
570
- }
571
- #V() {
572
- this.#r = this.#U();
573
- }
574
- //MARK: レイヤ設定の消去
575
- #H(t) {
576
- return this.#S(t, (e) => {
577
- const s = this.#s[this.#u({ layer: e })];
578
- if (t.page === "both") {
579
- s.fore.clearLay(t), s.back.clearLay(t);
580
- return;
581
- }
582
- s.getPage(t).clearLay(t);
583
- }), !1;
584
- }
585
- //===================================================
586
- //MARK: WebGL フラグメントシェーダー GLSL
587
- static #F = (
588
- /* glsl */
589
- `
590
- precision mediump float;
591
-
592
- varying vec2 vTextureCoord;
593
- uniform sampler2D uSampler;
594
-
595
- uniform sampler2D rule;
596
- uniform float vague;
597
- uniform float tick;
598
-
599
- uniform vec4 inputPixel;
600
- uniform highp vec4 outputFrame;
601
- vec2 getUV(vec2 coord) {
602
- return coord * inputPixel.xy / outputFrame.zw;
603
- }
604
-
605
- void main() {
606
- vec4 fg = texture2D(uSampler, vTextureCoord);
607
- vec4 ru = texture2D(rule, getUV(vTextureCoord));
608
-
609
- float v = ru.r - tick;
610
- gl_FragColor = abs(v) < vague
611
- ? vec4(fg.rgb, 1) *fg.a *(0.5 +v /vague *0.5)
612
- : 0.0 <= v ? fg : vec4(0);
613
- }`
614
- );
615
- /*
616
- 末尾が読みづらいが、以下のif文を消して三項演算子にしている。
617
-
618
- if (abs(v) < vague) {
619
- float f_a = fg.a *(0.5 +v /vague *0.5);
620
- gl_FragColor.rgb = fg.rgb *f_a;
621
- gl_FragColor.a = f_a;
622
- return;
623
- }
624
- gl_FragColor = v >= 0.0 ? fg : vec4(0);
625
-
626
- ★GLSL : don't use "if"|Nobu note.com/nobuhirosaijo/n/n606a3f5d8e89
627
- > if文はあまり使わない方がいいらしい (処理負荷が高い)
628
- */
629
- #L = W.create({
630
- width: _.stageW,
631
- height: _.stageH
632
- });
633
- #T = new q(this.#L);
634
- #g = W.create({
635
- width: _.stageW,
636
- height: _.stageH
637
- });
638
- #a = new q(this.#g);
639
- //MARK: ページ裏表を交換
640
- #G(t) {
641
- const { layer: e } = t, s = /* @__PURE__ */ new Set(), i = this.#p(e).map((y) => (s.add(y), this.#s[y].fore)), n = () => {
642
- [this.#t, this.#i] = [this.#i, this.#t];
643
- const y = [];
644
- for (const [$, T] of Object.entries(this.#s)) {
645
- if (s.has($)) {
646
- T.transPage(y);
647
- continue;
648
- }
649
- const { fore: { ctn: P }, back: { ctn: D } } = T, z = this.#t.getChildIndex(D);
650
- this.#t.removeChild(D), this.#i.removeChild(P), this.#t.addChildAt(P, z), this.#i.addChildAt(D, z);
651
- }
652
- Promise.allSettled(y).then(() => {
653
- this.#t.visible = !0, this.#i.visible = !1, this.#T.visible = !1, this.#a.visible = !1, C.notifyEndProc(R);
654
- });
655
- };
656
- if (this.#a.filters = [], this.#a.alpha = 1, x(t, "time", 0) === 0 || this.#d.isSkipping)
657
- return n(), !1;
658
- const r = [], c = this.#r.map((y) => {
659
- const { fore: $, back: T } = this.#s[y], P = s.has(y) ? T : $;
660
- return P.ctn.visible && r.push(P.ctn), P;
661
- }), { ticker: h, renderer: f } = this.appPixi;
662
- f.render(this.#i, { renderTexture: this.#L });
663
- let l = () => {
664
- for (const y of r) f.render(
665
- y,
666
- { renderTexture: this.#L, clear: !1 }
667
- );
668
- };
669
- if (!c.some((y) => y.containMovement)) {
670
- const y = l;
671
- l = () => {
672
- l = () => {
673
- }, y();
674
- };
675
- }
676
- const d = () => f.render(this.#t, { renderTexture: this.#g });
677
- d();
678
- let u = () => {
679
- this.#t.visible = !0, d(), this.#t.visible = !1;
680
- };
681
- if (!i.some((y) => y.containMovement)) {
682
- const y = u;
683
- u = () => {
684
- u = () => {
685
- }, y();
686
- };
687
- }
688
- const a = () => {
689
- l(), this.#T.visible = !0, u(), this.#a.visible = !0;
690
- }, { glsl: b, rule: k } = t, v = () => {
691
- h.remove(a), n();
692
- };
693
- if (!b && !k)
694
- return w.tween(R, t, this.#a, { alpha: 0 }, () => {
695
- }, v, () => {
696
- }), h.add(a), !1;
697
- const S = {
698
- rule: at.EMPTY,
699
- vague: x(t, "vague", 0.04),
700
- tick: 0
701
- };
702
- this.#a.filters = [new nt(
703
- void 0,
704
- b ?? Z.#F,
705
- S
706
- )];
707
- const V = w.tween(R, t, S, { tick: 1 }, () => {
708
- }, v, () => {
709
- }, !k);
710
- return k ? new E(k, void 0, (y) => {
711
- S.rule = y.texture, y.destroy(), V.start(), h.add(a);
712
- }, (y) => {
713
- y && this.main.resume();
714
- }).ret : (h.add(a), !1);
715
- }
716
- #p(t = "") {
717
- return t ? t.split(",") : this.#r;
718
- }
719
- #S(t, e) {
720
- const s = this.#p(t.layer);
721
- for (const i of s) {
722
- const n = this.#s[i];
723
- if (!n) throw `存在しないlayer【${i}】です`;
724
- e(i, n);
725
- }
726
- return s;
727
- }
728
- #U(t = "") {
729
- return this.#p(t).sort((e, s) => {
730
- const i = this.#t.getChildIndex(this.#s[e].fore.ctn), n = this.#t.getChildIndex(this.#s[s].fore.ctn);
731
- return i < n ? -1 : i > n ? 1 : 0;
732
- });
733
- }
734
- setAllStyle2TxtLay(t) {
735
- for (const e of this.#r) {
736
- const s = this.#s[e].fore;
737
- s instanceof N && s.lay({ style: t });
738
- }
739
- }
740
- //MARK: 画面を揺らす
741
- #q(t) {
742
- if (x(t, "time", NaN) === 0) return !1;
743
- const e = this.#p(t.layer).map((f) => this.#s[f].fore.ctn), { renderer: s, ticker: i } = this.appPixi;
744
- this.#g.resize(_.stageW, _.stageH);
745
- const n = () => {
746
- this.#t.visible = !0;
747
- for (const f of e) s.render(
748
- f,
749
- { renderTexture: this.#g, clear: !1 }
750
- );
751
- this.#t.visible = !1;
752
- };
753
- this.#a.visible = !0, this.#a.alpha = 1;
754
- const o = O(x(t, "hmax", 10)), r = O(x(t, "vmax", 10)), c = o === 0 ? () => {
755
- } : () => {
756
- this.#a.x = Math.round(Math.random() * o * 2) - o;
757
- }, h = r === 0 ? () => {
758
- } : () => {
759
- this.#a.y = Math.round(Math.random() * r * 2) - r;
760
- };
761
- return this.#a.filters = [], w.tween(R, t, this.#a, { x: 0, y: 0 }, () => {
762
- c(), h();
763
- }, () => {
764
- i.remove(n), this.#t.visible = !0, this.#a.visible = !1, this.#a.x = 0, this.#a.y = 0, C.notifyEndProc(R);
765
- }, () => {
766
- }), i.add(n), !1;
767
- }
768
- //MARK: トゥイーン開始
769
- #J(t) {
770
- const { layer: e, render: s, name: i } = t;
771
- if (!e) throw "layerは必須です";
772
- const n = this.#s[this.#u(t)], o = n.fore;
773
- let r = () => {
774
- };
775
- s && (this.#d.isSkipping ? o.renderStart(!0) : (o.renderStart(!1), r = () => o.renderEnd()));
776
- const c = w.cnvTweenArg(t, o), h = g(t, "arrive", !1), f = g(t, "backlay", !1), l = n.back.ctn;
777
- return w.tween(i ?? e, t, o, w.cnvTweenArg(t, o), () => {
778
- }, r, () => {
779
- if (h && Object.assign(o, c), f) for (const d of w.aLayerPrpNm) l[d] = o[d];
780
- }), "filter" in t && (o.ctn.filters = [J.bldFilters(t)], o.aFltHArg = [t]), !1;
781
- }
782
- //MARK: フィルター追加
783
- #X(t) {
784
- return this.#S(t, (e) => {
785
- const s = this.#s[this.#u({ layer: e })];
786
- if (t.page === "both") {
787
- this.#P(s.fore, t), this.#P(s.back, t);
788
- return;
789
- }
790
- const i = s.getPage(t);
791
- this.#P(i, t);
792
- }), !1;
793
- }
794
- #P(t, e) {
795
- const s = t.ctn;
796
- s.filters ??= [], s.filters = [...s.filters, J.bldFilters(e)], t.aFltHArg.push(e);
797
- }
798
- //MARK: フィルター全削除
799
- #Y(t) {
800
- return this.#S(t, (e) => {
801
- const s = this.#s[this.#u({ layer: e })];
802
- if (t.page === "both") {
803
- const n = s.fore, o = s.back;
804
- n.ctn.filters = null, o.ctn.filters = null, n.aFltHArg = [], o.aFltHArg = [];
805
- return;
806
- }
807
- const i = s.getPage(t);
808
- i.ctn.filters = null, i.aFltHArg = [];
809
- }), !1;
810
- }
811
- //MARK: フィルター個別切替
812
- #K(t) {
813
- return this.#S(t, (e) => {
814
- const s = this.#s[this.#u({ layer: e })];
815
- if (t.page === "both") {
816
- this.#R(s.fore, t), this.#R(s.back, t);
817
- return;
818
- }
819
- const i = s.getPage(t);
820
- this.#R(i, t);
821
- }), !1;
822
- }
823
- #R(t, e) {
824
- const s = t.ctn;
825
- if (!s.filters) throw "フィルターがありません";
826
- const i = O(x(e, "index", 0)), n = s.filters.length;
827
- if (n <= i) throw `フィルターの個数(${String(n)})を越えています`;
828
- t.aFltHArg[i].enabled = s.filters[i].enabled = g(e, "enabled", !0);
829
- }
830
- // // 文字・文字レイヤ
831
- //MARK: 文字を追加する
832
- #I(t) {
833
- const { text: e } = t;
834
- if (!e) throw "textは必須です";
835
- const s = this.#h(t);
836
- delete t.text, this.setNormalChWait(), this.#d.isSkipping ? t.wait = 0 : "wait" in t && x(t, "wait", NaN), this.#n("add|" + L(t), s);
837
- const i = g(t, "record", !0), n = this.val.doRecLog();
838
- return i || this.val.setVal_Nochk("save", "sn.doRecLog", i), s.tagCh(e.replaceAll("[r]", `
839
- `)), this.val.setVal_Nochk("save", "sn.doRecLog", n), this.#n("add_close|", s), !1;
840
- }
841
- #h = (t) => {
842
- throw this.#C(), 0;
843
- };
844
- #Q(t) {
845
- const e = this.#u(t, this.#v), i = this.#s[e].getPage(t);
846
- if (!(i instanceof N)) throw e + "はTxtLayerではありません";
847
- return i;
848
- }
849
- setNormalChWait() {
850
- N.msecChWait = this.scrItr.normalWait;
851
- }
852
- //MARK: 操作対象のメッセージレイヤの指定
853
- #D = (t) => {
854
- throw this.#C(), 0;
855
- };
856
- #Z(t) {
857
- const { layer: e } = t;
858
- if (!e) throw "[current] layerは必須です";
859
- const s = this.#s[e];
860
- if (!s || !(s.getPage(t) instanceof N)) throw `${e}はTxtLayerではありません`;
861
- this.#x = s, this.#l.pagebreak(), this.#v = e, this.val.setVal_Nochk("save", "const.sn.mesLayer", e);
862
- for (const i of this.#r) {
863
- const { fore: n, back: o } = this.#s[i];
864
- n instanceof N && (n.isCur = o.isCur = i === e);
865
- }
866
- return !1;
867
- }
868
- get currentTxtlayForeNeedErr() {
869
- return this.#C(), this.currentTxtlayFore;
870
- }
871
- get currentTxtlayFore() {
872
- return this.#x ? this.#x.fore : null;
873
- }
874
- #x = void 0;
875
- // カレントテキストレイヤ
876
- #C = () => {
877
- throw "文字レイヤーがありません。文字表示や操作する前に、[add_lay layer=(レイヤ名) class=txt]で文字レイヤを追加して下さい";
878
- };
879
- #u(t, e = "") {
880
- const s = t.layer ?? e;
881
- if (s.includes(",")) throw "layer名に「,」は使えません";
882
- if (!(s in this.#s)) throw "属性 layer【" + s + "】が不正です。レイヤーがありません";
883
- return t.layer = s, s;
884
- }
885
- recPagebreak() {
886
- this.#l.pagebreak();
887
- }
888
- //MARK: 文字消去
889
- #M(t) {
890
- const e = this.#h(t);
891
- return t.layer === this.#v && t.page === "fore" && this.#l.pagebreak(), e.clearText(), !1;
892
- }
893
- //MARK: ハイパーリンクの終了
894
- #A(t) {
895
- return this.#n("endlink|", this.#h(t)), !1;
896
- }
897
- //MARK: ページ両面の文字消去
898
- #tt(t) {
899
- return g(t, "rec_page_break", !0) && this.#l.pagebreak(), this.#x && (this.#x.fore.clearLay(t), this.#x.back.clearLay(t)), !1;
900
- }
901
- //MARK: インライン画像表示
902
- #et(t) {
903
- if (!t.pic) throw "[graph] picは必須です";
904
- return this.#n("grp|" + L(t), this.#h(t)), !1;
905
- }
906
- //MARK: ハイパーリンク
907
- #st(t) {
908
- if (!t.fn && !t.label && !t.url) throw "fn,label,url いずれかは必須です";
909
- return t.fn ??= this.scrItr.scriptFn, t.style ??= "background-color: rgba(255,0,0,0.5);", t.style_hover ??= "background-color: rgba(255,0,0,0.9);", t.style_clicked ??= t.style, this.#n("link|" + L(t), this.#h(t)), !1;
910
- }
911
- //MARK: 改行
912
- #it(t) {
913
- return this.#I({ ...t, text: `
914
- ` });
915
- }
916
- //MARK: 文字列と複数ルビの追加
917
- #at(t) {
918
- const { t: e, r: s } = t;
919
- if (!e) throw "[ruby2] tは必須です";
920
- if (!s) throw "[ruby2] rは必須です";
921
- return t.text = "|" + encodeURIComponent(e) + "《" + encodeURIComponent(s) + "》", delete t.t, delete t.r, this.#I(t);
922
- }
923
- //MARK: インラインスタイル設定
924
- #nt(t) {
925
- return this.#n("span|" + L(t), this.#h(t)), !1;
926
- }
927
- //MARK: tcy縦中横を表示する
928
- #rt(t) {
929
- if (!t.t) throw "[tcy] tは必須です";
930
- return this.#n("tcy|" + L(t), this.#h(t)), !1;
931
- }
932
- //MARK: レイヤのダンプ
933
- #ot({ layer: t }) {
934
- console.group("🥟 [dump_lay]");
935
- for (const e of this.#p(t)) {
936
- const { fore: s, back: i } = this.#s[e];
937
- try {
938
- console.info(
939
- `%c${s.name.slice(0, -7)} %o`,
940
- `color:#${_.isDarkMode ? "49F" : "05A"};`,
941
- JSON.parse(`{"back":{${i.dump()}}, "fore":{${s.dump()}}}`)
942
- );
943
- } catch (n) {
944
- console.error("dump_lay err:%o", n), console.error(` back:${i.dump()}`), console.error(` fore:${s.dump()}`);
945
- }
946
- }
947
- return console.groupEnd(), !1;
948
- }
949
- //MARK: イベント有無の切替
950
- #ct(t) {
951
- const e = this.#u(t, this.#v), s = g(t, "enabled", !0);
952
- return this.#h(t).enabled = s, this.val.setVal_Nochk("save", "const.sn.layer." + e + ".enabled", s), !1;
953
- }
954
- //MARK: ボタンを表示
955
- #lt(t) {
956
- return I.argChk_page(t, "back"), t.fn ??= this.scrItr.scriptFn, this.#h(t).addButton(t), this.scrItr.recodeDesign(t), !1;
957
- }
958
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
959
- record() {
960
- const t = {};
961
- for (const e of this.#r) {
962
- const s = this.#s[e];
963
- t[e] = {
964
- cls: s.cls,
965
- fore: s.fore.record(),
966
- back: s.back.record()
967
- };
968
- }
969
- return t;
970
- }
971
- playback(t) {
972
- this.#l.playback();
973
- const e = [], s = [];
974
- for (const [n, { fore: o, fore: { idx: r }, back: c, cls: h }] of Object.entries(t)) {
975
- s.push({ ln: n, idx: r });
976
- const f = this.#s[n] ??= new I(n, h, this.#t, this.#i, {}, this.sys, this.val, { isWait: !1 });
977
- f.fore.playback(o, e), f.back.playback(c, e);
978
- }
979
- const i = this.#t.children.length;
980
- return e.push(new Promise((n) => {
981
- for (const { ln: o, idx: r } of s.sort(({ idx: c }, { idx: h }) => c === h ? 0 : c < h ? -1 : 1)) {
982
- const c = this.#s[o];
983
- if (!c) continue;
984
- const h = i > r ? r : i - 1, { fore: f, back: l } = c;
985
- this.#t.setChildIndex(f.ctn, h), this.#i.setChildIndex(l.ctn, h);
986
- }
987
- n();
988
- })), e;
989
- }
1
+ import { c as argChk_Color, g as uint, h as parseColor, l as argChk_Num, o as addStyle, s as argChk_Boolean, t as CmnLib, u as getDateStr } from "./CmnLib.js";
2
+ import { c as Loader, d as RenderTexture, f as Texture, l as LoaderResource, m as Container, o as Sprite, p as autoDetectRenderer, s as Graphics, u as Filter } from "./pixi.js";
3
+ import { t as EventListenerCtn } from "./EventListenerCtn.js";
4
+ import { n as SEARCH_PATH_ARG_EXT } from "./ConfigBase.js";
5
+ import { t as Layer } from "./Layer.js";
6
+ import "./DebugMng.js";
7
+ import { i as TW_NM_TRANS, 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
+ import { TxtLayer, t as TxtStage } from "./TxtLayer.js";
12
+ import { GrpLayer, t as DesignCast } from "./GrpLayer.js";
13
+ import { n as PROTOCOL_DL, r as PROTOCOL_USERDATA } from "./Config.js";
14
+ var Pages = class e {
15
+ #e;
16
+ constructor(e, m, h, g, _, y, b, x) {
17
+ this.cls = m, this.hArg = _, this.sys = y, this.val = b, this.ret = x;
18
+ let S = y.hFactoryCls[m];
19
+ if (!S) throw `属性 class【${m}】が不正です`;
20
+ let C = S(), w = S();
21
+ C.layname = w.layname = e;
22
+ let T = _[":id_tag"] = `layer:${e} cls:${m} page:`;
23
+ C.ctn.name = C.name = T + "A", w.ctn.name = w.name = T + "B", h.addChild(C.ctn), g.addChild(w.ctn), argChk_Boolean(_, "visible", !0), argChk_Boolean(_, "visible", !0), x.isWait = C.lay(_) || w.lay(_), this.#e = {
24
+ fore: C,
25
+ back: w
26
+ }, g.visible = !1;
27
+ let E = `const.sn.lay.${e}`;
28
+ b.setVal_Nochk("tmp", E, !0), b.defTmp(E + ".fore.alpha", () => this.#e.fore.alpha), b.defTmp(E + ".back.alpha", () => this.#e.back.alpha), b.defTmp(E + ".fore.height", () => this.#e.fore.height), b.defTmp(E + ".back.height", () => this.#e.back.height), b.defTmp(E + ".fore.visible", () => this.#e.fore.ctn.visible), b.defTmp(E + ".back.visible", () => this.#e.back.ctn.visible), b.defTmp(E + ".fore.width", () => this.#e.fore.width), b.defTmp(E + ".back.width", () => this.#e.back.width), b.defTmp(E + ".fore.x", () => this.#e.fore.x), b.defTmp(E + ".back.x", () => this.#e.back.x), b.defTmp(E + ".fore.y", () => this.#e.fore.y), b.defTmp(E + ".back.y", () => this.#e.back.y);
29
+ }
30
+ destroy() {
31
+ this.#e.fore.destroy(), this.#e.back.destroy();
32
+ }
33
+ lay = (e) => this.getPage(e).lay(e);
34
+ getPage = (m) => e.argChk_page(m, "fore") === "back" ? this.#e.back : this.#e.fore;
35
+ static argChk_page(e, m) {
36
+ let h = e.page ?? m;
37
+ if (h === "fore" || h === "back") return e.page = h, h;
38
+ throw Error("属性 page【" + h + "】が不正です");
39
+ }
40
+ get fore() {
41
+ return this.#e.fore;
42
+ }
43
+ get back() {
44
+ return this.#e.back;
45
+ }
46
+ transPage(e) {
47
+ [this.#e.back, this.#e.fore] = [this.#e.fore, this.#e.back], this.#e.back.copy(this.#e.fore, e);
48
+ }
49
+ }, FrameMng = class e {
50
+ static #e;
51
+ static #t;
52
+ static #n;
53
+ static init(m, h, g) {
54
+ e.#e = m, e.#t = h, e.#n = g;
55
+ }
56
+ constructor(e, m, h) {
57
+ this.appPixi = m, this.val = h, e.add_frame = (e) => this.#o(e), e.let_frame = (e) => this.#f(e), e.set_frame = (e) => this.#p(e), e.frame = (e) => this.#h(e), e.tsy_frame = (e) => this.#g(e);
58
+ }
59
+ #r;
60
+ setEvtMng(e) {
61
+ this.#r = e;
62
+ }
63
+ #i = Object.create(null);
64
+ destroy() {
65
+ for (let e of Object.values(this.#i)) e.parentElement.removeChild(e);
66
+ this.#i = Object.create(null);
67
+ }
68
+ hideAllFrame() {
69
+ for (let [e, { style: m }] of Object.entries(this.#i)) this.#a[e] = m.display !== "none", m.display = "none";
70
+ }
71
+ #a = Object.create(null);
72
+ restoreAllFrame() {
73
+ for (let [e, m] of Object.entries(this.#a)) {
74
+ let h = this.#i[e];
75
+ h && (h.style.display = m ? "inline" : "none");
76
+ }
77
+ this.#a = Object.create(null);
78
+ }
79
+ #o(m) {
80
+ let { id: h, src: g, alpha: _ = 1, scale_x: y = 1, scale_y: b = 1, rotate: S = 0 } = m;
81
+ if (!h) throw "idは必須です";
82
+ if (!g) throw "srcは必須です";
83
+ let C = "const.sn.frm." + h;
84
+ if (this.val.getVal(`tmp:${C}`)) throw `frame【${h}】はすでにあります`;
85
+ let T = argChk_Boolean(m, "visible", !0), E = m.b_color ? ` background-color: ${m.b_color};` : "", D = this.#c(m);
86
+ e.#n.cvs.insertAdjacentHTML("beforebegin", `<iframe id="${h}" style="opacity: ${String(_)}; ${E} position: absolute; left:${String(e.#t.ofsLeft4elm + D.x * e.#t.cvsScale)}px; top: ${String(e.#t.ofsTop4elm + D.y * e.#t.cvsScale)}px; z-index: 1; border: 0px; overflow: hidden; display: ${T ? "inline" : "none"}; transform: scale(${String(y)}, ${String(b)}) rotate(${String(S)}deg);" width="${String(D.width * e.#t.cvsScale)}" height="${String(D.height * e.#t.cvsScale)}"></iframe>`);
87
+ let O = Reading.procID + `add_frame id:${h}`;
88
+ Reading.beginProc(O);
89
+ let k = e.#e.searchPath(g, SEARCH_PATH_ARG_EXT.HTML), A = new Loader().add({
90
+ name: g,
91
+ url: k,
92
+ xhrType: LoaderResource.XHR_RESPONSE_TYPE.TEXT
93
+ });
94
+ return e.#t.arg.crypto && A.use((m, h) => void e.#t.dec(m.extension, m.data).then((e) => {
95
+ m.data = e, h();
96
+ }).catch((g) => {
97
+ e.#n.errScript(`[add_frame]Html ロード失敗です src:${m.name} ${String(g)}`, !1), h();
98
+ })), A.load((m, v) => {
99
+ let x = document.getElementById(h);
100
+ this.#i[h] = x, this.#s[h] = !1;
101
+ let w = k.lastIndexOf("/") + 1, E = k.slice(0, w), A = E.slice(0, w);
102
+ x.srcdoc = String(v[g]?.data).replace("sn_repRes();", "").replaceAll(/\s(?:src|href)=(["'])(\S+?)\1/g, (e, m, h) => h.startsWith("../") ? A + e.slice(3) : e.replace("./", "").replace(m, m + E)), x.srcdoc.includes("true/*WEBP*/;") && (x.srcdoc = x.srcdoc.replaceAll(/data-src="(.+?\.)(?:jpe?g|png)/g, (e, m) => `data-src="${m}webp`)), x.onload = () => {
103
+ Reading.endProc(O), this.val.setVal_Nochk("tmp", C, !0), this.val.setVal_Nochk("tmp", C + ".alpha", _), this.val.setVal_Nochk("tmp", C + ".x", D.x), this.val.setVal_Nochk("tmp", C + ".y", D.y), this.val.setVal_Nochk("tmp", C + ".scale_x", y), this.val.setVal_Nochk("tmp", C + ".scale_y", b), this.val.setVal_Nochk("tmp", C + ".rotate", S), this.val.setVal_Nochk("tmp", C + ".width", D.width), this.val.setVal_Nochk("tmp", C + ".height", D.height), this.val.setVal_Nochk("tmp", C + ".visible", T);
104
+ let m = x.contentWindow;
105
+ this.#r.resvFlameEvent(m.document.body), m.sn_repRes?.((m) => e.#l(m.dataset.src ?? "", m));
106
+ };
107
+ }), !0;
108
+ }
109
+ #s = {};
110
+ getFrmDisabled(e) {
111
+ return this.#s[e];
112
+ }
113
+ #c(e) {
114
+ let m = { ...e };
115
+ return new DOMRect(argChk_Num(m, "x", 0), argChk_Num(m, "y", 0), argChk_Num(m, "width", CmnLib.stageW), argChk_Num(m, "height", CmnLib.stageH));
116
+ }
117
+ static #l(m, h, g) {
118
+ let _ = this.#d[m];
119
+ if (_) {
120
+ h.src = _, g && (h.onload = () => g(h));
121
+ return;
122
+ }
123
+ let v = this.#u[m];
124
+ if (v) {
125
+ v.push(h);
126
+ return;
127
+ }
128
+ this.#u[m] = [h];
129
+ let [y = "", b = ""] = m.split("?"), S = e.#e.searchPath(y, SEARCH_PATH_ARG_EXT.SP_GSM), C = new Loader().add({
130
+ name: m,
131
+ url: S,
132
+ xhrType: LoaderResource.XHR_RESPONSE_TYPE.BUFFER
133
+ });
134
+ e.#t.use4ViteElectron(m, S, C, e.#n) || e.#t.arg.crypto && S.endsWith(".bin") && C.use((m, h) => {
135
+ if (m.extension !== "bin") {
136
+ h();
137
+ return;
138
+ }
139
+ e.#t.decAB(m.data).then((e) => {
140
+ m.data = e, e instanceof HTMLImageElement && (m.type = LoaderResource.TYPE.IMAGE), h();
141
+ }).catch((g) => {
142
+ e.#n.errScript(`FrameMng loadPic ロード失敗です fn:${m.name} ${String(g)}`, !1), h();
143
+ });
144
+ }), C.load((e, m) => {
145
+ for (let [e, { data: { src: h } }] of Object.entries(m)) {
146
+ let m = this.#d[e] = h + (h.startsWith("blob:") || h.startsWith("data:") ? "" : b ? "?" + b : ""), _ = this.#u[e];
147
+ if (_) for (let e of _) e.src = m, g && (e.onload = () => g(e));
148
+ delete this.#u[e];
149
+ }
150
+ });
151
+ }
152
+ static #u = {};
153
+ static #d = {};
154
+ cvsResize() {
155
+ for (let [m, h] of Object.entries(this.#i)) {
156
+ let g = "const.sn.frm." + m, _ = Number(this.val.getVal(g + ".x")), v = Number(this.val.getVal(g + ".y")), y = Number(this.val.getVal(g + ".width")), b = Number(this.val.getVal(g + ".height"));
157
+ h.style.left = `${String(e.#t.ofsLeft4elm + _ * e.#t.cvsScale)}px`, h.style.top = `${String(e.#t.ofsTop4elm + v * e.#t.cvsScale)}px`, h.width = String(y * e.#t.cvsScale), h.height = String(b * e.#t.cvsScale);
158
+ }
159
+ }
160
+ #f(e) {
161
+ let { id: m, var_name: h } = e;
162
+ if (!m) throw "idは必須です";
163
+ let g = document.getElementById(m);
164
+ if (!g) throw `id【${m}】はフレームではありません`;
165
+ let _ = "const.sn.frm." + m;
166
+ if (!this.val.getVal(`tmp:${_}`)) throw `frame【${m}】が読み込まれていません`;
167
+ if (!h) throw "var_nameは必須です";
168
+ let y = g.contentWindow;
169
+ if (!Object.hasOwn(y, h)) throw `frame【${m}】に変数/関数【${h}】がありません。変数は var付きにして下さい`;
170
+ let b = y[h];
171
+ return this.val.setVal_Nochk("tmp", _ + "." + h, argChk_Boolean(e, "function", !1) ? b() : b), !1;
172
+ }
173
+ #p(e) {
174
+ let { id: m, var_name: h, text: g } = e;
175
+ if (!m) throw "idは必須です";
176
+ let _ = document.getElementById(m);
177
+ if (!_) throw `id【${m}】はフレームではありません`;
178
+ let v = "const.sn.frm." + m;
179
+ if (!this.val.getVal(`tmp:${v}`)) throw `frame【${m}】が読み込まれていません`;
180
+ if (!h) throw "var_nameは必須です";
181
+ if (!g) throw "textは必須です";
182
+ this.val.setVal_Nochk("tmp", v + "." + h, g);
183
+ let y = _.contentWindow;
184
+ return y[h] = g, !1;
185
+ }
186
+ #m = 1;
187
+ #h(m) {
188
+ let { id: h } = m;
189
+ if (!h) throw "idは必須です";
190
+ let _ = document.getElementById(h);
191
+ if (!_) throw `id【${h}】はフレームではありません`;
192
+ let y = "const.sn.frm." + h;
193
+ if (!this.val.getVal("tmp:" + y)) throw `frame【${h}】が読み込まれていません`;
194
+ let b = _.style;
195
+ if (argChk_Boolean(m, "float", !1) ? b.zIndex = String(++this.#m) : "index" in m ? b.zIndex = String(argChk_Num(m, "index", 0)) : m.dive && (b.zIndex = String(-++this.#m)), "alpha" in m) {
196
+ let e = b.opacity = String(m.alpha);
197
+ this.val.setVal_Nochk("tmp", y + ".alpha", e);
198
+ }
199
+ let x = this.#c(m);
200
+ if (("x" in m || "y" in m) && (b.left = `${String(e.#t.ofsLeft4elm + x.x * e.#t.cvsScale)}px`, b.top = `${String(e.#t.ofsTop4elm + x.y * e.#t.cvsScale)}px`, this.val.setVal_Nochk("tmp", y + ".x", x.x), this.val.setVal_Nochk("tmp", y + ".y", x.y)), "scale_x" in m || "scale_y" in m || "rotate" in m) {
201
+ let e = argChk_Num(m, "scale_x", 1), h = argChk_Num(m, "scale_y", 1), _ = argChk_Num(m, "rotate", 0);
202
+ b.transform = `scale(${String(e)}, ${String(h)}) rotate(${String(_)}deg)`, this.val.setVal_Nochk("tmp", y + ".scale_x", e), this.val.setVal_Nochk("tmp", y + ".scale_y", h), this.val.setVal_Nochk("tmp", y + ".rotate", _);
203
+ }
204
+ if ("width" in m && (_.width = String(x.width * e.#t.cvsScale), this.val.setVal_Nochk("tmp", y + ".width", x.width)), "height" in m && (_.height = String(x.height * e.#t.cvsScale), this.val.setVal_Nochk("tmp", y + ".height", x.height)), "visible" in m) {
205
+ let e = argChk_Boolean(m, "visible", !0);
206
+ b.display = e ? "inline" : "none", this.val.setVal_Nochk("tmp", y + ".visible", e);
207
+ }
208
+ if ("b_color" in m && (b.backgroundColor = m.b_color), "disabled" in m) {
209
+ let e = this.#s[h] = argChk_Boolean(m, "disabled", !0), g = _.contentDocument.body;
210
+ for (let m of [...Array.from(g.getElementsByTagName("input")), ...Array.from(g.getElementsByTagName("select"))]) m.disabled = e;
211
+ }
212
+ return !1;
213
+ }
214
+ #g(m) {
215
+ let { id: h, alpha: _, x: v, y, scale_x: b, scale_y: x, rotate: S, width: C, height: w } = m;
216
+ if (!h) throw "idは必須です";
217
+ let T = document.getElementById(h);
218
+ if (!T) throw `id【${h}】はフレームではありません`;
219
+ let E = "const.sn.frm." + h;
220
+ if (!this.val.getVal(`tmp:${E}`, 0)) throw `frame【${h}】が読み込まれていません`;
221
+ let D = {};
222
+ _ && (D.a = Number(T.style.opacity)), (v || y || b || x || S) && (D.x = Number(this.val.getVal(`tmp:${E}.x`)), D.y = Number(this.val.getVal(`tmp:${E}.y`)), D.sx = Number(this.val.getVal(`tmp:${E}.scale_x`)), D.sy = Number(this.val.getVal(`tmp:${E}.scale_y`)), D.r = Number(this.val.getVal(`tmp:${E}.rotate`))), C && (D.w = Number(this.val.getVal(`tmp:${E}.width`))), w && (D.h = Number(this.val.getVal(`tmp:${E}.height`)));
223
+ let O = CmnTween.cnvTweenArg(m, D), k = {}, A = (e) => {};
224
+ _ && (k.a = argChk_Num(O, "alpha", 0), A = (e) => {
225
+ T.style.opacity = String(e.a), this.val.setVal_Nochk("tmp", "alpha", e.a);
226
+ });
227
+ let j = (e) => {}, M = this.#c(O);
228
+ (v || y || b || x || S) && (k.x = M.x, k.y = M.y, k.sx = argChk_Num(O, "scale_x", 1), k.sy = argChk_Num(O, "scale_y", 1), k.r = argChk_Num(O, "rotate", 0), j = (m) => {
229
+ T.style.left = `${String(e.#t.ofsLeft4elm + m.x * e.#t.cvsScale)} px`, T.style.top = `${String(e.#t.ofsTop4elm + m.y * e.#t.cvsScale)} px`, T.style.transform = `scale(${String(m.sx)}, ${String(m.sy)}) rotate(${String(m.r)}deg)`, this.val.setVal_Nochk("tmp", E + ".x", m.x), this.val.setVal_Nochk("tmp", E + ".y", m.y), this.val.setVal_Nochk("tmp", E + ".scale_x", m.sx), this.val.setVal_Nochk("tmp", E + ".scale_y", m.sy), this.val.setVal_Nochk("tmp", E + ".rotate", m.r);
230
+ });
231
+ let N = (e) => {};
232
+ C && (k.w = M.width, N = (m) => {
233
+ T.width = `${String(m.w * e.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", E + ".width", m.w);
234
+ });
235
+ let P = (e) => {};
236
+ return w && (k.h = M.height, P = (m) => {
237
+ T.height = `${String(m.h * e.#t.cvsScale)} px`, this.val.setVal_Nochk("tmp", E + ".height", m.h);
238
+ }), this.appPixi.stage.interactive = !1, CmnTween.tween(`frm\n${h}`, m, D, CmnTween.cnvTweenArg(m, D), (e) => {
239
+ A(e), j(e), N(e), P(e);
240
+ }, () => {
241
+ this.appPixi.stage.interactive = !0;
242
+ }, () => {}), !1;
243
+ }
244
+ }, Log = class {
245
+ #e = { text: "" };
246
+ #t = [];
247
+ constructor(e, m, h) {
248
+ this.oCfg = e, this.hTag = m, this.val = h, m.rec_ch = (e) => this.#n(e), m.rec_r = (e) => this.#r(e), m.reset_rec = (e) => this.#i(e), h.defTmp("const.sn.log.json", () => {
249
+ this.#e.text = this.#e.text.replaceAll("</span><span class='sn_ch'>", "");
250
+ let e = [...this.#t, this.#e];
251
+ return JSON.stringify(e);
252
+ }), this.recText("");
253
+ }
254
+ recText(e) {
255
+ this.#e.text = e, this.val.setVal_Nochk("save", "const.sn.sLog", String(this.val.getVal("const.sn.log.json")));
256
+ }
257
+ #n(e) {
258
+ return this.#e = {
259
+ ...e,
260
+ text: this.#e.text
261
+ }, e.text ? (e.record = !0, e.style ??= "", e.style += "display: none;", e.wait = 0, this.hTag.ch(e)) : (this.val.setVal_Nochk("save", "const.sn.sLog", String(this.val.getVal("const.sn.log.json"))), !1);
262
+ }
263
+ #r(e) {
264
+ return this.#n({
265
+ ...e,
266
+ text: "[r]"
267
+ });
268
+ }
269
+ #i(e) {
270
+ return this.#t = [], e.text ??= "", this.#e = { text: e.text }, this.val.setVal_Nochk("save", "const.sn.sLog", JSON.stringify([this.#e])), !1;
271
+ }
272
+ pagebreak() {
273
+ this.#e.text = this.#e.text.replaceAll("</span><span class='sn_ch'>", ""), this.#e.text && (this.#t.push(this.#e) > this.oCfg.log.max_len && (this.#t = this.#t.slice(-this.oCfg.log.max_len)), this.#e = { text: "" });
274
+ }
275
+ playback() {
276
+ this.#t = JSON.parse(String(this.val.getVal("save:const.sn.sLog"))), this.#e = { text: "" };
277
+ }
278
+ };
279
+ function cnvSArg(e) {
280
+ return encodeURIComponent(JSON.stringify(e));
990
281
  }
991
- export {
992
- Z as LayerMng
282
+ var LayerMng = class x {
283
+ #e;
284
+ #t = new Container();
285
+ #n = new Container();
286
+ #r;
287
+ #i;
288
+ #a;
289
+ #o = new EventListenerCtn();
290
+ constructor(e, m, g, _, v, b, x, S, C) {
291
+ this.cfg = e, this.hTag = m, this.appPixi = g, this.val = _, this.main = v, this.scrItr = b, this.sys = x;
292
+ let w = () => {
293
+ if (x.cvsResize(), this.cvsResizeDesign(), this.#l) for (let e of this.#S) this.#x[e].fore.cvsResizeChildren();
294
+ else for (let e of this.#S) this.#x[e].fore.cvsResize();
295
+ this.#r.cvsResize(), this.#f.cvsResize();
296
+ };
297
+ if (CmnLib.isMobile) this.#o.add(globalThis, "orientationchange", w, { passive: !0 });
298
+ else {
299
+ let e;
300
+ this.#o.add(globalThis, "resize", () => {
301
+ e ||= setTimeout(() => {
302
+ e = void 0, w();
303
+ }, 1e3 / 60 * 10);
304
+ }, { passive: !0 });
305
+ }
306
+ x.cvsResize(), this.#a = new Log(this.cfg.oCfg, m, _), TxtLayer.init(e, m, _, this.#a, (e) => this.#x[e.layname].fore === e, g), GrpLayer.init(v, e, g, x, S, _), FrameMng.init(e, x, v), this.#r = new FrameMng(m, g, _), m.loadplugin = (e) => this.#y(e), m.snapshot = (e) => this.#h(e), this.#g = this.sys.isApp ? (e, m, h, g, _) => this.#_(e, m, h, g, _) : (e, m, h, g, _) => this.#v(e, m, h, g, _), m.add_lay = (e) => this.#b(e), m.clear_lay = (e) => this.#D(e), m.finish_trans = () => !1, m.lay = (e) => this.#T(e), m.trans = (e) => this.#N(e), m.wt = (e) => CmnTween.wt(e), m.quake = (e) => this.#L(e), m.stop_quake = m.finish_trans, m.wq = m.wt, m.pause_tsy = (e) => CmnTween.pause_tsy(e), m.resume_tsy = (e) => CmnTween.resume_tsy(e), m.stop_tsy = (e) => CmnTween.stop_tsy(e), m.tsy = (e) => this.#R(e), m.wait_tsy = (e) => CmnTween.wait_tsy(e), m.add_filter = (e) => this.#z(e), m.clear_filter = (e) => this.#V(e), m.enable_filter = (e) => this.#H(e), m.ch = (e) => this.#W(e), m.clear_text = (e) => this.#Q(e), m.current = (e) => this.#q(e), m.endlink = (e) => this.#$(e), m.er = (e) => this.#ee(e), m.graph = (e) => this.#te(e), m.link = (e) => this.#ne(e), m.r = (e) => this.#re(e), m.ruby2 = (e) => this.#ie(e), m.span = (e) => this.#ae(e), m.tcy = (e) => this.#oe(e), m.add_face = (e) => SpritesMng.add_face(e), m.wv = (e) => SpritesMng.wv(e), m.dump_lay = (e) => this.#se(e), m.enable_event = (e) => this.#ce(e), m.button = (e) => this.#le(e), e.existsBreakline && (this.breakLine = (e) => {
307
+ delete e.visible, e.id = "break", e.pic = "breakline", this.#m("grp|" + cnvSArg(e));
308
+ }), e.existsBreakpage && (this.breakPage = (e) => {
309
+ delete e.visible, e.id = "break", e.pic = "breakpage", this.#m("grp|" + cnvSArg(e));
310
+ }), this.#i = parseColor(String(e.oCfg.init.bg_color));
311
+ let T = new Graphics();
312
+ T.beginFill(this.#i).lineStyle(0, this.#i).drawRect(0, 0, CmnLib.stageW, CmnLib.stageH).endFill(), this.#t.addChild(T.clone()), this.#n.addChild(T), this.#n.visible = !1, this.#t.name = "page:A", this.#n.name = "page:B", this.#e = g.stage, this.#e.addChild(this.#n), this.#e.addChild(this.#t), this.#e.addChild(this.#A), this.#e.addChild(this.#M), this.#e.name = "stage";
313
+ let E = (e, m) => {
314
+ this.#p(Number(m));
315
+ };
316
+ E("", _.getVal("sys:TextLayer.Back.Alpha", 1)), _.defValTrg("sys:TextLayer.Back.Alpha", E);
317
+ let D = (e, m) => {
318
+ Button.fontFamily = m;
319
+ };
320
+ D("", _.getVal("tmp:sn.button.fontFamily", Button.fontFamily)), _.defValTrg("tmp:sn.button.fontFamily", D), _.defTmp("const.sn.last_page_text", () => this.currentTxtlayFore?.pageText ?? ""), _.defTmp("const.sn.last_page_plain_text", () => this.currentTxtlayFore?.pagePlainText ?? ""), CmnLib.isDbg && (DesignCast.init(g, x, b, C, e, this.#x), this.cvsResizeDesign = () => DesignCast.cvsResizeDesign(), x.addHook((e, m) => {
321
+ this.#s[e]?.(e, m) && delete this.#s[e];
322
+ }));
323
+ }
324
+ cvsResizeDesign() {}
325
+ #s = {
326
+ attach: (e) => (DesignCast.leaveMode(), !1),
327
+ continue: (e) => (DesignCast.leaveMode(), !1),
328
+ disconnect: (e) => (DesignCast.leaveMode(), !1),
329
+ _enterDesign: (e) => {
330
+ DesignCast.enterMode();
331
+ for (let e of this.#S) {
332
+ let m = this.#x[e].fore;
333
+ m.makeDesignCastChildren((e) => e.make()), m.makeDesignCast((e) => e.make());
334
+ }
335
+ return this.#u(this.#C), !1;
336
+ },
337
+ _replaceToken: (e, m) => (DesignCast.replaceToken(m), !1),
338
+ _selectNode: (e, m) => (this.#u(m.node), !1)
339
+ };
340
+ #c = "";
341
+ #l = "";
342
+ #u(e) {
343
+ [this.#c = "", this.#l = ""] = e.split("/");
344
+ let m = this.#x[this.#c];
345
+ m && (DesignCast.allHide(), this.#l ? m.fore.showDesignCastChildren() : m.fore.showDesignCast());
346
+ }
347
+ getFrmDisabled = (e) => this.#r.getFrmDisabled(e);
348
+ #d = void 0;
349
+ cover(e, m = 0) {
350
+ this.#d &&= (this.#e.removeChild(this.#d), this.#d.destroy(), void 0), e && this.#e.addChild((this.#d = new Graphics()).beginFill(m).lineStyle(0, m).drawRect(0, 0, CmnLib.stageW, CmnLib.stageH).endFill());
351
+ }
352
+ #f;
353
+ setEvtMng(e) {
354
+ this.#f = e, this.#r.setEvtMng(e), SpritesMng.setEvtMng(e), CmnTween.init(e);
355
+ }
356
+ destroy() {
357
+ for (let e of Object.values(this.#x)) e.destroy();
358
+ this.#o.clear(), GrpLayer.destroy(), RubySpliter.destroy(), TxtStage.destroy(), TxtLayer.destroy(), this.#r.destroy(), CmnTween.destroy(), TxtLayer.msecChWait = 10;
359
+ }
360
+ #p(e) {
361
+ for (let m of this.#S) {
362
+ let { fore: h, back: g } = this.#x[m];
363
+ h instanceof TxtLayer && (h.chgBackAlpha(e), g.chgBackAlpha(e));
364
+ }
365
+ }
366
+ #m = (e, m = this.currentTxtlayForeNeedErr, h = !0) => m.tagCh("|&emsp;《" + e + "》");
367
+ goTxt = () => {};
368
+ get needGoTxt() {
369
+ return this.currentTxtlayFore?.needGoTxt ?? !1;
370
+ }
371
+ breakLine = (e) => {};
372
+ breakPage = (e) => {};
373
+ clearBreak() {
374
+ this.currentTxtlayFore && (this.clearBreak = () => this.#m("del|break"), this.clearBreak());
375
+ }
376
+ clickTxtLay() {
377
+ return this.currentTxtlayFore ? this.#S.map((e) => this.#x[e].fore).some((e) => e instanceof TxtLayer && e.click()) : !1;
378
+ }
379
+ #h(e) {
380
+ let m = getDateStr("-", "_", "", "_"), h = e.fn ? e.fn.startsWith("userdata:/") ? e.fn : `${PROTOCOL_DL + e.fn + m}.png` : `${PROTOCOL_DL}snapshot${m}.png`, _ = this.cfg.searchPath(h), v = argChk_Num(e, "width", CmnLib.stageW), x = argChk_Num(e, "height", CmnLib.stageH);
381
+ return this.#g(e, _, v, x, `snapshot dt:${m}`);
382
+ }
383
+ #g = () => !1;
384
+ #_({ layer: e }, m, h, g, _) {
385
+ if (this.#r.hideAllFrame(), Reading.beginProc(_), !e) return this.sys.capturePage(m, h, g, () => {
386
+ this.#r.restoreAllFrame(), Reading.endProc(_);
387
+ }), !0;
388
+ let v = this.#S.map((e) => {
389
+ let { ctn: m } = this.#x[e].fore, h = [m, m.visible];
390
+ return m.visible = !1, h;
391
+ });
392
+ for (let m of this.#P(e)) this.#x[m].fore.ctn.visible = !0;
393
+ return this.sys.capturePage(m, h, g, () => {
394
+ for (let [e, m] of v) e.visible = m;
395
+ this.#r.restoreAllFrame(), Reading.endProc(_);
396
+ }), !0;
397
+ }
398
+ #v(m, h, g, _, y) {
399
+ Reading.beginProc(y);
400
+ let b = argChk_Color(m, "b_color", this.#i), x = autoDetectRenderer({
401
+ width: g,
402
+ height: _,
403
+ backgroundAlpha: b > 16777216 && h.endsWith(".png") ? 0 : 1,
404
+ antialias: argChk_Boolean(m, "smoothing", !1),
405
+ preserveDrawingBuffer: !0,
406
+ backgroundColor: b & 16777215,
407
+ autoDensity: !0
408
+ }), C = m.page === "back" ? "back" : "fore", { layer: w } = m;
409
+ return Promise.allSettled(this.#P(w).map((e) => new Promise((m) => this.#x[e][C].snapshot(x, m)))).then(async () => {
410
+ let e = RenderTexture.create({
411
+ width: x.width,
412
+ height: x.height
413
+ });
414
+ x.render(this.#e, { renderTexture: e }), await this.sys.savePic(h, x.plugins.extract.base64(e)), e.destroy();
415
+ for (let e of this.#P(w)) this.#x[e][C].snapshot_end();
416
+ x.destroy(!0), Reading.endProc(y);
417
+ }), !0;
418
+ }
419
+ #y(e) {
420
+ let { fn: m } = e;
421
+ if (!m) throw "fnは必須です";
422
+ if (!m.endsWith(".css")) throw "サポートされない拡張子です";
423
+ let h = argChk_Boolean(e, "join", !0), g = Reading.procID + `loadplugin fn:${m}`;
424
+ return h && Reading.beginProc(g), (async () => {
425
+ let e = await fetch(m);
426
+ if (!e.ok) throw Error("Network response was not ok.");
427
+ addStyle(await e.text()), h && Reading.endProc(g);
428
+ })(), h;
429
+ }
430
+ #b(e) {
431
+ let { layer: m, class: h } = e;
432
+ if (!m) throw "layerは必須です";
433
+ if (m.includes(",")) throw "layer名に「,」は使えません";
434
+ if (m in this.#x) throw `layer【${m}】はすでにあります`;
435
+ if (!h) throw "clsは必須です";
436
+ let g = { isWait: !1 };
437
+ switch (this.#x[m] = new Pages(m, h, this.#t, this.#n, e, this.sys, this.val, g), this.#S.push(m), h) {
438
+ case "txt":
439
+ this.#C || (this.#X = () => {}, this.#G = (e) => this.#K(e), this.#q = (e) => this.#J(e), this.hTag.current({ layer: m }), this.goTxt = () => {
440
+ this.#f.isSkipping ? TxtLayer.msecChWait = 0 : this.setNormalChWait();
441
+ for (let e of this.#S) {
442
+ let m = this.#x[e].fore;
443
+ m instanceof TxtLayer && this.#m("gotxt|", m, !1);
444
+ }
445
+ }), this.val.setVal_Nochk("save", "const.sn.layer." + m + ".enabled", !0);
446
+ break;
447
+ case "grp":
448
+ if (this.#w) break;
449
+ this.#w = m;
450
+ break;
451
+ }
452
+ return this.scrItr.recodeDesign(e), g.isWait;
453
+ }
454
+ #x = {};
455
+ #S = [];
456
+ #C = "";
457
+ #w = "";
458
+ #T(e) {
459
+ let m = this.#Z(e), h = this.#x[m], _ = h.back.ctn, y = h.fore.ctn;
460
+ if (argChk_Boolean(e, "float", !1)) this.#n.setChildIndex(_, this.#n.children.length - 1), this.#t.setChildIndex(y, this.#t.children.length - 1), this.#E();
461
+ else if (e.index) argChk_Num(e, "index", 0) && (this.#n.setChildIndex(_, e.index), this.#t.setChildIndex(y, e.index), this.#E());
462
+ else if (e.dive) {
463
+ let { dive: h } = e, g = 0;
464
+ if (m === h) throw "[lay] 属性 layerとdiveが同じ【" + h + "】です";
465
+ let v = this.#x[h];
466
+ if (!v) throw "[lay] 属性 dive【" + h + "】が不正です。レイヤーがありません";
467
+ let b = v.back, x = v.fore, S = this.#n.getChildIndex(b.ctn), C = this.#t.getChildIndex(x.ctn);
468
+ g = S < C ? S : C, g > this.#n.getChildIndex(_) && --g, this.#t.setChildIndex(y, g), this.#n.setChildIndex(_, g), this.#E();
469
+ }
470
+ return e[":id_tag"] = h.fore.name.slice(0, -7), this.scrItr.recodeDesign(e), h.lay(e);
471
+ }
472
+ #E() {
473
+ this.#S = this.#I();
474
+ }
475
+ #D(e) {
476
+ return this.#F(e, (m) => {
477
+ let h = this.#x[this.#Z({ layer: m })];
478
+ if (e.page === "both") {
479
+ h.fore.clearLay(e), h.back.clearLay(e);
480
+ return;
481
+ }
482
+ h.getPage(e).clearLay(e);
483
+ }), !1;
484
+ }
485
+ static #O = "\nprecision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform sampler2D rule;\nuniform float vague;\nuniform float tick;\n\nuniform vec4 inputPixel;\nuniform highp vec4 outputFrame;\nvec2 getUV(vec2 coord) {\n return coord * inputPixel.xy / outputFrame.zw;\n}\n\nvoid main() {\n vec4 fg = texture2D(uSampler, vTextureCoord);\n vec4 ru = texture2D(rule, getUV(vTextureCoord));\n\n float v = ru.r - tick;\n gl_FragColor = abs(v) < vague\n ? vec4(fg.rgb, 1) *fg.a *(0.5 +v /vague *0.5)\n : 0.0 <= v ? fg : vec4(0);\n}";
486
+ #k = RenderTexture.create({
487
+ width: CmnLib.stageW,
488
+ height: CmnLib.stageH
489
+ });
490
+ #A = new Sprite(this.#k);
491
+ #j = RenderTexture.create({
492
+ width: CmnLib.stageW,
493
+ height: CmnLib.stageH
494
+ });
495
+ #M = new Sprite(this.#j);
496
+ #N(e) {
497
+ let { layer: m } = e, h = /* @__PURE__ */ new Set(), _ = this.#P(m).map((e) => (h.add(e), this.#x[e].fore)), v = () => {
498
+ [this.#t, this.#n] = [this.#n, this.#t];
499
+ let e = [];
500
+ for (let [m, g] of Object.entries(this.#x)) {
501
+ if (h.has(m)) {
502
+ g.transPage(e);
503
+ continue;
504
+ }
505
+ let { fore: { ctn: _ }, back: { ctn: v } } = g, y = this.#t.getChildIndex(v);
506
+ this.#t.removeChild(v), this.#n.removeChild(_), this.#t.addChildAt(_, y), this.#n.addChildAt(v, y);
507
+ }
508
+ Promise.allSettled(e).then(() => {
509
+ this.#t.visible = !0, this.#n.visible = !1, this.#A.visible = !1, this.#M.visible = !1, Reading.notifyEndProc(TW_NM_TRANS);
510
+ });
511
+ };
512
+ if (this.#M.filters = [], this.#M.alpha = 1, argChk_Num(e, "time", 0) === 0 || this.#f.isSkipping) return v(), !1;
513
+ let y = [], b = this.#S.map((e) => {
514
+ let { fore: m, back: g } = this.#x[e], _ = h.has(e) ? g : m;
515
+ return _.ctn.visible && y.push(_.ctn), _;
516
+ }), { ticker: S, renderer: w } = this.appPixi;
517
+ w.render(this.#n, { renderTexture: this.#k });
518
+ let T = () => {
519
+ for (let e of y) w.render(e, {
520
+ renderTexture: this.#k,
521
+ clear: !1
522
+ });
523
+ };
524
+ if (!b.some((e) => e.containMovement)) {
525
+ let e = T;
526
+ T = () => {
527
+ T = () => {}, e();
528
+ };
529
+ }
530
+ let E = () => w.render(this.#t, { renderTexture: this.#j });
531
+ E();
532
+ let D = () => {
533
+ this.#t.visible = !0, E(), this.#t.visible = !1;
534
+ };
535
+ if (!_.some((e) => e.containMovement)) {
536
+ let e = D;
537
+ D = () => {
538
+ D = () => {}, e();
539
+ };
540
+ }
541
+ let O = () => {
542
+ T(), this.#A.visible = !0, D(), this.#M.visible = !0;
543
+ }, { glsl: A, rule: j } = e, M = () => {
544
+ S.remove(O), v();
545
+ };
546
+ if (!A && !j) return CmnTween.tween(TW_NM_TRANS, e, this.#M, { alpha: 0 }, () => {}, M, () => {}), S.add(O), !1;
547
+ let F = {
548
+ rule: Texture.EMPTY,
549
+ vague: argChk_Num(e, "vague", .04),
550
+ tick: 0
551
+ };
552
+ this.#M.filters = [new Filter(void 0, A ?? x.#O, F)];
553
+ let I = CmnTween.tween(TW_NM_TRANS, e, F, { tick: 1 }, () => {}, M, () => {}, !j);
554
+ return j ? new SpritesMng(j, void 0, (e) => {
555
+ F.rule = e.texture, e.destroy(), I.start(), S.add(O);
556
+ }, (e) => {
557
+ e && this.main.resume();
558
+ }).ret : (S.add(O), !1);
559
+ }
560
+ #P(e = "") {
561
+ return e ? e.split(",") : this.#S;
562
+ }
563
+ #F(e, m) {
564
+ let h = this.#P(e.layer);
565
+ for (let e of h) {
566
+ let h = this.#x[e];
567
+ if (!h) throw `存在しないlayer【${e}】です`;
568
+ m(e, h);
569
+ }
570
+ return h;
571
+ }
572
+ #I(e = "") {
573
+ return this.#P(e).sort((e, m) => {
574
+ let h = this.#t.getChildIndex(this.#x[e].fore.ctn), g = this.#t.getChildIndex(this.#x[m].fore.ctn);
575
+ return h < g ? -1 : h > g ? 1 : 0;
576
+ });
577
+ }
578
+ setAllStyle2TxtLay(e) {
579
+ for (let m of this.#S) {
580
+ let h = this.#x[m].fore;
581
+ h instanceof TxtLayer && h.lay({ style: e });
582
+ }
583
+ }
584
+ #L(e) {
585
+ if (argChk_Num(e, "time", NaN) === 0) return !1;
586
+ let h = this.#P(e.layer).map((e) => this.#x[e].fore.ctn), { renderer: _, ticker: v } = this.appPixi;
587
+ this.#j.resize(CmnLib.stageW, CmnLib.stageH);
588
+ let b = () => {
589
+ this.#t.visible = !0;
590
+ for (let e of h) _.render(e, {
591
+ renderTexture: this.#j,
592
+ clear: !1
593
+ });
594
+ this.#t.visible = !1;
595
+ };
596
+ this.#M.visible = !0, this.#M.alpha = 1;
597
+ let x = uint(argChk_Num(e, "hmax", 10)), S = uint(argChk_Num(e, "vmax", 10)), C = x === 0 ? () => {} : () => {
598
+ this.#M.x = Math.round(Math.random() * x * 2) - x;
599
+ }, w = S === 0 ? () => {} : () => {
600
+ this.#M.y = Math.round(Math.random() * S * 2) - S;
601
+ };
602
+ return this.#M.filters = [], CmnTween.tween(TW_NM_TRANS, e, this.#M, {
603
+ x: 0,
604
+ y: 0
605
+ }, () => {
606
+ C(), w();
607
+ }, () => {
608
+ v.remove(b), this.#t.visible = !0, this.#M.visible = !1, this.#M.x = 0, this.#M.y = 0, Reading.notifyEndProc(TW_NM_TRANS);
609
+ }, () => {}), v.add(b), !1;
610
+ }
611
+ #R(e) {
612
+ let { layer: m, render: h, name: g } = e;
613
+ if (!m) throw "layerは必須です";
614
+ let _ = this.#x[this.#Z(e)], y = _.fore, b = () => {};
615
+ h && (this.#f.isSkipping ? y.renderStart(!0) : (y.renderStart(!1), b = () => y.renderEnd()));
616
+ let x = CmnTween.cnvTweenArg(e, y), S = argChk_Boolean(e, "arrive", !1), C = argChk_Boolean(e, "backlay", !1), w = _.back.ctn;
617
+ return CmnTween.tween(g ?? m, e, y, CmnTween.cnvTweenArg(e, y), () => {}, b, () => {
618
+ if (S && Object.assign(y, x), C) for (let e of CmnTween.aLayerPrpNm) w[e] = y[e];
619
+ }), "filter" in e && (y.ctn.filters = [Layer.bldFilters(e)], y.aFltHArg = [e]), !1;
620
+ }
621
+ #z(e) {
622
+ return this.#F(e, (m) => {
623
+ let h = this.#x[this.#Z({ layer: m })];
624
+ if (e.page === "both") {
625
+ this.#B(h.fore, e), this.#B(h.back, e);
626
+ return;
627
+ }
628
+ let g = h.getPage(e);
629
+ this.#B(g, e);
630
+ }), !1;
631
+ }
632
+ #B(e, m) {
633
+ let h = e.ctn;
634
+ h.filters ??= [], h.filters = [...h.filters, Layer.bldFilters(m)], e.aFltHArg.push(m);
635
+ }
636
+ #V(e) {
637
+ return this.#F(e, (m) => {
638
+ let h = this.#x[this.#Z({ layer: m })];
639
+ if (e.page === "both") {
640
+ let e = h.fore, m = h.back;
641
+ e.ctn.filters = null, m.ctn.filters = null, e.aFltHArg = [], m.aFltHArg = [];
642
+ return;
643
+ }
644
+ let g = h.getPage(e);
645
+ g.ctn.filters = null, g.aFltHArg = [];
646
+ }), !1;
647
+ }
648
+ #H(e) {
649
+ return this.#F(e, (m) => {
650
+ let h = this.#x[this.#Z({ layer: m })];
651
+ if (e.page === "both") {
652
+ this.#U(h.fore, e), this.#U(h.back, e);
653
+ return;
654
+ }
655
+ let g = h.getPage(e);
656
+ this.#U(g, e);
657
+ }), !1;
658
+ }
659
+ #U(e, h) {
660
+ let _ = e.ctn;
661
+ if (!_.filters) throw "フィルターがありません";
662
+ let y = uint(argChk_Num(h, "index", 0)), b = _.filters.length;
663
+ if (b <= y) throw `フィルターの個数(${String(b)})を越えています`;
664
+ e.aFltHArg[y].enabled = _.filters[y].enabled = argChk_Boolean(h, "enabled", !0);
665
+ }
666
+ #W(e) {
667
+ let { text: m } = e;
668
+ if (!m) throw "textは必須です";
669
+ let h = this.#G(e);
670
+ delete e.text, this.setNormalChWait(), this.#f.isSkipping ? e.wait = 0 : "wait" in e && argChk_Num(e, "wait", NaN), this.#m("add|" + cnvSArg(e), h);
671
+ let _ = argChk_Boolean(e, "record", !0), y = this.val.doRecLog();
672
+ return _ || this.val.setVal_Nochk("save", "sn.doRecLog", _), h.tagCh(m.replaceAll("[r]", "\n")), this.val.setVal_Nochk("save", "sn.doRecLog", y), this.#m("add_close|", h), !1;
673
+ }
674
+ #G = (e) => {
675
+ throw this.#X(), 0;
676
+ };
677
+ #K(e) {
678
+ let m = this.#Z(e, this.#C), h = this.#x[m].getPage(e);
679
+ if (!(h instanceof TxtLayer)) throw m + "はTxtLayerではありません";
680
+ return h;
681
+ }
682
+ setNormalChWait() {
683
+ TxtLayer.msecChWait = this.scrItr.normalWait;
684
+ }
685
+ #q = (e) => {
686
+ throw this.#X(), 0;
687
+ };
688
+ #J(e) {
689
+ let { layer: m } = e;
690
+ if (!m) throw "[current] layerは必須です";
691
+ let h = this.#x[m];
692
+ if (!h || !(h.getPage(e) instanceof TxtLayer)) throw `${m}はTxtLayerではありません`;
693
+ this.#Y = h, this.#a.pagebreak(), this.#C = m, this.val.setVal_Nochk("save", "const.sn.mesLayer", m);
694
+ for (let e of this.#S) {
695
+ let { fore: h, back: g } = this.#x[e];
696
+ h instanceof TxtLayer && (h.isCur = g.isCur = e === m);
697
+ }
698
+ return !1;
699
+ }
700
+ get currentTxtlayForeNeedErr() {
701
+ return this.#X(), this.currentTxtlayFore;
702
+ }
703
+ get currentTxtlayFore() {
704
+ return this.#Y ? this.#Y.fore : null;
705
+ }
706
+ #Y = void 0;
707
+ #X = () => {
708
+ throw "文字レイヤーがありません。文字表示や操作する前に、[add_lay layer=(レイヤ名) class=txt]で文字レイヤを追加して下さい";
709
+ };
710
+ #Z(e, m = "") {
711
+ let h = e.layer ?? m;
712
+ if (h.includes(",")) throw "layer名に「,」は使えません";
713
+ if (!(h in this.#x)) throw "属性 layer【" + h + "】が不正です。レイヤーがありません";
714
+ return e.layer = h, h;
715
+ }
716
+ recPagebreak() {
717
+ this.#a.pagebreak();
718
+ }
719
+ #Q(e) {
720
+ let m = this.#G(e);
721
+ return e.layer === this.#C && e.page === "fore" && this.#a.pagebreak(), m.clearText(), !1;
722
+ }
723
+ #$(e) {
724
+ return this.#m("endlink|", this.#G(e)), !1;
725
+ }
726
+ #ee(e) {
727
+ return argChk_Boolean(e, "rec_page_break", !0) && this.#a.pagebreak(), this.#Y && (this.#Y.fore.clearLay(e), this.#Y.back.clearLay(e)), !1;
728
+ }
729
+ #te(e) {
730
+ if (!e.pic) throw "[graph] picは必須です";
731
+ return this.#m("grp|" + cnvSArg(e), this.#G(e)), !1;
732
+ }
733
+ #ne(e) {
734
+ if (!e.fn && !e.label && !e.url) throw "fn,label,url いずれかは必須です";
735
+ return e.fn ??= this.scrItr.scriptFn, e.style ??= "background-color: rgba(255,0,0,0.5);", e.style_hover ??= "background-color: rgba(255,0,0,0.9);", e.style_clicked ??= e.style, this.#m("link|" + cnvSArg(e), this.#G(e)), !1;
736
+ }
737
+ #re(e) {
738
+ return this.#W({
739
+ ...e,
740
+ text: "\n"
741
+ });
742
+ }
743
+ #ie(e) {
744
+ let { t: m, r: h } = e;
745
+ if (!m) throw "[ruby2] tは必須です";
746
+ if (!h) throw "[ruby2] rは必須です";
747
+ return e.text = "|" + encodeURIComponent(m) + "《" + encodeURIComponent(h) + "》", delete e.t, delete e.r, this.#W(e);
748
+ }
749
+ #ae(e) {
750
+ return this.#m("span|" + cnvSArg(e), this.#G(e)), !1;
751
+ }
752
+ #oe(e) {
753
+ if (!e.t) throw "[tcy] tは必須です";
754
+ return this.#m("tcy|" + cnvSArg(e), this.#G(e)), !1;
755
+ }
756
+ #se({ layer: e }) {
757
+ console.group("🥟 [dump_lay]");
758
+ for (let m of this.#P(e)) {
759
+ let { fore: e, back: h } = this.#x[m];
760
+ try {
761
+ console.info(`%c${e.name.slice(0, -7)} %o`, `color:#${CmnLib.isDarkMode ? "49F" : "05A"};`, JSON.parse(`{"back":{${h.dump()}}, "fore":{${e.dump()}}}`));
762
+ } catch (m) {
763
+ console.error("dump_lay err:%o", m), console.error(` back:${h.dump()}`), console.error(` fore:${e.dump()}`);
764
+ }
765
+ }
766
+ return console.groupEnd(), !1;
767
+ }
768
+ #ce(e) {
769
+ let m = this.#Z(e, this.#C), h = argChk_Boolean(e, "enabled", !0);
770
+ return this.#G(e).enabled = h, this.val.setVal_Nochk("save", "const.sn.layer." + m + ".enabled", h), !1;
771
+ }
772
+ #le(e) {
773
+ return Pages.argChk_page(e, "back"), e.fn ??= this.scrItr.scriptFn, this.#G(e).addButton(e), this.scrItr.recodeDesign(e), !1;
774
+ }
775
+ record() {
776
+ let e = {};
777
+ for (let m of this.#S) {
778
+ let h = this.#x[m];
779
+ e[m] = {
780
+ cls: h.cls,
781
+ fore: h.fore.record(),
782
+ back: h.back.record()
783
+ };
784
+ }
785
+ return e;
786
+ }
787
+ playback(e) {
788
+ this.#a.playback();
789
+ let m = [], h = [];
790
+ for (let [g, { fore: _, fore: { idx: v }, back: y, cls: b }] of Object.entries(e)) {
791
+ h.push({
792
+ ln: g,
793
+ idx: v
794
+ });
795
+ let e = this.#x[g] ??= new Pages(g, b, this.#t, this.#n, {}, this.sys, this.val, { isWait: !1 });
796
+ e.fore.playback(_, m), e.back.playback(y, m);
797
+ }
798
+ let g = this.#t.children.length;
799
+ return m.push(new Promise((e) => {
800
+ for (let { ln: e, idx: m } of h.sort(({ idx: e }, { idx: m }) => e === m ? 0 : e < m ? -1 : 1)) {
801
+ let h = this.#x[e];
802
+ if (!h) continue;
803
+ let _ = g > m ? m : g - 1, { fore: v, back: y } = h;
804
+ this.#t.setChildIndex(v.ctn, _), this.#n.setChildIndex(y.ctn, _);
805
+ }
806
+ e();
807
+ })), m;
808
+ }
993
809
  };
994
- //# sourceMappingURL=LayerMng.js.map
810
+ export { LayerMng };
811
+
812
+ //# sourceMappingURL=LayerMng.js.map