@weppy/roblox-mcp 2.17.0 → 2.17.2

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 (47) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dashboard/dist/assets/AiPromptExamples-CJjCcxg8.js +1 -0
  3. package/dashboard/dist/assets/AiPromptExamples-DvVR2a1g.css +1 -0
  4. package/dashboard/dist/assets/AssetsPage-DTiyyQxl.js +61 -0
  5. package/dashboard/dist/assets/AssetsPage-DX8NUPQo.css +1 -0
  6. package/dashboard/dist/assets/{ChangelogPage-DXZxXvJY.js → ChangelogPage-DuuVSnIa.js} +1 -1
  7. package/dashboard/dist/assets/{ConfirmModal-CQhMb2gs.js → ConfirmModal-DaOuVA6n.js} +1 -1
  8. package/dashboard/dist/assets/{ConnectionPage-Bk4HeU0-.js → ConnectionPage-BIq2TqY_.js} +2 -7
  9. package/dashboard/dist/assets/{ControlsPage-jEHyFrVc.js → ControlsPage-DqEbayDU.js} +1 -1
  10. package/dashboard/dist/assets/{CurrentPlaceScope-B60o8hpn.js → CurrentPlaceScope-p_fkZWK9.js} +1 -1
  11. package/dashboard/dist/assets/{GameChangeDetail-B5X_6M-R.js → GameChangeDetail-BOp_DXQ9.js} +1 -1
  12. package/dashboard/dist/assets/{InfoLabel-csGVLmJ3.js → InfoLabel-gl5i0JQy.js} +1 -1
  13. package/dashboard/dist/assets/{OverviewPage-B2_8B6fs.js → OverviewPage-DcQz5h3p.js} +1 -1
  14. package/dashboard/dist/assets/{PageHeader-B42Je0MJ.js → PageHeader-BkXyqPrA.js} +1 -1
  15. package/dashboard/dist/assets/PlaytestAiPromptExamples-Ciyd-GNB.js +1 -0
  16. package/dashboard/dist/assets/PlaytestPage-C3Vjgtlg.css +1 -0
  17. package/dashboard/dist/assets/PlaytestPage-CoclFxfc.js +127 -0
  18. package/dashboard/dist/assets/{SettingsPage-eLuRrn1E.js → SettingsPage-BC0XIU-3.js} +1 -1
  19. package/dashboard/dist/assets/{StatusBadge-Ct9C2L71.js → StatusBadge-BQsRd8hv.js} +1 -1
  20. package/dashboard/dist/assets/{SyncPage-CKbsNp8O.js → SyncPage-DF2YdMPy.js} +1 -1
  21. package/dashboard/dist/assets/{Tabs-Dos9flTe.js → Tabs-Dy5daI-F.js} +1 -1
  22. package/dashboard/dist/assets/{TierPromoPanel-Ci_piK2n.js → TierPromoPanel-nA1RBcJp.js} +1 -1
  23. package/dashboard/dist/assets/{ToolsPage-mfcba-cj.js → ToolsPage-DSsqmlnt.js} +1 -1
  24. package/dashboard/dist/assets/{TooltipText-EK4_jbu2.js → TooltipText-BEK9VoiS.js} +1 -1
  25. package/dashboard/dist/assets/UiStudioPage-CiRNdRE-.js +11 -0
  26. package/dashboard/dist/assets/{UiStudioPage-CSK5gQMN.css → UiStudioPage-DdLVbHdA.css} +1 -1
  27. package/dashboard/dist/assets/WhatsNewPage-DX9G9ZFd.js +1 -0
  28. package/dashboard/dist/assets/WhatsNewPage-WMbbAUsL.css +1 -0
  29. package/dashboard/dist/assets/bot-B06rJuWg.js +6 -0
  30. package/dashboard/dist/assets/{check-BgcyMSc_.js → check-CZ_wdz7l.js} +1 -1
  31. package/dashboard/dist/assets/{copy-BJc7IQHD.js → copy-CGFMtAPH.js} +1 -1
  32. package/dashboard/dist/assets/{index-89-Xnii6.js → index-Hgv8iCTe.js} +55 -55
  33. package/dashboard/dist/assets/{sample-requests-DOteSh1j.js → sample-requests-DafsjfJi.js} +1 -1
  34. package/dashboard/dist/assets/{trash-2-CeZRGbl-.js → trash-2-DMQtyT_y.js} +1 -1
  35. package/dashboard/dist/assets/{useLiveUptime-BX-d0MHY.js → useLiveUptime-C6MCUOz0.js} +1 -1
  36. package/dashboard/dist/assets/{useSettings-B45j17ns.js → useSettings-DfLxtt-w.js} +1 -1
  37. package/dashboard/dist/index.html +1 -1
  38. package/dist/index.js +136 -136
  39. package/package.json +1 -1
  40. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  41. package/dashboard/dist/assets/AssetsPage-BRZSoLQp.css +0 -1
  42. package/dashboard/dist/assets/AssetsPage-FecplRby.js +0 -56
  43. package/dashboard/dist/assets/PlaytestPage-B89cLi76.css +0 -1
  44. package/dashboard/dist/assets/PlaytestPage-Cww1uTQ8.js +0 -122
  45. package/dashboard/dist/assets/UiStudioPage-Y2PR7h_q.js +0 -11
  46. package/dashboard/dist/assets/WhatsNewPage-BsVZv6D8.css +0 -1
  47. package/dashboard/dist/assets/WhatsNewPage-uAPdDJaM.js +0 -1
@@ -1,122 +0,0 @@
1
- import{f as Re,j as t,X as Nt,r,b as Ce,u as ye,D as Lt,p as Dt,k as It,s as Mt,c as $t,a as Vt,e as Bt,d as Ot,i as Ft,T as Gt}from"./index-89-Xnii6.js";import{T as Ht}from"./TierPromoPanel-Ci_piK2n.js";import{P as qt,a as Ut}from"./PageHeader-B42Je0MJ.js";import{I as Kt}from"./InfoLabel-csGVLmJ3.js";import{C as Wt}from"./CurrentPlaceScope-B60o8hpn.js";import{T as ze}from"./TooltipText-EK4_jbu2.js";import{C as wt}from"./ConfirmModal-CQhMb2gs.js";import{T as zt,C as Fe}from"./Tabs-Dos9flTe.js";import{T as Jt}from"./trash-2-CeZRGbl-.js";import{C as Yt}from"./check-BgcyMSc_.js";import"./ConfirmModal.module-DJksQHBd.js";/**
2
- * @license lucide-react v1.8.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Qt=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Xt=Re("arrow-down",Qt);/**
7
- * @license lucide-react v1.8.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Zt=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ea=Re("arrow-up",Zt);/**
12
- * @license lucide-react v1.8.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const ta=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rt=Re("chevron-down",ta);/**
17
- * @license lucide-react v1.8.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const aa=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yt=Re("chevron-up",aa);/**
22
- * @license lucide-react v1.8.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const sa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],na=Re("circle-dot",sa);/**
27
- * @license lucide-react v1.8.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const la=[["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"}]],mt=Re("grip-vertical",la);/**
32
- * @license lucide-react v1.8.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const ia=[["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"}]],ra=Re("list-plus",ia);/**
37
- * @license lucide-react v1.8.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const oa=[["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"}]],ca=Re("lock-keyhole",oa);/**
42
- * @license lucide-react v1.8.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const da=[["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"}]],ua=Re("pencil",da);/**
47
- * @license lucide-react v1.8.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const pa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ct=Re("plus",pa);/**
52
- * @license lucide-react v1.8.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const ya=[["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"}]],ma=Re("rotate-ccw",ya);/**
57
- * @license lucide-react v1.8.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const va=[["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"}]],ha=Re("triangle-alert",va),fa="_header_6e369_1",ga="_copy_6e369_16",xa="_close_6e369_39",Qe={header:fa,copy:ga,close:xa};function Ge(e){return t.jsxs("header",{className:Qe.header,children:[t.jsxs("div",{className:Qe.copy,children:[t.jsx("h2",{children:e.title}),e.description&&t.jsx("p",{children:e.description})]}),t.jsx("button",{type:"button",className:Qe.close,"aria-label":e.closeLabel,disabled:e.closeDisabled,onClick:e.onRequestClose,children:t.jsx(Nt,{size:18,"aria-hidden":"true"})})]})}const ba=5e3;function vt(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 ja(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 Sa(e){return e instanceof Error?e.message:String(e)}function Na(e){const a=(e==null?void 0:e.enabled)??!0,i=(e==null?void 0:e.placeId)??null,[n,o]=r.useState([]),[p,c]=r.useState(null),[h,f]=r.useState(a),[g,w]=r.useState(!1),[N,b]=r.useState(null),_=r.useRef(null),E=r.useRef(0),y=r.useRef(null),T=r.useCallback(async()=>{try{const A=vt(i),I=A?await Ce.get("/api/dashboard/playtest/history",A):await Ce.get("/api/dashboard/playtest/history");o(I.entries??[])}catch{}},[i]),F=r.useCallback(async()=>{if(!a){f(!1);return}await T(),f(!1)},[a,T]),L=r.useCallback(()=>{E.current+=1,y.current=null,c(null),w(!1),b(null)},[]);r.useEffect(()=>{L()},[L,a,i]);const P=r.useCallback(async A=>{if(!a)return;y.current=A;const I=++E.current;c(null),w(!0),b(null);try{const J=vt(i),G=`/api/dashboard/playtest/detail/${encodeURIComponent(A)}`,D=J?await Ce.get(G,J):await Ce.get(G);I===E.current&&c(ja(D))}catch(J){I===E.current&&b(Sa(J))}finally{I===E.current&&w(!1)}},[a,i]),k=r.useCallback(async()=>{const A=y.current;A&&await P(A)},[P]),$=r.useCallback(async()=>{a&&(await Ce.post(_a("/api/dashboard/playtest/history/clear",i)),o([]),L())},[L,a,i]);return r.useEffect(()=>{if(!a){f(!1);return}return F(),_.current=setInterval(F,ba),()=>{_.current&&clearInterval(_.current)}},[a,F]),{history:n,selectedReport:p,loading:h,detailLoading:g,detailError:N,loadReport:P,retryReport:k,clearSelectedReport:L,clearHistory:$}}function wa(e){const a="2026-03-27T15:26:00.000Z",i={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:i,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
62
-
63
- - Spawn flow: PASS
64
- - HUD countdown: PASS
65
- - Wave bootstrap: PASS
66
-
67
- This is a sample preview. Live playtests and real reports are available with Pro.`),logs:e("playtest.sample.report.logs",`[sample] boot playtest preview
68
- [sample] spawn protection active
69
- [sample] hud countdown rendered
70
- [sample] wave one completed
71
- [sample] preview report finished`),contextId:"sample_playtest_preview",contextSummary:i,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 De(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 dt(e){return e==="passed"?"✓":e==="failed"||e==="timed_out"?"×":e==="cancelled"||e==="insufficient_evidence"||e==="unavailable"?"!":"–"}function Rt(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Ke(e){return JSON.stringify(e,null,2)}function Pt(e,a,i){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."):i}function Ca(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 Ra="_page_65x67_2",Pa="_sampleBanner_65x67_10",ka="_sampleBannerRow_65x67_22",Aa="_sampleBannerMain_65x67_29",Ea="_sampleBadge_65x67_36",Ta="_sampleTitle_65x67_51",La="_sampleMessage_65x67_58",Da="_sampleActions_65x67_65",Ia="_primaryAction_65x67_73",Ma="_secondaryAction_65x67_74",$a="_resetAction_65x67_75",Va="_card_65x67_124",Ba="_cardHeader_65x67_131",Oa="_clearButton_65x67_144",Fa="_statusRow_65x67_173",Ga="_statusIndicator_65x67_180",Ha="_statusRunning_65x67_188",qa="_statusPaused_65x67_193",Ua="_statusNotRunning_65x67_197",Ka="_statusLabel_65x67_201",Wa="_statusMeta_65x67_208",za="_controlButtons_65x67_214",Ja="_btn_65x67_221",Ya="_btnPrimary_65x67_243",Qa="_btnDanger_65x67_253",Xa="_historyList_65x67_265",Za="_historyItem_65x67_271",es="_stepDisclosure_65x67_291",ts="_historyItemSelected_65x67_296",as="_historyItemHeader_65x67_301",ss="_historyIcon_65x67_307",ns="_historyTimestamp_65x67_312",ls="_historyName_65x67_319",is="_recordKind_65x67_330",rs="_historyItemMeta_65x67_344",os="_historyMode_65x67_354",cs="_historyDuration_65x67_358",ds="_historyStatus_65x67_362",us="_status_passed_65x67_369",ps="_status_failed_65x67_373",ys="_status_running_65x67_377",ms="_status_timed_out_65x67_381",vs="_status_cancelled_65x67_385",hs="_status_insufficient_evidence_65x67_386",fs="_historyError_65x67_390",gs="_historyEvidence_65x67_400",xs="_historyLimitation_65x67_410",bs="_detailShell_65x67_421",_s="_detailHeader_65x67_429",js="_detailHeading_65x67_440",Ss="_detailRecordName_65x67_451",Ns="_detailCloseButton_65x67_460",ws="_detailRetryButton_65x67_480",Cs="_detailBody_65x67_485",Rs="_detailState_65x67_494",Ps="_detailErrorTitle_65x67_505",ks="_detailErrorMessage_65x67_512",As="_reportContainer_65x67_534",Es="_runSummary_65x67_540",Ts="_viewerSection_65x67_541",Ls="_summaryLead_65x67_554",Ds="_summaryStatusMark_65x67_560",Is="_viewerHeading_65x67_573",Ms="_summaryName_65x67_583",$s="_summaryReason_65x67_594",Vs="_summaryFacts_65x67_601",Bs="_subsectionLabel_65x67_614",Os="_sectionHeadingRow_65x67_629",Fs="_sectionHint_65x67_637",Gs="_dimensionGrid_65x67_642",Hs="_dimensionCard_65x67_649",qs="_dimensionHeader_65x67_657",Us="_statusMark_65x67_663",Ks="_dimensionName_65x67_676",Ws="_requirementBadge_65x67_686",zs="_dimensionStatus_65x67_694",Js="_dimensionMeta_65x67_701",Ys="_tone_passed_65x67_709",Qs="_tone_failed_65x67_710",Xs="_tone_timed_out_65x67_711",Zs="_tone_cancelled_65x67_712",en="_tone_insufficient_evidence_65x67_713",tn="_tone_unavailable_65x67_714",an="_tone_skipped_65x67_715",sn="_tone_not_requested_65x67_716",nn="_stepList_65x67_718",ln="_stepItem_65x67_725",rn="_stepIndex_65x67_749",on="_stepIdentity_65x67_756",cn="_stepName_65x67_763",dn="_stepMeta_65x67_773",un="_stepStatus_65x67_774",pn="_chevron_65x67_782",yn="_chevronOpen_65x67_788",mn="_stepDetails_65x67_790",vn="_evidenceBlock_65x67_799",hn="_evidenceLabel_65x67_803",fn="_stepError_65x67_830",gn="_recordProblem_65x67_831",xn="_capabilityGrid_65x67_846",bn="_capabilityItem_65x67_853",_n="_capabilityYes_65x67_866",jn="_capabilityNo_65x67_867",Sn="_capabilityState_65x67_868",Nn="_limitations_65x67_870",wn="_artifactList_65x67_871",Cn="_agentList_65x67_872",Rn="_artifactDisclosures_65x67_889",Pn="_artifactDisclosure_65x67_889",kn="_artifactButton_65x67_903",An="_artifactContent_65x67_928",En="_limitationItem_65x67_948",Tn="_reportContextPanel_65x67_965",Ln="_reportContextRow_65x67_975",Dn="_reportContextLabel_65x67_983",In="_reportSection_65x67_991",Mn="_reportSectionHeader_65x67_997",$n="_reportMarkdown_65x67_1009",Vn="_reportLogs_65x67_1022",Bn="_emptyState_65x67_1037",On="_emptyStateTitle_65x67_1044",Fn="_emptyStateMessage_65x67_1052",Gn="_upgradePanel_65x67_1061",Hn="_upgradePanelIcon_65x67_1069",qn="_upgradePanelTitle_65x67_1074",Un="_upgradePanelDesc_65x67_1082",Kn="_benefitList_65x67_1092",Wn="_benefitItem_65x67_1103",zn="_upgradeActions_65x67_1118",Jn="_workspaceTabs_65x67_1124",Yn="_sessionHelp_65x67_1137",Qn="_stopAction_65x67_1143",Xn="_controlEditor_65x67_1144",Zn="_profileToolbar_65x67_1146",el="_profileDialog_65x67_1147",tl="_sessionBar_65x67_1152",al="_sessionIdentity_65x67_1165",sl="_sessionActions_65x67_1195",nl="_profileActions_65x67_1196",ll="_profileDialogActions_65x67_1197",il="_liveWorkspace_65x67_1238",rl="_profileLabelRow_65x67_1254",ol="_profileHint_65x67_1262",cl="_actualValue_65x67_1271",dl="_watchReading_65x67_1272",ul="_liveGrid_65x67_1308",pl="_livePanel_65x67_1315",yl="_panelEmpty_65x67_1352",ml="_controlAvailability_65x67_1358",vl="_controlGate_65x67_1361",hl="_controlGateTrigger_65x67_1364",fl="_controlGateHint_65x67_1366",gl="_editorLabel_65x67_1367",xl="_editorHeading_65x67_1368",bl="_savedValueState_65x67_1369",_l="_valueToolbar_65x67_1373",jl="_valueFilters_65x67_1383",Sl="_valuePagination_65x67_1390",Nl="_valueListStatus_65x67_1391",wl="_valueCount_65x67_1392",Cl="_layoutHint_65x67_1394",Rl="_srOnly_65x67_1395",Pl="_unifiedValueRows_65x67_1396",kl="_liveRows_65x67_1397",Al="_watchRows_65x67_1397",El="_valueGroup_65x67_1398",Tl="_valueGroupToggle_65x67_1400",Ll="_valueGroupRows_65x67_1406",Dl="_controlRow_65x67_1406",Il="_watchRow_65x67_1397",Ml="_historyBrowser_65x67_1411",$l="_historyToolbar_65x67_1412",Vl="_rowIdentity_65x67_1436",Bl="_freshness_65x67_1439",Ol="_presentationMeta_65x67_1460",Fl="_rowFeedback_65x67_1461",Gl="_controlEditorRow_65x67_1467",Hl="_controlActions_65x67_1468",ql="_applyOnStartOption_65x67_1471",Ul="_valueDetails_65x67_1473",Kl="_valueDetailButton_65x67_1479",Wl="_valueDetailShell_65x67_1482",zl="_valueDetailBody_65x67_1483",Jl="_valueDetailList_65x67_1484",Yl="_valueDetailActions_65x67_1488",Ql="_valueDetailFeedback_65x67_1489",Xl="_defaultValueEditor_65x67_1492",Zl="_defaultBooleanEditor_65x67_1496",ei="_booleanEditor_65x67_1499",ti="_rangeEditor_65x67_1508",ai="_valueWorkspacePanel_65x67_1523",si="_valueWorkspaceHeader_65x67_1524",ni="_valueSections_65x67_1525",li="_valueSection_65x67_1525",ii="_valueSectionHeader_65x67_1527",ri="_valueSectionHeading_65x67_1528",oi="_valueSectionCount_65x67_1530",ci="_valueSectionHeaderActions_65x67_1531",di="_sectionDragHandle_65x67_1532",ui="_sectionMoveButton_65x67_1533",pi="_valueReorderControls_65x67_1534",yi="_dragHandle_65x67_1536",mi="_runtimeSettings_65x67_1548",vi="_runtimeApplyMode_65x67_1549",hi="_runtimeDefaultOption_65x67_1556",fi="_layoutError_65x67_1562",gi="_controlValueList_65x67_1563",xi="_watchValueGrid_65x67_1564",bi="_valueEntryShell_65x67_1565",_i="_watchCardMain_65x67_1577",ji="_watchDetails_65x67_1584",Si="_deploymentGuide_65x67_1616",Ni="_deploymentScope_65x67_1628",wi="_deploymentLifecycle_65x67_1631",Ci="_deploymentNotice_65x67_1632",Ri="_deploymentChecklist_65x67_1634",Pi="_deploymentDescription_65x67_1638",ki="_deploymentDetails_65x67_1641",Ai="_inlineError_65x67_1661",Ei="_profileEditorDialog_65x67_1664",Ti="_profileDialogBody_65x67_1665",Li="_bindingTabs_65x67_1668",Di="_bindingList_65x67_1672",Ii="_bindingEmpty_65x67_1673",Mi="_bindingItem_65x67_1674",$i="_bindingItemCopy_65x67_1679",Vi="_bindingPresentation_65x67_1680",Bi="_bindingPin_65x67_1683",Oi="_bindingItemActions_65x67_1685",Fi="_bindingDelete_65x67_1689",Gi="_addBindingButton_65x67_1691",Hi="_bindingForm_65x67_1692",qi="_bindingFormGrid_65x67_1693",Ui="_bindingBooleanDefault_65x67_1696",Ki="_bindingPathField_65x67_1698",Wi="_rangeFields_65x67_1699",zi="_selectionButton_65x67_1700",Ji="_bindingFormActions_65x67_1701",Yi="_bindingError_65x67_1702",Qi="_valueManagerShell_65x67_1703",Xi="_valueSourceTabs_65x67_1704",Zi="_valueManagerBody_65x67_1708",er="_valueSourcePanel_65x67_1709",tr="_registeredIntro_65x67_1710",ar="_registeredEmpty_65x67_1714",sr="_registeredSteps_65x67_1717",nr="_registeredEmptyActions_65x67_1720",lr="_adapterSetupList_65x67_1725",ir="_adapterSetupRow_65x67_1729",rr="_adapterMethods_65x67_1736",or="_connectionGuide_65x67_1737",cr="_registrationGuide_65x67_1740",dr="_adapterSetupContext_65x67_1741",ur="_valueSearch_65x67_1742",pr="_firstProfileName_65x67_1743",yr="_sourceIntro_65x67_1747",mr="_catalogGroups_65x67_1751",vr="_catalogRow_65x67_1752",hr="_candidateActions_65x67_1760",fr="_candidateEntry_65x67_1762",gr="_propertySelection_65x67_1763",xr="_propertySelectionHeader_65x67_1764",br="_selectedInstance_65x67_1765",_r="_propertyPickerLabel_65x67_1766",jr="_propertyPicker_65x67_1766",Sr="_propertyPickerTrigger_65x67_1772",Nr="_propertyPickerPanel_65x67_1774",wr="_propertyPickerSearchRow_65x67_1776",Cr="_propertyPickerList_65x67_1780",Rr="_propertyPickerGroup_65x67_1782",Pr="_propertyPickerOption_65x67_1785",kr="_compoundEditor_65x67_1791",Ar="_compoundCoordinates_65x67_1792",Er="_colorSwatch_65x67_1799",Tr="_candidateAction_65x67_1760",Lr="_candidateActionSizer_65x67_1816",Dr="_candidateError_65x67_1820",Ir="_valueManagerFooter_65x67_1822",Mr="_catalogDetails_65x67_1823",$r="_inlineNotice_65x67_1832",Vr="_subscriptionUsage_65x67_1833",Br="_pendingProfileAction_65x67_1834",Or="_registrationExample_65x67_1839",Fr="_registrationActions_65x67_1842",s={page:Ra,sampleBanner:Pa,sampleBannerRow:ka,sampleBannerMain:Aa,sampleBadge:Ea,sampleTitle:Ta,sampleMessage:La,sampleActions:Da,primaryAction:Ia,secondaryAction:Ma,resetAction:$a,card:Va,cardHeader:Ba,clearButton:Oa,statusRow:Fa,statusIndicator:Ga,statusRunning:Ha,statusPaused:qa,statusNotRunning:Ua,statusLabel:Ka,statusMeta:Wa,controlButtons:za,btn:Ja,btnPrimary:Ya,btnDanger:Qa,historyList:Xa,historyItem:Za,stepDisclosure:es,historyItemSelected:ts,historyItemHeader:as,historyIcon:ss,historyTimestamp:ns,historyName:ls,recordKind:is,historyItemMeta:rs,historyMode:os,historyDuration:cs,historyStatus:ds,status_passed:us,status_failed:ps,status_running:ys,status_timed_out:ms,status_cancelled:vs,status_insufficient_evidence:hs,historyError:fs,historyEvidence:gs,historyLimitation:xs,detailShell:bs,detailHeader:_s,detailHeading:js,detailRecordName:Ss,detailCloseButton:Ns,detailRetryButton:ws,detailBody:Cs,detailState:Rs,detailErrorTitle:Ps,detailErrorMessage:ks,reportContainer:As,runSummary:Es,viewerSection:Ts,summaryLead:Ls,summaryStatusMark:Ds,viewerHeading:Is,summaryName:Ms,summaryReason:$s,summaryFacts:Vs,subsectionLabel:Bs,sectionHeadingRow:Os,sectionHint:Fs,dimensionGrid:Gs,dimensionCard:Hs,dimensionHeader:qs,statusMark:Us,dimensionName:Ks,requirementBadge:Ws,dimensionStatus:zs,dimensionMeta:Js,tone_passed:Ys,tone_failed:Qs,tone_timed_out:Xs,tone_cancelled:Zs,tone_insufficient_evidence:en,tone_unavailable:tn,tone_skipped:an,tone_not_requested:sn,stepList:nn,stepItem:ln,stepIndex:rn,stepIdentity:on,stepName:cn,stepMeta:dn,stepStatus:un,chevron:pn,chevronOpen:yn,stepDetails:mn,evidenceBlock:vn,evidenceLabel:hn,stepError:fn,recordProblem:gn,capabilityGrid:xn,capabilityItem:bn,capabilityYes:_n,capabilityNo:jn,capabilityState:Sn,limitations:Nn,artifactList:wn,agentList:Cn,artifactDisclosures:Rn,artifactDisclosure:Pn,artifactButton:kn,artifactContent:An,limitationItem:En,reportContextPanel:Tn,reportContextRow:Ln,reportContextLabel:Dn,reportSection:In,reportSectionHeader:Mn,reportMarkdown:$n,reportLogs:Vn,emptyState:Bn,emptyStateTitle:On,emptyStateMessage:Fn,upgradePanel:Gn,upgradePanelIcon:Hn,upgradePanelTitle:qn,upgradePanelDesc:Un,benefitList:Kn,benefitItem:Wn,upgradeActions:zn,workspaceTabs:Jn,sessionHelp:Yn,stopAction:Qn,controlEditor:Xn,profileToolbar:Zn,profileDialog:el,sessionBar:tl,sessionIdentity:al,sessionActions:sl,profileActions:nl,profileDialogActions:ll,liveWorkspace:il,profileLabelRow:rl,profileHint:ol,actualValue:cl,watchReading:dl,liveGrid:ul,livePanel:pl,panelEmpty:yl,controlAvailability:ml,controlGate:vl,controlGateTrigger:hl,controlGateHint:fl,editorLabel:gl,editorHeading:xl,savedValueState:bl,valueToolbar:_l,valueFilters:jl,valuePagination:Sl,valueListStatus:Nl,valueCount:wl,layoutHint:Cl,srOnly:Rl,unifiedValueRows:Pl,liveRows:kl,watchRows:Al,valueGroup:El,valueGroupToggle:Tl,valueGroupRows:Ll,controlRow:Dl,watchRow:Il,historyBrowser:Ml,historyToolbar:$l,rowIdentity:Vl,freshness:Bl,presentationMeta:Ol,rowFeedback:Fl,controlEditorRow:Gl,controlActions:Hl,applyOnStartOption:ql,valueDetails:Ul,valueDetailButton:Kl,valueDetailShell:Wl,valueDetailBody:zl,valueDetailList:Jl,valueDetailActions:Yl,valueDetailFeedback:Ql,defaultValueEditor:Xl,defaultBooleanEditor:Zl,booleanEditor:ei,rangeEditor:ti,valueWorkspacePanel:ai,valueWorkspaceHeader:si,valueSections:ni,valueSection:li,valueSectionHeader:ii,valueSectionHeading:ri,valueSectionCount:oi,valueSectionHeaderActions:ci,sectionDragHandle:di,sectionMoveButton:ui,valueReorderControls:pi,dragHandle:yi,runtimeSettings:mi,runtimeApplyMode:vi,runtimeDefaultOption:hi,layoutError:fi,controlValueList:gi,watchValueGrid:xi,valueEntryShell:bi,watchCardMain:_i,watchDetails:ji,deploymentGuide:Si,deploymentScope:Ni,deploymentLifecycle:wi,deploymentNotice:Ci,deploymentChecklist:Ri,deploymentDescription:Pi,deploymentDetails:ki,inlineError:Ai,profileEditorDialog:Ei,profileDialogBody:Ti,bindingTabs:Li,bindingList:Di,bindingEmpty:Ii,bindingItem:Mi,bindingItemCopy:$i,bindingPresentation:Vi,bindingPin:Bi,bindingItemActions:Oi,bindingDelete:Fi,addBindingButton:Gi,bindingForm:Hi,bindingFormGrid:qi,bindingBooleanDefault:Ui,bindingPathField:Ki,rangeFields:Wi,selectionButton:zi,bindingFormActions:Ji,bindingError:Yi,valueManagerShell:Qi,valueSourceTabs:Xi,valueManagerBody:Zi,valueSourcePanel:er,registeredIntro:tr,registeredEmpty:ar,registeredSteps:sr,registeredEmptyActions:nr,adapterSetupList:lr,adapterSetupRow:ir,adapterMethods:rr,connectionGuide:or,registrationGuide:cr,adapterSetupContext:dr,valueSearch:ur,firstProfileName:pr,sourceIntro:yr,catalogGroups:mr,catalogRow:vr,candidateActions:hr,candidateEntry:fr,propertySelection:gr,propertySelectionHeader:xr,selectedInstance:br,propertyPickerLabel:_r,propertyPicker:jr,propertyPickerTrigger:Sr,propertyPickerPanel:Nr,propertyPickerSearchRow:wr,propertyPickerList:Cr,propertyPickerGroup:Rr,propertyPickerOption:Pr,compoundEditor:kr,compoundCoordinates:Ar,colorSwatch:Er,candidateAction:Tr,candidateActionSizer:Lr,candidateError:Dr,valueManagerFooter:Ir,catalogDetails:Mr,inlineNotice:$r,subscriptionUsage:Vr,pendingProfileAction:Br,registrationExample:Or,registrationActions:Fr};function He(e){return e.trim().toLowerCase()}function Gr(e){switch(He(e)){case"passed":return"✓";case"failed":case"timed_out":return"×";case"running":return"◔";case"cancelled":case"insufficient_evidence":return"!";default:return"–"}}function Hr(e,a){switch(He(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 qr(e,a){const i=He(a);return i==="running"?e("playtest.history.status.running","Running"):De(e,i)}function Ur(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Kr(e){const a=/^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})$/.exec(e);if(a){const[,n,o,p,c,h,f]=a,g=new Date(Date.UTC(Number(n),Number(o)-1,Number(p),Number(c),Number(h),Number(f)));return g.getUTCFullYear()===Number(n)&&g.getUTCMonth()===Number(o)-1&&g.getUTCDate()===Number(p)&&g.getUTCHours()===Number(c)&&g.getUTCMinutes()===Number(h)&&g.getUTCSeconds()===Number(f)?g:null}const i=Date.parse(e);return Number.isNaN(i)?null:new Date(i)}function Wr(e,a){const i=Kr(e);return i?new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"short"}).format(i):e}function zr({entries:e,onSelect:a,selectedRecordId:i}){const{t:n,locale:o}=ye(),[p,c]=r.useState(""),[h,f]=r.useState("all"),[g,w]=r.useState(0),N=r.useMemo(()=>{const y=p.trim().toLocaleLowerCase();return e.filter(T=>(h==="all"||He(T.status)===h)&&(!y||[T.testName,T.status,T.mode,T.recordKind].join(" ").toLocaleLowerCase().includes(y)))},[e,p,h]),b=Math.max(1,Math.ceil(N.length/50)),_=Math.min(g,b-1),E=N.slice(_*50,(_+1)*50);return e.length===0?t.jsx("div",{className:s.emptyState,children:n("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:n("playtest.history.search","Search test results")}),t.jsx("input",{type:"search",value:p,onChange:y=>{c(y.target.value),w(0)}})]}),t.jsxs("label",{children:[t.jsx("span",{children:n("playtest.history.filter","Result")}),t.jsxs("select",{value:h,onChange:y=>{f(y.target.value),w(0)},children:[t.jsx("option",{value:"all",children:n("playtest.history.filterAll","All results")}),t.jsx("option",{value:"passed",children:n("playtest.result.status.passed","Passed")}),t.jsx("option",{value:"failed",children:n("playtest.result.status.failed","Failed")}),t.jsx("option",{value:"insufficient_evidence",children:n("playtest.result.status.insufficientEvidence","Insufficient evidence")}),t.jsx("option",{value:"timed_out",children:n("playtest.result.status.timedOut","Timed out")})]})]})]}),t.jsx("div",{className:s.valueCount,role:"status",children:n("playtest.history.filteredCount","{{visible}} of {{total}} results").replace("{{visible}}",String(N.length)).replace("{{total}}",String(e.length))}),t.jsx("div",{className:s.historyList,children:E.map(y=>{const T=y.recordId===i;return t.jsxs("button",{className:`${s.historyItem} ${T?s.historyItemSelected:""}`,onClick:F=>a(y.recordId,F.currentTarget),"aria-current":T?"true":void 0,"aria-haspopup":"dialog",children:[t.jsxs("div",{className:s.historyItemHeader,children:[t.jsx("span",{className:s.historyIcon,children:Gr(y.status)}),t.jsx("span",{className:s.historyTimestamp,children:Wr(y.timestamp,o)}),t.jsx("span",{className:s.historyName,children:y.testName}),t.jsx("span",{className:s.recordKind,children:y.recordKind==="structured"?n("playtest.history.kind.structured","Structured"):y.recordKind==="legacy"?n("playtest.history.kind.legacy","Legacy"):n("playtest.history.kind.attention","Needs attention")})]}),t.jsxs("div",{className:s.historyItemMeta,children:[t.jsx(ze,{text:n("playtest.history.mode.tooltip","Playtest mode used for this recorded test run."),children:t.jsxs("span",{className:s.historyMode,children:[n("playtest.history.mode","Mode"),": ",Hr(n,y.mode)]})}),t.jsx("span",{className:s.historyDuration,children:Ur(y.durationMs)}),t.jsx(ze,{text:n("playtest.history.status.tooltip","Recorded result state for this automated playtest run."),children:t.jsx("span",{className:`${s.historyStatus} ${s[`status_${He(y.status)}`]??""}`,children:qr(n,y.status)})})]}),y.evidenceSummary&&t.jsxs("div",{className:s.historyEvidence,children:[t.jsxs("span",{children:[n("playtest.dimension.server","Server"),": ",De(n,y.evidenceSummary.server.status)]}),t.jsxs("span",{children:[n("playtest.dimension.clientUi","Client UI"),": ",De(n,y.evidenceSummary.clientUi.status)]}),y.agentCounts&&t.jsx("span",{children:n("playtest.history.agentCounts","Server {server} · Client {client}").replace("{server}",String(y.agentCounts.server)).replace("{client}",String(y.agentCounts.client))})]}),y.errorMessage&&t.jsx("div",{className:s.historyError,children:y.errorMessage}),!y.errorMessage&&y.limitation&&t.jsx("div",{className:s.historyLimitation,children:Pt(n,y.limitation.code,y.limitation.message)})]},y.recordId)})}),b>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:_===0,onClick:()=>w(y=>y-1),children:n("playtest.values.previous","Previous")}),t.jsxs("span",{children:[_+1," / ",b]}),t.jsx("button",{type:"button",disabled:_+1>=b,onClick:()=>w(y=>y+1),children:n("playtest.values.next","Next")})]})]})}function Xe({label:e,open:a,onToggle:i,children:n,tooltip:o}){const p=r.useId();return t.jsxs("div",{className:s.artifactDisclosure,children:[t.jsxs("button",{className:s.artifactButton,onClick:i,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),i())},"aria-expanded":a,"aria-controls":p,children:[o?t.jsx(ze,{text:o,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:p,children:n})]})}function Jr({detail:e}){const{t:a}=ye(),[i,n]=r.useState(()=>new Set(e.recordKind==="legacy"?["report","logs"]:[])),o=h=>n(f=>{const g=new Set(f);return g.has(h)?g.delete(h):g.add(h),g}),p=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,c=e.artifactErrors??[];return!p&&!e.markdown&&!e.logs&&c.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:[p&&t.jsx(Xe,{label:a("playtest.artifacts.metadata","Result metadata"),open:i.has("metadata"),onToggle:()=>o("metadata"),children:t.jsx("pre",{children:Ke(p)})}),e.markdown&&t.jsx(Xe,{label:a("playtest.report.content","Report"),tooltip:a("playtest.report.content.tooltip","Markdown summary for the selected automated playtest run."),open:i.has("report"),onToggle:()=>o("report"),children:t.jsx("pre",{children:e.markdown})}),e.logs&&t.jsx(Xe,{label:a("playtest.report.logs","Logs"),tooltip:a("playtest.report.logs.tooltip","Execution logs captured for the selected automated playtest run."),open:i.has("logs"),onToggle:()=>o("logs"),children:t.jsx("pre",{children:e.logs})})]}),c.map(h=>t.jsx("div",{className:s.stepError,children:h.message},`${h.code}-${h.message}`))]})}function Yr({result:e}){const{t:a}=ye(),i=[[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:i.map(([n,o])=>t.jsxs("div",{className:s.capabilityItem,children:[t.jsx("span",{className:o?s.capabilityYes:s.capabilityNo,"aria-hidden":"true",children:o?"✓":"–"}),t.jsx("span",{children:n}),t.jsx("span",{className:s.capabilityState,children:o?a("playtest.capability.available","Available"):a("playtest.capability.unavailable","Unavailable")})]},n))}),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((n,o)=>{const p=typeof n.agentId=="string"?n.agentId:`${a("playtest.agents.unknown","Agent")} ${o+1}`,c=typeof n.role=="string"?n.role:"unknown",h=typeof n.clientId=="string"?` · ${n.clientId}`:"";return t.jsxs("code",{children:[p," · ",c,h]},`${p}-${o}`)})]}),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(n=>t.jsxs("div",{className:s.limitationItem,children:["! ",Pt(a,n.code,n.message)]},n.code))]})]})}const Qr=["server","clientUi","interaction","visual"];function Xr({result:e}){const{t:a}=ye(),i={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:Qr.map(n=>{const o=e.dimensions[n];return t.jsxs("div",{className:s.dimensionCard,children:[t.jsxs("div",{className:s.dimensionHeader,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${o.status}`]??""}`,"aria-hidden":"true",children:dt(o.status)}),t.jsx("span",{className:s.dimensionName,children:i[n]}),t.jsx("span",{className:s.requirementBadge,children:o.required?a("playtest.dimension.required","Required"):a("playtest.dimension.optional","Optional")})]}),t.jsx("div",{className:s.dimensionStatus,children:De(a,o.status)}),o.provider&&t.jsx("div",{className:s.dimensionMeta,children:o.provider}),o.reason&&t.jsx("div",{className:s.dimensionMeta,children:Ca(a,o.reason)}),t.jsxs("div",{className:s.dimensionMeta,children:[a("playtest.dimension.steps","Steps"),": ",o.stepIds.length]})]},n)})})]})}function Zr({result:e}){const{t:a}=ye(),i=r.useId(),[n,o]=r.useState(()=>new Set),p=c=>{o(h=>{const f=new Set(h);return f.has(c)?f.delete(c):f.add(c),f})};return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":`${i}-heading`,children:[t.jsx("h3",{id:`${i}-heading`,className:s.viewerHeading,children:a("playtest.steps.title","Step timeline")}),t.jsx("div",{className:s.stepList,children:e.steps.map(c=>{const h=n.has(c.stepId),f=`${i}-${c.index}-details`,g=c.target.role==="server"?a("playtest.steps.server","Server"):c.target.clientId;return t.jsxs("div",{className:s.stepItem,children:[t.jsxs("button",{className:s.stepDisclosure,onClick:()=>p(c.stepId),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),p(c.stepId))},"aria-expanded":h,"aria-controls":f,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${c.status}`]??""}`,"aria-hidden":"true",children:dt(c.status)}),t.jsx("span",{className:s.stepIndex,children:c.index+1}),t.jsxs("span",{className:s.stepIdentity,children:[t.jsx("span",{className:s.stepName,children:c.stepId}),t.jsxs("span",{className:s.stepMeta,children:[g," · ",c.action," · ",Rt(c.durationMs)]})]}),t.jsx("span",{className:s.stepStatus,children:De(a,c.status)}),t.jsx("span",{className:`${s.chevron} ${h?s.chevronOpen:""}`,"aria-hidden":"true",children:"⌄"})]}),h&&t.jsxs("div",{className:s.stepDetails,id:f,role:"region","aria-label":`${c.stepId} ${a("playtest.steps.details","details")}`,children:[c.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:Ke(c.expected)})]}),c.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:Ke(c.observed)})]}),c.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:Ke(c.evidence)})]}),c.error&&t.jsxs("div",{className:s.stepError,children:[t.jsx("strong",{children:c.error.code})," — ",c.error.message]})]})]},c.stepId)})})]})}function eo({report:e}){var n;const{t:a}=ye(),i=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:i}),t.jsx("span",{children:((n=e.error)==null?void 0:n.message)??a("playtest.record.unavailable","Result details are unavailable.")})]})}function to({report:e}){var o,p,c,h,f,g;const{t:a}=ye(),i=!!((o=e.contextSummary)!=null&&o.testScenario||(p=e.contextSummary)!=null&&p.expectedBehavior||(c=e.contextSummary)!=null&&c.observedBehavior),n=e.recordKind==="structured"?e.result:void 0;return t.jsxs("div",{className:s.reportContainer,children:[n&&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_${n.overallStatus}`]??""}`,"aria-hidden":"true",children:dt(n.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:n.testName}),t.jsx("div",{className:s.summaryReason,children:n.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:De(a,n.overallStatus)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.mode","Mode")}),t.jsx("strong",{children:n.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:Rt(n.durationMs)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.cleanup","Cleanup")}),t.jsx("strong",{children:De(a,n.cleanup.status)})]})]})]}),t.jsx(Xr,{result:n}),t.jsx(Zr,{result:n}),t.jsx(Yr,{result:n})]}),e.recordKind!=="structured"&&e.recordKind!=="legacy"&&t.jsx(eo,{report:e}),i&&t.jsxs("div",{className:s.reportContextPanel,children:[((h=e.contextSummary)==null?void 0:h.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})]}),((f=e.contextSummary)==null?void 0:f.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})]}),((g=e.contextSummary)==null?void 0:g.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(Jr,{detail:e},e.recordId),!n&&!e.markdown&&!e.logs&&e.recordKind==="legacy"&&t.jsx("div",{className:s.emptyState,children:a("playtest.report.empty","No report content available")})]})}function ht(e){return typeof e=="number"?{placeId:String(e)}:void 0}const we={listProfiles:async e=>Ce.get("/api/dashboard/playtest/control-profiles",ht(e)),liveStatus:async(e,a)=>Ce.get("/api/dashboard/playtest/live",{...ht(e)??{},...a?{leaseId:a}:{}}),liveAction:async e=>Ce.post("/api/dashboard/playtest/live",e),bindingDraft:async(e,a)=>Ce.post("/api/dashboard/playtest/binding-draft",{...e,...typeof a=="number"?{placeId:a}:{}}),bindingCandidates:async e=>Ce.post("/api/dashboard/playtest/binding-candidates",{...typeof e=="number"?{placeId:e}:{}}),saveProfile:async(e,a,i)=>Ce.put(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e.id)}`,{profile:e,expectedRevision:a,...typeof i=="number"?{placeId:i}:{}}),saveProfileMetadata:async(e,a,i,n)=>Ce.patch(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e)}/metadata`,{expectedRevision:a,...i,...typeof n=="number"?{placeId:n}:{}})},kt="weppy-playtest-workspace-v1",ao="weppy-playtest-profile-v1:";function Je(){try{return window.localStorage}catch{return null}}function so(){var e;try{const a=(e=Je())==null?void 0:e.getItem(kt);return a==="live"||a==="results"?a:"live"}catch{return"live"}}function no(e){var a;try{(a=Je())==null||a.setItem(kt,e)}catch{}}function At(e){return`${ao}${e}`}function lo(e){var a;if(e===null)return null;try{return((a=Je())==null?void 0:a.getItem(At(e)))||null}catch{return null}}function Ze(e,a){var i;if(e!==null)try{(i=Je())==null||i.setItem(At(e),a)}catch{}}const et={entries:[],diagnostics:[]},tt={hasManagedAdapterWithoutStudioGuard:!1};function at(e){return typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:e instanceof Error?e.message:String(e)}function io(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 ro(e){const{enabled:a,canMutate:i,placeId:n,studioSnapshot:o}=e,[p,c]=r.useState([]),[h,f]=r.useState(!1),[g,w]=r.useState(null),[N,b]=r.useState(null),[_,E]=r.useState(et),[y,T]=r.useState(tt),[F,L]=r.useState({}),[P,k]=r.useState({}),[$,A]=r.useState(!0),[I,J]=r.useState(null),G=r.useRef(null),D=r.useRef(null),ue=r.useRef(!1),K=r.useRef(Promise.resolve()),q=r.useRef(0),oe=r.useRef(0),W=r.useRef(null),X=r.useRef(Promise.resolve()),[ge,H]=r.useState(0);G.current=N;const V=r.useMemo(()=>p.find(m=>m.id===g)??null,[p,g]);D.current=V;const Y=r.useCallback(()=>{k(m=>Object.fromEntries(Object.entries(m).map(([j,R])=>{const{observed:x,...C}=R;return[j,{...C,status:"unavailable",fresh:!1,...x!==void 0?{lastObserved:x}:{},reason:"session_ended"}]})))},[]),je=r.useCallback(async()=>{W.current&&(clearTimeout(W.current),W.current=null),oe.current=0;const m=G.current;if(m){G.current=null,b(null),L({}),Y();try{await we.liveAction({action:"close",leaseId:m.leaseId,...typeof n=="number"?{placeId:n}:{}})}catch{}}},[Y,n]),ee=r.useCallback(async()=>{const m=D.current;if(!(G.current||ue.current)){ue.current=!0;try{const j=await we.liveAction({action:m?"observe":"discover",...m?{profileId:m.id}:{},...typeof n=="number"?{placeId:n}:{}});G.current=j.lease,b(j.lease),j.lease.catalog&&E(j.lease.catalog),L({});const R=await we.liveStatus(n,j.lease.leaseId);k(Object.fromEntries(R.watches.map(x=>[x.subscriptionId,x]))),W.current&&clearTimeout(W.current),W.current=null,oe.current=0,J(null)}catch(j){if(J(at(j)),io(j)&&!W.current){const R=oe.current;oe.current+=1;const x=Math.min(2e3,250*2**Math.min(R,3));W.current=setTimeout(()=>{W.current=null,H(C=>C+1)},x)}}finally{ue.current=!1}}},[n]);r.useEffect(()=>{a||je()},[je,a]),r.useEffect(()=>()=>{je()},[je]),r.useEffect(()=>{let m=!1;return A(!0),f(!1),b(null),L({}),k({}),E(et),T(tt),(async()=>{const R=we.listProfiles(n).then(x=>{var Z;if(m)return;c(x.profiles),E(x.catalog??et),T(x.releaseGuidance??tt);const C=lo(n),B=x.profiles.some(ce=>ce.id===C)?C:((Z=x.profiles[0])==null?void 0:Z.id)??null;w(B),B&&Ze(n,B),f(!0)}).catch(x=>{m||(J(at(x)),f(!0))});try{await R}finally{m||A(!1)}})(),()=>{m=!0}},[a,n]),r.useEffect(()=>{const m=++q.current,j=a&&h&&o.targetClientId!==null&&(o.state==="Running"||o.state==="Paused");!j&&W.current&&(clearTimeout(W.current),W.current=null,oe.current=0),K.current=K.current.catch(()=>{}).then(async()=>{var C;if(m!==q.current)return;const R=G.current,x=((C=D.current)==null?void 0:C.id)??"__weppy_catalog__";R&&(!j||R.target.clientId!==o.targetClientId||R.profileId!==x)&&await je(),m===q.current&&j&&!G.current&&await ee()})},[je,a,ee,ge,h,g,o.state,o.mode,o.targetClientId]),r.useEffect(()=>{if(!a)return;const m=new Lt,j=m.on("playtest_watch",R=>{var C;const x=R;!(x!=null&&x.subscriptionId)||x.leaseId!==((C=G.current)==null?void 0:C.leaseId)||k(B=>{const Z=B[x.subscriptionId];if(Z&&x.sequence<=Z.sequence&&x.sequence!==0)return B;const Pe=Z&&x.sequence>0&&Z.sequence>0&&x.sequence!==Z.sequence+1?(()=>{const{observed:Se,...Ae}=x;return{...Ae,status:"stale",fresh:!1,...Se!==void 0?{lastObserved:Se}:{},reason:"sequence_gap"}})():x;return{...B,[x.subscriptionId]:Pe}})});return m.connect(),()=>{j(),m.disconnect()}},[a]);const me=r.useCallback(m=>{G.current||(w(m),Ze(n,m))},[n]),M=r.useCallback(async(m,j)=>{const R=G.current;if(!(!R||!i)){L(x=>({...x,[m]:{...x[m],status:"applying",draft:j}}));try{const x=await we.liveAction({action:"apply",leaseId:R.leaseId,expectedRevision:R.revision,values:{[m]:j},...typeof n=="number"?{placeId:n}:{}}),C=x.result.bindings.find(B=>B.bindingId===m);b(B=>B&&{...B,revision:x.result.revision}),L(B=>{var Z,ce;return{...B,[m]:x.result.status==="applied"?{status:"applied",draft:j,requested:(C==null?void 0:C.requested)??j,observed:C==null?void 0:C.observed,original:C==null?void 0:C.original}:{...B[m],status:((Z=x.result.error)==null?void 0:Z.code)==="requires_adapter"?"requires_adapter":"error",draft:j,message:(ce=x.result.error)==null?void 0:ce.message}}})}catch(x){const C=typeof x=="object"&&x!==null&&"status"in x&&x.status===409;L(B=>({...B,[m]:{...B[m],status:C?"conflict":"error",draft:j,message:at(x)}}))}}},[i,n]),ie=r.useCallback(async()=>{const m=G.current;if(!m||!i)return;const j=await we.liveAction({action:"reset",leaseId:m.leaseId,...typeof n=="number"?{placeId:n}:{}});b(j.lease),L({})},[i,n]),z=r.useCallback(async m=>{const j=m.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||`profile-${Date.now()}`,R=await we.saveProfile({schemaVersion:3,id:j,name:m.trim(),controls:[],watches:[],presentation:{},settings:{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"},sectionOrder:["watches","controls"]},0,n);return c(x=>[...x,R.profile]),w(R.profile.id),Ze(n,R.profile.id),R.profile},[n]),ve=r.useCallback(async m=>{const{revision:j,...R}=m,x=await we.saveProfile(R,j,n);c(C=>C.map(B=>B.id===x.profile.id?x.profile:B))},[n]),he=r.useCallback(async(m,j,R)=>{if(!D.current)throw new Error("Select a test profile before saving a value.");await new Promise((C,B)=>{X.current=X.current.catch(()=>{}).then(async()=>{const Z=D.current;if(!Z)throw new Error("Select a test profile before saving a value.");const ce=await we.saveProfileMetadata(Z.id,Z.revision,{defaults:{[m]:j}},n);D.current=ce.profile,c(Pe=>Pe.map(Se=>Se.id===ce.profile.id?ce.profile:Se))}),X.current.then(C,B)})},[n]),pe=r.useCallback(async m=>{await new Promise((j,R)=>{X.current=X.current.catch(()=>{}).then(async()=>{const x=D.current;if(!x)throw new Error("Select a test profile before saving display settings.");const C=await we.saveProfileMetadata(x.id,x.revision,m,n);D.current=C.profile,c(B=>B.map(Z=>Z.id===C.profile.id?C.profile:Z))}),X.current.then(j,R)})},[n]),xe=r.useCallback(async m=>({path:(await we.bindingDraft(m,n)).binding.path}),[n]),d=r.useCallback(async()=>await we.bindingCandidates(n),[n]);return{profiles:p,selectedProfileId:g,profile:V,catalog:_,releaseGuidance:y,lease:N,controls:F,watches:P,studioState:o.state,studioMode:o.mode,canMutate:i,loading:$,error:I,selectProfile:me,apply:M,resetAll:ie,createProfile:z,saveProfile:ve,saveControlValue:he,saveProfileMetadata:pe,resolveSelection:xe,resolveSelectionCandidates:d}}function oo(e){const{t:a}=ye(),i=[{key:"live",label:a("playtest.view.liveSession","Test Values")},{key:"results",label:a("playtest.view.testResults","Automated Test Results")}];return t.jsx(zt,{items:i,value:e.value,onChange:e.onChange,ariaLabel:a("playtest.view.workspaceLabel","Playtest workspace"),className:s.workspaceTabs})}function co(e){const{t:a}=ye(),i=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),n=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(na,{size:16,"aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("strong",{children:i}),n&&t.jsx("span",{children:n})]})]})})}function $e(e){const{t:a}=ye(),[i,n]=r.useState(!1),o=r.useRef(null),p=r.useRef(null),c=r.useRef(null),[h,f]=r.useState({top:0,left:0});return r.useLayoutEffect(()=>{var y;if(!i||e.active||!p.current||!c.current)return;const w=(((y=o.current)==null?void 0:y.querySelector("input, select, button"))??p.current).getBoundingClientRect(),N=c.current.getBoundingClientRect(),b=w.top-N.height-6,_=w.bottom+6,E=b<8&&_+N.height<=window.innerHeight-8?_:b;f({top:Math.max(8,Math.min(E,window.innerHeight-N.height-8)),left:Math.max(8,Math.min(w.left+w.width/2-N.width/2,window.innerWidth-N.width-8))})},[i,e.active,e.reason]),r.useEffect(()=>{if(!i)return;const g=()=>n(!1);return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[i]),t.jsxs("div",{ref:o,className:s.controlGate,children:[e.children,!e.active&&t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:p,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":i,onClick:()=>n(!0),onFocus:()=>n(!0),onBlur:()=>n(!1),onKeyDown:g=>{g.key==="Escape"&&n(!1)}}),i&&Dt.createPortal(t.jsx("span",{ref:c,className:s.controlGateHint,style:h,role:"status",children:e.reason}),document.body)]})]})}function Et(e){var a,i,n;return t.jsx(Fe,{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(Ge,{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(o=>t.jsxs("div",{children:[t.jsx("dt",{children:o.label}),t.jsx("dd",{children:o.value})]},o.label))}),t.jsx("div",{className:s.valueDetailFeedback,"data-state":e.error?"error":((a=e.feedback)==null?void 0:a.state)??"idle",role:e.error||((i=e.feedback)==null?void 0:i.state)==="error"?"alert":"status","aria-live":"polite",children:e.error??((n=e.feedback)==null?void 0:n.message)??" "}),e.actions&&e.actions.length>0&&t.jsx("div",{className:s.valueDetailActions,children:e.actions.map(o=>{var p,c,h;return t.jsx($e,{active:((p=o.gate)==null?void 0:p.active)??!0,label:((c=o.gate)==null?void 0:c.label)??o.label,reason:((h=o.gate)==null?void 0:h.reason)??"",children:t.jsx("button",{type:"button",className:o.variant==="secondary"?s.secondaryAction:s.primaryAction,"aria-label":o.accessibleLabel,disabled:o.disabled,onClick:o.onClick,children:o.label})},o.accessibleLabel)})})]})]})})}function Ve(e){return e==="vector3"||e==="color3"||e==="cframe"}function Tt(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 ut(e,a){try{const i=JSON.parse(a),n=Tt(e);if(e==="cframe"?!Array.isArray(i)||i.length!==12:!i||Array.isArray(i)||typeof i!="object"||Object.keys(i).length!==3)return;const o=n.map((p,c)=>e==="cframe"?i[c]:i[p]);if(!o.every(p=>typeof p=="number"&&Number.isFinite(p))||e==="color3"&&o.some(p=>p<0||p>1))return;if(e==="cframe"){const p=o,c=(f,g)=>p[f]*p[g]+p[f+1]*p[g+1]+p[f+2]*p[g+2],h=p[3]*(p[7]*p[11]-p[8]*p[10])-p[4]*(p[6]*p[11]-p[8]*p[9])+p[5]*(p[6]*p[10]-p[7]*p[9]);if([3,6,9].some(f=>Math.abs(c(f,f)-1)>1e-5)||[[3,6],[3,9],[6,9]].some(([f,g])=>Math.abs(c(f,g))>1e-5)||Math.abs(h-1)>1e-5)return}return i}catch{return}}function We(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(i=>typeof e[i]=="number"))return a.map(i=>`${i.toUpperCase()} ${Number(e[i].toPrecision(6))}`).join(" · ")}return JSON.stringify(e)}function ot(e){const a=r.useRef(!1),i=Tt(e.type);let n={};try{n=JSON.parse(e.draft)??{}}catch{}const o=i.map((f,g)=>{const w=e.type==="cframe"?n[g]:n[f];return w==null?"":String(w)}),p=(f,g)=>{const N=o.map((b,_)=>_===f?g:b).map(b=>b.trim()!==""&&!/[.eE+-]$/.test(b)&&Number.isFinite(Number(b))?Number(b):b);e.onChange(JSON.stringify(e.type==="cframe"?N:Object.fromEntries(i.map((b,_)=>[b,N[_]]))))},c=ut(e.type,e.draft),h=c&&!Array.isArray(c)&&typeof c=="object"?`#${["r","g","b"].map(f=>Math.round(Number(c[f])*255).toString(16).padStart(2,"0")).join("")}`:"#000000";return t.jsxs("div",{className:s.compoundEditor,role:"group","aria-label":e.label,onFocus:()=>{var f;return(f=e.onFocusChange)==null?void 0:f.call(e,!0)},onBlur:f=>{var g,w;f.currentTarget.contains(f.relatedTarget)||((g=e.onFocusChange)==null||g.call(e,!1),a.current||(w=e.onCommit)==null||w.call(e))},onCompositionStart:()=>{a.current=!0},onCompositionEnd:()=>{a.current=!1},onKeyDown:f=>{var g;f.key==="Enter"&&!f.nativeEvent.isComposing&&!a.current&&((g=e.onCommit)==null||g.call(e))},children:[e.type==="color3"&&t.jsx("input",{className:s.colorSwatch,type:"color",value:h,disabled:e.disabled,"aria-label":`${e.label} RGB`,"aria-describedby":e.describedBy,onChange:f=>{const g=f.target.value.slice(1);e.onChange(JSON.stringify({r:parseInt(g.slice(0,2),16)/255,g:parseInt(g.slice(2,4),16)/255,b:parseInt(g.slice(4,6),16)/255}))}}),t.jsx("div",{className:s.compoundCoordinates,children:i.map((f,g)=>t.jsxs("label",{children:[t.jsxs("span",{children:[f.toUpperCase(),e.type==="color3"?" (0–1)":""]}),t.jsx("input",{inputMode:"decimal",value:o[g],disabled:e.disabled,"aria-label":`${e.label} ${f.toUpperCase()}`,"aria-describedby":e.describedBy,"aria-invalid":e.draft!==""&&c===void 0||void 0,onChange:w=>p(g,w.target.value)})]},f))})]})}function Ne(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function uo(e,a,i){const n=i!=null&&i.fresh?i.observed:i==null?void 0:i.lastObserved,o=(a==null?void 0:a.draft)??n??e.value;return o===void 0?"":Ne(o)}function Be(e,a){var i;if(Ve(e.valueType))return ut(e.valueType,a);if(e.valueType==="number"){if(a.trim()==="")return;const n=Number(a);return Number.isFinite(n)?n:void 0}return e.valueType==="boolean"?a==="true":e.valueType==="enum"?((i=e.enumValues)==null?void 0:i.find(n=>Ne(n)===a))??a:a}function Ie(e){return e&&typeof e=="object"&&!Array.isArray(e)?`object:${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${Ie(e[a])}`).join(",")}`:`${typeof e}:${JSON.stringify(e)}`}function Oe(e){var a;return e.value!==void 0?Ne(e.value):e.valueType==="boolean"?"false":e.valueType==="enum"?Ne((a=e.enumValues)==null?void 0:a[0]):""}function po(e){var n;const{t:a}=ye();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 i=((n=e.profile.settings)==null?void 0:n.runtimeApplyMode)??"manual";return t.jsx("div",{className:s.liveRows,children:e.profile.controls.map(o=>{var p,c,h;return t.jsx(yo,{control:o,active:e.active,inactiveReason:e.inactiveReason,profileSaveLocked:e.profileSaveLocked,runtimeApplyMode:i,state:e.states[o.id],watch:e.watches[`control:${o.id}`],presentation:(c=(p=e.profile)==null?void 0:p.presentation)==null?void 0:c[o.id],draftState:(h=e.drafts)==null?void 0:h[o.id],onDraftChange:e.onDraftChange,onApply:e.onApply,onSaveValue:e.onSaveValue,onRemoveValue:e.onRemoveValue},`${e.draftScope??"profile"}:${o.id}`)})})}function yo(e){var xe,d,m,j,R,x,C,B,Z,ce,Pe,Se,Ae,Ee,v,Q,ae,fe,te,le,l;const{t:a}=ye(),i=uo(e.control,e.state,e.watch),[n,o]=r.useState(i),[p,c]=r.useState(!1),[h,f]=r.useState("idle"),[g,w]=r.useState(null),[N,b]=r.useState(()=>Oe(e.control)),[_,E]=r.useState(e.control.value),[y,T]=r.useState(null),[F,L]=r.useState(!1),P=r.useRef(null),k=r.useRef(!1),$=r.useRef(!1),A=r.useRef(null),I=((xe=e.draftState)==null?void 0:xe.value)??n,J=((d=e.draftState)==null?void 0:d.dirty)??p;r.useEffect(()=>{o(i),c(!1),b(Oe(e.control)),E(e.control.value),T(null),w(null),A.current=null},[e.control.id]),r.useEffect(()=>{b(Oe(e.control)),E(e.control.value)},[e.control.value]),r.useEffect(()=>{!e.draftState&&!J&&!k.current&&o(i)},[J,i,e.draftState]),r.useEffect(()=>{var u,S,O;(((u=e.state)==null?void 0:u.status)==="error"||((S=e.state)==null?void 0:S.status)==="conflict"||((O=e.state)==null?void 0:O.status)==="requires_adapter")&&(A.current=null)},[(m=e.state)==null?void 0:m.status]);const G=()=>Be(e.control,I),D=u=>{if(!e.active||$.current)return;const S=u??G();if(S===void 0)return;const O=Ie(S);A.current!==O&&(A.current=O,e.onApply(e.control.id,S))},ue=u=>{var O;o(u),c(!0),(O=e.onDraftChange)==null||O.call(e,e.control.id,u,!0);const S=Be(e.control,u);(S===void 0||Ie(S)!==A.current)&&(A.current=null)},K=async()=>{const u=Be(e.control,N);if(!(u===void 0||!e.onSaveValue||e.profileSaveLocked||h!=="idle")){f("saving"),w(null),T(null);try{await e.onSaveValue(e.control.id,u,e.control.applyOnStart??!1),E(u),T({state:"saved",value:Ne(u)})}catch(S){w(S instanceof Error?S.message:String(S))}finally{f("idle")}}},q=async()=>{if(!(_===void 0||!e.onRemoveValue||e.profileSaveLocked||h!=="idle")){f("removing"),w(null),T(null);try{await e.onRemoveValue(e.control.id),b(Oe({...e.control,value:void 0})),E(void 0),T({state:"removed"})}catch(u){w(u instanceof Error?u.message:String(u))}finally{f("idle")}}},oe=a("playtest.controls.inputLabel","Input value for {{label}}").replace("{{label}}",e.control.label),W=e.active?void 0:"playtest-controls-availability",X=e.inactiveReason??a("playtest.values.playRequired","Start Play in Studio to change test values."),ge=e.control.valueType==="number"&&((j=e.control.constraints)==null?void 0:j.minimum)!==void 0&&((R=e.control.constraints)==null?void 0:R.maximum)!==void 0,H=(x=e.watch)!=null&&x.fresh?e.watch.observed:(C=e.watch)==null?void 0:C.lastObserved,V=(B=e.watch)!=null&&B.fresh?a("playtest.controls.currentObserved","Current value"):H!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),Y=((Z=e.state)==null?void 0:Z.status)??"idle",je=e.control.origin?`ServerStorage.WeppyTestAdapters.${e.control.origin.adapter}`:e.control.path?[e.control.path.root,...e.control.path.segments].join("."):"adapter",ee=e.runtimeApplyMode==="auto",me=G(),M=Y==="applying"||Y==="pending_resume",ie=!ee&&e.active&&J&&me!==void 0&&H!==void 0&&Ie(me)!==Ie(H)&&Ie(me)!==A.current&&!M,z=_===void 0?a("playtest.controls.noSavedValue","No saved default"):Ne(_),ve=a("playtest.controls.defaultInputLabel","Saved default for {{label}}").replace("{{label}}",e.control.label);let he;Ve(e.control.valueType)?he=t.jsx(ot,{type:e.control.valueType,draft:I,label:oe,disabled:!e.active,describedBy:W,onChange:ue,onFocusChange:u=>{k.current=u},onCommit:()=>{ee&&D()}}):e.control.valueType==="boolean"?he=t.jsxs("label",{className:s.booleanEditor,children:[t.jsx("input",{type:"checkbox",checked:I==="true",disabled:!e.active,"aria-label":oe,"aria-describedby":W,onFocus:()=>{k.current=!0},onBlur:()=>{k.current=!1},onChange:u=>{const S=u.target.checked;ue(String(S)),ee&&D(S)}}),t.jsx("span",{children:I==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?he=t.jsx("select",{"aria-label":oe,"aria-describedby":W,value:I,disabled:!e.active,onFocus:()=>{k.current=!0},onBlur:()=>{k.current=!1},onChange:u=>{ue(u.target.value);const S=Be(e.control,u.target.value);ee&&S!==void 0&&D(S)},children:(e.control.enumValues??[]).map(u=>t.jsx("option",{value:Ne(u),children:We(u)},Ne(u)))}):ge?he=t.jsxs("div",{className:s.rangeEditor,children:[t.jsx("input",{type:"range",value:I||String(((ce=e.control.constraints)==null?void 0:ce.minimum)??0),min:(Pe=e.control.constraints)==null?void 0:Pe.minimum,max:(Se=e.control.constraints)==null?void 0:Se.maximum,step:((Ae=e.control.constraints)==null?void 0:Ae.step)??1,disabled:!e.active,"aria-label":oe,"aria-describedby":W,onFocus:()=>{k.current=!0},onBlur:()=>{k.current=!1},onChange:u=>ue(u.target.value),onPointerUp:()=>{ee&&D()},onKeyUp:u=>{ee&&(u.key.startsWith("Arrow")||u.key==="Home"||u.key==="End")&&D()}}),t.jsx("output",{children:I||"—"})]}):he=t.jsx("input",{value:I,disabled:!e.active,inputMode:e.control.valueType==="number"?"decimal":void 0,onFocus:()=>{k.current=!0},onChange:u=>ue(u.target.value),onCompositionStart:()=>{$.current=!0},onCompositionEnd:()=>{$.current=!1},onKeyDown:u=>{ee&&u.key==="Enter"&&!u.nativeEvent.isComposing&&D()},onBlur:()=>{k.current=!1,ee&&D()},"aria-label":oe,"aria-describedby":W});let pe;return Ve(e.control.valueType)?pe=t.jsx(ot,{type:e.control.valueType,draft:N,label:ve,disabled:!e.onSaveValue||e.profileSaveLocked||h!=="idle",onChange:u=>{b(u),T(null),w(null)}}):e.control.valueType==="boolean"?pe=t.jsxs("label",{className:s.defaultBooleanEditor,children:[t.jsx("input",{type:"checkbox",checked:N==="true",disabled:!e.onSaveValue||e.profileSaveLocked||h!=="idle","aria-label":ve,onChange:u=>{b(String(u.target.checked)),T(null),w(null)}}),t.jsx("span",{children:N==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?pe=t.jsx("select",{value:N,disabled:!e.onSaveValue||e.profileSaveLocked||h!=="idle","aria-label":ve,onChange:u=>{b(u.target.value),T(null),w(null)},children:(e.control.enumValues??[]).map(u=>t.jsx("option",{value:Ne(u),children:We(u)},Ne(u)))}):pe=t.jsx("input",{type:e.control.valueType==="number"?"number":"text",value:N,min:(Ee=e.control.constraints)==null?void 0:Ee.minimum,max:(v=e.control.constraints)==null?void 0:v.maximum,step:(Q=e.control.constraints)==null?void 0:Q.step,disabled:!e.onSaveValue||e.profileSaveLocked||h!=="idle","aria-label":ve,onChange:u=>{b(u.target.value),T(null),w(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}),(((ae=e.presentation)==null?void 0:ae.pinned)||((fe=e.presentation)==null?void 0:fe.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:()=>{b(Oe({...e.control,value:_})),T(null),w(null),L(!0)},children:a("playtest.controls.details","Value details")})]}),t.jsxs("div",{className:s.actualValue,"aria-label":`${V} ${Ne(H)}`,children:[t.jsx("span",{children:V}),t.jsx("strong",{children:We(H)})]}),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:z,"aria-label":a("playtest.controls.savedDefaultState","Saved default for {{label}}: {{value}}").replace("{{label}}",e.control.label).replace("{{value}}",z),children:[a("playtest.controls.defaultValue","Saved default")," ",t.jsx("strong",{children:z})]})]}),t.jsxs("div",{className:s.controlEditorRow,children:[t.jsx($e,{active:e.active,label:`${e.control.label} input`,reason:X,children:he}),t.jsx("div",{className:s.controlActions,children:t.jsx($e,{active:e.active,label:`${e.control.label} apply`,reason:X,children:t.jsx("button",{type:"button",className:s.secondaryAction,disabled:!ie,"aria-label":a("playtest.controls.applyLabel","Apply the input value for {{label}}").replace("{{label}}",e.control.label),onClick:()=>D(),children:a("playtest.controls.applyRuntime","Apply manually")})})})]}),t.jsx("span",{className:s.rowFeedback,"data-state":g?"error":Y,"aria-live":"polite",children:g??(Y==="applying"?a("playtest.controls.applying","Applying…"):Y==="pending_resume"?a("playtest.controls.pendingResume","Apply on resume"):Y==="applied"?a("playtest.controls.applied","Applied · readback {{value}}").replace("{{value}}",Ne((te=e.state)==null?void 0:te.observed)):Y==="conflict"?a("playtest.controls.conflict","Conflict · reload the current revision"):Y==="requires_adapter"?a("playtest.controls.requiresAdapter","Requires reviewed adapter"):Y==="error"?((le=e.state)==null?void 0:le.message)??a("playtest.controls.applyFailed","Apply failed"):e.active?ee?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(Et,{open:F,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:()=>L(!1),items:[{label:V,value:Ne(H)},{label:a("playtest.controls.defaultValue","Saved default"),value:t.jsx("div",{className:s.defaultValueEditor,children:pe})},{label:a("playtest.controls.originalValue","Original runtime value"),value:Ne((l=e.state)==null?void 0:l.original)},{label:a("playtest.controls.registration","Registration"),value:`${e.control.target.role} · ${e.control.access.kind}`},{label:a("playtest.values.location","Location"),value:je},{label:a("playtest.values.valueType","Value type"),value:e.control.valueType}],error:g,feedback:(y==null?void 0:y.state)==="saved"?{state:"success",message:a("playtest.controls.defaultSavedFeedback","Saved default {{value}} · Saved").replace("{{value}}",y.value??"")}:(y==null?void 0:y.state)==="removed"?{state:"success",message:a("playtest.controls.defaultRemovedFeedback","No saved default · Removed")}:null,actions:[{label:h==="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:_===void 0||!e.onRemoveValue||e.profileSaveLocked||h!=="idle",variant:"secondary",onClick:()=>void q()},{label:h==="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||h!=="idle"||Be(e.control,N)===void 0,onClick:()=>void K()}]})]})}function qe(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function mo(e){var w;const{t:a}=ye(),i=[...((w=e.profile)==null?void 0:w.watches.map(N=>({...N,subscriptionId:`watch:${N.id}`})))??[]],[n,o]=r.useState(null),p=r.useRef(null);if(i.length===0)return t.jsx("div",{className:s.panelEmpty,children:a("playtest.watch.empty","Observed values appear here during Play.")});const c=i.find(N=>N.id===n),h=c?e.watches[c.subscriptionId]:void 0,f=h!=null&&h.fresh?h.observed:h==null?void 0:h.lastObserved,g=c!=null&&c.path?[c.path.root,...c.path.segments].join("."):(c==null?void 0:c.access.adapter)??"adapter";return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:s.watchRows,children:i.map(N=>{var T,F;const b=e.watches[N.subscriptionId],_=(F=(T=e.profile)==null?void 0:T.presentation)==null?void 0:F[N.id],E=b!=null&&b.fresh?b.observed:b==null?void 0:b.lastObserved,y=b!=null&&b.fresh?a("playtest.watch.currentValue","Current value"):E!==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":N.valueType,children:[t.jsxs("div",{className:s.watchCardMain,children:[t.jsx("strong",{children:N.label}),((_==null?void 0:_.pinned)||(_==null?void 0:_.group))&&t.jsxs("span",{className:s.presentationMeta,children:[_.pinned?a("playtest.values.pinned","Pinned"):"",_.pinned&&_.group?" · ":"",_.group??""]}),t.jsx("button",{type:"button",className:s.valueDetailButton,"aria-label":a("playtest.values.detailsFor","Value details for {{label}}").replace("{{label}}",N.label),onClick:L=>{p.current=L.currentTarget,o(N.id)},children:a("playtest.watch.details","Observation details")})]}),t.jsxs("div",{className:s.watchReading,children:[!(b!=null&&b.fresh)&&t.jsx("span",{children:y}),t.jsx("strong",{title:qe(E),"aria-label":`${y} ${qe(E)}`,children:qe(E)})]}),b&&b.status!=="fresh"&&t.jsx("span",{className:s.freshness,"data-status":b.status,children:(b==null?void 0:b.status)==="stale"?a("playtest.watch.stale","Stale"):a("playtest.watch.unavailable","Unavailable")})]},N.subscriptionId)})}),c&&t.jsx(Et,{open:n!==null,title:c.label,description:a("playtest.watch.details","Observation details"),ariaLabel:a("playtest.values.detailsDialog","{{label}} value details").replace("{{label}}",c.label),closeLabel:a("common.close","Close"),returnFocusTo:p.current,onClose:()=>o(null),items:[{label:a("playtest.watch.registration","Registration"),value:`${c.target.role} · ${c.access.kind}`},{label:a("playtest.values.location","Location"),value:g},{label:a("playtest.values.valueType","Value type"),value:c.valueType},{label:h!=null&&h.fresh?a("playtest.watch.currentValue","Current value"):f!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),value:qe(f)},...h!=null&&h.observedAtMs?[{label:a("playtest.watch.observedAt","Observed at"),value:t.jsx("time",{children:new Date(h.observedAtMs).toLocaleTimeString()})}]:[]]})]})}function vo(e,a,i,n){const o=e.indexOf(a),p=e.indexOf(i);if(o<0||p<0||a===i)return[...e];const c=e.filter(g=>g!==a),h=c.indexOf(i),f=n==="after"?h+1:h;return c.splice(f,0,a),c}const ft=["watches","controls"];function ho(e,a){const i=e.path?[e.path.root,...e.path.segments].join("."):"";return[e.id,e.label,a,i,e.access.adapter,e.access.name].filter(Boolean).join(" ").toLocaleLowerCase()}function fo(e,a){const i=e.watches[`${a.kind}:${a.binding.id}`];return(i==null?void 0:i.status)??"unobserved"}function go(e){var Z,ce,Pe,Se,Ae,Ee;const{t:a}=ye(),[i,n]=r.useState(""),[o,p]=r.useState("all"),[c,h]=r.useState("all"),[f,g]=r.useState("all"),[w,N]=r.useState(new Set),[b,_]=r.useState(0),[E,y]=r.useState(50),[T,F]=r.useState(!1),[L,P]=r.useState(((Z=e.live.profile)==null?void 0:Z.sectionOrder)??ft),[k,$]=r.useState(null),[A,I]=r.useState(null),[J,G]=r.useState(null),[D,ue]=r.useState(!1),[K,q]=r.useState(!1),[oe,W]=r.useState(""),[X,ge]=r.useState(null),[H,V]=r.useState(()=>{var v;return((v=e.live.profile)==null?void 0:v.presentation)??{}}),[Y,je]=r.useState({}),[ee,me]=r.useState(()=>{var v;return((v=e.live.profile)==null?void 0:v.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}}),M=e.live.profile,ie=a("playtest.values.ungrouped","Ungrouped");r.useEffect(()=>{var v,Q;P(((v=e.live.profile)==null?void 0:v.sectionOrder)??ft),V(((Q=e.live.profile)==null?void 0:Q.presentation)??{}),ue(!1)},[(ce=e.live.profile)==null?void 0:ce.id,(Pe=e.live.profile)==null?void 0:Pe.presentation,(Se=e.live.profile)==null?void 0:Se.sectionOrder]),r.useEffect(()=>{var v;me(((v=e.live.profile)==null?void 0:v.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"})},[(Ae=e.live.profile)==null?void 0:Ae.id,(Ee=e.live.profile)==null?void 0:Ee.settings]);const z=r.useMemo(()=>{if(!M)return{entries:[],total:0,pages:1,safePage:0,groups:[]};const v=[...M.controls.map((l,u)=>({kind:"control",binding:l,sourceOrder:u})),...M.watches.map((l,u)=>({kind:"watch",binding:l,sourceOrder:M.controls.length+u}))],Q=Array.from(new Set(v.map(l=>{var u;return((u=H[l.binding.id])==null?void 0:u.group)??ie}))).sort((l,u)=>l.localeCompare(u)),ae=i.trim().toLocaleLowerCase(),fe=v.filter(l=>{var S;const u=((S=H[l.binding.id])==null?void 0:S.group)??ie;return(o==="all"||l.kind===o)&&(f==="all"||u===f)&&(c==="all"||fo(e.live,l)===c)&&(!ae||ho(l.binding,u).includes(ae))}).sort((l,u)=>{if(l.kind!==u.kind)return l.kind==="watch"?-1:1;const S=H[l.binding.id],O=H[u.binding.id];return!!(S!=null&&S.pinned)!=!!(O!=null&&O.pinned)?S!=null&&S.pinned?-1:1:((S==null?void 0:S.order)??l.sourceOrder)-((O==null?void 0:O.order)??u.sourceOrder)}),te=Math.max(1,Math.ceil(fe.length/E)),le=Math.min(b,te-1);return{entries:fe.slice(le*E,(le+1)*E),total:fe.length,pages:te,safePage:le,groups:Q}},[f,o,c,b,E,H,M,e.live,i,ie]),ve=((M==null?void 0:M.controls.length)??0)+((M==null?void 0:M.watches.length)??0),he=i.trim()!==""||o!=="all"||c!=="all"||f!=="all",pe={watches:a("playtest.values.observedSection","Observed values"),controls:a("playtest.values.changeSection","Change values")},xe=async v=>{G(null);try{await e.live.saveProfileMetadata(v)}catch(Q){throw G(Q instanceof Error?Q.message:a("playtest.values.layoutSaveFailed","Could not save the display order")),Q}},d=v=>{me(v),xe({settings:v}).catch(()=>me((M==null?void 0:M.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}))},m=v=>{if(!D||K||!L.includes(v))return;const Q=L,ae=[L[1],L[0]];P(ae),q(!0),xe({sectionOrder:ae}).then(()=>W(a("playtest.values.layoutSaved","Display order saved"))).catch(()=>P(Q)).finally(()=>q(!1))},j=v=>z.entries.filter(Q=>Q.kind===v),R=(v,Q,ae,fe)=>{var U,se,_e;if(!M||!D||K)return;const te=H,le=Q.map(ne=>ne.binding.id),l=vo(le,v.binding.id,ae,fe);if(le.every((ne,de)=>ne===l[de]))return;const u={...H},S=Q.map(ne=>{var de;return((de=H[ne.binding.id])==null?void 0:de.order)??ne.sourceOrder}).sort((ne,de)=>ne-de);for(const[ne,de]of l.entries())u[de]={order:S[ne],pinned:((U=H[de])==null?void 0:U.pinned)??!1,...(se=H[de])!=null&&se.group?{group:(_e=H[de])==null?void 0:_e.group}:{}};V(u),q(!0);const O=l.indexOf(v.binding.id)+1;xe({presentation:u}).then(()=>W(a("playtest.values.movedTo","{{label}} moved to position {{position}}").replace("{{label}}",v.binding.label).replace("{{position}}",String(O)))).catch(()=>V(te)).finally(()=>q(!1))},x=v=>N(Q=>{const ae=new Set(Q);return ae.has(v)?ae.delete(v):ae.add(v),ae}),C=(v,Q)=>{var se,_e,ne,de;const ae=((se=H[v.binding.id])==null?void 0:se.group)??ie,fe=((_e=H[v.binding.id])==null?void 0:_e.pinned)??!1,te=Q.filter(re=>{var be,ke;return(((be=H[re.binding.id])==null?void 0:be.group)??ie)===ae&&(((ke=H[re.binding.id])==null?void 0:ke.pinned)??!1)===fe}),le=te.findIndex(re=>re.binding.id===v.binding.id),l=re=>a(re==="previous"?"playtest.values.movePrevious":"playtest.values.moveNext",`Move {{label}} ${re}`).replace("{{label}}",v.binding.label),u=a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",v.binding.label),S=e.active&&(e.live.studioMode!=="run"||v.binding.target.role==="server"),O=e.live.studioMode==="run"&&v.binding.target.role==="client"?a("playtest.controls.playModeRequired","Client test values are available in Play."):e.inactiveReason,U=`${M.id}:${((ne=e.live.lease)==null?void 0:ne.leaseId)??"edit"}:${v.binding.id}`;return t.jsxs("div",{className:s.valueEntryShell,"data-layout-editing":D,"data-drop-position":(X==null?void 0:X.id)===v.binding.id?X.placement:void 0,onDragOver:re=>{if((k==null?void 0:k.kind)!==v.kind||!te.some(Ye=>Ye.binding.id===k.id))return;re.preventDefault();const be=re.currentTarget.getBoundingClientRect(),Te=v.kind==="watch"?re.clientX>=be.left+be.width/2?"after":"before":re.clientY>=be.top+be.height/2?"after":"before";ge({id:v.binding.id,placement:Te})},onDrop:re=>{if(re.preventDefault(),(k==null?void 0:k.kind)===v.kind&&k.id!==v.binding.id&&(X==null?void 0:X.id)===v.binding.id){const be=te.find(ke=>ke.binding.id===k.id);be&&R(be,te,v.binding.id,X.placement)}$(null),ge(null)},children:[D&&t.jsxs("div",{className:s.valueReorderControls,children:[t.jsx("button",{type:"button",className:s.dragHandle,draggable:!0,"aria-label":u,disabled:K,onDragStart:()=>$({kind:v.kind,id:v.binding.id}),onDragEnd:()=>{$(null),ge(null)},children:t.jsx(mt,{size:14,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":l("previous"),"aria-describedby":le<=0?"playtest-layout-boundary":void 0,disabled:K||le<=0,onClick:()=>R(v,te,te[le-1].binding.id,"before"),children:t.jsx(yt,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":l("next"),"aria-describedby":le===te.length-1?"playtest-layout-boundary":void 0,disabled:K||le<0||le===te.length-1,onClick:()=>R(v,te,te[le+1].binding.id,"after"),children:t.jsx(rt,{size:13,"aria-hidden":"true"})})]}),v.kind==="control"?t.jsx(po,{profile:{...M,controls:[v.binding],watches:[],settings:ee},active:S,inactiveReason:O,states:e.live.controls,watches:e.live.watches,draftScope:`${M.id}:${((de=e.live.lease)==null?void 0:de.leaseId)??"edit"}`,drafts:Y[U]?{[v.binding.id]:Y[U]}:void 0,onDraftChange:(re,be,ke)=>je(Te=>({...Te,[U]:{value:be,dirty:ke}})),profileSaveLocked:!1,onApply:(re,be)=>void e.live.apply(re,be),onSaveValue:e.live.saveControlValue,onRemoveValue:re=>e.live.saveProfileMetadata({removeDefaults:[re]})}):t.jsx(mo,{profile:{...M,controls:[],watches:[v.binding]},watches:e.live.watches})]},`${v.kind}:${v.binding.id}`)},B=v=>{var le;const ae=j(v==="watches"?"watch":"control"),fe=new Map;for(const l of ae){const u=((le=H[l.binding.id])==null?void 0:le.group)??ie;fe.set(u,[...fe.get(u)??[],l])}const te=pe[v];return t.jsxs("section",{className:s.valueSection,"aria-label":te,onDragOver:l=>{A&&A!==v&&l.preventDefault()},onDrop:l=>{!A||A===v||(l.preventDefault(),m(A),I(null))},children:[t.jsxs("header",{className:s.valueSectionHeader,children:[t.jsxs("div",{className:s.valueSectionHeading,children:[D&&t.jsx("button",{type:"button",className:s.sectionDragHandle,draggable:!0,"aria-label":a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",te),disabled:K,onDragStart:()=>I(v),onDragEnd:()=>I(null),children:t.jsx(mt,{size:15,"aria-hidden":"true"})}),t.jsx("h3",{children:te}),t.jsx("span",{className:s.valueSectionCount,children:ae.length})]}),t.jsxs("div",{className:s.valueSectionHeaderActions,children:[v==="controls"&&M&&t.jsxs("div",{className:s.runtimeSettings,children:[t.jsx($e,{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("div",{className:s.runtimeApplyMode,role:"group","aria-label":a("playtest.settings.applyChangesAutomatically","Apply changes automatically"),children:[t.jsx("span",{children:a("playtest.settings.applyMode","Apply values")}),["manual","auto"].map(l=>t.jsx("button",{type:"button","aria-pressed":ee.runtimeApplyMode===l,disabled:!e.live.canMutate,onClick:()=>{ee.runtimeApplyMode!==l&&d({...ee,runtimeApplyMode:l})},children:l==="auto"?a("playtest.settings.autoMode","Automatic"):a("playtest.settings.manualMode","Manual")},l))]})}),t.jsx($e,{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.runtimeDefaultOption,children:[t.jsx("input",{type:"checkbox",checked:ee.applyDefaultsOnManualPlayStart,disabled:!e.live.canMutate,onChange:l=>d({...ee,applyDefaultsOnManualPlayStart:l.target.checked})}),t.jsx("span",{children:a("playtest.settings.applyDefaultsOnPlayStart","Apply saved defaults when Play starts")})]})})]}),D&&t.jsx("button",{type:"button",className:s.sectionMoveButton,disabled:K,"aria-label":a(L[0]===v?"playtest.values.moveDown":"playtest.values.moveUp",L[0]===v?"Move {{label}} down":"Move {{label}} up").replace("{{label}}",te),onClick:()=>m(v),children:L[0]===v?t.jsx(rt,{size:14,"aria-hidden":"true"}):t.jsx(yt,{size:14,"aria-hidden":"true"})})]})]}),ae.length===0?t.jsx("div",{className:s.panelEmpty,children:v==="watches"?a("playtest.watch.empty","Observed values appear here during Play."):a("playtest.controls.empty","No test controls in this profile yet.")}):t.jsx("div",{className:v==="watches"?s.watchValueGrid:s.controlValueList,children:Array.from(fe.entries()).map(([l,u])=>{const S=w.has(`${v}:${l}`),O=t.jsx("div",{className:s.valueGroupRows,children:u.map(U=>C(U,ae))});return fe.size===1&&l===ie?t.jsx("div",{className:s.valueGroup,children:O},`${v}:${l}`):t.jsxs("section",{className:s.valueGroup,children:[t.jsxs("button",{type:"button",className:s.valueGroupToggle,"aria-expanded":!S,"aria-label":`${S?a("playtest.values.expandGroup","Expand"):a("playtest.values.collapseGroup","Collapse")} ${l}`,onClick:()=>x(`${v}:${l}`),children:[t.jsx("span",{children:l}),t.jsx("span",{children:u.length})]}),!S&&O]},`${v}:${l}`)})})]},v)};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:i,onChange:v=>{n(v.target.value),_(0)},placeholder:a("playtest.values.searchPlaceholder","Name, group, source, or path")})]}),t.jsxs("button",{type:"button",className:s.secondaryAction,"aria-expanded":T,"aria-controls":"playtest-value-filters",onClick:()=>F(v=>!v),children:[a("playtest.values.filters","Filters"),he?` (${[i.trim()!=="",o!=="all",c!=="all",f!=="all"].filter(Boolean).length})`:""]})]}),T&&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:o,onChange:v=>{p(v.target.value),_(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.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:c,onChange:v=>{h(v.target.value),_(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:f,onChange:v=>{g(v.target.value),_(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.allGroups","All groups")}),z.groups.map(v=>t.jsx("option",{value:v,children:v},v))]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.pageSize","Rows")}),t.jsxs("select",{"aria-label":a("playtest.values.pageSize","Rows"),value:E,onChange:v=>{y(Number(v.target.value)),_(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(z.total)).replace("{{total}}",String(ve))}),t.jsx("button",{type:"button",className:s.secondaryAction,disabled:K||ve===0,onClick:()=>{if(D){ue(!1);return}he&&(n(""),p("all"),h("all"),g("all"),_(0)),ue(!0)},children:D?a("playtest.values.doneLayout","Done editing layout"):he?a("playtest.values.editFullList","Edit full list"):a("playtest.values.editLayout","Edit layout")})]}),D&&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:oe}),J&&t.jsx("div",{className:s.layoutError,role:"alert",children:J}),z.total===0&&ve>0?t.jsx("div",{className:s.panelEmpty,children:a("playtest.values.noResults","No values match these filters.")}):t.jsx("div",{className:s.valueSections,children:L.map(B)}),z.pages>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:z.safePage===0,onClick:()=>_(v=>v-1),children:a("playtest.values.previous","Previous")}),t.jsxs("span",{children:[z.safePage+1," / ",z.pages]}),t.jsx("button",{type:"button",disabled:z.safePage+1>=z.pages,onClick:()=>_(v=>v+1),children:a("playtest.values.next","Next")})]})]})}function xo(e){var h,f;const{live:a}=e,{t:i}=ye(),n=((h=a.lease)==null?void 0:h.state)==="active"&&(a.studioState==="Running"||a.studioState==="Paused"),o=n&&a.canMutate,p=o&&(a.studioMode!=="run"||!!((f=a.profile)!=null&&f.controls.some(g=>g.target.role==="server"))),c=e.inactiveReason??i("playtest.values.playRequired","Start Play in Studio to change test values.");return t.jsxs("div",{className:s.liveWorkspace,role:"tabpanel","aria-label":i("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:i("playtest.profile.label","Test profiles")}),t.jsx("span",{children:i("playtest.profile.savedCount","{{count}} profiles saved").replace("{{count}}",String(a.profiles.length))})]}),t.jsxs("select",{id:"playtest-profile",value:a.selectedProfileId??"",disabled:!!a.lease,onChange:g=>a.selectProfile(g.target.value),children:[a.profiles.length===0&&t.jsx("option",{value:"",children:i("playtest.profile.empty","No profiles yet")}),a.profiles.map(g=>t.jsx("option",{value:g.id,children:g.name},g.id))]})]}),t.jsxs("div",{className:s.profileActions,children:[t.jsxs("button",{type:"button",className:s.primaryAction,onClick:e.onManageValues,children:[t.jsx(ra,{size:14,"aria-hidden":"true"})," ",i("playtest.values.addValue","Add value")]}),t.jsxs("button",{type:"button",className:s.secondaryAction,disabled:!a.profile||!!a.lease,onClick:e.onEditProfile,children:[t.jsx(ua,{size:14,"aria-hidden":"true"})," ",i("playtest.profile.edit","Edit profile")]}),t.jsxs("button",{type:"button",className:s.secondaryAction,disabled:!!a.lease,onClick:e.onNewProfile,children:[t.jsx(Ct,{size:14,"aria-hidden":"true"})," ",i("playtest.profile.new","New profile")]})]})]}),t.jsx("div",{className:s.liveGrid,children:t.jsxs("section",{className:`${s.livePanel} ${s.valueWorkspacePanel}`,"data-runtime-state":n?"active":"inactive",children:[t.jsxs("header",{className:s.valueWorkspaceHeader,children:[t.jsxs("div",{children:[t.jsx("strong",{children:i("playtest.values.title","Test values")}),!o&&t.jsxs("span",{className:s.controlAvailability,"data-warning":a.studioState==="Edit",id:"playtest-controls-availability",role:"status",children:[a.studioState==="Edit"&&t.jsx(ha,{size:14,"aria-hidden":"true"}),c]})]}),t.jsx($e,{active:p,label:i("playtest.session.reset","Reset all"),reason:c,children:t.jsxs("button",{type:"button",className:s.resetAction,disabled:!p,"aria-describedby":p?void 0:"playtest-controls-availability",onClick:()=>void a.resetAll(),children:[a.canMutate?t.jsx(ma,{size:14,"aria-hidden":"true"}):t.jsx(ca,{size:14,"aria-hidden":"true"}),i("playtest.session.reset","Reset all")]})})]}),t.jsx(go,{live:a,active:o,inactiveReason:c})]})})]})}const st={label:"",role:"server",path:"Workspace",accessKind:"attribute",fieldName:"",editorType:"number",defaultValue:"0",minimum:"0",maximum:"100",step:"1"};function bo(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"binding"}function gt(e){const a=e.split(".").map(i=>i.trim()).filter(Boolean);return a.length>0?{root:a[0],segments:a.slice(1)}:null}function Le(e){return e==="range"?"number":e}function _o(e){var i;if(Ve(Le(e.editorType)))return ut(Le(e.editorType),e.defaultValue)??null;if(e.editorType==="enum")return((i=e.enumValues)==null?void 0:i.find(n=>String(n)===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 xt(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName.trim()}}function jo(e){var o,p;const a=e.path?[e.path.root,...e.path.segments].join("."):"adapter",i=e.access.kind==="value"?"Value":e.access.name??e.access.kind,n="constraints"in e&&((o=e.constraints)==null?void 0:o.minimum)!==void 0&&((p=e.constraints)==null?void 0:p.maximum)!==void 0;return`${e.target.role} · ${a} · ${i} · ${n?"range":e.valueType}`}function So(e){var z,ve,he,pe,xe;const{t:a}=ye(),i=!!e.profile,[n,o]=r.useState(""),[p,c]=r.useState([]),[h,f]=r.useState([]),[g,w]=r.useState({}),[N,b]=r.useState("controls"),[_,E]=r.useState(!1),[y,T]=r.useState(st),[F,L]=r.useState(!1),[P,k]=r.useState(!1),[$,A]=r.useState(null),[I,J]=r.useState(null),G=r.useRef(null);r.useEffect(()=>{var d,m,j,R;e.open&&(o(((d=e.profile)==null?void 0:d.name)??""),c(((m=e.profile)==null?void 0:m.controls)??[]),f(((j=e.profile)==null?void 0:j.watches)??[]),w(((R=e.profile)==null?void 0:R.presentation)??{}),b("controls"),E(!1),T(st),k(!1),J(null),A(null))},[e.open,e.profile]);const D=N==="controls"?p:h,ue=n!==(((z=e.profile)==null?void 0:z.name)??"")||JSON.stringify(p)!==JSON.stringify(((ve=e.profile)==null?void 0:ve.controls)??[])||JSON.stringify(h)!==JSON.stringify(((he=e.profile)==null?void 0:he.watches)??[])||JSON.stringify(g)!==JSON.stringify(((pe=e.profile)==null?void 0:pe.presentation)??{})||_,K=r.useMemo(()=>new Set([...p,...h].map(d=>d.id)),[p,h]),q=(d,m)=>{T(j=>({...j,[d]:m})),A(null)},oe=()=>{const d=bo(y.label);let m=d,j=2;for(;K.has(m);)m=`${d}-${j}`,j+=1;return m},W=(d,m)=>g[d]??{order:m,pinned:!1},X=(d,m,j)=>w(R=>({...R,[d]:{...W(d,m),...j}})),ge=D.map((d,m)=>({binding:d,sourceOrder:m,entry:W(d.id,m)})).sort((d,m)=>d.entry.order-m.entry.order),H=(d,m)=>{const j=ge.findIndex(C=>C.binding.id===d),R=ge[j+m],x=ge[j];!x||!R||w(C=>({...C,[x.binding.id]:{...x.entry,order:R.entry.order},[R.binding.id]:{...R.entry,order:x.entry.order}}))},V=()=>{const d=gt(y.path),m=_o(y);if(!y.label.trim()||!d||y.accessKind!=="value"&&!y.fieldName.trim()||m===null)return null;const j=y.editorType==="range",R=Number(y.minimum),x=Number(y.maximum),C=Number(y.step);return j&&(typeof m!="number"||!Number.isFinite(R)||!Number.isFinite(x)||!Number.isFinite(C)||R>=x||C<=0||m<R||m>x)?null:{id:oe(),label:y.label.trim(),target:{role:y.role},path:d,access:xt(y),valueType:Le(y.editorType),value:m,...y.editorType==="enum"?{enumValues:y.enumValues}:{},applyTiming:"after_agents_ready",restorePolicy:"session_end",...j?{constraints:{minimum:R,maximum:x,step:C}}:{}}},Y=()=>{const d=gt(y.path);return!y.label.trim()||!d||y.accessKind!=="value"&&!y.fieldName.trim()?null:{id:oe(),label:y.label.trim(),target:{role:y.role},path:d,access:xt(y),valueType:Le(y.editorType)}},je=()=>{const d=N==="controls"?V():Y();if(!d){A(a("playtest.profile.binding.invalid","Complete the label, path, field, and type values."));return}N==="controls"?c(m=>[...m,d]):f(m=>[...m,d]),w(m=>({...m,[d.id]:{order:p.length+h.length,pinned:!1}})),E(!1),T(st)},ee=async()=>{if(e.onResolveSelectionCandidates){try{const m=await e.onResolveSelectionCandidates();if(!m.selected.path||m.candidates.length===0){A(a("playtest.profile.binding.selectionEmpty","The selected instance has no supported fields."));return}J(m),me(m,0)}catch(m){A(m instanceof Error?m.message:String(m))}return}if(!e.onResolveSelection)return;const d=N==="controls"?V():Y();if(!d){A(a("playtest.profile.binding.selectionNeedsFields","Enter the label, field, and type before using the Studio selection."));return}try{const m=await e.onResolveSelection({kind:N==="controls"?"control":"watch",id:d.id,label:d.label,role:d.target.role,access:d.access,valueType:d.valueType,..."value"in d?{value:d.value}:{},..."constraints"in d&&d.constraints?{constraints:d.constraints}:{},..."enumValues"in d&&d.enumValues?{enumValues:d.enumValues}:{}});m.path&&q("path",[m.path.root,...m.path.segments].join("."))}catch(m){A(m instanceof Error?m.message:String(m))}},me=(d,m)=>{const j=d.candidates[m];if(!j||!d.selected.path)return;const R=j.fieldName??"Value";T(x=>({...x,label:`${d.selected.name??"Selected"} ${R}`,path:[d.selected.path.root,...d.selected.path.segments].join("."),accessKind:j.accessKind,fieldName:j.fieldName??"",editorType:j.valueType,defaultValue:typeof j.value=="object"?JSON.stringify(j.value):String(j.value),enumValues:j.enumValues})),A(null)},M=async()=>{if(!(!e.profile||!e.onSave||!n.trim())){L(!0),A(null);try{await e.onSave({...e.profile,name:n.trim(),controls:p,watches:h,presentation:g}),e.onClose()}catch(d){A(d instanceof Error?d.message:String(d))}finally{L(!1)}}},ie=()=>{if(!F){if(ue){k(!0);return}e.onClose()}};return t.jsxs(Fe,{open:e.open,onClose:ie,dismissDisabled:F,initialFocusRef:G,ariaLabel:i?a("playtest.profile.editTitle","Edit test profile"):a("playtest.profile.createTitle","Create test profile"),children:[t.jsxs("div",{className:`${s.profileDialog} ${i?s.profileEditorDialog:""}`,children:[t.jsx(Ge,{title:i?a("playtest.profile.editTitle","Edit test profile"):a("playtest.profile.createTitle","Create test profile"),description:i?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:F,onRequestClose:ie}),t.jsxs("div",{className:s.profileDialogBody,children:[t.jsxs("label",{children:[a("playtest.profile.name","Profile name"),t.jsx("input",{ref:G,value:n,onChange:d=>o(d.target.value)})]}),i&&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":N==="controls",onClick:()=>{b("controls"),E(!1)},children:[a("playtest.profile.controlsTab","Controls")," ",t.jsx("span",{children:p.length})]}),t.jsxs("button",{type:"button",role:"tab","aria-selected":N==="watches",onClick:()=>{b("watches"),E(!1)},children:[a("playtest.profile.watchesTab","Watch Values")," ",t.jsx("span",{children:h.length})]})]}),t.jsx("div",{className:s.bindingList,children:D.length===0?t.jsx("div",{className:s.bindingEmpty,children:N==="controls"?a("playtest.profile.controlsEmpty","No controls added yet."):a("playtest.profile.watchesEmpty","No Watch Values added yet.")}):ge.map(({binding:d,entry:m,sourceOrder:j},R)=>t.jsxs("div",{className:s.bindingItem,children:[t.jsxs("div",{className:s.bindingItemCopy,children:[t.jsx("strong",{children:d.label}),t.jsx("span",{children:jo(d)}),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}}",d.label),value:m.group??"",onChange:x=>X(d.id,j,{group:x.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}}",d.label),checked:m.pinned,onChange:x=>X(d.id,j,{pinned:x.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}}",d.label),disabled:R===0,onClick:()=>H(d.id,-1),children:t.jsx(ea,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":a("playtest.profile.moveDown","Move {{label}} down").replace("{{label}}",d.label),disabled:R===ge.length-1,onClick:()=>H(d.id,1),children:t.jsx(Xt,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button",className:s.bindingDelete,"aria-label":a("playtest.profile.removeBinding","Remove {{label}}").replace("{{label}}",d.label),onClick:()=>{N==="controls"?c(x=>x.filter(C=>C.id!==d.id)):f(x=>x.filter(C=>C.id!==d.id)),w(x=>Object.fromEntries(Object.entries(x).filter(([C])=>C!==d.id)))},children:t.jsx(Jt,{size:14,"aria-hidden":"true"})})]})]},d.id))}),_?t.jsxs("fieldset",{className:s.bindingForm,"aria-label":N==="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 ee(),children:a("playtest.profile.binding.useSelection","Use current Studio selection")}),I&&I.candidates.length>1&&t.jsxs("label",{children:[a("playtest.profile.binding.selectedField","Selected field"),t.jsx("select",{onChange:d=>me(I,Number(d.target.value)),children:I.candidates.map((d,m)=>t.jsx("option",{value:m,children:d.accessKind==="value"?"ValueBase.Value":`${d.accessKind} · ${d.fieldName}`},`${d.accessKind}:${d.fieldName??"Value"}`))})]}),t.jsxs("div",{className:s.bindingFormGrid,children:[t.jsxs("label",{children:[a("playtest.profile.binding.label","Label"),t.jsx("input",{value:y.label,onChange:d=>q("label",d.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.role","Target"),t.jsxs("select",{value:y.role,onChange:d=>q("role",d.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:y.path,placeholder:a("playtest.profile.binding.pathPlaceholder","Workspace.Config"),onChange:d=>q("path",d.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.access","Access"),t.jsxs("select",{value:y.accessKind,onChange:d=>q("accessKind",d.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")})]})]}),y.accessKind!=="value"&&t.jsxs("label",{children:[a("playtest.profile.binding.field","Field name"),t.jsx("input",{value:y.fieldName,onChange:d=>q("fieldName",d.target.value)})]}),t.jsxs("label",{children:[N==="controls"?a("playtest.profile.binding.inputType","Input type"):a("playtest.profile.binding.valueType","Value type"),t.jsxs("select",{value:y.editorType,onChange:d=>q("editorType",d.target.value),children:[t.jsx("option",{value:"number",children:a("playtest.profile.binding.number","Number")}),N==="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")}),y.enumValues&&t.jsx("option",{value:"enum",children:a("playtest.profile.binding.enum","Enum")})]})]}),N==="controls"&&Ve(Le(y.editorType))&&t.jsx(ot,{type:Le(y.editorType),draft:y.defaultValue,label:a("playtest.profile.binding.defaultValue","Default value"),onChange:d=>q("defaultValue",d)}),N==="controls"&&y.editorType==="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("select",{value:y.defaultValue,onChange:d=>q("defaultValue",d.target.value),children:(xe=y.enumValues)==null?void 0:xe.map(d=>t.jsx("option",{value:String(d),children:String(d)},String(d)))})]}),N==="controls"&&!Ve(Le(y.editorType))&&y.editorType!=="boolean"&&y.editorType!=="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("input",{type:y.editorType==="string"?"text":"number",value:y.defaultValue,onChange:d=>q("defaultValue",d.target.value)})]}),N==="controls"&&y.editorType==="boolean"&&t.jsxs("label",{className:s.bindingBooleanDefault,children:[t.jsx("input",{type:"checkbox","aria-label":a("playtest.profile.binding.defaultValue","Default value"),checked:y.defaultValue==="true",onChange:d=>q("defaultValue",String(d.target.checked))}),t.jsx("span",{children:a("playtest.profile.binding.defaultValue","Default value")})]}),N==="controls"&&y.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:y.minimum,onChange:d=>q("minimum",d.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.maximum","Maximum"),t.jsx("input",{type:"number",value:y.maximum,onChange:d=>q("maximum",d.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.step","Step"),t.jsx("input",{type:"number",value:y.step,onChange:d=>q("step",d.target.value)})]})]})]}),$&&t.jsx("div",{className:s.bindingError,role:"alert",children:$}),t.jsxs("div",{className:s.bindingFormActions,children:[t.jsx("button",{type:"button",className:s.secondaryAction,onClick:()=>{E(!1),A(null)},children:a("common.cancel","Cancel")}),t.jsx("button",{type:"button",className:s.primaryAction,onClick:je,children:a("playtest.profile.binding.add","Add to profile")})]})]}):t.jsxs("button",{type:"button",className:s.addBindingButton,onClick:()=>E(!0),children:[t.jsx(Ct,{size:14,"aria-hidden":"true"})," ",N==="controls"?a("playtest.profile.addControl","Add control"):a("playtest.profile.addWatch","Add watch")]})]}),$&&!_&&t.jsx("div",{className:s.bindingError,role:"alert",children:$})]}),t.jsxs("div",{className:s.profileDialogActions,children:[t.jsx("button",{type:"button",className:s.secondaryAction,disabled:F,onClick:ie,children:a("common.cancel","Cancel")}),i?t.jsx("button",{type:"button",className:s.primaryAction,disabled:!n.trim()||F,onClick:()=>void M(),children:F?a("playtest.profile.saving","Saving…"):a("playtest.profile.save","Save profile")}):t.jsx("button",{type:"button",className:s.primaryAction,disabled:!n.trim()||F,onClick:async()=>{L(!0);try{await e.onCreate(n),o(""),e.onClose()}finally{L(!1)}},children:F?a("playtest.profile.creating","Creating…"):a("playtest.profile.createTitle","Create test profile")})]})]}),t.jsx(wt,{open:P,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:()=>k(!1),onConfirm:()=>{k(!1),e.onClose()}})]})}function Me(e){return`${e.accessKind}:${e.fieldName??"Value"}`}function Ue(e){return e.fieldName??"Value"}function No(e){const{t:a}=ye(),i=r.useId(),[n,o]=r.useState(!1),[p,c]=r.useState(""),h=r.useRef(null),f=r.useRef(null),g=r.useRef(null),w=p.trim().toLocaleLowerCase(),N=r.useMemo(()=>e.candidates.filter(P=>`${Ue(P)} ${P.accessKind}`.toLocaleLowerCase().includes(w)),[w,e.candidates]),b=["attribute","value","property"].map(P=>({kind:P,candidates:N.filter(k=>k.accessKind===P)})).filter(P=>P.candidates.length>0),_=Ue(e.selected);r.useEffect(()=>{var P;n&&((P=f.current)==null||P.focus())},[n]);const E=(P=!0)=>{var k;o(!1),c(""),P&&((k=h.current)==null||k.focus())},y=()=>{var P;return Array.from(((P=g.current)==null?void 0:P.querySelectorAll('[role="option"]'))??[])},T=P=>{var $;const k=y();($=k[Math.max(0,Math.min(P,k.length-1))])==null||$.focus()},F=P=>{e.onSelect(P),E()},L=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:h,type:"button",className:s.propertyPickerTrigger,disabled:e.disabled,"aria-haspopup":"listbox","aria-expanded":n,"aria-controls":n?i:void 0,"aria-label":`${a("playtest.values.propertyPickerAction","Select property")}: ${_}`,onClick:()=>{n?E(!1):o(!0)},children:[t.jsx("span",{children:_}),t.jsx(rt,{size:16,"aria-hidden":"true"})]}),n&&t.jsxs("div",{ref:g,className:s.propertyPickerPanel,onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),E())},children:[t.jsxs("div",{className:s.propertyPickerSearchRow,children:[t.jsxs("label",{children:[a("playtest.values.searchProperties","Search properties"),t.jsx("input",{ref:f,type:"search",value:p,onChange:P=>c(P.target.value),onKeyDown:P=>{P.key==="ArrowDown"&&(P.preventDefault(),T(0))}})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.propertyPickerClose","Close property picker"),onClick:()=>E(),children:t.jsx(Nt,{size:16,"aria-hidden":"true"})})]}),t.jsxs("div",{id:i,className:s.propertyPickerList,role:"listbox","aria-label":a("playtest.values.availableProperties","Available properties"),children:[b.map(P=>t.jsxs("div",{className:s.propertyPickerGroup,role:"group","aria-label":L(P.kind),children:[t.jsx("span",{children:L(P.kind)}),P.candidates.map(k=>{const $=Me(k)===Me(e.selected);return t.jsxs("div",{role:"option",tabIndex:0,"aria-selected":$,"aria-label":Ue(k),className:s.propertyPickerOption,onClick:()=>F(k),onKeyDown:A=>{var G;const J=y().indexOf(A.currentTarget);A.key==="ArrowDown"&&(A.preventDefault(),T(J+1)),A.key==="ArrowUp"&&(A.preventDefault(),J===0?(G=f.current)==null||G.focus():T(J-1)),(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),F(k))},children:[t.jsx("span",{children:Ue(k)}),t.jsx("small",{children:k.valueType}),$&&t.jsx(Yt,{size:15,"aria-hidden":"true"})]},Me(k))})]},P.kind)),N.length===0&&t.jsx("p",{role:"status",children:a("playtest.values.noProperties","No matching properties")})]})]})]})}const bt=`local RunService = game:GetService("RunService")
72
- local Workspace = game:GetService("Workspace")
73
-
74
- local function requireStudioSession(context)
75
- assert(RunService:IsStudio(), "Test Adapter is only available in Studio")
76
- assert(type(context) == "table" and type(context.sessionId) == "string", "Active WEPPY test session is required")
77
- end
78
-
79
- return {
80
- schemaVersion = 1,
81
- name = "combat-test-values",
82
- version = "1.0.0",
83
- studioOnly = true,
84
- methods = {
85
- enemyCount = {
86
- argsSchema = { type = "object", properties = {}, additionalProperties = false },
87
- timeoutSeconds = 2,
88
- sideEffectClass = "read_only",
89
- run = function(context)
90
- requireStudioSession(context)
91
- local enemies = Workspace:FindFirstChild("Enemies")
92
- return enemies and #enemies:GetChildren() or 0
93
- end,
94
- },
95
- },
96
- dashboard = {
97
- schemaVersion = 1,
98
- entries = {{
99
- id = "enemy-count",
100
- label = "Enemy count",
101
- group = "Combat",
102
- kind = "watch",
103
- valueType = "number",
104
- read = { method = "enemyCount", arguments = {}, pollIntervalMs = 1000 },
105
- }},
106
- },
107
- }`;function wo(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"value"}function nt(e,a){const i=new Set([...e.controls,...e.watches].map(p=>p.id));let n=a,o=2;for(;i.has(n);)n=`${a}-${o}`,o+=1;return n}function _t(e){return`adapter-${e.adapter}-${e.id}`.toLowerCase().replace(/[^a-z0-9-]+/g,"-")}function Co(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName}}function ct(e){return e.fieldName??"Value"}function jt(e,a){return`${e.selected.name??"Selected"} ${ct(a)}`}function lt(e,a,i,n){const o=a.selected.path;return!e||!o?!1:(n==="watch"?e.watches:e.controls).some(p=>{var c;return p.target.role==="server"&&((c=p.path)==null?void 0:c.root)===o.root&&JSON.stringify(p.path.segments)===JSON.stringify(o.segments)&&p.access.kind===i.accessKind&&(i.accessKind==="value"||p.access.name===i.fieldName)})}function it(e,a,i){var n,o;return JSON.stringify([(n=e.selected.path)==null?void 0:n.root,(o=e.selected.path)==null?void 0:o.segments,a.accessKind,a.fieldName??"value",i])}function St(e,a){var n;if(e instanceof It&&((n=e.error)!=null&&n.trim()))return e.error;const i=e instanceof Error?e.message:String(e);return i.startsWith("API ")?`${a} ${i}`:i}function Ro(e){var ae,fe,te,le;const{t:a,locale:i="en"}=ye(),[n,o]=r.useState("selection"),[p,c]=r.useState(""),[h,f]=r.useState(0),[g,w]=r.useState("My test profile"),[N,b]=r.useState(!e.profile),[_,E]=r.useState(null),[y,T]=r.useState(""),[F,L]=r.useState(!1),[P,k]=r.useState(null),[$,A]=r.useState(null),I=r.useRef(!1),J=r.useRef({open:!1,profileId:null}),[G,D]=r.useState(null),[ue,K]=r.useState(null),[q,oe]=r.useState(null),[W,X]=r.useState(!1),[ge,H]=r.useState(null),V=P??e.profile,Y=((ae=e.catalog.adapters)==null?void 0:ae.find(l=>l.name===ge))??null,ee=[Y?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}}",Y.name).replace("{{path}}",Y.sourcePath??Y.name).replace("{{methods}}",Y.methods.map(l=>`${l.name} (${l.sideEffectClass})`).join(", ")):"",a("playtest.values.aiRequest")].filter(Boolean).join(`
108
-
109
- `);r.useEffect(()=>{var O;const l=J.current,u=((O=e.profile)==null?void 0:O.id)??null;J.current={open:e.open,profileId:u};const S=l.open&&l.profileId===null&&u!==null&&I.current;!e.open||S||l.open&&l.profileId===u||(o("selection"),b(!e.profile),c(""),f(0),E(null),T(""),k(null),A(null),K(null),D(null),X(!1),H(null))},[e.open,(fe=e.profile)==null?void 0:fe.id]);const me=r.useMemo(()=>{const l=p.trim().toLocaleLowerCase();return e.catalog.entries.filter(u=>!l||[u.label,u.group,u.adapter,u.sourcePath,u.id].filter(Boolean).join(" ").toLocaleLowerCase().includes(l))},[e.catalog.entries,p]),M=((_==null?void 0:_.candidates)??[]).find(l=>Me(l)===y)??(_==null?void 0:_.candidates[0]),ie=Math.max(1,Math.ceil(me.length/50)),z=Math.min(h,ie-1),ve=me.slice(z*50,(z+1)*50),he=new Set([...(V==null?void 0:V.controls)??[],...(V==null?void 0:V.watches)??[]].map(l=>l.origin?`${l.origin.adapter}/${l.origin.entryId}`:"")),pe=[...(V==null?void 0:V.controls)??[],...(V==null?void 0:V.watches)??[]],xe=pe.filter(l=>l.access.kind==="adapter"||l.access.kind==="adapter_read").length,d=pe.length-xe,m=d>=64,j=xe>=10,R=((te=e.catalog.adapters)==null?void 0:te.filter(l=>l.entryCount===0))??[],x=!!(e.catalog.catalogRevision&&e.catalog.verifiedAt&&!Number.isNaN(Date.parse(e.catalog.verifiedAt))),C=x&&e.catalog.verifiedAt?new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e.catalog.verifiedAt)):null,B=l=>{o(l),c(""),f(0)},Z=async()=>{if(V)return V;if(e.activeLease)throw new Error(a("playtest.values.stopBeforeCreate","Stop Studio Play before creating the first profile."));if(!e.onCreateProfile||!g.trim())throw new Error(a("playtest.values.profileNameRequired","Enter a profile name before adding the first value."));return e.onCreateProfile(g.trim())},ce=async l=>{if(e.activeLease){k(l);return}await e.onSave(l),k(null)},Pe=async(l,u)=>{if(!I.current){I.current=!0,A(`adapter:${l.id}`),K(null);try{const S=await Z(),O={kind:"adapter",adapter:l.adapter,entryId:l.id,version:l.adapterVersion},U=se=>{var _e;return((_e=se.origin)==null?void 0:_e.adapter)===l.adapter&&se.origin.entryId===l.id};u?await ce({...S,controls:S.controls.filter(se=>!U(se)),watches:S.watches.filter(se=>!U(se))}):l.kind==="watch"?await ce({...S,schemaVersion:3,watches:[...S.watches,{id:nt(S,_t(l)),label:l.label,target:{role:"server"},access:{kind:"adapter_read",adapter:l.adapter,...l.read},valueType:l.valueType,origin:O}]}):l.write&&await ce({...S,schemaVersion:3,controls:[...S.controls,{id:nt(S,_t(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:O}]})}catch(S){K(S instanceof Error?S.message:String(S))}finally{I.current=!1,A(null)}}},Se=async(l,u,S)=>{if(!l.selected.path||F||I.current||lt(V,l,u,S))return;const O=it(l,u,S);I.current=!0,A(O),K(null),D(null);try{const U=await Z(),se=jt(l,u),ne={id:nt(U,`direct-${wo([l.selected.path.root,...l.selected.path.segments,ct(u)].join("-"))}`),label:se,target:{role:"server"},path:l.selected.path,access:Co(u),valueType:u.valueType};S==="watch"?await ce({...U,schemaVersion:3,watches:[...U.watches,ne]}):await ce({...U,schemaVersion:3,controls:[...U.controls,{...ne,...u.enumValues?{enumValues:u.enumValues}:{},applyOnStart:!1,applyTiming:"after_agents_ready",restorePolicy:"session_end"}]})}catch(U){D({key:O,kind:S,message:St(U,a("playtest.profile.saveFailed","Could not save profile."))})}finally{I.current=!1,A(null)}},Ae=async()=>{if(!(!e.onResolveSelectionCandidates||F||I.current)){L(!0),K(null),D(null);try{const l=await e.onResolveSelectionCandidates();E(l),T(l.candidates[0]?Me(l.candidates[0]):""),(!l.selected.path||l.candidates.length===0)&&K(a("playtest.values.selectionEmpty","Select an Instance with a supported Attribute, Value, or property in Studio."))}catch(l){E(null),K(St(l,a("playtest.values.selectionFailed","Could not read the Studio selection. Select one Instance in Explorer and try again.")))}finally{L(!1)}}},Ee=async()=>{if(!(!P||e.activeLease||I.current)){I.current=!0,A("pending"),K(null);try{await e.onSave(P),k(null)}catch(l){K(l instanceof Error?l.message:String(l))}finally{I.current=!1,A(null)}}},v=async(l,u)=>{var S;await((S=navigator.clipboard)==null?void 0:S.writeText(u)),oe(l)},Q=[{id:"selection",label:a("playtest.values.sourceSelection","Studio selection")},{id:"registered",label:a("playtest.values.sourceRegistered","Test Adapter")}];return t.jsx(Fe,{open:e.open,ariaLabel:a("playtest.values.addTitle","Add a test value"),onClose:e.onClose,dismissDisabled:$!==null,children:t.jsxs("div",{className:s.valueManagerShell,children:[t.jsx(Ge,{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:$!==null,onRequestClose:e.onClose}),t.jsx("div",{className:s.valueSourceTabs,role:"tablist","aria-label":a("playtest.values.sources","Value source"),children:Q.map((l,u)=>t.jsx("button",{type:"button",role:"tab","aria-selected":n===l.id,"aria-controls":`playtest-value-source-${l.id}`,tabIndex:n===l.id?0:-1,onClick:()=>B(l.id),onKeyDown:S=>{var _e,ne;if(S.key!=="ArrowLeft"&&S.key!=="ArrowRight")return;S.preventDefault();const O=S.key==="ArrowRight"?1:-1,U=(u+O+Q.length)%Q.length,se=Q[U];if(se){B(se.id);const de=(_e=S.currentTarget.parentElement)==null?void 0:_e.querySelectorAll('[role="tab"]');(ne=de==null?void 0:de[U])==null||ne.focus()}},children:l.label},l.id))}),t.jsxs("div",{className:s.valueManagerBody,children:[N&&t.jsxs("label",{className:s.firstProfileName,children:[t.jsx("span",{children:a("playtest.profile.name","Profile name")}),t.jsx("input",{value:((le=e.profile)==null?void 0:le.name)??g,readOnly:!!e.profile,"aria-label":a("playtest.profile.name","Profile name"),onChange:l=>w(l.target.value)}),t.jsx("small",{children:a("playtest.values.firstProfileHint","The first value and this profile are saved together for the selected Place.")})]}),e.activeLease&&t.jsx("div",{className:s.inlineNotice,role:"status",children:P?a("playtest.values.draftReady","This change is kept as a draft. Save it after Studio Play stops."):a("playtest.values.stopBeforeSave","You can prepare changes now. Save the active profile after Studio Play stops.")}),t.jsx("div",{className:s.subscriptionUsage,role:"status",children:a("playtest.values.subscriptionUsage","Runtime subscriptions · Direct {{direct}}/64 · Adapter {{adapter}}/10").replace("{{direct}}",String(d)).replace("{{adapter}}",String(xe))}),n==="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||F||$!==null,onClick:()=>void Ae(),children:F?a("playtest.values.readingSelection","Reading selection…"):a("playtest.values.readSelection","Read current Studio selection")})]}),(_==null?void 0:_.selected.path)&&_.candidates.length>0&&t.jsxs("div",{className:s.propertySelection,"aria-busy":F,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:_.selected.name??"Selected"}),_.selected.className&&t.jsx("span",{children:_.selected.className}),t.jsxs("details",{children:[t.jsx("summary",{children:a("playtest.values.location","Location")}),t.jsx("code",{children:[_.selected.path.root,..._.selected.path.segments].join(".")})]})]}),M&&t.jsx(No,{candidates:_.candidates,selected:M,disabled:F||$!==null,onSelect:l=>T(Me(l))})]}),(M?[M]:[]).map(l=>{const u=jt(_,l),S=ct(l),O=G&&G.key===it(_,l,G.kind)?G:null;return t.jsxs("div",{className:s.candidateEntry,children:[t.jsxs("div",{className:s.catalogRow,children:[t.jsxs("div",{children:[t.jsxs("strong",{children:[_.selected.name??"Selected"," · ",S]}),t.jsxs("span",{children:[a("playtest.values.actualNow","Actual now"),": ",We(l.value)]})]}),t.jsx("div",{className:s.candidateActions,children:["watch","control"].map(U=>{const se=lt(V,_,l,U),_e=se&&!lt(e.profile,_,l,U),ne=$===it(_,l,U),de=U==="watch"?a("playtest.values.addWatch","Add as Watch Value"):a("playtest.values.addControl","Add as Control"),re=U==="watch"?a("playtest.values.addedWatch","Added as Watch Value"):a("playtest.values.addedControl","Added as Control"),be=U==="watch"?a("playtest.values.pendingWatch","Watch Value · save pending"):a("playtest.values.pendingControl","Control · save pending"),ke=a("playtest.values.adding","Adding…"),Te=ne?ke:_e?be:se?re:de,Ye=U==="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":ne?"saving":_e?"pending":se?"saved":"idle",disabled:F||!se&&(m||!V&&e.activeLease),"aria-disabled":se||$!==null||void 0,"aria-label":se||ne?`${Te} · ${u}`:Ye.replace("{{label}}",u),onClick:()=>void Se(_,l,U),children:[[de,`✓ ${re}`,be,ke].map(pt=>t.jsx("span",{className:s.candidateActionSizer,"aria-hidden":"true",children:pt},pt)),t.jsx("span",{className:s.candidateActionLabel,"aria-live":"polite","aria-atomic":"true",children:se&&!_e&&!ne?`✓ ${Te}`:Te})]},U)})})]}),O&&t.jsxs("div",{className:s.candidateError,role:"alert",children:[t.jsx("span",{children:O.message}),t.jsx("button",{type:"button",disabled:$!==null,onClick:()=>void Se(_,l,O.kind),children:a("playtest.values.retryAddition","Try again")})]})]},`${l.accessKind}:${S}`)})]})]}),n==="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.")}),C&&t.jsx("span",{children:a("playtest.values.lastChecked","Last checked: {{time}}").replace("{{time}}",C)})]}),R.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.")})]}),R.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(u=>t.jsxs("span",{children:[u.name," · ",u.sideEffectClass==="read_only"?a("playtest.values.methodReadOnly","Read only"):a("playtest.values.methodReversible","Reversible fixture")]},u.name))})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.configureAdapterLabel","Configure values for {{adapter}}").replace("{{adapter}}",l.name),onClick:()=>{H(l.name),X(!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:p,onChange:l=>{c(l.target.value),f(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(me.length)).replace("{{total}}",String(e.catalog.entries.length))}),ve.length>0?t.jsx("div",{className:s.catalogGroups,children:ve.map(l=>{const u=he.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"):a("playtest.values.watch","Watch")]}),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:u?V==null?void 0:V.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 v(`remove:${l.adapter}/${l.id}`,`Review removal of the WEPPY Playtest adapter registration ${l.adapter}/${l.id}.
110
-
111
- - Call manage_studio.playtest_adapter_plan with adapterOperation=remove_entry, adapterId=${l.adapter}, and adapterRegistrationId=${l.id}.
112
- - Show the current source SHA-256, unified diff, profile and scenario usages, dynamic-reference coverage, and production exclusion strategy.
113
- - Do not change source until I review the plan.
114
- - Apply only the returned unexpired plan token and expected source hash.
115
- - After apply, start a new Play and confirm the catalog no longer includes this entry.`),children:q===`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:$!==null||!u&&j||!V&&e.activeLease,"aria-label":u?`${a("playtest.values.remove","Remove")} ${l.label} ${a("playtest.values.fromProfile","from profile")}`:`${a("playtest.values.add","Add")} ${l.label}`,onClick:()=>void Pe(l,u),children:u?a("playtest.values.removeFromProfile","Remove from profile"):$===`adapter:${l.id}`?a("playtest.profile.saving","Saving…"):a("playtest.values.add","Add")})]},`${l.adapter}/${l.id}`)})}):e.catalog.entries.length===0&&R.length===0?t.jsxs("div",{className:s.registeredEmpty,children:[t.jsx("strong",{children:x?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:x?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:()=>B("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:()=>{c(""),f(0)},children:a("playtest.values.clearSearch","Clear search")})]}):null,ie>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:z===0,onClick:()=>f(l=>l-1),children:a("playtest.values.previous","Previous")}),t.jsxs("span",{children:[z+1," / ",ie]}),t.jsx("button",{type:"button",disabled:z+1>=ie,onClick:()=>f(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:W,onToggle:l=>X(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.")}),Y&&t.jsx("p",{className:s.adapterSetupContext,children:a("playtest.values.configuringAdapter","Configuring {{adapter}} using its detected methods.").replace("{{adapter}}",Y.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:bt})]}),t.jsxs("details",{className:s.registrationExample,children:[t.jsx("summary",{children:a("playtest.values.showAiExample","Show AI request example")}),t.jsx("pre",{children:ee})]}),t.jsxs("div",{className:s.registrationActions,children:[t.jsx("button",{type:"button",onClick:()=>void v("example",bt),children:q==="example"?a("playtest.values.copied","Copied"):a("playtest.values.copyExample","Copy Luau example")}),t.jsx("button",{type:"button",onClick:()=>void v("ai",ee),children:q==="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.")})]})]})]})]}),P&&t.jsxs("div",{className:s.pendingProfileAction,children:[t.jsx("span",{children:a("playtest.values.pendingCount","Profile changes are ready to save.")}),t.jsx("button",{type:"button",className:s.primaryAction,disabled:e.activeLease||$!==null,onClick:()=>void Ee(),children:e.activeLease?a("playtest.values.stopToSave","Stop Play to save"):a("playtest.profile.save","Save profile")})]}),ue&&t.jsx("div",{className:s.bindingError,role:"alert",children:ue})]}),t.jsx("div",{className:s.valueManagerFooter,children:t.jsx("button",{type:"button",className:s.primaryAction,disabled:$!==null||P!==null||pe.length===0,onClick:e.onClose,children:a("playtest.values.viewAdded","View added values")})})]})})}const Po=`{
116
- "name": "Production",
117
- "globIgnorePaths": ["src/ServerStorage/WeppyTestAdapters/**"],
118
- "tree": {
119
- "$className": "DataModel",
120
- "ServerStorage": { "$path": "src/ServerStorage" }
121
- }
122
- }`;function ko(e){const{t:a}=ye();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")})]}),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:Po}),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 Ao(e){return e.studioState==="running"?"Running":e.studioState==="paused"?"Paused":"Edit"}function Eo(e,a){const i=((e==null?void 0:e.pluginClients)??[]).filter(o=>o.connectionState==="connected");let n;if(a!==null){const o=i.filter(p=>p.placeId===a);n=o.length===1?o[0]:void 0}else n=Mt(i,(e==null?void 0:e.studioRoutingMode)??"recentPriority",(e==null?void 0:e.pinnedTargetClientId)??null)[0];return n?{state:Ao(n),targetClientId:n.clientId,...n.studioStateUpdatedAt!==void 0?{updatedAt:n.studioStateUpdatedAt}:{},...n.playtestMode!==void 0?{mode:n.playtestMode}:{}}:{state:"Edit",targetClientId:null}}function Ho(){var j,R,x;const{t:e}=ye(),a=$t(),{trackEvent:i}=Vt(),{tier:n,loading:o}=Bt(),{level:p,status:c}=Ot(),h=!o&&n==="basic",[f,g]=r.useState(null),w=Na({enabled:!h,placeId:f}),N=Eo(c,f),b=ro({enabled:!o&&p==="studioConnected",canMutate:!h,placeId:f,studioSnapshot:N}),[_,E]=r.useState(so),[y,T]=r.useState(!1),[F,L]=r.useState(!1),[P,k]=r.useState(!1),$=r.useRef(null),[A,I]=r.useState(!1),{show:J}=Ft(),[G,D]=r.useState(null),[ue,K]=r.useState(!1),[q,oe]=r.useState(!1);r.useEffect(()=>{new URLSearchParams(a.search).get("add")==="value"&&(E("live"),L(!0))},[a.search]);const W=p==="studioConnected",X=W?b.profile?b.studioState==="Edit"?e("playtest.values.playRequired","Start Play or Run in Studio to change test values."):h?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."),ge=W?b.studioState:"Disconnected",H=r.useRef(null),{history:V,selectedReport:Y,loading:je,detailLoading:ee,detailError:me}=w,M=h?wa(e):null,ie=((j=M==null?void 0:M.history[0])==null?void 0:j.recordId)??null,z=(M==null?void 0:M.history)??V,ve=M&&G===ie?M.report:Y,he=h?!1:je,pe=z.find(C=>C.recordId===G),xe=(C,B)=>{H.current=B,D(C),!h&&w.loadReport(C)},d=r.useCallback(()=>{D(null),w.clearSelectedReport()},[w.clearSelectedReport]),m=async()=>{oe(!0);try{await w.clearHistory(),J(e("toast.clearSuccess","Cleared successfully"),"success"),K(!1),D(null)}catch{J(e("toast.clearFailed","Failed to clear data"),"error")}finally{oe(!1)}};return t.jsxs("div",{className:s.page,children:[t.jsx(qt,{title:e("page.playtest.title","Playtest"),description:e("page.playtest.description","Review automated playtest runs, saved reports, and result history."),helpTopicId:"playtest",helpState:{tier:n},actions:t.jsx(Ut,{ref:$,type:"button",variant:"secondary",size:"sm",onClick:()=>k(!0),children:e("playtest.guide.open","Before publishing")})}),!o&&t.jsx(Wt,{surface:"playtest",selectable:!0,selectedPlaceId:f,onSelectedPlaceIdChange:C=>{g(C),D(null),w.clearSelectedReport()}}),!o&&t.jsxs(t.Fragment,{children:[t.jsx(oo,{value:_,onChange:C=>{E(C),no(C)}}),t.jsx(co,{lease:b.lease,profileName:(R=b.profile)==null?void 0:R.name,studioState:ge,studioMode:N.mode}),h&&t.jsx(Ht,{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:Gt.playtest}),b.error&&t.jsx("div",{className:s.inlineError,role:"alert",children:b.error}),_==="live"&&t.jsx(xo,{live:b,inactiveReason:X,onManageValues:()=>L(!0),onNewProfile:()=>{I(!1),T(!0)},onEditProfile:()=>{I(!0),T(!0)}})]}),_==="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(Kt,{label:e("playtest.history.title","Test History"),tooltip:e("playtest.history.title.tooltip","Recorded automated playtest runs for this project.")}),h?t.jsx(ze,{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"}),K(!0)},children:e("common.clear","Clear")})]}),he?t.jsx("div",{className:s.emptyState,children:e("common.loading","Loading...")}):z.length===0?t.jsxs("div",{className:s.emptyState,children:[t.jsx("div",{className:s.emptyStateTitle,children:e("playtest.empty.title","No playtest results yet")}),t.jsx("div",{className:s.emptyStateMessage,children:e("playtest.empty.message","Test results for this place will appear here after the AI Agent runs a Playtest.")})]}):t.jsx(zr,{entries:z,onSelect:xe,selectedRecordId:G??void 0})]}),t.jsx(Fe,{open:P,ariaLabel:e("playtest.guide.title","Publishing your game after playtesting"),onClose:()=>k(!1),returnFocusTo:$.current,children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(Ge,{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:()=>k(!1)}),t.jsx("div",{className:s.detailBody,children:t.jsx(ko,{showHeading:!1,hasManagedAdapterWithoutStudioGuard:((x=b.releaseGuidance)==null?void 0:x.hasManagedAdapterWithoutStudioGuard)===!0})})]})}),t.jsx(Fe,{open:G!==null,ariaLabel:e("playtest.detail.dialogLabel","Playtest report detail"),onClose:d,returnFocusTo:H.current,testId:"playtest-detail-popup-layer",children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(Ge,{title:e("playtest.report.title","Selected Report"),description:pe==null?void 0:pe.testName,closeLabel:e("common.close","Close"),onRequestClose:d}),t.jsx("div",{className:s.detailBody,children:ee?t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")}):me?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:me}),t.jsx("button",{type:"button",className:s.detailRetryButton,onClick:()=>void w.retryReport(),children:e("common.retry","Retry")})]}):ve?t.jsx(to,{report:ve}):t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")})})]})}),!o&&t.jsxs(t.Fragment,{children:[!h&&t.jsx(wt,{open:ue,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:q,onCancel:()=>!q&&K(!1),onConfirm:m}),t.jsx(So,{open:y,onClose:()=>T(!1),profile:A?b.profile:null,onCreate:b.createProfile,onSave:b.saveProfile,onResolveSelection:b.resolveSelection,onResolveSelectionCandidates:b.resolveSelectionCandidates}),t.jsx(Ro,{open:F,profile:b.profile,catalog:b.catalog,activeLease:!!b.lease,onClose:()=>L(!1),onSave:b.saveProfile,onCreateProfile:b.createProfile,onResolveSelectionCandidates:b.resolveSelectionCandidates})]})]})}export{Ho as Component};