@weppy/roblox-mcp 2.16.0 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dashboard/dist/assets/{AssetsPage-Dcj0TWe9.js → AssetsPage-_CPMetwm.js} +2 -2
  3. package/dashboard/dist/assets/ChangelogPage-B9Ct115r.css +1 -0
  4. package/dashboard/dist/assets/ChangelogPage-BpTjHwvr.js +1 -0
  5. package/dashboard/dist/assets/{ConfirmModal-CyjUVYwz.js → ConfirmModal-BSbhJt6x.js} +1 -1
  6. package/dashboard/dist/assets/{ConnectionPage-B1tZK4zW.js → ConnectionPage-BMIbBueG.js} +2 -2
  7. package/dashboard/dist/assets/ContentScopedDialog-D92wgDaU.js +1 -0
  8. package/dashboard/dist/assets/ContentScopedDialog-DCgVfmeB.css +1 -0
  9. package/dashboard/dist/assets/{ControlsPage-zlLRwkt6.js → ControlsPage-C828Cgwo.js} +2 -2
  10. package/dashboard/dist/assets/CurrentPlaceScope-BFYSAg2T.js +1 -0
  11. package/dashboard/dist/assets/{GameChangeDetail-CONsGQ2-.js → GameChangeDetail-CCQ8h1ft.js} +1 -1
  12. package/dashboard/dist/assets/{InfoLabel-Cf_fu0ZE.js → InfoLabel-D6WxKFnG.js} +1 -1
  13. package/dashboard/dist/assets/OverviewPage-B8RMrIaQ.js +1 -0
  14. package/dashboard/dist/assets/{UiPrimitive-BMSNRGwI.css → PageHeader-CrhjZjgp.css} +1 -1
  15. package/dashboard/dist/assets/PageHeader-Xrn6BpcL.js +6 -0
  16. package/dashboard/dist/assets/PlaytestPage-C-WO2SsY.css +1 -0
  17. package/dashboard/dist/assets/PlaytestPage-CrCurhRT.js +11 -0
  18. package/dashboard/dist/assets/SettingsPage-B_9NwPEF.js +1 -0
  19. package/dashboard/dist/assets/{StatusBadge-DPEvJdzm.js → StatusBadge-Ddzg1cSk.js} +1 -1
  20. package/dashboard/dist/assets/SyncPage-BNadN0NU.js +1 -0
  21. package/dashboard/dist/assets/{Tabs-BXHuo9Wk.js → Tabs-DZDOsT6_.js} +1 -1
  22. package/dashboard/dist/assets/ToolsPage-B4t6LvfV.css +1 -0
  23. package/dashboard/dist/assets/ToolsPage-bHm2QbDR.js +1 -0
  24. package/dashboard/dist/assets/{TooltipText-55u9HaGy.js → TooltipText-B1An7dUI.js} +1 -1
  25. package/dashboard/dist/assets/UiStudioPage-CWQgLMHO.js +11 -0
  26. package/dashboard/dist/assets/{UiStudioPage-Cej06eXQ.css → UiStudioPage-Ds-eaGvd.css} +1 -1
  27. package/dashboard/dist/assets/WhatsNewPage-D-iibgAc.js +1 -0
  28. package/dashboard/dist/assets/{copy-szgBQciT.js → copy-B03ftJiE.js} +1 -1
  29. package/dashboard/dist/assets/{index-CACN5u4J.js → index-Ygt1Wh6v.js} +26 -26
  30. package/dashboard/dist/assets/sample-requests-r6iFLFba.js +1 -0
  31. package/dashboard/dist/assets/{useLiveUptime-kOkM_pqk.js → useLiveUptime-CnfGQ_vS.js} +1 -1
  32. package/dashboard/dist/assets/useSettings-BrnGUYZY.js +1 -0
  33. package/dashboard/dist/index.html +1 -1
  34. package/dist/index.js +91 -91
  35. package/package.json +1 -1
  36. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  37. package/dashboard/dist/assets/ChangelogDetailPage-Bw3gyr1A.js +0 -1
  38. package/dashboard/dist/assets/ChangelogDetailPage-vGgnpq1q.css +0 -1
  39. package/dashboard/dist/assets/ChangelogPage-0WZSh2m-.js +0 -1
  40. package/dashboard/dist/assets/ChangelogPage-DsP0fTsc.css +0 -1
  41. package/dashboard/dist/assets/CurrentPlaceScope-BdkdaT7r.js +0 -1
  42. package/dashboard/dist/assets/OverviewPage-B7Y5VEFH.js +0 -1
  43. package/dashboard/dist/assets/PageHeader-CTOJDcG8.js +0 -6
  44. package/dashboard/dist/assets/PageHeader-CV_rjuG8.css +0 -1
  45. package/dashboard/dist/assets/PlaytestPage-BJq2ns66.css +0 -1
  46. package/dashboard/dist/assets/PlaytestPage-Zab8aOB7.js +0 -11
  47. package/dashboard/dist/assets/SettingsPage-CizCAf2d.js +0 -1
  48. package/dashboard/dist/assets/SyncPage-M1CTHa74.js +0 -1
  49. package/dashboard/dist/assets/ToolsPage-CAaH9fIQ.css +0 -1
  50. package/dashboard/dist/assets/ToolsPage-oPc2T58z.js +0 -1
  51. package/dashboard/dist/assets/UiPrimitive-BUpeGXNh.js +0 -1
  52. package/dashboard/dist/assets/UiStudioPage-Ck1kJetD.js +0 -11
  53. package/dashboard/dist/assets/WhatsNewPage-BoTRERVd.js +0 -1
  54. package/dashboard/dist/assets/sample-requests-DOSLzn1v.js +0 -1
  55. package/dashboard/dist/assets/useSettings-COna4-LR.js +0 -1
@@ -0,0 +1,6 @@
1
+ import{f as oe,r as d,j as t,u as se,a as ae,X as re,E as ie,h as ce,t as le}from"./index-Ygt1Wh6v.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 de=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],V=oe("circle-question-mark",de),ue="_button_vab4n_1",pe="_iconButton_vab4n_2",he="_checkboxInput_vab4n_26",fe="_button_sm_vab4n_37",be="_button_md_vab4n_42",_e="_primary_vab4n_47",ge="_secondary_vab4n_58",ye="_ghost_vab4n_69",me="_danger_vab4n_81",ve="_iconButton_sm_vab4n_104",ke="_iconButton_md_vab4n_109",Pe="_badge_vab4n_114",we="_pill_vab4n_133",Ie="_interactive_vab4n_137",Ce="_neutral_vab4n_151",xe="_accent_vab4n_157",Se="_success_vab4n_163",Ae="_warning_vab4n_169",Ee="_info_vab4n_175",Re="_error_vab4n_181",De="_pro_vab4n_193",g={button:ue,iconButton:pe,checkboxInput:he,button_sm:fe,button_md:be,primary:_e,secondary:ge,ghost:ye,danger:me,iconButton_sm:ve,iconButton_md:ke,badge:Pe,pill:we,interactive:Ie,neutral:Ce,accent:xe,success:Se,warning:Ae,info:Ee,error:Re,pro:De};function D(...e){return e.filter(Boolean).join(" ")}const Le=d.forwardRef(function({variant:n="secondary",size:o="md",className:i,type:l="button",...f},u){return t.jsx("button",{ref:u,type:l,className:D(g.button,g[n],g[`button_${o}`],i),...f})}),Q=d.forwardRef(function({size:n="md",className:o,type:i="button",...l},f){return t.jsx("button",{ref:f,type:i,className:D(g.iconButton,g[`iconButton_${n}`],o),...l})}),pt=d.forwardRef(function({variant:n="neutral",shape:o="square",interactive:i=!1,className:l,...f},u){return t.jsx("span",{ref:u,className:D(g.badge,g[n],o==="pill"&&g.pill,i&&g.interactive,l),...f})}),ht=d.forwardRef(function({className:n,type:o,...i},l){return t.jsx("input",{ref:l,type:"checkbox",className:D(g.checkboxInput,n),...i})}),O={"studio.mesh_image_apis":{action:'In Studio, open File → Experience Settings → Security and enable "Allow Mesh / Image APIs".'},"open_cloud.api_key":{action:"In Roblox Creator Hub, create an API key, add Assets under Access Permissions, enable both Read and Write, then save and test the key in WEPPY Assets settings.",docsUrl:"https://create.roblox.com/docs/cloud/auth/api-keys"},"open_cloud.assets":{docsUrl:"https://create.roblox.com/docs/cloud/guides/usage-assets"}},a={canDo:{key:"dashboardHelp.section.canDo",fallback:"What you can do here"},howItWorks:{key:"dashboardHelp.section.howItWorks",fallback:"How it works"},needs:{key:"dashboardHelp.section.needs",fallback:"What you need to use it"},currentState:{key:"dashboardHelp.section.currentState",fallback:"Check based on current status"}},He=O["studio.mesh_image_apis"],Z=O["open_cloud.api_key"],Be=O["open_cloud.assets"],Ue=Z.docsUrl,je=Be.docsUrl,Ne="https://create.roblox.com/docs/cloud/reference/features/assets",Oe="https://create.roblox.com/docs/reference/engine/classes/DataModel#CreatorId",Me="https://create.roblox.com/docs/reference/engine/classes/Player#UserId",We="https://create.roblox.com/docs/projects/groups",Te="https://create.roblox.com/docs/cloud/reference/features/groups";function y(e,n,o,i){return{id:e,title:{key:`dashboardHelp.${e}.title`,fallback:n},sections:o,links:i}}function c(e,n,o,i){return{heading:e,items:i.map((l,f)=>({key:`dashboardHelp.${n}.${o}.${f+1}`,fallback:l}))}}function r(e,n,o){return{heading:a.currentState,items:[{key:`dashboardHelp.${e}.currentState.${n}`,fallback:o}]}}function P(e,n,o,i,l,f){return y(e,n,[c(a.canDo,e,"canDo",o),c(a.needs,e,"needs",i),c(a.currentState,e,"currentState",l)],f)}function Ge(e){return e.tier==="basic"?r("assets","basic","Activate Pro before uploading to Roblox."):e.uploadEnabled===!1?r("assets","uploadDisabled","Turn on API Key local upload in Assets settings."):e.hasOpenCloudCredential===!1?r("assets","noCredential","Save and test an Open Cloud API Key."):e.hasDefaultCreator===!1?r("assets","noCreator","Save a default Creator ID or enter Creator details during upload."):r("assets","default","Open an asset detail dialog to start upload or usage scan.")}function Fe(e){return e.connectionLevel!==void 0&&e.connectionLevel!=="studioConnected"?r("sync","pluginMissing","Connect WEPPY Plugin in Studio before using live sync details."):e.tier==="basic"?r("sync","basic","Activate Pro to use bidirectional or reverse sync."):r("sync","default","Use the sync log to diagnose stuck or failed sync activity.")}function Ye(e,n={}){return e==="studioRouting"?{id:e,title:{key:"controls.studioRouting.helpLabel",fallback:"How Studio routing works"},sections:[{heading:a.canDo,items:[{key:"controls.studioRouting.priorityDescription",fallback:"Explicit Studio ID, Connection ID, or Place ID requests bypass this priority setting and route to the named Studio."}]},{heading:a.howItWorks,items:[{key:"controls.studioRouting.help.auto",fallback:"Automatic uses the highest-priority active Studio, based on recent routed commands and connection order."},{key:"controls.studioRouting.help.pinned",fallback:"Studio fixed uses the selected Studio unless the request names a Studio ID, Connection ID, or Place ID."}]}]}:e==="luauValidation"?{id:e,title:{key:"controls.luauValidation.helpLabel",fallback:"How Luau syntax validation works"},sections:[{heading:a.canDo,items:[{key:"controls.luauValidation.benefit",fallback:"After AI edits a Script, check for Luau syntax errors."}]},{heading:a.howItWorks,items:[{key:"controls.luauValidation.help.behavior",fallback:"When On, after AI finishes replacing, editing, inserting, or deleting Script lines, WEPPY checks the full code that was actually saved. When Off, the Script is edited without an automatic syntax check."},{key:"controls.luauValidation.help.response",fallback:"A clean Script keeps the usual short completion response. WEPPY gives details only when it finds an error or cannot complete the check. Large Scripts may take a little longer."},{key:"controls.luauValidation.help.nonBlocking",fallback:"If WEPPY finds a syntax error or cannot complete the check, the saved Script change is not undone. The result helps the AI fix the same Script right away."},{key:"controls.luauValidation.priority",fallback:"If an AI request differs from this setting, the Dashboard setting is used. Turn it on or off here to change how Script edits are checked."}]}]}:e==="openCloudApiKey"?y(e,"Open Cloud API Key help",[c(a.canDo,e,"canDo",["WEPPY uses this key only for Roblox Open Cloud requests."]),c(a.needs,e,"needs",[Z.action,"Set the key target to the same User or Group that you use as the upload Creator.","The raw key is encrypted on this device. It is not sent to WEPPY servers, and it is not stored in any other external storage, browser storage, telemetry, logs, tool history, or Asset Library metadata."]),n.hasOpenCloudCredential?r(e,"saved","Use Test Connection to confirm the saved key still works."):r(e,"empty","Create an API key in Roblox Creator Hub, paste it here, then save and test it.")],[{label:{key:"dashboardHelp.openCloudApiKey.link.apiKeys",fallback:"Roblox API keys"},href:Ue},{label:{key:"dashboardHelp.openCloudApiKey.link.assetsGuide",fallback:"Assets API usage guide"},href:je},{label:{key:"dashboardHelp.openCloudApiKey.link.assetsReference",fallback:"Assets API reference"},href:Ne}]):e==="openCloudCreatorId"?y(e,"Creator ID help",[c(a.canDo,e,"canDo",["The default Creator decides which User or Group owns newly uploaded Roblox assets."]),c(a.needs,e,"needs",["For User, sign in to roblox.com, open your profile from your avatar or username, then copy only the number between /users/ and /profile in the browser URL.","For Group, open the Roblox group or community page, then copy only the number after /groups/ or /communities/ in the browser URL.","Paste only the numeric ID in Creator ID. Do not paste the full URL, rbxassetid://, User, or Group text."]),n.hasDefaultCreator?r(e,"saved","Keep this value if new assets should continue using the same owner."):r(e,"empty","Choose User or Group, paste the numeric ID, then save the default Creator.")],[{label:{key:"dashboardHelp.openCloudCreatorId.link.creatorId",fallback:"Creator ID reference"},href:Oe},{label:{key:"dashboardHelp.openCloudCreatorId.link.userId",fallback:"User ID reference"},href:Me},{label:{key:"dashboardHelp.openCloudCreatorId.link.groups",fallback:"Roblox groups"},href:We},{label:{key:"dashboardHelp.openCloudCreatorId.link.groupsApi",fallback:"Groups Cloud API"},href:Te}]):{overview:y("overview","Overview help",[c(a.canDo,"overview","canDo",["Check MCP server, WEPPY Plugin, AI Agent, Sync, and recent game changes in one place."]),c(a.needs,"overview","needs",["Useful status requires the MCP server. Live Studio status also needs WEPPY Plugin connected to the active place."]),n.connectionLevel==="serverOnly"?r("overview","serverOnly","Open Roblox Studio and start WEPPY Plugin so live place data can appear."):r("overview","default","If the server disconnects, restart MCP or wait for the automatic reconnect.")]),connection:P("connection","Connection help",["Inspect server process details, connected AI agents, Studio plugin clients, and connection log events."],["The MCP server must be reachable. Plugin rows appear after Studio sends heartbeats."],["If Plugin is missing, open Roblox Studio and run WEPPY Plugin. If AI Agent is missing, reconnect the MCP server from your AI tool."]),sync:y("sync","Sync help",[c(a.canDo,"sync","canDo",["Review Studio to local sync status, direction, apply mode, and sync logs."]),c(a.needs,"sync","needs",["Sync needs an active place and connected WEPPY Plugin. Two-way and reverse workflows depend on Pro."]),Fe(n)]),assets:y("assets","Assets help",[c(a.canDo,"assets","canDo",["Browse local Asset Library files, switch place/shared scope, filter categories, scan usage, insert RBXM into Studio, and upload local assets to Roblox."]),c(a.needs,"assets","needs",["Upload needs Pro, the Open Cloud upload toggle, a valid API Key, and a Creator. Browse and preview work on Basic."]),Ge(n)]),changelog:P("changelog","Changelog help",["Review real game-change sessions extracted from AI actions and sync events."],["Entries are scoped to the active place. Basic shows only the latest preview entries."],["If the list is empty, ask the AI Agent to make a game change. Clear only deletes saved history records, not Studio objects."]),playtest:y("playtest","Playtest help",[c(a.canDo,"playtest","canDo",["Review structured Playtest evidence for UI, input, and server results saved by the AI Agent."]),c(a.needs,"playtest","needs",["Pro shows real stored reports. Basic shows one sample. Play screenshot evidence is unavailable; semantic UI and interaction evidence remain available. Live active-place confidence needs WEPPY Plugin connected."]),n.tier==="basic"?r("playtest","basic","Activate Pro to use real Playtest history."):r("playtest","default","Ask the AI Agent to run a Playtest when no report is available.")]),uiStudio:y("uiStudio","UI Studio help",[c(a.canDo,"uiStudio","canDo",["Review AI-created UI analysis, improvement suggestions, captures, and before/after history."]),c(a.needs,"uiStudio","needs",["Pro shows real UI Studio data. Basic shows a bundled sample. New capture/check actions need WEPPY Plugin connected."]),n.tier==="basic"?r("uiStudio","basic","Activate Pro to use live UI Studio previews."):r("uiStudio","default","Ask the AI Agent to capture the UI or recheck improvement suggestions, then copy follow-up requests back to the AI chat.")]),tools:P("tools","Tools help",["Inspect tool history, status classification, fallback/unsupported/warn/error details, and usage statistics."],["History and statistics depend on local recording settings and the active place bucket."],["If no records appear, check Controls > General Settings and confirm history/statistics are enabled. Expand failed rows to inspect input, permission, or connection causes."]),controls:P("controls","Controls help",["Manage Project Root, Studio routing, and MCP hot settings."],["Project Root and Studio Routing need MCP server connection. Hot settings need a server response. Asset upload controls live in Assets settings."],["Use Project Root only when MCP should write sync data under a different project folder. Use Studio Routing only for requests where the agent does not name Studio ID, Connection ID, or Place ID."]),settings:P("settings","Settings help",["Manage License, saved data cleanup, server environment display, and language."],["License actions need MCP server connection. Server environment values are read-only here. Asset upload controls live in Assets settings.",He.action],["Activate a license for Pro features. Change environment values outside WEPPY Dashboard, then restart MCP. Review delete confirmations before clearing saved data."]),whatsNew:P("whatsNew","What's New help",["Review WEPPY Dashboard, MCP, and Plugin announcements, releases, and change notes."],["Announcements are bundled locally. Unread state is stored in this browser."],["After you visit this page, unread announcements from this visit are marked read when you leave. The top header does not show a duplicate What's New button on this page."])}[e]}const $e="_root_15e9p_1",qe="_rootPage_15e9p_7",Ke="_rootField_15e9p_11",Xe="_helpButton_15e9p_15",ze="_panel_15e9p_19",Ve="_panelField_15e9p_34",Qe="_panelPage_15e9p_38",Je="_panelHeader_15e9p_42",Ze="_closeButton_15e9p_60",et="_sectionStack_15e9p_64",tt="_helpSection_15e9p_69",nt="_linkList_15e9p_70",h={root:$e,rootPage:qe,rootField:Ke,helpButton:Xe,panel:ze,panelField:Ve,panelPage:Qe,panelHeader:Je,closeButton:Ze,sectionStack:et,helpSection:tt,linkList:nt},m=12,E=8,ot=120,st=360,at=340,J=560;function rt({topicId:e,state:n,variant:o="page",className:i,tooltip:l,triggerClassName:f}){const{t:u}=se(),{trackEvent:M}=ae(),[b,w]=d.useState(!1),[x,W]=d.useState(null),L=d.useId(),T=d.useRef(null),H=d.useRef(null),B=d.useRef(null),v=Ye(e,n),S=u(v.title.key,v.title.fallback),A=d.useCallback(()=>{const s=H.current,p=B.current;if(!s||!p||typeof window>"u")return;const _=s.getBoundingClientRect(),k=p.getBoundingClientRect(),I=window.innerWidth,C=window.innerHeight,te=o==="field"?at:st,Y=k.width||Math.min(te,I-m*2),$=k.height||J;let U=o==="field"?_.left:_.right-Y;U=Math.max(m,Math.min(U,I-Y-m));const j=C-_.bottom-E-m,q=_.top-E-m,K=j<Math.min($,220)&&q>j,ne=Math.max(ot,K?q:j),X=Math.min(J,ne),z=Math.min($,X);let N=K?_.top-E-z:_.bottom+E;N=Math.max(m,Math.min(N,C-z-m)),W({top:Math.round(N),left:Math.round(U),maxHeight:Math.round(X)})},[o]);d.useLayoutEffect(()=>{b?A():W(null)},[b,A]),d.useEffect(()=>{if(!b)return;const s=_=>{var I,C;const k=_.target;k&&!((I=T.current)!=null&&I.contains(k))&&!((C=B.current)!=null&&C.contains(k))&&w(!1)},p=_=>{_.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",s),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",p)}},[b]),d.useEffect(()=>{if(!b)return;const s=()=>A();return window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s)}},[b,A]);const G=o==="field"?u("dashboardHelp.fieldButton.ariaLabel","Open field help"):u("dashboardHelp.pageButton.ariaLabel","Open page help"),ee=x?{top:x.top,left:x.left,maxHeight:x.maxHeight}:{top:-9999,left:-9999,visibility:"hidden"},F=b?t.jsxs("section",{ref:B,id:L,className:[h.panel,o==="field"?h.panelField:h.panelPage].filter(Boolean).join(" "),style:ee,role:"dialog","aria-label":S,"data-panel-placement":"help-portal",children:[t.jsxs("div",{className:h.panelHeader,children:[t.jsx("h2",{children:S}),t.jsx(Q,{type:"button",size:"sm",className:h.closeButton,"aria-label":u("common.close","Close"),onClick:()=>w(!1),children:t.jsx(re,{size:15,"aria-hidden":"true"})})]}),t.jsx("div",{className:h.sectionStack,children:v.sections.map(s=>t.jsxs("section",{className:h.helpSection,children:[t.jsx("h3",{children:u(s.heading.key,s.heading.fallback)}),t.jsx("ul",{children:s.items.map(p=>t.jsx("li",{children:u(p.key,p.fallback)},p.key))})]},s.heading.key))}),v.links&&v.links.length>0&&t.jsxs("div",{className:h.linkList,children:[t.jsx("h3",{children:u("dashboardHelp.section.links","Related links")}),v.links.map(s=>t.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",children:[u(s.label.key,s.label.fallback),t.jsx(ie,{size:12,"aria-hidden":"true"})]},s.href))]})]}):null;return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:T,className:[h.root,o==="field"?h.rootField:h.rootPage,i??""].filter(Boolean).join(" "),children:o==="field"?t.jsx(ce,{text:l??"",disabled:b,children:t.jsx(Q,{ref:H,type:"button",size:"sm",className:[h.helpButton,f??""].filter(Boolean).join(" "),"aria-label":`${G}: ${S}`,"aria-expanded":b,"aria-controls":L,onClick:()=>{w(s=>{const p=!s;return s||M("dashboard_click_event",{click_target:"dashboard_help_open",help_topic:e,placement:o}),p})},children:t.jsx(V,{size:14,"aria-hidden":"true"})})}):t.jsxs(Le,{ref:H,type:"button",variant:"secondary",size:"sm",className:h.helpButton,"aria-label":`${G}: ${S}`,"aria-expanded":b,"aria-controls":L,onClick:()=>{w(s=>{const p=!s;return s||M("dashboard_click_event",{click_target:"dashboard_help_open",help_topic:e,placement:o}),p})},children:[t.jsx(V,{size:16,"aria-hidden":"true"}),t.jsx("span",{children:u("dashboardHelp.button","Help")})]})}),F&&typeof document<"u"?le.createPortal(F,document.body):null]})}const it="_pageHeader_qym7v_1",ct="_copy_qym7v_9",lt="_titleLine_qym7v_16",dt="_actions_qym7v_39",R={pageHeader:it,copy:ct,titleLine:lt,actions:dt};function ft({title:e,description:n,badge:o,helpTopicId:i,helpState:l}){return t.jsxs("div",{className:R.pageHeader,children:[t.jsxs("div",{className:R.copy,children:[t.jsxs("div",{className:R.titleLine,children:[t.jsx("h1",{children:e}),o]}),t.jsx("p",{children:n})]}),t.jsx("div",{className:R.actions,children:t.jsx(rt,{topicId:i,state:l})})]})}export{pt as B,ht as C,rt as D,ft as P,Le as a,O as b};
@@ -0,0 +1 @@
1
+ ._page_1daxc_2{display:flex;flex-direction:column;width:100%;min-width:0;gap:16px}._sampleBanner_1daxc_10{display:flex;flex-direction:column;gap:12px;padding:18px 20px;border:1px solid var(--pro-border);border-radius:var(--radius);background:linear-gradient(135deg,#f0bd5829,#f0bd5808 55%),var(--bg-card)}._sampleBannerRow_1daxc_22{display:flex;align-items:center;justify-content:space-between;gap:20px}._sampleBannerMain_1daxc_29{display:flex;flex-direction:column;gap:8px;min-width:0}._sampleBadge_1daxc_36{width:fit-content;padding:0;border-radius:0;background:none;border:none;color:var(--pro-text);font-family:var(--font-label);font-size:11px;font-weight:600;letter-spacing:.02em;text-transform:none;opacity:.92}._sampleTitle_1daxc_51{font-family:var(--font-label);font-size:16px;font-weight:600;color:var(--text-primary)}._sampleMessage_1daxc_58{max-width:560px;color:var(--text-secondary);font-size:13px;line-height:1.5}._sampleActions_1daxc_65{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}._primaryAction_1daxc_73,._secondaryAction_1daxc_74{display:inline-flex;align-items:center;justify-content:center;min-height:34px;padding:0 14px;border-radius:var(--radius-control);font-family:var(--font-label);font-size:12px;text-decoration:none;transition:background var(--transition),border-color var(--transition),opacity var(--transition)}._secondaryAction_1daxc_74{border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);cursor:pointer}._secondaryAction_1daxc_74:hover{border-color:var(--accent);background:var(--accent-dim)}._primaryAction_1daxc_73{border:1px solid var(--pro-badge);background:var(--pro-badge);color:var(--pro-text-on-badge)}._primaryAction_1daxc_73:hover{opacity:.9}._card_1daxc_110{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:16px 20px}._cardHeader_1daxc_117{font-family:var(--font-label);font-size:13px;font-weight:600;color:var(--text-primary);margin-bottom:12px;display:flex;align-items:center;justify-content:space-between;gap:8px}._clearButton_1daxc_129{border:1px solid var(--danger-border);background:var(--danger-bg);color:var(--danger-text);border-radius:var(--radius-control);padding:6px 12px;font-family:var(--font-label);font-size:12px;font-weight:600;cursor:pointer;transition:background var(--transition),border-color var(--transition),color var(--transition)}._clearButton_1daxc_129:hover:not(:disabled){background:var(--danger-hover-bg);border-color:var(--danger)}._clearButton_1daxc_129:focus-visible{outline:none;box-shadow:var(--focus-ring)}._clearButton_1daxc_129:disabled{cursor:not-allowed;opacity:.55}._statusRow_1daxc_158{display:flex;align-items:center;gap:12px;margin-bottom:8px}._statusIndicator_1daxc_165{display:inline-block;width:8px;height:8px;border-radius:50%;flex-shrink:0}._statusRunning_1daxc_173{background:var(--success);box-shadow:0 0 6px var(--success)}._statusPaused_1daxc_178{background:var(--warning)}._statusNotRunning_1daxc_182{background:var(--text-muted)}._statusLabel_1daxc_186{font-family:var(--font-code);font-size:13px;font-weight:600;color:var(--text-primary)}._statusMeta_1daxc_193{font-family:var(--font-code);font-size:12px;color:var(--text-secondary)}._controlButtons_1daxc_199{display:flex;gap:8px;margin-top:12px}._btn_1daxc_206{font-family:var(--font-label);font-size:12px;padding:6px 14px;border-radius:var(--radius-control);border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);cursor:pointer;transition:background var(--transition),border-color var(--transition)}._btn_1daxc_206:hover{border-color:var(--accent);background:var(--accent-dim)}._btn_1daxc_206:disabled{opacity:.4;pointer-events:none}._btnPrimary_1daxc_228{background:var(--accent);color:var(--bg-card);border-color:var(--accent)}._btnPrimary_1daxc_228:hover{opacity:.9}._btnDanger_1daxc_238{border-color:var(--danger-border);background:var(--danger-bg);color:var(--danger-text)}._btnDanger_1daxc_238:hover{border-color:var(--danger);background:var(--danger-hover-bg)}._historyList_1daxc_250{display:flex;flex-direction:column;gap:4px}._historyItem_1daxc_256{display:flex;flex-direction:column;gap:4px;padding:8px 12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--bg-card);cursor:pointer;text-align:left;width:100%;font-family:inherit;transition:border-color var(--transition)}._historyItem_1daxc_256:hover{border-color:var(--accent)}._historyItem_1daxc_256:focus-visible,._stepDisclosure_1daxc_276:focus-visible{outline:none;box-shadow:var(--focus-ring)}._historyItemSelected_1daxc_281{border-color:var(--accent);background:var(--accent-dim)}._historyItemHeader_1daxc_286{display:flex;align-items:center;gap:8px}._historyIcon_1daxc_292{font-size:14px;flex-shrink:0}._historyTimestamp_1daxc_297{font-family:var(--font-code);font-size:11px;color:var(--text-muted);flex-shrink:0}._historyName_1daxc_304{min-width:0;font-family:var(--font-label);font-size:12px;font-weight:500;color:var(--text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._recordKind_1daxc_315{margin-left:auto;flex-shrink:0;padding:2px 6px;border:1px solid var(--border);border-radius:999px;color:var(--text-muted);font-family:var(--font-label);font-size:9px;font-weight:600;letter-spacing:.04em;text-transform:uppercase}._historyItemMeta_1daxc_329{display:flex;flex-wrap:wrap;gap:12px;font-family:var(--font-code);font-size:11px;color:var(--text-secondary);padding-left:22px}._historyMode_1daxc_339{color:var(--text-muted)}._historyDuration_1daxc_343{color:var(--text-secondary)}._historyStatus_1daxc_347{font-weight:500;text-transform:uppercase;font-size:10px;letter-spacing:.04em}._status_passed_1daxc_354{color:var(--success)}._status_failed_1daxc_358{color:var(--error)}._status_running_1daxc_362{color:var(--accent)}._status_timed_out_1daxc_366{color:var(--error)}._status_cancelled_1daxc_370,._status_insufficient_evidence_1daxc_371{color:var(--warning)}._historyError_1daxc_375{font-family:var(--font-code);font-size:11px;color:var(--error);padding-left:22px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._historyEvidence_1daxc_385{display:flex;flex-wrap:wrap;gap:5px 10px;padding-left:22px;color:var(--text-muted);font-family:var(--font-code);font-size:9px}._historyLimitation_1daxc_395{padding-left:22px;overflow:hidden;color:var(--warning);font-size:10px;text-overflow:ellipsis;white-space:nowrap}._detailShell_1daxc_406{display:flex;flex:1;min-width:0;min-height:0;flex-direction:column}._detailHeader_1daxc_414{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:16px;min-width:0;padding:16px 20px;border-bottom:1px solid var(--border)}._detailHeading_1daxc_425{display:flex;min-width:0;flex-direction:column;gap:4px;color:var(--text-primary);font-family:var(--font-label);font-size:13px;font-weight:600}._detailRecordName_1daxc_436{overflow:hidden;color:var(--text-secondary);font-size:12px;font-weight:400;text-overflow:ellipsis;white-space:nowrap}._detailCloseButton_1daxc_445{display:inline-grid;width:34px;height:34px;flex:0 0 34px;place-items:center;padding:0;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer}._detailCloseButton_1daxc_445:hover{border-color:var(--accent);color:var(--text-primary)}._detailCloseButton_1daxc_445:focus-visible,._detailRetryButton_1daxc_465:focus-visible{outline:none;box-shadow:var(--focus-ring)}._detailBody_1daxc_470{flex:1;min-width:0;min-height:0;overflow-x:hidden;overflow-y:auto;padding:20px}._detailState_1daxc_479{display:flex;min-height:220px;align-items:center;justify-content:center;flex-direction:column;gap:8px;color:var(--text-secondary);text-align:center}._detailErrorTitle_1daxc_490{color:var(--text-primary);font-family:var(--font-label);font-size:15px;font-weight:600}._detailErrorMessage_1daxc_497{max-width:560px;color:var(--error);font-family:var(--font-code);font-size:11px;overflow-wrap:anywhere}._detailRetryButton_1daxc_465{margin-top:6px;padding:7px 14px;border:1px solid var(--accent);border-radius:var(--radius-control);background:var(--accent);color:var(--bg-card);font-family:var(--font-label);font-size:12px;font-weight:600;cursor:pointer}._reportContainer_1daxc_519{display:flex;flex-direction:column;gap:12px}._runSummary_1daxc_525,._viewerSection_1daxc_526{border:1px solid var(--border);border-radius:var(--radius);background:var(--bg-secondary);padding:14px}._runSummary_1daxc_525{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px}._summaryLead_1daxc_539{display:flex;gap:12px;min-width:0}._summaryStatusMark_1daxc_545{display:grid;place-items:center;width:34px;height:34px;flex:0 0 34px;border:1px solid currentColor;border-radius:50%;font-family:var(--font-label);font-size:17px;font-weight:700}._viewerHeading_1daxc_558{margin:0;color:var(--text-primary);font-family:var(--font-label);font-size:12px;font-weight:650;letter-spacing:.04em;text-transform:uppercase}._summaryName_1daxc_568{margin-top:5px;overflow:hidden;color:var(--text-primary);font-family:var(--font-label);font-size:15px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}._summaryReason_1daxc_579{margin-top:3px;color:var(--text-secondary);font-size:12px;line-height:1.45}._summaryFacts_1daxc_586{display:grid;grid-template-columns:repeat(2,minmax(88px,1fr));gap:8px 14px}._summaryFacts_1daxc_586 div{display:flex;flex-direction:column;gap:2px}._summaryFacts_1daxc_586 span,._subsectionLabel_1daxc_599{color:var(--text-muted);font-family:var(--font-label);font-size:9px;letter-spacing:.06em;text-transform:uppercase}._summaryFacts_1daxc_586 strong{color:var(--text-primary);font-family:var(--font-code);font-size:11px;font-weight:500}._sectionHeadingRow_1daxc_614{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:10px}._sectionHint_1daxc_622{color:var(--text-muted);font-size:10px}._dimensionGrid_1daxc_627{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:10px}._dimensionCard_1daxc_634{min-width:0;padding:10px;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-card)}._dimensionHeader_1daxc_642{display:flex;align-items:center;gap:6px}._statusMark_1daxc_648{display:inline-grid;place-items:center;width:18px;height:18px;flex:0 0 18px;border:1px solid currentColor;border-radius:50%;font-family:var(--font-code);font-size:10px;font-weight:700}._dimensionName_1daxc_661{overflow:hidden;color:var(--text-primary);font-family:var(--font-label);font-size:11px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}._requirementBadge_1daxc_671{margin-left:auto;color:var(--text-muted);font-family:var(--font-code);font-size:8px;text-transform:uppercase}._dimensionStatus_1daxc_679{margin-top:9px;color:var(--text-primary);font-family:var(--font-code);font-size:11px}._dimensionMeta_1daxc_686{margin-top:3px;overflow-wrap:anywhere;color:var(--text-muted);font-family:var(--font-code);font-size:9px}._tone_passed_1daxc_694{color:var(--success)}._tone_failed_1daxc_695,._tone_timed_out_1daxc_696{color:var(--error)}._tone_cancelled_1daxc_697,._tone_insufficient_evidence_1daxc_698,._tone_unavailable_1daxc_699{color:var(--warning)}._tone_skipped_1daxc_700,._tone_not_requested_1daxc_701{color:var(--text-muted)}._stepList_1daxc_703{display:flex;flex-direction:column;gap:6px;margin-top:10px}._stepItem_1daxc_710{overflow:hidden;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-card)}._stepDisclosure_1daxc_276{display:grid;grid-template-columns:18px 22px minmax(0,1fr) auto 14px;align-items:center;width:100%;gap:8px;padding:9px 10px;border:0;background:transparent;color:inherit;cursor:pointer;font:inherit;text-align:left}._stepDisclosure_1daxc_276:hover{background:var(--bg-secondary)}._stepIndex_1daxc_734{color:var(--text-muted);font-family:var(--font-code);font-size:10px;text-align:right}._stepIdentity_1daxc_741{display:flex;min-width:0;flex-direction:column;gap:2px}._stepName_1daxc_748{overflow:hidden;color:var(--text-primary);font-family:var(--font-code);font-size:11px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}._stepMeta_1daxc_758,._stepStatus_1daxc_759{color:var(--text-muted);font-family:var(--font-code);font-size:9px}._stepStatus_1daxc_759{color:var(--text-secondary)}._chevron_1daxc_767{color:var(--text-muted);font-size:14px;transition:transform var(--transition)}._chevronOpen_1daxc_773{transform:rotate(180deg)}._stepDetails_1daxc_775{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:10px;border-top:1px solid var(--border);background:var(--bg-secondary)}._evidenceBlock_1daxc_784{min-width:0}._evidenceLabel_1daxc_788{margin-bottom:4px;color:var(--text-muted);font-family:var(--font-label);font-size:9px;letter-spacing:.05em;text-transform:uppercase}._evidenceBlock_1daxc_784 pre{max-height:180px;margin:0;overflow-x:hidden;overflow-y:auto;padding:8px;border:1px solid var(--border);border-radius:4px;background:var(--bg-card);color:var(--text-secondary);font-family:var(--font-code);font-size:9px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-all}._stepError_1daxc_815,._recordProblem_1daxc_816{padding:9px 10px;border:1px solid color-mix(in srgb,var(--error) 38%,var(--border));border-radius:var(--radius-control);background:color-mix(in srgb,var(--error) 8%,var(--bg-card));color:var(--error);font-size:11px}._recordProblem_1daxc_816{display:flex;flex-direction:column;gap:4px}._capabilityGrid_1daxc_831{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:10px}._capabilityItem_1daxc_838{display:grid;grid-template-columns:18px minmax(0,1fr) auto;align-items:center;gap:7px;padding:8px;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-card);color:var(--text-primary);font-size:11px}._capabilityYes_1daxc_851{color:var(--success)}._capabilityNo_1daxc_852{color:var(--text-muted)}._capabilityState_1daxc_853{color:var(--text-muted);font-size:9px}._limitations_1daxc_855,._artifactList_1daxc_856,._agentList_1daxc_857{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:10px}._agentList_1daxc_857 code{padding:3px 5px;border-radius:4px;background:var(--bg-card);color:var(--text-secondary);font-family:var(--font-code);font-size:9px}._artifactDisclosures_1daxc_874{display:flex;flex-direction:column;gap:6px;margin-top:10px}._artifactDisclosure_1daxc_874{overflow:hidden;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-card)}._artifactButton_1daxc_888{display:flex;align-items:center;justify-content:space-between;width:100%;padding:8px 10px;border:0;background:transparent;color:var(--text-secondary);cursor:pointer;font-family:var(--font-label);font-size:10px;font-weight:600;letter-spacing:.05em;text-align:left;text-transform:uppercase}._artifactButton_1daxc_888:hover{background:var(--bg-secondary)}._artifactButton_1daxc_888:focus-visible{outline:none;box-shadow:var(--focus-ring)}._artifactContent_1daxc_913{padding:10px;border-top:1px solid var(--border);background:var(--bg-secondary)}._artifactContent_1daxc_913 pre{max-height:320px;margin:0;overflow-x:hidden;overflow-y:auto;color:var(--text-secondary);font-family:var(--font-code);font-size:10px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-all}._limitationItem_1daxc_933{padding:5px 7px;border-radius:4px;background:color-mix(in srgb,var(--warning) 9%,transparent);color:var(--text-secondary);font-size:10px}._artifactList_1daxc_856 code{padding:3px 5px;border-radius:4px;background:var(--bg-card);color:var(--text-secondary);font-family:var(--font-code);font-size:9px}._reportContextPanel_1daxc_950{display:flex;flex-direction:column;gap:10px;padding:12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--bg-secondary)}._reportContextRow_1daxc_960{display:flex;flex-direction:column;gap:4px;color:var(--text-primary);font-size:12px}._reportContextLabel_1daxc_968{font-family:var(--font-label);font-size:10px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em}._reportSection_1daxc_976{border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}._reportSectionHeader_1daxc_982{font-family:var(--font-label);font-size:11px;font-weight:600;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.06em;padding:6px 12px;background:var(--bg-secondary);border-bottom:1px solid var(--border)}._reportMarkdown_1daxc_994{padding:12px;margin:0;font-family:var(--font-code);font-size:12px;line-height:1.6;color:var(--text-primary);white-space:pre-wrap;word-break:break-word;max-height:400px;overflow-y:auto}._reportLogs_1daxc_1007{padding:12px;margin:0;font-family:var(--font-code);font-size:11px;line-height:1.5;color:var(--text-secondary);white-space:pre-wrap;word-break:break-word;max-height:240px;overflow-y:auto;background:var(--bg-secondary)}._emptyState_1daxc_1022{text-align:center;padding:32px 16px;color:var(--text-muted);font-size:13px}._emptyStateTitle_1daxc_1029{font-family:var(--font-label);font-size:14px;font-weight:600;color:var(--text-secondary);margin-bottom:8px}._emptyStateMessage_1daxc_1037{font-size:12px;color:var(--text-muted);max-width:360px;margin:0 auto;line-height:1.5}._upgradePanel_1daxc_1046{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:32px 24px;text-align:center}._upgradePanelIcon_1daxc_1054{font-size:32px;margin-bottom:12px}._upgradePanelTitle_1daxc_1059{font-family:var(--font-label);font-size:15px;font-weight:600;color:var(--text-primary);margin-bottom:8px}._upgradePanelDesc_1daxc_1067{font-size:13px;color:var(--text-secondary);margin-bottom:16px;max-width:400px;margin-left:auto;margin-right:auto;line-height:1.5}._benefitList_1daxc_1077{list-style:none;padding:0;margin:0 auto 16px;display:flex;flex-direction:column;gap:4px;max-width:360px;text-align:left}._benefitItem_1daxc_1088{font-size:12px;color:var(--text-secondary);padding-left:16px;position:relative}._benefitItem_1daxc_1088:before{content:"+";position:absolute;left:0;color:var(--accent);font-weight:600}._upgradeActions_1daxc_1103{display:flex;gap:8px;justify-content:center}@media(max-width:720px){._sampleBannerRow_1daxc_22{flex-direction:column;align-items:stretch}._sampleActions_1daxc_65{justify-content:stretch}._primaryAction_1daxc_73,._secondaryAction_1daxc_74{width:100%}._runSummary_1daxc_525{grid-template-columns:1fr}._summaryFacts_1daxc_586,._capabilityGrid_1daxc_831,._dimensionGrid_1daxc_627{grid-template-columns:1fr 1fr}._stepDetails_1daxc_775{grid-template-columns:1fr}._stepDisclosure_1daxc_276{grid-template-columns:18px 18px minmax(0,1fr) 14px}._stepStatus_1daxc_759,._historyTimestamp_1daxc_297{display:none}._historyItemMeta_1daxc_329,._historyEvidence_1daxc_385,._historyLimitation_1daxc_395,._historyError_1daxc_375{padding-left:0}._detailHeader_1daxc_414{padding:14px 16px}._detailBody_1daxc_470{padding:16px}}@media(max-width:420px){._dimensionGrid_1daxc_627,._capabilityGrid_1daxc_831{grid-template-columns:1fr}._sectionHeadingRow_1daxc_614{align-items:flex-start;flex-direction:column;gap:4px}}
@@ -0,0 +1,11 @@
1
+ import{r as d,b as C,u as v,j as t,a as z,e as Z,i as J,T as W,X as Q}from"./index-Ygt1Wh6v.js";import{P as X}from"./PageHeader-Xrn6BpcL.js";import{I as U}from"./InfoLabel-D6WxKFnG.js";import{C as ee}from"./CurrentPlaceScope-BFYSAg2T.js";import{T}from"./TooltipText-B1An7dUI.js";import{C as te}from"./ConfirmModal-BSbhJt6x.js";import{C as se}from"./ContentScopedDialog-D92wgDaU.js";import"./ConfirmModal.module-DJksQHBd.js";const ae=5e3;function K(e){return typeof e=="number"?{placeId:String(e)}:void 0}function ne(e,a){return typeof a=="number"?`${e}?placeId=${encodeURIComponent(String(a))}`:e}function re(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 ie(e){return e instanceof Error?e.message:String(e)}function ce(e){const a=(e==null?void 0:e.enabled)??!0,c=(e==null?void 0:e.placeId)??null,[n,l]=d.useState([]),[i,r]=d.useState(null),[o,p]=d.useState(a),[u,m]=d.useState(!1),[H,g]=d.useState(null),S=d.useRef(null),h=d.useRef(0),N=d.useRef(null),L=d.useCallback(async()=>{try{const y=K(c),x=y?await C.get("/api/dashboard/playtest/history",y):await C.get("/api/dashboard/playtest/history");l(x.entries??[])}catch{}},[c]),w=d.useCallback(async()=>{if(!a){p(!1);return}await L(),p(!1)},[a,L]),f=d.useCallback(()=>{h.current+=1,N.current=null,r(null),m(!1),g(null)},[]);d.useEffect(()=>{f()},[f,a,c]);const R=d.useCallback(async y=>{if(!a)return;N.current=y;const x=++h.current;r(null),m(!0),g(null);try{const b=K(c),M=`/api/dashboard/playtest/detail/${encodeURIComponent(y)}`,P=b?await C.get(M,b):await C.get(M);x===h.current&&r(re(P))}catch(b){x===h.current&&g(ie(b))}finally{x===h.current&&m(!1)}},[a,c]),k=d.useCallback(async()=>{const y=N.current;y&&await R(y)},[R]),_=d.useCallback(async()=>{a&&(await C.post(ne("/api/dashboard/playtest/history/clear",c)),l([]),f())},[f,a,c]);return d.useEffect(()=>{if(!a){p(!1);return}return w(),S.current=setInterval(w,ae),()=>{S.current&&clearInterval(S.current)}},[a,w]),{history:n,selectedReport:i,loading:o,detailLoading:u,detailError:H,loadReport:R,retryReport:k,clearSelectedReport:f,clearHistory:_}}function le(e){const a="2026-03-27T15:26:00.000Z",c={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:c,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
2
+
3
+ - Spawn flow: PASS
4
+ - HUD countdown: PASS
5
+ - Wave bootstrap: PASS
6
+
7
+ This is a sample preview. Live playtests and real reports are available with Pro.`),logs:e("playtest.sample.report.logs",`[sample] boot playtest preview
8
+ [sample] spawn protection active
9
+ [sample] hud countdown rendered
10
+ [sample] wave one completed
11
+ [sample] preview report finished`),contextId:"sample_playtest_preview",contextSummary:c,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 j(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 A(e){return e==="passed"?"✓":e==="failed"||e==="timed_out"?"×":e==="cancelled"||e==="insufficient_evidence"||e==="unavailable"?"!":"–"}function O(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function B(e){return JSON.stringify(e,null,2)}function F(e,a,c){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."):c}function oe(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 de="_page_1daxc_2",ue="_sampleBanner_1daxc_10",pe="_sampleBannerRow_1daxc_22",me="_sampleBannerMain_1daxc_29",_e="_sampleBadge_1daxc_36",ye="_sampleTitle_1daxc_51",xe="_sampleMessage_1daxc_58",he="_sampleActions_1daxc_65",ve="_primaryAction_1daxc_73",ge="_secondaryAction_1daxc_74",fe="_card_1daxc_110",be="_cardHeader_1daxc_117",je="_clearButton_1daxc_129",Se="_statusRow_1daxc_158",Ne="_statusIndicator_1daxc_165",Ie="_statusRunning_1daxc_173",we="_statusPaused_1daxc_178",Re="_statusNotRunning_1daxc_182",Ce="_statusLabel_1daxc_186",Le="_statusMeta_1daxc_193",ke="_controlButtons_1daxc_199",Me="_btn_1daxc_206",Pe="_btnPrimary_1daxc_228",Be="_btnDanger_1daxc_238",Te="_historyList_1daxc_250",De="_historyItem_1daxc_256",He="_stepDisclosure_1daxc_276",Ee="_historyItemSelected_1daxc_281",Ae="_historyItemHeader_1daxc_286",$e="_historyIcon_1daxc_292",qe="_historyTimestamp_1daxc_297",Ue="_historyName_1daxc_304",Ke="_recordKind_1daxc_315",Oe="_historyItemMeta_1daxc_329",Fe="_historyMode_1daxc_339",Ve="_historyDuration_1daxc_343",Ge="_historyStatus_1daxc_347",Ye="_status_passed_1daxc_354",ze="_status_failed_1daxc_358",Ze="_status_running_1daxc_362",Je="_status_timed_out_1daxc_366",We="_status_cancelled_1daxc_370",Qe="_status_insufficient_evidence_1daxc_371",Xe="_historyError_1daxc_375",et="_historyEvidence_1daxc_385",tt="_historyLimitation_1daxc_395",st="_detailShell_1daxc_406",at="_detailHeader_1daxc_414",nt="_detailHeading_1daxc_425",rt="_detailRecordName_1daxc_436",it="_detailCloseButton_1daxc_445",ct="_detailRetryButton_1daxc_465",lt="_detailBody_1daxc_470",ot="_detailState_1daxc_479",dt="_detailErrorTitle_1daxc_490",ut="_detailErrorMessage_1daxc_497",pt="_reportContainer_1daxc_519",mt="_runSummary_1daxc_525",_t="_viewerSection_1daxc_526",yt="_summaryLead_1daxc_539",xt="_summaryStatusMark_1daxc_545",ht="_viewerHeading_1daxc_558",vt="_summaryName_1daxc_568",gt="_summaryReason_1daxc_579",ft="_summaryFacts_1daxc_586",bt="_subsectionLabel_1daxc_599",jt="_sectionHeadingRow_1daxc_614",St="_sectionHint_1daxc_622",Nt="_dimensionGrid_1daxc_627",It="_dimensionCard_1daxc_634",wt="_dimensionHeader_1daxc_642",Rt="_statusMark_1daxc_648",Ct="_dimensionName_1daxc_661",Lt="_requirementBadge_1daxc_671",kt="_dimensionStatus_1daxc_679",Mt="_dimensionMeta_1daxc_686",Pt="_tone_passed_1daxc_694",Bt="_tone_failed_1daxc_695",Tt="_tone_timed_out_1daxc_696",Dt="_tone_cancelled_1daxc_697",Ht="_tone_insufficient_evidence_1daxc_698",Et="_tone_unavailable_1daxc_699",At="_tone_skipped_1daxc_700",$t="_tone_not_requested_1daxc_701",qt="_stepList_1daxc_703",Ut="_stepItem_1daxc_710",Kt="_stepIndex_1daxc_734",Ot="_stepIdentity_1daxc_741",Ft="_stepName_1daxc_748",Vt="_stepMeta_1daxc_758",Gt="_stepStatus_1daxc_759",Yt="_chevron_1daxc_767",zt="_chevronOpen_1daxc_773",Zt="_stepDetails_1daxc_775",Jt="_evidenceBlock_1daxc_784",Wt="_evidenceLabel_1daxc_788",Qt="_stepError_1daxc_815",Xt="_recordProblem_1daxc_816",es="_capabilityGrid_1daxc_831",ts="_capabilityItem_1daxc_838",ss="_capabilityYes_1daxc_851",as="_capabilityNo_1daxc_852",ns="_capabilityState_1daxc_853",rs="_limitations_1daxc_855",is="_artifactList_1daxc_856",cs="_agentList_1daxc_857",ls="_artifactDisclosures_1daxc_874",os="_artifactDisclosure_1daxc_874",ds="_artifactButton_1daxc_888",us="_artifactContent_1daxc_913",ps="_limitationItem_1daxc_933",ms="_reportContextPanel_1daxc_950",_s="_reportContextRow_1daxc_960",ys="_reportContextLabel_1daxc_968",xs="_reportSection_1daxc_976",hs="_reportSectionHeader_1daxc_982",vs="_reportMarkdown_1daxc_994",gs="_reportLogs_1daxc_1007",fs="_emptyState_1daxc_1022",bs="_emptyStateTitle_1daxc_1029",js="_emptyStateMessage_1daxc_1037",Ss="_upgradePanel_1daxc_1046",Ns="_upgradePanelIcon_1daxc_1054",Is="_upgradePanelTitle_1daxc_1059",ws="_upgradePanelDesc_1daxc_1067",Rs="_benefitList_1daxc_1077",Cs="_benefitItem_1daxc_1088",Ls="_upgradeActions_1daxc_1103",s={page:de,sampleBanner:ue,sampleBannerRow:pe,sampleBannerMain:me,sampleBadge:_e,sampleTitle:ye,sampleMessage:xe,sampleActions:he,primaryAction:ve,secondaryAction:ge,card:fe,cardHeader:be,clearButton:je,statusRow:Se,statusIndicator:Ne,statusRunning:Ie,statusPaused:we,statusNotRunning:Re,statusLabel:Ce,statusMeta:Le,controlButtons:ke,btn:Me,btnPrimary:Pe,btnDanger:Be,historyList:Te,historyItem:De,stepDisclosure:He,historyItemSelected:Ee,historyItemHeader:Ae,historyIcon:$e,historyTimestamp:qe,historyName:Ue,recordKind:Ke,historyItemMeta:Oe,historyMode:Fe,historyDuration:Ve,historyStatus:Ge,status_passed:Ye,status_failed:ze,status_running:Ze,status_timed_out:Je,status_cancelled:We,status_insufficient_evidence:Qe,historyError:Xe,historyEvidence:et,historyLimitation:tt,detailShell:st,detailHeader:at,detailHeading:nt,detailRecordName:rt,detailCloseButton:it,detailRetryButton:ct,detailBody:lt,detailState:ot,detailErrorTitle:dt,detailErrorMessage:ut,reportContainer:pt,runSummary:mt,viewerSection:_t,summaryLead:yt,summaryStatusMark:xt,viewerHeading:ht,summaryName:vt,summaryReason:gt,summaryFacts:ft,subsectionLabel:bt,sectionHeadingRow:jt,sectionHint:St,dimensionGrid:Nt,dimensionCard:It,dimensionHeader:wt,statusMark:Rt,dimensionName:Ct,requirementBadge:Lt,dimensionStatus:kt,dimensionMeta:Mt,tone_passed:Pt,tone_failed:Bt,tone_timed_out:Tt,tone_cancelled:Dt,tone_insufficient_evidence:Ht,tone_unavailable:Et,tone_skipped:At,tone_not_requested:$t,stepList:qt,stepItem:Ut,stepIndex:Kt,stepIdentity:Ot,stepName:Ft,stepMeta:Vt,stepStatus:Gt,chevron:Yt,chevronOpen:zt,stepDetails:Zt,evidenceBlock:Jt,evidenceLabel:Wt,stepError:Qt,recordProblem:Xt,capabilityGrid:es,capabilityItem:ts,capabilityYes:ss,capabilityNo:as,capabilityState:ns,limitations:rs,artifactList:is,agentList:cs,artifactDisclosures:ls,artifactDisclosure:os,artifactButton:ds,artifactContent:us,limitationItem:ps,reportContextPanel:ms,reportContextRow:_s,reportContextLabel:ys,reportSection:xs,reportSectionHeader:hs,reportMarkdown:vs,reportLogs:gs,emptyState:fs,emptyStateTitle:bs,emptyStateMessage:js,upgradePanel:Ss,upgradePanelIcon:Ns,upgradePanelTitle:Is,upgradePanelDesc:ws,benefitList:Rs,benefitItem:Cs,upgradeActions:Ls};function D(e){return e.trim().toLowerCase()}function ks(e){switch(D(e)){case"passed":return"✓";case"failed":case"timed_out":return"×";case"running":return"◔";case"cancelled":case"insufficient_evidence":return"!";default:return"–"}}function Ms(e,a){switch(D(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 Ps(e,a){const c=D(a);return c==="running"?e("playtest.history.status.running","Running"):j(e,c)}function Bs(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Ts(e){const a=/^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})$/.exec(e);if(a){const[,n,l,i,r,o,p]=a,u=new Date(Date.UTC(Number(n),Number(l)-1,Number(i),Number(r),Number(o),Number(p)));return u.getUTCFullYear()===Number(n)&&u.getUTCMonth()===Number(l)-1&&u.getUTCDate()===Number(i)&&u.getUTCHours()===Number(r)&&u.getUTCMinutes()===Number(o)&&u.getUTCSeconds()===Number(p)?u:null}const c=Date.parse(e);return Number.isNaN(c)?null:new Date(c)}function Ds(e,a){const c=Ts(e);return c?new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"short"}).format(c):e}function Hs({entries:e,onSelect:a,selectedRecordId:c}){const{t:n,locale:l}=v();return e.length===0?t.jsx("div",{className:s.emptyState,children:n("playtest.history.empty","No test results yet")}):t.jsx("div",{className:s.historyList,children:e.map(i=>{const r=i.recordId===c;return t.jsxs("button",{className:`${s.historyItem} ${r?s.historyItemSelected:""}`,onClick:o=>a(i.recordId,o.currentTarget),"aria-current":r?"true":void 0,"aria-haspopup":"dialog",children:[t.jsxs("div",{className:s.historyItemHeader,children:[t.jsx("span",{className:s.historyIcon,children:ks(i.status)}),t.jsx("span",{className:s.historyTimestamp,children:Ds(i.timestamp,l)}),t.jsx("span",{className:s.historyName,children:i.testName}),t.jsx("span",{className:s.recordKind,children:i.recordKind==="structured"?n("playtest.history.kind.structured","Structured"):i.recordKind==="legacy"?n("playtest.history.kind.legacy","Legacy"):n("playtest.history.kind.attention","Needs attention")})]}),t.jsxs("div",{className:s.historyItemMeta,children:[t.jsx(T,{text:n("playtest.history.mode.tooltip","Playtest mode used for this recorded test run."),children:t.jsxs("span",{className:s.historyMode,children:[n("playtest.history.mode","Mode"),": ",Ms(n,i.mode)]})}),t.jsx("span",{className:s.historyDuration,children:Bs(i.durationMs)}),t.jsx(T,{text:n("playtest.history.status.tooltip","Recorded result state for this automated playtest run."),children:t.jsx("span",{className:`${s.historyStatus} ${s[`status_${D(i.status)}`]??""}`,children:Ps(n,i.status)})})]}),i.evidenceSummary&&t.jsxs("div",{className:s.historyEvidence,children:[t.jsxs("span",{children:[n("playtest.dimension.server","Server"),": ",j(n,i.evidenceSummary.server.status)]}),t.jsxs("span",{children:[n("playtest.dimension.clientUi","Client UI"),": ",j(n,i.evidenceSummary.clientUi.status)]}),i.agentCounts&&t.jsx("span",{children:n("playtest.history.agentCounts","Server {server} · Client {client}").replace("{server}",String(i.agentCounts.server)).replace("{client}",String(i.agentCounts.client))})]}),i.errorMessage&&t.jsx("div",{className:s.historyError,children:i.errorMessage}),!i.errorMessage&&i.limitation&&t.jsx("div",{className:s.historyLimitation,children:F(n,i.limitation.code,i.limitation.message)})]},i.recordId)})})}function E({label:e,open:a,onToggle:c,children:n,tooltip:l}){const i=d.useId();return t.jsxs("div",{className:s.artifactDisclosure,children:[t.jsxs("button",{className:s.artifactButton,onClick:c,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),c())},"aria-expanded":a,"aria-controls":i,children:[l?t.jsx(T,{text:l,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:i,children:n})]})}function Es({detail:e}){const{t:a}=v(),[c,n]=d.useState(()=>new Set(e.recordKind==="legacy"?["report","logs"]:[])),l=o=>n(p=>{const u=new Set(p);return u.has(o)?u.delete(o):u.add(o),u}),i=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,r=e.artifactErrors??[];return!i&&!e.markdown&&!e.logs&&r.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:[i&&t.jsx(E,{label:a("playtest.artifacts.metadata","Result metadata"),open:c.has("metadata"),onToggle:()=>l("metadata"),children:t.jsx("pre",{children:B(i)})}),e.markdown&&t.jsx(E,{label:a("playtest.report.content","Report"),tooltip:a("playtest.report.content.tooltip","Markdown summary for the selected automated playtest run."),open:c.has("report"),onToggle:()=>l("report"),children:t.jsx("pre",{children:e.markdown})}),e.logs&&t.jsx(E,{label:a("playtest.report.logs","Logs"),tooltip:a("playtest.report.logs.tooltip","Execution logs captured for the selected automated playtest run."),open:c.has("logs"),onToggle:()=>l("logs"),children:t.jsx("pre",{children:e.logs})})]}),r.map(o=>t.jsx("div",{className:s.stepError,children:o.message},`${o.code}-${o.message}`))]})}function As({result:e}){const{t:a}=v(),c=[[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:c.map(([n,l])=>t.jsxs("div",{className:s.capabilityItem,children:[t.jsx("span",{className:l?s.capabilityYes:s.capabilityNo,"aria-hidden":"true",children:l?"✓":"–"}),t.jsx("span",{children:n}),t.jsx("span",{className:s.capabilityState,children:l?a("playtest.capability.available","Available"):a("playtest.capability.unavailable","Unavailable")})]},n))}),e.agents.length>0&&t.jsxs("div",{className:s.agentList,children:[t.jsx("span",{className:s.subsectionLabel,children:a("playtest.agents.title","Test agents")}),e.agents.map((n,l)=>{const i=typeof n.agentId=="string"?n.agentId:`${a("playtest.agents.unknown","Agent")} ${l+1}`,r=typeof n.role=="string"?n.role:"unknown",o=typeof n.clientId=="string"?` · ${n.clientId}`:"";return t.jsxs("code",{children:[i," · ",r,o]},`${i}-${l}`)})]}),e.limitations.length>0&&t.jsxs("div",{className:s.limitations,children:[t.jsx("div",{className:s.subsectionLabel,children:a("playtest.limitations.title","Limitations")}),e.limitations.map(n=>t.jsxs("div",{className:s.limitationItem,children:["! ",F(a,n.code,n.message)]},n.code))]})]})}const $s=["server","clientUi","interaction","visual"];function qs({result:e}){const{t:a}=v(),c={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:$s.map(n=>{const l=e.dimensions[n];return t.jsxs("div",{className:s.dimensionCard,children:[t.jsxs("div",{className:s.dimensionHeader,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${l.status}`]??""}`,"aria-hidden":"true",children:A(l.status)}),t.jsx("span",{className:s.dimensionName,children:c[n]}),t.jsx("span",{className:s.requirementBadge,children:l.required?a("playtest.dimension.required","Required"):a("playtest.dimension.optional","Optional")})]}),t.jsx("div",{className:s.dimensionStatus,children:j(a,l.status)}),l.provider&&t.jsx("div",{className:s.dimensionMeta,children:l.provider}),l.reason&&t.jsx("div",{className:s.dimensionMeta,children:oe(a,l.reason)}),t.jsxs("div",{className:s.dimensionMeta,children:[a("playtest.dimension.steps","Steps"),": ",l.stepIds.length]})]},n)})})]})}function Us({result:e}){const{t:a}=v(),c=d.useId(),[n,l]=d.useState(()=>new Set),i=r=>{l(o=>{const p=new Set(o);return p.has(r)?p.delete(r):p.add(r),p})};return t.jsxs("section",{className:s.viewerSection,"aria-labelledby":`${c}-heading`,children:[t.jsx("h3",{id:`${c}-heading`,className:s.viewerHeading,children:a("playtest.steps.title","Step timeline")}),t.jsx("div",{className:s.stepList,children:e.steps.map(r=>{const o=n.has(r.stepId),p=`${c}-${r.index}-details`,u=r.target.role==="server"?a("playtest.steps.server","Server"):r.target.clientId;return t.jsxs("div",{className:s.stepItem,children:[t.jsxs("button",{className:s.stepDisclosure,onClick:()=>i(r.stepId),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),i(r.stepId))},"aria-expanded":o,"aria-controls":p,children:[t.jsx("span",{className:`${s.statusMark} ${s[`tone_${r.status}`]??""}`,"aria-hidden":"true",children:A(r.status)}),t.jsx("span",{className:s.stepIndex,children:r.index+1}),t.jsxs("span",{className:s.stepIdentity,children:[t.jsx("span",{className:s.stepName,children:r.stepId}),t.jsxs("span",{className:s.stepMeta,children:[u," · ",r.action," · ",O(r.durationMs)]})]}),t.jsx("span",{className:s.stepStatus,children:j(a,r.status)}),t.jsx("span",{className:`${s.chevron} ${o?s.chevronOpen:""}`,"aria-hidden":"true",children:"⌄"})]}),o&&t.jsxs("div",{className:s.stepDetails,id:p,role:"region","aria-label":`${r.stepId} ${a("playtest.steps.details","details")}`,children:[r.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:B(r.expected)})]}),r.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:B(r.observed)})]}),r.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:B(r.evidence)})]}),r.error&&t.jsxs("div",{className:s.stepError,children:[t.jsx("strong",{children:r.error.code})," — ",r.error.message]})]})]},r.stepId)})})]})}function Ks({report:e}){var n;const{t:a}=v(),c=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:c}),t.jsx("span",{children:((n=e.error)==null?void 0:n.message)??a("playtest.record.unavailable","Result details are unavailable.")})]})}function Os({report:e}){var l,i,r,o,p,u;const{t:a}=v(),c=!!((l=e.contextSummary)!=null&&l.testScenario||(i=e.contextSummary)!=null&&i.expectedBehavior||(r=e.contextSummary)!=null&&r.observedBehavior),n=e.recordKind==="structured"?e.result:void 0;return t.jsxs("div",{className:s.reportContainer,children:[n&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:s.runSummary,"aria-labelledby":"playtest-summary-heading",children:[t.jsxs("div",{className:s.summaryLead,children:[t.jsx("span",{className:`${s.summaryStatusMark} ${s[`tone_${n.overallStatus}`]??""}`,"aria-hidden":"true",children:A(n.overallStatus)}),t.jsxs("div",{children:[t.jsx("h3",{id:"playtest-summary-heading",className:s.viewerHeading,children:a("playtest.summary.title","Run summary")}),t.jsx("div",{className:s.summaryName,children:n.testName}),t.jsx("div",{className:s.summaryReason,children:n.terminalReason.message})]})]}),t.jsxs("div",{className:s.summaryFacts,children:[t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.status","Status")}),t.jsx("strong",{children:j(a,n.overallStatus)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.mode","Mode")}),t.jsx("strong",{children:n.mode==="play"?a("playtest.status.mode.play","Play"):a("playtest.status.mode.run","Run")})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.duration","Duration")}),t.jsx("strong",{children:O(n.durationMs)})]}),t.jsxs("div",{children:[t.jsx("span",{children:a("playtest.summary.cleanup","Cleanup")}),t.jsx("strong",{children:j(a,n.cleanup.status)})]})]})]}),t.jsx(qs,{result:n}),t.jsx(Us,{result:n}),t.jsx(As,{result:n})]}),e.recordKind!=="structured"&&e.recordKind!=="legacy"&&t.jsx(Ks,{report:e}),c&&t.jsxs("div",{className:s.reportContextPanel,children:[((o=e.contextSummary)==null?void 0:o.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})]}),((p=e.contextSummary)==null?void 0:p.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})]}),((u=e.contextSummary)==null?void 0:u.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(Es,{detail:e},e.recordId),!n&&!e.markdown&&!e.logs&&e.recordKind==="legacy"&&t.jsx("div",{className:s.emptyState,children:a("playtest.report.empty","No report content available")})]})}function Qs(){var q;const{t:e}=v(),{trackEvent:a}=z(),{tier:c,loading:n}=Z(),l=!n&&c==="basic",[i,r]=d.useState(null),o=ce({enabled:!l,placeId:i}),{show:p}=J(),[u,m]=d.useState(null),[H,g]=d.useState(!1),[S,h]=d.useState(!1),N=d.useRef(null),{history:L,selectedReport:w,loading:f,detailLoading:R,detailError:k}=o,_=l?le(e):null,y=((q=_==null?void 0:_.history[0])==null?void 0:q.recordId)??null,x=(_==null?void 0:_.history)??L,b=_&&u===y?_.report:w,M=l?!1:f,P=x.find(I=>I.recordId===u),V=(I,Y)=>{N.current=Y,m(I),!l&&o.loadReport(I)},$=d.useCallback(()=>{m(null),o.clearSelectedReport()},[o.clearSelectedReport]),G=async()=>{h(!0);try{await o.clearHistory(),p(e("toast.clearSuccess","Cleared successfully"),"success"),g(!1),m(null)}catch{p(e("toast.clearFailed","Failed to clear data"),"error")}finally{h(!1)}};return t.jsxs("div",{className:s.page,children:[t.jsx(X,{title:e("page.playtest.title","Playtest"),description:e("page.playtest.description","Review automated playtest runs, saved reports, and result history."),helpTopicId:"playtest",helpState:{tier:c}}),!l&&t.jsx(ee,{surface:"playtest",selectable:!0,selectedPlaceId:i,onSelectedPlaceIdChange:I=>{r(I),m(null),o.clearSelectedReport()}}),l&&t.jsx("div",{className:s.sampleBanner,children:t.jsxs("div",{className:s.sampleBannerRow,children:[t.jsxs("div",{className:s.sampleBannerMain,children:[t.jsx("div",{className:s.sampleBadge,children:e("playtest.sample.badge","Preview of the Pro playtest view")}),t.jsx("div",{className:s.sampleTitle,children:e("playtest.sample.title","You are previewing the report viewer that becomes available after upgrading to Pro.")}),t.jsx("div",{className:s.sampleMessage,children:e("playtest.sample.message","This preview uses sample data. Real playtest history management and stored reports unlock with Pro.")})]}),t.jsx("div",{className:s.sampleActions,children:t.jsx("a",{className:s.primaryAction,href:W.playtest,target:"_blank",rel:"noreferrer",onClick:()=>a("dashboard_click_event",{click_target:"upgrade_cta",placement:"playtest_sample_banner",page:"playtest"}),children:e("tier.upgrade","View Pro")})})]})}),t.jsxs("div",{className:s.card,children:[t.jsxs("div",{className:s.cardHeader,children:[t.jsx(U,{label:e("playtest.history.title","Test History"),tooltip:e("playtest.history.title.tooltip","Recorded automated playtest runs for this project.")}),l?t.jsx(T,{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:()=>{a("dashboard_click_event",{click_target:"playtest_clear_history",page:"playtest"}),g(!0)},children:e("common.clear","Clear")})]}),M?t.jsx("div",{className:s.emptyState,children:e("common.loading","Loading...")}):x.length===0?t.jsxs("div",{className:s.emptyState,children:[t.jsx("div",{className:s.emptyStateTitle,children:e("playtest.empty.title","No playtest results yet")}),t.jsx("div",{className:s.emptyStateMessage,children:e("playtest.empty.message","Test results for this place will appear here after the AI Agent runs a Playtest.")})]}):t.jsx(Hs,{entries:x,onSelect:V,selectedRecordId:u??void 0})]}),t.jsx(se,{open:u!==null,ariaLabel:e("playtest.detail.dialogLabel","Playtest report detail"),onClose:$,returnFocusTo:N.current,testId:"playtest-detail-popup-layer",children:t.jsxs("div",{className:s.detailShell,children:[t.jsxs("header",{className:s.detailHeader,children:[t.jsxs("div",{className:s.detailHeading,children:[t.jsx(U,{label:e("playtest.report.title","Selected Report"),tooltip:e("playtest.report.title.tooltip","Detailed output for the currently selected automated playtest run.")}),P&&t.jsx("span",{className:s.detailRecordName,children:P.testName})]}),t.jsx("button",{type:"button",className:s.detailCloseButton,onClick:$,"aria-label":e("common.close","Close"),children:t.jsx(Q,{size:18,"aria-hidden":"true"})})]}),t.jsx("div",{className:s.detailBody,children:R?t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")}):k?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:k}),t.jsx("button",{type:"button",className:s.detailRetryButton,onClick:()=>void o.retryReport(),children:e("common.retry","Retry")})]}):b?t.jsx(Os,{report:b}):t.jsx("div",{className:s.detailState,role:"status",children:e("playtest.detail.loading","Loading report...")})})]})}),!l&&t.jsx(te,{open:H,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:S,onCancel:()=>!S&&g(!1),onConfirm:G})]})}export{Qs as Component};
@@ -0,0 +1 @@
1
+ import{u as X,a as le,r,j as e,b as U,g as me,c as ye,T as je,A as xe,S as fe}from"./index-Ygt1Wh6v.js";import{C as be,P as ve}from"./PageHeader-Xrn6BpcL.js";import{I as R}from"./InfoLabel-D6WxKFnG.js";import{T as m}from"./TooltipText-B1An7dUI.js";import{s as a,u as Se}from"./useSettings-BrnGUYZY.js";import{C as ce}from"./ConfirmModal-BSbhJt6x.js";import{D as de,f as ue,r as Ce,s as Ne,a as pe,d as se,S as ae,b as _e}from"./sample-requests-r6iFLFba.js";import"./ConfirmModal.module-DJksQHBd.js";const ke="_card_1ende_4",Pe="_cardEmbedded_1ende_14",Le="_cardTitle_1ende_21",Re="_storageConsoleGrid_1ende_30",we="_storageUsageColumn_1ende_37",He="_storagePolicyColumn_1ende_38",Be="_usageRow_1ende_43",Me="_usageTotal_1ende_49",Ae="_usageBreakdown_1ende_56",$e="_usageCounts_1ende_62",De="_storageFooter_1ende_69",Ee="_lastRunRow_1ende_78",Te="_lastRunLabel_1ende_88",Ie="_errorIcon_1ende_94",Ue="_tooltip_1ende_102",ze="_cleanupRow_1ende_125",Fe="_cleanupLabel_1ende_132",Oe="_cleanupBtn_1ende_139",Ge="_cleanupBtnDanger_1ende_168",qe="_retentionSection_1ende_181",We="_retentionTitle_1ende_187",Ye="_retentionFieldset_1ende_194",Ke="_proOverlay_1ende_209",Ve="_modeSegments_1ende_221",Je="_radioLabel_1ende_242",Qe="_radioLabelActive_1ende_263",Ze="_presetGroup_1ende_277",Xe="_presetBtn_1ende_285",et="_presetBtnActive_1ende_308",tt="_freeInput_1ende_315",st="_inputError_1ende_332",at="_inputUnit_1ende_336",nt="_cascadeRow_1ende_343",it="_retentionActions_1ende_359",ot="_saveBtn_1ende_365",rt="_runNowBtn_1ende_393",lt="_errorMsg_1ende_437",ct="_freeInputHitArea_1ende_499",o={card:ke,cardEmbedded:Pe,cardTitle:Le,storageConsoleGrid:Re,storageUsageColumn:we,storagePolicyColumn:He,usageRow:Be,usageTotal:Me,usageBreakdown:Ae,usageCounts:$e,storageFooter:De,lastRunRow:Ee,lastRunLabel:Te,errorIcon:Ie,tooltip:Ue,cleanupRow:ze,cleanupLabel:Fe,cleanupBtn:Oe,cleanupBtnDanger:Ge,retentionSection:qe,retentionTitle:We,retentionFieldset:Ye,proOverlay:Ke,modeSegments:Ve,radioLabel:Je,radioLabelActive:Qe,presetGroup:Ze,presetBtn:Xe,presetBtnActive:et,freeInput:tt,inputError:st,inputUnit:at,cascadeRow:nt,retentionActions:it,saveBtn:ot,runNowBtn:rt,errorMsg:lt,freeInputHitArea:ct};function dt(t,s){return!!(t.mode==="off"&&s.mode!=="off"||t.mode==="age"&&s.mode==="age"&&(s.ageDays??0)<(t.ageDays??0)||t.mode==="size"&&s.mode==="size"&&(s.sizeMb??0)<(t.sizeMb??0)||!t.cascadeSnapshots&&s.cascadeSnapshots)}function ne(t){return t.mode==="age"?Number.isInteger(t.ageDays)&&t.ageDays>=1&&t.ageDays<=365:t.mode==="size"?Number.isInteger(t.sizeMb)&&t.sizeMb>=50&&t.sizeMb<=1e4:!0}function ut(t,s){return t.mode===s.mode&&t.ageDays===s.ageDays&&t.sizeMb===s.sizeMb&&t.cascadeSnapshots===s.cascadeSnapshots}function Y(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function pt({placeId:t,tier:s,currentPolicy:l,onSaved:d}){const{t:i}=X(),{trackEvent:b}=le(),[n,g]=r.useState(l),[p,_]=r.useState(()=>[7,14,30,90].includes(l.ageDays??-1)?"":String(l.ageDays??30)),[v,k]=r.useState(()=>[100,500,1e3].includes(l.sizeMb??-1)?"":String(l.sizeMb??500)),[P,D]=r.useState(null),[x,f]=r.useState(!1),[E,w]=r.useState(!1),[y,H]=r.useState(!1),[L,A]=r.useState(null);r.useEffect(()=>{g(l);const h=[7,14,30,90],M=[100,500,1e3];_(h.includes(l.ageDays??-1)?"":String(l.ageDays??30)),k(M.includes(l.sizeMb??-1)?"":String(l.sizeMb??500))},[l]);const $=s==="basic",N=ne(n),j=ut(l,n),T=N&&!j&&!E,S=h=>{g(M=>{const O={...M,mode:h};return h==="age"&&(O.ageDays=parseInt(p,10)||30),h==="size"&&(O.sizeMb=parseInt(v,10)||500),O})},B=h=>{_(""),g(M=>({...M,ageDays:h}))},z=h=>{k(""),g(M=>({...M,sizeMb:h}))},F=h=>{_(h);const M=parseInt(h,10);Number.isNaN(M)||g(O=>({...O,ageDays:M}))},c=h=>{k(h);const M=parseInt(h,10);Number.isNaN(M)||g(O=>({...O,sizeMb:M}))},I=async()=>{if(A(null),b("dashboard_click_event",{click_target:"ui_studio_cleanup_save",page:"settings"}),dt(l,n)){try{const h=await ue(t,{mode:n.mode,ageDays:n.ageDays,sizeMb:n.sizeMb,cascadeSnapshots:n.cascadeSnapshots});D(h.dryRun),f(!0)}catch(h){A(h.message)}return}await W()},W=async()=>{w(!0);try{await Ne(t,n),f(!1),d()}catch(h){throw A(h.message),h}finally{w(!1)}},u=async()=>{A(null),b("dashboard_click_event",{click_target:"ui_studio_cleanup_run_now",page:"settings"}),H(!0);try{await Ce(t),d()}catch(h){A(h.message)}finally{H(!1)}},C=P?`${i("uiStudio.cleanup.policy.confirm.messageStrict","이 정책으로 즉시")} ${P.wouldRemoveRequests}${i("uiStudio.cleanup.policy.confirm.requests","건")} / ${P.wouldRemoveSnapshots}${i("uiStudio.cleanup.policy.confirm.snapshots","개 화면 캡처")} / ${Y(P.wouldFreeBytes)} ${i("uiStudio.cleanup.policy.confirm.freed","가 삭제됩니다 — 적용?")}`:"",K=n.mode==="age"&&!ne(n),q=n.mode==="size"&&!ne(n);return e.jsxs("div",{className:o.retentionSection,children:[e.jsx("h3",{className:o.retentionTitle,children:e.jsx(R,{label:i("uiStudio.cleanup.policy.title","자동 삭제 정책"),tooltip:i("uiStudio.cleanup.policy.title.tooltip","Rules that automatically remove old or large captures.")})}),e.jsxs("div",{style:{position:"relative"},children:[$&&e.jsx("div",{className:o.proOverlay,title:i("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능"),children:e.jsx("div",{className:o.tooltip,children:i("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능")})}),e.jsxs("fieldset",{className:o.retentionFieldset,disabled:$,"aria-label":i("uiStudio.cleanup.policy.title","자동 삭제 정책"),style:$?{opacity:.45,pointerEvents:"none"}:void 0,children:[e.jsxs("div",{className:o.modeSegments,"data-testid":"cleanup-mode-segments",children:[e.jsx(m,{text:i("uiStudio.cleanup.policy.modeOff.tooltip","Turn off auto-cleanup. Data stays until you remove it manually."),children:e.jsxs("label",{className:`${o.radioLabel} ${n.mode==="off"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"off",checked:n.mode==="off",onChange:()=>S("off")}),i("uiStudio.cleanup.policy.modeOff","사용 안 함 (off)")]})}),e.jsx(m,{text:i("uiStudio.cleanup.policy.modeAge.tooltip","Automatically delete data older than the configured number of days."),children:e.jsxs("label",{className:`${o.radioLabel} ${n.mode==="age"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"age",checked:n.mode==="age",onChange:()=>S("age")}),i("uiStudio.cleanup.policy.modeAge","기간 기반 (age)")]})}),e.jsx(m,{text:i("uiStudio.cleanup.policy.modeSize.tooltip","When total usage exceeds the limit, the oldest data is removed first."),children:e.jsxs("label",{className:`${o.radioLabel} ${n.mode==="size"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"size",checked:n.mode==="size",onChange:()=>S("size")}),i("uiStudio.cleanup.policy.modeSize","용량 기반 (size)")]})})]}),n.mode==="age"&&e.jsxs("div",{className:o.presetGroup,children:[[7,14,30,90].map(h=>e.jsx(m,{text:i("uiStudio.cleanup.policy.agePreset.tooltip","Delete data older than this many days."),children:e.jsxs("button",{type:"button",className:`${o.presetBtn} ${n.ageDays===h&&p===""?o.presetBtnActive:""}`,onClick:()=>B(h),children:[h,i("uiStudio.cleanup.policy.daysUnit","일")]})},h)),e.jsx(m,{text:i("uiStudio.cleanup.policy.ageInput.tooltip","Enter any value between 1 and 365 days."),children:e.jsx("label",{className:o.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${o.freeInput} ${K?o.inputError:""}`,value:p,min:1,max:365,onChange:h=>F(h.target.value)})})}),e.jsxs("span",{className:o.inputUnit,children:["1–365",i("uiStudio.cleanup.policy.daysUnit","일")]})]}),n.mode==="size"&&e.jsxs("div",{className:o.presetGroup,children:[[100,500,1e3].map(h=>e.jsx(m,{text:i("uiStudio.cleanup.policy.sizePreset.tooltip","Keep total usage under this size."),children:e.jsxs("button",{type:"button",className:`${o.presetBtn} ${n.sizeMb===h&&v===""?o.presetBtnActive:""}`,onClick:()=>z(h),children:[h,i("uiStudio.cleanup.policy.mbUnit","MB")]})},h)),e.jsx(m,{text:i("uiStudio.cleanup.policy.sizeInput.tooltip","Enter any value between 50 MB and 10000 MB (10 GB)."),children:e.jsx("label",{className:o.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${o.freeInput} ${q?o.inputError:""}`,value:v,min:50,max:1e4,onChange:h=>c(h.target.value)})})}),e.jsxs("span",{className:o.inputUnit,children:["50–10000",i("uiStudio.cleanup.policy.mbUnit","MB")]})]}),e.jsx(m,{text:i("uiStudio.cleanup.policy.cascade.tooltip","Also delete the capture images linked to those records. If off, the images stay."),children:e.jsxs("label",{className:o.cascadeRow,children:[e.jsx(be,{checked:n.cascadeSnapshots,onChange:h=>g(M=>({...M,cascadeSnapshots:h.target.checked}))}),i("uiStudio.cleanup.policy.cascade","연결된 화면 캡처도 함께 삭제")]})}),e.jsxs("div",{className:o.retentionActions,children:[e.jsx(m,{text:i("uiStudio.cleanup.policy.save.tooltip","Save the current cleanup rule. It runs in the background from then on."),children:e.jsx("button",{type:"button",className:o.saveBtn,onClick:()=>void I(),disabled:!T,children:i("uiStudio.cleanup.policy.save","정책 저장")})}),e.jsx(m,{text:i("uiStudio.cleanup.policy.runNow.tooltip","저장된 정리 정책을 다음 자동 실행까지 기다리지 않고 지금 한 번 실행합니다."),children:e.jsx("button",{type:"button",className:o.runNowBtn,onClick:()=>void u(),disabled:y,children:i("uiStudio.cleanup.policy.runNow","저장된 정책으로 정리")})})]}),L&&e.jsx("div",{className:o.errorMsg,children:L})]})]}),x&&P&&e.jsx(de,{title:i("uiStudio.cleanup.policy.confirm.title","정책 적용 확인"),message:C,danger:!0,confirmLabel:i("uiStudio.cleanup.policy.save","정책 저장"),busy:E,onConfirm:W,onClose:()=>f(!1)})]})}function gt({placeId:t,tier:s,onChanged:l,sampleUsage:d,sampleRetention:i,embedded:b=!1}){const{t:n}=X(),g=s==="basic"&&d!=null&&i!=null,[p,_]=r.useState(g?d:null),[v,k]=r.useState(g?i:null),[P,D]=r.useState(null),[x,f]=r.useState(null),[E,w]=r.useState(null),y=r.useCallback(async()=>{if(!g&&t!=null){D(null);try{const[S,B]=await Promise.all([pe(t),ue(t)]);_(S),k(B.policy)}catch(S){D(S.message)}}},[t,g]);r.useEffect(()=>{y()},[y]);const H=r.useCallback(()=>{y(),l==null||l()},[y,l]),L=r.useCallback(async()=>{if(x&&t!=null){w(null);try{x.kind==="keep7"?await se(t,{olderThanDays:7,alsoSnapshots:!0}):x.kind==="keep30"?await se(t,{olderThanDays:30,alsoSnapshots:!0}):await se(t,{all:!0,alsoSnapshots:!0}),f(null),y(),l==null||l()}catch(S){throw w(S.message),S}}},[x,t,y,l]);function A(S){const B=n("uiStudio.cleanup.studioPreservedNote","This deletes saved change records and screenshots on disk only; Roblox Studio instances are not affected.");return S.kind==="keep7"?`${n("uiStudio.cleanup.cleanupConfirmMessage.keep7","7일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:S.kind==="keep30"?`${n("uiStudio.cleanup.cleanupConfirmMessage.keep30","30일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:`${((p==null?void 0:p.requestCount)??0)+((p==null?void 0:p.snapshotCount)??0)}${n("uiStudio.cleanup.cleanupConfirmMessage.all","개의 저장된 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`}if(t==null&&!g)return null;if(P)return e.jsx("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:e.jsx("p",{className:o.errorMsg,children:P})});if(!p||!v)return e.jsx("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:0},children:n("uiStudio.storage.loading","로딩 중...")})});const $=v.lastRunAt,N=v.lastRunStats,j=$?new Date($).toLocaleString():null,T=t??0;return e.jsxs("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:[!b&&e.jsx("h3",{className:o.cardTitle,children:e.jsx(R,{label:n("uiStudio.storage.title","UI Studio 저장 데이터"),tooltip:n("uiStudio.storage.title.tooltip","Disk usage of UI Studio change records and screenshots.")})}),e.jsxs("div",{className:o.storageConsoleGrid,"data-testid":"ui-studio-storage-console-grid",children:[e.jsx("section",{className:o.storageUsageColumn,children:e.jsxs("div",{className:o.usageRow,children:[e.jsx(m,{text:n("uiStudio.storage.usageLabel.tooltip","Disk space currently used by UI Studio for this project."),children:e.jsxs("div",{className:o.usageTotal,children:[n("uiStudio.storage.usageLabel","사용 중")," ",Y(p.totalBytes)]})}),e.jsxs("div",{className:o.usageBreakdown,children:[e.jsx(m,{text:n("uiStudio.storage.historyBytes.tooltip","Space taken by change record data (JSON)."),children:e.jsxs("span",{children:[n("uiStudio.storage.historyBytes","변경 이력")," ",Y(p.historyBytes)]})})," · ",e.jsx(m,{text:n("uiStudio.storage.snapshotBytes.tooltip","Space taken by captured PNG image files."),children:e.jsxs("span",{children:[n("uiStudio.storage.snapshotBytes","화면 캡처")," ",Y(p.snapshotBytes)]})})]}),e.jsxs("div",{className:o.usageCounts,children:[e.jsx(m,{text:n("uiStudio.storage.requestCount.tooltip","Number of actions where AI changed the UI."),children:e.jsxs("span",{children:[n("uiStudio.storage.requestCount","변경 기록")," ",p.requestCount.toLocaleString(),n("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:n("uiStudio.storage.mutationCount.tooltip","Number of detail changes inside actions (one property edit = 1)."),children:e.jsxs("span",{children:[n("uiStudio.storage.mutationCount","변경 상세")," ",p.mutationCount.toLocaleString(),n("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:n("uiStudio.storage.snapshotCount.tooltip","Number of saved capture image files."),children:e.jsxs("span",{children:[n("uiStudio.storage.snapshotCount","화면 캡처")," ",p.snapshotCount.toLocaleString(),n("uiStudio.storage.countSuffix","개")]})})]})]})}),e.jsx("section",{className:o.storagePolicyColumn,children:e.jsx(pt,{placeId:T,tier:s,currentPolicy:v,onSaved:H})})]}),e.jsxs("div",{className:o.storageFooter,"data-testid":"ui-studio-storage-footer",children:[e.jsxs("div",{className:o.lastRunRow,children:[e.jsx("span",{className:o.lastRunLabel,children:e.jsx(R,{label:n("uiStudio.storage.lastRun","마지막 자동 정리"),tooltip:n("uiStudio.storage.lastRun.tooltip","When the auto-cleanup policy last ran, and what it removed.")})}),j?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:j}),N&&e.jsxs("span",{children:["· ",n("uiStudio.storage.requestCount","변경 기록")," ",N.removedRequests,n("uiStudio.storage.countSuffix","개")," / ",n("uiStudio.storage.snapshotCount","화면 캡처")," ",N.removedSnapshots,n("uiStudio.storage.countSuffix","개")," / ",Y(N.freedBytes)," ",n("uiStudio.storage.lastRunFreed","회수")]}),N&&N.errors>0&&e.jsxs("span",{className:o.errorIcon,title:`${n("uiStudio.storage.lastRunErrors","오류")} ${N.errors}건`,children:["⚠",e.jsxs("span",{className:o.tooltip,children:[n("uiStudio.storage.lastRunErrors","오류")," ",N.errors,n("uiStudio.storage.countSuffix","건")]})]})]}):e.jsx("span",{children:n("uiStudio.storage.lastRunNever","—")})]}),e.jsxs("div",{className:o.cleanupRow,children:[e.jsx("span",{className:o.cleanupLabel,children:e.jsx(R,{label:n("uiStudio.cleanup.label","수동 정리"),tooltip:n("uiStudio.cleanup.label.tooltip","Manually clean up change records and captures whenever you want.")})}),e.jsx(m,{text:n("uiStudio.cleanup.keep7.tooltip","Delete change records and captures older than 7 days."),children:e.jsx("button",{type:"button",className:o.cleanupBtn,onClick:()=>f({kind:"keep7"}),disabled:s==="basic",children:n("uiStudio.cleanup.keepLastNDays","최근 7일만 남기기").replace("{n}","7")})}),e.jsx(m,{text:n("uiStudio.cleanup.keep30.tooltip","Delete change records and captures older than 30 days."),children:e.jsx("button",{type:"button",className:o.cleanupBtn,onClick:()=>f({kind:"keep30"}),disabled:s==="basic",children:n("uiStudio.cleanup.keepLastNDays","최근 30일만 남기기").replace("{n}","30")})}),!b&&e.jsx(m,{text:n("uiStudio.cleanup.deleteAll.tooltip","Delete every change record and capture for this project. The actual UI in Roblox Studio is not affected."),children:e.jsx("button",{type:"button",className:`${o.cleanupBtn} ${o.cleanupBtnDanger}`,onClick:()=>f({kind:"all"}),disabled:s==="basic",children:n("uiStudio.cleanup.deleteAll","전체 삭제…")})})]})]}),E&&e.jsx("div",{className:o.errorMsg,children:E}),x&&e.jsx(de,{title:n("uiStudio.cleanup.cleanupConfirmTitle","정리 확인"),message:A(x),danger:!0,confirmLabel:n("common.delete","삭제"),onConfirm:L,onClose:()=>{f(null),w(null)}})]})}function ie(t,s){const l={placeId:String(t)};return s&&(l["preview.mode"]=s.mode,s.mode==="size"&&(l["preview.sizeMb"]=String(s.sizeMb))),U.get("/api/dashboard/changelog/cleanup",l)}function oe(t){return U.put("/api/dashboard/changelog/cleanup",t)}function ht(t){return U.post(`/api/dashboard/changelog/cleanup/run?placeId=${encodeURIComponent(t)}`)}const mt=[100,500,1e3];function re(t,s){return t.mode!==s.mode?!1:t.mode==="off"||s.mode==="size"&&t.sizeMb===s.sizeMb}function yt(t,s){return t.mode==="off"?!1:s.mode==="off"||t.sizeMb<s.sizeMb}function J(t){return t<1e3?`${t} B`:t<1e6?`${(t/1e3).toFixed(1)} KB`:t<1e9?`${(t/1e6).toFixed(1)} MB`:`${(t/1e9).toFixed(2)} GB`}function jt({placeId:t,onChanged:s}){const{locale:l,t:d}=X(),[i,b]=r.useState(null),[n,g]=r.useState({mode:"size",sizeMb:500}),[p,_]=r.useState(t!==null),[v,k]=r.useState(!1),[P,D]=r.useState(!1),[x,f]=r.useState(!1),[E,w]=r.useState(!1),[y,H]=r.useState(null),L=r.useCallback(async()=>{if(t===null){b(null),_(!1);return}D(!1);try{const u=await ie(t);b(u),g(u.policy)}catch{D(!0)}finally{_(!1)}},[t]);r.useEffect(()=>{_(t!==null),L()},[L,t]);const A=r.useCallback(async u=>{k(!0),f(!1),w(!1);try{await oe(u),H(null),await L(),w(!0),s==null||s()}catch{f(!0)}finally{k(!1)}},[L,s]),$=r.useCallback(async()=>{if(!(!i||t===null||re(n,i.policy))){k(!0),f(!1),w(!1);try{if(yt(n,i.policy)){const u=await ie(t,n);if(u.preview.affectedPlaceCount>0){H({policy:n,preview:u});return}}await oe(n),await L(),w(!0),s==null||s()}catch{f(!0)}finally{k(!1)}}},[i,n,L,s,t]),N=r.useCallback(async()=>{if(t!==null){k(!0),f(!1),w(!1);try{await ht(t),await L(),s==null||s()}catch{f(!0)}finally{k(!1)}}},[L,s,t]),j=i==null?void 0:i.selectedPlace.currentUsage,T=(i==null?void 0:i.policy.mode)==="size"?i.policy.sizeMb*1e6:null,S=T??Math.max((j==null?void 0:j.bytes)??0,1),B=Math.min(100,((j==null?void 0:j.sessionBytes)??0)/S*100),z=Math.min(Math.max(0,100-B),((j==null?void 0:j.contextBytes)??0)/S*100),F=i?!re(n,i.policy):!1,c=u=>u.mode==="off"?d("settings.projectChanges.cleanup.unlimited","Unlimited"):`${u.sizeMb} MB`,I=r.useMemo(()=>{if(!y)return"";const u=y.preview.preview,C=d("settings.projectChanges.cleanup.confirm.message","{places} Places · {sessions} sessions · {bytes} expected to be freed.").replace("{places}",u.affectedPlaceCount.toLocaleString()).replace("{sessions}",u.deleteSessionCount.toLocaleString()).replace("{bytes}",J(u.estimatedFreedBytes));return u.wouldRemainOverLimitPlaceCount===0?C:`${C} ${d("settings.projectChanges.cleanup.confirm.protected","{places} Place may remain over the limit because active data is protected.").replace("{places}",u.wouldRemainOverLimitPlaceCount.toLocaleString())}`},[y,d]);if(t===null)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:d("settings.projectChanges.cleanup.noPlace","Select a Place to manage saved project changes.")})});if(p)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:d("settings.projectChanges.cleanup.loading","Loading storage settings…")})});if(P||!i||!j)return e.jsxs("div",{className:a.projectChangesPanel,children:[e.jsx("p",{className:a.projectChangesError,role:"alert",children:d("settings.projectChanges.cleanup.loadFailed","Could not load storage settings.")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",onClick:()=>{_(!0),L()},children:d("common.retry","Retry")})]});const W=T===null?d("settings.projectChanges.cleanup.usageUnlimited","{used} used · Unlimited").replace("{used}",J(j.bytes)):d("settings.projectChanges.cleanup.usageLimited","{used} used of {limit}").replace("{used}",J(j.bytes)).replace("{limit}",c(i.policy));return e.jsxs("div",{className:a.projectChangesPanel,children:[e.jsxs("div",{className:a.projectChangesConsoleGrid,"data-testid":"project-storage-console-grid",children:[e.jsxs("section",{className:a.projectChangesUsageColumn,children:[e.jsx("h3",{className:a.projectChangesPanelTitle,children:e.jsx(R,{label:d("settings.projectChanges.cleanup.title","Storage management"),tooltip:d("settings.projectChanges.cleanup.title.tooltip","Set how much Project Change Summary history each Place can keep.")})}),e.jsxs("div",{className:a.projectChangesUsageBlock,children:[e.jsx("div",{className:a.projectChangesUsageSummary,children:W}),e.jsxs("div",{className:a.projectChangesQuotaRail,role:"meter","aria-label":d("settings.projectChanges.cleanup.usageAria","Place storage usage"),"aria-valuemin":0,"aria-valuenow":j.bytes,"aria-valuemax":T??j.bytes,children:[e.jsx("span",{className:a.projectChangesSessionRail,style:{width:`${B}%`}}),e.jsx("span",{className:a.projectChangesContextRail,style:{width:`${z}%`}})]}),e.jsxs("div",{className:a.projectChangesUsageLegend,children:[e.jsxs("span",{children:[d("settings.projectChanges.cleanup.sessions","Sessions")," ",e.jsx("strong",{children:J(j.sessionBytes)})]}),e.jsxs("span",{children:[d("settings.projectChanges.cleanup.contexts","Contexts")," ",e.jsx("strong",{children:J(j.contextBytes)})]})]})]})]}),e.jsxs("section",{className:a.projectChangesPolicyColumn,children:[e.jsx("p",{className:a.projectChangesScope,children:d("settings.projectChanges.cleanup.scope","One setting applies the selected limit separately to every Place.")}),e.jsxs("fieldset",{className:a.projectChangesPolicyFieldset,disabled:v,children:[e.jsx("legend",{className:a.projectChangesPolicyLegend,children:d("settings.projectChanges.cleanup.limit","Limit per Place")}),e.jsxs("div",{className:a.projectChangesPresetGroup,children:[mt.map(u=>{const C=n.mode==="size"&&n.sizeMb===u;return e.jsx("button",{className:`${a.projectChangesPresetButton} ${C?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":C,onClick:()=>g({mode:"size",sizeMb:u}),children:d("settings.projectChanges.cleanup.preset","{sizeMb}MB").replace("{sizeMb}",String(u))},u)}),e.jsx("button",{className:`${a.projectChangesPresetButton} ${n.mode==="off"?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":n.mode==="off",onClick:()=>g({mode:"off"}),children:d("settings.projectChanges.cleanup.unlimited","Unlimited")})]})]}),e.jsxs("div",{className:a.projectChangesActions,children:[e.jsx("button",{className:a.projectChangesSaveButton,type:"button",disabled:!F||v,onClick:()=>void $(),children:d("common.save","Save")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",disabled:v,onClick:()=>void N(),children:d("settings.projectChanges.cleanup.runNow","Run saved policy")}),E&&e.jsx("span",{className:a.projectChangesSaved,role:"status",children:d("settings.projectChanges.cleanup.saved","Saved")})]})]})]}),i.selectedPlace.dryRun.wouldRemainOverLimit&&e.jsx("p",{className:a.projectChangesWarning,children:d("settings.projectChanges.cleanup.protectedWarning","Active changes are protected, so this Place may stay over the limit.")}),e.jsxs("div",{className:a.projectChangesLastRun,"data-testid":"project-storage-footer",children:[e.jsx("span",{className:a.projectChangesLastRunLabel,children:d("settings.projectChanges.cleanup.lastRun","Last cleanup")}),i.selectedPlace.lastRun?e.jsxs("span",{children:[new Date(i.selectedPlace.lastRun.ranAt).toLocaleString(l)," · ",d("settings.projectChanges.cleanup.lastRunSummary","{sessions} sessions · {bytes} freed").replace("{sessions}",i.selectedPlace.lastRun.deletedSessionCount.toLocaleString()).replace("{bytes}",J(i.selectedPlace.lastRun.freedBytes))]}):e.jsx("span",{children:d("settings.projectChanges.cleanup.neverRun","Not run yet")})]}),x&&e.jsx("p",{className:a.projectChangesError,role:"alert",children:d("settings.projectChanges.cleanup.actionFailed","Could not update storage settings.")}),e.jsx(ce,{open:y!==null,title:d("settings.projectChanges.cleanup.confirm.title","Apply this limit and clean saved changes?"),message:I,cancelLabel:d("common.cancel","Cancel"),confirmLabel:d("settings.projectChanges.cleanup.confirm.apply","Apply and clean"),loading:v,onCancel:()=>!v&&H(null),onConfirm:()=>{y&&A(y.policy)}})]})}const xt={toolsActivity:null,toolStats:null,toolSessions:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null},ft={toolsActivity:null,toolStats:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null};function bt(t){var s;return t?t.pluginConnected?t.activePlaceId:t.lastActivePlaceId??((s=t.places[0])==null?void 0:s.placeId)??null:null}async function G(t){try{return await t}catch{return null}}function ee(t){return t?typeof t.total=="number"?t.total:Array.isArray(t.entries)?t.entries.length:null:null}function te(t,s,l,d){return s===null?t("settings.dataHistory.metric.unavailable","Unavailable"):`${s.toLocaleString()} ${t(l,d)}`}function Q(t,s,l){const d=l===null?t("settings.dataHistory.metric.sizeUnavailable","size unavailable"):Y(l);return`${s} · ${d}`}function Z(t,s){var d;const l=(d=t==null?void 0:t[s])==null?void 0:d.bytes;return typeof l=="number"&&Number.isFinite(l)?l:null}function vt(t,s){return s?[`${s.requestCount.toLocaleString()} ${t("uiStudio.storage.requestCount","change records")}`,`${s.snapshotCount.toLocaleString()} ${t("uiStudio.storage.snapshotCount","screenshots")}`,Y(s.totalBytes)].join(" · "):t("settings.dataHistory.metric.unavailable","Unavailable")}function St({tier:t}){const{t:s}=X(),[l,d]=r.useState(xt),[i,b]=r.useState(ft),[n,g]=r.useState(t==="basic"?ae:null),[p,_]=r.useState(null),[v,k]=r.useState(!0),[P,D]=r.useState(!0),[x,f]=r.useState(null),[E,w]=r.useState(()=>new Set),[y,H]=r.useState(null),[L,A]=r.useState(!1),[$,N]=r.useState(null),j=r.useCallback(async()=>{k(!0);const u=await G(me()),C=bt(u);_(C);const[K,q,h,M,O,ge,V]=await Promise.all([G(U.get("/api/dashboard/history",{limit:"1",offset:"0"})),G(U.get("/api/dashboard/tool-stats")),G(U.get("/sync/history",{limit:"1",offset:"0"})),G(U.get("/api/dashboard/playtest/history")),G(U.get("/api/dashboard/changelog",{limit:"1",offset:"0"})),G(U.get("/api/dashboard/connection-log")),G(U.get("/api/dashboard/storage-summary"))]),he=t==="basic"?ae:C===null?null:await G(pe(C));d({toolsActivity:ee(K),toolStats:(q==null?void 0:q.totalCalls)??null,toolSessions:(q==null?void 0:q.totalSessions)??null,syncLog:ee(h),playtestReports:ee(M),projectChanges:ee(O),connectionLog:ee(ge)}),b({toolsActivity:Z(V,"toolsActivity"),toolStats:Z(V,"toolStats"),syncLog:Z(V,"syncLog"),playtestReports:Z(V,"playtestReports"),projectChanges:Z(V,"projectChanges"),connectionLog:Z(V,"connectionLog")}),g(he),k(!1)},[t]);r.useEffect(()=>{j()},[j]);const T=r.useCallback(u=>{w(C=>{if(C.has(u))return C;const K=new Set(C);return K.add(u),K}),f(C=>C===u?null:u)},[]),S=r.useMemo(()=>[{key:"toolsActivity",title:s("settings.dataHistory.toolsActivity.title","Tool activity"),description:s("settings.dataHistory.toolsActivity.description","Saved tool runs shown on the Tools page."),metric:Q(s,te(s,l.toolsActivity,"settings.dataHistory.metric.records","records"),i.toolsActivity),metricTooltip:s("settings.dataHistory.toolsActivity.metric.tooltip","Number of saved tool runs and the disk space they use."),route:"/tools",clearEndpoint:"/api/dashboard/tools/history/clear"},{key:"toolStats",title:s("settings.dataHistory.toolStats.title","Tool usage statistics"),description:s("settings.dataHistory.toolStats.description","Aggregated tool counts and status totals."),metric:Q(s,l.toolStats===null?s("settings.dataHistory.metric.unavailable","Unavailable"):`${l.toolStats.toLocaleString()} ${s("settings.dataHistory.metric.runs","runs")} · ${(l.toolSessions??0).toLocaleString()} ${s("settings.dataHistory.metric.sessions","sessions")}`,i.toolStats),metricTooltip:s("settings.dataHistory.toolStats.metric.tooltip","Aggregated total runs and session counts."),route:"/tools",clearEndpoint:"/api/dashboard/tools/statistics/clear"},{key:"syncLog",title:s("settings.dataHistory.syncLog.title","Sync log"),description:s("settings.dataHistory.syncLog.description","Saved file sync events for the active place."),metric:Q(s,te(s,l.syncLog,"settings.dataHistory.metric.records","records"),i.syncLog),metricTooltip:s("settings.dataHistory.syncLog.metric.tooltip","Number of saved sync events and the disk space they use."),route:"/sync",clearEndpoint:"/api/dashboard/sync/history/clear"},{key:"playtestReports",title:s("settings.dataHistory.playtest.title","Playtest reports"),description:s("settings.dataHistory.playtest.description","Saved automated playtest reports and logs."),metric:Q(s,te(s,l.playtestReports,"settings.dataHistory.metric.reports","reports"),i.playtestReports),metricTooltip:s("settings.dataHistory.playtestReports.metric.tooltip","Number of saved playtest reports and the disk space they use."),route:"/playtest",clearEndpoint:"/api/dashboard/playtest/history/clear"},{key:"projectChanges",title:s("settings.dataHistory.projectChanges.title","Project change summary"),description:s("settings.dataHistory.projectChanges.description","Saved summaries of project changes."),metric:Q(s,te(s,l.projectChanges,"settings.dataHistory.metric.records","records"),i.projectChanges),metricTooltip:s("settings.dataHistory.projectChanges.metric.tooltip","Number of saved project change summaries and the disk space they use."),route:"/changelog",clearEndpoint:"/api/dashboard/changelog/clear"},{key:"connectionLog",title:s("settings.dataHistory.connectionLog.title","Connection log"),description:s("settings.dataHistory.connectionLog.description","Saved MCP and Studio connection events."),metric:Q(s,te(s,l.connectionLog,"settings.dataHistory.metric.records","records"),i.connectionLog),metricTooltip:s("settings.dataHistory.connectionLog.metric.tooltip","Number of saved connection events and the disk space they use."),route:"/connection",clearEndpoint:"/api/dashboard/connection-log/clear"}],[l,i,s]),B=async()=>{if(y){A(!0),N(null);try{if(y.kind==="uiStudio"){if(t!=="pro"||p===null)throw new Error("UI Studio place is unavailable");await se(p,{all:!0,alsoSnapshots:!0}),N(s("settings.dataHistory.uiStudio.clear.success","UI Studio saved data cleared."))}else{const u=y.row.key==="projectChanges";if(u&&p===null)throw new Error("Project changes place is unavailable");let C=y.row.clearEndpoint;u&&p!==null&&(C=`${C}?placeId=${encodeURIComponent(p)}`),await U.post(C),N(u?s("settings.dataHistory.projectChanges.clear.success","Project change summaries cleared."):s("settings.dataHistory.clear.success","Saved data cleared."))}H(null),await j()}catch{N(y.kind==="uiStudio"?s("settings.dataHistory.uiStudio.clear.failed","Failed to clear UI Studio saved data."):s("settings.dataHistory.clear.failed","Failed to clear saved data."))}finally{A(!1)}}},z=t==="pro"?p:0,F=t==="pro"&&p!==null,c=(y==null?void 0:y.kind)==="uiStudio",I=(y==null?void 0:y.kind)==="row"&&y.row.key==="projectChanges",W=s("settings.dataHistory.title","Data & History");return e.jsxs(e.Fragment,{children:[e.jsxs("section",{id:"data-history",className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:s("settings.dataHistory.title","Data & History"),tooltip:s("settings.dataHistory.title.tooltip","Manage saved dashboard data in one place.")}),e.jsxs("div",{className:a.cardHeaderActions,children:[e.jsx(m,{text:s("settings.dataHistory.scope.tooltip","Clear actions apply to the current project and active place where applicable."),children:e.jsx("span",{className:a.headerBadge,children:v?s("common.loading","Loading"):s("settings.dataHistory.scope","Current project")})}),e.jsx(m,{text:s("settings.dataHistory.toggle.tooltip","Collapse or expand this section."),children:e.jsx("button",{className:a.collapseButton,type:"button","aria-expanded":P,"aria-controls":"settings-data-history-body","aria-label":P?s("settings.dataHistory.collapse","Collapse {title}").replace("{title}",W):s("settings.dataHistory.expand","Expand {title}").replace("{title}",W),onClick:()=>D(u=>!u),children:P?"▾":"▸"})})]})]}),P&&e.jsxs("div",{id:"settings-data-history-body",children:[e.jsx("p",{className:a.dataHistoryIntro,children:s("settings.dataHistory.intro","Review saved dashboard data, open the related page, or clear stored records from one place.")}),e.jsxs("div",{className:a.dataHistoryList,children:[S.map(u=>e.jsxs(r.Fragment,{children:[e.jsxs("div",{className:`${a.dataHistoryRow} ${u.key==="projectChanges"&&x==="projectChanges"?a.dataHistoryRowExpanded:""}`,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:u.title}),e.jsx("div",{className:a.dataHistoryDescription,children:u.description})]}),e.jsx(m,{text:u.metricTooltip,children:e.jsx("div",{className:a.dataHistoryMetric,children:u.metric})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(m,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:`#${u.route}`,children:s("settings.dataHistory.open","Open")})}),u.key==="projectChanges"&&e.jsx(m,{text:s("settings.dataHistory.manageStorage.tooltip","Show or hide storage policy and cleanup controls."),children:e.jsxs("button",{className:a.manageStorageButton,type:"button","aria-expanded":x==="projectChanges","aria-controls":"settings-project-changes-storage","aria-label":s("settings.dataHistory.manageStorage.projectChanges.aria","Manage Project change summary storage"),onClick:()=>T("projectChanges"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="projectChanges"?"▴":"▾"})]})}),e.jsx(m,{text:s("settings.dataHistory.clear.tooltip","Delete only the records saved for this item. Roblox Studio data is not changed."),children:e.jsx("button",{className:a.dangerButton,type:"button",disabled:u.key==="projectChanges"&&p===null,onClick:()=>H({kind:"row",row:u}),children:u.key==="projectChanges"?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear")})})]})]}),u.key==="projectChanges"&&E.has("projectChanges")&&e.jsx("div",{id:"settings-project-changes-storage",className:`${a.dataHistoryDetail} ${a.projectChangesDataHistoryDetail}`,hidden:x!=="projectChanges",children:e.jsx(jt,{placeId:p,onChanged:j})})]},u.key)),e.jsxs("div",{className:`${a.dataHistoryRow} ${x==="uiStudio"?a.dataHistoryRowExpanded:""}`,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:s("settings.dataHistory.uiStudio.title","UI Studio history and screenshots")}),e.jsx("div",{className:a.dataHistoryDescription,children:s("settings.dataHistory.uiStudio.description","Saved UI Studio change records, screenshots, and cleanup policy.")})]}),e.jsx(m,{text:s("settings.dataHistory.uiStudio.metric.tooltip","UI Studio change record and capture counts, plus total disk usage."),children:e.jsx("div",{className:a.dataHistoryMetric,children:vt(s,n)})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(m,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:"#/ui-studio?tab=history",children:s("settings.dataHistory.open","Open")})}),e.jsx(m,{text:s("settings.dataHistory.manageStorage.tooltip","Show or hide storage policy and cleanup controls."),children:e.jsxs("button",{className:a.manageStorageButton,type:"button","aria-expanded":x==="uiStudio","aria-controls":"settings-ui-studio-storage","aria-label":s("settings.dataHistory.manageStorage.uiStudio.aria","Manage UI Studio history and screenshots storage"),onClick:()=>T("uiStudio"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="uiStudio"?"▴":"▾"})]})}),e.jsx(m,{text:s("settings.dataHistory.clear.tooltip","Delete only the records saved for this item. Roblox Studio data is not changed."),children:e.jsx("button",{className:a.dangerButton,type:"button",disabled:!F,onClick:()=>H({kind:"uiStudio"}),children:s("settings.dataHistory.clearAll","Clear all")})})]})]}),E.has("uiStudio")&&e.jsx("div",{id:"settings-ui-studio-storage",className:`${a.dataHistoryDetail} ${a.uiStudioDataHistoryDetail}`,hidden:x!=="uiStudio",children:e.jsx(gt,{placeId:z,tier:t,onChanged:j,embedded:!0,...t==="basic"?{sampleUsage:ae,sampleRetention:_e}:{}})})]}),$&&e.jsx("p",{className:a.inlineStatus,children:$})]})]}),e.jsx(ce,{open:y!==null,title:c?s("settings.dataHistory.uiStudio.clear.title","Clear UI Studio saved data?"):I?s("settings.dataHistory.projectChanges.clear.title","Clear project change summaries?"):s("settings.dataHistory.clear.title","Clear saved data?"),message:c?s("settings.dataHistory.uiStudio.clear.message","This deletes saved UI Studio change records and screenshots only. Roblox Studio instances and project objects are not changed."):I?s("settings.dataHistory.projectChanges.clear.message","This deletes completed sessions and ended context history for the selected Place. Active work and Roblox Studio project data stay intact."):s("settings.dataHistory.clear.message","This deletes saved dashboard records only. Roblox Studio instances and project objects are not changed."),cancelLabel:s("common.cancel","Cancel"),confirmLabel:I||c?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear"),loading:L,onCancel:()=>!L&&H(null),onConfirm:()=>void B()})]})}const Ct=r.forwardRef(function({autoOpen:s,settingsFilePath:l,saving:d,targeted:i,updateDashboardPreferences:b},n){const{t:g}=X(),[p,_]=r.useState("idle"),v="settings-dashboard-auto-open-label",k=d||p==="saving",P=async x=>{_("saving");try{await b({autoOpen:x}),_("saved")}catch{_("error")}},D=p==="saving"?g("settings.dashboard.autoOpen.saving","Saving…"):p==="saved"?g("settings.dashboard.autoOpen.saved","Saved for the next server start."):p==="error"?g("settings.dashboard.autoOpen.error","Could not save. The previous setting was restored."):" ";return e.jsxs("div",{id:"settings-dashboard",ref:n,tabIndex:-1,"data-testid":"settings-dashboard-card",className:[a.card,a.dashboardCard,i?a.dashboardCardTarget:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:g("settings.dashboard.title","Dashboard"),tooltip:g("settings.dashboard.title.tooltip","Choose how WEPPY Dashboard behaves when the MCP Server starts.")}),e.jsx(m,{text:g("settings.dashboard.autoOpen.nextStart","Applies the next time the MCP Server starts."),children:e.jsx("span",{className:a.headerBadge,children:g("settings.dashboard.nextStartBadge","Next Start")})})]}),e.jsxs("div",{className:a.dashboardSettingRow,children:[e.jsxs("div",{className:a.dashboardSettingCopy,children:[e.jsx("span",{id:v,className:a.dashboardSettingLabel,children:g("settings.dashboard.autoOpen.label","Open Dashboard when WEPPY starts")}),e.jsx("span",{className:a.dashboardSettingDescription,children:g("settings.dashboard.autoOpen.description","Automatically opens this Dashboard after the MCP Server starts.")}),e.jsx("span",{className:a.dashboardSettingMeta,children:g("settings.dashboard.autoOpen.nextStart","Applies the next time the MCP Server starts.")})]}),e.jsxs("label",{className:`${a.toggleSwitch} ${a.dashboardToggleTarget}`,children:[e.jsx("input",{className:a.toggleInput,type:"checkbox",role:"switch","aria-labelledby":v,checked:s,disabled:k,onChange:x=>{P(x.target.checked)}}),e.jsx("span",{className:a.toggleTrack,"aria-hidden":"true",children:e.jsx("span",{className:a.toggleThumb})})]})]}),e.jsxs("dl",{className:a.dashboardDetails,children:[e.jsxs("div",{className:a.dashboardDetailRow,children:[e.jsx("dt",{children:g("settings.dashboard.settingsFile.label","Settings file")}),e.jsx("dd",{children:e.jsx("code",{className:a.dashboardSettingsFilePath,children:l})})]}),e.jsxs("div",{className:a.dashboardDetailRow,children:[e.jsx("dt",{children:g("settings.dashboard.agentExample.label","Ask your Agent")}),e.jsx("dd",{className:a.dashboardAgentPrompt,children:g("settings.dashboard.agentExample.prompt","“Turn off Dashboard auto-open.”")})]})]}),e.jsx("p",{className:`${a.dashboardSaveFeedback} ${p==="error"?a.dashboardSaveFeedbackError:""}`,"aria-live":"polite",children:D})]})}),Nt={en:"English",ko:"한국어",es:"Español","pt-br":"Português (BR)",ja:"日本語",id:"Bahasa Indonesia",de:"Deutsch","fr-fr":"Français"};function _t(t){return t==="active"?a.statusActive:t==="grace"?a.statusGrace:t==="invalid"||t==="revoked"?a.statusError:a.statusInactive}function kt(t){return t?t.refreshBlockedReason==="missing_session_token"?!0:t.status==="active"||t.status==="grace"||t.status==="invalid"||t.status==="revoked"||t.status==="unknown":!1}function Pt(t,s){return t.refreshBlockedReason==="missing_session_token"?{label:s("settings.license.status.activationRequired","Activation Required"),tooltip:s("settings.license.status.activationRequired.tooltip","Manual license activation is required before WEPPY Dashboard can refresh this status."),detail:s("settings.license.detail.missingSessionToken","Refresh is blocked because the current session token is missing."),detailTone:a.licenseNoticeWarning}:t.statusDetail==="active_cancel_pending"?{label:s("settings.license.active","Active"),tooltip:s("settings.license.status.activeCancelPending.tooltip","Cancellation is pending, but Pro access remains active until the current billing period ends."),detail:s("settings.license.detail.cancelPending","Cancellation is scheduled. Pro access remains active until the current billing period ends."),detailTone:a.licenseNoticeInfo}:t.statusDetail==="grace_provider_unavailable"?{label:s("settings.license.status.grace","Grace"),tooltip:s("settings.license.status.grace.tooltip","Provider verification is temporarily unavailable, but Pro access remains active during the grace period."),detail:s("settings.license.detail.graceProviderUnavailable","Provider unavailable. Pro access remains active during grace mode."),detailTone:a.licenseNoticeInfo}:t.statusDetail==="grace_expired"||t.statusDetail==="grace_payment_failed"?{label:s("settings.license.status.grace","Grace"),tooltip:s("settings.license.status.graceBilling.tooltip","Pro access is still available during a billing-related grace period."),detail:s("settings.license.detail.graceBilling","Pro access remains available during a billing grace period."),detailTone:a.licenseNoticeInfo}:{label:s(`settings.license.${t.status}`,t.status),tooltip:s(`settings.license.${t.status}.tooltip`,"Current license activation state."),detail:t.refreshRequired?s("settings.license.detail.refreshRecommended","License verification should be refreshed soon."):null,detailTone:a.licenseNoticeMuted}}function Dt(){const{t,selectedLocale:s,setLocale:l}=X(),{trackEvent:d}=le(),{search:i}=ye(),{settings:b,license:n,licenseControlsDisabled:g,licenseSubmitting:p,licenseMessage:_,activateLicense:v,refreshLicense:k,resetLicense:P,saving:D,updateDashboardPreferences:x,loading:f}=Se(),[E,w]=r.useState(""),y=n?Pt(n,t):null,H=kt(n),L=H&&(n==null?void 0:n.refreshBlockedReason)!=="missing_session_token",A=H,$=H?n==null?void 0:n.maskedKey:void 0,N=n!=null&&n.provider&&n.provider!=="auto"?n.provider:void 0,j=(n==null?void 0:n.tier)==="pro"?"pro":"basic",T=r.useRef(null),S=r.useRef(null),B=r.useRef(null),z=r.useMemo(()=>new URLSearchParams(i).get("section")==="license",[i]),F=r.useMemo(()=>new URLSearchParams(i).get("section")==="dashboard",[i]);return r.useEffect(()=>{var I;if(!z||f)return;const c=T.current;if((I=c==null?void 0:c.scrollIntoView)==null||I.call(c,{block:"start",behavior:"smooth"}),B.current&&!B.current.disabled){B.current.focus();return}c==null||c.focus()},[f,g,p,z]),r.useEffect(()=>{var I;if(!F||f)return;const c=S.current;(I=c==null?void 0:c.scrollIntoView)==null||I.call(c,{block:"start",behavior:"smooth"}),c==null||c.focus()},[f,F]),f?e.jsx("div",{className:a.page,children:e.jsx("div",{className:a.loading,children:t("common.loading")})}):e.jsxs("div",{className:a.page,children:[e.jsx(ve,{title:t("page.settings.title","Settings"),description:t("page.settings.description","Manage license, saved data, server environment, and language."),helpTopicId:"settings",helpState:{tier:j}}),e.jsxs("div",{id:"settings-license",ref:T,tabIndex:-1,"data-testid":"settings-license-card",className:[a.card,z?a.licenseCardTarget:"",(n==null?void 0:n.tier)==="pro"?a.licenseCardPro:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:t("settings.license.title","License"),tooltip:t("settings.license.title.tooltip","Current license status and subscription tier.")}),e.jsx(m,{text:g?t("settings.license.disconnected.tooltip","Reconnect to the MCP server to manage license actions from WEPPY Dashboard."):t("settings.license.live.tooltip","License actions are sent to the MCP server immediately."),children:e.jsx("span",{className:`${a.headerBadge} ${g?"":a.headerBadgeLive}`,children:g?t("settings.license.disconnected","Disconnected"):t("settings.general.liveApply","Live Apply")})})]}),e.jsxs(e.Fragment,{children:[n?e.jsxs(e.Fragment,{children:[(()=>{const c=y;return e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.licenseGrid,children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.status","Status"),tooltip:t("settings.license.status.tooltip","Current license activation state.")})}),e.jsxs("dd",{children:[e.jsx("span",{className:`${a.statusDot} ${_t(n.status)}`}),e.jsx(m,{text:(c==null?void 0:c.tooltip)??t(`settings.license.${n.status}.tooltip`,"Current license activation state."),children:(c==null?void 0:c.label)??t(`settings.license.${n.status}`,n.status)})]}),e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.tier","Tier"),tooltip:t("settings.license.tier.tooltip","Current subscription tier for available WEPPY Dashboard features.")})}),e.jsx("dd",{className:n.tier==="pro"?a.proBadge:"",children:e.jsx(m,{text:t(`tier.${n.tier}.tooltip`,"Available feature set for the connected license."),children:n.tier==="pro"?t("tier.pro","Pro"):t("tier.basic","Basic")})}),$&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.key","Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("dd",{children:e.jsx(m,{text:t("settings.license.keyValue.tooltip","Masked license key currently loaded by the server."),children:$})})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.provider","Provider"),tooltip:t("settings.license.provider.tooltip","License provider used to validate this key.")})}),e.jsx("dd",{children:e.jsx(m,{text:t("settings.license.providerValue.tooltip","License provider used to validate this key."),children:N})})]})]}),(c==null?void 0:c.detail)&&e.jsx("p",{className:`${a.licenseNotice} ${c.detailTone}`,children:n.refreshBlockedReason==="missing_session_token"?t("settings.license.detail.manualActivation","Manual activation required to restore Pro access."):c.detail}),n.refreshBlockedReason==="missing_session_token"&&e.jsx("p",{className:`${a.licenseNotice} ${a.licenseNoticeMuted}`,children:c==null?void 0:c.detail})]})})(),n.tier==="basic"&&e.jsx(m,{text:t("tier.upgrade.tooltip","View Pro features and purchase options."),children:e.jsx("a",{className:a.upgradeLink,href:je.settingsLicense,target:"_blank",rel:"noopener noreferrer",onClick:()=>d("dashboard_click_event",{click_target:"upgrade_cta",placement:"settings_license",page:"settings"}),children:t("tier.upgrade","View Pro")})})]}):e.jsx("div",{className:a.loading,children:t("settings.license.unavailable")}),e.jsxs("div",{className:a.licenseControls,children:[e.jsxs("div",{className:a.licenseControlRow,children:[e.jsx(m,{text:t("settings.license.refresh.tooltip","Re-fetch the current state from the license server. Useful when a billing change hasn't appeared yet."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p||!L,onClick:()=>{k()},children:p?t("common.loading"):t("settings.license.refresh","Refresh License")})}),e.jsx(m,{text:t("settings.license.reset.tooltip","Remove the currently registered license key. Use this before activating with a different key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p||!A,onClick:()=>{P()},children:p?t("common.loading"):t("settings.license.reset","Reset License")})})]}),e.jsxs("div",{className:a.licenseControlRow,children:[e.jsxs("label",{className:`${a.licenseField} ${a.licenseFieldGrow}`,children:[e.jsx("span",{className:a.controlLabel,children:e.jsx(R,{label:t("settings.license.keyInput","License Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("input",{ref:B,"aria-label":t("settings.license.keyInput","License Key"),className:a.textInput,type:"text",value:E,disabled:g||p,onChange:c=>w(c.target.value)})]}),e.jsx(m,{text:t("settings.license.activate.tooltip","Activate Pro features with the entered license key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p,onClick:()=>{(async()=>await v(E)&&w(""))()},children:p?t("common.loading"):t("settings.license.activate","Activate License")})})]}),_&&e.jsx("p",{className:a.licenseMessage,children:_})]})]})]}),e.jsx(St,{tier:j}),b&&e.jsx(Ct,{ref:S,autoOpen:b.dashboard.autoOpen,settingsFilePath:b.dashboard.settingsFilePath,saving:D,targeted:F,updateDashboardPreferences:x}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:t("settings.cold.title","Server Environment"),tooltip:t("settings.cold.title.tooltip","Read-only server environment values loaded at startup.")}),e.jsx(m,{text:t("settings.readOnly.tooltip","This section shows values that cannot be edited from WEPPY Dashboard."),children:e.jsx("span",{className:a.headerBadge,children:t("settings.readOnly","Read-only")})})]}),b?e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.coldGrid,children:[e.jsx("dt",{children:e.jsx(R,{label:"HTTP_PORT",tooltip:t("settings.cold.httpPort.tooltip","Port number used by the MCP WEPPY Dashboard HTTP server.")})}),e.jsx("dd",{children:b.cold.HTTP_PORT}),e.jsx("dt",{children:e.jsx(R,{label:"HTTP_HOST",tooltip:t("settings.cold.httpHost.tooltip","Host interface that the MCP WEPPY Dashboard HTTP server binds to.")})}),e.jsx("dd",{children:b.cold.HTTP_HOST})]}),e.jsx("p",{className:a.coldHint,children:t("settings.cold.hint","Set via environment variables to change these values.")})]}):e.jsx("div",{className:a.loading,children:t("settings.unavailable")})]}),e.jsxs("div",{className:a.card,children:[e.jsx("div",{className:a.cardHeader,children:e.jsx(R,{label:t("settings.language.title","Language"),tooltip:t("settings.language.title.tooltip","Choose how the WEPPY Dashboard interface text is localized.")})}),e.jsxs("div",{className:a.langRow,children:[e.jsx("label",{children:e.jsx(R,{label:t("settings.language.dashboard","WEPPY Dashboard Language"),tooltip:t("settings.language.dashboard.tooltip","Overrides the WEPPY Dashboard language or follows the system language when set to Auto.")})}),e.jsx(m,{text:t("settings.language.auto.tooltip","Follow the operating system's language. Falls back to English when not supported."),children:e.jsxs("select",{className:a.select,value:s,onChange:c=>l(c.target.value),children:[e.jsx("option",{value:xe,children:t("settings.language.auto","Auto")}),fe.map(c=>e.jsx("option",{value:c,children:Nt[c]??c},c))]})})]})]})]})}export{Dt as Component};
@@ -1 +1 @@
1
- import{u as o,j as s}from"./index-CACN5u4J.js";const e="_badge_1ucqq_2",c="_dot_1ucqq_12",a="_online_1ucqq_20",l="_offline_1ucqq_25",_="_idle_1ucqq_30",u="_syncing_1ucqq_34",d="_initializing_1ucqq_35",n={badge:e,dot:c,online:a,offline:l,idle:_,syncing:u,initializing:d},g={online:"status.online",offline:"status.offline",idle:"status.idle",syncing:"status.syncing",initializing:"status.initializing"};function f({status:i}){const{t}=o();return s.jsxs("span",{className:n.badge,children:[s.jsx("span",{className:`${n.dot} ${n[i]}`}),t(g[i])]})}export{f as S};
1
+ import{u as o,j as s}from"./index-Ygt1Wh6v.js";const e="_badge_1ucqq_2",c="_dot_1ucqq_12",a="_online_1ucqq_20",l="_offline_1ucqq_25",_="_idle_1ucqq_30",u="_syncing_1ucqq_34",d="_initializing_1ucqq_35",n={badge:e,dot:c,online:a,offline:l,idle:_,syncing:u,initializing:d},g={online:"status.online",offline:"status.offline",idle:"status.idle",syncing:"status.syncing",initializing:"status.initializing"};function f({status:i}){const{t}=o();return s.jsxs("span",{className:n.badge,children:[s.jsx("span",{className:`${n.dot} ${n[i]}`}),t(g[i])]})}export{f as S};
@@ -0,0 +1 @@
1
+ import{r,b as I,k as A,D as V,a as H,c as W,l as q,j as e,u as M,d as G,e as z,i as Y,T as K}from"./index-Ygt1Wh6v.js";import{B as R,a as E,P as J}from"./PageHeader-Xrn6BpcL.js";import{I as L}from"./InfoLabel-D6WxKFnG.js";import{T as S}from"./TooltipText-B1An7dUI.js";import{C as F}from"./ConfirmModal-BSbhJt6x.js";import{C as B}from"./CurrentPlaceScope-BFYSAg2T.js";import{S as Q}from"./StatusBadge-Ddzg1cSk.js";import"./ConfirmModal.module-DJksQHBd.js";const X=5e3;function Z(){const[t,s]=r.useState(null),[c,a]=r.useState([]),[x,y]=r.useState(!0),[d,f]=r.useState(null),[h,j]=r.useState(null),[n,u]=r.useState({report:null,loading:!1,applying:!1,error:null}),k=r.useRef(null),N=r.useRef(null),v=r.useCallback(async()=>{var p;try{const[l,g]=await Promise.all([I.get("/sync/status"),I.get("/api/dashboard/place-summary")]);s(l);const D=(p=g.places)==null?void 0:p.find(U=>U.isActive);return f((D==null?void 0:D.placeDirName)??null),j(g.activePlaceId),g.activePlaceId}catch{return null}},[]),T=r.useCallback(async()=>{try{const p=await I.get("/sync/history",{limit:"30"});a(p.entries??[])}catch{a([])}},[]),o=r.useCallback(async p=>{if(p===null){u({report:null,loading:!1,applying:!1,error:null});return}u(l=>({...l,loading:!0,error:null}));try{const l=await I.get("/api/sync/migration",{placeId:String(p)});u(g=>({...g,report:l,loading:!1,error:l.status==="blocked"?"migration_blocked":null}))}catch(l){if(l instanceof A&&(l.status===404||l.status===503)){u(g=>({...g,report:null,loading:!1,error:null}));return}u(g=>({...g,loading:!1,error:"unknown"}))}},[]),_=r.useCallback(async()=>{const[p]=await Promise.all([v(),T()]);await o(p),y(!1)},[v,T,o]),P=r.useCallback(()=>{_()},[_]),C=r.useCallback(async()=>{await o(h)},[h,o]),m=r.useCallback(async()=>{const p=n.report;if(!(!p||p.status!=="ready"||n.applying)){u(l=>({...l,applying:!0,error:null}));try{const l=await I.post("/api/sync/migration",{placeId:p.placeId,fromVersion:2,previewFingerprint:p.previewFingerprint,apply:!0});u({report:l,loading:!1,applying:!1,error:null}),await v()}catch(l){if(l instanceof A&&l.status===409&&(l.error==="preview_stale"||l.error==="migration_blocked")){const g=l.error;await o(p.placeId),u(D=>({...D,applying:!1,error:g}));return}u(g=>({...g,applying:!1,error:"unknown"}))}}},[o,v,n.applying,n.report]),b=r.useCallback(async()=>{await I.post("/api/dashboard/sync/history/clear"),a([]),v()},[v]);return r.useEffect(()=>(_(),N.current=setInterval(_,X),()=>{N.current&&clearInterval(N.current)}),[_]),r.useEffect(()=>{const p=new V;k.current=p,p.connect();const l=p.on("sync",()=>{_()});return()=>{l(),p.disconnect(),k.current=null}},[_]),{status:t,history:c,loading:x,activePlaceDirName:d,migration:n,refresh:P,refreshMigration:C,applyMigration:m,clearHistory:b}}const ee="_actions_1j3p3_60",te="_btn_1j3p3_68",ie="_btnPrimary_1j3p3_99",oe="_panel_1j3p3_109",ae="_panelIcon_1j3p3_116",se="_panelTitle_1j3p3_122",ne="_panelDesc_1j3p3_131",ce="_benefitList_1j3p3_139",le="_benefitItem_1j3p3_148",w={actions:ee,btn:te,btnPrimary:ie,panel:oe,panelIcon:ae,panelTitle:se,panelDesc:ne,benefitList:ce,benefitItem:le};function re({icon:t,title:s,description:c,benefits:a,upgradeLabel:x,upgradeHref:y}){const{trackEvent:d}=H(),{pathname:f,search:h}=W(),j=q(f,h);return e.jsxs("div",{className:w.panel,children:[t&&e.jsx("div",{className:w.panelIcon,children:t}),e.jsx("div",{className:w.panelTitle,children:s}),e.jsx("div",{className:w.panelDesc,children:c}),e.jsx("ul",{className:w.benefitList,children:a.map(n=>e.jsx("li",{className:w.benefitItem,children:n},n))}),e.jsx("div",{className:w.actions,children:e.jsx("a",{className:`${w.btn} ${w.btnPrimary}`,href:y,target:"_blank",rel:"noreferrer",onClick:()=>d("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...j}),children:x})})]})}const pe="_page_1o0wf_2",de="_card_1o0wf_10",ye="_cardHeader_1o0wf_17",me="_clearButton_1o0wf_29",ue="_statusRow_1o0wf_53",ge="_metaItem_1o0wf_60",fe="_statusGrid_1o0wf_66",he="_migrationPanel_1o0wf_85",_e="_migrationHeader_1o0wf_92",xe="_migrationTitle_1o0wf_99",we="_migrationDescription_1o0wf_108",je="_migrationLedger_1o0wf_116",ve="_migrationLedgerItem_1o0wf_123",Se="_migrationLedgerBlocked_1o0wf_148",be="_migrationSection_1o0wf_152",Ne="_migrationList_1o0wf_166",Ie="_migrationRow_1o0wf_176",Le="_migrationOperation_1o0wf_189",Te="_migrationRowBody_1o0wf_194",De="_migrationNotice_1o0wf_215",Re="_migrationActions_1o0wf_222",ke="_migrationButton_1o0wf_228",Pe="_policySummary_1o0wf_265",Ce="_policySummaryItem_1o0wf_276",Ae="_policyPrimaryValue_1o0wf_301",Ee="_policyReviewNotice_1o0wf_307",Be="_policyApplySection_1o0wf_318",$e="_policyApplyHeader_1o0wf_322",Oe="_policyApplyTitle_1o0wf_326",He="_policyApplyDescription_1o0wf_334",Me="_policyInfoLabel_1o0wf_342",Fe="_policySafetyRow_1o0wf_353",Ue="_policySafetyLabel_1o0wf_365",Ve="_policySafetyBadge_1o0wf_371",We="_policyDisclosure_1o0wf_375",qe="_policyDisclosureIcon_1o0wf_407",Ge="_policyDisclosureIconOpen_1o0wf_414",ze="_policyScopeList_1o0wf_418",Ye="_policyScopeRow_1o0wf_425",Ke="_policyScopeName_1o0wf_439",Je="_policyDirectionRail_1o0wf_451",Qe="_policyDirectionEndpoint_1o0wf_467",Xe="_policyDirectionEndpointStudio_1o0wf_474",Ze="_policyDirectionArrow_1o0wf_478",et="_forwardBadge_1o0wf_521",tt="_logContainer_1o0wf_536",it="_logEntry_1o0wf_543",ot="_logTime_1o0wf_555",at="_logType_1o0wf_561",st="_logTypeWrite_1o0wf_570",nt="_logTypeUpdate_1o0wf_574",ct="_logTypeDelete_1o0wf_578",lt="_logTypeIdle_1o0wf_582",rt="_logPath_1o0wf_586",pt="_logEmpty_1o0wf_593",dt="_overlay_1o0wf_600",yt="_overlayTitle_1o0wf_610",mt="_overlayMessage_1o0wf_617",ut="_checklist_1o0wf_623",gt="_checkItem_1o0wf_633",i={page:pe,card:de,cardHeader:ye,clearButton:me,statusRow:ue,metaItem:ge,statusGrid:fe,migrationPanel:he,migrationHeader:_e,migrationTitle:xe,migrationDescription:we,migrationLedger:je,migrationLedgerItem:ve,migrationLedgerBlocked:Se,migrationSection:be,migrationList:Ne,migrationRow:Ie,migrationOperation:Le,migrationRowBody:Te,migrationNotice:De,migrationActions:Re,migrationButton:ke,policySummary:Pe,policySummaryItem:Ce,policyPrimaryValue:Ae,policyReviewNotice:Ee,policyApplySection:Be,policyApplyHeader:$e,policyApplyTitle:Oe,policyApplyDescription:He,policyInfoLabel:Me,policySafetyRow:Fe,policySafetyLabel:Ue,policySafetyBadge:Ve,policyDisclosure:We,policyDisclosureIcon:qe,policyDisclosureIconOpen:Ge,policyScopeList:ze,policyScopeRow:Ye,policyScopeName:Ke,policyDirectionRail:Je,policyDirectionEndpoint:Qe,policyDirectionEndpointStudio:Xe,policyDirectionArrow:Ze,forwardBadge:et,logContainer:tt,logEntry:it,logTime:ot,logType:at,logTypeWrite:st,logTypeUpdate:nt,logTypeDelete:ct,logTypeIdle:lt,logPath:rt,logEmpty:pt,overlay:dt,overlayTitle:yt,overlayMessage:mt,checklist:ut,checkItem:gt};function ft(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function ht(t){return`sync.migration.reason.${t}`}function _t(t){return`sync.migration.reason.${t}`}function xt({migration:t,onRefresh:s,onApply:c}){const{t:a}=M(),[x,y]=r.useState(!1),d=t==null?void 0:t.report;if(!t||!d||d.status==="not_required")return null;const f=d.status==="blocked",h=d.status==="ready"&&!t.loading&&!t.applying,j=async()=>{await c(),y(!1)};return e.jsxs("section",{className:`${i.card} ${i.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:i.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:i.migrationTitle,children:a("sync.migration.title","Sync format update available")}),e.jsx("p",{className:i.migrationDescription,children:a("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),e.jsx(R,{variant:f?"warning":"accent",children:f?a("sync.migration.status.blocked","Blocked"):a("sync.migration.status.ready","Ready to review")})]}),e.jsxs("div",{className:i.migrationLedger,"aria-label":a("sync.migration.preview","Review changes"),children:[e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.add","Add")}),e.jsx("strong",{children:d.summary.add})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.modify","Modify")}),e.jsx("strong",{children:d.summary.modify})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.delete","Delete")}),e.jsx("strong",{children:d.summary.delete})]}),e.jsxs("div",{className:`${i.migrationLedgerItem} ${f?i.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:a("sync.migration.summary.blocked","Blocked")}),e.jsx("strong",{children:d.summary.blocked})]})]}),d.changes.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.changes","Metadata changes")}),e.jsx("ul",{className:i.migrationList,children:d.changes.map(n=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:ft(n.operation),className:i.migrationOperation,children:a(`sync.migration.operation.${n.operation}`,n.operation)}),e.jsxs("div",{className:i.migrationRowBody,children:[e.jsx("code",{children:n.path}),e.jsx("span",{children:a(ht(n.reason),n.reason.replace(/_/g," "))})]})]},`${n.operation}:${n.path}`))})]}),d.blockers.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.blockers","Items to resolve")}),e.jsx("ul",{className:i.migrationList,children:d.blockers.map((n,u)=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:"warning",className:i.migrationOperation,children:a("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:i.migrationRowBody,children:[n.path&&e.jsx("code",{children:n.path}),e.jsx("span",{children:a(_t(n.reason),n.reason.replace(/_/g," "))})]})]},`${n.reason}:${n.path??u}`))})]}),e.jsxs("div",{className:i.migrationNotice,"aria-live":"polite",children:[(f||t.error==="migration_blocked")&&e.jsx("span",{children:a("sync.migration.blocked","Resolve sync conflicts before updating")}),t.error==="preview_stale"&&e.jsx("span",{children:a("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="unknown"&&e.jsx("span",{children:a("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:i.migrationActions,children:[e.jsx(E,{variant:"secondary",className:i.migrationButton,disabled:t.loading||t.applying,onClick:()=>void s(),children:t.loading?a("sync.migration.refreshing","Refreshing…"):a("sync.migration.refresh","Refresh preview")}),e.jsx(E,{variant:"primary",className:i.migrationButton,disabled:!h,onClick:()=>y(!0),children:t.applying?a("sync.migration.applying","Applying…"):a("sync.migration.apply","Apply update")})]}),e.jsx(F,{open:x,title:a("sync.migration.confirm.title","Apply sync format update?"),message:a("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:a("common.cancel","Cancel"),confirmLabel:a("sync.migration.apply","Apply update"),loading:t.applying,onCancel:()=>!t.applying&&y(!1),onConfirm:()=>void j()})]})}const wt=["scriptSource","properties","structure","serviceProperties"];function jt(t){const s=new Date(t);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`}function vt(t){switch(t){case"write":return i.logTypeWrite;case"update":return i.logTypeUpdate;case"delete":return i.logTypeDelete;default:return i.logTypeIdle}}function St(t){switch(t){case"syncing":return"syncing";case"initializing":return"initializing";case"idle":return"idle";default:return"offline"}}function bt(t,s){const c={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${s}`,c[s])}function $(t,s){return s==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function Nt(t,s){const c={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${s}`,c[s])}function It(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function Lt(t,s){const c={forward:"Studio changes are written to local files.",reverse:"Local file changes are applied to Studio.",bidirectional:"Changes can move from Studio to local files and from local files to Studio."};return t(`sync.policy.direction.${s}.tooltip`,c[s])}function O(...t){const s=t[0]??"",c=s.includes("\\")&&!s.includes("/")?"\\":"/";return t.filter(a=>a.length>0).map((a,x)=>x===0?a.replace(/[\\/]+$/g,""):a.replace(/^[\\/]+|[\\/]+$/g,"")).join(c)}function Tt(t){const s=t.replace(/[\\/]+$/g,""),c=s.split(/[\\/]+/);return c[c.length-1]??s}function Dt(t,s){const c=Tt(t);return c==="explorer"?t:c===s?O(t,"explorer"):O(t,s,"explorer")}function Rt(t,s){return s?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function kt(t,s){return s?t("sync.policy.safety.auto.tooltip","Deleting local files may automatically remove matching Studio instances. This is separate from UI Studio automatic cleanup."):t("sync.policy.safety.review.tooltip","Local file deletions wait for review before matching Studio instances are removed. This is separate from UI Studio automatic cleanup.")}function Pt(t,s){switch(s){case"write":return t("sync.log.type.write","WRITE");case"update":return t("sync.log.type.update","UPDATE");case"delete":return t("sync.log.type.delete","DELETE");default:return t("sync.log.type.idle","IDLE")}}function Ct(t,s){switch(s){case"write":return t("sync.log.type.write.tooltip","A new sync output was written to disk.");case"update":return t("sync.log.type.update.tooltip","An existing synced file or instance was updated.");case"delete":return t("sync.log.type.delete.tooltip","A synced file or instance was removed.");default:return t("sync.log.type.idle.tooltip","A sync event was recorded without a file mutation.")}}function Ut(){const{t}=M(),{trackEvent:s}=H(),{level:c}=G(),{tier:a,loading:x}=z(),y=Z(),{show:d}=Y(),[f,h]=r.useState(!1),[j,n]=r.useState(!1),[u,k]=r.useState(!1),N=!x&&a==="basic",v=c==="disconnected"||c==="serverOnly",T=e.jsx(J,{title:t("page.sync.title","Sync"),description:t("page.sync.description","Monitor Studio to local sync status, direction, apply mode, and recent sync logs."),helpTopicId:"sync",helpState:{connectionLevel:c,tier:a}});if(v)return e.jsxs("div",{className:i.page,children:[T,e.jsx(B,{surface:"sync"}),e.jsx("div",{className:i.card,children:e.jsxs("div",{className:i.overlay,children:[e.jsx("div",{className:i.overlayTitle,children:t("sync.overlay.title","Roblox Studio plugin required")}),e.jsx("div",{className:i.overlayMessage,children:t("sync.overlay.message","Sync status will be available once the Roblox Studio plugin connects.")}),e.jsxs("ul",{className:i.checklist,children:[e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check1","Is Roblox Studio running?")}),e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check2","Is the WEPPY Plugin installed?")})]})]})})]});const o=y.status,_=y.history,P=St(o==null?void 0:o.state),C=async()=>{n(!0);try{await y.clearHistory(),d(t("toast.clearSuccess","Cleared successfully"),"success"),h(!1)}catch{d(t("toast.clearFailed","Failed to clear data"),"error")}finally{n(!1)}};return e.jsxs("div",{className:i.page,children:[T,e.jsx(B,{surface:"sync"}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx(S,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),N&&e.jsx(S,{text:t("sync.status.forwardOnly.tooltip","Basic tier allows Studio to local forward sync only."),children:e.jsx("span",{className:i.forwardBadge,children:t("sync.status.forwardOnly","Forward Only")})})]}),e.jsxs("div",{className:i.statusRow,children:[e.jsx(Q,{status:P}),(o==null?void 0:o.placeName)&&e.jsxs("span",{className:i.metaItem,children:[e.jsx(L,{label:t("sync.status.place","Place"),tooltip:t("sync.status.place.tooltip","Connected Roblox place name and place ID.")}),": ",o.placeName,o.placeId?` (${o.placeId})`:""]})]}),e.jsxs("dl",{className:i.statusGrid,children:[(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(L,{label:t("sync.status.path","Place Root"),tooltip:t("sync.status.path.tooltip","Local filesystem root currently used for this place sync output.")})}),e.jsx("dd",{children:o.syncRoot})]}),y.activePlaceDirName&&(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(L,{label:t("sync.status.placePath","Explorer Path"),tooltip:t("sync.status.placePath.tooltip","Explorer files path for the active place.")})}),e.jsx("dd",{children:Dt(o.syncRoot,y.activePlaceDirName)})]}),(o==null?void 0:o.instanceCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(L,{label:t("sync.status.instances","Instances"),tooltip:t("sync.status.instances.tooltip","Total synced Roblox instances tracked in the local mirror.")})}),e.jsx("dd",{children:o.instanceCount})]}),(o==null?void 0:o.scriptCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(L,{label:t("sync.status.scripts","Scripts"),tooltip:t("sync.status.scripts.tooltip","Total synced script files currently indexed for this place.")})}),e.jsx("dd",{children:o.scriptCount})]}),(o==null?void 0:o.state)==="syncing"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(L,{label:t("sync.status.state","State"),tooltip:t("sync.status.state.tooltip","Current runtime sync state reported by the server.")})}),e.jsx("dd",{children:t("status.syncing","Syncing")})]})]})]}),e.jsx(xt,{migration:y.migration,onRefresh:y.refreshMigration,onApply:y.applyMigration}),(o==null?void 0:o.policy)&&e.jsxs("div",{className:i.card,children:[e.jsx("div",{className:i.cardHeader,children:e.jsx(S,{text:t("sync.policy.title.tooltip","Effective Sync policy reported by the connected Studio plugin."),children:t("sync.policy.title","Sync Policy")})}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(R,{variant:o.syncEnabled?"success":"neutral",children:o.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:i.policyPrimaryValue,children:bt(t,o.policy.preset)})]})]}),o.policyReviewRequired&&e.jsx("div",{className:i.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:i.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:i.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:i.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:i.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(S,{text:t("sync.policy.apply.content.tooltip","Script Source, property, and Service property changes made locally. Instance creation, deletion, renaming, and moves are Structure changes."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:$(t,o.policy.apply.contentChanges)})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(S,{text:t("sync.policy.apply.structure.tooltip","Instance creation, deletion, renaming, and moves made locally. Automatic local deletion additionally requires the separate delete option below."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:$(t,o.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:i.policySafetyRow,children:[e.jsx("span",{className:i.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(S,{text:kt(t,o.policy.autoApplyLocalDeletesToStudio),children:e.jsx(R,{variant:o.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:i.policySafetyBadge,tabIndex:0,children:Rt(t,o.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:i.policyDisclosure,"aria-expanded":u,"aria-controls":"sync-policy-scope-panel",onClick:()=>k(m=>!m),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${i.policyDisclosureIcon} ${u?i.policyDisclosureIconOpen:""}`,children:"⌄"})]}),u&&e.jsx("div",{id:"sync-policy-scope-panel",className:i.policyScopeList,children:wt.map(m=>{const b=o.policy.directions[m];return e.jsxs("div",{className:i.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:i.policyScopeName,children:t(`sync.policy.scope.${m}`,m)}),e.jsx(S,{text:Lt(t,b),children:e.jsxs("span",{className:i.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":Nt(t,b),tabIndex:0,children:[e.jsx("span",{className:i.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:i.policyDirectionArrow,"aria-hidden":"true",children:It(b)}),e.jsx("span",{className:`${i.policyDirectionEndpoint} ${i.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},m)})})]}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx("span",{children:t("sync.log.title","Sync Log")}),e.jsx("button",{className:i.clearButton,onClick:()=>{s("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),h(!0)},children:t("common.clear","Clear")})]}),e.jsx("div",{className:i.logContainer,children:_.length===0?e.jsx("div",{className:i.logEmpty,children:t("sync.log.empty","No sync events yet")}):_.map((m,b)=>e.jsxs("div",{className:i.logEntry,children:[e.jsx("span",{className:i.logTime,children:jt(m.timestamp)}),e.jsx(S,{text:Ct(t,m.type),children:e.jsx("span",{className:`${i.logType} ${vt(m.type)}`,children:Pt(t,m.type)})}),e.jsxs("span",{className:i.logPath,children:[m.path,m.details?` — ${m.details}`:""]})]},b))})]}),N&&e.jsx(re,{title:t("sync.upgrade.title","Explore Full Sync with Pro"),description:t("tier.banner.save","Save AI tokens with Pro!"),benefits:[t("sync.upgrade.benefit1","Bidirectional sync — edit files, auto-apply to Studio"),t("sync.upgrade.benefit2","Reverse sync — push file changes back to Studio"),t("sync.upgrade.benefit3","Full sync history and detailed change log")],upgradeLabel:t("sync.upgrade.buy","View Pro"),upgradeHref:K.sync}),e.jsx(F,{open:f,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.message","This permanently removes the stored sync log for the current place."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:j,onCancel:()=>!j&&h(!1),onConfirm:C})]})}export{Ut as Component};
@@ -1 +1 @@
1
- import{j as s}from"./index-CACN5u4J.js";const r="_tabBar_jefog_2",_="_tabs_jefog_9",j="_actions_jefog_14",d="_tab_jefog_2",f="_tabActive_jefog_52",a={tabBar:r,tabs:_,actions:j,tab:d,tabActive:f};function u({items:n,value:c,onChange:l,ariaLabel:b,className:i,rightActions:e}){return s.jsxs("div",{className:[a.tabBar,i].filter(Boolean).join(" "),role:"tablist","aria-label":b,children:[s.jsx("div",{className:a.tabs,children:n.map(t=>{const o=t.key===c;return s.jsx("button",{type:"button",role:"tab","aria-selected":o,"data-testid":t.testId,className:[a.tab,o?a.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(t.key),children:t.label},t.key)})}),e?s.jsx("div",{className:a.actions,children:e}):null]})}export{u as T};
1
+ import{j as s}from"./index-Ygt1Wh6v.js";const r="_tabBar_jefog_2",_="_tabs_jefog_9",j="_actions_jefog_14",d="_tab_jefog_2",f="_tabActive_jefog_52",a={tabBar:r,tabs:_,actions:j,tab:d,tabActive:f};function u({items:n,value:c,onChange:l,ariaLabel:b,className:i,rightActions:e}){return s.jsxs("div",{className:[a.tabBar,i].filter(Boolean).join(" "),role:"tablist","aria-label":b,children:[s.jsx("div",{className:a.tabs,children:n.map(t=>{const o=t.key===c;return s.jsx("button",{type:"button",role:"tab","aria-selected":o,"data-testid":t.testId,className:[a.tab,o?a.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(t.key),children:t.label},t.key)})}),e?s.jsx("div",{className:a.actions,children:e}):null]})}export{u as T};
@@ -0,0 +1 @@
1
+ ._wrapper_1s3lp_2{overflow-x:auto}._table_1s3lp_7{width:100%;border-collapse:collapse;font-family:var(--font-code);font-size:12px}._table_1s3lp_7 th{text-align:left;color:var(--text-muted);font-weight:500;padding:6px 8px;border-bottom:1px solid var(--border);background:var(--bg-secondary);white-space:nowrap;-webkit-user-select:none;user-select:none}._table_1s3lp_7 td{padding:6px 8px;color:var(--text-primary);border-bottom:1px solid var(--border-dim, rgba(255, 255, 255, .04))}._sortable_1s3lp_32{cursor:pointer;transition:color var(--transition)}._sortable_1s3lp_32:hover{color:var(--accent)}._sortArrow_1s3lp_41{margin-left:4px;font-size:10px}._table_1s3lp_7 tbody tr:hover td{background:var(--accent-dim)}._clickable_1s3lp_52{cursor:pointer}._empty_1s3lp_57{text-align:center;color:var(--text-muted);font-style:italic;padding:24px 8px}._page_d8s7g_2{display:flex;flex-direction:column;width:100%;min-width:0;gap:var(--content-gap);max-width:var(--content-max)}._card_d8s7g_14{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:16px 20px}._cardToolbar_d8s7g_21{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}._sectionTitle_d8s7g_29{font-family:var(--font-label);font-size:13px;color:var(--text-primary)}._dangerButton_d8s7g_35{border:1px solid var(--danger-border);background:var(--danger-bg);color:var(--danger-text);border-radius:var(--radius-control);padding:6px 12px;font-family:var(--font-label);font-size:12px;font-weight:500;cursor:pointer;transition:background var(--transition),border-color var(--transition)}._dangerButton_d8s7g_35:hover{background:var(--danger-hover-bg);border-color:var(--danger)}._proBadge_d8s7g_54{display:inline-block;margin-left:6px;padding:1px 5px;font-size:9px;font-weight:600;letter-spacing:.05em;color:var(--pro-text-on-badge);background:var(--pro-badge);border-radius:3px;vertical-align:middle}._statusOk_d8s7g_69{display:inline-flex;align-items:center;min-height:22px;padding:2px 8px;border:1px solid var(--success-border);border-radius:var(--radius-control);background:var(--success-bg);color:var(--success-text);font-weight:500;cursor:default}._statusFallback_d8s7g_82{display:inline-flex;align-items:center;min-height:22px;padding:2px 8px;border:1px solid var(--info-border);border-radius:var(--radius-control);background:var(--info-bg);color:var(--info-text);font-weight:600;cursor:default}._statusUnsupported_d8s7g_95,._statusWarning_d8s7g_108{display:inline-flex;align-items:center;min-height:22px;padding:2px 8px;border:1px solid var(--warning-border);border-radius:var(--radius-control);background:var(--warning-bg);color:var(--warning-text);font-weight:600;cursor:default}._statusError_d8s7g_121{display:inline-flex;align-items:center;min-height:22px;padding:2px 8px;border:1px solid var(--error-border);border-radius:var(--radius-control);background:var(--error-bg);color:var(--error-text);font-weight:600;cursor:default}._tierBasic_d8s7g_135{color:var(--text-secondary)}._tierPro_d8s7g_139{color:var(--pro-badge);font-weight:500}._tierMixed_d8s7g_144{color:var(--text-primary);font-weight:500}._errorText_d8s7g_150{color:var(--error)}._filterRow_d8s7g_155{display:flex;align-items:center;gap:12px;margin-bottom:12px}._filterLabel_d8s7g_162{font-family:var(--font-label);font-size:11px;color:var(--text-secondary);display:flex;align-items:center;gap:6px}._filterSelect_d8s7g_171{font-family:var(--font-code);font-size:12px;padding:3px 8px;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-secondary);color:var(--text-primary)}._filterSelect_d8s7g_171:focus-visible{outline:none;box-shadow:var(--focus-ring)}._detailsButton_d8s7g_186{min-height:28px;padding:3px 8px;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-secondary);color:var(--text-primary);font-family:var(--font-label);font-size:11px;cursor:pointer}._detailsButton_d8s7g_186:hover{border-color:var(--accent);background:var(--accent-dim)}._detailsButton_d8s7g_186:focus-visible{outline:none;box-shadow:var(--focus-ring)}._detailShell_d8s7g_209{display:flex;flex:1;min-width:0;min-height:0;flex-direction:column}._detailHeader_d8s7g_217{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:16px;min-width:0;padding:16px 20px;border-bottom:1px solid var(--border)}._detailHeading_d8s7g_228{display:flex;min-width:0;flex-direction:column;gap:4px}._detailTitle_d8s7g_235{color:var(--text-primary);font-family:var(--font-label);font-size:13px;font-weight:600}._detailRecordName_d8s7g_242{overflow:hidden;color:var(--text-secondary);font-family:var(--font-code);font-size:11px;text-overflow:ellipsis;white-space:nowrap}._detailHeaderActions_d8s7g_251{display:flex;flex:0 0 auto;align-items:center;gap:10px}._detailCloseButton_d8s7g_258{display:inline-grid;width:34px;height:34px;place-items:center;padding:0;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer}._detailCloseButton_d8s7g_258:hover{border-color:var(--accent);color:var(--text-primary)}._detailCloseButton_d8s7g_258:focus-visible{outline:none;box-shadow:var(--focus-ring)}._detailBody_d8s7g_281{display:flex;flex:1;min-width:0;min-height:0;overflow-x:hidden;overflow-y:auto;flex-direction:column;gap:12px;padding:20px}._detailSection_d8s7g_293{min-width:0;padding:14px;border:1px solid var(--border);border-radius:var(--radius);background:var(--bg-secondary);color:var(--text-secondary);font-size:12px}._detailSection_d8s7g_293>strong{display:block;margin-bottom:8px;color:var(--text-primary);font-family:var(--font-label);font-size:12px;font-weight:600}._detailList_d8s7g_312{display:flex;flex-direction:column;gap:6px}._detailItem_d8s7g_318{display:flex;flex-wrap:wrap;gap:6px;min-width:0}._detailLabel_d8s7g_325{font-family:var(--font-label);color:var(--text-muted)}._detailValue_d8s7g_330{min-width:0;color:var(--text-primary);overflow-wrap:anywhere}._pre_d8s7g_336{max-width:100%;font-family:var(--font-code);font-size:11px;color:var(--text-primary);background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-control);padding:8px;margin-top:4px;overflow-x:auto;max-height:200px;overflow-y:auto;white-space:pre-wrap;word-break:break-all}._pagination_d8s7g_354{display:flex;align-items:center;justify-content:center;gap:12px;margin-top:12px}._pageInfo_d8s7g_362{font-family:var(--font-code);font-size:12px;color:var(--text-secondary)}._btn_d8s7g_368{font-family:var(--font-label);font-size:12px;padding:4px 12px;border-radius:var(--radius-control);border:1px solid var(--border);background:var(--bg-secondary);color:var(--text-primary);cursor:pointer;transition:background var(--transition),border-color var(--transition)}._btn_d8s7g_368:hover:not(:disabled){border-color:var(--accent);background:var(--accent-dim)}._btn_d8s7g_368:disabled{opacity:.4;cursor:default}._btn_d8s7g_368:focus-visible{outline:none;box-shadow:var(--focus-ring)}._tierDistribution_d8s7g_396{margin-bottom:16px}._tierBarWrap_d8s7g_400{display:flex;height:12px;border-radius:6px;overflow:hidden;background:var(--bg-secondary)}._tierBarBasic_d8s7g_408{background:var(--text-secondary);transition:width .3s ease}._tierBarPro_d8s7g_413{background:var(--accent);transition:width .3s ease}._tierLabels_d8s7g_418{display:flex;justify-content:space-between;margin-top:4px;font-family:var(--font-code);font-size:11px;color:var(--text-secondary)}._statsTableWrap_d8s7g_427{border:1px solid var(--border);border-radius:var(--radius);overflow-x:auto;overflow-y:hidden}._statsTable_d8s7g_427{width:100%;border-collapse:collapse}._statsTable_d8s7g_427 th,._statsTable_d8s7g_427 td{padding:10px 12px;font-size:12px;text-align:left;border-bottom:1px solid var(--border)}._statsTable_d8s7g_427 th{font-family:var(--font-label);font-size:11px;font-weight:500;color:var(--text-secondary);background:var(--bg-secondary)}._statsTable_d8s7g_427 tbody tr:last-child td{border-bottom:none}._sortableHeader_d8s7g_459{cursor:pointer;-webkit-user-select:none;user-select:none}._sortArrow_d8s7g_464{margin-left:4px}._statsToolRow_d8s7g_468{cursor:pointer}._statsToolRow_d8s7g_468:hover td{background:var(--bg-secondary)}._statsActionRow_d8s7g_476 td{background:color-mix(in srgb,var(--bg-secondary) 72%,transparent)}._expandButton_d8s7g_480{display:inline-flex;align-items:center;gap:8px;padding:0;border:none;background:transparent;color:inherit;font:inherit;cursor:pointer}._expandIcon_d8s7g_492{width:10px;color:var(--text-secondary)}._actionLabel_d8s7g_497{display:inline-block;padding-left:18px;font-family:var(--font-code);color:var(--text-secondary)}._emptyStats_d8s7g_504{text-align:center;color:var(--text-muted)}._summaryLine_d8s7g_510{margin-top:12px;font-family:var(--font-code);font-size:12px;color:var(--text-muted);text-align:right}@media(max-width:720px){._card_d8s7g_14,._detailHeader_d8s7g_217{padding:14px 16px}._detailBody_d8s7g_281{padding:16px}}
@@ -0,0 +1 @@
1
+ import{j as e,r as i,b as I,D as ht,u as at,X as mt,a as bt,i as gt}from"./index-Ygt1Wh6v.js";import{P as xt}from"./PageHeader-Xrn6BpcL.js";import{T as M}from"./TooltipText-B1An7dUI.js";import{C as ft}from"./ConfirmModal-BSbhJt6x.js";import{C as _t}from"./ContentScopedDialog-D92wgDaU.js";import{C as yt}from"./CurrentPlaceScope-BFYSAg2T.js";import{T as Ct}from"./Tabs-DZDOsT6_.js";import"./ConfirmModal.module-DJksQHBd.js";const jt="_wrapper_1s3lp_2",Tt="_table_1s3lp_7",kt="_sortable_1s3lp_32",Nt="_sortArrow_1s3lp_41",St="_clickable_1s3lp_52",wt="_empty_1s3lp_57",A={wrapper:jt,table:Tt,sortable:kt,sortArrow:Nt,clickable:St,empty:wt};function vt({columns:t,data:o,sortBy:c,sortDir:T="asc",onSort:b,onRowClick:l,rowKey:N,emptyMessage:S}){return e.jsx("div",{className:A.wrapper,children:e.jsxs("table",{className:A.table,children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(h=>e.jsxs("th",{style:h.width?{width:h.width}:void 0,className:h.sortable?A.sortable:void 0,onClick:h.sortable&&b?()=>b(h.key):void 0,children:[e.jsx("span",{children:h.label}),h.sortable&&c===h.key&&e.jsx("span",{className:A.sortArrow,children:T==="asc"?"▴":"▾"})]},h.key))})}),e.jsx("tbody",{children:o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:A.empty,children:S||"No data"})}):o.map((h,w)=>{const j=N?N(h):String(w);return e.jsx("tr",{className:l?A.clickable:void 0,tabIndex:l?-1:void 0,onClick:l?f=>l(h,f.currentTarget):void 0,children:t.map(f=>e.jsx("td",{children:f.render?f.render(h):String(h[f.key]??"")},f.key))},j)})})]})})}function Mt(t){return{...t,sequenceNumber:typeof t.sequenceNumber=="number"?t.sequenceNumber:void 0,executionTimeMs:typeof t.executionTimeMs=="number"?t.executionTimeMs:void 0}}const Bt=50;function Pt(t){if(typeof t=="number")return{placeId:String(t)}}function Y(t,o){return typeof o!="number"?t:`${t}?placeId=${encodeURIComponent(String(o))}`}function Lt(t){const o=(t==null?void 0:t.placeId)??null,[c,T]=i.useState(null),[b,l]=i.useState(!0),[N,S]=i.useState([]),[h,w]=i.useState(0),[j,f]=i.useState(!1),[U,O]=i.useState(!0),[m,E]=i.useState(0),[_,F]=i.useState(""),B=i.useRef(null),k=i.useCallback(async()=>{l(!0);try{const y=Pt(o),u=y?await I.get("/api/dashboard/tool-stats",y):await I.get("/api/dashboard/tool-stats");T(u)}catch{}finally{l(!1)}},[o]),g=i.useCallback(async(y,u)=>{O(!0);try{const P={limit:String(Bt),offset:String(y)};u&&(P.tool=u),typeof o=="number"&&(P.placeId=String(o));const H=await I.get("/api/dashboard/history",P);S(H.entries.map(Mt)),w(H.total),f(H.hasMore)}catch{S([]),w(0),f(!1)}finally{O(!1)}},[o]),D=i.useCallback(()=>{k(),g(m,_)},[g,k,m,_]),V=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/history/clear",o)),g(m,_)},[g,m,_,o]),K=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/statistics/clear",o)),k()},[k,o]);return i.useEffect(()=>{k()},[k]),i.useEffect(()=>{g(m,_)},[g,m,_]),i.useEffect(()=>{const y=new ht;B.current=y,y.connect();const u=y.on("command",()=>{k(),g(m,_)});return()=>{u(),y.disconnect(),B.current=null}},[g,k,m,_]),{statistics:c,statsLoading:b,history:N,historyTotal:h,historyHasMore:j,historyLoading:U,historyOffset:m,historyToolFilter:_,setHistoryOffset:E,setHistoryToolFilter:F,refresh:D,clearHistory:V,clearStatistics:K}}const Et="_page_d8s7g_2",Ht="_card_d8s7g_14",At="_cardToolbar_d8s7g_21",Rt="_sectionTitle_d8s7g_29",It="_dangerButton_d8s7g_35",Ot="_proBadge_d8s7g_54",Ft="_statusOk_d8s7g_69",Dt="_statusFallback_d8s7g_82",$t="_statusUnsupported_d8s7g_95",qt="_statusWarning_d8s7g_108",Wt="_statusError_d8s7g_121",Ut="_tierBasic_d8s7g_135",Vt="_tierPro_d8s7g_139",Kt="_tierMixed_d8s7g_144",Gt="_filterRow_d8s7g_155",zt="_filterLabel_d8s7g_162",Jt="_filterSelect_d8s7g_171",Qt="_detailsButton_d8s7g_186",Zt="_detailShell_d8s7g_209",Xt="_detailHeader_d8s7g_217",Yt="_detailHeading_d8s7g_228",te="_detailTitle_d8s7g_235",ee="_detailRecordName_d8s7g_242",se="_detailHeaderActions_d8s7g_251",ae="_detailCloseButton_d8s7g_258",oe="_detailBody_d8s7g_281",le="_detailSection_d8s7g_293",re="_detailList_d8s7g_312",ie="_detailItem_d8s7g_318",ne="_detailLabel_d8s7g_325",ce="_detailValue_d8s7g_330",de="_pre_d8s7g_336",ue="_pagination_d8s7g_354",pe="_pageInfo_d8s7g_362",he="_btn_d8s7g_368",me="_tierDistribution_d8s7g_396",be="_tierBarWrap_d8s7g_400",ge="_tierBarBasic_d8s7g_408",xe="_tierBarPro_d8s7g_413",fe="_tierLabels_d8s7g_418",_e="_statsTableWrap_d8s7g_427",ye="_statsTable_d8s7g_427",Ce="_sortableHeader_d8s7g_459",je="_sortArrow_d8s7g_464",Te="_statsToolRow_d8s7g_468",ke="_statsActionRow_d8s7g_476",Ne="_expandButton_d8s7g_480",Se="_expandIcon_d8s7g_492",we="_actionLabel_d8s7g_497",ve="_emptyStats_d8s7g_504",Me="_summaryLine_d8s7g_510",a={page:Et,card:Ht,cardToolbar:At,sectionTitle:Rt,dangerButton:It,proBadge:Ot,statusOk:Ft,statusFallback:Dt,statusUnsupported:$t,statusWarning:qt,statusError:Wt,tierBasic:Ut,tierPro:Vt,tierMixed:Kt,filterRow:Gt,filterLabel:zt,filterSelect:Jt,detailsButton:Qt,detailShell:Zt,detailHeader:Xt,detailHeading:Yt,detailTitle:te,detailRecordName:ee,detailHeaderActions:se,detailCloseButton:ae,detailBody:oe,detailSection:le,detailList:re,detailItem:ie,detailLabel:ne,detailValue:ce,pre:de,pagination:ue,pageInfo:pe,btn:he,tierDistribution:me,tierBarWrap:be,tierBarBasic:ge,tierBarPro:xe,tierLabels:fe,statsTableWrap:_e,statsTable:ye,sortableHeader:Ce,sortArrow:je,statsToolRow:Te,statsActionRow:ke,expandButton:Ne,expandIcon:Se,actionLabel:we,emptyStats:ve,summaryLine:Me},Be=new Set(["clientId","placeId","pinnedTarget","recentPriority","globalQueue"]);function tt(t){return typeof t=="string"&&t.length>0?t:void 0}function Pe(t){if(!Array.isArray(t))return;const o=t.filter(c=>typeof c=="string"&&c.length>0);return o.length>0?o:void 0}function Le(t){const o=t.result??{};return{requestedCommand:t.requestedCommand??tt(o.requestedCommand),executedCommand:t.executedCommand??tt(o.executedCommand),alternatives:t.alternatives??Pe(o.alternatives)}}function ot(t,o){switch(t.status){case"fallback":return{label:o("tools.badge.fallback","FALLBACK"),tooltip:o("tools.badge.fallback.tooltip","The requested Pro action succeeded via a Basic fallback."),className:a.statusFallback};case"unsupported":return{label:o("tools.badge.unsupported","UNSUPPORTED"),tooltip:o("tools.badge.unsupported.tooltip","The requested Pro action was blocked and no fallback ran."),className:a.statusUnsupported};case"warning":return{label:o("tools.badge.warn","WARN"),tooltip:o("tools.badge.warn.tooltip","The tool call failed as an expected caller, project, policy, or user-code issue."),className:a.statusWarning};case"error":return{label:o("tools.badge.err","FAILED"),tooltip:o("tools.badge.err.tooltip","The tool run failed."),className:a.statusError};default:return{label:o("tools.status.ok","OK"),tooltip:o("tools.status.ok.tooltip","The tool run completed successfully."),className:a.statusOk}}}function C(t,o){return e.jsxs("div",{className:a.detailItem,children:[e.jsx("span",{className:a.detailLabel,children:t}),e.jsx("span",{className:a.detailValue,children:o})]})}function Ee(t){if(!t||typeof t!="object")return;const o=t;if(typeof o.selectionMode=="string"&&Be.has(o.selectionMode))return o}function et(t){if(!(!t||typeof t!="object"||!("routing"in t)))return Ee(t.routing)}function He(t){return t.routing??et(t.result)??et(t.data)}function Ae(t,o){return t.requestedClientId?t.requestedClientId:t.requestedPlaceId!==void 0?t.requestedPlaceId:o("tools.history.routing.none","No Studio target named")}function Re(t){return t.actualPlaceName?`${t.actualPlaceName} · ${t.actualPlaceId??"-"}`:t.actualClientId??"-"}function Ie({entry:t,onClose:o}){const{t:c}=at(),T=ot(t,c),b=Le(t),l=He(t);return e.jsxs("div",{className:a.detailShell,children:[e.jsxs("header",{className:a.detailHeader,children:[e.jsxs("div",{className:a.detailHeading,children:[e.jsx("span",{className:a.detailTitle,children:c("tools.detail.title","Tool execution")}),e.jsx("span",{className:a.detailRecordName,children:t.command})]}),e.jsxs("div",{className:a.detailHeaderActions,children:[e.jsx(M,{text:T.tooltip,children:e.jsx("span",{className:T.className,children:T.label})}),e.jsx("button",{type:"button",className:a.detailCloseButton,onClick:o,"aria-label":c("common.close","Close"),children:e.jsx(mt,{size:18,"aria-hidden":"true"})})]})]}),e.jsxs("div",{className:a.detailBody,children:[e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.params.tooltip","Input parameters passed to this tool run."),children:c("tools.detail.params","Parameters")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.parameters,null,2)})]}),t.result&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.result.tooltip","Returned result payload for this tool run."),children:c("tools.detail.result","Result")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.result,null,2)})]}),l&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:c("tools.history.routing","Routing")}),e.jsxs("div",{className:a.detailList,children:[C(c("tools.history.routing.mode","Mode"),l.selectionMode),C(c("tools.history.routing.requested","Requested"),Ae(l,c)),C(c("tools.history.routing.actual","Actual"),Re(l))]})]}),(t.status==="fallback"||t.status==="unsupported"||t.status==="warning"||t.status==="error")&&e.jsx("section",{className:a.detailSection,children:e.jsxs("div",{className:a.detailList,children:[t.status==="fallback"&&b.requestedCommand?C(c("tools.detail.requestedCommand","Requested Command"),b.requestedCommand):null,t.status==="fallback"&&b.executedCommand?C(c("tools.detail.executedCommand","Executed Command"),b.executedCommand):null,t.status==="fallback"&&b.alternatives?C(c("tools.detail.alternatives","Alternatives"),b.alternatives.join(", ")):null,t.status==="unsupported"&&t.blockedMessage?C(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="unsupported"?C(c("tools.detail.noFallback","No Fallback"),c("tools.detail.noFallback.value","No fallback ran.")):null,t.status==="warning"&&t.warningMessage?C(c("tools.detail.warningMessage","Warning Message"),t.warningMessage):null,t.status==="error"&&t.errorMessage?C(c("tools.detail.errorMessage","Error Message"),t.errorMessage):null,t.status==="error"&&t.blockedMessage?C(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="error"&&t.fallbackCommand?C(c("tools.detail.executedCommand","Executed Command"),t.fallbackCommand):null]})})]})]})}const G=50;function Oe(t){const o=new Date(t);return`${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}:${String(o.getSeconds()).padStart(2,"0")}`}function W(t){return typeof t!="number"||!Number.isFinite(t)?"-":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function R(t,o){return o==="pro"?t("tier.pro","Pro"):o==="mixed"?t("tier.mixed","Mixed"):t("tier.basic","Basic")}function lt(t,o){return o!==t&&o.startsWith(`${t}_`)?o.slice(t.length+1):""}function st(t,o){const c=lt(t,o);return c?`${t}.${c}`:t}function ze(){const{t}=at(),{trackEvent:o,trackPageView:c}=bt(),[T,b]=i.useState(null),l=Lt({placeId:T}),{show:N}=gt(),[S,h]=i.useState("history"),[w,j]=i.useState(null),f=i.useRef(null),[U,O]=i.useState(null),[m,E]=i.useState(null),[_,F]=i.useState(!1),[B,k]=i.useState("totalCalls"),[g,D]=i.useState("desc"),V=i.useCallback(s=>{k(n=>n===s?(D(r=>r==="asc"?"desc":"asc"),s):(D("desc"),s))},[]),K=i.useMemo(()=>{var n;const s=new Set;return Object.keys(((n=l.statistics)==null?void 0:n.tools)??{}).forEach(r=>s.add(r)),l.history.forEach(r=>{r.tool&&s.add(r.tool)}),l.historyToolFilter&&s.add(l.historyToolFilter),Array.from(s).sort()},[l.history,l.historyToolFilter,l.statistics]),y=i.useMemo(()=>{var s;return(s=l.statistics)!=null&&s.tools?Object.values(l.statistics.tools).map(n=>{var X;const r=Object.entries(n.commands??{}).map(([p,d])=>({toolName:n.tool,commandName:d.command??p,label:lt(n.tool,d.command??p)||(d.command??p),tier:d.tier,totalCalls:d.totalCalls,successCount:d.successCount,fallbackCount:d.fallbackCount,unsupportedCount:d.unsupportedCount,warningCount:d.warningCount??0,failureCount:d.failureCount,totalExecutionTimeMs:d.totalExecutionTimeMs,avgExecutionTimeMs:d.avgExecutionTimeMs})),x=r.reduce((p,d)=>p+d.totalCalls,0),v=r.reduce((p,d)=>p+d.successCount,0),$=r.reduce((p,d)=>p+d.fallbackCount,0),q=r.reduce((p,d)=>p+d.unsupportedCount,0),dt=r.reduce((p,d)=>p+d.warningCount,0),ut=r.reduce((p,d)=>p+d.failureCount,0),Z=r.reduce((p,d)=>p+d.totalExecutionTimeMs,0),pt=new Set(r.map(p=>p.tier)).size>1?"mixed":((X=r[0])==null?void 0:X.tier)??n.tier;return{toolName:n.tool,tier:pt,commands:r,totalCalls:x,successCount:v,fallbackCount:$,unsupportedCount:q,warningCount:dt,failureCount:ut,totalExecutionTimeMs:Z,avgExecutionTimeMs:x>0?Math.round(Z/x):0}}):[]},[l.statistics]),u=i.useCallback((s,n,r,x)=>e.jsx(M,{text:t(r,x),children:t(s,n)}),[t]),P=i.useCallback((s,n)=>{f.current=n,j(s)},[]),H=i.useCallback(()=>{j(null)},[]),z=i.useMemo(()=>[...y].sort((n,r)=>{const x=n[B],v=r[B];if(typeof x=="number"&&typeof v=="number")return g==="asc"?x-v:v-x;const $=String(x??""),q=String(v??"");return g==="asc"?$.localeCompare(q):q.localeCompare($)}),[y,B,g]),rt=i.useMemo(()=>[{key:"timestamp",label:u("tools.col.time","Time","tools.col.time.tooltip","When the tool run was recorded."),width:"80px",render:s=>Oe(s.timestamp)},{key:"toolName",label:u("tools.col.toolAction","Tool.Action","tools.col.toolAction.tooltip","Tool name and action that were executed."),render:s=>e.jsxs("span",{children:[st(s.tool,s.command),s.tier==="pro"&&e.jsx(M,{text:t("tools.badge.pro.tooltip","This entry used a Pro-only tool or action."),children:e.jsx("span",{className:a.proBadge,children:t("tools.badge.pro","PRO")})})]})},{key:"executionTimeMs",label:u("tools.col.duration","Duration","tools.col.duration.tooltip","How long the tool took to finish."),width:"80px",render:s=>W(s.executionTimeMs)},{key:"status",label:u("tools.col.status","Status","tools.col.status.tooltip","Outcome of the recorded tool run."),width:"120px",render:s=>{const n=ot(s,t);return e.jsx(M,{text:n.tooltip,children:e.jsx("span",{className:n.className,children:n.label})})}},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tier.tooltip","License tier required for the tool or action."),width:"60px",render:s=>e.jsx("span",{className:s.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,s.tier)})},{key:"details",label:t("tools.detail.open","Details"),width:"84px",render:s=>{const n=st(s.tool,s.command);return e.jsx("button",{type:"button",className:a.detailsButton,"aria-haspopup":"dialog","aria-label":t("tools.detail.openLabel","View details for {command}").replace("{command}",n),onClick:r=>{r.stopPropagation(),P(s,r.currentTarget)},children:t("tools.detail.open","Details")})}}],[P,t,u]),J=i.useMemo(()=>[{key:"toolName",label:u("tools.col.tool","Tool","tools.col.tool.tooltip","Consolidated tool name in the statistics table."),sortable:!0},{key:"totalCalls",label:u("tools.col.calls","Calls","tools.col.calls.tooltip","Total number of recorded calls for this tool."),sortable:!0,width:"70px"},{key:"successCount",label:u("tools.col.ok","OK","tools.col.ok.tooltip","Number of direct successful runs."),sortable:!0,width:"70px"},{key:"fallbackCount",label:u("tools.col.fallback","FALLBACK","tools.col.fallback.tooltip","Number of runs that succeeded through fallback execution."),sortable:!0,width:"110px"},{key:"unsupportedCount",label:u("tools.col.unsupported","UNSUPPORTED","tools.col.unsupported.tooltip","Number of blocked runs without fallback execution."),sortable:!0,width:"130px"},{key:"warningCount",label:u("tools.col.warn","WARN","tools.col.warn.tooltip","Number of expected failures caused by caller input, project state, Roblox policy, or user code."),sortable:!0,width:"80px"},{key:"failureCount",label:u("tools.col.err","FAILED","tools.col.err.tooltip","Number of runs that failed."),sortable:!0,width:"70px"},{key:"avgExecutionTimeMs",label:u("tools.col.avgTime","Avg Time","tools.col.avgTime.tooltip","Average execution time across recorded calls."),sortable:!0,width:"90px",render:s=>W(s.avgExecutionTimeMs)},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tierStats.tooltip","Basic, Pro, or Mixed summary for the tool statistics row."),sortable:!0,width:"70px",render:s=>e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})}],[t,u]),L=i.useMemo(()=>{if(!l.statistics)return null;const s=l.statistics.tierSummary.basic.totalCalls,n=l.statistics.tierSummary.pro.totalCalls,r=s+n;if(r===0)return null;const x=Math.round(s/r*100),v=100-x;return{basic:s,pro:n,basicPct:x,proPct:v}},[l.statistics]),Q=i.useCallback(s=>{O(n=>n===s?null:s)},[]),it=i.useCallback(async()=>{if(m){F(!0);try{m==="history"?await l.clearHistory():await l.clearStatistics(),N(t("toast.clearSuccess","Cleared successfully"),"success"),E(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{F(!1)}}},[m,N,t,l]),nt=i.useCallback(s=>{const n=s==="history"?"tools_history":"tools_statistics";o("dashboard_click_event",{click_target:s==="history"?"tools_tab_history":"tools_tab_statistics",page:"tools",tab:n}),c({page:"tools",tab:n}),j(null),h(s)},[o,c]),ct=["history","statistics"].map(s=>({key:s,label:t(`tools.tab.${s}`,s.charAt(0).toUpperCase()+s.slice(1))}));return e.jsxs("div",{className:a.page,children:[e.jsx(xt,{title:t("page.tools.title","Tools"),description:t("page.tools.description","Inspect tool history, outcomes, fallback details, and usage statistics."),helpTopicId:"tools"}),e.jsx(yt,{surface:"tools",selectable:!0,selectedPlaceId:T,onSelectedPlaceIdChange:s=>{j(null),b(s),l.setHistoryOffset(0)}}),e.jsx(Ct,{items:ct,value:S,onChange:nt}),S==="history"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.history","History")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_history",page:"tools",tab:"tools_history"}),E("history")},children:t("common.clear","Clear")})]}),e.jsx("div",{className:a.filterRow,children:e.jsxs("label",{className:a.filterLabel,children:[t("tools.filter.tool","Tool"),":",e.jsxs("select",{className:a.filterSelect,value:l.historyToolFilter,onChange:s=>{j(null),l.setHistoryToolFilter(s.target.value),l.setHistoryOffset(0)},children:[e.jsx("option",{value:"",children:t("tools.filter.all","All")}),K.map(s=>e.jsx("option",{value:s,children:s},s))]})]})}),e.jsx(vt,{columns:rt,data:l.history,rowKey:s=>s.id,onRowClick:(s,n)=>P(s,n),emptyMessage:t("tools.empty.history","No tool history entries for this place")}),e.jsxs("div",{className:a.pagination,children:[e.jsx("button",{className:a.btn,disabled:l.historyOffset===0,title:t("tools.page.prev.tooltip","Go to the previous page of tool history results."),onClick:()=>{j(null),l.setHistoryOffset(Math.max(0,l.historyOffset-G))},children:t("tools.page.prev","Prev")}),e.jsxs("span",{className:a.pageInfo,children:[l.historyOffset+1,"–",Math.min(l.historyOffset+G,l.historyTotal)," / ",l.historyTotal]}),e.jsx("button",{className:a.btn,disabled:!l.historyHasMore,title:t("tools.page.next.tooltip","Go to the next page of tool history results."),onClick:()=>{j(null),l.setHistoryOffset(l.historyOffset+G)},children:t("tools.page.next","Next")})]})]}),S==="statistics"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.statistics","Statistics")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_statistics",page:"tools",tab:"tools_statistics"}),E("statistics")},children:t("common.clear","Clear")})]}),L&&e.jsxs("div",{className:a.tierDistribution,children:[e.jsxs("div",{className:a.tierBarWrap,children:[e.jsx("div",{className:a.tierBarBasic,style:{width:`${L.basicPct}%`}}),e.jsx("div",{className:a.tierBarPro,style:{width:`${L.proPct}%`}})]}),e.jsxs("div",{className:a.tierLabels,children:[e.jsxs("span",{children:[R(t,"basic")," ",L.basicPct,"% (",L.basic,")"]}),e.jsxs("span",{children:[R(t,"pro")," ",L.proPct,"% (",L.pro,")"]})]})]}),e.jsx("div",{className:a.statsTableWrap,children:e.jsxs("table",{className:a.statsTable,children:[e.jsx("thead",{children:e.jsx("tr",{children:J.map(s=>e.jsxs("th",{style:s.width?{width:s.width}:void 0,className:s.sortable?a.sortableHeader:void 0,onClick:s.sortable?()=>V(s.key):void 0,children:[e.jsx("span",{children:s.label}),s.sortable&&B===s.key&&e.jsx("span",{className:a.sortArrow,children:g==="asc"?"▴":"▾"})]},s.key))})}),e.jsx("tbody",{children:z.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:J.length,className:a.emptyStats,children:t("tools.empty.stats","No tool statistics for this place")})}):z.map(s=>{const n=U===s.toolName;return e.jsxs(i.Fragment,{children:[e.jsxs("tr",{className:a.statsToolRow,onClick:()=>Q(s.toolName),children:[e.jsx("td",{children:e.jsxs("button",{type:"button",className:a.expandButton,"aria-expanded":n,"aria-label":`${s.toolName} ${n?t("common.collapse","Collapse"):t("common.expand","Expand")}`,onClick:r=>{r.stopPropagation(),Q(s.toolName)},children:[e.jsx("span",{className:a.expandIcon,"aria-hidden":"true",children:n?"▾":"▸"}),e.jsx("span",{children:s.toolName})]})}),e.jsx("td",{children:s.totalCalls}),e.jsx("td",{children:s.successCount}),e.jsx("td",{children:s.fallbackCount}),e.jsx("td",{children:s.unsupportedCount}),e.jsx("td",{children:s.warningCount}),e.jsx("td",{children:s.failureCount}),e.jsx("td",{children:W(s.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})})]}),n&&s.commands.map(r=>e.jsxs("tr",{className:a.statsActionRow,children:[e.jsx("td",{children:e.jsx("span",{className:a.actionLabel,children:r.label})}),e.jsx("td",{children:r.totalCalls}),e.jsx("td",{children:r.successCount}),e.jsx("td",{children:r.fallbackCount}),e.jsx("td",{children:r.unsupportedCount}),e.jsx("td",{children:r.warningCount}),e.jsx("td",{children:r.failureCount}),e.jsx("td",{children:W(r.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx("span",{className:r.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,r.tier)})})]},`${s.toolName}:${r.commandName}`))]},s.toolName)})})]})}),l.statistics&&e.jsxs("div",{className:a.summaryLine,children:[t("tools.summary.total","Total"),": ",l.statistics.totalCalls," ",t("tools.summary.calls","calls")," | ",t("tools.summary.sessions","Sessions"),": ",l.statistics.totalSessions]})]}),e.jsx(_t,{open:w!==null,ariaLabel:t("tools.detail.dialogLabel","Tool execution detail"),onClose:H,returnFocusTo:f.current,testId:"tools-history-detail-popup-layer",children:w&&e.jsx(Ie,{entry:w,onClose:H})}),e.jsx(ft,{open:m!==null,title:m==="history"?t("tools.clear.history.title","Clear history?"):t("tools.clear.statistics.title","Clear statistics?"),message:m==="history"?t("tools.clear.history.message","This permanently removes the current place tools history."):t("tools.clear.statistics.message","This permanently resets the current place tool statistics."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:_,onCancel:()=>!_&&E(null),onConfirm:it})]})}export{ze as Component};
@@ -1 +1 @@
1
- import{j as r,k as s}from"./index-CACN5u4J.js";function p({text:o,children:t}){return r.jsx(s,{text:o,children:t})}export{p as T};
1
+ import{j as r,h as s}from"./index-Ygt1Wh6v.js";function p({text:o,children:t}){return r.jsx(s,{text:o,children:t})}export{p as T};