@weppy/roblox-mcp 2.17.16 → 2.17.18

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 (37) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dashboard/dist/assets/{AiPromptExamples-BT5RrshJ.js → AiPromptExamples-D2sS2PSu.js} +1 -1
  3. package/dashboard/dist/assets/{AssetsPage-B91Jd91K.js → AssetsPage-B2qzqnkt.js} +1 -1
  4. package/dashboard/dist/assets/{ChangelogPage-D8QDjq9V.js → ChangelogPage-C5ja0j4I.js} +1 -1
  5. package/dashboard/dist/assets/{ConfirmModal-D2yw01tT.js → ConfirmModal-Bs6DRyDJ.js} +1 -1
  6. package/dashboard/dist/assets/{ConnectionPage-DuE65ANO.js → ConnectionPage-BlX_FCoU.js} +1 -1
  7. package/dashboard/dist/assets/{ControlsPage-Cl2JDzO5.js → ControlsPage-BJrBVm7J.js} +1 -1
  8. package/dashboard/dist/assets/{GameChangeDetail-B-rutxUx.js → GameChangeDetail-BzNOM8NR.js} +1 -1
  9. package/dashboard/dist/assets/{InfoLabel-DfinjjFO.js → InfoLabel-ZcP_cIQR.js} +1 -1
  10. package/dashboard/dist/assets/{OverviewPage-D_R1KBze.js → OverviewPage-B9a6q4Ii.js} +1 -1
  11. package/dashboard/dist/assets/{PageHeader-QiUV3oJs.js → PageHeader-DJRyLHjf.js} +1 -1
  12. package/dashboard/dist/assets/{PlaceSelectOptions-BArB7wnB.js → PlaceSelectOptions-CM4-kAp6.js} +1 -1
  13. package/dashboard/dist/assets/{PlaytestAiPromptExamples-BymEsVMx.js → PlaytestAiPromptExamples-xPI9gFIa.js} +1 -1
  14. package/dashboard/dist/assets/{PlaytestPage-xSVycgy8.js → PlaytestPage-DAmSdhjK.js} +1 -1
  15. package/dashboard/dist/assets/SettingsPage-vFF8B8_s.js +1 -0
  16. package/dashboard/dist/assets/{SyncPage-CMHX43na.js → SyncPage-Bdvcmu3d.js} +1 -1
  17. package/dashboard/dist/assets/{Tabs-Cnh4bdIv.js → Tabs-CKXzr1J0.js} +1 -1
  18. package/dashboard/dist/assets/{TierPromoPanel-DWTUB0jD.js → TierPromoPanel-BKRqAd84.js} +1 -1
  19. package/dashboard/dist/assets/{ToolsPage-BWDGROg9.js → ToolsPage-CIujiMTB.js} +1 -1
  20. package/dashboard/dist/assets/{TooltipText-x86NSn8t.js → TooltipText-3t8YedaH.js} +1 -1
  21. package/dashboard/dist/assets/{UiStudioPage-DruAP3cs.js → UiStudioPage-BDsl75Db.js} +1 -1
  22. package/dashboard/dist/assets/{WhatsNewPage-DdlnBlsD.js → WhatsNewPage-C5UL-0oc.js} +1 -1
  23. package/dashboard/dist/assets/{bot-SjZv9JDp.js → bot-CtZWcMz-.js} +1 -1
  24. package/dashboard/dist/assets/{check-BTcudP1t.js → check-Baab5uf0.js} +1 -1
  25. package/dashboard/dist/assets/{copy-BV32y84n.js → copy-C3LkcanH.js} +1 -1
  26. package/dashboard/dist/assets/{index-B1SnAt0o.js → index-DOEmzpkJ.js} +54 -54
  27. package/dashboard/dist/assets/{rotate-ccw-DFqk1Xmr.js → rotate-ccw-Qw8waJGt.js} +1 -1
  28. package/dashboard/dist/assets/{sample-requests-BxNYwxW0.js → sample-requests-D-1qxdk0.js} +1 -1
  29. package/dashboard/dist/assets/{trash-2-CYsYg3as.js → trash-2-BEuYnkkE.js} +1 -1
  30. package/dashboard/dist/assets/{useLiveUptime-IBRIkiaM.js → useLiveUptime-DqFiew1s.js} +1 -1
  31. package/dashboard/dist/assets/useSettings-B4O8NGPH.js +1 -0
  32. package/dashboard/dist/index.html +1 -1
  33. package/dist/index.js +168 -168
  34. package/package.json +1 -1
  35. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  36. package/dashboard/dist/assets/SettingsPage-f3RT7b9T.js +0 -1
  37. package/dashboard/dist/assets/useSettings-BiOxUpzD.js +0 -1
@@ -0,0 +1 @@
1
+ import{u as K,s as le,j as e,r,a as ce,b as I,g as je,c as fe,T as xe,A as ve,S as be}from"./index-DOEmzpkJ.js";import{C as Se,P as Ce}from"./PageHeader-DJRyLHjf.js";import{I as R}from"./InfoLabel-ZcP_cIQR.js";import{T as m}from"./TooltipText-3t8YedaH.js";import{s as a,u as Ne}from"./useSettings-B4O8NGPH.js";import{C as de}from"./ConfirmModal-Bs6DRyDJ.js";import{D as ue,f as pe,r as _e,s as ke,a as ge,d as se,S as ae,b as Pe}from"./sample-requests-D-1qxdk0.js";import"./ConfirmModal.module-DJksQHBd.js";function he({value:t}){const{t:s}=K(),o=le(t);if(!o)return null;const c=["wait","review_settings","review_external","reauthenticate","correct_input"].includes(o.nextAction??"")?o.nextAction:"inspect",n=o.traceId??o.clientOperationId??o.requestId??"";return e.jsxs("details",{children:[e.jsx("summary",{children:s("settings.license.supportDetails","Support details")}),e.jsx("p",{children:s(`settings.license.action.${c}`,"Use this support ID to investigate the request.")}),e.jsx("p",{children:[o.code,o.category,o.stage].filter(Boolean).join(" · ")}),e.jsxs("label",{children:[s("settings.license.supportReference","Support ID"),e.jsx("input",{readOnly:!0,value:n,onFocus:f=>f.currentTarget.select()})]}),o.persistence==="unavailable"&&e.jsx("p",{children:s("settings.license.persistenceUnavailable","Local storage failed; this session keeps the current access decision.")}),!o.serverTraceAvailable&&e.jsx("p",{children:s("settings.license.localReference","Local request only; no server trace was received.")})]})}function Le(){const[t,s]=r.useState();return r.useEffect(()=>{let o=!1,c=!1;async function n(){var i,g;if(!c){c=!0;try{const p=await fetch("/api/platform/status",{cache:"no-store"});if(!p.ok)return;const b=await p.json();o||s(le(b.diagnostic??((g=(i=b.auth)==null?void 0:i.usage)==null?void 0:g.diagnostic)))}catch{}finally{c=!1}}}n();const f=setInterval(()=>{n()},1e4);return()=>{o=!0,clearInterval(f)}},[]),e.jsx(he,{value:t})}const Re="_card_jz1ya_4",we="_cardEmbedded_jz1ya_14",He="_cardTitle_jz1ya_21",Be="_storageConsoleGrid_jz1ya_31",Ae="_storageUsageColumn_jz1ya_38",De="_storagePolicyColumn_jz1ya_39",$e="_usageRow_jz1ya_44",Me="_usageTotal_jz1ya_50",ze="_usageBreakdown_jz1ya_57",Ee="_usageCounts_jz1ya_63",Te="_storageFooter_jz1ya_70",Ie="_lastRunRow_jz1ya_79",Ue="_lastRunLabel_jz1ya_89",Fe="_errorIcon_jz1ya_95",Oe="_tooltip_jz1ya_103",qe="_cleanupRow_jz1ya_126",Ge="_cleanupLabel_jz1ya_133",We="_cleanupBtn_jz1ya_140",Ye="_cleanupBtnDanger_jz1ya_169",Ke="_retentionSection_jz1ya_182",Ve="_retentionTitle_jz1ya_188",Je="_retentionFieldset_jz1ya_196",Qe="_proOverlay_jz1ya_211",Ze="_modeSegments_jz1ya_223",Xe="_radioLabel_jz1ya_244",et="_radioLabelActive_jz1ya_265",tt="_presetGroup_jz1ya_279",st="_presetBtn_jz1ya_287",at="_presetBtnActive_jz1ya_310",it="_freeInput_jz1ya_317",nt="_inputError_jz1ya_334",ot="_inputUnit_jz1ya_338",rt="_cascadeRow_jz1ya_345",lt="_retentionActions_jz1ya_361",ct="_saveBtn_jz1ya_367",dt="_runNowBtn_jz1ya_395",ut="_errorMsg_jz1ya_439",pt="_freeInputHitArea_jz1ya_501",l={card:Re,cardEmbedded:we,cardTitle:He,storageConsoleGrid:Be,storageUsageColumn:Ae,storagePolicyColumn:De,usageRow:$e,usageTotal:Me,usageBreakdown:ze,usageCounts:Ee,storageFooter:Te,lastRunRow:Ie,lastRunLabel:Ue,errorIcon:Fe,tooltip:Oe,cleanupRow:qe,cleanupLabel:Ge,cleanupBtn:We,cleanupBtnDanger:Ye,retentionSection:Ke,retentionTitle:Ve,retentionFieldset:Je,proOverlay:Qe,modeSegments:Ze,radioLabel:Xe,radioLabelActive:et,presetGroup:tt,presetBtn:st,presetBtnActive:at,freeInput:it,inputError:nt,inputUnit:ot,cascadeRow:rt,retentionActions:lt,saveBtn:ct,runNowBtn:dt,errorMsg:ut,freeInputHitArea:pt};function gt(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 ie(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 ht(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 mt({placeId:t,tier:s,currentPolicy:o,onSaved:c}){const{t:n}=K(),{trackEvent:f}=ce(),[i,g]=r.useState(o),[p,b]=r.useState(()=>[7,14,30,90].includes(o.ageDays??-1)?"":String(o.ageDays??30)),[S,k]=r.useState(()=>[100,500,1e3].includes(o.sizeMb??-1)?"":String(o.sizeMb??500)),[P,M]=r.useState(null),[x,v]=r.useState(!1),[z,w]=r.useState(!1),[y,H]=r.useState(!1),[L,D]=r.useState(null);r.useEffect(()=>{g(o);const h=[7,14,30,90],A=[100,500,1e3];b(h.includes(o.ageDays??-1)?"":String(o.ageDays??30)),k(A.includes(o.sizeMb??-1)?"":String(o.sizeMb??500))},[o]);const $=s==="basic",_=ie(i),j=ht(o,i),E=_&&!j&&!z,C=h=>{g(A=>{const O={...A,mode:h};return h==="age"&&(O.ageDays=parseInt(p,10)||30),h==="size"&&(O.sizeMb=parseInt(S,10)||500),O})},B=h=>{b(""),g(A=>({...A,ageDays:h}))},U=h=>{k(""),g(A=>({...A,sizeMb:h}))},F=h=>{b(h);const A=parseInt(h,10);Number.isNaN(A)||g(O=>({...O,ageDays:A}))},d=h=>{k(h);const A=parseInt(h,10);Number.isNaN(A)||g(O=>({...O,sizeMb:A}))},T=async()=>{if(D(null),f("dashboard_click_event",{click_target:"ui_studio_cleanup_save",page:"settings"}),gt(o,i)){try{const h=await pe(t,{mode:i.mode,ageDays:i.ageDays,sizeMb:i.sizeMb,cascadeSnapshots:i.cascadeSnapshots});M(h.dryRun),v(!0)}catch(h){D(h.message)}return}await W()},W=async()=>{w(!0);try{await ke(t,i),v(!1),c()}catch(h){throw D(h.message),h}finally{w(!1)}},u=async()=>{D(null),f("dashboard_click_event",{click_target:"ui_studio_cleanup_run_now",page:"settings"}),H(!0);try{await _e(t),c()}catch(h){D(h.message)}finally{H(!1)}},N=P?`${n("uiStudio.cleanup.policy.confirm.messageStrict","이 정책으로 즉시")} ${P.wouldRemoveRequests}${n("uiStudio.cleanup.policy.confirm.requests","건")} / ${P.wouldRemoveSnapshots}${n("uiStudio.cleanup.policy.confirm.snapshots","개 화면 캡처")} / ${Y(P.wouldFreeBytes)} ${n("uiStudio.cleanup.policy.confirm.freed","가 삭제됩니다 — 적용?")}`:"",V=i.mode==="age"&&!ie(i),G=i.mode==="size"&&!ie(i);return e.jsxs("div",{className:l.retentionSection,children:[e.jsx("h3",{className:l.retentionTitle,children:e.jsx(R,{label:n("uiStudio.cleanup.policy.title","자동 삭제 정책"),tooltip:n("uiStudio.cleanup.policy.title.tooltip","Rules that automatically remove old or large captures.")})}),e.jsxs("div",{style:{position:"relative"},children:[$&&e.jsx("div",{className:l.proOverlay,title:n("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능"),children:e.jsx("div",{className:l.tooltip,children:n("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능")})}),e.jsxs("fieldset",{className:l.retentionFieldset,disabled:$,"aria-label":n("uiStudio.cleanup.policy.title","자동 삭제 정책"),style:$?{opacity:.45,pointerEvents:"none"}:void 0,children:[e.jsxs("div",{className:l.modeSegments,"data-testid":"cleanup-mode-segments",children:[e.jsx(m,{text:n("uiStudio.cleanup.policy.modeOff.tooltip","Turn off auto-cleanup. Data stays until you remove it manually."),children:e.jsxs("label",{className:`${l.radioLabel} ${i.mode==="off"?l.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"off",checked:i.mode==="off",onChange:()=>C("off")}),n("uiStudio.cleanup.policy.modeOff","사용 안 함 (off)")]})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.modeAge.tooltip","Automatically delete data older than the configured number of days."),children:e.jsxs("label",{className:`${l.radioLabel} ${i.mode==="age"?l.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"age",checked:i.mode==="age",onChange:()=>C("age")}),n("uiStudio.cleanup.policy.modeAge","기간 기반 (age)")]})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.modeSize.tooltip","When total usage exceeds the limit, the oldest data is removed first."),children:e.jsxs("label",{className:`${l.radioLabel} ${i.mode==="size"?l.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"size",checked:i.mode==="size",onChange:()=>C("size")}),n("uiStudio.cleanup.policy.modeSize","용량 기반 (size)")]})})]}),i.mode==="age"&&e.jsxs("div",{className:l.presetGroup,children:[[7,14,30,90].map(h=>e.jsx(m,{text:n("uiStudio.cleanup.policy.agePreset.tooltip","Delete data older than this many days."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${i.ageDays===h&&p===""?l.presetBtnActive:""}`,onClick:()=>B(h),children:[h,n("uiStudio.cleanup.policy.daysUnit","일")]})},h)),e.jsx(m,{text:n("uiStudio.cleanup.policy.ageInput.tooltip","Enter any value between 1 and 365 days."),children:e.jsx("label",{className:l.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${l.freeInput} ${V?l.inputError:""}`,value:p,min:1,max:365,onChange:h=>F(h.target.value)})})}),e.jsxs("span",{className:l.inputUnit,children:["1–365",n("uiStudio.cleanup.policy.daysUnit","일")]})]}),i.mode==="size"&&e.jsxs("div",{className:l.presetGroup,children:[[100,500,1e3].map(h=>e.jsx(m,{text:n("uiStudio.cleanup.policy.sizePreset.tooltip","Keep total usage under this size."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${i.sizeMb===h&&S===""?l.presetBtnActive:""}`,onClick:()=>U(h),children:[h,n("uiStudio.cleanup.policy.mbUnit","MB")]})},h)),e.jsx(m,{text:n("uiStudio.cleanup.policy.sizeInput.tooltip","Enter any value between 50 MB and 10000 MB (10 GB)."),children:e.jsx("label",{className:l.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${l.freeInput} ${G?l.inputError:""}`,value:S,min:50,max:1e4,onChange:h=>d(h.target.value)})})}),e.jsxs("span",{className:l.inputUnit,children:["50–10000",n("uiStudio.cleanup.policy.mbUnit","MB")]})]}),e.jsx(m,{text:n("uiStudio.cleanup.policy.cascade.tooltip","Also delete the capture images linked to those records. If off, the images stay."),children:e.jsxs("label",{className:l.cascadeRow,children:[e.jsx(Se,{checked:i.cascadeSnapshots,onChange:h=>g(A=>({...A,cascadeSnapshots:h.target.checked}))}),n("uiStudio.cleanup.policy.cascade","연결된 화면 캡처도 함께 삭제")]})}),e.jsxs("div",{className:l.retentionActions,children:[e.jsx(m,{text:n("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:l.saveBtn,onClick:()=>void T(),disabled:!E,children:n("uiStudio.cleanup.policy.save","정책 저장")})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.runNow.tooltip","저장된 정리 정책을 다음 자동 실행까지 기다리지 않고 지금 한 번 실행합니다."),children:e.jsx("button",{type:"button",className:l.runNowBtn,onClick:()=>void u(),disabled:y,children:n("uiStudio.cleanup.policy.runNow","저장된 정책으로 정리")})})]}),L&&e.jsx("div",{className:l.errorMsg,children:L})]})]}),x&&P&&e.jsx(ue,{title:n("uiStudio.cleanup.policy.confirm.title","정책 적용 확인"),message:N,danger:!0,confirmLabel:n("uiStudio.cleanup.policy.save","정책 저장"),busy:z,onConfirm:W,onClose:()=>v(!1)})]})}function yt({placeId:t,tier:s,onChanged:o,sampleUsage:c,sampleRetention:n,embedded:f=!1}){const{t:i}=K(),g=s==="basic"&&c!=null&&n!=null,[p,b]=r.useState(g?c:null),[S,k]=r.useState(g?n:null),[P,M]=r.useState(null),[x,v]=r.useState(null),[z,w]=r.useState(null),y=r.useCallback(async()=>{if(!g&&t!=null){M(null);try{const[C,B]=await Promise.all([ge(t),pe(t)]);b(C),k(B.policy)}catch(C){M(C.message)}}},[t,g]);r.useEffect(()=>{y()},[y]);const H=r.useCallback(()=>{y(),o==null||o()},[y,o]),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}),v(null),y(),o==null||o()}catch(C){throw w(C.message),C}}},[x,t,y,o]);function D(C){const B=i("uiStudio.cleanup.studioPreservedNote","This deletes saved change records and screenshots on disk only; Roblox Studio instances are not affected.");return C.kind==="keep7"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep7","7일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:C.kind==="keep30"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep30","30일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:`${((p==null?void 0:p.requestCount)??0)+((p==null?void 0:p.snapshotCount)??0)}${i("uiStudio.cleanup.cleanupConfirmMessage.all","개의 저장된 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`}if(t==null&&!g)return null;if(P)return e.jsx("div",{className:`${l.card} ${f?l.cardEmbedded:""}`,children:e.jsx("p",{className:l.errorMsg,children:P})});if(!p||!S)return e.jsx("div",{className:`${l.card} ${f?l.cardEmbedded:""}`,children:e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:0},children:i("uiStudio.storage.loading","로딩 중...")})});const $=S.lastRunAt,_=S.lastRunStats,j=$?new Date($).toLocaleString():null,E=t??0;return e.jsxs("div",{className:`${l.card} ${f?l.cardEmbedded:""}`,children:[!f&&e.jsx("h3",{className:l.cardTitle,children:e.jsx(R,{label:i("uiStudio.storage.title","UI Studio 저장 데이터"),tooltip:i("uiStudio.storage.title.tooltip","Disk usage of UI Studio change records and screenshots.")})}),e.jsxs("div",{className:l.storageConsoleGrid,"data-testid":"ui-studio-storage-console-grid",children:[e.jsx("section",{className:l.storageUsageColumn,children:e.jsxs("div",{className:l.usageRow,children:[e.jsx(m,{text:i("uiStudio.storage.usageLabel.tooltip","Disk space currently used by UI Studio for this project."),children:e.jsxs("div",{className:l.usageTotal,children:[i("uiStudio.storage.usageLabel","사용 중")," ",Y(p.totalBytes)]})}),e.jsxs("div",{className:l.usageBreakdown,children:[e.jsx(m,{text:i("uiStudio.storage.historyBytes.tooltip","Space taken by change record data (JSON)."),children:e.jsxs("span",{children:[i("uiStudio.storage.historyBytes","변경 이력")," ",Y(p.historyBytes)]})})," · ",e.jsx(m,{text:i("uiStudio.storage.snapshotBytes.tooltip","Space taken by captured PNG image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotBytes","화면 캡처")," ",Y(p.snapshotBytes)]})})]}),e.jsxs("div",{className:l.usageCounts,children:[e.jsx(m,{text:i("uiStudio.storage.requestCount.tooltip","Number of actions where AI changed the UI."),children:e.jsxs("span",{children:[i("uiStudio.storage.requestCount","변경 기록")," ",p.requestCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:i("uiStudio.storage.mutationCount.tooltip","Number of detail changes inside actions (one property edit = 1)."),children:e.jsxs("span",{children:[i("uiStudio.storage.mutationCount","변경 상세")," ",p.mutationCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:i("uiStudio.storage.snapshotCount.tooltip","Number of saved capture image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotCount","화면 캡처")," ",p.snapshotCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})]})]})}),e.jsx("section",{className:l.storagePolicyColumn,children:e.jsx(mt,{placeId:E,tier:s,currentPolicy:S,onSaved:H})})]}),e.jsxs("div",{className:l.storageFooter,"data-testid":"ui-studio-storage-footer",children:[e.jsxs("div",{className:l.lastRunRow,children:[e.jsx("span",{className:l.lastRunLabel,children:e.jsx(R,{label:i("uiStudio.storage.lastRun","마지막 자동 정리"),tooltip:i("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}),_&&e.jsxs("span",{children:["· ",i("uiStudio.storage.requestCount","변경 기록")," ",_.removedRequests,i("uiStudio.storage.countSuffix","개")," / ",i("uiStudio.storage.snapshotCount","화면 캡처")," ",_.removedSnapshots,i("uiStudio.storage.countSuffix","개")," / ",Y(_.freedBytes)," ",i("uiStudio.storage.lastRunFreed","회수")]}),_&&_.errors>0&&e.jsxs("span",{className:l.errorIcon,title:`${i("uiStudio.storage.lastRunErrors","오류")} ${_.errors}건`,children:["⚠",e.jsxs("span",{className:l.tooltip,children:[i("uiStudio.storage.lastRunErrors","오류")," ",_.errors,i("uiStudio.storage.countSuffix","건")]})]})]}):e.jsx("span",{children:i("uiStudio.storage.lastRunNever","—")})]}),e.jsxs("div",{className:l.cleanupRow,children:[e.jsx("span",{className:l.cleanupLabel,children:e.jsx(R,{label:i("uiStudio.cleanup.label","수동 정리"),tooltip:i("uiStudio.cleanup.label.tooltip","Manually clean up change records and captures whenever you want.")})}),e.jsx(m,{text:i("uiStudio.cleanup.keep7.tooltip","Delete change records and captures older than 7 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>v({kind:"keep7"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 7일만 남기기").replace("{n}","7")})}),e.jsx(m,{text:i("uiStudio.cleanup.keep30.tooltip","Delete change records and captures older than 30 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>v({kind:"keep30"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 30일만 남기기").replace("{n}","30")})}),!f&&e.jsx(m,{text:i("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:`${l.cleanupBtn} ${l.cleanupBtnDanger}`,onClick:()=>v({kind:"all"}),disabled:s==="basic",children:i("uiStudio.cleanup.deleteAll","전체 삭제…")})})]})]}),z&&e.jsx("div",{className:l.errorMsg,children:z}),x&&e.jsx(ue,{title:i("uiStudio.cleanup.cleanupConfirmTitle","정리 확인"),message:D(x),danger:!0,confirmLabel:i("common.delete","삭제"),onConfirm:L,onClose:()=>{v(null),w(null)}})]})}function ne(t,s){const o={placeId:String(t)};return s&&(o["preview.mode"]=s.mode,s.mode==="size"&&(o["preview.sizeMb"]=String(s.sizeMb))),I.get("/api/dashboard/changelog/cleanup",o)}function oe(t){return I.put("/api/dashboard/changelog/cleanup",t)}function jt(t){return I.post(`/api/dashboard/changelog/cleanup/run?placeId=${encodeURIComponent(t)}`)}const ft=[100,500,1e3];function re(t,s){return t.mode!==s.mode?!1:t.mode==="off"||s.mode==="size"&&t.sizeMb===s.sizeMb}function xt(t,s){return t.mode==="off"?!1:s.mode==="off"||t.sizeMb<s.sizeMb}function Q(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 vt({placeId:t,onChanged:s}){const{locale:o,t:c}=K(),[n,f]=r.useState(null),[i,g]=r.useState({mode:"size",sizeMb:500}),[p,b]=r.useState(t!==null),[S,k]=r.useState(!1),[P,M]=r.useState(!1),[x,v]=r.useState(!1),[z,w]=r.useState(!1),[y,H]=r.useState(null),L=r.useCallback(async()=>{if(t===null){f(null),b(!1);return}M(!1);try{const u=await ne(t);f(u),g(u.policy)}catch{M(!0)}finally{b(!1)}},[t]);r.useEffect(()=>{b(t!==null),L()},[L,t]);const D=r.useCallback(async u=>{k(!0),v(!1),w(!1);try{await oe(u),H(null),await L(),w(!0),s==null||s()}catch{v(!0)}finally{k(!1)}},[L,s]),$=r.useCallback(async()=>{if(!(!n||t===null||re(i,n.policy))){k(!0),v(!1),w(!1);try{if(xt(i,n.policy)){const u=await ne(t,i);if(u.preview.affectedPlaceCount>0){H({policy:i,preview:u});return}}await oe(i),await L(),w(!0),s==null||s()}catch{v(!0)}finally{k(!1)}}},[n,i,L,s,t]),_=r.useCallback(async()=>{if(t!==null){k(!0),v(!1),w(!1);try{await jt(t),await L(),s==null||s()}catch{v(!0)}finally{k(!1)}}},[L,s,t]),j=n==null?void 0:n.selectedPlace.currentUsage,E=(n==null?void 0:n.policy.mode)==="size"?n.policy.sizeMb*1e6:null,C=E??Math.max((j==null?void 0:j.bytes)??0,1),B=Math.min(100,((j==null?void 0:j.sessionBytes)??0)/C*100),U=Math.min(Math.max(0,100-B),((j==null?void 0:j.contextBytes)??0)/C*100),F=n?!re(i,n.policy):!1,d=u=>u.mode==="off"?c("settings.projectChanges.cleanup.unlimited","Unlimited"):`${u.sizeMb} MB`,T=r.useMemo(()=>{if(!y)return"";const u=y.preview.preview,N=c("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}",Q(u.estimatedFreedBytes));return u.wouldRemainOverLimitPlaceCount===0?N:`${N} ${c("settings.projectChanges.cleanup.confirm.protected","{places} Place may remain over the limit because active data is protected.").replace("{places}",u.wouldRemainOverLimitPlaceCount.toLocaleString())}`},[y,c]);if(t===null)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:c("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:c("settings.projectChanges.cleanup.loading","Loading storage settings…")})});if(P||!n||!j)return e.jsxs("div",{className:a.projectChangesPanel,children:[e.jsx("p",{className:a.projectChangesError,role:"alert",children:c("settings.projectChanges.cleanup.loadFailed","Could not load storage settings.")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",onClick:()=>{b(!0),L()},children:c("common.retry","Retry")})]});const W=E===null?c("settings.projectChanges.cleanup.usageUnlimited","{used} used · Unlimited").replace("{used}",Q(j.bytes)):c("settings.projectChanges.cleanup.usageLimited","{used} used of {limit}").replace("{used}",Q(j.bytes)).replace("{limit}",d(n.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:c("settings.projectChanges.cleanup.title","Storage management"),tooltip:c("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":c("settings.projectChanges.cleanup.usageAria","Place storage usage"),"aria-valuemin":0,"aria-valuenow":j.bytes,"aria-valuemax":E??j.bytes,children:[e.jsx("span",{className:a.projectChangesSessionRail,style:{width:`${B}%`}}),e.jsx("span",{className:a.projectChangesContextRail,style:{width:`${U}%`}})]}),e.jsxs("div",{className:a.projectChangesUsageLegend,children:[e.jsxs("span",{children:[c("settings.projectChanges.cleanup.sessions","Sessions")," ",e.jsx("strong",{children:Q(j.sessionBytes)})]}),e.jsxs("span",{children:[c("settings.projectChanges.cleanup.contexts","Contexts")," ",e.jsx("strong",{children:Q(j.contextBytes)})]})]})]})]}),e.jsxs("section",{className:a.projectChangesPolicyColumn,children:[e.jsx("p",{className:a.projectChangesScope,children:c("settings.projectChanges.cleanup.scope","One setting applies the selected limit separately to every Place.")}),e.jsxs("fieldset",{className:a.projectChangesPolicyFieldset,disabled:S,children:[e.jsx("legend",{className:a.projectChangesPolicyLegend,children:c("settings.projectChanges.cleanup.limit","Limit per Place")}),e.jsxs("div",{className:a.projectChangesPresetGroup,children:[ft.map(u=>{const N=i.mode==="size"&&i.sizeMb===u;return e.jsx("button",{className:`${a.projectChangesPresetButton} ${N?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":N,onClick:()=>g({mode:"size",sizeMb:u}),children:c("settings.projectChanges.cleanup.preset","{sizeMb}MB").replace("{sizeMb}",String(u))},u)}),e.jsx("button",{className:`${a.projectChangesPresetButton} ${i.mode==="off"?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":i.mode==="off",onClick:()=>g({mode:"off"}),children:c("settings.projectChanges.cleanup.unlimited","Unlimited")})]})]}),e.jsxs("div",{className:a.projectChangesActions,children:[e.jsx("button",{className:a.projectChangesSaveButton,type:"button",disabled:!F||S,onClick:()=>void $(),children:c("common.save","Save")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",disabled:S,onClick:()=>void _(),children:c("settings.projectChanges.cleanup.runNow","Run saved policy")}),z&&e.jsx("span",{className:a.projectChangesSaved,role:"status",children:c("settings.projectChanges.cleanup.saved","Saved")})]})]})]}),n.selectedPlace.dryRun.wouldRemainOverLimit&&e.jsx("p",{className:a.projectChangesWarning,children:c("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:c("settings.projectChanges.cleanup.lastRun","Last cleanup")}),n.selectedPlace.lastRun?e.jsxs("span",{children:[new Date(n.selectedPlace.lastRun.ranAt).toLocaleString(o)," · ",c("settings.projectChanges.cleanup.lastRunSummary","{sessions} sessions · {bytes} freed").replace("{sessions}",n.selectedPlace.lastRun.deletedSessionCount.toLocaleString()).replace("{bytes}",Q(n.selectedPlace.lastRun.freedBytes))]}):e.jsx("span",{children:c("settings.projectChanges.cleanup.neverRun","Not run yet")})]}),x&&e.jsx("p",{className:a.projectChangesError,role:"alert",children:c("settings.projectChanges.cleanup.actionFailed","Could not update storage settings.")}),e.jsx(de,{open:y!==null,title:c("settings.projectChanges.cleanup.confirm.title","Apply this limit and clean saved changes?"),message:T,cancelLabel:c("common.cancel","Cancel"),confirmLabel:c("settings.projectChanges.cleanup.confirm.apply","Apply and clean"),loading:S,onCancel:()=>!S&&H(null),onConfirm:()=>{y&&D(y.policy)}})]})}const bt={toolsActivity:null,toolStats:null,toolSessions:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null},St={toolsActivity:null,toolStats:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null};function Ct(t){var s;return t?t.pluginConnected?t.activePlaceId:t.lastActivePlaceId??((s=t.places[0])==null?void 0:s.placeId)??null:null}async function q(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,o,c){return s===null?t("settings.dataHistory.metric.unavailable","Unavailable"):`${s.toLocaleString()} ${t(o,c)}`}function Z(t,s,o){const c=o===null?t("settings.dataHistory.metric.sizeUnavailable","size unavailable"):Y(o);return`${s} · ${c}`}function X(t,s){var c;const o=(c=t==null?void 0:t[s])==null?void 0:c.bytes;return typeof o=="number"&&Number.isFinite(o)?o:null}function Nt(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 _t({tier:t}){const{t:s}=K(),[o,c]=r.useState(bt),[n,f]=r.useState(St),[i,g]=r.useState(t==="basic"?ae:null),[p,b]=r.useState(null),[S,k]=r.useState(!0),[P,M]=r.useState(!0),[x,v]=r.useState(null),[z,w]=r.useState(()=>new Set),[y,H]=r.useState(null),[L,D]=r.useState(!1),[$,_]=r.useState(null),j=r.useCallback(async()=>{k(!0);const u=await q(je()),N=Ct(u);b(N);const[V,G,h,A,O,me,J]=await Promise.all([q(I.get("/api/dashboard/history",{limit:"1",offset:"0"})),q(I.get("/api/dashboard/tool-stats")),q(I.get("/sync/history",{limit:"1",offset:"0"})),q(I.get("/api/dashboard/playtest/history")),q(I.get("/api/dashboard/changelog",{limit:"1",offset:"0"})),q(I.get("/api/dashboard/connection-log")),q(I.get("/api/dashboard/storage-summary"))]),ye=t==="basic"?ae:N===null?null:await q(ge(N));c({toolsActivity:ee(V),toolStats:(G==null?void 0:G.totalCalls)??null,toolSessions:(G==null?void 0:G.totalSessions)??null,syncLog:ee(h),playtestReports:ee(A),projectChanges:ee(O),connectionLog:ee(me)}),f({toolsActivity:X(J,"toolsActivity"),toolStats:X(J,"toolStats"),syncLog:X(J,"syncLog"),playtestReports:X(J,"playtestReports"),projectChanges:X(J,"projectChanges"),connectionLog:X(J,"connectionLog")}),g(ye),k(!1)},[t]);r.useEffect(()=>{j()},[j]);const E=r.useCallback(u=>{w(N=>{if(N.has(u))return N;const V=new Set(N);return V.add(u),V}),v(N=>N===u?null:u)},[]),C=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:Z(s,te(s,o.toolsActivity,"settings.dataHistory.metric.records","records"),n.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:Z(s,o.toolStats===null?s("settings.dataHistory.metric.unavailable","Unavailable"):`${o.toolStats.toLocaleString()} ${s("settings.dataHistory.metric.runs","runs")} · ${(o.toolSessions??0).toLocaleString()} ${s("settings.dataHistory.metric.sessions","sessions")}`,n.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:Z(s,te(s,o.syncLog,"settings.dataHistory.metric.records","records"),n.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:Z(s,te(s,o.playtestReports,"settings.dataHistory.metric.reports","reports"),n.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:Z(s,te(s,o.projectChanges,"settings.dataHistory.metric.records","records"),n.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:Z(s,te(s,o.connectionLog,"settings.dataHistory.metric.records","records"),n.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"}],[o,n,s]),B=async()=>{if(y){D(!0),_(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}),_(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 N=y.row.clearEndpoint;u&&p!==null&&(N=`${N}?placeId=${encodeURIComponent(p)}`),await I.post(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{_(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{D(!1)}}},U=t==="pro"?p:0,F=t==="pro"&&p!==null,d=(y==null?void 0:y.kind)==="uiStudio",T=(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:S?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:()=>M(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:[C.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:()=>E("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"&&z.has("projectChanges")&&e.jsx("div",{id:"settings-project-changes-storage",className:`${a.dataHistoryDetail} ${a.projectChangesDataHistoryDetail}`,hidden:x!=="projectChanges",children:e.jsx(vt,{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:Nt(s,i)})}),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:()=>E("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")})})]})]}),z.has("uiStudio")&&e.jsx("div",{id:"settings-ui-studio-storage",className:`${a.dataHistoryDetail} ${a.uiStudioDataHistoryDetail}`,hidden:x!=="uiStudio",children:e.jsx(yt,{placeId:U,tier:t,onChanged:j,embedded:!0,...t==="basic"?{sampleUsage:ae,sampleRetention:Pe}:{}})})]}),$&&e.jsx("p",{className:a.inlineStatus,children:$})]})]}),e.jsx(de,{open:y!==null,title:d?s("settings.dataHistory.uiStudio.clear.title","Clear UI Studio saved data?"):T?s("settings.dataHistory.projectChanges.clear.title","Clear project change summaries?"):s("settings.dataHistory.clear.title","Clear saved data?"),message:d?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."):T?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:T||d?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear"),loading:L,onCancel:()=>!L&&H(null),onConfirm:()=>void B()})]})}const kt=r.forwardRef(function({autoOpen:s,settingsFilePath:o,saving:c,targeted:n,updateDashboardPreferences:f},i){const{t:g}=K(),[p,b]=r.useState("idle"),S="settings-dashboard-auto-open-label",k=c||p==="saving",P=async x=>{b("saving");try{await f({autoOpen:x}),b("saved")}catch{b("error")}},M=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:i,tabIndex:-1,"data-testid":"settings-dashboard-card",className:[a.card,a.dashboardCard,n?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:S,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":S,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:o})})]}),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:M})]})}),Pt={en:"English",ko:"한국어",es:"Español","pt-br":"Português (BR)",ja:"日本語",id:"Bahasa Indonesia",de:"Deutsch","fr-fr":"Français"};function Lt(t){return t==="active"?a.statusActive:t==="grace"?a.statusGrace:t==="invalid"||t==="revoked"?a.statusError:a.statusInactive}function Rt(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 wt(t,s){return t.provisional?{label:t.tier==="pro"?s("settings.license.provisional","Temporary Pro access"):s("settings.license.verificationRequired","Verification required"),tooltip:s("settings.license.provisionalHint","Verification is pending. Temporary access keeps its original expiry."),detail:`${t.graceUntil?new Date(t.graceUntil*1e3).toLocaleString():""}${t.provisional.persistence==="unavailable"?` · ${s("settings.license.persistenceUnavailable","Available in this session; local storage failed.")}`:""}`,detailTone:a.licenseNoticeWarning}: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 Tt(){const{t,selectedLocale:s,setLocale:o}=K(),{trackEvent:c}=ce(),{search:n}=fe(),{settings:f,license:i,licenseControlsDisabled:g,licenseSubmitting:p,licenseMessage:b,activateLicense:S,refreshLicense:k,resetLicense:P,saving:M,updateDashboardPreferences:x,loading:v}=Ne(),[z,w]=r.useState(""),y=i?wt(i,t):null,H=Rt(i),L=H&&(i==null?void 0:i.refreshBlockedReason)!=="missing_session_token",D=H,$=H?i==null?void 0:i.maskedKey:void 0,_=i!=null&&i.provider&&i.provider!=="auto"?i.provider:void 0,j=(i==null?void 0:i.tier)==="pro"?"pro":"basic",E=r.useRef(null),C=r.useRef(null),B=r.useRef(null),U=r.useMemo(()=>new URLSearchParams(n).get("section")==="license",[n]),F=r.useMemo(()=>new URLSearchParams(n).get("section")==="dashboard",[n]);return r.useEffect(()=>{var T;if(!U||v)return;const d=E.current;if((T=d==null?void 0:d.scrollIntoView)==null||T.call(d,{block:"start",behavior:"smooth"}),B.current&&!B.current.disabled){B.current.focus();return}d==null||d.focus()},[v,g,p,U]),r.useEffect(()=>{var T;if(!F||v)return;const d=C.current;(T=d==null?void 0:d.scrollIntoView)==null||T.call(d,{block:"start",behavior:"smooth"}),d==null||d.focus()},[v,F]),v?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(Ce,{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:E,tabIndex:-1,"data-testid":"settings-license-card",className:[a.card,U?a.licenseCardTarget:"",(i==null?void 0:i.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:[i?e.jsxs(e.Fragment,{children:[(()=>{const d=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} ${Lt(i.status)}`}),e.jsx(m,{text:(d==null?void 0:d.tooltip)??t(`settings.license.${i.status}.tooltip`,"Current license activation state."),children:(d==null?void 0:d.label)??t(`settings.license.${i.status}`,i.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:i.tier==="pro"?a.proBadge:"",children:e.jsx(m,{text:t(`tier.${i.tier}.tooltip`,"Available feature set for the connected license."),children:i.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:$})})]}),_&&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:_})})]})]}),(d==null?void 0:d.detail)&&e.jsx("p",{className:`${a.licenseNotice} ${d.detailTone}`,children:i.refreshBlockedReason==="missing_session_token"?t("settings.license.detail.manualActivation","Manual activation required to restore Pro access."):d.detail}),i.refreshBlockedReason==="missing_session_token"&&e.jsx("p",{className:`${a.licenseNotice} ${a.licenseNoticeMuted}`,children:d==null?void 0:d.detail})]})})(),i.tier==="basic"&&e.jsx(m,{text:t("tier.upgrade.tooltip","View Pro features and purchase options."),children:e.jsx("a",{className:a.upgradeLink,href:xe.settingsLicense,target:"_blank",rel:"noopener noreferrer",onClick:()=>c("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||!D,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:z,disabled:g||p,onChange:d=>w(d.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 S(z)&&w(""))()},children:p?t("common.loading"):t("settings.license.activate","Activate License")})})]}),b&&e.jsx("p",{className:a.licenseMessage,children:b}),e.jsx(he,{value:i==null?void 0:i.diagnostic}),e.jsx(Le,{})]})]})]}),e.jsx(_t,{tier:j}),f&&e.jsx(kt,{ref:C,autoOpen:f.dashboard.autoOpen,settingsFilePath:f.dashboard.settingsFilePath,saving:M,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")})})]}),f?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:f.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:f.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:d=>o(d.target.value),children:[e.jsx("option",{value:ve,children:t("settings.language.auto","Auto")}),be.map(d=>e.jsx("option",{value:d,children:Pt[d]??d},d))]})})]})]})]})}export{Tt as Component};
@@ -1 +1 @@
1
- import{r as l,b as z,h as ne,D as fe,u as ie,j as e,a as _e,d as Se,e as ve,k as xe,T as je}from"./index-B1SnAt0o.js";import{B as H,a as J,P as we}from"./PageHeader-QiUV3oJs.js";import{I as Z}from"./InfoLabel-DfinjjFO.js";import{T as O}from"./TooltipText-x86NSn8t.js";import{C as pe}from"./ConfirmModal-D2yw01tT.js";import{T as Ne}from"./TierPromoPanel-DWTUB0jD.js";import"./ConfirmModal.module-DJksQHBd.js";const be=5e3,W={report:null,loading:!1,applying:!1,error:null};function Ie(t,a){if(a===null)return null;const _=t.filter(i=>i.placeId===a);return _.length===1?_[0]:a===0?null:_.find(i=>i.folderStatus==="canonical")??null}function ye(t,a){if(a===null||!Number.isSafeInteger(a)||a<0)return!1;const _=t.filter(i=>i.placeId===a);return a===0?_.length===1:_.length===0||_.some(i=>i.folderStatus==="canonical")}function oe(t,a){return a.placeId<=0||!Number.isSafeInteger(a.placeId)?!1:ye(t,a.placeId)&&(a.folderStatus==="canonical"||t.filter(_=>_.placeId===a.placeId).length===1)}function Re(){const[t,a]=l.useState([]),[_,i]=l.useState(null),[d,n]=l.useState(null),[N,R]=l.useState(!0),[D,j]=l.useState(null),[b,g]=l.useState([]),[C,u]=l.useState(!1),[A,E]=l.useState(null),[p,y]=l.useState(W),c=l.useRef(0),h=l.useRef(0),L=l.useRef(null),G=l.useRef(!1),B=l.useRef(null),U=l.useRef(0),q=l.useRef(null),M=l.useRef(new Set),$=l.useCallback(async()=>{const o=++c.current;try{const[f,m]=await Promise.all([z.get("/api/dashboard/sync/targets"),z.get("/api/dashboard/place-summary")]);if(o!==c.current)return;a(f.targets??[]),i(m),j(null)}catch(f){if(o!==c.current)return;a([]),i(null),j(f instanceof Error?f.message:String(f))}finally{o===c.current&&R(!1)}},[]),k=l.useMemo(()=>(_==null?void 0:_.places)??[],[_]),Q=l.useMemo(()=>new Set(t.map(o=>o.placeId).filter(o=>typeof o=="number")),[t]),K=l.useMemo(()=>k.filter(o=>o.placeId===0||!Q.has(o.placeId)),[Q,k]);l.useEffect(()=>{N||D||n(o=>{if((o==null?void 0:o.kind)==="target"&&t.some(m=>m.clientId===o.clientId)||(o==null?void 0:o.kind)==="stored"&&K.some(m=>m.placeId===o.placeId&&m.placeDirName===o.placeDirName&&oe(k,m)))return o;if(t[0])return{kind:"target",clientId:t[0].clientId};const f=K.find(m=>oe(k,m));return f?{kind:"stored",placeId:f.placeId,placeDirName:f.placeDirName}:null})},[N,k,D,K,t]);const Y=(d==null?void 0:d.kind)==="target"?t.find(o=>o.clientId===d.clientId)??null:null,v=(Y==null?void 0:Y.placeId)??((d==null?void 0:d.kind)==="stored"?d.placeId:null),X=(d==null?void 0:d.kind)==="stored"?K.find(o=>o.placeId===d.placeId&&o.placeDirName===d.placeDirName)??null:Ie(k,v),w=(d==null?void 0:d.kind)==="stored"?X!==null&&oe(k,X):ye(k,v),V=(d==null?void 0:d.kind)==="target"?`target:${d.clientId}:${v??"none"}`:(d==null?void 0:d.kind)==="stored"?`stored:${d.placeDirName}`:null;L.current=v,G.current=w,B.current=V;const r=p.applying||V!==null&&M.current.has(V),x=l.useCallback(async(o,f=!1)=>{var F,te;if(o===null){y(W);return}const m=B.current;if(m!==null&&M.current.has(m)||((F=q.current)==null?void 0:F.key)===m)return;const S=++U.current;q.current={key:m,id:S},y(T=>{var se;return f&&((se=T.report)==null?void 0:se.status)==="not_required"?T:{...T,loading:!0,error:null,progress:null}});const P=()=>S===U.current&&m===B.current&&!(m!==null&&M.current.has(m));try{const T=await z.get("/api/sync/migration",{placeId:String(o)});if(!P())return;y({...W,report:T,error:T.status==="blocked"?"migration_blocked":null})}catch(T){if(!P())return;T instanceof ne&&(T.status===404||T.status===503)?y(W):y(se=>({...se,loading:!1,progress:null,error:T instanceof ne&&T.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}finally{((te=q.current)==null?void 0:te.id)===S&&(q.current=null)}},[]),I=l.useCallback(async(o,f,m=!1)=>{const S=++h.current;if(m||(g([]),E(null)),o===null||!f){u(!1),y(W);return}m||u(!0);const P=z.get("/api/dashboard/sync/history",{placeId:String(o),limit:"30"}).then(F=>{S===h.current&&(g(F.entries??[]),E(null))}).catch(F=>{S===h.current&&E(F instanceof Error?F.message:String(F))}).finally(()=>{S===h.current&&u(!1)});await Promise.all([P,x(o,m)])},[x]);l.useEffect(()=>(U.current+=1,q.current=null,y(W),I(v,w),()=>{h.current+=1,U.current+=1}),[I,v,w,(d==null?void 0:d.kind)==="target"?d.clientId:d==null?void 0:d.placeDirName]);const ee=l.useCallback(()=>{$(),I(v,w)},[I,$,v,w]),ue=l.useCallback(async()=>{w&&await x(v)},[x,v,w]),ge=l.useCallback(async()=>{var m;const o=p.report;if(!o||o.status!=="ready"||p.loading||p.applying||!w||o.placeId!==v)return;const f=B.current;if(!(f===null||M.current.has(f))&&((m=q.current)==null?void 0:m.key)!==f){M.current.add(f),U.current+=1,y(S=>({...S,loading:!1,applying:!0,error:null,progress:null}));try{const S=await z.post("/api/sync/migration",{placeId:o.placeId,fromVersion:2,previewFingerprint:o.previewFingerprint,apply:!0});if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;y({...W,report:S}),$()}catch(S){if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;if(S instanceof ne&&S.status===409&&(S.error==="preview_stale"||S.error==="migration_blocked")){if(await x(o.placeId),B.current!==f||L.current!==o.placeId)return;y(P=>({...P,applying:!1,error:S.error}))}else y(P=>({...P,applying:!1,progress:null,error:S instanceof ne&&S.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}}},[x,$,p,v,w]);l.useEffect(()=>{if(!p.loading&&!r||v===null||!w)return;let o=!1,f;const m=V,S=async()=>{var P;try{const F=await z.get("/api/sync/migration/progress",{placeId:String(v)});!o&&B.current===m&&((P=F.progress)==null?void 0:P.placeId)===v&&y(te=>({...te,progress:F.progress}))}catch{}finally{o||(f=setTimeout(()=>void S(),1e3))}};return S(),()=>{o=!0,f&&clearTimeout(f)}},[p.loading,r,v,V,w]);const he=l.useCallback(async o=>{if((await z.post(`/api/dashboard/sync/history/clear?placeId=${encodeURIComponent(String(o))}`)).placeId!==o)throw new Error("Cleared Place differs from the confirmed Place.");L.current===o&&G.current&&I(o,!0)},[I]);l.useEffect(()=>{$();const o=()=>{$(),L.current!==null&&G.current&&I(L.current,!0,!0)},f=setInterval(o,be),m=new fe;m.connect();const S=m.on("sync",o),P=m.on("connection",o);return()=>{clearInterval(f),S(),P(),m.disconnect(),c.current+=1}},[I,$]);const me=p.report&&p.report.placeId!==v?W:{...p,applying:r};return{targets:t,places:k,selection:d,selectedTarget:Y,selectedPlace:X,selectedPlaceId:v,storageSafe:w,history:b,historyLoading:C,historyError:A,loading:N,snapshotError:D,migration:me,selectTarget:o=>n({kind:"target",clientId:o}),selectStored:o=>n({kind:"stored",placeId:o.placeId,placeDirName:o.placeDirName}),refresh:ee,refreshMigration:ue,applyMigration:ge,clearHistory:he}}const ke="_page_1hoev_2",Pe="_detailsStack_1hoev_9",De="_refreshButton_1hoev_15",Ce="_targetRow_1hoev_29",Ee="_storedRow_1hoev_30",Le="_storedDisclosure_1hoev_31",Te="_targetList_1hoev_33",Ae="_storedList_1hoev_33",Be="_targetRowSelected_1hoev_53",Me="_targetIdentity_1hoev_54",Fe="_targetStudio_1hoev_54",Oe="_targetState_1hoev_54",$e="_stateNote_1hoev_57",He="_selectedScope_1hoev_94",Ue="_sharedNote_1hoev_109",qe="_emptyMessage_1hoev_109",Ve="_errorMessage_1hoev_110",We="_card_1hoev_113",Ge="_cardHeader_1hoev_120",Ke="_clearButton_1hoev_132",Ye="_statusRow_1hoev_158",ze="_metaItem_1hoev_165",Xe="_statusGrid_1hoev_171",Ze="_forwardStatusReason_1hoev_191",Je="_migrationPanel_1hoev_199",Qe="_migrationHeader_1hoev_206",et="_migrationTitle_1hoev_213",tt="_migrationDescription_1hoev_222",st="_migrationLedger_1hoev_230",nt="_migrationLedgerItem_1hoev_237",ot="_migrationLedgerBlocked_1hoev_262",at="_migrationSection_1hoev_266",it="_migrationList_1hoev_280",rt="_migrationRow_1hoev_292",ct="_migrationOperation_1hoev_305",lt="_migrationRowBody_1hoev_310",dt="_migrationNotice_1hoev_331",pt="_migrationActions_1hoev_340",yt="_migrationButton_1hoev_346",ut="_migrationError_1hoev_353",gt="_migrationDisclosure_1hoev_354",ht="_migrationPagination_1hoev_356",mt="_migrationProgressHeading_1hoev_356",ft="_migrationProgressMeta_1hoev_356",_t="_migrationProgress_1hoev_356",St="_policySummary_1hoev_403",vt="_policySummaryItem_1hoev_414",xt="_policyPrimaryValue_1hoev_439",jt="_policyReviewNotice_1hoev_445",wt="_policyApplySection_1hoev_456",Nt="_policyApplyHeader_1hoev_460",bt="_policyApplyTitle_1hoev_464",It="_policyApplyDescription_1hoev_472",Rt="_policyInfoLabel_1hoev_480",kt="_policySafetyRow_1hoev_491",Pt="_policySafetyLabel_1hoev_503",Dt="_policySafetyBadge_1hoev_509",Ct="_policyDisclosure_1hoev_513",Et="_policyDisclosureIcon_1hoev_545",Lt="_policyDisclosureIconOpen_1hoev_552",Tt="_policyScopeList_1hoev_556",At="_policyScopeRow_1hoev_563",Bt="_policyScopeName_1hoev_577",Mt="_policyDirectionRail_1hoev_589",Ft="_policyDirectionEndpoint_1hoev_605",Ot="_policyDirectionEndpointStudio_1hoev_612",$t="_policyDirectionArrow_1hoev_616",Ht="_forwardBadge_1hoev_659",Ut="_logContainer_1hoev_674",qt="_logEntry_1hoev_681",Vt="_logTime_1hoev_693",Wt="_logType_1hoev_699",Gt="_logTypeWrite_1hoev_708",Kt="_logTypeUpdate_1hoev_712",Yt="_logTypeDelete_1hoev_716",zt="_logTypeIdle_1hoev_720",Xt="_logPath_1hoev_724",Zt="_logEmpty_1hoev_731",s={page:ke,detailsStack:Pe,refreshButton:De,targetRow:Ce,storedRow:Ee,storedDisclosure:Le,targetList:Te,storedList:Ae,targetRowSelected:Be,targetIdentity:Me,targetStudio:Fe,targetState:Oe,stateNote:$e,selectedScope:He,sharedNote:Ue,emptyMessage:qe,errorMessage:Ve,card:We,cardHeader:Ge,clearButton:Ke,statusRow:Ye,metaItem:ze,statusGrid:Xe,forwardStatusReason:Ze,migrationPanel:Je,migrationHeader:Qe,migrationTitle:et,migrationDescription:tt,migrationLedger:st,migrationLedgerItem:nt,migrationLedgerBlocked:ot,migrationSection:at,migrationList:it,migrationRow:rt,migrationOperation:ct,migrationRowBody:lt,migrationNotice:dt,migrationActions:pt,migrationButton:yt,migrationError:ut,migrationDisclosure:gt,migrationPagination:ht,migrationProgressHeading:mt,migrationProgressMeta:ft,migrationProgress:_t,policySummary:St,policySummaryItem:vt,policyPrimaryValue:xt,policyReviewNotice:jt,policyApplySection:wt,policyApplyHeader:Nt,policyApplyTitle:bt,policyApplyDescription:It,policyInfoLabel:Rt,policySafetyRow:kt,policySafetyLabel:Pt,policySafetyBadge:Dt,policyDisclosure:Ct,policyDisclosureIcon:Et,policyDisclosureIconOpen:Lt,policyScopeList:Tt,policyScopeRow:At,policyScopeName:Bt,policyDirectionRail:Mt,policyDirectionEndpoint:Ft,policyDirectionEndpointStudio:Ot,policyDirectionArrow:$t,forwardBadge:Ht,logContainer:Ut,logEntry:qt,logTime:Vt,logType:Wt,logTypeWrite:Gt,logTypeUpdate:Kt,logTypeDelete:Yt,logTypeIdle:zt,logPath:Xt,logEmpty:Zt},ae=50;function Jt(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function re({title:t,items:a,renderItem:_}){const{t:i}=ie(),d=l.useId(),n=l.useRef(null),[N,R]=l.useState(!1),[D,j]=l.useState(0),b=Math.max(0,Math.ceil(a.length/ae)-1),g=Math.min(D,b),C=g*ae,u=Math.min(C+ae,a.length),A=E=>{var p,y;j(E),(y=(p=n.current)==null?void 0:p.scrollTo)==null||y.call(p,{top:0})};return e.jsxs("div",{className:s.migrationSection,children:[e.jsxs(J,{variant:"ghost",className:s.migrationDisclosure,"aria-expanded":N,"aria-controls":d,onClick:()=>R(!N),children:[e.jsxs("span",{children:[t," (",a.length.toLocaleString(),")"]}),e.jsx("span",{"aria-hidden":"true",children:N?"−":"+"})]}),e.jsx("div",{id:d,hidden:!N,children:N&&e.jsxs("div",{children:[e.jsx("ul",{ref:n,className:s.migrationList,tabIndex:0,"aria-label":t,children:a.slice(C,u).map((E,p)=>_(E,C+p))}),e.jsxs("div",{className:s.migrationPagination,children:[e.jsxs("span",{children:[C+1,"–",u," / ",a.length.toLocaleString()]}),b>0&&e.jsxs("div",{children:[e.jsx(J,{variant:"secondary",disabled:g===0,onClick:()=>A(g-1),children:i("sync.migration.previous","Previous")}),e.jsx(J,{variant:"secondary",disabled:g===b,onClick:()=>A(g+1),children:i("sync.migration.next","Next")})]})]})]},g)})]})}function Qt({migration:t,onRefresh:a,onApply:_}){const{t:i}=ie(),[d,n]=l.useState(!1),[N,R]=l.useState(0),D=l.useRef(null),j=!!(t!=null&&t.loading||t!=null&&t.applying),b=t==null?void 0:t.progress,g=(b==null?void 0:b.status)==="running"&&b.operation===(t!=null&&t.applying?"apply":"preview")?b:null,C=g==null?void 0:g.startedAt;l.useEffect(()=>{if(!j){R(0);return}const c=C?Date.parse(C):Date.now(),h=()=>R(Math.max(0,Math.floor((Date.now()-c)/1e3)));h();const L=setInterval(h,1e3);return()=>clearInterval(L)},[j,C]);const u=t==null?void 0:t.report;if(!t||(u==null?void 0:u.status)==="not_required"||!u&&!j&&!t.error)return null;const A=(u==null?void 0:u.status)==="blocked",E=(u==null?void 0:u.status)==="ready"&&!j,p=()=>{n(!1),_(),requestAnimationFrame(()=>{var c;return(c=D.current)==null?void 0:c.focus()})},y=[...new Set((u==null?void 0:u.blockers.map(c=>c.reason))??[])];return e.jsxs("section",{ref:D,tabIndex:-1,className:`${s.card} ${s.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:s.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:s.migrationTitle,children:u?i("sync.migration.title","Sync format update available"):i("sync.migration.checking","Checking sync format")}),e.jsx("p",{className:s.migrationDescription,children:i("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),u&&e.jsx(H,{variant:A?"warning":"accent",children:j?t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…"):A?i("sync.migration.status.blocked","Blocked"):i("sync.migration.status.ready","Ready to review")})]}),u&&e.jsx("div",{className:s.migrationLedger,"aria-label":i("sync.migration.preview","Review changes"),children:["add","modify","delete","blocked"].map(c=>e.jsxs("div",{className:`${s.migrationLedgerItem} ${c==="blocked"&&A?s.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:i(`sync.migration.summary.${c}`,c)}),e.jsx("strong",{children:u.summary[c].toLocaleString()})]},c))}),j&&e.jsxs("div",{className:s.migrationProgress,children:[e.jsxs("div",{role:"status",className:s.migrationProgressHeading,children:[e.jsx("span",{children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…")}),g&&e.jsx("span",{children:i(`sync.migration.phase.${g.phase}`,g.phase)})]}),e.jsx("progress",{"aria-label":i("sync.migration.progress","Update progress"),...g!=null&&g.total&&g.total>0?{value:g.completed,max:g.total}:{}}),e.jsxs("div",{className:s.migrationProgressMeta,children:[e.jsx("span",{"aria-live":"off",children:i("sync.migration.elapsed","Elapsed {seconds}s").replace("{seconds}",String(N))}),(g==null?void 0:g.total)!==null&&(g==null?void 0:g.total)!==void 0&&e.jsxs("span",{children:[g.completed.toLocaleString()," / ",g.total.toLocaleString()]})]}),e.jsx("p",{children:i("sync.migration.wait","Large places can take a while. You can keep browsing while this runs.")})]}),e.jsxs("div",{className:s.migrationNotice,"aria-live":"polite",children:[(A||t.error==="migration_blocked")&&e.jsx("span",{children:i("sync.migration.blocked","Resolve sync conflicts before updating")}),y.map(c=>e.jsx("span",{children:i(`sync.migration.reason.${c}`,c.replace(/_/g," "))},c)),t.error==="preview_stale"&&e.jsx("span",{children:i("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="migration_in_progress"&&e.jsx("span",{children:i("sync.migration.inProgress","An update is already running for this place. Wait, then refresh the preview.")}),t.error==="unknown"&&e.jsx("span",{className:s.migrationError,children:i("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:s.migrationActions,children:[e.jsx(J,{variant:"secondary",className:s.migrationButton,disabled:j,onClick:()=>void a(),children:t.loading?i("sync.migration.refreshing","Refreshing…"):i("sync.migration.refresh","Refresh preview")}),u&&e.jsx(J,{variant:"primary",className:s.migrationButton,disabled:!E,onClick:()=>n(!0),children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.apply","Apply update")})]}),u&&u.changes.length>0&&e.jsx(re,{title:i("sync.migration.changes","Metadata changes"),items:u.changes,renderItem:c=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:Jt(c.operation),className:s.migrationOperation,children:i(`sync.migration.operation.${c.operation}`,c.operation)}),e.jsxs("div",{className:s.migrationRowBody,children:[e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.operation}:${c.path}`)}),u&&u.blockers.length>0&&e.jsx(re,{title:i("sync.migration.blockers","Items to resolve"),items:u.blockers,renderItem:(c,h)=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:"warning",className:s.migrationOperation,children:i("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:s.migrationRowBody,children:[c.path&&e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.reason}:${c.path??h}`)}),e.jsx(pe,{open:d,title:i("sync.migration.confirm.title","Apply sync format update?"),message:i("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:i("common.cancel","Cancel"),confirmLabel:i("sync.migration.apply","Apply update"),onCancel:()=>n(!1),onConfirm:p})]})}const es=["scriptSource","properties","structure","serviceProperties"];function ts(t){const a=new Date(t);return`${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}function ss(t){switch(t){case"fullSyncComplete":case"write":return s.logTypeWrite;case"fullSyncStart":case"fullSyncProgress":case"update":return s.logTypeUpdate;case"fullSyncFailed":case"delete":return s.logTypeDelete;default:return s.logTypeIdle}}const ce={unknown:"neutral",off:"neutral",idle:"neutral",initializing:"info",syncing:"success",paused:"warning",error:"error"},le={unknown:"Unknown",off:"Sync OFF",idle:"Waiting",initializing:"Initializing",syncing:"Syncing",paused:"Paused",error:"Error"},ns={inactive:"Change sending off",active:"Change sending enabled",paused_play:"Paused for Play",reconciling:"Checking Edit changes",blocked:"Changes need attention",unknown:"Sending status unknown"},os={inactive:"neutral",active:"success",paused_play:"warning",reconciling:"info",blocked:"error",unknown:"neutral"};function as(t,a){switch(a){case"conflict_review":case"manual_review":return t("sync.forwardStatus.reason.review","Review changes in the Studio Plugin.");case"edit_changed_during_reconciliation":return t("sync.forwardStatus.reason.editChanged","Edit changed during the check. Inspect Sync in the Studio Plugin.");case"pre_check_failed":case"reverse_apply_failed":case"reconciliation_failed":case"sync_error":case"update_failed":case"acknowledgement_missing":case"ACK_EXPIRED":case"ACK_ID_REUSED":case"SYNC_DIRECTION_REVERSE":return t("sync.forwardStatus.reason.failed","Changes could not be confirmed. Inspect Sync in the Studio Plugin.");default:return t("sync.forwardStatus.reason.fallback","Check the Studio Plugin for details.")}}function is(t,a){const _={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${a}`,_[a])}function de(t,a){return a==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function rs(t,a){const _={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${a}`,_[a])}function cs(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function ls(t,a){const _={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.${a}.tooltip`,_[a])}function ds(t,a){return a?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function ps(t,a){return a?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 ys(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart","START");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress","PROGRESS");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete","COMPLETE");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed","FAILED");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 us(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart.tooltip","Full Sync started.");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress.tooltip","Full Sync is saving the snapshot.");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete.tooltip","Full Sync completed successfully.");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed.tooltip","Full Sync ended without completing the snapshot.");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 xs(){var K,Y,v,X,w,V;const{t}=ie(),{trackEvent:a}=_e(),{level:_}=Se(),{tier:i,loading:d}=ve(),n=Re(),{show:N}=xe(),[R,D]=l.useState(null),[j,b]=l.useState(!1),[g,C]=l.useState(!1),[u,A]=l.useState(!1),E=!d&&i==="basic",p=n.selectedTarget,y=p==null?void 0:p.sync,c=(y==null?void 0:y.forwardSyncStatus)??"unknown",h=p?{...p.sync.status,syncEnabled:p.sync.syncEnabled,policy:p.sync.policy,policyCapabilities:p.sync.policyCapabilities,policyReviewRequired:p.sync.policyReviewRequired}:null,L=(p==null?void 0:p.placeName)??((K=n.selectedPlace)==null?void 0:K.placeName)??t("sync.targets.unknownPlace","Unknown place"),G=n.selectedPlaceId===null?L:L+" · "+n.selectedPlaceId,B=n.storageSafe?(h==null?void 0:h.instanceCount)??((Y=n.selectedPlace)==null?void 0:Y.instanceCount):null,U=n.storageSafe?(h==null?void 0:h.scriptCount)??((v=n.selectedPlace)==null?void 0:v.scriptCount):null,q=new Set(n.targets.map(r=>r.placeId)),M=n.places.filter(r=>r.placeId===0||!q.has(r.placeId)),$=e.jsx(we,{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:_,tier:i}}),k=n.history,Q=async()=>{if(R){b(!0);try{await n.clearHistory(R.placeId),N(t("toast.clearSuccess","Cleared successfully"),"success"),D(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{b(!1)}}};return e.jsxs("div",{className:s.page,children:[$,e.jsxs("section",{className:s.card,"aria-label":t("sync.targets.title","Connected Studios"),children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.targets.title","Connected Studios")," (",n.targets.length,")"]}),e.jsx("button",{type:"button",className:s.refreshButton,onClick:n.refresh,children:t("sync.targets.refresh","Refresh")})]}),n.loading?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.loading","Loading Studio Sync status…")}):n.snapshotError?e.jsxs("p",{className:s.errorMessage,role:"alert",children:[t("sync.targets.unavailable","Studio Sync status is unavailable. Retry to check the current state.")," ",n.snapshotError]}):n.targets.length===0?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.empty","No Studio is connected. Connect the WEPPY Plugin to see live Sync status.")}):e.jsx("div",{className:s.targetList,children:n.targets.map(r=>{var I;const x=((I=n.selection)==null?void 0:I.kind)==="target"&&n.selection.clientId===r.clientId;return e.jsxs("button",{type:"button",className:`${s.targetRow} ${x?s.targetRowSelected:""}`,"aria-pressed":x,onClick:()=>n.selectTarget(r.clientId),children:[e.jsxs("span",{className:s.targetIdentity,children:[e.jsx(O,{text:r.placeName||t("sync.targets.unknownPlace","Unknown place"),children:e.jsx("strong",{children:r.placeName||t("sync.targets.unknownPlace","Unknown place")})}),e.jsxs("span",{children:[t("sync.targets.placeId","Place ID"),": ",r.placeId??"—"]})]}),e.jsxs("span",{className:s.targetStudio,children:[e.jsx(O,{text:r.clientId,children:e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",r.targetAlias]})}),e.jsx("span",{children:t("sync.targets.connected","Connected")})]}),e.jsxs("span",{className:s.targetState,children:[e.jsx(H,{variant:ce[r.sync.state],shape:"pill",children:t("sync.targets.state."+r.sync.state,le[r.sync.state])}),r.sync.syncEnabled===null&&e.jsx("span",{className:s.stateNote,children:t("sync.targets.notReported","Not reported yet")})]})]},r.clientId)})})]}),M.length>0&&e.jsxs("section",{className:s.card,"aria-label":t("sync.stored.title","Stored places"),children:[e.jsxs("button",{type:"button",className:s.storedDisclosure,"aria-expanded":u,onClick:()=>A(r=>!r),children:[e.jsxs("span",{children:[t("sync.stored.title","Stored places")," (",M.length,")"]}),e.jsx("span",{"aria-hidden":"true",children:u?"⌃":"⌄"})]}),u&&e.jsx("div",{className:s.storedList,children:M.map(r=>{var ee;const x=oe(n.places,r),I=((ee=n.selection)==null?void 0:ee.kind)==="stored"&&n.selection.placeDirName===r.placeDirName;return e.jsxs("button",{type:"button",className:`${s.storedRow} ${I?s.targetRowSelected:""}`,disabled:!x,"aria-pressed":I,onClick:()=>n.selectStored(r),children:[e.jsxs("span",{children:[r.placeName," · ",r.placeId]}),e.jsx("span",{children:x?t("sync.stored.data","Stored data"):t("sync.stored.ambiguous","Storage location unconfirmed")})]},r.placeDirName)})})]}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.selectedScope,children:[e.jsx("span",{children:t("sync.detail.scope","Viewing Sync details for")}),e.jsx("strong",{children:G}),p&&e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",p.targetAlias]}),e.jsx("span",{children:t("sync.detail.readOnly","Viewing details does not change Studio routing.")})]}),!n.selection&&!n.loading&&!n.snapshotError&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.empty","Select a connected Studio or stored place to view details.")}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.detailsStack,children:[e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx(O,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),E&&e.jsx(O,{text:t("sync.status.forwardOnly.tooltip","Basic tier allows Studio to local forward sync only."),children:e.jsx("span",{className:s.forwardBadge,children:t("sync.status.forwardOnly","Forward Only")})})]}),e.jsxs("div",{className:s.statusRow,children:[y?e.jsx(H,{variant:ce[y.state],shape:"pill",children:t("sync.targets.state."+y.state,le[y.state])}):e.jsx(H,{variant:"neutral",shape:"pill",children:t("sync.stored.data","Stored data")}),e.jsx("span",{className:s.metaItem,children:G})]}),(y==null?void 0:y.state)==="unknown"&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.unknown","This Studio has not reported its Sync state yet.")}),(y==null?void 0:y.state)==="error"&&e.jsx("p",{className:s.errorMessage,role:"alert",children:t("sync.detail.error","Sync reported an error. Check the Studio Plugin for details.")}),e.jsxs("dl",{className:s.statusGrid,children:[p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.forwardStatus.label","Change sending"),tooltip:t("sync.forwardStatus.tooltip","This reports whether Edit changes can be sent. Enabled does not confirm every local file is current.")})}),e.jsxs("dd",{children:[e.jsx(H,{variant:os[c],shape:"pill",children:t("sync.forwardStatus."+c,ns[c])}),c==="blocked"&&e.jsx("span",{className:s.forwardStatusReason,children:as(t,y==null?void 0:y.forwardSyncReason)})]}),(y==null?void 0:y.forwardSyncObservedAt)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.forwardStatus.observedAt","Observed")}),e.jsx("dd",{children:new Date(y.forwardSyncObservedAt).toLocaleString()})]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.targets.studioId","Studio ID")}),e.jsx("dd",{children:p.targetAlias}),e.jsx("dt",{children:t("sync.targets.connectionId","Connection ID")}),e.jsx("dd",{children:p.clientId})]}),(h==null?void 0:h.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:h.syncRoot})]}),((X=n.selectedPlace)==null?void 0:X.placeDirName)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.detail.placeFolder","Place folder"),tooltip:t("sync.detail.placeFolder.tooltip","The stored folder shared by Studios opening this Place.")})}),e.jsx("dd",{children:n.selectedPlace.placeDirName})]}),B!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:B})]}),U!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:U})]})]}),e.jsx("p",{className:s.sharedNote,children:t("sync.detail.sharedData","Path, counts, and log belong to the Place and are shared by Studios opening it.")})]}),n.storageSafe&&e.jsx(Qt,{migration:n.migration,onRefresh:n.refreshMigration,onApply:n.applyMigration},[n.selection.kind==="target"?n.selection.clientId:n.selection.placeDirName,n.selectedPlaceId,(V=(w=n.migration)==null?void 0:w.report)==null?void 0:V.previewFingerprint].join(":")),(h==null?void 0:h.policy)&&e.jsxs("div",{className:s.card,children:[e.jsx("div",{className:s.cardHeader,children:e.jsx(O,{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:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(H,{variant:h.syncEnabled?"success":"neutral",children:h.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:s.policyPrimaryValue,children:is(t,h.policy.preset)})]})]}),h.policyReviewRequired&&e.jsx("div",{className:s.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:s.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:s.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:s.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:s.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{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:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.contentChanges)})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{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:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:s.policySafetyRow,children:[e.jsx("span",{className:s.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(O,{text:ps(t,h.policy.autoApplyLocalDeletesToStudio),children:e.jsx(H,{variant:h.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:s.policySafetyBadge,tabIndex:0,children:ds(t,h.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:s.policyDisclosure,"aria-expanded":g,"aria-controls":"sync-policy-scope-panel",onClick:()=>C(r=>!r),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${s.policyDisclosureIcon} ${g?s.policyDisclosureIconOpen:""}`,children:"⌄"})]}),g&&e.jsx("div",{id:"sync-policy-scope-panel",className:s.policyScopeList,children:es.map(r=>{const x=h.policy.directions[r];return e.jsxs("div",{className:s.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:s.policyScopeName,children:t(`sync.policy.scope.${r}`,r)}),e.jsx(O,{text:ls(t,x),children:e.jsxs("span",{className:s.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":rs(t,x),tabIndex:0,children:[e.jsx("span",{className:s.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:s.policyDirectionArrow,"aria-hidden":"true",children:cs(x)}),e.jsx("span",{className:`${s.policyDirectionEndpoint} ${s.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},r)})})]}),e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.log.title","Sync Log")," · ",t("sync.log.shared","Shared Place log")]}),e.jsx("button",{className:s.clearButton,type:"button",disabled:!n.storageSafe||n.selectedPlaceId===null,onClick:()=>{n.selectedPlaceId!==null&&(a("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),D({placeId:n.selectedPlaceId,label:G}))},children:t("common.clear","Clear")})]}),e.jsx("div",{className:s.logContainer,children:n.storageSafe?n.historyError?e.jsxs("div",{className:s.errorMessage,role:"alert",children:[t("sync.log.unavailable","The Place log could not be loaded. Retry to check it.")," ",n.historyError]}):n.historyLoading&&k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.loading","Loading Place log…")}):k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.empty","No sync events yet")}):k.map((r,x)=>e.jsxs("div",{className:s.logEntry,children:[e.jsx("span",{className:s.logTime,children:ts(r.timestamp)}),e.jsx(O,{text:us(t,r.type),children:e.jsx("span",{className:`${s.logType} ${ss(r.type)}`,children:ys(t,r.type)})}),e.jsxs("span",{className:s.logPath,children:[r.path,r.details?` — ${r.details}`:""]})]},x)):e.jsx("div",{className:s.logEmpty,children:t("sync.log.unsafe","This Place has no confirmed storage location for log access.")})})]}),E&&e.jsx(Ne,{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:je.sync})]}),e.jsx(pe,{open:R!==null,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.selectedMessage","This permanently removes the shared Sync log for {place}.").replace("{place}",(R==null?void 0:R.label)??""),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:j,onCancel:()=>!j&&D(null),onConfirm:Q})]})}export{xs as Component};
1
+ import{r as l,b as z,h as ne,D as fe,u as ie,j as e,a as _e,d as Se,e as ve,k as xe,T as je}from"./index-DOEmzpkJ.js";import{B as H,a as J,P as we}from"./PageHeader-DJRyLHjf.js";import{I as Z}from"./InfoLabel-ZcP_cIQR.js";import{T as O}from"./TooltipText-3t8YedaH.js";import{C as pe}from"./ConfirmModal-Bs6DRyDJ.js";import{T as Ne}from"./TierPromoPanel-BKRqAd84.js";import"./ConfirmModal.module-DJksQHBd.js";const be=5e3,W={report:null,loading:!1,applying:!1,error:null};function Ie(t,a){if(a===null)return null;const _=t.filter(i=>i.placeId===a);return _.length===1?_[0]:a===0?null:_.find(i=>i.folderStatus==="canonical")??null}function ye(t,a){if(a===null||!Number.isSafeInteger(a)||a<0)return!1;const _=t.filter(i=>i.placeId===a);return a===0?_.length===1:_.length===0||_.some(i=>i.folderStatus==="canonical")}function oe(t,a){return a.placeId<=0||!Number.isSafeInteger(a.placeId)?!1:ye(t,a.placeId)&&(a.folderStatus==="canonical"||t.filter(_=>_.placeId===a.placeId).length===1)}function Re(){const[t,a]=l.useState([]),[_,i]=l.useState(null),[d,n]=l.useState(null),[N,R]=l.useState(!0),[D,j]=l.useState(null),[b,g]=l.useState([]),[C,u]=l.useState(!1),[A,E]=l.useState(null),[p,y]=l.useState(W),c=l.useRef(0),h=l.useRef(0),L=l.useRef(null),G=l.useRef(!1),B=l.useRef(null),U=l.useRef(0),q=l.useRef(null),M=l.useRef(new Set),$=l.useCallback(async()=>{const o=++c.current;try{const[f,m]=await Promise.all([z.get("/api/dashboard/sync/targets"),z.get("/api/dashboard/place-summary")]);if(o!==c.current)return;a(f.targets??[]),i(m),j(null)}catch(f){if(o!==c.current)return;a([]),i(null),j(f instanceof Error?f.message:String(f))}finally{o===c.current&&R(!1)}},[]),k=l.useMemo(()=>(_==null?void 0:_.places)??[],[_]),Q=l.useMemo(()=>new Set(t.map(o=>o.placeId).filter(o=>typeof o=="number")),[t]),K=l.useMemo(()=>k.filter(o=>o.placeId===0||!Q.has(o.placeId)),[Q,k]);l.useEffect(()=>{N||D||n(o=>{if((o==null?void 0:o.kind)==="target"&&t.some(m=>m.clientId===o.clientId)||(o==null?void 0:o.kind)==="stored"&&K.some(m=>m.placeId===o.placeId&&m.placeDirName===o.placeDirName&&oe(k,m)))return o;if(t[0])return{kind:"target",clientId:t[0].clientId};const f=K.find(m=>oe(k,m));return f?{kind:"stored",placeId:f.placeId,placeDirName:f.placeDirName}:null})},[N,k,D,K,t]);const Y=(d==null?void 0:d.kind)==="target"?t.find(o=>o.clientId===d.clientId)??null:null,v=(Y==null?void 0:Y.placeId)??((d==null?void 0:d.kind)==="stored"?d.placeId:null),X=(d==null?void 0:d.kind)==="stored"?K.find(o=>o.placeId===d.placeId&&o.placeDirName===d.placeDirName)??null:Ie(k,v),w=(d==null?void 0:d.kind)==="stored"?X!==null&&oe(k,X):ye(k,v),V=(d==null?void 0:d.kind)==="target"?`target:${d.clientId}:${v??"none"}`:(d==null?void 0:d.kind)==="stored"?`stored:${d.placeDirName}`:null;L.current=v,G.current=w,B.current=V;const r=p.applying||V!==null&&M.current.has(V),x=l.useCallback(async(o,f=!1)=>{var F,te;if(o===null){y(W);return}const m=B.current;if(m!==null&&M.current.has(m)||((F=q.current)==null?void 0:F.key)===m)return;const S=++U.current;q.current={key:m,id:S},y(T=>{var se;return f&&((se=T.report)==null?void 0:se.status)==="not_required"?T:{...T,loading:!0,error:null,progress:null}});const P=()=>S===U.current&&m===B.current&&!(m!==null&&M.current.has(m));try{const T=await z.get("/api/sync/migration",{placeId:String(o)});if(!P())return;y({...W,report:T,error:T.status==="blocked"?"migration_blocked":null})}catch(T){if(!P())return;T instanceof ne&&(T.status===404||T.status===503)?y(W):y(se=>({...se,loading:!1,progress:null,error:T instanceof ne&&T.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}finally{((te=q.current)==null?void 0:te.id)===S&&(q.current=null)}},[]),I=l.useCallback(async(o,f,m=!1)=>{const S=++h.current;if(m||(g([]),E(null)),o===null||!f){u(!1),y(W);return}m||u(!0);const P=z.get("/api/dashboard/sync/history",{placeId:String(o),limit:"30"}).then(F=>{S===h.current&&(g(F.entries??[]),E(null))}).catch(F=>{S===h.current&&E(F instanceof Error?F.message:String(F))}).finally(()=>{S===h.current&&u(!1)});await Promise.all([P,x(o,m)])},[x]);l.useEffect(()=>(U.current+=1,q.current=null,y(W),I(v,w),()=>{h.current+=1,U.current+=1}),[I,v,w,(d==null?void 0:d.kind)==="target"?d.clientId:d==null?void 0:d.placeDirName]);const ee=l.useCallback(()=>{$(),I(v,w)},[I,$,v,w]),ue=l.useCallback(async()=>{w&&await x(v)},[x,v,w]),ge=l.useCallback(async()=>{var m;const o=p.report;if(!o||o.status!=="ready"||p.loading||p.applying||!w||o.placeId!==v)return;const f=B.current;if(!(f===null||M.current.has(f))&&((m=q.current)==null?void 0:m.key)!==f){M.current.add(f),U.current+=1,y(S=>({...S,loading:!1,applying:!0,error:null,progress:null}));try{const S=await z.post("/api/sync/migration",{placeId:o.placeId,fromVersion:2,previewFingerprint:o.previewFingerprint,apply:!0});if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;y({...W,report:S}),$()}catch(S){if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;if(S instanceof ne&&S.status===409&&(S.error==="preview_stale"||S.error==="migration_blocked")){if(await x(o.placeId),B.current!==f||L.current!==o.placeId)return;y(P=>({...P,applying:!1,error:S.error}))}else y(P=>({...P,applying:!1,progress:null,error:S instanceof ne&&S.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}}},[x,$,p,v,w]);l.useEffect(()=>{if(!p.loading&&!r||v===null||!w)return;let o=!1,f;const m=V,S=async()=>{var P;try{const F=await z.get("/api/sync/migration/progress",{placeId:String(v)});!o&&B.current===m&&((P=F.progress)==null?void 0:P.placeId)===v&&y(te=>({...te,progress:F.progress}))}catch{}finally{o||(f=setTimeout(()=>void S(),1e3))}};return S(),()=>{o=!0,f&&clearTimeout(f)}},[p.loading,r,v,V,w]);const he=l.useCallback(async o=>{if((await z.post(`/api/dashboard/sync/history/clear?placeId=${encodeURIComponent(String(o))}`)).placeId!==o)throw new Error("Cleared Place differs from the confirmed Place.");L.current===o&&G.current&&I(o,!0)},[I]);l.useEffect(()=>{$();const o=()=>{$(),L.current!==null&&G.current&&I(L.current,!0,!0)},f=setInterval(o,be),m=new fe;m.connect();const S=m.on("sync",o),P=m.on("connection",o);return()=>{clearInterval(f),S(),P(),m.disconnect(),c.current+=1}},[I,$]);const me=p.report&&p.report.placeId!==v?W:{...p,applying:r};return{targets:t,places:k,selection:d,selectedTarget:Y,selectedPlace:X,selectedPlaceId:v,storageSafe:w,history:b,historyLoading:C,historyError:A,loading:N,snapshotError:D,migration:me,selectTarget:o=>n({kind:"target",clientId:o}),selectStored:o=>n({kind:"stored",placeId:o.placeId,placeDirName:o.placeDirName}),refresh:ee,refreshMigration:ue,applyMigration:ge,clearHistory:he}}const ke="_page_1hoev_2",Pe="_detailsStack_1hoev_9",De="_refreshButton_1hoev_15",Ce="_targetRow_1hoev_29",Ee="_storedRow_1hoev_30",Le="_storedDisclosure_1hoev_31",Te="_targetList_1hoev_33",Ae="_storedList_1hoev_33",Be="_targetRowSelected_1hoev_53",Me="_targetIdentity_1hoev_54",Fe="_targetStudio_1hoev_54",Oe="_targetState_1hoev_54",$e="_stateNote_1hoev_57",He="_selectedScope_1hoev_94",Ue="_sharedNote_1hoev_109",qe="_emptyMessage_1hoev_109",Ve="_errorMessage_1hoev_110",We="_card_1hoev_113",Ge="_cardHeader_1hoev_120",Ke="_clearButton_1hoev_132",Ye="_statusRow_1hoev_158",ze="_metaItem_1hoev_165",Xe="_statusGrid_1hoev_171",Ze="_forwardStatusReason_1hoev_191",Je="_migrationPanel_1hoev_199",Qe="_migrationHeader_1hoev_206",et="_migrationTitle_1hoev_213",tt="_migrationDescription_1hoev_222",st="_migrationLedger_1hoev_230",nt="_migrationLedgerItem_1hoev_237",ot="_migrationLedgerBlocked_1hoev_262",at="_migrationSection_1hoev_266",it="_migrationList_1hoev_280",rt="_migrationRow_1hoev_292",ct="_migrationOperation_1hoev_305",lt="_migrationRowBody_1hoev_310",dt="_migrationNotice_1hoev_331",pt="_migrationActions_1hoev_340",yt="_migrationButton_1hoev_346",ut="_migrationError_1hoev_353",gt="_migrationDisclosure_1hoev_354",ht="_migrationPagination_1hoev_356",mt="_migrationProgressHeading_1hoev_356",ft="_migrationProgressMeta_1hoev_356",_t="_migrationProgress_1hoev_356",St="_policySummary_1hoev_403",vt="_policySummaryItem_1hoev_414",xt="_policyPrimaryValue_1hoev_439",jt="_policyReviewNotice_1hoev_445",wt="_policyApplySection_1hoev_456",Nt="_policyApplyHeader_1hoev_460",bt="_policyApplyTitle_1hoev_464",It="_policyApplyDescription_1hoev_472",Rt="_policyInfoLabel_1hoev_480",kt="_policySafetyRow_1hoev_491",Pt="_policySafetyLabel_1hoev_503",Dt="_policySafetyBadge_1hoev_509",Ct="_policyDisclosure_1hoev_513",Et="_policyDisclosureIcon_1hoev_545",Lt="_policyDisclosureIconOpen_1hoev_552",Tt="_policyScopeList_1hoev_556",At="_policyScopeRow_1hoev_563",Bt="_policyScopeName_1hoev_577",Mt="_policyDirectionRail_1hoev_589",Ft="_policyDirectionEndpoint_1hoev_605",Ot="_policyDirectionEndpointStudio_1hoev_612",$t="_policyDirectionArrow_1hoev_616",Ht="_forwardBadge_1hoev_659",Ut="_logContainer_1hoev_674",qt="_logEntry_1hoev_681",Vt="_logTime_1hoev_693",Wt="_logType_1hoev_699",Gt="_logTypeWrite_1hoev_708",Kt="_logTypeUpdate_1hoev_712",Yt="_logTypeDelete_1hoev_716",zt="_logTypeIdle_1hoev_720",Xt="_logPath_1hoev_724",Zt="_logEmpty_1hoev_731",s={page:ke,detailsStack:Pe,refreshButton:De,targetRow:Ce,storedRow:Ee,storedDisclosure:Le,targetList:Te,storedList:Ae,targetRowSelected:Be,targetIdentity:Me,targetStudio:Fe,targetState:Oe,stateNote:$e,selectedScope:He,sharedNote:Ue,emptyMessage:qe,errorMessage:Ve,card:We,cardHeader:Ge,clearButton:Ke,statusRow:Ye,metaItem:ze,statusGrid:Xe,forwardStatusReason:Ze,migrationPanel:Je,migrationHeader:Qe,migrationTitle:et,migrationDescription:tt,migrationLedger:st,migrationLedgerItem:nt,migrationLedgerBlocked:ot,migrationSection:at,migrationList:it,migrationRow:rt,migrationOperation:ct,migrationRowBody:lt,migrationNotice:dt,migrationActions:pt,migrationButton:yt,migrationError:ut,migrationDisclosure:gt,migrationPagination:ht,migrationProgressHeading:mt,migrationProgressMeta:ft,migrationProgress:_t,policySummary:St,policySummaryItem:vt,policyPrimaryValue:xt,policyReviewNotice:jt,policyApplySection:wt,policyApplyHeader:Nt,policyApplyTitle:bt,policyApplyDescription:It,policyInfoLabel:Rt,policySafetyRow:kt,policySafetyLabel:Pt,policySafetyBadge:Dt,policyDisclosure:Ct,policyDisclosureIcon:Et,policyDisclosureIconOpen:Lt,policyScopeList:Tt,policyScopeRow:At,policyScopeName:Bt,policyDirectionRail:Mt,policyDirectionEndpoint:Ft,policyDirectionEndpointStudio:Ot,policyDirectionArrow:$t,forwardBadge:Ht,logContainer:Ut,logEntry:qt,logTime:Vt,logType:Wt,logTypeWrite:Gt,logTypeUpdate:Kt,logTypeDelete:Yt,logTypeIdle:zt,logPath:Xt,logEmpty:Zt},ae=50;function Jt(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function re({title:t,items:a,renderItem:_}){const{t:i}=ie(),d=l.useId(),n=l.useRef(null),[N,R]=l.useState(!1),[D,j]=l.useState(0),b=Math.max(0,Math.ceil(a.length/ae)-1),g=Math.min(D,b),C=g*ae,u=Math.min(C+ae,a.length),A=E=>{var p,y;j(E),(y=(p=n.current)==null?void 0:p.scrollTo)==null||y.call(p,{top:0})};return e.jsxs("div",{className:s.migrationSection,children:[e.jsxs(J,{variant:"ghost",className:s.migrationDisclosure,"aria-expanded":N,"aria-controls":d,onClick:()=>R(!N),children:[e.jsxs("span",{children:[t," (",a.length.toLocaleString(),")"]}),e.jsx("span",{"aria-hidden":"true",children:N?"−":"+"})]}),e.jsx("div",{id:d,hidden:!N,children:N&&e.jsxs("div",{children:[e.jsx("ul",{ref:n,className:s.migrationList,tabIndex:0,"aria-label":t,children:a.slice(C,u).map((E,p)=>_(E,C+p))}),e.jsxs("div",{className:s.migrationPagination,children:[e.jsxs("span",{children:[C+1,"–",u," / ",a.length.toLocaleString()]}),b>0&&e.jsxs("div",{children:[e.jsx(J,{variant:"secondary",disabled:g===0,onClick:()=>A(g-1),children:i("sync.migration.previous","Previous")}),e.jsx(J,{variant:"secondary",disabled:g===b,onClick:()=>A(g+1),children:i("sync.migration.next","Next")})]})]})]},g)})]})}function Qt({migration:t,onRefresh:a,onApply:_}){const{t:i}=ie(),[d,n]=l.useState(!1),[N,R]=l.useState(0),D=l.useRef(null),j=!!(t!=null&&t.loading||t!=null&&t.applying),b=t==null?void 0:t.progress,g=(b==null?void 0:b.status)==="running"&&b.operation===(t!=null&&t.applying?"apply":"preview")?b:null,C=g==null?void 0:g.startedAt;l.useEffect(()=>{if(!j){R(0);return}const c=C?Date.parse(C):Date.now(),h=()=>R(Math.max(0,Math.floor((Date.now()-c)/1e3)));h();const L=setInterval(h,1e3);return()=>clearInterval(L)},[j,C]);const u=t==null?void 0:t.report;if(!t||(u==null?void 0:u.status)==="not_required"||!u&&!j&&!t.error)return null;const A=(u==null?void 0:u.status)==="blocked",E=(u==null?void 0:u.status)==="ready"&&!j,p=()=>{n(!1),_(),requestAnimationFrame(()=>{var c;return(c=D.current)==null?void 0:c.focus()})},y=[...new Set((u==null?void 0:u.blockers.map(c=>c.reason))??[])];return e.jsxs("section",{ref:D,tabIndex:-1,className:`${s.card} ${s.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:s.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:s.migrationTitle,children:u?i("sync.migration.title","Sync format update available"):i("sync.migration.checking","Checking sync format")}),e.jsx("p",{className:s.migrationDescription,children:i("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),u&&e.jsx(H,{variant:A?"warning":"accent",children:j?t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…"):A?i("sync.migration.status.blocked","Blocked"):i("sync.migration.status.ready","Ready to review")})]}),u&&e.jsx("div",{className:s.migrationLedger,"aria-label":i("sync.migration.preview","Review changes"),children:["add","modify","delete","blocked"].map(c=>e.jsxs("div",{className:`${s.migrationLedgerItem} ${c==="blocked"&&A?s.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:i(`sync.migration.summary.${c}`,c)}),e.jsx("strong",{children:u.summary[c].toLocaleString()})]},c))}),j&&e.jsxs("div",{className:s.migrationProgress,children:[e.jsxs("div",{role:"status",className:s.migrationProgressHeading,children:[e.jsx("span",{children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…")}),g&&e.jsx("span",{children:i(`sync.migration.phase.${g.phase}`,g.phase)})]}),e.jsx("progress",{"aria-label":i("sync.migration.progress","Update progress"),...g!=null&&g.total&&g.total>0?{value:g.completed,max:g.total}:{}}),e.jsxs("div",{className:s.migrationProgressMeta,children:[e.jsx("span",{"aria-live":"off",children:i("sync.migration.elapsed","Elapsed {seconds}s").replace("{seconds}",String(N))}),(g==null?void 0:g.total)!==null&&(g==null?void 0:g.total)!==void 0&&e.jsxs("span",{children:[g.completed.toLocaleString()," / ",g.total.toLocaleString()]})]}),e.jsx("p",{children:i("sync.migration.wait","Large places can take a while. You can keep browsing while this runs.")})]}),e.jsxs("div",{className:s.migrationNotice,"aria-live":"polite",children:[(A||t.error==="migration_blocked")&&e.jsx("span",{children:i("sync.migration.blocked","Resolve sync conflicts before updating")}),y.map(c=>e.jsx("span",{children:i(`sync.migration.reason.${c}`,c.replace(/_/g," "))},c)),t.error==="preview_stale"&&e.jsx("span",{children:i("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="migration_in_progress"&&e.jsx("span",{children:i("sync.migration.inProgress","An update is already running for this place. Wait, then refresh the preview.")}),t.error==="unknown"&&e.jsx("span",{className:s.migrationError,children:i("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:s.migrationActions,children:[e.jsx(J,{variant:"secondary",className:s.migrationButton,disabled:j,onClick:()=>void a(),children:t.loading?i("sync.migration.refreshing","Refreshing…"):i("sync.migration.refresh","Refresh preview")}),u&&e.jsx(J,{variant:"primary",className:s.migrationButton,disabled:!E,onClick:()=>n(!0),children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.apply","Apply update")})]}),u&&u.changes.length>0&&e.jsx(re,{title:i("sync.migration.changes","Metadata changes"),items:u.changes,renderItem:c=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:Jt(c.operation),className:s.migrationOperation,children:i(`sync.migration.operation.${c.operation}`,c.operation)}),e.jsxs("div",{className:s.migrationRowBody,children:[e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.operation}:${c.path}`)}),u&&u.blockers.length>0&&e.jsx(re,{title:i("sync.migration.blockers","Items to resolve"),items:u.blockers,renderItem:(c,h)=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:"warning",className:s.migrationOperation,children:i("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:s.migrationRowBody,children:[c.path&&e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.reason}:${c.path??h}`)}),e.jsx(pe,{open:d,title:i("sync.migration.confirm.title","Apply sync format update?"),message:i("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:i("common.cancel","Cancel"),confirmLabel:i("sync.migration.apply","Apply update"),onCancel:()=>n(!1),onConfirm:p})]})}const es=["scriptSource","properties","structure","serviceProperties"];function ts(t){const a=new Date(t);return`${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}function ss(t){switch(t){case"fullSyncComplete":case"write":return s.logTypeWrite;case"fullSyncStart":case"fullSyncProgress":case"update":return s.logTypeUpdate;case"fullSyncFailed":case"delete":return s.logTypeDelete;default:return s.logTypeIdle}}const ce={unknown:"neutral",off:"neutral",idle:"neutral",initializing:"info",syncing:"success",paused:"warning",error:"error"},le={unknown:"Unknown",off:"Sync OFF",idle:"Waiting",initializing:"Initializing",syncing:"Syncing",paused:"Paused",error:"Error"},ns={inactive:"Change sending off",active:"Change sending enabled",paused_play:"Paused for Play",reconciling:"Checking Edit changes",blocked:"Changes need attention",unknown:"Sending status unknown"},os={inactive:"neutral",active:"success",paused_play:"warning",reconciling:"info",blocked:"error",unknown:"neutral"};function as(t,a){switch(a){case"conflict_review":case"manual_review":return t("sync.forwardStatus.reason.review","Review changes in the Studio Plugin.");case"edit_changed_during_reconciliation":return t("sync.forwardStatus.reason.editChanged","Edit changed during the check. Inspect Sync in the Studio Plugin.");case"pre_check_failed":case"reverse_apply_failed":case"reconciliation_failed":case"sync_error":case"update_failed":case"acknowledgement_missing":case"ACK_EXPIRED":case"ACK_ID_REUSED":case"SYNC_DIRECTION_REVERSE":return t("sync.forwardStatus.reason.failed","Changes could not be confirmed. Inspect Sync in the Studio Plugin.");default:return t("sync.forwardStatus.reason.fallback","Check the Studio Plugin for details.")}}function is(t,a){const _={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${a}`,_[a])}function de(t,a){return a==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function rs(t,a){const _={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${a}`,_[a])}function cs(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function ls(t,a){const _={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.${a}.tooltip`,_[a])}function ds(t,a){return a?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function ps(t,a){return a?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 ys(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart","START");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress","PROGRESS");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete","COMPLETE");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed","FAILED");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 us(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart.tooltip","Full Sync started.");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress.tooltip","Full Sync is saving the snapshot.");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete.tooltip","Full Sync completed successfully.");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed.tooltip","Full Sync ended without completing the snapshot.");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 xs(){var K,Y,v,X,w,V;const{t}=ie(),{trackEvent:a}=_e(),{level:_}=Se(),{tier:i,loading:d}=ve(),n=Re(),{show:N}=xe(),[R,D]=l.useState(null),[j,b]=l.useState(!1),[g,C]=l.useState(!1),[u,A]=l.useState(!1),E=!d&&i==="basic",p=n.selectedTarget,y=p==null?void 0:p.sync,c=(y==null?void 0:y.forwardSyncStatus)??"unknown",h=p?{...p.sync.status,syncEnabled:p.sync.syncEnabled,policy:p.sync.policy,policyCapabilities:p.sync.policyCapabilities,policyReviewRequired:p.sync.policyReviewRequired}:null,L=(p==null?void 0:p.placeName)??((K=n.selectedPlace)==null?void 0:K.placeName)??t("sync.targets.unknownPlace","Unknown place"),G=n.selectedPlaceId===null?L:L+" · "+n.selectedPlaceId,B=n.storageSafe?(h==null?void 0:h.instanceCount)??((Y=n.selectedPlace)==null?void 0:Y.instanceCount):null,U=n.storageSafe?(h==null?void 0:h.scriptCount)??((v=n.selectedPlace)==null?void 0:v.scriptCount):null,q=new Set(n.targets.map(r=>r.placeId)),M=n.places.filter(r=>r.placeId===0||!q.has(r.placeId)),$=e.jsx(we,{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:_,tier:i}}),k=n.history,Q=async()=>{if(R){b(!0);try{await n.clearHistory(R.placeId),N(t("toast.clearSuccess","Cleared successfully"),"success"),D(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{b(!1)}}};return e.jsxs("div",{className:s.page,children:[$,e.jsxs("section",{className:s.card,"aria-label":t("sync.targets.title","Connected Studios"),children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.targets.title","Connected Studios")," (",n.targets.length,")"]}),e.jsx("button",{type:"button",className:s.refreshButton,onClick:n.refresh,children:t("sync.targets.refresh","Refresh")})]}),n.loading?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.loading","Loading Studio Sync status…")}):n.snapshotError?e.jsxs("p",{className:s.errorMessage,role:"alert",children:[t("sync.targets.unavailable","Studio Sync status is unavailable. Retry to check the current state.")," ",n.snapshotError]}):n.targets.length===0?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.empty","No Studio is connected. Connect the WEPPY Plugin to see live Sync status.")}):e.jsx("div",{className:s.targetList,children:n.targets.map(r=>{var I;const x=((I=n.selection)==null?void 0:I.kind)==="target"&&n.selection.clientId===r.clientId;return e.jsxs("button",{type:"button",className:`${s.targetRow} ${x?s.targetRowSelected:""}`,"aria-pressed":x,onClick:()=>n.selectTarget(r.clientId),children:[e.jsxs("span",{className:s.targetIdentity,children:[e.jsx(O,{text:r.placeName||t("sync.targets.unknownPlace","Unknown place"),children:e.jsx("strong",{children:r.placeName||t("sync.targets.unknownPlace","Unknown place")})}),e.jsxs("span",{children:[t("sync.targets.placeId","Place ID"),": ",r.placeId??"—"]})]}),e.jsxs("span",{className:s.targetStudio,children:[e.jsx(O,{text:r.clientId,children:e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",r.targetAlias]})}),e.jsx("span",{children:t("sync.targets.connected","Connected")})]}),e.jsxs("span",{className:s.targetState,children:[e.jsx(H,{variant:ce[r.sync.state],shape:"pill",children:t("sync.targets.state."+r.sync.state,le[r.sync.state])}),r.sync.syncEnabled===null&&e.jsx("span",{className:s.stateNote,children:t("sync.targets.notReported","Not reported yet")})]})]},r.clientId)})})]}),M.length>0&&e.jsxs("section",{className:s.card,"aria-label":t("sync.stored.title","Stored places"),children:[e.jsxs("button",{type:"button",className:s.storedDisclosure,"aria-expanded":u,onClick:()=>A(r=>!r),children:[e.jsxs("span",{children:[t("sync.stored.title","Stored places")," (",M.length,")"]}),e.jsx("span",{"aria-hidden":"true",children:u?"⌃":"⌄"})]}),u&&e.jsx("div",{className:s.storedList,children:M.map(r=>{var ee;const x=oe(n.places,r),I=((ee=n.selection)==null?void 0:ee.kind)==="stored"&&n.selection.placeDirName===r.placeDirName;return e.jsxs("button",{type:"button",className:`${s.storedRow} ${I?s.targetRowSelected:""}`,disabled:!x,"aria-pressed":I,onClick:()=>n.selectStored(r),children:[e.jsxs("span",{children:[r.placeName," · ",r.placeId]}),e.jsx("span",{children:x?t("sync.stored.data","Stored data"):t("sync.stored.ambiguous","Storage location unconfirmed")})]},r.placeDirName)})})]}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.selectedScope,children:[e.jsx("span",{children:t("sync.detail.scope","Viewing Sync details for")}),e.jsx("strong",{children:G}),p&&e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",p.targetAlias]}),e.jsx("span",{children:t("sync.detail.readOnly","Viewing details does not change Studio routing.")})]}),!n.selection&&!n.loading&&!n.snapshotError&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.empty","Select a connected Studio or stored place to view details.")}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.detailsStack,children:[e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx(O,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),E&&e.jsx(O,{text:t("sync.status.forwardOnly.tooltip","Basic tier allows Studio to local forward sync only."),children:e.jsx("span",{className:s.forwardBadge,children:t("sync.status.forwardOnly","Forward Only")})})]}),e.jsxs("div",{className:s.statusRow,children:[y?e.jsx(H,{variant:ce[y.state],shape:"pill",children:t("sync.targets.state."+y.state,le[y.state])}):e.jsx(H,{variant:"neutral",shape:"pill",children:t("sync.stored.data","Stored data")}),e.jsx("span",{className:s.metaItem,children:G})]}),(y==null?void 0:y.state)==="unknown"&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.unknown","This Studio has not reported its Sync state yet.")}),(y==null?void 0:y.state)==="error"&&e.jsx("p",{className:s.errorMessage,role:"alert",children:t("sync.detail.error","Sync reported an error. Check the Studio Plugin for details.")}),e.jsxs("dl",{className:s.statusGrid,children:[p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.forwardStatus.label","Change sending"),tooltip:t("sync.forwardStatus.tooltip","This reports whether Edit changes can be sent. Enabled does not confirm every local file is current.")})}),e.jsxs("dd",{children:[e.jsx(H,{variant:os[c],shape:"pill",children:t("sync.forwardStatus."+c,ns[c])}),c==="blocked"&&e.jsx("span",{className:s.forwardStatusReason,children:as(t,y==null?void 0:y.forwardSyncReason)})]}),(y==null?void 0:y.forwardSyncObservedAt)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.forwardStatus.observedAt","Observed")}),e.jsx("dd",{children:new Date(y.forwardSyncObservedAt).toLocaleString()})]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.targets.studioId","Studio ID")}),e.jsx("dd",{children:p.targetAlias}),e.jsx("dt",{children:t("sync.targets.connectionId","Connection ID")}),e.jsx("dd",{children:p.clientId})]}),(h==null?void 0:h.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:h.syncRoot})]}),((X=n.selectedPlace)==null?void 0:X.placeDirName)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.detail.placeFolder","Place folder"),tooltip:t("sync.detail.placeFolder.tooltip","The stored folder shared by Studios opening this Place.")})}),e.jsx("dd",{children:n.selectedPlace.placeDirName})]}),B!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:B})]}),U!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:U})]})]}),e.jsx("p",{className:s.sharedNote,children:t("sync.detail.sharedData","Path, counts, and log belong to the Place and are shared by Studios opening it.")})]}),n.storageSafe&&e.jsx(Qt,{migration:n.migration,onRefresh:n.refreshMigration,onApply:n.applyMigration},[n.selection.kind==="target"?n.selection.clientId:n.selection.placeDirName,n.selectedPlaceId,(V=(w=n.migration)==null?void 0:w.report)==null?void 0:V.previewFingerprint].join(":")),(h==null?void 0:h.policy)&&e.jsxs("div",{className:s.card,children:[e.jsx("div",{className:s.cardHeader,children:e.jsx(O,{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:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(H,{variant:h.syncEnabled?"success":"neutral",children:h.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:s.policyPrimaryValue,children:is(t,h.policy.preset)})]})]}),h.policyReviewRequired&&e.jsx("div",{className:s.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:s.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:s.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:s.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:s.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{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:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.contentChanges)})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{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:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:s.policySafetyRow,children:[e.jsx("span",{className:s.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(O,{text:ps(t,h.policy.autoApplyLocalDeletesToStudio),children:e.jsx(H,{variant:h.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:s.policySafetyBadge,tabIndex:0,children:ds(t,h.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:s.policyDisclosure,"aria-expanded":g,"aria-controls":"sync-policy-scope-panel",onClick:()=>C(r=>!r),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${s.policyDisclosureIcon} ${g?s.policyDisclosureIconOpen:""}`,children:"⌄"})]}),g&&e.jsx("div",{id:"sync-policy-scope-panel",className:s.policyScopeList,children:es.map(r=>{const x=h.policy.directions[r];return e.jsxs("div",{className:s.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:s.policyScopeName,children:t(`sync.policy.scope.${r}`,r)}),e.jsx(O,{text:ls(t,x),children:e.jsxs("span",{className:s.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":rs(t,x),tabIndex:0,children:[e.jsx("span",{className:s.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:s.policyDirectionArrow,"aria-hidden":"true",children:cs(x)}),e.jsx("span",{className:`${s.policyDirectionEndpoint} ${s.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},r)})})]}),e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.log.title","Sync Log")," · ",t("sync.log.shared","Shared Place log")]}),e.jsx("button",{className:s.clearButton,type:"button",disabled:!n.storageSafe||n.selectedPlaceId===null,onClick:()=>{n.selectedPlaceId!==null&&(a("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),D({placeId:n.selectedPlaceId,label:G}))},children:t("common.clear","Clear")})]}),e.jsx("div",{className:s.logContainer,children:n.storageSafe?n.historyError?e.jsxs("div",{className:s.errorMessage,role:"alert",children:[t("sync.log.unavailable","The Place log could not be loaded. Retry to check it.")," ",n.historyError]}):n.historyLoading&&k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.loading","Loading Place log…")}):k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.empty","No sync events yet")}):k.map((r,x)=>e.jsxs("div",{className:s.logEntry,children:[e.jsx("span",{className:s.logTime,children:ts(r.timestamp)}),e.jsx(O,{text:us(t,r.type),children:e.jsx("span",{className:`${s.logType} ${ss(r.type)}`,children:ys(t,r.type)})}),e.jsxs("span",{className:s.logPath,children:[r.path,r.details?` — ${r.details}`:""]})]},x)):e.jsx("div",{className:s.logEmpty,children:t("sync.log.unsafe","This Place has no confirmed storage location for log access.")})})]}),E&&e.jsx(Ne,{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:je.sync})]}),e.jsx(pe,{open:R!==null,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.selectedMessage","This permanently removes the shared Sync log for {place}.").replace("{place}",(R==null?void 0:R.label)??""),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:j,onCancel:()=>!j&&D(null),onConfirm:Q})]})}export{xs as Component};
@@ -1 +1 @@
1
- import{u as H,r as u,j as a,B as z,C as U,g as V,v as Y,o as F,p as B,q as D,x as G}from"./index-B1SnAt0o.js";import{B as L}from"./PageHeader-QiUV3oJs.js";import{P as Q,a as J}from"./PlaceSelectOptions-BArB7wnB.js";const X="_scope_1i8qy_1",Z="_main_1i8qy_13",ee="_label_1i8qy_22",ce="_selectorLabel_1i8qy_30",le="_placeSelect_1i8qy_38",ae="_name_1i8qy_54",te="_id_1i8qy_65",ne="_scopeBadge_1i8qy_72",oe="_copy_1i8qy_76",se="_note_1i8qy_88",re="_folderDetails_1i8qy_92",ie="_shortcuts_1i8qy_96",de="_shortcutsTrigger_1i8qy_103",pe="_shortcutLink_1i8qy_126",ue="_shortcutsPopover_1i8qy_131",s={scope:X,main:Z,label:ee,selectorLabel:ce,placeSelect:le,name:ae,id:te,scopeBadge:ne,copy:oe,note:se,folderDetails:re,shortcuts:ie,shortcutsTrigger:de,shortcutLink:pe,shortcutsPopover:ue};function C(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function g(e,c){return F(e.places,c)}function $(e){var c;return e.lastActivePlaceId!==null?e.lastActivePlaceId:((c=e.places[0])==null?void 0:c.placeId)??null}function T(e){var c;if(e.pluginConnected&&e.activePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.activePlaceId);if(g(e,e.activePlaceId)||l.length===0)return e.activePlaceId}if(e.lastActivePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.lastActivePlaceId);if(g(e,e.lastActivePlaceId)||l.length===0)return e.lastActivePlaceId}return((c=Y(e.places))==null?void 0:c.placeId)??null}function fe(e,c,l){var n;return c?((n=g(e,typeof l=="number"?l:null))==null?void 0:n.placeId)??T(e):e.pluginConnected&&e.activePlaceId!==null?e.activePlaceId:$(e)}function M(e,c){const l=g(e,c);return(l==null?void 0:l.universeId)!==void 0?l.universeId:c===e.activePlaceId?e.activeUniverseId??null:c===e.lastActivePlaceId?e.lastActiveUniverseId??null:null}function ve(e,c,l){if(!C(e))return[];const n=[];return C(c)&&n.push({label:l("placeScope.shortcuts.settings","Place settings"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/places/${e}/configure`},{label:l("placeScope.shortcuts.experience","Experience management"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/overview`}),n.push({label:l("placeScope.shortcuts.roblox","View on Roblox"),href:`https://www.roblox.com/games/${e}`}),n}function he(e,c){if(e.pluginConnected&&e.activePlaceId!==null){const o=g(e,e.activePlaceId),t=o?B(e.places,o.placeId):!1,r=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(e.activePlaceId));return{label:c("placeScope.current.label","Current Place"),placeId:e.activePlaceId,placeName:e.activePlaceName??(t?r:o==null?void 0:o.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.connected","Studio connected"),connected:(o==null?void 0:o.isConnected)??!0,folderUnresolved:t,hasSyncMetadata:o?D(e.places,o):void 0,note:null}}const l=$(e),n=g(e,l);if(l!==null){const o=l===e.lastActivePlaceId?e.lastActivePlaceName:null,t=n?B(e.places,n.placeId):!1,r=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(l));return{label:c("placeScope.lastActive.label","Last Active Place"),placeId:l,placeName:o??(t?r:n==null?void 0:n.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.stored","Stored data"),connected:!1,folderUnresolved:t,hasSyncMetadata:n?D(e.places,n):void 0,note:c("placeScope.stored.note","No connected Studio currently has this place open.")}}return{label:c("placeScope.noPlace.label","Place scope"),placeId:null,placeName:c("placeScope.noPlace.value","No place data available yet"),badge:c("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:c("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")}}function be(e,c,l){const n=typeof c=="number"?g(e,c):null,o=T(e),t=(n==null?void 0:n.placeId)??o,r=g(e,t);if(t===null)return{label:l("placeScope.noPlace.label","Place scope"),placeId:null,placeName:l("placeScope.noPlace.value","No place data available yet"),badge:l("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:l("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")};const S=(r==null?void 0:r.isConnected)??!1,f=e.activePlaceId===t,p=t===e.lastActivePlaceId?e.lastActivePlaceName:null,b=f?e.activePlaceName:null,P=r?B(e.places,r.placeId):!1,v=l("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(t));return{label:f?l("placeScope.current.label","Current Place"):l("placeScope.selected.label","Selected Place"),placeId:t,placeName:b??p??(P?v:r==null?void 0:r.placeName)??l("placeScope.unknownPlace","Unknown place"),badge:S?l("placeScope.connected","Studio connected"):l("placeScope.stored","Stored data"),connected:S,folderUnresolved:P,hasSyncMetadata:r?D(e.places,r):void 0,note:S?null:l("placeScope.stored.note","No connected Studio currently has this place open.")}}function Se(e,c){switch(e){case"sync":return c("placeScope.surface.sync","Sync status and logs use this place.");case"changelog":return c("placeScope.surface.changelog","Changelog sessions use this place.");case"playtest":return c("placeScope.surface.playtest","Playtest reports use this place.");case"uiStudio":return c("placeScope.surface.uiStudio","UI captures and change history use this place.");case"tools":return c("placeScope.surface.tools","Tool history and statistics use this place.")}}function Le({surface:e,selectable:c=!1,selectedPlaceId:l=null,onSelectedPlaceIdChange:n}){const{t:o}=H(),[t,r]=u.useState(null),[S,f]=u.useState(!0),[p,b]=u.useState(null),P=u.useRef(null),v=u.useRef(null),E=u.useId();u.useEffect(()=>{let i=!1;async function N(){try{const k=await V();i||r(k)}catch{i||r(null)}finally{i||f(!1)}}return N(),()=>{i=!0}},[]),u.useEffect(()=>{if(!c||!t)return;const i=T(t);(typeof l!="number"||!g(t,l))&&l!==i&&(n==null||n(i))},[n,c,l,t]);const I=t?fe(t,c,l):null,h=t?M(t,I):null,_=`${I??"none"}:${h??"none"}`;if(u.useEffect(()=>{b(i=>i===_?i:null)},[_]),u.useEffect(()=>{function i(){b(null)}function N(w){var j;p!==null&&!((j=P.current)!=null&&j.contains(w.target))&&i()}function k(w){var j;p!==null&&w.key==="Escape"&&(w.preventDefault(),i(),(j=v.current)==null||j.focus())}return document.addEventListener("pointerdown",N),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",k)}},[p]),S)return a.jsx("div",{className:s.scope,"aria-live":"polite",children:a.jsx("span",{className:s.label,children:o("placeScope.loading","Loading place scope...")})});if(!t)return a.jsx("div",{className:s.scope,"aria-live":"polite",children:a.jsx("span",{className:s.label,children:o("placeScope.unavailable","Place scope unavailable")})});const d=c?be(t,l,o):he(t,o),m=z(t),x=typeof d.placeId=="number"?String(d.placeId):"",O=c&&t.places.length>0,W=M(t,d.placeId),q=ve(d.placeId,W,o),R=_,A=p===R;return a.jsxs("div",{className:s.scope,"aria-live":"polite",children:[a.jsxs("div",{className:s.main,children:[O?a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:s.selectorLabel,children:[a.jsx("span",{className:s.label,children:o("placeScope.selector.label","Place data")}),a.jsxs("select",{className:s.placeSelect,value:x,onChange:i=>{const N=Number.parseInt(i.currentTarget.value,10);b(null),n==null||n(Number.isInteger(N)?N:null)},children:[d.placeId===null?a.jsx("option",{value:"",disabled:!0,children:o("placeScope.selector.noneSelectable","No selectable Place folder")}):null,a.jsx(Q,{places:t.places,confirmedNames:m,t:o})]})]}),a.jsx("span",{className:s.label,children:d.label}),a.jsx("span",{className:s.name,children:d.placeName})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:s.label,children:d.label}),a.jsx("span",{className:s.name,children:d.placeName})]}),d.placeId!==null?a.jsx("span",{className:s.id,children:d.placeId}):null,a.jsx(L,{variant:d.connected?"success":"neutral",shape:"pill",className:s.scopeBadge,children:d.badge}),d.folderUnresolved?a.jsx(L,{variant:"neutral",shape:"pill",className:s.scopeBadge,children:o("placeScope.folder.unresolved","Representative folder unconfirmed")}):null,d.hasSyncMetadata===!1?a.jsx(L,{variant:"neutral",shape:"pill",className:s.scopeBadge,children:o("placeScope.folder.noSyncHistory","No sync history")}):null]}),a.jsxs("div",{className:s.copy,children:[a.jsx("span",{children:Se(e,o)}),d.note?a.jsx("span",{className:s.note,children:d.note}):null]}),t.places.some(i=>U(i)==="duplicate"||U(i)==="unresolved")?a.jsx("div",{className:s.folderDetails,children:a.jsx(J,{places:t.places,t:o})}):null,q.length>0?a.jsxs("div",{className:s.shortcuts,ref:P,children:[a.jsxs("button",{ref:v,type:"button",className:s.shortcutsTrigger,"aria-controls":E,"aria-expanded":A,onClick:()=>{b(A?null:R)},children:[o("placeScope.shortcuts.trigger","Quick links"),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),A?a.jsx("div",{id:E,className:s.shortcutsPopover,role:"group","aria-label":o("placeScope.shortcuts.label","Place shortcuts"),children:q.map(i=>a.jsxs("a",{className:s.shortcutLink,href:i.href,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{children:i.label}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]},i.href))}):null]}):null]})}const ge="_backdrop_1sgib_1",Pe="_dialog_1sgib_19",K={backdrop:ge,dialog:Pe},_e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(", ");function Ne(e){return Array.from(e.querySelectorAll(_e))}function xe(e){const c=document.activeElement;if(!(c instanceof HTMLElement))return!1;const l=c.closest('[role="dialog"][aria-modal="true"]');return l!==null&&l!==e}function Be({open:e,ariaLabel:c,onClose:l,returnFocusTo:n=null,initialFocusRef:o,dismissDisabled:t=!1,children:r,testId:S}){const f=u.useRef(null),p=u.useRef(l),b=u.useRef(t),P=u.useRef(null);return p.current=l,b.current=t,u.useEffect(()=>{if(!e)return;const v=f.current;if(!v)return;const E=document.body.style.overflow;P.current=n??(document.activeElement instanceof HTMLElement?document.activeElement:null),document.body.style.overflow="hidden",((o==null?void 0:o.current)??v).focus();const I=h=>{if(xe(v))return;if(h.key==="Escape"){h.preventDefault(),b.current||p.current();return}if(h.key!=="Tab")return;const _=Ne(v);if(_.length===0){h.preventDefault(),v.focus();return}const d=_[0],m=_[_.length-1],x=document.activeElement;h.shiftKey&&(x===d||!v.contains(x))?(h.preventDefault(),m.focus()):!h.shiftKey&&(x===m||!v.contains(x))&&(h.preventDefault(),d.focus())};return document.addEventListener("keydown",I),()=>{document.removeEventListener("keydown",I),document.body.style.overflow=E;const h=n??P.current;h&&document.contains(h)&&h.focus()}},[o,e,n]),e?G.createPortal(a.jsx("div",{className:K.backdrop,"data-testid":S,role:"presentation",onClick:v=>{v.target===v.currentTarget&&!t&&p.current()},children:a.jsx("section",{ref:f,className:K.dialog,role:"dialog","aria-modal":"true","aria-label":c,tabIndex:-1,children:r})}),document.body):null}const Ie="_tabBar_jefog_2",je="_tabs_jefog_9",ye="_actions_jefog_14",Ee="_tab_jefog_2",me="_tabActive_jefog_52",y={tabBar:Ie,tabs:je,actions:ye,tab:Ee,tabActive:me};function De({items:e,value:c,onChange:l,ariaLabel:n,className:o,rightActions:t}){const r=u.useRef(null),S=u.useRef(null);return u.useEffect(()=>{const f=()=>{const p=r.current,b=S.current;!p||!b||typeof p.scrollTo!="function"||p.scrollTo({left:Math.max(0,b.offsetLeft+b.offsetWidth/2-p.clientWidth/2),behavior:"auto"})};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[c]),a.jsxs("div",{ref:r,className:[y.tabBar,o].filter(Boolean).join(" "),role:"tablist","aria-label":n,children:[a.jsx("div",{className:y.tabs,children:e.map(f=>{const p=f.key===c;return a.jsx("button",{ref:p?S:void 0,type:"button",role:"tab","aria-selected":p,"data-testid":f.testId,className:[y.tab,p?y.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(f.key),children:f.label},f.key)})}),t?a.jsx("div",{className:y.actions,children:t}):null]})}export{Be as C,De as T,Le as a};
1
+ import{u as H,r as u,j as a,C as z,G as U,g as G,w as V,p as Y,q as B,t as D,y as F}from"./index-DOEmzpkJ.js";import{B as L}from"./PageHeader-DJRyLHjf.js";import{P as Q,a as J}from"./PlaceSelectOptions-CM4-kAp6.js";const X="_scope_1i8qy_1",Z="_main_1i8qy_13",ee="_label_1i8qy_22",ce="_selectorLabel_1i8qy_30",le="_placeSelect_1i8qy_38",ae="_name_1i8qy_54",te="_id_1i8qy_65",ne="_scopeBadge_1i8qy_72",oe="_copy_1i8qy_76",se="_note_1i8qy_88",re="_folderDetails_1i8qy_92",ie="_shortcuts_1i8qy_96",de="_shortcutsTrigger_1i8qy_103",pe="_shortcutLink_1i8qy_126",ue="_shortcutsPopover_1i8qy_131",s={scope:X,main:Z,label:ee,selectorLabel:ce,placeSelect:le,name:ae,id:te,scopeBadge:ne,copy:oe,note:se,folderDetails:re,shortcuts:ie,shortcutsTrigger:de,shortcutLink:pe,shortcutsPopover:ue};function C(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function g(e,c){return Y(e.places,c)}function $(e){var c;return e.lastActivePlaceId!==null?e.lastActivePlaceId:((c=e.places[0])==null?void 0:c.placeId)??null}function T(e){var c;if(e.pluginConnected&&e.activePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.activePlaceId);if(g(e,e.activePlaceId)||l.length===0)return e.activePlaceId}if(e.lastActivePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.lastActivePlaceId);if(g(e,e.lastActivePlaceId)||l.length===0)return e.lastActivePlaceId}return((c=V(e.places))==null?void 0:c.placeId)??null}function fe(e,c,l){var n;return c?((n=g(e,typeof l=="number"?l:null))==null?void 0:n.placeId)??T(e):e.pluginConnected&&e.activePlaceId!==null?e.activePlaceId:$(e)}function M(e,c){const l=g(e,c);return(l==null?void 0:l.universeId)!==void 0?l.universeId:c===e.activePlaceId?e.activeUniverseId??null:c===e.lastActivePlaceId?e.lastActiveUniverseId??null:null}function ve(e,c,l){if(!C(e))return[];const n=[];return C(c)&&n.push({label:l("placeScope.shortcuts.settings","Place settings"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/places/${e}/configure`},{label:l("placeScope.shortcuts.experience","Experience management"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/overview`}),n.push({label:l("placeScope.shortcuts.roblox","View on Roblox"),href:`https://www.roblox.com/games/${e}`}),n}function he(e,c){if(e.pluginConnected&&e.activePlaceId!==null){const o=g(e,e.activePlaceId),t=o?B(e.places,o.placeId):!1,r=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(e.activePlaceId));return{label:c("placeScope.current.label","Current Place"),placeId:e.activePlaceId,placeName:e.activePlaceName??(t?r:o==null?void 0:o.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.connected","Studio connected"),connected:(o==null?void 0:o.isConnected)??!0,folderUnresolved:t,hasSyncMetadata:o?D(e.places,o):void 0,note:null}}const l=$(e),n=g(e,l);if(l!==null){const o=l===e.lastActivePlaceId?e.lastActivePlaceName:null,t=n?B(e.places,n.placeId):!1,r=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(l));return{label:c("placeScope.lastActive.label","Last Active Place"),placeId:l,placeName:o??(t?r:n==null?void 0:n.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.stored","Stored data"),connected:!1,folderUnresolved:t,hasSyncMetadata:n?D(e.places,n):void 0,note:c("placeScope.stored.note","No connected Studio currently has this place open.")}}return{label:c("placeScope.noPlace.label","Place scope"),placeId:null,placeName:c("placeScope.noPlace.value","No place data available yet"),badge:c("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:c("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")}}function be(e,c,l){const n=typeof c=="number"?g(e,c):null,o=T(e),t=(n==null?void 0:n.placeId)??o,r=g(e,t);if(t===null)return{label:l("placeScope.noPlace.label","Place scope"),placeId:null,placeName:l("placeScope.noPlace.value","No place data available yet"),badge:l("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:l("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")};const S=(r==null?void 0:r.isConnected)??!1,f=e.activePlaceId===t,p=t===e.lastActivePlaceId?e.lastActivePlaceName:null,b=f?e.activePlaceName:null,P=r?B(e.places,r.placeId):!1,v=l("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(t));return{label:f?l("placeScope.current.label","Current Place"):l("placeScope.selected.label","Selected Place"),placeId:t,placeName:b??p??(P?v:r==null?void 0:r.placeName)??l("placeScope.unknownPlace","Unknown place"),badge:S?l("placeScope.connected","Studio connected"):l("placeScope.stored","Stored data"),connected:S,folderUnresolved:P,hasSyncMetadata:r?D(e.places,r):void 0,note:S?null:l("placeScope.stored.note","No connected Studio currently has this place open.")}}function Se(e,c){switch(e){case"sync":return c("placeScope.surface.sync","Sync status and logs use this place.");case"changelog":return c("placeScope.surface.changelog","Changelog sessions use this place.");case"playtest":return c("placeScope.surface.playtest","Playtest reports use this place.");case"uiStudio":return c("placeScope.surface.uiStudio","UI captures and change history use this place.");case"tools":return c("placeScope.surface.tools","Tool history and statistics use this place.")}}function Le({surface:e,selectable:c=!1,selectedPlaceId:l=null,onSelectedPlaceIdChange:n}){const{t:o}=H(),[t,r]=u.useState(null),[S,f]=u.useState(!0),[p,b]=u.useState(null),P=u.useRef(null),v=u.useRef(null),E=u.useId();u.useEffect(()=>{let i=!1;async function N(){try{const w=await G();i||r(w)}catch{i||r(null)}finally{i||f(!1)}}return N(),()=>{i=!0}},[]),u.useEffect(()=>{if(!c||!t)return;const i=T(t);(typeof l!="number"||!g(t,l))&&l!==i&&(n==null||n(i))},[n,c,l,t]);const I=t?fe(t,c,l):null,h=t?M(t,I):null,_=`${I??"none"}:${h??"none"}`;if(u.useEffect(()=>{b(i=>i===_?i:null)},[_]),u.useEffect(()=>{function i(){b(null)}function N(k){var j;p!==null&&!((j=P.current)!=null&&j.contains(k.target))&&i()}function w(k){var j;p!==null&&k.key==="Escape"&&(k.preventDefault(),i(),(j=v.current)==null||j.focus())}return document.addEventListener("pointerdown",N),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",w)}},[p]),S)return a.jsx("div",{className:s.scope,"aria-live":"polite",children:a.jsx("span",{className:s.label,children:o("placeScope.loading","Loading place scope...")})});if(!t)return a.jsx("div",{className:s.scope,"aria-live":"polite",children:a.jsx("span",{className:s.label,children:o("placeScope.unavailable","Place scope unavailable")})});const d=c?be(t,l,o):he(t,o),m=z(t),x=typeof d.placeId=="number"?String(d.placeId):"",O=c&&t.places.length>0,W=M(t,d.placeId),q=ve(d.placeId,W,o),R=_,A=p===R;return a.jsxs("div",{className:s.scope,"aria-live":"polite",children:[a.jsxs("div",{className:s.main,children:[O?a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:s.selectorLabel,children:[a.jsx("span",{className:s.label,children:o("placeScope.selector.label","Place data")}),a.jsxs("select",{className:s.placeSelect,value:x,onChange:i=>{const N=Number.parseInt(i.currentTarget.value,10);b(null),n==null||n(Number.isInteger(N)?N:null)},children:[d.placeId===null?a.jsx("option",{value:"",disabled:!0,children:o("placeScope.selector.noneSelectable","No selectable Place folder")}):null,a.jsx(Q,{places:t.places,confirmedNames:m,t:o})]})]}),a.jsx("span",{className:s.label,children:d.label}),a.jsx("span",{className:s.name,children:d.placeName})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:s.label,children:d.label}),a.jsx("span",{className:s.name,children:d.placeName})]}),d.placeId!==null?a.jsx("span",{className:s.id,children:d.placeId}):null,a.jsx(L,{variant:d.connected?"success":"neutral",shape:"pill",className:s.scopeBadge,children:d.badge}),d.folderUnresolved?a.jsx(L,{variant:"neutral",shape:"pill",className:s.scopeBadge,children:o("placeScope.folder.unresolved","Representative folder unconfirmed")}):null,d.hasSyncMetadata===!1?a.jsx(L,{variant:"neutral",shape:"pill",className:s.scopeBadge,children:o("placeScope.folder.noSyncHistory","No sync history")}):null]}),a.jsxs("div",{className:s.copy,children:[a.jsx("span",{children:Se(e,o)}),d.note?a.jsx("span",{className:s.note,children:d.note}):null]}),t.places.some(i=>U(i)==="duplicate"||U(i)==="unresolved")?a.jsx("div",{className:s.folderDetails,children:a.jsx(J,{places:t.places,t:o})}):null,q.length>0?a.jsxs("div",{className:s.shortcuts,ref:P,children:[a.jsxs("button",{ref:v,type:"button",className:s.shortcutsTrigger,"aria-controls":E,"aria-expanded":A,onClick:()=>{b(A?null:R)},children:[o("placeScope.shortcuts.trigger","Quick links"),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),A?a.jsx("div",{id:E,className:s.shortcutsPopover,role:"group","aria-label":o("placeScope.shortcuts.label","Place shortcuts"),children:q.map(i=>a.jsxs("a",{className:s.shortcutLink,href:i.href,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{children:i.label}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]},i.href))}):null]}):null]})}const ge="_backdrop_1sgib_1",Pe="_dialog_1sgib_19",K={backdrop:ge,dialog:Pe},_e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(", ");function Ne(e){return Array.from(e.querySelectorAll(_e))}function xe(e){const c=document.activeElement;if(!(c instanceof HTMLElement))return!1;const l=c.closest('[role="dialog"][aria-modal="true"]');return l!==null&&l!==e}function Be({open:e,ariaLabel:c,onClose:l,returnFocusTo:n=null,initialFocusRef:o,dismissDisabled:t=!1,children:r,testId:S}){const f=u.useRef(null),p=u.useRef(l),b=u.useRef(t),P=u.useRef(null);return p.current=l,b.current=t,u.useEffect(()=>{if(!e)return;const v=f.current;if(!v)return;const E=document.body.style.overflow;P.current=n??(document.activeElement instanceof HTMLElement?document.activeElement:null),document.body.style.overflow="hidden",((o==null?void 0:o.current)??v).focus();const I=h=>{if(xe(v))return;if(h.key==="Escape"){h.preventDefault(),b.current||p.current();return}if(h.key!=="Tab")return;const _=Ne(v);if(_.length===0){h.preventDefault(),v.focus();return}const d=_[0],m=_[_.length-1],x=document.activeElement;h.shiftKey&&(x===d||!v.contains(x))?(h.preventDefault(),m.focus()):!h.shiftKey&&(x===m||!v.contains(x))&&(h.preventDefault(),d.focus())};return document.addEventListener("keydown",I),()=>{document.removeEventListener("keydown",I),document.body.style.overflow=E;const h=n??P.current;h&&document.contains(h)&&h.focus()}},[o,e,n]),e?F.createPortal(a.jsx("div",{className:K.backdrop,"data-testid":S,role:"presentation",onClick:v=>{v.target===v.currentTarget&&!t&&p.current()},children:a.jsx("section",{ref:f,className:K.dialog,role:"dialog","aria-modal":"true","aria-label":c,tabIndex:-1,children:r})}),document.body):null}const Ie="_tabBar_jefog_2",je="_tabs_jefog_9",ye="_actions_jefog_14",Ee="_tab_jefog_2",me="_tabActive_jefog_52",y={tabBar:Ie,tabs:je,actions:ye,tab:Ee,tabActive:me};function De({items:e,value:c,onChange:l,ariaLabel:n,className:o,rightActions:t}){const r=u.useRef(null),S=u.useRef(null);return u.useEffect(()=>{const f=()=>{const p=r.current,b=S.current;!p||!b||typeof p.scrollTo!="function"||p.scrollTo({left:Math.max(0,b.offsetLeft+b.offsetWidth/2-p.clientWidth/2),behavior:"auto"})};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[c]),a.jsxs("div",{ref:r,className:[y.tabBar,o].filter(Boolean).join(" "),role:"tablist","aria-label":n,children:[a.jsx("div",{className:y.tabs,children:e.map(f=>{const p=f.key===c;return a.jsx("button",{ref:p?S:void 0,type:"button",role:"tab","aria-selected":p,"data-testid":f.testId,className:[y.tab,p?y.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(f.key),children:f.label},f.key)})}),t?a.jsx("div",{className:y.actions,children:t}):null]})}export{Be as C,De as T,Le as a};
@@ -1 +1 @@
1
- import{a as m,c as d,y as h,j as n}from"./index-B1SnAt0o.js";const x="_actions_z7b39_60",f="_btn_z7b39_68",j="_btnPrimary_z7b39_99",z="_panel_z7b39_109",y="_panelIcon_z7b39_116",I="_panelTitle_z7b39_122",N="_panelDesc_z7b39_132",u="_benefitList_z7b39_140",v="_benefitItem_z7b39_149",e={actions:x,btn:f,btnPrimary:j,panel:z,panelIcon:y,panelTitle:I,panelDesc:N,benefitList:u,benefitItem:v};function g({icon:a,title:s,description:c,benefits:l,upgradeLabel:i,upgradeHref:r}){const{trackEvent:o}=m(),{pathname:_,search:b}=d(),p=h(_,b);return n.jsxs("div",{className:e.panel,children:[a&&n.jsx("div",{className:e.panelIcon,children:a}),n.jsx("div",{className:e.panelTitle,children:s}),n.jsx("div",{className:e.panelDesc,children:c}),n.jsx("ul",{className:e.benefitList,children:l.map(t=>n.jsx("li",{className:e.benefitItem,children:t},t))}),n.jsx("div",{className:e.actions,children:n.jsx("a",{className:`${e.btn} ${e.btnPrimary}`,href:r,target:"_blank",rel:"noreferrer",onClick:()=>o("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...p}),children:i})})]})}export{g as T};
1
+ import{a as m,c as d,z as h,j as n}from"./index-DOEmzpkJ.js";const x="_actions_z7b39_60",f="_btn_z7b39_68",j="_btnPrimary_z7b39_99",z="_panel_z7b39_109",I="_panelIcon_z7b39_116",N="_panelTitle_z7b39_122",u="_panelDesc_z7b39_132",v="_benefitList_z7b39_140",y="_benefitItem_z7b39_149",e={actions:x,btn:f,btnPrimary:j,panel:z,panelIcon:I,panelTitle:N,panelDesc:u,benefitList:v,benefitItem:y};function g({icon:a,title:s,description:c,benefits:l,upgradeLabel:i,upgradeHref:r}){const{trackEvent:o}=m(),{pathname:_,search:b}=d(),p=h(_,b);return n.jsxs("div",{className:e.panel,children:[a&&n.jsx("div",{className:e.panelIcon,children:a}),n.jsx("div",{className:e.panelTitle,children:s}),n.jsx("div",{className:e.panelDesc,children:c}),n.jsx("ul",{className:e.benefitList,children:l.map(t=>n.jsx("li",{className:e.benefitItem,children:t},t))}),n.jsx("div",{className:e.actions,children:n.jsx("a",{className:`${e.btn} ${e.btnPrimary}`,href:r,target:"_blank",rel:"noreferrer",onClick:()=>o("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...p}),children:i})})]})}export{g as T};
@@ -1 +1 @@
1
- import{j as e,r as i,b as I,D as ht,u as at,X as mt,a as bt,k as xt}from"./index-B1SnAt0o.js";import{P as ft}from"./PageHeader-QiUV3oJs.js";import{T as M}from"./TooltipText-x86NSn8t.js";import{C as _t}from"./ConfirmModal-D2yw01tT.js";import{a as gt,T as jt,C as yt}from"./Tabs-Cnh4bdIv.js";import"./ConfirmModal.module-DJksQHBd.js";import"./PlaceSelectOptions-BArB7wnB.js";const Ct="_wrapper_1s3lp_2",kt="_table_1s3lp_7",Tt="_sortable_1s3lp_32",Nt="_sortArrow_1s3lp_41",St="_clickable_1s3lp_52",wt="_empty_1s3lp_57",A={wrapper:Ct,table:kt,sortable:Tt,sortArrow:Nt,clickable:St,empty:wt};function vt({columns:t,data:o,sortBy:c,sortDir:k="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:k==="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 C=N?N(h):String(w);return e.jsx("tr",{className:l?A.clickable:void 0,tabIndex:l?-1:void 0,onClick:l?_=>l(h,_.currentTarget):void 0,children:t.map(_=>e.jsx("td",{children:_.render?_.render(h):String(h[_.key]??"")},_.key))},C)})})]})})}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,k]=i.useState(null),[b,l]=i.useState(!0),[N,S]=i.useState([]),[h,w]=i.useState(0),[C,_]=i.useState(!1),[U,O]=i.useState(!0),[m,E]=i.useState(0),[g,F]=i.useState(""),B=i.useRef(null),T=i.useCallback(async()=>{l(!0);try{const j=Pt(o),u=j?await I.get("/api/dashboard/tool-stats",j):await I.get("/api/dashboard/tool-stats");k(u)}catch{}finally{l(!1)}},[o]),x=i.useCallback(async(j,u)=>{O(!0);try{const P={limit:String(Bt),offset:String(j)};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),_(H.hasMore)}catch{S([]),w(0),_(!1)}finally{O(!1)}},[o]),D=i.useCallback(()=>{T(),x(m,g)},[x,T,m,g]),V=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/history/clear",o)),x(m,g)},[x,m,g,o]),K=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/statistics/clear",o)),T()},[T,o]);return i.useEffect(()=>{T()},[T]),i.useEffect(()=>{x(m,g)},[x,m,g]),i.useEffect(()=>{const j=new ht;B.current=j,j.connect();const u=j.on("command",()=>{T(),x(m,g)});return()=>{u(),j.disconnect(),B.current=null}},[x,T,m,g]),{statistics:c,statsLoading:b,history:N,historyTotal:h,historyHasMore:C,historyLoading:U,historyOffset:m,historyToolFilter:g,setHistoryOffset:E,setHistoryToolFilter:F,refresh:D,clearHistory:V,clearStatistics:K}}const Et="_page_1rtjt_2",Ht="_card_1rtjt_14",At="_cardToolbar_1rtjt_21",Rt="_sectionTitle_1rtjt_29",It="_dangerButton_1rtjt_36",Ot="_proBadge_1rtjt_55",Ft="_statusOk_1rtjt_70",Dt="_statusFallback_1rtjt_83",$t="_statusUnsupported_1rtjt_96",qt="_statusWarning_1rtjt_109",Wt="_statusError_1rtjt_122",Ut="_tierBasic_1rtjt_136",Vt="_tierPro_1rtjt_140",Kt="_tierMixed_1rtjt_145",Gt="_filterRow_1rtjt_156",zt="_filterLabel_1rtjt_163",Jt="_filterSelect_1rtjt_172",Qt="_detailsButton_1rtjt_187",Zt="_detailShell_1rtjt_210",Xt="_detailHeader_1rtjt_218",Yt="_detailHeading_1rtjt_229",te="_detailTitle_1rtjt_236",ee="_detailRecordName_1rtjt_243",se="_detailHeaderActions_1rtjt_252",ae="_detailCloseButton_1rtjt_259",oe="_detailBody_1rtjt_282",le="_detailSection_1rtjt_294",re="_detailList_1rtjt_313",ie="_detailItem_1rtjt_319",ne="_detailLabel_1rtjt_326",ce="_detailValue_1rtjt_331",de="_pre_1rtjt_337",ue="_pagination_1rtjt_355",pe="_pageInfo_1rtjt_363",he="_btn_1rtjt_369",me="_tierDistribution_1rtjt_397",be="_tierBarWrap_1rtjt_401",xe="_tierBarBasic_1rtjt_409",fe="_tierBarPro_1rtjt_414",_e="_tierLabels_1rtjt_419",ge="_statsTableWrap_1rtjt_428",je="_statsTable_1rtjt_428",ye="_sortableHeader_1rtjt_460",Ce="_sortArrow_1rtjt_465",ke="_statsToolRow_1rtjt_469",Te="_statsActionRow_1rtjt_477",Ne="_expandButton_1rtjt_481",Se="_expandIcon_1rtjt_493",we="_actionLabel_1rtjt_498",ve="_emptyStats_1rtjt_505",Me="_summaryLine_1rtjt_511",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:xe,tierBarPro:fe,tierLabels:_e,statsTableWrap:ge,statsTable:je,sortableHeader:ye,sortArrow:Ce,statsToolRow:ke,statsActionRow:Te,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 y(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(),k=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:k.tooltip,children:e.jsx("span",{className:k.className,children:k.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:[y(c("tools.history.routing.mode","Mode"),l.selectionMode),y(c("tools.history.routing.requested","Requested"),Ae(l,c)),y(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?y(c("tools.detail.requestedCommand","Requested Command"),b.requestedCommand):null,t.status==="fallback"&&b.executedCommand?y(c("tools.detail.executedCommand","Executed Command"),b.executedCommand):null,t.status==="fallback"&&b.alternatives?y(c("tools.detail.alternatives","Alternatives"),b.alternatives.join(", ")):null,t.status==="unsupported"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="unsupported"?y(c("tools.detail.noFallback","No Fallback"),c("tools.detail.noFallback.value","No fallback ran.")):null,t.status==="warning"&&t.warningMessage?y(c("tools.detail.warningMessage","Warning Message"),t.warningMessage):null,t.status==="error"&&t.errorMessage?y(c("tools.detail.errorMessage","Error Message"),t.errorMessage):null,t.status==="error"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="error"&&t.fallbackCommand?y(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 Ge(){const{t}=at(),{trackEvent:o,trackPageView:c}=bt(),[k,b]=i.useState(null),l=Lt({placeId:k}),{show:N}=xt(),[S,h]=i.useState("history"),[w,C]=i.useState(null),_=i.useRef(null),[U,O]=i.useState(null),[m,E]=i.useState(null),[g,F]=i.useState(!1),[B,T]=i.useState("totalCalls"),[x,D]=i.useState("desc"),V=i.useCallback(s=>{T(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]),j=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})),f=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:f,successCount:v,fallbackCount:$,unsupportedCount:q,warningCount:dt,failureCount:ut,totalExecutionTimeMs:Z,avgExecutionTimeMs:f>0?Math.round(Z/f):0}}):[]},[l.statistics]),u=i.useCallback((s,n,r,f)=>e.jsx(M,{text:t(r,f),children:t(s,n)}),[t]),P=i.useCallback((s,n)=>{_.current=n,C(s)},[]),H=i.useCallback(()=>{C(null)},[]),z=i.useMemo(()=>[...j].sort((n,r)=>{const f=n[B],v=r[B];if(typeof f=="number"&&typeof v=="number")return x==="asc"?f-v:v-f;const $=String(f??""),q=String(v??"");return x==="asc"?$.localeCompare(q):q.localeCompare($)}),[j,B,x]),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 f=Math.round(s/r*100),v=100-f;return{basic:s,pro:n,basicPct:f,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}),C(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(ft,{title:t("page.tools.title","Tools"),description:t("page.tools.description","Inspect tool history, outcomes, fallback details, and usage statistics."),helpTopicId:"tools"}),e.jsx(gt,{surface:"tools",selectable:!0,selectedPlaceId:k,onSelectedPlaceIdChange:s=>{C(null),b(s),l.setHistoryOffset(0)}}),e.jsx(jt,{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=>{C(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:()=>{C(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:()=>{C(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:x==="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(yt,{open:w!==null,ariaLabel:t("tools.detail.dialogLabel","Tool execution detail"),onClose:H,returnFocusTo:_.current,testId:"tools-history-detail-popup-layer",children:w&&e.jsx(Ie,{entry:w,onClose:H})}),e.jsx(_t,{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:g,onCancel:()=>!g&&E(null),onConfirm:it})]})}export{Ge as Component};
1
+ import{j as e,r as i,b as I,D as ht,u as at,X as mt,a as bt,k as xt}from"./index-DOEmzpkJ.js";import{P as ft}from"./PageHeader-DJRyLHjf.js";import{T as M}from"./TooltipText-3t8YedaH.js";import{C as _t}from"./ConfirmModal-Bs6DRyDJ.js";import{a as gt,T as jt,C as yt}from"./Tabs-CKXzr1J0.js";import"./ConfirmModal.module-DJksQHBd.js";import"./PlaceSelectOptions-CM4-kAp6.js";const Ct="_wrapper_1s3lp_2",kt="_table_1s3lp_7",Tt="_sortable_1s3lp_32",Nt="_sortArrow_1s3lp_41",St="_clickable_1s3lp_52",wt="_empty_1s3lp_57",A={wrapper:Ct,table:kt,sortable:Tt,sortArrow:Nt,clickable:St,empty:wt};function vt({columns:t,data:o,sortBy:c,sortDir:k="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:k==="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 C=N?N(h):String(w);return e.jsx("tr",{className:l?A.clickable:void 0,tabIndex:l?-1:void 0,onClick:l?_=>l(h,_.currentTarget):void 0,children:t.map(_=>e.jsx("td",{children:_.render?_.render(h):String(h[_.key]??"")},_.key))},C)})})]})})}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,k]=i.useState(null),[b,l]=i.useState(!0),[N,S]=i.useState([]),[h,w]=i.useState(0),[C,_]=i.useState(!1),[U,O]=i.useState(!0),[m,E]=i.useState(0),[g,F]=i.useState(""),B=i.useRef(null),T=i.useCallback(async()=>{l(!0);try{const j=Pt(o),u=j?await I.get("/api/dashboard/tool-stats",j):await I.get("/api/dashboard/tool-stats");k(u)}catch{}finally{l(!1)}},[o]),x=i.useCallback(async(j,u)=>{O(!0);try{const P={limit:String(Bt),offset:String(j)};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),_(H.hasMore)}catch{S([]),w(0),_(!1)}finally{O(!1)}},[o]),D=i.useCallback(()=>{T(),x(m,g)},[x,T,m,g]),V=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/history/clear",o)),x(m,g)},[x,m,g,o]),K=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/statistics/clear",o)),T()},[T,o]);return i.useEffect(()=>{T()},[T]),i.useEffect(()=>{x(m,g)},[x,m,g]),i.useEffect(()=>{const j=new ht;B.current=j,j.connect();const u=j.on("command",()=>{T(),x(m,g)});return()=>{u(),j.disconnect(),B.current=null}},[x,T,m,g]),{statistics:c,statsLoading:b,history:N,historyTotal:h,historyHasMore:C,historyLoading:U,historyOffset:m,historyToolFilter:g,setHistoryOffset:E,setHistoryToolFilter:F,refresh:D,clearHistory:V,clearStatistics:K}}const Et="_page_1rtjt_2",Ht="_card_1rtjt_14",At="_cardToolbar_1rtjt_21",Rt="_sectionTitle_1rtjt_29",It="_dangerButton_1rtjt_36",Ot="_proBadge_1rtjt_55",Ft="_statusOk_1rtjt_70",Dt="_statusFallback_1rtjt_83",$t="_statusUnsupported_1rtjt_96",qt="_statusWarning_1rtjt_109",Wt="_statusError_1rtjt_122",Ut="_tierBasic_1rtjt_136",Vt="_tierPro_1rtjt_140",Kt="_tierMixed_1rtjt_145",Gt="_filterRow_1rtjt_156",zt="_filterLabel_1rtjt_163",Jt="_filterSelect_1rtjt_172",Qt="_detailsButton_1rtjt_187",Zt="_detailShell_1rtjt_210",Xt="_detailHeader_1rtjt_218",Yt="_detailHeading_1rtjt_229",te="_detailTitle_1rtjt_236",ee="_detailRecordName_1rtjt_243",se="_detailHeaderActions_1rtjt_252",ae="_detailCloseButton_1rtjt_259",oe="_detailBody_1rtjt_282",le="_detailSection_1rtjt_294",re="_detailList_1rtjt_313",ie="_detailItem_1rtjt_319",ne="_detailLabel_1rtjt_326",ce="_detailValue_1rtjt_331",de="_pre_1rtjt_337",ue="_pagination_1rtjt_355",pe="_pageInfo_1rtjt_363",he="_btn_1rtjt_369",me="_tierDistribution_1rtjt_397",be="_tierBarWrap_1rtjt_401",xe="_tierBarBasic_1rtjt_409",fe="_tierBarPro_1rtjt_414",_e="_tierLabels_1rtjt_419",ge="_statsTableWrap_1rtjt_428",je="_statsTable_1rtjt_428",ye="_sortableHeader_1rtjt_460",Ce="_sortArrow_1rtjt_465",ke="_statsToolRow_1rtjt_469",Te="_statsActionRow_1rtjt_477",Ne="_expandButton_1rtjt_481",Se="_expandIcon_1rtjt_493",we="_actionLabel_1rtjt_498",ve="_emptyStats_1rtjt_505",Me="_summaryLine_1rtjt_511",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:xe,tierBarPro:fe,tierLabels:_e,statsTableWrap:ge,statsTable:je,sortableHeader:ye,sortArrow:Ce,statsToolRow:ke,statsActionRow:Te,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 y(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(),k=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:k.tooltip,children:e.jsx("span",{className:k.className,children:k.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:[y(c("tools.history.routing.mode","Mode"),l.selectionMode),y(c("tools.history.routing.requested","Requested"),Ae(l,c)),y(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?y(c("tools.detail.requestedCommand","Requested Command"),b.requestedCommand):null,t.status==="fallback"&&b.executedCommand?y(c("tools.detail.executedCommand","Executed Command"),b.executedCommand):null,t.status==="fallback"&&b.alternatives?y(c("tools.detail.alternatives","Alternatives"),b.alternatives.join(", ")):null,t.status==="unsupported"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="unsupported"?y(c("tools.detail.noFallback","No Fallback"),c("tools.detail.noFallback.value","No fallback ran.")):null,t.status==="warning"&&t.warningMessage?y(c("tools.detail.warningMessage","Warning Message"),t.warningMessage):null,t.status==="error"&&t.errorMessage?y(c("tools.detail.errorMessage","Error Message"),t.errorMessage):null,t.status==="error"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="error"&&t.fallbackCommand?y(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 Ge(){const{t}=at(),{trackEvent:o,trackPageView:c}=bt(),[k,b]=i.useState(null),l=Lt({placeId:k}),{show:N}=xt(),[S,h]=i.useState("history"),[w,C]=i.useState(null),_=i.useRef(null),[U,O]=i.useState(null),[m,E]=i.useState(null),[g,F]=i.useState(!1),[B,T]=i.useState("totalCalls"),[x,D]=i.useState("desc"),V=i.useCallback(s=>{T(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]),j=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})),f=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:f,successCount:v,fallbackCount:$,unsupportedCount:q,warningCount:dt,failureCount:ut,totalExecutionTimeMs:Z,avgExecutionTimeMs:f>0?Math.round(Z/f):0}}):[]},[l.statistics]),u=i.useCallback((s,n,r,f)=>e.jsx(M,{text:t(r,f),children:t(s,n)}),[t]),P=i.useCallback((s,n)=>{_.current=n,C(s)},[]),H=i.useCallback(()=>{C(null)},[]),z=i.useMemo(()=>[...j].sort((n,r)=>{const f=n[B],v=r[B];if(typeof f=="number"&&typeof v=="number")return x==="asc"?f-v:v-f;const $=String(f??""),q=String(v??"");return x==="asc"?$.localeCompare(q):q.localeCompare($)}),[j,B,x]),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 f=Math.round(s/r*100),v=100-f;return{basic:s,pro:n,basicPct:f,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}),C(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(ft,{title:t("page.tools.title","Tools"),description:t("page.tools.description","Inspect tool history, outcomes, fallback details, and usage statistics."),helpTopicId:"tools"}),e.jsx(gt,{surface:"tools",selectable:!0,selectedPlaceId:k,onSelectedPlaceIdChange:s=>{C(null),b(s),l.setHistoryOffset(0)}}),e.jsx(jt,{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=>{C(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:()=>{C(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:()=>{C(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:x==="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(yt,{open:w!==null,ariaLabel:t("tools.detail.dialogLabel","Tool execution detail"),onClose:H,returnFocusTo:_.current,testId:"tools-history-detail-popup-layer",children:w&&e.jsx(Ie,{entry:w,onClose:H})}),e.jsx(_t,{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:g,onCancel:()=>!g&&E(null),onConfirm:it})]})}export{Ge as Component};
@@ -1 +1 @@
1
- import{j as i,i as r}from"./index-B1SnAt0o.js";function p({text:o,children:t}){return i.jsx(r,{text:o,children:t})}export{p as T};
1
+ import{j as i,i as r}from"./index-DOEmzpkJ.js";function p({text:o,children:t}){return i.jsx(r,{text:o,children:t})}export{p as T};