@tarot-ai/pixel 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["view-assets/App-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["view-assets/App-BkF1Yv4U.js","view-assets/App-BEih8O7c.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var K1=Object.defineProperty;var J1=(t,a,l)=>a in t?K1(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l;var _i=(t,a,l)=>J1(t,typeof a!="symbol"?a+"":a,l);function ew(t,a){for(var l=0;l<a.length;l++){const o=a[l];if(typeof o!="string"&&!Array.isArray(o)){for(const s in o)if(s!=="default"&&!(s in t)){const c=Object.getOwnPropertyDescriptor(o,s);c&&Object.defineProperty(t,s,c.get?c:{enumerable:!0,get:()=>o[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function l(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerPolicy&&(c.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?c.credentials="include":s.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(s){if(s.ep)return;s.ep=!0;const c=l(s);fetch(s.href,c)}})();function tw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cd={exports:{}},ml={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -251,7 +251,7 @@ Error generating stack: `+r.message+`
|
|
|
251
251
|
*
|
|
252
252
|
* This source code is licensed under the ISC license.
|
|
253
253
|
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
-
*/const nj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ij=_e("x",nj);function Vs(t,a){return{en:t,"zh-CN":a}}const aj=Vs({"app.documentTitle":"Tarot Pixel","app.name":"Tarot Pixel","common.loading":"Loading...","common.loadFailed":"Failed to load","common.retry":"Retry","common.unknownTime":"Unknown time","language.label":"Language","language.english":"English","language.simplifiedChinese":"Simplified Chinese","settings.title":"Preferences","menu.open":"Open menu","navigation.backToDesignOverview":"Back to design overview","navigation.backToDesignList":"Back to design list","navigation.myDesigns":"My designs"},{"app.documentTitle":"Tarot Pixel","app.name":"Tarot Pixel","common.loading":"加载中...","common.loadFailed":"加载失败","common.retry":"重试","common.unknownTime":"未知时间","language.label":"语言","language.english":"English","language.simplifiedChinese":"简体中文","settings.title":"偏好设置","menu.open":"打开菜单","navigation.backToDesignOverview":"返回设计稿概览","navigation.backToDesignList":"返回设计稿列表","navigation.myDesigns":"我的设计稿"}),oj=Vs({"dashboard.designList.loadFailed":"Failed to load designs","dashboard.delete.confirm":"Delete this export? Its link will no longer be available after deletion.","dashboard.delete.failed":"Failed to delete export","dashboard.delete.succeeded":"Export deleted","dashboard.copy.failed":"Failed to copy link","dashboard.copy.succeeded":"Link copied","dashboard.toast.close":"Close notification","dashboard.count.design.one":"{count} design","dashboard.count.design.other":"{count} designs","dashboard.count.export.one":"{count} export","dashboard.count.export.other":"{count} exports","dashboard.count.module.one":"{count} module","dashboard.count.module.other":"{count} modules","dashboard.search.placeholder":"Search designs or exports","dashboard.search.clear":"Clear search","dashboard.empty.noDesigns.title":"No designs yet","dashboard.empty.noDesigns.description":"Sync a design from a design tool plugin to see it here","dashboard.empty.noResults.title":"No matching results","dashboard.empty.noResults.description":"Try a different search term","dashboard.time.justNow":"Just now","dashboard.time.minute.one":"{count} minute ago","dashboard.time.minute.other":"{count} minutes ago","dashboard.time.hour.one":"{count} hour ago","dashboard.time.hour.other":"{count} hours ago","dashboard.time.day.one":"{count} day ago","dashboard.time.day.other":"{count} days ago","dashboard.export.unnamed":"Unnamed export","dashboard.export.titleWithMore":"{title} + {restCount} more","dashboard.export.latestAt":"Latest {time}","dashboard.export.latest":"Latest","dashboard.export.listLabel":"Exports","dashboard.export.expandList":"Expand export list","dashboard.export.collapseList":"Collapse export list","dashboard.export.selectSource":"Select a source design","dashboard.export.copyLink":"Copy export link","dashboard.export.delete":"Delete this export","dashboard.mobile.loadingDesigns":"Loading designs","dashboard.mobile.selectDesign":"Select a design","dashboard.mobile.noDesigns":"No designs","dashboard.mobile.selectExport":"Select an export","dashboard.mobile.exportVersion":"Export version","dashboard.module.preview":"Preview","dashboard.module.selectExport":"Select an export to view its modules","dashboard.module.loading":"Loading modules...","dashboard.module.loadFailed":"Failed to load modules","dashboard.module.empty":"This export has no modules","dashboard.module.open":"Open module {name}","dashboard.module.viewInMgdone":"View in mgdone"},{"dashboard.designList.loadFailed":"设计稿列表加载失败","dashboard.delete.confirm":"确定要删除这次导出吗?删除后对应链接将不可访问。","dashboard.delete.failed":"删除失败","dashboard.delete.succeeded":"删除成功","dashboard.copy.failed":"复制失败","dashboard.copy.succeeded":"链接已复制","dashboard.toast.close":"关闭通知","dashboard.count.design.one":"{count} 个","dashboard.count.design.other":"{count} 个","dashboard.count.export.one":"{count} 次导出","dashboard.count.export.other":"{count} 次导出","dashboard.count.module.one":"{count} 个模块","dashboard.count.module.other":"{count} 个模块","dashboard.search.placeholder":"搜索视觉稿或导出","dashboard.search.clear":"清空搜索","dashboard.empty.noDesigns.title":"暂无设计稿","dashboard.empty.noDesigns.description":"在设计工具插件中同步后显示","dashboard.empty.noResults.title":"无匹配结果","dashboard.empty.noResults.description":"换个关键词试试","dashboard.time.justNow":"刚刚","dashboard.time.minute.one":"{count} 分钟前","dashboard.time.minute.other":"{count} 分钟前","dashboard.time.hour.one":"{count} 小时前","dashboard.time.hour.other":"{count} 小时前","dashboard.time.day.one":"{count} 天前","dashboard.time.day.other":"{count} 天前","dashboard.export.unnamed":"未命名导出","dashboard.export.titleWithMore":"{title},另有 {restCount} 个模块","dashboard.export.latestAt":"最新 {time}","dashboard.export.latest":"最新","dashboard.export.listLabel":"导出","dashboard.export.expandList":"展开导出列表","dashboard.export.collapseList":"收起导出列表","dashboard.export.selectSource":"选择一个原始设计稿","dashboard.export.copyLink":"复制导出链接","dashboard.export.delete":"删除这次导出","dashboard.mobile.loadingDesigns":"加载设计稿","dashboard.mobile.selectDesign":"选择设计稿","dashboard.mobile.noDesigns":"暂无设计稿","dashboard.mobile.selectExport":"选择导出","dashboard.mobile.exportVersion":"导出版本","dashboard.module.preview":"预览","dashboard.module.selectExport":"选择一次导出查看模块","dashboard.module.loading":"加载模块中...","dashboard.module.loadFailed":"模块加载失败","dashboard.module.empty":"这次导出没有模块","dashboard.module.open":"打开模块 {name}","dashboard.module.viewInMgdone":"在 mgdone 中查看"}),lj=Vs({"detail.empty.selectNode":"Select a node to view its details","detail.empty.nodeNotFound":"Node not found","detail.header.componentId":"Component ID: {id}","detail.header.componentFallback":"Component","detail.section.path":"Path","detail.section.css":"CSS","detail.section.compositeAnalysis":"Composite-layer analysis","detail.section.layout":"Layout","detail.section.hints":"Hints analysis","detail.section.designToolLayout":"Design-tool layout","detail.section.spacing":"Spacing","detail.section.componentDetection":"Component detection","detail.section.appearance":"Appearance","detail.section.text":"Text","detail.section.asset":"Asset","detail.section.context":"Context","detail.section.nodeInfo":"Node info","detail.section.rawHints":"Hints","detail.section.compactContext":"Compact context","detail.section.children.one":"Child ({count})","detail.section.children.other":"Children ({count})","detail.action.copyCss":"Copy CSS","detail.action.copyCompositeAnalysis":"Copy composite-layer analysis","detail.action.copyAssetUrl":"Copy asset URL","detail.action.openAsset":"Open asset in a new tab","detail.field.position":"Position","detail.field.size":"Size","detail.field.parent":"Parent","detail.field.children":"Children","detail.field.display":"Display","detail.field.mainAxis":"Main axis","detail.field.gap":"Gap","detail.field.mainAxisAlignment":"Main-axis alignment","detail.field.crossAxisAlignment":"Cross-axis alignment","detail.field.padding":"Padding","detail.field.opacity":"Opacity","detail.field.borderRadius":"Border radius","detail.field.overflow":"Overflow","detail.field.blendMode":"Blend mode","detail.field.fill":"Fill","detail.field.stroke":"Stroke","detail.field.shadow":"Shadow","detail.field.content":"Content","detail.field.font":"Font","detail.field.fontSize":"Font size","detail.field.fontWeight":"Font weight","detail.field.color":"Color","detail.field.lineHeight":"Line height","detail.field.horizontalAlignment":"Horizontal alignment","detail.field.verticalAlignment":"Vertical alignment","detail.field.file":"File","detail.field.format":"Format","detail.field.url":"URL","detail.value.rootNode":"(root node)","detail.value.automatic":"Auto","detail.value.clipped":"Clipped","detail.value.visible":"Visible","detail.value.yes":"Yes","detail.value.no":"No","detail.value.yesHorizontal":"Yes (horizontal arrangement)","detail.value.yesVertical":"Yes (vertical arrangement)","detail.direction.top":"Top","detail.direction.right":"Right","detail.direction.bottom":"Bottom","detail.direction.left":"Left","detail.direction.horizontal":"Horizontal","detail.direction.vertical":"Vertical","detail.direction.both":"Both","detail.spacing.padding":"Padding","detail.spacing.uniform":"Uniform","detail.spacing.siblings":"Sibling spacing","detail.more.one":"+{count} more item...","detail.more.other":"+{count} more items...","detail.component.summary.one":"{count} child, {width}×{height}","detail.component.summary.other":"{count} children, {width}×{height}","detail.text.segments":"Text segments","detail.composite.strategy.decorative":"Decorative","detail.composite.strategy.review":"Review","detail.composite.strategy.text":"Text","detail.composite.strategy.code":"Code","detail.composite.assetSuggestion":"Exported asset: {file} ({width}×{height}) → use an img directly if this is decorative","detail.composite.preview":"Background preview (text layers excluded)","detail.export.compositeTitle":"Composite-layer export recommendation — {name} ({id}, sourceId: {sourceId})","detail.export.size":"Size: {width}×{height}","detail.export.decorativeHeading":"Decorative layers suitable for background compositing (high confidence):","detail.export.reviewHeading":"Layers requiring review (low confidence):","detail.export.keepHeading":"Layers to keep as code or text:","detail.export.itemWithCoverage":" - {name} ({type}) — {reason} [coverage {coverage}%]","detail.export.item":" - {name} ({type}) — {reason}","detail.hints.role.decorative":"Decorative","detail.hints.role.text":"Text","detail.hints.role.container":"Container","detail.hints.role.interactive":"Interactive","detail.hints.decorativeReason.maskChild":"Mask child","detail.hints.decorativeReason.maskLayer":"Mask layer","detail.hints.decorativeReason.ghostLayer":"Ghost layer (no visible styles)","detail.hints.decorativeReason.backgroundLayer":"Background layer","detail.hints.decorativeReason.ornamentalShape":"Decorative shape","detail.hints.decorativeReason.separator":"Separator","detail.hints.badge.ghost":"Ghost layer","detail.hints.badge.background":"Background layer","detail.hints.badge.horizontalSeparator":"Horizontal separator","detail.hints.badge.verticalSeparator":"Vertical separator","detail.hints.badge.scrollCandidate":"Possible scroll area","detail.hints.field.decorativeReason":"Decorative reason","detail.hints.field.containerType":"Container type","detail.hints.container.transparent":"Transparent container","detail.hints.container.visualBoundary":"Visual-boundary container","detail.hints.childrenAxis":"Child axes","detail.hints.field.xNonOverlapping":"No X-axis overlap","detail.hints.field.yNonOverlapping":"No Y-axis overlap","detail.hints.childrenSpacing":"Child spacing","detail.hints.spacing.uniform":"Uniform {gap}px","detail.hints.spacing.nonUniform":"Non-uniform [{gaps}{suffix}]","detail.hints.childrenAlignment":"Child alignment","detail.hints.alignment.top":"Top aligned","detail.hints.alignment.bottom":"Bottom aligned","detail.hints.alignment.centerY":"Vertically centered","detail.hints.alignment.left":"Left aligned","detail.hints.alignment.right":"Right aligned","detail.hints.alignment.centerX":"Horizontally centered","detail.hints.sizeUniformity":"Child size consistency","detail.hints.field.widthUniform":"Consistent widths","detail.hints.field.heightUniform":"Consistent heights","detail.hints.field.similarity":"Similarity","detail.hints.overflow":"Overflow detection","detail.hints.field.direction":"Direction","detail.hints.field.containerViewport":"Container / viewport","detail.hints.visibility.full":"Fully visible","detail.hints.visibility.partial":"Partially visible: {pixels}px","detail.hints.stackingGroups.one":"Stacking group ({count})","detail.hints.stackingGroups.other":"Stacking groups ({count})","detail.hints.overlaps":"Overlaps","detail.hints.similarSiblings":"Similar sibling nodes","detail.hints.field.structureSignature":"Structure signature","detail.hints.field.containedBy":"Contained by","detail.hints.grouping":"Visual grouping","detail.hints.axis.horizontal":"Horizontal","detail.hints.axis.vertical":"Vertical","detail.hints.axis.stack":"Stack","detail.hints.confidence":"Confidence {confidence}","detail.hints.ungrouped":"Ungrouped:","detail.hints.interGroup":"Between groups: {axis} arrangement","detail.hints.interGroupSpacing":", spacing {spacing}px","detail.hints.interGroupAlignment":", {alignment}","detail.hints.contentFlow":"Content flow","detail.hints.field.primaryDirection":"Primary direction","detail.hints.flow.topToBottom":"Top to bottom","detail.hints.flow.leftToRight":"Left to right","detail.hints.section.header":"Header","detail.hints.section.body":"Body","detail.hints.section.footer":"Footer","detail.hints.section.sidebar":"Sidebar","detail.hints.section.content":"Content","detail.hints.constraints":"Constraints","detail.hints.constraint.fillWidth":"Fill width","detail.hints.constraint.fillHeight":"Fill height","detail.hints.constraint.centerX":"Horizontally centered","detail.hints.constraint.centerY":"Vertically centered","detail.hints.constraint.symmetricX":"Symmetric horizontal padding","detail.hints.constraint.symmetricY":"Symmetric vertical padding","detail.hints.constraint.intrinsic":"Intrinsic size","detail.hints.constraint.padding":"Top {top} Right {right} Bottom {bottom} Left {left}px","detail.hints.layoutPattern":"Layout pattern: {type}","detail.hints.layoutPattern.list":"List","detail.hints.layoutPattern.grid":"Grid","detail.hints.layoutPattern.cardGroup":"Card group","detail.hints.layoutPattern.tabBar":"Tab bar","detail.hints.layoutPattern.carousel":"Carousel","detail.hints.layoutPattern.specification":"Specification","detail.hints.layoutPattern.specificationValue":"{rows} rows × {columns} columns","detail.hints.stackingDetail":"Stacking analysis: {type}","detail.hints.stacking.decorativeOverlay":"Decorative overlay","detail.hints.stacking.containedOverlay":"Contained overlay","detail.hints.stacking.overlappingSimilar":"Overlapping similar elements","detail.hints.stacking.floating":"Floating element","detail.hints.stacking.unknown":"Unknown","detail.hints.semantic":"Semantic inference: {role}","detail.hints.semantic.card":"Card","detail.hints.semantic.listItem":"List item","detail.hints.semantic.navItem":"Navigation item","detail.hints.semantic.avatarName":"Avatar + name","detail.hints.semantic.thumbnailTitle":"Thumbnail + title","detail.hints.semantic.iconText":"Icon + text","detail.hints.semantic.labelValue":"Label-value pair","detail.hints.semantic.mediaBlock":"Media block","detail.data.id":"ID","detail.data.name":"Name","detail.data.type":"Type","detail.data.sourceId":"Source ID","detail.data.boundingBox":"Bounding box","detail.data.parent":"Parent","detail.data.children":"Children","detail.data.root":"(root)","detail.data.asset":"Asset","detail.data.assetUrl":"Asset URL","detail.data.text":"Text","detail.data.font":"Font","detail.data.color":"Color","detail.data.alignment":"Alignment","detail.data.verticalAlignment":"Vertical alignment","detail.data.segmented":"Segmented ({count} parts, use <span>):","detail.data.style":"Style","detail.data.opacity":"Opacity","detail.data.overflow":"Overflow","detail.data.radius":"Radius","detail.data.fill":"Fill","detail.data.stroke":"Stroke","detail.data.shadow":"Shadow","detail.data.childList":"Children","detail.data.child.separator":"Separator","detail.data.child.background":"Background","detail.data.child.ghost":"Ghost"},{"detail.empty.selectNode":"选择一个节点查看详情","detail.empty.nodeNotFound":"节点未找到","detail.header.componentId":"组件 ID:{id}","detail.header.componentFallback":"组件","detail.section.path":"路径","detail.section.css":"CSS","detail.section.compositeAnalysis":"复合图层分析","detail.section.layout":"布局","detail.section.hints":"提示分析","detail.section.designToolLayout":"设计工具布局","detail.section.spacing":"间距标注","detail.section.componentDetection":"组件检测","detail.section.appearance":"外观","detail.section.text":"文本","detail.section.asset":"资源","detail.section.context":"上下文","detail.section.nodeInfo":"节点信息","detail.section.rawHints":"分析提示","detail.section.compactContext":"精简上下文","detail.section.children.one":"子节点({count})","detail.section.children.other":"子节点({count})","detail.action.copyCss":"复制 CSS","detail.action.copyCompositeAnalysis":"复制复合图层分析","detail.action.copyAssetUrl":"复制资源 URL","detail.action.openAsset":"在新标签页中打开资源","detail.field.position":"位置","detail.field.size":"尺寸","detail.field.parent":"父节点","detail.field.children":"子节点","detail.field.display":"显示","detail.field.mainAxis":"主轴","detail.field.gap":"间距","detail.field.mainAxisAlignment":"主轴对齐","detail.field.crossAxisAlignment":"交叉轴对齐","detail.field.padding":"内边距","detail.field.opacity":"透明度","detail.field.borderRadius":"圆角","detail.field.overflow":"溢出","detail.field.blendMode":"混合模式","detail.field.fill":"填充","detail.field.stroke":"描边","detail.field.shadow":"阴影","detail.field.content":"内容","detail.field.font":"字体","detail.field.fontSize":"字号","detail.field.fontWeight":"字重","detail.field.color":"颜色","detail.field.lineHeight":"行高","detail.field.horizontalAlignment":"水平对齐","detail.field.verticalAlignment":"垂直对齐","detail.field.file":"文件","detail.field.format":"格式","detail.field.url":"URL","detail.value.rootNode":"(根节点)","detail.value.automatic":"自动","detail.value.clipped":"裁剪","detail.value.visible":"可见","detail.value.yes":"是","detail.value.no":"否","detail.value.yesHorizontal":"是(横向排列)","detail.value.yesVertical":"是(纵向排列)","detail.direction.top":"上","detail.direction.right":"右","detail.direction.bottom":"下","detail.direction.left":"左","detail.direction.horizontal":"横向","detail.direction.vertical":"纵向","detail.direction.both":"双向","detail.spacing.padding":"内边距(Padding)","detail.spacing.uniform":"统一","detail.spacing.siblings":"兄弟间距","detail.more.one":"+{count} 更多...","detail.more.other":"+{count} 更多...","detail.component.summary.one":"{count} 个子节点,{width}×{height}","detail.component.summary.other":"{count} 个子节点,{width}×{height}","detail.text.segments":"文本分段","detail.composite.strategy.decorative":"装饰","detail.composite.strategy.review":"待确认","detail.composite.strategy.text":"文本","detail.composite.strategy.code":"代码","detail.composite.assetSuggestion":"已有导出资源:{file}({width}×{height})→ 若为装饰层可直接使用 img","detail.composite.preview":"背景预览(排除文本层)","detail.export.compositeTitle":"复合图层导出建议 — {name}({id},sourceId:{sourceId})","detail.export.size":"尺寸:{width}×{height}","detail.export.decorativeHeading":"可合成为背景的装饰层(高置信):","detail.export.reviewHeading":"需确认的层(低置信):","detail.export.keepHeading":"保留为代码或文本的层:","detail.export.itemWithCoverage":" - {name}({type})— {reason}[覆盖率 {coverage}%]","detail.export.item":" - {name}({type})— {reason}","detail.hints.role.decorative":"装饰层","detail.hints.role.text":"文本","detail.hints.role.container":"容器","detail.hints.role.interactive":"交互","detail.hints.decorativeReason.maskChild":"蒙版子节点","detail.hints.decorativeReason.maskLayer":"蒙版层","detail.hints.decorativeReason.ghostLayer":"幽灵层(无可见样式)","detail.hints.decorativeReason.backgroundLayer":"背景层","detail.hints.decorativeReason.ornamentalShape":"装饰性形状","detail.hints.decorativeReason.separator":"分隔线","detail.hints.badge.ghost":"幽灵层","detail.hints.badge.background":"背景层","detail.hints.badge.horizontalSeparator":"水平分隔线","detail.hints.badge.verticalSeparator":"垂直分隔线","detail.hints.badge.scrollCandidate":"疑似滚动区","detail.hints.field.decorativeReason":"装饰原因","detail.hints.field.containerType":"容器类型","detail.hints.container.transparent":"透明容器","detail.hints.container.visualBoundary":"视觉边界容器","detail.hints.childrenAxis":"子节点轴线","detail.hints.field.xNonOverlapping":"X 轴不重叠","detail.hints.field.yNonOverlapping":"Y 轴不重叠","detail.hints.childrenSpacing":"子节点间距","detail.hints.spacing.uniform":"均匀 {gap}px","detail.hints.spacing.nonUniform":"不均匀[{gaps}{suffix}]","detail.hints.childrenAlignment":"子节点对齐","detail.hints.alignment.top":"顶部对齐","detail.hints.alignment.bottom":"底部对齐","detail.hints.alignment.centerY":"垂直居中","detail.hints.alignment.left":"左对齐","detail.hints.alignment.right":"右对齐","detail.hints.alignment.centerX":"水平居中","detail.hints.sizeUniformity":"子节点尺寸一致性","detail.hints.field.widthUniform":"宽度一致","detail.hints.field.heightUniform":"高度一致","detail.hints.field.similarity":"相似度","detail.hints.overflow":"溢出检测","detail.hints.field.direction":"方向","detail.hints.field.containerViewport":"容器/视口","detail.hints.visibility.full":"完全可见","detail.hints.visibility.partial":"部分可见 {pixels}px","detail.hints.stackingGroups.one":"堆叠组({count})","detail.hints.stackingGroups.other":"堆叠组({count})","detail.hints.overlaps":"重叠关系","detail.hints.similarSiblings":"相似兄弟节点","detail.hints.field.structureSignature":"结构签名","detail.hints.field.containedBy":"被包含于","detail.hints.grouping":"视觉分组","detail.hints.axis.horizontal":"横向","detail.hints.axis.vertical":"纵向","detail.hints.axis.stack":"堆叠","detail.hints.confidence":"置信度 {confidence}","detail.hints.ungrouped":"未分组:","detail.hints.interGroup":"组间:{axis}排列","detail.hints.interGroupSpacing":",间距 {spacing}px","detail.hints.interGroupAlignment":",{alignment}","detail.hints.contentFlow":"内容流","detail.hints.field.primaryDirection":"主方向","detail.hints.flow.topToBottom":"从上到下","detail.hints.flow.leftToRight":"从左到右","detail.hints.section.header":"头部","detail.hints.section.body":"主体","detail.hints.section.footer":"底部","detail.hints.section.sidebar":"侧边栏","detail.hints.section.content":"内容区","detail.hints.constraints":"约束关系","detail.hints.constraint.fillWidth":"撑满宽度","detail.hints.constraint.fillHeight":"撑满高度","detail.hints.constraint.centerX":"水平居中","detail.hints.constraint.centerY":"垂直居中","detail.hints.constraint.symmetricX":"左右对称","detail.hints.constraint.symmetricY":"上下对称","detail.hints.constraint.intrinsic":"固有尺寸","detail.hints.constraint.padding":"上 {top} 右 {right} 下 {bottom} 左 {left}px","detail.hints.layoutPattern":"布局模式:{type}","detail.hints.layoutPattern.list":"列表","detail.hints.layoutPattern.grid":"网格","detail.hints.layoutPattern.cardGroup":"卡片组","detail.hints.layoutPattern.tabBar":"标签栏","detail.hints.layoutPattern.carousel":"轮播","detail.hints.layoutPattern.specification":"规格","detail.hints.layoutPattern.specificationValue":"{rows} 行 × {columns} 列","detail.hints.stackingDetail":"堆叠分析:{type}","detail.hints.stacking.decorativeOverlay":"装饰叠加","detail.hints.stacking.containedOverlay":"内容叠加","detail.hints.stacking.overlappingSimilar":"重叠的相似元素","detail.hints.stacking.floating":"浮动元素","detail.hints.stacking.unknown":"未知","detail.hints.semantic":"语义推断:{role}","detail.hints.semantic.card":"卡片","detail.hints.semantic.listItem":"列表项","detail.hints.semantic.navItem":"导航项","detail.hints.semantic.avatarName":"头像+名称","detail.hints.semantic.thumbnailTitle":"缩略图+标题","detail.hints.semantic.iconText":"图标+文本","detail.hints.semantic.labelValue":"标签-值对","detail.hints.semantic.mediaBlock":"媒体块","detail.data.id":"ID","detail.data.name":"名称","detail.data.type":"类型","detail.data.sourceId":"来源 ID","detail.data.boundingBox":"边界框","detail.data.parent":"父节点","detail.data.children":"子节点数","detail.data.root":"(根节点)","detail.data.asset":"资源","detail.data.assetUrl":"资源 URL","detail.data.text":"文本","detail.data.font":"字体","detail.data.color":"颜色","detail.data.alignment":"对齐","detail.data.verticalAlignment":"垂直对齐","detail.data.segmented":"分段文本({count} 段,使用 <span>):","detail.data.style":"样式","detail.data.opacity":"透明度","detail.data.overflow":"溢出","detail.data.radius":"圆角","detail.data.fill":"填充","detail.data.stroke":"描边","detail.data.shadow":"阴影","detail.data.childList":"子节点","detail.data.child.separator":"分隔线","detail.data.child.background":"背景","detail.data.child.ghost":"幽灵层"}),rj=Vs({"viewer.loadingDashboard":"Loading designs...","viewer.loadDesignFailed":"Unable to load design data","viewer.localizeFailed":"Unable to update the current design language","viewer.designDeleted":"This design was deleted or does not exist","viewer.invalidDesignUrl":"Invalid design URL","viewer.loadingDesign":"Loading design data...","viewer.overviewLabel":"Design modules overview","viewer.breadcrumb":"Breadcrumb","viewer.moduleAria":"Module: {name} — {width}×{height}, {count} nodes","viewer.canvas.switchLight":"Switch to a light canvas","viewer.canvas.switchDark":"Switch to a dark canvas","viewer.canvas.fitView":"Fit to view","viewer.canvas.fitWidth":"Fit to width","viewer.canvas.zoomOut":"Zoom out","viewer.canvas.zoomIn":"Zoom in","viewer.sidebar.layers":"Layers","viewer.sidebar.searchPlaceholder":"Search node names, text, or IDs (supports type:text, asset:true, #id, and more)","viewer.sidebar.clearSearch":"Clear search","viewer.sidebar.resultCount.one":"{count} result","viewer.sidebar.resultCount.other":"{count} results","viewer.node.show":"Show node","viewer.node.hide":"Hide node","viewer.map.childCount.one":"{count} child","viewer.map.childCount.other":"{count} children","viewer.reload.title":"Reload","viewer.reload.refreshing":"Refreshing...","viewer.reload.description":"Read the source data again through MCP and refresh the analysis.","viewer.reload.action":"Reload design data","viewer.reload.failed":"Unable to reload design data","viewer.module.switch":"Switch module","viewer.module.count.one":"{count} module","viewer.module.count.other":"{count} modules","viewer.mode.visual":"Visual","viewer.mode.visualAria":"Switch to visual mode","viewer.mode.map":"Map","viewer.mode.mapAria":"Switch to map mode","viewer.font.count.one":"{count} font","viewer.font.count.other":"{count} fonts","viewer.font.usedInModule":"Fonts used in this module","viewer.font.custom":"Custom","viewer.font.builtin":"Built-in","viewer.font.missing":"Missing","viewer.font.weightMissing":"w{weight} was not found in the font preset","viewer.font.weightsMissing":"w{weights} were not found in the font preset","viewer.stats.node.one":"{count} node","viewer.stats.node.other":"{count} nodes","viewer.stats.asset.one":"{count} asset","viewer.stats.asset.other":"{count} assets","viewer.stats.text.one":"{count} text layer","viewer.stats.text.other":"{count} text layers","viewer.stats.frame.one":"{count} frame","viewer.stats.frame.other":"{count} frames","viewer.transform.title":"Transform diff","viewer.transform.loading":"Loading raw data...","viewer.transform.loadFailed":"Unable to load raw data","viewer.transform.noChanges":"No structural changes","viewer.transform.originalChildren":"Original children","viewer.transform.virtualWrapper":"Virtual wrapper (created by layout transform)","viewer.transform.virtualDetail":"flex-{direction}, wrapping {count} items","viewer.transform.parentChanged":"Parent changed","viewer.transform.root":"(root)","viewer.transform.virtualChild":"+ {name} (virtual wrapper)","viewer.transform.groupedDetail":"Groups {count} items into flex-{direction}","viewer.transform.moved":"↳ {name} moved","viewer.transform.nowUnder":"Now under {name}","viewer.transform.flattened":"- {name} (flattened)","viewer.transform.reordered":"Children reordered","viewer.transform.movedSuffix":" (moved)","viewer.transform.goneSuffix":" (gone)"},{"viewer.loadingDashboard":"加载设计稿中...","viewer.loadDesignFailed":"无法加载设计数据","viewer.localizeFailed":"无法更新当前设计稿语言","viewer.designDeleted":"设计稿已删除或不存在","viewer.invalidDesignUrl":"无效的设计稿 URL","viewer.loadingDesign":"加载设计数据中...","viewer.overviewLabel":"设计稿模块概览","viewer.breadcrumb":"面包屑导航","viewer.moduleAria":"模块:{name} — {width}×{height},{count} 个节点","viewer.canvas.switchLight":"切换为白色背景","viewer.canvas.switchDark":"切换为黑色背景","viewer.canvas.fitView":"适应视图","viewer.canvas.fitWidth":"适应宽度","viewer.canvas.zoomOut":"缩小","viewer.canvas.zoomIn":"放大","viewer.sidebar.layers":"图层","viewer.sidebar.searchPlaceholder":"搜索节点名称、文本内容或 ID(支持 type:text / asset:true / #id 等高级语法)","viewer.sidebar.clearSearch":"清空搜索","viewer.sidebar.resultCount.one":"{count} 个结果","viewer.sidebar.resultCount.other":"{count} 个结果","viewer.node.show":"显示节点","viewer.node.hide":"隐藏节点","viewer.map.childCount.one":"{count} 个子节点","viewer.map.childCount.other":"{count} 个子节点","viewer.reload.title":"重新加载","viewer.reload.refreshing":"刷新中...","viewer.reload.description":"通过 MCP 重新读取源数据并刷新计算结果。","viewer.reload.action":"重新加载设计数据","viewer.reload.failed":"无法重新加载设计数据","viewer.module.switch":"切换模块","viewer.module.count.one":"{count} 个模块","viewer.module.count.other":"{count} 个模块","viewer.mode.visual":"视觉","viewer.mode.visualAria":"切换到视觉模式","viewer.mode.map":"地图","viewer.mode.mapAria":"切换到地图模式","viewer.font.count.one":"{count} 种字体","viewer.font.count.other":"{count} 种字体","viewer.font.usedInModule":"本模块使用字体","viewer.font.custom":"自定义","viewer.font.builtin":"内置","viewer.font.missing":"缺失","viewer.font.weightMissing":"w{weight} 未在预设字体中找到","viewer.font.weightsMissing":"w{weights} 未在预设中找到","viewer.stats.node.one":"{count} 个节点","viewer.stats.node.other":"{count} 个节点","viewer.stats.asset.one":"{count} 个资源","viewer.stats.asset.other":"{count} 个资源","viewer.stats.text.one":"{count} 个文本层","viewer.stats.text.other":"{count} 个文本层","viewer.stats.frame.one":"{count} 个容器","viewer.stats.frame.other":"{count} 个容器","viewer.transform.title":"结构变换差异","viewer.transform.loading":"正在加载原始数据...","viewer.transform.loadFailed":"无法加载原始数据","viewer.transform.noChanges":"无结构变化","viewer.transform.originalChildren":"原始子节点","viewer.transform.virtualWrapper":"虚拟容器(由布局转换创建)","viewer.transform.virtualDetail":"flex-{direction},包含 {count} 项","viewer.transform.parentChanged":"父节点已变化","viewer.transform.root":"(根节点)","viewer.transform.virtualChild":"+ {name}(虚拟容器)","viewer.transform.groupedDetail":"将 {count} 项归入 flex-{direction}","viewer.transform.moved":"↳ {name} 已移动","viewer.transform.nowUnder":"现位于 {name} 下","viewer.transform.flattened":"- {name}(已扁平化)","viewer.transform.reordered":"子节点已重新排序","viewer.transform.movedSuffix":"(已移动)","viewer.transform.goneSuffix":"(已移除)"}),sj=["en","zh-CN"],Cb="en",wf="tarot-pixel.locale",cj=[aj,oj,lj,rj],Tx=Object.fromEntries(sj.map(t=>[t,Object.assign({},...cj.map(a=>a[t]))])),uj="http://tarot-pixel.local";function ms(t){const a=t==null?void 0:t.trim().replaceAll("_","-").toLowerCase();return a?a==="zh"||a.startsWith("zh-")?"zh-CN":a==="en"||a.startsWith("en-")?"en":null:null}function dj({query:t,stored:a,systemLocale:l,languages:o=[]}){const s=mj(t);if(s)return s;const c=ms(a);if(c)return c;const d=ms(l);if(d)return d;for(const f of o){const p=ms(f);if(p)return p}return Cb}function zx(t,a,l={}){return(Tx[t][a]??Tx[Cb][a]??a).replace(/\{([A-Za-z][A-Za-z0-9]*)\}/g,(s,c)=>{const d=l[c];return d===void 0?s:String(d)})}function Rx(){try{return window.localStorage.getItem(wf)}catch{return null}}function Es(t,a){const l=new URL(t,uj);return l.searchParams.set("lang",a),/^[a-z][a-z\d+.-]*:/i.test(t)||t.startsWith("//")?l.toString():`${l.pathname}${l.search}${l.hash}`}function Mb(t){return new URLSearchParams(t).has("_screenshot_token")}function fj(t,a){const l=a.indexOf("?"),o=l>=0?a.slice(l+1):"",s=new URLSearchParams(o).get("mode")==="map";return Mb(t)&&!s}function hj(t){try{window.localStorage.setItem(wf,t)}catch{}}function mj(t){if(!t)return null;try{return ms(new URLSearchParams(t).get("lang"))}catch{return null}}const jb=N.createContext(null);function pj({children:t}){const[a,l]=N.useState(()=>wd(Rx())),o=N.useCallback(d=>{l(d),hj(d),window.history.replaceState(window.history.state,"",Es(window.location.href,d))},[]);N.useEffect(()=>{document.documentElement.lang=a,document.title=zx(a,"app.documentTitle")},[a]),N.useEffect(()=>{const d=p=>{p.key===wf&&l(wd(p.newValue))},f=()=>{l(wd(Rx()))};return window.addEventListener("storage",d),window.addEventListener("languagechange",f),()=>{window.removeEventListener("storage",d),window.removeEventListener("languagechange",f)}},[]);const s=N.useCallback((d,f)=>zx(a,d,f),[a]),c=N.useMemo(()=>({locale:a,setLocale:o,t:s}),[a,o,s]);return m.jsx(jb.Provider,{value:c,children:t})}function gt(){const t=N.useContext(jb);if(!t)throw new Error("useI18n 必须在 I18nProvider 内调用");return t}function wd(t){const a=window.navigator.languages.length?window.navigator.languages:window.navigator.language?[window.navigator.language]:[];return dj({query:window.location.search,stored:t,systemLocale:gj(),languages:a})}function gj(){try{return Intl.DateTimeFormat().resolvedOptions().locale||null}catch{return null}}function xj(){const{t}=gt(),{exportData:a,selectModule:l,getModuleStats:o}=Ze(Pt(s=>({exportData:s.exportData,selectModule:s.selectModule,getModuleStats:s.getModuleStats})));return a?m.jsxs("section",{id:"overview","aria-label":t("viewer.overviewLabel"),className:"h-full flex flex-col bg-background",children:[m.jsx("header",{id:"project-meta",className:"flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b bg-white py-2 pl-11 pr-3 sm:pr-5",children:m.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 sm:gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[m.jsx(wb,{className:"size-4 shrink-0 text-primary"}),m.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight",children:a.source.fileName})]}),m.jsx("span",{className:"hidden shrink-0 text-border sm:inline",children:"·"}),m.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:a.source.pageName})]})}),m.jsx("div",{id:"module-grid",className:"flex-1 overflow-auto p-3 sm:p-6",children:m.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-4",children:a.modules.map(s=>{const c=o(s.moduleId);return m.jsx(vj,{mod:s,stats:c,onSelect:l,exportedAt:a.exportedAt},`${s.moduleId}`)})})})]}):null}function vj({mod:t,stats:a,onSelect:l,exportedAt:o}){var f;const{t:s}=gt(),c=p=>o?`${p}?_t=${encodeURIComponent(o)}`:p,d=m.jsxs("article",{"data-module-id":t.moduleId,"aria-label":s("viewer.moduleAria",{name:t.name,width:Math.round(t.bbox.width),height:Math.round(t.bbox.height),count:a.nodes}),className:"group border rounded-lg overflow-hidden bg-white hover:border-primary/20 hover:shadow-md hover:shadow-black/5 transition-all duration-200 cursor-pointer",onClick:()=>l(t.moduleId),children:[m.jsx(bj,{mod:t,exportedAt:o}),m.jsxs("div",{className:"px-3.5 py-3 space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("h3",{className:"text-[13px] font-medium truncate",children:t.name}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:[Math.round(t.bbox.width),"×",Math.round(t.bbox.height)]})]}),m.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[m.jsx(is,{icon:yb,label:s(`viewer.stats.node.${a.nodes===1?"one":"other"}`,{count:a.nodes})}),m.jsx(is,{icon:bb,label:s(`viewer.stats.asset.${a.assets===1?"one":"other"}`,{count:a.assets})}),a.texts>0&&m.jsx(is,{icon:yM,label:s(`viewer.stats.text.${a.texts===1?"one":"other"}`,{count:a.texts})}),a.frames>0&&m.jsx(is,{icon:UM,label:s(`viewer.stats.frame.${a.frames===1?"one":"other"}`,{count:a.frames})})]})]})]});return(f=t.preview)!=null&&f.url?m.jsxs(xf,{openDelay:300,closeDelay:100,children:[m.jsx(vf,{asChild:!0,children:d}),m.jsxs(bf,{side:"right",align:"start",className:"w-auto max-w-[calc(100vw-32px)] p-1.5 sm:max-w-[520px]",children:[m.jsx("img",{src:c(t.preview.url),alt:t.name,className:"max-h-[80vh] max-w-full rounded object-contain sm:max-h-[600px] sm:max-w-[500px]",draggable:!1}),m.jsxs("p",{className:"text-[11px] text-muted-foreground text-center mt-1",children:[t.name," — ",Math.round(t.bbox.width)," × ",Math.round(t.bbox.height)]})]})]}):d}function is({icon:t,label:a}){return m.jsxs(Le,{variant:"secondary",className:"text-[10px] h-4.5 px-1.5 gap-1 font-normal text-muted-foreground",children:[m.jsx(t,{className:"size-2.5"}),a]})}function bj({mod:t,exportedAt:a}){var o;const l=s=>a?`${s}?_t=${encodeURIComponent(a)}`:s;return(o=t.preview)!=null&&o.url?m.jsx("div",{className:"relative flex h-36 items-center justify-center overflow-hidden border-b border-border/50 bg-neutral-100 sm:h-44",children:m.jsx("img",{src:l(t.preview.url),alt:t.name,className:"object-contain",style:{maxWidth:144,maxHeight:144},draggable:!1})}):m.jsx("div",{className:"relative flex h-36 items-center justify-center overflow-hidden border-b border-border/50 bg-neutral-100 sm:h-44",children:m.jsxs("div",{className:"text-xs text-muted-foreground/30 font-mono",children:[Math.round(t.bbox.width)," × ",Math.round(t.bbox.height)]})})}var yj=Pd[" useId ".trim().toString()]||(()=>{}),wj=0;function Eb(t){const[a,l]=N.useState(yj());return kn(()=>{l(o=>o??String(wj++))},[t]),t||(a?`radix-${a}`:"")}var Sj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Nj="VisuallyHidden",Ab=N.forwardRef((t,a)=>m.jsx(St.span,{...t,ref:a,style:{...Sj,...t.style}}));Ab.displayName=Nj;var Cj=Ab,[Xs]=Rl("Tooltip",[yo]),qs=yo(),Tb="TooltipProvider",Mj=700,Hd="tooltip.open",[jj,Sf]=Xs(Tb),zb=t=>{const{__scopeTooltip:a,delayDuration:l=Mj,skipDelayDuration:o=300,disableHoverableContent:s=!1,children:c}=t,d=N.useRef(!0),f=N.useRef(!1),p=N.useRef(0);return N.useEffect(()=>{const g=p.current;return()=>window.clearTimeout(g)},[]),m.jsx(jj,{scope:a,isOpenDelayedRef:d,delayDuration:l,onOpen:N.useCallback(()=>{o<=0||(window.clearTimeout(p.current),d.current=!1)},[o]),onClose:N.useCallback(()=>{o<=0||(window.clearTimeout(p.current),p.current=window.setTimeout(()=>d.current=!0,o))},[o]),isPointerInTransitRef:f,onPointerInTransitChange:N.useCallback(g=>{f.current=g},[]),disableHoverableContent:s,children:c})};zb.displayName=Tb;var Al="Tooltip",[Ej,Ol]=Xs(Al),Rb=t=>{const{__scopeTooltip:a,children:l,open:o,defaultOpen:s,onOpenChange:c,disableHoverableContent:d,delayDuration:f}=t,p=Sf(Al,t.__scopeTooltip),g=qs(a),[x,v]=N.useState(null),w=Eb(),y=N.useRef(0),S=d??p.disableHoverableContent,C=f??p.delayDuration,j=N.useRef(!1),[A,_]=tf({prop:o,defaultProp:s??!1,onChange:D=>{D?(p.onOpen(),document.dispatchEvent(new CustomEvent(Hd))):p.onClose(),c==null||c(D)},caller:Al}),z=N.useMemo(()=>A?j.current?"delayed-open":"instant-open":"closed",[A]),R=N.useCallback(()=>{window.clearTimeout(y.current),y.current=0,j.current=!1,_(!0)},[_]),E=N.useCallback(()=>{window.clearTimeout(y.current),y.current=0,_(!1)},[_]),T=N.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{j.current=!0,_(!0),y.current=0},C)},[C,_]);return N.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),m.jsx(hf,{...g,children:m.jsx(Ej,{scope:a,contentId:w,open:A,stateAttribute:z,trigger:x,onTriggerChange:v,onTriggerEnter:N.useCallback(()=>{p.isOpenDelayedRef.current?T():R()},[p.isOpenDelayedRef,T,R]),onTriggerLeave:N.useCallback(()=>{S?E():(window.clearTimeout(y.current),y.current=0)},[E,S]),onOpen:R,onClose:E,disableHoverableContent:S,children:l})})};Rb.displayName=Al;var Yd="TooltipTrigger",Ob=N.forwardRef((t,a)=>{const{__scopeTooltip:l,...o}=t,s=Ol(Yd,l),c=Sf(Yd,l),d=qs(l),f=N.useRef(null),p=Tt(a,f,s.onTriggerChange),g=N.useRef(!1),x=N.useRef(!1),v=N.useCallback(()=>g.current=!1,[]);return N.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),m.jsx(Ls,{asChild:!0,...d,children:m.jsx(St.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...o,ref:p,onPointerMove:Ye(t.onPointerMove,w=>{w.pointerType!=="touch"&&!x.current&&!c.isPointerInTransitRef.current&&(s.onTriggerEnter(),x.current=!0)}),onPointerLeave:Ye(t.onPointerLeave,()=>{s.onTriggerLeave(),x.current=!1}),onPointerDown:Ye(t.onPointerDown,()=>{s.open&&s.onClose(),g.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Ye(t.onFocus,()=>{g.current||s.onOpen()}),onBlur:Ye(t.onBlur,s.onClose),onClick:Ye(t.onClick,s.onClose)})})});Ob.displayName=Yd;var Nf="TooltipPortal",[Aj,Tj]=Xs(Nf,{forceMount:void 0}),kb=t=>{const{__scopeTooltip:a,forceMount:l,children:o,container:s}=t,c=Ol(Nf,a);return m.jsx(Aj,{scope:a,forceMount:l,children:m.jsx(wn,{present:l||c.open,children:m.jsx(Us,{asChild:!0,container:s,children:o})})})};kb.displayName=Nf;var po="TooltipContent",_b=N.forwardRef((t,a)=>{const l=Tj(po,t.__scopeTooltip),{forceMount:o=l.forceMount,side:s="top",...c}=t,d=Ol(po,t.__scopeTooltip);return m.jsx(wn,{present:o||d.open,children:d.disableHoverableContent?m.jsx(Db,{side:s,...c,ref:a}):m.jsx(zj,{side:s,...c,ref:a})})}),zj=N.forwardRef((t,a)=>{const l=Ol(po,t.__scopeTooltip),o=Sf(po,t.__scopeTooltip),s=N.useRef(null),c=Tt(a,s),[d,f]=N.useState(null),{trigger:p,onClose:g}=l,x=s.current,{onPointerInTransitChange:v}=o,w=N.useCallback(()=>{f(null),v(!1)},[v]),y=N.useCallback((S,C)=>{const j=S.currentTarget,A={x:S.clientX,y:S.clientY},_=_j(A,j.getBoundingClientRect()),z=Dj(A,_),R=$j(C.getBoundingClientRect()),E=Uj([...z,...R]);f(E),v(!0)},[v]);return N.useEffect(()=>()=>w(),[w]),N.useEffect(()=>{if(p&&x){const S=j=>y(j,x),C=j=>y(j,p);return p.addEventListener("pointerleave",S),x.addEventListener("pointerleave",C),()=>{p.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",C)}}},[p,x,y,w]),N.useEffect(()=>{if(d){const S=C=>{const j=C.target,A={x:C.clientX,y:C.clientY},_=(p==null?void 0:p.contains(j))||(x==null?void 0:x.contains(j)),z=!Lj(A,d);_?w():z&&(w(),g())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[p,x,d,g,w]),m.jsx(Db,{...t,ref:c})}),[Rj,Oj]=Xs(Al,{isInside:!1}),kj=t2("TooltipContent"),Db=N.forwardRef((t,a)=>{const{__scopeTooltip:l,children:o,"aria-label":s,onEscapeKeyDown:c,onPointerDownOutside:d,...f}=t,p=Ol(po,l),g=qs(l),{onClose:x}=p;return N.useEffect(()=>(document.addEventListener(Hd,x),()=>document.removeEventListener(Hd,x)),[x]),N.useEffect(()=>{if(p.trigger){const v=w=>{w.target instanceof Node&&w.target.contains(p.trigger)&&x()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[p.trigger,x]),m.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:v=>v.preventDefault(),onDismiss:x,children:m.jsxs(mf,{"data-state":p.stateAttribute,...g,...f,ref:a,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(kj,{children:o}),m.jsx(Rj,{scope:l,isInside:!0,children:m.jsx(Cj,{id:p.contentId,role:"tooltip",children:s||o})})]})})});_b.displayName=po;var $b="TooltipArrow",Lb=N.forwardRef((t,a)=>{const{__scopeTooltip:l,...o}=t,s=qs(l);return Oj($b,l).isInside?null:m.jsx(pf,{...s,...o,ref:a})});Lb.displayName=$b;function _j(t,a){const l=Math.abs(a.top-t.y),o=Math.abs(a.bottom-t.y),s=Math.abs(a.right-t.x),c=Math.abs(a.left-t.x);switch(Math.min(l,o,s,c)){case c:return"left";case s:return"right";case l:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Dj(t,a,l=5){const o=[];switch(a){case"top":o.push({x:t.x-l,y:t.y+l},{x:t.x+l,y:t.y+l});break;case"bottom":o.push({x:t.x-l,y:t.y-l},{x:t.x+l,y:t.y-l});break;case"left":o.push({x:t.x+l,y:t.y-l},{x:t.x+l,y:t.y+l});break;case"right":o.push({x:t.x-l,y:t.y-l},{x:t.x-l,y:t.y+l});break}return o}function $j(t){const{top:a,right:l,bottom:o,left:s}=t;return[{x:s,y:a},{x:l,y:a},{x:l,y:o},{x:s,y:o}]}function Lj(t,a){const{x:l,y:o}=t;let s=!1;for(let c=0,d=a.length-1;c<a.length;d=c++){const f=a[c],p=a[d],g=f.x,x=f.y,v=p.x,w=p.y;x>o!=w>o&&l<(v-g)*(o-x)/(w-x)+g&&(s=!s)}return s}function Uj(t){const a=t.slice();return a.sort((l,o)=>l.x<o.x?-1:l.x>o.x?1:l.y<o.y?-1:l.y>o.y?1:0),Bj(a)}function Bj(t){if(t.length<=1)return t.slice();const a=[];for(let o=0;o<t.length;o++){const s=t[o];for(;a.length>=2;){const c=a[a.length-1],d=a[a.length-2];if((c.x-d.x)*(s.y-d.y)>=(c.y-d.y)*(s.x-d.x))a.pop();else break}a.push(s)}a.pop();const l=[];for(let o=t.length-1;o>=0;o--){const s=t[o];for(;l.length>=2;){const c=l[l.length-1],d=l[l.length-2];if((c.x-d.x)*(s.y-d.y)>=(c.y-d.y)*(s.x-d.x))l.pop();else break}l.push(s)}return l.pop(),a.length===1&&l.length===1&&a[0].x===l[0].x&&a[0].y===l[0].y?a:a.concat(l)}var Hj=zb,Yj=Rb,Ij=Ob,Gj=kb,Vj=_b,Xj=Lb;function Ox({delayDuration:t=0,...a}){return m.jsx(Hj,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function vl({...t}){return m.jsx(Yj,{"data-slot":"tooltip",...t})}function bl({...t}){return m.jsx(Ij,{"data-slot":"tooltip-trigger",...t})}function yl({className:t,sideOffset:a=0,children:l,...o}){return m.jsx(Gj,{children:m.jsxs(Vj,{"data-slot":"tooltip-content",sideOffset:a,className:Ot("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...o,children:[l,m.jsx(Xj,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const qj=jv("group/button cursor-pointer inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),gn=N.forwardRef(({className:t,variant:a="default",size:l="default",asChild:o=!1,...s},c)=>{const d=o?Ev:"button";return m.jsx(d,{ref:c,"data-slot":"button","data-variant":a,"data-size":l,className:Ot(qj({variant:a,size:l,className:t})),...s})});gn.displayName="Button";var Pj=N.createContext(void 0);function Qj(t){const a=N.useContext(Pj);return t||a||"ltr"}function Zj(t,[a,l]){return Math.min(l,Math.max(a,t))}function Fj(t,a){return N.useReducer((l,o)=>a[l][o]??l,t)}var Cf="ScrollArea",[Ub]=Rl(Cf),[Wj,xn]=Ub(Cf),Bb=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,type:o="hover",dir:s,scrollHideDelay:c=600,...d}=t,[f,p]=N.useState(null),[g,x]=N.useState(null),[v,w]=N.useState(null),[y,S]=N.useState(null),[C,j]=N.useState(null),[A,_]=N.useState(0),[z,R]=N.useState(0),[E,T]=N.useState(!1),[D,k]=N.useState(!1),V=Tt(a,p),te=Qj(s);return m.jsx(Wj,{scope:l,type:o,dir:te,scrollHideDelay:c,scrollArea:f,viewport:g,onViewportChange:x,content:v,onContentChange:w,scrollbarX:y,onScrollbarXChange:S,scrollbarXEnabled:E,onScrollbarXEnabledChange:T,scrollbarY:C,onScrollbarYChange:j,scrollbarYEnabled:D,onScrollbarYEnabledChange:k,onCornerWidthChange:_,onCornerHeightChange:R,children:m.jsx(St.div,{dir:te,...d,ref:V,style:{position:"relative","--radix-scroll-area-corner-width":A+"px","--radix-scroll-area-corner-height":z+"px",...t.style}})})});Bb.displayName=Cf;var Hb="ScrollAreaViewport",Yb=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,children:o,nonce:s,...c}=t,d=xn(Hb,l),f=N.useRef(null),p=Tt(a,f,d.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx(Kj,{nonce:s}),m.jsx(St.div,{"data-radix-scroll-area-viewport":"",...c,ref:p,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:m.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Yb.displayName=Hb;var Kj=N.memo(({nonce:t})=>m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),(t,a)=>t.nonce===a.nonce),$n="ScrollAreaScrollbar",Ib=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=xn($n,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=s,f=t.orientation==="horizontal";return N.useEffect(()=>(f?c(!0):d(!0),()=>{f?c(!1):d(!1)}),[f,c,d]),s.type==="hover"?m.jsx(Jj,{...o,ref:a,forceMount:l}):s.type==="scroll"?m.jsx(eE,{...o,ref:a,forceMount:l}):s.type==="auto"?m.jsx(Gb,{...o,ref:a,forceMount:l}):s.type==="always"?m.jsx(Mf,{...o,ref:a,"data-state":"visible"}):null});Ib.displayName=$n;var Jj=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=xn($n,t.__scopeScrollArea),[c,d]=N.useState(!1);return N.useEffect(()=>{const f=s.scrollArea;let p=0;if(f){const g=()=>{window.clearTimeout(p),d(!0)},x=()=>{p=window.setTimeout(()=>d(!1),s.scrollHideDelay)};return f.addEventListener("pointerenter",g),f.addEventListener("pointerleave",x),()=>{window.clearTimeout(p),f.removeEventListener("pointerenter",g),f.removeEventListener("pointerleave",x)}}},[s.scrollArea,s.scrollHideDelay]),m.jsx(wn,{present:l||c,children:m.jsx(Gb,{"data-state":c?"visible":"hidden",...o,ref:a})})}),eE=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=xn($n,t.__scopeScrollArea),c=t.orientation==="horizontal",d=Qs(()=>p("SCROLL_END"),100),[f,p]=Fj("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return N.useEffect(()=>{if(f==="idle"){const g=window.setTimeout(()=>p("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(g)}},[f,s.scrollHideDelay,p]),N.useEffect(()=>{const g=s.viewport,x=c?"scrollLeft":"scrollTop";if(g){let v=g[x];const w=()=>{const y=g[x];v!==y&&(p("SCROLL"),d()),v=y};return g.addEventListener("scroll",w),()=>g.removeEventListener("scroll",w)}},[s.viewport,c,p,d]),m.jsx(wn,{present:l||f!=="hidden",children:m.jsx(Mf,{"data-state":f==="hidden"?"hidden":"visible",...o,ref:a,onPointerEnter:Ye(t.onPointerEnter,()=>p("POINTER_ENTER")),onPointerLeave:Ye(t.onPointerLeave,()=>p("POINTER_LEAVE"))})})}),Gb=N.forwardRef((t,a)=>{const l=xn($n,t.__scopeScrollArea),{forceMount:o,...s}=t,[c,d]=N.useState(!1),f=t.orientation==="horizontal",p=Qs(()=>{if(l.viewport){const g=l.viewport.offsetWidth<l.viewport.scrollWidth,x=l.viewport.offsetHeight<l.viewport.scrollHeight;d(f?g:x)}},10);return go(l.viewport,p),go(l.content,p),m.jsx(wn,{present:o||c,children:m.jsx(Mf,{"data-state":c?"visible":"hidden",...s,ref:a})})}),Mf=N.forwardRef((t,a)=>{const{orientation:l="vertical",...o}=t,s=xn($n,t.__scopeScrollArea),c=N.useRef(null),d=N.useRef(0),[f,p]=N.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),g=Qb(f.viewport,f.content),x={...o,sizes:f,onSizesChange:p,hasThumb:g>0&&g<1,onThumbChange:w=>c.current=w,onThumbPointerUp:()=>d.current=0,onThumbPointerDown:w=>d.current=w};function v(w,y){return lE(w,d.current,f,y)}return l==="horizontal"?m.jsx(tE,{...x,ref:a,onThumbPositionChange:()=>{if(s.viewport&&c.current){const w=s.viewport.scrollLeft,y=kx(w,f,s.dir);c.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:w=>{s.viewport&&(s.viewport.scrollLeft=w)},onDragScroll:w=>{s.viewport&&(s.viewport.scrollLeft=v(w,s.dir))}}):l==="vertical"?m.jsx(nE,{...x,ref:a,onThumbPositionChange:()=>{if(s.viewport&&c.current){const w=s.viewport.scrollTop,y=kx(w,f);c.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:w=>{s.viewport&&(s.viewport.scrollTop=w)},onDragScroll:w=>{s.viewport&&(s.viewport.scrollTop=v(w))}}):null}),tE=N.forwardRef((t,a)=>{const{sizes:l,onSizesChange:o,...s}=t,c=xn($n,t.__scopeScrollArea),[d,f]=N.useState(),p=N.useRef(null),g=Tt(a,p,c.onScrollbarXChange);return N.useEffect(()=>{p.current&&f(getComputedStyle(p.current))},[p]),m.jsx(Xb,{"data-orientation":"horizontal",...s,ref:g,sizes:l,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ps(l)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.x),onDragScroll:x=>t.onDragScroll(x.x),onWheelScroll:(x,v)=>{if(c.viewport){const w=c.viewport.scrollLeft+x.deltaX;t.onWheelScroll(w),Fb(w,v)&&x.preventDefault()}},onResize:()=>{p.current&&c.viewport&&d&&o({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:p.current.clientWidth,paddingStart:Ts(d.paddingLeft),paddingEnd:Ts(d.paddingRight)}})}})}),nE=N.forwardRef((t,a)=>{const{sizes:l,onSizesChange:o,...s}=t,c=xn($n,t.__scopeScrollArea),[d,f]=N.useState(),p=N.useRef(null),g=Tt(a,p,c.onScrollbarYChange);return N.useEffect(()=>{p.current&&f(getComputedStyle(p.current))},[p]),m.jsx(Xb,{"data-orientation":"vertical",...s,ref:g,sizes:l,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ps(l)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.y),onDragScroll:x=>t.onDragScroll(x.y),onWheelScroll:(x,v)=>{if(c.viewport){const w=c.viewport.scrollTop+x.deltaY;t.onWheelScroll(w),Fb(w,v)&&x.preventDefault()}},onResize:()=>{p.current&&c.viewport&&d&&o({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:p.current.clientHeight,paddingStart:Ts(d.paddingTop),paddingEnd:Ts(d.paddingBottom)}})}})}),[iE,Vb]=Ub($n),Xb=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,sizes:o,hasThumb:s,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:f,onThumbPositionChange:p,onDragScroll:g,onWheelScroll:x,onResize:v,...w}=t,y=xn($n,l),[S,C]=N.useState(null),j=Tt(a,C),A=N.useRef(null),_=N.useRef(""),z=y.viewport,R=o.content-o.viewport,E=an(x),T=an(p),D=Qs(v,10);function k(V){if(A.current){const te=V.clientX-A.current.left,J=V.clientY-A.current.top;g({x:te,y:J})}}return N.useEffect(()=>{const V=te=>{const J=te.target;(S==null?void 0:S.contains(J))&&E(te,R)};return document.addEventListener("wheel",V,{passive:!1}),()=>document.removeEventListener("wheel",V,{passive:!1})},[z,S,R,E]),N.useEffect(T,[o,T]),go(S,D),go(y.content,D),m.jsx(iE,{scope:l,scrollbar:S,hasThumb:s,onThumbChange:an(c),onThumbPointerUp:an(d),onThumbPositionChange:T,onThumbPointerDown:an(f),children:m.jsx(St.div,{...w,ref:j,style:{position:"absolute",...w.style},onPointerDown:Ye(t.onPointerDown,V=>{V.button===0&&(V.target.setPointerCapture(V.pointerId),A.current=S.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),k(V))}),onPointerMove:Ye(t.onPointerMove,k),onPointerUp:Ye(t.onPointerUp,V=>{const te=V.target;te.hasPointerCapture(V.pointerId)&&te.releasePointerCapture(V.pointerId),document.body.style.webkitUserSelect=_.current,y.viewport&&(y.viewport.style.scrollBehavior=""),A.current=null})})})}),As="ScrollAreaThumb",qb=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=Vb(As,t.__scopeScrollArea);return m.jsx(wn,{present:l||s.hasThumb,children:m.jsx(aE,{ref:a,...o})})}),aE=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,style:o,...s}=t,c=xn(As,l),d=Vb(As,l),{onThumbPositionChange:f}=d,p=Tt(a,d.onThumbChange),g=N.useRef(void 0),x=Qs(()=>{g.current&&(g.current(),g.current=void 0)},100);return N.useEffect(()=>{const v=c.viewport;if(v){const w=()=>{if(x(),!g.current){const y=rE(v,f);g.current=y,f()}};return f(),v.addEventListener("scroll",w),()=>v.removeEventListener("scroll",w)}},[c.viewport,x,f]),m.jsx(St.div,{"data-state":d.hasThumb?"visible":"hidden",...s,ref:p,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Ye(t.onPointerDownCapture,v=>{const y=v.target.getBoundingClientRect(),S=v.clientX-y.left,C=v.clientY-y.top;d.onThumbPointerDown({x:S,y:C})}),onPointerUp:Ye(t.onPointerUp,d.onThumbPointerUp)})});qb.displayName=As;var jf="ScrollAreaCorner",Pb=N.forwardRef((t,a)=>{const l=xn(jf,t.__scopeScrollArea),o=!!(l.scrollbarX&&l.scrollbarY);return l.type!=="scroll"&&o?m.jsx(oE,{...t,ref:a}):null});Pb.displayName=jf;var oE=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,...o}=t,s=xn(jf,l),[c,d]=N.useState(0),[f,p]=N.useState(0),g=!!(c&&f),{onCornerWidthChange:x,onCornerHeightChange:v}=s;return go(s.scrollbarX,()=>{var y;const w=((y=s.scrollbarX)==null?void 0:y.offsetHeight)||0;s.onCornerHeightChange(w),p(w)}),go(s.scrollbarY,()=>{var y;const w=((y=s.scrollbarY)==null?void 0:y.offsetWidth)||0;s.onCornerWidthChange(w),d(w)}),N.useEffect(()=>()=>{x(0),v(0)},[x,v]),g?m.jsx(St.div,{...o,ref:a,style:{width:c,height:f,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Ts(t){return t?parseInt(t,10):0}function Qb(t,a){const l=t/a;return isNaN(l)?0:l}function Ps(t){const a=Qb(t.viewport,t.content),l=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-l)*a;return Math.max(o,18)}function lE(t,a,l,o="ltr"){const s=Ps(l),c=s/2,d=a||c,f=s-d,p=l.scrollbar.paddingStart+d,g=l.scrollbar.size-l.scrollbar.paddingEnd-f,x=l.content-l.viewport,v=o==="ltr"?[0,x]:[x*-1,0];return Zb([p,g],v)(t)}function kx(t,a,l="ltr"){const o=Ps(a),s=a.scrollbar.paddingStart+a.scrollbar.paddingEnd,c=a.scrollbar.size-s,d=a.content-a.viewport,f=c-o,p=l==="ltr"?[0,d]:[d*-1,0],g=Zj(t,p);return Zb([0,d],[0,f])(g)}function Zb(t,a){return l=>{if(t[0]===t[1]||a[0]===a[1])return a[0];const o=(a[1]-a[0])/(t[1]-t[0]);return a[0]+o*(l-t[0])}}function Fb(t,a){return t>0&&t<a}var rE=(t,a=()=>{})=>{let l={left:t.scrollLeft,top:t.scrollTop},o=0;return(function s(){const c={left:t.scrollLeft,top:t.scrollTop},d=l.left!==c.left,f=l.top!==c.top;(d||f)&&a(),l=c,o=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(o)};function Qs(t,a){const l=an(t),o=N.useRef(0);return N.useEffect(()=>()=>window.clearTimeout(o.current),[]),N.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(l,a)},[l,a])}function go(t,a){const l=an(a);kn(()=>{let o=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(l)});return s.observe(t),()=>{window.cancelAnimationFrame(o),s.unobserve(t)}}},[t,l])}var sE=Bb,cE=Yb,uE=Pb;function Tl({className:t,children:a,...l}){return m.jsxs(sE,{"data-slot":"scroll-area",className:Ot("relative",t),...l,children:[m.jsx(cE,{"data-slot":"scroll-area-viewport",style:{overflow:"auto"},className:"size-full min-w-0 overflow-hidden rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:a}),m.jsx(dE,{}),m.jsx(uE,{})]})}function dE({className:t,orientation:a="vertical",...l}){return m.jsx(Ib,{"data-slot":"scroll-area-scrollbar","data-orientation":a,orientation:a,className:Ot("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",t),...l,children:m.jsx(qb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function fE({className:t,type:a,...l}){return m.jsx("input",{type:a,"data-slot":"input",className:Ot("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...l})}const hE={frame:SM,group:CM,text:Nb,rectangle:KM,ellipse:lM,image:bb,vector:YM,line:yf,section:Bd};function Wb({type:t,className:a}){const l=hE[t]??hM;return m.jsx(l,{className:Ot("size-3.5 shrink-0",a)})}function mE(){const{selectedNodeId:t,searchQuery:a,selectNode:l,mod:o,hiddenNodeIds:s,toggleNodeVisibility:c}=Ze(Pt(y=>({selectedNodeId:y.selectedNodeId,searchQuery:y.searchQuery,selectNode:y.selectNode,mod:y.getCurrentModule(),hiddenNodeIds:y.hiddenNodeIds,toggleNodeVisibility:y.toggleNodeVisibility}))),d=N.useRef(null),[f,p]=N.useState(()=>{const y=new Set,S=(C,j)=>{if(j<2){y.add(C);const A=o==null?void 0:o.nodes[C];if(A)for(const _ of A.children)S(_,j+1)}};return o&&S(o.rootNodeId,0),y});N.useEffect(()=>{if(!t||!o)return;const y=new Set;let S=t;for(;S;){const C=o.nodes[S];if(!C)break;S=C.parentId,S&&y.add(S)}p(C=>{const j=new Set(C);return y.forEach(A=>j.add(A)),j}),requestAnimationFrame(()=>{var j;const C=(j=d.current)==null?void 0:j.querySelector(`[data-node-id="${t}"]`);C&&C.scrollIntoView({block:"nearest",behavior:"auto"})})},[t,o]);const g=N.useCallback((y,S)=>{S.stopPropagation(),p(C=>{const j=new Set(C);return j.has(y)?j.delete(y):j.add(y),j})},[]),x=N.useCallback(y=>l(y),[l]);if(!o)return null;const v=o.nodes[o.rootNodeId];if(!v)return null;const w=N.useMemo(()=>{if(!t||!o)return new Set;const y=o.nodes[t];if(!y||y.children.length===0)return new Set;const S=new Set,C=j=>{S.add(j);const A=o.nodes[j];if(A)for(const _ of A.children)C(_)};for(const j of y.children)C(j);return S},[t,o]);return m.jsx("div",{ref:d,className:"py-0.5 min-w-0",children:m.jsx(Kb,{node:v,mod:o,depth:0,filter:a,selectedId:t,selectedDescendants:w,expandedNodes:f,hiddenNodeIds:s,onClick:x,onToggleExpand:g,onToggleVisibility:c})})}function Kb({node:t,mod:a,depth:l,filter:o,selectedId:s,selectedDescendants:c,expandedNodes:d,hiddenNodeIds:f,onClick:p,onToggleExpand:g,onToggleVisibility:x}){var R,E;const{t:v}=gt(),w=f.has(t.id),y=!o||t.name.toLowerCase().includes(o.toLowerCase())||t.type.includes(o.toLowerCase())||(((E=(R=t.text)==null?void 0:R.content)==null?void 0:E.toLowerCase().includes(o.toLowerCase()))??!1),S=t.children.map(T=>a.nodes[T]).filter(Boolean),C=S.length>0,j=d.has(t.id),A=j?S.map(T=>m.jsx(Kb,{node:T,mod:a,depth:l+1,filter:o,selectedId:s,selectedDescendants:c,expandedNodes:d,hiddenNodeIds:f,onClick:p,onToggleExpand:g,onToggleVisibility:x},T.id)):null;if(!y&&!S.length&&o)return null;const _=t.id===s,z=c.has(t.id);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{"data-node-id":t.id,"data-type":t.type,role:"button",tabIndex:0,onClick:T=>{T.stopPropagation(),p(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),p(t.id))},className:Ot("group flex items-center gap-1 w-full min-w-0 max-w-full text-left h-7 pr-1 text-xs cursor-pointer",_?"bg-sidebar-primary/15 text-sidebar-accent-foreground font-medium":z?"bg-sidebar-primary/8":"text-sidebar-foreground hover:bg-sidebar-accent/50",!y&&o&&"opacity-30",w&&"opacity-40"),style:{paddingLeft:l*12+4},children:[C?m.jsx("span",{onClick:T=>g(t.id,T),className:"w-4 h-4 flex items-center justify-center shrink-0 cursor-pointer hover:bg-muted rounded-sm",children:m.jsx(wo,{className:Ot("size-3 text-muted-foreground transition-transform duration-150",j&&"rotate-90")})}):m.jsx("span",{className:"w-4 h-4 shrink-0"}),m.jsx(Wb,{type:t.type,className:Ot("size-3 shrink-0",_?"text-sidebar-primary":"text-muted-foreground")}),m.jsx("span",{className:Ot("truncate block flex-1 min-w-0 text-foreground",l===0&&"font-semibold"),style:{maxWidth:120},title:t.name,children:t.name}),m.jsx(Le,{variant:"ghost",className:"text-[9px] h-3.5 px-1 text-muted-foreground font-normal shrink-0",children:t.type}),m.jsx("span",{onClick:T=>{T.stopPropagation(),x(t.id)},className:Ot("w-4 h-4 flex items-center justify-center shrink-0 rounded-sm transition-opacity",w?"opacity-100 text-muted-foreground":"opacity-0 group-hover:opacity-100 text-muted-foreground/60 hover:text-muted-foreground"),title:v(w?"viewer.node.show":"viewer.node.hide"),children:w?m.jsx(xM,{className:"size-3"}):m.jsx(vb,{className:"size-3"})})]}),A]})}function pE(){const{t}=gt(),{exportData:a,searchQuery:l,setSearchQuery:o,findNodeAsset:s,selectNode:c}=Ze(),d=Ze(g=>g.getCurrentModule()),f=N.useMemo(()=>{if(!a||!l.trim())return null;const g=qS(l);return!g.moduleId&&d&&(g.moduleId=d.moduleId),PS(g,a,s)},[a,l,s,d]);if(!a||!d)return null;const p=f!==null;return m.jsxs("aside",{id:"sidebar",className:"hidden min-h-0 min-w-0 flex-col overflow-hidden border-r bg-white xl:flex",children:[m.jsxs("div",{className:"px-3 py-2.5 border-b space-y-2",onClick:()=>c(null),children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[11px] font-medium uppercase tracking-widest text-muted-foreground",children:t("viewer.sidebar.layers")}),m.jsx(Le,{variant:"secondary",className:"text-[10px] h-4.5 px-1.5 font-mono font-normal text-muted-foreground",children:Object.keys(d.nodes).length})]}),m.jsxs("div",{className:"relative",children:[m.jsx(QM,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground/50 pointer-events-none"}),m.jsx(fE,{id:"search-input",value:l,onChange:g=>o(g.target.value),placeholder:t("viewer.sidebar.searchPlaceholder"),className:`h-7 pl-7 text-[10px] bg-muted/50 placeholder:text-muted-foreground rounded-md ${l?"pr-5":""}`}),l&&m.jsx("button",{type:"button","aria-label":t("viewer.sidebar.clearSearch"),title:t("viewer.sidebar.clearSearch"),onClick:()=>o(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:m.jsx(ij,{className:"size-3"})})]})]}),p?m.jsx(Tl,{className:"flex-1 overflow-hidden min-w-0",onClick:()=>c(null),children:m.jsxs("div",{className:"py-1 min-w-0",children:[m.jsx("div",{className:"px-3 py-1 text-[10px] text-muted-foreground",children:t(`viewer.sidebar.resultCount.${f.length===1?"one":"other"}`,{count:f.length})}),f.map(g=>m.jsxs("button",{"data-node-id":g.node.id,className:"flex items-center gap-1.5 w-full text-left h-7 px-3 text-xs hover:bg-sidebar-accent/50",onClick:x=>{x.stopPropagation(),c(g.node.id)},children:[m.jsx(Le,{variant:"ghost",className:"text-[9px] h-3.5 px-1 text-sidebar-foreground/40 font-normal shrink-0",children:g.node.type}),m.jsx("span",{className:"truncate flex-1",children:g.node.name}),g.node.text&&m.jsxs("span",{className:"text-[10px] text-muted-foreground truncate max-w-[80px]",children:['"',g.node.text.content,'"']})]},g.node.id))]})}):m.jsx(Tl,{className:"flex-1 overflow-hidden min-w-0",onClick:()=>c(null),children:m.jsx(mE,{})})]})}function gE(t,a){const o=document.elementsFromPoint(t,a).filter(s=>s instanceof HTMLElement&&!!s.dataset.nodeId).map(s=>({id:s.dataset.nodeId,area:(s.offsetWidth||1)*(s.offsetHeight||1)}));return o.length===0?null:o.reduce((s,c)=>s.area<=c.area?s:c).id}function xE({asset:t,node:a}){var c;const l=(c=a.image)==null?void 0:c.position,o=a.type==="text"&&a.meta.exportReason==="text-rasterized",s={alt:o?"":a.name,"aria-hidden":o?!0:void 0};if((l==null?void 0:l.mode)==="offset"){const d={position:"absolute",pointerEvents:"none",maxWidth:"none",height:"auto",left:l.left,top:l.top};return l.width!=null&&(d.width=l.width),l.height!=null&&(d.height=l.height),m.jsx("img",{style:d,src:t.url,...s,draggable:!1})}if((l==null?void 0:l.mode)==="center"){const d={position:"absolute",pointerEvents:"none",maxWidth:"none",left:"50%",top:"50%",transform:l.transform??"translate(-50%, -50%)",transformOrigin:l.transformOrigin??"center"};return l.width!=null&&(d.width=l.width),l.height!=null&&(d.height=l.height),m.jsx("img",{className:"block",style:d,src:t.url,...s,draggable:!1})}return m.jsx("img",{className:"absolute inset-0 w-full h-full pointer-events-none block",src:t.url,...s,draggable:!1})}function _x(t){return!t||!t.includes(" ")?t:t.replace(/ /g," ")}function vE({node:t}){if(!t.text)return null;if(t.text.listMarkerGeometry&&t.text.content.trim()===""){const{path:d,fillRule:f}=t.text.listMarkerGeometry,p=t.text.color;return m.jsx("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:m.jsx("path",{d,fill:p,fillRule:f})})}const a=t.text.segments&&t.text.segments.length>1,l=t.text.listMarker,o=Mw(t),s=Cw(t);l&&(o.display="list-item",o.listStylePosition="inside",o.paddingLeft="0.25em");const c=a?t.text.segments.map((d,f)=>m.jsx("span",{style:{fontSize:d.fontSize,fontFamily:`'${d.fontFamily}', sans-serif`,fontWeight:d.fontWeight,color:d.color,letterSpacing:d.letterSpacing||void 0,lineHeight:d.lineHeight?`${d.lineHeight}px`:void 0,...d.textDecoration?{textDecoration:d.textDecoration}:{}},children:_x(d.content)},f)):_x(t.text.content);return s?m.jsx("span",{style:s,children:m.jsx("span",{style:o,children:c})}):m.jsx("span",{style:o,children:c})}const Jb=N.memo(function t({node:a,mod:l,isRoot:o=!1,screenshotMode:s=!1,coveredByAncestor:c}){var R,E,T;const{selectNode:d,findNodeAsset:f,displayMode:p,hiddenNodeIds:g}=Ze(Pt(D=>({selectNode:D.selectNode,findNodeAsset:D.findNodeAsset,displayMode:D.displayMode,hiddenNodeIds:D.hiddenNodeIds}))),x=f(a.id),v=p==="map",w=(R=a.text)!=null&&R.content?`${a.name} - ${a.text.content}`:a.name,y=N.useMemo(()=>{var ne;if(!((ne=a.computed)!=null&&ne.maskInfo))return{maskChildId:void 0,hideMaskChild:!1};const{childId:D,coversParent:k,shouldHide:V,background:te}=a.computed.maskInfo;if(!k)return{maskChildId:D,hideMaskChild:!1};const J={},q=f(D);return q&&(J.WebkitMaskImage=`url(${q.url})`,J.maskImage=`url(${q.url})`,J.WebkitMaskSize="100% 100%",J.maskSize="100% 100%",J.WebkitMaskRepeat="no-repeat",J.maskRepeat="no-repeat"),te&&Object.assign(J,ds(te)),{maskChildId:D,hideMaskChild:V,styleUpdates:J}},[a,f]),S=N.useMemo(()=>Nw(a,o,!!x,c,l.nodes),[a,o,x,c,l]),C=y.styleUpdates?{...S,...y.styleUpdates}:S;if(!a.style.visible||g.has(a.id))return null;const j=!!x&&a.children.length===0,A=c||j,{maskChildId:_,hideMaskChild:z}=y;return m.jsxs("div",{"data-node-id":a.id,"data-type":a.type,"data-name":a.name,"data-parent-id":a.parentId??"","data-has-children":a.children.length>0,"data-has-asset":!!x,"data-effects-css-only":x&&((E=a.image)==null?void 0:E.effectsCssOnly)===!0?"true":void 0,"data-virtual":a.isVirtual?"true":void 0,"data-bbox":`${Math.round(a.bbox.x)},${Math.round(a.bbox.y)},${Math.round(a.bbox.width)},${Math.round(a.bbox.height)}`,"data-text":((T=a.text)==null?void 0:T.content)??"","aria-label":`${w} - ${a.type} - ${Math.round(a.bbox.width)}×${Math.round(a.bbox.height)}`,role:"region",className:`design-node ${v?"":"cursor-pointer"}`,style:{...C,...o&&s?{overflow:"visible"}:void 0},onClick:D=>{if(Ze.getState().isDragging){D.stopPropagation();return}D.stopPropagation();const k=gE(D.clientX,D.clientY);d(k??a.id)},children:[x&&!c&&m.jsx(xE,{asset:x,node:a}),gw(a,!!x,c)&&m.jsx(vE,{node:a}),a.children.map(D=>l.nodes[D]).filter(Boolean).map(D=>{var k;return m.jsx(t,{node:D,mod:l,coveredByAncestor:D.id===_?z&&!((k=D.style.strokes)!=null&&k.some(V=>V.width>0)):A},D.id)})]})});function Sd(t,a){let l=t.bbox.x,o=t.bbox.y,s=t.parentId;for(;s;){const c=a.nodes[s];if(!c||c.id===a.rootNodeId)break;l+=c.bbox.x,o+=c.bbox.y,s=c.parentId}return{x:l,y:o,w:t.bbox.width,h:t.bbox.height}}function bE({mod:t}){const a=Ze(x=>x.selectedNodeId),l=a?t.nodes[a]:void 0,o=N.useMemo(()=>l?rv(l,t):[],[l,t]),s=N.useMemo(()=>l?Zd(l,t):null,[l,t]),c=N.useMemo(()=>l?Tw(l,t):null,[l,t]);if(!l)return null;const d=Sd(l,t),f=o.slice(0,4),p=l.parentId?t.nodes[l.parentId]:void 0,g=p?p.id===t.rootNodeId?{x:0,y:0,w:p.bbox.width,h:p.bbox.height}:Sd(p,t):void 0;return m.jsxs("svg",{className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%",zIndex:9999,overflow:"visible"},children:[s&&m.jsx(yE,{rect:d,padding:s}),c&&g&&m.jsx(wE,{nodeRect:d,parentRect:g,spacing:c}),f.map((x,v)=>{const w=t.nodes[x.to.id];if(!w)return null;const y=d,S=Sd(w,t);if(x.direction==="horizontal"){const T=y.x<S.x?y:S,D=y.x<S.x?S:y,k=T.x+T.w,V=D.x,te=Math.max(y.y,S.y),J=Math.min(y.y+y.h,S.y+S.h),q=(te+J)/2;return m.jsxs("g",{children:[m.jsx("line",{x1:k,y1:q,x2:V,y2:q,stroke:"#f43f5e",strokeWidth:1.5}),m.jsx("line",{x1:k,y1:q-8,x2:k,y2:q+8,stroke:"#f43f5e",strokeWidth:2}),m.jsx("line",{x1:V,y1:q-8,x2:V,y2:q+8,stroke:"#f43f5e",strokeWidth:2}),m.jsx(Dx,{x:(k+V)/2,y:q-6,value:x.distance})]},`h-${v}`)}const C=y.y<S.y?y:S,j=y.y<S.y?S:y,A=C.y+C.h,_=j.y,z=Math.max(y.x,S.x),R=Math.min(y.x+y.w,S.x+S.w),E=(z+R)/2;return m.jsxs("g",{children:[m.jsx("line",{x1:E,y1:A,x2:E,y2:_,stroke:"#f43f5e",strokeWidth:1.5}),m.jsx("line",{x1:E-8,y1:A,x2:E+8,y2:A,stroke:"#f43f5e",strokeWidth:2}),m.jsx("line",{x1:E-8,y1:_,x2:E+8,y2:_,stroke:"#f43f5e",strokeWidth:2}),m.jsx(Dx,{x:E+6,y:(A+_)/2,value:x.distance})]},`v-${v}`)})]})}function Dx({x:t,y:a,value:l}){const o=`${l}`,s=Math.max(32,o.length*12+10);return m.jsxs("g",{children:[m.jsx("rect",{x:t-s/2,y:a-10,width:s,height:20,rx:4,fill:"#f43f5e",opacity:.92}),m.jsx("text",{x:t,y:a+4,textAnchor:"middle",fill:"#fff",fontSize:14,fontFamily:"monospace",fontWeight:700,children:l})]})}function yE({rect:t,padding:a}){const l=[];if(a.top>2){const o=t.x+t.w/2;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:o,y1:t.y,x2:o,y2:t.y+a.top,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:o+6,y:t.y+a.top/2,value:a.top})]},"pt"))}if(a.bottom>2){const o=t.x+t.w/2,s=t.y+t.h-a.bottom,c=t.y+t.h;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:o,y1:s,x2:o,y2:c,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:o+6,y:(s+c)/2,value:a.bottom})]},"pb"))}if(a.left>2){const o=t.y+t.h/2;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:t.x,y1:o,x2:t.x+a.left,y2:o,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:t.x+a.left/2,y:o-6,value:a.left})]},"pl"))}if(a.right>2){const o=t.y+t.h/2,s=t.x+t.w-a.right,c=t.x+t.w;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:s,y1:o,x2:c,y2:o,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:(s+c)/2,y:o-6,value:a.right})]},"pr"))}return m.jsx(m.Fragment,{children:l})}function as({x:t,y:a,value:l}){const o=`${l}`,s=Math.max(28,o.length*10+10);return m.jsxs("g",{children:[m.jsx("rect",{x:t-s/2,y:a-9,width:s,height:18,rx:3,fill:"#3b82f6",opacity:.88}),m.jsx("text",{x:t,y:a+4,textAnchor:"middle",fill:"#fff",fontSize:12,fontFamily:"monospace",fontWeight:700,children:l})]})}const Xt="#10b981";function wE({nodeRect:t,parentRect:a,spacing:l}){const o=[];if(o.push(m.jsx("rect",{x:a.x,y:a.y,width:a.w,height:a.h,fill:"none",stroke:Xt,strokeWidth:1,strokeDasharray:"6 3",opacity:.5},"parent-outline")),l.top>0){const s=t.x+t.w/2;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:s,y1:a.y,x2:s,y2:t.y,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:s-4,y1:a.y,x2:s+4,y2:a.y,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:s-4,y1:t.y,x2:s+4,y2:t.y,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:s+6,y:(a.y+t.y)/2,value:l.top})]},"parent-top"))}if(l.bottom>0){const s=t.x+t.w/2,c=t.y+t.h,d=a.y+a.h;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:s,y1:c,x2:s,y2:d,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:s-4,y1:c,x2:s+4,y2:c,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:s-4,y1:d,x2:s+4,y2:d,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:s+6,y:(c+d)/2,value:l.bottom})]},"parent-bottom"))}if(l.left>0){const s=t.y+t.h/2;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:a.x,y1:s,x2:t.x,y2:s,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:a.x,y1:s-4,x2:a.x,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:t.x,y1:s-4,x2:t.x,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:(a.x+t.x)/2,y:s-6,value:l.left})]},"parent-left"))}if(l.right>0){const s=t.y+t.h/2,c=t.x+t.w,d=a.x+a.w;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:c,y1:s,x2:d,y2:s,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:c,y1:s-4,x2:c,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:d,y1:s-4,x2:d,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:(c+d)/2,y:s-6,value:l.right})]},"parent-right"))}return m.jsx(m.Fragment,{children:o})}function os({x:t,y:a,value:l}){const o=`${l}`,s=Math.max(28,o.length*10+10);return m.jsxs("g",{children:[m.jsx("rect",{x:t-s/2,y:a-9,width:s,height:18,rx:3,fill:Xt,opacity:.88}),m.jsx("text",{x:t,y:a+4,textAnchor:"middle",fill:"#fff",fontSize:12,fontFamily:"monospace",fontWeight:700,children:l})]})}function ey(t,a){for(const l of t.querySelectorAll("[data-node-id]"))if(l.dataset.nodeId===a)return l;return null}function $x(t,a,l){const o=ey(t,a);if(!o)return null;const s=t.getBoundingClientRect(),c=o.getBoundingClientRect(),d=Math.max(l,1e-4);return{id:a,x:(c.left-s.left)/d,y:(c.top-s.top)/d,width:c.width/d,height:c.height/d}}function SE({containerRef:t,moduleData:a,zoom:l}){const{selectedNodeId:o,highlightedNodeIds:s,hiddenNodeIds:c,displayMode:d}=Ze(Pt(j=>({selectedNodeId:j.selectedNodeId,highlightedNodeIds:j.highlightedNodeIds,hiddenNodeIds:j.hiddenNodeIds,displayMode:j.displayMode}))),[f,p]=N.useState(null),[g,x]=N.useState([]),v=d==="map";if(N.useLayoutEffect(()=>{const j=t.current;if(!j||v){p(null),x([]);return}const A=[...s].filter(T=>!c.has(T));let _=0;const z=()=>{_=0,p(o&&!c.has(o)?$x(j,o,l):null),x(A.flatMap(T=>{const D=$x(j,T,l);return D?[D]:[]}))},R=()=>{_||(_=window.requestAnimationFrame(z))};z(),window.addEventListener("resize",R);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(R);E==null||E.observe(j);for(const T of[o,...A]){if(!T)continue;const D=ey(j,T);D&&(E==null||E.observe(D))}return()=>{_&&window.cancelAnimationFrame(_),window.removeEventListener("resize",R),E==null||E.disconnect()}},[t,c,s,v,a,o,l]),!f&&g.length===0)return null;const w=Math.max(l,1e-4),y=2/w,S=1/w,C=(j,A,_)=>m.jsx("rect",{x:j.x-S,y:j.y-S,width:j.width+S*2,height:j.height+S*2,fill:"none",stroke:A,strokeWidth:y},_);return m.jsxs("svg",{className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%",zIndex:1e4,overflow:"visible"},children:[g.map(j=>C(j,"rgba(234, 88, 12, 0.9)",`hl-${j.id}`)),f&&C(f,"#2563eb","selected")]})}const At=22,ty=8,ny=7.5,uo=3,NE=100,CE="#ff4800",ME="#ff4800",Nd=20,jE=8,EE=10;function Id(t,a){return t.x<a.x+a.w&&t.x+t.w>a.x&&t.y<a.y+a.h&&t.y+t.h>a.y}function iy(t,a){return t.length>a?t.slice(0,a)+"…":t}function ay(t){return t.length*ny+ty}function zs(t,a,l){return Math.max(a,Math.min(t,l))}function AE(t,a,l,o,s){if(!a)return[];const c=TE(t,a,l,o,s);return OE(c,o,s)}function TE(t,a,l,o,s){const c=[];for(const d of t){const f=Ef(d.absoluteBbox,a,l);if(!zE(f,o,s))continue;const p=iy(d.name,jE),g=`${d.id} · ${p}`,x=ay(g),v=zs(f.x+f.width/2,0,o),w=zs(f.y+f.height/2,0,s),{idealX:y,idealY:S}=RE(v,w,x,o);c.push({nodeId:d.id,labelText:g,labelW:x,dotX:v,dotY:w,idealX:y,idealY:S})}return c.sort((d,f)=>d.idealY-f.idealY||d.idealX-f.idealX),c}function Ef(t,a,l){return{x:(t.x-a.x)*l.zoom+l.panX,y:(t.y-a.y)*l.zoom+l.panY,width:t.width*l.zoom,height:t.height*l.zoom}}function zE(t,a,l){return!(t.x+t.width<0||t.x>a||t.y+t.height<0||t.y>l)}function RE(t,a,l,o){let s=t,c=a-At-uo;return c<0&&(c=a+uo),s=zs(s,uo,o-l-uo),{idealX:s,idealY:c}}function OE(t,a,l){const o=[],s=[];for(const c of t){const d=kE(c,o,a,l);o.push({x:d.x,y:d.y,w:c.labelW,h:At}),s.push({nodeId:c.nodeId,labelText:c.labelText,labelW:c.labelW,...d,dotX:c.dotX,dotY:c.dotY})}return s}function kE(t,a,l,o){for(let s=0;s<40;s++){const c=t.idealY+s*(At+uo);if(c+At>o+10)break;const d=_E(t.idealX,t.labelW,l);for(const f of d){const p={x:f,y:c,w:t.labelW,h:At};if(!a.some(g=>Id(p,g)))return{x:f,y:c}}}return{x:t.idealX,y:Math.min(t.idealY,o-At-uo)}}function _E(t,a,l){const o=[t],s=t+a+4;s+a<=l&&o.push(s);const c=t-a-4;return c>=0&&o.push(c),o}function DE(t,a,l,o){return t<a?"left":a<t?"right":l<o/2?"left":"right"}function $E(t,a,l,o,s){if(!a)return new Map;const c=LE(l,a),d=[...t].sort((x,v)=>x.absoluteBbox.y-v.absoluteBbox.y),f=new Map,p=[],g={left:0,right:0};for(const x of d){const v=Ef(x.absoluteBbox,a,l),w=v.x+v.width/2,y=DE(g.left,g.right,w,o),S=UE(x,a,l,s,c,y,p);f.set(x.id,S),p.push({x:S.labelX,y:S.labelY,w:S.width,h:S.height});const{leftX:C}=oy(c,S.width),j=S.labelX<C+S.width?"left":"right";g[j]++}return f}function LE(t,a){return{left:t.panX,right:t.panX+a.width*t.zoom,top:t.panY}}function UE(t,a,l,o,s,c,d){const f=Ef(t.absoluteBbox,a,l),p=iy(t.name,EE),g=`${t.id} · ${p}`,x=ay(g),{leftX:v,rightX:w}=oy(s,x),y=zs(f.y+f.height/2-At/2,s.top,o-At-10),{labelX:S,labelY:C}=BE(c==="left"?v:w,y,x,d,c,v,w),{anchorX:j,anchorY:A}=HE(f,s,o,S);return{nodeId:t.id,labelX:S,labelY:C,anchorX:j,anchorY:A,width:x,height:At,labelText:g}}function oy(t,a){return{leftX:t.left-a-40,rightX:t.right+40}}function BE(t,a,l,o,s,c,d){let f=t,p=a,g={x:f,y:p,w:l,h:At},x=0;for(;o.some(v=>Id(g,v))&&x<Nd;)p+=At+8,g={x:f,y:p,w:l,h:At},x++;if(x>=Nd)for(f=s==="left"?d:c,p=a,g={x:f,y:p,w:l,h:At},x=0;o.some(v=>Id(g,v))&&x<Nd;)p+=At+8,g={x:f,y:p,w:l,h:At},x++;return{labelX:f,labelY:p}}function HE(t,a,l,o){const s=Math.max(t.x,a.left),c=Math.min(t.x+t.width,a.right),d=Math.max(t.y,a.top),f=Math.min(t.y+t.height,l);return{anchorX:o<a.left?s:c,anchorY:(d+f)/2}}function YE({camera:t,mod:a,areaRef:l}){const{selectedNodeId:o,selectNode:s}=Ze(Pt(w=>({selectedNodeId:w.selectedNodeId,selectNode:w.selectNode}))),{root:c,focusNode:d,directChildren:f}=N.useMemo(()=>{const w=a.nodes[a.rootNodeId],y=o??a.rootNodeId,S=a.nodes[y]??w,C=S?S.children.map(j=>a.nodes[j]).filter(j=>!!j&&j.style.visible):[];return{root:w,focusNode:S,directChildren:C}},[a.nodes,a.rootNodeId,o]),p=IE(l),g=GE(c,t,p.width),x=N.useMemo(()=>g==="tooltip"?AE(f,c==null?void 0:c.absoluteBbox,t,p.width,p.height):[],[g,f,c,t,p]),v=N.useMemo(()=>g==="line"?$E(f,c==null?void 0:c.absoluteBbox,t,p.width,p.height):new Map,[g,f,c,t,p.width,p.height]);return!c||!d?null:m.jsxs("svg",{className:"absolute inset-0 pointer-events-none z-40",width:p.width,height:p.height,children:[m.jsx(VE,{focusNode:d,childrenCount:f.length}),g==="tooltip"&&m.jsx(XE,{tooltips:x,onSelectNode:s}),g==="line"&&m.jsx(qE,{childNodes:f,labelPlacements:v,onSelectNode:s})]})}function IE(t){var l;const a=(l=t.current)==null?void 0:l.getBoundingClientRect();return{width:(a==null?void 0:a.width)??800,height:(a==null?void 0:a.height)??600}}function GE(t,a,l){const o=t?t.absoluteBbox.width*a.zoom:0,s=a.panX,c=l-(a.panX+o);return Math.max(s,c)>=NE?"line":"tooltip"}function VE({focusNode:t,childrenCount:a}){const{t:l}=gt(),o=l(`viewer.map.childCount.${a===1?"one":"other"}`,{count:a}),s=`${t.id} · ${t.name} (${o})`,c=s.length*ny+20;return m.jsxs("g",{transform:"translate(12, 12)",children:[m.jsx("rect",{x:"0",y:"0",width:c,height:"24",rx:"4",fill:"rgba(0,0,0,0.75)"}),m.jsx("text",{x:"10",y:"16",fill:"#fff",fontSize:"12",fontWeight:"700",fontFamily:"ui-monospace, monospace",children:s})]})}function XE({tooltips:t,onSelectNode:a}){return m.jsx(m.Fragment,{children:t.map(l=>m.jsxs("g",{className:"pointer-events-auto cursor-pointer",onClick:()=>a(l.nodeId),children:[m.jsx("circle",{cx:l.dotX,cy:l.dotY,r:"3",fill:"rgba(0,0,0,0.85)"}),m.jsx("rect",{x:l.x,y:l.y,width:l.labelW,height:At,rx:"3",fill:"rgba(0,0,0,0.82)"}),m.jsx("text",{x:l.x+ty,y:l.y+At/2+4,fill:"#fff",fontSize:"11",fontWeight:"600",fontFamily:"ui-monospace, monospace",style:{userSelect:"none"},children:l.labelText})]},l.nodeId))})}function qE({childNodes:t,labelPlacements:a,onSelectNode:l}){return m.jsx(m.Fragment,{children:t.map(o=>{const s=a.get(o.id);if(!s)return null;const c=s.labelX<s.anchorX?s.labelX+s.width:s.labelX,d=s.labelY+s.height/2;return m.jsxs("g",{className:"pointer-events-auto",onClick:()=>l(o.id),children:[m.jsx("line",{x1:s.anchorX,y1:s.anchorY,x2:c,y2:d,stroke:ME,strokeWidth:"2"}),m.jsx("circle",{cx:s.anchorX,cy:s.anchorY,r:"4",fill:CE}),m.jsx("text",{x:s.labelX+s.width/2,y:s.labelY+s.height/2+5,textAnchor:"middle",fill:"#fff",fontSize:"12",fontWeight:"600",fontFamily:"ui-monospace, monospace",style:{userSelect:"none"},children:s.labelText})]},o.id)})})}function PE(t,a){let l=t.absoluteBbox.x,o=t.absoluteBbox.y,s=t.absoluteBbox.x+t.absoluteBbox.width,c=t.absoluteBbox.y+t.absoluteBbox.height,d=t.parentId;for(;d;){const g=a.nodes[d];if(!g)break;g.style.overflow==="hidden"&&(l=Math.max(l,g.absoluteBbox.x),o=Math.max(o,g.absoluteBbox.y),s=Math.min(s,g.absoluteBbox.x+g.absoluteBbox.width),c=Math.min(c,g.absoluteBbox.y+g.absoluteBbox.height)),d=g.parentId}const f=Math.max(0,s-l),p=Math.max(0,c-o);return f>0&&p>0?{x:l,y:o,width:f,height:p}:{...t.absoluteBbox}}const QE=24;function ha(t,a){return Math.max(QE,t-a*2)}function ZE(t,a,l){const s=Math.min(ha(t.width,40)/l.bbox.width,ha(t.height,40)/l.bbox.height,2),c=Math.min(ha(t.width,60)/a.width,ha(t.height,60)/a.height,s*1.5),d=a.x-l.absoluteBbox.x,f=a.y-l.absoluteBbox.y;return{zoom:c,panX:(t.width-a.width*c)/2-d*c,panY:(t.height-a.height*c)/2-f*c}}function Lx({screenshotMode:t=!1}={}){const{t:a}=gt(),{mod:l,selectNode:o,displayMode:s,fitTargetNodeId:c,setFitTargetNodeId:d,canvasBgColor:f,toggleCanvasBgColor:p}=Ze(Pt(q=>({mod:q.getCurrentModule(),selectNode:q.selectNode,displayMode:q.displayMode,fitTargetNodeId:q.fitTargetNodeId,setFitTargetNodeId:q.setFitTargetNodeId,canvasBgColor:q.canvasBgColor,toggleCanvasBgColor:q.toggleCanvasBgColor}))),g=N.useRef(null),x=N.useRef(null),[v,w]=N.useState({zoom:1,panX:0,panY:0}),[y,S]=N.useState(!1),[C,j]=N.useState(!1),A=N.useRef({x:0,y:0}),_=N.useRef(s),z=N.useCallback(()=>{const q=g.current;if(!q||!l)return 1;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return 1;const oe=40,U=ha(ne.width,oe)/ae.bbox.width,Q=ha(ne.height,oe)/ae.bbox.height;return Math.min(U,Q,2)},[l]),R=N.useCallback(()=>{const q=g.current;if(!q||!l)return!1;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return!1;const oe=z(),U=ae.bbox.width,Q=ae.bbox.height;return w({zoom:oe,panX:(ne.width-U*oe)/2,panY:(ne.height-Q*oe)/2}),!0},[l,z]),E=N.useCallback(()=>{const q=g.current;if(!q||!l)return;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return;const oe=40,U=Math.min(ha(ne.width,oe)/ae.bbox.width,2),Q=ae.bbox.width;w({zoom:U,panX:(ne.width-Q*U)/2,panY:oe})},[l]);N.useEffect(()=>{if(!c||!l||!y)return;if(s==="visual"){d(null);return}const q=l.nodes[c],ne=g.current,ae=l.nodes[l.rootNodeId];!q||!ne||!ae||(w(ZE(ne.getBoundingClientRect(),PE(q,l),ae)),d(null))},[c,l,y,s,d]),N.useEffect(()=>{_.current!=="visual"&&s==="visual"&&y&&R(),_.current=s},[s,y,R]);const T=N.useCallback((q,ne,ae)=>{w(oe=>{const U=Math.max(.05,Math.min(10,oe.zoom*q)),Q=U/oe.zoom;return{zoom:U,panX:ne-(ne-oe.panX)*Q,panY:ae-(ae-oe.panY)*Q}})},[]),D=N.useCallback(q=>{const ne=g.current;if(!ne)return;const ae=ne.getBoundingClientRect();T(q,ae.width/2,ae.height/2)},[T]);N.useEffect(()=>{const q=g.current;if(!q)return;R()&&S(!0);const ne=ae=>{if(ae.preventDefault(),ae.ctrlKey||ae.metaKey){const oe=q.getBoundingClientRect(),U=ae.clientX-oe.left,Q=ae.clientY-oe.top,K=ae.deltaY>0?.92:1.08;T(K,U,Q)}else w(oe=>({...oe,panX:oe.panX-ae.deltaX,panY:oe.panY-ae.deltaY}))};return q.addEventListener("wheel",ne,{passive:!1}),()=>q.removeEventListener("wheel",ne)},[R,T]);const k=N.useCallback(q=>{q.button===0&&(q.target.closest("[data-node-id]")||o(null),q.preventDefault(),j(!0),A.current={x:q.clientX,y:q.clientY})},[o]),V=N.useCallback(()=>{const q=g.current;if(!q||!l)return;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return;const oe=z(),U=.01;w(Q=>{let K;if(oe>=1-U?K=(Q.zoom>=oe-U,oe):Q.zoom<oe-U?K=oe:Q.zoom<1-U?K=1:K=oe,Math.abs(K-oe)<U){const Z=ae.bbox.width,ie=ae.bbox.height;return{zoom:oe,panX:(ne.width-Z*oe)/2,panY:(ne.height-ie*oe)/2}}const de=ne.width/2,ee=ne.height/2,$=K/Q.zoom;return{zoom:K,panX:de-(de-Q.panX)*$,panY:ee-(ee-Q.panY)*$}})},[l,z]);N.useEffect(()=>{if(!C)return;const q=ae=>{const oe=ae.clientX-A.current.x,U=ae.clientY-A.current.y;(Math.abs(oe)>3||Math.abs(U)>3)&&Ze.getState().setIsDragging(!0),w(Q=>({...Q,panX:Q.panX+oe,panY:Q.panY+U})),A.current={x:ae.clientX,y:ae.clientY}},ne=()=>{j(!1),requestAnimationFrame(()=>{Ze.getState().setIsDragging(!1)})};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",ne),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",ne)}},[C]);const te=f==="dark"?"bg-[#0d0d0d]":"bg-white";if(!l)return m.jsx("main",{id:"canvas",className:te});const J=l.nodes[l.rootNodeId];return J?m.jsxs("main",{id:"canvas",ref:g,className:Ot("relative overflow-hidden",te,C?"cursor-grabbing":"cursor-grab"),onMouseDown:k,onDoubleClick:V,children:[m.jsxs("div",{ref:x,className:t?"will-change-transform":"will-change-transform transition-opacity duration-200",style:{width:J.bbox.width,height:J.bbox.height,position:"relative",transform:`translate(${v.panX}px, ${v.panY}px) scale(${v.zoom})`,transformOrigin:"0 0",opacity:t||y?1:0},children:[m.jsx(Jb,{node:J,mod:l,isRoot:!0,screenshotMode:t,coveredByAncestor:!1}),!t&&m.jsx(SE,{containerRef:x,moduleData:l,zoom:v.zoom}),m.jsx(bE,{mod:l})]}),s==="map"&&m.jsx(YE,{camera:v,mod:l,areaRef:g}),!t&&m.jsxs("div",{"data-screenshot-hide":!0,className:"absolute bottom-3 left-1/2 z-50 flex max-w-[calc(100vw-24px)] -translate-x-1/2 items-center gap-0.5 rounded-lg border border-white/10 bg-black/80 p-1 backdrop-blur-md sm:bottom-4",children:[m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a(f==="dark"?"viewer.canvas.switchLight":"viewer.canvas.switchDark"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:p,children:f==="dark"?m.jsx(ej,{className:"size-3"}):m.jsx(_M,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a(f==="dark"?"viewer.canvas.switchLight":"viewer.canvas.switchDark")})]}),m.jsx("div",{className:"h-3.5 w-px bg-white/10 mx-0.5"}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.fitView"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:R,children:m.jsx(TM,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.fitView")})]}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.fitWidth"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:E,children:m.jsx($M,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.fitWidth")})]}),m.jsx("div",{className:"h-3.5 w-px bg-white/10 mx-0.5"}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.zoomOut"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:()=>D(1/1.25),children:m.jsx(yf,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.zoomOut")})]}),m.jsxs("span",{className:"text-[10px] text-white/35 w-10 text-center tabular-nums select-none font-mono",children:[Math.round(v.zoom*100),"%"]}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.zoomIn"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:()=>D(1.25),children:m.jsx(Sb,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.zoomIn")})]})]})]}):m.jsx("main",{id:"canvas",className:te})}const FE="0.0.3",Ux="/mcp",Bx="2025-06-18",Hx=-32001;class wt extends Error{constructor(a,l,o="INVALID_RESPONSE",s){super(a),this.code=l,this.reason=o,this.domainCode=s,this.name="McpClientError"}}class WE{constructor(){_i(this,"requestId",0);_i(this,"sessionId",null);_i(this,"initialized",!1);_i(this,"negotiatedProtocolVersion",Bx);_i(this,"initializePromise",null)}async callTool(a,l,o){await this.ensureInitialized();let s;try{s=await this.request("tools/call",{name:a,arguments:l},o)}catch(d){if(!(d instanceof wt)||d.reason!=="SESSION_EXPIRED")throw d;await this.ensureInitialized(),s=await this.request("tools/call",{name:a,arguments:l},o)}const c=this.extractToolPayload(s);if(s.isError){const d=lA(c);throw new wt(d.message||`MCP tool ${a} failed`,void 0,"TOOL_ERROR",d.code)}return c}close(){const a=this.sessionId;this.resetSession(),this.initializePromise=null,a&&fetch(Ux,{method:"DELETE",headers:{Accept:"application/json, text/event-stream","MCP-Protocol-Version":this.negotiatedProtocolVersion,"MCP-Session-Id":a},keepalive:!0}).then(l=>{var o;return(o=l.body)==null?void 0:o.cancel()}).catch(()=>{})}async ensureInitialized(){if(!this.initialized)return this.initializePromise||(this.initializePromise=this.initialize().finally(()=>{this.initializePromise=null})),this.initializePromise}resetSession(){this.sessionId=null,this.initialized=!1}sessionExpiredError(a){return this.resetSession(),new wt(a,Hx,"SESSION_EXPIRED")}async initialize(){const a=await this.request("initialize",{protocolVersion:Bx,capabilities:{},clientInfo:{name:"tarot-pixel-view",version:FE}});a.protocolVersion&&(this.negotiatedProtocolVersion=a.protocolVersion),await this.notify("notifications/initialized"),this.initialized=!0}async request(a,l,o){const s=++this.requestId,c=await this.post({jsonrpc:"2.0",id:s,method:a,params:l},o),d=await this.readJsonRpcResponse(c,s);if("error"in d)throw d.error.code===Hx?this.sessionExpiredError(d.error.message):new wt(d.error.message,d.error.code,"RPC_ERROR");return d.result}async notify(a){const l=await this.post({jsonrpc:"2.0",method:a});if(!l.ok)throw new wt(`MCP notification failed with HTTP ${l.status}`,void 0,"REQUEST_FAILED")}async post(a,l){const o=this.sessionId!==null,s={Accept:"application/json, text/event-stream","Content-Type":"application/json","MCP-Protocol-Version":this.negotiatedProtocolVersion};this.sessionId&&(s["Mcp-Session-Id"]=this.sessionId);const c=await fetch(Ux,{method:"POST",headers:s,body:JSON.stringify(a),signal:l}),d=c.headers.get("Mcp-Session-Id");if(d&&(this.sessionId=d),!c.ok)throw c.status===404&&o?this.sessionExpiredError("The MCP session has expired"):new wt(`MCP request failed with HTTP ${c.status}`,void 0,"REQUEST_FAILED");return c}async readJsonRpcResponse(a,l){if(a.status===202||a.status===204)throw new wt("The MCP request did not return a JSON-RPC result",void 0,"EMPTY_RESPONSE");if((a.headers.get("content-type")??"").includes("text/event-stream")){const d=(await a.text()).split(/\r?\n\r?\n/).flatMap(f=>{const p=f.split(/\r?\n/).filter(g=>g.startsWith("data:")).map(g=>g.slice(5).trim()).join(`
|
|
254
|
+
*/const nj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ij=_e("x",nj);function Vs(t,a){return{en:t,"zh-CN":a}}const aj=Vs({"app.documentTitle":"Tarot Pixel","app.name":"Tarot Pixel","common.loading":"Loading...","common.loadFailed":"Failed to load","common.retry":"Retry","common.unknownTime":"Unknown time","language.label":"Language","language.english":"English","language.simplifiedChinese":"Simplified Chinese","settings.title":"Preferences","menu.open":"Open menu","navigation.backToDesignOverview":"Back to design overview","navigation.backToDesignList":"Back to design list","navigation.myDesigns":"My designs"},{"app.documentTitle":"Tarot Pixel","app.name":"Tarot Pixel","common.loading":"加载中...","common.loadFailed":"加载失败","common.retry":"重试","common.unknownTime":"未知时间","language.label":"语言","language.english":"English","language.simplifiedChinese":"简体中文","settings.title":"偏好设置","menu.open":"打开菜单","navigation.backToDesignOverview":"返回设计稿概览","navigation.backToDesignList":"返回设计稿列表","navigation.myDesigns":"我的设计稿"}),oj=Vs({"dashboard.designList.loadFailed":"Failed to load designs","dashboard.delete.confirm":"Delete this export? Its link will no longer be available after deletion.","dashboard.delete.failed":"Failed to delete export","dashboard.delete.succeeded":"Export deleted","dashboard.copy.failed":"Failed to copy link","dashboard.copy.succeeded":"Link copied","dashboard.toast.close":"Close notification","dashboard.count.design.one":"{count} design","dashboard.count.design.other":"{count} designs","dashboard.count.export.one":"{count} export","dashboard.count.export.other":"{count} exports","dashboard.count.module.one":"{count} module","dashboard.count.module.other":"{count} modules","dashboard.search.placeholder":"Search designs or exports","dashboard.search.clear":"Clear search","dashboard.empty.noDesigns.title":"No designs yet","dashboard.empty.noDesigns.description":"Sync a design from a design tool plugin to see it here","dashboard.empty.noResults.title":"No matching results","dashboard.empty.noResults.description":"Try a different search term","dashboard.time.justNow":"Just now","dashboard.time.minute.one":"{count} minute ago","dashboard.time.minute.other":"{count} minutes ago","dashboard.time.hour.one":"{count} hour ago","dashboard.time.hour.other":"{count} hours ago","dashboard.time.day.one":"{count} day ago","dashboard.time.day.other":"{count} days ago","dashboard.export.unnamed":"Unnamed export","dashboard.export.titleWithMore":"{title} + {restCount} more","dashboard.export.latestAt":"Latest {time}","dashboard.export.latest":"Latest","dashboard.export.listLabel":"Exports","dashboard.export.expandList":"Expand export list","dashboard.export.collapseList":"Collapse export list","dashboard.export.selectSource":"Select a source design","dashboard.export.copyLink":"Copy export link","dashboard.export.delete":"Delete this export","dashboard.mobile.loadingDesigns":"Loading designs","dashboard.mobile.selectDesign":"Select a design","dashboard.mobile.noDesigns":"No designs","dashboard.mobile.selectExport":"Select an export","dashboard.mobile.exportVersion":"Export version","dashboard.module.preview":"Preview","dashboard.module.selectExport":"Select an export to view its modules","dashboard.module.loading":"Loading modules...","dashboard.module.loadFailed":"Failed to load modules","dashboard.module.empty":"This export has no modules","dashboard.module.open":"Open module {name}","dashboard.module.viewInMgdone":"View in mgdone"},{"dashboard.designList.loadFailed":"设计稿列表加载失败","dashboard.delete.confirm":"确定要删除这次导出吗?删除后对应链接将不可访问。","dashboard.delete.failed":"删除失败","dashboard.delete.succeeded":"删除成功","dashboard.copy.failed":"复制失败","dashboard.copy.succeeded":"链接已复制","dashboard.toast.close":"关闭通知","dashboard.count.design.one":"{count} 个","dashboard.count.design.other":"{count} 个","dashboard.count.export.one":"{count} 次导出","dashboard.count.export.other":"{count} 次导出","dashboard.count.module.one":"{count} 个模块","dashboard.count.module.other":"{count} 个模块","dashboard.search.placeholder":"搜索视觉稿或导出","dashboard.search.clear":"清空搜索","dashboard.empty.noDesigns.title":"暂无设计稿","dashboard.empty.noDesigns.description":"在设计工具插件中同步后显示","dashboard.empty.noResults.title":"无匹配结果","dashboard.empty.noResults.description":"换个关键词试试","dashboard.time.justNow":"刚刚","dashboard.time.minute.one":"{count} 分钟前","dashboard.time.minute.other":"{count} 分钟前","dashboard.time.hour.one":"{count} 小时前","dashboard.time.hour.other":"{count} 小时前","dashboard.time.day.one":"{count} 天前","dashboard.time.day.other":"{count} 天前","dashboard.export.unnamed":"未命名导出","dashboard.export.titleWithMore":"{title},另有 {restCount} 个模块","dashboard.export.latestAt":"最新 {time}","dashboard.export.latest":"最新","dashboard.export.listLabel":"导出","dashboard.export.expandList":"展开导出列表","dashboard.export.collapseList":"收起导出列表","dashboard.export.selectSource":"选择一个原始设计稿","dashboard.export.copyLink":"复制导出链接","dashboard.export.delete":"删除这次导出","dashboard.mobile.loadingDesigns":"加载设计稿","dashboard.mobile.selectDesign":"选择设计稿","dashboard.mobile.noDesigns":"暂无设计稿","dashboard.mobile.selectExport":"选择导出","dashboard.mobile.exportVersion":"导出版本","dashboard.module.preview":"预览","dashboard.module.selectExport":"选择一次导出查看模块","dashboard.module.loading":"加载模块中...","dashboard.module.loadFailed":"模块加载失败","dashboard.module.empty":"这次导出没有模块","dashboard.module.open":"打开模块 {name}","dashboard.module.viewInMgdone":"在 mgdone 中查看"}),lj=Vs({"detail.empty.selectNode":"Select a node to view its details","detail.empty.nodeNotFound":"Node not found","detail.header.componentId":"Component ID: {id}","detail.header.componentFallback":"Component","detail.section.path":"Path","detail.section.css":"CSS","detail.section.compositeAnalysis":"Composite-layer analysis","detail.section.layout":"Layout","detail.section.hints":"Hints analysis","detail.section.designToolLayout":"Design-tool layout","detail.section.spacing":"Spacing","detail.section.componentDetection":"Component detection","detail.section.appearance":"Appearance","detail.section.text":"Text","detail.section.asset":"Asset","detail.section.context":"Context","detail.section.nodeInfo":"Node info","detail.section.rawHints":"Hints","detail.section.compactContext":"Compact context","detail.section.children.one":"Child ({count})","detail.section.children.other":"Children ({count})","detail.action.copyCss":"Copy CSS","detail.action.copyCompositeAnalysis":"Copy composite-layer analysis","detail.action.copyAssetUrl":"Copy asset URL","detail.action.openAsset":"Open asset in a new tab","detail.field.position":"Position","detail.field.size":"Size","detail.field.parent":"Parent","detail.field.children":"Children","detail.field.display":"Display","detail.field.mainAxis":"Main axis","detail.field.gap":"Gap","detail.field.mainAxisAlignment":"Main-axis alignment","detail.field.crossAxisAlignment":"Cross-axis alignment","detail.field.padding":"Padding","detail.field.opacity":"Opacity","detail.field.borderRadius":"Border radius","detail.field.overflow":"Overflow","detail.field.blendMode":"Blend mode","detail.field.fill":"Fill","detail.field.stroke":"Stroke","detail.field.shadow":"Shadow","detail.field.content":"Content","detail.field.font":"Font","detail.field.fontSize":"Font size","detail.field.fontWeight":"Font weight","detail.field.color":"Color","detail.field.lineHeight":"Line height","detail.field.horizontalAlignment":"Horizontal alignment","detail.field.verticalAlignment":"Vertical alignment","detail.field.file":"File","detail.field.format":"Format","detail.field.url":"URL","detail.value.rootNode":"(root node)","detail.value.automatic":"Auto","detail.value.clipped":"Clipped","detail.value.visible":"Visible","detail.value.yes":"Yes","detail.value.no":"No","detail.value.yesHorizontal":"Yes (horizontal arrangement)","detail.value.yesVertical":"Yes (vertical arrangement)","detail.direction.top":"Top","detail.direction.right":"Right","detail.direction.bottom":"Bottom","detail.direction.left":"Left","detail.direction.horizontal":"Horizontal","detail.direction.vertical":"Vertical","detail.direction.both":"Both","detail.spacing.padding":"Padding","detail.spacing.uniform":"Uniform","detail.spacing.siblings":"Sibling spacing","detail.more.one":"+{count} more item...","detail.more.other":"+{count} more items...","detail.component.summary.one":"{count} child, {width}×{height}","detail.component.summary.other":"{count} children, {width}×{height}","detail.text.segments":"Text segments","detail.composite.strategy.decorative":"Decorative","detail.composite.strategy.review":"Review","detail.composite.strategy.text":"Text","detail.composite.strategy.code":"Code","detail.composite.assetSuggestion":"Exported asset: {file} ({width}×{height}) → use an img directly if this is decorative","detail.composite.preview":"Background preview (text layers excluded)","detail.export.compositeTitle":"Composite-layer export recommendation — {name} ({id}, sourceId: {sourceId})","detail.export.size":"Size: {width}×{height}","detail.export.decorativeHeading":"Decorative layers suitable for background compositing (high confidence):","detail.export.reviewHeading":"Layers requiring review (low confidence):","detail.export.keepHeading":"Layers to keep as code or text:","detail.export.itemWithCoverage":" - {name} ({type}) — {reason} [coverage {coverage}%]","detail.export.item":" - {name} ({type}) — {reason}","detail.hints.role.decorative":"Decorative","detail.hints.role.text":"Text","detail.hints.role.container":"Container","detail.hints.role.interactive":"Interactive","detail.hints.decorativeReason.maskChild":"Mask child","detail.hints.decorativeReason.maskLayer":"Mask layer","detail.hints.decorativeReason.ghostLayer":"Ghost layer (no visible styles)","detail.hints.decorativeReason.backgroundLayer":"Background layer","detail.hints.decorativeReason.ornamentalShape":"Decorative shape","detail.hints.decorativeReason.separator":"Separator","detail.hints.badge.ghost":"Ghost layer","detail.hints.badge.background":"Background layer","detail.hints.badge.horizontalSeparator":"Horizontal separator","detail.hints.badge.verticalSeparator":"Vertical separator","detail.hints.badge.scrollCandidate":"Possible scroll area","detail.hints.field.decorativeReason":"Decorative reason","detail.hints.field.containerType":"Container type","detail.hints.container.transparent":"Transparent container","detail.hints.container.visualBoundary":"Visual-boundary container","detail.hints.childrenAxis":"Child axes","detail.hints.field.xNonOverlapping":"No X-axis overlap","detail.hints.field.yNonOverlapping":"No Y-axis overlap","detail.hints.childrenSpacing":"Child spacing","detail.hints.spacing.uniform":"Uniform {gap}px","detail.hints.spacing.nonUniform":"Non-uniform [{gaps}{suffix}]","detail.hints.childrenAlignment":"Child alignment","detail.hints.alignment.top":"Top aligned","detail.hints.alignment.bottom":"Bottom aligned","detail.hints.alignment.centerY":"Vertically centered","detail.hints.alignment.left":"Left aligned","detail.hints.alignment.right":"Right aligned","detail.hints.alignment.centerX":"Horizontally centered","detail.hints.sizeUniformity":"Child size consistency","detail.hints.field.widthUniform":"Consistent widths","detail.hints.field.heightUniform":"Consistent heights","detail.hints.field.similarity":"Similarity","detail.hints.overflow":"Overflow detection","detail.hints.field.direction":"Direction","detail.hints.field.containerViewport":"Container / viewport","detail.hints.visibility.full":"Fully visible","detail.hints.visibility.partial":"Partially visible: {pixels}px","detail.hints.stackingGroups.one":"Stacking group ({count})","detail.hints.stackingGroups.other":"Stacking groups ({count})","detail.hints.overlaps":"Overlaps","detail.hints.similarSiblings":"Similar sibling nodes","detail.hints.field.structureSignature":"Structure signature","detail.hints.field.containedBy":"Contained by","detail.hints.grouping":"Visual grouping","detail.hints.axis.horizontal":"Horizontal","detail.hints.axis.vertical":"Vertical","detail.hints.axis.stack":"Stack","detail.hints.confidence":"Confidence {confidence}","detail.hints.ungrouped":"Ungrouped:","detail.hints.interGroup":"Between groups: {axis} arrangement","detail.hints.interGroupSpacing":", spacing {spacing}px","detail.hints.interGroupAlignment":", {alignment}","detail.hints.contentFlow":"Content flow","detail.hints.field.primaryDirection":"Primary direction","detail.hints.flow.topToBottom":"Top to bottom","detail.hints.flow.leftToRight":"Left to right","detail.hints.section.header":"Header","detail.hints.section.body":"Body","detail.hints.section.footer":"Footer","detail.hints.section.sidebar":"Sidebar","detail.hints.section.content":"Content","detail.hints.constraints":"Constraints","detail.hints.constraint.fillWidth":"Fill width","detail.hints.constraint.fillHeight":"Fill height","detail.hints.constraint.centerX":"Horizontally centered","detail.hints.constraint.centerY":"Vertically centered","detail.hints.constraint.symmetricX":"Symmetric horizontal padding","detail.hints.constraint.symmetricY":"Symmetric vertical padding","detail.hints.constraint.intrinsic":"Intrinsic size","detail.hints.constraint.padding":"Top {top} Right {right} Bottom {bottom} Left {left}px","detail.hints.layoutPattern":"Layout pattern: {type}","detail.hints.layoutPattern.list":"List","detail.hints.layoutPattern.grid":"Grid","detail.hints.layoutPattern.cardGroup":"Card group","detail.hints.layoutPattern.tabBar":"Tab bar","detail.hints.layoutPattern.carousel":"Carousel","detail.hints.layoutPattern.specification":"Specification","detail.hints.layoutPattern.specificationValue":"{rows} rows × {columns} columns","detail.hints.stackingDetail":"Stacking analysis: {type}","detail.hints.stacking.decorativeOverlay":"Decorative overlay","detail.hints.stacking.containedOverlay":"Contained overlay","detail.hints.stacking.overlappingSimilar":"Overlapping similar elements","detail.hints.stacking.floating":"Floating element","detail.hints.stacking.unknown":"Unknown","detail.hints.semantic":"Semantic inference: {role}","detail.hints.semantic.card":"Card","detail.hints.semantic.listItem":"List item","detail.hints.semantic.navItem":"Navigation item","detail.hints.semantic.avatarName":"Avatar + name","detail.hints.semantic.thumbnailTitle":"Thumbnail + title","detail.hints.semantic.iconText":"Icon + text","detail.hints.semantic.labelValue":"Label-value pair","detail.hints.semantic.mediaBlock":"Media block","detail.data.id":"ID","detail.data.name":"Name","detail.data.type":"Type","detail.data.sourceId":"Source ID","detail.data.boundingBox":"Bounding box","detail.data.parent":"Parent","detail.data.children":"Children","detail.data.root":"(root)","detail.data.asset":"Asset","detail.data.assetUrl":"Asset URL","detail.data.text":"Text","detail.data.font":"Font","detail.data.color":"Color","detail.data.alignment":"Alignment","detail.data.verticalAlignment":"Vertical alignment","detail.data.segmented":"Segmented ({count} parts, use <span>):","detail.data.style":"Style","detail.data.opacity":"Opacity","detail.data.overflow":"Overflow","detail.data.radius":"Radius","detail.data.fill":"Fill","detail.data.stroke":"Stroke","detail.data.shadow":"Shadow","detail.data.childList":"Children","detail.data.child.separator":"Separator","detail.data.child.background":"Background","detail.data.child.ghost":"Ghost"},{"detail.empty.selectNode":"选择一个节点查看详情","detail.empty.nodeNotFound":"节点未找到","detail.header.componentId":"组件 ID:{id}","detail.header.componentFallback":"组件","detail.section.path":"路径","detail.section.css":"CSS","detail.section.compositeAnalysis":"复合图层分析","detail.section.layout":"布局","detail.section.hints":"提示分析","detail.section.designToolLayout":"设计工具布局","detail.section.spacing":"间距标注","detail.section.componentDetection":"组件检测","detail.section.appearance":"外观","detail.section.text":"文本","detail.section.asset":"资源","detail.section.context":"上下文","detail.section.nodeInfo":"节点信息","detail.section.rawHints":"分析提示","detail.section.compactContext":"精简上下文","detail.section.children.one":"子节点({count})","detail.section.children.other":"子节点({count})","detail.action.copyCss":"复制 CSS","detail.action.copyCompositeAnalysis":"复制复合图层分析","detail.action.copyAssetUrl":"复制资源 URL","detail.action.openAsset":"在新标签页中打开资源","detail.field.position":"位置","detail.field.size":"尺寸","detail.field.parent":"父节点","detail.field.children":"子节点","detail.field.display":"显示","detail.field.mainAxis":"主轴","detail.field.gap":"间距","detail.field.mainAxisAlignment":"主轴对齐","detail.field.crossAxisAlignment":"交叉轴对齐","detail.field.padding":"内边距","detail.field.opacity":"透明度","detail.field.borderRadius":"圆角","detail.field.overflow":"溢出","detail.field.blendMode":"混合模式","detail.field.fill":"填充","detail.field.stroke":"描边","detail.field.shadow":"阴影","detail.field.content":"内容","detail.field.font":"字体","detail.field.fontSize":"字号","detail.field.fontWeight":"字重","detail.field.color":"颜色","detail.field.lineHeight":"行高","detail.field.horizontalAlignment":"水平对齐","detail.field.verticalAlignment":"垂直对齐","detail.field.file":"文件","detail.field.format":"格式","detail.field.url":"URL","detail.value.rootNode":"(根节点)","detail.value.automatic":"自动","detail.value.clipped":"裁剪","detail.value.visible":"可见","detail.value.yes":"是","detail.value.no":"否","detail.value.yesHorizontal":"是(横向排列)","detail.value.yesVertical":"是(纵向排列)","detail.direction.top":"上","detail.direction.right":"右","detail.direction.bottom":"下","detail.direction.left":"左","detail.direction.horizontal":"横向","detail.direction.vertical":"纵向","detail.direction.both":"双向","detail.spacing.padding":"内边距(Padding)","detail.spacing.uniform":"统一","detail.spacing.siblings":"兄弟间距","detail.more.one":"+{count} 更多...","detail.more.other":"+{count} 更多...","detail.component.summary.one":"{count} 个子节点,{width}×{height}","detail.component.summary.other":"{count} 个子节点,{width}×{height}","detail.text.segments":"文本分段","detail.composite.strategy.decorative":"装饰","detail.composite.strategy.review":"待确认","detail.composite.strategy.text":"文本","detail.composite.strategy.code":"代码","detail.composite.assetSuggestion":"已有导出资源:{file}({width}×{height})→ 若为装饰层可直接使用 img","detail.composite.preview":"背景预览(排除文本层)","detail.export.compositeTitle":"复合图层导出建议 — {name}({id},sourceId:{sourceId})","detail.export.size":"尺寸:{width}×{height}","detail.export.decorativeHeading":"可合成为背景的装饰层(高置信):","detail.export.reviewHeading":"需确认的层(低置信):","detail.export.keepHeading":"保留为代码或文本的层:","detail.export.itemWithCoverage":" - {name}({type})— {reason}[覆盖率 {coverage}%]","detail.export.item":" - {name}({type})— {reason}","detail.hints.role.decorative":"装饰层","detail.hints.role.text":"文本","detail.hints.role.container":"容器","detail.hints.role.interactive":"交互","detail.hints.decorativeReason.maskChild":"蒙版子节点","detail.hints.decorativeReason.maskLayer":"蒙版层","detail.hints.decorativeReason.ghostLayer":"幽灵层(无可见样式)","detail.hints.decorativeReason.backgroundLayer":"背景层","detail.hints.decorativeReason.ornamentalShape":"装饰性形状","detail.hints.decorativeReason.separator":"分隔线","detail.hints.badge.ghost":"幽灵层","detail.hints.badge.background":"背景层","detail.hints.badge.horizontalSeparator":"水平分隔线","detail.hints.badge.verticalSeparator":"垂直分隔线","detail.hints.badge.scrollCandidate":"疑似滚动区","detail.hints.field.decorativeReason":"装饰原因","detail.hints.field.containerType":"容器类型","detail.hints.container.transparent":"透明容器","detail.hints.container.visualBoundary":"视觉边界容器","detail.hints.childrenAxis":"子节点轴线","detail.hints.field.xNonOverlapping":"X 轴不重叠","detail.hints.field.yNonOverlapping":"Y 轴不重叠","detail.hints.childrenSpacing":"子节点间距","detail.hints.spacing.uniform":"均匀 {gap}px","detail.hints.spacing.nonUniform":"不均匀[{gaps}{suffix}]","detail.hints.childrenAlignment":"子节点对齐","detail.hints.alignment.top":"顶部对齐","detail.hints.alignment.bottom":"底部对齐","detail.hints.alignment.centerY":"垂直居中","detail.hints.alignment.left":"左对齐","detail.hints.alignment.right":"右对齐","detail.hints.alignment.centerX":"水平居中","detail.hints.sizeUniformity":"子节点尺寸一致性","detail.hints.field.widthUniform":"宽度一致","detail.hints.field.heightUniform":"高度一致","detail.hints.field.similarity":"相似度","detail.hints.overflow":"溢出检测","detail.hints.field.direction":"方向","detail.hints.field.containerViewport":"容器/视口","detail.hints.visibility.full":"完全可见","detail.hints.visibility.partial":"部分可见 {pixels}px","detail.hints.stackingGroups.one":"堆叠组({count})","detail.hints.stackingGroups.other":"堆叠组({count})","detail.hints.overlaps":"重叠关系","detail.hints.similarSiblings":"相似兄弟节点","detail.hints.field.structureSignature":"结构签名","detail.hints.field.containedBy":"被包含于","detail.hints.grouping":"视觉分组","detail.hints.axis.horizontal":"横向","detail.hints.axis.vertical":"纵向","detail.hints.axis.stack":"堆叠","detail.hints.confidence":"置信度 {confidence}","detail.hints.ungrouped":"未分组:","detail.hints.interGroup":"组间:{axis}排列","detail.hints.interGroupSpacing":",间距 {spacing}px","detail.hints.interGroupAlignment":",{alignment}","detail.hints.contentFlow":"内容流","detail.hints.field.primaryDirection":"主方向","detail.hints.flow.topToBottom":"从上到下","detail.hints.flow.leftToRight":"从左到右","detail.hints.section.header":"头部","detail.hints.section.body":"主体","detail.hints.section.footer":"底部","detail.hints.section.sidebar":"侧边栏","detail.hints.section.content":"内容区","detail.hints.constraints":"约束关系","detail.hints.constraint.fillWidth":"撑满宽度","detail.hints.constraint.fillHeight":"撑满高度","detail.hints.constraint.centerX":"水平居中","detail.hints.constraint.centerY":"垂直居中","detail.hints.constraint.symmetricX":"左右对称","detail.hints.constraint.symmetricY":"上下对称","detail.hints.constraint.intrinsic":"固有尺寸","detail.hints.constraint.padding":"上 {top} 右 {right} 下 {bottom} 左 {left}px","detail.hints.layoutPattern":"布局模式:{type}","detail.hints.layoutPattern.list":"列表","detail.hints.layoutPattern.grid":"网格","detail.hints.layoutPattern.cardGroup":"卡片组","detail.hints.layoutPattern.tabBar":"标签栏","detail.hints.layoutPattern.carousel":"轮播","detail.hints.layoutPattern.specification":"规格","detail.hints.layoutPattern.specificationValue":"{rows} 行 × {columns} 列","detail.hints.stackingDetail":"堆叠分析:{type}","detail.hints.stacking.decorativeOverlay":"装饰叠加","detail.hints.stacking.containedOverlay":"内容叠加","detail.hints.stacking.overlappingSimilar":"重叠的相似元素","detail.hints.stacking.floating":"浮动元素","detail.hints.stacking.unknown":"未知","detail.hints.semantic":"语义推断:{role}","detail.hints.semantic.card":"卡片","detail.hints.semantic.listItem":"列表项","detail.hints.semantic.navItem":"导航项","detail.hints.semantic.avatarName":"头像+名称","detail.hints.semantic.thumbnailTitle":"缩略图+标题","detail.hints.semantic.iconText":"图标+文本","detail.hints.semantic.labelValue":"标签-值对","detail.hints.semantic.mediaBlock":"媒体块","detail.data.id":"ID","detail.data.name":"名称","detail.data.type":"类型","detail.data.sourceId":"来源 ID","detail.data.boundingBox":"边界框","detail.data.parent":"父节点","detail.data.children":"子节点数","detail.data.root":"(根节点)","detail.data.asset":"资源","detail.data.assetUrl":"资源 URL","detail.data.text":"文本","detail.data.font":"字体","detail.data.color":"颜色","detail.data.alignment":"对齐","detail.data.verticalAlignment":"垂直对齐","detail.data.segmented":"分段文本({count} 段,使用 <span>):","detail.data.style":"样式","detail.data.opacity":"透明度","detail.data.overflow":"溢出","detail.data.radius":"圆角","detail.data.fill":"填充","detail.data.stroke":"描边","detail.data.shadow":"阴影","detail.data.childList":"子节点","detail.data.child.separator":"分隔线","detail.data.child.background":"背景","detail.data.child.ghost":"幽灵层"}),rj=Vs({"viewer.loadingDashboard":"Loading designs...","viewer.loadDesignFailed":"Unable to load design data","viewer.localizeFailed":"Unable to update the current design language","viewer.designDeleted":"This design was deleted or does not exist","viewer.invalidDesignUrl":"Invalid design URL","viewer.loadingDesign":"Loading design data...","viewer.overviewLabel":"Design modules overview","viewer.breadcrumb":"Breadcrumb","viewer.moduleAria":"Module: {name} — {width}×{height}, {count} nodes","viewer.canvas.switchLight":"Switch to a light canvas","viewer.canvas.switchDark":"Switch to a dark canvas","viewer.canvas.fitView":"Fit to view","viewer.canvas.fitWidth":"Fit to width","viewer.canvas.zoomOut":"Zoom out","viewer.canvas.zoomIn":"Zoom in","viewer.sidebar.layers":"Layers","viewer.sidebar.searchPlaceholder":"Search node names, text, or IDs (supports type:text, asset:true, #id, and more)","viewer.sidebar.clearSearch":"Clear search","viewer.sidebar.resultCount.one":"{count} result","viewer.sidebar.resultCount.other":"{count} results","viewer.node.show":"Show node","viewer.node.hide":"Hide node","viewer.map.childCount.one":"{count} child","viewer.map.childCount.other":"{count} children","viewer.reload.title":"Reload","viewer.reload.refreshing":"Refreshing...","viewer.reload.description":"Read the source data again through MCP and refresh the analysis.","viewer.reload.action":"Reload design data","viewer.reload.failed":"Unable to reload design data","viewer.module.switch":"Switch module","viewer.module.count.one":"{count} module","viewer.module.count.other":"{count} modules","viewer.mode.visual":"Visual","viewer.mode.visualAria":"Switch to visual mode","viewer.mode.map":"Map","viewer.mode.mapAria":"Switch to map mode","viewer.font.count.one":"{count} font","viewer.font.count.other":"{count} fonts","viewer.font.usedInModule":"Fonts used in this module","viewer.font.custom":"Custom","viewer.font.builtin":"Built-in","viewer.font.missing":"Missing","viewer.font.weightMissing":"w{weight} was not found in the font preset","viewer.font.weightsMissing":"w{weights} were not found in the font preset","viewer.stats.node.one":"{count} node","viewer.stats.node.other":"{count} nodes","viewer.stats.asset.one":"{count} asset","viewer.stats.asset.other":"{count} assets","viewer.stats.text.one":"{count} text layer","viewer.stats.text.other":"{count} text layers","viewer.stats.frame.one":"{count} frame","viewer.stats.frame.other":"{count} frames","viewer.transform.title":"Transform diff","viewer.transform.loading":"Loading raw data...","viewer.transform.loadFailed":"Unable to load raw data","viewer.transform.noChanges":"No structural changes","viewer.transform.originalChildren":"Original children","viewer.transform.virtualWrapper":"Virtual wrapper (created by layout transform)","viewer.transform.virtualDetail":"flex-{direction}, wrapping {count} items","viewer.transform.parentChanged":"Parent changed","viewer.transform.root":"(root)","viewer.transform.virtualChild":"+ {name} (virtual wrapper)","viewer.transform.groupedDetail":"Groups {count} items into flex-{direction}","viewer.transform.moved":"↳ {name} moved","viewer.transform.nowUnder":"Now under {name}","viewer.transform.flattened":"- {name} (flattened)","viewer.transform.reordered":"Children reordered","viewer.transform.movedSuffix":" (moved)","viewer.transform.goneSuffix":" (gone)"},{"viewer.loadingDashboard":"加载设计稿中...","viewer.loadDesignFailed":"无法加载设计数据","viewer.localizeFailed":"无法更新当前设计稿语言","viewer.designDeleted":"设计稿已删除或不存在","viewer.invalidDesignUrl":"无效的设计稿 URL","viewer.loadingDesign":"加载设计数据中...","viewer.overviewLabel":"设计稿模块概览","viewer.breadcrumb":"面包屑导航","viewer.moduleAria":"模块:{name} — {width}×{height},{count} 个节点","viewer.canvas.switchLight":"切换为白色背景","viewer.canvas.switchDark":"切换为黑色背景","viewer.canvas.fitView":"适应视图","viewer.canvas.fitWidth":"适应宽度","viewer.canvas.zoomOut":"缩小","viewer.canvas.zoomIn":"放大","viewer.sidebar.layers":"图层","viewer.sidebar.searchPlaceholder":"搜索节点名称、文本内容或 ID(支持 type:text / asset:true / #id 等高级语法)","viewer.sidebar.clearSearch":"清空搜索","viewer.sidebar.resultCount.one":"{count} 个结果","viewer.sidebar.resultCount.other":"{count} 个结果","viewer.node.show":"显示节点","viewer.node.hide":"隐藏节点","viewer.map.childCount.one":"{count} 个子节点","viewer.map.childCount.other":"{count} 个子节点","viewer.reload.title":"重新加载","viewer.reload.refreshing":"刷新中...","viewer.reload.description":"通过 MCP 重新读取源数据并刷新计算结果。","viewer.reload.action":"重新加载设计数据","viewer.reload.failed":"无法重新加载设计数据","viewer.module.switch":"切换模块","viewer.module.count.one":"{count} 个模块","viewer.module.count.other":"{count} 个模块","viewer.mode.visual":"视觉","viewer.mode.visualAria":"切换到视觉模式","viewer.mode.map":"地图","viewer.mode.mapAria":"切换到地图模式","viewer.font.count.one":"{count} 种字体","viewer.font.count.other":"{count} 种字体","viewer.font.usedInModule":"本模块使用字体","viewer.font.custom":"自定义","viewer.font.builtin":"内置","viewer.font.missing":"缺失","viewer.font.weightMissing":"w{weight} 未在预设字体中找到","viewer.font.weightsMissing":"w{weights} 未在预设中找到","viewer.stats.node.one":"{count} 个节点","viewer.stats.node.other":"{count} 个节点","viewer.stats.asset.one":"{count} 个资源","viewer.stats.asset.other":"{count} 个资源","viewer.stats.text.one":"{count} 个文本层","viewer.stats.text.other":"{count} 个文本层","viewer.stats.frame.one":"{count} 个容器","viewer.stats.frame.other":"{count} 个容器","viewer.transform.title":"结构变换差异","viewer.transform.loading":"正在加载原始数据...","viewer.transform.loadFailed":"无法加载原始数据","viewer.transform.noChanges":"无结构变化","viewer.transform.originalChildren":"原始子节点","viewer.transform.virtualWrapper":"虚拟容器(由布局转换创建)","viewer.transform.virtualDetail":"flex-{direction},包含 {count} 项","viewer.transform.parentChanged":"父节点已变化","viewer.transform.root":"(根节点)","viewer.transform.virtualChild":"+ {name}(虚拟容器)","viewer.transform.groupedDetail":"将 {count} 项归入 flex-{direction}","viewer.transform.moved":"↳ {name} 已移动","viewer.transform.nowUnder":"现位于 {name} 下","viewer.transform.flattened":"- {name}(已扁平化)","viewer.transform.reordered":"子节点已重新排序","viewer.transform.movedSuffix":"(已移动)","viewer.transform.goneSuffix":"(已移除)"}),sj=["en","zh-CN"],Cb="en",wf="tarot-pixel.locale",cj=[aj,oj,lj,rj],Tx=Object.fromEntries(sj.map(t=>[t,Object.assign({},...cj.map(a=>a[t]))])),uj="http://tarot-pixel.local";function ms(t){const a=t==null?void 0:t.trim().replaceAll("_","-").toLowerCase();return a?a==="zh"||a.startsWith("zh-")?"zh-CN":a==="en"||a.startsWith("en-")?"en":null:null}function dj({query:t,stored:a,systemLocale:l,languages:o=[]}){const s=mj(t);if(s)return s;const c=ms(a);if(c)return c;const d=ms(l);if(d)return d;for(const f of o){const p=ms(f);if(p)return p}return Cb}function zx(t,a,l={}){return(Tx[t][a]??Tx[Cb][a]??a).replace(/\{([A-Za-z][A-Za-z0-9]*)\}/g,(s,c)=>{const d=l[c];return d===void 0?s:String(d)})}function Rx(){try{return window.localStorage.getItem(wf)}catch{return null}}function Es(t,a){const l=new URL(t,uj);return l.searchParams.set("lang",a),/^[a-z][a-z\d+.-]*:/i.test(t)||t.startsWith("//")?l.toString():`${l.pathname}${l.search}${l.hash}`}function Mb(t){return new URLSearchParams(t).has("_screenshot_token")}function fj(t,a){const l=a.indexOf("?"),o=l>=0?a.slice(l+1):"",s=new URLSearchParams(o).get("mode")==="map";return Mb(t)&&!s}function hj(t){try{window.localStorage.setItem(wf,t)}catch{}}function mj(t){if(!t)return null;try{return ms(new URLSearchParams(t).get("lang"))}catch{return null}}const jb=N.createContext(null);function pj({children:t}){const[a,l]=N.useState(()=>wd(Rx())),o=N.useCallback(d=>{l(d),hj(d),window.history.replaceState(window.history.state,"",Es(window.location.href,d))},[]);N.useEffect(()=>{document.documentElement.lang=a,document.title=zx(a,"app.documentTitle")},[a]),N.useEffect(()=>{const d=p=>{p.key===wf&&l(wd(p.newValue))},f=()=>{l(wd(Rx()))};return window.addEventListener("storage",d),window.addEventListener("languagechange",f),()=>{window.removeEventListener("storage",d),window.removeEventListener("languagechange",f)}},[]);const s=N.useCallback((d,f)=>zx(a,d,f),[a]),c=N.useMemo(()=>({locale:a,setLocale:o,t:s}),[a,o,s]);return m.jsx(jb.Provider,{value:c,children:t})}function gt(){const t=N.useContext(jb);if(!t)throw new Error("useI18n 必须在 I18nProvider 内调用");return t}function wd(t){const a=window.navigator.languages.length?window.navigator.languages:window.navigator.language?[window.navigator.language]:[];return dj({query:window.location.search,stored:t,systemLocale:gj(),languages:a})}function gj(){try{return Intl.DateTimeFormat().resolvedOptions().locale||null}catch{return null}}function xj(){const{t}=gt(),{exportData:a,selectModule:l,getModuleStats:o}=Ze(Pt(s=>({exportData:s.exportData,selectModule:s.selectModule,getModuleStats:s.getModuleStats})));return a?m.jsxs("section",{id:"overview","aria-label":t("viewer.overviewLabel"),className:"h-full flex flex-col bg-background",children:[m.jsx("header",{id:"project-meta",className:"flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b bg-white py-2 pl-11 pr-3 sm:pr-5",children:m.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 sm:gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[m.jsx(wb,{className:"size-4 shrink-0 text-primary"}),m.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight",children:a.source.fileName})]}),m.jsx("span",{className:"hidden shrink-0 text-border sm:inline",children:"·"}),m.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:a.source.pageName})]})}),m.jsx("div",{id:"module-grid",className:"flex-1 overflow-auto p-3 sm:p-6",children:m.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-4",children:a.modules.map(s=>{const c=o(s.moduleId);return m.jsx(vj,{mod:s,stats:c,onSelect:l,exportedAt:a.exportedAt},`${s.moduleId}`)})})})]}):null}function vj({mod:t,stats:a,onSelect:l,exportedAt:o}){var f;const{t:s}=gt(),c=p=>o?`${p}?_t=${encodeURIComponent(o)}`:p,d=m.jsxs("article",{"data-module-id":t.moduleId,"aria-label":s("viewer.moduleAria",{name:t.name,width:Math.round(t.bbox.width),height:Math.round(t.bbox.height),count:a.nodes}),className:"group border rounded-lg overflow-hidden bg-white hover:border-primary/20 hover:shadow-md hover:shadow-black/5 transition-all duration-200 cursor-pointer",onClick:()=>l(t.moduleId),children:[m.jsx(bj,{mod:t,exportedAt:o}),m.jsxs("div",{className:"px-3.5 py-3 space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("h3",{className:"text-[13px] font-medium truncate",children:t.name}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:[Math.round(t.bbox.width),"×",Math.round(t.bbox.height)]})]}),m.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[m.jsx(is,{icon:yb,label:s(`viewer.stats.node.${a.nodes===1?"one":"other"}`,{count:a.nodes})}),m.jsx(is,{icon:bb,label:s(`viewer.stats.asset.${a.assets===1?"one":"other"}`,{count:a.assets})}),a.texts>0&&m.jsx(is,{icon:yM,label:s(`viewer.stats.text.${a.texts===1?"one":"other"}`,{count:a.texts})}),a.frames>0&&m.jsx(is,{icon:UM,label:s(`viewer.stats.frame.${a.frames===1?"one":"other"}`,{count:a.frames})})]})]})]});return(f=t.preview)!=null&&f.url?m.jsxs(xf,{openDelay:300,closeDelay:100,children:[m.jsx(vf,{asChild:!0,children:d}),m.jsxs(bf,{side:"right",align:"start",className:"w-auto max-w-[calc(100vw-32px)] p-1.5 sm:max-w-[520px]",children:[m.jsx("img",{src:c(t.preview.url),alt:t.name,className:"max-h-[80vh] max-w-full rounded object-contain sm:max-h-[600px] sm:max-w-[500px]",draggable:!1}),m.jsxs("p",{className:"text-[11px] text-muted-foreground text-center mt-1",children:[t.name," — ",Math.round(t.bbox.width)," × ",Math.round(t.bbox.height)]})]})]}):d}function is({icon:t,label:a}){return m.jsxs(Le,{variant:"secondary",className:"text-[10px] h-4.5 px-1.5 gap-1 font-normal text-muted-foreground",children:[m.jsx(t,{className:"size-2.5"}),a]})}function bj({mod:t,exportedAt:a}){var o;const l=s=>a?`${s}?_t=${encodeURIComponent(a)}`:s;return(o=t.preview)!=null&&o.url?m.jsx("div",{className:"relative flex h-36 items-center justify-center overflow-hidden border-b border-border/50 bg-neutral-100 sm:h-44",children:m.jsx("img",{src:l(t.preview.url),alt:t.name,className:"object-contain",style:{maxWidth:144,maxHeight:144},draggable:!1})}):m.jsx("div",{className:"relative flex h-36 items-center justify-center overflow-hidden border-b border-border/50 bg-neutral-100 sm:h-44",children:m.jsxs("div",{className:"text-xs text-muted-foreground/30 font-mono",children:[Math.round(t.bbox.width)," × ",Math.round(t.bbox.height)]})})}var yj=Pd[" useId ".trim().toString()]||(()=>{}),wj=0;function Eb(t){const[a,l]=N.useState(yj());return kn(()=>{l(o=>o??String(wj++))},[t]),t||(a?`radix-${a}`:"")}var Sj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Nj="VisuallyHidden",Ab=N.forwardRef((t,a)=>m.jsx(St.span,{...t,ref:a,style:{...Sj,...t.style}}));Ab.displayName=Nj;var Cj=Ab,[Xs]=Rl("Tooltip",[yo]),qs=yo(),Tb="TooltipProvider",Mj=700,Hd="tooltip.open",[jj,Sf]=Xs(Tb),zb=t=>{const{__scopeTooltip:a,delayDuration:l=Mj,skipDelayDuration:o=300,disableHoverableContent:s=!1,children:c}=t,d=N.useRef(!0),f=N.useRef(!1),p=N.useRef(0);return N.useEffect(()=>{const g=p.current;return()=>window.clearTimeout(g)},[]),m.jsx(jj,{scope:a,isOpenDelayedRef:d,delayDuration:l,onOpen:N.useCallback(()=>{o<=0||(window.clearTimeout(p.current),d.current=!1)},[o]),onClose:N.useCallback(()=>{o<=0||(window.clearTimeout(p.current),p.current=window.setTimeout(()=>d.current=!0,o))},[o]),isPointerInTransitRef:f,onPointerInTransitChange:N.useCallback(g=>{f.current=g},[]),disableHoverableContent:s,children:c})};zb.displayName=Tb;var Al="Tooltip",[Ej,Ol]=Xs(Al),Rb=t=>{const{__scopeTooltip:a,children:l,open:o,defaultOpen:s,onOpenChange:c,disableHoverableContent:d,delayDuration:f}=t,p=Sf(Al,t.__scopeTooltip),g=qs(a),[x,v]=N.useState(null),w=Eb(),y=N.useRef(0),S=d??p.disableHoverableContent,C=f??p.delayDuration,j=N.useRef(!1),[A,_]=tf({prop:o,defaultProp:s??!1,onChange:D=>{D?(p.onOpen(),document.dispatchEvent(new CustomEvent(Hd))):p.onClose(),c==null||c(D)},caller:Al}),z=N.useMemo(()=>A?j.current?"delayed-open":"instant-open":"closed",[A]),R=N.useCallback(()=>{window.clearTimeout(y.current),y.current=0,j.current=!1,_(!0)},[_]),E=N.useCallback(()=>{window.clearTimeout(y.current),y.current=0,_(!1)},[_]),T=N.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{j.current=!0,_(!0),y.current=0},C)},[C,_]);return N.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),m.jsx(hf,{...g,children:m.jsx(Ej,{scope:a,contentId:w,open:A,stateAttribute:z,trigger:x,onTriggerChange:v,onTriggerEnter:N.useCallback(()=>{p.isOpenDelayedRef.current?T():R()},[p.isOpenDelayedRef,T,R]),onTriggerLeave:N.useCallback(()=>{S?E():(window.clearTimeout(y.current),y.current=0)},[E,S]),onOpen:R,onClose:E,disableHoverableContent:S,children:l})})};Rb.displayName=Al;var Yd="TooltipTrigger",Ob=N.forwardRef((t,a)=>{const{__scopeTooltip:l,...o}=t,s=Ol(Yd,l),c=Sf(Yd,l),d=qs(l),f=N.useRef(null),p=Tt(a,f,s.onTriggerChange),g=N.useRef(!1),x=N.useRef(!1),v=N.useCallback(()=>g.current=!1,[]);return N.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),m.jsx(Ls,{asChild:!0,...d,children:m.jsx(St.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...o,ref:p,onPointerMove:Ye(t.onPointerMove,w=>{w.pointerType!=="touch"&&!x.current&&!c.isPointerInTransitRef.current&&(s.onTriggerEnter(),x.current=!0)}),onPointerLeave:Ye(t.onPointerLeave,()=>{s.onTriggerLeave(),x.current=!1}),onPointerDown:Ye(t.onPointerDown,()=>{s.open&&s.onClose(),g.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Ye(t.onFocus,()=>{g.current||s.onOpen()}),onBlur:Ye(t.onBlur,s.onClose),onClick:Ye(t.onClick,s.onClose)})})});Ob.displayName=Yd;var Nf="TooltipPortal",[Aj,Tj]=Xs(Nf,{forceMount:void 0}),kb=t=>{const{__scopeTooltip:a,forceMount:l,children:o,container:s}=t,c=Ol(Nf,a);return m.jsx(Aj,{scope:a,forceMount:l,children:m.jsx(wn,{present:l||c.open,children:m.jsx(Us,{asChild:!0,container:s,children:o})})})};kb.displayName=Nf;var po="TooltipContent",_b=N.forwardRef((t,a)=>{const l=Tj(po,t.__scopeTooltip),{forceMount:o=l.forceMount,side:s="top",...c}=t,d=Ol(po,t.__scopeTooltip);return m.jsx(wn,{present:o||d.open,children:d.disableHoverableContent?m.jsx(Db,{side:s,...c,ref:a}):m.jsx(zj,{side:s,...c,ref:a})})}),zj=N.forwardRef((t,a)=>{const l=Ol(po,t.__scopeTooltip),o=Sf(po,t.__scopeTooltip),s=N.useRef(null),c=Tt(a,s),[d,f]=N.useState(null),{trigger:p,onClose:g}=l,x=s.current,{onPointerInTransitChange:v}=o,w=N.useCallback(()=>{f(null),v(!1)},[v]),y=N.useCallback((S,C)=>{const j=S.currentTarget,A={x:S.clientX,y:S.clientY},_=_j(A,j.getBoundingClientRect()),z=Dj(A,_),R=$j(C.getBoundingClientRect()),E=Uj([...z,...R]);f(E),v(!0)},[v]);return N.useEffect(()=>()=>w(),[w]),N.useEffect(()=>{if(p&&x){const S=j=>y(j,x),C=j=>y(j,p);return p.addEventListener("pointerleave",S),x.addEventListener("pointerleave",C),()=>{p.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",C)}}},[p,x,y,w]),N.useEffect(()=>{if(d){const S=C=>{const j=C.target,A={x:C.clientX,y:C.clientY},_=(p==null?void 0:p.contains(j))||(x==null?void 0:x.contains(j)),z=!Lj(A,d);_?w():z&&(w(),g())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[p,x,d,g,w]),m.jsx(Db,{...t,ref:c})}),[Rj,Oj]=Xs(Al,{isInside:!1}),kj=t2("TooltipContent"),Db=N.forwardRef((t,a)=>{const{__scopeTooltip:l,children:o,"aria-label":s,onEscapeKeyDown:c,onPointerDownOutside:d,...f}=t,p=Ol(po,l),g=qs(l),{onClose:x}=p;return N.useEffect(()=>(document.addEventListener(Hd,x),()=>document.removeEventListener(Hd,x)),[x]),N.useEffect(()=>{if(p.trigger){const v=w=>{w.target instanceof Node&&w.target.contains(p.trigger)&&x()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[p.trigger,x]),m.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:v=>v.preventDefault(),onDismiss:x,children:m.jsxs(mf,{"data-state":p.stateAttribute,...g,...f,ref:a,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(kj,{children:o}),m.jsx(Rj,{scope:l,isInside:!0,children:m.jsx(Cj,{id:p.contentId,role:"tooltip",children:s||o})})]})})});_b.displayName=po;var $b="TooltipArrow",Lb=N.forwardRef((t,a)=>{const{__scopeTooltip:l,...o}=t,s=qs(l);return Oj($b,l).isInside?null:m.jsx(pf,{...s,...o,ref:a})});Lb.displayName=$b;function _j(t,a){const l=Math.abs(a.top-t.y),o=Math.abs(a.bottom-t.y),s=Math.abs(a.right-t.x),c=Math.abs(a.left-t.x);switch(Math.min(l,o,s,c)){case c:return"left";case s:return"right";case l:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Dj(t,a,l=5){const o=[];switch(a){case"top":o.push({x:t.x-l,y:t.y+l},{x:t.x+l,y:t.y+l});break;case"bottom":o.push({x:t.x-l,y:t.y-l},{x:t.x+l,y:t.y-l});break;case"left":o.push({x:t.x+l,y:t.y-l},{x:t.x+l,y:t.y+l});break;case"right":o.push({x:t.x-l,y:t.y-l},{x:t.x-l,y:t.y+l});break}return o}function $j(t){const{top:a,right:l,bottom:o,left:s}=t;return[{x:s,y:a},{x:l,y:a},{x:l,y:o},{x:s,y:o}]}function Lj(t,a){const{x:l,y:o}=t;let s=!1;for(let c=0,d=a.length-1;c<a.length;d=c++){const f=a[c],p=a[d],g=f.x,x=f.y,v=p.x,w=p.y;x>o!=w>o&&l<(v-g)*(o-x)/(w-x)+g&&(s=!s)}return s}function Uj(t){const a=t.slice();return a.sort((l,o)=>l.x<o.x?-1:l.x>o.x?1:l.y<o.y?-1:l.y>o.y?1:0),Bj(a)}function Bj(t){if(t.length<=1)return t.slice();const a=[];for(let o=0;o<t.length;o++){const s=t[o];for(;a.length>=2;){const c=a[a.length-1],d=a[a.length-2];if((c.x-d.x)*(s.y-d.y)>=(c.y-d.y)*(s.x-d.x))a.pop();else break}a.push(s)}a.pop();const l=[];for(let o=t.length-1;o>=0;o--){const s=t[o];for(;l.length>=2;){const c=l[l.length-1],d=l[l.length-2];if((c.x-d.x)*(s.y-d.y)>=(c.y-d.y)*(s.x-d.x))l.pop();else break}l.push(s)}return l.pop(),a.length===1&&l.length===1&&a[0].x===l[0].x&&a[0].y===l[0].y?a:a.concat(l)}var Hj=zb,Yj=Rb,Ij=Ob,Gj=kb,Vj=_b,Xj=Lb;function Ox({delayDuration:t=0,...a}){return m.jsx(Hj,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function vl({...t}){return m.jsx(Yj,{"data-slot":"tooltip",...t})}function bl({...t}){return m.jsx(Ij,{"data-slot":"tooltip-trigger",...t})}function yl({className:t,sideOffset:a=0,children:l,...o}){return m.jsx(Gj,{children:m.jsxs(Vj,{"data-slot":"tooltip-content",sideOffset:a,className:Ot("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...o,children:[l,m.jsx(Xj,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const qj=jv("group/button cursor-pointer inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),gn=N.forwardRef(({className:t,variant:a="default",size:l="default",asChild:o=!1,...s},c)=>{const d=o?Ev:"button";return m.jsx(d,{ref:c,"data-slot":"button","data-variant":a,"data-size":l,className:Ot(qj({variant:a,size:l,className:t})),...s})});gn.displayName="Button";var Pj=N.createContext(void 0);function Qj(t){const a=N.useContext(Pj);return t||a||"ltr"}function Zj(t,[a,l]){return Math.min(l,Math.max(a,t))}function Fj(t,a){return N.useReducer((l,o)=>a[l][o]??l,t)}var Cf="ScrollArea",[Ub]=Rl(Cf),[Wj,xn]=Ub(Cf),Bb=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,type:o="hover",dir:s,scrollHideDelay:c=600,...d}=t,[f,p]=N.useState(null),[g,x]=N.useState(null),[v,w]=N.useState(null),[y,S]=N.useState(null),[C,j]=N.useState(null),[A,_]=N.useState(0),[z,R]=N.useState(0),[E,T]=N.useState(!1),[D,k]=N.useState(!1),V=Tt(a,p),te=Qj(s);return m.jsx(Wj,{scope:l,type:o,dir:te,scrollHideDelay:c,scrollArea:f,viewport:g,onViewportChange:x,content:v,onContentChange:w,scrollbarX:y,onScrollbarXChange:S,scrollbarXEnabled:E,onScrollbarXEnabledChange:T,scrollbarY:C,onScrollbarYChange:j,scrollbarYEnabled:D,onScrollbarYEnabledChange:k,onCornerWidthChange:_,onCornerHeightChange:R,children:m.jsx(St.div,{dir:te,...d,ref:V,style:{position:"relative","--radix-scroll-area-corner-width":A+"px","--radix-scroll-area-corner-height":z+"px",...t.style}})})});Bb.displayName=Cf;var Hb="ScrollAreaViewport",Yb=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,children:o,nonce:s,...c}=t,d=xn(Hb,l),f=N.useRef(null),p=Tt(a,f,d.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx(Kj,{nonce:s}),m.jsx(St.div,{"data-radix-scroll-area-viewport":"",...c,ref:p,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:m.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Yb.displayName=Hb;var Kj=N.memo(({nonce:t})=>m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),(t,a)=>t.nonce===a.nonce),$n="ScrollAreaScrollbar",Ib=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=xn($n,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=s,f=t.orientation==="horizontal";return N.useEffect(()=>(f?c(!0):d(!0),()=>{f?c(!1):d(!1)}),[f,c,d]),s.type==="hover"?m.jsx(Jj,{...o,ref:a,forceMount:l}):s.type==="scroll"?m.jsx(eE,{...o,ref:a,forceMount:l}):s.type==="auto"?m.jsx(Gb,{...o,ref:a,forceMount:l}):s.type==="always"?m.jsx(Mf,{...o,ref:a,"data-state":"visible"}):null});Ib.displayName=$n;var Jj=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=xn($n,t.__scopeScrollArea),[c,d]=N.useState(!1);return N.useEffect(()=>{const f=s.scrollArea;let p=0;if(f){const g=()=>{window.clearTimeout(p),d(!0)},x=()=>{p=window.setTimeout(()=>d(!1),s.scrollHideDelay)};return f.addEventListener("pointerenter",g),f.addEventListener("pointerleave",x),()=>{window.clearTimeout(p),f.removeEventListener("pointerenter",g),f.removeEventListener("pointerleave",x)}}},[s.scrollArea,s.scrollHideDelay]),m.jsx(wn,{present:l||c,children:m.jsx(Gb,{"data-state":c?"visible":"hidden",...o,ref:a})})}),eE=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=xn($n,t.__scopeScrollArea),c=t.orientation==="horizontal",d=Qs(()=>p("SCROLL_END"),100),[f,p]=Fj("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return N.useEffect(()=>{if(f==="idle"){const g=window.setTimeout(()=>p("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(g)}},[f,s.scrollHideDelay,p]),N.useEffect(()=>{const g=s.viewport,x=c?"scrollLeft":"scrollTop";if(g){let v=g[x];const w=()=>{const y=g[x];v!==y&&(p("SCROLL"),d()),v=y};return g.addEventListener("scroll",w),()=>g.removeEventListener("scroll",w)}},[s.viewport,c,p,d]),m.jsx(wn,{present:l||f!=="hidden",children:m.jsx(Mf,{"data-state":f==="hidden"?"hidden":"visible",...o,ref:a,onPointerEnter:Ye(t.onPointerEnter,()=>p("POINTER_ENTER")),onPointerLeave:Ye(t.onPointerLeave,()=>p("POINTER_LEAVE"))})})}),Gb=N.forwardRef((t,a)=>{const l=xn($n,t.__scopeScrollArea),{forceMount:o,...s}=t,[c,d]=N.useState(!1),f=t.orientation==="horizontal",p=Qs(()=>{if(l.viewport){const g=l.viewport.offsetWidth<l.viewport.scrollWidth,x=l.viewport.offsetHeight<l.viewport.scrollHeight;d(f?g:x)}},10);return go(l.viewport,p),go(l.content,p),m.jsx(wn,{present:o||c,children:m.jsx(Mf,{"data-state":c?"visible":"hidden",...s,ref:a})})}),Mf=N.forwardRef((t,a)=>{const{orientation:l="vertical",...o}=t,s=xn($n,t.__scopeScrollArea),c=N.useRef(null),d=N.useRef(0),[f,p]=N.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),g=Qb(f.viewport,f.content),x={...o,sizes:f,onSizesChange:p,hasThumb:g>0&&g<1,onThumbChange:w=>c.current=w,onThumbPointerUp:()=>d.current=0,onThumbPointerDown:w=>d.current=w};function v(w,y){return lE(w,d.current,f,y)}return l==="horizontal"?m.jsx(tE,{...x,ref:a,onThumbPositionChange:()=>{if(s.viewport&&c.current){const w=s.viewport.scrollLeft,y=kx(w,f,s.dir);c.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:w=>{s.viewport&&(s.viewport.scrollLeft=w)},onDragScroll:w=>{s.viewport&&(s.viewport.scrollLeft=v(w,s.dir))}}):l==="vertical"?m.jsx(nE,{...x,ref:a,onThumbPositionChange:()=>{if(s.viewport&&c.current){const w=s.viewport.scrollTop,y=kx(w,f);c.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:w=>{s.viewport&&(s.viewport.scrollTop=w)},onDragScroll:w=>{s.viewport&&(s.viewport.scrollTop=v(w))}}):null}),tE=N.forwardRef((t,a)=>{const{sizes:l,onSizesChange:o,...s}=t,c=xn($n,t.__scopeScrollArea),[d,f]=N.useState(),p=N.useRef(null),g=Tt(a,p,c.onScrollbarXChange);return N.useEffect(()=>{p.current&&f(getComputedStyle(p.current))},[p]),m.jsx(Xb,{"data-orientation":"horizontal",...s,ref:g,sizes:l,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ps(l)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.x),onDragScroll:x=>t.onDragScroll(x.x),onWheelScroll:(x,v)=>{if(c.viewport){const w=c.viewport.scrollLeft+x.deltaX;t.onWheelScroll(w),Fb(w,v)&&x.preventDefault()}},onResize:()=>{p.current&&c.viewport&&d&&o({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:p.current.clientWidth,paddingStart:Ts(d.paddingLeft),paddingEnd:Ts(d.paddingRight)}})}})}),nE=N.forwardRef((t,a)=>{const{sizes:l,onSizesChange:o,...s}=t,c=xn($n,t.__scopeScrollArea),[d,f]=N.useState(),p=N.useRef(null),g=Tt(a,p,c.onScrollbarYChange);return N.useEffect(()=>{p.current&&f(getComputedStyle(p.current))},[p]),m.jsx(Xb,{"data-orientation":"vertical",...s,ref:g,sizes:l,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ps(l)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.y),onDragScroll:x=>t.onDragScroll(x.y),onWheelScroll:(x,v)=>{if(c.viewport){const w=c.viewport.scrollTop+x.deltaY;t.onWheelScroll(w),Fb(w,v)&&x.preventDefault()}},onResize:()=>{p.current&&c.viewport&&d&&o({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:p.current.clientHeight,paddingStart:Ts(d.paddingTop),paddingEnd:Ts(d.paddingBottom)}})}})}),[iE,Vb]=Ub($n),Xb=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,sizes:o,hasThumb:s,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:f,onThumbPositionChange:p,onDragScroll:g,onWheelScroll:x,onResize:v,...w}=t,y=xn($n,l),[S,C]=N.useState(null),j=Tt(a,C),A=N.useRef(null),_=N.useRef(""),z=y.viewport,R=o.content-o.viewport,E=an(x),T=an(p),D=Qs(v,10);function k(V){if(A.current){const te=V.clientX-A.current.left,J=V.clientY-A.current.top;g({x:te,y:J})}}return N.useEffect(()=>{const V=te=>{const J=te.target;(S==null?void 0:S.contains(J))&&E(te,R)};return document.addEventListener("wheel",V,{passive:!1}),()=>document.removeEventListener("wheel",V,{passive:!1})},[z,S,R,E]),N.useEffect(T,[o,T]),go(S,D),go(y.content,D),m.jsx(iE,{scope:l,scrollbar:S,hasThumb:s,onThumbChange:an(c),onThumbPointerUp:an(d),onThumbPositionChange:T,onThumbPointerDown:an(f),children:m.jsx(St.div,{...w,ref:j,style:{position:"absolute",...w.style},onPointerDown:Ye(t.onPointerDown,V=>{V.button===0&&(V.target.setPointerCapture(V.pointerId),A.current=S.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),k(V))}),onPointerMove:Ye(t.onPointerMove,k),onPointerUp:Ye(t.onPointerUp,V=>{const te=V.target;te.hasPointerCapture(V.pointerId)&&te.releasePointerCapture(V.pointerId),document.body.style.webkitUserSelect=_.current,y.viewport&&(y.viewport.style.scrollBehavior=""),A.current=null})})})}),As="ScrollAreaThumb",qb=N.forwardRef((t,a)=>{const{forceMount:l,...o}=t,s=Vb(As,t.__scopeScrollArea);return m.jsx(wn,{present:l||s.hasThumb,children:m.jsx(aE,{ref:a,...o})})}),aE=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,style:o,...s}=t,c=xn(As,l),d=Vb(As,l),{onThumbPositionChange:f}=d,p=Tt(a,d.onThumbChange),g=N.useRef(void 0),x=Qs(()=>{g.current&&(g.current(),g.current=void 0)},100);return N.useEffect(()=>{const v=c.viewport;if(v){const w=()=>{if(x(),!g.current){const y=rE(v,f);g.current=y,f()}};return f(),v.addEventListener("scroll",w),()=>v.removeEventListener("scroll",w)}},[c.viewport,x,f]),m.jsx(St.div,{"data-state":d.hasThumb?"visible":"hidden",...s,ref:p,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Ye(t.onPointerDownCapture,v=>{const y=v.target.getBoundingClientRect(),S=v.clientX-y.left,C=v.clientY-y.top;d.onThumbPointerDown({x:S,y:C})}),onPointerUp:Ye(t.onPointerUp,d.onThumbPointerUp)})});qb.displayName=As;var jf="ScrollAreaCorner",Pb=N.forwardRef((t,a)=>{const l=xn(jf,t.__scopeScrollArea),o=!!(l.scrollbarX&&l.scrollbarY);return l.type!=="scroll"&&o?m.jsx(oE,{...t,ref:a}):null});Pb.displayName=jf;var oE=N.forwardRef((t,a)=>{const{__scopeScrollArea:l,...o}=t,s=xn(jf,l),[c,d]=N.useState(0),[f,p]=N.useState(0),g=!!(c&&f),{onCornerWidthChange:x,onCornerHeightChange:v}=s;return go(s.scrollbarX,()=>{var y;const w=((y=s.scrollbarX)==null?void 0:y.offsetHeight)||0;s.onCornerHeightChange(w),p(w)}),go(s.scrollbarY,()=>{var y;const w=((y=s.scrollbarY)==null?void 0:y.offsetWidth)||0;s.onCornerWidthChange(w),d(w)}),N.useEffect(()=>()=>{x(0),v(0)},[x,v]),g?m.jsx(St.div,{...o,ref:a,style:{width:c,height:f,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Ts(t){return t?parseInt(t,10):0}function Qb(t,a){const l=t/a;return isNaN(l)?0:l}function Ps(t){const a=Qb(t.viewport,t.content),l=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-l)*a;return Math.max(o,18)}function lE(t,a,l,o="ltr"){const s=Ps(l),c=s/2,d=a||c,f=s-d,p=l.scrollbar.paddingStart+d,g=l.scrollbar.size-l.scrollbar.paddingEnd-f,x=l.content-l.viewport,v=o==="ltr"?[0,x]:[x*-1,0];return Zb([p,g],v)(t)}function kx(t,a,l="ltr"){const o=Ps(a),s=a.scrollbar.paddingStart+a.scrollbar.paddingEnd,c=a.scrollbar.size-s,d=a.content-a.viewport,f=c-o,p=l==="ltr"?[0,d]:[d*-1,0],g=Zj(t,p);return Zb([0,d],[0,f])(g)}function Zb(t,a){return l=>{if(t[0]===t[1]||a[0]===a[1])return a[0];const o=(a[1]-a[0])/(t[1]-t[0]);return a[0]+o*(l-t[0])}}function Fb(t,a){return t>0&&t<a}var rE=(t,a=()=>{})=>{let l={left:t.scrollLeft,top:t.scrollTop},o=0;return(function s(){const c={left:t.scrollLeft,top:t.scrollTop},d=l.left!==c.left,f=l.top!==c.top;(d||f)&&a(),l=c,o=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(o)};function Qs(t,a){const l=an(t),o=N.useRef(0);return N.useEffect(()=>()=>window.clearTimeout(o.current),[]),N.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(l,a)},[l,a])}function go(t,a){const l=an(a);kn(()=>{let o=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(l)});return s.observe(t),()=>{window.cancelAnimationFrame(o),s.unobserve(t)}}},[t,l])}var sE=Bb,cE=Yb,uE=Pb;function Tl({className:t,children:a,...l}){return m.jsxs(sE,{"data-slot":"scroll-area",className:Ot("relative",t),...l,children:[m.jsx(cE,{"data-slot":"scroll-area-viewport",style:{overflow:"auto"},className:"size-full min-w-0 overflow-hidden rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:a}),m.jsx(dE,{}),m.jsx(uE,{})]})}function dE({className:t,orientation:a="vertical",...l}){return m.jsx(Ib,{"data-slot":"scroll-area-scrollbar","data-orientation":a,orientation:a,className:Ot("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",t),...l,children:m.jsx(qb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function fE({className:t,type:a,...l}){return m.jsx("input",{type:a,"data-slot":"input",className:Ot("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...l})}const hE={frame:SM,group:CM,text:Nb,rectangle:KM,ellipse:lM,image:bb,vector:YM,line:yf,section:Bd};function Wb({type:t,className:a}){const l=hE[t]??hM;return m.jsx(l,{className:Ot("size-3.5 shrink-0",a)})}function mE(){const{selectedNodeId:t,searchQuery:a,selectNode:l,mod:o,hiddenNodeIds:s,toggleNodeVisibility:c}=Ze(Pt(y=>({selectedNodeId:y.selectedNodeId,searchQuery:y.searchQuery,selectNode:y.selectNode,mod:y.getCurrentModule(),hiddenNodeIds:y.hiddenNodeIds,toggleNodeVisibility:y.toggleNodeVisibility}))),d=N.useRef(null),[f,p]=N.useState(()=>{const y=new Set,S=(C,j)=>{if(j<2){y.add(C);const A=o==null?void 0:o.nodes[C];if(A)for(const _ of A.children)S(_,j+1)}};return o&&S(o.rootNodeId,0),y});N.useEffect(()=>{if(!t||!o)return;const y=new Set;let S=t;for(;S;){const C=o.nodes[S];if(!C)break;S=C.parentId,S&&y.add(S)}p(C=>{const j=new Set(C);return y.forEach(A=>j.add(A)),j}),requestAnimationFrame(()=>{var j;const C=(j=d.current)==null?void 0:j.querySelector(`[data-node-id="${t}"]`);C&&C.scrollIntoView({block:"nearest",behavior:"auto"})})},[t,o]);const g=N.useCallback((y,S)=>{S.stopPropagation(),p(C=>{const j=new Set(C);return j.has(y)?j.delete(y):j.add(y),j})},[]),x=N.useCallback(y=>l(y),[l]);if(!o)return null;const v=o.nodes[o.rootNodeId];if(!v)return null;const w=N.useMemo(()=>{if(!t||!o)return new Set;const y=o.nodes[t];if(!y||y.children.length===0)return new Set;const S=new Set,C=j=>{S.add(j);const A=o.nodes[j];if(A)for(const _ of A.children)C(_)};for(const j of y.children)C(j);return S},[t,o]);return m.jsx("div",{ref:d,className:"py-0.5 min-w-0",children:m.jsx(Kb,{node:v,mod:o,depth:0,filter:a,selectedId:t,selectedDescendants:w,expandedNodes:f,hiddenNodeIds:s,onClick:x,onToggleExpand:g,onToggleVisibility:c})})}function Kb({node:t,mod:a,depth:l,filter:o,selectedId:s,selectedDescendants:c,expandedNodes:d,hiddenNodeIds:f,onClick:p,onToggleExpand:g,onToggleVisibility:x}){var R,E;const{t:v}=gt(),w=f.has(t.id),y=!o||t.name.toLowerCase().includes(o.toLowerCase())||t.type.includes(o.toLowerCase())||(((E=(R=t.text)==null?void 0:R.content)==null?void 0:E.toLowerCase().includes(o.toLowerCase()))??!1),S=t.children.map(T=>a.nodes[T]).filter(Boolean),C=S.length>0,j=d.has(t.id),A=j?S.map(T=>m.jsx(Kb,{node:T,mod:a,depth:l+1,filter:o,selectedId:s,selectedDescendants:c,expandedNodes:d,hiddenNodeIds:f,onClick:p,onToggleExpand:g,onToggleVisibility:x},T.id)):null;if(!y&&!S.length&&o)return null;const _=t.id===s,z=c.has(t.id);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{"data-node-id":t.id,"data-type":t.type,role:"button",tabIndex:0,onClick:T=>{T.stopPropagation(),p(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),p(t.id))},className:Ot("group flex items-center gap-1 w-full min-w-0 max-w-full text-left h-7 pr-1 text-xs cursor-pointer",_?"bg-sidebar-primary/15 text-sidebar-accent-foreground font-medium":z?"bg-sidebar-primary/8":"text-sidebar-foreground hover:bg-sidebar-accent/50",!y&&o&&"opacity-30",w&&"opacity-40"),style:{paddingLeft:l*12+4},children:[C?m.jsx("span",{onClick:T=>g(t.id,T),className:"w-4 h-4 flex items-center justify-center shrink-0 cursor-pointer hover:bg-muted rounded-sm",children:m.jsx(wo,{className:Ot("size-3 text-muted-foreground transition-transform duration-150",j&&"rotate-90")})}):m.jsx("span",{className:"w-4 h-4 shrink-0"}),m.jsx(Wb,{type:t.type,className:Ot("size-3 shrink-0",_?"text-sidebar-primary":"text-muted-foreground")}),m.jsx("span",{className:Ot("truncate block flex-1 min-w-0 text-foreground",l===0&&"font-semibold"),style:{maxWidth:120},title:t.name,children:t.name}),m.jsx(Le,{variant:"ghost",className:"text-[9px] h-3.5 px-1 text-muted-foreground font-normal shrink-0",children:t.type}),m.jsx("span",{onClick:T=>{T.stopPropagation(),x(t.id)},className:Ot("w-4 h-4 flex items-center justify-center shrink-0 rounded-sm transition-opacity",w?"opacity-100 text-muted-foreground":"opacity-0 group-hover:opacity-100 text-muted-foreground/60 hover:text-muted-foreground"),title:v(w?"viewer.node.show":"viewer.node.hide"),children:w?m.jsx(xM,{className:"size-3"}):m.jsx(vb,{className:"size-3"})})]}),A]})}function pE(){const{t}=gt(),{exportData:a,searchQuery:l,setSearchQuery:o,findNodeAsset:s,selectNode:c}=Ze(),d=Ze(g=>g.getCurrentModule()),f=N.useMemo(()=>{if(!a||!l.trim())return null;const g=qS(l);return!g.moduleId&&d&&(g.moduleId=d.moduleId),PS(g,a,s)},[a,l,s,d]);if(!a||!d)return null;const p=f!==null;return m.jsxs("aside",{id:"sidebar",className:"hidden min-h-0 min-w-0 flex-col overflow-hidden border-r bg-white xl:flex",children:[m.jsxs("div",{className:"px-3 py-2.5 border-b space-y-2",onClick:()=>c(null),children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[11px] font-medium uppercase tracking-widest text-muted-foreground",children:t("viewer.sidebar.layers")}),m.jsx(Le,{variant:"secondary",className:"text-[10px] h-4.5 px-1.5 font-mono font-normal text-muted-foreground",children:Object.keys(d.nodes).length})]}),m.jsxs("div",{className:"relative",children:[m.jsx(QM,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground/50 pointer-events-none"}),m.jsx(fE,{id:"search-input",value:l,onChange:g=>o(g.target.value),placeholder:t("viewer.sidebar.searchPlaceholder"),className:`h-7 pl-7 text-[10px] bg-muted/50 placeholder:text-muted-foreground rounded-md ${l?"pr-5":""}`}),l&&m.jsx("button",{type:"button","aria-label":t("viewer.sidebar.clearSearch"),title:t("viewer.sidebar.clearSearch"),onClick:()=>o(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:m.jsx(ij,{className:"size-3"})})]})]}),p?m.jsx(Tl,{className:"flex-1 overflow-hidden min-w-0",onClick:()=>c(null),children:m.jsxs("div",{className:"py-1 min-w-0",children:[m.jsx("div",{className:"px-3 py-1 text-[10px] text-muted-foreground",children:t(`viewer.sidebar.resultCount.${f.length===1?"one":"other"}`,{count:f.length})}),f.map(g=>m.jsxs("button",{"data-node-id":g.node.id,className:"flex items-center gap-1.5 w-full text-left h-7 px-3 text-xs hover:bg-sidebar-accent/50",onClick:x=>{x.stopPropagation(),c(g.node.id)},children:[m.jsx(Le,{variant:"ghost",className:"text-[9px] h-3.5 px-1 text-sidebar-foreground/40 font-normal shrink-0",children:g.node.type}),m.jsx("span",{className:"truncate flex-1",children:g.node.name}),g.node.text&&m.jsxs("span",{className:"text-[10px] text-muted-foreground truncate max-w-[80px]",children:['"',g.node.text.content,'"']})]},g.node.id))]})}):m.jsx(Tl,{className:"flex-1 overflow-hidden min-w-0",onClick:()=>c(null),children:m.jsx(mE,{})})]})}function gE(t,a){const o=document.elementsFromPoint(t,a).filter(s=>s instanceof HTMLElement&&!!s.dataset.nodeId).map(s=>({id:s.dataset.nodeId,area:(s.offsetWidth||1)*(s.offsetHeight||1)}));return o.length===0?null:o.reduce((s,c)=>s.area<=c.area?s:c).id}function xE({asset:t,node:a}){var c;const l=(c=a.image)==null?void 0:c.position,o=a.type==="text"&&a.meta.exportReason==="text-rasterized",s={alt:o?"":a.name,"aria-hidden":o?!0:void 0};if((l==null?void 0:l.mode)==="offset"){const d={position:"absolute",pointerEvents:"none",maxWidth:"none",height:"auto",left:l.left,top:l.top};return l.width!=null&&(d.width=l.width),l.height!=null&&(d.height=l.height),m.jsx("img",{style:d,src:t.url,...s,draggable:!1})}if((l==null?void 0:l.mode)==="center"){const d={position:"absolute",pointerEvents:"none",maxWidth:"none",left:"50%",top:"50%",transform:l.transform??"translate(-50%, -50%)",transformOrigin:l.transformOrigin??"center"};return l.width!=null&&(d.width=l.width),l.height!=null&&(d.height=l.height),m.jsx("img",{className:"block",style:d,src:t.url,...s,draggable:!1})}return m.jsx("img",{className:"absolute inset-0 w-full h-full pointer-events-none block",src:t.url,...s,draggable:!1})}function _x(t){return!t||!t.includes(" ")?t:t.replace(/ /g," ")}function vE({node:t}){if(!t.text)return null;if(t.text.listMarkerGeometry&&t.text.content.trim()===""){const{path:d,fillRule:f}=t.text.listMarkerGeometry,p=t.text.color;return m.jsx("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:m.jsx("path",{d,fill:p,fillRule:f})})}const a=t.text.segments&&t.text.segments.length>1,l=t.text.listMarker,o=Mw(t),s=Cw(t);l&&(o.display="list-item",o.listStylePosition="inside",o.paddingLeft="0.25em");const c=a?t.text.segments.map((d,f)=>m.jsx("span",{style:{fontSize:d.fontSize,fontFamily:`'${d.fontFamily}', sans-serif`,fontWeight:d.fontWeight,color:d.color,letterSpacing:d.letterSpacing||void 0,lineHeight:d.lineHeight?`${d.lineHeight}px`:void 0,...d.textDecoration?{textDecoration:d.textDecoration}:{}},children:_x(d.content)},f)):_x(t.text.content);return s?m.jsx("span",{style:s,children:m.jsx("span",{style:o,children:c})}):m.jsx("span",{style:o,children:c})}const Jb=N.memo(function t({node:a,mod:l,isRoot:o=!1,screenshotMode:s=!1,coveredByAncestor:c}){var R,E,T;const{selectNode:d,findNodeAsset:f,displayMode:p,hiddenNodeIds:g}=Ze(Pt(D=>({selectNode:D.selectNode,findNodeAsset:D.findNodeAsset,displayMode:D.displayMode,hiddenNodeIds:D.hiddenNodeIds}))),x=f(a.id),v=p==="map",w=(R=a.text)!=null&&R.content?`${a.name} - ${a.text.content}`:a.name,y=N.useMemo(()=>{var ne;if(!((ne=a.computed)!=null&&ne.maskInfo))return{maskChildId:void 0,hideMaskChild:!1};const{childId:D,coversParent:k,shouldHide:V,background:te}=a.computed.maskInfo;if(!k)return{maskChildId:D,hideMaskChild:!1};const J={},q=f(D);return q&&(J.WebkitMaskImage=`url(${q.url})`,J.maskImage=`url(${q.url})`,J.WebkitMaskSize="100% 100%",J.maskSize="100% 100%",J.WebkitMaskRepeat="no-repeat",J.maskRepeat="no-repeat"),te&&Object.assign(J,ds(te)),{maskChildId:D,hideMaskChild:V,styleUpdates:J}},[a,f]),S=N.useMemo(()=>Nw(a,o,!!x,c,l.nodes),[a,o,x,c,l]),C=y.styleUpdates?{...S,...y.styleUpdates}:S;if(!a.style.visible||g.has(a.id))return null;const j=!!x&&a.children.length===0,A=c||j,{maskChildId:_,hideMaskChild:z}=y;return m.jsxs("div",{"data-node-id":a.id,"data-type":a.type,"data-name":a.name,"data-parent-id":a.parentId??"","data-has-children":a.children.length>0,"data-has-asset":!!x,"data-effects-css-only":x&&((E=a.image)==null?void 0:E.effectsCssOnly)===!0?"true":void 0,"data-virtual":a.isVirtual?"true":void 0,"data-bbox":`${Math.round(a.bbox.x)},${Math.round(a.bbox.y)},${Math.round(a.bbox.width)},${Math.round(a.bbox.height)}`,"data-text":((T=a.text)==null?void 0:T.content)??"","aria-label":`${w} - ${a.type} - ${Math.round(a.bbox.width)}×${Math.round(a.bbox.height)}`,role:"region",className:`design-node ${v?"":"cursor-pointer"}`,style:{...C,...o&&s?{overflow:"visible"}:void 0},onClick:D=>{if(Ze.getState().isDragging){D.stopPropagation();return}D.stopPropagation();const k=gE(D.clientX,D.clientY);d(k??a.id)},children:[x&&!c&&m.jsx(xE,{asset:x,node:a}),gw(a,!!x,c)&&m.jsx(vE,{node:a}),a.children.map(D=>l.nodes[D]).filter(Boolean).map(D=>{var k;return m.jsx(t,{node:D,mod:l,coveredByAncestor:D.id===_?z&&!((k=D.style.strokes)!=null&&k.some(V=>V.width>0)):A},D.id)})]})});function Sd(t,a){let l=t.bbox.x,o=t.bbox.y,s=t.parentId;for(;s;){const c=a.nodes[s];if(!c||c.id===a.rootNodeId)break;l+=c.bbox.x,o+=c.bbox.y,s=c.parentId}return{x:l,y:o,w:t.bbox.width,h:t.bbox.height}}function bE({mod:t}){const a=Ze(x=>x.selectedNodeId),l=a?t.nodes[a]:void 0,o=N.useMemo(()=>l?rv(l,t):[],[l,t]),s=N.useMemo(()=>l?Zd(l,t):null,[l,t]),c=N.useMemo(()=>l?Tw(l,t):null,[l,t]);if(!l)return null;const d=Sd(l,t),f=o.slice(0,4),p=l.parentId?t.nodes[l.parentId]:void 0,g=p?p.id===t.rootNodeId?{x:0,y:0,w:p.bbox.width,h:p.bbox.height}:Sd(p,t):void 0;return m.jsxs("svg",{className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%",zIndex:9999,overflow:"visible"},children:[s&&m.jsx(yE,{rect:d,padding:s}),c&&g&&m.jsx(wE,{nodeRect:d,parentRect:g,spacing:c}),f.map((x,v)=>{const w=t.nodes[x.to.id];if(!w)return null;const y=d,S=Sd(w,t);if(x.direction==="horizontal"){const T=y.x<S.x?y:S,D=y.x<S.x?S:y,k=T.x+T.w,V=D.x,te=Math.max(y.y,S.y),J=Math.min(y.y+y.h,S.y+S.h),q=(te+J)/2;return m.jsxs("g",{children:[m.jsx("line",{x1:k,y1:q,x2:V,y2:q,stroke:"#f43f5e",strokeWidth:1.5}),m.jsx("line",{x1:k,y1:q-8,x2:k,y2:q+8,stroke:"#f43f5e",strokeWidth:2}),m.jsx("line",{x1:V,y1:q-8,x2:V,y2:q+8,stroke:"#f43f5e",strokeWidth:2}),m.jsx(Dx,{x:(k+V)/2,y:q-6,value:x.distance})]},`h-${v}`)}const C=y.y<S.y?y:S,j=y.y<S.y?S:y,A=C.y+C.h,_=j.y,z=Math.max(y.x,S.x),R=Math.min(y.x+y.w,S.x+S.w),E=(z+R)/2;return m.jsxs("g",{children:[m.jsx("line",{x1:E,y1:A,x2:E,y2:_,stroke:"#f43f5e",strokeWidth:1.5}),m.jsx("line",{x1:E-8,y1:A,x2:E+8,y2:A,stroke:"#f43f5e",strokeWidth:2}),m.jsx("line",{x1:E-8,y1:_,x2:E+8,y2:_,stroke:"#f43f5e",strokeWidth:2}),m.jsx(Dx,{x:E+6,y:(A+_)/2,value:x.distance})]},`v-${v}`)})]})}function Dx({x:t,y:a,value:l}){const o=`${l}`,s=Math.max(32,o.length*12+10);return m.jsxs("g",{children:[m.jsx("rect",{x:t-s/2,y:a-10,width:s,height:20,rx:4,fill:"#f43f5e",opacity:.92}),m.jsx("text",{x:t,y:a+4,textAnchor:"middle",fill:"#fff",fontSize:14,fontFamily:"monospace",fontWeight:700,children:l})]})}function yE({rect:t,padding:a}){const l=[];if(a.top>2){const o=t.x+t.w/2;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:o,y1:t.y,x2:o,y2:t.y+a.top,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:o+6,y:t.y+a.top/2,value:a.top})]},"pt"))}if(a.bottom>2){const o=t.x+t.w/2,s=t.y+t.h-a.bottom,c=t.y+t.h;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:o,y1:s,x2:o,y2:c,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:o+6,y:(s+c)/2,value:a.bottom})]},"pb"))}if(a.left>2){const o=t.y+t.h/2;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:t.x,y1:o,x2:t.x+a.left,y2:o,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:t.x+a.left/2,y:o-6,value:a.left})]},"pl"))}if(a.right>2){const o=t.y+t.h/2,s=t.x+t.w-a.right,c=t.x+t.w;l.push(m.jsxs("g",{children:[m.jsx("line",{x1:s,y1:o,x2:c,y2:o,stroke:"#3b82f6",strokeWidth:1,strokeDasharray:"3 2"}),m.jsx(as,{x:(s+c)/2,y:o-6,value:a.right})]},"pr"))}return m.jsx(m.Fragment,{children:l})}function as({x:t,y:a,value:l}){const o=`${l}`,s=Math.max(28,o.length*10+10);return m.jsxs("g",{children:[m.jsx("rect",{x:t-s/2,y:a-9,width:s,height:18,rx:3,fill:"#3b82f6",opacity:.88}),m.jsx("text",{x:t,y:a+4,textAnchor:"middle",fill:"#fff",fontSize:12,fontFamily:"monospace",fontWeight:700,children:l})]})}const Xt="#10b981";function wE({nodeRect:t,parentRect:a,spacing:l}){const o=[];if(o.push(m.jsx("rect",{x:a.x,y:a.y,width:a.w,height:a.h,fill:"none",stroke:Xt,strokeWidth:1,strokeDasharray:"6 3",opacity:.5},"parent-outline")),l.top>0){const s=t.x+t.w/2;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:s,y1:a.y,x2:s,y2:t.y,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:s-4,y1:a.y,x2:s+4,y2:a.y,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:s-4,y1:t.y,x2:s+4,y2:t.y,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:s+6,y:(a.y+t.y)/2,value:l.top})]},"parent-top"))}if(l.bottom>0){const s=t.x+t.w/2,c=t.y+t.h,d=a.y+a.h;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:s,y1:c,x2:s,y2:d,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:s-4,y1:c,x2:s+4,y2:c,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:s-4,y1:d,x2:s+4,y2:d,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:s+6,y:(c+d)/2,value:l.bottom})]},"parent-bottom"))}if(l.left>0){const s=t.y+t.h/2;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:a.x,y1:s,x2:t.x,y2:s,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:a.x,y1:s-4,x2:a.x,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:t.x,y1:s-4,x2:t.x,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:(a.x+t.x)/2,y:s-6,value:l.left})]},"parent-left"))}if(l.right>0){const s=t.y+t.h/2,c=t.x+t.w,d=a.x+a.w;o.push(m.jsxs("g",{children:[m.jsx("line",{x1:c,y1:s,x2:d,y2:s,stroke:Xt,strokeWidth:1,strokeDasharray:"4 2"}),m.jsx("line",{x1:c,y1:s-4,x2:c,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx("line",{x1:d,y1:s-4,x2:d,y2:s+4,stroke:Xt,strokeWidth:1.5}),m.jsx(os,{x:(c+d)/2,y:s-6,value:l.right})]},"parent-right"))}return m.jsx(m.Fragment,{children:o})}function os({x:t,y:a,value:l}){const o=`${l}`,s=Math.max(28,o.length*10+10);return m.jsxs("g",{children:[m.jsx("rect",{x:t-s/2,y:a-9,width:s,height:18,rx:3,fill:Xt,opacity:.88}),m.jsx("text",{x:t,y:a+4,textAnchor:"middle",fill:"#fff",fontSize:12,fontFamily:"monospace",fontWeight:700,children:l})]})}function ey(t,a){for(const l of t.querySelectorAll("[data-node-id]"))if(l.dataset.nodeId===a)return l;return null}function $x(t,a,l){const o=ey(t,a);if(!o)return null;const s=t.getBoundingClientRect(),c=o.getBoundingClientRect(),d=Math.max(l,1e-4);return{id:a,x:(c.left-s.left)/d,y:(c.top-s.top)/d,width:c.width/d,height:c.height/d}}function SE({containerRef:t,moduleData:a,zoom:l}){const{selectedNodeId:o,highlightedNodeIds:s,hiddenNodeIds:c,displayMode:d}=Ze(Pt(j=>({selectedNodeId:j.selectedNodeId,highlightedNodeIds:j.highlightedNodeIds,hiddenNodeIds:j.hiddenNodeIds,displayMode:j.displayMode}))),[f,p]=N.useState(null),[g,x]=N.useState([]),v=d==="map";if(N.useLayoutEffect(()=>{const j=t.current;if(!j||v){p(null),x([]);return}const A=[...s].filter(T=>!c.has(T));let _=0;const z=()=>{_=0,p(o&&!c.has(o)?$x(j,o,l):null),x(A.flatMap(T=>{const D=$x(j,T,l);return D?[D]:[]}))},R=()=>{_||(_=window.requestAnimationFrame(z))};z(),window.addEventListener("resize",R);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(R);E==null||E.observe(j);for(const T of[o,...A]){if(!T)continue;const D=ey(j,T);D&&(E==null||E.observe(D))}return()=>{_&&window.cancelAnimationFrame(_),window.removeEventListener("resize",R),E==null||E.disconnect()}},[t,c,s,v,a,o,l]),!f&&g.length===0)return null;const w=Math.max(l,1e-4),y=2/w,S=1/w,C=(j,A,_)=>m.jsx("rect",{x:j.x-S,y:j.y-S,width:j.width+S*2,height:j.height+S*2,fill:"none",stroke:A,strokeWidth:y},_);return m.jsxs("svg",{className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%",zIndex:1e4,overflow:"visible"},children:[g.map(j=>C(j,"rgba(234, 88, 12, 0.9)",`hl-${j.id}`)),f&&C(f,"#2563eb","selected")]})}const At=22,ty=8,ny=7.5,uo=3,NE=100,CE="#ff4800",ME="#ff4800",Nd=20,jE=8,EE=10;function Id(t,a){return t.x<a.x+a.w&&t.x+t.w>a.x&&t.y<a.y+a.h&&t.y+t.h>a.y}function iy(t,a){return t.length>a?t.slice(0,a)+"…":t}function ay(t){return t.length*ny+ty}function zs(t,a,l){return Math.max(a,Math.min(t,l))}function AE(t,a,l,o,s){if(!a)return[];const c=TE(t,a,l,o,s);return OE(c,o,s)}function TE(t,a,l,o,s){const c=[];for(const d of t){const f=Ef(d.absoluteBbox,a,l);if(!zE(f,o,s))continue;const p=iy(d.name,jE),g=`${d.id} · ${p}`,x=ay(g),v=zs(f.x+f.width/2,0,o),w=zs(f.y+f.height/2,0,s),{idealX:y,idealY:S}=RE(v,w,x,o);c.push({nodeId:d.id,labelText:g,labelW:x,dotX:v,dotY:w,idealX:y,idealY:S})}return c.sort((d,f)=>d.idealY-f.idealY||d.idealX-f.idealX),c}function Ef(t,a,l){return{x:(t.x-a.x)*l.zoom+l.panX,y:(t.y-a.y)*l.zoom+l.panY,width:t.width*l.zoom,height:t.height*l.zoom}}function zE(t,a,l){return!(t.x+t.width<0||t.x>a||t.y+t.height<0||t.y>l)}function RE(t,a,l,o){let s=t,c=a-At-uo;return c<0&&(c=a+uo),s=zs(s,uo,o-l-uo),{idealX:s,idealY:c}}function OE(t,a,l){const o=[],s=[];for(const c of t){const d=kE(c,o,a,l);o.push({x:d.x,y:d.y,w:c.labelW,h:At}),s.push({nodeId:c.nodeId,labelText:c.labelText,labelW:c.labelW,...d,dotX:c.dotX,dotY:c.dotY})}return s}function kE(t,a,l,o){for(let s=0;s<40;s++){const c=t.idealY+s*(At+uo);if(c+At>o+10)break;const d=_E(t.idealX,t.labelW,l);for(const f of d){const p={x:f,y:c,w:t.labelW,h:At};if(!a.some(g=>Id(p,g)))return{x:f,y:c}}}return{x:t.idealX,y:Math.min(t.idealY,o-At-uo)}}function _E(t,a,l){const o=[t],s=t+a+4;s+a<=l&&o.push(s);const c=t-a-4;return c>=0&&o.push(c),o}function DE(t,a,l,o){return t<a?"left":a<t?"right":l<o/2?"left":"right"}function $E(t,a,l,o,s){if(!a)return new Map;const c=LE(l,a),d=[...t].sort((x,v)=>x.absoluteBbox.y-v.absoluteBbox.y),f=new Map,p=[],g={left:0,right:0};for(const x of d){const v=Ef(x.absoluteBbox,a,l),w=v.x+v.width/2,y=DE(g.left,g.right,w,o),S=UE(x,a,l,s,c,y,p);f.set(x.id,S),p.push({x:S.labelX,y:S.labelY,w:S.width,h:S.height});const{leftX:C}=oy(c,S.width),j=S.labelX<C+S.width?"left":"right";g[j]++}return f}function LE(t,a){return{left:t.panX,right:t.panX+a.width*t.zoom,top:t.panY}}function UE(t,a,l,o,s,c,d){const f=Ef(t.absoluteBbox,a,l),p=iy(t.name,EE),g=`${t.id} · ${p}`,x=ay(g),{leftX:v,rightX:w}=oy(s,x),y=zs(f.y+f.height/2-At/2,s.top,o-At-10),{labelX:S,labelY:C}=BE(c==="left"?v:w,y,x,d,c,v,w),{anchorX:j,anchorY:A}=HE(f,s,o,S);return{nodeId:t.id,labelX:S,labelY:C,anchorX:j,anchorY:A,width:x,height:At,labelText:g}}function oy(t,a){return{leftX:t.left-a-40,rightX:t.right+40}}function BE(t,a,l,o,s,c,d){let f=t,p=a,g={x:f,y:p,w:l,h:At},x=0;for(;o.some(v=>Id(g,v))&&x<Nd;)p+=At+8,g={x:f,y:p,w:l,h:At},x++;if(x>=Nd)for(f=s==="left"?d:c,p=a,g={x:f,y:p,w:l,h:At},x=0;o.some(v=>Id(g,v))&&x<Nd;)p+=At+8,g={x:f,y:p,w:l,h:At},x++;return{labelX:f,labelY:p}}function HE(t,a,l,o){const s=Math.max(t.x,a.left),c=Math.min(t.x+t.width,a.right),d=Math.max(t.y,a.top),f=Math.min(t.y+t.height,l);return{anchorX:o<a.left?s:c,anchorY:(d+f)/2}}function YE({camera:t,mod:a,areaRef:l}){const{selectedNodeId:o,selectNode:s}=Ze(Pt(w=>({selectedNodeId:w.selectedNodeId,selectNode:w.selectNode}))),{root:c,focusNode:d,directChildren:f}=N.useMemo(()=>{const w=a.nodes[a.rootNodeId],y=o??a.rootNodeId,S=a.nodes[y]??w,C=S?S.children.map(j=>a.nodes[j]).filter(j=>!!j&&j.style.visible):[];return{root:w,focusNode:S,directChildren:C}},[a.nodes,a.rootNodeId,o]),p=IE(l),g=GE(c,t,p.width),x=N.useMemo(()=>g==="tooltip"?AE(f,c==null?void 0:c.absoluteBbox,t,p.width,p.height):[],[g,f,c,t,p]),v=N.useMemo(()=>g==="line"?$E(f,c==null?void 0:c.absoluteBbox,t,p.width,p.height):new Map,[g,f,c,t,p.width,p.height]);return!c||!d?null:m.jsxs("svg",{"data-node-map-overlay":!0,className:"absolute inset-0 pointer-events-none z-40",width:p.width,height:p.height,children:[m.jsx(VE,{focusNode:d,childrenCount:f.length}),g==="tooltip"&&m.jsx(XE,{tooltips:x,onSelectNode:s}),g==="line"&&m.jsx(qE,{childNodes:f,labelPlacements:v,onSelectNode:s})]})}function IE(t){var l;const a=(l=t.current)==null?void 0:l.getBoundingClientRect();return{width:(a==null?void 0:a.width)??800,height:(a==null?void 0:a.height)??600}}function GE(t,a,l){const o=t?t.absoluteBbox.width*a.zoom:0,s=a.panX,c=l-(a.panX+o);return Math.max(s,c)>=NE?"line":"tooltip"}function VE({focusNode:t,childrenCount:a}){const{t:l}=gt(),o=l(`viewer.map.childCount.${a===1?"one":"other"}`,{count:a}),s=`${t.id} · ${t.name} (${o})`,c=s.length*ny+20;return m.jsxs("g",{transform:"translate(12, 12)",children:[m.jsx("rect",{x:"0",y:"0",width:c,height:"24",rx:"4",fill:"rgba(0,0,0,0.75)"}),m.jsx("text",{x:"10",y:"16",fill:"#fff",fontSize:"12",fontWeight:"700",fontFamily:"ui-monospace, monospace",children:s})]})}function XE({tooltips:t,onSelectNode:a}){return m.jsx(m.Fragment,{children:t.map(l=>m.jsxs("g",{className:"pointer-events-auto cursor-pointer",onClick:()=>a(l.nodeId),children:[m.jsx("circle",{cx:l.dotX,cy:l.dotY,r:"3",fill:"rgba(0,0,0,0.85)"}),m.jsx("rect",{x:l.x,y:l.y,width:l.labelW,height:At,rx:"3",fill:"rgba(0,0,0,0.82)"}),m.jsx("text",{x:l.x+ty,y:l.y+At/2+4,fill:"#fff",fontSize:"11",fontWeight:"600",fontFamily:"ui-monospace, monospace",style:{userSelect:"none"},children:l.labelText})]},l.nodeId))})}function qE({childNodes:t,labelPlacements:a,onSelectNode:l}){return m.jsx(m.Fragment,{children:t.map(o=>{const s=a.get(o.id);if(!s)return null;const c=s.labelX<s.anchorX?s.labelX+s.width:s.labelX,d=s.labelY+s.height/2;return m.jsxs("g",{className:"pointer-events-auto",onClick:()=>l(o.id),children:[m.jsx("line",{x1:s.anchorX,y1:s.anchorY,x2:c,y2:d,stroke:ME,strokeWidth:"2"}),m.jsx("circle",{cx:s.anchorX,cy:s.anchorY,r:"4",fill:CE}),m.jsx("text",{x:s.labelX+s.width/2,y:s.labelY+s.height/2+5,textAnchor:"middle",fill:"#fff",fontSize:"12",fontWeight:"600",fontFamily:"ui-monospace, monospace",style:{userSelect:"none"},children:s.labelText})]},o.id)})})}function PE(t,a){let l=t.absoluteBbox.x,o=t.absoluteBbox.y,s=t.absoluteBbox.x+t.absoluteBbox.width,c=t.absoluteBbox.y+t.absoluteBbox.height,d=t.parentId;for(;d;){const g=a.nodes[d];if(!g)break;g.style.overflow==="hidden"&&(l=Math.max(l,g.absoluteBbox.x),o=Math.max(o,g.absoluteBbox.y),s=Math.min(s,g.absoluteBbox.x+g.absoluteBbox.width),c=Math.min(c,g.absoluteBbox.y+g.absoluteBbox.height)),d=g.parentId}const f=Math.max(0,s-l),p=Math.max(0,c-o);return f>0&&p>0?{x:l,y:o,width:f,height:p}:{...t.absoluteBbox}}const QE=24;function ha(t,a){return Math.max(QE,t-a*2)}function ZE(t,a,l){const s=Math.min(ha(t.width,40)/l.bbox.width,ha(t.height,40)/l.bbox.height,2),c=Math.min(ha(t.width,60)/a.width,ha(t.height,60)/a.height,s*1.5),d=a.x-l.absoluteBbox.x,f=a.y-l.absoluteBbox.y;return{zoom:c,panX:(t.width-a.width*c)/2-d*c,panY:(t.height-a.height*c)/2-f*c}}function Lx({screenshotMode:t=!1}={}){const{t:a}=gt(),{mod:l,selectNode:o,displayMode:s,fitTargetNodeId:c,setFitTargetNodeId:d,canvasBgColor:f,toggleCanvasBgColor:p}=Ze(Pt(q=>({mod:q.getCurrentModule(),selectNode:q.selectNode,displayMode:q.displayMode,fitTargetNodeId:q.fitTargetNodeId,setFitTargetNodeId:q.setFitTargetNodeId,canvasBgColor:q.canvasBgColor,toggleCanvasBgColor:q.toggleCanvasBgColor}))),g=N.useRef(null),x=N.useRef(null),[v,w]=N.useState({zoom:1,panX:0,panY:0}),[y,S]=N.useState(!1),[C,j]=N.useState(!1),A=N.useRef({x:0,y:0}),_=N.useRef(s),z=N.useCallback(()=>{const q=g.current;if(!q||!l)return 1;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return 1;const oe=40,U=ha(ne.width,oe)/ae.bbox.width,Q=ha(ne.height,oe)/ae.bbox.height;return Math.min(U,Q,2)},[l]),R=N.useCallback(()=>{const q=g.current;if(!q||!l)return!1;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return!1;const oe=z(),U=ae.bbox.width,Q=ae.bbox.height;return w({zoom:oe,panX:(ne.width-U*oe)/2,panY:(ne.height-Q*oe)/2}),!0},[l,z]),E=N.useCallback(()=>{const q=g.current;if(!q||!l)return;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return;const oe=40,U=Math.min(ha(ne.width,oe)/ae.bbox.width,2),Q=ae.bbox.width;w({zoom:U,panX:(ne.width-Q*U)/2,panY:oe})},[l]);N.useEffect(()=>{if(!c||!l||!y)return;if(s==="visual"){d(null);return}const q=l.nodes[c],ne=g.current,ae=l.nodes[l.rootNodeId];!q||!ne||!ae||(w(ZE(ne.getBoundingClientRect(),PE(q,l),ae)),d(null))},[c,l,y,s,d]),N.useEffect(()=>{_.current!=="visual"&&s==="visual"&&y&&R(),_.current=s},[s,y,R]);const T=N.useCallback((q,ne,ae)=>{w(oe=>{const U=Math.max(.05,Math.min(10,oe.zoom*q)),Q=U/oe.zoom;return{zoom:U,panX:ne-(ne-oe.panX)*Q,panY:ae-(ae-oe.panY)*Q}})},[]),D=N.useCallback(q=>{const ne=g.current;if(!ne)return;const ae=ne.getBoundingClientRect();T(q,ae.width/2,ae.height/2)},[T]);N.useEffect(()=>{const q=g.current;if(!q)return;R()&&S(!0);const ne=ae=>{if(ae.preventDefault(),ae.ctrlKey||ae.metaKey){const oe=q.getBoundingClientRect(),U=ae.clientX-oe.left,Q=ae.clientY-oe.top,K=ae.deltaY>0?.92:1.08;T(K,U,Q)}else w(oe=>({...oe,panX:oe.panX-ae.deltaX,panY:oe.panY-ae.deltaY}))};return q.addEventListener("wheel",ne,{passive:!1}),()=>q.removeEventListener("wheel",ne)},[R,T]);const k=N.useCallback(q=>{q.button===0&&(q.target.closest("[data-node-id]")||o(null),q.preventDefault(),j(!0),A.current={x:q.clientX,y:q.clientY})},[o]),V=N.useCallback(()=>{const q=g.current;if(!q||!l)return;const ne=q.getBoundingClientRect(),ae=l.nodes[l.rootNodeId];if(!ae)return;const oe=z(),U=.01;w(Q=>{let K;if(oe>=1-U?K=(Q.zoom>=oe-U,oe):Q.zoom<oe-U?K=oe:Q.zoom<1-U?K=1:K=oe,Math.abs(K-oe)<U){const Z=ae.bbox.width,ie=ae.bbox.height;return{zoom:oe,panX:(ne.width-Z*oe)/2,panY:(ne.height-ie*oe)/2}}const de=ne.width/2,ee=ne.height/2,$=K/Q.zoom;return{zoom:K,panX:de-(de-Q.panX)*$,panY:ee-(ee-Q.panY)*$}})},[l,z]);N.useEffect(()=>{if(!C)return;const q=ae=>{const oe=ae.clientX-A.current.x,U=ae.clientY-A.current.y;(Math.abs(oe)>3||Math.abs(U)>3)&&Ze.getState().setIsDragging(!0),w(Q=>({...Q,panX:Q.panX+oe,panY:Q.panY+U})),A.current={x:ae.clientX,y:ae.clientY}},ne=()=>{j(!1),requestAnimationFrame(()=>{Ze.getState().setIsDragging(!1)})};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",ne),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",ne)}},[C]);const te=f==="dark"?"bg-[#0d0d0d]":"bg-white";if(!l)return m.jsx("main",{id:"canvas",className:te});const J=l.nodes[l.rootNodeId];return J?m.jsxs("main",{id:"canvas",ref:g,className:Ot("relative overflow-hidden",te,C?"cursor-grabbing":"cursor-grab"),onMouseDown:k,onDoubleClick:V,children:[m.jsxs("div",{ref:x,className:t?"will-change-transform":"will-change-transform transition-opacity duration-200",style:{width:J.bbox.width,height:J.bbox.height,position:"relative",transform:`translate(${v.panX}px, ${v.panY}px) scale(${v.zoom})`,transformOrigin:"0 0",opacity:t||y?1:0},children:[m.jsx(Jb,{node:J,mod:l,isRoot:!0,screenshotMode:t,coveredByAncestor:!1}),!t&&m.jsx(SE,{containerRef:x,moduleData:l,zoom:v.zoom}),m.jsx(bE,{mod:l})]}),s==="map"&&m.jsx(YE,{camera:v,mod:l,areaRef:g}),!t&&m.jsxs("div",{"data-screenshot-hide":!0,className:"absolute bottom-3 left-1/2 z-50 flex max-w-[calc(100vw-24px)] -translate-x-1/2 items-center gap-0.5 rounded-lg border border-white/10 bg-black/80 p-1 backdrop-blur-md sm:bottom-4",children:[m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a(f==="dark"?"viewer.canvas.switchLight":"viewer.canvas.switchDark"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:p,children:f==="dark"?m.jsx(ej,{className:"size-3"}):m.jsx(_M,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a(f==="dark"?"viewer.canvas.switchLight":"viewer.canvas.switchDark")})]}),m.jsx("div",{className:"h-3.5 w-px bg-white/10 mx-0.5"}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.fitView"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:R,children:m.jsx(TM,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.fitView")})]}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.fitWidth"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:E,children:m.jsx($M,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.fitWidth")})]}),m.jsx("div",{className:"h-3.5 w-px bg-white/10 mx-0.5"}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.zoomOut"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:()=>D(1/1.25),children:m.jsx(yf,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.zoomOut")})]}),m.jsxs("span",{className:"text-[10px] text-white/35 w-10 text-center tabular-nums select-none font-mono",children:[Math.round(v.zoom*100),"%"]}),m.jsxs(vl,{children:[m.jsx(bl,{asChild:!0,children:m.jsx(gn,{variant:"ghost",size:"icon-xs","aria-label":a("viewer.canvas.zoomIn"),className:"text-white/50 hover:text-white hover:bg-white/10 rounded-md",onClick:()=>D(1.25),children:m.jsx(Sb,{className:"size-3"})})}),m.jsx(yl,{side:"top",children:a("viewer.canvas.zoomIn")})]})]})]}):m.jsx("main",{id:"canvas",className:te})}const FE="0.0.4",Ux="/mcp",Bx="2025-06-18",Hx=-32001;class wt extends Error{constructor(a,l,o="INVALID_RESPONSE",s){super(a),this.code=l,this.reason=o,this.domainCode=s,this.name="McpClientError"}}class WE{constructor(){_i(this,"requestId",0);_i(this,"sessionId",null);_i(this,"initialized",!1);_i(this,"negotiatedProtocolVersion",Bx);_i(this,"initializePromise",null)}async callTool(a,l,o){await this.ensureInitialized();let s;try{s=await this.request("tools/call",{name:a,arguments:l},o)}catch(d){if(!(d instanceof wt)||d.reason!=="SESSION_EXPIRED")throw d;await this.ensureInitialized(),s=await this.request("tools/call",{name:a,arguments:l},o)}const c=this.extractToolPayload(s);if(s.isError){const d=lA(c);throw new wt(d.message||`MCP tool ${a} failed`,void 0,"TOOL_ERROR",d.code)}return c}close(){const a=this.sessionId;this.resetSession(),this.initializePromise=null,a&&fetch(Ux,{method:"DELETE",headers:{Accept:"application/json, text/event-stream","MCP-Protocol-Version":this.negotiatedProtocolVersion,"MCP-Session-Id":a},keepalive:!0}).then(l=>{var o;return(o=l.body)==null?void 0:o.cancel()}).catch(()=>{})}async ensureInitialized(){if(!this.initialized)return this.initializePromise||(this.initializePromise=this.initialize().finally(()=>{this.initializePromise=null})),this.initializePromise}resetSession(){this.sessionId=null,this.initialized=!1}sessionExpiredError(a){return this.resetSession(),new wt(a,Hx,"SESSION_EXPIRED")}async initialize(){const a=await this.request("initialize",{protocolVersion:Bx,capabilities:{},clientInfo:{name:"tarot-pixel-view",version:FE}});a.protocolVersion&&(this.negotiatedProtocolVersion=a.protocolVersion),await this.notify("notifications/initialized"),this.initialized=!0}async request(a,l,o){const s=++this.requestId,c=await this.post({jsonrpc:"2.0",id:s,method:a,params:l},o),d=await this.readJsonRpcResponse(c,s);if("error"in d)throw d.error.code===Hx?this.sessionExpiredError(d.error.message):new wt(d.error.message,d.error.code,"RPC_ERROR");return d.result}async notify(a){const l=await this.post({jsonrpc:"2.0",method:a});if(!l.ok)throw new wt(`MCP notification failed with HTTP ${l.status}`,void 0,"REQUEST_FAILED")}async post(a,l){const o=this.sessionId!==null,s={Accept:"application/json, text/event-stream","Content-Type":"application/json","MCP-Protocol-Version":this.negotiatedProtocolVersion};this.sessionId&&(s["Mcp-Session-Id"]=this.sessionId);const c=await fetch(Ux,{method:"POST",headers:s,body:JSON.stringify(a),signal:l}),d=c.headers.get("Mcp-Session-Id");if(d&&(this.sessionId=d),!c.ok)throw c.status===404&&o?this.sessionExpiredError("The MCP session has expired"):new wt(`MCP request failed with HTTP ${c.status}`,void 0,"REQUEST_FAILED");return c}async readJsonRpcResponse(a,l){if(a.status===202||a.status===204)throw new wt("The MCP request did not return a JSON-RPC result",void 0,"EMPTY_RESPONSE");if((a.headers.get("content-type")??"").includes("text/event-stream")){const d=(await a.text()).split(/\r?\n\r?\n/).flatMap(f=>{const p=f.split(/\r?\n/).filter(g=>g.startsWith("data:")).map(g=>g.slice(5).trim()).join(`
|
|
255
255
|
`);if(!p)return[];try{return[JSON.parse(p)]}catch{return[]}}).find(f=>f.id===l);if(!d)throw new wt("The MCP SSE response did not include the matching result",void 0,"INVALID_RESPONSE");return d}return await a.json()}extractToolPayload(a){var o,s;if(a.structuredContent!==void 0)return a.structuredContent;const l=(s=(o=a.content)==null?void 0:o.find(c=>c.type==="text"))==null?void 0:s.text;if(l===void 0)throw new wt("The MCP tool response did not include structured data",void 0,"INVALID_RESPONSE");try{return JSON.parse(l)}catch{return l}}}const Ln=new WE;typeof window<"u"&&window.addEventListener("pagehide",()=>Ln.close());function Af(t,a){if(!t.data||!Array.isArray(t.data.modules))throw new wt(`MCP tool ${a} returned invalid design data`);return t.data}async function KE(t,a){const l=await Ln.callTool("design_get_data",{designId:t},a);return Af(l,"design_get_data")}async function JE(t,a){const l=await Ln.callTool("design_get_snapshot",{designId:t},a),o=Af(l,"design_get_snapshot");if(typeof l.revision!="string"||!l.revision)throw new wt("MCP tool design_get_snapshot returned an invalid revision");return{data:o,revision:l.revision}}async function eA(t,a){const l=await Ln.callTool("design_get_raw",{designId:t},a);return Af(l,"design_get_raw")}async function tA(t,a){const l=await Ln.callTool("design_get_revision",{designId:t},a);if(typeof l.revision!="string")throw new wt("MCP tool design_get_revision returned an invalid revision");return l.revision}async function oz(t,a){const l=await Ln.callTool("design_get_overview",{designId:t},a);if(!Array.isArray(l.modules)||l.modules.some(o=>!o||typeof o.moduleId!="string"||typeof o.name!="string"||!nA(o.bbox)||!iA(o.preview))||l.exportedAt!==void 0&&typeof l.exportedAt!="string")throw new wt("MCP tool design_get_overview returned an invalid module list");return l}function nA(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const a=t;return[a.x,a.y,a.width,a.height].every(l=>typeof l=="number"&&Number.isFinite(l))}function iA(t){if(t==null)return!0;if(typeof t!="object"||Array.isArray(t))return!1;const a=t;return typeof a.url=="string"&&typeof a.width=="number"&&Number.isFinite(a.width)&&typeof a.height=="number"&&Number.isFinite(a.height)}async function lz(t){const a=await Ln.callTool("design_list",{},t);if(!Array.isArray(a.designs))throw new wt("MCP tool design_list returned an invalid list");return a.designs}async function rz(t,a){const l=await Ln.callTool("design_delete",{designId:t},a);if(typeof l.deleted!="boolean")throw new wt("MCP tool design_delete returned an invalid result");return l.deleted}async function aA(t){const a=await Ln.callTool("font_registry_get",{},t);return Array.isArray(a.fonts)?a.fonts:[]}async function oA(t,a){const l=await Ln.callTool("design_reload",{designId:t},a);if(l.success!==!0||typeof l.revision!="string")throw new wt("MCP tool design_reload returned an invalid result");return{success:!0,revision:l.revision}}function lA(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const a=t.error;return!a||typeof a!="object"?{}:{code:typeof a.code=="string"?a.code:void 0,message:typeof a.message=="string"?a.message:void 0}}const rA={".ttf":"truetype",".otf":"opentype",".woff":"woff",".woff2":"woff2",".eot":"embedded-opentype",".svg":"svg"},Yx="tarot-pixel-custom-fonts",sA=6e4;function cA(t){if(typeof t!="string")return null;try{const a=new URL(t,window.location.origin);return a.origin!==window.location.origin||!/^\/local-fonts\/[a-f0-9]{64}\.woff2$/.test(a.pathname)?null:a.href}catch{return null}}function Cd(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/[\r\n\f]/g," ")}function uA(t){const a=t.split("?")[0],l=a.slice(a.lastIndexOf(".")).toLowerCase();return rA[l]||"truetype"}const dA=()=>{};let Gd=dA,wl=null,Ix=0,Gx=!1,Tf=new Map;async function fA(){return Gx&&Date.now()-Ix<sA?Gd:wl||(wl=(async()=>{const t=new Map,a=new Map,l=await aA();for(const s of l){if(typeof s.family!="string"||!Array.isArray(s.styles))continue;const c=s.family.trim().toLowerCase();let d=t.get(c);d||(d=new Map,t.set(c,d));let f=a.get(c);f||(f=new Set,a.set(c,f));for(const p of s.styles){const g=cA(p.url);typeof p.style=="string"&&/^(?:[1-9]\d{0,2}|1000)$/.test(p.style)&&g&&(d.set(p.style,g),f.add(p.style))}}const o=(s,c)=>{const d=t.get(s.trim().toLowerCase());return d==null?void 0:d.get(`${c}`)};return Gd=o,Tf=a,Ix=Date.now(),Gx=!0,o})().finally(()=>{wl=null}),wl)}function hA(t){return Tf.has(t.trim().toLowerCase())}function Vx(t,a){const l=Tf.get(t.trim().toLowerCase());return(l==null?void 0:l.has(`${a}`))??!1}function ly(){return Gd}function mA(t,a,l){const o=t.text;if(!o)return;const s=l(o.fontFamily,o.fontWeight);if(s){const c=`${o.fontFamily}::${o.fontWeight}`;a.has(c)||a.set(c,{fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontUrl:s})}if(o.segments)for(const c of o.segments){const d=l(c.fontFamily,c.fontWeight);if(d){const f=`${c.fontFamily}::${c.fontWeight}`;a.has(f)||a.set(f,{fontFamily:c.fontFamily,fontWeight:c.fontWeight,fontUrl:d})}}}async function ry(t){const a=await fA(),l=new Map;for(const d of t.modules)for(const f of Object.values(d.nodes))mA(f,l,a);const o=document.getElementById(Yx);if(o&&o.remove(),l.size===0)return;const s=Array.from(l.values()).map(({fontFamily:d,fontWeight:f,fontUrl:p})=>`@font-face {
|
|
256
256
|
font-family: '${Cd(d)}';
|
|
257
257
|
src: url('${Cd(p)}') format('${uA(p)}');
|
|
@@ -349,4 +349,4 @@ ${o("detail.data.childList")}:
|
|
|
349
349
|
`)},Kx=function(){var t=parseInt(document.body.getAttribute(ho)||"0",10);return isFinite(t)?t:0},bT=function(){N.useEffect(function(){return document.body.setAttribute(ho,(Kx()+1).toString()),function(){var t=Kx()-1;t<=0?document.body.removeAttribute(ho):document.body.setAttribute(ho,t.toString())}},[])},yT=function(t){var a=t.noRelative,l=t.noImportant,o=t.gapMode,s=o===void 0?"margin":o;bT();var c=N.useMemo(function(){return gT(s)},[s]);return N.createElement(xT,{styles:vT(c,!a,s,l?"":"!important")})},Xd=!1;if(typeof window<"u")try{var cs=Object.defineProperty({},"passive",{get:function(){return Xd=!0,!0}});window.addEventListener("test",cs,cs),window.removeEventListener("test",cs,cs)}catch{Xd=!1}var lo=Xd?{passive:!1}:!1,wT=function(t){return t.tagName==="TEXTAREA"},vy=function(t,a){if(!(t instanceof Element))return!1;var l=window.getComputedStyle(t);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!wT(t)&&l[a]==="visible")},ST=function(t){return vy(t,"overflowY")},NT=function(t){return vy(t,"overflowX")},Jx=function(t,a){var l=a.ownerDocument,o=a;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var s=by(t,o);if(s){var c=yy(t,o),d=c[1],f=c[2];if(d>f)return!0}o=o.parentNode}while(o&&o!==l.body);return!1},CT=function(t){var a=t.scrollTop,l=t.scrollHeight,o=t.clientHeight;return[a,l,o]},MT=function(t){var a=t.scrollLeft,l=t.scrollWidth,o=t.clientWidth;return[a,l,o]},by=function(t,a){return t==="v"?ST(a):NT(a)},yy=function(t,a){return t==="v"?CT(a):MT(a)},jT=function(t,a){return t==="h"&&a==="rtl"?-1:1},ET=function(t,a,l,o,s){var c=jT(t,window.getComputedStyle(a).direction),d=c*o,f=l.target,p=a.contains(f),g=!1,x=d>0,v=0,w=0;do{if(!f)break;var y=yy(t,f),S=y[0],C=y[1],j=y[2],A=C-j-c*S;(S||A)&&by(t,f)&&(v+=A,w+=S);var _=f.parentNode;f=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!p&&f!==document.body||p&&(a.contains(f)||a===f));return(x&&Math.abs(v)<1||!x&&Math.abs(w)<1)&&(g=!0),g},us=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},ev=function(t){return[t.deltaX,t.deltaY]},tv=function(t){return t&&"current"in t?t.current:t},AT=function(t,a){return t[0]===a[0]&&t[1]===a[1]},TT=function(t){return`
|
|
350
350
|
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
351
351
|
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
352
|
-
`)},zT=0,ro=[];function RT(t){var a=N.useRef([]),l=N.useRef([0,0]),o=N.useRef(),s=N.useState(zT++)[0],c=N.useState(xy)[0],d=N.useRef(t);N.useEffect(function(){d.current=t},[t]),N.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var C=KA([t.lockRef.current],(t.shards||[]).map(tv),!0).filter(Boolean);return C.forEach(function(j){return j.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),C.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var f=N.useCallback(function(C,j){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!d.current.allowPinchZoom;var A=us(C),_=l.current,z="deltaX"in C?C.deltaX:_[0]-A[0],R="deltaY"in C?C.deltaY:_[1]-A[1],E,T=C.target,D=Math.abs(z)>Math.abs(R)?"h":"v";if("touches"in C&&D==="h"&&T.type==="range")return!1;var k=window.getSelection(),V=k&&k.anchorNode,te=V?V===T||V.contains(T):!1;if(te)return!1;var J=Jx(D,T);if(!J)return!0;if(J?E=D:(E=D==="v"?"h":"v",J=Jx(D,T)),!J)return!1;if(!o.current&&"changedTouches"in C&&(z||R)&&(o.current=E),!E)return!0;var q=o.current||E;return ET(q,j,C,q==="h"?z:R)},[]),p=N.useCallback(function(C){var j=C;if(!(!ro.length||ro[ro.length-1]!==c)){var A="deltaY"in j?ev(j):us(j),_=a.current.filter(function(E){return E.name===j.type&&(E.target===j.target||j.target===E.shadowParent)&&AT(E.delta,A)})[0];if(_&&_.should){j.cancelable&&j.preventDefault();return}if(!_){var z=(d.current.shards||[]).map(tv).filter(Boolean).filter(function(E){return E.contains(j.target)}),R=z.length>0?f(j,z[0]):!d.current.noIsolation;R&&j.cancelable&&j.preventDefault()}}},[]),g=N.useCallback(function(C,j,A,_){var z={name:C,delta:j,target:A,should:_,shadowParent:OT(A)};a.current.push(z),setTimeout(function(){a.current=a.current.filter(function(R){return R!==z})},1)},[]),x=N.useCallback(function(C){l.current=us(C),o.current=void 0},[]),v=N.useCallback(function(C){g(C.type,ev(C),C.target,f(C,t.lockRef.current))},[]),w=N.useCallback(function(C){g(C.type,us(C),C.target,f(C,t.lockRef.current))},[]);N.useEffect(function(){return ro.push(c),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",p,lo),document.addEventListener("touchmove",p,lo),document.addEventListener("touchstart",x,lo),function(){ro=ro.filter(function(C){return C!==c}),document.removeEventListener("wheel",p,lo),document.removeEventListener("touchmove",p,lo),document.removeEventListener("touchstart",x,lo)}},[]);var y=t.removeScrollBar,S=t.inert;return N.createElement(N.Fragment,null,S?N.createElement(c,{styles:TT(s)}):null,y?N.createElement(yT,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function OT(t){for(var a=null;t!==null;)t instanceof ShadowRoot&&(a=t.host,t=t.host),t=t.parentNode;return a}const kT=rT(gy,RT);var wy=N.forwardRef(function(t,a){return N.createElement(Zs,Rn({},t,{ref:a,sideCar:kT}))});wy.classNames=Zs.classNames;var Fs="Popover",[Sy]=Rl(Fs,[yo]),kl=yo(),[_T,Gi]=Sy(Fs),Ny=t=>{const{__scopePopover:a,children:l,open:o,defaultOpen:s,onOpenChange:c,modal:d=!1}=t,f=kl(a),p=N.useRef(null),[g,x]=N.useState(!1),[v,w]=tf({prop:o,defaultProp:s??!1,onChange:c,caller:Fs});return m.jsx(hf,{...f,children:m.jsx(_T,{scope:a,contentId:Eb(),triggerRef:p,open:v,onOpenChange:w,onOpenToggle:N.useCallback(()=>w(y=>!y),[w]),hasCustomAnchor:g,onCustomAnchorAdd:N.useCallback(()=>x(!0),[]),onCustomAnchorRemove:N.useCallback(()=>x(!1),[]),modal:d,children:l})})};Ny.displayName=Fs;var Cy="PopoverAnchor",DT=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=Gi(Cy,l),c=kl(l),{onCustomAnchorAdd:d,onCustomAnchorRemove:f}=s;return N.useEffect(()=>(d(),()=>f()),[d,f]),m.jsx(Ls,{...c,...o,ref:a})});DT.displayName=Cy;var My="PopoverTrigger",jy=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=Gi(My,l),c=kl(l),d=Tt(a,s.triggerRef),f=m.jsx(St.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ry(s.open),...o,ref:d,onClick:Ye(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?f:m.jsx(Ls,{asChild:!0,...c,children:f})});jy.displayName=My;var zf="PopoverPortal",[$T,LT]=Sy(zf,{forceMount:void 0}),Ey=t=>{const{__scopePopover:a,forceMount:l,children:o,container:s}=t,c=Gi(zf,a);return m.jsx($T,{scope:a,forceMount:l,children:m.jsx(wn,{present:l||c.open,children:m.jsx(Us,{asChild:!0,container:s,children:o})})})};Ey.displayName=zf;var xo="PopoverContent",Ay=N.forwardRef((t,a)=>{const l=LT(xo,t.__scopePopover),{forceMount:o=l.forceMount,...s}=t,c=Gi(xo,t.__scopePopover);return m.jsx(wn,{present:o||c.open,children:c.modal?m.jsx(BT,{...s,ref:a}):m.jsx(HT,{...s,ref:a})})});Ay.displayName=xo;var UT=Kd("PopoverContent.RemoveScroll"),BT=N.forwardRef((t,a)=>{const l=Gi(xo,t.__scopePopover),o=N.useRef(null),s=Tt(a,o),c=N.useRef(!1);return N.useEffect(()=>{const d=o.current;if(d)return WA(d)},[]),m.jsx(wy,{as:UT,allowPinchZoom:!0,children:m.jsx(Ty,{...t,ref:s,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(t.onCloseAutoFocus,d=>{var f;d.preventDefault(),c.current||(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Ye(t.onPointerDownOutside,d=>{const f=d.detail.originalEvent,p=f.button===0&&f.ctrlKey===!0,g=f.button===2||p;c.current=g},{checkForDefaultPrevented:!1}),onFocusOutside:Ye(t.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1})})})}),HT=N.forwardRef((t,a)=>{const l=Gi(xo,t.__scopePopover),o=N.useRef(!1),s=N.useRef(!1);return m.jsx(Ty,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var d,f;(d=t.onCloseAutoFocus)==null||d.call(t,c),c.defaultPrevented||(o.current||(f=l.triggerRef.current)==null||f.focus(),c.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:c=>{var p,g;(p=t.onInteractOutside)==null||p.call(t,c),c.defaultPrevented||(o.current=!0,c.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const d=c.target;((g=l.triggerRef.current)==null?void 0:g.contains(d))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.current&&c.preventDefault()}})}),Ty=N.forwardRef((t,a)=>{const{__scopePopover:l,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:g,onInteractOutside:x,...v}=t,w=Gi(xo,l),y=kl(l);return HA(),m.jsx(dy,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:c,children:m.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:x,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:g,onDismiss:()=>w.onOpenChange(!1),deferPointerDownOutside:!0,children:m.jsx(mf,{"data-state":Ry(w.open),role:"dialog",id:w.contentId,...y,...v,ref:a,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),zy="PopoverClose",YT=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=Gi(zy,l);return m.jsx(St.button,{type:"button",...o,ref:a,onClick:Ye(t.onClick,()=>s.onOpenChange(!1))})});YT.displayName=zy;var IT="PopoverArrow",GT=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=kl(l);return m.jsx(pf,{...s,...o,ref:a})});GT.displayName=IT;function Ry(t){return t?"open":"closed"}var VT=Ny,XT=jy,qT=Ey,PT=Ay;function Oy({...t}){return m.jsx(VT,{"data-slot":"popover",...t})}function ky({...t}){return m.jsx(XT,{"data-slot":"popover-trigger",...t})}function _y({className:t,align:a="start",sideOffset:l=6,...o}){return m.jsx(qT,{"data-slot":"popover-portal",children:m.jsx(PT,{"data-slot":"popover-content",align:a,sideOffset:l,className:Ot("z-50 origin-(--radix-popover-content-transform-origin) rounded-lg bg-popover p-2 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...o})})}function QT({currentModuleId:t,currentModuleName:a}){const{t:l}=gt(),[o,s]=N.useState(!1),{modules:c,selectModule:d,exportedAt:f}=Ze(Pt(g=>{var x,v;return{modules:((x=g.exportData)==null?void 0:x.modules)??[],selectModule:g.selectModule,exportedAt:(v=g.exportData)==null?void 0:v.exportedAt}})),p=g=>f?`${g}?_t=${encodeURIComponent(f)}`:g;return m.jsxs(Oy,{open:o,onOpenChange:s,children:[m.jsx(ky,{asChild:!0,children:m.jsxs("button",{className:"flex min-w-0 max-w-[38vw] items-center gap-1 truncate font-medium transition-colors hover:text-primary sm:max-w-60 lg:max-w-72","aria-label":l("viewer.module.switch"),children:[m.jsx("span",{className:"truncate",children:a}),m.jsx(Gs,{className:"size-3 text-muted-foreground/60 shrink-0"})]})}),m.jsxs(_y,{side:"bottom",align:"start",className:"w-[min(18rem,calc(100vw-24px))] p-1.5",sideOffset:8,children:[m.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-widest text-muted-foreground",children:l(`viewer.module.count.${c.length===1?"one":"other"}`,{count:c.length})}),m.jsx(Tl,{className:"max-h-80 overflow-auto",children:m.jsx("ul",{className:"space-y-0.5",children:c.map(g=>{var w,y;const x=g.moduleId===t,v=m.jsxs("button",{className:`flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-left text-xs hover:bg-secondary/70 transition-colors ${x?"bg-secondary":""}`,onClick:()=>{x||d(g.moduleId),s(!1)},children:[m.jsx("div",{className:"size-9 rounded-md bg-neutral-100 border border-border/60 flex items-center justify-center shrink-0 overflow-hidden",children:(w=g.preview)!=null&&w.url?m.jsx("img",{src:p(g.preview.url),alt:"",className:"max-w-full max-h-full object-contain",draggable:!1}):m.jsxs("span",{className:"text-[9px] text-muted-foreground/40 font-mono",children:[Math.round(g.bbox.width),"×",Math.round(g.bbox.height)]})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"truncate font-medium",children:g.name}),m.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono",children:[Math.round(g.bbox.width)," × ",Math.round(g.bbox.height)]})]}),x&&m.jsx(nM,{className:"size-3.5 text-primary shrink-0"})]});return m.jsx("li",{children:(y=g.preview)!=null&&y.url?m.jsxs(xf,{openDelay:150,closeDelay:0,children:[m.jsx(vf,{asChild:!0,children:v}),m.jsx(bf,{side:"left",align:"start",sideOffset:12,className:"w-auto p-1",children:m.jsx("img",{src:p(g.preview.url),alt:g.name,className:"block max-h-[60vh] max-w-[min(320px,calc(100vw-32px))] rounded object-contain",draggable:!1})})]}):v},g.moduleId)})})})]})]})}const ZT=fj(window.location.search,window.location.hash);function FT(){const{locale:t,t:a}=gt(),{designId:l,displayMode:o,setDisplayMode:s,mod:c,source:d}=Ze(Pt(f=>{var p;return{designId:f.designId,displayMode:f.displayMode,setDisplayMode:f.setDisplayMode,mod:f.getCurrentModule(),source:(p=f.exportData)==null?void 0:p.source}}));return c?ZT?m.jsx(Ox,{children:m.jsx("div",{"data-view":"module","data-mode":o,className:"h-dvh",children:m.jsx(Lx,{screenshotMode:!0})})}):m.jsx(Ox,{children:m.jsxs("div",{id:"module-view","data-view":"module","data-mode":o,className:"h-full flex flex-col overflow-hidden",children:[m.jsxs("header",{id:"module-header",className:"flex min-h-12 shrink-0 flex-wrap items-center justify-between gap-2 border-b bg-white py-2 pl-11 pr-3 sm:pr-4",children:[m.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:m.jsxs("nav",{id:"module-breadcrumb",className:"flex min-w-0 items-center gap-1 text-xs sm:gap-1.5","aria-label":a("viewer.breadcrumb"),children:[d&&m.jsxs("a",{href:Es(l?`/design/${encodeURIComponent(l)}`:"/",t),className:"group flex min-w-0 items-center gap-1 rounded-[4px] text-muted-foreground underline-offset-3 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:[m.jsx(wb,{className:"size-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"max-w-[32vw] truncate text-foreground/80 group-hover:text-foreground sm:max-w-40",children:d.fileName}),m.jsx("span",{className:"hidden max-w-28 truncate text-muted-foreground/60 group-hover:text-muted-foreground md:inline-block lg:max-w-32",children:d.pageName})]}),m.jsx(wo,{className:"size-3 shrink-0 text-muted-foreground/30"}),m.jsx(QT,{currentModuleId:c.moduleId,currentModuleName:c.name})]})}),m.jsxs("div",{id:"module-summary",className:"flex min-w-0 shrink-0 items-center gap-1.5 sm:gap-2",children:[m.jsx(BA,{mod:c}),m.jsxs("div",{id:"mode-switch",className:"flex items-center rounded-md bg-secondary/50 p-0.5",children:[m.jsxs(gn,{variant:o==="visual"?"secondary":"ghost",size:"icon-xs","aria-label":a("viewer.mode.visualAria"),className:"h-6 w-auto gap-1.5 rounded-[4px] px-1.5 text-[11px] sm:px-2",onClick:()=>s("visual"),children:[m.jsx(vb,{className:"size-3"}),m.jsx("span",{children:a("viewer.mode.visual")})]}),m.jsxs(gn,{variant:o==="map"?"secondary":"ghost",size:"icon-xs","aria-label":a("viewer.mode.mapAria"),className:"h-6 w-auto gap-1.5 rounded-[4px] px-1.5 text-[11px] sm:px-2",onClick:()=>s("map"),children:[m.jsx(yb,{className:"size-3"}),m.jsx("span",{children:a("viewer.mode.map")})]})]})]})]}),m.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 overflow-hidden *:min-w-0 xl:grid-cols-[260px_minmax(0,1fr)_300px] [&>*:nth-child(3)]:hidden xl:[&>*:nth-child(3)]:flex",children:[m.jsx(pE,{}),m.jsx(Lx,{}),m.jsx(EA,{})]})]})}):null}function WT(t,a,l){if(t==="/")return null;const o=Nv(t);return o&&a==="module"?{href:Es(`/design/${encodeURIComponent(o)}`,l),labelKey:"navigation.backToDesignOverview"}:{href:Es("/",l),labelKey:"navigation.backToDesignList"}}function KT(){const{locale:t,setLocale:a,t:l}=gt(),[o,s]=N.useState(!1),c=N.useRef(null),d=Ze(p=>p.currentView),f=WT(window.location.pathname,d,t);return m.jsx("div",{className:"fixed left-2 top-0 z-[70] flex h-12 items-center",children:m.jsxs(Oy,{open:o,onOpenChange:s,children:[m.jsx(ky,{asChild:!0,children:m.jsx("button",{ref:c,type:"button","aria-label":l("menu.open"),title:l("menu.open"),className:"flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 data-[state=open]:bg-muted data-[state=open]:text-foreground",children:m.jsx(RM,{className:"size-3.5","aria-hidden":"true"})})}),m.jsx(_y,{side:"bottom",align:"start",sideOffset:10,className:"z-[80] w-44 overflow-visible p-2",onOpenAutoFocus:p=>{var g;p.preventDefault(),(g=c.current)==null||g.focus({preventScroll:!0})},children:m.jsxs("nav",{className:"space-y-1","aria-label":l("menu.open"),children:[f&&m.jsxs("a",{href:f.href,className:"flex h-9 items-center gap-2 rounded-md px-2.5 text-xs text-foreground transition-colors hover:bg-muted",children:[m.jsx(KC,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}),m.jsx("span",{children:l(f.labelKey)})]}),m.jsxs("div",{className:"group/preferences relative",children:[m.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-controls":"app-preferences-panel",className:"flex h-9 w-full items-center gap-2 rounded-md px-2.5 text-left text-xs text-foreground transition-colors group-hover/preferences:bg-muted focus-visible:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:[m.jsx(FM,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}),m.jsx("span",{className:"flex-1",children:l("settings.title")}),m.jsx(wo,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"})]}),m.jsx("section",{id:"app-preferences-panel",role:"dialog",className:"invisible absolute -top-2 left-[calc(100%+0.5rem)] z-10 w-44 rounded-lg bg-popover p-3 text-popover-foreground opacity-0 shadow-md ring-1 ring-foreground/10 transition-opacity before:absolute before:-left-2 before:top-0 before:h-full before:w-2 group-focus-within/preferences:visible group-focus-within/preferences:opacity-100 group-hover/preferences:visible group-hover/preferences:opacity-100 max-[640px]:left-0 max-[640px]:top-[calc(100%+0.5rem)] max-[640px]:w-[min(11rem,calc(100vw-2rem))] max-[640px]:before:-top-2 max-[640px]:before:left-0 max-[640px]:before:h-2 max-[640px]:before:w-full","aria-label":l("settings.title"),children:m.jsxs("label",{className:"block text-xs text-muted-foreground",children:[m.jsx("span",{className:"block",children:l("language.label")}),m.jsxs("select",{className:"mt-1.5 h-8 w-full rounded-md border bg-white px-2 text-xs text-foreground outline-none focus:border-primary/40 focus:ring-2 focus:ring-primary/15","aria-label":l("language.label"),value:t,onChange:p=>a(p.target.value),children:[m.jsx("option",{value:"en",children:l("language.english")}),m.jsx("option",{value:"zh-CN",children:l("language.simplifiedChinese")})]})]})})]})]})})]})})}const JT=2e3,ez=N.lazy(()=>hw(()=>import("./App-su3Zx5n_.js"),__vite__mapDeps([0,1])).then(t=>({default:t.Dashboard})));function tz(){const t=Nv(window.location.pathname),a=Mb(window.location.search),l=window.location.pathname==="/"?m.jsx(N.Suspense,{fallback:m.jsx(nz,{}),children:m.jsx(ez,{})}):m.jsx(iz,{routeDesignId:t});return a?m.jsx("div",{className:"h-dvh overflow-hidden",children:l}):m.jsxs("div",{className:"h-dvh overflow-hidden",children:[m.jsx("div",{className:"h-full",children:l}),m.jsx(KT,{})]})}function nz(){const{t}=gt();return m.jsx("div",{className:"flex h-full items-center justify-center bg-[#fafafa] text-sm text-[#999]",children:t("viewer.loadingDashboard")})}function iz({routeDesignId:t}){const{locale:a,t:l}=gt(),{exportData:o,currentView:s,designId:c,initDesignId:d,setExportData:f,syncFromHash:p}=Ze(Pt(z=>({exportData:z.exportData,currentView:z.currentView,designId:z.designId,initDesignId:z.initDesignId,setExportData:z.setExportData,syncFromHash:z.syncFromHash}))),[g,x]=N.useState(null),[v,w]=N.useState(!1),y=N.useRef(null),S=N.useRef(0),C=N.useRef(a),j=N.useRef(a);C.current=a,N.useEffect(()=>{t&&d(t)},[d,t]);const A=N.useCallback(async z=>{if(!c)return!1;const R=++S.current;try{const{data:E,revision:T}=await JE(c,z);return await ry(E),z!=null&&z.aborted||R!==S.current||(_d(E,C.current),z!=null&&z.aborted||R!==S.current)?!1:(f(E),y.current=T,x(null),w(!1),document.documentElement.setAttribute("data-loaded","true"),!0)}catch(E){return z!=null&&z.aborted||R!==S.current||x(E instanceof wt&&E.domainCode==="DESIGN_NOT_FOUND"?"design-deleted":"load-failed"),!1}},[c,f]);N.useEffect(()=>{if(!c)return;const z=new AbortController;return document.documentElement.removeAttribute("data-loaded"),y.current=null,A(z.signal),()=>z.abort()},[c,A]),N.useEffect(()=>{if(j.current===a)return;j.current=a;const z=Ze.getState().exportData;if(z)try{const R=structuredClone(z);if(_d(R,a),C.current!==a||Ze.getState().exportData!==z)return;f(R),w(!1)}catch{C.current===a&&w(!0)}},[a,f]);const _=N.useRef(A);return N.useEffect(()=>{_.current=A}),N.useEffect(()=>{if(!c)return;let z=!1;const R=async()=>{if(!z){z=!0;try{const T=await tA(c),D=y.current;(D===null||T!==D)&&await _.current()}catch(T){T instanceof wt&&T.domainCode==="DESIGN_NOT_FOUND"&&(f(null),x("design-deleted"),document.documentElement.removeAttribute("data-loaded"))}finally{z=!1}}},E=window.setInterval(()=>void R(),JT);return()=>window.clearInterval(E)},[c,f]),N.useEffect(()=>{const z=()=>p();return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[p]),c?!o&&g?m.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 px-6 text-center","data-view":"empty",children:[m.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:l("app.name")}),m.jsx("p",{className:"text-sm text-destructive",children:l(g==="design-deleted"?"viewer.designDeleted":"viewer.loadDesignFailed")}),m.jsx("button",{type:"button",className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted",onClick:()=>void A(),children:l("common.retry")})]}):o?m.jsxs(m.Fragment,{children:[s==="module"?m.jsx(FT,{}):m.jsx(xj,{}),v&&m.jsx("div",{role:"alert",className:"fixed bottom-3 right-3 z-[60] max-w-xs rounded-md border border-destructive/20 bg-white px-3 py-2 text-xs text-destructive shadow-md",children:l("viewer.localizeFailed")})]}):m.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center gap-4","data-view":"empty",children:[m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center",children:m.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4 text-primary",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),m.jsx("path",{d:"M2 17l10 5 10-5"}),m.jsx("path",{d:"M2 12l10 5 10-5"})]})}),m.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:l("app.name")})]}),m.jsx("p",{className:"text-sm text-muted-foreground",children:l("viewer.loadingDesign")})]}):m.jsx("div",{className:"relative flex h-full flex-col items-center justify-center gap-4","data-view":"empty",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:l("viewer.invalidDesignUrl")})})}uw.createRoot(document.getElementById("app")).render(m.jsx(N.StrictMode,{children:m.jsx(pj,{children:m.jsx(tz,{})})}));export{wo as C,Cb as D,pM as E,UM as P,IC as R,QM as S,GC as T,ij as X,Mv as a,Ot as b,_e as c,rz as d,so as e,VC as f,oz as g,XC as h,Gs as i,m as j,nM as k,lz as l,wb as m,N as r,zx as t,gt as u,Es as w};
|
|
352
|
+
`)},zT=0,ro=[];function RT(t){var a=N.useRef([]),l=N.useRef([0,0]),o=N.useRef(),s=N.useState(zT++)[0],c=N.useState(xy)[0],d=N.useRef(t);N.useEffect(function(){d.current=t},[t]),N.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var C=KA([t.lockRef.current],(t.shards||[]).map(tv),!0).filter(Boolean);return C.forEach(function(j){return j.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),C.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var f=N.useCallback(function(C,j){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!d.current.allowPinchZoom;var A=us(C),_=l.current,z="deltaX"in C?C.deltaX:_[0]-A[0],R="deltaY"in C?C.deltaY:_[1]-A[1],E,T=C.target,D=Math.abs(z)>Math.abs(R)?"h":"v";if("touches"in C&&D==="h"&&T.type==="range")return!1;var k=window.getSelection(),V=k&&k.anchorNode,te=V?V===T||V.contains(T):!1;if(te)return!1;var J=Jx(D,T);if(!J)return!0;if(J?E=D:(E=D==="v"?"h":"v",J=Jx(D,T)),!J)return!1;if(!o.current&&"changedTouches"in C&&(z||R)&&(o.current=E),!E)return!0;var q=o.current||E;return ET(q,j,C,q==="h"?z:R)},[]),p=N.useCallback(function(C){var j=C;if(!(!ro.length||ro[ro.length-1]!==c)){var A="deltaY"in j?ev(j):us(j),_=a.current.filter(function(E){return E.name===j.type&&(E.target===j.target||j.target===E.shadowParent)&&AT(E.delta,A)})[0];if(_&&_.should){j.cancelable&&j.preventDefault();return}if(!_){var z=(d.current.shards||[]).map(tv).filter(Boolean).filter(function(E){return E.contains(j.target)}),R=z.length>0?f(j,z[0]):!d.current.noIsolation;R&&j.cancelable&&j.preventDefault()}}},[]),g=N.useCallback(function(C,j,A,_){var z={name:C,delta:j,target:A,should:_,shadowParent:OT(A)};a.current.push(z),setTimeout(function(){a.current=a.current.filter(function(R){return R!==z})},1)},[]),x=N.useCallback(function(C){l.current=us(C),o.current=void 0},[]),v=N.useCallback(function(C){g(C.type,ev(C),C.target,f(C,t.lockRef.current))},[]),w=N.useCallback(function(C){g(C.type,us(C),C.target,f(C,t.lockRef.current))},[]);N.useEffect(function(){return ro.push(c),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",p,lo),document.addEventListener("touchmove",p,lo),document.addEventListener("touchstart",x,lo),function(){ro=ro.filter(function(C){return C!==c}),document.removeEventListener("wheel",p,lo),document.removeEventListener("touchmove",p,lo),document.removeEventListener("touchstart",x,lo)}},[]);var y=t.removeScrollBar,S=t.inert;return N.createElement(N.Fragment,null,S?N.createElement(c,{styles:TT(s)}):null,y?N.createElement(yT,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function OT(t){for(var a=null;t!==null;)t instanceof ShadowRoot&&(a=t.host,t=t.host),t=t.parentNode;return a}const kT=rT(gy,RT);var wy=N.forwardRef(function(t,a){return N.createElement(Zs,Rn({},t,{ref:a,sideCar:kT}))});wy.classNames=Zs.classNames;var Fs="Popover",[Sy]=Rl(Fs,[yo]),kl=yo(),[_T,Gi]=Sy(Fs),Ny=t=>{const{__scopePopover:a,children:l,open:o,defaultOpen:s,onOpenChange:c,modal:d=!1}=t,f=kl(a),p=N.useRef(null),[g,x]=N.useState(!1),[v,w]=tf({prop:o,defaultProp:s??!1,onChange:c,caller:Fs});return m.jsx(hf,{...f,children:m.jsx(_T,{scope:a,contentId:Eb(),triggerRef:p,open:v,onOpenChange:w,onOpenToggle:N.useCallback(()=>w(y=>!y),[w]),hasCustomAnchor:g,onCustomAnchorAdd:N.useCallback(()=>x(!0),[]),onCustomAnchorRemove:N.useCallback(()=>x(!1),[]),modal:d,children:l})})};Ny.displayName=Fs;var Cy="PopoverAnchor",DT=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=Gi(Cy,l),c=kl(l),{onCustomAnchorAdd:d,onCustomAnchorRemove:f}=s;return N.useEffect(()=>(d(),()=>f()),[d,f]),m.jsx(Ls,{...c,...o,ref:a})});DT.displayName=Cy;var My="PopoverTrigger",jy=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=Gi(My,l),c=kl(l),d=Tt(a,s.triggerRef),f=m.jsx(St.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ry(s.open),...o,ref:d,onClick:Ye(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?f:m.jsx(Ls,{asChild:!0,...c,children:f})});jy.displayName=My;var zf="PopoverPortal",[$T,LT]=Sy(zf,{forceMount:void 0}),Ey=t=>{const{__scopePopover:a,forceMount:l,children:o,container:s}=t,c=Gi(zf,a);return m.jsx($T,{scope:a,forceMount:l,children:m.jsx(wn,{present:l||c.open,children:m.jsx(Us,{asChild:!0,container:s,children:o})})})};Ey.displayName=zf;var xo="PopoverContent",Ay=N.forwardRef((t,a)=>{const l=LT(xo,t.__scopePopover),{forceMount:o=l.forceMount,...s}=t,c=Gi(xo,t.__scopePopover);return m.jsx(wn,{present:o||c.open,children:c.modal?m.jsx(BT,{...s,ref:a}):m.jsx(HT,{...s,ref:a})})});Ay.displayName=xo;var UT=Kd("PopoverContent.RemoveScroll"),BT=N.forwardRef((t,a)=>{const l=Gi(xo,t.__scopePopover),o=N.useRef(null),s=Tt(a,o),c=N.useRef(!1);return N.useEffect(()=>{const d=o.current;if(d)return WA(d)},[]),m.jsx(wy,{as:UT,allowPinchZoom:!0,children:m.jsx(Ty,{...t,ref:s,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(t.onCloseAutoFocus,d=>{var f;d.preventDefault(),c.current||(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Ye(t.onPointerDownOutside,d=>{const f=d.detail.originalEvent,p=f.button===0&&f.ctrlKey===!0,g=f.button===2||p;c.current=g},{checkForDefaultPrevented:!1}),onFocusOutside:Ye(t.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1})})})}),HT=N.forwardRef((t,a)=>{const l=Gi(xo,t.__scopePopover),o=N.useRef(!1),s=N.useRef(!1);return m.jsx(Ty,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var d,f;(d=t.onCloseAutoFocus)==null||d.call(t,c),c.defaultPrevented||(o.current||(f=l.triggerRef.current)==null||f.focus(),c.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:c=>{var p,g;(p=t.onInteractOutside)==null||p.call(t,c),c.defaultPrevented||(o.current=!0,c.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const d=c.target;((g=l.triggerRef.current)==null?void 0:g.contains(d))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.current&&c.preventDefault()}})}),Ty=N.forwardRef((t,a)=>{const{__scopePopover:l,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:g,onInteractOutside:x,...v}=t,w=Gi(xo,l),y=kl(l);return HA(),m.jsx(dy,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:c,children:m.jsx(Bs,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:x,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:g,onDismiss:()=>w.onOpenChange(!1),deferPointerDownOutside:!0,children:m.jsx(mf,{"data-state":Ry(w.open),role:"dialog",id:w.contentId,...y,...v,ref:a,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),zy="PopoverClose",YT=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=Gi(zy,l);return m.jsx(St.button,{type:"button",...o,ref:a,onClick:Ye(t.onClick,()=>s.onOpenChange(!1))})});YT.displayName=zy;var IT="PopoverArrow",GT=N.forwardRef((t,a)=>{const{__scopePopover:l,...o}=t,s=kl(l);return m.jsx(pf,{...s,...o,ref:a})});GT.displayName=IT;function Ry(t){return t?"open":"closed"}var VT=Ny,XT=jy,qT=Ey,PT=Ay;function Oy({...t}){return m.jsx(VT,{"data-slot":"popover",...t})}function ky({...t}){return m.jsx(XT,{"data-slot":"popover-trigger",...t})}function _y({className:t,align:a="start",sideOffset:l=6,...o}){return m.jsx(qT,{"data-slot":"popover-portal",children:m.jsx(PT,{"data-slot":"popover-content",align:a,sideOffset:l,className:Ot("z-50 origin-(--radix-popover-content-transform-origin) rounded-lg bg-popover p-2 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...o})})}function QT({currentModuleId:t,currentModuleName:a}){const{t:l}=gt(),[o,s]=N.useState(!1),{modules:c,selectModule:d,exportedAt:f}=Ze(Pt(g=>{var x,v;return{modules:((x=g.exportData)==null?void 0:x.modules)??[],selectModule:g.selectModule,exportedAt:(v=g.exportData)==null?void 0:v.exportedAt}})),p=g=>f?`${g}?_t=${encodeURIComponent(f)}`:g;return m.jsxs(Oy,{open:o,onOpenChange:s,children:[m.jsx(ky,{asChild:!0,children:m.jsxs("button",{className:"flex min-w-0 max-w-[38vw] items-center gap-1 truncate font-medium transition-colors hover:text-primary sm:max-w-60 lg:max-w-72","aria-label":l("viewer.module.switch"),children:[m.jsx("span",{className:"truncate",children:a}),m.jsx(Gs,{className:"size-3 text-muted-foreground/60 shrink-0"})]})}),m.jsxs(_y,{side:"bottom",align:"start",className:"w-[min(18rem,calc(100vw-24px))] p-1.5",sideOffset:8,children:[m.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-widest text-muted-foreground",children:l(`viewer.module.count.${c.length===1?"one":"other"}`,{count:c.length})}),m.jsx(Tl,{className:"max-h-80 overflow-auto",children:m.jsx("ul",{className:"space-y-0.5",children:c.map(g=>{var w,y;const x=g.moduleId===t,v=m.jsxs("button",{className:`flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-left text-xs hover:bg-secondary/70 transition-colors ${x?"bg-secondary":""}`,onClick:()=>{x||d(g.moduleId),s(!1)},children:[m.jsx("div",{className:"size-9 rounded-md bg-neutral-100 border border-border/60 flex items-center justify-center shrink-0 overflow-hidden",children:(w=g.preview)!=null&&w.url?m.jsx("img",{src:p(g.preview.url),alt:"",className:"max-w-full max-h-full object-contain",draggable:!1}):m.jsxs("span",{className:"text-[9px] text-muted-foreground/40 font-mono",children:[Math.round(g.bbox.width),"×",Math.round(g.bbox.height)]})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"truncate font-medium",children:g.name}),m.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono",children:[Math.round(g.bbox.width)," × ",Math.round(g.bbox.height)]})]}),x&&m.jsx(nM,{className:"size-3.5 text-primary shrink-0"})]});return m.jsx("li",{children:(y=g.preview)!=null&&y.url?m.jsxs(xf,{openDelay:150,closeDelay:0,children:[m.jsx(vf,{asChild:!0,children:v}),m.jsx(bf,{side:"left",align:"start",sideOffset:12,className:"w-auto p-1",children:m.jsx("img",{src:p(g.preview.url),alt:g.name,className:"block max-h-[60vh] max-w-[min(320px,calc(100vw-32px))] rounded object-contain",draggable:!1})})]}):v},g.moduleId)})})})]})]})}const ZT=fj(window.location.search,window.location.hash);function FT(){const{locale:t,t:a}=gt(),{designId:l,displayMode:o,setDisplayMode:s,mod:c,source:d}=Ze(Pt(f=>{var p;return{designId:f.designId,displayMode:f.displayMode,setDisplayMode:f.setDisplayMode,mod:f.getCurrentModule(),source:(p=f.exportData)==null?void 0:p.source}}));return c?ZT?m.jsx(Ox,{children:m.jsx("div",{"data-view":"module","data-mode":o,className:"h-dvh",children:m.jsx(Lx,{screenshotMode:!0})})}):m.jsx(Ox,{children:m.jsxs("div",{id:"module-view","data-view":"module","data-mode":o,className:"h-full flex flex-col overflow-hidden",children:[m.jsxs("header",{id:"module-header",className:"flex min-h-12 shrink-0 flex-wrap items-center justify-between gap-2 border-b bg-white py-2 pl-11 pr-3 sm:pr-4",children:[m.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:m.jsxs("nav",{id:"module-breadcrumb",className:"flex min-w-0 items-center gap-1 text-xs sm:gap-1.5","aria-label":a("viewer.breadcrumb"),children:[d&&m.jsxs("a",{href:Es(l?`/design/${encodeURIComponent(l)}`:"/",t),className:"group flex min-w-0 items-center gap-1 rounded-[4px] text-muted-foreground underline-offset-3 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:[m.jsx(wb,{className:"size-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"max-w-[32vw] truncate text-foreground/80 group-hover:text-foreground sm:max-w-40",children:d.fileName}),m.jsx("span",{className:"hidden max-w-28 truncate text-muted-foreground/60 group-hover:text-muted-foreground md:inline-block lg:max-w-32",children:d.pageName})]}),m.jsx(wo,{className:"size-3 shrink-0 text-muted-foreground/30"}),m.jsx(QT,{currentModuleId:c.moduleId,currentModuleName:c.name})]})}),m.jsxs("div",{id:"module-summary",className:"flex min-w-0 shrink-0 items-center gap-1.5 sm:gap-2",children:[m.jsx(BA,{mod:c}),m.jsxs("div",{id:"mode-switch",className:"flex items-center rounded-md bg-secondary/50 p-0.5",children:[m.jsxs(gn,{variant:o==="visual"?"secondary":"ghost",size:"icon-xs","aria-label":a("viewer.mode.visualAria"),className:"h-6 w-auto gap-1.5 rounded-[4px] px-1.5 text-[11px] sm:px-2",onClick:()=>s("visual"),children:[m.jsx(vb,{className:"size-3"}),m.jsx("span",{children:a("viewer.mode.visual")})]}),m.jsxs(gn,{variant:o==="map"?"secondary":"ghost",size:"icon-xs","aria-label":a("viewer.mode.mapAria"),className:"h-6 w-auto gap-1.5 rounded-[4px] px-1.5 text-[11px] sm:px-2",onClick:()=>s("map"),children:[m.jsx(yb,{className:"size-3"}),m.jsx("span",{children:a("viewer.mode.map")})]})]})]})]}),m.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 overflow-hidden *:min-w-0 xl:grid-cols-[260px_minmax(0,1fr)_300px] [&>*:nth-child(3)]:hidden xl:[&>*:nth-child(3)]:flex",children:[m.jsx(pE,{}),m.jsx(Lx,{}),m.jsx(EA,{})]})]})}):null}function WT(t,a,l){if(t==="/")return null;const o=Nv(t);return o&&a==="module"?{href:Es(`/design/${encodeURIComponent(o)}`,l),labelKey:"navigation.backToDesignOverview"}:{href:Es("/",l),labelKey:"navigation.backToDesignList"}}function KT(){const{locale:t,setLocale:a,t:l}=gt(),[o,s]=N.useState(!1),c=N.useRef(null),d=Ze(p=>p.currentView),f=WT(window.location.pathname,d,t);return m.jsx("div",{className:"fixed left-2 top-0 z-[70] flex h-12 items-center",children:m.jsxs(Oy,{open:o,onOpenChange:s,children:[m.jsx(ky,{asChild:!0,children:m.jsx("button",{ref:c,type:"button","aria-label":l("menu.open"),title:l("menu.open"),className:"flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 data-[state=open]:bg-muted data-[state=open]:text-foreground",children:m.jsx(RM,{className:"size-3.5","aria-hidden":"true"})})}),m.jsx(_y,{side:"bottom",align:"start",sideOffset:10,className:"z-[80] w-44 overflow-visible p-2",onOpenAutoFocus:p=>{var g;p.preventDefault(),(g=c.current)==null||g.focus({preventScroll:!0})},children:m.jsxs("nav",{className:"space-y-1","aria-label":l("menu.open"),children:[f&&m.jsxs("a",{href:f.href,className:"flex h-9 items-center gap-2 rounded-md px-2.5 text-xs text-foreground transition-colors hover:bg-muted",children:[m.jsx(KC,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}),m.jsx("span",{children:l(f.labelKey)})]}),m.jsxs("div",{className:"group/preferences relative",children:[m.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-controls":"app-preferences-panel",className:"flex h-9 w-full items-center gap-2 rounded-md px-2.5 text-left text-xs text-foreground transition-colors group-hover/preferences:bg-muted focus-visible:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:[m.jsx(FM,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"}),m.jsx("span",{className:"flex-1",children:l("settings.title")}),m.jsx(wo,{className:"size-3.5 text-muted-foreground","aria-hidden":"true"})]}),m.jsx("section",{id:"app-preferences-panel",role:"dialog",className:"invisible absolute -top-2 left-[calc(100%+0.5rem)] z-10 w-44 rounded-lg bg-popover p-3 text-popover-foreground opacity-0 shadow-md ring-1 ring-foreground/10 transition-opacity before:absolute before:-left-2 before:top-0 before:h-full before:w-2 group-focus-within/preferences:visible group-focus-within/preferences:opacity-100 group-hover/preferences:visible group-hover/preferences:opacity-100 max-[640px]:left-0 max-[640px]:top-[calc(100%+0.5rem)] max-[640px]:w-[min(11rem,calc(100vw-2rem))] max-[640px]:before:-top-2 max-[640px]:before:left-0 max-[640px]:before:h-2 max-[640px]:before:w-full","aria-label":l("settings.title"),children:m.jsxs("label",{className:"block text-xs text-muted-foreground",children:[m.jsx("span",{className:"block",children:l("language.label")}),m.jsxs("select",{className:"mt-1.5 h-8 w-full rounded-md border bg-white px-2 text-xs text-foreground outline-none focus:border-primary/40 focus:ring-2 focus:ring-primary/15","aria-label":l("language.label"),value:t,onChange:p=>a(p.target.value),children:[m.jsx("option",{value:"en",children:l("language.english")}),m.jsx("option",{value:"zh-CN",children:l("language.simplifiedChinese")})]})]})})]})]})})]})})}const JT=2e3,ez=N.lazy(()=>hw(()=>import("./App-BkF1Yv4U.js"),__vite__mapDeps([0,1])).then(t=>({default:t.Dashboard})));function tz(){const t=Nv(window.location.pathname),a=Mb(window.location.search),l=window.location.pathname==="/"?m.jsx(N.Suspense,{fallback:m.jsx(nz,{}),children:m.jsx(ez,{})}):m.jsx(iz,{routeDesignId:t});return a?m.jsx("div",{className:"h-dvh overflow-hidden",children:l}):m.jsxs("div",{className:"h-dvh overflow-hidden",children:[m.jsx("div",{className:"h-full",children:l}),m.jsx(KT,{})]})}function nz(){const{t}=gt();return m.jsx("div",{className:"flex h-full items-center justify-center bg-[#fafafa] text-sm text-[#999]",children:t("viewer.loadingDashboard")})}function iz({routeDesignId:t}){const{locale:a,t:l}=gt(),{exportData:o,currentView:s,designId:c,initDesignId:d,setExportData:f,syncFromHash:p}=Ze(Pt(z=>({exportData:z.exportData,currentView:z.currentView,designId:z.designId,initDesignId:z.initDesignId,setExportData:z.setExportData,syncFromHash:z.syncFromHash}))),[g,x]=N.useState(null),[v,w]=N.useState(!1),y=N.useRef(null),S=N.useRef(0),C=N.useRef(a),j=N.useRef(a);C.current=a,N.useEffect(()=>{t&&d(t)},[d,t]);const A=N.useCallback(async z=>{if(!c)return!1;const R=++S.current;try{const{data:E,revision:T}=await JE(c,z);return await ry(E),z!=null&&z.aborted||R!==S.current||(_d(E,C.current),z!=null&&z.aborted||R!==S.current)?!1:(f(E),y.current=T,x(null),w(!1),document.documentElement.setAttribute("data-loaded","true"),!0)}catch(E){return z!=null&&z.aborted||R!==S.current||x(E instanceof wt&&E.domainCode==="DESIGN_NOT_FOUND"?"design-deleted":"load-failed"),!1}},[c,f]);N.useEffect(()=>{if(!c)return;const z=new AbortController;return document.documentElement.removeAttribute("data-loaded"),y.current=null,A(z.signal),()=>z.abort()},[c,A]),N.useEffect(()=>{if(j.current===a)return;j.current=a;const z=Ze.getState().exportData;if(z)try{const R=structuredClone(z);if(_d(R,a),C.current!==a||Ze.getState().exportData!==z)return;f(R),w(!1)}catch{C.current===a&&w(!0)}},[a,f]);const _=N.useRef(A);return N.useEffect(()=>{_.current=A}),N.useEffect(()=>{if(!c)return;let z=!1;const R=async()=>{if(!z){z=!0;try{const T=await tA(c),D=y.current;(D===null||T!==D)&&await _.current()}catch(T){T instanceof wt&&T.domainCode==="DESIGN_NOT_FOUND"&&(f(null),x("design-deleted"),document.documentElement.removeAttribute("data-loaded"))}finally{z=!1}}},E=window.setInterval(()=>void R(),JT);return()=>window.clearInterval(E)},[c,f]),N.useEffect(()=>{const z=()=>p();return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[p]),c?!o&&g?m.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 px-6 text-center","data-view":"empty",children:[m.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:l("app.name")}),m.jsx("p",{className:"text-sm text-destructive",children:l(g==="design-deleted"?"viewer.designDeleted":"viewer.loadDesignFailed")}),m.jsx("button",{type:"button",className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted",onClick:()=>void A(),children:l("common.retry")})]}):o?m.jsxs(m.Fragment,{children:[s==="module"?m.jsx(FT,{}):m.jsx(xj,{}),v&&m.jsx("div",{role:"alert",className:"fixed bottom-3 right-3 z-[60] max-w-xs rounded-md border border-destructive/20 bg-white px-3 py-2 text-xs text-destructive shadow-md",children:l("viewer.localizeFailed")})]}):m.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center gap-4","data-view":"empty",children:[m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center",children:m.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4 text-primary",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),m.jsx("path",{d:"M2 17l10 5 10-5"}),m.jsx("path",{d:"M2 12l10 5 10-5"})]})}),m.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:l("app.name")})]}),m.jsx("p",{className:"text-sm text-muted-foreground",children:l("viewer.loadingDesign")})]}):m.jsx("div",{className:"relative flex h-full flex-col items-center justify-center gap-4","data-view":"empty",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:l("viewer.invalidDesignUrl")})})}uw.createRoot(document.getElementById("app")).render(m.jsx(N.StrictMode,{children:m.jsx(pj,{children:m.jsx(tz,{})})}));export{wo as C,Cb as D,pM as E,UM as P,IC as R,QM as S,GC as T,ij as X,Mv as a,Ot as b,_e as c,rz as d,so as e,VC as f,oz as g,XC as h,Gs as i,m as j,nM as k,lz as l,wb as m,N as r,zx as t,gt as u,Es as w};
|