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