@weppy/roblox-mcp 2.17.2 → 2.17.4

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 (49) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +4 -2
  3. package/dashboard/dist/assets/{AiPromptExamples-CJjCcxg8.js → AiPromptExamples-B3LZ06_M.js} +1 -1
  4. package/dashboard/dist/assets/AssetsPage-DBMNmn9Z.js +61 -0
  5. package/dashboard/dist/assets/ChangelogPage-D_G_HjiK.js +1 -0
  6. package/dashboard/dist/assets/{ConfirmModal-DaOuVA6n.js → ConfirmModal-CL0Z5xwJ.js} +1 -1
  7. package/dashboard/dist/assets/{ConnectionPage-BIq2TqY_.js → ConnectionPage-DaYME7QT.js} +1 -1
  8. package/dashboard/dist/assets/{ControlsPage-DqEbayDU.js → ControlsPage-gnKyi48F.js} +1 -1
  9. package/dashboard/dist/assets/CurrentPlaceScope-CHRh7s-z.js +1 -0
  10. package/dashboard/dist/assets/{GameChangeDetail-BOp_DXQ9.js → GameChangeDetail-CbYXbvWl.js} +1 -1
  11. package/dashboard/dist/assets/{InfoLabel-gl5i0JQy.js → InfoLabel-BaayM8hW.js} +1 -1
  12. package/dashboard/dist/assets/{OverviewPage-DcQz5h3p.js → OverviewPage-DuPB7VBe.js} +1 -1
  13. package/dashboard/dist/assets/{PageHeader-BkXyqPrA.js → PageHeader-C1A4pFFD.js} +2 -2
  14. package/dashboard/dist/assets/PlaceSelectOptions-DU7Ka-gE.js +1 -0
  15. package/dashboard/dist/assets/PlaytestAiPromptExamples-Bf494cNk.js +1 -0
  16. package/dashboard/dist/assets/PlaytestPage-BkuJr8Va.css +1 -0
  17. package/dashboard/dist/assets/PlaytestPage-JPS-_xPE.js +127 -0
  18. package/dashboard/dist/assets/{SettingsPage-BC0XIU-3.js → SettingsPage-Om-hGqIQ.js} +1 -1
  19. package/dashboard/dist/assets/{StatusBadge-BQsRd8hv.js → StatusBadge-CiHSf_o_.js} +1 -1
  20. package/dashboard/dist/assets/SyncPage-BTADHgCn.js +1 -0
  21. package/dashboard/dist/assets/{Tabs-Dy5daI-F.js → Tabs-C0QQfjUl.js} +1 -1
  22. package/dashboard/dist/assets/{TierPromoPanel-nA1RBcJp.js → TierPromoPanel-DI3EP06A.js} +1 -1
  23. package/dashboard/dist/assets/ToolsPage-CCsd60Kh.js +1 -0
  24. package/dashboard/dist/assets/{TooltipText-BEK9VoiS.js → TooltipText-INE_h7BS.js} +1 -1
  25. package/dashboard/dist/assets/UiStudioPage-CtSFtEbS.css +1 -0
  26. package/dashboard/dist/assets/UiStudioPage-TfbhZvt5.js +11 -0
  27. package/dashboard/dist/assets/{WhatsNewPage-DX9G9ZFd.js → WhatsNewPage-BPKMcfVs.js} +1 -1
  28. package/dashboard/dist/assets/{bot-B06rJuWg.js → bot-TMxhORyF.js} +1 -1
  29. package/dashboard/dist/assets/{check-CZ_wdz7l.js → check-C5Uo2cs_.js} +1 -1
  30. package/dashboard/dist/assets/{copy-CGFMtAPH.js → copy-BENnfclm.js} +1 -1
  31. package/dashboard/dist/assets/{index-Hgv8iCTe.js → index-ZP3F-qh6.js} +71 -263
  32. package/dashboard/dist/assets/{sample-requests-DafsjfJi.js → sample-requests-DVllzgEu.js} +1 -1
  33. package/dashboard/dist/assets/{trash-2-DMQtyT_y.js → trash-2-C7bZq3Km.js} +1 -1
  34. package/dashboard/dist/assets/{useLiveUptime-C6MCUOz0.js → useLiveUptime-CBpmama-.js} +1 -1
  35. package/dashboard/dist/assets/{useSettings-DfLxtt-w.js → useSettings-Ug_fLuUn.js} +1 -1
  36. package/dashboard/dist/index.html +1 -1
  37. package/dist/index.js +179 -457
  38. package/package.json +2 -2
  39. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  40. package/dashboard/dist/assets/AssetsPage-DTiyyQxl.js +0 -61
  41. package/dashboard/dist/assets/ChangelogPage-DuuVSnIa.js +0 -1
  42. package/dashboard/dist/assets/CurrentPlaceScope-p_fkZWK9.js +0 -1
  43. package/dashboard/dist/assets/PlaytestAiPromptExamples-Ciyd-GNB.js +0 -1
  44. package/dashboard/dist/assets/PlaytestPage-C3Vjgtlg.css +0 -1
  45. package/dashboard/dist/assets/PlaytestPage-CoclFxfc.js +0 -127
  46. package/dashboard/dist/assets/SyncPage-DF2YdMPy.js +0 -1
  47. package/dashboard/dist/assets/ToolsPage-DSsqmlnt.js +0 -1
  48. package/dashboard/dist/assets/UiStudioPage-CiRNdRE-.js +0 -11
  49. package/dashboard/dist/assets/UiStudioPage-DdLVbHdA.css +0 -1
@@ -1,127 +0,0 @@
1
- import{f as Ee,j as t,X as Et,r as o,b as Ae,u as me,D as Bt,p as Ot,k as Ft,s as Ht,c as Gt,o as qt,a as Ut,e as Kt,d as zt,i as Wt,T as Yt}from"./index-Hgv8iCTe.js";import{T as Jt}from"./TierPromoPanel-nA1RBcJp.js";import{P as Qt,a as Xt}from"./PageHeader-BkXyqPrA.js";import{I as Zt}from"./InfoLabel-gl5i0JQy.js";import{C as ea}from"./CurrentPlaceScope-p_fkZWK9.js";import{T as Ze}from"./TooltipText-BEK9VoiS.js";import{C as ot}from"./ConfirmModal-DaOuVA6n.js";import{T as ta,C as Ge}from"./Tabs-Dy5daI-F.js";import{P as vt}from"./PlaytestAiPromptExamples-Ciyd-GNB.js";import{B as aa}from"./bot-B06rJuWg.js";import{T as ft}from"./trash-2-DMQtyT_y.js";import{C as sa}from"./check-CZ_wdz7l.js";import"./ConfirmModal.module-DJksQHBd.js";import"./AiPromptExamples-CJjCcxg8.js";import"./copy-CGFMtAPH.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 la=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],na=Ee("arrow-down",la);/**
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 ia=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ra=Ee("arrow-up",ia);/**
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 oa=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ct=Ee("chevron-down",oa);/**
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 ca=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],gt=Ee("chevron-up",ca);/**
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 da=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],ua=Ee("circle-dot",da);/**
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 pa=[["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"}]],bt=Ee("grip-vertical",pa);/**
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 ya=[["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"}]],ma=Ee("list-plus",ya);/**
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 ha=[["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"}]],va=Ee("lock-keyhole",ha);/**
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 fa=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],ga=Ee("mouse-pointer-click",fa);/**
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 ba=[["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"}]],_a=Ee("pencil",ba);/**
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 xa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dt=Ee("plus",xa);/**
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 ja=[["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"}]],Sa=Ee("rotate-ccw",ja);/**
62
- * @license lucide-react v1.8.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const Na=[["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"}]],wa=Ee("triangle-alert",Na),Ca="_header_6e369_1",Ra="_copy_6e369_16",Pa="_close_6e369_39",tt={header:Ca,copy:Ra,close:Pa};function qe(e){return t.jsxs("header",{className:tt.header,children:[t.jsxs("div",{className:tt.copy,children:[t.jsx("h2",{children:e.title}),e.description&&t.jsx("p",{children:e.description})]}),t.jsx("button",{type:"button",className:tt.close,"aria-label":e.closeLabel,disabled:e.closeDisabled,onClick:e.onRequestClose,children:t.jsx(Et,{size:18,"aria-hidden":"true"})})]})}const ka=5e3;function _t(e){return typeof e=="number"?{placeId:String(e)}:void 0}function Aa(e,a){return typeof a=="number"?`${e}?placeId=${encodeURIComponent(String(a))}`:e}function Ea(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 xt(e){return e instanceof Error?e.message:String(e)}function Da(e){const a=(e==null?void 0:e.enabled)??!0,i=(e==null?void 0:e.placeId)??null,[l,d]=o.useState([]),[u,c]=o.useState(a?"loading":"idle"),[b,v]=o.useState(null),[_,R]=o.useState(null),[x,S]=o.useState(a),[f,E]=o.useState(!1),[m,D]=o.useState(null),M=o.useRef(null),I=o.useRef(0),P=o.useRef(null),k=o.useCallback(async()=>{try{const G=_t(i),U=G?await Ae.get("/api/dashboard/playtest/history",G):await Ae.get("/api/dashboard/playtest/history");d(U.entries??[]),c("ready"),v(null)}catch(G){c("error"),v(xt(G))}},[i]),O=o.useCallback(async()=>{if(!a){S(!1);return}await k(),S(!1)},[a,k]),T=o.useCallback(()=>{I.current+=1,P.current=null,R(null),E(!1),D(null)},[]);o.useEffect(()=>{T()},[T,a,i]);const L=o.useCallback(async G=>{if(!a)return;P.current=G;const U=++I.current;R(null),E(!0),D(null);try{const ae=_t(i),de=`/api/dashboard/playtest/detail/${encodeURIComponent(G)}`,ne=ae?await Ae.get(de,ae):await Ae.get(de);U===I.current&&R(Ea(ne))}catch(ae){U===I.current&&D(xt(ae))}finally{U===I.current&&E(!1)}},[a,i]),ee=o.useCallback(async()=>{const G=P.current;G&&await L(G)},[L]),H=o.useCallback(async()=>{a&&(c("loading"),v(null),await k())},[a,k]),A=o.useCallback(async()=>{a&&(await Ae.post(Aa("/api/dashboard/playtest/history/clear",i)),d([]),c("ready"),v(null),T())},[T,a,i]);return o.useEffect(()=>{if(!a){S(!1),c("idle"),v(null);return}return c("loading"),v(null),O(),M.current=setInterval(O,ka),()=>{M.current&&clearInterval(M.current)}},[a,O]),{history:l,historyLoadState:u,historyError:b,selectedReport:_,loading:x,detailLoading:f,detailError:m,loadReport:L,retryReport:ee,retryHistory:H,clearSelectedReport:T,clearHistory:A}}function Ta(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
67
-
68
- - Spawn flow: PASS
69
- - HUD countdown: PASS
70
- - Wave bootstrap: PASS
71
-
72
- This is a sample preview. Live playtests and real reports are available with Pro.`),logs:e("playtest.sample.report.logs",`[sample] boot playtest preview
73
- [sample] spawn protection active
74
- [sample] hud countdown rendered
75
- [sample] wave one completed
76
- [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 Le(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 pt(e){return e==="passed"?"✓":e==="failed"||e==="timed_out"?"×":e==="cancelled"||e==="insufficient_evidence"||e==="unavailable"?"!":"–"}function Tt(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Qe(e){return JSON.stringify(e,null,2)}function It(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 Ia(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 La="_page_12t05_2",Ma="_sampleBanner_12t05_10",$a="_sampleBannerRow_12t05_22",Va="_sampleBannerMain_12t05_29",Ba="_sampleBadge_12t05_36",Oa="_sampleTitle_12t05_51",Fa="_sampleMessage_12t05_58",Ha="_sampleActions_12t05_65",Ga="_primaryAction_12t05_73",qa="_secondaryAction_12t05_74",Ua="_resetAction_12t05_75",Ka="_card_12t05_124",za="_cardHeader_12t05_131",Wa="_clearButton_12t05_144",Ya="_statusRow_12t05_173",Ja="_statusIndicator_12t05_180",Qa="_statusRunning_12t05_188",Xa="_statusPaused_12t05_193",Za="_statusNotRunning_12t05_197",es="_statusLabel_12t05_201",ts="_statusMeta_12t05_208",as="_controlButtons_12t05_214",ss="_btn_12t05_221",ls="_btnPrimary_12t05_243",ns="_btnDanger_12t05_253",is="_historyList_12t05_265",rs="_historyItem_12t05_271",os="_stepDisclosure_12t05_291",cs="_historyItemSelected_12t05_296",ds="_historyItemHeader_12t05_301",us="_historyIcon_12t05_307",ps="_historyTimestamp_12t05_312",ys="_historyName_12t05_319",ms="_recordKind_12t05_330",hs="_historyItemMeta_12t05_344",vs="_historyMode_12t05_354",fs="_historyDuration_12t05_358",gs="_historyStatus_12t05_362",bs="_status_passed_12t05_369",_s="_status_failed_12t05_373",xs="_status_running_12t05_377",js="_status_timed_out_12t05_381",Ss="_status_cancelled_12t05_385",Ns="_status_insufficient_evidence_12t05_386",ws="_historyError_12t05_390",Cs="_historyEvidence_12t05_400",Rs="_historyLimitation_12t05_410",Ps="_detailShell_12t05_421",ks="_detailHeader_12t05_429",As="_detailHeading_12t05_440",Es="_detailRecordName_12t05_451",Ds="_detailCloseButton_12t05_460",Ts="_detailRetryButton_12t05_480",Is="_detailBody_12t05_485",Ls="_detailState_12t05_494",Ms="_detailErrorTitle_12t05_505",$s="_detailErrorMessage_12t05_512",Vs="_reportContainer_12t05_534",Bs="_runSummary_12t05_540",Os="_viewerSection_12t05_541",Fs="_summaryLead_12t05_554",Hs="_summaryStatusMark_12t05_560",Gs="_viewerHeading_12t05_573",qs="_summaryName_12t05_583",Us="_summaryReason_12t05_594",Ks="_summaryFacts_12t05_601",zs="_subsectionLabel_12t05_614",Ws="_sectionHeadingRow_12t05_629",Ys="_sectionHint_12t05_637",Js="_dimensionGrid_12t05_642",Qs="_dimensionCard_12t05_649",Xs="_dimensionHeader_12t05_657",Zs="_statusMark_12t05_663",el="_dimensionName_12t05_676",tl="_requirementBadge_12t05_686",al="_dimensionStatus_12t05_694",sl="_dimensionMeta_12t05_701",ll="_tone_passed_12t05_709",nl="_tone_failed_12t05_710",il="_tone_timed_out_12t05_711",rl="_tone_cancelled_12t05_712",ol="_tone_insufficient_evidence_12t05_713",cl="_tone_unavailable_12t05_714",dl="_tone_skipped_12t05_715",ul="_tone_not_requested_12t05_716",pl="_stepList_12t05_718",yl="_stepItem_12t05_725",ml="_stepIndex_12t05_749",hl="_stepIdentity_12t05_756",vl="_stepName_12t05_763",fl="_stepMeta_12t05_773",gl="_stepStatus_12t05_774",bl="_chevron_12t05_782",_l="_chevronOpen_12t05_788",xl="_stepDetails_12t05_790",jl="_evidenceBlock_12t05_799",Sl="_evidenceLabel_12t05_803",Nl="_stepError_12t05_830",wl="_recordProblem_12t05_831",Cl="_capabilityGrid_12t05_846",Rl="_capabilityItem_12t05_853",Pl="_capabilityYes_12t05_866",kl="_capabilityNo_12t05_867",Al="_capabilityState_12t05_868",El="_limitations_12t05_870",Dl="_artifactList_12t05_871",Tl="_agentList_12t05_872",Il="_artifactDisclosures_12t05_889",Ll="_artifactDisclosure_12t05_889",Ml="_artifactButton_12t05_903",$l="_artifactContent_12t05_928",Vl="_limitationItem_12t05_948",Bl="_reportContextPanel_12t05_965",Ol="_reportContextRow_12t05_975",Fl="_reportContextLabel_12t05_983",Hl="_reportSection_12t05_991",Gl="_reportSectionHeader_12t05_997",ql="_reportMarkdown_12t05_1009",Ul="_reportLogs_12t05_1022",Kl="_emptyState_12t05_1037",zl="_emptyStateTitle_12t05_1044",Wl="_emptyStateMessage_12t05_1052",Yl="_upgradePanel_12t05_1061",Jl="_upgradePanelIcon_12t05_1069",Ql="_upgradePanelTitle_12t05_1074",Xl="_upgradePanelDesc_12t05_1082",Zl="_benefitList_12t05_1092",en="_benefitItem_12t05_1103",tn="_upgradeActions_12t05_1118",an="_workspaceTabs_12t05_1124",sn="_sessionHelp_12t05_1137",ln="_stopAction_12t05_1143",nn="_controlEditor_12t05_1144",rn="_profileToolbar_12t05_1146",on="_profileDialog_12t05_1147",cn="_sessionBar_12t05_1152",dn="_sessionIdentity_12t05_1165",un="_sessionActions_12t05_1195",pn="_profileActions_12t05_1196",yn="_profileDialogActions_12t05_1197",mn="_liveWorkspace_12t05_1238",hn="_profileLabelRow_12t05_1254",vn="_profileHint_12t05_1262",fn="_actualValue_12t05_1271",gn="_watchReading_12t05_1272",bn="_liveGrid_12t05_1308",_n="_livePanel_12t05_1315",xn="_panelEmpty_12t05_1352",jn="_controlAvailability_12t05_1358",Sn="_controlGate_12t05_1361",Nn="_controlGateTrigger_12t05_1364",wn="_controlGateHint_12t05_1366",Cn="_editorLabel_12t05_1367",Rn="_editorHeading_12t05_1368",Pn="_savedValueState_12t05_1369",kn="_valueToolbar_12t05_1373",An="_valueFilters_12t05_1383",En="_valuePagination_12t05_1390",Dn="_valueListStatus_12t05_1391",Tn="_valueCount_12t05_1392",In="_layoutHint_12t05_1394",Ln="_srOnly_12t05_1395",Mn="_unifiedValueRows_12t05_1396",$n="_liveRows_12t05_1397",Vn="_watchRows_12t05_1397",Bn="_valueGroup_12t05_1398",On="_valueGroupToggle_12t05_1400",Fn="_valueGroupRows_12t05_1406",Hn="_controlRow_12t05_1406",Gn="_watchRow_12t05_1397",qn="_historyBrowser_12t05_1411",Un="_historyToolbar_12t05_1412",Kn="_rowIdentity_12t05_1436",zn="_freshness_12t05_1439",Wn="_presentationMeta_12t05_1460",Yn="_rowFeedback_12t05_1461",Jn="_controlEditorRow_12t05_1467",Qn="_controlActions_12t05_1468",Xn="_applyOnStartOption_12t05_1471",Zn="_valueDetails_12t05_1473",ei="_valueDetailButton_12t05_1479",ti="_valueDetailShell_12t05_1482",ai="_valueDetailBody_12t05_1483",si="_valueDetailList_12t05_1484",li="_valueDetailActions_12t05_1488",ni="_valueDetailFeedback_12t05_1489",ii="_defaultValueEditor_12t05_1492",ri="_defaultBooleanEditor_12t05_1496",oi="_booleanEditor_12t05_1499",ci="_rangeEditor_12t05_1508",di="_valueWorkspacePanel_12t05_1523",ui="_valueWorkspaceHeader_12t05_1524",pi="_valueSections_12t05_1525",yi="_valueSection_12t05_1525",mi="_valueSectionHeader_12t05_1527",hi="_valueSectionHeading_12t05_1528",vi="_valueSectionCount_12t05_1530",fi="_valueSectionHeaderActions_12t05_1531",gi="_sectionDragHandle_12t05_1532",bi="_sectionMoveButton_12t05_1533",_i="_valueReorderControls_12t05_1534",xi="_dragHandle_12t05_1536",ji="_runtimeSettings_12t05_1548",Si="_runtimeApplyMode_12t05_1549",Ni="_runtimeDefaultOption_12t05_1556",wi="_layoutError_12t05_1562",Ci="_controlValueList_12t05_1563",Ri="_watchValueGrid_12t05_1564",Pi="_valueEntryShell_12t05_1565",ki="_watchCardMain_12t05_1577",Ai="_watchDetails_12t05_1584",Ei="_deploymentGuide_12t05_1616",Di="_deploymentScope_12t05_1628",Ti="_deploymentLifecycle_12t05_1631",Ii="_deploymentNotice_12t05_1632",Li="_deploymentChecklist_12t05_1634",Mi="_deploymentDescription_12t05_1638",$i="_deploymentDetails_12t05_1641",Vi="_inlineError_12t05_1661",Bi="_profileEditorDialog_12t05_1664",Oi="_profileDialogBody_12t05_1665",Fi="_profileDeleteAction_12t05_1668",Hi="_profileDeleteReason_12t05_1669",Gi="_bindingTabs_12t05_1670",qi="_bindingList_12t05_1674",Ui="_bindingEmpty_12t05_1675",Ki="_bindingItem_12t05_1676",zi="_bindingItemCopy_12t05_1681",Wi="_bindingPresentation_12t05_1682",Yi="_bindingPin_12t05_1685",Ji="_bindingItemActions_12t05_1687",Qi="_bindingDelete_12t05_1691",Xi="_addBindingButton_12t05_1693",Zi="_bindingForm_12t05_1694",er="_bindingFormGrid_12t05_1695",tr="_bindingBooleanDefault_12t05_1698",ar="_bindingPathField_12t05_1700",sr="_rangeFields_12t05_1701",lr="_selectionButton_12t05_1702",nr="_bindingFormActions_12t05_1703",ir="_bindingError_12t05_1704",rr="_valueManagerShell_12t05_1705",or="_valueSourceTabs_12t05_1706",cr="_valueManagerBody_12t05_1710",dr="_valueSourcePanel_12t05_1711",ur="_registeredIntro_12t05_1712",pr="_registeredEmpty_12t05_1716",yr="_registeredSteps_12t05_1719",mr="_registeredEmptyActions_12t05_1722",hr="_adapterSetupList_12t05_1727",vr="_adapterSetupRow_12t05_1731",fr="_adapterMethods_12t05_1738",gr="_connectionGuide_12t05_1739",br="_registrationGuide_12t05_1742",_r="_adapterSetupContext_12t05_1743",xr="_valueSearch_12t05_1744",jr="_firstProfileName_12t05_1745",Sr="_sourceIntro_12t05_1749",Nr="_catalogGroups_12t05_1753",wr="_catalogRow_12t05_1754",Cr="_candidateActions_12t05_1762",Rr="_candidateEntry_12t05_1764",Pr="_propertySelection_12t05_1765",kr="_propertySelectionHeader_12t05_1766",Ar="_selectedInstance_12t05_1767",Er="_propertyPickerLabel_12t05_1768",Dr="_propertyPicker_12t05_1768",Tr="_propertyPickerTrigger_12t05_1774",Ir="_propertyPickerPanel_12t05_1776",Lr="_propertyPickerSearchRow_12t05_1778",Mr="_propertyPickerList_12t05_1782",$r="_propertyPickerGroup_12t05_1784",Vr="_propertyPickerOption_12t05_1787",Br="_compoundEditor_12t05_1793",Or="_compoundCoordinates_12t05_1794",Fr="_colorSwatch_12t05_1801",Hr="_candidateAction_12t05_1762",Gr="_candidateActionSizer_12t05_1818",qr="_candidateError_12t05_1822",Ur="_valueManagerFooter_12t05_1824",Kr="_catalogDetails_12t05_1825",zr="_inlineNotice_12t05_1834",Wr="_subscriptionUsage_12t05_1835",Yr="_pendingProfileAction_12t05_1836",Jr="_registrationExample_12t05_1841",Qr="_registrationActions_12t05_1844",s={page:La,sampleBanner:Ma,sampleBannerRow:$a,sampleBannerMain:Va,sampleBadge:Ba,sampleTitle:Oa,sampleMessage:Fa,sampleActions:Ha,primaryAction:Ga,secondaryAction:qa,resetAction:Ua,card:Ka,cardHeader:za,clearButton:Wa,statusRow:Ya,statusIndicator:Ja,statusRunning:Qa,statusPaused:Xa,statusNotRunning:Za,statusLabel:es,statusMeta:ts,controlButtons:as,btn:ss,btnPrimary:ls,btnDanger:ns,historyList:is,historyItem:rs,stepDisclosure:os,historyItemSelected:cs,historyItemHeader:ds,historyIcon:us,historyTimestamp:ps,historyName:ys,recordKind:ms,historyItemMeta:hs,historyMode:vs,historyDuration:fs,historyStatus:gs,status_passed:bs,status_failed:_s,status_running:xs,status_timed_out:js,status_cancelled:Ss,status_insufficient_evidence:Ns,historyError:ws,historyEvidence:Cs,historyLimitation:Rs,detailShell:Ps,detailHeader:ks,detailHeading:As,detailRecordName:Es,detailCloseButton:Ds,detailRetryButton:Ts,detailBody:Is,detailState:Ls,detailErrorTitle:Ms,detailErrorMessage:$s,reportContainer:Vs,runSummary:Bs,viewerSection:Os,summaryLead:Fs,summaryStatusMark:Hs,viewerHeading:Gs,summaryName:qs,summaryReason:Us,summaryFacts:Ks,subsectionLabel:zs,sectionHeadingRow:Ws,sectionHint:Ys,dimensionGrid:Js,dimensionCard:Qs,dimensionHeader:Xs,statusMark:Zs,dimensionName:el,requirementBadge:tl,dimensionStatus:al,dimensionMeta:sl,tone_passed:ll,tone_failed:nl,tone_timed_out:il,tone_cancelled:rl,tone_insufficient_evidence:ol,tone_unavailable:cl,tone_skipped:dl,tone_not_requested:ul,stepList:pl,stepItem:yl,stepIndex:ml,stepIdentity:hl,stepName:vl,stepMeta:fl,stepStatus:gl,chevron:bl,chevronOpen:_l,stepDetails:xl,evidenceBlock:jl,evidenceLabel:Sl,stepError:Nl,recordProblem:wl,capabilityGrid:Cl,capabilityItem:Rl,capabilityYes:Pl,capabilityNo:kl,capabilityState:Al,limitations:El,artifactList:Dl,agentList:Tl,artifactDisclosures:Il,artifactDisclosure:Ll,artifactButton:Ml,artifactContent:$l,limitationItem:Vl,reportContextPanel:Bl,reportContextRow:Ol,reportContextLabel:Fl,reportSection:Hl,reportSectionHeader:Gl,reportMarkdown:ql,reportLogs:Ul,emptyState:Kl,emptyStateTitle:zl,emptyStateMessage:Wl,upgradePanel:Yl,upgradePanelIcon:Jl,upgradePanelTitle:Ql,upgradePanelDesc:Xl,benefitList:Zl,benefitItem:en,upgradeActions:tn,workspaceTabs:an,sessionHelp:sn,stopAction:ln,controlEditor:nn,profileToolbar:rn,profileDialog:on,sessionBar:cn,sessionIdentity:dn,sessionActions:un,profileActions:pn,profileDialogActions:yn,liveWorkspace:mn,profileLabelRow:hn,profileHint:vn,actualValue:fn,watchReading:gn,liveGrid:bn,livePanel:_n,panelEmpty:xn,controlAvailability:jn,controlGate:Sn,controlGateTrigger:Nn,controlGateHint:wn,editorLabel:Cn,editorHeading:Rn,savedValueState:Pn,valueToolbar:kn,valueFilters:An,valuePagination:En,valueListStatus:Dn,valueCount:Tn,layoutHint:In,srOnly:Ln,unifiedValueRows:Mn,liveRows:$n,watchRows:Vn,valueGroup:Bn,valueGroupToggle:On,valueGroupRows:Fn,controlRow:Hn,watchRow:Gn,historyBrowser:qn,historyToolbar:Un,rowIdentity:Kn,freshness:zn,presentationMeta:Wn,rowFeedback:Yn,controlEditorRow:Jn,controlActions:Qn,applyOnStartOption:Xn,valueDetails:Zn,valueDetailButton:ei,valueDetailShell:ti,valueDetailBody:ai,valueDetailList:si,valueDetailActions:li,valueDetailFeedback:ni,defaultValueEditor:ii,defaultBooleanEditor:ri,booleanEditor:oi,rangeEditor:ci,valueWorkspacePanel:di,valueWorkspaceHeader:ui,valueSections:pi,valueSection:yi,valueSectionHeader:mi,valueSectionHeading:hi,valueSectionCount:vi,valueSectionHeaderActions:fi,sectionDragHandle:gi,sectionMoveButton:bi,valueReorderControls:_i,dragHandle:xi,runtimeSettings:ji,runtimeApplyMode:Si,runtimeDefaultOption:Ni,layoutError:wi,controlValueList:Ci,watchValueGrid:Ri,valueEntryShell:Pi,watchCardMain:ki,watchDetails:Ai,deploymentGuide:Ei,deploymentScope:Di,deploymentLifecycle:Ti,deploymentNotice:Ii,deploymentChecklist:Li,deploymentDescription:Mi,deploymentDetails:$i,inlineError:Vi,profileEditorDialog:Bi,profileDialogBody:Oi,profileDeleteAction:Fi,profileDeleteReason:Hi,bindingTabs:Gi,bindingList:qi,bindingEmpty:Ui,bindingItem:Ki,bindingItemCopy:zi,bindingPresentation:Wi,bindingPin:Yi,bindingItemActions:Ji,bindingDelete:Qi,addBindingButton:Xi,bindingForm:Zi,bindingFormGrid:er,bindingBooleanDefault:tr,bindingPathField:ar,rangeFields:sr,selectionButton:lr,bindingFormActions:nr,bindingError:ir,valueManagerShell:rr,valueSourceTabs:or,valueManagerBody:cr,valueSourcePanel:dr,registeredIntro:ur,registeredEmpty:pr,registeredSteps:yr,registeredEmptyActions:mr,adapterSetupList:hr,adapterSetupRow:vr,adapterMethods:fr,connectionGuide:gr,registrationGuide:br,adapterSetupContext:_r,valueSearch:xr,firstProfileName:jr,sourceIntro:Sr,catalogGroups:Nr,catalogRow:wr,candidateActions:Cr,candidateEntry:Rr,propertySelection:Pr,propertySelectionHeader:kr,selectedInstance:Ar,propertyPickerLabel:Er,propertyPicker:Dr,propertyPickerTrigger:Tr,propertyPickerPanel:Ir,propertyPickerSearchRow:Lr,propertyPickerList:Mr,propertyPickerGroup:$r,propertyPickerOption:Vr,compoundEditor:Br,compoundCoordinates:Or,colorSwatch:Fr,candidateAction:Hr,candidateActionSizer:Gr,candidateError:qr,valueManagerFooter:Ur,catalogDetails:Kr,inlineNotice:zr,subscriptionUsage:Wr,pendingProfileAction:Yr,registrationExample:Jr,registrationActions:Qr};function Ue(e){return e.trim().toLowerCase()}function Xr(e){switch(Ue(e)){case"passed":return"✓";case"failed":case"timed_out":return"×";case"running":return"◔";case"cancelled":case"insufficient_evidence":return"!";default:return"–"}}function Zr(e,a){switch(Ue(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 eo(e,a){const i=Ue(a);return i==="running"?e("playtest.history.status.running","Running"):Le(e,i)}function to(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ao(e){const a=/^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})$/.exec(e);if(a){const[,l,d,u,c,b,v]=a,_=new Date(Date.UTC(Number(l),Number(d)-1,Number(u),Number(c),Number(b),Number(v)));return _.getUTCFullYear()===Number(l)&&_.getUTCMonth()===Number(d)-1&&_.getUTCDate()===Number(u)&&_.getUTCHours()===Number(c)&&_.getUTCMinutes()===Number(b)&&_.getUTCSeconds()===Number(v)?_:null}const i=Date.parse(e);return Number.isNaN(i)?null:new Date(i)}function so(e,a){const i=ao(e);return i?new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"short"}).format(i):e}function lo({entries:e,onSelect:a,selectedRecordId:i}){const{t:l,locale:d}=me(),[u,c]=o.useState(""),[b,v]=o.useState("all"),[_,R]=o.useState(0),x=o.useMemo(()=>{const m=u.trim().toLocaleLowerCase();return e.filter(D=>(b==="all"||Ue(D.status)===b)&&(!m||[D.testName,D.status,D.mode,D.recordKind].join(" ").toLocaleLowerCase().includes(m)))},[e,u,b]),S=Math.max(1,Math.ceil(x.length/50)),f=Math.min(_,S-1),E=x.slice(f*50,(f+1)*50);return e.length===0?t.jsx("div",{className:s.emptyState,children:l("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:l("playtest.history.search","Search test results")}),t.jsx("input",{type:"search",value:u,onChange:m=>{c(m.target.value),R(0)}})]}),t.jsxs("label",{children:[t.jsx("span",{children:l("playtest.history.filter","Result")}),t.jsxs("select",{value:b,onChange:m=>{v(m.target.value),R(0)},children:[t.jsx("option",{value:"all",children:l("playtest.history.filterAll","All results")}),t.jsx("option",{value:"passed",children:l("playtest.result.status.passed","Passed")}),t.jsx("option",{value:"failed",children:l("playtest.result.status.failed","Failed")}),t.jsx("option",{value:"insufficient_evidence",children:l("playtest.result.status.insufficientEvidence","Insufficient evidence")}),t.jsx("option",{value:"timed_out",children:l("playtest.result.status.timedOut","Timed out")})]})]})]}),t.jsx("div",{className:s.valueCount,role:"status",children:l("playtest.history.filteredCount","{{visible}} of {{total}} results").replace("{{visible}}",String(x.length)).replace("{{total}}",String(e.length))}),t.jsx("div",{className:s.historyList,children:E.map(m=>{const D=m.recordId===i;return t.jsxs("button",{className:`${s.historyItem} ${D?s.historyItemSelected:""}`,onClick:M=>a(m.recordId,M.currentTarget),"aria-current":D?"true":void 0,"aria-haspopup":"dialog",children:[t.jsxs("div",{className:s.historyItemHeader,children:[t.jsx("span",{className:s.historyIcon,children:Xr(m.status)}),t.jsx("span",{className:s.historyTimestamp,children:so(m.timestamp,d)}),t.jsx("span",{className:s.historyName,children:m.testName}),t.jsx("span",{className:s.recordKind,children:m.recordKind==="structured"?l("playtest.history.kind.structured","Structured"):m.recordKind==="legacy"?l("playtest.history.kind.legacy","Legacy"):l("playtest.history.kind.attention","Needs attention")})]}),t.jsxs("div",{className:s.historyItemMeta,children:[t.jsx(Ze,{text:l("playtest.history.mode.tooltip","Playtest mode used for this recorded test run."),children:t.jsxs("span",{className:s.historyMode,children:[l("playtest.history.mode","Mode"),": ",Zr(l,m.mode)]})}),t.jsx("span",{className:s.historyDuration,children:to(m.durationMs)}),t.jsx(Ze,{text:l("playtest.history.status.tooltip","Recorded result state for this automated playtest run."),children:t.jsx("span",{className:`${s.historyStatus} ${s[`status_${Ue(m.status)}`]??""}`,children:eo(l,m.status)})})]}),m.evidenceSummary&&t.jsxs("div",{className:s.historyEvidence,children:[t.jsxs("span",{children:[l("playtest.dimension.server","Server"),": ",Le(l,m.evidenceSummary.server.status)]}),t.jsxs("span",{children:[l("playtest.dimension.clientUi","Client UI"),": ",Le(l,m.evidenceSummary.clientUi.status)]}),m.agentCounts&&t.jsx("span",{children:l("playtest.history.agentCounts","Server {server} · Client {client}").replace("{server}",String(m.agentCounts.server)).replace("{client}",String(m.agentCounts.client))})]}),m.errorMessage&&t.jsx("div",{className:s.historyError,children:m.errorMessage}),!m.errorMessage&&m.limitation&&t.jsx("div",{className:s.historyLimitation,children:It(l,m.limitation.code,m.limitation.message)})]},m.recordId)})}),S>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:f===0,onClick:()=>R(m=>m-1),children:l("playtest.values.previous","Previous")}),t.jsxs("span",{children:[f+1," / ",S]}),t.jsx("button",{type:"button",disabled:f+1>=S,onClick:()=>R(m=>m+1),children:l("playtest.values.next","Next")})]})]})}function at({label:e,open:a,onToggle:i,children:l,tooltip:d}){const u=o.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":u,children:[d?t.jsx(Ze,{text:d,children:t.jsx("span",{children:e})}):t.jsx("span",{children:e}),t.jsx("span",{"aria-hidden":"true",className:`${s.chevron} ${a?s.chevronOpen:""}`,children:"⌄"})]}),a&&t.jsx("div",{className:s.artifactContent,id:u,children:l})]})}function no({detail:e}){const{t:a}=me(),[i,l]=o.useState(()=>new Set(e.recordKind==="legacy"?["report","logs"]:[])),d=b=>l(v=>{const _=new Set(v);return _.has(b)?_.delete(b):_.add(b),_}),u=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!u&&!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:[u&&t.jsx(at,{label:a("playtest.artifacts.metadata","Result metadata"),open:i.has("metadata"),onToggle:()=>d("metadata"),children:t.jsx("pre",{children:Qe(u)})}),e.markdown&&t.jsx(at,{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:()=>d("report"),children:t.jsx("pre",{children:e.markdown})}),e.logs&&t.jsx(at,{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:()=>d("logs"),children:t.jsx("pre",{children:e.logs})})]}),c.map(b=>t.jsx("div",{className:s.stepError,children:b.message},`${b.code}-${b.message}`))]})}function io({result:e}){const{t:a}=me(),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(([l,d])=>t.jsxs("div",{className:s.capabilityItem,children:[t.jsx("span",{className:d?s.capabilityYes:s.capabilityNo,"aria-hidden":"true",children:d?"✓":"–"}),t.jsx("span",{children:l}),t.jsx("span",{className:s.capabilityState,children:d?a("playtest.capability.available","Available"):a("playtest.capability.unavailable","Unavailable")})]},l))}),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((l,d)=>{const u=typeof l.agentId=="string"?l.agentId:`${a("playtest.agents.unknown","Agent")} ${d+1}`,c=typeof l.role=="string"?l.role:"unknown",b=typeof l.clientId=="string"?` · ${l.clientId}`:"";return t.jsxs("code",{children:[u," · ",c,b]},`${u}-${d}`)})]}),e.limitations.length>0&&t.jsxs("div",{className:s.limitations,children:[t.jsx("div",{className:s.subsectionLabel,children:a("playtest.limitations.title","Limitations")}),e.limitations.map(l=>t.jsxs("div",{className:s.limitationItem,children:["! ",It(a,l.code,l.message)]},l.code))]})]})}const ro=["server","clientUi","interaction","visual"];function oo({result:e}){const{t:a}=me(),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:ro.map(l=>{const d=e.dimensions[l];return t.jsxs("div",{className:s.dimensionCard,children:[t.jsxs("div",{className:s.dimensionHeader,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${d.status}`]??""}`,"aria-hidden":"true",children:pt(d.status)}),t.jsx("span",{className:s.dimensionName,children:i[l]}),t.jsx("span",{className:s.requirementBadge,children:d.required?a("playtest.dimension.required","Required"):a("playtest.dimension.optional","Optional")})]}),t.jsx("div",{className:s.dimensionStatus,children:Le(a,d.status)}),d.provider&&t.jsx("div",{className:s.dimensionMeta,children:d.provider}),d.reason&&t.jsx("div",{className:s.dimensionMeta,children:Ia(a,d.reason)}),t.jsxs("div",{className:s.dimensionMeta,children:[a("playtest.dimension.steps","Steps"),": ",d.stepIds.length]})]},l)})})]})}function co({result:e}){const{t:a}=me(),i=o.useId(),[l,d]=o.useState(()=>new Set),u=c=>{d(b=>{const v=new Set(b);return v.has(c)?v.delete(c):v.add(c),v})};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 b=l.has(c.stepId),v=`${i}-${c.index}-details`,_=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:()=>u(c.stepId),onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),u(c.stepId))},"aria-expanded":b,"aria-controls":v,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${c.status}`]??""}`,"aria-hidden":"true",children:pt(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:[_," · ",c.action," · ",Tt(c.durationMs)]})]}),t.jsx("span",{className:s.stepStatus,children:Le(a,c.status)}),t.jsx("span",{className:`${s.chevron} ${b?s.chevronOpen:""}`,"aria-hidden":"true",children:"⌄"})]}),b&&t.jsxs("div",{className:s.stepDetails,id:v,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:Qe(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:Qe(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:Qe(c.evidence)})]}),c.error&&t.jsxs("div",{className:s.stepError,children:[t.jsx("strong",{children:c.error.code})," — ",c.error.message]})]})]},c.stepId)})})]})}function uo({report:e}){var l;const{t:a}=me(),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:((l=e.error)==null?void 0:l.message)??a("playtest.record.unavailable","Result details are unavailable.")})]})}function po({report:e}){var d,u,c,b,v,_;const{t:a}=me(),i=!!((d=e.contextSummary)!=null&&d.testScenario||(u=e.contextSummary)!=null&&u.expectedBehavior||(c=e.contextSummary)!=null&&c.observedBehavior),l=e.recordKind==="structured"?e.result:void 0;return t.jsxs("div",{className:s.reportContainer,children:[l&&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_${l.overallStatus}`]??""}`,"aria-hidden":"true",children:pt(l.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:l.testName}),t.jsx("div",{className:s.summaryReason,children:l.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:Le(a,l.overallStatus)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.mode","Mode")}),t.jsx("strong",{children:l.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:Tt(l.durationMs)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.cleanup","Cleanup")}),t.jsx("strong",{children:Le(a,l.cleanup.status)})]})]})]}),t.jsx(oo,{result:l}),t.jsx(co,{result:l}),t.jsx(io,{result:l})]}),e.recordKind!=="structured"&&e.recordKind!=="legacy"&&t.jsx(uo,{report:e}),i&&t.jsxs("div",{className:s.reportContextPanel,children:[((b=e.contextSummary)==null?void 0:b.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})]}),((v=e.contextSummary)==null?void 0:v.expectedBehavior)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.expected","Expected")}),t.jsx("span",{children:e.contextSummary.expectedBehavior})]}),((_=e.contextSummary)==null?void 0:_.observedBehavior)&&t.jsxs("div",{className:s.reportContextRow,children:[t.jsx("span",{className:s.reportContextLabel,children:a("playtest.context.observed","Observed")}),t.jsx("span",{children:e.contextSummary.observedBehavior})]})]}),t.jsx(no,{detail:e},e.recordId),!l&&!e.markdown&&!e.logs&&e.recordKind==="legacy"&&t.jsx("div",{className:s.emptyState,children:a("playtest.report.empty","No report content available")})]})}function jt(e){return typeof e=="number"?{placeId:String(e)}:void 0}const Ce={listProfiles:async e=>Ae.get("/api/dashboard/playtest/control-profiles",jt(e)),liveStatus:async(e,a)=>Ae.get("/api/dashboard/playtest/live",{...jt(e)??{},...a?{leaseId:a}:{}}),liveAction:async e=>Ae.post("/api/dashboard/playtest/live",e),bindingDraft:async(e,a)=>Ae.post("/api/dashboard/playtest/binding-draft",{...e,...typeof a=="number"?{placeId:a}:{}}),bindingCandidates:async e=>Ae.post("/api/dashboard/playtest/binding-candidates",{...typeof e=="number"?{placeId:e}:{}}),saveProfile:async(e,a,i)=>Ae.put(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e.id)}`,{profile:e,expectedRevision:a,...typeof i=="number"?{placeId:i}:{}}),saveProfileMetadata:async(e,a,i,l)=>Ae.patch(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e)}/metadata`,{expectedRevision:a,...i,...typeof l=="number"?{placeId:l}:{}}),deleteProfile:async(e,a,i)=>{const l=new URLSearchParams({expectedRevision:String(a)});return i.placeId!==void 0&&l.set("placeId",String(i.placeId)),Ae.delete(`/api/dashboard/playtest/control-profiles/${encodeURIComponent(e)}?${l.toString()}`,i.clientId?{clientId:i.clientId}:void 0)}},Lt="weppy-playtest-workspace-v1",yo="weppy-playtest-profile-v1:";function Ke(){try{return window.localStorage}catch{return null}}function mo(){var e;try{const a=(e=Ke())==null?void 0:e.getItem(Lt);return a==="live"||a==="results"?a:"live"}catch{return"live"}}function ho(e){var a;try{(a=Ke())==null||a.setItem(Lt,e)}catch{}}function yt(e){return`${yo}${e}`}function vo(e){var a;if(e===null)return null;try{return((a=Ke())==null?void 0:a.getItem(yt(e)))||null}catch{return null}}function Oe(e,a){var i;if(e!==null)try{(i=Ke())==null||i.setItem(yt(e),a)}catch{}}function St(e){var a;if(e!==null)try{(a=Ke())==null||a.removeItem(yt(e))}catch{}}const ze={entries:[],diagnostics:[]},We={hasManagedAdapterWithoutStudioGuard:!1};function st(e){return typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:e instanceof Error?e.message:String(e)}function fo(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 go(e){const{enabled:a,canMutate:i,placeId:l,studioSnapshot:d}=e,[u,c]=o.useState([]),[b,v]=o.useState(!1),[_,R]=o.useState(null),[x,S]=o.useState(null),[f,E]=o.useState(ze),[m,D]=o.useState(We),[M,I]=o.useState({}),[P,k]=o.useState({}),[O,T]=o.useState(!0),[L,ee]=o.useState(null),H=o.useRef(null),A=o.useRef(null),G=o.useRef([]),U=o.useRef(!1),ae=o.useRef(Promise.resolve()),de=o.useRef(0),ne=o.useRef(0),z=o.useRef(null),Y=o.useRef(Promise.resolve()),K=o.useRef(null),$=o.useRef(l);$.current=l;const[Q,Ne]=o.useState(0);H.current=x;const X=o.useMemo(()=>u.find(r=>r.id===_)??null,[u,_]);A.current=X,G.current=u;const he=o.useCallback(()=>{k(r=>Object.fromEntries(Object.entries(r).map(([y,j])=>{const{observed:g,...w}=j;return[y,{...w,status:"unavailable",fresh:!1,...g!==void 0?{lastObserved:g}:{},reason:"session_ended"}]})))},[]),V=o.useCallback(async()=>{z.current&&(clearTimeout(z.current),z.current=null),ne.current=0;const r=H.current;if(r){H.current=null,S(null),I({}),he();try{await Ce.liveAction({action:"close",leaseId:r.leaseId,...typeof l=="number"?{placeId:l}:{}})}catch{}}},[he,l]),pe=o.useCallback(async()=>{const r=A.current;if(!(H.current||U.current)){U.current=!0;try{const y=await Ce.liveAction({action:r?"observe":"discover",...r?{profileId:r.id}:{},...typeof l=="number"?{placeId:l}:{}});H.current=y.lease,S(y.lease),y.lease.catalog&&E(y.lease.catalog),I({});const j=await Ce.liveStatus(l,y.lease.leaseId);k(Object.fromEntries(j.watches.map(g=>[g.subscriptionId,g]))),z.current&&clearTimeout(z.current),z.current=null,ne.current=0,ee(null)}catch(y){if(ee(st(y)),fo(y)&&!z.current){const j=ne.current;ne.current+=1;const g=Math.min(2e3,250*2**Math.min(j,3));z.current=setTimeout(()=>{z.current=null,Ne(w=>w+1)},g)}}finally{U.current=!1}}},[l]);o.useEffect(()=>{a||V()},[V,a]),o.useEffect(()=>()=>{V()},[V]),o.useEffect(()=>{let r=!1;return T(!0),v(!1),c([]),R(null),K.current=null,S(null),I({}),k({}),E(ze),D(We),(async()=>{const j=Ce.listProfiles(l).then(g=>{var q,ie;if(r)return;c(g.profiles),K.current=(q=g.scope)!=null&&q.placeId?{placeId:g.scope.placeId}:g.targetClientId?{clientId:g.targetClientId}:typeof l=="number"?{placeId:l}:null,E(g.catalog??ze),D(g.releaseGuidance??We);const w=vo(l),C=g.profiles.some(h=>h.id===w)?w:((ie=g.profiles[0])==null?void 0:ie.id)??null;R(C),C&&Oe(l,C),v(!0)}).catch(g=>{r||(ee(st(g)),v(!0))});try{await j}finally{r||T(!1)}})(),()=>{r=!0}},[a,l]),o.useEffect(()=>{const r=++de.current,y=a&&b&&d.targetClientId!==null&&(d.state==="Running"||d.state==="Paused");!y&&z.current&&(clearTimeout(z.current),z.current=null,ne.current=0),ae.current=ae.current.catch(()=>{}).then(async()=>{var w;if(r!==de.current)return;const j=H.current,g=((w=A.current)==null?void 0:w.id)??"__weppy_catalog__";j&&(!y||j.target.clientId!==d.targetClientId||j.profileId!==g)&&await V(),r===de.current&&y&&!H.current&&await pe()})},[V,a,pe,Q,b,_,d.state,d.mode,d.targetClientId]),o.useEffect(()=>{if(!a)return;const r=new Bt,y=r.on("playtest_watch",j=>{var w;const g=j;!(g!=null&&g.subscriptionId)||g.leaseId!==((w=H.current)==null?void 0:w.leaseId)||k(C=>{const q=C[g.subscriptionId];if(q&&g.sequence<=q.sequence&&g.sequence!==0)return C;const h=q&&g.sequence>0&&q.sequence>0&&g.sequence!==q.sequence+1?(()=>{const{observed:B,...J}=g;return{...J,status:"stale",fresh:!1,...B!==void 0?{lastObserved:B}:{},reason:"sequence_gap"}})():g;return{...C,[g.subscriptionId]:h}})});return r.connect(),()=>{y(),r.disconnect()}},[a]);const Z=o.useCallback(r=>{H.current||(R(r),Oe(l,r))},[l]),se=o.useCallback(async(r,y)=>{const j=H.current;if(!(!j||!i)){I(g=>({...g,[r]:{...g[r],status:"applying",draft:y}}));try{const g=await Ce.liveAction({action:"apply",leaseId:j.leaseId,expectedRevision:j.revision,values:{[r]:y},...typeof l=="number"?{placeId:l}:{}}),w=g.result.bindings.find(C=>C.bindingId===r);S(C=>C&&{...C,revision:g.result.revision}),I(C=>{var q,ie;return{...C,[r]:g.result.status==="applied"?{status:"applied",draft:y,requested:(w==null?void 0:w.requested)??y,observed:w==null?void 0:w.observed,original:w==null?void 0:w.original}:{...C[r],status:((q=g.result.error)==null?void 0:q.code)==="requires_adapter"?"requires_adapter":"error",draft:y,message:(ie=g.result.error)==null?void 0:ie.message}}})}catch(g){const w=typeof g=="object"&&g!==null&&"status"in g&&g.status===409;I(C=>({...C,[r]:{...C[r],status:w?"conflict":"error",draft:y,message:st(g)}}))}}},[i,l]),ve=o.useCallback(async()=>{const r=H.current;if(!r||!i)return;const y=await Ce.liveAction({action:"reset",leaseId:r.leaseId,...typeof l=="number"?{placeId:l}:{}});S(y.lease),I({})},[i,l]),oe=o.useCallback(async r=>{const y=r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||`profile-${Date.now()}`,j=await Ce.saveProfile({schemaVersion:3,id:y,name:r.trim(),controls:[],watches:[],presentation:{},settings:{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"},sectionOrder:["watches","controls"]},0,l);return c(g=>[...g,j.profile]),R(j.profile.id),Oe(l,j.profile.id),j.profile},[l]),be=o.useCallback(async r=>{const{revision:y,...j}=r,g=await Ce.saveProfile(j,y,l);c(w=>w.map(C=>C.id===g.profile.id?g.profile:C))},[l]),xe=o.useCallback(async(r,y,j)=>{if(!A.current)throw new Error("Select a test profile before saving a value.");await new Promise((w,C)=>{Y.current=Y.current.catch(()=>{}).then(async()=>{const q=A.current;if(!q)throw new Error("Select a test profile before saving a value.");const ie=await Ce.saveProfileMetadata(q.id,q.revision,{defaults:{[r]:y}},l);A.current=ie.profile,c(h=>h.map(B=>B.id===ie.profile.id?ie.profile:B))}),Y.current.then(w,C)})},[l]),je=o.useCallback(async r=>{await new Promise((y,j)=>{Y.current=Y.current.catch(()=>{}).then(async()=>{const g=A.current;if(!g)throw new Error("Select a test profile before saving display settings.");const w=await Ce.saveProfileMetadata(g.id,g.revision,r,l);A.current=w.profile,c(C=>C.map(q=>q.id===w.profile.id?w.profile:q))}),Y.current.then(y,j)})},[l]),Pe=o.useCallback(async r=>({path:(await Ce.bindingDraft(r,l)).binding.path}),[l]),fe=o.useCallback(async()=>await Ce.bindingCandidates(l),[l]),we=o.useCallback(async(r,y)=>{var q,ie;const j=K.current,g=l;if(!j)throw Object.assign(new Error("profile_scope_unavailable"),{code:"profile_scope_unavailable"});await Ce.deleteProfile(r,y,j);let w;try{w=await Ce.listProfiles(g)}catch{if($.current!==g)return{refreshFailed:!0};const h=G.current.filter(J=>J.id!==r),B=((q=h[0])==null?void 0:q.id)??null;return c(h),R(B),B?Oe(g,B):St(g),I({}),k({}),{refreshFailed:!0}}if($.current!==g)return{refreshFailed:!1};c(w.profiles),E(w.catalog??ze),D(w.releaseGuidance??We);const C=((ie=w.profiles[0])==null?void 0:ie.id)??null;return R(C),C?Oe(g,C):St(g),I({}),k({}),{refreshFailed:!1}},[l]);return{profiles:u,selectedProfileId:_,profile:X,catalog:f,releaseGuidance:m,lease:x,controls:M,watches:P,studioState:d.state,studioMode:d.mode,canMutate:i,loading:O,error:L,selectProfile:Z,apply:se,resetAll:ve,createProfile:oe,saveProfile:be,saveControlValue:xe,saveProfileMetadata:je,resolveSelection:Pe,resolveSelectionCandidates:fe,deleteProfile:we}}function bo(e){const{t:a}=me(),i=[{key:"live",label:a("playtest.view.liveSession","Test Values")},{key:"results",label:a("playtest.view.testResults","Automated Test Results")}];return t.jsx(ta,{items:i,value:e.value,onChange:e.onChange,ariaLabel:a("playtest.view.workspaceLabel","Playtest workspace"),className:s.workspaceTabs})}function _o(e){const{t:a}=me(),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),l=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(ua,{size:16,"aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("strong",{children:i}),l&&t.jsx("span",{children:l})]})]})})}function Ve(e){const{t:a}=me(),[i,l]=o.useState(!1),d=o.useRef(null),u=o.useRef(null),c=o.useRef(null),[b,v]=o.useState({top:0,left:0});return o.useLayoutEffect(()=>{var m;if(!i||e.active||!u.current||!c.current)return;const R=(((m=d.current)==null?void 0:m.querySelector("input, select, button"))??u.current).getBoundingClientRect(),x=c.current.getBoundingClientRect(),S=R.top-x.height-6,f=R.bottom+6,E=S<8&&f+x.height<=window.innerHeight-8?f:S;v({top:Math.max(8,Math.min(E,window.innerHeight-x.height-8)),left:Math.max(8,Math.min(R.left+R.width/2-x.width/2,window.innerWidth-x.width-8))})},[i,e.active,e.reason]),o.useEffect(()=>{if(!i)return;const _=()=>l(!1);return window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_)}},[i]),t.jsxs("div",{ref:d,className:s.controlGate,children:[e.children,!e.active&&t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:u,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:()=>l(!0),onFocus:()=>l(!0),onBlur:()=>l(!1),onKeyDown:_=>{_.key==="Escape"&&l(!1)}}),i&&Ot.createPortal(t.jsx("span",{ref:c,className:s.controlGateHint,style:b,role:"status",children:e.reason}),document.body)]})]})}function Mt(e){var a,i,l;return t.jsx(Ge,{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(qe,{title:e.title,description:e.description,closeLabel:e.closeLabel,onRequestClose:e.onClose}),t.jsxs("div",{className:s.valueDetailBody,children:[t.jsx("dl",{className:s.valueDetailList,children:e.items.map(d=>t.jsxs("div",{children:[t.jsx("dt",{children:d.label}),t.jsx("dd",{children:d.value})]},d.label))}),t.jsx("div",{className:s.valueDetailFeedback,"data-state":e.error?"error":((a=e.feedback)==null?void 0:a.state)??"idle",role:e.error||((i=e.feedback)==null?void 0:i.state)==="error"?"alert":"status","aria-live":"polite",children:e.error??((l=e.feedback)==null?void 0:l.message)??" "}),e.actions&&e.actions.length>0&&t.jsx("div",{className:s.valueDetailActions,children:e.actions.map(d=>{var u,c,b;return t.jsx(Ve,{active:((u=d.gate)==null?void 0:u.active)??!0,label:((c=d.gate)==null?void 0:c.label)??d.label,reason:((b=d.gate)==null?void 0:b.reason)??"",children:t.jsx("button",{type:"button",className:d.variant==="secondary"?s.secondaryAction:s.primaryAction,"aria-label":d.accessibleLabel,disabled:d.disabled,onClick:d.onClick,children:d.label})},d.accessibleLabel)})})]})]})})}function Be(e){return e==="vector3"||e==="color3"||e==="cframe"}function $t(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 mt(e,a){try{const i=JSON.parse(a),l=$t(e);if(e==="cframe"?!Array.isArray(i)||i.length!==12:!i||Array.isArray(i)||typeof i!="object"||Object.keys(i).length!==3)return;const d=l.map((u,c)=>e==="cframe"?i[c]:i[u]);if(!d.every(u=>typeof u=="number"&&Number.isFinite(u))||e==="color3"&&d.some(u=>u<0||u>1))return;if(e==="cframe"){const u=d,c=(v,_)=>u[v]*u[_]+u[v+1]*u[_+1]+u[v+2]*u[_+2],b=u[3]*(u[7]*u[11]-u[8]*u[10])-u[4]*(u[6]*u[11]-u[8]*u[9])+u[5]*(u[6]*u[10]-u[7]*u[9]);if([3,6,9].some(v=>Math.abs(c(v,v)-1)>1e-5)||[[3,6],[3,9],[6,9]].some(([v,_])=>Math.abs(c(v,_))>1e-5)||Math.abs(b-1)>1e-5)return}return i}catch{return}}function Xe(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 dt(e){const a=o.useRef(!1),i=$t(e.type);let l={};try{l=JSON.parse(e.draft)??{}}catch{}const d=i.map((v,_)=>{const R=e.type==="cframe"?l[_]:l[v];return R==null?"":String(R)}),u=(v,_)=>{const x=d.map((S,f)=>f===v?_:S).map(S=>S.trim()!==""&&!/[.eE+-]$/.test(S)&&Number.isFinite(Number(S))?Number(S):S);e.onChange(JSON.stringify(e.type==="cframe"?x:Object.fromEntries(i.map((S,f)=>[S,x[f]]))))},c=mt(e.type,e.draft),b=c&&!Array.isArray(c)&&typeof c=="object"?`#${["r","g","b"].map(v=>Math.round(Number(c[v])*255).toString(16).padStart(2,"0")).join("")}`:"#000000";return t.jsxs("div",{className:s.compoundEditor,role:"group","aria-label":e.label,onFocus:()=>{var v;return(v=e.onFocusChange)==null?void 0:v.call(e,!0)},onBlur:v=>{var _,R;v.currentTarget.contains(v.relatedTarget)||((_=e.onFocusChange)==null||_.call(e,!1),a.current||(R=e.onCommit)==null||R.call(e))},onCompositionStart:()=>{a.current=!0},onCompositionEnd:()=>{a.current=!1},onKeyDown:v=>{var _;v.key==="Enter"&&!v.nativeEvent.isComposing&&!a.current&&((_=e.onCommit)==null||_.call(e))},children:[e.type==="color3"&&t.jsx("input",{className:s.colorSwatch,type:"color",value:b,disabled:e.disabled,"aria-label":`${e.label} RGB`,"aria-describedby":e.describedBy,onChange:v=>{const _=v.target.value.slice(1);e.onChange(JSON.stringify({r:parseInt(_.slice(0,2),16)/255,g:parseInt(_.slice(2,4),16)/255,b:parseInt(_.slice(4,6),16)/255}))}}),t.jsx("div",{className:s.compoundCoordinates,children:i.map((v,_)=>t.jsxs("label",{children:[t.jsxs("span",{children:[v.toUpperCase(),e.type==="color3"?" (0–1)":""]}),t.jsx("input",{inputMode:"decimal",value:d[_],disabled:e.disabled,"aria-label":`${e.label} ${v.toUpperCase()}`,"aria-describedby":e.describedBy,"aria-invalid":e.draft!==""&&c===void 0||void 0,onChange:R=>u(_,R.target.value)})]},v))})]})}function Re(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function xo(e,a,i){const l=i!=null&&i.fresh?i.observed:i==null?void 0:i.lastObserved,d=(a==null?void 0:a.draft)??l??e.value;return d===void 0?"":Re(d)}function Fe(e,a){var i;if(Be(e.valueType))return mt(e.valueType,a);if(e.valueType==="number"){if(a.trim()==="")return;const l=Number(a);return Number.isFinite(l)?l:void 0}return e.valueType==="boolean"?a==="true":e.valueType==="enum"?((i=e.enumValues)==null?void 0:i.find(l=>Re(l)===a))??a:a}function Me(e){return e&&typeof e=="object"&&!Array.isArray(e)?`object:${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${Me(e[a])}`).join(",")}`:`${typeof e}:${JSON.stringify(e)}`}function He(e){var a;return e.value!==void 0?Re(e.value):e.valueType==="boolean"?"false":e.valueType==="enum"?Re((a=e.enumValues)==null?void 0:a[0]):""}function jo(e){var l;const{t:a}=me();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=((l=e.profile.settings)==null?void 0:l.runtimeApplyMode)??"manual";return t.jsx("div",{className:s.liveRows,children:e.profile.controls.map(d=>{var u,c,b;return t.jsx(So,{control:d,active:e.active,inactiveReason:e.inactiveReason,profileSaveLocked:e.profileSaveLocked,runtimeApplyMode:i,state:e.states[d.id],watch:e.watches[`control:${d.id}`],presentation:(c=(u=e.profile)==null?void 0:u.presentation)==null?void 0:c[d.id],draftState:(b=e.drafts)==null?void 0:b[d.id],onDraftChange:e.onDraftChange,onApply:e.onApply,onSaveValue:e.onSaveValue,onRemoveValue:e.onRemoveValue},`${e.draftScope??"profile"}:${d.id}`)})})}function So(e){var be,xe,je,Pe,fe,we,r,y,j,g,w,C,q,ie,h,B,J,ge,te,ce,n;const{t:a}=me(),i=xo(e.control,e.state,e.watch),[l,d]=o.useState(i),[u,c]=o.useState(!1),[b,v]=o.useState("idle"),[_,R]=o.useState(null),[x,S]=o.useState(()=>He(e.control)),[f,E]=o.useState(e.control.value),[m,D]=o.useState(null),[M,I]=o.useState(!1),P=o.useRef(null),k=o.useRef(!1),O=o.useRef(!1),T=o.useRef(null),L=((be=e.draftState)==null?void 0:be.value)??l,ee=((xe=e.draftState)==null?void 0:xe.dirty)??u;o.useEffect(()=>{d(i),c(!1),S(He(e.control)),E(e.control.value),D(null),R(null),T.current=null},[e.control.id]),o.useEffect(()=>{S(He(e.control)),E(e.control.value)},[e.control.value]),o.useEffect(()=>{!e.draftState&&!ee&&!k.current&&d(i)},[ee,i,e.draftState]),o.useEffect(()=>{var p,N,F;(((p=e.state)==null?void 0:p.status)==="error"||((N=e.state)==null?void 0:N.status)==="conflict"||((F=e.state)==null?void 0:F.status)==="requires_adapter")&&(T.current=null)},[(je=e.state)==null?void 0:je.status]);const H=()=>Fe(e.control,L),A=p=>{if(!e.active||O.current)return;const N=p??H();if(N===void 0)return;const F=Me(N);T.current!==F&&(T.current=F,e.onApply(e.control.id,N))},G=p=>{var F;d(p),c(!0),(F=e.onDraftChange)==null||F.call(e,e.control.id,p,!0);const N=Fe(e.control,p);(N===void 0||Me(N)!==T.current)&&(T.current=null)},U=async()=>{const p=Fe(e.control,x);if(!(p===void 0||!e.onSaveValue||e.profileSaveLocked||b!=="idle")){v("saving"),R(null),D(null);try{await e.onSaveValue(e.control.id,p,e.control.applyOnStart??!1),E(p),D({state:"saved",value:Re(p)})}catch(N){R(N instanceof Error?N.message:String(N))}finally{v("idle")}}},ae=async()=>{if(!(f===void 0||!e.onRemoveValue||e.profileSaveLocked||b!=="idle")){v("removing"),R(null),D(null);try{await e.onRemoveValue(e.control.id),S(He({...e.control,value:void 0})),E(void 0),D({state:"removed"})}catch(p){R(p instanceof Error?p.message:String(p))}finally{v("idle")}}},de=a("playtest.controls.inputLabel","Input value for {{label}}").replace("{{label}}",e.control.label),ne=e.active?void 0:"playtest-controls-availability",z=e.inactiveReason??a("playtest.values.playRequired","Start Play in Studio to change test values."),Y=e.control.valueType==="number"&&((Pe=e.control.constraints)==null?void 0:Pe.minimum)!==void 0&&((fe=e.control.constraints)==null?void 0:fe.maximum)!==void 0,K=(we=e.watch)!=null&&we.fresh?e.watch.observed:(r=e.watch)==null?void 0:r.lastObserved,$=(y=e.watch)!=null&&y.fresh?a("playtest.controls.currentObserved","Current value"):K!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),Q=((j=e.state)==null?void 0:j.status)??"idle",Ne=e.control.origin?`ServerStorage.WeppyTestAdapters.${e.control.origin.adapter}`:e.control.path?[e.control.path.root,...e.control.path.segments].join("."):"adapter",X=e.runtimeApplyMode==="auto",he=H(),V=Q==="applying"||Q==="pending_resume",pe=!X&&e.active&&ee&&he!==void 0&&K!==void 0&&Me(he)!==Me(K)&&Me(he)!==T.current&&!V,Z=f===void 0?a("playtest.controls.noSavedValue","No saved default"):Re(f),se=a("playtest.controls.defaultInputLabel","Saved default for {{label}}").replace("{{label}}",e.control.label);let ve;Be(e.control.valueType)?ve=t.jsx(dt,{type:e.control.valueType,draft:L,label:de,disabled:!e.active,describedBy:ne,onChange:G,onFocusChange:p=>{k.current=p},onCommit:()=>{X&&A()}}):e.control.valueType==="boolean"?ve=t.jsxs("label",{className:s.booleanEditor,children:[t.jsx("input",{type:"checkbox",checked:L==="true",disabled:!e.active,"aria-label":de,"aria-describedby":ne,onFocus:()=>{k.current=!0},onBlur:()=>{k.current=!1},onChange:p=>{const N=p.target.checked;G(String(N)),X&&A(N)}}),t.jsx("span",{children:L==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?ve=t.jsx("select",{"aria-label":de,"aria-describedby":ne,value:L,disabled:!e.active,onFocus:()=>{k.current=!0},onBlur:()=>{k.current=!1},onChange:p=>{G(p.target.value);const N=Fe(e.control,p.target.value);X&&N!==void 0&&A(N)},children:(e.control.enumValues??[]).map(p=>t.jsx("option",{value:Re(p),children:Xe(p)},Re(p)))}):Y?ve=t.jsxs("div",{className:s.rangeEditor,children:[t.jsx("input",{type:"range",value:L||String(((g=e.control.constraints)==null?void 0:g.minimum)??0),min:(w=e.control.constraints)==null?void 0:w.minimum,max:(C=e.control.constraints)==null?void 0:C.maximum,step:((q=e.control.constraints)==null?void 0:q.step)??1,disabled:!e.active,"aria-label":de,"aria-describedby":ne,onFocus:()=>{k.current=!0},onBlur:()=>{k.current=!1},onChange:p=>G(p.target.value),onPointerUp:()=>{X&&A()},onKeyUp:p=>{X&&(p.key.startsWith("Arrow")||p.key==="Home"||p.key==="End")&&A()}}),t.jsx("output",{children:L||"—"})]}):ve=t.jsx("input",{value:L,disabled:!e.active,inputMode:e.control.valueType==="number"?"decimal":void 0,onFocus:()=>{k.current=!0},onChange:p=>G(p.target.value),onCompositionStart:()=>{O.current=!0},onCompositionEnd:()=>{O.current=!1},onKeyDown:p=>{X&&p.key==="Enter"&&!p.nativeEvent.isComposing&&A()},onBlur:()=>{k.current=!1,X&&A()},"aria-label":de,"aria-describedby":ne});let oe;return Be(e.control.valueType)?oe=t.jsx(dt,{type:e.control.valueType,draft:x,label:se,disabled:!e.onSaveValue||e.profileSaveLocked||b!=="idle",onChange:p=>{S(p),D(null),R(null)}}):e.control.valueType==="boolean"?oe=t.jsxs("label",{className:s.defaultBooleanEditor,children:[t.jsx("input",{type:"checkbox",checked:x==="true",disabled:!e.onSaveValue||e.profileSaveLocked||b!=="idle","aria-label":se,onChange:p=>{S(String(p.target.checked)),D(null),R(null)}}),t.jsx("span",{children:x==="true"?a("common.true","True"):a("common.false","False")})]}):e.control.valueType==="enum"?oe=t.jsx("select",{value:x,disabled:!e.onSaveValue||e.profileSaveLocked||b!=="idle","aria-label":se,onChange:p=>{S(p.target.value),D(null),R(null)},children:(e.control.enumValues??[]).map(p=>t.jsx("option",{value:Re(p),children:Xe(p)},Re(p)))}):oe=t.jsx("input",{type:e.control.valueType==="number"?"number":"text",value:x,min:(ie=e.control.constraints)==null?void 0:ie.minimum,max:(h=e.control.constraints)==null?void 0:h.maximum,step:(B=e.control.constraints)==null?void 0:B.step,disabled:!e.onSaveValue||e.profileSaveLocked||b!=="idle","aria-label":se,onChange:p=>{S(p.target.value),D(null),R(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}),(((J=e.presentation)==null?void 0:J.pinned)||((ge=e.presentation)==null?void 0:ge.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:()=>{S(He({...e.control,value:f})),D(null),R(null),I(!0)},children:a("playtest.controls.details","Value details")})]}),t.jsxs("div",{className:s.actualValue,"aria-label":`${$} ${Re(K)}`,children:[t.jsx("span",{children:$}),t.jsx("strong",{children:Xe(K)})]}),t.jsxs("div",{className:s.controlEditor,children:[t.jsxs("div",{className:s.editorHeading,children:[t.jsx("span",{className:s.editorLabel,children:a("playtest.controls.inputValue","Input value")}),t.jsxs("span",{className:s.savedValueState,title: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(Ve,{active:e.active,label:`${e.control.label} input`,reason:z,children:ve}),t.jsx("div",{className:s.controlActions,children:t.jsx(Ve,{active:e.active,label:`${e.control.label} apply`,reason:z,children:t.jsx("button",{type:"button",className:s.secondaryAction,disabled:!pe,"aria-label":a("playtest.controls.applyLabel","Apply the input value for {{label}}").replace("{{label}}",e.control.label),onClick:()=>A(),children:a("playtest.controls.applyRuntime","Apply manually")})})})]}),t.jsx("span",{className:s.rowFeedback,"data-state":_?"error":Q,"aria-live":"polite",children:_??(Q==="applying"?a("playtest.controls.applying","Applying…"):Q==="pending_resume"?a("playtest.controls.pendingResume","Apply on resume"):Q==="applied"?a("playtest.controls.applied","Applied · readback {{value}}").replace("{{value}}",Re((te=e.state)==null?void 0:te.observed)):Q==="conflict"?a("playtest.controls.conflict","Conflict · reload the current revision"):Q==="requires_adapter"?a("playtest.controls.requiresAdapter","Requires reviewed adapter"):Q==="error"?((ce=e.state)==null?void 0:ce.message)??a("playtest.controls.applyFailed","Apply failed"):e.active?X?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(Mt,{open:M,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:()=>I(!1),items:[{label:$,value:Re(K)},{label:a("playtest.controls.defaultValue","Saved default"),value:t.jsx("div",{className:s.defaultValueEditor,children:oe})},{label:a("playtest.controls.originalValue","Original runtime value"),value:Re((n=e.state)==null?void 0:n.original)},{label:a("playtest.controls.registration","Registration"),value:`${e.control.target.role} · ${e.control.access.kind}`},{label:a("playtest.values.location","Location"),value:Ne},{label:a("playtest.values.valueType","Value type"),value:e.control.valueType}],error:_,feedback:(m==null?void 0:m.state)==="saved"?{state:"success",message:a("playtest.controls.defaultSavedFeedback","Saved default {{value}} · Saved").replace("{{value}}",m.value??"")}:(m==null?void 0:m.state)==="removed"?{state:"success",message:a("playtest.controls.defaultRemovedFeedback","No saved default · Removed")}:null,actions:[{label:b==="removing"?a("playtest.controls.removingDefault","Removing…"):a("playtest.controls.removeDefault","Remove default"),accessibleLabel:a("playtest.controls.removeDefaultLabel","Remove saved default for {{label}}").replace("{{label}}",e.control.label),disabled:f===void 0||!e.onRemoveValue||e.profileSaveLocked||b!=="idle",variant:"secondary",onClick:()=>void ae()},{label:b==="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||b!=="idle"||Fe(e.control,x)===void 0,onClick:()=>void U()}]})]})}function Ye(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function No(e){var R;const{t:a}=me(),i=[...((R=e.profile)==null?void 0:R.watches.map(x=>({...x,subscriptionId:`watch:${x.id}`})))??[]],[l,d]=o.useState(null),u=o.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(x=>x.id===l),b=c?e.watches[c.subscriptionId]:void 0,v=b!=null&&b.fresh?b.observed:b==null?void 0:b.lastObserved,_=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(x=>{var D,M;const S=e.watches[x.subscriptionId],f=(M=(D=e.profile)==null?void 0:D.presentation)==null?void 0:M[x.id],E=S!=null&&S.fresh?S.observed:S==null?void 0:S.lastObserved,m=S!=null&&S.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":x.valueType,children:[t.jsxs("div",{className:s.watchCardMain,children:[t.jsx("strong",{children:x.label}),((f==null?void 0:f.pinned)||(f==null?void 0:f.group))&&t.jsxs("span",{className:s.presentationMeta,children:[f.pinned?a("playtest.values.pinned","Pinned"):"",f.pinned&&f.group?" · ":"",f.group??""]}),t.jsx("button",{type:"button",className:s.valueDetailButton,"aria-label":a("playtest.values.detailsFor","Value details for {{label}}").replace("{{label}}",x.label),onClick:I=>{u.current=I.currentTarget,d(x.id)},children:a("playtest.watch.details","Observation details")})]}),t.jsxs("div",{className:s.watchReading,children:[!(S!=null&&S.fresh)&&t.jsx("span",{children:m}),t.jsx("strong",{title:Ye(E),"aria-label":`${m} ${Ye(E)}`,children:Ye(E)})]}),S&&S.status!=="fresh"&&t.jsx("span",{className:s.freshness,"data-status":S.status,children:(S==null?void 0:S.status)==="stale"?a("playtest.watch.stale","Stale"):a("playtest.watch.unavailable","Unavailable")})]},x.subscriptionId)})}),c&&t.jsx(Mt,{open:l!==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:u.current,onClose:()=>d(null),items:[{label:a("playtest.watch.registration","Registration"),value:`${c.target.role} · ${c.access.kind}`},{label:a("playtest.values.location","Location"),value:_},{label:a("playtest.values.valueType","Value type"),value:c.valueType},{label:b!=null&&b.fresh?a("playtest.watch.currentValue","Current value"):v!==void 0?a("playtest.watch.lastObserved","Last observed"):a("playtest.watch.notObserved","Not observed yet"),value:Ye(v)},...b!=null&&b.observedAtMs?[{label:a("playtest.watch.observedAt","Observed at"),value:t.jsx("time",{children:new Date(b.observedAtMs).toLocaleTimeString()})}]:[]]})]})}function wo(e,a,i,l){const d=e.indexOf(a),u=e.indexOf(i);if(d<0||u<0||a===i)return[...e];const c=e.filter(_=>_!==a),b=c.indexOf(i),v=l==="after"?b+1:b;return c.splice(v,0,a),c}const Nt=["watches","controls"];function Co(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 Ro(e,a){const i=e.watches[`${a.kind}:${a.binding.id}`];return(i==null?void 0:i.status)??"unobserved"}function Po(e){var j,g,w,C,q,ie;const{t:a}=me(),[i,l]=o.useState(""),[d,u]=o.useState("all"),[c,b]=o.useState("all"),[v,_]=o.useState("all"),[R,x]=o.useState(new Set),[S,f]=o.useState(0),[E,m]=o.useState(50),[D,M]=o.useState(!1),[I,P]=o.useState(((j=e.live.profile)==null?void 0:j.sectionOrder)??Nt),[k,O]=o.useState(null),[T,L]=o.useState(null),[ee,H]=o.useState(null),[A,G]=o.useState(!1),[U,ae]=o.useState(!1),[de,ne]=o.useState(""),[z,Y]=o.useState(null),[K,$]=o.useState(()=>{var h;return((h=e.live.profile)==null?void 0:h.presentation)??{}}),[Q,Ne]=o.useState({}),[X,he]=o.useState(()=>{var h;return((h=e.live.profile)==null?void 0:h.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}}),V=e.live.profile,pe=a("playtest.values.ungrouped","Ungrouped");o.useEffect(()=>{var h,B;P(((h=e.live.profile)==null?void 0:h.sectionOrder)??Nt),$(((B=e.live.profile)==null?void 0:B.presentation)??{}),G(!1)},[(g=e.live.profile)==null?void 0:g.id,(w=e.live.profile)==null?void 0:w.presentation,(C=e.live.profile)==null?void 0:C.sectionOrder]),o.useEffect(()=>{var h;he(((h=e.live.profile)==null?void 0:h.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"})},[(q=e.live.profile)==null?void 0:q.id,(ie=e.live.profile)==null?void 0:ie.settings]);const Z=o.useMemo(()=>{if(!V)return{entries:[],total:0,pages:1,safePage:0,groups:[]};const h=[...V.controls.map((n,p)=>({kind:"control",binding:n,sourceOrder:p})),...V.watches.map((n,p)=>({kind:"watch",binding:n,sourceOrder:V.controls.length+p}))],B=Array.from(new Set(h.map(n=>{var p;return((p=K[n.binding.id])==null?void 0:p.group)??pe}))).sort((n,p)=>n.localeCompare(p)),J=i.trim().toLocaleLowerCase(),ge=h.filter(n=>{var N;const p=((N=K[n.binding.id])==null?void 0:N.group)??pe;return(d==="all"||n.kind===d)&&(v==="all"||p===v)&&(c==="all"||Ro(e.live,n)===c)&&(!J||Co(n.binding,p).includes(J))}).sort((n,p)=>{if(n.kind!==p.kind)return n.kind==="watch"?-1:1;const N=K[n.binding.id],F=K[p.binding.id];return!!(N!=null&&N.pinned)!=!!(F!=null&&F.pinned)?N!=null&&N.pinned?-1:1:((N==null?void 0:N.order)??n.sourceOrder)-((F==null?void 0:F.order)??p.sourceOrder)}),te=Math.max(1,Math.ceil(ge.length/E)),ce=Math.min(S,te-1);return{entries:ge.slice(ce*E,(ce+1)*E),total:ge.length,pages:te,safePage:ce,groups:B}},[v,d,c,S,E,K,V,e.live,i,pe]),se=((V==null?void 0:V.controls.length)??0)+((V==null?void 0:V.watches.length)??0),ve=i.trim()!==""||d!=="all"||c!=="all"||v!=="all",oe={watches:a("playtest.values.observedSection","Observed values"),controls:a("playtest.values.changeSection","Change values")},be=async h=>{H(null);try{await e.live.saveProfileMetadata(h)}catch(B){throw H(B instanceof Error?B.message:a("playtest.values.layoutSaveFailed","Could not save the display order")),B}},xe=h=>{he(h),be({settings:h}).catch(()=>he((V==null?void 0:V.settings)??{applyDefaultsOnManualPlayStart:!1,runtimeApplyMode:"manual"}))},je=h=>{if(!A||U||!I.includes(h))return;const B=I,J=[I[1],I[0]];P(J),ae(!0),be({sectionOrder:J}).then(()=>ne(a("playtest.values.layoutSaved","Display order saved"))).catch(()=>P(B)).finally(()=>ae(!1))},Pe=h=>Z.entries.filter(B=>B.kind===h),fe=(h,B,J,ge)=>{var W,le,Se;if(!V||!A||U)return;const te=K,ce=B.map(re=>re.binding.id),n=wo(ce,h.binding.id,J,ge);if(ce.every((re,ye)=>re===n[ye]))return;const p={...K},N=B.map(re=>{var ye;return((ye=K[re.binding.id])==null?void 0:ye.order)??re.sourceOrder}).sort((re,ye)=>re-ye);for(const[re,ye]of n.entries())p[ye]={order:N[re],pinned:((W=K[ye])==null?void 0:W.pinned)??!1,...(le=K[ye])!=null&&le.group?{group:(Se=K[ye])==null?void 0:Se.group}:{}};$(p),ae(!0);const F=n.indexOf(h.binding.id)+1;be({presentation:p}).then(()=>ne(a("playtest.values.movedTo","{{label}} moved to position {{position}}").replace("{{label}}",h.binding.label).replace("{{position}}",String(F)))).catch(()=>$(te)).finally(()=>ae(!1))},we=h=>x(B=>{const J=new Set(B);return J.has(h)?J.delete(h):J.add(h),J}),r=(h,B)=>{var le,Se,re,ye;const J=((le=K[h.binding.id])==null?void 0:le.group)??pe,ge=((Se=K[h.binding.id])==null?void 0:Se.pinned)??!1,te=B.filter(ue=>{var _e,De;return(((_e=K[ue.binding.id])==null?void 0:_e.group)??pe)===J&&(((De=K[ue.binding.id])==null?void 0:De.pinned)??!1)===ge}),ce=te.findIndex(ue=>ue.binding.id===h.binding.id),n=ue=>a(ue==="previous"?"playtest.values.movePrevious":"playtest.values.moveNext",`Move {{label}} ${ue}`).replace("{{label}}",h.binding.label),p=a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",h.binding.label),N=e.active&&(e.live.studioMode!=="run"||h.binding.target.role==="server"),F=e.live.studioMode==="run"&&h.binding.target.role==="client"?a("playtest.controls.playModeRequired","Client test values are available in Play."):e.inactiveReason,W=`${V.id}:${((re=e.live.lease)==null?void 0:re.leaseId)??"edit"}:${h.binding.id}`;return t.jsxs("div",{className:s.valueEntryShell,"data-layout-editing":A,"data-drop-position":(z==null?void 0:z.id)===h.binding.id?z.placement:void 0,onDragOver:ue=>{if((k==null?void 0:k.kind)!==h.kind||!te.some(et=>et.binding.id===k.id))return;ue.preventDefault();const _e=ue.currentTarget.getBoundingClientRect(),Te=h.kind==="watch"?ue.clientX>=_e.left+_e.width/2?"after":"before":ue.clientY>=_e.top+_e.height/2?"after":"before";Y({id:h.binding.id,placement:Te})},onDrop:ue=>{if(ue.preventDefault(),(k==null?void 0:k.kind)===h.kind&&k.id!==h.binding.id&&(z==null?void 0:z.id)===h.binding.id){const _e=te.find(De=>De.binding.id===k.id);_e&&fe(_e,te,h.binding.id,z.placement)}O(null),Y(null)},children:[A&&t.jsxs("div",{className:s.valueReorderControls,children:[t.jsx("button",{type:"button",className:s.dragHandle,draggable:!0,"aria-label":p,disabled:U,onDragStart:()=>O({kind:h.kind,id:h.binding.id}),onDragEnd:()=>{O(null),Y(null)},children:t.jsx(bt,{size:14,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":n("previous"),"aria-describedby":ce<=0?"playtest-layout-boundary":void 0,disabled:U||ce<=0,onClick:()=>fe(h,te,te[ce-1].binding.id,"before"),children:t.jsx(gt,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":n("next"),"aria-describedby":ce===te.length-1?"playtest-layout-boundary":void 0,disabled:U||ce<0||ce===te.length-1,onClick:()=>fe(h,te,te[ce+1].binding.id,"after"),children:t.jsx(ct,{size:13,"aria-hidden":"true"})})]}),h.kind==="control"?t.jsx(jo,{profile:{...V,controls:[h.binding],watches:[],settings:X},active:N,inactiveReason:F,states:e.live.controls,watches:e.live.watches,draftScope:`${V.id}:${((ye=e.live.lease)==null?void 0:ye.leaseId)??"edit"}`,drafts:Q[W]?{[h.binding.id]:Q[W]}:void 0,onDraftChange:(ue,_e,De)=>Ne(Te=>({...Te,[W]:{value:_e,dirty:De}})),profileSaveLocked:!1,onApply:(ue,_e)=>void e.live.apply(ue,_e),onSaveValue:e.live.saveControlValue,onRemoveValue:ue=>e.live.saveProfileMetadata({removeDefaults:[ue]})}):t.jsx(No,{profile:{...V,controls:[],watches:[h.binding]},watches:e.live.watches})]},`${h.kind}:${h.binding.id}`)},y=h=>{var ce;const J=Pe(h==="watches"?"watch":"control"),ge=new Map;for(const n of J){const p=((ce=K[n.binding.id])==null?void 0:ce.group)??pe;ge.set(p,[...ge.get(p)??[],n])}const te=oe[h];return t.jsxs("section",{className:s.valueSection,"aria-label":te,onDragOver:n=>{T&&T!==h&&n.preventDefault()},onDrop:n=>{!T||T===h||(n.preventDefault(),je(T),L(null))},children:[t.jsxs("header",{className:s.valueSectionHeader,children:[t.jsxs("div",{className:s.valueSectionHeading,children:[A&&t.jsx("button",{type:"button",className:s.sectionDragHandle,draggable:!0,"aria-label":a("playtest.values.drag","Drag {{label}} to reorder").replace("{{label}}",te),disabled:U,onDragStart:()=>L(h),onDragEnd:()=>L(null),children:t.jsx(bt,{size:15,"aria-hidden":"true"})}),t.jsx("h3",{children:te}),t.jsx("span",{className:s.valueSectionCount,children:J.length})]}),t.jsxs("div",{className:s.valueSectionHeaderActions,children:[h==="controls"&&V&&t.jsxs("div",{className:s.runtimeSettings,children:[t.jsx(Ve,{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(n=>t.jsx("button",{type:"button","aria-pressed":X.runtimeApplyMode===n,disabled:!e.live.canMutate,onClick:()=>{X.runtimeApplyMode!==n&&xe({...X,runtimeApplyMode:n})},children:n==="auto"?a("playtest.settings.autoMode","Automatic"):a("playtest.settings.manualMode","Manual")},n))]})}),t.jsx(Ve,{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:X.applyDefaultsOnManualPlayStart,disabled:!e.live.canMutate,onChange:n=>xe({...X,applyDefaultsOnManualPlayStart:n.target.checked})}),t.jsx("span",{children:a("playtest.settings.applyDefaultsOnPlayStart","Apply saved defaults when Play starts")})]})})]}),A&&t.jsx("button",{type:"button",className:s.sectionMoveButton,disabled:U,"aria-label":a(I[0]===h?"playtest.values.moveDown":"playtest.values.moveUp",I[0]===h?"Move {{label}} down":"Move {{label}} up").replace("{{label}}",te),onClick:()=>je(h),children:I[0]===h?t.jsx(ct,{size:14,"aria-hidden":"true"}):t.jsx(gt,{size:14,"aria-hidden":"true"})})]})]}),J.length===0?t.jsx("div",{className:s.panelEmpty,children:h==="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:h==="watches"?s.watchValueGrid:s.controlValueList,children:Array.from(ge.entries()).map(([n,p])=>{const N=R.has(`${h}:${n}`),F=t.jsx("div",{className:s.valueGroupRows,children:p.map(W=>r(W,J))});return ge.size===1&&n===pe?t.jsx("div",{className:s.valueGroup,children:F},`${h}:${n}`):t.jsxs("section",{className:s.valueGroup,children:[t.jsxs("button",{type:"button",className:s.valueGroupToggle,"aria-expanded":!N,"aria-label":`${N?a("playtest.values.expandGroup","Expand"):a("playtest.values.collapseGroup","Collapse")} ${n}`,onClick:()=>we(`${h}:${n}`),children:[t.jsx("span",{children:n}),t.jsx("span",{children:p.length})]}),!N&&F]},`${h}:${n}`)})})]},h)};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:h=>{l(h.target.value),f(0)},placeholder:a("playtest.values.searchPlaceholder","Name, group, source, or path")})]}),t.jsxs("button",{type:"button",className:s.secondaryAction,"aria-expanded":D,"aria-controls":"playtest-value-filters",onClick:()=>M(h=>!h),children:[a("playtest.values.filters","Filters"),ve?` (${[i.trim()!=="",d!=="all",c!=="all",v!=="all"].filter(Boolean).length})`:""]})]}),D&&t.jsxs("div",{className:s.valueFilters,id:"playtest-value-filters",children:[t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.kind","Value type")}),t.jsxs("select",{"aria-label":a("playtest.values.kind","Value type"),value:d,onChange:h=>{u(h.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.all","All values")}),t.jsx("option",{value:"control",children:a("playtest.values.controls","Controls")}),t.jsx("option",{value:"watch",children:a("playtest.values.watches","Watch Values")})]})]}),t.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:h=>{b(h.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.statusAll","All statuses")}),t.jsx("option",{value:"fresh",children:a("playtest.watch.fresh","Fresh")}),t.jsx("option",{value:"stale",children:a("playtest.watch.stale","Stale")}),t.jsx("option",{value:"unavailable",children:a("playtest.watch.unavailable","Unavailable")}),t.jsx("option",{value:"unobserved",children:a("playtest.watch.notObserved","Not observed yet")})]})]}),t.jsxs("label",{children:[t.jsx("span",{children:a("playtest.values.group","Group")}),t.jsxs("select",{"aria-label":a("playtest.values.group","Group"),value:v,onChange:h=>{_(h.target.value),f(0)},children:[t.jsx("option",{value:"all",children:a("playtest.values.allGroups","All groups")}),Z.groups.map(h=>t.jsx("option",{value:h,children:h},h))]})]}),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:h=>{m(Number(h.target.value)),f(0)},children:[t.jsx("option",{value:"25",children:"25"}),t.jsx("option",{value:"50",children:"50"}),t.jsx("option",{value:"100",children:"100"})]})]})]}),t.jsxs("div",{className:s.valueListStatus,children:[t.jsx("div",{className:s.valueCount,role:"status",children:a("playtest.values.count","{{visible}} of {{total}} values").replace("{{visible}}",String(Z.total)).replace("{{total}}",String(se))}),t.jsx("button",{type:"button",className:s.secondaryAction,disabled:U||se===0,onClick:()=>{if(A){G(!1);return}ve&&(l(""),u("all"),b("all"),_("all"),f(0)),G(!0)},children:A?a("playtest.values.doneLayout","Done editing layout"):ve?a("playtest.values.editFullList","Edit full list"):a("playtest.values.editLayout","Edit layout")})]}),A&&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:de}),ee&&t.jsx("div",{className:s.layoutError,role:"alert",children:ee}),Z.total===0&&se>0?t.jsx("div",{className:s.panelEmpty,children:a("playtest.values.noResults","No values match these filters.")}):t.jsx("div",{className:s.valueSections,children:I.map(y)}),Z.pages>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:Z.safePage===0,onClick:()=>f(h=>h-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:()=>f(h=>h+1),children:a("playtest.values.next","Next")})]})]})}const ko="_emptyState_10pjf_1",Ao="_header_10pjf_11",Eo="_method_10pjf_12",Do="_methods_10pjf_39",To="_singleMethod_10pjf_45",Io="_methodTitle_10pjf_57",Lo="_moreExamples_10pjf_70",Mo="_hint_10pjf_88",$o="_tierNote_10pjf_89",Vo="_disabledReason_10pjf_90",Bo="_primaryAction_10pjf_102",ke={emptyState:ko,header:Ao,method:Eo,methods:Do,singleMethod:To,methodTitle:Io,moreExamples:Lo,hint:Mo,tierNote:$o,disabledReason:Vo,primaryAction:Bo};function Vt(e){const{t:a}=me(),i=e.kind==="no-results",l=e.kind==="no-profile",d=i?a("playtest.emptyResults.title","Ask AI to check your game"):l?a("playtest.emptyValues.noProfileTitle","Prepare a value to test"):a("playtest.emptyValues.noValuesTitle","Add a test value to this profile"),u=i?a("playtest.emptyResults.description","When AI finishes the test, you can review pass, failure, and the reason here."):l?a("playtest.emptyValues.noProfileDescription","Ask AI to prepare a value, or select an object in Studio and add one directly."):a("playtest.emptyValues.noValuesDescription","Use the selected profile, {{name}}, to collect values you want to observe or change.").replace("{{name}}",e.profileName??"");return t.jsxs("section",{className:ke.emptyState,children:[t.jsxs("header",{className:ke.header,children:[t.jsx("h3",{children:d}),t.jsx("p",{children:u})]}),t.jsxs("div",{className:`${ke.methods} ${i?ke.singleMethod:""}`,children:[t.jsxs("section",{className:ke.method,children:[t.jsxs("div",{className:ke.methodTitle,children:[t.jsx(aa,{size:16,"aria-hidden":"true"}),t.jsx("h4",{children:a("playtest.emptyValues.aiTitle","Ask AI")})]}),!i&&t.jsx("p",{children:a("playtest.emptyValues.aiDescription","Copy a request and paste it into an AI chat connected to WEPPY.")}),t.jsx(vt,{exampleIds:i?["automated-check"]:["character"]}),!i&&t.jsxs("details",{className:ke.moreExamples,children:[t.jsx("summary",{children:a("playtest.ai.otherExamples","Other request examples")}),t.jsx(vt,{exampleIds:["selection","game-state"]})]}),i&&e.isBasic&&t.jsx("p",{className:ke.tierNote,children:a("playtest.emptyResults.proDescription","Automated test runs and actual saved results are available with Pro.")})]}),!i&&t.jsxs("section",{className:ke.method,children:[t.jsxs("div",{className:ke.methodTitle,children:[t.jsx(ga,{size:16,"aria-hidden":"true"}),t.jsx("h4",{children:a("playtest.emptyValues.directTitle","Select and add it yourself")})]}),t.jsx("p",{children:a("playtest.emptyValues.directDescription","Select an object in Studio, then choose a supported property, Attribute, or Value.")}),l&&t.jsx("p",{className:ke.hint,children:a("playtest.emptyValues.firstProfileHint","When you add the first value, enter a profile name to keep related test settings together.")}),t.jsx("button",{type:"button",className:ke.primaryAction,disabled:!!e.directAddDisabledReason,"aria-describedby":e.directAddDisabledReason?"playtest-empty-direct-reason":void 0,onClick:e.onAddFromSelection,children:a("playtest.emptyValues.directAction","Add selected Studio value")}),e.directAddDisabledReason&&t.jsx("p",{className:ke.disabledReason,id:"playtest-empty-direct-reason",children:e.directAddDisabledReason})]})]})]})}function Oo(e){var v,_,R,x,S;const{live:a}=e,{t:i}=me(),l=((v=a.lease)==null?void 0:v.state)==="active"&&(a.studioState==="Running"||a.studioState==="Paused"),d=l&&a.canMutate,u=d&&(a.studioMode!=="run"||!!((_=a.profile)!=null&&_.controls.some(f=>f.target.role==="server"))),c=e.inactiveReason??i("playtest.values.playRequired","Start Play in Studio to change test values."),b=(((R=a.profile)==null?void 0:R.controls.length)??0)+(((x=a.profile)==null?void 0:x.watches.length)??0);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:f=>a.selectProfile(f.target.value),children:[a.profiles.length===0&&t.jsx("option",{value:"",children:i("playtest.profile.empty","No profiles yet")}),a.profiles.map(f=>t.jsx("option",{value:f.id,children:f.name},f.id))]})]}),t.jsxs("div",{className:s.profileActions,children:[t.jsxs("button",{type:"button",className:s.primaryAction,onClick:e.onManageValues,children:[t.jsx(ma,{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(_a,{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(Dt,{size:14,"aria-hidden":"true"})," ",i("playtest.profile.new","New profile")]})]})]}),a.loading?t.jsx("div",{className:s.panelEmpty,children:i("common.loading","Loading...")}):b===0?t.jsx(Vt,{kind:a.profile?"no-values":"no-profile",profileName:(S=a.profile)==null?void 0:S.name,onAddFromSelection:e.onManageValues,directAddDisabledReason:e.directAddDisabledReason}):t.jsx("div",{className:s.liveGrid,children:t.jsxs("section",{className:`${s.livePanel} ${s.valueWorkspacePanel}`,"data-runtime-state":l?"active":"inactive",children:[t.jsxs("header",{className:s.valueWorkspaceHeader,children:[t.jsxs("div",{children:[t.jsx("strong",{children:i("playtest.values.title","Test values")}),!d&&t.jsxs("span",{className:s.controlAvailability,"data-warning":a.studioState==="Edit",id:"playtest-controls-availability",role:"status",children:[a.studioState==="Edit"&&t.jsx(wa,{size:14,"aria-hidden":"true"}),c]})]}),t.jsx(Ve,{active:u,label:i("playtest.session.reset","Reset all"),reason:c,children:t.jsxs("button",{type:"button",className:s.resetAction,disabled:!u,"aria-describedby":u?void 0:"playtest-controls-availability",onClick:()=>void a.resetAll(),children:[a.canMutate?t.jsx(Sa,{size:14,"aria-hidden":"true"}):t.jsx(va,{size:14,"aria-hidden":"true"}),i("playtest.session.reset","Reset all")]})})]}),t.jsx(Po,{live:a,active:d,inactiveReason:c})]})})]})}const lt={label:"",role:"server",path:"Workspace",accessKind:"attribute",fieldName:"",editorType:"number",defaultValue:"0",minimum:"0",maximum:"100",step:"1"};function Fo(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"binding"}function wt(e){const a=e.split(".").map(i=>i.trim()).filter(Boolean);return a.length>0?{root:a[0],segments:a.slice(1)}:null}function Ie(e){return e==="range"?"number":e}function Ho(e){var i;if(Be(Ie(e.editorType)))return mt(Ie(e.editorType),e.defaultValue)??null;if(e.editorType==="enum")return((i=e.enumValues)==null?void 0:i.find(l=>String(l)===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 Ct(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName.trim()}}function Go(e){var d,u;const a=e.path?[e.path.root,...e.path.segments].join("."):"adapter",i=e.access.kind==="value"?"Value":e.access.name??e.access.kind,l="constraints"in e&&((d=e.constraints)==null?void 0:d.minimum)!==void 0&&((u=e.constraints)==null?void 0:u.maximum)!==void 0;return`${e.target.role} · ${a} · ${i} · ${l?"range":e.valueType}`}function qo(e){var xe,je,Pe,fe,we;const{t:a}=me(),i=!!e.profile,[l,d]=o.useState(""),[u,c]=o.useState([]),[b,v]=o.useState([]),[_,R]=o.useState({}),[x,S]=o.useState("controls"),[f,E]=o.useState(!1),[m,D]=o.useState(lt),[M,I]=o.useState(!1),[P,k]=o.useState(!1),[O,T]=o.useState(!1),[L,ee]=o.useState(!1),[H,A]=o.useState(null),[G,U]=o.useState(null),ae=o.useRef(null);o.useEffect(()=>{var r,y,j,g;e.open&&(d(((r=e.profile)==null?void 0:r.name)??""),c(((y=e.profile)==null?void 0:y.controls)??[]),v(((j=e.profile)==null?void 0:j.watches)??[]),R(((g=e.profile)==null?void 0:g.presentation)??{}),S("controls"),E(!1),D(lt),k(!1),T(!1),ee(!1),U(null),A(null))},[e.open,e.profile]);const de=x==="controls"?u:b,ne=l!==(((xe=e.profile)==null?void 0:xe.name)??"")||JSON.stringify(u)!==JSON.stringify(((je=e.profile)==null?void 0:je.controls)??[])||JSON.stringify(b)!==JSON.stringify(((Pe=e.profile)==null?void 0:Pe.watches)??[])||JSON.stringify(_)!==JSON.stringify(((fe=e.profile)==null?void 0:fe.presentation)??{})||f,z=o.useMemo(()=>new Set([...u,...b].map(r=>r.id)),[u,b]),Y=(r,y)=>{D(j=>({...j,[r]:y})),A(null)},K=()=>{const r=Fo(m.label);let y=r,j=2;for(;z.has(y);)y=`${r}-${j}`,j+=1;return y},$=(r,y)=>_[r]??{order:y,pinned:!1},Q=(r,y,j)=>R(g=>({...g,[r]:{...$(r,y),...j}})),Ne=de.map((r,y)=>({binding:r,sourceOrder:y,entry:$(r.id,y)})).sort((r,y)=>r.entry.order-y.entry.order),X=(r,y)=>{const j=Ne.findIndex(C=>C.binding.id===r),g=Ne[j+y],w=Ne[j];!w||!g||R(C=>({...C,[w.binding.id]:{...w.entry,order:g.entry.order},[g.binding.id]:{...g.entry,order:w.entry.order}}))},he=()=>{const r=wt(m.path),y=Ho(m);if(!m.label.trim()||!r||m.accessKind!=="value"&&!m.fieldName.trim()||y===null)return null;const j=m.editorType==="range",g=Number(m.minimum),w=Number(m.maximum),C=Number(m.step);return j&&(typeof y!="number"||!Number.isFinite(g)||!Number.isFinite(w)||!Number.isFinite(C)||g>=w||C<=0||y<g||y>w)?null:{id:K(),label:m.label.trim(),target:{role:m.role},path:r,access:Ct(m),valueType:Ie(m.editorType),value:y,...m.editorType==="enum"?{enumValues:m.enumValues}:{},applyTiming:"after_agents_ready",restorePolicy:"session_end",...j?{constraints:{minimum:g,maximum:w,step:C}}:{}}},V=()=>{const r=wt(m.path);return!m.label.trim()||!r||m.accessKind!=="value"&&!m.fieldName.trim()?null:{id:K(),label:m.label.trim(),target:{role:m.role},path:r,access:Ct(m),valueType:Ie(m.editorType)}},pe=()=>{const r=x==="controls"?he():V();if(!r){A(a("playtest.profile.binding.invalid","Complete the label, path, field, and type values."));return}x==="controls"?c(y=>[...y,r]):v(y=>[...y,r]),R(y=>({...y,[r.id]:{order:u.length+b.length,pinned:!1}})),E(!1),D(lt)},Z=async()=>{if(e.onResolveSelectionCandidates){try{const y=await e.onResolveSelectionCandidates();if(!y.selected.path||y.candidates.length===0){A(a("playtest.profile.binding.selectionEmpty","The selected instance has no supported fields."));return}U(y),se(y,0)}catch(y){A(y instanceof Error?y.message:String(y))}return}if(!e.onResolveSelection)return;const r=x==="controls"?he():V();if(!r){A(a("playtest.profile.binding.selectionNeedsFields","Enter the label, field, and type before using the Studio selection."));return}try{const y=await e.onResolveSelection({kind:x==="controls"?"control":"watch",id:r.id,label:r.label,role:r.target.role,access:r.access,valueType:r.valueType,..."value"in r?{value:r.value}:{},..."constraints"in r&&r.constraints?{constraints:r.constraints}:{},..."enumValues"in r&&r.enumValues?{enumValues:r.enumValues}:{}});y.path&&Y("path",[y.path.root,...y.path.segments].join("."))}catch(y){A(y instanceof Error?y.message:String(y))}},se=(r,y)=>{const j=r.candidates[y];if(!j||!r.selected.path)return;const g=j.fieldName??"Value";D(w=>({...w,label:`${r.selected.name??"Selected"} ${g}`,path:[r.selected.path.root,...r.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)},ve=async()=>{if(!(!e.profile||!e.onSave||!l.trim())){I(!0),A(null);try{await e.onSave({...e.profile,name:l.trim(),controls:u,watches:b,presentation:_}),e.onClose()}catch(r){A(r instanceof Error?r.message:String(r))}finally{I(!1)}}},oe=()=>{if(!(M||L)){if(ne){k(!0);return}e.onClose()}},be=async()=>{var r;if(!(!e.profile||!e.onDelete||L||e.deleteDisabledReason)){ee(!0),A(null);try{await e.onDelete(e.profile.id,e.profile.revision),T(!1),e.onClose()}catch(y){const j=y&&typeof y=="object"?String("payload"in y&&((r=y.payload)==null?void 0:r.errorCode)||"error"in y&&y.error||"code"in y&&y.code||""):"";A(a(j==="profile_active"?"playtest.profile.deleteActive":j==="profile_revision_conflict"?"playtest.profile.deleteConflict":j==="profile_not_found"?"playtest.profile.deleteNotFound":j==="profile_scope_unavailable"?"playtest.profile.deleteScopeUnavailable":"playtest.profile.deleteFailed",y instanceof Error?y.message:"Could not delete the profile."))}finally{ee(!1)}}};return t.jsxs(Ge,{open:e.open,onClose:oe,dismissDisabled:M||L,initialFocusRef:ae,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(qe,{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:M||L,onRequestClose:oe}),t.jsxs("div",{className:s.profileDialogBody,children:[t.jsxs("label",{children:[a("playtest.profile.name","Profile name"),t.jsx("input",{ref:ae,value:l,onChange:r=>d(r.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":x==="controls",onClick:()=>{S("controls"),E(!1)},children:[a("playtest.profile.controlsTab","Controls")," ",t.jsx("span",{children:u.length})]}),t.jsxs("button",{type:"button",role:"tab","aria-selected":x==="watches",onClick:()=>{S("watches"),E(!1)},children:[a("playtest.profile.watchesTab","Watch Values")," ",t.jsx("span",{children:b.length})]})]}),t.jsx("div",{className:s.bindingList,children:de.length===0?t.jsx("div",{className:s.bindingEmpty,children:x==="controls"?a("playtest.profile.controlsEmpty","No controls added yet."):a("playtest.profile.watchesEmpty","No Watch Values added yet.")}):Ne.map(({binding:r,entry:y,sourceOrder:j},g)=>t.jsxs("div",{className:s.bindingItem,children:[t.jsxs("div",{className:s.bindingItemCopy,children:[t.jsx("strong",{children:r.label}),t.jsx("span",{children:Go(r)}),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}}",r.label),value:y.group??"",onChange:w=>Q(r.id,j,{group:w.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}}",r.label),checked:y.pinned,onChange:w=>Q(r.id,j,{pinned:w.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}}",r.label),disabled:g===0,onClick:()=>X(r.id,-1),children:t.jsx(ra,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button","aria-label":a("playtest.profile.moveDown","Move {{label}} down").replace("{{label}}",r.label),disabled:g===Ne.length-1,onClick:()=>X(r.id,1),children:t.jsx(na,{size:13,"aria-hidden":"true"})}),t.jsx("button",{type:"button",className:s.bindingDelete,"aria-label":a("playtest.profile.removeBinding","Remove {{label}}").replace("{{label}}",r.label),onClick:()=>{x==="controls"?c(w=>w.filter(C=>C.id!==r.id)):v(w=>w.filter(C=>C.id!==r.id)),R(w=>Object.fromEntries(Object.entries(w).filter(([C])=>C!==r.id)))},children:t.jsx(ft,{size:14,"aria-hidden":"true"})})]})]},r.id))}),f?t.jsxs("fieldset",{className:s.bindingForm,"aria-label":x==="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 Z(),children:a("playtest.profile.binding.useSelection","Use current Studio selection")}),G&&G.candidates.length>1&&t.jsxs("label",{children:[a("playtest.profile.binding.selectedField","Selected field"),t.jsx("select",{onChange:r=>se(G,Number(r.target.value)),children:G.candidates.map((r,y)=>t.jsx("option",{value:y,children:r.accessKind==="value"?"ValueBase.Value":`${r.accessKind} · ${r.fieldName}`},`${r.accessKind}:${r.fieldName??"Value"}`))})]}),t.jsxs("div",{className:s.bindingFormGrid,children:[t.jsxs("label",{children:[a("playtest.profile.binding.label","Label"),t.jsx("input",{value:m.label,onChange:r=>Y("label",r.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.role","Target"),t.jsxs("select",{value:m.role,onChange:r=>Y("role",r.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:m.path,placeholder:a("playtest.profile.binding.pathPlaceholder","Workspace.Config"),onChange:r=>Y("path",r.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.access","Access"),t.jsxs("select",{value:m.accessKind,onChange:r=>Y("accessKind",r.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")})]})]}),m.accessKind!=="value"&&t.jsxs("label",{children:[a("playtest.profile.binding.field","Field name"),t.jsx("input",{value:m.fieldName,onChange:r=>Y("fieldName",r.target.value)})]}),t.jsxs("label",{children:[x==="controls"?a("playtest.profile.binding.inputType","Input type"):a("playtest.profile.binding.valueType","Value type"),t.jsxs("select",{value:m.editorType,onChange:r=>Y("editorType",r.target.value),children:[t.jsx("option",{value:"number",children:a("playtest.profile.binding.number","Number")}),x==="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")}),m.enumValues&&t.jsx("option",{value:"enum",children:a("playtest.profile.binding.enum","Enum")})]})]}),x==="controls"&&Be(Ie(m.editorType))&&t.jsx(dt,{type:Ie(m.editorType),draft:m.defaultValue,label:a("playtest.profile.binding.defaultValue","Default value"),onChange:r=>Y("defaultValue",r)}),x==="controls"&&m.editorType==="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("select",{value:m.defaultValue,onChange:r=>Y("defaultValue",r.target.value),children:(we=m.enumValues)==null?void 0:we.map(r=>t.jsx("option",{value:String(r),children:String(r)},String(r)))})]}),x==="controls"&&!Be(Ie(m.editorType))&&m.editorType!=="boolean"&&m.editorType!=="enum"&&t.jsxs("label",{children:[a("playtest.profile.binding.defaultValue","Default value"),t.jsx("input",{type:m.editorType==="string"?"text":"number",value:m.defaultValue,onChange:r=>Y("defaultValue",r.target.value)})]}),x==="controls"&&m.editorType==="boolean"&&t.jsxs("label",{className:s.bindingBooleanDefault,children:[t.jsx("input",{type:"checkbox","aria-label":a("playtest.profile.binding.defaultValue","Default value"),checked:m.defaultValue==="true",onChange:r=>Y("defaultValue",String(r.target.checked))}),t.jsx("span",{children:a("playtest.profile.binding.defaultValue","Default value")})]}),x==="controls"&&m.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:m.minimum,onChange:r=>Y("minimum",r.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.maximum","Maximum"),t.jsx("input",{type:"number",value:m.maximum,onChange:r=>Y("maximum",r.target.value)})]}),t.jsxs("label",{children:[a("playtest.profile.binding.step","Step"),t.jsx("input",{type:"number",value:m.step,onChange:r=>Y("step",r.target.value)})]})]})]}),H&&t.jsx("div",{className:s.bindingError,role:"alert",children:H}),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:pe,children:a("playtest.profile.binding.add","Add to profile")})]})]}):t.jsxs("button",{type:"button",className:s.addBindingButton,onClick:()=>E(!0),children:[t.jsx(Dt,{size:14,"aria-hidden":"true"})," ",x==="controls"?a("playtest.profile.addControl","Add control"):a("playtest.profile.addWatch","Add watch")]})]}),H&&!f&&t.jsx("div",{className:s.bindingError,role:"alert",children:H})]}),t.jsxs("div",{className:s.profileDialogActions,children:[i&&e.onDelete&&t.jsxs("button",{type:"button",className:`${s.stopAction} ${s.profileDeleteAction}`,disabled:M||L||!!e.deleteDisabledReason,title:e.deleteDisabledReason,onClick:()=>T(!0),children:[t.jsx(ft,{size:14,"aria-hidden":"true"})," ",a("playtest.profile.delete","Delete profile")]}),i&&e.deleteDisabledReason&&t.jsx("span",{className:s.profileDeleteReason,role:"status",children:e.deleteDisabledReason}),t.jsx("button",{type:"button",className:s.secondaryAction,disabled:M||L,onClick:oe,children:a("common.cancel","Cancel")}),i?t.jsx("button",{type:"button",className:s.primaryAction,disabled:!l.trim()||M,onClick:()=>void ve(),children:M?a("playtest.profile.saving","Saving…"):a("playtest.profile.save","Save profile")}):t.jsx("button",{type:"button",className:s.primaryAction,disabled:!l.trim()||M,onClick:async()=>{I(!0);try{await e.onCreate(l),d(""),e.onClose()}finally{I(!1)}},children:M?a("playtest.profile.creating","Creating…"):a("playtest.profile.createTitle","Create test profile")})]})]}),t.jsx(ot,{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()}}),t.jsx(ot,{open:O,title:a("playtest.profile.deleteConfirmTitle","Delete test profile?"),message:e.profile?[a("playtest.profile.deleteConfirmMessage","Delete “{{name}}”? Its {{controls}} control values and {{watches}} observed values will be removed. Game objects, scripts, test connection code, other profiles, and automated test results will remain.").replace("{{name}}",e.profile.name).replace("{{controls}}",String(e.profile.controls.length)).replace("{{watches}}",String(e.profile.watches.length)),ne?a("playtest.profile.deleteDirty","Unsaved edits will also be discarded."):""].filter(Boolean).join(" "):"",cancelLabel:a("common.cancel","Cancel"),confirmLabel:a("playtest.profile.delete","Delete profile"),loading:L,onCancel:()=>{L||T(!1)},onConfirm:()=>void be()})]})}function $e(e){return`${e.accessKind}:${e.fieldName??"Value"}`}function Je(e){return e.fieldName??"Value"}function Uo(e){const{t:a}=me(),i=o.useId(),[l,d]=o.useState(!1),[u,c]=o.useState(""),b=o.useRef(null),v=o.useRef(null),_=o.useRef(null),R=u.trim().toLocaleLowerCase(),x=o.useMemo(()=>e.candidates.filter(P=>`${Je(P)} ${P.accessKind}`.toLocaleLowerCase().includes(R)),[R,e.candidates]),S=["attribute","value","property"].map(P=>({kind:P,candidates:x.filter(k=>k.accessKind===P)})).filter(P=>P.candidates.length>0),f=Je(e.selected);o.useEffect(()=>{var P;l&&((P=v.current)==null||P.focus())},[l]);const E=(P=!0)=>{var k;d(!1),c(""),P&&((k=b.current)==null||k.focus())},m=()=>{var P;return Array.from(((P=_.current)==null?void 0:P.querySelectorAll('[role="option"]'))??[])},D=P=>{var O;const k=m();(O=k[Math.max(0,Math.min(P,k.length-1))])==null||O.focus()},M=P=>{e.onSelect(P),E()},I=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:b,type:"button",className:s.propertyPickerTrigger,disabled:e.disabled,"aria-haspopup":"listbox","aria-expanded":l,"aria-controls":l?i:void 0,"aria-label":`${a("playtest.values.propertyPickerAction","Select property")}: ${f}`,onClick:()=>{l?E(!1):d(!0)},children:[t.jsx("span",{children:f}),t.jsx(ct,{size:16,"aria-hidden":"true"})]}),l&&t.jsxs("div",{ref:_,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:v,type:"search",value:u,onChange:P=>c(P.target.value),onKeyDown:P=>{P.key==="ArrowDown"&&(P.preventDefault(),D(0))}})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.propertyPickerClose","Close property picker"),onClick:()=>E(),children:t.jsx(Et,{size:16,"aria-hidden":"true"})})]}),t.jsxs("div",{id:i,className:s.propertyPickerList,role:"listbox","aria-label":a("playtest.values.availableProperties","Available properties"),children:[S.map(P=>t.jsxs("div",{className:s.propertyPickerGroup,role:"group","aria-label":I(P.kind),children:[t.jsx("span",{children:I(P.kind)}),P.candidates.map(k=>{const O=$e(k)===$e(e.selected);return t.jsxs("div",{role:"option",tabIndex:0,"aria-selected":O,"aria-label":Je(k),className:s.propertyPickerOption,onClick:()=>M(k),onKeyDown:T=>{var H;const ee=m().indexOf(T.currentTarget);T.key==="ArrowDown"&&(T.preventDefault(),D(ee+1)),T.key==="ArrowUp"&&(T.preventDefault(),ee===0?(H=v.current)==null||H.focus():D(ee-1)),(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),M(k))},children:[t.jsx("span",{children:Je(k)}),t.jsx("small",{children:k.valueType}),O&&t.jsx(sa,{size:15,"aria-hidden":"true"})]},$e(k))})]},P.kind)),x.length===0&&t.jsx("p",{role:"status",children:a("playtest.values.noProperties","No matching properties")})]})]})]})}const Rt=`local RunService = game:GetService("RunService")
77
- local Workspace = game:GetService("Workspace")
78
-
79
- local function requireStudioSession(context)
80
- assert(RunService:IsStudio(), "Test Adapter is only available in Studio")
81
- assert(type(context) == "table" and type(context.sessionId) == "string", "Active WEPPY test session is required")
82
- end
83
-
84
- return {
85
- schemaVersion = 1,
86
- name = "combat-test-values",
87
- version = "1.0.0",
88
- studioOnly = true,
89
- methods = {
90
- enemyCount = {
91
- argsSchema = { type = "object", properties = {}, additionalProperties = false },
92
- timeoutSeconds = 2,
93
- sideEffectClass = "read_only",
94
- run = function(context)
95
- requireStudioSession(context)
96
- local enemies = Workspace:FindFirstChild("Enemies")
97
- return enemies and #enemies:GetChildren() or 0
98
- end,
99
- },
100
- },
101
- dashboard = {
102
- schemaVersion = 1,
103
- entries = {{
104
- id = "enemy-count",
105
- label = "Enemy count",
106
- group = "Combat",
107
- kind = "watch",
108
- valueType = "number",
109
- read = { method = "enemyCount", arguments = {}, pollIntervalMs = 1000 },
110
- }},
111
- },
112
- }`;function Ko(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(u=>u.id));let l=a,d=2;for(;i.has(l);)l=`${a}-${d}`,d+=1;return l}function Pt(e){return`adapter-${e.adapter}-${e.id}`.toLowerCase().replace(/[^a-z0-9-]+/g,"-")}function zo(e){return e.accessKind==="value"?{kind:"value"}:{kind:e.accessKind,name:e.fieldName}}function ut(e){return e.fieldName??"Value"}function kt(e,a){return`${e.selected.name??"Selected"} ${ut(a)}`}function it(e,a,i,l){const d=a.selected.path;return!e||!d?!1:(l==="watch"?e.watches:e.controls).some(u=>{var c;return u.target.role==="server"&&((c=u.path)==null?void 0:c.root)===d.root&&JSON.stringify(u.path.segments)===JSON.stringify(d.segments)&&u.access.kind===i.accessKind&&(i.accessKind==="value"||u.access.name===i.fieldName)})}function rt(e,a,i){var l,d;return JSON.stringify([(l=e.selected.path)==null?void 0:l.root,(d=e.selected.path)==null?void 0:d.segments,a.accessKind,a.fieldName??"value",i])}function At(e,a){var l;if(e instanceof Ft&&((l=e.error)!=null&&l.trim()))return e.error;const i=e instanceof Error?e.message:String(e);return i.startsWith("API ")?`${a} ${i}`:i}function Wo(e){var J,ge,te,ce;const{t:a,locale:i="en"}=me(),[l,d]=o.useState("selection"),[u,c]=o.useState(""),[b,v]=o.useState(0),[_,R]=o.useState("My test profile"),[x,S]=o.useState(!e.profile),[f,E]=o.useState(null),[m,D]=o.useState(""),[M,I]=o.useState(!1),[P,k]=o.useState(null),[O,T]=o.useState(null),L=o.useRef(!1),ee=o.useRef({open:!1,profileId:null}),[H,A]=o.useState(null),[G,U]=o.useState(null),[ae,de]=o.useState(null),[ne,z]=o.useState(!1),[Y,K]=o.useState(null),$=P??e.profile,Q=((J=e.catalog.adapters)==null?void 0:J.find(n=>n.name===Y))??null,X=[Q?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}}",Q.name).replace("{{path}}",Q.sourcePath??Q.name).replace("{{methods}}",Q.methods.map(n=>`${n.name} (${n.sideEffectClass})`).join(", ")):"",a("playtest.values.aiRequest")].filter(Boolean).join(`
113
-
114
- `);o.useEffect(()=>{var F;const n=ee.current,p=((F=e.profile)==null?void 0:F.id)??null;ee.current={open:e.open,profileId:p};const N=n.open&&n.profileId===null&&p!==null&&L.current;!e.open||N||n.open&&n.profileId===p||(d("selection"),S(!e.profile),c(""),v(0),E(null),D(""),k(null),T(null),U(null),A(null),z(!1),K(null))},[e.open,(ge=e.profile)==null?void 0:ge.id]);const he=o.useMemo(()=>{const n=u.trim().toLocaleLowerCase();return e.catalog.entries.filter(p=>!n||[p.label,p.group,p.adapter,p.sourcePath,p.id].filter(Boolean).join(" ").toLocaleLowerCase().includes(n))},[e.catalog.entries,u]),V=((f==null?void 0:f.candidates)??[]).find(n=>$e(n)===m)??(f==null?void 0:f.candidates[0]),pe=Math.max(1,Math.ceil(he.length/50)),Z=Math.min(b,pe-1),se=he.slice(Z*50,(Z+1)*50),ve=new Set([...($==null?void 0:$.controls)??[],...($==null?void 0:$.watches)??[]].map(n=>n.origin?`${n.origin.adapter}/${n.origin.entryId}`:"")),oe=[...($==null?void 0:$.controls)??[],...($==null?void 0:$.watches)??[]],be=oe.filter(n=>n.access.kind==="adapter"||n.access.kind==="adapter_read").length,xe=oe.length-be,je=xe>=64,Pe=be>=10,fe=((te=e.catalog.adapters)==null?void 0:te.filter(n=>n.entryCount===0))??[],we=!!(e.catalog.catalogRevision&&e.catalog.verifiedAt&&!Number.isNaN(Date.parse(e.catalog.verifiedAt))),r=we&&e.catalog.verifiedAt?new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e.catalog.verifiedAt)):null,y=n=>{d(n),c(""),v(0)},j=async()=>{if($)return $;if(e.activeLease)throw new Error(a("playtest.values.stopBeforeCreate","Stop Studio Play before creating the first profile."));if(!e.onCreateProfile||!_.trim())throw new Error(a("playtest.values.profileNameRequired","Enter a profile name before adding the first value."));return e.onCreateProfile(_.trim())},g=async n=>{if(e.activeLease){k(n);return}await e.onSave(n),k(null)},w=async(n,p)=>{if(!L.current){L.current=!0,T(`adapter:${n.id}`),U(null);try{const N=await j(),F={kind:"adapter",adapter:n.adapter,entryId:n.id,version:n.adapterVersion},W=le=>{var Se;return((Se=le.origin)==null?void 0:Se.adapter)===n.adapter&&le.origin.entryId===n.id};p?await g({...N,controls:N.controls.filter(le=>!W(le)),watches:N.watches.filter(le=>!W(le))}):n.kind==="watch"?await g({...N,schemaVersion:3,watches:[...N.watches,{id:nt(N,Pt(n)),label:n.label,target:{role:"server"},access:{kind:"adapter_read",adapter:n.adapter,...n.read},valueType:n.valueType,origin:F}]}):n.write&&await g({...N,schemaVersion:3,controls:[...N.controls,{id:nt(N,Pt(n)),label:n.label,target:{role:"server"},access:{kind:"adapter",adapter:n.adapter,...n.write},observation:{kind:"adapter_read",adapter:n.adapter,...n.read},valueType:n.valueType,applyOnStart:!1,constraints:n.constraints,enumValues:n.enumValues,applyTiming:"after_agents_ready",restorePolicy:"session_end",origin:F}]})}catch(N){U(N instanceof Error?N.message:String(N))}finally{L.current=!1,T(null)}}},C=async(n,p,N)=>{if(!n.selected.path||M||L.current||it($,n,p,N))return;const F=rt(n,p,N);L.current=!0,T(F),U(null),A(null);try{const W=await j(),le=kt(n,p),re={id:nt(W,`direct-${Ko([n.selected.path.root,...n.selected.path.segments,ut(p)].join("-"))}`),label:le,target:{role:"server"},path:n.selected.path,access:zo(p),valueType:p.valueType};N==="watch"?await g({...W,schemaVersion:3,watches:[...W.watches,re]}):await g({...W,schemaVersion:3,controls:[...W.controls,{...re,...p.enumValues?{enumValues:p.enumValues}:{},applyOnStart:!1,applyTiming:"after_agents_ready",restorePolicy:"session_end"}]})}catch(W){A({key:F,kind:N,message:At(W,a("playtest.profile.saveFailed","Could not save profile."))})}finally{L.current=!1,T(null)}},q=async()=>{if(!(!e.onResolveSelectionCandidates||M||L.current)){I(!0),U(null),A(null);try{const n=await e.onResolveSelectionCandidates();E(n),D(n.candidates[0]?$e(n.candidates[0]):""),(!n.selected.path||n.candidates.length===0)&&U(a("playtest.values.selectionEmpty","Select an Instance with a supported Attribute, Value, or property in Studio."))}catch(n){E(null),U(At(n,a("playtest.values.selectionFailed","Could not read the Studio selection. Select one Instance in Explorer and try again.")))}finally{I(!1)}}},ie=async()=>{if(!(!P||e.activeLease||L.current)){L.current=!0,T("pending"),U(null);try{await e.onSave(P),k(null)}catch(n){U(n instanceof Error?n.message:String(n))}finally{L.current=!1,T(null)}}},h=async(n,p)=>{var N;await((N=navigator.clipboard)==null?void 0:N.writeText(p)),de(n)},B=[{id:"selection",label:a("playtest.values.sourceSelection","Studio selection")},{id:"registered",label:a("playtest.values.sourceRegistered","Test Adapter")}];return t.jsx(Ge,{open:e.open,ariaLabel:a("playtest.values.addTitle","Add a test value"),onClose:e.onClose,dismissDisabled:O!==null,children:t.jsxs("div",{className:s.valueManagerShell,children:[t.jsx(qe,{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:O!==null,onRequestClose:e.onClose}),t.jsx("div",{className:s.valueSourceTabs,role:"tablist","aria-label":a("playtest.values.sources","Value source"),children:B.map((n,p)=>t.jsx("button",{type:"button",role:"tab","aria-selected":l===n.id,"aria-controls":`playtest-value-source-${n.id}`,tabIndex:l===n.id?0:-1,onClick:()=>y(n.id),onKeyDown:N=>{var Se,re;if(N.key!=="ArrowLeft"&&N.key!=="ArrowRight")return;N.preventDefault();const F=N.key==="ArrowRight"?1:-1,W=(p+F+B.length)%B.length,le=B[W];if(le){y(le.id);const ye=(Se=N.currentTarget.parentElement)==null?void 0:Se.querySelectorAll('[role="tab"]');(re=ye==null?void 0:ye[W])==null||re.focus()}},children:n.label},n.id))}),t.jsxs("div",{className:s.valueManagerBody,children:[x&&t.jsxs("label",{className:s.firstProfileName,children:[t.jsx("span",{children:a("playtest.profile.name","Profile name")}),t.jsx("input",{value:((ce=e.profile)==null?void 0:ce.name)??_,readOnly:!!e.profile,"aria-label":a("playtest.profile.name","Profile name"),onChange:n=>R(n.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(xe)).replace("{{adapter}}",String(be))}),l==="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||M||O!==null,onClick:()=>void q(),children:M?a("playtest.values.readingSelection","Reading selection…"):a("playtest.values.readSelection","Read current Studio selection")})]}),(f==null?void 0:f.selected.path)&&f.candidates.length>0&&t.jsxs("div",{className:s.propertySelection,"aria-busy":M,children:[t.jsxs("div",{className:s.propertySelectionHeader,children:[t.jsxs("div",{className:s.selectedInstance,children:[t.jsx("span",{children:a("playtest.values.selectedInstance","Instance")}),t.jsx("strong",{children:f.selected.name??"Selected"}),f.selected.className&&t.jsx("span",{children:f.selected.className}),t.jsxs("details",{children:[t.jsx("summary",{children:a("playtest.values.location","Location")}),t.jsx("code",{children:[f.selected.path.root,...f.selected.path.segments].join(".")})]})]}),V&&t.jsx(Uo,{candidates:f.candidates,selected:V,disabled:M||O!==null,onSelect:n=>D($e(n))})]}),(V?[V]:[]).map(n=>{const p=kt(f,n),N=ut(n),F=H&&H.key===rt(f,n,H.kind)?H:null;return t.jsxs("div",{className:s.candidateEntry,children:[t.jsxs("div",{className:s.catalogRow,children:[t.jsxs("div",{children:[t.jsxs("strong",{children:[f.selected.name??"Selected"," · ",N]}),t.jsxs("span",{children:[a("playtest.values.actualNow","Actual now"),": ",Xe(n.value)]})]}),t.jsx("div",{className:s.candidateActions,children:["watch","control"].map(W=>{const le=it($,f,n,W),Se=le&&!it(e.profile,f,n,W),re=O===rt(f,n,W),ye=W==="watch"?a("playtest.values.addWatch","Add as Watch Value"):a("playtest.values.addControl","Add as Control"),ue=W==="watch"?a("playtest.values.addedWatch","Added as Watch Value"):a("playtest.values.addedControl","Added as Control"),_e=W==="watch"?a("playtest.values.pendingWatch","Watch Value · save pending"):a("playtest.values.pendingControl","Control · save pending"),De=a("playtest.values.adding","Adding…"),Te=re?De:Se?_e:le?ue:ye,et=W==="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":re?"saving":Se?"pending":le?"saved":"idle",disabled:M||!le&&(je||!$&&e.activeLease),"aria-disabled":le||O!==null||void 0,"aria-label":le||re?`${Te} · ${p}`:et.replace("{{label}}",p),onClick:()=>void C(f,n,W),children:[[ye,`✓ ${ue}`,_e,De].map(ht=>t.jsx("span",{className:s.candidateActionSizer,"aria-hidden":"true",children:ht},ht)),t.jsx("span",{className:s.candidateActionLabel,"aria-live":"polite","aria-atomic":"true",children:le&&!Se&&!re?`✓ ${Te}`:Te})]},W)})})]}),F&&t.jsxs("div",{className:s.candidateError,role:"alert",children:[t.jsx("span",{children:F.message}),t.jsx("button",{type:"button",disabled:O!==null,onClick:()=>void C(f,n,F.kind),children:a("playtest.values.retryAddition","Try again")})]})]},`${n.accessKind}:${N}`)})]})]}),l==="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.")}),r&&t.jsx("span",{children:a("playtest.values.lastChecked","Last checked: {{time}}").replace("{{time}}",r)})]}),fe.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.")})]}),fe.map(n=>t.jsxs("div",{className:s.adapterSetupRow,children:[t.jsxs("div",{children:[t.jsx("strong",{children:n.name}),t.jsxs("span",{children:[a("playtest.values.adapterSetupRequired","Value setup required")," · ",a("playtest.values.adapterVersion","Version")," ",n.version]}),n.sourcePath&&t.jsx("code",{children:n.sourcePath}),t.jsx("div",{className:s.adapterMethods,children:n.methods.map(p=>t.jsxs("span",{children:[p.name," · ",p.sideEffectClass==="read_only"?a("playtest.values.methodReadOnly","Read only"):a("playtest.values.methodReversible","Reversible fixture")]},p.name))})]}),t.jsx("button",{type:"button","aria-label":a("playtest.values.configureAdapterLabel","Configure values for {{adapter}}").replace("{{adapter}}",n.name),onClick:()=>{K(n.name),z(!0)},children:a("playtest.values.configureAdapter","Configure values")})]},n.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:u,onChange:n=>{c(n.target.value),v(0)},placeholder:a("playtest.values.searchPlaceholder","Name, group, source, or path")})]}),e.catalog.entries.length>0&&t.jsx("div",{className:s.valueCount,role:"status",children:a("playtest.values.count","{{visible}} of {{total}} values").replace("{{visible}}",String(he.length)).replace("{{total}}",String(e.catalog.entries.length))}),se.length>0?t.jsx("div",{className:s.catalogGroups,children:se.map(n=>{const p=ve.has(`${n.adapter}/${n.id}`);return t.jsxs("div",{className:s.catalogRow,children:[t.jsxs("div",{children:[t.jsx("strong",{children:n.label}),t.jsxs("span",{children:[n.group," · ",n.kind==="control"?a("playtest.values.control","Control"):a("playtest.values.watch","Watch")]}),t.jsx("code",{children:n.sourcePath??n.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:n.sourcePath??`ServerStorage.WeppyTestAdapters.${n.adapter}`})})]}),t.jsxs("div",{children:[t.jsx("dt",{children:a("playtest.values.profileUsage","Current profile")}),t.jsx("dd",{children:p?$==null?void 0:$.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 h(`remove:${n.adapter}/${n.id}`,`Review removal of the WEPPY Playtest adapter registration ${n.adapter}/${n.id}.
115
-
116
- - Call manage_studio.playtest_adapter_plan with adapterOperation=remove_entry, adapterId=${n.adapter}, and adapterRegistrationId=${n.id}.
117
- - Show the current source SHA-256, unified diff, profile and scenario usages, dynamic-reference coverage, and production exclusion strategy.
118
- - Do not change source until I review the plan.
119
- - Apply only the returned unexpired plan token and expected source hash.
120
- - After apply, start a new Play and confirm the catalog no longer includes this entry.`),children:ae===`remove:${n.adapter}/${n.id}`?a("playtest.values.copied","Copied"):a("playtest.values.copyRemovalRequest","Copy original registration removal request")})]})]}),t.jsx("button",{type:"button",disabled:O!==null||!p&&Pe||!$&&e.activeLease,"aria-label":p?`${a("playtest.values.remove","Remove")} ${n.label} ${a("playtest.values.fromProfile","from profile")}`:`${a("playtest.values.add","Add")} ${n.label}`,onClick:()=>void w(n,p),children:p?a("playtest.values.removeFromProfile","Remove from profile"):O===`adapter:${n.id}`?a("playtest.profile.saving","Saving…"):a("playtest.values.add","Add")})]},`${n.adapter}/${n.id}`)})}):e.catalog.entries.length===0&&fe.length===0?t.jsxs("div",{className:s.registeredEmpty,children:[t.jsx("strong",{children:we?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:we?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:()=>y("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(""),v(0)},children:a("playtest.values.clearSearch","Clear search")})]}):null,pe>1&&t.jsxs("div",{className:s.valuePagination,children:[t.jsx("button",{type:"button",disabled:Z===0,onClick:()=>v(n=>n-1),children:a("playtest.values.previous","Previous")}),t.jsxs("span",{children:[Z+1," / ",pe]}),t.jsx("button",{type:"button",disabled:Z+1>=pe,onClick:()=>v(n=>n+1),children:a("playtest.values.next","Next")})]}),e.catalog.diagnostics.map(n=>t.jsxs("div",{className:s.bindingError,role:"alert",children:[n.adapter,n.entryId?`/${n.entryId}`:"",": ",n.message]},`${n.adapter}/${n.entryId??n.code}`)),t.jsxs("details",{className:s.connectionGuide,open:ne,onToggle:n=>z(n.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.")}),Q&&t.jsx("p",{className:s.adapterSetupContext,children:a("playtest.values.configuringAdapter","Configuring {{adapter}} using its detected methods.").replace("{{adapter}}",Q.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:Rt})]}),t.jsxs("details",{className:s.registrationExample,children:[t.jsx("summary",{children:a("playtest.values.showAiExample","Show AI request example")}),t.jsx("pre",{children:X})]}),t.jsxs("div",{className:s.registrationActions,children:[t.jsx("button",{type:"button",onClick:()=>void h("example",Rt),children:ae==="example"?a("playtest.values.copied","Copied"):a("playtest.values.copyExample","Copy Luau example")}),t.jsx("button",{type:"button",onClick:()=>void h("ai",X),children:ae==="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||O!==null,onClick:()=>void ie(),children:e.activeLease?a("playtest.values.stopToSave","Stop Play to save"):a("playtest.profile.save","Save profile")})]}),G&&t.jsx("div",{className:s.bindingError,role:"alert",children:G})]}),t.jsx("div",{className:s.valueManagerFooter,children:t.jsx("button",{type:"button",className:s.primaryAction,disabled:O!==null||P!==null||oe.length===0,onClick:e.onClose,children:a("playtest.values.viewAdded","View added values")})})]})})}const Yo=`{
121
- "name": "Production",
122
- "globIgnorePaths": ["src/ServerStorage/WeppyTestAdapters/**"],
123
- "tree": {
124
- "$className": "DataModel",
125
- "ServerStorage": { "$path": "src/ServerStorage" }
126
- }
127
- }`;function Jo(e){const{t:a}=me();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:Yo}),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 Qo(e){return e.studioState==="running"?"Running":e.studioState==="paused"?"Paused":"Edit"}function Xo(e,a){const i=((e==null?void 0:e.pluginClients)??[]).filter(d=>d.connectionState==="connected");let l;if(a!==null){const d=i.filter(u=>u.placeId===a);l=d.length===1?d[0]:void 0}else l=Ht(i,(e==null?void 0:e.studioRoutingMode)??"recentPriority",(e==null?void 0:e.pinnedTargetClientId)??null)[0];return l?{state:Qo(l),targetClientId:l.clientId,...l.studioStateUpdatedAt!==void 0?{updatedAt:l.studioStateUpdatedAt}:{},...l.playtestMode!==void 0?{mode:l.playtestMode}:{}}:{state:"Edit",targetClientId:null}}function mc(){var r,y,j,g,w;const{t:e}=me(),a=Gt(),i=qt(),{trackEvent:l}=Ut(),{tier:d,loading:u}=Kt(),{level:c,status:b}=zt(),v=!u&&d==="basic",[_,R]=o.useState(null),x=Da({enabled:!v,placeId:_}),S=Xo(b,_),f=go({enabled:!u&&c==="studioConnected",canMutate:!v,placeId:_,studioSnapshot:S}),[E,m]=o.useState(mo),[D,M]=o.useState(!1),[I,P]=o.useState(!1),[k,O]=o.useState(!1),T=o.useRef(null),[L,ee]=o.useState(!1),{show:H}=Wt(),[A,G]=o.useState(null),[U,ae]=o.useState(!1),[de,ne]=o.useState(!1);o.useEffect(()=>{const C=new URLSearchParams(a.search);if(C.get("add")!=="value")return;m("live"),P(!0),C.delete("add");const q=C.toString();i(`${a.pathname}${q?`?${q}`:""}${a.hash}`,{replace:!0})},[a.hash,a.pathname,a.search,i]);const z=c==="studioConnected",Y=z?f.profile?f.studioState==="Edit"?e("playtest.values.playRequired","Start Play or Run in Studio to change test values."):v?e("playtest.controls.proRequired","Real-time value editing and Reset all are available with Pro."):e("playtest.controls.connectingDescription","Preparing runtime controls for the selected profile…"):e("playtest.controls.profileRequired","Select or create a test profile to change values."):e("playtest.controls.studioRequired","Connect Roblox Studio and WEPPY Plugin to change test values."),K=z?f.studioState:"Disconnected",$=o.useRef(null),{history:Q,historyLoadState:Ne,historyError:X,selectedReport:he,loading:V,detailLoading:pe,detailError:Z}=x,se=v?Ta(e):null,ve=((r=se==null?void 0:se.history[0])==null?void 0:r.recordId)??null,oe=(se==null?void 0:se.history)??Q,be=se&&A===ve?se.report:he,xe=v?!1:V,je=oe.find(C=>C.recordId===A),Pe=(C,q)=>{$.current=q,G(C),!v&&x.loadReport(C)},fe=o.useCallback(()=>{G(null),x.clearSelectedReport()},[x.clearSelectedReport]),we=async()=>{ne(!0);try{await x.clearHistory(),H(e("toast.clearSuccess","Cleared successfully"),"success"),ae(!1),G(null)}catch{H(e("toast.clearFailed","Failed to clear data"),"error")}finally{ne(!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:d},actions:t.jsx(Xt,{ref:T,type:"button",variant:"secondary",size:"sm",onClick:()=>O(!0),children:e("playtest.guide.open","Before publishing")})}),!u&&t.jsx(ea,{surface:"playtest",selectable:!0,selectedPlaceId:_,onSelectedPlaceIdChange:C=>{R(C),G(null),x.clearSelectedReport()}}),!u&&t.jsxs(t.Fragment,{children:[t.jsx(bo,{value:E,onChange:C=>{m(C),ho(C)}}),t.jsx(_o,{lease:f.lease,profileName:(y=f.profile)==null?void 0:y.name,studioState:K,studioMode:S.mode}),v&&t.jsx(Jt,{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:Yt.playtest}),f.error&&t.jsx("div",{className:s.inlineError,role:"alert",children:f.error}),E==="live"&&t.jsx(Oo,{live:f,inactiveReason:Y,onManageValues:()=>P(!0),onNewProfile:()=>{ee(!1),M(!0)},onEditProfile:()=>{ee(!0),M(!0)},directAddDisabledReason:z?void 0:e("playtest.controls.studioRequired","Connect Roblox Studio and WEPPY Plugin to change test values.")})]}),E==="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(Zt,{label:e("playtest.history.title","Test History"),tooltip:e("playtest.history.title.tooltip","Recorded automated playtest runs for this project.")}),v?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:()=>{l("dashboard_click_event",{click_target:"playtest_clear_history",page:"playtest"}),ae(!0)},children:e("common.clear","Clear")})]}),(v||!xe&&Ne==="ready"&&oe.length===0)&&t.jsx(Vt,{kind:"no-results",isBasic:v}),!v&&Ne==="error"&&oe.length===0&&t.jsxs("div",{className:s.inlineError,role:"alert",children:[t.jsx("span",{children:X??e("playtest.emptyResults.loadFailed","Could not load test results.")}),t.jsx("button",{type:"button",className:s.secondaryAction,onClick:()=>void x.retryHistory(),children:e("common.retry","Try again")})]}),xe?t.jsx("div",{className:s.emptyState,children:e("common.loading","Loading...")}):oe.length===0?null:t.jsx(lo,{entries:oe,onSelect:Pe,selectedRecordId:A??void 0})]}),t.jsx(Ge,{open:k,ariaLabel:e("playtest.guide.title","Publishing your game after playtesting"),onClose:()=>O(!1),returnFocusTo:T.current,children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(qe,{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:()=>O(!1)}),t.jsx("div",{className:s.detailBody,children:t.jsx(Jo,{showHeading:!1,hasManagedAdapterWithoutStudioGuard:((j=f.releaseGuidance)==null?void 0:j.hasManagedAdapterWithoutStudioGuard)===!0})})]})}),t.jsx(Ge,{open:A!==null,ariaLabel:e("playtest.detail.dialogLabel","Playtest report detail"),onClose:fe,returnFocusTo:$.current,testId:"playtest-detail-popup-layer",children:t.jsxs("div",{className:s.detailShell,children:[t.jsx(qe,{title:e("playtest.report.title","Selected Report"),description:je==null?void 0:je.testName,closeLabel:e("common.close","Close"),onRequestClose:fe}),t.jsx("div",{className:s.detailBody,children:pe?t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")}):Z?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:Z}),t.jsx("button",{type:"button",className:s.detailRetryButton,onClick:()=>void x.retryReport(),children:e("common.retry","Retry")})]}):be?t.jsx(po,{report:be}):t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")})})]})}),!u&&t.jsxs(t.Fragment,{children:[!v&&t.jsx(ot,{open:U,title:e("playtest.clear.title","Clear test history?"),message:e("playtest.clear.message","This permanently removes the stored playtest reports for the current place."),cancelLabel:e("common.cancel","Cancel"),confirmLabel:e("common.clear","Clear"),loading:de,onCancel:()=>!de&&ae(!1),onConfirm:we}),t.jsx(qo,{open:D,onClose:()=>M(!1),profile:L?f.profile:null,onCreate:f.createProfile,onSave:f.saveProfile,onDelete:async(C,q)=>{const ie=await f.deleteProfile(C,q);H(ie.refreshFailed?e("playtest.profile.deleteRefreshFailed","Profile deleted. Reload the profile list to confirm the latest state."):e("playtest.profile.deleteSuccess","Profile deleted."),ie.refreshFailed?"warning":"success")},deleteDisabledReason:((g=f.lease)==null?void 0:g.profileId)===((w=f.profile)==null?void 0:w.id)?e("playtest.profile.deleteActive","This profile is in use. Stop Play or Run in Studio before deleting it."):void 0,onResolveSelection:f.resolveSelection,onResolveSelectionCandidates:f.resolveSelectionCandidates}),t.jsx(Wo,{open:I,profile:f.profile,catalog:f.catalog,activeLease:!!f.lease,onClose:()=>P(!1),onSave:f.saveProfile,onCreateProfile:f.createProfile,onResolveSelectionCandidates:f.resolveSelectionCandidates})]})]})}export{mc as Component};