xiaodao-spreader 0.1.20 → 0.1.21

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,9 +1,9 @@
1
- (function(Mt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Mt=typeof globalThis<"u"?globalThis:Mt||self,t(Mt.XiaoDaoSpreader={},Mt.Vue))})(this,function(Mt,t){"use strict";const mo={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",sheetList:"工作表列表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatGeneral:"常规",nfCatNumber:"数值",nfCatCurrency:"货币",nfCatAccounting:"会计专用",nfCatFinancial:"财务",nfCatPercent:"百分比",nfCatScientific:"科学计数",nfCatDate:"日期",nfCatTime:"时间",nfCatText:"文本",nfCatCurrencyRounded:"货币取整",nfCatDateTime:"日期和时间",nfCatDuration:"持续时间",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",sheetList:"Sheet list",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",avg:"Average",count:"Count",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatGeneral:"General",nfCatNumber:"Number",nfCatCurrency:"Currency",nfCatAccounting:"Accounting",nfCatFinancial:"Financial",nfCatPercent:"Percentage",nfCatScientific:"Scientific",nfCatDate:"Date",nfCatTime:"Time",nfCatText:"Text",nfCatCurrencyRounded:"Currency Rounded",nfCatDateTime:"Date & Time",nfCatDuration:"Duration",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close"}};function N(e,n){var o;return((o=mo[e])==null?void 0:o[n])??n}const el='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',St=10,po=[{label:"",value:""},{label:"微软雅黑",value:'"Microsoft YaHei", "微软雅黑", sans-serif'},{label:"宋体",value:'"SimSun", "宋体", serif'},{label:"黑体",value:'"SimHei", "黑体", sans-serif'},{label:"楷体",value:'"KaiTi", "楷体", serif'},{label:"Arial",value:"Arial, sans-serif"},{label:"Arial Black",value:'"Arial Black", sans-serif'},{label:"Times New Roman",value:'"Times New Roman", serif'},{label:"Courier New",value:'"Courier New", monospace'},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Impact",value:"Impact, sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Trebuchet MS",value:'"Trebuchet MS", sans-serif'},{label:"Comic Sans MS",value:'"Comic Sans MS", cursive'}],ho=[{label:"9",value:9},{label:"10",value:10},{label:"11",value:11},{label:"12",value:12},{label:"13",value:13},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"20",value:20},{label:"24",value:24},{label:"28",value:28},{label:"32",value:32},{label:"36",value:36},{label:"48",value:48},{label:"72",value:72}],go='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="19" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="17" y2="18"/></svg>',bo='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>',yo='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="5" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="7" y1="18" x2="21" y2="18"/></svg>',vo='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="7" x2="6" y2="20"/><line x1="12" y1="7" x2="12" y2="16"/><line x1="18" y1="7" x2="18" y2="20"/><line x1="4" y1="3" x2="20" y2="3"/></svg>',Co='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="20"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="18" y1="4" x2="18" y2="20"/></svg>',wo='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="17"/><line x1="12" y1="8" x2="12" y2="17"/><line x1="18" y1="4" x2="18" y2="17"/><line x1="4" y1="21" x2="20" y2="21"/></svg>',ko=[{value:"left",labelKey:"alignLeft",icon:go},{value:"center",labelKey:"alignCenter",icon:bo},{value:"right",labelKey:"alignRight",icon:yo}],Eo=[{value:"top",labelKey:"alignTop",icon:vo},{value:"middle",labelKey:"alignMiddle",icon:Co},{value:"bottom",labelKey:"alignBottom",icon:wo}],Fl=[{key:"mergeCenter",labelKey:"mergeCenter",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"/></svg>'},{key:"mergeAcross",labelKey:"mergeAcross",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M832 64c70.4 0 128 57.6 128 128v640c0 70.4-57.6 128-128 128H192c-70.4 0-128-57.6-128-128V192c0-70.4 57.6-128 128-128h640zM448 768H128v64c0 38.4 25.6 64 64 64h256v-128z m448 0H512v128h320c38.4 0 64-25.6 64-64v-64z m0-448H128v384h768V320zM633.6 390.4l96 96c6.4 6.4 6.4 12.8 6.4 19.2 0 6.4-6.4 12.8-6.4 19.2L633.6 633.6c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32-6.4-44.8l44.8-44.8H288c-19.2 0-32-12.8-32-32s12.8-32 32-32h339.2l-44.8-44.8c-6.4-12.8-6.4-32 0-44.8 12.8-12.8 38.4-12.8 51.2 0zM448 128H192c-38.4 0-64 25.6-64 64v64h320V128z m384 0H512v128h384V192c0-38.4-25.6-64-64-64z"/></svg>'},{key:"mergeCells",labelKey:"mergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M512 480c0 5.376-1.984 10.112-5.952 14.08L354.048 634.048C350.08 638.08 345.344 640 339.968 640s-10.048-1.92-14.08-5.952C321.92 630.144 320 625.344 320 620.032L320 512 224 512C206.336 512 192 497.664 192 480S206.336 448 224 448L320 448 320 339.968c0-5.376 1.92-10.048 5.952-14.08C329.92 321.984 334.656 320 339.968 320s10.048 1.984 14.08 5.952L506.048 465.92C510.016 469.952 512 474.624 512 480zM576 480c0 5.376 1.984 10.112 5.952 14.08l152 140.032C737.92 638.08 742.656 640 748.032 640s10.048-1.92 14.08-5.952C766.08 630.144 768 625.344 768 620.032L768 512l96 0C881.664 512 896 497.664 896 480S881.664 448 864 448L768 448 768 339.968c0-5.376-1.92-10.048-5.952-14.08C758.08 321.984 753.344 320 748.032 320s-10.048 1.984-14.08 5.952L581.952 465.92C577.984 469.952 576 474.624 576 480zM448 128l0 128 64 0L512 128c0-35.392-28.672-64-64-64l0 0L128 64C92.672 64 64 92.608 64 128l0 704c0 35.392 28.672 64 64 64l320 0c35.328 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'},{key:"unmergeCells",labelKey:"unmergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M197.952 465.92l152-140.032C353.92 321.984 358.656 320 364.032 320s10.048 1.984 14.08 5.952C382.08 329.92 384 334.656 384 339.968L384 448l96 0C497.664 448 512 462.336 512 480S497.664 512 480 512L384 512l0 108.032c0 5.376-1.92 10.112-5.952 14.08C374.08 638.08 369.344 640 364.032 640S353.92 638.08 349.952 634.048L197.952 494.08C193.984 490.112 192 485.376 192 480S193.984 469.952 197.952 465.92zM890.048 465.92l-152-140.032C734.08 321.984 729.344 320 723.968 320s-10.048 1.984-14.08 5.952C705.92 329.92 704 334.656 704 339.968L704 448 608 448C590.336 448 576 462.336 576 480S590.336 512 608 512L704 512l0 108.032c0 5.376 1.92 10.112 5.952 14.08C713.92 638.08 718.656 640 723.968 640s10.048-1.92 14.08-5.952l152-140.032C894.016 490.112 896 485.376 896 480S894.016 469.952 890.048 465.92zM448 128l0 128 64 0L512 128c0-35.392-28.608-64-64-64l0 0L128 64C92.608 64 64 92.608 64 128l0 704c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'}],So={bg:"#f4f4f4",gridBg:"#ffffff",headerBg:"#e8e8e8",headerBorder:"#c8c8c8",headerText:"#444",headerSep:"#b0b0b0",cornerBg:"#e0e0e0",gridLine:"#e0e0e0",selectionBg:"rgba(0, 120, 215, 0.12)",activeCellBorder:"#0078d7",cellText:"#1a1a1a",scrollTrack:"rgba(0,0,0,0.08)",scrollThumb:"rgba(0,0,0,0.25)",formulaBarBg:"#f0f0f0",formulaBarBorder:"#c8c8c8",formulaBarLabelText:"#333",formulaBarLabelBg:"#fff",formulaBarLabelBorder:"#c0c0c0",formulaBarInputBg:"#fff",formulaBarInputBorder:"#c0c0c0",formulaBarInputText:"#1a1a1a",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.3)",wrapperBg:"#e8e8e8",cellEditorBorder:"#0078d7",cellEditorText:"#1a1a1a",cellEditorBg:"#fff",cellEditorShadow:"#0078d7",tabBarBg:"#e8e8e8",tabBarBorder:"#c0c0c0",tabActiveBg:"#ffffff",tabActiveText:"#1a1a1a",tabActiveBorder:"#0078d7",tabInactiveBg:"#dfdfdf",tabInactiveText:"#666",tabInactiveBorder:"transparent",tabHoverBg:"#e0e0e0",tabAddBtnColor:"#555",tabAddBtnHoverBg:"#d0d0d0",tabScrollBtnColor:"#888",tabScrollBtnHoverBg:"#d0d0d0",scrollbarThumb:"rgba(0,0,0,0.25)",scrollbarThumbHover:"rgba(0,0,0,0.4)",scrollBtnBg:"#e8e8e8",scrollBtnColor:"#666",scrollBtnHoverBg:"#d0d0d0",scrollBtnActiveBg:"#c0c0c0",scrollTrackBg:"rgba(0,0,0,0.06)",toolbarBg:"#f7f7f7",toolbarBorder:"#d8d8d8",toolbarBtnColor:"#444",toolbarBtnHoverBg:"#e6e6e6",toolbarBtnDisabledColor:"#b0b0b0",toolbarBtnActiveColor:"#0078d7",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},Bo={bg:"#1e1e1e",gridBg:"#252526",headerBg:"#252525",headerBorder:"#3e3e3e",headerText:"#999",headerSep:"#3e3e3e",cornerBg:"#2a2a2a",gridLine:"#3e3e3e",selectionBg:"rgba(0, 120, 215, 0.25)",activeCellBorder:"#0078d7",cellText:"#d4d4d4",scrollTrack:"rgba(255,255,255,0.06)",scrollThumb:"rgba(255,255,255,0.2)",formulaBarBg:"#2d2d2d",formulaBarBorder:"#3e3e3e",formulaBarLabelText:"#ccc",formulaBarLabelBg:"#3c3c3c",formulaBarLabelBorder:"#555",formulaBarInputBg:"#3c3c3c",formulaBarInputBorder:"#555",formulaBarInputText:"#d4d4d4",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.4)",wrapperBg:"#1e1e1e",cellEditorBorder:"#0078d7",cellEditorText:"#d4d4d4",cellEditorBg:"#3c3c3c",cellEditorShadow:"#0078d7",tabBarBg:"#2a2a2a",tabBarBorder:"#3e3e3e",tabActiveBg:"#1e1e1e",tabActiveText:"#e0e0e0",tabActiveBorder:"#0078d7",tabInactiveBg:"#333333",tabInactiveText:"#888",tabInactiveBorder:"transparent",tabHoverBg:"#3a3a3a",tabAddBtnColor:"#999",tabAddBtnHoverBg:"#3a3a3a",tabScrollBtnColor:"#777",tabScrollBtnHoverBg:"#3a3a3a",scrollbarThumb:"rgba(255,255,255,0.2)",scrollbarThumbHover:"rgba(255,255,255,0.35)",scrollBtnBg:"#2d2d2d",scrollBtnColor:"#999",scrollBtnHoverBg:"#3d3d3d",scrollBtnActiveBg:"#4d4d4d",scrollTrackBg:"rgba(255,255,255,0.05)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"},Ol="__nf_custom__",sl="",dl="",Vt="@",Cl="__NF_INVALID__",Ll=2958465,$l=0;function tl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function zl(e){return e==="zh-CN"?"¥":"$"}function Ro(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Wl(e){return e.replace(/"([^"]*)"/g,"$1")}function xo(e){let n=e,o;const l=n.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),n=n.slice(l[0].length)),n=Ro(n);const a=/E[+-]/i.test(n),i=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:n,suffix:"",color:o};let p=-1;for(let Z=n.length-1;Z>=0;Z--){const oe=n[Z];if(oe==="0"||oe==="#"||oe==="?"||oe==="E"){p=Z;break}}p<0&&(p=r);const s=r>0?n.slice(0,r):"",b=p<n.length-1?n.slice(p+1):"",S=n.slice(r,p+1),T=/[0#?]/.test(S),E=S.includes(",");let x=S.replace(/,/g,"");if(a){const Z=x.search(/E/i);Z>=0&&(x=x.slice(0,Z))}const te=x.indexOf("."),ie=te>=0?x.slice(0,te):x,g=te>=0?x.slice(te+1):"",V=(g.match(/[0#?]/g)||[]).length,X=(g.match(/0/g)||[]).length,ae=(ie.match(/0/g)||[]).length;return{hasDigits:T,decimals:V,minDecimals:X,minIntDigits:ae,thousands:E,scale:i?100:1,scientific:a,prefix:s,suffix:b,color:o}}function Mo(e){const n=[];let o=!1;const l=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let a;for(;(a=l.exec(e))!==null;){const i=a[0];switch(i){case"[h]":o=!0,n.push({type:"hour",len:0});break;case"[mm]":o=!0,n.push({type:"minute",len:2});break;case"[ss]":o=!0,n.push({type:"second",len:2});break;case"yyyy":n.push({type:"year",len:4});break;case"yy":case"y":n.push({type:"year",len:2});break;case"mmmm":n.push({type:"monthName",len:4});break;case"mmm":n.push({type:"monthName",len:3});break;case"mm":n.push({type:"month",len:2});break;case"m":n.push({type:"month",len:1});break;case"dddd":n.push({type:"weekday",len:4});break;case"ddd":n.push({type:"weekday",len:3});break;case"dd":n.push({type:"day",len:2});break;case"d":n.push({type:"day",len:1});break;case"hh":n.push({type:"hour",len:2});break;case"h":n.push({type:"hour",len:1});break;case"ss":n.push({type:"second",len:2});break;case"s":n.push({type:"second",len:1});break;case"AM/PM":case"am/pm":n.push({type:"ampm",len:2});break;default:i.startsWith('"')?n.push({type:"literal",text:Wl(i),len:0}):n.push({type:"literal",text:i,len:0})}}return{tokens:n,isDuration:o}}const _l=new Map;function Do(e){if(/[ydhs]/.test(e)||/AM\/PM/i.test(e)||/\[h\]/i.test(e)){const a=e.split(";")[0]??e,{tokens:i,isDuration:r}=Mo(a);return{kind:r?"duration":"date",sections:[],tokens:i,isDuration:r,raw:e}}return{kind:"number",sections:e.split(";").map(a=>xo(a)),tokens:[],isDuration:!1,raw:e}}function ul(e){const n=_l.get(e);if(n)return n;const o=Do(e);return _l.set(e,o),o}function Kl(e,n,o,l,a){const i=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*i)/i,p=r<0,s=Math.abs(r);let S=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:n,maximumFractionDigits:n}).format(s);if(o<n&&n>0){const E=S.indexOf(".");if(E>=0){const B=S.substring(0,E);let x=S.substring(E+1);x=x.replace(/0+$/,""),x.length<o&&(x=x+"0".repeat(o-x.length)),S=x?`${B}.${x}`:B}}return`${p?"-":""}${S}`}function Ul(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,o),a=Kl(l,n,n,!1,1),i=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${a}E${i}`}function To(e,n,o){if(!o.hasDigits)return Wl(o.prefix+o.suffix);const l=o.scale===100?e*100:e,a=o.scientific?Ul(l,o.decimals):Kl(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return n+o.prefix+a+o.suffix}function No(e,n){const o=n.sections;if(o.length===0)return String(e);let l,a,i="";return e>0?(l=o[0],a=e):e<0?o[1]?(l=o[1],a=-e):(l=o[0],a=-e,i="-"):(l=o[2]??o[0],a=0),To(a,i,l)}function Ao(e){return new Date((e-25569)*864e5)}const Io=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Ho=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Gl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Vo=["January","February","March","April","May","June","July","August","September","October","November","December"],Fo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Pl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Kt(e,n){return String(e).padStart(n,"0")}function Oo(e,n,o,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),p=e.getUTCDay(),s=o==="zh-CN";let b="",S=!1;for(const T of n)switch(T.type){case"literal":b+=T.text??"";break;case"year":b+=T.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":b+=Kt(S?e.getUTCMinutes():i,T.len);break;case"monthName":b+=T.len>=4?s?Io[i-1]:Vo[i-1]:s?Ho[i-1]:Fo[i-1];break;case"day":b+=Kt(r,T.len);break;case"weekday":b+=T.len>=4?s?Gl[p]:Pl[p]:s?Gl[p].slice(2):Pl[p].slice(0,3);break;case"hour":{let E=e.getUTCHours();if(T.len===0){const B=Math.floor(l*86400);E=Math.floor(B/3600)}b+=String(E),S=!0;break}case"minute":b+=Kt(e.getUTCMinutes(),T.len);break;case"second":b+=Kt(e.getUTCSeconds(),T.len);break;case"ampm":{const E=e.getUTCHours();b+=E<12?s?"上午":"AM":s?"下午":"PM";break}}return b}function Lo(e,n){const o=Math.floor(e*86400),l=Math.floor(o/3600),a=Math.floor(o%3600/60),i=o%60;let r="";for(const p of n)switch(p.type){case"literal":r+=p.text??"";break;case"hour":r+=String(l);break;case"minute":r+=Kt(a,p.len||2);break;case"second":r+=Kt(i,p.len||2);break;default:r+=""}return r}function $o(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const o=Math.abs(n);return o!==0&&(o>=1e15||o<1e-9)?Ul(n,9):e}return e}function wl(e,n,o){if(tl(n))return $o(e);if(n==null||n===Vt)return e;const l=ul(n);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<$l||i>Ll)return Cl}else if(i<0)return Cl;return l.kind==="duration"?Lo(i,l.tokens):Oo(Ao(i),l.tokens,o,i)}const a=Number(e);return isNaN(a)?e:No(a,l)}const zo=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function Yl(e,n){if(n===Vt||n==="@")return!1;if(tl(n)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=ul(n);return!!(o.kind==="number"&&Xl(o))}function Xl(e){return e.sections.some(n=>n.hasDigits)}function Wo(e){if(e==null||tl(e)||e===Vt||e==="@")return!1;const n=ul(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&Xl(n))}function _o(e,n){if(n==null||tl(n)||n===Vt||n==="@")return!1;const o=ul(n),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<$l||l>Ll:o.kind==="duration"?l<0:!1:!1}function Ko(e,n,o,l){const a=zl(e),i=l?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",p=i+r;switch(n){case"general":return"";case"text":return Vt;case"custom":return"";case"number":return p;case"percent":return p+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return a+p;case"currencyRounded":return a+(l?"#,##0":"0");case"accounting":return`${a}${p};(${a}${p});${a}"-"`;case"financial":return`${p};[Red](${p})`;case"date":return e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy";case"time":return"h:mm:ss";case"dateTime":return e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss";case"duration":return"[h]:mm:ss";default:return""}}function Uo(e){const n=zl(e);return[{label:N(e,"nfGeneral"),value:dl},{label:N(e,"nfText"),value:Vt},{label:N(e,"nfNumber"),value:"#,##0.00"},{label:N(e,"nfPercent"),value:"0.00%"},{label:N(e,"nfScientific"),value:"0.00E+00"},{label:N(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:N(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:N(e,"nfCurrency"),value:n+"#,##0.00"},{label:N(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:N(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:N(e,"nfTime"),value:"h:mm:ss"},{label:N(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:N(e,"nfDuration"),value:"[h]:mm:ss"},{label:N(e,"nfCustom"),value:Ol}]}const Go=["title"],Po=["innerHTML"],Yo={key:1,class:"sp-dropdown__value"},Xo=["disabled"],jo=["onClick"],Zo=["innerHTML"],qo={class:"sp-dropdown__item-label"},Jo=["disabled"],Qo=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(!1),i=t.ref(0),r=t.ref(null),p=t.ref(null),s=t.ref(null),b=t.ref({top:0,up:!1}),S=t.ref(0),T=t.ref(!1),E=t.computed(()=>o.options.find(P=>String(P.value)===String(o.modelValue))),B=t.computed(()=>o.menuWidth),x=t.computed(()=>Math.min(o.visibleCount,o.options.length)),te=t.computed(()=>o.options.slice(i.value,i.value+x.value)),ie=t.computed(()=>i.value>0),g=t.computed(()=>i.value+x.value<o.options.length),V=t.computed(()=>o.options.length>x.value);function X(P){i.value=Math.max(0,Math.min(o.options.length-x.value,i.value+P))}function ae(){a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0);const P=o.triggerEl??r.value;if(!P)return;const fe=P.getBoundingClientRect(),Q=x.value*22+(V.value?2*15:0)+8,f=window.innerHeight-fe.bottom-4<Q&&fe.top-4>Q;o.align==="right"?b.value={right:window.innerWidth-fe.right,top:f?fe.top-Q-4:fe.bottom+4,up:f}:b.value={left:fe.left,top:f?fe.top-Q-4:fe.bottom+4,up:f};const m=o.options.findIndex(A=>String(A.value)===String(o.modelValue));i.value=m>=0?Math.max(0,Math.min(m-Math.floor(x.value/2),o.options.length-x.value)):0}function Z(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function oe(){a.value?Z():ae()}function ne(P){l("update:modelValue",P.value),l("change",P.value),Z()}function ce(P){var Q,c;if(!a.value)return;const fe=P.target;(Q=r.value)!=null&&Q.contains(fe)||(c=s.value)!=null&&c.contains(fe)||Z()}function Ne(P){a.value&&(P.preventDefault(),X(P.deltaY>0?1:-1))}t.watch(a,P=>{t.nextTick(()=>{var fe,Q;P?((fe=p.value)==null||fe.addEventListener("wheel",Ne,{passive:!1}),document.addEventListener("keydown",Ve)):((Q=p.value)==null||Q.removeEventListener("wheel",Ne),document.removeEventListener("keydown",Ve))})});function Ve(P){a.value&&P.key==="Escape"&&Z()}t.watch(()=>o.modelOpen,P=>{P!==void 0&&P!==a.value&&(P?ae():Z())});function Ye(P){a.value&&(S.value=P.touches[0].clientY,T.value=!0)}function Le(P){if(!a.value||!T.value)return;const fe=P.touches[0].clientY-S.value;Math.abs(fe)>5&&(X(fe<0?1:-1),S.value=P.touches[0].clientY)}function ye(){T.value=!1}function J(P){P.key==="Escape"&&Z()}return t.onMounted(()=>{document.addEventListener("pointerdown",ce),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ce),document.removeEventListener("keydown",Ve),window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}),(P,fe)=>{var Q,c;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"sp-dropdown",style:t.normalizeStyle(typeof e.width=="number"?{width:e.width+"px"}:{width:e.width})},[e.hideTrigger?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":a.value}]),title:e.title,onClick:oe},[(Q=E.value)!=null&&Q.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:E.value.icon},null,8,Po)):(t.openBlock(),t.createElementBlock("span",Yo,t.toDisplayString(((c=E.value)==null?void 0:c.label)??e.fallbackLabel),1)),fe[3]||(fe[3]=t.createElementVNode("svg",{class:"sp-dropdown__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1))],10,Go)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:s,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":b.value.up}]),style:t.normalizeStyle({left:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px",minWidth:B.value!==void 0?typeof B.value=="number"?B.value+"px":B.value:void 0}),onKeydown:J,onMousedown:fe[2]||(fe[2]=t.withModifiers(()=>{},["prevent"]))},[V.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ie.value}]),disabled:!ie.value,onClick:fe[0]||(fe[0]=f=>X(-1))},[...fe[4]||(fe[4]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,Xo)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:p,class:"sp-dropdown__list",onTouchstart:Ye,onTouchmove:Le,onTouchend:ye},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,f=>(t.openBlock(),t.createElementBlock("button",{key:String(f.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(f.value)===String(e.modelValue)}]),onClick:m=>ne(f)},[f.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:f.icon},null,8,Zo)):t.createCommentVNode("",!0),t.createElementVNode("span",qo,t.toDisplayString(f.label),1)],10,jo))),128))],544),V.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!g.value}]),disabled:!g.value,onClick:fe[1]||(fe[1]=f=>X(1))},[...fe[5]||(fe[5]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Jo)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),vt=(e,n)=>{const o=e.__vccOpts||e;for(const[l,a]of n)o[l]=a;return o},ll=vt(Qo,[["__scopeId","data-v-0152ad1e"]]),en=["title","onClick"],jl=vt(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],r=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],p=t.computed(()=>l.colorKey==="fill"?r:i);function s(V){return N(l.locale,V)}function b(V){const X=l.currentColor;return!X&&!V?!0:X?X.toLowerCase()===V.toLowerCase():!1}const S=t.ref(!1),T=t.ref(null),E=t.ref(null),B=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==S.value&&(V?te():ie())});function x(V){const X=T.value,ae=E.value,Z=V.target;X&&X.contains(Z)||ae&&ae.contains(Z)||ie()}function te(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??T.value;if(V){const X=V.getBoundingClientRect(),ae=150,Z=120;let oe=window.innerWidth-X.right,ne=X.bottom+4,ce;X.left-Z<4&&(oe=void 0,ce=Math.max(4,X.left)),ne+ae>window.innerHeight-4&&(ne=X.top-ae-4),ne<4&&(ne=4),B.value=oe!==void 0?{right:oe,top:ne}:{left:ce,top:ne}}document.addEventListener("pointerdown",x)})}function ie(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function g(V){a("update:modelValue",V),a("change",V),ie()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),n({open:S,openMenu:te,close:ie}),(V,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:T,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:E,class:"color-picker__menu",style:t.normalizeStyle({left:B.value.left!==void 0?B.value.left+"px":void 0,right:B.value.right!==void 0?B.value.right+"px":void 0,top:B.value.top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,(ae,Z)=>(t.openBlock(),t.createElementBlock("div",{key:Z,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ae,oe=>(t.openBlock(),t.createElementBlock("button",{key:oe.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":b(oe.value)}]),title:s(oe.key),style:t.normalizeStyle({background:oe.value||"transparent",border:oe.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:ne=>g(oe.value)},null,14,en))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),tn=["title","onClick"],ln={viewBox:"0 0 30 30",class:"border-picker__icon"},on=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],nn={class:"border-picker__label"},rn=vt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],r=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],p={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},s={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function b(V,X){return s[V].includes(X)?"thick":p[V].includes(X)?"solid":"dashed"}const S=t.ref(!1),T=t.ref(null),E=t.ref(null),B=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==S.value&&(V?te():ie())});function x(V){const X=T.value,ae=E.value,Z=V.target;X&&X.contains(Z)||ae&&ae.contains(Z)||ie()}function te(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??T.value;if(V){const X=V.getBoundingClientRect(),ae=200,Z=160;let oe=window.innerWidth-X.right,ne=X.bottom+4,ce;X.left-Z<4&&(oe=void 0,ce=Math.max(4,X.left)),ne+ae>window.innerHeight-4&&(ne=X.top-ae-4),ne<4&&(ne=4),B.value=oe!==void 0?{right:oe,top:ne}:{left:ce,top:ne}}document.addEventListener("pointerdown",x)})}function ie(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function g(V){a("change",V),ie()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),n({open:S,openMenu:te,close:ie}),(V,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:T,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:E,class:"border-picker__menu",style:t.normalizeStyle({left:B.value.left!==void 0?B.value.left+"px":void 0,right:B.value.right!==void 0?B.value.right+"px":void 0,top:B.value.top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ae=>t.createElementVNode("button",{key:ae.key,class:"border-picker__item",title:t.unref(N)(e.locale,ae.i18nKey),onClick:Z=>g(ae.key)},[(t.openBlock(),t.createElementBlock("svg",ln,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,Z=>t.createElementVNode("line",{key:Z.name,x1:Z.x1,y1:Z.y1,x2:Z.x2,y2:Z.y2,stroke:"currentColor","stroke-width":b(ae.key,Z.name)==="thick"?3:1.5,"stroke-dasharray":b(ae.key,Z.name)==="dashed"?"0 4":"none","stroke-linecap":b(ae.key,Z.name)==="dashed"?"round":"square"},null,8,on)),64))])),t.createElementVNode("span",nn,t.toDisplayString(t.unref(N)(e.locale,ae.i18nKey)),1)],8,tn)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),an=["title","onClick"],cn=["innerHTML"],sn={class:"merge-picker__label"},dn=vt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=t.ref(!1),r=t.ref(null),p=t.ref(null),s=t.ref({top:0});t.watch(()=>l.modelOpen,B=>{B!==void 0&&B!==i.value&&(B?S():T())});function b(B){const x=r.value,te=p.value,ie=B.target;x&&x.contains(ie)||te&&te.contains(ie)||T()}function S(){i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const B=l.triggerEl??r.value;if(B){const x=B.getBoundingClientRect(),te=Fl.length*30+12,ie=160;let g=window.innerWidth-x.right,V=x.bottom+4,X;x.left-ie<4&&(g=void 0,X=Math.max(4,x.left)),V+te>window.innerHeight-4&&(V=x.top-te-4),V<4&&(V=4),s.value=g!==void 0?{right:g,top:V}:{left:X,top:V}}document.addEventListener("pointerdown",b)})}function T(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",b)}function E(B){a("change",B),T()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",b)}),n({open:i,openMenu:S,close:T}),(B,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:p,class:"merge-picker__menu",style:t.normalizeStyle({left:s.value.left!==void 0?s.value.left+"px":void 0,right:s.value.right!==void 0?s.value.right+"px":void 0,top:s.value.top+"px"}),onMousedown:x[0]||(x[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Fl),te=>(t.openBlock(),t.createElementBlock("button",{key:te.key,class:"merge-picker__item",title:t.unref(N)(e.locale,te.labelKey),onClick:ie=>E(te.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:te.icon},null,8,cn),t.createElementVNode("span",sn,t.toDisplayString(t.unref(N)(e.locale,te.labelKey)),1)],8,an))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),un=["disabled","title","onClick"],fn={class:"calc-picker__label"},mn=vt(t.defineComponent({__name:"calcPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),p=t.ref(null),s=t.ref(null),b=t.ref({top:0});t.watch(()=>l.modelOpen,x=>{x!==void 0&&x!==r.value&&(x?T():E())});function S(x){const te=p.value,ie=s.value,g=x.target;te&&te.contains(g)||ie&&ie.contains(g)||E()}function T(){r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const x=l.triggerEl??p.value;if(x){const te=x.getBoundingClientRect(),ie=i.length*30+12,g=160;let V=window.innerWidth-te.right,X=te.bottom+4,ae;te.left-g<4&&(V=void 0,ae=Math.max(4,te.left)),X+ie>window.innerHeight-4&&(X=te.top-ie-4),X<4&&(X=4),b.value=V!==void 0?{right:V,top:X}:{left:ae,top:X}}document.addEventListener("pointerdown",S)})}function E(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function B(x){l.disabled||(a("change",x),E())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),n({open:r,openMenu:T,close:E}),(x,te)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:p,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:s,class:"calc-picker__menu",style:t.normalizeStyle({left:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px"}),onMousedown:te[0]||(te[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ie=>t.createElementVNode("button",{key:ie.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(N)(e.locale,ie.labelKey),onClick:g=>B(ie.key)},[t.createElementVNode("span",fn,t.toDisplayString(t.unref(N)(e.locale,ie.labelKey)),1)],10,un)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),pn={class:"tb-item","data-key":"undo"},hn=["title","disabled"],gn={class:"tb-item","data-key":"redo"},bn=["title","disabled"],yn={class:"tb-item","data-key":"paint"},vn=["title","disabled"],Cn={class:"tb-item","data-key":"clear"},wn=["title","disabled"],kn={class:"tb-item","data-key":"font"},En={class:"tb-item","data-key":"fontSize"},Sn={class:"toolbar-font-size"},Bn=["value","title"],Rn=["title"],xn=["title","disabled"],Mn=["title","disabled"],Dn={class:"tb-item","data-key":"bold"},Tn=["title","disabled"],Nn={class:"tb-item","data-key":"italic"},An=["title","disabled"],In={class:"tb-item","data-key":"underline"},Hn=["title","disabled"],Vn={class:"tb-item","data-key":"strike"},Fn=["title","disabled"],On={class:"tb-item","data-key":"textColor"},Ln={class:"toolbar-split"},$n=["title","disabled"],zn={viewBox:"0 0 1024 1024",fill:"currentColor"},Wn=["fill"],_n=["title","disabled"],Kn={class:"tb-item","data-key":"fillColor"},Un={class:"toolbar-split"},Gn=["title","disabled"],Pn={viewBox:"0 0 1024 1024",fill:"currentColor"},Yn=["fill"],Xn=["title","disabled"],jn={class:"tb-item","data-key":"border"},Zn={class:"toolbar-split"},qn=["title","disabled"],Jn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Qn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],er=["title","disabled"],tr={class:"tb-item","data-key":"hAlign"},lr={class:"tb-item","data-key":"vAlign"},or={class:"tb-item","data-key":"wrap"},nr=["title"],rr={class:"tb-item","data-key":"merge"},ar={class:"toolbar-split"},ir=["title","disabled"],cr=["title","disabled"],sr={class:"tb-item","data-key":"numFmt"},dr={class:"tb-item","data-key":"calc"},ur={class:"toolbar-split"},fr=["title","disabled"],mr=["title","disabled"],pr={class:"tb-item","data-key":"find"},hr=["title"],kl=2,gr=6,br=34,yr=vt(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","merge-change"],setup(e,{emit:n}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],l={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},a={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function i($,u){return a[$].includes(u)?"thick":l[$].includes(u)?"solid":"dashed"}const r=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","find"],p=t.ref(null),s=t.ref(null),b=t.ref(null),S=t.ref(null),T=t.ref(null),E=t.ref(null),B=t.ref(null),x=t.ref(null),te=t.ref(null),ie=t.ref(new Set),g=t.ref(!1),V=t.ref(!1),X=t.ref(0),ae=new Map,Z=t.computed(()=>ie.value.size>0);function oe($){return ie.value.has($)}const ne=t.computed(()=>{const $=s.value;return $ instanceof HTMLElement?$:void 0});function ce($){return ne.value?!oe($):!0}function Ne(){for(const $ of r){const u=ae.get($);if(u===void 0||u===0)return!0}return!1}function Ve(){if(!p.value)return;p.value.querySelectorAll(".tb-item").forEach(u=>{const M=u.dataset.key;if(!M)return;const j=u.offsetWidth;j>0?ae.set(M,j):ae.has(M)||ae.set(M,0)})}function Ye($,u){if($.size!==u.size)return!1;for(const M of $)if(!u.has(M))return!1;return!0}let Le=0,ye=0;function J(){Le&&cancelAnimationFrame(Le),!(ye>60)&&(ye++,Le=requestAnimationFrame(()=>requestAnimationFrame(P)))}function P(){if(!p.value)return;const $=p.value.clientWidth-gr*2;if($<=0){J();return}ye=0,(ae.size===0||Ne())&&Ve();let u=0;for(const j of r)u+=(ae.get(j)??0)+kl;const M=new Set;if(u>$){const j=$-br-kl;let re=0;for(let W=0;W<r.length;W++){const ke=r[W],Ke=(ae.get(ke)??0)+kl;if(re+Ke>j){for(let nt=W;nt<r.length;nt++)M.add(r[nt]);break}re+=Ke}}Ye(M,ie.value)||(ie.value=M,X.value++,M.size===0&&(g.value=!1))}let fe=null;const Q=t.ref(0),c=t.computed(()=>{const $=b.value,u={position:"fixed",top:"0px",right:"0px"};if(!$)return{...O.themeVars,...u};Q.value;const M=$.getBoundingClientRect();return{...O.themeVars,position:"fixed",top:`${M.bottom+4}px`,right:`${window.innerWidth-M.right}px`}});function f(){g.value&&(Q.value++,t.nextTick(()=>P()))}function m($){var M,j;if(!g.value)return;const u=$.target;(M=s.value)!=null&&M.contains(u)||(j=b.value)!=null&&j.contains(u)||(V.value=!0,g.value=!1,t.nextTick(()=>{V.value=!1}))}function A(){g.value=!g.value}function I(){g.value=!1,C("find")}t.onMounted(()=>{J(),p.value&&(fe=new ResizeObserver(()=>{g.value||J()}),fe.observe(p.value)),document.addEventListener("pointerdown",m,!0),window.addEventListener("resize",f),window.addEventListener("load",J),window.addEventListener("orientationchange",J)}),t.onBeforeUnmount(()=>{Le&&cancelAnimationFrame(Le),fe==null||fe.disconnect(),document.removeEventListener("pointerdown",m,!0),window.removeEventListener("resize",f),window.removeEventListener("load",J),window.removeEventListener("orientationchange",J)});const O=e,C=n,se=t.computed(()=>O.selNumberFormat===sl?N(O.locale,"nfMixed"):"");return($,u)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:p,class:"toolbar",onMousedown:u[45]||(u[45]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("undo"),to:ne.value},[t.createElementVNode("div",pn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(N)(e.locale,"undo"),disabled:!e.canUndo,onClick:u[0]||(u[0]=M=>C("undo"))},[...u[47]||(u[47]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,hn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("redo"),to:ne.value},[t.createElementVNode("div",gn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(N)(e.locale,"redo"),disabled:!e.canRedo,onClick:u[1]||(u[1]=M=>C("redo"))},[...u[48]||(u[48]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{transform:"translate(1024, 0) scale(-1, 1)",d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,bn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("paint"),to:ne.value},[t.createElementVNode("div",yn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(N)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:u[2]||(u[2]=M=>C("paint-format"))},[...u[49]||(u[49]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z"})],-1)])],10,vn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("clear"),to:ne.value},[t.createElementVNode("div",Cn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(N)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:u[3]||(u[3]=M=>C("clear-format"))},[...u[50]||(u[50]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0"})],-1)])],10,wn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("sep1"),to:ne.value},[u[51]||(u[51]=t.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("font"),to:ne.value},[t.createElementVNode("div",kn,[t.createVNode(ll,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:oe("font")?"100%":110,"menu-width":oe("font")?120:void 0,"visible-count":8,title:t.unref(N)(e.locale,"fontFamily"),align:"right",onChange:u[4]||(u[4]=M=>C("font-family-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("fontSize"),to:ne.value},[t.createElementVNode("div",En,[t.createElementVNode("div",Sn,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(N)(e.locale,"fontSize"),onMousedown:u[5]||(u[5]=t.withModifiers(()=>{},["stop"])),onInput:u[6]||(u[6]=M=>C("font-size-input",M.target.value)),onBlur:u[7]||(u[7]=M=>C("font-size-blur")),onKeydown:u[8]||(u[8]=M=>C("font-size-keydown",M))},null,40,Bn),t.createVNode(ll,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:oe("fontSize")?"100%":56,"menu-width":oe("fontSize")?120:56,"visible-count":9,title:t.unref(N)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":te.value,"onUpdate:modelOpen":u[9]||(u[9]=M=>C("update:font-size-menu-open",M)),onChange:u[10]||(u[10]=M=>C("font-size-change",M))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:te,class:"toolbar-font-size__btn",type:"button",title:t.unref(N)(e.locale,"fontSize"),onMousedown:u[11]||(u[11]=t.withModifiers(()=>{},["prevent"])),onClick:u[12]||(u[12]=M=>C("font-size-toggle"))},[...u[52]||(u[52]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,Rn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(N)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:u[13]||(u[13]=t.withModifiers(()=>{},["prevent"])),onClick:u[14]||(u[14]=M=>C("font-size-step-down"))},[...u[53]||(u[53]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,xn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(N)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:u[15]||(u[15]=t.withModifiers(()=>{},["prevent"])),onClick:u[16]||(u[16]=M=>C("font-size-step-up"))},[...u[54]||(u[54]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,Mn)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("sep2"),to:ne.value},[u[55]||(u[55]=t.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("bold"),to:ne.value},[t.createElementVNode("div",Dn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(N)(e.locale,"bold"),disabled:!e.hasSelection,onClick:u[17]||(u[17]=M=>C("bold-toggle"))},[...u[56]||(u[56]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z"})])],-1)])],10,Tn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("italic"),to:ne.value},[t.createElementVNode("div",Nn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(N)(e.locale,"italic"),disabled:!e.hasSelection,onClick:u[18]||(u[18]=M=>C("italic-toggle"))},[...u[57]||(u[57]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z"})])],-1)])],10,An)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("underline"),to:ne.value},[t.createElementVNode("div",In,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(N)(e.locale,"underline"),disabled:!e.hasSelection,onClick:u[19]||(u[19]=M=>C("underline-toggle"))},[...u[58]||(u[58]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z"})])],-1)])],10,Hn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("strike"),to:ne.value},[t.createElementVNode("div",Vn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(N)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:u[20]||(u[20]=M=>C("strikethrough-toggle"))},[...u[59]||(u[59]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,Fn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("sep3"),to:ne.value},[u[60]||(u[60]=t.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("textColor"),to:ne.value},[t.createElementVNode("div",On,[t.createElementVNode("div",Ln,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:u[21]||(u[21]=M=>C("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",zn,[u[61]||(u[61]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:e.cachedTextColor||"#000000"},null,8,Wn)]))],8,$n),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:S,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:u[22]||(u[22]=M=>C("update:text-color-menu-open",!e.textColorMenuOpen))},[...u[62]||(u[62]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,_n),t.createVNode(jl,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":S.value,"onUpdate:modelOpen":u[23]||(u[23]=M=>C("update:text-color-menu-open",M)),onChange:u[24]||(u[24]=M=>C("text-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("fillColor"),to:ne.value},[t.createElementVNode("div",Kn,[t.createElementVNode("div",Un,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:u[25]||(u[25]=M=>C("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Pn,[u[63]||(u[63]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:e.cachedFillColor||"currentColor"},null,8,Yn)]))],8,Gn),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:T,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:u[26]||(u[26]=M=>C("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...u[64]||(u[64]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Xn),t.createVNode(jl,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":T.value,"onUpdate:modelOpen":u[27]||(u[27]=M=>C("update:fill-color-menu-open",M)),onChange:u[28]||(u[28]=M=>C("fill-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("border"),to:ne.value},[t.createElementVNode("div",jn,[t.createElementVNode("div",Zn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"borders"),disabled:!e.hasSelection,onClick:u[29]||(u[29]=M=>C("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Jn,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,M=>t.createElementVNode("line",{key:M.name,x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,"stroke-width":i(e.cachedBorder,M.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,M.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,M.name)==="dashed"?"round":"square"},null,8,Qn)),64))]))],8,qn),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:E,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"borders"),disabled:!e.hasSelection,onClick:u[30]||(u[30]=M=>C("update:border-menu-open",!e.borderMenuOpen))},[...u[65]||(u[65]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,er),t.createVNode(rn,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":E.value,"onUpdate:modelOpen":u[31]||(u[31]=M=>C("update:border-menu-open",M)),onChange:u[32]||(u[32]=M=>C("border-change",M))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("sep4"),to:ne.value},[u[66]||(u[66]=t.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("hAlign"),to:ne.value},[t.createElementVNode("div",tr,[t.createVNode(ll,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:oe("hAlign")?"100%":44,"menu-width":oe("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(N)(e.locale,"hAlign"),onChange:u[33]||(u[33]=M=>C("h-align-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("vAlign"),to:ne.value},[t.createElementVNode("div",lr,[t.createVNode(ll,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:oe("vAlign")?"100%":44,"menu-width":oe("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(N)(e.locale,"vAlign"),onChange:u[34]||(u[34]=M=>C("v-align-change",M))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",or,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(N)(e.locale,"wrap"),onClick:u[35]||(u[35]=M=>C("wrap-toggle"))},[...u[67]||(u[67]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z"})],-1)])],10,nr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("merge"),to:ne.value},[t.createElementVNode("div",rr,[t.createElementVNode("div",ar,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:u[36]||(u[36]=M=>C("apply-merge"))},[...u[68]||(u[68]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)])],8,ir),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:B,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:u[37]||(u[37]=M=>C("update:merge-menu-open",!e.mergeMenuOpen))},[...u[69]||(u[69]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,cr),t.createVNode(dn,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":B.value,"onUpdate:modelOpen":u[38]||(u[38]=M=>C("update:merge-menu-open",M)),onChange:u[39]||(u[39]=M=>C("merge-change",M))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("sep6"),to:ne.value},[u[70]||(u[70]=t.createElementVNode("div",{class:"tb-item","data-key":"sep6"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("numFmt"),to:ne.value},[t.createElementVNode("div",sr,[t.createVNode(ll,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:oe("numFmt")?"100%":92,"menu-width":(oe("numFmt"),150),"visible-count":8,title:t.unref(N)(e.locale,"numberFormat"),"fallback-label":se.value,align:"right",onChange:u[40]||(u[40]=M=>C("number-format-change",String(M)))},null,8,["model-value","options","width","menu-width","title","fallback-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("sep7"),to:ne.value},[u[71]||(u[71]=t.createElementVNode("div",{class:"tb-item","data-key":"sep7"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("calc"),to:ne.value},[t.createElementVNode("div",dr,[t.createElementVNode("div",ur,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:u[41]||(u[41]=M=>C("calc-sum"))},[...u[72]||(u[72]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)])],8,fr),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:u[42]||(u[42]=M=>C("update:calc-menu-open",!e.calcMenuOpen))},[...u[73]||(u[73]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,mr),t.createVNode(mn,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":x.value,disabled:e.isSingleCell,"onUpdate:modelOpen":u[43]||(u[43]=M=>C("update:calc-menu-open",M)),onChange:u[44]||(u[44]=M=>C(`calc-${M}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ce("find"),to:ne.value},[t.createElementVNode("div",pr,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(N)(e.locale,"find"),onClick:I},[...u[74]||(u[74]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M448 128a320 320 0 0 1 251.2 516.8l171.2 171.2a32 32 0 0 1-45.2 45.2L654 689.9A320 320 0 1 1 448 128zm0 64a256 256 0 1 0 0 512 256 256 0 0 0 0-512z"})],-1)])],8,hr)])],8,["disabled","to"])),Z.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:b,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":g.value}]),type:"button",onClick:A},[...u[75]||(u[75]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],544),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:s,key:X.value,class:t.normalizeClass(["overflow-menu",{"no-anim":V.value}]),style:t.normalizeStyle(c.value),onMousedown:u[46]||(u[46]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,g.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-d0b03fba"]]),vr=["title"],Cr={class:"tab-list"},wr=["onClick","onDblclick","onContextmenu"],kr=["value"],Er={key:1,class:"tab-item__name"},Sr=["title"],Br=["disabled"],Rr=["title","onClick"],xr={class:"tab-list-menu__name"},Mr=["title","disabled","onClick"],Dr=["disabled"],Tr=8,Nr=vt(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","delete-sheet","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(null),i=t.ref(!1),r=t.ref(0),p=t.ref({left:0,bottom:0}),s=t.ref(null),b=t.computed(()=>Math.min(Tr,o.sheets.length)),S=t.computed(()=>o.sheets.slice(r.value,r.value+b.value)),T=t.computed(()=>r.value>0),E=t.computed(()=>r.value+b.value<o.sheets.length),B=t.computed(()=>o.sheets.length>b.value),x=t.computed(()=>o.sheets.length>1);t.watch(()=>o.sheets.length,()=>{if(!i.value)return;const ye=Math.max(0,o.sheets.length-b.value);r.value>ye&&(r.value=ye)});function te(ye){r.value=Math.max(0,Math.min(o.sheets.length-b.value,r.value+ye))}function ie(){if(i.value){i.value=!1;return}const ye=a.value;if(!ye)return;const J=ye.getBoundingClientRect();p.value={left:J.left,bottom:window.innerHeight-J.top+4};const P=o.activeSheetIndex;r.value=P>=0?Math.max(0,Math.min(P-Math.floor(b.value/2),o.sheets.length-b.value)):0,i.value=!0}function g(ye){l("tab-click",ye),i.value=!1}function V(ye){x.value&&l("delete-sheet",ye)}function X(ye){var fe;if(!i.value)return;const J=ye.target;if((fe=a.value)!=null&&fe.contains(J))return;const P=document.querySelector(".tab-list-menu");P!=null&&P.contains(J)||(i.value=!1)}function ae(ye){i.value&&ye.key==="Escape"&&(i.value=!1)}function Z(ye){i.value&&(ye.preventDefault(),te(ye.deltaY>0?1:-1))}function oe(){i.value=!1}function ne(ye){!i.value||ye.target===s.value||oe()}const ce=t.ref(0),Ne=t.ref(!1);function Ve(ye){i.value&&(ce.value=ye.touches[0].clientY,Ne.value=!0)}function Ye(ye){if(!i.value||!Ne.value)return;const J=ye.touches[0].clientY-ce.value;Math.abs(J)>5&&(te(J<0?1:-1),ce.value=ye.touches[0].clientY)}function Le(){Ne.value=!1}return t.watch(i,ye=>{t.nextTick(()=>{var J,P;ye?(J=s.value)==null||J.addEventListener("wheel",Z,{passive:!1}):(P=s.value)==null||P.removeEventListener("wheel",Z)})}),t.onMounted(()=>{document.addEventListener("pointerdown",X),document.addEventListener("keydown",ae),window.addEventListener("resize",oe),window.addEventListener("scroll",ne,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",X),document.removeEventListener("keydown",ae),window.removeEventListener("resize",oe),window.removeEventListener("scroll",ne,!0)}),(ye,J)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:J[8]||(J[8]=P=>l("tabbar-contextmenu",P))},[t.createElementVNode("button",{ref_key:"listBtnRef",ref:a,class:t.normalizeClass(["tab-bar__list-btn",{"tab-bar__list-btn--active":i.value}]),type:"button",title:t.unref(N)(e.locale,"sheetList"),onClick:ie},[...J[9]||(J[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M128 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z"})],-1)])],10,vr),t.createElementVNode("div",Cr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(P,fe)=>(t.openBlock(),t.createElementBlock("div",{key:P.id,class:t.normalizeClass(["tab-item",{"tab-item--active":fe===e.activeSheetIndex}]),onClick:Q=>l("tab-click",fe),onDblclick:t.withModifiers(Q=>l("tab-dblclick",fe),["prevent"]),onContextmenu:Q=>l("tab-contextmenu",{ev:Q,i:fe})},[e.renTab===fe?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:J[0]||(J[0]=Q=>l("tab-rename-input",Q.target.value)),onKeydown:J[1]||(J[1]=Q=>l("tab-rename-keydown",Q)),onBlur:J[2]||(J[2]=Q=>l("tab-rename-commit")),onClick:J[3]||(J[3]=t.withModifiers(()=>{},["stop"]))},null,40,kr)):(t.openBlock(),t.createElementBlock("span",Er,t.toDisplayString(P.name),1))],42,wr))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(N)(e.locale,"addSheet"),onClick:J[4]||(J[4]=P=>l("add-sheet"))}," + ",8,Sr),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"tab-list-menu",style:t.normalizeStyle({left:p.value.left+"px",bottom:p.value.bottom+"px"}),onMousedown:J[7]||(J[7]=t.withModifiers(()=>{},["prevent"]))},[B.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!T.value}]),disabled:!T.value,onClick:J[5]||(J[5]=P=>te(-1))},[...J[10]||(J[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,Br)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:s,class:"tab-list-menu__list",onTouchstart:Ve,onTouchmove:Ye,onTouchend:Le},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,P=>(t.openBlock(),t.createElementBlock("div",{key:P.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(P)===e.activeSheetIndex}]),title:P.name,onClick:fe=>g(e.sheets.indexOf(P))},[t.createElementVNode("span",xr,t.toDisplayString(P.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(N)(e.locale,"delete"),disabled:!x.value,onClick:t.withModifiers(fe=>V(e.sheets.indexOf(P)),["stop"])},[...J[11]||(J[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,Mr)],10,Rr))),128))],544),B.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!E.value}]),disabled:!E.value,onClick:J[6]||(J[6]=P=>te(1))},[...J[12]||(J[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Dr)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),Ar=["placeholder","value"],Ir=["placeholder","value"],Hr=["value","title"],Vr={value:"sheet"},Fr={value:"workbook"},Or={value:"selection"},Lr={class:"find-bar__chk"},$r=["checked"],zr={class:"find-bar__chk"},Wr=["checked"],_r={class:"find-bar__count"},Kr=["title","disabled"],Ur=["title","disabled"],Gr=["disabled"],Pr=["disabled"],Yr=["title"],Xr=vt(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},findText:{},replaceText:{},scope:{},matchCase:{type:Boolean},matchEntireCell:{type:Boolean},currentIndex:{},total:{},message:{},focusToken:{},locale:{},themeVars:{}},emits:["update:findText","update:replaceText","update:scope","update:matchCase","update:matchEntireCell","prev","next","replace","replace-all","close"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(null),i=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||"");t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var s;return(s=a.value)==null?void 0:s.focus()})});function r(s){s.key==="Enter"?(s.preventDefault(),s.shiftKey?l("prev"):l("next")):s.key==="Escape"&&(s.preventDefault(),l("close"))}function p(s){l("update:scope",s.target.value)}return(s,b)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(N)(e.locale,"findPlaceholder"),value:e.findText,onInput:b[0]||(b[0]=S=>l("update:findText",S.target.value)),onKeydown:r},null,40,Ar),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(N)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:b[1]||(b[1]=S=>l("update:replaceText",S.target.value)),onKeydown:r},null,40,Ir),t.createElementVNode("select",{class:"find-bar__select",value:e.scope,title:t.unref(N)(e.locale,"findScope"),onChange:p},[t.createElementVNode("option",Vr,t.toDisplayString(t.unref(N)(e.locale,"scopeSheet")),1),t.createElementVNode("option",Fr,t.toDisplayString(t.unref(N)(e.locale,"scopeWorkbook")),1),t.createElementVNode("option",Or,t.toDisplayString(t.unref(N)(e.locale,"scopeSelection")),1)],40,Hr),t.createElementVNode("label",Lr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchCase,onChange:b[2]||(b[2]=S=>l("update:matchCase",S.target.checked))},null,40,$r),t.createTextVNode(t.toDisplayString(t.unref(N)(e.locale,"matchCase")),1)]),t.createElementVNode("label",zr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchEntireCell,onChange:b[3]||(b[3]=S=>l("update:matchEntireCell",S.target.checked))},null,40,Wr),t.createTextVNode(t.toDisplayString(t.unref(N)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",_r,t.toDisplayString(i.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(N)(e.locale,"findPrev"),disabled:e.total===0,onClick:b[4]||(b[4]=S=>l("prev"))},[...b[9]||(b[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 320a32 32 0 0 1 45.254 0l288 288a32 32 0 0 1-45.254 45.254L512 410.51 214.254 653.254A32 32 0 0 1 169 608l288-288z"})],-1)])],8,Kr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(N)(e.locale,"findNext"),disabled:e.total===0,onClick:b[5]||(b[5]=S=>l("next"))},[...b[10]||(b[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 704a32 32 0 0 1-45.254 0l-288-288A32 32 0 0 1 214.254 370.746L512 613.49 809.746 370.746A32 32 0 0 1 855 416l-288 288z"})],-1)])],8,Ur),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:b[6]||(b[6]=S=>l("replace"))},t.toDisplayString(t.unref(N)(e.locale,"replace")),9,Gr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:b[7]||(b[7]=S=>l("replace-all"))},t.toDisplayString(t.unref(N)(e.locale,"replaceAll")),9,Pr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(N)(e.locale,"findClose"),onClick:b[8]||(b[8]=S=>l("close"))},[...b[11]||(b[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 451.669L369.664 294.336a32 32 0 0 0-45.312 45.312L466.688 497 309.355 654.336a32 32 0 0 0 45.312 45.312L512 542.688l157.333 157.334a32 32 0 0 0 45.312-45.312L557.312 497 714.645 339.664a32 32 0 0 0-45.312-45.312z"})],-1)])],8,Yr)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-8d54f890"]]),jr={class:"nf-dialog__header"},Zr={class:"nf-dialog__title"},qr={class:"nf-dialog__body"},Jr={class:"nf-field"},Qr={class:"nf-field__label"},ea=["value"],ta={key:0,class:"nf-field"},la={class:"nf-field__label"},oa={key:1,class:"nf-field nf-field--inline"},na={class:"nf-checkbox"},ra={key:2,class:"nf-field"},aa={class:"nf-field__label"},ia=["value"],ca={key:3,class:"nf-field"},sa={class:"nf-field__label"},da=["value"],ua={key:4,class:"nf-field"},fa={class:"nf-field__label"},ma=["value"],pa={key:5,class:"nf-field"},ha={class:"nf-field__label"},ga=["value"],ba={key:6,class:"nf-field"},ya={class:"nf-field__label"},va=["value"],Ca={class:"nf-field"},wa={class:"nf-field__label"},ka={class:"nf-dialog__footer"},Ea={class:"nf-preview"},Sa={class:"nf-preview__label"},Ba={class:"nf-preview__value"},Ra={class:"nf-dialog__actions"},xa=vt(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),p=t.ref(!1),s=t.ref("$"),b=t.ref("m/d/yyyy"),S=t.ref("h:mm:ss"),T=t.ref("m/d/yyyy h:mm:ss"),E=t.ref("[h]:mm:ss"),B=t.ref(""),x=t.ref(null),te=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],ie=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],g=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],V=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],X=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],ae=t.computed(()=>o.locale==="zh-CN"?[...ie,...g]:[...g,...ie]),Z=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],oe=t.computed(()=>o.locale==="zh-CN"?[...V,...X]:[...X,...V]),ne=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ce={general:"nfCatGeneral",number:"nfCatNumber",currency:"nfCatCurrency",currencyRounded:"nfCatCurrencyRounded",accounting:"nfCatAccounting",financial:"nfCatFinancial",percent:"nfCatPercent",scientific:"nfCatScientific",date:"nfCatDate",time:"nfCatTime",dateTime:"nfCatDateTime",duration:"nfCatDuration",text:"nfCatText",custom:"nfCatCustom"},Ne=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Ve=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),Ye=t.computed(()=>i.value==="date"),Le=t.computed(()=>i.value==="time"),ye=t.computed(()=>i.value==="dateTime"),J=t.computed(()=>i.value==="duration"),P=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function fe(){if(i.value==="general")return dl;if(i.value==="text")return Vt;if(i.value==="custom")return B.value;if(i.value==="date")return b.value;if(i.value==="time")return S.value;if(i.value==="dateTime")return T.value;if(i.value==="duration")return E.value;const j=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?Q(i.value,j,p.value,s.value):Ko(o.locale,i.value,j,p.value)}function Q(j,re,W,ke){const Ke=W?"#,##0":"0";if(j==="currencyRounded")return ke+Ke;const nt=re>0?"."+"0".repeat(re):"",rt=Ke+nt;return j==="currency"?ke+rt:`${ke}${rt};(${ke}${rt});${ke}"-"`}function c(j){if(B.value=j,tl(j)){i.value="general";return}if(j==="@"){i.value="text";return}if(/\[h\]/i.test(j)&&!/[yd]/i.test(j)){i.value="duration",ne.includes(j)&&(E.value=j);return}const re=/[yd]/i.test(j),W=/h|s|AM\/PM/i.test(j);if(re&&W){i.value="dateTime",oe.value.includes(j)&&(T.value=j);return}if(re||/AM\/PM/i.test(j)){W&&!re?(i.value="time",Z.includes(j)&&(S.value=j)):(i.value="date",ae.value.includes(j)&&(b.value=j));return}if(j.includes("%")){i.value="percent",r.value=f(j);return}if(/E[+-]/i.test(j)){i.value="scientific",r.value=f(j);return}const ke=te.find(Ke=>j.startsWith(Ke.value));if(j.includes("[Red](")){i.value="financial",p.value=j.includes(","),r.value=f(j);return}if(ke){j.includes("(")?(i.value="accounting",s.value=ke.value,p.value=j.includes(","),r.value=f(j)):/\.\d/.test(j.slice(ke.value.length))?(i.value="currency",s.value=ke.value,p.value=j.includes(","),r.value=f(j)):(i.value="currencyRounded",s.value=ke.value,p.value=j.includes(","));return}i.value="number",p.value=j.includes(","),r.value=f(j)}function f(j){const re=j.match(/\.([0#?]+)/);return re?re[1].length:0}function m(){i.value!=="custom"&&(B.value=fe())}function A(){}function I(){b.value=ae.value[0],S.value=Z[0],T.value=oe.value[0],E.value=ne[0]}function O(){a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),I(),c(o.currentFormat??""),t.nextTick(()=>{var j;return(j=x.value)==null?void 0:j.focus()})}function C(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function se(){l("apply",B.value),C()}function $(){C()}function u(j){j.key==="Escape"&&C()}t.watch(()=>o.modelOpen,j=>{j&&!a.value?O():!j&&a.value&&C()});const M=t.computed(()=>wl(o.sampleValue,B.value,o.locale));return(j,re)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:$,onKeydown:u},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:re[9]||(re[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",jr,[t.createElementVNode("span",Zr,t.toDisplayString(t.unref(N)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:C},[...re[10]||(re[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",qr,[t.createElementVNode("div",Jr,[t.createElementVNode("label",Qr,t.toDisplayString(t.unref(N)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":re[0]||(re[0]=W=>i.value=W),class:"nf-field__select",onChange:m},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(zo),W=>(t.openBlock(),t.createElementBlock("option",{key:W,value:W},t.toDisplayString(t.unref(N)(e.locale,ce[W])),9,ea))),128))],544),[[t.vModelSelect,i.value]])]),P.value?(t.openBlock(),t.createElementBlock("div",ta,[t.createElementVNode("label",la,t.toDisplayString(t.unref(N)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":re[1]||(re[1]=W=>r.value=W),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:m},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("div",oa,[t.createElementVNode("label",na,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":re[2]||(re[2]=W=>p.value=W),type:"checkbox",onChange:m},null,544),[[t.vModelCheckbox,p.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(N)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Ve.value?(t.openBlock(),t.createElementBlock("div",ra,[t.createElementVNode("label",aa,t.toDisplayString(t.unref(N)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":re[3]||(re[3]=W=>s.value=W),class:"nf-field__select",onChange:m},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(te,W=>t.createElementVNode("option",{key:W.value,value:W.value},t.toDisplayString(W.label),9,ia)),64))],544),[[t.vModelSelect,s.value]])])):t.createCommentVNode("",!0),Ye.value?(t.openBlock(),t.createElementBlock("div",ca,[t.createElementVNode("label",sa,t.toDisplayString(t.unref(N)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":re[4]||(re[4]=W=>b.value=W),class:"nf-field__select",onChange:m},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ae.value,W=>(t.openBlock(),t.createElementBlock("option",{key:W,value:W},t.toDisplayString(W),9,da))),128))],544),[[t.vModelSelect,b.value]])])):t.createCommentVNode("",!0),Le.value?(t.openBlock(),t.createElementBlock("div",ua,[t.createElementVNode("label",fa,t.toDisplayString(t.unref(N)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":re[5]||(re[5]=W=>S.value=W),class:"nf-field__select",onChange:m},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Z,W=>t.createElementVNode("option",{key:W,value:W},t.toDisplayString(W),9,ma)),64))],544),[[t.vModelSelect,S.value]])])):t.createCommentVNode("",!0),ye.value?(t.openBlock(),t.createElementBlock("div",pa,[t.createElementVNode("label",ha,t.toDisplayString(t.unref(N)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":re[6]||(re[6]=W=>T.value=W),class:"nf-field__select",onChange:m},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe.value,W=>(t.openBlock(),t.createElementBlock("option",{key:W,value:W},t.toDisplayString(W),9,ga))),128))],544),[[t.vModelSelect,T.value]])])):t.createCommentVNode("",!0),J.value?(t.openBlock(),t.createElementBlock("div",ba,[t.createElementVNode("label",ya,t.toDisplayString(t.unref(N)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":re[7]||(re[7]=W=>E.value=W),class:"nf-field__select",onChange:m},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ne,W=>t.createElementVNode("option",{key:W,value:W},t.toDisplayString(W),9,va)),64))],544),[[t.vModelSelect,E.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",Ca,[t.createElementVNode("label",wa,t.toDisplayString(t.unref(N)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:x,"onUpdate:modelValue":re[8]||(re[8]=W=>B.value=W),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:A},null,544),[[t.vModelText,B.value]])])]),t.createElementVNode("div",ka,[t.createElementVNode("div",Ea,[t.createElementVNode("span",Sa,t.toDisplayString(t.unref(N)(e.locale,"nfPreview")),1),t.createElementVNode("span",Ba,t.toDisplayString(M.value||"—"),1)]),t.createElementVNode("div",Ra,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:se},t.toDisplayString(t.unref(N)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:C},t.toDisplayString(t.unref(N)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-69cb36b7"]]);function Pe(e){let n="",o=e;do n=String.fromCharCode(65+o%26)+n,o=Math.floor(o/26)-1;while(o>=0);return n}function El(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.toUpperCase().charCodeAt(o)-64);return n-1}function Ft(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return e.endsWith("%")||isNaN(n)?null:n}return null}function Sl(e){navigator.clipboard.writeText(e).catch(()=>{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)})}function Ut(e,n){return`${e},${n}`}function ol(e,n,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=El(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=n||i<0||i>=o?null:{col:a,row:i}}function Ot(e,n){if(!n)return{x:0,y:0};const o=n.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}function Zl(e,n,o){const l=e.split(":");if(l.length!==2)return null;const a=ol(l[0],n,o),i=ol(l[1],n,o);return!a||!i?null:{sc:Math.min(a.col,i.col),sr:Math.min(a.row,i.row),ec:Math.max(a.col,i.col),er:Math.max(a.row,i.row)}}function ql(e){const n=e.trim();if(n==="")return"";const o=Number(n);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?o:e}function Lt(e,n,o,l,a){const i=o[Ut(e,n)];if(!i)return"";const r=i.value;return r.startsWith("=")?Jl(Ut(e,n),o,l,a):ql(r)}function Ma(e,n,o,l,a){const i=Lt(e,n,o,l,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const nl=new Map,fl=new Set;function Bl(){nl.clear(),fl.clear()}function Jl(e,n,o,l){return Da(e,n,o,l,0)}function Da(e,n,o,l,a){if(fl.has(e))return null;if(nl.has(e))return nl.get(e);fl.add(e);const i=n[e];let r;if(!i)r=null;else{const p=i.value;if(!p.startsWith("="))r=ql(p);else{const s=p.slice(1).trim(),b=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(s);r=b?eo(b[1].toUpperCase(),b[2],n,o,l,a+1):null}}return fl.delete(e),nl.set(e,r),r}function Ql(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Ta(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function Na(e,n,o){let l;if(typeof e=="number"&&typeof n=="number")l=e<n?-1:e>n?1:0;else{const a=String(e??""),i=String(n??"");l=a<i?-1:a>i?1:0}switch(o){case"=":return l===0;case"<>":return l!==0;case"<":return l<0;case">":return l>0;case"<=":return l<=0;case">=":return l>=0}return!1}function Aa(e,n,o,l,a){const i=e.trim(),r=["<=",">=","<>"];let p=null,s=-1,b=null,S=0;for(let E=0;E<i.length;E++){const B=i[E];if(b){B===b&&(i[E+1]===b?E++:b=null);continue}if(B==='"'||B==="'"){b=B;continue}if(B==="("&&S++,B===")"&&S--,S===0&&(B==="<"||B===">"||B==="=")){const x=i.slice(E,E+2);p=r.includes(x)?x:B,s=E;break}}if(p&&s>=0){const E=i.slice(0,s).trim(),B=i.slice(s+p.length).trim(),x=Bt(E,n,o,l,a),te=Bt(B,n,o,l,a);return Na(x,te,p)}const T=Bt(i,n,o,l,a);return Ql(T)}function Rl(e){const n=[];let o=0,l=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(l){a+=r,r===l&&(e[i+1]===l?(i++,a+=l):l=null);continue}if(r==='"'||r==="'"){l=r,a+=r;continue}if(r==="("&&o++,r===")"&&o--,r===","&&o===0){n.push(a),a="";continue}a+=r}return n.push(a),n}function Bt(e,n,o,l,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const r=i.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const p=Ia(i);if(p.length===0)return null;let s=0;const b=()=>{let B=S();for(;s<p.length;){const x=p[s];if(x.type==="op"&&(x.val==="+"||x.val==="-"))s++,B=xl(B,S(),x.val);else break}return B},S=()=>{let B=T();for(;s<p.length;){const x=p[s];if(x.type==="op"&&(x.val==="*"||x.val==="/"))s++,B=xl(B,T(),x.val);else break}return B},T=()=>{const B=p[s];return B&&B.type==="op"&&B.val==="-"?(s++,xl(0,T(),"-")):B&&B.type==="op"&&B.val==="+"?(s++,T()):E()},E=()=>{const B=p[s];if(!B)return null;if(B.type==="num")return s++,Number(B.val);if(B.type==="str")return s++,B.val;if(B.type==="lp"){s++;const x=b();return p[s]&&p[s].type==="rp"&&s++,x}if(B.type==="ref"){s++;const x=ol(B.val,o,l);return x?Lt(x.col,x.row,n,o,l):null}if(B.type==="func"){const x=B.val.toUpperCase();if(s++,p[s]&&p[s].type==="lp"){const te=p[s];let ie=0,g=null,V=s;for(;V<p.length;V++)if(p[V].type==="lp")ie++;else if(p[V].type==="rp"&&(ie--,ie===0)){g=p[V];break}if(g){const X=i.slice(te.start+1,g.start);return s=V+1,eo(x,X,n,o,l,a+1)}}return null}return s++,null};return b()}function Ia(e){const n=[];let o=0;for(;o<e.length;){const l=e[o];if(/\s/.test(l)){o++;continue}if(l==='"'||l==="'"){const a=l,i=o;o++;let r="";for(;o<e.length;){if(e[o]===a){if(e[o+1]===a){r+=a,o+=2;continue}o++;break}r+=e[o],o++}n.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(l)||l==="."){const a=o;let i="";for(l==="."&&(i+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]===".")for(i+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(i+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(i+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;n.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_]/.test(l)){const a=o;let i="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)i+=e[o],o++;e[o]==="("?n.push({type:"func",val:i,start:a}):n.push({type:"ref",val:i,start:a});continue}if(l==="("){n.push({type:"lp",val:l,start:o}),o++;continue}if(l===")"){n.push({type:"rp",val:l,start:o}),o++;continue}if(l===","){n.push({type:"comma",val:l,start:o}),o++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){n.push({type:"op",val:l,start:o}),o++;continue}o++}return n}function xl(e,n,o){if(typeof e!="number"||typeof n!="number")return null;switch(o){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function eo(e,n,o,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Zl(n.trim(),l,a);if(!r)return null;if(e==="COUNT"){let s=0;for(let b=r.sc;b<=r.ec;b++)for(let S=r.sr;S<=r.er;S++)typeof Lt(b,S,o,l,a)=="number"&&s++;return s}let p=0;for(let s=r.sc;s<=r.ec;s++)for(let b=r.sr;b<=r.er;b++)p+=Ma(s,b,o,l,a);if(isNaN(p))return null;if(e==="AVERAGE"){const s=(r.ec-r.sc+1)*(r.er-r.sr+1);return s===0?null:p/s}return p}case"IF":{const r=Rl(n);if(r.length<3)return null;const p=Aa(r[0],o,l,a,i);return Bt(p?r[1]:r[2],o,l,a,i)}case"VLOOKUP":{const r=Rl(n);if(r.length<3)return null;const p=Bt(r[0],o,l,a,i),s=Zl(r[1].trim(),l,a);if(!s)return null;const b=Bt(r[2],o,l,a,i),S=typeof b=="number"?b:parseFloat(String(b));if(isNaN(S))return null;const T=s.sc+(S-1);if(T<s.sc||T>s.ec)return null;if(r.length>=4?Ql(Bt(r[3],o,l,a,i)):!1){let B=-1,x=-1/0;for(let te=s.sr;te<=s.er;te++){const ie=Lt(s.sc,te,o,l,a);typeof ie=="number"&&typeof p=="number"&&ie<=p&&ie>x&&(x=ie,B=te)}return B>=0?Lt(T,B,o,l,a):null}for(let B=s.sr;B<=s.er;B++){const x=Lt(s.sc,B,o,l,a);if(Ta(x,p))return Lt(T,B,o,l,a)}return null}case"CONCATENATE":{const r=Rl(n);let p="";for(const s of r){const b=Bt(s,o,l,a,i);p+=b===null?"":typeof b=="number"?String(b):b}return p}default:return null}}function Ml(e,n,o){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=ol(i[1],n,o);if(r)if(i[2]){const p=ol(i[2],n,o);if(!p)continue;for(let s=Math.min(r.col,p.col);s<=Math.max(r.col,p.col);s++)for(let b=Math.min(r.row,p.row);b<=Math.max(r.row,p.row);b++)l.push(Ut(s,b))}else l.push(Ut(r.col,r.row))}return l}function Ha(e,n,o,l,a){const i=o[Ut(e,n)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const p=Jl(Ut(e,n),o,l,a);return p===null?"#ERROR":String(p)}function Va(e,n,o,l,a,i){return n===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,p,s,b,S)=>{const T=p?El(s):El(s)+n,E=b?parseInt(S,10)-1:parseInt(S,10)-1+o;let B;T<0?B="A":T>=l?B=i(l-1):B=i(T);let x;return E<0?x="1":E>=a?x=String(a):x=String(E+1),(p||"")+B+(b||"")+x})}class Fa{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var l;const o=this.deps.get(n);if(o){for(const a of o)(l=this.rev.get(a))==null||l.delete(n);this.deps.delete(n)}}set(n,o){if(this.clear(n),o.length!==0){this.deps.set(n,o);for(const l of o)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(n)}}markDirty(n){const o=[n];for(;o.length>0;){const l=o.pop(),a=this.rev.get(l);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),o.push(i))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),nl.clear();for(const[a,i]of Object.entries(n))if(i.value.startsWith("=")){const r=Ml(i.value.slice(1),o,l);this.set(a,r)}}}class Oa{constructor(n){if(n&&n.length>0){this.styles=n,this.index=new Map;for(let o=0;o<this.styles.length;o++){const l=this.stableKey(this.styles[o]);this.index.set(l,o)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const o=Object.keys(n).sort(),l={};for(const a of o)l[a]=n[a];return JSON.stringify(l)}get(n){const o=this.styles[n];return o?n===0?o:Object.freeze(o):{}}getId(n){if(!n||Object.keys(n).length===0)return 0;const o=this.stableKey(n),l=this.index.get(o);if(l!==void 0)return l;const a=this.styles.length,i=Object.freeze({...n});return this.styles.push(i),this.index.set(o,a),a}getStyles(){return[...this.styles]}setStyles(n){this.styles=n,this.index=new Map;for(let o=0;o<this.styles.length;o++){const l=this.stableKey(this.styles[o]);this.index.set(l,o)}}compactStyles(n){const o=new Set;o.add(0);for(const r in n){const p=n[r].styleId??0;o.add(p)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((r,p)=>r-p);for(const r of i)if(r!==0&&r<this.styles.length){const p=a.length;l.set(r,p),a.push(this.styles[r])}for(const r in n){const p=n[r],s=p.styleId??0,b=l.get(s);b!==void 0&&b!==s&&(p.styleId=b)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const p=this.stableKey(this.styles[r]);this.index.set(p,r)}return a}}function La(e,n){if(!e)return null;const o=e.styleId;return o===void 0||o===0?null:n[o]??null}function to(e){const n=new Oa,o={};for(const[l,a]of Object.entries(e)){const i={value:a.value};a.styleId!==void 0&&a.styleId>0&&(i.styleId=a.styleId),a.style&&Object.keys(a.style).length>0&&(i.styleId=n.getId(a.style)),i.styleId===0&&delete i.styleId,o[l]=i}return{cells:o,styles:n.getStyles()}}function $a(e){const n={};for(const[o,l]of Object.entries(e)){const a={value:l.value};l.styleId!==void 0&&l.styleId>0&&(a.styleId=l.styleId),n[o]=a}return n}class za{constructor(n){if(n&&n.length>0){this.borders=n,this.index=new Map;for(let o=0;o<this.borders.length;o++){const l=this.stableKey(this.borders[o]);this.index.set(l,o)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const o=["top","right","bottom","left"],l={};for(const a of o){const i=n[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0)){const r={};i.width!==void 0&&(r.width=i.width),i.color!==void 0&&(r.color=i.color),i.style!==void 0&&(r.style=i.style),l[a]=r}}return JSON.stringify(l)}get(n){const o=this.borders[n];return o?n===0?o:Object.freeze(o):{}}getId(n){if(!n||this.isEmptyBorder(n))return 0;const o=this.stableKey(n),l=this.index.get(o);if(l!==void 0)return l;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(n));return this.borders.push(i),this.index.set(o,a),a}isEmptyBorder(n){return!n.top&&!n.right&&!n.bottom&&!n.left}deepCloneBorder(n){const o={};return n.top&&(o.top={...n.top}),n.right&&(o.right={...n.right}),n.bottom&&(o.bottom={...n.bottom}),n.left&&(o.left={...n.left}),o}getBorders(){return[...this.borders]}setBorders(n){this.borders=n,this.index=new Map;for(let o=0;o<this.borders.length;o++){const l=this.stableKey(this.borders[o]);this.index.set(l,o)}}compactBorders(n){const o=new Set;o.add(0);for(const r of n){const p=r.borderId??0;o.add(p)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((r,p)=>r-p);for(const r of i)if(r!==0&&r<this.borders.length){const p=a.length;l.set(r,p),a.push(this.borders[r])}for(const r of n){const p=r.borderId??0,s=l.get(p);s!==void 0&&s!==p&&(r.borderId=s)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const p=this.stableKey(this.borders[r]);this.index.set(p,r)}return a}}function Wa(e,n,o,l){if(!e)return;const a=e.styleId??0,i=o[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const p=l.get(r);if(p)return p[n]}function _a(e,n,o,l,a,i){const r=l[e.styleId??0]??{},p=r.borderId??0,s=p>0?a.get(p):{},b={top:s.top?{...s.top}:void 0,right:s.right?{...s.right}:void 0,bottom:s.bottom?{...s.bottom}:void 0,left:s.left?{...s.left}:void 0};o?b[n]={...o}:b[n]=void 0;const S=a.getId(b),T={...r};S===0?delete T.borderId:T.borderId=S,delete T.borderTopWidth,delete T.borderBottomWidth,delete T.borderLeftWidth,delete T.borderRightWidth,delete T.borderColor,Object.keys(T).length===0?e.styleId=0:e.styleId=i(T)}function lo(e){const n=new za,o=[];for(const l of e){if(!(l.borderTopWidth!==void 0||l.borderBottomWidth!==void 0||l.borderLeftWidth!==void 0||l.borderRightWidth!==void 0)){o.push(l);continue}const i=typeof l.borderColor=="string"?l.borderColor:void 0,r={};l.borderTopWidth!==void 0&&l.borderTopWidth>0&&(r.top={width:l.borderTopWidth,color:i}),l.borderBottomWidth!==void 0&&l.borderBottomWidth>0&&(r.bottom={width:l.borderBottomWidth,color:i}),l.borderLeftWidth!==void 0&&l.borderLeftWidth>0&&(r.left={width:l.borderLeftWidth,color:i}),l.borderRightWidth!==void 0&&l.borderRightWidth>0&&(r.right={width:l.borderRightWidth,color:i});const p=n.getId(r),s={...l};delete s.borderTopWidth,delete s.borderBottomWidth,delete s.borderLeftWidth,delete s.borderRightWidth,delete s.borderColor,p>0?s.borderId=p:delete s.borderId,o.push(s)}return{styles:o,borders:n.getBorders()}}function Ka(e,n){const o=t.reactive({rowCount:e.rowCount??n.rowCount,colCount:e.colCount??n.colCount,width:e.width,height:e.height,theme:e.theme??n.theme,locale:e.locale??n.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??n.rowCount,o.colCount=e.colCount??n.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??n.theme,o.locale=e.locale??n.locale});const l=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),a=o.colCount,i=o.rowCount,r=t.reactive({}),p=t.reactive([{}]),s=t.reactive([{}]);let b=new Map;b.set("{}",0);let S=new Map;S.set("{}",0);function T(h){const k=Object.keys(h).sort(),R={};for(const U of k)R[U]=h[U];return JSON.stringify(R)}function E(h){const k=["top","right","bottom","left"],R={};for(const U of k){const q=h[U];if(q&&(q.width!==void 0||q.color!==void 0||q.style!==void 0)){const he={};q.width!==void 0&&(he.width=q.width),q.color!==void 0&&(he.color=q.color),q.style!==void 0&&(he.style=q.style),R[U]=he}}return JSON.stringify(R)}function B(h){if(!h||Object.keys(h).length===0)return 0;const k=T(h),R=b.get(k);if(R!==void 0)return R;const U=p.length;return p.push(Object.freeze({...h})),b.set(k,U),U}function x(h){return La(h,p)}function te(){b=new Map;for(let h=0;h<p.length;h++)b.set(T(p[h]),h)}function ie(h){p.splice(0,p.length,...h),te()}function g(h){if(!h||!h.top&&!h.right&&!h.bottom&&!h.left)return 0;const k=E(h),R=S.get(k);if(R!==void 0)return R;const U=s.length;return s.push(Object.freeze({top:h.top?Object.freeze({...h.top}):void 0,right:h.right?Object.freeze({...h.right}):void 0,bottom:h.bottom?Object.freeze({...h.bottom}):void 0,left:h.left?Object.freeze({...h.left}):void 0})),S.set(k,U),U}function V(h){return s[h]??{}}function X(){S=new Map;for(let h=0;h<s.length;h++)S.set(E(s[h]),h)}function ae(h){s.splice(0,s.length,...h),X()}function Z(h,k){return Wa(h,k,p,{get:R=>s[R]??{}})}function oe(h,k){const R=C(h,k);return R?R.anchor:null}function ne(h,k,R,U){const q=C(h,k),he=C(R,U);return!q||!he?!1:q.anchor===he.anchor}const ce=t.reactive({}),Ne=new Fa,Ve=t.ref(null),Ye=t.ref("cell"),Le=t.ref({col:0,row:0}),ye=t.ref(null),J=t.ref(""),P=t.ref(new Array(a).fill(100)),fe=t.ref(new Array(i).fill(void 0)),Q=t.ref(0),c=t.ref(0),f=(24-St)/2,m=new Map;let A=null;function I(h,k,R,U){const q=`${U} ${R} ${k}px ${h}`,he=m.get(q);if(he)return he;if(!A){if(typeof document>"u")return{ascent:k*.88,descent:k*.28};A=document.createElement("canvas")}const De=A.getContext("2d");if(!De)return{ascent:k*.88,descent:k*.28};De.font=q;const Te=De.measureText(" "),Ae=Te.fontBoundingBoxAscent,We=Te.fontBoundingBoxDescent;if(typeof Ae=="number"&&typeof We=="number"&&Ae>0&&We>0){const bt={ascent:Ae,descent:We};return m.set(q,bt),bt}const Ie=["M","中","y","Ä","0"];let gt=0,Xe=0;for(const bt of Ie){const Yt=De.measureText(bt),Xt=Yt.actualBoundingBoxAscent||0,Tt=Yt.actualBoundingBoxDescent||0;Xt>gt&&(gt=Xt),Tt>Xe&&(Xe=Tt)}const Gt=Math.max(gt,k*.88),Pt=Math.max(Xe,k*.28),zt={ascent:Gt,descent:Pt};return m.set(q,zt),zt}let O=(h,k)=>`${h},${k}`,C=()=>null,se=()=>St,$=t.computed(()=>[0]),u=()=>24,M=(h,k,R,U)=>({startCol:Math.min(h,R),startRow:Math.min(k,U),endCol:Math.max(h,R),endRow:Math.max(k,U)});function j(h,k){const R=x(r[O(h,k)]),U=se(h,k),q=typeof(R==null?void 0:R.fontFamily)=="string"&&R.fontFamily?R.fontFamily:el,he=(R==null?void 0:R.fontWeight)==="bold"?"bold":"normal",De=(R==null?void 0:R.fontStyle)==="italic"?"italic":"normal";return I(q,U,he,De)}function re(h,k,R,U){if(!k)return[""];const q=k.split(`
2
- `),he=[];for(const De of q)if(!U||R<=0)he.push(De);else{let Te="";for(let Ae=0;Ae<De.length;Ae++){const We=De[Ae],Ie=Te+We;h.measureText(Ie).width>R&&Te?(he.push(Te),Te=We):Te=Ie}he.push(Te)}return he}function W(h,k){const R=x(r[O(h,k)]);return typeof(R==null?void 0:R.fontSize)=="number"&&R.fontSize>0?R.fontSize:St}se=W;const ke=t.computed(()=>{const h=[0];for(let k=0;k<a;k++)h.push(h[k]+P.value[k]);return h});$=ke;const Ke={w:800,h:600};let nt=()=>{};function rt(h){const k=fe.value[h];if(k!=null&&k>0)return k;let R,U,q=1;const he=A?A.getContext("2d"):null,De=I(el,St,"normal","normal");R=De.ascent,U=De.descent;for(let Ie=0;Ie<a;Ie++){const gt=W(Ie,h),Xe=x(r[O(Ie,h)]),Gt=typeof(Xe==null?void 0:Xe.fontFamily)=="string"&&Xe.fontFamily?Xe.fontFamily:el,Pt=(Xe==null?void 0:Xe.fontWeight)==="bold"?"bold":"normal",zt=(Xe==null?void 0:Xe.fontStyle)==="italic"?"italic":"normal",bt=I(Gt,gt,Pt,zt);bt.ascent>R&&(R=bt.ascent),bt.descent>U&&(U=bt.descent);const Yt=typeof(Xe==null?void 0:Xe.numberFormat)=="string"?Xe.numberFormat:"",Xt=ut(Ie,h),Tt=wl(Xt,Yt,l.value);if(Tt){const Tl=(Xe==null?void 0:Xe.wrap)==="wrap";let Nt;if(Tl&&he){he.font=`${zt} ${Pt} ${gt}px ${Gt}`;const jt=C(Ie,h);let Wt;jt&&Ie===jt.range.startCol&&h===jt.range.startRow?Wt=$.value[jt.range.endCol+1]-$.value[Ie]:Wt=P.value[Ie],Nt=re(he,Tt,Math.max(0,Wt-10),!0).length,Nt>q&&(q=Nt)}else Nt=Tt.split(`
3
- `).length,Nt>q&&(q=Nt)}}const Te=R+U,Ae=f*2+q*Te;return Math.min(500,Math.max(24,Math.round(Ae)))}u=rt;function H(h){return fe.value[h]===void 0}const D=t.computed(()=>{const h=[0];for(let k=0;k<i;k++)h.push(h[k]+u(k));return h}),G=t.computed(()=>ke.value[a]),ve=t.computed(()=>D.value[i]);function L(h,k){return`${h},${k}`}O=L;function Y(h){Reflect.deleteProperty(r,h)}function Be(h,k){Ye.value="cell";const R=C(h,k);R?(Le.value={col:R.range.startCol,row:R.range.startRow},Ve.value={...R.range}):(Le.value={col:h,row:k},Ve.value={startCol:h,startRow:k,endCol:h,endRow:k})}function de(h,k,R,U,q="cell"){const he=C(h,k);if(Le.value=he?{col:he.range.startCol,row:he.range.startRow}:{col:h,row:k},Ye.value=q,q==="row"||q==="col"){const De=Math.min(h,R),Te=Math.max(h,R),Ae=Math.min(k,U),We=Math.max(k,U);Ve.value={startCol:De,startRow:Ae,endCol:Te,endRow:We}}else Ve.value=M(h,k,R,U)}function Re(){de(0,0,a-1,i-1,"all")}function Fe(h,k){const R=Ve.value;return R?(Ye.value==="cell"||Ye.value==="all",h>=R.startCol&&h<=R.endCol&&k>=R.startRow&&k<=R.endRow):!1}function Ze(h,k){return Fe(h,k)}function et(h,k){for(const R in ce){const U=ce[R];if(U&&h>=U.startCol&&h<=U.endCol&&k>=U.startRow&&k<=U.endRow)return{range:U,anchor:R}}return null}C=et;function it(h,k){return ce[L(h,k)]!==void 0}function ft(h,k){const R=C(h,k);if(R&&h===R.range.startCol&&k===R.range.startRow){const U=ke.value[R.range.endCol+1]-ke.value[h],q=D.value[R.range.endRow+1]-D.value[k];return{w:U,h:q}}return{w:P.value[h],h:u(k)}}function Dt(h,k,R,U){let q=Math.min(h,R),he=Math.max(h,R),De=Math.min(k,U),Te=Math.max(k,U),Ae=!0;for(;Ae;){Ae=!1;for(const We in ce){const Ie=ce[We];if(!Ie)continue;Ie.startCol<=he&&Ie.endCol>=q&&Ie.startRow<=Te&&Ie.endRow>=De&&(Ie.startCol<q&&(q=Ie.startCol,Ae=!0),Ie.endCol>he&&(he=Ie.endCol,Ae=!0),Ie.startRow<De&&(De=Ie.startRow,Ae=!0),Ie.endRow>Te&&(Te=Ie.endRow,Ae=!0))}}return{startCol:q,startRow:De,endCol:he,endRow:Te}}M=Dt;function ct(h,k){var R;return((R=r[L(h,k)])==null?void 0:R.value)??""}function ut(h,k){return Bl(),Ha(h,k,r,a,i)}function ht(h,k,R){var Te,Ae;const U=L(h,k);if(Bl(),R===""||R==null){Ne.clear(U);const We=(Te=r[U])==null?void 0:Te.styleId;We!==void 0&&We>0?r[U]={value:"",styleId:We}:Y(U),Ne.markDirty(U);return}const q=String(R),he=(Ae=r[U])==null?void 0:Ae.styleId,De={value:q};he!==void 0&&he>0&&(De.styleId=he),r[U]=De,q.startsWith("=")?Ne.set(U,Ml(q.slice(1),a,i)):Ne.clear(U),Ne.markDirty(U)}function rl(h,k,R,U){for(let q=h;q<=k;q++)for(let he=R;he<=U;he++){const De=L(q,he);Ne.clear(De),Y(De),Ne.markDirty(De)}}let $t=()=>{};function Ct(h){ye.value||(ye.value={...Le.value},h!==void 0?J.value=h:J.value||(J.value=ct(Le.value.col,Le.value.row)))}function at(){ye.value&&($t(),ht(ye.value.col,ye.value.row,J.value),ye.value=null,J.value="")}function st(){ye.value=null,J.value=""}function w(h,k){const R=Le.value;let U=Math.max(0,Math.min(a-1,R.col+h)),q=Math.max(0,Math.min(i-1,R.row+k));const he=C(R.col,R.row),De=C(U,q);he&&De&&he.anchor===De.anchor&&(h>0?U=he.range.endCol+1:h<0&&(U=he.range.startCol-1),k>0?q=he.range.endRow+1:k<0&&(q=he.range.startRow-1),U=Math.max(0,Math.min(a-1,U)),q=Math.max(0,Math.min(i-1,q))),Be(U,q)}function F(h,k){const R=Math.max(0,Ke.w-52-11),U=Math.max(0,Ke.h-24-11),q=ke.value[h],he=D.value[k],De=C(h,k),Te=De?ke.value[De.range.endCol+1]-ke.value[h]:P.value[h],Ae=De?D.value[De.range.endRow+1]-D.value[k]:u(k);let We=Q.value,Ie=c.value;q<We?We=q:q+Te>We+R&&(We=q+Te-R),he<Ie?Ie=he:he+Ae>Ie+U&&(Ie=he+Ae-U),nt(We,Ie)}function me(h){const k=ke.value;if(h<0||h>=k[a])return-1;let R=0,U=a-1;for(;R<U;){const q=R+U+1>>1;k[q]<=h?R=q:U=q-1}return R}function Ce(h){const k=D.value;if(h<0||h>=k[i])return-1;let R=0,U=i-1;for(;R<U;){const q=R+U+1>>1;k[q]<=h?R=q:U=q-1}return R}const pe={props:o,locale:l,colCount:a,rowCount:i,cells:r,styles:p,borders:s,merges:ce,formulaDeps:Ne,selection:Ve,activeCell:Le,editingCell:ye,editValue:J,colWidths:P,rowHeights:fe,scrollX:Q,scrollY:c,BASE_CELL_VPAD:f,fontMetricsCache:m,fontMetricsCanvas:A,measureFontMetrics:I,_getFontMetricsForCell:j,getWrappedLines:re,cellFontSize:W,colPositions:ke,getRowHeight:rt,_isAutoRow:H,rowPositions:D,totalWidth:G,totalHeight:ve,selectCell:Be,selectRange:de,selectAll:Re,isSelected:Fe,isCellSelected:Ze,selectionMode:Ye,cellKey:L,delCell:Y,findMerge:et,_isMergeAnchor:it,_mergedSpan:ft,expandSelectionForMerges:Dt,getCellRaw:ct,getCellValue:ut,setCellValue:ht,clearCellsInRange:rl,startEdit:Ct,commitEdit:at,cancelEdit:st,moveActive:w,ensureVisible:F,hitCol:me,hitRow:Ce,registerStyle:B,resolveStyle:x,rebuildStyleIndex:te,syncStyles:ie,registerBorder:g,resolveBorder:V,rebuildBorderIndex:X,syncBorders:ae,getCellBorderSide:Z,getMergeOwner:oe,isSameMergeInternal:ne,viewSize:Ke,findHighlight:(h,k)=>null};return $t=()=>{var h;return(h=pe.saveUndo)==null?void 0:h.call(pe)},nt=(h,k)=>{var R;return(R=pe.clampScroll)==null?void 0:R.call(pe,h,k)},pe}function Ua(e,n){const o=t.ref([]),l=t.ref([]);function a(w){return $a(w)}function i(){return n.saveSheet(),{sheets:n.sheets.value.map(w=>({id:w.id,name:w.name,cells:a(w.cells),styles:[...w.styles],borders:w.borders?[...w.borders]:[{}],merges:w.merges?{...w.merges}:{},selection:w.selection?{...w.selection}:null,activeCell:w.activeCell?{...w.activeCell}:{col:0,row:0},scrollX:w.scrollX,scrollY:w.scrollY,colWidths:[...w.colWidths],rowHeights:[...w.rowHeights]})),styles:[...e.styles],activeSheetIndex:n.activeSheetIndex.value}}function r(w){n.sheets.value=w.sheets.map(F=>({...F,cells:a(F.cells),styles:[...F.styles],borders:F.borders?[...F.borders]:[{}]})),n.loadSheet(Math.max(0,Math.min(w.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function p(){const w=i(),F=o.value[o.value.length-1];F&&JSON.stringify(F)===JSON.stringify(w)||(o.value.push(w),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=p;function s(){var w;o.value.length&&(l.value.push(i()),r(o.value.pop()),(w=e.scheduleRender)==null||w.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}function b(){var w;l.value.length&&(o.value.push(i()),r(l.value.pop()),(w=e.scheduleRender)==null||w.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}const S=t.computed(()=>o.value.length>0),T=t.computed(()=>l.value.length>0),E=t.computed(()=>!!e.selection.value),B=t.ref(null);function x(){var me;const w=e.selection.value;if(!w)return;const F={};for(let Ce=w.startCol;Ce<=w.endCol;Ce++)for(let pe=w.startRow;pe<=w.endRow;pe++)F[`${Ce-w.startCol},${pe-w.startRow}`]=((me=e.cells[e.cellKey(Ce,pe)])==null?void 0:me.styleId)??0;B.value={styles:F}}function te(){var me,Ce,pe;const w=B.value,F=e.selection.value;if(!(!w||!F)){p();for(let h=F.startCol;h<=F.endCol;h++)for(let k=F.startRow;k<=F.endRow;k++){const R=e.findMerge(h,k);if(R&&(h!==R.range.startCol||k!==R.range.startRow))continue;const U=w.styles[`${h-F.startCol},${k-F.startRow}`]??0,q=e.cellKey(h,k),he=((me=e.cells[q])==null?void 0:me.value)??"";if(he===""&&U===0)e.delCell(q);else{const De={value:he};U>0&&(De.styleId=U),e.cells[q]=De}}B.value=null,(Ce=e.scheduleRender)==null||Ce.call(e),(pe=e.emitModelData)==null||pe.call(e)}}function ie(){var F,me,Ce;const w=e.selection.value;if(w){p();for(let pe=w.startCol;pe<=w.endCol;pe++)for(let h=w.startRow;h<=w.endRow;h++){const k=e.findMerge(pe,h);if(k&&(pe!==k.range.startCol||h!==k.range.startRow))continue;const R=e.cellKey(pe,h),U=((F=e.cells[R])==null?void 0:F.value)??"";U===""?e.delCell(R):e.cells[R]={value:U}}(me=e.scheduleRender)==null||me.call(e),(Ce=e.emitModelData)==null||Ce.call(e)}}const g=t.computed(()=>po.map(w=>({...w,label:w.value===""?N(e.locale.value,"fontDefault"):w.label}))),V=t.computed(()=>ho.map(w=>({...w,label:String(w.value)}))),X="\0",ae=t.computed(()=>{const w=e.selection.value;if(!w)return"";let F,me=!1;for(let Ce=w.startCol;Ce<=w.endCol&&!me;Ce++)for(let pe=w.startRow;pe<=w.endRow&&!me;pe++){const h=e.findMerge(Ce,pe);if(h&&(Ce!==h.range.startCol||pe!==h.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(Ce,pe)]),R=typeof(k==null?void 0:k.fontFamily)=="string"?k.fontFamily:"";F===void 0?F=R:R!==F&&(me=!0)}return me?X:F??""}),Z=t.computed(()=>{const w=e.selection.value;if(!w)return St;let F,me=!1;for(let Ce=w.startCol;Ce<=w.endCol&&!me;Ce++)for(let pe=w.startRow;pe<=w.endRow&&!me;pe++){const h=e.findMerge(Ce,pe);if(h&&(Ce!==h.range.startCol||pe!==h.range.startRow))continue;const k=e.cellFontSize(Ce,pe);F===void 0?F=k:k!==F&&(me=!0)}return me?0:F??St});function oe(w,F){var Ce,pe,h;const me=e.selection.value;if(me){p();for(let k=me.startCol;k<=me.endCol;k++)for(let R=me.startRow;R<=me.endRow;R++){const U=e.findMerge(k,R);if(U&&(k!==U.range.startCol||R!==U.range.startRow))continue;const q=e.cellKey(k,R),he=((Ce=e.cells[q])==null?void 0:Ce.value)??"";let Te={...e.resolveStyle(e.cells[q])??{}};if(F===""||F===null||F===void 0||F===0){const{[w]:We,...Ie}=Te;Te=Ie}else Te[w]=F;const Ae=Object.keys(Te).length?e.registerStyle(Te):0;if(he===""&&Ae===0)e.delCell(q);else{const We={value:he};Ae>0&&(We.styleId=Ae),e.cells[q]=We}}(pe=e.scheduleRender)==null||pe.call(e),(h=e.emitModelData)==null||h.call(e)}}function ne(w){oe("fontFamily",w===""?"":w)}const ce=t.ref(!1),Ne=t.ref(!1),Ve=t.ref(!1),Ye=t.ref(!1),Le=t.ref(!1);function ye(w){oe("fontSize",w),ce.value=!1}const J=t.computed(()=>ko.map(w=>({label:N(e.locale.value,w.labelKey),value:w.value,icon:w.icon}))),P=t.computed(()=>Eo.map(w=>({label:N(e.locale.value,w.labelKey),value:w.value,icon:w.icon}))),fe=t.computed(()=>{const w=e.selection.value;if(!w)return"left";const F=e.resolveStyle(e.cells[e.cellKey(w.startCol,w.startRow)]),me=typeof(F==null?void 0:F.textAlign)=="string"?F.textAlign:"";return me==="center"||me==="right"?me:"left"}),Q=t.computed(()=>{const w=e.selection.value;if(!w)return"top";const F=e.resolveStyle(e.cells[e.cellKey(w.startCol,w.startRow)]),me=typeof(F==null?void 0:F.verticalAlign)=="string"?F.verticalAlign:"";return me==="middle"||me==="bottom"?me:"top"}),c=t.computed(()=>{const w=e.selection.value;if(!w)return!1;const F=e.resolveStyle(e.cells[e.cellKey(w.startCol,w.startRow)]);return(F==null?void 0:F.wrap)==="wrap"});function f(w){oe("textAlign",w)}function m(w){oe("verticalAlign",w)}function A(){if(!e.selection.value)return;const F=c.value;oe("wrap",F?void 0:"wrap")}const I=t.ref(""),O=ce;t.watch(Z,w=>{I.value=w===0?"":String(w)},{immediate:!0});function C(w){const F=w.replace(/[^\d]/g,"");I.value=F;const me=parseInt(F,10);!isNaN(me)&&me>=5&&me<=72&&me!==Z.value&&oe("fontSize",me)}function se(){const w=I.value.trim();if(!w){I.value=Z.value===0?"":String(Z.value);return}let F=parseInt(w,10);isNaN(F)?F=Z.value===0?St:Z.value:F=Math.max(5,Math.min(72,F)),I.value=String(F),F!==Z.value&&oe("fontSize",F)}function $(w){w.key==="Enter"&&w.target.blur()}function u(w){w&&w.preventDefault(),O.value=!O.value,O.value&&(Ve&&(Ve.value=!1),Ne&&(Ne.value=!1),Ye.value=!1,Le.value=!1)}function M(){const w=Z.value===0?St:Z.value,F=Math.min(72,w+1);oe("fontSize",F),I.value=String(F),O.value=!1}function j(){const w=Z.value===0?St:Z.value,F=Math.max(5,w-1);oe("fontSize",F),I.value=String(F),O.value=!1}function re(w){const F=e.selection.value;if(!F)return!1;let me,Ce=!1;for(let pe=F.startCol;pe<=F.endCol&&!Ce;pe++)for(let h=F.startRow;h<=F.endRow&&!Ce;h++){const k=e.findMerge(pe,h);if(k&&(pe!==k.range.startCol||h!==k.range.startRow))continue;const R=e.resolveStyle(e.cells[e.cellKey(pe,h)]),U=!!(R!=null&&R[w]);me===void 0?me=U:U!==me&&(Ce=!0)}return!Ce&&me===!0}const W=t.computed(()=>re("fontWeight")),ke=t.computed(()=>re("fontStyle")),Ke=t.computed(()=>re("underline")),nt=t.computed(()=>re("strikethrough"));function rt(){oe("fontWeight",W.value?"":"bold")}function H(){oe("fontStyle",ke.value?"":"italic")}function D(){oe("underline",Ke.value?"":"underline")}function G(){oe("strikethrough",nt.value?"":"line-through")}const ve=t.ref(""),L=t.ref(""),Y=Ye,Be=Le;function de(){Y.value=!Y.value,Be.value=!1,Ne&&(Ne.value=!1),Ve&&(Ve.value=!1)}function Re(){Be.value=!Be.value,Y.value=!1,Ne&&(Ne.value=!1),Ve&&(Ve.value=!1)}function Fe(w){Ne&&(Ne.value=w),w&&(Y.value=!1,Be.value=!1,Ve&&(Ve.value=!1))}function Ze(w){ve.value=w,oe("color",w===""?"":w)}function et(w){L.value=w,oe("backgroundColor",w===""?"":w)}function it(){oe("color",ve.value===""?"":ve.value)}function ft(){oe("backgroundColor",L.value===""?"":L.value)}const Dt=t.computed(()=>{const w=e.selection.value;if(!w)return"";let F,me=!1;for(let Ce=w.startCol;Ce<=w.endCol&&!me;Ce++)for(let pe=w.startRow;pe<=w.endRow&&!me;pe++){const h=e.findMerge(Ce,pe);if(h&&(Ce!==h.range.startCol||pe!==h.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(Ce,pe)]),R=typeof(k==null?void 0:k.color)=="string"?k.color:"";F===void 0?F=R:R!==F&&(me=!0)}return me?"":F??""}),ct=t.computed(()=>{const w=e.selection.value;if(!w)return"";let F,me=!1;for(let Ce=w.startCol;Ce<=w.endCol&&!me;Ce++)for(let pe=w.startRow;pe<=w.endRow&&!me;pe++){const h=e.findMerge(Ce,pe);if(h&&(Ce!==h.range.startCol||pe!==h.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(Ce,pe)]),R=typeof(k==null?void 0:k.backgroundColor)=="string"?k.backgroundColor:"";F===void 0?F=R:R!==F&&(me=!0)}return me?"":F??""}),ut=t.computed(()=>Uo(e.locale.value)),ht=t.ref(!1),rl=t.computed(()=>{const w=e.selection.value;if(!w)return dl;let F,me=!1;for(let Ce=w.startCol;Ce<=w.endCol&&!me;Ce++)for(let pe=w.startRow;pe<=w.endRow&&!me;pe++){const h=e.findMerge(Ce,pe);if(h&&(Ce!==h.range.startCol||pe!==h.range.startRow))continue;const k=e.resolveStyle(e.cells[e.cellKey(Ce,pe)]),R=typeof(k==null?void 0:k.numberFormat)=="string"?k.numberFormat:"";F===void 0?F=R:R!==F&&(me=!0)}return me?sl:F??dl});function $t(w){oe("numberFormat",w)}function Ct(w){if(w===Ol){ht.value=!0;return}$t(w)}function at(){ht.value=!0}return{undoStack:o,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:p,undo:s,redo:b,canUndo:S,canRedo:T,hasSelection:E,paintFmt:B,onPaintFormat:x,applyPaintFormat:te,clearFormat:ie,fontFamilyOptions:g,fontSizeOptions:V,FONT_FAMILY_MIXED:X,selFontFamily:ae,selFontSize:Z,applyStyleToSelection:oe,onFontFamilyChange:ne,onFontSizeChange:ye,hAlignOptions:J,vAlignOptions:P,selHAlign:fe,selVAlign:Q,selWrap:c,onHAlignChange:f,onVAlignChange:m,onWrapToggle:A,fontSizeInput:I,fontSizeMenuOpen:O,onFontSizeInput:C,onFontSizeBlur:se,onFontSizeKeydown:$,toggleFontSizeMenu:u,onFontSizeStepUp:M,onFontSizeStepDown:j,selFontWeight:W,selFontStyle:ke,selUnderline:Ke,selStrikethrough:nt,toggleFontWeight:rt,toggleFontStyle:H,toggleUnderline:D,toggleStrikethrough:G,cachedTextColor:ve,cachedFillColor:L,textColorMenuOpen:Y,fillColorMenuOpen:Be,_toggleTextColorMenu:de,_toggleFillColorMenu:Re,onBorderMenuToggle:Fe,onTextColorChange:Ze,onFillColorChange:et,applyCachedTextColor:it,applyCachedFillColor:ft,selTextColor:Dt,selFillColor:ct,nfOptions:ut,selNumberFormat:rl,NF_NUMBER_FORMAT_MIXED:sl,nfDialogOpen:ht,onNumberFormatChange:Ct,openNumberFormatDialog:at,applyNumberFormatCode:$t}}function Ga(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{l&&(l.value=i),i&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,a&&(a.value=!1))},e.toggleFontSizeMenu=i=>{i&&i.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(a&&(a.value=!1),l&&(l.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)}})()}function Pa(e,n){const o=t.ref("none"),l=t.ref(!1),a="#444";function i(m,A,I,O){if(m<0||A<0||m>=e.colCount||A>=e.rowCount)return;const C=e.findMerge(m,A),se=C?C.anchor:e.cellKey(m,A);if(!e.cells[se]){if(!O)return;e.cells[se]={value:""}}_a(e.cells[se],I,O,e.styles,{get:u=>e.resolveBorder(u),getId:u=>e.registerBorder(u)},e.registerStyle)}function r(m,A,I){var M;const O=e.findMerge(m,A),C=O?O.anchor:e.cellKey(m,A),se=((M=e.cells[C])==null?void 0:M.value)??"",$=e.resolveStyle(e.cells[C])?{...e.resolveStyle(e.cells[C])}:{},u=e.registerBorder(I);if(u>0?$.borderId=u:delete $.borderId,delete $.borderTopWidth,delete $.borderBottomWidth,delete $.borderLeftWidth,delete $.borderRightWidth,delete $.borderColor,se===""&&!Object.keys($).length)e.delCell(C);else{const j=e.registerStyle($);e.cells[C]={value:se,styleId:j||void 0}}}function p(m){var M,j;o.value=m;const A=e.selection.value;if(!A)return;n.saveUndo();const{startCol:I,startRow:O,endCol:C,endRow:se}=A,$={width:1,color:a},u={width:2,color:a};if(m==="none")for(let re=I;re<=C;re++)for(let W=O;W<=se;W++){const ke=e.findMerge(re,W);ke&&(re!==ke.range.startCol||W!==ke.range.startRow)||r(re,W,{})}else if(m==="all")for(let re=I;re<=C;re++)for(let W=O;W<=se;W++){const ke=e.findMerge(re,W);ke&&(re!==ke.range.startCol||W!==ke.range.startRow)||r(re,W,{top:$,right:$,bottom:$,left:$})}else if(m==="outer"||m==="thickOuter"){const re=m==="thickOuter"?u:$;for(let W=I;W<=C;W++)i(W,O,"top",re);for(let W=I;W<=C;W++)i(W,se,"bottom",re);for(let W=O;W<=se;W++)i(I,W,"left",re);for(let W=O;W<=se;W++)i(C,W,"right",re)}else{const W={top:{side:"top",edgeCheck:(ke,Ke)=>Ke===O},bottom:{side:"bottom",edgeCheck:(ke,Ke)=>Ke===se},left:{side:"left",edgeCheck:(ke,Ke)=>ke===I},right:{side:"right",edgeCheck:(ke,Ke)=>ke===C}}[m];if(W)for(let ke=I;ke<=C;ke++)for(let Ke=O;Ke<=se;Ke++)W.edgeCheck(ke,Ke)&&i(ke,Ke,W.side,$)}(M=e.scheduleRender)==null||M.call(e),(j=e.emitModelData)==null||j.call(e)}function s(){p(o.value)}function b(m,A,I){const O=I.toLowerCase(),C=e.findMerge(m,A);if(C){if(O==="top"&&A!==C.range.startRow||O==="bottom"&&A!==C.range.endRow||O==="left"&&m!==C.range.startCol||O==="right"&&m!==C.range.endCol)return 0;const $=e.getCellBorderSide(e.cells[C.anchor],O);return($==null?void 0:$.width)??0}const se=e.getCellBorderSide(e.cells[e.cellKey(m,A)],O);return(se==null?void 0:se.width)??0}const S=t.ref(!1);function T(m){S.value=m,m&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1)}function E(m,A,I,O){const C=[];for(const se in e.merges){const $=e.merges[se];$&&$.startCol<=I&&$.endCol>=m&&$.startRow<=O&&$.endRow>=A&&C.push(se)}for(const se of C)Reflect.deleteProperty(e.merges,se)}function B(){var se,$,u;const m=e.selection.value;if(!m||m.startCol===m.endCol&&m.startRow===m.endRow)return;n.saveUndo(),E(m.startCol,m.startRow,m.endCol,m.endRow);const A=e.cellKey(m.startCol,m.startRow),I=((se=e.cells[A])==null?void 0:se.value)??"";for(let M=m.startCol;M<=m.endCol;M++)for(let j=m.startRow;j<=m.endRow;j++)M===m.startCol&&j===m.startRow||e.clearCellsInRange(M,M,j,j);const O=e.resolveStyle(e.cells[A])?{...e.resolveStyle(e.cells[A])}:{};O.textAlign="center";const C=e.registerStyle(O);e.cells[A]={value:I,styleId:C||void 0},e.merges[A]={startCol:m.startCol,startRow:m.startRow,endCol:m.endCol,endRow:m.endRow},e.selectCell(m.startCol,m.startRow),($=e.scheduleRender)==null||$.call(e),(u=e.emitModelData)==null||u.call(e)}function x(){var A,I,O;const m=e.selection.value;if(!(!m||m.startCol===m.endCol)){n.saveUndo();for(let C=m.startRow;C<=m.endRow;C++){E(m.startCol,C,m.endCol,C);const se=e.cellKey(m.startCol,C);(A=e.cells[se])==null||A.value;for(let $=m.startCol+1;$<=m.endCol;$++)e.clearCellsInRange($,$,C,C);e.merges[se]={startCol:m.startCol,startRow:C,endCol:m.endCol,endRow:C}}e.selectRange(m.startCol,m.startRow,m.endCol,m.endRow),(I=e.scheduleRender)==null||I.call(e),(O=e.emitModelData)==null||O.call(e)}}function te(){var I,O,C;const m=e.selection.value;if(!m||m.startCol===m.endCol&&m.startRow===m.endRow)return;n.saveUndo(),E(m.startCol,m.startRow,m.endCol,m.endRow);const A=e.cellKey(m.startCol,m.startRow);(I=e.cells[A])==null||I.value;for(let se=m.startCol;se<=m.endCol;se++)for(let $=m.startRow;$<=m.endRow;$++)se===m.startCol&&$===m.startRow||e.clearCellsInRange(se,se,$,$);e.merges[A]={startCol:m.startCol,startRow:m.startRow,endCol:m.endCol,endRow:m.endRow},e.selectCell(m.startCol,m.startRow),(O=e.scheduleRender)==null||O.call(e),(C=e.emitModelData)==null||C.call(e)}function ie(){var A,I;const m=e.selection.value;m&&(n.saveUndo(),E(m.startCol,m.startRow,m.endCol,m.endRow),(A=e.scheduleRender)==null||A.call(e),(I=e.emitModelData)==null||I.call(e))}function g(){const m=e.selection.value;if(!m)return;const A=e.findMerge(m.startCol,m.startRow);A&&m.startCol===A.range.startCol&&m.startRow===A.range.startRow&&m.endCol===A.range.endCol&&m.endRow===A.range.endRow?ie():B()}function V(m){switch(m){case"mergeCenter":B();break;case"mergeAcross":x();break;case"mergeCells":te();break;case"unmergeCells":ie();break}}let X=null,ae=[];function Z(m,A,I,O){ae=[];for(let C=I;C<=O;C++){const se=[];for(let $=m;$<=A;$++){const u=e.cells[e.cellKey($,C)];se.push((u==null?void 0:u.styleId)??0)}ae.push(se)}}function oe(m,A,I,O){const C=e.cellKey(m,A);if(Bl(),I===""||I==null){e.formulaDeps.clear(C),O&&O>0?e.cells[C]={value:"",styleId:O}:e.delCell(C),e.formulaDeps.markDirty(C);return}e.cells[C]={value:I,styleId:O&&O>0?O:void 0},I.startsWith("=")?e.formulaDeps.set(C,Ml(I.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(C),e.formulaDeps.markDirty(C)}function ne(){const m=e.selection.value;if(!m)return;X={...m},Z(m.startCol,m.endCol,m.startRow,m.endRow);const A=[];for(let I=m.startRow;I<=m.endRow;I++){const O=[];for(let C=m.startCol;C<=m.endCol;C++)O.push(e.getCellRaw(C,I));A.push(O.join(" "))}Sl(A.join(`
4
- `))}function ce(){const m=e.selection.value;if(m){if(m.startCol===0&&m.endCol===e.colCount-1){X={...m},Z(0,e.colCount-1,m.startRow,m.endRow);const A=[];for(let I=m.startRow;I<=m.endRow;I++){const O=[];for(let C=0;C<e.colCount;C++)O.push(e.getCellRaw(C,I));A.push(O.join(" "))}Sl(A.join(`
5
- `))}else if(m.startRow===0&&m.endRow===e.rowCount-1){X={...m},Z(m.startCol,m.endCol,0,e.rowCount-1);const A=[];for(let I=0;I<e.rowCount;I++){const O=[];for(let C=m.startCol;C<=m.endCol;C++)O.push(e.getCellRaw(C,I));A.push(O.join(" "))}Sl(A.join(`
6
- `))}}}async function Ne(){var se;let m;try{m=await navigator.clipboard.readText()}catch{return}if(!m&&m!=="")return;const A=m.split(/\r?\n/),I=e.activeCell.value,O=X,C=O&&ae.length>0;for(let $=0;$<A.length;$++){const u=A[$].split(" ");for(let M=0;M<u.length;M++){const j=I.col+M,re=I.row+$;if(j<e.colCount&&re<e.rowCount){let W=u[M];if(W.startsWith("=")&&O&&(W=Va(W,j-(O.startCol+M),re-(O.startRow+$),e.colCount,e.rowCount,Pe)),C&&$<ae.length&&M<(((se=ae[$])==null?void 0:se.length)??0)){const ke=ae[$][M]??null;oe(j,re,W,ke)}else e.setCellValue(j,re,W)}}}}function Ve(){var m;if(n.saveUndo(),ne(),e.selection.value){const A=e.selection.value;e.clearCellsInRange(A.startCol,A.endCol,A.startRow,A.endRow),(m=e.scheduleRender)==null||m.call(e)}}function Ye(){var m;if(e.selection.value){const A=e.selection.value;e.clearCellsInRange(A.startCol,A.endCol,A.startRow,A.endRow),(m=e.scheduleRender)==null||m.call(e)}}function Le(){var se,$;const m=e.selection.value;if(!m)return;n.saveUndo();const A=m.startCol,I=m.startRow,O=m.endCol,C=m.endRow;if(I===C)if(O+1<e.colCount){const u=`${Pe(A)}${I+1}:${Pe(O)}${I+1}`;e.setCellValue(O+1,I,`=SUM(${u})`)}else{const u=`${Pe(A)}${I+1}:${Pe(O-1)}${I+1}`;e.setCellValue(O,I,`=SUM(${u})`)}else for(let u=A;u<=O;u++)if(C+1<e.rowCount){const M=`${Pe(u)}${I+1}:${Pe(u)}${C+1}`;e.setCellValue(u,C+1,`=SUM(${M})`)}else{const M=`${Pe(u)}${I+1}:${Pe(u)}${C}`;e.setCellValue(u,C,`=SUM(${M})`)}(se=e.scheduleRender)==null||se.call(e),($=e.emitModelData)==null||$.call(e)}function ye(){var se,$;const m=e.selection.value;if(!m)return;n.saveUndo();const A=m.startCol,I=m.startRow,O=m.endCol,C=m.endRow;if(I===C)if(O+1<e.colCount){const u=`${Pe(A)}${I+1}:${Pe(O)}${I+1}`;e.setCellValue(O+1,I,`=AVERAGE(${u})`)}else{const u=`${Pe(A)}${I+1}:${Pe(O-1)}${I+1}`;e.setCellValue(O,I,`=AVERAGE(${u})`)}else for(let u=A;u<=O;u++)if(C+1<e.rowCount){const M=`${Pe(u)}${I+1}:${Pe(u)}${C+1}`;e.setCellValue(u,C+1,`=AVERAGE(${M})`)}else{const M=`${Pe(u)}${I+1}:${Pe(u)}${C}`;e.setCellValue(u,C,`=AVERAGE(${M})`)}(se=e.scheduleRender)==null||se.call(e),($=e.emitModelData)==null||$.call(e)}function J(){var se,$;const m=e.selection.value;if(!m)return;n.saveUndo();const A=m.startCol,I=m.startRow,O=m.endCol,C=m.endRow;if(I===C)if(O+1<e.colCount){const u=`${Pe(A)}${I+1}:${Pe(O)}${I+1}`;e.setCellValue(O+1,I,`=COUNT(${u})`)}else{const u=`${Pe(A)}${I+1}:${Pe(O-1)}${I+1}`;e.setCellValue(O,I,`=COUNT(${u})`)}else for(let u=A;u<=O;u++)if(C+1<e.rowCount){const M=`${Pe(u)}${I+1}:${Pe(u)}${C+1}`;e.setCellValue(u,C+1,`=COUNT(${M})`)}else{const M=`${Pe(u)}${I+1}:${Pe(u)}${C}`;e.setCellValue(u,C,`=COUNT(${M})`)}(se=e.scheduleRender)==null||se.call(e),($=e.emitModelData)==null||$.call(e)}const P=t.ref(!1);function fe(m){P.value=m,m&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1,S.value=!1)}function Q(){Le(),P.value=!1}function c(){ye(),P.value=!1}function f(){J(),P.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:p,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:s,cellBorderWidth:b,mergeMenuOpen:S,onMergeMenuToggle:T,removeOverlappingMerges:E,mergeAndCenter:B,mergeAcross:x,mergeCells:te,unmergeCells:ie,onApplyMerge:g,onMergeChange:V,copySourceRange:null,copySourceStyles:[],captureStyles:Z,setCellWithStyle:oe,copyToClipboard:ne,copyRowCol:ce,pasteFromClipboard:Ne,cutSelected:Ve,clearSelected:Ye,sumSelected:Le,avgSelected:ye,countSelected:J,calcMenuOpen:P,onCalcMenuToggle:fe,onCalcSum:Q,onCalcAvg:c,onCalcCount:f}}function Ya(e,n,o,l){const a={},i=l(n),r=l(o);return i!=null&&(a.width=`${i}px`),r!=null&&(a.height=`${r}px`),a["--sp-formula-bar-bg"]=e.formulaBarBg,a["--sp-formula-bar-border"]=e.formulaBarBorder,a["--sp-formula-bar-label-color"]=e.formulaBarLabelText,a["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,a["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,a["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,a["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,a["--sp-formula-bar-input-color"]=e.formulaBarInputText,a["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,a["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,a["--sp-wrapper-bg"]=e.wrapperBg,a["--sp-cell-editor-border"]=e.cellEditorBorder,a["--sp-cell-editor-color"]=e.cellEditorText,a["--sp-cell-editor-bg"]=e.cellEditorBg,a["--sp-cell-editor-shadow"]=e.cellEditorShadow,a["--sp-tab-bar-bg"]=e.tabBarBg,a["--sp-tab-bar-border"]=e.tabBarBorder,a["--sp-tab-active-bg"]=e.tabActiveBg,a["--sp-tab-active-color"]=e.tabActiveText,a["--sp-tab-active-border"]=e.tabActiveBorder,a["--sp-tab-inactive-bg"]=e.tabInactiveBg,a["--sp-tab-inactive-color"]=e.tabInactiveText,a["--sp-tab-inactive-border"]=e.tabInactiveBorder,a["--sp-tab-hover-bg"]=e.tabHoverBg,a["--sp-tab-add-btn-color"]=e.tabAddBtnColor,a["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,a["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,a["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,a["--sp-scroll-thumb"]=e.scrollbarThumb,a["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,a["--sp-scroll-btn-bg"]=e.scrollBtnBg,a["--sp-scroll-btn-color"]=e.scrollBtnColor,a["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,a["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,a["--sp-scroll-track-bg"]=e.scrollTrackBg,a["--sp-toolbar-bg"]=e.toolbarBg,a["--sp-toolbar-border"]=e.toolbarBorder,a["--sp-toolbar-btn-color"]=e.toolbarBtnColor,a["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,a["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,a["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,a}function Xa(e,n,o,l,a){function i(H,D){const G=D-H+1,ve=S(H,D);for(let L=H;L<=D;L++)for(let Y=0;Y<e.colCount;Y++)e.delCell(e.cellKey(Y,L));for(let L=H;L<e.rowCount-G;L++){for(let Y=0;Y<e.colCount;Y++){const Be=e.cellKey(Y,L+G),de=e.cellKey(Y,L);e.cells[Be]?(e.cells[de]=e.cells[Be],e.delCell(Be)):e.delCell(de)}e.rowHeights.value[L]=e.rowHeights.value[L+G]}for(let L=e.rowCount-G;L<e.rowCount;L++){for(let Y=0;Y<e.colCount;Y++)e.delCell(e.cellKey(Y,L));e.rowHeights.value[L]=void 0}b(ve)}function r(H,D){const G=D-H+1;if(D>=e.rowCount-1)return;const ve=E(H,D);for(let L=e.rowCount-1;L>D;L--){for(let Y=0;Y<e.colCount;Y++){const Be=e.cellKey(Y,L-G),de=e.cellKey(Y,L);e.cells[Be]?e.cells[de]=e.cells[Be]:e.delCell(de)}e.rowHeights.value[L]=e.rowHeights.value[L-G]}for(let L=D+1;L<=D+G;L++){for(let Y=0;Y<e.colCount;Y++)e.delCell(e.cellKey(Y,L));e.rowHeights.value[L]=void 0}b(ve)}function p(H,D){const G=D-H+1;if(D>=e.colCount-1)return;const ve=B(H,D);for(let L=e.colCount-1;L>D;L--){for(let Y=0;Y<e.rowCount;Y++){const Be=e.cellKey(L-G,Y),de=e.cellKey(L,Y);e.cells[Be]?e.cells[de]=e.cells[Be]:e.delCell(de)}e.colWidths.value[L]=e.colWidths.value[L-G]}for(let L=D+1;L<=D+G;L++){for(let Y=0;Y<e.rowCount;Y++)e.delCell(e.cellKey(L,Y));e.colWidths.value[L]=100}b(ve)}function s(H,D){const G=D-H+1,ve=T(H,D);for(let L=H;L<=D;L++)for(let Y=0;Y<e.rowCount;Y++)e.delCell(e.cellKey(L,Y));for(let L=H;L<e.colCount-G;L++){for(let Y=0;Y<e.rowCount;Y++){const Be=e.cellKey(L+G,Y),de=e.cellKey(L,Y);e.cells[Be]?(e.cells[de]=e.cells[Be],e.delCell(Be)):e.delCell(de)}e.colWidths.value[L]=e.colWidths.value[L+G]}for(let L=e.colCount-G;L<e.colCount;L++){for(let Y=0;Y<e.rowCount;Y++)e.delCell(e.cellKey(L,Y));e.colWidths.value[L]=100}b(ve)}function b(H){Object.keys(e.merges).forEach(D=>Reflect.deleteProperty(e.merges,D));for(const D of H)if(!(D.newRange.startCol>D.newRange.endCol||D.newRange.startRow>D.newRange.endRow)&&(e.merges[D.newAnchorKey]={...D.newRange},D.anchorCell)){const G=D.anchorCell.value,ve=D.anchorCell.styleId;G===""&&!ve||(e.cells[D.newAnchorKey]={value:G,styleId:ve||void 0})}}function S(H,D){const G=D-H+1,ve=[];for(const L in e.merges){const Y=e.merges[L];if(!Y)continue;const Be=e.cells[L]?{value:e.cells[L].value,styleId:e.cells[L].styleId??0}:{value:"",styleId:0},{startCol:de,endCol:Re}=Y;let{startRow:Fe,endRow:Ze}=Y;if(Fe>D){Fe-=G,Ze-=G,ve.push({newAnchorKey:e.cellKey(de,Fe),newRange:{startCol:de,startRow:Fe,endCol:Re,endRow:Ze}});continue}if(Ze<H){ve.push({newAnchorKey:L,newRange:{startCol:de,startRow:Fe,endCol:Re,endRow:Ze}});continue}if(Fe>=H&&Ze<=D||(Fe>=H&&Fe<=D&&(Fe=H),Ze>=H&&Ze<=D?Ze=H-1:Ze>D&&(Ze-=G),Fe>Ze))continue;const et=de,it=Fe,ft=e.cellKey(et,it),ct=L.split(",").map(Number)[1],ut=ct>=H&&ct<=D||et!==Y.startCol||it!==ct;ve.push({newAnchorKey:ft,newRange:{startCol:de,startRow:Fe,endCol:Re,endRow:Ze},anchorCell:ut?Be:void 0})}return ve}function T(H,D){const G=D-H+1,ve=[];for(const L in e.merges){const Y=e.merges[L];if(!Y)continue;const Be=e.cells[L]?{value:e.cells[L].value,styleId:e.cells[L].styleId??0}:{value:"",styleId:0};let{startCol:de,endCol:Re}=Y;const{startRow:Fe,endRow:Ze}=Y;if(de>D){de-=G,Re-=G,ve.push({newAnchorKey:e.cellKey(de,Fe),newRange:{startCol:de,startRow:Fe,endCol:Re,endRow:Ze}});continue}if(Re<H){ve.push({newAnchorKey:L,newRange:{startCol:de,startRow:Fe,endCol:Re,endRow:Ze}});continue}if(de>=H&&Re<=D||(de>=H&&de<=D&&(de=H),Re>=H&&Re<=D?Re=H-1:Re>D&&(Re-=G),de>Re))continue;const et=de,it=Fe,ft=e.cellKey(et,it),ct=L.split(",").map(Number)[0],ut=ct>=H&&ct<=D||et!==ct||it!==Y.startRow;ve.push({newAnchorKey:ft,newRange:{startCol:de,startRow:Fe,endCol:Re,endRow:Ze},anchorCell:ut?Be:void 0})}return ve}function E(H,D){const G=D-H+1,ve=[];for(const L in e.merges){const Y=e.merges[L];if(!Y)continue;const{startCol:Be,endCol:de}=Y;let{startRow:Re,endRow:Fe}=Y;Fe<H?ve.push({newAnchorKey:L,newRange:{startCol:Be,startRow:Re,endCol:de,endRow:Fe}}):Re>D?(Re+=G,Fe+=G,ve.push({newAnchorKey:e.cellKey(Be,Re),newRange:{startCol:Be,startRow:Re,endCol:de,endRow:Fe}})):(Fe+=G,ve.push({newAnchorKey:L,newRange:{startCol:Be,startRow:Re,endCol:de,endRow:Fe}}))}return ve}function B(H,D){const G=D-H+1,ve=[];for(const L in e.merges){const Y=e.merges[L];if(!Y)continue;let{startCol:Be,endCol:de}=Y;const{startRow:Re,endRow:Fe}=Y;de<H?ve.push({newAnchorKey:L,newRange:{startCol:Be,startRow:Re,endCol:de,endRow:Fe}}):Be>D?(Be+=G,de+=G,ve.push({newAnchorKey:e.cellKey(Be,Re),newRange:{startCol:Be,startRow:Re,endCol:de,endRow:Fe}})):(de+=G,ve.push({newAnchorKey:L,newRange:{startCol:Be,startRow:Re,endCol:de,endRow:Fe}}))}return ve}let x=0;function te(){return x++,`s_${x}`}function ie(H){return{id:te(),name:H,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(e.colCount).fill(100),rowHeights:new Array(e.rowCount).fill(void 0)}}const g=t.ref([ie("Sheet1")]),V=t.ref(0);function X(){const H=g.value[V.value];H&&(H.cells={...e.cells},H.merges={...e.merges},H.selection=e.selection.value?{...e.selection.value}:null,H.activeCell={...e.activeCell.value},H.scrollX=e.scrollX.value,H.scrollY=e.scrollY.value,H.colWidths=[...e.colWidths.value],H.rowHeights=[...e.rowHeights.value],H.styles=[...e.styles],H.borders=[...e.borders])}function ae(H){const D=g.value[H];D&&(Object.keys(e.cells).forEach(G=>e.delCell(G)),Object.assign(e.cells,D.cells),Object.keys(e.merges).forEach(G=>Reflect.deleteProperty(e.merges,G)),D.merges&&Object.assign(e.merges,D.merges),e.selection.value=D.selection?{...D.selection}:null,e.activeCell.value={...D.activeCell},e.scrollX.value=D.scrollX,e.scrollY.value=D.scrollY,e.colWidths.value=[...D.colWidths],e.rowHeights.value=[...D.rowHeights],e.syncStyles(D.styles),e.syncBorders(D.borders??[{}]),V.value=H)}function Z(H){H===V.value||H<0||H>=g.value.length||(e.cancelEdit(),X(),ae(H))}function oe(H){return n.saveUndo(),e.cancelEdit(),X(),g.value.push(ie(H??`Sheet${g.value.length+1}`)),ae(g.value.length-1),g.value.length-1}function ne(H){return g.value.length<=1||(n.saveUndo(),e.cancelEdit(),g.value.splice(H,1),ae(Math.min(H,g.value.length-1))),V.value}function ce(H,D){g.value[H]&&D.trim()&&(n.saveUndo(),g.value[H].name=D.trim())}function Ne(H){n.saveUndo(),e.cancelEdit(),X();const D=g.value[H];if(!D)return H;let G=D.name;const ve=G.match(/^(.*?)\s*\((\d+)\)$/);let L=ve?parseInt(ve[2],10)+1:2;ve&&(G=ve[1]);let Y=`${G} (${L})`;const Be=new Set(g.value.map(Re=>Re.name));for(;Be.has(Y);)L++,Y=`${G} (${L})`;const de={id:te(),name:Y,cells:{...D.cells},merges:D.merges?{...D.merges}:{},styles:[...D.styles],borders:D.borders?[...D.borders]:[{}],selection:D.selection?{...D.selection}:null,activeCell:D.activeCell?{...D.activeCell}:{col:0,row:0},scrollX:D.scrollX,scrollY:D.scrollY,colWidths:[...D.colWidths],rowHeights:[...D.rowHeights]};return g.value.splice(H+1,0,de),ae(H+1),H+1}function Ve(H,D){var Y;const G=H+D;if(G<0||G>=g.value.length)return;n.saveUndo();const ve=V.value,L=g.value.splice(H,1)[0];g.value.splice(G,0,L),ve===H?V.value=G:H<ve&&G>=ve?V.value=ve-1:H>ve&&G<=ve&&(V.value=ve+1),(Y=e.scheduleRender)==null||Y.call(e)}const Ye=t.computed(()=>g.value.length);let Le="";const ye=o;function J(){X();const H=g.value.map(G=>{const ve={};for(const[de,Re]of Object.entries(G.cells))ve[de]={value:Re.value},Re.styleId&&Re.styleId>0&&(ve[de].styleId=Re.styleId);const L={name:G.name,cells:ve};G.styles&&G.styles.length>1&&(L.styles=[...G.styles]),G.borders&&G.borders.length>1&&(L.borders=[...G.borders]),G.merges&&Object.keys(G.merges).length&&(L.merges={...G.merges});const Y={};for(let de=0;de<G.colWidths.length;de++)G.colWidths[de]!==100&&(Y[de]=G.colWidths[de]);Object.keys(Y).length&&(L.colWidths=Y);const Be={};for(let de=0;de<G.rowHeights.length;de++){const Re=G.rowHeights[de];Re!=null&&(Be[de]=Re)}return Object.keys(Be).length&&(L.rowHeights=Be),L}),D=JSON.stringify(H);D!==Le&&(Le=D,ye.value=H,a&&(a.value=D))}e.emitModelData=J;let P=!1;function fe(){P||(P=!0,Promise.resolve().then(()=>{P=!1,J()}))}const Q=t.computed(()=>e.props.theme==="dark"?Bo:So),c=t.computed(()=>Ya(Q.value,e.props.width,e.props.height,Ft)),f=t.computed(()=>{const H={};for(const[D,G]of Object.entries(c.value))D.startsWith("--")&&(H[D]=G);return H}),m=t.ref(null),A=t.ref(null),I=t.ref(null),O=t.ref(null),C=t.reactive({w:800,h:600});e.viewSize&&t.watch(C,H=>{e.viewSize&&(e.viewSize.w=H.w,e.viewSize.h=H.h)},{deep:!0});const se=48,$=28,u=11,M=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,C.w-se-u))),j=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,C.h-$-u)));function re(H,D){const G=Math.max(0,C.w-se-u),ve=Math.max(0,C.h-$-u);e.scrollX.value=Math.max(0,Math.min(H??e.scrollX.value,Math.max(0,e.totalWidth.value-G))),e.scrollY.value=Math.max(0,Math.min(D??e.scrollY.value,Math.max(0,e.totalHeight.value-ve)))}e.clampScroll=re;function W(){var H;return typeof window>"u"?!1:!((H=window.matchMedia)!=null&&H.call(window,"(hover: none) and (pointer: coarse)").matches)}function ke(H=!1){t.nextTick(()=>{const D=I.value;if(D){if(!e.editingCell.value&&!W()){document.activeElement===D&&D.blur();return}D.focus({preventScroll:!0}),H&&D.select()}})}function Ke(){ke()}function nt(){var D;const H=e.selection.value;if(H){n.saveUndo();for(let G=H.startRow;G<=H.endRow;G++)e.rowHeights.value[G]=void 0;(D=e.scheduleRender)==null||D.call(e),J()}}function rt(){var D;const H=e.selection.value;if(H){n.saveUndo();for(let G=H.startCol;G<=H.endCol;G++)e.colWidths.value[G]=100;(D=e.scheduleRender)==null||D.call(e),J()}}return{deleteRows:i,insertRows:r,insertCols:p,deleteCols:s,sheets:g,activeSheetIndex:V,saveSheet:X,loadSheet:ae,switchSheet:Z,addSheet:oe,removeSheet:ne,renameSheet:ce,dupSheet:Ne,moveSheet:Ve,sheetCount:Ye,mkSheet:ie,emitModelData:J,scheduleOptEmit:fe,themeColors:Q,outerStyle:c,toolbarThemeVars:f,wrapperRef:m,canvasRef:A,editInputRef:I,formulaBarRef:O,viewSize:C,maxScrollX:M,maxScrollY:j,clampScroll:re,canFocusHiddenEditor:W,focusEditInput:ke,onCanvasFocus:Ke,resetRowHeight:nt,resetColWidth:rt,modelData:ye}}function oo(e){return!!e&&e.width!==void 0&&e.width>0}function ot(e,n,o,l){const a=oo(e),i=oo(n);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return n;const r=e.width??0,p=n.width??0;return r>p?e:p>r?n:e}function ja(e,n,o,l,a){let i=!1,r=null,p=1;function s(){i||(i=!0,requestAnimationFrame(()=>{i=!1,S()}))}e.scheduleRender=s;const b="#444";function S(){const d=l.canvasRef.value;if(!d)return;const y=l.wrapperRef.value;if(!y||(r=d.getContext("2d"),!r))return;p=window.devicePixelRatio||1;const z=y.getBoundingClientRect(),_=z.width,v=z.height;l.viewSize.w=_,l.viewSize.h=v,d.width=_*p,d.height=v*p,d.style.width=_+"px",d.style.height=v+"px",r.setTransform(p,0,0,p,0,0);const K=e.scrollX.value,we=e.scrollY.value,Ee=52,ge=24,Me=l.themeColors.value,qe=e.colPositions.value,tt=e.rowPositions.value,yt=e.colWidths.value,pt=[];for(let le=0;le<e.rowCount;le++)pt[le]=tt[le+1]-tt[le];const Rt=Math.max(0,e.hitCol(K));let Zt=Rt;for(let le=Rt;le<e.colCount&&!(Ee+qe[le]-K>=_);le++)Zt=le;const At=Zt,wt=Math.max(0,e.hitRow(we));let ml=wt;for(let le=wt;le<e.rowCount&&!(ge+tt[le]-we>=v);le++)ml=le;const kt=ml;let qt=Rt,Jt=wt;for(const le in e.merges){const be=e.merges[le];be&&(be.startRow>kt||be.endRow<wt||be.startCol>At||be.endCol<Rt||(be.startCol<qt&&(qt=be.startCol),be.startRow<Jt&&(Jt=be.startRow)))}r.fillStyle=Me.bg,r.fillRect(0,0,_,v),r.fillStyle=Me.gridBg,r.fillRect(Ee,ge,_-Ee,v-ge),r.save(),r.beginPath(),r.rect(Ee,ge,_-Ee,v-ge),r.clip();const dt=e.selection.value,il=e.editingCell.value;for(let le=Jt;le<=kt;le++)for(let be=qt;be<=At;be++){const He=e.findMerge(be,le);if(He&&!(be===He.range.startCol&&le===He.range.startRow))continue;const Oe=Ee+qe[be]-K,Ue=ge+tt[le]-we;let Je=yt[be],Qe=pt[le];if(He&&(Je=qe[He.range.endCol+1]-qe[be],Qe=tt[He.range.endRow+1]-tt[le]),Oe+Je<Ee||Ue+Qe<ge||Oe>_||Ue>v)continue;const It=e.findHighlight?e.findHighlight(be,le):null,Ge=e.resolveStyle(e.cells[e.cellKey(be,le)]),je=typeof(Ge==null?void 0:Ge.backgroundColor)=="string"?Ge.backgroundColor:"";if(je&&(r.fillStyle=je,r.fillRect(Oe,Ue,Je,Qe)),It&&(r.fillStyle=It==="active"?Me.findActiveBg:Me.findMatchBg,r.fillRect(Oe,Ue,Je,Qe)),e.isSelected(be,le)&&(r.fillStyle=Me.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(Oe,Ue,yt[be],pt[le]):r.fillRect(Oe,Ue,Je,Qe)),e.activeCell.value.col===be&&e.activeCell.value.row===le&&(r.strokeStyle=Me.activeCellBorder,r.lineWidth=2,r.strokeRect(Oe+1,Ue+1,Je-2,Qe-2)),It==="active"&&(r.strokeStyle=Me.findActiveBg,r.lineWidth=2,r.strokeRect(Oe+1,Ue+1,Je-2,Qe-2)),r.strokeStyle=Me.gridLine,r.lineWidth=.5,r.strokeRect(Oe+.25,Ue+.25,Je-.5,Qe-.5),!(il&&il.col===be&&il.row===le)){const ue=e.resolveStyle(e.cells[e.cellKey(be,le)]),$e=e.getCellValue(be,le),ze=typeof(ue==null?void 0:ue.numberFormat)=="string"?ue.numberFormat:"",ee=$e?wl($e,ze,e.locale.value):"";if(ee){const xe=e.cellFontSize(be,le),Se=typeof(ue==null?void 0:ue.fontFamily)=="string"&&ue.fontFamily?ue.fontFamily:el,_e=(ue==null?void 0:ue.fontWeight)==="bold"?"bold":"normal",Et=(ue==null?void 0:ue.fontStyle)==="italic"?"italic":"normal",Si=(ue==null?void 0:ue.underline)==="underline",Bi=(ue==null?void 0:ue.strikethrough)==="line-through",Hl=typeof(ue==null?void 0:ue.color)=="string"?ue.color:"",io=typeof(ue==null?void 0:ue.textAlign)=="string"?ue.textAlign:Yl($e,ze)?"right":"left",co=typeof(ue==null?void 0:ue.verticalAlign)=="string"?ue.verticalAlign:"top";r.fillStyle=Hl||Me.cellText,r.font=`${Et} ${_e} ${xe}px ${Se}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(Oe+5,Ue+1,Je-10,Qe-2),r.clip();const so=(ue==null?void 0:ue.wrap)==="wrap",pl=Je-10;let Vl=ee;const Ri=!so&&Wo(ze),uo=ee===Cl||_o($e,ze);if(uo||Ri){if(uo){const _t=Math.max(1,r.measureText("#").width),cl=Math.max(1,Math.floor(pl/_t));Vl="#".repeat(cl)}else if(e.getWrappedLines(r,ee,1e9,!1).some(xt=>xt&&r.measureText(xt).width>pl)){const xt=Math.max(1,r.measureText("#").width),Qt=Math.max(1,Math.floor(pl/xt));Vl="#".repeat(Qt)}}const hl=e.getWrappedLines(r,Vl,pl,so),{ascent:gl,descent:bl}=e.measureFontMetrics(Se,xe,_e,Et),yl=gl+bl,xi=hl.length*yl;let vl;co==="middle"?vl=Ue+(Qe-xi)/2+gl:co==="bottom"?vl=Ue+Qe-e.BASE_CELL_VPAD-bl-(hl.length-1)*yl:vl=Ue+e.BASE_CELL_VPAD+gl;for(let _t=0;_t<hl.length;_t++){const cl=hl[_t],xt=vl+_t*yl,Qt=r.measureText(cl);let Ht;if(io==="center"?Ht=Oe+Je/2-Qt.width/2:io==="right"?Ht=Oe+Je-5-Qt.width:Ht=Oe+5,r.fillText(cl,Ht,xt),Si&&(r.strokeStyle=Hl||Me.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(Ht,xt+bl+1),r.lineTo(Ht+Qt.width,xt+bl+1),r.stroke()),Bi){r.strokeStyle=Hl||Me.cellText,r.lineWidth=1;const fo=xt-gl+yl*.42;r.beginPath(),r.moveTo(Ht,fo),r.lineTo(Ht+Qt.width,fo),r.stroke()}}r.restore()}}}const lt=(le,be,He)=>{const Oe=e.findMerge(le,be);return Oe?e.getCellBorderSide(e.cells[Oe.anchor],He):e.getCellBorderSide(e.cells[e.cellKey(le,be)],He)};r.fillStyle=b;for(let le=Jt;le<=kt;le++)for(let be=qt;be<=At;be++){const He=e.findMerge(be,le);if(He&&!(be===He.range.startCol&&le===He.range.startRow))continue;const Oe=Ee+qe[be]-K,Ue=ge+tt[le]-we;let Je=yt[be],Qe=pt[le];if(He&&(Je=qe[He.range.endCol+1]-qe[be],Qe=tt[He.range.endRow+1]-tt[le]),Oe+Je<Ee||Ue+Qe<ge||Oe>_||Ue>v)continue;const It=e.cells[e.cellKey(be,le)],Ge={top:e.getCellBorderSide(It,"top"),right:e.getCellBorderSide(It,"right"),bottom:e.getCellBorderSide(It,"bottom"),left:e.getCellBorderSide(It,"left")};if(He){const je=He.range.startRow,ue=He.range.endRow,$e=He.range.startCol,ze=He.range.endCol;for(let ee=$e;ee<=ze;ee++){if(e.isSameMergeInternal(ee,je-1,ee,je))continue;const xe=lt(ee,je-1,"bottom"),Se=ot(xe,Ge.top);if(Se&&Se.width&&Se.width>0){const _e=Ee+qe[ee]-K;r.fillStyle=Se.color||b,r.fillRect(_e,Ue,yt[ee],Se.width)}}for(let ee=$e;ee<=ze;ee++){if(e.isSameMergeInternal(ee,ue,ee,ue+1))continue;const xe=lt(ee,ue+1,"top"),Se=ot(Ge.bottom,xe);if(Se&&Se.width&&Se.width>0){const _e=Ee+qe[ee]-K;r.fillStyle=Se.color||b,r.fillRect(_e,Ue+Qe-Se.width,yt[ee],Se.width)}}for(let ee=je;ee<=ue;ee++){if(e.isSameMergeInternal($e-1,ee,$e,ee))continue;const xe=lt($e-1,ee,"right"),Se=ot(xe,Ge.left);if(Se&&Se.width&&Se.width>0){const _e=ge+tt[ee]-we;r.fillStyle=Se.color||b,r.fillRect(Oe,_e,Se.width,pt[ee])}}for(let ee=je;ee<=ue;ee++){if(e.isSameMergeInternal(ze,ee,ze+1,ee))continue;const xe=lt(ze+1,ee,"left"),Se=ot(Ge.right,xe);if(Se&&Se.width&&Se.width>0){const _e=ge+tt[ee]-we;r.fillStyle=Se.color||b,r.fillRect(Oe+Je-Se.width,_e,Se.width,pt[ee])}}{const ee=e.isSameMergeInternal($e,je-1,$e,je)?Ge.top:ot(lt($e,je-1,"bottom"),Ge.top),xe=e.isSameMergeInternal($e-1,je,$e,je)?Ge.left:ot(lt($e-1,je,"right"),Ge.left),Se=(ee==null?void 0:ee.width)??0,_e=(xe==null?void 0:xe.width)??0;Se>0&&_e>0&&(r.fillStyle=(ee==null?void 0:ee.color)||(xe==null?void 0:xe.color)||b,r.fillRect(Oe-_e,Ue-Se,_e,Se))}{const ee=e.isSameMergeInternal(ze,je-1,ze,je)?Ge.top:ot(lt(ze,je-1,"bottom"),Ge.top),xe=e.isSameMergeInternal(ze,je,ze+1,je)?Ge.right:ot(Ge.right,lt(ze+1,je,"left")),Se=(ee==null?void 0:ee.width)??0,_e=(xe==null?void 0:xe.width)??0;Se>0&&_e>0&&(r.fillStyle=(ee==null?void 0:ee.color)||(xe==null?void 0:xe.color)||b,r.fillRect(Oe+Je,Ue-Se,_e,Se))}{const ee=e.isSameMergeInternal($e,ue,$e,ue+1)?Ge.bottom:ot(Ge.bottom,lt($e,ue+1,"top")),xe=e.isSameMergeInternal($e-1,ue,$e,ue)?Ge.left:ot(lt($e-1,ue,"right"),Ge.left),Se=(ee==null?void 0:ee.width)??0,_e=(xe==null?void 0:xe.width)??0;Se>0&&_e>0&&(r.fillStyle=(ee==null?void 0:ee.color)||(xe==null?void 0:xe.color)||b,r.fillRect(Oe-_e,Ue+Qe,_e,Se))}{const ee=e.isSameMergeInternal(ze,ue,ze,ue+1)?Ge.bottom:ot(Ge.bottom,lt(ze,ue+1,"top")),xe=e.isSameMergeInternal(ze,ue,ze+1,ue)?Ge.right:ot(Ge.right,lt(ze+1,ue,"left")),Se=(ee==null?void 0:ee.width)??0,_e=(xe==null?void 0:xe.width)??0;Se>0&&_e>0&&(r.fillStyle=(ee==null?void 0:ee.color)||(xe==null?void 0:xe.color)||b,r.fillRect(Oe+Je,Ue+Qe,_e,Se))}}else{const je={top:lt(be,le-1,"bottom"),left:lt(be-1,le,"right"),bottom:lt(be,le+1,"top"),right:lt(be+1,le,"left")},ue=ot(je.top,Ge.top),$e=ot(je.left,Ge.left),ze=ot(Ge.bottom,je.bottom),ee=ot(Ge.right,je.right),xe=(ue==null?void 0:ue.width)??0,Se=($e==null?void 0:$e.width)??0,_e=(ze==null?void 0:ze.width)??0,Et=(ee==null?void 0:ee.width)??0;xe>0&&(r.fillStyle=(ue==null?void 0:ue.color)||b,r.fillRect(Oe,Ue,Je,xe)),_e>0&&(r.fillStyle=(ze==null?void 0:ze.color)||b,r.fillRect(Oe,Ue+Qe-_e,Je,_e)),Se>0&&(r.fillStyle=($e==null?void 0:$e.color)||b,r.fillRect(Oe,Ue,Se,Qe)),Et>0&&(r.fillStyle=(ee==null?void 0:ee.color)||b,r.fillRect(Oe+Je-Et,Ue,Et,Qe)),xe>0&&Se>0&&(r.fillStyle=(ue==null?void 0:ue.color)||($e==null?void 0:$e.color)||b,r.fillRect(Oe-Se,Ue-xe,Se,xe)),xe>0&&Et>0&&(r.fillStyle=(ue==null?void 0:ue.color)||(ee==null?void 0:ee.color)||b,r.fillRect(Oe+Je,Ue-xe,Et,xe)),_e>0&&Se>0&&(r.fillStyle=(ze==null?void 0:ze.color)||($e==null?void 0:$e.color)||b,r.fillRect(Oe-Se,Ue+Qe,Se,_e)),_e>0&&Et>0&&(r.fillStyle=(ze==null?void 0:ze.color)||(ee==null?void 0:ee.color)||b,r.fillRect(Oe+Je,Ue+Qe,Et,_e))}}r.restore(),r.fillStyle=Me.headerBg,r.fillRect(Ee,0,_-Ee,ge);for(let le=Rt;le<=At;le++){const be=Ee+qe[le]-K,He=yt[le];be+He<Ee||be>_||(dt&&le>=dt.startCol&&le<=dt.endCol&&(r.fillStyle=Me.selectionBg,r.fillRect(be,0,He,ge)),r.strokeStyle=Me.headerBorder,r.lineWidth=.5,r.strokeRect(be+.25,.25,He-.5,ge-.5),dt&&le>=dt.startCol&&le<=dt.endCol&&(r.strokeStyle=Me.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(be,ge-1),r.lineTo(be+He,ge-1),r.stroke()),r.fillStyle=Me.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Pe(le),be+He/2,ge/2))}r.strokeStyle=Me.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Ee,ge+.5),r.lineTo(_,ge+.5),r.stroke(),r.fillStyle=Me.headerBg,r.fillRect(0,ge,Ee,v-ge);for(let le=wt;le<=kt;le++){const be=ge+tt[le]-we,He=pt[le];be+He<ge||be>v||(dt&&le>=dt.startRow&&le<=dt.endRow&&(r.fillStyle=Me.selectionBg,r.fillRect(0,be,Ee,He)),r.strokeStyle=Me.headerBorder,r.lineWidth=.5,r.strokeRect(.25,be+.25,Ee-.5,He-.5),dt&&le>=dt.startRow&&le<=dt.endRow&&(r.strokeStyle=Me.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ee-1,be),r.lineTo(Ee-1,be+He),r.stroke()),r.fillStyle=Me.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(le+1),Ee/2,be+He/2+.5))}r.strokeStyle=Me.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Ee+.5,ge),r.lineTo(Ee+.5,v),r.stroke(),r.fillStyle=Me.headerBg,r.fillRect(0,0,Ee,ge),r.strokeStyle=Me.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,Ee-.5,ge-.5)}const T=t.computed(()=>Pe(e.activeCell.value.col)+String(e.activeCell.value.row+1)),E=t.ref(""),B=t.ref(!1),x=t.computed(()=>e.editingCell.value?E.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(d,y)=>{if(d&&!y){const z=e.editValue.value||e.getCellRaw(d.col,d.row)||"";E.value=z,V=!1}else!d&&y&&(E.value="",B.value=!1,V=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(E.value="",V=!1)});function te(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),s())}function ie(d){const y=d.target.value;E.value=y,V=!0,e.editingCell.value||e.startEdit()}let g=!1,V=!1;function X(){var K,we,Ee,ge,Me,qe,tt,yt,pt;if(g)return;const d=l.formulaBarRef.value,y=!!(d&&typeof document<"u"&&document.activeElement===d);if(!e.editingCell.value&&!y&&!V)return;const z={...e.activeCell.value},_=e.editingCell.value?e.editingCell.value.col:z.col,v=e.editingCell.value?e.editingCell.value.row:z.row;if(!e.editingCell.value){const Rt=e.getCellRaw(_,v),Zt=E.value!==Rt;if(!V)return;g=!0,Zt&&((K=e.saveUndo)==null||K.call(e),e.setCellValue(_,v,E.value),s(),(we=l.emitModelData)==null||we.call(l)),(Ee=l.formulaBarRef.value)==null||Ee.blur(),E.value="",B.value=!1,V=!1,t.nextTick(()=>{g=!1});return}g=!0,V?(e.editValue.value=E.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ge=l.formulaBarRef.value)==null||ge.blur(),E.value="",B.value=!1,V=!1,s(),l.focusEditInput(),(Me=l.emitModelData)==null||Me.call(l),t.nextTick(()=>{g=!1})):y?(E.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(qe=l.formulaBarRef.value)==null||qe.blur(),E.value="",B.value=!1,V=!1,s(),l.focusEditInput(),(tt=l.emitModelData)==null||tt.call(l),t.nextTick(()=>{g=!1})):(e.commitEdit(),(yt=l.formulaBarRef.value)==null||yt.blur(),E.value="",B.value=!1,V=!1,s(),l.focusEditInput(),(pt=l.emitModelData)==null||pt.call(l),t.nextTick(()=>{g=!1}))}function ae(){var d;g||(g=!0,e.editingCell.value&&e.cancelEdit(),(d=l.formulaBarRef.value)==null||d.blur(),E.value="",B.value=!1,V=!1,s(),l.focusEditInput(),t.nextTick(()=>{g=!1}))}function Z(d){if(!d.isComposing){if(d.key==="Enter"&&(d.altKey||d.metaKey)&&!d.ctrlKey){d.preventDefault(),d.stopPropagation();const y=d.target;if(!y)return;e.editingCell.value||e.startEdit();const z=y.selectionStart??y.value.length,_=y.selectionEnd??y.value.length,v=y.value,K=v.substring(0,z)+`
7
- `+v.substring(_),we=z+1;E.value=K,B.value||(B.value=!0),t.nextTick(()=>{try{y.setSelectionRange(we,we)}catch{}if(B.value)try{y.scrollTop=y.scrollHeight}catch{}try{y.focus({preventScroll:!0})}catch{}});return}d.key==="Enter"?(d.preventDefault(),X()):d.key==="Escape"&&(d.preventDefault(),ae())}}function oe(){X()}const ne=t.ref(null),ce=t.ref("");function Ne(d){ne.value===null&&(l.switchSheet(d),s())}function Ve(d){d!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(d),s()),ne.value=d,ce.value=l.sheets.value[d].name,t.nextTick(()=>{const y=document.querySelector(".tab-rename-input");y==null||y.focus(),y==null||y.select()})}function Ye(){ne.value!==null&&(l.renameSheet(ne.value,ce.value),t.nextTick(()=>l.emitModelData())),ne.value=null,ce.value=""}function Le(){ne.value=null,ce.value=""}function ye(d){d.key==="Enter"?(d.preventDefault(),Ye()):d.key==="Escape"&&(d.preventDefault(),Le())}const J=t.ref(null);let P=null;function fe(){P&&(document.removeEventListener("click",P),P=null)}function Q(d,y,z){fe();const _=140,v=z.length*28+8,K=window.innerWidth,we=window.innerHeight;d+_>K&&(d-=_),y+v>we&&(y-=v),J.value={x:d,y,items:z},P=()=>{J.value=null,fe()},setTimeout(()=>document.addEventListener("click",P,{once:!0}),0)}const c=t.ref(!1);function f(d,y){if(!y.children){c.value=!1;return}const _=d.currentTarget.querySelector(".context-submenu");if(!_){c.value=!1;return}const v=_.getBoundingClientRect();c.value=v.right>window.innerWidth}function m(d,y){d.preventDefault(),d.stopPropagation(),Q(d.clientX,d.clientY,[{label:N(e.locale.value,"insert"),action:()=>{l.addSheet(),s()}},{label:N(e.locale.value,"copy"),action:()=>{l.dupSheet(y)}},{label:N(e.locale.value,"rename"),action:()=>{Ve(y)}},{label:N(e.locale.value,"delete"),action:()=>{l.removeSheet(y),s()},disabled:l.sheetCount.value<=1},{label:N(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(y,-1)},disabled:y===0},{label:N(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(y,1)},disabled:y===l.sheets.value.length-1}])}function A(d){d.preventDefault(),!(d.target.closest(".tab-item")||d.target.closest(".tab-bar__add-btn"))&&Q(d.clientX,d.clientY,[{label:N(e.locale.value,"insert"),action:()=>{l.addSheet(),s()}}])}function I(d){d.preventDefault(),e.selectAll(),s(),Q(d.clientX,d.clientY,[{label:N(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{s(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected();for(let y=0;y<e.colCount;y++)e.colWidths.value[y]=100;for(let y=0;y<e.rowCount;y++)e.rowHeights.value[y]=void 0;s(),l.emitModelData()}}])}function O(d,y){d.preventDefault();const z=d.clientX,_=d.clientY,v=e.selection.value;v&&v.startCol===0&&v.endCol===e.colCount-1&&y>=v.startRow&&y<=v.endRow||(e.selectRange(0,y,e.colCount-1,y,"row"),s());const K=e.selection.value;Q(d.clientX,d.clientY,[{label:N(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertRows(K.startRow,K.endRow),s(),l.emitModelData()},disabled:K.endRow>=e.rowCount-1},{label:N(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,K.startRow,K.endRow),s(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{s(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteRows(K.startRow,K.endRow),s(),l.emitModelData()}},{label:`${N(e.locale.value,"rowHeight")}...`,action:()=>re("row",z,_)},{label:N(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()}])}function C(d,y){d.preventDefault();const z=d.clientX,_=d.clientY,v=e.selection.value;v&&v.startRow===0&&v.endRow===e.rowCount-1&&y>=v.startCol&&y<=v.endCol||(e.selectRange(y,0,y,e.rowCount-1,"col"),s());const K=e.selection.value;Q(d.clientX,d.clientY,[{label:N(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertCols(K.startCol,K.endCol),s(),l.emitModelData()},disabled:K.endCol>=e.colCount-1},{label:N(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(K.startCol,K.endCol,0,e.rowCount-1),s(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{s(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteCols(K.startCol,K.endCol),s(),l.emitModelData()}},{label:`${N(e.locale.value,"colWidth")}...`,action:()=>re("col",z,_)},{label:N(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()}])}function se(d,y,z){d.preventDefault(),e.isSelected(y,z)||(e.selectCell(y,z),s());const _=e.selection.value,v=!!(_&&_.startCol===_.endCol&&_.startRow===_.endRow);Q(d.clientX,d.clientY,[{label:N(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:N(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:N(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{s(),t.nextTick(()=>l.emitModelData())})}},{label:N(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected(),s(),l.emitModelData()}},{label:N(e.locale.value,"calculate"),children:[{label:N(e.locale.value,"sum"),action:o.sumSelected,disabled:v},{label:N(e.locale.value,"avg"),action:o.avgSelected,disabled:v},{label:N(e.locale.value,"count"),action:o.countSelected,disabled:v}]}])}const $=t.ref(null),u=t.ref(null);let M=null;function j(){M&&(document.removeEventListener("mousedown",M),M=null)}function re(d,y,z){j();const _=e.selection.value;let v="";if(_){const Me=d==="row"?e.getRowHeight(_.startRow):e.colWidths.value[_.startCol];v=Me!=null&&Me>0?String(Math.round(Me)):""}const K=220,we=118;let Ee=y,ge=z;Ee+K>window.innerWidth&&(Ee=window.innerWidth-K-8),ge+we>window.innerHeight&&(ge=window.innerHeight-we-8),Ee<8&&(Ee=8),ge<8&&(ge=8),u.value={type:d,x:Ee,y:ge,value:v,error:""},M=()=>{u.value=null},setTimeout(()=>document.addEventListener("mousedown",M,{once:!0}),0),t.nextTick(()=>{const Me=$.value;Me&&(Me.focus(),Me.select())})}function W(d){const y=u.value;if(!y)return;const z=d.target,_=z.value,v=_.replace(/[^\d]/g,"");y.value=v,_!==v&&(z.value=v),y.error=""}function ke(d){d.key==="Enter"?(d.preventDefault(),nt()):d.key==="Escape"&&(d.preventDefault(),rt())}function Ke(){const d=u.value;if(!d)return;const y=d.value.trim(),z=Number(y),_=d.type==="row",v=_?24:30,K=_?500:1e3;if(y===""||!Number.isFinite(z)){rt();return}const we=Math.max(v,Math.min(K,Math.round(z)));d.value=String(we),d.error=""}function nt(){const d=u.value,y=e.selection.value;if(!d||!y)return;const z=d.value.trim(),_=Number(z),v=d.type==="row",K=v?24:30,we=v?500:1e3;if(z===""||!Number.isFinite(_)){d.error=N(e.locale.value,"dimNumberError");return}if(_<K||_>we){d.error=N(e.locale.value,"dimRangeError").replace("{min}",String(K)).replace("{max}",String(we));return}const Ee=_;if(n.saveUndo(),v)for(let ge=y.startRow;ge<=y.endRow;ge++)e.rowHeights.value[ge]=Ee;else for(let ge=y.startCol;ge<=y.endCol;ge++)e.colWidths.value[ge]=Ee;s(),l.emitModelData(),rt()}function rt(){j(),u.value=null}const H=t.computed(()=>{const d=!e.editingCell.value,y=e.editingCell.value??e.activeCell.value,z=y.col,_=y.row,v=e.resolveStyle(e.cells[e.cellKey(z,_)]),K=e.cellFontSize(z,_),we=typeof(v==null?void 0:v.fontFamily)=="string"&&v.fontFamily?v.fontFamily:el,Ee=(v==null?void 0:v.fontWeight)==="bold"?"bold":"normal",ge=(v==null?void 0:v.fontStyle)==="italic"?"italic":"normal",Me=(v==null?void 0:v.underline)==="underline"?"underline":(v==null?void 0:v.strikethrough)==="line-through"?"line-through":"none",qe=(v==null?void 0:v.underline)==="underline"&&(v==null?void 0:v.strikethrough)==="line-through"?"underline line-through":Me,tt=typeof(v==null?void 0:v.color)=="string"?v.color:void 0,yt=typeof(v==null?void 0:v.backgroundColor)=="string"?v.backgroundColor:void 0,pt=typeof(v==null?void 0:v.numberFormat)=="string"?v.numberFormat:"",Rt=e.editValue.value??e.getCellValue(z,_),Zt=typeof(v==null?void 0:v.textAlign)=="string"?v.textAlign:Yl(Rt,pt)?"right":"left",At=typeof(v==null?void 0:v.verticalAlign)=="string"?v.verticalAlign:"top",wt=e.findMerge(z,_),ml=wt?e.colPositions.value[wt.range.endCol+1]-e.colPositions.value[z]:e.colWidths.value[z],kt=wt?e.rowPositions.value[wt.range.endRow+1]-e.rowPositions.value[_]:e.getRowHeight(_),qt=2,{ascent:Jt,descent:dt}=e.measureFontMetrics(we,K,Ee,ge),il=Jt+dt,le=(e.editValue.value?e.editValue.value.split(`
8
- `).length:1)*il,be=e.BASE_CELL_VPAD-qt;let He=0,Oe=0;return At==="middle"?(He=Math.floor((kt-le)/2),Oe=Math.max(0,kt-le-He)):At==="top"?(He=be,Oe=Math.max(0,kt-le-He)):At==="bottom"&&(Oe=be,He=Math.max(0,kt-le-Oe)),{left:`${52+e.colPositions.value[z]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[_]-e.scrollY.value}px`,width:`${ml}px`,height:`${kt}px`,fontFamily:we,fontSize:`${K}px`,lineHeight:1,fontWeight:Ee,fontStyle:ge,textDecoration:qe,textAlign:Zt,paddingTop:`${He}px`,paddingRight:"3px",paddingBottom:`${Oe}px`,paddingLeft:"3px",opacity:d?0:1,pointerEvents:d?"none":"auto",color:d?"transparent":tt,caretColor:d?"transparent":void 0,borderColor:d?"transparent":void 0,background:d?"transparent":yt,boxShadow:d?"none":void 0}});function D(){return Math.max(0,l.viewSize.w-52-11)}function G(){return Math.max(0,l.viewSize.h-24-11)}const ve=t.computed(()=>D()),L=t.computed(()=>G()),Y=t.computed(()=>Math.max(0,ve.value-11*2)),Be=t.computed(()=>Math.max(0,L.value-11*2)),de=t.computed(()=>l.maxScrollX.value<=0?Y.value:Math.max(24,D()/e.totalWidth.value*Y.value)),Re=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(Y.value-de.value)),Fe=t.computed(()=>l.maxScrollY.value<=0?Be.value:Math.max(24,G()/e.totalHeight.value*Be.value)),Ze=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(Be.value-Fe.value));let et=null,it=0,ft=0;function Dt(d){d.preventDefault(),et="v",it=d.clientY,ft=e.scrollY.value,document.addEventListener("mousemove",ut),document.addEventListener("mouseup",ht)}function ct(d){d.preventDefault(),et="h",it=d.clientX,ft=e.scrollX.value,document.addEventListener("mousemove",ut),document.addEventListener("mouseup",ht)}function ut(d){if(et==="v"){const z=(d.clientY-it)/(Be.value-Fe.value);l.clampScroll(null,ft+z*l.maxScrollY.value),s()}else if(et==="h"){const z=(d.clientX-it)/(Y.value-de.value);l.clampScroll(ft+z*l.maxScrollX.value,null),s()}}function ht(){et=null,document.removeEventListener("mousemove",ut),document.removeEventListener("mouseup",ht)}function rl(d){if(et)return;const y=d.currentTarget.getBoundingClientRect(),z=d.clientY-y.top;z<Ze.value?l.clampScroll(null,e.scrollY.value-G()):z>Ze.value+Fe.value&&l.clampScroll(null,e.scrollY.value+G()),s()}function $t(d){if(et)return;const y=d.currentTarget.getBoundingClientRect(),z=d.clientX-y.left;z<Re.value?l.clampScroll(e.scrollX.value-D(),null):z>Re.value+de.value&&l.clampScroll(e.scrollX.value+D(),null),s()}let Ct=!1,at=0,st=0,w=!1,F=!1,me=0,Ce=0,pe=0,h=0,k=0,R=0,U=0,q=0,he=!1,De=!1,Te=0,Ae=0,We="cell",Ie=0,gt=-1,Xe=-1;function Gt(d){if(d.button!==0)return;d.preventDefault(),J.value=null;const y=Ot(d,l.canvasRef.value);if(y.y<24&&y.x>=52){const v=y.x-52+e.scrollX.value,K=e.hitCol(v);if(K>=0&&Math.abs(y.x-(52+e.colPositions.value[K+1]-e.scrollX.value))<=4){n.saveUndo(),w=!0,me=K,pe=e.colWidths.value[K],h=v,s();return}}if(y.x<52&&y.y>=24){const v=y.y-24+e.scrollY.value,K=e.hitRow(v);if(K>=0&&Math.abs(y.y-(24+e.rowPositions.value[K+1]-e.scrollY.value))<=4){n.saveUndo(),F=!0,Ce=K,pe=e.getRowHeight(K),h=v,s();return}}if(y.x<52||y.y<24){{const v=l.formulaBarRef.value,K=!!(v&&typeof document<"u"&&document.activeElement===v);(e.editingCell.value||K||V)&&X()}if(y.y<24&&y.x>=52){const v=e.hitCol(y.x-52+e.scrollX.value);v>=0&&(e.selectRange(v,0,v,e.rowCount-1,"col"),Ct=!0,at=v,st=0)}else if(y.x<52&&y.y>=24){const v=e.hitRow(y.y-24+e.scrollY.value);v>=0&&(e.selectRange(0,v,e.colCount-1,v,"row"),Ct=!0,at=0,st=v)}else y.x<52&&y.y<24&&e.selectAll();s();return}const z=e.hitCol(y.x-52+e.scrollX.value),_=e.hitRow(y.y-24+e.scrollY.value);if(!(z<0||_<0)){{const v=l.formulaBarRef.value,K=!!(v&&typeof document<"u"&&document.activeElement===v);(e.editingCell.value||K||V)&&X()}if(d.shiftKey&&e.selection.value){const v=e.selection.value;e.selectRange(v.startCol,v.startRow,z,_)}else e.selectCell(z,_);Ct=!0,at=z,st=_,l.focusEditInput(),s()}}function Pt(d){if(w){const K=Ot(d,l.canvasRef.value).x-52+e.scrollX.value-h,we=pe+K;we>=30&&we<=1e3?e.colWidths.value[me]=we:we<30?e.colWidths.value[me]=30:e.colWidths.value[me]=1e3,s();return}if(F){const K=Ot(d,l.canvasRef.value).y-24+e.scrollY.value-h,we=pe+K;we>=24&&we<=500?e.rowHeights.value[Ce]=we:we<24?e.rowHeights.value[Ce]=24:e.rowHeights.value[Ce]=500,s();return}if(!Ct){const v=l.canvasRef.value;if(!v)return;if(n.paintFmt.value){v.style.cursor="copy";return}const K=Ot(d,v);if(K.y<24&&K.x>=52){const we=e.hitCol(K.x-52+e.scrollX.value);if(we>=0&&Math.abs(K.x-(52+e.colPositions.value[we+1]-e.scrollX.value))<=4){v.style.cursor="col-resize";return}}if(K.x<52&&K.y>=24){const we=e.hitRow(K.y-24+e.scrollY.value);if(we>=0&&Math.abs(K.y-(24+e.rowPositions.value[we+1]-e.scrollY.value))<=4){v.style.cursor="row-resize";return}}v.style.cursor="cell";return}const y=Ot(d,l.canvasRef.value);if(at<0||st<0)return;if(y.x<52||y.y<24){if(y.y<24&&y.x>=52){const v=e.hitCol(y.x-52+e.scrollX.value);v>=0&&e.selectRange(Math.min(at,v),0,Math.max(at,v),e.rowCount-1,"col")}else if(y.x<52&&y.y>=24){const v=e.hitRow(y.y-24+e.scrollY.value);v>=0&&e.selectRange(0,Math.min(st,v),e.colCount-1,Math.max(st,v),"row")}s();return}const z=e.hitCol(y.x-52+e.scrollX.value),_=e.hitRow(y.y-24+e.scrollY.value);z<0||_<0||(st===0&&at>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(at,z),0,Math.max(at,z),e.rowCount-1,"col"):at===0&&st>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(st,_),e.colCount-1,Math.max(st,_),"row"):e.selectRange(at,st,z,_),s())}function zt(d){const y=w||F;Ct=!1,w=!1,F=!1,y&&l.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat()}function bt(){const d=w||F;Ct=!1,w=!1,F=!1,d&&l.scheduleOptEmit()}function Yt(d){d.preventDefault();const y=Ot(d,l.canvasRef.value);if(y.x<52&&y.y<24){I(d);return}if(y.y<24&&y.x>=52){const z=e.hitCol(y.x-52+e.scrollX.value);z>=0&&C(d,z);return}if(y.x<52&&y.y>=24){const z=e.hitRow(y.y-24+e.scrollY.value);z>=0&&O(d,z);return}if(y.x>=52&&y.y>=24){const z=e.hitCol(y.x-52+e.scrollX.value),_=e.hitRow(y.y-24+e.scrollY.value);z>=0&&_>=0&&se(d,z,_)}}function Xt(d){const y=Ot(d,l.canvasRef.value);if(y.x<52||y.y<24)return;const z=e.hitCol(y.x-52+e.scrollX.value),_=e.hitRow(y.y-24+e.scrollY.value);if(!(z<0||_<0)){{const v=l.formulaBarRef.value,K=!!(v&&typeof document<"u"&&document.activeElement===v);(e.editingCell.value||K||V)&&X()}e.selectCell(z,_),e.ensureVisible(z,_),e.startEdit(),s(),l.focusEditInput()}}function Tt(d){l.clampScroll(e.scrollX.value+d.deltaX,e.scrollY.value+d.deltaY),s()}function Tl(d){if(d.touches.length!==1){he=!1;return}const y=d.touches[0],z=l.canvasRef.value;if(!z)return;const _=z.getBoundingClientRect(),v=y.clientX-_.left,K=y.clientY-_.top;v>=52&&K>=24?(d.preventDefault(),he=!0,De=!1,We="cell",k=v,R=K,U=e.scrollX.value,q=e.scrollY.value,Te=e.hitCol(v-52+e.scrollX.value),Ae=e.hitRow(K-24+e.scrollY.value)):v>=0&&K>=0&&(v<52||K<24)&&(d.preventDefault(),he=!0,De=!1,k=v,R=K,U=e.scrollX.value,q=e.scrollY.value,K<24&&v>=52?(We="col",Te=e.hitCol(v-52+e.scrollX.value),Ae=-1):v<52&&K>=24?(We="row",Ae=e.hitRow(K-24+e.scrollY.value),Te=-1):(We="all",Te=-1,Ae=-1))}function Nt(d){if(!he||d.touches.length!==1)return;const y=d.touches[0],z=l.canvasRef.value;if(!z)return;const _=z.getBoundingClientRect(),v=y.clientX-_.left,K=y.clientY-_.top;(Math.abs(v-k)>8||Math.abs(K-R)>8)&&(De=!0,d.preventDefault(),l.clampScroll(U+(k-v),q+(R-K)),s())}function jt(){if(he&&(he=!1,!De))if(We==="cell"&&Te>=0&&Ae>=0){const d=Date.now();Te===gt&&Ae===Xe&&d-Ie<300?(e.selectCell(Te,Ae),e.startEdit(),s(),l.focusEditInput(),Ie=0):(e.commitEdit(),e.selectCell(Te,Ae),s(),Ie=d),gt=Te,Xe=Ae,l.focusEditInput()}else We==="col"&&Te>=0?(e.commitEdit(),e.selectRange(Te,0,Te,e.rowCount-1,"col"),s()):We==="row"&&Ae>=0?(e.commitEdit(),e.selectRange(0,Ae,e.colCount-1,Ae,"row"),s()):We==="all"&&(e.commitEdit(),e.selectAll(),s())}function Wt(d){return d.isComposing||d.key==="Process"||d.keyCode===229}function Nl(d){return d.key.length===1&&!d.ctrlKey&&!d.metaKey&&!d.altKey}function ao(d){if(e.editingCell.value)return;const y=d.ctrlKey||d.metaKey,z=d.shiftKey;switch(!0){case(y&&(d.key==="c"||d.key==="C")):d.preventDefault(),o.copyToClipboard();return;case(y&&(d.key==="x"||d.key==="X")):d.preventDefault(),o.cutSelected();return;case(y&&(d.key==="z"||d.key==="Z")):d.preventDefault(),n.undo();return;case(y&&(d.key==="y"||d.key==="Y")):d.preventDefault(),n.redo();return;case(y&&(d.key==="v"||d.key==="V")):d.preventDefault(),n.saveUndo(),o.pasteFromClipboard().then(()=>{s(),t.nextTick(()=>l.emitModelData())});return;case(y&&(d.key==="a"||d.key==="A")):d.preventDefault(),e.selectAll(),s();return;case(y&&d.key==="Home"):d.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),s();return;case(y&&d.key==="End"):d.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),s();return;case d.key==="Home":d.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),s();return;case d.key==="End":d.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),s();return;case d.key==="ArrowUp":d.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s();return;case d.key==="ArrowDown":d.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s();return;case d.key==="ArrowLeft":d.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s();return;case d.key==="ArrowRight":d.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s();return;case d.key==="Tab":d.preventDefault(),e.moveActive(z?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s();return;case d.key==="Enter":d.preventDefault(),e.moveActive(0,z?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s();return;case d.key==="F2":d.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),s(),l.focusEditInput();return;case d.key==="Delete":case d.key==="Backspace":d.preventDefault(),n.saveUndo(),o.clearSelected(),s();return;case d.key==="Escape":d.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,s();return;case Nl(d):if(Wt(d)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),s(),l.focusEditInput();return}d.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(d.key),s(),t.nextTick(()=>{const _=l.editInputRef.value;_&&(_.focus(),_.setSelectionRange(1,1))});return}}let Al=!1,Il=!1;function bi(d){const y=d.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(y),E.value=y,s();return}e.editValue.value=y,E.value=y}function yi(){Al=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),E.value="",s())}function vi(d){Al=!1,Il=!0,setTimeout(()=>{Il=!1},0);const y=d.target.value;e.editValue.value=y,E.value=y}function Ci(d){if(!e.editingCell.value){if(Nl(d)||Wt(d))return;ao(d);return}if(!(Al||Wt(d))&&!(Il&&(d.key==="Enter"||d.key==="Escape")))if(d.key==="Enter"&&(d.altKey||d.metaKey)){d.preventDefault();const y=l.editInputRef.value;if(!y)return;const z=y.selectionStart??y.value.length,_=y.selectionEnd??y.value.length,v=y.value,K=v.slice(0,z)+`
9
- `+v.slice(_);e.editValue.value=K,y.value=K,y.selectionStart=y.selectionEnd=z+1,s()}else d.key==="Enter"?(d.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s(),l.focusEditInput()):d.key==="Tab"?(d.preventDefault(),e.commitEdit(),e.moveActive(d.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),s(),l.focusEditInput()):d.key==="Escape"&&(d.preventDefault(),e.cancelEdit(),s(),l.focusEditInput())}function wi(d){e.editingCell.value}function ki(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),s())},0)}let mt=null;function al(){var y;const d=(y=l.wrapperRef.value)==null?void 0:y.getBoundingClientRect();if(d){const z=Ft(e.props.width),_=Ft(e.props.height);z!=null?l.viewSize.w=z:l.viewSize.w=d.width,_!=null?l.viewSize.h=_:l.viewSize.h=d.height}l.clampScroll(null,null),s()}function Ei(){t.onMounted(()=>{const d=Ft(e.props.width),y=Ft(e.props.height);(d==null||y==null)&&(mt=new ResizeObserver(()=>al()),l.wrapperRef.value&&mt.observe(l.wrapperRef.value)),t.nextTick(()=>{al(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(a.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map(z=>{const _=l.mkSheet(z.name),{cells:v,styles:K}=to(z.cells);if(Object.assign(_.cells,v),_.styles=z.styles??K,z.borders)_.borders=z.borders;else{const we=lo(_.styles);_.styles=we.styles,_.borders=we.borders}if(z.colWidths)for(const[we,Ee]of Object.entries(z.colWidths)){const ge=Number(we);ge>=0&&ge<e.colCount&&Ee>=30&&(_.colWidths[ge]=Ee)}if(z.rowHeights)for(const[we,Ee]of Object.entries(z.rowHeights)){const ge=Number(we);ge>=0&&ge<e.rowCount&&Ee>=24&&(_.rowHeights[ge]=Ee)}if(z.merges)for(const[we,Ee]of Object.entries(z.merges))_.merges[we]={...Ee};return _}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const d=Ft(e.props.width),y=Ft(e.props.height);d!=null&&y!=null?(mt==null||mt.disconnect(),mt=null):!mt&&l.wrapperRef.value&&(mt=new ResizeObserver(()=>al()),mt.observe(l.wrapperRef.value)),t.nextTick(()=>al())}),t.watch(()=>e.props.theme,()=>s()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),s()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,d=>{if(!d||d.length===0)return;const y=JSON.stringify(d);if(y===a.value)return;a.value=y;const z=e.selection.value?{...e.selection.value}:null,_={...e.activeCell.value};l.sheets.value=d.map(v=>{const K=l.mkSheet(v.name),{cells:we,styles:Ee}=to(v.cells);if(Object.assign(K.cells,we),K.styles=v.styles??Ee,v.borders)K.borders=v.borders;else{const ge=lo(K.styles);K.styles=ge.styles,K.borders=ge.borders}if(v.colWidths)for(const[ge,Me]of Object.entries(v.colWidths)){const qe=Number(ge);qe>=0&&qe<e.colCount&&Me>=30&&(K.colWidths[qe]=Me)}if(v.rowHeights)for(const[ge,Me]of Object.entries(v.rowHeights)){const qe=Number(ge);qe>=0&&qe<e.rowCount&&Me>=24&&(K.rowHeights[qe]=Me)}if(v.merges)for(const[ge,Me]of Object.entries(v.merges))K.merges[ge]={...Me};return K}),l.sheets.value.length>0&&l.loadSheet(0),z&&(e.selection.value=z),e.activeCell.value=_,s()},{deep:!0}),t.onBeforeUnmount(()=>{mt==null||mt.disconnect()})}return{scheduleRender:s,render:S,activeCellLabel:T,formulaBarDisplay:x,formulaBarDraft:E,formulaBarExpanded:B,onFormulaBarFocus:te,onFormulaBarInput:ie,onFormulaBarKeydown:Z,onFormulaBarBlur:oe,acceptFormulaBarEdit:X,cancelFormulaBarEdit:ae,renTab:ne,renTabVal:ce,onTabClick:Ne,onTabDblClick:Ve,commitTabRename:Ye,cclTabRename:Le,onTabRenameKd:ye,ctxMenu:J,ctxSubmenuLeft:c,onCtxItemEnter:f,onTabCtxMenu:m,onTabBarCtx:A,onCornerCtx:I,onRowHdrCtx:O,onColHdrCtx:C,onCellCtx:se,dimInputRef:$,dimPanel:u,openDimPanel:re,onDimInput:W,onDimKeydown:ke,onDimBlur:Ke,applyDimPanel:nt,closeDimPanel:rt,editInputStyle:H,hScrollbarW:ve,vScrollbarH:L,hTrackW:Y,vTrackH:Be,hThumbW:de,hThumbL:Re,vThumbH:Fe,vThumbT:Ze,onVStart:Dt,onHStart:ct,onSbMove:ut,onSbUp:ht,onVTrk:rl,onHTrk:$t,onMouseDown:Gt,onMouseMove:Pt,onMouseUp:zt,onMouseLeave:bt,onCanvasCtx:Yt,onDblClick:Xt,onWheel:Tt,onTouchStart:Tl,onTouchMove:Nt,onTouchEnd:jt,onKeydown:ao,onEditInput:bi,onEditCompositionStart:yi,onEditCompositionEnd:vi,onEditKd:Ci,onEditPaste:wi,onEditBlur:ki,applySize:al,setupLifecycle:Ei}}function Za(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function no(e,n,o,l){return n?l?o?e===n:e.toLowerCase()===n.toLowerCase():o?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function qa(e,n,o,l){if(!n)return e;if(l){const i=e.indexOf(n);return i<0?e:e.slice(0,i)+o+e.slice(i+n.length)}const a=e.toLowerCase().indexOf(n.toLowerCase());return a<0?e:e.slice(0,a)+o+e.slice(a+n.length)}function Ja(e,n,o,l){return n?l?e.indexOf(n)<0?e:e.split(n).join(o):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(Za(n),"gi"),()=>o):e}function Dl(e,n,o,l,a,i,r){const p=[];if(r){for(let s=r.startRow;s<=r.endRow;s++)for(let b=r.startCol;b<=r.endCol;b++){const S=e[o(b,s)];S&&no(S.value,l,a,i)&&p.push({sheetIndex:n,col:b,row:s})}return p}for(const s in e){const b=e[s];if(b&&no(b.value,l,a,i)){const S=s.split(","),T=Number(S[0]),E=Number(S[1]);!Number.isNaN(T)&&!Number.isNaN(E)&&p.push({sheetIndex:n,col:T,row:E})}}return p}function Qa(e,n,o,l){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),p=t.ref("sheet"),s=t.ref(!1),b=t.ref(!1),S=t.ref(-1),T=t.ref([]),E=t.ref(""),B=t.ref(0),x=t.ref(""),te=t.computed(()=>{const c=new Set,f=o.activeSheetIndex.value;for(const m of T.value)m.sheetIndex===f&&c.add(`${m.col},${m.row}`);return c}),ie=t.computed(()=>{if(S.value<0||S.value>=T.value.length)return null;const c=T.value[S.value];return c.sheetIndex!==o.activeSheetIndex.value?null:`${c.col},${c.row}`});e.findHighlight=(c,f)=>{const m=`${c},${f}`;return ie.value===m?"active":te.value.has(m)?"match":null};function g(c){var A,I;const f=e.cellKey(c.col,c.row);if(c.sheetIndex===o.activeSheetIndex.value)return((A=e.cells[f])==null?void 0:A.value)??"";const m=o.sheets.value[c.sheetIndex];return((I=m==null?void 0:m.cells[f])==null?void 0:I.value)??""}function V(c,f){const m=e.cellKey(c.col,c.row);if(c.sheetIndex===o.activeSheetIndex.value)e.setCellValue(c.col,c.row,f);else{const A=o.sheets.value[c.sheetIndex];if(!A)return;const I=A.cells[m];A.cells[m]={value:String(f),styleId:I==null?void 0:I.styleId}}}function X(){if(x.value){E.value=x.value;return}if(!i.value){E.value="";return}if(p.value==="selection"&&!e.selection.value){E.value=N(e.locale.value,"findNeedSelection");return}if(T.value.length===0){E.value=N(e.locale.value,"findNoResult");return}E.value=""}function ae(){const c=i.value,f=[];if(c)if(p.value==="workbook")o.sheets.value.forEach((m,A)=>{f.push(...Dl(m.cells,A,e.cellKey,c,s.value,b.value))});else if(p.value==="selection"){const m=e.selection.value;m&&f.push(...Dl(e.cells,o.activeSheetIndex.value,e.cellKey,c,s.value,b.value,m))}else f.push(...Dl(e.cells,o.activeSheetIndex.value,e.cellKey,c,s.value,b.value));T.value=f,f.length===0?S.value=-1:S.value>=f.length?S.value=f.length-1:S.value<0&&(S.value=0),X()}function Z(){if(S.value<0||S.value>=T.value.length)return;const c=T.value[S.value];c.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(c.sheetIndex),p.value==="selection"?e.activeCell.value={col:c.col,row:c.row}:e.selectCell(c.col,c.row),e.ensureVisible(c.col,c.row)}const oe=typeof requestAnimationFrame=="function"?requestAnimationFrame:c=>setTimeout(c,16);let ne=!1,ce=!1;function Ne(c){if(ne){ce=ce||c;return}ne=!0,ce=c,oe(()=>{var f;ne=!1,ae(),ce&&T.value.length>0&&S.value>=0&&Z(),ce=!1,(f=e.scheduleRender)==null||f.call(e)})}function Ve(){var c;a.value=!0,B.value++,ae(),T.value.length>0&&(S.value=0,Z()),(c=e.scheduleRender)==null||c.call(e)}function Ye(){Ve()}function Le(){var c;a.value=!1,T.value=[],S.value=-1,x.value="",E.value="",(c=e.scheduleRender)==null||c.call(e)}function ye(){var c;T.value.length!==0&&(S.value=(S.value+1)%T.value.length,Z(),(c=e.scheduleRender)==null||c.call(e))}function J(){var c;T.value.length!==0&&(S.value=(S.value-1+T.value.length)%T.value.length,Z(),(c=e.scheduleRender)==null||c.call(e))}function P(){var I,O;if(S.value<0||S.value>=T.value.length)return;const c=T.value[S.value],f=g(c),m=qa(f,i.value,r.value,s.value);if(m===f)return;n.saveUndo(),V(c,m);const A=S.value;ae(),T.value.length>0?(S.value=Math.min(A,T.value.length-1),ye()):S.value=-1,(I=e.emitModelData)==null||I.call(e),(O=e.scheduleRender)==null||O.call(e)}function fe(){var A,I;const c=i.value;if(!c||T.value.length===0)return;n.saveUndo();let f=0;const m=T.value.slice();for(const O of m){const C=g(O),se=Ja(C,c,r.value,s.value);se!==C&&(V(O,se),f++)}T.value=[],S.value=-1,x.value=N(e.locale.value,"findReplacedAll").replace("{n}",String(f)),X(),(A=e.emitModelData)==null||A.call(e),(I=e.scheduleRender)==null||I.call(e)}function Q(){const c=f=>{if(!(f.ctrlKey||f.metaKey))return;const A=f.key.toLowerCase();(A==="f"||A==="h")&&(f.preventDefault(),Ve())};window.addEventListener("keydown",c),t.onBeforeUnmount(()=>window.removeEventListener("keydown",c))}return t.watch(i,()=>{a.value&&(x.value="",S.value=0,Ne(!0))}),t.watch([p,s,b],()=>{a.value&&(x.value="",S.value=0,Ne(!0))}),t.watch(e.cells,()=>{a.value&&Ne(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&p.value==="selection"&&(S.value=0,Ne(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{a.value&&Ne(!1)}),{open:a,findText:i,replaceText:r,scope:p,matchCase:s,matchEntireCell:b,currentIndex:S,results:T,message:E,focusToken:B,activeSheetMatches:te,activeMatchKey:ie,openFind:Ve,openReplace:Ye,close:Le,recompute:ae,findNext:ye,findPrev:J,replace:P,replaceAll:fe,setupLifecycle:Q}}const ei={class:"formula-bar__cell-label"},ti={class:"formula-bar__buttons"},li=["rows","value"],oi=["title"],ni={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ri={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ai=["value"],ii={key:2,class:"sb-corner"},ci=["onClick","onMouseenter"],si={class:"context-menu__label"},di={key:0,class:"context-menu__arrow"},ui=["onClick"],fi={class:"dim-panel__title"},mi={class:"dim-panel__body"},pi=["value"],hi={key:0,class:"dim-panel__error"},gi={class:"dim-panel__footer"},ro=vt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const n=e,o=t.useModel(e,"data"),l={value:""},a=Ka(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:Q=>{},mkSheet:Q=>({id:"",name:Q,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=Ua(a,i),p=Pa(a,r);Ga(r,{borderMenuOpen:p.borderMenuOpen,mergeMenuOpen:p.mergeMenuOpen});const s=Xa(a,r,o,void 0,l);i.sheets=s.sheets,i.activeSheetIndex=s.activeSheetIndex,i.saveSheet=s.saveSheet,i.loadSheet=s.loadSheet,i.mkSheet=s.mkSheet;const b=ja(a,r,p,s,l);b.setupLifecycle();const S=Qa(a,r,s);S.setupLifecycle();const T=t.reactive(a),E=t.reactive(r),B=t.reactive(p),x=t.reactive(s),te=s.sheets,ie=s.activeSheetIndex,g=t.reactive(b),V=t.reactive(S),X=t.computed(()=>{const Q=T.selection;return!!Q&&Q.startCol===Q.endCol&&Q.startRow===Q.endRow}),ae=t.computed(()=>{const Q=E.selNumberFormat;if(Q!==sl)return Q;const c=T.activeCell,f=a.resolveStyle(T.cells[T.cellKey(c.col,c.row)]);return typeof(f==null?void 0:f.numberFormat)=="string"?f.numberFormat:""});function Z(Q){r.nfDialogOpen.value=Q}function oe(Q){r.fontSizeMenuOpen.value=Q}function ne(Q){r.textColorMenuOpen.value=Q}function ce(Q){r.fillColorMenuOpen.value=Q}function Ne(Q){b.renTabVal.value=Q}function Ve(){b.ctxMenu.value=null}const Ye=Q=>{s.formulaBarRef.value=Q};function Le(){b.formulaBarExpanded.value=!b.formulaBarExpanded.value}const ye=Q=>{s.wrapperRef.value=Q},J=Q=>{s.canvasRef.value=Q},P=Q=>{s.editInputRef.value=Q},fe=Q=>{b.dimInputRef.value=Q};return(Q,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(x.outerStyle)},[t.createVNode(yr,{locale:T.locale,"can-undo":E.canUndo,"can-redo":E.canRedo,"paint-fmt-active":E.paintFmt!==null,"has-selection":E.hasSelection,"font-family-options":E.fontFamilyOptions,"font-size-options":E.fontSizeOptions,"sel-font-family":E.selFontFamily,"sel-font-size":E.selFontSize,"font-size-input":E.fontSizeInput,"font-size-menu-open":E.fontSizeMenuOpen,"sel-font-weight":E.selFontWeight,"sel-font-style":E.selFontStyle,"sel-underline":E.selUnderline,"sel-strikethrough":E.selStrikethrough,"sel-text-color":E.selTextColor,"text-color-menu-open":E.textColorMenuOpen,"sel-fill-color":E.selFillColor,"fill-color-menu-open":E.fillColorMenuOpen,"cached-text-color":E.cachedTextColor,"cached-fill-color":E.cachedFillColor,"border-menu-open":B.borderMenuOpen,"cached-border":B.cachedBorder,"h-align-options":E.hAlignOptions,"v-align-options":E.vAlignOptions,"sel-h-align":E.selHAlign,"sel-v-align":E.selVAlign,"sel-wrap":E.selWrap,"merge-menu-open":B.mergeMenuOpen,"calc-menu-open":B.calcMenuOpen,"is-single-cell":X.value,"sel-number-format":E.selNumberFormat,"nf-options":E.nfOptions,"theme-vars":x.toolbarThemeVars,onUndo:c[0]||(c[0]=f=>E.undo()),onRedo:c[1]||(c[1]=f=>E.redo()),onPaintFormat:E.onPaintFormat,onClearFormat:c[2]||(c[2]=f=>E.clearFormat()),onNumberFormatChange:c[3]||(c[3]=f=>E.onNumberFormatChange(f)),onFontFamilyChange:c[4]||(c[4]=f=>E.onFontFamilyChange(f)),onFontSizeInput:c[5]||(c[5]=f=>E.onFontSizeInput(f)),onFontSizeBlur:E.onFontSizeBlur,onFontSizeKeydown:c[6]||(c[6]=f=>E.onFontSizeKeydown(f)),onFontSizeChange:c[7]||(c[7]=f=>E.onFontSizeChange(f)),"onUpdate:fontSizeMenuOpen":c[8]||(c[8]=f=>oe(f)),onFontSizeToggle:c[9]||(c[9]=f=>E.toggleFontSizeMenu()),onFontSizeStepUp:E.onFontSizeStepUp,onFontSizeStepDown:E.onFontSizeStepDown,onBoldToggle:E.toggleFontWeight,onItalicToggle:E.toggleFontStyle,onUnderlineToggle:E.toggleUnderline,onStrikethroughToggle:E.toggleStrikethrough,onTextColorChange:c[10]||(c[10]=f=>E.onTextColorChange(f)),"onUpdate:textColorMenuOpen":c[11]||(c[11]=f=>ne(f)),onFillColorChange:c[12]||(c[12]=f=>E.onFillColorChange(f)),"onUpdate:fillColorMenuOpen":c[13]||(c[13]=f=>ce(f)),onApplyTextColor:E.applyCachedTextColor,onApplyFillColor:E.applyCachedFillColor,"onUpdate:borderMenuOpen":c[14]||(c[14]=f=>E.onBorderMenuToggle(f)),onBorderChange:c[15]||(c[15]=f=>B.onBorderChange(f)),onApplyBorder:B.applyCachedBorder,onHAlignChange:c[16]||(c[16]=f=>E.onHAlignChange(f)),onVAlignChange:c[17]||(c[17]=f=>E.onVAlignChange(f)),onWrapToggle:E.onWrapToggle,"onUpdate:mergeMenuOpen":c[18]||(c[18]=f=>B.onMergeMenuToggle(f)),onMergeChange:c[19]||(c[19]=f=>B.onMergeChange(f)),onApplyMerge:B.onApplyMerge,"onUpdate:calcMenuOpen":c[20]||(c[20]=f=>B.onCalcMenuToggle(f)),onCalcSum:B.onCalcSum,onCalcAvg:B.onCalcAvg,onCalcCount:B.onCalcCount,onFind:c[21]||(c[21]=f=>t.unref(S).openFind())},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","sel-number-format","nf-options","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(Xr,{open:V.open,"find-text":V.findText,"replace-text":V.replaceText,scope:V.scope,"match-case":V.matchCase,"match-entire-cell":V.matchEntireCell,"current-index":V.currentIndex,total:V.results.length,message:V.message,"focus-token":V.focusToken,locale:T.locale,"theme-vars":x.toolbarThemeVars,"onUpdate:findText":c[22]||(c[22]=f=>t.unref(S).findText.value=f),"onUpdate:replaceText":c[23]||(c[23]=f=>t.unref(S).replaceText.value=f),"onUpdate:scope":c[24]||(c[24]=f=>t.unref(S).scope.value=f),"onUpdate:matchCase":c[25]||(c[25]=f=>t.unref(S).matchCase.value=f),"onUpdate:matchEntireCell":c[26]||(c[26]=f=>t.unref(S).matchEntireCell.value=f),onPrev:c[27]||(c[27]=f=>t.unref(S).findPrev()),onNext:c[28]||(c[28]=f=>t.unref(S).findNext()),onReplace:c[29]||(c[29]=f=>t.unref(S).replace()),onReplaceAll:c[30]||(c[30]=f=>t.unref(S).replaceAll()),onClose:c[31]||(c[31]=f=>t.unref(S).close())},null,8,["open","find-text","replace-text","scope","match-case","match-entire-cell","current-index","total","message","focus-token","locale","theme-vars"]),t.createVNode(xa,{"model-open":E.nfDialogOpen,locale:T.locale,"current-format":ae.value,"onUpdate:modelOpen":c[32]||(c[32]=f=>Z(f)),onApply:c[33]||(c[33]=f=>E.applyNumberFormatCode(f))},null,8,["model-open","locale","current-format"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":g.formulaBarExpanded}])},[t.createElementVNode("div",ei,t.toDisplayString(g.activeCellLabel),1),t.createElementVNode("div",ti,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:c[34]||(c[34]=t.withModifiers(()=>{},["prevent"])),onClick:c[35]||(c[35]=t.withModifiers((...f)=>g.cancelFormulaBarEdit&&g.cancelFormulaBarEdit(...f),["stop"]))},[...c[85]||(c[85]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 3l8 8M11 3l-8 8",fill:"none",stroke:"#e53935","stroke-width":"1.8","stroke-linecap":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:"接受(Enter)","aria-label":"接受",onMousedown:c[36]||(c[36]=t.withModifiers(()=>{},["prevent"])),onClick:c[37]||(c[37]=t.withModifiers((...f)=>g.acceptFormulaBarEdit&&g.acceptFormulaBarEdit(...f),["stop"]))},[...c[86]||(c[86]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M2.5 7.5l3.5 3.5L12 3.5",fill:"none",stroke:"#2e7d32","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],32)]),t.createElementVNode("textarea",{ref:Ye,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":g.formulaBarExpanded}]),rows:g.formulaBarExpanded?3:1,value:g.formulaBarDisplay,spellcheck:"false",onFocus:c[38]||(c[38]=(...f)=>g.onFormulaBarFocus&&g.onFormulaBarFocus(...f)),onInput:c[39]||(c[39]=(...f)=>g.onFormulaBarInput&&g.onFormulaBarInput(...f)),onKeydown:c[40]||(c[40]=(...f)=>g.onFormulaBarKeydown&&g.onFormulaBarKeydown(...f)),onBlur:c[41]||(c[41]=(...f)=>g.onFormulaBarBlur&&g.onFormulaBarBlur(...f))},null,42,li),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:g.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:c[42]||(c[42]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Le,["stop"])},[g.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",ri,[...c[88]||(c[88]=[t.createElementVNode("path",{d:"M2 8l4-4 4 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",ni,[...c[87]||(c[87]=[t.createElementVNode("path",{d:"M2 4l4 4 4-4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))],40,oi)],2),t.createElementVNode("div",{ref:ye,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:J,class:"grid-canvas",tabindex:"0",onMousedown:c[43]||(c[43]=(...f)=>g.onMouseDown&&g.onMouseDown(...f)),onMousemove:c[44]||(c[44]=(...f)=>g.onMouseMove&&g.onMouseMove(...f)),onMouseup:c[45]||(c[45]=(...f)=>g.onMouseUp&&g.onMouseUp(...f)),onMouseleave:c[46]||(c[46]=(...f)=>g.onMouseLeave&&g.onMouseLeave(...f)),onDblclick:c[47]||(c[47]=(...f)=>g.onDblClick&&g.onDblClick(...f)),onWheel:c[48]||(c[48]=t.withModifiers((...f)=>g.onWheel&&g.onWheel(...f),["prevent"])),onFocus:c[49]||(c[49]=(...f)=>x.onCanvasFocus&&x.onCanvasFocus(...f)),onKeydown:c[50]||(c[50]=(...f)=>g.onKeydown&&g.onKeydown(...f)),onContextmenu:c[51]||(c[51]=(...f)=>g.onCanvasCtx&&g.onCanvasCtx(...f)),onTouchstart:c[52]||(c[52]=t.withModifiers((...f)=>g.onTouchStart&&g.onTouchStart(...f),["prevent"])),onTouchmove:c[53]||(c[53]=t.withModifiers((...f)=>g.onTouchMove&&g.onTouchMove(...f),["prevent"])),onTouchend:c[54]||(c[54]=(...f)=>g.onTouchEnd&&g.onTouchEnd(...f))},null,32),t.createElementVNode("textarea",{ref:P,class:"cell-editor",value:T.editValue,style:t.normalizeStyle(g.editInputStyle),onInput:c[55]||(c[55]=(...f)=>g.onEditInput&&g.onEditInput(...f)),onKeydown:c[56]||(c[56]=(...f)=>g.onEditKd&&g.onEditKd(...f)),onCompositionstart:c[57]||(c[57]=(...f)=>g.onEditCompositionStart&&g.onEditCompositionStart(...f)),onCompositionend:c[58]||(c[58]=(...f)=>g.onEditCompositionEnd&&g.onEditCompositionEnd(...f)),onBlur:c[59]||(c[59]=(...f)=>g.onEditBlur&&g.onEditBlur(...f)),onPaste:c[60]||(c[60]=(...f)=>g.onEditPaste&&g.onEditPaste(...f))},null,44,ai),x.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:c[61]||(c[61]=t.withModifiers(f=>{x.clampScroll(null,T.scrollY-50),g.scheduleRender()},["prevent"]))},[...c[89]||(c[89]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[63]||(c[63]=(...f)=>g.onVTrk&&g.onVTrk(...f))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:g.vThumbT+"px",height:g.vThumbH+"px"}),onMousedown:c[62]||(c[62]=(...f)=>g.onVStart&&g.onVStart(...f))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[64]||(c[64]=t.withModifiers(f=>{x.clampScroll(null,T.scrollY+50),g.scheduleRender()},["prevent"]))},[...c[90]||(c[90]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),x.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:c[65]||(c[65]=t.withModifiers(f=>{x.clampScroll(T.scrollX-50,null),g.scheduleRender()},["prevent"]))},[...c[91]||(c[91]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[67]||(c[67]=(...f)=>g.onHTrk&&g.onHTrk(...f))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:g.hThumbL+"px",width:g.hThumbW+"px"}),onMousedown:c[66]||(c[66]=(...f)=>g.onHStart&&g.onHStart(...f))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[68]||(c[68]=t.withModifiers(f=>{x.clampScroll(T.scrollX+50,null),g.scheduleRender()},["prevent"]))},[...c[92]||(c[92]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),x.maxScrollX>0&&x.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",ii)):t.createCommentVNode("",!0)]),t.createVNode(Nr,{locale:T.locale,sheets:t.unref(te),"active-sheet-index":t.unref(ie),"ren-tab":g.renTab,"ren-tab-val":g.renTabVal,onTabClick:c[69]||(c[69]=f=>g.onTabClick(f)),onTabDblclick:c[70]||(c[70]=f=>g.onTabDblClick(f)),onTabContextmenu:c[71]||(c[71]=f=>g.onTabCtxMenu(f.ev,f.i)),onTabRenameInput:c[72]||(c[72]=f=>Ne(f)),onTabRenameKeydown:c[73]||(c[73]=f=>g.onTabRenameKd(f)),onTabRenameCommit:g.commitTabRename,onTabbarContextmenu:c[74]||(c[74]=f=>g.onTabBarCtx(f)),onDeleteSheet:c[75]||(c[75]=f=>{x.removeSheet(f),g.scheduleRender()}),onAddSheet:c[76]||(c[76]=f=>{x.addSheet(),g.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:g.ctxMenu.x+"px",top:g.ctxMenu.y+"px"}),onClick:c[77]||(c[77]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.ctxMenu.items,(f,m)=>(t.openBlock(),t.createElementBlock("div",{key:m,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":f.disabled}]),onClick:A=>!f.disabled&&f.action&&(f.action(),Ve()),onMouseenter:A=>g.onCtxItemEnter(A,f)},[t.createElementVNode("span",si,t.toDisplayString(f.label),1),f.children?(t.openBlock(),t.createElementBlock("span",di)):t.createCommentVNode("",!0),f.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":g.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.children,(A,I)=>(t.openBlock(),t.createElementBlock("div",{key:I,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":A.disabled}]),onClick:t.withModifiers(O=>!A.disabled&&A.action&&(A.action(),Ve()),["stop"])},t.toDisplayString(A.label),11,ui))),128))],2)):t.createCommentVNode("",!0)],42,ci))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:g.dimPanel.x+"px",top:g.dimPanel.y+"px"}),onMousedown:c[83]||(c[83]=t.withModifiers(()=>{},["stop"])),onClick:c[84]||(c[84]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",fi,t.toDisplayString(g.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",mi,[t.createElementVNode("input",{ref:fe,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":g.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:g.dimPanel.value,onInput:c[78]||(c[78]=(...f)=>g.onDimInput&&g.onDimInput(...f)),onKeydown:c[79]||(c[79]=(...f)=>g.onDimKeydown&&g.onDimKeydown(...f)),onBlur:c[80]||(c[80]=(...f)=>g.onDimBlur&&g.onDimBlur(...f))},null,42,pi),c[93]||(c[93]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),g.dimPanel.error?(t.openBlock(),t.createElementBlock("div",hi,t.toDisplayString(g.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",gi,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[81]||(c[81]=(...f)=>g.applyDimPanel&&g.applyDimPanel(...f))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[82]||(c[82]=(...f)=>g.closeDimPanel&&g.closeDimPanel(...f))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-dc46aaa8"]]);Mt.Spreader=ro,Mt.default=ro,Object.defineProperties(Mt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(Lt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Lt=typeof globalThis<"u"?globalThis:Lt||self,t(Lt.XiaoDaoSpreader={},Lt.Vue))})(this,function(Lt,t){"use strict";const vn={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",sheetList:"工作表列表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfIncreaseDecimals:"增加小数位数",nfDecreaseDecimals:"减少小数位数",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatGeneral:"常规",nfCatNumber:"数值",nfCatCurrency:"货币",nfCatAccounting:"会计专用",nfCatFinancial:"财务",nfCatPercent:"百分比",nfCatScientific:"科学计数",nfCatDate:"日期",nfCatTime:"时间",nfCatText:"文本",nfCatCurrencyRounded:"货币取整",nfCatDateTime:"日期和时间",nfCatDuration:"持续时间",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",sheetList:"Sheet list",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",avg:"Average",count:"Count",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfIncreaseDecimals:"Increase Decimal",nfDecreaseDecimals:"Decrease Decimal",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatGeneral:"General",nfCatNumber:"Number",nfCatCurrency:"Currency",nfCatAccounting:"Accounting",nfCatFinancial:"Financial",nfCatPercent:"Percentage",nfCatScientific:"Scientific",nfCatDate:"Date",nfCatTime:"Time",nfCatText:"Text",nfCatCurrencyRounded:"Currency Rounded",nfCatDateTime:"Date & Time",nfCatDuration:"Duration",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close"}};function T(e,n){var o;return((o=vn[e])==null?void 0:o[n])??n}const al='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',It=10,Cn=[{label:"",value:""},{label:"微软雅黑",value:'"Microsoft YaHei", "微软雅黑", sans-serif'},{label:"宋体",value:'"SimSun", "宋体", serif'},{label:"黑体",value:'"SimHei", "黑体", sans-serif'},{label:"楷体",value:'"KaiTi", "楷体", serif'},{label:"Arial",value:"Arial, sans-serif"},{label:"Arial Black",value:'"Arial Black", sans-serif'},{label:"Times New Roman",value:'"Times New Roman", serif'},{label:"Courier New",value:'"Courier New", monospace'},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Impact",value:"Impact, sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Trebuchet MS",value:'"Trebuchet MS", sans-serif'},{label:"Comic Sans MS",value:'"Comic Sans MS", cursive'}],wn=[{label:"9",value:9},{label:"10",value:10},{label:"11",value:11},{label:"12",value:12},{label:"13",value:13},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"20",value:20},{label:"24",value:24},{label:"28",value:28},{label:"32",value:32},{label:"36",value:36},{label:"48",value:48},{label:"72",value:72}],kn='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="19" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="17" y2="18"/></svg>',En='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>',Sn='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="5" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="7" y1="18" x2="21" y2="18"/></svg>',Rn='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="7" x2="6" y2="20"/><line x1="12" y1="7" x2="12" y2="16"/><line x1="18" y1="7" x2="18" y2="20"/><line x1="4" y1="3" x2="20" y2="3"/></svg>',Bn='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="20"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="18" y1="4" x2="18" y2="20"/></svg>',xn='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="17"/><line x1="12" y1="8" x2="12" y2="17"/><line x1="18" y1="4" x2="18" y2="17"/><line x1="4" y1="21" x2="20" y2="21"/></svg>',Mn=[{value:"left",labelKey:"alignLeft",icon:kn},{value:"center",labelKey:"alignCenter",icon:En},{value:"right",labelKey:"alignRight",icon:Sn}],Dn=[{value:"top",labelKey:"alignTop",icon:Rn},{value:"middle",labelKey:"alignMiddle",icon:Bn},{value:"bottom",labelKey:"alignBottom",icon:xn}],Kl=[{key:"mergeCenter",labelKey:"mergeCenter",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"/></svg>'},{key:"mergeAcross",labelKey:"mergeAcross",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M832 64c70.4 0 128 57.6 128 128v640c0 70.4-57.6 128-128 128H192c-70.4 0-128-57.6-128-128V192c0-70.4 57.6-128 128-128h640zM448 768H128v64c0 38.4 25.6 64 64 64h256v-128z m448 0H512v128h320c38.4 0 64-25.6 64-64v-64z m0-448H128v384h768V320zM633.6 390.4l96 96c6.4 6.4 6.4 12.8 6.4 19.2 0 6.4-6.4 12.8-6.4 19.2L633.6 633.6c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32-6.4-44.8l44.8-44.8H288c-19.2 0-32-12.8-32-32s12.8-32 32-32h339.2l-44.8-44.8c-6.4-12.8-6.4-32 0-44.8 12.8-12.8 38.4-12.8 51.2 0zM448 128H192c-38.4 0-64 25.6-64 64v64h320V128z m384 0H512v128h384V192c0-38.4-25.6-64-64-64z"/></svg>'},{key:"mergeCells",labelKey:"mergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M512 480c0 5.376-1.984 10.112-5.952 14.08L354.048 634.048C350.08 638.08 345.344 640 339.968 640s-10.048-1.92-14.08-5.952C321.92 630.144 320 625.344 320 620.032L320 512 224 512C206.336 512 192 497.664 192 480S206.336 448 224 448L320 448 320 339.968c0-5.376 1.92-10.048 5.952-14.08C329.92 321.984 334.656 320 339.968 320s10.048 1.984 14.08 5.952L506.048 465.92C510.016 469.952 512 474.624 512 480zM576 480c0 5.376 1.984 10.112 5.952 14.08l152 140.032C737.92 638.08 742.656 640 748.032 640s10.048-1.92 14.08-5.952C766.08 630.144 768 625.344 768 620.032L768 512l96 0C881.664 512 896 497.664 896 480S881.664 448 864 448L768 448 768 339.968c0-5.376-1.92-10.048-5.952-14.08C758.08 321.984 753.344 320 748.032 320s-10.048 1.984-14.08 5.952L581.952 465.92C577.984 469.952 576 474.624 576 480zM448 128l0 128 64 0L512 128c0-35.392-28.672-64-64-64l0 0L128 64C92.672 64 64 92.608 64 128l0 704c0 35.392 28.672 64 64 64l320 0c35.328 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'},{key:"unmergeCells",labelKey:"unmergeCells",icon:'<svg viewBox="0 0 1024 1024" fill="currentColor"><path d="M197.952 465.92l152-140.032C353.92 321.984 358.656 320 364.032 320s10.048 1.984 14.08 5.952C382.08 329.92 384 334.656 384 339.968L384 448l96 0C497.664 448 512 462.336 512 480S497.664 512 480 512L384 512l0 108.032c0 5.376-1.92 10.112-5.952 14.08C374.08 638.08 369.344 640 364.032 640S353.92 638.08 349.952 634.048L197.952 494.08C193.984 490.112 192 485.376 192 480S193.984 469.952 197.952 465.92zM890.048 465.92l-152-140.032C734.08 321.984 729.344 320 723.968 320s-10.048 1.984-14.08 5.952C705.92 329.92 704 334.656 704 339.968L704 448 608 448C590.336 448 576 462.336 576 480S590.336 512 608 512L704 512l0 108.032c0 5.376 1.92 10.112 5.952 14.08C713.92 638.08 718.656 640 723.968 640s10.048-1.92 14.08-5.952l152-140.032C894.016 490.112 896 485.376 896 480S894.016 469.952 890.048 465.92zM448 128l0 128 64 0L512 128c0-35.392-28.608-64-64-64l0 0L128 64C92.608 64 64 92.608 64 128l0 704c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64l0-128L448 704l0 128L128 832 128 128 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128"/></svg>'}],Tn={bg:"#f4f4f4",gridBg:"#ffffff",headerBg:"#e8e8e8",headerBorder:"#c8c8c8",headerText:"#444",headerSep:"#b0b0b0",cornerBg:"#e0e0e0",gridLine:"#e0e0e0",selectionBg:"rgba(0, 120, 215, 0.12)",activeCellBorder:"#0078d7",cellText:"#1a1a1a",scrollTrack:"rgba(0,0,0,0.08)",scrollThumb:"rgba(0,0,0,0.25)",formulaBarBg:"#f0f0f0",formulaBarBorder:"#c8c8c8",formulaBarLabelText:"#333",formulaBarLabelBg:"#fff",formulaBarLabelBorder:"#c0c0c0",formulaBarInputBg:"#fff",formulaBarInputBorder:"#c0c0c0",formulaBarInputText:"#1a1a1a",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.3)",wrapperBg:"#e8e8e8",cellEditorBorder:"#0078d7",cellEditorText:"#1a1a1a",cellEditorBg:"#fff",cellEditorShadow:"#0078d7",tabBarBg:"#e8e8e8",tabBarBorder:"#c0c0c0",tabActiveBg:"#ffffff",tabActiveText:"#1a1a1a",tabActiveBorder:"#0078d7",tabInactiveBg:"#dfdfdf",tabInactiveText:"#666",tabInactiveBorder:"transparent",tabHoverBg:"#e0e0e0",tabAddBtnColor:"#555",tabAddBtnHoverBg:"#d0d0d0",tabScrollBtnColor:"#888",tabScrollBtnHoverBg:"#d0d0d0",scrollbarThumb:"rgba(0,0,0,0.25)",scrollbarThumbHover:"rgba(0,0,0,0.4)",scrollBtnBg:"#e8e8e8",scrollBtnColor:"#666",scrollBtnHoverBg:"#d0d0d0",scrollBtnActiveBg:"#c0c0c0",scrollTrackBg:"rgba(0,0,0,0.06)",toolbarBg:"#f7f7f7",toolbarBorder:"#d8d8d8",toolbarBtnColor:"#444",toolbarBtnHoverBg:"#e6e6e6",toolbarBtnDisabledColor:"#b0b0b0",toolbarBtnActiveColor:"#0078d7",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},Nn={bg:"#1e1e1e",gridBg:"#252526",headerBg:"#252525",headerBorder:"#3e3e3e",headerText:"#999",headerSep:"#3e3e3e",cornerBg:"#2a2a2a",gridLine:"#3e3e3e",selectionBg:"rgba(0, 120, 215, 0.25)",activeCellBorder:"#0078d7",cellText:"#d4d4d4",scrollTrack:"rgba(255,255,255,0.06)",scrollThumb:"rgba(255,255,255,0.2)",formulaBarBg:"#2d2d2d",formulaBarBorder:"#3e3e3e",formulaBarLabelText:"#ccc",formulaBarLabelBg:"#3c3c3c",formulaBarLabelBorder:"#555",formulaBarInputBg:"#3c3c3c",formulaBarInputBorder:"#555",formulaBarInputText:"#d4d4d4",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.4)",wrapperBg:"#1e1e1e",cellEditorBorder:"#0078d7",cellEditorText:"#d4d4d4",cellEditorBg:"#3c3c3c",cellEditorShadow:"#0078d7",tabBarBg:"#2a2a2a",tabBarBorder:"#3e3e3e",tabActiveBg:"#1e1e1e",tabActiveText:"#e0e0e0",tabActiveBorder:"#0078d7",tabInactiveBg:"#333333",tabInactiveText:"#888",tabInactiveBorder:"transparent",tabHoverBg:"#3a3a3a",tabAddBtnColor:"#999",tabAddBtnHoverBg:"#3a3a3a",tabScrollBtnColor:"#777",tabScrollBtnHoverBg:"#3a3a3a",scrollbarThumb:"rgba(255,255,255,0.2)",scrollbarThumbHover:"rgba(255,255,255,0.35)",scrollBtnBg:"#2d2d2d",scrollBtnColor:"#999",scrollBtnHoverBg:"#3d3d3d",scrollBtnActiveBg:"#4d4d4d",scrollTrackBg:"rgba(255,255,255,0.05)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"},At="__nf_custom__",kt="",Vt="",bt="@",kl="__NF_INVALID__",El=2958465,Sl=0;function vt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Rl(e){return e==="zh-CN"?"¥":"$"}function In(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Ul(e){return e.replace(/"([^"]*)"/g,"$1")}function An(e){let n=e,o;const l=n.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),n=n.slice(l[0].length)),n=In(n);const a=/E[+-]/i.test(n),i=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:n,suffix:"",color:o};let h=-1;for(let ne=n.length-1;ne>=0;ne--){const se=n[ne];if(se==="0"||se==="#"||se==="?"||se==="E"){h=ne;break}}h<0&&(h=r);const c=r>0?n.slice(0,r):"",y=h<n.length-1?n.slice(h+1):"",S=n.slice(r,h+1),x=/[0#?]/.test(S),C=S.includes(",");let R=S.replace(/,/g,"");if(a){const ne=R.search(/E/i);ne>=0&&(R=R.slice(0,ne))}const Z=R.indexOf("."),Q=Z>=0?R.slice(0,Z):R,g=Z>=0?R.slice(Z+1):"",F=(g.match(/[0#?]/g)||[]).length,X=(g.match(/0/g)||[]).length,me=(Q.match(/0/g)||[]).length;return{hasDigits:x,decimals:F,minDecimals:X,minIntDigits:me,thousands:C,scale:i?100:1,scientific:a,prefix:c,suffix:y,color:o}}function Vn(e){const n=[];let o=!1;const l=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let a;for(;(a=l.exec(e))!==null;){const i=a[0];switch(i){case"[h]":o=!0,n.push({type:"hour",len:0});break;case"[mm]":o=!0,n.push({type:"minute",len:2});break;case"[ss]":o=!0,n.push({type:"second",len:2});break;case"yyyy":n.push({type:"year",len:4});break;case"yy":case"y":n.push({type:"year",len:2});break;case"mmmm":n.push({type:"monthName",len:4});break;case"mmm":n.push({type:"monthName",len:3});break;case"mm":n.push({type:"month",len:2});break;case"m":n.push({type:"month",len:1});break;case"dddd":n.push({type:"weekday",len:4});break;case"ddd":n.push({type:"weekday",len:3});break;case"dd":n.push({type:"day",len:2});break;case"d":n.push({type:"day",len:1});break;case"hh":n.push({type:"hour",len:2});break;case"h":n.push({type:"hour",len:1});break;case"ss":n.push({type:"second",len:2});break;case"s":n.push({type:"second",len:1});break;case"AM/PM":case"am/pm":n.push({type:"ampm",len:2});break;default:i.startsWith('"')?n.push({type:"literal",text:Ul(i),len:0}):n.push({type:"literal",text:i,len:0})}}return{tokens:n,isDuration:o}}const Pl=new Map;function Fn(e){const n=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(n)||/AM\/PM/i.test(n)||/\[h\]/i.test(n)){const i=e.split(";")[0]??e,{tokens:r,isDuration:h}=Vn(i);return{kind:h?"duration":"date",sections:[],tokens:r,isDuration:h,raw:e}}return{kind:"number",sections:e.split(";").map(i=>An(i)),tokens:[],isDuration:!1,raw:e}}function $t(e){const n=Pl.get(e);if(n)return n;const o=Fn(e);return Pl.set(e,o),o}function Gl(e,n,o,l,a){const i=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*i)/i,h=r<0,c=Math.abs(r);let S=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:n,maximumFractionDigits:n}).format(c);if(o<n&&n>0){const C=S.indexOf(".");if(C>=0){const b=S.substring(0,C);let R=S.substring(C+1);R=R.replace(/0+$/,""),R.length<o&&(R=R+"0".repeat(o-R.length)),S=R?`${b}.${R}`:b}}return`${h?"-":""}${S}`}function Yl(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,o),a=Gl(l,n,n,!1,1),i=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${a}E${i}`}function Hn(e,n,o){if(!o.hasDigits)return Ul(o.prefix+o.suffix);const l=o.scale===100?e*100:e,a=o.scientific?Yl(l,o.decimals):Gl(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return n+o.prefix+a+o.suffix}function On(e,n){const o=n.sections;if(o.length===0)return String(e);let l,a,i="";return e>0?(l=o[0],a=e):e<0?o[1]?(l=o[1],a=-e):(l=o[0],a=-e,i="-"):(l=o[2]??o[0],a=0),Hn(a,i,l)}function Ln(e){return new Date((e-25569)*864e5)}const $n=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],zn=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Xl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Wn=["January","February","March","April","May","June","July","August","September","October","November","December"],_n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],jl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function qt(e,n){return String(e).padStart(n,"0")}function Kn(e,n,o,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),h=e.getUTCDay(),c=o==="zh-CN";let y="",S=!1;for(const x of n)switch(x.type){case"literal":y+=x.text??"";break;case"year":y+=x.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":y+=qt(S?e.getUTCMinutes():i,x.len);break;case"monthName":y+=x.len>=4?c?$n[i-1]:Wn[i-1]:c?zn[i-1]:_n[i-1];break;case"day":y+=qt(r,x.len);break;case"weekday":y+=x.len>=4?c?Xl[h]:jl[h]:c?Xl[h].slice(2):jl[h].slice(0,3);break;case"hour":{let C=e.getUTCHours();if(x.len===0){const b=Math.floor(l*86400);C=Math.floor(b/3600)}y+=String(C),S=!0;break}case"minute":y+=qt(e.getUTCMinutes(),x.len);break;case"second":y+=qt(e.getUTCSeconds(),x.len);break;case"ampm":{const C=e.getUTCHours();y+=C<12?c?"上午":"AM":c?"下午":"PM";break}}return y}function Un(e,n){const o=Math.floor(e*86400),l=Math.floor(o/3600),a=Math.floor(o%3600/60),i=o%60;let r="";for(const h of n)switch(h.type){case"literal":r+=h.text??"";break;case"hour":r+=String(l);break;case"minute":r+=qt(a,h.len||2);break;case"second":r+=qt(i,h.len||2);break;default:r+=""}return r}function Pn(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const o=Math.abs(n);return o!==0&&(o>=1e15||o<1e-9)?Yl(n,9):e}return e}function Bl(e,n,o){if(vt(n))return Pn(e);if(n==null||n===bt)return e;const l=$t(n);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<Sl||i>El)return kl}else if(i<0)return kl;return l.kind==="duration"?Un(i,l.tokens):Kn(Ln(i),l.tokens,o,i)}const a=Number(e);return isNaN(a)?e:On(a,l)}const Gn=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function Zl(e,n){if(n===bt||n==="@")return!1;if(vt(n)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=$t(n);return!!(o.kind==="number"&&ql(o))}function ql(e){return e.sections.some(n=>n.hasDigits)}function Yn(e){if(e==null||vt(e)||e===bt||e==="@")return!1;const n=$t(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&ql(n))}function Xn(e,n){if(n==null||vt(n)||n===bt||n==="@")return!1;const o=$t(n),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<Sl||l>El:o.kind==="duration"?l<0:!1:!1}const xl=30,Ml=0;function Dl(e){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}function Jl(e,n){if(e==null||e===kt||vt(e))return Dl(n);if(e===bt)return!1;const o=$t(e);return o.kind==="date"||o.kind==="duration"?!1:o.sections.some(l=>l.hasDigits)}function jn(e,n){if(!Jl(e,n))return-1;if(e==null||e===kt||vt(e))return 0;const l=$t(e).sections.find(a=>a.hasDigits);return l?l.decimals:-1}function Zn(e,n){let o=0;const l=/\[[^\]]*\]/g;let a;for(;(a=l.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)o=a.index+a[0].length;const i=e.slice(0,o),r=e.slice(o),h=r.search(/[0#?]/);if(h===-1)return e;let c=-1;for(let Q=r.length-1;Q>=0;Q--){const g=r[Q];if(g==="0"||g==="#"||g==="?"||g==="E"){c=Q;break}}if(c<h)return e;const y=r.slice(h,c+1),S=y.search(/E[+-]/i),x=S>=0?y.slice(0,S):y,C=x.indexOf("."),b=C>=0?(x.slice(C+1).match(/[0#?]/g)||[]).length:0;if(b===n)return e;let R;if(C<0)R=n>0?x+"."+"0".repeat(n):x;else if(n>b)R=x+"0".repeat(n-b);else{let Q=b-n;const g=x.split("");for(let F=g.length-1;F>=0&&Q>0;F--){const X=g[F];(X==="0"||X==="#"||X==="?")&&(g.splice(F,1),Q--)}R=g.join(""),n===0&&R.endsWith(".")&&(R=R.slice(0,-1))}const Z=R+(S>=0?y.slice(S):"");return i+r.slice(0,h)+Z+r.slice(c+1)}function qn(e,n){if(!Number.isInteger(n)||n<Ml||n>xl||e===kt)return null;if(e==null||vt(e))return n>0?"0."+"0".repeat(n):"0";if(e===bt)return null;const o=$t(e);return o.kind==="date"||o.kind==="duration"||!o.sections.some(l=>l.hasDigits)?null:e.split(";").map(l=>Zn(l,n)).join(";")}const Jn=["¥","$","€","£"];function Ql(e,n){if(e==null||e===kt)return e??Vt;if(vt(e))return Vt;if(e===bt||e==="@")return bt;const o=Rl(n),l=n==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=n==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",i=`${o}#,##0.00;(${o}#,##0.00);${o}"-"`,r="#,##0.00;[Red](#,##0.00)";if(en(n).some(b=>b.value===e))return e;const c=e.replace(/\[[^\]]*\]/gi,b=>/^\[(h|mm|ss)\]$/i.test(b)?b:"");if(/\[(h|mm|ss)\]/i.test(c)&&!/[yd]/i.test(c))return"[h]:mm:ss";const y=/[yd]/i.test(c),S=/h|s|AM\/PM/i.test(c);if(y&&S)return a;if(y||/AM\/PM/i.test(c))return l;if(S)return"h:mm:ss";if(e.includes("%"))return"0.00%";if(/E[+-]/i.test(e))return"0.00E+00";if(e.includes("[Red]("))return r;const x=Jn.find(b=>e.startsWith(b));if(x)return e.includes("(")?i:/\.\d/.test(e.slice(x.length))?o+"#,##0.00":o+"#,##0";const C=$t(e);return C.kind==="number"&&C.sections.some(b=>b.hasDigits)?"#,##0.00":At}function Qn(e,n){return new Date(Date.UTC(e,n,0)).getUTCDate()}function eo(e,n,o){const l=Date.UTC(e,n-1,o)/864e5+25569;return l<=60?l-1:l}function to(e,n,o=new Date){const l=e.trim();if(!l||l.startsWith("=")||Dl(l))return null;const a=n==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=n==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function h(C){const b=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(C);if(!b)return null;const R=Number(b[1]),Z=Number(b[2]),Q=b[3]!==void 0?Number(b[3]):0;return R>23||Z>59||Q>59?null:(R*3600+Z*60+Q)/86400}function c(C){let b=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(C),R,Z,Q;if(b)R=Number(b[1]),Z=Number(b[2]),Q=Number(b[3]);else if(b=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(C))R=Number(b[1]),Z=Number(b[2]),Q=Number(b[3]);else if(b=/^(\d{1,2})[-/](\d{1,2})$/.exec(C))R=o.getUTCFullYear(),Z=Number(b[1]),Q=Number(b[2]);else return null;if(R<1900||R>9999||Z<1||Z>12||Q<1||Q>Qn(R,Z))return null;const g=eo(R,Z,Q);return g>=Sl&&g<=El?g:null}const y=h(l);if(y!==null)return{serial:y,format:r};const S=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(l);if(S){const C=c(S[1].trim()),b=h(S[2]);if(C!==null&&b!==null)return{serial:C+b,format:i}}const x=c(l);return x!==null?{serial:x,format:a}:null}function lo(e,n,o,l){const a=Rl(e),i=l?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",h=i+r;switch(n){case"general":return"";case"text":return bt;case"custom":return"";case"number":return h;case"percent":return h+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return a+h;case"currencyRounded":return a+(l?"#,##0":"0");case"accounting":return`${a}${h};(${a}${h});${a}"-"`;case"financial":return`${h};[Red](${h})`;case"date":return e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy";case"time":return"h:mm:ss";case"dateTime":return e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss";case"duration":return"[h]:mm:ss";default:return""}}function en(e){const n=Rl(e);return[{label:T(e,"nfGeneral"),value:Vt},{label:T(e,"nfText"),value:bt},{label:T(e,"nfNumber"),value:"#,##0.00"},{label:T(e,"nfPercent"),value:"0.00%"},{label:T(e,"nfScientific"),value:"0.00E+00"},{label:T(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:T(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:T(e,"nfCurrency"),value:n+"#,##0.00"},{label:T(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:T(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:T(e,"nfTime"),value:"h:mm:ss"},{label:T(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:T(e,"nfDuration"),value:"[h]:mm:ss"},{label:T(e,"nfCustom"),value:At}]}const no=["title"],oo=["innerHTML"],ro={key:1,class:"sp-dropdown__value"},ao=["disabled"],io=["onClick"],co=["innerHTML"],so={class:"sp-dropdown__item-label"},uo=["disabled"],fo=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(!1),i=t.ref(0),r=t.ref(null),h=t.ref(null),c=t.ref(null),y=t.ref({top:0,up:!1}),S=t.ref(0),x=t.ref(!1),C=t.computed(()=>o.options.find(q=>String(q.value)===String(o.modelValue))),b=t.computed(()=>o.menuWidth),R=t.computed(()=>Math.min(o.visibleCount,o.options.length)),Z=t.computed(()=>o.options.slice(i.value,i.value+R.value)),Q=t.computed(()=>i.value>0),g=t.computed(()=>i.value+R.value<o.options.length),F=t.computed(()=>o.options.length>R.value);function X(q){i.value=Math.max(0,Math.min(o.options.length-R.value,i.value+q))}function me(){a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0);const q=o.triggerEl??r.value;if(!q)return;const be=q.getBoundingClientRect(),oe=R.value*22+(F.value?2*15:0)+8,m=window.innerHeight-be.bottom-4<oe&&be.top-4>oe;o.align==="right"?y.value={right:window.innerWidth-be.right,top:m?be.top-oe-4:be.bottom+4,up:m}:y.value={left:be.left,top:m?be.top-oe-4:be.bottom+4,up:m};const p=o.options.findIndex(N=>String(N.value)===String(o.modelValue));i.value=p>=0?Math.max(0,Math.min(p-Math.floor(R.value/2),o.options.length-R.value)):0}function ne(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function se(){a.value?ne():me()}function ue(q){l("update:modelValue",q.value),l("change",q.value),ne()}function pe(q){var oe,s;if(!a.value)return;const be=q.target;(oe=r.value)!=null&&oe.contains(be)||(s=c.value)!=null&&s.contains(be)||ne()}function Ne(q){a.value&&(q.preventDefault(),X(q.deltaY>0?1:-1))}t.watch(a,q=>{t.nextTick(()=>{var be,oe;q?((be=h.value)==null||be.addEventListener("wheel",Ne,{passive:!1}),document.addEventListener("keydown",Ae)):((oe=h.value)==null||oe.removeEventListener("wheel",Ne),document.removeEventListener("keydown",Ae))})});function Ae(q){a.value&&q.key==="Escape"&&ne()}t.watch(()=>o.modelOpen,q=>{q!==void 0&&q!==a.value&&(q?me():ne())});function Pe(q){a.value&&(S.value=q.touches[0].clientY,x.value=!0)}function He(q){if(!a.value||!x.value)return;const be=q.touches[0].clientY-S.value;Math.abs(be)>5&&(X(be<0?1:-1),S.value=q.touches[0].clientY)}function we(){x.value=!1}function re(q){q.key==="Escape"&&ne()}return t.onMounted(()=>{document.addEventListener("pointerdown",pe),window.addEventListener("resize",ne),window.addEventListener("scroll",ne,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",pe),document.removeEventListener("keydown",Ae),window.removeEventListener("resize",ne),window.removeEventListener("scroll",ne,!0)}),(q,be)=>{var oe,s;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"sp-dropdown",style:t.normalizeStyle(typeof e.width=="number"?{width:e.width+"px"}:{width:e.width})},[e.hideTrigger?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__trigger",{"sp-dropdown__trigger--open":a.value}]),title:e.title,onClick:se},[(oe=C.value)!=null&&oe.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:C.value.icon},null,8,oo)):(t.openBlock(),t.createElementBlock("span",ro,t.toDisplayString(((s=C.value)==null?void 0:s.label)??e.fallbackLabel),1)),be[3]||(be[3]=t.createElementVNode("svg",{class:"sp-dropdown__caret",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1))],10,no)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:c,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":y.value.up}]),style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px",minWidth:b.value!==void 0?typeof b.value=="number"?b.value+"px":b.value:void 0}),onKeydown:re,onMousedown:be[2]||(be[2]=t.withModifiers(()=>{},["prevent"]))},[F.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Q.value}]),disabled:!Q.value,onClick:be[0]||(be[0]=m=>X(-1))},[...be[4]||(be[4]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,ao)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:h,class:"sp-dropdown__list",onTouchstart:Pe,onTouchmove:He,onTouchend:we},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.value,m=>(t.openBlock(),t.createElementBlock("button",{key:String(m.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(m.value)===String(e.modelValue)}]),onClick:p=>ue(m)},[m.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:m.icon},null,8,co)):t.createCommentVNode("",!0),t.createElementVNode("span",so,t.toDisplayString(m.label),1)],10,io))),128))],544),F.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!g.value}]),disabled:!g.value,onClick:be[1]||(be[1]=m=>X(1))},[...be[5]||(be[5]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,uo)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Et=(e,n)=>{const o=e.__vccOpts||e;for(const[l,a]of n)o[l]=a;return o},il=Et(fo,[["__scopeId","data-v-0152ad1e"]]),mo=["title","onClick"],tn=Et(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],r=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],h=t.computed(()=>l.colorKey==="fill"?r:i);function c(F){return T(l.locale,F)}function y(F){const X=l.currentColor;return!X&&!F?!0:X?X.toLowerCase()===F.toLowerCase():!1}const S=t.ref(!1),x=t.ref(null),C=t.ref(null),b=t.ref({top:0});t.watch(()=>l.modelOpen,F=>{F!==void 0&&F!==S.value&&(F?Z():Q())});function R(F){const X=x.value,me=C.value,ne=F.target;X&&X.contains(ne)||me&&me.contains(ne)||Q()}function Z(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const F=l.triggerEl??x.value;if(F){const X=F.getBoundingClientRect(),me=150,ne=120;let se=window.innerWidth-X.right,ue=X.bottom+4,pe;X.left-ne<4&&(se=void 0,pe=Math.max(4,X.left)),ue+me>window.innerHeight-4&&(ue=X.top-me-4),ue<4&&(ue=4),b.value=se!==void 0?{right:se,top:ue}:{left:pe,top:ue}}document.addEventListener("pointerdown",R)})}function Q(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function g(F){a("update:modelValue",F),a("change",F),Q()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),n({open:S,openMenu:Z,close:Q}),(F,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:x,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:C,class:"color-picker__menu",style:t.normalizeStyle({left:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,(me,ne)=>(t.openBlock(),t.createElementBlock("div",{key:ne,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me,se=>(t.openBlock(),t.createElementBlock("button",{key:se.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":y(se.value)}]),title:c(se.key),style:t.normalizeStyle({background:se.value||"transparent",border:se.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:ue=>g(se.value)},null,14,mo))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),po=["title","onClick"],ho={viewBox:"0 0 30 30",class:"border-picker__icon"},go=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],yo={class:"border-picker__label"},bo=Et(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],r=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],h={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},c={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function y(F,X){return c[F].includes(X)?"thick":h[F].includes(X)?"solid":"dashed"}const S=t.ref(!1),x=t.ref(null),C=t.ref(null),b=t.ref({top:0});t.watch(()=>l.modelOpen,F=>{F!==void 0&&F!==S.value&&(F?Z():Q())});function R(F){const X=x.value,me=C.value,ne=F.target;X&&X.contains(ne)||me&&me.contains(ne)||Q()}function Z(){S.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const F=l.triggerEl??x.value;if(F){const X=F.getBoundingClientRect(),me=200,ne=160;let se=window.innerWidth-X.right,ue=X.bottom+4,pe;X.left-ne<4&&(se=void 0,pe=Math.max(4,X.left)),ue+me>window.innerHeight-4&&(ue=X.top-me-4),ue<4&&(ue=4),b.value=se!==void 0?{right:se,top:ue}:{left:pe,top:ue}}document.addEventListener("pointerdown",R)})}function Q(){S.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function g(F){a("change",F),Q()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),n({open:S,openMenu:Z,close:Q}),(F,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:x,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[S.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:C,class:"border-picker__menu",style:t.normalizeStyle({left:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px"}),onMousedown:X[0]||(X[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,me=>t.createElementVNode("button",{key:me.key,class:"border-picker__item",title:t.unref(T)(e.locale,me.i18nKey),onClick:ne=>g(me.key)},[(t.openBlock(),t.createElementBlock("svg",ho,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,ne=>t.createElementVNode("line",{key:ne.name,x1:ne.x1,y1:ne.y1,x2:ne.x2,y2:ne.y2,stroke:"currentColor","stroke-width":y(me.key,ne.name)==="thick"?3:1.5,"stroke-dasharray":y(me.key,ne.name)==="dashed"?"0 4":"none","stroke-linecap":y(me.key,ne.name)==="dashed"?"round":"square"},null,8,go)),64))])),t.createElementVNode("span",yo,t.toDisplayString(t.unref(T)(e.locale,me.i18nKey)),1)],8,po)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),vo=["title","onClick"],Co=["innerHTML"],wo={class:"merge-picker__label"},ko=Et(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=t.ref(!1),r=t.ref(null),h=t.ref(null),c=t.ref({top:0});t.watch(()=>l.modelOpen,b=>{b!==void 0&&b!==i.value&&(b?S():x())});function y(b){const R=r.value,Z=h.value,Q=b.target;R&&R.contains(Q)||Z&&Z.contains(Q)||x()}function S(){i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const b=l.triggerEl??r.value;if(b){const R=b.getBoundingClientRect(),Z=Kl.length*30+12,Q=160;let g=window.innerWidth-R.right,F=R.bottom+4,X;R.left-Q<4&&(g=void 0,X=Math.max(4,R.left)),F+Z>window.innerHeight-4&&(F=R.top-Z-4),F<4&&(F=4),c.value=g!==void 0?{right:g,top:F}:{left:X,top:F}}document.addEventListener("pointerdown",y)})}function x(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",y)}function C(b){a("change",b),x()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y)}),n({open:i,openMenu:S,close:x}),(b,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:h,class:"merge-picker__menu",style:t.normalizeStyle({left:c.value.left!==void 0?c.value.left+"px":void 0,right:c.value.right!==void 0?c.value.right+"px":void 0,top:c.value.top+"px"}),onMousedown:R[0]||(R[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Kl),Z=>(t.openBlock(),t.createElementBlock("button",{key:Z.key,class:"merge-picker__item",title:t.unref(T)(e.locale,Z.labelKey),onClick:Q=>C(Z.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:Z.icon},null,8,Co),t.createElementVNode("span",wo,t.toDisplayString(t.unref(T)(e.locale,Z.labelKey)),1)],8,vo))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Eo=["disabled","title","onClick"],So={class:"calc-picker__label"},Ro=Et(t.defineComponent({__name:"calcPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,a=o,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),h=t.ref(null),c=t.ref(null),y=t.ref({top:0});t.watch(()=>l.modelOpen,R=>{R!==void 0&&R!==r.value&&(R?x():C())});function S(R){const Z=h.value,Q=c.value,g=R.target;Z&&Z.contains(g)||Q&&Q.contains(g)||C()}function x(){r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const R=l.triggerEl??h.value;if(R){const Z=R.getBoundingClientRect(),Q=i.length*30+12,g=160;let F=window.innerWidth-Z.right,X=Z.bottom+4,me;Z.left-g<4&&(F=void 0,me=Math.max(4,Z.left)),X+Q>window.innerHeight-4&&(X=Z.top-Q-4),X<4&&(X=4),y.value=F!==void 0?{right:F,top:X}:{left:me,top:X}}document.addEventListener("pointerdown",S)})}function C(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function b(R){l.disabled||(a("change",R),C())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),n({open:r,openMenu:x,close:C}),(R,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:h,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:c,class:"calc-picker__menu",style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown:Z[0]||(Z[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Q=>t.createElementVNode("button",{key:Q.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(T)(e.locale,Q.labelKey),onClick:g=>b(Q.key)},[t.createElementVNode("span",So,t.toDisplayString(t.unref(T)(e.locale,Q.labelKey)),1)],10,Eo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),Bo={class:"tb-item","data-key":"undo"},xo=["title","disabled"],Mo={class:"tb-item","data-key":"redo"},Do=["title","disabled"],To={class:"tb-item","data-key":"paint"},No=["title","disabled"],Io={class:"tb-item","data-key":"clear"},Ao=["title","disabled"],Vo={class:"tb-item","data-key":"font"},Fo={class:"tb-item","data-key":"fontSize"},Ho={class:"toolbar-font-size"},Oo=["value","title"],Lo=["title"],$o=["title","disabled"],zo=["title","disabled"],Wo={class:"tb-item","data-key":"bold"},_o=["title","disabled"],Ko={class:"tb-item","data-key":"italic"},Uo=["title","disabled"],Po={class:"tb-item","data-key":"underline"},Go=["title","disabled"],Yo={class:"tb-item","data-key":"strike"},Xo=["title","disabled"],jo={class:"tb-item","data-key":"textColor"},Zo={class:"toolbar-split"},qo=["title","disabled"],Jo={viewBox:"0 0 1024 1024",fill:"currentColor"},Qo=["fill"],er=["title","disabled"],tr={class:"tb-item","data-key":"fillColor"},lr={class:"toolbar-split"},nr=["title","disabled"],or={viewBox:"0 0 1024 1024",fill:"currentColor"},rr=["fill"],ar=["title","disabled"],ir={class:"tb-item","data-key":"border"},cr={class:"toolbar-split"},sr=["title","disabled"],dr={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},ur=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],fr=["title","disabled"],mr={class:"tb-item","data-key":"hAlign"},pr={class:"tb-item","data-key":"vAlign"},hr={class:"tb-item","data-key":"wrap"},gr=["title"],yr={class:"tb-item","data-key":"merge"},br={class:"toolbar-split"},vr=["title","disabled"],Cr=["title","disabled"],wr={class:"tb-item","data-key":"numFmt"},kr=["title","disabled"],Er=["title","disabled"],Sr={class:"tb-item","data-key":"calc"},Rr={class:"toolbar-split"},Br=["title","disabled"],xr=["title","disabled"],Mr={class:"tb-item","data-key":"find"},Dr=["title"],Tl=2,Tr=6,Nr=34,Ir=Et(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{},canIncreaseDecimals:{type:Boolean},canDecreaseDecimals:{type:Boolean}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","increase-decimals","decrease-decimals","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","merge-change"],setup(e,{emit:n}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],l={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},a={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function i(K,u){return a[K].includes(u)?"thick":l[K].includes(u)?"solid":"dashed"}const r=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","find"],h=t.ref(null),c=t.ref(null),y=t.ref(null),S=t.ref(null),x=t.ref(null),C=t.ref(null),b=t.ref(null),R=t.ref(null),Z=t.ref(null),Q=t.ref(new Set),g=t.ref(!1),F=t.ref(!1),X=t.ref(0),me=new Map,ne=t.computed(()=>Q.value.size>0);function se(K){return Q.value.has(K)}const ue=t.computed(()=>{const K=c.value;return K instanceof HTMLElement?K:void 0});function pe(K){return ue.value?!se(K):!0}function Ne(){for(const K of r){const u=me.get(K);if(u===void 0||u===0)return!0}return!1}function Ae(){if(!h.value)return;h.value.querySelectorAll(".tb-item").forEach(u=>{const M=u.dataset.key;if(!M)return;const le=u.offsetWidth;le>0?me.set(M,le):me.has(M)||me.set(M,0)})}function Pe(K,u){if(K.size!==u.size)return!1;for(const M of K)if(!u.has(M))return!1;return!0}let He=0,we=0;function re(){He&&cancelAnimationFrame(He),!(we>60)&&(we++,He=requestAnimationFrame(()=>requestAnimationFrame(q)))}function q(){if(!h.value)return;const K=h.value.clientWidth-Tr*2;if(K<=0){re();return}we=0,(me.size===0||Ne())&&Ae();let u=0;for(const le of r)u+=(me.get(le)??0)+Tl;const M=new Set;if(u>K){const le=K-Nr-Tl;let ie=0;for(let P=0;P<r.length;P++){const xe=r[P],$e=(me.get(xe)??0)+Tl;if(ie+$e>le){for(let Ze=P;Ze<r.length;Ze++)M.add(r[Ze]);break}ie+=$e}}Pe(M,Q.value)||(Q.value=M,X.value++,M.size===0&&(g.value=!1))}let be=null;const oe=t.ref(0),s=t.computed(()=>{const K=y.value,u={position:"fixed",top:"0px",right:"0px"};if(!K)return{...W.themeVars,...u};oe.value;const M=K.getBoundingClientRect();return{...W.themeVars,position:"fixed",top:`${M.bottom+4}px`,right:`${window.innerWidth-M.right}px`}});function m(){g.value&&(oe.value++,t.nextTick(()=>q()))}function p(K){var M,le;if(!g.value)return;const u=K.target;(M=c.value)!=null&&M.contains(u)||(le=y.value)!=null&&le.contains(u)||(F.value=!0,g.value=!1,t.nextTick(()=>{F.value=!1}))}function N(){g.value=!g.value}function A(){g.value=!1,k("find")}t.onMounted(()=>{re(),h.value&&(be=new ResizeObserver(()=>{g.value||re()}),be.observe(h.value)),document.addEventListener("pointerdown",p,!0),window.addEventListener("resize",m),window.addEventListener("load",re),window.addEventListener("orientationchange",re)}),t.onBeforeUnmount(()=>{He&&cancelAnimationFrame(He),be==null||be.disconnect(),document.removeEventListener("pointerdown",p,!0),window.removeEventListener("resize",m),window.removeEventListener("load",re),window.removeEventListener("orientationchange",re)});const W=e,k=n,he=t.computed(()=>W.selNumberFormat===kt?T(W.locale,"nfMixed"):"");return(K,u)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:h,class:"toolbar",onMousedown:u[47]||(u[47]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("undo"),to:ue.value},[t.createElementVNode("div",Bo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(T)(e.locale,"undo"),disabled:!e.canUndo,onClick:u[0]||(u[0]=M=>k("undo"))},[...u[49]||(u[49]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("redo"),to:ue.value},[t.createElementVNode("div",Mo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(T)(e.locale,"redo"),disabled:!e.canRedo,onClick:u[1]||(u[1]=M=>k("redo"))},[...u[50]||(u[50]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{transform:"translate(1024, 0) scale(-1, 1)",d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,Do)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("paint"),to:ue.value},[t.createElementVNode("div",To,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(T)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:u[2]||(u[2]=M=>k("paint-format"))},[...u[51]||(u[51]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z"})],-1)])],10,No)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("clear"),to:ue.value},[t.createElementVNode("div",Io,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(T)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:u[3]||(u[3]=M=>k("clear-format"))},[...u[52]||(u[52]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0"})],-1)])],10,Ao)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep1"),to:ue.value},[u[53]||(u[53]=t.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("font"),to:ue.value},[t.createElementVNode("div",Vo,[t.createVNode(il,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:se("font")?"100%":110,"menu-width":se("font")?120:void 0,"visible-count":8,title:t.unref(T)(e.locale,"fontFamily"),align:"right",onChange:u[4]||(u[4]=M=>k("font-family-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("fontSize"),to:ue.value},[t.createElementVNode("div",Fo,[t.createElementVNode("div",Ho,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(T)(e.locale,"fontSize"),onMousedown:u[5]||(u[5]=t.withModifiers(()=>{},["stop"])),onInput:u[6]||(u[6]=M=>k("font-size-input",M.target.value)),onBlur:u[7]||(u[7]=M=>k("font-size-blur")),onKeydown:u[8]||(u[8]=M=>k("font-size-keydown",M))},null,40,Oo),t.createVNode(il,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:se("fontSize")?"100%":56,"menu-width":se("fontSize")?120:56,"visible-count":9,title:t.unref(T)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":Z.value,"onUpdate:modelOpen":u[9]||(u[9]=M=>k("update:font-size-menu-open",M)),onChange:u[10]||(u[10]=M=>k("font-size-change",M))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:Z,class:"toolbar-font-size__btn",type:"button",title:t.unref(T)(e.locale,"fontSize"),onMousedown:u[11]||(u[11]=t.withModifiers(()=>{},["prevent"])),onClick:u[12]||(u[12]=M=>k("font-size-toggle"))},[...u[54]||(u[54]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,Lo),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:u[13]||(u[13]=t.withModifiers(()=>{},["prevent"])),onClick:u[14]||(u[14]=M=>k("font-size-step-down"))},[...u[55]||(u[55]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,$o),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(T)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:u[15]||(u[15]=t.withModifiers(()=>{},["prevent"])),onClick:u[16]||(u[16]=M=>k("font-size-step-up"))},[...u[56]||(u[56]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,zo)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep2"),to:ue.value},[u[57]||(u[57]=t.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("bold"),to:ue.value},[t.createElementVNode("div",Wo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(T)(e.locale,"bold"),disabled:!e.hasSelection,onClick:u[17]||(u[17]=M=>k("bold-toggle"))},[...u[58]||(u[58]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z"})])],-1)])],10,_o)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("italic"),to:ue.value},[t.createElementVNode("div",Ko,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(T)(e.locale,"italic"),disabled:!e.hasSelection,onClick:u[18]||(u[18]=M=>k("italic-toggle"))},[...u[59]||(u[59]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z"})])],-1)])],10,Uo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("underline"),to:ue.value},[t.createElementVNode("div",Po,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(T)(e.locale,"underline"),disabled:!e.hasSelection,onClick:u[19]||(u[19]=M=>k("underline-toggle"))},[...u[60]||(u[60]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z"})])],-1)])],10,Go)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("strike"),to:ue.value},[t.createElementVNode("div",Yo,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(T)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:u[20]||(u[20]=M=>k("strikethrough-toggle"))},[...u[61]||(u[61]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,Xo)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep3"),to:ue.value},[u[62]||(u[62]=t.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("textColor"),to:ue.value},[t.createElementVNode("div",jo,[t.createElementVNode("div",Zo,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:u[21]||(u[21]=M=>k("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Jo,[u[63]||(u[63]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:e.cachedTextColor||"#000000"},null,8,Qo)]))],8,qo),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:S,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:u[22]||(u[22]=M=>k("update:text-color-menu-open",!e.textColorMenuOpen))},[...u[64]||(u[64]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,er),t.createVNode(tn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":S.value,"onUpdate:modelOpen":u[23]||(u[23]=M=>k("update:text-color-menu-open",M)),onChange:u[24]||(u[24]=M=>k("text-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("fillColor"),to:ue.value},[t.createElementVNode("div",tr,[t.createElementVNode("div",lr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:u[25]||(u[25]=M=>k("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",or,[u[65]||(u[65]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:e.cachedFillColor||"currentColor"},null,8,rr)]))],8,nr),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:u[26]||(u[26]=M=>k("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...u[66]||(u[66]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ar),t.createVNode(tn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":x.value,"onUpdate:modelOpen":u[27]||(u[27]=M=>k("update:fill-color-menu-open",M)),onChange:u[28]||(u[28]=M=>k("fill-color-change",M))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("border"),to:ue.value},[t.createElementVNode("div",ir,[t.createElementVNode("div",cr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:u[29]||(u[29]=M=>k("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",dr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,M=>t.createElementVNode("line",{key:M.name,x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,"stroke-width":i(e.cachedBorder,M.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,M.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,M.name)==="dashed"?"round":"square"},null,8,ur)),64))]))],8,sr),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:C,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"borders"),disabled:!e.hasSelection,onClick:u[30]||(u[30]=M=>k("update:border-menu-open",!e.borderMenuOpen))},[...u[67]||(u[67]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,fr),t.createVNode(bo,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":C.value,"onUpdate:modelOpen":u[31]||(u[31]=M=>k("update:border-menu-open",M)),onChange:u[32]||(u[32]=M=>k("border-change",M))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep4"),to:ue.value},[u[68]||(u[68]=t.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("hAlign"),to:ue.value},[t.createElementVNode("div",mr,[t.createVNode(il,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:se("hAlign")?"100%":44,"menu-width":se("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"hAlign"),onChange:u[33]||(u[33]=M=>k("h-align-change",M))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("vAlign"),to:ue.value},[t.createElementVNode("div",pr,[t.createVNode(il,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:se("vAlign")?"100%":44,"menu-width":se("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(T)(e.locale,"vAlign"),onChange:u[34]||(u[34]=M=>k("v-align-change",M))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",hr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(T)(e.locale,"wrap"),onClick:u[35]||(u[35]=M=>k("wrap-toggle"))},[...u[69]||(u[69]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z"})],-1)])],10,gr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("merge"),to:ue.value},[t.createElementVNode("div",yr,[t.createElementVNode("div",br,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:u[36]||(u[36]=M=>k("apply-merge"))},[...u[70]||(u[70]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)])],8,vr),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:b,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:u[37]||(u[37]=M=>k("update:merge-menu-open",!e.mergeMenuOpen))},[...u[71]||(u[71]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Cr),t.createVNode(ko,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":b.value,"onUpdate:modelOpen":u[38]||(u[38]=M=>k("update:merge-menu-open",M)),onChange:u[39]||(u[39]=M=>k("merge-change",M))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep6"),to:ue.value},[u[72]||(u[72]=t.createElementVNode("div",{class:"tb-item","data-key":"sep6"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("numFmt"),to:ue.value},[t.createElementVNode("div",wr,[t.createVNode(il,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:se("numFmt")?"100%":92,"menu-width":(se("numFmt"),150),"visible-count":8,title:t.unref(T)(e.locale,"numberFormat"),"fallback-label":he.value,align:"right",onChange:u[40]||(u[40]=M=>k("number-format-change",String(M)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(T)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:u[41]||(u[41]=M=>k("increase-decimals"))},[...u[73]||(u[73]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 5.5l4.2 5.2h-2.7v7.8h-3v-7.8h-2.7z"})],-1)])],10,kr),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(T)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:u[42]||(u[42]=M=>k("decrease-decimals"))},[...u[74]||(u[74]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 18.5l-4.2-5.2h2.7V5.5h3v7.8h2.7z"})],-1)])],10,Er)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("sep7"),to:ue.value},[u[75]||(u[75]=t.createElementVNode("div",{class:"tb-item","data-key":"sep7"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("calc"),to:ue.value},[t.createElementVNode("div",Sr,[t.createElementVNode("div",Rr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(T)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:u[43]||(u[43]=M=>k("calc-sum"))},[...u[76]||(u[76]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)])],8,Br),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(T)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:u[44]||(u[44]=M=>k("update:calc-menu-open",!e.calcMenuOpen))},[...u[77]||(u[77]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,xr),t.createVNode(Ro,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":R.value,disabled:e.isSingleCell,"onUpdate:modelOpen":u[45]||(u[45]=M=>k("update:calc-menu-open",M)),onChange:u[46]||(u[46]=M=>k(`calc-${M}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:pe("find"),to:ue.value},[t.createElementVNode("div",Mr,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(T)(e.locale,"find"),onClick:A},[...u[78]||(u[78]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M448 128a320 320 0 0 1 251.2 516.8l171.2 171.2a32 32 0 0 1-45.2 45.2L654 689.9A320 320 0 1 1 448 128zm0 64a256 256 0 1 0 0 512 256 256 0 0 0 0-512z"})],-1)])],8,Dr)])],8,["disabled","to"])),ne.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:y,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":g.value}]),type:"button",onClick:N},[...u[79]||(u[79]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],544),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:c,key:X.value,class:t.normalizeClass(["overflow-menu",{"no-anim":F.value}]),style:t.normalizeStyle(s.value),onMousedown:u[48]||(u[48]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,g.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-94d2ccc1"]]),Ar=["title"],Vr={class:"tab-list"},Fr=["onClick","onDblclick","onContextmenu"],Hr=["value"],Or={key:1,class:"tab-item__name"},Lr=["title"],$r=["disabled"],zr=["title","onClick"],Wr={class:"tab-list-menu__name"},_r=["title","disabled","onClick"],Kr=["disabled"],Ur=8,Pr=Et(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","delete-sheet","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(null),i=t.ref(!1),r=t.ref(0),h=t.ref({left:0,bottom:0}),c=t.ref(null),y=t.computed(()=>Math.min(Ur,o.sheets.length)),S=t.computed(()=>o.sheets.slice(r.value,r.value+y.value)),x=t.computed(()=>r.value>0),C=t.computed(()=>r.value+y.value<o.sheets.length),b=t.computed(()=>o.sheets.length>y.value),R=t.computed(()=>o.sheets.length>1);t.watch(()=>o.sheets.length,()=>{if(!i.value)return;const we=Math.max(0,o.sheets.length-y.value);r.value>we&&(r.value=we)});function Z(we){r.value=Math.max(0,Math.min(o.sheets.length-y.value,r.value+we))}function Q(){if(i.value){i.value=!1;return}const we=a.value;if(!we)return;const re=we.getBoundingClientRect();h.value={left:re.left,bottom:window.innerHeight-re.top+4};const q=o.activeSheetIndex;r.value=q>=0?Math.max(0,Math.min(q-Math.floor(y.value/2),o.sheets.length-y.value)):0,i.value=!0}function g(we){l("tab-click",we),i.value=!1}function F(we){R.value&&l("delete-sheet",we)}function X(we){var be;if(!i.value)return;const re=we.target;if((be=a.value)!=null&&be.contains(re))return;const q=document.querySelector(".tab-list-menu");q!=null&&q.contains(re)||(i.value=!1)}function me(we){i.value&&we.key==="Escape"&&(i.value=!1)}function ne(we){i.value&&(we.preventDefault(),Z(we.deltaY>0?1:-1))}function se(){i.value=!1}function ue(we){!i.value||we.target===c.value||se()}const pe=t.ref(0),Ne=t.ref(!1);function Ae(we){i.value&&(pe.value=we.touches[0].clientY,Ne.value=!0)}function Pe(we){if(!i.value||!Ne.value)return;const re=we.touches[0].clientY-pe.value;Math.abs(re)>5&&(Z(re<0?1:-1),pe.value=we.touches[0].clientY)}function He(){Ne.value=!1}return t.watch(i,we=>{t.nextTick(()=>{var re,q;we?(re=c.value)==null||re.addEventListener("wheel",ne,{passive:!1}):(q=c.value)==null||q.removeEventListener("wheel",ne)})}),t.onMounted(()=>{document.addEventListener("pointerdown",X),document.addEventListener("keydown",me),window.addEventListener("resize",se),window.addEventListener("scroll",ue,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",X),document.removeEventListener("keydown",me),window.removeEventListener("resize",se),window.removeEventListener("scroll",ue,!0)}),(we,re)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:re[8]||(re[8]=q=>l("tabbar-contextmenu",q))},[t.createElementVNode("button",{ref_key:"listBtnRef",ref:a,class:t.normalizeClass(["tab-bar__list-btn",{"tab-bar__list-btn--active":i.value}]),type:"button",title:t.unref(T)(e.locale,"sheetList"),onClick:Q},[...re[9]||(re[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M128 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z"})],-1)])],10,Ar),t.createElementVNode("div",Vr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(q,be)=>(t.openBlock(),t.createElementBlock("div",{key:q.id,class:t.normalizeClass(["tab-item",{"tab-item--active":be===e.activeSheetIndex}]),onClick:oe=>l("tab-click",be),onDblclick:t.withModifiers(oe=>l("tab-dblclick",be),["prevent"]),onContextmenu:oe=>l("tab-contextmenu",{ev:oe,i:be})},[e.renTab===be?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:re[0]||(re[0]=oe=>l("tab-rename-input",oe.target.value)),onKeydown:re[1]||(re[1]=oe=>l("tab-rename-keydown",oe)),onBlur:re[2]||(re[2]=oe=>l("tab-rename-commit")),onClick:re[3]||(re[3]=t.withModifiers(()=>{},["stop"]))},null,40,Hr)):(t.openBlock(),t.createElementBlock("span",Or,t.toDisplayString(q.name),1))],42,Fr))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(T)(e.locale,"addSheet"),onClick:re[4]||(re[4]=q=>l("add-sheet"))}," + ",8,Lr),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"tab-list-menu",style:t.normalizeStyle({left:h.value.left+"px",bottom:h.value.bottom+"px"}),onMousedown:re[7]||(re[7]=t.withModifiers(()=>{},["prevent"]))},[b.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!x.value}]),disabled:!x.value,onClick:re[5]||(re[5]=q=>Z(-1))},[...re[10]||(re[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z"})],-1)])],10,$r)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"tab-list-menu__list",onTouchstart:Ae,onTouchmove:Pe,onTouchend:He},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,q=>(t.openBlock(),t.createElementBlock("div",{key:q.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(q)===e.activeSheetIndex}]),title:q.name,onClick:be=>g(e.sheets.indexOf(q))},[t.createElementVNode("span",Wr,t.toDisplayString(q.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(T)(e.locale,"delete"),disabled:!R.value,onClick:t.withModifiers(be=>F(e.sheets.indexOf(q)),["stop"])},[...re[11]||(re[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,_r)],10,zr))),128))],544),b.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!C.value}]),disabled:!C.value,onClick:re[6]||(re[6]=q=>Z(1))},[...re[12]||(re[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],10,Kr)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-ec10bade"]]),Gr=["placeholder","value"],Yr=["placeholder","value"],Xr=["value","title"],jr={value:"sheet"},Zr={value:"workbook"},qr={value:"selection"},Jr={class:"find-bar__chk"},Qr=["checked"],ea={class:"find-bar__chk"},ta=["checked"],la={class:"find-bar__count"},na=["title","disabled"],oa=["title","disabled"],ra=["disabled"],aa=["disabled"],ia=["title"],ca=Et(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},findText:{},replaceText:{},scope:{},matchCase:{type:Boolean},matchEntireCell:{type:Boolean},currentIndex:{},total:{},message:{},focusToken:{},locale:{},themeVars:{}},emits:["update:findText","update:replaceText","update:scope","update:matchCase","update:matchEntireCell","prev","next","replace","replace-all","close"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(null),i=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||"");t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var c;return(c=a.value)==null?void 0:c.focus()})});function r(c){c.key==="Enter"?(c.preventDefault(),c.shiftKey?l("prev"):l("next")):c.key==="Escape"&&(c.preventDefault(),l("close"))}function h(c){l("update:scope",c.target.value)}return(c,y)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(T)(e.locale,"findPlaceholder"),value:e.findText,onInput:y[0]||(y[0]=S=>l("update:findText",S.target.value)),onKeydown:r},null,40,Gr),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(T)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:y[1]||(y[1]=S=>l("update:replaceText",S.target.value)),onKeydown:r},null,40,Yr),t.createElementVNode("select",{class:"find-bar__select",value:e.scope,title:t.unref(T)(e.locale,"findScope"),onChange:h},[t.createElementVNode("option",jr,t.toDisplayString(t.unref(T)(e.locale,"scopeSheet")),1),t.createElementVNode("option",Zr,t.toDisplayString(t.unref(T)(e.locale,"scopeWorkbook")),1),t.createElementVNode("option",qr,t.toDisplayString(t.unref(T)(e.locale,"scopeSelection")),1)],40,Xr),t.createElementVNode("label",Jr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchCase,onChange:y[2]||(y[2]=S=>l("update:matchCase",S.target.checked))},null,40,Qr),t.createTextVNode(t.toDisplayString(t.unref(T)(e.locale,"matchCase")),1)]),t.createElementVNode("label",ea,[t.createElementVNode("input",{type:"checkbox",checked:e.matchEntireCell,onChange:y[3]||(y[3]=S=>l("update:matchEntireCell",S.target.checked))},null,40,ta),t.createTextVNode(t.toDisplayString(t.unref(T)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",la,t.toDisplayString(i.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(T)(e.locale,"findPrev"),disabled:e.total===0,onClick:y[4]||(y[4]=S=>l("prev"))},[...y[9]||(y[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 320a32 32 0 0 1 45.254 0l288 288a32 32 0 0 1-45.254 45.254L512 410.51 214.254 653.254A32 32 0 0 1 169 608l288-288z"})],-1)])],8,na),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(T)(e.locale,"findNext"),disabled:e.total===0,onClick:y[5]||(y[5]=S=>l("next"))},[...y[10]||(y[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 704a32 32 0 0 1-45.254 0l-288-288A32 32 0 0 1 214.254 370.746L512 613.49 809.746 370.746A32 32 0 0 1 855 416l-288 288z"})],-1)])],8,oa),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:y[6]||(y[6]=S=>l("replace"))},t.toDisplayString(t.unref(T)(e.locale,"replace")),9,ra),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:y[7]||(y[7]=S=>l("replace-all"))},t.toDisplayString(t.unref(T)(e.locale,"replaceAll")),9,aa),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(T)(e.locale,"findClose"),onClick:y[8]||(y[8]=S=>l("close"))},[...y[11]||(y[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 451.669L369.664 294.336a32 32 0 0 0-45.312 45.312L466.688 497 309.355 654.336a32 32 0 0 0 45.312 45.312L512 542.688l157.333 157.334a32 32 0 0 0 45.312-45.312L557.312 497 714.645 339.664a32 32 0 0 0-45.312-45.312z"})],-1)])],8,ia)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-8d54f890"]]),sa={class:"nf-dialog__header"},da={class:"nf-dialog__title"},ua={class:"nf-dialog__body"},fa={class:"nf-field"},ma={class:"nf-field__label"},pa=["value"],ha={key:0,class:"nf-field"},ga={class:"nf-field__label"},ya={key:1,class:"nf-field nf-field--inline"},ba={class:"nf-checkbox"},va={key:2,class:"nf-field"},Ca={class:"nf-field__label"},wa=["value"],ka={key:3,class:"nf-field"},Ea={class:"nf-field__label"},Sa=["value"],Ra={key:4,class:"nf-field"},Ba={class:"nf-field__label"},xa=["value"],Ma={key:5,class:"nf-field"},Da={class:"nf-field__label"},Ta=["value"],Na={key:6,class:"nf-field"},Ia={class:"nf-field__label"},Aa=["value"],Va={class:"nf-field"},Fa={class:"nf-field__label"},Ha={class:"nf-dialog__footer"},Oa={class:"nf-preview"},La={class:"nf-preview__label"},$a={class:"nf-preview__value"},za={class:"nf-dialog__actions"},Wa=Et(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},isCustom:{type:Boolean,default:!1},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:n}){const o=e,l=n,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),h=t.ref(!1),c=t.ref("$"),y=t.ref("m/d/yyyy"),S=t.ref("h:mm:ss"),x=t.ref("m/d/yyyy h:mm:ss"),C=t.ref("[h]:mm:ss"),b=t.ref(""),R=t.ref(null),Z=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Q=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],g=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],F=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],X=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],me=t.computed(()=>o.locale==="zh-CN"?[...Q,...g]:[...g,...Q]),ne=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],se=t.computed(()=>o.locale==="zh-CN"?[...F,...X]:[...X,...F]),ue=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],pe={general:"nfCatGeneral",number:"nfCatNumber",currency:"nfCatCurrency",currencyRounded:"nfCatCurrencyRounded",accounting:"nfCatAccounting",financial:"nfCatFinancial",percent:"nfCatPercent",scientific:"nfCatScientific",date:"nfCatDate",time:"nfCatTime",dateTime:"nfCatDateTime",duration:"nfCatDuration",text:"nfCatText",custom:"nfCatCustom"},Ne=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Ae=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),Pe=t.computed(()=>i.value==="date"),He=t.computed(()=>i.value==="time"),we=t.computed(()=>i.value==="dateTime"),re=t.computed(()=>i.value==="duration"),q=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function be(){if(i.value==="general")return Vt;if(i.value==="text")return bt;if(i.value==="custom")return b.value;if(i.value==="date")return y.value;if(i.value==="time")return S.value;if(i.value==="dateTime")return x.value;if(i.value==="duration")return C.value;const le=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?oe(i.value,le,h.value,c.value):lo(o.locale,i.value,le,h.value)}function oe(le,ie,P,xe){const $e=P?"#,##0":"0";if(le==="currencyRounded")return xe+$e;const Ze=ie>0?"."+"0".repeat(ie):"",at=$e+Ze;return le==="currency"?xe+at:`${xe}${at};(${xe}${at});${xe}"-"`}function s(le){if(b.value=le,vt(le)){i.value="general";return}if(le==="@"){i.value="text";return}const ie=le.replace(/\[[^\]]*\]/gi,Ze=>/\[h\]/i.test(Ze)?Ze:"");if(/\[h\]/i.test(ie)&&!/[yd]/i.test(ie)){i.value="duration",ue.includes(le)&&(C.value=le);return}const P=/[yd]/i.test(ie),xe=/h|s|AM\/PM/i.test(ie);if(P&&xe){i.value="dateTime",se.value.includes(le)&&(x.value=le);return}if(P||/AM\/PM/i.test(ie)){xe&&!P?(i.value="time",ne.includes(le)&&(S.value=le)):(i.value="date",me.value.includes(le)&&(y.value=le));return}if(le.includes("%")){i.value="percent",r.value=m(le);return}if(/E[+-]/i.test(le)){i.value="scientific",r.value=m(le);return}const $e=Z.find(Ze=>le.startsWith(Ze.value));if(le.includes("[Red](")){i.value="financial",h.value=le.includes(","),r.value=m(le);return}if($e){le.includes("(")?(i.value="accounting",c.value=$e.value,h.value=le.includes(","),r.value=m(le)):/\.\d/.test(le.slice($e.value.length))?(i.value="currency",c.value=$e.value,h.value=le.includes(","),r.value=m(le)):(i.value="currencyRounded",c.value=$e.value,h.value=le.includes(","));return}i.value="number",h.value=le.includes(","),r.value=m(le)}function m(le){const ie=le.match(/\.([0#?]+)/);return ie?ie[1].length:0}function p(){i.value!=="custom"&&(b.value=be())}function N(){}function A(){y.value=me.value[0],S.value=ne[0],x.value=se.value[0],C.value=ue[0]}function W(){a.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),A(),s(o.currentFormat??""),o.isCustom&&(i.value="custom"),t.nextTick(()=>{var le;return(le=R.value)==null?void 0:le.focus()})}function k(){a.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function he(){l("apply",b.value),k()}function K(){k()}function u(le){le.key==="Escape"&&k()}t.watch(()=>o.modelOpen,le=>{le&&!a.value?W():!le&&a.value&&k()});const M=t.computed(()=>Bl(o.sampleValue,b.value,o.locale));return(le,ie)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:K,onKeydown:u},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:ie[9]||(ie[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",sa,[t.createElementVNode("span",da,t.toDisplayString(t.unref(T)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:k},[...ie[10]||(ie[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",ua,[t.createElementVNode("div",fa,[t.createElementVNode("label",ma,t.toDisplayString(t.unref(T)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[0]||(ie[0]=P=>i.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Gn),P=>(t.openBlock(),t.createElementBlock("option",{key:P,value:P},t.toDisplayString(t.unref(T)(e.locale,pe[P])),9,pa))),128))],544),[[t.vModelSelect,i.value]])]),q.value?(t.openBlock(),t.createElementBlock("div",ha,[t.createElementVNode("label",ga,t.toDisplayString(t.unref(T)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[1]||(ie[1]=P=>r.value=P),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:p},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("div",ya,[t.createElementVNode("label",ba,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[2]||(ie[2]=P=>h.value=P),type:"checkbox",onChange:p},null,544),[[t.vModelCheckbox,h.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(T)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Ae.value?(t.openBlock(),t.createElementBlock("div",va,[t.createElementVNode("label",Ca,t.toDisplayString(t.unref(T)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[3]||(ie[3]=P=>c.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Z,P=>t.createElementVNode("option",{key:P.value,value:P.value},t.toDisplayString(P.label),9,wa)),64))],544),[[t.vModelSelect,c.value]])])):t.createCommentVNode("",!0),Pe.value?(t.openBlock(),t.createElementBlock("div",ka,[t.createElementVNode("label",Ea,t.toDisplayString(t.unref(T)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[4]||(ie[4]=P=>y.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me.value,P=>(t.openBlock(),t.createElementBlock("option",{key:P,value:P},t.toDisplayString(P),9,Sa))),128))],544),[[t.vModelSelect,y.value]])])):t.createCommentVNode("",!0),He.value?(t.openBlock(),t.createElementBlock("div",Ra,[t.createElementVNode("label",Ba,t.toDisplayString(t.unref(T)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[5]||(ie[5]=P=>S.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ne,P=>t.createElementVNode("option",{key:P,value:P},t.toDisplayString(P),9,xa)),64))],544),[[t.vModelSelect,S.value]])])):t.createCommentVNode("",!0),we.value?(t.openBlock(),t.createElementBlock("div",Ma,[t.createElementVNode("label",Da,t.toDisplayString(t.unref(T)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[6]||(ie[6]=P=>x.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se.value,P=>(t.openBlock(),t.createElementBlock("option",{key:P,value:P},t.toDisplayString(P),9,Ta))),128))],544),[[t.vModelSelect,x.value]])])):t.createCommentVNode("",!0),re.value?(t.openBlock(),t.createElementBlock("div",Na,[t.createElementVNode("label",Ia,t.toDisplayString(t.unref(T)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":ie[7]||(ie[7]=P=>C.value=P),class:"nf-field__select",onChange:p},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ue,P=>t.createElementVNode("option",{key:P,value:P},t.toDisplayString(P),9,Aa)),64))],544),[[t.vModelSelect,C.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",Va,[t.createElementVNode("label",Fa,t.toDisplayString(t.unref(T)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:R,"onUpdate:modelValue":ie[8]||(ie[8]=P=>b.value=P),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:N},null,544),[[t.vModelText,b.value]])])]),t.createElementVNode("div",Ha,[t.createElementVNode("div",Oa,[t.createElementVNode("span",La,t.toDisplayString(t.unref(T)(e.locale,"nfPreview")),1),t.createElementVNode("span",$a,t.toDisplayString(M.value||"—"),1)]),t.createElementVNode("div",za,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:he},t.toDisplayString(t.unref(T)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:k},t.toDisplayString(t.unref(T)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-75101bf8"]]);function Ue(e){let n="",o=e;do n=String.fromCharCode(65+o%26)+n,o=Math.floor(o/26)-1;while(o>=0);return n}function Nl(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.toUpperCase().charCodeAt(o)-64);return n-1}function Gt(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return e.endsWith("%")||isNaN(n)?null:n}return null}function Il(e){navigator.clipboard.writeText(e).catch(()=>{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)})}function Jt(e,n){return`${e},${n}`}function cl(e,n,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=Nl(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=n||i<0||i>=o?null:{col:a,row:i}}function Yt(e,n){if(!n)return{x:0,y:0};const o=n.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}function ln(e,n,o){const l=e.split(":");if(l.length!==2)return null;const a=cl(l[0],n,o),i=cl(l[1],n,o);return!a||!i?null:{sc:Math.min(a.col,i.col),sr:Math.min(a.row,i.row),ec:Math.max(a.col,i.col),er:Math.max(a.row,i.row)}}function nn(e){const n=e.trim();if(n==="")return"";const o=Number(n);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?o:e}function Xt(e,n,o,l,a){const i=o[Jt(e,n)];if(!i)return"";const r=i.value;return r.startsWith("=")?on(Jt(e,n),o,l,a):nn(r)}function _a(e,n,o,l,a){const i=Xt(e,n,o,l,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const sl=new Map,pl=new Set;function Al(){sl.clear(),pl.clear()}function on(e,n,o,l){return Ka(e,n,o,l,0)}function Ka(e,n,o,l,a){if(pl.has(e))return null;if(sl.has(e))return sl.get(e);pl.add(e);const i=n[e];let r;if(!i)r=null;else{const h=i.value;if(!h.startsWith("="))r=nn(h);else{const c=h.slice(1).trim(),y=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(c);r=y?an(y[1].toUpperCase(),y[2],n,o,l,a+1):null}}return pl.delete(e),sl.set(e,r),r}function rn(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Ua(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function Pa(e,n,o){let l;if(typeof e=="number"&&typeof n=="number")l=e<n?-1:e>n?1:0;else{const a=String(e??""),i=String(n??"");l=a<i?-1:a>i?1:0}switch(o){case"=":return l===0;case"<>":return l!==0;case"<":return l<0;case">":return l>0;case"<=":return l<=0;case">=":return l>=0}return!1}function Ga(e,n,o,l,a){const i=e.trim(),r=["<=",">=","<>"];let h=null,c=-1,y=null,S=0;for(let C=0;C<i.length;C++){const b=i[C];if(y){b===y&&(i[C+1]===y?C++:y=null);continue}if(b==='"'||b==="'"){y=b;continue}if(b==="("&&S++,b===")"&&S--,S===0&&(b==="<"||b===">"||b==="=")){const R=i.slice(C,C+2);h=r.includes(R)?R:b,c=C;break}}if(h&&c>=0){const C=i.slice(0,c).trim(),b=i.slice(c+h.length).trim(),R=Ft(C,n,o,l,a),Z=Ft(b,n,o,l,a);return Pa(R,Z,h)}const x=Ft(i,n,o,l,a);return rn(x)}function Vl(e){const n=[];let o=0,l=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(l){a+=r,r===l&&(e[i+1]===l?(i++,a+=l):l=null);continue}if(r==='"'||r==="'"){l=r,a+=r;continue}if(r==="("&&o++,r===")"&&o--,r===","&&o===0){n.push(a),a="";continue}a+=r}return n.push(a),n}function Ft(e,n,o,l,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const r=i.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const h=Ya(i);if(h.length===0)return null;let c=0;const y=()=>{let b=S();for(;c<h.length;){const R=h[c];if(R.type==="op"&&(R.val==="+"||R.val==="-"))c++,b=Fl(b,S(),R.val);else break}return b},S=()=>{let b=x();for(;c<h.length;){const R=h[c];if(R.type==="op"&&(R.val==="*"||R.val==="/"))c++,b=Fl(b,x(),R.val);else break}return b},x=()=>{const b=h[c];return b&&b.type==="op"&&b.val==="-"?(c++,Fl(0,x(),"-")):b&&b.type==="op"&&b.val==="+"?(c++,x()):C()},C=()=>{const b=h[c];if(!b)return null;if(b.type==="num")return c++,Number(b.val);if(b.type==="str")return c++,b.val;if(b.type==="lp"){c++;const R=y();return h[c]&&h[c].type==="rp"&&c++,R}if(b.type==="ref"){c++;const R=cl(b.val,o,l);return R?Xt(R.col,R.row,n,o,l):null}if(b.type==="func"){const R=b.val.toUpperCase();if(c++,h[c]&&h[c].type==="lp"){const Z=h[c];let Q=0,g=null,F=c;for(;F<h.length;F++)if(h[F].type==="lp")Q++;else if(h[F].type==="rp"&&(Q--,Q===0)){g=h[F];break}if(g){const X=i.slice(Z.start+1,g.start);return c=F+1,an(R,X,n,o,l,a+1)}}return null}return c++,null};return y()}function Ya(e){const n=[];let o=0;for(;o<e.length;){const l=e[o];if(/\s/.test(l)){o++;continue}if(l==='"'||l==="'"){const a=l,i=o;o++;let r="";for(;o<e.length;){if(e[o]===a){if(e[o+1]===a){r+=a,o+=2;continue}o++;break}r+=e[o],o++}n.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(l)||l==="."){const a=o;let i="";for(l==="."&&(i+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]===".")for(i+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(i+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(i+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;n.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_]/.test(l)){const a=o;let i="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)i+=e[o],o++;e[o]==="("?n.push({type:"func",val:i,start:a}):n.push({type:"ref",val:i,start:a});continue}if(l==="("){n.push({type:"lp",val:l,start:o}),o++;continue}if(l===")"){n.push({type:"rp",val:l,start:o}),o++;continue}if(l===","){n.push({type:"comma",val:l,start:o}),o++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){n.push({type:"op",val:l,start:o}),o++;continue}o++}return n}function Fl(e,n,o){if(typeof e!="number"||typeof n!="number")return null;switch(o){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function an(e,n,o,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=ln(n.trim(),l,a);if(!r)return null;if(e==="COUNT"){let c=0;for(let y=r.sc;y<=r.ec;y++)for(let S=r.sr;S<=r.er;S++)typeof Xt(y,S,o,l,a)=="number"&&c++;return c}let h=0;for(let c=r.sc;c<=r.ec;c++)for(let y=r.sr;y<=r.er;y++)h+=_a(c,y,o,l,a);if(isNaN(h))return null;if(e==="AVERAGE"){const c=(r.ec-r.sc+1)*(r.er-r.sr+1);return c===0?null:h/c}return h}case"IF":{const r=Vl(n);if(r.length<3)return null;const h=Ga(r[0],o,l,a,i);return Ft(h?r[1]:r[2],o,l,a,i)}case"VLOOKUP":{const r=Vl(n);if(r.length<3)return null;const h=Ft(r[0],o,l,a,i),c=ln(r[1].trim(),l,a);if(!c)return null;const y=Ft(r[2],o,l,a,i),S=typeof y=="number"?y:parseFloat(String(y));if(isNaN(S))return null;const x=c.sc+(S-1);if(x<c.sc||x>c.ec)return null;if(r.length>=4?rn(Ft(r[3],o,l,a,i)):!1){let b=-1,R=-1/0;for(let Z=c.sr;Z<=c.er;Z++){const Q=Xt(c.sc,Z,o,l,a);typeof Q=="number"&&typeof h=="number"&&Q<=h&&Q>R&&(R=Q,b=Z)}return b>=0?Xt(x,b,o,l,a):null}for(let b=c.sr;b<=c.er;b++){const R=Xt(c.sc,b,o,l,a);if(Ua(R,h))return Xt(x,b,o,l,a)}return null}case"CONCATENATE":{const r=Vl(n);let h="";for(const c of r){const y=Ft(c,o,l,a,i);h+=y===null?"":typeof y=="number"?String(y):y}return h}default:return null}}function Hl(e,n,o){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=cl(i[1],n,o);if(r)if(i[2]){const h=cl(i[2],n,o);if(!h)continue;for(let c=Math.min(r.col,h.col);c<=Math.max(r.col,h.col);c++)for(let y=Math.min(r.row,h.row);y<=Math.max(r.row,h.row);y++)l.push(Jt(c,y))}else l.push(Jt(r.col,r.row))}return l}function Xa(e,n,o,l,a){const i=o[Jt(e,n)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const h=on(Jt(e,n),o,l,a);return h===null?"#ERROR":String(h)}function ja(e,n,o,l,a,i){return n===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,h,c,y,S)=>{const x=h?Nl(c):Nl(c)+n,C=y?parseInt(S,10)-1:parseInt(S,10)-1+o;let b;x<0?b="A":x>=l?b=i(l-1):b=i(x);let R;return C<0?R="1":C>=a?R=String(a):R=String(C+1),(h||"")+b+(y||"")+R})}class Za{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var l;const o=this.deps.get(n);if(o){for(const a of o)(l=this.rev.get(a))==null||l.delete(n);this.deps.delete(n)}}set(n,o){if(this.clear(n),o.length!==0){this.deps.set(n,o);for(const l of o)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(n)}}markDirty(n){const o=[n];for(;o.length>0;){const l=o.pop(),a=this.rev.get(l);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),o.push(i))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),sl.clear();for(const[a,i]of Object.entries(n))if(i.value.startsWith("=")){const r=Hl(i.value.slice(1),o,l);this.set(a,r)}}}class qa{constructor(n){if(n&&n.length>0){this.styles=n,this.index=new Map;for(let o=0;o<this.styles.length;o++){const l=this.stableKey(this.styles[o]);this.index.set(l,o)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const o=Object.keys(n).sort(),l={};for(const a of o)l[a]=n[a];return JSON.stringify(l)}get(n){const o=this.styles[n];return o?n===0?o:Object.freeze(o):{}}getId(n){if(!n||Object.keys(n).length===0)return 0;const o=this.stableKey(n),l=this.index.get(o);if(l!==void 0)return l;const a=this.styles.length,i=Object.freeze({...n});return this.styles.push(i),this.index.set(o,a),a}getStyles(){return[...this.styles]}setStyles(n){this.styles=n,this.index=new Map;for(let o=0;o<this.styles.length;o++){const l=this.stableKey(this.styles[o]);this.index.set(l,o)}}compactStyles(n){const o=new Set;o.add(0);for(const r in n){const h=n[r].styleId??0;o.add(h)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((r,h)=>r-h);for(const r of i)if(r!==0&&r<this.styles.length){const h=a.length;l.set(r,h),a.push(this.styles[r])}for(const r in n){const h=n[r],c=h.styleId??0,y=l.get(c);y!==void 0&&y!==c&&(h.styleId=y)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const h=this.stableKey(this.styles[r]);this.index.set(h,r)}return a}}function Ja(e,n){if(!e)return null;const o=e.styleId;return o===void 0||o===0?null:n[o]??null}function cn(e){const n=new qa,o={};for(const[l,a]of Object.entries(e)){const i={value:a.value};a.styleId!==void 0&&a.styleId>0&&(i.styleId=a.styleId),a.style&&Object.keys(a.style).length>0&&(i.styleId=n.getId(a.style)),i.styleId===0&&delete i.styleId,o[l]=i}return{cells:o,styles:n.getStyles()}}function Qa(e){const n={};for(const[o,l]of Object.entries(e)){const a={value:l.value};l.styleId!==void 0&&l.styleId>0&&(a.styleId=l.styleId),n[o]=a}return n}class ei{constructor(n){if(n&&n.length>0){this.borders=n,this.index=new Map;for(let o=0;o<this.borders.length;o++){const l=this.stableKey(this.borders[o]);this.index.set(l,o)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const o=["top","right","bottom","left"],l={};for(const a of o){const i=n[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0)){const r={};i.width!==void 0&&(r.width=i.width),i.color!==void 0&&(r.color=i.color),i.style!==void 0&&(r.style=i.style),l[a]=r}}return JSON.stringify(l)}get(n){const o=this.borders[n];return o?n===0?o:Object.freeze(o):{}}getId(n){if(!n||this.isEmptyBorder(n))return 0;const o=this.stableKey(n),l=this.index.get(o);if(l!==void 0)return l;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(n));return this.borders.push(i),this.index.set(o,a),a}isEmptyBorder(n){return!n.top&&!n.right&&!n.bottom&&!n.left}deepCloneBorder(n){const o={};return n.top&&(o.top={...n.top}),n.right&&(o.right={...n.right}),n.bottom&&(o.bottom={...n.bottom}),n.left&&(o.left={...n.left}),o}getBorders(){return[...this.borders]}setBorders(n){this.borders=n,this.index=new Map;for(let o=0;o<this.borders.length;o++){const l=this.stableKey(this.borders[o]);this.index.set(l,o)}}compactBorders(n){const o=new Set;o.add(0);for(const r of n){const h=r.borderId??0;o.add(h)}const l=new Map,a=[{}];l.set(0,0);const i=Array.from(o).sort((r,h)=>r-h);for(const r of i)if(r!==0&&r<this.borders.length){const h=a.length;l.set(r,h),a.push(this.borders[r])}for(const r of n){const h=r.borderId??0,c=l.get(h);c!==void 0&&c!==h&&(r.borderId=c)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const h=this.stableKey(this.borders[r]);this.index.set(h,r)}return a}}function ti(e,n,o,l){if(!e)return;const a=e.styleId??0,i=o[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const h=l.get(r);if(h)return h[n]}function li(e,n,o,l,a,i){const r=l[e.styleId??0]??{},h=r.borderId??0,c=h>0?a.get(h):{},y={top:c.top?{...c.top}:void 0,right:c.right?{...c.right}:void 0,bottom:c.bottom?{...c.bottom}:void 0,left:c.left?{...c.left}:void 0};o?y[n]={...o}:y[n]=void 0;const S=a.getId(y),x={...r};S===0?delete x.borderId:x.borderId=S,delete x.borderTopWidth,delete x.borderBottomWidth,delete x.borderLeftWidth,delete x.borderRightWidth,delete x.borderColor,Object.keys(x).length===0?e.styleId=0:e.styleId=i(x)}function sn(e){const n=new ei,o=[];for(const l of e){if(!(l.borderTopWidth!==void 0||l.borderBottomWidth!==void 0||l.borderLeftWidth!==void 0||l.borderRightWidth!==void 0)){o.push(l);continue}const i=typeof l.borderColor=="string"?l.borderColor:void 0,r={};l.borderTopWidth!==void 0&&l.borderTopWidth>0&&(r.top={width:l.borderTopWidth,color:i}),l.borderBottomWidth!==void 0&&l.borderBottomWidth>0&&(r.bottom={width:l.borderBottomWidth,color:i}),l.borderLeftWidth!==void 0&&l.borderLeftWidth>0&&(r.left={width:l.borderLeftWidth,color:i}),l.borderRightWidth!==void 0&&l.borderRightWidth>0&&(r.right={width:l.borderRightWidth,color:i});const h=n.getId(r),c={...l};delete c.borderTopWidth,delete c.borderBottomWidth,delete c.borderLeftWidth,delete c.borderRightWidth,delete c.borderColor,h>0?c.borderId=h:delete c.borderId,o.push(c)}return{styles:o,borders:n.getBorders()}}function ni(e,n){const o=t.reactive({rowCount:e.rowCount??n.rowCount,colCount:e.colCount??n.colCount,width:e.width,height:e.height,theme:e.theme??n.theme,locale:e.locale??n.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??n.rowCount,o.colCount=e.colCount??n.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??n.theme,o.locale=e.locale??n.locale});const l=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),a=o.colCount,i=o.rowCount,r=t.reactive({}),h=t.reactive([{}]),c=t.reactive([{}]);let y=new Map;y.set("{}",0);let S=new Map;S.set("{}",0);function x(B){const V=Object.keys(B).sort(),H={};for(const ee of V)H[ee]=B[ee];return JSON.stringify(H)}function C(B){const V=["top","right","bottom","left"],H={};for(const ee of V){const de=B[ee];if(de&&(de.width!==void 0||de.color!==void 0||de.style!==void 0)){const f={};de.width!==void 0&&(f.width=de.width),de.color!==void 0&&(f.color=de.color),de.style!==void 0&&(f.style=de.style),H[ee]=f}}return JSON.stringify(H)}function b(B){if(!B||Object.keys(B).length===0)return 0;const V=x(B),H=y.get(V);if(H!==void 0)return H;const ee=h.length;return h.push(Object.freeze({...B})),y.set(V,ee),ee}function R(B){return Ja(B,h)}function Z(){y=new Map;for(let B=0;B<h.length;B++)y.set(x(h[B]),B)}function Q(B){h.splice(0,h.length,...B),Z()}function g(B){if(!B||!B.top&&!B.right&&!B.bottom&&!B.left)return 0;const V=C(B),H=S.get(V);if(H!==void 0)return H;const ee=c.length;return c.push(Object.freeze({top:B.top?Object.freeze({...B.top}):void 0,right:B.right?Object.freeze({...B.right}):void 0,bottom:B.bottom?Object.freeze({...B.bottom}):void 0,left:B.left?Object.freeze({...B.left}):void 0})),S.set(V,ee),ee}function F(B){return c[B]??{}}function X(){S=new Map;for(let B=0;B<c.length;B++)S.set(C(c[B]),B)}function me(B){c.splice(0,c.length,...B),X()}function ne(B,V){return ti(B,V,h,{get:H=>c[H]??{}})}function se(B,V){const H=k(B,V);return H?H.anchor:null}function ue(B,V,H,ee){const de=k(B,V),f=k(H,ee);return!de||!f?!1:de.anchor===f.anchor}const pe=t.reactive({}),Ne=new Za,Ae=t.ref(null),Pe=t.ref("cell"),He=t.ref({col:0,row:0}),we=t.ref(null),re=t.ref(""),q=t.ref(new Array(a).fill(100)),be=t.ref(new Array(i).fill(void 0)),oe=t.ref(0),s=t.ref(0),m=(24-It)/2,p=new Map;let N=null;function A(B,V,H,ee){const de=`${ee} ${H} ${V}px ${B}`,f=p.get(de);if(f)return f;if(!N){if(typeof document>"u")return{ascent:V*.88,descent:V*.28};N=document.createElement("canvas")}const E=N.getContext("2d");if(!E)return{ascent:V*.88,descent:V*.28};E.font=de;const I=E.measureText(" "),$=I.fontBoundingBoxAscent,z=I.fontBoundingBoxDescent;if(typeof $=="number"&&typeof z=="number"&&$>0&&z>0){const et={ascent:$,descent:z};return p.set(de,et),et}const L=["M","中","y","Ä","0"];let te=0,fe=0;for(const et of L){const pt=E.measureText(et),Mt=pt.actualBoundingBoxAscent||0,ht=pt.actualBoundingBoxDescent||0;Mt>te&&(te=Mt),ht>fe&&(fe=ht)}const We=Math.max(te,V*.88),qe=Math.max(fe,V*.28),rt={ascent:We,descent:qe};return p.set(de,rt),rt}let W=(B,V)=>`${B},${V}`,k=()=>null,he=()=>It,K=t.computed(()=>[0]),u=()=>24,M=(B,V,H,ee)=>({startCol:Math.min(B,H),startRow:Math.min(V,ee),endCol:Math.max(B,H),endRow:Math.max(V,ee)});function le(B,V){const H=R(r[W(B,V)]),ee=he(B,V),de=typeof(H==null?void 0:H.fontFamily)=="string"&&H.fontFamily?H.fontFamily:al,f=(H==null?void 0:H.fontWeight)==="bold"?"bold":"normal",E=(H==null?void 0:H.fontStyle)==="italic"?"italic":"normal";return A(de,ee,f,E)}function ie(B,V,H,ee){if(!V)return[""];const de=V.split(`
2
+ `),f=[];for(const E of de)if(!ee||H<=0)f.push(E);else{let I="";for(let $=0;$<E.length;$++){const z=E[$],L=I+z;B.measureText(L).width>H&&I?(f.push(I),I=z):I=L}f.push(I)}return f}function P(B,V){const H=R(r[W(B,V)]);return typeof(H==null?void 0:H.fontSize)=="number"&&H.fontSize>0?H.fontSize:It}he=P;const xe=t.computed(()=>{const B=[0];for(let V=0;V<a;V++)B.push(B[V]+q.value[V]);return B});K=xe;const $e={w:800,h:600};let Ze=()=>{};function at(B){const V=be.value[B];if(V!=null&&V>0)return V;let H,ee,de=1;const f=N?N.getContext("2d"):null,E=A(al,It,"normal","normal");H=E.ascent,ee=E.descent;for(let L=0;L<a;L++){const te=P(L,B),fe=R(r[W(L,B)]),We=typeof(fe==null?void 0:fe.fontFamily)=="string"&&fe.fontFamily?fe.fontFamily:al,qe=(fe==null?void 0:fe.fontWeight)==="bold"?"bold":"normal",rt=(fe==null?void 0:fe.fontStyle)==="italic"?"italic":"normal",et=A(We,te,qe,rt);et.ascent>H&&(H=et.ascent),et.descent>ee&&(ee=et.descent);const pt=typeof(fe==null?void 0:fe.numberFormat)=="string"?fe.numberFormat:"",Mt=ft(L,B),ht=Bl(Mt,pt,l.value);if(ht){const dl=(fe==null?void 0:fe.wrap)==="wrap";let _t;if(dl&&f){f.font=`${rt} ${qe} ${te}px ${We}`;const tl=k(L,B);let jt;tl&&L===tl.range.startCol&&B===tl.range.startRow?jt=K.value[tl.range.endCol+1]-K.value[L]:jt=q.value[L],_t=ie(f,ht,Math.max(0,jt-10),!0).length,_t>de&&(de=_t)}else _t=ht.split(`
3
+ `).length,_t>de&&(de=_t)}}const I=H+ee,$=m*2+de*I;return Math.min(500,Math.max(24,Math.round($)))}u=at;function O(B){return be.value[B]===void 0}const D=t.computed(()=>{const B=[0];for(let V=0;V<i;V++)B.push(B[V]+u(V));return B}),j=t.computed(()=>xe.value[a]),ke=t.computed(()=>D.value[i]);function _(B,V){return`${B},${V}`}W=_;function J(B){Reflect.deleteProperty(r,B)}function Be(B,V){Pe.value="cell";const H=k(B,V);H?(He.value={col:H.range.startCol,row:H.range.startRow},Ae.value={...H.range}):(He.value={col:B,row:V},Ae.value={startCol:B,startRow:V,endCol:B,endRow:V})}function ge(B,V,H,ee,de="cell"){const f=k(B,V);if(He.value=f?{col:f.range.startCol,row:f.range.startRow}:{col:B,row:V},Pe.value=de,de==="row"||de==="col"){const E=Math.min(B,H),I=Math.max(B,H),$=Math.min(V,ee),z=Math.max(V,ee);Ae.value={startCol:E,startRow:$,endCol:I,endRow:z}}else Ae.value=M(B,V,H,ee)}function Me(){ge(0,0,a-1,i-1,"all")}function Ve(B,V){const H=Ae.value;return H?(Pe.value==="cell"||Pe.value==="all",B>=H.startCol&&B<=H.endCol&&V>=H.startRow&&V<=H.endRow):!1}function Ye(B,V){return Ve(B,V)}function Qe(B,V){for(const H in pe){const ee=pe[H];if(ee&&B>=ee.startCol&&B<=ee.endCol&&V>=ee.startRow&&V<=ee.endRow)return{range:ee,anchor:H}}return null}k=Qe;function ct(B,V){return pe[_(B,V)]!==void 0}function mt(B,V){const H=k(B,V);if(H&&B===H.range.startCol&&V===H.range.startRow){const ee=xe.value[H.range.endCol+1]-xe.value[B],de=D.value[H.range.endRow+1]-D.value[V];return{w:ee,h:de}}return{w:q.value[B],h:u(V)}}function zt(B,V,H,ee){let de=Math.min(B,H),f=Math.max(B,H),E=Math.min(V,ee),I=Math.max(V,ee),$=!0;for(;$;){$=!1;for(const z in pe){const L=pe[z];if(!L)continue;L.startCol<=f&&L.endCol>=de&&L.startRow<=I&&L.endRow>=E&&(L.startCol<de&&(de=L.startCol,$=!0),L.endCol>f&&(f=L.endCol,$=!0),L.startRow<E&&(E=L.startRow,$=!0),L.endRow>I&&(I=L.endRow,$=!0))}}return{startCol:de,startRow:E,endCol:f,endRow:I}}M=zt;function st(B,V){var H;return((H=r[_(B,V)])==null?void 0:H.value)??""}function ft(B,V){return Al(),Xa(B,V,r,a,i)}function Ct(B,V,H){var I,$;const ee=_(B,V);if(Al(),H===""||H==null){Ne.clear(ee);const z=(I=r[ee])==null?void 0:I.styleId;z!==void 0&&z>0?r[ee]={value:"",styleId:z}:J(ee),Ne.markDirty(ee);return}const de=String(H);if(!de.startsWith("=")){const z=R(r[ee]),L=typeof(z==null?void 0:z.numberFormat)=="string"?z.numberFormat:"";if(vt(L)){const te=to(de,l.value);if(te){const fe={...z??{},numberFormat:te.format};r[ee]={value:String(te.serial),styleId:b(fe)},Ne.clear(ee),Ne.markDirty(ee);return}}}const f=($=r[ee])==null?void 0:$.styleId,E={value:de};f!==void 0&&f>0&&(E.styleId=f),r[ee]=E,de.startsWith("=")?Ne.set(ee,Hl(de.slice(1),a,i)):Ne.clear(ee),Ne.markDirty(ee)}function Qt(B,V,H,ee){for(let de=B;de<=V;de++)for(let f=H;f<=ee;f++){const E=_(de,f);Ne.clear(E),J(E),Ne.markDirty(E)}}let el=()=>{};function St(B){we.value||(we.value={...He.value},B!==void 0?re.value=B:re.value||(re.value=st(He.value.col,He.value.row)))}function ot(){we.value&&(el(),Ct(we.value.col,we.value.row,re.value),we.value=null,re.value="")}function it(){we.value=null,re.value=""}function Rt(B,V){const H=He.value;let ee=Math.max(0,Math.min(a-1,H.col+B)),de=Math.max(0,Math.min(i-1,H.row+V));const f=k(H.col,H.row),E=k(ee,de);f&&E&&f.anchor===E.anchor&&(B>0?ee=f.range.endCol+1:B<0&&(ee=f.range.startCol-1),V>0?de=f.range.endRow+1:V<0&&(de=f.range.startRow-1),ee=Math.max(0,Math.min(a-1,ee)),de=Math.max(0,Math.min(i-1,de))),Be(ee,de)}function Bt(B,V){const H=Math.max(0,$e.w-52-11),ee=Math.max(0,$e.h-24-11),de=xe.value[B],f=D.value[V],E=k(B,V),I=E?xe.value[E.range.endCol+1]-xe.value[B]:q.value[B],$=E?D.value[E.range.endRow+1]-D.value[V]:u(V);let z=oe.value,L=s.value;de<z?z=de:de+I>z+H&&(z=de+I-H),f<L?L=f:f+$>L+ee&&(L=f+$-ee),Ze(z,L)}function xt(B){const V=xe.value;if(B<0||B>=V[a])return-1;let H=0,ee=a-1;for(;H<ee;){const de=H+ee+1>>1;V[de]<=B?H=de:ee=de-1}return H}function Wt(B){const V=D.value;if(B<0||B>=V[i])return-1;let H=0,ee=i-1;for(;H<ee;){const de=H+ee+1>>1;V[de]<=B?H=de:ee=de-1}return H}const dt={props:o,locale:l,colCount:a,rowCount:i,cells:r,styles:h,borders:c,merges:pe,formulaDeps:Ne,selection:Ae,activeCell:He,editingCell:we,editValue:re,colWidths:q,rowHeights:be,scrollX:oe,scrollY:s,BASE_CELL_VPAD:m,fontMetricsCache:p,fontMetricsCanvas:N,measureFontMetrics:A,_getFontMetricsForCell:le,getWrappedLines:ie,cellFontSize:P,colPositions:xe,getRowHeight:at,_isAutoRow:O,rowPositions:D,totalWidth:j,totalHeight:ke,selectCell:Be,selectRange:ge,selectAll:Me,isSelected:Ve,isCellSelected:Ye,selectionMode:Pe,cellKey:_,delCell:J,findMerge:Qe,_isMergeAnchor:ct,_mergedSpan:mt,expandSelectionForMerges:zt,getCellRaw:st,getCellValue:ft,setCellValue:Ct,clearCellsInRange:Qt,startEdit:St,commitEdit:ot,cancelEdit:it,moveActive:Rt,ensureVisible:Bt,hitCol:xt,hitRow:Wt,registerStyle:b,resolveStyle:R,rebuildStyleIndex:Z,syncStyles:Q,registerBorder:g,resolveBorder:F,rebuildBorderIndex:X,syncBorders:me,getCellBorderSide:ne,getMergeOwner:se,isSameMergeInternal:ue,viewSize:$e,findHighlight:(B,V)=>null};return el=()=>{var B;return(B=dt.saveUndo)==null?void 0:B.call(dt)},Ze=(B,V)=>{var H;return(H=dt.clampScroll)==null?void 0:H.call(dt,B,V)},dt}function oi(e,n){const o=t.ref([]),l=t.ref([]);function a(f){return Qa(f)}function i(){return n.saveSheet(),{sheets:n.sheets.value.map(f=>({id:f.id,name:f.name,cells:a(f.cells),styles:[...f.styles],borders:f.borders?[...f.borders]:[{}],merges:f.merges?{...f.merges}:{},selection:f.selection?{...f.selection}:null,activeCell:f.activeCell?{...f.activeCell}:{col:0,row:0},scrollX:f.scrollX,scrollY:f.scrollY,colWidths:[...f.colWidths],rowHeights:[...f.rowHeights]})),styles:[...e.styles],activeSheetIndex:n.activeSheetIndex.value}}function r(f){n.sheets.value=f.sheets.map(E=>({...E,cells:a(E.cells),styles:[...E.styles],borders:E.borders?[...E.borders]:[{}]})),n.loadSheet(Math.max(0,Math.min(f.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function h(){const f=i(),E=o.value[o.value.length-1];E&&JSON.stringify(E)===JSON.stringify(f)||(o.value.push(f),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=h;function c(){var f;o.value.length&&(l.value.push(i()),r(o.value.pop()),(f=e.scheduleRender)==null||f.call(e),t.nextTick(()=>{var E;return(E=e.emitModelData)==null?void 0:E.call(e)}))}function y(){var f;l.value.length&&(o.value.push(i()),r(l.value.pop()),(f=e.scheduleRender)==null||f.call(e),t.nextTick(()=>{var E;return(E=e.emitModelData)==null?void 0:E.call(e)}))}const S=t.computed(()=>o.value.length>0),x=t.computed(()=>l.value.length>0),C=t.computed(()=>!!e.selection.value),b=t.ref(null);function R(){var I;const f=e.selection.value;if(!f)return;const E={};for(let $=f.startCol;$<=f.endCol;$++)for(let z=f.startRow;z<=f.endRow;z++)E[`${$-f.startCol},${z-f.startRow}`]=((I=e.cells[e.cellKey($,z)])==null?void 0:I.styleId)??0;b.value={styles:E}}function Z(){var I,$,z;const f=b.value,E=e.selection.value;if(!(!f||!E)){h();for(let L=E.startCol;L<=E.endCol;L++)for(let te=E.startRow;te<=E.endRow;te++){const fe=e.findMerge(L,te);if(fe&&(L!==fe.range.startCol||te!==fe.range.startRow))continue;const We=f.styles[`${L-E.startCol},${te-E.startRow}`]??0,qe=e.cellKey(L,te),rt=((I=e.cells[qe])==null?void 0:I.value)??"";if(rt===""&&We===0)e.delCell(qe);else{const et={value:rt};We>0&&(et.styleId=We),e.cells[qe]=et}}b.value=null,($=e.scheduleRender)==null||$.call(e),(z=e.emitModelData)==null||z.call(e)}}function Q(){var E,I,$;const f=e.selection.value;if(f){h();for(let z=f.startCol;z<=f.endCol;z++)for(let L=f.startRow;L<=f.endRow;L++){const te=e.findMerge(z,L);if(te&&(z!==te.range.startCol||L!==te.range.startRow))continue;const fe=e.cellKey(z,L),We=((E=e.cells[fe])==null?void 0:E.value)??"";We===""?e.delCell(fe):e.cells[fe]={value:We}}(I=e.scheduleRender)==null||I.call(e),($=e.emitModelData)==null||$.call(e)}}const g=t.computed(()=>Cn.map(f=>({...f,label:f.value===""?T(e.locale.value,"fontDefault"):f.label}))),F=t.computed(()=>wn.map(f=>({...f,label:String(f.value)}))),X="\0",me=t.computed(()=>{const f=e.selection.value;if(!f)return"";let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=typeof(te==null?void 0:te.fontFamily)=="string"?te.fontFamily:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?X:E??""}),ne=t.computed(()=>{const f=e.selection.value;if(!f)return It;let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.cellFontSize($,z);E===void 0?E=te:te!==E&&(I=!0)}return I?0:E??It});function se(f,E){var $,z,L;const I=e.selection.value;if(I){h();for(let te=I.startCol;te<=I.endCol;te++)for(let fe=I.startRow;fe<=I.endRow;fe++){const We=e.findMerge(te,fe);if(We&&(te!==We.range.startCol||fe!==We.range.startRow))continue;const qe=e.cellKey(te,fe),rt=(($=e.cells[qe])==null?void 0:$.value)??"";let pt={...e.resolveStyle(e.cells[qe])??{}};if(E===""||E===null||E===void 0||E===0){const{[f]:ht,...dl}=pt;pt=dl}else pt[f]=E;const Mt=Object.keys(pt).length?e.registerStyle(pt):0;if(rt===""&&Mt===0)e.delCell(qe);else{const ht={value:rt};Mt>0&&(ht.styleId=Mt),e.cells[qe]=ht}}(z=e.scheduleRender)==null||z.call(e),(L=e.emitModelData)==null||L.call(e)}}function ue(f){se("fontFamily",f===""?"":f)}const pe=t.ref(!1),Ne=t.ref(!1),Ae=t.ref(!1),Pe=t.ref(!1),He=t.ref(!1);function we(f){se("fontSize",f),pe.value=!1}const re=t.computed(()=>Mn.map(f=>({label:T(e.locale.value,f.labelKey),value:f.value,icon:f.icon}))),q=t.computed(()=>Dn.map(f=>({label:T(e.locale.value,f.labelKey),value:f.value,icon:f.icon}))),be=t.computed(()=>{const f=e.selection.value;if(!f)return"left";const E=e.resolveStyle(e.cells[e.cellKey(f.startCol,f.startRow)]),I=typeof(E==null?void 0:E.textAlign)=="string"?E.textAlign:"";return I==="center"||I==="right"?I:"left"}),oe=t.computed(()=>{const f=e.selection.value;if(!f)return"top";const E=e.resolveStyle(e.cells[e.cellKey(f.startCol,f.startRow)]),I=typeof(E==null?void 0:E.verticalAlign)=="string"?E.verticalAlign:"";return I==="middle"||I==="bottom"?I:"top"}),s=t.computed(()=>{const f=e.selection.value;if(!f)return!1;const E=e.resolveStyle(e.cells[e.cellKey(f.startCol,f.startRow)]);return(E==null?void 0:E.wrap)==="wrap"});function m(f){se("textAlign",f)}function p(f){se("verticalAlign",f)}function N(){if(!e.selection.value)return;const E=s.value;se("wrap",E?void 0:"wrap")}const A=t.ref(""),W=pe;t.watch(ne,f=>{A.value=f===0?"":String(f)},{immediate:!0});function k(f){const E=f.replace(/[^\d]/g,"");A.value=E;const I=parseInt(E,10);!isNaN(I)&&I>=5&&I<=72&&I!==ne.value&&se("fontSize",I)}function he(){const f=A.value.trim();if(!f){A.value=ne.value===0?"":String(ne.value);return}let E=parseInt(f,10);isNaN(E)?E=ne.value===0?It:ne.value:E=Math.max(5,Math.min(72,E)),A.value=String(E),E!==ne.value&&se("fontSize",E)}function K(f){f.key==="Enter"&&f.target.blur()}function u(f){f&&f.preventDefault(),W.value=!W.value,W.value&&(Ae&&(Ae.value=!1),Ne&&(Ne.value=!1),Pe.value=!1,He.value=!1)}function M(){const f=ne.value===0?It:ne.value,E=Math.min(72,f+1);se("fontSize",E),A.value=String(E),W.value=!1}function le(){const f=ne.value===0?It:ne.value,E=Math.max(5,f-1);se("fontSize",E),A.value=String(E),W.value=!1}function ie(f){const E=e.selection.value;if(!E)return!1;let I,$=!1;for(let z=E.startCol;z<=E.endCol&&!$;z++)for(let L=E.startRow;L<=E.endRow&&!$;L++){const te=e.findMerge(z,L);if(te&&(z!==te.range.startCol||L!==te.range.startRow))continue;const fe=e.resolveStyle(e.cells[e.cellKey(z,L)]),We=!!(fe!=null&&fe[f]);I===void 0?I=We:We!==I&&($=!0)}return!$&&I===!0}const P=t.computed(()=>ie("fontWeight")),xe=t.computed(()=>ie("fontStyle")),$e=t.computed(()=>ie("underline")),Ze=t.computed(()=>ie("strikethrough"));function at(){se("fontWeight",P.value?"":"bold")}function O(){se("fontStyle",xe.value?"":"italic")}function D(){se("underline",$e.value?"":"underline")}function j(){se("strikethrough",Ze.value?"":"line-through")}const ke=t.ref(""),_=t.ref(""),J=Pe,Be=He;function ge(){J.value=!J.value,Be.value=!1,Ne&&(Ne.value=!1),Ae&&(Ae.value=!1)}function Me(){Be.value=!Be.value,J.value=!1,Ne&&(Ne.value=!1),Ae&&(Ae.value=!1)}function Ve(f){Ne&&(Ne.value=f),f&&(J.value=!1,Be.value=!1,Ae&&(Ae.value=!1))}function Ye(f){ke.value=f,se("color",f===""?"":f)}function Qe(f){_.value=f,se("backgroundColor",f===""?"":f)}function ct(){se("color",ke.value===""?"":ke.value)}function mt(){se("backgroundColor",_.value===""?"":_.value)}const zt=t.computed(()=>{const f=e.selection.value;if(!f)return"";let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=typeof(te==null?void 0:te.color)=="string"?te.color:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?"":E??""}),st=t.computed(()=>{const f=e.selection.value;if(!f)return"";let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=typeof(te==null?void 0:te.backgroundColor)=="string"?te.backgroundColor:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?"":E??""}),ft=t.computed(()=>en(e.locale.value)),Ct=t.ref(!1),Qt=t.computed(()=>{const f=e.selection.value;if(!f)return Vt;let E,I=!1;for(let $=f.startCol;$<=f.endCol&&!I;$++)for(let z=f.startRow;z<=f.endRow&&!I;z++){const L=e.findMerge($,z);if(L&&($!==L.range.startCol||z!==L.range.startRow))continue;const te=e.resolveStyle(e.cells[e.cellKey($,z)]),fe=(te==null?void 0:te.numberFormatCategory)==="custom"?At:typeof(te==null?void 0:te.numberFormat)=="string"?te.numberFormat:"";E===void 0?E=fe:fe!==E&&(I=!0)}return I?kt:E??Vt});function el(f){if((f==null?void 0:f.numberFormatCategory)==="custom")return At;const E=typeof(f==null?void 0:f.numberFormat)=="string"?f.numberFormat:"";return Ql(E,e.locale.value)}const St=t.computed(()=>{const f=Qt.value;if(f!==kt)return f===At?At:Ql(f,e.locale.value);const E=e.selection.value;if(!E)return Vt;let I,$=!1;for(let z=E.startCol;z<=E.endCol&&!$;z++)for(let L=E.startRow;L<=E.endRow&&!$;L++){const te=e.findMerge(z,L);if(te&&(z!==te.range.startCol||L!==te.range.startRow))continue;const fe=el(e.resolveStyle(e.cells[e.cellKey(z,L)]));I===void 0?I=fe:fe!==I&&($=!0)}return $?kt:I??Vt});function ot(f){se("numberFormat",f),it()}function it(){const f=e.selection.value;if(f)for(let E=f.startCol;E<=f.endCol;E++)for(let I=f.startRow;I<=f.endRow;I++){const $=e.findMerge(E,I);if($&&(E!==$.range.startCol||I!==$.range.startRow))continue;const z=e.cellKey(E,I),L=e.cells[z],te=e.resolveStyle(L);if((te==null?void 0:te.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:fe,...We}=te,qe=Object.keys(We).length?e.registerStyle(We):0,rt=(L==null?void 0:L.value)??"";if(rt===""&&qe===0)e.delCell(z);else{const et={value:rt};qe>0&&(et.styleId=qe),e.cells[z]=et}}}function Rt(f){if(f===At){Ct.value=!0;return}ot(f)}function Bt(){Ct.value=!0}function xt(){const f=e.selection.value;if(!f)return[];const E=[];for(let I=f.startCol;I<=f.endCol;I++)for(let $=f.startRow;$<=f.endRow;$++){const z=e.findMerge(I,$);if(z&&(I!==z.range.startCol||$!==z.range.startRow))continue;const L=e.cellKey(I,$),te=e.cells[L],fe=e.resolveStyle(te),We=typeof(fe==null?void 0:fe.numberFormat)=="string"?fe.numberFormat:Vt,qe=(te==null?void 0:te.value)??"";Jl(We,qe)&&E.push({key:L,nf:We,decimals:jn(We,qe)})}return E}const Wt=t.computed(()=>xt().some(f=>f.decimals<xl)),dt=t.computed(()=>xt().some(f=>f.decimals>Ml));function B(f,E,I){var fe;const $=((fe=e.cells[f])==null?void 0:fe.value)??"",L={...e.resolveStyle(e.cells[f])??{}};E===""?(delete L.numberFormat,delete L.numberFormatCategory):(L.numberFormat=E,I==="custom"&&(L.numberFormatCategory="custom"));const te=Object.keys(L).length?e.registerStyle(L):0;if($===""&&te===0)e.delCell(f);else{const We={value:$};te>0&&(We.styleId=te),e.cells[f]=We}}function V(f){var $,z;const E=xt(),I=[];for(const L of E){const te=L.decimals+f;if(te<Ml||te>xl)continue;const fe=qn(L.nf,te);fe==null||fe===L.nf||I.push({key:L.key,code:fe,category:vt(L.nf)?"custom":void 0})}if(I.length){h();for(const L of I)B(L.key,L.code,L.category);($=e.scheduleRender)==null||$.call(e),(z=e.emitModelData)==null||z.call(e)}}function H(){V(1)}function ee(){V(-1)}return{undoStack:o,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:h,undo:c,redo:y,canUndo:S,canRedo:x,hasSelection:C,paintFmt:b,onPaintFormat:R,applyPaintFormat:Z,clearFormat:Q,fontFamilyOptions:g,fontSizeOptions:F,FONT_FAMILY_MIXED:X,selFontFamily:me,selFontSize:ne,applyStyleToSelection:se,onFontFamilyChange:ue,onFontSizeChange:we,hAlignOptions:re,vAlignOptions:q,selHAlign:be,selVAlign:oe,selWrap:s,onHAlignChange:m,onVAlignChange:p,onWrapToggle:N,fontSizeInput:A,fontSizeMenuOpen:W,onFontSizeInput:k,onFontSizeBlur:he,onFontSizeKeydown:K,toggleFontSizeMenu:u,onFontSizeStepUp:M,onFontSizeStepDown:le,selFontWeight:P,selFontStyle:xe,selUnderline:$e,selStrikethrough:Ze,toggleFontWeight:at,toggleFontStyle:O,toggleUnderline:D,toggleStrikethrough:j,cachedTextColor:ke,cachedFillColor:_,textColorMenuOpen:J,fillColorMenuOpen:Be,_toggleTextColorMenu:ge,_toggleFillColorMenu:Me,onBorderMenuToggle:Ve,onTextColorChange:Ye,onFillColorChange:Qe,applyCachedTextColor:ct,applyCachedFillColor:mt,selTextColor:zt,selFillColor:st,nfOptions:ft,selNumberFormat:Qt,selNumberFormatDisplay:St,NF_NUMBER_FORMAT_MIXED:kt,nfDialogOpen:Ct,onNumberFormatChange:Rt,openNumberFormatDialog:Bt,applyNumberFormatCode:ot,canIncreaseDecimals:Wt,canDecreaseDecimals:dt,onIncreaseDecimals:H,onDecreaseDecimals:ee}}function ri(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{l&&(l.value=i),i&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,a&&(a.value=!1))},e.toggleFontSizeMenu=i=>{i&&i.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(a&&(a.value=!1),l&&(l.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)}})()}function ai(e,n){const o=t.ref("none"),l=t.ref(!1),a="#444";function i(p,N,A,W){if(p<0||N<0||p>=e.colCount||N>=e.rowCount)return;const k=e.findMerge(p,N),he=k?k.anchor:e.cellKey(p,N);if(!e.cells[he]){if(!W)return;e.cells[he]={value:""}}li(e.cells[he],A,W,e.styles,{get:u=>e.resolveBorder(u),getId:u=>e.registerBorder(u)},e.registerStyle)}function r(p,N,A){var M;const W=e.findMerge(p,N),k=W?W.anchor:e.cellKey(p,N),he=((M=e.cells[k])==null?void 0:M.value)??"",K=e.resolveStyle(e.cells[k])?{...e.resolveStyle(e.cells[k])}:{},u=e.registerBorder(A);if(u>0?K.borderId=u:delete K.borderId,delete K.borderTopWidth,delete K.borderBottomWidth,delete K.borderLeftWidth,delete K.borderRightWidth,delete K.borderColor,he===""&&!Object.keys(K).length)e.delCell(k);else{const le=e.registerStyle(K);e.cells[k]={value:he,styleId:le||void 0}}}function h(p){var M,le;o.value=p;const N=e.selection.value;if(!N)return;n.saveUndo();const{startCol:A,startRow:W,endCol:k,endRow:he}=N,K={width:1,color:a},u={width:2,color:a};if(p==="none")for(let ie=A;ie<=k;ie++)for(let P=W;P<=he;P++){const xe=e.findMerge(ie,P);xe&&(ie!==xe.range.startCol||P!==xe.range.startRow)||r(ie,P,{})}else if(p==="all")for(let ie=A;ie<=k;ie++)for(let P=W;P<=he;P++){const xe=e.findMerge(ie,P);xe&&(ie!==xe.range.startCol||P!==xe.range.startRow)||r(ie,P,{top:K,right:K,bottom:K,left:K})}else if(p==="outer"||p==="thickOuter"){const ie=p==="thickOuter"?u:K;for(let P=A;P<=k;P++)i(P,W,"top",ie);for(let P=A;P<=k;P++)i(P,he,"bottom",ie);for(let P=W;P<=he;P++)i(A,P,"left",ie);for(let P=W;P<=he;P++)i(k,P,"right",ie)}else{const P={top:{side:"top",edgeCheck:(xe,$e)=>$e===W},bottom:{side:"bottom",edgeCheck:(xe,$e)=>$e===he},left:{side:"left",edgeCheck:(xe,$e)=>xe===A},right:{side:"right",edgeCheck:(xe,$e)=>xe===k}}[p];if(P)for(let xe=A;xe<=k;xe++)for(let $e=W;$e<=he;$e++)P.edgeCheck(xe,$e)&&i(xe,$e,P.side,K)}(M=e.scheduleRender)==null||M.call(e),(le=e.emitModelData)==null||le.call(e)}function c(){h(o.value)}function y(p,N,A){const W=A.toLowerCase(),k=e.findMerge(p,N);if(k){if(W==="top"&&N!==k.range.startRow||W==="bottom"&&N!==k.range.endRow||W==="left"&&p!==k.range.startCol||W==="right"&&p!==k.range.endCol)return 0;const K=e.getCellBorderSide(e.cells[k.anchor],W);return(K==null?void 0:K.width)??0}const he=e.getCellBorderSide(e.cells[e.cellKey(p,N)],W);return(he==null?void 0:he.width)??0}const S=t.ref(!1);function x(p){S.value=p,p&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1)}function C(p,N,A,W){const k=[];for(const he in e.merges){const K=e.merges[he];K&&K.startCol<=A&&K.endCol>=p&&K.startRow<=W&&K.endRow>=N&&k.push(he)}for(const he of k)Reflect.deleteProperty(e.merges,he)}function b(){var he,K,u;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;n.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow);const N=e.cellKey(p.startCol,p.startRow),A=((he=e.cells[N])==null?void 0:he.value)??"";for(let M=p.startCol;M<=p.endCol;M++)for(let le=p.startRow;le<=p.endRow;le++)M===p.startCol&&le===p.startRow||e.clearCellsInRange(M,M,le,le);const W=e.resolveStyle(e.cells[N])?{...e.resolveStyle(e.cells[N])}:{};W.textAlign="center";const k=e.registerStyle(W);e.cells[N]={value:A,styleId:k||void 0},e.merges[N]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(K=e.scheduleRender)==null||K.call(e),(u=e.emitModelData)==null||u.call(e)}function R(){var N,A,W;const p=e.selection.value;if(!(!p||p.startCol===p.endCol)){n.saveUndo();for(let k=p.startRow;k<=p.endRow;k++){C(p.startCol,k,p.endCol,k);const he=e.cellKey(p.startCol,k);(N=e.cells[he])==null||N.value;for(let K=p.startCol+1;K<=p.endCol;K++)e.clearCellsInRange(K,K,k,k);e.merges[he]={startCol:p.startCol,startRow:k,endCol:p.endCol,endRow:k}}e.selectRange(p.startCol,p.startRow,p.endCol,p.endRow),(A=e.scheduleRender)==null||A.call(e),(W=e.emitModelData)==null||W.call(e)}}function Z(){var A,W,k;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;n.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow);const N=e.cellKey(p.startCol,p.startRow);(A=e.cells[N])==null||A.value;for(let he=p.startCol;he<=p.endCol;he++)for(let K=p.startRow;K<=p.endRow;K++)he===p.startCol&&K===p.startRow||e.clearCellsInRange(he,he,K,K);e.merges[N]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(W=e.scheduleRender)==null||W.call(e),(k=e.emitModelData)==null||k.call(e)}function Q(){var N,A;const p=e.selection.value;p&&(n.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow),(N=e.scheduleRender)==null||N.call(e),(A=e.emitModelData)==null||A.call(e))}function g(){const p=e.selection.value;if(!p)return;const N=e.findMerge(p.startCol,p.startRow);N&&p.startCol===N.range.startCol&&p.startRow===N.range.startRow&&p.endCol===N.range.endCol&&p.endRow===N.range.endRow?Q():b()}function F(p){switch(p){case"mergeCenter":b();break;case"mergeAcross":R();break;case"mergeCells":Z();break;case"unmergeCells":Q();break}}let X=null,me=[];function ne(p,N,A,W){me=[];for(let k=A;k<=W;k++){const he=[];for(let K=p;K<=N;K++){const u=e.cells[e.cellKey(K,k)];he.push((u==null?void 0:u.styleId)??0)}me.push(he)}}function se(p,N,A,W){const k=e.cellKey(p,N);if(Al(),A===""||A==null){e.formulaDeps.clear(k),W&&W>0?e.cells[k]={value:"",styleId:W}:e.delCell(k),e.formulaDeps.markDirty(k);return}e.cells[k]={value:A,styleId:W&&W>0?W:void 0},A.startsWith("=")?e.formulaDeps.set(k,Hl(A.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(k),e.formulaDeps.markDirty(k)}function ue(){const p=e.selection.value;if(!p)return;X={...p},ne(p.startCol,p.endCol,p.startRow,p.endRow);const N=[];for(let A=p.startRow;A<=p.endRow;A++){const W=[];for(let k=p.startCol;k<=p.endCol;k++)W.push(e.getCellRaw(k,A));N.push(W.join(" "))}Il(N.join(`
4
+ `))}function pe(){const p=e.selection.value;if(p){if(p.startCol===0&&p.endCol===e.colCount-1){X={...p},ne(0,e.colCount-1,p.startRow,p.endRow);const N=[];for(let A=p.startRow;A<=p.endRow;A++){const W=[];for(let k=0;k<e.colCount;k++)W.push(e.getCellRaw(k,A));N.push(W.join(" "))}Il(N.join(`
5
+ `))}else if(p.startRow===0&&p.endRow===e.rowCount-1){X={...p},ne(p.startCol,p.endCol,0,e.rowCount-1);const N=[];for(let A=0;A<e.rowCount;A++){const W=[];for(let k=p.startCol;k<=p.endCol;k++)W.push(e.getCellRaw(k,A));N.push(W.join(" "))}Il(N.join(`
6
+ `))}}}async function Ne(){var he;let p;try{p=await navigator.clipboard.readText()}catch{return}if(!p&&p!=="")return;const N=p.split(/\r?\n/),A=e.activeCell.value,W=X,k=W&&me.length>0;for(let K=0;K<N.length;K++){const u=N[K].split(" ");for(let M=0;M<u.length;M++){const le=A.col+M,ie=A.row+K;if(le<e.colCount&&ie<e.rowCount){let P=u[M];if(P.startsWith("=")&&W&&(P=ja(P,le-(W.startCol+M),ie-(W.startRow+K),e.colCount,e.rowCount,Ue)),k&&K<me.length&&M<(((he=me[K])==null?void 0:he.length)??0)){const xe=me[K][M]??null;se(le,ie,P,xe)}else e.setCellValue(le,ie,P)}}}}function Ae(){var p;if(n.saveUndo(),ue(),e.selection.value){const N=e.selection.value;e.clearCellsInRange(N.startCol,N.endCol,N.startRow,N.endRow),(p=e.scheduleRender)==null||p.call(e)}}function Pe(){var p;if(e.selection.value){const N=e.selection.value;e.clearCellsInRange(N.startCol,N.endCol,N.startRow,N.endRow),(p=e.scheduleRender)==null||p.call(e)}}function He(){var he,K;const p=e.selection.value;if(!p)return;n.saveUndo();const N=p.startCol,A=p.startRow,W=p.endCol,k=p.endRow;if(A===k)if(W+1<e.colCount){const u=`${Ue(N)}${A+1}:${Ue(W)}${A+1}`;e.setCellValue(W+1,A,`=SUM(${u})`)}else{const u=`${Ue(N)}${A+1}:${Ue(W-1)}${A+1}`;e.setCellValue(W,A,`=SUM(${u})`)}else for(let u=N;u<=W;u++)if(k+1<e.rowCount){const M=`${Ue(u)}${A+1}:${Ue(u)}${k+1}`;e.setCellValue(u,k+1,`=SUM(${M})`)}else{const M=`${Ue(u)}${A+1}:${Ue(u)}${k}`;e.setCellValue(u,k,`=SUM(${M})`)}(he=e.scheduleRender)==null||he.call(e),(K=e.emitModelData)==null||K.call(e)}function we(){var he,K;const p=e.selection.value;if(!p)return;n.saveUndo();const N=p.startCol,A=p.startRow,W=p.endCol,k=p.endRow;if(A===k)if(W+1<e.colCount){const u=`${Ue(N)}${A+1}:${Ue(W)}${A+1}`;e.setCellValue(W+1,A,`=AVERAGE(${u})`)}else{const u=`${Ue(N)}${A+1}:${Ue(W-1)}${A+1}`;e.setCellValue(W,A,`=AVERAGE(${u})`)}else for(let u=N;u<=W;u++)if(k+1<e.rowCount){const M=`${Ue(u)}${A+1}:${Ue(u)}${k+1}`;e.setCellValue(u,k+1,`=AVERAGE(${M})`)}else{const M=`${Ue(u)}${A+1}:${Ue(u)}${k}`;e.setCellValue(u,k,`=AVERAGE(${M})`)}(he=e.scheduleRender)==null||he.call(e),(K=e.emitModelData)==null||K.call(e)}function re(){var he,K;const p=e.selection.value;if(!p)return;n.saveUndo();const N=p.startCol,A=p.startRow,W=p.endCol,k=p.endRow;if(A===k)if(W+1<e.colCount){const u=`${Ue(N)}${A+1}:${Ue(W)}${A+1}`;e.setCellValue(W+1,A,`=COUNT(${u})`)}else{const u=`${Ue(N)}${A+1}:${Ue(W-1)}${A+1}`;e.setCellValue(W,A,`=COUNT(${u})`)}else for(let u=N;u<=W;u++)if(k+1<e.rowCount){const M=`${Ue(u)}${A+1}:${Ue(u)}${k+1}`;e.setCellValue(u,k+1,`=COUNT(${M})`)}else{const M=`${Ue(u)}${A+1}:${Ue(u)}${k}`;e.setCellValue(u,k,`=COUNT(${M})`)}(he=e.scheduleRender)==null||he.call(e),(K=e.emitModelData)==null||K.call(e)}const q=t.ref(!1);function be(p){q.value=p,p&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1,S.value=!1)}function oe(){He(),q.value=!1}function s(){we(),q.value=!1}function m(){re(),q.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:h,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:c,cellBorderWidth:y,mergeMenuOpen:S,onMergeMenuToggle:x,removeOverlappingMerges:C,mergeAndCenter:b,mergeAcross:R,mergeCells:Z,unmergeCells:Q,onApplyMerge:g,onMergeChange:F,copySourceRange:null,copySourceStyles:[],captureStyles:ne,setCellWithStyle:se,copyToClipboard:ue,copyRowCol:pe,pasteFromClipboard:Ne,cutSelected:Ae,clearSelected:Pe,sumSelected:He,avgSelected:we,countSelected:re,calcMenuOpen:q,onCalcMenuToggle:be,onCalcSum:oe,onCalcAvg:s,onCalcCount:m}}function ii(e,n,o,l){const a={},i=l(n),r=l(o);return i!=null&&(a.width=`${i}px`),r!=null&&(a.height=`${r}px`),a["--sp-formula-bar-bg"]=e.formulaBarBg,a["--sp-formula-bar-border"]=e.formulaBarBorder,a["--sp-formula-bar-label-color"]=e.formulaBarLabelText,a["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,a["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,a["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,a["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,a["--sp-formula-bar-input-color"]=e.formulaBarInputText,a["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,a["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,a["--sp-wrapper-bg"]=e.wrapperBg,a["--sp-cell-editor-border"]=e.cellEditorBorder,a["--sp-cell-editor-color"]=e.cellEditorText,a["--sp-cell-editor-bg"]=e.cellEditorBg,a["--sp-cell-editor-shadow"]=e.cellEditorShadow,a["--sp-tab-bar-bg"]=e.tabBarBg,a["--sp-tab-bar-border"]=e.tabBarBorder,a["--sp-tab-active-bg"]=e.tabActiveBg,a["--sp-tab-active-color"]=e.tabActiveText,a["--sp-tab-active-border"]=e.tabActiveBorder,a["--sp-tab-inactive-bg"]=e.tabInactiveBg,a["--sp-tab-inactive-color"]=e.tabInactiveText,a["--sp-tab-inactive-border"]=e.tabInactiveBorder,a["--sp-tab-hover-bg"]=e.tabHoverBg,a["--sp-tab-add-btn-color"]=e.tabAddBtnColor,a["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,a["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,a["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,a["--sp-scroll-thumb"]=e.scrollbarThumb,a["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,a["--sp-scroll-btn-bg"]=e.scrollBtnBg,a["--sp-scroll-btn-color"]=e.scrollBtnColor,a["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,a["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,a["--sp-scroll-track-bg"]=e.scrollTrackBg,a["--sp-toolbar-bg"]=e.toolbarBg,a["--sp-toolbar-border"]=e.toolbarBorder,a["--sp-toolbar-btn-color"]=e.toolbarBtnColor,a["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,a["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,a["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,a}function ci(e,n,o,l,a){function i(O,D){const j=D-O+1,ke=S(O,D);for(let _=O;_<=D;_++)for(let J=0;J<e.colCount;J++)e.delCell(e.cellKey(J,_));for(let _=O;_<e.rowCount-j;_++){for(let J=0;J<e.colCount;J++){const Be=e.cellKey(J,_+j),ge=e.cellKey(J,_);e.cells[Be]?(e.cells[ge]=e.cells[Be],e.delCell(Be)):e.delCell(ge)}e.rowHeights.value[_]=e.rowHeights.value[_+j]}for(let _=e.rowCount-j;_<e.rowCount;_++){for(let J=0;J<e.colCount;J++)e.delCell(e.cellKey(J,_));e.rowHeights.value[_]=void 0}y(ke)}function r(O,D){const j=D-O+1;if(D>=e.rowCount-1)return;const ke=C(O,D);for(let _=e.rowCount-1;_>D;_--){for(let J=0;J<e.colCount;J++){const Be=e.cellKey(J,_-j),ge=e.cellKey(J,_);e.cells[Be]?e.cells[ge]=e.cells[Be]:e.delCell(ge)}e.rowHeights.value[_]=e.rowHeights.value[_-j]}for(let _=D+1;_<=D+j;_++){for(let J=0;J<e.colCount;J++)e.delCell(e.cellKey(J,_));e.rowHeights.value[_]=void 0}y(ke)}function h(O,D){const j=D-O+1;if(D>=e.colCount-1)return;const ke=b(O,D);for(let _=e.colCount-1;_>D;_--){for(let J=0;J<e.rowCount;J++){const Be=e.cellKey(_-j,J),ge=e.cellKey(_,J);e.cells[Be]?e.cells[ge]=e.cells[Be]:e.delCell(ge)}e.colWidths.value[_]=e.colWidths.value[_-j]}for(let _=D+1;_<=D+j;_++){for(let J=0;J<e.rowCount;J++)e.delCell(e.cellKey(_,J));e.colWidths.value[_]=100}y(ke)}function c(O,D){const j=D-O+1,ke=x(O,D);for(let _=O;_<=D;_++)for(let J=0;J<e.rowCount;J++)e.delCell(e.cellKey(_,J));for(let _=O;_<e.colCount-j;_++){for(let J=0;J<e.rowCount;J++){const Be=e.cellKey(_+j,J),ge=e.cellKey(_,J);e.cells[Be]?(e.cells[ge]=e.cells[Be],e.delCell(Be)):e.delCell(ge)}e.colWidths.value[_]=e.colWidths.value[_+j]}for(let _=e.colCount-j;_<e.colCount;_++){for(let J=0;J<e.rowCount;J++)e.delCell(e.cellKey(_,J));e.colWidths.value[_]=100}y(ke)}function y(O){Object.keys(e.merges).forEach(D=>Reflect.deleteProperty(e.merges,D));for(const D of O)if(!(D.newRange.startCol>D.newRange.endCol||D.newRange.startRow>D.newRange.endRow)&&(e.merges[D.newAnchorKey]={...D.newRange},D.anchorCell)){const j=D.anchorCell.value,ke=D.anchorCell.styleId;j===""&&!ke||(e.cells[D.newAnchorKey]={value:j,styleId:ke||void 0})}}function S(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;const Be=e.cells[_]?{value:e.cells[_].value,styleId:e.cells[_].styleId??0}:{value:"",styleId:0},{startCol:ge,endCol:Me}=J;let{startRow:Ve,endRow:Ye}=J;if(Ve>D){Ve-=j,Ye-=j,ke.push({newAnchorKey:e.cellKey(ge,Ve),newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(Ye<O){ke.push({newAnchorKey:_,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(Ve>=O&&Ye<=D||(Ve>=O&&Ve<=D&&(Ve=O),Ye>=O&&Ye<=D?Ye=O-1:Ye>D&&(Ye-=j),Ve>Ye))continue;const Qe=ge,ct=Ve,mt=e.cellKey(Qe,ct),st=_.split(",").map(Number)[1],ft=st>=O&&st<=D||Qe!==J.startCol||ct!==st;ke.push({newAnchorKey:mt,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye},anchorCell:ft?Be:void 0})}return ke}function x(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;const Be=e.cells[_]?{value:e.cells[_].value,styleId:e.cells[_].styleId??0}:{value:"",styleId:0};let{startCol:ge,endCol:Me}=J;const{startRow:Ve,endRow:Ye}=J;if(ge>D){ge-=j,Me-=j,ke.push({newAnchorKey:e.cellKey(ge,Ve),newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(Me<O){ke.push({newAnchorKey:_,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye}});continue}if(ge>=O&&Me<=D||(ge>=O&&ge<=D&&(ge=O),Me>=O&&Me<=D?Me=O-1:Me>D&&(Me-=j),ge>Me))continue;const Qe=ge,ct=Ve,mt=e.cellKey(Qe,ct),st=_.split(",").map(Number)[0],ft=st>=O&&st<=D||Qe!==st||ct!==J.startRow;ke.push({newAnchorKey:mt,newRange:{startCol:ge,startRow:Ve,endCol:Me,endRow:Ye},anchorCell:ft?Be:void 0})}return ke}function C(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;const{startCol:Be,endCol:ge}=J;let{startRow:Me,endRow:Ve}=J;Ve<O?ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}):Me>D?(Me+=j,Ve+=j,ke.push({newAnchorKey:e.cellKey(Be,Me),newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}})):(Ve+=j,ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}))}return ke}function b(O,D){const j=D-O+1,ke=[];for(const _ in e.merges){const J=e.merges[_];if(!J)continue;let{startCol:Be,endCol:ge}=J;const{startRow:Me,endRow:Ve}=J;ge<O?ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}):Be>D?(Be+=j,ge+=j,ke.push({newAnchorKey:e.cellKey(Be,Me),newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}})):(ge+=j,ke.push({newAnchorKey:_,newRange:{startCol:Be,startRow:Me,endCol:ge,endRow:Ve}}))}return ke}let R=0;function Z(){return R++,`s_${R}`}function Q(O){return{id:Z(),name:O,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(e.colCount).fill(100),rowHeights:new Array(e.rowCount).fill(void 0)}}const g=t.ref([Q("Sheet1")]),F=t.ref(0);function X(){const O=g.value[F.value];O&&(O.cells={...e.cells},O.merges={...e.merges},O.selection=e.selection.value?{...e.selection.value}:null,O.activeCell={...e.activeCell.value},O.scrollX=e.scrollX.value,O.scrollY=e.scrollY.value,O.colWidths=[...e.colWidths.value],O.rowHeights=[...e.rowHeights.value],O.styles=[...e.styles],O.borders=[...e.borders])}function me(O){const D=g.value[O];D&&(Object.keys(e.cells).forEach(j=>e.delCell(j)),Object.assign(e.cells,D.cells),Object.keys(e.merges).forEach(j=>Reflect.deleteProperty(e.merges,j)),D.merges&&Object.assign(e.merges,D.merges),e.selection.value=D.selection?{...D.selection}:null,e.activeCell.value={...D.activeCell},e.scrollX.value=D.scrollX,e.scrollY.value=D.scrollY,e.colWidths.value=[...D.colWidths],e.rowHeights.value=[...D.rowHeights],e.syncStyles(D.styles),e.syncBorders(D.borders??[{}]),F.value=O)}function ne(O){O===F.value||O<0||O>=g.value.length||(e.cancelEdit(),X(),me(O))}function se(O){return n.saveUndo(),e.cancelEdit(),X(),g.value.push(Q(O??`Sheet${g.value.length+1}`)),me(g.value.length-1),g.value.length-1}function ue(O){return g.value.length<=1||(n.saveUndo(),e.cancelEdit(),g.value.splice(O,1),me(Math.min(O,g.value.length-1))),F.value}function pe(O,D){g.value[O]&&D.trim()&&(n.saveUndo(),g.value[O].name=D.trim())}function Ne(O){n.saveUndo(),e.cancelEdit(),X();const D=g.value[O];if(!D)return O;let j=D.name;const ke=j.match(/^(.*?)\s*\((\d+)\)$/);let _=ke?parseInt(ke[2],10)+1:2;ke&&(j=ke[1]);let J=`${j} (${_})`;const Be=new Set(g.value.map(Me=>Me.name));for(;Be.has(J);)_++,J=`${j} (${_})`;const ge={id:Z(),name:J,cells:{...D.cells},merges:D.merges?{...D.merges}:{},styles:[...D.styles],borders:D.borders?[...D.borders]:[{}],selection:D.selection?{...D.selection}:null,activeCell:D.activeCell?{...D.activeCell}:{col:0,row:0},scrollX:D.scrollX,scrollY:D.scrollY,colWidths:[...D.colWidths],rowHeights:[...D.rowHeights]};return g.value.splice(O+1,0,ge),me(O+1),O+1}function Ae(O,D){var J;const j=O+D;if(j<0||j>=g.value.length)return;n.saveUndo();const ke=F.value,_=g.value.splice(O,1)[0];g.value.splice(j,0,_),ke===O?F.value=j:O<ke&&j>=ke?F.value=ke-1:O>ke&&j<=ke&&(F.value=ke+1),(J=e.scheduleRender)==null||J.call(e)}const Pe=t.computed(()=>g.value.length);let He="";const we=o;function re(){X();const O=g.value.map(j=>{const ke={};for(const[ge,Me]of Object.entries(j.cells))ke[ge]={value:Me.value},Me.styleId&&Me.styleId>0&&(ke[ge].styleId=Me.styleId);const _={name:j.name,cells:ke};j.styles&&j.styles.length>1&&(_.styles=[...j.styles]),j.borders&&j.borders.length>1&&(_.borders=[...j.borders]),j.merges&&Object.keys(j.merges).length&&(_.merges={...j.merges});const J={};for(let ge=0;ge<j.colWidths.length;ge++)j.colWidths[ge]!==100&&(J[ge]=j.colWidths[ge]);Object.keys(J).length&&(_.colWidths=J);const Be={};for(let ge=0;ge<j.rowHeights.length;ge++){const Me=j.rowHeights[ge];Me!=null&&(Be[ge]=Me)}return Object.keys(Be).length&&(_.rowHeights=Be),_}),D=JSON.stringify(O);D!==He&&(He=D,we.value=O,a&&(a.value=D))}e.emitModelData=re;let q=!1;function be(){q||(q=!0,Promise.resolve().then(()=>{q=!1,re()}))}const oe=t.computed(()=>e.props.theme==="dark"?Nn:Tn),s=t.computed(()=>ii(oe.value,e.props.width,e.props.height,Gt)),m=t.computed(()=>{const O={};for(const[D,j]of Object.entries(s.value))D.startsWith("--")&&(O[D]=j);return O}),p=t.ref(null),N=t.ref(null),A=t.ref(null),W=t.ref(null),k=t.reactive({w:800,h:600});e.viewSize&&t.watch(k,O=>{e.viewSize&&(e.viewSize.w=O.w,e.viewSize.h=O.h)},{deep:!0});const he=48,K=28,u=11,M=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,k.w-he-u))),le=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,k.h-K-u)));function ie(O,D){const j=Math.max(0,k.w-he-u),ke=Math.max(0,k.h-K-u);e.scrollX.value=Math.max(0,Math.min(O??e.scrollX.value,Math.max(0,e.totalWidth.value-j))),e.scrollY.value=Math.max(0,Math.min(D??e.scrollY.value,Math.max(0,e.totalHeight.value-ke)))}e.clampScroll=ie;function P(){var O;return typeof window>"u"?!1:!((O=window.matchMedia)!=null&&O.call(window,"(hover: none) and (pointer: coarse)").matches)}function xe(O=!1){t.nextTick(()=>{const D=A.value;if(D){if(!e.editingCell.value&&!P()){document.activeElement===D&&D.blur();return}D.focus({preventScroll:!0}),O&&D.select()}})}function $e(){xe()}function Ze(){var D;const O=e.selection.value;if(O){n.saveUndo();for(let j=O.startRow;j<=O.endRow;j++)e.rowHeights.value[j]=void 0;(D=e.scheduleRender)==null||D.call(e),re()}}function at(){var D;const O=e.selection.value;if(O){n.saveUndo();for(let j=O.startCol;j<=O.endCol;j++)e.colWidths.value[j]=100;(D=e.scheduleRender)==null||D.call(e),re()}}return{deleteRows:i,insertRows:r,insertCols:h,deleteCols:c,sheets:g,activeSheetIndex:F,saveSheet:X,loadSheet:me,switchSheet:ne,addSheet:se,removeSheet:ue,renameSheet:pe,dupSheet:Ne,moveSheet:Ae,sheetCount:Pe,mkSheet:Q,emitModelData:re,scheduleOptEmit:be,themeColors:oe,outerStyle:s,toolbarThemeVars:m,wrapperRef:p,canvasRef:N,editInputRef:A,formulaBarRef:W,viewSize:k,maxScrollX:M,maxScrollY:le,clampScroll:ie,canFocusHiddenEditor:P,focusEditInput:xe,onCanvasFocus:$e,resetRowHeight:Ze,resetColWidth:at,modelData:we}}function dn(e){return!!e&&e.width!==void 0&&e.width>0}function nt(e,n,o,l){const a=dn(e),i=dn(n);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return n;const r=e.width??0,h=n.width??0;return r>h?e:h>r?n:e}function si(e,n,o,l,a){let i=!1,r=null,h=1;function c(){i||(i=!0,requestAnimationFrame(()=>{i=!1,S()}))}e.scheduleRender=c;const y="#444";function S(){const d=l.canvasRef.value;if(!d)return;const v=l.wrapperRef.value;if(!v||(r=d.getContext("2d"),!r))return;h=window.devicePixelRatio||1;const U=v.getBoundingClientRect(),G=U.width,w=U.height;l.viewSize.w=G,l.viewSize.h=w,d.width=G*h,d.height=w*h,d.style.width=G+"px",d.style.height=w+"px",r.setTransform(h,0,0,h,0,0);const Y=e.scrollX.value,Ee=e.scrollY.value,Se=52,ve=24,Te=l.themeColors.value,Xe=e.colPositions.value,tt=e.rowPositions.value,wt=e.colWidths.value,yt=[];for(let ce=0;ce<e.rowCount;ce++)yt[ce]=tt[ce+1]-tt[ce];const Ht=Math.max(0,e.hitCol(Y));let ll=Ht;for(let ce=Ht;ce<e.colCount&&!(Se+Xe[ce]-Y>=G);ce++)ll=ce;const Kt=ll,Dt=Math.max(0,e.hitRow(Ee));let hl=Dt;for(let ce=Dt;ce<e.rowCount&&!(ve+tt[ce]-Ee>=w);ce++)hl=ce;const Tt=hl;let nl=Ht,ol=Dt;for(const ce in e.merges){const Ce=e.merges[ce];Ce&&(Ce.startRow>Tt||Ce.endRow<Dt||Ce.startCol>Kt||Ce.endCol<Ht||(Ce.startCol<nl&&(nl=Ce.startCol),Ce.startRow<ol&&(ol=Ce.startRow)))}r.fillStyle=Te.bg,r.fillRect(0,0,G,w),r.fillStyle=Te.gridBg,r.fillRect(Se,ve,G-Se,w-ve),r.save(),r.beginPath(),r.rect(Se,ve,G-Se,w-ve),r.clip();const ut=e.selection.value,fl=e.editingCell.value;for(let ce=ol;ce<=Tt;ce++)for(let Ce=nl;Ce<=Kt;Ce++){const Ie=e.findMerge(Ce,ce);if(Ie&&!(Ce===Ie.range.startCol&&ce===Ie.range.startRow))continue;const Fe=Se+Xe[Ce]-Y,_e=ve+tt[ce]-Ee;let je=wt[Ce],Je=yt[ce];if(Ie&&(je=Xe[Ie.range.endCol+1]-Xe[Ce],Je=tt[Ie.range.endRow+1]-tt[ce]),Fe+je<Se||_e+Je<ve||Fe>G||_e>w)continue;const Ut=e.findHighlight?e.findHighlight(Ce,ce):null,Ke=e.resolveStyle(e.cells[e.cellKey(Ce,ce)]),Ge=typeof(Ke==null?void 0:Ke.backgroundColor)=="string"?Ke.backgroundColor:"";if(Ge&&(r.fillStyle=Ge,r.fillRect(Fe,_e,je,Je)),Ut&&(r.fillStyle=Ut==="active"?Te.findActiveBg:Te.findMatchBg,r.fillRect(Fe,_e,je,Je)),e.isSelected(Ce,ce)&&(r.fillStyle=Te.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(Fe,_e,wt[Ce],yt[ce]):r.fillRect(Fe,_e,je,Je)),e.activeCell.value.col===Ce&&e.activeCell.value.row===ce&&(r.strokeStyle=Te.activeCellBorder,r.lineWidth=2,r.strokeRect(Fe+1,_e+1,je-2,Je-2)),Ut==="active"&&(r.strokeStyle=Te.findActiveBg,r.lineWidth=2,r.strokeRect(Fe+1,_e+1,je-2,Je-2)),r.strokeStyle=Te.gridLine,r.lineWidth=.5,r.strokeRect(Fe+.25,_e+.25,je-.5,Je-.5),!(fl&&fl.col===Ce&&fl.row===ce)){const ye=e.resolveStyle(e.cells[e.cellKey(Ce,ce)]),Oe=e.getCellValue(Ce,ce),Le=typeof(ye==null?void 0:ye.numberFormat)=="string"?ye.numberFormat:"",ae=Oe?Bl(Oe,Le,e.locale.value):"";if(ae){const De=e.cellFontSize(Ce,ce),Re=typeof(ye==null?void 0:ye.fontFamily)=="string"&&ye.fontFamily?ye.fontFamily:al,ze=(ye==null?void 0:ye.fontWeight)==="bold"?"bold":"normal",Nt=(ye==null?void 0:ye.fontStyle)==="italic"?"italic":"normal",Li=(ye==null?void 0:ye.underline)==="underline",$i=(ye==null?void 0:ye.strikethrough)==="line-through",Wl=typeof(ye==null?void 0:ye.color)=="string"?ye.color:"",pn=typeof(ye==null?void 0:ye.textAlign)=="string"?ye.textAlign:Zl(Oe,Le)?"right":"left",hn=typeof(ye==null?void 0:ye.verticalAlign)=="string"?ye.verticalAlign:"top";r.fillStyle=Wl||Te.cellText,r.font=`${Nt} ${ze} ${De}px ${Re}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(Fe+5,_e+1,je-10,Je-2),r.clip();const gn=(ye==null?void 0:ye.wrap)==="wrap",gl=je-10;let _l=ae;const zi=!gn&&Yn(Le),yn=ae===kl||Xn(Oe,Le);if(yn||zi){if(yn){const Zt=Math.max(1,r.measureText("#").width),ml=Math.max(1,Math.floor(gl/Zt));_l="#".repeat(ml)}else if(e.getWrappedLines(r,ae,1e9,!1).some(Ot=>Ot&&r.measureText(Ot).width>gl)){const Ot=Math.max(1,r.measureText("#").width),rl=Math.max(1,Math.floor(gl/Ot));_l="#".repeat(rl)}}const yl=e.getWrappedLines(r,_l,gl,gn),{ascent:bl,descent:vl}=e.measureFontMetrics(Re,De,ze,Nt),Cl=bl+vl,Wi=yl.length*Cl;let wl;hn==="middle"?wl=_e+(Je-Wi)/2+bl:hn==="bottom"?wl=_e+Je-e.BASE_CELL_VPAD-vl-(yl.length-1)*Cl:wl=_e+e.BASE_CELL_VPAD+bl;for(let Zt=0;Zt<yl.length;Zt++){const ml=yl[Zt],Ot=wl+Zt*Cl,rl=r.measureText(ml);let Pt;if(pn==="center"?Pt=Fe+je/2-rl.width/2:pn==="right"?Pt=Fe+je-5-rl.width:Pt=Fe+5,r.fillText(ml,Pt,Ot),Li&&(r.strokeStyle=Wl||Te.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(Pt,Ot+vl+1),r.lineTo(Pt+rl.width,Ot+vl+1),r.stroke()),$i){r.strokeStyle=Wl||Te.cellText,r.lineWidth=1;const bn=Ot-bl+Cl*.42;r.beginPath(),r.moveTo(Pt,bn),r.lineTo(Pt+rl.width,bn),r.stroke()}}r.restore()}}}const lt=(ce,Ce,Ie)=>{const Fe=e.findMerge(ce,Ce);return Fe?e.getCellBorderSide(e.cells[Fe.anchor],Ie):e.getCellBorderSide(e.cells[e.cellKey(ce,Ce)],Ie)};r.fillStyle=y;for(let ce=ol;ce<=Tt;ce++)for(let Ce=nl;Ce<=Kt;Ce++){const Ie=e.findMerge(Ce,ce);if(Ie&&!(Ce===Ie.range.startCol&&ce===Ie.range.startRow))continue;const Fe=Se+Xe[Ce]-Y,_e=ve+tt[ce]-Ee;let je=wt[Ce],Je=yt[ce];if(Ie&&(je=Xe[Ie.range.endCol+1]-Xe[Ce],Je=tt[Ie.range.endRow+1]-tt[ce]),Fe+je<Se||_e+Je<ve||Fe>G||_e>w)continue;const Ut=e.cells[e.cellKey(Ce,ce)],Ke={top:e.getCellBorderSide(Ut,"top"),right:e.getCellBorderSide(Ut,"right"),bottom:e.getCellBorderSide(Ut,"bottom"),left:e.getCellBorderSide(Ut,"left")};if(Ie){const Ge=Ie.range.startRow,ye=Ie.range.endRow,Oe=Ie.range.startCol,Le=Ie.range.endCol;for(let ae=Oe;ae<=Le;ae++){if(e.isSameMergeInternal(ae,Ge-1,ae,Ge))continue;const De=lt(ae,Ge-1,"bottom"),Re=nt(De,Ke.top);if(Re&&Re.width&&Re.width>0){const ze=Se+Xe[ae]-Y;r.fillStyle=Re.color||y,r.fillRect(ze,_e,wt[ae],Re.width)}}for(let ae=Oe;ae<=Le;ae++){if(e.isSameMergeInternal(ae,ye,ae,ye+1))continue;const De=lt(ae,ye+1,"top"),Re=nt(Ke.bottom,De);if(Re&&Re.width&&Re.width>0){const ze=Se+Xe[ae]-Y;r.fillStyle=Re.color||y,r.fillRect(ze,_e+Je-Re.width,wt[ae],Re.width)}}for(let ae=Ge;ae<=ye;ae++){if(e.isSameMergeInternal(Oe-1,ae,Oe,ae))continue;const De=lt(Oe-1,ae,"right"),Re=nt(De,Ke.left);if(Re&&Re.width&&Re.width>0){const ze=ve+tt[ae]-Ee;r.fillStyle=Re.color||y,r.fillRect(Fe,ze,Re.width,yt[ae])}}for(let ae=Ge;ae<=ye;ae++){if(e.isSameMergeInternal(Le,ae,Le+1,ae))continue;const De=lt(Le+1,ae,"left"),Re=nt(Ke.right,De);if(Re&&Re.width&&Re.width>0){const ze=ve+tt[ae]-Ee;r.fillStyle=Re.color||y,r.fillRect(Fe+je-Re.width,ze,Re.width,yt[ae])}}{const ae=e.isSameMergeInternal(Oe,Ge-1,Oe,Ge)?Ke.top:nt(lt(Oe,Ge-1,"bottom"),Ke.top),De=e.isSameMergeInternal(Oe-1,Ge,Oe,Ge)?Ke.left:nt(lt(Oe-1,Ge,"right"),Ke.left),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe-ze,_e-Re,ze,Re))}{const ae=e.isSameMergeInternal(Le,Ge-1,Le,Ge)?Ke.top:nt(lt(Le,Ge-1,"bottom"),Ke.top),De=e.isSameMergeInternal(Le,Ge,Le+1,Ge)?Ke.right:nt(Ke.right,lt(Le+1,Ge,"left")),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe+je,_e-Re,ze,Re))}{const ae=e.isSameMergeInternal(Oe,ye,Oe,ye+1)?Ke.bottom:nt(Ke.bottom,lt(Oe,ye+1,"top")),De=e.isSameMergeInternal(Oe-1,ye,Oe,ye)?Ke.left:nt(lt(Oe-1,ye,"right"),Ke.left),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe-ze,_e+Je,ze,Re))}{const ae=e.isSameMergeInternal(Le,ye,Le,ye+1)?Ke.bottom:nt(Ke.bottom,lt(Le,ye+1,"top")),De=e.isSameMergeInternal(Le,ye,Le+1,ye)?Ke.right:nt(Ke.right,lt(Le+1,ye,"left")),Re=(ae==null?void 0:ae.width)??0,ze=(De==null?void 0:De.width)??0;Re>0&&ze>0&&(r.fillStyle=(ae==null?void 0:ae.color)||(De==null?void 0:De.color)||y,r.fillRect(Fe+je,_e+Je,ze,Re))}}else{const Ge={top:lt(Ce,ce-1,"bottom"),left:lt(Ce-1,ce,"right"),bottom:lt(Ce,ce+1,"top"),right:lt(Ce+1,ce,"left")},ye=nt(Ge.top,Ke.top),Oe=nt(Ge.left,Ke.left),Le=nt(Ke.bottom,Ge.bottom),ae=nt(Ke.right,Ge.right),De=(ye==null?void 0:ye.width)??0,Re=(Oe==null?void 0:Oe.width)??0,ze=(Le==null?void 0:Le.width)??0,Nt=(ae==null?void 0:ae.width)??0;De>0&&(r.fillStyle=(ye==null?void 0:ye.color)||y,r.fillRect(Fe,_e,je,De)),ze>0&&(r.fillStyle=(Le==null?void 0:Le.color)||y,r.fillRect(Fe,_e+Je-ze,je,ze)),Re>0&&(r.fillStyle=(Oe==null?void 0:Oe.color)||y,r.fillRect(Fe,_e,Re,Je)),Nt>0&&(r.fillStyle=(ae==null?void 0:ae.color)||y,r.fillRect(Fe+je-Nt,_e,Nt,Je)),De>0&&Re>0&&(r.fillStyle=(ye==null?void 0:ye.color)||(Oe==null?void 0:Oe.color)||y,r.fillRect(Fe-Re,_e-De,Re,De)),De>0&&Nt>0&&(r.fillStyle=(ye==null?void 0:ye.color)||(ae==null?void 0:ae.color)||y,r.fillRect(Fe+je,_e-De,Nt,De)),ze>0&&Re>0&&(r.fillStyle=(Le==null?void 0:Le.color)||(Oe==null?void 0:Oe.color)||y,r.fillRect(Fe-Re,_e+Je,Re,ze)),ze>0&&Nt>0&&(r.fillStyle=(Le==null?void 0:Le.color)||(ae==null?void 0:ae.color)||y,r.fillRect(Fe+je,_e+Je,Nt,ze))}}r.restore(),r.fillStyle=Te.headerBg,r.fillRect(Se,0,G-Se,ve);for(let ce=Ht;ce<=Kt;ce++){const Ce=Se+Xe[ce]-Y,Ie=wt[ce];Ce+Ie<Se||Ce>G||(ut&&ce>=ut.startCol&&ce<=ut.endCol&&(r.fillStyle=Te.selectionBg,r.fillRect(Ce,0,Ie,ve)),r.strokeStyle=Te.headerBorder,r.lineWidth=.5,r.strokeRect(Ce+.25,.25,Ie-.5,ve-.5),ut&&ce>=ut.startCol&&ce<=ut.endCol&&(r.strokeStyle=Te.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ce,ve-1),r.lineTo(Ce+Ie,ve-1),r.stroke()),r.fillStyle=Te.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Ue(ce),Ce+Ie/2,ve/2))}r.strokeStyle=Te.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Se,ve+.5),r.lineTo(G,ve+.5),r.stroke(),r.fillStyle=Te.headerBg,r.fillRect(0,ve,Se,w-ve);for(let ce=Dt;ce<=Tt;ce++){const Ce=ve+tt[ce]-Ee,Ie=yt[ce];Ce+Ie<ve||Ce>w||(ut&&ce>=ut.startRow&&ce<=ut.endRow&&(r.fillStyle=Te.selectionBg,r.fillRect(0,Ce,Se,Ie)),r.strokeStyle=Te.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ce+.25,Se-.5,Ie-.5),ut&&ce>=ut.startRow&&ce<=ut.endRow&&(r.strokeStyle=Te.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Se-1,Ce),r.lineTo(Se-1,Ce+Ie),r.stroke()),r.fillStyle=Te.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(ce+1),Se/2,Ce+Ie/2+.5))}r.strokeStyle=Te.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Se+.5,ve),r.lineTo(Se+.5,w),r.stroke(),r.fillStyle=Te.headerBg,r.fillRect(0,0,Se,ve),r.strokeStyle=Te.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,Se-.5,ve-.5)}const x=t.computed(()=>Ue(e.activeCell.value.col)+String(e.activeCell.value.row+1)),C=t.ref(""),b=t.ref(!1),R=t.computed(()=>e.editingCell.value?C.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(d,v)=>{if(d&&!v){const U=e.editValue.value||e.getCellRaw(d.col,d.row)||"";C.value=U,F=!1}else!d&&v&&(C.value="",b.value=!1,F=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(C.value="",F=!1)});function Z(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),c())}function Q(d){const v=d.target.value;C.value=v,F=!0,e.editingCell.value||e.startEdit()}let g=!1,F=!1;function X(){var Y,Ee,Se,ve,Te,Xe,tt,wt,yt;if(g)return;const d=l.formulaBarRef.value,v=!!(d&&typeof document<"u"&&document.activeElement===d);if(!e.editingCell.value&&!v&&!F)return;const U={...e.activeCell.value},G=e.editingCell.value?e.editingCell.value.col:U.col,w=e.editingCell.value?e.editingCell.value.row:U.row;if(!e.editingCell.value){const Ht=e.getCellRaw(G,w),ll=C.value!==Ht;if(!F)return;g=!0,ll&&((Y=e.saveUndo)==null||Y.call(e),e.setCellValue(G,w,C.value),c(),(Ee=l.emitModelData)==null||Ee.call(l)),(Se=l.formulaBarRef.value)==null||Se.blur(),C.value="",b.value=!1,F=!1,t.nextTick(()=>{g=!1});return}g=!0,F?(e.editValue.value=C.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ve=l.formulaBarRef.value)==null||ve.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),(Te=l.emitModelData)==null||Te.call(l),t.nextTick(()=>{g=!1})):v?(C.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(Xe=l.formulaBarRef.value)==null||Xe.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),(tt=l.emitModelData)==null||tt.call(l),t.nextTick(()=>{g=!1})):(e.commitEdit(),(wt=l.formulaBarRef.value)==null||wt.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),(yt=l.emitModelData)==null||yt.call(l),t.nextTick(()=>{g=!1}))}function me(){var d;g||(g=!0,e.editingCell.value&&e.cancelEdit(),(d=l.formulaBarRef.value)==null||d.blur(),C.value="",b.value=!1,F=!1,c(),l.focusEditInput(),t.nextTick(()=>{g=!1}))}function ne(d){if(!d.isComposing){if(d.key==="Enter"&&(d.altKey||d.metaKey)&&!d.ctrlKey){d.preventDefault(),d.stopPropagation();const v=d.target;if(!v)return;e.editingCell.value||e.startEdit();const U=v.selectionStart??v.value.length,G=v.selectionEnd??v.value.length,w=v.value,Y=w.substring(0,U)+`
7
+ `+w.substring(G),Ee=U+1;C.value=Y,b.value||(b.value=!0),t.nextTick(()=>{try{v.setSelectionRange(Ee,Ee)}catch{}if(b.value)try{v.scrollTop=v.scrollHeight}catch{}try{v.focus({preventScroll:!0})}catch{}});return}d.key==="Enter"?(d.preventDefault(),X()):d.key==="Escape"&&(d.preventDefault(),me())}}function se(){X()}const ue=t.ref(null),pe=t.ref("");function Ne(d){ue.value===null&&(l.switchSheet(d),c())}function Ae(d){d!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(d),c()),ue.value=d,pe.value=l.sheets.value[d].name,t.nextTick(()=>{const v=document.querySelector(".tab-rename-input");v==null||v.focus(),v==null||v.select()})}function Pe(){ue.value!==null&&(l.renameSheet(ue.value,pe.value),t.nextTick(()=>l.emitModelData())),ue.value=null,pe.value=""}function He(){ue.value=null,pe.value=""}function we(d){d.key==="Enter"?(d.preventDefault(),Pe()):d.key==="Escape"&&(d.preventDefault(),He())}const re=t.ref(null);let q=null;function be(){q&&(document.removeEventListener("click",q),q=null)}function oe(d,v,U){be();const G=140,w=U.length*28+8,Y=window.innerWidth,Ee=window.innerHeight;d+G>Y&&(d-=G),v+w>Ee&&(v-=w),re.value={x:d,y:v,items:U},q=()=>{re.value=null,be()},setTimeout(()=>document.addEventListener("click",q,{once:!0}),0)}const s=t.ref(!1);function m(d,v){if(!v.children){s.value=!1;return}const G=d.currentTarget.querySelector(".context-submenu");if(!G){s.value=!1;return}const w=G.getBoundingClientRect();s.value=w.right>window.innerWidth}function p(d,v){d.preventDefault(),d.stopPropagation(),oe(d.clientX,d.clientY,[{label:T(e.locale.value,"insert"),action:()=>{l.addSheet(),c()}},{label:T(e.locale.value,"copy"),action:()=>{l.dupSheet(v)}},{label:T(e.locale.value,"rename"),action:()=>{Ae(v)}},{label:T(e.locale.value,"delete"),action:()=>{l.removeSheet(v),c()},disabled:l.sheetCount.value<=1},{label:T(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(v,-1)},disabled:v===0},{label:T(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(v,1)},disabled:v===l.sheets.value.length-1}])}function N(d){d.preventDefault(),!(d.target.closest(".tab-item")||d.target.closest(".tab-bar__add-btn"))&&oe(d.clientX,d.clientY,[{label:T(e.locale.value,"insert"),action:()=>{l.addSheet(),c()}}])}function A(d){d.preventDefault(),e.selectAll(),c(),oe(d.clientX,d.clientY,[{label:T(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:T(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected();for(let v=0;v<e.colCount;v++)e.colWidths.value[v]=100;for(let v=0;v<e.rowCount;v++)e.rowHeights.value[v]=void 0;c(),l.emitModelData()}}])}function W(d,v){d.preventDefault();const U=d.clientX,G=d.clientY,w=e.selection.value;w&&w.startCol===0&&w.endCol===e.colCount-1&&v>=w.startRow&&v<=w.endRow||(e.selectRange(0,v,e.colCount-1,v,"row"),c());const Y=e.selection.value;oe(d.clientX,d.clientY,[{label:T(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertRows(Y.startRow,Y.endRow),c(),l.emitModelData()},disabled:Y.endRow>=e.rowCount-1},{label:T(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,Y.startRow,Y.endRow),c(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:T(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteRows(Y.startRow,Y.endRow),c(),l.emitModelData()}},{label:`${T(e.locale.value,"rowHeight")}...`,action:()=>ie("row",U,G)},{label:T(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()}])}function k(d,v){d.preventDefault();const U=d.clientX,G=d.clientY,w=e.selection.value;w&&w.startRow===0&&w.endRow===e.rowCount-1&&v>=w.startCol&&v<=w.endCol||(e.selectRange(v,0,v,e.rowCount-1,"col"),c());const Y=e.selection.value;oe(d.clientX,d.clientY,[{label:T(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertCols(Y.startCol,Y.endCol),c(),l.emitModelData()},disabled:Y.endCol>=e.colCount-1},{label:T(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(Y.startCol,Y.endCol,0,e.rowCount-1),c(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:T(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteCols(Y.startCol,Y.endCol),c(),l.emitModelData()}},{label:`${T(e.locale.value,"colWidth")}...`,action:()=>ie("col",U,G)},{label:T(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()}])}function he(d,v,U){d.preventDefault(),e.isSelected(v,U)||(e.selectCell(v,U),c());const G=e.selection.value,w=!!(G&&G.startCol===G.endCol&&G.startRow===G.endRow);oe(d.clientX,d.clientY,[{label:T(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:T(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:T(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())})}},{label:T(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected(),c(),l.emitModelData()}},{label:T(e.locale.value,"calculate"),children:[{label:T(e.locale.value,"sum"),action:o.sumSelected,disabled:w},{label:T(e.locale.value,"avg"),action:o.avgSelected,disabled:w},{label:T(e.locale.value,"count"),action:o.countSelected,disabled:w}]}])}const K=t.ref(null),u=t.ref(null);let M=null;function le(){M&&(document.removeEventListener("mousedown",M),M=null)}function ie(d,v,U){le();const G=e.selection.value;let w="";if(G){const Te=d==="row"?e.getRowHeight(G.startRow):e.colWidths.value[G.startCol];w=Te!=null&&Te>0?String(Math.round(Te)):""}const Y=220,Ee=118;let Se=v,ve=U;Se+Y>window.innerWidth&&(Se=window.innerWidth-Y-8),ve+Ee>window.innerHeight&&(ve=window.innerHeight-Ee-8),Se<8&&(Se=8),ve<8&&(ve=8),u.value={type:d,x:Se,y:ve,value:w,error:""},M=()=>{u.value=null},setTimeout(()=>document.addEventListener("mousedown",M,{once:!0}),0),t.nextTick(()=>{const Te=K.value;Te&&(Te.focus(),Te.select())})}function P(d){const v=u.value;if(!v)return;const U=d.target,G=U.value,w=G.replace(/[^\d]/g,"");v.value=w,G!==w&&(U.value=w),v.error=""}function xe(d){d.key==="Enter"?(d.preventDefault(),Ze()):d.key==="Escape"&&(d.preventDefault(),at())}function $e(){const d=u.value;if(!d)return;const v=d.value.trim(),U=Number(v),G=d.type==="row",w=G?24:30,Y=G?500:1e3;if(v===""||!Number.isFinite(U)){at();return}const Ee=Math.max(w,Math.min(Y,Math.round(U)));d.value=String(Ee),d.error=""}function Ze(){const d=u.value,v=e.selection.value;if(!d||!v)return;const U=d.value.trim(),G=Number(U),w=d.type==="row",Y=w?24:30,Ee=w?500:1e3;if(U===""||!Number.isFinite(G)){d.error=T(e.locale.value,"dimNumberError");return}if(G<Y||G>Ee){d.error=T(e.locale.value,"dimRangeError").replace("{min}",String(Y)).replace("{max}",String(Ee));return}const Se=G;if(n.saveUndo(),w)for(let ve=v.startRow;ve<=v.endRow;ve++)e.rowHeights.value[ve]=Se;else for(let ve=v.startCol;ve<=v.endCol;ve++)e.colWidths.value[ve]=Se;c(),l.emitModelData(),at()}function at(){le(),u.value=null}const O=t.computed(()=>{const d=!e.editingCell.value,v=e.editingCell.value??e.activeCell.value,U=v.col,G=v.row,w=e.resolveStyle(e.cells[e.cellKey(U,G)]),Y=e.cellFontSize(U,G),Ee=typeof(w==null?void 0:w.fontFamily)=="string"&&w.fontFamily?w.fontFamily:al,Se=(w==null?void 0:w.fontWeight)==="bold"?"bold":"normal",ve=(w==null?void 0:w.fontStyle)==="italic"?"italic":"normal",Te=(w==null?void 0:w.underline)==="underline"?"underline":(w==null?void 0:w.strikethrough)==="line-through"?"line-through":"none",Xe=(w==null?void 0:w.underline)==="underline"&&(w==null?void 0:w.strikethrough)==="line-through"?"underline line-through":Te,tt=typeof(w==null?void 0:w.color)=="string"?w.color:void 0,wt=typeof(w==null?void 0:w.backgroundColor)=="string"?w.backgroundColor:void 0,yt=typeof(w==null?void 0:w.numberFormat)=="string"?w.numberFormat:"",Ht=e.editValue.value??e.getCellValue(U,G),ll=typeof(w==null?void 0:w.textAlign)=="string"?w.textAlign:Zl(Ht,yt)?"right":"left",Kt=typeof(w==null?void 0:w.verticalAlign)=="string"?w.verticalAlign:"top",Dt=e.findMerge(U,G),hl=Dt?e.colPositions.value[Dt.range.endCol+1]-e.colPositions.value[U]:e.colWidths.value[U],Tt=Dt?e.rowPositions.value[Dt.range.endRow+1]-e.rowPositions.value[G]:e.getRowHeight(G),nl=2,{ascent:ol,descent:ut}=e.measureFontMetrics(Ee,Y,Se,ve),fl=ol+ut,ce=(e.editValue.value?e.editValue.value.split(`
8
+ `).length:1)*fl,Ce=e.BASE_CELL_VPAD-nl;let Ie=0,Fe=0;return Kt==="middle"?(Ie=Math.floor((Tt-ce)/2),Fe=Math.max(0,Tt-ce-Ie)):Kt==="top"?(Ie=Ce,Fe=Math.max(0,Tt-ce-Ie)):Kt==="bottom"&&(Fe=Ce,Ie=Math.max(0,Tt-ce-Fe)),{left:`${52+e.colPositions.value[U]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[G]-e.scrollY.value}px`,width:`${hl}px`,height:`${Tt}px`,fontFamily:Ee,fontSize:`${Y}px`,lineHeight:1,fontWeight:Se,fontStyle:ve,textDecoration:Xe,textAlign:ll,paddingTop:`${Ie}px`,paddingRight:"3px",paddingBottom:`${Fe}px`,paddingLeft:"3px",opacity:d?0:1,pointerEvents:d?"none":"auto",color:d?"transparent":tt,caretColor:d?"transparent":void 0,borderColor:d?"transparent":void 0,background:d?"transparent":wt,boxShadow:d?"none":void 0}});function D(){return Math.max(0,l.viewSize.w-52-11)}function j(){return Math.max(0,l.viewSize.h-24-11)}const ke=t.computed(()=>D()),_=t.computed(()=>j()),J=t.computed(()=>Math.max(0,ke.value-11*2)),Be=t.computed(()=>Math.max(0,_.value-11*2)),ge=t.computed(()=>l.maxScrollX.value<=0?J.value:Math.max(24,D()/e.totalWidth.value*J.value)),Me=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(J.value-ge.value)),Ve=t.computed(()=>l.maxScrollY.value<=0?Be.value:Math.max(24,j()/e.totalHeight.value*Be.value)),Ye=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(Be.value-Ve.value));let Qe=null,ct=0,mt=0;function zt(d){d.preventDefault(),Qe="v",ct=d.clientY,mt=e.scrollY.value,document.addEventListener("mousemove",ft),document.addEventListener("mouseup",Ct)}function st(d){d.preventDefault(),Qe="h",ct=d.clientX,mt=e.scrollX.value,document.addEventListener("mousemove",ft),document.addEventListener("mouseup",Ct)}function ft(d){if(Qe==="v"){const U=(d.clientY-ct)/(Be.value-Ve.value);l.clampScroll(null,mt+U*l.maxScrollY.value),c()}else if(Qe==="h"){const U=(d.clientX-ct)/(J.value-ge.value);l.clampScroll(mt+U*l.maxScrollX.value,null),c()}}function Ct(){Qe=null,document.removeEventListener("mousemove",ft),document.removeEventListener("mouseup",Ct)}function Qt(d){if(Qe)return;const v=d.currentTarget.getBoundingClientRect(),U=d.clientY-v.top;U<Ye.value?l.clampScroll(null,e.scrollY.value-j()):U>Ye.value+Ve.value&&l.clampScroll(null,e.scrollY.value+j()),c()}function el(d){if(Qe)return;const v=d.currentTarget.getBoundingClientRect(),U=d.clientX-v.left;U<Me.value?l.clampScroll(e.scrollX.value-D(),null):U>Me.value+ge.value&&l.clampScroll(e.scrollX.value+D(),null),c()}let St=!1,ot=0,it=0,Rt=!1,Bt=!1,xt=0,Wt=0,dt=0,B=0,V=0,H=0,ee=0,de=0,f=!1,E=!1,I=0,$=0,z="cell",L=0,te=-1,fe=-1;function We(d){if(d.button!==0)return;d.preventDefault(),re.value=null;const v=Yt(d,l.canvasRef.value);if(v.y<24&&v.x>=52){const w=v.x-52+e.scrollX.value,Y=e.hitCol(w);if(Y>=0&&Math.abs(v.x-(52+e.colPositions.value[Y+1]-e.scrollX.value))<=4){n.saveUndo(),Rt=!0,xt=Y,dt=e.colWidths.value[Y],B=w,c();return}}if(v.x<52&&v.y>=24){const w=v.y-24+e.scrollY.value,Y=e.hitRow(w);if(Y>=0&&Math.abs(v.y-(24+e.rowPositions.value[Y+1]-e.scrollY.value))<=4){n.saveUndo(),Bt=!0,Wt=Y,dt=e.getRowHeight(Y),B=w,c();return}}if(v.x<52||v.y<24){{const w=l.formulaBarRef.value,Y=!!(w&&typeof document<"u"&&document.activeElement===w);(e.editingCell.value||Y||F)&&X()}if(v.y<24&&v.x>=52){const w=e.hitCol(v.x-52+e.scrollX.value);w>=0&&(e.selectRange(w,0,w,e.rowCount-1,"col"),St=!0,ot=w,it=0)}else if(v.x<52&&v.y>=24){const w=e.hitRow(v.y-24+e.scrollY.value);w>=0&&(e.selectRange(0,w,e.colCount-1,w,"row"),St=!0,ot=0,it=w)}else v.x<52&&v.y<24&&e.selectAll();c();return}const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);if(!(U<0||G<0)){{const w=l.formulaBarRef.value,Y=!!(w&&typeof document<"u"&&document.activeElement===w);(e.editingCell.value||Y||F)&&X()}if(d.shiftKey&&e.selection.value){const w=e.selection.value;e.selectRange(w.startCol,w.startRow,U,G)}else e.selectCell(U,G);St=!0,ot=U,it=G,l.focusEditInput(),c()}}function qe(d){if(Rt){const Y=Yt(d,l.canvasRef.value).x-52+e.scrollX.value-B,Ee=dt+Y;Ee>=30&&Ee<=1e3?e.colWidths.value[xt]=Ee:Ee<30?e.colWidths.value[xt]=30:e.colWidths.value[xt]=1e3,c();return}if(Bt){const Y=Yt(d,l.canvasRef.value).y-24+e.scrollY.value-B,Ee=dt+Y;Ee>=24&&Ee<=500?e.rowHeights.value[Wt]=Ee:Ee<24?e.rowHeights.value[Wt]=24:e.rowHeights.value[Wt]=500,c();return}if(!St){const w=l.canvasRef.value;if(!w)return;if(n.paintFmt.value){w.style.cursor="copy";return}const Y=Yt(d,w);if(Y.y<24&&Y.x>=52){const Ee=e.hitCol(Y.x-52+e.scrollX.value);if(Ee>=0&&Math.abs(Y.x-(52+e.colPositions.value[Ee+1]-e.scrollX.value))<=4){w.style.cursor="col-resize";return}}if(Y.x<52&&Y.y>=24){const Ee=e.hitRow(Y.y-24+e.scrollY.value);if(Ee>=0&&Math.abs(Y.y-(24+e.rowPositions.value[Ee+1]-e.scrollY.value))<=4){w.style.cursor="row-resize";return}}w.style.cursor="cell";return}const v=Yt(d,l.canvasRef.value);if(ot<0||it<0)return;if(v.x<52||v.y<24){if(v.y<24&&v.x>=52){const w=e.hitCol(v.x-52+e.scrollX.value);w>=0&&e.selectRange(Math.min(ot,w),0,Math.max(ot,w),e.rowCount-1,"col")}else if(v.x<52&&v.y>=24){const w=e.hitRow(v.y-24+e.scrollY.value);w>=0&&e.selectRange(0,Math.min(it,w),e.colCount-1,Math.max(it,w),"row")}c();return}const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);U<0||G<0||(it===0&&ot>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(ot,U),0,Math.max(ot,U),e.rowCount-1,"col"):ot===0&&it>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(it,G),e.colCount-1,Math.max(it,G),"row"):e.selectRange(ot,it,U,G),c())}function rt(d){const v=Rt||Bt;St=!1,Rt=!1,Bt=!1,v&&l.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat()}function et(){const d=Rt||Bt;St=!1,Rt=!1,Bt=!1,d&&l.scheduleOptEmit()}function pt(d){d.preventDefault();const v=Yt(d,l.canvasRef.value);if(v.x<52&&v.y<24){A(d);return}if(v.y<24&&v.x>=52){const U=e.hitCol(v.x-52+e.scrollX.value);U>=0&&k(d,U);return}if(v.x<52&&v.y>=24){const U=e.hitRow(v.y-24+e.scrollY.value);U>=0&&W(d,U);return}if(v.x>=52&&v.y>=24){const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);U>=0&&G>=0&&he(d,U,G)}}function Mt(d){const v=Yt(d,l.canvasRef.value);if(v.x<52||v.y<24)return;const U=e.hitCol(v.x-52+e.scrollX.value),G=e.hitRow(v.y-24+e.scrollY.value);if(!(U<0||G<0)){{const w=l.formulaBarRef.value,Y=!!(w&&typeof document<"u"&&document.activeElement===w);(e.editingCell.value||Y||F)&&X()}e.selectCell(U,G),e.ensureVisible(U,G),e.startEdit(),c(),l.focusEditInput()}}function ht(d){l.clampScroll(e.scrollX.value+d.deltaX,e.scrollY.value+d.deltaY),c()}function dl(d){if(d.touches.length!==1){f=!1;return}const v=d.touches[0],U=l.canvasRef.value;if(!U)return;const G=U.getBoundingClientRect(),w=v.clientX-G.left,Y=v.clientY-G.top;w>=52&&Y>=24?(d.preventDefault(),f=!0,E=!1,z="cell",V=w,H=Y,ee=e.scrollX.value,de=e.scrollY.value,I=e.hitCol(w-52+e.scrollX.value),$=e.hitRow(Y-24+e.scrollY.value)):w>=0&&Y>=0&&(w<52||Y<24)&&(d.preventDefault(),f=!0,E=!1,V=w,H=Y,ee=e.scrollX.value,de=e.scrollY.value,Y<24&&w>=52?(z="col",I=e.hitCol(w-52+e.scrollX.value),$=-1):w<52&&Y>=24?(z="row",$=e.hitRow(Y-24+e.scrollY.value),I=-1):(z="all",I=-1,$=-1))}function _t(d){if(!f||d.touches.length!==1)return;const v=d.touches[0],U=l.canvasRef.value;if(!U)return;const G=U.getBoundingClientRect(),w=v.clientX-G.left,Y=v.clientY-G.top;(Math.abs(w-V)>8||Math.abs(Y-H)>8)&&(E=!0,d.preventDefault(),l.clampScroll(ee+(V-w),de+(H-Y)),c())}function tl(){if(f&&(f=!1,!E))if(z==="cell"&&I>=0&&$>=0){const d=Date.now();I===te&&$===fe&&d-L<300?(e.selectCell(I,$),e.startEdit(),c(),l.focusEditInput(),L=0):(e.commitEdit(),e.selectCell(I,$),c(),L=d),te=I,fe=$,l.focusEditInput()}else z==="col"&&I>=0?(e.commitEdit(),e.selectRange(I,0,I,e.rowCount-1,"col"),c()):z==="row"&&$>=0?(e.commitEdit(),e.selectRange(0,$,e.colCount-1,$,"row"),c()):z==="all"&&(e.commitEdit(),e.selectAll(),c())}function jt(d){return d.isComposing||d.key==="Process"||d.keyCode===229}function Ll(d){return d.key.length===1&&!d.ctrlKey&&!d.metaKey&&!d.altKey}function mn(d){if(e.editingCell.value)return;const v=d.ctrlKey||d.metaKey,U=d.shiftKey;switch(!0){case(v&&(d.key==="c"||d.key==="C")):d.preventDefault(),o.copyToClipboard();return;case(v&&(d.key==="x"||d.key==="X")):d.preventDefault(),o.cutSelected();return;case(v&&(d.key==="z"||d.key==="Z")):d.preventDefault(),n.undo();return;case(v&&(d.key==="y"||d.key==="Y")):d.preventDefault(),n.redo();return;case(v&&(d.key==="v"||d.key==="V")):d.preventDefault(),n.saveUndo(),o.pasteFromClipboard().then(()=>{c(),t.nextTick(()=>l.emitModelData())});return;case(v&&(d.key==="a"||d.key==="A")):d.preventDefault(),e.selectAll(),c();return;case(v&&d.key==="Home"):d.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),c();return;case(v&&d.key==="End"):d.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),c();return;case d.key==="Home":d.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),c();return;case d.key==="End":d.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),c();return;case d.key==="ArrowUp":d.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="ArrowDown":d.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="ArrowLeft":d.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="ArrowRight":d.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="Tab":d.preventDefault(),e.moveActive(U?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="Enter":d.preventDefault(),e.moveActive(0,U?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c();return;case d.key==="F2":d.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),c(),l.focusEditInput();return;case d.key==="Delete":case d.key==="Backspace":d.preventDefault(),n.saveUndo(),o.clearSelected(),c();return;case d.key==="Escape":d.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,c();return;case Ll(d):if(jt(d)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),c(),l.focusEditInput();return}d.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(d.key),c(),t.nextTick(()=>{const G=l.editInputRef.value;G&&(G.focus(),G.setSelectionRange(1,1))});return}}let $l=!1,zl=!1;function Ni(d){const v=d.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(v),C.value=v,c();return}e.editValue.value=v,C.value=v}function Ii(){$l=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),C.value="",c())}function Ai(d){$l=!1,zl=!0,setTimeout(()=>{zl=!1},0);const v=d.target.value;e.editValue.value=v,C.value=v}function Vi(d){if(!e.editingCell.value){if(Ll(d)||jt(d))return;mn(d);return}if(!($l||jt(d))&&!(zl&&(d.key==="Enter"||d.key==="Escape")))if(d.key==="Enter"&&(d.altKey||d.metaKey)){d.preventDefault();const v=l.editInputRef.value;if(!v)return;const U=v.selectionStart??v.value.length,G=v.selectionEnd??v.value.length,w=v.value,Y=w.slice(0,U)+`
9
+ `+w.slice(G);e.editValue.value=Y,v.value=Y,v.selectionStart=v.selectionEnd=U+1,c()}else d.key==="Enter"?(d.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c(),l.focusEditInput()):d.key==="Tab"?(d.preventDefault(),e.commitEdit(),e.moveActive(d.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),c(),l.focusEditInput()):d.key==="Escape"&&(d.preventDefault(),e.cancelEdit(),c(),l.focusEditInput())}function Fi(d){e.editingCell.value}function Hi(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),c())},0)}let gt=null;function ul(){var v;const d=(v=l.wrapperRef.value)==null?void 0:v.getBoundingClientRect();if(d){const U=Gt(e.props.width),G=Gt(e.props.height);U!=null?l.viewSize.w=U:l.viewSize.w=d.width,G!=null?l.viewSize.h=G:l.viewSize.h=d.height}l.clampScroll(null,null),c()}function Oi(){t.onMounted(()=>{const d=Gt(e.props.width),v=Gt(e.props.height);(d==null||v==null)&&(gt=new ResizeObserver(()=>ul()),l.wrapperRef.value&&gt.observe(l.wrapperRef.value)),t.nextTick(()=>{ul(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(a.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map(U=>{const G=l.mkSheet(U.name),{cells:w,styles:Y}=cn(U.cells);if(Object.assign(G.cells,w),G.styles=U.styles??Y,U.borders)G.borders=U.borders;else{const Ee=sn(G.styles);G.styles=Ee.styles,G.borders=Ee.borders}if(U.colWidths)for(const[Ee,Se]of Object.entries(U.colWidths)){const ve=Number(Ee);ve>=0&&ve<e.colCount&&Se>=30&&(G.colWidths[ve]=Se)}if(U.rowHeights)for(const[Ee,Se]of Object.entries(U.rowHeights)){const ve=Number(Ee);ve>=0&&ve<e.rowCount&&Se>=24&&(G.rowHeights[ve]=Se)}if(U.merges)for(const[Ee,Se]of Object.entries(U.merges))G.merges[Ee]={...Se};return G}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const d=Gt(e.props.width),v=Gt(e.props.height);d!=null&&v!=null?(gt==null||gt.disconnect(),gt=null):!gt&&l.wrapperRef.value&&(gt=new ResizeObserver(()=>ul()),gt.observe(l.wrapperRef.value)),t.nextTick(()=>ul())}),t.watch(()=>e.props.theme,()=>c()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),c()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,d=>{if(!d||d.length===0)return;const v=JSON.stringify(d);if(v===a.value)return;a.value=v;const U=e.selection.value?{...e.selection.value}:null,G={...e.activeCell.value};l.sheets.value=d.map(w=>{const Y=l.mkSheet(w.name),{cells:Ee,styles:Se}=cn(w.cells);if(Object.assign(Y.cells,Ee),Y.styles=w.styles??Se,w.borders)Y.borders=w.borders;else{const ve=sn(Y.styles);Y.styles=ve.styles,Y.borders=ve.borders}if(w.colWidths)for(const[ve,Te]of Object.entries(w.colWidths)){const Xe=Number(ve);Xe>=0&&Xe<e.colCount&&Te>=30&&(Y.colWidths[Xe]=Te)}if(w.rowHeights)for(const[ve,Te]of Object.entries(w.rowHeights)){const Xe=Number(ve);Xe>=0&&Xe<e.rowCount&&Te>=24&&(Y.rowHeights[Xe]=Te)}if(w.merges)for(const[ve,Te]of Object.entries(w.merges))Y.merges[ve]={...Te};return Y}),l.sheets.value.length>0&&l.loadSheet(0),U&&(e.selection.value=U),e.activeCell.value=G,c()},{deep:!0}),t.onBeforeUnmount(()=>{gt==null||gt.disconnect()})}return{scheduleRender:c,render:S,activeCellLabel:x,formulaBarDisplay:R,formulaBarDraft:C,formulaBarExpanded:b,onFormulaBarFocus:Z,onFormulaBarInput:Q,onFormulaBarKeydown:ne,onFormulaBarBlur:se,acceptFormulaBarEdit:X,cancelFormulaBarEdit:me,renTab:ue,renTabVal:pe,onTabClick:Ne,onTabDblClick:Ae,commitTabRename:Pe,cclTabRename:He,onTabRenameKd:we,ctxMenu:re,ctxSubmenuLeft:s,onCtxItemEnter:m,onTabCtxMenu:p,onTabBarCtx:N,onCornerCtx:A,onRowHdrCtx:W,onColHdrCtx:k,onCellCtx:he,dimInputRef:K,dimPanel:u,openDimPanel:ie,onDimInput:P,onDimKeydown:xe,onDimBlur:$e,applyDimPanel:Ze,closeDimPanel:at,editInputStyle:O,hScrollbarW:ke,vScrollbarH:_,hTrackW:J,vTrackH:Be,hThumbW:ge,hThumbL:Me,vThumbH:Ve,vThumbT:Ye,onVStart:zt,onHStart:st,onSbMove:ft,onSbUp:Ct,onVTrk:Qt,onHTrk:el,onMouseDown:We,onMouseMove:qe,onMouseUp:rt,onMouseLeave:et,onCanvasCtx:pt,onDblClick:Mt,onWheel:ht,onTouchStart:dl,onTouchMove:_t,onTouchEnd:tl,onKeydown:mn,onEditInput:Ni,onEditCompositionStart:Ii,onEditCompositionEnd:Ai,onEditKd:Vi,onEditPaste:Fi,onEditBlur:Hi,applySize:ul,setupLifecycle:Oi}}function di(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function un(e,n,o,l){return n?l?o?e===n:e.toLowerCase()===n.toLowerCase():o?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function ui(e,n,o,l){if(!n)return e;if(l){const i=e.indexOf(n);return i<0?e:e.slice(0,i)+o+e.slice(i+n.length)}const a=e.toLowerCase().indexOf(n.toLowerCase());return a<0?e:e.slice(0,a)+o+e.slice(a+n.length)}function fi(e,n,o,l){return n?l?e.indexOf(n)<0?e:e.split(n).join(o):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(di(n),"gi"),()=>o):e}function Ol(e,n,o,l,a,i,r){const h=[];if(r){for(let c=r.startRow;c<=r.endRow;c++)for(let y=r.startCol;y<=r.endCol;y++){const S=e[o(y,c)];S&&un(S.value,l,a,i)&&h.push({sheetIndex:n,col:y,row:c})}return h}for(const c in e){const y=e[c];if(y&&un(y.value,l,a,i)){const S=c.split(","),x=Number(S[0]),C=Number(S[1]);!Number.isNaN(x)&&!Number.isNaN(C)&&h.push({sheetIndex:n,col:x,row:C})}}return h}function mi(e,n,o,l){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),h=t.ref("sheet"),c=t.ref(!1),y=t.ref(!1),S=t.ref(-1),x=t.ref([]),C=t.ref(""),b=t.ref(0),R=t.ref(""),Z=t.computed(()=>{const s=new Set,m=o.activeSheetIndex.value;for(const p of x.value)p.sheetIndex===m&&s.add(`${p.col},${p.row}`);return s}),Q=t.computed(()=>{if(S.value<0||S.value>=x.value.length)return null;const s=x.value[S.value];return s.sheetIndex!==o.activeSheetIndex.value?null:`${s.col},${s.row}`});e.findHighlight=(s,m)=>{const p=`${s},${m}`;return Q.value===p?"active":Z.value.has(p)?"match":null};function g(s){var N,A;const m=e.cellKey(s.col,s.row);if(s.sheetIndex===o.activeSheetIndex.value)return((N=e.cells[m])==null?void 0:N.value)??"";const p=o.sheets.value[s.sheetIndex];return((A=p==null?void 0:p.cells[m])==null?void 0:A.value)??""}function F(s,m){const p=e.cellKey(s.col,s.row);if(s.sheetIndex===o.activeSheetIndex.value)e.setCellValue(s.col,s.row,m);else{const N=o.sheets.value[s.sheetIndex];if(!N)return;const A=N.cells[p];N.cells[p]={value:String(m),styleId:A==null?void 0:A.styleId}}}function X(){if(R.value){C.value=R.value;return}if(!i.value){C.value="";return}if(h.value==="selection"&&!e.selection.value){C.value=T(e.locale.value,"findNeedSelection");return}if(x.value.length===0){C.value=T(e.locale.value,"findNoResult");return}C.value=""}function me(){const s=i.value,m=[];if(s)if(h.value==="workbook")o.sheets.value.forEach((p,N)=>{m.push(...Ol(p.cells,N,e.cellKey,s,c.value,y.value))});else if(h.value==="selection"){const p=e.selection.value;p&&m.push(...Ol(e.cells,o.activeSheetIndex.value,e.cellKey,s,c.value,y.value,p))}else m.push(...Ol(e.cells,o.activeSheetIndex.value,e.cellKey,s,c.value,y.value));x.value=m,m.length===0?S.value=-1:S.value>=m.length?S.value=m.length-1:S.value<0&&(S.value=0),X()}function ne(){if(S.value<0||S.value>=x.value.length)return;const s=x.value[S.value];s.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(s.sheetIndex),h.value==="selection"?e.activeCell.value={col:s.col,row:s.row}:e.selectCell(s.col,s.row),e.ensureVisible(s.col,s.row)}const se=typeof requestAnimationFrame=="function"?requestAnimationFrame:s=>setTimeout(s,16);let ue=!1,pe=!1;function Ne(s){if(ue){pe=pe||s;return}ue=!0,pe=s,se(()=>{var m;ue=!1,me(),pe&&x.value.length>0&&S.value>=0&&ne(),pe=!1,(m=e.scheduleRender)==null||m.call(e)})}function Ae(){var s;a.value=!0,b.value++,me(),x.value.length>0&&(S.value=0,ne()),(s=e.scheduleRender)==null||s.call(e)}function Pe(){Ae()}function He(){var s;a.value=!1,x.value=[],S.value=-1,R.value="",C.value="",(s=e.scheduleRender)==null||s.call(e)}function we(){var s;x.value.length!==0&&(S.value=(S.value+1)%x.value.length,ne(),(s=e.scheduleRender)==null||s.call(e))}function re(){var s;x.value.length!==0&&(S.value=(S.value-1+x.value.length)%x.value.length,ne(),(s=e.scheduleRender)==null||s.call(e))}function q(){var A,W;if(S.value<0||S.value>=x.value.length)return;const s=x.value[S.value],m=g(s),p=ui(m,i.value,r.value,c.value);if(p===m)return;n.saveUndo(),F(s,p);const N=S.value;me(),x.value.length>0?(S.value=Math.min(N,x.value.length-1),we()):S.value=-1,(A=e.emitModelData)==null||A.call(e),(W=e.scheduleRender)==null||W.call(e)}function be(){var N,A;const s=i.value;if(!s||x.value.length===0)return;n.saveUndo();let m=0;const p=x.value.slice();for(const W of p){const k=g(W),he=fi(k,s,r.value,c.value);he!==k&&(F(W,he),m++)}x.value=[],S.value=-1,R.value=T(e.locale.value,"findReplacedAll").replace("{n}",String(m)),X(),(N=e.emitModelData)==null||N.call(e),(A=e.scheduleRender)==null||A.call(e)}function oe(){const s=m=>{if(!(m.ctrlKey||m.metaKey))return;const N=m.key.toLowerCase();(N==="f"||N==="h")&&(m.preventDefault(),Ae())};window.addEventListener("keydown",s),t.onBeforeUnmount(()=>window.removeEventListener("keydown",s))}return t.watch(i,()=>{a.value&&(R.value="",S.value=0,Ne(!0))}),t.watch([h,c,y],()=>{a.value&&(R.value="",S.value=0,Ne(!0))}),t.watch(e.cells,()=>{a.value&&Ne(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&h.value==="selection"&&(S.value=0,Ne(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{a.value&&Ne(!1)}),{open:a,findText:i,replaceText:r,scope:h,matchCase:c,matchEntireCell:y,currentIndex:S,results:x,message:C,focusToken:b,activeSheetMatches:Z,activeMatchKey:Q,openFind:Ae,openReplace:Pe,close:He,recompute:me,findNext:we,findPrev:re,replace:q,replaceAll:be,setupLifecycle:oe}}const pi={class:"formula-bar__cell-label"},hi={class:"formula-bar__buttons"},gi=["rows","value"],yi=["title"],bi={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},vi={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ci=["value"],wi={key:2,class:"sb-corner"},ki=["onClick","onMouseenter"],Ei={class:"context-menu__label"},Si={key:0,class:"context-menu__arrow"},Ri=["onClick"],Bi={class:"dim-panel__title"},xi={class:"dim-panel__body"},Mi=["value"],Di={key:0,class:"dim-panel__error"},Ti={class:"dim-panel__footer"},fn=Et(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const n=e,o=t.useModel(e,"data"),l={value:""},a=ni(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:oe=>{},mkSheet:oe=>({id:"",name:oe,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=oi(a,i),h=ai(a,r);ri(r,{borderMenuOpen:h.borderMenuOpen,mergeMenuOpen:h.mergeMenuOpen});const c=ci(a,r,o,void 0,l);i.sheets=c.sheets,i.activeSheetIndex=c.activeSheetIndex,i.saveSheet=c.saveSheet,i.loadSheet=c.loadSheet,i.mkSheet=c.mkSheet;const y=si(a,r,h,c,l);y.setupLifecycle();const S=mi(a,r,c);S.setupLifecycle();const x=t.reactive(a),C=t.reactive(r),b=t.reactive(h),R=t.reactive(c),Z=c.sheets,Q=c.activeSheetIndex,g=t.reactive(y),F=t.reactive(S),X=t.computed(()=>{const oe=x.selection;return!!oe&&oe.startCol===oe.endCol&&oe.startRow===oe.endRow}),me=t.computed(()=>{const oe=C.selNumberFormat;if(oe!==kt&&oe!==At)return oe;const s=x.activeCell,m=a.resolveStyle(x.cells[x.cellKey(s.col,s.row)]);return typeof(m==null?void 0:m.numberFormat)=="string"?m.numberFormat:""});function ne(oe){r.nfDialogOpen.value=oe}function se(oe){r.fontSizeMenuOpen.value=oe}function ue(oe){r.textColorMenuOpen.value=oe}function pe(oe){r.fillColorMenuOpen.value=oe}function Ne(oe){y.renTabVal.value=oe}function Ae(){y.ctxMenu.value=null}const Pe=oe=>{c.formulaBarRef.value=oe};function He(){y.formulaBarExpanded.value=!y.formulaBarExpanded.value}const we=oe=>{c.wrapperRef.value=oe},re=oe=>{c.canvasRef.value=oe},q=oe=>{c.editInputRef.value=oe},be=oe=>{y.dimInputRef.value=oe};return(oe,s)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(R.outerStyle)},[t.createVNode(Ir,{locale:x.locale,"can-undo":C.canUndo,"can-redo":C.canRedo,"paint-fmt-active":C.paintFmt!==null,"has-selection":C.hasSelection,"font-family-options":C.fontFamilyOptions,"font-size-options":C.fontSizeOptions,"sel-font-family":C.selFontFamily,"sel-font-size":C.selFontSize,"font-size-input":C.fontSizeInput,"font-size-menu-open":C.fontSizeMenuOpen,"sel-font-weight":C.selFontWeight,"sel-font-style":C.selFontStyle,"sel-underline":C.selUnderline,"sel-strikethrough":C.selStrikethrough,"sel-text-color":C.selTextColor,"text-color-menu-open":C.textColorMenuOpen,"sel-fill-color":C.selFillColor,"fill-color-menu-open":C.fillColorMenuOpen,"cached-text-color":C.cachedTextColor,"cached-fill-color":C.cachedFillColor,"border-menu-open":b.borderMenuOpen,"cached-border":b.cachedBorder,"h-align-options":C.hAlignOptions,"v-align-options":C.vAlignOptions,"sel-h-align":C.selHAlign,"sel-v-align":C.selVAlign,"sel-wrap":C.selWrap,"merge-menu-open":b.mergeMenuOpen,"calc-menu-open":b.calcMenuOpen,"is-single-cell":X.value,"sel-number-format":C.selNumberFormatDisplay,"nf-options":C.nfOptions,"can-increase-decimals":C.canIncreaseDecimals,"can-decrease-decimals":C.canDecreaseDecimals,"theme-vars":R.toolbarThemeVars,onUndo:s[0]||(s[0]=m=>C.undo()),onRedo:s[1]||(s[1]=m=>C.redo()),onPaintFormat:C.onPaintFormat,onClearFormat:s[2]||(s[2]=m=>C.clearFormat()),onNumberFormatChange:s[3]||(s[3]=m=>C.onNumberFormatChange(m)),onIncreaseDecimals:C.onIncreaseDecimals,onDecreaseDecimals:C.onDecreaseDecimals,onFontFamilyChange:s[4]||(s[4]=m=>C.onFontFamilyChange(m)),onFontSizeInput:s[5]||(s[5]=m=>C.onFontSizeInput(m)),onFontSizeBlur:C.onFontSizeBlur,onFontSizeKeydown:s[6]||(s[6]=m=>C.onFontSizeKeydown(m)),onFontSizeChange:s[7]||(s[7]=m=>C.onFontSizeChange(m)),"onUpdate:fontSizeMenuOpen":s[8]||(s[8]=m=>se(m)),onFontSizeToggle:s[9]||(s[9]=m=>C.toggleFontSizeMenu()),onFontSizeStepUp:C.onFontSizeStepUp,onFontSizeStepDown:C.onFontSizeStepDown,onBoldToggle:C.toggleFontWeight,onItalicToggle:C.toggleFontStyle,onUnderlineToggle:C.toggleUnderline,onStrikethroughToggle:C.toggleStrikethrough,onTextColorChange:s[10]||(s[10]=m=>C.onTextColorChange(m)),"onUpdate:textColorMenuOpen":s[11]||(s[11]=m=>ue(m)),onFillColorChange:s[12]||(s[12]=m=>C.onFillColorChange(m)),"onUpdate:fillColorMenuOpen":s[13]||(s[13]=m=>pe(m)),onApplyTextColor:C.applyCachedTextColor,onApplyFillColor:C.applyCachedFillColor,"onUpdate:borderMenuOpen":s[14]||(s[14]=m=>C.onBorderMenuToggle(m)),onBorderChange:s[15]||(s[15]=m=>b.onBorderChange(m)),onApplyBorder:b.applyCachedBorder,onHAlignChange:s[16]||(s[16]=m=>C.onHAlignChange(m)),onVAlignChange:s[17]||(s[17]=m=>C.onVAlignChange(m)),onWrapToggle:C.onWrapToggle,"onUpdate:mergeMenuOpen":s[18]||(s[18]=m=>b.onMergeMenuToggle(m)),onMergeChange:s[19]||(s[19]=m=>b.onMergeChange(m)),onApplyMerge:b.onApplyMerge,"onUpdate:calcMenuOpen":s[20]||(s[20]=m=>b.onCalcMenuToggle(m)),onCalcSum:b.onCalcSum,onCalcAvg:b.onCalcAvg,onCalcCount:b.onCalcCount,onFind:s[21]||(s[21]=m=>t.unref(S).openFind())},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","sel-number-format","nf-options","can-increase-decimals","can-decrease-decimals","theme-vars","onPaintFormat","onIncreaseDecimals","onDecreaseDecimals","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(ca,{open:F.open,"find-text":F.findText,"replace-text":F.replaceText,scope:F.scope,"match-case":F.matchCase,"match-entire-cell":F.matchEntireCell,"current-index":F.currentIndex,total:F.results.length,message:F.message,"focus-token":F.focusToken,locale:x.locale,"theme-vars":R.toolbarThemeVars,"onUpdate:findText":s[22]||(s[22]=m=>t.unref(S).findText.value=m),"onUpdate:replaceText":s[23]||(s[23]=m=>t.unref(S).replaceText.value=m),"onUpdate:scope":s[24]||(s[24]=m=>t.unref(S).scope.value=m),"onUpdate:matchCase":s[25]||(s[25]=m=>t.unref(S).matchCase.value=m),"onUpdate:matchEntireCell":s[26]||(s[26]=m=>t.unref(S).matchEntireCell.value=m),onPrev:s[27]||(s[27]=m=>t.unref(S).findPrev()),onNext:s[28]||(s[28]=m=>t.unref(S).findNext()),onReplace:s[29]||(s[29]=m=>t.unref(S).replace()),onReplaceAll:s[30]||(s[30]=m=>t.unref(S).replaceAll()),onClose:s[31]||(s[31]=m=>t.unref(S).close())},null,8,["open","find-text","replace-text","scope","match-case","match-entire-cell","current-index","total","message","focus-token","locale","theme-vars"]),t.createVNode(Wa,{"model-open":C.nfDialogOpen,locale:x.locale,"current-format":me.value,"is-custom":C.selNumberFormat===t.unref(At),"onUpdate:modelOpen":s[32]||(s[32]=m=>ne(m)),onApply:s[33]||(s[33]=m=>C.applyNumberFormatCode(m))},null,8,["model-open","locale","current-format","is-custom"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":g.formulaBarExpanded}])},[t.createElementVNode("div",pi,t.toDisplayString(g.activeCellLabel),1),t.createElementVNode("div",hi,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:s[34]||(s[34]=t.withModifiers(()=>{},["prevent"])),onClick:s[35]||(s[35]=t.withModifiers((...m)=>g.cancelFormulaBarEdit&&g.cancelFormulaBarEdit(...m),["stop"]))},[...s[85]||(s[85]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 3l8 8M11 3l-8 8",fill:"none",stroke:"#e53935","stroke-width":"1.8","stroke-linecap":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:"接受(Enter)","aria-label":"接受",onMousedown:s[36]||(s[36]=t.withModifiers(()=>{},["prevent"])),onClick:s[37]||(s[37]=t.withModifiers((...m)=>g.acceptFormulaBarEdit&&g.acceptFormulaBarEdit(...m),["stop"]))},[...s[86]||(s[86]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M2.5 7.5l3.5 3.5L12 3.5",fill:"none",stroke:"#2e7d32","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],32)]),t.createElementVNode("textarea",{ref:Pe,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":g.formulaBarExpanded}]),rows:g.formulaBarExpanded?3:1,value:g.formulaBarDisplay,spellcheck:"false",onFocus:s[38]||(s[38]=(...m)=>g.onFormulaBarFocus&&g.onFormulaBarFocus(...m)),onInput:s[39]||(s[39]=(...m)=>g.onFormulaBarInput&&g.onFormulaBarInput(...m)),onKeydown:s[40]||(s[40]=(...m)=>g.onFormulaBarKeydown&&g.onFormulaBarKeydown(...m)),onBlur:s[41]||(s[41]=(...m)=>g.onFormulaBarBlur&&g.onFormulaBarBlur(...m))},null,42,gi),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:g.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:s[42]||(s[42]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(He,["stop"])},[g.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",vi,[...s[88]||(s[88]=[t.createElementVNode("path",{d:"M2 8l4-4 4 4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",bi,[...s[87]||(s[87]=[t.createElementVNode("path",{d:"M2 4l4 4 4-4",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))],40,yi)],2),t.createElementVNode("div",{ref:we,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:re,class:"grid-canvas",tabindex:"0",onMousedown:s[43]||(s[43]=(...m)=>g.onMouseDown&&g.onMouseDown(...m)),onMousemove:s[44]||(s[44]=(...m)=>g.onMouseMove&&g.onMouseMove(...m)),onMouseup:s[45]||(s[45]=(...m)=>g.onMouseUp&&g.onMouseUp(...m)),onMouseleave:s[46]||(s[46]=(...m)=>g.onMouseLeave&&g.onMouseLeave(...m)),onDblclick:s[47]||(s[47]=(...m)=>g.onDblClick&&g.onDblClick(...m)),onWheel:s[48]||(s[48]=t.withModifiers((...m)=>g.onWheel&&g.onWheel(...m),["prevent"])),onFocus:s[49]||(s[49]=(...m)=>R.onCanvasFocus&&R.onCanvasFocus(...m)),onKeydown:s[50]||(s[50]=(...m)=>g.onKeydown&&g.onKeydown(...m)),onContextmenu:s[51]||(s[51]=(...m)=>g.onCanvasCtx&&g.onCanvasCtx(...m)),onTouchstart:s[52]||(s[52]=t.withModifiers((...m)=>g.onTouchStart&&g.onTouchStart(...m),["prevent"])),onTouchmove:s[53]||(s[53]=t.withModifiers((...m)=>g.onTouchMove&&g.onTouchMove(...m),["prevent"])),onTouchend:s[54]||(s[54]=(...m)=>g.onTouchEnd&&g.onTouchEnd(...m))},null,32),t.createElementVNode("textarea",{ref:q,class:"cell-editor",value:x.editValue,style:t.normalizeStyle(g.editInputStyle),onInput:s[55]||(s[55]=(...m)=>g.onEditInput&&g.onEditInput(...m)),onKeydown:s[56]||(s[56]=(...m)=>g.onEditKd&&g.onEditKd(...m)),onCompositionstart:s[57]||(s[57]=(...m)=>g.onEditCompositionStart&&g.onEditCompositionStart(...m)),onCompositionend:s[58]||(s[58]=(...m)=>g.onEditCompositionEnd&&g.onEditCompositionEnd(...m)),onBlur:s[59]||(s[59]=(...m)=>g.onEditBlur&&g.onEditBlur(...m)),onPaste:s[60]||(s[60]=(...m)=>g.onEditPaste&&g.onEditPaste(...m))},null,44,Ci),R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:s[61]||(s[61]=t.withModifiers(m=>{R.clampScroll(null,x.scrollY-50),g.scheduleRender()},["prevent"]))},[...s[89]||(s[89]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:s[63]||(s[63]=(...m)=>g.onVTrk&&g.onVTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:g.vThumbT+"px",height:g.vThumbH+"px"}),onMousedown:s[62]||(s[62]=(...m)=>g.onVStart&&g.onVStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:s[64]||(s[64]=t.withModifiers(m=>{R.clampScroll(null,x.scrollY+50),g.scheduleRender()},["prevent"]))},[...s[90]||(s[90]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:s[65]||(s[65]=t.withModifiers(m=>{R.clampScroll(x.scrollX-50,null),g.scheduleRender()},["prevent"]))},[...s[91]||(s[91]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:s[67]||(s[67]=(...m)=>g.onHTrk&&g.onHTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:g.hThumbL+"px",width:g.hThumbW+"px"}),onMousedown:s[66]||(s[66]=(...m)=>g.onHStart&&g.onHStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:s[68]||(s[68]=t.withModifiers(m=>{R.clampScroll(x.scrollX+50,null),g.scheduleRender()},["prevent"]))},[...s[92]||(s[92]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0&&R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",wi)):t.createCommentVNode("",!0)]),t.createVNode(Pr,{locale:x.locale,sheets:t.unref(Z),"active-sheet-index":t.unref(Q),"ren-tab":g.renTab,"ren-tab-val":g.renTabVal,onTabClick:s[69]||(s[69]=m=>g.onTabClick(m)),onTabDblclick:s[70]||(s[70]=m=>g.onTabDblClick(m)),onTabContextmenu:s[71]||(s[71]=m=>g.onTabCtxMenu(m.ev,m.i)),onTabRenameInput:s[72]||(s[72]=m=>Ne(m)),onTabRenameKeydown:s[73]||(s[73]=m=>g.onTabRenameKd(m)),onTabRenameCommit:g.commitTabRename,onTabbarContextmenu:s[74]||(s[74]=m=>g.onTabBarCtx(m)),onDeleteSheet:s[75]||(s[75]=m=>{R.removeSheet(m),g.scheduleRender()}),onAddSheet:s[76]||(s[76]=m=>{R.addSheet(),g.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:g.ctxMenu.x+"px",top:g.ctxMenu.y+"px"}),onClick:s[77]||(s[77]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.ctxMenu.items,(m,p)=>(t.openBlock(),t.createElementBlock("div",{key:p,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":m.disabled}]),onClick:N=>!m.disabled&&m.action&&(m.action(),Ae()),onMouseenter:N=>g.onCtxItemEnter(N,m)},[t.createElementVNode("span",Ei,t.toDisplayString(m.label),1),m.children?(t.openBlock(),t.createElementBlock("span",Si)):t.createCommentVNode("",!0),m.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":g.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.children,(N,A)=>(t.openBlock(),t.createElementBlock("div",{key:A,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":N.disabled}]),onClick:t.withModifiers(W=>!N.disabled&&N.action&&(N.action(),Ae()),["stop"])},t.toDisplayString(N.label),11,Ri))),128))],2)):t.createCommentVNode("",!0)],42,ki))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:g.dimPanel.x+"px",top:g.dimPanel.y+"px"}),onMousedown:s[83]||(s[83]=t.withModifiers(()=>{},["stop"])),onClick:s[84]||(s[84]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Bi,t.toDisplayString(g.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",xi,[t.createElementVNode("input",{ref:be,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":g.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:g.dimPanel.value,onInput:s[78]||(s[78]=(...m)=>g.onDimInput&&g.onDimInput(...m)),onKeydown:s[79]||(s[79]=(...m)=>g.onDimKeydown&&g.onDimKeydown(...m)),onBlur:s[80]||(s[80]=(...m)=>g.onDimBlur&&g.onDimBlur(...m))},null,42,Mi),s[93]||(s[93]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),g.dimPanel.error?(t.openBlock(),t.createElementBlock("div",Di,t.toDisplayString(g.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Ti,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:s[81]||(s[81]=(...m)=>g.applyDimPanel&&g.applyDimPanel(...m))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:s[82]||(s[82]=(...m)=>g.closeDimPanel&&g.closeDimPanel(...m))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-e9e7c7f1"]]);Lt.Spreader=fn,Lt.default=fn,Object.defineProperties(Lt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});