xiaodao-spreader 0.1.35 → 0.1.36

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(Ql,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Ql=typeof globalThis<"u"?globalThis:Ql||self,t(Ql.XiaoDaoSpreader={},Ql.Vue))})(this,function(Ql,t){"use strict";const oa={"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:"默认列宽",sort:"排序",sortAsc:"升序排序",sortDesc:"降序排序",sortReminderTitle:"排序提醒",sortReminderMessage:"选定区域的左侧或右侧还有相邻数据,这些数据未被选中,将不参与排序。是否将其一并纳入排序?",sortExpandSelection:"扩展选定区域",sortCurrentSelection:"仅对选定区域排序",insertFunctionTitle:"插入函数",insertFunctionSelectLabel:"函数",insertFunctionPlaceholder:"请选择函数",insertFunctionSearchPlaceholder:"搜索函数",insertFunctionFormulaLabel:"公式",insertFunctionBtn:"插入",fnDescSum:"计算单元格区域中所有数值的和",fnDescAverage:"计算单元格区域中数值的算术平均值",fnDescCount:"统计单元格区域中包含数值的单元格个数",fnDescIf:"根据指定条件判断真假,返回对应的两个值之一",fnDescVlookup:"在区域首列查找指定值,返回同一行中指定列的值",fnDescConcatenate:"将多个文本连接合并为一个文本",fnDescMax:"返回单元格区域中所有数值的最大值",fnDescMin:"返回单元格区域中所有数值的最小值",fnDescSin:"返回给定角度(弧度)的正弦值",fnDescSumif:"对区域中满足指定条件的单元格对应的数值求和",fnDescPmt:"计算基于固定利率及等额分期付款的贷款每期还款额",fnDescStdev:"估算基于样本的标准偏差(忽略文本与逻辑值)",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:"分类",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",findOptions:"查找选项",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列",filter:"筛选",clearFilter:"清除筛选",cancelFilter:"取消",filterSearchPlaceholder:"搜索",filterSelectAll:"全选",filterClearAll:"清除全部",filterOk:"确定",filterBlank:"空白",filterNonBlank:"非空白",filterText:"文本筛选",filterNumber:"数字筛选",filterDate:"日期筛选",filterEquals:"等于",filterNotEquals:"不等于",filterContains:"包含",filterNotContains:"不包含",filterStartsWith:"开头是",filterEndsWith:"结尾是",filterGreaterThan:"大于",filterGreaterThanOrEqual:"大于等于",filterLessThan:"小于",filterLessThanOrEqual:"小于等于",filterBetween:"介于",filterAnd:"与",filterCustom:"自定义筛选",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",conditionalFormat:"条件格式",cfHighlightRules:"突出显示单元格规则",cfGreaterThan:"大于",cfGreaterThanOrEqual:"大于等于",cfLessThan:"小于",cfLessThanOrEqual:"小于等于",cfBetween:"介于",cfNotBetween:"不介于",cfEqual:"等于",cfCellIs:"单元格值",cfNotEqual:"不等于",cfTextContains:"文本包含",cfTextNotContains:"文本不包含",cfBlank:"空白",cfNotBlank:"非空白",cfDuplicate:"重复值",cfUnique:"唯一值",cfFormulaShort:"公式",cfFormula:"使用公式确定要设置格式的单元格",cfFormulaExample:"例如 =$A1>100",cfNewRule:"新建规则",cfManageRules:"管理规则",cfClearRules:"清除规则",cfClearSelected:"清除所选单元格的规则",cfClearSheet:"清除整个工作表的规则",cfAppliedTo:"应用于",cfRule:"规则",cfFormat:"格式",cfPriority:"优先级",cfStopIfTrue:"停止如果为真",cfEnabled:"启用",cfDelete:"删除",cfEdit:"编辑",cfMoveUp:"上移",cfMoveDown:"下移",cfType:"类型",cfOperator:"条件",cfValue:"值",cfValue2:"到",cfManagerTitle:"条件格式规则管理器",cfPreview:"预览",cfNoRules:"当前工作表没有条件格式规则",cfRuleTypeGeneric:"自定义规则",cfBold:"加粗",cfItalic:"斜体",cfUnderline:"下划线",cfFontColor:"字体颜色",cfFillColor:"填充颜色",dv:"数据验证",dvDialogTitle:"数据验证",dvSettings:"设置",dvInputMessageTab:"输入信息",dvErrorAlertTab:"出错警告",dvAllow:"允许",dvData:"数据",dvSource:"来源",dvMin:"最小值",dvMax:"最大值",dvValue:"值",dvFormula:"公式",dvOperator:"条件",dvApplyTo:"应用于",dvShowDropdown:"提供下拉箭头",dvIgnoreBlank:"忽略空值",dvShowInputMessage:"选定单元格时显示输入信息",dvInputTitle:"标题",dvInputMessage:"输入信息",dvShowErrorAlert:"输入无效数据时显示出错警告",dvErrorStyle:"样式",dvErrorTitle:"标题",dvErrorMessage:"错误信息",dvClearAll:"全部清除",dvTypeAny:"任何值",dvTypeList:"列表",dvTypeWholeNumber:"整数",dvTypeDecimal:"小数",dvTypeDate:"日期",dvTypeTime:"时间",dvTypeTextLength:"文本长度",dvTypeCustom:"自定义",dvBetween:"介于",dvNotBetween:"不介于",dvEqual:"等于",dvNotEqual:"不等于",dvGreaterThan:"大于",dvGreaterThanOrEqual:"大于等于",dvLessThan:"小于",dvLessThanOrEqual:"小于等于",dvStyleStop:"停止",dvStyleWarning:"警告",dvStyleInformation:"信息",dvErrorTitleDefault:"输入无效",dvMsgList:"请从下拉列表中选择:{values}",dvMsgListEmpty:"请从下拉列表中选择一个有效值",dvMsgBetween:"{type}必须介于 {min} 与 {max} 之间",dvMsgNotBetween:"{type}不能介于 {min} 与 {max} 之间",dvMsgCompare:"{type}必须{op} {value}",dvMsgCustom:"输入不满足条件:{formula}",dvMsgInvalid:"输入的值不符合该单元格的数据验证规则",dvStopDialogTitle:"输入无效",dvWarningDialogTitle:"输入可能无效",dvInformationDialogTitle:"输入提示",dvBtnRetry:"重试",dvBtnContinue:"是",dvBtnNo:"否",dvBtnOk:"确定",dvRangeInvalid:"范围格式无效,例如 A1:B10 或 A2:A100,C2:C100",dvSourceInvalid:"来源不能为空",dvFormulaRequired:"请输入公式",dvValueRequired:"请输入比较值",dvMinRequired:"请输入最小值",dvMaxRequired:"请输入最大值",dvMustBeInteger:"必须为整数",dvMustBeNumber:"必须为数字",dvDateInvalid:"日期格式无效",dvTimeInvalid:"时间格式无效",dvSearchPlaceholder:"搜索",dvNoMatch:"无匹配项",dvClearValidation:"清除数据验证",dvSourceHint:"直接输入逗号分隔的值,或引用区域(如 A1:A10、Sheet2!A1:A10)"},"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",sort:"Sort",sortAsc:"Sort Ascending",sortDesc:"Sort Descending",sortReminderTitle:"Sort Warning",sortReminderMessage:"There is adjacent data to the left or right of your selection. It is not selected and will not be sorted. Include it in the sort?",sortExpandSelection:"Expand the selection",sortCurrentSelection:"Sort the current selection only",insertFunctionTitle:"Insert Function",insertFunctionSelectLabel:"Function",insertFunctionPlaceholder:"Select a function",insertFunctionSearchPlaceholder:"Search a function",insertFunctionFormulaLabel:"Formula",insertFunctionBtn:"Insert",fnDescSum:"Adds all the numbers in a range of cells",fnDescAverage:"Returns the arithmetic mean of the numbers in a range",fnDescCount:"Counts the cells that contain numbers in a range",fnDescIf:"Checks a condition and returns one of two values",fnDescVlookup:"Looks up a value in the first column of a range and returns a value in the same row",fnDescConcatenate:"Joins several text strings into one text string",fnDescMax:"Returns the largest numeric value in a range of cells",fnDescMin:"Returns the smallest numeric value in a range of cells",fnDescSin:"Returns the sine of a given angle (in radians)",fnDescSumif:"Sums the values in a range that meet a specified condition",fnDescPmt:"Calculates the periodic payment for a loan with constant payments and interest",fnDescStdev:"Estimates the sample standard deviation of a supplied set of values",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",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",findOptions:"Find options",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",freezePane:"Freeze Panes",freezePanes:"Freeze Panes",freezeFirstRow:"Freeze First Row",freezeFirstCol:"Freeze First Column",unfreezePanes:"Unfreeze Panes",freezeToRow:"Freeze to Row",freezeToCol:"Freeze to Column",filter:"Filter",clearFilter:"Clear Filter",cancelFilter:"Cancel",filterSearchPlaceholder:"Search",filterSelectAll:"Select All",filterClearAll:"Clear All",filterOk:"OK",filterBlank:"Blanks",filterNonBlank:"Non-blanks",filterText:"Text Filters",filterNumber:"Number Filters",filterDate:"Date Filters",filterEquals:"Equals",filterNotEquals:"Does Not Equal",filterContains:"Contains",filterNotContains:"Does Not Contain",filterStartsWith:"Begins With",filterEndsWith:"Ends With",filterGreaterThan:"Greater Than",filterGreaterThanOrEqual:"Greater Than Or Equal To",filterLessThan:"Less Than",filterLessThanOrEqual:"Less Than Or Equal To",filterBetween:"Between",filterAnd:"And",filterCustom:"Custom Filter",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",conditionalFormat:"Conditional Formatting",cfHighlightRules:"Highlight Cell Rules",cfGreaterThan:"Greater Than",cfGreaterThanOrEqual:"Greater Than Or Equal To",cfLessThan:"Less Than",cfLessThanOrEqual:"Less Than Or Equal To",cfBetween:"Between",cfNotBetween:"Not Between",cfEqual:"Equal To",cfCellIs:"Cell Value",cfNotEqual:"Not Equal To",cfTextContains:"Text Contains",cfTextNotContains:"Text Does Not Contain",cfBlank:"Blanks",cfNotBlank:"Non-blanks",cfDuplicate:"Duplicate Values",cfUnique:"Unique Values",cfFormulaShort:"Formula",cfFormula:"Use a formula to determine which cells to format",cfFormulaExample:"e.g. =$A1>100",cfNewRule:"New Rule",cfManageRules:"Manage Rules",cfClearRules:"Clear Rules",cfClearSelected:"Clear Rules from Selected Cells",cfClearSheet:"Clear Rules from Entire Sheet",cfAppliedTo:"Applies to",cfRule:"Rule",cfFormat:"Format",cfPriority:"Priority",cfStopIfTrue:"Stop If True",cfEnabled:"Enabled",cfDelete:"Delete",cfEdit:"Edit",cfMoveUp:"Move Up",cfMoveDown:"Move Down",cfType:"Type",cfOperator:"When",cfValue:"Value",cfValue2:"To",cfManagerTitle:"Conditional Formatting Rules Manager",cfPreview:"Preview",cfNoRules:"No conditional formatting rules on this sheet",cfRuleTypeGeneric:"Custom Rule",cfBold:"Bold",cfItalic:"Italic",cfUnderline:"Underline",cfFontColor:"Font Color",cfFillColor:"Fill Color",dv:"Data Validation",dvDialogTitle:"Data Validation",dvSettings:"Settings",dvInputMessageTab:"Input Message",dvErrorAlertTab:"Error Alert",dvAllow:"Allow",dvData:"Data",dvSource:"Source",dvMin:"Minimum",dvMax:"Maximum",dvValue:"Value",dvFormula:"Formula",dvOperator:"Operator",dvApplyTo:"Apply to",dvShowDropdown:"In-cell dropdown",dvIgnoreBlank:"Ignore blank",dvShowInputMessage:"Show input message when cell is selected",dvInputTitle:"Title",dvInputMessage:"Input message",dvShowErrorAlert:"Show error alert after invalid data is entered",dvErrorStyle:"Style",dvErrorTitle:"Title",dvErrorMessage:"Error message",dvClearAll:"Clear All",dvTypeAny:"Any value",dvTypeList:"List",dvTypeWholeNumber:"Whole Number",dvTypeDecimal:"Decimal",dvTypeDate:"Date",dvTypeTime:"Time",dvTypeTextLength:"Text Length",dvTypeCustom:"Custom",dvBetween:"between",dvNotBetween:"not between",dvEqual:"equal to",dvNotEqual:"not equal to",dvGreaterThan:"greater than",dvGreaterThanOrEqual:"greater than or equal to",dvLessThan:"less than",dvLessThanOrEqual:"less than or equal to",dvStyleStop:"Stop",dvStyleWarning:"Warning",dvStyleInformation:"Information",dvErrorTitleDefault:"Invalid Input",dvMsgList:"Please select a value from the dropdown list: {values}",dvMsgListEmpty:"Please select a valid value from the dropdown list",dvMsgBetween:"{type} must be between {min} and {max}",dvMsgNotBetween:"{type} must not be between {min} and {max}",dvMsgCompare:"{type} must be {op} {value}",dvMsgCustom:"The input does not satisfy: {formula}",dvMsgInvalid:"The value does not match the data validation rules for this cell",dvStopDialogTitle:"Invalid Input",dvWarningDialogTitle:"Possible Invalid Input",dvInformationDialogTitle:"Input Notice",dvBtnRetry:"Retry",dvBtnContinue:"Yes",dvBtnNo:"No",dvBtnOk:"OK",dvRangeInvalid:"Invalid range, e.g. A1:B10 or A2:A100,C2:C100",dvSourceInvalid:"Source cannot be empty",dvFormulaRequired:"Please enter a formula",dvValueRequired:"Please enter a comparison value",dvMinRequired:"Please enter the minimum value",dvMaxRequired:"Please enter the maximum value",dvMustBeInteger:"Must be an integer",dvMustBeNumber:"Must be a number",dvDateInvalid:"Invalid date format",dvTimeInvalid:"Invalid time format",dvSearchPlaceholder:"Search",dvNoMatch:"No matches",dvClearValidation:"Clear Validation",dvSourceHint:"Enter comma separated values, or reference a range (e.g. A1:A10, Sheet2!A1:A10)"}};function b(e,n){var l;return((l=oa[e])==null?void 0:l[n])??n}const pn='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',zl=10,ra=[{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'}],aa=[{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}],ia='<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>',sa='<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>',ca='<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>',da='<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>',ua='<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>',fa='<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>',ma=[{value:"left",labelKey:"alignLeft",icon:ia},{value:"center",labelKey:"alignCenter",icon:sa},{value:"right",labelKey:"alignRight",icon:ca}],pa=[{value:"top",labelKey:"alignTop",icon:da},{value:"middle",labelKey:"alignMiddle",icon:ua},{value:"bottom",labelKey:"alignBottom",icon:fa}],ha=[{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>'}],ga={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)"},ba={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)"},Wl="__nf_custom__",Tl="",Pl="",il="@",Gn="__NF_INVALID__",Co=2958465,wo=0;function sl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function vo(e){return e==="zh-CN"?"¥":"$"}function ya(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function er(e){return e.replace(/"([^"]*)"/g,"$1")}function Ca(e){let n=e,l;const o=n.match(/^\[([^\]]+)\]/);o&&(l=o[1].toLowerCase(),n=n.slice(o[0].length)),n=ya(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:l};let d=-1;for(let X=n.length-1;X>=0;X--){const te=n[X];if(te==="0"||te==="#"||te==="?"||te==="E"){d=X;break}}d<0&&(d=r);const f=r>0?n.slice(0,r):"",y=d<n.length-1?n.slice(d+1):"",h=n.slice(r,d+1),u=/[0#?]/.test(h),E=h.includes(",");let k=h.replace(/,/g,"");if(a){const X=k.search(/E/i);X>=0&&(k=k.slice(0,X))}const H=k.indexOf("."),Y=H>=0?k.slice(0,H):k,ne=H>=0?k.slice(H+1):"",ee=(ne.match(/[0#?]/g)||[]).length,M=(ne.match(/0/g)||[]).length,se=(Y.match(/0/g)||[]).length;return{hasDigits:u,decimals:ee,minDecimals:M,minIntDigits:se,thousands:E,scale:i?100:1,scientific:a,prefix:f,suffix:y,color:l}}function wa(e){const n=[];let l=!1;const o=/\[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=o.exec(e))!==null;){const i=a[0];switch(i){case"[h]":l=!0,n.push({type:"hour",len:0});break;case"[mm]":l=!0,n.push({type:"minute",len:2});break;case"[ss]":l=!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(l?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":n.push(l?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":n.push(l?{type:"minute",len:2}:{type:"month",len:2});break;case"m":n.push(l?{type:"minute",len:1}:{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:er(i),len:0}):n.push({type:"literal",text:i,len:0})}}return{tokens:n,isDuration:l}}const tr=new Map;function va(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:d}=wa(i);return{kind:d?"duration":"date",sections:[],tokens:r,isDuration:d,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Ca(i)),tokens:[],isDuration:!1,raw:e}}function Ul(e){const n=tr.get(e);if(n)return n;const l=va(e);return tr.set(e,l),l}function lr(e,n,l,o,a){const i=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*i)/i,d=r<0,f=Math.abs(r);let h=new Intl.NumberFormat("en-US",{useGrouping:o,minimumIntegerDigits:a,minimumFractionDigits:n,maximumFractionDigits:n}).format(f);if(l<n&&n>0){const E=h.indexOf(".");if(E>=0){const x=h.substring(0,E);let k=h.substring(E+1);k=k.replace(/0+$/,""),k.length<l&&(k=k+"0".repeat(l-k.length)),h=k?`${x}.${k}`:x}}return`${d?"-":""}${h}`}function nr(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const l=Math.floor(Math.log10(Math.abs(e))),o=e/Math.pow(10,l),a=lr(o,n,n,!1,1),i=(l>=0?"+":"-")+String(Math.abs(l)).padStart(2,"0");return`${a}E${i}`}function ka(e,n,l){if(!l.hasDigits)return er(l.prefix+l.suffix);const o=l.scale===100?e*100:e,a=l.scientific?nr(o,l.decimals):lr(o,l.decimals,l.minDecimals,l.thousands,l.minIntDigits);return n+l.prefix+a+l.suffix}function Ea(e,n){const l=n.sections;if(l.length===0)return String(e);let o,a,i="";return e>0?(o=l[0],a=e):e<0?l[1]?(o=l[1],a=-e):(o=l[0],a=-e,i="-"):(o=l[2]??l[0],a=0),ka(a,i,o)}function Ra(e){return new Date((e-25569)*864e5)}const Sa=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Ma=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],or=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Ba=["January","February","March","April","May","June","July","August","September","October","November","December"],Ta=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function En(e,n){return String(e).padStart(n,"0")}function Na(e,n,l,o){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),d=e.getUTCDay(),f=l==="zh-CN";let y="",h=!1;for(const u of n)switch(u.type){case"literal":y+=u.text??"";break;case"year":y+=u.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":y+=En(h?e.getUTCMinutes():i,u.len);break;case"monthName":y+=u.len>=4?f?Sa[i-1]:Ba[i-1]:f?Ma[i-1]:Ta[i-1];break;case"day":y+=En(r,u.len);break;case"weekday":y+=u.len>=4?f?or[d]:rr[d]:f?or[d].slice(2):rr[d].slice(0,3);break;case"hour":{let E=e.getUTCHours();if(u.len===0){const x=Math.floor(o*86400);E=Math.floor(x/3600)}y+=String(E),h=!0;break}case"minute":y+=En(e.getUTCMinutes(),u.len);break;case"second":y+=En(e.getUTCSeconds(),u.len);break;case"ampm":{const E=e.getUTCHours();y+=E<12?f?"上午":"AM":f?"下午":"PM";break}}return y}function xa(e,n){const l=Math.floor(e*86400),o=Math.floor(l/3600),a=Math.floor(l%3600/60),i=l%60;let r="";for(const d of n)switch(d.type){case"literal":r+=d.text??"";break;case"hour":r+=String(o);break;case"minute":r+=En(a,d.len||2);break;case"second":r+=En(i,d.len||2);break;default:r+=""}return r}function Da(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const l=Math.abs(n);return l!==0&&(l>=1e15||l<1e-9)?nr(n,9):e}return e}function yl(e,n,l){if(sl(n))return Da(e);if(n==null||n===il)return e;const o=Ul(n);if(o.kind==="date"||o.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(o.kind==="date"){if(i<wo||i>Co)return Gn}else if(i<0)return Gn;return o.kind==="duration"?xa(i,o.tokens):Na(Ra(i),o.tokens,l,i)}const a=Number(e);return isNaN(a)?e:Ea(a,o)}const Va=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function ko(e,n){if(n===il||n==="@")return!1;if(sl(n)){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}const l=Ul(n);return!!(l.kind==="number"&&ar(l))}function ar(e){return e.sections.some(n=>n.hasDigits)}function ir(e){if(e==null||sl(e)||e===il||e==="@")return!1;const n=Ul(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&ar(n))}function sr(e,n){if(n==null||sl(n)||n===il||n==="@")return!1;const l=Ul(n),o=Number(e);return Number.isFinite(o)?l.kind==="date"?o<wo||o>Co:l.kind==="duration"?o<0:!1:!1}const Eo=30,Ro=0;function Cl(e){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}function cr(e,n){if(e==null||e===Tl||sl(e))return Cl(n);if(e===il)return!1;const l=Ul(e);return l.kind==="date"||l.kind==="duration"?!1:l.sections.some(o=>o.hasDigits)}function Fa(e){if(!Cl(e))return 0;const n=String(Number(e));return n.indexOf(".")<0||/e/i.test(n)?0:n.slice(n.indexOf(".")+1).length}function Ia(e,n){if(!cr(e,n))return-1;if(e==null||e===Tl||sl(e))return Fa(n);const o=Ul(e).sections.find(a=>a.hasDigits);return o?o.decimals:-1}function Aa(e,n){let l=0;const o=/\[[^\]]*\]/g;let a;for(;(a=o.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)l=a.index+a[0].length;const i=e.slice(0,l),r=e.slice(l),d=r.search(/[0#?]/);if(d===-1)return e;let f=-1;for(let Y=r.length-1;Y>=0;Y--){const ne=r[Y];if(ne==="0"||ne==="#"||ne==="?"||ne==="E"){f=Y;break}}if(f<d)return e;const y=r.slice(d,f+1),h=y.search(/E[+-]/i),u=h>=0?y.slice(0,h):y,E=u.indexOf("."),x=E>=0?(u.slice(E+1).match(/[0#?]/g)||[]).length:0;if(x===n)return e;let k;if(E<0)k=n>0?u+"."+"0".repeat(n):u;else if(n>x)k=u+"0".repeat(n-x);else{let Y=x-n;const ne=u.split("");for(let ee=ne.length-1;ee>=0&&Y>0;ee--){const M=ne[ee];(M==="0"||M==="#"||M==="?")&&(ne.splice(ee,1),Y--)}k=ne.join(""),n===0&&k.endsWith(".")&&(k=k.slice(0,-1))}const H=k+(h>=0?y.slice(h):"");return i+r.slice(0,d)+H+r.slice(f+1)}function _a(e,n){if(!Number.isInteger(n)||n<Ro||n>Eo||e===Tl)return null;if(e==null||sl(e))return n>0?"0."+"0".repeat(n):"0";if(e===il)return null;const l=Ul(e);return l.kind==="date"||l.kind==="duration"||!l.sections.some(o=>o.hasDigits)?null:e.split(";").map(o=>Aa(o,n)).join(";")}const So=["¥","$","€","£"];function dr(e,n){if(e==null||e===Tl)return e??Pl;if(sl(e))return Pl;if(e===il||e==="@")return il;const l=vo(n),o=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=`${l}#,##0.00;(${l}#,##0.00);${l}"-"`,r="#,##0.00;[Red](#,##0.00)";if(ur(n).some(x=>x.value===e))return e;const f=e.replace(/\[[^\]]*\]/gi,x=>/^\[(h|mm|ss)\]$/i.test(x)?x:"");if(/\[(h|mm|ss)\]/i.test(f)&&!/[yd]/i.test(f))return"[h]:mm:ss";const y=/[yd]/i.test(f),h=/h|s|AM\/PM/i.test(f);if(y&&h)return a;if(y||/AM\/PM/i.test(f))return o;if(h)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 u=So.find(x=>e.startsWith(x));if(u)return e.includes("(")?i:/\.\d/.test(e.slice(u.length))?l+"#,##0.00":l+"#,##0";const E=Ul(e);return E.kind==="number"&&E.sections.some(x=>x.hasDigits)?"#,##0.00":Wl}function La(e,n){return new Date(Date.UTC(e,n,0)).getUTCDate()}function Oa(e,n,l){const o=Date.UTC(e,n-1,l)/864e5+25569;return o<=60?o-1:o}function Nl(e,n,l=new Date){const o=e.trim();if(!o||o.startsWith("=")||Cl(o))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 d(E){const x=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(E);if(!x)return null;const k=Number(x[1]),H=Number(x[2]),Y=x[3]!==void 0?Number(x[3]):0;return k>23||H>59||Y>59?null:(k*3600+H*60+Y)/86400}function f(E){let x=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(E),k,H,Y;if(x)k=Number(x[1]),H=Number(x[2]),Y=Number(x[3]);else if(x=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(E))k=Number(x[1]),H=Number(x[2]),Y=Number(x[3]);else if(x=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(E))H=Number(x[1]),Y=Number(x[2]),k=Number(x[3]);else if(x=/^(\d{1,2})[-/](\d{1,2})$/.exec(E))k=l.getUTCFullYear(),H=Number(x[1]),Y=Number(x[2]);else return null;if(k<1900||k>9999||H<1||H>12||Y<1||Y>La(k,H))return null;const ne=Oa(k,H,Y);return ne>=wo&&ne<=Co?ne:null}const y=d(o);if(y!==null)return{serial:y,format:r};const h=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(o);if(h){const E=f(h[1].trim()),x=d(h[2]);if(E!==null&&x!==null)return{serial:E+x,format:i}}const u=f(o);return u!==null?{serial:u,format:a}:null}function qn(e,n){const l=e.trim();if(!l||l.startsWith("=")||!(l.includes(",")||l.includes("%")||So.some(ee=>l.startsWith(ee)))||Nl(l,n))return null;const a=So.find(ee=>l.startsWith(ee)),i=a?l.slice(a.length).trim():l;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const d=r[1]==="-"?-1:1,f=r[2].replace(/,/g,""),y=r[3],h=(r[4]??"")==="%",u=y?y.length:0,E=+(f+(y?"."+y:""));if(!Number.isFinite(E))return null;const k=i.includes(",")?"#,##0":"0",H=u>0?"."+"0".repeat(u):"",Y=(a??"")+k+H+(h?"%":"");let ne=E*d;return h&&(ne=ne/100),ne=Math.round(ne*1e12)/1e12,{num:ne,format:Y}}function $a(e,n,l,o){const a=vo(e),i=o?"#,##0":"0",r=l>0?"."+"0".repeat(l):"",d=i+r;switch(n){case"general":return"";case"text":return il;case"custom":return"";case"number":return d;case"percent":return d+"%";case"scientific":return"0."+"0".repeat(l)+"E+00";case"currency":return a+d;case"currencyRounded":return a+(o?"#,##0":"0");case"accounting":return`${a}${d};(${a}${d});${a}"-"`;case"financial":return`${d};[Red](${d})`;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 ur(e){const n=vo(e);return[{label:b(e,"nfGeneral"),value:Pl},{label:b(e,"nfText"),value:il},{label:b(e,"nfNumber"),value:"#,##0.00"},{label:b(e,"nfPercent"),value:"0.00%"},{label:b(e,"nfScientific"),value:"0.00E+00"},{label:b(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:b(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:b(e,"nfCurrency"),value:n+"#,##0.00"},{label:b(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:b(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:b(e,"nfTime"),value:"h:mm:ss"},{label:b(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:b(e,"nfDuration"),value:"[h]:mm:ss"},{label:b(e,"nfCustom"),value:Wl}]}const Ha=["title"],za=["innerHTML"],Wa={class:"sp-dropdown__value"},Pa=["disabled"],Ua=["placeholder"],Ka=["disabled","onClick"],Ga=["innerHTML"],qa={class:"sp-dropdown__item-label"},Ya={key:2,class:"sp-dropdown__empty"},Xa=["disabled"],ja=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:""},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:""},triggerIcon:{default:""},triggerLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(0),r=t.ref(null),d=t.ref(null),f=t.ref(null),y=t.ref({top:0,up:!1}),h=t.ref(void 0),u=t.ref(0),E=t.ref(!1),x=t.ref(""),k=t.ref(null),H=t.computed(()=>l.options.find(Q=>String(Q.value)===String(l.modelValue))),Y=t.computed(()=>l.menuWidth!==void 0?l.menuWidth:h.value),ne=t.computed(()=>{if(!l.searchable||!x.value.trim())return l.options;const Q=x.value.trim().toLowerCase();return l.options.filter(ke=>String(ke.label??"").toLowerCase().includes(Q))}),ee=t.computed(()=>ne.value.length>0),M=t.computed(()=>Math.min(l.visibleCount,ne.value.length)),se=t.computed(()=>ne.value.slice(i.value,i.value+M.value)),X=t.computed(()=>i.value>0),te=t.computed(()=>i.value+M.value<ne.value.length),Ne=t.computed(()=>ne.value.length>M.value);function ze(Q){i.value=Math.max(0,Math.min(ne.value.length-M.value,i.value+Q))}function Ve(){const Q=l.triggerEl??r.value;if(!Q)return;const ke=Q.getBoundingClientRect();h.value=ke.width,a.value=!0,l.searchable&&(x.value=""),l.modelOpen!==void 0&&o("update:modelOpen",!0);const B=ke.bottom+4;l.align==="right"?y.value={right:window.innerWidth-ke.right,top:B,up:!1}:y.value={left:ke.left,top:B,up:!1};const oe=ne.value.findIndex(Z=>String(Z.value)===String(l.modelValue));i.value=oe>=0?Math.max(0,Math.min(oe-Math.floor(M.value/2),ne.value.length-M.value)):0,l.searchable&&t.nextTick(()=>{var Z;return(Z=k.value)==null?void 0:Z.focus()}),t.nextTick(()=>{const Z=l.triggerEl??r.value;if(!Z)return;const re=Z.getBoundingClientRect(),K=f.value;if(!K)return;const L=K.offsetHeight,J=window.innerHeight-re.bottom-8,$=re.top-8,U=J<L&&$>0;let de=U?re.top-L-4:re.bottom+4;de=Math.max(8,Math.min(window.innerHeight-L-8,de)),l.align==="right"?y.value={right:window.innerWidth-re.right,top:de,up:U}:y.value={left:re.left,top:de,up:U}})}function Fe(){a.value=!1,x.value="",l.modelOpen!==void 0&&o("update:modelOpen",!1)}function je(){a.value?Fe():Ve()}function _e(Q){Q.disabled||(o("update:modelValue",Q.value),o("change",Q.value),Fe())}function F(Q){var B,oe;if(!a.value)return;const ke=Q.target;(B=r.value)!=null&&B.contains(ke)||(oe=f.value)!=null&&oe.contains(ke)||Fe()}function I(Q){a.value&&(Q.preventDefault(),ze(Q.deltaY>0?1:-1))}t.watch(a,Q=>{t.nextTick(()=>{var ke,B;Q?((ke=d.value)==null||ke.addEventListener("wheel",I,{passive:!1}),document.addEventListener("keydown",G)):((B=d.value)==null||B.removeEventListener("wheel",I),document.removeEventListener("keydown",G))})});function G(Q){a.value&&Q.key==="Escape"&&Fe()}t.watch(()=>l.modelOpen,Q=>{Q!==void 0&&Q!==a.value&&(Q?Ve():Fe())});function Ce(Q){a.value&&(u.value=Q.touches[0].clientY,E.value=!0)}function $e(Q){if(!a.value||!E.value)return;const ke=Q.touches[0].clientY-u.value;Math.abs(ke)>5&&(ze(ke<0?1:-1),u.value=Q.touches[0].clientY)}function j(){E.value=!1}function Be(Q){Q.key==="Escape"&&(Q.stopPropagation(),Fe())}return t.onMounted(()=>{document.addEventListener("pointerdown",F),window.addEventListener("resize",Fe),window.addEventListener("scroll",Fe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",G),window.removeEventListener("resize",Fe),window.removeEventListener("scroll",Fe,!0)}),(Q,ke)=>{var B,oe,Z,re,K;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:je},[(B=H.value)!=null&&B.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((oe=H.value)==null?void 0:oe.icon)||e.triggerIcon},null,8,za)):t.createCommentVNode("",!0),t.createElementVNode("span",Wa,t.toDisplayString((Z=H.value)!=null&&Z.icon||e.triggerIcon?((re=H.value)==null?void 0:re.label)??e.triggerLabel:((K=H.value)==null?void 0:K.label)??e.fallbackLabel),1),ke[5]||(ke[5]=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,Ha)),(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:f,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:Y.value!==void 0?typeof Y.value=="number"?Y.value+"px":Y.value:void 0}),onKeydown:Be,onMousedown:ke[4]||(ke[4]=t.withModifiers(()=>{},["prevent"]))},[Ne.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!X.value}]),disabled:!X.value,onClick:ke[0]||(ke[0]=L=>ze(-1))},[...ke[6]||(ke[6]=[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,Pa)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:k,"onUpdate:modelValue":ke[1]||(ke[1]=L=>x.value=L),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:ke[2]||(ke[2]=t.withModifiers(()=>{},["stop"]))},null,40,Ua)),[[t.vModelText,x.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"sp-dropdown__list",onTouchstart:Ce,onTouchmove:$e,onTouchend:j},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se.value,L=>(t.openBlock(),t.createElementBlock("button",{key:String(L.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!L.disabled&&String(L.value)===String(e.modelValue),"sp-dropdown__item--disabled":L.disabled}]),disabled:L.disabled,onClick:J=>_e(L)},[L.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:L.icon},null,8,Ga)):t.createCommentVNode("",!0),t.createElementVNode("span",qa,t.toDisplayString(L.label),1)],10,Ka))),128))],544),e.searchable&&!ee.value?(t.openBlock(),t.createElementBlock("div",Ya," 无匹配 ")):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!te.value}]),disabled:!te.value,onClick:ke[3]||(ke[3]=L=>ze(1))},[...ke[7]||(ke[7]=[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,Xa)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),St=(e,n)=>{const l=e.__vccOpts||e;for(const[o,a]of n)l[o]=a;return l},Dt=St(ja,[["__scopeId","data-v-391d39ca"]]),Za=["title","onClick"],Yn=St(t.defineComponent({__name:"color-picker",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:l}){const o=e,a=l,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"}]],d=t.computed(()=>o.colorKey==="fill"?r:i);function f(ee){return b(o.locale,ee)}function y(ee){const M=o.currentColor;return!M&&!ee?!0:M?M.toLowerCase()===ee.toLowerCase():!1}const h=t.ref(!1),u=t.ref(null),E=t.ref(null),x=t.ref({top:0});t.watch(()=>o.modelOpen,ee=>{ee!==void 0&&ee!==h.value&&(ee?H():Y())});function k(ee){const M=u.value,se=E.value,X=ee.target;M&&M.contains(X)||se&&se.contains(X)||Y()}function H(){const ee=o.triggerEl??u.value;if(!ee)return;h.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const M=ee.getBoundingClientRect();let se=window.innerWidth-M.right;const X=120;let te;M.left-X<4&&(se=void 0,te=Math.max(4,M.left)),x.value=se!==void 0?{right:se,top:M.bottom+4}:{left:te,top:M.bottom+4},t.nextTick(()=>{const Ne=o.triggerEl??u.value;if(!Ne)return;const ze=Ne.getBoundingClientRect(),Ve=E.value;if(!Ve)return;const Fe=Ve.offsetHeight,je=window.innerHeight-ze.bottom-8,_e=ze.top-8;let I=je<Fe&&_e>0?ze.top-Fe-4:ze.bottom+4;I=Math.max(4,Math.min(window.innerHeight-Fe-4,I)),x.value=se!==void 0?{right:window.innerWidth-ze.right,top:I}:{left:te,top:I},document.addEventListener("pointerdown",k)})}function Y(){h.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function ne(ee){a("update:modelValue",ee),a("change",ee),Y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),n({open:h,openMenu:H,close:Y}),(ee,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:u,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[h.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:E,class:"color-picker__menu",style:t.normalizeStyle({left:x.value.left!==void 0?x.value.left+"px":void 0,right:x.value.right!==void 0?x.value.right+"px":void 0,top:x.value.top+"px"}),onMousedown:M[0]||(M[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(se,X)=>(t.openBlock(),t.createElementBlock("div",{key:X,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se,te=>(t.openBlock(),t.createElementBlock("button",{key:te.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":y(te.value)}]),title:f(te.key),style:t.normalizeStyle({background:te.value||"transparent",border:te.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Ne=>ne(te.value)},null,14,Za))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-34b2d484"]]),Ja=["title","onClick"],Qa={viewBox:"0 0 30 30",class:"border-picker__icon"},ei=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],ti={class:"border-picker__label"},li=St(t.defineComponent({__name:"border-picker",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:l}){const o=e,a=l,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}],d={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"]},f={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function y(ee,M){return f[ee].includes(M)?"thick":d[ee].includes(M)?"solid":"dashed"}const h=t.ref(!1),u=t.ref(null),E=t.ref(null),x=t.ref({top:0});t.watch(()=>o.modelOpen,ee=>{ee!==void 0&&ee!==h.value&&(ee?H():Y())});function k(ee){const M=u.value,se=E.value,X=ee.target;M&&M.contains(X)||se&&se.contains(X)||Y()}function H(){const ee=o.triggerEl??u.value;if(!ee)return;h.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const M=ee.getBoundingClientRect();let se=window.innerWidth-M.right;const X=160;let te;M.left-X<4&&(se=void 0,te=Math.max(4,M.left)),x.value=se!==void 0?{right:se,top:M.bottom+4}:{left:te,top:M.bottom+4},t.nextTick(()=>{const Ne=o.triggerEl??u.value;if(!Ne)return;const ze=Ne.getBoundingClientRect(),Ve=E.value;if(!Ve)return;const Fe=Ve.offsetHeight,je=window.innerHeight-ze.bottom-8,_e=ze.top-8;let I=je<Fe&&_e>0?ze.top-Fe-4:ze.bottom+4;I=Math.max(4,Math.min(window.innerHeight-Fe-4,I)),x.value=se!==void 0?{right:window.innerWidth-ze.right,top:I}:{left:te,top:I},document.addEventListener("pointerdown",k)})}function Y(){h.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function ne(ee){a("change",ee),Y()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),n({open:h,openMenu:H,close:Y}),(ee,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:u,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[h.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:E,class:"border-picker__menu",style:t.normalizeStyle({left:x.value.left!==void 0?x.value.left+"px":void 0,right:x.value.right!==void 0?x.value.right+"px":void 0,top:x.value.top+"px"}),onMousedown:M[0]||(M[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,se=>t.createElementVNode("button",{key:se.key,class:"border-picker__item",title:t.unref(b)(e.locale,se.i18nKey),onClick:X=>ne(se.key)},[(t.openBlock(),t.createElementBlock("svg",Qa,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,X=>t.createElementVNode("line",{key:X.name,x1:X.x1,y1:X.y1,x2:X.x2,y2:X.y2,stroke:"currentColor","stroke-width":y(se.key,X.name)==="thick"?3:1.5,"stroke-dasharray":y(se.key,X.name)==="dashed"?"0 4":"none","stroke-linecap":y(se.key,X.name)==="dashed"?"round":"square"},null,8,ei)),64))])),t.createElementVNode("span",ti,t.toDisplayString(t.unref(b)(e.locale,se.i18nKey)),1)],8,Ja)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-a6e24710"]]),ni=["title","onClick"],oi={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},ri=["x1","y1","x2","y2"],ai=["d"],ii={class:"sort-picker__label"},si=St(t.defineComponent({__name:"sort-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],r=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],d={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},f=t.ref(!1),y=t.ref(null),h=t.ref(null),u=t.ref({top:0});t.watch(()=>o.modelOpen,Y=>{Y!==void 0&&Y!==f.value&&(Y?x():k())});function E(Y){const ne=y.value,ee=h.value,M=Y.target;ne&&ne.contains(M)||ee&&ee.contains(M)||k()}function x(){const Y=o.triggerEl??y.value;if(!Y)return;f.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const ne=Y.getBoundingClientRect();let ee=window.innerWidth-ne.right;const M=160;let se;ne.left-M<4&&(ee=void 0,se=Math.max(4,ne.left)),u.value=ee!==void 0?{right:ee,top:ne.bottom+4}:{left:se,top:ne.bottom+4},t.nextTick(()=>{const X=o.triggerEl??y.value;if(!X)return;const te=X.getBoundingClientRect(),Ne=h.value;if(!Ne)return;const ze=Ne.offsetHeight,Ve=window.innerHeight-te.bottom-8,Fe=te.top-8;let _e=Ve<ze&&Fe>0?te.top-ze-4:te.bottom+4;_e=Math.max(4,Math.min(window.innerHeight-ze-4,_e)),u.value=ee!==void 0?{right:window.innerWidth-te.right,top:_e}:{left:se,top:_e},document.addEventListener("pointerdown",E)})}function k(){f.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",E)}function H(Y){a("change",Y),k()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",E)}),n({open:f,openMenu:x,close:k}),(Y,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[f.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:h,class:"sort-picker__menu",style:t.normalizeStyle({left:u.value.left!==void 0?u.value.left+"px":void 0,right:u.value.right!==void 0?u.value.right+"px":void 0,top:u.value.top+"px"}),onMousedown:ne[0]||(ne[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ee=>t.createElementVNode("button",{key:ee.key,class:"sort-picker__item",title:t.unref(b)(e.locale,ee.i18nKey),onClick:M=>H(ee.key)},[(t.openBlock(),t.createElementBlock("svg",oi,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,M=>t.createElementVNode("line",{key:M.name,x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2},null,8,ri)),64)),t.createElementVNode("path",{d:d[ee.key]},null,8,ai)])),t.createElementVNode("span",ii,t.toDisplayString(t.unref(b)(e.locale,ee.i18nKey)),1)],8,ni)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-a6111c69"]]),ci=["title","onClick"],di=["innerHTML"],ui={class:"merge-picker__label"},fi=St(t.defineComponent({__name:"merge-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=t.ref(!1),r=t.ref(null),d=t.ref(null),f=t.ref({top:0});t.watch(()=>o.modelOpen,x=>{x!==void 0&&x!==i.value&&(x?h():u())});function y(x){const k=r.value,H=d.value,Y=x.target;k&&k.contains(Y)||H&&H.contains(Y)||u()}function h(){const x=o.triggerEl??r.value;if(!x)return;i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const k=x.getBoundingClientRect();let H=window.innerWidth-k.right;const Y=160;let ne;k.left-Y<4&&(H=void 0,ne=Math.max(4,k.left)),f.value=H!==void 0?{right:H,top:k.bottom+4}:{left:ne,top:k.bottom+4},t.nextTick(()=>{const ee=o.triggerEl??r.value;if(!ee)return;const M=ee.getBoundingClientRect(),se=d.value;if(!se)return;const X=se.offsetHeight,te=window.innerHeight-M.bottom-8,Ne=M.top-8;let Ve=te<X&&Ne>0?M.top-X-4:M.bottom+4;Ve=Math.max(4,Math.min(window.innerHeight-X-4,Ve)),f.value=H!==void 0?{right:window.innerWidth-M.right,top:Ve}:{left:ne,top:Ve},document.addEventListener("pointerdown",y)})}function u(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",y)}function E(x){a("change",x),u()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y)}),n({open:i,openMenu:h,close:u}),(x,k)=>(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:d,class:"merge-picker__menu",style:t.normalizeStyle({left:f.value.left!==void 0?f.value.left+"px":void 0,right:f.value.right!==void 0?f.value.right+"px":void 0,top:f.value.top+"px"}),onMousedown:k[0]||(k[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ha),H=>(t.openBlock(),t.createElementBlock("button",{key:H.key,class:"merge-picker__item",title:t.unref(b)(e.locale,H.labelKey),onClick:Y=>E(H.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:H.icon},null,8,di),t.createElementVNode("span",ui,t.toDisplayString(t.unref(b)(e.locale,H.labelKey)),1)],8,ci))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-78cf6d86"]]),mi=["title","disabled"],pi={class:"cf-menu-trigger__label"},hi=["disabled"],gi=["disabled"],bi=["disabled"],yi=["disabled"],Ci=["disabled"],wi=["disabled"],vi=["disabled"],ki=["onClick"],Ei=["disabled"],Ri=["disabled"],Si=["disabled"],Mi=["disabled"],Bi=St(t.defineComponent({__name:"conditional-format-menu",props:{locale:{},hasSelection:{type:Boolean},themeVars:{default:()=>({})}},emits:["preset","new-rule","manage","clear"],setup(e,{emit:n}){const l=n,o=t.ref(null),a=t.ref(null),i=t.ref(null),r=t.ref(null),d=t.ref(null),f=t.ref(!1),y=t.ref(null),h=t.ref("right"),u=t.ref("right"),E=t.ref({right:0,top:0,up:!1}),x=t.ref(!1),k=t.ref(!1),H=t.ref(!1),Y=t.ref(!1),ne=t.ref(!1),ee=t.ref(!1),M=t.ref({top:0}),se=t.ref({top:0});let X;const te=[{type:"equal",key:"cfEqual"},{type:"notEqual",key:"cfNotEqual"},{type:"greaterThan",key:"cfGreaterThan"},{type:"greaterThanOrEqual",key:"cfGreaterThanOrEqual"},{type:"lessThan",key:"cfLessThan"},{type:"lessThanOrEqual",key:"cfLessThanOrEqual"},{type:"between",key:"cfBetween"},{type:"notBetween",key:"cfNotBetween"},{type:"textContains",key:"cfTextContains"},{type:"textNotContains",key:"cfTextNotContains"}];function Ne(){f.value?Ve():ze()}function ze(){const K=a.value;if(!K)return;const L=K.getBoundingClientRect();f.value=!0,y.value=null,E.value={right:window.innerWidth-L.right,top:L.bottom+4,up:!1},t.nextTick(()=>{var Ie;const J=(Ie=i.value)==null?void 0:Ie.closest(".cf-menu");if(!J)return;const $=J.offsetHeight,U=window.innerHeight-L.bottom-8,de=L.top-8,Le=U<$&&de>0;let ve=Le?L.top-$-4:L.bottom+4;ve=Math.max(8,Math.min(window.innerHeight-$-8,ve)),E.value={right:window.innerWidth-L.right,top:ve,up:Le},Fe()})}function Ve(){f.value=!1,clearTimeout(X),y.value=null}function Fe(){const K=i.value;K&&(x.value=K.scrollTop>1,k.value=K.scrollTop+K.clientHeight<K.scrollHeight-1)}function je(K){const L=i.value;L&&(L.scrollTop=Math.max(0,Math.min(L.scrollHeight-L.clientHeight,L.scrollTop+K*30)))}function _e(K){const L=K==="highlight"?r.value:d.value;if(!L)return;const J=L.scrollTop>1,$=L.scrollTop+L.clientHeight<L.scrollHeight-1;K==="highlight"?(H.value=J,Y.value=$):(ne.value=J,ee.value=$)}function F(K,L){const J=K==="highlight"?r.value:d.value;J&&(J.scrollTop=Math.max(0,Math.min(J.scrollHeight-J.clientHeight,J.scrollTop+L*30)))}function I(K,L){K&&(K.scrollHeight<=K.clientHeight||(L.preventDefault(),K.scrollTop=Math.max(0,Math.min(K.scrollHeight-K.clientHeight,K.scrollTop+L.deltaY))))}function G(K){I(i.value,K),Fe()}function Ce(K){I(r.value,K),_e("highlight")}function $e(K){I(d.value,K),_e("clear")}function j(K){var J,$,U,de,Le,ve;if(!f.value)return;const L=K.target;(J=o.value)!=null&&J.contains(L)||($=i.value)!=null&&$.contains(L)||(de=(U=r.value)==null?void 0:U.closest(".cf-submenu-wrap"))!=null&&de.contains(L)||(ve=(Le=d.value)==null?void 0:Le.closest(".cf-submenu-wrap"))!=null&&ve.contains(L)||Ve()}function Be(K,L){clearTimeout(X),y.value=K,t.nextTick(()=>{var ge,et;const J=(L==null?void 0:L.currentTarget)instanceof HTMLElement?L.currentTarget:null;if(!J)return;const $=J.getBoundingClientRect(),U=K==="highlight"?(ge=r.value)==null?void 0:ge.closest(".cf-submenu-wrap"):(et=d.value)==null?void 0:et.closest(".cf-submenu-wrap");if(!U)return;const de=U.offsetWidth,Le=$.right+de+8>window.innerWidth,ve=$.left-de-8<0;let Ie="right";(Le&&!ve||Le&&ve)&&(Ie="left"),K==="highlight"?h.value=Ie:u.value=Ie;const Ee=Math.max(8,Math.min(window.innerHeight-30,$.top-4)),He=Ie==="right"?{left:$.right+4,top:Ee}:{right:window.innerWidth-$.left+4,top:Ee};K==="highlight"?M.value=He:se.value=He,_e(K)})}function Q(){clearTimeout(X),X=setTimeout(()=>{y.value=null},150)}function ke(){clearTimeout(X)}function B(K){l("preset",K),Ve()}function oe(){l("new-rule"),Ve()}function Z(){l("manage"),Ve()}function re(K){l("clear",K),Ve()}return t.onMounted(()=>{document.addEventListener("pointerdown",j),window.addEventListener("resize",Ve),window.addEventListener("scroll",Ve,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",j),window.removeEventListener("resize",Ve),window.removeEventListener("scroll",Ve,!0)}),(K,L)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:o,class:"cf-menu-root"},[t.createElementVNode("button",{ref_key:"btnRef",ref:a,type:"button",class:"toolbar-btn cf-menu-trigger",title:t.unref(b)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:Ne},[L[22]||(L[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-7b3d8228><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-7b3d8228></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-7b3d8228></path><path d="M324.022857 109.714286v674.596571h-73.142857V109.714286zM584.850286 109.714286v341.942857h-73.142857V109.714286zM1060.278857 512h-658.285714v475.428571h658.285714V512z m-73.216 73.142857v329.142857h-512V585.142857h512z" data-v-7b3d8228></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-7b3d8228></path></svg>',1)),t.createElementVNode("span",pi,t.toDisplayString(t.unref(b)(e.locale,"conditionalFormat")),1),L[23]||(L[23]=t.createElementVNode("svg",{class:"cf-menu-trigger__caret",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,mi),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[f.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:E.value.right+"px",top:E.value.top+"px"}),onClick:L[8]||(L[8]=t.withModifiers(()=>{},["stop"])),onMousedown:L[9]||(L[9]=t.withModifiers(()=>{},["prevent"]))},[x.value||k.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!x.value}]),disabled:!x.value,onClick:L[0]||(L[0]=J=>je(-1))},[...L[24]||(L[24]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,hi)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:i,class:"cf-menu__body",onScroll:Fe,onWheelPassive:G},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:L[1]||(L[1]=J=>Be("highlight",J)),onMouseleave:Q},[t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"cfHighlightRules")),1),L[25]||(L[25]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32),L[27]||(L[27]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[2]||(L[2]=J=>e.hasSelection&&B("blank"))},t.toDisplayString(t.unref(b)(e.locale,"cfBlank")),11,gi),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[3]||(L[3]=J=>e.hasSelection&&B("notBlank"))},t.toDisplayString(t.unref(b)(e.locale,"cfNotBlank")),11,bi),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[4]||(L[4]=J=>e.hasSelection&&B("duplicate"))},t.toDisplayString(t.unref(b)(e.locale,"cfDuplicate")),11,yi),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[5]||(L[5]=J=>e.hasSelection&&B("unique"))},t.toDisplayString(t.unref(b)(e.locale,"cfUnique")),11,Ci),L[28]||(L[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:oe},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:Z},t.toDisplayString(t.unref(b)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:L[6]||(L[6]=J=>Be("clear",J)),onMouseleave:Q},[t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"cfClearRules")),1),L[26]||(L[26]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32)],544),x.value||k.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!k.value}]),disabled:!k.value,onClick:L[7]||(L[7]=J=>je(1))},[...L[29]||(L[29]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,wi)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[f.value&&y.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":h.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:M.value.left!==void 0?M.value.left+"px":void 0,right:M.value.right!==void 0?M.value.right+"px":void 0,top:M.value.top+"px"}),onClick:L[13]||(L[13]=t.withModifiers(()=>{},["stop"])),onMousedown:L[14]||(L[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ke,onMouseleave:Q},[H.value||Y.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!H.value}]),disabled:!H.value,onClick:L[10]||(L[10]=J=>F("highlight",-1))},[...L[30]||(L[30]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,vi)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:r,class:"cf-submenu",onScroll:L[11]||(L[11]=J=>_e("highlight")),onWheelPassive:Ce},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(te,J=>t.createElementVNode("button",{key:J.type,type:"button",class:"cf-menu__subitem",onClick:$=>B(J.type)},t.toDisplayString(t.unref(b)(e.locale,J.key)),9,ki)),64))],544),H.value||Y.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Y.value}]),disabled:!Y.value,onClick:L[12]||(L[12]=J=>F("highlight",1))},[...L[31]||(L[31]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,Ei)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[f.value&&y.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":u.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:se.value.left!==void 0?se.value.left+"px":void 0,right:se.value.right!==void 0?se.value.right+"px":void 0,top:se.value.top+"px"}),onClick:L[20]||(L[20]=t.withModifiers(()=>{},["stop"])),onMousedown:L[21]||(L[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ke,onMouseleave:Q},[ne.value||ee.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ne.value}]),disabled:!ne.value,onClick:L[15]||(L[15]=J=>F("clear",-1))},[...L[32]||(L[32]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,Ri)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:d,class:"cf-submenu",onScroll:L[18]||(L[18]=J=>_e("clear")),onWheelPassive:$e},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__subitem",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:L[16]||(L[16]=J=>e.hasSelection&&re("selection"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSelected")),11,Si),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:L[17]||(L[17]=J=>re("sheet"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSheet")),1)],544),ne.value||ee.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ee.value}]),disabled:!ee.value,onClick:L[19]||(L[19]=J=>F("clear",1))},[...L[33]||(L[33]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,Mi)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-7b3d8228"]]),Ti=["disabled","title","onClick"],Ni={class:"calc-picker__label"},xi=St(t.defineComponent({__name:"calc-picker",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:l}){const o=e,a=l,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),d=t.ref(null),f=t.ref(null),y=t.ref({top:0});t.watch(()=>o.modelOpen,k=>{k!==void 0&&k!==r.value&&(k?u():E())});function h(k){const H=d.value,Y=f.value,ne=k.target;H&&H.contains(ne)||Y&&Y.contains(ne)||E()}function u(){const k=o.triggerEl??d.value;if(!k)return;r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const H=k.getBoundingClientRect();let Y=window.innerWidth-H.right;const ne=160;let ee;H.left-ne<4&&(Y=void 0,ee=Math.max(4,H.left)),y.value=Y!==void 0?{right:Y,top:H.bottom+4}:{left:ee,top:H.bottom+4},t.nextTick(()=>{const M=o.triggerEl??d.value;if(!M)return;const se=M.getBoundingClientRect(),X=f.value;if(!X)return;const te=X.offsetHeight,Ne=window.innerHeight-se.bottom-8,ze=se.top-8;let Fe=Ne<te&&ze>0?se.top-te-4:se.bottom+4;Fe=Math.max(4,Math.min(window.innerHeight-te-4,Fe)),y.value=Y!==void 0?{right:window.innerWidth-se.right,top:Fe}:{left:ee,top:Fe},document.addEventListener("pointerdown",h)})}function E(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function x(k){o.disabled||(a("change",k),E())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),n({open:r,openMenu:u,close:E}),(k,H)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,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:f,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:H[0]||(H[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Y=>t.createElementVNode("button",{key:Y.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(b)(e.locale,Y.labelKey),onClick:ne=>x(Y.key)},[t.createElementVNode("span",Ni,t.toDisplayString(t.unref(b)(e.locale,Y.labelKey)),1)],10,Ti)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-d9e95ea2"]]),Di={class:"tb-item","data-key":"undo"},Vi=["title","disabled"],Fi={class:"toolbar-btn__label"},Ii={class:"tb-item","data-key":"redo"},Ai=["title","disabled"],_i={class:"toolbar-btn__label"},Li={class:"tb-item","data-key":"paint"},Oi=["title","disabled"],$i={class:"toolbar-btn__label"},Hi={class:"tb-item","data-key":"clear"},zi=["title","disabled"],Wi={class:"toolbar-btn__label"},Pi={class:"tb-item","data-key":"font"},Ui={class:"tb-item","data-key":"fontSize"},Ki={class:"toolbar-font-size"},Gi=["value","title"],qi=["title"],Yi=["title","disabled"],Xi=["title","disabled"],ji={class:"tb-item","data-key":"bold"},Zi=["title","disabled"],Ji={class:"toolbar-btn__label"},Qi={class:"tb-item","data-key":"italic"},es=["title","disabled"],ts={class:"toolbar-btn__label"},ls={class:"tb-item","data-key":"underline"},ns=["title","disabled"],os={class:"toolbar-btn__label"},rs={class:"tb-item","data-key":"strike"},as=["title","disabled"],is={class:"toolbar-btn__label"},ss={class:"tb-item","data-key":"textColor"},cs={class:"toolbar-split"},ds=["title","disabled"],us={viewBox:"0 0 1024 1024",fill:"currentColor"},fs=["fill"],ms={class:"toolbar-btn__label"},ps=["title","disabled"],hs={class:"tb-item","data-key":"fillColor"},gs={class:"toolbar-split"},bs=["title","disabled"],ys={viewBox:"0 0 1024 1024",fill:"currentColor"},Cs=["fill"],ws={class:"toolbar-btn__label"},vs=["title","disabled"],ks={class:"tb-item","data-key":"border"},Es={class:"toolbar-split"},Rs=["title","disabled"],Ss={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Ms=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Bs={class:"toolbar-btn__label"},Ts=["title","disabled"],Ns={class:"tb-item","data-key":"hAlign"},xs={class:"tb-item","data-key":"vAlign"},Ds={class:"tb-item","data-key":"wrap"},Vs=["title"],Fs={class:"toolbar-btn__label"},Is={class:"tb-item","data-key":"merge"},As={class:"toolbar-split"},_s=["title","disabled"],Ls={class:"toolbar-btn__label"},Os=["title","disabled"],$s={class:"tb-item","data-key":"numFmt"},Hs={class:"toolbar-number-format-group"},zs=["title","disabled"],Ws=["title","disabled"],Ps={class:"tb-item","data-key":"calc"},Us={class:"toolbar-split"},Ks=["title","disabled"],Gs={class:"toolbar-btn__label"},qs=["title","disabled"],Ys={class:"tb-item","data-key":"sort"},Xs={class:"toolbar-split"},js=["title","disabled"],Zs={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Js=["x1","y1","x2","y2"],Qs=["d"],ec={class:"toolbar-btn__label"},tc=["title","disabled"],lc={class:"tb-item","data-key":"filter"},nc=["disabled","title"],oc={class:"toolbar-btn__label"},rc={class:"tb-item","data-key":"freeze"},ac={class:"tb-item","data-key":"cf"},ic={class:"tb-item","data-key":"dv"},sc=["title"],cc={class:"toolbar-btn__label"},dc={class:"tb-item","data-key":"find"},uc=["title"],fc={class:"toolbar-btn__label"},mc=["disabled"],pc=["disabled"],fr='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V416 H192 Z" /></svg>',hc='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path d="M192 192 H832 V416 H192 Z" /></svg>',gc='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V832 H192 Z" /></svg>',bc='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M224 224 L416 416" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M416 224 L224 416" /></svg>',Mo=2,yc=6,Cc=34,wc=St(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:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},freezePanesDisabled:{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","apply-sort","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","increase-decimals","decrease-decimals","toggle-filter","cf-new-rule","cf-manage","open-data-validation","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","freeze-change","cf-preset","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:sort-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","sort-change","merge-change","cf-clear"],setup(e,{expose:n,emit:l}){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}],a={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"]},i={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function r(Pe,N){return i[Pe].includes(N)?"thick":a[Pe].includes(N)?"solid":"dashed"}const d={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"},f=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],y={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},h=["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","sort","filter","freeze","cf","dv","find"],u=t.ref(null),E=t.ref(null),x=t.ref(null),k=t.ref(null),H=t.ref(null),Y=t.ref(null),ne=t.ref(null),ee=t.ref(null),M=t.ref(null),se=t.ref(null),X=t.ref(new Set),te=t.ref(!1),Ne=t.ref(!1),ze=t.ref(0),Ve=t.ref(!1),Fe=t.ref(!1),je=t.ref(!1),_e=new Map,F=t.computed(()=>X.value.size>0);function I(Pe){return X.value.has(Pe)}const G=t.computed(()=>{const Pe=E.value;return Pe instanceof HTMLElement?Pe:void 0});function Ce(Pe){return G.value?!I(Pe):!0}function $e(){for(const Pe of h){const N=_e.get(Pe);if(N===void 0||N===0)return!0}return!1}function j(){if(!u.value)return;u.value.querySelectorAll(".tb-item").forEach(N=>{const ie=N.dataset.key;if(!ie)return;const Rt=N.offsetWidth;Rt>0?_e.set(ie,Rt):_e.has(ie)||_e.set(ie,0)})}function Be(Pe,N){if(Pe.size!==N.size)return!1;for(const ie of Pe)if(!N.has(ie))return!1;return!0}let Q=0,ke=0;function B(){Q&&cancelAnimationFrame(Q),!(ke>60)&&(ke++,Q=requestAnimationFrame(()=>requestAnimationFrame(oe)))}function oe(){if(!u.value)return;const Pe=u.value.clientWidth-yc*2;if(Pe<=0){B();return}ke=0,(_e.size===0||$e())&&j();let N=0;for(const Rt of h)N+=(_e.get(Rt)??0)+Mo;const ie=new Set;if(N>Pe){const Rt=Pe-Cc-Mo;let ft=0;for(let Mt=0;Mt<h.length;Mt++){const Ft=h[Mt],It=(_e.get(Ft)??0)+Mo;if(ft+It>Rt){for(let Ot=Mt;Ot<h.length;Ot++)ie.add(h[Ot]);break}ft+=It}}Be(ie,X.value)||(X.value=ie,ze.value++,ie.size===0&&(te.value=!1)),je.value=!0}let Z=null;const re=t.ref(0),K=t.computed(()=>{const Pe=x.value,N={position:"fixed",top:"0px",right:"0px"};if(!Pe)return{...He.themeVars,...N};re.value;const ie=Pe.getBoundingClientRect();return{...He.themeVars,position:"fixed",top:`${ie.bottom+4}px`,right:`${window.innerWidth-ie.right}px`}});function L(){te.value&&(re.value++,t.nextTick(()=>oe()))}function J(Pe){var ie,Rt,ft;if(!te.value)return;const N=Pe.target;(ie=N.closest)!=null&&ie.call(N,".overflow-menu-wrap")||(Rt=x.value)!=null&&Rt.contains(N)||(ft=N.closest)!=null&&ft.call(N,".cf-menu, .sp-dropdown__menu, .color-picker__menu")||(Ne.value=!0,te.value=!1,t.nextTick(()=>{Ne.value=!1}))}function $(){te.value=!te.value,te.value&&t.nextTick(Ie)}function U(){te.value=!1,ge("open-data-validation")}function de(){te.value=!1,ge("find")}function Le(){te.value=!1,ge("toggle-filter")}function ve(){te.value=!1}function Ie(){const Pe=E.value;Pe&&(Ve.value=Pe.scrollTop>1,Fe.value=Pe.scrollTop+Pe.clientHeight<Pe.scrollHeight-1)}function Ee(Pe){const N=E.value;N&&(N.scrollTop=Math.max(0,Math.min(N.scrollHeight-N.clientHeight,N.scrollTop+Pe*40)))}n({closeOverflow:ve}),t.onMounted(()=>{B(),u.value&&(Z=new ResizeObserver(()=>{te.value||B()}),Z.observe(u.value)),document.addEventListener("pointerdown",J,!0),window.addEventListener("resize",L),window.addEventListener("load",B),window.addEventListener("orientationchange",B)}),t.onBeforeUnmount(()=>{Q&&cancelAnimationFrame(Q),Z==null||Z.disconnect(),document.removeEventListener("pointerdown",J,!0),window.removeEventListener("resize",L),window.removeEventListener("load",B),window.removeEventListener("orientationchange",B)});const He=e,ge=l,et=t.computed(()=>He.selNumberFormat===Tl?b(He.locale,"nfMixed"):""),ut=t.computed(()=>{const Pe=[{label:b(He.locale,"freezeFirstRow"),value:"firstRow",icon:hc},{label:b(He.locale,"freezeFirstCol"),value:"firstCol",icon:gc}];return He.hasFreeze?Pe.unshift({label:b(He.locale,"unfreezePanes"),value:"unfreeze",icon:bc}):Pe.unshift({label:b(He.locale,"freezePanes"),value:"panes",icon:fr,disabled:He.freezePanesDisabled}),Pe});return(Pe,N)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:u,class:t.normalizeClass(["toolbar",{"toolbar--ready":je.value}]),onMousedown:N[56]||(N[56]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("undo"),to:G.value},[t.createElementVNode("div",Di,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(b)(e.locale,"undo"),disabled:!e.canUndo,onClick:N[0]||(N[0]=ie=>ge("undo"))},[N[60]||(N[60]=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)),t.createElementVNode("span",Fi,t.toDisplayString(t.unref(b)(e.locale,"undo")),1)],10,Vi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("redo"),to:G.value},[t.createElementVNode("div",Ii,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(b)(e.locale,"redo"),disabled:!e.canRedo,onClick:N[1]||(N[1]=ie=>ge("redo"))},[N[61]||(N[61]=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)),t.createElementVNode("span",_i,t.toDisplayString(t.unref(b)(e.locale,"redo")),1)],10,Ai)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("paint"),to:G.value},[t.createElementVNode("div",Li,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(b)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:N[2]||(N[2]=ie=>ge("paint-format"))},[N[62]||(N[62]=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)),t.createElementVNode("span",$i,t.toDisplayString(t.unref(b)(e.locale,"paintFormat")),1)],10,Oi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("clear"),to:G.value},[t.createElementVNode("div",Hi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(b)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:N[3]||(N[3]=ie=>ge("clear-format"))},[N[63]||(N[63]=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)),t.createElementVNode("span",Wi,t.toDisplayString(t.unref(b)(e.locale,"clearFormat")),1)],10,zi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep1"),to:G.value},[N[64]||(N[64]=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:G.value},[t.createElementVNode("div",Pi,[t.createVNode(Dt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:I("font")?"100%":110,"menu-width":I("font")?120:void 0,"visible-count":8,title:t.unref(b)(e.locale,"fontFamily"),align:"right",onChange:N[4]||(N[4]=ie=>ge("font-family-change",ie))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("fontSize"),to:G.value},[t.createElementVNode("div",Ui,[t.createElementVNode("div",Ki,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(b)(e.locale,"fontSize"),onMousedown:N[5]||(N[5]=t.withModifiers(()=>{},["stop"])),onInput:N[6]||(N[6]=ie=>ge("font-size-input",ie.target.value)),onBlur:N[7]||(N[7]=ie=>ge("font-size-blur")),onKeydown:N[8]||(N[8]=ie=>ge("font-size-keydown",ie))},null,40,Gi),t.createVNode(Dt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:I("fontSize")?"100%":56,"menu-width":I("fontSize")?120:56,"visible-count":9,title:t.unref(b)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":se.value,"onUpdate:modelOpen":N[9]||(N[9]=ie=>ge("update:font-size-menu-open",ie)),onChange:N[10]||(N[10]=ie=>ge("font-size-change",ie))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:se,class:"toolbar-font-size__btn",type:"button",title:t.unref(b)(e.locale,"fontSize"),onMousedown:N[11]||(N[11]=t.withModifiers(()=>{},["prevent"])),onClick:N[12]||(N[12]=ie=>ge("font-size-toggle"))},[...N[65]||(N[65]=[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,qi),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:N[13]||(N[13]=t.withModifiers(()=>{},["prevent"])),onClick:N[14]||(N[14]=ie=>ge("font-size-step-down"))},[...N[66]||(N[66]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M675.2 184.533333h260.266667a12.8 12.8 0 0 1 12.8 12.8v21.333334a12.8 12.8 0 0 1-12.8 12.8H675.2a12.8 12.8 0 0 1-12.8-12.8v-21.333334a12.8 12.8 0 0 1 12.8-12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,Yi),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:N[15]||(N[15]=t.withModifiers(()=>{},["prevent"])),onClick:N[16]||(N[16]=ie=>ge("font-size-step-up"))},[...N[67]||(N[67]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M769.066667 77.952v93.781333h-93.866667a12.8 12.8 0 0 0-12.8 12.8v46.933334a12.8 12.8 0 0 0 12.8 12.8h93.866667v93.952a12.8 12.8 0 0 0 12.8 12.8h46.933333a12.8 12.8 0 0 0 12.8-12.8V244.266667h93.866667a12.8 12.8 0 0 0 12.8-12.8v-46.933334a12.8 12.8 0 0 0-12.8-12.8h-93.866667V77.952a12.8 12.8 0 0 0-12.8-12.8h-46.933333a12.8 12.8 0 0 0-12.8 12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,Xi)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep2"),to:G.value},[N[68]||(N[68]=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:G.value},[t.createElementVNode("div",ji,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(b)(e.locale,"bold"),disabled:!e.hasSelection,onClick:N[17]||(N[17]=ie=>ge("bold-toggle"))},[N[69]||(N[69]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)),t.createElementVNode("span",Ji,t.toDisplayString(t.unref(b)(e.locale,"bold")),1)],10,Zi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("italic"),to:G.value},[t.createElementVNode("div",Qi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(b)(e.locale,"italic"),disabled:!e.hasSelection,onClick:N[18]||(N[18]=ie=>ge("italic-toggle"))},[N[70]||(N[70]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)),t.createElementVNode("span",ts,t.toDisplayString(t.unref(b)(e.locale,"italic")),1)],10,es)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("underline"),to:G.value},[t.createElementVNode("div",ls,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(b)(e.locale,"underline"),disabled:!e.hasSelection,onClick:N[19]||(N[19]=ie=>ge("underline-toggle"))},[N[71]||(N[71]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)),t.createElementVNode("span",os,t.toDisplayString(t.unref(b)(e.locale,"underline")),1)],10,ns)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("strike"),to:G.value},[t.createElementVNode("div",rs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:N[20]||(N[20]=ie=>ge("strikethrough-toggle"))},[N[72]||(N[72]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)),t.createElementVNode("span",is,t.toDisplayString(t.unref(b)(e.locale,"strikethrough")),1)],10,as)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep3"),to:G.value},[N[73]||(N[73]=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:G.value},[t.createElementVNode("div",ss,[t.createElementVNode("div",cs,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[21]||(N[21]=ie=>ge("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",us,[N[74]||(N[74]=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,fs)])),t.createElementVNode("span",ms,t.toDisplayString(t.unref(b)(e.locale,"fontColor")),1)],8,ds),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:k,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[22]||(N[22]=ie=>ge("update:text-color-menu-open",!e.textColorMenuOpen))},[...N[75]||(N[75]=[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,ps),t.createVNode(Yn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":k.value,"onUpdate:modelOpen":N[23]||(N[23]=ie=>ge("update:text-color-menu-open",ie)),onChange:N[24]||(N[24]=ie=>ge("text-color-change",ie))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("fillColor"),to:G.value},[t.createElementVNode("div",hs,[t.createElementVNode("div",gs,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[25]||(N[25]=ie=>ge("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",ys,[N[76]||(N[76]=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,Cs)])),t.createElementVNode("span",ws,t.toDisplayString(t.unref(b)(e.locale,"fillColor")),1)],8,bs),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:H,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[26]||(N[26]=ie=>ge("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...N[77]||(N[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,vs),t.createVNode(Yn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":H.value,"onUpdate:modelOpen":N[27]||(N[27]=ie=>ge("update:fill-color-menu-open",ie)),onChange:N[28]||(N[28]=ie=>ge("fill-color-change",ie))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("border"),to:G.value},[t.createElementVNode("div",ks,[t.createElementVNode("div",Es,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[29]||(N[29]=ie=>ge("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Ss,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,ie=>t.createElementVNode("line",{key:ie.name,x1:ie.x1,y1:ie.y1,x2:ie.x2,y2:ie.y2,"stroke-width":r(e.cachedBorder,ie.name)==="thick"?3:1.5,"stroke-dasharray":r(e.cachedBorder,ie.name)==="dashed"?"0 4":"none","stroke-linecap":r(e.cachedBorder,ie.name)==="dashed"?"round":"square"},null,8,Ms)),64))])),t.createElementVNode("span",Bs,t.toDisplayString(t.unref(b)(e.locale,d[e.cachedBorder]??"borders")),1)],8,Rs),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:Y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[30]||(N[30]=ie=>ge("update:border-menu-open",!e.borderMenuOpen))},[...N[78]||(N[78]=[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,Ts),t.createVNode(li,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":Y.value,"onUpdate:modelOpen":N[31]||(N[31]=ie=>ge("update:border-menu-open",ie)),onChange:N[32]||(N[32]=ie=>ge("border-change",ie))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep4"),to:G.value},[N[79]||(N[79]=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:G.value},[t.createElementVNode("div",Ns,[t.createVNode(Dt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:I("hAlign")?"100%":44,"menu-width":I("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"hAlign"),onChange:N[33]||(N[33]=ie=>ge("h-align-change",ie))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("vAlign"),to:G.value},[t.createElementVNode("div",xs,[t.createVNode(Dt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:I("vAlign")?"100%":44,"menu-width":I("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"vAlign"),onChange:N[34]||(N[34]=ie=>ge("v-align-change",ie))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Ds,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(b)(e.locale,"wrap"),onClick:N[35]||(N[35]=ie=>ge("wrap-toggle"))},[N[80]||(N[80]=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)),t.createElementVNode("span",Fs,t.toDisplayString(t.unref(b)(e.locale,"wrap")),1)],10,Vs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("merge"),to:G.value},[t.createElementVNode("div",Is,[t.createElementVNode("div",As,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:N[36]||(N[36]=ie=>ge("apply-merge"))},[N[81]||(N[81]=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)),t.createElementVNode("span",Ls,t.toDisplayString(t.unref(b)(e.locale,"mergeCenter")),1)],8,_s),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:ee,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:N[37]||(N[37]=ie=>ge("update:merge-menu-open",!e.mergeMenuOpen))},[...N[82]||(N[82]=[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,Os),t.createVNode(fi,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":ee.value,"onUpdate:modelOpen":N[38]||(N[38]=ie=>ge("update:merge-menu-open",ie)),onChange:N[39]||(N[39]=ie=>ge("merge-change",ie))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep6"),to:G.value},[N[83]||(N[83]=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:G.value},[t.createElementVNode("div",$s,[t.createElementVNode("div",Hs,[t.createVNode(Dt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:I("numFmt")?"auto":92,"menu-width":(I("numFmt"),150),"visible-count":8,title:t.unref(b)(e.locale,"numberFormat"),"fallback-label":et.value,align:"right",onChange:N[40]||(N[40]=ie=>ge("number-format-change",String(ie)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(b)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:N[41]||(N[41]=ie=>ge("increase-decimals"))},[...N[84]||(N[84]=[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,zs),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(b)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:N[42]||(N[42]=ie=>ge("decrease-decimals"))},[...N[85]||(N[85]=[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,Ws)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sep7"),to:G.value},[N[86]||(N[86]=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:G.value},[t.createElementVNode("div",Ps,[t.createElementVNode("div",Us,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:N[43]||(N[43]=ie=>ge("calc-sum"))},[N[87]||(N[87]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)),t.createElementVNode("span",Gs,t.toDisplayString(t.unref(b)(e.locale,"sum")),1)],8,Ks),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:M,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:N[44]||(N[44]=ie=>ge("update:calc-menu-open",!e.calcMenuOpen))},[...N[88]||(N[88]=[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,qs),t.createVNode(xi,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":M.value,disabled:e.isSingleCell,"onUpdate:modelOpen":N[45]||(N[45]=ie=>ge("update:calc-menu-open",ie)),onChange:N[46]||(N[46]=ie=>ge(`calc-${ie}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("sort"),to:G.value},[t.createElementVNode("div",Ys,[t.createElementVNode("div",Xs,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(b)(e.locale,"sortAsc"):t.unref(b)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:N[47]||(N[47]=ie=>ge("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Zs,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(f,ie=>t.createElementVNode("line",{key:ie.name,x1:ie.x1,y1:ie.y1,x2:ie.x2,y2:ie.y2},null,8,Js)),64)),t.createElementVNode("path",{d:y[e.cachedSortOrder]},null,8,Qs)])),t.createElementVNode("span",ec,t.toDisplayString(t.unref(b)(e.locale,"sort")),1)],8,js),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:ne,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"sort"),disabled:!e.canSort,onClick:N[48]||(N[48]=ie=>ge("update:sort-menu-open",!e.sortMenuOpen))},[...N[89]||(N[89]=[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,tc),t.createVNode(si,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":ne.value,"onUpdate:modelOpen":N[49]||(N[49]=ie=>ge("update:sort-menu-open",ie)),onChange:N[50]||(N[50]=ie=>ge("sort-change",ie))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("filter"),to:G.value},[t.createElementVNode("div",lc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter,title:e.filterActive?t.unref(b)(e.locale,"clearFilter"):t.unref(b)(e.locale,"filter"),onClick:Le},[N[90]||(N[90]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M96 192c0-17.6 14.4-32 32-32h768c17.6 0 32 14.4 32 32 0 9.6-4.8 19.2-12.8 25.6L608 480v320c0 19.2-12.8 35.2-32 40-4.8 1.6-9.6 1.6-14.4 1.6-12.8 0-24-4.8-33.6-12.8l-128-108.8c-8-6.4-12.8-16-12.8-25.6V480L108.8 217.6C100.8 211.2 96 201.6 96 192z"})],-1)),t.createElementVNode("span",oc,t.toDisplayString(t.unref(b)(e.locale,"filter")),1)],10,nc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("freeze"),to:G.value},[t.createElementVNode("div",rc,[t.createVNode(Dt,{class:"toolbar-freeze","model-value":"",options:ut.value,width:I("freeze")?"100%":44,"menu-width":I("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(b)(e.locale,"freezePane"),"trigger-icon":fr,"trigger-label":t.unref(b)(e.locale,"freezePane"),onChange:N[51]||(N[51]=ie=>ge("freeze-change",String(ie)))},null,8,["options","width","menu-width","title","trigger-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("cf"),to:G.value},[t.createElementVNode("div",ac,[t.createVNode(Bi,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,onPreset:N[52]||(N[52]=ie=>ge("cf-preset",ie)),onNewRule:N[53]||(N[53]=ie=>ge("cf-new-rule")),onManage:N[54]||(N[54]=ie=>ge("cf-manage")),onClear:N[55]||(N[55]=ie=>ge("cf-clear",ie))},null,8,["locale","has-selection","theme-vars"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("dv"),to:G.value},[t.createElementVNode("div",ic,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"dv"),onClick:U},[N[91]||(N[91]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M933.76 705.728l-74.112 74.048 74.88 74.944-58.88 58.88-74.88-75.008-74.88 74.88-58.88-58.752 74.88-74.88-74.048-74.112 58.88-58.88 74.112 74.048 74.048-74.048 58.88 58.88z"}),t.createElementVNode("path",{d:"M832.576 607.104H167.808v162.944h370.688v83.2H126.208a41.664 41.664 0 0 1-41.6-41.6V565.376a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2zM908.608 241.856l30.848 27.904-158.08 174.08a41.664 41.664 0 0 1-60.224 1.408L605.824 329.856l58.816-58.88 84.48 84.48 128.768-141.568 30.72 27.968z"}),t.createElementVNode("path",{d:"M832.576 193.664H167.808v162.944h370.688v83.2H126.208a41.6 41.6 0 0 1-41.6-41.6V151.936a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2z"})],-1)),t.createElementVNode("span",cc,t.toDisplayString(t.unref(b)(e.locale,"dv")),1)],8,sc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ce("find"),to:G.value},[t.createElementVNode("div",dc,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"find"),onClick:de},[N[92]||(N[92]=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)),t.createElementVNode("span",fc,t.toDisplayString(t.unref(b)(e.locale,"findReplace")),1)],8,uc)])],8,["disabled","to"])),F.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:x,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":te.value}]),type:"button",onClick:$},[...N[93]||(N[93]=[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)],34),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["overflow-menu-wrap",{"no-anim":Ne.value}]),style:t.normalizeStyle(K.value),onPointerdown:N[59]||(N[59]=t.withModifiers(()=>{},["stop","prevent"]))},[Ve.value||Fe.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Ve.value}]),disabled:!Ve.value,onClick:N[57]||(N[57]=ie=>Ee(-1))},[...N[94]||(N[94]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,mc)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:E,key:ze.value,class:"overflow-menu",onScroll:Ie},null,32)),Ve.value||Fe.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Fe.value}]),disabled:!Fe.value,onClick:N[58]||(N[58]=ie=>Ee(1))},[...N[95]||(N[95]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,pc)):t.createCommentVNode("",!0)],38),[[t.vShow,te.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-886dd586"]]),vc=["title"],kc={class:"tab-list"},Ec=["onClick","onDblclick","onContextmenu","onTouchstart"],Rc=["value"],Sc={key:1,class:"tab-item__name"},Mc=["title"],Bc=["disabled"],Tc=["title","onClick"],Nc={class:"tab-list-menu__name"},xc=["title","disabled","onClick"],Dc=["disabled"],Vc=8,mr=450,Xn=8,Fc=St(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 l=e,o=n,a=t.ref(null),i=t.ref(!1),r=t.ref(0),d=t.ref({left:0,bottom:0}),f=t.ref(null),y=t.computed(()=>Math.min(Vc,l.sheets.length)),h=t.computed(()=>l.sheets.slice(r.value,r.value+y.value)),u=t.computed(()=>r.value>0),E=t.computed(()=>r.value+y.value<l.sheets.length),x=t.computed(()=>l.sheets.length>y.value),k=t.computed(()=>l.sheets.length>1);t.watch(()=>l.sheets.length,()=>{if(!i.value)return;const $=Math.max(0,l.sheets.length-y.value);r.value>$&&(r.value=$)});function H($){r.value=Math.max(0,Math.min(l.sheets.length-y.value,r.value+$))}function Y(){if(i.value){i.value=!1;return}const $=a.value;if(!$)return;const U=$.getBoundingClientRect();d.value={left:U.left,bottom:window.innerHeight-U.top+4};const de=l.activeSheetIndex;r.value=de>=0?Math.max(0,Math.min(de-Math.floor(y.value/2),l.sheets.length-y.value)):0,i.value=!0}function ne($){o("tab-click",$),i.value=!1}function ee($){k.value&&o("delete-sheet",$)}function M($){var Le;if(!i.value)return;const U=$.target;if((Le=a.value)!=null&&Le.contains(U))return;const de=document.querySelector(".tab-list-menu");de!=null&&de.contains(U)||(i.value=!1)}function se($){i.value&&$.key==="Escape"&&(i.value=!1)}function X($){i.value&&($.preventDefault(),H($.deltaY>0?1:-1))}function te(){i.value=!1}function Ne($){!i.value||$.target===f.value||te()}const ze=t.ref(0),Ve=t.ref(!1);function Fe($){i.value&&(ze.value=$.touches[0].clientY,Ve.value=!0)}function je($){if(!i.value||!Ve.value)return;const U=$.touches[0].clientY-ze.value;Math.abs(U)>5&&(H(U<0?1:-1),ze.value=$.touches[0].clientY)}function _e(){Ve.value=!1}let F=null,I=-1,G=0,Ce=0,$e=!1,j=null,Be=0,Q=0;function ke($,U,de){return{clientX:$,clientY:U,target:de,preventDefault(){},stopPropagation(){}}}function B($,U){const de=$.touches[0];if(!de)return;G=de.clientX,Ce=de.clientY,I=U,F!==null&&clearTimeout(F);const Le=$.target;F=window.setTimeout(()=>{$e=!0;const ve=ke(G,Ce,Le);o("tab-contextmenu",{ev:ve,i:I})},mr)}function oe($){const U=$.touches[0];!U||F===null||(Math.abs(U.clientX-G)>Xn||Math.abs(U.clientY-Ce)>Xn)&&(clearTimeout(F),F=null)}function Z(){F!==null&&(clearTimeout(F),F=null)}function re($){if($e){$e=!1;return}o("tab-click",$)}function K($){const U=$.touches[0];if(!U)return;const de=$.target;if(de.closest(".tab-item")||de.closest(".tab-bar__add-btn")||de.closest(".tab-bar__list-btn"))return;Be=U.clientX,Q=U.clientY,j!==null&&clearTimeout(j);const Le=de;j=window.setTimeout(()=>{const ve=ke(Be,Q,Le);o("tabbar-contextmenu",ve)},mr)}function L($){const U=$.touches[0];!U||j===null||(Math.abs(U.clientX-Be)>Xn||Math.abs(U.clientY-Q)>Xn)&&(clearTimeout(j),j=null)}function J(){j!==null&&(clearTimeout(j),j=null)}return t.watch(i,$=>{t.nextTick(()=>{var U,de;$?(U=f.value)==null||U.addEventListener("wheel",X,{passive:!1}):(de=f.value)==null||de.removeEventListener("wheel",X)})}),t.onMounted(()=>{document.addEventListener("pointerdown",M),document.addEventListener("keydown",se),window.addEventListener("resize",te),window.addEventListener("scroll",Ne,!0)}),t.onBeforeUnmount(()=>{F!==null&&clearTimeout(F),j!==null&&clearTimeout(j),document.removeEventListener("pointerdown",M),document.removeEventListener("keydown",se),window.removeEventListener("resize",te),window.removeEventListener("scroll",Ne,!0)}),($,U)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:U[8]||(U[8]=de=>o("tabbar-contextmenu",de)),onTouchstart:K,onTouchmove:L,onTouchend:J,onTouchcancel:J},[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(b)(e.locale,"sheetList"),onClick:Y},[...U[9]||(U[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,vc),t.createElementVNode("div",kc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(de,Le)=>(t.openBlock(),t.createElementBlock("div",{key:de.id,class:t.normalizeClass(["tab-item",{"tab-item--active":Le===e.activeSheetIndex}]),onClick:ve=>re(Le),onDblclick:t.withModifiers(ve=>o("tab-dblclick",Le),["prevent"]),onContextmenu:ve=>o("tab-contextmenu",{ev:ve,i:Le}),onTouchstart:ve=>B(ve,Le),onTouchmove:oe,onTouchend:Z,onTouchcancel:Z},[e.renTab===Le?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:U[0]||(U[0]=ve=>o("tab-rename-input",ve.target.value)),onKeydown:U[1]||(U[1]=ve=>o("tab-rename-keydown",ve)),onBlur:U[2]||(U[2]=ve=>o("tab-rename-commit")),onClick:U[3]||(U[3]=t.withModifiers(()=>{},["stop"]))},null,40,Rc)):(t.openBlock(),t.createElementBlock("span",Sc,t.toDisplayString(de.name),1))],42,Ec))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(b)(e.locale,"addSheet"),onClick:U[4]||(U[4]=de=>o("add-sheet"))}," + ",8,Mc),(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:d.value.left+"px",bottom:d.value.bottom+"px"}),onMousedown:U[7]||(U[7]=t.withModifiers(()=>{},["prevent"]))},[x.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!u.value}]),disabled:!u.value,onClick:U[5]||(U[5]=de=>H(-1))},[...U[10]||(U[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,Bc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:f,class:"tab-list-menu__list",onTouchstart:Fe,onTouchmove:je,onTouchend:_e},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,de=>(t.openBlock(),t.createElementBlock("div",{key:de.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(de)===e.activeSheetIndex}]),title:de.name,onClick:Le=>ne(e.sheets.indexOf(de))},[t.createElementVNode("span",Nc,t.toDisplayString(de.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(b)(e.locale,"delete"),disabled:!k.value,onClick:t.withModifiers(Le=>ee(e.sheets.indexOf(de)),["stop"])},[...U[11]||(U[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,xc)],10,Tc))),128))],544),x.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:U[6]||(U[6]=de=>H(1))},[...U[12]||(U[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,Dc)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-e00401ad"]]),Ic={class:"find-bar__row find-bar__row--inputs"},Ac=["placeholder","value"],_c=["placeholder","value"],Lc=["title","disabled"],Oc=["title","disabled"],$c=["title"],Hc={class:"find-bar__row find-bar__row--controls"},zc=["title"],Wc={class:"find-bar__count"},Pc=["disabled"],Uc=["disabled"],Kc={class:"find-bar__chk find-bar__chk--panel"},Gc=["checked"],qc={class:"find-bar__chk find-bar__chk--panel"},Yc=["checked"],Xc=St(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 l=e,o=n,a=t.ref(null),i=t.ref(null),r=t.ref(!1),d=t.ref({top:0,left:0}),f=t.computed(()=>l.total>0?`${l.currentIndex+1}/${l.total}`:l.message||""),y=t.computed(()=>[{label:b(l.locale,"scopeSheet"),value:"sheet"},{label:b(l.locale,"scopeWorkbook"),value:"workbook"},{label:b(l.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>l.focusToken,()=>{t.nextTick(()=>{var x;return(x=a.value)==null?void 0:x.focus()})});function h(x){x.key==="Enter"?(x.preventDefault(),x.shiftKey?o("prev"):o("next")):x.key==="Escape"&&(x.preventDefault(),o("close"))}function u(){if(i.value){if(!r.value){const x=i.value.getBoundingClientRect();d.value={top:x.bottom+2,left:x.left}}r.value=!r.value}}function E(x){if(!r.value)return;const k=x.target;k.closest(".find-bar__settings-btn")||k.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,x=>{x?document.addEventListener("pointerdown",E,!0):document.removeEventListener("pointerdown",E,!0)}),t.watch(()=>l.open,x=>{x||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",E,!0)),(x,k)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Ic,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(b)(e.locale,"findPlaceholder"),value:e.findText,onInput:k[0]||(k[0]=H=>o("update:findText",H.target.value)),onKeydown:h},null,40,Ac),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(b)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:k[1]||(k[1]=H=>o("update:replaceText",H.target.value)),onKeydown:h},null,40,_c),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findPrev"),disabled:e.total===0,onClick:k[2]||(k[2]=H=>o("prev"))},[...k[12]||(k[12]=[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,Lc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findNext"),disabled:e.total===0,onClick:k[3]||(k[3]=H=>o("next"))},[...k[13]||(k[13]=[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,Oc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(b)(e.locale,"findClose"),onClick:k[4]||(k[4]=H=>o("close"))},[...k[14]||(k[14]=[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,$c)]),t.createElementVNode("div",Hc,[t.createVNode(Dt,{class:"find-bar__dropdown","model-value":e.scope,options:y.value,title:t.unref(b)(e.locale,"findScope"),"onUpdate:modelValue":k[5]||(k[5]=H=>x.$emit("update:scope",H))},null,8,["model-value","options","title"]),t.createElementVNode("button",{ref_key:"settingsBtnRef",ref:i,class:t.normalizeClass(["find-bar__btn find-bar__btn--icon find-bar__settings-btn",{"find-bar__btn--active":r.value}]),title:t.unref(b)(e.locale,"findOptions"),onClick:t.withModifiers(u,["stop"])},[...k[15]||(k[15]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M224 671.616a64 64 0 1 1 128 0 64 64 0 0 1-128 0z m-59.968 32a128 128 0 0 0 247.936 0H928a32 32 0 1 0 0-64H411.968a128 128 0 0 0-247.936 0H96a32 32 0 1 0 0 64h68.032z"}),t.createElementVNode("path",{d:"M800 319.808a64 64 0 1 1-128 0 64 64 0 0 1 128 0z m59.968-32a128 128 0 0 0-247.936 0H96a32 32 0 0 0 0 64h516.032a128 128 0 0 0 247.936 0H928a32 32 0 0 0 0-64h-68.032z"})],-1)])],10,zc),t.createElementVNode("span",Wc,t.toDisplayString(f.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[6]||(k[6]=H=>o("replace"))},t.toDisplayString(t.unref(b)(e.locale,"replace")),9,Pc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[7]||(k[7]=H=>o("replace-all"))},t.toDisplayString(t.unref(b)(e.locale,"replaceAll")),9,Uc)])],4)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"find-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar__settings-panel",style:t.normalizeStyle({top:d.value.top+"px",left:d.value.left+"px"}),onClick:k[10]||(k[10]=t.withModifiers(()=>{},["stop"])),onMousedown:k[11]||(k[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",Kc,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:k[8]||(k[8]=H=>o("update:matchCase",H.target.checked))},null,40,Gc),k[16]||(k[16]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"matchCase")),1)]),t.createElementVNode("label",qc,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:k[9]||(k[9]=H=>o("update:matchEntireCell",H.target.checked))},null,40,Yc),k[17]||(k[17]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"matchEntireCell")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],64))}}),[["__scopeId","data-v-07f6713b"]]),jc={class:"nf-dialog__header"},Zc={class:"nf-dialog__title"},Jc={class:"nf-dialog__body"},Qc={class:"nf-field"},ed={class:"nf-field__label"},td={key:0,class:"nf-field"},ld={class:"nf-field__label"},nd={key:1,class:"nf-field nf-field--inline"},od={class:"nf-checkbox"},rd={key:2,class:"nf-field"},ad={class:"nf-field__label"},id={key:3,class:"nf-field"},sd={class:"nf-field__label"},cd={key:4,class:"nf-field"},dd={class:"nf-field__label"},ud={key:5,class:"nf-field"},fd={class:"nf-field__label"},md={key:6,class:"nf-field"},pd={class:"nf-field__label"},hd={class:"nf-field"},gd={class:"nf-field__label"},bd={class:"nf-dialog__footer"},yd={class:"nf-preview"},Cd={class:"nf-preview__label"},wd={class:"nf-preview__value"},vd={class:"nf-dialog__actions"},kd=St(t.defineComponent({__name:"number-format-dialog",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 l=e,o=n,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),d=t.ref(!1),f=t.ref("$"),y=t.ref("m/d/yyyy"),h=t.ref("h:mm:ss"),u=t.ref("m/d/yyyy h:mm:ss"),E=t.ref("[h]:mm:ss"),x=t.ref(""),k=t.ref(null),H=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Y=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],ne=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],ee=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],M=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],se=t.computed(()=>l.locale==="zh-CN"?[...Y,...ne]:[...ne,...Y]),X=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],te=t.computed(()=>l.locale==="zh-CN"?[...ee,...M]:[...M,...ee]),Ne=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ze={general:"nfGeneral",text:"nfText",number:"nfNumber",percent:"nfPercent",scientific:"nfScientific",accounting:"nfAccounting",financial:"nfFinancial",currency:"nfCurrency",currencyRounded:"nfCurrencyRounded",date:"nfDate",time:"nfTime",dateTime:"nfDateTime",duration:"nfDuration",custom:"nfCatCustom"},Ve=t.computed(()=>Va.map(Ee=>({label:b(l.locale,ze[Ee]),value:Ee}))),Fe=H.map(Ee=>({label:Ee.label,value:Ee.value})),je=t.computed(()=>se.value.map(Ee=>({label:Ee,value:Ee}))),_e=X.map(Ee=>({label:Ee,value:Ee})),F=t.computed(()=>te.value.map(Ee=>({label:Ee,value:Ee}))),I=Ne.map(Ee=>({label:Ee,value:Ee})),G=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Ce=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),$e=t.computed(()=>i.value==="date"),j=t.computed(()=>i.value==="time"),Be=t.computed(()=>i.value==="dateTime"),Q=t.computed(()=>i.value==="duration"),ke=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function B(){if(i.value==="general")return Pl;if(i.value==="text")return il;if(i.value==="custom")return x.value;if(i.value==="date")return y.value;if(i.value==="time")return h.value;if(i.value==="dateTime")return u.value;if(i.value==="duration")return E.value;const Ee=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?oe(i.value,Ee,d.value,f.value):$a(l.locale,i.value,Ee,d.value)}function oe(Ee,He,ge,et){const ut=ge?"#,##0":"0";if(Ee==="currencyRounded")return et+ut;const Pe=He>0?"."+"0".repeat(He):"",N=ut+Pe;return Ee==="currency"?et+N:`${et}${N};(${et}${N});${et}"-"`}function Z(Ee){if(x.value=Ee,sl(Ee)){i.value="general";return}if(Ee==="@"){i.value="text";return}const He=Ee.replace(/\[[^\]]*\]/gi,Pe=>/\[h\]/i.test(Pe)?Pe:"");if(/\[h\]/i.test(He)&&!/[yd]/i.test(He)){i.value="duration",Ne.includes(Ee)&&(E.value=Ee);return}const ge=/[yd]/i.test(He),et=/h|s|AM\/PM/i.test(He);if(ge&&et){i.value="dateTime",te.value.includes(Ee)&&(u.value=Ee);return}if(ge||/AM\/PM/i.test(He)){et&&!ge?(i.value="time",X.includes(Ee)&&(h.value=Ee)):(i.value="date",se.value.includes(Ee)&&(y.value=Ee));return}if(Ee.includes("%")){i.value="percent",r.value=re(Ee);return}if(/E[+-]/i.test(Ee)){i.value="scientific",r.value=re(Ee);return}const ut=H.find(Pe=>Ee.startsWith(Pe.value));if(Ee.includes("[Red](")){i.value="financial",d.value=Ee.includes(","),r.value=re(Ee);return}if(ut){Ee.includes("(")?(i.value="accounting",f.value=ut.value,d.value=Ee.includes(","),r.value=re(Ee)):/\.\d/.test(Ee.slice(ut.value.length))?(i.value="currency",f.value=ut.value,d.value=Ee.includes(","),r.value=re(Ee)):(i.value="currencyRounded",f.value=ut.value,d.value=Ee.includes(","));return}i.value="number",d.value=Ee.includes(","),r.value=re(Ee)}function re(Ee){const He=Ee.match(/\.([0#?]+)/);return He?He[1].length:0}function K(){i.value!=="custom"&&(x.value=B())}function L(){}function J(){y.value=se.value[0],h.value=X[0],u.value=te.value[0],E.value=Ne[0]}function $(){a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),J(),Z(l.currentFormat??""),l.isCustom&&(i.value="custom"),t.nextTick(()=>{var Ee;return(Ee=k.value)==null?void 0:Ee.focus()})}function U(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function de(){o("apply",x.value),U()}function Le(){U()}function ve(Ee){Ee.key==="Escape"&&U()}t.watch(()=>l.modelOpen,Ee=>{Ee&&!a.value?$():!Ee&&a.value&&U()});const Ie=t.computed(()=>yl(l.sampleValue,x.value,l.locale));return(Ee,He)=>(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:Le,onKeydown:ve},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:He[9]||(He[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",jc,[t.createElementVNode("span",Zc,t.toDisplayString(t.unref(b)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:U},[...He[10]||(He[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",Jc,[t.createElementVNode("div",Qc,[t.createElementVNode("label",ed,t.toDisplayString(t.unref(b)(e.locale,"nfCategory")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":i.value,options:Ve.value,"onUpdate:modelValue":He[0]||(He[0]=ge=>i.value=ge),onChange:K},null,8,["model-value","options"])]),ke.value?(t.openBlock(),t.createElementBlock("div",td,[t.createElementVNode("label",ld,t.toDisplayString(t.unref(b)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":He[1]||(He[1]=ge=>r.value=ge),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:K},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),G.value?(t.openBlock(),t.createElementBlock("div",nd,[t.createElementVNode("label",od,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":He[2]||(He[2]=ge=>d.value=ge),type:"checkbox",onChange:K},null,544),[[t.vModelCheckbox,d.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Ce.value?(t.openBlock(),t.createElementBlock("div",rd,[t.createElementVNode("label",ad,t.toDisplayString(t.unref(b)(e.locale,"nfSymbol")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":f.value,options:t.unref(Fe),"onUpdate:modelValue":He[3]||(He[3]=ge=>f.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),$e.value?(t.openBlock(),t.createElementBlock("div",id,[t.createElementVNode("label",sd,t.toDisplayString(t.unref(b)(e.locale,"nfDateFormat")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":y.value,options:je.value,"onUpdate:modelValue":He[4]||(He[4]=ge=>y.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),j.value?(t.openBlock(),t.createElementBlock("div",cd,[t.createElementVNode("label",dd,t.toDisplayString(t.unref(b)(e.locale,"nfTimeFormat")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":h.value,options:t.unref(_e),"onUpdate:modelValue":He[5]||(He[5]=ge=>h.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Be.value?(t.openBlock(),t.createElementBlock("div",ud,[t.createElementVNode("label",fd,t.toDisplayString(t.unref(b)(e.locale,"nfDateTime")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":u.value,options:F.value,"onUpdate:modelValue":He[6]||(He[6]=ge=>u.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Q.value?(t.openBlock(),t.createElementBlock("div",md,[t.createElementVNode("label",pd,t.toDisplayString(t.unref(b)(e.locale,"nfDuration")),1),t.createVNode(Dt,{class:"nf-field__dropdown","model-value":E.value,options:t.unref(I),"onUpdate:modelValue":He[7]||(He[7]=ge=>E.value=ge),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",hd,[t.createElementVNode("label",gd,t.toDisplayString(t.unref(b)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:k,"onUpdate:modelValue":He[8]||(He[8]=ge=>x.value=ge),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:L},null,544),[[t.vModelText,x.value]])])]),t.createElementVNode("div",bd,[t.createElementVNode("div",yd,[t.createElementVNode("span",Cd,t.toDisplayString(t.unref(b)(e.locale,"nfPreview")),1),t.createElementVNode("span",wd,t.toDisplayString(Ie.value||"—"),1)]),t.createElementVNode("div",vd,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:de},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:U},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-84bb335b"]]),Ed={class:"sort-confirm__header"},Rd={class:"sort-confirm__title"},Sd={class:"sort-confirm__body"},Md={class:"sort-confirm__message"},Bd={class:"sort-confirm__options"},Td={class:"sort-confirm__option"},Nd={class:"sort-confirm__option"},xd={class:"sort-confirm__footer"},Dd=St(t.defineComponent({__name:"sort-confirm-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>l.modelOpen,x=>{x&&!a.value?d():!x&&a.value&&f()});function d(){i.value=!0,a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{var k;const x=(k=r.value)==null?void 0:k.querySelector(".sort-confirm__btn--primary");x==null||x.focus()})}function f(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function y(){E()}function h(x){x.key==="Escape"&&E()}function u(){o("confirm",i.value),f()}function E(){o("cancel"),f()}return(x,k)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:y,onKeydown:h},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:k[2]||(k[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ed,[t.createElementVNode("span",Rd,t.toDisplayString(t.unref(b)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:E},[...k[3]||(k[3]=[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",Sd,[t.createElementVNode("p",Md,t.toDisplayString(t.unref(b)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Bd,[t.createElementVNode("label",Td,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[0]||(k[0]=H=>i.value=H),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Nd,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=H=>i.value=H),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",xd,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:u},t.toDisplayString(t.unref(b)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:E},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-af42d78b"]]);function lt(e){let n="",l=e;do n=String.fromCharCode(65+l%26)+n,l=Math.floor(l/26)-1;while(l>=0);return n}function Bo(e){let n=0;for(let l=0;l<e.length;l++)n=n*26+(e.toUpperCase().charCodeAt(l)-64);return n-1}function hn(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 To(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 Rn(e,n){return`${e},${n}`}function ll(e,n,l){const o=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!o)return null;const a=Bo(o[1]),i=parseInt(o[2],10)-1;return a<0||a>=n||i<0||i>=l?null:{col:a,row:i}}function en(e,n){if(!n)return{x:0,y:0};const l=n.getBoundingClientRect();return{x:e.clientX-l.left,y:e.clientY-l.top}}const pr=[{name:"SUM",snippet:"SUM(A1:A10)"},{name:"AVERAGE",snippet:"AVERAGE(A1:A10)"},{name:"COUNT",snippet:"COUNT(A1:A10)"},{name:"IF",snippet:"IF(A1>0, B1, C1)"},{name:"VLOOKUP",snippet:"VLOOKUP(A1, B1:C10, 2, FALSE)"},{name:"CONCATENATE",snippet:"CONCATENATE(A1, B1)"},{name:"MAX",snippet:"MAX(A1:A10)"},{name:"MIN",snippet:"MIN(A1:A10)"},{name:"SIN",snippet:"SIN(A1)"},{name:"SUMIF",snippet:'SUMIF(A1:A10, ">0", B1:B10)'},{name:"PMT",snippet:"PMT(0.05/12, 360, 100000)"},{name:"STDEV",snippet:"STDEV(A1:A10)"}],Vd={SUM:{min:1,max:1},AVERAGE:{min:1,max:1},COUNT:{min:1,max:1},IF:{min:3,max:3},VLOOKUP:{min:3,max:4},CONCATENATE:{min:1,max:1/0},MAX:{min:1,max:1},MIN:{min:1,max:1},SIN:{min:1,max:1},SUMIF:{min:2,max:3},PMT:{min:3,max:5},STDEV:{min:1,max:1}};function Fd(e){let n=0,l=null;for(let o=0;o<e.length;o++){const a=e[o];if(l){a===l&&(e[o+1]===l?o++:l=null);continue}if(a==='"'||a==="'"){l=a;continue}if(a==="(")n++;else if(a===")"&&(n--,n<0))return!1}return n===0}function Id(e){const n=e.trim();if(!n.startsWith("="))return{ok:!1,name:null};const l=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(n.slice(1).trim());if(!l)return{ok:!1,name:null};const o=l[1].toUpperCase(),a=Vd[o];if(!a)return{ok:!1,name:o};const i=l[2];if(!Fd(i))return{ok:!1,name:o};const r=Kl(i),d=r.length===1&&r[0].trim()===""?0:r.length;return d<a.min||d>a.max?{ok:!1,name:o}:r.some(f=>f.trim()==="")?{ok:!1,name:o}:{ok:!0,name:o}}function Sn(e,n,l){const o=e.split(":");if(o.length!==2)return null;const a=ll(o[0],n,l),i=ll(o[1],n,l);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 hr(e){const n=e.trim();if(n==="")return"";const l=Number(n);return!isNaN(l)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?l:e}function xl(e,n,l,o,a){const i=l[Rn(e,n)];if(!i)return"";const r=i.value;return r.startsWith("=")?br(Rn(e,n),l,o,a):hr(r)}function gr(e,n,l,o,a){const i=xl(e,n,l,o,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const Fn=new Map,jn=new Set;function tn(){Fn.clear(),jn.clear()}function br(e,n,l,o){return Ad(e,n,l,o,0)}function Ad(e,n,l,o,a){if(jn.has(e))return null;if(Fn.has(e))return Fn.get(e);jn.add(e);const i=n[e];let r;if(!i)r=null;else{const d=i.value;if(!d.startsWith("="))r=hr(d);else{const f=d.slice(1).trim(),y=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(f);r=y?vr(y[1].toUpperCase(),y[2],n,l,o,a+1):Vt(f,n,l,o,a+1)}}return jn.delete(e),Fn.set(e,r),r}function Mn(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function yr(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function No(e,n,l){let o;if(typeof e=="number"&&typeof n=="number")o=e<n?-1:e>n?1:0;else{const a=String(e??""),i=String(n??"");o=a<i?-1:a>i?1:0}switch(l){case"=":return o===0;case"<>":return o!==0;case"<":return o<0;case">":return o>0;case"<=":return o<=0;case">=":return o>=0}return!1}function Cr(e,n,l,o){const a=e.trim();if(a.length>=2&&(a[0]==='"'&&a[a.length-1]==='"'||a[0]==="'"&&a[a.length-1]==="'"))return a.slice(1,-1);const i=Number(a);return!isNaN(i)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(a)?i:a}function _d(e,n,l,o,a,i){let d=n.trim();d.length>=2&&(d[0]==='"'&&d[d.length-1]==='"'||d[0]==="'"&&d[d.length-1]==="'")&&(d=d.slice(1,-1));const f=/^([<>=]+)([\s\S]*)$/.exec(d);if(f){const h=f[1],u=Cr(f[2]);return No(e,u,h)}const y=Cr(d);return yr(e,y)}function wr(e,n,l,o,a){const i=e.trim(),r=["<=",">=","<>"];let d=null,f=-1,y=null,h=0;for(let E=0;E<i.length;E++){const x=i[E];if(y){x===y&&(i[E+1]===y?E++:y=null);continue}if(x==='"'||x==="'"){y=x;continue}if(x==="("&&h++,x===")"&&h--,h===0&&(x==="<"||x===">"||x==="=")){const k=i.slice(E,E+2);d=r.includes(k)?k:x,f=E;break}}if(d&&f>=0){const E=i.slice(0,f).trim(),x=i.slice(f+d.length).trim(),k=Vt(E,n,l,o,a),H=Vt(x,n,l,o,a);return No(k,H,d)}const u=Vt(i,n,l,o,a);return Mn(u)}function Kl(e){const n=[];let l=0,o=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(o){a+=r,r===o&&(e[i+1]===o?(i++,a+=o):o=null);continue}if(r==='"'||r==="'"){o=r,a+=r;continue}if(r==="("&&l++,r===")"&&l--,r===","&&l===0){n.push(a),a="";continue}a+=r}return n.push(a),n}function Vt(e,n,l,o,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 d=Ld(i);if(d.length===0)return null;let f=0;const y=()=>{const k=h(),H=d[f];if(!(H&&H.type==="cmp"))return k;f++;const Y=h();return k===null||Y===null?null:No(k,Y,H.val)?1:0},h=()=>{let k=u();for(;f<d.length;){const H=d[f];if(H.type==="op"&&(H.val==="+"||H.val==="-"))f++,k=xo(k,u(),H.val);else break}return k},u=()=>{let k=E();for(;f<d.length;){const H=d[f];if(H.type==="op"&&(H.val==="*"||H.val==="/"))f++,k=xo(k,E(),H.val);else break}return k},E=()=>{const k=d[f];return k&&k.type==="op"&&k.val==="-"?(f++,xo(0,E(),"-")):k&&k.type==="op"&&k.val==="+"?(f++,E()):x()},x=()=>{const k=d[f];if(!k)return null;if(k.type==="num")return f++,Number(k.val);if(k.type==="str")return f++,k.val;if(k.type==="lp"){f++;const H=y();return d[f]&&d[f].type==="rp"&&f++,H}if(k.type==="ref"){f++;const H=ll(k.val,l,o);return H?xl(H.col,H.row,n,l,o):null}if(k.type==="func"){const H=k.val.toUpperCase();if(f++,d[f]&&d[f].type==="lp"){const Y=d[f];let ne=0,ee=null,M=f;for(;M<d.length;M++)if(d[M].type==="lp")ne++;else if(d[M].type==="rp"&&(ne--,ne===0)){ee=d[M];break}if(ee){const se=i.slice(Y.start+1,ee.start);return f=M+1,vr(H,se,n,l,o,a+1)}}return null}return f++,null};return y()}function Ld(e){const n=[];let l=0;for(;l<e.length;){const o=e[l];if(/\s/.test(o)){l++;continue}if(o==='"'||o==="'"){const a=o,i=l;l++;let r="";for(;l<e.length;){if(e[l]===a){if(e[l+1]===a){r+=a,l+=2;continue}l++;break}r+=e[l],l++}n.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(o)||o==="."){const a=l;let i="";for(o==="."&&(i+=".",l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]===".")for(i+=".",l++;l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]==="e"||e[l]==="E")for(i+=e[l],l++,(e[l]==="+"||e[l]==="-")&&(i+=e[l],l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;n.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(o)){const a=l;let i="";for(;l<e.length&&/[A-Za-z0-9_$]/.test(e[l]);)i+=e[l],l++;e[l]==="("&&!i.includes("$")?n.push({type:"func",val:i,start:a}):n.push({type:"ref",val:i,start:a});continue}if(o==="("){n.push({type:"lp",val:o,start:l}),l++;continue}if(o===")"){n.push({type:"rp",val:o,start:l}),l++;continue}if(o===","){n.push({type:"comma",val:o,start:l}),l++;continue}if(o==="+"||o==="-"||o==="*"||o==="/"){n.push({type:"op",val:o,start:l}),l++;continue}if(o==="<"||o===">"||o==="="){const a=e.slice(l,l+2);a==="<="||a===">="||a==="<>"?(n.push({type:"cmp",val:a,start:l}),l+=2):(n.push({type:"cmp",val:o,start:l}),l++);continue}l++}return n}function xo(e,n,l){if(typeof e!="number"||typeof n!="number")return null;switch(l){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function vr(e,n,l,o,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Sn(n.trim(),o,a);if(!r)return null;if(e==="COUNT"){let f=0;for(let y=r.sc;y<=r.ec;y++)for(let h=r.sr;h<=r.er;h++)typeof xl(y,h,l,o,a)=="number"&&f++;return f}let d=0;for(let f=r.sc;f<=r.ec;f++)for(let y=r.sr;y<=r.er;y++)d+=gr(f,y,l,o,a);if(isNaN(d))return null;if(e==="AVERAGE"){const f=(r.ec-r.sc+1)*(r.er-r.sr+1);return f===0?null:d/f}return d}case"AND":case"OR":{const r=Kl(n);if(r.length===0)return null;let d=e==="AND";for(const f of r){const y=Vt(f,l,o,a,i);if(y===null)return null;if(e==="AND"){if(!Mn(y))return 0}else if(Mn(y))return 1}return d?1:0}case"NOT":{const r=Kl(n);if(r.length!==1)return null;const d=Vt(r[0],l,o,a,i);return d===null?null:Mn(d)?0:1}case"IF":{const r=Kl(n);if(r.length<3)return null;const d=wr(r[0],l,o,a,i);return Vt(d?r[1]:r[2],l,o,a,i)}case"VLOOKUP":{const r=Kl(n);if(r.length<3)return null;const d=Vt(r[0],l,o,a,i),f=Sn(r[1].trim(),o,a);if(!f)return null;const y=Vt(r[2],l,o,a,i),h=typeof y=="number"?y:parseFloat(String(y));if(isNaN(h))return null;const u=f.sc+(h-1);if(u<f.sc||u>f.ec)return null;if(r.length>=4?Mn(Vt(r[3],l,o,a,i)):!1){let x=-1,k=-1/0;for(let H=f.sr;H<=f.er;H++){const Y=xl(f.sc,H,l,o,a);typeof Y=="number"&&typeof d=="number"&&Y<=d&&Y>k&&(k=Y,x=H)}return x>=0?xl(u,x,l,o,a):null}for(let x=f.sr;x<=f.er;x++){const k=xl(f.sc,x,l,o,a);if(yr(k,d))return xl(u,x,l,o,a)}return null}case"CONCATENATE":{const r=Kl(n);let d="";for(const f of r){const y=Vt(f,l,o,a,i);d+=y===null?"":typeof y=="number"?String(y):y}return d}case"MAX":case"MIN":{const r=Sn(n.trim(),o,a);if(!r)return null;const d=[];for(let f=r.sc;f<=r.ec;f++)for(let y=r.sr;y<=r.er;y++){const h=xl(f,y,l,o,a);typeof h=="number"&&d.push(h)}return d.length===0?null:e==="MAX"?Math.max(...d):Math.min(...d)}case"STDEV":{const r=Sn(n.trim(),o,a);if(!r)return null;const d=[];for(let u=r.sc;u<=r.ec;u++)for(let E=r.sr;E<=r.er;E++){const x=xl(u,E,l,o,a);typeof x=="number"&&d.push(x)}const f=d.length;if(f<2)return null;const y=d.reduce((u,E)=>u+E,0)/f,h=d.reduce((u,E)=>u+Math.pow(E-y,2),0)/(f-1);return Math.sqrt(h)}case"SIN":{const r=Kl(n);if(r.length!==1)return null;const d=Vt(r[0],l,o,a,i);return typeof d!="number"?null:Math.sin(d)}case"SUMIF":{const r=Kl(n);if(r.length<2||r.length>3)return null;const d=Sn(r[0].trim(),o,a);if(!d)return null;const f=r.length===3?Sn(r[2].trim(),o,a):d;if(!f)return null;let y=0;for(let h=d.sr;h<=d.er;h++)for(let u=d.sc;u<=d.ec;u++){const E=xl(u,h,l,o,a);_d(E,r[1])&&(y+=gr(f.sc+(u-d.sc),f.sr+(h-d.sr),l,o,a))}return y}case"PMT":{const r=Kl(n);if(r.length<3||r.length>5)return null;const d=Vt(r[0],l,o,a,i),f=Vt(r[1],l,o,a,i),y=Vt(r[2],l,o,a,i);if(typeof d!="number"||typeof f!="number"||typeof y!="number")return null;const h=r.length>=4?Vt(r[3],l,o,a,i):0,u=typeof h=="number"?h:0,E=r.length>=5?Vt(r[4],l,o,a,i):0,x=Mn(E)?1:0;if(d===0)return f===0?null:-(y+u)/f;const k=Math.pow(1+d,f);return-(u+y*k)*d/((1+d*x)*(k-1))}default:return null}}function Zn(e,n,l){const o=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=ll(i[1],n,l);if(r)if(i[2]){const d=ll(i[2],n,l);if(!d)continue;for(let f=Math.min(r.col,d.col);f<=Math.max(r.col,d.col);f++)for(let y=Math.min(r.row,d.row);y<=Math.max(r.row,d.row);y++)o.push(Rn(f,y))}else o.push(Rn(r.col,r.row))}return o}function kr(e,n,l,o,a){const i=l[Rn(e,n)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const d=br(Rn(e,n),l,o,a);return d===null?"#ERROR":String(d)}function Er(e,n,l,o){return Vt(e,n,l,o,0)}function Rr(e,n,l,o){const a=e.trim().replace(/^=/,"");return a?wr(a,n,l,o,0):!1}function Jn(e,n,l,o,a,i){return n===0&&l===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,d,f,y,h)=>{const u=d?Bo(f):Bo(f)+n,E=y?parseInt(h,10)-1:parseInt(h,10)-1+l;let x;u<0?x="A":u>=o?x=i(o-1):x=i(u);let k;return E<0?k="1":E>=a?k=String(a):k=String(E+1),(d||"")+x+(y||"")+k})}class Od{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var o;const l=this.deps.get(n);if(l){for(const a of l)(o=this.rev.get(a))==null||o.delete(n);this.deps.delete(n)}}set(n,l){if(this.clear(n),l.length!==0){this.deps.set(n,l);for(const o of l)this.rev.has(o)||this.rev.set(o,new Set),this.rev.get(o).add(n)}}markDirty(n){const l=[n];for(;l.length>0;){const o=l.pop(),a=this.rev.get(o);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),l.push(i))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,l,o){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Fn.clear();for(const[a,i]of Object.entries(n))if(i.value.startsWith("=")){const r=Zn(i.value.slice(1),l,o);this.set(a,r)}}}const $d={class:"ifn-dialog__header"},Hd={class:"ifn-dialog__title"},zd={class:"ifn-dialog__body"},Wd={class:"ifn-dialog__field"},Pd={class:"ifn-dialog__label"},Ud={key:0,class:"ifn-dialog__desc"},Kd={class:"ifn-dialog__field"},Gd={class:"ifn-dialog__label"},qd={class:"ifn-dialog__footer"},Yd=["disabled"],Xd=St(t.defineComponent({__name:"insert-function-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(""),r=t.ref(""),d=t.ref(null),f=t.ref(null),y={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},h=t.computed(()=>pr.map(X=>({label:X.name,value:X.name}))),u=t.computed(()=>{const X=String(i.value??"");return X?b(l.locale,y[X]??""):""}),E=t.computed(()=>Id(r.value)),x=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!E.value.ok?!1:E.value.name===String(i.value).toUpperCase());t.watch(()=>l.modelOpen,X=>{X&&!a.value?k():!X&&a.value&&H()});function k(){r.value="",i.value="",a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{const X=d.value;if(X)try{X.focus({preventScroll:!0}),X.setSelectionRange(X.value.length,X.value.length)}catch{}})}function H(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function Y(X){i.value=X;const te=pr.find(Ne=>Ne.name===String(X));te&&(r.value="",ne(te.snippet))}function ne(X){const te=r.value,Ne=d.value,ze=Ne?Ne.selectionStart??te.length:te.length,Ve=Ne?Ne.selectionEnd??te.length:te.length,Fe=te.trim()?X:"="+X;r.value=te.slice(0,ze)+Fe+te.slice(Ve),t.nextTick(()=>{const je=d.value;if(!je)return;const _e=ze+Fe.length;try{je.focus({preventScroll:!0}),je.setSelectionRange(_e,_e)}catch{}})}function ee(){o("insert",r.value),H()}function M(){o("cancel"),H()}function se(X){X.key==="Escape"&&(X.stopPropagation(),M())}return(X,te)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"ifn-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"ifn-dialog__mask",onMousedown:t.withModifiers(M,["self"]),onKeydown:se},[t.createElementVNode("div",{ref_key:"dialogRef",ref:f,class:"ifn-dialog",onMousedown:te[1]||(te[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",$d,[t.createElementVNode("span",Hd,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:M},[...te[2]||(te[2]=[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",zd,[t.createElementVNode("div",Wd,[t.createElementVNode("label",Pd,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Dt,{class:"ifn-dialog__dropdown","model-value":i.value,options:h.value,searchable:!0,"search-placeholder":t.unref(b)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(b)(e.locale,"insertFunctionPlaceholder"),title:t.unref(b)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":Y},null,8,["model-value","options","search-placeholder","fallback-label","title"]),u.value?(t.openBlock(),t.createElementBlock("div",Ud,t.toDisplayString(u.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Kd,[t.createElementVNode("label",Gd,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":te[0]||(te[0]=Ne=>r.value=Ne),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",qd,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!x.value,onClick:ee},t.toDisplayString(t.unref(b)(e.locale,"insertFunctionBtn")),9,Yd),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:M},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b21a714"]]),In="__filter_blank__";function Do(e,n,l,o){if(Cl(e))return Number(e);if(o==="date"){const a=Nl(e,l);if(a)return a.serial}return null}function Qn(e,n,l){if(e==null)return null;if(Cl(e))return Number(e);if(n==="date"){const o=Nl(e,l);if(o)return o.serial}return null}function jd(e,n,l,o,a){const i=yl(n,l,o);switch(e.operator){case"blank":return n.trim()==="";case"notBlank":return n.trim()!=="";case"equals":case"notEquals":{const r=e.operator==="equals";if(a==="number"||a==="date"){const f=Do(n,l,o,a),y=Qn(e.value,a,o);return f==null||y==null?!1:r?f===y:f!==y}const d=i.toLowerCase()===(e.value??"").toLowerCase();return r?d:!d}case"contains":return i.toLowerCase().includes((e.value??"").toLowerCase());case"notContains":return!i.toLowerCase().includes((e.value??"").toLowerCase());case"startsWith":return i.toLowerCase().startsWith((e.value??"").toLowerCase());case"endsWith":return i.toLowerCase().endsWith((e.value??"").toLowerCase());case"gt":case"gte":case"lt":case"lte":{const r=Do(n,l,o,a),d=Qn(e.value,a,o);return r==null||d==null?!1:e.operator==="gt"?r>d:e.operator==="gte"?r>=d:e.operator==="lt"?r<d:r<=d}case"between":{const r=Do(n,l,o,a),d=Qn(e.value,a,o),f=Qn(e.value2,a,o);if(r==null||d==null||f==null)return!1;const y=Math.min(d,f),h=Math.max(d,f);return r>=y&&r<=h}}return!0}function Sr(e,n,l,o){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(n.trim()==="")return a.includes(In);const i=yl(n,l,o);return a.includes(n)||a.includes(i)}return e.condition?jd(e.condition,n,l,o,e.type):!0}function Zd(e,n,l,o){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const d=Number(r);if(d<i.startCol||d>i.endCol)continue;const f=a[r],y=l.getValue(d,n),h=l.getFormat(d,n);if(!Sr(f,y,h,o))return!1}return!0}function Jd(e,n,l,o){const a=new Set,i=[];let r=!1;const{range:d,columns:f}=e;for(let h=d.startRow+1;h<=d.endRow;h++){let u=!0;for(const k in f){const H=Number(k);if(H===n)continue;const Y=f[k];if(!Sr(Y,l.getValue(H,h),l.getFormat(H,h),o)){u=!1;break}}if(!u)continue;const E=l.getValue(n,h),x=yl(E,l.getFormat(n,h),o);if(E.trim()===""){r=!0;continue}a.has(x)||(a.add(x),i.push(x))}return i.length>0&&i.every(h=>Cl(h))?i.sort((h,u)=>Number(h)-Number(u)):i.sort((h,u)=>h.localeCompare(u,o,{numeric:!0})),{values:i,hasBlank:r}}function Mr(e){var n;return e?e.type==="values"?(((n=e.values)==null?void 0:n.length)??0)>0:!!e.condition:!1}const Qd={class:"filter-popup__head"},eu={class:"filter-popup__head-label"},tu={key:0,class:"filter-popup__head-badge"},lu={class:"filter-popup__search"},nu=["placeholder"],ou={class:"filter-popup__tools"},ru={class:"filter-popup__count"},au=["checked","onChange"],iu={class:"filter-popup__item-label"},su={key:0,class:"filter-popup__item-note"},cu={key:0,class:"filter-popup__empty"},du={class:"filter-popup__modes"},uu={key:1,class:"filter-popup__cond"},fu={class:"filter-popup__cond-row"},mu=["value"],pu={key:0,class:"filter-popup__cond-row"},hu={class:"filter-popup__cond-and"},gu={key:1,class:"filter-popup__cond-row"},bu=["placeholder"],yu={class:"filter-popup__footer"},Vo=248,eo=28,Cu=252,wu=St(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{}},setup(e){const n=e,l=t.ref(null),o=t.ref(null),a=t.ref(null),i=t.ref({left:0,top:0}),r=t.ref("values"),d=t.ref(""),f=t.ref(new Set),y=t.ref(!1),h=t.ref(0),u=t.ref(null),E=t.ref("equals"),x=t.ref(""),k=t.ref(""),H=t.computed(()=>n.getColumnCandidates(n.col)),Y=t.computed(()=>d.value.trim()!==""),ne=t.computed(()=>{const $=d.value.trim().toLowerCase();return $?H.value.values.filter(U=>U.toLowerCase().includes($)):H.value.values}),ee=t.computed(()=>{const $=ne.value.map(U=>({key:U,label:U,isBlank:!1}));return H.value.hasBlank&&!Y.value&&$.push({key:In,label:b(n.locale,"filterBlank"),isBlank:!0}),$}),M=Math.ceil(Cu/eo),se=t.computed(()=>Math.max(0,Math.floor(h.value/eo)-2)),X=t.computed(()=>Math.min(ee.value.length,se.value+M+4)),te=t.computed(()=>ee.value.slice(se.value,X.value)),Ne=t.computed(()=>se.value*eo),ze=t.computed(()=>Math.max(0,(ee.value.length-X.value)*eo));function Ve($){h.value=$.target.scrollTop}const Fe=["equals","notEquals","contains","notContains","startsWith","endsWith"],je=["equals","notEquals","gt","gte","lt","lte","between"],_e={equals:"filterEquals",notEquals:"filterNotEquals",contains:"filterContains",notContains:"filterNotContains",startsWith:"filterStartsWith",endsWith:"filterEndsWith",gt:"filterGreaterThan",gte:"filterGreaterThanOrEqual",lt:"filterLessThan",lte:"filterLessThanOrEqual",between:"filterBetween",blank:"filterBlank",notBlank:"filterNonBlank"},F=t.computed(()=>r.value==="text"?Fe:je),I=t.computed(()=>{var de;const $=n.getFilter(),U=$==null?void 0:$.columns[n.col];return U?U.type==="values"?(((de=U.values)==null?void 0:de.length)??0)>0:!!U.condition:!1});function G(){const $=n.getFilter(),U=$==null?void 0:$.columns[n.col];U&&U.type==="values"?(f.value=new Set((U.values??[]).filter(de=>de!==In)),y.value=(U.values??[]).includes(In)):U&&U.condition?(r.value=U.type,E.value=U.condition.operator,x.value=U.condition.value??"",k.value=U.condition.value2??""):(f.value=new Set(H.value.values),y.value=H.value.hasBlank)}function Ce(){if(!n.getFilter())return;const U=H.value.values,de=H.value.hasBlank;if(f.value.size===U.length&&U.every(ve=>f.value.has(ve))&&y.value===de)n.setFilterColumn(n.col,null);else{const ve=[...f.value];y.value&&ve.push(In),n.setFilterColumn(n.col,{type:"values",values:ve})}}function $e($){const U=new Set(f.value);U.has($)?U.delete($):U.add($),f.value=U}function j(){y.value=!y.value}function Be(){const $=Y.value?ne.value:H.value.values,U=new Set(f.value);$.forEach(de=>U.add(de)),f.value=U,y.value=!0}function Q(){f.value=new Set,y.value=!1}function ke($){r.value=$,E.value=$==="text"?"contains":"equals",x.value="",k.value=""}function B(){r.value="values",G()}function oe(){const $={operator:E.value,value:x.value};r.value!=="text"&&E.value==="between"&&($.value2=k.value),x.value.trim()!==""&&(n.setFilterColumn(n.col,{type:r.value,condition:$}),n.close())}function Z(){f.value=new Set(H.value.values),y.value=H.value.hasBlank}function re(){Ce(),n.close()}function K(){u.value&&n.setFilter(u.value),n.close()}function L($){const U=l.value;U&&$.target instanceof Node&&U.contains($.target)||n.close()}function J($){$.key==="Escape"&&K()}return t.onMounted(async()=>{var Le,ve;u.value=n.getFilter()?JSON.parse(JSON.stringify(n.getFilter())):null,G(),await t.nextTick();const $=((Le=l.value)==null?void 0:Le.offsetHeight)??400;let U=n.anchor.x+15-Vo,de=n.anchor.y+24;U<4&&(U=Math.max(4,n.anchor.x)),U+Vo>window.innerWidth-4&&(U=Math.max(4,window.innerWidth-Vo-4)),de+$>window.innerHeight-4&&(de=Math.max(4,n.anchor.y-$-4)),i.value={left:U,top:de},(ve=a.value)==null||ve.focus(),document.addEventListener("pointerdown",L,!0),document.addEventListener("keydown",J,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",L,!0),document.removeEventListener("keydown",J,!0)}),($,U)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:l,class:"filter-popup",style:t.normalizeStyle({left:i.value.left+"px",top:i.value.top+"px"}),onPointerdown:U[9]||(U[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Qd,[t.createElementVNode("span",eu,t.toDisplayString(e.headerLabel||t.unref(lt)(e.col)),1),I.value?(t.openBlock(),t.createElementBlock("span",tu,t.toDisplayString(t.unref(b)(e.locale,"filterActive")),1)):t.createCommentVNode("",!0)]),r.value==="values"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",lu,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":U[0]||(U[0]=de=>d.value=de),class:"filter-popup__search-input",type:"text",placeholder:t.unref(b)(e.locale,"filterSearchPlaceholder")},null,8,nu),[[t.vModelText,d.value]])]),t.createElementVNode("div",ou,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:Be},t.toDisplayString(t.unref(b)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:Q},t.toDisplayString(t.unref(b)(e.locale,"filterClearAll")),1),t.createElementVNode("span",ru,t.toDisplayString(t.unref(b)(e.locale,"filterFilteredCount").replace("{n}",String(H.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:o,class:"filter-popup__list",onScroll:Ve},[t.createElementVNode("div",{style:t.normalizeStyle({height:Ne.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,de=>(t.openBlock(),t.createElementBlock("label",{key:de.key,class:"filter-popup__item"},[t.createElementVNode("input",{type:"checkbox",checked:de.isBlank?y.value:f.value.has(de.key),onChange:Le=>de.isBlank?j():$e(de.key)},null,40,au),t.createElementVNode("span",iu,t.toDisplayString(de.label),1),de.isBlank?(t.openBlock(),t.createElementBlock("span",su,"("+t.toDisplayString(t.unref(b)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ze.value+"px"})},null,4),ee.value.length===0?(t.openBlock(),t.createElementBlock("div",cu,t.toDisplayString(t.unref(b)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",du,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[1]||(U[1]=de=>ke("text"))},t.toDisplayString(t.unref(b)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[2]||(U[2]=de=>ke("number"))},t.toDisplayString(t.unref(b)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[3]||(U[3]=de=>ke("date"))},t.toDisplayString(t.unref(b)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",uu,[t.createElementVNode("button",{class:"filter-popup__cond-back",onClick:B}," ← "+t.toDisplayString(t.unref(b)(e.locale,"filterCustom")),1),t.createElementVNode("div",fu,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":U[4]||(U[4]=de=>E.value=de),class:"filter-popup__cond-select"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(F.value,de=>(t.openBlock(),t.createElementBlock("option",{key:de,value:de},t.toDisplayString(t.unref(b)(e.locale,_e[de])),9,mu))),128))],512),[[t.vModelSelect,E.value]])]),E.value==="between"?(t.openBlock(),t.createElementBlock("div",pu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[5]||(U[5]=de=>x.value=de),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,x.value]]),t.createElementVNode("span",hu,t.toDisplayString(t.unref(b)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[6]||(U[6]=de=>k.value=de),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,k.value]])])):(t.openBlock(),t.createElementBlock("div",gu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[7]||(U[7]=de=>x.value=de),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"2024-01-01":"",onKeydown:t.withKeys(oe,["enter"])},null,40,bu),[[t.vModelText,x.value]])]))])),t.createElementVNode("div",yu,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:Z},t.toDisplayString(t.unref(b)(e.locale,"clearFilter")),1),U[10]||(U[10]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:K},t.toDisplayString(t.unref(b)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:U[8]||(U[8]=de=>r.value==="values"?re():oe())},t.toDisplayString(t.unref(b)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-f6b7d944"]]),vu={class:"cf-manager__header"},ku={class:"cf-manager__title"},Eu={key:0,class:"cf-manager__empty"},Ru={key:1,class:"cf-manager__list"},Su={class:"cf-rule__main"},Mu={class:"cf-rule__info"},Bu={class:"cf-rule__summary"},Tu={class:"cf-rule__range"},Nu={class:"cf-rule__actions"},xu={class:"cf-chk"},Du=["checked","onChange"],Vu=["title","onClick"],Fu=["title","onClick"],Iu=["title","onClick"],Au=["title","onClick"],_u=St(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:n}){const l=e,o=n,a=t.computed(()=>[...l.rules].sort((f,y)=>f.priority-y.priority));function i(f){return f.ranges.map(y=>{const h=lt(y.startCol)+(y.startRow+1);return y.startCol===y.endCol&&y.startRow===y.endRow?h:h+":"+lt(y.endCol)+(y.endRow+1)}).join(", ")}function r(f){switch(f.type){case"cellIs":{const y=b(l.locale,"cf"+(f.operator==="greaterThan"?"GreaterThan":f.operator==="lessThan"?"LessThan":f.operator==="greaterThanOrEqual"?"GreaterThanOrEqual":f.operator==="lessThanOrEqual"?"LessThanOrEqual":f.operator==="notEqual"?"NotEqual":f.operator==="between"?"Between":f.operator==="notBetween"?"NotBetween":"Equal"));return f.operator==="between"||f.operator==="notBetween"?`${y} ${f.value} ${b(l.locale,"cfValue2")} ${f.value2??""}`:`${y} ${f.value}`}case"textContains":return`${b(l.locale,"cfTextContains")} "${f.value}"`;case"textNotContains":return`${b(l.locale,"cfTextNotContains")} "${f.value}"`;case"blank":return b(l.locale,"cfBlank");case"notBlank":return b(l.locale,"cfNotBlank");case"duplicate":return b(l.locale,"cfDuplicate");case"unique":return b(l.locale,"cfUnique");case"formula":return"= "+f.formula;default:return b(l.locale,"cfRuleTypeGeneric")}}function d(f){const y={};return f.format.backgroundColor&&(y.background=f.format.backgroundColor),f.format.color&&(y.color=f.format.color),f.format.fontWeight==="bold"&&(y.fontWeight="700"),f.format.fontStyle==="italic"&&(y.fontStyle="italic"),f.format.underline==="underline"&&(y.textDecoration="underline"),f.format.strikethrough==="line-through"&&(y.textDecoration="line-through"),y}return(f,y)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",vu,[t.createElementVNode("span",ku,t.toDisplayString(t.unref(b)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",onClick:y[0]||(y[0]=h=>o("new"))},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:y[1]||(y[1]=h=>o("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",Eu,t.toDisplayString(t.unref(b)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",Ru,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,h=>(t.openBlock(),t.createElementBlock("div",{key:h.id,class:t.normalizeClass(["cf-rule",{"cf-rule--disabled":!h.enabled}])},[t.createElementVNode("div",Su,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(d(h))},"Aa",4),t.createElementVNode("div",Mu,[t.createElementVNode("div",Bu,t.toDisplayString(r(h.condition)),1),t.createElementVNode("div",Tu,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(h)),1)])]),t.createElementVNode("div",Nu,[t.createElementVNode("label",xu,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:h.enabled,onChange:u=>o("toggle",h.id,u.target.checked)},null,40,Du),y[2]||(y[2]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)]),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfMoveUp"),onClick:u=>o("move",h.id,"up")},[...y[3]||(y[3]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 7 L8 3 L12 7"})],-1)])],8,Vu),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfMoveDown"),onClick:u=>o("move",h.id,"down")},[...y[4]||(y[4]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 9 L8 13 L12 9"})],-1)])],8,Fu),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfEdit"),onClick:u=>o("edit",h)},[...y[5]||(y[5]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M10.5 3.5 L13 6 L5 14 L2 14 L2 11 Z"}),t.createElementVNode("path",{d:"M9 5.5 L11.5 8"})],-1)])],8,Iu),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfDelete"),onClick:u=>o("delete",h.id)},[...y[6]||(y[6]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},[t.createElementVNode("path",{d:"M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5"})],-1)])],8,Au)])],2))),128))]))],4))}}),[["__scopeId","data-v-230c5fcf"]]),Lu={class:"cf-editor__header"},Ou={class:"cf-editor__title"},$u={class:"cf-editor__body"},Hu={class:"cf-row"},zu={class:"cf-label"},Wu={class:"cf-row"},Pu={class:"cf-label"},Uu={class:"cf-row"},Ku={class:"cf-label"},Gu={key:0,class:"cf-row"},qu={class:"cf-label"},Yu={class:"cf-row"},Xu={class:"cf-label"},ju=["placeholder"],Zu={class:"cf-hint"},Ju={key:2,class:"cf-row"},Qu={class:"cf-label"},ef={class:"cf-row"},tf={class:"cf-label"},lf={class:"cf-format-row"},nf=["title"],of={viewBox:"0 0 1024 1024",fill:"currentColor"},rf=["fill"],af=["title"],sf={viewBox:"0 0 1024 1024",fill:"currentColor"},cf=["fill"],df=["title"],uf=["title"],ff=["title"],mf=["title"],pf={class:"cf-row"},hf={class:"cf-label"},gf={key:3,class:"cf-error"},bf={class:"cf-row cf-row--inline"},yf={class:"cf-chk"},Cf=["checked"],wf={class:"cf-chk"},vf=["checked"],kf={class:"cf-editor__footer"},Ef=St(t.defineComponent({__name:"conditional-format-rule-editor",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel"],setup(e,{emit:n}){const l=e,o=n,a=[{label:"cfCellIs",value:"cellIs"},{label:"cfTextContains",value:"textContains"},{label:"cfTextNotContains",value:"textNotContains"},{label:"cfBlank",value:"blank"},{label:"cfNotBlank",value:"notBlank"},{label:"cfDuplicate",value:"duplicate"},{label:"cfUnique",value:"unique"},{label:"cfFormulaShort",value:"formula"}],i=[{label:"cfEqual",value:"equal"},{label:"cfNotEqual",value:"notEqual"},{label:"cfGreaterThan",value:"greaterThan"},{label:"cfGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"cfLessThan",value:"lessThan"},{label:"cfLessThanOrEqual",value:"lessThanOrEqual"},{label:"cfBetween",value:"between"},{label:"cfNotBetween",value:"notBetween"}];function r(){if(l.rule){const F=l.rule.condition;return{type:F.type==="cellIs"||F.type==="textContains"||F.type==="textNotContains"||F.type==="blank"||F.type==="notBlank"||F.type==="duplicate"||F.type==="unique"||F.type==="formula"?F.type:"cellIs",operator:F.type==="cellIs"?F.operator:"greaterThan",value:F.type==="cellIs"||F.type==="textContains"||F.type==="textNotContains"?F.value:"",value2:F.type==="cellIs"?F.value2??"":"",formula:F.type==="formula"?F.formula:"",backgroundColor:l.rule.format.backgroundColor??"",color:l.rule.format.color??"",fontWeight:l.rule.format.fontWeight==="bold",fontStyle:l.rule.format.fontStyle==="italic",underline:l.rule.format.underline==="underline",strikethrough:l.rule.format.strikethrough==="line-through",rangeText:l.rule.ranges.length?l.rule.ranges.map(G=>x(G)).join(", "):l.defaultRangeText,stopIfTrue:l.rule.stopIfTrue,enabled:l.rule.enabled}}return{type:"cellIs",operator:"greaterThan",value:"",value2:"",formula:"",backgroundColor:"#DEEBF7",color:"#17375E",fontWeight:!1,fontStyle:!1,underline:!1,strikethrough:!1,rangeText:l.defaultRangeText,stopIfTrue:!1,enabled:!0}}const d=t.reactive(r()),f=t.ref(!1),y=t.ref(!1),h=t.ref(null),u=t.ref(null),E=t.ref("");function x(F){const I=lt(F.startCol)+(F.startRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?I:I+":"+lt(F.endCol)+(F.endRow+1)}function k(F){const I=F.split(",").map(Ce=>Ce.trim()).filter(Boolean),G=[];for(const Ce of I){if(!Ce.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const j=ll(Ce.split(":")[0],99999,99999),Be=Ce.split(":")[1],Q=Be?ll(Be,99999,99999):j;if(!j||!Q)return null;G.push({startCol:Math.min(j.col,Q.col),endCol:Math.max(j.col,Q.col),startRow:Math.min(j.row,Q.row),endRow:Math.max(j.row,Q.row)})}return G.length?G:null}const H=t.computed(()=>d.type==="cellIs"&&(d.operator==="between"||d.operator==="notBetween")),Y=t.computed(()=>d.type==="formula"),ne=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(d.type)),ee=t.computed(()=>a.map(F=>({value:F.value,label:b(l.locale,F.label)}))),M=t.computed(()=>i.map(F=>({value:F.value,label:b(l.locale,F.label)})));function se(F){d.type=F}function X(F){d.operator=String(F)}function te(){f.value=!f.value}function Ne(){y.value=!y.value}function ze(){return E.value="",k(d.rangeText)?Y.value&&!d.formula.trim()?(E.value="请输入公式",!1):!0:(E.value="范围格式无效,例如 A1:B10",!1)}function Ve(){switch(d.type){case"cellIs":return{type:"cellIs",operator:d.operator,value:d.value,value2:d.value2||void 0};case"textContains":return{type:"textContains",value:d.value};case"textNotContains":return{type:"textNotContains",value:d.value};case"blank":return{type:"blank"};case"notBlank":return{type:"notBlank"};case"duplicate":return{type:"duplicate"};case"unique":return{type:"unique"};case"formula":return{type:"formula",formula:d.formula}}}function Fe(){return{backgroundColor:d.backgroundColor||void 0,color:d.color||void 0,fontWeight:d.fontWeight?"bold":"",fontStyle:d.fontStyle?"italic":"",underline:d.underline?"underline":"",strikethrough:d.strikethrough?"line-through":""}}function je(){var G,Ce;if(!ze())return;const F=k(d.rangeText),I={id:((G=l.rule)==null?void 0:G.id)??"",condition:Ve(),format:Fe(),ranges:F,priority:((Ce=l.rule)==null?void 0:Ce.priority)??0,stopIfTrue:d.stopIfTrue,enabled:d.enabled};o("save",I)}function _e(){o("cancel")}return(F,I)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Lu,[t.createElementVNode("span",Ou,t.toDisplayString(e.mode==="edit"?t.unref(b)(e.locale,"cfEdit"):t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-editor__close",onClick:_e}," × ")]),t.createElementVNode("div",$u,[t.createElementVNode("div",Hu,[t.createElementVNode("label",zu,t.toDisplayString(t.unref(b)(e.locale,"cfType")),1),t.createVNode(Dt,{class:"cf-dropdown","model-value":d.type,options:ee.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"cfType"),align:"right",onChange:se},null,8,["model-value","options","title"])]),d.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Wu,[t.createElementVNode("label",Pu,t.toDisplayString(t.unref(b)(e.locale,"cfOperator")),1),t.createVNode(Dt,{class:"cf-dropdown","model-value":d.operator,options:M.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"cfOperator"),align:"right",onChange:X},null,8,["model-value","options","title"])]),t.createElementVNode("div",Uu,[t.createElementVNode("label",Ku,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[0]||(I[0]=G=>d.value=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value]])]),H.value?(t.openBlock(),t.createElementBlock("div",Gu,[t.createElementVNode("label",qu,t.toDisplayString(t.unref(b)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=G=>d.value2=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value2]])])):t.createCommentVNode("",!0)],64)):Y.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Yu,[t.createElementVNode("label",Xu,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[2]||(I[2]=G=>d.formula=G),class:"cf-input",type:"text",placeholder:t.unref(b)(e.locale,"cfFormulaExample")},null,8,ju),[[t.vModelText,d.formula]])]),t.createElementVNode("p",Zu,t.toDisplayString(t.unref(b)(e.locale,"cfFormula")),1)],64)):ne.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Ju,[t.createElementVNode("label",Qu,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[3]||(I[3]=G=>d.value=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value]])])),t.createElementVNode("div",ef,[t.createElementVNode("label",tf,t.toDisplayString(t.unref(b)(e.locale,"cfFormat")),1),t.createElementVNode("div",lf,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:h,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":f.value}]),title:t.unref(b)(e.locale,"fillColor"),onClick:te},[(t.openBlock(),t.createElementBlock("svg",of,[I[15]||(I[15]=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:d.backgroundColor||"currentColor"},null,8,rf)]))],10,nf),t.createVNode(Yn,{"model-open":f.value,"color-key":"fill","current-color":d.backgroundColor,"trigger-el":h.value,locale:e.locale,"onUpdate:modelOpen":I[4]||(I[4]=G=>f.value=G),onChange:I[5]||(I[5]=G=>d.backgroundColor=G)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:u,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":y.value}]),title:t.unref(b)(e.locale,"fontColor"),onClick:Ne},[(t.openBlock(),t.createElementBlock("svg",sf,[I[16]||(I[16]=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:d.color||"#000000"},null,8,cf)]))],10,af),t.createVNode(Yn,{"model-open":y.value,"color-key":"text","current-color":d.color,"trigger-el":u.value,locale:e.locale,"onUpdate:modelOpen":I[6]||(I[6]=G=>y.value=G),onChange:I[7]||(I[7]=G=>d.color=G)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.fontWeight}]),title:t.unref(b)(e.locale,"bold"),onClick:I[8]||(I[8]=G=>d.fontWeight=!d.fontWeight)},[...I[17]||(I[17]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)])],10,df),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.fontStyle}]),title:t.unref(b)(e.locale,"italic"),onClick:I[9]||(I[9]=G=>d.fontStyle=!d.fontStyle)},[...I[18]||(I[18]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)])],10,uf),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.underline}]),title:t.unref(b)(e.locale,"underline"),onClick:I[10]||(I[10]=G=>d.underline=!d.underline)},[...I[19]||(I[19]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)])],10,ff),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.strikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),onClick:I[11]||(I[11]=G=>d.strikethrough=!d.strikethrough)},[...I[20]||(I[20]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)])],10,mf)])]),t.createElementVNode("div",pf,[t.createElementVNode("label",hf,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[12]||(I[12]=G=>d.rangeText=G),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.rangeText]])]),E.value?(t.openBlock(),t.createElementBlock("div",gf,t.toDisplayString(E.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",bf,[t.createElementVNode("label",yf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:d.stopIfTrue,onChange:I[13]||(I[13]=G=>d.stopIfTrue=G.target.checked)},null,40,Cf),I[21]||(I[21]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfStopIfTrue")),1)]),t.createElementVNode("label",wf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:d.enabled,onChange:I[14]||(I[14]=G=>d.enabled=G.target.checked)},null,40,vf),I[22]||(I[22]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)])])]),t.createElementVNode("div",kf,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:je},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:_e},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-f625bb44"]]),Rf={class:"dv-editor__header"},Sf={class:"dv-editor__title"},Mf={class:"dv-editor__body"},Bf={class:"dv-sec"},Tf={class:"dv-sec__title"},Nf={class:"dv-row"},xf={class:"dv-label"},Df={class:"dv-row"},Vf={class:"dv-label"},Ff={class:"dv-hint"},If={class:"dv-row dv-row--inline"},Af={class:"dv-chk"},_f=["checked"],Lf={class:"dv-row"},Of={class:"dv-label"},$f={class:"dv-hint"},Hf={class:"dv-row"},zf={class:"dv-label"},Wf={key:0,class:"dv-row"},Pf={class:"dv-label"},Uf={class:"dv-row"},Kf={class:"dv-label"},Gf={class:"dv-row"},qf={class:"dv-label"},Yf={class:"dv-row dv-row--inline"},Xf=["checked","disabled"],jf=["checked","disabled"],Zf={class:"dv-sec"},Jf={class:"dv-sec__title"},Qf={class:"dv-row dv-row--inline"},em={class:"dv-chk"},tm=["checked"],lm={class:"dv-row"},nm={class:"dv-label"},om=["disabled"],rm={class:"dv-row dv-row--top"},am={class:"dv-label"},im=["disabled"],sm={class:"dv-sec"},cm={class:"dv-sec__title"},dm={class:"dv-row dv-row--inline"},um={class:"dv-chk"},fm=["checked"],mm={class:"dv-row"},pm={class:"dv-label"},hm={class:"dv-row"},gm={class:"dv-label"},bm=["disabled"],ym={class:"dv-row dv-row--top"},Cm={class:"dv-label"},wm=["disabled"],vm={class:"dv-sec"},km={class:"dv-row"},Em={class:"dv-label"},Rm={key:0,class:"dv-error"},Sm={class:"dv-editor__footer"},to="\\$?[A-Za-z]+\\$?\\d+",Mm=St(t.defineComponent({__name:"data-validation-dialog",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel","clear"],setup(e,{emit:n}){const l=e,o=n,a=[{label:"dvTypeAny",value:"any"},{label:"dvTypeList",value:"list"},{label:"dvTypeWholeNumber",value:"wholeNumber"},{label:"dvTypeDecimal",value:"decimal"},{label:"dvTypeDate",value:"date"},{label:"dvTypeTime",value:"time"},{label:"dvTypeTextLength",value:"textLength"},{label:"dvTypeCustom",value:"custom"}],i=[{label:"dvBetween",value:"between"},{label:"dvNotBetween",value:"notBetween"},{label:"dvEqual",value:"equal"},{label:"dvNotEqual",value:"notEqual"},{label:"dvGreaterThan",value:"greaterThan"},{label:"dvGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"dvLessThan",value:"lessThan"},{label:"dvLessThanOrEqual",value:"lessThanOrEqual"}],r=[{label:"dvStyleStop",value:"stop"},{label:"dvStyleWarning",value:"warning"},{label:"dvStyleInformation",value:"information"}];function d(F){const I=lt(F.startCol)+(F.startRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?I:I+":"+lt(F.endCol)+(F.endRow+1)}function f(F){const I=F==null?void 0:F.listSource;if((I==null?void 0:I.type)==="range"){const Ce=d(I.range);return I.sheetId?`${I.sheetId}!${Ce}`:Ce}return((I==null?void 0:I.type)==="values"?I.values:(F==null?void 0:F.values)??[]).join(",")}function y(){const F=l.rule;return{type:(F==null?void 0:F.type)??"any",operator:(F==null?void 0:F.operator)??"between",formula1:(F==null?void 0:F.formula1)??"",formula2:(F==null?void 0:F.formula2)??"",source:f(F),allowBlank:(F==null?void 0:F.allowBlank)!==!1,showDropdown:(F==null?void 0:F.showDropdown)!==!1,showInputMessage:(F==null?void 0:F.showInputMessage)===!0,inputTitle:(F==null?void 0:F.inputTitle)??"",inputMessage:(F==null?void 0:F.inputMessage)??"",showErrorMessage:(F==null?void 0:F.showErrorMessage)!==!1,errorStyle:(F==null?void 0:F.errorStyle)??"stop",errorTitle:(F==null?void 0:F.errorTitle)??"",errorMessage:(F==null?void 0:F.errorMessage)??"",rangeText:F&&F.ranges.length?F.ranges.map(d).join(", "):l.defaultRangeText,enabled:(F==null?void 0:F.enabled)!==!1}}const h=t.reactive(y()),u=t.ref(""),E=t.computed(()=>h.type==="list"),x=t.computed(()=>h.type==="custom"),k=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(h.type)),H=t.computed(()=>k.value&&(h.operator==="between"||h.operator==="notBetween")),Y=t.computed(()=>h.type==="any"),ne=t.computed(()=>a.map(F=>({value:F.value,label:b(l.locale,F.label)}))),ee=t.computed(()=>i.map(F=>({value:F.value,label:b(l.locale,F.label)}))),M=t.computed(()=>r.map(F=>({value:F.value,label:b(l.locale,F.label)})));function se(F){const I=F.split(",").map(Ce=>Ce.trim()).filter(Boolean),G=[];for(const Ce of I){if(!Ce.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const j=ll(Ce.split(":")[0],99999,99999),Be=Ce.split(":")[1],Q=Be?ll(Be,99999,99999):j;if(!j||!Q)return null;G.push({startCol:Math.min(j.col,Q.col),endCol:Math.max(j.col,Q.col),startRow:Math.min(j.row,Q.row),endRow:Math.max(j.row,Q.row)})}return G.length?G:null}function X(F){const I=F.trim();if(!I)return null;const G=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${to})(?::(${to}))?$`).exec(I);if(G){const j=(G[1]??G[2]??"").trim(),Be=ll(G[3],99999,99999),Q=G[4]?ll(G[4],99999,99999):Be;return!j||!Be||!Q?null:{type:"range",sheetId:j,range:{startCol:Math.min(Be.col,Q.col),endCol:Math.max(Be.col,Q.col),startRow:Math.min(Be.row,Q.row),endRow:Math.max(Be.row,Q.row)}}}const Ce=new RegExp(`^(${to})(?::(${to}))?$`).exec(I);if(Ce){const j=ll(Ce[1],99999,99999),Be=Ce[2]?ll(Ce[2],99999,99999):j;return!j||!Be?null:{type:"range",range:{startCol:Math.min(j.col,Be.col),endCol:Math.max(j.col,Be.col),startRow:Math.min(j.row,Be.row),endRow:Math.max(j.row,Be.row)}}}const $e=I.split(",").map(j=>j.trim());return $e.some(j=>j!=="")?{type:"values",values:$e}:null}const te=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Ne(F,I){const G=I.trim();if(G==="")return b(l.locale,"dvValueRequired");if(G.startsWith("="))return null;const Ce=l.locale;switch(F){case"wholeNumber":case"textLength":{const $e=qn(G,Ce);return $e&&Number.isFinite($e.num)&&Number.isInteger($e.num)||te.test(G)&&Number.isInteger(Number(G))?null:b(Ce,"dvMustBeInteger")}case"decimal":{const $e=qn(G,Ce);return $e&&Number.isFinite($e.num)||te.test(G)&&Number.isFinite(Number(G))?null:b(Ce,"dvMustBeNumber")}case"date":{const $e=Nl(G,Ce);return $e&&$e.format!=="h:mm:ss"?null:b(Ce,"dvDateInvalid")}case"time":return Nl(G,Ce)?null:b(Ce,"dvTimeInvalid");default:return null}}function ze(){if(u.value="",!se(h.rangeText))return u.value=b(l.locale,"dvRangeInvalid"),!1;if(h.type==="any")return!0;if(E.value)return X(h.source)?!0:(u.value=b(l.locale,"dvSourceInvalid"),!1);if(x.value)return h.formula1.trim()?!0:(u.value=b(l.locale,"dvFormulaRequired"),!1);if(H.value){if(!h.formula1.trim())return u.value=b(l.locale,"dvMinRequired"),!1;if(!h.formula2.trim())return u.value=b(l.locale,"dvMaxRequired"),!1;const I=Ne(h.type,h.formula1);if(I)return u.value=`${b(l.locale,"dvMin")}:${I}`,!1;const G=Ne(h.type,h.formula2);return G?(u.value=`${b(l.locale,"dvMax")}:${G}`,!1):!0}if(!h.formula1.trim())return u.value=b(l.locale,"dvValueRequired"),!1;const F=Ne(h.type,h.formula1);return F?(u.value=`${b(l.locale,"dvValue")}:${F}`,!1):!0}function Ve(){var G,Ce;if(!ze())return;const F=se(h.rangeText);if(h.type==="any"){o("save",{id:((G=l.rule)==null?void 0:G.id)??"",type:"any",ranges:F,allowBlank:h.allowBlank,enabled:!0});return}const I={id:((Ce=l.rule)==null?void 0:Ce.id)??"",type:h.type,ranges:F,allowBlank:h.allowBlank,enabled:h.enabled,showInputMessage:h.showInputMessage,inputTitle:h.inputTitle||void 0,inputMessage:h.inputMessage||void 0,showErrorMessage:h.showErrorMessage,errorStyle:h.errorStyle,errorTitle:h.errorTitle||void 0,errorMessage:h.errorMessage||void 0};if(E.value){const $e=X(h.source);I.listSource=$e,I.values=$e.type==="values"?$e.values:void 0,I.showDropdown=h.showDropdown}else x.value?I.formula1=h.formula1.trim():(I.operator=h.operator,I.formula1=h.formula1.trim(),I.formula2=H.value?h.formula2.trim():void 0);o("save",I)}function Fe(F){h.type=F}function je(F){h.operator=String(F)}function _e(F){h.errorStyle=String(F)}return(F,I)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Rf,[t.createElementVNode("span",Sf,t.toDisplayString(t.unref(b)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:I[0]||(I[0]=G=>o("cancel"))}," × ")]),t.createElementVNode("div",Mf,[t.createElementVNode("div",Bf,[t.createElementVNode("div",Tf,t.toDisplayString(t.unref(b)(e.locale,"dvSettings")),1),t.createElementVNode("div",Nf,[t.createElementVNode("label",xf,t.toDisplayString(t.unref(b)(e.locale,"dvAllow")),1),t.createVNode(Dt,{class:"dv-dropdown","model-value":h.type,options:ne.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"dvAllow"),align:"right",onChange:Fe},null,8,["model-value","options","title"])]),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Df,[t.createElementVNode("label",Vf,t.toDisplayString(t.unref(b)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=G=>h.source=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.source]])]),t.createElementVNode("p",Ff,t.toDisplayString(t.unref(b)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",If,[t.createElementVNode("label",Af,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showDropdown,onChange:I[2]||(I[2]=G=>h.showDropdown=G.target.checked)},null,40,_f),I[18]||(I[18]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowDropdown")),1)])])],64)):x.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Lf,[t.createElementVNode("label",Of,t.toDisplayString(t.unref(b)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[3]||(I[3]=G=>h.formula1=G),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("p",$f,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaExample")),1)],64)):k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",Hf,[t.createElementVNode("label",zf,t.toDisplayString(t.unref(b)(e.locale,"dvData")),1),t.createVNode(Dt,{class:"dv-dropdown","model-value":h.operator,options:ee.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"dvOperator"),align:"right",onChange:je},null,8,["model-value","options","title"])]),H.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Uf,[t.createElementVNode("label",Kf,t.toDisplayString(t.unref(b)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[5]||(I[5]=G=>h.formula1=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("div",Gf,[t.createElementVNode("label",qf,t.toDisplayString(t.unref(b)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[6]||(I[6]=G=>h.formula2=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",Wf,[t.createElementVNode("label",Pf,t.toDisplayString(t.unref(b)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[4]||(I[4]=G=>h.formula1=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",Yf,[t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":Y.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.allowBlank,disabled:Y.value,onChange:I[7]||(I[7]=G=>h.allowBlank=G.target.checked)},null,40,Xf),I[19]||(I[19]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvIgnoreBlank")),1)],2),t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":Y.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.enabled,disabled:Y.value,onChange:I[8]||(I[8]=G=>h.enabled=G.target.checked)},null,40,jf),I[20]||(I[20]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)],2)])]),t.createElementVNode("div",Zf,[t.createElementVNode("div",Jf,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",Qf,[t.createElementVNode("label",em,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showInputMessage,onChange:I[9]||(I[9]=G=>h.showInputMessage=G.target.checked)},null,40,tm),I[21]||(I[21]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowInputMessage")),1)])]),t.createElementVNode("div",lm,[t.createElementVNode("label",nm,t.toDisplayString(t.unref(b)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[10]||(I[10]=G=>h.inputTitle=G),class:"dv-input",type:"text",disabled:!h.showInputMessage},null,8,om),[[t.vModelText,h.inputTitle]])]),t.createElementVNode("div",rm,[t.createElementVNode("label",am,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":I[11]||(I[11]=G=>h.inputMessage=G),class:"dv-input dv-input--area",rows:"2",disabled:!h.showInputMessage},null,8,im),[[t.vModelText,h.inputMessage]])])]),t.createElementVNode("div",sm,[t.createElementVNode("div",cm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",dm,[t.createElementVNode("label",um,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showErrorMessage,onChange:I[12]||(I[12]=G=>h.showErrorMessage=G.target.checked)},null,40,fm),I[22]||(I[22]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowErrorAlert")),1)])]),t.createElementVNode("div",mm,[t.createElementVNode("label",pm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorStyle")),1),t.createVNode(Dt,{class:"dv-dropdown","model-value":h.errorStyle,options:M.value,width:"100%","visible-count":4,title:t.unref(b)(e.locale,"dvErrorStyle"),align:"right",onChange:_e},null,8,["model-value","options","title"])]),t.createElementVNode("div",hm,[t.createElementVNode("label",gm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[13]||(I[13]=G=>h.errorTitle=G),class:"dv-input",type:"text",disabled:!h.showErrorMessage},null,8,bm),[[t.vModelText,h.errorTitle]])]),t.createElementVNode("div",ym,[t.createElementVNode("label",Cm,t.toDisplayString(t.unref(b)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":I[14]||(I[14]=G=>h.errorMessage=G),class:"dv-input dv-input--area",rows:"2",disabled:!h.showErrorMessage},null,8,wm),[[t.vModelText,h.errorMessage]])])]),t.createElementVNode("div",vm,[t.createElementVNode("div",km,[t.createElementVNode("label",Em,t.toDisplayString(t.unref(b)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[15]||(I[15]=G=>h.rangeText=G),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.rangeText]])])]),u.value?(t.openBlock(),t.createElementBlock("div",Rm,t.toDisplayString(u.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Sm,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",onClick:I[16]||(I[16]=G=>o("clear"))},t.toDisplayString(t.unref(b)(e.locale,"dvClearAll")),1),I[23]||(I[23]=t.createElementVNode("span",{class:"dv-editor__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--primary",onClick:Ve},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:I[17]||(I[17]=G=>o("cancel"))},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-3f7d54bb"]]),Bm={key:0,class:"dvd__search"},Tm=["placeholder"],Nm=["onMouseenter","onClick"],xm={class:"dvd__check"},Dm={class:"dvd__label"},Vm={key:1,class:"dvd__empty"},cl=24,Fm=244,Im=140,Am=St(t.defineComponent({__name:"data-validation-dropdown",props:{items:{default:()=>[]},current:{default:""},locale:{default:"zh-CN"},x:{default:0},y:{default:0},width:{default:100},height:{default:24}},emits:["select","close"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(""),i=t.ref(0),r=t.ref(0),d=t.ref(null),f=t.ref(null),y=t.ref(null),h=t.ref({left:l.x,top:l.y+l.height+2,up:!1}),u=t.computed(()=>{const F=a.value.trim().toLowerCase();return F?l.items.filter(I=>String(I??"").toLowerCase().includes(F)):l.items}),E=t.computed(()=>Math.min(Fm,Math.max(cl,u.value.length*cl))),x=t.computed(()=>Math.max(Im,Math.min(360,l.width))),k=t.computed(()=>Math.max(0,Math.floor(r.value/cl)-1)),H=t.computed(()=>Math.min(u.value.length,Math.ceil((r.value+E.value)/cl)+1)),Y=t.computed(()=>u.value.slice(k.value,H.value)),ne=t.computed(()=>k.value*cl),ee=t.computed(()=>Math.max(0,(u.value.length-H.value)*cl));function M(F){return String(F??"").trim().toLowerCase()===String(l.current??"").trim().toLowerCase()}function se(){const F=E.value+X(),I=window.innerHeight-(l.y+l.height)-8,G=l.y-8,Ce=I<F&&G>I;let $e=Ce?l.y-F-2:l.y+l.height+2;$e=Math.max(8,Math.min(window.innerHeight-F-8,$e));const j=Math.max(8,Math.min(window.innerWidth-x.value-8,l.x));h.value={left:j,top:$e,up:Ce}}function X(){return u.value.length>8||a.value?34:0}t.watch(()=>[l.x,l.y,l.width,l.height],()=>se()),t.onMounted(()=>{t.nextTick(()=>{var F;se(),d.value?d.value.focus():(F=y.value)==null||F.focus()}),document.addEventListener("pointerdown",te,!0),window.addEventListener("resize",Ne),window.addEventListener("scroll",Ne,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",te,!0),window.removeEventListener("resize",Ne),window.removeEventListener("scroll",Ne,!0)});function te(F){var I;(I=y.value)!=null&&I.contains(F.target)||Ne()}function Ne(){o("close")}function ze(F){const I=f.value;if(!I)return;const G=F*cl,Ce=G+cl;G<I.scrollTop?I.scrollTop=G:Ce>I.scrollTop+E.value&&(I.scrollTop=Ce-E.value)}function Ve(F){const I=u.value.length;I!==0&&(i.value=(i.value+F+I)%I,ze(i.value))}function Fe(F){const I=u.value[F];I!==void 0&&o("select",I)}function je(F){r.value=F.target.scrollTop}function _e(F){switch(F.key){case"ArrowDown":F.preventDefault(),F.stopPropagation(),Ve(1);return;case"ArrowUp":F.preventDefault(),F.stopPropagation(),Ve(-1);return;case"Home":F.preventDefault(),F.stopPropagation(),i.value=0,r.value=0,f.value&&(f.value.scrollTop=0);return;case"End":{F.preventDefault(),F.stopPropagation();const I=u.value.length;i.value=Math.max(0,I-1),ze(i.value);return}case"PageDown":F.preventDefault(),F.stopPropagation(),Ve(Math.max(1,Math.floor(E.value/cl)));return;case"PageUp":F.preventDefault(),F.stopPropagation(),Ve(-Math.max(1,Math.floor(E.value/cl)));return;case"Enter":F.preventDefault(),F.stopPropagation(),Fe(i.value);return;case"Escape":F.preventDefault(),F.stopPropagation(),Ne();return;case"Tab":F.preventDefault(),F.stopPropagation(),Fe(i.value);return}}return t.watch(a,()=>{i.value=0,r.value=0,f.value&&(f.value.scrollTop=0),t.nextTick(se)}),t.watch(u,F=>{const I=F.findIndex(G=>M(G));I>=0&&(i.value=I,t.nextTick(()=>ze(I)))},{immediate:!0}),(F,I)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"dvd",tabindex:"-1",style:t.normalizeStyle({left:h.value.left+"px",top:h.value.top+"px",width:x.value+"px"}),onKeydown:_e,onWheel:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},[X()>0?(t.openBlock(),t.createElementBlock("div",Bm,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:d,"onUpdate:modelValue":I[0]||(I[0]=G=>a.value=G),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(b)(e.locale,"dvSearchPlaceholder"),onKeydown:_e},null,40,Tm),[[t.vModelText,a.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:f,class:"dvd__list",style:t.normalizeStyle({height:E.value+"px"}),onScroll:je},[t.createElementVNode("div",{style:t.normalizeStyle({height:ne.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y.value,(G,Ce)=>(t.openBlock(),t.createElementBlock("div",{key:k.value+Ce,class:t.normalizeClass(["dvd__item",{"dvd__item--active":k.value+Ce===i.value,"dvd__item--checked":M(G)}]),style:t.normalizeStyle({height:cl+"px",lineHeight:cl+"px"}),onMousedown:I[1]||(I[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:$e=>i.value=k.value+Ce,onClick:$e=>Fe(k.value+Ce)},[t.createElementVNode("span",xm,t.toDisplayString(M(G)?"✓":""),1),t.createElementVNode("span",Dm,t.toDisplayString(G===""?"(空)":G),1)],46,Nm))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ee.value+"px"})},null,4)],36),u.value.length===0?(t.openBlock(),t.createElementBlock("div",Vm,t.toDisplayString(t.unref(b)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],36))}}),[["__scopeId","data-v-9b17a184"]]),_m={class:"dv-alert__header"},Lm={class:"dv-alert__title"},Om={class:"dv-alert__body"},$m=["d"],Hm={class:"dv-alert__text"},zm={key:0,class:"dv-alert__subtitle"},Wm={class:"dv-alert__message"},Pm={class:"dv-alert__footer"},Um=St(t.defineComponent({__name:"data-validation-alert",props:{locale:{},severity:{},title:{default:""},message:{default:""},themeVars:{default:()=>({})}},emits:["resolve"],setup(e,{emit:n}){const l=e,o=n,a={stop:{color:"#d93025",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-160 224h320a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"},warning:{color:"#f4b400",path:"M512 96l416 736H96L512 96zm0 128L192 768h640L512 224zm-32 128a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32zm0 256a36 36 0 1 1 0 72 36 36 0 0 1 0-72z"},information:{color:"#1a73e8",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-32 128a32 32 0 0 1 64 0v32a32 32 0 0 1-64 0V288zm32 128a36 36 0 1 1 0 72 36 36 0 0 1 0-72zm0 96a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0V544a32 32 0 0 1 32-32z"}},i=t.computed(()=>a[l.severity]??a.stop),r=t.computed(()=>l.title?l.title:l.severity==="warning"?b(l.locale,"dvWarningDialogTitle"):l.severity==="information"?b(l.locale,"dvInformationDialogTitle"):b(l.locale,"dvStopDialogTitle")),d=t.computed(()=>l.severity==="stop"?b(l.locale,"dvBtnRetry"):l.severity==="warning"?b(l.locale,"dvBtnContinue"):b(l.locale,"dvBtnOk")),f=t.computed(()=>l.severity==="stop"?b(l.locale,"cancel"):l.severity==="warning"?b(l.locale,"dvBtnNo"):b(l.locale,"cancel"));function y(){o("resolve",l.severity==="stop"?"retry":"continue")}function h(){o("resolve","cancel")}return(u,E)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",_m,[t.createElementVNode("span",Lm,t.toDisplayString(r.value),1)]),t.createElementVNode("div",Om,[(t.openBlock(),t.createElementBlock("svg",{class:"dv-alert__icon",viewBox:"0 0 1024 1024",style:t.normalizeStyle({color:i.value.color})},[t.createElementVNode("path",{d:i.value.path,fill:"currentColor"},null,8,$m)],4)),t.createElementVNode("div",Hm,[e.title?(t.openBlock(),t.createElementBlock("div",zm,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Wm,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",Pm,[E[2]||(E[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:E[0]||(E[0]=t.withModifiers(()=>{},["prevent"])),onClick:y},t.toDisplayString(d.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:E[1]||(E[1]=t.withModifiers(()=>{},["prevent"])),onClick:h},t.toDisplayString(f.value),33)])],4))}}),[["__scopeId","data-v-07223d87"]]),Km={key:0,class:"dvim__title"},Gm={class:"dvim__message"},qm=St(t.defineComponent({__name:"data-validation-input-message",props:{title:{default:""},message:{default:""},x:{default:0},y:{default:0},width:{default:100},height:{default:24}},setup(e){return(n,l)=>(t.openBlock(),t.createElementBlock("div",{class:"dvim",style:t.normalizeStyle({left:e.x+"px",top:e.y+e.height+4+"px",minWidth:Math.min(220,Math.max(e.width,140))+"px"})},[e.title?(t.openBlock(),t.createElementBlock("div",Km,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Gm,t.toDisplayString(e.message),1)],4))}}),[["__scopeId","data-v-ec9868e3"]]);function ln(e,n){return`${e},${n}`}function Br(e,n){if(e.startsWith("="))return{kind:"formula",formula:e};const l=Nl(e,n);if(l)return{kind:"date",serial:l.serial};const o=/^(.*?)(\d+)$/.exec(e);if(o){const a=o[1],i=o[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return Cl(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function Fo(e,n){for(let l=2;l<e.length;l++)if(e[l]-e[l-1]!==n)return!1;return!0}function Tr(e){const n=e.length;if(n===0)return{kind:"copy",sourceValues:[]};if(e.some(l=>l.kind==="formula"))return{kind:"formula"};if(e.every(l=>l.kind==="date")){const l=e[0],o=n>=2?e[1].serial-l.serial:1;return{kind:"date-linear",baseSerial:l.serial,step:o,sourceLen:n}}if(e.every(l=>l.kind==="number")){if(n===1)return{kind:"copy",sourceValues:[...e]};const l=e.map(a=>a.num),o=l[1]-l[0];return Fo(l,o)?{kind:"linear",step:o,base:l[0],sourceLen:n}:{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text-number")){const l=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===l.prefix)){if(n===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(Fo(a,i))return{kind:"text-number",prefix:l.prefix,step:i,base:l.num,digits:l.digits,sourceLen:n}}return{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text")){const l=e.every(o=>o.text.length===1&&/[a-zA-Z]/.test(o.text));if(n>=2&&l){const o=e.map(i=>i.text.charCodeAt(0)),a=o[1]-o[0];if(a!==0&&Fo(o,a))return{kind:"text-series",step:a,baseCharCode:o[0],sourceLen:n}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function Nr(e,n,l){switch(e.kind){case"copy":{const o=e.sourceValues.length;return o===0?{kind:"text",text:""}:e.sourceValues[n%o]}case"linear":return{kind:"number",num:e.base+e.step*(l+n)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(l+n),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(l+n)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(l+n))};case"formula":return{kind:"formula",formula:""}}}function xr(e,n){switch(e.kind){case"copy":{const l=e.sourceValues.length;return l===0?{kind:"text",text:""}:e.sourceValues[l-1-n%l]}case"linear":return{kind:"number",num:e.base-e.step*(n+1)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base-e.step*(n+1),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial-e.step*(n+1)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode-e.step*(n+1))};case"formula":return{kind:"formula",formula:""}}}function lo(e,n){switch(e.kind){case"formula":return{value:e.formula,styleId:n};case"number":return{value:String(e.num),styleId:n};case"text":return{value:e.text,styleId:n};case"text-number":return{value:e.prefix+String(e.num).padStart(e.digits,"0"),styleId:n};case"date":return{value:String(e.serial),styleId:n}}}function Dr(e,n){const l=n.row<e.startRow?e.startRow-n.row:n.row>e.endRow?n.row-e.endRow:0,o=n.col<e.startCol?e.startCol-n.col:n.col>e.endCol?n.col-e.endCol:0;if(l===0&&o===0)return null;const a=l>=o?n.row<e.startRow?"up":"down":n.col<e.startCol?"left":"right";let i;switch(a){case"down":i={startCol:e.startCol,startRow:e.endRow+1,endCol:e.endCol,endRow:n.row};break;case"up":i={startCol:e.startCol,startRow:n.row,endCol:e.endCol,endRow:e.startRow-1};break;case"right":i={startCol:e.endCol+1,startRow:e.startRow,endCol:n.col,endRow:e.endRow};break;case"left":i={startCol:n.col,startRow:e.startRow,endCol:e.startCol-1,endRow:e.endRow};break}return{targetRange:i,direction:a}}function Vr(e,n,l,o,a,i){return Jn(e,l.col-n.col,l.row-n.row,o,a,i)}function Fr(e,n){return!(e.endCol<n.startCol||e.startCol>n.endCol||e.endRow<n.startRow||e.startRow>n.endRow)}function Ym(e,n){return n.startCol>=e.startCol&&n.endCol<=e.endCol&&n.startRow>=e.startRow&&n.endRow<=e.endRow}function Io(e,n,l){const o=Object.keys(l);for(const a of o){const i=l[a];if(Fr(e,i)&&!Ym(e,i))return!1}for(const a of o){const i=l[a];if(Fr(n,i))return!1}return!0}function Ir(e,n,l,o){const a=n.length;if(a!==0){if(e.kind==="copy"){const i=o?a-1-l%a:l%a;return n[i]}return o?n[0]:n[a-1]}}function Ar(e,n,l,o,a,i,r,d){const f={cells:{},merges:{}},y=o==="up"||o==="down",h=o==="up"||o==="left";if(y){const u=e.endRow-e.startRow+1;for(let E=e.startCol;E<=e.endCol;E++){const x=[],k=[];for(let ne=e.startRow;ne<=e.endRow;ne++){const ee=l.cells[ln(E,ne)];x.push(ee?Br(ee.value,a):{kind:"text",text:""}),k.push(ee==null?void 0:ee.styleId)}const H=Tr(x),Y=x.length;for(let ne=n.startRow;ne<=n.endRow;ne++){const ee=h?n.endRow-ne:ne-n.startRow;if(H.kind==="formula"){const M=h?e.endRow-((n.endRow-ne)%u+u)%u:e.startRow+((ne-e.startRow)%u+u)%u,se=l.cells[ln(E,M)],X=se?se.value:"",te=Vr(X,{col:E,row:M},{col:E,row:ne},i,r,d);f.cells[ln(E,ne)]=lo({kind:"formula",formula:te},se==null?void 0:se.styleId)}else{const M=h?xr(H,ee):Nr(H,ee,Y),se=Ir(H,k,ee,h);f.cells[ln(E,ne)]=lo(M,se)}}}}else{const u=e.endCol-e.startCol+1;for(let E=e.startRow;E<=e.endRow;E++){const x=[],k=[];for(let ne=e.startCol;ne<=e.endCol;ne++){const ee=l.cells[ln(ne,E)];x.push(ee?Br(ee.value,a):{kind:"text",text:""}),k.push(ee==null?void 0:ee.styleId)}const H=Tr(x),Y=x.length;for(let ne=n.startCol;ne<=n.endCol;ne++){const ee=h?n.endCol-ne:ne-n.startCol;if(H.kind==="formula"){const M=h?e.endCol-((n.endCol-ne)%u+u)%u:e.startCol+((ne-e.startCol)%u+u)%u,se=l.cells[ln(M,E)],X=se?se.value:"",te=Vr(X,{col:M,row:E},{col:ne,row:E},i,r,d);f.cells[ln(ne,E)]=lo({kind:"formula",formula:te},se==null?void 0:se.styleId)}else{const M=h?xr(H,ee):Nr(H,ee,Y),se=Ir(H,k,ee,h);f.cells[ln(ne,E)]=lo(M,se)}}}}return f}function Xm(e){let n=1/0,l=1/0;for(const o of e.ranges)o.startCol<n&&(n=o.startCol),o.startRow<l&&(l=o.startRow);return isFinite(n)||(n=0),isFinite(l)||(l=0),{col:n,row:l}}function jm(e,n,l){for(const o of e)if(n>=o.startCol&&n<=o.endCol&&l>=o.startRow&&l<=o.endRow)return!0;return!1}function wl(e){if(e==null)return null;const n=String(e).trim();if(n==="")return null;const l=n.replace(/[, ]/g,"");if(l==="")return null;const o=Number(l);return Number.isFinite(o)?o:null}function Zm(e,n){const l=new Map;for(const o of e.ranges)for(let a=o.startRow;a<=o.endRow;a++)for(let i=o.startCol;i<=o.endCol;i++){const r=n.getCellValue(i,a);r!==""&&l.set(r,(l.get(r)??0)+1)}return l}class Jm{constructor(){this.map=new Map}get(n){return this.map.get(n)}set(n,l){this.map.set(n,l)}invalidate(n){n?this.map.delete(n):this.map.clear()}}function Qm(e,n,l,o,a,i){switch(e.type){case"cellIs":{const r=o.getCellValue(n,l),d=wl(r);switch(e.operator){case"equal":{const f=wl(e.value);return d!==null&&f!==null?d===f:r===e.value}case"notEqual":{const f=wl(e.value);return d!==null&&f!==null?d!==f:r!==e.value}case"greaterThan":{const f=wl(e.value);return d===null||f===null?!1:d>f}case"greaterThanOrEqual":{const f=wl(e.value);return d===null||f===null?!1:d>=f}case"lessThan":{const f=wl(e.value);return d===null||f===null?!1:d<f}case"lessThanOrEqual":{const f=wl(e.value);return d===null||f===null?!1:d<=f}case"between":{const f=wl(e.value),y=wl(e.value2??"");return d===null||f===null||y===null?!1:d>=Math.min(f,y)&&d<=Math.max(f,y)}case"notBetween":{const f=wl(e.value),y=wl(e.value2??"");return d===null||f===null||y===null?!1:d<Math.min(f,y)||d>Math.max(f,y)}}return!1}case"textContains":return o.getCellValue(n,l).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!o.getCellValue(n,l).toLowerCase().includes(e.value.toLowerCase());case"blank":return o.getCellValue(n,l)==="";case"notBlank":return o.getCellValue(n,l)!=="";case"duplicate":{if(!i)return!1;const r=o.getCellValue(n,l);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=o.getCellValue(n,l);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=n-a.col,d=l-a.row,f=e.formula.trim().replace(/^=/,""),y=e0(f,r,d,o.colCount,o.rowCount);return Rr(y,o.cells,o.colCount,o.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function e0(e,n,l,o,a){return Jn(e,n,l,o,a,lt)}function t0(e,n,l,o,a){if(!l||l.length===0)return null;const i=l.filter(f=>f.enabled&&jm(f.ranges,e,n)).sort((f,y)=>f.priority-y.priority);if(i.length===0)return null;const r={};let d=!1;for(const f of i){const y=Xm(f);let h;(f.condition.type==="duplicate"||f.condition.type==="unique")&&(h=a==null?void 0:a.get(f.id),h||(h=Zm(f,o),a==null||a.set(f.id,h)));let u=!1;try{u=Qm(f.condition,e,n,o,y,h)}catch{}if(!u)continue;d=!0;const E=f.format;if(E.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=E.backgroundColor),E.color!==void 0&&r.color===void 0&&(r.color=E.color),E.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=E.fontWeight),E.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=E.fontStyle),E.underline!==void 0&&r.underline===void 0&&(r.underline=E.underline),E.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=E.strikethrough),f.stopIfTrue)break}return d?r:null}function l0(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function _r(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function n0(e,n,l){for(const o of e)if(n>=o.startCol&&n<=o.endCol&&l>=o.startRow&&l<=o.endRow)return!0;return!1}function o0(e){let n=1/0,l=1/0;for(const o of e.ranges)o.startCol<n&&(n=o.startCol),o.startRow<l&&(l=o.startRow);return isFinite(n)||(n=0),isFinite(l)||(l=0),{col:n,row:l}}function r0(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function a0(e){return e?Array.from(e).length:0}const Lr=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function An(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=Ao(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?a:a===null?null:Number(a)}const o=qn(l,n.locale);if(o&&Number.isFinite(o.num))return o.num;if(Lr.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}return null}function Ao(e,n){try{return tn(),Er(e,n.cells,n.colCount,n.rowCount)}catch{return null}}function _o(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=Ao(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?_o(a,n):null}if(Cl(l)||Lr.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}const o=Nl(l,n.locale);return o&&o.format!=="h:mm:ss"?o.serial:null}function Lo(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=Ao(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?Oo(a):typeof a=="string"?Lo(a,n):null}const o=Nl(l,n.locale);return o?o.format==="h:mm:ss"?o.serial:Oo(o.serial):Cl(l)?Oo(Number(l)):null}function Oo(e){return Number.isFinite(e)?Math.abs(e)%1:0}function i0(e,n,l,o){switch(e){case"between":return l===null||o===null?!1:n>=Math.min(l,o)&&n<=Math.max(l,o);case"notBetween":return l===null||o===null?!1:n<Math.min(l,o)||n>Math.max(l,o);case"equal":return l!==null&&n===l;case"notEqual":return l!==null&&n!==l;case"greaterThan":return l!==null&&n>l;case"greaterThanOrEqual":return l!==null&&n>=l;case"lessThan":return l!==null&&n<l;case"lessThanOrEqual":return l!==null&&n<=l;default:return!1}}function $o(e){return String(e??"").trim().toLowerCase()}function Or(e,n){var h;const l=e.listSource??(e.values?{type:"values",values:e.values}:void 0);if(!l)return[];const o=[],a=new Set,i=u=>{const E=$o(u);if(!E){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),o.push("");return}a.has(E)||(a.add(E),o.push(u))};if(l.type==="values"){for(const u of l.values??[])i(u);return o}const{range:r,sheetId:d}=l,f=d?((h=n.getSheetCells)==null?void 0:h.call(n,d))??null:null,y=f??n.cells;for(let u=r.startRow;u<=r.endRow;u++)for(let E=r.startCol;E<=r.endCol;E++){const x=`${E},${u}`,k=y[x];if(k)if(f){const H=k.value;i(H.startsWith("=")?s0(H,f,n):H)}else i(n.getCellValue(E,u))}return o}function s0(e,n,l){try{tn();const o=Er(e.slice(1),n,l.colCount,l.rowCount);return o===null?"":String(o)}catch{return""}}function c0(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function d0(e,n,l){const o={value:l};return new Proxy(e,{get(a,i){return i===n?o:a[i]},has(a,i){return i===n?!0:i in a}})}function u0(e,n,l,o,a){if(e.enabled===!1)return!0;const i=n==null?"":String(n);if(r0(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=Or(e,a),d=$o(i);return r.some(f=>$o(f)===d)}case"wholeNumber":{const r=An(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:_n(e,r,a,An)}case"decimal":{const r=An(i,a);return r===null||!Number.isFinite(r)?!1:_n(e,r,a,An)}case"date":{const r=_o(i,a);return r===null?!1:_n(e,r,a,_o)}case"time":{const r=Lo(i,a);return r===null?!1:_n(e,r,a,Lo)}case"textLength":{const r=a0(i);return _n(e,r,a,An)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?f0(r,n,l,o,e,a):!0}default:return!0}}catch{return!1}}function _n(e,n,l,o){const a=e.operator;if(!a)return!0;const i=e.formula1!==void 0&&e.formula1!==""?o(e.formula1,l):null,r=e.formula2!==void 0&&e.formula2!==""?o(e.formula2,l):null;return i0(a,n,i,r)}function f0(e,n,l,o,a,i){try{const r=o0(a),d=Jn(e,l-r.col,o-r.row,i.colCount,i.rowCount,lt),f=d0(i.cells,`${l},${o}`,n==null?"":String(n));return tn(),Rr(d,f,i.colCount,i.rowCount)}catch{return!1}}const m0={stop:3,warning:2,information:1};function Ho(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function $r(e,n,l,o,a){if(!o||o.length===0)return{valid:!0};let i=null,r=0;for(const h of o){if(h.enabled===!1||!n0(h.ranges,n,l))continue;let u=!1;try{u=u0(h,e,n,l,a)}catch{u=!1}if(u)continue;const E=m0[Ho(h)];E>r&&(r=E,i=h)}if(!i)return{valid:!0};const d=Ho(i),f=i.showErrorMessage!==!1,y=p0(i,a.locale);return{valid:!1,rule:i,severity:d,title:f&&i.errorTitle?i.errorTitle:y.title,message:f&&i.errorMessage?i.errorMessage:y.message}}function p0(e,n){var a;const l=b(n,"dvErrorTitleDefault"),o=e.operator?b(n,`dv${h0(e.operator)}`):"";switch(e.type){case"list":{const r=(((a=e.listSource)==null?void 0:a.type)==="values"?e.listSource.values??e.values??[]:e.values??[]).filter(Boolean).slice(0,6).join(", ");return{title:l,message:b(n,r?"dvMsgList":"dvMsgListEmpty").replace("{values}",r)}}case"wholeNumber":return{title:l,message:Ln(n,b(n,"dvTypeWholeNumber"),o,e)};case"decimal":return{title:l,message:Ln(n,b(n,"dvTypeDecimal"),o,e)};case"date":return{title:l,message:Ln(n,b(n,"dvTypeDate"),o,e)};case"time":return{title:l,message:Ln(n,b(n,"dvTypeTime"),o,e)};case"textLength":return{title:l,message:Ln(n,b(n,"dvTypeTextLength"),o,e)};case"custom":return{title:l,message:b(n,"dvMsgCustom").replace("{formula}",e.formula1??"")};default:return{title:l,message:b(n,"dvMsgInvalid")}}}function h0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ln(e,n,l,o){return l?o.operator==="between"||o.operator==="notBetween"?b(e,o.operator==="between"?"dvMsgBetween":"dvMsgNotBetween").replace("{type}",n).replace("{min}",o.formula1??"").replace("{max}",o.formula2??""):b(e,"dvMsgCompare").replace("{type}",n).replace("{op}",l).replace("{value}",o.formula1??""):b(e,"dvMsgInvalid")}const no=64;class g0{constructor(n=[]){this.bands=new Map,this.dirty=!0,this.source=[],this.source=n}invalidate(){this.dirty=!0}ensure(n){if(n&&n!==this.source&&(this.source=n,this.dirty=!0),!!this.dirty){this.bands.clear();for(const l of this.source)if(!(!l||l.enabled===!1))for(const o of l.ranges??[]){const a=Math.floor(o.startRow/no),i=Math.floor(o.endRow/no);for(let r=a;r<=i;r++){let d=this.bands.get(r);d||(d=[],this.bands.set(r,d)),d.push({rule:l,range:o})}}this.dirty=!1}}getRules(n,l,o){this.ensure(o);const a=this.bands.get(Math.floor(l/no));if(!a||a.length===0)return[];const i=[];for(const r of a)n<r.range.startCol||n>r.range.endCol||l<r.range.startRow||l>r.range.endRow||i.includes(r.rule)||i.push(r.rule);return i}has(n,l,o){const a=this.bandsOf(n,l,o);for(const i of a)if(!(n<i.range.startCol||n>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow))return!0;return!1}findRule(n,l,o,a){for(const i of this.bandsOf(n,l,a))if(!(n<i.range.startCol||n>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow)&&o(i.rule))return i.rule;return null}bandsOf(n,l,o){return this.ensure(o),this.bands.get(Math.floor(l/no))??b0}}const b0=[];function y0(e,n,l,o){if(n==="row"){const f=e.startRow,y=e.endRow;let h,u;if(y<l)h=f,u=y;else if(f>l+o-1)h=f-o,u=y-o;else if(h=f<l?f:l,u=y>l+o-1?y-o:l-1,u<h)return null;return{...e,startRow:h,endRow:u}}const a=e.startCol,i=e.endCol;let r,d;if(i<l)r=a,d=i;else if(a>l+o-1)r=a-o,d=i-o;else if(r=a<l?a:l,d=i>l+o-1?i-o:l-1,d<r)return null;return{...e,startCol:r,endCol:d}}function C0(e,n,l,o){if(n==="row"){const r=e.startRow,d=e.endRow;return r>=l?{...e,startRow:r+o,endRow:d+o}:d<l?e:{...e,endRow:d+o}}const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+o,endCol:i+o}:i<l?e:{...e,endCol:i+o}}function Hr(e,n){return!(e.endCol<n.startCol||e.startCol>n.endCol||e.endRow<n.startRow||e.startRow>n.endRow)}function zr(e,n){if(!Hr(e,n))return[{...e}];const l=[];e.startRow<n.startRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:e.startRow,endRow:n.startRow-1}),e.endRow>n.endRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:n.endRow+1,endRow:e.endRow});const o=Math.max(e.startRow,n.startRow),a=Math.min(e.endRow,n.endRow);return o<=a&&(e.startCol<n.startCol&&l.push({startCol:e.startCol,endCol:n.startCol-1,startRow:o,endRow:a}),e.endCol>n.endCol&&l.push({startCol:n.endCol+1,endCol:e.endCol,startRow:o,endRow:a})),l}function w0(e,n,l){return{startCol:e.startCol+n,endCol:e.endCol+n,startRow:e.startRow+l,endRow:e.endRow+l}}function Wr(e,n){return Hr(e,n)?{startCol:Math.max(e.startCol,n.startCol),endCol:Math.min(e.endCol,n.endCol),startRow:Math.max(e.startRow,n.startRow),endRow:Math.min(e.endRow,n.endRow)}:null}class v0{constructor(n){if(n&&n.length>0){this.styles=n,this.index=new Map;for(let l=0;l<this.styles.length;l++){const o=this.stableKey(this.styles[l]);this.index.set(o,l)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const l=Object.keys(n).sort(),o={};for(const a of l)o[a]=n[a];return JSON.stringify(o)}get(n){const l=this.styles[n];return l?n===0?l:Object.freeze(l):{}}getId(n){if(!n||Object.keys(n).length===0)return 0;const l=this.stableKey(n),o=this.index.get(l);if(o!==void 0)return o;const a=this.styles.length,i=Object.freeze({...n});return this.styles.push(i),this.index.set(l,a),a}getStyles(){return[...this.styles]}setStyles(n){this.styles=n,this.index=new Map;for(let l=0;l<this.styles.length;l++){const o=this.stableKey(this.styles[l]);this.index.set(o,l)}}compactStyles(n){const l=new Set;l.add(0);for(const r in n){const d=n[r].styleId??0;l.add(d)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(l).sort((r,d)=>r-d);for(const r of i)if(r!==0&&r<this.styles.length){const d=a.length;o.set(r,d),a.push(this.styles[r])}for(const r in n){const d=n[r],f=d.styleId??0,y=o.get(f);y!==void 0&&y!==f&&(d.styleId=y)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const d=this.stableKey(this.styles[r]);this.index.set(d,r)}return a}}function k0(e,n){if(!e)return null;const l=e.styleId;return l===void 0||l===0?null:n[l]??null}function Pr(e){const n=new v0,l={};for(const[o,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,l[o]=i}return{cells:l,styles:n.getStyles()}}function E0(e){const n={};for(const[l,o]of Object.entries(e)){const a={value:o.value};o.styleId!==void 0&&o.styleId>0&&(a.styleId=o.styleId),n[l]=a}return n}class R0{constructor(n){if(n&&n.length>0){this.borders=n,this.index=new Map;for(let l=0;l<this.borders.length;l++){const o=this.stableKey(this.borders[l]);this.index.set(o,l)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const l=["top","right","bottom","left"],o={};for(const a of l){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),o[a]=r}}return JSON.stringify(o)}get(n){const l=this.borders[n];return l?n===0?l:Object.freeze(l):{}}getId(n){if(!n||this.isEmptyBorder(n))return 0;const l=this.stableKey(n),o=this.index.get(l);if(o!==void 0)return o;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(n));return this.borders.push(i),this.index.set(l,a),a}isEmptyBorder(n){return!n.top&&!n.right&&!n.bottom&&!n.left}deepCloneBorder(n){const l={};return n.top&&(l.top={...n.top}),n.right&&(l.right={...n.right}),n.bottom&&(l.bottom={...n.bottom}),n.left&&(l.left={...n.left}),l}getBorders(){return[...this.borders]}setBorders(n){this.borders=n,this.index=new Map;for(let l=0;l<this.borders.length;l++){const o=this.stableKey(this.borders[l]);this.index.set(o,l)}}compactBorders(n){const l=new Set;l.add(0);for(const r of n){const d=r.borderId??0;l.add(d)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(l).sort((r,d)=>r-d);for(const r of i)if(r!==0&&r<this.borders.length){const d=a.length;o.set(r,d),a.push(this.borders[r])}for(const r of n){const d=r.borderId??0,f=o.get(d);f!==void 0&&f!==d&&(r.borderId=f)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const d=this.stableKey(this.borders[r]);this.index.set(d,r)}return a}}function S0(e,n,l,o){if(!e)return;const a=e.styleId??0,i=l[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const d=o.get(r);if(d)return d[n]}function M0(e,n,l,o,a,i){const r=o[e.styleId??0]??{},d=r.borderId??0,f=d>0?a.get(d):{},y={top:f.top?{...f.top}:void 0,right:f.right?{...f.right}:void 0,bottom:f.bottom?{...f.bottom}:void 0,left:f.left?{...f.left}:void 0};l?y[n]={...l}:y[n]=void 0;const h=a.getId(y),u={...r};h===0?delete u.borderId:u.borderId=h,delete u.borderTopWidth,delete u.borderBottomWidth,delete u.borderLeftWidth,delete u.borderRightWidth,delete u.borderColor,Object.keys(u).length===0?e.styleId=0:e.styleId=i(u)}function Ur(e){const n=new R0,l=[];for(const o of e){if(!(o.borderTopWidth!==void 0||o.borderBottomWidth!==void 0||o.borderLeftWidth!==void 0||o.borderRightWidth!==void 0)){l.push(o);continue}const i=typeof o.borderColor=="string"?o.borderColor:void 0,r={};o.borderTopWidth!==void 0&&o.borderTopWidth>0&&(r.top={width:o.borderTopWidth,color:i}),o.borderBottomWidth!==void 0&&o.borderBottomWidth>0&&(r.bottom={width:o.borderBottomWidth,color:i}),o.borderLeftWidth!==void 0&&o.borderLeftWidth>0&&(r.left={width:o.borderLeftWidth,color:i}),o.borderRightWidth!==void 0&&o.borderRightWidth>0&&(r.right={width:o.borderRightWidth,color:i});const d=n.getId(r),f={...o};delete f.borderTopWidth,delete f.borderBottomWidth,delete f.borderLeftWidth,delete f.borderRightWidth,delete f.borderColor,d>0?f.borderId=d:delete f.borderId,l.push(f)}return{styles:l,borders:n.getBorders()}}function B0(e,n){const l=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(()=>{l.rowCount=e.rowCount??n.rowCount,l.colCount=e.colCount??n.colCount,l.width=e.width,l.height=e.height,l.theme=e.theme??n.theme,l.locale=e.locale??n.locale});const o=t.computed(()=>l.locale==="zh-CN"?"zh-CN":"en-US"),a=l.colCount,i=l.rowCount,r=t.reactive({colCount:a,rowCount:i}),d=8,f=32,y=t.reactive({}),h=t.reactive([{}]),u=t.reactive([{}]);let E=new Map;E.set("{}",0);let x=new Map;x.set("{}",0);const k=t.reactive([]),H=new Jm,Y=t.reactive([]),ne=new g0(Y),ee=new Map;let M=0;function se(p){const v=Object.keys(p).sort(),S={};for(const O of v)S[O]=p[O];return JSON.stringify(S)}function X(p){const v=["top","right","bottom","left"],S={};for(const O of v){const s=p[O];if(s&&(s.width!==void 0||s.color!==void 0||s.style!==void 0)){const m={};s.width!==void 0&&(m.width=s.width),s.color!==void 0&&(m.color=s.color),s.style!==void 0&&(m.style=s.style),S[O]=m}}return JSON.stringify(S)}function te(p){if(!p||Object.keys(p).length===0)return 0;const v=se(p),S=E.get(v);if(S!==void 0)return S;const O=h.length;return h.push(Object.freeze({...p})),E.set(v,O),O}function Ne(p){return k0(p,h)}function ze(){E=new Map;for(let p=0;p<h.length;p++)E.set(se(h[p]),p)}function Ve(p){h.splice(0,h.length,...p),ze()}function Fe(p){if(!p||!p.top&&!p.right&&!p.bottom&&!p.left)return 0;const v=X(p),S=x.get(v);if(S!==void 0)return S;const O=u.length;return u.push(Object.freeze({top:p.top?Object.freeze({...p.top}):void 0,right:p.right?Object.freeze({...p.right}):void 0,bottom:p.bottom?Object.freeze({...p.bottom}):void 0,left:p.left?Object.freeze({...p.left}):void 0})),x.set(v,O),O}function je(p){return u[p]??{}}function _e(){x=new Map;for(let p=0;p<u.length;p++)x.set(X(u[p]),p)}function F(p){u.splice(0,u.length,...p),_e()}function I(p,v){return S0(p,v,h,{get:S=>u[S]??{}})}function G(p,v){const S=et(p,v);return S?S.anchor:null}function Ce(p,v,S,O){const s=et(p,v),m=et(S,O);return!s||!m?!1:s.anchor===m.anchor}const $e=t.reactive({}),j=new Od,Be=t.ref(null),Q=t.ref("cell"),ke=t.ref({col:0,row:0}),B=t.ref(null),oe=t.ref(""),Z=t.ref(new Array(r.colCount).fill(100)),re=t.ref(new Array(r.rowCount).fill(void 0)),K=t.ref(0),L=t.ref(0),J=t.reactive({rows:0,cols:0}),$=t.ref(null),U=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),de=new Map;let Le=null;function ve(p,v,S,O){const s=`${O} ${S} ${v}px ${p}`,m=de.get(s);if(m)return m;if(!Le){if(typeof document>"u")return{ascent:v*.88,descent:v*.28};Le=document.createElement("canvas")}const C=Le.getContext("2d");if(!C)return{ascent:v*.88,descent:v*.28};C.font=s;const T=C.measureText(" "),R=T.fontBoundingBoxAscent,A=T.fontBoundingBoxDescent;if(typeof R=="number"&&typeof A=="number"&&R>0&&A>0){const nt={ascent:R,descent:A};return de.set(s,nt),nt}const _=["M","中","y","Ä","0"];let D=0,z=0;for(const nt of _){const dt=C.measureText(nt),vt=dt.actualBoundingBoxAscent||0,Nt=dt.actualBoundingBoxDescent||0;vt>D&&(D=vt),Nt>z&&(z=Nt)}const ae=Math.max(D,v*.88),Me=Math.max(z,v*.28),Qe={ascent:ae,descent:Me};return de.set(s,Qe),Qe}const Ie=ve(pn,zl,"normal","normal"),Ee=Ie.ascent+Ie.descent,He=Math.max(0,(24-Ee)/2);let ge=(p,v)=>`${p},${v}`,et=()=>null,ut=()=>zl,Pe=t.computed(()=>[0]),N=()=>24,ie=(p,v,S,O)=>({startCol:Math.min(p,S),startRow:Math.min(v,O),endCol:Math.max(p,S),endRow:Math.max(v,O)});function Rt(p,v){const S=Ne(y[ge(p,v)]),O=ut(p,v),s=typeof(S==null?void 0:S.fontFamily)=="string"&&S.fontFamily?S.fontFamily:pn,m=(S==null?void 0:S.fontWeight)==="bold"?"bold":"normal",C=(S==null?void 0:S.fontStyle)==="italic"?"italic":"normal";return ve(s,O,m,C)}function ft(p,v,S,O){if(!v)return[""];const s=v.split(`
2
- `),m=[];for(const C of s)if(!O||S<=0)m.push(C);else{let T="";for(let R=0;R<C.length;R++){const A=C[R],_=T+A;p.measureText(_).width>S&&T?(m.push(T),T=A):T=_}m.push(T)}return m}function Mt(p,v){const S=Ne(y[ge(p,v)]);return typeof(S==null?void 0:S.fontSize)=="number"&&S.fontSize>0?S.fontSize:zl}ut=Mt;const Ft=t.computed(()=>{const p=[0];for(let v=0;v<r.colCount;v++)p.push(p[v]+Z.value[v]);return p});Pe=Ft;const It={w:800,h:600};let Ot=()=>{};const Dl=t.computed(()=>{const p=new Set;for(const v in y){const S=v.indexOf(",");if(S<0)continue;const O=parseInt(v.substring(S+1),10),s=y[v];s&&(s.value!==""||s.styleId!==void 0)&&p.add(O)}for(let v=0;v<re.value.length;v++)re.value[v]!==void 0&&p.add(v);for(const v in $e){const S=v.indexOf(",");if(S<0)continue;const O=parseInt(v.substring(S+1),10);p.add(O)}return p});function nl(p){if($.value&&Ht.value.has(p))return 0;const v=re.value[p];if(v!=null&&v>0)return v;if(!Dl.value.has(p))return 24;let S,O,s=1;const m=Le?Le.getContext("2d"):null,C=ve(pn,zl,"normal","normal");S=C.ascent,O=C.descent;for(let _=0;_<r.colCount;_++){const D=Mt(_,p),z=Ne(y[ge(_,p)]),ae=typeof(z==null?void 0:z.fontFamily)=="string"&&z.fontFamily?z.fontFamily:pn,Me=(z==null?void 0:z.fontWeight)==="bold"?"bold":"normal",Qe=(z==null?void 0:z.fontStyle)==="italic"?"italic":"normal",nt=ve(ae,D,Me,Qe);nt.ascent>S&&(S=nt.ascent),nt.descent>O&&(O=nt.descent);const dt=typeof(z==null?void 0:z.numberFormat)=="string"?z.numberFormat:"",vt=Wt(_,p),Nt=yl(vt,dt,o.value);if(Nt){const Ut=(z==null?void 0:z.wrap)==="wrap";let At;if(Ut&&m){m.font=`${Qe} ${Me} ${D}px ${ae}`;const el=et(_,p);let pl;el&&_===el.range.startCol&&p===el.range.startRow?pl=Pe.value[el.range.endCol+1]-Pe.value[_]:pl=Z.value[_],At=ft(m,Nt,Math.max(0,pl-10),!0).length,At>s&&(s=At)}else At=Nt.split(`
3
- `).length,At>s&&(s=At)}}const T=S+O,R=He*2+s*T;return Math.min(500,Math.max(24,Math.round(R)))}N=nl;function dl(p){return re.value[p]===void 0}const ol={getValue:(p,v)=>Wt(p,v),getFormat:(p,v)=>{var S;return(S=Ne(y[ge(p,v)]))==null?void 0:S.numberFormat}},Ht=t.computed(()=>{const p=new Set,v=$.value;if(!v)return p;const{range:S}=v;for(let O=S.startRow+1;O<=S.endRow;O++)vl(O)||p.add(O);return p});function vl(p){return Zd($.value,p,ol,o.value)}function zt(){return Ht.value}function W(p){return $.value?Ht.value.has(p):!1}function g(){return $.value?r.rowCount-Ht.value.size:r.rowCount}function c(p){let v=-1;for(let S=0;S<r.rowCount;S++)if(!W(S)&&(v++,v===p))return S;return-1}function w(p){if(W(p))return-1;let v=0;for(let S=0;S<p;S++)W(S)||v++;return v}function be(){return $.value}function he(p,v=!1){var S,O;$.value=p,!v&&(Ot(K.value,L.value),(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q))}function xe(p){var S,O;const v={range:{startCol:Math.min(p.startCol,p.endCol),endCol:Math.max(p.startCol,p.endCol),startRow:Math.min(p.startRow,p.endRow),endRow:Math.max(p.startRow,p.endRow)},columns:{}};$.value=v,Ot(K.value,L.value),(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q)}function we(){var p,v;$.value&&($.value=null,Ot(K.value,L.value),(p=q.scheduleRender)==null||p.call(q),(v=q.emitModelData)==null||v.call(q))}function ce(p){var O,s;if(!$.value)return;const{[p]:v,...S}=$.value.columns;$.value={...$.value,columns:S},(O=q.scheduleRender)==null||O.call(q),(s=q.emitModelData)==null||s.call(q)}function Ue(p,v){var S,O;if($.value){if(v)$.value={...$.value,columns:{...$.value.columns,[p]:v}};else{const{[p]:s,...m}=$.value.columns;$.value={...$.value,columns:m}}(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q)}}function Ze(p){const v=$.value;return v?Jd(v,p,ol,o.value):{values:[],hasBlank:!1}}function fe(p,v){const S=r.colCount,O=r.rowCount,s=(D,z)=>{const ae=y[ct(D,z)];return!!ae&&(ae.value!==""||ae.styleId!==void 0)};if(!s(p,v))return null;const m=D=>{for(let z=0;z<S;z++)if(s(z,D))return!0;return!1},C=(D,z,ae)=>{for(let Me=z;Me<=ae;Me++)if(s(D,Me))return!0;return!1};let T=v;for(;T>0&&m(T-1);)T--;let R=v;for(;R<O-1&&m(R+1);)R++;let A=p;for(;A>0&&C(A-1,T,R);)A--;let _=p;for(;_<S-1&&C(_+1,T,R);)_++;return{startCol:A,startRow:T,endCol:_,endRow:R}}function We(){const p=Be.value;if(!!p&&p.startRow!==p.endRow)return{startCol:Math.min(p.startCol,p.endCol),endCol:Math.max(p.startCol,p.endCol),startRow:Math.min(p.startRow,p.endRow),endRow:Math.max(p.startRow,p.endRow)};const S=ke.value,O=p?p.startCol:S.col,s=p?p.startRow:S.row,m=(A,_)=>{const D=y[ct(A,_)];return!!D&&(D.value!==""||D.styleId!==void 0)};let C,T;p?(C=Math.min(p.startCol,p.endCol),T=Math.max(p.startCol,p.endCol)):(C=S.col,T=S.col);let R=s;for(;R<r.rowCount-1;){const A=R+1;let _=!1,D=!1;for(let z=C;z<=T;z++){m(z,A)&&(_=!0);const ae=On(z,A);ae&&(ae.range.startCol!==ae.range.endCol||ae.range.startRow!==ae.range.endRow)&&(D=!0)}if(D||!_)break;R++}return!m(O,s)&&R===s?Te():{startCol:C,endCol:T,startRow:s,endRow:R}}function V(){if($.value){we();return}const p=We();p&&xe(p)}function le(p){const v=$.value;return v?p>=v.range.startCol&&p<=v.range.endCol:!1}function me(){return $.value?{...$.value.range}:null}function pe(){return!!$.value}function Re(p){const v=$.value;return v?Mr(v.columns[p]):!1}function Te(){let p=1/0,v=1/0,S=-1,O=-1;for(const s in y){const m=s.indexOf(",");if(m<0)continue;const C=parseInt(s.substring(0,m),10),T=parseInt(s.substring(m+1),10),R=y[s];R&&(R.value!==""||R.styleId!==void 0)&&(C<p&&(p=C),T<v&&(v=T),C>S&&(S=C),T>O&&(O=T))}return S<0?null:{startCol:p,startRow:v,endCol:S,endRow:O}}const Se=t.computed(()=>{const p=[0];for(let v=0;v<r.rowCount;v++)p.push(p[v]+N(v));return p}),qe=t.computed(()=>Ft.value[r.colCount]),mt=t.computed(()=>Se.value[r.rowCount]);function ct(p,v){return`${p},${v}`}ge=ct;function kt(p){Reflect.deleteProperty(y,p)}function jt(p,v){Q.value="cell";const S=et(p,v);S?(ke.value={col:S.range.startCol,row:S.range.startRow},Be.value={...S.range}):(ke.value={col:p,row:v},Be.value={startCol:p,startRow:v,endCol:p,endRow:v})}function kl(p,v,S,O,s="cell"){const m=et(p,v);if(ke.value=m?{col:m.range.startCol,row:m.range.startRow}:{col:p,row:v},Q.value=s,s==="row"||s==="col"){const C=Math.min(p,S),T=Math.max(p,S),R=Math.min(v,O),A=Math.max(v,O);Be.value={startCol:C,startRow:R,endCol:T,endRow:A}}else Be.value=ie(p,v,S,O)}function gn(){kl(0,0,r.colCount-1,r.rowCount-1,"all")}function El(p,v){const S=Be.value;return S?(Q.value==="cell"||Q.value==="all",p>=S.startCol&&p<=S.endCol&&v>=S.startRow&&v<=S.endRow):!1}function nn(p,v){return El(p,v)}function On(p,v){for(const S in $e){const O=$e[S];if(O&&p>=O.startCol&&p<=O.endCol&&v>=O.startRow&&v<=O.endRow)return{range:O,anchor:S}}return null}et=On;function Po(p,v){return $e[ct(p,v)]!==void 0}function on(p,v){const S=et(p,v);if(S&&p===S.range.startCol&&v===S.range.startRow){const O=Ft.value[S.range.endCol+1]-Ft.value[p],s=Se.value[S.range.endRow+1]-Se.value[v];return{w:O,h:s}}return{w:Z.value[p],h:N(v)}}function Zt(p,v,S,O){let s=Math.min(p,S),m=Math.max(p,S),C=Math.min(v,O),T=Math.max(v,O),R=!0;for(;R;){R=!1;for(const A in $e){const _=$e[A];if(!_)continue;_.startCol<=m&&_.endCol>=s&&_.startRow<=T&&_.endRow>=C&&(_.startCol<s&&(s=_.startCol,R=!0),_.endCol>m&&(m=_.endCol,R=!0),_.startRow<C&&(C=_.startRow,R=!0),_.endRow>T&&(T=_.endRow,R=!0))}}return{startCol:s,startRow:C,endCol:m,endRow:T}}ie=Zt;function Jt(p,v){var S;return((S=y[ct(p,v)])==null?void 0:S.value)??""}function Wt(p,v){return tn(),kr(p,v,y,r.colCount,r.rowCount)}function rl(p,v,S){var T,R;p>=0&&v>=0&&Gl(p,v);const O=ct(p,v);if(tn(),H.invalidate(),Y.length>0&&$t(),S===""||S==null){j.clear(O);const A=(T=y[O])==null?void 0:T.styleId;A!==void 0&&A>0?y[O]={value:"",styleId:A}:kt(O),j.markDirty(O);return}const s=String(S);if(!s.startsWith("=")){const A=Ne(y[O]),_=typeof(A==null?void 0:A.numberFormat)=="string"?A.numberFormat:"";if(sl(_)){const D=Nl(s,o.value);if(D){const ae={...A??{},numberFormat:D.format};y[O]={value:String(D.serial),styleId:te(ae)},j.clear(O),j.markDirty(O);return}const z=qn(s,o.value);if(z){const ae={...A??{},numberFormat:z.format};y[O]={value:String(z.num),styleId:te(ae)},j.clear(O),j.markDirty(O);return}}}const m=(R=y[O])==null?void 0:R.styleId,C={value:s};m!==void 0&&m>0&&(C.styleId=m),y[O]=C,s.startsWith("=")?j.set(O,Zn(s.slice(1),r.colCount,r.rowCount)):j.clear(O),j.markDirty(O)}function rn(p,v,S,O){for(let s=p;s<=v;s++)for(let m=S;m<=O;m++){const C=ct(s,m);j.clear(C),kt(C),j.markDirty(C)}H.invalidate(),Y.length>0&&$t()}function an(){return{cells:y,colCount:r.colCount,rowCount:r.rowCount,locale:o.value,getCellValue:(p,v)=>Wt(p,v)}}function Vl(p,v){return k.length===0?null:t0(p,v,k,an(),H)}function Fl(p){var S,O,s;(S=q.saveUndo)==null||S.call(q);const v={id:p.id||l0(),condition:p.condition,format:p.format,ranges:p.ranges,priority:p.priority,stopIfTrue:p.stopIfTrue,enabled:p.enabled!==!1};k.push(v),H.invalidate(),(O=q.scheduleRender)==null||O.call(q),(s=q.emitModelData)==null||s.call(q)}function bn(p,v){var O,s,m;(O=q.saveUndo)==null||O.call(q);const S=k.findIndex(C=>C.id===p);S<0||(k[S]={...k[S],...v,id:p},H.invalidate(),(s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q))}function yn(p){var S,O,s;(S=q.saveUndo)==null||S.call(q);const v=k.findIndex(m=>m.id===p);v<0||(k.splice(v,1),H.invalidate(),(O=q.scheduleRender)==null||O.call(q),(s=q.emitModelData)==null||s.call(q))}function Bn(p,v){var R,A,_;(R=q.saveUndo)==null||R.call(q);const S=[...k].sort((D,z)=>D.priority-z.priority),O=S.findIndex(D=>D.id===p);if(O<0)return;const s=v==="up"?O-1:O+1;if(s<0||s>=S.length)return;const m=S[O],C=S[s],T=m.priority;m.priority=C.priority,C.priority=T,H.invalidate(),(A=q.scheduleRender)==null||A.call(q),(_=q.emitModelData)==null||_.call(q)}function Tn(){H.invalidate()}function Gt(p){var v,S,O;if((v=q.saveUndo)==null||v.call(q),p==="sheet")k.splice(0,k.length);else{const s=q.selection.value;if(!s)return;for(let m=k.length-1;m>=0;m--){const C=k[m];C.ranges=C.ranges.filter(T=>!(T.startCol<=s.endCol&&T.endCol>=s.startCol&&T.startRow<=s.endRow&&T.endRow>=s.startRow)),C.ranges.length===0&&k.splice(m,1)}}H.invalidate(),(S=q.scheduleRender)==null||S.call(q),(O=q.emitModelData)==null||O.call(q)}function $t(){ne.invalidate(),ee.clear()}function gt(){return{cells:y,colCount:r.colCount,rowCount:r.rowCount,locale:o.value,getCellValue:(p,v)=>Wt(p,v),getSheetCells:p=>q.getSheetCellsById?q.getSheetCellsById(p):null}}function pt(p,v){const S=et(v,p),O=S?{col:S.range.startCol,row:S.range.startRow}:{col:v,row:p};return ne.getRules(O.col,O.row,Y)}function Pt(p,v){const S=pt(p,v);return S.length?S[0]:null}function $n(p,v){return pt(p,v).length>0}function Hn(p,v){const S=et(v,p),O=S?{col:S.range.startCol,row:S.range.startRow}:{col:v,row:p};return ne.findRule(O.col,O.row,c0,Y)}function oo(p){const v=p.listSource,S=v&&v.type==="range"?`range:${v.sheetId??""}:${v.range.startCol},${v.range.startRow},${v.range.endCol},${v.range.endRow}`:`values:${(v&&v.type==="values"?v.values:p.values??[]).join("")}`,O=ee.get(S);if(O)return O;const s=Or(p,gt());return ee.set(S,s),s}function Qt(p,v){const S=Hn(p,v);return S?{rule:S,items:oo(S)}:null}function Il(p,v){for(const S of pt(p,v)){if(S.enabled===!1||!S.showInputMessage)continue;const O=S.inputTitle??"",s=S.inputMessage??"";if(!(!O&&!s))return{title:O,message:s}}return null}function ul(p,v,S){const O=pt(p,v);return O.length===0?{valid:!0}:$r(S,v,p,O,gt())}function fl(p){const v=gt(),S={stop:3,warning:2,information:1};let O=null,s=0;for(const m of p){const C=pt(m.row,m.col);if(C.length===0)continue;const T=$r(m.value,m.col,m.row,C,v);if(T.valid)continue;const R=S[Ho(T.rule)]??0;R>s&&(s=R,O=T)}return O??{valid:!0}}function Al(p,v){var O,s,m;v!=null&&v.silent||(O=q.saveUndo)==null||O.call(q);const S={...p,id:p.id||_r(),ranges:(p.ranges??[]).map(C=>({...C})),enabled:p.enabled!==!1};return Y.push(S),$t(),v!=null&&v.silent||((s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q)),S}function ml(p,v,S){var s,m,C;const O=Y.findIndex(T=>T.id===p);if(O<0){Al({id:p,...v},S);return}S!=null&&S.silent||(s=q.saveUndo)==null||s.call(q),Y[O]={...Y[O],...v,id:p},$t(),S!=null&&S.silent||((m=q.scheduleRender)==null||m.call(q),(C=q.emitModelData)==null||C.call(q))}function sn(p,v){var O,s,m;const S=Y.findIndex(C=>C.id===p);S<0||(v!=null&&v.silent||(O=q.saveUndo)==null||O.call(q),Y.splice(S,1),$t(),v!=null&&v.silent||((s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q)))}function ro(p,v){var s,m,C,T,R,A;if(!p){if(Y.length===0)return;v!=null&&v.silent||(s=q.saveUndo)==null||s.call(q),Y.splice(0,Y.length),$t(),v!=null&&v.silent||((m=q.scheduleRender)==null||m.call(q),(C=q.emitModelData)==null||C.call(q));return}const S={startCol:Math.min(p.startCol,p.endCol),endCol:Math.max(p.startCol,p.endCol),startRow:Math.min(p.startRow,p.endRow),endRow:Math.max(p.startRow,p.endRow)};if(Y.filter(_=>(_.ranges??[]).some(D=>!(D.endCol<S.startCol||D.startCol>S.endCol||D.endRow<S.startRow||D.startRow>S.endRow))).length!==0){v!=null&&v.silent||(T=q.saveUndo)==null||T.call(q);for(let _=Y.length-1;_>=0;_--){const D=Y[_],z=[];for(const ae of D.ranges??[])z.push(...zr(ae,S));z.length===0?Y.splice(_,1):D.ranges=z}$t(),v!=null&&v.silent||((R=q.scheduleRender)==null||R.call(q),(A=q.emitModelData)==null||A.call(q))}}function ao(p){const v=[];for(const S of Y)for(const O of S.ranges??[]){const s=Wr(O,p);s&&v.push({rule:S,range:s})}return v}function zn(p,v,S){var O,s,m;if(p.length){S!=null&&S.silent||(O=q.saveUndo)==null||O.call(q);for(let C=Y.length-1;C>=0;C--){const T=Y[C],R=[];for(const A of T.ranges??[])R.push(...zr(A,v));R.length===0?Y.splice(C,1):T.ranges=R}for(const C of p){const T=[];for(const R of C.ranges??[]){const A=Wr(R,v);A&&T.push(A)}T.length&&Y.push({...C,id:_r(),ranges:T})}$t(),S!=null&&S.silent||((s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q))}}async function Wn(p,v,S){const O=p.severity??"stop";if(!(!p.rule||p.rule.showErrorMessage!==!1))return O==="stop"?"cancel":"continue";const m=q.showValidationAlert;if(!m)return O==="stop"?"cancel":"continue";M++;try{return await m({severity:O,title:p.title??"",message:p.message??"",col:v,row:S})}catch{return"cancel"}finally{M=Math.max(0,M-1)}}function io(){return M>0}let Nn=()=>{};function so(p){B.value||(B.value={...ke.value},p!==void 0?oe.value=p:oe.value||(oe.value=Jt(ke.value.col,ke.value.row)))}async function co(){const p=B.value;if(!p)return!1;const v=p.col,S=p.row,O=oe.value,s=ul(S,v,O);return!s.valid&&await Wn(s,v,S)!=="continue"?!1:(Nn(),rl(v,S,O),B.value=null,oe.value="",!0)}function Uo(){B.value=null,oe.value=""}function Ko(p,v){const S=ke.value;let O=Math.max(0,S.col+p),s=Math.max(0,S.row+v);(O>=r.colCount||s>=r.rowCount)&&Gl(O,s);const m=et(S.col,S.row),C=et(O,s);m&&C&&m.anchor===C.anchor&&(p>0?O=m.range.endCol+1:p<0&&(O=m.range.startCol-1),v>0?s=m.range.endRow+1:v<0&&(s=m.range.startRow-1),(O>=r.colCount||s>=r.rowCount)&&Gl(O,s)),O=Math.max(0,Math.min(r.colCount-1,O)),s=Math.max(0,Math.min(r.rowCount-1,s)),jt(O,s)}function Go(p,v){Dn(v,p)}function uo(p){const v=Ft.value;if(p<0||p>=v[r.colCount])return-1;let S=0,O=r.colCount-1;for(;S<O;){const s=S+O+1>>1;v[s]<=p?S=s:O=s-1}return S}function fo(p){const v=Se.value;if(p<0||p>=v[r.rowCount])return-1;let S=0,O=r.rowCount-1;for(;S<O;){const s=S+O+1>>1;v[s]<=p?S=s:O=s-1}return S}function qo(p,v){var s,m;const S=Math.max(0,Math.min(Math.floor(p),r.rowCount)),O=Math.max(0,Math.min(Math.floor(v),r.colCount));J.rows=S,J.cols=O,(s=q.scheduleRender)==null||s.call(q),(m=q.emitModelData)==null||m.call(q)}function Yo(){var p,v;J.rows=0,J.cols=0,(p=q.scheduleRender)==null||p.call(q),(v=q.emitModelData)==null||v.call(q)}function Xo(){return{rows:J.rows,cols:J.cols}}function xn(){let p=0,v=0;if(J.cols>0){const S=Z.value,O=Math.min(J.cols,S.length);for(let s=0;s<O;s++)p+=S[s]}if(J.rows>0)for(let S=0;S<J.rows;S++)v+=N(S);return{frozenRowsHeight:v,frozenColumnsWidth:p}}function jo(){const{frozenColumnsWidth:p,frozenRowsHeight:v}=xn(),S=52+p,O=24+v,s=Math.max(0,It.w-52-11-p),m=Math.max(0,It.h-24-11-v),C=[];return v>0&&p>0&&C.push({kind:"corner",x:52,y:24,width:p,height:v,scrollLeft:0,scrollTop:0}),v>0&&C.push({kind:"rows",x:S,y:24,width:s,height:v,scrollLeft:K.value,scrollTop:0}),p>0&&C.push({kind:"columns",x:52,y:O,width:p,height:m,scrollLeft:0,scrollTop:L.value}),C.push({kind:"body",x:S,y:O,width:s,height:m,scrollLeft:K.value,scrollTop:L.value}),C}function Pn(p,v){const S=Ft.value,O=Se.value,s=Z.value,m=S[v]??0,C=O[p]??0,T=et(v,p),R=T?(S[T.range.endCol+1]??m)-m:s[v]??0,A=T?(O[T.range.endRow+1]??C)-C:N(p),_=v<J.cols,D=p<J.rows,z=_?52+m:52+m-K.value,ae=D?24+C:24+C-L.value;return{x:z,y:ae,width:R,height:A}}function mo(p,v){const{frozenColumnsWidth:S,frozenRowsHeight:O}=xn();if(p<52||v<24)return null;const s=S>0&&p<52+S,m=O>0&&v<24+O,C=s?p-52:p-52+K.value,T=m?v-24:v-24+L.value,R=uo(C),A=fo(T);return R<0||A<0?null:{col:R,row:A}}function Un(p,v){return p<J.rows||v<J.cols}function Dn(p,v){if(Un(p,v))return;const{frozenColumnsWidth:S,frozenRowsHeight:O}=xn(),s=Math.max(0,It.w-52-11-S),m=Math.max(0,It.h-24-11-O),C=Ft.value,T=Se.value,R=(C[v]??0)-S,A=(T[p]??0)-O,_=et(v,p),D=_?(C[_.range.endCol+1]??0)-(C[v]??0):Z.value[v]??0,z=_?(T[_.range.endRow+1]??0)-(T[p]??0):N(p);let ae=K.value,Me=L.value;R<ae?ae=R:R+D>ae+s&&(ae=R+D-s),A<Me?Me=A:A+z>Me+m&&(Me=A+z-m),ae=Math.max(0,ae),Me=Math.max(0,Me),Ot(ae,Me)}function Gl(p,v){var m;const S=p+1,O=v+1;let s=!1;if(S>=r.colCount){const C=Math.max(r.colCount+d,S),T=C-r.colCount,R=Z.value;for(let A=0;A<T;A++)R.push(100);r.colCount=C,s=!0}if(O>=r.rowCount){const C=Math.max(r.rowCount+f,O),T=C-r.rowCount,R=re.value;for(let A=0;A<T;A++)R.push(void 0);r.rowCount=C,s=!0}s&&((m=q.scheduleRender)==null||m.call(q))}function Zo(){return r.colCount!==a||r.rowCount!==i}function Jo(p,v,S){if(!Io(p,v,$e))return;const O=Ar(p,v,{cells:y},S,o.value,r.colCount,r.rowCount,lt),s=Object.entries(O.cells).map(([C,T])=>{const R=C.indexOf(",");return{col:parseInt(C.substring(0,R),10),row:parseInt(C.substring(R+1),10),value:T?T.value:""}}),m=fl(s);if(!m.valid){(async()=>await Wn(m,v.startCol,v.startRow)==="continue"&&po(p,v,S))();return}po(p,v,S)}function po(p,v,S){var m,C,T;(m=q.saveUndo)==null||m.call(q),Gl(v.endCol,v.endRow);const O=Ar(p,v,{cells:y},S,o.value,r.colCount,r.rowCount,lt);tn();for(const[R,A]of Object.entries(O.cells)){const _=A.value;_===""&&(A.styleId===void 0||A.styleId===0)?(j.clear(R),kt(R)):(y[R]={value:_,...A.styleId!==void 0&&A.styleId>0?{styleId:A.styleId}:{}},_.startsWith("=")?j.set(R,Zn(_.slice(1),r.colCount,r.rowCount)):j.clear(R)),j.markDirty(R)}const s={startCol:Math.min(p.startCol,v.startCol),startRow:Math.min(p.startRow,v.startRow),endCol:Math.max(p.endCol,v.endCol),endRow:Math.max(p.endRow,v.endRow)};kl(s.startCol,s.startRow,s.endCol,s.endRow),(C=q.scheduleRender)==null||C.call(q),(T=q.emitModelData)==null||T.call(q)}function Qo(p,v){var m;let S=!1;const O=Math.max(1,Math.floor(p)),s=Math.max(1,Math.floor(v));if(O!==r.colCount){if(O>r.colCount){const C=Z.value;for(let T=r.colCount;T<O;T++)C.push(100)}else Z.value=Z.value.slice(0,O);r.colCount=O,S=!0}if(s!==r.rowCount){if(s>r.rowCount){const C=re.value;for(let T=r.rowCount;T<s;T++)C.push(void 0)}else re.value=re.value.slice(0,s);r.rowCount=s,S=!0}S&&((m=q.scheduleRender)==null||m.call(q))}const q={props:l,locale:o,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:Gl,hasDynamicDims:Zo,setDims:Qo,cells:y,styles:h,borders:u,merges:$e,formulaDeps:j,selection:Be,activeCell:ke,editingCell:B,editValue:oe,colWidths:Z,rowHeights:re,scrollX:K,scrollY:L,freeze:J,setFreeze:qo,clearFreeze:Yo,getFreeze:Xo,getFrozenMetrics:xn,filter:$,getFilter:be,setFilter:he,enableFilter:xe,clearFilter:we,clearFilterColumn:ce,setFilterColumn:Ue,getColumnCandidates:Ze,getDataRange:Te,getCurrentRegion:fe,detectFilterRange:We,toggleAutoFilter:V,isColumnInFilterRange:le,getFilterRange:me,isFilterEnabled:pe,isFilterColumnActive:Re,isRowHidden:W,getFilteredOutRows:zt,getVisibleRowCount:g,getVisibleRowAt:c,getVisibleRowIndex:w,getViewportRegions:jo,cellToScreenRect:Pn,screenToCell:mo,isCellFrozen:Un,scrollCellIntoView:Dn,BASE_CELL_VPAD:He,fontMetricsCache:de,fontMetricsCanvas:Le,measureFontMetrics:ve,_getFontMetricsForCell:Rt,getWrappedLines:ft,cellFontSize:Mt,colPositions:Ft,getRowHeight:nl,_isAutoRow:dl,rowPositions:Se,totalWidth:qe,totalHeight:mt,selectCell:jt,selectRange:kl,selectAll:gn,isSelected:El,isCellSelected:nn,selectionMode:Q,cellKey:ct,delCell:kt,findMerge:On,_isMergeAnchor:Po,_mergedSpan:on,expandSelectionForMerges:Zt,getCellRaw:Jt,getCellValue:Wt,setCellValue:rl,clearCellsInRange:rn,startEdit:so,commitEdit:co,cancelEdit:Uo,moveActive:Ko,ensureVisible:Go,hitCol:uo,hitRow:fo,registerStyle:te,resolveStyle:Ne,rebuildStyleIndex:ze,syncStyles:Ve,registerBorder:Fe,resolveBorder:je,rebuildBorderIndex:_e,syncBorders:F,getCellBorderSide:I,getMergeOwner:G,isSameMergeInternal:Ce,viewSize:It,findHighlight:(p,v)=>null,autoFillState:U,applyAutoFill:Jo,conditionalFormats:k,resolveConditionalFormat:Vl,addConditionalFormatRule:Fl,updateConditionalFormatRule:bn,removeConditionalFormatRule:yn,moveConditionalFormatRule:Bn,clearConditionalFormats:Gt,invalidateConditionalFormatCache:Tn,dataValidations:Y,getDataValidationRules:pt,getDataValidationRule:Pt,hasDataValidation:$n,getListValidation:Hn,getValidationDropdown:Qt,getValidationInputMessage:Il,validateCell:ul,validateCells:fl,createDataValidation:Al,updateDataValidation:ml,removeDataValidation:sn,clearDataValidation:ro,getDataValidationsInRange:ao,applyDataValidationsToRange:zn,invalidateDataValidationCache:$t,isValidationAlertOpen:io,confirmInvalidValue:Wn};return Nn=()=>{var p;return(p=q.saveUndo)==null?void 0:p.call(q)},Ot=(p,v)=>{var S;return(S=q.clampScroll)==null?void 0:S.call(q,p,v)},q}function T0(e,n){const l=t.ref([]),o=t.ref([]);function a(V){return E0(V)}function i(){return n.saveSheet(),{sheets:n.sheets.value.map(V=>({id:V.id,name:V.name,cells:a(V.cells),styles:[...V.styles],borders:V.borders?[...V.borders]:[{}],merges:V.merges?{...V.merges}:{},selection:V.selection?{...V.selection}:null,activeCell:V.activeCell?{...V.activeCell}:{col:0,row:0},scrollX:V.scrollX,scrollY:V.scrollY,colWidths:[...V.colWidths],rowHeights:[...V.rowHeights],colCount:V.colCount,rowCount:V.rowCount,freeze:{...V.freeze},filter:V.filter?JSON.parse(JSON.stringify(V.filter)):null,conditionalFormats:V.conditionalFormats?V.conditionalFormats.map(le=>({...le,ranges:le.ranges.map(me=>({...me}))})):[],dataValidations:V.dataValidations?V.dataValidations.map(le=>({...le,ranges:(le.ranges??[]).map(me=>({...me}))})):[]})),styles:[...e.styles],activeSheetIndex:n.activeSheetIndex.value}}function r(V){const le=n.sheets.value;n.sheets.value=V.sheets.map((me,pe)=>{var Te;const Re=((Te=le[pe])==null?void 0:Te.freeze)??{rows:0,cols:0};return{...me,cells:a(me.cells),styles:[...me.styles],borders:me.borders?[...me.borders]:[{}],freeze:{rows:Re.rows,cols:Re.cols}}}),n.loadSheet(Math.max(0,Math.min(V.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function d(){const V=i(),le=l.value[l.value.length-1];le&&JSON.stringify(le)===JSON.stringify(V)||(l.value.push(V),o.value=[],l.value.length>50&&l.value.shift())}e.saveUndo=d;function f(){var V,le,me;l.value.length&&(o.value.push(i()),r(l.value.pop()),(V=e.invalidateConditionalFormatCache)==null||V.call(e),(le=e.invalidateDataValidationCache)==null||le.call(e),(me=e.scheduleRender)==null||me.call(e),t.nextTick(()=>{var pe;return(pe=e.emitModelData)==null?void 0:pe.call(e)}))}function y(){var V,le,me;o.value.length&&(l.value.push(i()),r(o.value.pop()),(V=e.invalidateConditionalFormatCache)==null||V.call(e),(le=e.invalidateDataValidationCache)==null||le.call(e),(me=e.scheduleRender)==null||me.call(e),t.nextTick(()=>{var pe;return(pe=e.emitModelData)==null?void 0:pe.call(e)}))}const h=t.computed(()=>l.value.length>0),u=t.computed(()=>o.value.length>0),E=t.computed(()=>!!e.selection.value),x=t.ref(null);function k(){var me;const V=e.selection.value;if(!V)return;const le={};for(let pe=V.startCol;pe<=V.endCol;pe++)for(let Re=V.startRow;Re<=V.endRow;Re++)le[`${pe-V.startCol},${Re-V.startRow}`]=((me=e.cells[e.cellKey(pe,Re)])==null?void 0:me.styleId)??0;x.value={styles:le}}function H(){var me,pe,Re;const V=x.value,le=e.selection.value;if(!(!V||!le)){d();for(let Te=le.startCol;Te<=le.endCol;Te++)for(let Se=le.startRow;Se<=le.endRow;Se++){const qe=e.findMerge(Te,Se);if(qe&&(Te!==qe.range.startCol||Se!==qe.range.startRow))continue;const mt=V.styles[`${Te-le.startCol},${Se-le.startRow}`]??0,ct=e.cellKey(Te,Se),kt=((me=e.cells[ct])==null?void 0:me.value)??"";if(kt===""&&mt===0)e.delCell(ct);else{const jt={value:kt};mt>0&&(jt.styleId=mt),e.cells[ct]=jt}}x.value=null,(pe=e.scheduleRender)==null||pe.call(e),(Re=e.emitModelData)==null||Re.call(e)}}function Y(){var le,me,pe;const V=e.selection.value;if(V){d();for(let Re=V.startCol;Re<=V.endCol;Re++)for(let Te=V.startRow;Te<=V.endRow;Te++){const Se=e.findMerge(Re,Te);if(Se&&(Re!==Se.range.startCol||Te!==Se.range.startRow))continue;const qe=e.cellKey(Re,Te),mt=((le=e.cells[qe])==null?void 0:le.value)??"";mt===""?e.delCell(qe):e.cells[qe]={value:mt}}(me=e.scheduleRender)==null||me.call(e),(pe=e.emitModelData)==null||pe.call(e)}}const ne=t.computed(()=>ra.map(V=>({...V,label:V.value===""?b(e.locale.value,"fontDefault"):V.label}))),ee=t.computed(()=>aa.map(V=>({...V,label:String(V.value)}))),M="\0",se=t.computed(()=>{const V=e.selection.value;if(!V)return"";let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=typeof(Se==null?void 0:Se.fontFamily)=="string"?Se.fontFamily:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?M:le??""}),X=t.computed(()=>{const V=e.selection.value;if(!V)return zl;let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.cellFontSize(pe,Re);le===void 0?le=Se:Se!==le&&(me=!0)}return me?0:le??zl});function te(V,le){var pe,Re,Te;const me=e.selection.value;if(me){d();for(let Se=me.startCol;Se<=me.endCol;Se++)for(let qe=me.startRow;qe<=me.endRow;qe++){const mt=e.findMerge(Se,qe);if(mt&&(Se!==mt.range.startCol||qe!==mt.range.startRow))continue;const ct=e.cellKey(Se,qe),kt=((pe=e.cells[ct])==null?void 0:pe.value)??"";let kl={...e.resolveStyle(e.cells[ct])??{}};if(le===""||le===null||le===void 0||le===0){const{[V]:El,...nn}=kl;kl=nn}else kl[V]=le;const gn=Object.keys(kl).length?e.registerStyle(kl):0;if(kt===""&&gn===0)e.delCell(ct);else{const El={value:kt};gn>0&&(El.styleId=gn),e.cells[ct]=El}}(Re=e.scheduleRender)==null||Re.call(e),(Te=e.emitModelData)==null||Te.call(e)}}function Ne(V){te("fontFamily",V===""?"":V)}const ze=t.ref(!1),Ve=t.ref(!1),Fe=t.ref(!1),je=t.ref(!1),_e=t.ref(!1);function F(V){te("fontSize",V),ze.value=!1}const I=t.computed(()=>ma.map(V=>({label:b(e.locale.value,V.labelKey),value:V.value,icon:V.icon}))),G=t.computed(()=>pa.map(V=>({label:b(e.locale.value,V.labelKey),value:V.value,icon:V.icon}))),Ce=t.computed(()=>{const V=e.selection.value;if(!V)return"left";const le=e.resolveStyle(e.cells[e.cellKey(V.startCol,V.startRow)]),me=typeof(le==null?void 0:le.textAlign)=="string"?le.textAlign:"";return me==="center"||me==="right"?me:"left"}),$e=t.computed(()=>{const V=e.selection.value;if(!V)return"top";const le=e.resolveStyle(e.cells[e.cellKey(V.startCol,V.startRow)]),me=typeof(le==null?void 0:le.verticalAlign)=="string"?le.verticalAlign:"";return me==="middle"||me==="bottom"?me:"top"}),j=t.computed(()=>{const V=e.selection.value;if(!V)return!1;const le=e.resolveStyle(e.cells[e.cellKey(V.startCol,V.startRow)]);return(le==null?void 0:le.wrap)==="wrap"});function Be(V){te("textAlign",V)}function Q(V){te("verticalAlign",V)}function ke(){if(!e.selection.value)return;const le=j.value;te("wrap",le?void 0:"wrap")}const B=t.ref(""),oe=ze;t.watch(X,V=>{B.value=V===0?"":String(V)},{immediate:!0});function Z(V){const le=V.replace(/[^\d]/g,"");B.value=le;const me=parseInt(le,10);!isNaN(me)&&me>=5&&me<=72&&me!==X.value&&te("fontSize",me)}function re(){const V=B.value.trim();if(!V){B.value=X.value===0?"":String(X.value);return}let le=parseInt(V,10);isNaN(le)?le=X.value===0?zl:X.value:le=Math.max(5,Math.min(72,le)),B.value=String(le),le!==X.value&&te("fontSize",le)}function K(V){V.key==="Enter"&&V.target.blur()}function L(V){V&&V.preventDefault(),oe.value=!oe.value,oe.value&&(Fe&&(Fe.value=!1),Ve&&(Ve.value=!1),je.value=!1,_e.value=!1)}function J(){const V=X.value===0?zl:X.value,le=Math.min(72,V+1);te("fontSize",le),B.value=String(le),oe.value=!1}function $(){const V=X.value===0?zl:X.value,le=Math.max(5,V-1);te("fontSize",le),B.value=String(le),oe.value=!1}function U(V){const le=e.selection.value;if(!le)return!1;let me,pe=!1;for(let Re=le.startCol;Re<=le.endCol&&!pe;Re++)for(let Te=le.startRow;Te<=le.endRow&&!pe;Te++){const Se=e.findMerge(Re,Te);if(Se&&(Re!==Se.range.startCol||Te!==Se.range.startRow))continue;const qe=e.resolveStyle(e.cells[e.cellKey(Re,Te)]),mt=!!(qe!=null&&qe[V]);me===void 0?me=mt:mt!==me&&(pe=!0)}return!pe&&me===!0}const de=t.computed(()=>U("fontWeight")),Le=t.computed(()=>U("fontStyle")),ve=t.computed(()=>U("underline")),Ie=t.computed(()=>U("strikethrough"));function Ee(){te("fontWeight",de.value?"":"bold")}function He(){te("fontStyle",Le.value?"":"italic")}function ge(){te("underline",ve.value?"":"underline")}function et(){te("strikethrough",Ie.value?"":"line-through")}const ut=t.ref(""),Pe=t.ref(""),N=je,ie=_e;function Rt(){N.value=!N.value,ie.value=!1,Ve&&(Ve.value=!1),Fe&&(Fe.value=!1)}function ft(){ie.value=!ie.value,N.value=!1,Ve&&(Ve.value=!1),Fe&&(Fe.value=!1)}function Mt(V){Ve&&(Ve.value=V),V&&(N.value=!1,ie.value=!1,Fe&&(Fe.value=!1))}function Ft(V){ut.value=V,te("color",V===""?"":V)}function It(V){Pe.value=V,te("backgroundColor",V===""?"":V)}function Ot(){te("color",ut.value===""?"":ut.value)}function Dl(){te("backgroundColor",Pe.value===""?"":Pe.value)}const nl=t.computed(()=>{const V=e.selection.value;if(!V)return"";let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=typeof(Se==null?void 0:Se.color)=="string"?Se.color:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?"":le??""}),dl=t.computed(()=>{const V=e.selection.value;if(!V)return"";let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=typeof(Se==null?void 0:Se.backgroundColor)=="string"?Se.backgroundColor:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?"":le??""}),ol=t.computed(()=>ur(e.locale.value)),Ht=t.ref(!1),vl=t.computed(()=>{const V=e.selection.value;if(!V)return Pl;let le,me=!1;for(let pe=V.startCol;pe<=V.endCol&&!me;pe++)for(let Re=V.startRow;Re<=V.endRow&&!me;Re++){const Te=e.findMerge(pe,Re);if(Te&&(pe!==Te.range.startCol||Re!==Te.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(pe,Re)]),qe=(Se==null?void 0:Se.numberFormatCategory)==="custom"?Wl:typeof(Se==null?void 0:Se.numberFormat)=="string"?Se.numberFormat:"";le===void 0?le=qe:qe!==le&&(me=!0)}return me?Tl:le??Pl});function zt(V){if((V==null?void 0:V.numberFormatCategory)==="custom")return Wl;const le=typeof(V==null?void 0:V.numberFormat)=="string"?V.numberFormat:"";return dr(le,e.locale.value)}const W=t.computed(()=>{const V=vl.value;if(V!==Tl)return V===Wl?Wl:dr(V,e.locale.value);const le=e.selection.value;if(!le)return Pl;let me,pe=!1;for(let Re=le.startCol;Re<=le.endCol&&!pe;Re++)for(let Te=le.startRow;Te<=le.endRow&&!pe;Te++){const Se=e.findMerge(Re,Te);if(Se&&(Re!==Se.range.startCol||Te!==Se.range.startRow))continue;const qe=zt(e.resolveStyle(e.cells[e.cellKey(Re,Te)]));me===void 0?me=qe:qe!==me&&(pe=!0)}return pe?Tl:me??Pl});function g(V){te("numberFormat",V),c()}function c(){const V=e.selection.value;if(V)for(let le=V.startCol;le<=V.endCol;le++)for(let me=V.startRow;me<=V.endRow;me++){const pe=e.findMerge(le,me);if(pe&&(le!==pe.range.startCol||me!==pe.range.startRow))continue;const Re=e.cellKey(le,me),Te=e.cells[Re],Se=e.resolveStyle(Te);if((Se==null?void 0:Se.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:qe,...mt}=Se,ct=Object.keys(mt).length?e.registerStyle(mt):0,kt=(Te==null?void 0:Te.value)??"";if(kt===""&&ct===0)e.delCell(Re);else{const jt={value:kt};ct>0&&(jt.styleId=ct),e.cells[Re]=jt}}}function w(V){if(V===Wl){Ht.value=!0;return}g(V)}function be(){Ht.value=!0}function he(){const V=e.selection.value;if(!V)return[];const le=[];for(let me=V.startCol;me<=V.endCol;me++)for(let pe=V.startRow;pe<=V.endRow;pe++){const Re=e.findMerge(me,pe);if(Re&&(me!==Re.range.startCol||pe!==Re.range.startRow))continue;const Te=e.cellKey(me,pe),Se=e.cells[Te],qe=e.resolveStyle(Se),mt=typeof(qe==null?void 0:qe.numberFormat)=="string"?qe.numberFormat:Pl,ct=(Se==null?void 0:Se.value)??"",kt=ct.startsWith("=")?kr(me,pe,e.cells,e.colCount,e.rowCount):ct;cr(mt,kt)&&le.push({key:Te,nf:mt,decimals:Ia(mt,kt)})}return le}const xe=t.computed(()=>he().some(V=>V.decimals<Eo)),we=t.computed(()=>he().some(V=>V.decimals>Ro));function ce(V,le,me){var qe;const pe=((qe=e.cells[V])==null?void 0:qe.value)??"",Te={...e.resolveStyle(e.cells[V])??{}};le===""?(delete Te.numberFormat,delete Te.numberFormatCategory):(Te.numberFormat=le,me==="custom"&&(Te.numberFormatCategory="custom"));const Se=Object.keys(Te).length?e.registerStyle(Te):0;if(pe===""&&Se===0)e.delCell(V);else{const mt={value:pe};Se>0&&(mt.styleId=Se),e.cells[V]=mt}}function Ue(V){var pe,Re;const le=he(),me=[];for(const Te of le){const Se=Te.decimals+V;if(Se<Ro||Se>Eo)continue;const qe=_a(Te.nf,Se);qe==null||qe===Te.nf||me.push({key:Te.key,code:qe,category:sl(Te.nf)?"custom":void 0})}if(me.length){d();for(const Te of me)ce(Te.key,Te.code,Te.category);(pe=e.scheduleRender)==null||pe.call(e),(Re=e.emitModelData)==null||Re.call(e)}}function Ze(){Ue(1)}function fe(){Ue(-1)}return{undoStack:l,redoStack:o,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:d,undo:f,redo:y,canUndo:h,canRedo:u,hasSelection:E,paintFmt:x,onPaintFormat:k,applyPaintFormat:H,clearFormat:Y,fontFamilyOptions:ne,fontSizeOptions:ee,FONT_FAMILY_MIXED:M,selFontFamily:se,selFontSize:X,applyStyleToSelection:te,onFontFamilyChange:Ne,onFontSizeChange:F,hAlignOptions:I,vAlignOptions:G,selHAlign:Ce,selVAlign:$e,selWrap:j,onHAlignChange:Be,onVAlignChange:Q,onWrapToggle:ke,fontSizeInput:B,fontSizeMenuOpen:oe,onFontSizeInput:Z,onFontSizeBlur:re,onFontSizeKeydown:K,toggleFontSizeMenu:L,onFontSizeStepUp:J,onFontSizeStepDown:$,selFontWeight:de,selFontStyle:Le,selUnderline:ve,selStrikethrough:Ie,toggleFontWeight:Ee,toggleFontStyle:He,toggleUnderline:ge,toggleStrikethrough:et,cachedTextColor:ut,cachedFillColor:Pe,textColorMenuOpen:N,fillColorMenuOpen:ie,_toggleTextColorMenu:Rt,_toggleFillColorMenu:ft,onBorderMenuToggle:Mt,onTextColorChange:Ft,onFillColorChange:It,applyCachedTextColor:Ot,applyCachedFillColor:Dl,selTextColor:nl,selFillColor:dl,nfOptions:ol,selNumberFormat:vl,selNumberFormatDisplay:W,NF_NUMBER_FORMAT_MIXED:Tl,nfDialogOpen:Ht,onNumberFormatChange:w,openNumberFormatDialog:be,applyNumberFormatCode:g,canIncreaseDecimals:xe,canDecreaseDecimals:we,onIncreaseDecimals:Ze,onDecreaseDecimals:fe}}function N0(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const o=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{o&&(o.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),o&&(o.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,o&&(o.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,o&&(o.value=!1),a&&(a.value=!1)}})()}function x0(e,n){const l=t.ref("none"),o=t.ref(!1),a="#444";function i(B,oe,Z,re){if(B<0||oe<0||B>=e.colCount||oe>=e.rowCount)return;const K=e.findMerge(B,oe),L=K?K.anchor:e.cellKey(B,oe);if(!e.cells[L]){if(!re)return;e.cells[L]={value:""}}M0(e.cells[L],Z,re,e.styles,{get:$=>e.resolveBorder($),getId:$=>e.registerBorder($)},e.registerStyle)}function r(B,oe,Z){var U;const re=e.findMerge(B,oe),K=re?re.anchor:e.cellKey(B,oe),L=((U=e.cells[K])==null?void 0:U.value)??"",J=e.resolveStyle(e.cells[K])?{...e.resolveStyle(e.cells[K])}:{},$=e.registerBorder(Z);if($>0?J.borderId=$:delete J.borderId,delete J.borderTopWidth,delete J.borderBottomWidth,delete J.borderLeftWidth,delete J.borderRightWidth,delete J.borderColor,L===""&&!Object.keys(J).length)e.delCell(K);else{const de=e.registerStyle(J);e.cells[K]={value:L,styleId:de||void 0}}}function d(B){var U,de;l.value=B;const oe=e.selection.value;if(!oe)return;n.saveUndo();const{startCol:Z,startRow:re,endCol:K,endRow:L}=oe,J={width:1,color:a},$={width:2,color:a};if(B==="none")for(let Le=Z;Le<=K;Le++)for(let ve=re;ve<=L;ve++){const Ie=e.findMerge(Le,ve);Ie&&(Le!==Ie.range.startCol||ve!==Ie.range.startRow)||r(Le,ve,{})}else if(B==="all")for(let Le=Z;Le<=K;Le++)for(let ve=re;ve<=L;ve++){const Ie=e.findMerge(Le,ve);Ie&&(Le!==Ie.range.startCol||ve!==Ie.range.startRow)||r(Le,ve,{top:J,right:J,bottom:J,left:J})}else if(B==="outer"||B==="thickOuter"){const Le=B==="thickOuter"?$:J;for(let ve=Z;ve<=K;ve++)i(ve,re,"top",Le);for(let ve=Z;ve<=K;ve++)i(ve,L,"bottom",Le);for(let ve=re;ve<=L;ve++)i(Z,ve,"left",Le);for(let ve=re;ve<=L;ve++)i(K,ve,"right",Le)}else{const ve={top:{side:"top",edgeCheck:(Ie,Ee)=>Ee===re},bottom:{side:"bottom",edgeCheck:(Ie,Ee)=>Ee===L},left:{side:"left",edgeCheck:(Ie,Ee)=>Ie===Z},right:{side:"right",edgeCheck:(Ie,Ee)=>Ie===K}}[B];if(ve)for(let Ie=Z;Ie<=K;Ie++)for(let Ee=re;Ee<=L;Ee++)ve.edgeCheck(Ie,Ee)&&i(Ie,Ee,ve.side,J)}(U=e.scheduleRender)==null||U.call(e),(de=e.emitModelData)==null||de.call(e)}function f(){d(l.value)}function y(B,oe,Z){const re=Z.toLowerCase(),K=e.findMerge(B,oe);if(K){if(re==="top"&&oe!==K.range.startRow||re==="bottom"&&oe!==K.range.endRow||re==="left"&&B!==K.range.startCol||re==="right"&&B!==K.range.endCol)return 0;const J=e.getCellBorderSide(e.cells[K.anchor],re);return(J==null?void 0:J.width)??0}const L=e.getCellBorderSide(e.cells[e.cellKey(B,oe)],re);return(L==null?void 0:L.width)??0}const h=t.ref(!1);function u(B){h.value=B,B&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,o.value=!1,n.fontSizeMenuOpen.value=!1)}function E(B,oe,Z,re){const K=[];for(const L in e.merges){const J=e.merges[L];J&&J.startCol<=Z&&J.endCol>=B&&J.startRow<=re&&J.endRow>=oe&&K.push(L)}for(const L of K)Reflect.deleteProperty(e.merges,L)}function x(){var L,J,$;const B=e.selection.value;if(!B||B.startCol===B.endCol&&B.startRow===B.endRow)return;n.saveUndo(),E(B.startCol,B.startRow,B.endCol,B.endRow);const oe=e.cellKey(B.startCol,B.startRow),Z=((L=e.cells[oe])==null?void 0:L.value)??"";for(let U=B.startCol;U<=B.endCol;U++)for(let de=B.startRow;de<=B.endRow;de++)U===B.startCol&&de===B.startRow||e.clearCellsInRange(U,U,de,de);const re=e.resolveStyle(e.cells[oe])?{...e.resolveStyle(e.cells[oe])}:{};re.textAlign="center";const K=e.registerStyle(re);e.cells[oe]={value:Z,styleId:K||void 0},e.merges[oe]={startCol:B.startCol,startRow:B.startRow,endCol:B.endCol,endRow:B.endRow},e.selectCell(B.startCol,B.startRow),(J=e.scheduleRender)==null||J.call(e),($=e.emitModelData)==null||$.call(e)}function k(){var oe,Z,re;const B=e.selection.value;if(!(!B||B.startCol===B.endCol)){n.saveUndo();for(let K=B.startRow;K<=B.endRow;K++){E(B.startCol,K,B.endCol,K);const L=e.cellKey(B.startCol,K);(oe=e.cells[L])==null||oe.value;for(let J=B.startCol+1;J<=B.endCol;J++)e.clearCellsInRange(J,J,K,K);e.merges[L]={startCol:B.startCol,startRow:K,endCol:B.endCol,endRow:K}}e.selectRange(B.startCol,B.startRow,B.endCol,B.endRow),(Z=e.scheduleRender)==null||Z.call(e),(re=e.emitModelData)==null||re.call(e)}}function H(){var Z,re,K;const B=e.selection.value;if(!B||B.startCol===B.endCol&&B.startRow===B.endRow)return;n.saveUndo(),E(B.startCol,B.startRow,B.endCol,B.endRow);const oe=e.cellKey(B.startCol,B.startRow);(Z=e.cells[oe])==null||Z.value;for(let L=B.startCol;L<=B.endCol;L++)for(let J=B.startRow;J<=B.endRow;J++)L===B.startCol&&J===B.startRow||e.clearCellsInRange(L,L,J,J);e.merges[oe]={startCol:B.startCol,startRow:B.startRow,endCol:B.endCol,endRow:B.endRow},e.selectCell(B.startCol,B.startRow),(re=e.scheduleRender)==null||re.call(e),(K=e.emitModelData)==null||K.call(e)}function Y(){var oe,Z;const B=e.selection.value;B&&(n.saveUndo(),E(B.startCol,B.startRow,B.endCol,B.endRow),(oe=e.scheduleRender)==null||oe.call(e),(Z=e.emitModelData)==null||Z.call(e))}function ne(){const B=e.selection.value;if(!B)return;const oe=e.findMerge(B.startCol,B.startRow);oe&&B.startCol===oe.range.startCol&&B.startRow===oe.range.startRow&&B.endCol===oe.range.endCol&&B.endRow===oe.range.endRow?Y():x()}function ee(B){switch(B){case"mergeCenter":x();break;case"mergeAcross":k();break;case"mergeCells":H();break;case"unmergeCells":Y();break}}let M=null,se=[],X=[];function te(B,oe,Z,re){X=[];const K={startCol:B,endCol:oe,startRow:Z,endRow:re};for(const{rule:L,range:J}of e.getDataValidationsInRange(K))X.push({...L,ranges:[{...J}]})}function Ne(B,oe,Z,re){se=[];for(let K=Z;K<=re;K++){const L=[];for(let J=B;J<=oe;J++){const $=e.cells[e.cellKey(J,K)];L.push(($==null?void 0:$.styleId)??0)}se.push(L)}}function ze(B,oe,Z,re){const K=e.cellKey(B,oe);if(tn(),Z===""||Z==null){e.formulaDeps.clear(K),re&&re>0?e.cells[K]={value:"",styleId:re}:e.delCell(K),e.formulaDeps.markDirty(K);return}e.cells[K]={value:Z,styleId:re&&re>0?re:void 0},Z.startsWith("=")?e.formulaDeps.set(K,Zn(Z.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(K),e.formulaDeps.markDirty(K)}function Ve(){const B=e.selection.value;if(!B)return;M={...B},Ne(B.startCol,B.endCol,B.startRow,B.endRow),te(B.startCol,B.endCol,B.startRow,B.endRow);const oe=[];for(let Z=B.startRow;Z<=B.endRow;Z++){const re=[];for(let K=B.startCol;K<=B.endCol;K++)re.push(e.getCellRaw(K,Z));oe.push(re.join(" "))}To(oe.join(`
4
- `))}function Fe(){const B=e.selection.value;if(B){if(B.startCol===0&&B.endCol===e.colCount-1){M={...B},Ne(0,e.colCount-1,B.startRow,B.endRow),te(0,e.colCount-1,B.startRow,B.endRow);const oe=[];for(let Z=B.startRow;Z<=B.endRow;Z++){const re=[];for(let K=0;K<e.colCount;K++)re.push(e.getCellRaw(K,Z));oe.push(re.join(" "))}To(oe.join(`
5
- `))}else if(B.startRow===0&&B.endRow===e.rowCount-1){M={...B},Ne(B.startCol,B.endCol,0,e.rowCount-1),te(B.startCol,B.endCol,0,e.rowCount-1);const oe=[];for(let Z=0;Z<e.rowCount;Z++){const re=[];for(let K=B.startCol;K<=B.endCol;K++)re.push(e.getCellRaw(K,Z));oe.push(re.join(" "))}To(oe.join(`
6
- `))}}}async function je(){var ve;let B;try{B=await navigator.clipboard.readText()}catch{return}if(!B&&B!=="")return;const oe=B.split(/\r?\n/),Z=e.activeCell.value,re=M,K=re&&se.length>0,L=oe.map(Ie=>Ie.split(" ").length),J=L.length?Math.max(...L):0,$=Z.col+J-1,U=Z.row+oe.length-1;$>=0&&U>=0&&e.ensureCapacity($,U);const de=[];for(let Ie=0;Ie<oe.length;Ie++){const Ee=oe[Ie].split(" ");for(let He=0;He<Ee.length;He++){const ge=Z.col+He,et=Z.row+Ie;let ut=Ee[He];ut.startsWith("=")&&re&&(ut=Jn(ut,ge-(re.startCol+He),et-(re.startRow+Ie),e.colCount,e.rowCount,lt));const Pe=K&&Ie<se.length&&He<(((ve=se[Ie])==null?void 0:ve.length)??0)?se[Ie][He]??null:null;de.push({c:ge,r:et,val:ut,styleId:Pe})}}const Le=e.validateCells(de.map(Ie=>({col:Ie.c,row:Ie.r,value:Ie.val})));if(!(!Le.valid&&await e.confirmInvalidValue(Le,Z.col,Z.row)!=="continue")){for(const Ie of de)Ie.styleId!==null?ze(Ie.c,Ie.r,Ie.val,Ie.styleId):e.setCellValue(Ie.c,Ie.r,Ie.val);if(re&&X.length>0){const Ie=Z.col-re.startCol,Ee=Z.row-re.startRow,He={startCol:Z.col,endCol:Z.col+J-1,startRow:Z.row,endRow:Z.row+oe.length-1},ge=X.map(et=>({...et,ranges:et.ranges.map(ut=>w0(ut,Ie,Ee))}));e.applyDataValidationsToRange(ge,He,{silent:!0}),e.invalidateDataValidationCache()}}}function _e(){var B;if(n.saveUndo(),Ve(),e.selection.value){const oe=e.selection.value;e.clearCellsInRange(oe.startCol,oe.endCol,oe.startRow,oe.endRow),(B=e.scheduleRender)==null||B.call(e)}}function F(){var B;if(e.selection.value){const oe=e.selection.value;e.clearCellsInRange(oe.startCol,oe.endCol,oe.startRow,oe.endRow),(B=e.scheduleRender)==null||B.call(e)}}function I(){var L,J;const B=e.selection.value;if(!B)return;n.saveUndo();const oe=B.startCol,Z=B.startRow,re=B.endCol,K=B.endRow;if(Z===K)if(re+1<e.colCount){const $=`${lt(oe)}${Z+1}:${lt(re)}${Z+1}`;e.setCellValue(re+1,Z,`=SUM(${$})`)}else{const $=`${lt(oe)}${Z+1}:${lt(re-1)}${Z+1}`;e.setCellValue(re,Z,`=SUM(${$})`)}else for(let $=oe;$<=re;$++)if(K+1<e.rowCount){const U=`${lt($)}${Z+1}:${lt($)}${K+1}`;e.setCellValue($,K+1,`=SUM(${U})`)}else{const U=`${lt($)}${Z+1}:${lt($)}${K}`;e.setCellValue($,K,`=SUM(${U})`)}(L=e.scheduleRender)==null||L.call(e),(J=e.emitModelData)==null||J.call(e)}function G(){var L,J;const B=e.selection.value;if(!B)return;n.saveUndo();const oe=B.startCol,Z=B.startRow,re=B.endCol,K=B.endRow;if(Z===K)if(re+1<e.colCount){const $=`${lt(oe)}${Z+1}:${lt(re)}${Z+1}`;e.setCellValue(re+1,Z,`=AVERAGE(${$})`)}else{const $=`${lt(oe)}${Z+1}:${lt(re-1)}${Z+1}`;e.setCellValue(re,Z,`=AVERAGE(${$})`)}else for(let $=oe;$<=re;$++)if(K+1<e.rowCount){const U=`${lt($)}${Z+1}:${lt($)}${K+1}`;e.setCellValue($,K+1,`=AVERAGE(${U})`)}else{const U=`${lt($)}${Z+1}:${lt($)}${K}`;e.setCellValue($,K,`=AVERAGE(${U})`)}(L=e.scheduleRender)==null||L.call(e),(J=e.emitModelData)==null||J.call(e)}function Ce(){var L,J;const B=e.selection.value;if(!B)return;n.saveUndo();const oe=B.startCol,Z=B.startRow,re=B.endCol,K=B.endRow;if(Z===K)if(re+1<e.colCount){const $=`${lt(oe)}${Z+1}:${lt(re)}${Z+1}`;e.setCellValue(re+1,Z,`=COUNT(${$})`)}else{const $=`${lt(oe)}${Z+1}:${lt(re-1)}${Z+1}`;e.setCellValue(re,Z,`=COUNT(${$})`)}else for(let $=oe;$<=re;$++)if(K+1<e.rowCount){const U=`${lt($)}${Z+1}:${lt($)}${K+1}`;e.setCellValue($,K+1,`=COUNT(${U})`)}else{const U=`${lt($)}${Z+1}:${lt($)}${K}`;e.setCellValue($,K,`=COUNT(${U})`)}(L=e.scheduleRender)==null||L.call(e),(J=e.emitModelData)==null||J.call(e)}const $e=t.ref(!1);function j(B){$e.value=B,B&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,o.value=!1,n.fontSizeMenuOpen.value=!1,h.value=!1)}function Be(){I(),$e.value=!1}function Q(){G(),$e.value=!1}function ke(){Ce(),$e.value=!1}return{cachedBorder:l,borderMenuOpen:o,BORDER_COLOR:a,onBorderChange:d,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:f,cellBorderWidth:y,mergeMenuOpen:h,onMergeMenuToggle:u,removeOverlappingMerges:E,mergeAndCenter:x,mergeAcross:k,mergeCells:H,unmergeCells:Y,onApplyMerge:ne,onMergeChange:ee,copySourceRange:null,copySourceStyles:[],captureStyles:Ne,captureDataValidations:te,setCellWithStyle:ze,copyToClipboard:Ve,copyRowCol:Fe,pasteFromClipboard:je,cutSelected:_e,clearSelected:F,sumSelected:I,avgSelected:G,countSelected:Ce,calcMenuOpen:$e,onCalcMenuToggle:j,onCalcSum:Be,onCalcAvg:Q,onCalcCount:ke}}function D0(e,n,l,o){const a={},i=o(n),r=o(l);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 Kr(e){return e==="number"?0:1}function Gr(e,n,l){var i;if(e==null||e.trim()==="")return{kind:"blank"};const o=n??"";if(o===il||o==="@")return{kind:"text",text:e};if(sl(o)){if(Cl(e))return{kind:"number",num:Number(e)};const r=Nl(e,l);return r?{kind:"number",num:r.serial}:{kind:"text",text:yl(e,o,l)}}const a=Ul(o);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:yl(e,o,l)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const d=((i=a.sections.find(f=>f.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*d}}return{kind:"text",text:yl(e,o,l)}}return{kind:"text",text:yl(e,o,l)}}function V0(e,n,l,o){if(e.kind==="blank"||n.kind==="blank")return e.kind==="blank"&&n.kind==="blank"?0:e.kind==="blank"?1:-1;const a=Kr(e.kind),i=Kr(n.kind);if(a!==i)return l==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(n.num??0):r=(e.text??"").localeCompare(n.text??"",o,{numeric:!0}),l==="asc"?r:-r}function F0(e,n,l){const o=e.map((a,i)=>i);return o.sort((a,i)=>{const r=V0(e[a],e[i],n,l);return r!==0?r:a-i}),o}function I0(e){if(e.length<2||e[0].kind!=="text")return!1;for(let n=1;n<e.length;n++)if(e[n].kind==="number")return!0;return!1}function zo(e){return e?JSON.parse(JSON.stringify(e)):null}function qr(e,n,l,o){if(!e)return null;const a=l-n+1,i={...e.range};return o?n<=i.endRow&&(n<=i.startRow&&(i.startRow+=a),i.endRow+=a):l<i.startRow?(i.startRow-=a,i.endRow-=a):n<=i.endRow&&(i.endRow-=Math.min(a,i.endRow-n+1),i.endRow<i.startRow&&(i.endRow=i.startRow)),{range:i,columns:e.columns}}function Yr(e,n,l,o){if(!e)return null;const a=l-n+1,i={...e.range},r={};if(o){n<=i.endCol&&(n<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const d in e.columns){const f=Number(d);r[f>=n?f+a:f]=e.columns[d]}}else{l<i.startCol?(i.startCol-=a,i.endCol-=a):n<=i.endCol&&(i.endCol-=Math.min(a,i.endCol-n+1),i.endCol<i.startCol&&(i.endCol=i.startCol));for(const d in e.columns){const f=Number(d);f>=n&&f<=l||(r[f>l?f-a:f]=e.columns[d])}}return{range:i,columns:r}}function Xr(e,n,l,o){if(n==="row"){const a=e.startRow,i=e.endRow;let r,d;if(i<l)r=a,d=i;else if(a>l+o-1)r=a-o,d=i-o;else if(r=a<l?a:l,d=i>l+o-1?i-o:l-1,d<r)return null;return{...e,startRow:r,endRow:d}}else{const a=e.startCol,i=e.endCol;let r,d;if(i<l)r=a,d=i;else if(a>l+o-1)r=a-o,d=i-o;else if(r=a<l?a:l,d=i>l+o-1?i-o:l-1,d<r)return null;return{...e,startCol:r,endCol:d}}}function jr(e,n,l,o){if(n==="row"){const a=e.startRow,i=e.endRow;return a>=l?{...e,startRow:a+o,endRow:i+o}:i<l?e:{...e,endRow:i+o}}else{const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+o,endCol:i+o}:i<l?e:{...e,endCol:i+o}}}function A0(e,n,l){var a;const o=l-n+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],d=r.ranges.map(f=>Xr(f,"row",n,o)).filter(f=>f!==null);d.length===0?e.conditionalFormats.splice(i,1):r.ranges=d}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function _0(e,n,l){var a;const o=l-n+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>jr(r,"row",n,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function L0(e,n,l){var a;const o=l-n+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],d=r.ranges.map(f=>Xr(f,"col",n,o)).filter(f=>f!==null);d.length===0?e.conditionalFormats.splice(i,1):r.ranges=d}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function O0(e,n,l){var a;const o=l-n+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>jr(r,"col",n,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Zr(e,n,l,o){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],d=(r.ranges??[]).map(f=>y0(f,n,l,o)).filter(f=>f!==null);d.length===0?e.dataValidations.splice(i,1):r.ranges=d}(a=e.invalidateDataValidationCache)==null||a.call(e)}function Jr(e,n,l,o){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>C0(r,n,l,o));(a=e.invalidateDataValidationCache)==null||a.call(e)}function $0(e,n,l,o,a){function i(W,g){const c=g-W+1,w=_e(W,g),be=[],he=[];for(const ce in e.cells){const Ue=ce.indexOf(",");if(Ue<0)continue;const Ze=parseInt(ce.substring(0,Ue),10),fe=parseInt(ce.substring(Ue+1),10);fe>=W&&fe<=g?he.push(ce):fe>g&&be.push({oldKey:ce,newKey:e.cellKey(Ze,fe-c),cell:e.cells[ce]})}for(const ce of he)Reflect.deleteProperty(e.cells,ce);for(const ce of be)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const xe=e.rowHeights.value,we=new Array(xe.length);for(let ce=0;ce<W;ce++)we[ce]=xe[ce];for(let ce=W;ce<xe.length-c;ce++)we[ce]=xe[ce+c];for(let ce=xe.length-c;ce<xe.length;ce++)we[ce]=void 0;e.rowHeights.value=we,je(w),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(qr(e.getFilter(),W,g,!1)),A0(e,W,g),Zr(e,"row",W,c)}function r(W,g){const c=g-W+1,w=e.rowCount,be=e.colCount,{lastRow:he}=y();he>=W&&he+c>=w&&e.ensureCapacity(be-1,w-1+c);const xe=e.rowCount,we=I(W,g),ce=[];for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(0,We),10),le=parseInt(fe.substring(We+1),10);le>=W&&ce.push({oldKey:fe,newKey:e.cellKey(V,le+c),cell:e.cells[fe],oldRow:le})}ce.sort((fe,We)=>We.oldRow-fe.oldRow);for(const fe of ce)Reflect.deleteProperty(e.cells,fe.oldKey),e.cells[fe.newKey]=fe.cell;for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(We+1),10);V>=W&&V<=g&&Reflect.deleteProperty(e.cells,fe)}const Ue=e.rowHeights.value,Ze=new Array(xe);for(let fe=0;fe<W;fe++)Ze[fe]=Ue[fe];for(let fe=W;fe<=g;fe++)Ze[fe]=void 0;for(let fe=W;fe<xe;fe++)Ze[fe+c]=Ue[fe];e.rowHeights.value=Ze,je(we),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(qr(e.getFilter(),W,g,!0)),_0(e,W,g),Jr(e,"row",W,c)}function d(W,g){const c=g-W+1,w=e.colCount,be=e.rowCount,{lastCol:he}=y();he>=W&&he+c>=w&&e.ensureCapacity(w-1+c,be-1);const xe=e.colCount,we=G(W,g),ce=[];for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(0,We),10),le=parseInt(fe.substring(We+1),10);V>=W&&ce.push({oldKey:fe,newKey:e.cellKey(V+c,le),cell:e.cells[fe],oldCol:V})}ce.sort((fe,We)=>We.oldCol-fe.oldCol);for(const fe of ce)Reflect.deleteProperty(e.cells,fe.oldKey),e.cells[fe.newKey]=fe.cell;for(const fe in e.cells){const We=fe.indexOf(",");if(We<0)continue;const V=parseInt(fe.substring(0,We),10);V>=W&&V<=g&&Reflect.deleteProperty(e.cells,fe)}const Ue=e.colWidths.value,Ze=new Array(xe);for(let fe=0;fe<W;fe++)Ze[fe]=Ue[fe];for(let fe=W;fe<=g;fe++)Ze[fe]=100;for(let fe=W;fe<xe;fe++)Ze[fe+c]=Ue[fe];e.colWidths.value=Ze,je(we),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Yr(e.getFilter(),W,g,!0)),O0(e,W,g),Jr(e,"col",W,c)}function f(W,g){const c=g-W+1,w=F(W,g),be=[],he=[];for(const ce in e.cells){const Ue=ce.indexOf(",");if(Ue<0)continue;const Ze=parseInt(ce.substring(0,Ue),10),fe=parseInt(ce.substring(Ue+1),10);Ze>=W&&Ze<=g?he.push(ce):Ze>g&&be.push({oldKey:ce,newKey:e.cellKey(Ze-c,fe),cell:e.cells[ce]})}for(const ce of he)Reflect.deleteProperty(e.cells,ce);for(const ce of be)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const xe=e.colWidths.value,we=new Array(xe.length);for(let ce=0;ce<W;ce++)we[ce]=xe[ce];for(let ce=W;ce<xe.length-c;ce++)we[ce]=xe[ce+c];for(let ce=xe.length-c;ce<xe.length;ce++)we[ce]=100;e.colWidths.value=we,je(w),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Yr(e.getFilter(),W,g,!1)),L0(e,W,g),Zr(e,"col",W,c)}function y(){let W=-1,g=-1;for(const c in e.cells){const w=c.split(",");if(w.length===2){const be=parseInt(w[0],10),he=parseInt(w[1],10),xe=e.cells[c];xe&&(xe.value!==""||xe.styleId!==void 0)&&(be>W&&(W=be),he>g&&(g=he))}}for(let c=e.colCount-1;c>=0;c--){const w=e.colWidths.value[c];if(w!==void 0&&w!==100){c>W&&(W=c);break}}for(let c=e.rowCount-1;c>=0;c--)if(e.rowHeights.value[c]!==void 0){c>g&&(g=c);break}return{lastCol:W,lastRow:g}}function h(W,g){const c=e.resolveStyle(e.cells[e.cellKey(W,g)]);return typeof(c==null?void 0:c.numberFormat)=="string"?c.numberFormat:""}function u(W,g,c){for(let w=g;w<=c;w++)if(e.getCellRaw(W,w).trim()!=="")return!0;return!1}function E(W){const{startRow:g,endRow:c,startCol:w,endCol:be}=W;let he=w,xe=be;for(;he>0&&u(he-1,g,c);)he--;for(;xe<e.colCount-1&&u(xe+1,g,c);)xe++;return{startRow:g,endRow:c,startCol:he,endCol:xe}}function x(W){const g=E(W);return g.startCol!==W.startCol||g.endCol!==W.endCol}function k(W,g,c,w=W){let be,he;if(c)be=c.startRow,he=c.endRow;else{const fe=e.selection.value,We=!!fe&&fe.startRow===fe.endRow&&fe.startCol===fe.endCol;be=We||!fe?0:fe.startRow,he=We||!fe?e.rowCount-1:fe.endRow}let xe=-1,we=-1;for(let fe=be;fe<=he;fe++){let We=!1;for(let V=W;V<=g;V++)if(e.getCellRaw(V,fe).trim()!==""){We=!0;break}We&&(xe<0&&(xe=fe),we=fe)}if(xe<0)return null;const ce=[];for(let fe=xe;fe<=we;fe++){const We=e.getCellRaw(w,fe);ce.push(Gr(We,h(w,fe),e.locale.value))}const Ue=I0(ce)?xe+1:xe;let Ze=!1;for(let fe=xe;fe<=we&&!Ze;fe++)for(let We=W;We<=g;We++){const V=e.cells[e.cellKey(We,fe)];if(V&&V.value.startsWith("=")){Ze=!0;break}}if(!Ze)for(const fe in e.merges){const We=e.merges[fe];if(We&&We.startCol<=g&&We.endCol>=W&&We.startRow<=he&&We.endRow>=be){Ze=!0;break}}return{firstRow:xe,lastRow:we,sortStart:Ue,blocked:Ze}}function H(W,g){const c=k(W,g);return!!c&&!c.blocked&&c.sortStart<c.lastRow}function Y(W,g,c){var le,me;const w=g??e.selection.value;if(!w)return;const be=w.startCol,he=w.endCol,xe=c??be,we=k(be,he,{startRow:w.startRow,endRow:w.endRow},xe);if(!we||we.blocked||we.sortStart>=we.lastRow)return;const ce=he-be+1,Ue=we.lastRow-we.sortStart+1,Ze=[],fe=[];for(let pe=we.sortStart;pe<=we.lastRow;pe++){const Re=new Array(ce);for(let Se=be;Se<=he;Se++)Re[Se-be]=e.cells[e.cellKey(Se,pe)]??null;Ze.push(Re);const Te=e.getCellRaw(xe,pe);fe.push(Gr(Te,h(xe,pe),e.locale.value))}const We=F0(fe,W,e.locale.value);let V=!1;for(let pe=0;pe<Ue;pe++)if(We[pe]!==pe){V=!0;break}if(V){n.saveUndo();for(let pe=0;pe<Ue;pe++){const Re=Ze[We[pe]],Te=we.sortStart+pe;for(let Se=be;Se<=he;Se++){const qe=e.cellKey(Se,Te),mt=Re[Se-be],ct=mt?mt.value:"",kt=(le=e.cells[qe])==null?void 0:le.styleId;ct!==""||kt!==void 0?e.cells[qe]={value:ct,styleId:kt}:e.delCell(qe)}}tn();for(let pe=we.sortStart;pe<=we.lastRow;pe++)for(let Re=be;Re<=he;Re++)e.formulaDeps.markDirty(e.cellKey(Re,pe));(me=e.scheduleRender)==null||me.call(e),ve()}}const ne=t.ref(!1),ee=t.ref(null);function M(W){const g=e.selection.value;if(!g||!x(g))return!1;const c=E(g);return ee.value={order:W,originalRange:g,expandedRange:c},ne.value=!0,!0}function se(W){const g=ee.value;if(!g)return;const{order:c,originalRange:w,expandedRange:be}=g;ne.value=!1,ee.value=null,Y(c,W?be:w,w.startCol),Ne.value=c}function X(){ne.value=!1,ee.value=null}const te=t.ref(!1),Ne=t.ref("asc");function ze(W){te.value=W,W&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,n.fontSizeMenuOpen.value=!1)}function Ve(W){M(W)||(Ne.value=W,Y(W))}function Fe(){M(Ne.value)||Y(Ne.value)}function je(W){Object.keys(e.merges).forEach(g=>Reflect.deleteProperty(e.merges,g));for(const g of W)if(!(g.newRange.startCol>g.newRange.endCol||g.newRange.startRow>g.newRange.endRow)&&(e.merges[g.newAnchorKey]={...g.newRange},g.anchorCell)){const c=g.anchorCell.value,w=g.anchorCell.styleId;c===""&&!w||(e.cells[g.newAnchorKey]={value:c,styleId:w||void 0})}}function _e(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;const xe=e.cells[be]?{value:e.cells[be].value,styleId:e.cells[be].styleId??0}:{value:"",styleId:0},{startCol:we,endCol:ce}=he;let{startRow:Ue,endRow:Ze}=he;if(Ue>g){Ue-=c,Ze-=c,w.push({newAnchorKey:e.cellKey(we,Ue),newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(Ze<W){w.push({newAnchorKey:be,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(Ue>=W&&Ze<=g||(Ue>=W&&Ue<=g&&(Ue=W),Ze>=W&&Ze<=g?Ze=W-1:Ze>g&&(Ze-=c),Ue>Ze))continue;const fe=we,We=Ue,V=e.cellKey(fe,We),me=be.split(",").map(Number)[1],pe=me>=W&&me<=g||fe!==he.startCol||We!==me;w.push({newAnchorKey:V,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze},anchorCell:pe?xe:void 0})}return w}function F(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;const xe=e.cells[be]?{value:e.cells[be].value,styleId:e.cells[be].styleId??0}:{value:"",styleId:0};let{startCol:we,endCol:ce}=he;const{startRow:Ue,endRow:Ze}=he;if(we>g){we-=c,ce-=c,w.push({newAnchorKey:e.cellKey(we,Ue),newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(ce<W){w.push({newAnchorKey:be,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze}});continue}if(we>=W&&ce<=g||(we>=W&&we<=g&&(we=W),ce>=W&&ce<=g?ce=W-1:ce>g&&(ce-=c),we>ce))continue;const fe=we,We=Ue,V=e.cellKey(fe,We),me=be.split(",").map(Number)[0],pe=me>=W&&me<=g||fe!==me||We!==he.startRow;w.push({newAnchorKey:V,newRange:{startCol:we,startRow:Ue,endCol:ce,endRow:Ze},anchorCell:pe?xe:void 0})}return w}function I(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;const{startCol:xe,endCol:we}=he;let{startRow:ce,endRow:Ue}=he;Ue<W?w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}):ce>g?(ce+=c,Ue+=c,w.push({newAnchorKey:e.cellKey(xe,ce),newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}})):(Ue+=c,w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}))}return w}function G(W,g){const c=g-W+1,w=[];for(const be in e.merges){const he=e.merges[be];if(!he)continue;let{startCol:xe,endCol:we}=he;const{startRow:ce,endRow:Ue}=he;we<W?w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}):xe>g?(xe+=c,we+=c,w.push({newAnchorKey:e.cellKey(xe,ce),newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}})):(we+=c,w.push({newAnchorKey:be,newRange:{startCol:xe,startRow:ce,endCol:we,endRow:Ue}}))}return w}let Ce=0;function $e(){return Ce++,`s_${Ce}`}function j(W){if(!Array.isArray(W))return[];const g=[];for(const c of W){if(!c||typeof c!="object")continue;const w=c;if(!w.type||!Array.isArray(w.ranges)||w.ranges.length===0)continue;const be=w.ranges.filter(he=>!!he&&typeof he.startCol=="number"&&typeof he.startRow=="number"&&typeof he.endCol=="number"&&typeof he.endRow=="number").map(he=>({startCol:Math.min(he.startCol,he.endCol),endCol:Math.max(he.startCol,he.endCol),startRow:Math.min(he.startRow,he.endRow),endRow:Math.max(he.startRow,he.endRow)}));be.length&&g.push({...w,id:w.id||`dv_${g.length}`,ranges:be})}return g}function Be(W,g){const c=Math.max(1,(g==null?void 0:g.colCount)??e.colCount),w=Math.max(1,(g==null?void 0:g.rowCount)??e.rowCount),be=new Array(c).fill(100),he=new Array(w).fill(void 0);return{id:$e(),name:W,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:be,rowHeights:he,colCount:c,rowCount:w,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[]}}const Q=t.ref([Be("Sheet1")]),ke=t.ref(0);function B(){const W=Q.value[ke.value];W&&(W.cells={...e.cells},W.merges={...e.merges},W.selection=e.selection.value?{...e.selection.value}:null,W.activeCell={...e.activeCell.value},W.scrollX=e.scrollX.value,W.scrollY=e.scrollY.value,W.colWidths=[...e.colWidths.value],W.rowHeights=[...e.rowHeights.value],W.styles=[...e.styles],W.borders=[...e.borders],W.colCount=e.colCount,W.rowCount=e.rowCount,W.freeze={rows:e.freeze.rows,cols:e.freeze.cols},W.filter=zo(e.getFilter()),W.conditionalFormats=[...e.conditionalFormats],W.dataValidations=[...e.dataValidations])}function oe(W){var Ue,Ze,fe;const g=Q.value[W];if(!g)return;Object.keys(e.cells).forEach(We=>e.delCell(We)),Object.assign(e.cells,g.cells),Object.keys(e.merges).forEach(We=>Reflect.deleteProperty(e.merges,We)),g.merges&&Object.assign(e.merges,g.merges),e.selection.value=g.selection?{...g.selection}:null,e.activeCell.value={...g.activeCell};const c=e.activeCell.value,w=e.selection.value,be=e.findMerge(c.col,c.row);be&&be.anchor===e.cellKey(c.col,c.row)&&(!w||w.startCol===c.col&&w.startRow===c.row&&w.endCol===c.col&&w.endRow===c.row)&&e.selectCell(c.col,c.row),e.scrollX.value=g.scrollX,e.scrollY.value=g.scrollY,e.colWidths.value=[...g.colWidths],e.rowHeights.value=[...g.rowHeights];const he=Math.max(1,g.colCount??e.colCount),xe=Math.max(1,g.rowCount??e.rowCount);if((Ue=e.setDims)==null||Ue.call(e,he,xe),e.freeze.rows=Math.max(0,Math.min(g.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(g.freeze.cols,e.colCount)),g.filter){const We=g.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(We.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(We.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(We.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(We.endRow,e.rowCount-1))},columns:{...g.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(g.styles),e.syncBorders(g.borders??[{}]);const we=g.conditionalFormats?g.conditionalFormats.map(We=>({...We,ranges:We.ranges.map(V=>({...V}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...we),(Ze=e.invalidateConditionalFormatCache)==null||Ze.call(e);const ce=j(g.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...ce),(fe=e.invalidateDataValidationCache)==null||fe.call(e),ke.value=W}function Z(W){W===ke.value||W<0||W>=Q.value.length||(e.cancelEdit(),B(),oe(W))}function re(W){return n.saveUndo(),e.cancelEdit(),B(),Q.value.push(Be(W??`Sheet${Q.value.length+1}`)),oe(Q.value.length-1),Q.value.length-1}function K(W){return Q.value.length<=1||(n.saveUndo(),e.cancelEdit(),Q.value.splice(W,1),oe(Math.min(W,Q.value.length-1))),ke.value}function L(W,g){Q.value[W]&&g.trim()&&(n.saveUndo(),Q.value[W].name=g.trim())}function J(W){n.saveUndo(),e.cancelEdit(),B();const g=Q.value[W];if(!g)return W;let c=g.name;const w=c.match(/^(.*?)\s*\((\d+)\)$/);let be=w?parseInt(w[2],10)+1:2;w&&(c=w[1]);let he=`${c} (${be})`;const xe=new Set(Q.value.map(ce=>ce.name));for(;xe.has(he);)be++,he=`${c} (${be})`;const we={id:$e(),name:he,cells:{...g.cells},merges:g.merges?{...g.merges}:{},styles:[...g.styles],borders:g.borders?[...g.borders]:[{}],selection:g.selection?{...g.selection}:null,activeCell:g.activeCell?{...g.activeCell}:{col:0,row:0},scrollX:g.scrollX,scrollY:g.scrollY,colWidths:[...g.colWidths],rowHeights:[...g.rowHeights],colCount:g.colCount,rowCount:g.rowCount,freeze:{...g.freeze},filter:zo(g.filter),conditionalFormats:g.conditionalFormats?g.conditionalFormats.map(ce=>({...ce})):[],dataValidations:j(g.dataValidations)};return Q.value.splice(W+1,0,we),oe(W+1),W+1}function $(W,g){var he;const c=W+g;if(c<0||c>=Q.value.length)return;n.saveUndo();const w=ke.value,be=Q.value.splice(W,1)[0];Q.value.splice(c,0,be),w===W?ke.value=c:W<w&&c>=w?ke.value=w-1:W>w&&c<=w&&(ke.value=w+1),(he=e.scheduleRender)==null||he.call(e)}const U=t.computed(()=>Q.value.length);let de="";const Le=l;function ve(){B();const W=Q.value.map(c=>{const w={};for(const[we,ce]of Object.entries(c.cells))w[we]={value:ce.value},ce.styleId&&ce.styleId>0&&(w[we].styleId=ce.styleId);const be={name:c.name,cells:w};c.styles&&c.styles.length>1&&(be.styles=[...c.styles]),c.borders&&c.borders.length>1&&(be.borders=[...c.borders]),c.merges&&Object.keys(c.merges).length&&(be.merges={...c.merges});const he={};for(let we=0;we<c.colWidths.length;we++)c.colWidths[we]!==100&&(he[we]=c.colWidths[we]);Object.keys(he).length&&(be.colWidths=he);const xe={};for(let we=0;we<c.rowHeights.length;we++){const ce=c.rowHeights[we];ce!=null&&(xe[we]=ce)}return Object.keys(xe).length&&(be.rowHeights=xe),c.colCount!==26&&(be.colCount=c.colCount),c.rowCount!==200&&(be.rowCount=c.rowCount),(c.freeze.rows!==0||c.freeze.cols!==0)&&(be.freeze={rows:c.freeze.rows,cols:c.freeze.cols}),c.filter&&(be.filter=zo(c.filter)),c.conditionalFormats&&c.conditionalFormats.length&&(be.conditionalFormats=c.conditionalFormats.map(we=>({...we}))),c.dataValidations&&c.dataValidations.length&&(be.dataValidations=c.dataValidations.map(we=>({...we,ranges:we.ranges.map(ce=>({...ce}))}))),be}),g=JSON.stringify(W);g!==de&&(de=g,Le.value=W,a&&(a.value=g))}e.emitModelData=ve;let Ie=!1;function Ee(){Ie||(Ie=!0,Promise.resolve().then(()=>{Ie=!1,ve()}))}const He=t.computed(()=>e.props.theme==="dark"?ba:ga),ge=t.computed(()=>D0(He.value,e.props.width,e.props.height,hn)),et=t.computed(()=>{const W={};for(const[g,c]of Object.entries(ge.value))g.startsWith("--")&&(W[g]=c);return W}),ut=t.ref(null),Pe=t.ref(null),N=t.ref(null),ie=t.ref(null),Rt=t.ref(null),ft=t.reactive({w:800,h:600});e.viewSize&&t.watch(ft,W=>{e.viewSize&&(e.viewSize.w=W.w,e.viewSize.h=W.h)},{deep:!0});const Mt=48,Ft=28,It=11,Ot=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,ft.w-Mt-It))),Dl=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,ft.h-Ft-It)));function nl(W,g){const c=Math.max(0,ft.w-Mt-It),w=Math.max(0,ft.h-Ft-It),be=W??e.scrollX.value,he=g??e.scrollY.value,xe=40,we=Math.max(0,e.totalWidth.value-c),ce=Math.max(0,e.totalHeight.value-w);if(be>=we-xe&&be>e.scrollX.value||he>=ce-xe&&he>e.scrollY.value){const Ue=Math.max(0,Math.ceil((be+c)/100)+2),Ze=Math.max(0,Math.ceil((he+w)/24)+2);e.ensureCapacity(Ue,Ze)}e.scrollX.value=Math.max(0,Math.min(be,Math.max(0,e.totalWidth.value-c))),e.scrollY.value=Math.max(0,Math.min(he,Math.max(0,e.totalHeight.value-w)))}e.clampScroll=nl;function dl(){var W;return typeof window>"u"?!1:!((W=window.matchMedia)!=null&&W.call(window,"(hover: none) and (pointer: coarse)").matches)}function ol(W=!1){t.nextTick(()=>{const g=ie.value;if(g){if(!e.editingCell.value&&!dl()){document.activeElement===g&&g.blur();return}g.focus({preventScroll:!0}),W&&g.select()}})}function Ht(){ol()}function vl(){var g;const W=e.selection.value;if(W){n.saveUndo();for(let c=W.startRow;c<=W.endRow;c++)e.rowHeights.value[c]=void 0;(g=e.scheduleRender)==null||g.call(e),ve()}}function zt(){var g;const W=e.selection.value;if(W){n.saveUndo();for(let c=W.startCol;c<=W.endCol;c++)e.colWidths.value[c]=100;(g=e.scheduleRender)==null||g.call(e),ve()}}return{deleteRows:i,insertRows:r,insertCols:d,deleteCols:f,sortSelectedColumns:Y,canSortColumns:H,sortMenuOpen:te,cachedSortOrder:Ne,onSortMenuToggle:ze,onSortChange:Ve,applyCachedSort:Fe,sortConfirmOpen:ne,prepareSortConfirmation:M,confirmSort:se,cancelSortConfirmation:X,sheets:Q,activeSheetIndex:ke,saveSheet:B,loadSheet:oe,switchSheet:Z,addSheet:re,removeSheet:K,renameSheet:L,dupSheet:J,moveSheet:$,sheetCount:U,mkSheet:Be,emitModelData:ve,scheduleOptEmit:Ee,themeColors:He,outerStyle:ge,toolbarThemeVars:et,wrapperRef:ut,canvasRef:Pe,freezeCanvasRef:N,editInputRef:ie,formulaBarRef:Rt,viewSize:ft,maxScrollX:Ot,maxScrollY:Dl,clampScroll:nl,canFocusHiddenEditor:dl,focusEditInput:ol,onCanvasFocus:Ht,resetRowHeight:vl,resetColWidth:zt,modelData:Le}}function Qr(e){return!!e&&e.width!==void 0&&e.width>0}function Tt(e,n,l,o){const a=Qr(e),i=Qr(n);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return n;const r=e.width??0,d=n.width??0;return r>d?e:d>r?n:e}function ea(e,n){if(!e||typeof e!="object")return null;const l=e,o=l.columns??{},a=Object.keys(o).map(r=>Number(r)).filter(r=>!Number.isNaN(r));if(!l.range||typeof l.range.startRow!="number"){const r=a.length?Math.min(...a):0,d=a.length?Math.max(...a):0;let f=0;for(const y in n){const h=y.indexOf(",");if(h<0)continue;const u=parseInt(y.substring(h+1),10);u>f&&(f=u)}return{range:{startCol:r,startRow:0,endCol:d,endRow:Math.max(0,f)},columns:o}}const i={...l.range};for(const r of a)r<i.startCol&&(i.startCol=r),r>i.endCol&&(i.endCol=r);return{range:i,columns:o}}function H0(e,n,l,o,a){let i=!1,r=null,d=1,f=()=>{},y=()=>{},h=()=>{};function u(){i||(i=!0,requestAnimationFrame(()=>{i=!1,Y(),ne()}))}e.scheduleRender=u;function E(s){const{frozenColumnsWidth:m}=e.getFrozenMetrics(),C=m>0&&s<52+m?s-52:s-52+e.scrollX.value;return e.hitCol(C)}function x(s){const{frozenRowsHeight:m}=e.getFrozenMetrics(),C=m>0&&s<24+m?s-24:s-24+e.scrollY.value;return e.hitRow(C)}const k="#444",H=14;function Y(){const s=o.wrapperRef.value,m=o.canvasRef.value;if(!s||!m||(r=m.getContext("2d"),!r))return;d=window.devicePixelRatio||1;const C=s.getBoundingClientRect(),T=C.width,R=C.height;o.viewSize.w=T,o.viewSize.h=R,m.width=T*d,m.height=R*d,m.style.width=T+"px",m.style.height=R+"px",r.setTransform(d,0,0,d,0,0);const A=e.scrollX.value,_=e.scrollY.value,D=52,z=24,ae=o.themeColors.value,Me=e.getFilter(),Qe=e.colPositions.value,nt=e.rowPositions.value,dt=e.colWidths.value,{frozenRowsHeight:vt,frozenColumnsWidth:Nt}=e.getFrozenMetrics(),Ut=D+Nt,At=z+vt,el=Math.max(0,T-D-11-Nt),pl=Math.max(0,R-z-11-vt),ql=Math.max(0,e.freeze.cols-1),cn=Math.max(0,e.freeze.rows-1),Yl=Math.max(e.freeze.cols,e.hitCol(Nt+A));let dn=Yl;for(let P=Yl;P<e.colCount&&!(D+Qe[P]-A>=T);P++)dn=P;const hl=Math.max(e.freeze.rows,e.hitRow(vt+_));let _l=hl;for(let P=hl;P<e.rowCount&&!(z+nt[P]-_>=R);P++)_l=P;let qt=Yl,Yt=dn,tl=hl,Ll=_l;Nt>0&&(qt=0,Yt=Math.max(Yt,ql)),vt>0&&(tl=0,Ll=Math.max(Ll,cn));let Ol=qt,Xl=tl;for(const P in e.merges){const Ae=e.merges[P];Ae&&(Ae.startRow>Ll||Ae.endRow<tl||Ae.startCol>Yt||Ae.endCol<qt||(Ae.startCol<Ol&&(Ol=Ae.startCol),Ae.startRow<Xl&&(Xl=Ae.startRow)))}const $l=new Array(Xl);for(let P=Xl;P<=Ll;P++)$l[P]=nt[P+1]-nt[P];r.fillStyle=ae.bg,r.fillRect(0,0,T,R),r.fillStyle=ae.gridBg,r.fillRect(D,z,T-D,R-z);const yt=e.selection.value,Cn=e.editingCell.value;f=(P,Ae,Ke,bt,_t,Bt)=>{const ht=e.dataValidations.length>0;for(let De=bt;De<=_t;De++)for(let Ye=Ae;Ye<=Ke;Ye++){if(e.findMerge(Ye,De))continue;const tt=e.cellToScreenRect(De,Ye),Xe=tt.x,rt=tt.y,Ge=tt.width,at=tt.height;if(Xe+Ge<D||rt+at<z||Xe>T||rt>R)continue;const Ct=e.findHighlight?e.findHighlight(Ye,De):null,Et=e.resolveStyle(e.cells[e.cellKey(Ye,De)]),ot=typeof(Et==null?void 0:Et.backgroundColor)=="string"?Et.backgroundColor:"";ot&&(P.fillStyle=ot,P.fillRect(Xe,rt,Ge,at));const ue=e.resolveConditionalFormat(Ye,De);if(ue!=null&&ue.backgroundColor&&(P.fillStyle=ue.backgroundColor,P.fillRect(Xe,rt,Ge,at)),Ct&&(P.fillStyle=Ct==="active"?ae.findActiveBg:ae.findMatchBg,P.fillRect(Xe,rt,Ge,at)),e.isSelected(Ye,De)&&(P.fillStyle=ae.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?P.fillRect(Xe,rt,dt[Ye],Bt[De]):P.fillRect(Xe,rt,Ge,at)),e.activeCell.value.col===Ye&&e.activeCell.value.row===De&&(P.strokeStyle=ae.activeCellBorder,P.lineWidth=2,P.strokeRect(Xe+1,rt+1,Ge-2,at-2)),Ct==="active"&&(P.strokeStyle=ae.findActiveBg,P.lineWidth=2,P.strokeRect(Xe+1,rt+1,Ge-2,at-2)),P.strokeStyle=ae.gridLine,P.lineWidth=.5,P.strokeRect(Xe+.25,rt+.25,Ge-.5,at-.5),!(Cn&&Cn.col===Ye&&Cn.row===De)){const ye=e.resolveStyle(e.cells[e.cellKey(Ye,De)]),Oe=e.getCellValue(Ye,De),it=typeof(ye==null?void 0:ye.numberFormat)=="string"?ye.numberFormat:"",wt=Oe?yl(Oe,it,e.locale.value):"";if(wt){const Lt=e.cellFontSize(Ye,De),Kt=typeof(ye==null?void 0:ye.fontFamily)=="string"&&ye.fontFamily?ye.fontFamily:pn,jl=(ye==null?void 0:ye.fontWeight)==="bold"||(ue==null?void 0:ue.fontWeight)==="bold"?"bold":"normal",Sl=(ye==null?void 0:ye.fontStyle)==="italic"||(ue==null?void 0:ue.fontStyle)==="italic"?"italic":"normal",un=(ye==null?void 0:ye.underline)==="underline"||(ue==null?void 0:ue.underline)==="underline",wn=(ye==null?void 0:ye.strikethrough)==="line-through"||(ue==null?void 0:ue.strikethrough)==="line-through",Ml=(ue==null?void 0:ue.color)||(typeof(ye==null?void 0:ye.color)=="string"?ye.color:""),fn=typeof(ye==null?void 0:ye.textAlign)=="string"?ye.textAlign:ko(Oe,it)?"right":"left",Zl=typeof(ye==null?void 0:ye.verticalAlign)=="string"?ye.verticalAlign:"top";P.fillStyle=Ml||ae.cellText,P.font=`${Sl} ${jl} ${Lt}px ${Kt}`,P.textBaseline="alphabetic",P.save(),P.beginPath(),P.rect(Xe+5,rt+1,Ge-10,at-2),P.clip();const bl=(ye==null?void 0:ye.wrap)==="wrap";let al=Ge-10;Me&&De===Me.range.startRow&&Ye>=Me.range.startCol&&Ye<=Me.range.endCol&&(al=Ge-10-L);let Xt=wt;const Hl=!bl&&ir(it),Bl=wt===Gn||sr(Oe,it);if(Bl||Hl){if(Bl){const kn=Math.max(1,P.measureText("#").width),Kn=Math.max(1,Math.floor(al/kn));Xt="#".repeat(Kn)}else if(e.getWrappedLines(P,wt,1e9,!1).some(Jl=>Jl&&P.measureText(Jl).width>al)){const Jl=Math.max(1,P.measureText("#").width),Vn=Math.max(1,Math.floor(al/Jl));Xt="#".repeat(Vn)}}const vn=e.getWrappedLines(P,Xt,al,bl),{ascent:ho,descent:go}=e.measureFontMetrics(Kt,Lt,jl,Sl),bo=ho+go,d1=vn.length*bo;let yo;Zl==="middle"?yo=rt+(at-d1)/2+ho:Zl==="bottom"?yo=rt+at-e.BASE_CELL_VPAD-go-(vn.length-1)*bo:yo=rt+e.BASE_CELL_VPAD+ho;for(let kn=0;kn<vn.length;kn++){const Kn=vn[kn],Jl=yo+kn*bo,Vn=P.measureText(Kn);let mn;if(fn==="center"?mn=Xe+Ge/2-Vn.width/2:fn==="right"?mn=Xe+Ge-5-Vn.width:mn=Xe+5,P.fillText(Kn,mn,Jl),un&&(P.strokeStyle=Ml||ae.cellText,P.lineWidth=1,P.beginPath(),P.moveTo(mn,Jl+go+1),P.lineTo(mn+Vn.width,Jl+go+1),P.stroke()),wn){P.strokeStyle=Ml||ae.cellText,P.lineWidth=1;const na=Jl-ho+bo*.42;P.beginPath(),P.moveTo(mn,na),P.lineTo(mn+Vn.width,na),P.stroke()}}P.restore()}}if(Me&&De===Me.range.startRow&&Ye>=Me.range.startCol&&Ye<=Me.range.endCol&&ge(P,Xe,rt,Ge,at,Mr(Me.columns[Ye]),ae),ht&&e.getListValidation(De,Ye)){const ye=e.activeCell.value.col===Ye&&e.activeCell.value.row===De;Le(P,Xe,rt,Ge,at,ye||e.isSelected(Ye,De),ae)}}};const Je=(P,Ae,Ke)=>{const bt=e.findMerge(P,Ae);return bt?e.getCellBorderSide(e.cells[bt.anchor],Ke):e.getCellBorderSide(e.cells[e.cellKey(P,Ae)],Ke)};y=(P,Ae,Ke,bt,_t,Bt)=>{P.fillStyle=k;for(let ht=bt;ht<=_t;ht++)for(let De=Ae;De<=Ke;De++){if(e.findMerge(De,ht))continue;const st=e.cellToScreenRect(ht,De),tt=st.x,Xe=st.y,rt=st.width,Ge=st.height;if(tt+rt<D||Xe+Ge<z||tt>T||Xe>R)continue;const at=e.cells[e.cellKey(De,ht)],Ct={top:e.getCellBorderSide(at,"top"),right:e.getCellBorderSide(at,"right"),bottom:e.getCellBorderSide(at,"bottom"),left:e.getCellBorderSide(at,"left")},Et={top:Je(De,ht-1,"bottom"),left:Je(De-1,ht,"right"),bottom:Je(De,ht+1,"top"),right:Je(De+1,ht,"left")},ot=Tt(Et.top,Ct.top),ue=Tt(Et.left,Ct.left),ye=Tt(Ct.bottom,Et.bottom),Oe=Tt(Ct.right,Et.right),it=(ot==null?void 0:ot.width)??0,wt=(ue==null?void 0:ue.width)??0,Lt=(ye==null?void 0:ye.width)??0,Kt=(Oe==null?void 0:Oe.width)??0;it>0&&(P.fillStyle=(ot==null?void 0:ot.color)||k,P.fillRect(tt,Xe,rt,it)),Lt>0&&(P.fillStyle=(ye==null?void 0:ye.color)||k,P.fillRect(tt,Xe+Ge-Lt,rt,Lt)),wt>0&&(P.fillStyle=(ue==null?void 0:ue.color)||k,P.fillRect(tt,Xe,wt,Ge)),Kt>0&&(P.fillStyle=(Oe==null?void 0:Oe.color)||k,P.fillRect(tt+rt-Kt,Xe,Kt,Ge)),it>0&&wt>0&&(P.fillStyle=(ot==null?void 0:ot.color)||(ue==null?void 0:ue.color)||k,P.fillRect(tt-wt,Xe-it,wt,it)),it>0&&Kt>0&&(P.fillStyle=(ot==null?void 0:ot.color)||(Oe==null?void 0:Oe.color)||k,P.fillRect(tt+rt,Xe-it,Kt,it)),Lt>0&&wt>0&&(P.fillStyle=(ye==null?void 0:ye.color)||(ue==null?void 0:ue.color)||k,P.fillRect(tt-wt,Xe+Ge,wt,Lt)),Lt>0&&Kt>0&&(P.fillStyle=(ye==null?void 0:ye.color)||(Oe==null?void 0:Oe.color)||k,P.fillRect(tt+rt,Xe+Ge,Kt,Lt))}};const xt=(P,Ae,Ke,bt,_t,Bt,ht)=>{const De=e.resolveStyle(e.cells[e.cellKey(Ae,Ke)]),Ye=e.getCellValue(Ae,Ke),st=typeof(De==null?void 0:De.numberFormat)=="string"?De.numberFormat:"",tt=Ye?yl(Ye,st,e.locale.value):"";if(!tt)return;const Xe=e.cellFontSize(Ae,Ke),rt=typeof(De==null?void 0:De.fontFamily)=="string"&&De.fontFamily?De.fontFamily:pn,Ge=e.resolveConditionalFormat(Ae,Ke),at=(De==null?void 0:De.fontWeight)==="bold"||(Ge==null?void 0:Ge.fontWeight)==="bold"?"bold":"normal",Ct=(De==null?void 0:De.fontStyle)==="italic"||(Ge==null?void 0:Ge.fontStyle)==="italic"?"italic":"normal",Et=(De==null?void 0:De.underline)==="underline"||(Ge==null?void 0:Ge.underline)==="underline",ot=(De==null?void 0:De.strikethrough)==="line-through"||(Ge==null?void 0:Ge.strikethrough)==="line-through",ue=(Ge==null?void 0:Ge.color)||(typeof(De==null?void 0:De.color)=="string"?De.color:""),ye=typeof(De==null?void 0:De.textAlign)=="string"?De.textAlign:ko(Ye,st)?"right":"left",Oe=typeof(De==null?void 0:De.verticalAlign)=="string"?De.verticalAlign:"top";P.fillStyle=ue||ae.cellText,P.font=`${Ct} ${at} ${Xe}px ${rt}`,P.textBaseline="alphabetic",P.save(),P.beginPath(),P.rect(Bt+5,ht+1,bt-10,_t-2),P.clip();const it=(De==null?void 0:De.wrap)==="wrap",wt=bt-10;let Lt=tt;const Kt=!it&&ir(st),jl=tt===Gn||sr(Ye,st);if(jl||Kt){if(jl){const bl=Math.max(1,P.measureText("#").width),al=Math.max(1,Math.floor(wt/bl));Lt="#".repeat(al)}else if(e.getWrappedLines(P,tt,1e9,!1).some(Xt=>Xt&&P.measureText(Xt).width>wt)){const Xt=Math.max(1,P.measureText("#").width),Hl=Math.max(1,Math.floor(wt/Xt));Lt="#".repeat(Hl)}}const Sl=e.getWrappedLines(P,Lt,wt,it),{ascent:un,descent:wn}=e.measureFontMetrics(rt,Xe,at,Ct),Ml=un+wn,fn=Sl.length*Ml;let Zl;Oe==="middle"?Zl=ht+(_t-fn)/2+un:Oe==="bottom"?Zl=ht+_t-e.BASE_CELL_VPAD-wn-(Sl.length-1)*Ml:Zl=ht+e.BASE_CELL_VPAD+un;for(let bl=0;bl<Sl.length;bl++){const al=Sl[bl],Xt=Zl+bl*Ml,Hl=P.measureText(al);let Bl;if(ye==="center"?Bl=Bt+bt/2-Hl.width/2:ye==="right"?Bl=Bt+bt-5-Hl.width:Bl=Bt+5,P.fillText(al,Bl,Xt),Et&&(P.strokeStyle=ue||ae.cellText,P.lineWidth=1,P.beginPath(),P.moveTo(Bl,Xt+wn+1),P.lineTo(Bl+Hl.width,Xt+wn+1),P.stroke()),ot){P.strokeStyle=ue||ae.cellText,P.lineWidth=1;const vn=Xt-un+Ml*.42;P.beginPath(),P.moveTo(Bl,vn),P.lineTo(Bl+Hl.width,vn),P.stroke()}}P.restore()},Rl=(P,Ae,Ke,bt,_t,Bt,ht,De)=>{const Ye=Ae.startCol,st=Ae.endCol,tt=Ae.startRow,Xe=Ae.endRow,rt=bt,Ge=Bt,at=ht&&st>=e.freeze.cols,Ct=De&&Xe>=e.freeze.rows,Et=e.cells[e.cellKey(Ye,tt)],ot={top:e.getCellBorderSide(Et,"top"),right:e.getCellBorderSide(Et,"right"),bottom:e.getCellBorderSide(Et,"bottom"),left:e.getCellBorderSide(Et,"left")};P.fillStyle=k;for(let ue=Ye;ue<=st;ue++){if(ht&&ue>=e.freeze.cols||e.isSameMergeInternal(ue,tt-1,ue,tt))continue;const ye=Je(ue,tt-1,"bottom"),Oe=Tt(ye,ot.top);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.cols?D+Qe[ue]:D+Qe[ue]-A;P.fillStyle=Oe.color||k,P.fillRect(it,rt,dt[ue],Oe.width)}}if(!Ct)for(let ue=Ye;ue<=st;ue++){if(ht&&ue>=e.freeze.cols||e.isSameMergeInternal(ue,Xe,ue,Xe+1))continue;const ye=Je(ue,Xe+1,"top"),Oe=Tt(ot.bottom,ye);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.cols?D+Qe[ue]:D+Qe[ue]-A;P.fillStyle=Oe.color||k,P.fillRect(it,rt+Ge-Oe.width,dt[ue],Oe.width)}}for(let ue=tt;ue<=Xe;ue++){if(De&&ue>=e.freeze.rows||e.isSameMergeInternal(Ye-1,ue,Ye,ue))continue;const ye=Je(Ye-1,ue,"right"),Oe=Tt(ye,ot.left);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.rows?z+nt[ue]:z+nt[ue]-_,wt=nt[ue+1]-nt[ue];P.fillStyle=Oe.color||k,P.fillRect(Ke,it,Oe.width,wt)}}if(!at)for(let ue=tt;ue<=Xe;ue++){if(De&&ue>=e.freeze.rows||e.isSameMergeInternal(st,ue,st+1,ue))continue;const ye=Je(st+1,ue,"left"),Oe=Tt(ot.right,ye);if(Oe&&Oe.width&&Oe.width>0){const it=ue<e.freeze.rows?z+nt[ue]:z+nt[ue]-_,wt=nt[ue+1]-nt[ue];P.fillStyle=Oe.color||k,P.fillRect(Ke+_t-Oe.width,it,Oe.width,wt)}}{const ue=e.isSameMergeInternal(Ye,tt-1,Ye,tt)?ot.top:Tt(Je(Ye,tt-1,"bottom"),ot.top),ye=e.isSameMergeInternal(Ye-1,tt,Ye,tt)?ot.left:Tt(Je(Ye-1,tt,"right"),ot.left),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke-it,bt-Oe,it,Oe))}if(!at){const ue=e.isSameMergeInternal(st,tt-1,st,tt)?ot.top:Tt(Je(st,tt-1,"bottom"),ot.top),ye=e.isSameMergeInternal(st,tt,st+1,tt)?ot.right:Tt(ot.right,Je(st+1,tt,"left")),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke+_t,bt-Oe,it,Oe))}if(!Ct){const ue=e.isSameMergeInternal(Ye,Xe,Ye,Xe+1)?ot.bottom:Tt(ot.bottom,Je(Ye,Xe+1,"top")),ye=e.isSameMergeInternal(Ye-1,Xe,Ye,Xe)?ot.left:Tt(Je(Ye-1,Xe,"right"),ot.left),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke-it,bt+Bt,it,Oe))}if(!at&&!Ct){const ue=e.isSameMergeInternal(st,Xe,st,Xe+1)?ot.bottom:Tt(ot.bottom,Je(st,Xe+1,"top")),ye=e.isSameMergeInternal(st,Xe,st+1,Xe)?ot.right:Tt(ot.right,Je(st+1,Xe,"left")),Oe=(ue==null?void 0:ue.width)??0,it=(ye==null?void 0:ye.width)??0;Oe>0&&it>0&&(P.fillStyle=(ue==null?void 0:ue.color)||(ye==null?void 0:ye.color)||k,P.fillRect(Ke+_t,bt+Bt,it,Oe))}};h=(P,Ae,Ke,bt,_t)=>{var st,tt;const Bt=Ae+bt,ht=Ke+_t,De=Ae<Ut,Ye=Ke<At;for(const Xe in e.merges){const rt=e.merges[Xe];if(!rt)continue;const Ge=rt.startCol,at=rt.startRow,Ct=rt.endCol,Et=rt.endRow,ot=e.cellToScreenRect(at,Ge),ue=e.cellToScreenRect(Et,Ct),ye=ot.x,Oe=ot.y,it=ue.x+ue.width-ye,wt=ue.y+ue.height-Oe,Lt=De&&Ct>=e.freeze.cols?Math.min(Bt,Ut):Math.min(ye+it,Bt),Kt=Ye&&Et>=e.freeze.rows?Math.min(ht,At):Math.min(Oe+wt,ht),jl=Math.max(ye,Ae),Sl=Math.max(Oe,Ke);if(Lt<=jl||Kt<=Sl)continue;const un=(st=e.resolveStyle(e.cells[e.cellKey(Ge,at)]))==null?void 0:st.backgroundColor,Ml=((tt=e.resolveConditionalFormat(Ge,at))==null?void 0:tt.backgroundColor)||un;if(Ml&&(P.fillStyle=Ml,P.fillRect(jl,Sl,Lt-jl,Kt-Sl)),P.strokeStyle=ae.gridLine,P.lineWidth=.5,P.strokeRect(ye+.25,Oe+.25,Lt-ye-.5,Kt-Oe-.5),Rl(P,rt,ye,Oe,it,wt,De,Ye),e.getListValidation(at,Ge)){const fn=e.activeCell.value.col===Ge&&e.activeCell.value.row===at;Le(P,ye,Oe,it,wt,fn,ae)}if(!(e.editingCell.value&&e.editingCell.value.col===Ge&&e.editingCell.value.row===at)){const fn=Qe[Ct+1]-Qe[Ge],Zl=nt[Et+1]-nt[at],bl=Ge<e.freeze.cols,al=at<e.freeze.rows,Xt=De?ye:bl?ye-A:ye,Hl=Ye?Oe:al?Oe-_:Oe;xt(P,Ge,at,fn,Zl,Xt,Hl)}}},r.save(),r.beginPath(),r.rect(Ut,At,el,pl),r.clip(),f(r,Ol,Yt,Xl,Ll,$l),y(r,Ol,Yt,Xl,Ll,$l),h(r,Ut,At,el,pl),r.restore(),Nt>0&&(r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Ut+.5,z),r.lineTo(Ut+.5,R),r.stroke()),vt>0&&(r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(D,At+.5),r.lineTo(T,At+.5),r.stroke()),r.fillStyle=ae.headerBg,r.fillRect(D,0,T-D,z);for(let P=Yl;P<=dn;P++){const Ae=D+Qe[P]-A,Ke=dt[P];Ae+Ke<D||Ae>T||(yt&&P>=yt.startCol&&P<=yt.endCol&&(r.fillStyle=ae.selectionBg,r.fillRect(Ae,0,Ke,z)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,.25,Ke-.5,z-.5),yt&&P>=yt.startCol&&P<=yt.endCol&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,z-1),r.lineTo(Ae+Ke,z-1),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(lt(P),Ae+Ke/2,z/2))}if(Nt>0){r.fillStyle=ae.headerBg,r.fillRect(D,0,Nt,z);for(let P=0;P<=ql;P++){const Ae=D+Qe[P],Ke=dt[P];Ae+Ke<D||Ae>T||(yt&&P>=yt.startCol&&P<=yt.endCol&&(r.fillStyle=ae.selectionBg,r.fillRect(Ae,0,Ke,z)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,.25,Ke-.5,z-.5),yt&&P>=yt.startCol&&P<=yt.endCol&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,z-1),r.lineTo(Ae+Ke,z-1),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(lt(P),Ae+Ke/2,z/2))}}r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(D,z+.5),r.lineTo(T,z+.5),r.stroke(),r.fillStyle=ae.headerBg,r.fillRect(0,z,D,R-z);for(let P=hl;P<=_l;P++){if(e.isRowHidden(P))continue;const Ae=z+nt[P]-_,Ke=$l[P];Ae+Ke<z||Ae>R||(yt&&P>=yt.startRow&&P<=yt.endRow&&(r.fillStyle=ae.selectionBg,r.fillRect(0,Ae,D,Ke)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ae+.25,D-.5,Ke-.5),yt&&P>=yt.startRow&&P<=yt.endRow&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(D-1,Ae),r.lineTo(D-1,Ae+Ke),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(P+1),D/2,Ae+Ke/2+.5))}if(vt>0){r.fillStyle=ae.headerBg,r.fillRect(0,z,D,vt);for(let P=0;P<=cn;P++){if(e.isRowHidden(P))continue;const Ae=z+nt[P],Ke=$l[P];Ae+Ke<z||Ae>R||(yt&&P>=yt.startRow&&P<=yt.endRow&&(r.fillStyle=ae.selectionBg,r.fillRect(0,Ae,D,Ke)),r.strokeStyle=ae.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ae+.25,D-.5,Ke-.5),yt&&P>=yt.startRow&&P<=yt.endRow&&(r.strokeStyle=ae.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(D-1,Ae),r.lineTo(D-1,Ae+Ke),r.stroke()),r.fillStyle=ae.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(P+1),D/2,Ae+Ke/2+.5))}}r.strokeStyle=ae.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(D+.5,z),r.lineTo(D+.5,R),r.stroke(),r.fillStyle=ae.headerBg,r.fillRect(0,0,D,z),r.strokeStyle=ae.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,D-1,z-1);const gl=Math.min(D,z)*.32;r.fillStyle=ae.activeCellBorder,r.beginPath(),r.moveTo(D-1,z-1-gl),r.lineTo(D-1-gl,z-1),r.lineTo(D-1,z-1),r.closePath(),r.fill(),ee(r,ae),M(r,ae)}function ne(){const s=o.freezeCanvasRef.value,m=o.wrapperRef.value;if(!s||!m)return;const C=s.getContext("2d");if(!C)return;const T=m.getBoundingClientRect(),R=T.width,A=T.height,_=52,D=24,z=o.themeColors.value,ae=e.colPositions.value,Me=e.rowPositions.value,Qe=e.scrollX.value,nt=e.scrollY.value;s.width=R*d,s.height=A*d,s.style.width=R+"px",s.style.height=A+"px",C.setTransform(d,0,0,d,0,0),C.clearRect(0,0,R,A);const{frozenRowsHeight:dt,frozenColumnsWidth:vt}=e.getFrozenMetrics();if(dt<=0&&vt<=0)return;const Nt=_+vt,Ut=D+dt,At=Math.max(0,R-_-11-vt),el=Math.max(0,A-D-11-dt),pl=Math.max(0,e.freeze.cols-1),ql=Math.max(0,e.freeze.rows-1),cn=Math.max(e.freeze.cols,e.hitCol(vt+Qe));let Yl=cn;for(let Je=cn;Je<e.colCount&&!(_+ae[Je]-Qe>=R);Je++)Yl=Je;const dn=Math.max(e.freeze.rows,e.hitRow(dt+nt));let hl=dn;for(let Je=dn;Je<e.rowCount&&!(D+Me[Je]-nt>=A);Je++)hl=Je;let _l=cn,qt=Yl,Yt=dn,tl=hl;vt>0&&(_l=0,qt=Math.max(qt,pl)),dt>0&&(Yt=0,tl=Math.max(tl,ql));let Ll=_l,Ol=Yt;for(const Je in e.merges){const xt=e.merges[Je];xt&&(xt.startRow>tl||xt.endRow<Yt||xt.startCol>qt||xt.endCol<_l||(xt.startCol<Ll&&(Ll=xt.startCol),xt.startRow<Ol&&(Ol=xt.startRow)))}const Xl=new Array(Ol);for(let Je=Ol;Je<=tl;Je++)Xl[Je]=Me[Je+1]-Me[Je];const $l=(Je,xt,Rl)=>{const gl=e.findMerge(Je,xt);return gl?e.getCellBorderSide(e.cells[gl.anchor],Rl):e.getCellBorderSide(e.cells[e.cellKey(Je,xt)],Rl)},yt=(Je,xt,Rl,gl,P)=>{Je.fillStyle="#444";for(let Ae=gl;Ae<=P;Ae++)for(let Ke=xt;Ke<=Rl;Ke++){const bt=e.findMerge(Ke,Ae);if(bt&&!(Ke===bt.range.startCol&&Ae===bt.range.startRow))continue;const _t=e.cellToScreenRect(Ae,Ke),Bt=_t.x,ht=_t.y,De=_t.width,Ye=_t.height;if(Bt+De<_||ht+Ye<D||Bt>R||ht>A)continue;const st=e.cells[e.cellKey(Ke,Ae)],tt={top:e.getCellBorderSide(st,"top"),right:e.getCellBorderSide(st,"right"),bottom:e.getCellBorderSide(st,"bottom"),left:e.getCellBorderSide(st,"left")};if(bt)continue;const Xe={top:$l(Ke,Ae-1,"bottom"),left:$l(Ke-1,Ae,"right"),bottom:$l(Ke,Ae+1,"top"),right:$l(Ke+1,Ae,"left")},rt=Tt(Xe.top,tt.top),Ge=Tt(Xe.left,tt.left),at=Tt(tt.bottom,Xe.bottom),Ct=Tt(tt.right,Xe.right),Et=(rt==null?void 0:rt.width)??0,ot=(Ge==null?void 0:Ge.width)??0,ue=(at==null?void 0:at.width)??0,ye=(Ct==null?void 0:Ct.width)??0;Et>0&&(Je.fillStyle=(rt==null?void 0:rt.color)||"#444",Je.fillRect(Bt,ht,De,Et)),ue>0&&(Je.fillStyle=(at==null?void 0:at.color)||"#444",Je.fillRect(Bt,ht+Ye-ue,De,ue)),ot>0&&(Je.fillStyle=(Ge==null?void 0:Ge.color)||"#444",Je.fillRect(Bt,ht,ot,Ye)),ye>0&&(Je.fillStyle=(Ct==null?void 0:Ct.color)||"#444",Je.fillRect(Bt+De-ye,ht,ye,Ye))}},Cn=(Je,xt,Rl,gl,P,Ae,Ke,bt)=>{Rl<=0||gl<=0||(C.save(),C.beginPath(),C.rect(Je,xt,Rl,gl),C.clip(),C.fillStyle=z.gridBg,C.fillRect(Je,xt,Rl,gl),f(C,P,Ae,Ke,bt,Xl),yt(C,P,Ae,Ke,bt),h(C,Je,xt,Rl,gl),C.restore())};vt>0&&dt>0&&Cn(_,D,vt,dt,0,pl,0,ql),dt>0&&Cn(Nt,D,At,dt,Ll,qt,0,ql),vt>0&&Cn(_,Ut,vt,el,0,pl,Ol,tl),C.strokeStyle=z.headerSep,C.lineWidth=1,vt>0&&(C.beginPath(),C.moveTo(Nt+.5,D),C.lineTo(Nt+.5,A),C.stroke()),dt>0&&(C.beginPath(),C.moveTo(_,Ut+.5),C.lineTo(R,Ut+.5),C.stroke()),C.fillStyle=z.headerBg,C.fillRect(0,0,_,D),C.strokeStyle=z.headerSep,C.lineWidth=1,C.strokeRect(.5,.5,_-.5,D-.5),ee(C,z),M(C,z)}function ee(s,m){const C=e.selection.value;if(!C||e.editingCell.value)return;const T=e.cellToScreenRect(C.endRow,C.endCol),R=Io(C,C,e.merges),A=T.x+T.width-6/2,_=T.y+T.height-6/2;s.fillStyle=R?m.activeCellBorder:m.scrollTrack,s.fillRect(A,_,6,6),s.strokeStyle="#fff",s.lineWidth=1,s.strokeRect(A+.5,_+.5,6-1,6-1)}function M(s,m){const C=e.autoFillState.value;if(!C.active||!C.preview||!C.targetRange)return;const T=C.targetRange,R=e.cellToScreenRect(T.startRow,T.startCol),A=e.cellToScreenRect(T.endRow,T.endCol),_=R.x,D=R.y,z=A.x+A.width-_,ae=A.y+A.height-D;s.fillStyle=m.selectionBg,s.fillRect(_,D,z,ae),s.strokeStyle=m.activeCellBorder,s.lineWidth=1.5,s.setLineDash([4,3]),s.strokeRect(_+.5,D+.5,z-1,ae-1),s.setLineDash([])}const se=t.computed(()=>lt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),X=t.ref(""),te=t.ref(!1),Ne=t.computed(()=>e.editingCell.value?X.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(s,m)=>{if(s&&!m){const C=e.editValue.value||e.getCellRaw(s.col,s.row)||"";X.value=C,_e=!1}else!s&&m&&(X.value="",te.value=!1,_e=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(X.value="",_e=!1)});function ze(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u())}function Ve(s){const m=s.target.value;e.editingCell.value?e.editValue.value=m:e.startEdit(m),X.value=m,_e=!0}function Fe(s){var C,T;const m={...e.activeCell.value};e.editingCell.value?(e.editValue.value=s,e.commitEdit()):((C=e.saveUndo)==null||C.call(e),e.setCellValue(m.col,m.row,s)),X.value="",_e=!1,u(),(T=o.emitModelData)==null||T.call(o)}let je=!1,_e=!1;function F(){var A,_,D;if(je)return;const s=o.formulaBarRef.value,m=!!(s&&typeof document<"u"&&document.activeElement===s);if(!e.editingCell.value&&!m&&!_e)return;const C={...e.activeCell.value},T=e.editingCell.value?e.editingCell.value.col:C.col,R=e.editingCell.value?e.editingCell.value.row:C.row;if(!e.editingCell.value){const z=e.getCellRaw(T,R),ae=X.value!==z;if(!_e)return;je=!0,ae&&((A=e.saveUndo)==null||A.call(e),e.setCellValue(T,R,X.value),u(),(_=o.emitModelData)==null||_.call(o)),(D=o.formulaBarRef.value)==null||D.blur(),X.value="",te.value=!1,_e=!1,t.nextTick(()=>{je=!1});return}je=!0,_e?(e.editValue.value=X.value,e.commitEdit().then(z=>{var ae,Me;z&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(ae=o.formulaBarRef.value)==null||ae.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),(Me=o.emitModelData)==null||Me.call(o),t.nextTick(()=>{je=!1})})):m?(X.value=e.editValue.value,e.commitEdit().then(z=>{var ae,Me;z&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(ae=o.formulaBarRef.value)==null||ae.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),(Me=o.emitModelData)==null||Me.call(o),t.nextTick(()=>{je=!1})})):e.commitEdit().then(()=>{var z,ae;(z=o.formulaBarRef.value)==null||z.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),(ae=o.emitModelData)==null||ae.call(o),t.nextTick(()=>{je=!1})})}function I(){var s;je||(je=!0,e.editingCell.value&&e.cancelEdit(),(s=o.formulaBarRef.value)==null||s.blur(),X.value="",te.value=!1,_e=!1,u(),o.focusEditInput(),t.nextTick(()=>{je=!1}))}function G(s){if(!s.isComposing){if(s.key==="Enter"&&(s.altKey||s.metaKey)&&!s.ctrlKey){s.preventDefault(),s.stopPropagation();const m=s.target;if(!m)return;e.editingCell.value||e.startEdit();const C=m.selectionStart??m.value.length,T=m.selectionEnd??m.value.length,R=m.value,A=R.substring(0,C)+`
7
- `+R.substring(T),_=C+1;X.value=A,te.value||(te.value=!0),t.nextTick(()=>{try{m.setSelectionRange(_,_)}catch{}if(te.value)try{m.scrollTop=m.scrollHeight}catch{}try{m.focus({preventScroll:!0})}catch{}});return}s.key==="Enter"?(s.preventDefault(),F()):s.key==="Escape"&&(s.preventDefault(),I())}}function Ce(){F()}const $e=t.ref(null),j=t.ref("");function Be(s){$e.value===null&&(o.switchSheet(s),u())}function Q(s){s!==o.activeSheetIndex.value&&(o.saveSheet(),o.loadSheet(s),u()),$e.value=s,j.value=o.sheets.value[s].name,t.nextTick(()=>{const m=document.querySelector(".tab-rename-input");m==null||m.focus(),m==null||m.select()})}function ke(){$e.value!==null&&(o.renameSheet($e.value,j.value),t.nextTick(()=>o.emitModelData())),$e.value=null,j.value=""}function B(){$e.value=null,j.value=""}function oe(s){s.key==="Enter"?(s.preventDefault(),ke()):s.key==="Escape"&&(s.preventDefault(),B())}const Z=t.ref(null);t.watch(Z,s=>{s===null&&Rt()});const re=t.ref(null),K=t.ref(null),L=18,J=2,$=2,U=new Path2D("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");function de(s,m,C,T,R,A){const _=Math.min(A,T/2,R/2);s.beginPath(),s.moveTo(m+_,C),s.arcTo(m+T,C,m+T,C+R,_),s.arcTo(m+T,C+R,m,C+R,_),s.arcTo(m,C+R,m,C,_),s.arcTo(m,C,m+T,C,_),s.closePath()}function Le(s,m,C,T,R,A,_){if(T<H+4||R<10)return;const D=m+T-H,z=C+1,ae=R-2;s.save(),A&&(s.fillStyle=_.selectionBg,s.fillRect(D,z,H,ae)),s.fillStyle=_.activeCellBorder;const Me=6,Qe=4,nt=D+H/2,dt=z+ae/2;s.beginPath(),s.moveTo(nt-Me/2,dt-Qe/2+.5),s.lineTo(nt+Me/2,dt-Qe/2+.5),s.lineTo(nt,dt+Qe/2+.5),s.closePath(),s.fill(),s.restore()}function ve(s,m){if(e.dataValidations.length===0)return null;const C=e.screenToCell(s,m);if(!C)return null;const T=e.findMerge(C.col,C.row),R=T?T.range.startCol:C.col,A=T?T.range.startRow:C.row;if(!e.getListValidation(A,R))return null;const _=e.cellToScreenRect(A,R);if(_.width<H+4)return null;const D=_.x+_.width-H;return s<D||s>_.x+_.width||m<_.y||m>_.y+_.height?null:{col:R,row:A}}function Ie(s,m){const C=e.getValidationDropdown(m,s);if(!C)return!1;const T=o.canvasRef.value;if(!T)return!1;e.activeCell.value.col===s&&e.activeCell.value.row===m||e.selectCell(s,m),e.ensureVisible(s,m),u();const R=e.cellToScreenRect(m,s),A=T.getBoundingClientRect();return K.value={col:s,row:m,rule:C.rule,items:C.items,current:e.getCellRaw(s,m),x:A.left+R.x,y:A.top+R.y,width:R.width,height:R.height},!0}function Ee(){K.value&&(K.value=null,u())}async function He(s){var A;const m=K.value;if(!m)return;const{col:C,row:T}=m;K.value=null;const R=e.validateCell(T,C,s);if(!R.valid&&await e.confirmInvalidValue(R,C,T)!=="continue"){u(),o.focusEditInput();return}n.saveUndo(),e.setCellValue(C,T,s),(A=e.emitModelData)==null||A.call(e),u(),o.focusEditInput()}function ge(s,m,C,T,R,A,_){const D=Math.min(T,L)-J,z=m+T-D-J,ae=C+J,Me=R-2*J;s.save(),s.fillStyle=A?_.activeCellBorder:"#ececec",de(s,z,ae,D,Me,$),s.fill();const Qe=Math.min(D,Me)*.72;s.translate(z+D/2,ae+Me/2),s.scale(Qe/1024,Qe/1024),s.translate(-512,-512),s.fillStyle=A?"#ffffff":"#5a5a5a",s.fill(U),s.restore()}function et(s,m){const C=e.getFilter();if(!C)return-1;const T=e.screenToCell(s,m);if(!T)return-1;const{col:R,row:A}=T;if(A!==C.range.startRow||R<C.range.startCol||R>C.range.endCol)return-1;const _=e.cellToScreenRect(A,R),D=Math.min(_.width,L)-J,z=_.x+_.width-D-J,ae=_.x+_.width-J;return s>=z&&s<=ae&&m>=_.y+J&&m<=_.y+_.height-J?R:-1}function ut(s){const m=e.getFilter();if(!m)return;const C=o.canvasRef.value;if(!C)return;const T=C.getBoundingClientRect(),R=e.cellToScreenRect(m.range.startRow,s);re.value={col:s,x:T.left+R.x+R.width-L,y:T.top+R.y+2}}function Pe(){re.value=null}let N=null,ie=null;function Rt(){N&&(document.removeEventListener("click",N),N=null),ie&&(document.removeEventListener("touchstart",ie,{capture:!0}),ie=null)}function ft(s,m,C){Rt();const T=140,R=C.length*28+8,A=window.innerWidth,_=window.innerHeight;s+T>A&&(s-=T),m+R>_&&(m-=R),Mt.value=!1,Z.value={x:s,y:m,items:C},t.nextTick(()=>It()),N=()=>{Z.value=null,Rt()},ie=D=>{const z=D.target;z&&z.closest(".context-menu")||(Z.value=null,Rt())},setTimeout(()=>{document.addEventListener("click",N,{once:!0}),document.addEventListener("touchstart",ie,{capture:!0})},0)}const Mt=t.ref(!1);function Ft(s,m){}function It(){const m=document.querySelector(".context-menu"),C=Z.value,T=o.wrapperRef.value;if(!m||!C||!T){Mt.value=!1;return}const R=C.x+140,A=T.getBoundingClientRect(),_=m.style.transform;m.style.transform="none";let D=0;if(m.querySelectorAll(".context-menu__item").forEach(ae=>{const Me=ae.querySelector(":scope > .context-submenu");if(!Me)return;const Qe=Me.style.display;Me.style.display="block";const nt=Me.getBoundingClientRect().width;Me.style.display=Qe,nt>D&&(D=nt)}),m.style.transform=_,D===0){Mt.value=!0;return}const z=A.right-R;Mt.value=z<D+8}function Ot(s,m){s.preventDefault(),s.stopPropagation(),ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.addSheet(),u()}},{label:b(e.locale.value,"copy"),action:()=>{o.dupSheet(m)}},{label:b(e.locale.value,"rename"),action:()=>{Q(m)}},{label:b(e.locale.value,"delete"),action:()=>{o.removeSheet(m),u()},disabled:o.sheetCount.value<=1},{label:b(e.locale.value,"moveSheetLeft"),action:()=>{o.moveSheet(m,-1)},disabled:m===0},{label:b(e.locale.value,"moveSheetRight"),action:()=>{o.moveSheet(m,1)},disabled:m===o.sheets.value.length-1}])}function Dl(s){s.preventDefault(),!(s.target.closest(".tab-item")||s.target.closest(".tab-bar__add-btn"))&&ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.addSheet(),u()}}])}function nl(s){s.preventDefault(),e.selectAll(),u(),ft(s.clientX,s.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.clearSelected();for(let m=0;m<e.colCount;m++)e.colWidths.value[m]=100;for(let m=0;m<e.rowCount;m++)e.rowHeights.value[m]=void 0;u(),o.emitModelData()}}])}function dl(s,m){s.preventDefault();const C=s.clientX,T=s.clientY,R=e.selection.value;R&&R.startCol===0&&R.endCol===e.colCount-1&&m>=R.startRow&&m<=R.endRow||(e.selectRange(0,m,e.colCount-1,m,"row"),u());const A=e.selection.value;ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.saveUndo(),o.insertRows(A.startRow,A.endRow),u(),o.emitModelData()}},{label:b(e.locale.value,"cut"),action:()=>{n.saveUndo(),l.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,A.startRow,A.endRow),u(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.deleteRows(A.startRow,A.endRow),u(),o.emitModelData()}},{label:`${b(e.locale.value,"rowHeight")}...`,action:()=>w("row",C,T)},{label:b(e.locale.value,"autoRowHeight"),action:()=>o.resetRowHeight()},{label:b(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(m+1,e.freeze.cols),u()}}])}function ol(s,m){s.preventDefault();const C=s.clientX,T=s.clientY,R=e.selection.value;R&&R.startRow===0&&R.endRow===e.rowCount-1&&m>=R.startCol&&m<=R.endCol||(e.selectRange(m,0,m,e.rowCount-1,"col"),u());const A=e.selection.value,_=!o.canSortColumns(A.startCol,A.endCol);ft(s.clientX,s.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.saveUndo(),o.insertCols(A.startCol,A.endCol),u(),o.emitModelData()}},{label:b(e.locale.value,"cut"),action:()=>{n.saveUndo(),l.copyRowCol(),e.clearCellsInRange(A.startCol,A.endCol,0,e.rowCount-1),u(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.deleteCols(A.startCol,A.endCol),u(),o.emitModelData()}},{label:b(e.locale.value,"sort"),disabled:_,children:[{label:b(e.locale.value,"sortAsc"),action:()=>{o.prepareSortConfirmation("asc")||o.sortSelectedColumns("asc")},disabled:_},{label:b(e.locale.value,"sortDesc"),action:()=>{o.prepareSortConfirmation("desc")||o.sortSelectedColumns("desc")},disabled:_}]},{label:`${b(e.locale.value,"colWidth")}...`,action:()=>w("col",C,T)},{label:b(e.locale.value,"defaultColWidth"),action:()=>o.resetColWidth()},{label:b(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,m+1),u()}}])}function Ht(s,m,C){s.preventDefault(),e.isSelected(m,C)||(e.selectCell(m,C),u());const T=e.selection.value,R=!!(T&&T.startCol===T.endCol&&T.startRow===T.endRow);ft(s.clientX,s.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.clearSelected(),u(),o.emitModelData()}},{label:b(e.locale.value,"calculate"),children:[{label:b(e.locale.value,"sum"),action:l.sumSelected,disabled:R},{label:b(e.locale.value,"avg"),action:l.avgSelected,disabled:R},{label:b(e.locale.value,"count"),action:l.countSelected,disabled:R}]},{label:`${b(e.locale.value,"dv")}...`,action:()=>{var A;return(A=e.requestDataValidationDialog)==null?void 0:A.call(e)}},{label:b(e.locale.value,"dvClearValidation"),action:()=>{n.saveUndo(),e.clearDataValidation(e.selection.value),u(),o.emitModelData()}}])}const vl=t.ref(null),zt=t.ref(null);let W=null,g=null;function c(){W&&(document.removeEventListener("mousedown",W),W=null),g&&(document.removeEventListener("touchstart",g),g=null)}function w(s,m,C){c();const T=e.selection.value;let R="";if(T){const ae=s==="row"?e.getRowHeight(T.startRow):e.colWidths.value[T.startCol];R=ae!=null&&ae>0?String(Math.round(ae)):""}const A=220,_=118;let D=m,z=C;D+A>window.innerWidth&&(D=window.innerWidth-A-8),z+_>window.innerHeight&&(z=window.innerHeight-_-8),D<8&&(D=8),z<8&&(z=8),zt.value={type:s,x:D,y:z,value:R,error:""},W=()=>{zt.value=null},g=()=>{zt.value=null},setTimeout(()=>{document.addEventListener("mousedown",W,{once:!0}),document.addEventListener("touchstart",g,{once:!0})},0),t.nextTick(()=>{const ae=vl.value;ae&&(ae.focus(),ae.select())})}function be(s){const m=zt.value;if(!m)return;const C=s.target,T=C.value,R=T.replace(/[^\d]/g,"");m.value=R,T!==R&&(C.value=R),m.error=""}function he(s){s.key==="Enter"?(s.preventDefault(),we()):s.key==="Escape"&&(s.preventDefault(),ce())}function xe(){const s=zt.value;if(!s)return;const m=s.value.trim(),C=Number(m),T=s.type==="row",R=T?24:30,A=T?500:1e3;if(m===""||!Number.isFinite(C)){ce();return}const _=Math.max(R,Math.min(A,Math.round(C)));s.value=String(_),s.error=""}function we(){const s=zt.value,m=e.selection.value;if(!s||!m)return;const C=s.value.trim(),T=Number(C),R=s.type==="row",A=R?24:30,_=R?500:1e3;if(C===""||!Number.isFinite(T)){s.error=b(e.locale.value,"dimNumberError");return}if(T<A||T>_){s.error=b(e.locale.value,"dimRangeError").replace("{min}",String(A)).replace("{max}",String(_));return}const D=T;if(n.saveUndo(),R)for(let z=m.startRow;z<=m.endRow;z++)e.rowHeights.value[z]=D;else for(let z=m.startCol;z<=m.endCol;z++)e.colWidths.value[z]=D;u(),o.emitModelData(),ce()}function ce(){c(),zt.value=null}const Ue=t.computed(()=>{const s=!e.editingCell.value,m=e.editingCell.value??e.activeCell.value,C=m.col,T=m.row,R=e.resolveStyle(e.cells[e.cellKey(C,T)]),A=e.cellFontSize(C,T),_=typeof(R==null?void 0:R.fontFamily)=="string"&&R.fontFamily?R.fontFamily:pn,D=(R==null?void 0:R.fontWeight)==="bold"?"bold":"normal",z=(R==null?void 0:R.fontStyle)==="italic"?"italic":"normal",ae=(R==null?void 0:R.underline)==="underline"?"underline":(R==null?void 0:R.strikethrough)==="line-through"?"line-through":"none",Me=(R==null?void 0:R.underline)==="underline"&&(R==null?void 0:R.strikethrough)==="line-through"?"underline line-through":ae,Qe=typeof(R==null?void 0:R.color)=="string"?R.color:void 0,nt=typeof(R==null?void 0:R.backgroundColor)=="string"?R.backgroundColor:void 0,dt=typeof(R==null?void 0:R.numberFormat)=="string"?R.numberFormat:"",vt=e.editValue.value??e.getCellValue(C,T),Nt=typeof(R==null?void 0:R.textAlign)=="string"?R.textAlign:ko(vt,dt)?"right":"left",Ut=typeof(R==null?void 0:R.verticalAlign)=="string"?R.verticalAlign:"top",At=e.findMerge(C,T),el=At?e.rowPositions.value[At.range.endRow+1]-e.rowPositions.value[T]:e.getRowHeight(T),pl=2,{ascent:ql,descent:cn}=e.measureFontMetrics(_,A,D,z),Yl=ql+cn,hl=(e.editValue.value?e.editValue.value.split(`
8
- `).length:1)*Yl,_l=e.BASE_CELL_VPAD-pl;let qt=0,Yt=0;Ut==="middle"?(qt=Math.floor((el-hl)/2),Yt=Math.max(0,el-hl-qt)):Ut==="top"?(qt=_l,Yt=Math.max(0,el-hl-qt)):Ut==="bottom"&&(Yt=_l,qt=Math.max(0,el-hl-Yt));const tl=e.cellToScreenRect(T,C);return{left:`${tl.x}px`,top:`${tl.y}px`,width:`${tl.width}px`,height:`${tl.height}px`,fontFamily:_,fontSize:`${A}px`,lineHeight:1,fontWeight:D,fontStyle:z,textDecoration:Me,textAlign:Nt,paddingTop:`${qt}px`,paddingRight:"3px",paddingBottom:`${Yt}px`,paddingLeft:"3px",opacity:s?0:1,pointerEvents:s?"none":"auto",color:s?"transparent":Qe,caretColor:s?"transparent":void 0,borderColor:s?"transparent":void 0,background:s?"transparent":nt,boxShadow:s?"none":void 0}});function Ze(){return Math.max(0,o.viewSize.w-52-11)}function fe(){return Math.max(0,o.viewSize.h-24-11)}const We=t.computed(()=>Math.max(0,Ze()-e.getFrozenMetrics().frozenColumnsWidth)),V=t.computed(()=>Math.max(0,fe()-e.getFrozenMetrics().frozenRowsHeight)),le=t.computed(()=>52+e.getFrozenMetrics().frozenColumnsWidth),me=t.computed(()=>24+e.getFrozenMetrics().frozenRowsHeight),pe=t.computed(()=>Math.max(0,We.value-11*2)),Re=t.computed(()=>Math.max(0,V.value-11*2)),Te=t.computed(()=>o.maxScrollX.value<=0?pe.value:Math.max(24,We.value/e.totalWidth.value*pe.value)),Se=t.computed(()=>o.maxScrollX.value<=0?0:e.scrollX.value/o.maxScrollX.value*(pe.value-Te.value)),qe=t.computed(()=>o.maxScrollY.value<=0?Re.value:Math.max(24,V.value/e.totalHeight.value*Re.value)),mt=t.computed(()=>o.maxScrollY.value<=0?0:e.scrollY.value/o.maxScrollY.value*(Re.value-qe.value));let ct=null,kt=0,jt=0;function kl(s){s.preventDefault(),ct="v",kt=s.clientY,jt=e.scrollY.value,document.addEventListener("mousemove",El),document.addEventListener("mouseup",nn)}function gn(s){s.preventDefault(),ct="h",kt=s.clientX,jt=e.scrollX.value,document.addEventListener("mousemove",El),document.addEventListener("mouseup",nn)}function El(s){if(ct==="v"){const C=(s.clientY-kt)/(Re.value-qe.value);o.clampScroll(null,jt+C*o.maxScrollY.value),u()}else if(ct==="h"){const C=(s.clientX-kt)/(pe.value-Te.value);o.clampScroll(jt+C*o.maxScrollX.value,null),u()}}function nn(){ct=null,document.removeEventListener("mousemove",El),document.removeEventListener("mouseup",nn)}function On(s){if(ct)return;const m=s.currentTarget.getBoundingClientRect(),C=s.clientY-m.top;C<mt.value?o.clampScroll(null,e.scrollY.value-fe()):C>mt.value+qe.value&&o.clampScroll(null,e.scrollY.value+fe()),u()}function Po(s){if(ct)return;const m=s.currentTarget.getBoundingClientRect(),C=s.clientX-m.left;C<Se.value?o.clampScroll(e.scrollX.value-Ze(),null):C>Se.value+Te.value&&o.clampScroll(e.scrollX.value+Ze(),null),u()}let on=!1,Zt=0,Jt=0,Wt=!1,rl=!1,rn=0,an=0,Vl=0,Fl=0,bn=0,yn=0,Bn=0,Tn=0,Gt=!1,$t=!1,gt=0,pt=0,Pt="cell",$n=0,Hn=-1,oo=-1,Qt=null,Il=!1,ul=0,fl=0,Al=!1,ml=null,sn=null,ro=0,ao=0;function zn(s,m){const C=e.selection.value;if(!C||e.editingCell.value||!Io(C,C,e.merges))return!1;const T=e.cellToScreenRect(C.endRow,C.endCol),R=T.x+T.width-6,A=T.y+T.height-6,_=4;return s>=R-_&&s<=R+6+_&&m>=A-_&&m<=A+6+_}function Wn(){ml=requestAnimationFrame(io)}function io(){if(!e.autoFillState.value.active||!sn){ml=null;return}const s=8;o.clampScroll(e.scrollX.value+sn.x*s*.1,e.scrollY.value+sn.y*s*.1);const m=e.screenToCell(ro,ao),C=e.autoFillState.value.sourceRange;if(m&&C){const T=Dr(C,{col:m.col,row:m.row});T?e.autoFillState.value={...e.autoFillState.value,targetRange:T.targetRange,direction:T.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}u(),ml=requestAnimationFrame(io)}function Nn(){ml!==null&&(cancelAnimationFrame(ml),ml=null),sn=null}function so(s,m){ro=s,ao=m;const C=e.screenToCell(s,m),T=e.autoFillState.value.sourceRange;if(C&&T){const ae=Dr(T,{col:C.col,row:C.row});ae?e.autoFillState.value={...e.autoFillState.value,targetRange:ae.targetRange,direction:ae.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const R=30,A=o.viewSize.w,_=o.viewSize.h;let D=0,z=0;s<52+R?D=-(52+R-s):s>A-11-R&&(D=s-(A-11-R)),m<24+R?z=-(24+R-m):m>_-11-R&&(z=m-(_-11-R)),D!==0||z!==0?(sn={x:D,y:z},ml===null&&Wn()):(sn=null,ml!==null&&(cancelAnimationFrame(ml),ml=null)),u()}function co(){Nn();const s=e.autoFillState.value;s.targetRange&&s.direction&&s.sourceRange&&e.applyAutoFill(s.sourceRange,s.targetRange,s.direction),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}}function Uo(s){if(s.button!==0)return;s.preventDefault(),Z.value=null;const m=en(s,o.canvasRef.value),C=ve(m.x,m.y);if(C){if(e.editingCell.value){e.commitEdit().then(D=>{D&&Ie(C.col,C.row)});return}Ie(C.col,C.row);return}const T=et(m.x,m.y);if(T>=0){ut(T);return}if(m.y<24&&m.x>=52){const D=m.x-52+e.scrollX.value,z=E(m.x),ae=z>=0?e.cellToScreenRect(0,z).x+e.colWidths.value[z]:-1;if(z>=0&&Math.abs(m.x-ae)<=4){n.saveUndo(),Wt=!0,rn=z,Vl=e.colWidths.value[z],Fl=D,u();return}}if(m.x<52&&m.y>=24){const D=m.y-24+e.scrollY.value,z=x(m.y),ae=z>=0?e.cellToScreenRect(z,0).y+e.getRowHeight(z):-1;if(z>=0&&Math.abs(m.y-ae)<=4){n.saveUndo(),rl=!0,an=z,Vl=e.getRowHeight(z),Fl=D,u();return}}if(zn(m.x,m.y)){const D=e.selection.value;D&&(e.autoFillState.value={active:!0,sourceRange:{...D},targetRange:null,direction:null,preview:!0},u());return}if(m.x<52||m.y<24){{const D=o.formulaBarRef.value,z=!!(D&&typeof document<"u"&&document.activeElement===D);(e.editingCell.value||z||_e)&&F()}if(m.y<24&&m.x>=52){const D=E(m.x);D>=0&&(e.selectRange(D,0,D,e.rowCount-1,"col"),on=!0,Zt=D,Jt=0)}else if(m.x<52&&m.y>=24){const D=x(m.y);D>=0&&(e.selectRange(0,D,e.colCount-1,D,"row"),on=!0,Zt=0,Jt=D)}else m.x<52&&m.y<24&&e.selectAll();u();return}const R=e.screenToCell(m.x,m.y);if(!R)return;const A=R.col,_=R.row;{const D=o.formulaBarRef.value,z=!!(D&&typeof document<"u"&&document.activeElement===D);(e.editingCell.value||z||_e)&&F()}if(s.shiftKey&&e.selection.value){const D=e.selection.value;e.selectRange(D.startCol,D.startRow,A,_)}else e.selectCell(A,_);on=!0,Zt=A,Jt=_,o.focusEditInput(),u()}function Ko(s){if(Wt){const _=en(s,o.canvasRef.value).x-52+e.scrollX.value-Fl,D=Vl+_;D>=30&&D<=1e3?e.colWidths.value[rn]=D:D<30?e.colWidths.value[rn]=30:e.colWidths.value[rn]=1e3,u();return}if(rl){const _=en(s,o.canvasRef.value).y-24+e.scrollY.value-Fl,D=Vl+_;D>=24&&D<=500?e.rowHeights.value[an]=D:D<24?e.rowHeights.value[an]=24:e.rowHeights.value[an]=500,u();return}if(e.autoFillState.value.active){const A=en(s,o.canvasRef.value);so(A.x,A.y);return}if(!on){const A=o.canvasRef.value;if(!A)return;if(n.paintFmt.value){A.style.cursor="copy";return}const _=en(s,A);if(et(_.x,_.y)>=0){A.style.cursor="pointer";return}if(ve(_.x,_.y)){A.style.cursor="pointer";return}if(_.y<24&&_.x>=52){const D=E(_.x),z=D>=0?e.cellToScreenRect(0,D).x+e.colWidths.value[D]:-1;if(D>=0&&Math.abs(_.x-z)<=4){A.style.cursor="col-resize";return}}if(_.x<52&&_.y>=24){const D=x(_.y),z=D>=0?e.cellToScreenRect(D,0).y+e.getRowHeight(D):-1;if(D>=0&&Math.abs(_.y-z)<=4){A.style.cursor="row-resize";return}}if(zn(_.x,_.y)){A.style.cursor="crosshair";return}A.style.cursor="cell";return}const m=en(s,o.canvasRef.value);if(Zt<0||Jt<0)return;if(m.x<52||m.y<24){if(m.y<24&&m.x>=52){const A=E(m.x);A>=0&&e.selectRange(Math.min(Zt,A),0,Math.max(Zt,A),e.rowCount-1,"col")}else if(m.x<52&&m.y>=24){const A=x(m.y);A>=0&&e.selectRange(0,Math.min(Jt,A),e.colCount-1,Math.max(Jt,A),"row")}u();return}const C=e.screenToCell(m.x,m.y);if(!C)return;const T=C.col,R=C.row;Jt===0&&Zt>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(Zt,T),0,Math.max(Zt,T),e.rowCount-1,"col"):Zt===0&&Jt>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Jt,R),e.colCount-1,Math.max(Jt,R),"row"):e.selectRange(Zt,Jt,T,R),u()}function Go(s){const m=Wt||rl;if(on=!1,Wt=!1,rl=!1,m&&o.scheduleOptEmit(),e.autoFillState.value.active){co();return}n.paintFmt.value&&n.applyPaintFormat()}function uo(){Nn();const s=Wt||rl;on=!1,Wt=!1,rl=!1,s&&o.scheduleOptEmit()}function fo(s){s.preventDefault();const m=en(s,o.canvasRef.value);if(m.x<52&&m.y<24){nl(s);return}if(m.y<24&&m.x>=52){const C=E(m.x);C>=0&&ol(s,C);return}if(m.x<52&&m.y>=24){const C=x(m.y);C>=0&&dl(s,C);return}if(m.x>=52&&m.y>=24){const C=e.screenToCell(m.x,m.y);C&&Ht(s,C.col,C.row)}}function qo(s){const m=en(s,o.canvasRef.value);if(m.x<52||m.y<24)return;const C=e.screenToCell(m.x,m.y);if(!C)return;const T=C.col,R=C.row;{const A=o.formulaBarRef.value,_=!!(A&&typeof document<"u"&&document.activeElement===A);(e.editingCell.value||_||_e)&&F()}e.selectCell(T,R),e.ensureVisible(T,R),e.startEdit(),u(),o.focusEditInput()}function Yo(s){const m=e.scrollX.value+s.deltaX,C=e.scrollY.value+s.deltaY,T=40,R=o.maxScrollX.value,A=o.maxScrollY.value;if(m>=R-T&&s.deltaX>0||C>=A-T&&s.deltaY>0){const _=Math.max(0,o.viewSize.w-28-11),D=Math.max(0,o.viewSize.h-28-11),z=Math.max(0,Math.ceil((m+_)/100)+2),ae=Math.max(0,Math.ceil((C+D)/24)+2);e.ensureCapacity(z,ae)}o.clampScroll(m,C),u()}function Xo(s){if(s.touches.length!==1){Gt=!1;return}const m=s.touches[0],C=o.canvasRef.value;if(!C)return;const T=C.getBoundingClientRect(),R=m.clientX-T.left,A=m.clientY-T.top,_=m.clientX,D=m.clientY,z=(Me,Qe)=>({clientX:Me,clientY:Qe,preventDefault(){}});{const Me=o.formulaBarRef.value,Qe=!!(Me&&typeof document<"u"&&document.activeElement===Me);(e.editingCell.value||Qe||_e)&&F()}if(zn(R,A)){s.preventDefault();const Me=e.selection.value;Me&&(e.autoFillState.value={active:!0,sourceRange:{...Me},targetRange:null,direction:null,preview:!0},Gt=!0,$t=!1,Pt="cell",bn=R,yn=A,Bn=e.scrollX.value,Tn=e.scrollY.value);return}const ae=et(R,A);if(ae>=0){s.preventDefault(),ut(ae);return}if(A<24&&R>=52){const Me=E(R);if(Me>=0){const Qe=e.cellToScreenRect(0,Me).x+e.colWidths.value[Me];if(Math.abs(R-Qe)<=8){s.preventDefault(),n.saveUndo(),Wt=!0,rn=Me,Vl=e.colWidths.value[Me],Fl=R-52+e.scrollX.value,Gt=!0,$t=!1;return}}}if(R<52&&A>=24){const Me=x(A);if(Me>=0){const Qe=e.cellToScreenRect(Me,0).y+e.getRowHeight(Me);if(Math.abs(A-Qe)<=8){s.preventDefault(),n.saveUndo(),rl=!0,an=Me,Vl=e.getRowHeight(Me),Fl=A-24+e.scrollY.value,Gt=!0,$t=!1;return}}}R>=52&&A>=24?(s.preventDefault(),Gt=!0,$t=!1,Il=!1,Al=!1,Pt="cell",bn=R,yn=A,Bn=e.scrollX.value,Tn=e.scrollY.value,gt=E(R),pt=x(A),Qt!==null&&clearTimeout(Qt),Qt=window.setTimeout(()=>{const Me=e.selection.value;if(!!Me&&gt>=Me.startCol&&gt<=Me.endCol&&pt>=Me.startRow&&pt<=Me.endRow){Al=!0,Ht(z(_,D),gt,pt);return}Il=!0,ul=gt,fl=pt,gt>=0&&pt>=0&&(e.selectCell(gt,pt),u())},450)):R>=0&&A>=0&&(R<52||A<24)&&(s.preventDefault(),Gt=!0,$t=!1,Il=!1,bn=R,yn=A,Bn=e.scrollX.value,Tn=e.scrollY.value,A<24&&R>=52?(Pt="col",gt=E(R),pt=-1):R<52&&A>=24?(Pt="row",pt=x(A),gt=-1):(Pt="all",gt=-1,pt=-1),(Pt==="col"||Pt==="row"||Pt==="all")&&(Qt!==null&&clearTimeout(Qt),Qt=window.setTimeout(()=>{const Me=e.selection.value;if(Pt==="all"){Al=!0,nl(z(_,D));return}if(Pt==="col"){if(!!Me&&Me.startRow===0&&Me.endRow===e.rowCount-1&&gt>=Me.startCol&&gt<=Me.endCol){Al=!0,ol(z(_,D),gt);return}Il=!0,ul=gt,fl=-1,gt>=0&&(e.selectRange(gt,0,gt,e.rowCount-1,"col"),u())}else{if(!!Me&&Me.startCol===0&&Me.endCol===e.colCount-1&&pt>=Me.startRow&&pt<=Me.endRow){Al=!0,dl(z(_,D),pt);return}Il=!0,ul=-1,fl=pt,pt>=0&&(e.selectRange(0,pt,e.colCount-1,pt,"row"),u())}},450)))}function xn(s){if(!Gt||s.touches.length!==1)return;const m=s.touches[0],C=o.canvasRef.value;if(!C)return;const T=C.getBoundingClientRect(),R=m.clientX-T.left,A=m.clientY-T.top;if(e.autoFillState.value.active){s.preventDefault(),so(R,A);return}if(Wt){const _=R-52+e.scrollX.value-Fl;let D=Vl+_;D=D<30?30:D>1e3?1e3:D,e.colWidths.value[rn]=D,s.preventDefault(),u();return}if(rl){const _=A-24+e.scrollY.value-Fl;let D=Vl+_;D=D<24?24:D>500?500:D,e.rowHeights.value[an]=D,s.preventDefault(),u();return}if(Il){if(s.preventDefault(),ul>=0&&fl>=0){const _=E(R),D=x(A);_>=0&&D>=0&&(e.selectRange(ul,fl,_,D),u())}else if(fl===-1&&ul>=0){const _=E(R);_>=0&&(e.selectRange(Math.min(ul,_),0,Math.max(ul,_),e.rowCount-1,"col"),u())}else if(ul===-1&&fl>=0){const _=x(A);_>=0&&(e.selectRange(0,Math.min(fl,_),e.colCount-1,Math.max(fl,_),"row"),u())}return}Qt!==null&&(clearTimeout(Qt),Qt=null),(Math.abs(R-bn)>8||Math.abs(A-yn)>8)&&($t=!0,s.preventDefault(),o.clampScroll(Bn+(bn-R),Tn+(yn-A)),u())}function jo(){if(Gt){if(Qt!==null&&(clearTimeout(Qt),Qt=null),Al){Al=!1,Gt=!1;return}if(e.autoFillState.value.active){co(),Gt=!1;return}if(Wt||rl){Wt=!1,rl=!1,o.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat(),Gt=!1;return}if(Il){Il=!1,n.paintFmt.value&&n.applyPaintFormat(),Gt=!1;return}if(Gt=!1,!$t){if(Pt==="cell"&&gt>=0&&pt>=0){const s=Date.now();gt===Hn&&pt===oo&&s-$n<300?(e.selectCell(gt,pt),e.startEdit(),u(),o.focusEditInput(),$n=0):(e.commitEdit(),e.selectCell(gt,pt),u(),$n=s),Hn=gt,oo=pt,o.focusEditInput()}else Pt==="col"&&gt>=0?(e.commitEdit(),e.selectRange(gt,0,gt,e.rowCount-1,"col"),u()):Pt==="row"&&pt>=0?(e.commitEdit(),e.selectRange(0,pt,e.colCount-1,pt,"row"),u()):Pt==="all"&&(e.commitEdit(),e.selectAll(),u());n.paintFmt.value&&!e.editingCell.value&&n.applyPaintFormat()}}}function Pn(s){return s.isComposing||s.key==="Process"||s.keyCode===229}function mo(s){return s.key.length===1&&!s.ctrlKey&&!s.metaKey&&!s.altKey}function Un(s){if(e.autoFillState.value.active){s.key==="Escape"&&(s.preventDefault(),Nn(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},u());return}if(e.editingCell.value)return;const m=s.ctrlKey||s.metaKey,C=s.shiftKey;switch(!0){case(s.altKey&&s.key==="ArrowDown"):s.preventDefault(),Ie(e.activeCell.value.col,e.activeCell.value.row);return;case(m&&(s.key==="c"||s.key==="C")):s.preventDefault(),l.copyToClipboard();return;case(m&&(s.key==="x"||s.key==="X")):s.preventDefault(),l.cutSelected();return;case(m&&(s.key==="z"||s.key==="Z")):s.preventDefault(),n.undo();return;case(m&&(s.key==="y"||s.key==="Y")):s.preventDefault(),n.redo();return;case(m&&(s.key==="v"||s.key==="V")):s.preventDefault(),n.saveUndo(),l.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>o.emitModelData())});return;case(m&&(s.key==="a"||s.key==="A")):s.preventDefault(),e.selectAll(),u();return;case(m&&C&&(s.key==="l"||s.key==="L")):s.preventDefault(),e.toggleAutoFilter(),u();return;case(m&&s.key==="Home"):s.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),u();return;case(m&&s.key==="End"):s.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),u();return;case s.key==="Home":s.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),u();return;case s.key==="End":s.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),u();return;case s.key==="ArrowUp":s.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowDown":s.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowLeft":s.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowRight":s.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Tab":s.preventDefault(),e.moveActive(C?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Enter":s.preventDefault(),e.moveActive(0,C?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="F2":s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u(),o.focusEditInput();return;case s.key==="Delete":case s.key==="Backspace":s.preventDefault(),n.saveUndo(),l.clearSelected(),u();return;case s.key==="Escape":s.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,u();return;case mo(s):if(Pn(s)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),u(),o.focusEditInput();return}s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s.key),u(),t.nextTick(()=>{const T=o.editInputRef.value;T&&(T.focus(),T.setSelectionRange(1,1))});return}}let Dn=!1,Gl=!1;function Zo(s){const m=s.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(m),X.value=m,u();return}e.editValue.value=m,X.value=m}function Jo(){Dn=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),X.value="",u())}function po(s){Dn=!1,Gl=!0,setTimeout(()=>{Gl=!1},0);const m=s.target.value;e.editValue.value=m,X.value=m}function Qo(s){if(!e.editingCell.value){if(mo(s)||Pn(s))return;Un(s);return}if(!(Dn||Pn(s))&&!(Gl&&(s.key==="Enter"||s.key==="Escape")))if(s.key==="Enter"&&(s.altKey||s.metaKey)){s.preventDefault();const m=o.editInputRef.value;if(!m)return;const C=m.selectionStart??m.value.length,T=m.selectionEnd??m.value.length,R=m.value,A=R.slice(0,C)+`
9
- `+R.slice(T);e.editValue.value=A,m.value=A,m.selectionStart=m.selectionEnd=C+1,u()}else s.key==="Enter"?(s.preventDefault(),e.commitEdit().then(m=>{if(!m){u(),o.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),o.focusEditInput()})):s.key==="Tab"?(s.preventDefault(),e.commitEdit().then(m=>{if(!m){u(),o.focusEditInput();return}e.moveActive(s.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),o.focusEditInput()})):s.key==="Escape"&&(s.preventDefault(),e.cancelEdit(),u(),o.focusEditInput())}function q(s){e.editingCell.value}function p(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>u())},0)}let v=null;function S(){var m;const s=(m=o.wrapperRef.value)==null?void 0:m.getBoundingClientRect();if(s){const C=hn(e.props.width),T=hn(e.props.height);C!=null?o.viewSize.w=C:o.viewSize.w=s.width,T!=null?o.viewSize.h=T:o.viewSize.h=s.height}o.clampScroll(null,null),u()}function O(){t.onMounted(()=>{const s=hn(e.props.width),m=hn(e.props.height);(s==null||m==null)&&(v=new ResizeObserver(()=>S()),o.wrapperRef.value&&v.observe(o.wrapperRef.value)),t.nextTick(()=>{S(),o.focusEditInput()}),e.selectCell(0,0),o.modelData.value&&o.modelData.value.length>0&&(a.value=JSON.stringify(o.modelData.value),o.sheets.value=o.modelData.value.map(C=>{const T=o.mkSheet(C.name,{colCount:C.colCount,rowCount:C.rowCount}),{cells:R,styles:A}=Pr(C.cells);if(Object.assign(T.cells,R),T.styles=C.styles??A,C.borders)T.borders=C.borders;else{const _=Ur(T.styles);T.styles=_.styles,T.borders=_.borders}if(C.colWidths)for(const[_,D]of Object.entries(C.colWidths)){const z=Number(_);z>=0&&z<(T.colCount??e.colCount)&&D>=30&&(T.colWidths[z]=D)}if(C.rowHeights)for(const[_,D]of Object.entries(C.rowHeights)){const z=Number(_);z>=0&&z<(T.rowCount??e.rowCount)&&D>=24&&(T.rowHeights[z]=D)}if(C.merges)for(const[_,D]of Object.entries(C.merges))T.merges[_]={...D};return T.freeze=C.freeze?{rows:C.freeze.rows,cols:C.freeze.cols}:{rows:0,cols:0},T.filter=ea(C.filter,T.cells),T.dataValidations=Array.isArray(C.dataValidations)?[...C.dataValidations]:[],T}),o.sheets.value.length>0&&o.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const s=hn(e.props.width),m=hn(e.props.height);s!=null&&m!=null?(v==null||v.disconnect(),v=null):!v&&o.wrapperRef.value&&(v=new ResizeObserver(()=>S()),v.observe(o.wrapperRef.value)),t.nextTick(()=>S())}),t.watch(()=>e.props.theme,()=>u()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>o.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>o.emitModelData()),u()},{deep:!1}),t.watch(o.activeSheetIndex,()=>t.nextTick(()=>o.emitModelData())),t.watch(()=>o.modelData.value,s=>{if(!s||s.length===0)return;const m=JSON.stringify(s);if(m===a.value)return;a.value=m;const C=e.selection.value?{...e.selection.value}:null,T={...e.activeCell.value};o.sheets.value=s.map(D=>{const z=o.mkSheet(D.name),{cells:ae,styles:Me}=Pr(D.cells);if(Object.assign(z.cells,ae),z.styles=D.styles??Me,D.borders)z.borders=D.borders;else{const Qe=Ur(z.styles);z.styles=Qe.styles,z.borders=Qe.borders}if(D.colWidths)for(const[Qe,nt]of Object.entries(D.colWidths)){const dt=Number(Qe);dt>=0&&dt<e.colCount&&nt>=30&&(z.colWidths[dt]=nt)}if(D.rowHeights)for(const[Qe,nt]of Object.entries(D.rowHeights)){const dt=Number(Qe);dt>=0&&dt<e.rowCount&&nt>=24&&(z.rowHeights[dt]=nt)}if(D.merges)for(const[Qe,nt]of Object.entries(D.merges))z.merges[Qe]={...nt};return z.freeze=D.freeze?{rows:D.freeze.rows,cols:D.freeze.cols}:{rows:0,cols:0},z.filter=ea(D.filter,z.cells),z.dataValidations=Array.isArray(D.dataValidations)?[...D.dataValidations]:[],z}),o.sheets.value.length>0&&o.loadSheet(0),C&&(e.selection.value=C),e.activeCell.value=T;const R=e.activeCell.value,A=e.selection.value,_=e.findMerge(R.col,R.row);_&&_.anchor===e.cellKey(R.col,R.row)&&(!A||A.startCol===R.col&&A.startRow===R.row&&A.endCol===R.col&&A.endRow===R.row)&&e.selectCell(R.col,R.row),u()},{deep:!0}),t.onBeforeUnmount(()=>{v==null||v.disconnect()})}return{scheduleRender:u,render:Y,renderFrozenOverlay:ne,activeCellLabel:se,formulaBarDisplay:Ne,formulaBarDraft:X,formulaBarExpanded:te,onFormulaBarFocus:ze,onFormulaBarInput:Ve,onFormulaBarKeydown:G,onFormulaBarBlur:Ce,acceptFormulaBarEdit:F,cancelFormulaBarEdit:I,insertFunctionIntoCell:Fe,renTab:$e,renTabVal:j,onTabClick:Be,onTabDblClick:Q,commitTabRename:ke,cclTabRename:B,onTabRenameKd:oe,ctxMenu:Z,ctxSubmenuLeft:Mt,filterPopup:re,isFilterButtonHit:et,openFilterPopup:ut,closeFilterPopup:Pe,validationDropdown:K,isValidationDropdownHit:ve,openValidationDropdown:Ie,closeValidationDropdown:Ee,onValidationDropdownSelect:He,onCtxItemEnter:Ft,onTabCtxMenu:Ot,onTabBarCtx:Dl,onCornerCtx:nl,onRowHdrCtx:dl,onColHdrCtx:ol,onCellCtx:Ht,dimInputRef:vl,dimPanel:zt,openDimPanel:w,onDimInput:be,onDimKeydown:he,onDimBlur:xe,applyDimPanel:we,closeDimPanel:ce,editInputStyle:Ue,hScrollbarW:We,vScrollbarH:V,hScrollbarLeft:le,vScrollbarTop:me,hTrackW:pe,vTrackH:Re,hThumbW:Te,hThumbL:Se,vThumbH:qe,vThumbT:mt,onVStart:kl,onHStart:gn,onSbMove:El,onSbUp:nn,onVTrk:On,onHTrk:Po,onMouseDown:Uo,onMouseMove:Ko,onMouseUp:Go,onMouseLeave:uo,onCanvasCtx:fo,onDblClick:qo,onWheel:Yo,onTouchStart:Xo,onTouchMove:xn,onTouchEnd:jo,onKeydown:Un,onEditInput:Zo,onEditCompositionStart:Jo,onEditCompositionEnd:po,onEditKd:Qo,onEditPaste:q,onEditBlur:p,applySize:S,setupLifecycle:O}}function z0(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ta(e,n,l,o){return n?o?l?e===n:e.toLowerCase()===n.toLowerCase():l?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function W0(e,n,l,o){if(!n)return e;if(o){const i=e.indexOf(n);return i<0?e:e.slice(0,i)+l+e.slice(i+n.length)}const a=e.toLowerCase().indexOf(n.toLowerCase());return a<0?e:e.slice(0,a)+l+e.slice(a+n.length)}function P0(e,n,l,o){return n?o?e.indexOf(n)<0?e:e.split(n).join(l):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(z0(n),"gi"),()=>l):e}function Wo(e,n,l,o,a,i,r){const d=[];if(r){for(let f=r.startRow;f<=r.endRow;f++)for(let y=r.startCol;y<=r.endCol;y++){const h=e[l(y,f)];h&&ta(h.value,o,a,i)&&d.push({sheetIndex:n,col:y,row:f})}return d}for(const f in e){const y=e[f];if(y&&ta(y.value,o,a,i)){const h=f.split(","),u=Number(h[0]),E=Number(h[1]);!Number.isNaN(u)&&!Number.isNaN(E)&&d.push({sheetIndex:n,col:u,row:E})}}return d}function U0(e,n,l,o){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),d=t.ref("sheet"),f=t.ref(!1),y=t.ref(!1),h=t.ref(-1),u=t.ref([]),E=t.ref(""),x=t.ref(0),k=t.ref(""),H=t.computed(()=>{const j=new Set,Be=l.activeSheetIndex.value;for(const Q of u.value)Q.sheetIndex===Be&&j.add(`${Q.col},${Q.row}`);return j}),Y=t.computed(()=>{if(h.value<0||h.value>=u.value.length)return null;const j=u.value[h.value];return j.sheetIndex!==l.activeSheetIndex.value?null:`${j.col},${j.row}`});e.findHighlight=(j,Be)=>{const Q=`${j},${Be}`;return Y.value===Q?"active":H.value.has(Q)?"match":null};function ne(j){var ke,B;const Be=e.cellKey(j.col,j.row);if(j.sheetIndex===l.activeSheetIndex.value)return((ke=e.cells[Be])==null?void 0:ke.value)??"";const Q=l.sheets.value[j.sheetIndex];return((B=Q==null?void 0:Q.cells[Be])==null?void 0:B.value)??""}function ee(j,Be){const Q=e.cellKey(j.col,j.row);if(j.sheetIndex===l.activeSheetIndex.value)e.setCellValue(j.col,j.row,Be);else{const ke=l.sheets.value[j.sheetIndex];if(!ke)return;const B=ke.cells[Q];ke.cells[Q]={value:String(Be),styleId:B==null?void 0:B.styleId}}}function M(){if(k.value){E.value=k.value;return}if(!i.value){E.value="";return}if(d.value==="selection"&&!e.selection.value){E.value=b(e.locale.value,"findNeedSelection");return}if(u.value.length===0){E.value=b(e.locale.value,"findNoResult");return}E.value=""}function se(){const j=i.value,Be=[];if(j)if(d.value==="workbook")l.sheets.value.forEach((Q,ke)=>{Be.push(...Wo(Q.cells,ke,e.cellKey,j,f.value,y.value))});else if(d.value==="selection"){const Q=e.selection.value;Q&&Be.push(...Wo(e.cells,l.activeSheetIndex.value,e.cellKey,j,f.value,y.value,Q))}else Be.push(...Wo(e.cells,l.activeSheetIndex.value,e.cellKey,j,f.value,y.value));u.value=Be,Be.length===0?h.value=-1:h.value>=Be.length?h.value=Be.length-1:h.value<0&&(h.value=0),M()}function X(){if(h.value<0||h.value>=u.value.length)return;const j=u.value[h.value];j.sheetIndex!==l.activeSheetIndex.value&&l.switchSheet(j.sheetIndex),d.value==="selection"?e.activeCell.value={col:j.col,row:j.row}:e.selectCell(j.col,j.row),e.ensureVisible(j.col,j.row)}const te=typeof requestAnimationFrame=="function"?requestAnimationFrame:j=>setTimeout(j,16);let Ne=!1,ze=!1;function Ve(j){if(Ne){ze=ze||j;return}Ne=!0,ze=j,te(()=>{var Be;Ne=!1,se(),ze&&u.value.length>0&&h.value>=0&&X(),ze=!1,(Be=e.scheduleRender)==null||Be.call(e)})}function Fe(){var j;a.value=!0,x.value++,se(),u.value.length>0&&(h.value=0,X()),(j=e.scheduleRender)==null||j.call(e)}function je(){Fe()}function _e(){var j;a.value=!1,u.value=[],h.value=-1,k.value="",E.value="",(j=e.scheduleRender)==null||j.call(e)}function F(){var j;u.value.length!==0&&(h.value=(h.value+1)%u.value.length,X(),(j=e.scheduleRender)==null||j.call(e))}function I(){var j;u.value.length!==0&&(h.value=(h.value-1+u.value.length)%u.value.length,X(),(j=e.scheduleRender)==null||j.call(e))}function G(){var B,oe;if(h.value<0||h.value>=u.value.length)return;const j=u.value[h.value],Be=ne(j),Q=W0(Be,i.value,r.value,f.value);if(Q===Be)return;n.saveUndo(),ee(j,Q);const ke=h.value;se(),u.value.length>0?(h.value=Math.min(ke,u.value.length-1),F()):h.value=-1,(B=e.emitModelData)==null||B.call(e),(oe=e.scheduleRender)==null||oe.call(e)}function Ce(){var ke,B;const j=i.value;if(!j||u.value.length===0)return;n.saveUndo();let Be=0;const Q=u.value.slice();for(const oe of Q){const Z=ne(oe),re=P0(Z,j,r.value,f.value);re!==Z&&(ee(oe,re),Be++)}u.value=[],h.value=-1,k.value=b(e.locale.value,"findReplacedAll").replace("{n}",String(Be)),M(),(ke=e.emitModelData)==null||ke.call(e),(B=e.scheduleRender)==null||B.call(e)}function $e(){const j=Be=>{if(!(Be.ctrlKey||Be.metaKey))return;const ke=Be.key.toLowerCase();(ke==="f"||ke==="h")&&(Be.preventDefault(),Fe())};window.addEventListener("keydown",j),t.onBeforeUnmount(()=>window.removeEventListener("keydown",j))}return t.watch(i,()=>{a.value&&(k.value="",h.value=0,Ve(!0))}),t.watch([d,f,y],()=>{a.value&&(k.value="",h.value=0,Ve(!0))}),t.watch(e.cells,()=>{a.value&&Ve(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&d.value==="selection"&&(h.value=0,Ve(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{a.value&&Ve(!1)}),{open:a,findText:i,replaceText:r,scope:d,matchCase:f,matchEntireCell:y,currentIndex:h,results:u,message:E,focusToken:x,activeSheetMatches:H,activeMatchKey:Y,openFind:Fe,openReplace:je,close:_e,recompute:se,findNext:F,findPrev:I,replace:G,replaceAll:Ce,setupLifecycle:$e}}const K0={class:"formula-bar__cell-label"},G0={class:"formula-bar__buttons"},q0=["title","aria-label"],Y0=["rows","value"],X0=["title"],j0={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Z0={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},J0=["value"],Q0={key:2,class:"sb-corner"},e1=["onClick","onMouseenter"],t1={class:"context-menu__label"},l1={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},n1=["onClick"],o1={key:0,class:"cf-modal-mask"},r1={class:"dim-panel__title"},a1={class:"dim-panel__body"},i1=["value"],s1={key:0,class:"dim-panel__error"},c1={class:"dim-panel__footer"},la=St(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,l=t.useModel(e,"data"),o={value:""},a=B0(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:g=>{},mkSheet:g=>({id:"",name:g,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[],colCount:0,rowCount:0,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[]})},r=T0(a,i),d=x0(a,r);N0(r,{borderMenuOpen:d.borderMenuOpen,mergeMenuOpen:d.mergeMenuOpen});const f=$0(a,r,l,void 0,o);i.sheets=f.sheets,i.activeSheetIndex=f.activeSheetIndex,i.saveSheet=f.saveSheet,i.loadSheet=f.loadSheet,i.mkSheet=f.mkSheet;const y=H0(a,r,d,f,o);y.setupLifecycle();const h=U0(a,r,f);h.setupLifecycle();const u=t.reactive(a),E=t.reactive(r),x=t.reactive(d),k=t.reactive(f),H=f.sheets,Y=f.activeSheetIndex,ne=f.sortMenuOpen,ee=f.cachedSortOrder,M=t.reactive(y),se=t.reactive(h),X=t.computed(()=>{const g=u.selection;return!!g&&g.startCol===g.endCol&&g.startRow===g.endRow}),te=t.computed(()=>{const g=u.selection;return g?f.canSortColumns(g.startCol,g.endCol):!1}),Ne=t.computed(()=>{if(u.getFilter()!==null)return!0;const g=u.selection;if(!g)return!0;const c=Math.min(g.startCol,g.endCol),w=Math.max(g.startCol,g.endCol),be=Math.min(g.startRow,g.endRow),he=Math.max(g.startRow,g.endRow);for(const xe in u.merges){const we=u.merges[xe];if(!(we.startCol===we.endCol&&we.startRow===we.endRow)&&c<=we.endCol&&w>=we.startCol&&be<=we.endRow&&he>=we.startRow)return!1}return!0}),ze=t.computed(()=>{const g=E.selNumberFormat;if(g!==Tl&&g!==Wl)return g;const c=u.activeCell,w=a.resolveStyle(u.cells[u.cellKey(c.col,c.row)]);return typeof(w==null?void 0:w.numberFormat)=="string"?w.numberFormat:""});function Ve(g){r.nfDialogOpen.value=g}const Fe=t.ref(!1);function je(){Fe.value=!0}function _e(g){Fe.value=g}function F(g){y.insertFunctionIntoCell(g)}function I(){u.toggleAutoFilter(),M.scheduleRender()}function G(g){const c=u.getFilter();return c?u.getCellValue(g,c.range.startRow):""}const Ce=t.computed(()=>{const g=u.selection,c=g?g.startRow:u.activeCell.row,w=g?g.startCol:u.activeCell.col;return c===0&&w===0});function $e(g){const c=u.freeze;if(g==="panes"){const w=u.selection,be=w?w.startRow:u.activeCell.row,he=w?w.startCol:u.activeCell.col;u.setFreeze(be,he)}else g==="firstRow"?u.setFreeze(1,c.cols):g==="firstCol"?u.setFreeze(c.rows,1):g==="unfreeze"&&u.clearFreeze();M.scheduleRender()}const j=t.ref(null),Be=t.ref(!1),Q=t.ref(!1),ke=t.ref(null),B=t.ref("create"),oe=t.computed(()=>{const g=u.selection;if(g){const w=lt(g.startCol)+(g.startRow+1),be=lt(g.endCol)+(g.endRow+1);return g.startCol===g.endCol&&g.startRow===g.endRow?w:`${w}:${be}`}const c=u.activeCell;return lt(c.col)+(c.row+1)});function Z(g){var be;let c;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(g)?c={type:"cellIs",operator:g,value:""}:g==="textContains"?c={type:"textContains",value:""}:g==="textNotContains"?c={type:"textNotContains",value:""}:g==="blank"?c={type:"blank"}:g==="notBlank"?c={type:"notBlank"}:g==="duplicate"?c={type:"duplicate"}:g==="unique"?c={type:"unique"}:c={type:"cellIs",operator:"greaterThan",value:""},ke.value={id:"",condition:c,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},B.value="create",(be=j.value)==null||be.closeOverflow(),Q.value=!0}function re(){var g;ke.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},B.value="create",(g=j.value)==null||g.closeOverflow(),Q.value=!0}function K(){var g;(g=j.value)==null||g.closeOverflow(),Be.value=!0}function L(g){u.clearConditionalFormats(g),M.scheduleRender()}function J(g){g.id?u.updateConditionalFormatRule(g.id,g):u.addConditionalFormatRule(g),Q.value=!1}function $(g){var c;ke.value=g,B.value="edit",(c=j.value)==null||c.closeOverflow(),Q.value=!0}function U(g){u.removeConditionalFormatRule(g)}function de(g,c){u.moveConditionalFormatRule(g,c)}function Le(g,c){u.updateConditionalFormatRule(g,{enabled:c})}const ve=t.ref(!1),Ie=t.ref(null),Ee=t.ref("create"),He=t.computed(()=>{const g=u.selection;if(g){const w=lt(g.startCol)+(g.startRow+1),be=lt(g.endCol)+(g.endRow+1);return g.startCol===g.endCol&&g.startRow===g.endRow?w:`${w}:${be}`}const c=u.activeCell;return lt(c.col)+(c.row+1)}),ge=t.ref(null);let et=null;function ut(g){return new Promise(c=>{et=c,ge.value={...g}})}a.showValidationAlert=ut,a.getSheetCellsById=g=>{const c=f.sheets.value.findIndex(w=>w.id===g||w.name===g);return c<0?null:c===f.activeSheetIndex.value?a.cells:f.sheets.value[c].cells},a.requestDataValidationDialog=()=>Pe();function Pe(){var w;const g=u.activeCell,c=a.getDataValidationRule(g.row,g.col);Ie.value=c?JSON.parse(JSON.stringify(c)):null,Ee.value=c?"edit":"create",(w=j.value)==null||w.closeOverflow(),ve.value=!0}function N(g){if(g.type==="any"){g.ranges.forEach(c=>a.clearDataValidation(c)),ve.value=!1,y.scheduleRender();return}g.id?a.updateDataValidation(g.id,g):a.createDataValidation(g),ve.value=!1,y.scheduleRender()}function ie(){const g=u.selection;g&&a.clearDataValidation(g),ve.value=!1,y.scheduleRender()}function Rt(g){ge.value=null;const c=et;et=null,t.nextTick(()=>{const w=u.editingCell;w&&(a.selectCell(w.col,w.row),a.ensureVisible(w.col,w.row),y.scheduleRender(),f.focusEditInput())}),c==null||c(g)}const ft=t.computed(()=>{const g=u.activeCell,c=a.getValidationInputMessage(g.row,g.col);if(!c)return null;const w=a.cellToScreenRect(g.row,g.col),be=f.wrapperRef.value,he=be?be.getBoundingClientRect():{left:0,top:0};return{title:c.title,message:c.message,x:he.left+w.x,y:he.top+w.y,width:w.width,height:w.height}});function Mt(g){r.fontSizeMenuOpen.value=g}function Ft(g){r.textColorMenuOpen.value=g}function It(g){r.fillColorMenuOpen.value=g}function Ot(g){y.renTabVal.value=g}function Dl(){y.ctxMenu.value=null}const nl=g=>{f.formulaBarRef.value=g};function dl(){y.formulaBarExpanded.value=!y.formulaBarExpanded.value}const ol=g=>{f.wrapperRef.value=g},Ht=g=>{f.canvasRef.value=g},vl=g=>{f.freezeCanvasRef.value=g},zt=g=>{f.editInputRef.value=g},W=g=>{y.dimInputRef.value=g};return(g,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(k.outerStyle)},[t.createVNode(wc,{ref_key:"toolbarRef",ref:j,locale:u.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":x.borderMenuOpen,"cached-border":x.cachedBorder,"sort-menu-open":t.unref(ne),"cached-sort-order":t.unref(ee),"can-sort":te.value,"can-filter":Ne.value,"filter-active":u.getFilter()!==null,"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":x.mergeMenuOpen,"calc-menu-open":x.calcMenuOpen,"is-single-cell":X.value,"has-freeze":u.freeze.rows>0||u.freeze.cols>0,"freeze-panes-disabled":Ce.value,"sel-number-format":E.selNumberFormatDisplay,"nf-options":E.nfOptions,"can-increase-decimals":E.canIncreaseDecimals,"can-decrease-decimals":E.canDecreaseDecimals,"theme-vars":k.toolbarThemeVars,onUndo:c[0]||(c[0]=w=>E.undo()),onRedo:c[1]||(c[1]=w=>E.redo()),onPaintFormat:E.onPaintFormat,onClearFormat:c[2]||(c[2]=w=>E.clearFormat()),onNumberFormatChange:c[3]||(c[3]=w=>E.onNumberFormatChange(w)),onIncreaseDecimals:E.onIncreaseDecimals,onDecreaseDecimals:E.onDecreaseDecimals,onFontFamilyChange:c[4]||(c[4]=w=>E.onFontFamilyChange(w)),onFontSizeInput:c[5]||(c[5]=w=>E.onFontSizeInput(w)),onFontSizeBlur:E.onFontSizeBlur,onFontSizeKeydown:c[6]||(c[6]=w=>E.onFontSizeKeydown(w)),onFontSizeChange:c[7]||(c[7]=w=>E.onFontSizeChange(w)),"onUpdate:fontSizeMenuOpen":c[8]||(c[8]=w=>Mt(w)),onFontSizeToggle:c[9]||(c[9]=w=>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]=w=>E.onTextColorChange(w)),"onUpdate:textColorMenuOpen":c[11]||(c[11]=w=>Ft(w)),onFillColorChange:c[12]||(c[12]=w=>E.onFillColorChange(w)),"onUpdate:fillColorMenuOpen":c[13]||(c[13]=w=>It(w)),onApplyTextColor:E.applyCachedTextColor,onApplyFillColor:E.applyCachedFillColor,"onUpdate:borderMenuOpen":c[14]||(c[14]=w=>E.onBorderMenuToggle(w)),onBorderChange:c[15]||(c[15]=w=>x.onBorderChange(w)),onApplyBorder:x.applyCachedBorder,"onUpdate:sortMenuOpen":c[16]||(c[16]=w=>k.onSortMenuToggle(w)),onSortChange:c[17]||(c[17]=w=>k.onSortChange(w)),onApplySort:k.applyCachedSort,onToggleFilter:I,onFreezeChange:c[18]||(c[18]=w=>$e(w)),onHAlignChange:c[19]||(c[19]=w=>E.onHAlignChange(w)),onVAlignChange:c[20]||(c[20]=w=>E.onVAlignChange(w)),onWrapToggle:E.onWrapToggle,"onUpdate:mergeMenuOpen":c[21]||(c[21]=w=>x.onMergeMenuToggle(w)),onMergeChange:c[22]||(c[22]=w=>x.onMergeChange(w)),onApplyMerge:x.onApplyMerge,"onUpdate:calcMenuOpen":c[23]||(c[23]=w=>x.onCalcMenuToggle(w)),onCalcSum:x.onCalcSum,onCalcAvg:x.onCalcAvg,onCalcCount:x.onCalcCount,onFind:c[24]||(c[24]=w=>t.unref(h).openFind()),onCfPreset:c[25]||(c[25]=w=>Z(w)),onCfNewRule:re,onCfManage:K,onCfClear:c[26]||(c[26]=w=>L(w)),onOpenDataValidation:Pe},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","sort-menu-open","cached-sort-order","can-sort","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","has-freeze","freeze-panes-disabled","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","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(Xc,{open:se.open,"find-text":se.findText,"replace-text":se.replaceText,scope:se.scope,"match-case":se.matchCase,"match-entire-cell":se.matchEntireCell,"current-index":se.currentIndex,total:se.results.length,message:se.message,"focus-token":se.focusToken,locale:u.locale,"theme-vars":k.toolbarThemeVars,"onUpdate:findText":c[27]||(c[27]=w=>t.unref(h).findText.value=w),"onUpdate:replaceText":c[28]||(c[28]=w=>t.unref(h).replaceText.value=w),"onUpdate:scope":c[29]||(c[29]=w=>t.unref(h).scope.value=w),"onUpdate:matchCase":c[30]||(c[30]=w=>t.unref(h).matchCase.value=w),"onUpdate:matchEntireCell":c[31]||(c[31]=w=>t.unref(h).matchEntireCell.value=w),onPrev:c[32]||(c[32]=w=>t.unref(h).findPrev()),onNext:c[33]||(c[33]=w=>t.unref(h).findNext()),onReplace:c[34]||(c[34]=w=>t.unref(h).replace()),onReplaceAll:c[35]||(c[35]=w=>t.unref(h).replaceAll()),onClose:c[36]||(c[36]=w=>t.unref(h).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(kd,{"model-open":E.nfDialogOpen,locale:u.locale,"current-format":ze.value,"is-custom":E.selNumberFormat===t.unref(Wl),"onUpdate:modelOpen":c[37]||(c[37]=w=>Ve(w)),onApply:c[38]||(c[38]=w=>E.applyNumberFormatCode(w))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(Dd,{"model-open":k.sortConfirmOpen,locale:u.locale,"onUpdate:modelOpen":c[39]||(c[39]=w=>k.sortConfirmOpen=w),onConfirm:c[40]||(c[40]=w=>k.confirmSort(w)),onCancel:c[41]||(c[41]=w=>k.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(Xd,{"model-open":Fe.value,locale:u.locale,"onUpdate:modelOpen":c[42]||(c[42]=w=>_e(w)),onInsert:c[43]||(c[43]=w=>F(w))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":M.formulaBarExpanded}])},[t.createElementVNode("div",K0,t.toDisplayString(M.activeCellLabel),1),t.createElementVNode("div",G0,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:c[44]||(c[44]=t.withModifiers(()=>{},["prevent"])),onClick:c[45]||(c[45]=t.withModifiers((...w)=>M.cancelFormulaBarEdit&&M.cancelFormulaBarEdit(...w),["stop"]))},[...c[105]||(c[105]=[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[46]||(c[46]=t.withModifiers(()=>{},["prevent"])),onClick:c[47]||(c[47]=t.withModifiers((...w)=>M.acceptFormulaBarEdit&&M.acceptFormulaBarEdit(...w),["stop"]))},[...c[106]||(c[106]=[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("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(b)(u.locale,"insertFunctionTitle"),"aria-label":t.unref(b)(u.locale,"insertFunctionTitle"),onMousedown:c[48]||(c[48]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(je,["stop"])},[...c[107]||(c[107]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,q0)]),t.createElementVNode("textarea",{ref:nl,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":M.formulaBarExpanded}]),rows:M.formulaBarExpanded?3:1,value:M.formulaBarDisplay,spellcheck:"false",onFocus:c[49]||(c[49]=(...w)=>M.onFormulaBarFocus&&M.onFormulaBarFocus(...w)),onInput:c[50]||(c[50]=(...w)=>M.onFormulaBarInput&&M.onFormulaBarInput(...w)),onKeydown:c[51]||(c[51]=(...w)=>M.onFormulaBarKeydown&&M.onFormulaBarKeydown(...w)),onBlur:c[52]||(c[52]=(...w)=>M.onFormulaBarBlur&&M.onFormulaBarBlur(...w))},null,42,Y0),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:M.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:c[53]||(c[53]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(dl,["stop"])},[M.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Z0,[...c[109]||(c[109]=[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",j0,[...c[108]||(c[108]=[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,X0)],2),t.createElementVNode("div",{ref:ol,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:Ht,class:"grid-canvas",tabindex:"0",onMousedown:c[54]||(c[54]=(...w)=>M.onMouseDown&&M.onMouseDown(...w)),onMousemove:c[55]||(c[55]=(...w)=>M.onMouseMove&&M.onMouseMove(...w)),onMouseup:c[56]||(c[56]=(...w)=>M.onMouseUp&&M.onMouseUp(...w)),onMouseleave:c[57]||(c[57]=(...w)=>M.onMouseLeave&&M.onMouseLeave(...w)),onDblclick:c[58]||(c[58]=(...w)=>M.onDblClick&&M.onDblClick(...w)),onWheel:c[59]||(c[59]=t.withModifiers((...w)=>M.onWheel&&M.onWheel(...w),["prevent"])),onFocus:c[60]||(c[60]=(...w)=>k.onCanvasFocus&&k.onCanvasFocus(...w)),onKeydown:c[61]||(c[61]=(...w)=>M.onKeydown&&M.onKeydown(...w)),onContextmenu:c[62]||(c[62]=(...w)=>M.onCanvasCtx&&M.onCanvasCtx(...w)),onTouchstart:c[63]||(c[63]=t.withModifiers((...w)=>M.onTouchStart&&M.onTouchStart(...w),["prevent"])),onTouchmove:c[64]||(c[64]=t.withModifiers((...w)=>M.onTouchMove&&M.onTouchMove(...w),["prevent"])),onTouchend:c[65]||(c[65]=(...w)=>M.onTouchEnd&&M.onTouchEnd(...w))},null,32),t.createElementVNode("canvas",{ref:vl,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:zt,class:"cell-editor",value:u.editValue,style:t.normalizeStyle(M.editInputStyle),onInput:c[66]||(c[66]=(...w)=>M.onEditInput&&M.onEditInput(...w)),onKeydown:c[67]||(c[67]=(...w)=>M.onEditKd&&M.onEditKd(...w)),onCompositionstart:c[68]||(c[68]=(...w)=>M.onEditCompositionStart&&M.onEditCompositionStart(...w)),onCompositionend:c[69]||(c[69]=(...w)=>M.onEditCompositionEnd&&M.onEditCompositionEnd(...w)),onBlur:c[70]||(c[70]=(...w)=>M.onEditBlur&&M.onEditBlur(...w)),onPaste:c[71]||(c[71]=(...w)=>M.onEditPaste&&M.onEditPaste(...w))},null,44,J0),k.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:M.vScrollbarTop+"px",height:`calc(100% - ${M.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:c[72]||(c[72]=t.withModifiers(w=>{k.clampScroll(null,u.scrollY-50),M.scheduleRender()},["prevent"]))},[...c[110]||(c[110]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[74]||(c[74]=(...w)=>M.onVTrk&&M.onVTrk(...w))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:M.vThumbT+"px",height:M.vThumbH+"px"}),onMousedown:c[73]||(c[73]=(...w)=>M.onVStart&&M.onVStart(...w))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[75]||(c[75]=t.withModifiers(w=>{k.clampScroll(null,u.scrollY+50),M.scheduleRender()},["prevent"]))},[...c[111]||(c[111]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),k.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:M.hScrollbarLeft+"px",width:`calc(100% - ${M.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:c[76]||(c[76]=t.withModifiers(w=>{k.clampScroll(u.scrollX-50,null),M.scheduleRender()},["prevent"]))},[...c[112]||(c[112]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[78]||(c[78]=(...w)=>M.onHTrk&&M.onHTrk(...w))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:M.hThumbL+"px",width:M.hThumbW+"px"}),onMousedown:c[77]||(c[77]=(...w)=>M.onHStart&&M.onHStart(...w))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[79]||(c[79]=t.withModifiers(w=>{k.clampScroll(u.scrollX+50,null),M.scheduleRender()},["prevent"]))},[...c[113]||(c[113]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),k.maxScrollX>0&&k.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Q0)):t.createCommentVNode("",!0)]),t.createVNode(Fc,{locale:u.locale,sheets:t.unref(H),"active-sheet-index":t.unref(Y),"ren-tab":M.renTab,"ren-tab-val":M.renTabVal,onTabClick:c[80]||(c[80]=w=>M.onTabClick(w)),onTabDblclick:c[81]||(c[81]=w=>M.onTabDblClick(w)),onTabContextmenu:c[82]||(c[82]=w=>M.onTabCtxMenu(w.ev,w.i)),onTabRenameInput:c[83]||(c[83]=w=>Ot(w)),onTabRenameKeydown:c[84]||(c[84]=w=>M.onTabRenameKd(w)),onTabRenameCommit:M.commitTabRename,onTabbarContextmenu:c[85]||(c[85]=w=>M.onTabBarCtx(w)),onDeleteSheet:c[86]||(c[86]=w=>{k.removeSheet(w),M.scheduleRender()}),onAddSheet:c[87]||(c[87]=w=>{k.addSheet(),M.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(()=>[M.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:M.ctxMenu.x+"px",top:M.ctxMenu.y+"px"}),onClick:c[88]||(c[88]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.ctxMenu.items,(w,be)=>(t.openBlock(),t.createElementBlock("div",{key:be,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":w.disabled}]),onClick:he=>!w.disabled&&w.action&&(w.action(),Dl()),onMouseenter:he=>M.onCtxItemEnter(he,w)},[t.createElementVNode("span",t1,t.toDisplayString(w.label),1),w.children?(t.openBlock(),t.createElementBlock("svg",l1,[...c[114]||(c[114]=[t.createElementVNode("path",{d:"M361.386667 180.053333a32 32 0 0 0 0 45.226667L648.106667 512l-286.72 286.72a32 32 0 1 0 45.226666 45.226667l309.333334-309.333334a32 32 0 0 0 0-45.226666L406.613333 180.053333a32 32 0 0 0-45.226666 0z","p-id":"22870"},null,-1)])])):t.createCommentVNode("",!0),w.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":M.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.children,(he,xe)=>(t.openBlock(),t.createElementBlock("div",{key:xe,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":he.disabled}]),onClick:t.withModifiers(we=>!he.disabled&&he.action&&(he.action(),Dl()),["stop"])},t.toDisplayString(he.label),11,n1))),128))],2)):t.createCommentVNode("",!0)],42,e1))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),M.filterPopup?(t.openBlock(),t.createBlock(wu,{key:M.filterPopup.col,col:M.filterPopup.col,"header-label":G(M.filterPopup.col),anchor:{x:M.filterPopup.x,y:M.filterPopup.y},locale:u.locale,"get-filter":u.getFilter,"set-filter":u.setFilter,"set-filter-column":u.setFilterColumn,"clear-filter-column":u.clearFilterColumn,"get-column-candidates":u.getColumnCandidates,close:M.closeFilterPopup},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Be.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:c[90]||(c[90]=t.withModifiers(w=>Be.value=!1,["self"]))},[t.createVNode(_u,{locale:u.locale,rules:u.conditionalFormats,"theme-vars":k.toolbarThemeVars,onNew:re,onEdit:$,onDelete:U,onMove:de,onToggle:Le,onClose:c[89]||(c[89]=w=>Be.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Q.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:c[92]||(c[92]=t.withModifiers(w=>Q.value=!1,["self"]))},[t.createVNode(Ef,{locale:u.locale,mode:B.value,rule:ke.value,"default-range-text":oe.value,"theme-vars":k.toolbarThemeVars,onSave:J,onCancel:c[91]||(c[91]=w=>Q.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),M.validationDropdown?(t.openBlock(),t.createBlock(Am,{key:`${M.validationDropdown.col},${M.validationDropdown.row}`,items:M.validationDropdown.items,current:M.validationDropdown.current,locale:u.locale,x:M.validationDropdown.x,y:M.validationDropdown.y,width:M.validationDropdown.width,height:M.validationDropdown.height,onSelect:c[93]||(c[93]=w=>t.unref(y).onValidationDropdownSelect(w)),onClose:c[94]||(c[94]=w=>t.unref(y).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height"])):t.createCommentVNode("",!0),ft.value?(t.openBlock(),t.createBlock(qm,{key:2,title:ft.value.title,message:ft.value.message,x:ft.value.x,y:ft.value.y,width:ft.value.width,height:ft.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ve.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:c[96]||(c[96]=t.withModifiers(w=>ve.value=!1,["self"]))},[t.createVNode(Mm,{locale:u.locale,mode:Ee.value,rule:Ie.value,"default-range-text":He.value,"theme-vars":k.toolbarThemeVars,onSave:N,onClear:ie,onCancel:c[95]||(c[95]=w=>ve.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ge.value?(t.openBlock(),t.createElementBlock("div",o1,[t.createVNode(Um,{locale:u.locale,severity:ge.value.severity,title:ge.value.title,message:ge.value.message,"theme-vars":k.toolbarThemeVars,onResolve:Rt},null,8,["locale","severity","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[M.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:M.dimPanel.x+"px",top:M.dimPanel.y+"px"}),onMousedown:c[102]||(c[102]=t.withModifiers(()=>{},["stop"])),onTouchstart:c[103]||(c[103]=t.withModifiers(()=>{},["stop"])),onClick:c[104]||(c[104]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",r1,t.toDisplayString(M.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",a1,[t.createElementVNode("input",{ref:W,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":M.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:M.dimPanel.value,onInput:c[97]||(c[97]=(...w)=>M.onDimInput&&M.onDimInput(...w)),onKeydown:c[98]||(c[98]=(...w)=>M.onDimKeydown&&M.onDimKeydown(...w)),onBlur:c[99]||(c[99]=(...w)=>M.onDimBlur&&M.onDimBlur(...w))},null,42,i1)]),M.dimPanel.error?(t.openBlock(),t.createElementBlock("div",s1,t.toDisplayString(M.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",c1,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[100]||(c[100]=(...w)=>M.applyDimPanel&&M.applyDimPanel(...w))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[101]||(c[101]=(...w)=>M.closeDimPanel&&M.closeDimPanel(...w))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-5417998d"]]);Ql.Spreader=la,Ql.default=la,Object.defineProperties(Ql,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(un,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(un=typeof globalThis<"u"?globalThis:un||self,t(un.XiaoDaoSpreader={},un.Vue))})(this,function(un,t){"use strict";const Ua={"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:"默认列宽",sort:"排序",sortAsc:"升序排序",sortDesc:"降序排序",sortReminderTitle:"排序提醒",sortReminderMessage:"选定区域的左侧或右侧还有相邻数据,这些数据未被选中,将不参与排序。是否将其一并纳入排序?",sortExpandSelection:"扩展选定区域",sortCurrentSelection:"仅对选定区域排序",insertFunctionTitle:"插入函数",insertFunctionSelectLabel:"函数",insertFunctionPlaceholder:"请选择函数",insertFunctionSearchPlaceholder:"搜索函数",insertFunctionFormulaLabel:"公式",insertFunctionBtn:"插入",fnDescSum:"计算单元格区域中所有数值的和",fnDescAverage:"计算单元格区域中数值的算术平均值",fnDescCount:"统计单元格区域中包含数值的单元格个数",fnDescIf:"根据指定条件判断真假,返回对应的两个值之一",fnDescVlookup:"在区域首列查找指定值,返回同一行中指定列的值",fnDescConcatenate:"将多个文本连接合并为一个文本",fnDescMax:"返回单元格区域中所有数值的最大值",fnDescMin:"返回单元格区域中所有数值的最小值",fnDescSin:"返回给定角度(弧度)的正弦值",fnDescSumif:"对区域中满足指定条件的单元格对应的数值求和",fnDescPmt:"计算基于固定利率及等额分期付款的贷款每期还款额",fnDescStdev:"估算基于样本的标准偏差(忽略文本与逻辑值)",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:"分类",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",findOptions:"查找选项",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列",filter:"筛选",clearFilter:"清除筛选",cancelFilter:"取消",filterSearchPlaceholder:"搜索",filterSelectAll:"全选",filterClearAll:"清除全部",filterOk:"确定",filterBlank:"空白",filterNonBlank:"非空白",filterText:"文本筛选",filterNumber:"数字筛选",filterDate:"日期筛选",filterEquals:"等于",filterNotEquals:"不等于",filterContains:"包含",filterNotContains:"不包含",filterStartsWith:"开头是",filterEndsWith:"结尾是",filterGreaterThan:"大于",filterGreaterThanOrEqual:"大于等于",filterLessThan:"小于",filterLessThanOrEqual:"小于等于",filterBetween:"介于",filterAnd:"与",filterCustom:"自定义筛选",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",outlineGroup:"分组",outlineRows:"行分组",outlineColumns:"列分组",outlineAddRowGroup:"添加行分组",outlineAddColumnGroup:"添加列分组",outlineUngroup:"取消分组",outlineUngroupRows:"取消行分组",outlineUngroupColumns:"取消列分组",outlineClear:"清除分组",outlineClearAll:"清除全部分组",outlineExpand:"展开",outlineCollapse:"折叠",outlineExpandAll:"全部展开",outlineCollapseAll:"全部折叠",outlineRowsLabel:"行",outlineColumnsLabel:"列",outlineLevel:"级别",outlineLevelLabel:"等级",outlineNeedRowsOrColumns:"请选择整行或整列后分组",outlineInvalidRange:"无效的分组范围:分组至少需要连续 2 个行或列",outlineCrossing:"分组范围与现有分组交叉,请调整",outlineTooDeep:"最多支持 8 级分组",outlineUngroupPartial:"选区未完整覆盖某个分组,无法取消分组",autofillMergeSizeError:"要执行此操作,所有合并单元格必须大小相同。",outlineSelectAxisTitle:"创建分组",outlineSelectAxisPrompt:"请选择按行分组还是按列分组",outlineAlertTitle:"分组提示",conditionalFormat:"条件格式",cfHighlightRules:"突出显示单元格规则",cfGreaterThan:"大于",cfGreaterThanOrEqual:"大于等于",cfLessThan:"小于",cfLessThanOrEqual:"小于等于",cfBetween:"介于",cfNotBetween:"不介于",cfEqual:"等于",cfCellIs:"单元格值",cfNotEqual:"不等于",cfTextContains:"文本包含",cfTextNotContains:"文本不包含",cfBlank:"空白",cfNotBlank:"非空白",cfDuplicate:"重复值",cfUnique:"唯一值",cfFormulaShort:"公式",cfFormula:"使用公式确定要设置格式的单元格",cfFormulaExample:"例如 =$A1>100",cfNewRule:"新建规则",cfManageRules:"管理规则",cfClearRules:"清除规则",cfClearSelected:"清除所选单元格的规则",cfClearSheet:"清除整个工作表的规则",cfAppliedTo:"应用于",cfRule:"规则",cfFormat:"格式",cfPriority:"优先级",cfStopIfTrue:"停止如果为真",cfEnabled:"启用",cfDelete:"删除",cfEdit:"编辑",cfMoveUp:"上移",cfMoveDown:"下移",cfType:"类型",cfOperator:"条件",cfValue:"值",cfValue2:"到",cfManagerTitle:"条件格式规则管理器",cfPreview:"预览",cfNoRules:"当前工作表没有条件格式规则",cfRuleTypeGeneric:"自定义规则",cfBold:"加粗",cfItalic:"斜体",cfUnderline:"下划线",cfFontColor:"字体颜色",cfFillColor:"填充颜色",dv:"数据验证",dvDialogTitle:"数据验证",dvSettings:"设置",dvInputMessageTab:"输入信息",dvErrorAlertTab:"出错警告",dvAllow:"允许",dvData:"数据",dvSource:"来源",dvMin:"最小值",dvMax:"最大值",dvValue:"值",dvFormula:"公式",dvOperator:"条件",dvApplyTo:"应用于",dvShowDropdown:"提供下拉箭头",dvIgnoreBlank:"忽略空值",dvShowInputMessage:"选定单元格时显示输入信息",dvInputTitle:"标题",dvInputMessage:"输入信息",dvShowErrorAlert:"输入无效数据时显示出错警告",dvErrorStyle:"样式",dvErrorTitle:"标题",dvErrorMessage:"错误信息",dvClearAll:"全部清除",dvTypeAny:"任何值",dvTypeList:"列表",dvTypeWholeNumber:"整数",dvTypeDecimal:"小数",dvTypeDate:"日期",dvTypeTime:"时间",dvTypeTextLength:"文本长度",dvTypeCustom:"自定义",dvBetween:"介于",dvNotBetween:"不介于",dvEqual:"等于",dvNotEqual:"不等于",dvGreaterThan:"大于",dvGreaterThanOrEqual:"大于等于",dvLessThan:"小于",dvLessThanOrEqual:"小于等于",dvStyleStop:"停止",dvStyleWarning:"警告",dvStyleInformation:"信息",dvErrorTitleDefault:"输入无效",dvMsgList:"请从下拉列表中选择:{values}",dvMsgListEmpty:"请从下拉列表中选择一个有效值",dvMsgBetween:"{type}必须介于 {min} 与 {max} 之间",dvMsgNotBetween:"{type}不能介于 {min} 与 {max} 之间",dvMsgCompare:"{type}必须{op} {value}",dvMsgCustom:"输入不满足条件:{formula}",dvMsgInvalid:"输入的值不符合该单元格的数据验证规则",dvStopDialogTitle:"输入无效",dvWarningDialogTitle:"输入可能无效",dvInformationDialogTitle:"输入提示",dvBtnRetry:"重试",dvBtnContinue:"是",dvBtnNo:"否",dvBtnOk:"确定",dvRangeInvalid:"范围格式无效,例如 A1:B10 或 A2:A100,C2:C100",dvSourceInvalid:"来源不能为空",dvFormulaRequired:"请输入公式",dvValueRequired:"请输入比较值",dvMinRequired:"请输入最小值",dvMaxRequired:"请输入最大值",dvMustBeInteger:"必须为整数",dvMustBeNumber:"必须为数字",dvDateInvalid:"日期格式无效",dvTimeInvalid:"时间格式无效",dvSearchPlaceholder:"搜索",dvNoMatch:"无匹配项",dvClearValidation:"清除数据验证",dvSourceHint:"直接输入逗号分隔的值,或引用区域(如 A1:A10、Sheet2!A1:A10)"},"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",sort:"Sort",sortAsc:"Sort Ascending",sortDesc:"Sort Descending",sortReminderTitle:"Sort Warning",sortReminderMessage:"There is adjacent data to the left or right of your selection. It is not selected and will not be sorted. Include it in the sort?",sortExpandSelection:"Expand the selection",sortCurrentSelection:"Sort the current selection only",insertFunctionTitle:"Insert Function",insertFunctionSelectLabel:"Function",insertFunctionPlaceholder:"Select a function",insertFunctionSearchPlaceholder:"Search a function",insertFunctionFormulaLabel:"Formula",insertFunctionBtn:"Insert",fnDescSum:"Adds all the numbers in a range of cells",fnDescAverage:"Returns the arithmetic mean of the numbers in a range",fnDescCount:"Counts the cells that contain numbers in a range",fnDescIf:"Checks a condition and returns one of two values",fnDescVlookup:"Looks up a value in the first column of a range and returns a value in the same row",fnDescConcatenate:"Joins several text strings into one text string",fnDescMax:"Returns the largest numeric value in a range of cells",fnDescMin:"Returns the smallest numeric value in a range of cells",fnDescSin:"Returns the sine of a given angle (in radians)",fnDescSumif:"Sums the values in a range that meet a specified condition",fnDescPmt:"Calculates the periodic payment for a loan with constant payments and interest",fnDescStdev:"Estimates the sample standard deviation of a supplied set of values",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",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",findOptions:"Find options",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",freezePane:"Freeze Panes",freezePanes:"Freeze Panes",freezeFirstRow:"Freeze First Row",freezeFirstCol:"Freeze First Column",unfreezePanes:"Unfreeze Panes",freezeToRow:"Freeze to Row",freezeToCol:"Freeze to Column",filter:"Filter",clearFilter:"Clear Filter",cancelFilter:"Cancel",filterSearchPlaceholder:"Search",filterSelectAll:"Select All",filterClearAll:"Clear All",filterOk:"OK",filterBlank:"Blanks",filterNonBlank:"Non-blanks",filterText:"Text Filters",filterNumber:"Number Filters",filterDate:"Date Filters",filterEquals:"Equals",filterNotEquals:"Does Not Equal",filterContains:"Contains",filterNotContains:"Does Not Contain",filterStartsWith:"Begins With",filterEndsWith:"Ends With",filterGreaterThan:"Greater Than",filterGreaterThanOrEqual:"Greater Than Or Equal To",filterLessThan:"Less Than",filterLessThanOrEqual:"Less Than Or Equal To",filterBetween:"Between",filterAnd:"And",filterCustom:"Custom Filter",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",outlineGroup:"Group",outlineRows:"Group Rows",outlineColumns:"Group Columns",outlineAddRowGroup:"Add Row Group",outlineAddColumnGroup:"Add Column Group",outlineUngroup:"Ungroup",outlineUngroupRows:"Ungroup Rows",outlineUngroupColumns:"Ungroup Columns",outlineClear:"Clear Outline",outlineClearAll:"Clear All Outlines",outlineExpand:"Expand",outlineCollapse:"Collapse",outlineExpandAll:"Expand All",outlineCollapseAll:"Collapse All",outlineRowsLabel:"Rows",outlineColumnsLabel:"Columns",outlineLevel:"Level",outlineLevelLabel:"Level",outlineNeedRowsOrColumns:"Select entire rows or columns to group",outlineInvalidRange:"Invalid group range: a group needs at least 2 consecutive rows or columns",outlineCrossing:"Group range crosses an existing group, please adjust",outlineTooDeep:"Maximum of 8 outline levels supported",outlineUngroupPartial:"The selection does not fully cover a group, cannot ungroup",autofillMergeSizeError:"To do this, all the merged cells need to be the same size.",outlineSelectAxisTitle:"Create Group",outlineSelectAxisPrompt:"Choose to group by rows or by columns",outlineAlertTitle:"Grouping Notice",conditionalFormat:"Conditional Formatting",cfHighlightRules:"Highlight Cell Rules",cfGreaterThan:"Greater Than",cfGreaterThanOrEqual:"Greater Than Or Equal To",cfLessThan:"Less Than",cfLessThanOrEqual:"Less Than Or Equal To",cfBetween:"Between",cfNotBetween:"Not Between",cfEqual:"Equal To",cfCellIs:"Cell Value",cfNotEqual:"Not Equal To",cfTextContains:"Text Contains",cfTextNotContains:"Text Does Not Contain",cfBlank:"Blanks",cfNotBlank:"Non-blanks",cfDuplicate:"Duplicate Values",cfUnique:"Unique Values",cfFormulaShort:"Formula",cfFormula:"Use a formula to determine which cells to format",cfFormulaExample:"e.g. =$A1>100",cfNewRule:"New Rule",cfManageRules:"Manage Rules",cfClearRules:"Clear Rules",cfClearSelected:"Clear Rules from Selected Cells",cfClearSheet:"Clear Rules from Entire Sheet",cfAppliedTo:"Applies to",cfRule:"Rule",cfFormat:"Format",cfPriority:"Priority",cfStopIfTrue:"Stop If True",cfEnabled:"Enabled",cfDelete:"Delete",cfEdit:"Edit",cfMoveUp:"Move Up",cfMoveDown:"Move Down",cfType:"Type",cfOperator:"When",cfValue:"Value",cfValue2:"To",cfManagerTitle:"Conditional Formatting Rules Manager",cfPreview:"Preview",cfNoRules:"No conditional formatting rules on this sheet",cfRuleTypeGeneric:"Custom Rule",cfBold:"Bold",cfItalic:"Italic",cfUnderline:"Underline",cfFontColor:"Font Color",cfFillColor:"Fill Color",dv:"Data Validation",dvDialogTitle:"Data Validation",dvSettings:"Settings",dvInputMessageTab:"Input Message",dvErrorAlertTab:"Error Alert",dvAllow:"Allow",dvData:"Data",dvSource:"Source",dvMin:"Minimum",dvMax:"Maximum",dvValue:"Value",dvFormula:"Formula",dvOperator:"Operator",dvApplyTo:"Apply to",dvShowDropdown:"In-cell dropdown",dvIgnoreBlank:"Ignore blank",dvShowInputMessage:"Show input message when cell is selected",dvInputTitle:"Title",dvInputMessage:"Input message",dvShowErrorAlert:"Show error alert after invalid data is entered",dvErrorStyle:"Style",dvErrorTitle:"Title",dvErrorMessage:"Error message",dvClearAll:"Clear All",dvTypeAny:"Any value",dvTypeList:"List",dvTypeWholeNumber:"Whole Number",dvTypeDecimal:"Decimal",dvTypeDate:"Date",dvTypeTime:"Time",dvTypeTextLength:"Text Length",dvTypeCustom:"Custom",dvBetween:"between",dvNotBetween:"not between",dvEqual:"equal to",dvNotEqual:"not equal to",dvGreaterThan:"greater than",dvGreaterThanOrEqual:"greater than or equal to",dvLessThan:"less than",dvLessThanOrEqual:"less than or equal to",dvStyleStop:"Stop",dvStyleWarning:"Warning",dvStyleInformation:"Information",dvErrorTitleDefault:"Invalid Input",dvMsgList:"Please select a value from the dropdown list: {values}",dvMsgListEmpty:"Please select a valid value from the dropdown list",dvMsgBetween:"{type} must be between {min} and {max}",dvMsgNotBetween:"{type} must not be between {min} and {max}",dvMsgCompare:"{type} must be {op} {value}",dvMsgCustom:"The input does not satisfy: {formula}",dvMsgInvalid:"The value does not match the data validation rules for this cell",dvStopDialogTitle:"Invalid Input",dvWarningDialogTitle:"Possible Invalid Input",dvInformationDialogTitle:"Input Notice",dvBtnRetry:"Retry",dvBtnContinue:"Yes",dvBtnNo:"No",dvBtnOk:"OK",dvRangeInvalid:"Invalid range, e.g. A1:B10 or A2:A100,C2:C100",dvSourceInvalid:"Source cannot be empty",dvFormulaRequired:"Please enter a formula",dvValueRequired:"Please enter a comparison value",dvMinRequired:"Please enter the minimum value",dvMaxRequired:"Please enter the maximum value",dvMustBeInteger:"Must be an integer",dvMustBeNumber:"Must be a number",dvDateInvalid:"Invalid date format",dvTimeInvalid:"Invalid time format",dvSearchPlaceholder:"Search",dvNoMatch:"No matches",dvClearValidation:"Clear Validation",dvSourceHint:"Enter comma separated values, or reference a range (e.g. A1:A10, Sheet2!A1:A10)"}};function b(e,n){var l;return((l=Ua[e])==null?void 0:l[n])??n}const kn='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',Jl=10,Ka=[{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'}],Ga=[{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}],qa='<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>',Ya='<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>',Xa='<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>',ja='<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>',Za='<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>',Ja='<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>',Qa=[{value:"left",labelKey:"alignLeft",icon:qa},{value:"center",labelKey:"alignCenter",icon:Ya},{value:"right",labelKey:"alignRight",icon:Xa}],ei=[{value:"top",labelKey:"alignTop",icon:ja},{value:"middle",labelKey:"alignMiddle",icon:Za},{value:"bottom",labelKey:"alignBottom",icon:Ja}],ti=[{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>'}],li={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",outlineGroupBg1:"#d5e2f8",outlineGroupBg2:"#f0e2f6",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)"},ni={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",outlineGroupBg1:"#33405f",outlineGroupBg2:"#47335f",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)"},Ql="__nf_custom__",Pl="",en="",pl="@",po="__NF_INVALID__",Wo=2958465,Po=0;function hl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Uo(e){return e==="zh-CN"?"¥":"$"}function oi(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Vr(e){return e.replace(/"([^"]*)"/g,"$1")}function ri(e){let n=e,l;const o=n.match(/^\[([^\]]+)\]/);o&&(l=o[1].toLowerCase(),n=n.slice(o[0].length)),n=oi(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:l};let c=-1;for(let le=n.length-1;le>=0;le--){const ge=n[le];if(ge==="0"||ge==="#"||ge==="?"||ge==="E"){c=le;break}}c<0&&(c=r);const d=r>0?n.slice(0,r):"",y=c<n.length-1?n.slice(c+1):"",g=n.slice(r,c+1),C=/[0#?]/.test(g),m=g.includes(",");let R=g.replace(/,/g,"");if(a){const le=R.search(/E/i);le>=0&&(R=R.slice(0,le))}const I=R.indexOf("."),q=I>=0?R.slice(0,I):R,J=I>=0?R.slice(I+1):"",ee=(J.match(/[0#?]/g)||[]).length,ne=(J.match(/0/g)||[]).length,x=(q.match(/0/g)||[]).length;return{hasDigits:C,decimals:ee,minDecimals:ne,minIntDigits:x,thousands:m,scale:i?100:1,scientific:a,prefix:d,suffix:y,color:l}}function ai(e){const n=[];let l=!1;const o=/\[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=o.exec(e))!==null;){const i=a[0];switch(i){case"[h]":l=!0,n.push({type:"hour",len:0});break;case"[mm]":l=!0,n.push({type:"minute",len:2});break;case"[ss]":l=!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(l?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":n.push(l?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":n.push(l?{type:"minute",len:2}:{type:"month",len:2});break;case"m":n.push(l?{type:"minute",len:1}:{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:Vr(i),len:0}):n.push({type:"literal",text:i,len:0})}}return{tokens:n,isDuration:l}}const Dr=new Map;function ii(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:c}=ai(i);return{kind:c?"duration":"date",sections:[],tokens:r,isDuration:c,raw:e}}return{kind:"number",sections:e.split(";").map(i=>ri(i)),tokens:[],isDuration:!1,raw:e}}function tn(e){const n=Dr.get(e);if(n)return n;const l=ii(e);return Dr.set(e,l),l}function Fr(e,n,l,o,a){const i=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*i)/i,c=r<0,d=Math.abs(r);let g=new Intl.NumberFormat("en-US",{useGrouping:o,minimumIntegerDigits:a,minimumFractionDigits:n,maximumFractionDigits:n}).format(d);if(l<n&&n>0){const m=g.indexOf(".");if(m>=0){const B=g.substring(0,m);let R=g.substring(m+1);R=R.replace(/0+$/,""),R.length<l&&(R=R+"0".repeat(l-R.length)),g=R?`${B}.${R}`:B}}return`${c?"-":""}${g}`}function Ir(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const l=Math.floor(Math.log10(Math.abs(e))),o=e/Math.pow(10,l),a=Fr(o,n,n,!1,1),i=(l>=0?"+":"-")+String(Math.abs(l)).padStart(2,"0");return`${a}E${i}`}function si(e,n,l){if(!l.hasDigits)return Vr(l.prefix+l.suffix);const o=l.scale===100?e*100:e,a=l.scientific?Ir(o,l.decimals):Fr(o,l.decimals,l.minDecimals,l.thousands,l.minIntDigits);return n+l.prefix+a+l.suffix}function ci(e,n){const l=n.sections;if(l.length===0)return String(e);let o,a,i="";return e>0?(o=l[0],a=e):e<0?l[1]?(o=l[1],a=-e):(o=l[0],a=-e,i="-"):(o=l[2]??l[0],a=0),si(a,i,o)}function di(e){return new Date((e-25569)*864e5)}const ui=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],fi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Or=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],mi=["January","February","March","April","May","June","July","August","September","October","November","December"],pi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ar=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function On(e,n){return String(e).padStart(n,"0")}function hi(e,n,l,o){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),c=e.getUTCDay(),d=l==="zh-CN";let y="",g=!1;for(const C of n)switch(C.type){case"literal":y+=C.text??"";break;case"year":y+=C.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":y+=On(g?e.getUTCMinutes():i,C.len);break;case"monthName":y+=C.len>=4?d?ui[i-1]:mi[i-1]:d?fi[i-1]:pi[i-1];break;case"day":y+=On(r,C.len);break;case"weekday":y+=C.len>=4?d?Or[c]:Ar[c]:d?Or[c].slice(2):Ar[c].slice(0,3);break;case"hour":{let m=e.getUTCHours();if(C.len===0){const B=Math.floor(o*86400);m=Math.floor(B/3600)}y+=String(m),g=!0;break}case"minute":y+=On(e.getUTCMinutes(),C.len);break;case"second":y+=On(e.getUTCSeconds(),C.len);break;case"ampm":{const m=e.getUTCHours();y+=m<12?d?"上午":"AM":d?"下午":"PM";break}}return y}function gi(e,n){const l=Math.floor(e*86400),o=Math.floor(l/3600),a=Math.floor(l%3600/60),i=l%60;let r="";for(const c of n)switch(c.type){case"literal":r+=c.text??"";break;case"hour":r+=String(o);break;case"minute":r+=On(a,c.len||2);break;case"second":r+=On(i,c.len||2);break;default:r+=""}return r}function bi(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const l=Math.abs(n);return l!==0&&(l>=1e15||l<1e-9)?Ir(n,9):e}return e}function Ml(e,n,l){if(hl(n))return bi(e);if(n==null||n===pl)return e;const o=tn(n);if(o.kind==="date"||o.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(o.kind==="date"){if(i<Po||i>Wo)return po}else if(i<0)return po;return o.kind==="duration"?gi(i,o.tokens):hi(di(i),o.tokens,l,i)}const a=Number(e);return isNaN(a)?e:ci(a,o)}const yi=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function Ko(e,n){if(n===pl||n==="@")return!1;if(hl(n)){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}const l=tn(n);return!!(l.kind==="number"&&Lr(l))}function Lr(e){return e.sections.some(n=>n.hasDigits)}function _r(e){if(e==null||hl(e)||e===pl||e==="@")return!1;const n=tn(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&Lr(n))}function $r(e,n){if(n==null||hl(n)||n===pl||n==="@")return!1;const l=tn(n),o=Number(e);return Number.isFinite(o)?l.kind==="date"?o<Po||o>Wo:l.kind==="duration"?o<0:!1:!1}const Go=30,qo=0;function Bl(e){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}function zr(e,n){if(e==null||e===Pl||hl(e))return Bl(n);if(e===pl)return!1;const l=tn(e);return l.kind==="date"||l.kind==="duration"?!1:l.sections.some(o=>o.hasDigits)}function wi(e){if(!Bl(e))return 0;const n=String(Number(e));return n.indexOf(".")<0||/e/i.test(n)?0:n.slice(n.indexOf(".")+1).length}function Ci(e,n){if(!zr(e,n))return-1;if(e==null||e===Pl||hl(e))return wi(n);const o=tn(e).sections.find(a=>a.hasDigits);return o?o.decimals:-1}function vi(e,n){let l=0;const o=/\[[^\]]*\]/g;let a;for(;(a=o.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)l=a.index+a[0].length;const i=e.slice(0,l),r=e.slice(l),c=r.search(/[0#?]/);if(c===-1)return e;let d=-1;for(let q=r.length-1;q>=0;q--){const J=r[q];if(J==="0"||J==="#"||J==="?"||J==="E"){d=q;break}}if(d<c)return e;const y=r.slice(c,d+1),g=y.search(/E[+-]/i),C=g>=0?y.slice(0,g):y,m=C.indexOf("."),B=m>=0?(C.slice(m+1).match(/[0#?]/g)||[]).length:0;if(B===n)return e;let R;if(m<0)R=n>0?C+"."+"0".repeat(n):C;else if(n>B)R=C+"0".repeat(n-B);else{let q=B-n;const J=C.split("");for(let ee=J.length-1;ee>=0&&q>0;ee--){const ne=J[ee];(ne==="0"||ne==="#"||ne==="?")&&(J.splice(ee,1),q--)}R=J.join(""),n===0&&R.endsWith(".")&&(R=R.slice(0,-1))}const I=R+(g>=0?y.slice(g):"");return i+r.slice(0,c)+I+r.slice(d+1)}function ki(e,n){if(!Number.isInteger(n)||n<qo||n>Go||e===Pl)return null;if(e==null||hl(e))return n>0?"0."+"0".repeat(n):"0";if(e===pl)return null;const l=tn(e);return l.kind==="date"||l.kind==="duration"||!l.sections.some(o=>o.hasDigits)?null:e.split(";").map(o=>vi(o,n)).join(";")}const Yo=["¥","$","€","£"];function Hr(e,n){if(e==null||e===Pl)return e??en;if(hl(e))return en;if(e===pl||e==="@")return pl;const l=Uo(n),o=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=`${l}#,##0.00;(${l}#,##0.00);${l}"-"`,r="#,##0.00;[Red](#,##0.00)";if(Wr(n).some(B=>B.value===e))return e;const d=e.replace(/\[[^\]]*\]/gi,B=>/^\[(h|mm|ss)\]$/i.test(B)?B:"");if(/\[(h|mm|ss)\]/i.test(d)&&!/[yd]/i.test(d))return"[h]:mm:ss";const y=/[yd]/i.test(d),g=/h|s|AM\/PM/i.test(d);if(y&&g)return a;if(y||/AM\/PM/i.test(d))return o;if(g)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 C=Yo.find(B=>e.startsWith(B));if(C)return e.includes("(")?i:/\.\d/.test(e.slice(C.length))?l+"#,##0.00":l+"#,##0";const m=tn(e);return m.kind==="number"&&m.sections.some(B=>B.hasDigits)?"#,##0.00":Ql}function Ei(e,n){return new Date(Date.UTC(e,n,0)).getUTCDate()}function Ri(e,n,l){const o=Date.UTC(e,n-1,l)/864e5+25569;return o<=60?o-1:o}function Ul(e,n,l=new Date){const o=e.trim();if(!o||o.startsWith("=")||Bl(o))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 c(m){const B=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(m);if(!B)return null;const R=Number(B[1]),I=Number(B[2]),q=B[3]!==void 0?Number(B[3]):0;return R>23||I>59||q>59?null:(R*3600+I*60+q)/86400}function d(m){let B=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(m),R,I,q;if(B)R=Number(B[1]),I=Number(B[2]),q=Number(B[3]);else if(B=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(m))R=Number(B[1]),I=Number(B[2]),q=Number(B[3]);else if(B=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(m))I=Number(B[1]),q=Number(B[2]),R=Number(B[3]);else if(B=/^(\d{1,2})[-/](\d{1,2})$/.exec(m))R=l.getUTCFullYear(),I=Number(B[1]),q=Number(B[2]);else return null;if(R<1900||R>9999||I<1||I>12||q<1||q>Ei(R,I))return null;const J=Ri(R,I,q);return J>=Po&&J<=Wo?J:null}const y=c(o);if(y!==null)return{serial:y,format:r};const g=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(o);if(g){const m=d(g[1].trim()),B=c(g[2]);if(m!==null&&B!==null)return{serial:m+B,format:i}}const C=d(o);return C!==null?{serial:C,format:a}:null}function ho(e,n){const l=e.trim();if(!l||l.startsWith("=")||!(l.includes(",")||l.includes("%")||Yo.some(ee=>l.startsWith(ee)))||Ul(l,n))return null;const a=Yo.find(ee=>l.startsWith(ee)),i=a?l.slice(a.length).trim():l;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const c=r[1]==="-"?-1:1,d=r[2].replace(/,/g,""),y=r[3],g=(r[4]??"")==="%",C=y?y.length:0,m=+(d+(y?"."+y:""));if(!Number.isFinite(m))return null;const R=i.includes(",")?"#,##0":"0",I=C>0?"."+"0".repeat(C):"",q=(a??"")+R+I+(g?"%":"");let J=m*c;return g&&(J=J/100),J=Math.round(J*1e12)/1e12,{num:J,format:q}}function Si(e,n,l,o){const a=Uo(e),i=o?"#,##0":"0",r=l>0?"."+"0".repeat(l):"",c=i+r;switch(n){case"general":return"";case"text":return pl;case"custom":return"";case"number":return c;case"percent":return c+"%";case"scientific":return"0."+"0".repeat(l)+"E+00";case"currency":return a+c;case"currencyRounded":return a+(o?"#,##0":"0");case"accounting":return`${a}${c};(${a}${c});${a}"-"`;case"financial":return`${c};[Red](${c})`;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 Wr(e){const n=Uo(e);return[{label:b(e,"nfGeneral"),value:en},{label:b(e,"nfText"),value:pl},{label:b(e,"nfNumber"),value:"#,##0.00"},{label:b(e,"nfPercent"),value:"0.00%"},{label:b(e,"nfScientific"),value:"0.00E+00"},{label:b(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:b(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:b(e,"nfCurrency"),value:n+"#,##0.00"},{label:b(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:b(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:b(e,"nfTime"),value:"h:mm:ss"},{label:b(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:b(e,"nfDuration"),value:"[h]:mm:ss"},{label:b(e,"nfCustom"),value:Ql}]}const Mi=["title"],Bi=["innerHTML"],Ni={class:"sp-dropdown__value"},xi=["disabled"],Ti=["placeholder"],Vi=["disabled","onClick"],Di=["innerHTML"],Fi={class:"sp-dropdown__item-label"},Ii={key:2,class:"sp-dropdown__empty"},Oi=["disabled"],Ai=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:""},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:""},triggerIcon:{default:""},triggerLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(0),r=t.ref(null),c=t.ref(null),d=t.ref(null),y=t.ref({top:0,up:!1}),g=t.ref(void 0),C=t.ref(0),m=t.ref(!1),B=t.ref(""),R=t.ref(null),I=t.computed(()=>l.options.find(me=>String(me.value)===String(l.modelValue))),q=t.computed(()=>l.menuWidth!==void 0?l.menuWidth:g.value),J=t.computed(()=>{if(!l.searchable||!B.value.trim())return l.options;const me=B.value.trim().toLowerCase();return l.options.filter(Me=>String(Me.label??"").toLowerCase().includes(me))}),ee=t.computed(()=>J.value.length>0),ne=t.computed(()=>Math.min(l.visibleCount,J.value.length)),x=t.computed(()=>J.value.slice(i.value,i.value+ne.value)),le=t.computed(()=>i.value>0),ge=t.computed(()=>i.value+ne.value<J.value.length),fe=t.computed(()=>J.value.length>ne.value);function Ce(me){i.value=Math.max(0,Math.min(J.value.length-ne.value,i.value+me))}function $e(){const me=l.triggerEl??r.value;if(!me)return;const Me=me.getBoundingClientRect();g.value=Me.width,a.value=!0,l.searchable&&(B.value=""),l.modelOpen!==void 0&&o("update:modelOpen",!0);const T=Me.bottom+4;l.align==="right"?y.value={right:window.innerWidth-Me.right,top:T,up:!1}:y.value={left:Me.left,top:T,up:!1};const se=J.value.findIndex(ie=>String(ie.value)===String(l.modelValue));i.value=se>=0?Math.max(0,Math.min(se-Math.floor(ne.value/2),J.value.length-ne.value)):0,l.searchable&&t.nextTick(()=>{var ie;return(ie=R.value)==null?void 0:ie.focus()}),t.nextTick(()=>{const ie=l.triggerEl??r.value;if(!ie)return;const re=ie.getBoundingClientRect(),K=d.value;if(!K)return;const $=K.offsetHeight,de=window.innerHeight-re.bottom-8,z=re.top-8,_=de<$&&z>0;let ae=_?re.top-$-4:re.bottom+4;ae=Math.max(8,Math.min(window.innerHeight-$-8,ae)),l.align==="right"?y.value={right:window.innerWidth-re.right,top:ae,up:_}:y.value={left:re.left,top:ae,up:_}})}function ze(){a.value=!1,B.value="",l.modelOpen!==void 0&&o("update:modelOpen",!1)}function et(){a.value?ze():$e()}function nt(me){me.disabled||(o("update:modelValue",me.value),o("change",me.value),ze())}function F(me){var T,se;if(!a.value)return;const Me=me.target;(T=r.value)!=null&&T.contains(Me)||(se=d.value)!=null&&se.contains(Me)||ze()}function A(me){a.value&&(me.preventDefault(),Ce(me.deltaY>0?1:-1))}t.watch(a,me=>{t.nextTick(()=>{var Me,T;me?((Me=c.value)==null||Me.addEventListener("wheel",A,{passive:!1}),document.addEventListener("keydown",Q)):((T=c.value)==null||T.removeEventListener("wheel",A),document.removeEventListener("keydown",Q))})});function Q(me){a.value&&me.key==="Escape"&&ze()}t.watch(()=>l.modelOpen,me=>{me!==void 0&&me!==a.value&&(me?$e():ze())});function we(me){a.value&&(C.value=me.touches[0].clientY,m.value=!0)}function xe(me){if(!a.value||!m.value)return;const Me=me.touches[0].clientY-C.value;Math.abs(Me)>5&&(Ce(Me<0?1:-1),C.value=me.touches[0].clientY)}function X(){m.value=!1}function Ne(me){me.key==="Escape"&&(me.stopPropagation(),ze())}return t.onMounted(()=>{document.addEventListener("pointerdown",F),window.addEventListener("resize",ze),window.addEventListener("scroll",ze,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",F),document.removeEventListener("keydown",Q),window.removeEventListener("resize",ze),window.removeEventListener("scroll",ze,!0)}),(me,Me)=>{var T,se,ie,re,K;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:et},[(T=I.value)!=null&&T.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((se=I.value)==null?void 0:se.icon)||e.triggerIcon},null,8,Bi)):t.createCommentVNode("",!0),t.createElementVNode("span",Ni,t.toDisplayString((ie=I.value)!=null&&ie.icon||e.triggerIcon?((re=I.value)==null?void 0:re.label)??e.triggerLabel:((K=I.value)==null?void 0:K.label)??e.fallbackLabel),1),Me[5]||(Me[5]=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,Mi)),(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:d,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:q.value!==void 0?typeof q.value=="number"?q.value+"px":q.value:void 0}),onKeydown:Ne,onMousedown:Me[4]||(Me[4]=t.withModifiers(()=>{},["prevent"]))},[fe.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!le.value}]),disabled:!le.value,onClick:Me[0]||(Me[0]=$=>Ce(-1))},[...Me[6]||(Me[6]=[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,xi)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:R,"onUpdate:modelValue":Me[1]||(Me[1]=$=>B.value=$),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:Me[2]||(Me[2]=t.withModifiers(()=>{},["stop"]))},null,40,Ti)),[[t.vModelText,B.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"sp-dropdown__list",onTouchstart:we,onTouchmove:xe,onTouchend:X},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,$=>(t.openBlock(),t.createElementBlock("button",{key:String($.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!$.disabled&&String($.value)===String(e.modelValue),"sp-dropdown__item--disabled":$.disabled}]),disabled:$.disabled,onClick:de=>nt($)},[$.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:$.icon},null,8,Di)):t.createCommentVNode("",!0),t.createElementVNode("span",Fi,t.toDisplayString($.label),1)],10,Vi))),128))],544),e.searchable&&!ee.value?(t.openBlock(),t.createElementBlock("div",Ii," 无匹配 ")):t.createCommentVNode("",!0),fe.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ge.value}]),disabled:!ge.value,onClick:Me[3]||(Me[3]=$=>Ce(1))},[...Me[7]||(Me[7]=[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,Oi)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Vt=(e,n)=>{const l=e.__vccOpts||e;for(const[o,a]of n)l[o]=a;return l},_t=Vt(Ai,[["__scopeId","data-v-391d39ca"]]),Li=["title","onClick"],go=Vt(t.defineComponent({__name:"color-picker",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:l}){const o=e,a=l,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"}]],c=t.computed(()=>o.colorKey==="fill"?r:i);function d(ee){return b(o.locale,ee)}function y(ee){const ne=o.currentColor;return!ne&&!ee?!0:ne?ne.toLowerCase()===ee.toLowerCase():!1}const g=t.ref(!1),C=t.ref(null),m=t.ref(null),B=t.ref({top:0});t.watch(()=>o.modelOpen,ee=>{ee!==void 0&&ee!==g.value&&(ee?I():q())});function R(ee){const ne=C.value,x=m.value,le=ee.target;ne&&ne.contains(le)||x&&x.contains(le)||q()}function I(){const ee=o.triggerEl??C.value;if(!ee)return;g.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const ne=ee.getBoundingClientRect();let x=window.innerWidth-ne.right;const le=120;let ge;ne.left-le<4&&(x=void 0,ge=Math.max(4,ne.left)),B.value=x!==void 0?{right:x,top:ne.bottom+4}:{left:ge,top:ne.bottom+4},t.nextTick(()=>{const fe=o.triggerEl??C.value;if(!fe)return;const Ce=fe.getBoundingClientRect(),$e=m.value;if(!$e)return;const ze=$e.offsetHeight,et=window.innerHeight-Ce.bottom-8,nt=Ce.top-8;let A=et<ze&&nt>0?Ce.top-ze-4:Ce.bottom+4;A=Math.max(4,Math.min(window.innerHeight-ze-4,A)),B.value=x!==void 0?{right:window.innerWidth-Ce.right,top:A}:{left:ge,top:A},document.addEventListener("pointerdown",R)})}function q(){g.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function J(ee){a("update:modelValue",ee),a("change",ee),q()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),n({open:g,openMenu:I,close:q}),(ee,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:C,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:m,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:ne[0]||(ne[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(x,le)=>(t.openBlock(),t.createElementBlock("div",{key:le,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x,ge=>(t.openBlock(),t.createElementBlock("button",{key:ge.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":y(ge.value)}]),title:d(ge.key),style:t.normalizeStyle({background:ge.value||"transparent",border:ge.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:fe=>J(ge.value)},null,14,Li))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-34b2d484"]]),_i=["title","onClick"],$i={viewBox:"0 0 30 30",class:"border-picker__icon"},zi=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Hi={class:"border-picker__label"},Wi=Vt(t.defineComponent({__name:"border-picker",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:l}){const o=e,a=l,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}],c={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"]},d={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function y(ee,ne){return d[ee].includes(ne)?"thick":c[ee].includes(ne)?"solid":"dashed"}const g=t.ref(!1),C=t.ref(null),m=t.ref(null),B=t.ref({top:0});t.watch(()=>o.modelOpen,ee=>{ee!==void 0&&ee!==g.value&&(ee?I():q())});function R(ee){const ne=C.value,x=m.value,le=ee.target;ne&&ne.contains(le)||x&&x.contains(le)||q()}function I(){const ee=o.triggerEl??C.value;if(!ee)return;g.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const ne=ee.getBoundingClientRect();let x=window.innerWidth-ne.right;const le=160;let ge;ne.left-le<4&&(x=void 0,ge=Math.max(4,ne.left)),B.value=x!==void 0?{right:x,top:ne.bottom+4}:{left:ge,top:ne.bottom+4},t.nextTick(()=>{const fe=o.triggerEl??C.value;if(!fe)return;const Ce=fe.getBoundingClientRect(),$e=m.value;if(!$e)return;const ze=$e.offsetHeight,et=window.innerHeight-Ce.bottom-8,nt=Ce.top-8;let A=et<ze&&nt>0?Ce.top-ze-4:Ce.bottom+4;A=Math.max(4,Math.min(window.innerHeight-ze-4,A)),B.value=x!==void 0?{right:window.innerWidth-Ce.right,top:A}:{left:ge,top:A},document.addEventListener("pointerdown",R)})}function q(){g.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function J(ee){a("change",ee),q()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),n({open:g,openMenu:I,close:q}),(ee,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:C,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[g.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:m,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:ne[0]||(ne[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,x=>t.createElementVNode("button",{key:x.key,class:"border-picker__item",title:t.unref(b)(e.locale,x.i18nKey),onClick:le=>J(x.key)},[(t.openBlock(),t.createElementBlock("svg",$i,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,le=>t.createElementVNode("line",{key:le.name,x1:le.x1,y1:le.y1,x2:le.x2,y2:le.y2,stroke:"currentColor","stroke-width":y(x.key,le.name)==="thick"?3:1.5,"stroke-dasharray":y(x.key,le.name)==="dashed"?"0 4":"none","stroke-linecap":y(x.key,le.name)==="dashed"?"round":"square"},null,8,zi)),64))])),t.createElementVNode("span",Hi,t.toDisplayString(t.unref(b)(e.locale,x.i18nKey)),1)],8,_i)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-a6e24710"]]),Pi=["title","onClick"],Ui={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Ki=["x1","y1","x2","y2"],Gi=["d"],qi={class:"sort-picker__label"},Yi=Vt(t.defineComponent({__name:"sort-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],r=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],c={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},d=t.ref(!1),y=t.ref(null),g=t.ref(null),C=t.ref({top:0});t.watch(()=>o.modelOpen,q=>{q!==void 0&&q!==d.value&&(q?B():R())});function m(q){const J=y.value,ee=g.value,ne=q.target;J&&J.contains(ne)||ee&&ee.contains(ne)||R()}function B(){const q=o.triggerEl??y.value;if(!q)return;d.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const J=q.getBoundingClientRect();let ee=window.innerWidth-J.right;const ne=160;let x;J.left-ne<4&&(ee=void 0,x=Math.max(4,J.left)),C.value=ee!==void 0?{right:ee,top:J.bottom+4}:{left:x,top:J.bottom+4},t.nextTick(()=>{const le=o.triggerEl??y.value;if(!le)return;const ge=le.getBoundingClientRect(),fe=g.value;if(!fe)return;const Ce=fe.offsetHeight,$e=window.innerHeight-ge.bottom-8,ze=ge.top-8;let nt=$e<Ce&&ze>0?ge.top-Ce-4:ge.bottom+4;nt=Math.max(4,Math.min(window.innerHeight-Ce-4,nt)),C.value=ee!==void 0?{right:window.innerWidth-ge.right,top:nt}:{left:x,top:nt},document.addEventListener("pointerdown",m)})}function R(){d.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",m)}function I(q){a("change",q),R()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",m)}),n({open:d,openMenu:B,close:R}),(q,J)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:g,class:"sort-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:J[0]||(J[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ee=>t.createElementVNode("button",{key:ee.key,class:"sort-picker__item",title:t.unref(b)(e.locale,ee.i18nKey),onClick:ne=>I(ee.key)},[(t.openBlock(),t.createElementBlock("svg",Ui,[(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},null,8,Ki)),64)),t.createElementVNode("path",{d:c[ee.key]},null,8,Gi)])),t.createElementVNode("span",qi,t.toDisplayString(t.unref(b)(e.locale,ee.i18nKey)),1)],8,Pi)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-a6111c69"]]),Xi={key:0,class:"outline-picker__sep"},ji=["onMouseenter","onClick"],Zi={class:"outline-picker__label"},Ji={key:0,class:"outline-picker__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},Qi={key:1,class:"outline-picker__sub"},es=["onClick"],ts=Vt(t.defineComponent({__name:"outline-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","action"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=[{key:"group",i18nKey:"outlineGroup",children:[{key:"group-rows",i18nKey:"outlineRows"},{key:"group-cols",i18nKey:"outlineColumns"}]},{key:"ungroup",i18nKey:"outlineUngroup",children:[{key:"ungroup-rows",i18nKey:"outlineUngroupRows"},{key:"ungroup-cols",i18nKey:"outlineUngroupColumns"}]},{key:"sep1",i18nKey:"_sep",disabled:!0,sep:!0},{key:"expand-all",i18nKey:"outlineExpandAll"},{key:"collapse-all",i18nKey:"outlineCollapseAll"},{key:"sep2",i18nKey:"_sep",disabled:!0,sep:!0},{key:"clear",i18nKey:"outlineClearAll"}],r=t.ref(!1),c=t.ref(null),d=t.ref(null),y=t.ref({top:0}),g=t.ref(null);t.watch(()=>o.modelOpen,I=>{I!==void 0&&I!==r.value&&(I?m():B())});function C(I){const q=c.value,J=d.value,ee=I.target;q&&q.contains(ee)||J&&J.contains(ee)||B()}function m(){const I=o.triggerEl??c.value;if(!I)return;r.value=!0,g.value=null,o.modelOpen!==void 0&&a("update:modelOpen",!0);const q=I.getBoundingClientRect();let J=window.innerWidth-q.right;const ee=168;let ne;q.left-ee<4&&(J=void 0,ne=Math.max(4,q.left)),y.value=J!==void 0?{right:J,top:q.bottom+4}:{left:ne,top:q.bottom+4},t.nextTick(()=>{const x=o.triggerEl??c.value;if(!x)return;const le=x.getBoundingClientRect(),ge=d.value;if(!ge)return;const fe=ge.offsetHeight,Ce=window.innerHeight-le.bottom-8,$e=le.top-8;let et=Ce<fe&&$e>0?le.top-fe-4:le.bottom+4;et=Math.max(4,Math.min(window.innerHeight-fe-4,et)),y.value=J!==void 0?{right:window.innerWidth-le.right,top:et}:{left:ne,top:et},document.addEventListener("pointerdown",C)})}function B(){r.value=!1,g.value=null,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",C)}function R(I){a("action",I),B()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",C)}),n({open:r,openMenu:m,close:B}),(I,q)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:c,class:"outline-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:d,class:"outline-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:q[1]||(q[1]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,J=>{var ee,ne;return t.openBlock(),t.createElementBlock(t.Fragment,{key:J.key},[J.sep?(t.openBlock(),t.createElementBlock("div",Xi)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["outline-picker__item",{"outline-picker__item--open":g.value===J.key}]),onMouseenter:x=>{var le;return g.value=(le=J.children)!=null&&le.length?J.key:null},onClick:x=>{var le;return(le=J.children)!=null&&le.length?null:R(J.key)}},[t.createElementVNode("span",Zi,t.toDisplayString(t.unref(b)(e.locale,J.i18nKey)),1),(ee=J.children)!=null&&ee.length?(t.openBlock(),t.createElementBlock("svg",Ji,[...q[2]||(q[2]=[t.createElementVNode("path",{d:"M397.387 180.053a32 32 0 0 1 0 45.227L678.107 512l-280.72 286.72a32 32 0 1 1-45.227-45.227l258.88-241.493L352.16 225.28a32 32 0 0 1 0-45.227l45.227 0z"},null,-1)])])):t.createCommentVNode("",!0),(ne=J.children)!=null&&ne.length&&g.value===J.key?(t.openBlock(),t.createElementBlock("div",Qi,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.children,x=>(t.openBlock(),t.createElementBlock("div",{key:x.key,class:"outline-picker__sub-item",onMouseenter:q[0]||(q[0]=t.withModifiers(()=>{},["stop"])),onClick:t.withModifiers(le=>R(x.key),["stop"])},t.toDisplayString(t.unref(b)(e.locale,x.i18nKey)),41,es))),128))])):t.createCommentVNode("",!0)],42,ji))],64)}),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-90b16ce1"]]),ls=["title","onClick"],ns=["innerHTML"],os={class:"merge-picker__label"},rs=Vt(t.defineComponent({__name:"merge-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:l}){const o=e,a=l,i=t.ref(!1),r=t.ref(null),c=t.ref(null),d=t.ref({top:0});t.watch(()=>o.modelOpen,B=>{B!==void 0&&B!==i.value&&(B?g():C())});function y(B){const R=r.value,I=c.value,q=B.target;R&&R.contains(q)||I&&I.contains(q)||C()}function g(){const B=o.triggerEl??r.value;if(!B)return;i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const R=B.getBoundingClientRect();let I=window.innerWidth-R.right;const q=160;let J;R.left-q<4&&(I=void 0,J=Math.max(4,R.left)),d.value=I!==void 0?{right:I,top:R.bottom+4}:{left:J,top:R.bottom+4},t.nextTick(()=>{const ee=o.triggerEl??r.value;if(!ee)return;const ne=ee.getBoundingClientRect(),x=c.value;if(!x)return;const le=x.offsetHeight,ge=window.innerHeight-ne.bottom-8,fe=ne.top-8;let $e=ge<le&&fe>0?ne.top-le-4:ne.bottom+4;$e=Math.max(4,Math.min(window.innerHeight-le-4,$e)),d.value=I!==void 0?{right:window.innerWidth-ne.right,top:$e}:{left:J,top:$e},document.addEventListener("pointerdown",y)})}function C(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",y)}function m(B){a("change",B),C()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y)}),n({open:i,openMenu:g,close:C}),(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:c,class:"merge-picker__menu",style:t.normalizeStyle({left:d.value.left!==void 0?d.value.left+"px":void 0,right:d.value.right!==void 0?d.value.right+"px":void 0,top:d.value.top+"px"}),onMousedown:R[0]||(R[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ti),I=>(t.openBlock(),t.createElementBlock("button",{key:I.key,class:"merge-picker__item",title:t.unref(b)(e.locale,I.labelKey),onClick:q=>m(I.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:I.icon},null,8,ns),t.createElementVNode("span",os,t.toDisplayString(t.unref(b)(e.locale,I.labelKey)),1)],8,ls))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-78cf6d86"]]),as=["title","disabled"],is={class:"cf-menu-trigger__label"},ss=["disabled"],cs=["disabled"],ds=["disabled"],us=["disabled"],fs=["disabled"],ms=["disabled"],ps=["disabled"],hs=["onClick"],gs=["disabled"],bs=["disabled"],ys=["disabled"],ws=["disabled"],Cs=Vt(t.defineComponent({__name:"conditional-format-menu",props:{locale:{},hasSelection:{type:Boolean},themeVars:{default:()=>({})}},emits:["preset","new-rule","manage","clear"],setup(e,{emit:n}){const l=n,o=t.ref(null),a=t.ref(null),i=t.ref(null),r=t.ref(null),c=t.ref(null),d=t.ref(!1),y=t.ref(null),g=t.ref("right"),C=t.ref("right"),m=t.ref({right:0,top:0,up:!1}),B=t.ref(!1),R=t.ref(!1),I=t.ref(!1),q=t.ref(!1),J=t.ref(!1),ee=t.ref(!1),ne=t.ref({top:0}),x=t.ref({top:0});let le;const ge=[{type:"equal",key:"cfEqual"},{type:"notEqual",key:"cfNotEqual"},{type:"greaterThan",key:"cfGreaterThan"},{type:"greaterThanOrEqual",key:"cfGreaterThanOrEqual"},{type:"lessThan",key:"cfLessThan"},{type:"lessThanOrEqual",key:"cfLessThanOrEqual"},{type:"between",key:"cfBetween"},{type:"notBetween",key:"cfNotBetween"},{type:"textContains",key:"cfTextContains"},{type:"textNotContains",key:"cfTextNotContains"}];function fe(){d.value?$e():Ce()}function Ce(){const K=a.value;if(!K)return;const $=K.getBoundingClientRect();d.value=!0,y.value=null,m.value={right:window.innerWidth-$.right,top:$.bottom+4,up:!1},t.nextTick(()=>{var Le;const de=(Le=i.value)==null?void 0:Le.closest(".cf-menu");if(!de)return;const z=de.offsetHeight,_=window.innerHeight-$.bottom-8,ae=$.top-8,Ke=_<z&&ae>0;let Fe=Ke?$.top-z-4:$.bottom+4;Fe=Math.max(8,Math.min(window.innerHeight-z-8,Fe)),m.value={right:window.innerWidth-$.right,top:Fe,up:Ke},ze()})}function $e(){d.value=!1,clearTimeout(le),y.value=null}function ze(){const K=i.value;K&&(B.value=K.scrollTop>1,R.value=K.scrollTop+K.clientHeight<K.scrollHeight-1)}function et(K){const $=i.value;$&&($.scrollTop=Math.max(0,Math.min($.scrollHeight-$.clientHeight,$.scrollTop+K*30)))}function nt(K){const $=K==="highlight"?r.value:c.value;if(!$)return;const de=$.scrollTop>1,z=$.scrollTop+$.clientHeight<$.scrollHeight-1;K==="highlight"?(I.value=de,q.value=z):(J.value=de,ee.value=z)}function F(K,$){const de=K==="highlight"?r.value:c.value;de&&(de.scrollTop=Math.max(0,Math.min(de.scrollHeight-de.clientHeight,de.scrollTop+$*30)))}function A(K,$){K&&(K.scrollHeight<=K.clientHeight||($.preventDefault(),K.scrollTop=Math.max(0,Math.min(K.scrollHeight-K.clientHeight,K.scrollTop+$.deltaY))))}function Q(K){A(i.value,K),ze()}function we(K){A(r.value,K),nt("highlight")}function xe(K){A(c.value,K),nt("clear")}function X(K){var de,z,_,ae,Ke,Fe;if(!d.value)return;const $=K.target;(de=o.value)!=null&&de.contains($)||(z=i.value)!=null&&z.contains($)||(ae=(_=r.value)==null?void 0:_.closest(".cf-submenu-wrap"))!=null&&ae.contains($)||(Fe=(Ke=c.value)==null?void 0:Ke.closest(".cf-submenu-wrap"))!=null&&Fe.contains($)||$e()}function Ne(K,$){clearTimeout(le),y.value=K,t.nextTick(()=>{var Je,Te;const de=($==null?void 0:$.currentTarget)instanceof HTMLElement?$.currentTarget:null;if(!de)return;const z=de.getBoundingClientRect(),_=K==="highlight"?(Je=r.value)==null?void 0:Je.closest(".cf-submenu-wrap"):(Te=c.value)==null?void 0:Te.closest(".cf-submenu-wrap");if(!_)return;const ae=_.offsetWidth,Ke=z.right+ae+8>window.innerWidth,Fe=z.left-ae-8<0;let Le="right";(Ke&&!Fe||Ke&&Fe)&&(Le="left"),K==="highlight"?g.value=Le:C.value=Le;const Be=Math.max(8,Math.min(window.innerHeight-30,z.top-4)),qe=Le==="right"?{left:z.right+4,top:Be}:{right:window.innerWidth-z.left+4,top:Be};K==="highlight"?ne.value=qe:x.value=qe,nt(K)})}function me(){clearTimeout(le),le=setTimeout(()=>{y.value=null},150)}function Me(){clearTimeout(le)}function T(K){l("preset",K),$e()}function se(){l("new-rule"),$e()}function ie(){l("manage"),$e()}function re(K){l("clear",K),$e()}return t.onMounted(()=>{document.addEventListener("pointerdown",X),window.addEventListener("resize",$e),window.addEventListener("scroll",$e,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",X),window.removeEventListener("resize",$e),window.removeEventListener("scroll",$e,!0)}),(K,$)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:o,class:"cf-menu-root"},[t.createElementVNode("button",{ref_key:"btnRef",ref:a,type:"button",class:"toolbar-btn cf-menu-trigger",title:t.unref(b)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:fe},[$[22]||($[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-7b3d8228><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-7b3d8228></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-7b3d8228></path><path d="M324.022857 109.714286v674.596571h-73.142857V109.714286zM584.850286 109.714286v341.942857h-73.142857V109.714286zM1060.278857 512h-658.285714v475.428571h658.285714V512z m-73.216 73.142857v329.142857h-512V585.142857h512z" data-v-7b3d8228></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-7b3d8228></path></svg>',1)),t.createElementVNode("span",is,t.toDisplayString(t.unref(b)(e.locale,"conditionalFormat")),1),$[23]||($[23]=t.createElementVNode("svg",{class:"cf-menu-trigger__caret",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,as),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:m.value.right+"px",top:m.value.top+"px"}),onClick:$[8]||($[8]=t.withModifiers(()=>{},["stop"])),onMousedown:$[9]||($[9]=t.withModifiers(()=>{},["prevent"]))},[B.value||R.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!B.value}]),disabled:!B.value,onClick:$[0]||($[0]=de=>et(-1))},[...$[24]||($[24]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,ss)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:i,class:"cf-menu__body",onScroll:ze,onWheelPassive:Q},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:$[1]||($[1]=de=>Ne("highlight",de)),onMouseleave:me},[t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"cfHighlightRules")),1),$[25]||($[25]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32),$[27]||($[27]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:$[2]||($[2]=de=>e.hasSelection&&T("blank"))},t.toDisplayString(t.unref(b)(e.locale,"cfBlank")),11,cs),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:$[3]||($[3]=de=>e.hasSelection&&T("notBlank"))},t.toDisplayString(t.unref(b)(e.locale,"cfNotBlank")),11,ds),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:$[4]||($[4]=de=>e.hasSelection&&T("duplicate"))},t.toDisplayString(t.unref(b)(e.locale,"cfDuplicate")),11,us),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:$[5]||($[5]=de=>e.hasSelection&&T("unique"))},t.toDisplayString(t.unref(b)(e.locale,"cfUnique")),11,fs),$[28]||($[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:se},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:ie},t.toDisplayString(t.unref(b)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:$[6]||($[6]=de=>Ne("clear",de)),onMouseleave:me},[t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"cfClearRules")),1),$[26]||($[26]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32)],544),B.value||R.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!R.value}]),disabled:!R.value,onClick:$[7]||($[7]=de=>et(1))},[...$[29]||($[29]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,ms)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[d.value&&y.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":g.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:ne.value.left!==void 0?ne.value.left+"px":void 0,right:ne.value.right!==void 0?ne.value.right+"px":void 0,top:ne.value.top+"px"}),onClick:$[13]||($[13]=t.withModifiers(()=>{},["stop"])),onMousedown:$[14]||($[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:Me,onMouseleave:me},[I.value||q.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!I.value}]),disabled:!I.value,onClick:$[10]||($[10]=de=>F("highlight",-1))},[...$[30]||($[30]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,ps)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:r,class:"cf-submenu",onScroll:$[11]||($[11]=de=>nt("highlight")),onWheelPassive:we},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ge,de=>t.createElementVNode("button",{key:de.type,type:"button",class:"cf-menu__subitem",onClick:z=>T(de.type)},t.toDisplayString(t.unref(b)(e.locale,de.key)),9,hs)),64))],544),I.value||q.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!q.value}]),disabled:!q.value,onClick:$[12]||($[12]=de=>F("highlight",1))},[...$[31]||($[31]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,gs)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-sub-pop"},{default:t.withCtx(()=>[d.value&&y.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":C.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:x.value.left!==void 0?x.value.left+"px":void 0,right:x.value.right!==void 0?x.value.right+"px":void 0,top:x.value.top+"px"}),onClick:$[20]||($[20]=t.withModifiers(()=>{},["stop"])),onMousedown:$[21]||($[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:Me,onMouseleave:me},[J.value||ee.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!J.value}]),disabled:!J.value,onClick:$[15]||($[15]=de=>F("clear",-1))},[...$[32]||($[32]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,bs)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:c,class:"cf-submenu",onScroll:$[18]||($[18]=de=>nt("clear")),onWheelPassive:xe},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__subitem",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:$[16]||($[16]=de=>e.hasSelection&&re("selection"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSelected")),11,ys),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:$[17]||($[17]=de=>re("sheet"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSheet")),1)],544),J.value||ee.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ee.value}]),disabled:!ee.value,onClick:$[19]||($[19]=de=>F("clear",1))},[...$[33]||($[33]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,ws)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-7b3d8228"]]),vs=["disabled","title","onClick"],ks={class:"calc-picker__label"},Es=Vt(t.defineComponent({__name:"calc-picker",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:l}){const o=e,a=l,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),c=t.ref(null),d=t.ref(null),y=t.ref({top:0});t.watch(()=>o.modelOpen,R=>{R!==void 0&&R!==r.value&&(R?C():m())});function g(R){const I=c.value,q=d.value,J=R.target;I&&I.contains(J)||q&&q.contains(J)||m()}function C(){const R=o.triggerEl??c.value;if(!R)return;r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0);const I=R.getBoundingClientRect();let q=window.innerWidth-I.right;const J=160;let ee;I.left-J<4&&(q=void 0,ee=Math.max(4,I.left)),y.value=q!==void 0?{right:q,top:I.bottom+4}:{left:ee,top:I.bottom+4},t.nextTick(()=>{const ne=o.triggerEl??c.value;if(!ne)return;const x=ne.getBoundingClientRect(),le=d.value;if(!le)return;const ge=le.offsetHeight,fe=window.innerHeight-x.bottom-8,Ce=x.top-8;let ze=fe<ge&&Ce>0?x.top-ge-4:x.bottom+4;ze=Math.max(4,Math.min(window.innerHeight-ge-4,ze)),y.value=q!==void 0?{right:window.innerWidth-x.right,top:ze}:{left:ee,top:ze},document.addEventListener("pointerdown",g)})}function m(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",g)}function B(R){o.disabled||(a("change",R),m())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",g)}),n({open:r,openMenu:C,close:m}),(R,I)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:c,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:d,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:I[0]||(I[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(b)(e.locale,q.labelKey),onClick:J=>B(q.key)},[t.createElementVNode("span",ks,t.toDisplayString(t.unref(b)(e.locale,q.labelKey)),1)],10,vs)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-d9e95ea2"]]),Rs={class:"tb-item","data-key":"undo"},Ss=["title","disabled"],Ms={class:"toolbar-btn__label"},Bs={class:"tb-item","data-key":"redo"},Ns=["title","disabled"],xs={class:"toolbar-btn__label"},Ts={class:"tb-item","data-key":"paint"},Vs=["title","disabled"],Ds={class:"toolbar-btn__label"},Fs={class:"tb-item","data-key":"clear"},Is=["title","disabled"],Os={class:"toolbar-btn__label"},As={class:"tb-item","data-key":"font"},Ls={class:"tb-item","data-key":"fontSize"},_s={class:"toolbar-font-size"},$s=["value","title"],zs=["title"],Hs=["title","disabled"],Ws=["title","disabled"],Ps={class:"tb-item","data-key":"bold"},Us=["title","disabled"],Ks={class:"toolbar-btn__label"},Gs={class:"tb-item","data-key":"italic"},qs=["title","disabled"],Ys={class:"toolbar-btn__label"},Xs={class:"tb-item","data-key":"underline"},js=["title","disabled"],Zs={class:"toolbar-btn__label"},Js={class:"tb-item","data-key":"strike"},Qs=["title","disabled"],ec={class:"toolbar-btn__label"},tc={class:"tb-item","data-key":"textColor"},lc={class:"toolbar-split"},nc=["title","disabled"],oc={viewBox:"0 0 1024 1024",fill:"currentColor"},rc=["fill"],ac={class:"toolbar-btn__label"},ic=["title","disabled"],sc={class:"tb-item","data-key":"fillColor"},cc={class:"toolbar-split"},dc=["title","disabled"],uc={viewBox:"0 0 1024 1024",fill:"currentColor"},fc=["fill"],mc={class:"toolbar-btn__label"},pc=["title","disabled"],hc={class:"tb-item","data-key":"border"},gc={class:"toolbar-split"},bc=["title","disabled"],yc={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},wc=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Cc={class:"toolbar-btn__label"},vc=["title","disabled"],kc={class:"tb-item","data-key":"hAlign"},Ec={class:"tb-item","data-key":"vAlign"},Rc={class:"tb-item","data-key":"wrap"},Sc=["title"],Mc={class:"toolbar-btn__label"},Bc={class:"tb-item","data-key":"merge"},Nc={class:"toolbar-split"},xc=["title","disabled"],Tc={class:"toolbar-btn__label"},Vc=["title","disabled"],Dc={class:"tb-item","data-key":"numFmt"},Fc={class:"toolbar-number-format-group"},Ic=["title","disabled"],Oc=["title","disabled"],Ac={class:"tb-item","data-key":"calc"},Lc={class:"toolbar-split"},_c=["title","disabled"],$c={class:"toolbar-btn__label"},zc=["title","disabled"],Hc={class:"tb-item","data-key":"sort"},Wc={class:"toolbar-split"},Pc=["title","disabled"],Uc={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Kc=["x1","y1","x2","y2"],Gc=["d"],qc={class:"toolbar-btn__label"},Yc=["title","disabled"],Xc={class:"tb-item","data-key":"outline"},jc={class:"toolbar-split"},Zc=["title"],Jc={class:"toolbar-btn__label"},Qc=["title"],ed={class:"tb-item","data-key":"filter"},td=["disabled","title"],ld={class:"toolbar-btn__label"},nd={class:"tb-item","data-key":"freeze"},od={class:"tb-item","data-key":"cf"},rd={class:"tb-item","data-key":"dv"},ad=["title"],id={class:"toolbar-btn__label"},sd={class:"tb-item","data-key":"find"},cd=["title"],dd={class:"toolbar-btn__label"},ud=["disabled"],fd=["disabled"],Pr='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V416 H192 Z" /></svg>',md='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path d="M192 192 H832 V416 H192 Z" /></svg>',pd='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path d="M192 192 H416 V832 H192 Z" /></svg>',hd='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M448 160 V864" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M224 224 L416 416" /><path fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" d="M416 224 L224 416" /></svg>',Xo=2,gd=6,bd=34,yd=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:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},outlineMenuOpen:{type:Boolean},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},freezePanesDisabled:{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","apply-sort","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","increase-decimals","decrease-decimals","toggle-filter","cf-new-rule","cf-manage","open-data-validation","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","freeze-change","cf-preset","outline-action","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:sort-menu-open","update:outline-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","sort-change","merge-change","cf-clear"],setup(e,{expose:n,emit:l}){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}],a={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"]},i={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function r(Ue,N){return i[Ue].includes(N)?"thick":a[Ue].includes(N)?"solid":"dashed"}const c={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"},d=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],y={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},g=["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","sort","filter","outline","freeze","cf","dv","find"],C=t.ref(null),m=t.ref(null),B=t.ref(null),R=t.ref(null),I=t.ref(null),q=t.ref(null),J=t.ref(null),ee=t.ref(null),ne=t.ref(null),x=t.ref(null),le=t.ref(null),ge=t.ref(new Set),fe=t.ref(!1),Ce=t.ref(!1),$e=t.ref(0),ze=t.ref(!1),et=t.ref(!1),nt=t.ref(!1),F=new Map,A=t.computed(()=>ge.value.size>0);function Q(Ue){return ge.value.has(Ue)}const we=t.computed(()=>{const Ue=m.value;return Ue instanceof HTMLElement?Ue:void 0});function xe(Ue){return we.value?!Q(Ue):!0}function X(){for(const Ue of g){const N=F.get(Ue);if(N===void 0||N===0)return!0}return!1}function Ne(){if(!C.value)return;C.value.querySelectorAll(".tb-item").forEach(N=>{const pe=N.dataset.key;if(!pe)return;const Ct=N.offsetWidth;Ct>0?F.set(pe,Ct):F.has(pe)||F.set(pe,0)})}function me(Ue,N){if(Ue.size!==N.size)return!1;for(const pe of Ue)if(!N.has(pe))return!1;return!0}let Me=0,T=0;function se(){Me&&cancelAnimationFrame(Me),!(T>60)&&(T++,Me=requestAnimationFrame(()=>requestAnimationFrame(ie)))}function ie(){if(!C.value)return;const Ue=C.value.clientWidth-gd*2;if(Ue<=0){se();return}T=0,(F.size===0||X())&&Ne();let N=0;for(const Ct of g)N+=(F.get(Ct)??0)+Xo;const pe=new Set;if(N>Ue){const Ct=Ue-bd-Xo;let qt=0;for(let Kt=0;Kt<g.length;Kt++){const zt=g[Kt],Rt=(F.get(zt)??0)+Xo;if(qt+Rt>Ct){for(let Ut=Kt;Ut<g.length;Ut++)pe.add(g[Ut]);break}qt+=Rt}}me(pe,ge.value)||(ge.value=pe,$e.value++,pe.size===0&&(fe.value=!1)),nt.value=!0}let re=null;const K=t.ref(0),$=t.computed(()=>{const Ue=B.value,N={position:"fixed",top:"0px",right:"0px"};if(!Ue)return{...Je.themeVars,...N};K.value;const pe=Ue.getBoundingClientRect();return{...Je.themeVars,position:"fixed",top:`${pe.bottom+4}px`,right:`${window.innerWidth-pe.right}px`}});function de(){fe.value&&(K.value++,t.nextTick(()=>ie()))}function z(Ue){var pe,Ct,qt;if(!fe.value)return;const N=Ue.target;(pe=N.closest)!=null&&pe.call(N,".overflow-menu-wrap")||(Ct=B.value)!=null&&Ct.contains(N)||(qt=N.closest)!=null&&qt.call(N,".cf-menu, .sp-dropdown__menu, .color-picker__menu")||(Ce.value=!0,fe.value=!1,t.nextTick(()=>{Ce.value=!1}))}function _(){fe.value=!fe.value,fe.value&&t.nextTick(Be)}function ae(){fe.value=!1,Te("open-data-validation")}function Ke(){fe.value=!1,Te("find")}function Fe(){fe.value=!1,Te("toggle-filter")}function Le(){fe.value=!1}function Be(){const Ue=m.value;Ue&&(ze.value=Ue.scrollTop>1,et.value=Ue.scrollTop+Ue.clientHeight<Ue.scrollHeight-1)}function qe(Ue){const N=m.value;N&&(N.scrollTop=Math.max(0,Math.min(N.scrollHeight-N.clientHeight,N.scrollTop+Ue*40)))}n({closeOverflow:Le}),t.onMounted(()=>{se(),C.value&&(re=new ResizeObserver(()=>{fe.value||se()}),re.observe(C.value)),document.addEventListener("pointerdown",z,!0),window.addEventListener("resize",de),window.addEventListener("load",se),window.addEventListener("orientationchange",se)}),t.onBeforeUnmount(()=>{Me&&cancelAnimationFrame(Me),re==null||re.disconnect(),document.removeEventListener("pointerdown",z,!0),window.removeEventListener("resize",de),window.removeEventListener("load",se),window.removeEventListener("orientationchange",se)});const Je=e,Te=l,dt=t.computed(()=>Je.selNumberFormat===Pl?b(Je.locale,"nfMixed"):""),ft=t.computed(()=>{const Ue=[{label:b(Je.locale,"freezeFirstRow"),value:"firstRow",icon:md},{label:b(Je.locale,"freezeFirstCol"),value:"firstCol",icon:pd}];return Je.hasFreeze?Ue.unshift({label:b(Je.locale,"unfreezePanes"),value:"unfreeze",icon:hd}):Ue.unshift({label:b(Je.locale,"freezePanes"),value:"panes",icon:Pr,disabled:Je.freezePanesDisabled}),Ue});return(Ue,N)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:C,class:t.normalizeClass(["toolbar",{"toolbar--ready":nt.value}]),onMousedown:N[60]||(N[60]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("undo"),to:we.value},[t.createElementVNode("div",Rs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(b)(e.locale,"undo"),disabled:!e.canUndo,onClick:N[0]||(N[0]=pe=>Te("undo"))},[N[64]||(N[64]=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)),t.createElementVNode("span",Ms,t.toDisplayString(t.unref(b)(e.locale,"undo")),1)],10,Ss)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("redo"),to:we.value},[t.createElementVNode("div",Bs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(b)(e.locale,"redo"),disabled:!e.canRedo,onClick:N[1]||(N[1]=pe=>Te("redo"))},[N[65]||(N[65]=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)),t.createElementVNode("span",xs,t.toDisplayString(t.unref(b)(e.locale,"redo")),1)],10,Ns)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("paint"),to:we.value},[t.createElementVNode("div",Ts,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(b)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:N[2]||(N[2]=pe=>Te("paint-format"))},[N[66]||(N[66]=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)),t.createElementVNode("span",Ds,t.toDisplayString(t.unref(b)(e.locale,"paintFormat")),1)],10,Vs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("clear"),to:we.value},[t.createElementVNode("div",Fs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(b)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:N[3]||(N[3]=pe=>Te("clear-format"))},[N[67]||(N[67]=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)),t.createElementVNode("span",Os,t.toDisplayString(t.unref(b)(e.locale,"clearFormat")),1)],10,Is)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep1"),to:we.value},[N[68]||(N[68]=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:xe("font"),to:we.value},[t.createElementVNode("div",As,[t.createVNode(_t,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:Q("font")?"100%":110,"menu-width":Q("font")?120:void 0,"visible-count":8,title:t.unref(b)(e.locale,"fontFamily"),align:"right",onChange:N[4]||(N[4]=pe=>Te("font-family-change",pe))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("fontSize"),to:we.value},[t.createElementVNode("div",Ls,[t.createElementVNode("div",_s,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(b)(e.locale,"fontSize"),onMousedown:N[5]||(N[5]=t.withModifiers(()=>{},["stop"])),onInput:N[6]||(N[6]=pe=>Te("font-size-input",pe.target.value)),onBlur:N[7]||(N[7]=pe=>Te("font-size-blur")),onKeydown:N[8]||(N[8]=pe=>Te("font-size-keydown",pe))},null,40,$s),t.createVNode(_t,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:Q("fontSize")?"100%":56,"menu-width":Q("fontSize")?120:56,"visible-count":9,title:t.unref(b)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":le.value,"onUpdate:modelOpen":N[9]||(N[9]=pe=>Te("update:font-size-menu-open",pe)),onChange:N[10]||(N[10]=pe=>Te("font-size-change",pe))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:le,class:"toolbar-font-size__btn",type:"button",title:t.unref(b)(e.locale,"fontSize"),onMousedown:N[11]||(N[11]=t.withModifiers(()=>{},["prevent"])),onClick:N[12]||(N[12]=pe=>Te("font-size-toggle"))},[...N[69]||(N[69]=[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,zs),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:N[13]||(N[13]=t.withModifiers(()=>{},["prevent"])),onClick:N[14]||(N[14]=pe=>Te("font-size-step-down"))},[...N[70]||(N[70]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M675.2 184.533333h260.266667a12.8 12.8 0 0 1 12.8 12.8v21.333334a12.8 12.8 0 0 1-12.8 12.8H675.2a12.8 12.8 0 0 1-12.8-12.8v-21.333334a12.8 12.8 0 0 1 12.8-12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,Hs),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:N[15]||(N[15]=t.withModifiers(()=>{},["prevent"])),onClick:N[16]||(N[16]=pe=>Te("font-size-step-up"))},[...N[71]||(N[71]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M769.066667 77.952v93.781333h-93.866667a12.8 12.8 0 0 0-12.8 12.8v46.933334a12.8 12.8 0 0 0 12.8 12.8h93.866667v93.952a12.8 12.8 0 0 0 12.8 12.8h46.933333a12.8 12.8 0 0 0 12.8-12.8V244.266667h93.866667a12.8 12.8 0 0 0 12.8-12.8v-46.933334a12.8 12.8 0 0 0-12.8-12.8h-93.866667V77.952a12.8 12.8 0 0 0-12.8-12.8h-46.933333a12.8 12.8 0 0 0-12.8 12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,Ws)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep2"),to:we.value},[N[72]||(N[72]=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:xe("bold"),to:we.value},[t.createElementVNode("div",Ps,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(b)(e.locale,"bold"),disabled:!e.hasSelection,onClick:N[17]||(N[17]=pe=>Te("bold-toggle"))},[N[73]||(N[73]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)),t.createElementVNode("span",Ks,t.toDisplayString(t.unref(b)(e.locale,"bold")),1)],10,Us)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("italic"),to:we.value},[t.createElementVNode("div",Gs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(b)(e.locale,"italic"),disabled:!e.hasSelection,onClick:N[18]||(N[18]=pe=>Te("italic-toggle"))},[N[74]||(N[74]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)),t.createElementVNode("span",Ys,t.toDisplayString(t.unref(b)(e.locale,"italic")),1)],10,qs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("underline"),to:we.value},[t.createElementVNode("div",Xs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(b)(e.locale,"underline"),disabled:!e.hasSelection,onClick:N[19]||(N[19]=pe=>Te("underline-toggle"))},[N[75]||(N[75]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)),t.createElementVNode("span",Zs,t.toDisplayString(t.unref(b)(e.locale,"underline")),1)],10,js)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("strike"),to:we.value},[t.createElementVNode("div",Js,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:N[20]||(N[20]=pe=>Te("strikethrough-toggle"))},[N[76]||(N[76]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)),t.createElementVNode("span",ec,t.toDisplayString(t.unref(b)(e.locale,"strikethrough")),1)],10,Qs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep3"),to:we.value},[N[77]||(N[77]=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:xe("textColor"),to:we.value},[t.createElementVNode("div",tc,[t.createElementVNode("div",lc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[21]||(N[21]=pe=>Te("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",oc,[N[78]||(N[78]=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,rc)])),t.createElementVNode("span",ac,t.toDisplayString(t.unref(b)(e.locale,"fontColor")),1)],8,nc),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[22]||(N[22]=pe=>Te("update:text-color-menu-open",!e.textColorMenuOpen))},[...N[79]||(N[79]=[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,ic),t.createVNode(go,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":R.value,"onUpdate:modelOpen":N[23]||(N[23]=pe=>Te("update:text-color-menu-open",pe)),onChange:N[24]||(N[24]=pe=>Te("text-color-change",pe))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("fillColor"),to:we.value},[t.createElementVNode("div",sc,[t.createElementVNode("div",cc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[25]||(N[25]=pe=>Te("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",uc,[N[80]||(N[80]=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,fc)])),t.createElementVNode("span",mc,t.toDisplayString(t.unref(b)(e.locale,"fillColor")),1)],8,dc),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:I,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[26]||(N[26]=pe=>Te("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...N[81]||(N[81]=[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,pc),t.createVNode(go,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":I.value,"onUpdate:modelOpen":N[27]||(N[27]=pe=>Te("update:fill-color-menu-open",pe)),onChange:N[28]||(N[28]=pe=>Te("fill-color-change",pe))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("border"),to:we.value},[t.createElementVNode("div",hc,[t.createElementVNode("div",gc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[29]||(N[29]=pe=>Te("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",yc,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,pe=>t.createElementVNode("line",{key:pe.name,x1:pe.x1,y1:pe.y1,x2:pe.x2,y2:pe.y2,"stroke-width":r(e.cachedBorder,pe.name)==="thick"?3:1.5,"stroke-dasharray":r(e.cachedBorder,pe.name)==="dashed"?"0 4":"none","stroke-linecap":r(e.cachedBorder,pe.name)==="dashed"?"round":"square"},null,8,wc)),64))])),t.createElementVNode("span",Cc,t.toDisplayString(t.unref(b)(e.locale,c[e.cachedBorder]??"borders")),1)],8,bc),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:q,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[30]||(N[30]=pe=>Te("update:border-menu-open",!e.borderMenuOpen))},[...N[82]||(N[82]=[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,vc),t.createVNode(Wi,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":q.value,"onUpdate:modelOpen":N[31]||(N[31]=pe=>Te("update:border-menu-open",pe)),onChange:N[32]||(N[32]=pe=>Te("border-change",pe))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep4"),to:we.value},[N[83]||(N[83]=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:xe("hAlign"),to:we.value},[t.createElementVNode("div",kc,[t.createVNode(_t,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:Q("hAlign")?"100%":44,"menu-width":Q("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"hAlign"),onChange:N[33]||(N[33]=pe=>Te("h-align-change",pe))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("vAlign"),to:we.value},[t.createElementVNode("div",Ec,[t.createVNode(_t,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:Q("vAlign")?"100%":44,"menu-width":Q("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"vAlign"),onChange:N[34]||(N[34]=pe=>Te("v-align-change",pe))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("wrap"),to:we.value},[t.createElementVNode("div",Rc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(b)(e.locale,"wrap"),onClick:N[35]||(N[35]=pe=>Te("wrap-toggle"))},[N[84]||(N[84]=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)),t.createElementVNode("span",Mc,t.toDisplayString(t.unref(b)(e.locale,"wrap")),1)],10,Sc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("merge"),to:we.value},[t.createElementVNode("div",Bc,[t.createElementVNode("div",Nc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:N[36]||(N[36]=pe=>Te("apply-merge"))},[N[85]||(N[85]=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)),t.createElementVNode("span",Tc,t.toDisplayString(t.unref(b)(e.locale,"mergeCenter")),1)],8,xc),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:ee,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:N[37]||(N[37]=pe=>Te("update:merge-menu-open",!e.mergeMenuOpen))},[...N[86]||(N[86]=[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,Vc),t.createVNode(rs,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":ee.value,"onUpdate:modelOpen":N[38]||(N[38]=pe=>Te("update:merge-menu-open",pe)),onChange:N[39]||(N[39]=pe=>Te("merge-change",pe))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep6"),to:we.value},[N[87]||(N[87]=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:xe("numFmt"),to:we.value},[t.createElementVNode("div",Dc,[t.createElementVNode("div",Fc,[t.createVNode(_t,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:Q("numFmt")?"auto":92,"menu-width":(Q("numFmt"),150),"visible-count":8,title:t.unref(b)(e.locale,"numberFormat"),"fallback-label":dt.value,align:"right",onChange:N[40]||(N[40]=pe=>Te("number-format-change",String(pe)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(b)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:N[41]||(N[41]=pe=>Te("increase-decimals"))},[...N[88]||(N[88]=[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,Ic),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(b)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:N[42]||(N[42]=pe=>Te("decrease-decimals"))},[...N[89]||(N[89]=[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,Oc)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sep7"),to:we.value},[N[90]||(N[90]=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:xe("calc"),to:we.value},[t.createElementVNode("div",Ac,[t.createElementVNode("div",Lc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:N[43]||(N[43]=pe=>Te("calc-sum"))},[N[91]||(N[91]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)),t.createElementVNode("span",$c,t.toDisplayString(t.unref(b)(e.locale,"sum")),1)],8,_c),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:ne,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:N[44]||(N[44]=pe=>Te("update:calc-menu-open",!e.calcMenuOpen))},[...N[92]||(N[92]=[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,zc),t.createVNode(Es,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":ne.value,disabled:e.isSingleCell,"onUpdate:modelOpen":N[45]||(N[45]=pe=>Te("update:calc-menu-open",pe)),onChange:N[46]||(N[46]=pe=>Te(`calc-${pe}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("sort"),to:we.value},[t.createElementVNode("div",Hc,[t.createElementVNode("div",Wc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(b)(e.locale,"sortAsc"):t.unref(b)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:N[47]||(N[47]=pe=>Te("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Uc,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,pe=>t.createElementVNode("line",{key:pe.name,x1:pe.x1,y1:pe.y1,x2:pe.x2,y2:pe.y2},null,8,Kc)),64)),t.createElementVNode("path",{d:y[e.cachedSortOrder]},null,8,Gc)])),t.createElementVNode("span",qc,t.toDisplayString(t.unref(b)(e.locale,"sort")),1)],8,Pc),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:J,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"sort"),disabled:!e.canSort,onClick:N[48]||(N[48]=pe=>Te("update:sort-menu-open",!e.sortMenuOpen))},[...N[93]||(N[93]=[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,Yc),t.createVNode(Yi,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":J.value,"onUpdate:modelOpen":N[49]||(N[49]=pe=>Te("update:sort-menu-open",pe)),onChange:N[50]||(N[50]=pe=>Te("sort-change",pe))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("outline"),to:we.value},[t.createElementVNode("div",Xc,[t.createElementVNode("div",jc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"outlineGroup"),onClick:N[51]||(N[51]=pe=>Te("update:outline-menu-open",!e.outlineMenuOpen))},[N[94]||(N[94]=t.createElementVNode("span",{class:"toolbar-btn__icon"},[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"56","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M160 224 H560 V800 H160 Z"}),t.createElementVNode("path",{"stroke-width":"44",d:"M664 640 H864 V384 H664"})])],-1)),t.createElementVNode("span",Jc,t.toDisplayString(t.unref(b)(e.locale,"outlineGroup")),1)],8,Zc),t.createElementVNode("button",{ref_key:"outlineArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"outlineGroup"),onClick:N[52]||(N[52]=pe=>Te("update:outline-menu-open",!e.outlineMenuOpen))},[...N[95]||(N[95]=[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,Qc),t.createVNode(ts,{"model-open":e.outlineMenuOpen,locale:e.locale,"trigger-el":x.value,"onUpdate:modelOpen":N[53]||(N[53]=pe=>Te("update:outline-menu-open",pe)),onAction:N[54]||(N[54]=pe=>Te("outline-action",pe))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("filter"),to:we.value},[t.createElementVNode("div",ed,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter,title:e.filterActive?t.unref(b)(e.locale,"clearFilter"):t.unref(b)(e.locale,"filter"),onClick:Fe},[N[96]||(N[96]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M96 192c0-17.6 14.4-32 32-32h768c17.6 0 32 14.4 32 32 0 9.6-4.8 19.2-12.8 25.6L608 480v320c0 19.2-12.8 35.2-32 40-4.8 1.6-9.6 1.6-14.4 1.6-12.8 0-24-4.8-33.6-12.8l-128-108.8c-8-6.4-12.8-16-12.8-25.6V480L108.8 217.6C100.8 211.2 96 201.6 96 192z"})],-1)),t.createElementVNode("span",ld,t.toDisplayString(t.unref(b)(e.locale,"filter")),1)],10,td)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("freeze"),to:we.value},[t.createElementVNode("div",nd,[t.createVNode(_t,{class:"toolbar-freeze","model-value":"",options:ft.value,width:Q("freeze")?"100%":44,"menu-width":Q("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(b)(e.locale,"freezePane"),"trigger-icon":Pr,"trigger-label":t.unref(b)(e.locale,"freezePane"),onChange:N[55]||(N[55]=pe=>Te("freeze-change",String(pe)))},null,8,["options","width","menu-width","title","trigger-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("cf"),to:we.value},[t.createElementVNode("div",od,[t.createVNode(Cs,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,onPreset:N[56]||(N[56]=pe=>Te("cf-preset",pe)),onNewRule:N[57]||(N[57]=pe=>Te("cf-new-rule")),onManage:N[58]||(N[58]=pe=>Te("cf-manage")),onClear:N[59]||(N[59]=pe=>Te("cf-clear",pe))},null,8,["locale","has-selection","theme-vars"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("dv"),to:we.value},[t.createElementVNode("div",rd,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"dv"),onClick:ae},[N[97]||(N[97]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M933.76 705.728l-74.112 74.048 74.88 74.944-58.88 58.88-74.88-75.008-74.88 74.88-58.88-58.752 74.88-74.88-74.048-74.112 58.88-58.88 74.112 74.048 74.048-74.048 58.88 58.88z"}),t.createElementVNode("path",{d:"M832.576 607.104H167.808v162.944h370.688v83.2H126.208a41.664 41.664 0 0 1-41.6-41.6V565.376a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2zM908.608 241.856l30.848 27.904-158.08 174.08a41.664 41.664 0 0 1-60.224 1.408L605.824 329.856l58.816-58.88 84.48 84.48 128.768-141.568 30.72 27.968z"}),t.createElementVNode("path",{d:"M832.576 193.664H167.808v162.944h370.688v83.2H126.208a41.6 41.6 0 0 1-41.6-41.6V151.936a41.6 41.6 0 0 1 41.6-41.6h706.368v83.2z"})],-1)),t.createElementVNode("span",id,t.toDisplayString(t.unref(b)(e.locale,"dv")),1)],8,ad)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:xe("find"),to:we.value},[t.createElementVNode("div",sd,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"find"),onClick:Ke},[N[98]||(N[98]=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)),t.createElementVNode("span",dd,t.toDisplayString(t.unref(b)(e.locale,"findReplace")),1)],8,cd)])],8,["disabled","to"])),A.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:B,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":fe.value}]),type:"button",onClick:_},[...N[99]||(N[99]=[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)],34),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["overflow-menu-wrap",{"no-anim":Ce.value}]),style:t.normalizeStyle($.value),onPointerdown:N[63]||(N[63]=t.withModifiers(()=>{},["stop","prevent"]))},[ze.value||et.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!ze.value}]),disabled:!ze.value,onClick:N[61]||(N[61]=pe=>qe(-1))},[...N[100]||(N[100]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,ud)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:m,key:$e.value,class:"overflow-menu",onScroll:Be},null,32)),ze.value||et.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!et.value}]),disabled:!et.value,onClick:N[62]||(N[62]=pe=>qe(1))},[...N[101]||(N[101]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M134.827 361.387a32 32 0 0 1 45.226 0L512 693.333l331.947-331.946a32 32 0 1 1 45.226 45.226L534.613 738.56a32 32 0 0 1-45.226 0L134.827 406.613a32 32 0 0 1 0-45.226z"})],-1)])],10,fd)):t.createCommentVNode("",!0)],38),[[t.vShow,fe.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-b5f64b39"]]),wd=["title"],Cd={class:"tab-list"},vd=["onClick","onDblclick","onContextmenu","onTouchstart"],kd=["value"],Ed={key:1,class:"tab-item__name"},Rd=["title"],Sd=["disabled"],Md=["title","onClick"],Bd={class:"tab-list-menu__name"},Nd=["title","disabled","onClick"],xd=["disabled"],Td=8,Ur=450,bo=8,Vd=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 l=e,o=n,a=t.ref(null),i=t.ref(!1),r=t.ref(0),c=t.ref({left:0,bottom:0}),d=t.ref(null),y=t.computed(()=>Math.min(Td,l.sheets.length)),g=t.computed(()=>l.sheets.slice(r.value,r.value+y.value)),C=t.computed(()=>r.value>0),m=t.computed(()=>r.value+y.value<l.sheets.length),B=t.computed(()=>l.sheets.length>y.value),R=t.computed(()=>l.sheets.length>1);t.watch(()=>l.sheets.length,()=>{if(!i.value)return;const z=Math.max(0,l.sheets.length-y.value);r.value>z&&(r.value=z)});function I(z){r.value=Math.max(0,Math.min(l.sheets.length-y.value,r.value+z))}function q(){if(i.value){i.value=!1;return}const z=a.value;if(!z)return;const _=z.getBoundingClientRect();c.value={left:_.left,bottom:window.innerHeight-_.top+4};const ae=l.activeSheetIndex;r.value=ae>=0?Math.max(0,Math.min(ae-Math.floor(y.value/2),l.sheets.length-y.value)):0,i.value=!0}function J(z){o("tab-click",z),i.value=!1}function ee(z){R.value&&o("delete-sheet",z)}function ne(z){var Ke;if(!i.value)return;const _=z.target;if((Ke=a.value)!=null&&Ke.contains(_))return;const ae=document.querySelector(".tab-list-menu");ae!=null&&ae.contains(_)||(i.value=!1)}function x(z){i.value&&z.key==="Escape"&&(i.value=!1)}function le(z){i.value&&(z.preventDefault(),I(z.deltaY>0?1:-1))}function ge(){i.value=!1}function fe(z){!i.value||z.target===d.value||ge()}const Ce=t.ref(0),$e=t.ref(!1);function ze(z){i.value&&(Ce.value=z.touches[0].clientY,$e.value=!0)}function et(z){if(!i.value||!$e.value)return;const _=z.touches[0].clientY-Ce.value;Math.abs(_)>5&&(I(_<0?1:-1),Ce.value=z.touches[0].clientY)}function nt(){$e.value=!1}let F=null,A=-1,Q=0,we=0,xe=!1,X=null,Ne=0,me=0;function Me(z,_,ae){return{clientX:z,clientY:_,target:ae,preventDefault(){},stopPropagation(){}}}function T(z,_){const ae=z.touches[0];if(!ae)return;Q=ae.clientX,we=ae.clientY,A=_,F!==null&&clearTimeout(F);const Ke=z.target;F=window.setTimeout(()=>{xe=!0;const Fe=Me(Q,we,Ke);o("tab-contextmenu",{ev:Fe,i:A})},Ur)}function se(z){const _=z.touches[0];!_||F===null||(Math.abs(_.clientX-Q)>bo||Math.abs(_.clientY-we)>bo)&&(clearTimeout(F),F=null)}function ie(){F!==null&&(clearTimeout(F),F=null)}function re(z){if(xe){xe=!1;return}o("tab-click",z)}function K(z){const _=z.touches[0];if(!_)return;const ae=z.target;if(ae.closest(".tab-item")||ae.closest(".tab-bar__add-btn")||ae.closest(".tab-bar__list-btn"))return;Ne=_.clientX,me=_.clientY,X!==null&&clearTimeout(X);const Ke=ae;X=window.setTimeout(()=>{const Fe=Me(Ne,me,Ke);o("tabbar-contextmenu",Fe)},Ur)}function $(z){const _=z.touches[0];!_||X===null||(Math.abs(_.clientX-Ne)>bo||Math.abs(_.clientY-me)>bo)&&(clearTimeout(X),X=null)}function de(){X!==null&&(clearTimeout(X),X=null)}return t.watch(i,z=>{t.nextTick(()=>{var _,ae;z?(_=d.value)==null||_.addEventListener("wheel",le,{passive:!1}):(ae=d.value)==null||ae.removeEventListener("wheel",le)})}),t.onMounted(()=>{document.addEventListener("pointerdown",ne),document.addEventListener("keydown",x),window.addEventListener("resize",ge),window.addEventListener("scroll",fe,!0)}),t.onBeforeUnmount(()=>{F!==null&&clearTimeout(F),X!==null&&clearTimeout(X),document.removeEventListener("pointerdown",ne),document.removeEventListener("keydown",x),window.removeEventListener("resize",ge),window.removeEventListener("scroll",fe,!0)}),(z,_)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:_[8]||(_[8]=ae=>o("tabbar-contextmenu",ae)),onTouchstart:K,onTouchmove:$,onTouchend:de,onTouchcancel:de},[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(b)(e.locale,"sheetList"),onClick:q},[..._[9]||(_[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,wd),t.createElementVNode("div",Cd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(ae,Ke)=>(t.openBlock(),t.createElementBlock("div",{key:ae.id,class:t.normalizeClass(["tab-item",{"tab-item--active":Ke===e.activeSheetIndex}]),onClick:Fe=>re(Ke),onDblclick:t.withModifiers(Fe=>o("tab-dblclick",Ke),["prevent"]),onContextmenu:Fe=>o("tab-contextmenu",{ev:Fe,i:Ke}),onTouchstart:Fe=>T(Fe,Ke),onTouchmove:se,onTouchend:ie,onTouchcancel:ie},[e.renTab===Ke?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:_[0]||(_[0]=Fe=>o("tab-rename-input",Fe.target.value)),onKeydown:_[1]||(_[1]=Fe=>o("tab-rename-keydown",Fe)),onBlur:_[2]||(_[2]=Fe=>o("tab-rename-commit")),onClick:_[3]||(_[3]=t.withModifiers(()=>{},["stop"]))},null,40,kd)):(t.openBlock(),t.createElementBlock("span",Ed,t.toDisplayString(ae.name),1))],42,vd))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(b)(e.locale,"addSheet"),onClick:_[4]||(_[4]=ae=>o("add-sheet"))}," + ",8,Rd),(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:c.value.left+"px",bottom:c.value.bottom+"px"}),onMousedown:_[7]||(_[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":!C.value}]),disabled:!C.value,onClick:_[5]||(_[5]=ae=>I(-1))},[..._[10]||(_[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,Sd)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"tab-list-menu__list",onTouchstart:ze,onTouchmove:et,onTouchend:nt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,ae=>(t.openBlock(),t.createElementBlock("div",{key:ae.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(ae)===e.activeSheetIndex}]),title:ae.name,onClick:Ke=>J(e.sheets.indexOf(ae))},[t.createElementVNode("span",Bd,t.toDisplayString(ae.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(b)(e.locale,"delete"),disabled:!R.value,onClick:t.withModifiers(Ke=>ee(e.sheets.indexOf(ae)),["stop"])},[..._[11]||(_[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,Nd)],10,Md))),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":!m.value}]),disabled:!m.value,onClick:_[6]||(_[6]=ae=>I(1))},[..._[12]||(_[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,xd)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-e00401ad"]]),Dd={class:"find-bar__row find-bar__row--inputs"},Fd=["placeholder","value"],Id=["placeholder","value"],Od=["title","disabled"],Ad=["title","disabled"],Ld=["title"],_d={class:"find-bar__row find-bar__row--controls"},$d=["title"],zd={class:"find-bar__count"},Hd=["disabled"],Wd=["disabled"],Pd={class:"find-bar__chk find-bar__chk--panel"},Ud=["checked"],Kd={class:"find-bar__chk find-bar__chk--panel"},Gd=["checked"],qd=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 l=e,o=n,a=t.ref(null),i=t.ref(null),r=t.ref(!1),c=t.ref({top:0,left:0}),d=t.computed(()=>l.total>0?`${l.currentIndex+1}/${l.total}`:l.message||""),y=t.computed(()=>[{label:b(l.locale,"scopeSheet"),value:"sheet"},{label:b(l.locale,"scopeWorkbook"),value:"workbook"},{label:b(l.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>l.focusToken,()=>{t.nextTick(()=>{var B;return(B=a.value)==null?void 0:B.focus()})});function g(B){B.key==="Enter"?(B.preventDefault(),B.shiftKey?o("prev"):o("next")):B.key==="Escape"&&(B.preventDefault(),o("close"))}function C(){if(i.value){if(!r.value){const B=i.value.getBoundingClientRect();c.value={top:B.bottom+2,left:B.left}}r.value=!r.value}}function m(B){if(!r.value)return;const R=B.target;R.closest(".find-bar__settings-btn")||R.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,B=>{B?document.addEventListener("pointerdown",m,!0):document.removeEventListener("pointerdown",m,!0)}),t.watch(()=>l.open,B=>{B||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",m,!0)),(B,R)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Dd,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(b)(e.locale,"findPlaceholder"),value:e.findText,onInput:R[0]||(R[0]=I=>o("update:findText",I.target.value)),onKeydown:g},null,40,Fd),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(b)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:R[1]||(R[1]=I=>o("update:replaceText",I.target.value)),onKeydown:g},null,40,Id),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findPrev"),disabled:e.total===0,onClick:R[2]||(R[2]=I=>o("prev"))},[...R[12]||(R[12]=[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,Od),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findNext"),disabled:e.total===0,onClick:R[3]||(R[3]=I=>o("next"))},[...R[13]||(R[13]=[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,Ad),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(b)(e.locale,"findClose"),onClick:R[4]||(R[4]=I=>o("close"))},[...R[14]||(R[14]=[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,Ld)]),t.createElementVNode("div",_d,[t.createVNode(_t,{class:"find-bar__dropdown","model-value":e.scope,options:y.value,title:t.unref(b)(e.locale,"findScope"),"onUpdate:modelValue":R[5]||(R[5]=I=>B.$emit("update:scope",I))},null,8,["model-value","options","title"]),t.createElementVNode("button",{ref_key:"settingsBtnRef",ref:i,class:t.normalizeClass(["find-bar__btn find-bar__btn--icon find-bar__settings-btn",{"find-bar__btn--active":r.value}]),title:t.unref(b)(e.locale,"findOptions"),onClick:t.withModifiers(C,["stop"])},[...R[15]||(R[15]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M224 671.616a64 64 0 1 1 128 0 64 64 0 0 1-128 0z m-59.968 32a128 128 0 0 0 247.936 0H928a32 32 0 1 0 0-64H411.968a128 128 0 0 0-247.936 0H96a32 32 0 1 0 0 64h68.032z"}),t.createElementVNode("path",{d:"M800 319.808a64 64 0 1 1-128 0 64 64 0 0 1 128 0z m59.968-32a128 128 0 0 0-247.936 0H96a32 32 0 0 0 0 64h516.032a128 128 0 0 0 247.936 0H928a32 32 0 0 0 0-64h-68.032z"})],-1)])],10,$d),t.createElementVNode("span",zd,t.toDisplayString(d.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:R[6]||(R[6]=I=>o("replace"))},t.toDisplayString(t.unref(b)(e.locale,"replace")),9,Hd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:R[7]||(R[7]=I=>o("replace-all"))},t.toDisplayString(t.unref(b)(e.locale,"replaceAll")),9,Wd)])],4)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"find-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar__settings-panel",style:t.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"}),onClick:R[10]||(R[10]=t.withModifiers(()=>{},["stop"])),onMousedown:R[11]||(R[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",Pd,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:R[8]||(R[8]=I=>o("update:matchCase",I.target.checked))},null,40,Ud),R[16]||(R[16]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Kd,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:R[9]||(R[9]=I=>o("update:matchEntireCell",I.target.checked))},null,40,Gd),R[17]||(R[17]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"matchEntireCell")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],64))}}),[["__scopeId","data-v-07f6713b"]]),Yd={class:"nf-dialog__header"},Xd={class:"nf-dialog__title"},jd={class:"nf-dialog__body"},Zd={class:"nf-field"},Jd={class:"nf-field__label"},Qd={key:0,class:"nf-field"},eu={class:"nf-field__label"},tu={key:1,class:"nf-field nf-field--inline"},lu={class:"nf-checkbox"},nu={key:2,class:"nf-field"},ou={class:"nf-field__label"},ru={key:3,class:"nf-field"},au={class:"nf-field__label"},iu={key:4,class:"nf-field"},su={class:"nf-field__label"},cu={key:5,class:"nf-field"},du={class:"nf-field__label"},uu={key:6,class:"nf-field"},fu={class:"nf-field__label"},mu={class:"nf-field"},pu={class:"nf-field__label"},hu={class:"nf-dialog__footer"},gu={class:"nf-preview"},bu={class:"nf-preview__label"},yu={class:"nf-preview__value"},wu={class:"nf-dialog__actions"},Cu=Vt(t.defineComponent({__name:"number-format-dialog",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 l=e,o=n,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),c=t.ref(!1),d=t.ref("$"),y=t.ref("m/d/yyyy"),g=t.ref("h:mm:ss"),C=t.ref("m/d/yyyy h:mm:ss"),m=t.ref("[h]:mm:ss"),B=t.ref(""),R=t.ref(null),I=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],q=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],J=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],ee=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],ne=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],x=t.computed(()=>l.locale==="zh-CN"?[...q,...J]:[...J,...q]),le=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],ge=t.computed(()=>l.locale==="zh-CN"?[...ee,...ne]:[...ne,...ee]),fe=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Ce={general:"nfGeneral",text:"nfText",number:"nfNumber",percent:"nfPercent",scientific:"nfScientific",accounting:"nfAccounting",financial:"nfFinancial",currency:"nfCurrency",currencyRounded:"nfCurrencyRounded",date:"nfDate",time:"nfTime",dateTime:"nfDateTime",duration:"nfDuration",custom:"nfCatCustom"},$e=t.computed(()=>yi.map(Be=>({label:b(l.locale,Ce[Be]),value:Be}))),ze=I.map(Be=>({label:Be.label,value:Be.value})),et=t.computed(()=>x.value.map(Be=>({label:Be,value:Be}))),nt=le.map(Be=>({label:Be,value:Be})),F=t.computed(()=>ge.value.map(Be=>({label:Be,value:Be}))),A=fe.map(Be=>({label:Be,value:Be})),Q=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),we=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),xe=t.computed(()=>i.value==="date"),X=t.computed(()=>i.value==="time"),Ne=t.computed(()=>i.value==="dateTime"),me=t.computed(()=>i.value==="duration"),Me=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function T(){if(i.value==="general")return en;if(i.value==="text")return pl;if(i.value==="custom")return B.value;if(i.value==="date")return y.value;if(i.value==="time")return g.value;if(i.value==="dateTime")return C.value;if(i.value==="duration")return m.value;const Be=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?se(i.value,Be,c.value,d.value):Si(l.locale,i.value,Be,c.value)}function se(Be,qe,Je,Te){const dt=Je?"#,##0":"0";if(Be==="currencyRounded")return Te+dt;const ft=qe>0?"."+"0".repeat(qe):"",Ue=dt+ft;return Be==="currency"?Te+Ue:`${Te}${Ue};(${Te}${Ue});${Te}"-"`}function ie(Be){if(B.value=Be,hl(Be)){i.value="general";return}if(Be==="@"){i.value="text";return}const qe=Be.replace(/\[[^\]]*\]/gi,ft=>/\[h\]/i.test(ft)?ft:"");if(/\[h\]/i.test(qe)&&!/[yd]/i.test(qe)){i.value="duration",fe.includes(Be)&&(m.value=Be);return}const Je=/[yd]/i.test(qe),Te=/h|s|AM\/PM/i.test(qe);if(Je&&Te){i.value="dateTime",ge.value.includes(Be)&&(C.value=Be);return}if(Je||/AM\/PM/i.test(qe)){Te&&!Je?(i.value="time",le.includes(Be)&&(g.value=Be)):(i.value="date",x.value.includes(Be)&&(y.value=Be));return}if(Be.includes("%")){i.value="percent",r.value=re(Be);return}if(/E[+-]/i.test(Be)){i.value="scientific",r.value=re(Be);return}const dt=I.find(ft=>Be.startsWith(ft.value));if(Be.includes("[Red](")){i.value="financial",c.value=Be.includes(","),r.value=re(Be);return}if(dt){Be.includes("(")?(i.value="accounting",d.value=dt.value,c.value=Be.includes(","),r.value=re(Be)):/\.\d/.test(Be.slice(dt.value.length))?(i.value="currency",d.value=dt.value,c.value=Be.includes(","),r.value=re(Be)):(i.value="currencyRounded",d.value=dt.value,c.value=Be.includes(","));return}i.value="number",c.value=Be.includes(","),r.value=re(Be)}function re(Be){const qe=Be.match(/\.([0#?]+)/);return qe?qe[1].length:0}function K(){i.value!=="custom"&&(B.value=T())}function $(){}function de(){y.value=x.value[0],g.value=le[0],C.value=ge.value[0],m.value=fe[0]}function z(){a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),de(),ie(l.currentFormat??""),l.isCustom&&(i.value="custom"),t.nextTick(()=>{var Be;return(Be=R.value)==null?void 0:Be.focus()})}function _(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function ae(){o("apply",B.value),_()}function Ke(){_()}function Fe(Be){Be.key==="Escape"&&_()}t.watch(()=>l.modelOpen,Be=>{Be&&!a.value?z():!Be&&a.value&&_()});const Le=t.computed(()=>Ml(l.sampleValue,B.value,l.locale));return(Be,qe)=>(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:Ke,onKeydown:Fe},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:qe[9]||(qe[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Yd,[t.createElementVNode("span",Xd,t.toDisplayString(t.unref(b)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:_},[...qe[10]||(qe[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",jd,[t.createElementVNode("div",Zd,[t.createElementVNode("label",Jd,t.toDisplayString(t.unref(b)(e.locale,"nfCategory")),1),t.createVNode(_t,{class:"nf-field__dropdown","model-value":i.value,options:$e.value,"onUpdate:modelValue":qe[0]||(qe[0]=Je=>i.value=Je),onChange:K},null,8,["model-value","options"])]),Me.value?(t.openBlock(),t.createElementBlock("div",Qd,[t.createElementVNode("label",eu,t.toDisplayString(t.unref(b)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":qe[1]||(qe[1]=Je=>r.value=Je),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:K},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Q.value?(t.openBlock(),t.createElementBlock("div",tu,[t.createElementVNode("label",lu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":qe[2]||(qe[2]=Je=>c.value=Je),type:"checkbox",onChange:K},null,544),[[t.vModelCheckbox,c.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),we.value?(t.openBlock(),t.createElementBlock("div",nu,[t.createElementVNode("label",ou,t.toDisplayString(t.unref(b)(e.locale,"nfSymbol")),1),t.createVNode(_t,{class:"nf-field__dropdown","model-value":d.value,options:t.unref(ze),"onUpdate:modelValue":qe[3]||(qe[3]=Je=>d.value=Je),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),xe.value?(t.openBlock(),t.createElementBlock("div",ru,[t.createElementVNode("label",au,t.toDisplayString(t.unref(b)(e.locale,"nfDateFormat")),1),t.createVNode(_t,{class:"nf-field__dropdown","model-value":y.value,options:et.value,"onUpdate:modelValue":qe[4]||(qe[4]=Je=>y.value=Je),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),X.value?(t.openBlock(),t.createElementBlock("div",iu,[t.createElementVNode("label",su,t.toDisplayString(t.unref(b)(e.locale,"nfTimeFormat")),1),t.createVNode(_t,{class:"nf-field__dropdown","model-value":g.value,options:t.unref(nt),"onUpdate:modelValue":qe[5]||(qe[5]=Je=>g.value=Je),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("div",cu,[t.createElementVNode("label",du,t.toDisplayString(t.unref(b)(e.locale,"nfDateTime")),1),t.createVNode(_t,{class:"nf-field__dropdown","model-value":C.value,options:F.value,"onUpdate:modelValue":qe[6]||(qe[6]=Je=>C.value=Je),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),me.value?(t.openBlock(),t.createElementBlock("div",uu,[t.createElementVNode("label",fu,t.toDisplayString(t.unref(b)(e.locale,"nfDuration")),1),t.createVNode(_t,{class:"nf-field__dropdown","model-value":m.value,options:t.unref(A),"onUpdate:modelValue":qe[7]||(qe[7]=Je=>m.value=Je),onChange:K},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",mu,[t.createElementVNode("label",pu,t.toDisplayString(t.unref(b)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:R,"onUpdate:modelValue":qe[8]||(qe[8]=Je=>B.value=Je),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:$},null,544),[[t.vModelText,B.value]])])]),t.createElementVNode("div",hu,[t.createElementVNode("div",gu,[t.createElementVNode("span",bu,t.toDisplayString(t.unref(b)(e.locale,"nfPreview")),1),t.createElementVNode("span",yu,t.toDisplayString(Le.value||"—"),1)]),t.createElementVNode("div",wu,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:ae},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:_},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-84bb335b"]]),vu={class:"sort-confirm__header"},ku={class:"sort-confirm__title"},Eu={class:"sort-confirm__body"},Ru={class:"sort-confirm__message"},Su={class:"sort-confirm__options"},Mu={class:"sort-confirm__option"},Bu={class:"sort-confirm__option"},Nu={class:"sort-confirm__footer"},xu=Vt(t.defineComponent({__name:"sort-confirm-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>l.modelOpen,B=>{B&&!a.value?c():!B&&a.value&&d()});function c(){i.value=!0,a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{var R;const B=(R=r.value)==null?void 0:R.querySelector(".sort-confirm__btn--primary");B==null||B.focus()})}function d(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function y(){m()}function g(B){B.key==="Escape"&&m()}function C(){o("confirm",i.value),d()}function m(){o("cancel"),d()}return(B,R)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:y,onKeydown:g},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",vu,[t.createElementVNode("span",ku,t.toDisplayString(t.unref(b)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:m},[...R[3]||(R[3]=[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",Eu,[t.createElementVNode("p",Ru,t.toDisplayString(t.unref(b)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Su,[t.createElementVNode("label",Mu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[0]||(R[0]=I=>i.value=I),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Bu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[1]||(R[1]=I=>i.value=I),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",Nu,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:C},t.toDisplayString(t.unref(b)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:m},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-af42d78b"]]);function rt(e){let n="",l=e;do n=String.fromCharCode(65+l%26)+n,l=Math.floor(l/26)-1;while(l>=0);return n}function jo(e){let n=0;for(let l=0;l<e.length;l++)n=n*26+(e.toUpperCase().charCodeAt(l)-64);return n-1}function En(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 Zo(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 An(e,n){return`${e},${n}`}function cl(e,n,l){const o=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!o)return null;const a=jo(o[1]),i=parseInt(o[2],10)-1;return a<0||a>=n||i<0||i>=l?null:{col:a,row:i}}function fn(e,n){if(!n)return{x:0,y:0};const l=n.getBoundingClientRect();return{x:e.clientX-l.left,y:e.clientY-l.top}}const Kr=[{name:"SUM",snippet:"SUM(A1:A10)"},{name:"AVERAGE",snippet:"AVERAGE(A1:A10)"},{name:"COUNT",snippet:"COUNT(A1:A10)"},{name:"IF",snippet:"IF(A1>0, B1, C1)"},{name:"VLOOKUP",snippet:"VLOOKUP(A1, B1:C10, 2, FALSE)"},{name:"CONCATENATE",snippet:"CONCATENATE(A1, B1)"},{name:"MAX",snippet:"MAX(A1:A10)"},{name:"MIN",snippet:"MIN(A1:A10)"},{name:"SIN",snippet:"SIN(A1)"},{name:"SUMIF",snippet:'SUMIF(A1:A10, ">0", B1:B10)'},{name:"PMT",snippet:"PMT(0.05/12, 360, 100000)"},{name:"STDEV",snippet:"STDEV(A1:A10)"}],Tu={SUM:{min:1,max:1},AVERAGE:{min:1,max:1},COUNT:{min:1,max:1},IF:{min:3,max:3},VLOOKUP:{min:3,max:4},CONCATENATE:{min:1,max:1/0},MAX:{min:1,max:1},MIN:{min:1,max:1},SIN:{min:1,max:1},SUMIF:{min:2,max:3},PMT:{min:3,max:5},STDEV:{min:1,max:1}};function Vu(e){let n=0,l=null;for(let o=0;o<e.length;o++){const a=e[o];if(l){a===l&&(e[o+1]===l?o++:l=null);continue}if(a==='"'||a==="'"){l=a;continue}if(a==="(")n++;else if(a===")"&&(n--,n<0))return!1}return n===0}function Du(e){const n=e.trim();if(!n.startsWith("="))return{ok:!1,name:null};const l=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(n.slice(1).trim());if(!l)return{ok:!1,name:null};const o=l[1].toUpperCase(),a=Tu[o];if(!a)return{ok:!1,name:o};const i=l[2];if(!Vu(i))return{ok:!1,name:o};const r=ln(i),c=r.length===1&&r[0].trim()===""?0:r.length;return c<a.min||c>a.max?{ok:!1,name:o}:r.some(d=>d.trim()==="")?{ok:!1,name:o}:{ok:!0,name:o}}function Ln(e,n,l){const o=e.split(":");if(o.length!==2)return null;const a=cl(o[0],n,l),i=cl(o[1],n,l);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 Gr(e){const n=e.trim();if(n==="")return"";const l=Number(n);return!isNaN(l)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?l:e}function Kl(e,n,l,o,a){const i=l[An(e,n)];if(!i)return"";const r=i.value;return r.startsWith("=")?Yr(An(e,n),l,o,a):Gr(r)}function qr(e,n,l,o,a){const i=Kl(e,n,l,o,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const Jn=new Map,yo=new Set;function mn(){Jn.clear(),yo.clear()}function Yr(e,n,l,o){return Fu(e,n,l,o,0)}function Fu(e,n,l,o,a){if(yo.has(e))return null;if(Jn.has(e))return Jn.get(e);yo.add(e);const i=n[e];let r;if(!i)r=null;else{const c=i.value;if(!c.startsWith("="))r=Gr(c);else{const d=c.slice(1).trim(),y=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(d);r=y?Jr(y[1].toUpperCase(),y[2],n,l,o,a+1):$t(d,n,l,o,a+1)}}return yo.delete(e),Jn.set(e,r),r}function _n(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Xr(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function Jo(e,n,l){let o;if(typeof e=="number"&&typeof n=="number")o=e<n?-1:e>n?1:0;else{const a=String(e??""),i=String(n??"");o=a<i?-1:a>i?1:0}switch(l){case"=":return o===0;case"<>":return o!==0;case"<":return o<0;case">":return o>0;case"<=":return o<=0;case">=":return o>=0}return!1}function jr(e,n,l,o){const a=e.trim();if(a.length>=2&&(a[0]==='"'&&a[a.length-1]==='"'||a[0]==="'"&&a[a.length-1]==="'"))return a.slice(1,-1);const i=Number(a);return!isNaN(i)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(a)?i:a}function Iu(e,n,l,o,a,i){let c=n.trim();c.length>=2&&(c[0]==='"'&&c[c.length-1]==='"'||c[0]==="'"&&c[c.length-1]==="'")&&(c=c.slice(1,-1));const d=/^([<>=]+)([\s\S]*)$/.exec(c);if(d){const g=d[1],C=jr(d[2]);return Jo(e,C,g)}const y=jr(c);return Xr(e,y)}function Zr(e,n,l,o,a){const i=e.trim(),r=["<=",">=","<>"];let c=null,d=-1,y=null,g=0;for(let m=0;m<i.length;m++){const B=i[m];if(y){B===y&&(i[m+1]===y?m++:y=null);continue}if(B==='"'||B==="'"){y=B;continue}if(B==="("&&g++,B===")"&&g--,g===0&&(B==="<"||B===">"||B==="=")){const R=i.slice(m,m+2);c=r.includes(R)?R:B,d=m;break}}if(c&&d>=0){const m=i.slice(0,d).trim(),B=i.slice(d+c.length).trim(),R=$t(m,n,l,o,a),I=$t(B,n,l,o,a);return Jo(R,I,c)}const C=$t(i,n,l,o,a);return _n(C)}function ln(e){const n=[];let l=0,o=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(o){a+=r,r===o&&(e[i+1]===o?(i++,a+=o):o=null);continue}if(r==='"'||r==="'"){o=r,a+=r;continue}if(r==="("&&l++,r===")"&&l--,r===","&&l===0){n.push(a),a="";continue}a+=r}return n.push(a),n}function $t(e,n,l,o,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 c=Ou(i);if(c.length===0)return null;let d=0;const y=()=>{const R=g(),I=c[d];if(!(I&&I.type==="cmp"))return R;d++;const q=g();return R===null||q===null?null:Jo(R,q,I.val)?1:0},g=()=>{let R=C();for(;d<c.length;){const I=c[d];if(I.type==="op"&&(I.val==="+"||I.val==="-"))d++,R=Qo(R,C(),I.val);else break}return R},C=()=>{let R=m();for(;d<c.length;){const I=c[d];if(I.type==="op"&&(I.val==="*"||I.val==="/"))d++,R=Qo(R,m(),I.val);else break}return R},m=()=>{const R=c[d];return R&&R.type==="op"&&R.val==="-"?(d++,Qo(0,m(),"-")):R&&R.type==="op"&&R.val==="+"?(d++,m()):B()},B=()=>{const R=c[d];if(!R)return null;if(R.type==="num")return d++,Number(R.val);if(R.type==="str")return d++,R.val;if(R.type==="lp"){d++;const I=y();return c[d]&&c[d].type==="rp"&&d++,I}if(R.type==="ref"){d++;const I=cl(R.val,l,o);return I?Kl(I.col,I.row,n,l,o):null}if(R.type==="func"){const I=R.val.toUpperCase();if(d++,c[d]&&c[d].type==="lp"){const q=c[d];let J=0,ee=null,ne=d;for(;ne<c.length;ne++)if(c[ne].type==="lp")J++;else if(c[ne].type==="rp"&&(J--,J===0)){ee=c[ne];break}if(ee){const x=i.slice(q.start+1,ee.start);return d=ne+1,Jr(I,x,n,l,o,a+1)}}return null}return d++,null};return y()}function Ou(e){const n=[];let l=0;for(;l<e.length;){const o=e[l];if(/\s/.test(o)){l++;continue}if(o==='"'||o==="'"){const a=o,i=l;l++;let r="";for(;l<e.length;){if(e[l]===a){if(e[l+1]===a){r+=a,l+=2;continue}l++;break}r+=e[l],l++}n.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(o)||o==="."){const a=l;let i="";for(o==="."&&(i+=".",l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]===".")for(i+=".",l++;l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;if(e[l]==="e"||e[l]==="E")for(i+=e[l],l++,(e[l]==="+"||e[l]==="-")&&(i+=e[l],l++);l<e.length&&/[0-9]/.test(e[l]);)i+=e[l],l++;n.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(o)){const a=l;let i="";for(;l<e.length&&/[A-Za-z0-9_$]/.test(e[l]);)i+=e[l],l++;e[l]==="("&&!i.includes("$")?n.push({type:"func",val:i,start:a}):n.push({type:"ref",val:i,start:a});continue}if(o==="("){n.push({type:"lp",val:o,start:l}),l++;continue}if(o===")"){n.push({type:"rp",val:o,start:l}),l++;continue}if(o===","){n.push({type:"comma",val:o,start:l}),l++;continue}if(o==="+"||o==="-"||o==="*"||o==="/"){n.push({type:"op",val:o,start:l}),l++;continue}if(o==="<"||o===">"||o==="="){const a=e.slice(l,l+2);a==="<="||a===">="||a==="<>"?(n.push({type:"cmp",val:a,start:l}),l+=2):(n.push({type:"cmp",val:o,start:l}),l++);continue}l++}return n}function Qo(e,n,l){if(typeof e!="number"||typeof n!="number")return null;switch(l){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function Jr(e,n,l,o,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Ln(n.trim(),o,a);if(!r)return null;if(e==="COUNT"){let d=0;for(let y=r.sc;y<=r.ec;y++)for(let g=r.sr;g<=r.er;g++)typeof Kl(y,g,l,o,a)=="number"&&d++;return d}let c=0;for(let d=r.sc;d<=r.ec;d++)for(let y=r.sr;y<=r.er;y++)c+=qr(d,y,l,o,a);if(isNaN(c))return null;if(e==="AVERAGE"){const d=(r.ec-r.sc+1)*(r.er-r.sr+1);return d===0?null:c/d}return c}case"AND":case"OR":{const r=ln(n);if(r.length===0)return null;const c=e==="AND";for(const d of r){const y=$t(d,l,o,a,i);if(y===null)return null;if(e==="AND"){if(!_n(y))return 0}else if(_n(y))return 1}return c?1:0}case"NOT":{const r=ln(n);if(r.length!==1)return null;const c=$t(r[0],l,o,a,i);return c===null?null:_n(c)?0:1}case"IF":{const r=ln(n);if(r.length<3)return null;const c=Zr(r[0],l,o,a,i);return $t(c?r[1]:r[2],l,o,a,i)}case"VLOOKUP":{const r=ln(n);if(r.length<3)return null;const c=$t(r[0],l,o,a,i),d=Ln(r[1].trim(),o,a);if(!d)return null;const y=$t(r[2],l,o,a,i),g=typeof y=="number"?y:parseFloat(String(y));if(isNaN(g))return null;const C=d.sc+(g-1);if(C<d.sc||C>d.ec)return null;if(r.length>=4?_n($t(r[3],l,o,a,i)):!1){let B=-1,R=-1/0;for(let I=d.sr;I<=d.er;I++){const q=Kl(d.sc,I,l,o,a);typeof q=="number"&&typeof c=="number"&&q<=c&&q>R&&(R=q,B=I)}return B>=0?Kl(C,B,l,o,a):null}for(let B=d.sr;B<=d.er;B++){const R=Kl(d.sc,B,l,o,a);if(Xr(R,c))return Kl(C,B,l,o,a)}return null}case"CONCATENATE":{const r=ln(n);let c="";for(const d of r){const y=$t(d,l,o,a,i);c+=y===null?"":typeof y=="number"?String(y):y}return c}case"MAX":case"MIN":{const r=Ln(n.trim(),o,a);if(!r)return null;const c=[];for(let d=r.sc;d<=r.ec;d++)for(let y=r.sr;y<=r.er;y++){const g=Kl(d,y,l,o,a);typeof g=="number"&&c.push(g)}return c.length===0?null:e==="MAX"?Math.max(...c):Math.min(...c)}case"STDEV":{const r=Ln(n.trim(),o,a);if(!r)return null;const c=[];for(let C=r.sc;C<=r.ec;C++)for(let m=r.sr;m<=r.er;m++){const B=Kl(C,m,l,o,a);typeof B=="number"&&c.push(B)}const d=c.length;if(d<2)return null;const y=c.reduce((C,m)=>C+m,0)/d,g=c.reduce((C,m)=>C+Math.pow(m-y,2),0)/(d-1);return Math.sqrt(g)}case"SIN":{const r=ln(n);if(r.length!==1)return null;const c=$t(r[0],l,o,a,i);return typeof c!="number"?null:Math.sin(c)}case"SUMIF":{const r=ln(n);if(r.length<2||r.length>3)return null;const c=Ln(r[0].trim(),o,a);if(!c)return null;const d=r.length===3?Ln(r[2].trim(),o,a):c;if(!d)return null;let y=0;for(let g=c.sr;g<=c.er;g++)for(let C=c.sc;C<=c.ec;C++){const m=Kl(C,g,l,o,a);Iu(m,r[1])&&(y+=qr(d.sc+(C-c.sc),d.sr+(g-c.sr),l,o,a))}return y}case"PMT":{const r=ln(n);if(r.length<3||r.length>5)return null;const c=$t(r[0],l,o,a,i),d=$t(r[1],l,o,a,i),y=$t(r[2],l,o,a,i);if(typeof c!="number"||typeof d!="number"||typeof y!="number")return null;const g=r.length>=4?$t(r[3],l,o,a,i):0,C=typeof g=="number"?g:0,m=r.length>=5?$t(r[4],l,o,a,i):0,B=_n(m)?1:0;if(c===0)return d===0?null:-(y+C)/d;const R=Math.pow(1+c,d);return-(C+y*R)*c/((1+c*B)*(R-1))}default:return null}}function wo(e,n,l){const o=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=cl(i[1],n,l);if(r)if(i[2]){const c=cl(i[2],n,l);if(!c)continue;for(let d=Math.min(r.col,c.col);d<=Math.max(r.col,c.col);d++)for(let y=Math.min(r.row,c.row);y<=Math.max(r.row,c.row);y++)o.push(An(d,y))}else o.push(An(r.col,r.row))}return o}function Qr(e,n,l,o,a){const i=l[An(e,n)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const c=Yr(An(e,n),l,o,a);return c===null?"#ERROR":String(c)}function ea(e,n,l,o){return $t(e,n,l,o,0)}function ta(e,n,l,o){const a=e.trim().replace(/^=/,"");return a?Zr(a,n,l,o,0):!1}function Co(e,n,l,o,a,i){return n===0&&l===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,c,d,y,g)=>{const C=c?jo(d):jo(d)+n,m=y?parseInt(g,10)-1:parseInt(g,10)-1+l;let B;C<0?B="A":C>=o?B=i(o-1):B=i(C);let R;return m<0?R="1":m>=a?R=String(a):R=String(m+1),(c||"")+B+(y||"")+R})}class Au{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var o;const l=this.deps.get(n);if(l){for(const a of l)(o=this.rev.get(a))==null||o.delete(n);this.deps.delete(n)}}set(n,l){if(this.clear(n),l.length!==0){this.deps.set(n,l);for(const o of l)this.rev.has(o)||this.rev.set(o,new Set),this.rev.get(o).add(n)}}markDirty(n){const l=[n];for(;l.length>0;){const o=l.pop(),a=this.rev.get(o);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),l.push(i))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,l,o){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Jn.clear();for(const[a,i]of Object.entries(n))if(i.value.startsWith("=")){const r=wo(i.value.slice(1),l,o);this.set(a,r)}}}const Lu={class:"ifn-dialog__header"},_u={class:"ifn-dialog__title"},$u={class:"ifn-dialog__body"},zu={class:"ifn-dialog__field"},Hu={class:"ifn-dialog__label"},Wu={key:0,class:"ifn-dialog__desc"},Pu={class:"ifn-dialog__field"},Uu={class:"ifn-dialog__label"},Ku={class:"ifn-dialog__footer"},Gu=["disabled"],qu=Vt(t.defineComponent({__name:"insert-function-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref(null),d=t.ref(null),y={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},g=t.computed(()=>Kr.map(le=>({label:le.name,value:le.name}))),C=t.computed(()=>{const le=String(i.value??"");return le?b(l.locale,y[le]??""):""}),m=t.computed(()=>Du(r.value)),B=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!m.value.ok?!1:m.value.name===String(i.value).toUpperCase());t.watch(()=>l.modelOpen,le=>{le&&!a.value?R():!le&&a.value&&I()});function R(){r.value="",i.value="",a.value=!0,l.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{const le=c.value;if(le)try{le.focus({preventScroll:!0}),le.setSelectionRange(le.value.length,le.value.length)}catch{}})}function I(){a.value=!1,l.modelOpen!==void 0&&o("update:modelOpen",!1)}function q(le){i.value=le;const ge=Kr.find(fe=>fe.name===String(le));ge&&(r.value="",J(ge.snippet))}function J(le){const ge=r.value,fe=c.value,Ce=fe?fe.selectionStart??ge.length:ge.length,$e=fe?fe.selectionEnd??ge.length:ge.length,ze=ge.trim()?le:"="+le;r.value=ge.slice(0,Ce)+ze+ge.slice($e),t.nextTick(()=>{const et=c.value;if(!et)return;const nt=Ce+ze.length;try{et.focus({preventScroll:!0}),et.setSelectionRange(nt,nt)}catch{}})}function ee(){o("insert",r.value),I()}function ne(){o("cancel"),I()}function x(le){le.key==="Escape"&&(le.stopPropagation(),ne())}return(le,ge)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"ifn-dialog"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"ifn-dialog__mask",onMousedown:t.withModifiers(ne,["self"]),onKeydown:x},[t.createElementVNode("div",{ref_key:"dialogRef",ref:d,class:"ifn-dialog",onMousedown:ge[1]||(ge[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Lu,[t.createElementVNode("span",_u,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:ne},[...ge[2]||(ge[2]=[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",$u,[t.createElementVNode("div",zu,[t.createElementVNode("label",Hu,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(_t,{class:"ifn-dialog__dropdown","model-value":i.value,options:g.value,searchable:!0,"search-placeholder":t.unref(b)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(b)(e.locale,"insertFunctionPlaceholder"),title:t.unref(b)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":q},null,8,["model-value","options","search-placeholder","fallback-label","title"]),C.value?(t.openBlock(),t.createElementBlock("div",Wu,t.toDisplayString(C.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Pu,[t.createElementVNode("label",Uu,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":ge[0]||(ge[0]=fe=>r.value=fe),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",Ku,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!B.value,onClick:ee},t.toDisplayString(t.unref(b)(e.locale,"insertFunctionBtn")),9,Gu),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:ne},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b21a714"]]),Qn="__filter_blank__";function er(e,n,l,o){if(Bl(e))return Number(e);if(o==="date"){const a=Ul(e,l);if(a)return a.serial}return null}function vo(e,n,l){if(e==null)return null;if(Bl(e))return Number(e);if(n==="date"){const o=Ul(e,l);if(o)return o.serial}return null}function Yu(e,n,l,o,a){const i=Ml(n,l,o);switch(e.operator){case"blank":return n.trim()==="";case"notBlank":return n.trim()!=="";case"equals":case"notEquals":{const r=e.operator==="equals";if(a==="number"||a==="date"){const d=er(n,l,o,a),y=vo(e.value,a,o);return d==null||y==null?!1:r?d===y:d!==y}const c=i.toLowerCase()===(e.value??"").toLowerCase();return r?c:!c}case"contains":return i.toLowerCase().includes((e.value??"").toLowerCase());case"notContains":return!i.toLowerCase().includes((e.value??"").toLowerCase());case"startsWith":return i.toLowerCase().startsWith((e.value??"").toLowerCase());case"endsWith":return i.toLowerCase().endsWith((e.value??"").toLowerCase());case"gt":case"gte":case"lt":case"lte":{const r=er(n,l,o,a),c=vo(e.value,a,o);return r==null||c==null?!1:e.operator==="gt"?r>c:e.operator==="gte"?r>=c:e.operator==="lt"?r<c:r<=c}case"between":{const r=er(n,l,o,a),c=vo(e.value,a,o),d=vo(e.value2,a,o);if(r==null||c==null||d==null)return!1;const y=Math.min(c,d),g=Math.max(c,d);return r>=y&&r<=g}}return!0}function la(e,n,l,o){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(n.trim()==="")return a.includes(Qn);const i=Ml(n,l,o);return a.includes(n)||a.includes(i)}return e.condition?Yu(e.condition,n,l,o,e.type):!0}function Xu(e,n,l,o){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const c=Number(r);if(c<i.startCol||c>i.endCol)continue;const d=a[r],y=l.getValue(c,n),g=l.getFormat(c,n);if(!la(d,y,g,o))return!1}return!0}function ju(e,n,l,o){const a=new Set,i=[];let r=!1;const{range:c,columns:d}=e;for(let g=c.startRow+1;g<=c.endRow;g++){let C=!0;for(const R in d){const I=Number(R);if(I===n)continue;const q=d[R];if(!la(q,l.getValue(I,g),l.getFormat(I,g),o)){C=!1;break}}if(!C)continue;const m=l.getValue(n,g),B=Ml(m,l.getFormat(n,g),o);if(m.trim()===""){r=!0;continue}a.has(B)||(a.add(B),i.push(B))}return i.length>0&&i.every(g=>Bl(g))?i.sort((g,C)=>Number(g)-Number(C)):i.sort((g,C)=>g.localeCompare(C,o,{numeric:!0})),{values:i,hasBlank:r}}function na(e){var n;return e?e.type==="values"?(((n=e.values)==null?void 0:n.length)??0)>0:!!e.condition:!1}const Zu={class:"filter-popup__head"},Ju={class:"filter-popup__head-label"},Qu={key:0,class:"filter-popup__head-badge"},ef={class:"filter-popup__search"},tf=["placeholder"],lf={class:"filter-popup__tools"},nf={class:"filter-popup__count"},of=["checked","onChange"],rf={class:"filter-popup__item-label"},af={key:0,class:"filter-popup__item-note"},sf={key:0,class:"filter-popup__empty"},cf={class:"filter-popup__modes"},df={key:1,class:"filter-popup__cond"},uf={class:"filter-popup__cond-row"},ff=["value"],mf={key:0,class:"filter-popup__cond-row"},pf={class:"filter-popup__cond-and"},hf={key:1,class:"filter-popup__cond-row"},gf=["placeholder"],bf={class:"filter-popup__footer"},tr=248,ko=28,yf=252,wf=Vt(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{}},setup(e){const n=e,l=t.ref(null),o=t.ref(null),a=t.ref(null),i=t.ref({left:0,top:0}),r=t.ref("values"),c=t.ref(""),d=t.ref(new Set),y=t.ref(!1),g=t.ref(0),C=t.ref(null),m=t.ref("equals"),B=t.ref(""),R=t.ref(""),I=t.computed(()=>n.getColumnCandidates(n.col)),q=t.computed(()=>c.value.trim()!==""),J=t.computed(()=>{const z=c.value.trim().toLowerCase();return z?I.value.values.filter(_=>_.toLowerCase().includes(z)):I.value.values}),ee=t.computed(()=>{const z=J.value.map(_=>({key:_,label:_,isBlank:!1}));return I.value.hasBlank&&!q.value&&z.push({key:Qn,label:b(n.locale,"filterBlank"),isBlank:!0}),z}),ne=Math.ceil(yf/ko),x=t.computed(()=>Math.max(0,Math.floor(g.value/ko)-2)),le=t.computed(()=>Math.min(ee.value.length,x.value+ne+4)),ge=t.computed(()=>ee.value.slice(x.value,le.value)),fe=t.computed(()=>x.value*ko),Ce=t.computed(()=>Math.max(0,(ee.value.length-le.value)*ko));function $e(z){g.value=z.target.scrollTop}const ze=["equals","notEquals","contains","notContains","startsWith","endsWith"],et=["equals","notEquals","gt","gte","lt","lte","between"],nt={equals:"filterEquals",notEquals:"filterNotEquals",contains:"filterContains",notContains:"filterNotContains",startsWith:"filterStartsWith",endsWith:"filterEndsWith",gt:"filterGreaterThan",gte:"filterGreaterThanOrEqual",lt:"filterLessThan",lte:"filterLessThanOrEqual",between:"filterBetween",blank:"filterBlank",notBlank:"filterNonBlank"},F=t.computed(()=>r.value==="text"?ze:et),A=t.computed(()=>{var ae;const z=n.getFilter(),_=z==null?void 0:z.columns[n.col];return _?_.type==="values"?(((ae=_.values)==null?void 0:ae.length)??0)>0:!!_.condition:!1});function Q(){const z=n.getFilter(),_=z==null?void 0:z.columns[n.col];_&&_.type==="values"?(d.value=new Set((_.values??[]).filter(ae=>ae!==Qn)),y.value=(_.values??[]).includes(Qn)):_&&_.condition?(r.value=_.type,m.value=_.condition.operator,B.value=_.condition.value??"",R.value=_.condition.value2??""):(d.value=new Set(I.value.values),y.value=I.value.hasBlank)}function we(){if(!n.getFilter())return;const _=I.value.values,ae=I.value.hasBlank;if(d.value.size===_.length&&_.every(Fe=>d.value.has(Fe))&&y.value===ae)n.setFilterColumn(n.col,null);else{const Fe=[...d.value];y.value&&Fe.push(Qn),n.setFilterColumn(n.col,{type:"values",values:Fe})}}function xe(z){const _=new Set(d.value);_.has(z)?_.delete(z):_.add(z),d.value=_}function X(){y.value=!y.value}function Ne(){const z=q.value?J.value:I.value.values,_=new Set(d.value);z.forEach(ae=>_.add(ae)),d.value=_,y.value=!0}function me(){d.value=new Set,y.value=!1}function Me(z){r.value=z,m.value=z==="text"?"contains":"equals",B.value="",R.value=""}function T(){r.value="values",Q()}function se(){const z={operator:m.value,value:B.value};r.value!=="text"&&m.value==="between"&&(z.value2=R.value),B.value.trim()!==""&&(n.setFilterColumn(n.col,{type:r.value,condition:z}),n.close())}function ie(){d.value=new Set(I.value.values),y.value=I.value.hasBlank}function re(){we(),n.close()}function K(){C.value&&n.setFilter(C.value),n.close()}function $(z){const _=l.value;_&&z.target instanceof Node&&_.contains(z.target)||n.close()}function de(z){z.key==="Escape"&&K()}return t.onMounted(async()=>{var Ke,Fe;C.value=n.getFilter()?JSON.parse(JSON.stringify(n.getFilter())):null,Q(),await t.nextTick();const z=((Ke=l.value)==null?void 0:Ke.offsetHeight)??400;let _=n.anchor.x+15-tr,ae=n.anchor.y+24;_<4&&(_=Math.max(4,n.anchor.x)),_+tr>window.innerWidth-4&&(_=Math.max(4,window.innerWidth-tr-4)),ae+z>window.innerHeight-4&&(ae=Math.max(4,n.anchor.y-z-4)),i.value={left:_,top:ae},(Fe=a.value)==null||Fe.focus(),document.addEventListener("pointerdown",$,!0),document.addEventListener("keydown",de,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",$,!0),document.removeEventListener("keydown",de,!0)}),(z,_)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:l,class:"filter-popup",style:t.normalizeStyle({left:i.value.left+"px",top:i.value.top+"px"}),onPointerdown:_[9]||(_[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Zu,[t.createElementVNode("span",Ju,t.toDisplayString(e.headerLabel||t.unref(rt)(e.col)),1),A.value?(t.openBlock(),t.createElementBlock("span",Qu,t.toDisplayString(t.unref(b)(e.locale,"filterActive")),1)):t.createCommentVNode("",!0)]),r.value==="values"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",ef,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":_[0]||(_[0]=ae=>c.value=ae),class:"filter-popup__search-input",type:"text",placeholder:t.unref(b)(e.locale,"filterSearchPlaceholder")},null,8,tf),[[t.vModelText,c.value]])]),t.createElementVNode("div",lf,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:Ne},t.toDisplayString(t.unref(b)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:me},t.toDisplayString(t.unref(b)(e.locale,"filterClearAll")),1),t.createElementVNode("span",nf,t.toDisplayString(t.unref(b)(e.locale,"filterFilteredCount").replace("{n}",String(I.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:o,class:"filter-popup__list",onScroll:$e},[t.createElementVNode("div",{style:t.normalizeStyle({height:fe.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,ae=>(t.openBlock(),t.createElementBlock("label",{key:ae.key,class:"filter-popup__item"},[t.createElementVNode("input",{type:"checkbox",checked:ae.isBlank?y.value:d.value.has(ae.key),onChange:Ke=>ae.isBlank?X():xe(ae.key)},null,40,of),t.createElementVNode("span",rf,t.toDisplayString(ae.label),1),ae.isBlank?(t.openBlock(),t.createElementBlock("span",af,"("+t.toDisplayString(t.unref(b)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:Ce.value+"px"})},null,4),ee.value.length===0?(t.openBlock(),t.createElementBlock("div",sf,t.toDisplayString(t.unref(b)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",cf,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:_[1]||(_[1]=ae=>Me("text"))},t.toDisplayString(t.unref(b)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:_[2]||(_[2]=ae=>Me("number"))},t.toDisplayString(t.unref(b)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:_[3]||(_[3]=ae=>Me("date"))},t.toDisplayString(t.unref(b)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",df,[t.createElementVNode("button",{class:"filter-popup__cond-back",onClick:T}," ← "+t.toDisplayString(t.unref(b)(e.locale,"filterCustom")),1),t.createElementVNode("div",uf,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":_[4]||(_[4]=ae=>m.value=ae),class:"filter-popup__cond-select"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(F.value,ae=>(t.openBlock(),t.createElementBlock("option",{key:ae,value:ae},t.toDisplayString(t.unref(b)(e.locale,nt[ae])),9,ff))),128))],512),[[t.vModelSelect,m.value]])]),m.value==="between"?(t.openBlock(),t.createElementBlock("div",mf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":_[5]||(_[5]=ae=>B.value=ae),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,B.value]]),t.createElementVNode("span",pf,t.toDisplayString(t.unref(b)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":_[6]||(_[6]=ae=>R.value=ae),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,R.value]])])):(t.openBlock(),t.createElementBlock("div",hf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":_[7]||(_[7]=ae=>B.value=ae),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"2024-01-01":"",onKeydown:t.withKeys(se,["enter"])},null,40,gf),[[t.vModelText,B.value]])]))])),t.createElementVNode("div",bf,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:ie},t.toDisplayString(t.unref(b)(e.locale,"clearFilter")),1),_[10]||(_[10]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:K},t.toDisplayString(t.unref(b)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:_[8]||(_[8]=ae=>r.value==="values"?re():se())},t.toDisplayString(t.unref(b)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-f6b7d944"]]),Cf={class:"cf-manager__header"},vf={class:"cf-manager__title"},kf={key:0,class:"cf-manager__empty"},Ef={key:1,class:"cf-manager__list"},Rf={class:"cf-rule__main"},Sf={class:"cf-rule__info"},Mf={class:"cf-rule__summary"},Bf={class:"cf-rule__range"},Nf={class:"cf-rule__actions"},xf={class:"cf-chk"},Tf=["checked","onChange"],Vf=["title","onClick"],Df=["title","onClick"],Ff=["title","onClick"],If=["title","onClick"],Of=Vt(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:n}){const l=e,o=n,a=t.computed(()=>[...l.rules].sort((d,y)=>d.priority-y.priority));function i(d){return d.ranges.map(y=>{const g=rt(y.startCol)+(y.startRow+1);return y.startCol===y.endCol&&y.startRow===y.endRow?g:g+":"+rt(y.endCol)+(y.endRow+1)}).join(", ")}function r(d){switch(d.type){case"cellIs":{const y=b(l.locale,"cf"+(d.operator==="greaterThan"?"GreaterThan":d.operator==="lessThan"?"LessThan":d.operator==="greaterThanOrEqual"?"GreaterThanOrEqual":d.operator==="lessThanOrEqual"?"LessThanOrEqual":d.operator==="notEqual"?"NotEqual":d.operator==="between"?"Between":d.operator==="notBetween"?"NotBetween":"Equal"));return d.operator==="between"||d.operator==="notBetween"?`${y} ${d.value} ${b(l.locale,"cfValue2")} ${d.value2??""}`:`${y} ${d.value}`}case"textContains":return`${b(l.locale,"cfTextContains")} "${d.value}"`;case"textNotContains":return`${b(l.locale,"cfTextNotContains")} "${d.value}"`;case"blank":return b(l.locale,"cfBlank");case"notBlank":return b(l.locale,"cfNotBlank");case"duplicate":return b(l.locale,"cfDuplicate");case"unique":return b(l.locale,"cfUnique");case"formula":return"= "+d.formula;default:return b(l.locale,"cfRuleTypeGeneric")}}function c(d){const y={};return d.format.backgroundColor&&(y.background=d.format.backgroundColor),d.format.color&&(y.color=d.format.color),d.format.fontWeight==="bold"&&(y.fontWeight="700"),d.format.fontStyle==="italic"&&(y.fontStyle="italic"),d.format.underline==="underline"&&(y.textDecoration="underline"),d.format.strikethrough==="line-through"&&(y.textDecoration="line-through"),y}return(d,y)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Cf,[t.createElementVNode("span",vf,t.toDisplayString(t.unref(b)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",onClick:y[0]||(y[0]=g=>o("new"))},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:y[1]||(y[1]=g=>o("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",kf,t.toDisplayString(t.unref(b)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",Ef,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,g=>(t.openBlock(),t.createElementBlock("div",{key:g.id,class:t.normalizeClass(["cf-rule",{"cf-rule--disabled":!g.enabled}])},[t.createElementVNode("div",Rf,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(c(g))},"Aa",4),t.createElementVNode("div",Sf,[t.createElementVNode("div",Mf,t.toDisplayString(r(g.condition)),1),t.createElementVNode("div",Bf,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(g)),1)])]),t.createElementVNode("div",Nf,[t.createElementVNode("label",xf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:g.enabled,onChange:C=>o("toggle",g.id,C.target.checked)},null,40,Tf),y[2]||(y[2]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)]),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfMoveUp"),onClick:C=>o("move",g.id,"up")},[...y[3]||(y[3]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 7 L8 3 L12 7"})],-1)])],8,Vf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfMoveDown"),onClick:C=>o("move",g.id,"down")},[...y[4]||(y[4]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 9 L8 13 L12 9"})],-1)])],8,Df),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfEdit"),onClick:C=>o("edit",g)},[...y[5]||(y[5]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M10.5 3.5 L13 6 L5 14 L2 14 L2 11 Z"}),t.createElementVNode("path",{d:"M9 5.5 L11.5 8"})],-1)])],8,Ff),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfDelete"),onClick:C=>o("delete",g.id)},[...y[6]||(y[6]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},[t.createElementVNode("path",{d:"M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5"})],-1)])],8,If)])],2))),128))]))],4))}}),[["__scopeId","data-v-230c5fcf"]]),Af={class:"cf-editor__header"},Lf={class:"cf-editor__title"},_f={class:"cf-editor__body"},$f={class:"cf-row"},zf={class:"cf-label"},Hf={class:"cf-row"},Wf={class:"cf-label"},Pf={class:"cf-row"},Uf={class:"cf-label"},Kf={key:0,class:"cf-row"},Gf={class:"cf-label"},qf={class:"cf-row"},Yf={class:"cf-label"},Xf=["placeholder"],jf={class:"cf-hint"},Zf={key:2,class:"cf-row"},Jf={class:"cf-label"},Qf={class:"cf-row"},em={class:"cf-label"},tm={class:"cf-format-row"},lm=["title"],nm={viewBox:"0 0 1024 1024",fill:"currentColor"},om=["fill"],rm=["title"],am={viewBox:"0 0 1024 1024",fill:"currentColor"},im=["fill"],sm=["title"],cm=["title"],dm=["title"],um=["title"],fm={class:"cf-row"},mm={class:"cf-label"},pm={key:3,class:"cf-error"},hm={class:"cf-row cf-row--inline"},gm={class:"cf-chk"},bm=["checked"],ym={class:"cf-chk"},wm=["checked"],Cm={class:"cf-editor__footer"},vm=Vt(t.defineComponent({__name:"conditional-format-rule-editor",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel"],setup(e,{emit:n}){const l=e,o=n,a=[{label:"cfCellIs",value:"cellIs"},{label:"cfTextContains",value:"textContains"},{label:"cfTextNotContains",value:"textNotContains"},{label:"cfBlank",value:"blank"},{label:"cfNotBlank",value:"notBlank"},{label:"cfDuplicate",value:"duplicate"},{label:"cfUnique",value:"unique"},{label:"cfFormulaShort",value:"formula"}],i=[{label:"cfEqual",value:"equal"},{label:"cfNotEqual",value:"notEqual"},{label:"cfGreaterThan",value:"greaterThan"},{label:"cfGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"cfLessThan",value:"lessThan"},{label:"cfLessThanOrEqual",value:"lessThanOrEqual"},{label:"cfBetween",value:"between"},{label:"cfNotBetween",value:"notBetween"}];function r(){if(l.rule){const F=l.rule.condition;return{type:F.type==="cellIs"||F.type==="textContains"||F.type==="textNotContains"||F.type==="blank"||F.type==="notBlank"||F.type==="duplicate"||F.type==="unique"||F.type==="formula"?F.type:"cellIs",operator:F.type==="cellIs"?F.operator:"greaterThan",value:F.type==="cellIs"||F.type==="textContains"||F.type==="textNotContains"?F.value:"",value2:F.type==="cellIs"?F.value2??"":"",formula:F.type==="formula"?F.formula:"",backgroundColor:l.rule.format.backgroundColor??"",color:l.rule.format.color??"",fontWeight:l.rule.format.fontWeight==="bold",fontStyle:l.rule.format.fontStyle==="italic",underline:l.rule.format.underline==="underline",strikethrough:l.rule.format.strikethrough==="line-through",rangeText:l.rule.ranges.length?l.rule.ranges.map(Q=>B(Q)).join(", "):l.defaultRangeText,stopIfTrue:l.rule.stopIfTrue,enabled:l.rule.enabled}}return{type:"cellIs",operator:"greaterThan",value:"",value2:"",formula:"",backgroundColor:"#DEEBF7",color:"#17375E",fontWeight:!1,fontStyle:!1,underline:!1,strikethrough:!1,rangeText:l.defaultRangeText,stopIfTrue:!1,enabled:!0}}const c=t.reactive(r()),d=t.ref(!1),y=t.ref(!1),g=t.ref(null),C=t.ref(null),m=t.ref("");function B(F){const A=rt(F.startCol)+(F.startRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?A:A+":"+rt(F.endCol)+(F.endRow+1)}function R(F){const A=F.split(",").map(we=>we.trim()).filter(Boolean),Q=[];for(const we of A){if(!we.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const X=cl(we.split(":")[0],99999,99999),Ne=we.split(":")[1],me=Ne?cl(Ne,99999,99999):X;if(!X||!me)return null;Q.push({startCol:Math.min(X.col,me.col),endCol:Math.max(X.col,me.col),startRow:Math.min(X.row,me.row),endRow:Math.max(X.row,me.row)})}return Q.length?Q:null}const I=t.computed(()=>c.type==="cellIs"&&(c.operator==="between"||c.operator==="notBetween")),q=t.computed(()=>c.type==="formula"),J=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(c.type)),ee=t.computed(()=>a.map(F=>({value:F.value,label:b(l.locale,F.label)}))),ne=t.computed(()=>i.map(F=>({value:F.value,label:b(l.locale,F.label)})));function x(F){c.type=F}function le(F){c.operator=String(F)}function ge(){d.value=!d.value}function fe(){y.value=!y.value}function Ce(){return m.value="",R(c.rangeText)?q.value&&!c.formula.trim()?(m.value="请输入公式",!1):!0:(m.value="范围格式无效,例如 A1:B10",!1)}function $e(){switch(c.type){case"cellIs":return{type:"cellIs",operator:c.operator,value:c.value,value2:c.value2||void 0};case"textContains":return{type:"textContains",value:c.value};case"textNotContains":return{type:"textNotContains",value:c.value};case"blank":return{type:"blank"};case"notBlank":return{type:"notBlank"};case"duplicate":return{type:"duplicate"};case"unique":return{type:"unique"};case"formula":return{type:"formula",formula:c.formula}}}function ze(){return{backgroundColor:c.backgroundColor||void 0,color:c.color||void 0,fontWeight:c.fontWeight?"bold":"",fontStyle:c.fontStyle?"italic":"",underline:c.underline?"underline":"",strikethrough:c.strikethrough?"line-through":""}}function et(){var Q,we;if(!Ce())return;const F=R(c.rangeText),A={id:((Q=l.rule)==null?void 0:Q.id)??"",condition:$e(),format:ze(),ranges:F,priority:((we=l.rule)==null?void 0:we.priority)??0,stopIfTrue:c.stopIfTrue,enabled:c.enabled};o("save",A)}function nt(){o("cancel")}return(F,A)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Af,[t.createElementVNode("span",Lf,t.toDisplayString(e.mode==="edit"?t.unref(b)(e.locale,"cfEdit"):t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-editor__close",onClick:nt}," × ")]),t.createElementVNode("div",_f,[t.createElementVNode("div",$f,[t.createElementVNode("label",zf,t.toDisplayString(t.unref(b)(e.locale,"cfType")),1),t.createVNode(_t,{class:"cf-dropdown","model-value":c.type,options:ee.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"cfType"),align:"right",onChange:x},null,8,["model-value","options","title"])]),c.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Hf,[t.createElementVNode("label",Wf,t.toDisplayString(t.unref(b)(e.locale,"cfOperator")),1),t.createVNode(_t,{class:"cf-dropdown","model-value":c.operator,options:ne.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"cfOperator"),align:"right",onChange:le},null,8,["model-value","options","title"])]),t.createElementVNode("div",Pf,[t.createElementVNode("label",Uf,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[0]||(A[0]=Q=>c.value=Q),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])]),I.value?(t.openBlock(),t.createElementBlock("div",Kf,[t.createElementVNode("label",Gf,t.toDisplayString(t.unref(b)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=Q=>c.value2=Q),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value2]])])):t.createCommentVNode("",!0)],64)):q.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",qf,[t.createElementVNode("label",Yf,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[2]||(A[2]=Q=>c.formula=Q),class:"cf-input",type:"text",placeholder:t.unref(b)(e.locale,"cfFormulaExample")},null,8,Xf),[[t.vModelText,c.formula]])]),t.createElementVNode("p",jf,t.toDisplayString(t.unref(b)(e.locale,"cfFormula")),1)],64)):J.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Zf,[t.createElementVNode("label",Jf,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[3]||(A[3]=Q=>c.value=Q),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])])),t.createElementVNode("div",Qf,[t.createElementVNode("label",em,t.toDisplayString(t.unref(b)(e.locale,"cfFormat")),1),t.createElementVNode("div",tm,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:g,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.value}]),title:t.unref(b)(e.locale,"fillColor"),onClick:ge},[(t.openBlock(),t.createElementBlock("svg",nm,[A[15]||(A[15]=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:c.backgroundColor||"currentColor"},null,8,om)]))],10,lm),t.createVNode(go,{"model-open":d.value,"color-key":"fill","current-color":c.backgroundColor,"trigger-el":g.value,locale:e.locale,"onUpdate:modelOpen":A[4]||(A[4]=Q=>d.value=Q),onChange:A[5]||(A[5]=Q=>c.backgroundColor=Q)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:C,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":y.value}]),title:t.unref(b)(e.locale,"fontColor"),onClick:fe},[(t.openBlock(),t.createElementBlock("svg",am,[A[16]||(A[16]=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:c.color||"#000000"},null,8,im)]))],10,rm),t.createVNode(go,{"model-open":y.value,"color-key":"text","current-color":c.color,"trigger-el":C.value,locale:e.locale,"onUpdate:modelOpen":A[6]||(A[6]=Q=>y.value=Q),onChange:A[7]||(A[7]=Q=>c.color=Q)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.fontWeight}]),title:t.unref(b)(e.locale,"bold"),onClick:A[8]||(A[8]=Q=>c.fontWeight=!c.fontWeight)},[...A[17]||(A[17]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)])],10,sm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.fontStyle}]),title:t.unref(b)(e.locale,"italic"),onClick:A[9]||(A[9]=Q=>c.fontStyle=!c.fontStyle)},[...A[18]||(A[18]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)])],10,cm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.underline}]),title:t.unref(b)(e.locale,"underline"),onClick:A[10]||(A[10]=Q=>c.underline=!c.underline)},[...A[19]||(A[19]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)])],10,dm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.strikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),onClick:A[11]||(A[11]=Q=>c.strikethrough=!c.strikethrough)},[...A[20]||(A[20]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)])],10,um)])]),t.createElementVNode("div",fm,[t.createElementVNode("label",mm,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[12]||(A[12]=Q=>c.rangeText=Q),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.rangeText]])]),m.value?(t.openBlock(),t.createElementBlock("div",pm,t.toDisplayString(m.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",hm,[t.createElementVNode("label",gm,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.stopIfTrue,onChange:A[13]||(A[13]=Q=>c.stopIfTrue=Q.target.checked)},null,40,bm),A[21]||(A[21]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfStopIfTrue")),1)]),t.createElementVNode("label",ym,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.enabled,onChange:A[14]||(A[14]=Q=>c.enabled=Q.target.checked)},null,40,wm),A[22]||(A[22]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)])])]),t.createElementVNode("div",Cm,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:et},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:nt},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-f625bb44"]]),km={class:"dv-editor__header"},Em={class:"dv-editor__title"},Rm={class:"dv-editor__body"},Sm={class:"dv-sec"},Mm={class:"dv-sec__title"},Bm={class:"dv-row"},Nm={class:"dv-label"},xm={class:"dv-row"},Tm={class:"dv-label"},Vm={class:"dv-hint"},Dm={class:"dv-row dv-row--inline"},Fm={class:"dv-chk"},Im=["checked"],Om={class:"dv-row"},Am={class:"dv-label"},Lm={class:"dv-hint"},_m={class:"dv-row"},$m={class:"dv-label"},zm={key:0,class:"dv-row"},Hm={class:"dv-label"},Wm={class:"dv-row"},Pm={class:"dv-label"},Um={class:"dv-row"},Km={class:"dv-label"},Gm={class:"dv-row dv-row--inline"},qm=["checked","disabled"],Ym=["checked","disabled"],Xm={class:"dv-sec"},jm={class:"dv-sec__title"},Zm={class:"dv-row dv-row--inline"},Jm={class:"dv-chk"},Qm=["checked"],e0={class:"dv-row"},t0={class:"dv-label"},l0=["disabled"],n0={class:"dv-row dv-row--top"},o0={class:"dv-label"},r0=["disabled"],a0={class:"dv-sec"},i0={class:"dv-sec__title"},s0={class:"dv-row dv-row--inline"},c0={class:"dv-chk"},d0=["checked"],u0={class:"dv-row"},f0={class:"dv-label"},m0={class:"dv-row"},p0={class:"dv-label"},h0=["disabled"],g0={class:"dv-row dv-row--top"},b0={class:"dv-label"},y0=["disabled"],w0={class:"dv-sec"},C0={class:"dv-row"},v0={class:"dv-label"},k0={key:0,class:"dv-error"},E0={class:"dv-editor__footer"},Eo="\\$?[A-Za-z]+\\$?\\d+",R0=Vt(t.defineComponent({__name:"data-validation-dialog",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel","clear"],setup(e,{emit:n}){const l=e,o=n,a=[{label:"dvTypeAny",value:"any"},{label:"dvTypeList",value:"list"},{label:"dvTypeWholeNumber",value:"wholeNumber"},{label:"dvTypeDecimal",value:"decimal"},{label:"dvTypeDate",value:"date"},{label:"dvTypeTime",value:"time"},{label:"dvTypeTextLength",value:"textLength"},{label:"dvTypeCustom",value:"custom"}],i=[{label:"dvBetween",value:"between"},{label:"dvNotBetween",value:"notBetween"},{label:"dvEqual",value:"equal"},{label:"dvNotEqual",value:"notEqual"},{label:"dvGreaterThan",value:"greaterThan"},{label:"dvGreaterThanOrEqual",value:"greaterThanOrEqual"},{label:"dvLessThan",value:"lessThan"},{label:"dvLessThanOrEqual",value:"lessThanOrEqual"}],r=[{label:"dvStyleStop",value:"stop"},{label:"dvStyleWarning",value:"warning"},{label:"dvStyleInformation",value:"information"}];function c(F){const A=rt(F.startCol)+(F.startRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?A:A+":"+rt(F.endCol)+(F.endRow+1)}function d(F){const A=F==null?void 0:F.listSource;if((A==null?void 0:A.type)==="range"){const we=c(A.range);return A.sheetId?`${A.sheetId}!${we}`:we}return((A==null?void 0:A.type)==="values"?A.values:(F==null?void 0:F.values)??[]).join(",")}function y(){const F=l.rule;return{type:(F==null?void 0:F.type)??"any",operator:(F==null?void 0:F.operator)??"between",formula1:(F==null?void 0:F.formula1)??"",formula2:(F==null?void 0:F.formula2)??"",source:d(F),allowBlank:(F==null?void 0:F.allowBlank)!==!1,showDropdown:(F==null?void 0:F.showDropdown)!==!1,showInputMessage:(F==null?void 0:F.showInputMessage)===!0,inputTitle:(F==null?void 0:F.inputTitle)??"",inputMessage:(F==null?void 0:F.inputMessage)??"",showErrorMessage:(F==null?void 0:F.showErrorMessage)!==!1,errorStyle:(F==null?void 0:F.errorStyle)??"stop",errorTitle:(F==null?void 0:F.errorTitle)??"",errorMessage:(F==null?void 0:F.errorMessage)??"",rangeText:F&&F.ranges.length?F.ranges.map(c).join(", "):l.defaultRangeText,enabled:(F==null?void 0:F.enabled)!==!1}}const g=t.reactive(y()),C=t.ref(""),m=t.computed(()=>g.type==="list"),B=t.computed(()=>g.type==="custom"),R=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(g.type)),I=t.computed(()=>R.value&&(g.operator==="between"||g.operator==="notBetween")),q=t.computed(()=>g.type==="any"),J=t.computed(()=>a.map(F=>({value:F.value,label:b(l.locale,F.label)}))),ee=t.computed(()=>i.map(F=>({value:F.value,label:b(l.locale,F.label)}))),ne=t.computed(()=>r.map(F=>({value:F.value,label:b(l.locale,F.label)})));function x(F){const A=F.split(",").map(we=>we.trim()).filter(Boolean),Q=[];for(const we of A){if(!we.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const X=cl(we.split(":")[0],99999,99999),Ne=we.split(":")[1],me=Ne?cl(Ne,99999,99999):X;if(!X||!me)return null;Q.push({startCol:Math.min(X.col,me.col),endCol:Math.max(X.col,me.col),startRow:Math.min(X.row,me.row),endRow:Math.max(X.row,me.row)})}return Q.length?Q:null}function le(F){const A=F.trim();if(!A)return null;const Q=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${Eo})(?::(${Eo}))?$`).exec(A);if(Q){const X=(Q[1]??Q[2]??"").trim(),Ne=cl(Q[3],99999,99999),me=Q[4]?cl(Q[4],99999,99999):Ne;return!X||!Ne||!me?null:{type:"range",sheetId:X,range:{startCol:Math.min(Ne.col,me.col),endCol:Math.max(Ne.col,me.col),startRow:Math.min(Ne.row,me.row),endRow:Math.max(Ne.row,me.row)}}}const we=new RegExp(`^(${Eo})(?::(${Eo}))?$`).exec(A);if(we){const X=cl(we[1],99999,99999),Ne=we[2]?cl(we[2],99999,99999):X;return!X||!Ne?null:{type:"range",range:{startCol:Math.min(X.col,Ne.col),endCol:Math.max(X.col,Ne.col),startRow:Math.min(X.row,Ne.row),endRow:Math.max(X.row,Ne.row)}}}const xe=A.split(",").map(X=>X.trim());return xe.some(X=>X!=="")?{type:"values",values:xe}:null}const ge=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function fe(F,A){const Q=A.trim();if(Q==="")return b(l.locale,"dvValueRequired");if(Q.startsWith("="))return null;const we=l.locale;switch(F){case"wholeNumber":case"textLength":{const xe=ho(Q,we);return xe&&Number.isFinite(xe.num)&&Number.isInteger(xe.num)||ge.test(Q)&&Number.isInteger(Number(Q))?null:b(we,"dvMustBeInteger")}case"decimal":{const xe=ho(Q,we);return xe&&Number.isFinite(xe.num)||ge.test(Q)&&Number.isFinite(Number(Q))?null:b(we,"dvMustBeNumber")}case"date":{const xe=Ul(Q,we);return xe&&xe.format!=="h:mm:ss"?null:b(we,"dvDateInvalid")}case"time":return Ul(Q,we)?null:b(we,"dvTimeInvalid");default:return null}}function Ce(){if(C.value="",!x(g.rangeText))return C.value=b(l.locale,"dvRangeInvalid"),!1;if(g.type==="any")return!0;if(m.value)return le(g.source)?!0:(C.value=b(l.locale,"dvSourceInvalid"),!1);if(B.value)return g.formula1.trim()?!0:(C.value=b(l.locale,"dvFormulaRequired"),!1);if(I.value){if(!g.formula1.trim())return C.value=b(l.locale,"dvMinRequired"),!1;if(!g.formula2.trim())return C.value=b(l.locale,"dvMaxRequired"),!1;const A=fe(g.type,g.formula1);if(A)return C.value=`${b(l.locale,"dvMin")}:${A}`,!1;const Q=fe(g.type,g.formula2);return Q?(C.value=`${b(l.locale,"dvMax")}:${Q}`,!1):!0}if(!g.formula1.trim())return C.value=b(l.locale,"dvValueRequired"),!1;const F=fe(g.type,g.formula1);return F?(C.value=`${b(l.locale,"dvValue")}:${F}`,!1):!0}function $e(){var Q,we;if(!Ce())return;const F=x(g.rangeText);if(g.type==="any"){o("save",{id:((Q=l.rule)==null?void 0:Q.id)??"",type:"any",ranges:F,allowBlank:g.allowBlank,enabled:!0});return}const A={id:((we=l.rule)==null?void 0:we.id)??"",type:g.type,ranges:F,allowBlank:g.allowBlank,enabled:g.enabled,showInputMessage:g.showInputMessage,inputTitle:g.inputTitle||void 0,inputMessage:g.inputMessage||void 0,showErrorMessage:g.showErrorMessage,errorStyle:g.errorStyle,errorTitle:g.errorTitle||void 0,errorMessage:g.errorMessage||void 0};if(m.value){const xe=le(g.source);A.listSource=xe,A.values=xe.type==="values"?xe.values:void 0,A.showDropdown=g.showDropdown}else B.value?A.formula1=g.formula1.trim():(A.operator=g.operator,A.formula1=g.formula1.trim(),A.formula2=I.value?g.formula2.trim():void 0);o("save",A)}function ze(F){g.type=F}function et(F){g.operator=String(F)}function nt(F){g.errorStyle=String(F)}return(F,A)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",km,[t.createElementVNode("span",Em,t.toDisplayString(t.unref(b)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:A[0]||(A[0]=Q=>o("cancel"))}," × ")]),t.createElementVNode("div",Rm,[t.createElementVNode("div",Sm,[t.createElementVNode("div",Mm,t.toDisplayString(t.unref(b)(e.locale,"dvSettings")),1),t.createElementVNode("div",Bm,[t.createElementVNode("label",Nm,t.toDisplayString(t.unref(b)(e.locale,"dvAllow")),1),t.createVNode(_t,{class:"dv-dropdown","model-value":g.type,options:J.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"dvAllow"),align:"right",onChange:ze},null,8,["model-value","options","title"])]),m.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",xm,[t.createElementVNode("label",Tm,t.toDisplayString(t.unref(b)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=Q=>g.source=Q),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,g.source]])]),t.createElementVNode("p",Vm,t.toDisplayString(t.unref(b)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",Dm,[t.createElementVNode("label",Fm,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:g.showDropdown,onChange:A[2]||(A[2]=Q=>g.showDropdown=Q.target.checked)},null,40,Im),A[18]||(A[18]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowDropdown")),1)])])],64)):B.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Om,[t.createElementVNode("label",Am,t.toDisplayString(t.unref(b)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[3]||(A[3]=Q=>g.formula1=Q),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,g.formula1]])]),t.createElementVNode("p",Lm,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaExample")),1)],64)):R.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",_m,[t.createElementVNode("label",$m,t.toDisplayString(t.unref(b)(e.locale,"dvData")),1),t.createVNode(_t,{class:"dv-dropdown","model-value":g.operator,options:ee.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"dvOperator"),align:"right",onChange:et},null,8,["model-value","options","title"])]),I.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Wm,[t.createElementVNode("label",Pm,t.toDisplayString(t.unref(b)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[5]||(A[5]=Q=>g.formula1=Q),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,g.formula1]])]),t.createElementVNode("div",Um,[t.createElementVNode("label",Km,t.toDisplayString(t.unref(b)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[6]||(A[6]=Q=>g.formula2=Q),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,g.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",zm,[t.createElementVNode("label",Hm,t.toDisplayString(t.unref(b)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[4]||(A[4]=Q=>g.formula1=Q),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,g.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",Gm,[t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":q.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:g.allowBlank,disabled:q.value,onChange:A[7]||(A[7]=Q=>g.allowBlank=Q.target.checked)},null,40,qm),A[19]||(A[19]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvIgnoreBlank")),1)],2),t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":q.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:g.enabled,disabled:q.value,onChange:A[8]||(A[8]=Q=>g.enabled=Q.target.checked)},null,40,Ym),A[20]||(A[20]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"cfEnabled")),1)],2)])]),t.createElementVNode("div",Xm,[t.createElementVNode("div",jm,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",Zm,[t.createElementVNode("label",Jm,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:g.showInputMessage,onChange:A[9]||(A[9]=Q=>g.showInputMessage=Q.target.checked)},null,40,Qm),A[21]||(A[21]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowInputMessage")),1)])]),t.createElementVNode("div",e0,[t.createElementVNode("label",t0,t.toDisplayString(t.unref(b)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[10]||(A[10]=Q=>g.inputTitle=Q),class:"dv-input",type:"text",disabled:!g.showInputMessage},null,8,l0),[[t.vModelText,g.inputTitle]])]),t.createElementVNode("div",n0,[t.createElementVNode("label",o0,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":A[11]||(A[11]=Q=>g.inputMessage=Q),class:"dv-input dv-input--area",rows:"2",disabled:!g.showInputMessage},null,8,r0),[[t.vModelText,g.inputMessage]])])]),t.createElementVNode("div",a0,[t.createElementVNode("div",i0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",s0,[t.createElementVNode("label",c0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:g.showErrorMessage,onChange:A[12]||(A[12]=Q=>g.showErrorMessage=Q.target.checked)},null,40,d0),A[22]||(A[22]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(b)(e.locale,"dvShowErrorAlert")),1)])]),t.createElementVNode("div",u0,[t.createElementVNode("label",f0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorStyle")),1),t.createVNode(_t,{class:"dv-dropdown","model-value":g.errorStyle,options:ne.value,width:"100%","visible-count":4,title:t.unref(b)(e.locale,"dvErrorStyle"),align:"right",onChange:nt},null,8,["model-value","options","title"])]),t.createElementVNode("div",m0,[t.createElementVNode("label",p0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[13]||(A[13]=Q=>g.errorTitle=Q),class:"dv-input",type:"text",disabled:!g.showErrorMessage},null,8,h0),[[t.vModelText,g.errorTitle]])]),t.createElementVNode("div",g0,[t.createElementVNode("label",b0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":A[14]||(A[14]=Q=>g.errorMessage=Q),class:"dv-input dv-input--area",rows:"2",disabled:!g.showErrorMessage},null,8,y0),[[t.vModelText,g.errorMessage]])])]),t.createElementVNode("div",w0,[t.createElementVNode("div",C0,[t.createElementVNode("label",v0,t.toDisplayString(t.unref(b)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[15]||(A[15]=Q=>g.rangeText=Q),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,g.rangeText]])])]),C.value?(t.openBlock(),t.createElementBlock("div",k0,t.toDisplayString(C.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",E0,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",onClick:A[16]||(A[16]=Q=>o("clear"))},t.toDisplayString(t.unref(b)(e.locale,"dvClearAll")),1),A[23]||(A[23]=t.createElementVNode("span",{class:"dv-editor__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--primary",onClick:$e},t.toDisplayString(t.unref(b)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:A[17]||(A[17]=Q=>o("cancel"))},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-dc3b8000"]]),S0={key:0,class:"dvd__search"},M0=["placeholder"],B0=["onMouseenter","onClick"],N0={class:"dvd__check"},x0={class:"dvd__label"},T0={key:1,class:"dvd__empty"},gl=24,V0=244,D0=140,F0=Vt(t.defineComponent({__name:"data-validation-dropdown",props:{items:{default:()=>[]},current:{default:""},locale:{default:"zh-CN"},x:{default:0},y:{default:0},width:{default:100},height:{default:24}},emits:["select","close"],setup(e,{emit:n}){const l=e,o=n,a=t.ref(""),i=t.ref(0),r=t.ref(0),c=t.ref(null),d=t.ref(null),y=t.ref(null),g=t.ref({left:l.x,top:l.y+l.height+2,up:!1}),C=t.computed(()=>{const F=a.value.trim().toLowerCase();return F?l.items.filter(A=>String(A??"").toLowerCase().includes(F)):l.items}),m=t.computed(()=>Math.min(V0,Math.max(gl,C.value.length*gl))),B=t.computed(()=>Math.max(D0,Math.min(360,l.width))),R=t.computed(()=>Math.max(0,Math.floor(r.value/gl)-1)),I=t.computed(()=>Math.min(C.value.length,Math.ceil((r.value+m.value)/gl)+1)),q=t.computed(()=>C.value.slice(R.value,I.value)),J=t.computed(()=>R.value*gl),ee=t.computed(()=>Math.max(0,(C.value.length-I.value)*gl));function ne(F){return String(F??"").trim().toLowerCase()===String(l.current??"").trim().toLowerCase()}function x(){const F=m.value+le(),A=window.innerHeight-(l.y+l.height)-8,Q=l.y-8,we=A<F&&Q>A;let xe=we?l.y-F-2:l.y+l.height+2;xe=Math.max(8,Math.min(window.innerHeight-F-8,xe));const X=Math.max(8,Math.min(window.innerWidth-B.value-8,l.x));g.value={left:X,top:xe,up:we}}function le(){return C.value.length>8||a.value?34:0}t.watch(()=>[l.x,l.y,l.width,l.height],()=>x()),t.onMounted(()=>{t.nextTick(()=>{var F;x(),c.value?c.value.focus():(F=y.value)==null||F.focus()}),document.addEventListener("pointerdown",ge,!0),window.addEventListener("resize",fe),window.addEventListener("scroll",fe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ge,!0),window.removeEventListener("resize",fe),window.removeEventListener("scroll",fe,!0)});function ge(F){var A;(A=y.value)!=null&&A.contains(F.target)||fe()}function fe(){o("close")}function Ce(F){const A=d.value;if(!A)return;const Q=F*gl,we=Q+gl;Q<A.scrollTop?A.scrollTop=Q:we>A.scrollTop+m.value&&(A.scrollTop=we-m.value)}function $e(F){const A=C.value.length;A!==0&&(i.value=(i.value+F+A)%A,Ce(i.value))}function ze(F){const A=C.value[F];A!==void 0&&o("select",A)}function et(F){r.value=F.target.scrollTop}function nt(F){switch(F.key){case"ArrowDown":F.preventDefault(),F.stopPropagation(),$e(1);return;case"ArrowUp":F.preventDefault(),F.stopPropagation(),$e(-1);return;case"Home":F.preventDefault(),F.stopPropagation(),i.value=0,r.value=0,d.value&&(d.value.scrollTop=0);return;case"End":{F.preventDefault(),F.stopPropagation();const A=C.value.length;i.value=Math.max(0,A-1),Ce(i.value);return}case"PageDown":F.preventDefault(),F.stopPropagation(),$e(Math.max(1,Math.floor(m.value/gl)));return;case"PageUp":F.preventDefault(),F.stopPropagation(),$e(-Math.max(1,Math.floor(m.value/gl)));return;case"Enter":F.preventDefault(),F.stopPropagation(),ze(i.value);return;case"Escape":F.preventDefault(),F.stopPropagation(),fe();return;case"Tab":F.preventDefault(),F.stopPropagation(),ze(i.value);return}}return t.watch(a,()=>{i.value=0,r.value=0,d.value&&(d.value.scrollTop=0),t.nextTick(x)}),t.watch(C,F=>{const A=F.findIndex(Q=>ne(Q));A>=0&&(i.value=A,t.nextTick(()=>Ce(A)))},{immediate:!0}),(F,A)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"dvd",tabindex:"-1",style:t.normalizeStyle({left:g.value.left+"px",top:g.value.top+"px",width:B.value+"px"}),onKeydown:nt,onWheel:A[2]||(A[2]=t.withModifiers(()=>{},["stop"]))},[le()>0?(t.openBlock(),t.createElementBlock("div",S0,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:c,"onUpdate:modelValue":A[0]||(A[0]=Q=>a.value=Q),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(b)(e.locale,"dvSearchPlaceholder"),onKeydown:nt},null,40,M0),[[t.vModelText,a.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"dvd__list",style:t.normalizeStyle({height:m.value+"px"}),onScroll:et},[t.createElementVNode("div",{style:t.normalizeStyle({height:J.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(q.value,(Q,we)=>(t.openBlock(),t.createElementBlock("div",{key:R.value+we,class:t.normalizeClass(["dvd__item",{"dvd__item--active":R.value+we===i.value,"dvd__item--checked":ne(Q)}]),style:t.normalizeStyle({height:gl+"px",lineHeight:gl+"px"}),onMousedown:A[1]||(A[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:xe=>i.value=R.value+we,onClick:xe=>ze(R.value+we)},[t.createElementVNode("span",N0,t.toDisplayString(ne(Q)?"✓":""),1),t.createElementVNode("span",x0,t.toDisplayString(Q===""?"(空)":Q),1)],46,B0))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ee.value+"px"})},null,4)],36),C.value.length===0?(t.openBlock(),t.createElementBlock("div",T0,t.toDisplayString(t.unref(b)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],36))}}),[["__scopeId","data-v-9c588d8f"]]),I0={class:"dv-alert__header"},O0={class:"dv-alert__title"},A0={class:"dv-alert__body"},L0=["d"],_0={class:"dv-alert__text"},$0={key:0,class:"dv-alert__subtitle"},z0={class:"dv-alert__message"},H0={class:"dv-alert__footer"},oa=Vt(t.defineComponent({__name:"data-validation-alert",props:{locale:{},severity:{},title:{default:""},message:{default:""},themeVars:{default:()=>({})}},emits:["resolve"],setup(e,{emit:n}){const l=e,o=n,a={stop:{color:"#d93025",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-160 224h320a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"},warning:{color:"#f4b400",path:"M512 96l416 736H96L512 96zm0 128L192 768h640L512 224zm-32 128a32 32 0 0 1 32 32v160a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32zm0 256a36 36 0 1 1 0 72 36 36 0 0 1 0-72z"},information:{color:"#1a73e8",path:"M512 64a448 448 0 1 0 0 896 448 448 0 0 0 0-896zm0 96a352 352 0 1 1 0 704 352 352 0 0 1 0-704zm-32 128a32 32 0 0 1 64 0v32a32 32 0 0 1-64 0V288zm32 128a36 36 0 1 1 0 72 36 36 0 0 1 0-72zm0 96a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0V544a32 32 0 0 1 32-32z"}},i=t.computed(()=>a[l.severity]??a.stop),r=t.computed(()=>l.title?l.title:l.severity==="warning"?b(l.locale,"dvWarningDialogTitle"):l.severity==="information"?b(l.locale,"dvInformationDialogTitle"):b(l.locale,"dvStopDialogTitle")),c=t.computed(()=>l.severity==="stop"?b(l.locale,"dvBtnRetry"):l.severity==="warning"?b(l.locale,"dvBtnContinue"):b(l.locale,"dvBtnOk")),d=t.computed(()=>l.severity==="stop"?b(l.locale,"cancel"):l.severity==="warning"?b(l.locale,"dvBtnNo"):b(l.locale,"cancel"));function y(){o("resolve",l.severity==="stop"?"retry":"continue")}function g(){o("resolve","cancel")}return(C,m)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",I0,[t.createElementVNode("span",O0,t.toDisplayString(r.value),1)]),t.createElementVNode("div",A0,[(t.openBlock(),t.createElementBlock("svg",{class:"dv-alert__icon",viewBox:"0 0 1024 1024",style:t.normalizeStyle({color:i.value.color})},[t.createElementVNode("path",{d:i.value.path,fill:"currentColor"},null,8,L0)],4)),t.createElementVNode("div",_0,[e.title?(t.openBlock(),t.createElementBlock("div",$0,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",z0,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",H0,[m[2]||(m[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:m[0]||(m[0]=t.withModifiers(()=>{},["prevent"])),onClick:y},t.toDisplayString(c.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:m[1]||(m[1]=t.withModifiers(()=>{},["prevent"])),onClick:g},t.toDisplayString(d.value),33)])],4))}}),[["__scopeId","data-v-4edabad0"]]),W0={key:0,class:"dvim__title"},P0={class:"dvim__message"},U0=Vt(t.defineComponent({__name:"data-validation-input-message",props:{title:{default:""},message:{default:""},x:{default:0},y:{default:0},width:{default:100},height:{default:24}},setup(e){return(n,l)=>(t.openBlock(),t.createElementBlock("div",{class:"dvim",style:t.normalizeStyle({left:e.x+"px",top:e.y+e.height+4+"px",minWidth:Math.min(220,Math.max(e.width,140))+"px"})},[e.title?(t.openBlock(),t.createElementBlock("div",W0,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",P0,t.toDisplayString(e.message),1)],4))}}),[["__scopeId","data-v-15c54146"]]);function pn(e,n){return`${e},${n}`}function ra(e,n){if(e.startsWith("="))return{kind:"formula",formula:e};const l=Ul(e,n);if(l)return{kind:"date",serial:l.serial};const o=/^(.*?)(\d+)$/.exec(e);if(o){const a=o[1],i=o[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return Bl(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function lr(e,n){for(let l=2;l<e.length;l++)if(e[l]-e[l-1]!==n)return!1;return!0}function aa(e){const n=e.length;if(n===0)return{kind:"copy",sourceValues:[]};if(e.some(l=>l.kind==="formula"))return{kind:"formula"};if(e.every(l=>l.kind==="date")){const l=e[0],o=n>=2?e[1].serial-l.serial:1;return{kind:"date-linear",baseSerial:l.serial,step:o,sourceLen:n}}if(e.every(l=>l.kind==="number")){if(n===1)return{kind:"copy",sourceValues:[...e]};const l=e.map(a=>a.num),o=l[1]-l[0];return lr(l,o)?{kind:"linear",step:o,base:l[0],sourceLen:n}:{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text-number")){const l=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===l.prefix)){if(n===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(lr(a,i))return{kind:"text-number",prefix:l.prefix,step:i,base:l.num,digits:l.digits,sourceLen:n}}return{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text")){const l=e.every(o=>o.text.length===1&&/[a-zA-Z]/.test(o.text));if(n>=2&&l){const o=e.map(i=>i.text.charCodeAt(0)),a=o[1]-o[0];if(a!==0&&lr(o,a))return{kind:"text-series",step:a,baseCharCode:o[0],sourceLen:n}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function ia(e,n,l){switch(e.kind){case"copy":{const o=e.sourceValues.length;return o===0?{kind:"text",text:""}:e.sourceValues[n%o]}case"linear":return{kind:"number",num:e.base+e.step*(l+n)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(l+n),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(l+n)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(l+n))};case"formula":return{kind:"formula",formula:""}}}function sa(e,n){switch(e.kind){case"copy":{const l=e.sourceValues.length;return l===0?{kind:"text",text:""}:e.sourceValues[l-1-n%l]}case"linear":return{kind:"number",num:e.base-e.step*(n+1)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base-e.step*(n+1),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial-e.step*(n+1)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode-e.step*(n+1))};case"formula":return{kind:"formula",formula:""}}}function Ro(e,n){switch(e.kind){case"formula":return{value:e.formula,styleId:n};case"number":return{value:String(e.num),styleId:n};case"text":return{value:e.text,styleId:n};case"text-number":return{value:e.prefix+String(e.num).padStart(e.digits,"0"),styleId:n};case"date":return{value:String(e.serial),styleId:n}}}function ca(e,n){const l=n.row<e.startRow?e.startRow-n.row:n.row>e.endRow?n.row-e.endRow:0,o=n.col<e.startCol?e.startCol-n.col:n.col>e.endCol?n.col-e.endCol:0;if(l===0&&o===0)return null;const a=l>=o?n.row<e.startRow?"up":"down":n.col<e.startCol?"left":"right";let i;switch(a){case"down":i={startCol:e.startCol,startRow:e.endRow+1,endCol:e.endCol,endRow:n.row};break;case"up":i={startCol:e.startCol,startRow:n.row,endCol:e.endCol,endRow:e.startRow-1};break;case"right":i={startCol:e.endCol+1,startRow:e.startRow,endCol:n.col,endRow:e.endRow};break;case"left":i={startCol:n.col,startRow:e.startRow,endCol:e.startCol-1,endRow:e.endRow};break}return{targetRange:i,direction:a}}function da(e,n,l,o,a,i){return Co(e,l.col-n.col,l.row-n.row,o,a,i)}function ua(e,n){return!(e.endCol<n.startCol||e.startCol>n.endCol||e.endRow<n.startRow||e.startRow>n.endRow)}function fa(e,n){return n.startCol>=e.startCol&&n.endCol<=e.endCol&&n.startRow>=e.startRow&&n.endRow<=e.endRow}function nr(e,n,l){const o=Object.keys(l);for(const c of o){const d=l[c];if(ua(e,d)&&!fa(e,d))return{ok:!1,reason:"source-overlap"}}const a=[];for(const c of o){const d=l[c];fa(e,d)||ua(n,d)&&a.push(d)}if(a.length===0)return{ok:!0,reason:"ok"};const i=a[0].endRow-a[0].startRow,r=a[0].endCol-a[0].startCol;for(const c of a)if(c.endRow-c.startRow!==i||c.endCol-c.startCol!==r)return{ok:!1,reason:"target-merge-size"};return{ok:!0,reason:"ok"}}function ma(e,n,l,o){const a=n.length;if(a!==0){if(e.kind==="copy"){const i=o?a-1-l%a:l%a;return n[i]}return o?n[0]:n[a-1]}}function pa(e,n,l,o,a,i,r,c){const d={cells:{},merges:{}},y=o==="up"||o==="down",g=o==="up"||o==="left";if(y){const C=e.endRow-e.startRow+1;for(let m=e.startCol;m<=e.endCol;m++){const B=[],R=[];for(let J=e.startRow;J<=e.endRow;J++){const ee=l.cells[pn(m,J)];B.push(ee?ra(ee.value,a):{kind:"text",text:""}),R.push(ee==null?void 0:ee.styleId)}const I=aa(B),q=B.length;for(let J=n.startRow;J<=n.endRow;J++){const ee=g?n.endRow-J:J-n.startRow;if(I.kind==="formula"){const ne=g?e.endRow-((n.endRow-J)%C+C)%C:e.startRow+((J-e.startRow)%C+C)%C,x=l.cells[pn(m,ne)],le=x?x.value:"",ge=da(le,{col:m,row:ne},{col:m,row:J},i,r,c);d.cells[pn(m,J)]=Ro({kind:"formula",formula:ge},x==null?void 0:x.styleId)}else{const ne=g?sa(I,ee):ia(I,ee,q),x=ma(I,R,ee,g);d.cells[pn(m,J)]=Ro(ne,x)}}}}else{const C=e.endCol-e.startCol+1;for(let m=e.startRow;m<=e.endRow;m++){const B=[],R=[];for(let J=e.startCol;J<=e.endCol;J++){const ee=l.cells[pn(J,m)];B.push(ee?ra(ee.value,a):{kind:"text",text:""}),R.push(ee==null?void 0:ee.styleId)}const I=aa(B),q=B.length;for(let J=n.startCol;J<=n.endCol;J++){const ee=g?n.endCol-J:J-n.startCol;if(I.kind==="formula"){const ne=g?e.endCol-((n.endCol-J)%C+C)%C:e.startCol+((J-e.startCol)%C+C)%C,x=l.cells[pn(ne,m)],le=x?x.value:"",ge=da(le,{col:ne,row:m},{col:J,row:m},i,r,c);d.cells[pn(J,m)]=Ro({kind:"formula",formula:ge},x==null?void 0:x.styleId)}else{const ne=g?sa(I,ee):ia(I,ee,q),x=ma(I,R,ee,g);d.cells[pn(J,m)]=Ro(ne,x)}}}}return d}function K0(e){let n=1/0,l=1/0;for(const o of e.ranges)o.startCol<n&&(n=o.startCol),o.startRow<l&&(l=o.startRow);return isFinite(n)||(n=0),isFinite(l)||(l=0),{col:n,row:l}}function G0(e,n,l){for(const o of e)if(n>=o.startCol&&n<=o.endCol&&l>=o.startRow&&l<=o.endRow)return!0;return!1}function Nl(e){if(e==null)return null;const n=String(e).trim();if(n==="")return null;const l=n.replace(/[, ]/g,"");if(l==="")return null;const o=Number(l);return Number.isFinite(o)?o:null}function q0(e,n){const l=new Map;for(const o of e.ranges)for(let a=o.startRow;a<=o.endRow;a++)for(let i=o.startCol;i<=o.endCol;i++){const r=n.getCellValue(i,a);r!==""&&l.set(r,(l.get(r)??0)+1)}return l}class Y0{constructor(){this.map=new Map}get(n){return this.map.get(n)}set(n,l){this.map.set(n,l)}invalidate(n){n?this.map.delete(n):this.map.clear()}}function X0(e,n,l,o,a,i){switch(e.type){case"cellIs":{const r=o.getCellValue(n,l),c=Nl(r);switch(e.operator){case"equal":{const d=Nl(e.value);return c!==null&&d!==null?c===d:r===e.value}case"notEqual":{const d=Nl(e.value);return c!==null&&d!==null?c!==d:r!==e.value}case"greaterThan":{const d=Nl(e.value);return c===null||d===null?!1:c>d}case"greaterThanOrEqual":{const d=Nl(e.value);return c===null||d===null?!1:c>=d}case"lessThan":{const d=Nl(e.value);return c===null||d===null?!1:c<d}case"lessThanOrEqual":{const d=Nl(e.value);return c===null||d===null?!1:c<=d}case"between":{const d=Nl(e.value),y=Nl(e.value2??"");return c===null||d===null||y===null?!1:c>=Math.min(d,y)&&c<=Math.max(d,y)}case"notBetween":{const d=Nl(e.value),y=Nl(e.value2??"");return c===null||d===null||y===null?!1:c<Math.min(d,y)||c>Math.max(d,y)}}return!1}case"textContains":return o.getCellValue(n,l).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!o.getCellValue(n,l).toLowerCase().includes(e.value.toLowerCase());case"blank":return o.getCellValue(n,l)==="";case"notBlank":return o.getCellValue(n,l)!=="";case"duplicate":{if(!i)return!1;const r=o.getCellValue(n,l);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=o.getCellValue(n,l);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=n-a.col,c=l-a.row,d=e.formula.trim().replace(/^=/,""),y=j0(d,r,c,o.colCount,o.rowCount);return ta(y,o.cells,o.colCount,o.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function j0(e,n,l,o,a){return Co(e,n,l,o,a,rt)}function Z0(e,n,l,o,a){if(!l||l.length===0)return null;const i=l.filter(d=>d.enabled&&G0(d.ranges,e,n)).sort((d,y)=>d.priority-y.priority);if(i.length===0)return null;const r={};let c=!1;for(const d of i){const y=K0(d);let g;(d.condition.type==="duplicate"||d.condition.type==="unique")&&(g=a==null?void 0:a.get(d.id),g||(g=q0(d,o),a==null||a.set(d.id,g)));let C=!1;try{C=X0(d.condition,e,n,o,y,g)}catch{}if(!C)continue;c=!0;const m=d.format;if(m.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=m.backgroundColor),m.color!==void 0&&r.color===void 0&&(r.color=m.color),m.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=m.fontWeight),m.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=m.fontStyle),m.underline!==void 0&&r.underline===void 0&&(r.underline=m.underline),m.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=m.strikethrough),d.stopIfTrue)break}return c?r:null}function J0(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function ha(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Q0(e,n,l){for(const o of e)if(n>=o.startCol&&n<=o.endCol&&l>=o.startRow&&l<=o.endRow)return!0;return!1}function e1(e){let n=1/0,l=1/0;for(const o of e.ranges)o.startCol<n&&(n=o.startCol),o.startRow<l&&(l=o.startRow);return isFinite(n)||(n=0),isFinite(l)||(l=0),{col:n,row:l}}function t1(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function l1(e){return e?Array.from(e).length:0}const ga=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function eo(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=or(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?a:a===null?null:Number(a)}const o=ho(l,n.locale);if(o&&Number.isFinite(o.num))return o.num;if(ga.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}return null}function or(e,n){try{return mn(),ea(e,n.cells,n.colCount,n.rowCount)}catch{return null}}function rr(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=or(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?rr(a,n):null}if(Bl(l)||ga.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}const o=Ul(l,n.locale);return o&&o.format!=="h:mm:ss"?o.serial:null}function ar(e,n){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=or(l.slice(1),n);return typeof a=="number"&&Number.isFinite(a)?ir(a):typeof a=="string"?ar(a,n):null}const o=Ul(l,n.locale);return o?o.format==="h:mm:ss"?o.serial:ir(o.serial):Bl(l)?ir(Number(l)):null}function ir(e){return Number.isFinite(e)?Math.abs(e)%1:0}function n1(e,n,l,o){switch(e){case"between":return l===null||o===null?!1:n>=Math.min(l,o)&&n<=Math.max(l,o);case"notBetween":return l===null||o===null?!1:n<Math.min(l,o)||n>Math.max(l,o);case"equal":return l!==null&&n===l;case"notEqual":return l!==null&&n!==l;case"greaterThan":return l!==null&&n>l;case"greaterThanOrEqual":return l!==null&&n>=l;case"lessThan":return l!==null&&n<l;case"lessThanOrEqual":return l!==null&&n<=l;default:return!1}}function sr(e){return String(e??"").trim().toLowerCase()}function ba(e,n){var g;const l=e.listSource??(e.values?{type:"values",values:e.values}:void 0);if(!l)return[];const o=[],a=new Set,i=C=>{const m=sr(C);if(!m){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),o.push("");return}a.has(m)||(a.add(m),o.push(C))};if(l.type==="values"){for(const C of l.values??[])i(C);return o}const{range:r,sheetId:c}=l,d=c?((g=n.getSheetCells)==null?void 0:g.call(n,c))??null:null,y=d??n.cells;for(let C=r.startRow;C<=r.endRow;C++)for(let m=r.startCol;m<=r.endCol;m++){const B=`${m},${C}`,R=y[B];if(R)if(d){const I=R.value;i(I.startsWith("=")?o1(I,d,n):I)}else i(n.getCellValue(m,C))}return o}function o1(e,n,l){try{mn();const o=ea(e.slice(1),n,l.colCount,l.rowCount);return o===null?"":String(o)}catch{return""}}function r1(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function a1(e,n,l){const o={value:l};return new Proxy(e,{get(a,i){return i===n?o:a[i]},has(a,i){return i===n?!0:i in a}})}function i1(e,n,l,o,a){if(e.enabled===!1)return!0;const i=n==null?"":String(n);if(t1(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=ba(e,a),c=sr(i);return r.some(d=>sr(d)===c)}case"wholeNumber":{const r=eo(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:to(e,r,a,eo)}case"decimal":{const r=eo(i,a);return r===null||!Number.isFinite(r)?!1:to(e,r,a,eo)}case"date":{const r=rr(i,a);return r===null?!1:to(e,r,a,rr)}case"time":{const r=ar(i,a);return r===null?!1:to(e,r,a,ar)}case"textLength":{const r=l1(i);return to(e,r,a,eo)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?s1(r,n,l,o,e,a):!0}default:return!0}}catch{return!1}}function to(e,n,l,o){const a=e.operator;if(!a)return!0;const i=e.formula1!==void 0&&e.formula1!==""?o(e.formula1,l):null,r=e.formula2!==void 0&&e.formula2!==""?o(e.formula2,l):null;return n1(a,n,i,r)}function s1(e,n,l,o,a,i){try{const r=e1(a),c=Co(e,l-r.col,o-r.row,i.colCount,i.rowCount,rt),d=a1(i.cells,`${l},${o}`,n==null?"":String(n));return mn(),ta(c,d,i.colCount,i.rowCount)}catch{return!1}}const c1={stop:3,warning:2,information:1};function cr(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function ya(e,n,l,o,a){if(!o||o.length===0)return{valid:!0};let i=null,r=0;for(const g of o){if(g.enabled===!1||!Q0(g.ranges,n,l))continue;let C;try{C=i1(g,e,n,l,a)}catch{C=!1}if(C)continue;const m=c1[cr(g)];m>r&&(r=m,i=g)}if(!i)return{valid:!0};const c=cr(i),d=i.showErrorMessage!==!1,y=d1(i,a.locale);return{valid:!1,rule:i,severity:c,title:d&&i.errorTitle?i.errorTitle:y.title,message:d&&i.errorMessage?i.errorMessage:y.message}}function d1(e,n){var a;const l=b(n,"dvErrorTitleDefault"),o=e.operator?b(n,`dv${u1(e.operator)}`):"";switch(e.type){case"list":{const r=(((a=e.listSource)==null?void 0:a.type)==="values"?e.listSource.values??e.values??[]:e.values??[]).filter(Boolean).slice(0,6).join(", ");return{title:l,message:b(n,r?"dvMsgList":"dvMsgListEmpty").replace("{values}",r)}}case"wholeNumber":return{title:l,message:lo(n,b(n,"dvTypeWholeNumber"),o,e)};case"decimal":return{title:l,message:lo(n,b(n,"dvTypeDecimal"),o,e)};case"date":return{title:l,message:lo(n,b(n,"dvTypeDate"),o,e)};case"time":return{title:l,message:lo(n,b(n,"dvTypeTime"),o,e)};case"textLength":return{title:l,message:lo(n,b(n,"dvTypeTextLength"),o,e)};case"custom":return{title:l,message:b(n,"dvMsgCustom").replace("{formula}",e.formula1??"")};default:return{title:l,message:b(n,"dvMsgInvalid")}}}function u1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function lo(e,n,l,o){return l?o.operator==="between"||o.operator==="notBetween"?b(e,o.operator==="between"?"dvMsgBetween":"dvMsgNotBetween").replace("{type}",n).replace("{min}",o.formula1??"").replace("{max}",o.formula2??""):b(e,"dvMsgCompare").replace("{type}",n).replace("{op}",l).replace("{value}",o.formula1??""):b(e,"dvMsgInvalid")}const So=64;class f1{constructor(n=[]){this.bands=new Map,this.dirty=!0,this.source=[],this.source=n}invalidate(){this.dirty=!0}ensure(n){if(n&&n!==this.source&&(this.source=n,this.dirty=!0),!!this.dirty){this.bands.clear();for(const l of this.source)if(!(!l||l.enabled===!1))for(const o of l.ranges??[]){const a=Math.floor(o.startRow/So),i=Math.floor(o.endRow/So);for(let r=a;r<=i;r++){let c=this.bands.get(r);c||(c=[],this.bands.set(r,c)),c.push({rule:l,range:o})}}this.dirty=!1}}getRules(n,l,o){this.ensure(o);const a=this.bands.get(Math.floor(l/So));if(!a||a.length===0)return[];const i=[];for(const r of a)n<r.range.startCol||n>r.range.endCol||l<r.range.startRow||l>r.range.endRow||i.includes(r.rule)||i.push(r.rule);return i}has(n,l,o){const a=this.bandsOf(n,l,o);for(const i of a)if(!(n<i.range.startCol||n>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow))return!0;return!1}findRule(n,l,o,a){for(const i of this.bandsOf(n,l,a))if(!(n<i.range.startCol||n>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow)&&o(i.rule))return i.rule;return null}bandsOf(n,l,o){return this.ensure(o),this.bands.get(Math.floor(l/So))??m1}}const m1=[];function p1(e,n,l,o){if(n==="row"){const d=e.startRow,y=e.endRow;let g,C;if(y<l)g=d,C=y;else if(d>l+o-1)g=d-o,C=y-o;else if(g=d<l?d:l,C=y>l+o-1?y-o:l-1,C<g)return null;return{...e,startRow:g,endRow:C}}const a=e.startCol,i=e.endCol;let r,c;if(i<l)r=a,c=i;else if(a>l+o-1)r=a-o,c=i-o;else if(r=a<l?a:l,c=i>l+o-1?i-o:l-1,c<r)return null;return{...e,startCol:r,endCol:c}}function h1(e,n,l,o){if(n==="row"){const r=e.startRow,c=e.endRow;return r>=l?{...e,startRow:r+o,endRow:c+o}:c<l?e:{...e,endRow:c+o}}const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+o,endCol:i+o}:i<l?e:{...e,endCol:i+o}}function wa(e,n){return!(e.endCol<n.startCol||e.startCol>n.endCol||e.endRow<n.startRow||e.startRow>n.endRow)}function Ca(e,n){if(!wa(e,n))return[{...e}];const l=[];e.startRow<n.startRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:e.startRow,endRow:n.startRow-1}),e.endRow>n.endRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:n.endRow+1,endRow:e.endRow});const o=Math.max(e.startRow,n.startRow),a=Math.min(e.endRow,n.endRow);return o<=a&&(e.startCol<n.startCol&&l.push({startCol:e.startCol,endCol:n.startCol-1,startRow:o,endRow:a}),e.endCol>n.endCol&&l.push({startCol:n.endCol+1,endCol:e.endCol,startRow:o,endRow:a})),l}function g1(e,n,l){return{startCol:e.startCol+n,endCol:e.endCol+n,startRow:e.startRow+l,endRow:e.endRow+l}}function va(e,n){return wa(e,n)?{startCol:Math.max(e.startCol,n.startCol),endCol:Math.min(e.endCol,n.endCol),startRow:Math.max(e.startRow,n.startRow),endRow:Math.min(e.endRow,n.endRow)}:null}const b1=8;function y1(e,n,l){let o=0;for(let a=0;a<e.length;a++){const i=e[a];i.start<=n&&l<=i.end&&o++}return o}function w1(e,n,l,o){return e<=l&&o<=n||l<=e&&n<=o||n<l||o<e}function dr(e,n,l){if(!Number.isInteger(n)||!Number.isInteger(l)||n<0||l<n)return{ok:!1,code:"outlineInvalid"};if(l-n+1<2)return{ok:!1,code:"outlineMinSize"};for(let a=0;a<e.length;a++){const i=e[a];if(!w1(n,l,i.start,i.end))return{ok:!1,code:"outlineCrossing"}}const o=y1(e,n,l)+1;return o>b1?{ok:!1,code:"outlineTooDeep"}:{ok:!0,level:o}}function ka(e,n,l,o,a,i){const r=dr(e,l,o);return!r.ok||r.level===void 0?{outlines:e,validation:r}:{outlines:e.concat({id:a,axis:n,start:l,end:o,level:r.level,collapsed:!1}),validation:r}}function Ea(e,n,l){let o=!1;const a=e.map(i=>i.id===n&&i.collapsed!==l?(o=!0,{...i,collapsed:l}):i);return o?a:e}function Ra(e,n){return e.filter(l=>l.id!==n)}function Mo(){return[]}function Sa(e,n,l){return e.map(o=>o.start>=n?{...o,start:o.start+l,end:o.end+l}:o.end<n?o:{...o,end:o.end+l})}function Ma(e,n,l){const o=[];for(const a of e){const i=a.start,r=a.end;let c,d;if(r<n)c=i,d=r;else if(i>n+l-1)c=i-l,d=r-l;else if(c=i<n?i:n,d=r>n+l-1?r-l:n-1,d<c)continue;o.push({...a,start:c,end:d})}return o}function Gl(e){return e.map(n=>{let l=0;for(let o=0;o<e.length;o++){const a=e[o];a!==n&&a.start<=n.start&&n.end<=a.end&&l++}return{...n,level:l+1}})}function Ba(e,n){let l=0;for(let o=0;o<e.length;o++){const a=e[o];a.start<=n&&n<=a.end&&l++}return l}function Na(e,n){const l=n==="row"?"row-outline":"col-outline",o=new Set(e.map(i=>i.id));let a=1;for(;o.has(`${l}-${a}`);)a++;return`${l}-${a}`}class C1{constructor(n){if(n&&n.length>0){this.styles=n,this.index=new Map;for(let l=0;l<this.styles.length;l++){const o=this.stableKey(this.styles[l]);this.index.set(o,l)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const l=Object.keys(n).sort(),o={};for(const a of l)o[a]=n[a];return JSON.stringify(o)}get(n){const l=this.styles[n];return l?n===0?l:Object.freeze(l):{}}getId(n){if(!n||Object.keys(n).length===0)return 0;const l=this.stableKey(n),o=this.index.get(l);if(o!==void 0)return o;const a=this.styles.length,i=Object.freeze({...n});return this.styles.push(i),this.index.set(l,a),a}getStyles(){return[...this.styles]}setStyles(n){this.styles=n,this.index=new Map;for(let l=0;l<this.styles.length;l++){const o=this.stableKey(this.styles[l]);this.index.set(o,l)}}compactStyles(n){const l=new Set;l.add(0);for(const r in n){const c=n[r].styleId??0;l.add(c)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(l).sort((r,c)=>r-c);for(const r of i)if(r!==0&&r<this.styles.length){const c=a.length;o.set(r,c),a.push(this.styles[r])}for(const r in n){const c=n[r],d=c.styleId??0,y=o.get(d);y!==void 0&&y!==d&&(c.styleId=y)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const c=this.stableKey(this.styles[r]);this.index.set(c,r)}return a}}function v1(e,n){if(!e)return null;const l=e.styleId;return l===void 0||l===0?null:n[l]??null}function xa(e){const n=new C1,l={};for(const[o,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,l[o]=i}return{cells:l,styles:n.getStyles()}}function k1(e){const n={};for(const[l,o]of Object.entries(e)){const a={value:o.value};o.styleId!==void 0&&o.styleId>0&&(a.styleId=o.styleId),n[l]=a}return n}class E1{constructor(n){if(n&&n.length>0){this.borders=n,this.index=new Map;for(let l=0;l<this.borders.length;l++){const o=this.stableKey(this.borders[l]);this.index.set(o,l)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(n){const l=["top","right","bottom","left"],o={};for(const a of l){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),o[a]=r}}return JSON.stringify(o)}get(n){const l=this.borders[n];return l?n===0?l:Object.freeze(l):{}}getId(n){if(!n||this.isEmptyBorder(n))return 0;const l=this.stableKey(n),o=this.index.get(l);if(o!==void 0)return o;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(n));return this.borders.push(i),this.index.set(l,a),a}isEmptyBorder(n){return!n.top&&!n.right&&!n.bottom&&!n.left}deepCloneBorder(n){const l={};return n.top&&(l.top={...n.top}),n.right&&(l.right={...n.right}),n.bottom&&(l.bottom={...n.bottom}),n.left&&(l.left={...n.left}),l}getBorders(){return[...this.borders]}setBorders(n){this.borders=n,this.index=new Map;for(let l=0;l<this.borders.length;l++){const o=this.stableKey(this.borders[l]);this.index.set(o,l)}}compactBorders(n){const l=new Set;l.add(0);for(const r of n){const c=r.borderId??0;l.add(c)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(l).sort((r,c)=>r-c);for(const r of i)if(r!==0&&r<this.borders.length){const c=a.length;o.set(r,c),a.push(this.borders[r])}for(const r of n){const c=r.borderId??0,d=o.get(c);d!==void 0&&d!==c&&(r.borderId=d)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const c=this.stableKey(this.borders[r]);this.index.set(c,r)}return a}}function R1(e,n,l,o){if(!e)return;const a=e.styleId??0,i=l[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const c=o.get(r);if(c)return c[n]}function S1(e,n,l,o,a,i){const r=o[e.styleId??0]??{},c=r.borderId??0,d=c>0?a.get(c):{},y={top:d.top?{...d.top}:void 0,right:d.right?{...d.right}:void 0,bottom:d.bottom?{...d.bottom}:void 0,left:d.left?{...d.left}:void 0};l?y[n]={...l}:y[n]=void 0;const g=a.getId(y),C={...r};g===0?delete C.borderId:C.borderId=g,delete C.borderTopWidth,delete C.borderBottomWidth,delete C.borderLeftWidth,delete C.borderRightWidth,delete C.borderColor,Object.keys(C).length===0?e.styleId=0:e.styleId=i(C)}function Ta(e){const n=new E1,l=[];for(const o of e){if(!(o.borderTopWidth!==void 0||o.borderBottomWidth!==void 0||o.borderLeftWidth!==void 0||o.borderRightWidth!==void 0)){l.push(o);continue}const i=typeof o.borderColor=="string"?o.borderColor:void 0,r={};o.borderTopWidth!==void 0&&o.borderTopWidth>0&&(r.top={width:o.borderTopWidth,color:i}),o.borderBottomWidth!==void 0&&o.borderBottomWidth>0&&(r.bottom={width:o.borderBottomWidth,color:i}),o.borderLeftWidth!==void 0&&o.borderLeftWidth>0&&(r.left={width:o.borderLeftWidth,color:i}),o.borderRightWidth!==void 0&&o.borderRightWidth>0&&(r.right={width:o.borderRightWidth,color:i});const c=n.getId(r),d={...o};delete d.borderTopWidth,delete d.borderBottomWidth,delete d.borderLeftWidth,delete d.borderRightWidth,delete d.borderColor,c>0?d.borderId=c:delete d.borderId,l.push(d)}return{styles:l,borders:n.getBorders()}}function M1(e,n){const l=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(()=>{l.rowCount=e.rowCount??n.rowCount,l.colCount=e.colCount??n.colCount,l.width=e.width,l.height=e.height,l.theme=e.theme??n.theme,l.locale=e.locale??n.locale});const o=t.computed(()=>l.locale==="zh-CN"?"zh-CN":"en-US"),a=l.colCount,i=l.rowCount,r=t.reactive({colCount:a,rowCount:i}),c=8,d=32,y=t.reactive({}),g=t.reactive([{}]),C=t.reactive([{}]);let m=new Map;m.set("{}",0);let B=new Map;B.set("{}",0);const R=t.reactive([]),I=new Y0,q=t.reactive([]),J=new f1(q),ee=new Map;let ne=0;function x(s){const f=Object.keys(s).sort(),h={};for(const k of f)h[k]=s[k];return JSON.stringify(h)}function le(s){const f=["top","right","bottom","left"],h={};for(const k of f){const O=s[k];if(O&&(O.width!==void 0||O.color!==void 0||O.style!==void 0)){const te={};O.width!==void 0&&(te.width=O.width),O.color!==void 0&&(te.color=O.color),O.style!==void 0&&(te.style=O.style),h[k]=te}}return JSON.stringify(h)}function ge(s){if(!s||Object.keys(s).length===0)return 0;const f=x(s),h=m.get(f);if(h!==void 0)return h;const k=g.length;return g.push(Object.freeze({...s})),m.set(f,k),k}function fe(s){return v1(s,g)}function Ce(){m=new Map;for(let s=0;s<g.length;s++)m.set(x(g[s]),s)}function $e(s){g.splice(0,g.length,...s),Ce()}function ze(s){if(!s||!s.top&&!s.right&&!s.bottom&&!s.left)return 0;const f=le(s),h=B.get(f);if(h!==void 0)return h;const k=C.length;return C.push(Object.freeze({top:s.top?Object.freeze({...s.top}):void 0,right:s.right?Object.freeze({...s.right}):void 0,bottom:s.bottom?Object.freeze({...s.bottom}):void 0,left:s.left?Object.freeze({...s.left}):void 0})),B.set(f,k),k}function et(s){return C[s]??{}}function nt(){B=new Map;for(let s=0;s<C.length;s++)B.set(le(C[s]),s)}function F(s){C.splice(0,C.length,...s),nt()}function A(s,f){return R1(s,f,g,{get:h=>C[h]??{}})}function Q(s,f){const h=ft(s,f);return h?h.anchor:null}function we(s,f,h,k){const O=ft(s,f),te=ft(h,k);return!O||!te?!1:O.anchor===te.anchor}const xe=t.reactive({}),X=new Au,Ne=t.ref(null),me=t.ref("cell"),Me=t.ref({col:0,row:0}),T=t.ref(null),se=t.ref(""),ie=t.ref(new Array(r.colCount).fill(100)),re=t.ref(new Array(r.rowCount).fill(void 0)),K=t.ref(0),$=t.ref(0),de=t.reactive({rows:0,cols:0}),z=t.ref(null),_=t.ref([]),ae=t.ref([]),Ke=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),Fe=new Map;let Le=null;function Be(s,f,h,k){const O=`${k} ${h} ${f}px ${s}`,te=Fe.get(O);if(te)return te;if(!Le){if(typeof document>"u")return{ascent:f*.88,descent:f*.28};Le=document.createElement("canvas")}const he=Le.getContext("2d");if(!he)return{ascent:f*.88,descent:f*.28};he.font=O;const ke=he.measureText(" "),Re=ke.fontBoundingBoxAscent,_e=ke.fontBoundingBoxDescent;if(typeof Re=="number"&&typeof _e=="number"&&Re>0&&_e>0){const Dt={ascent:Re,descent:_e};return Fe.set(O,Dt),Dt}const He=["M","中","y","Ä","0"];let Qe=0,Ge=0;for(const Dt of He){const Wt=he.measureText(Dt),Yt=Wt.actualBoundingBoxAscent||0,tl=Wt.actualBoundingBoxDescent||0;Yt>Qe&&(Qe=Yt),tl>Ge&&(Ge=tl)}const st=Math.max(Qe,f*.88),yt=Math.max(Ge,f*.28),el={ascent:st,descent:yt};return Fe.set(O,el),el}const qe=Be(kn,Jl,"normal","normal"),Je=qe.ascent+qe.descent,Te=Math.max(0,(24-Je)/2);let dt=(s,f)=>`${s},${f}`,ft=()=>null,Ue=()=>Jl,N=t.computed(()=>[0]),pe=()=>24,Ct=(s,f,h,k)=>({startCol:Math.min(s,h),startRow:Math.min(f,k),endCol:Math.max(s,h),endRow:Math.max(f,k)});function qt(s,f){const h=fe(y[dt(s,f)]),k=Ue(s,f),O=typeof(h==null?void 0:h.fontFamily)=="string"&&h.fontFamily?h.fontFamily:kn,te=(h==null?void 0:h.fontWeight)==="bold"?"bold":"normal",he=(h==null?void 0:h.fontStyle)==="italic"?"italic":"normal";return Be(O,k,te,he)}function Kt(s,f,h,k){if(!f)return[""];const O=f.split(`
2
+ `),te=[];for(const he of O)if(!k||h<=0)te.push(he);else{let ke="";for(let Re=0;Re<he.length;Re++){const _e=he[Re],He=ke+_e;s.measureText(He).width>h&&ke?(te.push(ke),ke=_e):ke=He}te.push(ke)}return te}function zt(s,f){const h=fe(y[dt(s,f)]);return typeof(h==null?void 0:h.fontSize)=="number"&&h.fontSize>0?h.fontSize:Jl}Ue=zt;const Rt=t.computed(()=>{const s=[0];for(let f=0;f<r.colCount;f++)s.push(s[f]+ue(f));return s});N=Rt;const Ut={w:800,h:600};let nl=()=>{};const bl=t.computed(()=>{const s=new Set;for(const f in y){const h=f.indexOf(",");if(h<0)continue;const k=parseInt(f.substring(h+1),10),O=y[f];O&&(O.value!==""||O.styleId!==void 0)&&s.add(k)}for(let f=0;f<re.value.length;f++)re.value[f]!==void 0&&s.add(f);for(const f in xe){const h=f.indexOf(",");if(h<0)continue;const k=parseInt(f.substring(h+1),10);s.add(k)}return s});function dl(s){if(H(s))return 0;const f=re.value[s];if(f!=null&&f>0)return f;if(!bl.value.has(s))return 24;let h,k,O=1;const te=Le?Le.getContext("2d"):null,he=Be(kn,Jl,"normal","normal");h=he.ascent,k=he.descent;for(let He=0;He<r.colCount;He++){const Qe=zt(He,s),Ge=fe(y[dt(He,s)]),st=typeof(Ge==null?void 0:Ge.fontFamily)=="string"&&Ge.fontFamily?Ge.fontFamily:kn,yt=(Ge==null?void 0:Ge.fontWeight)==="bold"?"bold":"normal",el=(Ge==null?void 0:Ge.fontStyle)==="italic"?"italic":"normal",Dt=Be(st,Qe,yt,el);Dt.ascent>h&&(h=Dt.ascent),Dt.descent>k&&(k=Dt.descent);const Wt=typeof(Ge==null?void 0:Ge.numberFormat)=="string"?Ge.numberFormat:"",Yt=At(He,s),tl=Ml(Yt,Wt,o.value);if(tl){const jl=(Ge==null?void 0:Ge.wrap)==="wrap";let sl;if(jl&&te){te.font=`${el} ${yt} ${Qe}px ${st}`;const Xt=ft(He,s);let Il;Xt&&He===Xt.range.startCol&&s===Xt.range.startRow?Il=N.value[Xt.range.endCol+1]-N.value[He]:Il=ie.value[He],sl=Kt(te,tl,Math.max(0,Il-10),!0).length,sl>O&&(O=sl)}else sl=tl.split(`
3
+ `).length,sl>O&&(O=sl)}}const ke=h+k,Re=Te*2+O*ke;return Math.min(500,Math.max(24,Math.round(Re)))}pe=dl;function yl(s){return re.value[s]===void 0}const Gt={getValue:(s,f)=>At(s,f),getFormat:(s,f)=>{var h;return(h=fe(y[dt(s,f)]))==null?void 0:h.numberFormat}},ol=t.computed(()=>{const s=new Set,f=z.value;if(!f)return s;const{range:h}=f;for(let k=h.startRow+1;k<=h.endRow;k++)wl(k)||s.add(k);return s});function wl(s){return Xu(z.value,s,Gt,o.value)}function xl(){return ol.value}function H(s){return E(s)?!0:z.value?ol.value.has(s):!1}function W(){let s=0;for(let f=0;f<r.rowCount;f++)H(f)||s++;return s}function G(s){let f=-1;for(let h=0;h<r.rowCount;h++)if(!H(h)&&(f++,f===s))return h;return-1}function ve(s){if(H(s))return-1;let f=0;for(let h=0;h<s;h++)H(h)||f++;return f}const D=t.computed(()=>{const s=new Set,f=_.value;for(let h=0;h<f.length;h++){const k=f[h];if(k.collapsed)for(let O=Math.max(0,k.start);O<=k.end&&O<r.rowCount;O++)s.add(O)}return s}),p=t.computed(()=>{const s=new Set,f=ae.value;for(let h=0;h<f.length;h++){const k=f[h];if(k.collapsed)for(let O=Math.max(0,k.start);O<=k.end&&O<r.colCount;O++)s.add(O)}return s});function E(s){return D.value.has(s)}function be(s){return p.value.has(s)}function ce(s){return E(s)}function Ye(s){return be(s)}function Xe(s){return!H(s)}function v(s){return!be(s)}function P(s){return be(s)}function ue(s){return P(s)?0:ie.value[s]??100}function Ve(s){return Ba(_.value,s)}function Ie(s){return Ba(ae.value,s)}function Ee(s){const f=s==="row"?_.value:ae.value;let h=0;for(let k=0;k<f.length;k++){const O=f[k].level;O>h&&(h=O)}return h}function Oe(s){return 0}const je=()=>Oe(),at=()=>Oe();function Nt(){return _.value.map(s=>({...s}))}function Ot(){return ae.value.map(s=>({...s}))}function xt(s=!1){var f,h;s||(nl(K.value,$.value),(f=S.scheduleRender)==null||f.call(S),(h=S.emitModelData)==null||h.call(S))}function Cl(s,f){var k;const h=dr(_.value,s,f);return!h.ok||h.level===void 0?h:((k=S.saveUndo)==null||k.call(S),_.value=Gl(ka(_.value,"row",s,f,Na(_.value,"row")).outlines),xt(),{ok:!0,level:h.level})}function Rn(s,f){var k;const h=dr(ae.value,s,f);return!h.ok||h.level===void 0?h:((k=S.saveUndo)==null||k.call(S),ae.value=Gl(ka(ae.value,"column",s,f,Na(ae.value,"column")).outlines),xt(),{ok:!0,level:h.level})}function hn(s){var k;const f=_.value.some(O=>O.id===s),h=!f&&ae.value.some(O=>O.id===s);return!f&&!h?!1:((k=S.saveUndo)==null||k.call(S),f?_.value=Gl(Ra(_.value,s)):ae.value=Gl(Ra(ae.value,s)),xt(),!0)}function gn(){var s;_.value.length&&((s=S.saveUndo)==null||s.call(S),_.value=Mo(),xt())}function mr(){var s;ae.value.length&&((s=S.saveUndo)==null||s.call(S),ae.value=Mo(),xt())}function no(){var s;!_.value.length&&!ae.value.length||((s=S.saveUndo)==null||s.call(S),_.value=Mo(),ae.value=Mo(),xt())}function $n(s,f,h=!1){var te;const k=Ea(_.value,s,f),O=Ea(ae.value,s,f);k===_.value&&O===ae.value||(h||(te=S.saveUndo)==null||te.call(S),_.value=k,ae.value=O,xt(h))}function oo(s){const f=_.value.find(h=>h.id===s)??ae.value.find(h=>h.id===s);f&&$n(s,!f.collapsed)}function ro(s,f){_.value.length&&(_.value=Gl(Sa(_.value,s,f)),xt())}function pr(s,f){_.value.length&&(_.value=Gl(Ma(_.value,s,f)),xt())}function hr(s,f){ae.value.length&&(ae.value=Gl(Sa(ae.value,s,f)),xt())}function Sn(s,f){ae.value.length&&(ae.value=Gl(Ma(ae.value,s,f)),xt())}function Mn(s,f){s&&(_.value=Gl([...s])),f&&(ae.value=Gl([...f])),xt(!0)}function zn(){return z.value}function ao(s,f=!1){var h,k;z.value=s,!f&&(nl(K.value,$.value),(h=S.scheduleRender)==null||h.call(S),(k=S.emitModelData)==null||k.call(S))}function Bn(s){var h,k;const f={range:{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)},columns:{}};z.value=f,nl(K.value,$.value),(h=S.scheduleRender)==null||h.call(S),(k=S.emitModelData)==null||k.call(S)}function Hn(){var s,f;z.value&&(z.value=null,nl(K.value,$.value),(s=S.scheduleRender)==null||s.call(S),(f=S.emitModelData)==null||f.call(S))}function nn(s){var k,O;if(!z.value)return;const{[s]:f,...h}=z.value.columns;z.value={...z.value,columns:h},(k=S.scheduleRender)==null||k.call(S),(O=S.emitModelData)==null||O.call(S)}function Wn(s,f){var h,k;if(z.value){if(f)z.value={...z.value,columns:{...z.value.columns,[s]:f}};else{const{[s]:O,...te}=z.value.columns;z.value={...z.value,columns:te}}(h=S.scheduleRender)==null||h.call(S),(k=S.emitModelData)==null||k.call(S)}}function Pn(s){const f=z.value;return f?ju(f,s,Gt,o.value):{values:[],hasBlank:!1}}function gr(s,f){const h=r.colCount,k=r.rowCount,O=(Qe,Ge)=>{const st=y[Jt(Qe,Ge)];return!!st&&(st.value!==""||st.styleId!==void 0)};if(!O(s,f))return null;const te=Qe=>{for(let Ge=0;Ge<h;Ge++)if(O(Ge,Qe))return!0;return!1},he=(Qe,Ge,st)=>{for(let yt=Ge;yt<=st;yt++)if(O(Qe,yt))return!0;return!1};let ke=f;for(;ke>0&&te(ke-1);)ke--;let Re=f;for(;Re<k-1&&te(Re+1);)Re++;let _e=s;for(;_e>0&&he(_e-1,ke,Re);)_e--;let He=s;for(;He<h-1&&he(He+1,ke,Re);)He++;return{startCol:_e,startRow:ke,endCol:He,endRow:Re}}function Bo(){const s=Ne.value;if(!!s&&s.startRow!==s.endRow)return{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};const h=Me.value,k=s?s.startCol:h.col,O=s?s.startRow:h.row,te=(_e,He)=>{const Qe=y[Jt(_e,He)];return!!Qe&&(Qe.value!==""||Qe.styleId!==void 0)};let he,ke;s?(he=Math.min(s.startCol,s.endCol),ke=Math.max(s.startCol,s.endCol)):(he=h.col,ke=h.col);let Re=O;for(;Re<r.rowCount-1;){const _e=Re+1;let He=!1,Qe=!1;for(let Ge=he;Ge<=ke;Ge++){te(Ge,_e)&&(He=!0);const st=on(Ge,_e);st&&(st.range.startCol!==st.range.endCol||st.range.startRow!==st.range.endRow)&&(Qe=!0)}if(Qe||!He)break;Re++}return!te(k,O)&&Re===O?rl():{startCol:he,endCol:ke,startRow:O,endRow:Re}}function Un(){if(z.value){Hn();return}const s=Bo();s&&Bn(s)}function Kn(s){const f=z.value;return f?s>=f.range.startCol&&s<=f.range.endCol:!1}function br(){return z.value?{...z.value.range}:null}function yr(){return!!z.value}function bn(s){const f=z.value;return f?na(f.columns[s]):!1}function rl(){let s=1/0,f=1/0,h=-1,k=-1;for(const O in y){const te=O.indexOf(",");if(te<0)continue;const he=parseInt(O.substring(0,te),10),ke=parseInt(O.substring(te+1),10),Re=y[O];Re&&(Re.value!==""||Re.styleId!==void 0)&&(he<s&&(s=he),ke<f&&(f=ke),he>h&&(h=he),ke>k&&(k=ke))}return h<0?null:{startCol:s,startRow:f,endCol:h,endRow:k}}const Ht=t.computed(()=>{const s=[0];for(let f=0;f<r.rowCount;f++)s.push(s[f]+pe(f));return s}),vl=t.computed(()=>Rt.value[r.colCount]),kl=t.computed(()=>Ht.value[r.rowCount]);function Jt(s,f){return`${s},${f}`}dt=Jt;function Tl(s){Reflect.deleteProperty(y,s)}function Vl(s,f){me.value="cell";const h=ft(s,f);h?(Me.value={col:h.range.startCol,row:h.range.startRow},Ne.value={...h.range}):(Me.value={col:s,row:f},Ne.value={startCol:s,startRow:f,endCol:s,endRow:f})}function El(s,f,h,k,O="cell"){const te=ft(s,f);if(Me.value=te?{col:te.range.startCol,row:te.range.startRow}:{col:s,row:f},me.value=O,O==="row"||O==="col"){const he=Math.min(s,h),ke=Math.max(s,h),Re=Math.min(f,k),_e=Math.max(f,k);Ne.value={startCol:he,startRow:Re,endCol:ke,endRow:_e}}else Ne.value=Ct(s,f,h,k)}function Nn(){El(0,0,r.colCount-1,r.rowCount-1,"all")}function yn(s,f){const h=Ne.value;return h?(me.value==="cell"||me.value==="all",s>=h.startCol&&s<=h.endCol&&f>=h.startRow&&f<=h.endRow):!1}function Gn(s,f){return yn(s,f)}function on(s,f){for(const h in xe){const k=xe[h];if(k&&s>=k.startCol&&s<=k.endCol&&f>=k.startRow&&f<=k.endRow)return{range:k,anchor:h}}return null}ft=on;function Qt(s,f){return xe[Jt(s,f)]!==void 0}function rn(s,f){const h=ft(s,f);if(h&&s===h.range.startCol&&f===h.range.startRow){const k=Rt.value[h.range.endCol+1]-Rt.value[s],O=Ht.value[h.range.endRow+1]-Ht.value[f];return{w:k,h:O}}return{w:ue(s),h:pe(f)}}function vt(s,f,h,k){let O=Math.min(s,h),te=Math.max(s,h),he=Math.min(f,k),ke=Math.max(f,k),Re=!0;for(;Re;){Re=!1;for(const _e in xe){const He=xe[_e];if(!He)continue;He.startCol<=te&&He.endCol>=O&&He.startRow<=ke&&He.endRow>=he&&(He.startCol<O&&(O=He.startCol,Re=!0),He.endCol>te&&(te=He.endCol,Re=!0),He.startRow<he&&(he=He.startRow,Re=!0),He.endRow>ke&&(ke=He.endRow,Re=!0))}}return{startCol:O,startRow:he,endCol:te,endRow:ke}}Ct=vt;function kt(s,f){var h;return((h=y[Jt(s,f)])==null?void 0:h.value)??""}function At(s,f){return mn(),Qr(s,f,y,r.colCount,r.rowCount)}function qn(s,f,h){var ke,Re;s>=0&&f>=0&&M(s,f);const k=Jt(s,f);if(mn(),I.invalidate(),q.length>0&&Sl(),h===""||h==null){X.clear(k);const _e=(ke=y[k])==null?void 0:ke.styleId;_e!==void 0&&_e>0?y[k]={value:"",styleId:_e}:Tl(k),X.markDirty(k);return}const O=String(h);if(!O.startsWith("=")){const _e=fe(y[k]),He=typeof(_e==null?void 0:_e.numberFormat)=="string"?_e.numberFormat:"";if(hl(He)){const Qe=Ul(O,o.value);if(Qe){const st={..._e??{},numberFormat:Qe.format};y[k]={value:String(Qe.serial),styleId:ge(st)},X.clear(k),X.markDirty(k);return}const Ge=ho(O,o.value);if(Ge){const st={..._e??{},numberFormat:Ge.format};y[k]={value:String(Ge.num),styleId:ge(st)},X.clear(k),X.markDirty(k);return}}}const te=(Re=y[k])==null?void 0:Re.styleId,he={value:O};te!==void 0&&te>0&&(he.styleId=te),y[k]=he,O.startsWith("=")?X.set(k,wo(O.slice(1),r.colCount,r.rowCount)):X.clear(k),X.markDirty(k)}function No(s,f,h,k){for(let O=s;O<=f;O++)for(let te=h;te<=k;te++){const he=Jt(O,te);X.clear(he),Tl(he),X.markDirty(he)}I.invalidate(),q.length>0&&Sl()}function xo(){return{cells:y,colCount:r.colCount,rowCount:r.rowCount,locale:o.value,getCellValue:(s,f)=>At(s,f)}}function al(s,f){return R.length===0?null:Z0(s,f,R,xo(),I)}function ql(s){var h,k,O;(h=S.saveUndo)==null||h.call(S);const f={id:s.id||J0(),condition:s.condition,format:s.format,ranges:s.ranges,priority:s.priority,stopIfTrue:s.stopIfTrue,enabled:s.enabled!==!1};R.push(f),I.invalidate(),(k=S.scheduleRender)==null||k.call(S),(O=S.emitModelData)==null||O.call(S)}function Dl(s,f){var k,O,te;(k=S.saveUndo)==null||k.call(S);const h=R.findIndex(he=>he.id===s);h<0||(R[h]={...R[h],...f,id:s},I.invalidate(),(O=S.scheduleRender)==null||O.call(S),(te=S.emitModelData)==null||te.call(S))}function Fl(s){var h,k,O;(h=S.saveUndo)==null||h.call(S);const f=R.findIndex(te=>te.id===s);f<0||(R.splice(f,1),I.invalidate(),(k=S.scheduleRender)==null||k.call(S),(O=S.emitModelData)==null||O.call(S))}function an(s,f){var Re,_e,He;(Re=S.saveUndo)==null||Re.call(S);const h=[...R].sort((Qe,Ge)=>Qe.priority-Ge.priority),k=h.findIndex(Qe=>Qe.id===s);if(k<0)return;const O=f==="up"?k-1:k+1;if(O<0||O>=h.length)return;const te=h[k],he=h[O],ke=te.priority;te.priority=he.priority,he.priority=ke,I.invalidate(),(_e=S.scheduleRender)==null||_e.call(S),(He=S.emitModelData)==null||He.call(S)}function Rl(){I.invalidate()}function wn(s){var f,h,k;if((f=S.saveUndo)==null||f.call(S),s==="sheet")R.splice(0,R.length);else{const O=S.selection.value;if(!O)return;for(let te=R.length-1;te>=0;te--){const he=R[te];he.ranges=he.ranges.filter(ke=>!(ke.startCol<=O.endCol&&ke.endCol>=O.startCol&&ke.startRow<=O.endRow&&ke.endRow>=O.startRow)),he.ranges.length===0&&R.splice(te,1)}}I.invalidate(),(h=S.scheduleRender)==null||h.call(S),(k=S.emitModelData)==null||k.call(S)}function Sl(){J.invalidate(),ee.clear()}function Yn(){return{cells:y,colCount:r.colCount,rowCount:r.rowCount,locale:o.value,getCellValue:(s,f)=>At(s,f),getSheetCells:s=>S.getSheetCellsById?S.getSheetCellsById(s):null}}function Yl(s,f){const h=ft(f,s),k=h?{col:h.range.startCol,row:h.range.startRow}:{col:f,row:s};return J.getRules(k.col,k.row,q)}function wr(s,f){const h=Yl(s,f);return h.length?h[0]:null}function To(s,f){return Yl(s,f).length>0}function Xn(s,f){const h=ft(f,s),k=h?{col:h.range.startCol,row:h.range.startRow}:{col:f,row:s};return J.findRule(k.col,k.row,r1,q)}function Vo(s){const f=s.listSource,h=f&&f.type==="range"?`range:${f.sheetId??""}:${f.range.startCol},${f.range.startRow},${f.range.endCol},${f.range.endRow}`:`values:${(f&&f.type==="values"?f.values:s.values??[]).join("")}`,k=ee.get(h);if(k)return k;const O=ba(s,Yn());return ee.set(h,O),O}function Do(s,f){const h=Xn(s,f);return h?{rule:h,items:Vo(h)}:null}function Cr(s,f){for(const h of Yl(s,f)){if(h.enabled===!1||!h.showInputMessage)continue;const k=h.inputTitle??"",O=h.inputMessage??"";if(!(!k&&!O))return{title:k,message:O}}return null}function Fo(s,f,h){const k=Yl(s,f);return k.length===0?{valid:!0}:ya(h,f,s,k,Yn())}function Io(s){const f=Yn(),h={stop:3,warning:2,information:1};let k=null,O=0;for(const te of s){const he=Yl(te.row,te.col);if(he.length===0)continue;const ke=ya(te.value,te.col,te.row,he,f);if(ke.valid)continue;const Re=h[cr(ke.rule)]??0;Re>O&&(O=Re,k=ke)}return k??{valid:!0}}function Oo(s,f){var k,O,te;f!=null&&f.silent||(k=S.saveUndo)==null||k.call(S);const h={...s,id:s.id||ha(),ranges:(s.ranges??[]).map(he=>({...he})),enabled:s.enabled!==!1};return q.push(h),Sl(),f!=null&&f.silent||((O=S.scheduleRender)==null||O.call(S),(te=S.emitModelData)==null||te.call(S)),h}function vr(s,f,h){var O,te,he;const k=q.findIndex(ke=>ke.id===s);if(k<0){Oo({id:s,...f},h);return}h!=null&&h.silent||(O=S.saveUndo)==null||O.call(S),q[k]={...q[k],...f,id:s},Sl(),h!=null&&h.silent||((te=S.scheduleRender)==null||te.call(S),(he=S.emitModelData)==null||he.call(S))}function kr(s,f){var k,O,te;const h=q.findIndex(he=>he.id===s);h<0||(f!=null&&f.silent||(k=S.saveUndo)==null||k.call(S),q.splice(h,1),Sl(),f!=null&&f.silent||((O=S.scheduleRender)==null||O.call(S),(te=S.emitModelData)==null||te.call(S)))}function Er(s,f){var O,te,he,ke,Re,_e;if(!s){if(q.length===0)return;f!=null&&f.silent||(O=S.saveUndo)==null||O.call(S),q.splice(0,q.length),Sl(),f!=null&&f.silent||((te=S.scheduleRender)==null||te.call(S),(he=S.emitModelData)==null||he.call(S));return}const h={startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};if(q.filter(He=>(He.ranges??[]).some(Qe=>!(Qe.endCol<h.startCol||Qe.startCol>h.endCol||Qe.endRow<h.startRow||Qe.startRow>h.endRow))).length!==0){f!=null&&f.silent||(ke=S.saveUndo)==null||ke.call(S);for(let He=q.length-1;He>=0;He--){const Qe=q[He],Ge=[];for(const st of Qe.ranges??[])Ge.push(...Ca(st,h));Ge.length===0?q.splice(He,1):Qe.ranges=Ge}Sl(),f!=null&&f.silent||((Re=S.scheduleRender)==null||Re.call(S),(_e=S.emitModelData)==null||_e.call(S))}}function Rr(s){const f=[];for(const h of q)for(const k of h.ranges??[]){const O=va(k,s);O&&f.push({rule:h,range:O})}return f}function Sr(s,f,h){var k,O,te;if(s.length){h!=null&&h.silent||(k=S.saveUndo)==null||k.call(S);for(let he=q.length-1;he>=0;he--){const ke=q[he],Re=[];for(const _e of ke.ranges??[])Re.push(...Ca(_e,f));Re.length===0?q.splice(he,1):ke.ranges=Re}for(const he of s){const ke=[];for(const Re of he.ranges??[]){const _e=va(Re,f);_e&&ke.push(_e)}ke.length&&q.push({...he,id:ha(),ranges:ke})}Sl(),h!=null&&h.silent||((O=S.scheduleRender)==null||O.call(S),(te=S.emitModelData)==null||te.call(S))}}async function io(s,f,h){const k=s.severity??"stop";if(!(!s.rule||s.rule.showErrorMessage!==!1))return k==="stop"?"cancel":"continue";const te=S.showValidationAlert;if(!te)return k==="stop"?"cancel":"continue";ne++;try{return await te({severity:k,title:s.title??"",message:s.message??"",col:f,row:h})}catch{return"cancel"}finally{ne=Math.max(0,ne-1)}}function so(){return ne>0}let co=()=>{};function Ao(s){T.value||(T.value={...Me.value},s!==void 0?se.value=s:se.value||(se.value=kt(Me.value.col,Me.value.row)))}async function uo(){const s=T.value;if(!s)return!1;const f=s.col,h=s.row,k=se.value,O=Fo(h,f,k);return!O.valid&&await io(O,f,h)!=="continue"?!1:(co(),qn(f,h,k),T.value=null,se.value="",!0)}function fo(){T.value=null,se.value=""}function Mr(s,f){const h=Me.value;let k=Math.max(0,h.col+s),O=Math.max(0,h.row+f);(k>=r.colCount||O>=r.rowCount)&&M(k,O);const te=ft(h.col,h.row),he=ft(k,O);te&&he&&te.anchor===he.anchor&&(s>0?k=te.range.endCol+1:s<0&&(k=te.range.startCol-1),f>0?O=te.range.endRow+1:f<0&&(O=te.range.startRow-1),(k>=r.colCount||O>=r.rowCount)&&M(k,O)),k=Math.max(0,Math.min(r.colCount-1,k)),O=Math.max(0,Math.min(r.rowCount-1,O)),Vl(k,O)}function Br(s,f){U(f,s)}function Lo(s){const f=Rt.value;if(s<0||s>=f[r.colCount])return-1;let h=0,k=r.colCount-1;for(;h<k;){const O=h+k+1>>1;f[O]<=s?h=O:k=O-1}return h}function _o(s){const f=Ht.value;if(s<0||s>=f[r.rowCount])return-1;let h=0,k=r.rowCount-1;for(;h<k;){const O=h+k+1>>1;f[O]<=s?h=O:k=O-1}return h}function Nr(s,f){var O,te;const h=Math.max(0,Math.min(Math.floor(s),r.rowCount)),k=Math.max(0,Math.min(Math.floor(f),r.colCount));de.rows=h,de.cols=k,(O=S.scheduleRender)==null||O.call(S),(te=S.emitModelData)==null||te.call(S)}function xr(){var s,f;de.rows=0,de.cols=0,(s=S.scheduleRender)==null||s.call(S),(f=S.emitModelData)==null||f.call(S)}function il(){return{rows:de.rows,cols:de.cols}}function Xl(){let s=0,f=0;if(de.cols>0){const h=ie.value,k=Math.min(de.cols,h.length);for(let O=0;O<k;O++)s+=h[O]}if(de.rows>0)for(let h=0;h<de.rows;h++)f+=pe(h);return{frozenRowsHeight:f,frozenColumnsWidth:s}}function Tr(){const{frozenColumnsWidth:s,frozenRowsHeight:f}=Xl(),h=je(),k=at(),O=52+h+s,te=24+k+f,he=Math.max(0,Ut.w-52-h-11-s),ke=Math.max(0,Ut.h-24-k-11-f),Re=[];return f>0&&s>0&&Re.push({kind:"corner",x:52+h,y:24+k,width:s,height:f,scrollLeft:0,scrollTop:0}),f>0&&Re.push({kind:"rows",x:O,y:24+k,width:he,height:f,scrollLeft:K.value,scrollTop:0}),s>0&&Re.push({kind:"columns",x:52+h,y:te,width:s,height:ke,scrollLeft:0,scrollTop:$.value}),Re.push({kind:"body",x:O,y:te,width:he,height:ke,scrollLeft:K.value,scrollTop:$.value}),Re}function u(s,f){const h=Rt.value,k=Ht.value,O=h[f]??0,te=k[s]??0,he=ft(f,s),ke=he?(h[he.range.endCol+1]??O)-O:(h[f+1]??O)-O,Re=he?(k[he.range.endRow+1]??te)-te:pe(s),_e=f<de.cols,He=s<de.rows,Qe=(_e?0:-K.value)+52+je()+O,Ge=(He?0:-$.value)+24+at()+te;return{x:Qe,y:Ge,width:ke,height:Re}}function w(s,f){const{frozenColumnsWidth:h,frozenRowsHeight:k}=Xl(),O=je(),te=at();if(s<52+O||f<24+te)return null;const he=h>0&&s<52+O+h,ke=k>0&&f<24+te+k,Re=he?s-52-O:s-52-O+K.value,_e=ke?f-24-te:f-24-te+$.value,He=Lo(Re),Qe=_o(_e);return He<0||Qe<0?null:{col:He,row:Qe}}function V(s,f){return s<de.rows||f<de.cols}function U(s,f){if(V(s,f))return;const{frozenColumnsWidth:h,frozenRowsHeight:k}=Xl(),O=Math.max(0,Ut.w-52-je()-11-h),te=Math.max(0,Ut.h-24-at()-11-k),he=Rt.value,ke=Ht.value,Re=(he[f]??0)-h,_e=(ke[s]??0)-k,He=ft(f,s),Qe=He?(he[He.range.endCol+1]??0)-(he[f]??0):ie.value[f]??0,Ge=He?(ke[He.range.endRow+1]??0)-(ke[s]??0):pe(s);let st=K.value,yt=$.value;Re<st?st=Re:Re+Qe>st+O&&(st=Re+Qe-O),_e<yt?yt=_e:_e+Ge>yt+te&&(yt=_e+Ge-te),st=Math.max(0,st),yt=Math.max(0,yt),nl(st,yt)}function M(s,f){var te;const h=s+1,k=f+1;let O=!1;if(h>=r.colCount){const he=Math.max(r.colCount+c,h),ke=he-r.colCount,Re=ie.value;for(let _e=0;_e<ke;_e++)Re.push(100);r.colCount=he,O=!0}if(k>=r.rowCount){const he=Math.max(r.rowCount+d,k),ke=he-r.rowCount,Re=re.value;for(let _e=0;_e<ke;_e++)Re.push(void 0);r.rowCount=he,O=!0}O&&((te=S.scheduleRender)==null||te.call(S))}function Y(){return r.colCount!==a||r.rowCount!==i}function j(s,f,h){const k=nr(s,f,xe);if(!k.ok){k.reason==="target-merge-size"&&window.alert(b(o.value,"autofillMergeSizeError"));return}const O=pa(s,f,{cells:y},h,o.value,r.colCount,r.rowCount,rt),te=Object.entries(O.cells).map(([ke,Re])=>{const _e=ke.indexOf(",");return{col:parseInt(ke.substring(0,_e),10),row:parseInt(ke.substring(_e+1),10),value:Re?Re.value:""}}),he=Io(te);if(!he.valid){(async()=>await io(he,f.startCol,f.startRow)==="continue"&&Z(s,f,h))();return}Z(s,f,h)}function Z(s,f,h){var te,he,ke;(te=S.saveUndo)==null||te.call(S),M(f.endCol,f.endRow);const k=pa(s,f,{cells:y},h,o.value,r.colCount,r.rowCount,rt);mn();for(const[Re,_e]of Object.entries(k.cells)){const He=Re.indexOf(","),Qe=parseInt(Re.substring(0,He),10),Ge=parseInt(Re.substring(He+1),10),st=on(Qe,Ge);if(st&&!(Qe===st.range.startCol&&Ge===st.range.startRow))continue;const yt=_e.value;yt===""&&(_e.styleId===void 0||_e.styleId===0)?(X.clear(Re),Tl(Re)):(y[Re]={value:yt,..._e.styleId!==void 0&&_e.styleId>0?{styleId:_e.styleId}:{}},yt.startsWith("=")?X.set(Re,wo(yt.slice(1),r.colCount,r.rowCount)):X.clear(Re)),X.markDirty(Re)}const O={startCol:Math.min(s.startCol,f.startCol),startRow:Math.min(s.startRow,f.startRow),endCol:Math.max(s.endCol,f.endCol),endRow:Math.max(s.endRow,f.endRow)};El(O.startCol,O.startRow,O.endCol,O.endRow),(he=S.scheduleRender)==null||he.call(S),(ke=S.emitModelData)==null||ke.call(S)}function oe(s,f){var te;let h=!1;const k=Math.max(1,Math.floor(s)),O=Math.max(1,Math.floor(f));if(k!==r.colCount){if(k>r.colCount){const he=ie.value;for(let ke=r.colCount;ke<k;ke++)he.push(100)}else ie.value=ie.value.slice(0,k);r.colCount=k,h=!0}if(O!==r.rowCount){if(O>r.rowCount){const he=re.value;for(let ke=r.rowCount;ke<O;ke++)he.push(void 0)}else re.value=re.value.slice(0,O);r.rowCount=O,h=!0}h&&((te=S.scheduleRender)==null||te.call(S))}const S={props:l,locale:o,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:M,hasDynamicDims:Y,setDims:oe,cells:y,styles:g,borders:C,merges:xe,formulaDeps:X,selection:Ne,activeCell:Me,editingCell:T,editValue:se,colWidths:ie,rowHeights:re,scrollX:K,scrollY:$,freeze:de,setFreeze:Nr,clearFreeze:xr,getFreeze:il,getFrozenMetrics:Xl,filter:z,getFilter:zn,setFilter:ao,enableFilter:Bn,clearFilter:Hn,clearFilterColumn:nn,setFilterColumn:Wn,getColumnCandidates:Pn,getDataRange:rl,getCurrentRegion:gr,detectFilterRange:Bo,toggleAutoFilter:Un,isColumnInFilterRange:Kn,getFilterRange:br,isFilterEnabled:yr,isFilterColumnActive:bn,isRowHidden:H,getFilteredOutRows:xl,getVisibleRowCount:W,getVisibleRowAt:G,getVisibleRowIndex:ve,getViewportRegions:Tr,cellToScreenRect:u,screenToCell:w,isCellFrozen:V,scrollCellIntoView:U,BASE_CELL_VPAD:Te,fontMetricsCache:Fe,fontMetricsCanvas:Le,measureFontMetrics:Be,_getFontMetricsForCell:qt,getWrappedLines:Kt,cellFontSize:zt,colPositions:Rt,getRowHeight:dl,_isAutoRow:yl,rowPositions:Ht,totalWidth:vl,totalHeight:kl,selectCell:Vl,selectRange:El,selectAll:Nn,isSelected:yn,isCellSelected:Gn,selectionMode:me,cellKey:Jt,delCell:Tl,findMerge:on,_isMergeAnchor:Qt,_mergedSpan:rn,expandSelectionForMerges:vt,getCellRaw:kt,getCellValue:At,setCellValue:qn,clearCellsInRange:No,startEdit:Ao,commitEdit:uo,cancelEdit:fo,moveActive:Mr,ensureVisible:Br,hitCol:Lo,hitRow:_o,registerStyle:ge,resolveStyle:fe,rebuildStyleIndex:Ce,syncStyles:$e,registerBorder:ze,resolveBorder:et,rebuildBorderIndex:nt,syncBorders:F,getCellBorderSide:A,getMergeOwner:Q,isSameMergeInternal:we,getRowOutlines:Nt,getColumnOutlines:Ot,addRowGroup:Cl,addColumnGroup:Rn,removeOutline:hn,clearRowGroups:gn,clearColumnGroups:mr,clearAllOutlines:no,setOutlineCollapsed:$n,toggleOutline:oo,getOutlineLevel:Ee,getOutlineGutterSize:Oe,getRowOutlineLevel:Ve,getColumnOutlineLevel:Ie,isRowCollapsed:ce,isColumnCollapsed:Ye,isRowVisible:Xe,isColumnVisible:v,isColHidden:P,getColWidth:ue,adjustOutlinesForInsertRows:ro,adjustOutlinesForDeleteRows:pr,adjustOutlinesForInsertCols:hr,adjustOutlinesForDeleteCols:Sn,syncOutlines:Mn,viewSize:Ut,findHighlight:(s,f)=>null,autoFillState:Ke,applyAutoFill:j,conditionalFormats:R,resolveConditionalFormat:al,addConditionalFormatRule:ql,updateConditionalFormatRule:Dl,removeConditionalFormatRule:Fl,moveConditionalFormatRule:an,clearConditionalFormats:wn,invalidateConditionalFormatCache:Rl,dataValidations:q,getDataValidationRules:Yl,getDataValidationRule:wr,hasDataValidation:To,getListValidation:Xn,getValidationDropdown:Do,getValidationInputMessage:Cr,validateCell:Fo,validateCells:Io,createDataValidation:Oo,updateDataValidation:vr,removeDataValidation:kr,clearDataValidation:Er,getDataValidationsInRange:Rr,applyDataValidationsToRange:Sr,invalidateDataValidationCache:Sl,isValidationAlertOpen:so,confirmInvalidValue:io};return co=()=>{var s;return(s=S.saveUndo)==null?void 0:s.call(S)},nl=(s,f)=>{var h;return(h=S.clampScroll)==null?void 0:h.call(S,s,f)},S}function B1(e,n){const l=t.ref([]),o=t.ref([]);function a(v){return k1(v)}function i(){return n.saveSheet(),{sheets:n.sheets.value.map(v=>({id:v.id,name:v.name,cells:a(v.cells),styles:[...v.styles],borders:v.borders?[...v.borders]:[{}],merges:v.merges?{...v.merges}:{},selection:v.selection?{...v.selection}:null,activeCell:v.activeCell?{...v.activeCell}:{col:0,row:0},scrollX:v.scrollX,scrollY:v.scrollY,colWidths:[...v.colWidths],rowHeights:[...v.rowHeights],colCount:v.colCount,rowCount:v.rowCount,freeze:{...v.freeze},filter:v.filter?JSON.parse(JSON.stringify(v.filter)):null,conditionalFormats:v.conditionalFormats?v.conditionalFormats.map(P=>({...P,ranges:P.ranges.map(ue=>({...ue}))})):[],dataValidations:v.dataValidations?v.dataValidations.map(P=>({...P,ranges:(P.ranges??[]).map(ue=>({...ue}))})):[],rowOutlines:v.rowOutlines?v.rowOutlines.map(P=>({...P})):[],columnOutlines:v.columnOutlines?v.columnOutlines.map(P=>({...P})):[]})),styles:[...e.styles],activeSheetIndex:n.activeSheetIndex.value}}function r(v){const P=n.sheets.value;n.sheets.value=v.sheets.map((ue,Ve)=>{var Ee;const Ie=((Ee=P[Ve])==null?void 0:Ee.freeze)??{rows:0,cols:0};return{...ue,cells:a(ue.cells),styles:[...ue.styles],borders:ue.borders?[...ue.borders]:[{}],freeze:{rows:Ie.rows,cols:Ie.cols}}}),n.loadSheet(Math.max(0,Math.min(v.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function c(){const v=i(),P=l.value[l.value.length-1];P&&JSON.stringify(P)===JSON.stringify(v)||(l.value.push(v),o.value=[],l.value.length>50&&l.value.shift())}e.saveUndo=c;function d(){var v,P,ue;l.value.length&&(o.value.push(i()),r(l.value.pop()),(v=e.invalidateConditionalFormatCache)==null||v.call(e),(P=e.invalidateDataValidationCache)==null||P.call(e),(ue=e.scheduleRender)==null||ue.call(e),t.nextTick(()=>{var Ve;return(Ve=e.emitModelData)==null?void 0:Ve.call(e)}))}function y(){var v,P,ue;o.value.length&&(l.value.push(i()),r(o.value.pop()),(v=e.invalidateConditionalFormatCache)==null||v.call(e),(P=e.invalidateDataValidationCache)==null||P.call(e),(ue=e.scheduleRender)==null||ue.call(e),t.nextTick(()=>{var Ve;return(Ve=e.emitModelData)==null?void 0:Ve.call(e)}))}const g=t.computed(()=>l.value.length>0),C=t.computed(()=>o.value.length>0),m=t.computed(()=>!!e.selection.value),B=t.ref(null);function R(){var ue;const v=e.selection.value;if(!v)return;const P={};for(let Ve=v.startCol;Ve<=v.endCol;Ve++)for(let Ie=v.startRow;Ie<=v.endRow;Ie++)P[`${Ve-v.startCol},${Ie-v.startRow}`]=((ue=e.cells[e.cellKey(Ve,Ie)])==null?void 0:ue.styleId)??0;B.value={styles:P}}function I(){var ue,Ve,Ie;const v=B.value,P=e.selection.value;if(!(!v||!P)){c();for(let Ee=P.startCol;Ee<=P.endCol;Ee++)for(let Oe=P.startRow;Oe<=P.endRow;Oe++){const je=e.findMerge(Ee,Oe);if(je&&(Ee!==je.range.startCol||Oe!==je.range.startRow))continue;const at=v.styles[`${Ee-P.startCol},${Oe-P.startRow}`]??0,Nt=e.cellKey(Ee,Oe),Ot=((ue=e.cells[Nt])==null?void 0:ue.value)??"";if(Ot===""&&at===0)e.delCell(Nt);else{const xt={value:Ot};at>0&&(xt.styleId=at),e.cells[Nt]=xt}}B.value=null,(Ve=e.scheduleRender)==null||Ve.call(e),(Ie=e.emitModelData)==null||Ie.call(e)}}function q(){var P,ue,Ve;const v=e.selection.value;if(v){c();for(let Ie=v.startCol;Ie<=v.endCol;Ie++)for(let Ee=v.startRow;Ee<=v.endRow;Ee++){const Oe=e.findMerge(Ie,Ee);if(Oe&&(Ie!==Oe.range.startCol||Ee!==Oe.range.startRow))continue;const je=e.cellKey(Ie,Ee),at=((P=e.cells[je])==null?void 0:P.value)??"";at===""?e.delCell(je):e.cells[je]={value:at}}(ue=e.scheduleRender)==null||ue.call(e),(Ve=e.emitModelData)==null||Ve.call(e)}}const J=t.computed(()=>Ka.map(v=>({...v,label:v.value===""?b(e.locale.value,"fontDefault"):v.label}))),ee=t.computed(()=>Ga.map(v=>({...v,label:String(v.value)}))),ne="\0",x=t.computed(()=>{const v=e.selection.value;if(!v)return"";let P,ue=!1;for(let Ve=v.startCol;Ve<=v.endCol&&!ue;Ve++)for(let Ie=v.startRow;Ie<=v.endRow&&!ue;Ie++){const Ee=e.findMerge(Ve,Ie);if(Ee&&(Ve!==Ee.range.startCol||Ie!==Ee.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(Ve,Ie)]),je=typeof(Oe==null?void 0:Oe.fontFamily)=="string"?Oe.fontFamily:"";P===void 0?P=je:je!==P&&(ue=!0)}return ue?ne:P??""}),le=t.computed(()=>{const v=e.selection.value;if(!v)return Jl;let P,ue=!1;for(let Ve=v.startCol;Ve<=v.endCol&&!ue;Ve++)for(let Ie=v.startRow;Ie<=v.endRow&&!ue;Ie++){const Ee=e.findMerge(Ve,Ie);if(Ee&&(Ve!==Ee.range.startCol||Ie!==Ee.range.startRow))continue;const Oe=e.cellFontSize(Ve,Ie);P===void 0?P=Oe:Oe!==P&&(ue=!0)}return ue?0:P??Jl});function ge(v,P){var Ve,Ie,Ee;const ue=e.selection.value;if(ue){c();for(let Oe=ue.startCol;Oe<=ue.endCol;Oe++)for(let je=ue.startRow;je<=ue.endRow;je++){const at=e.findMerge(Oe,je);if(at&&(Oe!==at.range.startCol||je!==at.range.startRow))continue;const Nt=e.cellKey(Oe,je),Ot=((Ve=e.cells[Nt])==null?void 0:Ve.value)??"";let Cl={...e.resolveStyle(e.cells[Nt])??{}};if(P===""||P===null||P===void 0||P===0){const{[v]:hn,...gn}=Cl;Cl=gn}else Cl[v]=P;const Rn=Object.keys(Cl).length?e.registerStyle(Cl):0;if(Ot===""&&Rn===0)e.delCell(Nt);else{const hn={value:Ot};Rn>0&&(hn.styleId=Rn),e.cells[Nt]=hn}}(Ie=e.scheduleRender)==null||Ie.call(e),(Ee=e.emitModelData)==null||Ee.call(e)}}function fe(v){ge("fontFamily",v===""?"":v)}const Ce=t.ref(!1),$e=t.ref(!1),ze=t.ref(!1),et=t.ref(!1),nt=t.ref(!1);function F(v){ge("fontSize",v),Ce.value=!1}const A=t.computed(()=>Qa.map(v=>({label:b(e.locale.value,v.labelKey),value:v.value,icon:v.icon}))),Q=t.computed(()=>ei.map(v=>({label:b(e.locale.value,v.labelKey),value:v.value,icon:v.icon}))),we=t.computed(()=>{const v=e.selection.value;if(!v)return"left";const P=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]),ue=typeof(P==null?void 0:P.textAlign)=="string"?P.textAlign:"";return ue==="center"||ue==="right"?ue:"left"}),xe=t.computed(()=>{const v=e.selection.value;if(!v)return"top";const P=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]),ue=typeof(P==null?void 0:P.verticalAlign)=="string"?P.verticalAlign:"";return ue==="middle"||ue==="bottom"?ue:"top"}),X=t.computed(()=>{const v=e.selection.value;if(!v)return!1;const P=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]);return(P==null?void 0:P.wrap)==="wrap"});function Ne(v){ge("textAlign",v)}function me(v){ge("verticalAlign",v)}function Me(){if(!e.selection.value)return;const P=X.value;ge("wrap",P?void 0:"wrap")}const T=t.ref(""),se=Ce;t.watch(le,v=>{T.value=v===0?"":String(v)},{immediate:!0});function ie(v){const P=v.replace(/[^\d]/g,"");T.value=P;const ue=parseInt(P,10);!isNaN(ue)&&ue>=5&&ue<=72&&ue!==le.value&&ge("fontSize",ue)}function re(){const v=T.value.trim();if(!v){T.value=le.value===0?"":String(le.value);return}let P=parseInt(v,10);isNaN(P)?P=le.value===0?Jl:le.value:P=Math.max(5,Math.min(72,P)),T.value=String(P),P!==le.value&&ge("fontSize",P)}function K(v){v.key==="Enter"&&v.target.blur()}function $(v){v&&v.preventDefault(),se.value=!se.value,se.value&&(ze&&(ze.value=!1),$e&&($e.value=!1),et.value=!1,nt.value=!1)}function de(){const v=le.value===0?Jl:le.value,P=Math.min(72,v+1);ge("fontSize",P),T.value=String(P),se.value=!1}function z(){const v=le.value===0?Jl:le.value,P=Math.max(5,v-1);ge("fontSize",P),T.value=String(P),se.value=!1}function _(v){const P=e.selection.value;if(!P)return!1;let ue,Ve=!1;for(let Ie=P.startCol;Ie<=P.endCol&&!Ve;Ie++)for(let Ee=P.startRow;Ee<=P.endRow&&!Ve;Ee++){const Oe=e.findMerge(Ie,Ee);if(Oe&&(Ie!==Oe.range.startCol||Ee!==Oe.range.startRow))continue;const je=e.resolveStyle(e.cells[e.cellKey(Ie,Ee)]),at=!!(je!=null&&je[v]);ue===void 0?ue=at:at!==ue&&(Ve=!0)}return!Ve&&ue===!0}const ae=t.computed(()=>_("fontWeight")),Ke=t.computed(()=>_("fontStyle")),Fe=t.computed(()=>_("underline")),Le=t.computed(()=>_("strikethrough"));function Be(){ge("fontWeight",ae.value?"":"bold")}function qe(){ge("fontStyle",Ke.value?"":"italic")}function Je(){ge("underline",Fe.value?"":"underline")}function Te(){ge("strikethrough",Le.value?"":"line-through")}const dt=t.ref(""),ft=t.ref(""),Ue=et,N=nt;function pe(){Ue.value=!Ue.value,N.value=!1,$e&&($e.value=!1),ze&&(ze.value=!1)}function Ct(){N.value=!N.value,Ue.value=!1,$e&&($e.value=!1),ze&&(ze.value=!1)}function qt(v){$e&&($e.value=v),v&&(Ue.value=!1,N.value=!1,ze&&(ze.value=!1))}function Kt(v){dt.value=v,ge("color",v===""?"":v)}function zt(v){ft.value=v,ge("backgroundColor",v===""?"":v)}function Rt(){ge("color",dt.value===""?"":dt.value)}function Ut(){ge("backgroundColor",ft.value===""?"":ft.value)}const nl=t.computed(()=>{const v=e.selection.value;if(!v)return"";let P,ue=!1;for(let Ve=v.startCol;Ve<=v.endCol&&!ue;Ve++)for(let Ie=v.startRow;Ie<=v.endRow&&!ue;Ie++){const Ee=e.findMerge(Ve,Ie);if(Ee&&(Ve!==Ee.range.startCol||Ie!==Ee.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(Ve,Ie)]),je=typeof(Oe==null?void 0:Oe.color)=="string"?Oe.color:"";P===void 0?P=je:je!==P&&(ue=!0)}return ue?"":P??""}),bl=t.computed(()=>{const v=e.selection.value;if(!v)return"";let P,ue=!1;for(let Ve=v.startCol;Ve<=v.endCol&&!ue;Ve++)for(let Ie=v.startRow;Ie<=v.endRow&&!ue;Ie++){const Ee=e.findMerge(Ve,Ie);if(Ee&&(Ve!==Ee.range.startCol||Ie!==Ee.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(Ve,Ie)]),je=typeof(Oe==null?void 0:Oe.backgroundColor)=="string"?Oe.backgroundColor:"";P===void 0?P=je:je!==P&&(ue=!0)}return ue?"":P??""}),dl=t.computed(()=>Wr(e.locale.value)),yl=t.ref(!1),Gt=t.computed(()=>{const v=e.selection.value;if(!v)return en;let P,ue=!1;for(let Ve=v.startCol;Ve<=v.endCol&&!ue;Ve++)for(let Ie=v.startRow;Ie<=v.endRow&&!ue;Ie++){const Ee=e.findMerge(Ve,Ie);if(Ee&&(Ve!==Ee.range.startCol||Ie!==Ee.range.startRow))continue;const Oe=e.resolveStyle(e.cells[e.cellKey(Ve,Ie)]),je=(Oe==null?void 0:Oe.numberFormatCategory)==="custom"?Ql:typeof(Oe==null?void 0:Oe.numberFormat)=="string"?Oe.numberFormat:"";P===void 0?P=je:je!==P&&(ue=!0)}return ue?Pl:P??en});function ol(v){if((v==null?void 0:v.numberFormatCategory)==="custom")return Ql;const P=typeof(v==null?void 0:v.numberFormat)=="string"?v.numberFormat:"";return Hr(P,e.locale.value)}const wl=t.computed(()=>{const v=Gt.value;if(v!==Pl)return v===Ql?Ql:Hr(v,e.locale.value);const P=e.selection.value;if(!P)return en;let ue,Ve=!1;for(let Ie=P.startCol;Ie<=P.endCol&&!Ve;Ie++)for(let Ee=P.startRow;Ee<=P.endRow&&!Ve;Ee++){const Oe=e.findMerge(Ie,Ee);if(Oe&&(Ie!==Oe.range.startCol||Ee!==Oe.range.startRow))continue;const je=ol(e.resolveStyle(e.cells[e.cellKey(Ie,Ee)]));ue===void 0?ue=je:je!==ue&&(Ve=!0)}return Ve?Pl:ue??en});function xl(v){ge("numberFormat",v),H()}function H(){const v=e.selection.value;if(v)for(let P=v.startCol;P<=v.endCol;P++)for(let ue=v.startRow;ue<=v.endRow;ue++){const Ve=e.findMerge(P,ue);if(Ve&&(P!==Ve.range.startCol||ue!==Ve.range.startRow))continue;const Ie=e.cellKey(P,ue),Ee=e.cells[Ie],Oe=e.resolveStyle(Ee);if((Oe==null?void 0:Oe.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:je,...at}=Oe,Nt=Object.keys(at).length?e.registerStyle(at):0,Ot=(Ee==null?void 0:Ee.value)??"";if(Ot===""&&Nt===0)e.delCell(Ie);else{const xt={value:Ot};Nt>0&&(xt.styleId=Nt),e.cells[Ie]=xt}}}function W(v){if(v===Ql){yl.value=!0;return}xl(v)}function G(){yl.value=!0}function ve(){const v=e.selection.value;if(!v)return[];const P=[];for(let ue=v.startCol;ue<=v.endCol;ue++)for(let Ve=v.startRow;Ve<=v.endRow;Ve++){const Ie=e.findMerge(ue,Ve);if(Ie&&(ue!==Ie.range.startCol||Ve!==Ie.range.startRow))continue;const Ee=e.cellKey(ue,Ve),Oe=e.cells[Ee],je=e.resolveStyle(Oe),at=typeof(je==null?void 0:je.numberFormat)=="string"?je.numberFormat:en,Nt=(Oe==null?void 0:Oe.value)??"",Ot=Nt.startsWith("=")?Qr(ue,Ve,e.cells,e.colCount,e.rowCount):Nt;zr(at,Ot)&&P.push({key:Ee,nf:at,decimals:Ci(at,Ot)})}return P}const D=t.computed(()=>ve().some(v=>v.decimals<Go)),p=t.computed(()=>ve().some(v=>v.decimals>qo));function E(v,P,ue){var je;const Ve=((je=e.cells[v])==null?void 0:je.value)??"",Ee={...e.resolveStyle(e.cells[v])??{}};P===""?(delete Ee.numberFormat,delete Ee.numberFormatCategory):(Ee.numberFormat=P,ue==="custom"&&(Ee.numberFormatCategory="custom"));const Oe=Object.keys(Ee).length?e.registerStyle(Ee):0;if(Ve===""&&Oe===0)e.delCell(v);else{const at={value:Ve};Oe>0&&(at.styleId=Oe),e.cells[v]=at}}function be(v){var Ve,Ie;const P=ve(),ue=[];for(const Ee of P){const Oe=Ee.decimals+v;if(Oe<qo||Oe>Go)continue;const je=ki(Ee.nf,Oe);je==null||je===Ee.nf||ue.push({key:Ee.key,code:je,category:hl(Ee.nf)?"custom":void 0})}if(ue.length){c();for(const Ee of ue)E(Ee.key,Ee.code,Ee.category);(Ve=e.scheduleRender)==null||Ve.call(e),(Ie=e.emitModelData)==null||Ie.call(e)}}function ce(){be(1)}function Ye(){be(-1)}return{undoStack:l,redoStack:o,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:c,undo:d,redo:y,canUndo:g,canRedo:C,hasSelection:m,paintFmt:B,onPaintFormat:R,applyPaintFormat:I,clearFormat:q,fontFamilyOptions:J,fontSizeOptions:ee,FONT_FAMILY_MIXED:ne,selFontFamily:x,selFontSize:le,applyStyleToSelection:ge,onFontFamilyChange:fe,onFontSizeChange:F,hAlignOptions:A,vAlignOptions:Q,selHAlign:we,selVAlign:xe,selWrap:X,onHAlignChange:Ne,onVAlignChange:me,onWrapToggle:Me,fontSizeInput:T,fontSizeMenuOpen:se,onFontSizeInput:ie,onFontSizeBlur:re,onFontSizeKeydown:K,toggleFontSizeMenu:$,onFontSizeStepUp:de,onFontSizeStepDown:z,selFontWeight:ae,selFontStyle:Ke,selUnderline:Fe,selStrikethrough:Le,toggleFontWeight:Be,toggleFontStyle:qe,toggleUnderline:Je,toggleStrikethrough:Te,cachedTextColor:dt,cachedFillColor:ft,textColorMenuOpen:Ue,fillColorMenuOpen:N,_toggleTextColorMenu:pe,_toggleFillColorMenu:Ct,onBorderMenuToggle:qt,onTextColorChange:Kt,onFillColorChange:zt,applyCachedTextColor:Rt,applyCachedFillColor:Ut,selTextColor:nl,selFillColor:bl,nfOptions:dl,selNumberFormat:Gt,selNumberFormatDisplay:wl,NF_NUMBER_FORMAT_MIXED:Pl,nfDialogOpen:yl,onNumberFormatChange:W,openNumberFormatDialog:G,applyNumberFormatCode:xl,canIncreaseDecimals:D,canDecreaseDecimals:p,onIncreaseDecimals:ce,onDecreaseDecimals:Ye}}function N1(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const o=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{o&&(o.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),o&&(o.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,o&&(o.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,o&&(o.value=!1),a&&(a.value=!1)}})()}function x1(e,n){const l=t.ref("none"),o=t.ref(!1),a="#444";function i(T,se,ie,re){if(T<0||se<0||T>=e.colCount||se>=e.rowCount)return;const K=e.findMerge(T,se),$=K?K.anchor:e.cellKey(T,se);if(!e.cells[$]){if(!re)return;e.cells[$]={value:""}}S1(e.cells[$],ie,re,e.styles,{get:z=>e.resolveBorder(z),getId:z=>e.registerBorder(z)},e.registerStyle)}function r(T,se,ie){var _;const re=e.findMerge(T,se),K=re?re.anchor:e.cellKey(T,se),$=((_=e.cells[K])==null?void 0:_.value)??"",de=e.resolveStyle(e.cells[K])?{...e.resolveStyle(e.cells[K])}:{},z=e.registerBorder(ie);if(z>0?de.borderId=z:delete de.borderId,delete de.borderTopWidth,delete de.borderBottomWidth,delete de.borderLeftWidth,delete de.borderRightWidth,delete de.borderColor,$===""&&!Object.keys(de).length)e.delCell(K);else{const ae=e.registerStyle(de);e.cells[K]={value:$,styleId:ae||void 0}}}function c(T){var _,ae;l.value=T;const se=e.selection.value;if(!se)return;n.saveUndo();const{startCol:ie,startRow:re,endCol:K,endRow:$}=se,de={width:1,color:a},z={width:2,color:a};if(T==="none")for(let Ke=ie;Ke<=K;Ke++)for(let Fe=re;Fe<=$;Fe++){const Le=e.findMerge(Ke,Fe);Le&&(Ke!==Le.range.startCol||Fe!==Le.range.startRow)||r(Ke,Fe,{})}else if(T==="all")for(let Ke=ie;Ke<=K;Ke++)for(let Fe=re;Fe<=$;Fe++){const Le=e.findMerge(Ke,Fe);Le&&(Ke!==Le.range.startCol||Fe!==Le.range.startRow)||r(Ke,Fe,{top:de,right:de,bottom:de,left:de})}else if(T==="outer"||T==="thickOuter"){const Ke=T==="thickOuter"?z:de;for(let Fe=ie;Fe<=K;Fe++)i(Fe,re,"top",Ke);for(let Fe=ie;Fe<=K;Fe++)i(Fe,$,"bottom",Ke);for(let Fe=re;Fe<=$;Fe++)i(ie,Fe,"left",Ke);for(let Fe=re;Fe<=$;Fe++)i(K,Fe,"right",Ke)}else{const Fe={top:{side:"top",edgeCheck:(Le,Be)=>Be===re},bottom:{side:"bottom",edgeCheck:(Le,Be)=>Be===$},left:{side:"left",edgeCheck:(Le,Be)=>Le===ie},right:{side:"right",edgeCheck:(Le,Be)=>Le===K}}[T];if(Fe)for(let Le=ie;Le<=K;Le++)for(let Be=re;Be<=$;Be++)Fe.edgeCheck(Le,Be)&&i(Le,Be,Fe.side,de)}(_=e.scheduleRender)==null||_.call(e),(ae=e.emitModelData)==null||ae.call(e)}function d(){c(l.value)}function y(T,se,ie){const re=ie.toLowerCase(),K=e.findMerge(T,se);if(K){if(re==="top"&&se!==K.range.startRow||re==="bottom"&&se!==K.range.endRow||re==="left"&&T!==K.range.startCol||re==="right"&&T!==K.range.endCol)return 0;const de=e.getCellBorderSide(e.cells[K.anchor],re);return(de==null?void 0:de.width)??0}const $=e.getCellBorderSide(e.cells[e.cellKey(T,se)],re);return($==null?void 0:$.width)??0}const g=t.ref(!1);function C(T){g.value=T,T&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,o.value=!1,n.fontSizeMenuOpen.value=!1)}function m(T,se,ie,re){const K=[];for(const $ in e.merges){const de=e.merges[$];de&&de.startCol<=ie&&de.endCol>=T&&de.startRow<=re&&de.endRow>=se&&K.push($)}for(const $ of K)Reflect.deleteProperty(e.merges,$)}function B(){var $,de,z;const T=e.selection.value;if(!T||T.startCol===T.endCol&&T.startRow===T.endRow)return;n.saveUndo(),m(T.startCol,T.startRow,T.endCol,T.endRow);const se=e.cellKey(T.startCol,T.startRow),ie=(($=e.cells[se])==null?void 0:$.value)??"";for(let _=T.startCol;_<=T.endCol;_++)for(let ae=T.startRow;ae<=T.endRow;ae++)_===T.startCol&&ae===T.startRow||e.clearCellsInRange(_,_,ae,ae);const re=e.resolveStyle(e.cells[se])?{...e.resolveStyle(e.cells[se])}:{};re.textAlign="center";const K=e.registerStyle(re);e.cells[se]={value:ie,styleId:K||void 0},e.merges[se]={startCol:T.startCol,startRow:T.startRow,endCol:T.endCol,endRow:T.endRow},e.selectCell(T.startCol,T.startRow),(de=e.scheduleRender)==null||de.call(e),(z=e.emitModelData)==null||z.call(e)}function R(){var se,ie,re;const T=e.selection.value;if(!(!T||T.startCol===T.endCol)){n.saveUndo();for(let K=T.startRow;K<=T.endRow;K++){m(T.startCol,K,T.endCol,K);const $=e.cellKey(T.startCol,K);(se=e.cells[$])==null||se.value;for(let de=T.startCol+1;de<=T.endCol;de++)e.clearCellsInRange(de,de,K,K);e.merges[$]={startCol:T.startCol,startRow:K,endCol:T.endCol,endRow:K}}e.selectRange(T.startCol,T.startRow,T.endCol,T.endRow),(ie=e.scheduleRender)==null||ie.call(e),(re=e.emitModelData)==null||re.call(e)}}function I(){var ie,re,K;const T=e.selection.value;if(!T||T.startCol===T.endCol&&T.startRow===T.endRow)return;n.saveUndo(),m(T.startCol,T.startRow,T.endCol,T.endRow);const se=e.cellKey(T.startCol,T.startRow);(ie=e.cells[se])==null||ie.value;for(let $=T.startCol;$<=T.endCol;$++)for(let de=T.startRow;de<=T.endRow;de++)$===T.startCol&&de===T.startRow||e.clearCellsInRange($,$,de,de);e.merges[se]={startCol:T.startCol,startRow:T.startRow,endCol:T.endCol,endRow:T.endRow},e.selectCell(T.startCol,T.startRow),(re=e.scheduleRender)==null||re.call(e),(K=e.emitModelData)==null||K.call(e)}function q(){var se,ie;const T=e.selection.value;T&&(n.saveUndo(),m(T.startCol,T.startRow,T.endCol,T.endRow),(se=e.scheduleRender)==null||se.call(e),(ie=e.emitModelData)==null||ie.call(e))}function J(){const T=e.selection.value;if(!T)return;const se=e.findMerge(T.startCol,T.startRow);se&&T.startCol===se.range.startCol&&T.startRow===se.range.startRow&&T.endCol===se.range.endCol&&T.endRow===se.range.endRow?q():B()}function ee(T){switch(T){case"mergeCenter":B();break;case"mergeAcross":R();break;case"mergeCells":I();break;case"unmergeCells":q();break}}let ne=null,x=[],le=[];function ge(T,se,ie,re){le=[];const K={startCol:T,endCol:se,startRow:ie,endRow:re};for(const{rule:$,range:de}of e.getDataValidationsInRange(K))le.push({...$,ranges:[{...de}]})}function fe(T,se,ie,re){x=[];for(let K=ie;K<=re;K++){const $=[];for(let de=T;de<=se;de++){const z=e.cells[e.cellKey(de,K)];$.push((z==null?void 0:z.styleId)??0)}x.push($)}}function Ce(T,se,ie,re){const K=e.cellKey(T,se);if(mn(),ie===""||ie==null){e.formulaDeps.clear(K),re&&re>0?e.cells[K]={value:"",styleId:re}:e.delCell(K),e.formulaDeps.markDirty(K);return}e.cells[K]={value:ie,styleId:re&&re>0?re:void 0},ie.startsWith("=")?e.formulaDeps.set(K,wo(ie.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(K),e.formulaDeps.markDirty(K)}function $e(){const T=e.selection.value;if(!T)return;ne={...T},fe(T.startCol,T.endCol,T.startRow,T.endRow),ge(T.startCol,T.endCol,T.startRow,T.endRow);const se=[];for(let ie=T.startRow;ie<=T.endRow;ie++){const re=[];for(let K=T.startCol;K<=T.endCol;K++)re.push(e.getCellRaw(K,ie));se.push(re.join(" "))}Zo(se.join(`
4
+ `))}function ze(){const T=e.selection.value;if(T){if(T.startCol===0&&T.endCol===e.colCount-1){ne={...T},fe(0,e.colCount-1,T.startRow,T.endRow),ge(0,e.colCount-1,T.startRow,T.endRow);const se=[];for(let ie=T.startRow;ie<=T.endRow;ie++){const re=[];for(let K=0;K<e.colCount;K++)re.push(e.getCellRaw(K,ie));se.push(re.join(" "))}Zo(se.join(`
5
+ `))}else if(T.startRow===0&&T.endRow===e.rowCount-1){ne={...T},fe(T.startCol,T.endCol,0,e.rowCount-1),ge(T.startCol,T.endCol,0,e.rowCount-1);const se=[];for(let ie=0;ie<e.rowCount;ie++){const re=[];for(let K=T.startCol;K<=T.endCol;K++)re.push(e.getCellRaw(K,ie));se.push(re.join(" "))}Zo(se.join(`
6
+ `))}}}async function et(){var Fe;let T;try{T=await navigator.clipboard.readText()}catch{return}if(!T&&T!=="")return;const se=T.split(/\r?\n/),ie=e.activeCell.value,re=ne,K=re&&x.length>0,$=se.map(Le=>Le.split(" ").length),de=$.length?Math.max(...$):0,z=ie.col+de-1,_=ie.row+se.length-1;z>=0&&_>=0&&e.ensureCapacity(z,_);const ae=[];for(let Le=0;Le<se.length;Le++){const Be=se[Le].split(" ");for(let qe=0;qe<Be.length;qe++){const Je=ie.col+qe,Te=ie.row+Le;let dt=Be[qe];dt.startsWith("=")&&re&&(dt=Co(dt,Je-(re.startCol+qe),Te-(re.startRow+Le),e.colCount,e.rowCount,rt));const ft=K&&Le<x.length&&qe<(((Fe=x[Le])==null?void 0:Fe.length)??0)?x[Le][qe]??null:null;ae.push({c:Je,r:Te,val:dt,styleId:ft})}}const Ke=e.validateCells(ae.map(Le=>({col:Le.c,row:Le.r,value:Le.val})));if(!(!Ke.valid&&await e.confirmInvalidValue(Ke,ie.col,ie.row)!=="continue")){for(const Le of ae)Le.styleId!==null?Ce(Le.c,Le.r,Le.val,Le.styleId):e.setCellValue(Le.c,Le.r,Le.val);if(re&&le.length>0){const Le=ie.col-re.startCol,Be=ie.row-re.startRow,qe={startCol:ie.col,endCol:ie.col+de-1,startRow:ie.row,endRow:ie.row+se.length-1},Je=le.map(Te=>({...Te,ranges:Te.ranges.map(dt=>g1(dt,Le,Be))}));e.applyDataValidationsToRange(Je,qe,{silent:!0}),e.invalidateDataValidationCache()}}}function nt(){var T;if(n.saveUndo(),$e(),e.selection.value){const se=e.selection.value;e.clearCellsInRange(se.startCol,se.endCol,se.startRow,se.endRow),(T=e.scheduleRender)==null||T.call(e)}}function F(){var T;if(e.selection.value){const se=e.selection.value;e.clearCellsInRange(se.startCol,se.endCol,se.startRow,se.endRow),(T=e.scheduleRender)==null||T.call(e)}}function A(){var $,de;const T=e.selection.value;if(!T)return;n.saveUndo();const se=T.startCol,ie=T.startRow,re=T.endCol,K=T.endRow;if(ie===K)if(re+1<e.colCount){const z=`${rt(se)}${ie+1}:${rt(re)}${ie+1}`;e.setCellValue(re+1,ie,`=SUM(${z})`)}else{const z=`${rt(se)}${ie+1}:${rt(re-1)}${ie+1}`;e.setCellValue(re,ie,`=SUM(${z})`)}else for(let z=se;z<=re;z++)if(K+1<e.rowCount){const _=`${rt(z)}${ie+1}:${rt(z)}${K+1}`;e.setCellValue(z,K+1,`=SUM(${_})`)}else{const _=`${rt(z)}${ie+1}:${rt(z)}${K}`;e.setCellValue(z,K,`=SUM(${_})`)}($=e.scheduleRender)==null||$.call(e),(de=e.emitModelData)==null||de.call(e)}function Q(){var $,de;const T=e.selection.value;if(!T)return;n.saveUndo();const se=T.startCol,ie=T.startRow,re=T.endCol,K=T.endRow;if(ie===K)if(re+1<e.colCount){const z=`${rt(se)}${ie+1}:${rt(re)}${ie+1}`;e.setCellValue(re+1,ie,`=AVERAGE(${z})`)}else{const z=`${rt(se)}${ie+1}:${rt(re-1)}${ie+1}`;e.setCellValue(re,ie,`=AVERAGE(${z})`)}else for(let z=se;z<=re;z++)if(K+1<e.rowCount){const _=`${rt(z)}${ie+1}:${rt(z)}${K+1}`;e.setCellValue(z,K+1,`=AVERAGE(${_})`)}else{const _=`${rt(z)}${ie+1}:${rt(z)}${K}`;e.setCellValue(z,K,`=AVERAGE(${_})`)}($=e.scheduleRender)==null||$.call(e),(de=e.emitModelData)==null||de.call(e)}function we(){var $,de;const T=e.selection.value;if(!T)return;n.saveUndo();const se=T.startCol,ie=T.startRow,re=T.endCol,K=T.endRow;if(ie===K)if(re+1<e.colCount){const z=`${rt(se)}${ie+1}:${rt(re)}${ie+1}`;e.setCellValue(re+1,ie,`=COUNT(${z})`)}else{const z=`${rt(se)}${ie+1}:${rt(re-1)}${ie+1}`;e.setCellValue(re,ie,`=COUNT(${z})`)}else for(let z=se;z<=re;z++)if(K+1<e.rowCount){const _=`${rt(z)}${ie+1}:${rt(z)}${K+1}`;e.setCellValue(z,K+1,`=COUNT(${_})`)}else{const _=`${rt(z)}${ie+1}:${rt(z)}${K}`;e.setCellValue(z,K,`=COUNT(${_})`)}($=e.scheduleRender)==null||$.call(e),(de=e.emitModelData)==null||de.call(e)}const xe=t.ref(!1);function X(T){xe.value=T,T&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,o.value=!1,n.fontSizeMenuOpen.value=!1,g.value=!1)}function Ne(){A(),xe.value=!1}function me(){Q(),xe.value=!1}function Me(){we(),xe.value=!1}return{cachedBorder:l,borderMenuOpen:o,BORDER_COLOR:a,onBorderChange:c,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:d,cellBorderWidth:y,mergeMenuOpen:g,onMergeMenuToggle:C,removeOverlappingMerges:m,mergeAndCenter:B,mergeAcross:R,mergeCells:I,unmergeCells:q,onApplyMerge:J,onMergeChange:ee,copySourceRange:null,copySourceStyles:[],captureStyles:fe,captureDataValidations:ge,setCellWithStyle:Ce,copyToClipboard:$e,copyRowCol:ze,pasteFromClipboard:et,cutSelected:nt,clearSelected:F,sumSelected:A,avgSelected:Q,countSelected:we,calcMenuOpen:xe,onCalcMenuToggle:X,onCalcSum:Ne,onCalcAvg:me,onCalcCount:Me}}function T1(e,n,l,o){const a={},i=o(n),r=o(l);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 Va(e){return e==="number"?0:1}function Da(e,n,l){var i;if(e==null||e.trim()==="")return{kind:"blank"};const o=n??"";if(o===pl||o==="@")return{kind:"text",text:e};if(hl(o)){if(Bl(e))return{kind:"number",num:Number(e)};const r=Ul(e,l);return r?{kind:"number",num:r.serial}:{kind:"text",text:Ml(e,o,l)}}const a=tn(o);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:Ml(e,o,l)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const c=((i=a.sections.find(d=>d.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*c}}return{kind:"text",text:Ml(e,o,l)}}return{kind:"text",text:Ml(e,o,l)}}function V1(e,n,l,o){if(e.kind==="blank"||n.kind==="blank")return e.kind==="blank"&&n.kind==="blank"?0:e.kind==="blank"?1:-1;const a=Va(e.kind),i=Va(n.kind);if(a!==i)return l==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(n.num??0):r=(e.text??"").localeCompare(n.text??"",o,{numeric:!0}),l==="asc"?r:-r}function D1(e,n,l){const o=e.map((a,i)=>i);return o.sort((a,i)=>{const r=V1(e[a],e[i],n,l);return r!==0?r:a-i}),o}function F1(e){if(e.length<2||e[0].kind!=="text")return!1;for(let n=1;n<e.length;n++)if(e[n].kind==="number")return!0;return!1}function ur(e){return e?JSON.parse(JSON.stringify(e)):null}function Fa(e,n,l,o){if(!e)return null;const a=l-n+1,i={...e.range};return o?n<=i.endRow&&(n<=i.startRow&&(i.startRow+=a),i.endRow+=a):l<i.startRow?(i.startRow-=a,i.endRow-=a):n<=i.endRow&&(i.endRow-=Math.min(a,i.endRow-n+1),i.endRow<i.startRow&&(i.endRow=i.startRow)),{range:i,columns:e.columns}}function Ia(e,n,l,o){if(!e)return null;const a=l-n+1,i={...e.range},r={};if(o){n<=i.endCol&&(n<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const c in e.columns){const d=Number(c);r[d>=n?d+a:d]=e.columns[c]}}else{l<i.startCol?(i.startCol-=a,i.endCol-=a):n<=i.endCol&&(i.endCol-=Math.min(a,i.endCol-n+1),i.endCol<i.startCol&&(i.endCol=i.startCol));for(const c in e.columns){const d=Number(c);d>=n&&d<=l||(r[d>l?d-a:d]=e.columns[c])}}return{range:i,columns:r}}function Oa(e,n,l,o){if(n==="row"){const a=e.startRow,i=e.endRow;let r,c;if(i<l)r=a,c=i;else if(a>l+o-1)r=a-o,c=i-o;else if(r=a<l?a:l,c=i>l+o-1?i-o:l-1,c<r)return null;return{...e,startRow:r,endRow:c}}else{const a=e.startCol,i=e.endCol;let r,c;if(i<l)r=a,c=i;else if(a>l+o-1)r=a-o,c=i-o;else if(r=a<l?a:l,c=i>l+o-1?i-o:l-1,c<r)return null;return{...e,startCol:r,endCol:c}}}function Aa(e,n,l,o){if(n==="row"){const a=e.startRow,i=e.endRow;return a>=l?{...e,startRow:a+o,endRow:i+o}:i<l?e:{...e,endRow:i+o}}else{const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+o,endCol:i+o}:i<l?e:{...e,endCol:i+o}}}function I1(e,n,l){var a;const o=l-n+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(d=>Oa(d,"row",n,o)).filter(d=>d!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function O1(e,n,l){var a;const o=l-n+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>Aa(r,"row",n,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function A1(e,n,l){var a;const o=l-n+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(d=>Oa(d,"col",n,o)).filter(d=>d!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function L1(e,n,l){var a;const o=l-n+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>Aa(r,"col",n,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function La(e,n,l,o){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],c=(r.ranges??[]).map(d=>p1(d,n,l,o)).filter(d=>d!==null);c.length===0?e.dataValidations.splice(i,1):r.ranges=c}(a=e.invalidateDataValidationCache)==null||a.call(e)}function _a(e,n,l,o){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>h1(r,n,l,o));(a=e.invalidateDataValidationCache)==null||a.call(e)}function _1(e,n,l,o,a){function i(H,W){const G=W-H+1,ve=nt(H,W),D=[],p=[];for(const ce in e.cells){const Ye=ce.indexOf(",");if(Ye<0)continue;const Xe=parseInt(ce.substring(0,Ye),10),v=parseInt(ce.substring(Ye+1),10);v>=H&&v<=W?p.push(ce):v>W&&D.push({oldKey:ce,newKey:e.cellKey(Xe,v-G),cell:e.cells[ce]})}for(const ce of p)Reflect.deleteProperty(e.cells,ce);for(const ce of D)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const E=e.rowHeights.value,be=new Array(E.length);for(let ce=0;ce<H;ce++)be[ce]=E[ce];for(let ce=H;ce<E.length-G;ce++)be[ce]=E[ce+G];for(let ce=E.length-G;ce<E.length;ce++)be[ce]=void 0;e.rowHeights.value=be,et(ve),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Fa(e.getFilter(),H,W,!1)),I1(e,H,W),La(e,"row",H,G),e.adjustOutlinesForDeleteRows(H,G)}function r(H,W){const G=W-H+1,ve=e.rowCount,D=e.colCount,{lastRow:p}=y();p>=H&&p+G>=ve&&e.ensureCapacity(D-1,ve-1+G);const E=e.rowCount,be=A(H,W),ce=[];for(const v in e.cells){const P=v.indexOf(",");if(P<0)continue;const ue=parseInt(v.substring(0,P),10),Ve=parseInt(v.substring(P+1),10);Ve>=H&&ce.push({oldKey:v,newKey:e.cellKey(ue,Ve+G),cell:e.cells[v],oldRow:Ve})}ce.sort((v,P)=>P.oldRow-v.oldRow);for(const v of ce)Reflect.deleteProperty(e.cells,v.oldKey),e.cells[v.newKey]=v.cell;for(const v in e.cells){const P=v.indexOf(",");if(P<0)continue;const ue=parseInt(v.substring(P+1),10);ue>=H&&ue<=W&&Reflect.deleteProperty(e.cells,v)}const Ye=e.rowHeights.value,Xe=new Array(E);for(let v=0;v<H;v++)Xe[v]=Ye[v];for(let v=H;v<=W;v++)Xe[v]=void 0;for(let v=H;v<E;v++)Xe[v+G]=Ye[v];e.rowHeights.value=Xe,et(be),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Fa(e.getFilter(),H,W,!0)),O1(e,H,W),_a(e,"row",H,G),e.adjustOutlinesForInsertRows(H,G)}function c(H,W){const G=W-H+1,ve=e.colCount,D=e.rowCount,{lastCol:p}=y();p>=H&&p+G>=ve&&e.ensureCapacity(ve-1+G,D-1);const E=e.colCount,be=Q(H,W),ce=[];for(const v in e.cells){const P=v.indexOf(",");if(P<0)continue;const ue=parseInt(v.substring(0,P),10),Ve=parseInt(v.substring(P+1),10);ue>=H&&ce.push({oldKey:v,newKey:e.cellKey(ue+G,Ve),cell:e.cells[v],oldCol:ue})}ce.sort((v,P)=>P.oldCol-v.oldCol);for(const v of ce)Reflect.deleteProperty(e.cells,v.oldKey),e.cells[v.newKey]=v.cell;for(const v in e.cells){const P=v.indexOf(",");if(P<0)continue;const ue=parseInt(v.substring(0,P),10);ue>=H&&ue<=W&&Reflect.deleteProperty(e.cells,v)}const Ye=e.colWidths.value,Xe=new Array(E);for(let v=0;v<H;v++)Xe[v]=Ye[v];for(let v=H;v<=W;v++)Xe[v]=100;for(let v=H;v<E;v++)Xe[v+G]=Ye[v];e.colWidths.value=Xe,et(be),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Ia(e.getFilter(),H,W,!0)),L1(e,H,W),_a(e,"col",H,G),e.adjustOutlinesForInsertCols(H,G)}function d(H,W){const G=W-H+1,ve=F(H,W),D=[],p=[];for(const ce in e.cells){const Ye=ce.indexOf(",");if(Ye<0)continue;const Xe=parseInt(ce.substring(0,Ye),10),v=parseInt(ce.substring(Ye+1),10);Xe>=H&&Xe<=W?p.push(ce):Xe>W&&D.push({oldKey:ce,newKey:e.cellKey(Xe-G,v),cell:e.cells[ce]})}for(const ce of p)Reflect.deleteProperty(e.cells,ce);for(const ce of D)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const E=e.colWidths.value,be=new Array(E.length);for(let ce=0;ce<H;ce++)be[ce]=E[ce];for(let ce=H;ce<E.length-G;ce++)be[ce]=E[ce+G];for(let ce=E.length-G;ce<E.length;ce++)be[ce]=100;e.colWidths.value=be,et(ve),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(Ia(e.getFilter(),H,W,!1)),A1(e,H,W),La(e,"col",H,G),e.adjustOutlinesForDeleteCols(H,G)}function y(){let H=-1,W=-1;for(const G in e.cells){const ve=G.split(",");if(ve.length===2){const D=parseInt(ve[0],10),p=parseInt(ve[1],10),E=e.cells[G];E&&(E.value!==""||E.styleId!==void 0)&&(D>H&&(H=D),p>W&&(W=p))}}for(let G=e.colCount-1;G>=0;G--){const ve=e.colWidths.value[G];if(ve!==void 0&&ve!==100){G>H&&(H=G);break}}for(let G=e.rowCount-1;G>=0;G--)if(e.rowHeights.value[G]!==void 0){G>W&&(W=G);break}return{lastCol:H,lastRow:W}}function g(H,W){const G=e.resolveStyle(e.cells[e.cellKey(H,W)]);return typeof(G==null?void 0:G.numberFormat)=="string"?G.numberFormat:""}function C(H,W,G){for(let ve=W;ve<=G;ve++)if(e.getCellRaw(H,ve).trim()!=="")return!0;return!1}function m(H){const{startRow:W,endRow:G,startCol:ve,endCol:D}=H;let p=ve,E=D;for(;p>0&&C(p-1,W,G);)p--;for(;E<e.colCount-1&&C(E+1,W,G);)E++;return{startRow:W,endRow:G,startCol:p,endCol:E}}function B(H){const W=m(H);return W.startCol!==H.startCol||W.endCol!==H.endCol}function R(H,W,G,ve=H){let D,p;if(G)D=G.startRow,p=G.endRow;else{const v=e.selection.value,P=!!v&&v.startRow===v.endRow&&v.startCol===v.endCol;D=P||!v?0:v.startRow,p=P||!v?e.rowCount-1:v.endRow}let E=-1,be=-1;for(let v=D;v<=p;v++){let P=!1;for(let ue=H;ue<=W;ue++)if(e.getCellRaw(ue,v).trim()!==""){P=!0;break}P&&(E<0&&(E=v),be=v)}if(E<0)return null;const ce=[];for(let v=E;v<=be;v++){const P=e.getCellRaw(ve,v);ce.push(Da(P,g(ve,v),e.locale.value))}const Ye=F1(ce)?E+1:E;let Xe=!1;for(let v=E;v<=be&&!Xe;v++)for(let P=H;P<=W;P++){const ue=e.cells[e.cellKey(P,v)];if(ue&&ue.value.startsWith("=")){Xe=!0;break}}if(!Xe)for(const v in e.merges){const P=e.merges[v];if(P&&P.startCol<=W&&P.endCol>=H&&P.startRow<=p&&P.endRow>=D){Xe=!0;break}}return{firstRow:E,lastRow:be,sortStart:Ye,blocked:Xe}}function I(H,W){const G=R(H,W);return!!G&&!G.blocked&&G.sortStart<G.lastRow}function q(H,W,G){var Ve,Ie;const ve=W??e.selection.value;if(!ve)return;const D=ve.startCol,p=ve.endCol,E=G??D,be=R(D,p,{startRow:ve.startRow,endRow:ve.endRow},E);if(!be||be.blocked||be.sortStart>=be.lastRow)return;const ce=p-D+1,Ye=be.lastRow-be.sortStart+1,Xe=[],v=[];for(let Ee=be.sortStart;Ee<=be.lastRow;Ee++){const Oe=new Array(ce);for(let at=D;at<=p;at++)Oe[at-D]=e.cells[e.cellKey(at,Ee)]??null;Xe.push(Oe);const je=e.getCellRaw(E,Ee);v.push(Da(je,g(E,Ee),e.locale.value))}const P=D1(v,H,e.locale.value);let ue=!1;for(let Ee=0;Ee<Ye;Ee++)if(P[Ee]!==Ee){ue=!0;break}if(ue){n.saveUndo();for(let Ee=0;Ee<Ye;Ee++){const Oe=Xe[P[Ee]],je=be.sortStart+Ee;for(let at=D;at<=p;at++){const Nt=e.cellKey(at,je),Ot=Oe[at-D],xt=Ot?Ot.value:"",Cl=(Ve=e.cells[Nt])==null?void 0:Ve.styleId;xt!==""||Cl!==void 0?e.cells[Nt]={value:xt,styleId:Cl}:e.delCell(Nt)}}mn();for(let Ee=be.sortStart;Ee<=be.lastRow;Ee++)for(let Oe=D;Oe<=p;Oe++)e.formulaDeps.markDirty(e.cellKey(Oe,Ee));(Ie=e.scheduleRender)==null||Ie.call(e),Fe()}}const J=t.ref(!1),ee=t.ref(null);function ne(H){const W=e.selection.value;if(!W||!B(W))return!1;const G=m(W);return ee.value={order:H,originalRange:W,expandedRange:G},J.value=!0,!0}function x(H){const W=ee.value;if(!W)return;const{order:G,originalRange:ve,expandedRange:D}=W;J.value=!1,ee.value=null,q(G,H?D:ve,ve.startCol),fe.value=G}function le(){J.value=!1,ee.value=null}const ge=t.ref(!1),fe=t.ref("asc");function Ce(H){ge.value=H,H&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,n.fontSizeMenuOpen.value=!1)}function $e(H){ne(H)||(fe.value=H,q(H))}function ze(){ne(fe.value)||q(fe.value)}function et(H){Object.keys(e.merges).forEach(W=>Reflect.deleteProperty(e.merges,W));for(const W of H)if(!(W.newRange.startCol>W.newRange.endCol||W.newRange.startRow>W.newRange.endRow)&&(e.merges[W.newAnchorKey]={...W.newRange},W.anchorCell)){const G=W.anchorCell.value,ve=W.anchorCell.styleId;G===""&&!ve||(e.cells[W.newAnchorKey]={value:G,styleId:ve||void 0})}}function nt(H,W){const G=W-H+1,ve=[];for(const D in e.merges){const p=e.merges[D];if(!p)continue;const E=e.cells[D]?{value:e.cells[D].value,styleId:e.cells[D].styleId??0}:{value:"",styleId:0},{startCol:be,endCol:ce}=p;let{startRow:Ye,endRow:Xe}=p;if(Ye>W){Ye-=G,Xe-=G,ve.push({newAnchorKey:e.cellKey(be,Ye),newRange:{startCol:be,startRow:Ye,endCol:ce,endRow:Xe}});continue}if(Xe<H){ve.push({newAnchorKey:D,newRange:{startCol:be,startRow:Ye,endCol:ce,endRow:Xe}});continue}if(Ye>=H&&Xe<=W||(Ye>=H&&Ye<=W&&(Ye=H),Xe>=H&&Xe<=W?Xe=H-1:Xe>W&&(Xe-=G),Ye>Xe))continue;const v=be,P=Ye,ue=e.cellKey(v,P),Ie=D.split(",").map(Number)[1],Ee=Ie>=H&&Ie<=W||v!==p.startCol||P!==Ie;ve.push({newAnchorKey:ue,newRange:{startCol:be,startRow:Ye,endCol:ce,endRow:Xe},anchorCell:Ee?E:void 0})}return ve}function F(H,W){const G=W-H+1,ve=[];for(const D in e.merges){const p=e.merges[D];if(!p)continue;const E=e.cells[D]?{value:e.cells[D].value,styleId:e.cells[D].styleId??0}:{value:"",styleId:0};let{startCol:be,endCol:ce}=p;const{startRow:Ye,endRow:Xe}=p;if(be>W){be-=G,ce-=G,ve.push({newAnchorKey:e.cellKey(be,Ye),newRange:{startCol:be,startRow:Ye,endCol:ce,endRow:Xe}});continue}if(ce<H){ve.push({newAnchorKey:D,newRange:{startCol:be,startRow:Ye,endCol:ce,endRow:Xe}});continue}if(be>=H&&ce<=W||(be>=H&&be<=W&&(be=H),ce>=H&&ce<=W?ce=H-1:ce>W&&(ce-=G),be>ce))continue;const v=be,P=Ye,ue=e.cellKey(v,P),Ie=D.split(",").map(Number)[0],Ee=Ie>=H&&Ie<=W||v!==Ie||P!==p.startRow;ve.push({newAnchorKey:ue,newRange:{startCol:be,startRow:Ye,endCol:ce,endRow:Xe},anchorCell:Ee?E:void 0})}return ve}function A(H,W){const G=W-H+1,ve=[];for(const D in e.merges){const p=e.merges[D];if(!p)continue;const{startCol:E,endCol:be}=p;let{startRow:ce,endRow:Ye}=p;Ye<H?ve.push({newAnchorKey:D,newRange:{startCol:E,startRow:ce,endCol:be,endRow:Ye}}):ce>W?(ce+=G,Ye+=G,ve.push({newAnchorKey:e.cellKey(E,ce),newRange:{startCol:E,startRow:ce,endCol:be,endRow:Ye}})):(Ye+=G,ve.push({newAnchorKey:D,newRange:{startCol:E,startRow:ce,endCol:be,endRow:Ye}}))}return ve}function Q(H,W){const G=W-H+1,ve=[];for(const D in e.merges){const p=e.merges[D];if(!p)continue;let{startCol:E,endCol:be}=p;const{startRow:ce,endRow:Ye}=p;be<H?ve.push({newAnchorKey:D,newRange:{startCol:E,startRow:ce,endCol:be,endRow:Ye}}):E>W?(E+=G,be+=G,ve.push({newAnchorKey:e.cellKey(E,ce),newRange:{startCol:E,startRow:ce,endCol:be,endRow:Ye}})):(be+=G,ve.push({newAnchorKey:D,newRange:{startCol:E,startRow:ce,endCol:be,endRow:Ye}}))}return ve}let we=0;function xe(){return we++,`s_${we}`}function X(H){if(!Array.isArray(H))return[];const W=[];for(const G of H){if(!G||typeof G!="object")continue;const ve=G;if(!ve.type||!Array.isArray(ve.ranges)||ve.ranges.length===0)continue;const D=ve.ranges.filter(p=>!!p&&typeof p.startCol=="number"&&typeof p.startRow=="number"&&typeof p.endCol=="number"&&typeof p.endRow=="number").map(p=>({startCol:Math.min(p.startCol,p.endCol),endCol:Math.max(p.startCol,p.endCol),startRow:Math.min(p.startRow,p.endRow),endRow:Math.max(p.startRow,p.endRow)}));D.length&&W.push({...ve,id:ve.id||`dv_${W.length}`,ranges:D})}return W}function Ne(H,W){const G=Math.max(1,(W==null?void 0:W.colCount)??e.colCount),ve=Math.max(1,(W==null?void 0:W.rowCount)??e.rowCount),D=new Array(G).fill(100),p=new Array(ve).fill(void 0);return{id:xe(),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:D,rowHeights:p,colCount:G,rowCount:ve,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[]}}const me=t.ref([Ne("Sheet1")]),Me=t.ref(0);function T(){const H=me.value[Me.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],H.colCount=e.colCount,H.rowCount=e.rowCount,H.freeze={rows:e.freeze.rows,cols:e.freeze.cols},H.filter=ur(e.getFilter()),H.conditionalFormats=[...e.conditionalFormats],H.dataValidations=[...e.dataValidations],H.rowOutlines=e.getRowOutlines(),H.columnOutlines=e.getColumnOutlines())}function se(H){var Ye,Xe,v;const W=me.value[H];if(!W)return;Object.keys(e.cells).forEach(P=>e.delCell(P)),Object.assign(e.cells,W.cells),Object.keys(e.merges).forEach(P=>Reflect.deleteProperty(e.merges,P)),W.merges&&Object.assign(e.merges,W.merges),e.selection.value=W.selection?{...W.selection}:null,e.activeCell.value={...W.activeCell};const G=e.activeCell.value,ve=e.selection.value,D=e.findMerge(G.col,G.row);D&&D.anchor===e.cellKey(G.col,G.row)&&(!ve||ve.startCol===G.col&&ve.startRow===G.row&&ve.endCol===G.col&&ve.endRow===G.row)&&e.selectCell(G.col,G.row),e.scrollX.value=W.scrollX,e.scrollY.value=W.scrollY,e.colWidths.value=[...W.colWidths],e.rowHeights.value=[...W.rowHeights];const p=Math.max(1,W.colCount??e.colCount),E=Math.max(1,W.rowCount??e.rowCount);if((Ye=e.setDims)==null||Ye.call(e,p,E),e.freeze.rows=Math.max(0,Math.min(W.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(W.freeze.cols,e.colCount)),W.filter){const P=W.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(P.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(P.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(P.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(P.endRow,e.rowCount-1))},columns:{...W.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(W.styles),e.syncBorders(W.borders??[{}]);const be=W.conditionalFormats?W.conditionalFormats.map(P=>({...P,ranges:P.ranges.map(ue=>({...ue}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...be),(Xe=e.invalidateConditionalFormatCache)==null||Xe.call(e);const ce=X(W.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...ce),(v=e.invalidateDataValidationCache)==null||v.call(e),e.syncOutlines(W.rowOutlines,W.columnOutlines),Me.value=H}function ie(H){H===Me.value||H<0||H>=me.value.length||(e.cancelEdit(),T(),se(H))}function re(H){return n.saveUndo(),e.cancelEdit(),T(),me.value.push(Ne(H??`Sheet${me.value.length+1}`)),se(me.value.length-1),me.value.length-1}function K(H){return me.value.length<=1||(n.saveUndo(),e.cancelEdit(),me.value.splice(H,1),se(Math.min(H,me.value.length-1))),Me.value}function $(H,W){me.value[H]&&W.trim()&&(n.saveUndo(),me.value[H].name=W.trim())}function de(H){n.saveUndo(),e.cancelEdit(),T();const W=me.value[H];if(!W)return H;let G=W.name;const ve=G.match(/^(.*?)\s*\((\d+)\)$/);let D=ve?parseInt(ve[2],10)+1:2;ve&&(G=ve[1]);let p=`${G} (${D})`;const E=new Set(me.value.map(ce=>ce.name));for(;E.has(p);)D++,p=`${G} (${D})`;const be={id:xe(),name:p,cells:{...W.cells},merges:W.merges?{...W.merges}:{},styles:[...W.styles],borders:W.borders?[...W.borders]:[{}],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],colCount:W.colCount,rowCount:W.rowCount,freeze:{...W.freeze},filter:ur(W.filter),conditionalFormats:W.conditionalFormats?W.conditionalFormats.map(ce=>({...ce})):[],dataValidations:X(W.dataValidations),rowOutlines:W.rowOutlines?W.rowOutlines.map(ce=>({...ce})):[],columnOutlines:W.columnOutlines?W.columnOutlines.map(ce=>({...ce})):[]};return me.value.splice(H+1,0,be),se(H+1),H+1}function z(H,W){var p;const G=H+W;if(G<0||G>=me.value.length)return;n.saveUndo();const ve=Me.value,D=me.value.splice(H,1)[0];me.value.splice(G,0,D),ve===H?Me.value=G:H<ve&&G>=ve?Me.value=ve-1:H>ve&&G<=ve&&(Me.value=ve+1),(p=e.scheduleRender)==null||p.call(e)}const _=t.computed(()=>me.value.length);let ae="";const Ke=l;function Fe(){T();const H=me.value.map(G=>{const ve={};for(const[be,ce]of Object.entries(G.cells))ve[be]={value:ce.value},ce.styleId&&ce.styleId>0&&(ve[be].styleId=ce.styleId);const D={name:G.name,cells:ve};G.styles&&G.styles.length>1&&(D.styles=[...G.styles]),G.borders&&G.borders.length>1&&(D.borders=[...G.borders]),G.merges&&Object.keys(G.merges).length&&(D.merges={...G.merges});const p={};for(let be=0;be<G.colWidths.length;be++)G.colWidths[be]!==100&&(p[be]=G.colWidths[be]);Object.keys(p).length&&(D.colWidths=p);const E={};for(let be=0;be<G.rowHeights.length;be++){const ce=G.rowHeights[be];ce!=null&&(E[be]=ce)}return Object.keys(E).length&&(D.rowHeights=E),G.colCount!==26&&(D.colCount=G.colCount),G.rowCount!==200&&(D.rowCount=G.rowCount),(G.freeze.rows!==0||G.freeze.cols!==0)&&(D.freeze={rows:G.freeze.rows,cols:G.freeze.cols}),G.filter&&(D.filter=ur(G.filter)),G.conditionalFormats&&G.conditionalFormats.length&&(D.conditionalFormats=G.conditionalFormats.map(be=>({...be}))),G.dataValidations&&G.dataValidations.length&&(D.dataValidations=G.dataValidations.map(be=>({...be,ranges:be.ranges.map(ce=>({...ce}))}))),G.rowOutlines&&G.rowOutlines.length&&(D.rowOutlines=G.rowOutlines.map(be=>({...be}))),G.columnOutlines&&G.columnOutlines.length&&(D.columnOutlines=G.columnOutlines.map(be=>({...be}))),D}),W=JSON.stringify(H);W!==ae&&(ae=W,Ke.value=H,a&&(a.value=W))}e.emitModelData=Fe;let Le=!1;function Be(){Le||(Le=!0,Promise.resolve().then(()=>{Le=!1,Fe()}))}const qe=t.computed(()=>e.props.theme==="dark"?ni:li),Je=t.computed(()=>T1(qe.value,e.props.width,e.props.height,En)),Te=t.computed(()=>{const H={};for(const[W,G]of Object.entries(Je.value))W.startsWith("--")&&(H[W]=G);return H}),dt=t.ref(null),ft=t.ref(null),Ue=t.ref(null),N=t.ref(null),pe=t.ref(null),Ct=t.reactive({w:800,h:600});e.viewSize&&t.watch(Ct,H=>{e.viewSize&&(e.viewSize.w=H.w,e.viewSize.h=H.h)},{deep:!0});const qt=48,Kt=28,zt=11,Rt=()=>qt+e.getOutlineGutterSize("row"),Ut=()=>Kt+e.getOutlineGutterSize("column"),nl=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Ct.w-Rt()-zt))),bl=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Ct.h-Ut()-zt)));function dl(H,W){const G=Math.max(0,Ct.w-Rt()-zt),ve=Math.max(0,Ct.h-Ut()-zt),D=H??e.scrollX.value,p=W??e.scrollY.value,E=40,be=Math.max(0,e.totalWidth.value-G),ce=Math.max(0,e.totalHeight.value-ve);if(D>=be-E&&D>e.scrollX.value||p>=ce-E&&p>e.scrollY.value){const Ye=Math.max(0,Math.ceil((D+G)/100)+2),Xe=Math.max(0,Math.ceil((p+ve)/24)+2);e.ensureCapacity(Ye,Xe)}e.scrollX.value=Math.max(0,Math.min(D,Math.max(0,e.totalWidth.value-G))),e.scrollY.value=Math.max(0,Math.min(p,Math.max(0,e.totalHeight.value-ve)))}e.clampScroll=dl;function yl(){var H;return typeof window>"u"?!1:!((H=window.matchMedia)!=null&&H.call(window,"(hover: none) and (pointer: coarse)").matches)}function Gt(H=!1){t.nextTick(()=>{const W=N.value;if(W){if(!e.editingCell.value&&!yl()){document.activeElement===W&&W.blur();return}W.focus({preventScroll:!0}),H&&W.select()}})}function ol(){Gt()}function wl(){var W;const H=e.selection.value;if(H){n.saveUndo();for(let G=H.startRow;G<=H.endRow;G++)e.rowHeights.value[G]=void 0;(W=e.scheduleRender)==null||W.call(e),Fe()}}function xl(){var W;const H=e.selection.value;if(H){n.saveUndo();for(let G=H.startCol;G<=H.endCol;G++)e.colWidths.value[G]=100;(W=e.scheduleRender)==null||W.call(e),Fe()}}return{deleteRows:i,insertRows:r,insertCols:c,deleteCols:d,sortSelectedColumns:q,canSortColumns:I,sortMenuOpen:ge,cachedSortOrder:fe,onSortMenuToggle:Ce,onSortChange:$e,applyCachedSort:ze,sortConfirmOpen:J,prepareSortConfirmation:ne,confirmSort:x,cancelSortConfirmation:le,sheets:me,activeSheetIndex:Me,saveSheet:T,loadSheet:se,switchSheet:ie,addSheet:re,removeSheet:K,renameSheet:$,dupSheet:de,moveSheet:z,sheetCount:_,mkSheet:Ne,emitModelData:Fe,scheduleOptEmit:Be,themeColors:qe,outerStyle:Je,toolbarThemeVars:Te,wrapperRef:dt,canvasRef:ft,freezeCanvasRef:Ue,editInputRef:N,formulaBarRef:pe,viewSize:Ct,maxScrollX:nl,maxScrollY:bl,clampScroll:dl,canFocusHiddenEditor:yl,focusEditInput:Gt,onCanvasFocus:ol,resetRowHeight:wl,resetColWidth:xl,modelData:Ke}}function $a(e){return!!e&&e.width!==void 0&&e.width>0}function It(e,n,l,o){const a=$a(e),i=$a(n);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return n;const r=e.width??0,c=n.width??0;return r>c?e:c>r?n:e}function za(e,n){if(!e||typeof e!="object")return null;const l=e,o=l.columns??{},a=Object.keys(o).map(r=>Number(r)).filter(r=>!Number.isNaN(r));if(!l.range||typeof l.range.startRow!="number"){const r=a.length?Math.min(...a):0,c=a.length?Math.max(...a):0;let d=0;for(const y in n){const g=y.indexOf(",");if(g<0)continue;const C=parseInt(y.substring(g+1),10);C>d&&(d=C)}return{range:{startCol:r,startRow:0,endCol:c,endRow:Math.max(0,d)},columns:o}}const i={...l.range};for(const r of a)r<i.startCol&&(i.startCol=r),r>i.endCol&&(i.endCol=r);return{range:i,columns:o}}function $1(e,n,l,o,a){let i=!1,r=null,c=1,d,y=()=>{},g=()=>{},C=()=>{};function m(){i||(i=!0,requestAnimationFrame(()=>{i=!1,F(),A()}))}e.scheduleRender=m;function B(u){const{frozenColumnsWidth:w}=e.getFrozenMetrics(),V=w>0&&u<fe()+w?u-fe():u-fe()+e.scrollX.value;return e.hitCol(V)}function R(u){const{frozenRowsHeight:w}=e.getFrozenMetrics(),V=w>0&&u<Ce()+w?u-Ce():u-Ce()+e.scrollY.value;return e.hitRow(V)}const I="#444",q=14,J=9,ee=16,ne=Math.min(J-1,9);function x(u){return 0}const le=()=>x(),ge=()=>x(),fe=()=>52+le(),Ce=()=>24+ge();function $e(){const u=e.getRowOutlines(),w=e.getColumnOutlines();if(!u.length&&!w.length)return 0;let V=0,U=0;for(const M of u)M.level>V&&(V=M.level),M.collapsed&&M.level>U&&(U=M.level);for(const M of w)M.level>V&&(V=M.level),M.collapsed&&M.level>U&&(U=M.level);return U>0?U:V}function ze(u,w){return ee+2+(w-u.level)*J}function et(u,w){return 3+(w-u.level)*J}function nt(u,w){const V=new Int8Array(w).fill(-1);if(!u.length)return V;const U=[...u].sort((Y,j)=>Y.start-j.start),M=new Map;U.forEach((Y,j)=>M.set(Y.id,j%2));for(const Y of U){const j=M.get(Y.id),Z=Math.min(Y.end,w-1);for(let oe=Math.max(0,Y.start);oe<=Z;oe++)V[oe]===-1&&(V[oe]=j)}return V}function F(){const u=o.wrapperRef.value,w=o.canvasRef.value;if(!u||!w||(r=w.getContext("2d"),!r))return;c=window.devicePixelRatio||1;const V=u.getBoundingClientRect(),U=V.width,M=V.height;o.viewSize.w=U,o.viewSize.h=M,w.width=U*c,w.height=M*c,w.style.width=U+"px",w.style.height=M+"px",r.setTransform(c,0,0,c,0,0);const Y=e.scrollX.value,j=e.scrollY.value,Z=52,oe=24,S=le(),s=ge(),f=Z+S,h=oe+s,k=o.themeColors.value,O=e.getFilter(),te=e.colPositions.value,he=e.rowPositions.value,ke=nt(e.getRowOutlines(),e.rowCount),Re=nt(e.getColumnOutlines(),e.colCount),{frozenRowsHeight:_e,frozenColumnsWidth:He}=e.getFrozenMetrics(),Qe=f+He,Ge=h+_e,st=Math.max(0,U-f-11-He),yt=Math.max(0,M-h-11-_e),el=Math.max(0,e.freeze.cols-1),Dt=Math.max(0,e.freeze.rows-1),Wt=Math.max(e.freeze.cols,e.hitCol(He+Y));let Yt=Wt;for(let L=Wt;L<e.colCount&&!(f+te[L]-Y>=U);L++)Yt=L;const tl=Math.max(e.freeze.rows,e.hitRow(_e+j));let jl=tl;for(let L=tl;L<e.rowCount&&!(h+he[L]-j>=M);L++)jl=L;let sl=Wt,Xt=Yt,Il=tl,ul=jl;He>0&&(sl=0,Xt=Math.max(Xt,el)),_e>0&&(Il=0,ul=Math.max(ul,Dt));let xn=sl,Ol=Il;for(const L in e.merges){const De=e.merges[L];De&&(De.startRow>ul||De.endRow<Il||De.startCol>Xt||De.endCol<sl||(De.startCol<xn&&(xn=De.startCol),De.startRow<Ol&&(Ol=De.startRow)))}const Tn=new Array(Ol);for(let L=Ol;L<=ul;L++)Tn[L]=he[L+1]-he[L];r.fillStyle=k.bg,r.fillRect(0,0,U,M),r.fillStyle=k.gridBg,r.fillRect(f,h,U-f,M-h);const Et=e.selection.value,ht=e.editingCell.value;y=(L,De,We,bt,St,Mt)=>{const wt=e.dataValidations.length>0;for(let Ae=bt;Ae<=St;Ae++)if(!e.isRowCollapsed(Ae))for(let Ze=De;Ze<=We;Ze++){if(e.isColumnCollapsed(Ze)||e.findMerge(Ze,Ae))continue;const ot=e.cellToScreenRect(Ae,Ze),tt=ot.x,pt=ot.y,ct=ot.width,lt=ot.height;if(tt+ct<f||pt+lt<h||tt>U||pt>M)continue;const Tt=e.findHighlight?e.findHighlight(Ze,Ae):null,Ft=e.resolveStyle(e.cells[e.cellKey(Ze,Ae)]),ut=typeof(Ft==null?void 0:Ft.backgroundColor)=="string"?Ft.backgroundColor:"";ut&&(L.fillStyle=ut,L.fillRect(tt,pt,ct,lt));const ye=e.resolveConditionalFormat(Ze,Ae);if(ye!=null&&ye.backgroundColor&&(L.fillStyle=ye.backgroundColor,L.fillRect(tt,pt,ct,lt)),Tt&&(L.fillStyle=Tt==="active"?k.findActiveBg:k.findMatchBg,L.fillRect(tt,pt,ct,lt)),e.isSelected(Ze,Ae)&&(L.fillStyle=k.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?L.fillRect(tt,pt,(te[Ze+1]??0)-te[Ze],Mt[Ae]):L.fillRect(tt,pt,ct,lt)),e.activeCell.value.col===Ze&&e.activeCell.value.row===Ae&&(L.strokeStyle=k.activeCellBorder,L.lineWidth=2,L.strokeRect(tt+1,pt+1,ct-2,lt-2)),Tt==="active"&&(L.strokeStyle=k.findActiveBg,L.lineWidth=2,L.strokeRect(tt+1,pt+1,ct-2,lt-2)),L.strokeStyle=k.gridLine,L.lineWidth=.5,L.strokeRect(tt+.25,pt+.25,ct-.5,lt-.5),!(ht&&ht.col===Ze&&ht.row===Ae)){const Se=e.resolveStyle(e.cells[e.cellKey(Ze,Ae)]),Pe=e.getCellValue(Ze,Ae),it=typeof(Se==null?void 0:Se.numberFormat)=="string"?Se.numberFormat:"",Bt=Pe?Ml(Pe,it,e.locale.value):"";if(Bt){const Lt=e.cellFontSize(Ze,Ae),Pt=typeof(Se==null?void 0:Se.fontFamily)=="string"&&Se.fontFamily?Se.fontFamily:kn,Zl=(Se==null?void 0:Se.fontWeight)==="bold"||(ye==null?void 0:ye.fontWeight)==="bold"?"bold":"normal",$l=(Se==null?void 0:Se.fontStyle)==="italic"||(ye==null?void 0:ye.fontStyle)==="italic"?"italic":"normal",Cn=(Se==null?void 0:Se.underline)==="underline"||(ye==null?void 0:ye.underline)==="underline",Dn=(Se==null?void 0:Se.strikethrough)==="line-through"||(ye==null?void 0:ye.strikethrough)==="line-through",zl=(ye==null?void 0:ye.color)||(typeof(Se==null?void 0:Se.color)=="string"?Se.color:""),Hl=typeof(Se==null?void 0:Se.textAlign)=="string"?Se.textAlign:Ko(Pe,it)?"right":"left",jn=typeof(Se==null?void 0:Se.verticalAlign)=="string"?Se.verticalAlign:"top";L.fillStyle=zl||k.cellText,L.font=`${$l} ${Zl} ${Lt}px ${Pt}`,L.textBaseline="alphabetic",L.save(),L.beginPath(),L.rect(tt+5,pt+1,ct-10,lt-2),L.clip();const sn=(Se==null?void 0:Se.wrap)==="wrap";let ll=ct-10;O&&Ae===O.range.startRow&&Ze>=O.range.startCol&&Ze<=O.range.endCol&&(ll=ct-10-ft);let Wl=Bt;const fl=!sn&&_r(it),cn=Bt===po||$r(Pe,it);if(cn||fl){if(cn){const In=Math.max(1,L.measureText("#").width),mo=Math.max(1,Math.floor(ll/In));Wl="#".repeat(mo)}else if(e.getWrappedLines(L,Bt,1e9,!1).some(dn=>dn&&L.measureText(dn).width>ll)){const dn=Math.max(1,L.measureText("#").width),Zn=Math.max(1,Math.floor(ll/dn));Wl="#".repeat(Zn)}}const ml=e.getWrappedLines(L,Wl,ll,sn),{ascent:Fn,descent:$o}=e.measureFontMetrics(Pt,Lt,Zl,$l),zo=Fn+$o,dp=ml.length*zo;let Ho;jn==="middle"?Ho=pt+(lt-dp)/2+Fn:jn==="bottom"?Ho=pt+lt-e.BASE_CELL_VPAD-$o-(ml.length-1)*zo:Ho=pt+e.BASE_CELL_VPAD+Fn;for(let In=0;In<ml.length;In++){const mo=ml[In],dn=Ho+In*zo,Zn=L.measureText(mo);let vn;if(Hl==="center"?vn=tt+ct/2-Zn.width/2:Hl==="right"?vn=tt+ct-5-Zn.width:vn=tt+5,L.fillText(mo,vn,dn),Cn&&(L.strokeStyle=zl||k.cellText,L.lineWidth=1,L.beginPath(),L.moveTo(vn,dn+$o+1),L.lineTo(vn+Zn.width,dn+$o+1),L.stroke()),Dn){L.strokeStyle=zl||k.cellText,L.lineWidth=1;const Pa=dn-Fn+zo*.42;L.beginPath(),L.moveTo(vn,Pa),L.lineTo(vn+Zn.width,Pa),L.stroke()}}L.restore()}}if(O&&Ae===O.range.startRow&&Ze>=O.range.startCol&&Ze<=O.range.endCol&&nl(L,tt,pt,ct,lt,na(O.columns[Ze]),k),wt&&e.getListValidation(Ae,Ze)){const Se=e.activeCell.value.col===Ze&&e.activeCell.value.row===Ae;qt(L,tt,pt,ct,lt,Se||e.isSelected(Ze,Ae),k)}}};const gt=(L,De,We)=>{const bt=e.findMerge(L,De);return bt?e.getCellBorderSide(e.cells[bt.anchor],We):e.getCellBorderSide(e.cells[e.cellKey(L,De)],We)};g=(L,De,We,bt,St,Mt)=>{L.fillStyle=I;for(let wt=bt;wt<=St;wt++)if(!e.isRowCollapsed(wt))for(let Ae=De;Ae<=We;Ae++){if(e.isColumnCollapsed(Ae)||e.findMerge(Ae,wt))continue;const mt=e.cellToScreenRect(wt,Ae),ot=mt.x,tt=mt.y,pt=mt.width,ct=mt.height;if(ot+pt<f||tt+ct<h||ot>U||tt>M)continue;const lt=e.cells[e.cellKey(Ae,wt)],Tt={top:e.getCellBorderSide(lt,"top"),right:e.getCellBorderSide(lt,"right"),bottom:e.getCellBorderSide(lt,"bottom"),left:e.getCellBorderSide(lt,"left")},Ft={top:gt(Ae,wt-1,"bottom"),left:gt(Ae-1,wt,"right"),bottom:gt(Ae,wt+1,"top"),right:gt(Ae+1,wt,"left")},ut=It(Ft.top,Tt.top),ye=It(Ft.left,Tt.left),Se=It(Tt.bottom,Ft.bottom),Pe=It(Tt.right,Ft.right),it=(ut==null?void 0:ut.width)??0,Bt=(ye==null?void 0:ye.width)??0,Lt=(Se==null?void 0:Se.width)??0,Pt=(Pe==null?void 0:Pe.width)??0;it>0&&(L.fillStyle=(ut==null?void 0:ut.color)||I,L.fillRect(ot,tt,pt,it)),Lt>0&&(L.fillStyle=(Se==null?void 0:Se.color)||I,L.fillRect(ot,tt+ct-Lt,pt,Lt)),Bt>0&&(L.fillStyle=(ye==null?void 0:ye.color)||I,L.fillRect(ot,tt,Bt,ct)),Pt>0&&(L.fillStyle=(Pe==null?void 0:Pe.color)||I,L.fillRect(ot+pt-Pt,tt,Pt,ct)),it>0&&Bt>0&&(L.fillStyle=(ut==null?void 0:ut.color)||(ye==null?void 0:ye.color)||I,L.fillRect(ot-Bt,tt-it,Bt,it)),it>0&&Pt>0&&(L.fillStyle=(ut==null?void 0:ut.color)||(Pe==null?void 0:Pe.color)||I,L.fillRect(ot+pt,tt-it,Pt,it)),Lt>0&&Bt>0&&(L.fillStyle=(Se==null?void 0:Se.color)||(ye==null?void 0:ye.color)||I,L.fillRect(ot-Bt,tt+ct,Bt,Lt)),Lt>0&&Pt>0&&(L.fillStyle=(Se==null?void 0:Se.color)||(Pe==null?void 0:Pe.color)||I,L.fillRect(ot+pt,tt+ct,Pt,Lt))}};const Al=(L,De,We,bt,St,Mt,wt)=>{const Ae=e.resolveStyle(e.cells[e.cellKey(De,We)]),Ze=e.getCellValue(De,We),mt=typeof(Ae==null?void 0:Ae.numberFormat)=="string"?Ae.numberFormat:"",ot=Ze?Ml(Ze,mt,e.locale.value):"";if(!ot||bt-10<=0||St-2<=0)return;const pt=e.cellFontSize(De,We),ct=typeof(Ae==null?void 0:Ae.fontFamily)=="string"&&Ae.fontFamily?Ae.fontFamily:kn,lt=e.resolveConditionalFormat(De,We),Tt=(Ae==null?void 0:Ae.fontWeight)==="bold"||(lt==null?void 0:lt.fontWeight)==="bold"?"bold":"normal",Ft=(Ae==null?void 0:Ae.fontStyle)==="italic"||(lt==null?void 0:lt.fontStyle)==="italic"?"italic":"normal",ut=(Ae==null?void 0:Ae.underline)==="underline"||(lt==null?void 0:lt.underline)==="underline",ye=(Ae==null?void 0:Ae.strikethrough)==="line-through"||(lt==null?void 0:lt.strikethrough)==="line-through",Se=(lt==null?void 0:lt.color)||(typeof(Ae==null?void 0:Ae.color)=="string"?Ae.color:""),Pe=typeof(Ae==null?void 0:Ae.textAlign)=="string"?Ae.textAlign:Ko(Ze,mt)?"right":"left",it=typeof(Ae==null?void 0:Ae.verticalAlign)=="string"?Ae.verticalAlign:"top";L.fillStyle=Se||k.cellText,L.font=`${Ft} ${Tt} ${pt}px ${ct}`,L.textBaseline="alphabetic",L.save(),L.beginPath(),L.rect(Mt+5,wt+1,bt-10,St-2),L.clip();const Bt=(Ae==null?void 0:Ae.wrap)==="wrap",Lt=bt-10;let Pt=ot;const Zl=!Bt&&_r(mt),$l=ot===po||$r(Ze,mt);if($l||Zl){if($l){const ll=Math.max(1,L.measureText("#").width),Wl=Math.max(1,Math.floor(Lt/ll));Pt="#".repeat(Wl)}else if(e.getWrappedLines(L,ot,1e9,!1).some(fl=>fl&&L.measureText(fl).width>Lt)){const fl=Math.max(1,L.measureText("#").width),cn=Math.max(1,Math.floor(Lt/fl));Pt="#".repeat(cn)}}const Cn=e.getWrappedLines(L,Pt,Lt,Bt),{ascent:Dn,descent:zl}=e.measureFontMetrics(ct,pt,Tt,Ft),Hl=Dn+zl,jn=Cn.length*Hl;let sn;it==="middle"?sn=wt+(St-jn)/2+Dn:it==="bottom"?sn=wt+St-e.BASE_CELL_VPAD-zl-(Cn.length-1)*Hl:sn=wt+e.BASE_CELL_VPAD+Dn;for(let ll=0;ll<Cn.length;ll++){const Wl=Cn[ll],fl=sn+ll*Hl,cn=L.measureText(Wl);let ml;if(Pe==="center"?ml=Mt+bt/2-cn.width/2:Pe==="right"?ml=Mt+bt-5-cn.width:ml=Mt+5,L.fillText(Wl,ml,fl),ut&&(L.strokeStyle=Se||k.cellText,L.lineWidth=1,L.beginPath(),L.moveTo(ml,fl+zl+1),L.lineTo(ml+cn.width,fl+zl+1),L.stroke()),ye){L.strokeStyle=Se||k.cellText,L.lineWidth=1;const Fn=fl-Dn+Hl*.42;L.beginPath(),L.moveTo(ml,Fn),L.lineTo(ml+cn.width,Fn),L.stroke()}}L.restore()},Ll=(L,De,We,bt,St,Mt,wt,Ae)=>{const Ze=De.startCol,mt=De.endCol,ot=De.startRow,tt=De.endRow,pt=bt,ct=Mt,lt=wt&&mt>=e.freeze.cols,Tt=Ae&&tt>=e.freeze.rows,Ft=e.cells[e.cellKey(Ze,ot)],ut={top:e.getCellBorderSide(Ft,"top"),right:e.getCellBorderSide(Ft,"right"),bottom:e.getCellBorderSide(Ft,"bottom"),left:e.getCellBorderSide(Ft,"left")};L.fillStyle=I;for(let ye=Ze;ye<=mt;ye++){if(wt&&ye>=e.freeze.cols||e.isSameMergeInternal(ye,ot-1,ye,ot))continue;const Se=gt(ye,ot-1,"bottom"),Pe=It(Se,ut.top);if(Pe&&Pe.width&&Pe.width>0){const it=ye<e.freeze.cols?Z+te[ye]:Z+te[ye]-Y;L.fillStyle=Pe.color||I,L.fillRect(it,pt,(te[ye+1]??0)-te[ye],Pe.width)}}if(!Tt)for(let ye=Ze;ye<=mt;ye++){if(wt&&ye>=e.freeze.cols||e.isSameMergeInternal(ye,tt,ye,tt+1))continue;const Se=gt(ye,tt+1,"top"),Pe=It(ut.bottom,Se);if(Pe&&Pe.width&&Pe.width>0){const it=ye<e.freeze.cols?Z+te[ye]:Z+te[ye]-Y;L.fillStyle=Pe.color||I,L.fillRect(it,pt+ct-Pe.width,(te[ye+1]??0)-te[ye],Pe.width)}}for(let ye=ot;ye<=tt;ye++){if(Ae&&ye>=e.freeze.rows||e.isSameMergeInternal(Ze-1,ye,Ze,ye))continue;const Se=gt(Ze-1,ye,"right"),Pe=It(Se,ut.left);if(Pe&&Pe.width&&Pe.width>0){const it=ye<e.freeze.rows?oe+he[ye]:oe+he[ye]-j,Bt=he[ye+1]-he[ye];L.fillStyle=Pe.color||I,L.fillRect(We,it,Pe.width,Bt)}}if(!lt)for(let ye=ot;ye<=tt;ye++){if(Ae&&ye>=e.freeze.rows||e.isSameMergeInternal(mt,ye,mt+1,ye))continue;const Se=gt(mt+1,ye,"left"),Pe=It(ut.right,Se);if(Pe&&Pe.width&&Pe.width>0){const it=ye<e.freeze.rows?oe+he[ye]:oe+he[ye]-j,Bt=he[ye+1]-he[ye];L.fillStyle=Pe.color||I,L.fillRect(We+St-Pe.width,it,Pe.width,Bt)}}{const ye=e.isSameMergeInternal(Ze,ot-1,Ze,ot)?ut.top:It(gt(Ze,ot-1,"bottom"),ut.top),Se=e.isSameMergeInternal(Ze-1,ot,Ze,ot)?ut.left:It(gt(Ze-1,ot,"right"),ut.left),Pe=(ye==null?void 0:ye.width)??0,it=(Se==null?void 0:Se.width)??0;Pe>0&&it>0&&(L.fillStyle=(ye==null?void 0:ye.color)||(Se==null?void 0:Se.color)||I,L.fillRect(We-it,bt-Pe,it,Pe))}if(!lt){const ye=e.isSameMergeInternal(mt,ot-1,mt,ot)?ut.top:It(gt(mt,ot-1,"bottom"),ut.top),Se=e.isSameMergeInternal(mt,ot,mt+1,ot)?ut.right:It(ut.right,gt(mt+1,ot,"left")),Pe=(ye==null?void 0:ye.width)??0,it=(Se==null?void 0:Se.width)??0;Pe>0&&it>0&&(L.fillStyle=(ye==null?void 0:ye.color)||(Se==null?void 0:Se.color)||I,L.fillRect(We+St,bt-Pe,it,Pe))}if(!Tt){const ye=e.isSameMergeInternal(Ze,tt,Ze,tt+1)?ut.bottom:It(ut.bottom,gt(Ze,tt+1,"top")),Se=e.isSameMergeInternal(Ze-1,tt,Ze,tt)?ut.left:It(gt(Ze-1,tt,"right"),ut.left),Pe=(ye==null?void 0:ye.width)??0,it=(Se==null?void 0:Se.width)??0;Pe>0&&it>0&&(L.fillStyle=(ye==null?void 0:ye.color)||(Se==null?void 0:Se.color)||I,L.fillRect(We-it,bt+Mt,it,Pe))}if(!lt&&!Tt){const ye=e.isSameMergeInternal(mt,tt,mt,tt+1)?ut.bottom:It(ut.bottom,gt(mt,tt+1,"top")),Se=e.isSameMergeInternal(mt,tt,mt+1,tt)?ut.right:It(ut.right,gt(mt+1,tt,"left")),Pe=(ye==null?void 0:ye.width)??0,it=(Se==null?void 0:Se.width)??0;Pe>0&&it>0&&(L.fillStyle=(ye==null?void 0:ye.color)||(Se==null?void 0:Se.color)||I,L.fillRect(We+St,bt+Mt,it,Pe))}};C=(L,De,We,bt,St)=>{var mt,ot;const Mt=De+bt,wt=We+St,Ae=De<Qe,Ze=We<Ge;for(const tt in e.merges){const pt=e.merges[tt];if(!pt)continue;const ct=pt.startCol,lt=pt.startRow,Tt=pt.endCol,Ft=pt.endRow,ut=e.cellToScreenRect(lt,ct),ye=e.cellToScreenRect(Ft,Tt),Se=ut.x,Pe=ut.y,it=ye.x+ye.width-Se,Bt=ye.y+ye.height-Pe,Lt=Ae&&Tt>=e.freeze.cols?Math.min(Mt,Qe):Math.min(Se+it,Mt),Pt=Ze&&Ft>=e.freeze.rows?Math.min(wt,Ge):Math.min(Pe+Bt,wt),Zl=Math.max(Se,De),$l=Math.max(Pe,We);if(Lt<=Zl||Pt<=$l)continue;const Cn=(mt=e.resolveStyle(e.cells[e.cellKey(ct,lt)]))==null?void 0:mt.backgroundColor,zl=((ot=e.resolveConditionalFormat(ct,lt))==null?void 0:ot.backgroundColor)||Cn;if(zl&&(L.fillStyle=zl,L.fillRect(Zl,$l,Lt-Zl,Pt-$l)),e.isSelected(ct,lt)&&(L.fillStyle=k.selectionBg,L.fillRect(Zl,$l,Lt-Zl,Pt-$l)),L.strokeStyle=k.gridLine,L.lineWidth=.5,L.strokeRect(Se+.25,Pe+.25,Lt-Se-.5,Pt-Pe-.5),Ll(L,pt,Se,Pe,it,Bt,Ae,Ze),e.activeCell.value.col===ct&&e.activeCell.value.row===lt&&(L.strokeStyle=k.activeCellBorder,L.lineWidth=2,L.strokeRect(Se+1,Pe+1,it-2,Bt-2)),e.getListValidation(lt,ct)){const Hl=e.activeCell.value.col===ct&&e.activeCell.value.row===lt;qt(L,Se,Pe,it,Bt,Hl,k)}if(!(e.editingCell.value&&e.editingCell.value.col===ct&&e.editingCell.value.row===lt)){const Hl=te[Tt+1]-te[ct],jn=he[Ft+1]-he[lt],sn=ct<e.freeze.cols,ll=lt<e.freeze.rows,Wl=Ae?Se:sn?Se-Y:Se,fl=Ze?Pe:ll?Pe-j:Pe;Al(L,ct,lt,Hl,jn,Wl,fl)}}},r.save(),r.beginPath(),r.rect(Qe,Ge,st,yt),r.clip(),y(r,xn,Xt,Ol,ul,Tn),g(r,xn,Xt,Ol,ul,Tn),C(r,Qe,Ge,st,yt),r.restore(),He>0&&(r.strokeStyle=k.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Qe+.5,oe),r.lineTo(Qe+.5,M),r.stroke()),_e>0&&(r.strokeStyle=k.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Z,Ge+.5),r.lineTo(U,Ge+.5),r.stroke()),r.fillStyle=k.headerBg,r.fillRect(f,s,U-f,oe);for(let L=Wt;L<=Yt;L++){const De=f+te[L]-Y;if(e.isColumnCollapsed(L))continue;const We=(te[L+1]??0)-te[L];if(De+We<f||De>U)continue;const bt=Re[L];bt===0?(r.fillStyle=k.outlineGroupBg1,r.fillRect(De,s,We,oe)):bt===1&&(r.fillStyle=k.outlineGroupBg2,r.fillRect(De,s,We,oe)),Et&&L>=Et.startCol&&L<=Et.endCol&&(r.fillStyle=k.selectionBg,r.fillRect(De,s,We,oe)),r.strokeStyle=k.headerBorder,r.lineWidth=.5,r.strokeRect(De+.25,s+.25,We-.5,oe-.5),Et&&L>=Et.startCol&&L<=Et.endCol&&(r.strokeStyle=k.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(De,s+oe-1),r.lineTo(De+We,s+oe-1),r.stroke()),r.fillStyle=k.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(rt(L),De+We/2,s+oe/2)}if(He>0){r.fillStyle=k.headerBg,r.fillRect(f,s,He,oe);for(let L=0;L<=el;L++){const De=f+te[L];if(e.isColumnCollapsed(L))continue;const We=(te[L+1]??0)-te[L];De+We<f||De>U||(Et&&L>=Et.startCol&&L<=Et.endCol&&(r.fillStyle=k.selectionBg,r.fillRect(De,s,We,oe)),r.strokeStyle=k.headerBorder,r.lineWidth=.5,r.strokeRect(De+.25,s+.25,We-.5,oe-.5),Et&&L>=Et.startCol&&L<=Et.endCol&&(r.strokeStyle=k.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(De,s+oe-1),r.lineTo(De+We,s+oe-1),r.stroke()),r.fillStyle=k.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(rt(L),De+We/2,s+oe/2))}}r.strokeStyle=k.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(f,h+.5),r.lineTo(U,h+.5),r.stroke(),r.fillStyle=k.headerBg,r.fillRect(0,h,f,M-h);for(let L=tl;L<=jl;L++){if(e.isRowHidden(L))continue;const De=h+he[L]-j,We=Tn[L];if(De+We<h||De>M)continue;const bt=ke[L];bt===0?(r.fillStyle=k.outlineGroupBg1,r.fillRect(S,De,Z,We)):bt===1&&(r.fillStyle=k.outlineGroupBg2,r.fillRect(S,De,Z,We)),Et&&L>=Et.startRow&&L<=Et.endRow&&(r.fillStyle=k.selectionBg,r.fillRect(S,De,Z,We)),r.strokeStyle=k.headerBorder,r.lineWidth=.5,r.strokeRect(S+.25,De+.25,Z-.5,We-.5),Et&&L>=Et.startRow&&L<=Et.endRow&&(r.strokeStyle=k.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(S+Z-1,De),r.lineTo(S+Z-1,De+We),r.stroke()),r.fillStyle=k.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(L+1),S+Z/2,De+We/2+.5)}if(_e>0){r.fillStyle=k.headerBg,r.fillRect(0,h,f,_e);for(let L=0;L<=Dt;L++){if(e.isRowHidden(L))continue;const De=h+he[L],We=Tn[L];De+We<h||De>M||(Et&&L>=Et.startRow&&L<=Et.endRow&&(r.fillStyle=k.selectionBg,r.fillRect(S,De,Z,We)),r.strokeStyle=k.headerBorder,r.lineWidth=.5,r.strokeRect(S+.25,De+.25,Z-.5,We-.5),Et&&L>=Et.startRow&&L<=Et.endRow&&(r.strokeStyle=k.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(S+Z-1,De),r.lineTo(S+Z-1,De+We),r.stroke()),r.fillStyle=k.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(L+1),S+Z/2,De+We/2+.5))}}r.strokeStyle=k.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(f+.5,h),r.lineTo(f+.5,M),r.stroke(),r.fillStyle=k.headerBg,r.fillRect(S,s,Z,oe),r.strokeStyle=k.headerSep,r.lineWidth=1,r.strokeRect(S+.5,s+.5,Z-1,oe-1);const Vn=Math.min(Z,oe)*.32;r.fillStyle=k.activeCellBorder,r.beginPath(),r.moveTo(S+Z-1,s+oe-1-Vn),r.lineTo(S+Z-1-Vn,s+oe-1),r.lineTo(S+Z-1,s+oe-1),r.closePath(),r.fill();const jt=e.getOutlineLevel("row"),Zt=e.getOutlineLevel("column");if(e.getRowOutlines().length)for(const L of e.getRowOutlines()){const De=ze(L,jt),We=h+he[L.start]-j,bt=Math.min(L.end+1,he.length-1),St=h+he[bt]-j,Mt=Math.round(De);St-We>=1&&(r.strokeStyle=k.headerBorder,r.lineWidth=1,r.beginPath(),r.moveTo(Mt,Math.round(We)+2),r.lineTo(Mt,Math.max(1,Math.round(St)-2)),r.stroke());const wt=De-ne/2,Ae=We-ne/2;r.fillStyle=k.headerBg,r.strokeStyle=k.headerText,r.lineWidth=1,Ct(r,Math.round(wt),Math.round(Ae),ne,ne,2),r.fill(),r.stroke(),r.strokeStyle=k.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(De-2,We),r.lineTo(De+2,We),r.stroke(),L.collapsed&&(r.beginPath(),r.moveTo(De,We-2),r.lineTo(De,We+2),r.stroke())}if(e.getColumnOutlines().length)for(const L of e.getColumnOutlines()){const De=et(L,Zt),We=f+te[L.start]-Y,bt=Math.min(L.end+1,te.length-1),St=f+te[bt]-Y,Mt=Math.round(De);St-We>=1&&(r.strokeStyle=k.headerBorder,r.lineWidth=1,r.beginPath(),r.moveTo(Math.round(We)+2,Mt),r.lineTo(Math.max(1,Math.round(St)-2),Mt),r.stroke());const wt=We-ne/2,Ae=De-ne/2;r.fillStyle=k.headerBg,r.strokeStyle=k.headerText,r.lineWidth=1,Ct(r,Math.round(wt),Math.round(Ae),ne,ne,2),r.fill(),r.stroke(),r.strokeStyle=k.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(We-2,De),r.lineTo(We+2,De),r.stroke(),L.collapsed&&(r.beginPath(),r.moveTo(We,De-2),r.lineTo(We,De+2),r.stroke())}const _l=Math.max(jt,Zt);if(_l>0){const L=$e();r.fillStyle=k.headerBg,r.fillRect(0,0,ee,_l*ee);for(let De=1;De<=_l;De++){const We=(De-1)*ee;r.fillStyle=De===L?k.selectionBg:k.headerBg,r.strokeStyle=k.headerBorder,r.lineWidth=1,Ct(r,1,We+1,ee-2,ee-2,2),r.fill(),r.stroke(),r.fillStyle=De===L?k.activeCellBorder:k.headerText,r.font='9px -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(De),ee/2+.5,We+ee/2+.5)}}Q(r,k),we(r,k)}function A(){const u=o.freezeCanvasRef.value,w=o.wrapperRef.value;if(!u||!w)return;const V=u.getContext("2d");if(!V)return;const U=w.getBoundingClientRect(),M=U.width,Y=U.height,j=52,Z=24,oe=le(),S=ge(),s=j+oe,f=Z+S,h=o.themeColors.value,k=e.colPositions.value,O=e.rowPositions.value,te=e.scrollX.value,he=e.scrollY.value;u.width=M*c,u.height=Y*c,u.style.width=M+"px",u.style.height=Y+"px",V.setTransform(c,0,0,c,0,0),V.clearRect(0,0,M,Y);const{frozenRowsHeight:ke,frozenColumnsWidth:Re}=e.getFrozenMetrics();if(ke<=0&&Re<=0)return;const _e=s+Re,He=f+ke,Qe=Math.max(0,M-s-11-Re),Ge=Math.max(0,Y-f-11-ke),st=Math.max(0,e.freeze.cols-1),yt=Math.max(0,e.freeze.rows-1),el=Math.max(e.freeze.cols,e.hitCol(Re+te));let Dt=el;for(let ht=el;ht<e.colCount&&!(s+k[ht]-te>=M);ht++)Dt=ht;const Wt=Math.max(e.freeze.rows,e.hitRow(ke+he));let Yt=Wt;for(let ht=Wt;ht<e.rowCount&&!(f+O[ht]-he>=Y);ht++)Yt=ht;let tl=el,jl=Dt,sl=Wt,Xt=Yt;Re>0&&(tl=0,jl=Math.max(jl,st)),ke>0&&(sl=0,Xt=Math.max(Xt,yt));let Il=tl,ul=sl;for(const ht in e.merges){const gt=e.merges[ht];gt&&(gt.startRow>Xt||gt.endRow<sl||gt.startCol>jl||gt.endCol<tl||(gt.startCol<Il&&(Il=gt.startCol),gt.startRow<ul&&(ul=gt.startRow)))}const xn=new Array(ul);for(let ht=ul;ht<=Xt;ht++)xn[ht]=O[ht+1]-O[ht];const Ol=(ht,gt,Al)=>{const Ll=e.findMerge(ht,gt);return Ll?e.getCellBorderSide(e.cells[Ll.anchor],Al):e.getCellBorderSide(e.cells[e.cellKey(ht,gt)],Al)},Tn=(ht,gt,Al,Ll,Vn)=>{ht.fillStyle="#444";for(let jt=Ll;jt<=Vn;jt++)for(let Zt=gt;Zt<=Al;Zt++){const _l=e.findMerge(Zt,jt);if(_l&&!(Zt===_l.range.startCol&&jt===_l.range.startRow))continue;const L=e.cellToScreenRect(jt,Zt),De=L.x,We=L.y,bt=L.width,St=L.height;if(De+bt<s||We+St<f||De>M||We>Y)continue;const Mt=e.cells[e.cellKey(Zt,jt)],wt={top:e.getCellBorderSide(Mt,"top"),right:e.getCellBorderSide(Mt,"right"),bottom:e.getCellBorderSide(Mt,"bottom"),left:e.getCellBorderSide(Mt,"left")};if(_l)continue;const Ae={top:Ol(Zt,jt-1,"bottom"),left:Ol(Zt-1,jt,"right"),bottom:Ol(Zt,jt+1,"top"),right:Ol(Zt+1,jt,"left")},Ze=It(Ae.top,wt.top),mt=It(Ae.left,wt.left),ot=It(wt.bottom,Ae.bottom),tt=It(wt.right,Ae.right),pt=(Ze==null?void 0:Ze.width)??0,ct=(mt==null?void 0:mt.width)??0,lt=(ot==null?void 0:ot.width)??0,Tt=(tt==null?void 0:tt.width)??0;pt>0&&(ht.fillStyle=(Ze==null?void 0:Ze.color)||"#444",ht.fillRect(De,We,bt,pt)),lt>0&&(ht.fillStyle=(ot==null?void 0:ot.color)||"#444",ht.fillRect(De,We+St-lt,bt,lt)),ct>0&&(ht.fillStyle=(mt==null?void 0:mt.color)||"#444",ht.fillRect(De,We,ct,St)),Tt>0&&(ht.fillStyle=(tt==null?void 0:tt.color)||"#444",ht.fillRect(De+bt-Tt,We,Tt,St))}},Et=(ht,gt,Al,Ll,Vn,jt,Zt,_l)=>{Al<=0||Ll<=0||(V.save(),V.beginPath(),V.rect(ht,gt,Al,Ll),V.clip(),V.fillStyle=h.gridBg,V.fillRect(ht,gt,Al,Ll),y(V,Vn,jt,Zt,_l,xn),Tn(V,Vn,jt,Zt,_l),C(V,ht,gt,Al,Ll),V.restore())};Re>0&&ke>0&&Et(j,Z,Re,ke,0,st,0,yt),ke>0&&Et(_e,Z,Qe,ke,Il,jl,0,yt),Re>0&&Et(j,He,Re,Ge,0,st,ul,Xt),V.strokeStyle=h.headerSep,V.lineWidth=1,Re>0&&(V.beginPath(),V.moveTo(_e+.5,Z),V.lineTo(_e+.5,Y),V.stroke()),ke>0&&(V.beginPath(),V.moveTo(j,He+.5),V.lineTo(M,He+.5),V.stroke()),V.fillStyle=h.headerBg,V.fillRect(0,0,j,Z),V.strokeStyle=h.headerSep,V.lineWidth=1,V.strokeRect(.5,.5,j-.5,Z-.5),Q(V,h),we(V,h)}function Q(u,w){const V=e.selection.value;if(!V||e.editingCell.value)return;const U=e.cellToScreenRect(V.endRow,V.endCol),M=U.x+U.width-6/2,Y=U.y+U.height-6/2;if(M<fe()||Y<Ce())return;const j=nr(V,V,e.merges).ok;u.fillStyle=j?w.activeCellBorder:w.scrollTrack,u.fillRect(M,Y,6,6),u.strokeStyle="#fff",u.lineWidth=1,u.strokeRect(M+.5,Y+.5,6-1,6-1)}function we(u,w){const V=e.autoFillState.value;if(!V.active||!V.preview||!V.targetRange)return;const U=V.targetRange,M=e.cellToScreenRect(U.startRow,U.startCol),Y=e.cellToScreenRect(U.endRow,U.endCol),j=M.x,Z=M.y,oe=Y.x+Y.width-j,S=Y.y+Y.height-Z;Z<Ce()||j<fe()||(u.fillStyle=w.selectionBg,u.fillRect(j,Z,oe,S),u.strokeStyle=w.activeCellBorder,u.lineWidth=1.5,u.setLineDash([4,3]),u.strokeRect(j+.5,Z+.5,oe-1,S-1),u.setLineDash([]))}const xe=t.computed(()=>rt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),X=t.ref(""),Ne=t.ref(!1),me=t.computed(()=>e.editingCell.value?X.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(u,w)=>{if(u&&!w){const V=e.editValue.value||e.getCellRaw(u.col,u.row)||"";X.value=V,re=!1}else!u&&w&&(X.value="",Ne.value=!1,re=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(X.value="",re=!1)});function Me(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),m())}function T(u){const w=u.target.value;e.editingCell.value?e.editValue.value=w:e.startEdit(w),X.value=w,re=!0}function se(u){var V,U;const w={...e.activeCell.value};e.editingCell.value?(e.editValue.value=u,e.commitEdit()):((V=e.saveUndo)==null||V.call(e),e.setCellValue(w.col,w.row,u)),X.value="",re=!1,m(),(U=o.emitModelData)==null||U.call(o)}let ie=!1,re=!1;function K(){var Y,j,Z;if(ie)return;const u=o.formulaBarRef.value,w=!!(u&&typeof document<"u"&&document.activeElement===u);if(!e.editingCell.value&&!w&&!re)return;const V={...e.activeCell.value},U=e.editingCell.value?e.editingCell.value.col:V.col,M=e.editingCell.value?e.editingCell.value.row:V.row;if(!e.editingCell.value){const oe=e.getCellRaw(U,M),S=X.value!==oe;if(!re)return;ie=!0,S&&((Y=e.saveUndo)==null||Y.call(e),e.setCellValue(U,M,X.value),m(),(j=o.emitModelData)==null||j.call(o)),(Z=o.formulaBarRef.value)==null||Z.blur(),X.value="",Ne.value=!1,re=!1,t.nextTick(()=>{ie=!1});return}ie=!0,re?(e.editValue.value=X.value,e.commitEdit().then(oe=>{var S,s;oe&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(S=o.formulaBarRef.value)==null||S.blur(),X.value="",Ne.value=!1,re=!1,m(),o.focusEditInput(),(s=o.emitModelData)==null||s.call(o),t.nextTick(()=>{ie=!1})})):w?(X.value=e.editValue.value,e.commitEdit().then(oe=>{var S,s;oe&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(S=o.formulaBarRef.value)==null||S.blur(),X.value="",Ne.value=!1,re=!1,m(),o.focusEditInput(),(s=o.emitModelData)==null||s.call(o),t.nextTick(()=>{ie=!1})})):e.commitEdit().then(()=>{var oe,S;(oe=o.formulaBarRef.value)==null||oe.blur(),X.value="",Ne.value=!1,re=!1,m(),o.focusEditInput(),(S=o.emitModelData)==null||S.call(o),t.nextTick(()=>{ie=!1})})}function $(){var u;ie||(ie=!0,e.editingCell.value&&e.cancelEdit(),(u=o.formulaBarRef.value)==null||u.blur(),X.value="",Ne.value=!1,re=!1,m(),o.focusEditInput(),t.nextTick(()=>{ie=!1}))}function de(u){if(!u.isComposing){if(u.key==="Enter"&&(u.altKey||u.metaKey)&&!u.ctrlKey){u.preventDefault(),u.stopPropagation();const w=u.target;if(!w)return;e.editingCell.value||e.startEdit();const V=w.selectionStart??w.value.length,U=w.selectionEnd??w.value.length,M=w.value,Y=M.substring(0,V)+`
7
+ `+M.substring(U),j=V+1;X.value=Y,Ne.value||(Ne.value=!0),t.nextTick(()=>{try{w.setSelectionRange(j,j)}catch{}if(Ne.value)try{w.scrollTop=w.scrollHeight}catch{}try{w.focus({preventScroll:!0})}catch{}});return}u.key==="Enter"?(u.preventDefault(),K()):u.key==="Escape"&&(u.preventDefault(),$())}}function z(){K()}const _=t.ref(null),ae=t.ref("");function Ke(u){_.value===null&&(o.switchSheet(u),m())}function Fe(u){u!==o.activeSheetIndex.value&&(o.saveSheet(),o.loadSheet(u),m()),_.value=u,ae.value=o.sheets.value[u].name,t.nextTick(()=>{const w=document.querySelector(".tab-rename-input");w==null||w.focus(),w==null||w.select()})}function Le(){_.value!==null&&(o.renameSheet(_.value,ae.value),t.nextTick(()=>o.emitModelData())),_.value=null,ae.value=""}function Be(){_.value=null,ae.value=""}function qe(u){u.key==="Enter"?(u.preventDefault(),Le()):u.key==="Escape"&&(u.preventDefault(),Be())}const Je=t.ref(null);t.watch(Je,u=>{u===null&&wl()});const Te=t.ref(null),dt=t.ref(null),ft=18,Ue=2,N=2,pe=new Path2D("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");function Ct(u,w,V,U,M,Y){const j=Math.min(Y,U/2,M/2);u.beginPath(),u.moveTo(w+j,V),u.arcTo(w+U,V,w+U,V+M,j),u.arcTo(w+U,V+M,w,V+M,j),u.arcTo(w,V+M,w,V,j),u.arcTo(w,V,w+U,V,j),u.closePath()}function qt(u,w,V,U,M,Y,j){if(U<q+4||M<10)return;const Z=w+U-q,oe=V+1,S=M-2;u.save(),Y&&(u.fillStyle=j.selectionBg,u.fillRect(Z,oe,q,S)),u.fillStyle=j.activeCellBorder;const s=6,f=4,h=Z+q/2,k=oe+S/2;u.beginPath(),u.moveTo(h-s/2,k-f/2+.5),u.lineTo(h+s/2,k-f/2+.5),u.lineTo(h,k+f/2+.5),u.closePath(),u.fill(),u.restore()}function Kt(u,w){if(e.dataValidations.length===0)return null;const V=e.screenToCell(u,w);if(!V)return null;const U=e.findMerge(V.col,V.row),M=U?U.range.startCol:V.col,Y=U?U.range.startRow:V.row;if(!e.getListValidation(Y,M))return null;const j=e.cellToScreenRect(Y,M);if(j.width<q+4)return null;const Z=j.x+j.width-q;return u<Z||u>j.x+j.width||w<j.y||w>j.y+j.height?null:{col:M,row:Y}}function zt(u,w){const V=e.getValidationDropdown(w,u);if(!V)return!1;const U=o.canvasRef.value;if(!U)return!1;e.activeCell.value.col===u&&e.activeCell.value.row===w||e.selectCell(u,w),e.ensureVisible(u,w),m();const M=e.cellToScreenRect(w,u),Y=U.getBoundingClientRect();return dt.value={col:u,row:w,rule:V.rule,items:V.items,current:e.getCellRaw(u,w),x:Y.left+M.x,y:Y.top+M.y,width:M.width,height:M.height},!0}function Rt(){dt.value&&(dt.value=null,m())}async function Ut(u){var Y;const w=dt.value;if(!w)return;const{col:V,row:U}=w;dt.value=null;const M=e.validateCell(U,V,u);if(!M.valid&&await e.confirmInvalidValue(M,V,U)!=="continue"){m(),o.focusEditInput();return}n.saveUndo(),e.setCellValue(V,U,u),(Y=e.emitModelData)==null||Y.call(e),m(),o.focusEditInput()}function nl(u,w,V,U,M,Y,j){const Z=Math.min(U,ft)-Ue,oe=w+U-Z-Ue,S=V+Ue,s=M-2*Ue;u.save(),u.fillStyle=Y?j.activeCellBorder:"#ececec",Ct(u,oe,S,Z,s,N),u.fill();const f=Math.min(Z,s)*.72;u.translate(oe+Z/2,S+s/2),u.scale(f/1024,f/1024),u.translate(-512,-512),u.fillStyle=Y?"#ffffff":"#5a5a5a",u.fill(pe),u.restore()}function bl(u,w){const V=e.getFilter();if(!V)return-1;const U=e.screenToCell(u,w);if(!U)return-1;const{col:M,row:Y}=U;if(Y!==V.range.startRow||M<V.range.startCol||M>V.range.endCol)return-1;const j=e.cellToScreenRect(Y,M),Z=Math.min(j.width,ft)-Ue,oe=j.x+j.width-Z-Ue,S=j.x+j.width-Ue;return u>=oe&&u<=S&&w>=j.y+Ue&&w<=j.y+j.height-Ue?M:-1}function dl(u){const w=e.getFilter();if(!w)return;const V=o.canvasRef.value;if(!V)return;const U=V.getBoundingClientRect(),M=e.cellToScreenRect(w.range.startRow,u);Te.value={col:u,x:U.left+M.x+M.width-ft,y:U.top+M.y+2}}function yl(){Te.value=null}let Gt=null,ol=null;function wl(){Gt&&(document.removeEventListener("click",Gt),Gt=null),ol&&(document.removeEventListener("touchstart",ol,{capture:!0}),ol=null)}function xl(u,w){const V=e.getOutlineLevel("row"),U=e.getOutlineLevel("column"),M=Math.max(V,U);if(u>=0&&u<ee&&M>0&&w>=0&&w<M*ee){const s=Math.floor(w/ee)+1;if(s>=1&&s<=M)return{kind:"level",level:s}}const Y=e.rowPositions.value,j=e.colPositions.value,Z=e.scrollX.value,oe=e.scrollY.value,S=ne/2+1;if(w>=Ce())for(const s of e.getRowOutlines()){const f=ze(s,V),h=Ce()+Y[s.start]-oe;if(Math.abs(u-f)<=S&&Math.abs(w-h)<=S)return{kind:"toggle",outlineId:s.id}}if(u>=fe())for(const s of e.getColumnOutlines()){const f=et(s,U),h=fe()+j[s.start]-Z;if(Math.abs(w-f)<=S&&Math.abs(u-h)<=S)return{kind:"toggle",outlineId:s.id}}return null}function H(u){const w=e.getRowOutlines(),V=e.getColumnOutlines();let U=!1;for(const M of w)M.collapsed!==M.level>u&&(U=!0);for(const M of V)M.collapsed!==M.level>u&&(U=!0);if(U){n.saveUndo();for(const M of w)M.collapsed!==M.level>u&&e.setOutlineCollapsed(M.id,M.level>u,!0);for(const M of V)M.collapsed!==M.level>u&&e.setOutlineCollapsed(M.id,M.level>u,!0);o.emitModelData(),m()}}function W(u){for(const w of u)e.removeOutline(w);o.emitModelData(),m()}function G(u){const w=e.selection.value;if(!w)return p("outlineNeedRowsOrColumns"),!1;let V;if(u==="row"){if(w.startCol!==0||w.endCol!==e.colCount-1)return p("outlineNeedRowsOrColumns"),!1;if(w.startRow===w.endRow)return p("outlineInvalidRange"),!1;V=e.addRowGroup(w.startRow,w.endRow)}else{if(w.startRow!==0||w.endRow!==e.rowCount-1)return p("outlineNeedRowsOrColumns"),!1;if(w.startCol===w.endCol)return p("outlineInvalidRange"),!1;V=e.addColumnGroup(w.startCol,w.endCol)}return V.ok?!0:(p(V.code==="outlineCrossing"?"outlineCrossing":V.code==="outlineTooDeep"?"outlineTooDeep":"outlineInvalidRange"),!1)}function ve(u){const w=e.selection.value;if(!w||u==="row"&&(w.startCol!==0||w.endCol!==e.colCount-1)||u==="column"&&(w.startRow!==0||w.endRow!==e.rowCount-1))return p("outlineNeedRowsOrColumns"),!1;const V=u==="row"?e.getRowOutlines():e.getColumnOutlines(),U=u==="row"?w.startRow:w.startCol,M=u==="row"?w.endRow:w.endCol,Y=V.filter(j=>U<=j.start&&j.end<=M);return Y.length?(W(Y.map(j=>j.id)),!0):(p("outlineUngroupPartial"),!1)}function D(u,w){const V=u==="row"?e.getRowOutlines():e.getColumnOutlines();if(V.length&&!V.every(U=>U.collapsed===w)){n.saveUndo();for(const U of V)e.setOutlineCollapsed(U.id,w,!0);o.emitModelData(),m()}}function p(u){const w=b(e.locale.value,u);if(d){d(w);return}window.alert(w)}function E(u,w,V){wl();const U=140,M=V.length*28+8,Y=window.innerWidth,j=window.innerHeight;u+U>Y&&(u-=U),w+M>j&&(w-=M),be.value=!1,Je.value={x:u,y:w,items:V},t.nextTick(()=>Ye()),Gt=()=>{Je.value=null,wl()},ol=Z=>{const oe=Z.target;oe&&oe.closest(".context-menu")||(Je.value=null,wl())},setTimeout(()=>{document.addEventListener("click",Gt,{once:!0}),document.addEventListener("touchstart",ol,{capture:!0})},0)}const be=t.ref(!1);function ce(u,w){}function Ye(){const w=document.querySelector(".context-menu"),V=Je.value,U=o.wrapperRef.value;if(!w||!V||!U){be.value=!1;return}const M=V.x+140,Y=U.getBoundingClientRect(),j=w.style.transform;w.style.transform="none";let Z=0;if(w.querySelectorAll(".context-menu__item").forEach(S=>{const s=S.querySelector(":scope > .context-submenu");if(!s)return;const f=s.style.display;s.style.display="block";const h=s.getBoundingClientRect().width;s.style.display=f,h>Z&&(Z=h)}),w.style.transform=j,Z===0){be.value=!0;return}const oe=Y.right-M;be.value=oe<Z+8}function Xe(u,w){u.preventDefault(),u.stopPropagation(),E(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.addSheet(),m()}},{label:b(e.locale.value,"copy"),action:()=>{o.dupSheet(w)}},{label:b(e.locale.value,"rename"),action:()=>{Fe(w)}},{label:b(e.locale.value,"delete"),action:()=>{o.removeSheet(w),m()},disabled:o.sheetCount.value<=1},{label:b(e.locale.value,"moveSheetLeft"),action:()=>{o.moveSheet(w,-1)},disabled:w===0},{label:b(e.locale.value,"moveSheetRight"),action:()=>{o.moveSheet(w,1)},disabled:w===o.sheets.value.length-1}])}function v(u){u.preventDefault(),!(u.target.closest(".tab-item")||u.target.closest(".tab-bar__add-btn"))&&E(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.addSheet(),m()}}])}function P(u){u.preventDefault(),e.selectAll(),m(),E(u.clientX,u.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.clearSelected();for(let w=0;w<e.colCount;w++)e.colWidths.value[w]=100;for(let w=0;w<e.rowCount;w++)e.rowHeights.value[w]=void 0;m(),o.emitModelData()}}])}function ue(u,w){u.preventDefault();const V=u.clientX,U=u.clientY,M=e.selection.value;M&&M.startCol===0&&M.endCol===e.colCount-1&&w>=M.startRow&&w<=M.endRow||(e.selectRange(0,w,e.colCount-1,w,"row"),m());const Y=e.selection.value;E(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.saveUndo(),o.insertRows(Y.startRow,Y.endRow),m(),o.emitModelData()}},{label:b(e.locale.value,"cut"),action:()=>{n.saveUndo(),l.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,Y.startRow,Y.endRow),m(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.deleteRows(Y.startRow,Y.endRow),m(),o.emitModelData()}},{label:`${b(e.locale.value,"rowHeight")}...`,action:()=>Ot("row",V,U)},{label:b(e.locale.value,"autoRowHeight"),action:()=>o.resetRowHeight()},{label:b(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(w+1,e.freeze.cols),m()}},{label:b(e.locale.value,"outlineGroup"),children:[{label:b(e.locale.value,"outlineAddRowGroup"),action:()=>G("row")},{label:b(e.locale.value,"outlineUngroupRows"),action:()=>ve("row")},{label:b(e.locale.value,"outlineClear"),action:()=>e.clearRowGroups()},{label:b(e.locale.value,"outlineExpandAll"),action:()=>D("row",!1)},{label:b(e.locale.value,"outlineCollapseAll"),action:()=>D("row",!0)}]}])}function Ve(u,w){u.preventDefault();const V=u.clientX,U=u.clientY,M=e.selection.value;M&&M.startRow===0&&M.endRow===e.rowCount-1&&w>=M.startCol&&w<=M.endCol||(e.selectRange(w,0,w,e.rowCount-1,"col"),m());const Y=e.selection.value,j=!o.canSortColumns(Y.startCol,Y.endCol);E(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.saveUndo(),o.insertCols(Y.startCol,Y.endCol),m(),o.emitModelData()}},{label:b(e.locale.value,"cut"),action:()=>{n.saveUndo(),l.copyRowCol(),e.clearCellsInRange(Y.startCol,Y.endCol,0,e.rowCount-1),m(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.deleteCols(Y.startCol,Y.endCol),m(),o.emitModelData()}},{label:b(e.locale.value,"sort"),disabled:j,children:[{label:b(e.locale.value,"sortAsc"),action:()=>{o.prepareSortConfirmation("asc")||o.sortSelectedColumns("asc")},disabled:j},{label:b(e.locale.value,"sortDesc"),action:()=>{o.prepareSortConfirmation("desc")||o.sortSelectedColumns("desc")},disabled:j}]},{label:`${b(e.locale.value,"colWidth")}...`,action:()=>Ot("col",V,U)},{label:b(e.locale.value,"defaultColWidth"),action:()=>o.resetColWidth()},{label:b(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,w+1),m()}},{label:b(e.locale.value,"outlineGroup"),children:[{label:b(e.locale.value,"outlineAddColumnGroup"),action:()=>G("column")},{label:b(e.locale.value,"outlineUngroupColumns"),action:()=>ve("column")},{label:b(e.locale.value,"outlineClear"),action:()=>e.clearColumnGroups()},{label:b(e.locale.value,"outlineExpandAll"),action:()=>D("column",!1)},{label:b(e.locale.value,"outlineCollapseAll"),action:()=>D("column",!0)}]}])}function Ie(u,w,V){u.preventDefault(),e.isSelected(w,V)||(e.selectCell(w,V),m());const U=e.selection.value,M=!!(U&&U.startCol===U.endCol&&U.startRow===U.endRow);E(u.clientX,u.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),o.emitModelData()}},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{n.saveUndo(),l.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:b(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.clearSelected(),m(),o.emitModelData()}},{label:b(e.locale.value,"calculate"),children:[{label:b(e.locale.value,"sum"),action:l.sumSelected,disabled:M},{label:b(e.locale.value,"avg"),action:l.avgSelected,disabled:M},{label:b(e.locale.value,"count"),action:l.countSelected,disabled:M}]},{label:`${b(e.locale.value,"dv")}...`,action:()=>{var Y;return(Y=e.requestDataValidationDialog)==null?void 0:Y.call(e)}},{label:b(e.locale.value,"dvClearValidation"),action:()=>{n.saveUndo(),e.clearDataValidation(e.selection.value),m(),o.emitModelData()}}])}const Ee=t.ref(null),Oe=t.ref(null);let je=null,at=null;function Nt(){je&&(document.removeEventListener("mousedown",je),je=null),at&&(document.removeEventListener("touchstart",at),at=null)}function Ot(u,w,V){Nt();const U=e.selection.value;let M="";if(U){const S=u==="row"?e.getRowHeight(U.startRow):e.colWidths.value[U.startCol];M=S!=null&&S>0?String(Math.round(S)):""}const Y=220,j=118;let Z=w,oe=V;Z+Y>window.innerWidth&&(Z=window.innerWidth-Y-8),oe+j>window.innerHeight&&(oe=window.innerHeight-j-8),Z<8&&(Z=8),oe<8&&(oe=8),Oe.value={type:u,x:Z,y:oe,value:M,error:""},je=()=>{Oe.value=null},at=()=>{Oe.value=null},setTimeout(()=>{document.addEventListener("mousedown",je,{once:!0}),document.addEventListener("touchstart",at,{once:!0})},0),t.nextTick(()=>{const S=Ee.value;S&&(S.focus(),S.select())})}function xt(u){const w=Oe.value;if(!w)return;const V=u.target,U=V.value,M=U.replace(/[^\d]/g,"");w.value=M,U!==M&&(V.value=M),w.error=""}function Cl(u){u.key==="Enter"?(u.preventDefault(),hn()):u.key==="Escape"&&(u.preventDefault(),gn())}function Rn(){const u=Oe.value;if(!u)return;const w=u.value.trim(),V=Number(w),U=u.type==="row",M=U?24:30,Y=U?500:1e3;if(w===""||!Number.isFinite(V)){gn();return}const j=Math.max(M,Math.min(Y,Math.round(V)));u.value=String(j),u.error=""}function hn(){const u=Oe.value,w=e.selection.value;if(!u||!w)return;const V=u.value.trim(),U=Number(V),M=u.type==="row",Y=M?24:30,j=M?500:1e3;if(V===""||!Number.isFinite(U)){u.error=b(e.locale.value,"dimNumberError");return}if(U<Y||U>j){u.error=b(e.locale.value,"dimRangeError").replace("{min}",String(Y)).replace("{max}",String(j));return}const Z=U;if(n.saveUndo(),M)for(let oe=w.startRow;oe<=w.endRow;oe++)e.rowHeights.value[oe]=Z;else for(let oe=w.startCol;oe<=w.endCol;oe++)e.colWidths.value[oe]=Z;m(),o.emitModelData(),gn()}function gn(){Nt(),Oe.value=null}const mr=t.computed(()=>{const u=!e.editingCell.value,w=e.editingCell.value??e.activeCell.value,V=w.col,U=w.row,M=e.resolveStyle(e.cells[e.cellKey(V,U)]),Y=e.cellFontSize(V,U),j=typeof(M==null?void 0:M.fontFamily)=="string"&&M.fontFamily?M.fontFamily:kn,Z=(M==null?void 0:M.fontWeight)==="bold"?"bold":"normal",oe=(M==null?void 0:M.fontStyle)==="italic"?"italic":"normal",S=(M==null?void 0:M.underline)==="underline"?"underline":(M==null?void 0:M.strikethrough)==="line-through"?"line-through":"none",s=(M==null?void 0:M.underline)==="underline"&&(M==null?void 0:M.strikethrough)==="line-through"?"underline line-through":S,f=typeof(M==null?void 0:M.color)=="string"?M.color:void 0,h=typeof(M==null?void 0:M.backgroundColor)=="string"?M.backgroundColor:void 0,k=typeof(M==null?void 0:M.numberFormat)=="string"?M.numberFormat:"",O=e.editValue.value??e.getCellValue(V,U),te=typeof(M==null?void 0:M.textAlign)=="string"?M.textAlign:Ko(O,k)?"right":"left",he=typeof(M==null?void 0:M.verticalAlign)=="string"?M.verticalAlign:"top",ke=e.findMerge(V,U),Re=ke?e.rowPositions.value[ke.range.endRow+1]-e.rowPositions.value[U]:e.getRowHeight(U),_e=2,{ascent:He,descent:Qe}=e.measureFontMetrics(j,Y,Z,oe),Ge=He+Qe,yt=(e.editValue.value?e.editValue.value.split(`
8
+ `).length:1)*Ge,el=e.BASE_CELL_VPAD-_e;let Dt=0,Wt=0;he==="middle"?(Dt=Math.floor((Re-yt)/2),Wt=Math.max(0,Re-yt-Dt)):he==="top"?(Dt=el,Wt=Math.max(0,Re-yt-Dt)):he==="bottom"&&(Wt=el,Dt=Math.max(0,Re-yt-Wt));const Yt=e.cellToScreenRect(U,V);return{left:`${Yt.x}px`,top:`${Yt.y}px`,width:`${Yt.width}px`,height:`${Yt.height}px`,fontFamily:j,fontSize:`${Y}px`,lineHeight:1,fontWeight:Z,fontStyle:oe,textDecoration:s,textAlign:te,paddingTop:`${Dt}px`,paddingRight:"3px",paddingBottom:`${Wt}px`,paddingLeft:"3px",opacity:u?0:1,pointerEvents:u?"none":"auto",color:u?"transparent":f,caretColor:u?"transparent":void 0,borderColor:u?"transparent":void 0,background:u?"transparent":h,boxShadow:u?"none":void 0}});function no(){return Math.max(0,o.viewSize.w-fe()-11)}function $n(){return Math.max(0,o.viewSize.h-Ce()-11)}const oo=t.computed(()=>Math.max(0,no()-e.getFrozenMetrics().frozenColumnsWidth)),ro=t.computed(()=>Math.max(0,$n()-e.getFrozenMetrics().frozenRowsHeight)),pr=t.computed(()=>fe()+e.getFrozenMetrics().frozenColumnsWidth),hr=t.computed(()=>Ce()+e.getFrozenMetrics().frozenRowsHeight),Sn=t.computed(()=>Math.max(0,oo.value-11*2)),Mn=t.computed(()=>Math.max(0,ro.value-11*2)),zn=t.computed(()=>o.maxScrollX.value<=0?Sn.value:Math.max(24,oo.value/e.totalWidth.value*Sn.value)),ao=t.computed(()=>o.maxScrollX.value<=0?0:e.scrollX.value/o.maxScrollX.value*(Sn.value-zn.value)),Bn=t.computed(()=>o.maxScrollY.value<=0?Mn.value:Math.max(24,ro.value/e.totalHeight.value*Mn.value)),Hn=t.computed(()=>o.maxScrollY.value<=0?0:e.scrollY.value/o.maxScrollY.value*(Mn.value-Bn.value));let nn=null,Wn=0,Pn=0;function gr(u){u.preventDefault(),nn="v",Wn=u.clientY,Pn=e.scrollY.value,document.addEventListener("mousemove",Un),document.addEventListener("mouseup",Kn)}function Bo(u){u.preventDefault(),nn="h",Wn=u.clientX,Pn=e.scrollX.value,document.addEventListener("mousemove",Un),document.addEventListener("mouseup",Kn)}function Un(u){if(nn==="v"){const V=(u.clientY-Wn)/(Mn.value-Bn.value);o.clampScroll(null,Pn+V*o.maxScrollY.value),m()}else if(nn==="h"){const V=(u.clientX-Wn)/(Sn.value-zn.value);o.clampScroll(Pn+V*o.maxScrollX.value,null),m()}}function Kn(){nn=null,document.removeEventListener("mousemove",Un),document.removeEventListener("mouseup",Kn)}function br(u){if(nn)return;const w=u.currentTarget.getBoundingClientRect(),V=u.clientY-w.top;V<Hn.value?o.clampScroll(null,e.scrollY.value-$n()):V>Hn.value+Bn.value&&o.clampScroll(null,e.scrollY.value+$n()),m()}function yr(u){if(nn)return;const w=u.currentTarget.getBoundingClientRect(),V=u.clientX-w.left;V<ao.value?o.clampScroll(e.scrollX.value-no(),null):V>ao.value+zn.value&&o.clampScroll(e.scrollX.value+no(),null),m()}let bn=!1,rl=0,Ht=0,vl=!1,kl=!1,Jt=0,Tl=0,Vl=0,El=0,Nn=0,yn=0,Gn=0,on=0,Qt=!1,rn=!1,vt=0,kt=0,At="cell",qn=0,No=-1,xo=-1,al=null,ql=!1,Dl=0,Fl=0,an=!1,Rl=null,wn=null,Sl=0,Yn=0;function Yl(u,w){const V=e.selection.value;if(!V||e.editingCell.value||!nr(V,V,e.merges).ok)return!1;const U=e.cellToScreenRect(V.endRow,V.endCol),M=U.x+U.width-6,Y=U.y+U.height-6,j=4;return u>=M-j&&u<=M+6+j&&w>=Y-j&&w<=Y+6+j}function wr(){Rl=requestAnimationFrame(To)}function To(){if(!e.autoFillState.value.active||!wn){Rl=null;return}const u=8;o.clampScroll(e.scrollX.value+wn.x*u*.1,e.scrollY.value+wn.y*u*.1);const w=e.screenToCell(Sl,Yn),V=e.autoFillState.value.sourceRange;if(w&&V){const U=ca(V,{col:w.col,row:w.row});U?e.autoFillState.value={...e.autoFillState.value,targetRange:U.targetRange,direction:U.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}m(),Rl=requestAnimationFrame(To)}function Xn(){Rl!==null&&(cancelAnimationFrame(Rl),Rl=null),wn=null}function Vo(u,w){Sl=u,Yn=w;const V=e.screenToCell(u,w),U=e.autoFillState.value.sourceRange;if(V&&U){const S=ca(U,{col:V.col,row:V.row});S?e.autoFillState.value={...e.autoFillState.value,targetRange:S.targetRange,direction:S.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const M=30,Y=o.viewSize.w,j=o.viewSize.h;let Z=0,oe=0;u<fe()+M?Z=-(fe()+M-u):u>Y-11-M&&(Z=u-(Y-11-M)),w<Ce()+M?oe=-(Ce()+M-w):w>j-11-M&&(oe=w-(j-11-M)),Z!==0||oe!==0?(wn={x:Z,y:oe},Rl===null&&wr()):(wn=null,Rl!==null&&(cancelAnimationFrame(Rl),Rl=null)),m()}function Do(){Xn();const u=e.autoFillState.value;u.targetRange&&u.direction&&u.sourceRange&&e.applyAutoFill(u.sourceRange,u.targetRange,u.direction),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}}function Cr(u){if(u.button!==0)return;u.preventDefault(),Je.value=null;const w=fn(u,o.canvasRef.value),V=Kt(w.x,w.y);if(V){if(e.editingCell.value){e.commitEdit().then(oe=>{oe&&zt(V.col,V.row)});return}zt(V.col,V.row);return}const U=bl(w.x,w.y);if(U>=0){dl(U);return}const M=xl(w.x,w.y);if(M){M.kind==="toggle"?(e.toggleOutline(M.outlineId),m(),o.emitModelData()):M.kind==="level"&&H(M.level);return}if(w.y<Ce()&&w.x>=fe()){const oe=w.x-fe()+e.scrollX.value,S=B(w.x),s=S>=0?e.cellToScreenRect(0,S).x+e.colWidths.value[S]:-1;if(S>=0&&Math.abs(w.x-s)<=4){n.saveUndo(),vl=!0,Jt=S,Vl=e.colWidths.value[S],El=oe,m();return}}if(w.x<fe()&&w.y>=Ce()){const oe=w.y-Ce()+e.scrollY.value,S=R(w.y),s=S>=0?e.cellToScreenRect(S,0).y+e.getRowHeight(S):-1;if(S>=0&&Math.abs(w.y-s)<=4){n.saveUndo(),kl=!0,Tl=S,Vl=e.getRowHeight(S),El=oe,m();return}}if(Yl(w.x,w.y)){const oe=e.selection.value;oe&&(e.autoFillState.value={active:!0,sourceRange:{...oe},targetRange:null,direction:null,preview:!0},m());return}if(w.x<fe()||w.y<Ce()){{const oe=o.formulaBarRef.value,S=!!(oe&&typeof document<"u"&&document.activeElement===oe);(e.editingCell.value||S||re)&&K()}if(w.y<Ce()&&w.x>=fe()){const oe=B(w.x);oe>=0&&(e.selectRange(oe,0,oe,e.rowCount-1,"col"),bn=!0,rl=oe,Ht=0)}else if(w.x<fe()&&w.y>=Ce()){const oe=R(w.y);oe>=0&&(e.selectRange(0,oe,e.colCount-1,oe,"row"),bn=!0,rl=0,Ht=oe)}else w.x<fe()&&w.y<Ce()&&e.selectAll();m();return}const Y=e.screenToCell(w.x,w.y);if(!Y)return;const j=Y.col,Z=Y.row;{const oe=o.formulaBarRef.value,S=!!(oe&&typeof document<"u"&&document.activeElement===oe);(e.editingCell.value||S||re)&&K()}if(u.shiftKey&&e.selection.value){const oe=e.selection.value;e.selectRange(oe.startCol,oe.startRow,j,Z)}else e.selectCell(j,Z);bn=!0,rl=j,Ht=Z,o.focusEditInput(),m()}function Fo(u){if(vl){const j=fn(u,o.canvasRef.value).x-fe()+e.scrollX.value-El,Z=Vl+j;Z>=30&&Z<=1e3?e.colWidths.value[Jt]=Z:Z<30?e.colWidths.value[Jt]=30:e.colWidths.value[Jt]=1e3,m();return}if(kl){const j=fn(u,o.canvasRef.value).y-Ce()+e.scrollY.value-El,Z=Vl+j;Z>=24&&Z<=500?e.rowHeights.value[Tl]=Z:Z<24?e.rowHeights.value[Tl]=24:e.rowHeights.value[Tl]=500,m();return}if(e.autoFillState.value.active){const Y=fn(u,o.canvasRef.value);Vo(Y.x,Y.y);return}if(!bn){const Y=o.canvasRef.value;if(!Y)return;if(n.paintFmt.value){Y.style.cursor="copy";return}const j=fn(u,Y);if(xl(j.x,j.y)){Y.style.cursor="pointer";return}if(bl(j.x,j.y)>=0){Y.style.cursor="pointer";return}if(Kt(j.x,j.y)){Y.style.cursor="pointer";return}if(j.y<Ce()&&j.x>=fe()){const Z=B(j.x),oe=Z>=0?e.cellToScreenRect(0,Z).x+e.colWidths.value[Z]:-1;if(Z>=0&&Math.abs(j.x-oe)<=4){Y.style.cursor="col-resize";return}}if(j.x<fe()&&j.y>=Ce()){const Z=R(j.y),oe=Z>=0?e.cellToScreenRect(Z,0).y+e.getRowHeight(Z):-1;if(Z>=0&&Math.abs(j.y-oe)<=4){Y.style.cursor="row-resize";return}}if(Yl(j.x,j.y)){Y.style.cursor="crosshair";return}Y.style.cursor="cell";return}const w=fn(u,o.canvasRef.value);if(rl<0||Ht<0)return;if(w.x<fe()||w.y<Ce()){if(w.y<Ce()&&w.x>=fe()){const Y=B(w.x);Y>=0&&e.selectRange(Math.min(rl,Y),0,Math.max(rl,Y),e.rowCount-1,"col")}else if(w.x<fe()&&w.y>=Ce()){const Y=R(w.y);Y>=0&&e.selectRange(0,Math.min(Ht,Y),e.colCount-1,Math.max(Ht,Y),"row")}m();return}const V=e.screenToCell(w.x,w.y);if(!V)return;const U=V.col,M=V.row;Ht===0&&rl>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(rl,U),0,Math.max(rl,U),e.rowCount-1,"col"):rl===0&&Ht>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Ht,M),e.colCount-1,Math.max(Ht,M),"row"):e.selectRange(rl,Ht,U,M),m()}function Io(u){const w=vl||kl;if(bn=!1,vl=!1,kl=!1,w&&o.scheduleOptEmit(),e.autoFillState.value.active){Do();return}n.paintFmt.value&&n.applyPaintFormat()}function Oo(){Xn();const u=vl||kl;bn=!1,vl=!1,kl=!1,u&&o.scheduleOptEmit()}function vr(u){u.preventDefault();const w=fn(u,o.canvasRef.value);if(w.x<fe()&&w.y<Ce()){P(u);return}if(w.y<Ce()&&w.x>=fe()){const V=B(w.x);V>=0&&Ve(u,V);return}if(w.x<fe()&&w.y>=Ce()){const V=R(w.y);V>=0&&ue(u,V);return}if(w.x>=fe()&&w.y>=Ce()){const V=e.screenToCell(w.x,w.y);V&&Ie(u,V.col,V.row)}}function kr(u){const w=fn(u,o.canvasRef.value);if(w.x<fe()||w.y<Ce())return;const V=e.screenToCell(w.x,w.y);if(!V)return;const U=V.col,M=V.row;{const Y=o.formulaBarRef.value,j=!!(Y&&typeof document<"u"&&document.activeElement===Y);(e.editingCell.value||j||re)&&K()}e.selectCell(U,M),e.ensureVisible(U,M),e.startEdit(),m(),o.focusEditInput()}function Er(u){const w=e.scrollX.value+u.deltaX,V=e.scrollY.value+u.deltaY,U=40,M=o.maxScrollX.value,Y=o.maxScrollY.value;if(w>=M-U&&u.deltaX>0||V>=Y-U&&u.deltaY>0){const j=Math.max(0,o.viewSize.w-28-11),Z=Math.max(0,o.viewSize.h-28-11),oe=Math.max(0,Math.ceil((w+j)/100)+2),S=Math.max(0,Math.ceil((V+Z)/24)+2);e.ensureCapacity(oe,S)}o.clampScroll(w,V),m()}function Rr(u){if(u.touches.length!==1){Qt=!1;return}const w=u.touches[0],V=o.canvasRef.value;if(!V)return;const U=V.getBoundingClientRect(),M=w.clientX-U.left,Y=w.clientY-U.top,j=w.clientX,Z=w.clientY,oe=(s,f)=>({clientX:s,clientY:f,preventDefault(){}});{const s=o.formulaBarRef.value,f=!!(s&&typeof document<"u"&&document.activeElement===s);(e.editingCell.value||f||re)&&K()}if(Yl(M,Y)){u.preventDefault();const s=e.selection.value;s&&(e.autoFillState.value={active:!0,sourceRange:{...s},targetRange:null,direction:null,preview:!0},Qt=!0,rn=!1,At="cell",Nn=M,yn=Y,Gn=e.scrollX.value,on=e.scrollY.value);return}const S=bl(M,Y);if(S>=0){u.preventDefault(),dl(S);return}if(Y<Ce()&&M>=fe()){const s=B(M);if(s>=0){const f=e.cellToScreenRect(0,s).x+e.colWidths.value[s];if(Math.abs(M-f)<=8){u.preventDefault(),n.saveUndo(),vl=!0,Jt=s,Vl=e.colWidths.value[s],El=M-fe()+e.scrollX.value,Qt=!0,rn=!1;return}}}if(M<fe()&&Y>=Ce()){const s=R(Y);if(s>=0){const f=e.cellToScreenRect(s,0).y+e.getRowHeight(s);if(Math.abs(Y-f)<=8){u.preventDefault(),n.saveUndo(),kl=!0,Tl=s,Vl=e.getRowHeight(s),El=Y-Ce()+e.scrollY.value,Qt=!0,rn=!1;return}}}M>=fe()&&Y>=Ce()?(u.preventDefault(),Qt=!0,rn=!1,ql=!1,an=!1,At="cell",Nn=M,yn=Y,Gn=e.scrollX.value,on=e.scrollY.value,vt=B(M),kt=R(Y),al!==null&&clearTimeout(al),al=window.setTimeout(()=>{const s=e.selection.value;if(!!s&&vt>=s.startCol&&vt<=s.endCol&&kt>=s.startRow&&kt<=s.endRow){an=!0,Ie(oe(j,Z),vt,kt);return}ql=!0,Dl=vt,Fl=kt,vt>=0&&kt>=0&&(e.selectCell(vt,kt),m())},450)):M>=0&&Y>=0&&(M<fe()||Y<Ce())&&(u.preventDefault(),Qt=!0,rn=!1,ql=!1,Nn=M,yn=Y,Gn=e.scrollX.value,on=e.scrollY.value,Y<Ce()&&M>=fe()?(At="col",vt=B(M),kt=-1):M<fe()&&Y>=Ce()?(At="row",kt=R(Y),vt=-1):(At="all",vt=-1,kt=-1),(At==="col"||At==="row"||At==="all")&&(al!==null&&clearTimeout(al),al=window.setTimeout(()=>{const s=e.selection.value;if(At==="all"){an=!0,P(oe(j,Z));return}if(At==="col"){if(!!s&&s.startRow===0&&s.endRow===e.rowCount-1&&vt>=s.startCol&&vt<=s.endCol){an=!0,Ve(oe(j,Z),vt);return}ql=!0,Dl=vt,Fl=-1,vt>=0&&(e.selectRange(vt,0,vt,e.rowCount-1,"col"),m())}else{if(!!s&&s.startCol===0&&s.endCol===e.colCount-1&&kt>=s.startRow&&kt<=s.endRow){an=!0,ue(oe(j,Z),kt);return}ql=!0,Dl=-1,Fl=kt,kt>=0&&(e.selectRange(0,kt,e.colCount-1,kt,"row"),m())}},450)))}function Sr(u){if(!Qt||u.touches.length!==1)return;const w=u.touches[0],V=o.canvasRef.value;if(!V)return;const U=V.getBoundingClientRect(),M=w.clientX-U.left,Y=w.clientY-U.top;if(e.autoFillState.value.active){u.preventDefault(),Vo(M,Y);return}if(vl){const j=M-fe()+e.scrollX.value-El;let Z=Vl+j;Z=Z<30?30:Z>1e3?1e3:Z,e.colWidths.value[Jt]=Z,u.preventDefault(),m();return}if(kl){const j=Y-Ce()+e.scrollY.value-El;let Z=Vl+j;Z=Z<24?24:Z>500?500:Z,e.rowHeights.value[Tl]=Z,u.preventDefault(),m();return}if(ql){if(u.preventDefault(),Dl>=0&&Fl>=0){const j=B(M),Z=R(Y);j>=0&&Z>=0&&(e.selectRange(Dl,Fl,j,Z),m())}else if(Fl===-1&&Dl>=0){const j=B(M);j>=0&&(e.selectRange(Math.min(Dl,j),0,Math.max(Dl,j),e.rowCount-1,"col"),m())}else if(Dl===-1&&Fl>=0){const j=R(Y);j>=0&&(e.selectRange(0,Math.min(Fl,j),e.colCount-1,Math.max(Fl,j),"row"),m())}return}al!==null&&(clearTimeout(al),al=null),(Math.abs(M-Nn)>8||Math.abs(Y-yn)>8)&&(rn=!0,u.preventDefault(),o.clampScroll(Gn+(Nn-M),on+(yn-Y)),m())}function io(){if(Qt){if(al!==null&&(clearTimeout(al),al=null),an){an=!1,Qt=!1;return}if(e.autoFillState.value.active){Do(),Qt=!1;return}if(vl||kl){vl=!1,kl=!1,o.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat(),Qt=!1;return}if(ql){ql=!1,n.paintFmt.value&&n.applyPaintFormat(),Qt=!1;return}if(Qt=!1,!rn){if(At==="cell"&&vt>=0&&kt>=0){const u=Date.now();vt===No&&kt===xo&&u-qn<300?(e.selectCell(vt,kt),e.startEdit(),m(),o.focusEditInput(),qn=0):(e.commitEdit(),e.selectCell(vt,kt),m(),qn=u),No=vt,xo=kt,o.focusEditInput()}else At==="col"&&vt>=0?(e.commitEdit(),e.selectRange(vt,0,vt,e.rowCount-1,"col"),m()):At==="row"&&kt>=0?(e.commitEdit(),e.selectRange(0,kt,e.colCount-1,kt,"row"),m()):At==="all"&&(e.commitEdit(),e.selectAll(),m());n.paintFmt.value&&!e.editingCell.value&&n.applyPaintFormat()}}}function so(u){return u.isComposing||u.key==="Process"||u.keyCode===229}function co(u){return u.key.length===1&&!u.ctrlKey&&!u.metaKey&&!u.altKey}function Ao(u){if(e.autoFillState.value.active){u.key==="Escape"&&(u.preventDefault(),Xn(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},m());return}if(e.editingCell.value)return;const w=u.ctrlKey||u.metaKey,V=u.shiftKey;switch(!0){case(u.altKey&&u.key==="ArrowDown"):u.preventDefault(),zt(e.activeCell.value.col,e.activeCell.value.row);return;case(w&&(u.key==="c"||u.key==="C")):u.preventDefault(),l.copyToClipboard();return;case(w&&(u.key==="x"||u.key==="X")):u.preventDefault(),l.cutSelected();return;case(w&&(u.key==="z"||u.key==="Z")):u.preventDefault(),n.undo();return;case(w&&(u.key==="y"||u.key==="Y")):u.preventDefault(),n.redo();return;case(w&&(u.key==="v"||u.key==="V")):u.preventDefault(),n.saveUndo(),l.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())});return;case(w&&(u.key==="a"||u.key==="A")):u.preventDefault(),e.selectAll(),m();return;case(w&&V&&(u.key==="l"||u.key==="L")):u.preventDefault(),e.toggleAutoFilter(),m();return;case(w&&u.key==="Home"):u.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),m();return;case(w&&u.key==="End"):u.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),m();return;case u.key==="Home":u.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),m();return;case u.key==="End":u.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),m();return;case u.key==="ArrowUp":u.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="ArrowDown":u.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="ArrowLeft":u.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="ArrowRight":u.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="Tab":u.preventDefault(),e.moveActive(V?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="Enter":u.preventDefault(),e.moveActive(0,V?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="F2":u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),m(),o.focusEditInput();return;case u.key==="Delete":case u.key==="Backspace":u.preventDefault(),n.saveUndo(),l.clearSelected(),m();return;case u.key==="Escape":u.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,m();return;case co(u):if(so(u)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),m(),o.focusEditInput();return}u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(u.key),m(),t.nextTick(()=>{const U=o.editInputRef.value;U&&(U.focus(),U.setSelectionRange(1,1))});return}}let uo=!1,fo=!1;function Mr(u){const w=u.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(w),X.value=w,m();return}e.editValue.value=w,X.value=w}function Br(){uo=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),X.value="",m())}function Lo(u){uo=!1,fo=!0,setTimeout(()=>{fo=!1},0);const w=u.target.value;e.editValue.value=w,X.value=w}function _o(u){if(!e.editingCell.value){if(co(u)||so(u))return;Ao(u);return}if(!(uo||so(u))&&!(fo&&(u.key==="Enter"||u.key==="Escape")))if(u.key==="Enter"&&(u.altKey||u.metaKey)){u.preventDefault();const w=o.editInputRef.value;if(!w)return;const V=w.selectionStart??w.value.length,U=w.selectionEnd??w.value.length,M=w.value,Y=M.slice(0,V)+`
9
+ `+M.slice(U);e.editValue.value=Y,w.value=Y,w.selectionStart=w.selectionEnd=V+1,m()}else u.key==="Enter"?(u.preventDefault(),e.commitEdit().then(w=>{if(!w){m(),o.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m(),o.focusEditInput()})):u.key==="Tab"?(u.preventDefault(),e.commitEdit().then(w=>{if(!w){m(),o.focusEditInput();return}e.moveActive(u.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m(),o.focusEditInput()})):u.key==="Escape"&&(u.preventDefault(),e.cancelEdit(),m(),o.focusEditInput())}function Nr(u){e.editingCell.value}function xr(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>m())},0)}let il=null;function Xl(){var w;const u=(w=o.wrapperRef.value)==null?void 0:w.getBoundingClientRect();if(u){const V=En(e.props.width),U=En(e.props.height);V!=null?o.viewSize.w=V:o.viewSize.w=u.width,U!=null?o.viewSize.h=U:o.viewSize.h=u.height}o.clampScroll(null,null),m()}function Tr(){t.onMounted(()=>{const u=En(e.props.width),w=En(e.props.height);(u==null||w==null)&&(il=new ResizeObserver(()=>Xl()),o.wrapperRef.value&&il.observe(o.wrapperRef.value)),t.nextTick(()=>{Xl(),o.focusEditInput()}),e.selectCell(0,0),o.modelData.value&&o.modelData.value.length>0&&(a.value=JSON.stringify(o.modelData.value),o.sheets.value=o.modelData.value.map(V=>{const U=o.mkSheet(V.name,{colCount:V.colCount,rowCount:V.rowCount}),{cells:M,styles:Y}=xa(V.cells);if(Object.assign(U.cells,M),U.styles=V.styles??Y,V.borders)U.borders=V.borders;else{const j=Ta(U.styles);U.styles=j.styles,U.borders=j.borders}if(V.colWidths)for(const[j,Z]of Object.entries(V.colWidths)){const oe=Number(j);oe>=0&&oe<(U.colCount??e.colCount)&&Z>=30&&(U.colWidths[oe]=Z)}if(V.rowHeights)for(const[j,Z]of Object.entries(V.rowHeights)){const oe=Number(j);oe>=0&&oe<(U.rowCount??e.rowCount)&&Z>=24&&(U.rowHeights[oe]=Z)}if(V.merges)for(const[j,Z]of Object.entries(V.merges))U.merges[j]={...Z};return U.freeze=V.freeze?{rows:V.freeze.rows,cols:V.freeze.cols}:{rows:0,cols:0},U.filter=za(V.filter,U.cells),U.dataValidations=Array.isArray(V.dataValidations)?[...V.dataValidations]:[],U}),o.sheets.value.length>0&&o.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const u=En(e.props.width),w=En(e.props.height);u!=null&&w!=null?(il==null||il.disconnect(),il=null):!il&&o.wrapperRef.value&&(il=new ResizeObserver(()=>Xl()),il.observe(o.wrapperRef.value)),t.nextTick(()=>Xl())}),t.watch(()=>e.props.theme,()=>m()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>o.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>o.emitModelData()),m()},{deep:!1}),t.watch(o.activeSheetIndex,()=>t.nextTick(()=>o.emitModelData())),t.watch(()=>o.modelData.value,u=>{if(!u||u.length===0)return;const w=JSON.stringify(u);if(w===a.value)return;a.value=w;const V=e.selection.value?{...e.selection.value}:null,U={...e.activeCell.value};o.sheets.value=u.map(Z=>{const oe=o.mkSheet(Z.name),{cells:S,styles:s}=xa(Z.cells);if(Object.assign(oe.cells,S),oe.styles=Z.styles??s,Z.borders)oe.borders=Z.borders;else{const f=Ta(oe.styles);oe.styles=f.styles,oe.borders=f.borders}if(Z.colWidths)for(const[f,h]of Object.entries(Z.colWidths)){const k=Number(f);k>=0&&k<e.colCount&&h>=30&&(oe.colWidths[k]=h)}if(Z.rowHeights)for(const[f,h]of Object.entries(Z.rowHeights)){const k=Number(f);k>=0&&k<e.rowCount&&h>=24&&(oe.rowHeights[k]=h)}if(Z.merges)for(const[f,h]of Object.entries(Z.merges))oe.merges[f]={...h};return oe.freeze=Z.freeze?{rows:Z.freeze.rows,cols:Z.freeze.cols}:{rows:0,cols:0},oe.filter=za(Z.filter,oe.cells),oe.dataValidations=Array.isArray(Z.dataValidations)?[...Z.dataValidations]:[],oe.rowOutlines=Array.isArray(Z.rowOutlines)?Z.rowOutlines.map(f=>({...f})):[],oe.columnOutlines=Array.isArray(Z.columnOutlines)?Z.columnOutlines.map(f=>({...f})):[],oe}),o.sheets.value.length>0&&o.loadSheet(0),V&&(e.selection.value=V),e.activeCell.value=U;const M=e.activeCell.value,Y=e.selection.value,j=e.findMerge(M.col,M.row);j&&j.anchor===e.cellKey(M.col,M.row)&&(!Y||Y.startCol===M.col&&Y.startRow===M.row&&Y.endCol===M.col&&Y.endRow===M.row)&&e.selectCell(M.col,M.row),m()},{deep:!0}),t.onBeforeUnmount(()=>{il==null||il.disconnect()})}return{scheduleRender:m,render:F,renderFrozenOverlay:A,activeCellLabel:xe,formulaBarDisplay:me,formulaBarDraft:X,formulaBarExpanded:Ne,onFormulaBarFocus:Me,onFormulaBarInput:T,onFormulaBarKeydown:de,onFormulaBarBlur:z,acceptFormulaBarEdit:K,cancelFormulaBarEdit:$,insertFunctionIntoCell:se,renTab:_,renTabVal:ae,onTabClick:Ke,onTabDblClick:Fe,commitTabRename:Le,cclTabRename:Be,onTabRenameKd:qe,ctxMenu:Je,ctxSubmenuLeft:be,filterPopup:Te,isFilterButtonHit:bl,openFilterPopup:dl,closeFilterPopup:yl,validationDropdown:dt,isValidationDropdownHit:Kt,openValidationDropdown:zt,closeValidationDropdown:Rt,onValidationDropdownSelect:Ut,onCtxItemEnter:ce,onTabCtxMenu:Xe,onTabBarCtx:v,onCornerCtx:P,onRowHdrCtx:ue,onColHdrCtx:Ve,onCellCtx:Ie,dimInputRef:Ee,dimPanel:Oe,openDimPanel:Ot,onDimInput:xt,onDimKeydown:Cl,onDimBlur:Rn,applyDimPanel:hn,closeDimPanel:gn,outlineGroupRows:()=>G("row"),outlineGroupCols:()=>G("column"),outlineUngroupRows:()=>ve("row"),outlineUngroupCols:()=>ve("column"),outlineExpandRows:()=>D("row",!1),outlineCollapseRows:()=>D("row",!0),outlineExpandCols:()=>D("column",!1),outlineCollapseCols:()=>D("column",!0),get showOutlineAlert(){return d},set showOutlineAlert(u){d=u},editInputStyle:mr,hScrollbarW:oo,vScrollbarH:ro,hScrollbarLeft:pr,vScrollbarTop:hr,hTrackW:Sn,vTrackH:Mn,hThumbW:zn,hThumbL:ao,vThumbH:Bn,vThumbT:Hn,onVStart:gr,onHStart:Bo,onSbMove:Un,onSbUp:Kn,onVTrk:br,onHTrk:yr,onMouseDown:Cr,onMouseMove:Fo,onMouseUp:Io,onMouseLeave:Oo,onCanvasCtx:vr,onDblClick:kr,onWheel:Er,onTouchStart:Rr,onTouchMove:Sr,onTouchEnd:io,onKeydown:Ao,onEditInput:Mr,onEditCompositionStart:Br,onEditCompositionEnd:Lo,onEditKd:_o,onEditPaste:Nr,onEditBlur:xr,applySize:Xl,setupLifecycle:Tr}}function z1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ha(e,n,l,o){return n?o?l?e===n:e.toLowerCase()===n.toLowerCase():l?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function H1(e,n,l,o){if(!n)return e;if(o){const i=e.indexOf(n);return i<0?e:e.slice(0,i)+l+e.slice(i+n.length)}const a=e.toLowerCase().indexOf(n.toLowerCase());return a<0?e:e.slice(0,a)+l+e.slice(a+n.length)}function W1(e,n,l,o){return n?o?e.indexOf(n)<0?e:e.split(n).join(l):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(z1(n),"gi"),()=>l):e}function fr(e,n,l,o,a,i,r){const c=[];if(r){for(let d=r.startRow;d<=r.endRow;d++)for(let y=r.startCol;y<=r.endCol;y++){const g=e[l(y,d)];g&&Ha(g.value,o,a,i)&&c.push({sheetIndex:n,col:y,row:d})}return c}for(const d in e){const y=e[d];if(y&&Ha(y.value,o,a,i)){const g=d.split(","),C=Number(g[0]),m=Number(g[1]);!Number.isNaN(C)&&!Number.isNaN(m)&&c.push({sheetIndex:n,col:C,row:m})}}return c}function P1(e,n,l,o){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref("sheet"),d=t.ref(!1),y=t.ref(!1),g=t.ref(-1),C=t.ref([]),m=t.ref(""),B=t.ref(0),R=t.ref(""),I=t.computed(()=>{const X=new Set,Ne=l.activeSheetIndex.value;for(const me of C.value)me.sheetIndex===Ne&&X.add(`${me.col},${me.row}`);return X}),q=t.computed(()=>{if(g.value<0||g.value>=C.value.length)return null;const X=C.value[g.value];return X.sheetIndex!==l.activeSheetIndex.value?null:`${X.col},${X.row}`});e.findHighlight=(X,Ne)=>{const me=`${X},${Ne}`;return q.value===me?"active":I.value.has(me)?"match":null};function J(X){var Me,T;const Ne=e.cellKey(X.col,X.row);if(X.sheetIndex===l.activeSheetIndex.value)return((Me=e.cells[Ne])==null?void 0:Me.value)??"";const me=l.sheets.value[X.sheetIndex];return((T=me==null?void 0:me.cells[Ne])==null?void 0:T.value)??""}function ee(X,Ne){const me=e.cellKey(X.col,X.row);if(X.sheetIndex===l.activeSheetIndex.value)e.setCellValue(X.col,X.row,Ne);else{const Me=l.sheets.value[X.sheetIndex];if(!Me)return;const T=Me.cells[me];Me.cells[me]={value:String(Ne),styleId:T==null?void 0:T.styleId}}}function ne(){if(R.value){m.value=R.value;return}if(!i.value){m.value="";return}if(c.value==="selection"&&!e.selection.value){m.value=b(e.locale.value,"findNeedSelection");return}if(C.value.length===0){m.value=b(e.locale.value,"findNoResult");return}m.value=""}function x(){const X=i.value,Ne=[];if(X)if(c.value==="workbook")l.sheets.value.forEach((me,Me)=>{Ne.push(...fr(me.cells,Me,e.cellKey,X,d.value,y.value))});else if(c.value==="selection"){const me=e.selection.value;me&&Ne.push(...fr(e.cells,l.activeSheetIndex.value,e.cellKey,X,d.value,y.value,me))}else Ne.push(...fr(e.cells,l.activeSheetIndex.value,e.cellKey,X,d.value,y.value));C.value=Ne,Ne.length===0?g.value=-1:g.value>=Ne.length?g.value=Ne.length-1:g.value<0&&(g.value=0),ne()}function le(){if(g.value<0||g.value>=C.value.length)return;const X=C.value[g.value];X.sheetIndex!==l.activeSheetIndex.value&&l.switchSheet(X.sheetIndex),c.value==="selection"?e.activeCell.value={col:X.col,row:X.row}:e.selectCell(X.col,X.row),e.ensureVisible(X.col,X.row)}const ge=typeof requestAnimationFrame=="function"?requestAnimationFrame:X=>setTimeout(X,16);let fe=!1,Ce=!1;function $e(X){if(fe){Ce=Ce||X;return}fe=!0,Ce=X,ge(()=>{var Ne;fe=!1,x(),Ce&&C.value.length>0&&g.value>=0&&le(),Ce=!1,(Ne=e.scheduleRender)==null||Ne.call(e)})}function ze(){var X;a.value=!0,B.value++,x(),C.value.length>0&&(g.value=0,le()),(X=e.scheduleRender)==null||X.call(e)}function et(){ze()}function nt(){var X;a.value=!1,C.value=[],g.value=-1,R.value="",m.value="",(X=e.scheduleRender)==null||X.call(e)}function F(){var X;C.value.length!==0&&(g.value=(g.value+1)%C.value.length,le(),(X=e.scheduleRender)==null||X.call(e))}function A(){var X;C.value.length!==0&&(g.value=(g.value-1+C.value.length)%C.value.length,le(),(X=e.scheduleRender)==null||X.call(e))}function Q(){var T,se;if(g.value<0||g.value>=C.value.length)return;const X=C.value[g.value],Ne=J(X),me=H1(Ne,i.value,r.value,d.value);if(me===Ne)return;n.saveUndo(),ee(X,me);const Me=g.value;x(),C.value.length>0?(g.value=Math.min(Me,C.value.length-1),F()):g.value=-1,(T=e.emitModelData)==null||T.call(e),(se=e.scheduleRender)==null||se.call(e)}function we(){var Me,T;const X=i.value;if(!X||C.value.length===0)return;n.saveUndo();let Ne=0;const me=C.value.slice();for(const se of me){const ie=J(se),re=W1(ie,X,r.value,d.value);re!==ie&&(ee(se,re),Ne++)}C.value=[],g.value=-1,R.value=b(e.locale.value,"findReplacedAll").replace("{n}",String(Ne)),ne(),(Me=e.emitModelData)==null||Me.call(e),(T=e.scheduleRender)==null||T.call(e)}function xe(){const X=Ne=>{if(!(Ne.ctrlKey||Ne.metaKey))return;const Me=Ne.key.toLowerCase();(Me==="f"||Me==="h")&&(Ne.preventDefault(),ze())};window.addEventListener("keydown",X),t.onBeforeUnmount(()=>window.removeEventListener("keydown",X))}return t.watch(i,()=>{a.value&&(R.value="",g.value=0,$e(!0))}),t.watch([c,d,y],()=>{a.value&&(R.value="",g.value=0,$e(!0))}),t.watch(e.cells,()=>{a.value&&$e(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&c.value==="selection"&&(g.value=0,$e(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{a.value&&$e(!1)}),{open:a,findText:i,replaceText:r,scope:c,matchCase:d,matchEntireCell:y,currentIndex:g,results:C,message:m,focusToken:B,activeSheetMatches:I,activeMatchKey:q,openFind:ze,openReplace:et,close:nt,recompute:x,findNext:F,findPrev:A,replace:Q,replaceAll:we,setupLifecycle:xe}}const U1={class:"formula-bar__cell-label"},K1={class:"formula-bar__buttons"},G1=["title","aria-label"],q1=["rows","value"],Y1=["title"],X1={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},j1={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Z1=["value"],J1={key:2,class:"sb-corner"},Q1=["onClick","onMouseenter"],ep={class:"context-menu__label"},tp={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},lp=["onClick"],np={key:0,class:"cf-modal-mask"},op={key:0,class:"cf-modal-mask"},rp={class:"dim-panel__title"},ap={class:"dim-panel__body"},ip=["value"],sp={key:0,class:"dim-panel__error"},cp={class:"dim-panel__footer"},Wa=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,l=t.useModel(e,"data"),o={value:""},a=M1(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:D=>{},mkSheet:D=>({id:"",name:D,cells:{},merges:{},styles:[{}],borders:[{}],selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[],colCount:0,rowCount:0,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[]})},r=B1(a,i),c=x1(a,r);N1(r,{borderMenuOpen:c.borderMenuOpen,mergeMenuOpen:c.mergeMenuOpen});const d=_1(a,r,l,void 0,o);i.sheets=d.sheets,i.activeSheetIndex=d.activeSheetIndex,i.saveSheet=d.saveSheet,i.loadSheet=d.loadSheet,i.mkSheet=d.mkSheet;const y=$1(a,r,c,d,o);y.setupLifecycle();const g=P1(a,r,d);g.setupLifecycle();const C=t.reactive(a),m=t.reactive(r),B=t.reactive(c),R=t.reactive(d),I=d.sheets,q=d.activeSheetIndex,J=d.sortMenuOpen,ee=d.cachedSortOrder,ne=t.ref(!1),x=t.reactive(y),le=t.reactive(g),ge=t.computed(()=>{const D=C.selection;return!!D&&D.startCol===D.endCol&&D.startRow===D.endRow}),fe=t.computed(()=>{const D=C.selection;return D?d.canSortColumns(D.startCol,D.endCol):!1}),Ce=t.computed(()=>{if(C.getFilter()!==null)return!0;const D=C.selection;if(!D)return!0;const p=Math.min(D.startCol,D.endCol),E=Math.max(D.startCol,D.endCol),be=Math.min(D.startRow,D.endRow),ce=Math.max(D.startRow,D.endRow);for(const Ye in C.merges){const Xe=C.merges[Ye];if(!(Xe.startCol===Xe.endCol&&Xe.startRow===Xe.endRow)&&p<=Xe.endCol&&E>=Xe.startCol&&be<=Xe.endRow&&ce>=Xe.startRow)return!1}return!0}),$e=t.computed(()=>{const D=m.selNumberFormat;if(D!==Pl&&D!==Ql)return D;const p=C.activeCell,E=a.resolveStyle(C.cells[C.cellKey(p.col,p.row)]);return typeof(E==null?void 0:E.numberFormat)=="string"?E.numberFormat:""});function ze(D){r.nfDialogOpen.value=D}const et=t.ref(!1);function nt(){et.value=!0}function F(D){et.value=D}function A(D){y.insertFunctionIntoCell(D)}function Q(){C.toggleAutoFilter(),x.scheduleRender()}function we(D){const p=C.getFilter();return p?C.getCellValue(D,p.range.startRow):""}const xe=t.computed(()=>{const D=C.selection,p=D?D.startRow:C.activeCell.row,E=D?D.startCol:C.activeCell.col;return p===0&&E===0});function X(D){const p=C.freeze;if(D==="panes"){const E=C.selection,be=E?E.startRow:C.activeCell.row,ce=E?E.startCol:C.activeCell.col;C.setFreeze(be,ce)}else D==="firstRow"?C.setFreeze(1,p.cols):D==="firstCol"?C.setFreeze(p.rows,1):D==="unfreeze"&&C.clearFreeze();x.scheduleRender()}const Ne=t.ref(null),me=t.ref(!1),Me=t.ref(!1),T=t.ref(null),se=t.ref("create"),ie=t.computed(()=>{const D=C.selection;if(D){const E=rt(D.startCol)+(D.startRow+1),be=rt(D.endCol)+(D.endRow+1);return D.startCol===D.endCol&&D.startRow===D.endRow?E:`${E}:${be}`}const p=C.activeCell;return rt(p.col)+(p.row+1)});function re(D){var be;let p;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(D)?p={type:"cellIs",operator:D,value:""}:D==="textContains"?p={type:"textContains",value:""}:D==="textNotContains"?p={type:"textNotContains",value:""}:D==="blank"?p={type:"blank"}:D==="notBlank"?p={type:"notBlank"}:D==="duplicate"?p={type:"duplicate"}:D==="unique"?p={type:"unique"}:p={type:"cellIs",operator:"greaterThan",value:""},T.value={id:"",condition:p,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},se.value="create",(be=Ne.value)==null||be.closeOverflow(),Me.value=!0}function K(){var D;T.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},se.value="create",(D=Ne.value)==null||D.closeOverflow(),Me.value=!0}function $(){var D;(D=Ne.value)==null||D.closeOverflow(),me.value=!0}function de(D){C.clearConditionalFormats(D),x.scheduleRender()}function z(D){D.id?C.updateConditionalFormatRule(D.id,D):C.addConditionalFormatRule(D),Me.value=!1}function _(D){var p;T.value=D,se.value="edit",(p=Ne.value)==null||p.closeOverflow(),Me.value=!0}function ae(D){C.removeConditionalFormatRule(D)}function Ke(D,p){C.moveConditionalFormatRule(D,p)}function Fe(D,p){C.updateConditionalFormatRule(D,{enabled:p})}const Le=t.ref(!1),Be=t.ref(null),qe=t.ref("create"),Je=t.computed(()=>{const D=C.selection;if(D){const E=rt(D.startCol)+(D.startRow+1),be=rt(D.endCol)+(D.endRow+1);return D.startCol===D.endCol&&D.startRow===D.endRow?E:`${E}:${be}`}const p=C.activeCell;return rt(p.col)+(p.row+1)}),Te=t.ref(null);let dt=null;function ft(D){return new Promise(p=>{dt=p,Te.value={...D}})}a.showValidationAlert=ft;const Ue=t.ref(null);function N(D){Ue.value=D}function pe(){Ue.value=null}y.showOutlineAlert=N,a.getSheetCellsById=D=>{const p=d.sheets.value.findIndex(E=>E.id===D||E.name===D);return p<0?null:p===d.activeSheetIndex.value?a.cells:d.sheets.value[p].cells},a.requestDataValidationDialog=()=>Ct();function Ct(){var E;const D=C.activeCell,p=a.getDataValidationRule(D.row,D.col);Be.value=p?JSON.parse(JSON.stringify(p)):null,qe.value=p?"edit":"create",(E=Ne.value)==null||E.closeOverflow(),Le.value=!0}function qt(D){if(D.type==="any"){D.ranges.forEach(p=>a.clearDataValidation(p)),Le.value=!1,y.scheduleRender();return}D.id?a.updateDataValidation(D.id,D):a.createDataValidation(D),Le.value=!1,y.scheduleRender()}function Kt(){const D=C.selection;D&&a.clearDataValidation(D),Le.value=!1,y.scheduleRender()}function zt(D){Te.value=null;const p=dt;dt=null,t.nextTick(()=>{const E=C.editingCell;E&&(a.selectCell(E.col,E.row),a.ensureVisible(E.col,E.row),y.scheduleRender(),d.focusEditInput())}),p==null||p(D)}const Rt=t.computed(()=>{const D=C.activeCell,p=a.getValidationInputMessage(D.row,D.col);if(!p)return null;const E=a.cellToScreenRect(D.row,D.col),be=d.wrapperRef.value,ce=be?be.getBoundingClientRect():{left:0,top:0};return{title:p.title,message:p.message,x:ce.left+E.x,y:ce.top+E.y,width:E.width,height:E.height}});function Ut(D){r.fontSizeMenuOpen.value=D}function nl(D){r.textColorMenuOpen.value=D}function bl(D){r.fillColorMenuOpen.value=D}function dl(D){switch(D){case"group-rows":y.outlineGroupRows();break;case"group-cols":y.outlineGroupCols();break;case"ungroup-rows":y.outlineUngroupRows();break;case"ungroup-cols":y.outlineUngroupCols();break;case"expand-all":y.outlineExpandRows(),y.outlineExpandCols();break;case"collapse-all":y.outlineCollapseRows(),y.outlineCollapseCols();break;case"clear":a.clearAllOutlines();break}}function yl(D){y.renTabVal.value=D}function Gt(){y.ctxMenu.value=null}const ol=D=>{d.formulaBarRef.value=D};function wl(){y.formulaBarExpanded.value=!y.formulaBarExpanded.value}const xl=D=>{d.wrapperRef.value=D},H=D=>{d.canvasRef.value=D},W=D=>{d.freezeCanvasRef.value=D},G=D=>{d.editInputRef.value=D},ve=D=>{y.dimInputRef.value=D};return(D,p)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(R.outerStyle)},[t.createVNode(yd,{ref_key:"toolbarRef",ref:Ne,locale:C.locale,"can-undo":m.canUndo,"can-redo":m.canRedo,"paint-fmt-active":m.paintFmt!==null,"has-selection":m.hasSelection,"font-family-options":m.fontFamilyOptions,"font-size-options":m.fontSizeOptions,"sel-font-family":m.selFontFamily,"sel-font-size":m.selFontSize,"font-size-input":m.fontSizeInput,"font-size-menu-open":m.fontSizeMenuOpen,"sel-font-weight":m.selFontWeight,"sel-font-style":m.selFontStyle,"sel-underline":m.selUnderline,"sel-strikethrough":m.selStrikethrough,"sel-text-color":m.selTextColor,"text-color-menu-open":m.textColorMenuOpen,"sel-fill-color":m.selFillColor,"fill-color-menu-open":m.fillColorMenuOpen,"cached-text-color":m.cachedTextColor,"cached-fill-color":m.cachedFillColor,"border-menu-open":B.borderMenuOpen,"cached-border":B.cachedBorder,"sort-menu-open":t.unref(J),"cached-sort-order":t.unref(ee),"can-sort":fe.value,"outline-menu-open":ne.value,"can-filter":Ce.value,"filter-active":C.getFilter()!==null,"h-align-options":m.hAlignOptions,"v-align-options":m.vAlignOptions,"sel-h-align":m.selHAlign,"sel-v-align":m.selVAlign,"sel-wrap":m.selWrap,"merge-menu-open":B.mergeMenuOpen,"calc-menu-open":B.calcMenuOpen,"is-single-cell":ge.value,"has-freeze":C.freeze.rows>0||C.freeze.cols>0,"freeze-panes-disabled":xe.value,"sel-number-format":m.selNumberFormatDisplay,"nf-options":m.nfOptions,"can-increase-decimals":m.canIncreaseDecimals,"can-decrease-decimals":m.canDecreaseDecimals,"theme-vars":R.toolbarThemeVars,onUndo:p[0]||(p[0]=E=>m.undo()),onRedo:p[1]||(p[1]=E=>m.redo()),onPaintFormat:m.onPaintFormat,onClearFormat:p[2]||(p[2]=E=>m.clearFormat()),onNumberFormatChange:p[3]||(p[3]=E=>m.onNumberFormatChange(E)),onIncreaseDecimals:m.onIncreaseDecimals,onDecreaseDecimals:m.onDecreaseDecimals,onFontFamilyChange:p[4]||(p[4]=E=>m.onFontFamilyChange(E)),onFontSizeInput:p[5]||(p[5]=E=>m.onFontSizeInput(E)),onFontSizeBlur:m.onFontSizeBlur,onFontSizeKeydown:p[6]||(p[6]=E=>m.onFontSizeKeydown(E)),onFontSizeChange:p[7]||(p[7]=E=>m.onFontSizeChange(E)),"onUpdate:fontSizeMenuOpen":p[8]||(p[8]=E=>Ut(E)),onFontSizeToggle:p[9]||(p[9]=E=>m.toggleFontSizeMenu()),onFontSizeStepUp:m.onFontSizeStepUp,onFontSizeStepDown:m.onFontSizeStepDown,onBoldToggle:m.toggleFontWeight,onItalicToggle:m.toggleFontStyle,onUnderlineToggle:m.toggleUnderline,onStrikethroughToggle:m.toggleStrikethrough,onTextColorChange:p[10]||(p[10]=E=>m.onTextColorChange(E)),"onUpdate:textColorMenuOpen":p[11]||(p[11]=E=>nl(E)),onFillColorChange:p[12]||(p[12]=E=>m.onFillColorChange(E)),"onUpdate:fillColorMenuOpen":p[13]||(p[13]=E=>bl(E)),onApplyTextColor:m.applyCachedTextColor,onApplyFillColor:m.applyCachedFillColor,"onUpdate:borderMenuOpen":p[14]||(p[14]=E=>m.onBorderMenuToggle(E)),onBorderChange:p[15]||(p[15]=E=>B.onBorderChange(E)),onApplyBorder:B.applyCachedBorder,"onUpdate:sortMenuOpen":p[16]||(p[16]=E=>R.onSortMenuToggle(E)),onSortChange:p[17]||(p[17]=E=>R.onSortChange(E)),onApplySort:R.applyCachedSort,"onUpdate:outlineMenuOpen":p[18]||(p[18]=E=>ne.value=E),onOutlineAction:p[19]||(p[19]=E=>dl(E)),onToggleFilter:Q,onFreezeChange:p[20]||(p[20]=E=>X(E)),onHAlignChange:p[21]||(p[21]=E=>m.onHAlignChange(E)),onVAlignChange:p[22]||(p[22]=E=>m.onVAlignChange(E)),onWrapToggle:m.onWrapToggle,"onUpdate:mergeMenuOpen":p[23]||(p[23]=E=>B.onMergeMenuToggle(E)),onMergeChange:p[24]||(p[24]=E=>B.onMergeChange(E)),onApplyMerge:B.onApplyMerge,"onUpdate:calcMenuOpen":p[25]||(p[25]=E=>B.onCalcMenuToggle(E)),onCalcSum:B.onCalcSum,onCalcAvg:B.onCalcAvg,onCalcCount:B.onCalcCount,onFind:p[26]||(p[26]=E=>t.unref(g).openFind()),onCfPreset:p[27]||(p[27]=E=>re(E)),onCfNewRule:K,onCfManage:$,onCfClear:p[28]||(p[28]=E=>de(E)),onOpenDataValidation:Ct},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","sort-menu-open","cached-sort-order","can-sort","outline-menu-open","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","has-freeze","freeze-panes-disabled","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","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(qd,{open:le.open,"find-text":le.findText,"replace-text":le.replaceText,scope:le.scope,"match-case":le.matchCase,"match-entire-cell":le.matchEntireCell,"current-index":le.currentIndex,total:le.results.length,message:le.message,"focus-token":le.focusToken,locale:C.locale,"theme-vars":R.toolbarThemeVars,"onUpdate:findText":p[29]||(p[29]=E=>t.unref(g).findText.value=E),"onUpdate:replaceText":p[30]||(p[30]=E=>t.unref(g).replaceText.value=E),"onUpdate:scope":p[31]||(p[31]=E=>t.unref(g).scope.value=E),"onUpdate:matchCase":p[32]||(p[32]=E=>t.unref(g).matchCase.value=E),"onUpdate:matchEntireCell":p[33]||(p[33]=E=>t.unref(g).matchEntireCell.value=E),onPrev:p[34]||(p[34]=E=>t.unref(g).findPrev()),onNext:p[35]||(p[35]=E=>t.unref(g).findNext()),onReplace:p[36]||(p[36]=E=>t.unref(g).replace()),onReplaceAll:p[37]||(p[37]=E=>t.unref(g).replaceAll()),onClose:p[38]||(p[38]=E=>t.unref(g).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(Cu,{"model-open":m.nfDialogOpen,locale:C.locale,"current-format":$e.value,"is-custom":m.selNumberFormat===t.unref(Ql),"onUpdate:modelOpen":p[39]||(p[39]=E=>ze(E)),onApply:p[40]||(p[40]=E=>m.applyNumberFormatCode(E))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(xu,{"model-open":R.sortConfirmOpen,locale:C.locale,"onUpdate:modelOpen":p[41]||(p[41]=E=>R.sortConfirmOpen=E),onConfirm:p[42]||(p[42]=E=>R.confirmSort(E)),onCancel:p[43]||(p[43]=E=>R.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(qu,{"model-open":et.value,locale:C.locale,"onUpdate:modelOpen":p[44]||(p[44]=E=>F(E)),onInsert:p[45]||(p[45]=E=>A(E))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":x.formulaBarExpanded}])},[t.createElementVNode("div",U1,t.toDisplayString(x.activeCellLabel),1),t.createElementVNode("div",K1,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:p[46]||(p[46]=t.withModifiers(()=>{},["prevent"])),onClick:p[47]||(p[47]=t.withModifiers((...E)=>x.cancelFormulaBarEdit&&x.cancelFormulaBarEdit(...E),["stop"]))},[...p[107]||(p[107]=[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:p[48]||(p[48]=t.withModifiers(()=>{},["prevent"])),onClick:p[49]||(p[49]=t.withModifiers((...E)=>x.acceptFormulaBarEdit&&x.acceptFormulaBarEdit(...E),["stop"]))},[...p[108]||(p[108]=[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("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(b)(C.locale,"insertFunctionTitle"),"aria-label":t.unref(b)(C.locale,"insertFunctionTitle"),onMousedown:p[50]||(p[50]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(nt,["stop"])},[...p[109]||(p[109]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,G1)]),t.createElementVNode("textarea",{ref:ol,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":x.formulaBarExpanded}]),rows:x.formulaBarExpanded?3:1,value:x.formulaBarDisplay,spellcheck:"false",onFocus:p[51]||(p[51]=(...E)=>x.onFormulaBarFocus&&x.onFormulaBarFocus(...E)),onInput:p[52]||(p[52]=(...E)=>x.onFormulaBarInput&&x.onFormulaBarInput(...E)),onKeydown:p[53]||(p[53]=(...E)=>x.onFormulaBarKeydown&&x.onFormulaBarKeydown(...E)),onBlur:p[54]||(p[54]=(...E)=>x.onFormulaBarBlur&&x.onFormulaBarBlur(...E))},null,42,q1),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:x.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:p[55]||(p[55]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(wl,["stop"])},[x.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",j1,[...p[111]||(p[111]=[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",X1,[...p[110]||(p[110]=[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,Y1)],2),t.createElementVNode("div",{ref:xl,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:H,class:"grid-canvas",tabindex:"0",onMousedown:p[56]||(p[56]=(...E)=>x.onMouseDown&&x.onMouseDown(...E)),onMousemove:p[57]||(p[57]=(...E)=>x.onMouseMove&&x.onMouseMove(...E)),onMouseup:p[58]||(p[58]=(...E)=>x.onMouseUp&&x.onMouseUp(...E)),onMouseleave:p[59]||(p[59]=(...E)=>x.onMouseLeave&&x.onMouseLeave(...E)),onDblclick:p[60]||(p[60]=(...E)=>x.onDblClick&&x.onDblClick(...E)),onWheel:p[61]||(p[61]=t.withModifiers((...E)=>x.onWheel&&x.onWheel(...E),["prevent"])),onFocus:p[62]||(p[62]=(...E)=>R.onCanvasFocus&&R.onCanvasFocus(...E)),onKeydown:p[63]||(p[63]=(...E)=>x.onKeydown&&x.onKeydown(...E)),onContextmenu:p[64]||(p[64]=(...E)=>x.onCanvasCtx&&x.onCanvasCtx(...E)),onTouchstart:p[65]||(p[65]=t.withModifiers((...E)=>x.onTouchStart&&x.onTouchStart(...E),["prevent"])),onTouchmove:p[66]||(p[66]=t.withModifiers((...E)=>x.onTouchMove&&x.onTouchMove(...E),["prevent"])),onTouchend:p[67]||(p[67]=(...E)=>x.onTouchEnd&&x.onTouchEnd(...E))},null,32),t.createElementVNode("canvas",{ref:W,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:G,class:"cell-editor",value:C.editValue,style:t.normalizeStyle(x.editInputStyle),onInput:p[68]||(p[68]=(...E)=>x.onEditInput&&x.onEditInput(...E)),onKeydown:p[69]||(p[69]=(...E)=>x.onEditKd&&x.onEditKd(...E)),onCompositionstart:p[70]||(p[70]=(...E)=>x.onEditCompositionStart&&x.onEditCompositionStart(...E)),onCompositionend:p[71]||(p[71]=(...E)=>x.onEditCompositionEnd&&x.onEditCompositionEnd(...E)),onBlur:p[72]||(p[72]=(...E)=>x.onEditBlur&&x.onEditBlur(...E)),onPaste:p[73]||(p[73]=(...E)=>x.onEditPaste&&x.onEditPaste(...E))},null,44,Z1),R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:x.vScrollbarTop+"px",height:`calc(100% - ${x.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:p[74]||(p[74]=t.withModifiers(E=>{R.clampScroll(null,C.scrollY-50),x.scheduleRender()},["prevent"]))},[...p[112]||(p[112]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:p[76]||(p[76]=(...E)=>x.onVTrk&&x.onVTrk(...E))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:x.vThumbT+"px",height:x.vThumbH+"px"}),onMousedown:p[75]||(p[75]=(...E)=>x.onVStart&&x.onVStart(...E))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:p[77]||(p[77]=t.withModifiers(E=>{R.clampScroll(null,C.scrollY+50),x.scheduleRender()},["prevent"]))},[...p[113]||(p[113]=[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:x.hScrollbarLeft+"px",width:`calc(100% - ${x.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:p[78]||(p[78]=t.withModifiers(E=>{R.clampScroll(C.scrollX-50,null),x.scheduleRender()},["prevent"]))},[...p[114]||(p[114]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:p[80]||(p[80]=(...E)=>x.onHTrk&&x.onHTrk(...E))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:x.hThumbL+"px",width:x.hThumbW+"px"}),onMousedown:p[79]||(p[79]=(...E)=>x.onHStart&&x.onHStart(...E))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:p[81]||(p[81]=t.withModifiers(E=>{R.clampScroll(C.scrollX+50,null),x.scheduleRender()},["prevent"]))},[...p[115]||(p[115]=[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",J1)):t.createCommentVNode("",!0)]),t.createVNode(Vd,{locale:C.locale,sheets:t.unref(I),"active-sheet-index":t.unref(q),"ren-tab":x.renTab,"ren-tab-val":x.renTabVal,onTabClick:p[82]||(p[82]=E=>x.onTabClick(E)),onTabDblclick:p[83]||(p[83]=E=>x.onTabDblClick(E)),onTabContextmenu:p[84]||(p[84]=E=>x.onTabCtxMenu(E.ev,E.i)),onTabRenameInput:p[85]||(p[85]=E=>yl(E)),onTabRenameKeydown:p[86]||(p[86]=E=>x.onTabRenameKd(E)),onTabRenameCommit:x.commitTabRename,onTabbarContextmenu:p[87]||(p[87]=E=>x.onTabBarCtx(E)),onDeleteSheet:p[88]||(p[88]=E=>{R.removeSheet(E),x.scheduleRender()}),onAddSheet:p[89]||(p[89]=E=>{R.addSheet(),x.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(()=>[x.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:x.ctxMenu.x+"px",top:x.ctxMenu.y+"px"}),onClick:p[90]||(p[90]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.ctxMenu.items,(E,be)=>(t.openBlock(),t.createElementBlock("div",{key:be,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":E.disabled}]),onClick:ce=>!E.disabled&&E.action&&(E.action(),Gt()),onMouseenter:ce=>x.onCtxItemEnter(ce,E)},[t.createElementVNode("span",ep,t.toDisplayString(E.label),1),E.children?(t.openBlock(),t.createElementBlock("svg",tp,[...p[116]||(p[116]=[t.createElementVNode("path",{d:"M361.386667 180.053333a32 32 0 0 0 0 45.226667L648.106667 512l-286.72 286.72a32 32 0 1 0 45.226666 45.226667l309.333334-309.333334a32 32 0 0 0 0-45.226666L406.613333 180.053333a32 32 0 0 0-45.226666 0z","p-id":"22870"},null,-1)])])):t.createCommentVNode("",!0),E.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":x.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.children,(ce,Ye)=>(t.openBlock(),t.createElementBlock("div",{key:Ye,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":ce.disabled}]),onClick:t.withModifiers(Xe=>!ce.disabled&&ce.action&&(ce.action(),Gt()),["stop"])},t.toDisplayString(ce.label),11,lp))),128))],2)):t.createCommentVNode("",!0)],42,Q1))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),x.filterPopup?(t.openBlock(),t.createBlock(wf,{key:x.filterPopup.col,col:x.filterPopup.col,"header-label":we(x.filterPopup.col),anchor:{x:x.filterPopup.x,y:x.filterPopup.y},locale:C.locale,"get-filter":C.getFilter,"set-filter":C.setFilter,"set-filter-column":C.setFilterColumn,"clear-filter-column":C.clearFilterColumn,"get-column-candidates":C.getColumnCandidates,close:x.closeFilterPopup},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[me.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[92]||(p[92]=t.withModifiers(E=>me.value=!1,["self"]))},[t.createVNode(Of,{locale:C.locale,rules:C.conditionalFormats,"theme-vars":R.toolbarThemeVars,onNew:K,onEdit:_,onDelete:ae,onMove:Ke,onToggle:Fe,onClose:p[91]||(p[91]=E=>me.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Me.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[94]||(p[94]=t.withModifiers(E=>Me.value=!1,["self"]))},[t.createVNode(vm,{locale:C.locale,mode:se.value,rule:T.value,"default-range-text":ie.value,"theme-vars":R.toolbarThemeVars,onSave:z,onCancel:p[93]||(p[93]=E=>Me.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),x.validationDropdown?(t.openBlock(),t.createBlock(F0,{key:`${x.validationDropdown.col},${x.validationDropdown.row}`,items:x.validationDropdown.items,current:x.validationDropdown.current,locale:C.locale,x:x.validationDropdown.x,y:x.validationDropdown.y,width:x.validationDropdown.width,height:x.validationDropdown.height,onSelect:p[95]||(p[95]=E=>t.unref(y).onValidationDropdownSelect(E)),onClose:p[96]||(p[96]=E=>t.unref(y).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height"])):t.createCommentVNode("",!0),Rt.value?(t.openBlock(),t.createBlock(U0,{key:2,title:Rt.value.title,message:Rt.value.message,x:Rt.value.x,y:Rt.value.y,width:Rt.value.width,height:Rt.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Le.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[98]||(p[98]=t.withModifiers(E=>Le.value=!1,["self"]))},[t.createVNode(R0,{locale:C.locale,mode:qe.value,rule:Be.value,"default-range-text":Je.value,"theme-vars":R.toolbarThemeVars,onSave:qt,onClear:Kt,onCancel:p[97]||(p[97]=E=>Le.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Te.value?(t.openBlock(),t.createElementBlock("div",np,[t.createVNode(oa,{locale:C.locale,severity:Te.value.severity,title:Te.value.title,message:Te.value.message,"theme-vars":R.toolbarThemeVars,onResolve:zt},null,8,["locale","severity","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Ue.value?(t.openBlock(),t.createElementBlock("div",op,[t.createVNode(oa,{locale:C.locale,severity:"information",title:t.unref(b)(C.locale,"outlineAlertTitle"),message:Ue.value,"theme-vars":R.toolbarThemeVars,onResolve:pe},null,8,["locale","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[x.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:x.dimPanel.x+"px",top:x.dimPanel.y+"px"}),onMousedown:p[104]||(p[104]=t.withModifiers(()=>{},["stop"])),onTouchstart:p[105]||(p[105]=t.withModifiers(()=>{},["stop"])),onClick:p[106]||(p[106]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",rp,t.toDisplayString(x.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",ap,[t.createElementVNode("input",{ref:ve,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":x.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:x.dimPanel.value,onInput:p[99]||(p[99]=(...E)=>x.onDimInput&&x.onDimInput(...E)),onKeydown:p[100]||(p[100]=(...E)=>x.onDimKeydown&&x.onDimKeydown(...E)),onBlur:p[101]||(p[101]=(...E)=>x.onDimBlur&&x.onDimBlur(...E))},null,42,ip)]),x.dimPanel.error?(t.openBlock(),t.createElementBlock("div",sp,t.toDisplayString(x.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",cp,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:p[102]||(p[102]=(...E)=>x.applyDimPanel&&x.applyDimPanel(...E))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:p[103]||(p[103]=(...E)=>x.closeDimPanel&&x.closeDimPanel(...E))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-1dc53ecd"]]);un.Spreader=Wa,un.default=Wa,Object.defineProperties(un,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});