@famibee/skynovel 1.65.0 → 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 (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 +918 -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 +918 -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,1034 +1,806 @@
1
- import { a as v, S, b as w, R as P, e as d, L as B, D as k, k as C, f as D } from "./app2.js";
2
- import { c as O, C as L, a as $ } from "./CallStack.js";
3
- import { G as I, A as M, t as T, a as x } from "./Main.js";
4
- import { R as j } from "./RubySpliter.js";
5
- import { a as _, C as y, R as N } from "./CmnTween.js";
6
- import { a as W } from "./SndBuf.js";
7
- class p {
8
- //MARK: コンストラクタ
9
- constructor(t, s, i, h, n, r, a) {
10
- this.cfg = t, this.hTag = s, this.main = i, this.val = h, this.prpPrs = n, this.sndMng = r, this.sys = a, s.let_ml = (e) => this.#Z(e), s.endlet_ml = () => !1, s.dump_stack = () => this.#tt(), s.dump_script = (e) => this.#st(e), s.else = // その他ifブロック開始
11
- s.elsif = // 別条件のifブロック開始
12
- s.endif = () => this.#et(), s.if = (e) => this.#nt(e), s.call = (e) => this.#ht(e), s.jump = (e) => this.#at(e), s.pop_stack = (e) => this.#ot(e), s.return = (e) => this.#j(e), s.bracket2macro = (e) => this.#kt(e), s.char2macro = (e) => this.#gt(e), s.endmacro = (e) => this.#j(e), s.macro = (e) => this.#bt(e), s.load = (e) => this.#vt(e), s.reload_script = (e) => this.#St(e), s.record_place = () => this.#q(), s.save = (e) => this.#wt(e), t.oCfg.debug.token && (this.#F = (e) => {
13
- e.trim() !== "" && console.log(`🌱 トークン ${this.#i}:${String(this.#e)} (i:${String(this.#t)} cs:${String(this.#n.length)}) %c【${e}】`, "background-color:#350;");
14
- }), t.oCfg.debug.tag && (this.#D = (e) => console.log(`🌲 タグ解析 ${this.#i}:${String(this.#e)} (i:${String(this.#t)} cs:${String(this.#n.length)}) %c[${e} %o]`, "background-color:#30B;", this.#r.hPrm)), h.defTmp("const.sn.aIfStk.length", () => this.#o.length), h.defTmp("const.sn.vctCallStk.length", () => this.#n.length), this.#l = new I(t);
15
- const l = t.oCfg.init.escape;
16
- if (this.#l.setEscape(l), j.setEscape(l), v.isDbg) {
17
- this.#k, a.addHook((c, f) => this.#k[c]?.(f)), this.isBreak = (c) => this.#A(c);
18
- const e = () => this.analyzeInit();
19
- this.analyzeInit = () => {
20
- this.analyzeInit = () => {
21
- }, this.sys.send2Dbg("hi", {});
22
- }, this.#k.auth = (c) => {
23
- const f = c.hBreakpoint.hFn2hLineBP;
24
- for (const [o, u] of Object.entries(f)) this.#E(o, u);
25
- p.#p = {};
26
- for (const o of c.hBreakpoint.aFunc)
27
- p.#p[o.name] = 1;
28
- if (c.stopOnEntry) {
29
- let o;
30
- for (; o = this.nextToken(); ) {
31
- const u = o.charCodeAt(0);
32
- if (u === 91 || u === 38 || u === 42 && o.length === 1) break;
33
- u === 10 && (this.#e += o.length);
34
- }
35
- this.sys.callHook("stopOnEntry", {}), this.analyzeInit = e, this.analyzeInit();
36
- } else
37
- this.noticeWait = () => {
38
- this.noticeWait = () => {
39
- }, this.sys.callHook("stopOnEntry", {});
40
- }, this.analyzeInit = e, this.analyzeInit();
41
- };
42
- } else this.recodeDesign = () => {
43
- };
44
- }
45
- #s = { aToken: [""], len: 1, aLNum: [1] };
46
- #i = "";
47
- get scriptFn() {
48
- return this.#i;
49
- }
50
- #t = 0;
51
- get idxToken() {
52
- return this.#t;
53
- }
54
- subIdxToken() {
55
- --this.#t;
56
- }
57
- #e = 0;
58
- get lineNum() {
59
- return this.#e;
60
- }
61
- addLineNum = (t) => {
62
- this.#e += t;
63
- };
64
- jumpJustBefore() {
65
- this.#f(this.#i, "", --this.#t);
66
- }
67
- // 直前にジャンプ
68
- #n = [];
69
- // FILOバッファ(push/pop)
70
- #l;
71
- #r = new M();
72
- noticeWait = () => {
73
- };
74
- #E(t, s) {
75
- p.#w[this.#_(t)] = s;
76
- }
77
- destroy() {
78
- this.isBreak = this.#q = () => !1;
79
- }
80
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
81
- #k = {
82
- auth: () => {
83
- },
84
- // constructorでセット
85
- //launch: // ここでは冒頭停止に間に合わないのでanalyzeInit()
86
- disconnect: () => {
87
- p.#w = {}, p.#p = {}, this.isBreak = () => !1, this.#k.continue({}), this.#h = 0;
88
- },
89
- restart: () => {
90
- this.isBreak = () => !1;
91
- },
92
- // ブレークポイント登録
93
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
94
- add_break: (t) => this.#E(t.fn, t.o),
95
- data_break: (t) => {
96
- this.#h === 0 && (this.#h = 1, this.main.setLoop(!1, `変数 ${String(t.dataId)}【${String(t.old_v)}】→【${String(t.new_v)}】データブレーク`), this.sys.callHook("stopOnDataBreakpoint", {}), this.sys.send2Dbg("stopOnDataBreakpoint", {}));
97
- },
98
- set_func_break: (t) => {
99
- p.#p = {};
100
- for (const s of t.a) p.#p[s.name] = 1;
101
- this.sys.send2Dbg(t.ri, {});
102
- },
103
- // 情報問い合わせ系
104
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
105
- stack: (t) => this.sys.send2Dbg(t.ri, { a: this.#J() }),
106
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
107
- eval: (t) => {
108
- this.sys.send2Dbg(t.ri, { v: this.prpPrs.parse(t.txt) });
109
- },
110
- // デバッガからの操作系
111
- continue: () => {
112
- this.#S() || (this.#t -= this.#b, this.#h = 3, this.main.setLoop(!0), this.main.resume());
113
- },
114
- stepover: (t) => this.#P(t),
115
- stepin: () => {
116
- if (this.#S()) return;
117
- const t = this.#s.aToken[this.#t - this.#b];
118
- this.sys.callHook(`stopOnStep${this.#N.test(t ?? "") ? "In" : ""}`, {}), this.#t -= this.#b, this.#h = this.#h === 1 ? 4 : 5, this.main.setLoop(!0), this.main.resume();
119
- },
120
- stepout: (t) => {
121
- this.#S() || (this.#n.length > 0 ? this.#B(!0) : this.#P(t));
122
- },
123
- pause: () => {
124
- this.#h = 4, this.main.setLoop(!1, "一時停止"), this.sys.send2Dbg("stopOnStep", {});
125
- },
126
- stopOnEntry: () => {
127
- this.#h = 4, this.main.setLoop(!1, "一時停止"), this.sys.send2Dbg("stopOnEntry", {});
128
- }
129
- };
130
- #g = (t) => this.cfg.searchPath(t, S.SCRIPT);
131
- #_ = (t) => this.sys.pathBaseCnvSnPath4Dbg + this.#g(t);
132
- #P(t) {
133
- if (this.#S()) return;
134
- const s = this.#s.aToken[this.#t - this.#b];
135
- this.#N.test(s ?? "") ? this.#B(!1) : (this.sys.callHook("stopOnStep", {}), this.#k.stepin(t));
136
- }
137
- #B(t) {
138
- this.sys.callHook(`stopOnStep${t ? "Out" : ""}`, {}), this.#C = this.#n.length - (t ? 1 : 0), this.#t -= this.#b, this.#h = t ? 7 : 6, this.main.setLoop(!0), this.main.resume();
139
- }
140
- #C = 0;
141
- get #b() {
142
- return this.#h === 2 || this.#h === 4 ? 1 : 0;
143
- }
144
- #S() {
145
- return this.#t < this.#s.len ? !1 : (this.sys.callHook("stopOnEntry", {}), this.main.setLoop(!1, "スクリプト終端です isIdxOverLast"), !0);
146
- }
147
- // reload 再生成 Main に受け渡すため static
148
- static #w = {};
149
- static #p = {};
150
- #h = 0;
151
- // https://raw.githubusercontent.com/famibee/SKYNovel-vscode-extension/master/src/doc/BreakStateSMD.pu
152
- isBreak = (t) => !1;
153
- #A(t) {
154
- switch (this.#h) {
155
- case 6:
156
- this.#T(), this.#h = 7;
157
- break;
158
- case 7:
159
- if (this.#n.length !== this.#C) break;
160
- return this.#h = 4, this.main.setLoop(!1, "ステップ実行"), this.sys.send2Dbg("stopOnStep", {}), !0;
161
- // タグを実行せず、直前停止
162
- case 5:
163
- this.#T(), this.#h = 4;
164
- break;
165
- case 4:
166
- return this.#T(), this.main.setLoop(!1, "ステップ実行"), this.sys.send2Dbg("stopOnStep", {}), !0;
167
- // タグを実行せず、直前停止
168
- case 3:
169
- this.#T(), this.#h = 0;
170
- break;
171
- default:
172
- if (T(t) in p.#p)
173
- return this.#h = 2, this.main.setLoop(!1, `関数 ${t} ブレーク`), this.sys.callHook("stopOnBreakpoint", {}), this.sys.send2Dbg("stopOnBreakpoint", {}), !0;
174
- {
175
- const s = p.#w[this.#_(this.#i)];
176
- if (!s) break;
177
- const i = s[this.#e];
178
- if (!i) break;
179
- if (i.condition) {
180
- if (!this.prpPrs.parse(i.condition)) break;
181
- } else if ("hitCondition" in i && --i.hitCondition > 0) break;
182
- const h = this.#h === 0;
183
- this.#h = 2, this.main.setLoop(!1, h ? (
184
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
185
- (i.condition ? "条件" : "ヒットカウント") + "ブレーク"
186
- ) : "ステップ実行");
187
- const n = h ? "stopOnBreakpoint" : "stopOnStep";
188
- this.sys.callHook(n, {}), this.sys.send2Dbg(n, {});
189
- }
190
- return !0;
191
- }
192
- return !1;
193
- }
194
- #T() {
195
- const t = p.#w[w(this.#i)]?.[this.#e];
196
- t?.hitCondition && --t.hitCondition;
197
- }
198
- #J() {
199
- const t = this.#h === 3 ? 1 : 0, s = this.#s.aToken[this.#t - 1 + t], i = this.#_(this.#i), h = T(s), n = h ? `[${h}]` : s, r = String(this.val.getVal("mp:const.sn.macro") ?? "{}");
200
- if (this.#t === 0) return [{ fn: i, ln: 1, col: 1, nm: n, ma: r }];
201
- const a = this.#c(this.#s, this.#t), l = [{ fn: i, ln: a.ln, col: a.col_s + 1, nm: n, ma: r }], e = this.#n.length;
202
- if (e === 0) return l;
203
- for (let c = e - 1; c >= 0; --c) {
204
- const f = this.#n[c], o = this.#a[f.fn];
205
- if (!o) continue;
206
- const u = o.aToken[f.idx - 1];
207
- if (!u) continue;
208
- const m = this.#c(o, f.idx), b = T(u);
209
- l.push({
210
- fn: this.#_(f.fn),
211
- ln: m.ln,
212
- col: m.col_s + 1,
213
- nm: b ? `[${b}]` : u,
214
- ma: f.csArg[":hMp"]["const.sn.macro"]
215
- });
216
- }
217
- return l;
218
- }
219
- // result = true : waitする resume()で再開
220
- #D = (t) => {
221
- };
222
- //MARK: タグ解析
223
- async タグ解析(t, s) {
224
- const i = this.hTag[t];
225
- if (!i) throw `未定義のタグ【${t}】です`;
226
- this.#r.parse(s), this.#D(t);
227
- const h = this.#r.hPrm;
228
- if (h.cond) {
229
- const e = h.cond.val;
230
- if (!e || e.startsWith("&")) throw "属性condは「&」が不要です";
231
- const c = this.prpPrs.parse(e), f = String(c);
232
- if (f === "null" || f === "undefined" || !c) return !1;
233
- }
234
- let n = {};
235
- const r = this.#n.at(-1)?.csArg ?? O(), a = this.#n.length;
236
- if (this.#r.isKomeParam) {
237
- if (a === 0) throw "属性「*」はマクロのみ有効です";
238
- n = { ...r };
239
- }
240
- n[":タグ名"] = t;
241
- for (const [e, { val: c, def: f }] of Object.entries(h)) {
242
- let o = c;
243
- if (c.startsWith("%")) {
244
- if (a === 0) throw "属性「%」はマクロ定義内でのみ使用できます(そのマクロの引数を示す簡略文法であるため)";
245
- const u = r[o.slice(1)];
246
- if (u) {
247
- n[e] = u;
248
- continue;
249
- }
250
- if (f === void 0 || f === "null") continue;
251
- o = f;
252
- }
253
- if (o = this.prpPrs.getValAmpersand(o ?? ""), o !== "undefined") {
254
- n[e] = o;
255
- continue;
256
- }
257
- f !== void 0 && (o = this.prpPrs.getValAmpersand(f), o !== "undefined" && (n[e] = o));
258
- }
259
- if (_.needGoTxt && this.#U.has(t)) {
260
- const { promise: e, resolve: c } = Promise.withResolvers();
261
- _.beginProc(P, () => c(0), !1, () => c(0)), _.goTxt(), this.val.saveKidoku(), await e;
262
- }
263
- this.#X.has(t) && (this.#x.hideHint(), y.stopEndTrans());
264
- const l = this.#Q[t];
265
- return l && d(n, "canskip", this.#Y[t] ?? !0) && this.#x.isSkipping ? l(n) : i(n);
266
- }
267
- // 文字出現演出を待つタグ
268
- // ここで列挙せずタグ処理で文字表示を始めたい場合、goTxt()すること
269
- #U = /* @__PURE__ */ new Set([
270
- // 変数操作
271
- // 'clearsysvar', // システム変数の全消去
272
- // 'clearvar', // ゲーム変数の全消去
273
- // 'let_abs', // 絶対値
274
- // 'let_char_at', // 文字列から一字取りだし
275
- // 'let_index_of', // 文字列で検索
276
- // 'let_length', // 文字列の長さ
277
- // 'let_ml', // インラインテキスト代入
278
- // 'let_replace', // 正規表現で置換
279
- // 'let_round', // 四捨五入
280
- // 'let_search', // 正規表現で検索
281
- // 'let_substr', // 文字列から抜きだし
282
- // 'let', // 変数代入・演算
283
- // レイヤ共通
284
- // 'add_lay', // レイヤを追加する
285
- // 'clear_lay', // レイヤ設定の消去
286
- // 'finish_trans', // トランス強制終了
287
- // 'lay', // レイヤ設定
288
- "trans",
289
- // ページ裏表を交換
290
- "wt",
291
- // トランス終了待ち
292
- // 'add_filter', // フィルター追加
293
- // 'clear_filter', // フィルター全削除
294
- // 'enable_filter',// フィルター個別切替
295
- // トゥイーンアニメ
296
- // 'pause_tsy', // 一時停止
297
- // 'resume_tsy', // 一時停止再開
298
- // 'stop_tsy', // トゥイーン中断
299
- // 'tsy', // トゥイーン開始
300
- "wait_tsy",
301
- // トゥイーン終了待ち
302
- // 文字・文字レイヤ
303
- // 'autowc', // 文字ごとのウェイト
304
- // 'ch', // 文字を追加する
305
- // 'ch_in_style', // 文字出現演出定義
306
- // 'ch_out_style', // 文字消去演出定義
307
- // 'clear_text', // 文字消去
308
- // 'current', // デフォルト文字レイヤ設定
309
- // 'endlet_ml', // インラインテキスト代入の終端
310
- // 'endlink', // ハイパーリンクの終了
311
- // 'er', // ページ両面の文字消去
312
- // 'graph', // インライン画像表示
313
- // 'link', // ハイパーリンク
314
- // 'r', // 改行
315
- // 'rec_ch', // 履歴書き込み
316
- // 'rec_r', // 履歴改行
317
- // 'reset_rec', // 履歴リセット
318
- // 'ruby2', // 文字列と複数ルビの追加
319
- // 'set_focus', // フォーカス移動
320
- // 'span', // インラインスタイル設定
321
- // 'tcy', // 縦中横を表示する
322
- // 画像・画像レイヤ
323
- // 'add_face', // 差分名称の定義
324
- "wv",
325
- // 動画再生終了待ち
326
- // HTMLフレーム
327
- // 'add_frame', // フレーム追加
328
- // 'frame', // フレームに設定
329
- // 'let_frame', // フレーム変数を取得
330
- // 'set_frame', // フレーム変数に設定
331
- // 'tsy_frame', // フレームをトゥイーン開始
332
- // イベント
333
- // 'clear_event', // イベントを全消去
334
- // 'enable_event', // イベント有無の切替
335
- // 'event', // イベントを予約
336
- "l",
337
- // 行末クリック待ち
338
- "p",
339
- // 改ページクリック待ち
340
- "s",
341
- // 停止する
342
- // [set_cancel_skip] スキップ中断予約
343
- "wait",
344
- // ウェイトを入れる
345
- "waitclick",
346
- // クリックを待つ
347
- // BGM・効果音
348
- // 'fadebgm', // BGMのフェード
349
- // 'fadeoutbgm',// BGMのフェードアウト
350
- // 'fadeoutse', // 効果音のフェードアウト
351
- // 'fadese', // 効果音のフェード
352
- // 'playbgm', // BGM の演奏
353
- // 'playse', // 効果音の再生
354
- // 'stop_allse',// 全効果音再生の停止
355
- // 'stopbgm', // BGM 演奏の停止
356
- // 'stopfadese',// 音声フェードの停止
357
- // 'stopse', // 効果音再生の停止
358
- // 'volume', // BGMや効果音の音量を指定
359
- "wb",
360
- // BGM フェードの終了待ち
361
- "wf",
362
- // 効果音フェードの終了待ち
363
- "wl",
364
- // BGM 再生の終了待ち
365
- "ws",
366
- // 効果音再生の終了待ち
367
- // 'xchgbuf', // サウンドバッファの交換
368
- // 条件分岐
369
- // 'else', // その他ifブロック開始
370
- // 'elsif', // 別条件のifブロック開始
371
- // 'endif', // ifブロックの終端
372
- // 'if', // ifブロックの開始
373
- // ラベル・ジャンプ
374
- // 'button', // ボタンを表示
375
- // 'call', // サブルーチンコール
376
- // 'jump', // シナリオジャンプ
377
- // 'page', // ページ移動
378
- // 'pop_stack', // コールスタック破棄
379
- // 'return', // サブルーチンから戻る
380
- // マクロ
381
- // 'bracket2macro', // 括弧マクロの定義
382
- // 'char2macro', // 一文字マクロの定義
383
- // 'endmacro', // マクロ定義の終了
384
- // 'macro', // マクロ定義の開始
385
- // しおり
386
- // 'copybookmark', // しおりの複写
387
- // 'erasebookmark', // しおりの消去
388
- // 'load', // しおりの読込
389
- // 'record_place', // セーブポイント指定
390
- // 'reload_script', // スクリプト再読込
391
- // 'save', // しおりの保存
392
- // 画面揺らし
393
- "quake",
394
- // 画面を揺らす
395
- // 'stop_quake',// 画面揺らし中断
396
- "wq"
397
- // 画面揺らし終了待ち
398
- // システム
399
- // 'close', // アプリの終了
400
- // 'export', // プレイデータをエクスポート
401
- // 'import', // プレイデータをインポート
402
- // 'loadplugin', // プラグインの読み込み
403
- // 'navigate_to', // URLを開く
404
- // 'snapshot', // スナップショット
405
- // 'title', // タイトル指定
406
- // 'toggle_full_screen', // 全画面状態切替
407
- // 'update_check', // 更新チェック機能
408
- // 'window', // アプリウインドウ設定
409
- // デバッグ・その他
410
- // 'dump_lay', // レイヤのダンプ
411
- // 'dump_script', // 外部へスクリプトを表示
412
- // 'dump_stack', // スタックのダンプ
413
- // 'dump_val', // 変数のダンプ
414
- // 'log', // ログ出力
415
- // 'trace', // デバッグ表示へ出力
416
- ]);
417
- #X = /* @__PURE__ */ new Set([
418
- "finish_trans",
419
- // トランス強制終了
420
- "trans",
421
- // ページ裏表を交換
422
- "quake",
423
- // 画面を揺らす
424
- "stop_quake",
425
- // 画面揺らし中断
426
- "add_filter"
427
- // フィルター追加
428
- ]);
429
- // キー押しっぱなしスキップで処理せずスルーするタグ
430
- #Q = {
431
- wt: () => (y.stopEndTrans(), !1),
432
- // トランス終了待ち
433
- wait_tsy: (t) => this.hTag.stop_tsy(t),
434
- // トゥイーン終了待ち
435
- // 'wv', :タグ内部で処理 // 動画再生終了待ち
436
- wait: () => !1,
437
- // ウェイトを入れる
438
- // 'playbgm', :スルー不可 // BGM の演奏
439
- // 'playse', :タグ内部で処理 // 効果音の再生
440
- wb: () => this.hTag.stopfadese({ buf: W }),
441
- // BGM フェードの終了待ち
442
- wf: (t) => this.hTag.stopfadese(t),
443
- // 効果音フェードの終了待ち
444
- // 'ws' :タグ内部で処理 // 効果音再生の終了待ち
445
- wq: () => this.hTag.stop_quake({}),
446
- // 画面揺らし終了待ち
447
- // fade系 :タグ内部で処理
448
- // 'ch' :タグ内部で処理 // 文字を追加する
449
- // 'tsy' :タグ内部で処理 // トゥイーン開始
450
- // 'trans' :タグ内部で処理 // ページ裏表を交換
451
- quake: () => !1
452
- // 画面を揺らす
453
- };
454
- // タグ処理中にクリックなどで即終わらせられるタグ(canskip 属性がある)
455
- #Y = {
456
- // デフォルト値
457
- wt: !0,
458
- // [wt]トランス終了待ち
459
- wait_tsy: !0,
460
- // [wait_tsy]トゥイーン終了待ち
461
- wv: !0,
462
- // [wv]動画再生終了待ち
463
- wait: !0,
464
- // [wait]ウェイトを入れる
465
- playbgm: !1,
466
- // [playbgm]BGM の演奏
467
- playse: !0,
468
- // [playse]効果音の再生
469
- wb: !1,
470
- // [wb]BGM フェードの終了待ち
471
- wf: !1,
472
- // [wf]効果音フェードの終了待ち
473
- ws: !1,
474
- // [ws]効果音再生の終了待ち
475
- wq: !0
476
- // [wq]画面揺らし終了待ち
477
- };
478
- #x;
479
- #m;
480
- setOtherObj(t, s) {
481
- this.#x = t, this.#m = s;
482
- }
483
- //MARK: インラインテキスト代入
484
- #Z(t) {
485
- const { name: s } = t;
486
- if (!s) throw "nameは必須です";
487
- let i = "";
488
- const h = this.#s.len;
489
- for (; this.#t < h && (i = this.#s.aToken[this.#t], i === ""); ++this.#t)
490
- ;
491
- return t.text = i, t.cast = "str", this.hTag.let(t), this.#t += 2, this.#e += (i.match(/\n/g) ?? []).length, !1;
492
- }
493
- //MARK: スタックのダンプ
494
- #tt() {
495
- if (this.#t === 0)
496
- return console.group(`🥟 [dump_stack] スクリプト現在地 fn:${this.#i} line:1 col:0`), console.groupEnd(), !1;
497
- const t = this.#c(this.#s, this.#t), s = `スクリプト現在地 fn:${this.#i} line:${String(t.ln)} col:${String(t.col_s + 1)}`;
498
- console.group(`🥟 [dump_stack] ${s}`);
499
- const i = this.#n.length;
500
- if (i > 0) {
501
- console.info(s);
502
- for (let h = i - 1; h >= 0; --h) {
503
- const n = this.#n[h], r = n.csArg[":hMp"], a = r ? r[":タグ名"] : void 0, l = n.csArg[":タグ名"] ?? "", e = this.#c(this.#a[n.fn], n.idx);
504
- console.info(
505
- `${String(i - h)}つ前のコール元 fn:${n.fn} line:${String(e.ln)} col:${String(e.col_s + 1)}${a ? "([" + a + "]マクロ内)" : " "}で [${l} ...]をコール`
506
- );
507
- }
508
- }
509
- return console.groupEnd(), !1;
510
- }
511
- #c(t, s) {
512
- const i = { ln: 1, col_s: 0, col_e: 0 };
513
- if (!t) return i;
514
- let h = s - 1;
515
- const n = i.ln = t.aLNum[h];
516
- for (; t.aLNum[h] === n; ) {
517
- const r = t.aToken[h];
518
- if (!r.startsWith(`
519
- `)) {
520
- const a = r.length;
521
- i.col_e > 0 && (i.col_s += a), i.col_e += a;
522
- }
523
- if (--h < 0) break;
524
- }
525
- return i;
526
- }
527
- //MARK: 外部へスクリプトを表示
528
- #st(t) {
529
- const { set_fnc: s, break_fnc: i } = t;
530
- if (!s) throw "set_fncは必須です";
531
- if (this.#y = globalThis[s], !this.#y) {
532
- if (d(t, "need_err", !0)) throw `HTML内に関数${s}が見つかりません`;
533
- return this.#y = () => {
534
- }, !1;
535
- }
536
- if (this.noticeBreak = (h) => {
537
- this.#O !== this.#i && (this.#O = this.#i, this.#y(
538
- this.#it[this.#i] ??= this.#s.aToken.join("")
539
- )), this.#L(this.#e, h);
540
- }, this.noticeBreak(!0), !i) return !1;
541
- if (this.#L = globalThis[i], !this.#L) {
542
- if (d(t, "need_err", !0)) throw `HTML内に関数${i}が見つかりません`;
543
- this.#L = () => {
544
- };
545
- }
546
- return !1;
547
- }
548
- #y = () => {
549
- };
550
- #L = () => {
551
- };
552
- #O = "";
553
- #it = {};
554
- noticeBreak = (t) => {
555
- };
556
- #I = 5;
557
- dumpErrForeLine() {
558
- if (this.#t === 0) {
559
- console.group(`🥟 Error line (from 0 rows before) fn:${this.#i}`), console.groupEnd();
560
- return;
561
- }
562
- let t = "";
563
- for (let r = this.#t - 1; r >= 0 && (t = String(this.#s.aToken[r]) + t, !((t.match(/\n/g) ?? []).length >= this.#I)); --r)
564
- ;
565
- const s = t.split(`
566
- `).slice(-this.#I), i = s.length;
567
- console.group(`🥟 Error line (from ${String(i)} rows before) fn:${this.#i}`);
568
- const h = String(this.#e).length, n = this.#c(this.#s, this.#t);
569
- for (let r = 0; r < i; ++r) {
570
- const a = this.#e - i + r + 1, l = `${String(a).padStart(h, " ")}: %c`, e = s[r], c = e.length > 75 ? e.slice(0, 75) + "…" : e;
571
- r === i - 1 ? console.info(
572
- l + c.slice(0, n.col_s) + "%c" + c.slice(n.col_s),
573
- "color: black; background-color: skyblue;",
574
- "color: black; background-color: pink;"
575
- ) : console.info(l + c, "color: black; background-color: skyblue;");
576
- }
577
- console.groupEnd();
578
- }
579
- #o = [-1];
580
- // 先頭に積む FIFOバッファ(unshift / shift)
581
- //MARK: ifブロックの終端
582
- #et() {
583
- const t = this.#o[0];
584
- if (!t) throw "this.#aIfStk が異常です";
585
- if (t === -1) throw "ifブロック内ではありません";
586
- return this.#t = t, this.#o.shift(), !1;
587
- }
588
- //MARK: ifブロックの開始
589
- #nt(t) {
590
- const { exp: s } = t;
591
- if (!s) throw "expは必須です";
592
- if (s.startsWith("&")) throw "属性expは「&」が不要です";
593
- let i = 0, h = this.prpPrs.parse(s) ? this.#t : -1;
594
- const n = this.#s.aLNum[this.#t], r = this.#e - ((n ?? 0) || 0), a = this.#s.len;
595
- for (; this.#t < a; ++this.#t) {
596
- const l = this.#s.aLNum[this.#t];
597
- this.#s.aLNum[this.#t] = ((l ?? 0) || 0) + r;
598
- const e = this.#s.aToken[this.#t];
599
- if (!e) continue;
600
- const c = e.charCodeAt(0);
601
- if (c === 10) {
602
- this.#e += e.length;
603
- continue;
604
- }
605
- if (c !== 91) continue;
606
- const [f, o] = x(e);
607
- if (!(f in this.hTag)) throw `未定義のタグ[${f}]です`;
608
- switch (this.#r.parse(o), f) {
609
- case "if":
610
- ++i;
611
- break;
612
- case "elsif":
613
- {
614
- if (i > 0 || h > -1) break;
615
- const u = this.#r.hPrm.exp?.val;
616
- if (!u) throw "expは必須です";
617
- if (u.startsWith("&")) throw "属性expは「&」が不要です";
618
- this.prpPrs.parse(u) && (h = this.#t + 1);
619
- }
620
- break;
621
- case "else":
622
- if (i > 0) break;
623
- h === -1 && (h = this.#t + 1);
624
- break;
625
- case "endif":
626
- if (i > 0) {
627
- --i;
628
- break;
629
- }
630
- return h === -1 ? (++this.#t, this.#s.aLNum[this.#t] += r) : (this.#o.unshift(this.#t + 1), this.#t = h, this.#e = this.#s.aLNum[this.#t]), !1;
631
- }
632
- }
633
- throw "[endif]がないままスクリプト終端です";
634
- }
635
- //MARK: サブルーチンコール
636
- #ht(t) {
637
- d(t, "count", !1) || this.#V();
638
- const { fn: s } = t;
639
- return s && this.#g(s), this.#M({ ...t }, N.popLocalEvts()), d(t, "clear_local_event", !1) && this.hTag.clear_event({}), this.#f(s, t.label);
640
- }
641
- #M(t, s) {
642
- const i = {
643
- ...t,
644
- ":hEvt1Time": s,
645
- ":hMp": this.val.cloneMp(),
646
- ":lenIfStk": this.#o.length
647
- };
648
- this.#s.aLNum[this.#t] = this.#e, this.#W || (i[":resvToken"] = "", this.#$()), this.#n.push(new L(this.#i, this.#t, i)), this.#o.unshift(-1);
649
- }
650
- //MARK: シナリオジャンプ
651
- #at(t) {
652
- return d(t, "count", !0) || this.#V(), this.#o[0] = -1, this.#f(t.fn, t.label);
653
- }
654
- //MARK: コールスタック破棄
655
- #ot(t) {
656
- if (d(t, "clear", !1)) this.#n = [];
657
- else if (!this.#n.pop()) throw "スタックが空です";
658
- return this.#$(), this.#o = [-1], this.val.setMp($()), !1;
659
- }
660
- //MARK: サブルーチンから戻る
661
- #j(t) {
662
- const s = this.#n.pop();
663
- if (!s) throw "スタックが空です";
664
- const i = s.csArg;
665
- this.#o = this.#o.slice(-i[":lenIfStk"]);
666
- const h = i[":hMp"];
667
- h && this.val.setMp(h);
668
- const n = i[":resvToken"];
669
- n ? this.nextToken = () => (this.#$(), n) : this.#$(), i[":hEvt1Time"] && N.pushLocalEvts(i[":hEvt1Time"]);
670
- const { fn: r, label: a } = t;
671
- return r || a ? this.#f(r, a) : s.fn in this.#a ? (this.#z(s), !1) : this.#f(s.fn, "", s.idx);
672
- }
673
- #W = "";
674
- #$() {
675
- this.#W = "", this.nextToken = () => this.#R();
676
- }
677
- #v = "";
678
- #f(t = "", s = "", i = 0) {
679
- if (v.debugLog && console.log(`📜 %c1:jumpWork%c fn:${t} lbl:${s} idx:${String(i)}`, "color:#3B0;", ""), !t && !s && this.main.errScript("[jump系] fnまたはlabelは必須です"), s ? (s.startsWith("*") || this.main.errScript("[jump系] labelは*で始まります"), this.#v = s, this.#v.startsWith("**") || (this.#t = i)) : (this.#v = "", this.#t = i), !t)
680
- return this.analyzeInit(), !1;
681
- if (t.includes("@")) throw "[jump系] fn には文字「@」は禁止です";
682
- const h = this.#g(t);
683
- if (t === this.#i)
684
- return this.analyzeInit(), !1;
685
- this.#i = t;
686
- const n = this.#a[t];
687
- if (n)
688
- return this.#s = n, this.analyzeInit(), !1;
689
- const r = `jumpWork fn:${t}`;
690
- _.beginProc(r);
691
- let a = "";
692
- const l = new B();
693
- try {
694
- a = this.#g(t + "@"), l.add({ name: t + ":base", url: h }), l.add({ name: t, url: a });
695
- } catch {
696
- l.add({ name: t, url: h });
697
- }
698
- return l.use((e, c) => {
699
- this.sys.dec(e.extension, e.data).then((f) => {
700
- e.data = f, c();
701
- }).catch((f) => {
702
- this.main.errScript(`[jump系]snロード失敗です fn:${e.name} ${String(f)}`, !1), c();
703
- });
704
- }).load((e, c) => {
705
- if (_.endProc(r), a) {
706
- const f = c[t + ":base"].data, o = c[t].data, u = f.split(`
707
- `), m = o.split(`
708
- `), b = u.length, E = m.length;
709
- for (let g = 0; g < E && g < b; ++g) m[g] ||= u[g] ?? "";
710
- c[t].data = m.join(`
711
- `), delete c[t + ":base"];
712
- }
713
- this.nextToken = this.#R, this.#e = 1, this.#ft(c[t].data), this.hTag.record_place({}), this.analyzeInit();
714
- }), !0;
715
- }
716
- analyzeInit() {
717
- v.debugLog && console.log(`📜 %c9:analyzeInit%c fn:${this.#i} lbl:${this.#v} idx:${String(this.#t)}`, "color:#3B0;", "");
718
- const t = this.#ct(this.#s, !!this.val.getVal("mp:const.sn.macro.name"), this.#e, this.#v, this.#t);
719
- this.#t = t.idx, this.#e = t.ln;
720
- }
721
- // シナリオ解析処理ループ・冒頭処理
722
- nextToken = () => "";
723
- // 初期化前に終了した場合向け
724
- #R() {
725
- if (this.#H()) return "";
726
- this.#dt(), this.#s.aLNum[this.#t] ||= this.#e;
727
- const t = this.#s.aToken[this.#t];
728
- return this.#F(t), ++this.#t, t;
729
- }
730
- #F = (t) => {
731
- };
732
- #H() {
733
- return this.#t < this.#s.len ? !1 : (this.main.errScript("スクリプト終端です errOverScr"), !0);
734
- }
735
- #rt = /(\*{2,})([^|]*)/;
736
- #lt = /^\[macro\s/;
737
- #K = /^\[endmacro[\s\]]/;
738
- #ct(t, s, i, h, n) {
739
- const r = t.aToken.length;
740
- let a = i, l = h;
741
- if (!l) {
742
- if (this.#H()) return { idx: n, ln: a };
743
- if (t.aLNum[n])
744
- a = t.aLNum[n];
745
- else {
746
- a = 1;
747
- for (let o = 0; o < n; ++o) {
748
- t.aLNum[o] ||= a;
749
- const u = t.aToken[o];
750
- u.startsWith(`
751
- `) ? a += u.length : a += (u.match(/\n/g) ?? []).length;
752
- }
753
- t.aLNum[n] = a;
754
- }
755
- return { idx: n, ln: a };
756
- }
757
- t.aLNum[0] = 1;
758
- const e = l.match(this.#rt);
759
- if (e) {
760
- l = e[1];
761
- let o = n;
762
- switch (e[2]) {
763
- case "before":
764
- for (; t.aToken[--o] !== l; )
765
- o === 0 && k.myTrace(`[jump系 無名ラベルbefore]
766
- ${String(a)} 行目以前で ${s ? "マクロ内に" : ""} ラベル【 ${l} 】がありません`, "ET"), s && t.aToken[o].search(this.#lt) > -1 && k.myTrace("[jump系 無名ラベルbefore] マクロ内にラベル【" + l + "】がありません", "ET");
767
- return { idx: o + 1, ln: t.aLNum[o] };
768
- // break;
769
- case "after":
770
- for (; t.aToken[++o] !== l; )
771
- o === r && k.myTrace(`[jump系 無名ラベルafter] ${String(a)} 行目以後でマクロ内にラベル【${l}】がありません`, "ET"), t.aToken[o].search(this.#K) > -1 && k.myTrace(`[jump系 無名ラベルafter] ${String(a)} 行目以後でマクロ内にラベル【 ${l} 】がありません`, "ET");
772
- return { idx: o + 1, ln: t.aLNum[o] };
773
- // break;
774
- default:
775
- k.myTrace("[jump系] 無名ラベル指定【label=" + l + "】が間違っています", "ET");
776
- }
777
- }
778
- a = 1;
779
- const c = new RegExp(
780
- "^" + l.replaceAll("*", "\\*") + "(?=\\s|;|\\[|\\||$)"
781
- );
782
- let f = !1;
783
- for (let o = 0; o < r; ++o) {
784
- t.aLNum[o] ||= a;
785
- const u = t.aToken[o];
786
- if (f) {
787
- this.#l.testTagEndLetml(u) ? f = !1 : a += (u.match(/\n/g) ?? []).length;
788
- continue;
789
- }
790
- const m = u.charCodeAt(0);
791
- if (m === 10) {
792
- a += u.length;
793
- continue;
794
- }
795
- if (m === 42) {
796
- if (u.search(c) > -1) return { idx: o + 1, ln: a };
797
- continue;
798
- }
799
- m === 91 && (a += (u.match(/\n/g) ?? []).length, this.#l.testTagLetml(u) && (f = !0));
800
- }
801
- throw f ? "[let_ml]の終端・[endlet_ml]がありません" : (k.myTrace(`[jump系] ラベル【${l}】がありません`, "ET"), "Dummy");
802
- }
803
- #a = /* @__PURE__ */ Object.create(null);
804
- //{} シナリオキャッシュ
805
- #ft(t) {
806
- let s = "";
807
- try {
808
- s = "ScriptIterator.resolveScript";
809
- const i = this.#l.resolveScript(t);
810
- s = "ScriptIterator.replaceScript_Wildcard", this.#mt(i), this.#a[this.#i] = this.#s = i;
811
- } catch (i) {
812
- i instanceof Error ? s += `例外 mes=${i.message}(${i.name})` : s = String(i), this.main.errScript(s, !1);
813
- }
814
- this.val.touchAreaKidoku(this.#i);
815
- }
816
- #z(t) {
817
- this.#i = t.fn, this.#t = t.idx;
818
- const s = this.#a[this.#i];
819
- s && (this.#s = s), this.#e = this.#s.aLNum[t.idx];
820
- }
821
- #ut = /^\[(call|loadplugin)\s/;
822
- #pt = /\bfn\s*=\s*[^\s\]]+/;
823
- #mt(t) {
824
- for (let s = t.len - 1; s >= 0; --s) {
825
- const i = t.aToken[s];
826
- if (!this.#ut.test(i)) continue;
827
- const [h, n] = x(i);
828
- this.#r.parse(n);
829
- const r = this.#r.hPrm.fn;
830
- if (!r) continue;
831
- const { val: a } = r;
832
- if (!a.endsWith("*")) continue;
833
- t.aToken.splice(s, 1, " ", "; " + i), t.aLNum.splice(s, 1, NaN, NaN);
834
- const l = h === "loadplugin" ? S.CSS : S.SN, e = this.cfg.matchPath("^" + a.slice(0, -1) + ".*", l);
835
- for (const c of e) {
836
- const f = i.replace(
837
- this.#pt,
838
- "fn=" + decodeURIComponent(w(c[l]))
839
- );
840
- t.aToken.splice(s, 0, f), t.aLNum.splice(s, 0, NaN);
841
- }
842
- }
843
- t.len = t.aToken.length;
844
- }
845
- #dt() {
846
- const t = this.val.touchAreaKidoku(this.#i);
847
- if (this.#n.length > 0) {
848
- t.record(this.#t);
849
- return;
850
- }
851
- this.#d = t.search(this.#t), this.val.setVal_Nochk("tmp", "const.sn.isKidoku", this.#d), !this.#d && t.record(this.#t);
852
- }
853
- #d = !1;
854
- get isKidoku() {
855
- return this.#d;
856
- }
857
- #V() {
858
- this.val.getAreaKidoku(this.#i)?.erase(this.#t), this.#d = !1;
859
- }
860
- get isNextKidoku() {
861
- let t = this.#i, s = this.#t, i = this.#s.len;
862
- if (this.#n.length > 0) {
863
- const n = this.#n[0];
864
- t = n.fn, s = n.idx;
865
- const r = this.#a[t];
866
- r && (i = r.len);
867
- }
868
- return s === i ? !1 : this.val.getAreaKidoku(t)?.search(s) ?? !1;
869
- }
870
- get normalWait() {
871
- return this.#d ? this.val.tagCh_doWait_Kidoku ? this.val.tagCh_msecWait_Kidoku : 0 : this.val.tagCh_doWait ? this.val.tagCh_msecWait : 0;
872
- }
873
- //MARK: 括弧マクロの定義
874
- #kt(t) {
875
- return this.#l.bracket2macro(t, this.hTag, this.#s, this.#t), !1;
876
- }
877
- //MARK: 一文字マクロの定義
878
- #gt(t) {
879
- return this.#l.char2macro(t, this.hTag, this.#s, this.#t), !1;
880
- }
881
- //MARK: マクロ定義の開始
882
- // eslint-disable-next-line no-irregular-whitespace
883
- #_t = /["'#;\\] ]+/;
884
- #bt(t) {
885
- const { name: s } = t;
886
- if (!s) throw "nameは必須です";
887
- if (s in this.hTag) throw `[${s}]はタグかすでに定義済みのマクロです`;
888
- if (this.#_t.test(s)) throw `[${s}]はマクロ名として異常です`;
889
- const i = this.#e, h = new L(this.#i, this.#t);
890
- for (this.#G += "|" + s, this.#N = new RegExp(`\\[(${this.#G})\\b`), this.hTag[s] = (n) => (n.design_unit = t.design_unit, this.#M(n), this.val.setMp({
891
- ...n,
892
- "const.sn.macro": JSON.stringify({ name: t.name }),
893
- // ムダに大きいスクリプター用情報を削除、名前だけに
894
- "const.sn.me_call_scriptFn": this.#i
895
- }), this.val.setVal_Nochk("mp", "const.sn.me_call_scriptFn", this.#i), this.#e = i, this.#z(h), !1); this.#t < this.#s.len; ++this.#t) {
896
- this.#s.aLNum[this.#t] ||= this.#e;
897
- const n = this.#s.aToken[this.#t];
898
- if (n.search(this.#K) > -1)
899
- return ++this.#t, !1;
900
- const r = n.charCodeAt(0);
901
- r === 10 ? this.#e += n.length : r === 91 && (this.#e += (n.match(/\n/g) ?? []).length);
902
- }
903
- throw `マクロ[${s}]定義の終端・[endmacro]がありません`;
904
- }
905
- #G = "call";
906
- #N = /\[(call)\b/;
907
- // https://regex101.com/r/Lk9ASK/1
908
- //MARK: しおりの読込
909
- #vt(t) {
910
- if ("fn" in t != "label" in t) throw "fnとlabelはセットで指定して下さい";
911
- const s = C(t, "place", 0), i = this.val.getMark(s);
912
- if (!i) throw `place=${String(s)} は存在しません`;
913
- return this.loadFromMark(
914
- t,
915
- i,
916
- 2
917
- /* ALL_STOP_AND_PLAY */
918
- );
919
- }
920
- loadFromMark(t, s, i = 0) {
921
- this.hTag.clear_event({}), this.val.mark2save(s), this.val.setMp($()), this.#m.recPagebreak();
922
- let h = [];
923
- i !== 1 && (h = this.sndMng.playLoopFromSaveObj(
924
- i === 2
925
- /* ALL_STOP_AND_PLAY */
926
- )), d(t, "do_rec", !0) && (this.#u = {
927
- hSave: this.val.cloneSave(),
928
- hPages: { ...s.hPages },
929
- aIfStk: [...s.aIfStk]
930
- });
931
- const n = {
932
- enabled: !!this.val.getVal("save:const.sn.autowc.enabled"),
933
- text: String(this.val.getVal("save:const.sn.autowc.text")),
934
- time: Number(this.val.getVal("save:const.sn.autowc.time"))
935
- };
936
- this.hTag.autowc(n), this.#o = [...this.#u.aIfStk], this.#n = [], y.stopAllTw();
937
- const r = Promise.allSettled([...h, ...this.#m.playback(this.#u.hPages)]).then(() => this.#m.cover(!1)), { index: a, fn: l } = t;
938
- if (a)
939
- return v.debugLog && console.log(`📜 %cloadFromMark index:${String(a)} move!%c fn:${l ?? ""}`, "color:#3B0;", ""), r.then(() => {
940
- this.#f(l, "", a) || this.main.resume();
941
- }).catch((o) => console.error("loadFromMark e:%o", o)), !0;
942
- this.#m.cover(!0);
943
- const e = String(this.val.getVal("save:const.sn.scriptFn")), c = Number(this.val.getVal("save:const.sn.scriptIdx"));
944
- delete this.#a[e];
945
- const { label: f } = t;
946
- return r.then(f ? () => {
947
- this.#i = e, this.#t = c, this.hTag.call({ fn: l, label: f }) || this.main.resume();
948
- } : () => {
949
- this.#f(e, "", c) || this.main.resume();
950
- }).catch((o) => console.error("loadFromMark e:%o", o)), !0;
951
- }
952
- //MARK: スクリプト再読込
953
- #St(t) {
954
- const s = this.val.getMark(0);
955
- if (!s) return !1;
956
- delete this.#a[w(s.hSave["const.sn.scriptFn"])];
957
- const i = {};
958
- for (const h in this.#a)
959
- try {
960
- this.#g(h + "@");
961
- } catch {
962
- i[h] = this.#a[h];
963
- }
964
- return this.#a = i, t.do_rec = !1, this.loadFromMark(
965
- t,
966
- s,
967
- 1
968
- /* NO_TOUCH */
969
- );
970
- }
971
- //MARK: セーブポイント指定
972
- #u = {
973
- hSave: D(),
974
- hPages: {},
975
- aIfStk: [-1]
976
- };
977
- #q = () => {
978
- const { fn: t, idx: s } = this.nowScrIdx();
979
- return this.val.setVal_Nochk("save", "const.sn.scriptFn", t), this.val.setVal_Nochk("save", "const.sn.scriptIdx", s), this.#u = {
980
- hSave: this.val.cloneSave(),
981
- hPages: this.#m.record(),
982
- aIfStk: this.#o.slice(this.#n.length)
983
- }, !1;
984
- };
985
- nowScrIdx() {
986
- if (this.#n.length === 0) return {
987
- fn: this.#i,
988
- idx: this.#t
989
- };
990
- const s = this.#n[0];
991
- return {
992
- fn: s.fn,
993
- idx: s.idx
994
- };
995
- }
996
- nowMark() {
997
- return { ...this.#u };
998
- }
999
- // コピーはここでする
1000
- //MARK: スクリプト停止位置(マクロなどなら最上位の呼び元)
1001
- nowScrFnLn() {
1002
- const { fn: t, idx: s } = this.nowScrIdx(), i = this.#a[t], h = this.#c(i, s);
1003
- return { fn: t, ...h };
1004
- }
1005
- //MARK: しおりの保存
1006
- #wt(t) {
1007
- if (!("place" in t)) throw "placeは必須です";
1008
- const s = Number(t.place);
1009
- delete t[":タグ名"], delete t.place, t.text = t.text ?? "", this.#u.json = t, this.val.setMark(s, this.#u);
1010
- const i = Number(this.val.getVal("sys:const.sn.save.place"));
1011
- return s === i && this.val.setVal_Nochk("sys", "const.sn.save.place", i + 1), !1;
1012
- }
1013
- recodeDesign(t) {
1014
- let s = "", i = 0;
1015
- const h = this.#n.length;
1016
- if (t.design_unit && h > 0) {
1017
- const l = this.#n[0];
1018
- s = l.fn, i = l.idx;
1019
- } else
1020
- s = this.#i, i = this.#t;
1021
- t[":path"] = this.#_(s);
1022
- const n = this.#a[s], r = this.#c(n, i);
1023
- t[":ln"] = r.ln, t[":col_s"] = r.col_s, t[":col_e"] = r.col_e;
1024
- const a = i - 1;
1025
- t[":idx_tkn"] = a, t[":token"] = n.aToken[a], this.sys.send2Dbg("_recodeDesign", t);
1026
- }
1027
- replace(t, s) {
1028
- this.#s.aToken[t] = s;
1029
- }
1030
- }
1031
- export {
1032
- p as ScriptIterator
1
+ import { a as RPN_COMP_CHIN, d as getFn, l as argChk_Num, s as argChk_Boolean, t as CmnLib } from "./CmnLib.js";
2
+ import { t as creSAVEDATA } from "./CmnInterface.js";
3
+ import { c as Loader } from "./pixi.js";
4
+ import "./EventListenerCtn.js";
5
+ import { n as SEARCH_PATH_ARG_EXT } from "./ConfigBase.js";
6
+ import { t as DebugMng } from "./DebugMng.js";
7
+ import { n as ReadingState, r as CmnTween, t as Reading } from "./Reading.js";
8
+ import { t as RubySpliter } from "./RubySpliter.js";
9
+ import { a as AnalyzeTagArg, i as tagToken2Name_Args, r as tagToken2Name, t as Grammar } from "./Grammar.js";
10
+ import { n as creCSArg, r as creMP, t as CallStack } from "./CallStack.js";
11
+ import { t as BUF_BGM } from "./SndBuf.js";
12
+ var BreakState = /* @__PURE__ */ function(e) {
13
+ return e[e.Running = 0] = "Running", e[e.Wait = 1] = "Wait", e[e.Break = 2] = "Break", e[e.Breaking = 3] = "Breaking", e[e.Step = 4] = "Step", e[e.Stepping = 5] = "Stepping", e[e.StepOuting = 6] = "StepOuting", e[e.StepOut = 7] = "StepOut", e;
14
+ }(BreakState || {}), SndProcOnLoad = /* @__PURE__ */ function(e) {
15
+ return e[e.MINIMAL_STOP = 0] = "MINIMAL_STOP", e[e.NO_TOUCH = 1] = "NO_TOUCH", e[e.ALL_STOP_AND_PLAY = 2] = "ALL_STOP_AND_PLAY", e;
16
+ }(SndProcOnLoad || {}), ScriptIterator = class C {
17
+ #e = {
18
+ aToken: [""],
19
+ len: 1,
20
+ aLNum: [1]
21
+ };
22
+ #t = "";
23
+ get scriptFn() {
24
+ return this.#t;
25
+ }
26
+ #n = 0;
27
+ get idxToken() {
28
+ return this.#n;
29
+ }
30
+ subIdxToken() {
31
+ --this.#n;
32
+ }
33
+ #r = 0;
34
+ get lineNum() {
35
+ return this.#r;
36
+ }
37
+ addLineNum = (e) => {
38
+ this.#r += e;
39
+ };
40
+ jumpJustBefore() {
41
+ this.#Y(this.#t, "", --this.#n);
42
+ }
43
+ #i = [];
44
+ #a;
45
+ #o = new AnalyzeTagArg();
46
+ constructor(e, u, d, f, m, h, g) {
47
+ this.cfg = e, this.hTag = u, this.main = d, this.val = f, this.prpPrs = m, this.sndMng = h, this.sys = g, u.let_ml = (e) => this.#k(e), u.endlet_ml = () => !1, u.dump_stack = () => this.#A(), u.dump_script = (e) => this.#M(e), u.else = u.elsif = u.endif = () => this.#z(), u.if = (e) => this.#B(e), u.call = (e) => this.#V(e), u.jump = (e) => this.#U(e), u.pop_stack = (e) => this.#W(e), u.return = (e) => this.#G(e), u.bracket2macro = (e) => this.#fe(e), u.char2macro = (e) => this.#pe(e), u.endmacro = (e) => this.#G(e), u.macro = (e) => this.#he(e), u.load = (e) => this.#ve(e), u.reload_script = (e) => this.#ye(e), u.record_place = () => this.#xe(), u.save = (e) => this.#Se(e), e.oCfg.debug.token && (this.#Z = (e) => {
48
+ e.trim() !== "" && console.log(`🌱 トークン ${this.#t}:${String(this.#r)} (i:${String(this.#n)} cs:${String(this.#i.length)}) %c【${e}】`, "background-color:#350;");
49
+ }), e.oCfg.debug.tag && (this.#S = (e) => console.log(`🌲 タグ解析 ${this.#t}:${String(this.#r)} (i:${String(this.#n)} cs:${String(this.#i.length)}) %c[${e} %o]`, "background-color:#30B;", this.#o.hPrm)), f.defTmp("const.sn.aIfStk.length", () => this.#R.length), f.defTmp("const.sn.vctCallStk.length", () => this.#i.length), this.#a = new Grammar(e);
50
+ let _ = e.oCfg.init.escape;
51
+ if (this.#a.setEscape(_), RubySpliter.setEscape(_), CmnLib.isDbg) {
52
+ this.#c, g.addHook((e, u) => this.#c[e]?.(u)), this.isBreak = (e) => this.#y(e);
53
+ let e = () => this.analyzeInit();
54
+ this.analyzeInit = () => {
55
+ this.analyzeInit = () => {}, this.sys.send2Dbg("hi", {});
56
+ }, this.#c.auth = (u) => {
57
+ let d = u.hBreakpoint.hFn2hLineBP;
58
+ for (let [e, u] of Object.entries(d)) this.#s(e, u);
59
+ C.#_ = {};
60
+ for (let e of u.hBreakpoint.aFunc) C.#_[e.name] = 1;
61
+ if (u.stopOnEntry) {
62
+ let u;
63
+ for (; u = this.nextToken();) {
64
+ let e = u.charCodeAt(0);
65
+ if (e === 91 || e === 38 || e === 42 && u.length === 1) break;
66
+ e === 10 && (this.#r += u.length);
67
+ }
68
+ this.sys.callHook("stopOnEntry", {}), this.analyzeInit = e, this.analyzeInit();
69
+ } else this.noticeWait = () => {
70
+ this.noticeWait = () => {}, this.sys.callHook("stopOnEntry", {});
71
+ }, this.analyzeInit = e, this.analyzeInit();
72
+ };
73
+ } else this.recodeDesign = () => {};
74
+ }
75
+ noticeWait = () => {};
76
+ #s(e, u) {
77
+ C.#g[this.#u(e)] = u;
78
+ }
79
+ destroy() {
80
+ this.isBreak = this.#xe = () => !1;
81
+ }
82
+ #c = {
83
+ auth: () => {},
84
+ disconnect: () => {
85
+ C.#g = {}, C.#_ = {}, this.isBreak = () => !1, this.#c.continue({}), this.#v = BreakState.Running;
86
+ },
87
+ restart: () => {
88
+ this.isBreak = () => !1;
89
+ },
90
+ add_break: (e) => this.#s(e.fn, e.o),
91
+ data_break: (e) => {
92
+ this.#v === BreakState.Running && (this.#v = BreakState.Wait, this.main.setLoop(!1, `変数 ${String(e.dataId)}【${String(e.old_v)}】→【${String(e.new_v)}】データブレーク`), this.sys.callHook("stopOnDataBreakpoint", {}), this.sys.send2Dbg("stopOnDataBreakpoint", {}));
93
+ },
94
+ set_func_break: (e) => {
95
+ C.#_ = {};
96
+ for (let u of e.a) C.#_[u.name] = 1;
97
+ this.sys.send2Dbg(e.ri, {});
98
+ },
99
+ stack: (e) => this.sys.send2Dbg(e.ri, { a: this.#x() }),
100
+ eval: (e) => {
101
+ this.sys.send2Dbg(e.ri, { v: this.prpPrs.parse(e.txt) });
102
+ },
103
+ continue: () => {
104
+ this.#h() || (this.#n -= this.#m, this.#v = BreakState.Breaking, this.main.setLoop(!0), this.main.resume());
105
+ },
106
+ stepover: (e) => this.#d(e),
107
+ stepin: () => {
108
+ if (this.#h()) return;
109
+ let e = this.#e.aToken[this.#n - this.#m];
110
+ this.sys.callHook(`stopOnStep${this.#_e.test(e ?? "") ? "In" : ""}`, {}), this.#n -= this.#m, this.#v = this.#v === BreakState.Wait ? BreakState.Step : BreakState.Stepping, this.main.setLoop(!0), this.main.resume();
111
+ },
112
+ stepout: (e) => {
113
+ this.#h() || (this.#i.length > 0 ? this.#f(!0) : this.#d(e));
114
+ },
115
+ pause: () => {
116
+ this.#v = BreakState.Step, this.main.setLoop(!1, "一時停止"), this.sys.send2Dbg("stopOnStep", {});
117
+ },
118
+ stopOnEntry: () => {
119
+ this.#v = BreakState.Step, this.main.setLoop(!1, "一時停止"), this.sys.send2Dbg("stopOnEntry", {});
120
+ }
121
+ };
122
+ #l = (e) => this.cfg.searchPath(e, SEARCH_PATH_ARG_EXT.SCRIPT);
123
+ #u = (e) => this.sys.pathBaseCnvSnPath4Dbg + this.#l(e);
124
+ #d(e) {
125
+ if (this.#h()) return;
126
+ let u = this.#e.aToken[this.#n - this.#m];
127
+ this.#_e.test(u ?? "") ? this.#f(!1) : (this.sys.callHook("stopOnStep", {}), this.#c.stepin(e));
128
+ }
129
+ #f(e) {
130
+ this.sys.callHook(`stopOnStep${e ? "Out" : ""}`, {}), this.#p = this.#i.length - (e ? 1 : 0), this.#n -= this.#m, this.#v = e ? BreakState.StepOut : BreakState.StepOuting, this.main.setLoop(!0), this.main.resume();
131
+ }
132
+ #p = 0;
133
+ get #m() {
134
+ return this.#v === BreakState.Break || this.#v === BreakState.Step ? 1 : 0;
135
+ }
136
+ #h() {
137
+ return this.#n < this.#e.len ? !1 : (this.sys.callHook("stopOnEntry", {}), this.main.setLoop(!1, "スクリプト終端です isIdxOverLast"), !0);
138
+ }
139
+ static #g = {};
140
+ static #_ = {};
141
+ #v = BreakState.Running;
142
+ isBreak = (e) => !1;
143
+ #y(e) {
144
+ switch (this.#v) {
145
+ case BreakState.StepOuting:
146
+ this.#b(), this.#v = BreakState.StepOut;
147
+ break;
148
+ case BreakState.StepOut:
149
+ if (this.#i.length !== this.#p) break;
150
+ return this.#v = BreakState.Step, this.main.setLoop(!1, "ステップ実行"), this.sys.send2Dbg("stopOnStep", {}), !0;
151
+ case BreakState.Stepping:
152
+ this.#b(), this.#v = BreakState.Step;
153
+ break;
154
+ case BreakState.Step: return this.#b(), this.main.setLoop(!1, "ステップ実行"), this.sys.send2Dbg("stopOnStep", {}), !0;
155
+ case BreakState.Breaking:
156
+ this.#b(), this.#v = BreakState.Running;
157
+ break;
158
+ default:
159
+ if (tagToken2Name(e) in C.#_) return this.#v = BreakState.Break, this.main.setLoop(!1, `関数 ${e} ブレーク`), this.sys.callHook("stopOnBreakpoint", {}), this.sys.send2Dbg("stopOnBreakpoint", {}), !0;
160
+ {
161
+ let e = C.#g[this.#u(this.#t)];
162
+ if (!e) break;
163
+ let u = e[this.#r];
164
+ if (!u) break;
165
+ if (u.condition) {
166
+ if (!this.prpPrs.parse(u.condition)) break;
167
+ } else if ("hitCondition" in u && --u.hitCondition > 0) break;
168
+ let d = this.#v === BreakState.Running;
169
+ this.#v = BreakState.Break, this.main.setLoop(!1, d ? (u.condition ? "条件" : "ヒットカウント") + "ブレーク" : "ステップ実行");
170
+ let f = d ? "stopOnBreakpoint" : "stopOnStep";
171
+ this.sys.callHook(f, {}), this.sys.send2Dbg(f, {});
172
+ }
173
+ return !0;
174
+ }
175
+ return !1;
176
+ }
177
+ #b() {
178
+ let e = C.#g[getFn(this.#t)]?.[this.#r];
179
+ e?.hitCondition && --e.hitCondition;
180
+ }
181
+ #x() {
182
+ let e = this.#v === BreakState.Breaking ? 1 : 0, u = this.#e.aToken[this.#n - 1 + e], d = this.#u(this.#t), f = tagToken2Name(u), p = f ? `[${f}]` : u, m = String(this.val.getVal("mp:const.sn.macro") ?? "{}");
183
+ if (this.#n === 0) return [{
184
+ fn: d,
185
+ ln: 1,
186
+ col: 1,
187
+ nm: p,
188
+ ma: m
189
+ }];
190
+ let h = this.#j(this.#e, this.#n), g = [{
191
+ fn: d,
192
+ ln: h.ln,
193
+ col: h.col_s + 1,
194
+ nm: p,
195
+ ma: m
196
+ }], _ = this.#i.length;
197
+ if (_ === 0) return g;
198
+ for (let e = _ - 1; e >= 0; --e) {
199
+ let u = this.#i[e], d = this.#re[u.fn];
200
+ if (!d) continue;
201
+ let f = d.aToken[u.idx - 1];
202
+ if (!f) continue;
203
+ let p = this.#j(d, u.idx), m = tagToken2Name(f);
204
+ g.push({
205
+ fn: this.#u(u.fn),
206
+ ln: p.ln,
207
+ col: p.col_s + 1,
208
+ nm: m ? `[${m}]` : f,
209
+ ma: u.csArg[":hMp"]["const.sn.macro"]
210
+ });
211
+ }
212
+ return g;
213
+ }
214
+ #S = (e) => {};
215
+ async タグ解析(u, d) {
216
+ let p = this.hTag[u];
217
+ if (!p) throw `未定義のタグ【${u}】です`;
218
+ this.#o.parse(d), this.#S(u);
219
+ let m = this.#o.hPrm;
220
+ if (m.cond) {
221
+ let e = m.cond.val;
222
+ if (!e || e.startsWith("&")) throw "属性condは「&」が不要です";
223
+ let u = this.prpPrs.parse(e), d = String(u);
224
+ if (d === "null" || d === "undefined" || !u) return !1;
225
+ }
226
+ let h = {}, g = this.#i.at(-1)?.csArg ?? creCSArg(), _ = this.#i.length;
227
+ if (this.#o.isKomeParam) {
228
+ if (_ === 0) throw "属性「*」はマクロのみ有効です";
229
+ h = { ...g };
230
+ }
231
+ h[":タグ名"] = u;
232
+ for (let [e, { val: u, def: d }] of Object.entries(m)) {
233
+ let f = u;
234
+ if (u.startsWith("%")) {
235
+ if (_ === 0) throw "属性「%」はマクロ定義内でのみ使用できます(そのマクロの引数を示す簡略文法であるため)";
236
+ let u = g[f.slice(1)];
237
+ if (u) {
238
+ h[e] = u;
239
+ continue;
240
+ }
241
+ if (d === void 0 || d === "null") continue;
242
+ f = d;
243
+ }
244
+ if (f = this.prpPrs.getValAmpersand(f ?? ""), f !== "undefined") {
245
+ h[e] = f;
246
+ continue;
247
+ }
248
+ d !== void 0 && (f = this.prpPrs.getValAmpersand(d), f !== "undefined" && (h[e] = f));
249
+ }
250
+ if (Reading.needGoTxt && this.#C.has(u)) {
251
+ let { promise: u, resolve: d } = Promise.withResolvers();
252
+ Reading.beginProc(RPN_COMP_CHIN, () => d(0), !1, () => d(0)), Reading.goTxt(), this.val.saveKidoku(), await u;
253
+ }
254
+ this.#w.has(u) && (this.#D.hideHint(), CmnTween.stopEndTrans());
255
+ let v = this.#T[u];
256
+ return v && argChk_Boolean(h, "canskip", this.#E[u] ?? !0) && this.#D.isSkipping ? v(h) : p(h);
257
+ }
258
+ #C = new Set([
259
+ "trans",
260
+ "wt",
261
+ "wait_tsy",
262
+ "wv",
263
+ "l",
264
+ "p",
265
+ "s",
266
+ "wait",
267
+ "waitclick",
268
+ "wb",
269
+ "wf",
270
+ "wl",
271
+ "ws",
272
+ "quake",
273
+ "wq"
274
+ ]);
275
+ #w = new Set([
276
+ "finish_trans",
277
+ "trans",
278
+ "quake",
279
+ "stop_quake",
280
+ "add_filter"
281
+ ]);
282
+ #T = {
283
+ wt: () => (CmnTween.stopEndTrans(), !1),
284
+ wait_tsy: (e) => this.hTag.stop_tsy(e),
285
+ wait: () => !1,
286
+ wb: () => this.hTag.stopfadese({ buf: "BGM" }),
287
+ wf: (e) => this.hTag.stopfadese(e),
288
+ wq: () => this.hTag.stop_quake({}),
289
+ quake: () => !1
290
+ };
291
+ #E = {
292
+ wt: !0,
293
+ wait_tsy: !0,
294
+ wv: !0,
295
+ wait: !0,
296
+ playbgm: !1,
297
+ playse: !0,
298
+ wb: !1,
299
+ wf: !1,
300
+ ws: !1,
301
+ wq: !0
302
+ };
303
+ #D;
304
+ #O;
305
+ setOtherObj(e, u) {
306
+ this.#D = e, this.#O = u;
307
+ }
308
+ #k(e) {
309
+ let { name: u } = e;
310
+ if (!u) throw "nameは必須です";
311
+ let d = "", f = this.#e.len;
312
+ for (; this.#n < f && (d = this.#e.aToken[this.#n], d === ""); ++this.#n);
313
+ return e.text = d, e.cast = "str", this.hTag.let(e), this.#n += 2, this.#r += (d.match(/\n/g) ?? []).length, !1;
314
+ }
315
+ #A() {
316
+ if (this.#n === 0) return console.group(`🥟 [dump_stack] スクリプト現在地 fn:${this.#t} line:1 col:0`), console.groupEnd(), !1;
317
+ let e = this.#j(this.#e, this.#n), u = `スクリプト現在地 fn:${this.#t} line:${String(e.ln)} col:${String(e.col_s + 1)}`;
318
+ console.group(`🥟 [dump_stack] ${u}`);
319
+ let d = this.#i.length;
320
+ if (d > 0) {
321
+ console.info(u);
322
+ for (let e = d - 1; e >= 0; --e) {
323
+ let u = this.#i[e], f = u.csArg[":hMp"], p = f ? f[":タグ名"] : void 0, m = u.csArg[":タグ名"] ?? "", h = this.#j(this.#re[u.fn], u.idx);
324
+ console.info(`${String(d - e)}つ前のコール元 fn:${u.fn} line:${String(h.ln)} col:${String(h.col_s + 1)}${p ? "([" + p + "]マクロ内)" : " "}で [${m} ...]をコール`);
325
+ }
326
+ }
327
+ return console.groupEnd(), !1;
328
+ }
329
+ #j(e, u) {
330
+ let d = {
331
+ ln: 1,
332
+ col_s: 0,
333
+ col_e: 0
334
+ };
335
+ if (!e) return d;
336
+ let f = u - 1, p = d.ln = e.aLNum[f];
337
+ for (; e.aLNum[f] === p;) {
338
+ let u = e.aToken[f];
339
+ if (!u.startsWith("\n")) {
340
+ let e = u.length;
341
+ d.col_e > 0 && (d.col_s += e), d.col_e += e;
342
+ }
343
+ if (--f < 0) break;
344
+ }
345
+ return d;
346
+ }
347
+ #M(e) {
348
+ let { set_fnc: u, break_fnc: d } = e;
349
+ if (!u) throw "set_fncは必須です";
350
+ if (this.#N = globalThis[u], !this.#N) {
351
+ if (argChk_Boolean(e, "need_err", !0)) throw `HTML内に関数${u}が見つかりません`;
352
+ return this.#N = () => {}, !1;
353
+ }
354
+ if (this.noticeBreak = (e) => {
355
+ this.#F !== this.#t && (this.#F = this.#t, this.#N(this.#I[this.#t] ??= this.#e.aToken.join(""))), this.#P(this.#r, e);
356
+ }, this.noticeBreak(!0), !d) return !1;
357
+ if (this.#P = globalThis[d], !this.#P) {
358
+ if (argChk_Boolean(e, "need_err", !0)) throw `HTML内に関数${d}が見つかりません`;
359
+ this.#P = () => {};
360
+ }
361
+ return !1;
362
+ }
363
+ #N = () => {};
364
+ #P = () => {};
365
+ #F = "";
366
+ #I = {};
367
+ noticeBreak = (e) => {};
368
+ #L = 5;
369
+ dumpErrForeLine() {
370
+ if (this.#n === 0) {
371
+ console.group(`🥟 Error line (from 0 rows before) fn:${this.#t}`), console.groupEnd();
372
+ return;
373
+ }
374
+ let e = "";
375
+ for (let u = this.#n - 1; u >= 0 && (e = String(this.#e.aToken[u]) + e, !((e.match(/\n/g) ?? []).length >= this.#L)); --u);
376
+ let u = e.split("\n").slice(-this.#L), d = u.length;
377
+ console.group(`🥟 Error line (from ${String(d)} rows before) fn:${this.#t}`);
378
+ let f = String(this.#r).length, p = this.#j(this.#e, this.#n);
379
+ for (let e = 0; e < d; ++e) {
380
+ let m = this.#r - d + e + 1, h = `${String(m).padStart(f, " ")}: %c`, g = u[e], _ = g.length > 75 ? g.slice(0, 75) + "…" : g;
381
+ e === d - 1 ? console.info(h + _.slice(0, p.col_s) + "%c" + _.slice(p.col_s), "color: black; background-color: skyblue;", "color: black; background-color: pink;") : console.info(h + _, "color: black; background-color: skyblue;");
382
+ }
383
+ console.groupEnd();
384
+ }
385
+ #R = [-1];
386
+ #z() {
387
+ let e = this.#R[0];
388
+ if (!e) throw "this.#aIfStk が異常です";
389
+ if (e === -1) throw "ifブロック内ではありません";
390
+ return this.#n = e, this.#R.shift(), !1;
391
+ }
392
+ #B(e) {
393
+ let { exp: u } = e;
394
+ if (!u) throw "expは必須です";
395
+ if (u.startsWith("&")) throw "属性expは「&」が不要です";
396
+ let d = 0, f = this.prpPrs.parse(u) ? this.#n : -1, p = this.#e.aLNum[this.#n], m = this.#r - ((p ?? 0) || 0), h = this.#e.len;
397
+ for (; this.#n < h; ++this.#n) {
398
+ let e = this.#e.aLNum[this.#n];
399
+ this.#e.aLNum[this.#n] = ((e ?? 0) || 0) + m;
400
+ let u = this.#e.aToken[this.#n];
401
+ if (!u) continue;
402
+ let p = u.charCodeAt(0);
403
+ if (p === 10) {
404
+ this.#r += u.length;
405
+ continue;
406
+ }
407
+ if (p !== 91) continue;
408
+ let [h, g] = tagToken2Name_Args(u);
409
+ if (!(h in this.hTag)) throw `未定義のタグ[${h}]です`;
410
+ switch (this.#o.parse(g), h) {
411
+ case "if":
412
+ ++d;
413
+ break;
414
+ case "elsif":
415
+ {
416
+ if (d > 0 || f > -1) break;
417
+ let e = this.#o.hPrm.exp?.val;
418
+ if (!e) throw "expは必須です";
419
+ if (e.startsWith("&")) throw "属性expは「&」が不要です";
420
+ this.prpPrs.parse(e) && (f = this.#n + 1);
421
+ }
422
+ break;
423
+ case "else":
424
+ if (d > 0) break;
425
+ f === -1 && (f = this.#n + 1);
426
+ break;
427
+ case "endif":
428
+ if (d > 0) {
429
+ --d;
430
+ break;
431
+ }
432
+ return f === -1 ? (++this.#n, this.#e.aLNum[this.#n] += m) : (this.#R.unshift(this.#n + 1), this.#n = f, this.#r = this.#e.aLNum[this.#n]), !1;
433
+ }
434
+ }
435
+ throw "[endif]がないままスクリプト終端です";
436
+ }
437
+ #V(e) {
438
+ argChk_Boolean(e, "count", !1) || this.#de();
439
+ let { fn: u } = e;
440
+ return u && this.#l(u), this.#H({ ...e }, ReadingState.popLocalEvts()), argChk_Boolean(e, "clear_local_event", !1) && this.hTag.clear_event({}), this.#Y(u, e.label);
441
+ }
442
+ #H(e, u) {
443
+ let d = {
444
+ ...e,
445
+ ...u ? { ":hEvt1Time": u } : {},
446
+ ":hMp": this.val.cloneMp(),
447
+ ":lenIfStk": this.#R.length
448
+ };
449
+ this.#e.aLNum[this.#n] = this.#r, this.#K || (d[":resvToken"] = "", this.#q()), this.#i.push(new CallStack(this.#t, this.#n, d)), this.#R.unshift(-1);
450
+ }
451
+ #U(e) {
452
+ return argChk_Boolean(e, "count", !0) || this.#de(), this.#R[0] = -1, this.#Y(e.fn, e.label);
453
+ }
454
+ #W(e) {
455
+ if (argChk_Boolean(e, "clear", !1)) this.#i = [];
456
+ else if (!this.#i.pop()) throw "スタックが空です";
457
+ return this.#q(), this.#R = [-1], this.val.setMp(creMP()), !1;
458
+ }
459
+ #G(e) {
460
+ let u = this.#i.pop();
461
+ if (!u) throw "スタックが空です";
462
+ let d = u.csArg;
463
+ this.#R = this.#R.slice(-d[":lenIfStk"]);
464
+ let f = d[":hMp"];
465
+ f && this.val.setMp(f);
466
+ let p = d[":resvToken"];
467
+ p ? this.nextToken = () => (this.#q(), p) : this.#q(), d[":hEvt1Time"] && ReadingState.pushLocalEvts(d[":hEvt1Time"]);
468
+ let { fn: m, label: h } = e;
469
+ return m || h ? this.#Y(m, h) : u.fn in this.#re ? (this.#ae(u), !1) : this.#Y(u.fn, "", u.idx);
470
+ }
471
+ #K = "";
472
+ #q() {
473
+ this.#K = "", this.nextToken = () => this.#X();
474
+ }
475
+ #J = "";
476
+ #Y(e = "", u = "", d = 0) {
477
+ if (CmnLib.debugLog && console.log(`📜 %c1:jumpWork%c fn:${e} lbl:${u} idx:${String(d)}`, "color:#3B0;", ""), !e && !u && this.main.errScript("[jump系] fnまたはlabelは必須です"), u ? (u.startsWith("*") || this.main.errScript("[jump系] labelは*で始まります"), this.#J = u, this.#J.startsWith("**") || (this.#n = d)) : (this.#J = "", this.#n = d), !e) return this.analyzeInit(), !1;
478
+ if (e.includes("@")) throw "[jump系] fn には文字「@」は禁止です";
479
+ let f = this.#l(e);
480
+ if (e === this.#t) return this.analyzeInit(), !1;
481
+ this.#t = e;
482
+ let m = this.#re[e];
483
+ if (m) return this.#e = m, this.analyzeInit(), !1;
484
+ let g = `jumpWork fn:${e}`;
485
+ Reading.beginProc(g);
486
+ let _ = "", v = new Loader();
487
+ try {
488
+ _ = this.#l(e + "@"), v.add({
489
+ name: e + ":base",
490
+ url: f
491
+ }), v.add({
492
+ name: e,
493
+ url: _
494
+ });
495
+ } catch {
496
+ v.add({
497
+ name: e,
498
+ url: f
499
+ });
500
+ }
501
+ return v.use((e, u) => {
502
+ this.sys.dec(e.extension, e.data).then((d) => {
503
+ e.data = d, u();
504
+ }).catch((d) => {
505
+ this.main.errScript(`[jump系]snロード失敗です fn:${e.name} ${String(d)}`, !1), u();
506
+ });
507
+ }).load((u, d) => {
508
+ if (Reading.endProc(g), _) {
509
+ let u = d[e + ":base"].data, f = d[e].data, p = u.split("\n"), m = f.split("\n"), h = p.length, g = m.length;
510
+ for (let e = 0; e < g && e < h; ++e) m[e] ||= p[e] ?? "";
511
+ d[e].data = m.join("\n"), delete d[e + ":base"];
512
+ }
513
+ this.nextToken = this.#X, this.#r = 1, this.#ie(d[e].data), this.hTag.record_place({}), this.analyzeInit();
514
+ }), !0;
515
+ }
516
+ analyzeInit() {
517
+ CmnLib.debugLog && console.log(`📜 %c9:analyzeInit%c fn:${this.#t} lbl:${this.#J} idx:${String(this.#n)}`, "color:#3B0;", "");
518
+ let e = this.#ne(this.#e, !!this.val.getVal("mp:const.sn.macro.name"), this.#r, this.#J, this.#n);
519
+ this.#n = e.idx, this.#r = e.ln;
520
+ }
521
+ nextToken = () => "";
522
+ #X() {
523
+ if (this.#Q()) return "";
524
+ this.#le(), this.#e.aLNum[this.#n] ||= this.#r;
525
+ let e = this.#e.aToken[this.#n];
526
+ return this.#Z(e), ++this.#n, e;
527
+ }
528
+ #Z = (e) => {};
529
+ #Q() {
530
+ return this.#n < this.#e.len ? !1 : (this.main.errScript("スクリプト終端です errOverScr"), !0);
531
+ }
532
+ #$ = /(\*{2,})([^|]*)/;
533
+ #ee = /^\[macro\s/;
534
+ #te = /^\[endmacro[\s\]]/;
535
+ #ne(e, u, d, f, p) {
536
+ let m = e.aToken.length, h = d, g = f;
537
+ if (!g) {
538
+ if (this.#Q()) return {
539
+ idx: p,
540
+ ln: h
541
+ };
542
+ if (e.aLNum[p]) h = e.aLNum[p];
543
+ else {
544
+ h = 1;
545
+ for (let u = 0; u < p; ++u) {
546
+ e.aLNum[u] ||= h;
547
+ let d = e.aToken[u];
548
+ d.startsWith("\n") ? h += d.length : h += (d.match(/\n/g) ?? []).length;
549
+ }
550
+ e.aLNum[p] = h;
551
+ }
552
+ return {
553
+ idx: p,
554
+ ln: h
555
+ };
556
+ }
557
+ e.aLNum[0] = 1;
558
+ let v = g.match(this.#$);
559
+ if (v) {
560
+ g = v[1];
561
+ let d = p;
562
+ switch (v[2]) {
563
+ case "before":
564
+ for (; e.aToken[--d] !== g;) d === 0 && DebugMng.myTrace(`[jump系 無名ラベルbefore]
565
+ ${String(h)} 行目以前で ${u ? "マクロ内に" : ""} ラベル【 ${g} 】がありません`, "ET"), u && e.aToken[d].search(this.#ee) > -1 && DebugMng.myTrace("[jump系 無名ラベルbefore] マクロ内にラベル【" + g + "】がありません", "ET");
566
+ return {
567
+ idx: d + 1,
568
+ ln: e.aLNum[d]
569
+ };
570
+ case "after":
571
+ for (; e.aToken[++d] !== g;) d === m && DebugMng.myTrace(`[jump系 無名ラベルafter] ${String(h)} 行目以後でマクロ内にラベル【${g}】がありません`, "ET"), e.aToken[d].search(this.#te) > -1 && DebugMng.myTrace(`[jump系 無名ラベルafter] ${String(h)} 行目以後でマクロ内にラベル【 ${g} 】がありません`, "ET");
572
+ return {
573
+ idx: d + 1,
574
+ ln: e.aLNum[d]
575
+ };
576
+ default: DebugMng.myTrace("[jump系] 無名ラベル指定【label=" + g + "】が間違っています", "ET");
577
+ }
578
+ }
579
+ h = 1;
580
+ let y = /* @__PURE__ */ RegExp("^" + g.replaceAll("*", "\\*") + "(?=\\s|;|\\[|\\||$)"), b = !1;
581
+ for (let u = 0; u < m; ++u) {
582
+ e.aLNum[u] ||= h;
583
+ let d = e.aToken[u];
584
+ if (b) {
585
+ this.#a.testTagEndLetml(d) ? b = !1 : h += (d.match(/\n/g) ?? []).length;
586
+ continue;
587
+ }
588
+ let f = d.charCodeAt(0);
589
+ if (f === 10) {
590
+ h += d.length;
591
+ continue;
592
+ }
593
+ if (f === 42) {
594
+ if (d.search(y) > -1) return {
595
+ idx: u + 1,
596
+ ln: h
597
+ };
598
+ continue;
599
+ }
600
+ f === 91 && (h += (d.match(/\n/g) ?? []).length, this.#a.testTagLetml(d) && (b = !0));
601
+ }
602
+ throw b ? "[let_ml]の終端・[endlet_ml]がありません" : (DebugMng.myTrace(`[jump系] ラベル【${g}】がありません`, "ET"), "Dummy");
603
+ }
604
+ #re = Object.create(null);
605
+ #ie(e) {
606
+ let u = "";
607
+ try {
608
+ u = "ScriptIterator.resolveScript";
609
+ let d = this.#a.resolveScript(e);
610
+ u = "ScriptIterator.replaceScript_Wildcard", this.#ce(d), this.#re[this.#t] = this.#e = d;
611
+ } catch (e) {
612
+ e instanceof Error ? u += `例外 mes=${e.message}(${e.name})` : u = String(e), this.main.errScript(u, !1);
613
+ }
614
+ this.val.touchAreaKidoku(this.#t);
615
+ }
616
+ #ae(e) {
617
+ this.#t = e.fn, this.#n = e.idx;
618
+ let u = this.#re[this.#t];
619
+ u && (this.#e = u), this.#r = this.#e.aLNum[e.idx];
620
+ }
621
+ #oe = /^\[(call|loadplugin)\s/;
622
+ #se = /\bfn\s*=\s*[^\s\]]+/;
623
+ #ce(e) {
624
+ for (let d = e.len - 1; d >= 0; --d) {
625
+ let f = e.aToken[d];
626
+ if (!this.#oe.test(f)) continue;
627
+ let [p, m] = tagToken2Name_Args(f);
628
+ this.#o.parse(m);
629
+ let h = this.#o.hPrm.fn;
630
+ if (!h) continue;
631
+ let { val: _ } = h;
632
+ if (!_.endsWith("*")) continue;
633
+ e.aToken.splice(d, 1, " ", "; " + f), e.aLNum.splice(d, 1, NaN, NaN);
634
+ let v = p === "loadplugin" ? SEARCH_PATH_ARG_EXT.CSS : SEARCH_PATH_ARG_EXT.SN, y = this.cfg.matchPath("^" + _.slice(0, -1) + ".*", v);
635
+ for (let p of y) {
636
+ let m = f.replace(this.#se, "fn=" + decodeURIComponent(getFn(p[v])));
637
+ e.aToken.splice(d, 0, m), e.aLNum.splice(d, 0, NaN);
638
+ }
639
+ }
640
+ e.len = e.aToken.length;
641
+ }
642
+ #le() {
643
+ let e = this.val.touchAreaKidoku(this.#t);
644
+ if (this.#i.length > 0) {
645
+ e.record(this.#n);
646
+ return;
647
+ }
648
+ this.#ue = e.search(this.#n), this.val.setVal_Nochk("tmp", "const.sn.isKidoku", this.#ue), !this.#ue && e.record(this.#n);
649
+ }
650
+ #ue = !1;
651
+ get isKidoku() {
652
+ return this.#ue;
653
+ }
654
+ #de() {
655
+ this.val.getAreaKidoku(this.#t)?.erase(this.#n), this.#ue = !1;
656
+ }
657
+ get isNextKidoku() {
658
+ let e = this.#t, u = this.#n, d = this.#e.len;
659
+ if (this.#i.length > 0) {
660
+ let f = this.#i[0];
661
+ e = f.fn, u = f.idx;
662
+ let p = this.#re[e];
663
+ p && (d = p.len);
664
+ }
665
+ return u === d ? !1 : this.val.getAreaKidoku(e)?.search(u) ?? !1;
666
+ }
667
+ get normalWait() {
668
+ return this.#ue ? this.val.tagCh_doWait_Kidoku ? this.val.tagCh_msecWait_Kidoku : 0 : this.val.tagCh_doWait ? this.val.tagCh_msecWait : 0;
669
+ }
670
+ #fe(e) {
671
+ return this.#a.bracket2macro(e, this.hTag, this.#e, this.#n), !1;
672
+ }
673
+ #pe(e) {
674
+ return this.#a.char2macro(e, this.hTag, this.#e, this.#n), !1;
675
+ }
676
+ #me = /["'#;\\] ]+/;
677
+ #he(e) {
678
+ let { name: u } = e;
679
+ if (!u) throw "nameは必須です";
680
+ if (u in this.hTag) throw `[${u}]はタグかすでに定義済みのマクロです`;
681
+ if (this.#me.test(u)) throw `[${u}]はマクロ名として異常です`;
682
+ let d = this.#r, f = new CallStack(this.#t, this.#n);
683
+ for (this.#ge += "|" + u, this.#_e = /* @__PURE__ */ RegExp(`\\[(${this.#ge})\\b`), this.hTag[u] = (u) => (this.#H(u), this.val.setMp({
684
+ ...u,
685
+ "const.sn.macro": JSON.stringify({ name: e.name }),
686
+ "const.sn.me_call_scriptFn": this.#t
687
+ }), this.val.setVal_Nochk("mp", "const.sn.me_call_scriptFn", this.#t), this.#r = d, this.#ae(f), !1); this.#n < this.#e.len; ++this.#n) {
688
+ this.#e.aLNum[this.#n] ||= this.#r;
689
+ let e = this.#e.aToken[this.#n];
690
+ if (e.search(this.#te) > -1) return ++this.#n, !1;
691
+ let u = e.charCodeAt(0);
692
+ u === 10 ? this.#r += e.length : u === 91 && (this.#r += (e.match(/\n/g) ?? []).length);
693
+ }
694
+ throw `マクロ[${u}]定義の終端・[endmacro]がありません`;
695
+ }
696
+ #ge = "call";
697
+ #_e = /\[(call)\b/;
698
+ #ve(e) {
699
+ if ("fn" in e != "label" in e) throw "fnとlabelはセットで指定して下さい";
700
+ let u = argChk_Num(e, "place", 0), f = this.val.getMark(u);
701
+ if (!f) throw `place=${String(u)} は存在しません`;
702
+ return this.loadFromMark(e, f, SndProcOnLoad.ALL_STOP_AND_PLAY);
703
+ }
704
+ loadFromMark(e, u, d = SndProcOnLoad.MINIMAL_STOP) {
705
+ this.hTag.clear_event({}), this.val.mark2save(u), this.val.setMp(creMP()), this.#O.recPagebreak();
706
+ let m = [];
707
+ d !== SndProcOnLoad.NO_TOUCH && (m = this.sndMng.playLoopFromSaveObj(d === SndProcOnLoad.ALL_STOP_AND_PLAY)), argChk_Boolean(e, "do_rec", !0) && (this.#be = {
708
+ hSave: this.val.cloneSave(),
709
+ hPages: { ...u.hPages },
710
+ aIfStk: [...u.aIfStk]
711
+ });
712
+ let h = {
713
+ enabled: !!this.val.getVal("save:const.sn.autowc.enabled"),
714
+ text: String(this.val.getVal("save:const.sn.autowc.text")),
715
+ time: Number(this.val.getVal("save:const.sn.autowc.time"))
716
+ };
717
+ this.hTag.autowc(h), this.#R = [...this.#be.aIfStk], this.#i = [], CmnTween.stopAllTw();
718
+ let g = Promise.allSettled([...m, ...this.#O.playback(this.#be.hPages)]).then(() => this.#O.cover(!1)), { index: _, fn: v } = e;
719
+ if (_) return CmnLib.debugLog && console.log(`📜 %cloadFromMark index:${String(_)} move!%c fn:${v ?? ""}`, "color:#3B0;", ""), g.then(() => {
720
+ this.#Y(v, "", _) || this.main.resume();
721
+ }).catch((e) => console.error("loadFromMark e:%o", e)), !0;
722
+ this.#O.cover(!0);
723
+ let b = String(this.val.getVal("save:const.sn.scriptFn")), x = Number(this.val.getVal("save:const.sn.scriptIdx"));
724
+ delete this.#re[b];
725
+ let { label: S } = e;
726
+ return g.then(S ? () => {
727
+ this.#t = b, this.#n = x, this.hTag.call({
728
+ ...v ? { fn: v } : {},
729
+ label: S
730
+ }) || this.main.resume();
731
+ } : () => {
732
+ this.#Y(b, "", x) || this.main.resume();
733
+ }).catch((e) => console.error("loadFromMark e:%o", e)), !0;
734
+ }
735
+ #ye(e) {
736
+ let d = this.val.getMark(0);
737
+ if (!d) return !1;
738
+ delete this.#re[getFn(d.hSave["const.sn.scriptFn"])];
739
+ let f = {};
740
+ for (let e in this.#re) try {
741
+ this.#l(e + "@");
742
+ } catch {
743
+ f[e] = this.#re[e];
744
+ }
745
+ return this.#re = f, e.do_rec = !1, this.loadFromMark(e, d, SndProcOnLoad.NO_TOUCH);
746
+ }
747
+ #be = {
748
+ hSave: creSAVEDATA(),
749
+ hPages: {},
750
+ aIfStk: [-1]
751
+ };
752
+ #xe = () => {
753
+ let { fn: e, idx: u } = this.nowScrIdx();
754
+ return this.val.setVal_Nochk("save", "const.sn.scriptFn", e), this.val.setVal_Nochk("save", "const.sn.scriptIdx", u), this.#be = {
755
+ hSave: this.val.cloneSave(),
756
+ hPages: this.#O.record(),
757
+ aIfStk: this.#R.slice(this.#i.length)
758
+ }, !1;
759
+ };
760
+ nowScrIdx() {
761
+ if (this.#i.length === 0) return {
762
+ fn: this.#t,
763
+ idx: this.#n
764
+ };
765
+ let e = this.#i[0];
766
+ return {
767
+ fn: e.fn,
768
+ idx: e.idx
769
+ };
770
+ }
771
+ nowMark() {
772
+ return { ...this.#be };
773
+ }
774
+ nowScrFnLn() {
775
+ let { fn: e, idx: u } = this.nowScrIdx(), d = this.#re[e];
776
+ return {
777
+ fn: e,
778
+ ...this.#j(d, u)
779
+ };
780
+ }
781
+ #Se(e) {
782
+ if (!("place" in e)) throw "placeは必須です";
783
+ let u = e.place;
784
+ delete e[":タグ名"], delete e.place, e.text = e.text ?? "", this.#be.json = e, this.val.setMark(u, this.#be);
785
+ let d = Number(this.val.getVal("sys:const.sn.save.place"));
786
+ return u === d && this.val.setVal_Nochk("sys", "const.sn.save.place", d + 1), !1;
787
+ }
788
+ recodeDesign(e) {
789
+ let u = "", d = 0, f = this.#i.length;
790
+ if (e.design_unit && f > 0) {
791
+ let e = this.#i[0];
792
+ u = e.fn, d = e.idx;
793
+ } else u = this.#t, d = this.#n;
794
+ e[":path"] = this.#u(u);
795
+ let p = this.#re[u], m = this.#j(p, d);
796
+ e[":ln"] = m.ln, e[":col_s"] = m.col_s, e[":col_e"] = m.col_e;
797
+ let h = d - 1;
798
+ e[":idx_tkn"] = h, e[":token"] = p.aToken[h] ?? "", this.sys.send2Dbg("_recodeDesign", e);
799
+ }
800
+ replace(e, u) {
801
+ this.#e.aToken[e] = u;
802
+ }
1033
803
  };
1034
- //# sourceMappingURL=ScriptIterator.js.map
804
+ export { ScriptIterator };
805
+
806
+ //# sourceMappingURL=ScriptIterator.js.map