import{q as xe,s as q,v as Le,r as p,u as D,j as t,i as H,R as $e,T as Se,l as Ee,w as He}from"./index-BIVkyPD7.js";import{I as B}from"./InfoLabel-BkXtpBzT.js";import{T as y}from"./TooltipText-59Xfc1Ui.js";import{D as se,c as oe,e as Oe,g as Fe,h as Ue,i as le,j as je,k as ze,l as ce,d as qe}from"./sample-requests-DyHFY41o.js";import{X as Ve}from"./x-sRJSvoLm.js";import{T as We}from"./Tabs-B4kZyHzy.js";/**
 * @license lucide-react v1.8.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ke=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Qe=xe("camera",Ke);/**
 * @license lucide-react v1.8.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ye=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Je=xe("ellipsis",Ye);async function we(e){const i=await fetch(`${q}${e}`);if(!i.ok){let a=null;try{a=await i.json()}catch{}throw new Le(i.status,(a==null?void 0:a.message)??i.statusText,(a==null?void 0:a.error)??null,a)}return await i.json()}function O(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Xe(e){return e.design_check_summary?{priority_high:O(e.design_check_summary.priority_high),priority_medium:O(e.design_check_summary.priority_medium),priority_low:O(e.design_check_summary.priority_low)}:e.lint_summary?{priority_high:O(e.lint_summary.errors),priority_medium:O(e.lint_summary.warnings),priority_low:0}:null}function Ze(e){return{rule:e.rule,path:e.path,displayPriority:e.displayPriority??(e.severity==="error"?"priority_high":"priority_medium"),actual:e.actual,expected:e.expected,hint:e.hint}}function ve(e){return{snapshot_id:e.snapshot_id,captured_at:e.captured_at,brief_id:e.brief_id,thresholds_source:e.thresholds_source,scope:e.scope,target:e.target,design_check_summary:Xe(e),image:e.image}}function et(e){const i=e.check_results??e.lint_results??[];return{...ve(e),check_results:i.map(Ze),image_url:e.image_url,meta:e.meta}}async function de(e,i){const a=new URLSearchParams;i!==void 0&&a.set("limit",String(i));const o=a.toString()?`?${a.toString()}`:"",l=await we(`/api/ui-studio/snapshots${o}`);return{...l,snapshots:l.snapshots.map(ve)}}async function tt(e,i){const a=i!==void 0?`?placeId=${i}`:"",o=await we(`/api/ui-studio/snapshots/${encodeURIComponent(e)}${a}`);return et(o)}function be(e,i){const a=i!==void 0?`?placeId=${i}`:"";return`${q}/api/ui-studio/snapshots/${encodeURIComponent(e)}/image${a}`}const it=1e4;function Ce(e=50){const[i,a]=p.useState(null),[o,l]=p.useState(!0),[r,n]=p.useState(null),g=p.useCallback(async()=>{try{const d=await de(void 0,e);a(d),n(null)}catch(d){n(d instanceof Error?d.message:String(d))}finally{l(!1)}},[e]);return p.useEffect(()=>{let d=!1;const _=async()=>{try{const h=await de(void 0,e);d||(a(h),n(null))}catch(h){d||n(h instanceof Error?h.message:String(h))}finally{d||l(!1)}};_();const m=setInterval(()=>{_()},it);return()=>{d=!0,clearInterval(m)}},[e]),{data:i,loading:o,error:r,refresh:g}}const at="_page_1fjjw_2",rt="_grid_1fjjw_9",st="_card_1fjjw_16",nt="_cardBodyButton_1fjjw_31",ot="_thumb_1fjjw_43",lt="_badges_1fjjw_52",ct="_priorityHighBadge_1fjjw_60",dt="_priorityMediumBadge_1fjjw_69",ut="_priorityLowBadge_1fjjw_78",ht="_cardMeta_1fjjw_87",pt="_target_1fjjw_93",gt="_time_1fjjw_100",mt="_drawer_1fjjw_105",_t="_drawerToolbar_1fjjw_122",yt="_drawerTitleBlock_1fjjw_133",ft="_drawerEyebrow_1fjjw_140",xt="_drawerTarget_1fjjw_149",St="_drawerToolbarActions_1fjjw_159",jt="_closeBtn_1fjjw_167",wt="_detailBody_1fjjw_188",vt="_screenshotPreviewFrame_1fjjw_195",bt="_fullImg_1fjjw_208",Ct="_metaDl_1fjjw_215",It="_errorMsg_1fjjw_227",Nt="_suggestionsWrap_1fjjw_232",Pt="_prioritySection_1fjjw_239",kt="_sectionHighHeader_1fjjw_243",Tt="_sectionLowHeader_1fjjw_249",Bt="_sectionMediumHeader_1fjjw_255",Dt="_groupCard_1fjjw_261",Gt="_groupHeader_1fjjw_268",Mt="_groupLabel_1fjjw_284",At="_groupCount_1fjjw_289",Rt="_groupChevron_1fjjw_296",Lt="_groupBody_1fjjw_300",$t="_groupDescription_1fjjw_303",Et="_groupFix_1fjjw_308",Ht="_falsePositive_1fjjw_317",Ot="_itemList_1fjjw_325",Ft="_suggestionItem_1fjjw_333",Ut="_suggestionInfo_1fjjw_343",zt="_pathBreadcrumb_1fjjw_349",qt="_currentValue_1fjjw_358",Vt="_copyFixBtn_1fjjw_362",Wt="_emptySuggestions_1fjjw_376",Kt="_sampleBanner_1fjjw_384",Qt="_sampleBannerRow_1fjjw_397",Yt="_sampleBannerMain_1fjjw_405",Jt="_sampleBadge_1fjjw_413",Xt="_sampleTitle_1fjjw_423",Zt="_sampleMessage_1fjjw_430",ei="_sampleActions_1fjjw_437",ti="_primaryAction_1fjjw_445",ii="_secondaryAction_1fjjw_446",ai="_emptyState_1fjjw_481",ri="_pluginGuideCard_1fjjw_489",si="_pluginGuideMarker_1fjjw_500",ni="_pluginGuideBody_1fjjw_515",oi="_pluginGuideTitle_1fjjw_519",li="_pluginGuideMessage_1fjjw_527",ci="_pluginGuideChecklist_1fjjw_534",di="_pluginGuideWaiting_1fjjw_557",ui="_pluginGuideDot_1fjjw_566",hi="_analysisWorkspace_1fjjw_574",pi="_analysisMainColumn_1fjjw_579",gi="_analysisDetailPopupLayer_1fjjw_583",mi="_analysisDetailDialog_1fjjw_600",_i="_analysisSummaryPanel_1fjjw_619",yi="_recentCapturesHeader_1fjjw_632",fi="_analysisSummaryText_1fjjw_639",xi="_recentCapturesMeta_1fjjw_640",Si="_analysisReportGrid_1fjjw_646",ji="_analysisReportGroup_1fjjw_653",wi="_analysisReportCard_1fjjw_657",vi="_analysisReportThumb_1fjjw_679",bi="_analysisReportBody_1fjjw_688",Ci="_analysisReportTopline_1fjjw_695",Ii="_analysisVerdict_1fjjw_702",Ni="_analysisVerdict_needsFix_1fjjw_713",Pi="_analysisVerdict_review_1fjjw_714",ki="_analysisVerdict_passed_1fjjw_719",Ti="_analysisReportCounts_1fjjw_724",Bi="_analysisReportTarget_1fjjw_729",Di="_analysisReportIssue_1fjjw_738",Gi="_analysisReportMeta_1fjjw_744",Mi="_analysisChildList_1fjjw_751",Ai="_analysisChildRow_1fjjw_762",Ri="_analysisChildPath_1fjjw_783",Li="_analysisChildSummary_1fjjw_792",$i="_analysisChildDetailHint_1fjjw_793",Ei="_drawerAnalysisSummary_1fjjw_802",Hi="_drawerAnalysisSummaryItem_1fjjw_813",Oi="_drawerAnalysisLabel_1fjjw_820",Fi="_drawerAnalysisCounts_1fjjw_826",Ui="_drawerAnalysisValue_1fjjw_827",zi="_recentCapturesSection_1fjjw_832",qi="_drawerPrimaryActions_1fjjw_844",Vi="_drawerActionBtn_1fjjw_851",Wi="_drawerMoreMenu_1fjjw_880",Ki="_drawerMoreButton_1fjjw_885",Qi="_drawerMoreMenuBody_1fjjw_910",Yi="_drawerMenuItem_1fjjw_923",Ji="_drawerMenuItemDanger_1fjjw_946",Xi="_actionErrMsg_1fjjw_955",Zi="_actionStatusMsg_1fjjw_964",ea="_actionStatus_info_1fjjw_978",ta="_actionStatus_success_1fjjw_984",ia="_actionStatus_warning_1fjjw_990",aa="_actionStatusDetail_1fjjw_996",ra="_galleryHeader_1fjjw_1002",sa="_cardChecked_1fjjw_1015",na="_cardCheckbox_1fjjw_1022",oa="_captureSelectionActions_1fjjw_1062",la="_selectionToolbar_1fjjw_1071",ca="_selectionBar_1fjjw_1072",da="_selectionToolbarCount_1fjjw_1091",ua="_selectionToolbarActions_1fjjw_1098",ha="_selectionBarBtn_1fjjw_1105",pa="_selectionBarBtnDanger_1fjjw_1126",s={page:at,grid:rt,card:st,cardBodyButton:nt,thumb:ot,badges:lt,priorityHighBadge:ct,priorityMediumBadge:dt,priorityLowBadge:ut,cardMeta:ht,target:pt,time:gt,drawer:mt,drawerToolbar:_t,drawerTitleBlock:yt,drawerEyebrow:ft,drawerTarget:xt,drawerToolbarActions:St,closeBtn:jt,detailBody:wt,screenshotPreviewFrame:vt,fullImg:bt,metaDl:Ct,errorMsg:It,suggestionsWrap:Nt,prioritySection:Pt,sectionHighHeader:kt,sectionLowHeader:Tt,sectionMediumHeader:Bt,groupCard:Dt,groupHeader:Gt,groupLabel:Mt,groupCount:At,groupChevron:Rt,groupBody:Lt,groupDescription:$t,groupFix:Et,falsePositive:Ht,itemList:Ot,suggestionItem:Ft,suggestionInfo:Ut,pathBreadcrumb:zt,currentValue:qt,copyFixBtn:Vt,emptySuggestions:Wt,sampleBanner:Kt,sampleBannerRow:Qt,sampleBannerMain:Yt,sampleBadge:Jt,sampleTitle:Xt,sampleMessage:Zt,sampleActions:ei,primaryAction:ti,secondaryAction:ii,emptyState:ai,pluginGuideCard:ri,pluginGuideMarker:si,pluginGuideBody:ni,pluginGuideTitle:oi,pluginGuideMessage:li,pluginGuideChecklist:ci,pluginGuideWaiting:di,pluginGuideDot:ui,analysisWorkspace:hi,analysisMainColumn:pi,analysisDetailPopupLayer:gi,analysisDetailDialog:mi,analysisSummaryPanel:_i,recentCapturesHeader:yi,analysisSummaryText:fi,recentCapturesMeta:xi,analysisReportGrid:Si,analysisReportGroup:ji,analysisReportCard:wi,analysisReportThumb:vi,analysisReportBody:bi,analysisReportTopline:Ci,analysisVerdict:Ii,analysisVerdict_needsFix:Ni,analysisVerdict_review:Pi,analysisVerdict_passed:ki,analysisReportCounts:Ti,analysisReportTarget:Bi,analysisReportIssue:Di,analysisReportMeta:Gi,analysisChildList:Mi,analysisChildRow:Ai,analysisChildPath:Ri,analysisChildSummary:Li,analysisChildDetailHint:$i,drawerAnalysisSummary:Ei,drawerAnalysisSummaryItem:Hi,drawerAnalysisLabel:Oi,drawerAnalysisCounts:Fi,drawerAnalysisValue:Ui,recentCapturesSection:zi,drawerPrimaryActions:qi,drawerActionBtn:Vi,drawerMoreMenu:Wi,drawerMoreButton:Ki,drawerMoreMenuBody:Qi,drawerMenuItem:Yi,drawerMenuItemDanger:Ji,actionErrMsg:Xi,actionStatusMsg:Zi,actionStatus_info:ea,actionStatus_success:ta,actionStatus_warning:ia,actionStatusDetail:aa,galleryHeader:ra,cardChecked:sa,cardCheckbox:na,captureSelectionActions:oa,selectionToolbar:la,selectionBar:ca,selectionToolbarCount:da,selectionToolbarActions:ua,selectionBarBtn:ha,selectionBarBtnDanger:pa};function ga({snapshot:e,placeId:i,onClick:a,imageUrlOverride:o,selectable:l,selected:r,onToggleSelect:n}){var w,C,G;const{t:g}=D(),d=((w=e.design_check_summary)==null?void 0:w.priority_high)??0,_=((C=e.design_check_summary)==null?void 0:C.priority_medium)??0,m=((G=e.design_check_summary)==null?void 0:G.priority_low)??0,h=new Date(e.captured_at*1e3).toLocaleString(),x=o??be(e.snapshot_id,i),j=()=>{n==null||n(e.snapshot_id)};return t.jsxs("div",{className:`${s.card} ${r?s.cardChecked:""}`,children:[l&&t.jsx(y,{text:g("uiStudio.gallery.cardCheckbox.tooltip","Select this capture. Pick multiple to delete them together."),children:t.jsx("input",{className:s.cardCheckbox,type:"checkbox","aria-label":g("uiStudio.gallery.cardCheckbox","Select screenshot"),checked:!!r,onChange:j})}),t.jsxs("button",{className:s.cardBodyButton,onClick:I=>a(I.currentTarget),type:"button",children:[t.jsx("img",{className:s.thumb,src:x,alt:e.snapshot_id,loading:"lazy"}),t.jsxs("div",{className:s.badges,children:[d>0&&t.jsx(y,{text:g("uiStudio.gallery.priorityHighBadge.tooltip","Number of suggestions to review first. Click for details."),children:t.jsx("span",{className:s.priorityHighBadge,children:d})}),_>0&&t.jsx(y,{text:g("uiStudio.gallery.priorityMediumBadge.tooltip","Number of recommended suggestions."),children:t.jsx("span",{className:s.priorityMediumBadge,children:_})}),m>0&&t.jsx(y,{text:g("uiStudio.gallery.priorityLowBadge.tooltip","Number of optional improvements."),children:t.jsx("span",{className:s.priorityLowBadge,children:m})})]}),t.jsxs("div",{className:s.cardMeta,children:[t.jsx("div",{className:s.target,children:e.target??e.scope}),t.jsx("div",{className:s.time,children:h})]})]})]})}const ma={touch_target:"touchTarget",contrast:"contrast",text_scaled:"textScaled",safezone:"safezone",min_text_size:"minTextSize"};function _a(e){return e.rule==="contrast"&&/\.(Icon|Avatar|EmptyIcon|GoldIcon|[A-Za-z]*Icon)$/.test(e.path)}const ya={touch_target:{checkLabel:"터치 타겟 크기",description:"모바일에서 손가락으로 누르기 편한 최소 크기를 만족하는지 확인합니다.",howToFix:"버튼 Size 를 44x44 px 이상으로 키우거나 UIPadding 으로 터치 영역을 확장하세요.",buildUpdateCommand:e=>JSON.stringify({action:"update",targetPath:e.path,changes:{properties:{Size:{xScale:0,xOffset:44,yScale:0,yOffset:44}}}},null,2)},contrast:{checkLabel:"텍스트 대비",description:"텍스트와 배경의 명암 비율이 WCAG 접근성 기준을 만족하는지 확인합니다.",howToFix:"TextColor3 를 더 밝은 색(예: #FFFFFF) 으로 바꾸거나, 배경(BackgroundColor3)을 어둡게 조정하세요.",falsePositiveNote:"이모지 아이콘의 경우 색이 고정되어 대비 규칙이 오탐하는 경우가 많습니다. 실제 가독성에 문제 없으면 무시해도 됩니다.",buildUpdateCommand:e=>JSON.stringify({action:"update",targetPath:e.path,changes:{properties:{TextColor3:{r:255,g:255,b:255}}}},null,2)},text_scaled:{checkLabel:"TextScaled 사용",description:"TextScaled 가 켜져 있으나 UITextSizeConstraint 가 없으면 언어 확장 시 레이아웃이 깨질 수 있습니다.",howToFix:"해당 TextLabel 에 UITextSizeConstraint 자식을 추가하고 MaxTextSize 를 지정하세요.",buildUpdateCommand:e=>JSON.stringify({action:"update",targetPath:e.path,changes:{addChildren:[{className:"UITextSizeConstraint",name:"SizeConstraint",properties:{MaxTextSize:24,MinTextSize:10}}]}},null,2)},safezone:{checkLabel:"세이프존 배치",description:"버튼이 플랫폼별 세이프존(노치·홈 인디케이터·TV safe margin) 안에 있는지 확인합니다.",howToFix:"Position 을 세이프존 안쪽으로 이동하거나, 부모 Frame 을 축소하세요.",buildUpdateCommand:()=>null},min_text_size:{checkLabel:"최소 폰트 크기",description:"텍스트가 너무 작아 가독성이 떨어지는지 확인합니다. 브리프 기준 하한을 사용합니다.",howToFix:"TextSize 를 14 이상(본문 기준)으로 올리세요.",buildUpdateCommand:e=>{const i=typeof e.expected=="string"?parseInt(e.expected.replace(/[^\d]/g,""),10):14;return JSON.stringify({action:"update",targetPath:e.path,changes:{properties:{TextSize:Number.isFinite(i)?i:14}}},null,2)}}};function fa(e,i,a){const o=ma[e];return o?{...i,checkLabel:a(`uiStudio.fix.${o}.label`,i.checkLabel),description:a(`uiStudio.fix.${o}.description`,i.description),howToFix:a(`uiStudio.fix.${o}.howToFix`,i.howToFix),falsePositiveNote:i.falsePositiveNote?a(`uiStudio.fix.${o}.falsePositive`,i.falsePositiveNote):void 0}:i}function xa(e,i){const a=ya[e]??null;return a?i?fa(e,a,i):a:null}function Sa(e){return _a(e)}function ja(e,i){const a=new Map;for(const l of e){const r=`${l.displayPriority}::${l.rule}`,n=a.get(r)??[];n.push(l),a.set(r,n)}const o=[];for(const[l,r]of a){const[n,g]=l.split("::"),d=r.filter(Sa).length;o.push({rule:g??"unknown",priority:n,items:r,fixTemplate:xa(g??"",i),falsePositiveRatio:r.length>0?d/r.length:0})}return o.sort((l,r)=>{const n={priority_high:0,priority_medium:1,priority_low:2};return l.priority!==r.priority?n[l.priority]-n[r.priority]:r.items.length-l.items.length}),{high:o.filter(l=>l.priority==="priority_high"),medium:o.filter(l=>l.priority==="priority_medium"),low:o.filter(l=>l.priority==="priority_low")}}function Ie(e){const i=e.split("."),a=i[i.length-1]??e,o=i[i.length-2],l=o?`${o} > ${a}`:a;return{full:e,breadcrumb:l,leaf:a}}function Ne(e){return typeof e=="object"&&e!==null}function ue(e){return Ne(e.data)?e.data:{}}function Z(e,i){const a=e[i];return Ne(a)?a:{}}function V(e,i){const a=e[i];return typeof a=="string"?a:null}function W(e,i){const a=e[i];return typeof a=="number"&&Number.isFinite(a)?a:0}function wa(e){const i=Z(e,"design_check_summary");return{priority_high:W(i,"priority_high"),priority_medium:W(i,"priority_medium"),priority_low:W(i,"priority_low")}}function he(e){if(!(e.success??e.ok??!e.error))throw new Error(e.error??"UI Studio action failed")}function pe(e,i){return Pe(e,wa(i))}function F(e,i,a,o,l){const r=e(i,a);return l?`${r}: ${l} · ${o}`:`${r}: ${o}`}function va(e){const i=e.design_check_summary;return((i==null?void 0:i.priority_high)??0)>0?"needsFix":((i==null?void 0:i.priority_medium)??0)>0||((i==null?void 0:i.priority_low)??0)>0?"review":"passed"}function ba(e,i){return i==="needsFix"||i==="review"?e("uiStudio.analysis.verdict.hasSuggestions","개선 제안 있음"):e("uiStudio.analysis.verdict.passed","현재 개선 제안 없음")}function K(e,i){return`${i}${e("uiStudio.storage.countSuffix","개")}`}function Pe(e,i){return`${e("uiStudio.priorityHigh","우선 검토")} ${K(e,(i==null?void 0:i.priority_high)??0)} · ${e("uiStudio.priorityMedium","검토 권장")} ${K(e,(i==null?void 0:i.priority_medium)??0)} · ${e("uiStudio.priorityLow","선택 개선")} ${K(e,(i==null?void 0:i.priority_low)??0)}`}function Ca(e,i){return Pe(e,i.design_check_summary)}function Ia({snapshotId:e,placeId:i,onClose:a,sampleDetail:o,tier:l,onActionDone:r}){const[n,g]=p.useState(o??null),[d,_]=p.useState(null),[m,h]=p.useState(null),[x,j]=p.useState(null),[w,C]=p.useState(null),[G,I]=p.useState(null),{t:u}=D(),{trackEvent:P}=H(),A=l==="pro";p.useEffect(()=>{if(o){g(o),_(null);return}let b=!1;return tt(e,i).then(k=>{b||g(k)}).catch(k=>{b||_(k instanceof Error?k.message:String(k))}),()=>{b=!0}},[e,i,o]);const S=async()=>{if(n!=null&&n.target){P("dashboard_click_event",{click_target:"ui_studio_capture_current",page:"ui-studio",tab:"ui_studio_analysis"}),h(null),C("preview"),j({tone:"info",message:u("uiStudio.actions.previewRunning","캡처 중..."),detail:u("uiStudio.actions.previewRunningDetail","완료되면 새 화면 캡처 파일 ID를 표시합니다.")});try{const b=await oe("preview",{targetPath:n.target});he(b);const k=ue(b),L=V(k,"snapshot_id"),f=Z(k,"screenshot"),M=Z(k,"meta"),T=V(f,"saved_path"),ne=V(M,"persist_warning"),U=pe(u,k);j(ne?{tone:"warning",message:F(u,"uiStudio.actions.previewNeedsSaveCheck","캡처 완료, 저장 확인 필요",U,L),detail:ne}:L&&T?{tone:"success",message:F(u,"uiStudio.actions.previewSaved","새 화면 캡처 저장 완료",U,L),detail:u("uiStudio.actions.previewSavedDetail","기존 화면 캡처는 변경하지 않고 새 파일로 저장했습니다.")}:L?{tone:"warning",message:F(u,"uiStudio.actions.previewComplete","캡처 완료",U,L),detail:u("uiStudio.actions.previewSavedPathMissing","새 화면 캡처 ID는 받았지만 저장 경로를 확인하지 못했습니다.")}:{tone:"warning",message:F(u,"uiStudio.actions.previewComplete","캡처 완료",U),detail:u("uiStudio.actions.previewSnapshotIdMissing","새 화면 캡처 ID를 확인하지 못했습니다. 목록을 새로고침해 저장 여부를 확인해 주세요.")}),await(r==null?void 0:r())}catch(b){h(b instanceof Error?b.message:String(b))}finally{C(null)}}},N=async()=>{if(n!=null&&n.target){P("dashboard_click_event",{click_target:"ui_studio_check_again",page:"ui-studio",tab:"ui_studio_analysis"}),h(null),C("check"),j({tone:"info",message:u("uiStudio.actions.designCheckRunning","개선 제안 확인 중..."),detail:u("uiStudio.actions.designCheckRunningDetail","완료되면 우선 검토/검토 권장/선택 개선 항목 수를 표시합니다.")});try{const b=await oe("check",{targetPath:n.target});he(b);const k=ue(b),L=pe(u,k);j({tone:"success",message:F(u,"uiStudio.actions.designCheckComplete","개선 제안 확인 완료",L),detail:u("uiStudio.actions.designCheckNoSnapshotSaved","이 작업은 화면 캡처 파일을 새로 저장하지 않습니다.")}),await(r==null?void 0:r())}catch(b){h(b instanceof Error?b.message:String(b))}finally{C(null)}}},E=async()=>{h(null),j(null);try{await Oe(i,e),await(r==null?void 0:r()),I(null),a()}catch(b){throw h(b instanceof Error?b.message:String(b)),b}},v=A?void 0:u("uiStudio.actions.proRequired","Pro에서 사용 가능"),R=n!=null&&n.target?Ie(n.target):null;return t.jsxs("div",{className:s.drawer,children:[t.jsxs("div",{className:s.drawerToolbar,"data-testid":"snapshot-detail-toolbar",children:[t.jsxs("div",{className:s.drawerTitleBlock,children:[t.jsx("span",{className:s.drawerEyebrow,children:u("uiStudio.analysis.detailDialog","Analysis detail")}),t.jsx("span",{className:s.drawerTarget,title:(R==null?void 0:R.full)??e,children:(R==null?void 0:R.breadcrumb)??e})]}),t.jsxs("div",{className:s.drawerToolbarActions,children:[n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.drawerPrimaryActions,children:[t.jsx(y,{text:v??u("uiStudio.actions.captureCurrentState.tooltip","Save the UI currently shown in Studio as a new capture. Existing captures are kept."),children:t.jsxs("button",{className:s.drawerActionBtn,onClick:()=>void S(),disabled:!A||!n.target||w!==null,type:"button",children:[t.jsx(Qe,{size:15,"aria-hidden":"true"}),t.jsx("span",{children:u("uiStudio.actions.captureCurrentState","현재 상태 캡처")})]})}),t.jsx(y,{text:v??u("uiStudio.actions.checkSuggestionsAgain.tooltip","Recompute suggestions for this capture without taking a new screenshot."),children:t.jsxs("button",{className:s.drawerActionBtn,onClick:()=>void N(),disabled:!A||!n.target||w!==null,type:"button",children:[t.jsx($e,{size:15,"aria-hidden":"true"}),t.jsx("span",{children:u("uiStudio.actions.checkSuggestionsAgain","개선 제안 다시 확인")})]})})]}),t.jsxs("details",{className:s.drawerMoreMenu,children:[t.jsx("summary",{className:s.drawerMoreButton,title:u("uiStudio.actions.more.tooltip","Open additional actions."),"aria-label":u("uiStudio.actions.more","More"),children:t.jsx(Je,{size:18,"aria-hidden":"true"})}),t.jsx("div",{className:s.drawerMoreMenuBody,children:t.jsx(y,{text:v??u("uiStudio.actions.deleteSnapshot.tooltip","Delete only this capture file. The actual UI in Roblox Studio is not affected."),children:t.jsx("button",{className:`${s.drawerMenuItem} ${s.drawerMenuItemDanger}`,onClick:()=>{P("dashboard_click_event",{click_target:"ui_studio_delete_snapshot",page:"ui-studio",tab:"ui_studio_analysis"}),I("deleteSnapshot")},disabled:!A,type:"button",children:u("uiStudio.actions.deleteSnapshot","이 화면 캡처 삭제")})})})]})]}),t.jsx(y,{text:u("uiStudio.detailClose.tooltip","Close this detail panel."),children:t.jsx("button",{className:s.closeBtn,onClick:a,type:"button","aria-label":u("uiStudio.detailClose","Close"),children:t.jsx(Ve,{size:18,"aria-hidden":"true"})})})]})]}),d&&t.jsx("div",{className:s.errorMsg,children:d}),n&&t.jsxs("div",{className:s.detailBody,children:[m&&t.jsx("div",{className:s.actionErrMsg,children:m}),x&&t.jsxs("div",{className:`${s.actionStatusMsg} ${s[`actionStatus_${x.tone}`]??""}`,children:[t.jsx("div",{children:x.message}),x.detail&&t.jsx("div",{className:s.actionStatusDetail,children:x.detail})]}),t.jsx(Na,{detail:n}),t.jsx("div",{className:s.screenshotPreviewFrame,"data-testid":"analysis-screenshot-preview",children:t.jsx("img",{className:s.fullImg,src:n.image_url,alt:n.snapshot_id})}),t.jsx(Pa,{items:n.check_results}),t.jsxs("dl",{className:s.metaDl,children:[t.jsx("dt",{children:t.jsx(B,{label:u("uiStudio.capturedAt","Captured"),tooltip:u("uiStudio.capturedAt.tooltip","When this screen was captured.")})}),t.jsx("dd",{children:new Date(n.captured_at*1e3).toLocaleString()}),t.jsx("dt",{children:t.jsx(B,{label:u("uiStudio.scope","Scope"),tooltip:u("uiStudio.scope.tooltip","Capture scope (full screen or a specific UI).")})}),t.jsx("dd",{children:n.scope}),n.target&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:t.jsx(B,{label:u("uiStudio.target","Target"),tooltip:u("uiStudio.target.tooltip","Exact path of the captured UI instance.")})}),t.jsx("dd",{children:n.target})]}),n.brief_id&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:t.jsx(B,{label:u("uiStudio.briefId","Brief"),tooltip:u("uiStudio.briefId.tooltip","Identifier of the design brief that produced this UI.")})}),t.jsx("dd",{children:n.brief_id})]})]})]}),G==="deleteSnapshot"&&t.jsx(se,{title:u("uiStudio.confirm.deleteSnapshotTitle","화면 캡처 삭제"),message:u("uiStudio.confirm.deleteSnapshotMessage","이 화면 캡처 파일만 삭제됩니다 (Studio 인스턴스 보존)."),danger:!0,confirmLabel:u("common.delete","삭제"),onConfirm:E,onClose:()=>I(null)})]})}function Na({detail:e}){const{t:i}=D(),a=va(e);return t.jsxs("section",{className:s.drawerAnalysisSummary,children:[t.jsxs("div",{className:s.drawerAnalysisSummaryItem,children:[t.jsx("span",{className:s.drawerAnalysisLabel,children:t.jsx(B,{label:i("uiStudio.analysis.verdictLabel","개선 요약"),tooltip:i("uiStudio.analysis.verdictLabel.tooltip","Overall improvement verdict for this capture.")})}),t.jsx("span",{className:`${s.analysisVerdict} ${s[`analysisVerdict_${a}`]??""}`,children:ba(i,a)}),t.jsx("span",{className:s.drawerAnalysisCounts,children:Ca(i,e)})]}),t.jsxs("div",{className:s.drawerAnalysisSummaryItem,children:[t.jsx("span",{className:s.drawerAnalysisLabel,children:t.jsx(B,{label:i("uiStudio.analysis.thresholds","검토 기준"),tooltip:i("uiStudio.analysis.thresholds.tooltip","The threshold set used for this review (default or custom).")})}),t.jsx("span",{className:s.drawerAnalysisValue,children:e.thresholds_source})]})]})}function Pa({items:e}){const{t:i}=D();if(e.length===0)return t.jsx("p",{className:s.emptySuggestions,children:i("uiStudio.noSuggestions","현재 개선 제안 없음")});const{high:a,medium:o,low:l}=ja(e,i);return t.jsxs("div",{className:s.suggestionsWrap,children:[t.jsx("h3",{children:t.jsx(B,{label:i("uiStudio.designCheckResultsTitle","Design Check suggestions"),tooltip:i("uiStudio.designCheckResultsTitle.tooltip","All improvement suggestions found in this capture.")})}),a.length>0&&t.jsxs("section",{className:s.prioritySection,children:[t.jsx("h4",{className:s.sectionHighHeader,children:i("uiStudio.highPrioritySection","우선 검토")}),a.map(r=>t.jsx(Q,{group:r},`h-${r.rule}`))]}),o.length>0&&t.jsxs("section",{className:s.prioritySection,children:[t.jsx("h4",{className:s.sectionMediumHeader,children:i("uiStudio.mediumPrioritySection","검토 권장")}),o.map(r=>t.jsx(Q,{group:r},`m-${r.rule}`))]}),l.length>0&&t.jsxs("section",{className:s.prioritySection,children:[t.jsx("h4",{className:s.sectionLowHeader,children:i("uiStudio.lowPrioritySection","선택 개선")}),l.map(r=>t.jsx(Q,{group:r},`l-${r.rule}`))]})]})}function Q({group:e}){var n,g,d;const{t:i}=D(),[a,o]=p.useState(e.priority==="priority_high"&&e.items.length<=5),l=e.falsePositiveRatio>=.5&&!!((n=e.fixTemplate)!=null&&n.falsePositiveNote),r=((g=e.fixTemplate)==null?void 0:g.checkLabel)??e.rule;return t.jsxs("div",{className:s.groupCard,children:[t.jsx(y,{text:i("uiStudio.suggestionGroup.tooltip","Suggestions of the same kind grouped together. Click to expand or collapse."),children:t.jsxs("button",{className:s.groupHeader,onClick:()=>o(_=>!_),type:"button",children:[t.jsx("span",{className:s.groupLabel,children:r}),t.jsx(y,{text:i("uiStudio.groupSummary.tooltip","Number of UI elements matching this group."),children:t.jsxs("span",{className:s.groupCount,children:[e.items.length," ",i("uiStudio.groupSummary","items")]})}),t.jsx("span",{className:s.groupChevron,children:a?"▾":"▸"})]})}),a&&t.jsxs("div",{className:s.groupBody,children:[e.fixTemplate&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:s.groupDescription,children:e.fixTemplate.description}),t.jsx("p",{className:s.groupFix,children:e.fixTemplate.howToFix})]}),l&&t.jsx(y,{text:i("uiStudio.falsePositiveWarning.tooltip","This check can produce false positives — verify before applying."),children:t.jsxs("p",{className:s.falsePositive,children:[i("uiStudio.falsePositiveWarning","May contain false positives"),":"," ",(d=e.fixTemplate)==null?void 0:d.falsePositiveNote]})}),t.jsx("ul",{className:s.itemList,children:e.items.map((_,m)=>t.jsx(ka,{item:_,group:e},`${_.path}-${m}`))})]})]})}function ka({item:e,group:i}){var _;const{t:a}=D(),{trackEvent:o}=H(),[l,r]=p.useState(!1),n=Ie(e.path),g=((_=i.fixTemplate)==null?void 0:_.buildUpdateCommand(e))??null,d=async()=>{if(g)try{await navigator.clipboard.writeText(g),o("dashboard_click_event",{click_target:"ui_studio_copy_ai_instruction",page:"ui-studio",tab:"ui_studio_analysis"}),r(!0),setTimeout(()=>r(!1),2e3)}catch{}};return t.jsxs("li",{className:s.suggestionItem,children:[t.jsxs("div",{className:s.suggestionInfo,children:[t.jsx("code",{className:s.pathBreadcrumb,title:`${a("uiStudio.fullPath","Full path")}: ${n.full}`,children:n.breadcrumb}),t.jsxs("span",{className:s.currentValue,children:[t.jsx(y,{text:a("uiStudio.colCurrent.tooltip","The currently applied value."),children:t.jsx("span",{children:a("uiStudio.colCurrent","Current")})}),": ",t.jsx("strong",{children:String(e.actual)})," → ",t.jsx(y,{text:a("uiStudio.colRecommended.tooltip","The recommended value."),children:t.jsx("span",{children:a("uiStudio.colRecommended","Recommended")})}),": ",t.jsx("strong",{children:String(e.expected)})]})]}),g&&t.jsx(y,{text:a("uiStudio.copyFixCommand.tooltip","Copy a prompt that asks the AI to fix this issue."),children:t.jsx("button",{className:s.copyFixBtn,onClick:d,type:"button",children:l?a("uiStudio.copiedToClipboard","Copied"):a("uiStudio.copyFixCommand","Copy AI instruction")})})]})}function Y(e,i){return Object.entries(i).reduce((a,[o,l])=>a.split(`{${o}}`).join(String(l)),e)}function Ta(e,i){return i.rule==="contrast"?Y(e("uiStudio.sample.designCheck.contrast","Text contrast is below {expected} (current {actual}). Adjust TextColor3 or BackgroundColor3."),{expected:String(i.expected),actual:String(i.actual)}):i.rule==="touch_target"?Y(e("uiStudio.sample.designCheck.touchTarget","Touch targets should be at least {expected} px (current {actual}). Increase Size or padding."),{expected:String(i.expected),actual:String(i.actual)}):i.rule==="min_text_size"?Y(e("uiStudio.sample.designCheck.minTextSize","TextSize is below {expected} (current {actual}). Increase it for readability."),{expected:String(i.expected),actual:String(i.actual)}):i.hint}const ke="sample_inventory_preview",ee=Fe,Ba=[{path:"StarterGui.InventoryGame.Overlay.Modal.Header.GoldBox.Icon",hint:"텍스트 대비 4.5:1 미만 (현재 1.24). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥4.5:1",rule:"contrast",actual:"1.24"},{path:"StarterGui.InventoryGame.Overlay.Modal.Header.CloseBtn",hint:"텍스트 대비 4.5:1 미만 (현재 4.11). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥4.5:1",rule:"contrast",actual:"4.11"},{path:"StarterGui.InventoryGame.Overlay.Modal.LeftPanel.Portrait.Avatar",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.LeftPanel.EquipGrid.Slot1.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.LeftPanel.EquipGrid.Slot2.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.LeftPanel.EquipGrid.Slot3.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.LeftPanel.EquipGrid.Slot4.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.LeftPanel.EquipGrid.Slot5.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.LeftPanel.EquipGrid.Slot6.EmptyIcon",hint:"텍스트 대비 3.0:1 미만 (현재 2.53). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"2.53"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.TabBar.TabAll",hint:"터치 타겟 44x44 px 이상 권장 (현재 64x32). Size 또는 padding 늘리세요.",displayPriority:"priority_high",expected:"≥44x44",rule:"touch_target",actual:"64x32"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.TabBar.TabWeapon",hint:"터치 타겟 44x44 px 이상 권장 (현재 64x32). Size 또는 padding 늘리세요.",displayPriority:"priority_high",expected:"≥44x44",rule:"touch_target",actual:"64x32"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.TabBar.TabArmor",hint:"터치 타겟 44x44 px 이상 권장 (현재 64x32). Size 또는 padding 늘리세요.",displayPriority:"priority_high",expected:"≥44x44",rule:"touch_target",actual:"64x32"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.TabBar.TabConsume",hint:"터치 타겟 44x44 px 이상 권장 (현재 64x32). Size 또는 padding 늘리세요.",displayPriority:"priority_high",expected:"≥44x44",rule:"touch_target",actual:"64x32"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.TabBar.TabMisc",hint:"터치 타겟 44x44 px 이상 권장 (현재 64x32). Size 또는 padding 늘리세요.",displayPriority:"priority_high",expected:"≥44x44",rule:"touch_target",actual:"64x32"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I1.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I1.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I2.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I3.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I4.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I5.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I6.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I7.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I8.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I9.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I10.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I11.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I12.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I13.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I13.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I14.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I14.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I15.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I15.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I16.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I16.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I17.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I17.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I18.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I19.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I19.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I20.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.CenterPanel.ItemGrid.I20.Qty",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.DetailPanel.ItemIconBox.Icon",hint:"텍스트 대비 3.0:1 미만 (현재 1.25). TextColor3 또는 BackgroundColor3 조정 필요.",displayPriority:"priority_high",expected:"≥3.0:1",rule:"contrast",actual:"1.25"},{path:"StarterGui.InventoryGame.Overlay.Modal.DetailPanel.Rarity",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12},{path:"StarterGui.InventoryGame.Overlay.Modal.DetailPanel.StatsBox.Passive",hint:"TextSize 12 미만 (하한 14). 가독성 확보를 위해 상향 조정 권장.",displayPriority:"priority_medium",expected:"≥14",rule:"min_text_size",actual:12}];function Da(e){const o={snapshot_id:ke,captured_at:1776757908,brief_id:null,thresholds_source:"default",scope:"targetPath",target:"StarterGui.InventoryGame",design_check_summary:{priority_high:35,priority_medium:10,priority_low:0},image:{file:"ui-studio-sample.png",width:402,height:252}},l={...o,check_results:Ba.map(n=>({...n,hint:Ta(e,n)})),image_url:ee};return{list:{placeId:0,snapshots:[o],totalCount:1},detail:l}}const Ga=/plugin not connected|sync not started/i;function te(e){return typeof e=="string"&&Ga.test(e)}function Te(){const{t:e}=D();return t.jsxs("section",{className:s.pluginGuideCard,role:"status","aria-live":"polite",children:[t.jsx("div",{className:s.pluginGuideMarker,"aria-hidden":"true",children:"!"}),t.jsxs("div",{className:s.pluginGuideBody,children:[t.jsx("h2",{className:s.pluginGuideTitle,children:e("uiStudio.pluginGuide.title","Roblox Studio 플러그인이 연결되지 않았습니다")}),t.jsx("p",{className:s.pluginGuideMessage,children:e("uiStudio.pluginGuide.message","UI Studio는 연결된 Studio place의 화면 캡처와 변경 이력을 표시합니다. Studio와 WEPPY Plugin을 연결하면 자동으로 갱신됩니다.")}),t.jsxs("ul",{className:s.pluginGuideChecklist,children:[t.jsx("li",{children:e("uiStudio.pluginGuide.check1","Roblox Studio가 실행 중인가요?")}),t.jsx("li",{children:e("uiStudio.pluginGuide.check2","WEPPY Plugin이 설치되어 실행 중인가요?")})]}),t.jsxs("div",{className:s.pluginGuideWaiting,children:[t.jsx("span",{className:s.pluginGuideDot,"aria-hidden":"true"}),e("uiStudio.pluginGuide.waiting","플러그인 연결을 기다리는 중...")]})]})]})}function Be(e){return e.target??e.scope}function Ma(e){const i=Be(e),a=i.split(".").filter(l=>l.length>0),o=a.findIndex(l=>l==="StarterGui");return o>=0&&a[o+1]?["StarterGui",a[o+1]].join("."):i}function De(e){return((e==null?void 0:e.priority_high)??0)>0?"needsFix":((e==null?void 0:e.priority_medium)??0)>0||((e==null?void 0:e.priority_low)??0)>0?"review":"passed"}function Aa(e){return De(e.design_check_summary)}function ge(e){return ie(e.design_check_summary)}function ie(e){return((e==null?void 0:e.priority_high)??0)>0?0:((e==null?void 0:e.priority_medium)??0)>0?1:((e==null?void 0:e.priority_low)??0)>0?2:3}function Ra(e){return e.length===0?null:{...e.reduce((a,o)=>{const l=o.latest.design_check_summary;return a.priority_high+=(l==null?void 0:l.priority_high)??0,a.priority_medium+=(l==null?void 0:l.priority_medium)??0,a.priority_low+=(l==null?void 0:l.priority_low)??0,a},{priority_high:0,priority_medium:0,priority_low:0})}}function La(e){const i=new Map;for(const l of e){const r=Be(l),n=i.get(r);if(!n){i.set(r,{latest:l,snapshotCount:1});continue}n.snapshotCount+=1,l.captured_at>n.latest.captured_at&&(n.latest=l)}const a=[...i.entries()].map(([l,r])=>({key:l,latest:r.latest,snapshotCount:r.snapshotCount,verdict:Aa(r.latest)})),o=new Map;for(const l of a){const r=Ma(l.latest),n=o.get(r)??[];n.push(l),o.set(r,n)}return[...o.entries()].map(([l,r])=>{var _;const n=r.sort((m,h)=>{const x=ge(m.latest)-ge(h.latest);return x!==0?x:h.latest.captured_at-m.latest.captured_at}),g=n.reduce((m,h)=>h.latest.captured_at>m.captured_at?h.latest:m,((_=n[0])==null?void 0:_.latest)??r[0].latest),d=Ra(n);return{key:l,latest:g,snapshotCount:n.reduce((m,h)=>m+h.snapshotCount,0),children:n,summary:d,verdict:De(d)}}).sort((l,r)=>{const n=ie(l.summary)-ie(r.summary);return n!==0?n:r.latest.captured_at-l.latest.captured_at})}function $a(e){return e.reduce((i,a)=>(a.verdict==="passed"?i.noSuggestions+=1:i.hasSuggestions+=1,i),{hasSuggestions:0,noSuggestions:0})}function $(e,i){return`${i}${e("uiStudio.storage.countSuffix","개")}`}function ae(e,i){return`${e("uiStudio.priorityHigh","우선 검토")} ${$(e,(i==null?void 0:i.priority_high)??0)} · ${e("uiStudio.priorityMedium","검토 권장")} ${$(e,(i==null?void 0:i.priority_medium)??0)} · ${e("uiStudio.priorityLow","선택 개선")} ${$(e,(i==null?void 0:i.priority_low)??0)}`}function Ea(e,i,a){return`${e("uiStudio.analysis.targetCountLabel","분석 대상")} ${$(e,i)} · ${re(e,"needsFix")} ${$(e,a.hasSuggestions)} · ${re(e,"passed")} ${$(e,a.noSuggestions)}`}function Ha({tier:e}){const{t:i}=D(),{trackEvent:a}=H(),o=e==="basic",l=Ce(50),r=p.useRef(null),[n,g]=p.useState(null),[d,_]=p.useState(new Set),[m,h]=p.useState(new Set),[x,j]=p.useState(!1),w=p.useCallback((f,M)=>{g(n===f?null:f)},[n]),C=p.useCallback(()=>{g(null)},[]),G=p.useCallback(f=>{_(M=>{const T=new Set(M);return T.has(f)?T.delete(f):T.add(f),T})},[]);p.useEffect(()=>{var M;if(!n)return;(M=r.current)==null||M.focus();const f=T=>{T.key==="Escape"&&!document.getElementById("delete-confirm-title")&&C()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[C,n]);const I=o?Da(i):null,u=(I==null?void 0:I.list)??l.data,P=o?!1:l.loading,A=p.useCallback(f=>{h(M=>{const T=new Set(M);return T.has(f)?T.delete(f):T.add(f),T})},[]),S=f=>{h(new Set(f))},N=()=>{h(new Set)},E=async()=>{const f=(u==null?void 0:u.placeId)??0;a("dashboard_click_event",{click_target:"ui_studio_delete_selected_snapshots",page:"ui-studio",tab:"ui_studio_analysis"}),await Ue(f,{ids:[...m]}),await l.refresh(),j(!1),h(new Set)};if(P)return t.jsx("div",{className:s.page,children:i("uiStudio.loading","Loading...")});if(!o&&te(l.error))return t.jsx(Te,{});if(!o&&l.error)return t.jsxs("div",{className:s.page,children:[i("uiStudio.error","Error"),": ",l.error]});const v=(u==null?void 0:u.snapshots)??[],R=(u==null?void 0:u.placeId)??0,b=v.map(f=>f.snapshot_id),k=La(v),L=$a(k);return t.jsxs("div",{children:[t.jsxs("div",{className:s.analysisWorkspace,"data-detail-open":n?"true":"false",children:[t.jsxs("div",{className:s.analysisMainColumn,"data-testid":"analysis-main-column",children:[o&&t.jsx("div",{className:s.sampleBanner,children:t.jsxs("div",{className:s.sampleBannerRow,children:[t.jsxs("div",{className:s.sampleBannerMain,children:[t.jsx("div",{className:s.sampleBadge,children:i("uiStudio.sample.badge","Preview of the Pro UI gallery")}),t.jsx("div",{className:s.sampleTitle,children:i("uiStudio.sample.title","You are previewing the UI screenshot gallery that unlocks after upgrading to Pro.")}),t.jsx("div",{className:s.sampleMessage,children:i("uiStudio.sample.message","This preview uses sample data from a demo inventory UI. Real screenshots, review history, and AI-driven fixes unlock with Pro.")})]}),t.jsx("div",{className:s.sampleActions,children:t.jsx("a",{className:s.primaryAction,href:Se.uiStudioAnalysis,target:"_blank",rel:"noreferrer",onClick:()=>a("dashboard_click_event",{click_target:"upgrade_cta",placement:"ui_studio_analysis_banner",page:"ui-studio",tab:"ui_studio_analysis"}),children:i("tier.upgrade","View Pro")})})]})}),t.jsx("div",{className:s.galleryHeader,children:t.jsx("h1",{children:t.jsx(B,{label:i("uiStudio.title","UI Studio"),tooltip:i("uiStudio.title.tooltip","A central place to review AI-generated UI screens and improvement suggestions.")})})}),v.length===0?t.jsx("div",{className:s.emptyState,children:i("uiStudio.empty","No screenshots saved yet. They are created automatically when an AI agent captures the current UI state.")}):t.jsxs(t.Fragment,{children:[t.jsx("section",{className:s.analysisSummaryPanel,children:t.jsxs("div",{children:[t.jsx("h2",{children:t.jsx(B,{label:i("uiStudio.analysis.reportsTitle","UI 루트별 최신 분석"),tooltip:i("uiStudio.analysis.reportsTitle.tooltip","Shows the latest capture and suggestion summary per UI (e.g., Inventory window, Main menu).")})}),t.jsx("p",{className:s.analysisSummaryText,children:Ea(i,k.length,L)})]})}),t.jsx("div",{className:s.analysisReportGrid,"data-testid":"analysis-report-grid",children:k.map(f=>t.jsx(Fa,{report:f,placeId:R,imageUrlOverride:o?ee:void 0,expanded:d.has(f.key),onPrimaryClick:M=>{f.children.length>1?G(f.key):w(f.latest.snapshot_id,M)},onChildClick:(M,T)=>w(M,T)},f.key))}),t.jsxs("section",{className:s.recentCapturesSection,children:[t.jsxs("div",{className:s.recentCapturesHeader,children:[t.jsxs("div",{children:[t.jsx("h2",{children:t.jsx(B,{label:i("uiStudio.analysis.recentCapturesTitle","최근 캡처"),tooltip:i("uiStudio.analysis.recentCapturesTitle.tooltip","All recently saved captures in chronological order.")})}),t.jsxs("p",{className:s.recentCapturesMeta,children:[i("uiStudio.storage.snapshotCount","화면 캡처")," ",$(i,v.length)]})]}),!o&&v.length>0&&t.jsxs("div",{className:s.captureSelectionActions,children:[t.jsx(y,{text:i("uiStudio.gallery.selectAll.tooltip","Select every visible capture at once."),children:t.jsx("button",{className:s.selectionBarBtn,onClick:()=>S(b),type:"button",children:i("uiStudio.gallery.selectAll","모두 선택")})}),m.size>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:s.selectionToolbarCount,children:[m.size,i("uiStudio.gallery.selection.selectedCount"," selected")]}),t.jsx(y,{text:i("uiStudio.gallery.clearSelection.tooltip","Clear the current selection."),children:t.jsx("button",{className:s.selectionBarBtn,onClick:N,type:"button",children:i("uiStudio.gallery.clearSelection","선택 해제")})}),t.jsx(y,{text:i("uiStudio.gallery.deleteSelected.tooltip","Delete only the selected capture files. The actual UI in Roblox Studio is not affected."),children:t.jsx("button",{className:`${s.selectionBarBtn} ${s.selectionBarBtnDanger}`,onClick:()=>j(!0),type:"button",children:i("common.delete","삭제")})})]})]})]}),t.jsx("div",{className:s.grid,children:v.map(f=>t.jsx(ga,{snapshot:f,placeId:R,onClick:M=>w(f.snapshot_id,M),imageUrlOverride:o?ee:void 0,selectable:!o,selected:m.has(f.snapshot_id),onToggleSelect:A},f.snapshot_id))})]})]})]}),n&&t.jsx("div",{className:s.analysisDetailPopupLayer,"data-testid":"analysis-detail-popup-layer",onClick:C,role:"presentation",children:t.jsx("section",{ref:r,className:s.analysisDetailDialog,role:"dialog","aria-modal":"true","aria-label":i("uiStudio.analysis.detailDialog","Analysis detail"),tabIndex:-1,onClick:f=>f.stopPropagation(),children:t.jsx(Ia,{snapshotId:n,placeId:R,onClose:C,sampleDetail:o&&n===ke?(I==null?void 0:I.detail)??null:null,tier:e,onActionDone:o?void 0:l.refresh})})})]}),x&&t.jsx(se,{title:i("uiStudio.confirm.deleteBatchTitle","화면 캡처 일괄 삭제"),message:i("uiStudio.confirm.deleteBatchMessage",`선택한 ${m.size}개의 화면 캡처를 삭제합니다. 이 작업은 되돌릴 수 없습니다.`),danger:!0,confirmLabel:i("common.delete","삭제"),onConfirm:E,onClose:()=>j(!1)})]})}function re(e,i){return i==="needsFix"||i==="review"?e("uiStudio.analysis.verdict.hasSuggestions","개선 제안 있음"):e("uiStudio.analysis.verdict.passed","현재 개선 제안 없음")}function Oa(e,i){return((i==null?void 0:i.priority_high)??0)>0||((i==null?void 0:i.priority_medium)??0)>0||((i==null?void 0:i.priority_low)??0)>0?ae(e,i):e("uiStudio.analysis.issueSummary.passed","현재 검토 기준에서 추가 개선 제안은 없습니다.")}function Fa({report:e,placeId:i,imageUrlOverride:a,expanded:o,onPrimaryClick:l,onChildClick:r}){const{t:n}=D(),g=e.latest,d=a??be(g.snapshot_id,i),_=new Date(g.captured_at*1e3).toLocaleString(),m=re(n,e.verdict),h=e.children.length>1;return t.jsxs("div",{className:s.analysisReportGroup,children:[t.jsxs("button",{className:s.analysisReportCard,"aria-expanded":h?o:void 0,"aria-label":`${e.key} ${h?n("uiStudio.analysis.expandChildren","하위 대상 보기"):n("uiStudio.analysis.openDetail","상세 보기")}`,onClick:x=>l(x.currentTarget),type:"button",children:[t.jsx("img",{className:s.analysisReportThumb,src:d,alt:g.snapshot_id,loading:"lazy"}),t.jsxs("div",{className:s.analysisReportBody,children:[t.jsxs("div",{className:s.analysisReportTopline,children:[t.jsx(y,{text:e.verdict==="passed"?n("uiStudio.analysis.verdict.passed.tooltip","No improvements suggested under the current review thresholds."):n("uiStudio.analysis.verdict.hasSuggestions.tooltip","Some improvements were found in this UI. Click the card for details."),children:t.jsx("span",{className:`${s.analysisVerdict} ${s[`analysisVerdict_${e.verdict}`]??""}`,children:m})}),t.jsx(y,{text:n("uiStudio.analysis.counts.tooltip","Shows how many suggestions are marked review first, recommended, or optional."),children:t.jsx("span",{className:s.analysisReportCounts,children:ae(n,e.summary)})})]}),t.jsx("div",{className:s.analysisReportTarget,children:e.key}),t.jsx("div",{className:s.analysisReportIssue,children:Oa(n,e.summary)}),t.jsxs("div",{className:s.analysisReportMeta,children:[_," ·"," ",t.jsx(y,{text:n("uiStudio.analysis.thresholds.tooltip","The threshold set used for this review (default or custom)."),children:t.jsx("span",{children:n("uiStudio.analysis.thresholds","검토 기준")})}),": ",g.thresholds_source,e.snapshotCount>1?` · ${n("uiStudio.analysis.captureLabel","캡처")} ${$(n,e.snapshotCount)}`:"",h?` · ${n("uiStudio.analysis.childTargets","하위 대상")} ${$(n,e.children.length)}`:""]})]})]}),h&&o&&t.jsx("div",{className:s.analysisChildList,children:e.children.map(x=>t.jsxs("button",{className:s.analysisChildRow,onClick:j=>r(x.latest.snapshot_id,j.currentTarget),type:"button",children:[t.jsx("span",{className:s.analysisChildPath,children:x.key}),t.jsx("span",{className:s.analysisChildSummary,children:ae(n,x.latest.design_check_summary)}),t.jsx("span",{className:s.analysisChildDetailHint,children:n("uiStudio.analysis.childDetailHint","하위 대상 상세 보기")})]},x.key))})]})}function Ua(e,i,a=1e4){const[o,l]=p.useState(null),[r,n]=p.useState(!0),[g,d]=p.useState(null),_=JSON.stringify(i),m=p.useCallback(async()=>{try{const h=await le(e,i);l(h),d(null)}catch(h){d(h.message)}finally{n(!1)}},[e,_]);return p.useEffect(()=>{let h=!0;const x=async()=>{try{const w=await le(e,i);h&&(l(w),d(null))}catch(w){h&&d(w.message)}finally{h&&n(!1)}};x();const j=setInterval(()=>{x()},a);return()=>{h=!1,clearInterval(j)}},[e,_,a]),{data:o,loading:r,error:g,refresh:m}}const za="_filterBar_1nnge_4",qa="_filterGroup_1nnge_14",Va="_filterLabel_1nnge_21",Wa="_filterCheckbox_1nnge_28",Ka="_segmentGroup_1nnge_45",Qa="_segmentBtn_1nnge_55",Ya="_segmentBtnActive_1nnge_73",Ja="_filterInput_1nnge_79",Xa="_filterResetBtn_1nnge_95",Za="_requestRow_1nnge_114",er="_requestRowMain_1nnge_127",tr="_requestDetailToggle_1nnge_134",ir="_thumbPair_1nnge_156",ar="_thumbPairButton_1nnge_164",rr="_thumbSlot_1nnge_179",sr="_thumbImg_1nnge_204",nr="_thumbPlaceholder_1nnge_211",or="_thumbArrow_1nnge_219",lr="_extraPathsBadge_1nnge_225",cr="_requestMeta_1nnge_239",dr="_requestLabel_1nnge_247",ur="_requestTime_1nnge_256",hr="_requestStats_1nnge_261",pr="_statDot_1nnge_269",gr="_summaryPill_1nnge_273",mr="_requestActions_1nnge_278",_r="_expandHint_1nnge_285",yr="_mutationsArea_1nnge_298",fr="_mutLoading_1nnge_307",xr="_mutEmpty_1nnge_308",Sr="_mutError_1nnge_314",jr="_mutationRow_1nnge_320",wr="_mutationLine_1nnge_330",vr="_mutTs_1nnge_337",br="_mutCommand_1nnge_343",Cr="_mutPath_1nnge_349",Ir="_mutDiff_1nnge_359",Nr="_mutErr_1nnge_314",Pr="_changeDetails_1nnge_374",kr="_changeDetailRow_1nnge_382",Tr="_changeDetailRowNoBefore_1nnge_391",Br="_changeDetailBadge_1nnge_395",Dr="_changeDetail_text_1nnge_412",Gr="_changeDetail_color_1nnge_417",Mr="_changeDetail_size_1nnge_422",Ar="_changeDetail_layout_1nnge_427",Rr="_changeDetail_state_1nnge_432",Lr="_changeDetail_asset_1nnge_437",$r="_changeDetail_property_1nnge_442",Er="_changeDetailProperty_1nnge_446",Hr="_changeDetailArrow_1nnge_454",Or="_changeDetailOldValue_1nnge_460",Fr="_changeDetailNewValue_1nnge_461",Ur="_compareDialogLayer_1nnge_479",zr="_compareDialog_1nnge_479",qr="_beforeAfterDrawer_1nnge_510",Vr="_drawerHeader_1nnge_520",Wr="_drawerTitle_1nnge_529",Kr="_drawerCloseBtn_1nnge_536",Qr="_drawerBody_1nnge_552",Yr="_pathTabs_1nnge_559",Jr="_pathTab_1nnge_559",Xr="_pathTabActive_1nnge_588",Zr="_comparePanel_1nnge_594",es="_compareHalf_1nnge_604",ts="_compareLabel_1nnge_611",is="_compareImg_1nnge_622",as="_comparePlaceholder_1nnge_630",rs="_compareDetailsPanel_1nnge_642",ss="_compareDetailsHeader_1nnge_651",ns="_drawerFooter_1nnge_669",os="_drawerActionBtn_1nnge_677",ls="_historyTabWrap_1nnge_695",cs="_historyWorkspace_1nnge_701",ds="_historyMainColumn_1nnge_706",us="_requestList_1nnge_710",hs="_emptyHistory_1nnge_715",ps="_historyError_1nnge_722",gs="_historyLoading_1nnge_728",ms="_listHeader_1nnge_736",_s="_listHeaderTitle_1nnge_745",ys="_clearBtn_1nnge_752",fs="_deleteErrBanner_1nnge_771",c={filterBar:za,filterGroup:qa,filterLabel:Va,filterCheckbox:Wa,segmentGroup:Ka,segmentBtn:Qa,segmentBtnActive:Ya,filterInput:Ja,filterResetBtn:Xa,requestRow:Za,requestRowMain:er,requestDetailToggle:tr,thumbPair:ir,thumbPairButton:ar,thumbSlot:rr,thumbImg:sr,thumbPlaceholder:nr,thumbArrow:or,extraPathsBadge:lr,requestMeta:cr,requestLabel:dr,requestTime:ur,requestStats:hr,statDot:pr,summaryPill:gr,requestActions:mr,expandHint:_r,mutationsArea:yr,mutLoading:fr,mutEmpty:xr,mutError:Sr,mutationRow:jr,mutationLine:wr,mutTs:vr,mutCommand:br,mutPath:Cr,mutDiff:Ir,mutErr:Nr,changeDetails:Pr,changeDetailRow:kr,changeDetailRowNoBefore:Tr,changeDetailBadge:Br,changeDetail_text:Dr,changeDetail_color:Gr,changeDetail_size:Mr,changeDetail_layout:Ar,changeDetail_state:Rr,changeDetail_asset:Lr,changeDetail_property:$r,changeDetailProperty:Er,changeDetailArrow:Hr,changeDetailOldValue:Or,changeDetailNewValue:Fr,compareDialogLayer:Ur,compareDialog:zr,beforeAfterDrawer:qr,drawerHeader:Vr,drawerTitle:Wr,drawerCloseBtn:Kr,drawerBody:Qr,pathTabs:Yr,pathTab:Jr,pathTabActive:Xr,comparePanel:Zr,compareHalf:es,compareLabel:ts,compareImg:is,comparePlaceholder:as,compareDetailsPanel:rs,compareDetailsHeader:ss,drawerFooter:ns,drawerActionBtn:os,historyTabWrap:ls,historyWorkspace:cs,historyMainColumn:ds,requestList:us,emptyHistory:hs,historyError:ps,historyLoading:gs,listHeader:ms,listHeaderTitle:_s,clearBtn:ys,deleteErrBanner:fs};function xs(e){try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function me(e){return e==null?"nil":typeof e=="string"?`"${e}"`:typeof e=="object"?JSON.stringify(e):String(e)}function Ge({mutations:e,emptyLabel:i}){const{t:a}=D();return e.length===0?t.jsx("div",{className:c.mutEmpty,children:i??a("uiStudio.history.row.mutationsEmpty","No change details")}):t.jsx(t.Fragment,{children:e.map(o=>t.jsx(Ss,{mutation:o},o.mutationId))})}function Ss({mutation:e}){return t.jsxs("div",{className:c.mutationRow,children:[t.jsxs("div",{className:c.mutationLine,children:[t.jsx("span",{className:c.mutTs,children:xs(e.ts)}),t.jsx("span",{className:c.mutCommand,children:e.command}),e.targetPath&&t.jsx("span",{className:c.mutPath,children:e.targetPath}),e.diffSummary&&t.jsx("span",{className:c.mutDiff,children:e.diffSummary})]}),e.changeDetails&&e.changeDetails.length>0&&t.jsx("div",{className:c.changeDetails,children:e.changeDetails.map(i=>t.jsx(js,{detail:i},`${i.property}:${i.category}`))}),!e.ok&&e.error&&t.jsx("span",{className:c.mutErr,children:e.error})]})}function js({detail:e}){const i=Object.prototype.hasOwnProperty.call(e,"before");return t.jsxs("div",{className:`${c.changeDetailRow} ${i?"":c.changeDetailRowNoBefore}`,children:[t.jsx("span",{className:`${c.changeDetailBadge} ${c[`changeDetail_${e.category}`]??""}`,children:e.label}),t.jsx("span",{className:c.changeDetailProperty,children:e.property}),i&&t.jsx("span",{className:c.changeDetailOldValue,children:me(e.before)}),t.jsx("span",{className:c.changeDetailArrow,children:"→"}),t.jsx("span",{className:c.changeDetailNewValue,children:me(e.after)})]})}function _e(e,i){return`${q}/api/ui-studio/snapshots/${encodeURIComponent(e)}/image?placeId=${i}`}function ws(e){try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function vs(e){if(!e)return null;const i=e.split(/[./]/).filter(o=>o.length>0);if(i.length===0)return null;const a=i.findIndex(o=>o==="StarterGui");return a>=0&&i[a+1]?i[a+1]:i[i.length-1]??null}function J(e,i){if(i.label)return i.label;const a=vs(i.affectedPaths[0]);if(a){const o=i.mutationCount===1?"uiStudio.history.row.pathLabelOne":"uiStudio.history.row.pathLabelMany",l=i.mutationCount===1?"{path} · {n} change detail":"{path} · {n} change details";return e(o,l).replace("{path}",a).replace("{n}",String(i.mutationCount))}return e("uiStudio.history.row.toolLabel","UI changes ({n})").replace("{n}",String(i.mutationCount))}function X(e,i){return`${i}${e("uiStudio.storage.countSuffix","")}`}function bs(e,i){if(!i)return null;const a=[i.style_family,i.layout_family,i.device_policy,i.safe_area_policy].filter(o=>typeof o=="string"&&o.length>0);return a.length===0?null:`${e("uiStudio.history.row.qualityPlan","Design direction")}: ${a.join(" · ")}`}function Cs(e,i){if(!i)return null;if(i.source==="unavailable")return e("uiStudio.history.row.designCheckUnavailable","Suggestions: unavailable");if(i.total===0)return e("uiStudio.history.row.designCheckNone","Suggestions: none");const a=`${e("uiStudio.priorityHigh","Priority")} ${X(e,i.priority_high)}`,o=`${e("uiStudio.priorityMedium","Recommended")} ${X(e,i.priority_medium)}`,l=`${e("uiStudio.priorityLow","Optional")} ${X(e,i.priority_low)}`;return`${e("uiStudio.history.row.designCheck","Suggestions")}: ${a} · ${o} · ${l}`}function Me({req:e,placeId:i,onOpenCompare:a,imageUrlOverride:o,sampleMutations:l}){const{t:r}=D(),[n,g]=p.useState(!1),[d,_]=p.useState(null),[m,h]=p.useState(!1),[x,j]=p.useState(null),w=o!=null,C=e.affectedPaths[0]??null,G=e.affectedPaths.length-1,I=C?e.beforeSnapshots[C]??null:null,u=C?e.afterSnapshots[C]??null:null,P=I?w?o:_e(I,i):null,A=u?w?o:_e(u,i):null,S=bs(r,e.qualityPlanSummary),N=Cs(r,e.postChangeDesignCheckSummary),E=async()=>{if(!n&&d===null)if(w&&l!=null)_(l);else{h(!0),j(null);try{const v=await je(i,e.requestId);_(v.mutations)}catch(v){j(v.message)}finally{h(!1)}}g(v=>!v)};return t.jsxs("div",{className:c.requestRow,children:[t.jsxs("div",{className:c.requestRowMain,children:[t.jsx(y,{text:r("uiStudio.history.row.compare.tooltip","Compare the before and after screens. Click to open the full comparison view."),children:t.jsxs("button",{className:`${c.thumbPair} ${c.thumbPairButton}`,onClick:v=>a(v.currentTarget),disabled:!C,"aria-label":`${J(r,e)} ${r("uiStudio.history.row.compare","Before / After")}`,type:"button",children:[t.jsx("div",{className:c.thumbSlot,children:P?t.jsx("img",{className:c.thumbImg,src:P,alt:r("uiStudio.compare.before","Before"),loading:"lazy"}):t.jsx(y,{text:r("uiStudio.history.row.noBeforeState.tooltip","No capture saved before this change."),children:t.jsx("span",{className:c.thumbPlaceholder,children:r("uiStudio.history.row.noBeforeState","이전 없음")})})}),t.jsx("span",{className:c.thumbArrow,children:"→"}),t.jsx("div",{className:c.thumbSlot,children:A?t.jsx("img",{className:c.thumbImg,src:A,alt:r("uiStudio.compare.after","After"),loading:"lazy"}):t.jsx(y,{text:r("uiStudio.history.row.noAfterState.tooltip","No capture saved after this change."),children:t.jsx("span",{className:c.thumbPlaceholder,children:r("uiStudio.history.row.noAfterState","이후 없음")})})}),G>0&&t.jsx(y,{text:r("uiStudio.history.row.extraPaths.tooltip","Number of additional UIs changed in this action."),children:t.jsxs("span",{className:c.extraPathsBadge,children:["+",G]})})]})}),t.jsxs("button",{className:c.requestDetailToggle,type:"button","aria-expanded":n,"aria-label":`${J(r,e)} ${r("uiStudio.history.row.toggleDetails","Toggle change details")}`,onClick:()=>void E(),children:[t.jsxs("span",{className:c.requestMeta,children:[t.jsx("span",{className:c.requestLabel,children:J(r,e)}),t.jsx("span",{className:c.requestTime,children:ws(e.startedAt)}),t.jsxs("span",{className:c.requestStats,children:[t.jsx(y,{text:r("uiStudio.history.row.affectedPaths.tooltip","Number of UIs affected by this action."),children:t.jsxs("span",{children:[r("uiStudio.history.row.affectedPaths","Paths")," ",e.affectedPaths.length,r("uiStudio.storage.countSuffix","")]})}),t.jsx("span",{className:c.statDot,children:"·"}),t.jsx(y,{text:r("uiStudio.history.row.mutations.tooltip","Number of detailed changes (e.g., property edits)."),children:t.jsxs("span",{children:[r("uiStudio.history.row.mutations","Change details")," ",e.mutationCount,r("uiStudio.storage.countSuffix","")]})}),S&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:c.statDot,children:"·"}),t.jsx(y,{text:r("uiStudio.history.row.qualityPlan.tooltip","Brief design direction used for this change."),children:t.jsx("span",{className:c.summaryPill,children:S})})]}),N&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:c.statDot,children:"·"}),t.jsx(y,{text:r("uiStudio.history.row.designCheck.tooltip","Post-change Design Check suggestion summary."),children:t.jsx("span",{className:c.summaryPill,children:N})})]})]})]}),t.jsx("span",{className:c.requestActions,children:t.jsx(y,{text:r("uiStudio.history.row.toggleDetails.tooltip","Show or hide a per-line breakdown of what changed."),children:t.jsx("span",{className:c.expandHint,children:n?r("uiStudio.history.row.collapseDetails","Hide change details"):r("uiStudio.history.row.expandDetails","Show {n} change details").replace("{n}",String(e.mutationCount))})})})]})]}),n&&t.jsxs("div",{className:c.mutationsArea,children:[m&&t.jsx("div",{className:c.mutLoading,children:r("uiStudio.history.loading","로딩 중...")}),x&&t.jsx("div",{className:c.mutError,children:x}),d&&t.jsx(Ge,{mutations:d,emptyLabel:r("uiStudio.history.row.mutationsEmpty","No change details")})]})]})}function ye(e,i){return`${q}/api/ui-studio/snapshots/${encodeURIComponent(e)}/image?placeId=${i}`}function Ae({requestId:e,placeId:i,onClose:a,imageUrlOverride:o,sampleDetail:l}){const{t:r}=D(),n=p.useRef(null),g=l!=null,[d,_]=p.useState(g?l:null),[m,h]=p.useState(!g),[x,j]=p.useState(null),[w,C]=p.useState(g&&l.affectedPaths.length>0?l.affectedPaths[0]:null);p.useEffect(()=>{var S;(S=n.current)==null||S.focus()},[]),p.useEffect(()=>{const S=N=>{N.key==="Escape"&&(N.preventDefault(),a())};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[a]),p.useEffect(()=>{if(g)return;let S=!0;return h(!0),j(null),je(i,e).then(N=>{S&&(_(N),N.affectedPaths.length>0&&C(N.affectedPaths[0]))}).catch(N=>{S&&j(N.message)}).finally(()=>{S&&h(!1)}),()=>{S=!1}},[e,i,g]);const G=w&&d?d.beforeSnapshots[w]??null:null,I=w&&d?d.afterSnapshots[w]??null:null,u=G?o??ye(G,i):null,P=I?o??ye(I,i):null,A=r("uiStudio.history.row.compare","전후 비교");return t.jsx("div",{className:c.compareDialogLayer,"data-testid":"history-compare-dialog-layer",onClick:a,role:"presentation",children:t.jsx("section",{ref:n,className:c.compareDialog,role:"dialog","aria-modal":"true","aria-label":A,tabIndex:-1,onClick:S=>S.stopPropagation(),children:t.jsxs("div",{className:c.beforeAfterDrawer,children:[t.jsxs("div",{className:c.drawerHeader,children:[t.jsx("h2",{className:c.drawerTitle,children:A}),t.jsx("button",{className:c.drawerCloseBtn,onClick:a,type:"button",children:r("uiStudio.history.drawer.close","닫기")})]}),m&&t.jsx("div",{className:c.drawerBody,children:r("uiStudio.history.loading","로딩 중...")}),x&&t.jsx("div",{className:c.drawerBody,children:t.jsx("span",{className:c.mutErr,children:x})}),!m&&!x&&d&&t.jsxs(t.Fragment,{children:[d.affectedPaths.length>0&&t.jsx("div",{className:c.pathTabs,role:"tablist",children:d.affectedPaths.map(S=>t.jsx(y,{text:`${r("uiStudio.compare.path.tooltip","The UI instance path for this screen.")} ${S}`,children:t.jsx("button",{role:"tab","aria-selected":w===S,className:`${c.pathTab} ${w===S?c.pathTabActive:""}`,onClick:()=>C(S),type:"button",children:S.split("/").pop()??S})},S))}),t.jsxs("div",{className:c.comparePanel,children:[t.jsxs("div",{className:c.compareHalf,children:[t.jsx(y,{text:r("uiStudio.compare.before.tooltip","The screen saved just before AI made the change."),children:t.jsx("div",{className:c.compareLabel,children:r("uiStudio.compare.before","Before")})}),u?t.jsx("img",{className:c.compareImg,src:u,alt:r("uiStudio.compare.before","Before")}):t.jsx("div",{className:c.comparePlaceholder,children:r("uiStudio.history.row.noBeforeState","이전 상태 없음")})]}),t.jsxs("div",{className:c.compareHalf,children:[t.jsx(y,{text:r("uiStudio.compare.after.tooltip","The screen saved just after AI made the change."),children:t.jsx("div",{className:c.compareLabel,children:r("uiStudio.compare.after","After")})}),P?t.jsx("img",{className:c.compareImg,src:P,alt:r("uiStudio.compare.after","After")}):t.jsx("div",{className:c.comparePlaceholder,children:r("uiStudio.history.row.noAfterState","이후 상태 없음")})]})]}),t.jsxs("section",{className:c.compareDetailsPanel,children:[t.jsx("div",{className:c.compareDetailsHeader,children:r("uiStudio.history.drawer.changeDetails","Change details")}),t.jsx(Ge,{mutations:d.mutations,emptyLabel:r("uiStudio.history.row.mutationsEmpty","No change details")})]})]}),t.jsx("div",{className:c.drawerFooter,children:t.jsx("button",{className:c.drawerActionBtn,onClick:a,type:"button",children:r("uiStudio.history.drawer.close","닫기")})})]})})})}function z(e){const i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0),a=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999);return{start:i,end:a}}function fe(e,i){const a=e.split("-").map(Number);if(a.length!==3||a.some(n=>Number.isNaN(n)))return;const[o,l,r]=a;return new Date(o,l-1,r,i?23:0,i?59:0,i?59:0,i?999:0).toISOString()}function Is(e){const i={limit:50};if(e.action!=="all"&&(i.action=e.action),e.datePreset==="custom"){const a=e.from?fe(e.from,!1):void 0,o=e.to?fe(e.to,!0):void 0;a&&(i.from=a),o&&(i.to=o)}else if(e.datePreset!=="all"){const a=new Date;if(e.datePreset==="today"){const{start:o,end:l}=z(a);i.from=o.toISOString(),i.to=l.toISOString()}else if(e.datePreset==="yesterday"){const o=new Date(a);o.setDate(o.getDate()-1);const{start:l,end:r}=z(o);i.from=l.toISOString(),i.to=r.toISOString()}else{const o=e.datePreset==="7d"?6:29,l=new Date(a);l.setDate(l.getDate()-o);const{start:r}=z(l),{end:n}=z(a);i.from=r.toISOString(),i.to=n.toISOString()}}return i}function Re(){return{action:"all",datePreset:"all"}}function Ns(){const{t:e}=D(),{trackEvent:i}=H(),a=ze(e),[o,l]=p.useState(null),r=o?a.requests.find(d=>d.requestId===o)??null:null,n=p.useCallback((d,_)=>{l(d)},[]),g=p.useCallback(()=>{l(null)},[]);return t.jsxs("div",{className:c.historyTabWrap,children:[t.jsx("div",{className:s.sampleBanner,children:t.jsxs("div",{className:s.sampleBannerRow,children:[t.jsxs("div",{className:s.sampleBannerMain,children:[t.jsx("div",{className:s.sampleBadge,children:e("uiStudio.history.sample.bannerBadge","Preview of the Pro change history")}),t.jsx("div",{className:s.sampleTitle,children:e("uiStudio.history.sample.bannerTitle","You are previewing the UI change history that unlocks after upgrading to Pro.")}),t.jsx("div",{className:s.sampleMessage,children:e("uiStudio.history.sample.bannerMessage","This preview uses sample data. Real change history, before/after comparison, and batch delete unlock with Pro.")})]}),t.jsx("div",{className:s.sampleActions,children:t.jsx("a",{className:s.primaryAction,href:Se.uiStudioHistory,target:"_blank",rel:"noreferrer",title:e("uiStudio.history.sample.tooltip","Full history is available with Pro"),onClick:()=>i("dashboard_click_event",{click_target:"upgrade_cta",placement:"ui_studio_history_banner",page:"ui-studio",tab:"ui_studio_history"}),children:e("tier.upgrade","View Pro")})})]})}),t.jsxs("div",{className:c.historyWorkspace,"data-compare-open":o?"true":"false",children:[t.jsxs("div",{className:c.historyMainColumn,"data-testid":"history-main-column",children:[t.jsx("div",{className:c.listHeader,children:t.jsx("h2",{className:c.listHeaderTitle,children:t.jsx(B,{label:e("uiStudio.history.title","변경 이력"),tooltip:e("uiStudio.history.title.tooltip","A timeline of every UI change made by AI.")})})}),t.jsx("div",{className:c.requestList,children:a.requests.map(d=>t.jsx(Me,{req:d,placeId:0,onOpenCompare:_=>n(d.requestId,_),imageUrlOverride:ce,sampleMutations:a.mutationsByRequest[d.requestId]},d.requestId))})]}),o&&r&&t.jsx(Ae,{requestId:o,placeId:0,onClose:g,imageUrlOverride:ce,sampleDetail:{...r,mutations:a.mutationsByRequest[r.requestId]??[]}})]})]})}function Ps({filter:e,onChange:i}){const{t:a}=D(),o=[{value:"all",label:a("uiStudio.history.filter.actionAll","All"),tooltip:a("uiStudio.history.filter.actionAll.tooltip","Show every kind of action.")},{value:"create_tree",label:a("uiStudio.history.filter.actionCreate","Create"),tooltip:a("uiStudio.history.filter.actionCreate.tooltip","Show only actions that created a new UI.")},{value:"update",label:a("uiStudio.history.filter.actionUpdate","Update"),tooltip:a("uiStudio.history.filter.actionUpdate.tooltip","Show only actions that updated an existing UI.")},{value:"delete",label:a("uiStudio.history.filter.actionDelete","Delete"),tooltip:a("uiStudio.history.filter.actionDelete.tooltip","Show only actions that deleted a UI.")}],l=[{value:"all",label:a("uiStudio.history.filter.dateAll","All"),tooltip:a("uiStudio.history.filter.dateAll.tooltip","Show the full history.")},{value:"today",label:a("uiStudio.history.filter.today","Today"),tooltip:a("uiStudio.history.filter.today.tooltip","Show only changes from today.")},{value:"yesterday",label:a("uiStudio.history.filter.yesterday","Yesterday"),tooltip:a("uiStudio.history.filter.yesterday.tooltip","Show only changes from yesterday.")},{value:"7d",label:a("uiStudio.history.filter.last7Days","Last 7 days"),tooltip:a("uiStudio.history.filter.last7Days.tooltip","Show changes from the last 7 days.")},{value:"30d",label:a("uiStudio.history.filter.last30Days","Last 30 days"),tooltip:a("uiStudio.history.filter.last30Days.tooltip","Show changes from the last 30 days.")},{value:"custom",label:a("uiStudio.history.filter.customRange","Custom range"),tooltip:a("uiStudio.history.filter.customRange.tooltip","Pick a custom start and end date.")}];return t.jsxs("div",{className:c.filterBar,children:[t.jsxs("div",{className:c.filterGroup,children:[t.jsx("span",{className:c.filterLabel,children:t.jsx(B,{label:a("uiStudio.history.filter.actions","작업 유형"),tooltip:a("uiStudio.history.filter.actions.tooltip","Filter records by the kind of change AI made.")})}),t.jsx("div",{className:c.segmentGroup,children:o.map(r=>t.jsx(y,{text:r.tooltip,children:t.jsx("button",{className:`${c.segmentBtn} ${e.action===r.value?c.segmentBtnActive:""}`,onClick:()=>i({...e,action:r.value}),"aria-pressed":e.action===r.value,type:"button",children:r.label})},r.value))})]}),t.jsxs("div",{className:c.filterGroup,children:[t.jsx("span",{className:c.filterLabel,children:t.jsx(B,{label:a("uiStudio.history.filter.period","Period"),tooltip:a("uiStudio.history.filter.period.tooltip","Filter records by time range.")})}),t.jsx("div",{className:c.segmentGroup,children:l.map(r=>t.jsx(y,{text:r.tooltip,children:t.jsx("button",{className:`${c.segmentBtn} ${e.datePreset===r.value?c.segmentBtnActive:""}`,onClick:()=>i({...e,datePreset:r.value,from:r.value==="custom"?e.from:void 0,to:r.value==="custom"?e.to:void 0}),"aria-pressed":e.datePreset===r.value,type:"button",children:r.label})},r.value))})]}),e.datePreset==="custom"&&t.jsxs("div",{className:c.filterGroup,children:[t.jsx("label",{className:c.filterLabel,htmlFor:"ui-history-from-date",children:t.jsx(B,{label:a("uiStudio.history.filter.from","시작일"),tooltip:a("uiStudio.history.filter.from.tooltip","Start date for the query.")})}),t.jsx("input",{id:"ui-history-from-date",type:"date",className:c.filterInput,value:e.from??"",onChange:r=>i({...e,from:r.target.value||void 0})}),t.jsx("label",{className:c.filterLabel,htmlFor:"ui-history-to-date",children:t.jsx(B,{label:a("uiStudio.history.filter.to","종료일"),tooltip:a("uiStudio.history.filter.to.tooltip","End date for the query.")})}),t.jsx("input",{id:"ui-history-to-date",type:"date",className:c.filterInput,value:e.to??"",onChange:r=>i({...e,to:r.target.value||void 0})})]}),t.jsx(y,{text:a("uiStudio.history.filter.reset.tooltip","Reset all filters to defaults."),children:t.jsx("button",{className:c.filterResetBtn,onClick:()=>i(Re()),type:"button",children:a("uiStudio.history.filter.reset","Reset")})})]})}function ks(){var E;const{t:e}=D(),{trackEvent:i}=H(),a=Ce(1),o=((E=a.data)==null?void 0:E.placeId)??0,[l,r]=p.useState(Re),{data:n,loading:g,error:d,refresh:_}=Ua(o,Is(l)),[m,h]=p.useState(null),[x,j]=p.useState(!1),[w,C]=p.useState(!1),[G,I]=p.useState(null),u=async()=>{I(null);try{await qe(o,{all:!0,alsoSnapshots:w}),await _(),j(!1)}catch(v){throw I(v.message),v}},P=(n==null?void 0:n.requests)??[],A=te(a.error)||te(d),S=p.useCallback((v,R)=>{i("dashboard_click_event",{click_target:"ui_studio_compare_before_after",page:"ui-studio",tab:"ui_studio_history"}),h(v)},[i]),N=p.useCallback(()=>{h(null)},[]);return t.jsxs("div",{className:c.historyTabWrap,children:[A?t.jsx(Te,{}):t.jsxs("div",{className:c.historyWorkspace,"data-compare-open":m?"true":"false",children:[t.jsxs("div",{className:c.historyMainColumn,"data-testid":"history-main-column",children:[t.jsx(Ps,{filter:l,onChange:r}),t.jsxs("div",{className:c.listHeader,children:[t.jsx("h2",{className:c.listHeaderTitle,children:t.jsx(B,{label:e("uiStudio.history.title","변경 이력"),tooltip:e("uiStudio.history.title.tooltip","A timeline of every UI change made by AI.")})}),P.length>0&&t.jsx(y,{text:e("uiStudio.history.clear.tooltip","Delete every change record for this project. The actual UI in Roblox Studio is not affected."),children:t.jsx("button",{className:c.clearBtn,onClick:()=>{i("dashboard_click_event",{click_target:"ui_studio_clear_history",page:"ui-studio",tab:"ui_studio_history"}),j(!0)},type:"button",children:e("uiStudio.history.clear","Clear")})})]}),g&&t.jsx("div",{className:c.historyLoading,children:e("uiStudio.history.loading","로딩 중...")}),!g&&d&&t.jsxs("div",{className:c.historyError,children:[e("uiStudio.history.error","오류"),": ",d]}),!g&&!d&&P.length===0&&t.jsx("div",{className:c.emptyHistory,children:e("uiStudio.history.empty","아직 변경 이력이 없습니다. AI 에이전트가 manage_ui 로 UI 를 수정하면 자동으로 기록됩니다.")}),!g&&P.length>0&&t.jsx("div",{className:c.requestList,children:P.map(v=>t.jsx(Me,{req:v,placeId:o,onOpenCompare:R=>S(v.requestId,R)},v.requestId))}),G&&t.jsx("div",{className:c.deleteErrBanner,children:G})]}),m&&t.jsx(Ae,{requestId:m,placeId:o,onClose:N})]}),x&&t.jsx(se,{title:e("uiStudio.history.confirm.clearRequestsTitle","변경 이력 삭제"),message:e("uiStudio.history.confirm.clearRequestsMessage","현재 place의 변경 이력을 삭제합니다. Studio 인스턴스에는 영향을 주지 않습니다."),danger:!0,cascadeOption:{label:e("uiStudio.history.confirm.cascadeOption","연결된 화면 캡처도 함께 삭제"),checked:w,onChange:C},confirmLabel:e("common.delete","삭제"),onConfirm:u,onClose:()=>j(!1)})]})}function Ts({tier:e}){return e==="basic"?t.jsx(Ns,{}):t.jsx(ks,{})}const Bs=["analysis","history"];function $s(){const{t:e}=D(),{trackEvent:i}=H(),{tier:a,loading:o}=Ee(),[l,r]=He(),n=l.get("tab"),g=n&&Bs.includes(n)?n:"analysis",d=m=>{i("dashboard_click_event",{click_target:m==="analysis"?"ui_studio_tab_analysis":"ui_studio_tab_history",page:"ui-studio",tab:m==="analysis"?"ui_studio_analysis":"ui_studio_history"}),r(h=>{const x=new URLSearchParams(h);return x.set("tab",m),x})},_=[{key:"analysis",label:t.jsx(y,{text:e("uiStudio.tabs.analysis.tooltip","Browse AI-captured UI screens and quickly find which UIs need improvement."),children:e("uiStudio.tabs.analysis","Analysis")})},{key:"history",label:t.jsx(y,{text:e("uiStudio.tabs.history.tooltip","Every UI change AI made, in order. Compare before and after screens."),children:e("uiStudio.tabs.history","History")})}];return t.jsxs("div",{className:s.page,children:[t.jsx(We,{items:_,value:g,onChange:d}),o?t.jsx("div",{className:s.emptyState,children:e("uiStudio.loading","Loading...")}):g==="analysis"?t.jsx(Ha,{tier:a}):t.jsx(Ts,{tier:a})]})}export{$s as Component};
