@weppy/roblox-mcp 2.17.21 → 2.17.22
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.
- package/CHANGELOG.md +6 -0
- package/dashboard/dist/assets/AiPromptExamples-CQGYhsSq.js +1 -0
- package/dashboard/dist/assets/{AssetsPage-BiFlajKz.js → AssetsPage-tnh7G0oI.js} +1 -1
- package/dashboard/dist/assets/{ChangelogPage-CZ4M3zvA.js → ChangelogPage-niZk_9S5.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-EJt_S9vY.js → ConfirmModal-BSuAB3WU.js} +1 -1
- package/dashboard/dist/assets/{ConnectionPage-n7saIQzt.js → ConnectionPage-4Bu7ELYr.js} +1 -1
- package/dashboard/dist/assets/{ContentScopedDialog-BcNAWEg1.js → ContentScopedDialog-BZBRfU-h.js} +1 -1
- package/dashboard/dist/assets/{ControlsPage-BtjiFRSB.js → ControlsPage-CMQLZIv5.js} +1 -1
- package/dashboard/dist/assets/{DialogHeader-BMv5alOx.js → DialogHeader-DYe1ZbDg.js} +1 -1
- package/dashboard/dist/assets/{GameChangeDetail-BNoyNyoe.js → GameChangeDetail-C3zrRv4g.js} +1 -1
- package/dashboard/dist/assets/{InfoLabel-xpwjU19F.js → InfoLabel-C9QuVrs9.js} +1 -1
- package/dashboard/dist/assets/{OverviewPage-gmgRY2nN.js → OverviewPage-CI3l2Ay4.js} +1 -1
- package/dashboard/dist/assets/{PageHeader-C7zSPJ0K.js → PageHeader-plAaGWcw.js} +1 -1
- package/dashboard/dist/assets/{PlaceSelectOptions-e39l4_SC.js → PlaceSelectOptions-Bh6TVGoa.js} +1 -1
- package/dashboard/dist/assets/{PlaytestAiPromptExamples-DNcOx55_.js → PlaytestAiPromptExamples-CV1U6nF6.js} +1 -1
- package/dashboard/dist/assets/{PlaytestPage-C1cvi3ce.js → PlaytestPage-BgG_4l9a.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-CKqiItPX.js +23 -0
- package/dashboard/dist/assets/{SyncPage-C1xj3Vtj.js → SyncPage-k_67oQ0S.js} +1 -1
- package/dashboard/dist/assets/{Tabs-CJSfllHd.js → Tabs-BDAljzT9.js} +1 -1
- package/dashboard/dist/assets/{TierPromoPanel-Cj3f7idb.js → TierPromoPanel-DUwTC3Zz.js} +1 -1
- package/dashboard/dist/assets/{ToolsPage-DxgcVWzx.js → ToolsPage-RoWl4i2b.js} +1 -1
- package/dashboard/dist/assets/{TooltipText-CKbtCUcM.js → TooltipText-Btgvmrqc.js} +1 -1
- package/dashboard/dist/assets/{UiStudioPage-DmWjv22S.css → UiStudioPage-SojeKPNs.css} +1 -1
- package/dashboard/dist/assets/UiStudioPage-Tbo30itW.js +23 -0
- package/dashboard/dist/assets/{WhatsNewPage-D91VijNf.js → WhatsNewPage-n-lW5_0g.js} +1 -1
- package/dashboard/dist/assets/{bot-DBgSRd9L.js → bot-Cw9-c1xX.js} +1 -1
- package/dashboard/dist/assets/{check-BGgW005M.js → check-D8GciAv-.js} +1 -1
- package/dashboard/dist/assets/{copy-B53fec-q.js → copy-CcmKRqlO.js} +1 -1
- package/dashboard/dist/assets/{index-B-46k2zD.js → index-CfT3smRY.js} +64 -32
- package/dashboard/dist/assets/{rotate-ccw-C68bQzOX.js → rotate-ccw-B9h7F-0m.js} +1 -1
- package/dashboard/dist/assets/{sample-requests-Cb8_d2yO.js → sample-requests-cbyN06Aw.js} +1 -1
- package/dashboard/dist/assets/{trash-2-DMaFDTK8.js → trash-2-ElF9PcCM.js} +1 -1
- package/dashboard/dist/assets/{useLiveUptime-Dd5RwIEz.js → useLiveUptime-CXdR7Bos.js} +1 -1
- package/dashboard/dist/assets/{useSettings-DpFpA827.js → useSettings-DhD_vaHX.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/index.js +165 -518
- package/package.json +1 -1
- package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
- package/dashboard/dist/assets/AiPromptExamples-v7F0ZqtA.js +0 -1
- package/dashboard/dist/assets/SettingsPage-BMmYemqI.js +0 -23
- package/dashboard/dist/assets/UiStudioPage-Ch9n11Rs.js +0 -11
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{c as re,u as X,s as we,j as e,a as Pe,b as be,r,R as Re,H as ye,K as He,T as ze,d as Y,g as De,e as Ae,A as Be,S as $e}from"./index-CfT3smRY.js";import{C as Ee}from"./ContentScopedDialog-BZBRfU-h.js";import{D as Te}from"./DialogHeader-DYe1ZbDg.js";import{C as he}from"./ConfirmModal-BSuAB3WU.js";import{l as Me,m as Ie,c as Ue,s as a,u as Fe}from"./useSettings-DhD_vaHX.js";import{C as je}from"./check-D8GciAv-.js";import{T as Oe}from"./trash-2-ElF9PcCM.js";import{C as qe}from"./copy-CcmKRqlO.js";import{C as We,P as Ye}from"./PageHeader-plAaGWcw.js";import{I as F}from"./InfoLabel-C9QuVrs9.js";import{T as v}from"./TooltipText-Btgvmrqc.js";import{D as Ce,f as _e,r as Ge,s as Ke,a as Ne,d as ie,S as le,b as Ve}from"./sample-requests-cbyN06Aw.js";import"./ConfirmModal.module-DJksQHBd.js";/**
|
|
2
|
+
* @license lucide-react v1.8.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ze=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],de=re("life-buoy",Ze);/**
|
|
7
|
+
* @license lucide-react v1.8.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Je=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Qe=re("mail",Je);/**
|
|
12
|
+
* @license lucide-react v1.8.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Xe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ue=re("shield-alert",Xe);/**
|
|
17
|
+
* @license lucide-react v1.8.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const et=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],tt=re("shield-check",et),st="_details_mi07g_1",at="_reference_mi07g_6",fe={details:st,reference:at};function ot({value:t}){const{t:s}=X(),i=we(t);if(!i)return null;const c=i.traceId??i.clientOperationId??i.requestId;return e.jsxs("details",{className:fe.details,children:[e.jsx("summary",{children:s("settings.license.ux.technical","Technical details")}),e.jsxs("dl",{children:[e.jsx("dt",{children:s("settings.license.ux.code","Diagnostic code")}),e.jsx("dd",{children:e.jsx("code",{children:i.code})}),i.stage&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:s("settings.license.ux.stage","Processing stage")}),e.jsx("dd",{children:e.jsx("code",{children:i.stage})})]}),c&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:s(i.traceId?"settings.license.ux.serverId":"settings.license.ux.localId",i.traceId?"Server trace ID":"Local request ID")}),e.jsx("dd",{children:e.jsx("code",{className:fe.reference,children:c})})]})]}),!i.traceId&&e.jsx("p",{children:s("settings.license.localReference","Local request only; no server trace was received.")})]})}const nt="_card_if7f5_1",it="_header_if7f5_2",rt="_eyebrow_if7f5_3",ct="_connection_if7f5_4",lt="_hero_if7f5_5",dt="_stateCopy_if7f5_8",ut="_stateLine_if7f5_9",pt="_inlineStatus_if7f5_10",ht="_emblem_if7f5_11",gt="_pro_if7f5_12",mt="_notice_if7f5_13",yt="_problem_if7f5_16",jt="_metadata_if7f5_17",ft="_actions_if7f5_22",xt="_dialogBody_if7f5_23",vt="_supportActions_if7f5_23",St="_more_if7f5_25",bt="_primary_if7f5_27",Ct="_changeKey_if7f5_29",_t="_danger_if7f5_32",Nt="_keyForm_if7f5_33",kt="_field_if7f5_37",Lt="_plans_if7f5_39",wt="_issueDot_if7f5_40",Pt="_historyToolbar_if7f5_43",Rt="_historyList_if7f5_44",Ht="_recordHeader_if7f5_46",zt="_goodIcon_if7f5_49",Dt="_badIcon_if7f5_50",At="_empty_if7f5_51",Bt="_supportLead_if7f5_53",$t="_supportFooter_if7f5_60",Et="_spin_if7f5_61",j={card:nt,header:it,eyebrow:rt,connection:ct,hero:lt,stateCopy:dt,stateLine:ut,inlineStatus:pt,emblem:ht,pro:gt,notice:mt,problem:yt,metadata:jt,actions:ft,dialogBody:xt,supportActions:vt,more:St,primary:bt,changeKey:Ct,danger:_t,keyForm:Nt,field:kt,plans:Lt,issueDot:wt,historyToolbar:Pt,historyList:Rt,recordHeader:Ht,goodIcon:zt,badIcon:Dt,empty:At,supportLead:Bt,supportFooter:$t,spin:Et};function Tt(t){return t.replace(/(?:WEPPY_-)?[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}|[A-F0-9]{8}(?:-[A-F0-9]{8}){3}|(?:ls3|st|v1)\.[A-Za-z0-9_.-]+/gi,"[redacted]")}function Mt({license:t,records:s,disabled:i,submitting:c,targeted:n,cardRef:L,inputRef:o,activate:y,refresh:h,reset:z}){const{t:f,locale:w}=X(),{status:b}=Pe(),{trackEvent:M}=be(),[x,_]=r.useState(""),[E,D]=r.useState(!1),[g,P]=r.useState(null),[N,m]=r.useState(!1),[R,B]=r.useState(""),[S,U]=r.useState("idle"),H=r.useRef(null),I=r.useRef(null),G=s.find(C=>C.operation!=="status"),T=Me(t,G),$=(t==null?void 0:t.tier)==="pro",O=!["active","required","reset"].includes(T),q=!!t&&(t.status!=="unlicensed"||t.refreshBlockedReason==="missing_session_token"),d=q&&(t==null?void 0:t.refreshBlockedReason)!=="missing_session_token",k=(t==null?void 0:t.provisional)&&!$&&d&&t.status!=="invalid"&&t.status!=="revoked"&&T!=="invalid"&&T!=="revoked",J=q||!!(t!=null&&t.maskedKey)&&t.status!=="unlicensed",K=q?Ie(t==null?void 0:t.maskedKey):void 0,u=t!=null&&t.checkedAt?new Date(t.checkedAt*1e3).toLocaleString(w):null,A=`MCP ${(b==null?void 0:b.version)??"-"} · Node ${(b==null?void 0:b.nodeVersion)??"-"} · ${navigator.platform||"Browser"}`,W=r.useMemo(()=>Ue(t,s,A),[t,s,A]),ae=`${Tt(R.trim())}${R.trim()?`
|
|
22
|
+
|
|
23
|
+
`:""}${W}`,V=`mailto:support@weppyai.com?subject=${encodeURIComponent("WEPPY license support")}&body=${encodeURIComponent(ae)}`,p=(C,ce)=>f(`settings.license.ux.${C}`,ce),ge={active:"Your license is ready to use.",required:"Enter your license key to get started.",invalid:"We could not verify this license key.",revoked:"This license no longer provides Pro access.",connection:"We could not complete this license check.",unavailable:"Your license needs to be checked.",reset:"The license has been removed from this installation."}[T],ke={invalid:"Check that you copied the full key from your purchase, then try again.",revoked:"Check your purchase or contact support for help with this license.",connection:"Check your connection and try again. If it continues, contact support."}[T]??"Enter your license key again. If the problem continues, contact support.",me=()=>{P(null),U("idle")};async function Le(){try{await navigator.clipboard.writeText(ae),U("copied")}catch{U("manual")}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{id:"settings-license",ref:L,tabIndex:-1,"data-testid":"settings-license-card",className:[a.card,j.card,$?a.licenseCardPro:"",n?a.licenseCardTarget:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:j.header,children:[e.jsx("span",{className:j.eyebrow,children:f("settings.license.title","License")}),e.jsx("span",{className:j.connection,children:i?f("settings.license.disconnected","Disconnected"):p("connected","Connected")})]}),e.jsxs("div",{className:j.hero,children:[e.jsx("span",{className:`${j.emblem} ${$?j.pro:""}`,children:$?e.jsx(tt,{size:22}):e.jsx(ue,{size:22})}),e.jsxs("div",{className:j.stateCopy,children:[e.jsxs("div",{className:j.stateLine,children:[e.jsx("h2",{children:$?p("usingPro","Pro is ready"):p("usingBasic","Basic is ready")}),!O&&T!=="required"&&e.jsxs("span",{className:j.inlineStatus,role:"status",children:[e.jsx(je,{size:14}),p(`notice.${T}`,ge)]})]}),!$&&!O&&e.jsx("p",{children:T==="required"?p("notice.required","Enter your license key to get started."):p("basicDescription","Activate a license to use Pro features.")})]})]}),O&&e.jsxs("div",{className:`${j.notice} ${j.problem}`,role:"alert",children:[e.jsx(ue,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:p(`notice.${T}`,ge)}),e.jsxs("p",{children:[k?p("help.recheck","Select Check license to verify your saved license. If the problem continues, contact support."):p(`help.${T}`,ke),$&&` ${p("accessUnchanged","Your existing Pro access is still available.")}`]})]})]}),(t==null?void 0:t.statusDetail)==="active_cancel_pending"&&e.jsx("p",{className:j.supportFooter,children:f("settings.license.detail.cancelPending","Cancellation is scheduled. Pro access remains active until the current billing period ends.")}),e.jsxs("dl",{className:j.metadata,children:[e.jsxs("div",{children:[e.jsx("dt",{children:f("settings.license.provider","Provider")}),e.jsx("dd",{children:t!=null&&t.provider&&t.provider!=="auto"?t.provider==="gumroad"?"Gumroad":t.provider==="polar"?"Polar":"WEPPY":"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:f("settings.license.key","Key")}),e.jsx("dd",{children:e.jsx("code",{children:K??"—"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:p("lastCheck","Last checked")}),e.jsx("dd",{children:u??p("notChecked","Not checked yet")})]})]}),e.jsxs("div",{className:j.actions,children:[e.jsxs("button",{className:$?j.primary:void 0,disabled:i||c||!d,onClick:()=>void h(),children:[e.jsx(Re,{size:15,className:c?j.spin:""}),f("settings.license.refresh","Check license")]}),e.jsxs("button",{ref:H,onClick:()=>P("history"),children:[e.jsx(ye,{size:15}),p("history","Diagnostic history"),G&&!G.success&&e.jsx("span",{className:j.issueDot})]}),e.jsxs("button",{ref:I,onClick:()=>P("support"),children:[e.jsx(de,{size:15}),p("support","Contact support")]}),$&&!E&&e.jsxs("button",{className:j.changeKey,disabled:i||c,onClick:()=>{D(!0),setTimeout(()=>{var C;return(C=o.current)==null?void 0:C.focus()},0)},children:[e.jsx(He,{size:14}),p("changeKey","Use a different key")]}),e.jsxs("details",{className:j.more,children:[e.jsx("summary",{children:p("more","More")}),e.jsxs("button",{className:j.danger,disabled:i||c||!J,onClick:()=>m(!0),children:[e.jsx(Oe,{size:14}),f("settings.license.reset","Remove registration")]})]})]}),!$||E?e.jsxs("form",{className:j.keyForm,onSubmit:C=>{C.preventDefault(),y(x).then(ce=>{ce&&(_(""),D(!1))})},children:[e.jsx("label",{htmlFor:"license-key-input",children:f("settings.license.keyInput","License Key")}),e.jsxs("div",{children:[e.jsx("input",{ref:o,id:"license-key-input",autoComplete:"off",spellCheck:!1,type:"password",value:x,onChange:C=>_(C.target.value),disabled:i||c,placeholder:p("keyPlaceholder","Enter your license key")}),e.jsx("button",{className:j.primary,disabled:i||c,type:"submit",children:f("settings.license.activate","Activate License")})]})]}):null,!$&&e.jsx("a",{className:j.plans,href:ze.settingsLicense,target:"_blank",rel:"noopener noreferrer",onClick:()=>M("dashboard_click_event",{click_target:"upgrade_cta",placement:"settings_license",page:"settings"}),children:f("tier.upgrade","View Pro")})]}),e.jsxs(Ee,{open:g!==null,ariaLabel:g==="history"?p("history","Diagnostic history"):p("support","Contact support"),onClose:me,returnFocusTo:g==="history"?H.current:I.current,children:[e.jsx(Te,{title:g==="history"?p("history","Diagnostic history"):p("support","Contact support"),description:g==="history"?p("historyScope","Recent license actions in this Dashboard tab. Up to 50 entries; cleared on reload."):p("supportDescription","Tell us what happened. Review the details before sharing."),closeLabel:f("common.close","Close"),onRequestClose:me}),e.jsx("div",{className:j.dialogBody,children:g==="history"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:j.historyToolbar,children:[e.jsxs("span",{children:[s.length," / 50"]}),e.jsxs("button",{onClick:()=>P("support"),children:[e.jsx(de,{size:15}),p("support","Contact support")]})]}),s.length?e.jsx("ol",{className:j.historyList,children:s.map(C=>e.jsxs("li",{children:[e.jsxs("div",{className:j.recordHeader,children:[e.jsx("span",{className:C.success?j.goodIcon:j.badIcon,children:C.success?e.jsx(je,{size:17}):e.jsx(ue,{size:17})}),e.jsx("strong",{children:p(`operation.${C.operation}`,{status:"License status",activate:"License activation",refresh:"License check",reset:"License removed",recheck:"Automatic license check"}[C.operation])}),e.jsx("time",{dateTime:new Date(C.at).toISOString(),children:new Date(C.at).toLocaleTimeString(w)})]}),e.jsx("p",{children:C.success?p(C.tier==="pro"?"recordPro":"recordDone",C.tier==="pro"?"Completed · Pro is available":"Completed"):p("recordAttention","Could not complete this action. Check your key or contact support.")}),e.jsx(ot,{value:C.diagnostic})]},C.id))}):e.jsxs("div",{className:j.empty,children:[e.jsx(ye,{size:28}),e.jsx("strong",{children:p("emptyHistory","No license actions recorded yet")}),e.jsx("p",{children:p("emptyHistoryHint","Your next license check will appear here.")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:j.supportLead,children:[e.jsx(de,{size:22}),e.jsxs("div",{children:[e.jsx("strong",{children:p("supportLead","We can help with your license")}),e.jsx("p",{children:p("supportHint","Include what you tried and what you expected. Your license key and session token are excluded.")})]})]}),e.jsxs("label",{className:j.field,children:[p("symptoms","What happened?"),e.jsx("textarea",{rows:3,value:R,onChange:C=>B(C.target.value),placeholder:p("symptomsPlaceholder","Example: I purchased Pro, but activation does not complete.")})]}),e.jsxs("label",{className:j.field,children:[p("supportPreview","Information to share"),e.jsx("textarea",{readOnly:!0,rows:9,value:ae,onFocus:C=>C.currentTarget.select()})]}),e.jsxs("div",{className:j.supportActions,children:[e.jsxs("button",{className:j.primary,onClick:()=>void Le(),children:[e.jsx(qe,{size:15}),S==="copied"?p("copied","Copied"):p("copy","Copy support information")]}),e.jsxs("a",{href:V.length<7e3?V:"mailto:support@weppyai.com",children:[e.jsx(Qe,{size:15}),p("email","Write an email")]})]}),e.jsx("p",{className:j.supportFooter,children:S==="manual"?p("manualCopy","Select the information above and copy it manually."):p("emailHint","Email support@weppyai.com. If no mail app opens, copy the information and paste it into your email.")})]})})]}),e.jsx(he,{open:N,title:p("resetTitle","Remove this license?"),message:p("resetHelp","This removes the license from this installation. You will need your key to activate Pro again."),cancelLabel:f("common.cancel","Cancel"),confirmLabel:p("remove","Remove license"),loading:c,onCancel:()=>m(!1),onConfirm:()=>{z().then(()=>m(!1))}})]})}const It="_card_jz1ya_4",Ut="_cardEmbedded_jz1ya_14",Ft="_cardTitle_jz1ya_21",Ot="_storageConsoleGrid_jz1ya_31",qt="_storageUsageColumn_jz1ya_38",Wt="_storagePolicyColumn_jz1ya_39",Yt="_usageRow_jz1ya_44",Gt="_usageTotal_jz1ya_50",Kt="_usageBreakdown_jz1ya_57",Vt="_usageCounts_jz1ya_63",Zt="_storageFooter_jz1ya_70",Jt="_lastRunRow_jz1ya_79",Qt="_lastRunLabel_jz1ya_89",Xt="_errorIcon_jz1ya_95",es="_tooltip_jz1ya_103",ts="_cleanupRow_jz1ya_126",ss="_cleanupLabel_jz1ya_133",as="_cleanupBtn_jz1ya_140",os="_cleanupBtnDanger_jz1ya_169",ns="_retentionSection_jz1ya_182",is="_retentionTitle_jz1ya_188",rs="_retentionFieldset_jz1ya_196",cs="_proOverlay_jz1ya_211",ls="_modeSegments_jz1ya_223",ds="_radioLabel_jz1ya_244",us="_radioLabelActive_jz1ya_265",ps="_presetGroup_jz1ya_279",hs="_presetBtn_jz1ya_287",gs="_presetBtnActive_jz1ya_310",ms="_freeInput_jz1ya_317",ys="_inputError_jz1ya_334",js="_inputUnit_jz1ya_338",fs="_cascadeRow_jz1ya_345",xs="_retentionActions_jz1ya_361",vs="_saveBtn_jz1ya_367",Ss="_runNowBtn_jz1ya_395",bs="_errorMsg_jz1ya_439",Cs="_freeInputHitArea_jz1ya_501",l={card:It,cardEmbedded:Ut,cardTitle:Ft,storageConsoleGrid:Ot,storageUsageColumn:qt,storagePolicyColumn:Wt,usageRow:Yt,usageTotal:Gt,usageBreakdown:Kt,usageCounts:Vt,storageFooter:Zt,lastRunRow:Jt,lastRunLabel:Qt,errorIcon:Xt,tooltip:es,cleanupRow:ts,cleanupLabel:ss,cleanupBtn:as,cleanupBtnDanger:os,retentionSection:ns,retentionTitle:is,retentionFieldset:rs,proOverlay:cs,modeSegments:ls,radioLabel:ds,radioLabelActive:us,presetGroup:ps,presetBtn:hs,presetBtnActive:gs,freeInput:ms,inputError:ys,inputUnit:js,cascadeRow:fs,retentionActions:xs,saveBtn:vs,runNowBtn:Ss,errorMsg:bs,freeInputHitArea:Cs};function _s(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 pe(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 Ns(t,s){return t.mode===s.mode&&t.ageDays===s.ageDays&&t.sizeMb===s.sizeMb&&t.cascadeSnapshots===s.cascadeSnapshots}function Q(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 ks({placeId:t,tier:s,currentPolicy:i,onSaved:c}){const{t:n}=X(),{trackEvent:L}=be(),[o,y]=r.useState(i),[h,z]=r.useState(()=>[7,14,30,90].includes(i.ageDays??-1)?"":String(i.ageDays??30)),[f,w]=r.useState(()=>[100,500,1e3].includes(i.sizeMb??-1)?"":String(i.sizeMb??500)),[b,M]=r.useState(null),[x,_]=r.useState(!1),[E,D]=r.useState(!1),[g,P]=r.useState(!1),[N,m]=r.useState(null);r.useEffect(()=>{y(i);const u=[7,14,30,90],A=[100,500,1e3];z(u.includes(i.ageDays??-1)?"":String(i.ageDays??30)),w(A.includes(i.sizeMb??-1)?"":String(i.sizeMb??500))},[i]);const R=s==="basic",B=pe(o),S=Ns(i,o),U=B&&!S&&!E,H=u=>{y(A=>{const W={...A,mode:u};return u==="age"&&(W.ageDays=parseInt(h,10)||30),u==="size"&&(W.sizeMb=parseInt(f,10)||500),W})},I=u=>{z(""),y(A=>({...A,ageDays:u}))},G=u=>{w(""),y(A=>({...A,sizeMb:u}))},T=u=>{z(u);const A=parseInt(u,10);Number.isNaN(A)||y(W=>({...W,ageDays:A}))},$=u=>{w(u);const A=parseInt(u,10);Number.isNaN(A)||y(W=>({...W,sizeMb:A}))},O=async()=>{if(m(null),L("dashboard_click_event",{click_target:"ui_studio_cleanup_save",page:"settings"}),_s(i,o)){try{const u=await _e(t,{mode:o.mode,ageDays:o.ageDays,sizeMb:o.sizeMb,cascadeSnapshots:o.cascadeSnapshots});M(u.dryRun),_(!0)}catch(u){m(u.message)}return}await q()},q=async()=>{D(!0);try{await Ke(t,o),_(!1),c()}catch(u){throw m(u.message),u}finally{D(!1)}},d=async()=>{m(null),L("dashboard_click_event",{click_target:"ui_studio_cleanup_run_now",page:"settings"}),P(!0);try{await Ge(t),c()}catch(u){m(u.message)}finally{P(!1)}},k=b?`${n("uiStudio.cleanup.policy.confirm.messageStrict","이 정책으로 즉시")} ${b.wouldRemoveRequests}${n("uiStudio.cleanup.policy.confirm.requests","건")} / ${b.wouldRemoveSnapshots}${n("uiStudio.cleanup.policy.confirm.snapshots","개 화면 캡처")} / ${Q(b.wouldFreeBytes)} ${n("uiStudio.cleanup.policy.confirm.freed","가 삭제됩니다 — 적용?")}`:"",J=o.mode==="age"&&!pe(o),K=o.mode==="size"&&!pe(o);return e.jsxs("div",{className:l.retentionSection,children:[e.jsx("h3",{className:l.retentionTitle,children:e.jsx(F,{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:[R&&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:R,"aria-label":n("uiStudio.cleanup.policy.title","자동 삭제 정책"),style:R?{opacity:.45,pointerEvents:"none"}:void 0,children:[e.jsxs("div",{className:l.modeSegments,"data-testid":"cleanup-mode-segments",children:[e.jsx(v,{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} ${o.mode==="off"?l.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"off",checked:o.mode==="off",onChange:()=>H("off")}),n("uiStudio.cleanup.policy.modeOff","사용 안 함 (off)")]})}),e.jsx(v,{text:n("uiStudio.cleanup.policy.modeAge.tooltip","Automatically delete data older than the configured number of days."),children:e.jsxs("label",{className:`${l.radioLabel} ${o.mode==="age"?l.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"age",checked:o.mode==="age",onChange:()=>H("age")}),n("uiStudio.cleanup.policy.modeAge","기간 기반 (age)")]})}),e.jsx(v,{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} ${o.mode==="size"?l.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"size",checked:o.mode==="size",onChange:()=>H("size")}),n("uiStudio.cleanup.policy.modeSize","용량 기반 (size)")]})})]}),o.mode==="age"&&e.jsxs("div",{className:l.presetGroup,children:[[7,14,30,90].map(u=>e.jsx(v,{text:n("uiStudio.cleanup.policy.agePreset.tooltip","Delete data older than this many days."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${o.ageDays===u&&h===""?l.presetBtnActive:""}`,onClick:()=>I(u),children:[u,n("uiStudio.cleanup.policy.daysUnit","일")]})},u)),e.jsx(v,{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} ${J?l.inputError:""}`,value:h,min:1,max:365,onChange:u=>T(u.target.value)})})}),e.jsxs("span",{className:l.inputUnit,children:["1–365",n("uiStudio.cleanup.policy.daysUnit","일")]})]}),o.mode==="size"&&e.jsxs("div",{className:l.presetGroup,children:[[100,500,1e3].map(u=>e.jsx(v,{text:n("uiStudio.cleanup.policy.sizePreset.tooltip","Keep total usage under this size."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${o.sizeMb===u&&f===""?l.presetBtnActive:""}`,onClick:()=>G(u),children:[u,n("uiStudio.cleanup.policy.mbUnit","MB")]})},u)),e.jsx(v,{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} ${K?l.inputError:""}`,value:f,min:50,max:1e4,onChange:u=>$(u.target.value)})})}),e.jsxs("span",{className:l.inputUnit,children:["50–10000",n("uiStudio.cleanup.policy.mbUnit","MB")]})]}),e.jsx(v,{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(We,{checked:o.cascadeSnapshots,onChange:u=>y(A=>({...A,cascadeSnapshots:u.target.checked}))}),n("uiStudio.cleanup.policy.cascade","연결된 화면 캡처도 함께 삭제")]})}),e.jsxs("div",{className:l.retentionActions,children:[e.jsx(v,{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 O(),disabled:!U,children:n("uiStudio.cleanup.policy.save","정책 저장")})}),e.jsx(v,{text:n("uiStudio.cleanup.policy.runNow.tooltip","저장된 정리 정책을 다음 자동 실행까지 기다리지 않고 지금 한 번 실행합니다."),children:e.jsx("button",{type:"button",className:l.runNowBtn,onClick:()=>void d(),disabled:g,children:n("uiStudio.cleanup.policy.runNow","저장된 정책으로 정리")})})]}),N&&e.jsx("div",{className:l.errorMsg,children:N})]})]}),x&&b&&e.jsx(Ce,{title:n("uiStudio.cleanup.policy.confirm.title","정책 적용 확인"),message:k,danger:!0,confirmLabel:n("uiStudio.cleanup.policy.save","정책 저장"),busy:E,onConfirm:q,onClose:()=>_(!1)})]})}function Ls({placeId:t,tier:s,onChanged:i,sampleUsage:c,sampleRetention:n,embedded:L=!1}){const{t:o}=X(),y=s==="basic"&&c!=null&&n!=null,[h,z]=r.useState(y?c:null),[f,w]=r.useState(y?n:null),[b,M]=r.useState(null),[x,_]=r.useState(null),[E,D]=r.useState(null),g=r.useCallback(async()=>{if(!y&&t!=null){M(null);try{const[H,I]=await Promise.all([Ne(t),_e(t)]);z(H),w(I.policy)}catch(H){M(H.message)}}},[t,y]);r.useEffect(()=>{g()},[g]);const P=r.useCallback(()=>{g(),i==null||i()},[g,i]),N=r.useCallback(async()=>{if(x&&t!=null){D(null);try{x.kind==="keep7"?await ie(t,{olderThanDays:7,alsoSnapshots:!0}):x.kind==="keep30"?await ie(t,{olderThanDays:30,alsoSnapshots:!0}):await ie(t,{all:!0,alsoSnapshots:!0}),_(null),g(),i==null||i()}catch(H){throw D(H.message),H}}},[x,t,g,i]);function m(H){const I=o("uiStudio.cleanup.studioPreservedNote","This deletes saved change records and screenshots on disk only; Roblox Studio instances are not affected.");return H.kind==="keep7"?`${o("uiStudio.cleanup.cleanupConfirmMessage.keep7","7일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${I}`:H.kind==="keep30"?`${o("uiStudio.cleanup.cleanupConfirmMessage.keep30","30일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${I}`:`${((h==null?void 0:h.requestCount)??0)+((h==null?void 0:h.snapshotCount)??0)}${o("uiStudio.cleanup.cleanupConfirmMessage.all","개의 저장된 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${I}`}if(t==null&&!y)return null;if(b)return e.jsx("div",{className:`${l.card} ${L?l.cardEmbedded:""}`,children:e.jsx("p",{className:l.errorMsg,children:b})});if(!h||!f)return e.jsx("div",{className:`${l.card} ${L?l.cardEmbedded:""}`,children:e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:0},children:o("uiStudio.storage.loading","로딩 중...")})});const R=f.lastRunAt,B=f.lastRunStats,S=R?new Date(R).toLocaleString():null,U=t??0;return e.jsxs("div",{className:`${l.card} ${L?l.cardEmbedded:""}`,children:[!L&&e.jsx("h3",{className:l.cardTitle,children:e.jsx(F,{label:o("uiStudio.storage.title","UI Studio 저장 데이터"),tooltip:o("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(v,{text:o("uiStudio.storage.usageLabel.tooltip","Disk space currently used by UI Studio for this project."),children:e.jsxs("div",{className:l.usageTotal,children:[(h.designCount??0)>0?o("uiStudio.design.cleanupUsage","History and screenshots"):o("uiStudio.storage.usageLabel","사용 중")," ",Q(h.totalBytes)]})}),e.jsxs("div",{className:l.usageBreakdown,children:[e.jsx(v,{text:o("uiStudio.storage.historyBytes.tooltip","Space taken by change record data (JSON)."),children:e.jsxs("span",{children:[o("uiStudio.storage.historyBytes","변경 이력")," ",Q(h.historyBytes)]})})," · ",e.jsx(v,{text:o("uiStudio.storage.snapshotBytes.tooltip","Space taken by captured PNG image files."),children:e.jsxs("span",{children:[o("uiStudio.storage.snapshotBytes","화면 캡처")," ",Q(h.snapshotBytes)]})})]}),e.jsxs("div",{className:l.usageCounts,children:[e.jsx(v,{text:o("uiStudio.storage.requestCount.tooltip","Number of actions where AI changed the UI."),children:e.jsxs("span",{children:[o("uiStudio.storage.requestCount","변경 기록")," ",h.requestCount.toLocaleString(),o("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(v,{text:o("uiStudio.storage.mutationCount.tooltip","Number of detail changes inside actions (one property edit = 1)."),children:e.jsxs("span",{children:[o("uiStudio.storage.mutationCount","변경 상세")," ",h.mutationCount.toLocaleString(),o("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(v,{text:o("uiStudio.storage.snapshotCount.tooltip","Number of saved capture image files."),children:e.jsxs("span",{children:[o("uiStudio.storage.snapshotCount","화면 캡처")," ",h.snapshotCount.toLocaleString(),o("uiStudio.storage.countSuffix","개")]})})]}),(h.designCount??0)>0&&e.jsxs("p",{className:l.usageBreakdown,children:[o("uiStudio.design.saved","Saved designs")," ",h.designCount," · ",Q(h.designBytes??0),e.jsx("br",{}),o("uiStudio.design.cleanupPreserved","Saved designs are kept when history and screenshots are cleared.")]})]})}),e.jsx("section",{className:l.storagePolicyColumn,children:e.jsx(ks,{placeId:U,tier:s,currentPolicy:f,onSaved:P})})]}),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(F,{label:o("uiStudio.storage.lastRun","마지막 자동 정리"),tooltip:o("uiStudio.storage.lastRun.tooltip","When the auto-cleanup policy last ran, and what it removed.")})}),S?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:S}),B&&e.jsxs("span",{children:["· ",o("uiStudio.storage.requestCount","변경 기록")," ",B.removedRequests,o("uiStudio.storage.countSuffix","개")," / ",o("uiStudio.storage.snapshotCount","화면 캡처")," ",B.removedSnapshots,o("uiStudio.storage.countSuffix","개")," / ",Q(B.freedBytes)," ",o("uiStudio.storage.lastRunFreed","회수")]}),B&&B.errors>0&&e.jsxs("span",{className:l.errorIcon,title:`${o("uiStudio.storage.lastRunErrors","오류")} ${B.errors}건`,children:["⚠",e.jsxs("span",{className:l.tooltip,children:[o("uiStudio.storage.lastRunErrors","오류")," ",B.errors,o("uiStudio.storage.countSuffix","건")]})]})]}):e.jsx("span",{children:o("uiStudio.storage.lastRunNever","—")})]}),e.jsxs("div",{className:l.cleanupRow,children:[e.jsx("span",{className:l.cleanupLabel,children:e.jsx(F,{label:o("uiStudio.cleanup.label","수동 정리"),tooltip:o("uiStudio.cleanup.label.tooltip","Manually clean up change records and captures whenever you want.")})}),e.jsx(v,{text:o("uiStudio.cleanup.keep7.tooltip","Delete change records and captures older than 7 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>_({kind:"keep7"}),disabled:s==="basic",children:o("uiStudio.cleanup.keepLastNDays","최근 7일만 남기기").replace("{n}","7")})}),e.jsx(v,{text:o("uiStudio.cleanup.keep30.tooltip","Delete change records and captures older than 30 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>_({kind:"keep30"}),disabled:s==="basic",children:o("uiStudio.cleanup.keepLastNDays","최근 30일만 남기기").replace("{n}","30")})}),!L&&e.jsx(v,{text:o("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:()=>_({kind:"all"}),disabled:s==="basic",children:o("uiStudio.cleanup.deleteAll","전체 삭제…")})})]})]}),E&&e.jsx("div",{className:l.errorMsg,children:E}),x&&e.jsx(Ce,{title:o("uiStudio.cleanup.cleanupConfirmTitle","정리 확인"),message:m(x),danger:!0,confirmLabel:o("common.delete","삭제"),onConfirm:N,onClose:()=>{_(null),D(null)}})]})}function xe(t,s){const i={placeId:String(t)};return s&&(i["preview.mode"]=s.mode,s.mode==="size"&&(i["preview.sizeMb"]=String(s.sizeMb))),Y.get("/api/dashboard/changelog/cleanup",i)}function ve(t){return Y.put("/api/dashboard/changelog/cleanup",t)}function ws(t){return Y.post(`/api/dashboard/changelog/cleanup/run?placeId=${encodeURIComponent(t)}`)}const Ps=[100,500,1e3];function Se(t,s){return t.mode!==s.mode?!1:t.mode==="off"||s.mode==="size"&&t.sizeMb===s.sizeMb}function Rs(t,s){return t.mode==="off"?!1:s.mode==="off"||t.sizeMb<s.sizeMb}function ee(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 Hs({placeId:t,onChanged:s}){const{locale:i,t:c}=X(),[n,L]=r.useState(null),[o,y]=r.useState({mode:"size",sizeMb:500}),[h,z]=r.useState(t!==null),[f,w]=r.useState(!1),[b,M]=r.useState(!1),[x,_]=r.useState(!1),[E,D]=r.useState(!1),[g,P]=r.useState(null),N=r.useCallback(async()=>{if(t===null){L(null),z(!1);return}M(!1);try{const d=await xe(t);L(d),y(d.policy)}catch{M(!0)}finally{z(!1)}},[t]);r.useEffect(()=>{z(t!==null),N()},[N,t]);const m=r.useCallback(async d=>{w(!0),_(!1),D(!1);try{await ve(d),P(null),await N(),D(!0),s==null||s()}catch{_(!0)}finally{w(!1)}},[N,s]),R=r.useCallback(async()=>{if(!(!n||t===null||Se(o,n.policy))){w(!0),_(!1),D(!1);try{if(Rs(o,n.policy)){const d=await xe(t,o);if(d.preview.affectedPlaceCount>0){P({policy:o,preview:d});return}}await ve(o),await N(),D(!0),s==null||s()}catch{_(!0)}finally{w(!1)}}},[n,o,N,s,t]),B=r.useCallback(async()=>{if(t!==null){w(!0),_(!1),D(!1);try{await ws(t),await N(),s==null||s()}catch{_(!0)}finally{w(!1)}}},[N,s,t]),S=n==null?void 0:n.selectedPlace.currentUsage,U=(n==null?void 0:n.policy.mode)==="size"?n.policy.sizeMb*1e6:null,H=U??Math.max((S==null?void 0:S.bytes)??0,1),I=Math.min(100,((S==null?void 0:S.sessionBytes)??0)/H*100),G=Math.min(Math.max(0,100-I),((S==null?void 0:S.contextBytes)??0)/H*100),T=n?!Se(o,n.policy):!1,$=d=>d.mode==="off"?c("settings.projectChanges.cleanup.unlimited","Unlimited"):`${d.sizeMb} MB`,O=r.useMemo(()=>{if(!g)return"";const d=g.preview.preview,k=c("settings.projectChanges.cleanup.confirm.message","{places} Places · {sessions} sessions · {bytes} expected to be freed.").replace("{places}",d.affectedPlaceCount.toLocaleString()).replace("{sessions}",d.deleteSessionCount.toLocaleString()).replace("{bytes}",ee(d.estimatedFreedBytes));return d.wouldRemainOverLimitPlaceCount===0?k:`${k} ${c("settings.projectChanges.cleanup.confirm.protected","{places} Place may remain over the limit because active data is protected.").replace("{places}",d.wouldRemainOverLimitPlaceCount.toLocaleString())}`},[g,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(h)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:c("settings.projectChanges.cleanup.loading","Loading storage settings…")})});if(b||!n||!S)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:()=>{z(!0),N()},children:c("common.retry","Retry")})]});const q=U===null?c("settings.projectChanges.cleanup.usageUnlimited","{used} used · Unlimited").replace("{used}",ee(S.bytes)):c("settings.projectChanges.cleanup.usageLimited","{used} used of {limit}").replace("{used}",ee(S.bytes)).replace("{limit}",$(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(F,{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:q}),e.jsxs("div",{className:a.projectChangesQuotaRail,role:"meter","aria-label":c("settings.projectChanges.cleanup.usageAria","Place storage usage"),"aria-valuemin":0,"aria-valuenow":S.bytes,"aria-valuemax":U??S.bytes,children:[e.jsx("span",{className:a.projectChangesSessionRail,style:{width:`${I}%`}}),e.jsx("span",{className:a.projectChangesContextRail,style:{width:`${G}%`}})]}),e.jsxs("div",{className:a.projectChangesUsageLegend,children:[e.jsxs("span",{children:[c("settings.projectChanges.cleanup.sessions","Sessions")," ",e.jsx("strong",{children:ee(S.sessionBytes)})]}),e.jsxs("span",{children:[c("settings.projectChanges.cleanup.contexts","Contexts")," ",e.jsx("strong",{children:ee(S.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:f,children:[e.jsx("legend",{className:a.projectChangesPolicyLegend,children:c("settings.projectChanges.cleanup.limit","Limit per Place")}),e.jsxs("div",{className:a.projectChangesPresetGroup,children:[Ps.map(d=>{const k=o.mode==="size"&&o.sizeMb===d;return e.jsx("button",{className:`${a.projectChangesPresetButton} ${k?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":k,onClick:()=>y({mode:"size",sizeMb:d}),children:c("settings.projectChanges.cleanup.preset","{sizeMb}MB").replace("{sizeMb}",String(d))},d)}),e.jsx("button",{className:`${a.projectChangesPresetButton} ${o.mode==="off"?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":o.mode==="off",onClick:()=>y({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:!T||f,onClick:()=>void R(),children:c("common.save","Save")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",disabled:f,onClick:()=>void B(),children:c("settings.projectChanges.cleanup.runNow","Run saved policy")}),E&&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(i)," · ",c("settings.projectChanges.cleanup.lastRunSummary","{sessions} sessions · {bytes} freed").replace("{sessions}",n.selectedPlace.lastRun.deletedSessionCount.toLocaleString()).replace("{bytes}",ee(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(he,{open:g!==null,title:c("settings.projectChanges.cleanup.confirm.title","Apply this limit and clean saved changes?"),message:O,cancelLabel:c("common.cancel","Cancel"),confirmLabel:c("settings.projectChanges.cleanup.confirm.apply","Apply and clean"),loading:f,onCancel:()=>!f&&P(null),onConfirm:()=>{g&&m(g.policy)}})]})}const zs={toolsActivity:null,toolStats:null,toolSessions:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null},Ds={toolsActivity:null,toolStats:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null};function As(t){var s;return t?t.pluginConnected?t.activePlaceId:t.lastActivePlaceId??((s=t.places[0])==null?void 0:s.placeId)??null:null}async function Z(t){try{return await t}catch{return null}}function oe(t){return t?typeof t.total=="number"?t.total:Array.isArray(t.entries)?t.entries.length:null:null}function ne(t,s,i,c){return s===null?t("settings.dataHistory.metric.unavailable","Unavailable"):`${s.toLocaleString()} ${t(i,c)}`}function te(t,s,i){const c=i===null?t("settings.dataHistory.metric.sizeUnavailable","size unavailable"):Q(i);return`${s} · ${c}`}function se(t,s){var c;const i=(c=t==null?void 0:t[s])==null?void 0:c.bytes;return typeof i=="number"&&Number.isFinite(i)?i:null}function Bs(t,s){return s?[`${s.requestCount.toLocaleString()} ${t("uiStudio.storage.requestCount","change records")}`,`${s.snapshotCount.toLocaleString()} ${t("uiStudio.storage.snapshotCount","screenshots")}`,Q(s.totalBytes)].join(" · "):t("settings.dataHistory.metric.unavailable","Unavailable")}function $s({tier:t}){const{t:s}=X(),[i,c]=r.useState(zs),[n,L]=r.useState(Ds),[o,y]=r.useState(t==="basic"?le:null),[h,z]=r.useState(null),[f,w]=r.useState(!0),[b,M]=r.useState(!0),[x,_]=r.useState(null),[E,D]=r.useState(()=>new Set),[g,P]=r.useState(null),[N,m]=r.useState(!1),[R,B]=r.useState(null),S=r.useCallback(async()=>{w(!0);const d=await Z(De()),k=As(d);z(k);const[J,K,u,A,W,ae,V]=await Promise.all([Z(Y.get("/api/dashboard/history",{limit:"1",offset:"0"})),Z(Y.get("/api/dashboard/tool-stats")),Z(Y.get("/sync/history",{limit:"1",offset:"0"})),Z(Y.get("/api/dashboard/playtest/history")),Z(Y.get("/api/dashboard/changelog",{limit:"1",offset:"0"})),Z(Y.get("/api/dashboard/connection-log")),Z(Y.get("/api/dashboard/storage-summary"))]),p=t==="basic"?le:k===null?null:await Z(Ne(k));c({toolsActivity:oe(J),toolStats:(K==null?void 0:K.totalCalls)??null,toolSessions:(K==null?void 0:K.totalSessions)??null,syncLog:oe(u),playtestReports:oe(A),projectChanges:oe(W),connectionLog:oe(ae)}),L({toolsActivity:se(V,"toolsActivity"),toolStats:se(V,"toolStats"),syncLog:se(V,"syncLog"),playtestReports:se(V,"playtestReports"),projectChanges:se(V,"projectChanges"),connectionLog:se(V,"connectionLog")}),y(p),w(!1)},[t]);r.useEffect(()=>{S()},[S]);const U=r.useCallback(d=>{D(k=>{if(k.has(d))return k;const J=new Set(k);return J.add(d),J}),_(k=>k===d?null:d)},[]),H=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:te(s,ne(s,i.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:te(s,i.toolStats===null?s("settings.dataHistory.metric.unavailable","Unavailable"):`${i.toolStats.toLocaleString()} ${s("settings.dataHistory.metric.runs","runs")} · ${(i.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:te(s,ne(s,i.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:te(s,ne(s,i.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:te(s,ne(s,i.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:te(s,ne(s,i.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"}],[i,n,s]),I=async()=>{if(g){m(!0),B(null);try{if(g.kind==="uiStudio"){if(t!=="pro"||h===null)throw new Error("UI Studio place is unavailable");await ie(h,{all:!0,alsoSnapshots:!0}),B(s("settings.dataHistory.uiStudio.clear.success","UI Studio saved data cleared."))}else{const d=g.row.key==="projectChanges";if(d&&h===null)throw new Error("Project changes place is unavailable");let k=g.row.clearEndpoint;d&&h!==null&&(k=`${k}?placeId=${encodeURIComponent(h)}`),await Y.post(k),B(d?s("settings.dataHistory.projectChanges.clear.success","Project change summaries cleared."):s("settings.dataHistory.clear.success","Saved data cleared."))}P(null),await S()}catch{B(g.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{m(!1)}}},G=t==="pro"?h:0,T=t==="pro"&&h!==null,$=(g==null?void 0:g.kind)==="uiStudio",O=(g==null?void 0:g.kind)==="row"&&g.row.key==="projectChanges",q=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(F,{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(v,{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:f?s("common.loading","Loading"):s("settings.dataHistory.scope","Current project")})}),e.jsx(v,{text:s("settings.dataHistory.toggle.tooltip","Collapse or expand this section."),children:e.jsx("button",{className:a.collapseButton,type:"button","aria-expanded":b,"aria-controls":"settings-data-history-body","aria-label":b?s("settings.dataHistory.collapse","Collapse {title}").replace("{title}",q):s("settings.dataHistory.expand","Expand {title}").replace("{title}",q),onClick:()=>M(d=>!d),children:b?"▾":"▸"})})]})]}),b&&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:[H.map(d=>e.jsxs(r.Fragment,{children:[e.jsxs("div",{className:`${a.dataHistoryRow} ${d.key==="projectChanges"&&x==="projectChanges"?a.dataHistoryRowExpanded:""}`,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:d.title}),e.jsx("div",{className:a.dataHistoryDescription,children:d.description})]}),e.jsx(v,{text:d.metricTooltip,children:e.jsx("div",{className:a.dataHistoryMetric,children:d.metric})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(v,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:`#${d.route}`,children:s("settings.dataHistory.open","Open")})}),d.key==="projectChanges"&&e.jsx(v,{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:()=>U("projectChanges"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="projectChanges"?"▴":"▾"})]})}),e.jsx(v,{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:d.key==="projectChanges"&&h===null,onClick:()=>P({kind:"row",row:d}),children:d.key==="projectChanges"?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear")})})]})]}),d.key==="projectChanges"&&E.has("projectChanges")&&e.jsx("div",{id:"settings-project-changes-storage",className:`${a.dataHistoryDetail} ${a.projectChangesDataHistoryDetail}`,hidden:x!=="projectChanges",children:e.jsx(Hs,{placeId:h,onChanged:S})})]},d.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(v,{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:Bs(s,o)})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(v,{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(v,{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:()=>U("uiStudio"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="uiStudio"?"▴":"▾"})]})}),e.jsx(v,{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:!T,onClick:()=>P({kind:"uiStudio"}),children:s("settings.dataHistory.clearAll","Clear all")})})]})]}),E.has("uiStudio")&&e.jsx("div",{id:"settings-ui-studio-storage",className:`${a.dataHistoryDetail} ${a.uiStudioDataHistoryDetail}`,hidden:x!=="uiStudio",children:e.jsx(Ls,{placeId:G,tier:t,onChanged:S,embedded:!0,...t==="basic"?{sampleUsage:le,sampleRetention:Ve}:{}})})]}),R&&e.jsx("p",{className:a.inlineStatus,children:R})]})]}),e.jsx(he,{open:g!==null,title:$?s("settings.dataHistory.uiStudio.clear.title","Clear UI Studio saved data?"):O?s("settings.dataHistory.projectChanges.clear.title","Clear project change summaries?"):s("settings.dataHistory.clear.title","Clear saved data?"),message:$?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."):O?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:O||$?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear"),loading:N,onCancel:()=>!N&&P(null),onConfirm:()=>void I()})]})}const Es=r.forwardRef(function({autoOpen:s,settingsFilePath:i,saving:c,targeted:n,updateDashboardPreferences:L},o){const{t:y}=X(),[h,z]=r.useState("idle"),f="settings-dashboard-auto-open-label",w=c||h==="saving",b=async x=>{z("saving");try{await L({autoOpen:x}),z("saved")}catch{z("error")}},M=h==="saving"?y("settings.dashboard.autoOpen.saving","Saving…"):h==="saved"?y("settings.dashboard.autoOpen.saved","Saved for the next server start."):h==="error"?y("settings.dashboard.autoOpen.error","Could not save. The previous setting was restored."):" ";return e.jsxs("div",{id:"settings-dashboard",ref:o,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(F,{label:y("settings.dashboard.title","Dashboard"),tooltip:y("settings.dashboard.title.tooltip","Choose how WEPPY Dashboard behaves when the MCP Server starts.")}),e.jsx(v,{text:y("settings.dashboard.autoOpen.nextStart","Applies the next time the MCP Server starts."),children:e.jsx("span",{className:a.headerBadge,children:y("settings.dashboard.nextStartBadge","Next Start")})})]}),e.jsxs("div",{className:a.dashboardSettingRow,children:[e.jsxs("div",{className:a.dashboardSettingCopy,children:[e.jsx("span",{id:f,className:a.dashboardSettingLabel,children:y("settings.dashboard.autoOpen.label","Open Dashboard when WEPPY starts")}),e.jsx("span",{className:a.dashboardSettingDescription,children:y("settings.dashboard.autoOpen.description","Automatically opens this Dashboard after the MCP Server starts.")}),e.jsx("span",{className:a.dashboardSettingMeta,children:y("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":f,checked:s,disabled:w,onChange:x=>{b(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:y("settings.dashboard.settingsFile.label","Settings file")}),e.jsx("dd",{children:e.jsx("code",{className:a.dashboardSettingsFilePath,children:i})})]}),e.jsxs("div",{className:a.dashboardDetailRow,children:[e.jsx("dt",{children:y("settings.dashboard.agentExample.label","Ask your Agent")}),e.jsx("dd",{className:a.dashboardAgentPrompt,children:y("settings.dashboard.agentExample.prompt","“Turn off Dashboard auto-open.”")})]})]}),e.jsx("p",{className:`${a.dashboardSaveFeedback} ${h==="error"?a.dashboardSaveFeedbackError:""}`,"aria-live":"polite",children:M})]})}),Ts={en:"English",ko:"한국어",es:"Español","pt-br":"Português (BR)",ja:"日本語",id:"Bahasa Indonesia",de:"Deutsch","fr-fr":"Français"};function Qs(){const{t,selectedLocale:s,setLocale:i}=X(),{search:c}=Ae(),{settings:n,license:L,licenseControlsDisabled:o,licenseSubmitting:y,licenseRecords:h=[],activateLicense:z,refreshLicense:f,resetLicense:w,saving:b,updateDashboardPreferences:M,loading:x}=Fe(),_=(L==null?void 0:L.tier)==="pro"?"pro":"basic",E=r.useRef(null),D=r.useRef(null),g=r.useRef(null),P=r.useMemo(()=>new URLSearchParams(c).get("section")==="license",[c]),N=r.useMemo(()=>new URLSearchParams(c).get("section")==="dashboard",[c]);return r.useEffect(()=>{var R;if(!P||x)return;const m=E.current;if((R=m==null?void 0:m.scrollIntoView)==null||R.call(m,{block:"start",behavior:"smooth"}),g.current&&!g.current.disabled){g.current.focus();return}m==null||m.focus()},[x,o,y,P]),r.useEffect(()=>{var R;if(!N||x)return;const m=D.current;(R=m==null?void 0:m.scrollIntoView)==null||R.call(m,{block:"start",behavior:"smooth"}),m==null||m.focus()},[x,N]),x?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(Ye,{title:t("page.settings.title","Settings"),description:t("page.settings.description","Manage license, saved data, server environment, and language."),helpTopicId:"settings",helpState:{tier:_}}),e.jsx(Mt,{license:L,records:h,disabled:o,submitting:y,targeted:P,cardRef:E,inputRef:g,activate:z,refresh:f,reset:w}),e.jsx($s,{tier:_}),n&&e.jsx(Es,{ref:D,autoOpen:n.dashboard.autoOpen,settingsFilePath:n.dashboard.settingsFilePath,saving:b,targeted:N,updateDashboardPreferences:M}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(F,{label:t("settings.cold.title","Server Environment"),tooltip:t("settings.cold.title.tooltip","Read-only server environment values loaded at startup.")}),e.jsx(v,{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")})})]}),n?e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.coldGrid,children:[e.jsx("dt",{children:e.jsx(F,{label:"HTTP_PORT",tooltip:t("settings.cold.httpPort.tooltip","Port number used by the MCP WEPPY Dashboard HTTP server.")})}),e.jsx("dd",{children:n.cold.HTTP_PORT}),e.jsx("dt",{children:e.jsx(F,{label:"HTTP_HOST",tooltip:t("settings.cold.httpHost.tooltip","Host interface that the MCP WEPPY Dashboard HTTP server binds to.")})}),e.jsx("dd",{children:n.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(F,{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(F,{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(v,{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:m=>i(m.target.value),children:[e.jsx("option",{value:Be,children:t("settings.language.auto","Auto")}),$e.map(m=>e.jsx("option",{value:m,children:Ts[m]??m},m))]})})]})]}),e.jsxs("p",{className:a.licenseNotices,children:[t("settings.notices.description","WEPPY uses open-source components.")," ",e.jsx("a",{href:"/dashboard/THIRD_PARTY_NOTICES.txt",target:"_blank",rel:"noopener noreferrer",children:t("settings.notices.open","View open-source notices")})]})]})}export{Qs as Component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,d as z,h as ne,D as fe,u as ie,j as e,b as _e,a as Se,f as ve,k as xe,T as je}from"./index-B-46k2zD.js";import{B as H,a as J,P as we}from"./PageHeader-C7zSPJ0K.js";import{I as Z}from"./InfoLabel-xpwjU19F.js";import{T as O}from"./TooltipText-CKbtCUcM.js";import{C as pe}from"./ConfirmModal-EJt_S9vY.js";import{T as Ne}from"./TierPromoPanel-Cj3f7idb.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,d as z,h as ne,D as fe,u as ie,j as e,b as _e,a as Se,f as ve,k as xe,T as je}from"./index-CfT3smRY.js";import{B as H,a as J,P as we}from"./PageHeader-plAaGWcw.js";import{I as Z}from"./InfoLabel-C9QuVrs9.js";import{T as O}from"./TooltipText-Btgvmrqc.js";import{C as pe}from"./ConfirmModal-BSuAB3WU.js";import{T as Ne}from"./TierPromoPanel-DUwTC3Zz.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 W,r as f,j as a,G as O,J as U,g as z,w as G,p as V,q as k,t as A}from"./index-B-46k2zD.js";import{B as w}from"./PageHeader-C7zSPJ0K.js";import{P as Y,a as H}from"./PlaceSelectOptions-e39l4_SC.js";const J="_scope_1i8qy_1",Q="_main_1i8qy_13",X="_label_1i8qy_22",Z="_selectorLabel_1i8qy_30",ee="_placeSelect_1i8qy_38",ce="_name_1i8qy_54",le="_id_1i8qy_65",ae="_scopeBadge_1i8qy_72",te="_copy_1i8qy_76",ne="_note_1i8qy_88",se="_folderDetails_1i8qy_92",oe="_shortcuts_1i8qy_96",re="_shortcutsTrigger_1i8qy_103",ie="_shortcutLink_1i8qy_126",pe="_shortcutsPopover_1i8qy_131",o={scope:J,main:Q,label:X,selectorLabel:Z,placeSelect:ee,name:ce,id:le,scopeBadge:ae,copy:te,note:ne,folderDetails:se,shortcuts:oe,shortcutsTrigger:re,shortcutLink:ie,shortcutsPopover:pe};function R(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function h(e,c){return V(e.places,c)}function M(e){var c;return e.lastActivePlaceId!==null?e.lastActivePlaceId:((c=e.places[0])==null?void 0:c.placeId)??null}function L(e){var c;if(e.pluginConnected&&e.activePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.activePlaceId);if(h(e,e.activePlaceId)||l.length===0)return e.activePlaceId}if(e.lastActivePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.lastActivePlaceId);if(h(e,e.lastActivePlaceId)||l.length===0)return e.lastActivePlaceId}return((c=G(e.places))==null?void 0:c.placeId)??null}function de(e,c,l){var n;return c?((n=h(e,typeof l=="number"?l:null))==null?void 0:n.placeId)??L(e):e.pluginConnected&&e.activePlaceId!==null?e.activePlaceId:M(e)}function D(e,c){const l=h(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 ue(e,c,l){if(!R(e))return[];const n=[];return R(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 fe(e,c){if(e.pluginConnected&&e.activePlaceId!==null){const s=h(e,e.activePlaceId),t=s?k(e.places,s.placeId):!1,i=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?i:s==null?void 0:s.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.connected","Studio connected"),connected:(s==null?void 0:s.isConnected)??!0,folderUnresolved:t,hasSyncMetadata:s?A(e.places,s):void 0,note:null}}const l=M(e),n=h(e,l);if(l!==null){const s=l===e.lastActivePlaceId?e.lastActivePlaceName:null,t=n?k(e.places,n.placeId):!1,i=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(l));return{label:c("placeScope.lastActive.label","Last Active Place"),placeId:l,placeName:s??(t?i:n==null?void 0:n.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.stored","Stored data"),connected:!1,folderUnresolved:t,hasSyncMetadata:n?A(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 ve(e,c,l){const n=typeof c=="number"?h(e,c):null,s=L(e),t=(n==null?void 0:n.placeId)??s,i=h(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 b=(i==null?void 0:i.isConnected)??!1,u=e.activePlaceId===t,d=t===e.lastActivePlaceId?e.lastActivePlaceName:null,v=u?e.activePlaceName:null,P=i?k(e.places,i.placeId):!1,_=l("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(t));return{label:u?l("placeScope.current.label","Current Place"):l("placeScope.selected.label","Selected Place"),placeId:t,placeName:v??d??(P?_:i==null?void 0:i.placeName)??l("placeScope.unknownPlace","Unknown place"),badge:b?l("placeScope.connected","Studio connected"):l("placeScope.stored","Stored data"),connected:b,folderUnresolved:P,hasSyncMetadata:i?A(e.places,i):void 0,note:b?null:l("placeScope.stored.note","No connected Studio currently has this place open.")}}function he(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 je({surface:e,selectable:c=!1,selectedPlaceId:l=null,onSelectedPlaceIdChange:n}){const{t:s}=W(),[t,i]=f.useState(null),[b,u]=f.useState(!0),[d,v]=f.useState(null),P=f.useRef(null),_=f.useRef(null),B=f.useId();f.useEffect(()=>{let r=!1;async function S(){try{const x=await z();r||i(x)}catch{r||i(null)}finally{r||u(!1)}}return S(),()=>{r=!0}},[]),f.useEffect(()=>{if(!c||!t)return;const r=L(t);(typeof l!="number"||!h(t,l))&&l!==r&&(n==null||n(r))},[n,c,l,t]);const E=t?de(t,c,l):null,m=t?D(t,E):null,j=`${E??"none"}:${m??"none"}`;if(f.useEffect(()=>{v(r=>r===j?r:null)},[j]),f.useEffect(()=>{function r(){v(null)}function S(I){var g;d!==null&&!((g=P.current)!=null&&g.contains(I.target))&&r()}function x(I){var g;d!==null&&I.key==="Escape"&&(I.preventDefault(),r(),(g=_.current)==null||g.focus())}return document.addEventListener("pointerdown",S),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",x)}},[d]),b)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.loading","Loading place scope...")})});if(!t)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.unavailable","Place scope unavailable")})});const p=c?ve(t,l,s):fe(t,s),$=O(t),C=typeof p.placeId=="number"?String(p.placeId):"",F=c&&t.places.length>0,K=D(t,p.placeId),q=ue(p.placeId,K,s),T=j,y=d===T;return a.jsxs("div",{className:o.scope,"aria-live":"polite",children:[a.jsxs("div",{className:o.main,children:[F?a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:o.selectorLabel,children:[a.jsx("span",{className:o.label,children:s("placeScope.selector.label","Place data")}),a.jsxs("select",{className:o.placeSelect,value:C,onChange:r=>{const S=Number.parseInt(r.currentTarget.value,10);v(null),n==null||n(Number.isInteger(S)?S:null)},children:[p.placeId===null?a.jsx("option",{value:"",disabled:!0,children:s("placeScope.selector.noneSelectable","No selectable Place folder")}):null,a.jsx(Y,{places:t.places,confirmedNames:$,t:s})]})]}),a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}),p.placeId!==null?a.jsx("span",{className:o.id,children:p.placeId}):null,a.jsx(w,{variant:p.connected?"success":"neutral",shape:"pill",className:o.scopeBadge,children:p.badge}),p.folderUnresolved?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.unresolved","Representative folder unconfirmed")}):null,p.hasSyncMetadata===!1?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.noSyncHistory","No sync history")}):null]}),a.jsxs("div",{className:o.copy,children:[a.jsx("span",{children:he(e,s)}),p.note?a.jsx("span",{className:o.note,children:p.note}):null]}),t.places.some(r=>U(r)==="duplicate"||U(r)==="unresolved")?a.jsx("div",{className:o.folderDetails,children:a.jsx(H,{places:t.places,t:s})}):null,q.length>0?a.jsxs("div",{className:o.shortcuts,ref:P,children:[a.jsxs("button",{ref:_,type:"button",className:o.shortcutsTrigger,"aria-controls":B,"aria-expanded":y,onClick:()=>{v(y?null:T)},children:[s("placeScope.shortcuts.trigger","Quick links"),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),y?a.jsx("div",{id:B,className:o.shortcutsPopover,role:"group","aria-label":s("placeScope.shortcuts.label","Place shortcuts"),children:q.map(r=>a.jsxs("a",{className:o.shortcutLink,href:r.href,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{children:r.label}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]},r.href))}):null]}):null]})}const be="_tabBar_jefog_2",Se="_tabs_jefog_9",Pe="_actions_jefog_14",ge="_tab_jefog_2",Ne="_tabActive_jefog_52",N={tabBar:be,tabs:Se,actions:Pe,tab:ge,tabActive:Ne};function ye({items:e,value:c,onChange:l,ariaLabel:n,className:s,rightActions:t}){const i=f.useRef(null),b=f.useRef(null);return f.useEffect(()=>{const u=()=>{const d=i.current,v=b.current;!d||!v||typeof d.scrollTo!="function"||d.scrollTo({left:Math.max(0,v.offsetLeft+v.offsetWidth/2-d.clientWidth/2),behavior:"auto"})};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[c]),a.jsxs("div",{ref:i,className:[N.tabBar,s].filter(Boolean).join(" "),role:"tablist","aria-label":n,children:[a.jsx("div",{className:N.tabs,children:e.map(u=>{const d=u.key===c;return a.jsx("button",{ref:d?b:void 0,type:"button",role:"tab","aria-selected":d,"data-testid":u.testId,className:[N.tab,d?N.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(u.key),children:u.label},u.key)})}),t?a.jsx("div",{className:N.actions,children:t}):null]})}export{je as C,ye as T};
|
|
1
|
+
import{u as W,r as f,j as a,G as O,J as U,g as z,w as G,p as V,q as k,t as A}from"./index-CfT3smRY.js";import{B as w}from"./PageHeader-plAaGWcw.js";import{P as Y,a as H}from"./PlaceSelectOptions-Bh6TVGoa.js";const J="_scope_1i8qy_1",Q="_main_1i8qy_13",X="_label_1i8qy_22",Z="_selectorLabel_1i8qy_30",ee="_placeSelect_1i8qy_38",ce="_name_1i8qy_54",le="_id_1i8qy_65",ae="_scopeBadge_1i8qy_72",te="_copy_1i8qy_76",ne="_note_1i8qy_88",se="_folderDetails_1i8qy_92",oe="_shortcuts_1i8qy_96",re="_shortcutsTrigger_1i8qy_103",ie="_shortcutLink_1i8qy_126",pe="_shortcutsPopover_1i8qy_131",o={scope:J,main:Q,label:X,selectorLabel:Z,placeSelect:ee,name:ce,id:le,scopeBadge:ae,copy:te,note:ne,folderDetails:se,shortcuts:oe,shortcutsTrigger:re,shortcutLink:ie,shortcutsPopover:pe};function R(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function h(e,c){return V(e.places,c)}function M(e){var c;return e.lastActivePlaceId!==null?e.lastActivePlaceId:((c=e.places[0])==null?void 0:c.placeId)??null}function L(e){var c;if(e.pluginConnected&&e.activePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.activePlaceId);if(h(e,e.activePlaceId)||l.length===0)return e.activePlaceId}if(e.lastActivePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.lastActivePlaceId);if(h(e,e.lastActivePlaceId)||l.length===0)return e.lastActivePlaceId}return((c=G(e.places))==null?void 0:c.placeId)??null}function de(e,c,l){var n;return c?((n=h(e,typeof l=="number"?l:null))==null?void 0:n.placeId)??L(e):e.pluginConnected&&e.activePlaceId!==null?e.activePlaceId:M(e)}function D(e,c){const l=h(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 ue(e,c,l){if(!R(e))return[];const n=[];return R(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 fe(e,c){if(e.pluginConnected&&e.activePlaceId!==null){const s=h(e,e.activePlaceId),t=s?k(e.places,s.placeId):!1,i=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?i:s==null?void 0:s.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.connected","Studio connected"),connected:(s==null?void 0:s.isConnected)??!0,folderUnresolved:t,hasSyncMetadata:s?A(e.places,s):void 0,note:null}}const l=M(e),n=h(e,l);if(l!==null){const s=l===e.lastActivePlaceId?e.lastActivePlaceName:null,t=n?k(e.places,n.placeId):!1,i=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(l));return{label:c("placeScope.lastActive.label","Last Active Place"),placeId:l,placeName:s??(t?i:n==null?void 0:n.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.stored","Stored data"),connected:!1,folderUnresolved:t,hasSyncMetadata:n?A(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 ve(e,c,l){const n=typeof c=="number"?h(e,c):null,s=L(e),t=(n==null?void 0:n.placeId)??s,i=h(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 b=(i==null?void 0:i.isConnected)??!1,u=e.activePlaceId===t,d=t===e.lastActivePlaceId?e.lastActivePlaceName:null,v=u?e.activePlaceName:null,P=i?k(e.places,i.placeId):!1,_=l("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(t));return{label:u?l("placeScope.current.label","Current Place"):l("placeScope.selected.label","Selected Place"),placeId:t,placeName:v??d??(P?_:i==null?void 0:i.placeName)??l("placeScope.unknownPlace","Unknown place"),badge:b?l("placeScope.connected","Studio connected"):l("placeScope.stored","Stored data"),connected:b,folderUnresolved:P,hasSyncMetadata:i?A(e.places,i):void 0,note:b?null:l("placeScope.stored.note","No connected Studio currently has this place open.")}}function he(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 je({surface:e,selectable:c=!1,selectedPlaceId:l=null,onSelectedPlaceIdChange:n}){const{t:s}=W(),[t,i]=f.useState(null),[b,u]=f.useState(!0),[d,v]=f.useState(null),P=f.useRef(null),_=f.useRef(null),B=f.useId();f.useEffect(()=>{let r=!1;async function S(){try{const x=await z();r||i(x)}catch{r||i(null)}finally{r||u(!1)}}return S(),()=>{r=!0}},[]),f.useEffect(()=>{if(!c||!t)return;const r=L(t);(typeof l!="number"||!h(t,l))&&l!==r&&(n==null||n(r))},[n,c,l,t]);const E=t?de(t,c,l):null,m=t?D(t,E):null,j=`${E??"none"}:${m??"none"}`;if(f.useEffect(()=>{v(r=>r===j?r:null)},[j]),f.useEffect(()=>{function r(){v(null)}function S(I){var g;d!==null&&!((g=P.current)!=null&&g.contains(I.target))&&r()}function x(I){var g;d!==null&&I.key==="Escape"&&(I.preventDefault(),r(),(g=_.current)==null||g.focus())}return document.addEventListener("pointerdown",S),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",x)}},[d]),b)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.loading","Loading place scope...")})});if(!t)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.unavailable","Place scope unavailable")})});const p=c?ve(t,l,s):fe(t,s),$=O(t),C=typeof p.placeId=="number"?String(p.placeId):"",F=c&&t.places.length>0,K=D(t,p.placeId),q=ue(p.placeId,K,s),T=j,y=d===T;return a.jsxs("div",{className:o.scope,"aria-live":"polite",children:[a.jsxs("div",{className:o.main,children:[F?a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:o.selectorLabel,children:[a.jsx("span",{className:o.label,children:s("placeScope.selector.label","Place data")}),a.jsxs("select",{className:o.placeSelect,value:C,onChange:r=>{const S=Number.parseInt(r.currentTarget.value,10);v(null),n==null||n(Number.isInteger(S)?S:null)},children:[p.placeId===null?a.jsx("option",{value:"",disabled:!0,children:s("placeScope.selector.noneSelectable","No selectable Place folder")}):null,a.jsx(Y,{places:t.places,confirmedNames:$,t:s})]})]}),a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}),p.placeId!==null?a.jsx("span",{className:o.id,children:p.placeId}):null,a.jsx(w,{variant:p.connected?"success":"neutral",shape:"pill",className:o.scopeBadge,children:p.badge}),p.folderUnresolved?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.unresolved","Representative folder unconfirmed")}):null,p.hasSyncMetadata===!1?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.noSyncHistory","No sync history")}):null]}),a.jsxs("div",{className:o.copy,children:[a.jsx("span",{children:he(e,s)}),p.note?a.jsx("span",{className:o.note,children:p.note}):null]}),t.places.some(r=>U(r)==="duplicate"||U(r)==="unresolved")?a.jsx("div",{className:o.folderDetails,children:a.jsx(H,{places:t.places,t:s})}):null,q.length>0?a.jsxs("div",{className:o.shortcuts,ref:P,children:[a.jsxs("button",{ref:_,type:"button",className:o.shortcutsTrigger,"aria-controls":B,"aria-expanded":y,onClick:()=>{v(y?null:T)},children:[s("placeScope.shortcuts.trigger","Quick links"),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),y?a.jsx("div",{id:B,className:o.shortcutsPopover,role:"group","aria-label":s("placeScope.shortcuts.label","Place shortcuts"),children:q.map(r=>a.jsxs("a",{className:o.shortcutLink,href:r.href,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{children:r.label}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]},r.href))}):null]}):null]})}const be="_tabBar_jefog_2",Se="_tabs_jefog_9",Pe="_actions_jefog_14",ge="_tab_jefog_2",Ne="_tabActive_jefog_52",N={tabBar:be,tabs:Se,actions:Pe,tab:ge,tabActive:Ne};function ye({items:e,value:c,onChange:l,ariaLabel:n,className:s,rightActions:t}){const i=f.useRef(null),b=f.useRef(null);return f.useEffect(()=>{const u=()=>{const d=i.current,v=b.current;!d||!v||typeof d.scrollTo!="function"||d.scrollTo({left:Math.max(0,v.offsetLeft+v.offsetWidth/2-d.clientWidth/2),behavior:"auto"})};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[c]),a.jsxs("div",{ref:i,className:[N.tabBar,s].filter(Boolean).join(" "),role:"tablist","aria-label":n,children:[a.jsx("div",{className:N.tabs,children:e.map(u=>{const d=u.key===c;return a.jsx("button",{ref:d?b:void 0,type:"button",role:"tab","aria-selected":d,"data-testid":u.testId,className:[N.tab,d?N.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(u.key),children:u.label},u.key)})}),t?a.jsx("div",{className:N.actions,children:t}):null]})}export{je as C,ye as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as m,e as d,B as h,j as n}from"./index-
|
|
1
|
+
import{b as m,e as d,B as h,j as n}from"./index-CfT3smRY.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};
|