@weppy/roblox-mcp 2.17.9 → 2.17.11

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 (59) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +16 -5
  3. package/dashboard/dist/assets/{AiPromptExamples-BpV5YtwH.js → AiPromptExamples-DRAP_c3Y.js} +1 -1
  4. package/dashboard/dist/assets/{AssetsPage-CBkKW012.js → AssetsPage-DClT_Xq0.js} +1 -1
  5. package/dashboard/dist/assets/ChangelogPage-j9XKMICC.js +1 -0
  6. package/dashboard/dist/assets/{ConfirmModal-DD79xiWf.js → ConfirmModal-DQElh4mW.js} +1 -1
  7. package/dashboard/dist/assets/ConnectionPage-BStKoHK8.css +1 -0
  8. package/dashboard/dist/assets/ConnectionPage-ohHp3-EW.js +6 -0
  9. package/dashboard/dist/assets/{ControlsPage-BxQAO5lE.js → ControlsPage-DRq5gzh2.js} +1 -1
  10. package/dashboard/dist/assets/{GameChangeDetail-pof3XQ18.js → GameChangeDetail-DsbfZy27.js} +1 -1
  11. package/dashboard/dist/assets/InfoLabel-BA8vYJyT.js +1 -0
  12. package/dashboard/dist/assets/OverviewPage-CBHqpiuH.js +1 -0
  13. package/dashboard/dist/assets/{PageHeader-DUbueTLC.js → PageHeader-BdPmeEzS.js} +1 -1
  14. package/dashboard/dist/assets/{PlaceSelectOptions-KRG4cS5y.js → PlaceSelectOptions-CgwpeSx4.js} +1 -1
  15. package/dashboard/dist/assets/{PlaytestAiPromptExamples-BQ80VdK6.js → PlaytestAiPromptExamples-CfKnX7x5.js} +1 -1
  16. package/dashboard/dist/assets/{PlaytestPage-DNxnroWr.js → PlaytestPage-D5RqffbJ.js} +18 -23
  17. package/dashboard/dist/assets/{SettingsPage-3tKUev9_.js → SettingsPage-DsjksWTh.js} +1 -1
  18. package/dashboard/dist/assets/SyncPage-BIm9tW0s.css +1 -0
  19. package/dashboard/dist/assets/SyncPage-u4m65tCe.js +1 -0
  20. package/dashboard/dist/assets/Tabs-B_c28LwF.js +1 -0
  21. package/dashboard/dist/assets/{CurrentPlaceScope-B6NllTmu.css → Tabs-Ci4-OJm-.css} +1 -1
  22. package/dashboard/dist/assets/{TierPromoPanel-D_H_UgF4.js → TierPromoPanel-D0J8rNec.js} +1 -1
  23. package/dashboard/dist/assets/ToolsPage-sfWcLmtW.js +1 -0
  24. package/dashboard/dist/assets/TooltipText-BVB6IaqZ.js +1 -0
  25. package/dashboard/dist/assets/UiStudioPage-DUqrNkM_.js +11 -0
  26. package/dashboard/dist/assets/UiStudioPage-DmWjv22S.css +1 -0
  27. package/dashboard/dist/assets/{WhatsNewPage-D0l3SoZ9.js → WhatsNewPage-D24ekay9.js} +1 -1
  28. package/dashboard/dist/assets/{bot-DCwGDR4k.js → bot-B1wgPyai.js} +1 -1
  29. package/dashboard/dist/assets/{check-DBxi70_h.js → check-BOuMxlwX.js} +1 -1
  30. package/dashboard/dist/assets/{copy-bDdN4zua.js → copy-Cthw0Do5.js} +1 -1
  31. package/dashboard/dist/assets/index-D7BP0kl_.js +746 -0
  32. package/dashboard/dist/assets/rotate-ccw-DJdfoYVk.js +6 -0
  33. package/dashboard/dist/assets/sample-requests-Dg7Ej2AL.js +1 -0
  34. package/dashboard/dist/assets/{trash-2-BH7PRW92.js → trash-2-Cw9R346R.js} +1 -1
  35. package/dashboard/dist/assets/useLiveUptime-CITQ3ubd.js +1 -0
  36. package/dashboard/dist/assets/{useSettings-B8q8Cuch.js → useSettings-DrQYFCsj.js} +1 -1
  37. package/dashboard/dist/index.html +1 -1
  38. package/dist/index.js +399 -339
  39. package/package.json +1 -1
  40. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  41. package/dashboard/dist/assets/ChangelogPage-ChbHQhGx.js +0 -1
  42. package/dashboard/dist/assets/ConnectionPage-B3fGIK2X.css +0 -1
  43. package/dashboard/dist/assets/ConnectionPage-CywH0H2T.js +0 -6
  44. package/dashboard/dist/assets/CurrentPlaceScope-B0YLMs_a.js +0 -1
  45. package/dashboard/dist/assets/InfoLabel-CJVH3VF5.js +0 -1
  46. package/dashboard/dist/assets/OverviewPage-DStdjjf8.js +0 -1
  47. package/dashboard/dist/assets/StatusBadge-hrdvNb3-.js +0 -1
  48. package/dashboard/dist/assets/SyncPage-BgbrC3SP.css +0 -1
  49. package/dashboard/dist/assets/SyncPage-BtC4iYZE.js +0 -1
  50. package/dashboard/dist/assets/Tabs-CPTkUoYi.css +0 -1
  51. package/dashboard/dist/assets/Tabs-CXCAvK-b.js +0 -1
  52. package/dashboard/dist/assets/ToolsPage-SonaofpX.js +0 -1
  53. package/dashboard/dist/assets/TooltipText-CHM9zlD0.js +0 -1
  54. package/dashboard/dist/assets/UiStudioPage-CkHLBCN0.js +0 -11
  55. package/dashboard/dist/assets/UiStudioPage-CtSFtEbS.css +0 -1
  56. package/dashboard/dist/assets/index-MEBRUJOq.js +0 -714
  57. package/dashboard/dist/assets/sample-requests-DIskT9fc.js +0 -1
  58. package/dashboard/dist/assets/useLiveUptime-DtX2DhLL.js +0 -1
  59. /package/dashboard/dist/assets/{StatusBadge-C2zYt5iE.css → useLiveUptime-C2zYt5iE.css} +0 -0
@@ -1,69 +1,64 @@
1
- import{f as Ie,j as t,X as Vt,r as o,b as De,u as ue,D as zt,x as Wt,k as Jt,s as Yt,c as Qt,w as Xt,a as Zt,e as ea,d as ta,i as aa,T as sa}from"./index-MEBRUJOq.js";import{T as na}from"./TierPromoPanel-D_H_UgF4.js";import{P as ia,a as la}from"./PageHeader-DUbueTLC.js";import{I as ra}from"./InfoLabel-CJVH3VF5.js";import{C as oa}from"./CurrentPlaceScope-B0YLMs_a.js";import{T as it}from"./TooltipText-CHM9zlD0.js";import{C as mt}from"./ConfirmModal-DD79xiWf.js";import{T as ca,C as Ke}from"./Tabs-CXCAvK-b.js";import{P as jt}from"./PlaytestAiPromptExamples-BQ80VdK6.js";import{B as da}from"./bot-DCwGDR4k.js";import{T as St}from"./trash-2-BH7PRW92.js";import{C as ua}from"./check-DBxi70_h.js";import"./PlaceSelectOptions-KRG4cS5y.js";import"./ConfirmModal.module-DJksQHBd.js";import"./AiPromptExamples-BpV5YtwH.js";import"./copy-bDdN4zua.js";/**
1
+ import{f as Te,j as t,X as Vt,r as o,b as De,u as ue,D as zt,x as Wt,h as Jt,s as Yt,c as Qt,w as Xt,a as Zt,e as ea,d as ta,k as aa,T as sa}from"./index-D7BP0kl_.js";import{T as na}from"./TierPromoPanel-D0J8rNec.js";import{P as ia,a as la}from"./PageHeader-BdPmeEzS.js";import{I as ra}from"./InfoLabel-BA8vYJyT.js";import{T as oa,C as Ke,a as ca}from"./Tabs-B_c28LwF.js";import{T as it}from"./TooltipText-BVB6IaqZ.js";import{C as mt}from"./ConfirmModal-DQElh4mW.js";import{P as jt}from"./PlaytestAiPromptExamples-CfKnX7x5.js";import{B as da}from"./bot-B1wgPyai.js";import{R as ua}from"./rotate-ccw-DJdfoYVk.js";import{T as St}from"./trash-2-Cw9R346R.js";import{C as pa}from"./check-BOuMxlwX.js";import"./PlaceSelectOptions-CgwpeSx4.js";import"./ConfirmModal.module-DJksQHBd.js";import"./AiPromptExamples-DRAP_c3Y.js";import"./copy-Cthw0Do5.js";/**
2
2
  * @license lucide-react v1.8.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const pa=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fa=Ie("arrow-down",pa);/**
6
+ */const fa=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ma=Te("arrow-down",fa);/**
7
7
  * @license lucide-react v1.8.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const ma=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ha=Ie("arrow-up",ma);/**
11
+ */const ha=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ya=Te("arrow-up",ha);/**
12
12
  * @license lucide-react v1.8.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const ya=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ht=Ie("chevron-down",ya);/**
16
+ */const va=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ht=Te("chevron-down",va);/**
17
17
  * @license lucide-react v1.8.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const va=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wt=Ie("chevron-up",va);/**
21
+ */const ga=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wt=Te("chevron-up",ga);/**
22
22
  * @license lucide-react v1.8.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const ga=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],ba=Ie("circle-dot",ga);/**
26
+ */const ba=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],_a=Te("circle-dot",ba);/**
27
27
  * @license lucide-react v1.8.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const _a=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Nt=Ie("grip-vertical",_a);/**
31
+ */const xa=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Nt=Te("grip-vertical",xa);/**
32
32
  * @license lucide-react v1.8.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const xa=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],ja=Ie("list-plus",xa);/**
36
+ */const ja=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],Sa=Te("list-plus",ja);/**
37
37
  * @license lucide-react v1.8.0 - ISC
38
38
  *
39
39
  * This source code is licensed under the ISC license.
40
40
  * See the LICENSE file in the root directory of this source tree.
41
- */const Sa=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],wa=Ie("lock-keyhole",Sa);/**
41
+ */const wa=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],Na=Te("lock-keyhole",wa);/**
42
42
  * @license lucide-react v1.8.0 - ISC
43
43
  *
44
44
  * This source code is licensed under the ISC license.
45
45
  * See the LICENSE file in the root directory of this source tree.
46
- */const Na=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Ca=Ie("mouse-pointer-click",Na);/**
46
+ */const Ca=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Ra=Te("mouse-pointer-click",Ca);/**
47
47
  * @license lucide-react v1.8.0 - ISC
48
48
  *
49
49
  * This source code is licensed under the ISC license.
50
50
  * See the LICENSE file in the root directory of this source tree.
51
- */const Ra=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Pa=Ie("pencil",Ra);/**
51
+ */const Pa=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ka=Te("pencil",Pa);/**
52
52
  * @license lucide-react v1.8.0 - ISC
53
53
  *
54
54
  * This source code is licensed under the ISC license.
55
55
  * See the LICENSE file in the root directory of this source tree.
56
- */const ka=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ot=Ie("plus",ka);/**
56
+ */const Aa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ot=Te("plus",Aa);/**
57
57
  * @license lucide-react v1.8.0 - ISC
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const Aa=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Ea=Ie("rotate-ccw",Aa);/**
62
- * @license lucide-react v1.8.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const Da=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ia=Ie("triangle-alert",Da),Ta="_header_6e369_1",La="_copy_6e369_16",Ma="_close_6e369_39",rt={header:Ta,copy:La,close:Ma};function ze(e){return t.jsxs("header",{className:rt.header,children:[t.jsxs("div",{className:rt.copy,children:[t.jsx("h2",{children:e.title}),e.description&&t.jsx("p",{children:e.description})]}),t.jsx("button",{type:"button",className:rt.close,"aria-label":e.closeLabel,disabled:e.closeDisabled,onClick:e.onRequestClose,children:t.jsx(Vt,{size:18,"aria-hidden":"true"})})]})}const $a=5e3;function Ct(e){return typeof e=="number"?{placeId:String(e)}:void 0}function Va(e,a){return typeof a=="number"?`${e}?placeId=${encodeURIComponent(String(a))}`:e}function Oa(e){const a=e.context;return{...e,...typeof(a==null?void 0:a.contextId)=="string"?{contextId:a.contextId}:{},...a!=null&&a.contextSummary&&typeof a.contextSummary=="object"?{contextSummary:a.contextSummary}:{},...a!=null&&a.replayMetadata&&typeof a.replayMetadata=="object"?{replayMetadata:a.replayMetadata}:{}}}function Rt(e){return e instanceof Error?e.message:String(e)}function Ba(e){const a=(e==null?void 0:e.enabled)??!0,n=(e==null?void 0:e.placeId)??null,[i,d]=o.useState([]),[c,u]=o.useState(a?"loading":"idle"),[y,m]=o.useState(null),[_,C]=o.useState(null),[k,x]=o.useState(a),[f,V]=o.useState(!1),[R,M]=o.useState(null),w=o.useRef(null),B=o.useRef(0),P=o.useRef(null),E=o.useCallback(async()=>{try{const z=Ct(n),U=z?await De.get("/api/dashboard/playtest/history",z):await De.get("/api/dashboard/playtest/history");d(U.entries??[]),u("ready"),m(null)}catch(z){u("error"),m(Rt(z))}},[n]),W=o.useCallback(async()=>{if(!a){x(!1);return}await E(),x(!1)},[a,E]),$=o.useCallback(()=>{B.current+=1,P.current=null,C(null),V(!1),M(null)},[]);o.useEffect(()=>{$()},[$,a,n]);const ee=o.useCallback(async z=>{if(!a)return;P.current=z;const U=++B.current;C(null),V(!0),M(null);try{const L=Ct(n),ae=`/api/dashboard/playtest/detail/${encodeURIComponent(z)}`,J=L?await De.get(ae,L):await De.get(ae);U===B.current&&C(Oa(J))}catch(L){U===B.current&&M(Rt(L))}finally{U===B.current&&V(!1)}},[a,n]),te=o.useCallback(async()=>{const z=P.current;z&&await ee(z)},[ee]),q=o.useCallback(async()=>{a&&(u("loading"),m(null),await E())},[a,E]),O=o.useCallback(async()=>{a&&(await De.post(Va("/api/dashboard/playtest/history/clear",n)),d([]),u("ready"),m(null),$())},[$,a,n]);return o.useEffect(()=>{if(!a){x(!1),u("idle"),m(null);return}return u("loading"),m(null),W(),w.current=setInterval(W,$a),()=>{w.current&&clearInterval(w.current)}},[a,W]),{history:i,historyLoadState:c,historyError:y,selectedReport:_,loading:k,detailLoading:f,detailError:R,loadReport:ee,retryReport:te,retryHistory:q,clearSelectedReport:$,clearHistory:O}}function Fa(e){const a="2026-03-27T15:26:00.000Z",n={testScenario:e("playtest.sample.context.why","Spawn into the arena, survive the opener, and verify the HUD responds immediately."),expectedBehavior:e("playtest.sample.context.expected","The player spawns safely, the countdown UI appears within one second, and the first wave starts without errors."),observedBehavior:e("playtest.sample.context.observed","Spawn protection held, the HUD updated on time, and wave one completed with no gameplay regressions.")};return{history:[{recordId:"sample_playtest_preview",directoryName:"sample-playtest-preview",recordKind:"structured",timestamp:a,testName:e("playtest.sample.history.name","Sample Arena Smoke Test"),mode:"play",executionKind:"structured_session",overallStatus:"passed",status:"passed",durationMs:4820,contextId:"sample_playtest_preview",contextSummary:n,evidenceSummary:{server:{required:!0,status:"passed",stepIds:["wave-started"]},clientUi:{required:!0,status:"passed",stepIds:["hud-visible"]},interaction:{required:!0,status:"passed",provider:"virtual_input",stepIds:["start-click"]},visual:{required:!1,status:"not_requested",reason:"not_requested",stepIds:[]}},agentCounts:{server:1,client:1},limitation:{code:"play_screenshot_unsupported",message:e("playtest.sample.limit.visual","Play screenshot evidence is unavailable in structured session v1")}}],report:{recordId:"sample_playtest_preview",directoryName:"sample-playtest-preview",recordKind:"structured",markdown:e("playtest.sample.report.markdown",`# Sample Arena Smoke Test
61
+ */const Ea=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Da=Te("triangle-alert",Ea),Ia="_header_6e369_1",Ta="_copy_6e369_16",La="_close_6e369_39",rt={header:Ia,copy:Ta,close:La};function ze(e){return t.jsxs("header",{className:rt.header,children:[t.jsxs("div",{className:rt.copy,children:[t.jsx("h2",{children:e.title}),e.description&&t.jsx("p",{children:e.description})]}),t.jsx("button",{type:"button",className:rt.close,"aria-label":e.closeLabel,disabled:e.closeDisabled,onClick:e.onRequestClose,children:t.jsx(Vt,{size:18,"aria-hidden":"true"})})]})}const Ma=5e3;function Ct(e){return typeof e=="number"?{placeId:String(e)}:void 0}function $a(e,a){return typeof a=="number"?`${e}?placeId=${encodeURIComponent(String(a))}`:e}function Va(e){const a=e.context;return{...e,...typeof(a==null?void 0:a.contextId)=="string"?{contextId:a.contextId}:{},...a!=null&&a.contextSummary&&typeof a.contextSummary=="object"?{contextSummary:a.contextSummary}:{},...a!=null&&a.replayMetadata&&typeof a.replayMetadata=="object"?{replayMetadata:a.replayMetadata}:{}}}function Rt(e){return e instanceof Error?e.message:String(e)}function Oa(e){const a=(e==null?void 0:e.enabled)??!0,n=(e==null?void 0:e.placeId)??null,[i,d]=o.useState([]),[c,u]=o.useState(a?"loading":"idle"),[y,m]=o.useState(null),[_,C]=o.useState(null),[k,x]=o.useState(a),[f,V]=o.useState(!1),[R,M]=o.useState(null),w=o.useRef(null),B=o.useRef(0),P=o.useRef(null),E=o.useCallback(async()=>{try{const z=Ct(n),U=z?await De.get("/api/dashboard/playtest/history",z):await De.get("/api/dashboard/playtest/history");d(U.entries??[]),u("ready"),m(null)}catch(z){u("error"),m(Rt(z))}},[n]),W=o.useCallback(async()=>{if(!a){x(!1);return}await E(),x(!1)},[a,E]),$=o.useCallback(()=>{B.current+=1,P.current=null,C(null),V(!1),M(null)},[]);o.useEffect(()=>{$()},[$,a,n]);const ee=o.useCallback(async z=>{if(!a)return;P.current=z;const U=++B.current;C(null),V(!0),M(null);try{const L=Ct(n),ae=`/api/dashboard/playtest/detail/${encodeURIComponent(z)}`,J=L?await De.get(ae,L):await De.get(ae);U===B.current&&C(Va(J))}catch(L){U===B.current&&M(Rt(L))}finally{U===B.current&&V(!1)}},[a,n]),te=o.useCallback(async()=>{const z=P.current;z&&await ee(z)},[ee]),q=o.useCallback(async()=>{a&&(u("loading"),m(null),await E())},[a,E]),O=o.useCallback(async()=>{a&&(await De.post($a("/api/dashboard/playtest/history/clear",n)),d([]),u("ready"),m(null),$())},[$,a,n]);return o.useEffect(()=>{if(!a){x(!1),u("idle"),m(null);return}return u("loading"),m(null),W(),w.current=setInterval(W,Ma),()=>{w.current&&clearInterval(w.current)}},[a,W]),{history:i,historyLoadState:c,historyError:y,selectedReport:_,loading:k,detailLoading:f,detailError:R,loadReport:ee,retryReport:te,retryHistory:q,clearSelectedReport:$,clearHistory:O}}function Ba(e){const a="2026-03-27T15:26:00.000Z",n={testScenario:e("playtest.sample.context.why","Spawn into the arena, survive the opener, and verify the HUD responds immediately."),expectedBehavior:e("playtest.sample.context.expected","The player spawns safely, the countdown UI appears within one second, and the first wave starts without errors."),observedBehavior:e("playtest.sample.context.observed","Spawn protection held, the HUD updated on time, and wave one completed with no gameplay regressions.")};return{history:[{recordId:"sample_playtest_preview",directoryName:"sample-playtest-preview",recordKind:"structured",timestamp:a,testName:e("playtest.sample.history.name","Sample Arena Smoke Test"),mode:"play",executionKind:"structured_session",overallStatus:"passed",status:"passed",durationMs:4820,contextId:"sample_playtest_preview",contextSummary:n,evidenceSummary:{server:{required:!0,status:"passed",stepIds:["wave-started"]},clientUi:{required:!0,status:"passed",stepIds:["hud-visible"]},interaction:{required:!0,status:"passed",provider:"virtual_input",stepIds:["start-click"]},visual:{required:!1,status:"not_requested",reason:"not_requested",stepIds:[]}},agentCounts:{server:1,client:1},limitation:{code:"play_screenshot_unsupported",message:e("playtest.sample.limit.visual","Play screenshot evidence is unavailable in structured session v1")}}],report:{recordId:"sample_playtest_preview",directoryName:"sample-playtest-preview",recordKind:"structured",markdown:e("playtest.sample.report.markdown",`# Sample Arena Smoke Test
67
62
 
68
63
  - Spawn flow: PASS
69
64
  - HUD countdown: PASS
@@ -73,7 +68,7 @@ This is a sample preview. Live playtests and real reports are available with Pro
73
68
  [sample] spawn protection active
74
69
  [sample] hud countdown rendered
75
70
  [sample] wave one completed
76
- [sample] preview report finished`),contextId:"sample_playtest_preview",contextSummary:n,artifactErrors:[],result:{schemaVersion:1,sessionId:"sample-session",recordId:"sample_playtest_preview",testName:e("playtest.sample.history.name","Sample Arena Smoke Test"),executionKind:"structured_session",overallStatus:"passed",overallPassed:!0,terminalReason:{code:"all_required_evidence_passed",message:e("playtest.sample.terminal","All required evidence passed")},mode:"play",place:{placeName:e("playtest.sample.place","Sample Arena")},startedAt:a,endedAt:"2026-03-27T15:26:04.820Z",durationMs:4820,agents:[{agentId:"sample-server-agent",role:"server"},{agentId:"sample-client-agent",role:"client",clientId:"client-1"}],capabilities:{semanticUiSnapshot:!0,virtualInput:!0,fixedBootstrap:!0,projectTestAdapter:!1},requiredEvidence:{server:!0,clientUi:!0,interaction:!0,visual:!1},dimensions:{server:{required:!0,status:"passed",stepIds:["wave-started"]},clientUi:{required:!0,status:"passed",stepIds:["hud-visible"]},interaction:{required:!0,status:"passed",provider:"virtual_input",stepIds:["start-click"]},visual:{required:!1,status:"not_requested",reason:"not_requested",stepIds:[]}},limitations:[{code:"play_screenshot_unsupported",message:e("playtest.sample.limit.visual","Play screenshot evidence is unavailable in structured session v1")}],steps:[{index:0,stepId:"start-click",target:{role:"client",clientId:"client-1"},action:"input_click",dimension:"interaction",required:!0,status:"passed",startedAt:a,endedAt:"2026-03-27T15:26:00.120Z",durationMs:120,expected:{activated:!0},observed:{activated:!0},evidence:{delivery:"VirtualInput",observation:"GuiButton.Activated"}}],cleanup:{status:"passed",errors:[]},artifacts:{status:"complete",files:["test-result.json","test-report.md","test-log.txt","test-context.json"]}}}}}function Ve(e,a){switch(a){case"passed":return e("playtest.result.status.passed","Passed");case"failed":return e("playtest.result.status.failed","Failed");case"timed_out":return e("playtest.result.status.timedOut","Timed out");case"cancelled":return e("playtest.result.status.cancelled","Cancelled");case"insufficient_evidence":return e("playtest.result.status.insufficientEvidence","Insufficient evidence");case"unavailable":return e("playtest.result.status.unavailable","Unavailable");case"skipped":return e("playtest.result.status.skipped","Skipped");case"not_requested":return e("playtest.result.status.notRequested","Not requested");default:return e("playtest.result.status.unknown","Unknown")}}function gt(e){return e==="passed"?"✓":e==="failed"||e==="timed_out"?"×":e==="cancelled"||e==="insufficient_evidence"||e==="unavailable"?"!":"–"}function Bt(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function at(e){return JSON.stringify(e,null,2)}function Ft(e,a,n){return a==="play_screenshot_unsupported"?e("playtest.limitations.visualUnsupported","Visual evidence unavailable — Play screenshots are not supported in structured session v1."):a==="virtual_input_unavailable"?e("playtest.limitations.virtualInputUnavailable","Virtual input is unavailable for this session."):n}function Ga(e,a){return a==="play_screenshot_unsupported"?e("playtest.limitations.visualUnsupportedReason","Play screenshots are not supported in structured session v1."):a==="not_requested"?e("playtest.result.status.notRequested","Not requested"):a==="required_evidence_missing"?e("playtest.dimension.reason.missing","Required evidence is missing."):a==="required_capability_unavailable"?e("playtest.dimension.reason.capability","The required capability is unavailable."):a}const qa="_page_14ipf_2",Ha="_sampleBanner_14ipf_10",Ua="_sampleBannerRow_14ipf_22",Ka="_sampleBannerMain_14ipf_29",za="_sampleBadge_14ipf_36",Wa="_sampleTitle_14ipf_51",Ja="_sampleMessage_14ipf_58",Ya="_sampleActions_14ipf_65",Qa="_primaryAction_14ipf_73",Xa="_secondaryAction_14ipf_74",Za="_resetAction_14ipf_75",es="_card_14ipf_124",ts="_cardHeader_14ipf_131",as="_clearButton_14ipf_144",ss="_statusRow_14ipf_173",ns="_statusIndicator_14ipf_180",is="_statusRunning_14ipf_188",ls="_statusPaused_14ipf_193",rs="_statusNotRunning_14ipf_197",os="_statusLabel_14ipf_201",cs="_statusMeta_14ipf_208",ds="_controlButtons_14ipf_214",us="_btn_14ipf_221",ps="_btnPrimary_14ipf_243",fs="_btnDanger_14ipf_253",ms="_historyList_14ipf_265",hs="_historyItem_14ipf_271",ys="_stepDisclosure_14ipf_291",vs="_historyItemSelected_14ipf_296",gs="_historyItemHeader_14ipf_301",bs="_historyIcon_14ipf_307",_s="_historyTimestamp_14ipf_312",xs="_historyName_14ipf_319",js="_recordKind_14ipf_330",Ss="_historyItemMeta_14ipf_344",ws="_historyMode_14ipf_354",Ns="_historyDuration_14ipf_358",Cs="_historyStatus_14ipf_362",Rs="_status_passed_14ipf_369",Ps="_status_failed_14ipf_373",ks="_status_running_14ipf_377",As="_status_timed_out_14ipf_381",Es="_status_cancelled_14ipf_385",Ds="_status_insufficient_evidence_14ipf_386",Is="_historyError_14ipf_390",Ts="_historyEvidence_14ipf_400",Ls="_historyLimitation_14ipf_410",Ms="_detailShell_14ipf_421",$s="_detailHeader_14ipf_429",Vs="_detailHeading_14ipf_440",Os="_detailRecordName_14ipf_451",Bs="_detailCloseButton_14ipf_460",Fs="_detailRetryButton_14ipf_480",Gs="_detailBody_14ipf_485",qs="_detailState_14ipf_494",Hs="_detailErrorTitle_14ipf_505",Us="_detailErrorMessage_14ipf_512",Ks="_reportContainer_14ipf_534",zs="_runSummary_14ipf_540",Ws="_viewerSection_14ipf_541",Js="_summaryLead_14ipf_554",Ys="_summaryStatusMark_14ipf_560",Qs="_viewerHeading_14ipf_573",Xs="_summaryName_14ipf_583",Zs="_summaryReason_14ipf_594",en="_summaryFacts_14ipf_601",tn="_subsectionLabel_14ipf_614",an="_sectionHeadingRow_14ipf_629",sn="_sectionHint_14ipf_637",nn="_dimensionGrid_14ipf_642",ln="_dimensionCard_14ipf_649",rn="_dimensionHeader_14ipf_657",on="_statusMark_14ipf_663",cn="_dimensionName_14ipf_676",dn="_requirementBadge_14ipf_686",un="_dimensionStatus_14ipf_694",pn="_dimensionMeta_14ipf_701",fn="_tone_passed_14ipf_709",mn="_tone_failed_14ipf_710",hn="_tone_timed_out_14ipf_711",yn="_tone_cancelled_14ipf_712",vn="_tone_insufficient_evidence_14ipf_713",gn="_tone_unavailable_14ipf_714",bn="_tone_skipped_14ipf_715",_n="_tone_not_requested_14ipf_716",xn="_stepList_14ipf_718",jn="_stepItem_14ipf_725",Sn="_stepIndex_14ipf_749",wn="_stepIdentity_14ipf_756",Nn="_stepName_14ipf_763",Cn="_stepMeta_14ipf_773",Rn="_stepStatus_14ipf_774",Pn="_chevron_14ipf_782",kn="_chevronOpen_14ipf_788",An="_stepDetails_14ipf_790",En="_evidenceBlock_14ipf_799",Dn="_evidenceLabel_14ipf_803",In="_stepError_14ipf_830",Tn="_recordProblem_14ipf_831",Ln="_capabilityGrid_14ipf_846",Mn="_capabilityItem_14ipf_853",$n="_capabilityYes_14ipf_866",Vn="_capabilityNo_14ipf_867",On="_capabilityState_14ipf_868",Bn="_limitations_14ipf_870",Fn="_artifactList_14ipf_871",Gn="_agentList_14ipf_872",qn="_artifactDisclosures_14ipf_889",Hn="_artifactDisclosure_14ipf_889",Un="_artifactButton_14ipf_903",Kn="_artifactContent_14ipf_928",zn="_limitationItem_14ipf_948",Wn="_reportContextPanel_14ipf_965",Jn="_reportContextRow_14ipf_975",Yn="_reportContextLabel_14ipf_983",Qn="_reportSection_14ipf_991",Xn="_reportSectionHeader_14ipf_997",Zn="_reportMarkdown_14ipf_1009",ei="_reportLogs_14ipf_1022",ti="_emptyState_14ipf_1037",ai="_emptyStateTitle_14ipf_1044",si="_emptyStateMessage_14ipf_1052",ni="_upgradePanel_14ipf_1061",ii="_upgradePanelIcon_14ipf_1069",li="_upgradePanelTitle_14ipf_1074",ri="_upgradePanelDesc_14ipf_1082",oi="_benefitList_14ipf_1092",ci="_benefitItem_14ipf_1103",di="_upgradeActions_14ipf_1118",ui="_workspaceTabs_14ipf_1124",pi="_sessionHelp_14ipf_1137",fi="_stopAction_14ipf_1143",mi="_controlEditor_14ipf_1144",hi="_profileToolbar_14ipf_1146",yi="_profileDialog_14ipf_1147",vi="_sessionBar_14ipf_1152",gi="_sessionIdentity_14ipf_1165",bi="_sessionActions_14ipf_1195",_i="_profileActions_14ipf_1196",xi="_profileDialogActions_14ipf_1197",ji="_liveWorkspace_14ipf_1238",Si="_profileLabelRow_14ipf_1254",wi="_profileHint_14ipf_1262",Ni="_actualValue_14ipf_1271",Ci="_watchReading_14ipf_1272",Ri="_liveGrid_14ipf_1308",Pi="_livePanel_14ipf_1315",ki="_panelEmpty_14ipf_1352",Ai="_controlAvailability_14ipf_1358",Ei="_controlGate_14ipf_1361",Di="_controlGateTrigger_14ipf_1364",Ii="_controlGateHint_14ipf_1366",Ti="_editorLabel_14ipf_1367",Li="_editorHeading_14ipf_1368",Mi="_savedValueState_14ipf_1369",$i="_valueToolbar_14ipf_1373",Vi="_valueFilters_14ipf_1383",Oi="_valuePagination_14ipf_1390",Bi="_valueListStatus_14ipf_1391",Fi="_valueCount_14ipf_1392",Gi="_layoutHint_14ipf_1394",qi="_srOnly_14ipf_1395",Hi="_unifiedValueRows_14ipf_1396",Ui="_liveRows_14ipf_1397",Ki="_watchRows_14ipf_1397",zi="_valueGroup_14ipf_1398",Wi="_valueGroupToggle_14ipf_1400",Ji="_valueGroupRows_14ipf_1406",Yi="_controlRow_14ipf_1406",Qi="_watchRow_14ipf_1397",Xi="_actionRow_14ipf_1408",Zi="_historyBrowser_14ipf_1412",el="_historyToolbar_14ipf_1413",tl="_rowIdentity_14ipf_1437",al="_freshness_14ipf_1440",sl="_presentationMeta_14ipf_1461",nl="_rowFeedback_14ipf_1462",il="_controlEditorRow_14ipf_1468",ll="_controlActions_14ipf_1469",rl="_applyOnStartOption_14ipf_1472",ol="_valueDetails_14ipf_1474",cl="_valueDetailButton_14ipf_1480",dl="_valueDetailShell_14ipf_1483",ul="_valueDetailBody_14ipf_1484",pl="_valueDetailList_14ipf_1485",fl="_valueDetailActions_14ipf_1489",ml="_valueDetailFeedback_14ipf_1490",hl="_defaultValueEditor_14ipf_1493",yl="_defaultBooleanEditor_14ipf_1497",vl="_booleanEditor_14ipf_1500",gl="_rangeEditor_14ipf_1509",bl="_valueWorkspacePanel_14ipf_1524",_l="_valueWorkspaceHeader_14ipf_1525",xl="_valueSections_14ipf_1526",jl="_valueSection_14ipf_1526",Sl="_valueSectionHeader_14ipf_1528",wl="_valueSectionHeading_14ipf_1529",Nl="_valueSectionCount_14ipf_1531",Cl="_valueSectionHeaderActions_14ipf_1532",Rl="_sectionDragHandle_14ipf_1533",Pl="_sectionMoveButton_14ipf_1534",kl="_valueReorderControls_14ipf_1535",Al="_dragHandle_14ipf_1537",El="_runtimeSettings_14ipf_1549",Dl="_runtimeSettingSwitch_14ipf_1550",Il="_runtimeSettingSwitchInput_14ipf_1553",Tl="_runtimeSettingSwitchTrack_14ipf_1554",Ll="_runtimeSettingSwitchThumb_14ipf_1555",Ml="_layoutError_14ipf_1559",$l="_controlValueList_14ipf_1560",Vl="_watchValueGrid_14ipf_1561",Ol="_actionValueList_14ipf_1562",Bl="_valueEntryShell_14ipf_1563",Fl="_watchCardMain_14ipf_1576",Gl="_watchDetails_14ipf_1583",ql="_actionSummary_14ipf_1592",Hl="_actionExecution_14ipf_1592",Ul="_actionParameter_14ipf_1593",Kl="_actionInactiveReason_14ipf_1597",zl="_actionParameterGrid_14ipf_1602",Wl="_actionParameterError_14ipf_1608",Jl="_deploymentGuide_14ipf_1634",Yl="_deploymentScope_14ipf_1646",Ql="_deploymentLifecycle_14ipf_1649",Xl="_deploymentNotice_14ipf_1650",Zl="_deploymentChecklist_14ipf_1652",er="_deploymentDescription_14ipf_1656",tr="_deploymentDetails_14ipf_1659",ar="_inlineError_14ipf_1679",sr="_profileEditorDialog_14ipf_1682",nr="_profileDialogBody_14ipf_1683",ir="_profileDeleteAction_14ipf_1686",lr="_profileDeleteReason_14ipf_1687",rr="_bindingTabs_14ipf_1688",or="_bindingList_14ipf_1692",cr="_bindingEmpty_14ipf_1693",dr="_bindingItem_14ipf_1694",ur="_bindingItemCopy_14ipf_1699",pr="_bindingPresentation_14ipf_1700",fr="_bindingPin_14ipf_1703",mr="_bindingItemActions_14ipf_1705",hr="_bindingDelete_14ipf_1709",yr="_addBindingButton_14ipf_1711",vr="_bindingForm_14ipf_1712",gr="_bindingFormGrid_14ipf_1713",br="_bindingBooleanDefault_14ipf_1716",_r="_bindingPathField_14ipf_1718",xr="_rangeFields_14ipf_1719",jr="_selectionButton_14ipf_1720",Sr="_bindingFormActions_14ipf_1721",wr="_bindingError_14ipf_1722",Nr="_valueManagerShell_14ipf_1723",Cr="_valueSourceTabs_14ipf_1724",Rr="_valueManagerBody_14ipf_1728",Pr="_valueSourcePanel_14ipf_1729",kr="_registeredIntro_14ipf_1730",Ar="_registeredEmpty_14ipf_1734",Er="_registeredSteps_14ipf_1737",Dr="_registeredEmptyActions_14ipf_1740",Ir="_adapterSetupList_14ipf_1745",Tr="_adapterSetupRow_14ipf_1749",Lr="_adapterMethods_14ipf_1756",Mr="_connectionGuide_14ipf_1757",$r="_registrationGuide_14ipf_1760",Vr="_adapterSetupContext_14ipf_1761",Or="_valueSearch_14ipf_1762",Br="_firstProfileName_14ipf_1763",Fr="_sourceIntro_14ipf_1767",Gr="_catalogGroups_14ipf_1771",qr="_catalogRow_14ipf_1772",Hr="_candidateActions_14ipf_1780",Ur="_candidateEntry_14ipf_1782",Kr="_propertySelection_14ipf_1783",zr="_propertySelectionHeader_14ipf_1784",Wr="_selectedInstance_14ipf_1785",Jr="_propertyPickerLabel_14ipf_1786",Yr="_propertyPicker_14ipf_1786",Qr="_propertyPickerTrigger_14ipf_1792",Xr="_propertyPickerPanel_14ipf_1794",Zr="_propertyPickerSearchRow_14ipf_1796",eo="_propertyPickerList_14ipf_1800",to="_propertyPickerGroup_14ipf_1802",ao="_propertyPickerOption_14ipf_1805",so="_compoundEditor_14ipf_1811",no="_compoundCoordinates_14ipf_1812",io="_colorSwatch_14ipf_1819",lo="_candidateAction_14ipf_1780",ro="_candidateActionSizer_14ipf_1836",oo="_candidateError_14ipf_1840",co="_valueManagerFooter_14ipf_1842",uo="_catalogDetails_14ipf_1843",po="_inlineNotice_14ipf_1852",fo="_subscriptionUsage_14ipf_1853",mo="_pendingProfileAction_14ipf_1854",ho="_registrationExample_14ipf_1859",yo="_registrationActions_14ipf_1862",s={page:qa,sampleBanner:Ha,sampleBannerRow:Ua,sampleBannerMain:Ka,sampleBadge:za,sampleTitle:Wa,sampleMessage:Ja,sampleActions:Ya,primaryAction:Qa,secondaryAction:Xa,resetAction:Za,card:es,cardHeader:ts,clearButton:as,statusRow:ss,statusIndicator:ns,statusRunning:is,statusPaused:ls,statusNotRunning:rs,statusLabel:os,statusMeta:cs,controlButtons:ds,btn:us,btnPrimary:ps,btnDanger:fs,historyList:ms,historyItem:hs,stepDisclosure:ys,historyItemSelected:vs,historyItemHeader:gs,historyIcon:bs,historyTimestamp:_s,historyName:xs,recordKind:js,historyItemMeta:Ss,historyMode:ws,historyDuration:Ns,historyStatus:Cs,status_passed:Rs,status_failed:Ps,status_running:ks,status_timed_out:As,status_cancelled:Es,status_insufficient_evidence:Ds,historyError:Is,historyEvidence:Ts,historyLimitation:Ls,detailShell:Ms,detailHeader:$s,detailHeading:Vs,detailRecordName:Os,detailCloseButton:Bs,detailRetryButton:Fs,detailBody:Gs,detailState:qs,detailErrorTitle:Hs,detailErrorMessage:Us,reportContainer:Ks,runSummary:zs,viewerSection:Ws,summaryLead:Js,summaryStatusMark:Ys,viewerHeading:Qs,summaryName:Xs,summaryReason:Zs,summaryFacts:en,subsectionLabel:tn,sectionHeadingRow:an,sectionHint:sn,dimensionGrid:nn,dimensionCard:ln,dimensionHeader:rn,statusMark:on,dimensionName:cn,requirementBadge:dn,dimensionStatus:un,dimensionMeta:pn,tone_passed:fn,tone_failed:mn,tone_timed_out:hn,tone_cancelled:yn,tone_insufficient_evidence:vn,tone_unavailable:gn,tone_skipped:bn,tone_not_requested:_n,stepList:xn,stepItem:jn,stepIndex:Sn,stepIdentity:wn,stepName:Nn,stepMeta:Cn,stepStatus:Rn,chevron:Pn,chevronOpen:kn,stepDetails:An,evidenceBlock:En,evidenceLabel:Dn,stepError:In,recordProblem:Tn,capabilityGrid:Ln,capabilityItem:Mn,capabilityYes:$n,capabilityNo:Vn,capabilityState:On,limitations:Bn,artifactList:Fn,agentList:Gn,artifactDisclosures:qn,artifactDisclosure:Hn,artifactButton:Un,artifactContent:Kn,limitationItem:zn,reportContextPanel:Wn,reportContextRow:Jn,reportContextLabel:Yn,reportSection:Qn,reportSectionHeader:Xn,reportMarkdown:Zn,reportLogs:ei,emptyState:ti,emptyStateTitle:ai,emptyStateMessage:si,upgradePanel:ni,upgradePanelIcon:ii,upgradePanelTitle:li,upgradePanelDesc:ri,benefitList:oi,benefitItem:ci,upgradeActions:di,workspaceTabs:ui,sessionHelp:pi,stopAction:fi,controlEditor:mi,profileToolbar:hi,profileDialog:yi,sessionBar:vi,sessionIdentity:gi,sessionActions:bi,profileActions:_i,profileDialogActions:xi,liveWorkspace:ji,profileLabelRow:Si,profileHint:wi,actualValue:Ni,watchReading:Ci,liveGrid:Ri,livePanel:Pi,panelEmpty:ki,controlAvailability:Ai,controlGate:Ei,controlGateTrigger:Di,controlGateHint:Ii,editorLabel:Ti,editorHeading:Li,savedValueState:Mi,valueToolbar:$i,valueFilters:Vi,valuePagination:Oi,valueListStatus:Bi,valueCount:Fi,layoutHint:Gi,srOnly:qi,unifiedValueRows:Hi,liveRows:Ui,watchRows:Ki,valueGroup:zi,valueGroupToggle:Wi,valueGroupRows:Ji,controlRow:Yi,watchRow:Qi,actionRow:Xi,historyBrowser:Zi,historyToolbar:el,rowIdentity:tl,freshness:al,presentationMeta:sl,rowFeedback:nl,controlEditorRow:il,controlActions:ll,applyOnStartOption:rl,valueDetails:ol,valueDetailButton:cl,valueDetailShell:dl,valueDetailBody:ul,valueDetailList:pl,valueDetailActions:fl,valueDetailFeedback:ml,defaultValueEditor:hl,defaultBooleanEditor:yl,booleanEditor:vl,rangeEditor:gl,valueWorkspacePanel:bl,valueWorkspaceHeader:_l,valueSections:xl,valueSection:jl,valueSectionHeader:Sl,valueSectionHeading:wl,valueSectionCount:Nl,valueSectionHeaderActions:Cl,sectionDragHandle:Rl,sectionMoveButton:Pl,valueReorderControls:kl,dragHandle:Al,runtimeSettings:El,runtimeSettingSwitch:Dl,runtimeSettingSwitchInput:Il,runtimeSettingSwitchTrack:Tl,runtimeSettingSwitchThumb:Ll,layoutError:Ml,controlValueList:$l,watchValueGrid:Vl,actionValueList:Ol,valueEntryShell:Bl,watchCardMain:Fl,watchDetails:Gl,actionSummary:ql,actionExecution:Hl,actionParameter:Ul,actionInactiveReason:Kl,actionParameterGrid:zl,actionParameterError:Wl,deploymentGuide:Jl,deploymentScope:Yl,deploymentLifecycle:Ql,deploymentNotice:Xl,deploymentChecklist:Zl,deploymentDescription:er,deploymentDetails:tr,inlineError:ar,profileEditorDialog:sr,profileDialogBody:nr,profileDeleteAction:ir,profileDeleteReason:lr,bindingTabs:rr,bindingList:or,bindingEmpty:cr,bindingItem:dr,bindingItemCopy:ur,bindingPresentation:pr,bindingPin:fr,bindingItemActions:mr,bindingDelete:hr,addBindingButton:yr,bindingForm:vr,bindingFormGrid:gr,bindingBooleanDefault:br,bindingPathField:_r,rangeFields:xr,selectionButton:jr,bindingFormActions:Sr,bindingError:wr,valueManagerShell:Nr,valueSourceTabs:Cr,valueManagerBody:Rr,valueSourcePanel:Pr,registeredIntro:kr,registeredEmpty:Ar,registeredSteps:Er,registeredEmptyActions:Dr,adapterSetupList:Ir,adapterSetupRow:Tr,adapterMethods:Lr,connectionGuide:Mr,registrationGuide:$r,adapterSetupContext:Vr,valueSearch:Or,firstProfileName:Br,sourceIntro:Fr,catalogGroups:Gr,catalogRow:qr,candidateActions:Hr,candidateEntry:Ur,propertySelection:Kr,propertySelectionHeader:zr,selectedInstance:Wr,propertyPickerLabel:Jr,propertyPicker:Yr,propertyPickerTrigger:Qr,propertyPickerPanel:Xr,propertyPickerSearchRow:Zr,propertyPickerList:eo,propertyPickerGroup:to,propertyPickerOption:ao,compoundEditor:so,compoundCoordinates:no,colorSwatch:io,candidateAction:lo,candidateActionSizer:ro,candidateError:oo,valueManagerFooter:co,catalogDetails:uo,inlineNotice:po,subscriptionUsage:fo,pendingProfileAction:mo,registrationExample:ho,registrationActions:yo};function We(e){return e.trim().toLowerCase()}function vo(e){switch(We(e)){case"passed":return"✓";case"failed":case"timed_out":return"×";case"running":return"◔";case"cancelled":case"insufficient_evidence":return"!";default:return"–"}}function go(e,a){switch(We(a)){case"run":return e("playtest.status.mode.run","Run");case"server":return e("playtest.status.mode.server","Server");case"edit":return e("playtest.status.mode.edit","Edit");case"play":return e("playtest.status.mode.play","Play");default:return a}}function bo(e,a){const n=We(a);return n==="running"?e("playtest.history.status.running","Running"):Ve(e,n)}function _o(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function xo(e){const a=/^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})$/.exec(e);if(a){const[,i,d,c,u,y,m]=a,_=new Date(Date.UTC(Number(i),Number(d)-1,Number(c),Number(u),Number(y),Number(m)));return _.getUTCFullYear()===Number(i)&&_.getUTCMonth()===Number(d)-1&&_.getUTCDate()===Number(c)&&_.getUTCHours()===Number(u)&&_.getUTCMinutes()===Number(y)&&_.getUTCSeconds()===Number(m)?_:null}const n=Date.parse(e);return Number.isNaN(n)?null:new Date(n)}function jo(e,a){const n=xo(e);return n?new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"short"}).format(n):e}function So({entries:e,onSelect:a,selectedRecordId:n}){const{t:i,locale:d}=ue(),[c,u]=o.useState(""),[y,m]=o.useState("all"),[_,C]=o.useState(0),k=o.useMemo(()=>{const R=c.trim().toLocaleLowerCase();return e.filter(M=>(y==="all"||We(M.status)===y)&&(!R||[M.testName,M.status,M.mode,M.recordKind].join(" ").toLocaleLowerCase().includes(R)))},[e,c,y]),x=Math.max(1,Math.ceil(k.length/50)),f=Math.min(_,x-1),V=k.slice(f*50,(f+1)*50);return e.length===0?t.jsx("div",{className:s.emptyState,children:i("playtest.history.empty","No test results yet")}):t.jsxs("div",{className:s.historyBrowser,children:[t.jsxs("div",{className:s.historyToolbar,children:[t.jsxs("label",{children:[t.jsx("span",{children:i("playtest.history.search","Search test results")}),t.jsx("input",{type:"search",value:c,onChange:R=>{u(R.target.value),C(0)}})]}),t.jsxs("label",{children:[t.jsx("span",{children:i("playtest.history.filter","Result")}),t.jsxs("select",{value:y,onChange:R=>{m(R.target.value),C(0)},children:[t.jsx("option",{value:"all",children:i("playtest.history.filterAll","All results")}),t.jsx("option",{value:"passed",children:i("playtest.result.status.passed","Passed")}),t.jsx("option",{value:"failed",children:i("playtest.result.status.failed","Failed")}),t.jsx("option",{value:"insufficient_evidence",children:i("playtest.result.status.insufficientEvidence","Insufficient evidence")}),t.jsx("option",{value:"timed_out",children:i("playtest.result.status.timedOut","Timed out")})]})]})]}),t.jsx("div",{className:s.valueCount,role:"status",children:i("playtest.history.filteredCount","{{visible}} of {{total}} results").replace("{{visible}}",String(k.length)).replace("{{total}}",String(e.length))}),t.jsx("div",{className:s.historyList,children:V.map(R=>{const M=R.recordId===n;return t.jsxs("button",{className:`${s.historyItem} ${M?s.historyItemSelected:""}`,onClick:w=>a(R.recordId,w.currentTarget),"aria-current":M?"true":void 0,"aria-haspopup":"dialog",children:[t.jsxs("div",{className:s.historyItemHeader,children:[t.jsx("span",{className:s.historyIcon,children:vo(R.status)}),t.jsx("span",{className:s.historyTimestamp,children:jo(R.timestamp,d)}),t.jsx("span",{className:s.historyName,children:R.testName}),t.jsx("span",{className:s.recordKind,children:R.recordKind==="structured"?i("playtest.history.kind.structured","Structured"):R.recordKind==="legacy"?i("playtest.history.kind.legacy","Legacy"):i("playtest.history.kind.attention","Needs attention")})]}),t.jsxs("div",{className:s.historyItemMeta,children:[t.jsx(it,{text:i("playtest.history.mode.tooltip","Playtest mode used for this recorded test run."),children:t.jsxs("span",{className:s.historyMode,children:[i("playtest.history.mode","Mode"),": ",go(i,R.mode)]})}),t.jsx("span",{className:s.historyDuration,children:_o(R.durationMs)}),t.jsx(it,{text:i("playtest.history.status.tooltip","Recorded result state for this automated playtest run."),children:t.jsx("span",{className:`${s.historyStatus} ${s[`status_${We(R.status)}`]??""}`,children:bo(i,R.status)})})]}),R.evidenceSummary&&t.jsxs("div",{className:s.historyEvidence,children:[t.jsxs("span",{children:[i("playtest.dimension.server","Server"),": ",Ve(i,R.evidenceSummary.server.status)]}),t.jsxs("span",{children:[i("playtest.dimension.clientUi","Client UI"),": ",Ve(i,R.evidenceSummary.clientUi.status)]}),R.agentCounts&&t.jsx("span",{children:i("playtest.history.agentCounts","Server {server} · Client {client}").replace("{server}",String(R.agentCounts.server)).replace("{client}",String(R.agentCounts.client))})]}),R.errorMessage&&t.jsx("div",{className:s.historyError,children:R.errorMessage}),!R.errorMessage&&R.limitation&&t.jsx("div",{className:s.historyLimitation,children:Ft(i,R.limitation.code,R.limitation.message)})]},R.recordId)})}),x>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:f===0,onClick:()=>C(R=>R-1),children:i("playtest.values.previous","Previous")}),t.jsxs("span",{children:[f+1," / ",x]}),t.jsx("button",{type:"button",disabled:f+1>=x,onClick:()=>C(R=>R+1),children:i("playtest.values.next","Next")})]})]})}function ot({label:e,open:a,onToggle:n,children:i,tooltip:d}){const c=o.useId();return t.jsxs("div",{className:s.artifactDisclosure,children:[t.jsxs("button",{className:s.artifactButton,onClick:n,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n())},"aria-expanded":a,"aria-controls":c,children:[d?t.jsx(it,{text:d,children:t.jsx("span",{children:e})}):t.jsx("span",{children:e}),t.jsx("span",{"aria-hidden":"true",className:`${s.chevron} ${a?s.chevronOpen:""}`,children:"⌄"})]}),a&&t.jsx("div",{className:s.artifactContent,id:c,children:i})]})}function wo({detail:e}){const{t:a}=ue(),[n,i]=o.useState(()=>new Set(e.recordKind==="legacy"?["report","logs"]:[])),d=y=>i(m=>{const _=new Set(m);return _.has(y)?_.delete(y):_.add(y),_}),c=e.result?{schemaVersion:e.result.schemaVersion,sessionId:e.result.sessionId,recordId:e.result.recordId,startedAt:e.result.startedAt,endedAt:e.result.endedAt,files:e.result.artifacts.files}:null,u=e.artifactErrors??[];return!c&&!e.markdown&&!e.logs&&u.length===0?null:t.jsxs("section",{className:s.viewerSection,"aria-labelledby":"playtest-artifacts-heading",children:[t.jsx("h3",{id:"playtest-artifacts-heading",className:s.viewerHeading,children:a("playtest.artifacts.title","Artifacts")}),t.jsxs("div",{className:s.artifactDisclosures,children:[c&&t.jsx(ot,{label:a("playtest.artifacts.metadata","Result metadata"),open:n.has("metadata"),onToggle:()=>d("metadata"),children:t.jsx("pre",{children:at(c)})}),e.markdown&&t.jsx(ot,{label:a("playtest.report.content","Report"),tooltip:a("playtest.report.content.tooltip","Markdown summary for the selected automated playtest run."),open:n.has("report"),onToggle:()=>d("report"),children:t.jsx("pre",{children:e.markdown})}),e.logs&&t.jsx(ot,{label:a("playtest.report.logs","Logs"),tooltip:a("playtest.report.logs.tooltip","Execution logs captured for the selected automated playtest run."),open:n.has("logs"),onToggle:()=>d("logs"),children:t.jsx("pre",{children:e.logs})})]}),u.map(y=>t.jsx("div",{className:s.stepError,children:y.message},`${y.code}-${y.message}`))]})}function No({result:e}){const{t:a}=ue(),n=[[a("playtest.capability.semanticUi","Semantic UI snapshot"),e.capabilities.semanticUiSnapshot],[a("playtest.capability.virtualInput","Virtual input"),e.capabilities.virtualInput],[a("playtest.capability.fixedBootstrap","Fixed agent bootstrap"),e.capabilities.fixedBootstrap],[a("playtest.capability.projectAdapter","Project test adapter"),e.capabilities.projectTestAdapter]];return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":"playtest-capabilities-heading",children:[t.jsx("h3",{id:"playtest-capabilities-heading",className:s.viewerHeading,children:a("playtest.capability.title","Capabilities and limits")}),t.jsx("div",{className:s.capabilityGrid,children:n.map(([i,d])=>t.jsxs("div",{className:s.capabilityItem,children:[t.jsx("span",{className:d?s.capabilityYes:s.capabilityNo,"aria-hidden":"true",children:d?"✓":"–"}),t.jsx("span",{children:i}),t.jsx("span",{className:s.capabilityState,children:d?a("playtest.capability.available","Available"):a("playtest.capability.unavailable","Unavailable")})]},i))}),e.agents.length>0&&t.jsxs("div",{className:s.agentList,children:[t.jsx("span",{className:s.subsectionLabel,children:a("playtest.agents.title","Test agents")}),e.agents.map((i,d)=>{const c=typeof i.agentId=="string"?i.agentId:`${a("playtest.agents.unknown","Agent")} ${d+1}`,u=typeof i.role=="string"?i.role:"unknown",y=typeof i.clientId=="string"?` · ${i.clientId}`:"";return t.jsxs("code",{children:[c," · ",u,y]},`${c}-${d}`)})]}),e.limitations.length>0&&t.jsxs("div",{className:s.limitations,children:[t.jsx("div",{className:s.subsectionLabel,children:a("playtest.limitations.title","Limitations")}),e.limitations.map(i=>t.jsxs("div",{className:s.limitationItem,children:["! ",Ft(a,i.code,i.message)]},i.code))]})]})}const Co=["server","clientUi","interaction","visual"];function Ro({result:e}){const{t:a}=ue(),n={server:a("playtest.dimension.server","Server"),clientUi:a("playtest.dimension.clientUi","Client UI"),interaction:a("playtest.dimension.interaction","Interaction"),visual:a("playtest.dimension.visual","Visual")};return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":"playtest-dimensions-heading",children:[t.jsxs("div",{className:s.sectionHeadingRow,children:[t.jsx("h3",{id:"playtest-dimensions-heading",className:s.viewerHeading,children:a("playtest.dimension.title","Evidence dimensions")}),t.jsx("span",{className:s.sectionHint,children:a("playtest.dimension.hint","Required evidence is marked below.")})]}),t.jsx("div",{className:s.dimensionGrid,children:Co.map(i=>{const d=e.dimensions[i];return t.jsxs("div",{className:s.dimensionCard,children:[t.jsxs("div",{className:s.dimensionHeader,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${d.status}`]??""}`,"aria-hidden":"true",children:gt(d.status)}),t.jsx("span",{className:s.dimensionName,children:n[i]}),t.jsx("span",{className:s.requirementBadge,children:d.required?a("playtest.dimension.required","Required"):a("playtest.dimension.optional","Optional")})]}),t.jsx("div",{className:s.dimensionStatus,children:Ve(a,d.status)}),d.provider&&t.jsx("div",{className:s.dimensionMeta,children:d.provider}),d.reason&&t.jsx("div",{className:s.dimensionMeta,children:Ga(a,d.reason)}),t.jsxs("div",{className:s.dimensionMeta,children:[a("playtest.dimension.steps","Steps"),": ",d.stepIds.length]})]},i)})})]})}function Po({result:e}){const{t:a}=ue(),n=o.useId(),[i,d]=o.useState(()=>new Set),c=u=>{d(y=>{const m=new Set(y);return m.has(u)?m.delete(u):m.add(u),m})};return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":`${n}-heading`,children:[t.jsx("h3",{id:`${n}-heading`,className:s.viewerHeading,children:a("playtest.steps.title","Step timeline")}),t.jsx("div",{className:s.stepList,children:e.steps.map(u=>{const y=i.has(u.stepId),m=`${n}-${u.index}-details`,_=u.target.role==="server"?a("playtest.steps.server","Server"):u.target.clientId;return t.jsxs("div",{className:s.stepItem,children:[t.jsxs("button",{className:s.stepDisclosure,onClick:()=>c(u.stepId),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),c(u.stepId))},"aria-expanded":y,"aria-controls":m,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${u.status}`]??""}`,"aria-hidden":"true",children:gt(u.status)}),t.jsx("span",{className:s.stepIndex,children:u.index+1}),t.jsxs("span",{className:s.stepIdentity,children:[t.jsx("span",{className:s.stepName,children:u.stepId}),t.jsxs("span",{className:s.stepMeta,children:[_," · ",u.action," · ",Bt(u.durationMs)]})]}),t.jsx("span",{className:s.stepStatus,children:Ve(a,u.status)}),t.jsx("span",{className:`${s.chevron} ${y?s.chevronOpen:""}`,"aria-hidden":"true",children:"⌄"})]}),y&&t.jsxs("div",{className:s.stepDetails,id:m,role:"region","aria-label":`${u.stepId} ${a("playtest.steps.details","details")}`,children:[u.expected!==void 0&&t.jsxs("div",{className:s.evidenceBlock,children:[t.jsx("div",{className:s.evidenceLabel,children:a("playtest.steps.expected","Expected")}),t.jsx("pre",{children:at(u.expected)})]}),u.observed!==void 0&&t.jsxs("div",{className:s.evidenceBlock,children:[t.jsx("div",{className:s.evidenceLabel,children:a("playtest.steps.observed","Observed")}),t.jsx("pre",{children:at(u.observed)})]}),u.evidence!==void 0&&t.jsxs("div",{className:s.evidenceBlock,children:[t.jsx("div",{className:s.evidenceLabel,children:a("playtest.steps.evidence","Evidence")}),t.jsx("pre",{children:at(u.evidence)})]}),u.error&&t.jsxs("div",{className:s.stepError,children:[t.jsx("strong",{children:u.error.code})," — ",u.error.message]})]})]},u.stepId)})})]})}function ko({report:e}){var i;const{t:a}=ue(),n=e.recordKind==="incomplete_structured"?a("playtest.record.incomplete","Structured result is incomplete"):e.recordKind==="corrupt_structured"?a("playtest.record.corrupt","Structured result is damaged"):a("playtest.record.unsupported","Structured result version is unsupported");return t.jsxs("div",{className:s.recordProblem,role:"status",children:[t.jsx("strong",{children:n}),t.jsx("span",{children:((i=e.error)==null?void 0:i.message)??a("playtest.record.unavailable","Result details are unavailable.")})]})}function Ao({report:e}){var d,c,u,y,m,_;const{t:a}=ue(),n=!!((d=e.contextSummary)!=null&&d.testScenario||(c=e.contextSummary)!=null&&c.expectedBehavior||(u=e.contextSummary)!=null&&u.observedBehavior),i=e.recordKind==="structured"?e.result:void 0;return t.jsxs("div",{className:s.reportContainer,children:[i&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:s.runSummary,"aria-labelledby":"playtest-summary-heading",children:[t.jsxs("div",{className:s.summaryLead,children:[t.jsx("span",{className:`${s.summaryStatusMark} ${s[`tone_${i.overallStatus}`]??""}`,"aria-hidden":"true",children:gt(i.overallStatus)}),t.jsxs("div",{children:[t.jsx("h3",{id:"playtest-summary-heading",className:s.viewerHeading,children:a("playtest.summary.title","Run summary")}),t.jsx("div",{className:s.summaryName,children:i.testName}),t.jsx("div",{className:s.summaryReason,children:i.terminalReason.message})]})]}),t.jsxs("div",{className:s.summaryFacts,children:[t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.status","Status")}),t.jsx("strong",{children:Ve(a,i.overallStatus)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.mode","Mode")}),t.jsx("strong",{children:i.mode==="play"?a("playtest.status.mode.play","Play"):a("playtest.status.mode.run","Run")})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.duration","Duration")}),t.jsx("strong",{children:Bt(i.durationMs)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.cleanup","Cleanup")}),t.jsx("strong",{children:Ve(a,i.cleanup.status)})]})]})]}),t.jsx(Ro,{result:i}),t.jsx(Po,{result:i}),t.jsx(No,{result:i})]}),e.recordKind!=="structured"&&e.recordKind!=="legacy"&&t.jsx(ko,{report:e}),n&&t.jsxs("div",{className:s.reportContextPanel,children:[((y=e.contextSummary)==null?void 0:y.testScenario)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.why","Why this test ran")}),t.jsx("span",{children:e.contextSummary.testScenario})]}),((m=e.contextSummary)==null?void 0:m.expectedBehavior)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.expected","Expected")}),t.jsx("span",{children:e.contextSummary.expectedBehavior})]}),((_=e.contextSummary)==null?void 0:_.observedBehavior)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.observed","Observed")}),t.jsx("span",{children:e.contextSummary.observedBehavior})]})]}),t.jsx(wo,{detail:e},e.recordId),!i&&!e.markdown&&!e.logs&&e.recordKind==="legacy"&&t.jsx("div",{className:s.emptyState,children:a("playtest.report.empty","No report content available")})]})}function Pt(e){return typeof e=="number"?{placeId:String(e)}:void 0}const me={listProfiles:async e=>De.get("/api/dashboard/playtest/control-profiles",Pt(e)),liveStatus:async(e,a)=>De.get("/api/dashboard/playtest/live",{...Pt(e)??{},...a?{leaseId:a}:{}}),liveAction:async e=>De.post("/api/dashboard/playtest/live",e),bindingDraft:async(e,a)=>De.post("/api/dashboard/playtest/binding-draft",{...e,...typeof a=="number"?{placeId:a}:{}}),bindingCandidates:async e=>De.post("/api/dashboard/playtest/binding-candidates",{...typeof e=="number"?{placeId:e}:{}}),saveProfile:async(e,a,n)=>De.put(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e.id)}`,{profile:e,expectedRevision:a,...typeof n=="number"?{placeId:n}:{}}),saveProfileMetadata:async(e,a,n,i)=>De.patch(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e)}/metadata`,{expectedRevision:a,...n,...typeof i=="number"?{placeId:i}:{}}),deleteProfile:async(e,a,n)=>{const i=new URLSearchParams({expectedRevision:String(a)});return n.placeId!==void 0&&i.set("placeId",String(n.placeId)),De.delete(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e)}?${i.toString()}`,n.clientId?{clientId:n.clientId}:void 0)}},Gt="weppy-playtest-workspace-v1",Eo="weppy-playtest-profile-v1:";function Je(){try{return window.localStorage}catch{return null}}function Do(){var e;try{const a=(e=Je())==null?void 0:e.getItem(Gt);return a==="live"||a==="results"?a:"live"}catch{return"live"}}function Io(e){var a;try{(a=Je())==null||a.setItem(Gt,e)}catch{}}function bt(e){return`${Eo}${e}`}function To(e){var a;if(e===null)return null;try{return((a=Je())==null?void 0:a.getItem(bt(e)))||null}catch{return null}}function Ye(e,a){var n;if(e!==null)try{(n=Je())==null||n.setItem(bt(e),a)}catch{}}function kt(e){var a;if(e!==null)try{(a=Je())==null||a.removeItem(bt(e))}catch{}}const Qe={entries:[],diagnostics:[]},Xe={hasManagedAdapterWithoutStudioGuard:!1};function qe(e){return typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:e instanceof Error?e.message:String(e)}function Lo(e){if(typeof e!="object"||e===null||!("payload"in e))return!1;const a=e.payload;return(a==null?void 0:a.errorCode)==="lease_agents_unavailable"}function Mo(e){const{enabled:a,canMutate:n,placeId:i,studioSnapshot:d}=e,[c,u]=o.useState([]),[y,m]=o.useState(!1),[_,C]=o.useState(null),[k,x]=o.useState(null),[f,V]=o.useState(Qe),[R,M]=o.useState(Xe),[w,B]=o.useState({}),[P,E]=o.useState({}),[W,$]=o.useState({}),[ee,te]=o.useState(!0),[q,O]=o.useState(null),[z,U]=o.useState(null),L=o.useRef(null),ae=o.useRef(null),J=o.useRef([]),le=o.useRef(!1),Q=o.useRef(Promise.resolve()),K=o.useRef(0),Z=o.useRef(0),X=o.useRef(null),he=o.useRef(Promise.resolve()),re=o.useRef(null),oe=o.useRef(i);oe.current=i;const[ye,we]=o.useState(0);L.current=k;const H=o.useMemo(()=>c.find(v=>v.id===_)??null,[c,_]);ae.current=H,J.current=c;const se=o.useCallback(()=>{E(v=>Object.fromEntries(Object.entries(v).map(([S,A])=>{const{observed:N,...G}=A;return[S,{...G,status:"unavailable",fresh:!1,...N!==void 0?{lastObserved:N}:{},reason:"session_ended"}]})))},[]),ne=o.useCallback(async()=>{X.current&&(clearTimeout(X.current),X.current=null),Z.current=0;const v=L.current;if(v){L.current=null,x(null),B({}),$({}),se();try{await me.liveAction({action:"close",leaseId:v.leaseId,...typeof i=="number"?{placeId:i}:{}})}catch{}}},[se,i]),ce=o.useCallback(async()=>{if(!(L.current||le.current)){le.current=!0;try{let v=ae.current,S=oe.current,A=await me.liveAction({action:v?"observe":"discover",...v?{profileId:v.id}:{},...typeof S=="number"?{placeId:S}:{}});const N=ae.current,G=oe.current,l=(N==null?void 0:N.id)??"__weppy_catalog__";(A.lease.profileId!==l||G!==S)&&(v=N,S=G,A=await me.liveAction({action:v?"observe":"discover",...v?{profileId:v.id}:{},...typeof S=="number"?{placeId:S}:{}})),L.current=A.lease,x(A.lease),A.lease.catalog&&V(A.lease.catalog),B({});const r=await me.liveStatus(S,A.lease.leaseId);E(Object.fromEntries(r.watches.map(g=>[g.subscriptionId,g]))),X.current&&clearTimeout(X.current),X.current=null,Z.current=0,U(null)}catch(v){if(U(qe(v)),Lo(v)&&!X.current){const S=Z.current;Z.current+=1;const A=Math.min(2e3,250*2**Math.min(S,3));X.current=setTimeout(()=>{X.current=null,we(N=>N+1)},A)}}finally{le.current=!1}}},[]);o.useEffect(()=>{a||ne()},[ne,a]),o.useEffect(()=>{let v=!1;return te(!0),m(!1),u([]),C(null),re.current=null,x(null),B({}),E({}),$({}),V(Qe),M(Xe),(async()=>{const A=me.listProfiles(i).then(N=>{var r,g;if(v)return;u(N.profiles),re.current=(r=N.scope)!=null&&r.placeId?{placeId:N.scope.placeId}:N.targetClientId?{clientId:N.targetClientId}:typeof i=="number"?{placeId:i}:null,V(N.catalog??Qe),M(N.releaseGuidance??Xe);const G=To(i),l=N.profiles.some(D=>D.id===G)?G:((g=N.profiles[0])==null?void 0:g.id)??null;C(l),l&&Ye(i,l),m(!0)}).catch(N=>{v||(U(qe(N)),m(!0))});try{await A}finally{v||te(!1)}})(),()=>{v=!0}},[a,i]),o.useEffect(()=>{const v=++K.current,S=a&&y&&d.targetClientId!==null&&(d.state==="Running"||d.state==="Paused");!S&&X.current&&(clearTimeout(X.current),X.current=null,Z.current=0),Q.current=Q.current.catch(()=>{}).then(async()=>{if(v!==K.current)return;const A=L.current;A&&(!S||A.target.clientId!==d.targetClientId)&&await ne(),v===K.current&&S&&!L.current&&await ce()})},[ne,a,ce,ye,y,d.state,d.mode,d.targetClientId]),o.useEffect(()=>{if(!a)return;const v=new zt,S=v.on("playtest_watch",A=>{var G,l;const N=A;!(N!=null&&N.subscriptionId)||N.leaseId!==((G=L.current)==null?void 0:G.leaseId)||(N.profileGeneration??1)===(((l=L.current)==null?void 0:l.profileGeneration)??1)&&E(r=>{const g=r[N.subscriptionId];if(g&&N.sequence<=g.sequence&&N.sequence!==0)return r;const h=g&&N.sequence>0&&g.sequence>0&&N.sequence!==g.sequence+1?(()=>{const{observed:b,...T}=N;return{...T,status:"stale",fresh:!1,...b!==void 0?{lastObserved:b}:{},reason:"sequence_gap"}})():N;return{...r,[N.subscriptionId]:h}})});return v.connect(),()=>{S(),v.disconnect()}},[a]);const ie=o.useCallback(async v=>{var N;const S=J.current.find(G=>G.id===v);if(!S)return;const A=L.current;if(!A){C(v),Ye(i,v);return}if(A.profileId===S.id&&A.profileRevision===S.revision){C(v),Ye(i,v);return}O(v),U(null);try{const G=A.profileGeneration??1,l=await me.liveAction({action:"observe",profileId:v,...typeof i=="number"?{placeId:i}:{}});L.current=l.lease,x(l.lease),C(v),Ye(i,v),(l.lease.profileGeneration??1)!==G&&(B({}),$({}));const r=await me.liveStatus(i,l.lease.leaseId);(((N=L.current)==null?void 0:N.profileGeneration)??1)===(l.lease.profileGeneration??1)&&E(Object.fromEntries(r.watches.map(g=>[g.subscriptionId,g])))}catch(G){U(qe(G))}finally{O(null)}},[i]),Ne=o.useCallback(async(v,S)=>{var G;const A=L.current;if(!A||!n)return;const N=A.profileGeneration??1;B(l=>({...l,[v]:{...l[v],status:"applying",draft:S}}));try{const l=await me.liveAction({action:"apply",leaseId:A.leaseId,expectedRevision:A.revision,values:{[v]:S},...typeof i=="number"?{placeId:i}:{}}),r=l.result.bindings.find(g=>g.bindingId===v);if((((G=L.current)==null?void 0:G.profileGeneration)??1)!==N)return;x(g=>g&&(g.profileGeneration??1)===N?{...g,revision:l.result.revision}:g),B(g=>{var D,h;return{...g,[v]:l.result.status==="applied"?{status:"applied",draft:S,requested:(r==null?void 0:r.requested)??S,observed:r==null?void 0:r.observed,original:r==null?void 0:r.original}:{...g[v],status:((D=l.result.error)==null?void 0:D.code)==="requires_adapter"?"requires_adapter":"error",draft:S,message:(h=l.result.error)==null?void 0:h.message}}})}catch(l){const r=typeof l=="object"&&l!==null&&"status"in l&&l.status===409;B(g=>({...g,[v]:{...g[v],status:r?"conflict":"error",draft:S,message:qe(l)}}))}},[n,i]),ve=o.useCallback(async()=>{const v=L.current;if(!v||!n)return;const S=await me.liveAction({action:"reset",leaseId:v.leaseId,...typeof i=="number"?{placeId:i}:{}});x(S.lease),B({})},[n,i]),_e=o.useCallback(async(v,S,A)=>{var g,D;const N=L.current,G=ae.current;if(!N||!G||!n||d.state!=="Running")return;const l=structuredClone(S),r=N.profileGeneration??1;$(h=>({...h,[v]:{status:"running",requestId:A,actionId:v,arguments:l,executedAtMs:Date.now()}}));try{const h=await me.liveAction({action:"execute_action",leaseId:N.leaseId,profileId:G.id,actionId:v,requestId:A,expectedProfileRevision:G.revision,expectedRevision:N.revision,arguments:l,...typeof i=="number"?{placeId:i}:{}});(((g=L.current)==null?void 0:g.profileGeneration)??1)===r&&$(b=>({...b,[v]:h.result}))}catch(h){const b=typeof h=="object"&&h!==null&&"payload"in h?h.payload:void 0,T=(b==null?void 0:b.errorCode)==="action_result_unknown"||(b==null?void 0:b.errorCode)==="plugin_disconnected"||(b==null?void 0:b.errorCode)==="command_timeout";if((((D=L.current)==null?void 0:D.profileGeneration)??1)!==r)return;$(I=>({...I,[v]:{status:T?"unknown":"failed",requestId:A,actionId:v,arguments:l,executedAtMs:Date.now(),error:{code:(b==null?void 0:b.errorCode)??"action_failed",message:qe(h)}}}))}},[n,i,d.state]),xe=o.useCallback(async v=>{const S=v.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||`profile-${Date.now()}`,A=await me.saveProfile({schemaVersion:4,id:S,name:v.trim(),controls:[],watches:[],actions:[],presentation:{},settings:{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"},sectionOrder:["watches","controls","actions"]},0,i);return u(N=>[...N,A.profile]),J.current=[...J.current,A.profile],await ie(A.profile.id),A.profile},[i,ie]),Ce=o.useCallback(async v=>{var G;const{revision:S,...A}=v,N=await me.saveProfile(A,S,i);u(l=>l.map(r=>r.id===N.profile.id?N.profile:r)),J.current=J.current.map(l=>l.id===N.profile.id?N.profile:l),((G=L.current)==null?void 0:G.profileId)===N.profile.id&&await ie(N.profile.id)},[i,ie]),be=o.useCallback(async(v,S,A)=>{const N=ae.current;if(!N)throw new Error("Select a test profile before saving a value.");const G=N.id;await new Promise((l,r)=>{he.current=he.current.catch(()=>{}).then(async()=>{var h,b;const g=J.current.find(T=>T.id===G);if(!g)throw new Error("The selected test profile is no longer available.");const D=await me.saveProfileMetadata(g.id,g.revision,{defaults:{[v]:S}},i);((h=ae.current)==null?void 0:h.id)===D.profile.id&&(ae.current=D.profile),J.current=J.current.map(T=>T.id===D.profile.id?D.profile:T),u(J.current),((b=L.current)==null?void 0:b.profileId)===D.profile.id&&await ie(D.profile.id)}),he.current.then(l,r)})},[i,ie]),fe=o.useCallback(async v=>{var A;const S=(A=ae.current)==null?void 0:A.id;if(!S)throw new Error("Select a test profile before saving display settings.");await new Promise((N,G)=>{he.current=he.current.catch(()=>{}).then(async()=>{var g,D;const l=J.current.find(h=>h.id===S);if(!l)throw new Error("The selected test profile is no longer available.");const r=await me.saveProfileMetadata(l.id,l.revision,v,i);((g=ae.current)==null?void 0:g.id)===r.profile.id&&(ae.current=r.profile),J.current=J.current.map(h=>h.id===r.profile.id?r.profile:h),u(J.current),((D=L.current)==null?void 0:D.profileId)===r.profile.id&&await ie(r.profile.id)}),he.current.then(N,G)})},[i,ie]),Re=o.useCallback(async(v,S)=>{await fe({actionDefaults:{[v]:S}})},[fe]),p=o.useCallback(async v=>({path:(await me.bindingDraft(v,i)).binding.path}),[i]),j=o.useCallback(async()=>await me.bindingCandidates(i),[i]),F=o.useCallback(async(v,S)=>{var r,g,D,h;const A=re.current,N=i;if(!A)throw Object.assign(new Error("profile_scope_unavailable"),{code:"profile_scope_unavailable"});if(((r=L.current)==null?void 0:r.profileId)===v){const b=J.current.find(T=>T.id!==v);if(b){if(await ie(b.id),((g=L.current)==null?void 0:g.profileId)!==b.id)throw new Error("Could not switch away from the active profile before deleting it.")}else{const T=await me.liveAction({action:"discover",...typeof N=="number"?{placeId:N}:{}});L.current=T.lease,x(T.lease),B({}),E({}),$({})}}await me.deleteProfile(v,S,A);let G;try{G=await me.listProfiles(N)}catch{if(oe.current!==N)return{refreshFailed:!0};const b=J.current.filter(I=>I.id!==v);J.current=b;const T=((D=b[0])==null?void 0:D.id)??null;if(u(b),B({}),E({}),$({}),T)await ie(T);else if(C(null),kt(N),L.current&&L.current.profileId!=="__weppy_catalog__"){const I=await me.liveAction({action:"discover",...typeof N=="number"?{placeId:N}:{}});L.current=I.lease,x(I.lease)}return{refreshFailed:!0}}if(oe.current!==N)return{refreshFailed:!1};u(G.profiles),J.current=G.profiles,V(G.catalog??Qe),M(G.releaseGuidance??Xe);const l=((h=G.profiles[0])==null?void 0:h.id)??null;if(B({}),E({}),$({}),l)await ie(l);else if(C(null),kt(N),L.current&&L.current.profileId!=="__weppy_catalog__"){const b=await me.liveAction({action:"discover",...typeof N=="number"?{placeId:N}:{}});L.current=b.lease,x(b.lease)}return{refreshFailed:!1}},[i,ie]);return{profiles:c,selectedProfileId:_,profile:H,catalog:f,releaseGuidance:R,lease:k,controls:w,watches:P,actions:W,studioState:d.state,studioMode:d.mode,canMutate:n,loading:ee,switchingProfileId:q,error:z,selectProfile:ie,apply:Ne,executeAction:_e,resetAll:ve,createProfile:xe,saveProfile:Ce,saveControlValue:be,saveActionDefaults:Re,saveProfileMetadata:fe,resolveSelection:p,resolveSelectionCandidates:j,deleteProfile:F}}function $o(e){const{t:a}=ue(),n=[{key:"live",label:a("playtest.view.liveSession","Test Values")},{key:"results",label:a("playtest.view.testResults","Automated Test Results")}];return t.jsx(ca,{items:n,value:e.value,onChange:e.onChange,ariaLabel:a("playtest.view.workspaceLabel","Playtest workspace"),className:s.workspaceTabs})}function Vo(e){const{t:a}=ue(),n=e.studioState==="Running"&&e.studioMode==="run"?a("playtest.session.state.runRunning","Run running"):e.studioState==="Running"&&e.studioMode==="play"?a("playtest.session.state.playRunning","Play running"):a(`playtest.session.state.${e.studioState.toLowerCase()}`,e.studioState),i=e.studioState==="Disconnected"?a("playtest.session.disconnectedDescription","Connect Roblox Studio and WEPPY Plugin to observe Playtest values."):e.studioState==="Edit"?null:e.studioState==="Paused"?a("playtest.session.pausedDescription","Studio Play is paused. Observations remain connected, and Pro value changes stay available."):e.lease?`${e.profileName??e.lease.profileId} · ${e.lease.target.targetAlias??e.lease.target.clientId}`:a("playtest.session.connectingDescription","Studio is playing. Connecting runtime observations…");return t.jsx("section",{className:s.sessionBar,"aria-label":a("playtest.session.label","Playtest session"),children:t.jsxs("div",{className:s.sessionIdentity,children:[t.jsx(ba,{size:16,"aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("strong",{children:n}),i&&t.jsx("span",{children:i})]})]})})}function Oe(e){const{t:a}=ue(),[n,i]=o.useState(!1),d=o.useRef(null),c=o.useRef(null),u=o.useRef(null),[y,m]=o.useState({top:0,left:0});return o.useLayoutEffect(()=>{var R;if(!n||e.active||!c.current||!u.current)return;const C=(((R=d.current)==null?void 0:R.querySelector("input, select, button"))??c.current).getBoundingClientRect(),k=u.current.getBoundingClientRect(),x=C.top-k.height-6,f=C.bottom+6,V=x<8&&f+k.height<=window.innerHeight-8?f:x;m({top:Math.max(8,Math.min(V,window.innerHeight-k.height-8)),left:Math.max(8,Math.min(C.left+C.width/2-k.width/2,window.innerWidth-k.width-8))})},[n,e.active,e.reason]),o.useEffect(()=>{if(!n)return;const _=()=>i(!1);return window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_)}},[n]),t.jsxs("div",{ref:d,className:s.controlGate,children:[e.children,!e.active&&t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:c,type:"button",className:s.controlGateTrigger,"aria-label":a("playtest.controls.lockedHelp","Why is {{label}} unavailable?").replace("{{label}}",e.label),"aria-describedby":"playtest-controls-availability","aria-expanded":n,onClick:()=>i(!0),onFocus:()=>i(!0),onBlur:()=>i(!1),onKeyDown:_=>{_.key==="Escape"&&i(!1)}}),n&&Wt.createPortal(t.jsx("span",{ref:u,className:s.controlGateHint,style:y,role:"status",children:e.reason}),document.body)]})]})}function _t(e){var a,n,i;return t.jsx(Ke,{open:e.open,ariaLabel:e.ariaLabel,onClose:e.onClose,returnFocusTo:e.returnFocusTo,testId:"playtest-value-detail-layer",children:t.jsxs("div",{className:s.valueDetailShell,children:[t.jsx(ze,{title:e.title,description:e.description,closeLabel:e.closeLabel,onRequestClose:e.onClose}),t.jsxs("div",{className:s.valueDetailBody,children:[t.jsx("dl",{className:s.valueDetailList,children:e.items.map(d=>t.jsxs("div",{children:[t.jsx("dt",{children:d.label}),t.jsx("dd",{children:d.value})]},d.label))}),t.jsx("div",{className:s.valueDetailFeedback,"data-state":e.error?"error":((a=e.feedback)==null?void 0:a.state)??"idle",role:e.error||((n=e.feedback)==null?void 0:n.state)==="error"?"alert":"status","aria-live":"polite",children:e.error??((i=e.feedback)==null?void 0:i.message)??" "}),e.actions&&e.actions.length>0&&t.jsx("div",{className:s.valueDetailActions,children:e.actions.map(d=>{var c,u,y;return t.jsx(Oe,{active:((c=d.gate)==null?void 0:c.active)??!0,label:((u=d.gate)==null?void 0:u.label)??d.label,reason:((y=d.gate)==null?void 0:y.reason)??"",children:t.jsx("button",{type:"button",className:d.variant==="secondary"?s.secondaryAction:s.primaryAction,"aria-label":d.accessibleLabel,disabled:d.disabled,onClick:d.onClick,children:d.label})},d.accessibleLabel)})})]})]})})}function Ge(e){return e==="vector3"||e==="color3"||e==="cframe"}function qt(e){return e==="vector3"?["x","y","z"]:e==="color3"?["r","g","b"]:["X","Y","Z","R00","R01","R02","R10","R11","R12","R20","R21","R22"]}function xt(e,a){try{const n=JSON.parse(a),i=qt(e);if(e==="cframe"?!Array.isArray(n)||n.length!==12:!n||Array.isArray(n)||typeof n!="object"||Object.keys(n).length!==3)return;const d=i.map((c,u)=>e==="cframe"?n[u]:n[c]);if(!d.every(c=>typeof c=="number"&&Number.isFinite(c))||e==="color3"&&d.some(c=>c<0||c>1))return;if(e==="cframe"){const c=d,u=(m,_)=>c[m]*c[_]+c[m+1]*c[_+1]+c[m+2]*c[_+2],y=c[3]*(c[7]*c[11]-c[8]*c[10])-c[4]*(c[6]*c[11]-c[8]*c[9])+c[5]*(c[6]*c[10]-c[7]*c[9]);if([3,6,9].some(m=>Math.abs(u(m,m)-1)>1e-5)||[[3,6],[3,9],[6,9]].some(([m,_])=>Math.abs(u(m,_))>1e-5)||Math.abs(y-1)>1e-5)return}return n}catch{return}}function st(e){if(e===void 0)return"—";if(typeof e=="string")return e.replace(/^Enum\.[^.]+\./,"");if(e&&typeof e=="object"&&!Array.isArray(e)){const a="x"in e?["x","y","z"]:"r"in e?["r","g","b"]:[];if(a.length===3&&a.every(n=>typeof e[n]=="number"))return a.map(n=>`${n.toUpperCase()} ${Number(e[n].toPrecision(6))}`).join(" · ")}return JSON.stringify(e)}function yt(e){const a=o.useRef(!1),n=qt(e.type);let i={};try{i=JSON.parse(e.draft)??{}}catch{}const d=n.map((m,_)=>{const C=e.type==="cframe"?i[_]:i[m];return C==null?"":String(C)}),c=(m,_)=>{const k=d.map((x,f)=>f===m?_:x).map(x=>x.trim()!==""&&!/[.eE+-]$/.test(x)&&Number.isFinite(Number(x))?Number(x):x);e.onChange(JSON.stringify(e.type==="cframe"?k:Object.fromEntries(n.map((x,f)=>[x,k[f]]))))},u=xt(e.type,e.draft),y=u&&!Array.isArray(u)&&typeof u=="object"?`#${["r","g","b"].map(m=>Math.round(Number(u[m])*255).toString(16).padStart(2,"0")).join("")}`:"#000000";return t.jsxs("div",{className:s.compoundEditor,role:"group","aria-label":e.label,onFocus:()=>{var m;return(m=e.onFocusChange)==null?void 0:m.call(e,!0)},onBlur:m=>{var _,C;m.currentTarget.contains(m.relatedTarget)||((_=e.onFocusChange)==null||_.call(e,!1),a.current||(C=e.onCommit)==null||C.call(e))},onCompositionStart:()=>{a.current=!0},onCompositionEnd:()=>{a.current=!1},onKeyDown:m=>{var _;m.key==="Enter"&&!m.nativeEvent.isComposing&&!a.current&&((_=e.onCommit)==null||_.call(e))},children:[e.type==="color3"&&t.jsx("input",{className:s.colorSwatch,type:"color",value:y,disabled:e.disabled,"aria-label":`${e.label} RGB`,"aria-describedby":e.describedBy,onChange:m=>{const _=m.target.value.slice(1);e.onChange(JSON.stringify({r:parseInt(_.slice(0,2),16)/255,g:parseInt(_.slice(2,4),16)/255,b:parseInt(_.slice(4,6),16)/255}))}}),t.jsx("div",{className:s.compoundCoordinates,children:n.map((m,_)=>t.jsxs("label",{children:[t.jsxs("span",{children:[m.toUpperCase(),e.type==="color3"?" (0–1)":""]}),t.jsx("input",{inputMode:"decimal",value:d[_],disabled:e.disabled,"aria-label":`${e.label} ${m.toUpperCase()}`,"aria-describedby":e.describedBy,"aria-invalid":e.draft!==""&&u===void 0||void 0,onChange:C=>c(_,C.target.value)})]},m))})]})}function Ae(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Oo(e,a,n){const i=n!=null&&n.fresh?n.observed:n==null?void 0:n.lastObserved,d=(a==null?void 0:a.draft)??i??e.value;return d===void 0?"":Ae(d)}function He(e,a){var n;if(Ge(e.valueType))return xt(e.valueType,a);if(e.valueType==="number"){if(a.trim()==="")return;const i=Number(a);return Number.isFinite(i)?i:void 0}return e.valueType==="boolean"?a==="true":e.valueType==="enum"?((n=e.enumValues)==null?void 0:n.find(i=>Ae(i)===a))??a:a}function Be(e){return e&&typeof e=="object"&&!Array.isArray(e)?`object:${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${Be(e[a])}`).join(",")}`:`${typeof e}:${JSON.stringify(e)}`}function Ue(e){var a;return e.value!==void 0?Ae(e.value):e.valueType==="boolean"?"false":e.valueType==="enum"?Ae((a=e.enumValues)==null?void 0:a[0]):""}function Bo(e){var i;const{t:a}=ue();if(!e.profile||e.profile.controls.length===0)return t.jsx("div",{className:s.panelEmpty,children:a("playtest.controls.empty","No test controls in this profile yet.")});const n=((i=e.profile.settings)==null?void 0:i.runtimeApplyMode)??"manual";return t.jsx("div",{className:s.liveRows,children:e.profile.controls.map(d=>{var c,u,y;return t.jsx(Fo,{control:d,active:e.active,inactiveReason:e.inactiveReason,profileSaveLocked:e.profileSaveLocked,runtimeApplyMode:n,state:e.states[d.id],watch:e.watches[`control:${d.id}`],presentation:(u=(c=e.profile)==null?void 0:c.presentation)==null?void 0:u[d.id],draftState:(y=e.drafts)==null?void 0:y[d.id],onDraftChange:e.onDraftChange,onApply:e.onApply,onSaveValue:e.onSaveValue,onRemoveValue:e.onRemoveValue},`${e.draftScope??"profile"}:${d.id}`)})})}function Fo(e){var ie,Ne,ve,_e,xe,Ce,be,fe,Re,p,j,F,v,S,A,N,G,l,r,g,D;const{t:a}=ue(),n=Oo(e.control,e.state,e.watch),[i,d]=o.useState(n),[c,u]=o.useState(!1),[y,m]=o.useState("idle"),[_,C]=o.useState(null),[k,x]=o.useState(()=>Ue(e.control)),[f,V]=o.useState(e.control.value),[R,M]=o.useState(null),[w,B]=o.useState(!1),P=o.useRef(null),E=o.useRef(!1),W=o.useRef(!1),$=o.useRef(null),ee=((ie=e.draftState)==null?void 0:ie.value)??i,te=((Ne=e.draftState)==null?void 0:Ne.dirty)??c;o.useEffect(()=>{d(n),u(!1),x(Ue(e.control)),V(e.control.value),M(null),C(null),$.current=null},[e.control.id]),o.useEffect(()=>{x(Ue(e.control)),V(e.control.value)},[e.control.value]),o.useEffect(()=>{!e.draftState&&!te&&!E.current&&d(n)},[te,n,e.draftState]),o.useEffect(()=>{var h,b,T;(((h=e.state)==null?void 0:h.status)==="error"||((b=e.state)==null?void 0:b.status)==="conflict"||((T=e.state)==null?void 0:T.status)==="requires_adapter")&&($.current=null)},[(ve=e.state)==null?void 0:ve.status]);const q=()=>He(e.control,ee),O=h=>{if(!e.active||W.current)return;const b=h??q();if(b===void 0)return;const T=Be(b);$.current!==T&&($.current=T,e.onApply(e.control.id,b))},z=h=>{var T;d(h),u(!0),(T=e.onDraftChange)==null||T.call(e,e.control.id,h,!0);const b=He(e.control,h);(b===void 0||Be(b)!==$.current)&&($.current=null)},U=async()=>{const h=He(e.control,k);if(!(h===void 0||!e.onSaveValue||e.profileSaveLocked||y!=="idle")){m("saving"),C(null),M(null);try{await e.onSaveValue(e.control.id,h,e.control.applyOnStart??!1),V(h),M({state:"saved",value:Ae(h)})}catch(b){C(b instanceof Error?b.message:String(b))}finally{m("idle")}}},L=async()=>{if(!(f===void 0||!e.onRemoveValue||e.profileSaveLocked||y!=="idle")){m("removing"),C(null),M(null);try{await e.onRemoveValue(e.control.id),x(Ue({...e.control,value:void 0})),V(void 0),M({state:"removed"})}catch(h){C(h instanceof Error?h.message:String(h))}finally{m("idle")}}},ae=a("playtest.controls.inputLabel","Input value for {{label}}").replace("{{label}}",e.control.label),J=e.active?void 0:"playtest-controls-availability",le=e.inactiveReason??a("playtest.values.playRequired","Start Play in Studio to change test values."),Q=e.control.valueType==="number"&&((_e=e.control.constraints)==null?void 0:_e.minimum)!==void 0&&((xe=e.control.constraints)==null?void 0:xe.maximum)!==void 0,K=(Ce=e.watch)!=null&&Ce.fresh?e.watch.observed:(be=e.watch)==null?void 0:be.lastObserved,Z=(fe=e.watch)!=null&&fe.fresh?a("playtest.controls.currentObserved","Current value"):K!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),X=((Re=e.state)==null?void 0:Re.status)??"idle",he=e.control.origin?`ServerStorage.WeppyTestAdapters.${e.control.origin.adapter}`:e.control.path?[e.control.path.root,...e.control.path.segments].join("."):"adapter",re=e.runtimeApplyMode==="auto",oe=q(),ye=X==="applying"||X==="pending_resume",we=!re&&e.active&&te&&oe!==void 0&&K!==void 0&&Be(oe)!==Be(K)&&Be(oe)!==$.current&&!ye,H=f===void 0?a("playtest.controls.noSavedValue","No saved default"):Ae(f),se=a("playtest.controls.defaultInputLabel","Saved default for {{label}}").replace("{{label}}",e.control.label);let ne;Ge(e.control.valueType)?ne=t.jsx(yt,{type:e.control.valueType,draft:ee,label:ae,disabled:!e.active,describedBy:J,onChange:z,onFocusChange:h=>{E.current=h},onCommit:()=>{re&&O()}}):e.control.valueType==="boolean"?ne=t.jsxs("label",{className:s.booleanEditor,children:[t.jsx("input",{type:"checkbox",checked:ee==="true",disabled:!e.active,"aria-label":ae,"aria-describedby":J,onFocus:()=>{E.current=!0},onBlur:()=>{E.current=!1},onChange:h=>{const b=h.target.checked;z(String(b)),re&&O(b)}}),t.jsx("span",{children:ee==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?ne=t.jsx("select",{"aria-label":ae,"aria-describedby":J,value:ee,disabled:!e.active,onFocus:()=>{E.current=!0},onBlur:()=>{E.current=!1},onChange:h=>{z(h.target.value);const b=He(e.control,h.target.value);re&&b!==void 0&&O(b)},children:(e.control.enumValues??[]).map(h=>t.jsx("option",{value:Ae(h),children:st(h)},Ae(h)))}):Q?ne=t.jsxs("div",{className:s.rangeEditor,children:[t.jsx("input",{type:"range",value:ee||String(((p=e.control.constraints)==null?void 0:p.minimum)??0),min:(j=e.control.constraints)==null?void 0:j.minimum,max:(F=e.control.constraints)==null?void 0:F.maximum,step:((v=e.control.constraints)==null?void 0:v.step)??1,disabled:!e.active,"aria-label":ae,"aria-describedby":J,onFocus:()=>{E.current=!0},onBlur:()=>{E.current=!1},onChange:h=>z(h.target.value),onPointerUp:()=>{re&&O()},onKeyUp:h=>{re&&(h.key.startsWith("Arrow")||h.key==="Home"||h.key==="End")&&O()}}),t.jsx("output",{children:ee||"—"})]}):ne=t.jsx("input",{value:ee,disabled:!e.active,inputMode:e.control.valueType==="number"?"decimal":void 0,onFocus:()=>{E.current=!0},onChange:h=>z(h.target.value),onCompositionStart:()=>{W.current=!0},onCompositionEnd:()=>{W.current=!1},onKeyDown:h=>{re&&h.key==="Enter"&&!h.nativeEvent.isComposing&&O()},onBlur:()=>{E.current=!1,re&&O()},"aria-label":ae,"aria-describedby":J});let ce;return Ge(e.control.valueType)?ce=t.jsx(yt,{type:e.control.valueType,draft:k,label:se,disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle",onChange:h=>{x(h),M(null),C(null)}}):e.control.valueType==="boolean"?ce=t.jsxs("label",{className:s.defaultBooleanEditor,children:[t.jsx("input",{type:"checkbox",checked:k==="true",disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle","aria-label":se,onChange:h=>{x(String(h.target.checked)),M(null),C(null)}}),t.jsx("span",{children:k==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?ce=t.jsx("select",{value:k,disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle","aria-label":se,onChange:h=>{x(h.target.value),M(null),C(null)},children:(e.control.enumValues??[]).map(h=>t.jsx("option",{value:Ae(h),children:st(h)},Ae(h)))}):ce=t.jsx("input",{type:e.control.valueType==="number"?"number":"text",value:k,min:(S=e.control.constraints)==null?void 0:S.minimum,max:(A=e.control.constraints)==null?void 0:A.maximum,step:(N=e.control.constraints)==null?void 0:N.step,disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle","aria-label":se,onChange:h=>{x(h.target.value),M(null),C(null)}}),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.controlRow,children:[t.jsxs("div",{className:s.rowIdentity,children:[t.jsx("strong",{children:e.control.label}),(((G=e.presentation)==null?void 0:G.pinned)||((l=e.presentation)==null?void 0:l.group))&&t.jsxs("span",{className:s.presentationMeta,children:[e.presentation.pinned?a("playtest.values.pinned","Pinned"):"",e.presentation.pinned&&e.presentation.group?" · ":"",e.presentation.group??""]}),t.jsx("button",{ref:P,type:"button",className:s.valueDetailButton,"aria-label":a("playtest.values.detailsFor","Value details for {{label}}").replace("{{label}}",e.control.label),onClick:()=>{x(Ue({...e.control,value:f})),M(null),C(null),B(!0)},children:a("playtest.values.viewDetails","View details")})]}),t.jsxs("div",{className:s.actualValue,"aria-label":`${Z} ${Ae(K)}`,children:[t.jsx("span",{children:Z}),t.jsx("strong",{children:st(K)})]}),t.jsxs("div",{className:s.controlEditor,children:[t.jsxs("div",{className:s.editorHeading,children:[t.jsx("span",{className:s.editorLabel,children:a("playtest.controls.inputValue","Input value")}),t.jsxs("span",{className:s.savedValueState,title:H,"aria-label":a("playtest.controls.savedDefaultState","Saved default for {{label}}: {{value}}").replace("{{label}}",e.control.label).replace("{{value}}",H),children:[a("playtest.controls.defaultValue","Saved default")," ",t.jsx("strong",{children:H})]})]}),t.jsxs("div",{className:s.controlEditorRow,children:[t.jsx(Oe,{active:e.active,label:`${e.control.label} input`,reason:le,children:ne}),t.jsx("div",{className:s.controlActions,children:t.jsx(Oe,{active:e.active,label:`${e.control.label} apply`,reason:le,children:t.jsx("button",{type:"button",className:s.secondaryAction,disabled:!we,"aria-label":a("playtest.controls.applyLabel","Apply the input value for {{label}}").replace("{{label}}",e.control.label),onClick:()=>O(),children:a("playtest.controls.applyRuntime","Apply manually")})})})]}),t.jsx("span",{className:s.rowFeedback,"data-state":_?"error":X,"aria-live":"polite",children:_??(X==="applying"?a("playtest.controls.applying","Applying…"):X==="pending_resume"?a("playtest.controls.pendingResume","Apply on resume"):X==="applied"?a("playtest.controls.applied","Applied · readback {{value}}").replace("{{value}}",Ae((r=e.state)==null?void 0:r.observed)):X==="conflict"?a("playtest.controls.conflict","Conflict · reload the current revision"):X==="requires_adapter"?a("playtest.controls.requiresAdapter","Requires reviewed adapter"):X==="error"?((g=e.state)==null?void 0:g.message)??a("playtest.controls.applyFailed","Apply failed"):e.active?re?a("playtest.controls.autoApplyReady","Changes apply automatically when the input is confirmed"):a("playtest.controls.readyToApply","Input value is ready to apply or save as the default"):" ")})]})]}),t.jsx(_t,{open:w,title:e.control.label,description:a("playtest.controls.details","Value details"),ariaLabel:a("playtest.values.detailsDialog","{{label}} value details").replace("{{label}}",e.control.label),closeLabel:a("common.close","Close"),returnFocusTo:P.current,onClose:()=>B(!1),items:[{label:Z,value:Ae(K)},{label:a("playtest.controls.defaultValue","Saved default"),value:t.jsx("div",{className:s.defaultValueEditor,children:ce})},{label:a("playtest.controls.originalValue","Original runtime value"),value:Ae((D=e.state)==null?void 0:D.original)},{label:a("playtest.controls.registration","Registration"),value:`${e.control.target.role} · ${e.control.access.kind}`},{label:a("playtest.values.location","Location"),value:he},{label:a("playtest.values.valueType","Value type"),value:e.control.valueType}],error:_,feedback:(R==null?void 0:R.state)==="saved"?{state:"success",message:a("playtest.controls.defaultSavedFeedback","Saved default {{value}} · Saved").replace("{{value}}",R.value??"")}:(R==null?void 0:R.state)==="removed"?{state:"success",message:a("playtest.controls.defaultRemovedFeedback","No saved default · Removed")}:null,actions:[{label:y==="removing"?a("playtest.controls.removingDefault","Removing…"):a("playtest.controls.removeDefault","Remove default"),accessibleLabel:a("playtest.controls.removeDefaultLabel","Remove saved default for {{label}}").replace("{{label}}",e.control.label),disabled:f===void 0||!e.onRemoveValue||e.profileSaveLocked||y!=="idle",variant:"secondary",onClick:()=>void L()},{label:y==="saving"?a("playtest.profile.saving","Saving…"):a("playtest.controls.saveDefault","Save default"),accessibleLabel:a("playtest.controls.saveLabel","Save default for {{label}}").replace("{{label}}",e.control.label),disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle"||He(e.control,k)===void 0,onClick:()=>void U()}]})]})}function Ze(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Go(e){var C;const{t:a}=ue(),n=[...((C=e.profile)==null?void 0:C.watches.map(k=>({...k,subscriptionId:`watch:${k.id}`})))??[]],[i,d]=o.useState(null),c=o.useRef(null);if(n.length===0)return t.jsx("div",{className:s.panelEmpty,children:a("playtest.watch.empty","Observed values appear here during Play.")});const u=n.find(k=>k.id===i),y=u?e.watches[u.subscriptionId]:void 0,m=y!=null&&y.fresh?y.observed:y==null?void 0:y.lastObserved,_=u!=null&&u.path?[u.path.root,...u.path.segments].join("."):(u==null?void 0:u.access.adapter)??"adapter";return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:s.watchRows,children:n.map(k=>{var M,w;const x=e.watches[k.subscriptionId],f=(w=(M=e.profile)==null?void 0:M.presentation)==null?void 0:w[k.id],V=x!=null&&x.fresh?x.observed:x==null?void 0:x.lastObserved,R=x!=null&&x.fresh?a("playtest.watch.currentValue","Current value"):V!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet");return t.jsxs("div",{className:s.watchRow,"data-value-type":k.valueType,children:[t.jsxs("div",{className:s.watchCardMain,children:[t.jsx("strong",{children:k.label}),((f==null?void 0:f.pinned)||(f==null?void 0:f.group))&&t.jsxs("span",{className:s.presentationMeta,children:[f.pinned?a("playtest.values.pinned","Pinned"):"",f.pinned&&f.group?" · ":"",f.group??""]}),t.jsx("button",{type:"button",className:s.valueDetailButton,"aria-label":a("playtest.values.detailsFor","Value details for {{label}}").replace("{{label}}",k.label),onClick:B=>{c.current=B.currentTarget,d(k.id)},children:a("playtest.values.viewDetails","View details")})]}),t.jsxs("div",{className:s.watchReading,children:[!(x!=null&&x.fresh)&&t.jsx("span",{children:R}),t.jsx("strong",{title:Ze(V),"aria-label":`${R} ${Ze(V)}`,children:Ze(V)})]}),x&&x.status!=="fresh"&&t.jsx("span",{className:s.freshness,"data-status":x.status,children:(x==null?void 0:x.status)==="stale"?a("playtest.watch.stale","Stale"):a("playtest.watch.unavailable","Unavailable")})]},k.subscriptionId)})}),u&&t.jsx(_t,{open:i!==null,title:u.label,description:a("playtest.watch.details","Observation details"),ariaLabel:a("playtest.values.detailsDialog","{{label}} value details").replace("{{label}}",u.label),closeLabel:a("common.close","Close"),returnFocusTo:c.current,onClose:()=>d(null),items:[{label:a("playtest.watch.registration","Registration"),value:`${u.target.role} · ${u.access.kind}`},{label:a("playtest.values.location","Location"),value:_},{label:a("playtest.values.valueType","Value type"),value:u.valueType},{label:y!=null&&y.fresh?a("playtest.watch.currentValue","Current value"):m!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),value:Ze(m)},...y!=null&&y.observedAtMs?[{label:a("playtest.watch.observedAt","Observed at"),value:t.jsx("time",{children:new Date(y.observedAtMs).toLocaleTimeString()})}]:[]]})]})}function nt(e,a){return Object.prototype.hasOwnProperty.call(e,a)}function qo(e,a){var n;if(e.type==="string")return typeof a=="string"?a:void 0;if(e.type==="boolean")return typeof a=="boolean"?a:void 0;if(e.type==="number"||e.type==="integer"){const i=typeof a=="number"?a:typeof a=="string"&&a.trim()!==""?Number(a):NaN;return Number.isFinite(i)?i:void 0}return(n=e.enumValues)==null?void 0:n.find(i=>i===a)}function Ho(e,a){if(e.type==="integer"&&!Number.isInteger(a))return"Enter a whole number.";if(typeof a=="number"){if(e.minimum!==void 0&&a<e.minimum)return`Enter ${e.minimum} or more.`;if(e.maximum!==void 0&&a>e.maximum)return`Enter ${e.maximum} or less.`}if(typeof a=="string"){if(e.minLength!==void 0&&a.length<e.minLength)return`Enter at least ${e.minLength} characters.`;if(e.maxLength!==void 0&&a.length>e.maxLength)return`Enter no more than ${e.maxLength} characters.`}return null}function Ht(e){return Object.fromEntries(e.parameters.map(a=>[a.name,e.defaultArguments&&nt(e.defaultArguments,a.name)?e.defaultArguments[a.name]:a.defaultValue]))}function At(e,a){const n={},i=new Set(e.parameters.map(c=>c.name));for(const c of Object.keys(a))nt(e.fixedArguments,c)?n[c]="This argument is fixed and cannot be changed.":i.has(c)||(n[c]="This argument is not declared.");const d=structuredClone(e.fixedArguments);for(const c of[...e.parameters].sort((u,y)=>u.order-y.order)){const u=nt(a,c.name)?a[c.name]:e.defaultArguments&&nt(e.defaultArguments,c.name)?e.defaultArguments[c.name]:c.defaultValue;if(u===void 0){c.required&&(n[c.name]="This value is required.");continue}const y=qo(c,u);if(y===void 0){n[c.name]=c.type==="enum"?"Choose one of the available values.":"Enter a valid value.";continue}const m=Ho(c,y);m?n[c.name]=m:d[c.name]=y}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0,arguments:d}}function Et(e){const{t:a}=ue();return t.jsx("div",{className:s.actionParameterGrid,children:[...e.action.parameters].sort((n,i)=>n.order-i.order).map(n=>{var m,_;const i=(m=e.errors)==null?void 0:m[n.name],d=`playtest-action-${e.action.id}-${n.name}-error`,c=e.draft[n.name],u=`${n.label}${n.unit?` (${n.unit})`:""}`;let y;if(n.type==="boolean")y=t.jsx("input",{type:"checkbox","aria-label":u,checked:c===!0,disabled:e.disabled,"aria-invalid":!!i,"aria-describedby":i?d:void 0,onChange:C=>e.onChange(n.name,C.target.checked)});else if(n.type==="enum"){const C=((_=n.enumValues)==null?void 0:_.findIndex(k=>k===c))??-1;y=t.jsxs("select",{"aria-label":u,value:C<0?"":String(C),disabled:e.disabled,"aria-invalid":!!i,"aria-describedby":i?d:void 0,onChange:k=>{var f;const x=Number(k.target.value);e.onChange(n.name,Number.isInteger(x)?(f=n.enumValues)==null?void 0:f[x]:void 0)},children:[t.jsx("option",{value:"",children:n.required?a("playtest.actions.chooseValue","Choose a value"):a("playtest.actions.omitValue","Do not use")}),(n.enumValues??[]).map((k,x)=>t.jsx("option",{value:x,children:String(k)},`${x}:${String(k)}`))]})}else y=t.jsx("input",{type:n.type==="string"?"text":"number",inputMode:n.type==="string"?void 0:"decimal",step:n.type==="integer"?1:"any",min:n.minimum,max:n.maximum,minLength:n.minLength,maxLength:n.maxLength,"aria-label":u,"aria-invalid":!!i,"aria-describedby":i?d:void 0,disabled:e.disabled,value:typeof c=="string"||typeof c=="number"?String(c):"",onChange:C=>e.onChange(n.name,C.target.value)});return t.jsxs("label",{className:s.actionParameter,children:[t.jsxs("span",{children:[u,n.required?" *":""]}),y,n.description&&t.jsx("small",{children:n.description}),i&&t.jsx("small",{id:d,className:s.actionParameterError,role:"alert",children:i})]},n.name)})})}function ct(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Uo(e){var P,E,W,$,ee,te;const{t:a}=ue(),[n,i]=o.useState(!1),[d,c]=o.useState({}),u=o.useRef(null),y=e.draft??Ht(e.action),m=o.useMemo(()=>[...e.action.parameters].sort((q,O)=>q.order-O.order),[e.action.parameters]),_=At(e.action,y),C=((P=e.state)==null?void 0:P.status)??"idle",k=C==="running",x=e.inactiveReason??a("playtest.actions.playRequired","Start Studio Play before running this action."),f=m.length===0?a("playtest.actions.noParameters","No input required"):m.map(q=>`${q.label}: ${ct(y[q.name])}`).join(" · "),V=Object.entries(e.action.fixedArguments).map(([q,O])=>`${q}: ${ct(O)}`).join(" · "),R=C==="running"?a("playtest.actions.running","Running…"):C==="succeeded"?a("playtest.actions.succeeded","Succeeded"):C==="failed"?((W=(E=e.state)==null?void 0:E.error)==null?void 0:W.message)??a("playtest.actions.failed","Failed"):C==="unknown"?a("playtest.actions.unknown","Result unknown"):" ",M=(q,O)=>{const z={...y,[q]:O};c(U=>{const L={...U};return delete L[q],L}),e.onDraftChange(e.action.id,z)},w=()=>{const q=At(e.action,y);if(!q.ok){c(q.errors);return}e.onExecute(e.action.id,structuredClone(q.arguments))},B=()=>{if(!_.ok){c(_.errors);return}const q=new Set(e.action.parameters.map(O=>O.name));e.onSaveDefaults(e.action.id,Object.fromEntries(Object.entries(_.arguments).filter(([O])=>q.has(O))))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.actionRow,"data-state":C,children:[t.jsxs("div",{className:s.rowIdentity,children:[t.jsx("strong",{children:e.action.label}),e.action.description&&t.jsx("span",{children:e.action.description}),((($=e.presentation)==null?void 0:$.pinned)||((ee=e.presentation)==null?void 0:ee.group))&&t.jsxs("span",{className:s.presentationMeta,children:[e.presentation.pinned?a("playtest.values.pinned","Pinned"):"",e.presentation.pinned&&e.presentation.group?" · ":"",e.presentation.group??""]}),m.length>1&&t.jsx("button",{ref:u,type:"button",className:s.valueDetailButton,"aria-label":a("playtest.actions.settingsFor","Execution settings for {{label}}").replace("{{label}}",e.action.label),onClick:()=>i(!0),children:a("playtest.actions.settings","Execution settings")})]}),t.jsxs("div",{className:s.actionSummary,children:[t.jsx("span",{children:a("playtest.actions.parameters","Parameters")}),t.jsx("strong",{children:f})]}),t.jsxs("div",{className:s.actionExecution,children:[m.length===1&&t.jsx(Et,{action:e.action,draft:y,errors:d,disabled:k,onChange:M}),t.jsx(Oe,{active:e.active,label:e.action.label,reason:x,children:t.jsx("button",{type:"button",className:s.primaryAction,"aria-label":a("playtest.actions.runLabel","Run {{label}}").replace("{{label}}",e.action.label),disabled:!e.active||k,onClick:w,children:k?a("playtest.actions.running","Running…"):a("playtest.actions.run","Run")})}),t.jsx("span",{className:s.rowFeedback,"data-state":C,"aria-live":"polite",children:R}),!e.active&&t.jsx("span",{className:s.actionInactiveReason,children:x})]})]}),t.jsx(_t,{open:n,title:e.action.label,description:a("playtest.actions.settings","Execution settings"),ariaLabel:a("playtest.actions.settingsDialog","{{label}} execution settings").replace("{{label}}",e.action.label),closeLabel:a("common.close","Close"),returnFocusTo:u.current,onClose:()=>i(!1),items:[{label:a("playtest.actions.parameters","Parameters"),value:t.jsx(Et,{action:e.action,draft:y,errors:d,disabled:k,onChange:M})},{label:a("playtest.actions.fixedArguments","Fixed arguments"),value:V||"—"},{label:a("playtest.actions.lastResult","Last result"),value:((te=e.state)==null?void 0:te.result)===void 0?R.trim()||"—":ct(e.state.result)}],actions:[{label:a("playtest.actions.saveDefaults","Save default inputs"),accessibleLabel:a("playtest.actions.saveDefaultsFor","Save default inputs for {{label}}").replace("{{label}}",e.action.label),variant:"secondary",disabled:k||!_.ok,onClick:B}]})]})}function Ko(e,a,n,i){const d=e.indexOf(a),c=e.indexOf(n);if(d<0||c<0||a===n)return[...e];const u=e.filter(_=>_!==a),y=u.indexOf(n),m=i==="after"?y+1:y;return u.splice(m,0,a),u}const Dt=["watches","controls","actions"];function zo(e,a){const n="path"in e&&e.path?[e.path.root,...e.path.segments].join("."):"",i="access"in e?e.access.adapter:e.executor.kind==="adapter"?e.executor.adapter:"",d="access"in e?e.access.name:e.executor.kind;return[e.id,e.label,a,n,i,d].filter(Boolean).join(" ").toLocaleLowerCase()}function Wo(e,a){if(a.kind==="action")return"unobserved";const n=e.watches[`${a.kind}:${a.binding.id}`];return(n==null?void 0:n.status)??"unobserved"}function Jo(e){var j,F,v,S,A,N,G,l;const{t:a}=ue(),[n,i]=o.useState(""),[d,c]=o.useState("all"),[u,y]=o.useState("all"),[m,_]=o.useState("all"),[C,k]=o.useState(new Set),[x,f]=o.useState(0),[V,R]=o.useState(50),[M,w]=o.useState(!1),[B,P]=o.useState(((F=(j=e.live.profile)==null?void 0:j.sectionOrder)==null?void 0:F.length)===3?e.live.profile.sectionOrder:Dt),[E,W]=o.useState(null),[$,ee]=o.useState(null),[te,q]=o.useState(null),[O,z]=o.useState(!1),[U,L]=o.useState(!1),[ae,J]=o.useState(""),[le,Q]=o.useState(null),[K,Z]=o.useState(()=>{var r;return((r=e.live.profile)==null?void 0:r.presentation)??{}}),[X,he]=o.useState({}),[re,oe]=o.useState({}),[ye,we]=o.useState(()=>{var r;return((r=e.live.profile)==null?void 0:r.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}}),H=e.live.profile,se=a("playtest.values.ungrouped","Ungrouped");o.useEffect(()=>{var r,g,D;P(((g=(r=e.live.profile)==null?void 0:r.sectionOrder)==null?void 0:g.length)===3?e.live.profile.sectionOrder:Dt),Z(((D=e.live.profile)==null?void 0:D.presentation)??{}),z(!1)},[(v=e.live.profile)==null?void 0:v.id,(S=e.live.profile)==null?void 0:S.presentation,(A=e.live.profile)==null?void 0:A.sectionOrder]),o.useEffect(()=>{var r;we(((r=e.live.profile)==null?void 0:r.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"})},[(N=e.live.profile)==null?void 0:N.id,(G=e.live.profile)==null?void 0:G.settings]);const ne=o.useMemo(()=>{if(!H)return{entries:[],total:0,pages:1,safePage:0,groups:[]};const r=[...H.controls.map((I,Y)=>({kind:"control",binding:I,sourceOrder:Y})),...H.watches.map((I,Y)=>({kind:"watch",binding:I,sourceOrder:H.controls.length+Y})),...(H.actions??[]).map((I,Y)=>({kind:"action",binding:I,sourceOrder:H.controls.length+H.watches.length+Y}))],g=Array.from(new Set(r.map(I=>{var Y;return((Y=K[I.binding.id])==null?void 0:Y.group)??se}))).sort((I,Y)=>I.localeCompare(Y)),D=n.trim().toLocaleLowerCase(),h=r.filter(I=>{var de;const Y=((de=K[I.binding.id])==null?void 0:de.group)??se;return(d==="all"||I.kind===d)&&(m==="all"||Y===m)&&(u==="all"||I.kind==="action"||Wo(e.live,I)===u)&&(!D||zo(I.binding,Y).includes(D))}).sort((I,Y)=>{if(I.kind!==Y.kind){const Pe=Te=>Te==="watch"?"watches":Te==="control"?"controls":"actions";return B.indexOf(Pe(I.kind))-B.indexOf(Pe(Y.kind))}const de=K[I.binding.id],je=K[Y.binding.id];return!!(de!=null&&de.pinned)!=!!(je!=null&&je.pinned)?de!=null&&de.pinned?-1:1:((de==null?void 0:de.order)??I.sourceOrder)-((je==null?void 0:je.order)??Y.sourceOrder)}),b=Math.max(1,Math.ceil(h.length/V)),T=Math.min(x,b-1);return{entries:h.slice(T*V,(T+1)*V),total:h.length,pages:b,safePage:T,groups:g}},[m,d,u,x,V,K,H,e.live,n,B,se]),ce=((H==null?void 0:H.controls.length)??0)+((H==null?void 0:H.watches.length)??0)+(((l=H==null?void 0:H.actions)==null?void 0:l.length)??0),ie=n.trim()!==""||d!=="all"||u!=="all"||m!=="all",Ne={watches:a("playtest.values.observedSection","Observed values"),controls:a("playtest.values.changeSection","Change values"),actions:a("playtest.actions.section","Actions")},ve=async r=>{q(null);try{await e.live.saveProfileMetadata(r)}catch(g){throw q(g instanceof Error?g.message:a("playtest.values.layoutSaveFailed","Could not save the display order")),g}},_e=r=>{we(r),ve({settings:r}).catch(()=>we((H==null?void 0:H.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}))},xe=r=>{if(!O||U||!B.includes(r))return;const g=B,D=B.indexOf(r),h=D===0?1:D-1,b=[...B];[b[D],b[h]]=[b[h],b[D]];const T=b;P(T),L(!0),ve({sectionOrder:T}).then(()=>J(a("playtest.values.layoutSaved","Display order saved"))).catch(()=>P(g)).finally(()=>L(!1))},Ce=r=>ne.entries.filter(g=>g.kind===r),be=(r,g,D,h)=>{var Pe,Te,Me;if(!H||!O||U)return;const b=K,T=g.map(Se=>Se.binding.id),I=Ko(T,r.binding.id,D,h);if(T.every((Se,ke)=>Se===I[ke]))return;const Y={...K},de=g.map(Se=>{var ke;return((ke=K[Se.binding.id])==null?void 0:ke.order)??Se.sourceOrder}).sort((Se,ke)=>Se-ke);for(const[Se,ke]of I.entries())Y[ke]={order:de[Se],pinned:((Pe=K[ke])==null?void 0:Pe.pinned)??!1,...(Te=K[ke])!=null&&Te.group?{group:(Me=K[ke])==null?void 0:Me.group}:{}};Z(Y),L(!0);const je=I.indexOf(r.binding.id)+1;ve({presentation:Y}).then(()=>J(a("playtest.values.movedTo","{{label}} moved to position {{position}}").replace("{{label}}",r.binding.label).replace("{{position}}",String(je)))).catch(()=>Z(b)).finally(()=>L(!1))},fe=r=>k(g=>{const D=new Set(g);return D.has(r)?D.delete(r):D.add(r),D}),Re=(r,g)=>{var Te,Me,Se,ke;const D=((Te=K[r.binding.id])==null?void 0:Te.group)??se,h=((Me=K[r.binding.id])==null?void 0:Me.pinned)??!1,b=g.filter(pe=>{var ge,Le;return(((ge=K[pe.binding.id])==null?void 0:ge.group)??se)===D&&(((Le=K[pe.binding.id])==null?void 0:Le.pinned)??!1)===h}),T=b.findIndex(pe=>pe.binding.id===r.binding.id),I=pe=>a(pe==="previous"?"playtest.values.movePrevious":"playtest.values.moveNext",`Move {{label}} ${pe}`).replace("{{label}}",r.binding.label),Y=a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",r.binding.label),de=e.active&&(e.live.studioMode!=="run"||r.binding.target.role==="server"),je=e.live.studioMode==="run"&&r.binding.target.role==="client"?a("playtest.controls.playModeRequired","Client test values are available in Play."):e.inactiveReason,Pe=`${H.id}:${((Se=e.live.lease)==null?void 0:Se.leaseId)??"edit"}:${r.binding.id}`;return t.jsxs("div",{className:s.valueEntryShell,"data-layout-editing":O,"data-drop-position":(le==null?void 0:le.id)===r.binding.id?le.placement:void 0,onDragOver:pe=>{if((E==null?void 0:E.kind)!==r.kind||!b.some(Kt=>Kt.binding.id===E.id))return;pe.preventDefault();const ge=pe.currentTarget.getBoundingClientRect(),lt=r.kind==="watch"?pe.clientX>=ge.left+ge.width/2?"after":"before":pe.clientY>=ge.top+ge.height/2?"after":"before";Q({id:r.binding.id,placement:lt})},onDrop:pe=>{if(pe.preventDefault(),(E==null?void 0:E.kind)===r.kind&&E.id!==r.binding.id&&(le==null?void 0:le.id)===r.binding.id){const ge=b.find(Le=>Le.binding.id===E.id);ge&&be(ge,b,r.binding.id,le.placement)}W(null),Q(null)},children:[O&&t.jsxs("div",{className:s.valueReorderControls,children:[t.jsx("button",{type:"button",className:s.dragHandle,draggable:!0,"aria-label":Y,disabled:U,onDragStart:()=>W({kind:r.kind,id:r.binding.id}),onDragEnd:()=>{W(null),Q(null)},children:t.jsx(Nt,{size:14,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":I("previous"),"aria-describedby":T<=0?"playtest-layout-boundary":void 0,disabled:U||T<=0,onClick:()=>be(r,b,b[T-1].binding.id,"before"),children:t.jsx(wt,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":I("next"),"aria-describedby":T===b.length-1?"playtest-layout-boundary":void 0,disabled:U||T<0||T===b.length-1,onClick:()=>be(r,b,b[T+1].binding.id,"after"),children:t.jsx(ht,{size:13,"aria-hidden":"true"})})]}),r.kind==="control"?t.jsx(Bo,{profile:{...H,controls:[r.binding],watches:[],settings:ye},active:de,inactiveReason:je,states:e.live.controls,watches:e.live.watches,draftScope:`${H.id}:${((ke=e.live.lease)==null?void 0:ke.leaseId)??"edit"}`,drafts:X[Pe]?{[r.binding.id]:X[Pe]}:void 0,onDraftChange:(pe,ge,Le)=>he(lt=>({...lt,[Pe]:{value:ge,dirty:Le}})),profileSaveLocked:!1,onApply:(pe,ge)=>void e.live.apply(pe,ge),onSaveValue:e.live.saveControlValue,onRemoveValue:pe=>e.live.saveProfileMetadata({removeDefaults:[pe]})}):r.kind==="watch"?t.jsx(Go,{profile:{...H,controls:[],watches:[r.binding]},watches:e.live.watches}):t.jsx(Uo,{action:r.binding,state:e.live.actions[r.binding.id],draft:re[`${H.id}:${r.binding.id}`]??Ht(r.binding),active:e.active&&e.live.studioState==="Running"&&(e.live.studioMode!=="run"||r.binding.target.role==="server"),inactiveReason:e.live.studioState==="Paused"?a("playtest.actions.resumeRequired","Resume Studio before running this action."):e.live.studioMode==="run"&&r.binding.target.role==="client"?a("playtest.actions.playModeRequired","This action is available in Play."):e.inactiveReason,presentation:K[r.binding.id],onDraftChange:(pe,ge)=>oe(Le=>({...Le,[`${H.id}:${r.binding.id}`]:ge})),onExecute:(pe,ge)=>void e.live.executeAction(pe,ge,crypto.randomUUID()),onSaveDefaults:e.live.saveActionDefaults})]},`${r.kind}:${r.binding.id}`)},p=r=>{var T;const D=Ce(r==="watches"?"watch":r==="controls"?"control":"action"),h=new Map;for(const I of D){const Y=((T=K[I.binding.id])==null?void 0:T.group)??se;h.set(Y,[...h.get(Y)??[],I])}const b=Ne[r];return t.jsxs("section",{className:s.valueSection,"aria-label":b,onDragOver:I=>{$&&$!==r&&I.preventDefault()},onDrop:I=>{!$||$===r||(I.preventDefault(),xe($),ee(null))},children:[t.jsxs("header",{className:s.valueSectionHeader,children:[t.jsxs("div",{className:s.valueSectionHeading,children:[O&&t.jsx("button",{type:"button",className:s.sectionDragHandle,draggable:!0,"aria-label":a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",b),disabled:U,onDragStart:()=>ee(r),onDragEnd:()=>ee(null),children:t.jsx(Nt,{size:15,"aria-hidden":"true"})}),t.jsx("h3",{children:b}),t.jsx("span",{className:s.valueSectionCount,children:D.length})]}),t.jsxs("div",{className:s.valueSectionHeaderActions,children:[r==="controls"&&H&&t.jsxs("div",{className:s.runtimeSettings,children:[t.jsx(Oe,{active:e.live.canMutate,label:a("playtest.settings.applyChangesAutomatically","Apply changes automatically"),reason:e.inactiveReason??a("playtest.controls.proRequired","Real-time value editing and Reset all are available with Pro."),children:t.jsxs("label",{className:s.runtimeSettingSwitch,children:[t.jsx("span",{children:a("playtest.settings.applyChangesAutomatically","Apply changes automatically")}),t.jsx("input",{className:s.runtimeSettingSwitchInput,type:"checkbox",role:"switch",checked:ye.runtimeApplyMode==="auto",disabled:!e.live.canMutate,onChange:I=>{_e({...ye,runtimeApplyMode:I.target.checked?"auto":"manual"})}}),t.jsx("span",{className:s.runtimeSettingSwitchTrack,"aria-hidden":"true",children:t.jsx("span",{className:s.runtimeSettingSwitchThumb})})]})}),t.jsx(Oe,{active:e.live.canMutate,label:a("playtest.settings.applyDefaultsOnPlayStart","Apply saved defaults when Play starts"),reason:e.inactiveReason??a("playtest.controls.proRequired","Real-time value editing and Reset all are available with Pro."),children:t.jsxs("label",{className:s.runtimeSettingSwitch,children:[t.jsx("span",{children:a("playtest.settings.applyDefaultsOnPlayStart","Apply saved defaults when Play starts")}),t.jsx("input",{className:s.runtimeSettingSwitchInput,type:"checkbox",role:"switch",checked:ye.applyDefaultsOnManualPlayStart,disabled:!e.live.canMutate,onChange:I=>_e({...ye,applyDefaultsOnManualPlayStart:I.target.checked})}),t.jsx("span",{className:s.runtimeSettingSwitchTrack,"aria-hidden":"true",children:t.jsx("span",{className:s.runtimeSettingSwitchThumb})})]})})]}),O&&t.jsx("button",{type:"button",className:s.sectionMoveButton,disabled:U,"aria-label":a(B[0]===r?"playtest.values.moveDown":"playtest.values.moveUp",B[0]===r?"Move {{label}} down":"Move {{label}} up").replace("{{label}}",b),onClick:()=>xe(r),children:B[0]===r?t.jsx(ht,{size:14,"aria-hidden":"true"}):t.jsx(wt,{size:14,"aria-hidden":"true"})})]})]}),D.length===0?t.jsx("div",{className:s.panelEmpty,children:r==="watches"?a("playtest.watch.empty","Observed values appear here during Play."):r==="controls"?a("playtest.controls.empty","No test controls in this profile yet."):a("playtest.actions.empty","No actions in this profile yet.")}):t.jsx("div",{className:r==="watches"?s.watchValueGrid:r==="controls"?s.controlValueList:s.actionValueList,children:Array.from(h.entries()).map(([I,Y])=>{const de=C.has(`${r}:${I}`),je=t.jsx("div",{className:s.valueGroupRows,children:Y.map(Pe=>Re(Pe,D))});return h.size===1&&I===se?t.jsx("div",{className:s.valueGroup,children:je},`${r}:${I}`):t.jsxs("section",{className:s.valueGroup,children:[t.jsxs("button",{type:"button",className:s.valueGroupToggle,"aria-expanded":!de,"aria-label":`${de?a("playtest.values.expandGroup","Expand"):a("playtest.values.collapseGroup","Collapse")} ${I}`,onClick:()=>fe(`${r}:${I}`),children:[t.jsx("span",{children:I}),t.jsx("span",{children:Y.length})]}),!de&&je]},`${r}:${I}`)})})]},r)};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.valueToolbar,children:[t.jsxs("label",{className:s.valueSearch,children:[t.jsx("span",{className:s.srOnly,children:a("playtest.values.search","Search test values")}),t.jsx("input",{type:"search","aria-label":a("playtest.values.search","Search test values"),value:n,onChange:r=>{i(r.target.value),f(0)},placeholder:a("playtest.values.searchPlaceholder","Name, group, source, or path")})]}),t.jsxs("button",{type:"button",className:s.secondaryAction,"aria-expanded":M,"aria-controls":"playtest-value-filters",onClick:()=>w(r=>!r),children:[a("playtest.values.filters","Filters"),ie?` (${[n.trim()!=="",d!=="all",u!=="all",m!=="all"].filter(Boolean).length})`:""]})]}),M&&t.jsxs("div",{className:s.valueFilters,id:"playtest-value-filters",children:[t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.kind","Value type")}),t.jsxs("select",{"aria-label":a("playtest.values.kind","Value type"),value:d,onChange:r=>{c(r.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.all","All values")}),t.jsx("option",{value:"control",children:a("playtest.values.controls","Controls")}),t.jsx("option",{value:"watch",children:a("playtest.values.watches","Watch Values")}),t.jsx("option",{value:"action",children:a("playtest.actions.section","Actions")})]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.status","Observation status")}),t.jsxs("select",{"aria-label":a("playtest.values.status","Observation status"),value:u,onChange:r=>{y(r.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.statusAll","All statuses")}),t.jsx("option",{value:"fresh",children:a("playtest.watch.fresh","Fresh")}),t.jsx("option",{value:"stale",children:a("playtest.watch.stale","Stale")}),t.jsx("option",{value:"unavailable",children:a("playtest.watch.unavailable","Unavailable")}),t.jsx("option",{value:"unobserved",children:a("playtest.watch.notObserved","Not observed yet")})]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.group","Group")}),t.jsxs("select",{"aria-label":a("playtest.values.group","Group"),value:m,onChange:r=>{_(r.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.allGroups","All groups")}),ne.groups.map(r=>t.jsx("option",{value:r,children:r},r))]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.pageSize","Rows")}),t.jsxs("select",{"aria-label":a("playtest.values.pageSize","Rows"),value:V,onChange:r=>{R(Number(r.target.value)),f(0)},children:[t.jsx("option",{value:"25",children:"25"}),t.jsx("option",{value:"50",children:"50"}),t.jsx("option",{value:"100",children:"100"})]})]})]}),t.jsxs("div",{className:s.valueListStatus,children:[t.jsx("div",{className:s.valueCount,role:"status",children:a("playtest.values.count","{{visible}} of {{total}} values").replace("{{visible}}",String(ne.total)).replace("{{total}}",String(ce))}),t.jsx("button",{type:"button",className:s.secondaryAction,disabled:U||ce===0,onClick:()=>{if(O){z(!1);return}ie&&(i(""),c("all"),y("all"),_("all"),f(0)),z(!0)},children:O?a("playtest.values.doneLayout","Done editing layout"):ie?a("playtest.values.editFullList","Edit full list"):a("playtest.values.editLayout","Edit layout")})]}),O&&t.jsx("div",{className:s.layoutHint,id:"playtest-layout-boundary",children:a("playtest.values.layoutBoundary","Move items within the current group and pinned section.")}),t.jsx("span",{className:s.srOnly,"aria-live":"polite",children:ae}),te&&t.jsx("div",{className:s.layoutError,role:"alert",children:te}),ne.total===0&&ce>0?t.jsx("div",{className:s.panelEmpty,children:a("playtest.values.noResults","No values match these filters.")}):t.jsx("div",{className:s.valueSections,children:B.map(p)}),ne.pages>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:ne.safePage===0,onClick:()=>f(r=>r-1),children:a("playtest.values.previous","Previous")}),t.jsxs("span",{children:[ne.safePage+1," / ",ne.pages]}),t.jsx("button",{type:"button",disabled:ne.safePage+1>=ne.pages,onClick:()=>f(r=>r+1),children:a("playtest.values.next","Next")})]})]})}const Yo="_emptyState_10pjf_1",Qo="_header_10pjf_11",Xo="_method_10pjf_12",Zo="_methods_10pjf_39",ec="_singleMethod_10pjf_45",tc="_methodTitle_10pjf_57",ac="_moreExamples_10pjf_70",sc="_hint_10pjf_88",nc="_tierNote_10pjf_89",ic="_disabledReason_10pjf_90",lc="_primaryAction_10pjf_102",Ee={emptyState:Yo,header:Qo,method:Xo,methods:Zo,singleMethod:ec,methodTitle:tc,moreExamples:ac,hint:sc,tierNote:nc,disabledReason:ic,primaryAction:lc};function Ut(e){const{t:a}=ue(),n=e.kind==="no-results",i=e.kind==="no-profile",d=n?a("playtest.emptyResults.title","Ask AI to check your game"):i?a("playtest.emptyValues.noProfileTitle","Prepare values and actions to test"):a("playtest.emptyValues.noValuesTitle","Add test values and actions to this profile"),c=n?a("playtest.emptyResults.description","When AI finishes the test, you can review pass, failure, and the reason here."):i?a("playtest.emptyValues.noProfileDescription","Ask AI to prepare values to observe or change and actions to run during Play, or select an object in Studio and add one directly."):a("playtest.emptyValues.noValuesDescription","Use the selected profile, {{name}}, to collect values to observe or change and actions to run during Play.").replace("{{name}}",e.profileName??"");return t.jsxs("section",{className:Ee.emptyState,children:[t.jsxs("header",{className:Ee.header,children:[t.jsx("h3",{children:d}),t.jsx("p",{children:c})]}),t.jsxs("div",{className:`${Ee.methods} ${n?Ee.singleMethod:""}`,children:[t.jsxs("section",{className:Ee.method,children:[t.jsxs("div",{className:Ee.methodTitle,children:[t.jsx(da,{size:16,"aria-hidden":"true"}),t.jsx("h4",{children:a("playtest.emptyValues.aiTitle","Ask AI")})]}),!n&&t.jsx("p",{children:a("playtest.emptyValues.aiDescription","Copy a request and paste it into an AI chat connected to WEPPY.")}),t.jsx(jt,{exampleIds:n?["automated-check"]:["character"]}),!n&&t.jsxs("details",{className:Ee.moreExamples,children:[t.jsx("summary",{children:a("playtest.ai.otherExamples","Other request examples")}),t.jsx(jt,{exampleIds:["selection","game-state","action"]})]}),n&&e.isBasic&&t.jsx("p",{className:Ee.tierNote,children:a("playtest.emptyResults.proDescription","Automated test runs and actual saved results are available with Pro.")})]}),!n&&t.jsxs("section",{className:Ee.method,children:[t.jsxs("div",{className:Ee.methodTitle,children:[t.jsx(Ca,{size:16,"aria-hidden":"true"}),t.jsx("h4",{children:a("playtest.emptyValues.directTitle","Select and add it yourself")})]}),t.jsx("p",{children:a("playtest.emptyValues.directDescription","Select an object in Studio, then choose a supported value to observe or change, or an available action.")}),i&&t.jsx("p",{className:Ee.hint,children:a("playtest.emptyValues.firstProfileHint","When you add the first item, enter a profile name to keep related test settings together.")}),t.jsx("button",{type:"button",className:Ee.primaryAction,disabled:!!e.directAddDisabledReason,"aria-describedby":e.directAddDisabledReason?"playtest-empty-direct-reason":void 0,onClick:e.onAddFromSelection,children:a("playtest.emptyValues.directAction","Add selected Studio value")}),e.directAddDisabledReason&&t.jsx("p",{className:Ee.disabledReason,id:"playtest-empty-direct-reason",children:e.directAddDisabledReason})]})]})]})}function rc(e){var m,_,C,k,x,f,V;const{live:a}=e,{t:n}=ue(),i=((m=a.lease)==null?void 0:m.state)==="active"&&(a.studioState==="Running"||a.studioState==="Paused"),d=i&&a.canMutate,c=d&&(a.studioMode!=="run"||!!((_=a.profile)!=null&&_.controls.some(R=>R.target.role==="server"))),u=e.inactiveReason??n("playtest.values.playRequired","Start Play in Studio to change test values."),y=(((C=a.profile)==null?void 0:C.controls.length)??0)+(((k=a.profile)==null?void 0:k.watches.length)??0)+(((f=(x=a.profile)==null?void 0:x.actions)==null?void 0:f.length)??0);return t.jsxs("div",{className:s.liveWorkspace,role:"tabpanel","aria-label":n("playtest.view.liveSession","Test Values"),children:[t.jsxs("section",{className:s.profileToolbar,children:[t.jsxs("div",{children:[t.jsxs("div",{className:s.profileLabelRow,children:[t.jsx("label",{htmlFor:"playtest-profile",children:n("playtest.profile.label","Test profiles")}),t.jsx("span",{children:n("playtest.profile.savedCount","{{count}} profiles saved").replace("{{count}}",String(a.profiles.length))})]}),t.jsxs("select",{id:"playtest-profile",value:a.selectedProfileId??"",disabled:!!a.switchingProfileId,"aria-busy":!!a.switchingProfileId,onChange:R=>void a.selectProfile(R.target.value),children:[a.profiles.length===0&&t.jsx("option",{value:"",children:n("playtest.profile.empty","No profiles yet")}),a.profiles.map(R=>t.jsx("option",{value:R.id,children:R.name},R.id))]})]}),t.jsxs("div",{className:s.profileActions,children:[t.jsxs("button",{type:"button",className:s.primaryAction,onClick:e.onManageValues,children:[t.jsx(ja,{size:14,"aria-hidden":"true"})," ",n("playtest.values.addValue","Add value")]}),t.jsxs("button",{type:"button",className:s.secondaryAction,disabled:!a.profile||!!a.switchingProfileId,onClick:e.onEditProfile,children:[t.jsx(Pa,{size:14,"aria-hidden":"true"})," ",n("playtest.profile.edit","Edit profile")]}),t.jsxs("button",{type:"button",className:s.secondaryAction,disabled:!!a.switchingProfileId,onClick:e.onNewProfile,children:[t.jsx(Ot,{size:14,"aria-hidden":"true"})," ",n("playtest.profile.new","New profile")]})]})]}),a.switchingProfileId&&t.jsx("div",{className:s.controlAvailability,role:"status","aria-live":"polite",children:n("playtest.profile.switching","Switching test profile…")}),a.loading?t.jsx("div",{className:s.panelEmpty,children:n("common.loading","Loading...")}):y===0?t.jsx(Ut,{kind:a.profile?"no-values":"no-profile",profileName:(V=a.profile)==null?void 0:V.name,onAddFromSelection:e.onManageValues,directAddDisabledReason:e.directAddDisabledReason}):t.jsx("div",{className:s.liveGrid,children:t.jsxs("section",{className:`${s.livePanel} ${s.valueWorkspacePanel}`,"data-runtime-state":i?"active":"inactive",children:[t.jsxs("header",{className:s.valueWorkspaceHeader,children:[t.jsxs("div",{children:[t.jsx("strong",{children:n("playtest.values.title","Test values")}),!d&&t.jsxs("span",{className:s.controlAvailability,"data-warning":a.studioState==="Edit",id:"playtest-controls-availability",role:"status",children:[a.studioState==="Edit"&&t.jsx(Ia,{size:14,"aria-hidden":"true"}),u]})]}),t.jsx(Oe,{active:c,label:n("playtest.session.reset","Reset all"),reason:u,children:t.jsxs("button",{type:"button",className:s.resetAction,disabled:!c,"aria-describedby":c?void 0:"playtest-controls-availability",onClick:()=>void a.resetAll(),children:[a.canMutate?t.jsx(Ea,{size:14,"aria-hidden":"true"}):t.jsx(wa,{size:14,"aria-hidden":"true"}),n("playtest.session.reset","Reset all")]})})]}),t.jsx(Jo,{live:a,active:d,inactiveReason:u})]})})]})}const dt={label:"",role:"server",path:"Workspace",accessKind:"attribute",fieldName:"",editorType:"number",defaultValue:"0",minimum:"0",maximum:"100",step:"1"};function oc(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"binding"}function It(e){const a=e.split(".").map(n=>n.trim()).filter(Boolean);return a.length>0?{root:a[0],segments:a.slice(1)}:null}function $e(e){return e==="range"?"number":e}function cc(e){var n;if(Ge($e(e.editorType)))return xt($e(e.editorType),e.defaultValue)??null;if(e.editorType==="enum")return((n=e.enumValues)==null?void 0:n.find(i=>String(i)===e.defaultValue))??null;if(e.editorType==="boolean")return e.defaultValue==="true";if(e.editorType==="string")return e.defaultValue;const a=Number(e.defaultValue);return Number.isFinite(a)?a:null}function Tt(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName.trim()}}function dc(e){var d,c;if("executor"in e)return`${e.target.role} · ${e.executor.kind} · ${e.parameters.length} parameters`;const a=e.path?[e.path.root,...e.path.segments].join("."):"adapter",n=e.access.kind==="value"?"Value":e.access.name??e.access.kind,i="constraints"in e&&((d=e.constraints)==null?void 0:d.minimum)!==void 0&&((c=e.constraints)==null?void 0:c.maximum)!==void 0;return`${e.target.role} · ${a} · ${n} · ${i?"range":e.valueType}`}function uc(e){var _e,xe,Ce,be,fe,Re;const{t:a}=ue(),n=!!e.profile,[i,d]=o.useState(""),[c,u]=o.useState([]),[y,m]=o.useState([]),[_,C]=o.useState([]),[k,x]=o.useState({}),[f,V]=o.useState("controls"),[R,M]=o.useState(!1),[w,B]=o.useState(dt),[P,E]=o.useState(!1),[W,$]=o.useState(!1),[ee,te]=o.useState(!1),[q,O]=o.useState(!1),[z,U]=o.useState(null),[L,ae]=o.useState(null),J=o.useRef(null);o.useEffect(()=>{var p,j,F,v,S;e.open&&(d(((p=e.profile)==null?void 0:p.name)??""),u(((j=e.profile)==null?void 0:j.controls)??[]),m(((F=e.profile)==null?void 0:F.watches)??[]),C(((v=e.profile)==null?void 0:v.actions)??[]),x(((S=e.profile)==null?void 0:S.presentation)??{}),V("controls"),M(!1),B(dt),$(!1),te(!1),O(!1),ae(null),U(null))},[e.open,e.profile]);const le=f==="controls"?c:f==="watches"?y:_,Q=i!==(((_e=e.profile)==null?void 0:_e.name)??"")||JSON.stringify(c)!==JSON.stringify(((xe=e.profile)==null?void 0:xe.controls)??[])||JSON.stringify(y)!==JSON.stringify(((Ce=e.profile)==null?void 0:Ce.watches)??[])||JSON.stringify(_)!==JSON.stringify(((be=e.profile)==null?void 0:be.actions)??[])||JSON.stringify(k)!==JSON.stringify(((fe=e.profile)==null?void 0:fe.presentation)??{})||R,K=o.useMemo(()=>new Set([...c,...y,..._].map(p=>p.id)),[_,c,y]),Z=(p,j)=>{B(F=>({...F,[p]:j})),U(null)},X=()=>{const p=oc(w.label);let j=p,F=2;for(;K.has(j);)j=`${p}-${F}`,F+=1;return j},he=(p,j)=>k[p]??{order:j,pinned:!1},re=(p,j,F)=>x(v=>({...v,[p]:{...he(p,j),...F}})),oe=le.map((p,j)=>({binding:p,sourceOrder:j,entry:he(p.id,j)})).sort((p,j)=>p.entry.order-j.entry.order),ye=(p,j)=>{const F=oe.findIndex(A=>A.binding.id===p),v=oe[F+j],S=oe[F];!S||!v||x(A=>({...A,[S.binding.id]:{...S.entry,order:v.entry.order},[v.binding.id]:{...v.entry,order:S.entry.order}}))},we=()=>{const p=It(w.path),j=cc(w);if(!w.label.trim()||!p||w.accessKind!=="value"&&!w.fieldName.trim()||j===null)return null;const F=w.editorType==="range",v=Number(w.minimum),S=Number(w.maximum),A=Number(w.step);return F&&(typeof j!="number"||!Number.isFinite(v)||!Number.isFinite(S)||!Number.isFinite(A)||v>=S||A<=0||j<v||j>S)?null:{id:X(),label:w.label.trim(),target:{role:w.role},path:p,access:Tt(w),valueType:$e(w.editorType),value:j,...w.editorType==="enum"?{enumValues:w.enumValues}:{},applyTiming:"after_agents_ready",restorePolicy:"session_end",...F?{constraints:{minimum:v,maximum:S,step:A}}:{}}},H=()=>{const p=It(w.path);return!w.label.trim()||!p||w.accessKind!=="value"&&!w.fieldName.trim()?null:{id:X(),label:w.label.trim(),target:{role:w.role},path:p,access:Tt(w),valueType:$e(w.editorType)}},se=()=>{const p=f==="controls"?we():H();if(!p){U(a("playtest.profile.binding.invalid","Complete the label, path, field, and type values."));return}f==="controls"?u(j=>[...j,p]):m(j=>[...j,p]),x(j=>({...j,[p.id]:{order:c.length+y.length,pinned:!1}})),M(!1),B(dt)},ne=async()=>{if(e.onResolveSelectionCandidates){try{const j=await e.onResolveSelectionCandidates();if(!j.selected.path||j.candidates.length===0){U(a("playtest.profile.binding.selectionEmpty","The selected instance has no supported fields."));return}ae(j),ce(j,0)}catch(j){U(j instanceof Error?j.message:String(j))}return}if(!e.onResolveSelection)return;const p=f==="controls"?we():H();if(!p){U(a("playtest.profile.binding.selectionNeedsFields","Enter the label, field, and type before using the Studio selection."));return}try{const j=await e.onResolveSelection({kind:f==="controls"?"control":"watch",id:p.id,label:p.label,role:p.target.role,access:p.access,valueType:p.valueType,..."value"in p?{value:p.value}:{},..."constraints"in p&&p.constraints?{constraints:p.constraints}:{},..."enumValues"in p&&p.enumValues?{enumValues:p.enumValues}:{}});j.path&&Z("path",[j.path.root,...j.path.segments].join("."))}catch(j){U(j instanceof Error?j.message:String(j))}},ce=(p,j)=>{const F=p.candidates[j];if(!F||!p.selected.path)return;const v=F.fieldName??"Value";B(S=>({...S,label:`${p.selected.name??"Selected"} ${v}`,path:[p.selected.path.root,...p.selected.path.segments].join("."),accessKind:F.accessKind,fieldName:F.fieldName??"",editorType:F.valueType,defaultValue:typeof F.value=="object"?JSON.stringify(F.value):String(F.value),enumValues:F.enumValues})),U(null)},ie=async()=>{if(!(!e.profile||!e.onSave||!i.trim())){E(!0),U(null);try{await e.onSave({...e.profile,schemaVersion:4,name:i.trim(),controls:c,watches:y,actions:_,presentation:k}),e.onClose()}catch(p){U(p instanceof Error?p.message:String(p))}finally{E(!1)}}},Ne=()=>{if(!(P||q)){if(Q){$(!0);return}e.onClose()}},ve=async()=>{var p;if(!(!e.profile||!e.onDelete||q||e.deleteDisabledReason)){O(!0),U(null);try{await e.onDelete(e.profile.id,e.profile.revision),te(!1),e.onClose()}catch(j){const F=j&&typeof j=="object"?String("payload"in j&&((p=j.payload)==null?void 0:p.errorCode)||"error"in j&&j.error||"code"in j&&j.code||""):"";U(a(F==="profile_active"?"playtest.profile.deleteActive":F==="profile_revision_conflict"?"playtest.profile.deleteConflict":F==="profile_not_found"?"playtest.profile.deleteNotFound":F==="profile_scope_unavailable"?"playtest.profile.deleteScopeUnavailable":"playtest.profile.deleteFailed",j instanceof Error?j.message:"Could not delete the profile."))}finally{O(!1)}}};return t.jsxs(Ke,{open:e.open,onClose:Ne,dismissDisabled:P||q,initialFocusRef:J,ariaLabel:n?a("playtest.profile.editTitle","Edit test profile"):a("playtest.profile.createTitle","Create test profile"),children:[t.jsxs("div",{className:`${s.profileDialog} ${n?s.profileEditorDialog:""}`,children:[t.jsx(ze,{title:n?a("playtest.profile.editTitle","Edit test profile"):a("playtest.profile.createTitle","Create test profile"),description:n?a("playtest.profile.editDescription","Add controls you can change during Play and Watch Values you only want to observe."):a("playtest.profile.createDescription","Profiles are stored locally for the selected Place. Add controls after creating it."),closeLabel:a("common.close","Close"),closeDisabled:P||q,onRequestClose:Ne}),t.jsxs("div",{className:s.profileDialogBody,children:[t.jsxs("label",{children:[a("playtest.profile.name","Profile name"),t.jsx("input",{ref:J,value:i,onChange:p=>d(p.target.value)})]}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.bindingTabs,role:"tablist","aria-label":a("playtest.profile.bindingTabs","Profile values"),children:[t.jsxs("button",{type:"button",role:"tab","aria-selected":f==="controls",onClick:()=>{V("controls"),M(!1)},children:[a("playtest.profile.controlsTab","Controls")," ",t.jsx("span",{children:c.length})]}),t.jsxs("button",{type:"button",role:"tab","aria-selected":f==="watches",onClick:()=>{V("watches"),M(!1)},children:[a("playtest.profile.watchesTab","Watch Values")," ",t.jsx("span",{children:y.length})]}),t.jsxs("button",{type:"button",role:"tab","aria-selected":f==="actions",onClick:()=>{V("actions"),M(!1)},children:[a("playtest.actions.section","Actions")," ",t.jsx("span",{children:_.length})]})]}),t.jsx("div",{className:s.bindingList,children:le.length===0?t.jsx("div",{className:s.bindingEmpty,children:f==="controls"?a("playtest.profile.controlsEmpty","No controls added yet."):f==="watches"?a("playtest.profile.watchesEmpty","No Watch Values added yet."):a("playtest.actions.empty","No actions in this profile yet.")}):oe.map(({binding:p,entry:j,sourceOrder:F},v)=>t.jsxs("div",{className:s.bindingItem,children:[t.jsxs("div",{className:s.bindingItemCopy,children:[t.jsx("strong",{children:p.label}),t.jsx("span",{children:dc(p)}),t.jsxs("div",{className:s.bindingPresentation,children:[t.jsxs("label",{children:[a("playtest.profile.group","Group"),t.jsx("input",{"aria-label":a("playtest.profile.groupFor","Group for {{label}}").replace("{{label}}",p.label),value:j.group??"",onChange:S=>re(p.id,F,{group:S.target.value||void 0})})]}),t.jsxs("label",{className:s.bindingPin,children:[t.jsx("input",{type:"checkbox","aria-label":a("playtest.profile.pinLabel","Pin {{label}}").replace("{{label}}",p.label),checked:j.pinned,onChange:S=>re(p.id,F,{pinned:S.target.checked})}),a("playtest.profile.pin","Pin")]})]})]}),t.jsxs("div",{className:s.bindingItemActions,children:[t.jsx("button",{type:"button","aria-label":a("playtest.profile.moveUp","Move {{label}} up").replace("{{label}}",p.label),disabled:v===0,onClick:()=>ye(p.id,-1),children:t.jsx(ha,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":a("playtest.profile.moveDown","Move {{label}} down").replace("{{label}}",p.label),disabled:v===oe.length-1,onClick:()=>ye(p.id,1),children:t.jsx(fa,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button",className:s.bindingDelete,"aria-label":a("playtest.profile.removeBinding","Remove {{label}}").replace("{{label}}",p.label),onClick:()=>{f==="controls"?u(S=>S.filter(A=>A.id!==p.id)):f==="watches"?m(S=>S.filter(A=>A.id!==p.id)):C(S=>S.filter(A=>A.id!==p.id)),x(S=>Object.fromEntries(Object.entries(S).filter(([A])=>A!==p.id)))},children:t.jsx(St,{size:14,"aria-hidden":"true"})})]})]},p.id))}),f!=="actions"&&(R?t.jsxs("fieldset",{className:s.bindingForm,"aria-label":f==="controls"?a("playtest.profile.newControl","New control"):a("playtest.profile.newWatch","New watch"),children:[(e.onResolveSelectionCandidates||e.onResolveSelection)&&t.jsx("button",{type:"button",className:s.selectionButton,onClick:()=>void ne(),children:a("playtest.profile.binding.useSelection","Use current Studio selection")}),L&&L.candidates.length>1&&t.jsxs("label",{children:[a("playtest.profile.binding.selectedField","Selected field"),t.jsx("select",{onChange:p=>ce(L,Number(p.target.value)),children:L.candidates.map((p,j)=>t.jsx("option",{value:j,children:p.accessKind==="value"?"ValueBase.Value":`${p.accessKind} · ${p.fieldName}`},`${p.accessKind}:${p.fieldName??"Value"}`))})]}),t.jsxs("div",{className:s.bindingFormGrid,children:[t.jsxs("label",{children:[a("playtest.profile.binding.label","Label"),t.jsx("input",{value:w.label,onChange:p=>Z("label",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.role","Target"),t.jsxs("select",{value:w.role,onChange:p=>Z("role",p.target.value),children:[t.jsx("option",{value:"server",children:a("playtest.profile.binding.server","Server")}),t.jsx("option",{value:"client",children:a("playtest.profile.binding.client","Client")})]})]}),t.jsxs("label",{className:s.bindingPathField,children:[a("playtest.profile.binding.path","Runtime path"),t.jsx("input",{value:w.path,placeholder:a("playtest.profile.binding.pathPlaceholder","Workspace.Config"),onChange:p=>Z("path",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.access","Access"),t.jsxs("select",{value:w.accessKind,onChange:p=>Z("accessKind",p.target.value),children:[t.jsx("option",{value:"attribute",children:a("playtest.profile.binding.attribute","Attribute")}),t.jsx("option",{value:"value",children:a("playtest.profile.binding.valueBase","ValueBase.Value")}),t.jsx("option",{value:"property",children:a("playtest.profile.binding.property","Property")})]})]}),w.accessKind!=="value"&&t.jsxs("label",{children:[a("playtest.profile.binding.field","Field name"),t.jsx("input",{value:w.fieldName,onChange:p=>Z("fieldName",p.target.value)})]}),t.jsxs("label",{children:[f==="controls"?a("playtest.profile.binding.inputType","Input type"):a("playtest.profile.binding.valueType","Value type"),t.jsxs("select",{value:w.editorType,onChange:p=>Z("editorType",p.target.value),children:[t.jsx("option",{value:"number",children:a("playtest.profile.binding.number","Number")}),f==="controls"&&t.jsx("option",{value:"range",children:a("playtest.profile.binding.range","Range")}),t.jsx("option",{value:"string",children:a("playtest.profile.binding.string","String")}),t.jsx("option",{value:"boolean",children:a("playtest.profile.binding.boolean","Boolean")}),t.jsx("option",{value:"vector3",children:a("playtest.profile.binding.vector3","Vector3")}),t.jsx("option",{value:"color3",children:a("playtest.profile.binding.color3","Color3")}),t.jsx("option",{value:"cframe",children:a("playtest.profile.binding.cframe","CFrame")}),w.enumValues&&t.jsx("option",{value:"enum",children:a("playtest.profile.binding.enum","Enum")})]})]}),f==="controls"&&Ge($e(w.editorType))&&t.jsx(yt,{type:$e(w.editorType),draft:w.defaultValue,label:a("playtest.profile.binding.defaultValue","Default value"),onChange:p=>Z("defaultValue",p)}),f==="controls"&&w.editorType==="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("select",{value:w.defaultValue,onChange:p=>Z("defaultValue",p.target.value),children:(Re=w.enumValues)==null?void 0:Re.map(p=>t.jsx("option",{value:String(p),children:String(p)},String(p)))})]}),f==="controls"&&!Ge($e(w.editorType))&&w.editorType!=="boolean"&&w.editorType!=="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("input",{type:w.editorType==="string"?"text":"number",value:w.defaultValue,onChange:p=>Z("defaultValue",p.target.value)})]}),f==="controls"&&w.editorType==="boolean"&&t.jsxs("label",{className:s.bindingBooleanDefault,children:[t.jsx("input",{type:"checkbox","aria-label":a("playtest.profile.binding.defaultValue","Default value"),checked:w.defaultValue==="true",onChange:p=>Z("defaultValue",String(p.target.checked))}),t.jsx("span",{children:a("playtest.profile.binding.defaultValue","Default value")})]}),f==="controls"&&w.editorType==="range"&&t.jsxs("div",{className:s.rangeFields,children:[t.jsxs("label",{children:[a("playtest.profile.binding.minimum","Minimum"),t.jsx("input",{type:"number",value:w.minimum,onChange:p=>Z("minimum",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.maximum","Maximum"),t.jsx("input",{type:"number",value:w.maximum,onChange:p=>Z("maximum",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.step","Step"),t.jsx("input",{type:"number",value:w.step,onChange:p=>Z("step",p.target.value)})]})]})]}),z&&t.jsx("div",{className:s.bindingError,role:"alert",children:z}),t.jsxs("div",{className:s.bindingFormActions,children:[t.jsx("button",{type:"button",className:s.secondaryAction,onClick:()=>{M(!1),U(null)},children:a("common.cancel","Cancel")}),t.jsx("button",{type:"button",className:s.primaryAction,onClick:se,children:a("playtest.profile.binding.add","Add to profile")})]})]}):t.jsxs("button",{type:"button",className:s.addBindingButton,onClick:()=>M(!0),children:[t.jsx(Ot,{size:14,"aria-hidden":"true"})," ",f==="controls"?a("playtest.profile.addControl","Add control"):a("playtest.profile.addWatch","Add watch")]}))]}),z&&!R&&t.jsx("div",{className:s.bindingError,role:"alert",children:z})]}),t.jsxs("div",{className:s.profileDialogActions,children:[n&&e.onDelete&&t.jsxs("button",{type:"button",className:`${s.stopAction} ${s.profileDeleteAction}`,disabled:P||q||!!e.deleteDisabledReason,title:e.deleteDisabledReason,onClick:()=>te(!0),children:[t.jsx(St,{size:14,"aria-hidden":"true"})," ",a("playtest.profile.delete","Delete profile")]}),n&&e.deleteDisabledReason&&t.jsx("span",{className:s.profileDeleteReason,role:"status",children:e.deleteDisabledReason}),t.jsx("button",{type:"button",className:s.secondaryAction,disabled:P||q,onClick:Ne,children:a("common.cancel","Cancel")}),n?t.jsx("button",{type:"button",className:s.primaryAction,disabled:!i.trim()||P,onClick:()=>void ie(),children:P?a("playtest.profile.saving","Saving…"):a("playtest.profile.save","Save profile")}):t.jsx("button",{type:"button",className:s.primaryAction,disabled:!i.trim()||P,onClick:async()=>{E(!0);try{await e.onCreate(i),d(""),e.onClose()}finally{E(!1)}},children:P?a("playtest.profile.creating","Creating…"):a("playtest.profile.createTitle","Create test profile")})]})]}),t.jsx(mt,{open:W,title:a("playtest.profile.discardTitle","Discard profile changes?"),message:a("playtest.profile.discardMessage","Your unsaved profile changes will be lost."),cancelLabel:a("playtest.profile.keepEditing","Keep editing"),confirmLabel:a("playtest.profile.discard","Discard changes"),onCancel:()=>$(!1),onConfirm:()=>{$(!1),e.onClose()}}),t.jsx(mt,{open:ee,title:a("playtest.profile.deleteConfirmTitle","Delete test profile?"),message:e.profile?[a("playtest.profile.deleteConfirmMessage","Delete “{{name}}”? Its {{controls}} control values and {{watches}} observed values will be removed. Game objects, scripts, test connection code, other profiles, and automated test results will remain.").replace("{{name}}",e.profile.name).replace("{{controls}}",String(e.profile.controls.length)).replace("{{watches}}",String(e.profile.watches.length)),Q?a("playtest.profile.deleteDirty","Unsaved edits will also be discarded."):""].filter(Boolean).join(" "):"",cancelLabel:a("common.cancel","Cancel"),confirmLabel:a("playtest.profile.delete","Delete profile"),loading:q,onCancel:()=>{q||te(!1)},onConfirm:()=>void ve()})]})}function Fe(e){return`${e.accessKind}:${e.fieldName??"Value"}`}function et(e){return e.fieldName??"Value"}function pc(e){const{t:a}=ue(),n=o.useId(),[i,d]=o.useState(!1),[c,u]=o.useState(""),y=o.useRef(null),m=o.useRef(null),_=o.useRef(null),C=c.trim().toLocaleLowerCase(),k=o.useMemo(()=>e.candidates.filter(P=>`${et(P)} ${P.accessKind}`.toLocaleLowerCase().includes(C)),[C,e.candidates]),x=["attribute","value","property"].map(P=>({kind:P,candidates:k.filter(E=>E.accessKind===P)})).filter(P=>P.candidates.length>0),f=et(e.selected);o.useEffect(()=>{var P;i&&((P=m.current)==null||P.focus())},[i]);const V=(P=!0)=>{var E;d(!1),u(""),P&&((E=y.current)==null||E.focus())},R=()=>{var P;return Array.from(((P=_.current)==null?void 0:P.querySelectorAll('[role="option"]'))??[])},M=P=>{var W;const E=R();(W=E[Math.max(0,Math.min(P,E.length-1))])==null||W.focus()},w=P=>{e.onSelect(P),V()},B=P=>P==="attribute"?a("playtest.profile.binding.attribute","Attribute"):P==="value"?a("playtest.profile.binding.valueBase","ValueBase.Value"):a("playtest.profile.binding.property","Property");return t.jsxs("div",{className:s.propertyPicker,children:[t.jsx("span",{className:s.propertyPickerLabel,children:a("playtest.values.selectProperty","Property")}),t.jsxs("button",{ref:y,type:"button",className:s.propertyPickerTrigger,disabled:e.disabled,"aria-haspopup":"listbox","aria-expanded":i,"aria-controls":i?n:void 0,"aria-label":`${a("playtest.values.propertyPickerAction","Select property")}: ${f}`,onClick:()=>{i?V(!1):d(!0)},children:[t.jsx("span",{children:f}),t.jsx(ht,{size:16,"aria-hidden":"true"})]}),i&&t.jsxs("div",{ref:_,className:s.propertyPickerPanel,onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),V())},children:[t.jsxs("div",{className:s.propertyPickerSearchRow,children:[t.jsxs("label",{children:[a("playtest.values.searchProperties","Search properties"),t.jsx("input",{ref:m,type:"search",value:c,onChange:P=>u(P.target.value),onKeyDown:P=>{P.key==="ArrowDown"&&(P.preventDefault(),M(0))}})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.propertyPickerClose","Close property picker"),onClick:()=>V(),children:t.jsx(Vt,{size:16,"aria-hidden":"true"})})]}),t.jsxs("div",{id:n,className:s.propertyPickerList,role:"listbox","aria-label":a("playtest.values.availableProperties","Available properties"),children:[x.map(P=>t.jsxs("div",{className:s.propertyPickerGroup,role:"group","aria-label":B(P.kind),children:[t.jsx("span",{children:B(P.kind)}),P.candidates.map(E=>{const W=Fe(E)===Fe(e.selected);return t.jsxs("div",{role:"option",tabIndex:0,"aria-selected":W,"aria-label":et(E),className:s.propertyPickerOption,onClick:()=>w(E),onKeyDown:$=>{var q;const te=R().indexOf($.currentTarget);$.key==="ArrowDown"&&($.preventDefault(),M(te+1)),$.key==="ArrowUp"&&($.preventDefault(),te===0?(q=m.current)==null||q.focus():M(te-1)),($.key==="Enter"||$.key===" ")&&($.preventDefault(),w(E))},children:[t.jsx("span",{children:et(E)}),t.jsx("small",{children:E.valueType}),W&&t.jsx(ua,{size:15,"aria-hidden":"true"})]},Fe(E))})]},P.kind)),k.length===0&&t.jsx("p",{role:"status",children:a("playtest.values.noProperties","No matching properties")})]})]})]})}const Lt=`local RunService = game:GetService("RunService")
71
+ [sample] preview report finished`),contextId:"sample_playtest_preview",contextSummary:n,artifactErrors:[],result:{schemaVersion:1,sessionId:"sample-session",recordId:"sample_playtest_preview",testName:e("playtest.sample.history.name","Sample Arena Smoke Test"),executionKind:"structured_session",overallStatus:"passed",overallPassed:!0,terminalReason:{code:"all_required_evidence_passed",message:e("playtest.sample.terminal","All required evidence passed")},mode:"play",place:{placeName:e("playtest.sample.place","Sample Arena")},startedAt:a,endedAt:"2026-03-27T15:26:04.820Z",durationMs:4820,agents:[{agentId:"sample-server-agent",role:"server"},{agentId:"sample-client-agent",role:"client",clientId:"client-1"}],capabilities:{semanticUiSnapshot:!0,virtualInput:!0,fixedBootstrap:!0,projectTestAdapter:!1},requiredEvidence:{server:!0,clientUi:!0,interaction:!0,visual:!1},dimensions:{server:{required:!0,status:"passed",stepIds:["wave-started"]},clientUi:{required:!0,status:"passed",stepIds:["hud-visible"]},interaction:{required:!0,status:"passed",provider:"virtual_input",stepIds:["start-click"]},visual:{required:!1,status:"not_requested",reason:"not_requested",stepIds:[]}},limitations:[{code:"play_screenshot_unsupported",message:e("playtest.sample.limit.visual","Play screenshot evidence is unavailable in structured session v1")}],steps:[{index:0,stepId:"start-click",target:{role:"client",clientId:"client-1"},action:"input_click",dimension:"interaction",required:!0,status:"passed",startedAt:a,endedAt:"2026-03-27T15:26:00.120Z",durationMs:120,expected:{activated:!0},observed:{activated:!0},evidence:{delivery:"VirtualInput",observation:"GuiButton.Activated"}}],cleanup:{status:"passed",errors:[]},artifacts:{status:"complete",files:["test-result.json","test-report.md","test-log.txt","test-context.json"]}}}}}function Ve(e,a){switch(a){case"passed":return e("playtest.result.status.passed","Passed");case"failed":return e("playtest.result.status.failed","Failed");case"timed_out":return e("playtest.result.status.timedOut","Timed out");case"cancelled":return e("playtest.result.status.cancelled","Cancelled");case"insufficient_evidence":return e("playtest.result.status.insufficientEvidence","Insufficient evidence");case"unavailable":return e("playtest.result.status.unavailable","Unavailable");case"skipped":return e("playtest.result.status.skipped","Skipped");case"not_requested":return e("playtest.result.status.notRequested","Not requested");default:return e("playtest.result.status.unknown","Unknown")}}function gt(e){return e==="passed"?"✓":e==="failed"||e==="timed_out"?"×":e==="cancelled"||e==="insufficient_evidence"||e==="unavailable"?"!":"–"}function Bt(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function at(e){return JSON.stringify(e,null,2)}function Ft(e,a,n){return a==="play_screenshot_unsupported"?e("playtest.limitations.visualUnsupported","Visual evidence unavailable — Play screenshots are not supported in structured session v1."):a==="virtual_input_unavailable"?e("playtest.limitations.virtualInputUnavailable","Virtual input is unavailable for this session."):n}function Fa(e,a){return a==="play_screenshot_unsupported"?e("playtest.limitations.visualUnsupportedReason","Play screenshots are not supported in structured session v1."):a==="not_requested"?e("playtest.result.status.notRequested","Not requested"):a==="required_evidence_missing"?e("playtest.dimension.reason.missing","Required evidence is missing."):a==="required_capability_unavailable"?e("playtest.dimension.reason.capability","The required capability is unavailable."):a}const Ga="_page_14ipf_2",qa="_sampleBanner_14ipf_10",Ha="_sampleBannerRow_14ipf_22",Ua="_sampleBannerMain_14ipf_29",Ka="_sampleBadge_14ipf_36",za="_sampleTitle_14ipf_51",Wa="_sampleMessage_14ipf_58",Ja="_sampleActions_14ipf_65",Ya="_primaryAction_14ipf_73",Qa="_secondaryAction_14ipf_74",Xa="_resetAction_14ipf_75",Za="_card_14ipf_124",es="_cardHeader_14ipf_131",ts="_clearButton_14ipf_144",as="_statusRow_14ipf_173",ss="_statusIndicator_14ipf_180",ns="_statusRunning_14ipf_188",is="_statusPaused_14ipf_193",ls="_statusNotRunning_14ipf_197",rs="_statusLabel_14ipf_201",os="_statusMeta_14ipf_208",cs="_controlButtons_14ipf_214",ds="_btn_14ipf_221",us="_btnPrimary_14ipf_243",ps="_btnDanger_14ipf_253",fs="_historyList_14ipf_265",ms="_historyItem_14ipf_271",hs="_stepDisclosure_14ipf_291",ys="_historyItemSelected_14ipf_296",vs="_historyItemHeader_14ipf_301",gs="_historyIcon_14ipf_307",bs="_historyTimestamp_14ipf_312",_s="_historyName_14ipf_319",xs="_recordKind_14ipf_330",js="_historyItemMeta_14ipf_344",Ss="_historyMode_14ipf_354",ws="_historyDuration_14ipf_358",Ns="_historyStatus_14ipf_362",Cs="_status_passed_14ipf_369",Rs="_status_failed_14ipf_373",Ps="_status_running_14ipf_377",ks="_status_timed_out_14ipf_381",As="_status_cancelled_14ipf_385",Es="_status_insufficient_evidence_14ipf_386",Ds="_historyError_14ipf_390",Is="_historyEvidence_14ipf_400",Ts="_historyLimitation_14ipf_410",Ls="_detailShell_14ipf_421",Ms="_detailHeader_14ipf_429",$s="_detailHeading_14ipf_440",Vs="_detailRecordName_14ipf_451",Os="_detailCloseButton_14ipf_460",Bs="_detailRetryButton_14ipf_480",Fs="_detailBody_14ipf_485",Gs="_detailState_14ipf_494",qs="_detailErrorTitle_14ipf_505",Hs="_detailErrorMessage_14ipf_512",Us="_reportContainer_14ipf_534",Ks="_runSummary_14ipf_540",zs="_viewerSection_14ipf_541",Ws="_summaryLead_14ipf_554",Js="_summaryStatusMark_14ipf_560",Ys="_viewerHeading_14ipf_573",Qs="_summaryName_14ipf_583",Xs="_summaryReason_14ipf_594",Zs="_summaryFacts_14ipf_601",en="_subsectionLabel_14ipf_614",tn="_sectionHeadingRow_14ipf_629",an="_sectionHint_14ipf_637",sn="_dimensionGrid_14ipf_642",nn="_dimensionCard_14ipf_649",ln="_dimensionHeader_14ipf_657",rn="_statusMark_14ipf_663",on="_dimensionName_14ipf_676",cn="_requirementBadge_14ipf_686",dn="_dimensionStatus_14ipf_694",un="_dimensionMeta_14ipf_701",pn="_tone_passed_14ipf_709",fn="_tone_failed_14ipf_710",mn="_tone_timed_out_14ipf_711",hn="_tone_cancelled_14ipf_712",yn="_tone_insufficient_evidence_14ipf_713",vn="_tone_unavailable_14ipf_714",gn="_tone_skipped_14ipf_715",bn="_tone_not_requested_14ipf_716",_n="_stepList_14ipf_718",xn="_stepItem_14ipf_725",jn="_stepIndex_14ipf_749",Sn="_stepIdentity_14ipf_756",wn="_stepName_14ipf_763",Nn="_stepMeta_14ipf_773",Cn="_stepStatus_14ipf_774",Rn="_chevron_14ipf_782",Pn="_chevronOpen_14ipf_788",kn="_stepDetails_14ipf_790",An="_evidenceBlock_14ipf_799",En="_evidenceLabel_14ipf_803",Dn="_stepError_14ipf_830",In="_recordProblem_14ipf_831",Tn="_capabilityGrid_14ipf_846",Ln="_capabilityItem_14ipf_853",Mn="_capabilityYes_14ipf_866",$n="_capabilityNo_14ipf_867",Vn="_capabilityState_14ipf_868",On="_limitations_14ipf_870",Bn="_artifactList_14ipf_871",Fn="_agentList_14ipf_872",Gn="_artifactDisclosures_14ipf_889",qn="_artifactDisclosure_14ipf_889",Hn="_artifactButton_14ipf_903",Un="_artifactContent_14ipf_928",Kn="_limitationItem_14ipf_948",zn="_reportContextPanel_14ipf_965",Wn="_reportContextRow_14ipf_975",Jn="_reportContextLabel_14ipf_983",Yn="_reportSection_14ipf_991",Qn="_reportSectionHeader_14ipf_997",Xn="_reportMarkdown_14ipf_1009",Zn="_reportLogs_14ipf_1022",ei="_emptyState_14ipf_1037",ti="_emptyStateTitle_14ipf_1044",ai="_emptyStateMessage_14ipf_1052",si="_upgradePanel_14ipf_1061",ni="_upgradePanelIcon_14ipf_1069",ii="_upgradePanelTitle_14ipf_1074",li="_upgradePanelDesc_14ipf_1082",ri="_benefitList_14ipf_1092",oi="_benefitItem_14ipf_1103",ci="_upgradeActions_14ipf_1118",di="_workspaceTabs_14ipf_1124",ui="_sessionHelp_14ipf_1137",pi="_stopAction_14ipf_1143",fi="_controlEditor_14ipf_1144",mi="_profileToolbar_14ipf_1146",hi="_profileDialog_14ipf_1147",yi="_sessionBar_14ipf_1152",vi="_sessionIdentity_14ipf_1165",gi="_sessionActions_14ipf_1195",bi="_profileActions_14ipf_1196",_i="_profileDialogActions_14ipf_1197",xi="_liveWorkspace_14ipf_1238",ji="_profileLabelRow_14ipf_1254",Si="_profileHint_14ipf_1262",wi="_actualValue_14ipf_1271",Ni="_watchReading_14ipf_1272",Ci="_liveGrid_14ipf_1308",Ri="_livePanel_14ipf_1315",Pi="_panelEmpty_14ipf_1352",ki="_controlAvailability_14ipf_1358",Ai="_controlGate_14ipf_1361",Ei="_controlGateTrigger_14ipf_1364",Di="_controlGateHint_14ipf_1366",Ii="_editorLabel_14ipf_1367",Ti="_editorHeading_14ipf_1368",Li="_savedValueState_14ipf_1369",Mi="_valueToolbar_14ipf_1373",$i="_valueFilters_14ipf_1383",Vi="_valuePagination_14ipf_1390",Oi="_valueListStatus_14ipf_1391",Bi="_valueCount_14ipf_1392",Fi="_layoutHint_14ipf_1394",Gi="_srOnly_14ipf_1395",qi="_unifiedValueRows_14ipf_1396",Hi="_liveRows_14ipf_1397",Ui="_watchRows_14ipf_1397",Ki="_valueGroup_14ipf_1398",zi="_valueGroupToggle_14ipf_1400",Wi="_valueGroupRows_14ipf_1406",Ji="_controlRow_14ipf_1406",Yi="_watchRow_14ipf_1397",Qi="_actionRow_14ipf_1408",Xi="_historyBrowser_14ipf_1412",Zi="_historyToolbar_14ipf_1413",el="_rowIdentity_14ipf_1437",tl="_freshness_14ipf_1440",al="_presentationMeta_14ipf_1461",sl="_rowFeedback_14ipf_1462",nl="_controlEditorRow_14ipf_1468",il="_controlActions_14ipf_1469",ll="_applyOnStartOption_14ipf_1472",rl="_valueDetails_14ipf_1474",ol="_valueDetailButton_14ipf_1480",cl="_valueDetailShell_14ipf_1483",dl="_valueDetailBody_14ipf_1484",ul="_valueDetailList_14ipf_1485",pl="_valueDetailActions_14ipf_1489",fl="_valueDetailFeedback_14ipf_1490",ml="_defaultValueEditor_14ipf_1493",hl="_defaultBooleanEditor_14ipf_1497",yl="_booleanEditor_14ipf_1500",vl="_rangeEditor_14ipf_1509",gl="_valueWorkspacePanel_14ipf_1524",bl="_valueWorkspaceHeader_14ipf_1525",_l="_valueSections_14ipf_1526",xl="_valueSection_14ipf_1526",jl="_valueSectionHeader_14ipf_1528",Sl="_valueSectionHeading_14ipf_1529",wl="_valueSectionCount_14ipf_1531",Nl="_valueSectionHeaderActions_14ipf_1532",Cl="_sectionDragHandle_14ipf_1533",Rl="_sectionMoveButton_14ipf_1534",Pl="_valueReorderControls_14ipf_1535",kl="_dragHandle_14ipf_1537",Al="_runtimeSettings_14ipf_1549",El="_runtimeSettingSwitch_14ipf_1550",Dl="_runtimeSettingSwitchInput_14ipf_1553",Il="_runtimeSettingSwitchTrack_14ipf_1554",Tl="_runtimeSettingSwitchThumb_14ipf_1555",Ll="_layoutError_14ipf_1559",Ml="_controlValueList_14ipf_1560",$l="_watchValueGrid_14ipf_1561",Vl="_actionValueList_14ipf_1562",Ol="_valueEntryShell_14ipf_1563",Bl="_watchCardMain_14ipf_1576",Fl="_watchDetails_14ipf_1583",Gl="_actionSummary_14ipf_1592",ql="_actionExecution_14ipf_1592",Hl="_actionParameter_14ipf_1593",Ul="_actionInactiveReason_14ipf_1597",Kl="_actionParameterGrid_14ipf_1602",zl="_actionParameterError_14ipf_1608",Wl="_deploymentGuide_14ipf_1634",Jl="_deploymentScope_14ipf_1646",Yl="_deploymentLifecycle_14ipf_1649",Ql="_deploymentNotice_14ipf_1650",Xl="_deploymentChecklist_14ipf_1652",Zl="_deploymentDescription_14ipf_1656",er="_deploymentDetails_14ipf_1659",tr="_inlineError_14ipf_1679",ar="_profileEditorDialog_14ipf_1682",sr="_profileDialogBody_14ipf_1683",nr="_profileDeleteAction_14ipf_1686",ir="_profileDeleteReason_14ipf_1687",lr="_bindingTabs_14ipf_1688",rr="_bindingList_14ipf_1692",or="_bindingEmpty_14ipf_1693",cr="_bindingItem_14ipf_1694",dr="_bindingItemCopy_14ipf_1699",ur="_bindingPresentation_14ipf_1700",pr="_bindingPin_14ipf_1703",fr="_bindingItemActions_14ipf_1705",mr="_bindingDelete_14ipf_1709",hr="_addBindingButton_14ipf_1711",yr="_bindingForm_14ipf_1712",vr="_bindingFormGrid_14ipf_1713",gr="_bindingBooleanDefault_14ipf_1716",br="_bindingPathField_14ipf_1718",_r="_rangeFields_14ipf_1719",xr="_selectionButton_14ipf_1720",jr="_bindingFormActions_14ipf_1721",Sr="_bindingError_14ipf_1722",wr="_valueManagerShell_14ipf_1723",Nr="_valueSourceTabs_14ipf_1724",Cr="_valueManagerBody_14ipf_1728",Rr="_valueSourcePanel_14ipf_1729",Pr="_registeredIntro_14ipf_1730",kr="_registeredEmpty_14ipf_1734",Ar="_registeredSteps_14ipf_1737",Er="_registeredEmptyActions_14ipf_1740",Dr="_adapterSetupList_14ipf_1745",Ir="_adapterSetupRow_14ipf_1749",Tr="_adapterMethods_14ipf_1756",Lr="_connectionGuide_14ipf_1757",Mr="_registrationGuide_14ipf_1760",$r="_adapterSetupContext_14ipf_1761",Vr="_valueSearch_14ipf_1762",Or="_firstProfileName_14ipf_1763",Br="_sourceIntro_14ipf_1767",Fr="_catalogGroups_14ipf_1771",Gr="_catalogRow_14ipf_1772",qr="_candidateActions_14ipf_1780",Hr="_candidateEntry_14ipf_1782",Ur="_propertySelection_14ipf_1783",Kr="_propertySelectionHeader_14ipf_1784",zr="_selectedInstance_14ipf_1785",Wr="_propertyPickerLabel_14ipf_1786",Jr="_propertyPicker_14ipf_1786",Yr="_propertyPickerTrigger_14ipf_1792",Qr="_propertyPickerPanel_14ipf_1794",Xr="_propertyPickerSearchRow_14ipf_1796",Zr="_propertyPickerList_14ipf_1800",eo="_propertyPickerGroup_14ipf_1802",to="_propertyPickerOption_14ipf_1805",ao="_compoundEditor_14ipf_1811",so="_compoundCoordinates_14ipf_1812",no="_colorSwatch_14ipf_1819",io="_candidateAction_14ipf_1780",lo="_candidateActionSizer_14ipf_1836",ro="_candidateError_14ipf_1840",oo="_valueManagerFooter_14ipf_1842",co="_catalogDetails_14ipf_1843",uo="_inlineNotice_14ipf_1852",po="_subscriptionUsage_14ipf_1853",fo="_pendingProfileAction_14ipf_1854",mo="_registrationExample_14ipf_1859",ho="_registrationActions_14ipf_1862",s={page:Ga,sampleBanner:qa,sampleBannerRow:Ha,sampleBannerMain:Ua,sampleBadge:Ka,sampleTitle:za,sampleMessage:Wa,sampleActions:Ja,primaryAction:Ya,secondaryAction:Qa,resetAction:Xa,card:Za,cardHeader:es,clearButton:ts,statusRow:as,statusIndicator:ss,statusRunning:ns,statusPaused:is,statusNotRunning:ls,statusLabel:rs,statusMeta:os,controlButtons:cs,btn:ds,btnPrimary:us,btnDanger:ps,historyList:fs,historyItem:ms,stepDisclosure:hs,historyItemSelected:ys,historyItemHeader:vs,historyIcon:gs,historyTimestamp:bs,historyName:_s,recordKind:xs,historyItemMeta:js,historyMode:Ss,historyDuration:ws,historyStatus:Ns,status_passed:Cs,status_failed:Rs,status_running:Ps,status_timed_out:ks,status_cancelled:As,status_insufficient_evidence:Es,historyError:Ds,historyEvidence:Is,historyLimitation:Ts,detailShell:Ls,detailHeader:Ms,detailHeading:$s,detailRecordName:Vs,detailCloseButton:Os,detailRetryButton:Bs,detailBody:Fs,detailState:Gs,detailErrorTitle:qs,detailErrorMessage:Hs,reportContainer:Us,runSummary:Ks,viewerSection:zs,summaryLead:Ws,summaryStatusMark:Js,viewerHeading:Ys,summaryName:Qs,summaryReason:Xs,summaryFacts:Zs,subsectionLabel:en,sectionHeadingRow:tn,sectionHint:an,dimensionGrid:sn,dimensionCard:nn,dimensionHeader:ln,statusMark:rn,dimensionName:on,requirementBadge:cn,dimensionStatus:dn,dimensionMeta:un,tone_passed:pn,tone_failed:fn,tone_timed_out:mn,tone_cancelled:hn,tone_insufficient_evidence:yn,tone_unavailable:vn,tone_skipped:gn,tone_not_requested:bn,stepList:_n,stepItem:xn,stepIndex:jn,stepIdentity:Sn,stepName:wn,stepMeta:Nn,stepStatus:Cn,chevron:Rn,chevronOpen:Pn,stepDetails:kn,evidenceBlock:An,evidenceLabel:En,stepError:Dn,recordProblem:In,capabilityGrid:Tn,capabilityItem:Ln,capabilityYes:Mn,capabilityNo:$n,capabilityState:Vn,limitations:On,artifactList:Bn,agentList:Fn,artifactDisclosures:Gn,artifactDisclosure:qn,artifactButton:Hn,artifactContent:Un,limitationItem:Kn,reportContextPanel:zn,reportContextRow:Wn,reportContextLabel:Jn,reportSection:Yn,reportSectionHeader:Qn,reportMarkdown:Xn,reportLogs:Zn,emptyState:ei,emptyStateTitle:ti,emptyStateMessage:ai,upgradePanel:si,upgradePanelIcon:ni,upgradePanelTitle:ii,upgradePanelDesc:li,benefitList:ri,benefitItem:oi,upgradeActions:ci,workspaceTabs:di,sessionHelp:ui,stopAction:pi,controlEditor:fi,profileToolbar:mi,profileDialog:hi,sessionBar:yi,sessionIdentity:vi,sessionActions:gi,profileActions:bi,profileDialogActions:_i,liveWorkspace:xi,profileLabelRow:ji,profileHint:Si,actualValue:wi,watchReading:Ni,liveGrid:Ci,livePanel:Ri,panelEmpty:Pi,controlAvailability:ki,controlGate:Ai,controlGateTrigger:Ei,controlGateHint:Di,editorLabel:Ii,editorHeading:Ti,savedValueState:Li,valueToolbar:Mi,valueFilters:$i,valuePagination:Vi,valueListStatus:Oi,valueCount:Bi,layoutHint:Fi,srOnly:Gi,unifiedValueRows:qi,liveRows:Hi,watchRows:Ui,valueGroup:Ki,valueGroupToggle:zi,valueGroupRows:Wi,controlRow:Ji,watchRow:Yi,actionRow:Qi,historyBrowser:Xi,historyToolbar:Zi,rowIdentity:el,freshness:tl,presentationMeta:al,rowFeedback:sl,controlEditorRow:nl,controlActions:il,applyOnStartOption:ll,valueDetails:rl,valueDetailButton:ol,valueDetailShell:cl,valueDetailBody:dl,valueDetailList:ul,valueDetailActions:pl,valueDetailFeedback:fl,defaultValueEditor:ml,defaultBooleanEditor:hl,booleanEditor:yl,rangeEditor:vl,valueWorkspacePanel:gl,valueWorkspaceHeader:bl,valueSections:_l,valueSection:xl,valueSectionHeader:jl,valueSectionHeading:Sl,valueSectionCount:wl,valueSectionHeaderActions:Nl,sectionDragHandle:Cl,sectionMoveButton:Rl,valueReorderControls:Pl,dragHandle:kl,runtimeSettings:Al,runtimeSettingSwitch:El,runtimeSettingSwitchInput:Dl,runtimeSettingSwitchTrack:Il,runtimeSettingSwitchThumb:Tl,layoutError:Ll,controlValueList:Ml,watchValueGrid:$l,actionValueList:Vl,valueEntryShell:Ol,watchCardMain:Bl,watchDetails:Fl,actionSummary:Gl,actionExecution:ql,actionParameter:Hl,actionInactiveReason:Ul,actionParameterGrid:Kl,actionParameterError:zl,deploymentGuide:Wl,deploymentScope:Jl,deploymentLifecycle:Yl,deploymentNotice:Ql,deploymentChecklist:Xl,deploymentDescription:Zl,deploymentDetails:er,inlineError:tr,profileEditorDialog:ar,profileDialogBody:sr,profileDeleteAction:nr,profileDeleteReason:ir,bindingTabs:lr,bindingList:rr,bindingEmpty:or,bindingItem:cr,bindingItemCopy:dr,bindingPresentation:ur,bindingPin:pr,bindingItemActions:fr,bindingDelete:mr,addBindingButton:hr,bindingForm:yr,bindingFormGrid:vr,bindingBooleanDefault:gr,bindingPathField:br,rangeFields:_r,selectionButton:xr,bindingFormActions:jr,bindingError:Sr,valueManagerShell:wr,valueSourceTabs:Nr,valueManagerBody:Cr,valueSourcePanel:Rr,registeredIntro:Pr,registeredEmpty:kr,registeredSteps:Ar,registeredEmptyActions:Er,adapterSetupList:Dr,adapterSetupRow:Ir,adapterMethods:Tr,connectionGuide:Lr,registrationGuide:Mr,adapterSetupContext:$r,valueSearch:Vr,firstProfileName:Or,sourceIntro:Br,catalogGroups:Fr,catalogRow:Gr,candidateActions:qr,candidateEntry:Hr,propertySelection:Ur,propertySelectionHeader:Kr,selectedInstance:zr,propertyPickerLabel:Wr,propertyPicker:Jr,propertyPickerTrigger:Yr,propertyPickerPanel:Qr,propertyPickerSearchRow:Xr,propertyPickerList:Zr,propertyPickerGroup:eo,propertyPickerOption:to,compoundEditor:ao,compoundCoordinates:so,colorSwatch:no,candidateAction:io,candidateActionSizer:lo,candidateError:ro,valueManagerFooter:oo,catalogDetails:co,inlineNotice:uo,subscriptionUsage:po,pendingProfileAction:fo,registrationExample:mo,registrationActions:ho};function We(e){return e.trim().toLowerCase()}function yo(e){switch(We(e)){case"passed":return"✓";case"failed":case"timed_out":return"×";case"running":return"◔";case"cancelled":case"insufficient_evidence":return"!";default:return"–"}}function vo(e,a){switch(We(a)){case"run":return e("playtest.status.mode.run","Run");case"server":return e("playtest.status.mode.server","Server");case"edit":return e("playtest.status.mode.edit","Edit");case"play":return e("playtest.status.mode.play","Play");default:return a}}function go(e,a){const n=We(a);return n==="running"?e("playtest.history.status.running","Running"):Ve(e,n)}function bo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function _o(e){const a=/^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})$/.exec(e);if(a){const[,i,d,c,u,y,m]=a,_=new Date(Date.UTC(Number(i),Number(d)-1,Number(c),Number(u),Number(y),Number(m)));return _.getUTCFullYear()===Number(i)&&_.getUTCMonth()===Number(d)-1&&_.getUTCDate()===Number(c)&&_.getUTCHours()===Number(u)&&_.getUTCMinutes()===Number(y)&&_.getUTCSeconds()===Number(m)?_:null}const n=Date.parse(e);return Number.isNaN(n)?null:new Date(n)}function xo(e,a){const n=_o(e);return n?new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"short"}).format(n):e}function jo({entries:e,onSelect:a,selectedRecordId:n}){const{t:i,locale:d}=ue(),[c,u]=o.useState(""),[y,m]=o.useState("all"),[_,C]=o.useState(0),k=o.useMemo(()=>{const R=c.trim().toLocaleLowerCase();return e.filter(M=>(y==="all"||We(M.status)===y)&&(!R||[M.testName,M.status,M.mode,M.recordKind].join(" ").toLocaleLowerCase().includes(R)))},[e,c,y]),x=Math.max(1,Math.ceil(k.length/50)),f=Math.min(_,x-1),V=k.slice(f*50,(f+1)*50);return e.length===0?t.jsx("div",{className:s.emptyState,children:i("playtest.history.empty","No test results yet")}):t.jsxs("div",{className:s.historyBrowser,children:[t.jsxs("div",{className:s.historyToolbar,children:[t.jsxs("label",{children:[t.jsx("span",{children:i("playtest.history.search","Search test results")}),t.jsx("input",{type:"search",value:c,onChange:R=>{u(R.target.value),C(0)}})]}),t.jsxs("label",{children:[t.jsx("span",{children:i("playtest.history.filter","Result")}),t.jsxs("select",{value:y,onChange:R=>{m(R.target.value),C(0)},children:[t.jsx("option",{value:"all",children:i("playtest.history.filterAll","All results")}),t.jsx("option",{value:"passed",children:i("playtest.result.status.passed","Passed")}),t.jsx("option",{value:"failed",children:i("playtest.result.status.failed","Failed")}),t.jsx("option",{value:"insufficient_evidence",children:i("playtest.result.status.insufficientEvidence","Insufficient evidence")}),t.jsx("option",{value:"timed_out",children:i("playtest.result.status.timedOut","Timed out")})]})]})]}),t.jsx("div",{className:s.valueCount,role:"status",children:i("playtest.history.filteredCount","{{visible}} of {{total}} results").replace("{{visible}}",String(k.length)).replace("{{total}}",String(e.length))}),t.jsx("div",{className:s.historyList,children:V.map(R=>{const M=R.recordId===n;return t.jsxs("button",{className:`${s.historyItem} ${M?s.historyItemSelected:""}`,onClick:w=>a(R.recordId,w.currentTarget),"aria-current":M?"true":void 0,"aria-haspopup":"dialog",children:[t.jsxs("div",{className:s.historyItemHeader,children:[t.jsx("span",{className:s.historyIcon,children:yo(R.status)}),t.jsx("span",{className:s.historyTimestamp,children:xo(R.timestamp,d)}),t.jsx("span",{className:s.historyName,children:R.testName}),t.jsx("span",{className:s.recordKind,children:R.recordKind==="structured"?i("playtest.history.kind.structured","Structured"):R.recordKind==="legacy"?i("playtest.history.kind.legacy","Legacy"):i("playtest.history.kind.attention","Needs attention")})]}),t.jsxs("div",{className:s.historyItemMeta,children:[t.jsx(it,{text:i("playtest.history.mode.tooltip","Playtest mode used for this recorded test run."),children:t.jsxs("span",{className:s.historyMode,children:[i("playtest.history.mode","Mode"),": ",vo(i,R.mode)]})}),t.jsx("span",{className:s.historyDuration,children:bo(R.durationMs)}),t.jsx(it,{text:i("playtest.history.status.tooltip","Recorded result state for this automated playtest run."),children:t.jsx("span",{className:`${s.historyStatus} ${s[`status_${We(R.status)}`]??""}`,children:go(i,R.status)})})]}),R.evidenceSummary&&t.jsxs("div",{className:s.historyEvidence,children:[t.jsxs("span",{children:[i("playtest.dimension.server","Server"),": ",Ve(i,R.evidenceSummary.server.status)]}),t.jsxs("span",{children:[i("playtest.dimension.clientUi","Client UI"),": ",Ve(i,R.evidenceSummary.clientUi.status)]}),R.agentCounts&&t.jsx("span",{children:i("playtest.history.agentCounts","Server {server} · Client {client}").replace("{server}",String(R.agentCounts.server)).replace("{client}",String(R.agentCounts.client))})]}),R.errorMessage&&t.jsx("div",{className:s.historyError,children:R.errorMessage}),!R.errorMessage&&R.limitation&&t.jsx("div",{className:s.historyLimitation,children:Ft(i,R.limitation.code,R.limitation.message)})]},R.recordId)})}),x>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:f===0,onClick:()=>C(R=>R-1),children:i("playtest.values.previous","Previous")}),t.jsxs("span",{children:[f+1," / ",x]}),t.jsx("button",{type:"button",disabled:f+1>=x,onClick:()=>C(R=>R+1),children:i("playtest.values.next","Next")})]})]})}function ot({label:e,open:a,onToggle:n,children:i,tooltip:d}){const c=o.useId();return t.jsxs("div",{className:s.artifactDisclosure,children:[t.jsxs("button",{className:s.artifactButton,onClick:n,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n())},"aria-expanded":a,"aria-controls":c,children:[d?t.jsx(it,{text:d,children:t.jsx("span",{children:e})}):t.jsx("span",{children:e}),t.jsx("span",{"aria-hidden":"true",className:`${s.chevron} ${a?s.chevronOpen:""}`,children:"⌄"})]}),a&&t.jsx("div",{className:s.artifactContent,id:c,children:i})]})}function So({detail:e}){const{t:a}=ue(),[n,i]=o.useState(()=>new Set(e.recordKind==="legacy"?["report","logs"]:[])),d=y=>i(m=>{const _=new Set(m);return _.has(y)?_.delete(y):_.add(y),_}),c=e.result?{schemaVersion:e.result.schemaVersion,sessionId:e.result.sessionId,recordId:e.result.recordId,startedAt:e.result.startedAt,endedAt:e.result.endedAt,files:e.result.artifacts.files}:null,u=e.artifactErrors??[];return!c&&!e.markdown&&!e.logs&&u.length===0?null:t.jsxs("section",{className:s.viewerSection,"aria-labelledby":"playtest-artifacts-heading",children:[t.jsx("h3",{id:"playtest-artifacts-heading",className:s.viewerHeading,children:a("playtest.artifacts.title","Artifacts")}),t.jsxs("div",{className:s.artifactDisclosures,children:[c&&t.jsx(ot,{label:a("playtest.artifacts.metadata","Result metadata"),open:n.has("metadata"),onToggle:()=>d("metadata"),children:t.jsx("pre",{children:at(c)})}),e.markdown&&t.jsx(ot,{label:a("playtest.report.content","Report"),tooltip:a("playtest.report.content.tooltip","Markdown summary for the selected automated playtest run."),open:n.has("report"),onToggle:()=>d("report"),children:t.jsx("pre",{children:e.markdown})}),e.logs&&t.jsx(ot,{label:a("playtest.report.logs","Logs"),tooltip:a("playtest.report.logs.tooltip","Execution logs captured for the selected automated playtest run."),open:n.has("logs"),onToggle:()=>d("logs"),children:t.jsx("pre",{children:e.logs})})]}),u.map(y=>t.jsx("div",{className:s.stepError,children:y.message},`${y.code}-${y.message}`))]})}function wo({result:e}){const{t:a}=ue(),n=[[a("playtest.capability.semanticUi","Semantic UI snapshot"),e.capabilities.semanticUiSnapshot],[a("playtest.capability.virtualInput","Virtual input"),e.capabilities.virtualInput],[a("playtest.capability.fixedBootstrap","Fixed agent bootstrap"),e.capabilities.fixedBootstrap],[a("playtest.capability.projectAdapter","Project test adapter"),e.capabilities.projectTestAdapter]];return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":"playtest-capabilities-heading",children:[t.jsx("h3",{id:"playtest-capabilities-heading",className:s.viewerHeading,children:a("playtest.capability.title","Capabilities and limits")}),t.jsx("div",{className:s.capabilityGrid,children:n.map(([i,d])=>t.jsxs("div",{className:s.capabilityItem,children:[t.jsx("span",{className:d?s.capabilityYes:s.capabilityNo,"aria-hidden":"true",children:d?"✓":"–"}),t.jsx("span",{children:i}),t.jsx("span",{className:s.capabilityState,children:d?a("playtest.capability.available","Available"):a("playtest.capability.unavailable","Unavailable")})]},i))}),e.agents.length>0&&t.jsxs("div",{className:s.agentList,children:[t.jsx("span",{className:s.subsectionLabel,children:a("playtest.agents.title","Test agents")}),e.agents.map((i,d)=>{const c=typeof i.agentId=="string"?i.agentId:`${a("playtest.agents.unknown","Agent")} ${d+1}`,u=typeof i.role=="string"?i.role:"unknown",y=typeof i.clientId=="string"?` · ${i.clientId}`:"";return t.jsxs("code",{children:[c," · ",u,y]},`${c}-${d}`)})]}),e.limitations.length>0&&t.jsxs("div",{className:s.limitations,children:[t.jsx("div",{className:s.subsectionLabel,children:a("playtest.limitations.title","Limitations")}),e.limitations.map(i=>t.jsxs("div",{className:s.limitationItem,children:["! ",Ft(a,i.code,i.message)]},i.code))]})]})}const No=["server","clientUi","interaction","visual"];function Co({result:e}){const{t:a}=ue(),n={server:a("playtest.dimension.server","Server"),clientUi:a("playtest.dimension.clientUi","Client UI"),interaction:a("playtest.dimension.interaction","Interaction"),visual:a("playtest.dimension.visual","Visual")};return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":"playtest-dimensions-heading",children:[t.jsxs("div",{className:s.sectionHeadingRow,children:[t.jsx("h3",{id:"playtest-dimensions-heading",className:s.viewerHeading,children:a("playtest.dimension.title","Evidence dimensions")}),t.jsx("span",{className:s.sectionHint,children:a("playtest.dimension.hint","Required evidence is marked below.")})]}),t.jsx("div",{className:s.dimensionGrid,children:No.map(i=>{const d=e.dimensions[i];return t.jsxs("div",{className:s.dimensionCard,children:[t.jsxs("div",{className:s.dimensionHeader,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${d.status}`]??""}`,"aria-hidden":"true",children:gt(d.status)}),t.jsx("span",{className:s.dimensionName,children:n[i]}),t.jsx("span",{className:s.requirementBadge,children:d.required?a("playtest.dimension.required","Required"):a("playtest.dimension.optional","Optional")})]}),t.jsx("div",{className:s.dimensionStatus,children:Ve(a,d.status)}),d.provider&&t.jsx("div",{className:s.dimensionMeta,children:d.provider}),d.reason&&t.jsx("div",{className:s.dimensionMeta,children:Fa(a,d.reason)}),t.jsxs("div",{className:s.dimensionMeta,children:[a("playtest.dimension.steps","Steps"),": ",d.stepIds.length]})]},i)})})]})}function Ro({result:e}){const{t:a}=ue(),n=o.useId(),[i,d]=o.useState(()=>new Set),c=u=>{d(y=>{const m=new Set(y);return m.has(u)?m.delete(u):m.add(u),m})};return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":`${n}-heading`,children:[t.jsx("h3",{id:`${n}-heading`,className:s.viewerHeading,children:a("playtest.steps.title","Step timeline")}),t.jsx("div",{className:s.stepList,children:e.steps.map(u=>{const y=i.has(u.stepId),m=`${n}-${u.index}-details`,_=u.target.role==="server"?a("playtest.steps.server","Server"):u.target.clientId;return t.jsxs("div",{className:s.stepItem,children:[t.jsxs("button",{className:s.stepDisclosure,onClick:()=>c(u.stepId),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),c(u.stepId))},"aria-expanded":y,"aria-controls":m,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${u.status}`]??""}`,"aria-hidden":"true",children:gt(u.status)}),t.jsx("span",{className:s.stepIndex,children:u.index+1}),t.jsxs("span",{className:s.stepIdentity,children:[t.jsx("span",{className:s.stepName,children:u.stepId}),t.jsxs("span",{className:s.stepMeta,children:[_," · ",u.action," · ",Bt(u.durationMs)]})]}),t.jsx("span",{className:s.stepStatus,children:Ve(a,u.status)}),t.jsx("span",{className:`${s.chevron} ${y?s.chevronOpen:""}`,"aria-hidden":"true",children:"⌄"})]}),y&&t.jsxs("div",{className:s.stepDetails,id:m,role:"region","aria-label":`${u.stepId} ${a("playtest.steps.details","details")}`,children:[u.expected!==void 0&&t.jsxs("div",{className:s.evidenceBlock,children:[t.jsx("div",{className:s.evidenceLabel,children:a("playtest.steps.expected","Expected")}),t.jsx("pre",{children:at(u.expected)})]}),u.observed!==void 0&&t.jsxs("div",{className:s.evidenceBlock,children:[t.jsx("div",{className:s.evidenceLabel,children:a("playtest.steps.observed","Observed")}),t.jsx("pre",{children:at(u.observed)})]}),u.evidence!==void 0&&t.jsxs("div",{className:s.evidenceBlock,children:[t.jsx("div",{className:s.evidenceLabel,children:a("playtest.steps.evidence","Evidence")}),t.jsx("pre",{children:at(u.evidence)})]}),u.error&&t.jsxs("div",{className:s.stepError,children:[t.jsx("strong",{children:u.error.code})," — ",u.error.message]})]})]},u.stepId)})})]})}function Po({report:e}){var i;const{t:a}=ue(),n=e.recordKind==="incomplete_structured"?a("playtest.record.incomplete","Structured result is incomplete"):e.recordKind==="corrupt_structured"?a("playtest.record.corrupt","Structured result is damaged"):a("playtest.record.unsupported","Structured result version is unsupported");return t.jsxs("div",{className:s.recordProblem,role:"status",children:[t.jsx("strong",{children:n}),t.jsx("span",{children:((i=e.error)==null?void 0:i.message)??a("playtest.record.unavailable","Result details are unavailable.")})]})}function ko({report:e}){var d,c,u,y,m,_;const{t:a}=ue(),n=!!((d=e.contextSummary)!=null&&d.testScenario||(c=e.contextSummary)!=null&&c.expectedBehavior||(u=e.contextSummary)!=null&&u.observedBehavior),i=e.recordKind==="structured"?e.result:void 0;return t.jsxs("div",{className:s.reportContainer,children:[i&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:s.runSummary,"aria-labelledby":"playtest-summary-heading",children:[t.jsxs("div",{className:s.summaryLead,children:[t.jsx("span",{className:`${s.summaryStatusMark} ${s[`tone_${i.overallStatus}`]??""}`,"aria-hidden":"true",children:gt(i.overallStatus)}),t.jsxs("div",{children:[t.jsx("h3",{id:"playtest-summary-heading",className:s.viewerHeading,children:a("playtest.summary.title","Run summary")}),t.jsx("div",{className:s.summaryName,children:i.testName}),t.jsx("div",{className:s.summaryReason,children:i.terminalReason.message})]})]}),t.jsxs("div",{className:s.summaryFacts,children:[t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.status","Status")}),t.jsx("strong",{children:Ve(a,i.overallStatus)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.mode","Mode")}),t.jsx("strong",{children:i.mode==="play"?a("playtest.status.mode.play","Play"):a("playtest.status.mode.run","Run")})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.duration","Duration")}),t.jsx("strong",{children:Bt(i.durationMs)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.cleanup","Cleanup")}),t.jsx("strong",{children:Ve(a,i.cleanup.status)})]})]})]}),t.jsx(Co,{result:i}),t.jsx(Ro,{result:i}),t.jsx(wo,{result:i})]}),e.recordKind!=="structured"&&e.recordKind!=="legacy"&&t.jsx(Po,{report:e}),n&&t.jsxs("div",{className:s.reportContextPanel,children:[((y=e.contextSummary)==null?void 0:y.testScenario)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.why","Why this test ran")}),t.jsx("span",{children:e.contextSummary.testScenario})]}),((m=e.contextSummary)==null?void 0:m.expectedBehavior)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.expected","Expected")}),t.jsx("span",{children:e.contextSummary.expectedBehavior})]}),((_=e.contextSummary)==null?void 0:_.observedBehavior)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.observed","Observed")}),t.jsx("span",{children:e.contextSummary.observedBehavior})]})]}),t.jsx(So,{detail:e},e.recordId),!i&&!e.markdown&&!e.logs&&e.recordKind==="legacy"&&t.jsx("div",{className:s.emptyState,children:a("playtest.report.empty","No report content available")})]})}function Pt(e){return typeof e=="number"?{placeId:String(e)}:void 0}const me={listProfiles:async e=>De.get("/api/dashboard/playtest/control-profiles",Pt(e)),liveStatus:async(e,a)=>De.get("/api/dashboard/playtest/live",{...Pt(e)??{},...a?{leaseId:a}:{}}),liveAction:async e=>De.post("/api/dashboard/playtest/live",e),bindingDraft:async(e,a)=>De.post("/api/dashboard/playtest/binding-draft",{...e,...typeof a=="number"?{placeId:a}:{}}),bindingCandidates:async e=>De.post("/api/dashboard/playtest/binding-candidates",{...typeof e=="number"?{placeId:e}:{}}),saveProfile:async(e,a,n)=>De.put(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e.id)}`,{profile:e,expectedRevision:a,...typeof n=="number"?{placeId:n}:{}}),saveProfileMetadata:async(e,a,n,i)=>De.patch(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e)}/metadata`,{expectedRevision:a,...n,...typeof i=="number"?{placeId:i}:{}}),deleteProfile:async(e,a,n)=>{const i=new URLSearchParams({expectedRevision:String(a)});return n.placeId!==void 0&&i.set("placeId",String(n.placeId)),De.delete(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e)}?${i.toString()}`,n.clientId?{clientId:n.clientId}:void 0)}},Gt="weppy-playtest-workspace-v1",Ao="weppy-playtest-profile-v1:";function Je(){try{return window.localStorage}catch{return null}}function Eo(){var e;try{const a=(e=Je())==null?void 0:e.getItem(Gt);return a==="live"||a==="results"?a:"live"}catch{return"live"}}function Do(e){var a;try{(a=Je())==null||a.setItem(Gt,e)}catch{}}function bt(e){return`${Ao}${e}`}function Io(e){var a;if(e===null)return null;try{return((a=Je())==null?void 0:a.getItem(bt(e)))||null}catch{return null}}function Ye(e,a){var n;if(e!==null)try{(n=Je())==null||n.setItem(bt(e),a)}catch{}}function kt(e){var a;if(e!==null)try{(a=Je())==null||a.removeItem(bt(e))}catch{}}const Qe={entries:[],diagnostics:[]},Xe={hasManagedAdapterWithoutStudioGuard:!1};function qe(e){return typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:e instanceof Error?e.message:String(e)}function To(e){if(typeof e!="object"||e===null||!("payload"in e))return!1;const a=e.payload;return(a==null?void 0:a.errorCode)==="lease_agents_unavailable"}function Lo(e){const{enabled:a,canMutate:n,placeId:i,studioSnapshot:d}=e,[c,u]=o.useState([]),[y,m]=o.useState(!1),[_,C]=o.useState(null),[k,x]=o.useState(null),[f,V]=o.useState(Qe),[R,M]=o.useState(Xe),[w,B]=o.useState({}),[P,E]=o.useState({}),[W,$]=o.useState({}),[ee,te]=o.useState(!0),[q,O]=o.useState(null),[z,U]=o.useState(null),L=o.useRef(null),ae=o.useRef(null),J=o.useRef([]),le=o.useRef(!1),Q=o.useRef(Promise.resolve()),K=o.useRef(0),Z=o.useRef(0),X=o.useRef(null),he=o.useRef(Promise.resolve()),re=o.useRef(null),oe=o.useRef(i);oe.current=i;const[ye,we]=o.useState(0);L.current=k;const H=o.useMemo(()=>c.find(v=>v.id===_)??null,[c,_]);ae.current=H,J.current=c;const se=o.useCallback(()=>{E(v=>Object.fromEntries(Object.entries(v).map(([S,A])=>{const{observed:N,...G}=A;return[S,{...G,status:"unavailable",fresh:!1,...N!==void 0?{lastObserved:N}:{},reason:"session_ended"}]})))},[]),ne=o.useCallback(async()=>{X.current&&(clearTimeout(X.current),X.current=null),Z.current=0;const v=L.current;if(v){L.current=null,x(null),B({}),$({}),se();try{await me.liveAction({action:"close",leaseId:v.leaseId,...typeof i=="number"?{placeId:i}:{}})}catch{}}},[se,i]),ce=o.useCallback(async()=>{if(!(L.current||le.current)){le.current=!0;try{let v=ae.current,S=oe.current,A=await me.liveAction({action:v?"observe":"discover",...v?{profileId:v.id}:{},...typeof S=="number"?{placeId:S}:{}});const N=ae.current,G=oe.current,l=(N==null?void 0:N.id)??"__weppy_catalog__";(A.lease.profileId!==l||G!==S)&&(v=N,S=G,A=await me.liveAction({action:v?"observe":"discover",...v?{profileId:v.id}:{},...typeof S=="number"?{placeId:S}:{}})),L.current=A.lease,x(A.lease),A.lease.catalog&&V(A.lease.catalog),B({});const r=await me.liveStatus(S,A.lease.leaseId);E(Object.fromEntries(r.watches.map(g=>[g.subscriptionId,g]))),X.current&&clearTimeout(X.current),X.current=null,Z.current=0,U(null)}catch(v){if(U(qe(v)),To(v)&&!X.current){const S=Z.current;Z.current+=1;const A=Math.min(2e3,250*2**Math.min(S,3));X.current=setTimeout(()=>{X.current=null,we(N=>N+1)},A)}}finally{le.current=!1}}},[]);o.useEffect(()=>{a||ne()},[ne,a]),o.useEffect(()=>{let v=!1;return te(!0),m(!1),u([]),C(null),re.current=null,x(null),B({}),E({}),$({}),V(Qe),M(Xe),(async()=>{const A=me.listProfiles(i).then(N=>{var r,g;if(v)return;u(N.profiles),re.current=(r=N.scope)!=null&&r.placeId?{placeId:N.scope.placeId}:N.targetClientId?{clientId:N.targetClientId}:typeof i=="number"?{placeId:i}:null,V(N.catalog??Qe),M(N.releaseGuidance??Xe);const G=Io(i),l=N.profiles.some(D=>D.id===G)?G:((g=N.profiles[0])==null?void 0:g.id)??null;C(l),l&&Ye(i,l),m(!0)}).catch(N=>{v||(U(qe(N)),m(!0))});try{await A}finally{v||te(!1)}})(),()=>{v=!0}},[a,i]),o.useEffect(()=>{const v=++K.current,S=a&&y&&d.targetClientId!==null&&(d.state==="Running"||d.state==="Paused");!S&&X.current&&(clearTimeout(X.current),X.current=null,Z.current=0),Q.current=Q.current.catch(()=>{}).then(async()=>{if(v!==K.current)return;const A=L.current;A&&(!S||A.target.clientId!==d.targetClientId)&&await ne(),v===K.current&&S&&!L.current&&await ce()})},[ne,a,ce,ye,y,d.state,d.mode,d.targetClientId]),o.useEffect(()=>{if(!a)return;const v=new zt,S=v.on("playtest_watch",A=>{var G,l;const N=A;!(N!=null&&N.subscriptionId)||N.leaseId!==((G=L.current)==null?void 0:G.leaseId)||(N.profileGeneration??1)===(((l=L.current)==null?void 0:l.profileGeneration)??1)&&E(r=>{const g=r[N.subscriptionId];if(g&&N.sequence<=g.sequence&&N.sequence!==0)return r;const h=g&&N.sequence>0&&g.sequence>0&&N.sequence!==g.sequence+1?(()=>{const{observed:b,...T}=N;return{...T,status:"stale",fresh:!1,...b!==void 0?{lastObserved:b}:{},reason:"sequence_gap"}})():N;return{...r,[N.subscriptionId]:h}})});return v.connect(),()=>{S(),v.disconnect()}},[a]);const ie=o.useCallback(async v=>{var N;const S=J.current.find(G=>G.id===v);if(!S)return;const A=L.current;if(!A){C(v),Ye(i,v);return}if(A.profileId===S.id&&A.profileRevision===S.revision){C(v),Ye(i,v);return}O(v),U(null);try{const G=A.profileGeneration??1,l=await me.liveAction({action:"observe",profileId:v,...typeof i=="number"?{placeId:i}:{}});L.current=l.lease,x(l.lease),C(v),Ye(i,v),(l.lease.profileGeneration??1)!==G&&(B({}),$({}));const r=await me.liveStatus(i,l.lease.leaseId);(((N=L.current)==null?void 0:N.profileGeneration)??1)===(l.lease.profileGeneration??1)&&E(Object.fromEntries(r.watches.map(g=>[g.subscriptionId,g])))}catch(G){U(qe(G))}finally{O(null)}},[i]),Ne=o.useCallback(async(v,S)=>{var G;const A=L.current;if(!A||!n)return;const N=A.profileGeneration??1;B(l=>({...l,[v]:{...l[v],status:"applying",draft:S}}));try{const l=await me.liveAction({action:"apply",leaseId:A.leaseId,expectedRevision:A.revision,values:{[v]:S},...typeof i=="number"?{placeId:i}:{}}),r=l.result.bindings.find(g=>g.bindingId===v);if((((G=L.current)==null?void 0:G.profileGeneration)??1)!==N)return;x(g=>g&&(g.profileGeneration??1)===N?{...g,revision:l.result.revision}:g),B(g=>{var D,h;return{...g,[v]:l.result.status==="applied"?{status:"applied",draft:S,requested:(r==null?void 0:r.requested)??S,observed:r==null?void 0:r.observed,original:r==null?void 0:r.original}:{...g[v],status:((D=l.result.error)==null?void 0:D.code)==="requires_adapter"?"requires_adapter":"error",draft:S,message:(h=l.result.error)==null?void 0:h.message}}})}catch(l){const r=typeof l=="object"&&l!==null&&"status"in l&&l.status===409;B(g=>({...g,[v]:{...g[v],status:r?"conflict":"error",draft:S,message:qe(l)}}))}},[n,i]),ve=o.useCallback(async()=>{const v=L.current;if(!v||!n)return;const S=await me.liveAction({action:"reset",leaseId:v.leaseId,...typeof i=="number"?{placeId:i}:{}});x(S.lease),B({})},[n,i]),_e=o.useCallback(async(v,S,A)=>{var g,D;const N=L.current,G=ae.current;if(!N||!G||!n||d.state!=="Running")return;const l=structuredClone(S),r=N.profileGeneration??1;$(h=>({...h,[v]:{status:"running",requestId:A,actionId:v,arguments:l,executedAtMs:Date.now()}}));try{const h=await me.liveAction({action:"execute_action",leaseId:N.leaseId,profileId:G.id,actionId:v,requestId:A,expectedProfileRevision:G.revision,expectedRevision:N.revision,arguments:l,...typeof i=="number"?{placeId:i}:{}});(((g=L.current)==null?void 0:g.profileGeneration)??1)===r&&$(b=>({...b,[v]:h.result}))}catch(h){const b=typeof h=="object"&&h!==null&&"payload"in h?h.payload:void 0,T=(b==null?void 0:b.errorCode)==="action_result_unknown"||(b==null?void 0:b.errorCode)==="plugin_disconnected"||(b==null?void 0:b.errorCode)==="command_timeout";if((((D=L.current)==null?void 0:D.profileGeneration)??1)!==r)return;$(I=>({...I,[v]:{status:T?"unknown":"failed",requestId:A,actionId:v,arguments:l,executedAtMs:Date.now(),error:{code:(b==null?void 0:b.errorCode)??"action_failed",message:qe(h)}}}))}},[n,i,d.state]),xe=o.useCallback(async v=>{const S=v.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||`profile-${Date.now()}`,A=await me.saveProfile({schemaVersion:4,id:S,name:v.trim(),controls:[],watches:[],actions:[],presentation:{},settings:{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"},sectionOrder:["watches","controls","actions"]},0,i);return u(N=>[...N,A.profile]),J.current=[...J.current,A.profile],await ie(A.profile.id),A.profile},[i,ie]),Ce=o.useCallback(async v=>{var G;const{revision:S,...A}=v,N=await me.saveProfile(A,S,i);u(l=>l.map(r=>r.id===N.profile.id?N.profile:r)),J.current=J.current.map(l=>l.id===N.profile.id?N.profile:l),((G=L.current)==null?void 0:G.profileId)===N.profile.id&&await ie(N.profile.id)},[i,ie]),be=o.useCallback(async(v,S,A)=>{const N=ae.current;if(!N)throw new Error("Select a test profile before saving a value.");const G=N.id;await new Promise((l,r)=>{he.current=he.current.catch(()=>{}).then(async()=>{var h,b;const g=J.current.find(T=>T.id===G);if(!g)throw new Error("The selected test profile is no longer available.");const D=await me.saveProfileMetadata(g.id,g.revision,{defaults:{[v]:S}},i);((h=ae.current)==null?void 0:h.id)===D.profile.id&&(ae.current=D.profile),J.current=J.current.map(T=>T.id===D.profile.id?D.profile:T),u(J.current),((b=L.current)==null?void 0:b.profileId)===D.profile.id&&await ie(D.profile.id)}),he.current.then(l,r)})},[i,ie]),fe=o.useCallback(async v=>{var A;const S=(A=ae.current)==null?void 0:A.id;if(!S)throw new Error("Select a test profile before saving display settings.");await new Promise((N,G)=>{he.current=he.current.catch(()=>{}).then(async()=>{var g,D;const l=J.current.find(h=>h.id===S);if(!l)throw new Error("The selected test profile is no longer available.");const r=await me.saveProfileMetadata(l.id,l.revision,v,i);((g=ae.current)==null?void 0:g.id)===r.profile.id&&(ae.current=r.profile),J.current=J.current.map(h=>h.id===r.profile.id?r.profile:h),u(J.current),((D=L.current)==null?void 0:D.profileId)===r.profile.id&&await ie(r.profile.id)}),he.current.then(N,G)})},[i,ie]),Re=o.useCallback(async(v,S)=>{await fe({actionDefaults:{[v]:S}})},[fe]),p=o.useCallback(async v=>({path:(await me.bindingDraft(v,i)).binding.path}),[i]),j=o.useCallback(async()=>await me.bindingCandidates(i),[i]),F=o.useCallback(async(v,S)=>{var r,g,D,h;const A=re.current,N=i;if(!A)throw Object.assign(new Error("profile_scope_unavailable"),{code:"profile_scope_unavailable"});if(((r=L.current)==null?void 0:r.profileId)===v){const b=J.current.find(T=>T.id!==v);if(b){if(await ie(b.id),((g=L.current)==null?void 0:g.profileId)!==b.id)throw new Error("Could not switch away from the active profile before deleting it.")}else{const T=await me.liveAction({action:"discover",...typeof N=="number"?{placeId:N}:{}});L.current=T.lease,x(T.lease),B({}),E({}),$({})}}await me.deleteProfile(v,S,A);let G;try{G=await me.listProfiles(N)}catch{if(oe.current!==N)return{refreshFailed:!0};const b=J.current.filter(I=>I.id!==v);J.current=b;const T=((D=b[0])==null?void 0:D.id)??null;if(u(b),B({}),E({}),$({}),T)await ie(T);else if(C(null),kt(N),L.current&&L.current.profileId!=="__weppy_catalog__"){const I=await me.liveAction({action:"discover",...typeof N=="number"?{placeId:N}:{}});L.current=I.lease,x(I.lease)}return{refreshFailed:!0}}if(oe.current!==N)return{refreshFailed:!1};u(G.profiles),J.current=G.profiles,V(G.catalog??Qe),M(G.releaseGuidance??Xe);const l=((h=G.profiles[0])==null?void 0:h.id)??null;if(B({}),E({}),$({}),l)await ie(l);else if(C(null),kt(N),L.current&&L.current.profileId!=="__weppy_catalog__"){const b=await me.liveAction({action:"discover",...typeof N=="number"?{placeId:N}:{}});L.current=b.lease,x(b.lease)}return{refreshFailed:!1}},[i,ie]);return{profiles:c,selectedProfileId:_,profile:H,catalog:f,releaseGuidance:R,lease:k,controls:w,watches:P,actions:W,studioState:d.state,studioMode:d.mode,canMutate:n,loading:ee,switchingProfileId:q,error:z,selectProfile:ie,apply:Ne,executeAction:_e,resetAll:ve,createProfile:xe,saveProfile:Ce,saveControlValue:be,saveActionDefaults:Re,saveProfileMetadata:fe,resolveSelection:p,resolveSelectionCandidates:j,deleteProfile:F}}function Mo(e){const{t:a}=ue(),n=[{key:"live",label:a("playtest.view.liveSession","Test Values")},{key:"results",label:a("playtest.view.testResults","Automated Test Results")}];return t.jsx(oa,{items:n,value:e.value,onChange:e.onChange,ariaLabel:a("playtest.view.workspaceLabel","Playtest workspace"),className:s.workspaceTabs})}function $o(e){const{t:a}=ue(),n=e.studioState==="Running"&&e.studioMode==="run"?a("playtest.session.state.runRunning","Run running"):e.studioState==="Running"&&e.studioMode==="play"?a("playtest.session.state.playRunning","Play running"):a(`playtest.session.state.${e.studioState.toLowerCase()}`,e.studioState),i=e.studioState==="Disconnected"?a("playtest.session.disconnectedDescription","Connect Roblox Studio and WEPPY Plugin to observe Playtest values."):e.studioState==="Edit"?null:e.studioState==="Paused"?a("playtest.session.pausedDescription","Studio Play is paused. Observations remain connected, and Pro value changes stay available."):e.lease?`${e.profileName??e.lease.profileId} · ${e.lease.target.targetAlias??e.lease.target.clientId}`:a("playtest.session.connectingDescription","Studio is playing. Connecting runtime observations…");return t.jsx("section",{className:s.sessionBar,"aria-label":a("playtest.session.label","Playtest session"),children:t.jsxs("div",{className:s.sessionIdentity,children:[t.jsx(_a,{size:16,"aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("strong",{children:n}),i&&t.jsx("span",{children:i})]})]})})}function Oe(e){const{t:a}=ue(),[n,i]=o.useState(!1),d=o.useRef(null),c=o.useRef(null),u=o.useRef(null),[y,m]=o.useState({top:0,left:0});return o.useLayoutEffect(()=>{var R;if(!n||e.active||!c.current||!u.current)return;const C=(((R=d.current)==null?void 0:R.querySelector("input, select, button"))??c.current).getBoundingClientRect(),k=u.current.getBoundingClientRect(),x=C.top-k.height-6,f=C.bottom+6,V=x<8&&f+k.height<=window.innerHeight-8?f:x;m({top:Math.max(8,Math.min(V,window.innerHeight-k.height-8)),left:Math.max(8,Math.min(C.left+C.width/2-k.width/2,window.innerWidth-k.width-8))})},[n,e.active,e.reason]),o.useEffect(()=>{if(!n)return;const _=()=>i(!1);return window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_)}},[n]),t.jsxs("div",{ref:d,className:s.controlGate,children:[e.children,!e.active&&t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:c,type:"button",className:s.controlGateTrigger,"aria-label":a("playtest.controls.lockedHelp","Why is {{label}} unavailable?").replace("{{label}}",e.label),"aria-describedby":"playtest-controls-availability","aria-expanded":n,onClick:()=>i(!0),onFocus:()=>i(!0),onBlur:()=>i(!1),onKeyDown:_=>{_.key==="Escape"&&i(!1)}}),n&&Wt.createPortal(t.jsx("span",{ref:u,className:s.controlGateHint,style:y,role:"status",children:e.reason}),document.body)]})]})}function _t(e){var a,n,i;return t.jsx(Ke,{open:e.open,ariaLabel:e.ariaLabel,onClose:e.onClose,returnFocusTo:e.returnFocusTo,testId:"playtest-value-detail-layer",children:t.jsxs("div",{className:s.valueDetailShell,children:[t.jsx(ze,{title:e.title,description:e.description,closeLabel:e.closeLabel,onRequestClose:e.onClose}),t.jsxs("div",{className:s.valueDetailBody,children:[t.jsx("dl",{className:s.valueDetailList,children:e.items.map(d=>t.jsxs("div",{children:[t.jsx("dt",{children:d.label}),t.jsx("dd",{children:d.value})]},d.label))}),t.jsx("div",{className:s.valueDetailFeedback,"data-state":e.error?"error":((a=e.feedback)==null?void 0:a.state)??"idle",role:e.error||((n=e.feedback)==null?void 0:n.state)==="error"?"alert":"status","aria-live":"polite",children:e.error??((i=e.feedback)==null?void 0:i.message)??" "}),e.actions&&e.actions.length>0&&t.jsx("div",{className:s.valueDetailActions,children:e.actions.map(d=>{var c,u,y;return t.jsx(Oe,{active:((c=d.gate)==null?void 0:c.active)??!0,label:((u=d.gate)==null?void 0:u.label)??d.label,reason:((y=d.gate)==null?void 0:y.reason)??"",children:t.jsx("button",{type:"button",className:d.variant==="secondary"?s.secondaryAction:s.primaryAction,"aria-label":d.accessibleLabel,disabled:d.disabled,onClick:d.onClick,children:d.label})},d.accessibleLabel)})})]})]})})}function Ge(e){return e==="vector3"||e==="color3"||e==="cframe"}function qt(e){return e==="vector3"?["x","y","z"]:e==="color3"?["r","g","b"]:["X","Y","Z","R00","R01","R02","R10","R11","R12","R20","R21","R22"]}function xt(e,a){try{const n=JSON.parse(a),i=qt(e);if(e==="cframe"?!Array.isArray(n)||n.length!==12:!n||Array.isArray(n)||typeof n!="object"||Object.keys(n).length!==3)return;const d=i.map((c,u)=>e==="cframe"?n[u]:n[c]);if(!d.every(c=>typeof c=="number"&&Number.isFinite(c))||e==="color3"&&d.some(c=>c<0||c>1))return;if(e==="cframe"){const c=d,u=(m,_)=>c[m]*c[_]+c[m+1]*c[_+1]+c[m+2]*c[_+2],y=c[3]*(c[7]*c[11]-c[8]*c[10])-c[4]*(c[6]*c[11]-c[8]*c[9])+c[5]*(c[6]*c[10]-c[7]*c[9]);if([3,6,9].some(m=>Math.abs(u(m,m)-1)>1e-5)||[[3,6],[3,9],[6,9]].some(([m,_])=>Math.abs(u(m,_))>1e-5)||Math.abs(y-1)>1e-5)return}return n}catch{return}}function st(e){if(e===void 0)return"—";if(typeof e=="string")return e.replace(/^Enum\.[^.]+\./,"");if(e&&typeof e=="object"&&!Array.isArray(e)){const a="x"in e?["x","y","z"]:"r"in e?["r","g","b"]:[];if(a.length===3&&a.every(n=>typeof e[n]=="number"))return a.map(n=>`${n.toUpperCase()} ${Number(e[n].toPrecision(6))}`).join(" · ")}return JSON.stringify(e)}function yt(e){const a=o.useRef(!1),n=qt(e.type);let i={};try{i=JSON.parse(e.draft)??{}}catch{}const d=n.map((m,_)=>{const C=e.type==="cframe"?i[_]:i[m];return C==null?"":String(C)}),c=(m,_)=>{const k=d.map((x,f)=>f===m?_:x).map(x=>x.trim()!==""&&!/[.eE+-]$/.test(x)&&Number.isFinite(Number(x))?Number(x):x);e.onChange(JSON.stringify(e.type==="cframe"?k:Object.fromEntries(n.map((x,f)=>[x,k[f]]))))},u=xt(e.type,e.draft),y=u&&!Array.isArray(u)&&typeof u=="object"?`#${["r","g","b"].map(m=>Math.round(Number(u[m])*255).toString(16).padStart(2,"0")).join("")}`:"#000000";return t.jsxs("div",{className:s.compoundEditor,role:"group","aria-label":e.label,onFocus:()=>{var m;return(m=e.onFocusChange)==null?void 0:m.call(e,!0)},onBlur:m=>{var _,C;m.currentTarget.contains(m.relatedTarget)||((_=e.onFocusChange)==null||_.call(e,!1),a.current||(C=e.onCommit)==null||C.call(e))},onCompositionStart:()=>{a.current=!0},onCompositionEnd:()=>{a.current=!1},onKeyDown:m=>{var _;m.key==="Enter"&&!m.nativeEvent.isComposing&&!a.current&&((_=e.onCommit)==null||_.call(e))},children:[e.type==="color3"&&t.jsx("input",{className:s.colorSwatch,type:"color",value:y,disabled:e.disabled,"aria-label":`${e.label} RGB`,"aria-describedby":e.describedBy,onChange:m=>{const _=m.target.value.slice(1);e.onChange(JSON.stringify({r:parseInt(_.slice(0,2),16)/255,g:parseInt(_.slice(2,4),16)/255,b:parseInt(_.slice(4,6),16)/255}))}}),t.jsx("div",{className:s.compoundCoordinates,children:n.map((m,_)=>t.jsxs("label",{children:[t.jsxs("span",{children:[m.toUpperCase(),e.type==="color3"?" (0–1)":""]}),t.jsx("input",{inputMode:"decimal",value:d[_],disabled:e.disabled,"aria-label":`${e.label} ${m.toUpperCase()}`,"aria-describedby":e.describedBy,"aria-invalid":e.draft!==""&&u===void 0||void 0,onChange:C=>c(_,C.target.value)})]},m))})]})}function Ae(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Vo(e,a,n){const i=n!=null&&n.fresh?n.observed:n==null?void 0:n.lastObserved,d=(a==null?void 0:a.draft)??i??e.value;return d===void 0?"":Ae(d)}function He(e,a){var n;if(Ge(e.valueType))return xt(e.valueType,a);if(e.valueType==="number"){if(a.trim()==="")return;const i=Number(a);return Number.isFinite(i)?i:void 0}return e.valueType==="boolean"?a==="true":e.valueType==="enum"?((n=e.enumValues)==null?void 0:n.find(i=>Ae(i)===a))??a:a}function Be(e){return e&&typeof e=="object"&&!Array.isArray(e)?`object:${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${Be(e[a])}`).join(",")}`:`${typeof e}:${JSON.stringify(e)}`}function Ue(e){var a;return e.value!==void 0?Ae(e.value):e.valueType==="boolean"?"false":e.valueType==="enum"?Ae((a=e.enumValues)==null?void 0:a[0]):""}function Oo(e){var i;const{t:a}=ue();if(!e.profile||e.profile.controls.length===0)return t.jsx("div",{className:s.panelEmpty,children:a("playtest.controls.empty","No test controls in this profile yet.")});const n=((i=e.profile.settings)==null?void 0:i.runtimeApplyMode)??"manual";return t.jsx("div",{className:s.liveRows,children:e.profile.controls.map(d=>{var c,u,y;return t.jsx(Bo,{control:d,active:e.active,inactiveReason:e.inactiveReason,profileSaveLocked:e.profileSaveLocked,runtimeApplyMode:n,state:e.states[d.id],watch:e.watches[`control:${d.id}`],presentation:(u=(c=e.profile)==null?void 0:c.presentation)==null?void 0:u[d.id],draftState:(y=e.drafts)==null?void 0:y[d.id],onDraftChange:e.onDraftChange,onApply:e.onApply,onSaveValue:e.onSaveValue,onRemoveValue:e.onRemoveValue},`${e.draftScope??"profile"}:${d.id}`)})})}function Bo(e){var ie,Ne,ve,_e,xe,Ce,be,fe,Re,p,j,F,v,S,A,N,G,l,r,g,D;const{t:a}=ue(),n=Vo(e.control,e.state,e.watch),[i,d]=o.useState(n),[c,u]=o.useState(!1),[y,m]=o.useState("idle"),[_,C]=o.useState(null),[k,x]=o.useState(()=>Ue(e.control)),[f,V]=o.useState(e.control.value),[R,M]=o.useState(null),[w,B]=o.useState(!1),P=o.useRef(null),E=o.useRef(!1),W=o.useRef(!1),$=o.useRef(null),ee=((ie=e.draftState)==null?void 0:ie.value)??i,te=((Ne=e.draftState)==null?void 0:Ne.dirty)??c;o.useEffect(()=>{d(n),u(!1),x(Ue(e.control)),V(e.control.value),M(null),C(null),$.current=null},[e.control.id]),o.useEffect(()=>{x(Ue(e.control)),V(e.control.value)},[e.control.value]),o.useEffect(()=>{!e.draftState&&!te&&!E.current&&d(n)},[te,n,e.draftState]),o.useEffect(()=>{var h,b,T;(((h=e.state)==null?void 0:h.status)==="error"||((b=e.state)==null?void 0:b.status)==="conflict"||((T=e.state)==null?void 0:T.status)==="requires_adapter")&&($.current=null)},[(ve=e.state)==null?void 0:ve.status]);const q=()=>He(e.control,ee),O=h=>{if(!e.active||W.current)return;const b=h??q();if(b===void 0)return;const T=Be(b);$.current!==T&&($.current=T,e.onApply(e.control.id,b))},z=h=>{var T;d(h),u(!0),(T=e.onDraftChange)==null||T.call(e,e.control.id,h,!0);const b=He(e.control,h);(b===void 0||Be(b)!==$.current)&&($.current=null)},U=async()=>{const h=He(e.control,k);if(!(h===void 0||!e.onSaveValue||e.profileSaveLocked||y!=="idle")){m("saving"),C(null),M(null);try{await e.onSaveValue(e.control.id,h,e.control.applyOnStart??!1),V(h),M({state:"saved",value:Ae(h)})}catch(b){C(b instanceof Error?b.message:String(b))}finally{m("idle")}}},L=async()=>{if(!(f===void 0||!e.onRemoveValue||e.profileSaveLocked||y!=="idle")){m("removing"),C(null),M(null);try{await e.onRemoveValue(e.control.id),x(Ue({...e.control,value:void 0})),V(void 0),M({state:"removed"})}catch(h){C(h instanceof Error?h.message:String(h))}finally{m("idle")}}},ae=a("playtest.controls.inputLabel","Input value for {{label}}").replace("{{label}}",e.control.label),J=e.active?void 0:"playtest-controls-availability",le=e.inactiveReason??a("playtest.values.playRequired","Start Play in Studio to change test values."),Q=e.control.valueType==="number"&&((_e=e.control.constraints)==null?void 0:_e.minimum)!==void 0&&((xe=e.control.constraints)==null?void 0:xe.maximum)!==void 0,K=(Ce=e.watch)!=null&&Ce.fresh?e.watch.observed:(be=e.watch)==null?void 0:be.lastObserved,Z=(fe=e.watch)!=null&&fe.fresh?a("playtest.controls.currentObserved","Current value"):K!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),X=((Re=e.state)==null?void 0:Re.status)??"idle",he=e.control.origin?`ServerStorage.WeppyTestAdapters.${e.control.origin.adapter}`:e.control.path?[e.control.path.root,...e.control.path.segments].join("."):"adapter",re=e.runtimeApplyMode==="auto",oe=q(),ye=X==="applying"||X==="pending_resume",we=!re&&e.active&&te&&oe!==void 0&&K!==void 0&&Be(oe)!==Be(K)&&Be(oe)!==$.current&&!ye,H=f===void 0?a("playtest.controls.noSavedValue","No saved default"):Ae(f),se=a("playtest.controls.defaultInputLabel","Saved default for {{label}}").replace("{{label}}",e.control.label);let ne;Ge(e.control.valueType)?ne=t.jsx(yt,{type:e.control.valueType,draft:ee,label:ae,disabled:!e.active,describedBy:J,onChange:z,onFocusChange:h=>{E.current=h},onCommit:()=>{re&&O()}}):e.control.valueType==="boolean"?ne=t.jsxs("label",{className:s.booleanEditor,children:[t.jsx("input",{type:"checkbox",checked:ee==="true",disabled:!e.active,"aria-label":ae,"aria-describedby":J,onFocus:()=>{E.current=!0},onBlur:()=>{E.current=!1},onChange:h=>{const b=h.target.checked;z(String(b)),re&&O(b)}}),t.jsx("span",{children:ee==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?ne=t.jsx("select",{"aria-label":ae,"aria-describedby":J,value:ee,disabled:!e.active,onFocus:()=>{E.current=!0},onBlur:()=>{E.current=!1},onChange:h=>{z(h.target.value);const b=He(e.control,h.target.value);re&&b!==void 0&&O(b)},children:(e.control.enumValues??[]).map(h=>t.jsx("option",{value:Ae(h),children:st(h)},Ae(h)))}):Q?ne=t.jsxs("div",{className:s.rangeEditor,children:[t.jsx("input",{type:"range",value:ee||String(((p=e.control.constraints)==null?void 0:p.minimum)??0),min:(j=e.control.constraints)==null?void 0:j.minimum,max:(F=e.control.constraints)==null?void 0:F.maximum,step:((v=e.control.constraints)==null?void 0:v.step)??1,disabled:!e.active,"aria-label":ae,"aria-describedby":J,onFocus:()=>{E.current=!0},onBlur:()=>{E.current=!1},onChange:h=>z(h.target.value),onPointerUp:()=>{re&&O()},onKeyUp:h=>{re&&(h.key.startsWith("Arrow")||h.key==="Home"||h.key==="End")&&O()}}),t.jsx("output",{children:ee||"—"})]}):ne=t.jsx("input",{value:ee,disabled:!e.active,inputMode:e.control.valueType==="number"?"decimal":void 0,onFocus:()=>{E.current=!0},onChange:h=>z(h.target.value),onCompositionStart:()=>{W.current=!0},onCompositionEnd:()=>{W.current=!1},onKeyDown:h=>{re&&h.key==="Enter"&&!h.nativeEvent.isComposing&&O()},onBlur:()=>{E.current=!1,re&&O()},"aria-label":ae,"aria-describedby":J});let ce;return Ge(e.control.valueType)?ce=t.jsx(yt,{type:e.control.valueType,draft:k,label:se,disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle",onChange:h=>{x(h),M(null),C(null)}}):e.control.valueType==="boolean"?ce=t.jsxs("label",{className:s.defaultBooleanEditor,children:[t.jsx("input",{type:"checkbox",checked:k==="true",disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle","aria-label":se,onChange:h=>{x(String(h.target.checked)),M(null),C(null)}}),t.jsx("span",{children:k==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?ce=t.jsx("select",{value:k,disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle","aria-label":se,onChange:h=>{x(h.target.value),M(null),C(null)},children:(e.control.enumValues??[]).map(h=>t.jsx("option",{value:Ae(h),children:st(h)},Ae(h)))}):ce=t.jsx("input",{type:e.control.valueType==="number"?"number":"text",value:k,min:(S=e.control.constraints)==null?void 0:S.minimum,max:(A=e.control.constraints)==null?void 0:A.maximum,step:(N=e.control.constraints)==null?void 0:N.step,disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle","aria-label":se,onChange:h=>{x(h.target.value),M(null),C(null)}}),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.controlRow,children:[t.jsxs("div",{className:s.rowIdentity,children:[t.jsx("strong",{children:e.control.label}),(((G=e.presentation)==null?void 0:G.pinned)||((l=e.presentation)==null?void 0:l.group))&&t.jsxs("span",{className:s.presentationMeta,children:[e.presentation.pinned?a("playtest.values.pinned","Pinned"):"",e.presentation.pinned&&e.presentation.group?" · ":"",e.presentation.group??""]}),t.jsx("button",{ref:P,type:"button",className:s.valueDetailButton,"aria-label":a("playtest.values.detailsFor","Value details for {{label}}").replace("{{label}}",e.control.label),onClick:()=>{x(Ue({...e.control,value:f})),M(null),C(null),B(!0)},children:a("playtest.values.viewDetails","View details")})]}),t.jsxs("div",{className:s.actualValue,"aria-label":`${Z} ${Ae(K)}`,children:[t.jsx("span",{children:Z}),t.jsx("strong",{children:st(K)})]}),t.jsxs("div",{className:s.controlEditor,children:[t.jsxs("div",{className:s.editorHeading,children:[t.jsx("span",{className:s.editorLabel,children:a("playtest.controls.inputValue","Input value")}),t.jsxs("span",{className:s.savedValueState,title:H,"aria-label":a("playtest.controls.savedDefaultState","Saved default for {{label}}: {{value}}").replace("{{label}}",e.control.label).replace("{{value}}",H),children:[a("playtest.controls.defaultValue","Saved default")," ",t.jsx("strong",{children:H})]})]}),t.jsxs("div",{className:s.controlEditorRow,children:[t.jsx(Oe,{active:e.active,label:`${e.control.label} input`,reason:le,children:ne}),t.jsx("div",{className:s.controlActions,children:t.jsx(Oe,{active:e.active,label:`${e.control.label} apply`,reason:le,children:t.jsx("button",{type:"button",className:s.secondaryAction,disabled:!we,"aria-label":a("playtest.controls.applyLabel","Apply the input value for {{label}}").replace("{{label}}",e.control.label),onClick:()=>O(),children:a("playtest.controls.applyRuntime","Apply manually")})})})]}),t.jsx("span",{className:s.rowFeedback,"data-state":_?"error":X,"aria-live":"polite",children:_??(X==="applying"?a("playtest.controls.applying","Applying…"):X==="pending_resume"?a("playtest.controls.pendingResume","Apply on resume"):X==="applied"?a("playtest.controls.applied","Applied · readback {{value}}").replace("{{value}}",Ae((r=e.state)==null?void 0:r.observed)):X==="conflict"?a("playtest.controls.conflict","Conflict · reload the current revision"):X==="requires_adapter"?a("playtest.controls.requiresAdapter","Requires reviewed adapter"):X==="error"?((g=e.state)==null?void 0:g.message)??a("playtest.controls.applyFailed","Apply failed"):e.active?re?a("playtest.controls.autoApplyReady","Changes apply automatically when the input is confirmed"):a("playtest.controls.readyToApply","Input value is ready to apply or save as the default"):" ")})]})]}),t.jsx(_t,{open:w,title:e.control.label,description:a("playtest.controls.details","Value details"),ariaLabel:a("playtest.values.detailsDialog","{{label}} value details").replace("{{label}}",e.control.label),closeLabel:a("common.close","Close"),returnFocusTo:P.current,onClose:()=>B(!1),items:[{label:Z,value:Ae(K)},{label:a("playtest.controls.defaultValue","Saved default"),value:t.jsx("div",{className:s.defaultValueEditor,children:ce})},{label:a("playtest.controls.originalValue","Original runtime value"),value:Ae((D=e.state)==null?void 0:D.original)},{label:a("playtest.controls.registration","Registration"),value:`${e.control.target.role} · ${e.control.access.kind}`},{label:a("playtest.values.location","Location"),value:he},{label:a("playtest.values.valueType","Value type"),value:e.control.valueType}],error:_,feedback:(R==null?void 0:R.state)==="saved"?{state:"success",message:a("playtest.controls.defaultSavedFeedback","Saved default {{value}} · Saved").replace("{{value}}",R.value??"")}:(R==null?void 0:R.state)==="removed"?{state:"success",message:a("playtest.controls.defaultRemovedFeedback","No saved default · Removed")}:null,actions:[{label:y==="removing"?a("playtest.controls.removingDefault","Removing…"):a("playtest.controls.removeDefault","Remove default"),accessibleLabel:a("playtest.controls.removeDefaultLabel","Remove saved default for {{label}}").replace("{{label}}",e.control.label),disabled:f===void 0||!e.onRemoveValue||e.profileSaveLocked||y!=="idle",variant:"secondary",onClick:()=>void L()},{label:y==="saving"?a("playtest.profile.saving","Saving…"):a("playtest.controls.saveDefault","Save default"),accessibleLabel:a("playtest.controls.saveLabel","Save default for {{label}}").replace("{{label}}",e.control.label),disabled:!e.onSaveValue||e.profileSaveLocked||y!=="idle"||He(e.control,k)===void 0,onClick:()=>void U()}]})]})}function Ze(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Fo(e){var C;const{t:a}=ue(),n=[...((C=e.profile)==null?void 0:C.watches.map(k=>({...k,subscriptionId:`watch:${k.id}`})))??[]],[i,d]=o.useState(null),c=o.useRef(null);if(n.length===0)return t.jsx("div",{className:s.panelEmpty,children:a("playtest.watch.empty","Observed values appear here during Play.")});const u=n.find(k=>k.id===i),y=u?e.watches[u.subscriptionId]:void 0,m=y!=null&&y.fresh?y.observed:y==null?void 0:y.lastObserved,_=u!=null&&u.path?[u.path.root,...u.path.segments].join("."):(u==null?void 0:u.access.adapter)??"adapter";return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:s.watchRows,children:n.map(k=>{var M,w;const x=e.watches[k.subscriptionId],f=(w=(M=e.profile)==null?void 0:M.presentation)==null?void 0:w[k.id],V=x!=null&&x.fresh?x.observed:x==null?void 0:x.lastObserved,R=x!=null&&x.fresh?a("playtest.watch.currentValue","Current value"):V!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet");return t.jsxs("div",{className:s.watchRow,"data-value-type":k.valueType,children:[t.jsxs("div",{className:s.watchCardMain,children:[t.jsx("strong",{children:k.label}),((f==null?void 0:f.pinned)||(f==null?void 0:f.group))&&t.jsxs("span",{className:s.presentationMeta,children:[f.pinned?a("playtest.values.pinned","Pinned"):"",f.pinned&&f.group?" · ":"",f.group??""]}),t.jsx("button",{type:"button",className:s.valueDetailButton,"aria-label":a("playtest.values.detailsFor","Value details for {{label}}").replace("{{label}}",k.label),onClick:B=>{c.current=B.currentTarget,d(k.id)},children:a("playtest.values.viewDetails","View details")})]}),t.jsxs("div",{className:s.watchReading,children:[!(x!=null&&x.fresh)&&t.jsx("span",{children:R}),t.jsx("strong",{title:Ze(V),"aria-label":`${R} ${Ze(V)}`,children:Ze(V)})]}),x&&x.status!=="fresh"&&t.jsx("span",{className:s.freshness,"data-status":x.status,children:(x==null?void 0:x.status)==="stale"?a("playtest.watch.stale","Stale"):a("playtest.watch.unavailable","Unavailable")})]},k.subscriptionId)})}),u&&t.jsx(_t,{open:i!==null,title:u.label,description:a("playtest.watch.details","Observation details"),ariaLabel:a("playtest.values.detailsDialog","{{label}} value details").replace("{{label}}",u.label),closeLabel:a("common.close","Close"),returnFocusTo:c.current,onClose:()=>d(null),items:[{label:a("playtest.watch.registration","Registration"),value:`${u.target.role} · ${u.access.kind}`},{label:a("playtest.values.location","Location"),value:_},{label:a("playtest.values.valueType","Value type"),value:u.valueType},{label:y!=null&&y.fresh?a("playtest.watch.currentValue","Current value"):m!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),value:Ze(m)},...y!=null&&y.observedAtMs?[{label:a("playtest.watch.observedAt","Observed at"),value:t.jsx("time",{children:new Date(y.observedAtMs).toLocaleTimeString()})}]:[]]})]})}function nt(e,a){return Object.prototype.hasOwnProperty.call(e,a)}function Go(e,a){var n;if(e.type==="string")return typeof a=="string"?a:void 0;if(e.type==="boolean")return typeof a=="boolean"?a:void 0;if(e.type==="number"||e.type==="integer"){const i=typeof a=="number"?a:typeof a=="string"&&a.trim()!==""?Number(a):NaN;return Number.isFinite(i)?i:void 0}return(n=e.enumValues)==null?void 0:n.find(i=>i===a)}function qo(e,a){if(e.type==="integer"&&!Number.isInteger(a))return"Enter a whole number.";if(typeof a=="number"){if(e.minimum!==void 0&&a<e.minimum)return`Enter ${e.minimum} or more.`;if(e.maximum!==void 0&&a>e.maximum)return`Enter ${e.maximum} or less.`}if(typeof a=="string"){if(e.minLength!==void 0&&a.length<e.minLength)return`Enter at least ${e.minLength} characters.`;if(e.maxLength!==void 0&&a.length>e.maxLength)return`Enter no more than ${e.maxLength} characters.`}return null}function Ht(e){return Object.fromEntries(e.parameters.map(a=>[a.name,e.defaultArguments&&nt(e.defaultArguments,a.name)?e.defaultArguments[a.name]:a.defaultValue]))}function At(e,a){const n={},i=new Set(e.parameters.map(c=>c.name));for(const c of Object.keys(a))nt(e.fixedArguments,c)?n[c]="This argument is fixed and cannot be changed.":i.has(c)||(n[c]="This argument is not declared.");const d=structuredClone(e.fixedArguments);for(const c of[...e.parameters].sort((u,y)=>u.order-y.order)){const u=nt(a,c.name)?a[c.name]:e.defaultArguments&&nt(e.defaultArguments,c.name)?e.defaultArguments[c.name]:c.defaultValue;if(u===void 0){c.required&&(n[c.name]="This value is required.");continue}const y=Go(c,u);if(y===void 0){n[c.name]=c.type==="enum"?"Choose one of the available values.":"Enter a valid value.";continue}const m=qo(c,y);m?n[c.name]=m:d[c.name]=y}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0,arguments:d}}function Et(e){const{t:a}=ue();return t.jsx("div",{className:s.actionParameterGrid,children:[...e.action.parameters].sort((n,i)=>n.order-i.order).map(n=>{var m,_;const i=(m=e.errors)==null?void 0:m[n.name],d=`playtest-action-${e.action.id}-${n.name}-error`,c=e.draft[n.name],u=`${n.label}${n.unit?` (${n.unit})`:""}`;let y;if(n.type==="boolean")y=t.jsx("input",{type:"checkbox","aria-label":u,checked:c===!0,disabled:e.disabled,"aria-invalid":!!i,"aria-describedby":i?d:void 0,onChange:C=>e.onChange(n.name,C.target.checked)});else if(n.type==="enum"){const C=((_=n.enumValues)==null?void 0:_.findIndex(k=>k===c))??-1;y=t.jsxs("select",{"aria-label":u,value:C<0?"":String(C),disabled:e.disabled,"aria-invalid":!!i,"aria-describedby":i?d:void 0,onChange:k=>{var f;const x=Number(k.target.value);e.onChange(n.name,Number.isInteger(x)?(f=n.enumValues)==null?void 0:f[x]:void 0)},children:[t.jsx("option",{value:"",children:n.required?a("playtest.actions.chooseValue","Choose a value"):a("playtest.actions.omitValue","Do not use")}),(n.enumValues??[]).map((k,x)=>t.jsx("option",{value:x,children:String(k)},`${x}:${String(k)}`))]})}else y=t.jsx("input",{type:n.type==="string"?"text":"number",inputMode:n.type==="string"?void 0:"decimal",step:n.type==="integer"?1:"any",min:n.minimum,max:n.maximum,minLength:n.minLength,maxLength:n.maxLength,"aria-label":u,"aria-invalid":!!i,"aria-describedby":i?d:void 0,disabled:e.disabled,value:typeof c=="string"||typeof c=="number"?String(c):"",onChange:C=>e.onChange(n.name,C.target.value)});return t.jsxs("label",{className:s.actionParameter,children:[t.jsxs("span",{children:[u,n.required?" *":""]}),y,n.description&&t.jsx("small",{children:n.description}),i&&t.jsx("small",{id:d,className:s.actionParameterError,role:"alert",children:i})]},n.name)})})}function ct(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Ho(e){var P,E,W,$,ee,te;const{t:a}=ue(),[n,i]=o.useState(!1),[d,c]=o.useState({}),u=o.useRef(null),y=e.draft??Ht(e.action),m=o.useMemo(()=>[...e.action.parameters].sort((q,O)=>q.order-O.order),[e.action.parameters]),_=At(e.action,y),C=((P=e.state)==null?void 0:P.status)??"idle",k=C==="running",x=e.inactiveReason??a("playtest.actions.playRequired","Start Studio Play before running this action."),f=m.length===0?a("playtest.actions.noParameters","No input required"):m.map(q=>`${q.label}: ${ct(y[q.name])}`).join(" · "),V=Object.entries(e.action.fixedArguments).map(([q,O])=>`${q}: ${ct(O)}`).join(" · "),R=C==="running"?a("playtest.actions.running","Running…"):C==="succeeded"?a("playtest.actions.succeeded","Succeeded"):C==="failed"?((W=(E=e.state)==null?void 0:E.error)==null?void 0:W.message)??a("playtest.actions.failed","Failed"):C==="unknown"?a("playtest.actions.unknown","Result unknown"):" ",M=(q,O)=>{const z={...y,[q]:O};c(U=>{const L={...U};return delete L[q],L}),e.onDraftChange(e.action.id,z)},w=()=>{const q=At(e.action,y);if(!q.ok){c(q.errors);return}e.onExecute(e.action.id,structuredClone(q.arguments))},B=()=>{if(!_.ok){c(_.errors);return}const q=new Set(e.action.parameters.map(O=>O.name));e.onSaveDefaults(e.action.id,Object.fromEntries(Object.entries(_.arguments).filter(([O])=>q.has(O))))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.actionRow,"data-state":C,children:[t.jsxs("div",{className:s.rowIdentity,children:[t.jsx("strong",{children:e.action.label}),e.action.description&&t.jsx("span",{children:e.action.description}),((($=e.presentation)==null?void 0:$.pinned)||((ee=e.presentation)==null?void 0:ee.group))&&t.jsxs("span",{className:s.presentationMeta,children:[e.presentation.pinned?a("playtest.values.pinned","Pinned"):"",e.presentation.pinned&&e.presentation.group?" · ":"",e.presentation.group??""]}),m.length>1&&t.jsx("button",{ref:u,type:"button",className:s.valueDetailButton,"aria-label":a("playtest.actions.settingsFor","Execution settings for {{label}}").replace("{{label}}",e.action.label),onClick:()=>i(!0),children:a("playtest.actions.settings","Execution settings")})]}),t.jsxs("div",{className:s.actionSummary,children:[t.jsx("span",{children:a("playtest.actions.parameters","Parameters")}),t.jsx("strong",{children:f})]}),t.jsxs("div",{className:s.actionExecution,children:[m.length===1&&t.jsx(Et,{action:e.action,draft:y,errors:d,disabled:k,onChange:M}),t.jsx(Oe,{active:e.active,label:e.action.label,reason:x,children:t.jsx("button",{type:"button",className:s.primaryAction,"aria-label":a("playtest.actions.runLabel","Run {{label}}").replace("{{label}}",e.action.label),disabled:!e.active||k,onClick:w,children:k?a("playtest.actions.running","Running…"):a("playtest.actions.run","Run")})}),t.jsx("span",{className:s.rowFeedback,"data-state":C,"aria-live":"polite",children:R}),!e.active&&t.jsx("span",{className:s.actionInactiveReason,children:x})]})]}),t.jsx(_t,{open:n,title:e.action.label,description:a("playtest.actions.settings","Execution settings"),ariaLabel:a("playtest.actions.settingsDialog","{{label}} execution settings").replace("{{label}}",e.action.label),closeLabel:a("common.close","Close"),returnFocusTo:u.current,onClose:()=>i(!1),items:[{label:a("playtest.actions.parameters","Parameters"),value:t.jsx(Et,{action:e.action,draft:y,errors:d,disabled:k,onChange:M})},{label:a("playtest.actions.fixedArguments","Fixed arguments"),value:V||"—"},{label:a("playtest.actions.lastResult","Last result"),value:((te=e.state)==null?void 0:te.result)===void 0?R.trim()||"—":ct(e.state.result)}],actions:[{label:a("playtest.actions.saveDefaults","Save default inputs"),accessibleLabel:a("playtest.actions.saveDefaultsFor","Save default inputs for {{label}}").replace("{{label}}",e.action.label),variant:"secondary",disabled:k||!_.ok,onClick:B}]})]})}function Uo(e,a,n,i){const d=e.indexOf(a),c=e.indexOf(n);if(d<0||c<0||a===n)return[...e];const u=e.filter(_=>_!==a),y=u.indexOf(n),m=i==="after"?y+1:y;return u.splice(m,0,a),u}const Dt=["watches","controls","actions"];function Ko(e,a){const n="path"in e&&e.path?[e.path.root,...e.path.segments].join("."):"",i="access"in e?e.access.adapter:e.executor.kind==="adapter"?e.executor.adapter:"",d="access"in e?e.access.name:e.executor.kind;return[e.id,e.label,a,n,i,d].filter(Boolean).join(" ").toLocaleLowerCase()}function zo(e,a){if(a.kind==="action")return"unobserved";const n=e.watches[`${a.kind}:${a.binding.id}`];return(n==null?void 0:n.status)??"unobserved"}function Wo(e){var j,F,v,S,A,N,G,l;const{t:a}=ue(),[n,i]=o.useState(""),[d,c]=o.useState("all"),[u,y]=o.useState("all"),[m,_]=o.useState("all"),[C,k]=o.useState(new Set),[x,f]=o.useState(0),[V,R]=o.useState(50),[M,w]=o.useState(!1),[B,P]=o.useState(((F=(j=e.live.profile)==null?void 0:j.sectionOrder)==null?void 0:F.length)===3?e.live.profile.sectionOrder:Dt),[E,W]=o.useState(null),[$,ee]=o.useState(null),[te,q]=o.useState(null),[O,z]=o.useState(!1),[U,L]=o.useState(!1),[ae,J]=o.useState(""),[le,Q]=o.useState(null),[K,Z]=o.useState(()=>{var r;return((r=e.live.profile)==null?void 0:r.presentation)??{}}),[X,he]=o.useState({}),[re,oe]=o.useState({}),[ye,we]=o.useState(()=>{var r;return((r=e.live.profile)==null?void 0:r.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}}),H=e.live.profile,se=a("playtest.values.ungrouped","Ungrouped");o.useEffect(()=>{var r,g,D;P(((g=(r=e.live.profile)==null?void 0:r.sectionOrder)==null?void 0:g.length)===3?e.live.profile.sectionOrder:Dt),Z(((D=e.live.profile)==null?void 0:D.presentation)??{}),z(!1)},[(v=e.live.profile)==null?void 0:v.id,(S=e.live.profile)==null?void 0:S.presentation,(A=e.live.profile)==null?void 0:A.sectionOrder]),o.useEffect(()=>{var r;we(((r=e.live.profile)==null?void 0:r.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"})},[(N=e.live.profile)==null?void 0:N.id,(G=e.live.profile)==null?void 0:G.settings]);const ne=o.useMemo(()=>{if(!H)return{entries:[],total:0,pages:1,safePage:0,groups:[]};const r=[...H.controls.map((I,Y)=>({kind:"control",binding:I,sourceOrder:Y})),...H.watches.map((I,Y)=>({kind:"watch",binding:I,sourceOrder:H.controls.length+Y})),...(H.actions??[]).map((I,Y)=>({kind:"action",binding:I,sourceOrder:H.controls.length+H.watches.length+Y}))],g=Array.from(new Set(r.map(I=>{var Y;return((Y=K[I.binding.id])==null?void 0:Y.group)??se}))).sort((I,Y)=>I.localeCompare(Y)),D=n.trim().toLocaleLowerCase(),h=r.filter(I=>{var de;const Y=((de=K[I.binding.id])==null?void 0:de.group)??se;return(d==="all"||I.kind===d)&&(m==="all"||Y===m)&&(u==="all"||I.kind==="action"||zo(e.live,I)===u)&&(!D||Ko(I.binding,Y).includes(D))}).sort((I,Y)=>{if(I.kind!==Y.kind){const Pe=Ie=>Ie==="watch"?"watches":Ie==="control"?"controls":"actions";return B.indexOf(Pe(I.kind))-B.indexOf(Pe(Y.kind))}const de=K[I.binding.id],je=K[Y.binding.id];return!!(de!=null&&de.pinned)!=!!(je!=null&&je.pinned)?de!=null&&de.pinned?-1:1:((de==null?void 0:de.order)??I.sourceOrder)-((je==null?void 0:je.order)??Y.sourceOrder)}),b=Math.max(1,Math.ceil(h.length/V)),T=Math.min(x,b-1);return{entries:h.slice(T*V,(T+1)*V),total:h.length,pages:b,safePage:T,groups:g}},[m,d,u,x,V,K,H,e.live,n,B,se]),ce=((H==null?void 0:H.controls.length)??0)+((H==null?void 0:H.watches.length)??0)+(((l=H==null?void 0:H.actions)==null?void 0:l.length)??0),ie=n.trim()!==""||d!=="all"||u!=="all"||m!=="all",Ne={watches:a("playtest.values.observedSection","Observed values"),controls:a("playtest.values.changeSection","Change values"),actions:a("playtest.actions.section","Actions")},ve=async r=>{q(null);try{await e.live.saveProfileMetadata(r)}catch(g){throw q(g instanceof Error?g.message:a("playtest.values.layoutSaveFailed","Could not save the display order")),g}},_e=r=>{we(r),ve({settings:r}).catch(()=>we((H==null?void 0:H.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}))},xe=r=>{if(!O||U||!B.includes(r))return;const g=B,D=B.indexOf(r),h=D===0?1:D-1,b=[...B];[b[D],b[h]]=[b[h],b[D]];const T=b;P(T),L(!0),ve({sectionOrder:T}).then(()=>J(a("playtest.values.layoutSaved","Display order saved"))).catch(()=>P(g)).finally(()=>L(!1))},Ce=r=>ne.entries.filter(g=>g.kind===r),be=(r,g,D,h)=>{var Pe,Ie,Me;if(!H||!O||U)return;const b=K,T=g.map(Se=>Se.binding.id),I=Uo(T,r.binding.id,D,h);if(T.every((Se,ke)=>Se===I[ke]))return;const Y={...K},de=g.map(Se=>{var ke;return((ke=K[Se.binding.id])==null?void 0:ke.order)??Se.sourceOrder}).sort((Se,ke)=>Se-ke);for(const[Se,ke]of I.entries())Y[ke]={order:de[Se],pinned:((Pe=K[ke])==null?void 0:Pe.pinned)??!1,...(Ie=K[ke])!=null&&Ie.group?{group:(Me=K[ke])==null?void 0:Me.group}:{}};Z(Y),L(!0);const je=I.indexOf(r.binding.id)+1;ve({presentation:Y}).then(()=>J(a("playtest.values.movedTo","{{label}} moved to position {{position}}").replace("{{label}}",r.binding.label).replace("{{position}}",String(je)))).catch(()=>Z(b)).finally(()=>L(!1))},fe=r=>k(g=>{const D=new Set(g);return D.has(r)?D.delete(r):D.add(r),D}),Re=(r,g)=>{var Ie,Me,Se,ke;const D=((Ie=K[r.binding.id])==null?void 0:Ie.group)??se,h=((Me=K[r.binding.id])==null?void 0:Me.pinned)??!1,b=g.filter(pe=>{var ge,Le;return(((ge=K[pe.binding.id])==null?void 0:ge.group)??se)===D&&(((Le=K[pe.binding.id])==null?void 0:Le.pinned)??!1)===h}),T=b.findIndex(pe=>pe.binding.id===r.binding.id),I=pe=>a(pe==="previous"?"playtest.values.movePrevious":"playtest.values.moveNext",`Move {{label}} ${pe}`).replace("{{label}}",r.binding.label),Y=a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",r.binding.label),de=e.active&&(e.live.studioMode!=="run"||r.binding.target.role==="server"),je=e.live.studioMode==="run"&&r.binding.target.role==="client"?a("playtest.controls.playModeRequired","Client test values are available in Play."):e.inactiveReason,Pe=`${H.id}:${((Se=e.live.lease)==null?void 0:Se.leaseId)??"edit"}:${r.binding.id}`;return t.jsxs("div",{className:s.valueEntryShell,"data-layout-editing":O,"data-drop-position":(le==null?void 0:le.id)===r.binding.id?le.placement:void 0,onDragOver:pe=>{if((E==null?void 0:E.kind)!==r.kind||!b.some(Kt=>Kt.binding.id===E.id))return;pe.preventDefault();const ge=pe.currentTarget.getBoundingClientRect(),lt=r.kind==="watch"?pe.clientX>=ge.left+ge.width/2?"after":"before":pe.clientY>=ge.top+ge.height/2?"after":"before";Q({id:r.binding.id,placement:lt})},onDrop:pe=>{if(pe.preventDefault(),(E==null?void 0:E.kind)===r.kind&&E.id!==r.binding.id&&(le==null?void 0:le.id)===r.binding.id){const ge=b.find(Le=>Le.binding.id===E.id);ge&&be(ge,b,r.binding.id,le.placement)}W(null),Q(null)},children:[O&&t.jsxs("div",{className:s.valueReorderControls,children:[t.jsx("button",{type:"button",className:s.dragHandle,draggable:!0,"aria-label":Y,disabled:U,onDragStart:()=>W({kind:r.kind,id:r.binding.id}),onDragEnd:()=>{W(null),Q(null)},children:t.jsx(Nt,{size:14,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":I("previous"),"aria-describedby":T<=0?"playtest-layout-boundary":void 0,disabled:U||T<=0,onClick:()=>be(r,b,b[T-1].binding.id,"before"),children:t.jsx(wt,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":I("next"),"aria-describedby":T===b.length-1?"playtest-layout-boundary":void 0,disabled:U||T<0||T===b.length-1,onClick:()=>be(r,b,b[T+1].binding.id,"after"),children:t.jsx(ht,{size:13,"aria-hidden":"true"})})]}),r.kind==="control"?t.jsx(Oo,{profile:{...H,controls:[r.binding],watches:[],settings:ye},active:de,inactiveReason:je,states:e.live.controls,watches:e.live.watches,draftScope:`${H.id}:${((ke=e.live.lease)==null?void 0:ke.leaseId)??"edit"}`,drafts:X[Pe]?{[r.binding.id]:X[Pe]}:void 0,onDraftChange:(pe,ge,Le)=>he(lt=>({...lt,[Pe]:{value:ge,dirty:Le}})),profileSaveLocked:!1,onApply:(pe,ge)=>void e.live.apply(pe,ge),onSaveValue:e.live.saveControlValue,onRemoveValue:pe=>e.live.saveProfileMetadata({removeDefaults:[pe]})}):r.kind==="watch"?t.jsx(Fo,{profile:{...H,controls:[],watches:[r.binding]},watches:e.live.watches}):t.jsx(Ho,{action:r.binding,state:e.live.actions[r.binding.id],draft:re[`${H.id}:${r.binding.id}`]??Ht(r.binding),active:e.active&&e.live.studioState==="Running"&&(e.live.studioMode!=="run"||r.binding.target.role==="server"),inactiveReason:e.live.studioState==="Paused"?a("playtest.actions.resumeRequired","Resume Studio before running this action."):e.live.studioMode==="run"&&r.binding.target.role==="client"?a("playtest.actions.playModeRequired","This action is available in Play."):e.inactiveReason,presentation:K[r.binding.id],onDraftChange:(pe,ge)=>oe(Le=>({...Le,[`${H.id}:${r.binding.id}`]:ge})),onExecute:(pe,ge)=>void e.live.executeAction(pe,ge,crypto.randomUUID()),onSaveDefaults:e.live.saveActionDefaults})]},`${r.kind}:${r.binding.id}`)},p=r=>{var T;const D=Ce(r==="watches"?"watch":r==="controls"?"control":"action"),h=new Map;for(const I of D){const Y=((T=K[I.binding.id])==null?void 0:T.group)??se;h.set(Y,[...h.get(Y)??[],I])}const b=Ne[r];return t.jsxs("section",{className:s.valueSection,"aria-label":b,onDragOver:I=>{$&&$!==r&&I.preventDefault()},onDrop:I=>{!$||$===r||(I.preventDefault(),xe($),ee(null))},children:[t.jsxs("header",{className:s.valueSectionHeader,children:[t.jsxs("div",{className:s.valueSectionHeading,children:[O&&t.jsx("button",{type:"button",className:s.sectionDragHandle,draggable:!0,"aria-label":a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",b),disabled:U,onDragStart:()=>ee(r),onDragEnd:()=>ee(null),children:t.jsx(Nt,{size:15,"aria-hidden":"true"})}),t.jsx("h3",{children:b}),t.jsx("span",{className:s.valueSectionCount,children:D.length})]}),t.jsxs("div",{className:s.valueSectionHeaderActions,children:[r==="controls"&&H&&t.jsxs("div",{className:s.runtimeSettings,children:[t.jsx(Oe,{active:e.live.canMutate,label:a("playtest.settings.applyChangesAutomatically","Apply changes automatically"),reason:e.inactiveReason??a("playtest.controls.proRequired","Real-time value editing and Reset all are available with Pro."),children:t.jsxs("label",{className:s.runtimeSettingSwitch,children:[t.jsx("span",{children:a("playtest.settings.applyChangesAutomatically","Apply changes automatically")}),t.jsx("input",{className:s.runtimeSettingSwitchInput,type:"checkbox",role:"switch",checked:ye.runtimeApplyMode==="auto",disabled:!e.live.canMutate,onChange:I=>{_e({...ye,runtimeApplyMode:I.target.checked?"auto":"manual"})}}),t.jsx("span",{className:s.runtimeSettingSwitchTrack,"aria-hidden":"true",children:t.jsx("span",{className:s.runtimeSettingSwitchThumb})})]})}),t.jsx(Oe,{active:e.live.canMutate,label:a("playtest.settings.applyDefaultsOnPlayStart","Apply saved defaults when Play starts"),reason:e.inactiveReason??a("playtest.controls.proRequired","Real-time value editing and Reset all are available with Pro."),children:t.jsxs("label",{className:s.runtimeSettingSwitch,children:[t.jsx("span",{children:a("playtest.settings.applyDefaultsOnPlayStart","Apply saved defaults when Play starts")}),t.jsx("input",{className:s.runtimeSettingSwitchInput,type:"checkbox",role:"switch",checked:ye.applyDefaultsOnManualPlayStart,disabled:!e.live.canMutate,onChange:I=>_e({...ye,applyDefaultsOnManualPlayStart:I.target.checked})}),t.jsx("span",{className:s.runtimeSettingSwitchTrack,"aria-hidden":"true",children:t.jsx("span",{className:s.runtimeSettingSwitchThumb})})]})})]}),O&&t.jsx("button",{type:"button",className:s.sectionMoveButton,disabled:U,"aria-label":a(B[0]===r?"playtest.values.moveDown":"playtest.values.moveUp",B[0]===r?"Move {{label}} down":"Move {{label}} up").replace("{{label}}",b),onClick:()=>xe(r),children:B[0]===r?t.jsx(ht,{size:14,"aria-hidden":"true"}):t.jsx(wt,{size:14,"aria-hidden":"true"})})]})]}),D.length===0?t.jsx("div",{className:s.panelEmpty,children:r==="watches"?a("playtest.watch.empty","Observed values appear here during Play."):r==="controls"?a("playtest.controls.empty","No test controls in this profile yet."):a("playtest.actions.empty","No actions in this profile yet.")}):t.jsx("div",{className:r==="watches"?s.watchValueGrid:r==="controls"?s.controlValueList:s.actionValueList,children:Array.from(h.entries()).map(([I,Y])=>{const de=C.has(`${r}:${I}`),je=t.jsx("div",{className:s.valueGroupRows,children:Y.map(Pe=>Re(Pe,D))});return h.size===1&&I===se?t.jsx("div",{className:s.valueGroup,children:je},`${r}:${I}`):t.jsxs("section",{className:s.valueGroup,children:[t.jsxs("button",{type:"button",className:s.valueGroupToggle,"aria-expanded":!de,"aria-label":`${de?a("playtest.values.expandGroup","Expand"):a("playtest.values.collapseGroup","Collapse")} ${I}`,onClick:()=>fe(`${r}:${I}`),children:[t.jsx("span",{children:I}),t.jsx("span",{children:Y.length})]}),!de&&je]},`${r}:${I}`)})})]},r)};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.valueToolbar,children:[t.jsxs("label",{className:s.valueSearch,children:[t.jsx("span",{className:s.srOnly,children:a("playtest.values.search","Search test values")}),t.jsx("input",{type:"search","aria-label":a("playtest.values.search","Search test values"),value:n,onChange:r=>{i(r.target.value),f(0)},placeholder:a("playtest.values.searchPlaceholder","Name, group, source, or path")})]}),t.jsxs("button",{type:"button",className:s.secondaryAction,"aria-expanded":M,"aria-controls":"playtest-value-filters",onClick:()=>w(r=>!r),children:[a("playtest.values.filters","Filters"),ie?` (${[n.trim()!=="",d!=="all",u!=="all",m!=="all"].filter(Boolean).length})`:""]})]}),M&&t.jsxs("div",{className:s.valueFilters,id:"playtest-value-filters",children:[t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.kind","Value type")}),t.jsxs("select",{"aria-label":a("playtest.values.kind","Value type"),value:d,onChange:r=>{c(r.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.all","All values")}),t.jsx("option",{value:"control",children:a("playtest.values.controls","Controls")}),t.jsx("option",{value:"watch",children:a("playtest.values.watches","Watch Values")}),t.jsx("option",{value:"action",children:a("playtest.actions.section","Actions")})]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.status","Observation status")}),t.jsxs("select",{"aria-label":a("playtest.values.status","Observation status"),value:u,onChange:r=>{y(r.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.statusAll","All statuses")}),t.jsx("option",{value:"fresh",children:a("playtest.watch.fresh","Fresh")}),t.jsx("option",{value:"stale",children:a("playtest.watch.stale","Stale")}),t.jsx("option",{value:"unavailable",children:a("playtest.watch.unavailable","Unavailable")}),t.jsx("option",{value:"unobserved",children:a("playtest.watch.notObserved","Not observed yet")})]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.group","Group")}),t.jsxs("select",{"aria-label":a("playtest.values.group","Group"),value:m,onChange:r=>{_(r.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.allGroups","All groups")}),ne.groups.map(r=>t.jsx("option",{value:r,children:r},r))]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.pageSize","Rows")}),t.jsxs("select",{"aria-label":a("playtest.values.pageSize","Rows"),value:V,onChange:r=>{R(Number(r.target.value)),f(0)},children:[t.jsx("option",{value:"25",children:"25"}),t.jsx("option",{value:"50",children:"50"}),t.jsx("option",{value:"100",children:"100"})]})]})]}),t.jsxs("div",{className:s.valueListStatus,children:[t.jsx("div",{className:s.valueCount,role:"status",children:a("playtest.values.count","{{visible}} of {{total}} values").replace("{{visible}}",String(ne.total)).replace("{{total}}",String(ce))}),t.jsx("button",{type:"button",className:s.secondaryAction,disabled:U||ce===0,onClick:()=>{if(O){z(!1);return}ie&&(i(""),c("all"),y("all"),_("all"),f(0)),z(!0)},children:O?a("playtest.values.doneLayout","Done editing layout"):ie?a("playtest.values.editFullList","Edit full list"):a("playtest.values.editLayout","Edit layout")})]}),O&&t.jsx("div",{className:s.layoutHint,id:"playtest-layout-boundary",children:a("playtest.values.layoutBoundary","Move items within the current group and pinned section.")}),t.jsx("span",{className:s.srOnly,"aria-live":"polite",children:ae}),te&&t.jsx("div",{className:s.layoutError,role:"alert",children:te}),ne.total===0&&ce>0?t.jsx("div",{className:s.panelEmpty,children:a("playtest.values.noResults","No values match these filters.")}):t.jsx("div",{className:s.valueSections,children:B.map(p)}),ne.pages>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:ne.safePage===0,onClick:()=>f(r=>r-1),children:a("playtest.values.previous","Previous")}),t.jsxs("span",{children:[ne.safePage+1," / ",ne.pages]}),t.jsx("button",{type:"button",disabled:ne.safePage+1>=ne.pages,onClick:()=>f(r=>r+1),children:a("playtest.values.next","Next")})]})]})}const Jo="_emptyState_10pjf_1",Yo="_header_10pjf_11",Qo="_method_10pjf_12",Xo="_methods_10pjf_39",Zo="_singleMethod_10pjf_45",ec="_methodTitle_10pjf_57",tc="_moreExamples_10pjf_70",ac="_hint_10pjf_88",sc="_tierNote_10pjf_89",nc="_disabledReason_10pjf_90",ic="_primaryAction_10pjf_102",Ee={emptyState:Jo,header:Yo,method:Qo,methods:Xo,singleMethod:Zo,methodTitle:ec,moreExamples:tc,hint:ac,tierNote:sc,disabledReason:nc,primaryAction:ic};function Ut(e){const{t:a}=ue(),n=e.kind==="no-results",i=e.kind==="no-profile",d=n?a("playtest.emptyResults.title","Ask AI to check your game"):i?a("playtest.emptyValues.noProfileTitle","Prepare values and actions to test"):a("playtest.emptyValues.noValuesTitle","Add test values and actions to this profile"),c=n?a("playtest.emptyResults.description","When AI finishes the test, you can review pass, failure, and the reason here."):i?a("playtest.emptyValues.noProfileDescription","Ask AI to prepare values to observe or change and actions to run during Play, or select an object in Studio and add one directly."):a("playtest.emptyValues.noValuesDescription","Use the selected profile, {{name}}, to collect values to observe or change and actions to run during Play.").replace("{{name}}",e.profileName??"");return t.jsxs("section",{className:Ee.emptyState,children:[t.jsxs("header",{className:Ee.header,children:[t.jsx("h3",{children:d}),t.jsx("p",{children:c})]}),t.jsxs("div",{className:`${Ee.methods} ${n?Ee.singleMethod:""}`,children:[t.jsxs("section",{className:Ee.method,children:[t.jsxs("div",{className:Ee.methodTitle,children:[t.jsx(da,{size:16,"aria-hidden":"true"}),t.jsx("h4",{children:a("playtest.emptyValues.aiTitle","Ask AI")})]}),!n&&t.jsx("p",{children:a("playtest.emptyValues.aiDescription","Copy a request and paste it into an AI chat connected to WEPPY.")}),t.jsx(jt,{exampleIds:n?["automated-check"]:["character"]}),!n&&t.jsxs("details",{className:Ee.moreExamples,children:[t.jsx("summary",{children:a("playtest.ai.otherExamples","Other request examples")}),t.jsx(jt,{exampleIds:["selection","game-state","action"]})]}),n&&e.isBasic&&t.jsx("p",{className:Ee.tierNote,children:a("playtest.emptyResults.proDescription","Automated test runs and actual saved results are available with Pro.")})]}),!n&&t.jsxs("section",{className:Ee.method,children:[t.jsxs("div",{className:Ee.methodTitle,children:[t.jsx(Ra,{size:16,"aria-hidden":"true"}),t.jsx("h4",{children:a("playtest.emptyValues.directTitle","Select and add it yourself")})]}),t.jsx("p",{children:a("playtest.emptyValues.directDescription","Select an object in Studio, then choose a supported value to observe or change, or an available action.")}),i&&t.jsx("p",{className:Ee.hint,children:a("playtest.emptyValues.firstProfileHint","When you add the first item, enter a profile name to keep related test settings together.")}),t.jsx("button",{type:"button",className:Ee.primaryAction,disabled:!!e.directAddDisabledReason,"aria-describedby":e.directAddDisabledReason?"playtest-empty-direct-reason":void 0,onClick:e.onAddFromSelection,children:a("playtest.emptyValues.directAction","Add selected Studio value")}),e.directAddDisabledReason&&t.jsx("p",{className:Ee.disabledReason,id:"playtest-empty-direct-reason",children:e.directAddDisabledReason})]})]})]})}function lc(e){var m,_,C,k,x,f,V;const{live:a}=e,{t:n}=ue(),i=((m=a.lease)==null?void 0:m.state)==="active"&&(a.studioState==="Running"||a.studioState==="Paused"),d=i&&a.canMutate,c=d&&(a.studioMode!=="run"||!!((_=a.profile)!=null&&_.controls.some(R=>R.target.role==="server"))),u=e.inactiveReason??n("playtest.values.playRequired","Start Play in Studio to change test values."),y=(((C=a.profile)==null?void 0:C.controls.length)??0)+(((k=a.profile)==null?void 0:k.watches.length)??0)+(((f=(x=a.profile)==null?void 0:x.actions)==null?void 0:f.length)??0);return t.jsxs("div",{className:s.liveWorkspace,role:"tabpanel","aria-label":n("playtest.view.liveSession","Test Values"),children:[t.jsxs("section",{className:s.profileToolbar,children:[t.jsxs("div",{children:[t.jsxs("div",{className:s.profileLabelRow,children:[t.jsx("label",{htmlFor:"playtest-profile",children:n("playtest.profile.label","Test profiles")}),t.jsx("span",{children:n("playtest.profile.savedCount","{{count}} profiles saved").replace("{{count}}",String(a.profiles.length))})]}),t.jsxs("select",{id:"playtest-profile",value:a.selectedProfileId??"",disabled:!!a.switchingProfileId,"aria-busy":!!a.switchingProfileId,onChange:R=>void a.selectProfile(R.target.value),children:[a.profiles.length===0&&t.jsx("option",{value:"",children:n("playtest.profile.empty","No profiles yet")}),a.profiles.map(R=>t.jsx("option",{value:R.id,children:R.name},R.id))]})]}),t.jsxs("div",{className:s.profileActions,children:[t.jsxs("button",{type:"button",className:s.primaryAction,onClick:e.onManageValues,children:[t.jsx(Sa,{size:14,"aria-hidden":"true"})," ",n("playtest.values.addValue","Add value")]}),t.jsxs("button",{type:"button",className:s.secondaryAction,disabled:!a.profile||!!a.switchingProfileId,onClick:e.onEditProfile,children:[t.jsx(ka,{size:14,"aria-hidden":"true"})," ",n("playtest.profile.edit","Edit profile")]}),t.jsxs("button",{type:"button",className:s.secondaryAction,disabled:!!a.switchingProfileId,onClick:e.onNewProfile,children:[t.jsx(Ot,{size:14,"aria-hidden":"true"})," ",n("playtest.profile.new","New profile")]})]})]}),a.switchingProfileId&&t.jsx("div",{className:s.controlAvailability,role:"status","aria-live":"polite",children:n("playtest.profile.switching","Switching test profile…")}),a.loading?t.jsx("div",{className:s.panelEmpty,children:n("common.loading","Loading...")}):y===0?t.jsx(Ut,{kind:a.profile?"no-values":"no-profile",profileName:(V=a.profile)==null?void 0:V.name,onAddFromSelection:e.onManageValues,directAddDisabledReason:e.directAddDisabledReason}):t.jsx("div",{className:s.liveGrid,children:t.jsxs("section",{className:`${s.livePanel} ${s.valueWorkspacePanel}`,"data-runtime-state":i?"active":"inactive",children:[t.jsxs("header",{className:s.valueWorkspaceHeader,children:[t.jsxs("div",{children:[t.jsx("strong",{children:n("playtest.values.title","Test values")}),!d&&t.jsxs("span",{className:s.controlAvailability,"data-warning":a.studioState==="Edit",id:"playtest-controls-availability",role:"status",children:[a.studioState==="Edit"&&t.jsx(Da,{size:14,"aria-hidden":"true"}),u]})]}),t.jsx(Oe,{active:c,label:n("playtest.session.reset","Reset all"),reason:u,children:t.jsxs("button",{type:"button",className:s.resetAction,disabled:!c,"aria-describedby":c?void 0:"playtest-controls-availability",onClick:()=>void a.resetAll(),children:[a.canMutate?t.jsx(ua,{size:14,"aria-hidden":"true"}):t.jsx(Na,{size:14,"aria-hidden":"true"}),n("playtest.session.reset","Reset all")]})})]}),t.jsx(Wo,{live:a,active:d,inactiveReason:u})]})})]})}const dt={label:"",role:"server",path:"Workspace",accessKind:"attribute",fieldName:"",editorType:"number",defaultValue:"0",minimum:"0",maximum:"100",step:"1"};function rc(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"binding"}function It(e){const a=e.split(".").map(n=>n.trim()).filter(Boolean);return a.length>0?{root:a[0],segments:a.slice(1)}:null}function $e(e){return e==="range"?"number":e}function oc(e){var n;if(Ge($e(e.editorType)))return xt($e(e.editorType),e.defaultValue)??null;if(e.editorType==="enum")return((n=e.enumValues)==null?void 0:n.find(i=>String(i)===e.defaultValue))??null;if(e.editorType==="boolean")return e.defaultValue==="true";if(e.editorType==="string")return e.defaultValue;const a=Number(e.defaultValue);return Number.isFinite(a)?a:null}function Tt(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName.trim()}}function cc(e){var d,c;if("executor"in e)return`${e.target.role} · ${e.executor.kind} · ${e.parameters.length} parameters`;const a=e.path?[e.path.root,...e.path.segments].join("."):"adapter",n=e.access.kind==="value"?"Value":e.access.name??e.access.kind,i="constraints"in e&&((d=e.constraints)==null?void 0:d.minimum)!==void 0&&((c=e.constraints)==null?void 0:c.maximum)!==void 0;return`${e.target.role} · ${a} · ${n} · ${i?"range":e.valueType}`}function dc(e){var _e,xe,Ce,be,fe,Re;const{t:a}=ue(),n=!!e.profile,[i,d]=o.useState(""),[c,u]=o.useState([]),[y,m]=o.useState([]),[_,C]=o.useState([]),[k,x]=o.useState({}),[f,V]=o.useState("controls"),[R,M]=o.useState(!1),[w,B]=o.useState(dt),[P,E]=o.useState(!1),[W,$]=o.useState(!1),[ee,te]=o.useState(!1),[q,O]=o.useState(!1),[z,U]=o.useState(null),[L,ae]=o.useState(null),J=o.useRef(null);o.useEffect(()=>{var p,j,F,v,S;e.open&&(d(((p=e.profile)==null?void 0:p.name)??""),u(((j=e.profile)==null?void 0:j.controls)??[]),m(((F=e.profile)==null?void 0:F.watches)??[]),C(((v=e.profile)==null?void 0:v.actions)??[]),x(((S=e.profile)==null?void 0:S.presentation)??{}),V("controls"),M(!1),B(dt),$(!1),te(!1),O(!1),ae(null),U(null))},[e.open,e.profile]);const le=f==="controls"?c:f==="watches"?y:_,Q=i!==(((_e=e.profile)==null?void 0:_e.name)??"")||JSON.stringify(c)!==JSON.stringify(((xe=e.profile)==null?void 0:xe.controls)??[])||JSON.stringify(y)!==JSON.stringify(((Ce=e.profile)==null?void 0:Ce.watches)??[])||JSON.stringify(_)!==JSON.stringify(((be=e.profile)==null?void 0:be.actions)??[])||JSON.stringify(k)!==JSON.stringify(((fe=e.profile)==null?void 0:fe.presentation)??{})||R,K=o.useMemo(()=>new Set([...c,...y,..._].map(p=>p.id)),[_,c,y]),Z=(p,j)=>{B(F=>({...F,[p]:j})),U(null)},X=()=>{const p=rc(w.label);let j=p,F=2;for(;K.has(j);)j=`${p}-${F}`,F+=1;return j},he=(p,j)=>k[p]??{order:j,pinned:!1},re=(p,j,F)=>x(v=>({...v,[p]:{...he(p,j),...F}})),oe=le.map((p,j)=>({binding:p,sourceOrder:j,entry:he(p.id,j)})).sort((p,j)=>p.entry.order-j.entry.order),ye=(p,j)=>{const F=oe.findIndex(A=>A.binding.id===p),v=oe[F+j],S=oe[F];!S||!v||x(A=>({...A,[S.binding.id]:{...S.entry,order:v.entry.order},[v.binding.id]:{...v.entry,order:S.entry.order}}))},we=()=>{const p=It(w.path),j=oc(w);if(!w.label.trim()||!p||w.accessKind!=="value"&&!w.fieldName.trim()||j===null)return null;const F=w.editorType==="range",v=Number(w.minimum),S=Number(w.maximum),A=Number(w.step);return F&&(typeof j!="number"||!Number.isFinite(v)||!Number.isFinite(S)||!Number.isFinite(A)||v>=S||A<=0||j<v||j>S)?null:{id:X(),label:w.label.trim(),target:{role:w.role},path:p,access:Tt(w),valueType:$e(w.editorType),value:j,...w.editorType==="enum"?{enumValues:w.enumValues}:{},applyTiming:"after_agents_ready",restorePolicy:"session_end",...F?{constraints:{minimum:v,maximum:S,step:A}}:{}}},H=()=>{const p=It(w.path);return!w.label.trim()||!p||w.accessKind!=="value"&&!w.fieldName.trim()?null:{id:X(),label:w.label.trim(),target:{role:w.role},path:p,access:Tt(w),valueType:$e(w.editorType)}},se=()=>{const p=f==="controls"?we():H();if(!p){U(a("playtest.profile.binding.invalid","Complete the label, path, field, and type values."));return}f==="controls"?u(j=>[...j,p]):m(j=>[...j,p]),x(j=>({...j,[p.id]:{order:c.length+y.length,pinned:!1}})),M(!1),B(dt)},ne=async()=>{if(e.onResolveSelectionCandidates){try{const j=await e.onResolveSelectionCandidates();if(!j.selected.path||j.candidates.length===0){U(a("playtest.profile.binding.selectionEmpty","The selected instance has no supported fields."));return}ae(j),ce(j,0)}catch(j){U(j instanceof Error?j.message:String(j))}return}if(!e.onResolveSelection)return;const p=f==="controls"?we():H();if(!p){U(a("playtest.profile.binding.selectionNeedsFields","Enter the label, field, and type before using the Studio selection."));return}try{const j=await e.onResolveSelection({kind:f==="controls"?"control":"watch",id:p.id,label:p.label,role:p.target.role,access:p.access,valueType:p.valueType,..."value"in p?{value:p.value}:{},..."constraints"in p&&p.constraints?{constraints:p.constraints}:{},..."enumValues"in p&&p.enumValues?{enumValues:p.enumValues}:{}});j.path&&Z("path",[j.path.root,...j.path.segments].join("."))}catch(j){U(j instanceof Error?j.message:String(j))}},ce=(p,j)=>{const F=p.candidates[j];if(!F||!p.selected.path)return;const v=F.fieldName??"Value";B(S=>({...S,label:`${p.selected.name??"Selected"} ${v}`,path:[p.selected.path.root,...p.selected.path.segments].join("."),accessKind:F.accessKind,fieldName:F.fieldName??"",editorType:F.valueType,defaultValue:typeof F.value=="object"?JSON.stringify(F.value):String(F.value),enumValues:F.enumValues})),U(null)},ie=async()=>{if(!(!e.profile||!e.onSave||!i.trim())){E(!0),U(null);try{await e.onSave({...e.profile,schemaVersion:4,name:i.trim(),controls:c,watches:y,actions:_,presentation:k}),e.onClose()}catch(p){U(p instanceof Error?p.message:String(p))}finally{E(!1)}}},Ne=()=>{if(!(P||q)){if(Q){$(!0);return}e.onClose()}},ve=async()=>{var p;if(!(!e.profile||!e.onDelete||q||e.deleteDisabledReason)){O(!0),U(null);try{await e.onDelete(e.profile.id,e.profile.revision),te(!1),e.onClose()}catch(j){const F=j&&typeof j=="object"?String("payload"in j&&((p=j.payload)==null?void 0:p.errorCode)||"error"in j&&j.error||"code"in j&&j.code||""):"";U(a(F==="profile_active"?"playtest.profile.deleteActive":F==="profile_revision_conflict"?"playtest.profile.deleteConflict":F==="profile_not_found"?"playtest.profile.deleteNotFound":F==="profile_scope_unavailable"?"playtest.profile.deleteScopeUnavailable":"playtest.profile.deleteFailed",j instanceof Error?j.message:"Could not delete the profile."))}finally{O(!1)}}};return t.jsxs(Ke,{open:e.open,onClose:Ne,dismissDisabled:P||q,initialFocusRef:J,ariaLabel:n?a("playtest.profile.editTitle","Edit test profile"):a("playtest.profile.createTitle","Create test profile"),children:[t.jsxs("div",{className:`${s.profileDialog} ${n?s.profileEditorDialog:""}`,children:[t.jsx(ze,{title:n?a("playtest.profile.editTitle","Edit test profile"):a("playtest.profile.createTitle","Create test profile"),description:n?a("playtest.profile.editDescription","Add controls you can change during Play and Watch Values you only want to observe."):a("playtest.profile.createDescription","Profiles are stored locally for the selected Place. Add controls after creating it."),closeLabel:a("common.close","Close"),closeDisabled:P||q,onRequestClose:Ne}),t.jsxs("div",{className:s.profileDialogBody,children:[t.jsxs("label",{children:[a("playtest.profile.name","Profile name"),t.jsx("input",{ref:J,value:i,onChange:p=>d(p.target.value)})]}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.bindingTabs,role:"tablist","aria-label":a("playtest.profile.bindingTabs","Profile values"),children:[t.jsxs("button",{type:"button",role:"tab","aria-selected":f==="controls",onClick:()=>{V("controls"),M(!1)},children:[a("playtest.profile.controlsTab","Controls")," ",t.jsx("span",{children:c.length})]}),t.jsxs("button",{type:"button",role:"tab","aria-selected":f==="watches",onClick:()=>{V("watches"),M(!1)},children:[a("playtest.profile.watchesTab","Watch Values")," ",t.jsx("span",{children:y.length})]}),t.jsxs("button",{type:"button",role:"tab","aria-selected":f==="actions",onClick:()=>{V("actions"),M(!1)},children:[a("playtest.actions.section","Actions")," ",t.jsx("span",{children:_.length})]})]}),t.jsx("div",{className:s.bindingList,children:le.length===0?t.jsx("div",{className:s.bindingEmpty,children:f==="controls"?a("playtest.profile.controlsEmpty","No controls added yet."):f==="watches"?a("playtest.profile.watchesEmpty","No Watch Values added yet."):a("playtest.actions.empty","No actions in this profile yet.")}):oe.map(({binding:p,entry:j,sourceOrder:F},v)=>t.jsxs("div",{className:s.bindingItem,children:[t.jsxs("div",{className:s.bindingItemCopy,children:[t.jsx("strong",{children:p.label}),t.jsx("span",{children:cc(p)}),t.jsxs("div",{className:s.bindingPresentation,children:[t.jsxs("label",{children:[a("playtest.profile.group","Group"),t.jsx("input",{"aria-label":a("playtest.profile.groupFor","Group for {{label}}").replace("{{label}}",p.label),value:j.group??"",onChange:S=>re(p.id,F,{group:S.target.value||void 0})})]}),t.jsxs("label",{className:s.bindingPin,children:[t.jsx("input",{type:"checkbox","aria-label":a("playtest.profile.pinLabel","Pin {{label}}").replace("{{label}}",p.label),checked:j.pinned,onChange:S=>re(p.id,F,{pinned:S.target.checked})}),a("playtest.profile.pin","Pin")]})]})]}),t.jsxs("div",{className:s.bindingItemActions,children:[t.jsx("button",{type:"button","aria-label":a("playtest.profile.moveUp","Move {{label}} up").replace("{{label}}",p.label),disabled:v===0,onClick:()=>ye(p.id,-1),children:t.jsx(ya,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":a("playtest.profile.moveDown","Move {{label}} down").replace("{{label}}",p.label),disabled:v===oe.length-1,onClick:()=>ye(p.id,1),children:t.jsx(ma,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button",className:s.bindingDelete,"aria-label":a("playtest.profile.removeBinding","Remove {{label}}").replace("{{label}}",p.label),onClick:()=>{f==="controls"?u(S=>S.filter(A=>A.id!==p.id)):f==="watches"?m(S=>S.filter(A=>A.id!==p.id)):C(S=>S.filter(A=>A.id!==p.id)),x(S=>Object.fromEntries(Object.entries(S).filter(([A])=>A!==p.id)))},children:t.jsx(St,{size:14,"aria-hidden":"true"})})]})]},p.id))}),f!=="actions"&&(R?t.jsxs("fieldset",{className:s.bindingForm,"aria-label":f==="controls"?a("playtest.profile.newControl","New control"):a("playtest.profile.newWatch","New watch"),children:[(e.onResolveSelectionCandidates||e.onResolveSelection)&&t.jsx("button",{type:"button",className:s.selectionButton,onClick:()=>void ne(),children:a("playtest.profile.binding.useSelection","Use current Studio selection")}),L&&L.candidates.length>1&&t.jsxs("label",{children:[a("playtest.profile.binding.selectedField","Selected field"),t.jsx("select",{onChange:p=>ce(L,Number(p.target.value)),children:L.candidates.map((p,j)=>t.jsx("option",{value:j,children:p.accessKind==="value"?"ValueBase.Value":`${p.accessKind} · ${p.fieldName}`},`${p.accessKind}:${p.fieldName??"Value"}`))})]}),t.jsxs("div",{className:s.bindingFormGrid,children:[t.jsxs("label",{children:[a("playtest.profile.binding.label","Label"),t.jsx("input",{value:w.label,onChange:p=>Z("label",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.role","Target"),t.jsxs("select",{value:w.role,onChange:p=>Z("role",p.target.value),children:[t.jsx("option",{value:"server",children:a("playtest.profile.binding.server","Server")}),t.jsx("option",{value:"client",children:a("playtest.profile.binding.client","Client")})]})]}),t.jsxs("label",{className:s.bindingPathField,children:[a("playtest.profile.binding.path","Runtime path"),t.jsx("input",{value:w.path,placeholder:a("playtest.profile.binding.pathPlaceholder","Workspace.Config"),onChange:p=>Z("path",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.access","Access"),t.jsxs("select",{value:w.accessKind,onChange:p=>Z("accessKind",p.target.value),children:[t.jsx("option",{value:"attribute",children:a("playtest.profile.binding.attribute","Attribute")}),t.jsx("option",{value:"value",children:a("playtest.profile.binding.valueBase","ValueBase.Value")}),t.jsx("option",{value:"property",children:a("playtest.profile.binding.property","Property")})]})]}),w.accessKind!=="value"&&t.jsxs("label",{children:[a("playtest.profile.binding.field","Field name"),t.jsx("input",{value:w.fieldName,onChange:p=>Z("fieldName",p.target.value)})]}),t.jsxs("label",{children:[f==="controls"?a("playtest.profile.binding.inputType","Input type"):a("playtest.profile.binding.valueType","Value type"),t.jsxs("select",{value:w.editorType,onChange:p=>Z("editorType",p.target.value),children:[t.jsx("option",{value:"number",children:a("playtest.profile.binding.number","Number")}),f==="controls"&&t.jsx("option",{value:"range",children:a("playtest.profile.binding.range","Range")}),t.jsx("option",{value:"string",children:a("playtest.profile.binding.string","String")}),t.jsx("option",{value:"boolean",children:a("playtest.profile.binding.boolean","Boolean")}),t.jsx("option",{value:"vector3",children:a("playtest.profile.binding.vector3","Vector3")}),t.jsx("option",{value:"color3",children:a("playtest.profile.binding.color3","Color3")}),t.jsx("option",{value:"cframe",children:a("playtest.profile.binding.cframe","CFrame")}),w.enumValues&&t.jsx("option",{value:"enum",children:a("playtest.profile.binding.enum","Enum")})]})]}),f==="controls"&&Ge($e(w.editorType))&&t.jsx(yt,{type:$e(w.editorType),draft:w.defaultValue,label:a("playtest.profile.binding.defaultValue","Default value"),onChange:p=>Z("defaultValue",p)}),f==="controls"&&w.editorType==="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("select",{value:w.defaultValue,onChange:p=>Z("defaultValue",p.target.value),children:(Re=w.enumValues)==null?void 0:Re.map(p=>t.jsx("option",{value:String(p),children:String(p)},String(p)))})]}),f==="controls"&&!Ge($e(w.editorType))&&w.editorType!=="boolean"&&w.editorType!=="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("input",{type:w.editorType==="string"?"text":"number",value:w.defaultValue,onChange:p=>Z("defaultValue",p.target.value)})]}),f==="controls"&&w.editorType==="boolean"&&t.jsxs("label",{className:s.bindingBooleanDefault,children:[t.jsx("input",{type:"checkbox","aria-label":a("playtest.profile.binding.defaultValue","Default value"),checked:w.defaultValue==="true",onChange:p=>Z("defaultValue",String(p.target.checked))}),t.jsx("span",{children:a("playtest.profile.binding.defaultValue","Default value")})]}),f==="controls"&&w.editorType==="range"&&t.jsxs("div",{className:s.rangeFields,children:[t.jsxs("label",{children:[a("playtest.profile.binding.minimum","Minimum"),t.jsx("input",{type:"number",value:w.minimum,onChange:p=>Z("minimum",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.maximum","Maximum"),t.jsx("input",{type:"number",value:w.maximum,onChange:p=>Z("maximum",p.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.step","Step"),t.jsx("input",{type:"number",value:w.step,onChange:p=>Z("step",p.target.value)})]})]})]}),z&&t.jsx("div",{className:s.bindingError,role:"alert",children:z}),t.jsxs("div",{className:s.bindingFormActions,children:[t.jsx("button",{type:"button",className:s.secondaryAction,onClick:()=>{M(!1),U(null)},children:a("common.cancel","Cancel")}),t.jsx("button",{type:"button",className:s.primaryAction,onClick:se,children:a("playtest.profile.binding.add","Add to profile")})]})]}):t.jsxs("button",{type:"button",className:s.addBindingButton,onClick:()=>M(!0),children:[t.jsx(Ot,{size:14,"aria-hidden":"true"})," ",f==="controls"?a("playtest.profile.addControl","Add control"):a("playtest.profile.addWatch","Add watch")]}))]}),z&&!R&&t.jsx("div",{className:s.bindingError,role:"alert",children:z})]}),t.jsxs("div",{className:s.profileDialogActions,children:[n&&e.onDelete&&t.jsxs("button",{type:"button",className:`${s.stopAction} ${s.profileDeleteAction}`,disabled:P||q||!!e.deleteDisabledReason,title:e.deleteDisabledReason,onClick:()=>te(!0),children:[t.jsx(St,{size:14,"aria-hidden":"true"})," ",a("playtest.profile.delete","Delete profile")]}),n&&e.deleteDisabledReason&&t.jsx("span",{className:s.profileDeleteReason,role:"status",children:e.deleteDisabledReason}),t.jsx("button",{type:"button",className:s.secondaryAction,disabled:P||q,onClick:Ne,children:a("common.cancel","Cancel")}),n?t.jsx("button",{type:"button",className:s.primaryAction,disabled:!i.trim()||P,onClick:()=>void ie(),children:P?a("playtest.profile.saving","Saving…"):a("playtest.profile.save","Save profile")}):t.jsx("button",{type:"button",className:s.primaryAction,disabled:!i.trim()||P,onClick:async()=>{E(!0);try{await e.onCreate(i),d(""),e.onClose()}finally{E(!1)}},children:P?a("playtest.profile.creating","Creating…"):a("playtest.profile.createTitle","Create test profile")})]})]}),t.jsx(mt,{open:W,title:a("playtest.profile.discardTitle","Discard profile changes?"),message:a("playtest.profile.discardMessage","Your unsaved profile changes will be lost."),cancelLabel:a("playtest.profile.keepEditing","Keep editing"),confirmLabel:a("playtest.profile.discard","Discard changes"),onCancel:()=>$(!1),onConfirm:()=>{$(!1),e.onClose()}}),t.jsx(mt,{open:ee,title:a("playtest.profile.deleteConfirmTitle","Delete test profile?"),message:e.profile?[a("playtest.profile.deleteConfirmMessage","Delete “{{name}}”? Its {{controls}} control values and {{watches}} observed values will be removed. Game objects, scripts, test connection code, other profiles, and automated test results will remain.").replace("{{name}}",e.profile.name).replace("{{controls}}",String(e.profile.controls.length)).replace("{{watches}}",String(e.profile.watches.length)),Q?a("playtest.profile.deleteDirty","Unsaved edits will also be discarded."):""].filter(Boolean).join(" "):"",cancelLabel:a("common.cancel","Cancel"),confirmLabel:a("playtest.profile.delete","Delete profile"),loading:q,onCancel:()=>{q||te(!1)},onConfirm:()=>void ve()})]})}function Fe(e){return`${e.accessKind}:${e.fieldName??"Value"}`}function et(e){return e.fieldName??"Value"}function uc(e){const{t:a}=ue(),n=o.useId(),[i,d]=o.useState(!1),[c,u]=o.useState(""),y=o.useRef(null),m=o.useRef(null),_=o.useRef(null),C=c.trim().toLocaleLowerCase(),k=o.useMemo(()=>e.candidates.filter(P=>`${et(P)} ${P.accessKind}`.toLocaleLowerCase().includes(C)),[C,e.candidates]),x=["attribute","value","property"].map(P=>({kind:P,candidates:k.filter(E=>E.accessKind===P)})).filter(P=>P.candidates.length>0),f=et(e.selected);o.useEffect(()=>{var P;i&&((P=m.current)==null||P.focus())},[i]);const V=(P=!0)=>{var E;d(!1),u(""),P&&((E=y.current)==null||E.focus())},R=()=>{var P;return Array.from(((P=_.current)==null?void 0:P.querySelectorAll('[role="option"]'))??[])},M=P=>{var W;const E=R();(W=E[Math.max(0,Math.min(P,E.length-1))])==null||W.focus()},w=P=>{e.onSelect(P),V()},B=P=>P==="attribute"?a("playtest.profile.binding.attribute","Attribute"):P==="value"?a("playtest.profile.binding.valueBase","ValueBase.Value"):a("playtest.profile.binding.property","Property");return t.jsxs("div",{className:s.propertyPicker,children:[t.jsx("span",{className:s.propertyPickerLabel,children:a("playtest.values.selectProperty","Property")}),t.jsxs("button",{ref:y,type:"button",className:s.propertyPickerTrigger,disabled:e.disabled,"aria-haspopup":"listbox","aria-expanded":i,"aria-controls":i?n:void 0,"aria-label":`${a("playtest.values.propertyPickerAction","Select property")}: ${f}`,onClick:()=>{i?V(!1):d(!0)},children:[t.jsx("span",{children:f}),t.jsx(ht,{size:16,"aria-hidden":"true"})]}),i&&t.jsxs("div",{ref:_,className:s.propertyPickerPanel,onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),V())},children:[t.jsxs("div",{className:s.propertyPickerSearchRow,children:[t.jsxs("label",{children:[a("playtest.values.searchProperties","Search properties"),t.jsx("input",{ref:m,type:"search",value:c,onChange:P=>u(P.target.value),onKeyDown:P=>{P.key==="ArrowDown"&&(P.preventDefault(),M(0))}})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.propertyPickerClose","Close property picker"),onClick:()=>V(),children:t.jsx(Vt,{size:16,"aria-hidden":"true"})})]}),t.jsxs("div",{id:n,className:s.propertyPickerList,role:"listbox","aria-label":a("playtest.values.availableProperties","Available properties"),children:[x.map(P=>t.jsxs("div",{className:s.propertyPickerGroup,role:"group","aria-label":B(P.kind),children:[t.jsx("span",{children:B(P.kind)}),P.candidates.map(E=>{const W=Fe(E)===Fe(e.selected);return t.jsxs("div",{role:"option",tabIndex:0,"aria-selected":W,"aria-label":et(E),className:s.propertyPickerOption,onClick:()=>w(E),onKeyDown:$=>{var q;const te=R().indexOf($.currentTarget);$.key==="ArrowDown"&&($.preventDefault(),M(te+1)),$.key==="ArrowUp"&&($.preventDefault(),te===0?(q=m.current)==null||q.focus():M(te-1)),($.key==="Enter"||$.key===" ")&&($.preventDefault(),w(E))},children:[t.jsx("span",{children:et(E)}),t.jsx("small",{children:E.valueType}),W&&t.jsx(pa,{size:15,"aria-hidden":"true"})]},Fe(E))})]},P.kind)),k.length===0&&t.jsx("p",{role:"status",children:a("playtest.values.noProperties","No matching properties")})]})]})]})}const Lt=`local RunService = game:GetService("RunService")
77
72
  local Workspace = game:GetService("Workspace")
78
73
 
79
74
  local function requireStudioSession(context)
@@ -109,19 +104,19 @@ return {
109
104
  read = { method = "enemyCount", arguments = {}, pollIntervalMs = 1000 },
110
105
  }},
111
106
  },
112
- }`;function fc(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"value"}function tt(e,a){const n=new Set([...e.controls,...e.watches,...e.actions??[]].map(c=>c.id));let i=a,d=2;for(;n.has(i);)i=`${a}-${d}`,d+=1;return i}function ut(e){return`adapter-${e.adapter}-${e.id}`.toLowerCase().replace(/[^a-z0-9-]+/g,"-")}function mc(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName}}function vt(e){return e.fieldName??"Value"}function Mt(e,a){return`${e.selected.name??"Selected"} ${vt(a)}`}function pt(e,a,n,i){const d=a.selected.path;return!e||!d?!1:(i==="watch"?e.watches:e.controls).some(c=>{var u;return c.target.role==="server"&&((u=c.path)==null?void 0:u.root)===d.root&&JSON.stringify(c.path.segments)===JSON.stringify(d.segments)&&c.access.kind===n.accessKind&&(n.accessKind==="value"||c.access.name===n.fieldName)})}function ft(e,a,n){var i,d;return JSON.stringify([(i=e.selected.path)==null?void 0:i.root,(d=e.selected.path)==null?void 0:d.segments,a.accessKind,a.fieldName??"value",n])}function $t(e,a){var i;if(e instanceof Jt&&((i=e.error)!=null&&i.trim()))return e.error;const n=e instanceof Error?e.message:String(e);return n.startsWith("API ")?`${a} ${n}`:n}function hc(e){var S,A,N,G;const{t:a,locale:n="en"}=ue(),[i,d]=o.useState("selection"),[c,u]=o.useState(""),[y,m]=o.useState(0),[_,C]=o.useState("My test profile"),[k,x]=o.useState(!e.profile),[f,V]=o.useState(null),[R,M]=o.useState(""),[w,B]=o.useState(!1),[P,E]=o.useState(null),W=o.useRef(!1),$=o.useRef({open:!1,profileId:null}),[ee,te]=o.useState(null),[q,O]=o.useState(null),[z,U]=o.useState(null),[L,ae]=o.useState(!1),[J,le]=o.useState(null),Q=e.profile,K=((S=e.catalog.adapters)==null?void 0:S.find(l=>l.name===J))??null,X=[K?a("playtest.values.adapterAiContext","Use the existing Test Adapter {{adapter}} at {{path}}. Detected methods: {{methods}}. Review their schemas before adding dashboard entries; do not run a method or guess value types and fixed arguments.").replace("{{adapter}}",K.name).replace("{{path}}",K.sourcePath??K.name).replace("{{methods}}",K.methods.map(l=>`${l.name} (${l.sideEffectClass})`).join(", ")):"",a("playtest.values.aiRequest")].filter(Boolean).join(`
107
+ }`;function pc(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"value"}function tt(e,a){const n=new Set([...e.controls,...e.watches,...e.actions??[]].map(c=>c.id));let i=a,d=2;for(;n.has(i);)i=`${a}-${d}`,d+=1;return i}function ut(e){return`adapter-${e.adapter}-${e.id}`.toLowerCase().replace(/[^a-z0-9-]+/g,"-")}function fc(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName}}function vt(e){return e.fieldName??"Value"}function Mt(e,a){return`${e.selected.name??"Selected"} ${vt(a)}`}function pt(e,a,n,i){const d=a.selected.path;return!e||!d?!1:(i==="watch"?e.watches:e.controls).some(c=>{var u;return c.target.role==="server"&&((u=c.path)==null?void 0:u.root)===d.root&&JSON.stringify(c.path.segments)===JSON.stringify(d.segments)&&c.access.kind===n.accessKind&&(n.accessKind==="value"||c.access.name===n.fieldName)})}function ft(e,a,n){var i,d;return JSON.stringify([(i=e.selected.path)==null?void 0:i.root,(d=e.selected.path)==null?void 0:d.segments,a.accessKind,a.fieldName??"value",n])}function $t(e,a){var i;if(e instanceof Jt&&((i=e.error)!=null&&i.trim()))return e.error;const n=e instanceof Error?e.message:String(e);return n.startsWith("API ")?`${a} ${n}`:n}function mc(e){var S,A,N,G;const{t:a,locale:n="en"}=ue(),[i,d]=o.useState("selection"),[c,u]=o.useState(""),[y,m]=o.useState(0),[_,C]=o.useState("My test profile"),[k,x]=o.useState(!e.profile),[f,V]=o.useState(null),[R,M]=o.useState(""),[w,B]=o.useState(!1),[P,E]=o.useState(null),W=o.useRef(!1),$=o.useRef({open:!1,profileId:null}),[ee,te]=o.useState(null),[q,O]=o.useState(null),[z,U]=o.useState(null),[L,ae]=o.useState(!1),[J,le]=o.useState(null),Q=e.profile,K=((S=e.catalog.adapters)==null?void 0:S.find(l=>l.name===J))??null,X=[K?a("playtest.values.adapterAiContext","Use the existing Test Adapter {{adapter}} at {{path}}. Detected methods: {{methods}}. Review their schemas before adding dashboard entries; do not run a method or guess value types and fixed arguments.").replace("{{adapter}}",K.name).replace("{{path}}",K.sourcePath??K.name).replace("{{methods}}",K.methods.map(l=>`${l.name} (${l.sideEffectClass})`).join(", ")):"",a("playtest.values.aiRequest")].filter(Boolean).join(`
113
108
 
114
- `);o.useEffect(()=>{var D;const l=$.current,r=((D=e.profile)==null?void 0:D.id)??null;$.current={open:e.open,profileId:r};const g=l.open&&l.profileId===null&&r!==null&&W.current;!e.open||g||l.open&&l.profileId===r||(d("selection"),x(!e.profile),u(""),m(0),V(null),M(""),E(null),O(null),te(null),ae(!1),le(null))},[e.open,(A=e.profile)==null?void 0:A.id]);const he=o.useMemo(()=>{const l=c.trim().toLocaleLowerCase();return e.catalog.entries.filter(r=>!l||[r.label,r.group,r.adapter,r.sourcePath,r.id].filter(Boolean).join(" ").toLocaleLowerCase().includes(l))},[e.catalog.entries,c]),re=((f==null?void 0:f.candidates)??[]).find(l=>Fe(l)===R)??(f==null?void 0:f.candidates[0]),oe=Math.max(1,Math.ceil(he.length/50)),ye=Math.min(y,oe-1),we=he.slice(ye*50,(ye+1)*50),H=new Set([...(Q==null?void 0:Q.controls)??[],...(Q==null?void 0:Q.watches)??[],...(Q==null?void 0:Q.actions)??[]].map(l=>l.origin?`${l.origin.adapter}/${l.origin.entryId}`:"")),se=[...(Q==null?void 0:Q.controls)??[],...(Q==null?void 0:Q.watches)??[]],ne=se.filter(l=>l.access.kind==="adapter"||l.access.kind==="adapter_read").length,ce=se.length-ne,ie=ce>=64,Ne=ne>=10,ve=((N=e.catalog.adapters)==null?void 0:N.filter(l=>l.entryCount===0))??[],_e=!!(e.catalog.catalogRevision&&e.catalog.verifiedAt&&!Number.isNaN(Date.parse(e.catalog.verifiedAt))),xe=_e&&e.catalog.verifiedAt?new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e.catalog.verifiedAt)):null,Ce=l=>{d(l),u(""),m(0)},be=async()=>{if(Q)return Q;if(!e.onCreateProfile||!_.trim())throw new Error(a("playtest.values.profileNameRequired","Enter a profile name before adding the first value."));return e.onCreateProfile(_.trim())},fe=async l=>{var g;const r={...l,schemaVersion:4,actions:l.actions??[],settings:l.settings??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"},sectionOrder:((g=l.sectionOrder)==null?void 0:g.length)===3?l.sectionOrder:["watches","controls","actions"]};await e.onSave(r)},Re=async(l,r)=>{if(!W.current){W.current=!0,E(`adapter:${l.id}`),O(null);try{const g=await be(),D={kind:"adapter",adapter:l.adapter,entryId:l.id,version:l.adapterVersion},h=b=>{var T;return((T=b.origin)==null?void 0:T.adapter)===l.adapter&&b.origin.entryId===l.id};if(r)await fe({...g,controls:g.controls.filter(b=>!h(b)),watches:g.watches.filter(b=>!h(b)),actions:(g.actions??[]).filter(b=>!h(b))});else if(l.kind==="action"){const b={id:tt(g,ut(l)),label:l.label,target:{role:"server"},executor:{kind:"adapter",adapter:l.adapter,method:l.execute.method},parameters:l.execute.parameters,fixedArguments:l.execute.fixedArguments,origin:D};await fe({...g,schemaVersion:4,actions:[...g.actions??[],b]})}else l.kind==="watch"?await fe({...g,schemaVersion:4,watches:[...g.watches,{id:tt(g,ut(l)),label:l.label,target:{role:"server"},access:{kind:"adapter_read",adapter:l.adapter,...l.read},valueType:l.valueType,origin:D}]}):l.write&&await fe({...g,schemaVersion:4,controls:[...g.controls,{id:tt(g,ut(l)),label:l.label,target:{role:"server"},access:{kind:"adapter",adapter:l.adapter,...l.write},observation:{kind:"adapter_read",adapter:l.adapter,...l.read},valueType:l.valueType,applyOnStart:!1,constraints:l.constraints,enumValues:l.enumValues,applyTiming:"after_agents_ready",restorePolicy:"session_end",origin:D}]})}catch(g){O(g instanceof Error?g.message:String(g))}finally{W.current=!1,E(null)}}},p=async(l,r,g)=>{if(!l.selected.path||w||W.current||pt(Q,l,r,g))return;const D=ft(l,r,g);W.current=!0,E(D),O(null),te(null);try{const h=await be(),b=Mt(l,r),I={id:tt(h,`direct-${fc([l.selected.path.root,...l.selected.path.segments,vt(r)].join("-"))}`),label:b,target:{role:"server"},path:l.selected.path,access:mc(r),valueType:r.valueType};g==="watch"?await fe({...h,schemaVersion:4,watches:[...h.watches,I]}):await fe({...h,schemaVersion:4,controls:[...h.controls,{...I,...r.enumValues?{enumValues:r.enumValues}:{},applyOnStart:!1,applyTiming:"after_agents_ready",restorePolicy:"session_end"}]})}catch(h){te({key:D,kind:g,message:$t(h,a("playtest.profile.saveFailed","Could not save profile."))})}finally{W.current=!1,E(null)}},j=async()=>{if(!(!e.onResolveSelectionCandidates||w||W.current)){B(!0),O(null),te(null);try{const l=await e.onResolveSelectionCandidates();V(l),M(l.candidates[0]?Fe(l.candidates[0]):""),(!l.selected.path||l.candidates.length===0)&&O(a("playtest.values.selectionEmpty","Select an Instance with a supported Attribute, Value, or property in Studio."))}catch(l){V(null),O($t(l,a("playtest.values.selectionFailed","Could not read the Studio selection. Select one Instance in Explorer and try again.")))}finally{B(!1)}}},F=async(l,r)=>{var g;await((g=navigator.clipboard)==null?void 0:g.writeText(r)),U(l)},v=[{id:"selection",label:a("playtest.values.sourceSelection","Studio selection")},{id:"registered",label:a("playtest.values.sourceRegistered","Test Adapter")}];return t.jsx(Ke,{open:e.open,ariaLabel:a("playtest.values.addTitle","Add a test value"),onClose:e.onClose,dismissDisabled:P!==null,children:t.jsxs("div",{className:s.valueManagerShell,children:[t.jsx(ze,{title:a("playtest.values.addTitle","Add a test value"),description:a("playtest.values.addDescription","Choose where the value exists. WEPPY uses the simplest available connection and shows where it came from."),closeLabel:a("common.close","Close"),closeDisabled:P!==null,onRequestClose:e.onClose}),t.jsx("div",{className:s.valueSourceTabs,role:"tablist","aria-label":a("playtest.values.sources","Value source"),children:v.map((l,r)=>t.jsx("button",{type:"button",role:"tab","aria-selected":i===l.id,"aria-controls":`playtest-value-source-${l.id}`,tabIndex:i===l.id?0:-1,onClick:()=>Ce(l.id),onKeyDown:g=>{var T,I;if(g.key!=="ArrowLeft"&&g.key!=="ArrowRight")return;g.preventDefault();const D=g.key==="ArrowRight"?1:-1,h=(r+D+v.length)%v.length,b=v[h];if(b){Ce(b.id);const Y=(T=g.currentTarget.parentElement)==null?void 0:T.querySelectorAll('[role="tab"]');(I=Y==null?void 0:Y[h])==null||I.focus()}},children:l.label},l.id))}),t.jsxs("div",{className:s.valueManagerBody,children:[k&&t.jsxs("label",{className:s.firstProfileName,children:[t.jsx("span",{children:a("playtest.profile.name","Profile name")}),t.jsx("input",{value:((G=e.profile)==null?void 0:G.name)??_,readOnly:!!e.profile,"aria-label":a("playtest.profile.name","Profile name"),onChange:l=>C(l.target.value)}),t.jsx("small",{children:a("playtest.values.firstProfileHint","The first value and this profile are saved together for the selected Place.")})]}),t.jsx("div",{className:s.subscriptionUsage,role:"status",children:a("playtest.values.subscriptionUsage","Runtime subscriptions · Direct {{direct}}/64 · Adapter {{adapter}}/10").replace("{{direct}}",String(ce)).replace("{{adapter}}",String(ne))}),i==="selection"&&t.jsxs("section",{id:"playtest-value-source-selection",role:"tabpanel",className:s.valueSourcePanel,children:[t.jsxs("div",{className:s.sourceIntro,children:[t.jsxs("div",{children:[t.jsx("strong",{children:a("playtest.values.selectionTitle","Use the actual Studio selection")}),t.jsx("p",{children:a("playtest.values.selectionDescription","Select an Instance in Explorer, then read its Attributes, Value, and supported properties. This path does not add test code.")})]}),t.jsx("button",{type:"button",className:s.primaryAction,disabled:!e.onResolveSelectionCandidates||w||P!==null,onClick:()=>void j(),children:w?a("playtest.values.readingSelection","Reading selection…"):a("playtest.values.readSelection","Read current Studio selection")})]}),(f==null?void 0:f.selected.path)&&f.candidates.length>0&&t.jsxs("div",{className:s.propertySelection,"aria-busy":w,children:[t.jsxs("div",{className:s.propertySelectionHeader,children:[t.jsxs("div",{className:s.selectedInstance,children:[t.jsx("span",{children:a("playtest.values.selectedInstance","Instance")}),t.jsx("strong",{children:f.selected.name??"Selected"}),f.selected.className&&t.jsx("span",{children:f.selected.className}),t.jsxs("details",{children:[t.jsx("summary",{children:a("playtest.values.location","Location")}),t.jsx("code",{children:[f.selected.path.root,...f.selected.path.segments].join(".")})]})]}),re&&t.jsx(pc,{candidates:f.candidates,selected:re,disabled:w||P!==null,onSelect:l=>M(Fe(l))})]}),(re?[re]:[]).map(l=>{const r=Mt(f,l),g=vt(l),D=ee&&ee.key===ft(f,l,ee.kind)?ee:null;return t.jsxs("div",{className:s.candidateEntry,children:[t.jsxs("div",{className:s.catalogRow,children:[t.jsxs("div",{children:[t.jsxs("strong",{children:[f.selected.name??"Selected"," · ",g]}),t.jsxs("span",{children:[a("playtest.values.actualNow","Actual now"),": ",st(l.value)]})]}),t.jsx("div",{className:s.candidateActions,children:["watch","control"].map(h=>{const b=pt(Q,f,l,h),T=b&&!pt(e.profile,f,l,h),I=P===ft(f,l,h),Y=h==="watch"?a("playtest.values.addWatch","Add as Watch Value"):a("playtest.values.addControl","Add as Control"),de=h==="watch"?a("playtest.values.addedWatch","Added as Watch Value"):a("playtest.values.addedControl","Added as Control"),je=h==="watch"?a("playtest.values.pendingWatch","Watch Value · save pending"):a("playtest.values.pendingControl","Control · save pending"),Pe=a("playtest.values.adding","Adding…"),Te=I?Pe:T?je:b?de:Y,Me=h==="watch"?a("playtest.values.addWatchLabel","Add {{label}} as Watch Value"):a("playtest.values.addControlLabel","Add {{label}} as Control");return t.jsxs("button",{type:"button",className:s.candidateAction,"data-state":I?"saving":T?"pending":b?"saved":"idle",disabled:w||!b&&ie,"aria-disabled":b||P!==null||void 0,"aria-label":b||I?`${Te} · ${r}`:Me.replace("{{label}}",r),onClick:()=>void p(f,l,h),children:[[Y,`✓ ${de}`,je,Pe].map(Se=>t.jsx("span",{className:s.candidateActionSizer,"aria-hidden":"true",children:Se},Se)),t.jsx("span",{className:s.candidateActionLabel,"aria-live":"polite","aria-atomic":"true",children:b&&!T&&!I?`✓ ${Te}`:Te})]},h)})})]}),D&&t.jsxs("div",{className:s.candidateError,role:"alert",children:[t.jsx("span",{children:D.message}),t.jsx("button",{type:"button",disabled:P!==null,onClick:()=>void p(f,l,D.kind),children:a("playtest.values.retryAddition","Try again")})]})]},`${l.accessKind}:${g}`)})]})]}),i==="registered"&&t.jsxs("section",{id:"playtest-value-source-registered",role:"tabpanel",className:s.valueSourcePanel,children:[t.jsxs("div",{className:s.registeredIntro,children:[t.jsx("strong",{children:a("playtest.values.registeredTitle","Reuse values your game already exposes for testing.")}),t.jsx("p",{children:a("playtest.values.registeredDescription","These values come from Test Adapter entries checked during the last Studio Play or Run. Adding one saves it to this profile and does not change the running game.")}),xe&&t.jsx("span",{children:a("playtest.values.lastChecked","Last checked: {{time}}").replace("{{time}}",xe)})]}),ve.length>0&&t.jsxs("section",{className:s.adapterSetupList,"aria-label":a("playtest.values.adaptersNeedingSetup","Adapters that need value setup"),children:[t.jsxs("header",{children:[t.jsx("strong",{children:a("playtest.values.adaptersFound","Test Adapters found")}),t.jsx("span",{children:a("playtest.values.adaptersFoundDescription","These adapters are available to tests but do not expose a value you can select yet.")})]}),ve.map(l=>t.jsxs("div",{className:s.adapterSetupRow,children:[t.jsxs("div",{children:[t.jsx("strong",{children:l.name}),t.jsxs("span",{children:[a("playtest.values.adapterSetupRequired","Value setup required")," · ",a("playtest.values.adapterVersion","Version")," ",l.version]}),l.sourcePath&&t.jsx("code",{children:l.sourcePath}),t.jsx("div",{className:s.adapterMethods,children:l.methods.map(r=>t.jsxs("span",{children:[r.name," · ",r.sideEffectClass==="read_only"?a("playtest.values.methodReadOnly","Read only"):r.sideEffectClass==="session_action"?a("playtest.actions.sessionAction","Session action"):a("playtest.values.methodReversible","Reversible fixture")]},r.name))})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.configureAdapterLabel","Configure values for {{adapter}}").replace("{{adapter}}",l.name),onClick:()=>{le(l.name),ae(!0)},children:a("playtest.values.configureAdapter","Configure values")})]},l.name))]}),e.catalog.entries.length>0&&t.jsxs("label",{className:s.valueSearch,children:[t.jsx("span",{children:a("playtest.values.searchRegistered","Search registered values")}),t.jsx("input",{type:"search","aria-label":a("playtest.values.searchRegistered","Search registered values"),value:c,onChange:l=>{u(l.target.value),m(0)},placeholder:a("playtest.values.searchPlaceholder","Name, group, source, or path")})]}),e.catalog.entries.length>0&&t.jsx("div",{className:s.valueCount,role:"status",children:a("playtest.values.count","{{visible}} of {{total}} values").replace("{{visible}}",String(he.length)).replace("{{total}}",String(e.catalog.entries.length))}),we.length>0?t.jsx("div",{className:s.catalogGroups,children:we.map(l=>{const r=H.has(`${l.adapter}/${l.id}`);return t.jsxs("div",{className:s.catalogRow,children:[t.jsxs("div",{children:[t.jsx("strong",{children:l.label}),t.jsxs("span",{children:[l.group," · ",l.kind==="control"?a("playtest.values.control","Control"):l.kind==="watch"?a("playtest.values.watch","Watch"):a("playtest.actions.action","Action")]}),t.jsx("code",{children:l.sourcePath??l.adapter}),t.jsxs("details",{className:s.catalogDetails,children:[t.jsx("summary",{children:a("playtest.values.registrationDetails","Registration details")}),t.jsxs("dl",{children:[t.jsxs("div",{children:[t.jsx("dt",{children:a("playtest.values.sourceLocation","Source location")}),t.jsx("dd",{children:t.jsx("code",{children:l.sourcePath??`ServerStorage.WeppyTestAdapters.${l.adapter}`})})]}),t.jsxs("div",{children:[t.jsx("dt",{children:a("playtest.values.profileUsage","Current profile")}),t.jsx("dd",{children:r?Q==null?void 0:Q.name:a("playtest.values.notInProfile","Not included")})]}),t.jsxs("div",{children:[t.jsx("dt",{children:a("playtest.values.sourceHash","Source hash")}),t.jsx("dd",{children:a("playtest.values.hashAtPlan","Verified when a removal plan is created")})]})]}),t.jsx("p",{children:a("playtest.values.profileRemovalImpact","Removing from this profile keeps the original adapter code.")}),t.jsx("p",{children:a("playtest.values.sourceRemovalImpact","Removing the original registration changes project test code and can affect other profiles or automated tests. Review the source hash, diff, and known usages first.")}),t.jsx("button",{type:"button","aria-label":a("playtest.values.copyRemovalRequest","Copy original registration removal request"),onClick:()=>void F(`remove:${l.adapter}/${l.id}`,`Review removal of the WEPPY Playtest adapter registration ${l.adapter}/${l.id}.
109
+ `);o.useEffect(()=>{var D;const l=$.current,r=((D=e.profile)==null?void 0:D.id)??null;$.current={open:e.open,profileId:r};const g=l.open&&l.profileId===null&&r!==null&&W.current;!e.open||g||l.open&&l.profileId===r||(d("selection"),x(!e.profile),u(""),m(0),V(null),M(""),E(null),O(null),te(null),ae(!1),le(null))},[e.open,(A=e.profile)==null?void 0:A.id]);const he=o.useMemo(()=>{const l=c.trim().toLocaleLowerCase();return e.catalog.entries.filter(r=>!l||[r.label,r.group,r.adapter,r.sourcePath,r.id].filter(Boolean).join(" ").toLocaleLowerCase().includes(l))},[e.catalog.entries,c]),re=((f==null?void 0:f.candidates)??[]).find(l=>Fe(l)===R)??(f==null?void 0:f.candidates[0]),oe=Math.max(1,Math.ceil(he.length/50)),ye=Math.min(y,oe-1),we=he.slice(ye*50,(ye+1)*50),H=new Set([...(Q==null?void 0:Q.controls)??[],...(Q==null?void 0:Q.watches)??[],...(Q==null?void 0:Q.actions)??[]].map(l=>l.origin?`${l.origin.adapter}/${l.origin.entryId}`:"")),se=[...(Q==null?void 0:Q.controls)??[],...(Q==null?void 0:Q.watches)??[]],ne=se.filter(l=>l.access.kind==="adapter"||l.access.kind==="adapter_read").length,ce=se.length-ne,ie=ce>=64,Ne=ne>=10,ve=((N=e.catalog.adapters)==null?void 0:N.filter(l=>l.entryCount===0))??[],_e=!!(e.catalog.catalogRevision&&e.catalog.verifiedAt&&!Number.isNaN(Date.parse(e.catalog.verifiedAt))),xe=_e&&e.catalog.verifiedAt?new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e.catalog.verifiedAt)):null,Ce=l=>{d(l),u(""),m(0)},be=async()=>{if(Q)return Q;if(!e.onCreateProfile||!_.trim())throw new Error(a("playtest.values.profileNameRequired","Enter a profile name before adding the first value."));return e.onCreateProfile(_.trim())},fe=async l=>{var g;const r={...l,schemaVersion:4,actions:l.actions??[],settings:l.settings??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"},sectionOrder:((g=l.sectionOrder)==null?void 0:g.length)===3?l.sectionOrder:["watches","controls","actions"]};await e.onSave(r)},Re=async(l,r)=>{if(!W.current){W.current=!0,E(`adapter:${l.id}`),O(null);try{const g=await be(),D={kind:"adapter",adapter:l.adapter,entryId:l.id,version:l.adapterVersion},h=b=>{var T;return((T=b.origin)==null?void 0:T.adapter)===l.adapter&&b.origin.entryId===l.id};if(r)await fe({...g,controls:g.controls.filter(b=>!h(b)),watches:g.watches.filter(b=>!h(b)),actions:(g.actions??[]).filter(b=>!h(b))});else if(l.kind==="action"){const b={id:tt(g,ut(l)),label:l.label,target:{role:"server"},executor:{kind:"adapter",adapter:l.adapter,method:l.execute.method},parameters:l.execute.parameters,fixedArguments:l.execute.fixedArguments,origin:D};await fe({...g,schemaVersion:4,actions:[...g.actions??[],b]})}else l.kind==="watch"?await fe({...g,schemaVersion:4,watches:[...g.watches,{id:tt(g,ut(l)),label:l.label,target:{role:"server"},access:{kind:"adapter_read",adapter:l.adapter,...l.read},valueType:l.valueType,origin:D}]}):l.write&&await fe({...g,schemaVersion:4,controls:[...g.controls,{id:tt(g,ut(l)),label:l.label,target:{role:"server"},access:{kind:"adapter",adapter:l.adapter,...l.write},observation:{kind:"adapter_read",adapter:l.adapter,...l.read},valueType:l.valueType,applyOnStart:!1,constraints:l.constraints,enumValues:l.enumValues,applyTiming:"after_agents_ready",restorePolicy:"session_end",origin:D}]})}catch(g){O(g instanceof Error?g.message:String(g))}finally{W.current=!1,E(null)}}},p=async(l,r,g)=>{if(!l.selected.path||w||W.current||pt(Q,l,r,g))return;const D=ft(l,r,g);W.current=!0,E(D),O(null),te(null);try{const h=await be(),b=Mt(l,r),I={id:tt(h,`direct-${pc([l.selected.path.root,...l.selected.path.segments,vt(r)].join("-"))}`),label:b,target:{role:"server"},path:l.selected.path,access:fc(r),valueType:r.valueType};g==="watch"?await fe({...h,schemaVersion:4,watches:[...h.watches,I]}):await fe({...h,schemaVersion:4,controls:[...h.controls,{...I,...r.enumValues?{enumValues:r.enumValues}:{},applyOnStart:!1,applyTiming:"after_agents_ready",restorePolicy:"session_end"}]})}catch(h){te({key:D,kind:g,message:$t(h,a("playtest.profile.saveFailed","Could not save profile."))})}finally{W.current=!1,E(null)}},j=async()=>{if(!(!e.onResolveSelectionCandidates||w||W.current)){B(!0),O(null),te(null);try{const l=await e.onResolveSelectionCandidates();V(l),M(l.candidates[0]?Fe(l.candidates[0]):""),(!l.selected.path||l.candidates.length===0)&&O(a("playtest.values.selectionEmpty","Select an Instance with a supported Attribute, Value, or property in Studio."))}catch(l){V(null),O($t(l,a("playtest.values.selectionFailed","Could not read the Studio selection. Select one Instance in Explorer and try again.")))}finally{B(!1)}}},F=async(l,r)=>{var g;await((g=navigator.clipboard)==null?void 0:g.writeText(r)),U(l)},v=[{id:"selection",label:a("playtest.values.sourceSelection","Studio selection")},{id:"registered",label:a("playtest.values.sourceRegistered","Test Adapter")}];return t.jsx(Ke,{open:e.open,ariaLabel:a("playtest.values.addTitle","Add a test value"),onClose:e.onClose,dismissDisabled:P!==null,children:t.jsxs("div",{className:s.valueManagerShell,children:[t.jsx(ze,{title:a("playtest.values.addTitle","Add a test value"),description:a("playtest.values.addDescription","Choose where the value exists. WEPPY uses the simplest available connection and shows where it came from."),closeLabel:a("common.close","Close"),closeDisabled:P!==null,onRequestClose:e.onClose}),t.jsx("div",{className:s.valueSourceTabs,role:"tablist","aria-label":a("playtest.values.sources","Value source"),children:v.map((l,r)=>t.jsx("button",{type:"button",role:"tab","aria-selected":i===l.id,"aria-controls":`playtest-value-source-${l.id}`,tabIndex:i===l.id?0:-1,onClick:()=>Ce(l.id),onKeyDown:g=>{var T,I;if(g.key!=="ArrowLeft"&&g.key!=="ArrowRight")return;g.preventDefault();const D=g.key==="ArrowRight"?1:-1,h=(r+D+v.length)%v.length,b=v[h];if(b){Ce(b.id);const Y=(T=g.currentTarget.parentElement)==null?void 0:T.querySelectorAll('[role="tab"]');(I=Y==null?void 0:Y[h])==null||I.focus()}},children:l.label},l.id))}),t.jsxs("div",{className:s.valueManagerBody,children:[k&&t.jsxs("label",{className:s.firstProfileName,children:[t.jsx("span",{children:a("playtest.profile.name","Profile name")}),t.jsx("input",{value:((G=e.profile)==null?void 0:G.name)??_,readOnly:!!e.profile,"aria-label":a("playtest.profile.name","Profile name"),onChange:l=>C(l.target.value)}),t.jsx("small",{children:a("playtest.values.firstProfileHint","The first value and this profile are saved together for the selected Place.")})]}),t.jsx("div",{className:s.subscriptionUsage,role:"status",children:a("playtest.values.subscriptionUsage","Runtime subscriptions · Direct {{direct}}/64 · Adapter {{adapter}}/10").replace("{{direct}}",String(ce)).replace("{{adapter}}",String(ne))}),i==="selection"&&t.jsxs("section",{id:"playtest-value-source-selection",role:"tabpanel",className:s.valueSourcePanel,children:[t.jsxs("div",{className:s.sourceIntro,children:[t.jsxs("div",{children:[t.jsx("strong",{children:a("playtest.values.selectionTitle","Use the actual Studio selection")}),t.jsx("p",{children:a("playtest.values.selectionDescription","Select an Instance in Explorer, then read its Attributes, Value, and supported properties. This path does not add test code.")})]}),t.jsx("button",{type:"button",className:s.primaryAction,disabled:!e.onResolveSelectionCandidates||w||P!==null,onClick:()=>void j(),children:w?a("playtest.values.readingSelection","Reading selection…"):a("playtest.values.readSelection","Read current Studio selection")})]}),(f==null?void 0:f.selected.path)&&f.candidates.length>0&&t.jsxs("div",{className:s.propertySelection,"aria-busy":w,children:[t.jsxs("div",{className:s.propertySelectionHeader,children:[t.jsxs("div",{className:s.selectedInstance,children:[t.jsx("span",{children:a("playtest.values.selectedInstance","Instance")}),t.jsx("strong",{children:f.selected.name??"Selected"}),f.selected.className&&t.jsx("span",{children:f.selected.className}),t.jsxs("details",{children:[t.jsx("summary",{children:a("playtest.values.location","Location")}),t.jsx("code",{children:[f.selected.path.root,...f.selected.path.segments].join(".")})]})]}),re&&t.jsx(uc,{candidates:f.candidates,selected:re,disabled:w||P!==null,onSelect:l=>M(Fe(l))})]}),(re?[re]:[]).map(l=>{const r=Mt(f,l),g=vt(l),D=ee&&ee.key===ft(f,l,ee.kind)?ee:null;return t.jsxs("div",{className:s.candidateEntry,children:[t.jsxs("div",{className:s.catalogRow,children:[t.jsxs("div",{children:[t.jsxs("strong",{children:[f.selected.name??"Selected"," · ",g]}),t.jsxs("span",{children:[a("playtest.values.actualNow","Actual now"),": ",st(l.value)]})]}),t.jsx("div",{className:s.candidateActions,children:["watch","control"].map(h=>{const b=pt(Q,f,l,h),T=b&&!pt(e.profile,f,l,h),I=P===ft(f,l,h),Y=h==="watch"?a("playtest.values.addWatch","Add as Watch Value"):a("playtest.values.addControl","Add as Control"),de=h==="watch"?a("playtest.values.addedWatch","Added as Watch Value"):a("playtest.values.addedControl","Added as Control"),je=h==="watch"?a("playtest.values.pendingWatch","Watch Value · save pending"):a("playtest.values.pendingControl","Control · save pending"),Pe=a("playtest.values.adding","Adding…"),Ie=I?Pe:T?je:b?de:Y,Me=h==="watch"?a("playtest.values.addWatchLabel","Add {{label}} as Watch Value"):a("playtest.values.addControlLabel","Add {{label}} as Control");return t.jsxs("button",{type:"button",className:s.candidateAction,"data-state":I?"saving":T?"pending":b?"saved":"idle",disabled:w||!b&&ie,"aria-disabled":b||P!==null||void 0,"aria-label":b||I?`${Ie} · ${r}`:Me.replace("{{label}}",r),onClick:()=>void p(f,l,h),children:[[Y,`✓ ${de}`,je,Pe].map(Se=>t.jsx("span",{className:s.candidateActionSizer,"aria-hidden":"true",children:Se},Se)),t.jsx("span",{className:s.candidateActionLabel,"aria-live":"polite","aria-atomic":"true",children:b&&!T&&!I?`✓ ${Ie}`:Ie})]},h)})})]}),D&&t.jsxs("div",{className:s.candidateError,role:"alert",children:[t.jsx("span",{children:D.message}),t.jsx("button",{type:"button",disabled:P!==null,onClick:()=>void p(f,l,D.kind),children:a("playtest.values.retryAddition","Try again")})]})]},`${l.accessKind}:${g}`)})]})]}),i==="registered"&&t.jsxs("section",{id:"playtest-value-source-registered",role:"tabpanel",className:s.valueSourcePanel,children:[t.jsxs("div",{className:s.registeredIntro,children:[t.jsx("strong",{children:a("playtest.values.registeredTitle","Reuse values your game already exposes for testing.")}),t.jsx("p",{children:a("playtest.values.registeredDescription","These values come from Test Adapter entries checked during the last Studio Play or Run. Adding one saves it to this profile and does not change the running game.")}),xe&&t.jsx("span",{children:a("playtest.values.lastChecked","Last checked: {{time}}").replace("{{time}}",xe)})]}),ve.length>0&&t.jsxs("section",{className:s.adapterSetupList,"aria-label":a("playtest.values.adaptersNeedingSetup","Adapters that need value setup"),children:[t.jsxs("header",{children:[t.jsx("strong",{children:a("playtest.values.adaptersFound","Test Adapters found")}),t.jsx("span",{children:a("playtest.values.adaptersFoundDescription","These adapters are available to tests but do not expose a value you can select yet.")})]}),ve.map(l=>t.jsxs("div",{className:s.adapterSetupRow,children:[t.jsxs("div",{children:[t.jsx("strong",{children:l.name}),t.jsxs("span",{children:[a("playtest.values.adapterSetupRequired","Value setup required")," · ",a("playtest.values.adapterVersion","Version")," ",l.version]}),l.sourcePath&&t.jsx("code",{children:l.sourcePath}),t.jsx("div",{className:s.adapterMethods,children:l.methods.map(r=>t.jsxs("span",{children:[r.name," · ",r.sideEffectClass==="read_only"?a("playtest.values.methodReadOnly","Read only"):r.sideEffectClass==="session_action"?a("playtest.actions.sessionAction","Session action"):a("playtest.values.methodReversible","Reversible fixture")]},r.name))})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.configureAdapterLabel","Configure values for {{adapter}}").replace("{{adapter}}",l.name),onClick:()=>{le(l.name),ae(!0)},children:a("playtest.values.configureAdapter","Configure values")})]},l.name))]}),e.catalog.entries.length>0&&t.jsxs("label",{className:s.valueSearch,children:[t.jsx("span",{children:a("playtest.values.searchRegistered","Search registered values")}),t.jsx("input",{type:"search","aria-label":a("playtest.values.searchRegistered","Search registered values"),value:c,onChange:l=>{u(l.target.value),m(0)},placeholder:a("playtest.values.searchPlaceholder","Name, group, source, or path")})]}),e.catalog.entries.length>0&&t.jsx("div",{className:s.valueCount,role:"status",children:a("playtest.values.count","{{visible}} of {{total}} values").replace("{{visible}}",String(he.length)).replace("{{total}}",String(e.catalog.entries.length))}),we.length>0?t.jsx("div",{className:s.catalogGroups,children:we.map(l=>{const r=H.has(`${l.adapter}/${l.id}`);return t.jsxs("div",{className:s.catalogRow,children:[t.jsxs("div",{children:[t.jsx("strong",{children:l.label}),t.jsxs("span",{children:[l.group," · ",l.kind==="control"?a("playtest.values.control","Control"):l.kind==="watch"?a("playtest.values.watch","Watch"):a("playtest.actions.action","Action")]}),t.jsx("code",{children:l.sourcePath??l.adapter}),t.jsxs("details",{className:s.catalogDetails,children:[t.jsx("summary",{children:a("playtest.values.registrationDetails","Registration details")}),t.jsxs("dl",{children:[t.jsxs("div",{children:[t.jsx("dt",{children:a("playtest.values.sourceLocation","Source location")}),t.jsx("dd",{children:t.jsx("code",{children:l.sourcePath??`ServerStorage.WeppyTestAdapters.${l.adapter}`})})]}),t.jsxs("div",{children:[t.jsx("dt",{children:a("playtest.values.profileUsage","Current profile")}),t.jsx("dd",{children:r?Q==null?void 0:Q.name:a("playtest.values.notInProfile","Not included")})]}),t.jsxs("div",{children:[t.jsx("dt",{children:a("playtest.values.sourceHash","Source hash")}),t.jsx("dd",{children:a("playtest.values.hashAtPlan","Verified when a removal plan is created")})]})]}),t.jsx("p",{children:a("playtest.values.profileRemovalImpact","Removing from this profile keeps the original adapter code.")}),t.jsx("p",{children:a("playtest.values.sourceRemovalImpact","Removing the original registration changes project test code and can affect other profiles or automated tests. Review the source hash, diff, and known usages first.")}),t.jsx("button",{type:"button","aria-label":a("playtest.values.copyRemovalRequest","Copy original registration removal request"),onClick:()=>void F(`remove:${l.adapter}/${l.id}`,`Review removal of the WEPPY Playtest adapter registration ${l.adapter}/${l.id}.
115
110
 
116
111
  - Call manage_studio.playtest_adapter_plan with adapterOperation=remove_entry, adapterId=${l.adapter}, and adapterRegistrationId=${l.id}.
117
112
  - Show the current source SHA-256, unified diff, profile and scenario usages, dynamic-reference coverage, and production exclusion strategy.
118
113
  - Do not change source until I review the plan.
119
114
  - Apply only the returned unexpired plan token and expected source hash.
120
- - After apply, start a new Play and confirm the catalog no longer includes this entry.`),children:z===`remove:${l.adapter}/${l.id}`?a("playtest.values.copied","Copied"):a("playtest.values.copyRemovalRequest","Copy original registration removal request")})]})]}),t.jsx("button",{type:"button",disabled:P!==null||!r&&Ne,"aria-label":r?`${a("playtest.values.remove","Remove")} ${l.label} ${a("playtest.values.fromProfile","from profile")}`:`${a("playtest.values.add","Add")} ${l.label}`,onClick:()=>void Re(l,r),children:r?a("playtest.values.removeFromProfile","Remove from profile"):P===`adapter:${l.id}`?a("playtest.profile.saving","Saving…"):a("playtest.values.add","Add")})]},`${l.adapter}/${l.id}`)})}):e.catalog.entries.length===0&&ve.length===0?t.jsxs("div",{className:s.registeredEmpty,children:[t.jsx("strong",{children:_e?a("playtest.values.registeredEmptyChecked","The last Play or Run found no registered values."):a("playtest.values.registeredNotChecked","Test Adapters have not been checked yet.")}),t.jsx("p",{children:_e?a("playtest.values.registeredEmptyDescription","Use Studio selection for values visible in Explorer. Connect a game internal value when the value only exists in code."):a("playtest.values.registeredNotCheckedDescription","Connect a game internal value, then start Play or Run in Studio so WEPPY can check it.")}),t.jsxs("ol",{className:s.registeredSteps,"aria-label":a("playtest.values.registeredSteps","How registered values appear"),children:[t.jsx("li",{children:a("playtest.values.registeredStepConnect","Connect the value")}),t.jsx("li",{children:a("playtest.values.registeredStepPlay","Start Play or Run in Studio")}),t.jsx("li",{children:a("playtest.values.registeredStepCheck","Return here and check the list")}),t.jsx("li",{children:a("playtest.values.registeredStepAdd","Add the value to this profile")})]}),t.jsx("div",{className:s.registeredEmptyActions,children:t.jsx("button",{type:"button",onClick:()=>Ce("selection"),children:a("playtest.values.useStudioSelection","Use Studio selection")})})]}):e.catalog.entries.length>0?t.jsxs("div",{className:s.registeredEmpty,children:[t.jsx("strong",{children:a("playtest.values.registeredNoResults","No registered values match your search.")}),t.jsx("button",{type:"button",onClick:()=>{u(""),m(0)},children:a("playtest.values.clearSearch","Clear search")})]}):null,oe>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:ye===0,onClick:()=>m(l=>l-1),children:a("playtest.values.previous","Previous")}),t.jsxs("span",{children:[ye+1," / ",oe]}),t.jsx("button",{type:"button",disabled:ye+1>=oe,onClick:()=>m(l=>l+1),children:a("playtest.values.next","Next")})]}),e.catalog.diagnostics.map(l=>t.jsxs("div",{className:s.bindingError,role:"alert",children:[l.adapter,l.entryId?`/${l.entryId}`:"",": ",l.message]},`${l.adapter}/${l.entryId??l.code}`)),t.jsxs("details",{className:s.connectionGuide,open:L,onToggle:l=>ae(l.currentTarget.open),children:[t.jsx("summary",{children:a("playtest.values.connectValues","Connect a value")}),t.jsxs("div",{className:s.registrationGuide,children:[t.jsx("strong",{children:a("playtest.values.registerTitle","Register values in a Test Adapter")}),t.jsx("p",{children:a("playtest.values.registerDescription","Use a Test Adapter only for game state that cannot be reached through an Instance Attribute, Value, or supported property.")}),K&&t.jsx("p",{className:s.adapterSetupContext,children:a("playtest.values.configuringAdapter","Configuring {{adapter}} using its detected methods.").replace("{{adapter}}",K.name)}),t.jsx("code",{children:a("playtest.values.adapterPath","ServerStorage.WeppyTestAdapters")}),t.jsx("p",{children:a("playtest.values.registerSafety")}),t.jsx("p",{children:a("playtest.values.deploymentHint")}),t.jsxs("details",{className:s.registrationExample,children:[t.jsx("summary",{children:a("playtest.values.showExample","Show Luau registration example")}),t.jsx("pre",{children:Lt})]}),t.jsxs("details",{className:s.registrationExample,children:[t.jsx("summary",{children:a("playtest.values.showAiExample","Show AI request example")}),t.jsx("pre",{children:X})]}),t.jsxs("div",{className:s.registrationActions,children:[t.jsx("button",{type:"button",onClick:()=>void F("example",Lt),children:z==="example"?a("playtest.values.copied","Copied"):a("playtest.values.copyExample","Copy Luau example")}),t.jsx("button",{type:"button",onClick:()=>void F("ai",X),children:z==="ai"?a("playtest.values.copied","Copied"):a("playtest.values.copyAi","Copy AI request")})]}),t.jsxs("ol",{className:s.registeredSteps,"aria-label":a("playtest.values.afterRegistration","After connecting the value"),children:[t.jsx("li",{children:a("playtest.values.afterRegistrationPlay","Start a new Play or Run so WEPPY can check the connection.")}),t.jsx("li",{children:a("playtest.values.afterRegistrationAdd","Stop, return to Test Adapter, and add it to the profile.")}),t.jsx("li",{children:a("playtest.values.afterRegistrationObserve","Start Play or Run again to observe the value.")})]})]})]})]}),q&&t.jsx("div",{className:s.bindingError,role:"alert",children:q})]}),t.jsx("div",{className:s.valueManagerFooter,children:t.jsx("button",{type:"button",className:s.primaryAction,disabled:P!==null||se.length===0,onClick:e.onClose,children:a("playtest.values.viewAdded","View added values")})})]})})}const yc=`{
115
+ - After apply, start a new Play and confirm the catalog no longer includes this entry.`),children:z===`remove:${l.adapter}/${l.id}`?a("playtest.values.copied","Copied"):a("playtest.values.copyRemovalRequest","Copy original registration removal request")})]})]}),t.jsx("button",{type:"button",disabled:P!==null||!r&&Ne,"aria-label":r?`${a("playtest.values.remove","Remove")} ${l.label} ${a("playtest.values.fromProfile","from profile")}`:`${a("playtest.values.add","Add")} ${l.label}`,onClick:()=>void Re(l,r),children:r?a("playtest.values.removeFromProfile","Remove from profile"):P===`adapter:${l.id}`?a("playtest.profile.saving","Saving…"):a("playtest.values.add","Add")})]},`${l.adapter}/${l.id}`)})}):e.catalog.entries.length===0&&ve.length===0?t.jsxs("div",{className:s.registeredEmpty,children:[t.jsx("strong",{children:_e?a("playtest.values.registeredEmptyChecked","The last Play or Run found no registered values."):a("playtest.values.registeredNotChecked","Test Adapters have not been checked yet.")}),t.jsx("p",{children:_e?a("playtest.values.registeredEmptyDescription","Use Studio selection for values visible in Explorer. Connect a game internal value when the value only exists in code."):a("playtest.values.registeredNotCheckedDescription","Connect a game internal value, then start Play or Run in Studio so WEPPY can check it.")}),t.jsxs("ol",{className:s.registeredSteps,"aria-label":a("playtest.values.registeredSteps","How registered values appear"),children:[t.jsx("li",{children:a("playtest.values.registeredStepConnect","Connect the value")}),t.jsx("li",{children:a("playtest.values.registeredStepPlay","Start Play or Run in Studio")}),t.jsx("li",{children:a("playtest.values.registeredStepCheck","Return here and check the list")}),t.jsx("li",{children:a("playtest.values.registeredStepAdd","Add the value to this profile")})]}),t.jsx("div",{className:s.registeredEmptyActions,children:t.jsx("button",{type:"button",onClick:()=>Ce("selection"),children:a("playtest.values.useStudioSelection","Use Studio selection")})})]}):e.catalog.entries.length>0?t.jsxs("div",{className:s.registeredEmpty,children:[t.jsx("strong",{children:a("playtest.values.registeredNoResults","No registered values match your search.")}),t.jsx("button",{type:"button",onClick:()=>{u(""),m(0)},children:a("playtest.values.clearSearch","Clear search")})]}):null,oe>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:ye===0,onClick:()=>m(l=>l-1),children:a("playtest.values.previous","Previous")}),t.jsxs("span",{children:[ye+1," / ",oe]}),t.jsx("button",{type:"button",disabled:ye+1>=oe,onClick:()=>m(l=>l+1),children:a("playtest.values.next","Next")})]}),e.catalog.diagnostics.map(l=>t.jsxs("div",{className:s.bindingError,role:"alert",children:[l.adapter,l.entryId?`/${l.entryId}`:"",": ",l.message]},`${l.adapter}/${l.entryId??l.code}`)),t.jsxs("details",{className:s.connectionGuide,open:L,onToggle:l=>ae(l.currentTarget.open),children:[t.jsx("summary",{children:a("playtest.values.connectValues","Connect a value")}),t.jsxs("div",{className:s.registrationGuide,children:[t.jsx("strong",{children:a("playtest.values.registerTitle","Register values in a Test Adapter")}),t.jsx("p",{children:a("playtest.values.registerDescription","Use a Test Adapter only for game state that cannot be reached through an Instance Attribute, Value, or supported property.")}),K&&t.jsx("p",{className:s.adapterSetupContext,children:a("playtest.values.configuringAdapter","Configuring {{adapter}} using its detected methods.").replace("{{adapter}}",K.name)}),t.jsx("code",{children:a("playtest.values.adapterPath","ServerStorage.WeppyTestAdapters")}),t.jsx("p",{children:a("playtest.values.registerSafety")}),t.jsx("p",{children:a("playtest.values.deploymentHint")}),t.jsxs("details",{className:s.registrationExample,children:[t.jsx("summary",{children:a("playtest.values.showExample","Show Luau registration example")}),t.jsx("pre",{children:Lt})]}),t.jsxs("details",{className:s.registrationExample,children:[t.jsx("summary",{children:a("playtest.values.showAiExample","Show AI request example")}),t.jsx("pre",{children:X})]}),t.jsxs("div",{className:s.registrationActions,children:[t.jsx("button",{type:"button",onClick:()=>void F("example",Lt),children:z==="example"?a("playtest.values.copied","Copied"):a("playtest.values.copyExample","Copy Luau example")}),t.jsx("button",{type:"button",onClick:()=>void F("ai",X),children:z==="ai"?a("playtest.values.copied","Copied"):a("playtest.values.copyAi","Copy AI request")})]}),t.jsxs("ol",{className:s.registeredSteps,"aria-label":a("playtest.values.afterRegistration","After connecting the value"),children:[t.jsx("li",{children:a("playtest.values.afterRegistrationPlay","Start a new Play or Run so WEPPY can check the connection.")}),t.jsx("li",{children:a("playtest.values.afterRegistrationAdd","Stop, return to Test Adapter, and add it to the profile.")}),t.jsx("li",{children:a("playtest.values.afterRegistrationObserve","Start Play or Run again to observe the value.")})]})]})]})]}),q&&t.jsx("div",{className:s.bindingError,role:"alert",children:q})]}),t.jsx("div",{className:s.valueManagerFooter,children:t.jsx("button",{type:"button",className:s.primaryAction,disabled:P!==null||se.length===0,onClick:e.onClose,children:a("playtest.values.viewAdded","View added values")})})]})})}const hc=`{
121
116
  "name": "Production",
122
117
  "globIgnorePaths": ["src/ServerStorage/WeppyTestAdapters/**"],
123
118
  "tree": {
124
119
  "$className": "DataModel",
125
120
  "ServerStorage": { "$path": "src/ServerStorage" }
126
121
  }
127
- }`;function vc(e){const{t:a}=ue();return t.jsxs("section",{className:s.deploymentGuide,"aria-label":a("playtest.guide.title"),children:[t.jsxs("header",{className:s.deploymentLifecycle,children:[e.showHeading!==!1&&t.jsx("h2",{children:a("playtest.guide.title")}),t.jsx("p",{children:a("playtest.guide.runtime")}),t.jsx("p",{children:a("playtest.guide.local")}),t.jsx("p",{children:a("playtest.guide.methodIntro")}),t.jsx("p",{children:a("playtest.guide.actionEffects")})]}),e.hasManagedAdapterWithoutStudioGuard&&t.jsxs("section",{className:s.deploymentNotice,children:[t.jsx("h3",{children:a("playtest.guide.studioGuardNoticeTitle")}),t.jsx("p",{children:a("playtest.guide.studioGuardNotice")})]}),t.jsxs("section",{className:s.deploymentChecklist,"aria-labelledby":"playtest-publish-checklist-title",children:[t.jsx("h3",{id:"playtest-publish-checklist-title",children:a("playtest.guide.checklistTitle")}),t.jsxs("ul",{children:[t.jsx("li",{children:a("playtest.guide.checklistTarget")}),t.jsx("li",{children:a("playtest.guide.checklistBehavior")})]})]}),t.jsxs("div",{className:s.deploymentScope,children:[t.jsxs("section",{className:s.deploymentLifecycle,children:[t.jsx("h3",{children:a("playtest.guide.excludeTitle")}),t.jsx("p",{children:a("playtest.guide.exclude")})]}),t.jsxs("section",{className:s.deploymentLifecycle,children:[t.jsx("h3",{children:a("playtest.guide.conditionalDataTitle")}),t.jsx("p",{children:a("playtest.guide.checklistData")})]})]}),t.jsxs("section",{className:s.deploymentLifecycle,children:[t.jsx("h3",{children:a("playtest.guide.afterPublishTitle")}),t.jsx("p",{children:a("playtest.guide.final")})]}),t.jsxs("details",{className:s.deploymentDetails,children:[t.jsx("summary",{children:a("playtest.guide.studioTitle")}),t.jsx("p",{children:a("playtest.guide.include")}),t.jsx("p",{children:a("playtest.guide.studio")})]}),t.jsxs("details",{className:s.deploymentDetails,children:[t.jsx("summary",{children:a("playtest.guide.rojoTitle")}),t.jsx("p",{children:a("playtest.guide.rojo")}),t.jsx("pre",{children:yc}),t.jsx("p",{children:a("playtest.guide.rojoExample")})]}),t.jsxs("details",{className:s.deploymentDetails,children:[t.jsx("summary",{children:a("playtest.guide.dataTitle")}),t.jsx("p",{children:a("playtest.guide.data")})]}),t.jsx("p",{className:s.deploymentDescription,children:a("playtest.guide.description")})]})}function gc(e){return e.studioState==="running"?"Running":e.studioState==="paused"?"Paused":"Edit"}function bc(e,a){const n=((e==null?void 0:e.pluginClients)??[]).filter(d=>d.connectionState==="connected");let i;if(a!==null){const d=n.filter(c=>c.placeId===a);i=d.length===1?d[0]:void 0}else i=Yt(n,(e==null?void 0:e.studioRoutingMode)??"recentPriority",(e==null?void 0:e.pinnedTargetClientId)??null)[0];return i?{state:gc(i),targetClientId:i.clientId,...i.studioStateUpdatedAt!==void 0?{updatedAt:i.studioStateUpdatedAt}:{},...i.playtestMode!==void 0?{mode:i.playtestMode}:{}}:{state:"Edit",targetClientId:null}}function Mc(){var be,fe,Re;const{t:e}=ue(),a=Qt(),n=Xt(),{trackEvent:i}=Zt(),{tier:d,loading:c}=ea(),{level:u,status:y}=ta(),m=!c&&d==="basic",[_,C]=o.useState(null),k=Ba({enabled:!m,placeId:_}),x=bc(y,_),f=Mo({enabled:!c&&u==="studioConnected",canMutate:!m,placeId:_,studioSnapshot:x}),[V,R]=o.useState(Do),[M,w]=o.useState(!1),[B,P]=o.useState(!1),[E,W]=o.useState(!1),$=o.useRef(null),[ee,te]=o.useState(!1),{show:q}=aa(),[O,z]=o.useState(null),[U,L]=o.useState(!1),[ae,J]=o.useState(!1);o.useEffect(()=>{const p=new URLSearchParams(a.search);if(p.get("add")!=="value")return;R("live"),P(!0),p.delete("add");const j=p.toString();n(`${a.pathname}${j?`?${j}`:""}${a.hash}`,{replace:!0})},[a.hash,a.pathname,a.search,n]);const le=u==="studioConnected",Q=le?f.profile?f.studioState==="Edit"?e("playtest.values.playRequired","Start Play or Run in Studio to change test values."):m?e("playtest.controls.proRequired","Real-time value editing and Reset all are available with Pro."):e("playtest.controls.connectingDescription","Preparing runtime controls for the selected profile…"):e("playtest.controls.profileRequired","Select or create a test profile to change values."):e("playtest.controls.studioRequired","Connect Roblox Studio and WEPPY Plugin to change test values."),K=le?f.studioState:"Disconnected",Z=o.useRef(null),{history:X,historyLoadState:he,historyError:re,selectedReport:oe,loading:ye,detailLoading:we,detailError:H}=k,se=m?Fa(e):null,ne=((be=se==null?void 0:se.history[0])==null?void 0:be.recordId)??null,ce=(se==null?void 0:se.history)??X,ie=se&&O===ne?se.report:oe,Ne=m?!1:ye,ve=ce.find(p=>p.recordId===O),_e=(p,j)=>{Z.current=j,z(p),!m&&k.loadReport(p)},xe=o.useCallback(()=>{z(null),k.clearSelectedReport()},[k.clearSelectedReport]),Ce=async()=>{J(!0);try{await k.clearHistory(),q(e("toast.clearSuccess","Cleared successfully"),"success"),L(!1),z(null)}catch{q(e("toast.clearFailed","Failed to clear data"),"error")}finally{J(!1)}};return t.jsxs("div",{className:s.page,children:[t.jsx(ia,{title:e("page.playtest.title","Playtest"),description:e("page.playtest.description","Review automated playtest runs, saved reports, and result history."),helpTopicId:"playtest",helpState:{tier:d},actions:t.jsx(la,{ref:$,type:"button",variant:"secondary",size:"sm",onClick:()=>W(!0),children:e("playtest.guide.open","Before publishing")})}),!c&&t.jsx(oa,{surface:"playtest",selectable:!0,selectedPlaceId:_,onSelectedPlaceIdChange:p=>{C(p),z(null),k.clearSelectedReport()}}),!c&&t.jsxs(t.Fragment,{children:[t.jsx($o,{value:V,onChange:p=>{R(p),Io(p)}}),t.jsx(Vo,{lease:f.lease,profileName:(fe=f.profile)==null?void 0:fe.name,studioState:K,studioMode:x.mode}),m&&t.jsx(na,{title:e("playtest.upgrade.title","Real-time Playtest controls are available with Pro"),description:e("playtest.upgrade.description","Basic includes test profiles and live runtime observation. Upgrade when you need to change values during Play."),benefits:[e("playtest.upgrade.benefit1","Change test values while Studio Play is running"),e("playtest.upgrade.benefit2","Reset every override to its original value"),e("playtest.upgrade.benefit3","Review actual saved automated test results instead of sample data")],upgradeLabel:e("tier.upgrade","View Pro"),upgradeHref:sa.playtest}),f.error&&t.jsx("div",{className:s.inlineError,role:"alert",children:f.error}),V==="live"&&t.jsx(rc,{live:f,inactiveReason:Q,onManageValues:()=>P(!0),onNewProfile:()=>{te(!1),w(!0)},onEditProfile:()=>{te(!0),w(!0)},directAddDisabledReason:le?void 0:e("playtest.controls.studioRequired","Connect Roblox Studio and WEPPY Plugin to change test values.")})]}),V==="results"&&t.jsxs("div",{className:s.card,role:"tabpanel","aria-label":e("playtest.view.testResults","Automated Test Results"),children:[t.jsxs("div",{className:s.cardHeader,children:[t.jsx(ra,{label:e("playtest.history.title","Test History"),tooltip:e("playtest.history.title.tooltip","Recorded automated playtest runs for this project.")}),m?t.jsx(it,{text:e("playtest.sample.clearDisabled","Available with Pro for live playtest history."),children:t.jsx("span",{children:t.jsx("button",{className:s.clearButton,disabled:!0,children:e("common.clear","Clear")})})}):t.jsx("button",{className:s.clearButton,onClick:()=>{i("dashboard_click_event",{click_target:"playtest_clear_history",page:"playtest"}),L(!0)},children:e("common.clear","Clear")})]}),(m||!Ne&&he==="ready"&&ce.length===0)&&t.jsx(Ut,{kind:"no-results",isBasic:m}),!m&&he==="error"&&ce.length===0&&t.jsxs("div",{className:s.inlineError,role:"alert",children:[t.jsx("span",{children:re??e("playtest.emptyResults.loadFailed","Could not load test results.")}),t.jsx("button",{type:"button",className:s.secondaryAction,onClick:()=>void k.retryHistory(),children:e("common.retry","Try again")})]}),Ne?t.jsx("div",{className:s.emptyState,children:e("common.loading","Loading...")}):ce.length===0?null:t.jsx(So,{entries:ce,onSelect:_e,selectedRecordId:O??void 0})]}),t.jsx(Ke,{open:E,ariaLabel:e("playtest.guide.title","Publishing your game after playtesting"),onClose:()=>W(!1),returnFocusTo:$.current,children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(ze,{title:e("playtest.guide.title","Publishing your game after playtesting"),description:e("playtest.guide.dialogDescription","Review what remains after testing and what to check before publishing."),closeLabel:e("common.close","Close"),onRequestClose:()=>W(!1)}),t.jsx("div",{className:s.detailBody,children:t.jsx(vc,{showHeading:!1,hasManagedAdapterWithoutStudioGuard:((Re=f.releaseGuidance)==null?void 0:Re.hasManagedAdapterWithoutStudioGuard)===!0})})]})}),t.jsx(Ke,{open:O!==null,ariaLabel:e("playtest.detail.dialogLabel","Playtest report detail"),onClose:xe,returnFocusTo:Z.current,testId:"playtest-detail-popup-layer",children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(ze,{title:e("playtest.report.title","Selected Report"),description:ve==null?void 0:ve.testName,closeLabel:e("common.close","Close"),onRequestClose:xe}),t.jsx("div",{className:s.detailBody,children:we?t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")}):H?t.jsxs("div",{className:s.detailState,role:"alert",children:[t.jsx("div",{className:s.detailErrorTitle,children:e("playtest.detail.errorTitle","Report unavailable")}),t.jsx("div",{className:s.detailErrorMessage,children:H}),t.jsx("button",{type:"button",className:s.detailRetryButton,onClick:()=>void k.retryReport(),children:e("common.retry","Retry")})]}):ie?t.jsx(Ao,{report:ie}):t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")})})]})}),!c&&t.jsxs(t.Fragment,{children:[!m&&t.jsx(mt,{open:U,title:e("playtest.clear.title","Clear test history?"),message:e("playtest.clear.message","This permanently removes the stored playtest reports for the current place."),cancelLabel:e("common.cancel","Cancel"),confirmLabel:e("common.clear","Clear"),loading:ae,onCancel:()=>!ae&&L(!1),onConfirm:Ce}),t.jsx(uc,{open:M,onClose:()=>w(!1),profile:ee?f.profile:null,onCreate:f.createProfile,onSave:f.saveProfile,onDelete:async(p,j)=>{const F=await f.deleteProfile(p,j);q(F.refreshFailed?e("playtest.profile.deleteRefreshFailed","Profile deleted. Reload the profile list to confirm the latest state."):e("playtest.profile.deleteSuccess","Profile deleted."),F.refreshFailed?"warning":"success")},onResolveSelection:f.resolveSelection,onResolveSelectionCandidates:f.resolveSelectionCandidates}),t.jsx(hc,{open:B,profile:f.profile,catalog:f.catalog,activeLease:!!f.lease,onClose:()=>P(!1),onSave:f.saveProfile,onCreateProfile:f.createProfile,onResolveSelectionCandidates:f.resolveSelectionCandidates})]})]})}export{Mc as Component};
122
+ }`;function yc(e){const{t:a}=ue();return t.jsxs("section",{className:s.deploymentGuide,"aria-label":a("playtest.guide.title"),children:[t.jsxs("header",{className:s.deploymentLifecycle,children:[e.showHeading!==!1&&t.jsx("h2",{children:a("playtest.guide.title")}),t.jsx("p",{children:a("playtest.guide.runtime")}),t.jsx("p",{children:a("playtest.guide.local")}),t.jsx("p",{children:a("playtest.guide.methodIntro")}),t.jsx("p",{children:a("playtest.guide.actionEffects")})]}),e.hasManagedAdapterWithoutStudioGuard&&t.jsxs("section",{className:s.deploymentNotice,children:[t.jsx("h3",{children:a("playtest.guide.studioGuardNoticeTitle")}),t.jsx("p",{children:a("playtest.guide.studioGuardNotice")})]}),t.jsxs("section",{className:s.deploymentChecklist,"aria-labelledby":"playtest-publish-checklist-title",children:[t.jsx("h3",{id:"playtest-publish-checklist-title",children:a("playtest.guide.checklistTitle")}),t.jsxs("ul",{children:[t.jsx("li",{children:a("playtest.guide.checklistTarget")}),t.jsx("li",{children:a("playtest.guide.checklistBehavior")})]})]}),t.jsxs("div",{className:s.deploymentScope,children:[t.jsxs("section",{className:s.deploymentLifecycle,children:[t.jsx("h3",{children:a("playtest.guide.excludeTitle")}),t.jsx("p",{children:a("playtest.guide.exclude")})]}),t.jsxs("section",{className:s.deploymentLifecycle,children:[t.jsx("h3",{children:a("playtest.guide.conditionalDataTitle")}),t.jsx("p",{children:a("playtest.guide.checklistData")})]})]}),t.jsxs("section",{className:s.deploymentLifecycle,children:[t.jsx("h3",{children:a("playtest.guide.afterPublishTitle")}),t.jsx("p",{children:a("playtest.guide.final")})]}),t.jsxs("details",{className:s.deploymentDetails,children:[t.jsx("summary",{children:a("playtest.guide.studioTitle")}),t.jsx("p",{children:a("playtest.guide.include")}),t.jsx("p",{children:a("playtest.guide.studio")})]}),t.jsxs("details",{className:s.deploymentDetails,children:[t.jsx("summary",{children:a("playtest.guide.rojoTitle")}),t.jsx("p",{children:a("playtest.guide.rojo")}),t.jsx("pre",{children:hc}),t.jsx("p",{children:a("playtest.guide.rojoExample")})]}),t.jsxs("details",{className:s.deploymentDetails,children:[t.jsx("summary",{children:a("playtest.guide.dataTitle")}),t.jsx("p",{children:a("playtest.guide.data")})]}),t.jsx("p",{className:s.deploymentDescription,children:a("playtest.guide.description")})]})}function vc(e){return e.studioState==="running"?"Running":e.studioState==="paused"?"Paused":"Edit"}function gc(e,a){const n=((e==null?void 0:e.pluginClients)??[]).filter(d=>d.connectionState==="connected");let i;if(a!==null){const d=n.filter(c=>c.placeId===a);i=d.length===1?d[0]:void 0}else i=Yt(n,(e==null?void 0:e.studioRoutingMode)??"recentPriority",(e==null?void 0:e.pinnedTargetClientId)??null)[0];return i?{state:vc(i),targetClientId:i.clientId,...i.studioStateUpdatedAt!==void 0?{updatedAt:i.studioStateUpdatedAt}:{},...i.playtestMode!==void 0?{mode:i.playtestMode}:{}}:{state:"Edit",targetClientId:null}}function Lc(){var be,fe,Re;const{t:e}=ue(),a=Qt(),n=Xt(),{trackEvent:i}=Zt(),{tier:d,loading:c}=ea(),{level:u,status:y}=ta(),m=!c&&d==="basic",[_,C]=o.useState(null),k=Oa({enabled:!m,placeId:_}),x=gc(y,_),f=Lo({enabled:!c&&u==="studioConnected",canMutate:!m,placeId:_,studioSnapshot:x}),[V,R]=o.useState(Eo),[M,w]=o.useState(!1),[B,P]=o.useState(!1),[E,W]=o.useState(!1),$=o.useRef(null),[ee,te]=o.useState(!1),{show:q}=aa(),[O,z]=o.useState(null),[U,L]=o.useState(!1),[ae,J]=o.useState(!1);o.useEffect(()=>{const p=new URLSearchParams(a.search);if(p.get("add")!=="value")return;R("live"),P(!0),p.delete("add");const j=p.toString();n(`${a.pathname}${j?`?${j}`:""}${a.hash}`,{replace:!0})},[a.hash,a.pathname,a.search,n]);const le=u==="studioConnected",Q=le?f.profile?f.studioState==="Edit"?e("playtest.values.playRequired","Start Play or Run in Studio to change test values."):m?e("playtest.controls.proRequired","Real-time value editing and Reset all are available with Pro."):e("playtest.controls.connectingDescription","Preparing runtime controls for the selected profile…"):e("playtest.controls.profileRequired","Select or create a test profile to change values."):e("playtest.controls.studioRequired","Connect Roblox Studio and WEPPY Plugin to change test values."),K=le?f.studioState:"Disconnected",Z=o.useRef(null),{history:X,historyLoadState:he,historyError:re,selectedReport:oe,loading:ye,detailLoading:we,detailError:H}=k,se=m?Ba(e):null,ne=((be=se==null?void 0:se.history[0])==null?void 0:be.recordId)??null,ce=(se==null?void 0:se.history)??X,ie=se&&O===ne?se.report:oe,Ne=m?!1:ye,ve=ce.find(p=>p.recordId===O),_e=(p,j)=>{Z.current=j,z(p),!m&&k.loadReport(p)},xe=o.useCallback(()=>{z(null),k.clearSelectedReport()},[k.clearSelectedReport]),Ce=async()=>{J(!0);try{await k.clearHistory(),q(e("toast.clearSuccess","Cleared successfully"),"success"),L(!1),z(null)}catch{q(e("toast.clearFailed","Failed to clear data"),"error")}finally{J(!1)}};return t.jsxs("div",{className:s.page,children:[t.jsx(ia,{title:e("page.playtest.title","Playtest"),description:e("page.playtest.description","Review automated playtest runs, saved reports, and result history."),helpTopicId:"playtest",helpState:{tier:d},actions:t.jsx(la,{ref:$,type:"button",variant:"secondary",size:"sm",onClick:()=>W(!0),children:e("playtest.guide.open","Before publishing")})}),!c&&t.jsx(ca,{surface:"playtest",selectable:!0,selectedPlaceId:_,onSelectedPlaceIdChange:p=>{C(p),z(null),k.clearSelectedReport()}}),!c&&t.jsxs(t.Fragment,{children:[t.jsx(Mo,{value:V,onChange:p=>{R(p),Do(p)}}),t.jsx($o,{lease:f.lease,profileName:(fe=f.profile)==null?void 0:fe.name,studioState:K,studioMode:x.mode}),m&&t.jsx(na,{title:e("playtest.upgrade.title","Real-time Playtest controls are available with Pro"),description:e("playtest.upgrade.description","Basic includes test profiles and live runtime observation. Upgrade when you need to change values during Play."),benefits:[e("playtest.upgrade.benefit1","Change test values while Studio Play is running"),e("playtest.upgrade.benefit2","Reset every override to its original value"),e("playtest.upgrade.benefit3","Review actual saved automated test results instead of sample data")],upgradeLabel:e("tier.upgrade","View Pro"),upgradeHref:sa.playtest}),f.error&&t.jsx("div",{className:s.inlineError,role:"alert",children:f.error}),V==="live"&&t.jsx(lc,{live:f,inactiveReason:Q,onManageValues:()=>P(!0),onNewProfile:()=>{te(!1),w(!0)},onEditProfile:()=>{te(!0),w(!0)},directAddDisabledReason:le?void 0:e("playtest.controls.studioRequired","Connect Roblox Studio and WEPPY Plugin to change test values.")})]}),V==="results"&&t.jsxs("div",{className:s.card,role:"tabpanel","aria-label":e("playtest.view.testResults","Automated Test Results"),children:[t.jsxs("div",{className:s.cardHeader,children:[t.jsx(ra,{label:e("playtest.history.title","Test History"),tooltip:e("playtest.history.title.tooltip","Recorded automated playtest runs for this project.")}),m?t.jsx(it,{text:e("playtest.sample.clearDisabled","Available with Pro for live playtest history."),children:t.jsx("span",{children:t.jsx("button",{className:s.clearButton,disabled:!0,children:e("common.clear","Clear")})})}):t.jsx("button",{className:s.clearButton,onClick:()=>{i("dashboard_click_event",{click_target:"playtest_clear_history",page:"playtest"}),L(!0)},children:e("common.clear","Clear")})]}),(m||!Ne&&he==="ready"&&ce.length===0)&&t.jsx(Ut,{kind:"no-results",isBasic:m}),!m&&he==="error"&&ce.length===0&&t.jsxs("div",{className:s.inlineError,role:"alert",children:[t.jsx("span",{children:re??e("playtest.emptyResults.loadFailed","Could not load test results.")}),t.jsx("button",{type:"button",className:s.secondaryAction,onClick:()=>void k.retryHistory(),children:e("common.retry","Try again")})]}),Ne?t.jsx("div",{className:s.emptyState,children:e("common.loading","Loading...")}):ce.length===0?null:t.jsx(jo,{entries:ce,onSelect:_e,selectedRecordId:O??void 0})]}),t.jsx(Ke,{open:E,ariaLabel:e("playtest.guide.title","Publishing your game after playtesting"),onClose:()=>W(!1),returnFocusTo:$.current,children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(ze,{title:e("playtest.guide.title","Publishing your game after playtesting"),description:e("playtest.guide.dialogDescription","Review what remains after testing and what to check before publishing."),closeLabel:e("common.close","Close"),onRequestClose:()=>W(!1)}),t.jsx("div",{className:s.detailBody,children:t.jsx(yc,{showHeading:!1,hasManagedAdapterWithoutStudioGuard:((Re=f.releaseGuidance)==null?void 0:Re.hasManagedAdapterWithoutStudioGuard)===!0})})]})}),t.jsx(Ke,{open:O!==null,ariaLabel:e("playtest.detail.dialogLabel","Playtest report detail"),onClose:xe,returnFocusTo:Z.current,testId:"playtest-detail-popup-layer",children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(ze,{title:e("playtest.report.title","Selected Report"),description:ve==null?void 0:ve.testName,closeLabel:e("common.close","Close"),onRequestClose:xe}),t.jsx("div",{className:s.detailBody,children:we?t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")}):H?t.jsxs("div",{className:s.detailState,role:"alert",children:[t.jsx("div",{className:s.detailErrorTitle,children:e("playtest.detail.errorTitle","Report unavailable")}),t.jsx("div",{className:s.detailErrorMessage,children:H}),t.jsx("button",{type:"button",className:s.detailRetryButton,onClick:()=>void k.retryReport(),children:e("common.retry","Retry")})]}):ie?t.jsx(ko,{report:ie}):t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")})})]})}),!c&&t.jsxs(t.Fragment,{children:[!m&&t.jsx(mt,{open:U,title:e("playtest.clear.title","Clear test history?"),message:e("playtest.clear.message","This permanently removes the stored playtest reports for the current place."),cancelLabel:e("common.cancel","Cancel"),confirmLabel:e("common.clear","Clear"),loading:ae,onCancel:()=>!ae&&L(!1),onConfirm:Ce}),t.jsx(dc,{open:M,onClose:()=>w(!1),profile:ee?f.profile:null,onCreate:f.createProfile,onSave:f.saveProfile,onDelete:async(p,j)=>{const F=await f.deleteProfile(p,j);q(F.refreshFailed?e("playtest.profile.deleteRefreshFailed","Profile deleted. Reload the profile list to confirm the latest state."):e("playtest.profile.deleteSuccess","Profile deleted."),F.refreshFailed?"warning":"success")},onResolveSelection:f.resolveSelection,onResolveSelectionCandidates:f.resolveSelectionCandidates}),t.jsx(mc,{open:B,profile:f.profile,catalog:f.catalog,activeLease:!!f.lease,onClose:()=>P(!1),onSave:f.saveProfile,onCreateProfile:f.createProfile,onResolveSelectionCandidates:f.resolveSelectionCandidates})]})]})}export{Lc as Component};