dsh-plugin-beyond-simulator 1.0.7

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.
@@ -0,0 +1,228 @@
1
+ - insert:
2
+ - id: qxqy-simulator
3
+ name: dsh-plugin-beyond-simulator
4
+ - id: qxqy-simulator-skill
5
+ name: dsh-plugin-beyond-simulator/skill
6
+ - id: qxqy-simulator-preset-legacy
7
+ name: dsh-plugin-beyond-simulator/preset
8
+ - id: qxqy-simulator-preset
9
+ name: '@deepseek-ai/dsh-agent-preset'
10
+ config:
11
+ id: wonderland-lua-builder
12
+ name: "千星 2D+Lua 游戏制作"
13
+ description: "按策划案、TDD 测试用例、HTML 效果展示、千星美术素材、Lua 实现、测试、真机试玩与修复七步制作 2D+Lua 游戏。"
14
+ plugins:
15
+ # The `wonderland-lua-builder` agent preset: a Genshin Miliastra Wonderland
16
+ # (千星奇域) 2D+Lua game-studio agent, copied from `standard`.
17
+ #
18
+ # This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
19
+ # standing scope; every session naming it joins by scope parentage. The host
20
+ # composition keeps the registries, sandbox, approval stack, persistence, and
21
+ # the model route. Simulator Tools come from `dsh-plugin-beyond-simulator`.
22
+ # 2D Lua knowledge is the user's workspace (AGENTS.md / knowledge docs they
23
+ # place when creating the agent workspace). Do not bundle a corpus in this
24
+ # preset and do not route through miliastra-knowledge (3D sandbox nodes).
25
+ #
26
+ # A service row here MUST sit inside a group carrying an `isolate` realm.
27
+
28
+ # ── identity ────────────────────────────────────────────────────────────────
29
+
30
+ - id: persona
31
+ name: '@deepseek-ai/dsh-persona'
32
+ config:
33
+ prefix: |-
34
+ You are a 千星奇域 2D+Lua game studio director powered by the {{model}} model. Your working directory is {{cwd}}.
35
+
36
+ You make playable UI+Lua games for 原神千星奇域 (Miliastra Wonderland): client UI controls, client Lua, and a thin server of custom variables/signals. You are not a 3D level-graph designer. Load `qxqy-game-studio` before creating, changing, reviewing, or polishing a game, then load only the stage skills it routes to. Read 2D API and observed pitfalls from the current workspace (AGENTS.md and knowledge docs the user placed there). Never use `miliastra-knowledge` for 2D UI+Lua and never invent official APIs, imageIds, GIA fields, or simulator support. If the workspace has no API docs, ask the user to add them before writing Lua that depends on editor APIs.
37
+
38
+ Keep one current step after PREFLIGHT: (1) game design document, (2) TDD test cases before production code, (3) playable HTML effect showcase, (4) Miliastra art reference images and assets, (5) Lua implementation in the simulator, (6) simulator testing and fixes, (7) real-device play validation and bug fixes. Follow this order for new games. Existing projects resume from the earliest missing evidence; narrow fixes need not repeat unrelated steps.
39
+
40
+ Steps 1–4 do not open the simulator, edit saves, or runCase. Design test cases in step 2; a valid TDD Red requires a runnable skeleton in step 5. The HTML showcase in step 3 is opened by the user (this composition has no browser-play tool; record browser-run: user), is not Lua source, and is not the ship artifact. Prepare Miliastra art references and assets after the HTML experience is agreed. Use qxqy_studio_play, qxqy_studio_ui_screenshot, and qxqy_studio_play_screenshot for step 6; only a real device can establish step 7. Do not treat web search as playtesting. Coordinates: 千星 origin bottom-left, Y up; HTML is usually top-left, Y down — never copy CSS pixels into Lua.
41
+
42
+ The deliverable is a game that runs in the simulator and on device (Lua + save/GIA), not a webpage. Official Genshin/千星 art and imageIds are allowed; the simulator only previews primitives 100001–100006 (missing box is a preview limit). Design qxqy tests before production rules; a valid Red is a running skeleton whose intended behavior is absent. Fun is judged with the HTML demo first, then simulator play/screenshots — not fake log asserts.
43
+
44
+ First milestone is one complete game session. Saves: workspace/<slug>/<slug>.save.json with qxqy-simulator-save near the file head. Simulator green is not ship. Ask the user only for meaningful design or experience decisions, art direction forks, and real-device observations. Inspect the repo and tools yourself.
45
+
46
+ Maintain a living tech-architecture doc (docs/tech-architecture.md) throughout development, in the spirit of Karpathy's llm.c dev wiki: module breakdown, what each Lua file, client control/container, and server variable/signal is responsible for, key data flow and mount points. Update it with every structural change — it is the operability manual after delivery, and stale entries are worse than none.
47
+
48
+ - id: agent-instructions
49
+ name: '@deepseek-ai/dsh-agent-instructions'
50
+ config:
51
+ maxBytes: 65536
52
+
53
+ # ── shell ───────────────────────────────────────────────────────────────────
54
+
55
+ # `shell-env` stays in the HOST composition. Both shell tools consume the host
56
+ # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
57
+ # host-plane too.
58
+ - id: tool-bash
59
+ name: '@deepseek-ai/dsh-tool-bash'
60
+ disabled: !!js process.platform === 'win32'
61
+
62
+ - id: tool-pwsh
63
+ name: '@deepseek-ai/dsh-tool-pwsh'
64
+ disabled: !!js process.platform !== 'win32'
65
+
66
+ # ── filesystem ──────────────────────────────────────────────────────────────
67
+
68
+ # Both register into the host `tools` registry and provide nothing, so
69
+ # they need no realm. The `fs` service and its policy stay in the host.
70
+ - id: tool-fs
71
+ name: '@deepseek-ai/dsh-tool-fs'
72
+
73
+ - id: tool-fs-search
74
+ name: '@deepseek-ai/dsh-tool-fs-search'
75
+ config:
76
+ sampleOverCapGlobResults: false
77
+
78
+ # ── background jobs ────────────────────────────────────────────────────────
79
+
80
+ # Only the model-facing controls. The task REGISTRY stays on the host plane.
81
+ - id: tool-jobs
82
+ name: '@deepseek-ai/dsh-tool-jobs'
83
+
84
+ # ── skills ──────────────────────────────────────────────────────────────────
85
+
86
+ # The skill REGISTRY lives in the host composition and is layered per scope.
87
+ # `customSkillDirs` ships this preset's studio workflow with the copy; project
88
+ # and user roots remain enabled so `~/.dsh/skills` and workspace skills still
89
+ # appear. The simulator plugin still registers globally; miliastra-knowledge
90
+ # is not part of this preset's workflow.
91
+ - id: skill-filesystem
92
+ name: '@deepseek-ai/dsh-skill-filesystem'
93
+ config:
94
+ customSkillDirs:
95
+ - !!js "process.getBuiltinModule('node:url').fileURLToPath(new URL('skills/', baseUrl))"
96
+
97
+ - id: tool-skill
98
+ name: '@deepseek-ai/dsh-tool-skill'
99
+
100
+ # ── goals ───────────────────────────────────────────────────────────────────
101
+
102
+ # Only the model-facing tool. The goal SERVICE stays on the host plane.
103
+ - id: tool-goal
104
+ name: '@deepseek-ai/dsh-tool-goal'
105
+
106
+ # ── plan mode ───────────────────────────────────────────────────────────────
107
+
108
+ - id: planning
109
+ name: cordis:group
110
+ group: true
111
+ isolate:
112
+ planMode: true
113
+ config:
114
+ - id: plan-mode
115
+ name: '@deepseek-ai/dsh-plan-mode'
116
+ config:
117
+ section: |
118
+ You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
119
+
120
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
121
+
122
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
123
+
124
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
125
+
126
+ For 千星奇域 games, plan the seven-step workflow in order: (1) 策划案, (2) TDD 制定测试用例, (3) HTML 效果展示, (4) 准备千星美术参考图和素材, (5) Lua 编码实现, (6) 测试, (7) 真机试玩验证与 bug 修复. Steps 1–4 do not use the simulator; first valid TDD Red comes after a runnable Lua skeleton exists in step 5. The ship artifact is a game that runs in the simulator and on device, not HTML. Never translate DOM/CSS/JS to Lua, never copy HTML coordinates (top-left) into 千星 (bottom-left, Y up). Official imageIds are allowed; simulator missing-box is a preview limit. Cover the three-asset split, workspace/<slug>/<slug>.save.json, canvases, budgets, GIA warnings, and real-device pass. Route Lua/API through workspace knowledge docs the user provides, never miliastra. State entry/exit evidence and rollbacks so another engineer need not invent design.
127
+
128
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
129
+
130
+ # ── compaction ──────────────────────────────────────────────────────────────
131
+
132
+ - id: compaction
133
+ name: cordis:group
134
+ group: true
135
+ isolate:
136
+ compaction: true
137
+ toolResultPruner: true
138
+ config:
139
+ - id: compaction-basic
140
+ name: '@deepseek-ai/dsh-compaction-basic'
141
+
142
+ - id: command-compact
143
+ name: '@deepseek-ai/dsh-command-compact'
144
+
145
+ - id: tool-result-pruner
146
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
147
+ config:
148
+ thresholdChars: 8192
149
+ headChars: 4096
150
+ tailChars: 1024
151
+
152
+ # ── delegation and workflows ────────────────────────────────────────────────
153
+
154
+ # The `subagents` registry stays on the HOST plane. `workflowEngine` is
155
+ # isolated here because nothing outside an agent reads it.
156
+ - id: delegation
157
+ name: cordis:group
158
+ group: true
159
+ isolate:
160
+ workflowEngine: true
161
+ config:
162
+ - id: tool-subagent-control
163
+ name: '@deepseek-ai/dsh-tool-subagent-control'
164
+
165
+ - id: tool-subagent-list-agents
166
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
167
+
168
+ - id: tool-subagent
169
+ name: '@deepseek-ai/dsh-tool-subagent'
170
+ config:
171
+ provider: spawn
172
+ toolName: subagent
173
+ backgroundMode: continuable
174
+
175
+ - id: tool-subagent-fork
176
+ name: '@deepseek-ai/dsh-tool-subagent'
177
+ config:
178
+ provider: fork
179
+ toolName: subagent_fork
180
+ backgroundMode: continuable
181
+
182
+ - id: tool-subagent-codex
183
+ name: '@deepseek-ai/dsh-tool-subagent'
184
+ disabled: true
185
+ config:
186
+ provider: codex
187
+ toolName: subagent_codex
188
+ enableRunInBackground: false
189
+ maxDepth: provider-managed
190
+
191
+ - id: tool-subagent-claude-code
192
+ name: '@deepseek-ai/dsh-tool-subagent'
193
+ disabled: true
194
+ config:
195
+ provider: claude-code
196
+ toolName: subagent_claude_code
197
+ enableRunInBackground: false
198
+ maxDepth: provider-managed
199
+
200
+ - id: workflow-ptc
201
+ name: '@deepseek-ai/dsh-workflow-ptc'
202
+ config:
203
+ provider: spawn
204
+
205
+ - id: tool-workflow
206
+ name: '@deepseek-ai/dsh-tool-workflow'
207
+
208
+ - id: tool-ralph
209
+ name: '@deepseek-ai/dsh-tool-ralph'
210
+ config:
211
+ subagentProvider: spawn
212
+ maxRounds: 64
213
+
214
+ # ── remaining model-facing rows ─────────────────────────────────────────────
215
+
216
+ - id: tool-ask-user
217
+ name: '@deepseek-ai/dsh-tool-ask-user'
218
+
219
+ - id: tool-todo
220
+ name: '@deepseek-ai/dsh-tool-todo'
221
+ config:
222
+ allowParallelInProgress: true
223
+
224
+ - id: tool-web
225
+ name: '@deepseek-ai/dsh-tool-web'
226
+ config:
227
+ fetch: false
228
+ searchTimeoutMs: 60000
@@ -0,0 +1,26 @@
1
+ (()=>{function je(u,{api:B,playUrl:ne,saveToWorkspace:D=!1}){let e=u.createElement,U="qxqy-simulator-style",se=`
2
+ .qxsim-save-overlay{position:absolute;inset:0;z-index:30;display:grid;place-items:center;background:#0006}.qxsim-save-dialog{width:min(440px,90%);padding:24px;border:1px solid var(--line);border-radius:12px;background:var(--panel);box-shadow:0 12px 48px #0005}.qxsim-save-dialog h2{margin:0 0 16px;font-size:17px}.qxsim-save-dialog input{width:100%;margin:8px 0 16px;padding:10px;border:1px solid var(--line);border-radius:6px;background:var(--input)}.qxsim-save-dialog footer{display:flex;justify-content:flex-end;gap:8px}.qxsim-save-dialog [role=alert]{color:var(--danger);margin-bottom:12px;overflow-wrap:anywhere}
3
+ .qxsim{--blue:#477cf0;--danger:#e75a6a;position:relative;display:flex;flex:1 1 0;align-self:stretch;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;max-height:none;container-type:inline-size;color:var(--text);background:var(--bg);font:13px/1.4 Inter,"Microsoft YaHei UI","Microsoft YaHei",sans-serif;overflow:hidden;color-scheme:inherit}
4
+ .qxsim[data-theme=dark]{--bg:#20242e;--panel:#181d27;--panel2:#202632;--input:#151b25;--line:#363e4d;--lineSoft:#2b3240;--text:#edf1f7;--muted:#929baa;--hover:#252c37;--workspace:#383d47;--toolbarA:#242a35;--toolbarB:#1e232d;--status:#242a33;--button:#1d2430;--shadow:#0004}
5
+ .qxsim[data-theme=light]{--bg:#f5f6f8;--panel:#fff;--panel2:#f4f6f8;--input:#fff;--line:#d6dbe3;--lineSoft:#e7e9ed;--text:#20242a;--muted:#69717d;--hover:#eef1f5;--workspace:#d9dde3;--toolbarA:#fff;--toolbarB:#f3f5f8;--status:#f7f8fa;--button:#f7f8fa;--shadow:#18203318}
6
+ .qxsim *{box-sizing:border-box}.qxsim button,.qxsim input,.qxsim textarea,.qxsim select{font:inherit;color:inherit}.qxsim button{cursor:pointer}.qxsim button:disabled{opacity:.42;cursor:default}
7
+ .qxsim-toolbar{height:50px;flex:0 0 50px;display:grid;grid-template-columns:minmax(190px,1fr) auto minmax(280px,1fr);align-items:center;padding:0 10px;border-bottom:1px solid var(--line);background:linear-gradient(180deg,var(--toolbarA),var(--toolbarB));box-shadow:0 1px 8px var(--shadow);z-index:3}.qxsim-brand,.qxsim-toolbar-center,.qxsim-actions{display:flex;align-items:center}.qxsim-brand{gap:8px;min-width:0}.qxsim-appicon{width:26px;height:26px;display:grid;place-items:center;border:1px solid var(--line);border-radius:5px;font-size:11px;background:var(--input)}.qxsim-brand-text{min-width:0}.qxsim-brand-text strong,.qxsim-brand-text span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.qxsim-brand-text strong{font-size:13px}.qxsim-brand-text span{color:var(--muted);font-size:10px}.qxsim-toolbar-center{gap:6px}.qxsim-actions{justify-content:flex-end;gap:6px}.qxsim-io{display:flex;align-items:center;gap:4px;padding-right:6px;margin-right:2px;border-right:1px solid var(--line)}
8
+ .qxsim-editor-nav{height:40px;flex:0 0 40px;display:flex;align-items:stretch;padding:0 10px;border-bottom:1px solid var(--line);background:var(--panel)}.qxsim-editor-nav button{min-width:116px;padding:0 18px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);font-weight:650}.qxsim-editor-nav button.active{border-bottom-color:var(--blue);color:var(--text);background:color-mix(in srgb,var(--blue) 8%,transparent)}.qxsim-editor-nav .save-summary{display:flex;align-items:center;margin-left:auto;color:var(--muted);font-size:10px}
9
+ .qxsim-control,.qxsim-iconbtn,.qxsim-action{height:32px;border:1px solid var(--line);background:var(--input);border-radius:6px}.qxsim-control{min-width:156px;padding:0 28px 0 9px}.qxsim-control.zoom{min-width:78px}.qxsim-iconbtn{width:32px}.qxsim-action{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:0 11px;white-space:nowrap}.qxsim-action.primary{color:#fff;border-color:#3265d8;background:linear-gradient(#5388fa,#376ad8)}.qxsim-action.danger{color:var(--danger)}.qxsim-action:hover,.qxsim-iconbtn:hover{border-color:var(--blue);background:var(--hover)}
10
+ .qxsim-main{display:grid;grid-template-columns:clamp(220px,17cqi,280px) minmax(360px,1fr) clamp(310px,22cqi,356px);flex:1;min-height:0}.qxsim-tree,.qxsim-inspector{min-height:0;background:var(--panel)}.qxsim-tree{display:flex;flex-direction:column;border-right:1px solid var(--line)}.qxsim-inspector{display:flex;flex-direction:column;border-left:1px solid var(--line)}.qxsim-pane-head{height:44px;flex:0 0 44px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;border-bottom:1px solid var(--lineSoft)}.qxsim-pane-title{font-weight:650;font-size:13px}.qxsim-muted{color:var(--muted);font-size:10px}.qxsim-asset-switch{display:grid;grid-template-columns:1fr 1fr;gap:3px;margin:8px 8px 0;padding:3px;border:1px solid var(--line);border-radius:18px;background:var(--input)}.qxsim-asset-switch button{height:29px;min-width:0;border:0;border-radius:15px;background:transparent;color:var(--muted);font-weight:600;white-space:nowrap}.qxsim-asset-switch button.active{color:#fff;background:linear-gradient(#4f86ff,#3c6ed8);box-shadow:0 2px 7px #1d4b9f55}.qxsim-template-tag{padding:1px 5px;border:1px solid currentColor;border-radius:8px;color:#9cc2ff;font-size:9px}.qxsim-template-id{color:var(--muted);font:9px ui-monospace,Consolas,monospace}.qxsim-palette-head{display:flex;align-items:center;justify-content:space-between;gap:4px;margin:0 0 4px;color:var(--muted);font-size:10px}.qxsim-palette-head>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.qxsim-add-mode{display:flex;flex:0 0 auto;gap:2px;padding:1px;border:1px solid var(--line);border-radius:10px;background:var(--input)}.qxsim-add-mode button{height:18px;padding:0 6px;border:0;border-radius:8px;background:transparent;color:var(--muted);font-size:9px}.qxsim-add-mode button.active{color:var(--text);background:var(--hover)}
11
+ .qxsim-search{height:32px;margin:8px;display:flex;align-items:center;gap:7px;padding:0 9px;border:1px solid var(--line);border-radius:16px;background:var(--input);color:var(--muted)}.qxsim-search input{min-width:0;flex:1;border:0;outline:0;background:transparent}.qxsim-search button{border:0;background:transparent;color:var(--muted)}.qxsim-tree-scroll{flex:1;min-height:0;overflow:auto;padding:3px 6px 8px}.qxsim-row{position:relative;height:32px;display:flex;align-items:center;gap:6px;padding-right:7px;border:1px solid transparent;border-radius:4px;cursor:pointer;white-space:nowrap;overflow:hidden}.qxsim-row.template-root{height:38px;margin-top:5px;border-top-color:var(--lineSoft);background:color-mix(in srgb,var(--blue) 5%,transparent)}.qxsim-row.template-root:first-child{margin-top:0}.qxsim-row:not(.template-root):before{content:"";position:absolute;left:13px;top:-6px;bottom:16px;border-left:1px solid var(--lineSoft);pointer-events:none}.qxsim-row:hover{background:var(--hover)}.qxsim-row.active{background:linear-gradient(90deg,#3569cf,#315a9f);border-color:#4d7ee4;color:#fff}.qxsim-chevron{width:9px;color:var(--muted);font-size:9px}.qxsim-kind{width:19px;height:19px;display:inline-grid;place-items:center;flex:0 0 19px;border:1px solid currentColor;border-radius:3px;font-size:9px}.qxsim-row-label{min-width:0;overflow:hidden;text-overflow:ellipsis}.qxsim-row-end{margin-left:auto;display:flex;align-items:center;gap:4px;flex:0 0 auto}.qxsim-row.canvas-hidden .qxsim-row-label{opacity:.45}.qxsim-eye{width:20px;height:20px;display:grid;place-items:center;border:0;border-radius:4px;background:transparent;color:var(--muted);font-size:12px;line-height:1}.qxsim-eye:hover{background:var(--hover);color:var(--text)}.qxsim-row.active .qxsim-eye{color:#d7e6ff}.qxsim-row.active .qxsim-eye:hover{background:#ffffff24;color:#fff}.qxsim-eye.off{opacity:.55}.qxsim-incomplete{color:#e4a743;font-size:9px}.qxsim-tree-foot{flex:0 0 auto;padding:5px;border-top:1px solid var(--lineSoft)}.qxsim-hierarchy{margin-bottom:5px;padding:5px;border:1px solid var(--line);border-radius:6px;background:color-mix(in srgb,var(--input) 78%,transparent)}.qxsim-hierarchy-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:3px;font-size:10px}.qxsim-hierarchy-head strong{font-weight:650}.qxsim-hierarchy-head span{max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}.qxsim-parent-row{display:grid;grid-template-columns:minmax(0,1fr) 24px 24px;gap:3px}.qxsim-parent-row select,.qxsim-parent-row button{height:24px;min-width:0;border:1px solid var(--line);border-radius:4px;background:var(--button)}.qxsim-parent-row select{padding:0 5px}.qxsim-hierarchy-note{margin-top:3px;color:var(--muted);font-size:9px;line-height:1.3}.qxsim-add{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px}.qxsim-add button{height:22px;padding:0 4px;border:1px solid var(--line);border-radius:4px;background:var(--button);color:var(--muted);font-size:11px;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.qxsim-add button:hover{color:var(--text);border-color:var(--blue)}
12
+ .qxsim-center{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden;background:var(--workspace)}.qxsim-workspace{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;padding:34px 22px 20px;overflow:auto;background-color:var(--workspace);background-image:radial-gradient(#ffffff0b 1px,transparent 1px),linear-gradient(135deg,#ffffff09 25%,transparent 25%,transparent 75%,#00000008 75%);background-size:4px 4px,24px 24px}.qxsim-stage-shell{position:relative;flex:0 0 auto;max-width:100%;filter:drop-shadow(0 12px 24px #0004)}.qxsim-stage-label{position:absolute;left:0;right:0;top:-27px;display:flex;align-items:center;gap:7px;color:var(--muted);font-size:10px}.qxsim-stage-label b{padding:2px 7px;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--text);font-weight:600}.qxsim-stage{position:relative;max-width:100%;background-color:#28313e;background-image:linear-gradient(45deg,#ffffff08 25%,transparent 25%),linear-gradient(-45deg,#ffffff08 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ffffff08 75%),linear-gradient(-45deg,transparent 75%,#ffffff08 75%),radial-gradient(circle at 50% 45%,#466f9b38,transparent 48%);background-position:0 0,0 8px,8px -8px,-8px 0,0 0;background-size:16px 16px,16px 16px,16px 16px,16px 16px,100% 100%;border:1px solid #40b8cf;outline:1px solid #1f2732b3;overflow:hidden;touch-action:none;user-select:none}.qxsim-stage:before,.qxsim-stage:after{content:"";position:absolute;pointer-events:none;opacity:.12}.qxsim-stage:before{left:50%;top:0;bottom:0;border-left:1px dashed #cfe9ff}.qxsim-stage:after{top:50%;left:0;right:0;border-top:1px dashed #cfe9ff}
13
+ .qxsim-box{position:absolute;box-sizing:border-box;border:1px solid #cbdaged80;overflow:visible;display:flex;align-items:center;justify-content:center;white-space:pre-wrap;pointer-events:none;transform:rotate(var(--rotation,0deg));transform-origin:center}.qxsim-box.container{border-color:#4ea5e66b;background:transparent}.qxsim-box.textbox,.qxsim-box.textwindow{overflow:hidden}.qxsim-box.cursor{border-style:dashed;background:#4a8eb519}.qxsim-box.reference{border-style:dashed;background:#7365c219}.qxsim-box.grid{background-image:linear-gradient(#6a92bd26 1px,transparent 1px),linear-gradient(90deg,#6a92bd26 1px,transparent 1px);background-size:20px 20px}.qxsim-box.keyhint{border-radius:4px;background:#2b3441b8}.qxsim-box.animation,.qxsim-box.fullscreen{border-style:dotted}.qxsim-box.button{border-radius:6px;background:linear-gradient(#465467e6,#28313ee6);box-shadow:inset 0 0 0 1px #ffffff14}.qxsim-box.selected{z-index:2;border-color:#61b9ff;box-shadow:inset 0 0 0 1px #3a76ff,0 0 0 1px #0006}.qxsim-box.dynamic{border-style:dashed}.qxsim-box.pressed{filter:brightness(.72);transform:rotate(var(--rotation,0deg)) scale(.98)}.qxsim-box-label{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1px 4px;border-radius:3px;color:#e7edf5;background:#111925a8;text-shadow:0 1px 2px #000;font-size:10px}.qxsim-box.fullscreen>.qxsim-box-label{position:absolute;left:5px;top:5px}.qxsim-handle{position:absolute;width:7px;height:7px;border:1px solid #fff;background:#4388ff;box-shadow:0 0 0 1px #2d4e88}.qxsim-handle.tl{left:-4px;top:-4px}.qxsim-handle.tr{right:-4px;top:-4px}.qxsim-handle.bl{left:-4px;bottom:-4px}.qxsim-handle.br{right:-4px;bottom:-4px}
14
+ .qxsim-status{min-height:30px;display:flex;align-items:center;gap:10px;padding:5px 10px;border-top:1px solid var(--line);background:var(--status);color:var(--muted);font-size:10px}.qxsim-status .spacer{flex:1}.qxsim-status.error{color:var(--danger)}
15
+ .qxsim-inspector-head{padding:9px 11px 8px;border-bottom:1px solid var(--lineSoft)}.qxsim-inspector-line{display:flex;align-items:center;gap:7px}.qxsim-inspector-line strong{font-size:15px}.qxsim-node-id{margin-top:2px;color:var(--muted);font-size:10px}.qxsim-node-id code{color:#4f7fe9}.qxsim-tabs{display:grid;grid-template-columns:1fr 1fr;gap:3px;margin:7px 9px 5px;padding:3px;border:1px solid var(--line);border-radius:17px;background:var(--input)}.qxsim-tabs button{height:28px;border:0;border-radius:14px;background:transparent;color:var(--muted)}.qxsim-tabs button.active{color:#fff;background:linear-gradient(#4c83ff,#3d70dc)}.qxsim-inspector-scroll{flex:1;min-height:0;overflow:auto;padding:0 7px 9px;scrollbar-color:color-mix(in srgb,var(--muted) 55%,transparent) transparent}
16
+ .qxsim-section{margin:5px 0;border:1px solid var(--line);border-radius:6px;background:var(--panel2);overflow:hidden}.qxsim-section summary{height:34px;display:flex;align-items:center;gap:7px;padding:0 9px;font-weight:650;cursor:pointer;list-style:none}.qxsim-section summary::-webkit-details-marker{display:none}.qxsim-section summary:before{content:"\u203A";color:var(--muted)}.qxsim-section[open] summary:before{transform:rotate(90deg)}.qxsim-section summary:after{content:"\u2261";margin-left:auto;color:var(--muted)}.qxsim-section-body{padding:8px 9px 9px;border-top:1px solid var(--lineSoft)}.qxsim-field{display:flex;flex-direction:column;gap:4px;margin-bottom:8px}.qxsim-field:last-child{margin-bottom:0}.qxsim-field-label{display:flex;align-items:center;gap:5px;color:var(--muted);font-size:11px}.qxsim-field small{color:var(--muted)}.qxsim-field input[type=text],.qxsim-field input[type=number],.qxsim-field textarea,.qxsim-field select{width:100%;min-width:0;border:1px solid var(--line);border-radius:5px;outline:0;background:var(--input);padding:5px 7px}.qxsim-field input:focus,.qxsim-field textarea:focus,.qxsim-field select:focus{border-color:var(--blue);box-shadow:0 0 0 2px #4075e52e}.qxsim-field select,.qxsim-field input[type=number]{height:31px}.qxsim-field textarea{resize:vertical}.qxsim-note{padding:7px 8px;border-left:2px solid #dea943;background:color-mix(in srgb,#dea943 10%,var(--panel2));color:var(--muted)}
17
+ .qxsim-switch-row{min-height:32px;display:flex;align-items:center;gap:8px;margin-bottom:4px}.qxsim-switch{position:relative;width:40px;height:22px;margin-left:auto;flex:0 0 40px}.qxsim-switch input{position:absolute;opacity:0}.qxsim-switch-track{position:absolute;inset:0;border:1px solid var(--line);border-radius:12px;background:color-mix(in srgb,var(--muted) 28%,var(--input))}.qxsim-switch-track:after{content:"";position:absolute;left:3px;top:3px;width:14px;height:14px;border-radius:50%;background:var(--muted);box-shadow:0 1px 3px #0006;transition:.15s}.qxsim-switch input:checked+.qxsim-switch-track{border-color:#5688f4;background:#477cec}.qxsim-switch input:checked+.qxsim-switch-track:after{left:21px;background:#fff}.qxsim-pair{display:grid;grid-template-columns:42px minmax(0,1fr) minmax(0,1fr);gap:5px;align-items:end;margin-bottom:7px}.qxsim-pair-name{padding-bottom:7px;color:var(--muted);font-size:11px}.qxsim-pair .qxsim-field{margin:0}.qxsim-pair .qxsim-field-label{font-size:10px}.qxsim-axis{display:grid;place-items:center;width:17px;height:17px;border-radius:3px;font-size:10px}.qxsim-axis.x{color:#ff9aa6;background:#6c2733}.qxsim-axis.y{color:#a9e178;background:#2f5726}.qxsim-axis.w,.qxsim-axis.h{color:#8bc7ff;background:#294762}.qxsim-color-row{display:grid;grid-template-columns:34px 1fr;gap:6px}.qxsim-color-swatch{position:relative;width:34px;height:31px;border:1px solid var(--line);border-radius:5px;overflow:hidden;background:#fff}.qxsim-color-swatch input{position:absolute;inset:-8px;width:50px;height:47px;padding:0;border:0;cursor:pointer}.qxsim-percent{display:grid;grid-template-columns:minmax(0,1fr) 58px;gap:7px;align-items:center}.qxsim-percent input[type=range]{width:100%;accent-color:var(--blue)}.qxsim-percent output{height:30px;display:grid;place-items:center;border:1px solid var(--line);border-radius:5px;background:var(--input)}.qxsim-subfields{margin:2px 0 8px 8px;padding:7px 0 2px 9px;border-left:2px solid color-mix(in srgb,var(--blue) 55%,var(--line))}.qxsim-state-field{margin:8px 0}.qxsim-state-label{display:flex;align-items:center;gap:6px;margin-bottom:4px;color:var(--muted);font-size:11px}.qxsim-unsupported{min-height:31px;display:flex;align-items:center;padding:5px 8px;border:1px dashed var(--line);border-radius:5px;background:color-mix(in srgb,var(--muted) 8%,var(--input));color:var(--muted)}.qxsim-state-ref{display:grid;grid-template-columns:32px minmax(0,1fr);height:54px;border:1px dashed var(--line);border-radius:6px;background:color-mix(in srgb,var(--input) 72%,transparent);overflow:hidden}.qxsim-state-ref button{border:0;border-right:1px solid var(--line);background:transparent;color:var(--muted);font-size:22px}.qxsim-state-ref button:hover{color:var(--blue);background:var(--hover)}.qxsim-state-ref select{min-width:0;border:0;outline:0;background:transparent;padding:0 7px}.qxsim-script-actions{display:flex;justify-content:flex-end}.qxsim-script-actions button{height:30px;padding:0 10px;border:1px solid #4779e6;border-radius:5px;color:#fff;background:#2e5cab}.qxsim-empty{padding:22px 10px;text-align:center;color:var(--muted)}
18
+ .qxsim-script-page{display:grid;grid-template-columns:280px minmax(420px,1fr);flex:1;min-height:0;background:var(--workspace)}.qxsim-script-assets{min-height:0;padding:12px;border-right:1px solid var(--line);background:var(--panel);overflow:auto}.qxsim-script-assets h3{margin:2px 4px 10px;font-size:13px}.qxsim-script-asset{width:100%;margin-bottom:7px;padding:10px;border:1px solid var(--line);border-radius:7px;background:var(--button);text-align:left}.qxsim-script-asset.active{border-color:var(--blue);background:color-mix(in srgb,var(--blue) 14%,var(--button))}.qxsim-script-asset strong,.qxsim-script-asset small{display:block}.qxsim-script-asset small{margin-top:3px;color:var(--muted)}.qxsim-script-list-row{display:flex;gap:4px;align-items:stretch;margin-bottom:7px}.qxsim-script-list-row .qxsim-script-asset{flex:1;min-width:0;margin-bottom:0}.qxsim-script-list-row .qxsim-iconbtn{flex:0 0 30px;width:30px;min-height:30px;height:auto;align-self:stretch}.qxsim-script-editor{min-width:0;min-height:0;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:10px;padding:18px 22px}.qxsim-script-title{display:flex;align-items:end;justify-content:space-between;gap:16px}.qxsim-script-title h2{margin:0;font-size:18px}.qxsim-script-title span{color:var(--muted);font-size:11px}.qxsim-script-fields{display:grid;grid-template-columns:minmax(220px,1fr) minmax(220px,1fr);gap:10px}.qxsim-script-editor label{display:flex;flex-direction:column;gap:5px;color:var(--muted);font-size:11px}.qxsim-script-editor input,.qxsim-script-editor select,.qxsim-script-editor textarea{min-width:0;border:1px solid var(--line);border-radius:6px;outline:0;background:var(--input);color:var(--text)}.qxsim-script-editor input,.qxsim-script-editor select{height:34px;padding:0 9px}.qxsim-script-editor textarea{width:100%;height:100%;min-height:220px;padding:12px;resize:none;font:12px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace;tab-size:2}.qxsim-script-editor textarea:focus,.qxsim-script-editor input:focus,.qxsim-script-editor select:focus{border-color:var(--blue);box-shadow:0 0 0 2px #4075e52e}.qxsim-script-footer{display:flex;align-items:center;gap:8px}.qxsim-script-footer span{color:var(--muted);font-size:10px}.qxsim-script-footer .spacer{flex:1}
19
+ .qxsim-server-logic{flex:1;min-height:0;overflow:auto;padding:18px 22px;background:var(--workspace)}.qxsim-logic-wrap{max-width:900px;margin:0 auto}.qxsim-logic-title{display:flex;align-items:end;justify-content:space-between;gap:16px;margin-bottom:10px}.qxsim-logic-title h2{margin:0;font-size:18px}.qxsim-logic-title p{margin:3px 0 0;color:var(--muted);font-size:11px}.qxsim-logic-rule{margin:12px 0;border:1px solid var(--line);border-radius:8px;background:var(--panel);overflow:hidden}.qxsim-logic-rule-head,.qxsim-logic-action-head{display:flex;align-items:center;gap:8px;padding:9px 11px;border-bottom:1px solid var(--lineSoft)}.qxsim-logic-rule-head strong,.qxsim-logic-action-head strong{font-size:12px}.qxsim-logic-rule-head .qxsim-field{flex:1;margin:0}.qxsim-logic-rule-head .qxsim-field input{height:30px}.qxsim-logic-actions{padding:10px}.qxsim-logic-action{margin-bottom:9px;border:1px solid var(--line);border-radius:6px;background:var(--panel2);overflow:hidden}.qxsim-logic-action:last-child{margin-bottom:0}.qxsim-logic-action-head{min-height:36px;padding:6px 8px}.qxsim-logic-action-head span{color:var(--muted);font-size:10px}.qxsim-logic-action-head .qxsim-iconbtn{width:28px;height:28px;margin-left:auto}.qxsim-logic-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:9px}.qxsim-logic-fields .wide{grid-column:1 / -1}.qxsim-logic-actions-foot{display:flex;gap:7px;margin-top:10px}.qxsim-logic-actions-foot .qxsim-action{flex:0 0 auto}.qxsim-logic-json{min-height:58px;font:11px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace}.qxsim-logic-target{height:31px;display:flex;align-items:center;padding:0 7px;border:1px solid var(--line);border-radius:5px;background:color-mix(in srgb,var(--input) 75%,var(--muted));color:var(--muted)}.qxsim-logic-error{margin:10px 0;color:var(--danger);font-size:11px}.qxsim-logic-empty{padding:24px 12px;border:1px dashed var(--line);border-radius:8px;text-align:center;color:var(--muted);background:color-mix(in srgb,var(--panel) 70%,transparent)}
20
+ .qxsim-toolbar-center{min-width:0}.qxsim-device-switch{display:flex;flex:0 0 auto;gap:2px;padding:2px;border:1px solid var(--line);border-radius:9px;background:var(--input)}.qxsim-device-switch button{height:26px;padding:0 10px;border:0;border-radius:7px;background:transparent;color:var(--muted);font-size:11px;font-weight:600;white-space:nowrap}.qxsim-device-switch button:hover{color:var(--text)}.qxsim-device-switch button.active{color:#fff;background:linear-gradient(#4f86ff,#3c6ed8);box-shadow:0 1px 5px #1d4b9f44}.qxsim-control.ratio{width:150px;min-width:0;padding-right:22px;text-overflow:ellipsis}.qxsim-io .qxsim-control{width:118px;min-width:0;padding-right:22px;text-overflow:ellipsis}.qxsim-platform-tag{padding:2px 7px;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--text);font-weight:600;font-size:10px}
21
+ .qxsim-toolbar{grid-template-columns:minmax(170px,1fr) auto auto;column-gap:12px}.qxsim-toolbar-center .zoom{width:78px;min-width:78px}.qxsim-actions{min-width:0}
22
+ @container(max-width:1180px){.qxsim-toolbar{grid-template-columns:minmax(130px,1fr) auto auto;column-gap:8px}.qxsim-action{padding:0 8px}.qxsim-main{grid-template-columns:200px minmax(300px,1fr) 292px}.qxsim-control{min-width:132px}.qxsim-control.ratio{width:128px}.qxsim-io .qxsim-control{width:96px}.qxsim-device-switch button{padding:0 7px}.qxsim-workspace{padding-left:12px;padding-right:12px}.qxsim-brand-text span{display:none}.qxsim-asset-switch button{font-size:11px}}
23
+ @container(max-width:1000px){.qxsim-toolbar{height:90px;flex-basis:90px;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:42px 42px}.qxsim-toolbar-center{justify-self:end}.qxsim-actions{grid-column:1 / -1}.qxsim-editor-nav .save-summary{display:none}.qxsim-inspector{top:130px}}
24
+ @container(max-width:820px){.qxsim-main{grid-template-columns:180px minmax(280px,1fr)}.qxsim-inspector{position:absolute;right:0;top:130px;bottom:0;width:285px;z-index:5;box-shadow:-10px 0 24px var(--shadow)}.qxsim-script-page{grid-template-columns:190px minmax(320px,1fr)}.qxsim-script-editor{padding:12px}.qxsim-script-fields{grid-template-columns:1fr}}
25
+ `,M={"server-container":["\u25A3","\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668"],container:["\u25A1","\u5BB9\u5668\u8282\u70B9"],textbox:["T","\u6587\u672C\u6846"],cursor:["\u2301","\u5149\u6807\u68C0\u6D4B\u533A\u57DF"],reference:["\u2197","\u6A21\u677F\u5F15\u7528\u63A7\u4EF6"],grid:["\u25A6","\u7F51\u683C\u89C6\u7A97"],image:["\u25A7","\u56FE\u7247"],button:["Btn","\u9884\u8BBE\u6309\u94AE"],textwindow:["T\u2195","\u6587\u672C\u89C6\u7A97"],keyhint:["1","\u6309\u952E\u63D0\u793A"],animation:["\u2726","\u754C\u9762\u52A8\u6548"],fullscreen:["\u2725","\u5168\u5C4F\u52A8\u6548"]},G=[["container","\u5BB9\u5668\u8282\u70B9"],["textbox","\u6587\u672C\u6846"],["cursor","\u5149\u6807\u68C0\u6D4B"],["reference","\u6A21\u677F\u5F15\u7528"],["grid","\u7F51\u683C\u89C6\u7A97"],["button","\u9884\u8BBE\u6309\u94AE"],["textwindow","\u6587\u672C\u89C6\u7A97"],["keyhint","\u6309\u952E\u63D0\u793A"],["image","\u56FE\u7247"],["animation","\u754C\u9762\u52A8\u6548"],["fullscreen","\u5168\u5C4F\u52A8\u6548"]],Fe={container:["isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor"],textbox:["fontSize","adaptiveFontSize","minimumFontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","text"],cursor:[],reference:["referencedPrefabId"],grid:["cellSizeX","cellSizeY","spacingX","spacingY","padding1X","padding1Y","padding2X","padding2Y","previewCount"],image:["imageSource","imageId","imageColor","enableMask","enableSoftEdge","softEdgeMode","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","enableFill","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","fillAmount","reverseMaskArea"],button:["raycastTarget","interactable","unavailableChildId","hoverChildId","pressedChildId","selectedChildId","clickAudioId"],textwindow:["fontSize","adaptiveFontSize","minimumFontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","text"],keyhint:["keyboardKeyCode","controllerKeyCode"],animation:["animationId"],fullscreen:["animationId"]};function Be(){if(document.getElementById(U))return;let t=document.createElement("style");t.id=U,t.textContent=se,document.head.appendChild(t)}function he(){let t=document.documentElement,s=document.body,i=[t.dataset.theme,t.className,t.getAttribute("style"),s?.dataset?.theme,s?.className,s?.getAttribute("style"),getComputedStyle(t).colorScheme].filter(Boolean).join(" ").toLowerCase();return i.includes("dark")?"dark":i.includes("light")?"light":window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function De(){let[t,s]=u.useState(he);return u.useEffect(()=>{let i=()=>s(he()),n=new MutationObserver(i);n.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]}),document.body&&n.observe(document.body,{attributes:!0,attributeFilter:["class","style","data-theme"]});let o=window.matchMedia?.("(prefers-color-scheme: dark)");return o?.addEventListener?.("change",i),()=>{n.disconnect(),o?.removeEventListener?.("change",i)}},[]),t}function X(t,s){let i=Number(t??s)>>>0;return`rgba(${i>>>16&255},${i>>>8&255},${i&255},${(i>>>24&255)/255})`}function J(t){return`#${(Number(t)>>>0).toString(16).padStart(8,"0").toUpperCase()}`}function Ue(t,s){return t==="circle"?{borderRadius:"50%",background:s}:t==="ring"?{borderRadius:"50%",border:`7px solid ${s}`,background:"transparent"}:t==="triangle"?{background:s,clipPath:"polygon(50% 0,100% 100%,0 100%)"}:t==="fourstar"?{background:s,clipPath:"polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%)"}:t==="fivestar"?{background:s,clipPath:"polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%)"}:t==="missing"?{background:"#4822285c",border:"1px dashed #ff7481"}:{background:s}}let z=B;function ve(t){let s;try{s=atob(t.data)}catch{throw new Error("\u5BFC\u51FA\u5185\u5BB9\u89E3\u7801\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u6216\u5237\u65B0\u9875\u9762")}let i=new Uint8Array(s.length);for(let c=0;c<s.length;c+=1)i[c]=s.charCodeAt(c);let n=URL.createObjectURL(new Blob([i],{type:t.mimeType||"application/octet-stream"})),o=document.createElement("a");o.href=n,o.download=t.filename||"qxqy-export",o.rel="noopener",o.style.display="none",document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}async function Ge(t){let s=new Uint8Array(await t.arrayBuffer()),i="",n=32768;for(let o=0;o<s.length;o+=n)i+=String.fromCharCode(...s.subarray(o,o+n));return btoa(i)}let Y=t=>typeof t=="object"?t.value:t,qe=t=>typeof t=="object"?t.label:t,Ye=[{key:"KEYBOARD",label:"PC",title:"PC KEYBOARD \u753B\u5E03\uFF1A1600\xD7900 / 2100\xD7900"},{key:"TOUCHSCREEN",label:"\u624B\u673A",title:"\u624B\u673A TOUCHSCREEN \u753B\u5E03\uFF1A1280\xD7720 / 1560\xD7720 / 1280\xD7960"}];function ye(t){return String(t.id||"").split("-").slice(1).join(":")}function Ve(t,s){let i=(o,c)=>c?i(c,o%c):o,n=i(Math.round(t),Math.round(s))||1;return`${Math.round(t)/n}:${Math.round(s)/n}`}function $({field:t,commit:s,axis:i}){let n=t.type==="color"?J(t.value):t.value==null?"":String(t.value),[o,c]=u.useState(n);if(u.useEffect(()=>c(t.type==="color"?J(t.value):t.value==null?"":String(t.value)),[t.value,t.type]),t.type==="note")return e("div",{className:"qxsim-note"},t.value||t.label);if(t.readonly&&(t.evidence==="N"||t.evidence==="U"))return e("div",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},t.label),e("div",{className:"qxsim-unsupported"},t.value==null?"\u5C1A\u65E0\u53EF\u7F16\u8F91\u503C":String(t.value)));if(t.type==="bool")return e("div",{className:"qxsim-switch-row"},e("span",null,t.label),e("label",{className:"qxsim-switch"},e("input",{type:"checkbox",checked:!!t.value,disabled:!!t.readonly,onChange:l=>s(t.key,l.target.checked)}),e("span",{className:"qxsim-switch-track"})));if(t.type==="enum"){let l=[...t.options||[]],g=String(t.value??"");return l.some(q=>String(Y(q))===g)||l.unshift({value:t.value??"",label:`\u672A\u8BC6\u522B\u9009\u9879 ${t.unknownValue??(g||"\u7A7A")}\uFF08\u4FDD\u7559\u539F\u503C\uFF09`}),e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},t.label),e("select",{value:g,disabled:!!t.readonly,onChange:q=>s(t.key,q.target.value)},l.map(q=>e("option",{key:String(Y(q)),value:Y(q)},qe(q)))))}if(t.type==="percent"){let l=Math.round(Number(t.value||0)*100);return e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},t.label),e("span",{className:"qxsim-percent"},e("input",{type:"range",min:0,max:100,value:l,onInput:g=>s(t.key,Number(g.target.value)/100)}),e("output",null,`${l}%`)))}if(t.type==="color"){let l=/^#[0-9a-f]{8}$/i.test(o)?o:J(t.value);return e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},t.label,e("small",null,"ARGB")),e("span",{className:"qxsim-color-row"},e("span",{className:"qxsim-color-swatch",title:"\u6253\u5F00\u53D6\u8272\u5668"},e("input",{type:"color",value:`#${l.slice(3)}`,onInput:g=>{let q=`#${l.slice(1,3)}${g.target.value.slice(1).toUpperCase()}`;c(q),s(t.key,q)}})),e("input",{type:"text",value:o,spellCheck:!1,"aria-label":`${t.label} ARGB`,onChange:g=>c(g.target.value),onBlur:()=>s(t.key,o),onKeyDown:g=>{g.key==="Enter"&&g.currentTarget.blur(),g.key==="Escape"&&c(J(t.value))}})))}let m={value:o,disabled:!!t.readonly,readOnly:!!t.readonly,onChange:l=>c(l.target.value),onBlur:()=>{t.readonly||s(t.key,o)},onKeyDown:l=>{l.key==="Enter"&&t.type!=="text"&&l.currentTarget.blur(),l.key==="Escape"&&c(t.value==null?"":String(t.value))}};return e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},i?e("b",{className:`qxsim-axis ${i.toLowerCase()}`},i):null,t.label),t.type==="text"?e("textarea",{...m,rows:4}):e("input",{...m,type:t.type==="number"?"number":"text",step:t.type==="number"?"any":void 0}))}function A({title:t,open:s=!0,children:i}){return e("details",{className:"qxsim-section",open:s},e("summary",null,t),e("div",{className:"qxsim-section-body"},i))}function _e(t){let s={};for(let i of t||[])s[i.key]=i;return s}function E({label:t,x:s,y:i,xAxis:n="X",yAxis:o="Y",commit:c}){return e("div",{className:"qxsim-pair"},e("div",{className:"qxsim-pair-name"},t),e($,{field:s,axis:n,commit:c}),e($,{field:i,axis:o,commit:c}))}function Re({field:t,commit:s,createStateChild:i}){return e("div",{className:"qxsim-state-field"},e("div",{className:"qxsim-state-label"},t.label),e("div",{className:"qxsim-state-ref"},e("button",{title:`\u65B0\u5EFA\u5E76\u7ED1\u5B9A${t.label}\u56FE\u7247`,onClick:()=>i(t.key,t.label)},"+"),e("select",{value:String(t.value??""),"aria-label":t.label,onChange:n=>s(t.key,n.target.value)},(t.options||[]).map(n=>e("option",{key:String(Y(n)),value:Y(n)},qe(n))))))}function He({inspector:t,commit:s,createStateChild:i}){let n=_e(t.fields),o=g=>g?.type==="node"?e(Re,{key:g.key,field:g,commit:s,createStateChild:i}):g?e($,{key:g.key,field:g,commit:s}):null,c=(Fe[t.kind]||[]).map(g=>n[g]).filter(Boolean).map(o),m=null;if(t.kind==="image"){let g=n.fillType?.value==="Horizontal"?n.fillHorizontalType:n.fillType?.value==="Vertical"?n.fillVerticalType:n.fillType?.value==="Radial90"?n.fillRadial90Type:n.fillRadialType,q=[o(n.enableMask),o(n.enableSoftEdge),n.enableSoftEdge?.value?e("div",{className:"qxsim-subfields",key:"soft-fields"},o(n.softEdgeMode),e(E,{label:"\u7FBD\u5316\u5BBD\u5EA6",x:n.softEdgeWidthX,y:n.softEdgeWidthY,commit:s}),e(E,{label:"\u7FBD\u5316\u8303\u56F4",x:n.horizontalSoftRange,y:n.verticalSoftRange,commit:s})):null,o(n.enableFill),n.enableFill?.value?e("div",{className:"qxsim-subfields",key:"fill-fields"},o(n.fillType),o(g),o(n.fillAmount)):null,o(n.reverseMaskArea)];m=e(u.Fragment,null,e(A,{title:"\u56FE\u7247\u8BBE\u7F6E"},o(n.imageSource),o(n.imageId),o(n.imageColor)),e(A,{title:"\u906E\u7F69\u8BBE\u7F6E"},q))}let l=t.kind==="textbox"?"\u6587\u672C\u6846\u8BBE\u7F6E":t.kind==="button"?"\u6309\u94AE\u8BBE\u7F6E":`${t.label}\u8BBE\u7F6E`;return e(u.Fragment,null,e(A,{title:"\u8282\u70B9\u4FE1\u606F",open:!1},e($,{field:n.name,commit:s})),e(A,{title:"\u53D8\u6362"},n.posX?e(E,{label:"\u4F4D\u7F6E",x:n.posX,y:n.posY,commit:s}):null,n.width?e(E,{label:"\u5927\u5C0F",x:n.width,y:n.height,xAxis:"W",yAxis:"H",commit:s}):null,n.rotationZ?e($,{field:n.rotationZ,commit:s}):null,n.syncAllDevices?e($,{field:n.syncAllDevices,commit:s}):null,n.anchorType?e($,{field:n.anchorType,commit:s}):null,n.anchorMinX?e(E,{label:"Min",x:n.anchorMinX,y:n.anchorMinY,commit:s}):null,n.anchorMaxX?e(E,{label:"Max",x:n.anchorMaxX,y:n.anchorMaxY,commit:s}):null,n.pivotX?e(E,{label:"\u4E2D\u5FC3",x:n.pivotX,y:n.pivotY,commit:s}):null),e(A,{title:"\u521B\u5EFA\u8BBE\u7F6E"},n.active?e($,{field:n.active,commit:s}):null,n.visible?e($,{field:n.visible,commit:s}):null),m||(c.length?e(A,{title:l},c):null),n.canControllerFocus?e(A,{title:"\u624B\u67C4\u5BFC\u822A",open:!1},e($,{field:n.canControllerFocus,commit:s})):null,n.incomplete?e(A,{title:"\u5B9E\u73B0\u72B6\u6001"},e($,{field:n.incomplete,commit:s})):null)}function Xe({snap:t,selectedScriptId:s,selectScript:i,draft:n,updateDraft:o,saveScript:c,addScript:m,removeScript:l,exportLua:g,exportScripts:q,exportScriptsGia:S,notice:L}){let b=t.scripts||[],p=b.find(f=>f.id===s)||null,v=t.mountTargets||[],y=v.filter(f=>f.assetType==="server-control-template"),h=v.filter(f=>f.assetType==="client-control-template"),C=f=>{let P=v.find(T=>T.id===f);return P?`${P.assetLabel} \xB7 ${P.name}`:""};return e("div",{className:"qxsim-script-page"},e("aside",{className:"qxsim-script-assets"},e("h3",null,`\u5B58\u6863\u5185 Lua \u811A\u672C\uFF08${b.length}\uFF09`),e("button",{className:"qxsim-action",style:{width:"100%",marginBottom:8},onClick:m},"\uFF0B \u65B0\u5EFA\u811A\u672C"),b.length?b.map(f=>e("div",{key:f.id,className:"qxsim-script-list-row"},e("button",{className:`qxsim-script-asset${f.id===s?" active":""}`,onClick:()=>i(f.id)},e("strong",null,f.path||"(\u672A\u547D\u540D\u811A\u672C)"),e("small",null,f.mounted?`\u6302\u8F7D\uFF1A${f.assetLabel} \xB7 ${f.controlName}`:"\u672A\u6302\u8F7D\uFF08\u4EC5\u53EF\u88AB require\uFF09")),e("button",{className:"qxsim-iconbtn",title:"\u4E0B\u8F7D\u8BE5\u811A\u672C .lua",onClick:()=>g(f.id)},"\u21E9"),e("button",{className:"qxsim-iconbtn",title:"\u5220\u9664\u8BE5\u811A\u672C",onClick:()=>l(f.id)},"\u2715"))):e("div",{className:"qxsim-empty"},"\u8FD8\u6CA1\u6709\u811A\u672C\uFF0C\u70B9\u51FB\u201C\u65B0\u5EFA\u811A\u672C\u201D\u5F00\u59CB")),e("main",{className:"qxsim-script-editor"},p&&n?e(u.Fragment,null,e("div",{className:"qxsim-script-title"},e("div",null,e("h2",null,n.path||"(\u672A\u547D\u540D\u811A\u672C)"),e("span",null,`\u5C5E\u4E8E\u5B58\u6863\u201C${t.save?.name||"\u672A\u547D\u540D\u5B58\u6863"}\u201D \xB7 Lua \u811A\u672C\u662F\u5B58\u6863\u5185\u72EC\u7ACB\u8D44\u4EA7`)),e("span",null,`\u811A\u672C ${p.id}`)),e("div",{className:"qxsim-script-fields"},e("label",null,"\u811A\u672C\u8DEF\u5F84\uFF08\u5DE5\u4F5C\u533A\u76F8\u5BF9\u8DEF\u5F84\uFF09",e("input",{type:"text",value:n.path,placeholder:"lua/example.lua",onChange:f=>o({path:f.target.value})})),e("label",null,"\u6302\u8F7D\u76EE\u6807\uFF08\u5BA2\u6237\u7AEF\u63A7\u4EF6 / \u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\uFF09",e("select",{value:n.controlId?`${n.controlAsset||"server-control-template"}|${n.controlId}`:"",onChange:f=>{let[P,T]=f.target.value.split("|");o(T?{controlId:T,controlAsset:P}:{controlId:"",controlAsset:""})}},e("option",{value:""},"\u672A\u6302\u8F7D\uFF08\u4E0D\u751F\u6548\uFF0C\u4EC5\u53EF\u88AB require\uFF09"),e("optgroup",{label:"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F \xB7 \u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668\u5185"},y.map(f=>e("option",{key:f.id,value:`${f.assetType}|${f.id}`},`${f.name} \xB7 ${f.id}`))),h.length?e("optgroup",{label:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"},h.map(f=>e("option",{key:f.id,value:`${f.assetType}|${f.id}`},`${f.name} \xB7 ${f.id}`))):null))),e("label",null,"Lua \u6E90\u7801",e("textarea",{value:n.source,spellCheck:!1,placeholder:"-- \u5728\u8FD9\u91CC\u8F93\u5165\u5BA2\u6237\u7AEF Lua\uFF1B\u811A\u672C\u53EA\u6709\u6302\u8F7D\u5230\u5BA2\u6237\u7AEF\u63A7\u4EF6\u540E\u624D\u4F1A\u5728\u8BD5\u73A9\u65F6\u751F\u6548",onChange:f=>o({source:f.target.value})})),e("div",{className:"qxsim-script-footer"},e("span",null,n.dirty?"\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539":L||(p.mounted?`\u5DF2\u6302\u8F7D\uFF1A${C(p.controlId)}`:"\u5F53\u524D\u672A\u6302\u8F7D\uFF0C\u8BD5\u73A9\u65F6\u4E0D\u4F1A\u81EA\u52A8\u8FD0\u884C")),e("span",{className:"spacer"}),e("button",{className:"qxsim-action",onClick:q},"\u21E9 \u811A\u672C\u5305 JSON"),e("button",{className:"qxsim-action",onClick:S},"\u21E9 \u811A\u672C\u5305 GIA"),e("button",{className:"qxsim-action primary",disabled:!n.dirty,onClick:c},"\u4FDD\u5B58\u811A\u672C"))):e("div",{className:"qxsim-empty"},"\u8BF7\u65B0\u5EFA\u6216\u9009\u62E9\u4E00\u4E2A\u811A\u672C")))}function we(t){if(t===void 0)return"null";try{return JSON.stringify(t)}catch{return String(t)}}function ke(t){let s=String(t??"").trim();if(!s)return null;try{return JSON.parse(s)}catch{return s}}function Ne(t){return!!(t&&typeof t=="object"&&!Array.isArray(t)&&Object.prototype.hasOwnProperty.call(t,"fromSignalParam"))}function Se(t){return{version:1,dirty:!1,rules:(Array.isArray(t?.rules)?t.rules:[]).map((i,n)=>({id:String(i.id||`signal-${n+1}`),signalName:String(i.signalName||""),actions:Array.isArray(i.actions)&&i.actions.length?i.actions.map(o=>Ke(o)):[V("setCustomVariable")]}))}}let Ce=["PlayerSelf","AllPlayers","Player1","Player2","Player3","Player4","Player5","Player6","Player7","Player8"],$e=["PlayerSelf","Level","Player1","Player2","Player3","Player4","Player5","Player6","Player7","Player8"],Ae={PlayerSelf:"PlayerSelf \u5F53\u524D\u73A9\u5BB6",AllPlayers:"AllPlayers \u5168\u90E8\u73A9\u5BB6",Level:"Level \u5173\u5361",Player1:"Player1 \u73A9\u5BB61",Player2:"Player2 \u73A9\u5BB62",Player3:"Player3 \u73A9\u5BB63",Player4:"Player4 \u73A9\u5BB64",Player5:"Player5 \u73A9\u5BB65",Player6:"Player6 \u73A9\u5BB66",Player7:"Player7 \u73A9\u5BB67",Player8:"Player8 \u73A9\u5BB68"};function re(t){return $e.includes(t)&&t!=="AllPlayers"?t:t==="Level"?"Level":"PlayerSelf"}function oe(t){return Ce.includes(t)?t:"PlayerSelf"}function V(t){return t==="sendClientScriptSignal"?{kind:"sendClientScriptSignal",target:"PlayerSelf",signalName:"",params:[]}:{kind:"setCustomVariable",entityType:"PlayerSelf",name:"",value:0}}function Je(t){return{version:1,rules:(t?.rules||[]).map(s=>({id:String(s.id||""),signalName:String(s.signalName||"").trim(),actions:(s.actions||[]).map(i=>i?.kind==="sendClientScriptSignal"?{kind:"sendClientScriptSignal",target:oe(i.target),signalName:String(i.signalName||"").trim(),params:Array.isArray(i.params)?i.params:[]}:{kind:"setCustomVariable",entityType:re(i?.entityType),name:String(i?.name||"").trim(),value:i&&Object.prototype.hasOwnProperty.call(i,"value")?i.value:0})}))}}function We(t){let s=[];for(let[i,n]of(t?.rules||[]).entries()){String(n.signalName||"").trim()||s.push(`\u89C4\u5219 ${i+1} \u9700\u8981\u76D1\u542C\u4FE1\u53F7\u540D`);let o=n.actions||[];o.length||s.push(`\u89C4\u5219 ${i+1} \u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u52A8\u4F5C`);for(let[c,m]of o.entries())m?.kind==="sendClientScriptSignal"?String(m.signalName||"").trim()||s.push(`\u89C4\u5219 ${i+1} \u52A8\u4F5C ${c+1} \u9700\u8981\u5BA2\u6237\u7AEF\u4FE1\u53F7\u540D`):String(m?.name||"").trim()||s.push(`\u89C4\u5219 ${i+1} \u52A8\u4F5C ${c+1} \u9700\u8981\u53D8\u91CF\u540D`)}return s}function Ke(t){if(t?.kind==="sendClientScriptSignal")return{kind:"sendClientScriptSignal",target:oe(t.target),signalName:String(t.signalName||""),params:Array.isArray(t.params)?t.params.map(i=>{try{return JSON.parse(JSON.stringify(i))}catch{return i}}):[]};let s=0;if(t&&Object.prototype.hasOwnProperty.call(t,"value"))try{s=JSON.parse(JSON.stringify(t.value))}catch{s=t.value}return{kind:"setCustomVariable",entityType:re(t?.entityType),name:String(t?.name||""),value:s}}function Pe({label:t,value:s,onChange:i}){let n=Ne(s),[o,c]=u.useState(()=>n?"":we(s));return u.useEffect(()=>{Ne(s)||c(we(s))},[s]),e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},t),e("select",{value:n?"param":"literal","aria-label":`${t}\u6765\u6E90`,onChange:m=>{m.target.value==="param"?i({fromSignalParam:Number(s?.fromSignalParam)||0}):i(ke(o||"0"))}},e("option",{value:"literal"},"\u5B57\u9762\u91CF\uFF08JSON\uFF09"),e("option",{value:"param"},"\u5F15\u7528\u76D1\u542C\u4FE1\u53F7\u53C2\u6570")),n?e("input",{type:"number",min:0,step:1,value:Number(s.fromSignalParam)||0,"aria-label":`${t}\u53C2\u6570\u5E8F\u53F7`,onChange:m=>i({fromSignalParam:Math.max(0,Math.trunc(Number(m.target.value)||0))})}):e("textarea",{className:"qxsim-logic-json",value:o,spellCheck:!1,"aria-label":`${t}\u5B57\u9762\u91CF`,onBlur:()=>i(ke(o)),onChange:m=>c(m.target.value)}))}function Ze({params:t,onChange:s}){let i=Array.isArray(t)?t:[];return e("div",{className:"qxsim-field wide"},e("span",{className:"qxsim-field-label"},"\u5BA2\u6237\u7AEF\u4FE1\u53F7\u53C2\u6570\uFF08\u6309\u6DFB\u52A0\u987A\u5E8F\uFF09"),i.length?i.map((n,o)=>e("div",{key:o,style:{display:"flex",gap:6,alignItems:"flex-start",marginBottom:6}},e("div",{style:{flex:1,minWidth:0}},e(Pe,{label:`\u53C2\u6570 ${o}`,value:n,onChange:c=>s(i.map((m,l)=>l===o?c:m))})),e("button",{className:"qxsim-iconbtn",title:"\u5220\u9664\u53C2\u6570",onClick:()=>s(i.filter((c,m)=>m!==o))},"\u2715"))):e("div",{className:"qxsim-muted"},"\u6682\u65E0\u53C2\u6570\uFF0C\u53EF\u53D1\u9001\u7A7A\u53C2\u6570\u5217\u8868"),e("button",{className:"qxsim-action",style:{marginTop:4},onClick:()=>s(i.concat([0]))},"\uFF0B \u6DFB\u52A0\u53C2\u6570"))}function Qe({snap:t,draft:s,setDraft:i,saveLogic:n,notice:o,error:c}){let m=s?.rules||[];function l(b){i({version:1,rules:b,dirty:!0})}function g(){l(m.concat([{id:`signal-${Date.now().toString(36)}`,signalName:"",actions:[V("setCustomVariable")]}]))}function q(b,p){l(m.map((v,y)=>y===b?{...v,...p}:v))}function S(b,p,v){let y=m[b];y&&q(b,{actions:y.actions.map((h,C)=>C===p?{...h,...v}:h)})}function L(b,p,v){S(b,p,V(v))}return e("div",{className:"qxsim-server-logic"},e("div",{className:"qxsim-logic-wrap"},e("div",{className:"qxsim-logic-title"},e("div",null,e("h2",null,"\u670D\u52A1\u7AEF\u903B\u8F91"),e("p",null,`\u5C5E\u4E8E\u5B58\u6863\u201C${t.save?.name||"\u672A\u547D\u540D\u5B58\u6863"}\u201D \xB7 \u76D1\u542C\u5BA2\u6237\u7AEF\u4FE1\u53F7\u540E\u8BBE\u7F6E Level / \u73A9\u5BB6\u53D8\u91CF\uFF0C\u6216\u5411\u6307\u5B9A\u73A9\u5BB6\u53D1\u9001\u5BA2\u6237\u7AEF\u811A\u672C\u4FE1\u53F7`)),e("button",{className:"qxsim-action primary",disabled:!s?.dirty,onClick:n},"\u4FDD\u5B58\u670D\u52A1\u7AEF\u903B\u8F91")),e("div",{className:"qxsim-note"},"\u8FD9\u662F\u6A21\u62DF\u5668\u5B58\u6863\u683C\u5F0F\uFF0C\u4E0D\u662F\u5B98\u65B9\u8282\u70B9\u56FE\u3002PlayerSelf \u8868\u793A\u53D1\u4FE1\u53F7\u7684\u90A3\u4F4D\u73A9\u5BB6\uFF1BPlayer1\u20138 \u662F\u56FA\u5B9A\u5EA7\u4F4D\uFF1BAllPlayers \u5411\u672C\u5C40\u5168\u90E8\u8BD5\u73A9\u73A9\u5BB6\u5E7F\u64AD\u3002"),c?e("div",{className:"qxsim-logic-error"},c):null,m.length?m.map((b,p)=>e("section",{key:b.id||p,className:"qxsim-logic-rule"},e("div",{className:"qxsim-logic-rule-head"},e("strong",null,`\u89C4\u5219 ${p+1}`),e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},"\u76D1\u542C\u4FE1\u53F7\u540D"),e("input",{type:"text",value:b.signalName,placeholder:"EarnGold","aria-label":`\u89C4\u5219 ${p+1} \u76D1\u542C\u4FE1\u53F7\u540D`,onChange:v=>q(p,{signalName:v.target.value})})),e("button",{className:"qxsim-iconbtn",title:"\u5220\u9664\u89C4\u5219",onClick:()=>l(m.filter((v,y)=>y!==p))},"\u2715")),e("div",{className:"qxsim-logic-actions"},(b.actions||[]).map((v,y)=>e("div",{key:y,className:"qxsim-logic-action"},e("div",{className:"qxsim-logic-action-head"},e("strong",null,`\u52A8\u4F5C ${y+1}`),e("select",{value:v.kind,"aria-label":`\u89C4\u5219 ${p+1} \u52A8\u4F5C ${y+1} \u7C7B\u578B`,onChange:h=>L(p,y,h.target.value)},e("option",{value:"setCustomVariable"},"\u8BBE\u7F6E\u81EA\u5B9A\u4E49\u53D8\u91CF"),e("option",{value:"sendClientScriptSignal"},"\u53D1\u9001\u5BA2\u6237\u7AEF\u811A\u672C\u4FE1\u53F7")),e("span",null,v.kind==="sendClientScriptSignal"?"\u53D1\u7ED9\u5F53\u524D\u73A9\u5BB6\u3001\u6307\u5B9A\u73A9\u5BB6\u6216\u5168\u90E8\u73A9\u5BB6":"\u5199\u5165 Level / \u5F53\u524D\u73A9\u5BB6 / \u73A9\u5BB61-8"),e("button",{className:"qxsim-iconbtn",title:"\u5220\u9664\u52A8\u4F5C",disabled:(b.actions||[]).length<=1,onClick:()=>q(p,{actions:b.actions.filter((h,C)=>C!==y)})},"\u2715")),v.kind==="sendClientScriptSignal"?e("div",{className:"qxsim-logic-fields"},e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},"\u53D1\u9001\u76EE\u6807"),e("select",{value:oe(v.target),onChange:h=>S(p,y,{target:h.target.value})},Ce.map(h=>e("option",{key:h,value:h},Ae[h])))),e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},"\u5BA2\u6237\u7AEF\u4FE1\u53F7\u540D"),e("input",{type:"text",value:v.signalName,placeholder:"GoldChanged",onChange:h=>S(p,y,{signalName:h.target.value})})),e(Ze,{params:v.params,onChange:h=>S(p,y,{params:h})})):e("div",{className:"qxsim-logic-fields"},e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},"\u5B9E\u4F53"),e("select",{value:re(v.entityType),onChange:h=>S(p,y,{entityType:h.target.value})},$e.map(h=>e("option",{key:h,value:h},Ae[h])))),e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},"\u53D8\u91CF\u540D"),e("input",{type:"text",value:v.name,placeholder:"Gold",onChange:h=>S(p,y,{name:h.target.value})})),e("div",{className:"wide"},e(Pe,{label:"\u53D8\u91CF\u503C",value:v.value,onChange:h=>S(p,y,{value:h})}))))),e("div",{className:"qxsim-logic-actions-foot"},e("button",{className:"qxsim-action",onClick:()=>q(p,{actions:(b.actions||[]).concat([V("setCustomVariable")])})},"\uFF0B \u8BBE\u7F6E\u81EA\u5B9A\u4E49\u53D8\u91CF"),e("button",{className:"qxsim-action",onClick:()=>q(p,{actions:(b.actions||[]).concat([V("sendClientScriptSignal")])})},"\uFF0B \u53D1\u9001\u5BA2\u6237\u7AEF\u811A\u672C\u4FE1\u53F7"))))):e("div",{className:"qxsim-logic-empty"},"\u8FD8\u6CA1\u6709\u76D1\u542C\u89C4\u5219\u3002\u8BD5\u73A9\u65F6\u5BA2\u6237\u7AEF SendSignal \u4E0D\u4F1A\u81EA\u52A8\u6539\u53D8\u91CF\u6216\u56DE\u4F20\u4FE1\u53F7\u3002"),e("div",{className:"qxsim-logic-actions-foot"},e("button",{className:"qxsim-action",onClick:g},"\uFF0B \u6DFB\u52A0\u76D1\u542C\u89C4\u5219")),e("div",{className:"qxsim-script-footer",style:{marginTop:16}},e("span",null,s?.dirty?"\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539":o||"\u4FDD\u5B58\u540E\u4F1A\u5199\u5165\u5F53\u524D\u5B58\u6863\uFF0C\u4E0B\u6B21\u8BD5\u73A9\u751F\u6548"),e("span",{className:"spacer"}))))}function et({snap:t,addScriptMounted:s,mountScriptTo:i,unmountScript:n,openScript:o}){let c=(t.scripts||[]).filter(l=>l.controlId===t.selectedId),m=(t.scripts||[]).filter(l=>l.controlId!==t.selectedId);return e(u.Fragment,null,e(A,{title:"\u6302\u8F7D\u5230\u8BE5\u63A7\u4EF6\u7684\u811A\u672C"},c.length?c.map(l=>e("div",{key:l.id,className:"qxsim-script-list-row"},e("button",{className:"qxsim-script-asset",onClick:()=>o(l.id)},e("strong",null,l.path||"(\u672A\u547D\u540D\u811A\u672C)"),e("small",null,`\u811A\u672C ${l.id}`)),e("button",{className:"qxsim-iconbtn",title:"\u89E3\u9664\u6302\u8F7D\uFF08\u4FDD\u7559\u811A\u672C\uFF09",onClick:()=>n(l.id)},"\u292B"))):e("div",{className:"qxsim-note"},"\u8BE5\u63A7\u4EF6\u5C1A\u672A\u6302\u8F7D\u811A\u672C\u3002\u811A\u672C\u6302\u8F7D\u5230\u5BA2\u6237\u7AEF\u63A7\u4EF6\u540E\u624D\u4F1A\u5728\u8BD5\u73A9\u65F6\u751F\u6548\u3002")),e(A,{title:"\u6302\u8F7D\u5DF2\u6709\u811A\u672C",open:!1},m.length?e("label",{className:"qxsim-field"},e("span",{className:"qxsim-field-label"},"\u9009\u62E9\u811A\u672C\u6302\u8F7D\u5230\u8BE5\u63A7\u4EF6"),e("select",{value:"","aria-label":"\u9009\u62E9\u811A\u672C\u6302\u8F7D\u5230\u8BE5\u63A7\u4EF6",onChange:l=>{let g=l.target.value;l.target.value="",g&&i(g)}},e("option",{value:""},"\u9009\u62E9\u811A\u672C\u2026"),m.map(l=>e("option",{key:l.id,value:l.id},`${l.path||"(\u672A\u547D\u540D\u811A\u672C)"} \xB7 ${l.id}${l.mounted?`\uFF08\u5F53\u524D\u6302\u8F7D\u4E8E ${l.assetLabel} \xB7 ${l.controlName}\uFF0C\u5C06\u79FB\u52A8\u5230\u6B64\u63A7\u4EF6\uFF09`:"\uFF08\u672A\u6302\u8F7D\uFF09"}`)))):e("div",{className:"qxsim-note"},"\u5B58\u6863\u5185\u8FD8\u6CA1\u6709\u5176\u4ED6\u811A\u672C\uFF0C\u53EF\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u65B0\u5EFA\u3002"),e("div",{className:"qxsim-script-actions",style:{marginTop:8}},e("button",{onClick:()=>s(t.selectedId)},"\uFF0B \u65B0\u5EFA\u811A\u672C\u5E76\u6302\u8F7D\u5230\u6B64\u63A7\u4EF6"))))}function tt(t,s){let i=null,n=null;function o(c,m){c.id===s&&(i=c,n=m);for(let l of c.children||[])o(l,c)}if(o(t,null),i?.kind==="container")return i.id;if(i?.kind==="server-container")return i.children?.find(c=>c.kind==="container")?.id||i.id;for(;n&&n.kind!=="container";){let m=function(l){for(let g of l.children||[])g===n&&(c=l),m(g)},c=null;m(t),n=c}return n?.id||t.children?.find(c=>c.kind==="container")?.id}function at(t,s){let i=null;function n(o){o.id===s&&(i=o);for(let c of o.children||[])n(c)}return n(t),i&&i.kind!=="server-container"?i.id:tt(t,s)}function it(t,s,i,n){let o=t,c=t.kind,m=c==="textbox"||c==="textwindow",l=o.renderLeft??o.left,g=o.renderBottom??o.bottom,q=o.renderWidth??o.width,S=o.renderHeight??o.height,L=o.renderRotationZ??t.rotationZ??0,b={left:`${l/i*100}%`,bottom:`${g/n*100}%`,width:`${q/i*100}%`,height:`${S/n*100}%`,"--rotation":`${-Number(L)}deg`,fontSize:Math.max(8,Math.min(40,Number(t.fontSize||12))),color:m?X(t.fontColor,4294967295):"#fff"};c==="image"?Object.assign(b,Ue(t.primitive,X(t.imageColor,4294967295))):m?(b.background=X(t.bgColor,16777215),b.justifyContent=t.horizontalAlignment==="Right"?"flex-end":t.horizontalAlignment==="Middle"?"center":"flex-start",b.alignItems=t.verticalAlignment==="Bottom"?"flex-end":t.verticalAlignment==="Middle"?"center":"flex-start",b.textShadow=t.enableOutline===!1?"none":`0 0 2px ${X(t.outlineColor,4278190080)}`):c==="container"&&(b.background="transparent");let p=t.id===s.selectedId,v=m?t.text||"":c==="image"&&t.primitive==="missing"?e("span",{className:"qxsim-box-label"},`\u7F3A\u5C11\u56FE\u7247 ${t.imageId||""}`):c!=="container"&&c!=="image"?e("span",{className:"qxsim-box-label"},t.name||M[c]?.[1]||c):null;return e("div",{key:t.id,className:`qxsim-box ${c}${p?" selected":""}${t.instantiated?" dynamic":""}${t.pressed?" pressed":""}`,style:b},v,p&&c!=="container"?["tl","tr","bl","br"].map(y=>e("i",{key:y,className:`qxsim-handle ${y}`})):null)}function nt({sessionId:t}){let s=De(),[i,n]=u.useState(null),o=u.useRef(null),c=u.useRef(Promise.resolve()),[m,l]=u.useState(""),[g,q]=u.useState(null),[S,L]=u.useState(!1),[b,p]=u.useState(""),v=u.useRef(null),[y,h]=u.useState([]),[C,f]=u.useState("ui"),[P,T]=u.useState("base"),[le,st]=u.useState("fit"),[ce,rt]=u.useState({}),[W,de]=u.useState(""),[O,pe]=u.useState("template"),[me,K]=u.useState(""),[xe,_]=u.useState(null),[ze,ue]=u.useState({version:1,rules:[],dirty:!1}),Le=u.useRef(null),[Z,ot]=u.useState({width:0,height:0});u.useEffect(()=>{let a=Le.current;if(!a||typeof ResizeObserver>"u")return;let r=new ResizeObserver(d=>{let x=d[0]?.contentRect;x&&x.width>0&&ot({width:x.width,height:x.height})});return r.observe(a),()=>r.disconnect()},[i?.canvas?.id]);function R(a,{keepLogicDraft:r=!0}={}){return o.current=a,n(a),a?.scripts&&K(d=>a.scripts.some(x=>x.id===d)?d:a.scripts[0]?.id||""),ue(d=>r&&d?.dirty?d:Se(a?.serverLogic)),a}let Q=u.useCallback(async()=>{try{l(""),R(await z(t,"get"),{keepLogicDraft:!1})}catch(a){l(a?.message||String(a))}},[t]),ee=u.useCallback(async()=>{try{let a=await z(t,"archives");h(a?.archives||[])}catch{h([])}},[t]);u.useEffect(()=>{Q(),ee()},[Q,ee]);function N(a){let r=async()=>{let d=o.current;if(!d)throw new Error("editor is not ready");try{let x=await z(t,"patch",{op:{...a,expectedRevision:d.version}});return l(""),R(x)}catch(x){throw l(x?.message||String(x)),/revision conflict/.test(String(x?.message||x))&&await Q(),x}};return c.current=c.current.then(r,r),c.current}let lt=(a,r)=>void N({op:"set",key:a,value:r}).catch(()=>{});async function ct(a,r){let d=o.current?.inspector?.id;if(d)try{let x=await N({op:"add",kind:"image",parentId:d,name:`${r}\u56FE\u7247`});await N({op:"set",id:d,key:a,value:x.selectedId}),p(`${r}\u5DF2\u521B\u5EFA\u5E76\u7ED1\u5B9A\uFF1B\u53EF\u5728\u63A7\u4EF6\u6811\u4E2D\u7EE7\u7EED\u7F16\u8F91\u56FE\u7247\u3002`)}catch{}}u.useEffect(()=>{let a=i?.scripts?.find(r=>r.id===me);_(r=>r&&a&&r.id===a.id&&r.dirty?r:a?{id:a.id,path:a.path,source:a.source,controlId:a.controlId,controlAsset:a.controlAsset,dirty:!1}:null)},[i,me]);function dt(a){_(r=>r&&{...r,...a,dirty:!0})}async function te(){let a=xe;!a||!a.dirty||(await N({op:"updateScript",id:a.id,path:a.path,source:a.source,controlId:a.controlId,controlAsset:a.controlAsset}),_(r=>r&&r.id===a.id?{...r,dirty:!1}:r))}function Te(){te().then(()=>p("Lua \u811A\u672C\u5DF2\u4FDD\u5B58\u5230\u5F53\u524D\u5B58\u6863")).catch(()=>{})}async function ae({silent:a=!1}={}){let r=ze;if(!r||!r.dirty)return;let d=We(r);if(d.length){let F=d[0];throw a||l(F),new Error(F)}let x=await N({op:"setServerLogic",logic:Je(r)});ue(Se(x.serverLogic)),p("\u670D\u52A1\u7AEF\u903B\u8F91\u5DF2\u4FDD\u5B58\u5230\u5F53\u524D\u5B58\u6863")}function pt(){ae({silent:!0}).catch(()=>{})}function H(a){Te(),pt(),f(a)}async function Ee(a={}){let r=await N({op:"addScript",...a}),d=r.scripts?.[r.scripts.length-1];return d&&K(d.id),p(a.controlId?"\u5DF2\u65B0\u5EFA\u811A\u672C\u5E76\u6302\u8F7D\u5230\u8BE5\u63A7\u4EF6":"\u5DF2\u65B0\u5EFA\u811A\u672C\uFF0C\u53EF\u7F16\u8F91\u8DEF\u5F84\u3001\u6E90\u7801\u548C\u6302\u8F7D\u76EE\u6807"),d}function mt(a){xe?.id===a&&_(null),N({op:"removeScript",id:a}).then(()=>p("\u811A\u672C\u5DF2\u5220\u9664")).catch(()=>{})}function xt(a){N({op:"updateScript",id:a,controlId:""}).then(()=>p("\u5DF2\u89E3\u9664\u6302\u8F7D\uFF0C\u811A\u672C\u4ECD\u4FDD\u7559\u5728\u5B58\u6863\u4E2D")).catch(()=>{})}function ut(a){let r=o.current?.selectedId||"",d=o.current?.asset?.type||"";r&&(_(x=>x&&x.id===a?{...x,controlId:r,controlAsset:d}:x),N({op:"updateScript",id:a,controlId:r,controlAsset:d}).then(()=>p("\u5DF2\u6302\u8F7D\u5230\u5F53\u524D\u63A7\u4EF6")).catch(()=>{}))}async function Ie(a){if(o.current?.asset?.type!==a)try{let r=await N({op:"selectAsset",assetType:a});de(""),pe(a==="client-control-template"?"template":"child"),p(`\u5DF2\u5207\u6362\u5230\u5B58\u6863\u5185\u7684${r.asset.label}`)}catch{}}function gt(a,r){let d=o.current;if(!d)return;let x=d.asset?.type==="client-control-template"&&O==="template",F=x?{op:"addTemplate",kind:a,name:`${r}\u6A21\u677F`}:{op:"add",kind:a,parentId:at(d.root,d.selectedId),name:r};N(F).then(()=>p(x?`\u5DF2\u65B0\u589E${r}\u6A21\u677F`:`\u5DF2\u6DFB\u52A0${r}\u5B50\u63A7\u4EF6`)).catch(()=>{})}async function ie(a,r=""){try{await c.current.catch(()=>{});let d=await z(t,"export",{format:a,assetType:r});if(Array.isArray(d?.files)&&d.files.length){for(let x of d.files)ve(x);l(""),p(`\u5DF2\u5BFC\u51FA ${d.files.length} \u4E2A GIA \u6587\u4EF6\uFF08${d.files.map(x=>x.filename).join("\u3001")}\uFF09\uFF1B\u82E5\u6D4F\u89C8\u5668\u62E6\u622A\u591A\u6587\u4EF6\u4E0B\u8F7D\uFF0C\u8BF7\u5141\u8BB8\u540E\u91CD\u8BD5\u3002`);return}ve(d),l(""),p(d.warnings?.length?`\u5DF2\u5BFC\u51FA ${d.filename}\uFF1B\u90E8\u5206\u5185\u5BB9\u6682\u4E0D\u652F\u6301 GIA\u3002`:`\u5DF2\u5BFC\u51FA ${d.filename}`)}catch(d){l(d?.message||String(d))}}async function ft(a){if(a)try{await c.current.catch(()=>{});let r=await z(t,"load-archive",{path:a});R(r.snapshot,{keepLogicDraft:!1}),l(""),p(`\u5DF2\u4ECE\u5DE5\u4F5C\u533A\u62C9\u53D6 ${a}`)}catch(r){l(r?.message||String(r))}}async function bt(a){if(!a)return;let r=a.name.toLowerCase().endsWith(".gia")?"gia":a.name.toLowerCase().endsWith(".json")?"json":a.name.toLowerCase().endsWith(".lua")?"lua":"";if(!r){l("\u4EC5\u652F\u6301 .json\u3001.gia \u6216 .lua \u6587\u4EF6");return}try{await c.current.catch(()=>{});let d=await z(t,"import",{format:r,filename:a.name,data:await Ge(a)});R(d.snapshot,{keepLogicDraft:!1}),l(""),p(d.warnings?.length?`\u5DF2\u5BFC\u5165 ${a.name}\uFF1B\u90E8\u5206\u5185\u5BB9\u6682\u4E0D\u652F\u6301\u7F16\u8F91\u3002`:`\u5DF2\u5BFC\u5165 ${a.name}`)}catch(d){l(d?.message||String(d))}finally{v.current&&(v.current.value="")}}async function ht(){let a=window.open("about:blank","_blank");if(!a){l("\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u8BD5\u73A9\u6807\u7B7E\u9875\uFF0C\u8BF7\u5141\u8BB8\u6B64\u7AD9\u70B9\u6253\u5F00\u65B0\u6807\u7B7E\u9875\u540E\u91CD\u8BD5\u3002");return}a.document.write('<!doctype html><meta charset="utf-8"><title>\u6B63\u5728\u51C6\u5907\u8BD5\u73A9\u2026</title><style>html{color-scheme:light dark;font:14px system-ui}body{min-height:100vh;margin:0;display:grid;place-items:center;background:Canvas;color:CanvasText}</style><p>\u6B63\u5728\u4FDD\u5B58\u9879\u76EE\u5E76\u51C6\u5907\u8BD5\u73A9\u2026</p>');try{await te(),await ae(),a.location.replace(ne(t))}catch(r){a.close(),l(r?.message||String(r))}}async function vt(){if(!(S||!g?.trim())){L(!0);try{await te(),await ae(),await c.current.catch(()=>{});let a=o.current,r=await z(t,"save",{path:g.trim(),expectedRevision:a.version});R(await z(t,"get")),p(`\u5DF2\u4FDD\u5B58\u5230 ${r.path}`),l(""),q(null),ee()}catch(a){l(a?.message||String(a))}finally{L(!1)}}}if(u.useEffect(()=>{i?.inspector?.kind==="server-container"&&T("base")},[i?.inspector?.kind]),!i)return e("div",{className:"qxsim","data-theme":s,"data-qxsim-session-id":t},e("div",{className:"qxsim-status error"},m||"\u6B63\u5728\u8F7D\u5165\u5343\u661F\u6C99\u7BB1\u2026"));let I=i.canvas.width,j=i.canvas.height,ge=Z.width>0&&Z.height>0?Math.min((Z.width-44)/I,(Z.height-54)/j):NaN,qt=Number.isFinite(ge)&&ge>0?Math.min(2,Math.round(ge*1e3)/1e3):.5,yt=le==="fit"?qt:Number(le)||.5,Me=Ve(I,j),wt=(i.canvas.presets||[]).filter(a=>a.platform===i.canvas.platform);function kt(a){if(!i||i.canvas.platform===a)return;let r=(i.canvas.presets||[]).filter(x=>x.platform===a);if(!r.length)return;let d=r.find(x=>ye(x)===Me)||r[0];N({op:"setCanvas",canvasId:d.id}).then(()=>p(`\u5DF2\u5207\u6362\u5230${d.label}`)).catch(()=>{})}let k=i.asset?.type==="client-control-template",fe=!!(i.inspector&&i.inspector.kind!=="server-container"),be=new Set;for(let a of i.tree||[])(ce[a.id]||(a.ancestorIds||[]).some(r=>ce[r]))&&be.add(a.id);let Nt=(i.boxes||[]).filter(a=>a.kind!=="server-container"&&a.visible&&!be.has(a.id));function St(a,r){a.stopPropagation(),rt(d=>{let x={...d};return x[r]?delete x[r]:x[r]=!0,x})}let Oe=i.tree.filter(a=>!W.trim()||`${a.name} ${a.label}`.toLowerCase().includes(W.trim().toLowerCase())),w=i.tree.find(a=>a.id===i.selectedId),Ct=k&&w?i.tree.filter(a=>a.id!==w.id&&!(a.ancestorIds||[]).includes(w.id)):[],$t=w?.parentId||i.root.id;return e("div",{className:"qxsim","data-theme":s,"data-qxsim-session-id":t},g!==null?e("div",{className:"qxsim-save-overlay"},e("form",{className:"qxsim-save-dialog",role:"dialog","aria-modal":!0,"aria-label":"\u4FDD\u5B58\u5230\u5DE5\u4F5C\u533A",onSubmit:a=>{a.preventDefault(),vt()}},e("h2",null,"\u4FDD\u5B58\u5230\u5DE5\u4F5C\u533A"),e("label",null,"\u5B58\u6863\u76F8\u5BF9\u8DEF\u5F84",e("input",{autoFocus:!0,required:!0,value:g,disabled:S,onChange:a=>q(a.target.value)})),m?e("div",{role:"alert"},m):null,e("footer",null,e("button",{className:"qxsim-action",type:"button",disabled:S,onClick:()=>q(null)},"\u53D6\u6D88"),e("button",{className:"qxsim-action primary",type:"submit",disabled:S||!g.trim()},S?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58")))):null,e("header",{className:"qxsim-toolbar"},e("div",{className:"qxsim-brand",title:`${i.workspace?.bound?i.workspace.path:"\u5DE5\u4F5C\u533A\u672A\u7ED1\u5B9A"}
26
+ ${i.meta?.sourceFile||"\u5C1A\u672A\u5BFC\u5165\u6587\u4EF6"}`},e("span",{className:"qxsim-appicon"},"UI"),e("span",{className:"qxsim-brand-text"},e("strong",null,`\u5B58\u6863\uFF1A${i.save?.name||i.meta?.name||"\u672A\u547D\u540D\u5B58\u6863"}`),e("span",null,`\u5DE5\u4F5C\u533A\uFF1A${i.workspace?.bound?i.workspace.name:"\u672A\u7ED1\u5B9A"} \xB7 \u5F53\u524D\u8D44\u4EA7\uFF1A${i.asset?.label||"UI\u63A7\u4EF6"}`))),e("div",{className:"qxsim-toolbar-center"},C==="ui"?e(u.Fragment,null,e("div",{className:"qxsim-device-switch",role:"group","aria-label":"\u76EE\u6807\u8BBE\u5907"},Ye.map(a=>e("button",{key:a.key,className:i.canvas.platform===a.key?"active":"",title:a.title,onClick:()=>kt(a.key)},a.label))),e("select",{className:"qxsim-control ratio","aria-label":"\u5C4F\u5E55\u6BD4\u4F8B",value:i.canvasId,onChange:a=>void N({op:"setCanvas",canvasId:a.target.value}).catch(()=>{})},wt.map(a=>e("option",{key:a.id,value:a.id},`${ye(a)} \xB7 ${a.width}\xD7${a.height}`))),e("select",{className:"qxsim-control zoom","aria-label":"\u753B\u5E03\u7F29\u653E",value:le,onChange:a=>st(a.target.value)},[["fit","\u9002\u5E94"],["0.25","25%"],["0.5","50%"],["0.75","75%"],["1","100%"]].map(([a,r])=>e("option",{key:a,value:a},r)))):e("span",{className:"qxsim-muted"},C==="logic"?"\u670D\u52A1\u7AEF\u903B\u8F91\uFF1A\u76D1\u542C\u4FE1\u53F7 / \u81EA\u5B9A\u4E49\u53D8\u91CF / \u73A9\u5BB61-8 \u56DE\u4F20":"Lua \u811A\u672C\u8D44\u4EA7\u7F16\u8F91")),e("div",{className:"qxsim-actions"},D?e("button",{className:"qxsim-action",title:"\u4FDD\u5B58\u5B8C\u6574\u5B58\u6863\u5230\u5DE5\u4F5C\u533A",onClick:()=>{l(""),q(o.current?.storage?.path||"qxqy-simulator.save.json")}},"\u4FDD\u5B58\u5B58\u6863"):null,e("div",{className:"qxsim-io"},e("input",{ref:v,hidden:!0,type:"file",accept:".json,.gia,.lua,application/json,application/octet-stream,text/plain",onChange:a=>void bt(a.target.files?.[0])}),e("select",{className:"qxsim-control zoom","aria-label":"\u4ECE\u5DE5\u4F5C\u533A\u62C9\u53D6\u5B58\u6863",defaultValue:"",onFocus:()=>void ee(),onChange:a=>{let r=a.target.value;a.target.value="",r&&ft(r)}},e("option",{value:"",disabled:!0},i.workspace?.bound?"\u2913 \u5DE5\u4F5C\u533A\u5B58\u6863":"\u5DE5\u4F5C\u533A\u672A\u7ED1\u5B9A"),...y.length?y.map(a=>e("option",{key:a.path,value:a.path},`${a.name} \xB7 ${a.path}`)):[e("option",{value:"",disabled:!0},i.workspace?.bound?"\u672A\u53D1\u73B0 qxqy-simulator-save":"\u5148\u7ED1\u5B9A\u4F1A\u8BDD\u5DE5\u4F5C\u533A")]),e("button",{className:"qxsim-action",title:"\u5BFC\u5165\u5B58\u6863\u3001\u5355\u9879 UI \u8D44\u4EA7\u6216 Lua",onClick:()=>v.current?.click()},"\u21E7 \u5BFC\u5165"),e("select",{className:"qxsim-control zoom","aria-label":"\u5BFC\u51FA\u683C\u5F0F",defaultValue:"",onChange:a=>{let[r,d=""]=a.target.value.split("|");a.target.value="",r&&ie(r,d)}},e("option",{value:"",disabled:!0},"\u21E9 \u5BFC\u51FA"),e("option",{value:"save"},"\u8D44\u4EA7\u5305 JSON\uFF08\u4E09\u7C7B\u5408\u4E00\uFF09"),e("option",{value:"save-gia"},"\u8D44\u4EA7\u5305 GIA\uFF08\u5DF2\u6539\u52A8\u9879\uFF09"),e("option",{value:"gia-combined"},"\u8D44\u4EA7\u5305 GIA \u6574\u5408\u5305\uFF08\u63A7\u4EF6+\u811A\u672C\uFF09"),e("optgroup",{label:"\u5F53\u524D\u754C\u9762\uFF08\u5DE6\u680F\u6B63\u5728\u770B\u7684\u90A3\u68F5\u6811\uFF09"},e("option",{value:"json"},"\u5F53\u524D\u754C\u9762 Authoring JSON"),e("option",{value:"gia"},"\u5F53\u524D\u754C\u9762 GIA")),e("optgroup",{label:"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F"},e("option",{value:"json|server-control-template"},"Authoring JSON"),e("option",{value:"gia|server-control-template"},"GIA")),e("optgroup",{label:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\uFF08\u4EC5\u5F53\u5DE6\u680F\u5207\u5230\u300CUI\u63A7\u4EF6-\u5BA2\u6237\u7AEF\u300D\u65F6\u624D\u662F\u9875\u9762\u5185\u5BB9\uFF09"},e("option",{value:"json|client-control-template"},"Authoring JSON"),e("option",{value:"gia|client-control-template"},"GIA")),e("optgroup",{label:"Lua \u811A\u672C"},e("option",{value:"scripts"},"\u811A\u672C\u5305 JSON\uFF08\u5168\u90E8\u811A\u672C\uFF09"),e("option",{value:"scripts-gia"},"\u811A\u672C\u5305 GIA\uFF08\u5168\u90E8\u811A\u672C\uFF09")))),e("button",{className:"qxsim-action primary",title:"\u5728\u72EC\u7ACB\u6807\u7B7E\u9875\u4E2D\u8BD5\u73A9",onClick:ht},"\u25B7 \u8BD5\u73A9 \u2197"),e("button",{className:"qxsim-iconbtn",title:"\u91CD\u65B0\u8F7D\u5165",onClick:Q},"\u21BB"))),e("nav",{className:"qxsim-editor-nav","aria-label":"\u7F16\u8F91\u9875\u9762"},e("button",{className:C==="ui"?"active":"",onClick:()=>H("ui")},"UI \u7F16\u8F91"),e("button",{className:C==="script"?"active":"",onClick:()=>H("script")},"Lua \u811A\u672C"),e("button",{className:C==="logic"?"active":"",onClick:()=>H("logic")},"\u670D\u52A1\u7AEF\u903B\u8F91"),e("span",{className:"save-summary"},"\u4E00\u4E2A\u5B58\u6863 \xB7 \u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F + \u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F + Lua \u811A\u672C + \u670D\u52A1\u7AEF\u903B\u8F91")),C==="ui"?e("div",{className:"qxsim-main"},e("aside",{className:"qxsim-tree"},e("div",{className:"qxsim-asset-switch","aria-label":"\u7F16\u8F91\u8D44\u6E90\u7C7B\u578B"},e("button",{className:k?"":"active",title:"\u7F16\u8F91\u5B58\u6863\u5185\u7684\u670D\u52A1\u7AEF UI \u63A7\u4EF6",onClick:()=>void Ie("server-control-template")},"UI\u63A7\u4EF6-\u670D\u52A1\u7AEF"),e("button",{className:k?"active":"",title:"\u7F16\u8F91\u5B58\u6863\u5185\u7684\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F",onClick:()=>void Ie("client-control-template")},"UI\u63A7\u4EF6-\u5BA2\u6237\u7AEF")),e("div",{className:"qxsim-pane-head"},e("div",{className:"qxsim-pane-title"},k?"\u6A21\u677F\u4E0E\u5B50\u63A7\u4EF6":"\u63A7\u4EF6\u6811"),e("span",{className:"qxsim-muted"},k?`${i.asset.templateCount} \u4E2A\u6A21\u677F \xB7 ${i.tree.length} \u4E2A\u63A7\u4EF6`:`${i.tree.length} \u4E2A\u8282\u70B9`)),e("label",{className:"qxsim-search"},"\u2315",e("input",{value:W,placeholder:k?"\u641C\u7D22\u6A21\u677F\u6216\u63A7\u4EF6":"\u641C\u7D22\u63A7\u4EF6",onChange:a=>de(a.target.value)}),W?e("button",{onClick:()=>de("")},"\xD7"):e("span",null,"\u2301")),e("div",{className:"qxsim-tree-scroll"},Oe.length?Oe.map(a=>{let r=M[a.kind]||["\u25C7",a.label],d=be.has(a.id),x=!!ce[a.id];return e("div",{key:a.id,className:`qxsim-row${k&&a.depth===0?" template-root":""}${a.id===i.selectedId?" active":""}${d?" canvas-hidden":""}`,style:{paddingLeft:8+a.depth*18,"--depth":a.depth},title:`${r[1]} \xB7 ${a.name} \xB7 GUID ${a.guid??a.id}`,onClick:()=>void N({op:"select",id:a.id}).catch(()=>{})},e("span",{className:"qxsim-chevron"},a.childCount?"\u25BC":""),e("span",{className:"qxsim-kind"},r[0]),e("span",{className:"qxsim-row-label"},a.name),e("span",{className:"qxsim-row-end"},k&&a.depth===0?e(u.Fragment,null,e("span",{className:"qxsim-template-tag"},"\u6A21\u677F"),e("span",{className:"qxsim-template-id"},`#${a.guid??a.id}`)):a.incomplete?e("span",{className:"qxsim-incomplete"},"\u6682\u4E0D\u652F\u6301"):null,e("button",{className:`qxsim-eye${x?" off":""}`,type:"button",title:x?"\u5728\u753B\u5E03\u4E0A\u663E\u793A\uFF08\u4E0D\u5F71\u54CD\u63A7\u4EF6\u521D\u59CB\u53EF\u89C1\u6027\uFF09":"\u5728\u753B\u5E03\u4E0A\u9690\u85CF\uFF08\u4E0D\u5F71\u54CD\u63A7\u4EF6\u521D\u59CB\u53EF\u89C1\u6027\uFF09","aria-label":`${a.name}\u753B\u5E03\u53EF\u89C1\u6027`,"aria-pressed":!x,onClick:F=>St(F,a.id)},x?"\u25CC":"\u25C9")))}):e("div",{className:"qxsim-empty"},"\u6CA1\u6709\u5339\u914D\u7684\u63A7\u4EF6")),e("div",{className:"qxsim-tree-foot"},k&&w?e("div",{className:"qxsim-hierarchy"},e("div",{className:"qxsim-hierarchy-head"},e("strong",null,"\u5C42\u7EA7\u4E0E\u6A21\u677F\u8FB9\u754C"),e("span",null,w.name)),e("div",{className:"qxsim-parent-row"},e("select",{"aria-label":"\u7236\u7EA7\u63A7\u4EF6",value:$t,onChange:a=>void N({op:"reparent",id:w.id,parentId:a.target.value}).then(()=>p(a.target.value===i.root.id?"\u5DF2\u63D0\u5347\u4E3A\u53EF\u5B9E\u4F8B\u5316\u9876\u5C42\u6A21\u677F":"\u5DF2\u8C03\u6574\u63A7\u4EF6\u7236\u7EA7")).catch(()=>{})},e("option",{value:i.root.id},"\u9876\u5C42\u6A21\u677F\uFF08\u53EF\u5B9E\u4F8B\u5316\uFF09"),Ct.map(a=>e("option",{key:a.id,value:a.id},`${"\u3000".repeat(a.depth)}${a.name}`))),e("button",{title:"\u5728\u540C\u7EA7\u4E2D\u4E0A\u79FB",disabled:w.siblingIndex<=0,onClick:()=>void N({op:"moveSibling",id:w.id,direction:"up"}).catch(()=>{})},"\u2191"),e("button",{title:"\u5728\u540C\u7EA7\u4E2D\u4E0B\u79FB",disabled:w.siblingIndex>=w.siblingCount-1,onClick:()=>void N({op:"moveSibling",id:w.id,direction:"down"}).catch(()=>{})},"\u2193")),e("div",{className:"qxsim-hierarchy-note"},w.depth===0?"\u8BE5\u8282\u70B9\u4F1A\u5199\u5165\u72EC\u7ACB UIControlTemplate\uFF0C\u53EF\u76F4\u63A5\u4F5C\u4E3A prefabId\u3002":`\u5F53\u524D\u4E3A\u7B2C ${w.depth} \u5C42\u5B50\u63A7\u4EF6\uFF0C\u4E0D\u4F1A\u5355\u72EC\u6210\u4E3A prefabId\u3002`)):null,e("div",{className:"qxsim-palette-head"},e("span",{title:k&&O==="template"?"\u65B0\u589E\u72EC\u7ACB\u53EF\u5B9E\u4F8B\u5316\u6A21\u677F":`\u6DFB\u52A0\u5230${w?w.name:"\u5F53\u524D\u63A7\u4EF6"}`},k&&O==="template"?"\u65B0\u589E\u9876\u5C42\u6A21\u677F":`\u6DFB\u52A0\u5230${w?`\u201C${w.name}\u201D`:"\u5F53\u524D\u63A7\u4EF6"}`),k?e("span",{className:"qxsim-add-mode"},e("button",{className:O==="template"?"active":"",onClick:()=>pe("template")},"\u9876\u5C42"),e("button",{className:O==="child"?"active":"",onClick:()=>pe("child")},"\u5B50\u63A7\u4EF6")):null),e("div",{className:"qxsim-add"},G.filter(([a])=>k||a!=="container").map(([a,r])=>e("button",{key:a,title:`${k&&O==="template"?"\u65B0\u589E":"\u6DFB\u52A0"}${r}`,onClick:()=>gt(a,r)},`\uFF0B ${r}`))))),e("main",{className:"qxsim-center"},e("div",{className:"qxsim-workspace",ref:Le},e("div",{className:"qxsim-stage-shell",style:{width:`${Math.max(40,Math.round(I*yt))}px`}},e("div",{className:"qxsim-stage-label"},e("b",null,k?"Lua \u6A21\u677F\u9884\u89C8":"\u754C\u9762\u63A7\u4EF6\u7EC4"),e("span",{className:"qxsim-platform-tag"},i.canvas.platform),e("span",null,`${Me} \xB7 ${I}\xD7${j} \xB7 \u5DE6\u4E0B\u539F\u70B9`)),e("div",{className:"qxsim-stage",style:{width:"100%",aspectRatio:`${I} / ${j}`},onClick:a=>{let r=a.currentTarget.getBoundingClientRect();N({op:"pick",x:(a.clientX-r.left)*I/r.width,y:(r.bottom-a.clientY)*j/r.height}).catch(()=>{})}},Nt.map(a=>it(a,i,I,j))))),m?e("div",{className:"qxsim-status error"},"\u26A0 ",m):e("div",{className:"qxsim-status"},e("span",null,`\u25CF ${i.asset?.label||"\u63A7\u4EF6"}\u7F16\u8F91`),e("span",null,b||(w?`\u5F53\u524D\uFF1A${w.name}`:"")),e("span",{className:"spacer"}),e("span",null,k?"GIA \u5BFC\u51FA\u540E\u53EF\u5728 Lua \u4E2D\u6309 prefabId \u5B9E\u4F8B\u5316":"\u5B57\u6BB5\u5728\u5931\u7126\u6216 Enter \u65F6\u63D0\u4EA4"))),e("aside",{className:"qxsim-inspector"},i.inspector?e(u.Fragment,null,e("div",{className:"qxsim-inspector-head"},e("div",{className:"qxsim-inspector-line"},e("span",{className:"qxsim-kind"},(M[i.inspector.kind]||["\u25C7"])[0]),e("strong",null,i.inspector.label),k&&w?.depth===0?e("span",{className:"qxsim-template-tag"},"\u53EF\u5B9E\u4F8B\u5316"):null),e("div",{className:"qxsim-node-id"},k&&w?.depth===0?"\u5BFC\u51FA prefabId ":"\u63A7\u4EF6 GUID ",e("code",null,i.inspector.guid??i.inspector.id)," \xB7 ",w?.name||"\u8282\u70B9",k&&w?.depth===0?e("small",null,"\uFF08\u771F\u5B9E\u7F16\u8F91\u5668\u5BFC\u5165\u540E\u53EF\u80FD\u91CD\u6620\u5C04\uFF09"):null)),e("div",{className:"qxsim-tabs",style:fe?void 0:{gridTemplateColumns:"1fr"}},e("button",{className:P==="base"?"active":"",onClick:()=>T("base")},"\u57FA\u7840\u5C5E\u6027"),fe?e("button",{className:P==="script"?"active":"",onClick:()=>T("script")},"\u811A\u672C"):null),e("div",{className:"qxsim-inspector-scroll"},fe&&P==="script"?e(et,{snap:i,addScriptMounted:a=>void Ee({controlId:a,controlAsset:i.asset?.type}).then(()=>H("script")),mountScriptTo:ut,unmountScript:xt,openScript:a=>{K(a),H("script")}}):e(He,{inspector:i.inspector,commit:lt,createStateChild:ct})),e("div",{className:"qxsim-tree-foot"},e("button",{className:"qxsim-action danger",style:{width:"100%"},onClick:()=>void N({op:"remove"}).catch(()=>{})},k&&w?.depth===0?"\u232B \u5220\u9664\u5F53\u524D\u6A21\u677F":"\u232B \u5220\u9664\u5F53\u524D\u63A7\u4EF6"))):e("div",{className:"qxsim-empty"},"\u8BF7\u9009\u62E9\u4E00\u4E2A\u63A7\u4EF6"))):C==="script"?e(Xe,{snap:i,selectedScriptId:me,selectScript:a=>{Te(),K(a)},draft:xe,updateDraft:dt,saveScript:()=>void te().then(()=>p("Lua \u811A\u672C\u5DF2\u4FDD\u5B58\u5230\u5F53\u524D\u5B58\u6863")).catch(()=>{}),addScript:()=>void Ee(),removeScript:mt,exportLua:a=>void ie("lua",a),exportScripts:()=>void ie("scripts"),exportScriptsGia:()=>void ie("scripts-gia"),notice:b}):e(Qe,{snap:i,draft:ze,setDraft:ue,saveLogic:()=>void ae().catch(()=>{}),notice:b,error:m}))}return{SimulatorView:nt,ensureStyle:Be,removeStyle:()=>document.getElementById(U)?.remove()}}window.__ModuleLoader__.load({id:"dsh-plugin-beyond-simulator",factory:u=>{let B={},ne=u("react"),D=je(ne,{async api(e,U,se){let M=await fetch("/qxqy-simulator/api/"+U,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:e,...se||{}})}),G=await M.json();if(!M.ok||!G.ok)throw new Error(G.error||"Request failed");return G.value},playUrl:e=>"/qxqy-simulator/play#"+encodeURIComponent(e)});return B.inject=["slots"],B.apply=e=>{D.ensureStyle(),e.effect(()=>D.removeStyle,"qxqy-simulator: style cleanup"),e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"qxqy-simulator",order:20,label:()=>"\u6A21\u62DF\u5668"},D.SimulatorView))},B}});})();