xiaodao-spreader 0.1.43 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ZH.md +60 -7
- package/README.md +60 -7
- package/dist/style.css +1 -1
- package/dist/types/components/spreader/components/dropdown.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/find-replace-bar.vue.d.ts +1 -0
- package/dist/types/components/spreader/components/pickers/conditional-format-manager.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/conditional-format-rule-editor.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/data-validation-dialog.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/data-validation-input-message.vue.d.ts +0 -5
- package/dist/types/components/spreader/components/pickers/insert-function-dialog.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/number-format-dialog.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/pickers/sort-confirm-dialog.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/spreader.vue.d.ts +5 -0
- package/dist/types/components/spreader/components/tabbar.vue.d.ts +2 -0
- package/dist/types/components/spreader/components/toolbar.vue.d.ts +2 -0
- package/dist/types/components/spreader/composables/core-state.d.ts +5 -0
- package/dist/types/components/spreader/composables/sheets-ops.d.ts +0 -1
- package/dist/types/components/spreader/core/theme.d.ts +6 -4
- package/dist/types/components/spreader/index.d.ts +1 -0
- package/dist/xiaodao-spreader.es.js +8575 -8356
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(ko,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(ko=typeof globalThis<"u"?globalThis:ko||self,t(ko.XiaoDaoSpreader={},ko.Vue))})(this,function(ko,t){"use strict";const Zr="",xi={"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:"取消",accept:"接受",formulaBarAccept:"接受(Enter)",formulaBarCancel:"取消(Esc)",formulaBarExpand:"展开为3行",formulaBarCollapse:"折叠为1行",searchNoMatch:"无匹配",emptyCellLabel:"(空)",cfRangeInvalid:"范围格式无效,例如 A1:B10",cfFormulaRequired:"请输入公式",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:"墨绿",colorPurple:"紫色",colorCyan:"青色",borderColor:"边框颜色",borderLineStyle:"边框线型",lineSolid:"实线",lineDashed:"虚线",lineDotted:"点线",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:"自定义筛选",filterBack:"返回",filterDateHint:"支持日期格式:YYYY-MM-DD、YYYY/MM/DD、YYYY年M月D日",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",outlineGroup:"分组",outlineAddGroup:"添加分组",outlineRows:"行分组",outlineColumns:"列分组",outlineAddRowGroup:"添加行分组",outlineAddColumnGroup:"添加列分组",outlineUngroup:"取消分组",outlineUngroupRows:"取消行分组",outlineUngroupColumns:"取消列分组",outlineClear:"清除分组",outlineClearAll:"清除全部分组",outlineExpand:"展开",outlineCollapse:"折叠",outlineExpandAll:"全部展开",outlineCollapseAll:"全部折叠",outlineRowsLabel:"行",outlineColumnsLabel:"列",outlineLevel:"级别",outlineLevelLabel:"等级",outlineNeedRowsOrColumns:"请选择整行或整列后分组",outlineInvalidRange:"无效的分组范围:分组至少需要连续 2 个行或列",outlineCrossing:"分组范围与现有分组交叉,请调整",outlineTooDeep:"分组不能嵌套,仅支持一层",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:"填充颜色",note:"批注",newNote:"新建批注",editNote:"编辑批注",deleteNote:"删除批注",noteSave:"保存",noteAuthor:"作者",noteUnnamed:"未命名",noteEmpty:"(无内容)",notePlaceholder:"输入批注内容…",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",accept:"Accept",formulaBarAccept:"Accept (Enter)",formulaBarCancel:"Cancel (Esc)",formulaBarExpand:"Expand to 3 rows",formulaBarCollapse:"Collapse to 1 row",searchNoMatch:"No matches",emptyCellLabel:"(blank)",cfRangeInvalid:"Invalid range format, e.g. A1:B10",cfFormulaRequired:"Please enter a formula",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",colorPurple:"Purple",colorCyan:"Cyan",borderColor:"Border Color",borderLineStyle:"Line Style",lineSolid:"Solid",lineDashed:"Dashed",lineDotted:"Dotted",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",filterBack:"Back",filterDateHint:"Date formats: YYYY-MM-DD, YYYY/MM/DD, YYYY/M/D",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",outlineGroup:"Group",outlineAddGroup:"Add 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:"Groups cannot be nested; single level only",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",note:"Note",newNote:"New Note",editNote:"Edit Note",deleteNote:"Delete Note",noteSave:"Save",noteAuthor:"Author",noteUnnamed:"Unnamed",noteEmpty:"(Empty)",notePlaceholder:"Enter note text…",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 g(e,l){var n;return((n=xi[e])==null?void 0:n[l])??l}const Vo='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',uo=16,Ti=[{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'}],Vi=[{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}],Di='<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>',Fi='<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>',Oi='<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>',Ii='<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>',Ai='<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>',Li='<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>',$i=[{value:"left",labelKey:"alignLeft",icon:Di},{value:"center",labelKey:"alignCenter",icon:Fi},{value:"right",labelKey:"alignRight",icon:Oi}],zi=[{value:"top",labelKey:"alignTop",icon:Ii},{value:"middle",labelKey:"alignMiddle",icon:Ai},{value:"bottom",labelKey:"alignBottom",icon:Li}],_i=[{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>'}],Hi={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",toolbarTextSecondary:"#666",toolbarTextMuted:"#999",toolbarItemActiveBg:"#e5f1fb",dangerHoverBg:"#fce8e6",findHintColor:"#888",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},Jr={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(0,0,0,0.25)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",toolbarTextSecondary:"#aaa",toolbarTextMuted:"#888",toolbarItemActiveBg:"rgba(78, 161, 255, 0.16)",dangerHoverBg:"rgba(197, 34, 31, 0.18)",findHintColor:"#aaa",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"};function yt(e){let l="",n=e;do l=String.fromCharCode(65+n%26)+l,n=Math.floor(n/26)-1;while(n>=0);return l}function tr(e){let l=0;for(let n=0;n<e.length;n++)l=l*26+(e.toUpperCase().charCodeAt(n)-64);return l-1}function Do(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const l=parseFloat(e);return e.endsWith("%")||isNaN(l)?null:l}return null}function nr(e){navigator.clipboard.writeText(e).catch(()=>{const l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select(),document.execCommand("copy"),document.body.removeChild(l)})}function Po(e,l){return`${e},${l}`}function Sn(e,l,n){const o=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!o)return null;const a=tr(o[1]),i=parseInt(o[2],10)-1;return a<0||a>=l||i<0||i>=n?null:{col:a,row:i}}function Eo(e,l){if(!l)return{x:0,y:0};const n=l.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Fn(e){const l=window.innerWidth,n=window.innerHeight,o=(e==null?void 0:e.getBoundingClientRect())??null;return o?{left:Math.max(0,Math.min(l,o.left)),right:Math.max(0,Math.min(l,o.right)),top:Math.max(0,Math.min(n,o.top)),bottom:Math.max(0,Math.min(n,o.bottom))}:{left:0,right:l,top:0,bottom:n}}function Fo(e){return window.innerWidth-e}const fo="__nf_custom__",Qn="",mo="",On="@",Sl="__NF_INVALID__",or=2958465,lr=0;function In(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function rr(e){return e==="zh-CN"?"¥":"$"}function Wi(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Qr(e){return e.replace(/"([^"]*)"/g,"$1")}function Ui(e){let l=e,n;const o=l.match(/^\[([^\]]+)\]/);o&&(n=o[1].toLowerCase(),l=l.slice(o[0].length)),l=Wi(l);const a=/E[+-]/i.test(l),i=l.includes("%"),r=l.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:l,suffix:"",color:n};let c=-1;for(let pe=l.length-1;pe>=0;pe--){const Ee=l[pe];if(Ee==="0"||Ee==="#"||Ee==="?"||Ee==="E"){c=pe;break}}c<0&&(c=r);const s=r>0?l.slice(0,r):"",y=c<l.length-1?l.slice(c+1):"",h=l.slice(r,c+1),R=/[0#?]/.test(h),f=h.includes(",");let k=h.replace(/,/g,"");if(a){const pe=k.search(/E/i);pe>=0&&(k=k.slice(0,pe))}const N=k.indexOf("."),Y=N>=0?k.slice(0,N):k,te=N>=0?k.slice(N+1):"",me=(te.match(/[0#?]/g)||[]).length,he=(te.match(/0/g)||[]).length,Te=(Y.match(/0/g)||[]).length;return{hasDigits:R,decimals:me,minDecimals:he,minIntDigits:Te,thousands:f,scale:i?100:1,scientific:a,prefix:s,suffix:y,color:n}}function Pi(e){const l=[];let n=!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]":n=!0,l.push({type:"hour",len:0});break;case"[mm]":n=!0,l.push({type:"minute",len:2});break;case"[ss]":n=!0,l.push({type:"second",len:2});break;case"yyyy":l.push({type:"year",len:4});break;case"yy":case"y":l.push({type:"year",len:2});break;case"mmmm":l.push(n?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":l.push(n?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":l.push(n?{type:"minute",len:2}:{type:"month",len:2});break;case"m":l.push(n?{type:"minute",len:1}:{type:"month",len:1});break;case"dddd":l.push({type:"weekday",len:4});break;case"ddd":l.push({type:"weekday",len:3});break;case"dd":l.push({type:"day",len:2});break;case"d":l.push({type:"day",len:1});break;case"hh":l.push({type:"hour",len:2});break;case"h":l.push({type:"hour",len:1});break;case"ss":l.push({type:"second",len:2});break;case"s":l.push({type:"second",len:1});break;case"AM/PM":case"am/pm":l.push({type:"ampm",len:2});break;default:i.startsWith('"')?l.push({type:"literal",text:Qr(i),len:0}):l.push({type:"literal",text:i,len:0})}}return{tokens:l,isDuration:n}}const ea=new Map;function Ki(e){const l=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(l)||/AM\/PM/i.test(l)||/\[h\]/i.test(l)){const i=e.split(";")[0]??e,{tokens:r,isDuration:c}=Pi(i);return{kind:c?"duration":"date",sections:[],tokens:r,isDuration:c,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Ui(i)),tokens:[],isDuration:!1,raw:e}}function po(e){const l=ea.get(e);if(l)return l;const n=Ki(e);return ea.set(e,n),n}function ta(e,l,n,o,a){const i=Math.pow(10,l),r=Math.round((e+Number.EPSILON)*i)/i,c=r<0,s=Math.abs(r);let h=new Intl.NumberFormat("en-US",{useGrouping:o,minimumIntegerDigits:a,minimumFractionDigits:l,maximumFractionDigits:l}).format(s);if(n<l&&l>0){const f=h.indexOf(".");if(f>=0){const E=h.substring(0,f);let k=h.substring(f+1);k=k.replace(/0+$/,""),k.length<n&&(k=k+"0".repeat(n-k.length)),h=k?`${E}.${k}`:E}}return`${c?"-":""}${h}`}function na(e,l){if(e===0)return(l>0?"0."+"0".repeat(l):"0")+"E+00";const n=Math.floor(Math.log10(Math.abs(e))),o=e/Math.pow(10,n),a=ta(o,l,l,!1,1),i=(n>=0?"+":"-")+String(Math.abs(n)).padStart(2,"0");return`${a}E${i}`}function Gi(e,l,n){if(!n.hasDigits)return Qr(n.prefix+n.suffix);const o=n.scale===100?e*100:e,a=n.scientific?na(o,n.decimals):ta(o,n.decimals,n.minDecimals,n.thousands,n.minIntDigits);return l+n.prefix+a+n.suffix}function qi(e,l){const n=l.sections;if(n.length===0)return String(e);let o,a,i="";return e>0?(o=n[0],a=e):e<0?n[1]?(o=n[1],a=-e):(o=n[0],a=-e,i="-"):(o=n[2]??n[0],a=0),Gi(a,i,o)}function Yi(e){return new Date((e-25569)*864e5)}const ji=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Xi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],oa=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Zi=["January","February","March","April","May","June","July","August","September","October","November","December"],Ji=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],la=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Ko(e,l){return String(e).padStart(l,"0")}function Qi(e,l,n,o){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),c=e.getUTCDay(),s=n==="zh-CN";let y="",h=!1;for(const R of l)switch(R.type){case"literal":y+=R.text??"";break;case"year":y+=R.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":y+=Ko(h?e.getUTCMinutes():i,R.len);break;case"monthName":y+=R.len>=4?s?ji[i-1]:Zi[i-1]:s?Xi[i-1]:Ji[i-1];break;case"day":y+=Ko(r,R.len);break;case"weekday":y+=R.len>=4?s?oa[c]:la[c]:s?oa[c].slice(2):la[c].slice(0,3);break;case"hour":{let f=e.getUTCHours();if(R.len===0){const E=Math.floor(o*86400);f=Math.floor(E/3600)}y+=String(f),h=!0;break}case"minute":y+=Ko(e.getUTCMinutes(),R.len);break;case"second":y+=Ko(e.getUTCSeconds(),R.len);break;case"ampm":{const f=e.getUTCHours();y+=f<12?s?"上午":"AM":s?"下午":"PM";break}}return y}function es(e,l){const n=Math.floor(e*86400),o=Math.floor(n/3600),a=Math.floor(n%3600/60),i=n%60;let r="";for(const c of l)switch(c.type){case"literal":r+=c.text??"";break;case"hour":r+=String(o);break;case"minute":r+=Ko(a,c.len||2);break;case"second":r+=Ko(i,c.len||2);break;default:r+=""}return r}function ts(e){if(e==="")return e;const l=Number(e);if(!isNaN(l)&&e.trim()!==""){const n=Math.abs(l);return n!==0&&(n>=1e15||n<1e-9)?na(l,9):e}return e}function _n(e,l,n){if(In(l))return ts(e);if(l==null||l===On)return e;const o=po(l);if(o.kind==="date"||o.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(o.kind==="date"){if(i<lr||i>or)return Sl}else if(i<0)return Sl;return o.kind==="duration"?es(i,o.tokens):Qi(Yi(i),o.tokens,n,i)}const a=Number(e);return isNaN(a)?e:qi(a,o)}const ns=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function ar(e,l){if(l===On||l==="@")return!1;if(In(l)){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}const n=po(l);return!!(n.kind==="number"&&ra(n))}function ra(e){return e.sections.some(l=>l.hasDigits)}function aa(e){if(e==null||In(e)||e===On||e==="@")return!1;const l=po(e);return!!(l.kind==="date"||l.kind==="duration"||l.kind==="number"&&ra(l))}function ia(e,l){if(l==null||In(l)||l===On||l==="@")return!1;const n=po(l),o=Number(e);return Number.isFinite(o)?n.kind==="date"?o<lr||o>or:n.kind==="duration"?o<0:!1:!1}const ir=30,sr=0;function Hn(e){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}function sa(e,l){if(e==null||e===Qn||In(e))return Hn(l);if(e===On)return!1;const n=po(e);return n.kind==="date"||n.kind==="duration"?!1:n.sections.some(o=>o.hasDigits)}function os(e){if(!Hn(e))return 0;const l=String(Number(e));return l.indexOf(".")<0||/e/i.test(l)?0:l.slice(l.indexOf(".")+1).length}function ls(e,l){if(!sa(e,l))return-1;if(e==null||e===Qn||In(e))return os(l);const o=po(e).sections.find(a=>a.hasDigits);return o?o.decimals:-1}function rs(e,l){let n=0;const o=/\[[^\]]*\]/g;let a;for(;(a=o.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)n=a.index+a[0].length;const i=e.slice(0,n),r=e.slice(n),c=r.search(/[0#?]/);if(c===-1)return e;let s=-1;for(let Y=r.length-1;Y>=0;Y--){const te=r[Y];if(te==="0"||te==="#"||te==="?"||te==="E"){s=Y;break}}if(s<c)return e;const y=r.slice(c,s+1),h=y.search(/E[+-]/i),R=h>=0?y.slice(0,h):y,f=R.indexOf("."),E=f>=0?(R.slice(f+1).match(/[0#?]/g)||[]).length:0;if(E===l)return e;let k;if(f<0)k=l>0?R+"."+"0".repeat(l):R;else if(l>E)k=R+"0".repeat(l-E);else{let Y=E-l;const te=R.split("");for(let me=te.length-1;me>=0&&Y>0;me--){const he=te[me];(he==="0"||he==="#"||he==="?")&&(te.splice(me,1),Y--)}k=te.join(""),l===0&&k.endsWith(".")&&(k=k.slice(0,-1))}const N=k+(h>=0?y.slice(h):"");return i+r.slice(0,c)+N+r.slice(s+1)}function as(e,l){if(!Number.isInteger(l)||l<sr||l>ir||e===Qn)return null;if(e==null||In(e))return l>0?"0."+"0".repeat(l):"0";if(e===On)return null;const n=po(e);return n.kind==="date"||n.kind==="duration"||!n.sections.some(o=>o.hasDigits)?null:e.split(";").map(o=>rs(o,l)).join(";")}const cr=["¥","$","€","£"];function ca(e,l){if(e==null||e===Qn)return e??mo;if(In(e))return mo;if(e===On||e==="@")return On;const n=rr(l),o=l==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=l==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",i=`${n}#,##0.00;(${n}#,##0.00);${n}"-"`,r="#,##0.00;[Red](#,##0.00)";if(da(l).some(E=>E.value===e))return e;const s=e.replace(/\[[^\]]*\]/gi,E=>/^\[(h|mm|ss)\]$/i.test(E)?E:"");if(/\[(h|mm|ss)\]/i.test(s)&&!/[yd]/i.test(s))return"[h]:mm:ss";const y=/[yd]/i.test(s),h=/h|s|AM\/PM/i.test(s);if(y&&h)return a;if(y||/AM\/PM/i.test(s))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 R=cr.find(E=>e.startsWith(E));if(R)return e.includes("(")?i:/\.\d/.test(e.slice(R.length))?n+"#,##0.00":n+"#,##0";const f=po(e);return f.kind==="number"&&f.sections.some(E=>E.hasDigits)?"#,##0.00":fo}function is(e,l){return new Date(Date.UTC(e,l,0)).getUTCDate()}function ss(e,l,n){const o=Date.UTC(e,l-1,n)/864e5+25569;return o<=60?o-1:o}function eo(e,l,n=new Date){const o=e.trim();if(!o||o.startsWith("=")||Hn(o))return null;const a=l==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=l==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function c(f){const E=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(f);if(!E)return null;const k=Number(E[1]),N=Number(E[2]),Y=E[3]!==void 0?Number(E[3]):0;return k>23||N>59||Y>59?null:(k*3600+N*60+Y)/86400}function s(f){let E=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(f),k,N,Y;if(E)k=Number(E[1]),N=Number(E[2]),Y=Number(E[3]);else if(E=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(f))k=Number(E[1]),N=Number(E[2]),Y=Number(E[3]);else if(E=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(f))N=Number(E[1]),Y=Number(E[2]),k=Number(E[3]);else if(E=/^(\d{1,2})[-/](\d{1,2})$/.exec(f))k=n.getUTCFullYear(),N=Number(E[1]),Y=Number(E[2]);else return null;if(k<1900||k>9999||N<1||N>12||Y<1||Y>is(k,N))return null;const te=ss(k,N,Y);return te>=lr&&te<=or?te:null}const y=c(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 f=s(h[1].trim()),E=c(h[2]);if(f!==null&&E!==null)return{serial:f+E,format:i}}const R=s(o);return R!==null?{serial:R,format:a}:null}function Ml(e,l){const n=e.trim();if(!n||n.startsWith("=")||!(n.includes(",")||n.includes("%")||cr.some(me=>n.startsWith(me)))||eo(n,l))return null;const a=cr.find(me=>n.startsWith(me)),i=a?n.slice(a.length).trim():n;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,s=r[2].replace(/,/g,""),y=r[3],h=(r[4]??"")==="%",R=y?y.length:0,f=+(s+(y?"."+y:""));if(!Number.isFinite(f))return null;const k=i.includes(",")?"#,##0":"0",N=R>0?"."+"0".repeat(R):"",Y=(a??"")+k+N+(h?"%":"");let te=f*c;return h&&(te=te/100),te=Math.round(te*1e12)/1e12,{num:te,format:Y}}function cs(e,l,n,o){const a=rr(e),i=o?"#,##0":"0",r=n>0?"."+"0".repeat(n):"",c=i+r;switch(l){case"general":return"";case"text":return On;case"custom":return"";case"number":return c;case"percent":return c+"%";case"scientific":return"0."+"0".repeat(n)+"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 da(e){const l=rr(e);return[{label:g(e,"nfGeneral"),value:mo},{label:g(e,"nfText"),value:On},{label:g(e,"nfNumber"),value:"#,##0.00"},{label:g(e,"nfPercent"),value:"0.00%"},{label:g(e,"nfScientific"),value:"0.00E+00"},{label:g(e,"nfAccounting"),value:`${l}#,##0.00;(${l}#,##0.00);${l}"-"`},{label:g(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:g(e,"nfCurrency"),value:l+"#,##0.00"},{label:g(e,"nfCurrencyRounded"),value:l+"#,##0"},{label:g(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:g(e,"nfTime"),value:"h:mm:ss"},{label:g(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:g(e,"nfDuration"),value:"[h]:mm:ss"},{label:g(e,"nfCustom"),value:fo}]}const ds=["title"],us=["innerHTML"],fs=["disabled"],ms=["placeholder"],ps=["disabled","onClick"],hs=["innerHTML"],gs={key:2,class:"sp-dropdown__empty"},bs=["disabled"],ys=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},locale:{default:"zh-CN"},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:""},boundaryEl:{default:null},previewFont:{type:Boolean,default:!1}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(!1),i=t.ref(0),r=t.ref(null),c=t.ref(null),s=t.ref(null),y=t.ref({top:0,up:!1}),h=t.ref(void 0),R=t.ref(0),f=t.ref(!1),E=t.ref(""),k=t.ref(null),N=t.computed(()=>n.options.find(se=>String(se.value)===String(n.modelValue)));function Y(se){if(n.previewFont&&!(typeof se!="string"||!se))return{fontFamily:se}}const te=t.computed(()=>n.menuWidth!==void 0?n.menuWidth:h.value),me=t.computed(()=>{if(!n.searchable||!E.value.trim())return n.options;const se=E.value.trim().toLowerCase();return n.options.filter(de=>String(de.label??"").toLowerCase().includes(se))}),he=t.computed(()=>me.value.length>0),Te=t.computed(()=>Math.min(n.visibleCount,me.value.length)),pe=t.computed(()=>me.value.slice(i.value,i.value+Te.value)),Ee=t.computed(()=>i.value>0),Le=t.computed(()=>i.value+Te.value<me.value.length),ue=t.computed(()=>me.value.length>Te.value);function ie(se){i.value=Math.max(0,Math.min(me.value.length-Te.value,i.value+se))}function tt(){const se=n.triggerEl??r.value;if(!se)return;const de=se.getBoundingClientRect();h.value=de.width,a.value=!0,n.searchable&&(E.value=""),n.modelOpen!==void 0&&o("update:modelOpen",!0);const Be=de.bottom+4,_e=Fn(n.boundaryEl);n.align==="right"?y.value={right:Fo(Math.min(de.right,_e.right)),top:Be,up:!1}:y.value={left:Math.max(_e.left,de.left),top:Be,up:!1};const Ge=me.value.findIndex(ct=>String(ct.value)===String(n.modelValue));i.value=Ge>=0?Math.max(0,Math.min(Ge-Math.floor(Te.value/2),me.value.length-Te.value)):0,n.searchable&&t.nextTick(()=>{var ct;return(ct=k.value)==null?void 0:ct.focus()}),t.nextTick(()=>{const ct=n.triggerEl??r.value;if(!ct)return;const nt=ct.getBoundingClientRect(),I=s.value;if(!I)return;const H=I.offsetHeight,$=_e.bottom-nt.bottom-8,V=nt.top-_e.top-8,B=$<H&&V>0,W=B?nt.top-H-4:nt.bottom+4,z=Math.min(_e.top+8,nt.bottom+4),q=Math.max(z,Math.min(_e.bottom-H-8,W));n.align==="right"?y.value={right:Fo(Math.min(nt.right,_e.right)),top:q,up:B}:y.value={left:Math.max(_e.left,nt.left),top:q,up:B}})}function st(){a.value=!1,E.value="",n.modelOpen!==void 0&&o("update:modelOpen",!1)}function Z(){a.value?st():tt()}function O(se){se.disabled||(o("update:modelValue",se.value),o("change",se.value),st())}function L(se){var Be,_e;if(!a.value)return;const de=se.target;(Be=r.value)!=null&&Be.contains(de)||(_e=s.value)!=null&&_e.contains(de)||st()}function oe(se){a.value&&(se.preventDefault(),ie(se.deltaY>0?1:-1))}t.watch(a,se=>{t.nextTick(()=>{var de,Be;se?((de=c.value)==null||de.addEventListener("wheel",oe,{passive:!1}),document.addEventListener("keydown",$e)):((Be=c.value)==null||Be.removeEventListener("wheel",oe),document.removeEventListener("keydown",$e))})});function $e(se){a.value&&se.key==="Escape"&&st()}t.watch(()=>n.modelOpen,se=>{se!==void 0&&se!==a.value&&(se?tt():st())});function lt(se){a.value&&(R.value=se.touches[0].clientY,f.value=!0)}function ne(se){if(!a.value||!f.value)return;const de=se.touches[0].clientY-R.value;Math.abs(de)>5&&(ie(de<0?1:-1),R.value=se.touches[0].clientY)}function xe(){f.value=!1}function Ne(se){se.key==="Escape"&&(se.stopPropagation(),st())}return t.onMounted(()=>{document.addEventListener("pointerdown",L),window.addEventListener("resize",st),window.addEventListener("scroll",st,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",L),document.removeEventListener("keydown",$e),window.removeEventListener("resize",st),window.removeEventListener("scroll",st,!0)}),(se,de)=>{var Be,_e,Ge,ct,nt,I;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:Z},[(Be=N.value)!=null&&Be.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((_e=N.value)==null?void 0:_e.icon)||e.triggerIcon},null,8,us)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"sp-dropdown__value",style:t.normalizeStyle(Y(((Ge=N.value)==null?void 0:Ge.value)??""))},t.toDisplayString((ct=N.value)!=null&&ct.icon||e.triggerIcon?((nt=N.value)==null?void 0:nt.label)??e.triggerLabel:((I=N.value)==null?void 0:I.label)??e.fallbackLabel),5),de[5]||(de[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,ds)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:s,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":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:te.value!==void 0?typeof te.value=="number"?te.value+"px":te.value:void 0}),onKeydown:Ne,onMousedown:de[4]||(de[4]=t.withModifiers(()=>{},["prevent"]))},[ue.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Ee.value}]),disabled:!Ee.value,onClick:de[0]||(de[0]=H=>ie(-1))},[...de[6]||(de[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,fs)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:k,"onUpdate:modelValue":de[1]||(de[1]=H=>E.value=H),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:de[2]||(de[2]=t.withModifiers(()=>{},["stop"]))},null,40,ms)),[[t.vModelText,E.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"sp-dropdown__list",onTouchstart:lt,onTouchmove:ne,onTouchend:xe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(pe.value,H=>(t.openBlock(),t.createElementBlock("button",{key:String(H.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!H.disabled&&String(H.value)===String(e.modelValue),"sp-dropdown__item--disabled":H.disabled}]),disabled:H.disabled,onClick:$=>O(H)},[H.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:H.icon},null,8,hs)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"sp-dropdown__item-label",style:t.normalizeStyle(Y(H.value))},t.toDisplayString(H.label),5)],10,ps))),128))],544),e.searchable&&!he.value?(t.openBlock(),t.createElementBlock("div",gs,t.toDisplayString(t.unref(g)(e.locale,"searchNoMatch")),1)):t.createCommentVNode("",!0),ue.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Le.value}]),disabled:!Le.value,onClick:de[3]||(de[3]=H=>ie(1))},[...de[7]||(de[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,bs)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Lt=(e,l)=>{const n=e.__vccOpts||e;for(const[o,a]of l)n[o]=a;return n},Pt=Lt(ys,[["__scopeId","data-v-c393669d"]]);function Oo(){const e=t.ref({top:0,up:!1});function l(n,o,a){const i=Fn(o),r=n.getBoundingClientRect(),c=Fo(Math.min(r.right,i.right));if(!a){e.value={right:c,top:r.bottom+4,up:!1};return}const s=a.offsetHeight,y=i.bottom-r.bottom-8,h=r.top-i.top-8,R=y<s&&h>0,f=R?r.top-s-4:r.bottom+4,E=Math.min(i.top+8,r.bottom+4),k=Math.max(E,Math.min(i.bottom-s-8,f));e.value={right:c,top:k,up:R}}return{pos:e,place:l}}const Cs={class:"color-palette"},ws=["title","onClick"],ua=Lt(t.defineComponent({__name:"color-palette",props:{colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"}},emits:["pick"],setup(e,{emit:l}){const n=e,o=l,a=[[{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"}]],i=[[{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"}]],r=t.computed(()=>n.colorKey==="fill"?i:a);function c(h){return g(n.locale,h)}function s(h){const R=n.currentColor;return!R&&!h?!0:R?R.toLowerCase()===h.toLowerCase():!1}function y(h){o("pick",h)}return(h,R)=>(t.openBlock(),t.createElementBlock("div",Cs,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(f,E)=>(t.openBlock(),t.createElementBlock("div",{key:E,class:"color-palette__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f,k=>(t.openBlock(),t.createElementBlock("button",{key:k.value,type:"button",class:t.normalizeClass(["color-palette__swatch",{"color-palette__swatch--selected":s(k.value),"color-palette__swatch--none":!k.value}]),title:c(k.key),style:t.normalizeStyle(k.value?{background:k.value,border:"1px solid rgba(0,0,0,0.15)"}:void 0),onClick:N=>y(k.value)},null,14,ws))),128))]))),128))]))}}),[["__scopeId","data-v-71690bf8"]]),Nl=Lt(t.defineComponent({__name:"color-picker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:l,emit:n}){const o=e,a=n,i=t.ref(!1),r=t.ref(null),c=t.ref(null),{pos:s,place:y}=Oo();t.watch(()=>o.modelOpen,k=>{k!==void 0&&k!==i.value&&(k?R():f())});function h(k){const N=r.value,Y=c.value,te=k.target;N&&N.contains(te)||Y&&Y.contains(te)||f()}function R(){const k=o.triggerEl??r.value;k&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),y(k,o.boundaryEl),t.nextTick(()=>{const N=o.triggerEl??r.value;if(!N)return;const Y=c.value;Y&&(y(N,o.boundaryEl,Y),document.addEventListener("pointerdown",h))}))}function f(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function E(k){a("update:modelValue",k),a("change",k),f()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:i,openMenu:R,close:f}),(k,N)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"color-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:"color-picker__menu",style:t.normalizeStyle({left:t.unref(s).left!==void 0?t.unref(s).left+"px":void 0,right:t.unref(s).right!==void 0?t.unref(s).right+"px":void 0,top:t.unref(s).top+"px"}),onMousedown:N[0]||(N[0]=t.withModifiers(()=>{},["stop","prevent"]))},[t.createVNode(ua,{"color-key":o.colorKey,"current-color":o.currentColor,locale:o.locale,onPick:E},null,8,["color-key","current-color","locale"])],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-6f79730a"]]),fa=[{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}],vs={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"]},ks={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function Ro(e,l){return ks[e].includes(l)?"thick":vs[e].includes(l)?"solid":"dashed"}function ma(e){return Ro(e,"right")==="dashed"&&Ro(e,"bottom")==="dashed"}const pa=.75,ha=26,ga=26,Es=[{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"}],Rs={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"};function un(e){return e==="dashed"||e==="dotted"?e:"solid"}function ba(e,l){if(e==="solid")return null;const n=Math.max(1,l);return e==="dashed"?[Math.max(3,n*2.5),Math.max(2,n*1.5)]:[1e-4,Math.max(2,n*1.8)]}const Ss=["title","onClick"],Ms={viewBox:"0 0 30 30",class:"border-picker__icon"},Ns=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Bs=["cx","cy","r"],xs={class:"border-picker__label"},Ts={class:"border-picker__item--sub-label"},Vs={class:"border-picker__item--sub-label"},Ds=["title","onClick"],Fs={viewBox:"0 0 64 20",class:"border-picker__line-preview"},Os=["stroke-dasharray","stroke-linecap"],Is={class:"border-picker__line-label"},As=Lt(t.defineComponent({__name:"border-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},currentColor:{default:""},currentLineStyle:{default:""},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change","changeColor","change-line-style"],setup(e,{expose:l,emit:n}){const o=e,a=n,i=t.ref(!1),r=t.ref(null),c=t.ref(null),s=t.ref(!1),y=t.ref(null),h=t.ref("right"),R=t.ref(!1);let f;const E=t.ref({top:0}),{pos:k,place:N}=Oo();t.watch(()=>o.modelOpen,se=>{se!==void 0&&se!==i.value&&(se?te():me())});function Y(se){const de=r.value,Be=c.value,_e=se.target;de&&de.contains(_e)||Be&&Be.contains(_e)||_e instanceof Element&&_e.closest(".border-submenu-wrap")||me()}function te(){const se=o.triggerEl??r.value;se&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),N(se,o.boundaryEl),t.nextTick(()=>{const de=o.triggerEl??r.value;if(!de)return;const Be=c.value;Be&&(N(de,o.boundaryEl,Be),document.addEventListener("pointerdown",Y))}))}function me(){i.value=!1,s.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",Y)}function he(se){a("change",se),me()}function Te(se){clearTimeout(f),s.value=!0,t.nextTick(()=>{var z;const de=se.currentTarget instanceof HTMLElement?se.currentTarget:null;if(!de)return;const Be=de.getBoundingClientRect(),_e=(z=y.value)==null?void 0:z.closest(".border-submenu-wrap");if(!_e)return;const Ge=Fn(o.boundaryEl),ct=_e.offsetWidth,nt=_e.offsetHeight,H=Be.right+ct+8>Ge.right?"left":"right",$=Be.top+nt>Ge.bottom-8,V=$?Be.bottom+5-nt:Be.top-5,B=Math.min(Ge.top+8,V),W=Math.max(B,Math.min(Ge.bottom-nt-8,V));h.value=H,R.value=$,E.value=H==="right"?{left:Be.right+4,top:W}:{right:Fo(Be.left-4),top:W}})}function pe(){clearTimeout(f),f=setTimeout(()=>{s.value=!1},150)}function Ee(){clearTimeout(f)}function Le(se){s.value=!1,a("changeColor",se),me()}const ue=[{key:"solid",i18nKey:"lineSolid"},{key:"dashed",i18nKey:"lineDashed"},{key:"dotted",i18nKey:"lineDotted"}],ie=t.ref(!1),tt=t.ref(null),st=t.ref("right"),Z=t.ref(!1);let O;const L=t.ref({top:0});function oe(se){const de=ba(se,2);return de?`${de[0]} ${de[1]}`:void 0}function $e(se){return un(o.currentLineStyle)===se}function lt(se){clearTimeout(O),ie.value=!0,t.nextTick(()=>{var z;const de=se.currentTarget instanceof HTMLElement?se.currentTarget:null;if(!de)return;const Be=de.getBoundingClientRect(),_e=(z=tt.value)==null?void 0:z.closest(".border-submenu-wrap");if(!_e)return;const Ge=Fn(o.boundaryEl),ct=_e.offsetWidth,nt=_e.offsetHeight,H=Be.right+ct+8>Ge.right?"left":"right",$=Be.top+nt>Ge.bottom-8,V=$?Be.bottom+5-nt:Be.top-5,B=Math.min(Ge.top+8,V),W=Math.max(B,Math.min(Ge.bottom-nt-8,V));st.value=H,Z.value=$,L.value=H==="right"?{left:Be.right+4,top:W}:{right:Fo(Be.left-4),top:W}})}function ne(){clearTimeout(O),O=setTimeout(()=>{ie.value=!1},150)}function xe(){clearTimeout(O)}function Ne(se){ie.value=!1,a("change-line-style",se),me()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Y),clearTimeout(f)}),l({open:i,openMenu:te,close:me}),(se,de)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"border-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:"border-picker__menu",style:t.normalizeStyle({left:t.unref(k).left!==void 0?t.unref(k).left+"px":void 0,right:t.unref(k).right!==void 0?t.unref(k).right+"px":void 0,top:t.unref(k).top+"px"}),onMousedown:de[2]||(de[2]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Es),Be=>(t.openBlock(),t.createElementBlock("button",{key:Be.key,class:"border-picker__item",title:t.unref(g)(e.locale,Be.i18nKey),onClick:_e=>he(Be.key)},[(t.openBlock(),t.createElementBlock("svg",Ms,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(fa),_e=>(t.openBlock(),t.createElementBlock("line",{key:_e.name,x1:_e.x1,y1:_e.y1,x2:_e.x2,y2:_e.y2,stroke:"currentColor","stroke-width":t.unref(Ro)(Be.key,_e.name)==="thick"?3:1.5,"stroke-dasharray":t.unref(Ro)(Be.key,_e.name)==="dashed"?"0 4":"none","stroke-linecap":t.unref(Ro)(Be.key,_e.name)==="dashed"?"round":"square"},null,8,Ns))),128)),t.unref(ma)(Be.key)?(t.openBlock(),t.createElementBlock("circle",{key:0,cx:t.unref(ha),cy:t.unref(ga),r:t.unref(pa),fill:"currentColor"},null,8,Bs)):t.createCommentVNode("",!0)])),t.createElementVNode("span",xs,t.toDisplayString(t.unref(g)(e.locale,Be.i18nKey)),1)],8,Ss))),128)),de[11]||(de[11]=t.createElementVNode("div",{class:"border-picker__divider"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["border-picker__item border-picker__item--sub",{"border-picker__item--sub-open":ie.value}]),onMouseenter:de[0]||(de[0]=Be=>lt(Be)),onMouseleave:ne},[de[7]||(de[7]=t.createElementVNode("span",{class:"border-picker__line-icon","aria-hidden":"true"},[t.createElementVNode("svg",{viewBox:"0 0 40 20",class:"border-picker__line-svg"},[t.createElementVNode("line",{x1:"2",y1:"10",x2:"38",y2:"10",stroke:"currentColor","stroke-width":"2","stroke-dasharray":"none","stroke-linecap":"butt"})])],-1)),t.createElementVNode("span",Ts,t.toDisplayString(t.unref(g)(e.locale,"borderLineStyle")),1),de[8]||(de[8]=t.createElementVNode("svg",{class:"border-picker__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))],34),t.createElementVNode("div",{class:t.normalizeClass(["border-picker__item border-picker__item--sub",{"border-picker__item--sub-open":s.value}]),onMouseenter:de[1]||(de[1]=Be=>Te(Be)),onMouseleave:pe},[de[9]||(de[9]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",class:"border-picker__item--sub-icon",fill:"currentColor"},[t.createElementVNode("path",{d:"M563.39456 743.34208v-51.38432h308.3264V332.24704h-102.76864V280.85248h154.14784v462.4896h-359.7056z m-230.84544 51.88608l-26.84928-102.56896 283.93984-463.89248 127.2576 75.17184-284.17024 463.78496-100.17792 27.50464z m-180.26496-103.26528h102.784v51.38432H100.89984V280.85248h359.7056v51.39456H152.28416v359.71584z"})],-1)),t.createElementVNode("span",Vs,t.toDisplayString(t.unref(g)(e.locale,"borderColor")),1),t.createElementVNode("span",{class:"border-picker__item--sub-swatch",style:t.normalizeStyle({background:e.currentColor||"var(--sp-border-default, #444)"})},null,4),de[10]||(de[10]=t.createElementVNode("svg",{class:"border-picker__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))],34)],36)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"border-sub-pop"},{default:t.withCtx(()=>[i.value&&s.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"colorSubRef",ref:y,class:t.normalizeClass(["border-submenu-wrap",{"border-submenu-wrap--left":h.value==="left","border-submenu-wrap--up":R.value}]),style:t.normalizeStyle({left:E.value.left!==void 0?E.value.left+"px":void 0,right:E.value.right!==void 0?E.value.right+"px":void 0,top:E.value.top+"px"}),onClick:de[3]||(de[3]=t.withModifiers(()=>{},["stop"])),onMousedown:de[4]||(de[4]=t.withModifiers(()=>{},["prevent"])),onMouseenter:Ee,onMouseleave:pe},[t.createVNode(ua,{"color-key":"border","current-color":e.currentColor,locale:e.locale,onPick:Le},null,8,["current-color","locale"])],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"border-sub-pop"},{default:t.withCtx(()=>[i.value&&ie.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"lineSubRef",ref:tt,class:t.normalizeClass(["border-submenu-wrap",{"border-submenu-wrap--left":st.value==="left","border-submenu-wrap--up":Z.value}]),style:t.normalizeStyle({left:L.value.left!==void 0?L.value.left+"px":void 0,right:L.value.right!==void 0?L.value.right+"px":void 0,top:L.value.top+"px"}),onClick:de[5]||(de[5]=t.withModifiers(()=>{},["stop"])),onMousedown:de[6]||(de[6]=t.withModifiers(()=>{},["prevent"])),onMouseenter:xe,onMouseleave:ne},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ue,Be=>t.createElementVNode("button",{key:Be.key,class:t.normalizeClass(["border-picker__line-item",{"border-picker__line-item--active":$e(Be.key)}]),title:t.unref(g)(e.locale,Be.i18nKey),onClick:_e=>Ne(Be.key)},[(t.openBlock(),t.createElementBlock("svg",Fs,[t.createElementVNode("line",{x1:"3",y1:"10",x2:"61",y2:"10",stroke:"currentColor","stroke-width":"2","stroke-dasharray":oe(Be.key)||"none","stroke-linecap":Be.key==="dotted"?"round":"butt"},null,8,Os)])),t.createElementVNode("span",Is,t.toDisplayString(t.unref(g)(e.locale,Be.i18nKey)),1)],10,Ds)),64))],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-c72fa26b"]]),ya=[{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}],Ca={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},Ls=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],$s=["title","onClick"],zs={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},_s=["x1","y1","x2","y2"],Hs=["d"],Ws={class:"sort-picker__label"},Us=Lt(t.defineComponent({__name:"sort-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:n}){const o=e,a=n,i=t.ref(!1),r=t.ref(null),c=t.ref(null),{pos:s,place:y}=Oo();t.watch(()=>o.modelOpen,k=>{k!==void 0&&k!==i.value&&(k?R():f())});function h(k){const N=r.value,Y=c.value,te=k.target;N&&N.contains(te)||Y&&Y.contains(te)||f()}function R(){const k=o.triggerEl??r.value;k&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),y(k,o.boundaryEl),t.nextTick(()=>{const N=o.triggerEl??r.value;if(!N)return;const Y=c.value;Y&&(y(N,o.boundaryEl,Y),document.addEventListener("pointerdown",h))}))}function f(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function E(k){a("change",k),f()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:i,openMenu:R,close:f}),(k,N)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"sort-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:"sort-picker__menu",style:t.normalizeStyle({left:t.unref(s).left!==void 0?t.unref(s).left+"px":void 0,right:t.unref(s).right!==void 0?t.unref(s).right+"px":void 0,top:t.unref(s).top+"px"}),onMousedown:N[0]||(N[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Ls),Y=>(t.openBlock(),t.createElementBlock("button",{key:Y.key,class:"sort-picker__item",title:t.unref(g)(e.locale,Y.i18nKey),onClick:te=>E(Y.key)},[(t.openBlock(),t.createElementBlock("svg",zs,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ya),te=>(t.openBlock(),t.createElementBlock("line",{key:te.name,x1:te.x1,y1:te.y1,x2:te.x2,y2:te.y2},null,8,_s))),128)),t.createElementVNode("path",{d:t.unref(Ca)[Y.key]},null,8,Hs)])),t.createElementVNode("span",Ws,t.toDisplayString(t.unref(g)(e.locale,Y.i18nKey)),1)],8,$s))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-5b172d0e"]]),Ps={key:0,class:"outline-picker__sep"},Ks=["onClick"],Gs={class:"outline-picker__label"},qs=Lt(t.defineComponent({__name:"outline-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null},axis:{default:null}},emits:["update:modelOpen","action"],setup(e,{expose:l,emit:n}){const o=e,a=n,i=[{key:"group",i18nKey:"outlineAddGroup"},{key:"ungroup",i18nKey:"outlineUngroup"},{key:"clear",i18nKey:"outlineClear"},{key:"expand",i18nKey:"outlineExpandAll"},{key:"collapse",i18nKey:"outlineCollapseAll"}],r=t.ref(!1),c=t.ref(null),s=t.ref(null),{pos:y,place:h}=Oo();t.watch(()=>o.modelOpen,N=>{N!==void 0&&N!==r.value&&(N?f():E())});function R(N){const Y=c.value,te=s.value,me=N.target;Y&&Y.contains(me)||te&&te.contains(me)||E()}function f(){const N=o.triggerEl??c.value;N&&(r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),h(N,o.boundaryEl),t.nextTick(()=>{const Y=o.triggerEl??c.value;if(!Y)return;const te=s.value;te&&(h(Y,o.boundaryEl,te),document.addEventListener("pointerdown",R))}))}function E(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function k(N){o.axis&&(a("action",`${N}-${o.axis}`),E())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),l({open:r,openMenu:f,close:E}),(N,Y)=>(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:s,class:"outline-picker__menu",style:t.normalizeStyle({left:t.unref(y).left!==void 0?t.unref(y).left+"px":void 0,right:t.unref(y).right!==void 0?t.unref(y).right+"px":void 0,top:t.unref(y).top+"px"}),onMousedown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,te=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:te.key},[te.sep?(t.openBlock(),t.createElementBlock("div",Ps)):(t.openBlock(),t.createElementBlock("div",{key:1,class:"outline-picker__item",onClick:me=>k(te.key)},[t.createElementVNode("span",Gs,t.toDisplayString(t.unref(g)(e.locale,te.i18nKey)),1)],8,Ks))],64))),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-5e1b54bf"]]),Ys=["title","onClick"],js=["innerHTML"],Xs={class:"merge-picker__label"},Zs=Lt(t.defineComponent({__name:"merge-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:n}){const o=e,a=n,i=t.ref(!1),r=t.ref(null),c=t.ref(null),{pos:s,place:y}=Oo();t.watch(()=>o.modelOpen,k=>{k!==void 0&&k!==i.value&&(k?R():f())});function h(k){const N=r.value,Y=c.value,te=k.target;N&&N.contains(te)||Y&&Y.contains(te)||f()}function R(){const k=o.triggerEl??r.value;k&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),y(k,o.boundaryEl),t.nextTick(()=>{const N=o.triggerEl??r.value;if(!N)return;const Y=c.value;Y&&(y(N,o.boundaryEl,Y),document.addEventListener("pointerdown",h))}))}function f(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function E(k){a("change",k),f()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:i,openMenu:R,close:f}),(k,N)=>(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:t.unref(s).left!==void 0?t.unref(s).left+"px":void 0,right:t.unref(s).right!==void 0?t.unref(s).right+"px":void 0,top:t.unref(s).top+"px"}),onMousedown:N[0]||(N[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(_i),Y=>(t.openBlock(),t.createElementBlock("button",{key:Y.key,class:"merge-picker__item",title:t.unref(g)(e.locale,Y.labelKey),onClick:te=>E(Y.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:Y.icon},null,8,js),t.createElementVNode("span",Xs,t.toDisplayString(t.unref(g)(e.locale,Y.labelKey)),1)],8,Ys))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-1905c902"]]),Js=["title","disabled"],Qs={class:"cf-menu-trigger__label"},ec=["disabled"],tc=["disabled"],nc=["disabled"],oc=["disabled"],lc=["disabled"],rc=["disabled"],ac=["disabled"],ic=["onClick"],sc=["disabled"],cc=["disabled"],dc=["disabled"],uc=["disabled"],fc=Lt(t.defineComponent({__name:"conditional-format-menu",props:{locale:{},hasSelection:{type:Boolean},themeVars:{default:()=>({})},boundaryEl:{default:null},modelOpen:{type:Boolean,default:!1}},emits:["preset","new-rule","manage","clear","update:modelOpen"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(null),i=t.ref(null),r=t.ref(null),c=t.ref(null),s=t.ref(null),y=t.ref(!1),h=t.ref(null),R=t.ref("right"),f=t.ref("right"),E=t.ref(!1),k=t.ref(!1),N=t.ref(!1),Y=t.ref(!1),te=t.ref(!1),me=t.ref(!1),he=t.ref(!1),Te=t.ref(!1),{pos:pe,place:Ee}=Oo(),Le=t.ref({top:0}),ue=t.ref({top:0});let ie;const tt=[{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 st(){o("update:modelOpen",!y.value)}t.watch(()=>n.modelOpen,V=>{V&&!y.value?Z():!V&&y.value&&O()});function Z(){const V=i.value;V&&(y.value=!0,h.value=null,Ee(V,n.boundaryEl),t.nextTick(()=>{var W;const B=(W=r.value)==null?void 0:W.closest(".cf-menu");B&&(Ee(V,n.boundaryEl,B),oe())}))}function O(){y.value=!1,clearTimeout(ie),h.value=null}function L(){o("update:modelOpen",!1)}function oe(){const V=r.value;V&&(N.value=V.scrollTop>1,Y.value=V.scrollTop+V.clientHeight<V.scrollHeight-1)}function $e(V){const B=r.value;B&&(B.scrollTop=Math.max(0,Math.min(B.scrollHeight-B.clientHeight,B.scrollTop+V*30)))}function lt(V){const B=V==="highlight"?c.value:s.value;if(!B)return;const W=B.scrollTop>1,z=B.scrollTop+B.clientHeight<B.scrollHeight-1;V==="highlight"?(te.value=W,me.value=z):(he.value=W,Te.value=z)}function ne(V,B){const W=V==="highlight"?c.value:s.value;W&&(W.scrollTop=Math.max(0,Math.min(W.scrollHeight-W.clientHeight,W.scrollTop+B*30)))}function xe(V,B){V&&(V.scrollHeight<=V.clientHeight||(B.preventDefault(),V.scrollTop=Math.max(0,Math.min(V.scrollHeight-V.clientHeight,V.scrollTop+B.deltaY))))}function Ne(V){xe(r.value,V),oe()}function se(V){xe(c.value,V),lt("highlight")}function de(V){xe(s.value,V),lt("clear")}function Be(V){var W,z,q,Ce,We,gt;if(!y.value)return;const B=V.target;(W=a.value)!=null&&W.contains(B)||(z=r.value)!=null&&z.contains(B)||(Ce=(q=c.value)==null?void 0:q.closest(".cf-submenu-wrap"))!=null&&Ce.contains(B)||(gt=(We=s.value)==null?void 0:We.closest(".cf-submenu-wrap"))!=null&>.contains(B)||L()}function _e(V,B){clearTimeout(ie),h.value=V,t.nextTick(()=>{var xt,Tt;const W=(B==null?void 0:B.currentTarget)instanceof HTMLElement?B.currentTarget:null;if(!W)return;const z=W.getBoundingClientRect(),q=V==="highlight"?(xt=c.value)==null?void 0:xt.closest(".cf-submenu-wrap"):(Tt=s.value)==null?void 0:Tt.closest(".cf-submenu-wrap");if(!q)return;const Ce=Fn(n.boundaryEl),We=q.offsetWidth,gt=q.offsetHeight,Ae=z.right+We+8>Ce.right;let w="right";Ae&&(w="left");const X=z.top+gt>Ce.bottom-8,dt=X?z.bottom+5-gt:z.top-5,Nt=Math.min(Ce.top+8,dt),Ct=Math.max(Nt,Math.min(Ce.bottom-gt-8,dt)),$t=w==="right"?{left:z.right+4,top:Ct}:{right:Fo(z.left-4),top:Ct};V==="highlight"?(R.value=w,E.value=X,Le.value=$t):(f.value=w,k.value=X,ue.value=$t),lt(V)})}function Ge(){clearTimeout(ie),ie=setTimeout(()=>{h.value=null},150)}function ct(){clearTimeout(ie)}function nt(V){o("preset",V),L()}function I(){o("new-rule"),L()}function H(){o("manage"),L()}function $(V){o("clear",V),L()}return t.onMounted(()=>{document.addEventListener("pointerdown",Be),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Be),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}),(V,B)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:a,class:"cf-menu-root"},[t.createElementVNode("button",{ref_key:"btnRef",ref:i,type:"button",class:"toolbar-btn cf-menu-trigger",title:t.unref(g)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:st},[B[22]||(B[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-00c340ba><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-00c340ba></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-00c340ba></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-00c340ba></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-00c340ba></path></svg>',1)),t.createElementVNode("span",Qs,t.toDisplayString(t.unref(g)(e.locale,"conditionalFormat")),1),B[23]||(B[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,Js),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[y.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:t.unref(pe).right+"px",top:t.unref(pe).top+"px"}),onClick:B[8]||(B[8]=t.withModifiers(()=>{},["stop"])),onMousedown:B[9]||(B[9]=t.withModifiers(()=>{},["prevent"]))},[N.value||Y.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!N.value}]),disabled:!N.value,onClick:B[0]||(B[0]=W=>$e(-1))},[...B[24]||(B[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,ec)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:r,class:"cf-menu__body",onScroll:oe,onWheelPassive:Ne},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:B[1]||(B[1]=W=>_e("highlight",W)),onMouseleave:Ge},[t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"cfHighlightRules")),1),B[25]||(B[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),B[27]||(B[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:B[2]||(B[2]=W=>e.hasSelection&&nt("blank"))},t.toDisplayString(t.unref(g)(e.locale,"cfBlank")),11,tc),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:B[3]||(B[3]=W=>e.hasSelection&&nt("notBlank"))},t.toDisplayString(t.unref(g)(e.locale,"cfNotBlank")),11,nc),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:B[4]||(B[4]=W=>e.hasSelection&&nt("duplicate"))},t.toDisplayString(t.unref(g)(e.locale,"cfDuplicate")),11,oc),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:B[5]||(B[5]=W=>e.hasSelection&&nt("unique"))},t.toDisplayString(t.unref(g)(e.locale,"cfUnique")),11,lc),B[28]||(B[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:I},t.toDisplayString(t.unref(g)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:H},t.toDisplayString(t.unref(g)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:B[6]||(B[6]=W=>_e("clear",W)),onMouseleave:Ge},[t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"cfClearRules")),1),B[26]||(B[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),N.value||Y.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!Y.value}]),disabled:!Y.value,onClick:B[7]||(B[7]=W=>$e(1))},[...B[29]||(B[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,rc)):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(()=>[y.value&&h.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":R.value==="left","cf-submenu-wrap--up":E.value}]),style:t.normalizeStyle({...e.themeVars,left:Le.value.left!==void 0?Le.value.left+"px":void 0,right:Le.value.right!==void 0?Le.value.right+"px":void 0,top:Le.value.top+"px"}),onClick:B[13]||(B[13]=t.withModifiers(()=>{},["stop"])),onMousedown:B[14]||(B[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ct,onMouseleave:Ge},[te.value||me.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!te.value}]),disabled:!te.value,onClick:B[10]||(B[10]=W=>ne("highlight",-1))},[...B[30]||(B[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,ac)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:c,class:"cf-submenu",onScroll:B[11]||(B[11]=W=>lt("highlight")),onWheelPassive:se},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(tt,W=>t.createElementVNode("button",{key:W.type,type:"button",class:"cf-menu__subitem",onClick:z=>nt(W.type)},t.toDisplayString(t.unref(g)(e.locale,W.key)),9,ic)),64))],544),te.value||me.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!me.value}]),disabled:!me.value,onClick:B[12]||(B[12]=W=>ne("highlight",1))},[...B[31]||(B[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,sc)):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(()=>[y.value&&h.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":f.value==="left","cf-submenu-wrap--up":k.value}]),style:t.normalizeStyle({...e.themeVars,left:ue.value.left!==void 0?ue.value.left+"px":void 0,right:ue.value.right!==void 0?ue.value.right+"px":void 0,top:ue.value.top+"px"}),onClick:B[20]||(B[20]=t.withModifiers(()=>{},["stop"])),onMousedown:B[21]||(B[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ct,onMouseleave:Ge},[he.value||Te.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!he.value}]),disabled:!he.value,onClick:B[15]||(B[15]=W=>ne("clear",-1))},[...B[32]||(B[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,cc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:s,class:"cf-submenu",onScroll:B[18]||(B[18]=W=>lt("clear")),onWheelPassive:de},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__subitem",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:B[16]||(B[16]=W=>e.hasSelection&&$("selection"))},t.toDisplayString(t.unref(g)(e.locale,"cfClearSelected")),11,dc),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:B[17]||(B[17]=W=>$("sheet"))},t.toDisplayString(t.unref(g)(e.locale,"cfClearSheet")),1)],544),he.value||Te.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Te.value}]),disabled:!Te.value,onClick:B[19]||(B[19]=W=>ne("clear",1))},[...B[33]||(B[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,uc)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-00c340ba"]]),mc=["disabled","title","onClick"],pc={class:"calc-picker__label"},hc=Lt(t.defineComponent({__name:"calc-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1},boundaryEl:{}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:n}){const o=e,a=n,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),c=t.ref(null),s=t.ref(null),{pos:y,place:h}=Oo();t.watch(()=>o.modelOpen,N=>{N!==void 0&&N!==r.value&&(N?f():E())});function R(N){const Y=c.value,te=s.value,me=N.target;Y&&Y.contains(me)||te&&te.contains(me)||E()}function f(){const N=o.triggerEl??c.value;N&&(r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),h(N,o.boundaryEl),t.nextTick(()=>{const Y=o.triggerEl??c.value;if(!Y)return;const te=s.value;te&&(h(Y,o.boundaryEl,te),document.addEventListener("pointerdown",R))}))}function E(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function k(N){o.disabled||(a("change",N),E())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),l({open:r,openMenu:f,close:E}),(N,Y)=>(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:s,class:"calc-picker__menu",style:t.normalizeStyle({left:t.unref(y).left!==void 0?t.unref(y).left+"px":void 0,right:t.unref(y).right!==void 0?t.unref(y).right+"px":void 0,top:t.unref(y).top+"px"}),onMousedown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,te=>t.createElementVNode("button",{key:te.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(g)(e.locale,te.labelKey),onClick:me=>k(te.key)},[t.createElementVNode("span",pc,t.toDisplayString(t.unref(g)(e.locale,te.labelKey)),1)],10,mc)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-118a07d5"]]),gc={class:"tb-item","data-key":"undo"},bc=["title","disabled"],yc={class:"toolbar-btn__label"},Cc={class:"tb-item","data-key":"redo"},wc=["title","disabled"],vc={class:"toolbar-btn__label"},kc={class:"tb-item","data-key":"paint"},Ec=["title","disabled"],Rc={class:"toolbar-btn__label"},Sc={class:"tb-item","data-key":"clear"},Mc=["title","disabled"],Nc={class:"toolbar-btn__label"},Bc={class:"tb-item","data-key":"font"},xc={class:"tb-item","data-key":"fontSize"},Tc={class:"toolbar-font-size"},Vc=["value","title"],Dc=["title"],Fc=["title","disabled"],Oc=["title","disabled"],Ic={class:"tb-item","data-key":"bold"},Ac=["title","disabled"],Lc={class:"toolbar-btn__label"},$c={class:"tb-item","data-key":"italic"},zc=["title","disabled"],_c={class:"toolbar-btn__label"},Hc={class:"tb-item","data-key":"underline"},Wc=["title","disabled"],Uc={class:"toolbar-btn__label"},Pc={class:"tb-item","data-key":"strike"},Kc=["title","disabled"],Gc={class:"toolbar-btn__label"},qc={class:"tb-item","data-key":"textColor"},Yc={class:"toolbar-split"},jc=["title","disabled"],Xc={viewBox:"0 0 1024 1024",fill:"currentColor"},Zc=["fill"],Jc={class:"toolbar-btn__label"},Qc=["title","disabled"],ed={class:"tb-item","data-key":"fillColor"},td={class:"toolbar-split"},nd=["title","disabled"],od={viewBox:"0 0 1024 1024",fill:"currentColor"},ld=["fill"],rd={class:"toolbar-btn__label"},ad=["title","disabled"],id={class:"tb-item","data-key":"border"},sd={class:"toolbar-split"},cd=["title","disabled"],dd={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},ud=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],fd=["cx","cy","r"],md={class:"toolbar-btn__label"},pd=["title","disabled"],hd={class:"tb-item","data-key":"hAlign"},gd={class:"tb-item","data-key":"vAlign"},bd={class:"tb-item","data-key":"wrap"},yd=["title"],Cd={class:"toolbar-btn__label"},wd={class:"tb-item","data-key":"merge"},vd={class:"toolbar-split"},kd=["title","disabled"],Ed={class:"toolbar-btn__label"},Rd=["title","disabled"],Sd={class:"tb-item","data-key":"numFmt"},Md={class:"toolbar-number-format-group"},Nd=["title","disabled"],Bd=["title","disabled"],xd={class:"tb-item","data-key":"calc"},Td={class:"toolbar-split"},Vd=["title","disabled"],Dd={class:"toolbar-btn__label"},Fd=["title","disabled"],Od={class:"tb-item","data-key":"sort"},Id={class:"toolbar-split"},Ad=["title","disabled"],Ld={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},$d=["x1","y1","x2","y2"],zd=["d"],_d={class:"toolbar-btn__label"},Hd=["title","disabled"],Wd={class:"tb-item","data-key":"outline"},Ud=["disabled","title"],Pd={class:"toolbar-btn__label"},Kd={class:"tb-item","data-key":"filter"},Gd=["disabled","title"],qd={class:"toolbar-btn__label"},Yd={class:"tb-item","data-key":"freeze"},jd={class:"tb-item","data-key":"cf"},Xd={class:"tb-item","data-key":"dv"},Zd=["title"],Jd={class:"toolbar-btn__label"},Qd={class:"tb-item","data-key":"find"},eu=["title"],tu={class:"toolbar-btn__label"},nu=["disabled"],ou=["disabled"],wa='<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>',lu='<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>',ru='<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>',au='<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>',dr=2,iu=6,su=34,cu=Lt(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:{},cachedBorderColor:{},cachedBorderLineStyle:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},outlineMenuOpen:{type:Boolean},outlineAxis:{},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},cfMenuOpen:{type:Boolean},freezeMenuOpen:{type:Boolean},fontMenuOpen:{type:Boolean},hAlignMenuOpen:{type:Boolean},vAlignMenuOpen:{type:Boolean},numFmtMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},freezePanesDisabled:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{},canIncreaseDecimals:{type:Boolean},canDecreaseDecimals:{type:Boolean},boundaryEl:{}},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","border-color-change","border-line-style-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","update:cf-menu-open","update:freeze-menu-open","update:font-menu-open","update:h-align-menu-open","update:v-align-menu-open","update:num-fmt-menu-open","border-change","sort-change","merge-change","cf-clear"],setup(e,{expose:l,emit:n}){const o=["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"],a=t.ref(null),i=t.ref(null),r=t.ref(null),c=t.ref(null),s=t.ref(null),y=t.ref(null),h=t.ref(null),R=t.ref(null),f=t.ref(null),E=t.ref(null),k=t.ref(null),N=t.ref(new Set),Y=t.ref(!1),te=t.ref(!1),me=t.ref(0),he=t.ref(!1),Te=t.ref(!1),pe=new Map,Ee=t.computed(()=>N.value.size>0);function Le(Ae){return N.value.has(Ae)}const ue=t.computed(()=>{const Ae=i.value;return Ae instanceof HTMLElement?Ae:void 0});function ie(Ae){return ue.value?!Le(Ae):!0}function tt(){for(const Ae of o){const w=pe.get(Ae);if(w===void 0||w===0)return!0}return!1}function st(){if(!a.value)return;a.value.querySelectorAll(".tb-item").forEach(w=>{const X=w.dataset.key;if(!X)return;const dt=w.offsetWidth;dt>0?pe.set(X,dt):pe.has(X)||pe.set(X,0)})}function Z(Ae,w){if(Ae.size!==w.size)return!1;for(const X of Ae)if(!w.has(X))return!1;return!0}let O=0,L=0,oe=null;function $e(){if(O&&cancelAnimationFrame(O),L>60){oe&&clearTimeout(oe),oe=setTimeout(()=>{L=0,$e()},500);return}L++,O=requestAnimationFrame(()=>requestAnimationFrame(lt))}function lt(){if(!a.value)return;const Ae=a.value.clientWidth-iu*2;if(Ae<=0){$e();return}L=0,(pe.size===0||tt())&&st();let w=0;for(const dt of o)w+=(pe.get(dt)??0)+dr;const X=new Set;if(w>Ae){const dt=Ae-su-dr;let Nt=0;for(let Ct=0;Ct<o.length;Ct++){const $t=o[Ct],xt=(pe.get($t)??0)+dr;if(Nt+xt>dt){for(let Tt=Ct;Tt<o.length;Tt++)X.add(o[Tt]);break}Nt+=xt}}Z(X,N.value)||(N.value=X,me.value++,X.size===0&&(Y.value=!1))}let ne=null;const xe=t.ref(0),Ne=t.computed(()=>{const Ae=r.value,w={position:"fixed",top:"0px",right:"0px"};if(!Ae)return{...$.themeVars,...w};xe.value;const X=Ae.getBoundingClientRect(),dt=Fn($.boundaryEl);return{...$.themeVars,position:"fixed",top:`${X.bottom+4}px`,right:`${Fo(Math.min(X.right,dt.right))}px`}});function se(){Y.value&&(xe.value++,t.nextTick(()=>lt()))}function de(Ae){var X,dt,Nt;if(!Y.value)return;const w=Ae.target;(X=w.closest)!=null&&X.call(w,".overflow-menu-wrap")||(dt=r.value)!=null&&dt.contains(w)||(Nt=w.closest)!=null&&Nt.call(w,".cf-menu, .sp-dropdown__menu, .color-picker__menu, .outline-picker__menu, .border-picker__menu, .calc-picker__menu, .merge-picker__menu, .sort-picker__menu")||(te.value=!0,Y.value=!1,t.nextTick(()=>{te.value=!1}))}function Be(){Y.value=!Y.value,Y.value&&t.nextTick(I)}function _e(){Y.value=!1,V("open-data-validation")}function Ge(){Y.value=!1,V("find")}function ct(){Y.value=!1,V("toggle-filter")}function nt(){Y.value=!1}function I(){const Ae=i.value;Ae&&(he.value=Ae.scrollTop>1,Te.value=Ae.scrollTop+Ae.clientHeight<Ae.scrollHeight-1,q())}function H(Ae){const w=i.value;w&&(w.scrollTop=Math.max(0,Math.min(w.scrollHeight-w.clientHeight,w.scrollTop+Ae*40)))}l({closeOverflow:nt}),t.onMounted(()=>{$e(),a.value&&(ne=new ResizeObserver(()=>{Y.value||$e()}),ne.observe(a.value)),document.addEventListener("pointerdown",de,!0),window.addEventListener("resize",se),window.addEventListener("load",$e),window.addEventListener("orientationchange",$e)}),t.onBeforeUnmount(()=>{O&&cancelAnimationFrame(O),oe&&clearTimeout(oe),ne==null||ne.disconnect(),document.removeEventListener("pointerdown",de,!0),window.removeEventListener("resize",se),window.removeEventListener("load",$e),window.removeEventListener("orientationchange",$e)});const $=e,V=n,B=["fontSize","textColor","fillColor","border","merge","calc","sort","outline","cf","freeze","font","hAlign","vAlign","numFmt"],W={fontSize:"update:font-size-menu-open",textColor:"update:text-color-menu-open",fillColor:"update:fill-color-menu-open",border:"update:border-menu-open",merge:"update:merge-menu-open",calc:"update:calc-menu-open",sort:"update:sort-menu-open",outline:"update:outline-menu-open",cf:"update:cf-menu-open",freeze:"update:freeze-menu-open",font:"update:font-menu-open",hAlign:"update:h-align-menu-open",vAlign:"update:v-align-menu-open",numFmt:"update:num-fmt-menu-open"};function z(Ae,w){if(w)for(const X of B)X!==Ae&&V(W[X],!1);V(W[Ae],w)}function q(){for(const Ae of B)V(W[Ae],!1)}function Ce(Ae){var X;const w=Ae.target;(X=w.closest)!=null&&X.call(w,".toolbar-split__arrow, .outline-trigger, .toolbar-font-size__btn, .cf-menu-trigger, .sp-dropdown__trigger")||q()}const We=t.computed(()=>$.selNumberFormat===Qn?g($.locale,"nfMixed"):""),gt=t.computed(()=>{const Ae=[{label:g($.locale,"freezeFirstRow"),value:"firstRow",icon:lu},{label:g($.locale,"freezeFirstCol"),value:"firstCol",icon:ru}];return $.hasFreeze?Ae.unshift({label:g($.locale,"unfreezePanes"),value:"unfreeze",icon:au}):Ae.unshift({label:g($.locale,"freezePanes"),value:"panes",icon:wa,disabled:$.freezePanesDisabled}),Ae});return(Ae,w)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:a,class:"toolbar",onMousedown:w[67]||(w[67]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("undo"),to:ue.value},[t.createElementVNode("div",gc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(g)(e.locale,"undo"),disabled:!e.canUndo,onClick:w[0]||(w[0]=X=>V("undo"))},[w[71]||(w[71]=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",yc,t.toDisplayString(t.unref(g)(e.locale,"undo")),1)],10,bc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("redo"),to:ue.value},[t.createElementVNode("div",Cc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(g)(e.locale,"redo"),disabled:!e.canRedo,onClick:w[1]||(w[1]=X=>V("redo"))},[w[72]||(w[72]=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",vc,t.toDisplayString(t.unref(g)(e.locale,"redo")),1)],10,wc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("paint"),to:ue.value},[t.createElementVNode("div",kc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(g)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:w[2]||(w[2]=X=>V("paint-format"))},[w[73]||(w[73]=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",Rc,t.toDisplayString(t.unref(g)(e.locale,"paintFormat")),1)],10,Ec)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("clear"),to:ue.value},[t.createElementVNode("div",Sc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(g)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:w[3]||(w[3]=X=>V("clear-format"))},[w[74]||(w[74]=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",Nc,t.toDisplayString(t.unref(g)(e.locale,"clearFormat")),1)],10,Mc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("sep1"),to:ue.value},[w[75]||(w[75]=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:ie("font"),to:ue.value},[t.createElementVNode("div",Bc,[t.createVNode(Pt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:Le("font")?"100%":110,"menu-width":Le("font")?120:void 0,"visible-count":8,title:t.unref(g)(e.locale,"fontFamily"),align:"right","preview-font":!0,"model-open":e.fontMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[4]||(w[4]=X=>z("font",X)),onChange:w[5]||(w[5]=X=>V("font-family-change",X))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("fontSize"),to:ue.value},[t.createElementVNode("div",xc,[t.createElementVNode("div",Tc,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(g)(e.locale,"fontSize"),onMousedown:w[6]||(w[6]=t.withModifiers(()=>{},["stop"])),onInput:w[7]||(w[7]=X=>V("font-size-input",X.target.value)),onBlur:w[8]||(w[8]=X=>V("font-size-blur")),onKeydown:w[9]||(w[9]=X=>V("font-size-keydown",X))},null,40,Vc),t.createVNode(Pt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:Le("fontSize")?"100%":56,"menu-width":Le("fontSize")?120:56,"visible-count":9,title:t.unref(g)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":k.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[10]||(w[10]=X=>z("fontSize",X)),onChange:w[11]||(w[11]=X=>V("font-size-change",X))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el","boundary-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:k,class:"toolbar-font-size__btn",type:"button",title:t.unref(g)(e.locale,"fontSize"),onMousedown:w[12]||(w[12]=t.withModifiers(()=>{},["prevent"])),onClick:w[13]||(w[13]=X=>V("font-size-toggle"))},[...w[76]||(w[76]=[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,Dc),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(g)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:w[14]||(w[14]=t.withModifiers(()=>{},["prevent"])),onClick:w[15]||(w[15]=X=>V("font-size-step-down"))},[...w[77]||(w[77]=[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,Fc),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(g)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:w[16]||(w[16]=t.withModifiers(()=>{},["prevent"])),onClick:w[17]||(w[17]=X=>V("font-size-step-up"))},[...w[78]||(w[78]=[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,Oc)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("sep2"),to:ue.value},[w[79]||(w[79]=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:ie("bold"),to:ue.value},[t.createElementVNode("div",Ic,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(g)(e.locale,"bold"),disabled:!e.hasSelection,onClick:w[18]||(w[18]=X=>V("bold-toggle"))},[w[80]||(w[80]=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",Lc,t.toDisplayString(t.unref(g)(e.locale,"bold")),1)],10,Ac)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("italic"),to:ue.value},[t.createElementVNode("div",$c,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(g)(e.locale,"italic"),disabled:!e.hasSelection,onClick:w[19]||(w[19]=X=>V("italic-toggle"))},[w[81]||(w[81]=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",_c,t.toDisplayString(t.unref(g)(e.locale,"italic")),1)],10,zc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("underline"),to:ue.value},[t.createElementVNode("div",Hc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(g)(e.locale,"underline"),disabled:!e.hasSelection,onClick:w[20]||(w[20]=X=>V("underline-toggle"))},[w[82]||(w[82]=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",Uc,t.toDisplayString(t.unref(g)(e.locale,"underline")),1)],10,Wc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("strike"),to:ue.value},[t.createElementVNode("div",Pc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(g)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:w[21]||(w[21]=X=>V("strikethrough-toggle"))},[w[83]||(w[83]=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",Gc,t.toDisplayString(t.unref(g)(e.locale,"strikethrough")),1)],10,Kc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("sep3"),to:ue.value},[w[84]||(w[84]=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:ie("textColor"),to:ue.value},[t.createElementVNode("div",qc,[t.createElementVNode("div",Yc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:w[22]||(w[22]=X=>V("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Xc,[w[85]||(w[85]=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||"currentColor"},null,8,Zc)])),t.createElementVNode("span",Jc,t.toDisplayString(t.unref(g)(e.locale,"fontColor")),1)],8,jc),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:c,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:w[23]||(w[23]=X=>z("textColor",!e.textColorMenuOpen))},[...w[86]||(w[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,Qc),t.createVNode(Nl,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":c.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[24]||(w[24]=X=>z("textColor",X)),onChange:w[25]||(w[25]=X=>V("text-color-change",X))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("fillColor"),to:ue.value},[t.createElementVNode("div",ed,[t.createElementVNode("div",td,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:w[26]||(w[26]=X=>V("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",od,[w[87]||(w[87]=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,ld)])),t.createElementVNode("span",rd,t.toDisplayString(t.unref(g)(e.locale,"fillColor")),1)],8,nd),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:s,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:w[27]||(w[27]=X=>z("fillColor",!e.fillColorMenuOpen))},[...w[88]||(w[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,ad),t.createVNode(Nl,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":s.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[28]||(w[28]=X=>z("fillColor",X)),onChange:w[29]||(w[29]=X=>V("fill-color-change",X))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("border"),to:ue.value},[t.createElementVNode("div",id,[t.createElementVNode("div",sd,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"borders"),disabled:!e.hasSelection,onClick:w[30]||(w[30]=X=>V("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",dd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(fa),X=>(t.openBlock(),t.createElementBlock("line",{key:X.name,x1:X.x1,y1:X.y1,x2:X.x2,y2:X.y2,"stroke-width":t.unref(Ro)(e.cachedBorder,X.name)==="thick"?3:1.5,"stroke-dasharray":t.unref(Ro)(e.cachedBorder,X.name)==="dashed"?"0 4":"none","stroke-linecap":t.unref(Ro)(e.cachedBorder,X.name)==="dashed"?"round":"square"},null,8,ud))),128)),t.unref(ma)(e.cachedBorder)?(t.openBlock(),t.createElementBlock("circle",{key:0,cx:t.unref(ha),cy:t.unref(ga),r:t.unref(pa),fill:"currentColor",stroke:"none"},null,8,fd)):t.createCommentVNode("",!0)])),t.createElementVNode("span",md,t.toDisplayString(t.unref(g)(e.locale,t.unref(Rs)[e.cachedBorder]??"borders")),1)],8,cd),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"borders"),disabled:!e.hasSelection,onClick:w[31]||(w[31]=X=>z("border",!e.borderMenuOpen))},[...w[89]||(w[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,pd),t.createVNode(As,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"current-color":e.cachedBorderColor,"current-line-style":e.cachedBorderLineStyle,"trigger-el":y.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[32]||(w[32]=X=>z("border",X)),onChange:w[33]||(w[33]=X=>V("border-change",X)),onChangeColor:w[34]||(w[34]=X=>V("border-color-change",X)),onChangeLineStyle:w[35]||(w[35]=X=>V("border-line-style-change",X))},null,8,["model-open","locale","current-border","current-color","current-line-style","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("sep4"),to:ue.value},[w[90]||(w[90]=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:ie("hAlign"),to:ue.value},[t.createElementVNode("div",hd,[t.createVNode(Pt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:Le("hAlign")?"100%":44,"menu-width":Le("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(g)(e.locale,"hAlign"),"model-open":e.hAlignMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[36]||(w[36]=X=>z("hAlign",X)),onChange:w[37]||(w[37]=X=>V("h-align-change",X))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("vAlign"),to:ue.value},[t.createElementVNode("div",gd,[t.createVNode(Pt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:Le("vAlign")?"100%":44,"menu-width":Le("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(g)(e.locale,"vAlign"),"model-open":e.vAlignMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[38]||(w[38]=X=>z("vAlign",X)),onChange:w[39]||(w[39]=X=>V("v-align-change",X))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("wrap"),to:ue.value},[t.createElementVNode("div",bd,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(g)(e.locale,"wrap"),onClick:w[40]||(w[40]=X=>V("wrap-toggle"))},[w[91]||(w[91]=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",Cd,t.toDisplayString(t.unref(g)(e.locale,"wrap")),1)],10,yd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("merge"),to:ue.value},[t.createElementVNode("div",wd,[t.createElementVNode("div",vd,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:w[41]||(w[41]=X=>V("apply-merge"))},[w[92]||(w[92]=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",Ed,t.toDisplayString(t.unref(g)(e.locale,"mergeCenter")),1)],8,kd),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:w[42]||(w[42]=X=>z("merge",!e.mergeMenuOpen))},[...w[93]||(w[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,Rd),t.createVNode(Zs,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":R.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[43]||(w[43]=X=>z("merge",X)),onChange:w[44]||(w[44]=X=>V("merge-change",X))},null,8,["model-open","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("sep6"),to:ue.value},[w[94]||(w[94]=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:ie("numFmt"),to:ue.value},[t.createElementVNode("div",Sd,[t.createElementVNode("div",Md,[t.createVNode(Pt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:Le("numFmt")?"auto":92,"menu-width":(Le("numFmt"),150),"visible-count":8,title:t.unref(g)(e.locale,"numberFormat"),"fallback-label":We.value,align:"right","model-open":e.numFmtMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[45]||(w[45]=X=>z("numFmt",X)),onChange:w[46]||(w[46]=X=>V("number-format-change",String(X)))},null,8,["model-value","options","width","menu-width","title","fallback-label","model-open","boundary-el"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(g)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:w[47]||(w[47]=X=>V("increase-decimals"))},[...w[95]||(w[95]=[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,Nd),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(g)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:w[48]||(w[48]=X=>V("decrease-decimals"))},[...w[96]||(w[96]=[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,Bd)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("sep7"),to:ue.value},[w[97]||(w[97]=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:ie("calc"),to:ue.value},[t.createElementVNode("div",xd,[t.createElementVNode("div",Td,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:w[49]||(w[49]=X=>V("calc-sum"))},[w[98]||(w[98]=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",Dd,t.toDisplayString(t.unref(g)(e.locale,"sum")),1)],8,Vd),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:f,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:w[50]||(w[50]=X=>z("calc",!e.calcMenuOpen))},[...w[99]||(w[99]=[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,Fd),t.createVNode(hc,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":f.value,disabled:e.isSingleCell,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[51]||(w[51]=X=>z("calc",X)),onChange:w[52]||(w[52]=X=>V(`calc-${X}`))},null,8,["model-open","locale","trigger-el","disabled","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("sort"),to:ue.value},[t.createElementVNode("div",Od,[t.createElementVNode("div",Id,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(g)(e.locale,"sortAsc"):t.unref(g)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:w[53]||(w[53]=X=>V("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Ld,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ya),X=>(t.openBlock(),t.createElementBlock("line",{key:X.name,x1:X.x1,y1:X.y1,x2:X.x2,y2:X.y2},null,8,$d))),128)),t.createElementVNode("path",{d:t.unref(Ca)[e.cachedSortOrder]},null,8,zd)])),t.createElementVNode("span",_d,t.toDisplayString(t.unref(g)(e.locale,"sort")),1)],8,Ad),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:h,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"sort"),disabled:!e.canSort,onClick:w[54]||(w[54]=X=>z("sort",!e.sortMenuOpen))},[...w[100]||(w[100]=[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,Hd),t.createVNode(Us,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":h.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[55]||(w[55]=X=>z("sort",X)),onChange:w[56]||(w[56]=X=>V("sort-change",X))},null,8,["model-open","locale","current-sort","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("outline"),to:ue.value},[t.createElementVNode("div",Wd,[t.createElementVNode("button",{ref_key:"outlineArrowRef",ref:E,class:t.normalizeClass(["toolbar-btn outline-trigger",{"is-open":e.outlineMenuOpen}]),disabled:!e.outlineAxis,title:t.unref(g)(e.locale,"outlineGroup"),onClick:w[57]||(w[57]=X=>z("outline",!e.outlineMenuOpen))},[w[101]||(w[101]=t.createElementVNode("svg",{class:"outline-trigger__icon",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",Pd,t.toDisplayString(t.unref(g)(e.locale,"outlineGroup")),1),w[102]||(w[102]=t.createElementVNode("svg",{class:"outline-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))],10,Ud),t.createVNode(qs,{"model-open":e.outlineMenuOpen,locale:e.locale,"trigger-el":E.value,"boundary-el":e.boundaryEl,axis:e.outlineAxis,"onUpdate:modelOpen":w[58]||(w[58]=X=>z("outline",X)),onAction:w[59]||(w[59]=X=>V("outline-action",X))},null,8,["model-open","locale","trigger-el","boundary-el","axis"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("filter"),to:ue.value},[t.createElementVNode("div",Kd,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter,title:e.filterActive?t.unref(g)(e.locale,"clearFilter"):t.unref(g)(e.locale,"filter"),onClick:ct},[w[103]||(w[103]=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",qd,t.toDisplayString(t.unref(g)(e.locale,"filter")),1)],10,Gd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("freeze"),to:ue.value},[t.createElementVNode("div",Yd,[t.createVNode(Pt,{class:"toolbar-freeze","model-value":"",options:gt.value,width:Le("freeze")?"100%":44,"menu-width":Le("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(g)(e.locale,"freezePane"),"trigger-icon":wa,"trigger-label":t.unref(g)(e.locale,"freezePane"),"model-open":e.freezeMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[60]||(w[60]=X=>z("freeze",X)),onChange:w[61]||(w[61]=X=>V("freeze-change",String(X)))},null,8,["options","width","menu-width","title","trigger-label","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("cf"),to:ue.value},[t.createElementVNode("div",jd,[t.createVNode(fc,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,"model-open":e.cfMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":w[62]||(w[62]=X=>z("cf",X)),onPreset:w[63]||(w[63]=X=>V("cf-preset",X)),onNewRule:w[64]||(w[64]=X=>V("cf-new-rule")),onManage:w[65]||(w[65]=X=>V("cf-manage")),onClear:w[66]||(w[66]=X=>V("cf-clear",X))},null,8,["locale","has-selection","theme-vars","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("dv"),to:ue.value},[t.createElementVNode("div",Xd,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(g)(e.locale,"dv"),onClick:_e},[w[104]||(w[104]=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",Jd,t.toDisplayString(t.unref(g)(e.locale,"dv")),1)],8,Zd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ie("find"),to:ue.value},[t.createElementVNode("div",Qd,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(g)(e.locale,"find"),onClick:Ge},[w[105]||(w[105]=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",tu,t.toDisplayString(t.unref(g)(e.locale,"findReplace")),1)],8,eu)])],8,["disabled","to"])),Ee.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:r,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":Y.value}]),type:"button",onClick:Be},[...w[106]||(w[106]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],544),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["overflow-menu-wrap",{"no-anim":te.value}]),style:t.normalizeStyle(Ne.value),onPointerdown:w[70]||(w[70]=t.withModifiers(()=>{},["stop","prevent"]))},[he.value||Te.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!he.value}]),disabled:!he.value,onClick:w[68]||(w[68]=X=>H(-1))},[...w[107]||(w[107]=[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,nu)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:i,key:me.value,class:"overflow-menu",onScroll:I,onClick:Ce},null,32)),he.value||Te.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Te.value}]),disabled:!Te.value,onClick:w[69]||(w[69]=X=>H(1))},[...w[108]||(w[108]=[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,ou)):t.createCommentVNode("",!0)],38),[[t.vShow,Y.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-47d578cd"]]),du=["title"],uu={class:"tab-list"},fu=["onClick","onDblclick","onContextmenu","onTouchstart"],mu=["value"],pu={key:1,class:"tab-item__name"},hu=["title"],gu=["disabled"],bu=["title","onClick"],yu={class:"tab-list-menu__name"},Cu=["title","disabled","onClick"],wu=["disabled"],vu=8,va=450,Bl=8,ku=Lt(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{},boundaryEl:{}},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:l}){const n=e,o=l,a=t.ref(null),i=t.ref(!1),r=t.ref(0),c=t.ref({left:0,bottom:0}),s=t.ref(null),y=t.computed(()=>Math.min(vu,n.sheets.length)),h=t.computed(()=>n.sheets.slice(r.value,r.value+y.value)),R=t.computed(()=>r.value>0),f=t.computed(()=>r.value+y.value<n.sheets.length),E=t.computed(()=>n.sheets.length>y.value),k=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!i.value)return;const H=Math.max(0,n.sheets.length-y.value);r.value>H&&(r.value=H)});function N(H){r.value=Math.max(0,Math.min(n.sheets.length-y.value,r.value+H))}function Y(){if(i.value){i.value=!1;return}const H=a.value;if(!H)return;const $=H.getBoundingClientRect(),V=Fn(n.boundaryEl);c.value={left:Math.max(V.left,$.left),bottom:window.innerHeight-$.top+4};const B=n.activeSheetIndex;r.value=B>=0?Math.max(0,Math.min(B-Math.floor(y.value/2),n.sheets.length-y.value)):0,i.value=!0}function te(H){o("tab-click",H),i.value=!1}function me(H){k.value&&o("delete-sheet",H)}function he(H){var B;if(!i.value)return;const $=H.target;if((B=a.value)!=null&&B.contains($))return;const V=document.querySelector(".tab-list-menu");V!=null&&V.contains($)||(i.value=!1)}function Te(H){i.value&&H.key==="Escape"&&(i.value=!1)}function pe(H){i.value&&(H.preventDefault(),N(H.deltaY>0?1:-1))}function Ee(){i.value=!1}function Le(H){!i.value||H.target===s.value||Ee()}const ue=t.ref(0),ie=t.ref(!1);function tt(H){i.value&&(ue.value=H.touches[0].clientY,ie.value=!0)}function st(H){if(!i.value||!ie.value)return;const $=H.touches[0].clientY-ue.value;Math.abs($)>5&&(N($<0?1:-1),ue.value=H.touches[0].clientY)}function Z(){ie.value=!1}let O=null,L=-1,oe=0,$e=0,lt=!1,ne=null,xe=0,Ne=0;function se(H,$,V){return{clientX:H,clientY:$,target:V,preventDefault(){},stopPropagation(){}}}function de(H,$){const V=H.touches[0];if(!V)return;oe=V.clientX,$e=V.clientY,L=$,O!==null&&clearTimeout(O);const B=H.target;O=window.setTimeout(()=>{lt=!0;const W=se(oe,$e,B);o("tab-contextmenu",{ev:W,i:L})},va)}function Be(H){const $=H.touches[0];!$||O===null||(Math.abs($.clientX-oe)>Bl||Math.abs($.clientY-$e)>Bl)&&(clearTimeout(O),O=null)}function _e(){O!==null&&(clearTimeout(O),O=null)}function Ge(H){if(lt){lt=!1;return}o("tab-click",H)}function ct(H){const $=H.touches[0];if(!$)return;const V=H.target;if(V.closest(".tab-item")||V.closest(".tab-bar__add-btn")||V.closest(".tab-bar__list-btn"))return;xe=$.clientX,Ne=$.clientY,ne!==null&&clearTimeout(ne);const B=V;ne=window.setTimeout(()=>{const W=se(xe,Ne,B);o("tabbar-contextmenu",W)},va)}function nt(H){const $=H.touches[0];!$||ne===null||(Math.abs($.clientX-xe)>Bl||Math.abs($.clientY-Ne)>Bl)&&(clearTimeout(ne),ne=null)}function I(){ne!==null&&(clearTimeout(ne),ne=null)}return t.watch(i,H=>{t.nextTick(()=>{var $,V;H?($=s.value)==null||$.addEventListener("wheel",pe,{passive:!1}):(V=s.value)==null||V.removeEventListener("wheel",pe)})}),t.onMounted(()=>{document.addEventListener("pointerdown",he),document.addEventListener("keydown",Te),window.addEventListener("resize",Ee),window.addEventListener("scroll",Le,!0)}),t.onBeforeUnmount(()=>{O!==null&&clearTimeout(O),ne!==null&&clearTimeout(ne),document.removeEventListener("pointerdown",he),document.removeEventListener("keydown",Te),window.removeEventListener("resize",Ee),window.removeEventListener("scroll",Le,!0)}),(H,$)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:$[8]||($[8]=V=>o("tabbar-contextmenu",V)),onTouchstart:ct,onTouchmove:nt,onTouchend:I,onTouchcancel:I},[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(g)(e.locale,"sheetList"),onClick:Y},[...$[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,du),t.createElementVNode("div",uu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(V,B)=>(t.openBlock(),t.createElementBlock("div",{key:V.id,class:t.normalizeClass(["tab-item",{"tab-item--active":B===e.activeSheetIndex}]),onClick:W=>Ge(B),onDblclick:t.withModifiers(W=>o("tab-dblclick",B),["prevent"]),onContextmenu:W=>o("tab-contextmenu",{ev:W,i:B}),onTouchstart:W=>de(W,B),onTouchmove:Be,onTouchend:_e,onTouchcancel:_e},[e.renTab===B?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:$[0]||($[0]=W=>o("tab-rename-input",W.target.value)),onKeydown:$[1]||($[1]=W=>o("tab-rename-keydown",W)),onBlur:$[2]||($[2]=W=>o("tab-rename-commit")),onClick:$[3]||($[3]=t.withModifiers(()=>{},["stop"]))},null,40,mu)):(t.openBlock(),t.createElementBlock("span",pu,t.toDisplayString(V.name),1))],42,fu))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(g)(e.locale,"addSheet"),onClick:$[4]||($[4]=V=>o("add-sheet"))}," + ",8,hu),(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"]))},[E.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!R.value}]),disabled:!R.value,onClick:$[5]||($[5]=V=>N(-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,gu)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:s,class:"tab-list-menu__list",onTouchstart:tt,onTouchmove:st,onTouchend:Z},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,V=>(t.openBlock(),t.createElementBlock("div",{key:V.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(V)===e.activeSheetIndex}]),title:V.name,onClick:B=>te(e.sheets.indexOf(V))},[t.createElementVNode("span",yu,t.toDisplayString(V.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(g)(e.locale,"delete"),disabled:!k.value,onClick:t.withModifiers(B=>me(e.sheets.indexOf(V)),["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,Cu)],10,bu))),128))],544),E.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!f.value}]),disabled:!f.value,onClick:$[6]||($[6]=V=>N(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,wu)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-32dfb822"]]),Eu={class:"find-bar__row find-bar__row--inputs"},Ru=["placeholder","value"],Su=["placeholder","value"],Mu=["title","disabled"],Nu=["title","disabled"],Bu=["title"],xu={class:"find-bar__row find-bar__row--controls"},Tu=["title"],Vu={class:"find-bar__count"},Du=["disabled"],Fu=["disabled"],Ou={class:"find-bar__chk find-bar__chk--panel"},Iu=["checked"],Au={class:"find-bar__chk find-bar__chk--panel"},Lu=["checked"],$u=Lt(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:l}){const n=e,o=l,a=t.ref(null),i=t.ref(null),r=t.ref(!1),c=t.ref({top:0,left:0}),s=t.computed(()=>n.total>0?`${n.currentIndex+1}/${n.total}`:n.message||""),y=t.computed(()=>[{label:g(n.locale,"scopeSheet"),value:"sheet"},{label:g(n.locale,"scopeWorkbook"),value:"workbook"},{label:g(n.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>n.focusToken,()=>{t.nextTick(()=>{var E;return(E=a.value)==null?void 0:E.focus()})});function h(E){E.key==="Enter"?(E.preventDefault(),E.shiftKey?o("prev"):o("next")):E.key==="Escape"&&(E.preventDefault(),o("close"))}function R(){if(i.value){if(!r.value){const E=i.value.getBoundingClientRect();c.value={top:E.bottom+2,left:E.left}}r.value=!r.value}}function f(E){if(!r.value)return;const k=E.target;k.closest(".find-bar__settings-btn")||k.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,E=>{E?document.addEventListener("pointerdown",f,!0):document.removeEventListener("pointerdown",f,!0)}),t.watch(()=>n.open,E=>{E||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",f,!0)),(E,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",Eu,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(g)(e.locale,"findPlaceholder"),value:e.findText,onInput:k[0]||(k[0]=N=>o("update:findText",N.target.value)),onKeydown:h},null,40,Ru),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(g)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:k[1]||(k[1]=N=>o("update:replaceText",N.target.value)),onKeydown:h},null,40,Su),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(g)(e.locale,"findPrev"),disabled:e.total===0,onClick:k[2]||(k[2]=N=>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,Mu),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(g)(e.locale,"findNext"),disabled:e.total===0,onClick:k[3]||(k[3]=N=>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,Nu),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(g)(e.locale,"findClose"),onClick:k[4]||(k[4]=N=>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,Bu)]),t.createElementVNode("div",xu,[t.createVNode(Pt,{class:"find-bar__dropdown","model-value":e.scope,options:y.value,title:t.unref(g)(e.locale,"findScope"),"onUpdate:modelValue":k[5]||(k[5]=N=>E.$emit("update:scope",N))},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(g)(e.locale,"findOptions"),onClick:t.withModifiers(R,["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,Tu),t.createElementVNode("span",Vu,t.toDisplayString(s.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[6]||(k[6]=N=>o("replace"))},t.toDisplayString(t.unref(g)(e.locale,"replace")),9,Du),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[7]||(k[7]=N=>o("replace-all"))},t.toDisplayString(t.unref(g)(e.locale,"replaceAll")),9,Fu)])],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:k[10]||(k[10]=t.withModifiers(()=>{},["stop"])),onMousedown:k[11]||(k[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",Ou,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:k[8]||(k[8]=N=>o("update:matchCase",N.target.checked))},null,40,Iu),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(g)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Au,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:k[9]||(k[9]=N=>o("update:matchEntireCell",N.target.checked))},null,40,Lu),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(g)(e.locale,"matchEntireCell")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],64))}}),[["__scopeId","data-v-8a039e41"]]),zu={class:"nf-dialog__header"},_u={class:"nf-dialog__title"},Hu={class:"nf-dialog__body"},Wu={class:"nf-field"},Uu={class:"nf-field__label"},Pu={key:0,class:"nf-field"},Ku={class:"nf-field__label"},Gu={key:1,class:"nf-field nf-field--inline"},qu={class:"nf-checkbox"},Yu={key:2,class:"nf-field"},ju={class:"nf-field__label"},Xu={key:3,class:"nf-field"},Zu={class:"nf-field__label"},Ju={key:4,class:"nf-field"},Qu={class:"nf-field__label"},ef={key:5,class:"nf-field"},tf={class:"nf-field__label"},nf={key:6,class:"nf-field"},of={class:"nf-field__label"},lf={class:"nf-field"},rf={class:"nf-field__label"},af={class:"nf-dialog__footer"},sf={class:"nf-preview"},cf={class:"nf-preview__label"},df={class:"nf-preview__value"},uf={class:"nf-dialog__actions"},ff=Lt(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:l}){const n=e,o=l,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),c=t.ref(!1),s=t.ref("$"),y=t.ref("m/d/yyyy"),h=t.ref("h:mm:ss"),R=t.ref("m/d/yyyy h:mm:ss"),f=t.ref("[h]:mm:ss"),E=t.ref(""),k=t.ref(null),N=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Y=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],te=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],me=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],he=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],Te=t.computed(()=>n.locale==="zh-CN"?[...Y,...te]:[...te,...Y]),pe=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],Ee=t.computed(()=>n.locale==="zh-CN"?[...me,...he]:[...he,...me]),Le=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ue={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"},ie=t.computed(()=>ns.map(q=>({label:g(n.locale,ue[q]),value:q}))),tt=N.map(q=>({label:q.label,value:q.value})),st=t.computed(()=>Te.value.map(q=>({label:q,value:q}))),Z=pe.map(q=>({label:q,value:q})),O=t.computed(()=>Ee.value.map(q=>({label:q,value:q}))),L=Le.map(q=>({label:q,value:q})),oe=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),$e=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),lt=t.computed(()=>i.value==="date"),ne=t.computed(()=>i.value==="time"),xe=t.computed(()=>i.value==="dateTime"),Ne=t.computed(()=>i.value==="duration"),se=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function de(){if(i.value==="general")return mo;if(i.value==="text")return On;if(i.value==="custom")return E.value;if(i.value==="date")return y.value;if(i.value==="time")return h.value;if(i.value==="dateTime")return R.value;if(i.value==="duration")return f.value;const q=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?Be(i.value,q,c.value,s.value):cs(n.locale,i.value,q,c.value)}function Be(q,Ce,We,gt){const Ae=We?"#,##0":"0";if(q==="currencyRounded")return gt+Ae;const w=Ce>0?"."+"0".repeat(Ce):"",X=Ae+w;return q==="currency"?gt+X:`${gt}${X};(${gt}${X});${gt}"-"`}function _e(q){if(E.value=q,In(q)){i.value="general";return}if(q==="@"){i.value="text";return}const Ce=q.replace(/\[[^\]]*\]/gi,w=>/\[h\]/i.test(w)?w:"");if(/\[h\]/i.test(Ce)&&!/[yd]/i.test(Ce)){i.value="duration",Le.includes(q)&&(f.value=q);return}const We=/[yd]/i.test(Ce),gt=/h|s|AM\/PM/i.test(Ce);if(We&>){i.value="dateTime",Ee.value.includes(q)&&(R.value=q);return}if(We||/AM\/PM/i.test(Ce)){gt&&!We?(i.value="time",pe.includes(q)&&(h.value=q)):(i.value="date",Te.value.includes(q)&&(y.value=q));return}if(q.includes("%")){i.value="percent",r.value=Ge(q);return}if(/E[+-]/i.test(q)){i.value="scientific",r.value=Ge(q);return}const Ae=N.find(w=>q.startsWith(w.value));if(q.includes("[Red](")){i.value="financial",c.value=q.includes(","),r.value=Ge(q);return}if(Ae){q.includes("(")?(i.value="accounting",s.value=Ae.value,c.value=q.includes(","),r.value=Ge(q)):/\.\d/.test(q.slice(Ae.value.length))?(i.value="currency",s.value=Ae.value,c.value=q.includes(","),r.value=Ge(q)):(i.value="currencyRounded",s.value=Ae.value,c.value=q.includes(","));return}i.value="number",c.value=q.includes(","),r.value=Ge(q)}function Ge(q){const Ce=q.match(/\.([0#?]+)/);return Ce?Ce[1].length:0}function ct(){i.value!=="custom"&&(E.value=de())}function nt(){}function I(){y.value=Te.value[0],h.value=pe[0],R.value=Ee.value[0],f.value=Le[0]}function H(){a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),I(),_e(n.currentFormat??""),n.isCustom&&(i.value="custom"),t.nextTick(()=>{var q;return(q=k.value)==null?void 0:q.focus()})}function $(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function V(){o("apply",E.value),$()}function B(){$()}function W(q){q.key==="Escape"&&$()}t.watch(()=>n.modelOpen,q=>{q&&!a.value?H():!q&&a.value&&$()});const z=t.computed(()=>_n(n.sampleValue,E.value,n.locale));return(q,Ce)=>(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:B,onKeydown:W},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:Ce[9]||(Ce[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",zu,[t.createElementVNode("span",_u,t.toDisplayString(t.unref(g)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:$},[...Ce[10]||(Ce[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",Hu,[t.createElementVNode("div",Wu,[t.createElementVNode("label",Uu,t.toDisplayString(t.unref(g)(e.locale,"nfCategory")),1),t.createVNode(Pt,{class:"nf-field__dropdown","model-value":i.value,options:ie.value,"onUpdate:modelValue":Ce[0]||(Ce[0]=We=>i.value=We),onChange:ct},null,8,["model-value","options"])]),se.value?(t.openBlock(),t.createElementBlock("div",Pu,[t.createElementVNode("label",Ku,t.toDisplayString(t.unref(g)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Ce[1]||(Ce[1]=We=>r.value=We),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:ct},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("div",Gu,[t.createElementVNode("label",qu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Ce[2]||(Ce[2]=We=>c.value=We),type:"checkbox",onChange:ct},null,544),[[t.vModelCheckbox,c.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),$e.value?(t.openBlock(),t.createElementBlock("div",Yu,[t.createElementVNode("label",ju,t.toDisplayString(t.unref(g)(e.locale,"nfSymbol")),1),t.createVNode(Pt,{class:"nf-field__dropdown","model-value":s.value,options:t.unref(tt),"onUpdate:modelValue":Ce[3]||(Ce[3]=We=>s.value=We),onChange:ct},null,8,["model-value","options"])])):t.createCommentVNode("",!0),lt.value?(t.openBlock(),t.createElementBlock("div",Xu,[t.createElementVNode("label",Zu,t.toDisplayString(t.unref(g)(e.locale,"nfDateFormat")),1),t.createVNode(Pt,{class:"nf-field__dropdown","model-value":y.value,options:st.value,"onUpdate:modelValue":Ce[4]||(Ce[4]=We=>y.value=We),onChange:ct},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ne.value?(t.openBlock(),t.createElementBlock("div",Ju,[t.createElementVNode("label",Qu,t.toDisplayString(t.unref(g)(e.locale,"nfTimeFormat")),1),t.createVNode(Pt,{class:"nf-field__dropdown","model-value":h.value,options:t.unref(Z),"onUpdate:modelValue":Ce[5]||(Ce[5]=We=>h.value=We),onChange:ct},null,8,["model-value","options"])])):t.createCommentVNode("",!0),xe.value?(t.openBlock(),t.createElementBlock("div",ef,[t.createElementVNode("label",tf,t.toDisplayString(t.unref(g)(e.locale,"nfDateTime")),1),t.createVNode(Pt,{class:"nf-field__dropdown","model-value":R.value,options:O.value,"onUpdate:modelValue":Ce[6]||(Ce[6]=We=>R.value=We),onChange:ct},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Ne.value?(t.openBlock(),t.createElementBlock("div",nf,[t.createElementVNode("label",of,t.toDisplayString(t.unref(g)(e.locale,"nfDuration")),1),t.createVNode(Pt,{class:"nf-field__dropdown","model-value":f.value,options:t.unref(L),"onUpdate:modelValue":Ce[7]||(Ce[7]=We=>f.value=We),onChange:ct},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",lf,[t.createElementVNode("label",rf,t.toDisplayString(t.unref(g)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:k,"onUpdate:modelValue":Ce[8]||(Ce[8]=We=>E.value=We),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:nt},null,544),[[t.vModelText,E.value]])])]),t.createElementVNode("div",af,[t.createElementVNode("div",sf,[t.createElementVNode("span",cf,t.toDisplayString(t.unref(g)(e.locale,"nfPreview")),1),t.createElementVNode("span",df,t.toDisplayString(z.value||"-"),1)]),t.createElementVNode("div",uf,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:V},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:$},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-4997ac2c"]]),mf={class:"sort-confirm__header"},pf={class:"sort-confirm__title"},hf={class:"sort-confirm__body"},gf={class:"sort-confirm__message"},bf={class:"sort-confirm__options"},yf={class:"sort-confirm__option"},Cf={class:"sort-confirm__option"},wf={class:"sort-confirm__footer"},vf=Lt(t.defineComponent({__name:"sort-confirm-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>n.modelOpen,E=>{E&&!a.value?c():!E&&a.value&&s()});function c(){i.value=!0,a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{var k;const E=(k=r.value)==null?void 0:k.querySelector(".sort-confirm__btn--primary");E==null||E.focus()})}function s(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function y(){f()}function h(E){E.key==="Escape"&&f()}function R(){o("confirm",i.value),s()}function f(){o("cancel"),s()}return(E,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",mf,[t.createElementVNode("span",pf,t.toDisplayString(t.unref(g)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:f},[...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",hf,[t.createElementVNode("p",gf,t.toDisplayString(t.unref(g)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",bf,[t.createElementVNode("label",yf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[0]||(k[0]=N=>i.value=N),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Cf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=N=>i.value=N),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",wf,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:R},t.toDisplayString(t.unref(g)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:f},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-c73bc474"]]),ka=[{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)"}],kf={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 Ef(e){let l=0,n=null;for(let o=0;o<e.length;o++){const a=e[o];if(n){a===n&&(e[o+1]===n?o++:n=null);continue}if(a==='"'||a==="'"){n=a;continue}if(a==="(")l++;else if(a===")"&&(l--,l<0))return!1}return l===0}function Rf(e){const l=e.trim();if(!l.startsWith("="))return{ok:!1,name:null};const n=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(l.slice(1).trim());if(!n)return{ok:!1,name:null};const o=n[1].toUpperCase(),a=kf[o];if(!a)return{ok:!1,name:o};const i=n[2];if(!Ef(i))return{ok:!1,name:o};const r=ho(i),c=r.length===1&&r[0].trim()===""?0:r.length;return c<a.min||c>a.max?{ok:!1,name:o}:r.some(s=>s.trim()==="")?{ok:!1,name:o}:{ok:!0,name:o}}function Go(e,l,n){const o=e.split(":");if(o.length!==2)return null;const a=Sn(o[0],l,n),i=Sn(o[1],l,n);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 Ea(e){const l=e.trim();if(l==="")return"";const n=Number(l);return!isNaN(n)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(l)?n:e}function to(e,l,n,o,a){const i=n[Po(e,l)];if(!i)return"";const r=i.value;return r.startsWith("=")?Sa(Po(e,l),n,o,a):Ea(r)}function Ra(e,l,n,o,a){const i=to(e,l,n,o,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const ll=new Map,xl=new Set;function So(){ll.clear(),xl.clear()}function Sa(e,l,n,o){return Sf(e,l,n,o,0)}function Sf(e,l,n,o,a){if(xl.has(e))return null;if(ll.has(e))return ll.get(e);xl.add(e);const i=l[e];let r;if(!i)r=null;else{const c=i.value;if(!c.startsWith("="))r=Ea(c);else{const s=c.slice(1).trim(),y=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(s);r=y?xa(y[1].toUpperCase(),y[2],l,n,o,a+1):Yt(s,l,n,o,a+1)}}return xl.delete(e),ll.set(e,r),r}function qo(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Ma(e,l){return typeof e=="number"&&typeof l=="number"?e===l:String(e??"")===String(l??"")}function ur(e,l,n){let o;if(typeof e=="number"&&typeof l=="number")o=e<l?-1:e>l?1:0;else{const a=String(e??""),i=String(l??"");o=a<i?-1:a>i?1:0}switch(n){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 Na(e,l,n,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 Mf(e,l,n,o,a,i){let c=l.trim();c.length>=2&&(c[0]==='"'&&c[c.length-1]==='"'||c[0]==="'"&&c[c.length-1]==="'")&&(c=c.slice(1,-1));const s=/^([<>=]+)([\s\S]*)$/.exec(c);if(s){const h=s[1],R=Na(s[2]);return ur(e,R,h)}const y=Na(c);return Ma(e,y)}function Ba(e,l,n,o,a){const i=e.trim(),r=["<=",">=","<>"];let c=null,s=-1,y=null,h=0;for(let f=0;f<i.length;f++){const E=i[f];if(y){E===y&&(i[f+1]===y?f++:y=null);continue}if(E==='"'||E==="'"){y=E;continue}if(E==="("&&h++,E===")"&&h--,h===0&&(E==="<"||E===">"||E==="=")){const k=i.slice(f,f+2);c=r.includes(k)?k:E,s=f;break}}if(c&&s>=0){const f=i.slice(0,s).trim(),E=i.slice(s+c.length).trim(),k=Yt(f,l,n,o,a),N=Yt(E,l,n,o,a);return ur(k,N,c)}const R=Yt(i,l,n,o,a);return qo(R)}function ho(e){const l=[];let n=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==="("&&n++,r===")"&&n--,r===","&&n===0){l.push(a),a="";continue}a+=r}return l.push(a),l}function Yt(e,l,n,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=Nf(i);if(c.length===0)return null;let s=0;const y=()=>{const k=h(),N=c[s];if(!(N&&N.type==="cmp"))return k;s++;const Y=h();return k===null||Y===null?null:ur(k,Y,N.val)?1:0},h=()=>{let k=R();for(;s<c.length;){const N=c[s];if(N.type==="op"&&(N.val==="+"||N.val==="-"))s++,k=fr(k,R(),N.val);else break}return k},R=()=>{let k=f();for(;s<c.length;){const N=c[s];if(N.type==="op"&&(N.val==="*"||N.val==="/"))s++,k=fr(k,f(),N.val);else break}return k},f=()=>{const k=c[s];return k&&k.type==="op"&&k.val==="-"?(s++,fr(0,f(),"-")):k&&k.type==="op"&&k.val==="+"?(s++,f()):E()},E=()=>{const k=c[s];if(!k)return null;if(k.type==="num")return s++,Number(k.val);if(k.type==="str")return s++,k.val;if(k.type==="lp"){s++;const N=y();return c[s]&&c[s].type==="rp"&&s++,N}if(k.type==="ref"){s++;const N=Sn(k.val,n,o);return N?to(N.col,N.row,l,n,o):null}if(k.type==="func"){const N=k.val.toUpperCase();if(s++,c[s]&&c[s].type==="lp"){const Y=c[s];let te=0,me=null,he=s;for(;he<c.length;he++)if(c[he].type==="lp")te++;else if(c[he].type==="rp"&&(te--,te===0)){me=c[he];break}if(me){const Te=i.slice(Y.start+1,me.start);return s=he+1,xa(N,Te,l,n,o,a+1)}}return null}return s++,null};return y()}function Nf(e){const l=[];let n=0;for(;n<e.length;){const o=e[n];if(/\s/.test(o)){n++;continue}if(o==='"'||o==="'"){const a=o,i=n;n++;let r="";for(;n<e.length;){if(e[n]===a){if(e[n+1]===a){r+=a,n+=2;continue}n++;break}r+=e[n],n++}l.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(o)||o==="."){const a=n;let i="";for(o==="."&&(i+=".",n++);n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;if(e[n]===".")for(i+=".",n++;n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;if(e[n]==="e"||e[n]==="E")for(i+=e[n],n++,(e[n]==="+"||e[n]==="-")&&(i+=e[n],n++);n<e.length&&/[0-9]/.test(e[n]);)i+=e[n],n++;l.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(o)){const a=n;let i="";for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)i+=e[n],n++;e[n]==="("&&!i.includes("$")?l.push({type:"func",val:i,start:a}):l.push({type:"ref",val:i,start:a});continue}if(o==="("){l.push({type:"lp",val:o,start:n}),n++;continue}if(o===")"){l.push({type:"rp",val:o,start:n}),n++;continue}if(o===","){l.push({type:"comma",val:o,start:n}),n++;continue}if(o==="+"||o==="-"||o==="*"||o==="/"){l.push({type:"op",val:o,start:n}),n++;continue}if(o==="<"||o===">"||o==="="){const a=e.slice(n,n+2);a==="<="||a===">="||a==="<>"?(l.push({type:"cmp",val:a,start:n}),n+=2):(l.push({type:"cmp",val:o,start:n}),n++);continue}n++}return l}function fr(e,l,n){if(typeof e!="number"||typeof l!="number")return null;switch(n){case"+":return e+l;case"-":return e-l;case"*":return e*l;case"/":return l===0?null:e/l}return null}function xa(e,l,n,o,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Go(l.trim(),o,a);if(!r)return null;if(e==="COUNT"){let s=0;for(let y=r.sc;y<=r.ec;y++)for(let h=r.sr;h<=r.er;h++)typeof to(y,h,n,o,a)=="number"&&s++;return s}let c=0;for(let s=r.sc;s<=r.ec;s++)for(let y=r.sr;y<=r.er;y++)c+=Ra(s,y,n,o,a);if(isNaN(c))return null;if(e==="AVERAGE"){const s=(r.ec-r.sc+1)*(r.er-r.sr+1);return s===0?null:c/s}return c}case"AND":case"OR":{const r=ho(l);if(r.length===0)return null;const c=e==="AND";for(const s of r){const y=Yt(s,n,o,a,i);if(y===null)return null;if(e==="AND"){if(!qo(y))return 0}else if(qo(y))return 1}return c?1:0}case"NOT":{const r=ho(l);if(r.length!==1)return null;const c=Yt(r[0],n,o,a,i);return c===null?null:qo(c)?0:1}case"IF":{const r=ho(l);if(r.length<3)return null;const c=Ba(r[0],n,o,a,i);return Yt(c?r[1]:r[2],n,o,a,i)}case"VLOOKUP":{const r=ho(l);if(r.length<3)return null;const c=Yt(r[0],n,o,a,i),s=Go(r[1].trim(),o,a);if(!s)return null;const y=Yt(r[2],n,o,a,i),h=typeof y=="number"?y:parseFloat(String(y));if(isNaN(h))return null;const R=s.sc+(h-1);if(R<s.sc||R>s.ec)return null;if(r.length>=4?qo(Yt(r[3],n,o,a,i)):!1){let E=-1,k=-1/0;for(let N=s.sr;N<=s.er;N++){const Y=to(s.sc,N,n,o,a);typeof Y=="number"&&typeof c=="number"&&Y<=c&&Y>k&&(k=Y,E=N)}return E>=0?to(R,E,n,o,a):null}for(let E=s.sr;E<=s.er;E++){const k=to(s.sc,E,n,o,a);if(Ma(k,c))return to(R,E,n,o,a)}return null}case"CONCATENATE":{const r=ho(l);let c="";for(const s of r){const y=Yt(s,n,o,a,i);c+=y===null?"":typeof y=="number"?String(y):y}return c}case"MAX":case"MIN":{const r=Go(l.trim(),o,a);if(!r)return null;const c=[];for(let s=r.sc;s<=r.ec;s++)for(let y=r.sr;y<=r.er;y++){const h=to(s,y,n,o,a);typeof h=="number"&&c.push(h)}return c.length===0?null:e==="MAX"?Math.max(...c):Math.min(...c)}case"STDEV":{const r=Go(l.trim(),o,a);if(!r)return null;const c=[];for(let R=r.sc;R<=r.ec;R++)for(let f=r.sr;f<=r.er;f++){const E=to(R,f,n,o,a);typeof E=="number"&&c.push(E)}const s=c.length;if(s<2)return null;const y=c.reduce((R,f)=>R+f,0)/s,h=c.reduce((R,f)=>R+Math.pow(f-y,2),0)/(s-1);return Math.sqrt(h)}case"SIN":{const r=ho(l);if(r.length!==1)return null;const c=Yt(r[0],n,o,a,i);return typeof c!="number"?null:Math.sin(c)}case"SUMIF":{const r=ho(l);if(r.length<2||r.length>3)return null;const c=Go(r[0].trim(),o,a);if(!c)return null;const s=r.length===3?Go(r[2].trim(),o,a):c;if(!s)return null;let y=0;for(let h=c.sr;h<=c.er;h++)for(let R=c.sc;R<=c.ec;R++){const f=to(R,h,n,o,a);Mf(f,r[1])&&(y+=Ra(s.sc+(R-c.sc),s.sr+(h-c.sr),n,o,a))}return y}case"PMT":{const r=ho(l);if(r.length<3||r.length>5)return null;const c=Yt(r[0],n,o,a,i),s=Yt(r[1],n,o,a,i),y=Yt(r[2],n,o,a,i);if(typeof c!="number"||typeof s!="number"||typeof y!="number")return null;const h=r.length>=4?Yt(r[3],n,o,a,i):0,R=typeof h=="number"?h:0,f=r.length>=5?Yt(r[4],n,o,a,i):0,E=qo(f)?1:0;if(c===0)return s===0?null:-(y+R)/s;const k=Math.pow(1+c,s);return-(R+y*k)*c/((1+c*E)*(k-1))}default:return null}}function Tl(e,l,n){const o=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=Sn(i[1],l,n);if(r)if(i[2]){const c=Sn(i[2],l,n);if(!c)continue;for(let s=Math.min(r.col,c.col);s<=Math.max(r.col,c.col);s++)for(let y=Math.min(r.row,c.row);y<=Math.max(r.row,c.row);y++)o.push(Po(s,y))}else o.push(Po(r.col,r.row))}return o}function Ta(e,l,n,o,a){const i=n[Po(e,l)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const c=Sa(Po(e,l),n,o,a);return c===null?"#ERROR":String(c)}function Va(e,l,n,o){return Yt(e,l,n,o,0)}function Da(e,l,n,o){const a=e.trim().replace(/^=/,"");return a?Ba(a,l,n,o,0):!1}function Vl(e,l,n,o,a,i){return l===0&&n===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,c,s,y,h)=>{const R=c?tr(s):tr(s)+l,f=y?parseInt(h,10)-1:parseInt(h,10)-1+n;let E;R<0?E="A":R>=o?E=i(o-1):E=i(R);let k;return f<0?k="1":f>=a?k=String(a):k=String(f+1),(c||"")+E+(y||"")+k})}class Bf{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(l){var o;const n=this.deps.get(l);if(n){for(const a of n)(o=this.rev.get(a))==null||o.delete(l);this.deps.delete(l)}}set(l,n){if(this.clear(l),n.length!==0){this.deps.set(l,n);for(const o of n)this.rev.has(o)||this.rev.set(o,new Set),this.rev.get(o).add(l)}}markDirty(l){const n=[l];for(;n.length>0;){const o=n.pop(),a=this.rev.get(o);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),n.push(i))}}getDirtyAndClear(){const l=this.dirty;return this.dirty=new Set,l}rebuild(l,n,o){this.deps.clear(),this.rev.clear(),this.dirty.clear(),ll.clear();for(const[a,i]of Object.entries(l))if(i.value.startsWith("=")){const r=Tl(i.value.slice(1),n,o);this.set(a,r)}}}const xf={class:"ifn-dialog__header"},Tf={class:"ifn-dialog__title"},Vf={class:"ifn-dialog__body"},Df={class:"ifn-dialog__field"},Ff={class:"ifn-dialog__label"},Of={key:0,class:"ifn-dialog__desc"},If={class:"ifn-dialog__field"},Af={class:"ifn-dialog__label"},Lf={class:"ifn-dialog__footer"},$f=["disabled"],zf=Lt(t.defineComponent({__name:"insert-function-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref(null),s=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(()=>ka.map(pe=>({label:pe.name,value:pe.name}))),R=t.computed(()=>{const pe=String(i.value??"");return pe?g(n.locale,y[pe]??""):""}),f=t.computed(()=>Rf(r.value)),E=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!f.value.ok?!1:f.value.name===String(i.value).toUpperCase());t.watch(()=>n.modelOpen,pe=>{pe&&!a.value?k():!pe&&a.value&&N()});function k(){r.value="",i.value="",a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{const pe=c.value;if(pe)try{pe.focus({preventScroll:!0}),pe.setSelectionRange(pe.value.length,pe.value.length)}catch{}})}function N(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function Y(pe){i.value=pe;const Ee=ka.find(Le=>Le.name===String(pe));Ee&&(r.value="",te(Ee.snippet))}function te(pe){const Ee=r.value,Le=c.value,ue=Le?Le.selectionStart??Ee.length:Ee.length,ie=Le?Le.selectionEnd??Ee.length:Ee.length,tt=Ee.trim()?pe:"="+pe;r.value=Ee.slice(0,ue)+tt+Ee.slice(ie),t.nextTick(()=>{const st=c.value;if(!st)return;const Z=ue+tt.length;try{st.focus({preventScroll:!0}),st.setSelectionRange(Z,Z)}catch{}})}function me(){o("insert",r.value),N()}function he(){o("cancel"),N()}function Te(pe){pe.key==="Escape"&&(pe.stopPropagation(),he())}return(pe,Ee)=>(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(he,["self"]),onKeydown:Te},[t.createElementVNode("div",{ref_key:"dialogRef",ref:s,class:"ifn-dialog",onMousedown:Ee[1]||(Ee[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",xf,[t.createElementVNode("span",Tf,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:he},[...Ee[2]||(Ee[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",Vf,[t.createElementVNode("div",Df,[t.createElementVNode("label",Ff,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Pt,{class:"ifn-dialog__dropdown",locale:e.locale,"model-value":i.value,options:h.value,searchable:!0,"search-placeholder":t.unref(g)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(g)(e.locale,"insertFunctionPlaceholder"),title:t.unref(g)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":Y},null,8,["locale","model-value","options","search-placeholder","fallback-label","title"]),R.value?(t.openBlock(),t.createElementBlock("div",Of,t.toDisplayString(R.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",If,[t.createElementVNode("label",Af,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":Ee[0]||(Ee[0]=Le=>r.value=Le),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",Lf,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!E.value,onClick:me},t.toDisplayString(t.unref(g)(e.locale,"insertFunctionBtn")),9,$f),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:he},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-49675eeb"]]),rl="__filter_blank__";function mr(e,l,n,o){if(Hn(e))return Number(e);if(o==="date"){const a=eo(e,n);if(a)return a.serial}return null}function Dl(e,l,n){if(e==null)return null;if(Hn(e))return Number(e);if(l==="date"){const o=eo(e,n);if(o)return o.serial}return null}function _f(e,l,n,o,a){const i=_n(l,n,o);switch(e.operator){case"blank":return l.trim()==="";case"notBlank":return l.trim()!=="";case"equals":case"notEquals":{const r=e.operator==="equals";if(a==="number"||a==="date"){const s=mr(l,n,o,a),y=Dl(e.value,a,o);return s==null||y==null?!1:r?s===y:s!==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=mr(l,n,o,a),c=Dl(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=mr(l,n,o,a),c=Dl(e.value,a,o),s=Dl(e.value2,a,o);if(r==null||c==null||s==null)return!1;const y=Math.min(c,s),h=Math.max(c,s);return r>=y&&r<=h}}return!0}function Fa(e,l,n,o){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(l.trim()==="")return a.includes(rl);const i=_n(l,n,o);return a.includes(l)||a.includes(i)}return e.condition?_f(e.condition,l,n,o,e.type):!0}function Hf(e,l,n,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 s=a[r],y=n.getValue(c,l),h=n.getFormat(c,l);if(!Fa(s,y,h,o))return!1}return!0}function Wf(e,l,n,o){const a=new Set,i=[];let r=!1;const{range:c,columns:s}=e;for(let h=c.startRow+1;h<=c.endRow;h++){let R=!0;for(const k in s){const N=Number(k);if(N===l)continue;const Y=s[k];if(!Fa(Y,n.getValue(N,h),n.getFormat(N,h),o)){R=!1;break}}if(!R)continue;const f=n.getValue(l,h),E=_n(f,n.getFormat(l,h),o);if(f.trim()===""){r=!0;continue}a.has(E)||(a.add(E),i.push(E))}return i.length>0&&i.every(h=>Hn(h))?i.sort((h,R)=>Number(h)-Number(R)):i.sort((h,R)=>h.localeCompare(R,o,{numeric:!0})),{values:i,hasBlank:r}}function Oa(e){var l;return e?e.type==="values"?(((l=e.values)==null?void 0:l.length)??0)>0:!!e.condition:!1}const Uf={class:"filter-popup__head"},Pf={class:"filter-popup__head-label"},Kf={key:0,class:"filter-popup__head-badge"},Gf={class:"filter-popup__search"},qf=["placeholder"],Yf={class:"filter-popup__tools"},jf={class:"filter-popup__count"},Xf=["checked","onChange"],Zf={class:"filter-popup__item-label"},Jf={key:0,class:"filter-popup__item-note"},Qf={key:0,class:"filter-popup__empty"},em={class:"filter-popup__modes"},tm={key:1,class:"filter-popup__cond"},nm={class:"filter-popup__cond-nav"},om={class:"filter-popup__cond-mode"},lm={class:"filter-popup__cond-title"},rm={key:0,class:"filter-popup__cond-row filter-popup__cond-row--between"},am={class:"filter-popup__cond-and"},im={key:1,class:"filter-popup__cond-row"},sm=["placeholder"],cm={key:2,class:"filter-popup__cond-hint"},dm={class:"filter-popup__footer"},pr=248,Fl=28,um=252,fm=Lt(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{},boundaryEl:{}},setup(e){const l=e,n=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(""),s=t.ref(new Set),y=t.ref(!1),h=t.ref(0),R=t.ref(null),f=t.ref("equals"),E=t.ref(""),k=t.ref(""),N=t.computed(()=>l.getColumnCandidates(l.col)),Y=t.computed(()=>c.value.trim()!==""),te=t.computed(()=>{const W=c.value.trim().toLowerCase();return W?N.value.values.filter(z=>z.toLowerCase().includes(W)):N.value.values}),me=t.computed(()=>{const W=te.value.map(z=>({key:z,label:z,isBlank:!1}));return N.value.hasBlank&&!Y.value&&W.push({key:rl,label:g(l.locale,"filterBlank"),isBlank:!0}),W}),he=Math.ceil(um/Fl),Te=t.computed(()=>Math.max(0,Math.floor(h.value/Fl)-2)),pe=t.computed(()=>Math.min(me.value.length,Te.value+he+4)),Ee=t.computed(()=>me.value.slice(Te.value,pe.value)),Le=t.computed(()=>Te.value*Fl),ue=t.computed(()=>Math.max(0,(me.value.length-pe.value)*Fl));function ie(W){h.value=W.target.scrollTop}const tt=["equals","notEquals","contains","notContains","startsWith","endsWith"],st=["equals","notEquals","gt","gte","lt","lte","between"],Z={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"},O=t.computed(()=>r.value==="text"?tt:st),L=t.computed(()=>O.value.map(W=>({value:W,label:g(l.locale,Z[W])})));function oe(W){f.value=W}const $e={text:"filterText",number:"filterNumber",date:"filterDate"},lt=t.computed(()=>{const W=r.value,z=$e[W]??$e.text;return g(l.locale,z)}),ne=t.computed(()=>{var q;const W=l.getFilter(),z=W==null?void 0:W.columns[l.col];return z?z.type==="values"?(((q=z.values)==null?void 0:q.length)??0)>0:!!z.condition:!1});function xe(){const W=l.getFilter(),z=W==null?void 0:W.columns[l.col];z&&z.type==="values"?(s.value=new Set((z.values??[]).filter(q=>q!==rl)),y.value=(z.values??[]).includes(rl)):z&&z.condition?(r.value=z.type,f.value=z.condition.operator,E.value=z.condition.value??"",k.value=z.condition.value2??""):(s.value=new Set(N.value.values),y.value=N.value.hasBlank)}function Ne(){if(!l.getFilter())return;const z=N.value.values,q=N.value.hasBlank;if(s.value.size===z.length&&z.every(We=>s.value.has(We))&&y.value===q)l.setFilterColumn(l.col,null);else{const We=[...s.value];y.value&&We.push(rl),l.setFilterColumn(l.col,{type:"values",values:We})}}function se(W){const z=new Set(s.value);z.has(W)?z.delete(W):z.add(W),s.value=z}function de(){y.value=!y.value}function Be(){const W=Y.value?te.value:N.value.values,z=new Set(s.value);W.forEach(q=>z.add(q)),s.value=z,y.value=!0}function _e(){s.value=new Set,y.value=!1}function Ge(W){r.value=W,f.value=W==="text"?"contains":"equals",E.value="",k.value=""}function ct(){r.value="values",xe()}function nt(){const W={operator:f.value,value:E.value};r.value!=="text"&&f.value==="between"&&(W.value2=k.value),E.value.trim()!==""&&(l.setFilterColumn(l.col,{type:r.value,condition:W}),l.close())}function I(){s.value=new Set(N.value.values),y.value=N.value.hasBlank}function H(){Ne(),l.close()}function $(){R.value&&l.setFilter(R.value),l.close()}function V(W){const z=n.value;z&&W.target instanceof Node&&z.contains(W.target)||l.close()}function B(W){W.key==="Escape"&&$()}return t.onMounted(async()=>{var We,gt;R.value=l.getFilter()?JSON.parse(JSON.stringify(l.getFilter())):null,xe(),await t.nextTick();const W=((We=n.value)==null?void 0:We.offsetHeight)??400;let z=l.anchor.x+15-pr,q=l.anchor.y+24;const Ce=Fn(l.boundaryEl);z<Ce.left+4&&(z=Math.max(Ce.left+4,l.anchor.x)),z+pr>Ce.right-4&&(z=Math.max(Ce.left+4,Ce.right-pr-4)),q+W>Ce.bottom-4&&(q=Math.max(Ce.top+4,l.anchor.y-W-4)),i.value={left:z,top:q},(gt=a.value)==null||gt.focus(),document.addEventListener("pointerdown",V,!0),document.addEventListener("keydown",B,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",V,!0),document.removeEventListener("keydown",B,!0)}),(W,z)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:n,class:"filter-popup",style:t.normalizeStyle({left:i.value.left+"px",top:i.value.top+"px"}),onPointerdown:z[8]||(z[8]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Uf,[t.createElementVNode("span",Pf,t.toDisplayString(e.headerLabel||t.unref(yt)(e.col)),1),ne.value?(t.openBlock(),t.createElementBlock("span",Kf,t.toDisplayString(t.unref(g)(e.locale,"filterActive")),1)):t.createCommentVNode("",!0)]),r.value==="values"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Gf,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":z[0]||(z[0]=q=>c.value=q),class:"filter-popup__search-input",type:"text",placeholder:t.unref(g)(e.locale,"filterSearchPlaceholder")},null,8,qf),[[t.vModelText,c.value]])]),t.createElementVNode("div",Yf,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:Be},t.toDisplayString(t.unref(g)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:_e},t.toDisplayString(t.unref(g)(e.locale,"filterClearAll")),1),t.createElementVNode("span",jf,t.toDisplayString(t.unref(g)(e.locale,"filterFilteredCount").replace("{n}",String(N.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:o,class:"filter-popup__list",onScroll:ie},[t.createElementVNode("div",{style:t.normalizeStyle({height:Le.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ee.value,q=>(t.openBlock(),t.createElementBlock("label",{key:q.key,class:"filter-popup__item"},[t.createElementVNode("input",{class:"filter-popup__item-input",type:"checkbox",checked:q.isBlank?y.value:s.value.has(q.key),onChange:Ce=>q.isBlank?de():se(q.key)},null,40,Xf),z[9]||(z[9]=t.createElementVNode("span",{class:"filter-popup__item-box"},[t.createElementVNode("svg",{class:"filter-popup__item-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createElementVNode("span",Zf,t.toDisplayString(q.label),1),q.isBlank?(t.openBlock(),t.createElementBlock("span",Jf,"("+t.toDisplayString(t.unref(g)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ue.value+"px"})},null,4),me.value.length===0?(t.openBlock(),t.createElementBlock("div",Qf,t.toDisplayString(t.unref(g)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",em,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:z[1]||(z[1]=q=>Ge("text"))},t.toDisplayString(t.unref(g)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:z[2]||(z[2]=q=>Ge("number"))},t.toDisplayString(t.unref(g)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:z[3]||(z[3]=q=>Ge("date"))},t.toDisplayString(t.unref(g)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",tm,[t.createElementVNode("div",nm,[t.createElementVNode("button",{type:"button",class:"filter-popup__back",onClick:ct},[z[10]||(z[10]=t.createElementVNode("svg",{class:"filter-popup__back-icon",viewBox:"0 0 16 16","aria-hidden":"true"},[t.createElementVNode("path",{d:"M10 3l-5 5 5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"filterBack")),1)]),t.createElementVNode("span",om,t.toDisplayString(lt.value),1)]),t.createElementVNode("div",lm,t.toDisplayString(t.unref(g)(e.locale,"filterCustom")),1),t.createVNode(Pt,{class:"filter-popup__cond-op","model-value":f.value,options:L.value,title:t.unref(g)(e.locale,"filterCustom"),onChange:oe},null,8,["model-value","options","title"]),f.value==="between"?(t.openBlock(),t.createElementBlock("div",rm,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":z[4]||(z[4]=q=>E.value=q),class:"filter-popup__cond-input",type:"text",onKeydown:t.withKeys(nt,["enter"])},null,544),[[t.vModelText,E.value]]),t.createElementVNode("span",am,t.toDisplayString(t.unref(g)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":z[5]||(z[5]=q=>k.value=q),class:"filter-popup__cond-input",type:"text",onKeydown:t.withKeys(nt,["enter"])},null,544),[[t.vModelText,k.value]])])):(t.openBlock(),t.createElementBlock("div",im,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":z[6]||(z[6]=q=>E.value=q),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"YYYY-MM-DD":"",onKeydown:t.withKeys(nt,["enter"])},null,40,sm),[[t.vModelText,E.value]])])),r.value==="date"?(t.openBlock(),t.createElementBlock("p",cm,t.toDisplayString(t.unref(g)(e.locale,"filterDateHint")),1)):t.createCommentVNode("",!0)])),t.createElementVNode("div",dm,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:I},t.toDisplayString(t.unref(g)(e.locale,"clearFilter")),1),z[11]||(z[11]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:$},t.toDisplayString(t.unref(g)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:z[7]||(z[7]=q=>r.value==="values"?H():nt())},t.toDisplayString(t.unref(g)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-4bb3ed82"]]),mm={class:"cf-manager__header"},pm={class:"cf-manager__title"},hm={key:0,class:"cf-manager__empty"},gm={key:1,class:"cf-manager__list"},bm={class:"cf-rule__main"},ym={class:"cf-rule__info"},Cm={class:"cf-rule__summary"},wm={class:"cf-rule__range"},vm={class:"cf-rule__actions"},km={class:"cf-chk"},Em=["checked","onChange"],Rm=["title","onClick"],Sm=["title","onClick"],Mm=["title","onClick"],Nm=["title","onClick"],Bm=Lt(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:l}){const n=e,o=l,a=t.computed(()=>[...n.rules].sort((s,y)=>s.priority-y.priority));function i(s){return s.ranges.map(y=>{const h=yt(y.startCol)+(y.startRow+1);return y.startCol===y.endCol&&y.startRow===y.endRow?h:h+":"+yt(y.endCol)+(y.endRow+1)}).join(", ")}function r(s){switch(s.type){case"cellIs":{const y=g(n.locale,"cf"+(s.operator==="greaterThan"?"GreaterThan":s.operator==="lessThan"?"LessThan":s.operator==="greaterThanOrEqual"?"GreaterThanOrEqual":s.operator==="lessThanOrEqual"?"LessThanOrEqual":s.operator==="notEqual"?"NotEqual":s.operator==="between"?"Between":s.operator==="notBetween"?"NotBetween":"Equal"));return s.operator==="between"||s.operator==="notBetween"?`${y} ${s.value} ${g(n.locale,"cfValue2")} ${s.value2??""}`:`${y} ${s.value}`}case"textContains":return`${g(n.locale,"cfTextContains")} "${s.value}"`;case"textNotContains":return`${g(n.locale,"cfTextNotContains")} "${s.value}"`;case"blank":return g(n.locale,"cfBlank");case"notBlank":return g(n.locale,"cfNotBlank");case"duplicate":return g(n.locale,"cfDuplicate");case"unique":return g(n.locale,"cfUnique");case"formula":return"= "+s.formula;default:return g(n.locale,"cfRuleTypeGeneric")}}function c(s){const y={};return s.format.backgroundColor&&(y.background=s.format.backgroundColor),s.format.color&&(y.color=s.format.color),s.format.fontWeight==="bold"&&(y.fontWeight="700"),s.format.fontStyle==="italic"&&(y.fontStyle="italic"),s.format.underline==="underline"&&(y.textDecoration="underline"),s.format.strikethrough==="line-through"&&(y.textDecoration="line-through"),y}return(s,y)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",mm,[t.createElementVNode("span",pm,t.toDisplayString(t.unref(g)(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(g)(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",hm,t.toDisplayString(t.unref(g)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",gm,[(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",bm,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(c(h))},"Aa",4),t.createElementVNode("div",ym,[t.createElementVNode("div",Cm,t.toDisplayString(r(h.condition)),1),t.createElementVNode("div",wm,t.toDisplayString(t.unref(g)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(h)),1)])]),t.createElementVNode("div",vm,[t.createElementVNode("label",km,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:h.enabled,onChange:R=>o("toggle",h.id,R.target.checked)},null,40,Em),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(g)(e.locale,"cfEnabled")),1)]),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfMoveUp"),onClick:R=>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,Rm),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfMoveDown"),onClick:R=>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,Sm),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfEdit"),onClick:R=>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,Mm),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfDelete"),onClick:R=>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,Nm)])],2))),128))]))],4))}}),[["__scopeId","data-v-fccc9961"]]),xm={class:"cf-editor__header"},Tm={class:"cf-editor__title"},Vm={class:"cf-editor__body"},Dm={class:"cf-row"},Fm={class:"cf-label"},Om={class:"cf-row"},Im={class:"cf-label"},Am={class:"cf-row"},Lm={class:"cf-label"},$m={key:0,class:"cf-row"},zm={class:"cf-label"},_m={class:"cf-row"},Hm={class:"cf-label"},Wm=["placeholder"],Um={class:"cf-hint"},Pm={key:2,class:"cf-row"},Km={class:"cf-label"},Gm={class:"cf-row"},qm={class:"cf-label"},Ym={class:"cf-format-row"},jm=["title"],Xm={viewBox:"0 0 1024 1024",fill:"currentColor"},Zm=["fill"],Jm=["title"],Qm={viewBox:"0 0 1024 1024",fill:"currentColor"},e0=["fill"],t0=["title"],n0=["title"],o0=["title"],l0=["title"],r0={class:"cf-row"},a0={class:"cf-label"},i0={key:3,class:"cf-error"},s0={class:"cf-row cf-row--inline"},c0={class:"cf-chk"},d0=["checked"],u0={class:"cf-chk"},f0=["checked"],m0={class:"cf-editor__footer"},p0=Lt(t.defineComponent({__name:"conditional-format-rule-editor",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel"],setup(e,{emit:l}){const n=e,o=l,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(n.rule){const O=n.rule.condition;return{type:O.type==="cellIs"||O.type==="textContains"||O.type==="textNotContains"||O.type==="blank"||O.type==="notBlank"||O.type==="duplicate"||O.type==="unique"||O.type==="formula"?O.type:"cellIs",operator:O.type==="cellIs"?O.operator:"greaterThan",value:O.type==="cellIs"||O.type==="textContains"||O.type==="textNotContains"?O.value:"",value2:O.type==="cellIs"?O.value2??"":"",formula:O.type==="formula"?O.formula:"",backgroundColor:n.rule.format.backgroundColor??"",color:n.rule.format.color??"",fontWeight:n.rule.format.fontWeight==="bold",fontStyle:n.rule.format.fontStyle==="italic",underline:n.rule.format.underline==="underline",strikethrough:n.rule.format.strikethrough==="line-through",rangeText:n.rule.ranges.length?n.rule.ranges.map(oe=>E(oe)).join(", "):n.defaultRangeText,stopIfTrue:n.rule.stopIfTrue,enabled:n.rule.enabled}}return{type:"cellIs",operator:"greaterThan",value:"",value2:"",formula:"",backgroundColor:"#DEEBF7",color:"#17375E",fontWeight:!1,fontStyle:!1,underline:!1,strikethrough:!1,rangeText:n.defaultRangeText,stopIfTrue:!1,enabled:!0}}const c=t.reactive(r()),s=t.ref(!1),y=t.ref(!1),h=t.ref(null),R=t.ref(null),f=t.ref("");function E(O){const L=yt(O.startCol)+(O.startRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?L:L+":"+yt(O.endCol)+(O.endRow+1)}function k(O){const L=O.split(",").map($e=>$e.trim()).filter(Boolean),oe=[];for(const $e of L){if(!$e.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const ne=Sn($e.split(":")[0],99999,99999),xe=$e.split(":")[1],Ne=xe?Sn(xe,99999,99999):ne;if(!ne||!Ne)return null;oe.push({startCol:Math.min(ne.col,Ne.col),endCol:Math.max(ne.col,Ne.col),startRow:Math.min(ne.row,Ne.row),endRow:Math.max(ne.row,Ne.row)})}return oe.length?oe:null}const N=t.computed(()=>c.type==="cellIs"&&(c.operator==="between"||c.operator==="notBetween")),Y=t.computed(()=>c.type==="formula"),te=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(c.type)),me=t.computed(()=>a.map(O=>({value:O.value,label:g(n.locale,O.label)}))),he=t.computed(()=>i.map(O=>({value:O.value,label:g(n.locale,O.label)})));function Te(O){c.type=O}function pe(O){c.operator=String(O)}function Ee(){s.value=!s.value}function Le(){y.value=!y.value}function ue(){return f.value="",k(c.rangeText)?Y.value&&!c.formula.trim()?(f.value=g(n.locale,"cfFormulaRequired"),!1):!0:(f.value=g(n.locale,"cfRangeInvalid"),!1)}function ie(){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 tt(){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 st(){var oe,$e;if(!ue())return;const O=k(c.rangeText),L={id:((oe=n.rule)==null?void 0:oe.id)??"",condition:ie(),format:tt(),ranges:O,priority:(($e=n.rule)==null?void 0:$e.priority)??0,stopIfTrue:c.stopIfTrue,enabled:c.enabled};o("save",L)}function Z(){o("cancel")}return(O,L)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",xm,[t.createElementVNode("span",Tm,t.toDisplayString(e.mode==="edit"?t.unref(g)(e.locale,"cfEdit"):t.unref(g)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-editor__close",onClick:Z}," × ")]),t.createElementVNode("div",Vm,[t.createElementVNode("div",Dm,[t.createElementVNode("label",Fm,t.toDisplayString(t.unref(g)(e.locale,"cfType")),1),t.createVNode(Pt,{class:"cf-dropdown","model-value":c.type,options:me.value,width:"100%","visible-count":8,title:t.unref(g)(e.locale,"cfType"),align:"right",onChange:Te},null,8,["model-value","options","title"])]),c.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Om,[t.createElementVNode("label",Im,t.toDisplayString(t.unref(g)(e.locale,"cfOperator")),1),t.createVNode(Pt,{class:"cf-dropdown","model-value":c.operator,options:he.value,width:"100%","visible-count":9,title:t.unref(g)(e.locale,"cfOperator"),align:"right",onChange:pe},null,8,["model-value","options","title"])]),t.createElementVNode("div",Am,[t.createElementVNode("label",Lm,t.toDisplayString(t.unref(g)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[0]||(L[0]=oe=>c.value=oe),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])]),N.value?(t.openBlock(),t.createElementBlock("div",$m,[t.createElementVNode("label",zm,t.toDisplayString(t.unref(g)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[1]||(L[1]=oe=>c.value2=oe),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value2]])])):t.createCommentVNode("",!0)],64)):Y.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",_m,[t.createElementVNode("label",Hm,t.toDisplayString(t.unref(g)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[2]||(L[2]=oe=>c.formula=oe),class:"cf-input",type:"text",placeholder:t.unref(g)(e.locale,"cfFormulaExample")},null,8,Wm),[[t.vModelText,c.formula]])]),t.createElementVNode("p",Um,t.toDisplayString(t.unref(g)(e.locale,"cfFormula")),1)],64)):te.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Pm,[t.createElementVNode("label",Km,t.toDisplayString(t.unref(g)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[3]||(L[3]=oe=>c.value=oe),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])])),t.createElementVNode("div",Gm,[t.createElementVNode("label",qm,t.toDisplayString(t.unref(g)(e.locale,"cfFormat")),1),t.createElementVNode("div",Ym,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:h,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":s.value}]),title:t.unref(g)(e.locale,"fillColor"),onClick:Ee},[(t.openBlock(),t.createElementBlock("svg",Xm,[L[15]||(L[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,Zm)]))],10,jm),t.createVNode(Nl,{"model-open":s.value,"color-key":"fill","current-color":c.backgroundColor,"trigger-el":h.value,locale:e.locale,"onUpdate:modelOpen":L[4]||(L[4]=oe=>s.value=oe),onChange:L[5]||(L[5]=oe=>c.backgroundColor=oe)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:R,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":y.value}]),title:t.unref(g)(e.locale,"fontColor"),onClick:Le},[(t.openBlock(),t.createElementBlock("svg",Qm,[L[16]||(L[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,e0)]))],10,Jm),t.createVNode(Nl,{"model-open":y.value,"color-key":"text","current-color":c.color,"trigger-el":R.value,locale:e.locale,"onUpdate:modelOpen":L[6]||(L[6]=oe=>y.value=oe),onChange:L[7]||(L[7]=oe=>c.color=oe)},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(g)(e.locale,"bold"),onClick:L[8]||(L[8]=oe=>c.fontWeight=!c.fontWeight)},[...L[17]||(L[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,t0),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.fontStyle}]),title:t.unref(g)(e.locale,"italic"),onClick:L[9]||(L[9]=oe=>c.fontStyle=!c.fontStyle)},[...L[18]||(L[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,n0),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.underline}]),title:t.unref(g)(e.locale,"underline"),onClick:L[10]||(L[10]=oe=>c.underline=!c.underline)},[...L[19]||(L[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,o0),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.strikethrough}]),title:t.unref(g)(e.locale,"strikethrough"),onClick:L[11]||(L[11]=oe=>c.strikethrough=!c.strikethrough)},[...L[20]||(L[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,l0)])]),t.createElementVNode("div",r0,[t.createElementVNode("label",a0,t.toDisplayString(t.unref(g)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[12]||(L[12]=oe=>c.rangeText=oe),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.rangeText]])]),f.value?(t.openBlock(),t.createElementBlock("div",i0,t.toDisplayString(f.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",s0,[t.createElementVNode("label",c0,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.stopIfTrue,onChange:L[13]||(L[13]=oe=>c.stopIfTrue=oe.target.checked)},null,40,d0),L[21]||(L[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(g)(e.locale,"cfStopIfTrue")),1)]),t.createElementVNode("label",u0,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.enabled,onChange:L[14]||(L[14]=oe=>c.enabled=oe.target.checked)},null,40,f0),L[22]||(L[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(g)(e.locale,"cfEnabled")),1)])])]),t.createElementVNode("div",m0,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:st},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:Z},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-8a513402"]]),h0={class:"dv-editor__header"},g0={class:"dv-editor__title"},b0={class:"dv-editor__body"},y0={class:"dv-sec"},C0={class:"dv-sec__title"},w0={class:"dv-row"},v0={class:"dv-label"},k0={class:"dv-row"},E0={class:"dv-label"},R0={class:"dv-hint"},S0={class:"dv-row dv-row--inline"},M0={class:"dv-chk"},N0=["checked"],B0={class:"dv-row"},x0={class:"dv-label"},T0={class:"dv-hint"},V0={class:"dv-row"},D0={class:"dv-label"},F0={key:0,class:"dv-row"},O0={class:"dv-label"},I0={class:"dv-row"},A0={class:"dv-label"},L0={class:"dv-row"},$0={class:"dv-label"},z0={class:"dv-row dv-row--inline"},_0=["checked","disabled"],H0=["checked","disabled"],W0={class:"dv-sec"},U0={class:"dv-sec__title"},P0={class:"dv-row dv-row--inline"},K0={class:"dv-chk"},G0=["checked"],q0={class:"dv-row"},Y0={class:"dv-label"},j0=["disabled"],X0={class:"dv-row dv-row--top"},Z0={class:"dv-label"},J0=["disabled"],Q0={class:"dv-sec"},e1={class:"dv-sec__title"},t1={class:"dv-row dv-row--inline"},n1={class:"dv-chk"},o1=["checked"],l1={class:"dv-row"},r1={class:"dv-label"},a1={class:"dv-row"},i1={class:"dv-label"},s1=["disabled"],c1={class:"dv-row dv-row--top"},d1={class:"dv-label"},u1=["disabled"],f1={class:"dv-sec"},m1={class:"dv-row"},p1={class:"dv-label"},h1={key:0,class:"dv-error"},g1={class:"dv-editor__footer"},Ol="\\$?[A-Za-z]+\\$?\\d+",b1=Lt(t.defineComponent({__name:"data-validation-dialog",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel","clear"],setup(e,{emit:l}){const n=e,o=l,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(O){const L=yt(O.startCol)+(O.startRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?L:L+":"+yt(O.endCol)+(O.endRow+1)}function s(O){const L=O==null?void 0:O.listSource;if((L==null?void 0:L.type)==="range"){const $e=c(L.range);return L.sheetId?`${L.sheetId}!${$e}`:$e}return((L==null?void 0:L.type)==="values"?L.values:(O==null?void 0:O.values)??[]).join(",")}function y(){const O=n.rule;return{type:(O==null?void 0:O.type)??"any",operator:(O==null?void 0:O.operator)??"between",formula1:(O==null?void 0:O.formula1)??"",formula2:(O==null?void 0:O.formula2)??"",source:s(O),allowBlank:(O==null?void 0:O.allowBlank)!==!1,showDropdown:(O==null?void 0:O.showDropdown)!==!1,showInputMessage:(O==null?void 0:O.showInputMessage)===!0,inputTitle:(O==null?void 0:O.inputTitle)??"",inputMessage:(O==null?void 0:O.inputMessage)??"",showErrorMessage:(O==null?void 0:O.showErrorMessage)!==!1,errorStyle:(O==null?void 0:O.errorStyle)??"stop",errorTitle:(O==null?void 0:O.errorTitle)??"",errorMessage:(O==null?void 0:O.errorMessage)??"",rangeText:O&&O.ranges.length?O.ranges.map(c).join(", "):n.defaultRangeText,enabled:(O==null?void 0:O.enabled)!==!1}}const h=t.reactive(y()),R=t.ref(""),f=t.computed(()=>h.type==="list"),E=t.computed(()=>h.type==="custom"),k=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(h.type)),N=t.computed(()=>k.value&&(h.operator==="between"||h.operator==="notBetween")),Y=t.computed(()=>h.type==="any"),te=t.computed(()=>a.map(O=>({value:O.value,label:g(n.locale,O.label)}))),me=t.computed(()=>i.map(O=>({value:O.value,label:g(n.locale,O.label)}))),he=t.computed(()=>r.map(O=>({value:O.value,label:g(n.locale,O.label)})));function Te(O){const L=O.split(",").map($e=>$e.trim()).filter(Boolean),oe=[];for(const $e of L){if(!$e.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const ne=Sn($e.split(":")[0],99999,99999),xe=$e.split(":")[1],Ne=xe?Sn(xe,99999,99999):ne;if(!ne||!Ne)return null;oe.push({startCol:Math.min(ne.col,Ne.col),endCol:Math.max(ne.col,Ne.col),startRow:Math.min(ne.row,Ne.row),endRow:Math.max(ne.row,Ne.row)})}return oe.length?oe:null}function pe(O){const L=O.trim();if(!L)return null;const oe=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${Ol})(?::(${Ol}))?$`).exec(L);if(oe){const ne=(oe[1]??oe[2]??"").trim(),xe=Sn(oe[3],99999,99999),Ne=oe[4]?Sn(oe[4],99999,99999):xe;return!ne||!xe||!Ne?null:{type:"range",sheetId:ne,range:{startCol:Math.min(xe.col,Ne.col),endCol:Math.max(xe.col,Ne.col),startRow:Math.min(xe.row,Ne.row),endRow:Math.max(xe.row,Ne.row)}}}const $e=new RegExp(`^(${Ol})(?::(${Ol}))?$`).exec(L);if($e){const ne=Sn($e[1],99999,99999),xe=$e[2]?Sn($e[2],99999,99999):ne;return!ne||!xe?null:{type:"range",range:{startCol:Math.min(ne.col,xe.col),endCol:Math.max(ne.col,xe.col),startRow:Math.min(ne.row,xe.row),endRow:Math.max(ne.row,xe.row)}}}const lt=L.split(",").map(ne=>ne.trim());return lt.some(ne=>ne!=="")?{type:"values",values:lt}:null}const Ee=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Le(O,L){const oe=L.trim();if(oe==="")return g(n.locale,"dvValueRequired");if(oe.startsWith("="))return null;const $e=n.locale;switch(O){case"wholeNumber":case"textLength":{const lt=Ml(oe,$e);return lt&&Number.isFinite(lt.num)&&Number.isInteger(lt.num)||Ee.test(oe)&&Number.isInteger(Number(oe))?null:g($e,"dvMustBeInteger")}case"decimal":{const lt=Ml(oe,$e);return lt&&Number.isFinite(lt.num)||Ee.test(oe)&&Number.isFinite(Number(oe))?null:g($e,"dvMustBeNumber")}case"date":{const lt=eo(oe,$e);return lt&<.format!=="h:mm:ss"?null:g($e,"dvDateInvalid")}case"time":return eo(oe,$e)?null:g($e,"dvTimeInvalid");default:return null}}function ue(){if(R.value="",!Te(h.rangeText))return R.value=g(n.locale,"dvRangeInvalid"),!1;if(h.type==="any")return!0;if(f.value)return pe(h.source)?!0:(R.value=g(n.locale,"dvSourceInvalid"),!1);if(E.value)return h.formula1.trim()?!0:(R.value=g(n.locale,"dvFormulaRequired"),!1);if(N.value){if(!h.formula1.trim())return R.value=g(n.locale,"dvMinRequired"),!1;if(!h.formula2.trim())return R.value=g(n.locale,"dvMaxRequired"),!1;const L=Le(h.type,h.formula1);if(L)return R.value=`${g(n.locale,"dvMin")}:${L}`,!1;const oe=Le(h.type,h.formula2);return oe?(R.value=`${g(n.locale,"dvMax")}:${oe}`,!1):!0}if(!h.formula1.trim())return R.value=g(n.locale,"dvValueRequired"),!1;const O=Le(h.type,h.formula1);return O?(R.value=`${g(n.locale,"dvValue")}:${O}`,!1):!0}function ie(){var oe,$e;if(!ue())return;const O=Te(h.rangeText);if(h.type==="any"){o("save",{id:((oe=n.rule)==null?void 0:oe.id)??"",type:"any",ranges:O,allowBlank:h.allowBlank,enabled:!0});return}const L={id:(($e=n.rule)==null?void 0:$e.id)??"",type:h.type,ranges:O,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(f.value){const lt=pe(h.source);L.listSource=lt,L.values=lt.type==="values"?lt.values:void 0,L.showDropdown=h.showDropdown}else E.value?L.formula1=h.formula1.trim():(L.operator=h.operator,L.formula1=h.formula1.trim(),L.formula2=N.value?h.formula2.trim():void 0);o("save",L)}function tt(O){h.type=O}function st(O){h.operator=String(O)}function Z(O){h.errorStyle=String(O)}return(O,L)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",h0,[t.createElementVNode("span",g0,t.toDisplayString(t.unref(g)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:L[0]||(L[0]=oe=>o("cancel"))}," × ")]),t.createElementVNode("div",b0,[t.createElementVNode("div",y0,[t.createElementVNode("div",C0,t.toDisplayString(t.unref(g)(e.locale,"dvSettings")),1),t.createElementVNode("div",w0,[t.createElementVNode("label",v0,t.toDisplayString(t.unref(g)(e.locale,"dvAllow")),1),t.createVNode(Pt,{class:"dv-dropdown","model-value":h.type,options:te.value,width:"100%","visible-count":8,title:t.unref(g)(e.locale,"dvAllow"),align:"right",onChange:tt},null,8,["model-value","options","title"])]),f.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",k0,[t.createElementVNode("label",E0,t.toDisplayString(t.unref(g)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[1]||(L[1]=oe=>h.source=oe),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.source]])]),t.createElementVNode("p",R0,t.toDisplayString(t.unref(g)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",S0,[t.createElementVNode("label",M0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showDropdown,onChange:L[2]||(L[2]=oe=>h.showDropdown=oe.target.checked)},null,40,N0),L[18]||(L[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(g)(e.locale,"dvShowDropdown")),1)])])],64)):E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",B0,[t.createElementVNode("label",x0,t.toDisplayString(t.unref(g)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[3]||(L[3]=oe=>h.formula1=oe),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("p",T0,t.toDisplayString(t.unref(g)(e.locale,"cfFormulaExample")),1)],64)):k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",V0,[t.createElementVNode("label",D0,t.toDisplayString(t.unref(g)(e.locale,"dvData")),1),t.createVNode(Pt,{class:"dv-dropdown","model-value":h.operator,options:me.value,width:"100%","visible-count":9,title:t.unref(g)(e.locale,"dvOperator"),align:"right",onChange:st},null,8,["model-value","options","title"])]),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",I0,[t.createElementVNode("label",A0,t.toDisplayString(t.unref(g)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[5]||(L[5]=oe=>h.formula1=oe),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("div",L0,[t.createElementVNode("label",$0,t.toDisplayString(t.unref(g)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[6]||(L[6]=oe=>h.formula2=oe),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",F0,[t.createElementVNode("label",O0,t.toDisplayString(t.unref(g)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[4]||(L[4]=oe=>h.formula1=oe),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",z0,[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:L[7]||(L[7]=oe=>h.allowBlank=oe.target.checked)},null,40,_0),L[19]||(L[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(g)(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:L[8]||(L[8]=oe=>h.enabled=oe.target.checked)},null,40,H0),L[20]||(L[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(g)(e.locale,"cfEnabled")),1)],2)])]),t.createElementVNode("div",W0,[t.createElementVNode("div",U0,t.toDisplayString(t.unref(g)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",P0,[t.createElementVNode("label",K0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showInputMessage,onChange:L[9]||(L[9]=oe=>h.showInputMessage=oe.target.checked)},null,40,G0),L[21]||(L[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(g)(e.locale,"dvShowInputMessage")),1)])]),t.createElementVNode("div",q0,[t.createElementVNode("label",Y0,t.toDisplayString(t.unref(g)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[10]||(L[10]=oe=>h.inputTitle=oe),class:"dv-input",type:"text",disabled:!h.showInputMessage},null,8,j0),[[t.vModelText,h.inputTitle]])]),t.createElementVNode("div",X0,[t.createElementVNode("label",Z0,t.toDisplayString(t.unref(g)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":L[11]||(L[11]=oe=>h.inputMessage=oe),class:"dv-input dv-input--area",rows:"2",disabled:!h.showInputMessage},null,8,J0),[[t.vModelText,h.inputMessage]])])]),t.createElementVNode("div",Q0,[t.createElementVNode("div",e1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",t1,[t.createElementVNode("label",n1,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showErrorMessage,onChange:L[12]||(L[12]=oe=>h.showErrorMessage=oe.target.checked)},null,40,o1),L[22]||(L[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(g)(e.locale,"dvShowErrorAlert")),1)])]),t.createElementVNode("div",l1,[t.createElementVNode("label",r1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorStyle")),1),t.createVNode(Pt,{class:"dv-dropdown","model-value":h.errorStyle,options:he.value,width:"100%","visible-count":4,title:t.unref(g)(e.locale,"dvErrorStyle"),align:"right",onChange:Z},null,8,["model-value","options","title"])]),t.createElementVNode("div",a1,[t.createElementVNode("label",i1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[13]||(L[13]=oe=>h.errorTitle=oe),class:"dv-input",type:"text",disabled:!h.showErrorMessage},null,8,s1),[[t.vModelText,h.errorTitle]])]),t.createElementVNode("div",c1,[t.createElementVNode("label",d1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":L[14]||(L[14]=oe=>h.errorMessage=oe),class:"dv-input dv-input--area",rows:"2",disabled:!h.showErrorMessage},null,8,u1),[[t.vModelText,h.errorMessage]])])]),t.createElementVNode("div",f1,[t.createElementVNode("div",m1,[t.createElementVNode("label",p1,t.toDisplayString(t.unref(g)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[15]||(L[15]=oe=>h.rangeText=oe),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.rangeText]])])]),R.value?(t.openBlock(),t.createElementBlock("div",h1,t.toDisplayString(R.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",g1,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",onClick:L[16]||(L[16]=oe=>o("clear"))},t.toDisplayString(t.unref(g)(e.locale,"dvClearAll")),1),L[23]||(L[23]=t.createElementVNode("span",{class:"dv-editor__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--primary",onClick:ie},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:L[17]||(L[17]=oe=>o("cancel"))},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-6b92bc91"]]),y1={key:0,class:"dvd__search"},C1=["placeholder"],w1=["onMouseenter","onClick"],v1={class:"dvd__check"},k1={class:"dvd__label"},E1={key:1,class:"dvd__empty"},An=24,R1=244,S1=140,M1=Lt(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},boundaryEl:{}},emits:["select","close"],setup(e,{emit:l}){const n=e,o=l,a=t.ref(""),i=t.ref(0),r=t.ref(0),c=t.ref(null),s=t.ref(null),y=t.ref(null),h=t.ref({left:n.x,top:n.y+n.height+2,up:!1}),R=t.computed(()=>{const O=a.value.trim().toLowerCase();return O?n.items.filter(L=>String(L??"").toLowerCase().includes(O)):n.items}),f=t.computed(()=>Math.min(R1,Math.max(An,R.value.length*An))),E=t.computed(()=>Math.max(S1,Math.min(360,n.width))),k=t.computed(()=>Math.max(0,Math.floor(r.value/An)-1)),N=t.computed(()=>Math.min(R.value.length,Math.ceil((r.value+f.value)/An)+1)),Y=t.computed(()=>R.value.slice(k.value,N.value)),te=t.computed(()=>k.value*An),me=t.computed(()=>Math.max(0,(R.value.length-N.value)*An));function he(O){return String(O??"").trim().toLowerCase()===String(n.current??"").trim().toLowerCase()}function Te(){const O=f.value+pe(),L=Fn(n.boundaryEl),oe=L.bottom-(n.y+n.height)-8,$e=n.y-L.top-8,lt=oe<O&&$e>oe;let ne=lt?n.y-O-2:n.y+n.height+2;ne=Math.max(L.top+8,Math.min(L.bottom-O-8,ne));const xe=Math.max(L.left+8,Math.min(L.right-E.value-8,n.x));h.value={left:xe,top:ne,up:lt}}function pe(){return R.value.length>8||a.value?34:0}t.watch(()=>[n.x,n.y,n.width,n.height],()=>Te()),t.onMounted(()=>{t.nextTick(()=>{var O;Te(),c.value?c.value.focus():(O=y.value)==null||O.focus()}),document.addEventListener("pointerdown",Ee,!0),window.addEventListener("resize",Le),window.addEventListener("scroll",Le,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Ee,!0),window.removeEventListener("resize",Le),window.removeEventListener("scroll",Le,!0)});function Ee(O){var L;(L=y.value)!=null&&L.contains(O.target)||Le()}function Le(){o("close")}function ue(O){const L=s.value;if(!L)return;const oe=O*An,$e=oe+An;oe<L.scrollTop?L.scrollTop=oe:$e>L.scrollTop+f.value&&(L.scrollTop=$e-f.value)}function ie(O){const L=R.value.length;L!==0&&(i.value=(i.value+O+L)%L,ue(i.value))}function tt(O){const L=R.value[O];L!==void 0&&o("select",L)}function st(O){r.value=O.target.scrollTop}function Z(O){switch(O.key){case"ArrowDown":O.preventDefault(),O.stopPropagation(),ie(1);return;case"ArrowUp":O.preventDefault(),O.stopPropagation(),ie(-1);return;case"Home":O.preventDefault(),O.stopPropagation(),i.value=0,r.value=0,s.value&&(s.value.scrollTop=0);return;case"End":{O.preventDefault(),O.stopPropagation();const L=R.value.length;i.value=Math.max(0,L-1),ue(i.value);return}case"PageDown":O.preventDefault(),O.stopPropagation(),ie(Math.max(1,Math.floor(f.value/An)));return;case"PageUp":O.preventDefault(),O.stopPropagation(),ie(-Math.max(1,Math.floor(f.value/An)));return;case"Enter":O.preventDefault(),O.stopPropagation(),tt(i.value);return;case"Escape":O.preventDefault(),O.stopPropagation(),Le();return;case"Tab":O.preventDefault(),O.stopPropagation(),tt(i.value);return}}return t.watch(a,()=>{i.value=0,r.value=0,s.value&&(s.value.scrollTop=0),t.nextTick(Te)}),t.watch(R,O=>{const L=O.findIndex(oe=>he(oe));L>=0&&(i.value=L,t.nextTick(()=>ue(L)))},{immediate:!0}),(O,L)=>(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:E.value+"px"}),onKeydown:Z,onWheel:L[2]||(L[2]=t.withModifiers(()=>{},["stop"]))},[pe()>0?(t.openBlock(),t.createElementBlock("div",y1,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:c,"onUpdate:modelValue":L[0]||(L[0]=oe=>a.value=oe),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(g)(e.locale,"dvSearchPlaceholder"),onKeydown:Z},null,40,C1),[[t.vModelText,a.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:s,class:"dvd__list",style:t.normalizeStyle({height:f.value+"px"}),onScroll:st},[t.createElementVNode("div",{style:t.normalizeStyle({height:te.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Y.value,(oe,$e)=>(t.openBlock(),t.createElementBlock("div",{key:k.value+$e,class:t.normalizeClass(["dvd__item",{"dvd__item--active":k.value+$e===i.value,"dvd__item--checked":he(oe)}]),style:t.normalizeStyle({height:An+"px",lineHeight:An+"px"}),onMousedown:L[1]||(L[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:lt=>i.value=k.value+$e,onClick:lt=>tt(k.value+$e)},[t.createElementVNode("span",v1,t.toDisplayString(he(oe)?"✓":""),1),t.createElementVNode("span",k1,t.toDisplayString(oe===""?t.unref(g)(e.locale,"emptyCellLabel"):oe),1)],46,w1))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:me.value+"px"})},null,4)],36),R.value.length===0?(t.openBlock(),t.createElementBlock("div",E1,t.toDisplayString(t.unref(g)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],36))}}),[["__scopeId","data-v-1645fbe5"]]),N1={class:"dv-alert__header"},B1={class:"dv-alert__title"},x1={class:"dv-alert__body"},T1=["d"],V1={class:"dv-alert__text"},D1={key:0,class:"dv-alert__subtitle"},F1={class:"dv-alert__message"},O1={class:"dv-alert__footer"},Ia=Lt(t.defineComponent({__name:"data-validation-alert",props:{locale:{},severity:{},title:{default:""},message:{default:""},themeVars:{default:()=>({})}},emits:["resolve"],setup(e,{emit:l}){const n=e,o=l,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[n.severity]??a.stop),r=t.computed(()=>n.title?n.title:n.severity==="warning"?g(n.locale,"dvWarningDialogTitle"):n.severity==="information"?g(n.locale,"dvInformationDialogTitle"):g(n.locale,"dvStopDialogTitle")),c=t.computed(()=>n.severity==="stop"?g(n.locale,"dvBtnRetry"):n.severity==="warning"?g(n.locale,"dvBtnContinue"):g(n.locale,"dvBtnOk")),s=t.computed(()=>n.severity==="stop"?g(n.locale,"cancel"):n.severity==="warning"?g(n.locale,"dvBtnNo"):g(n.locale,"cancel"));function y(){o("resolve",n.severity==="stop"?"retry":"continue")}function h(){o("resolve","cancel")}return(R,f)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",N1,[t.createElementVNode("span",B1,t.toDisplayString(r.value),1)]),t.createElementVNode("div",x1,[(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,T1)],4)),t.createElementVNode("div",V1,[e.title?(t.openBlock(),t.createElementBlock("div",D1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",F1,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",O1,[f[2]||(f[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:f[0]||(f[0]=t.withModifiers(()=>{},["prevent"])),onClick:y},t.toDisplayString(c.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:f[1]||(f[1]=t.withModifiers(()=>{},["prevent"])),onClick:h},t.toDisplayString(s.value),33)])],4))}}),[["__scopeId","data-v-8b20dae0"]]),I1={key:0,class:"dvim__title"},A1={class:"dvim__message"},L1=Lt(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(l,n)=>(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",I1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",A1,t.toDisplayString(e.message),1)],4))}}),[["__scopeId","data-v-c8350c96"]]),$1={class:"note-overlay__header"},z1={class:"note-overlay__author"},_1=["title"],H1={class:"note-overlay__body"},W1={class:"note-overlay__header"},U1={class:"note-overlay__author"},P1=["placeholder"],K1={class:"note-overlay__footer"},G1=Lt(t.defineComponent({__name:"note-overlay",props:{anchor:{},mode:{},note:{default:null},author:{},locale:{},placeholder:{default:""},boundaryEl:{default:null}},emits:["save","delete","close"],setup(e,{emit:l}){var f;const n=e,o=l,a=t.ref(null),i=t.ref(((f=n.note)==null?void 0:f.text)??"");t.watch(()=>{var E;return[n.mode,(E=n.note)==null?void 0:E.text,n.anchor.x,n.anchor.y]},()=>{var E;i.value=((E=n.note)==null?void 0:E.text)??""});const r=t.ref({left:0,top:0}),c=t.computed(()=>({left:r.value.left+"px",top:r.value.top+"px",zIndex:2}));function s(){var ue,ie;const E=a.value,k=n.anchor;if(!E){r.value={left:k.x+k.width+6,top:k.y+6};return}const N=E.offsetWidth,Y=E.offsetHeight,he={left:52,top:24,right:((ue=n.boundaryEl)==null?void 0:ue.offsetWidth)??0,bottom:((ie=n.boundaryEl)==null?void 0:ie.offsetHeight)??0},Te=6,pe=8;let Ee=k.x+k.width+Te,Le=k.y+Te;Ee+N>he.right-pe&&(Ee=k.x-N-Te,Ee<he.left+pe&&(Ee=Math.min(Math.max(he.left+pe,k.x),he.right-N-pe),he.right-N-pe<he.left+pe&&(Ee=he.left+pe))),Le+Y>he.bottom-pe&&(Le=k.y+k.height-Te-Y,Le<he.top+pe&&(Le=Math.min(Math.max(he.top+pe,k.y),he.bottom-Y-pe),he.bottom-Y-pe<he.top+pe&&(Le=he.top+pe))),r.value={left:Ee,top:Le}}t.watch(()=>{var E;return[n.anchor.x,n.anchor.y,n.anchor.width,(E=n.note)==null?void 0:E.text,i.value]},()=>t.nextTick(s),{immediate:!0,flush:"post"});function y(){t.nextTick(s)}t.onMounted(()=>window.addEventListener("resize",y)),t.onBeforeUnmount(()=>window.removeEventListener("resize",y));function h(E){E.key==="Escape"?(E.stopPropagation(),E.preventDefault(),o("close")):E.key==="Enter"&&!E.shiftKey&&(E.ctrlKey||E.metaKey||E.altKey)&&(E.stopPropagation(),E.preventDefault(),R())}function R(){o("save",i.value.trim())}return(E,k)=>{var N,Y;return e.mode?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"el",ref:a,class:t.normalizeClass(["note-overlay",`note-overlay--${e.mode}`]),style:t.normalizeStyle(c.value),onMousedown:k[3]||(k[3]=t.withModifiers(()=>{},["stop"])),onContextmenu:k[4]||(k[4]=t.withModifiers(()=>{},["stop"])),onClick:k[5]||(k[5]=t.withModifiers(()=>{},["stop"]))},[e.mode==="view"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",$1,[t.createElementVNode("span",z1,t.toDisplayString(((N=e.note)==null?void 0:N.author)||e.author||t.unref(g)(e.locale,"noteUnnamed")),1),t.createElementVNode("button",{type:"button",class:"note-overlay__icon",title:t.unref(g)(e.locale,"findClose"),onClick:k[0]||(k[0]=te=>o("close"))}," × ",8,_1)]),t.createElementVNode("div",H1,t.toDisplayString(((Y=e.note)==null?void 0:Y.text)||t.unref(g)(e.locale,"noteEmpty")),1)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",W1,[t.createElementVNode("span",U1,t.toDisplayString(e.author||t.unref(g)(e.locale,"noteUnnamed")),1)]),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":k[1]||(k[1]=te=>i.value=te),class:"note-overlay__editor",placeholder:e.placeholder,rows:"3",onKeydown:h,onBlur:R},null,40,P1),[[t.vModelText,i.value]]),t.createElementVNode("div",K1,[t.createElementVNode("button",{type:"button",class:"note-overlay__btn note-overlay__btn--ghost",onClick:k[2]||(k[2]=te=>o("close"))},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1),t.createElementVNode("button",{type:"button",class:"note-overlay__btn note-overlay__btn--primary",onClick:R},t.toDisplayString(t.unref(g)(e.locale,"noteSave")),1)])],64))],38)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-2d4ad04f"]]);function Mo(e,l){return`${e},${l}`}function Aa(e,l){if(e.startsWith("="))return{kind:"formula",formula:e};const n=eo(e,l);if(n)return{kind:"date",serial:n.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 Hn(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function hr(e,l){for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==l)return!1;return!0}function La(e){const l=e.length;if(l===0)return{kind:"copy",sourceValues:[]};if(e.some(n=>n.kind==="formula"))return{kind:"formula"};if(e.every(n=>n.kind==="date")){const n=e[0],o=l>=2?e[1].serial-n.serial:1;return{kind:"date-linear",baseSerial:n.serial,step:o,sourceLen:l}}if(e.every(n=>n.kind==="number")){if(l===1)return{kind:"copy",sourceValues:[...e]};const n=e.map(a=>a.num),o=n[1]-n[0];return hr(n,o)?{kind:"linear",step:o,base:n[0],sourceLen:l}:{kind:"copy",sourceValues:[...e]}}if(e.every(n=>n.kind==="text-number")){const n=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===n.prefix)){if(l===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(hr(a,i))return{kind:"text-number",prefix:n.prefix,step:i,base:n.num,digits:n.digits,sourceLen:l}}return{kind:"copy",sourceValues:[...e]}}if(e.every(n=>n.kind==="text")){const n=e.every(o=>o.text.length===1&&/[a-zA-Z]/.test(o.text));if(l>=2&&n){const o=e.map(i=>i.text.charCodeAt(0)),a=o[1]-o[0];if(a!==0&&hr(o,a))return{kind:"text-series",step:a,baseCharCode:o[0],sourceLen:l}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function $a(e,l,n){switch(e.kind){case"copy":{const o=e.sourceValues.length;return o===0?{kind:"text",text:""}:e.sourceValues[l%o]}case"linear":return{kind:"number",num:e.base+e.step*(n+l)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(n+l),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(n+l)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(n+l))};case"formula":return{kind:"formula",formula:""}}}function za(e,l){switch(e.kind){case"copy":{const n=e.sourceValues.length;return n===0?{kind:"text",text:""}:e.sourceValues[n-1-l%n]}case"linear":return{kind:"number",num:e.base-e.step*(l+1)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base-e.step*(l+1),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial-e.step*(l+1)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode-e.step*(l+1))};case"formula":return{kind:"formula",formula:""}}}function Il(e,l){switch(e.kind){case"formula":return{value:e.formula,styleId:l};case"number":return{value:String(e.num),styleId:l};case"text":return{value:e.text,styleId:l};case"text-number":return{value:e.prefix+String(e.num).padStart(e.digits,"0"),styleId:l};case"date":return{value:String(e.serial),styleId:l}}}function _a(e,l){const n=l.row<e.startRow?e.startRow-l.row:l.row>e.endRow?l.row-e.endRow:0,o=l.col<e.startCol?e.startCol-l.col:l.col>e.endCol?l.col-e.endCol:0;if(n===0&&o===0)return null;const a=n>=o?l.row<e.startRow?"up":"down":l.col<e.startCol?"left":"right";let i;switch(a){case"down":i={startCol:e.startCol,startRow:e.endRow+1,endCol:e.endCol,endRow:l.row};break;case"up":i={startCol:e.startCol,startRow:l.row,endCol:e.endCol,endRow:e.startRow-1};break;case"right":i={startCol:e.endCol+1,startRow:e.startRow,endCol:l.col,endRow:e.endRow};break;case"left":i={startCol:l.col,startRow:e.startRow,endCol:e.startCol-1,endRow:e.endRow};break}return{targetRange:i,direction:a}}function Ha(e,l,n,o,a,i){return Vl(e,n.col-l.col,n.row-l.row,o,a,i)}function Wa(e,l){return!(e.endCol<l.startCol||e.startCol>l.endCol||e.endRow<l.startRow||e.startRow>l.endRow)}function Ua(e,l){return l.startCol>=e.startCol&&l.endCol<=e.endCol&&l.startRow>=e.startRow&&l.endRow<=e.endRow}function gr(e,l,n){const o=Object.keys(n);for(const c of o){const s=n[c];if(Wa(e,s)&&!Ua(e,s))return{ok:!1,reason:"source-overlap"}}const a=[];for(const c of o){const s=n[c];Ua(e,s)||Wa(l,s)&&a.push(s)}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 Pa(e,l,n,o){const a=l.length;if(a!==0){if(e.kind==="copy"){const i=o?a-1-n%a:n%a;return l[i]}return o?l[0]:l[a-1]}}function Ka(e,l,n,o,a,i,r,c){const s={cells:{},merges:{}},y=o==="up"||o==="down",h=o==="up"||o==="left";if(y){const R=e.endRow-e.startRow+1;for(let f=e.startCol;f<=e.endCol;f++){const E=[],k=[];for(let te=e.startRow;te<=e.endRow;te++){const me=n.cells[Mo(f,te)];E.push(me?Aa(me.value,a):{kind:"text",text:""}),k.push(me==null?void 0:me.styleId)}const N=La(E),Y=E.length;for(let te=l.startRow;te<=l.endRow;te++){const me=h?l.endRow-te:te-l.startRow;if(N.kind==="formula"){const he=h?e.endRow-((l.endRow-te)%R+R)%R:e.startRow+((te-e.startRow)%R+R)%R,Te=n.cells[Mo(f,he)],pe=Te?Te.value:"",Ee=Ha(pe,{col:f,row:he},{col:f,row:te},i,r,c);s.cells[Mo(f,te)]=Il({kind:"formula",formula:Ee},Te==null?void 0:Te.styleId)}else{const he=h?za(N,me):$a(N,me,Y),Te=Pa(N,k,me,h);s.cells[Mo(f,te)]=Il(he,Te)}}}}else{const R=e.endCol-e.startCol+1;for(let f=e.startRow;f<=e.endRow;f++){const E=[],k=[];for(let te=e.startCol;te<=e.endCol;te++){const me=n.cells[Mo(te,f)];E.push(me?Aa(me.value,a):{kind:"text",text:""}),k.push(me==null?void 0:me.styleId)}const N=La(E),Y=E.length;for(let te=l.startCol;te<=l.endCol;te++){const me=h?l.endCol-te:te-l.startCol;if(N.kind==="formula"){const he=h?e.endCol-((l.endCol-te)%R+R)%R:e.startCol+((te-e.startCol)%R+R)%R,Te=n.cells[Mo(he,f)],pe=Te?Te.value:"",Ee=Ha(pe,{col:he,row:f},{col:te,row:f},i,r,c);s.cells[Mo(te,f)]=Il({kind:"formula",formula:Ee},Te==null?void 0:Te.styleId)}else{const he=h?za(N,me):$a(N,me,Y),Te=Pa(N,k,me,h);s.cells[Mo(te,f)]=Il(he,Te)}}}}return s}function Al(e,l){delete e[l]}function q1(){return`note-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Ga(e){return e?{...e}:{}}function Yo(e,l){return`${e},${l}`}function qa(e,l,n){const o=n[Yo(l,e)];return!!(o&&o.noteId)}function Y1(e,l,n,o){const a=n[Yo(l,e)];if(!(!a||!a.noteId))return o[a.noteId]}function j1(e,l){const n=Date.now();return{id:q1(),text:e,author:l,createdAt:n,updatedAt:n}}function X1(e,l,n,o,a,i){const r=Yo(l,e),c=a[r]||(a[r]={value:""});c.noteId&&i[c.noteId]&&Al(i,c.noteId);const s=j1(n,o);return i[s.id]=s,c.noteId=s.id,s}function Z1(e,l,n){const o=n[e];if(!o)throw new Error(`Note ${e} not found`);return o.text=l,o.updatedAt=Date.now(),o}function J1(e,l,n,o){const a=Yo(l,e),i=n[a];if(!i||!i.noteId)return;const r=o[i.noteId];return Al(o,i.noteId),i.noteId=void 0,Object.keys(i).length===1&&"value"in i&&i.value===""&&Al(n,a),r}function Q1(e,l,n){const o=new Map;for(let a=e.startRow;a<=e.endRow;a++)for(let i=e.startCol;i<=e.endCol;i++){const r=l[Yo(i,a)];r&&r.noteId&&n[r.noteId]&&o.set(Yo(i,a),n[r.noteId])}return o}function Ll(e,l){const n=new Set;for(const o in e){const a=e[o];a!=null&&a.noteId&&n.add(a.noteId)}for(const o in l)n.has(o)||Al(l,o)}function ep(e){let l=1/0,n=1/0;for(const o of e.ranges)o.startCol<l&&(l=o.startCol),o.startRow<n&&(n=o.startRow);return isFinite(l)||(l=0),isFinite(n)||(n=0),{col:l,row:n}}function tp(e,l,n){for(const o of e)if(l>=o.startCol&&l<=o.endCol&&n>=o.startRow&&n<=o.endRow)return!0;return!1}function Wn(e){if(e==null)return null;const l=String(e).trim();if(l==="")return null;const n=l.replace(/[, ]/g,"");if(n==="")return null;const o=Number(n);return Number.isFinite(o)?o:null}function np(e,l){const n=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=l.getCellValue(i,a);r!==""&&n.set(r,(n.get(r)??0)+1)}return n}class op{constructor(){this.map=new Map}get(l){return this.map.get(l)}set(l,n){this.map.set(l,n)}invalidate(l){l?this.map.delete(l):this.map.clear()}}function lp(e,l,n,o,a,i){switch(e.type){case"cellIs":{const r=o.getCellValue(l,n),c=Wn(r);switch(e.operator){case"equal":{const s=Wn(e.value);return c!==null&&s!==null?c===s:r===e.value}case"notEqual":{const s=Wn(e.value);return c!==null&&s!==null?c!==s:r!==e.value}case"greaterThan":{const s=Wn(e.value);return c===null||s===null?!1:c>s}case"greaterThanOrEqual":{const s=Wn(e.value);return c===null||s===null?!1:c>=s}case"lessThan":{const s=Wn(e.value);return c===null||s===null?!1:c<s}case"lessThanOrEqual":{const s=Wn(e.value);return c===null||s===null?!1:c<=s}case"between":{const s=Wn(e.value),y=Wn(e.value2??"");return c===null||s===null||y===null?!1:c>=Math.min(s,y)&&c<=Math.max(s,y)}case"notBetween":{const s=Wn(e.value),y=Wn(e.value2??"");return c===null||s===null||y===null?!1:c<Math.min(s,y)||c>Math.max(s,y)}}return!1}case"textContains":return o.getCellValue(l,n).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!o.getCellValue(l,n).toLowerCase().includes(e.value.toLowerCase());case"blank":return o.getCellValue(l,n)==="";case"notBlank":return o.getCellValue(l,n)!=="";case"duplicate":{if(!i)return!1;const r=o.getCellValue(l,n);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=o.getCellValue(l,n);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=l-a.col,c=n-a.row,s=e.formula.trim().replace(/^=/,""),y=rp(s,r,c,o.colCount,o.rowCount);return Da(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 rp(e,l,n,o,a){return Vl(e,l,n,o,a,yt)}function ap(e,l,n,o,a){if(!n||n.length===0)return null;const i=n.filter(s=>s.enabled&&tp(s.ranges,e,l)).sort((s,y)=>s.priority-y.priority);if(i.length===0)return null;const r={};let c=!1;for(const s of i){const y=ep(s);let h;(s.condition.type==="duplicate"||s.condition.type==="unique")&&(h=a==null?void 0:a.get(s.id),h||(h=np(s,o),a==null||a.set(s.id,h)));let R=!1;try{R=lp(s.condition,e,l,o,y,h)}catch{}if(!R)continue;c=!0;const f=s.format;if(f.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=f.backgroundColor),f.color!==void 0&&r.color===void 0&&(r.color=f.color),f.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=f.fontWeight),f.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=f.fontStyle),f.underline!==void 0&&r.underline===void 0&&(r.underline=f.underline),f.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=f.strikethrough),s.stopIfTrue)break}return c?r:null}function ip(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Ya(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function sp(e,l,n){for(const o of e)if(l>=o.startCol&&l<=o.endCol&&n>=o.startRow&&n<=o.endRow)return!0;return!1}function cp(e){let l=1/0,n=1/0;for(const o of e.ranges)o.startCol<l&&(l=o.startCol),o.startRow<n&&(n=o.startRow);return isFinite(l)||(l=0),isFinite(n)||(n=0),{col:l,row:n}}function dp(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function up(e){return e?Array.from(e).length:0}const ja=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function al(e,l){if(e==null)return null;const n=String(e).trim();if(n==="")return null;if(n.startsWith("=")){const a=br(n.slice(1),l);return typeof a=="number"&&Number.isFinite(a)?a:a===null?null:Number(a)}const o=Ml(n,l.locale);if(o&&Number.isFinite(o.num))return o.num;if(ja.test(n)){const a=Number(n);return Number.isFinite(a)?a:null}return null}function br(e,l){try{return So(),Va(e,l.cells,l.colCount,l.rowCount)}catch{return null}}function yr(e,l){if(e==null)return null;const n=String(e).trim();if(n==="")return null;if(n.startsWith("=")){const a=br(n.slice(1),l);return typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?yr(a,l):null}if(Hn(n)||ja.test(n)){const a=Number(n);return Number.isFinite(a)?a:null}const o=eo(n,l.locale);return o&&o.format!=="h:mm:ss"?o.serial:null}function Cr(e,l){if(e==null)return null;const n=String(e).trim();if(n==="")return null;if(n.startsWith("=")){const a=br(n.slice(1),l);return typeof a=="number"&&Number.isFinite(a)?wr(a):typeof a=="string"?Cr(a,l):null}const o=eo(n,l.locale);return o?o.format==="h:mm:ss"?o.serial:wr(o.serial):Hn(n)?wr(Number(n)):null}function wr(e){return Number.isFinite(e)?Math.abs(e)%1:0}function fp(e,l,n,o){switch(e){case"between":return n===null||o===null?!1:l>=Math.min(n,o)&&l<=Math.max(n,o);case"notBetween":return n===null||o===null?!1:l<Math.min(n,o)||l>Math.max(n,o);case"equal":return n!==null&&l===n;case"notEqual":return n!==null&&l!==n;case"greaterThan":return n!==null&&l>n;case"greaterThanOrEqual":return n!==null&&l>=n;case"lessThan":return n!==null&&l<n;case"lessThanOrEqual":return n!==null&&l<=n;default:return!1}}function vr(e){return String(e??"").trim().toLowerCase()}function Xa(e,l){var h;const n=e.listSource??(e.values?{type:"values",values:e.values}:void 0);if(!n)return[];const o=[],a=new Set,i=R=>{const f=vr(R);if(!f){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),o.push("");return}a.has(f)||(a.add(f),o.push(R))};if(n.type==="values"){for(const R of n.values??[])i(R);return o}const{range:r,sheetId:c}=n,s=c?((h=l.getSheetCells)==null?void 0:h.call(l,c))??null:null,y=s??l.cells;for(let R=r.startRow;R<=r.endRow;R++)for(let f=r.startCol;f<=r.endCol;f++){const E=`${f},${R}`,k=y[E];if(k)if(s){const N=k.value;i(N.startsWith("=")?mp(N,s,l):N)}else i(l.getCellValue(f,R))}return o}function mp(e,l,n){try{So();const o=Va(e.slice(1),l,n.colCount,n.rowCount);return o===null?"":String(o)}catch{return""}}function pp(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function hp(e,l,n){const o={value:n};return new Proxy(e,{get(a,i){return i===l?o:a[i]},has(a,i){return i===l?!0:i in a}})}function gp(e,l,n,o,a){if(e.enabled===!1)return!0;const i=l==null?"":String(l);if(dp(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=Xa(e,a),c=vr(i);return r.some(s=>vr(s)===c)}case"wholeNumber":{const r=al(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:il(e,r,a,al)}case"decimal":{const r=al(i,a);return r===null||!Number.isFinite(r)?!1:il(e,r,a,al)}case"date":{const r=yr(i,a);return r===null?!1:il(e,r,a,yr)}case"time":{const r=Cr(i,a);return r===null?!1:il(e,r,a,Cr)}case"textLength":{const r=up(i);return il(e,r,a,al)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?bp(r,l,n,o,e,a):!0}default:return!0}}catch{return!1}}function il(e,l,n,o){const a=e.operator;if(!a)return!0;const i=e.formula1!==void 0&&e.formula1!==""?o(e.formula1,n):null,r=e.formula2!==void 0&&e.formula2!==""?o(e.formula2,n):null;return fp(a,l,i,r)}function bp(e,l,n,o,a,i){try{const r=cp(a),c=Vl(e,n-r.col,o-r.row,i.colCount,i.rowCount,yt),s=hp(i.cells,`${n},${o}`,l==null?"":String(l));return So(),Da(c,s,i.colCount,i.rowCount)}catch{return!1}}const yp={stop:3,warning:2,information:1};function kr(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function Za(e,l,n,o,a){if(!o||o.length===0)return{valid:!0};let i=null,r=0;for(const h of o){if(h.enabled===!1||!sp(h.ranges,l,n))continue;let R;try{R=gp(h,e,l,n,a)}catch{R=!1}if(R)continue;const f=yp[kr(h)];f>r&&(r=f,i=h)}if(!i)return{valid:!0};const c=kr(i),s=i.showErrorMessage!==!1,y=Cp(i,a.locale);return{valid:!1,rule:i,severity:c,title:s&&i.errorTitle?i.errorTitle:y.title,message:s&&i.errorMessage?i.errorMessage:y.message}}function Cp(e,l){var a;const n=g(l,"dvErrorTitleDefault"),o=e.operator?g(l,`dv${wp(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:n,message:g(l,r?"dvMsgList":"dvMsgListEmpty").replace("{values}",r)}}case"wholeNumber":return{title:n,message:sl(l,g(l,"dvTypeWholeNumber"),o,e)};case"decimal":return{title:n,message:sl(l,g(l,"dvTypeDecimal"),o,e)};case"date":return{title:n,message:sl(l,g(l,"dvTypeDate"),o,e)};case"time":return{title:n,message:sl(l,g(l,"dvTypeTime"),o,e)};case"textLength":return{title:n,message:sl(l,g(l,"dvTypeTextLength"),o,e)};case"custom":return{title:n,message:g(l,"dvMsgCustom").replace("{formula}",e.formula1??"")};default:return{title:n,message:g(l,"dvMsgInvalid")}}}function wp(e){return e.charAt(0).toUpperCase()+e.slice(1)}function sl(e,l,n,o){return n?o.operator==="between"||o.operator==="notBetween"?g(e,o.operator==="between"?"dvMsgBetween":"dvMsgNotBetween").replace("{type}",l).replace("{min}",o.formula1??"").replace("{max}",o.formula2??""):g(e,"dvMsgCompare").replace("{type}",l).replace("{op}",n).replace("{value}",o.formula1??""):g(e,"dvMsgInvalid")}const $l=64;class vp{constructor(l=[]){this.bands=new Map,this.dirty=!0,this.source=[],this.source=l}invalidate(){this.dirty=!0}ensure(l){if(l&&l!==this.source&&(this.source=l,this.dirty=!0),!!this.dirty){this.bands.clear();for(const n of this.source)if(!(!n||n.enabled===!1))for(const o of n.ranges??[]){const a=Math.floor(o.startRow/$l),i=Math.floor(o.endRow/$l);for(let r=a;r<=i;r++){let c=this.bands.get(r);c||(c=[],this.bands.set(r,c)),c.push({rule:n,range:o})}}this.dirty=!1}}getRules(l,n,o){this.ensure(o);const a=this.bands.get(Math.floor(n/$l));if(!a||a.length===0)return[];const i=[];for(const r of a)l<r.range.startCol||l>r.range.endCol||n<r.range.startRow||n>r.range.endRow||i.includes(r.rule)||i.push(r.rule);return i}has(l,n,o){const a=this.bandsOf(l,n,o);for(const i of a)if(!(l<i.range.startCol||l>i.range.endCol)&&!(n<i.range.startRow||n>i.range.endRow))return!0;return!1}findRule(l,n,o,a){for(const i of this.bandsOf(l,n,a))if(!(l<i.range.startCol||l>i.range.endCol)&&!(n<i.range.startRow||n>i.range.endRow)&&o(i.rule))return i.rule;return null}bandsOf(l,n,o){return this.ensure(o),this.bands.get(Math.floor(n/$l))??kp}}const kp=[];function Ep(e,l,n,o){if(l==="row"){const s=e.startRow,y=e.endRow;let h,R;if(y<n)h=s,R=y;else if(s>n+o-1)h=s-o,R=y-o;else if(h=s<n?s:n,R=y>n+o-1?y-o:n-1,R<h)return null;return{...e,startRow:h,endRow:R}}const a=e.startCol,i=e.endCol;let r,c;if(i<n)r=a,c=i;else if(a>n+o-1)r=a-o,c=i-o;else if(r=a<n?a:n,c=i>n+o-1?i-o:n-1,c<r)return null;return{...e,startCol:r,endCol:c}}function Rp(e,l,n,o){if(l==="row"){const r=e.startRow,c=e.endRow;return r>=n?{...e,startRow:r+o,endRow:c+o}:c<n?e:{...e,endRow:c+o}}const a=e.startCol,i=e.endCol;return a>=n?{...e,startCol:a+o,endCol:i+o}:i<n?e:{...e,endCol:i+o}}function Ja(e,l){return!(e.endCol<l.startCol||e.startCol>l.endCol||e.endRow<l.startRow||e.startRow>l.endRow)}function Qa(e,l){if(!Ja(e,l))return[{...e}];const n=[];e.startRow<l.startRow&&n.push({startCol:e.startCol,endCol:e.endCol,startRow:e.startRow,endRow:l.startRow-1}),e.endRow>l.endRow&&n.push({startCol:e.startCol,endCol:e.endCol,startRow:l.endRow+1,endRow:e.endRow});const o=Math.max(e.startRow,l.startRow),a=Math.min(e.endRow,l.endRow);return o<=a&&(e.startCol<l.startCol&&n.push({startCol:e.startCol,endCol:l.startCol-1,startRow:o,endRow:a}),e.endCol>l.endCol&&n.push({startCol:l.endCol+1,endCol:e.endCol,startRow:o,endRow:a})),n}function Sp(e,l,n){return{startCol:e.startCol+l,endCol:e.endCol+l,startRow:e.startRow+n,endRow:e.endRow+n}}function ei(e,l){return Ja(e,l)?{startCol:Math.max(e.startCol,l.startCol),endCol:Math.min(e.endCol,l.endCol),startRow:Math.max(e.startRow,l.startRow),endRow:Math.min(e.endRow,l.endRow)}:null}const Mp=1;function Np(e,l,n){let o=0;for(let a=0;a<e.length;a++){const i=e[a];i.start<=l&&n<=i.end&&o++}return o}function Bp(e,l,n,o){return e<=n&&o<=l||n<=e&&l<=o||l<n||o<e}function Er(e,l,n){if(!Number.isInteger(l)||!Number.isInteger(n)||l<0||n<l)return{ok:!1,code:"outlineInvalid"};if(n-l+1<2)return{ok:!1,code:"outlineMinSize"};for(let a=0;a<e.length;a++){const i=e[a];if(!Bp(l,n,i.start,i.end))return{ok:!1,code:"outlineCrossing"}}const o=Np(e,l,n)+1;return o>Mp?{ok:!1,code:"outlineTooDeep"}:{ok:!0,level:o}}function ti(e,l,n,o,a,i){const r=Er(e,n,o);return!r.ok||r.level===void 0?{outlines:e,validation:r}:{outlines:e.concat({id:a,axis:l,start:n,end:o,level:r.level,collapsed:!1}),validation:r}}function ni(e,l,n){let o=!1;const a=e.map(i=>i.id===l&&i.collapsed!==n?(o=!0,{...i,collapsed:n}):i);return o?a:e}function oi(e,l){return e.filter(n=>n.id!==l)}function zl(){return[]}function li(e,l,n){return e.map(o=>o.start>=l?{...o,start:o.start+n,end:o.end+n}:o.end<l?o:{...o,end:o.end+n})}function ri(e,l,n){const o=[];for(const a of e){const i=a.start,r=a.end;let c,s;if(r<l)c=i,s=r;else if(i>l+n-1)c=i-n,s=r-n;else if(c=i<l?i:l,s=r>l+n-1?r-n:l-1,s<c)continue;o.push({...a,start:c,end:s})}return o}function no(e){return e.map(l=>{let n=0;for(let o=0;o<e.length;o++){const a=e[o];a!==l&&a.start<=l.start&&l.end<=a.end&&n++}return{...l,level:n+1}})}function ai(e,l){let n=0;for(let o=0;o<e.length;o++){const a=e[o];a.start<=l&&l<=a.end&&n++}return n}function ii(e,l){const n=l==="row"?"row-outline":"col-outline",o=new Set(e.map(i=>i.id));let a=1;for(;o.has(`${n}-${a}`);)a++;return`${n}-${a}`}class xp{constructor(l){if(l&&l.length>0){this.styles=l,this.index=new Map;for(let n=0;n<this.styles.length;n++){const o=this.stableKey(this.styles[n]);this.index.set(o,n)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const n=Object.keys(l).sort(),o={};for(const a of n)o[a]=l[a];return JSON.stringify(o)}get(l){const n=this.styles[l];return n?l===0?n:Object.freeze(n):{}}getId(l){if(!l||Object.keys(l).length===0)return 0;const n=this.stableKey(l),o=this.index.get(n);if(o!==void 0)return o;const a=this.styles.length,i=Object.freeze({...l});return this.styles.push(i),this.index.set(n,a),a}getStyles(){return[...this.styles]}setStyles(l){this.styles=l,this.index=new Map;for(let n=0;n<this.styles.length;n++){const o=this.stableKey(this.styles[n]);this.index.set(o,n)}}compactStyles(l){const n=new Set;n.add(0);for(const r in l){const c=l[r].styleId??0;n.add(c)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(n).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 l){const c=l[r],s=c.styleId??0,y=o.get(s);y!==void 0&&y!==s&&(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 Tp(e,l){if(!e)return null;const n=e.styleId;return n===void 0||n===0?null:l[n]??null}function si(e){const l=new xp,n={};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=l.getId(a.style)),i.styleId===0&&delete i.styleId;const r=a.noteId;typeof r=="string"&&r&&(i.noteId=r),n[o]=i}return{cells:n,styles:l.getStyles()}}function Vp(e){const l={};for(const[n,o]of Object.entries(e)){const a={value:o.value};o.styleId!==void 0&&o.styleId>0&&(a.styleId=o.styleId),o.noteId&&(a.noteId=o.noteId),l[n]=a}return l}class Dp{constructor(l){if(l&&l.length>0){this.borders=l,this.index=new Map;for(let n=0;n<this.borders.length;n++){const o=this.stableKey(this.borders[n]);this.index.set(o,n)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const n=["top","right","bottom","left"],o={};for(const a of n){const i=l[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0||i.owner!==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),i.owner!==void 0&&(r.owner=i.owner),o[a]=r}}return JSON.stringify(o)}get(l){const n=this.borders[l];return n?l===0?n:Object.freeze(n):{}}getId(l){if(!l||this.isEmptyBorder(l))return 0;const n=this.stableKey(l),o=this.index.get(n);if(o!==void 0)return o;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(l));return this.borders.push(i),this.index.set(n,a),a}isEmptyBorder(l){return!l.top&&!l.right&&!l.bottom&&!l.left}deepCloneBorder(l){const n={};return l.top&&(n.top={...l.top}),l.right&&(n.right={...l.right}),l.bottom&&(n.bottom={...l.bottom}),l.left&&(n.left={...l.left}),n}getBorders(){return[...this.borders]}setBorders(l){this.borders=l,this.index=new Map;for(let n=0;n<this.borders.length;n++){const o=this.stableKey(this.borders[n]);this.index.set(o,n)}}compactBorders(l){const n=new Set;n.add(0);for(const r of l){const c=r.borderId??0;n.add(c)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(n).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 l){const c=r.borderId??0,s=o.get(c);s!==void 0&&s!==c&&(r.borderId=s)}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 Fp(e,l,n,o){if(!e)return;const a=e.styleId??0,i=n[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const c=o.get(r);if(c)return c[l]}function Op(e,l,n,o,a,i){const r=o[e.styleId??0]??{},c=r.borderId??0,s=c>0?a.get(c):{},y={top:s.top?{...s.top}:void 0,right:s.right?{...s.right}:void 0,bottom:s.bottom?{...s.bottom}:void 0,left:s.left?{...s.left}:void 0};n?y[l]={...n}:y[l]=void 0;const h=a.getId(y),R={...r};h===0?delete R.borderId:R.borderId=h,delete R.borderTopWidth,delete R.borderBottomWidth,delete R.borderLeftWidth,delete R.borderRightWidth,delete R.borderColor,Object.keys(R).length===0?e.styleId=0:e.styleId=i(R)}function ci(e){const l=new Dp,n=[];for(const o of e){if(!(o.borderTopWidth!==void 0||o.borderBottomWidth!==void 0||o.borderLeftWidth!==void 0||o.borderRightWidth!==void 0)){n.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=l.getId(r),s={...o};delete s.borderTopWidth,delete s.borderBottomWidth,delete s.borderLeftWidth,delete s.borderRightWidth,delete s.borderColor,c>0?s.borderId=c:delete s.borderId,n.push(s)}return{styles:n,borders:l.getBorders()}}function Ip(e,l){const a=t.reactive({rowCount:Math.max(200,e.rowCount??l.rowCount),colCount:Math.max(26,e.colCount??l.colCount),width:e.width,height:e.height,theme:e.theme??l.theme,locale:e.locale??l.locale});t.watchEffect(()=>{a.rowCount=Math.max(200,e.rowCount??l.rowCount),a.colCount=Math.max(26,e.colCount??l.colCount),a.width=e.width,a.height=e.height,a.theme=e.theme??l.theme,a.locale=e.locale??l.locale});const i=t.computed(()=>a.locale==="zh-CN"?"zh-CN":"en-US"),r=a.colCount,c=a.rowCount,s=t.reactive({colCount:r,rowCount:c}),y=8,h=32,R=t.reactive({}),f=t.reactive([{}]),E=t.reactive([{}]);let k=new Map;k.set("{}",0);let N=new Map;N.set("{}",0);const Y=t.reactive([]),te=new op,me=t.reactive({}),he=t.reactive([]),Te=new vp(he),pe=new Map;let Ee=0;function Le(d){const p=Object.keys(d).sort(),C={};for(const F of p)C[F]=d[F];return JSON.stringify(C)}function ue(d){const p=["top","right","bottom","left"],C={};for(const F of p){const A=d[F];if(A&&(A.width!==void 0||A.color!==void 0||A.style!==void 0)){const ae={};A.width!==void 0&&(ae.width=A.width),A.color!==void 0&&(ae.color=A.color),A.style!==void 0&&(ae.style=A.style),C[F]=ae}}return JSON.stringify(C)}function ie(d){if(!d||Object.keys(d).length===0)return 0;const p=Le(d),C=k.get(p);if(C!==void 0)return C;const F=f.length;return f.push(Object.freeze({...d})),k.set(p,F),F}function tt(d){return Tp(d,f)}function st(){k=new Map;for(let d=0;d<f.length;d++)k.set(Le(f[d]),d)}function Z(d){f.splice(0,f.length,...d),st()}function O(d){if(!d||!d.top&&!d.right&&!d.bottom&&!d.left)return 0;const p=ue(d),C=N.get(p);if(C!==void 0)return C;const F=E.length;return E.push(Object.freeze({top:d.top?Object.freeze({...d.top}):void 0,right:d.right?Object.freeze({...d.right}):void 0,bottom:d.bottom?Object.freeze({...d.bottom}):void 0,left:d.left?Object.freeze({...d.left}):void 0})),N.set(p,F),F}function L(d){return E[d]??{}}function oe(){N=new Map;for(let d=0;d<E.length;d++)N.set(ue(E[d]),d)}function $e(d){E.splice(0,E.length,...d),oe()}function lt(d,p){return Fp(d,p,f,{get:C=>E[C]??{}})}function ne(d,p){const C=Ct(d,p);return C?C.anchor:null}function xe(d,p,C,F){const A=Ct(d,p),ae=Ct(C,F);return!A||!ae?!1:A.anchor===ae.anchor}const Ne=t.reactive({}),se=new Bf,de=t.ref(null),Be=t.ref("cell"),_e=t.ref({col:0,row:0}),Ge=t.ref(null),ct=t.ref(""),nt=t.ref(new Array(s.colCount).fill(100)),I=t.ref(new Array(s.rowCount).fill(void 0)),H=t.ref(0),$=t.ref(0),V=t.reactive({rows:0,cols:0}),B=t.ref(null),W=t.ref([]),z=t.ref([]),q=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),Ce=new Map;let We=null;function gt(d,p,C,F){const A=`${F} ${C} ${p}px ${d}`,ae=Ce.get(A);if(ae)return ae;if(!We){if(typeof document>"u")return{ascent:p*.88,descent:p*.28};We=document.createElement("canvas")}const fe=We.getContext("2d");if(!fe)return{ascent:p*.88,descent:p*.28};fe.font=A;const we=fe.measureText(" "),Se=we.fontBoundingBoxAscent,Ye=we.fontBoundingBoxDescent;if(typeof Se=="number"&&typeof Ye=="number"&&Se>0&&Ye>0){const en={ascent:Se,descent:Ye};return Ce.set(A,en),en}const Pe=["M","中","y","Ä","0"];let Je=0,et=0;for(const en of Pe){const $n=fe.measureText(en),sn=$n.actualBoundingBoxAscent||0,Cn=$n.actualBoundingBoxDescent||0;sn>Je&&(Je=sn),Cn>et&&(et=Cn)}const pt=Math.max(Je,p*.88),Et=Math.max(et,p*.28),Qt={ascent:pt,descent:Et};return Ce.set(A,Qt),Qt}const Ae=gt(Vo,uo,"normal","normal"),w=Ae.ascent+Ae.descent,X=3,dt=Math.round(X*2+w);let Nt=(d,p)=>`${d},${p}`,Ct=()=>null,$t=()=>uo,xt=t.computed(()=>[0]),Tt=()=>dt,jt=(d,p,C,F)=>({startCol:Math.min(d,C),startRow:Math.min(p,F),endCol:Math.max(d,C),endRow:Math.max(p,F)});function Mn(d,p){const C=tt(R[Nt(d,p)]),F=$t(d,p),A=typeof(C==null?void 0:C.fontFamily)=="string"&&C.fontFamily?C.fontFamily:Vo,ae=(C==null?void 0:C.fontWeight)==="bold"?"bold":"normal",fe=(C==null?void 0:C.fontStyle)==="italic"?"italic":"normal";return gt(A,F,ae,fe)}function oo(d,p,C,F){if(!p)return[""];const A=p.split(`
|
|
2
|
-
`),
|
|
3
|
-
`).length,vn>A&&(A=vn)}}const we=C+F,Se=X*2+A*we;return Math.min(500,Math.max(dt,Math.round(Se)))}Tt=ln;function Un(d){return I.value[d]===void 0}const K={getValue:(d,p)=>gn(d,p),getFormat:(d,p)=>{var C;return(C=tt(R[Nt(d,p)]))==null?void 0:C.numberFormat}},U=t.computed(()=>{const d=new Set,p=B.value;if(!p)return d;const{range:C}=p;for(let F=C.startRow+1;F<=C.endRow;F++)j(F)||d.add(F);return d});function j(d){return Hf(B.value,d,K,i.value)}function ye(){return U.value}function ve(d){return Qe(d)?!0:B.value?U.value.has(d):!1}function Ve(){let d=0;for(let p=0;p<s.rowCount;p++)ve(p)||d++;return d}function Ue(d){let p=-1;for(let C=0;C<s.rowCount;C++)if(!ve(C)&&(p++,p===d))return C;return-1}function ke(d){if(ve(d))return-1;let p=0;for(let C=0;C<d;C++)ve(C)||p++;return p}const He=t.computed(()=>{const d=new Set,p=W.value;for(let C=0;C<p.length;C++){const F=p[C];if(F.collapsed)for(let A=Math.max(0,F.start);A<=F.end&&A<s.rowCount;A++)d.add(A)}return d}),be=t.computed(()=>{const d=new Set,p=z.value;for(let C=0;C<p.length;C++){const F=p[C];if(F.collapsed)for(let A=Math.max(0,F.start);A<=F.end&&A<s.colCount;A++)d.add(A)}return d});function Qe(d){return He.value.has(d)}function v(d){return be.value.has(d)}function P(d){return Qe(d)}function le(d){return v(d)}function Re(d){return!ve(d)}function Ie(d){return!v(d)}function x(d){return v(d)}function m(d){return x(d)?0:nt.value[d]??100}function M(d){return ai(W.value,d)}function it(d){return ai(z.value,d)}function vt(d){const p=d==="row"?W.value:z.value;let C=0;for(let F=0;F<p.length;F++){const A=p[F].level;A>C&&(C=A)}return C}function At(d){return 0}const Dt=()=>At(),rn=()=>At();function hn(){return W.value.map(d=>({...d}))}function Pn(){return z.value.map(d=>({...d}))}function Gt(d=!1){var p,C;d||(Jt(H.value,$.value),(p=S.scheduleRender)==null||p.call(S),(C=S.emitModelData)==null||C.call(S))}function Hl(d,p){var F;const C=Er(W.value,d,p);return!C.ok||C.level===void 0?C:((F=S.saveUndo)==null||F.call(S),W.value=no(ti(W.value,"row",d,p,ii(W.value,"row")).outlines),Gt(),{ok:!0,level:C.level})}function ul(d,p){var F;const C=Er(z.value,d,p);return!C.ok||C.level===void 0?C:((F=S.saveUndo)==null||F.call(S),z.value=no(ti(z.value,"column",d,p,ii(z.value,"column")).outlines),Gt(),{ok:!0,level:C.level})}function Nr(d){var F;const p=W.value.some(A=>A.id===d),C=!p&&z.value.some(A=>A.id===d);return!p&&!C?!1:((F=S.saveUndo)==null||F.call(S),p?W.value=no(oi(W.value,d)):z.value=no(oi(z.value,d)),Gt(),!0)}function Br(){var d;W.value.length&&((d=S.saveUndo)==null||d.call(S),W.value=zl(),Gt())}function xr(){var d;z.value.length&&((d=S.saveUndo)==null||d.call(S),z.value=zl(),Gt())}function Wl(){var d;!W.value.length&&!z.value.length||((d=S.saveUndo)==null||d.call(S),W.value=zl(),z.value=zl(),Gt())}function Io(d,p,C=!1){var ae;const F=ni(W.value,d,p),A=ni(z.value,d,p);F===W.value&&A===z.value||(C||(ae=S.saveUndo)==null||ae.call(S),W.value=F,z.value=A,Gt(C))}function Tr(d){const p=W.value.find(C=>C.id===d)??z.value.find(C=>C.id===d);p&&Io(d,!p.collapsed)}function fl(d,p){W.value.length&&(W.value=no(li(W.value,d,p)),Gt())}function ml(d,p){W.value.length&&(W.value=no(ri(W.value,d,p)),Gt())}function pl(d,p){z.value.length&&(z.value=no(li(z.value,d,p)),Gt())}function hl(d,p){z.value.length&&(z.value=no(ri(z.value,d,p)),Gt())}function Vr(d,p){d&&(W.value=no([...d])),p&&(z.value=no([...p])),Gt(!0)}function Dr(){return B.value}function Ao(d,p=!1){var C,F;B.value=d,!p&&(Jt(H.value,$.value),(C=S.scheduleRender)==null||C.call(S),(F=S.emitModelData)==null||F.call(S))}function No(d){var C,F;const p={range:{startCol:Math.min(d.startCol,d.endCol),endCol:Math.max(d.startCol,d.endCol),startRow:Math.min(d.startRow,d.endRow),endRow:Math.max(d.startRow,d.endRow)},columns:{}};B.value=p,Jt(H.value,$.value),(C=S.scheduleRender)==null||C.call(S),(F=S.emitModelData)==null||F.call(S)}function Lo(){var d,p;B.value&&(B.value=null,Jt(H.value,$.value),(d=S.scheduleRender)==null||d.call(S),(p=S.emitModelData)==null||p.call(S))}function gl(d){var F,A;if(!B.value)return;const{[d]:p,...C}=B.value.columns;B.value={...B.value,columns:C},(F=S.scheduleRender)==null||F.call(S),(A=S.emitModelData)==null||A.call(S)}function jo(d,p){var C,F;if(B.value){if(p)B.value={...B.value,columns:{...B.value.columns,[d]:p}};else{const{[d]:A,...ae}=B.value.columns;B.value={...B.value,columns:ae}}(C=S.scheduleRender)==null||C.call(S),(F=S.emitModelData)==null||F.call(S)}}function bl(d){const p=B.value;return p?Wf(p,d,K,i.value):{values:[],hasBlank:!1}}function go(d,p){const C=s.colCount,F=s.rowCount,A=(Je,et)=>{const pt=R[qt(Je,et)];return!!pt&&(pt.value!==""||pt.styleId!==void 0)};if(!A(d,p))return null;const ae=Je=>{for(let et=0;et<C;et++)if(A(et,Je))return!0;return!1},fe=(Je,et,pt)=>{for(let Et=et;Et<=pt;Et++)if(A(Je,Et))return!0;return!1};let we=p;for(;we>0&&ae(we-1);)we--;let Se=p;for(;Se<F-1&&ae(Se+1);)Se++;let Ye=d;for(;Ye>0&&fe(Ye-1,we,Se);)Ye--;let Pe=d;for(;Pe<C-1&&fe(Pe+1,we,Se);)Pe++;return{startCol:Ye,startRow:we,endCol:Pe,endRow:Se}}function $o(){const d=de.value;if(!!d&&d.startRow!==d.endRow)return{startCol:Math.min(d.startCol,d.endCol),endCol:Math.max(d.startCol,d.endCol),startRow:Math.min(d.startRow,d.endRow),endRow:Math.max(d.startRow,d.endRow)};const C=_e.value,F=d?d.startCol:C.col,A=d?d.startRow:C.row,ae=(Ye,Pe)=>{const Je=R[qt(Ye,Pe)];return!!Je&&(Je.value!==""||Je.styleId!==void 0)};let fe,we;d?(fe=Math.min(d.startCol,d.endCol),we=Math.max(d.startCol,d.endCol)):(fe=C.col,we=C.col);let Se=A;for(;Se<s.rowCount-1;){const Ye=Se+1;let Pe=!1,Je=!1;for(let et=fe;et<=we;et++){ae(et,Ye)&&(Pe=!0);const pt=ao(et,Ye);pt&&(pt.range.startCol!==pt.range.endCol||pt.range.startRow!==pt.range.endRow)&&(Je=!0)}if(Je||!Pe)break;Se++}return!ae(F,A)&&Se===A?Ul():{startCol:fe,endCol:we,startRow:A,endRow:Se}}function Xo(){if(B.value){Lo();return}const d=$o();d&&No(d)}function Fr(d){const p=B.value;return p?d>=p.range.startCol&&d<=p.range.endCol:!1}function Or(){return B.value?{...B.value.range}:null}function Zo(){return!!B.value}function Jo(d){const p=B.value;return p?Oa(p.columns[d]):!1}function Ul(){let d=1/0,p=1/0,C=-1,F=-1;for(const A in R){const ae=A.indexOf(",");if(ae<0)continue;const fe=parseInt(A.substring(0,ae),10),we=parseInt(A.substring(ae+1),10),Se=R[A];Se&&(Se.value!==""||Se.styleId!==void 0)&&(fe<d&&(d=fe),we<p&&(p=we),fe>C&&(C=fe),we>F&&(F=we))}return C<0?null:{startCol:d,startRow:p,endCol:C,endRow:F}}const bo=t.computed(()=>{const d=[0];for(let p=0;p<s.rowCount;p++)d.push(d[p]+Tt(p));return d}),yo=t.computed(()=>Xt.value[s.colCount]),Bn=t.computed(()=>bo.value[s.rowCount]);function qt(d,p){return`${d},${p}`}Nt=qt;function fn(d){Reflect.deleteProperty(R,d)}function xn(d,p){Be.value="cell";const C=Ct(d,p);C?(_e.value={col:C.range.startCol,row:C.range.startRow},de.value={...C.range}):(_e.value={col:d,row:p},de.value={startCol:d,startRow:p,endCol:d,endRow:p})}function lo(d,p,C,F,A="cell"){const ae=Ct(d,p);if(_e.value=ae?{col:ae.range.startCol,row:ae.range.startRow}:{col:d,row:p},Be.value=A,A==="row"||A==="col"){const fe=Math.min(d,C),we=Math.max(d,C),Se=Math.min(p,F),Ye=Math.max(p,F);de.value={startCol:fe,startRow:Se,endCol:we,endRow:Ye}}else de.value=jt(d,p,C,F)}function Bo(){lo(0,0,s.colCount-1,s.rowCount-1,"all")}function Kn(d,p){const C=de.value;return C?(Be.value==="cell"||Be.value==="all",d>=C.startCol&&d<=C.endCol&&p>=C.startRow&&p<=C.endRow):!1}function ro(d,p){return Kn(d,p)}function ao(d,p){for(const C in Ne){const F=Ne[C];if(F&&d>=F.startCol&&d<=F.endCol&&p>=F.startRow&&p<=F.endRow)return{range:F,anchor:C}}return null}Ct=ao;function zo(d,p){return Ne[qt(d,p)]!==void 0}function Qo(d,p){const C=Ct(d,p);if(C&&d===C.range.startCol&&p===C.range.startRow){const F=Xt.value[C.range.endCol+1]-Xt.value[d],A=bo.value[C.range.endRow+1]-bo.value[p];return{w:F,h:A}}return{w:m(d),h:Tt(p)}}function _o(d,p,C,F){let A=Math.min(d,C),ae=Math.max(d,C),fe=Math.min(p,F),we=Math.max(p,F),Se=!0;for(;Se;){Se=!1;for(const Ye in Ne){const Pe=Ne[Ye];if(!Pe)continue;Pe.startCol<=ae&&Pe.endCol>=A&&Pe.startRow<=we&&Pe.endRow>=fe&&(Pe.startCol<A&&(A=Pe.startCol,Se=!0),Pe.endCol>ae&&(ae=Pe.endCol,Se=!0),Pe.startRow<fe&&(fe=Pe.startRow,Se=!0),Pe.endRow>we&&(we=Pe.endRow,Se=!0))}}return{startCol:A,startRow:fe,endCol:ae,endRow:we}}jt=_o;function nn(d,p){var C;return((C=R[qt(d,p)])==null?void 0:C.value)??""}function gn(d,p){return So(),Ta(d,p,R,s.colCount,s.rowCount)}function Ft(d,p,C){var Se,Ye,Pe;d>=0&&p>=0&&ce(d,p);const F=qt(d,p);So(),te.invalidate(),he.length>0&&on();const A=(Se=R[F])==null?void 0:Se.noteId;if(C===""||C==null){se.clear(F);const Je=(Ye=R[F])==null?void 0:Ye.styleId;Je!==void 0&&Je>0?R[F]={value:"",styleId:Je}:fn(F),se.markDirty(F);return}const ae=String(C);if(!ae.startsWith("=")){const Je=tt(R[F]),et=typeof(Je==null?void 0:Je.numberFormat)=="string"?Je.numberFormat:"";if(In(et)){const pt=eo(ae,i.value);if(pt){const Qt={...Je??{},numberFormat:pt.format};R[F]={value:String(pt.serial),styleId:ie(Qt),noteId:A},se.clear(F),se.markDirty(F);return}const Et=Ml(ae,i.value);if(Et){const Qt={...Je??{},numberFormat:Et.format};R[F]={value:String(Et.num),styleId:ie(Qt),noteId:A},se.clear(F),se.markDirty(F);return}}}const fe=(Pe=R[F])==null?void 0:Pe.styleId,we={value:ae};fe!==void 0&&fe>0&&(we.styleId=fe),A&&(we.noteId=A),R[F]=we,ae.startsWith("=")?se.set(F,Tl(ae.slice(1),s.colCount,s.rowCount)):se.clear(F),se.markDirty(F)}function Ot(d,p,C,F){for(let A=d;A<=p;A++)for(let ae=C;ae<=F;ae++){const fe=qt(A,ae);se.clear(fe),fn(fe),se.markDirty(fe)}te.invalidate(),he.length>0&&on(),Ll(R,me)}function an(){return{cells:R,colCount:s.colCount,rowCount:s.rowCount,locale:i.value,getCellValue:(d,p)=>gn(d,p)}}function yl(d,p){return Y.length===0?null:ap(d,p,Y,an(),te)}function Pl(d){var C,F,A;(C=S.saveUndo)==null||C.call(S);const p={id:d.id||ip(),condition:d.condition,format:d.format,ranges:d.ranges,priority:d.priority,stopIfTrue:d.stopIfTrue,enabled:d.enabled!==!1};Y.push(p),te.invalidate(),(F=S.scheduleRender)==null||F.call(S),(A=S.emitModelData)==null||A.call(S)}function Kl(d,p){var F,A,ae;(F=S.saveUndo)==null||F.call(S);const C=Y.findIndex(fe=>fe.id===d);C<0||(Y[C]={...Y[C],...p,id:d},te.invalidate(),(A=S.scheduleRender)==null||A.call(S),(ae=S.emitModelData)==null||ae.call(S))}function bn(d){var C,F,A;(C=S.saveUndo)==null||C.call(S);const p=Y.findIndex(ae=>ae.id===d);p<0||(Y.splice(p,1),te.invalidate(),(F=S.scheduleRender)==null||F.call(S),(A=S.emitModelData)==null||A.call(S))}function io(d,p){var Se,Ye,Pe;(Se=S.saveUndo)==null||Se.call(S);const C=[...Y].sort((Je,et)=>Je.priority-et.priority),F=C.findIndex(Je=>Je.id===d);if(F<0)return;const A=p==="up"?F-1:F+1;if(A<0||A>=C.length)return;const ae=C[F],fe=C[A],we=ae.priority;ae.priority=fe.priority,fe.priority=we,te.invalidate(),(Ye=S.scheduleRender)==null||Ye.call(S),(Pe=S.emitModelData)==null||Pe.call(S)}function Gn(){te.invalidate()}function qn(d){var p,C,F;if((p=S.saveUndo)==null||p.call(S),d==="sheet")Y.splice(0,Y.length);else{const A=S.selection.value;if(!A)return;for(let ae=Y.length-1;ae>=0;ae--){const fe=Y[ae];fe.ranges=fe.ranges.filter(we=>!(we.startCol<=A.endCol&&we.endCol>=A.startCol&&we.startRow<=A.endRow&&we.endRow>=A.startRow)),fe.ranges.length===0&&Y.splice(ae,1)}}te.invalidate(),(C=S.scheduleRender)==null||C.call(S),(F=S.emitModelData)==null||F.call(S)}function on(){Te.invalidate(),pe.clear()}function yn(){return{cells:R,colCount:s.colCount,rowCount:s.rowCount,locale:i.value,getCellValue:(d,p)=>gn(d,p),getSheetCells:d=>S.getSheetCellsById?S.getSheetCellsById(d):null}}function Tn(d,p){const C=Ct(p,d),F=C?{col:C.range.startCol,row:C.range.startRow}:{col:p,row:d};return Te.getRules(F.col,F.row,he)}function Gl(d,p){const C=Tn(d,p);return C.length?C[0]:null}function ql(d,p){return Tn(d,p).length>0}function el(d,p){const C=Ct(p,d),F=C?{col:C.range.startCol,row:C.range.startRow}:{col:p,row:d};return Te.findRule(F.col,F.row,pp,he)}function Ir(d){const p=d.listSource,C=p&&p.type==="range"?`range:${p.sheetId??""}:${p.range.startCol},${p.range.startRow},${p.range.endCol},${p.range.endRow}`:`values:${(p&&p.type==="values"?p.values:d.values??[]).join("")}`,F=pe.get(C);if(F)return F;const A=Xa(d,yn());return pe.set(C,A),A}function Yl(d,p){const C=el(d,p);return C?{rule:C,items:Ir(C)}:null}function Cl(d,p){for(const C of Tn(d,p)){if(C.enabled===!1||!C.showInputMessage)continue;const F=C.inputTitle??"",A=C.inputMessage??"";if(!(!F&&!A))return{title:F,message:A}}return null}function wl(d,p,C){const F=Tn(d,p);return F.length===0?{valid:!0}:Za(C,p,d,F,yn())}function vl(d){const p=yn(),C={stop:3,warning:2,information:1};let F=null,A=0;for(const ae of d){const fe=Tn(ae.row,ae.col);if(fe.length===0)continue;const we=Za(ae.value,ae.col,ae.row,fe,p);if(we.valid)continue;const Se=C[kr(we.rule)]??0;Se>A&&(A=Se,F=we)}return F??{valid:!0}}function Ar(d,p){return qa(d,p,R)}function Lr(d,p){return Y1(d,p,R,me)}function $r(d,p,C,F,A){var fe,we,Se;A!=null&&A.silent||(fe=S.saveUndo)==null||fe.call(S);const ae=X1(d,p,C,F,R,me);return Ll(R,me),(we=S.scheduleRender)==null||we.call(S),(Se=S.emitModelData)==null||Se.call(S),ae}function zr(d,p){var C,F,A;me[d]&&((C=S.saveUndo)==null||C.call(S),Z1(d,p,me),(F=S.scheduleRender)==null||F.call(S),(A=S.emitModelData)==null||A.call(S))}function _r(d,p){var C,F,A;qa(d,p,R)&&((C=S.saveUndo)==null||C.call(S),J1(d,p,R,me),Ll(R,me),(F=S.scheduleRender)==null||F.call(S),(A=S.emitModelData)==null||A.call(S))}function Hr(){Ll(R,me)}function Wr(d){return Q1(d,R,me)}function jl(d,p){var F,A,ae;p!=null&&p.silent||(F=S.saveUndo)==null||F.call(S);const C={...d,id:d.id||Ya(),ranges:(d.ranges??[]).map(fe=>({...fe})),enabled:d.enabled!==!1};return he.push(C),on(),p!=null&&p.silent||((A=S.scheduleRender)==null||A.call(S),(ae=S.emitModelData)==null||ae.call(S)),C}function Ur(d,p,C){var A,ae,fe;const F=he.findIndex(we=>we.id===d);if(F<0){jl({id:d,...p},C);return}C!=null&&C.silent||(A=S.saveUndo)==null||A.call(S),he[F]={...he[F],...p,id:d},on(),C!=null&&C.silent||((ae=S.scheduleRender)==null||ae.call(S),(fe=S.emitModelData)==null||fe.call(S))}function Pr(d,p){var F,A,ae;const C=he.findIndex(fe=>fe.id===d);C<0||(p!=null&&p.silent||(F=S.saveUndo)==null||F.call(S),he.splice(C,1),on(),p!=null&&p.silent||((A=S.scheduleRender)==null||A.call(S),(ae=S.emitModelData)==null||ae.call(S)))}function kl(d,p){var A,ae,fe,we,Se,Ye;if(!d){if(he.length===0)return;p!=null&&p.silent||(A=S.saveUndo)==null||A.call(S),he.splice(0,he.length),on(),p!=null&&p.silent||((ae=S.scheduleRender)==null||ae.call(S),(fe=S.emitModelData)==null||fe.call(S));return}const C={startCol:Math.min(d.startCol,d.endCol),endCol:Math.max(d.startCol,d.endCol),startRow:Math.min(d.startRow,d.endRow),endRow:Math.max(d.startRow,d.endRow)};if(he.filter(Pe=>(Pe.ranges??[]).some(Je=>!(Je.endCol<C.startCol||Je.startCol>C.endCol||Je.endRow<C.startRow||Je.startRow>C.endRow))).length!==0){p!=null&&p.silent||(we=S.saveUndo)==null||we.call(S);for(let Pe=he.length-1;Pe>=0;Pe--){const Je=he[Pe],et=[];for(const pt of Je.ranges??[])et.push(...Qa(pt,C));et.length===0?he.splice(Pe,1):Je.ranges=et}on(),p!=null&&p.silent||((Se=S.scheduleRender)==null||Se.call(S),(Ye=S.emitModelData)==null||Ye.call(S))}}function Xl(d){const p=[];for(const C of he)for(const F of C.ranges??[]){const A=ei(F,d);A&&p.push({rule:C,range:A})}return p}function Zl(d,p,C){var F,A,ae;if(d.length){C!=null&&C.silent||(F=S.saveUndo)==null||F.call(S);for(let fe=he.length-1;fe>=0;fe--){const we=he[fe],Se=[];for(const Ye of we.ranges??[])Se.push(...Qa(Ye,p));Se.length===0?he.splice(fe,1):we.ranges=Se}for(const fe of d){const we=[];for(const Se of fe.ranges??[]){const Ye=ei(Se,p);Ye&&we.push(Ye)}we.length&&he.push({...fe,id:Ya(),ranges:we})}on(),C!=null&&C.silent||((A=S.scheduleRender)==null||A.call(S),(ae=S.emitModelData)==null||ae.call(S))}}async function Ho(d,p,C){const F=d.severity??"stop";if(!(!d.rule||d.rule.showErrorMessage!==!1))return F==="stop"?"cancel":"continue";const ae=S.showValidationAlert;if(!ae)return F==="stop"?"cancel":"continue";Ee++;try{return await ae({severity:F,title:d.title??"",message:d.message??"",col:p,row:C})}catch{return"cancel"}finally{Ee=Math.max(0,Ee-1)}}function El(){return Ee>0}let Jl=()=>{};function Kr(d){Ge.value||(Ge.value={..._e.value},d!==void 0?ct.value=d:ct.value||(ct.value=nn(_e.value.col,_e.value.row)))}async function Gr(){const d=Ge.value;if(!d)return!1;const p=d.col,C=d.row,F=ct.value,A=wl(C,p,F);return!A.valid&&await Ho(A,p,C)!=="continue"?!1:(Jl(),Ft(p,C,F),Ge.value=null,ct.value="",!0)}function qr(){Ge.value=null,ct.value=""}function Yr(d,p){const C=_e.value;let F=Math.max(0,C.col+d),A=Math.max(0,C.row+p);(F>=s.colCount||A>=s.rowCount)&&ce(F,A);const ae=Ct(C.col,C.row),fe=Ct(F,A);ae&&fe&&ae.anchor===fe.anchor&&(d>0?F=ae.range.endCol+1:d<0&&(F=ae.range.startCol-1),p>0?A=ae.range.endRow+1:p<0&&(A=ae.range.startRow-1),(F>=s.colCount||A>=s.rowCount)&&ce(F,A)),F=Math.max(0,Math.min(s.colCount-1,F)),A=Math.max(0,Math.min(s.rowCount-1,A)),xn(F,A)}function jr(d,p){ee(p,d)}function mn(d){const p=Xt.value;if(d<0||d>=p[s.colCount])return-1;let C=0,F=s.colCount-1;for(;C<F;){const A=C+F+1>>1;p[A]<=d?C=A:F=A-1}return C}function xo(d){const p=bo.value;if(d<0||d>=p[s.rowCount])return-1;let C=0,F=s.rowCount-1;for(;C<F;){const A=C+F+1>>1;p[A]<=d?C=A:F=A-1}return C}function Xr(d,p){var A,ae;const C=Math.max(0,Math.min(Math.floor(d),s.rowCount)),F=Math.max(0,Math.min(Math.floor(p),s.colCount));V.rows=C,V.cols=F,(A=S.scheduleRender)==null||A.call(S),(ae=S.emitModelData)==null||ae.call(S)}function u(){var d,p;V.rows=0,V.cols=0,(d=S.scheduleRender)==null||d.call(S),(p=S.emitModelData)==null||p.call(S)}function b(){return{rows:V.rows,cols:V.cols}}function T(){let d=0,p=0;if(V.cols>0){const C=nt.value,F=Math.min(V.cols,C.length);for(let A=0;A<F;A++)d+=C[A]}if(V.rows>0)for(let C=0;C<V.rows;C++)p+=Tt(C);return{frozenRowsHeight:p,frozenColumnsWidth:d}}function J(){const{frozenColumnsWidth:d,frozenRowsHeight:p}=T(),C=Dt(),F=rn(),A=52+C+d,ae=24+F+p,fe=Math.max(0,tn.w-52-C-11-d),we=Math.max(0,tn.h-24-F-11-p),Se=[];return p>0&&d>0&&Se.push({kind:"corner",x:52+C,y:24+F,width:d,height:p,scrollLeft:0,scrollTop:0}),p>0&&Se.push({kind:"rows",x:A,y:24+F,width:fe,height:p,scrollLeft:H.value,scrollTop:0}),d>0&&Se.push({kind:"columns",x:52+C,y:ae,width:d,height:we,scrollLeft:0,scrollTop:$.value}),Se.push({kind:"body",x:A,y:ae,width:fe,height:we,scrollLeft:H.value,scrollTop:$.value}),Se}function D(d,p){const C=Xt.value,F=bo.value,A=C[p]??0,ae=F[d]??0,fe=Ct(p,d),we=fe?(C[fe.range.endCol+1]??A)-A:(C[p+1]??A)-A,Se=fe?(F[fe.range.endRow+1]??ae)-ae:Tt(d),Ye=p<V.cols,Pe=d<V.rows,Je=(Ye?0:-H.value)+52+Dt()+A,et=(Pe?0:-$.value)+24+rn()+ae;return{x:Je,y:et,width:we,height:Se}}function G(d,p){const{frozenColumnsWidth:C,frozenRowsHeight:F}=T(),A=Dt(),ae=rn();if(d<52+A||p<24+ae)return null;const fe=C>0&&d<52+A+C,we=F>0&&p<24+ae+F,Se=fe?d-52-A:d-52-A+H.value,Ye=we?p-24-ae:p-24-ae+$.value,Pe=mn(Se),Je=xo(Ye);return Pe<0||Je<0?null:{col:Pe,row:Je}}function Q(d,p){return d<V.rows||p<V.cols}function ee(d,p){if(Q(d,p))return;const{frozenColumnsWidth:C,frozenRowsHeight:F}=T(),A=Math.max(0,tn.w-52-Dt()-11-C),ae=Math.max(0,tn.h-24-rn()-11-F),fe=Xt.value,we=bo.value,Se=(fe[p]??0)-C,Ye=(we[d]??0)-F,Pe=Ct(p,d),Je=Pe?(fe[Pe.range.endCol+1]??0)-(fe[p]??0):nt.value[p]??0,et=Pe?(we[Pe.range.endRow+1]??0)-(we[d]??0):Tt(d);let pt=H.value,Et=$.value;Se<pt?pt=Se:Se+Je>pt+A&&(pt=Se+Je-A),Ye<Et?Et=Ye:Ye+et>Et+ae&&(Et=Ye+et-ae),pt=Math.max(0,pt),Et=Math.max(0,Et),Jt(pt,Et)}function ce(d,p){var ae;const C=d+1,F=p+1;let A=!1;if(C>=s.colCount){const fe=Math.max(s.colCount+y,C),we=fe-s.colCount,Se=nt.value;for(let Ye=0;Ye<we;Ye++)Se.push(100);s.colCount=fe,A=!0}if(F>=s.rowCount){const fe=Math.max(s.rowCount+h,F),we=fe-s.rowCount,Se=I.value;for(let Ye=0;Ye<we;Ye++)Se.push(void 0);s.rowCount=fe,A=!0}A&&((ae=S.scheduleRender)==null||ae.call(S))}function re(){return s.colCount!==r||s.rowCount!==c}function ze(d,p,C){const F=gr(d,p,Ne);if(!F.ok){F.reason==="target-merge-size"&&window.alert(g(i.value,"autofillMergeSizeError"));return}const A=Ka(d,p,{cells:R},C,i.value,s.colCount,s.rowCount,yt),ae=Object.entries(A.cells).map(([we,Se])=>{const Ye=we.indexOf(",");return{col:parseInt(we.substring(0,Ye),10),row:parseInt(we.substring(Ye+1),10),value:Se?Se.value:""}}),fe=vl(ae);if(!fe.valid){(async()=>await Ho(fe,p.startCol,p.startRow)==="continue"&&Fe(d,p,C))();return}Fe(d,p,C)}function Fe(d,p,C){var ae,fe,we;(ae=S.saveUndo)==null||ae.call(S),ce(p.endCol,p.endRow);const F=Ka(d,p,{cells:R},C,i.value,s.colCount,s.rowCount,yt);So();for(const[Se,Ye]of Object.entries(F.cells)){const Pe=Se.indexOf(","),Je=parseInt(Se.substring(0,Pe),10),et=parseInt(Se.substring(Pe+1),10),pt=ao(Je,et);if(pt&&!(Je===pt.range.startCol&&et===pt.range.startRow))continue;const Et=Ye.value;Et===""&&(Ye.styleId===void 0||Ye.styleId===0)?(se.clear(Se),fn(Se)):(R[Se]={value:Et,...Ye.styleId!==void 0&&Ye.styleId>0?{styleId:Ye.styleId}:{}},Et.startsWith("=")?se.set(Se,Tl(Et.slice(1),s.colCount,s.rowCount)):se.clear(Se)),se.markDirty(Se)}const A={startCol:Math.min(d.startCol,p.startCol),startRow:Math.min(d.startRow,p.startRow),endCol:Math.max(d.endCol,p.endCol),endRow:Math.max(d.endRow,p.endRow)};lo(A.startCol,A.startRow,A.endCol,A.endRow),(fe=S.scheduleRender)==null||fe.call(S),(we=S.emitModelData)==null||we.call(S)}function ot(d,p){var ae;let C=!1;const F=Math.max(1,Math.floor(d)),A=Math.max(1,Math.floor(p));if(F!==s.colCount){if(F>s.colCount){const fe=nt.value;for(let we=s.colCount;we<F;we++)fe.push(100)}else nt.value=nt.value.slice(0,F);s.colCount=F,C=!0}if(A!==s.rowCount){if(A>s.rowCount){const fe=I.value;for(let we=s.rowCount;we<A;we++)fe.push(void 0)}else I.value=I.value.slice(0,A);s.rowCount=A,C=!0}C&&((ae=S.scheduleRender)==null||ae.call(S))}const S={props:a,locale:i,get colCount(){return s.colCount},get rowCount(){return s.rowCount},ensureCapacity:ce,hasDynamicDims:re,setDims:ot,cells:R,styles:f,borders:E,merges:Ne,formulaDeps:se,selection:de,activeCell:_e,editingCell:Ge,editValue:ct,colWidths:nt,rowHeights:I,scrollX:H,scrollY:$,freeze:V,setFreeze:Xr,clearFreeze:u,getFreeze:b,getFrozenMetrics:T,filter:B,getFilter:Dr,setFilter:Ao,enableFilter:No,clearFilter:Lo,clearFilterColumn:gl,setFilterColumn:jo,getColumnCandidates:bl,getDataRange:Ul,getCurrentRegion:go,detectFilterRange:$o,toggleAutoFilter:Xo,isColumnInFilterRange:Fr,getFilterRange:Or,isFilterEnabled:Zo,isFilterColumnActive:Jo,isRowHidden:ve,getFilteredOutRows:ye,getVisibleRowCount:Ve,getVisibleRowAt:Ue,getVisibleRowIndex:ke,getViewportRegions:J,cellToScreenRect:D,screenToCell:G,isCellFrozen:Q,scrollCellIntoView:ee,BASE_CELL_VPAD:X,AUTO_ROW_BASE:dt,fontMetricsCache:Ce,fontMetricsCanvas:We,measureFontMetrics:gt,_getFontMetricsForCell:Mn,getWrappedLines:oo,cellFontSize:Nn,colPositions:Xt,getRowHeight:ln,_isAutoRow:Un,rowPositions:bo,totalWidth:yo,totalHeight:Bn,selectCell:xn,selectRange:lo,selectAll:Bo,isSelected:Kn,isCellSelected:ro,selectionMode:Be,cellKey:qt,delCell:fn,findMerge:ao,_isMergeAnchor:zo,_mergedSpan:Qo,expandSelectionForMerges:_o,getCellRaw:nn,getCellValue:gn,setCellValue:Ft,clearCellsInRange:Ot,startEdit:Kr,commitEdit:Gr,cancelEdit:qr,moveActive:Yr,ensureVisible:jr,hitCol:mn,hitRow:xo,registerStyle:ie,resolveStyle:tt,rebuildStyleIndex:st,syncStyles:Z,registerBorder:O,resolveBorder:L,rebuildBorderIndex:oe,syncBorders:$e,getCellBorderSide:lt,getMergeOwner:ne,isSameMergeInternal:xe,getRowOutlines:hn,getColumnOutlines:Pn,addRowGroup:Hl,addColumnGroup:ul,removeOutline:Nr,clearRowGroups:Br,clearColumnGroups:xr,clearAllOutlines:Wl,setOutlineCollapsed:Io,toggleOutline:Tr,getOutlineLevel:vt,getOutlineGutterSize:At,getRowOutlineLevel:M,getColumnOutlineLevel:it,isRowCollapsed:P,isColumnCollapsed:le,isRowVisible:Re,isColumnVisible:Ie,isColHidden:x,getColWidth:m,adjustOutlinesForInsertRows:fl,adjustOutlinesForDeleteRows:ml,adjustOutlinesForInsertCols:pl,adjustOutlinesForDeleteCols:hl,syncOutlines:Vr,viewSize:tn,findHighlight:(d,p)=>null,autoFillState:q,applyAutoFill:ze,conditionalFormats:Y,resolveConditionalFormat:yl,addConditionalFormatRule:Pl,updateConditionalFormatRule:Kl,removeConditionalFormatRule:bn,moveConditionalFormatRule:io,clearConditionalFormats:qn,invalidateConditionalFormatCache:Gn,dataValidations:he,getDataValidationRules:Tn,getDataValidationRule:Gl,hasDataValidation:ql,getListValidation:el,getValidationDropdown:Yl,getValidationInputMessage:Cl,validateCell:wl,validateCells:vl,createDataValidation:jl,updateDataValidation:Ur,removeDataValidation:Pr,clearDataValidation:kl,getDataValidationsInRange:Xl,applyDataValidationsToRange:Zl,invalidateDataValidationCache:on,isValidationAlertOpen:El,confirmInvalidValue:Ho,notes:me,hasNote:Ar,getNote:Lr,setCellNote:$r,updateCellNote:zr,deleteCellNote:_r,gcNotes:Hr,getNotesInRange:Wr};return Jl=()=>{var d;return(d=S.saveUndo)==null?void 0:d.call(S)},Jt=(d,p)=>{var C;return(C=S.clampScroll)==null?void 0:C.call(S,d,p)},S}function Ap(e,l){const n=t.ref([]),o=t.ref([]);function a(v){return Vp(v)}function i(){return l.saveSheet(),{sheets:l.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(le=>({...le}))})):[],dataValidations:v.dataValidations?v.dataValidations.map(P=>({...P,ranges:(P.ranges??[]).map(le=>({...le}))})):[],rowOutlines:v.rowOutlines?v.rowOutlines.map(P=>({...P})):[],columnOutlines:v.columnOutlines?v.columnOutlines.map(P=>({...P})):[],notes:v.notes?Object.fromEntries(Object.entries(v.notes).map(([P,le])=>[P,{...le}])):{}})),styles:[...e.styles],activeSheetIndex:l.activeSheetIndex.value}}function r(v){const P=l.sheets.value;l.sheets.value=v.sheets.map((le,Re)=>{var x;const Ie=((x=P[Re])==null?void 0:x.freeze)??{rows:0,cols:0};return{...le,cells:a(le.cells),styles:[...le.styles],borders:le.borders?[...le.borders]:[{}],freeze:{rows:Ie.rows,cols:Ie.cols}}}),l.loadSheet(Math.max(0,Math.min(v.activeSheetIndex,l.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function c(){const v=i(),P=n.value[n.value.length-1];P&&JSON.stringify(P)===JSON.stringify(v)||(n.value.push(v),o.value=[],n.value.length>50&&n.value.shift())}e.saveUndo=c;function s(){var v,P,le;n.value.length&&(o.value.push(i()),r(n.value.pop()),(v=e.invalidateConditionalFormatCache)==null||v.call(e),(P=e.invalidateDataValidationCache)==null||P.call(e),(le=e.scheduleRender)==null||le.call(e),t.nextTick(()=>{var Re;return(Re=e.emitModelData)==null?void 0:Re.call(e)}))}function y(){var v,P,le;o.value.length&&(n.value.push(i()),r(o.value.pop()),(v=e.invalidateConditionalFormatCache)==null||v.call(e),(P=e.invalidateDataValidationCache)==null||P.call(e),(le=e.scheduleRender)==null||le.call(e),t.nextTick(()=>{var Re;return(Re=e.emitModelData)==null?void 0:Re.call(e)}))}const h=t.computed(()=>n.value.length>0),R=t.computed(()=>o.value.length>0),f=t.computed(()=>!!e.selection.value),E=t.ref(null);function k(){var le;const v=e.selection.value;if(!v)return;const P={};for(let Re=v.startCol;Re<=v.endCol;Re++)for(let Ie=v.startRow;Ie<=v.endRow;Ie++)P[`${Re-v.startCol},${Ie-v.startRow}`]=((le=e.cells[e.cellKey(Re,Ie)])==null?void 0:le.styleId)??0;E.value={styles:P}}function N(){var le,Re,Ie;const v=E.value,P=e.selection.value;if(!(!v||!P)){c();for(let x=P.startCol;x<=P.endCol;x++)for(let m=P.startRow;m<=P.endRow;m++){const M=e.findMerge(x,m);if(M&&(x!==M.range.startCol||m!==M.range.startRow))continue;const it=v.styles[`${x-P.startCol},${m-P.startRow}`]??0,vt=e.cellKey(x,m),At=((le=e.cells[vt])==null?void 0:le.value)??"";if(At===""&&it===0)e.delCell(vt);else{const Dt={value:At};it>0&&(Dt.styleId=it),e.cells[vt]=Dt}}E.value=null,(Re=e.scheduleRender)==null||Re.call(e),(Ie=e.emitModelData)==null||Ie.call(e)}}function Y(){var P,le,Re;const v=e.selection.value;if(v){c();for(let Ie=v.startCol;Ie<=v.endCol;Ie++)for(let x=v.startRow;x<=v.endRow;x++){const m=e.findMerge(Ie,x);if(m&&(Ie!==m.range.startCol||x!==m.range.startRow))continue;const M=e.cellKey(Ie,x),it=((P=e.cells[M])==null?void 0:P.value)??"";it===""?e.delCell(M):e.cells[M]={value:it}}(le=e.scheduleRender)==null||le.call(e),(Re=e.emitModelData)==null||Re.call(e)}}const te=t.computed(()=>Ti.map(v=>({...v,label:v.value===""?g(e.locale.value,"fontDefault"):v.label}))),me=t.computed(()=>Vi.map(v=>({...v,label:String(v.value)}))),he="\0",Te=t.computed(()=>{const v=e.selection.value;if(!v)return"";let P,le=!1;for(let Re=v.startCol;Re<=v.endCol&&!le;Re++)for(let Ie=v.startRow;Ie<=v.endRow&&!le;Ie++){const x=e.findMerge(Re,Ie);if(x&&(Re!==x.range.startCol||Ie!==x.range.startRow))continue;const m=e.resolveStyle(e.cells[e.cellKey(Re,Ie)]),M=typeof(m==null?void 0:m.fontFamily)=="string"?m.fontFamily:"";P===void 0?P=M:M!==P&&(le=!0)}return le?he:P??""}),pe=t.computed(()=>{const v=e.selection.value;if(!v)return uo;let P,le=!1;for(let Re=v.startCol;Re<=v.endCol&&!le;Re++)for(let Ie=v.startRow;Ie<=v.endRow&&!le;Ie++){const x=e.findMerge(Re,Ie);if(x&&(Re!==x.range.startCol||Ie!==x.range.startRow))continue;const m=e.cellFontSize(Re,Ie);P===void 0?P=m:m!==P&&(le=!0)}return le?0:P??uo});function Ee(v,P){var Re,Ie,x;const le=e.selection.value;if(le){c();for(let m=le.startCol;m<=le.endCol;m++)for(let M=le.startRow;M<=le.endRow;M++){const it=e.findMerge(m,M);if(it&&(m!==it.range.startCol||M!==it.range.startRow))continue;const vt=e.cellKey(m,M),At=((Re=e.cells[vt])==null?void 0:Re.value)??"";let rn={...e.resolveStyle(e.cells[vt])??{}};if(P===""||P===null||P===void 0||P===0){const{[v]:Pn,...Gt}=rn;rn=Gt}else rn[v]=P;const hn=Object.keys(rn).length?e.registerStyle(rn):0;if(At===""&&hn===0)e.delCell(vt);else{const Pn={value:At};hn>0&&(Pn.styleId=hn),e.cells[vt]=Pn}}(Ie=e.scheduleRender)==null||Ie.call(e),(x=e.emitModelData)==null||x.call(e)}}function Le(v){Ee("fontFamily",v===""?"":v)}const ue=t.ref(!1),ie=t.ref(!1),tt=t.ref(!1),st=t.ref(!1),Z=t.ref(!1);function O(v){Ee("fontSize",v),ue.value=!1}const L=t.computed(()=>$i.map(v=>({label:g(e.locale.value,v.labelKey),value:v.value,icon:v.icon}))),oe=t.computed(()=>zi.map(v=>({label:g(e.locale.value,v.labelKey),value:v.value,icon:v.icon}))),$e=t.computed(()=>{const v=e.selection.value;if(!v)return"left";const P=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]),le=typeof(P==null?void 0:P.textAlign)=="string"?P.textAlign:"";return le==="center"||le==="right"?le:"left"}),lt=t.computed(()=>{const v=e.selection.value;if(!v)return"top";const P=e.resolveStyle(e.cells[e.cellKey(v.startCol,v.startRow)]),le=typeof(P==null?void 0:P.verticalAlign)=="string"?P.verticalAlign:"";return le==="middle"||le==="bottom"?le:"top"}),ne=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 xe(v){Ee("textAlign",v)}function Ne(v){Ee("verticalAlign",v)}function se(){if(!e.selection.value)return;const P=ne.value;Ee("wrap",P?void 0:"wrap")}const de=t.ref(""),Be=ue;t.watch(pe,v=>{de.value=v===0?"":String(v)},{immediate:!0});function _e(v){const P=v.replace(/[^\d]/g,"");de.value=P;const le=parseInt(P,10);!isNaN(le)&&le>=5&&le<=72&&le!==pe.value&&Ee("fontSize",le)}function Ge(){const v=de.value.trim();if(!v){de.value=pe.value===0?"":String(pe.value);return}let P=parseInt(v,10);isNaN(P)?P=pe.value===0?uo:pe.value:P=Math.max(5,Math.min(72,P)),de.value=String(P),P!==pe.value&&Ee("fontSize",P)}function ct(v){v.key==="Enter"&&v.target.blur()}function nt(v){v&&v.preventDefault(),Be.value=!Be.value,Be.value&&(tt&&(tt.value=!1),ie&&(ie.value=!1),st.value=!1,Z.value=!1)}function I(){const v=pe.value===0?uo:pe.value,P=Math.min(72,v+1);Ee("fontSize",P),de.value=String(P),Be.value=!1}function H(){const v=pe.value===0?uo:pe.value,P=Math.max(5,v-1);Ee("fontSize",P),de.value=String(P),Be.value=!1}function $(v){const P=e.selection.value;if(!P)return!1;let le,Re=!1;for(let Ie=P.startCol;Ie<=P.endCol&&!Re;Ie++)for(let x=P.startRow;x<=P.endRow&&!Re;x++){const m=e.findMerge(Ie,x);if(m&&(Ie!==m.range.startCol||x!==m.range.startRow))continue;const M=e.resolveStyle(e.cells[e.cellKey(Ie,x)]),it=!!(M!=null&&M[v]);le===void 0?le=it:it!==le&&(Re=!0)}return!Re&&le===!0}const V=t.computed(()=>$("fontWeight")),B=t.computed(()=>$("fontStyle")),W=t.computed(()=>$("underline")),z=t.computed(()=>$("strikethrough"));function q(){Ee("fontWeight",V.value?"":"bold")}function Ce(){Ee("fontStyle",B.value?"":"italic")}function We(){Ee("underline",W.value?"":"underline")}function gt(){Ee("strikethrough",z.value?"":"line-through")}const Ae=t.ref(""),w=t.ref(""),X=st,dt=Z;function Nt(){X.value=!X.value,dt.value=!1,ie&&(ie.value=!1),tt&&(tt.value=!1)}function Ct(){dt.value=!dt.value,X.value=!1,ie&&(ie.value=!1),tt&&(tt.value=!1)}function $t(v){ie&&(ie.value=v),v&&(X.value=!1,dt.value=!1,tt&&(tt.value=!1))}function xt(v){Ae.value=v,Ee("color",v===""?"":v)}function Tt(v){w.value=v,Ee("backgroundColor",v===""?"":v)}function jt(){Ee("color",Ae.value===""?"":Ae.value)}function Mn(){Ee("backgroundColor",w.value===""?"":w.value)}const oo=t.computed(()=>{const v=e.selection.value;if(!v)return"";let P,le=!1;for(let Re=v.startCol;Re<=v.endCol&&!le;Re++)for(let Ie=v.startRow;Ie<=v.endRow&&!le;Ie++){const x=e.findMerge(Re,Ie);if(x&&(Re!==x.range.startCol||Ie!==x.range.startRow))continue;const m=e.resolveStyle(e.cells[e.cellKey(Re,Ie)]),M=typeof(m==null?void 0:m.color)=="string"?m.color:"";P===void 0?P=M:M!==P&&(le=!0)}return le?"":P??""}),Nn=t.computed(()=>{const v=e.selection.value;if(!v)return"";let P,le=!1;for(let Re=v.startCol;Re<=v.endCol&&!le;Re++)for(let Ie=v.startRow;Ie<=v.endRow&&!le;Ie++){const x=e.findMerge(Re,Ie);if(x&&(Re!==x.range.startCol||Ie!==x.range.startRow))continue;const m=e.resolveStyle(e.cells[e.cellKey(Re,Ie)]),M=typeof(m==null?void 0:m.backgroundColor)=="string"?m.backgroundColor:"";P===void 0?P=M:M!==P&&(le=!0)}return le?"":P??""}),Xt=t.computed(()=>da(e.locale.value)),tn=t.ref(!1),Jt=t.computed(()=>{const v=e.selection.value;if(!v)return mo;let P,le=!1;for(let Re=v.startCol;Re<=v.endCol&&!le;Re++)for(let Ie=v.startRow;Ie<=v.endRow&&!le;Ie++){const x=e.findMerge(Re,Ie);if(x&&(Re!==x.range.startCol||Ie!==x.range.startRow))continue;const m=e.resolveStyle(e.cells[e.cellKey(Re,Ie)]),M=(m==null?void 0:m.numberFormatCategory)==="custom"?fo:typeof(m==null?void 0:m.numberFormat)=="string"?m.numberFormat:"";P===void 0?P=M:M!==P&&(le=!0)}return le?Qn:P??mo});function Ln(v){if((v==null?void 0:v.numberFormatCategory)==="custom")return fo;const P=typeof(v==null?void 0:v.numberFormat)=="string"?v.numberFormat:"";return ca(P,e.locale.value)}const ln=t.computed(()=>{const v=Jt.value;if(v!==Qn)return v===fo?fo:ca(v,e.locale.value);const P=e.selection.value;if(!P)return mo;let le,Re=!1;for(let Ie=P.startCol;Ie<=P.endCol&&!Re;Ie++)for(let x=P.startRow;x<=P.endRow&&!Re;x++){const m=e.findMerge(Ie,x);if(m&&(Ie!==m.range.startCol||x!==m.range.startRow))continue;const M=Ln(e.resolveStyle(e.cells[e.cellKey(Ie,x)]));le===void 0?le=M:M!==le&&(Re=!0)}return Re?Qn:le??mo});function Un(v){Ee("numberFormat",v),K()}function K(){const v=e.selection.value;if(v)for(let P=v.startCol;P<=v.endCol;P++)for(let le=v.startRow;le<=v.endRow;le++){const Re=e.findMerge(P,le);if(Re&&(P!==Re.range.startCol||le!==Re.range.startRow))continue;const Ie=e.cellKey(P,le),x=e.cells[Ie],m=e.resolveStyle(x);if((m==null?void 0:m.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:M,...it}=m,vt=Object.keys(it).length?e.registerStyle(it):0,At=(x==null?void 0:x.value)??"";if(At===""&&vt===0)e.delCell(Ie);else{const Dt={value:At};vt>0&&(Dt.styleId=vt),e.cells[Ie]=Dt}}}function U(v){if(v===fo){tn.value=!0;return}Un(v)}function j(){tn.value=!0}function ye(){const v=e.selection.value;if(!v)return[];const P=[];for(let le=v.startCol;le<=v.endCol;le++)for(let Re=v.startRow;Re<=v.endRow;Re++){const Ie=e.findMerge(le,Re);if(Ie&&(le!==Ie.range.startCol||Re!==Ie.range.startRow))continue;const x=e.cellKey(le,Re),m=e.cells[x],M=e.resolveStyle(m),it=typeof(M==null?void 0:M.numberFormat)=="string"?M.numberFormat:mo,vt=(m==null?void 0:m.value)??"",At=vt.startsWith("=")?Ta(le,Re,e.cells,e.colCount,e.rowCount):vt;sa(it,At)&&P.push({key:x,nf:it,decimals:ls(it,At)})}return P}const ve=t.computed(()=>ye().some(v=>v.decimals<ir)),Ve=t.computed(()=>ye().some(v=>v.decimals>sr));function Ue(v,P,le){var M;const Re=((M=e.cells[v])==null?void 0:M.value)??"",x={...e.resolveStyle(e.cells[v])??{}};P===""?(delete x.numberFormat,delete x.numberFormatCategory):(x.numberFormat=P,le==="custom"&&(x.numberFormatCategory="custom"));const m=Object.keys(x).length?e.registerStyle(x):0;if(Re===""&&m===0)e.delCell(v);else{const it={value:Re};m>0&&(it.styleId=m),e.cells[v]=it}}function ke(v){var Re,Ie;const P=ye(),le=[];for(const x of P){const m=x.decimals+v;if(m<sr||m>ir)continue;const M=as(x.nf,m);M==null||M===x.nf||le.push({key:x.key,code:M,category:In(x.nf)?"custom":void 0})}if(le.length){c();for(const x of le)Ue(x.key,x.code,x.category);(Re=e.scheduleRender)==null||Re.call(e),(Ie=e.emitModelData)==null||Ie.call(e)}}function He(){ke(1)}function be(){ke(-1)}return{undoStack:n,redoStack:o,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:c,undo:s,redo:y,canUndo:h,canRedo:R,hasSelection:f,paintFmt:E,onPaintFormat:k,applyPaintFormat:N,clearFormat:Y,fontFamilyOptions:te,fontSizeOptions:me,FONT_FAMILY_MIXED:he,selFontFamily:Te,selFontSize:pe,applyStyleToSelection:Ee,onFontFamilyChange:Le,onFontSizeChange:O,hAlignOptions:L,vAlignOptions:oe,selHAlign:$e,selVAlign:lt,selWrap:ne,onHAlignChange:xe,onVAlignChange:Ne,onWrapToggle:se,fontSizeInput:de,fontSizeMenuOpen:Be,onFontSizeInput:_e,onFontSizeBlur:Ge,onFontSizeKeydown:ct,toggleFontSizeMenu:nt,onFontSizeStepUp:I,onFontSizeStepDown:H,selFontWeight:V,selFontStyle:B,selUnderline:W,selStrikethrough:z,toggleFontWeight:q,toggleFontStyle:Ce,toggleUnderline:We,toggleStrikethrough:gt,cachedTextColor:Ae,cachedFillColor:w,textColorMenuOpen:X,fillColorMenuOpen:dt,_toggleTextColorMenu:Nt,_toggleFillColorMenu:Ct,onBorderMenuToggle:$t,onTextColorChange:xt,onFillColorChange:Tt,applyCachedTextColor:jt,applyCachedFillColor:Mn,selTextColor:oo,selFillColor:Nn,nfOptions:Xt,selNumberFormat:Jt,selNumberFormatDisplay:ln,NF_NUMBER_FORMAT_MIXED:Qn,nfDialogOpen:tn,onNumberFormatChange:U,openNumberFormatDialog:j,applyNumberFormatCode:Un,canIncreaseDecimals:ve,canDecreaseDecimals:Ve,onIncreaseDecimals:He,onDecreaseDecimals:be}}function Lp(e,l){l.borderMenuOpen&&(e.borderMenuOpen=l.borderMenuOpen),l.mergeMenuOpen&&(e.mergeMenuOpen=l.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)}})()}const di="#444",ui="#aaaaaa";function fi(e){return e==="dark"?ui:di}const Rr=["top","right","bottom","left"];function cl(e){if(typeof e!="string")return;const l=e.trim();return l===""?void 0:l}function mi(e,l){const n=cl(e),o=cl(l);return n===void 0||o===void 0?n===o:n.toLowerCase()===o.toLowerCase()}function _l(e){return!!e&&typeof e.width=="number"&&e.width>0}function $p(e,l){const n={...e},o=cl(l);return o===void 0?delete n.color:n.color=o,n}function zp(e,l){const n={...e};return l==="solid"?delete n.style:n.style=l,n}function pi(e,l,n,o){const a=e?{...e}:{};a.width=l;const i=cl(n);return i===void 0?delete a.color:a.color=i,o!==void 0&&(o==="solid"?delete a.style:a.style=o),a}function dl(e,l,n){const o=Math.min(l.startCol,l.endCol),a=Math.max(l.startCol,l.endCol),i=Math.min(l.startRow,l.endRow),r=Math.max(l.startRow,l.endRow);if(a<o||r<i||e==="none")return;if(e==="all"){for(let y=o;y<=a;y++)for(let h=i;h<=r;h++)for(const R of Rr)n({col:y,row:h,side:R});return}if(e==="outer"||e==="thickOuter"){for(let y=o;y<=a;y++)n({col:y,row:i,side:"top"}),n({col:y,row:r,side:"bottom"});for(let y=i;y<=r;y++)n({col:o,row:y,side:"left"}),n({col:a,row:y,side:"right"});return}const s={bottom:{side:"bottom",isEdge:(y,h)=>h===r},top:{side:"top",isEdge:(y,h)=>h===i},left:{side:"left",isEdge:(y,h)=>y===o},right:{side:"right",isEdge:(y,h)=>y===a}}[e];if(s)for(let y=o;y<=a;y++)for(let h=i;h<=r;h++)s.isEdge(y,h)&&n({col:y,row:h,side:s.side})}function _p(e,l,n,o){const a=[];return dl(e,l,({col:i,row:r,side:c})=>{const s=o(i,r,c);if(!_l(s))return;const y=$p(s,n);mi(s==null?void 0:s.color,y.color)||a.push({col:i,row:r,side:c,next:y})}),a}function Hp(e,l,n,o,a,i){const r={};for(const c of Rr)r[c]=pi(a(e,l,c),n,o,i);return r}function Wp(e,l,n){let o,a=!1,i=!1;if(dl(e,l,({col:r,row:c,side:s})=>{if(i)return;const y=n(r,c,s);if(!_l(y))return;const h=cl(y.color);if(!a){o=h,a=!0;return}mi(o,h)||(i=!0)}),!(i||!a))return o}function Up(e,l,n,o){const a=[];return dl(e,l,({col:i,row:r,side:c})=>{const s=o(i,r,c);if(!_l(s))return;const y=zp(s,n);un(s.style)!==n&&a.push({col:i,row:r,side:c,next:y})}),a}function Pp(e,l,n){let o,a=!1,i=!1;if(dl(e,l,({col:r,row:c,side:s})=>{if(i)return;const y=n(r,c,s);if(!_l(y))return;const h=un(y.style);if(!a){o=h,a=!0;return}h!==o&&(i=!0)}),!(i||!a))return o}function Kp(e,l){const n=t.ref("none"),o=t.ref(""),a=t.ref("solid"),i=t.ref(!1);function r(I,H,$){if(I<0||H<0||I>=e.colCount||H>=e.rowCount)return;const V=e.findMerge(I,H);return e.getCellBorderSide(e.cells[V?V.anchor:e.cellKey(I,H)],$)}function c(I,H,$,V){if(I<0||H<0||I>=e.colCount||H>=e.rowCount)return;const B=e.findMerge(I,H),W=B?B.anchor:e.cellKey(I,H);if(!e.cells[W]){if(!V)return;e.cells[W]={value:""}}Op(e.cells[W],$,V,e.styles,{get:q=>e.resolveBorder(q),getId:q=>e.registerBorder(q)},e.registerStyle)}function s(I,H,$){var Ce;const V=e.findMerge(I,H),B=V?V.anchor:e.cellKey(I,H),W=((Ce=e.cells[B])==null?void 0:Ce.value)??"",z=e.resolveStyle(e.cells[B])?{...e.resolveStyle(e.cells[B])}:{},q=e.registerBorder($);if(q>0?z.borderId=q:delete z.borderId,delete z.borderTopWidth,delete z.borderBottomWidth,delete z.borderLeftWidth,delete z.borderRightWidth,delete z.borderColor,W===""&&!Object.keys(z).length)e.delCell(B);else{const We=e.registerStyle(z);e.cells[B]={value:W,styleId:We||void 0}}}function y(I){var We,gt;n.value=I;const H=e.selection.value;if(!H)return;l.saveUndo();const{startCol:$,startRow:V,endCol:B,endRow:W}=H,z={startCol:$,startRow:V,endCol:B,endRow:W},q=o.value||void 0,Ce=(Ae,w,X)=>r(Ae,w,X);if(I==="none")for(let Ae=$;Ae<=B;Ae++)for(let w=V;w<=W;w++){const X=e.findMerge(Ae,w);X&&(Ae!==X.range.startCol||w!==X.range.startRow)||s(Ae,w,{})}else if(I==="all")for(let Ae=$;Ae<=B;Ae++)for(let w=V;w<=W;w++){const X=e.findMerge(Ae,w);if(X&&(Ae!==X.range.startCol||w!==X.range.startRow))continue;const dt=Hp(Ae,w,1,q,Ce,a.value);for(const Nt of Rr)dt[Nt]&&(dt[Nt].owner=!0);s(Ae,w,dt)}else{const Ae=I==="thickOuter"?2:1;dl(I,z,({col:w,row:X,side:dt})=>{const Nt=Ce(w,X,dt),Ct=pi(Nt,Ae,q,a.value);Ct.owner=!0,c(w,X,dt,Ct)})}(We=e.scheduleRender)==null||We.call(e),(gt=e.emitModelData)==null||gt.call(e)}function h(I){var W,z;o.value=I;const H=e.selection.value;if(!H)return;const $={startCol:Math.min(H.startCol,H.endCol),startRow:Math.min(H.startRow,H.endRow),endCol:Math.max(H.startCol,H.endCol),endRow:Math.max(H.startRow,H.endRow)},V=n.value==="none"?"all":n.value,B=_p(V,$,I,(q,Ce,We)=>r(q,Ce,We));if(B.length!==0){l.saveUndo();for(const q of B)q.next.owner=!0,c(q.col,q.row,q.side,q.next);(W=e.scheduleRender)==null||W.call(e),(z=e.emitModelData)==null||z.call(e)}}function R(I){var W,z,q;a.value=I;const H=e.selection.value;if(!H)return;const $={startCol:Math.min(H.startCol,H.endCol),startRow:Math.min(H.startRow,H.endRow),endCol:Math.max(H.startCol,H.endCol),endRow:Math.max(H.startRow,H.endRow)},V=n.value==="none"?"all":n.value,B=Up(V,$,I,(Ce,We,gt)=>r(Ce,We,gt));if(B.length===0){(W=e.scheduleRender)==null||W.call(e);return}l.saveUndo();for(const Ce of B)Ce.next.owner=!0,c(Ce.col,Ce.row,Ce.side,Ce.next);(z=e.scheduleRender)==null||z.call(e),(q=e.emitModelData)==null||q.call(e)}const f=t.computed(()=>{const I=e.selection.value;if(!I)return"";const H=n.value==="none"?"all":n.value;return Wp(H,I,($,V,B)=>r($,V,B))??""}),E=t.computed(()=>{const I=e.selection.value;if(!I)return"";const H=n.value==="none"?"all":n.value;return Pp(H,I,($,V,B)=>r($,V,B))??""});function k(){y(n.value)}function N(I,H,$){const V=$.toLowerCase(),B=e.findMerge(I,H);if(B){if(V==="top"&&H!==B.range.startRow||V==="bottom"&&H!==B.range.endRow||V==="left"&&I!==B.range.startCol||V==="right"&&I!==B.range.endCol)return 0;const z=e.getCellBorderSide(e.cells[B.anchor],V);return(z==null?void 0:z.width)??0}const W=e.getCellBorderSide(e.cells[e.cellKey(I,H)],V);return(W==null?void 0:W.width)??0}const Y=t.ref(!1);function te(I){Y.value=I,I&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,i.value=!1,l.fontSizeMenuOpen.value=!1)}function me(I,H,$,V){const B=[];for(const W in e.merges){const z=e.merges[W];z&&z.startCol<=$&&z.endCol>=I&&z.startRow<=V&&z.endRow>=H&&B.push(W)}for(const W of B)Reflect.deleteProperty(e.merges,W)}function he(){var W,z,q;const I=e.selection.value;if(!I||I.startCol===I.endCol&&I.startRow===I.endRow)return;l.saveUndo(),me(I.startCol,I.startRow,I.endCol,I.endRow);const H=e.cellKey(I.startCol,I.startRow),$=((W=e.cells[H])==null?void 0:W.value)??"";for(let Ce=I.startCol;Ce<=I.endCol;Ce++)for(let We=I.startRow;We<=I.endRow;We++)Ce===I.startCol&&We===I.startRow||e.clearCellsInRange(Ce,Ce,We,We);const V=e.resolveStyle(e.cells[H])?{...e.resolveStyle(e.cells[H])}:{};V.textAlign="center";const B=e.registerStyle(V);e.cells[H]={value:$,styleId:B||void 0},e.merges[H]={startCol:I.startCol,startRow:I.startRow,endCol:I.endCol,endRow:I.endRow},e.selectCell(I.startCol,I.startRow),(z=e.scheduleRender)==null||z.call(e),(q=e.emitModelData)==null||q.call(e)}function Te(){var H,$,V;const I=e.selection.value;if(!(!I||I.startCol===I.endCol)){l.saveUndo();for(let B=I.startRow;B<=I.endRow;B++){me(I.startCol,B,I.endCol,B);const W=e.cellKey(I.startCol,B);(H=e.cells[W])==null||H.value;for(let z=I.startCol+1;z<=I.endCol;z++)e.clearCellsInRange(z,z,B,B);e.merges[W]={startCol:I.startCol,startRow:B,endCol:I.endCol,endRow:B}}e.selectRange(I.startCol,I.startRow,I.endCol,I.endRow),($=e.scheduleRender)==null||$.call(e),(V=e.emitModelData)==null||V.call(e)}}function pe(){var $,V,B;const I=e.selection.value;if(!I||I.startCol===I.endCol&&I.startRow===I.endRow)return;l.saveUndo(),me(I.startCol,I.startRow,I.endCol,I.endRow);const H=e.cellKey(I.startCol,I.startRow);($=e.cells[H])==null||$.value;for(let W=I.startCol;W<=I.endCol;W++)for(let z=I.startRow;z<=I.endRow;z++)W===I.startCol&&z===I.startRow||e.clearCellsInRange(W,W,z,z);e.merges[H]={startCol:I.startCol,startRow:I.startRow,endCol:I.endCol,endRow:I.endRow},e.selectCell(I.startCol,I.startRow),(V=e.scheduleRender)==null||V.call(e),(B=e.emitModelData)==null||B.call(e)}function Ee(){var H,$;const I=e.selection.value;I&&(l.saveUndo(),me(I.startCol,I.startRow,I.endCol,I.endRow),(H=e.scheduleRender)==null||H.call(e),($=e.emitModelData)==null||$.call(e))}function Le(){const I=e.selection.value;if(!I)return;const H=e.findMerge(I.startCol,I.startRow);H&&I.startCol===H.range.startCol&&I.startRow===H.range.startRow&&I.endCol===H.range.endCol&&I.endRow===H.range.endRow?Ee():he()}function ue(I){switch(I){case"mergeCenter":he();break;case"mergeAcross":Te();break;case"mergeCells":pe();break;case"unmergeCells":Ee();break}}let ie=null,tt=[],st=[];function Z(I,H,$,V){st=[];const B={startCol:I,endCol:H,startRow:$,endRow:V};for(const{rule:W,range:z}of e.getDataValidationsInRange(B))st.push({...W,ranges:[{...z}]})}function O(I,H,$,V){tt=[];for(let B=$;B<=V;B++){const W=[];for(let z=I;z<=H;z++){const q=e.cells[e.cellKey(z,B)];W.push((q==null?void 0:q.styleId)??0)}tt.push(W)}}function L(I,H,$,V){const B=e.cellKey(I,H);if(So(),$===""||$==null){e.formulaDeps.clear(B),V&&V>0?e.cells[B]={value:"",styleId:V}:e.delCell(B),e.formulaDeps.markDirty(B);return}e.cells[B]={value:$,styleId:V&&V>0?V:void 0},$.startsWith("=")?e.formulaDeps.set(B,Tl($.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(B),e.formulaDeps.markDirty(B)}function oe(){const I=e.selection.value;if(!I)return;ie={...I},O(I.startCol,I.endCol,I.startRow,I.endRow),Z(I.startCol,I.endCol,I.startRow,I.endRow);const H=[];for(let $=I.startRow;$<=I.endRow;$++){const V=[];for(let B=I.startCol;B<=I.endCol;B++)V.push(e.getCellRaw(B,$));H.push(V.join(" "))}nr(H.join(`
|
|
4
|
-
`))}function
|
|
5
|
-
`))}else if(
|
|
6
|
-
`))}}}async function lt(){var Ae;let I;try{I=await navigator.clipboard.readText()}catch{return}if(!I&&I!=="")return;const H=I.split(/\r?\n/),$=e.activeCell.value,V=ie,B=V&&tt.length>0,W=H.map(w=>w.split(" ").length),z=W.length?Math.max(...W):0,q=$.col+z-1,Ce=$.row+H.length-1;q>=0&&Ce>=0&&e.ensureCapacity(q,Ce);const We=[];for(let w=0;w<H.length;w++){const X=H[w].split(" ");for(let dt=0;dt<X.length;dt++){const Nt=$.col+dt,Ct=$.row+w;let $t=X[dt];$t.startsWith("=")&&V&&($t=Vl($t,Nt-(V.startCol+dt),Ct-(V.startRow+w),e.colCount,e.rowCount,yt));const xt=B&&w<tt.length&&dt<(((Ae=tt[w])==null?void 0:Ae.length)??0)?tt[w][dt]??null:null;We.push({c:Nt,r:Ct,val:$t,styleId:xt})}}const gt=e.validateCells(We.map(w=>({col:w.c,row:w.r,value:w.val})));if(!(!gt.valid&&await e.confirmInvalidValue(gt,$.col,$.row)!=="continue")){for(const w of We)w.styleId!==null?L(w.c,w.r,w.val,w.styleId):e.setCellValue(w.c,w.r,w.val);if(V&&st.length>0){const w=$.col-V.startCol,X=$.row-V.startRow,dt={startCol:$.col,endCol:$.col+z-1,startRow:$.row,endRow:$.row+H.length-1},Nt=st.map(Ct=>({...Ct,ranges:Ct.ranges.map($t=>Sp($t,w,X))}));e.applyDataValidationsToRange(Nt,dt,{silent:!0}),e.invalidateDataValidationCache()}}}function ne(){var I;if(l.saveUndo(),oe(),e.selection.value){const H=e.selection.value;e.clearCellsInRange(H.startCol,H.endCol,H.startRow,H.endRow),(I=e.scheduleRender)==null||I.call(e)}}function xe(){var I;if(e.selection.value){const H=e.selection.value;e.clearCellsInRange(H.startCol,H.endCol,H.startRow,H.endRow),(I=e.scheduleRender)==null||I.call(e)}}function Ne(){var W,z;const I=e.selection.value;if(!I)return;l.saveUndo();const H=I.startCol,$=I.startRow,V=I.endCol,B=I.endRow;if($===B)if(V+1<e.colCount){const q=`${yt(H)}${$+1}:${yt(V)}${$+1}`;e.setCellValue(V+1,$,`=SUM(${q})`)}else{const q=`${yt(H)}${$+1}:${yt(V-1)}${$+1}`;e.setCellValue(V,$,`=SUM(${q})`)}else for(let q=H;q<=V;q++)if(B+1<e.rowCount){const Ce=`${yt(q)}${$+1}:${yt(q)}${B+1}`;e.setCellValue(q,B+1,`=SUM(${Ce})`)}else{const Ce=`${yt(q)}${$+1}:${yt(q)}${B}`;e.setCellValue(q,B,`=SUM(${Ce})`)}(W=e.scheduleRender)==null||W.call(e),(z=e.emitModelData)==null||z.call(e)}function se(){var W,z;const I=e.selection.value;if(!I)return;l.saveUndo();const H=I.startCol,$=I.startRow,V=I.endCol,B=I.endRow;if($===B)if(V+1<e.colCount){const q=`${yt(H)}${$+1}:${yt(V)}${$+1}`;e.setCellValue(V+1,$,`=AVERAGE(${q})`)}else{const q=`${yt(H)}${$+1}:${yt(V-1)}${$+1}`;e.setCellValue(V,$,`=AVERAGE(${q})`)}else for(let q=H;q<=V;q++)if(B+1<e.rowCount){const Ce=`${yt(q)}${$+1}:${yt(q)}${B+1}`;e.setCellValue(q,B+1,`=AVERAGE(${Ce})`)}else{const Ce=`${yt(q)}${$+1}:${yt(q)}${B}`;e.setCellValue(q,B,`=AVERAGE(${Ce})`)}(W=e.scheduleRender)==null||W.call(e),(z=e.emitModelData)==null||z.call(e)}function de(){var W,z;const I=e.selection.value;if(!I)return;l.saveUndo();const H=I.startCol,$=I.startRow,V=I.endCol,B=I.endRow;if($===B)if(V+1<e.colCount){const q=`${yt(H)}${$+1}:${yt(V)}${$+1}`;e.setCellValue(V+1,$,`=COUNT(${q})`)}else{const q=`${yt(H)}${$+1}:${yt(V-1)}${$+1}`;e.setCellValue(V,$,`=COUNT(${q})`)}else for(let q=H;q<=V;q++)if(B+1<e.rowCount){const Ce=`${yt(q)}${$+1}:${yt(q)}${B+1}`;e.setCellValue(q,B+1,`=COUNT(${Ce})`)}else{const Ce=`${yt(q)}${$+1}:${yt(q)}${B}`;e.setCellValue(q,B,`=COUNT(${Ce})`)}(W=e.scheduleRender)==null||W.call(e),(z=e.emitModelData)==null||z.call(e)}const Be=t.ref(!1);function _e(I){Be.value=I,I&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,i.value=!1,l.fontSizeMenuOpen.value=!1,Y.value=!1)}function Ge(){Ne(),Be.value=!1}function ct(){se(),Be.value=!1}function nt(){de(),Be.value=!1}return{cachedBorder:n,cachedBorderColor:o,cachedBorderLineStyle:a,selBorderColor:f,selBorderLineStyle:E,borderMenuOpen:i,onBorderChange:y,onBorderColorChange:h,onBorderLineStyleChange:R,setCellBorderSide:c,applyBorderToCell:s,applyCachedBorder:k,cellBorderWidth:N,mergeMenuOpen:Y,onMergeMenuToggle:te,removeOverlappingMerges:me,mergeAndCenter:he,mergeAcross:Te,mergeCells:pe,unmergeCells:Ee,onApplyMerge:Le,onMergeChange:ue,copySourceRange:null,copySourceStyles:[],captureStyles:O,captureDataValidations:Z,setCellWithStyle:L,copyToClipboard:oe,copyRowCol:$e,pasteFromClipboard:lt,cutSelected:ne,clearSelected:xe,sumSelected:Ne,avgSelected:se,countSelected:de,calcMenuOpen:Be,onCalcMenuToggle:_e,onCalcSum:Ge,onCalcAvg:ct,onCalcCount:nt}}function Gp(e,l,n,o){const a={},i=o(l),r=o(n);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["--sp-toolbar-text-secondary"]=e.toolbarTextSecondary,a["--sp-toolbar-text-muted"]=e.toolbarTextMuted,a["--sp-toolbar-item-active-bg"]=e.toolbarItemActiveBg,a["--sp-danger-hover-bg"]=e.dangerHoverBg,a["--sp-find-hint-color"]=e.findHintColor,a["--sp-border-default"]=e===Jr?ui:di,a}function hi(e){return e==="number"?0:1}function gi(e,l,n){var i;if(e==null||e.trim()==="")return{kind:"blank"};const o=l??"";if(o===On||o==="@")return{kind:"text",text:e};if(In(o)){if(Hn(e))return{kind:"number",num:Number(e)};const r=eo(e,n);return r?{kind:"number",num:r.serial}:{kind:"text",text:_n(e,o,n)}}const a=po(o);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:_n(e,o,n)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const c=((i=a.sections.find(s=>s.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*c}}return{kind:"text",text:_n(e,o,n)}}return{kind:"text",text:_n(e,o,n)}}function qp(e,l,n,o){if(e.kind==="blank"||l.kind==="blank")return e.kind==="blank"&&l.kind==="blank"?0:e.kind==="blank"?1:-1;const a=hi(e.kind),i=hi(l.kind);if(a!==i)return n==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(l.num??0):r=(e.text??"").localeCompare(l.text??"",o,{numeric:!0}),n==="asc"?r:-r}function Yp(e,l,n){const o=e.map((a,i)=>i);return o.sort((a,i)=>{const r=qp(e[a],e[i],l,n);return r!==0?r:a-i}),o}function jp(e){if(e.length<2||e[0].kind!=="text")return!1;for(let l=1;l<e.length;l++)if(e[l].kind==="number")return!0;return!1}function Sr(e){return e?JSON.parse(JSON.stringify(e)):null}function bi(e,l,n,o){if(!e)return null;const a=n-l+1,i={...e.range};return o?l<=i.endRow&&(l<=i.startRow&&(i.startRow+=a),i.endRow+=a):n<i.startRow?(i.startRow-=a,i.endRow-=a):l<=i.endRow&&(i.endRow-=Math.min(a,i.endRow-l+1),i.endRow<i.startRow&&(i.endRow=i.startRow)),{range:i,columns:e.columns}}function yi(e,l,n,o){if(!e)return null;const a=n-l+1,i={...e.range},r={};if(o){l<=i.endCol&&(l<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const c in e.columns){const s=Number(c);r[s>=l?s+a:s]=e.columns[c]}}else{n<i.startCol?(i.startCol-=a,i.endCol-=a):l<=i.endCol&&(i.endCol-=Math.min(a,i.endCol-l+1),i.endCol<i.startCol&&(i.endCol=i.startCol));for(const c in e.columns){const s=Number(c);s>=l&&s<=n||(r[s>n?s-a:s]=e.columns[c])}}return{range:i,columns:r}}function Ci(e,l,n,o){if(l==="row"){const a=e.startRow,i=e.endRow;let r,c;if(i<n)r=a,c=i;else if(a>n+o-1)r=a-o,c=i-o;else if(r=a<n?a:n,c=i>n+o-1?i-o:n-1,c<r)return null;return{...e,startRow:r,endRow:c}}else{const a=e.startCol,i=e.endCol;let r,c;if(i<n)r=a,c=i;else if(a>n+o-1)r=a-o,c=i-o;else if(r=a<n?a:n,c=i>n+o-1?i-o:n-1,c<r)return null;return{...e,startCol:r,endCol:c}}}function wi(e,l,n,o){if(l==="row"){const a=e.startRow,i=e.endRow;return a>=n?{...e,startRow:a+o,endRow:i+o}:i<n?e:{...e,endRow:i+o}}else{const a=e.startCol,i=e.endCol;return a>=n?{...e,startCol:a+o,endCol:i+o}:i<n?e:{...e,endCol:i+o}}}function Xp(e,l,n){var a;const o=n-l+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(s=>Ci(s,"row",l,o)).filter(s=>s!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Zp(e,l,n){var a;const o=n-l+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>wi(r,"row",l,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Jp(e,l,n){var a;const o=n-l+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(s=>Ci(s,"col",l,o)).filter(s=>s!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Qp(e,l,n){var a;const o=n-l+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>wi(r,"col",l,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function vi(e,l,n,o){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],c=(r.ranges??[]).map(s=>Ep(s,l,n,o)).filter(s=>s!==null);c.length===0?e.dataValidations.splice(i,1):r.ranges=c}(a=e.invalidateDataValidationCache)==null||a.call(e)}function ki(e,l,n,o){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>Rp(r,l,n,o));(a=e.invalidateDataValidationCache)==null||a.call(e)}function e2(e,l,n,o,a){function i(K,U){var He;const j=U-K+1,ye=Z(K,U),ve=[],Ve=[];for(const be in e.cells){const Qe=be.indexOf(",");if(Qe<0)continue;const v=parseInt(be.substring(0,Qe),10),P=parseInt(be.substring(Qe+1),10);P>=K&&P<=U?Ve.push(be):P>U&&ve.push({oldKey:be,newKey:e.cellKey(v,P-j),cell:e.cells[be]})}for(const be of Ve)Reflect.deleteProperty(e.cells,be);for(const be of ve)Reflect.deleteProperty(e.cells,be.oldKey),e.cells[be.newKey]=be.cell;(He=e.gcNotes)==null||He.call(e);const Ue=e.rowHeights.value,ke=new Array(Ue.length);for(let be=0;be<K;be++)ke[be]=Ue[be];for(let be=K;be<Ue.length-j;be++)ke[be]=Ue[be+j];for(let be=Ue.length-j;be<Ue.length;be++)ke[be]=void 0;e.rowHeights.value=ke,st(ye),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(bi(e.getFilter(),K,U,!1)),Xp(e,K,U),vi(e,"row",K,j),e.adjustOutlinesForDeleteRows(K,j)}function r(K,U){const j=U-K+1,ye=e.rowCount,ve=e.colCount,{lastRow:Ve}=y();Ve>=K&&Ve+j>=ye&&e.ensureCapacity(ve-1,ye-1+j);const Ue=e.rowCount,ke=L(K,U),He=[];for(const v in e.cells){const P=v.indexOf(",");if(P<0)continue;const le=parseInt(v.substring(0,P),10),Re=parseInt(v.substring(P+1),10);Re>=K&&He.push({oldKey:v,newKey:e.cellKey(le,Re+j),cell:e.cells[v],oldRow:Re})}He.sort((v,P)=>P.oldRow-v.oldRow);for(const v of He)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 le=parseInt(v.substring(P+1),10);le>=K&&le<=U&&Reflect.deleteProperty(e.cells,v)}const be=e.rowHeights.value,Qe=new Array(Ue);for(let v=0;v<K;v++)Qe[v]=be[v];for(let v=K;v<=U;v++)Qe[v]=void 0;for(let v=K;v<Ue;v++)Qe[v+j]=be[v];e.rowHeights.value=Qe,st(ke),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(bi(e.getFilter(),K,U,!0)),Zp(e,K,U),ki(e,"row",K,j),e.adjustOutlinesForInsertRows(K,j)}function c(K,U){const j=U-K+1,ye=e.colCount,ve=e.rowCount,{lastCol:Ve}=y();Ve>=K&&Ve+j>=ye&&e.ensureCapacity(ye-1+j,ve-1);const Ue=e.colCount,ke=oe(K,U),He=[];for(const v in e.cells){const P=v.indexOf(",");if(P<0)continue;const le=parseInt(v.substring(0,P),10),Re=parseInt(v.substring(P+1),10);le>=K&&He.push({oldKey:v,newKey:e.cellKey(le+j,Re),cell:e.cells[v],oldCol:le})}He.sort((v,P)=>P.oldCol-v.oldCol);for(const v of He)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 le=parseInt(v.substring(0,P),10);le>=K&&le<=U&&Reflect.deleteProperty(e.cells,v)}const be=e.colWidths.value,Qe=new Array(Ue);for(let v=0;v<K;v++)Qe[v]=be[v];for(let v=K;v<=U;v++)Qe[v]=100;for(let v=K;v<Ue;v++)Qe[v+j]=be[v];e.colWidths.value=Qe,st(ke),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(yi(e.getFilter(),K,U,!0)),Qp(e,K,U),ki(e,"col",K,j),e.adjustOutlinesForInsertCols(K,j)}function s(K,U){var He;const j=U-K+1,ye=O(K,U),ve=[],Ve=[];for(const be in e.cells){const Qe=be.indexOf(",");if(Qe<0)continue;const v=parseInt(be.substring(0,Qe),10),P=parseInt(be.substring(Qe+1),10);v>=K&&v<=U?Ve.push(be):v>U&&ve.push({oldKey:be,newKey:e.cellKey(v-j,P),cell:e.cells[be]})}for(const be of Ve)Reflect.deleteProperty(e.cells,be);for(const be of ve)Reflect.deleteProperty(e.cells,be.oldKey),e.cells[be.newKey]=be.cell;(He=e.gcNotes)==null||He.call(e);const Ue=e.colWidths.value,ke=new Array(Ue.length);for(let be=0;be<K;be++)ke[be]=Ue[be];for(let be=K;be<Ue.length-j;be++)ke[be]=Ue[be+j];for(let be=Ue.length-j;be<Ue.length;be++)ke[be]=100;e.colWidths.value=ke,st(ye),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(yi(e.getFilter(),K,U,!1)),Jp(e,K,U),vi(e,"col",K,j),e.adjustOutlinesForDeleteCols(K,j)}function y(){let K=-1,U=-1;for(const j in e.cells){const ye=j.split(",");if(ye.length===2){const ve=parseInt(ye[0],10),Ve=parseInt(ye[1],10),Ue=e.cells[j];Ue&&(Ue.value!==""||Ue.styleId!==void 0)&&(ve>K&&(K=ve),Ve>U&&(U=Ve))}}for(let j=e.colCount-1;j>=0;j--){const ye=e.colWidths.value[j];if(ye!==void 0&&ye!==100){j>K&&(K=j);break}}for(let j=e.rowCount-1;j>=0;j--)if(e.rowHeights.value[j]!==void 0){j>U&&(U=j);break}return{lastCol:K,lastRow:U}}function h(K,U){const j=e.resolveStyle(e.cells[e.cellKey(K,U)]);return typeof(j==null?void 0:j.numberFormat)=="string"?j.numberFormat:""}function R(K,U,j){for(let ye=U;ye<=j;ye++)if(e.getCellRaw(K,ye).trim()!=="")return!0;return!1}function f(K){const{startRow:U,endRow:j,startCol:ye,endCol:ve}=K;let Ve=ye,Ue=ve;for(;Ve>0&&R(Ve-1,U,j);)Ve--;for(;Ue<e.colCount-1&&R(Ue+1,U,j);)Ue++;return{startRow:U,endRow:j,startCol:Ve,endCol:Ue}}function E(K){const U=f(K);return U.startCol!==K.startCol||U.endCol!==K.endCol}function k(K,U,j,ye=K){let ve,Ve;if(j)ve=j.startRow,Ve=j.endRow;else{const v=e.selection.value,P=!!v&&v.startRow===v.endRow&&v.startCol===v.endCol;ve=P||!v?0:v.startRow,Ve=P||!v?e.rowCount-1:v.endRow}let Ue=-1,ke=-1;for(let v=ve;v<=Ve;v++){let P=!1;for(let le=K;le<=U;le++)if(e.getCellRaw(le,v).trim()!==""){P=!0;break}P&&(Ue<0&&(Ue=v),ke=v)}if(Ue<0)return null;const He=[];for(let v=Ue;v<=ke;v++){const P=e.getCellRaw(ye,v);He.push(gi(P,h(ye,v),e.locale.value))}const be=jp(He)?Ue+1:Ue;let Qe=!1;for(let v=Ue;v<=ke&&!Qe;v++)for(let P=K;P<=U;P++){const le=e.cells[e.cellKey(P,v)];if(le&&le.value.startsWith("=")){Qe=!0;break}}if(!Qe)for(const v in e.merges){const P=e.merges[v];if(P&&P.startCol<=U&&P.endCol>=K&&P.startRow<=Ve&&P.endRow>=ve){Qe=!0;break}}return{firstRow:Ue,lastRow:ke,sortStart:be,blocked:Qe}}function N(K,U){const j=k(K,U);return!!j&&!j.blocked&&j.sortStart<j.lastRow}function Y(K,U,j){var Re,Ie;const ye=U??e.selection.value;if(!ye)return;const ve=ye.startCol,Ve=ye.endCol,Ue=j??ve,ke=k(ve,Ve,{startRow:ye.startRow,endRow:ye.endRow},Ue);if(!ke||ke.blocked||ke.sortStart>=ke.lastRow)return;const He=Ve-ve+1,be=ke.lastRow-ke.sortStart+1,Qe=[],v=[];for(let x=ke.sortStart;x<=ke.lastRow;x++){const m=new Array(He);for(let it=ve;it<=Ve;it++)m[it-ve]=e.cells[e.cellKey(it,x)]??null;Qe.push(m);const M=e.getCellRaw(Ue,x);v.push(gi(M,h(Ue,x),e.locale.value))}const P=Yp(v,K,e.locale.value);let le=!1;for(let x=0;x<be;x++)if(P[x]!==x){le=!0;break}if(le){l.saveUndo();for(let x=0;x<be;x++){const m=Qe[P[x]],M=ke.sortStart+x;for(let it=ve;it<=Ve;it++){const vt=e.cellKey(it,M),At=m[it-ve],Dt=At?At.value:"",rn=(Re=e.cells[vt])==null?void 0:Re.styleId;Dt!==""||rn!==void 0?e.cells[vt]={value:Dt,styleId:rn}:e.delCell(vt)}}So();for(let x=ke.sortStart;x<=ke.lastRow;x++)for(let m=ve;m<=Ve;m++)e.formulaDeps.markDirty(e.cellKey(m,x));(Ie=e.scheduleRender)==null||Ie.call(e),W()}}const te=t.ref(!1),me=t.ref(null);function he(K){const U=e.selection.value;if(!U||!E(U))return!1;const j=f(U);return me.value={order:K,originalRange:U,expandedRange:j},te.value=!0,!0}function Te(K){const U=me.value;if(!U)return;const{order:j,originalRange:ye,expandedRange:ve}=U;te.value=!1,me.value=null,Y(j,K?ve:ye,ye.startCol),Le.value=j}function pe(){te.value=!1,me.value=null}const Ee=t.ref(!1),Le=t.ref("asc");function ue(K){Ee.value=K,K&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,l.fontSizeMenuOpen.value=!1)}function ie(K){he(K)||(Le.value=K,Y(K))}function tt(){he(Le.value)||Y(Le.value)}function st(K){Object.keys(e.merges).forEach(U=>Reflect.deleteProperty(e.merges,U));for(const U of K)if(!(U.newRange.startCol>U.newRange.endCol||U.newRange.startRow>U.newRange.endRow)&&(e.merges[U.newAnchorKey]={...U.newRange},U.anchorCell)){const j=U.anchorCell.value,ye=U.anchorCell.styleId;j===""&&!ye||(e.cells[U.newAnchorKey]={value:j,styleId:ye||void 0})}}function Z(K,U){const j=U-K+1,ye=[];for(const ve in e.merges){const Ve=e.merges[ve];if(!Ve)continue;const Ue=e.cells[ve]?{value:e.cells[ve].value,styleId:e.cells[ve].styleId??0}:{value:"",styleId:0},{startCol:ke,endCol:He}=Ve;let{startRow:be,endRow:Qe}=Ve;if(be>U){be-=j,Qe-=j,ye.push({newAnchorKey:e.cellKey(ke,be),newRange:{startCol:ke,startRow:be,endCol:He,endRow:Qe}});continue}if(Qe<K){ye.push({newAnchorKey:ve,newRange:{startCol:ke,startRow:be,endCol:He,endRow:Qe}});continue}if(be>=K&&Qe<=U||(be>=K&&be<=U&&(be=K),Qe>=K&&Qe<=U?Qe=K-1:Qe>U&&(Qe-=j),be>Qe))continue;const v=ke,P=be,le=e.cellKey(v,P),Ie=ve.split(",").map(Number)[1],x=Ie>=K&&Ie<=U||v!==Ve.startCol||P!==Ie;ye.push({newAnchorKey:le,newRange:{startCol:ke,startRow:be,endCol:He,endRow:Qe},anchorCell:x?Ue:void 0})}return ye}function O(K,U){const j=U-K+1,ye=[];for(const ve in e.merges){const Ve=e.merges[ve];if(!Ve)continue;const Ue=e.cells[ve]?{value:e.cells[ve].value,styleId:e.cells[ve].styleId??0}:{value:"",styleId:0};let{startCol:ke,endCol:He}=Ve;const{startRow:be,endRow:Qe}=Ve;if(ke>U){ke-=j,He-=j,ye.push({newAnchorKey:e.cellKey(ke,be),newRange:{startCol:ke,startRow:be,endCol:He,endRow:Qe}});continue}if(He<K){ye.push({newAnchorKey:ve,newRange:{startCol:ke,startRow:be,endCol:He,endRow:Qe}});continue}if(ke>=K&&He<=U||(ke>=K&&ke<=U&&(ke=K),He>=K&&He<=U?He=K-1:He>U&&(He-=j),ke>He))continue;const v=ke,P=be,le=e.cellKey(v,P),Ie=ve.split(",").map(Number)[0],x=Ie>=K&&Ie<=U||v!==Ie||P!==Ve.startRow;ye.push({newAnchorKey:le,newRange:{startCol:ke,startRow:be,endCol:He,endRow:Qe},anchorCell:x?Ue:void 0})}return ye}function L(K,U){const j=U-K+1,ye=[];for(const ve in e.merges){const Ve=e.merges[ve];if(!Ve)continue;const{startCol:Ue,endCol:ke}=Ve;let{startRow:He,endRow:be}=Ve;be<K?ye.push({newAnchorKey:ve,newRange:{startCol:Ue,startRow:He,endCol:ke,endRow:be}}):He<K?(be+=j,ye.push({newAnchorKey:ve,newRange:{startCol:Ue,startRow:He,endCol:ke,endRow:be}})):(He+=j,be+=j,ye.push({newAnchorKey:e.cellKey(Ue,He),newRange:{startCol:Ue,startRow:He,endCol:ke,endRow:be}}))}return ye}function oe(K,U){const j=U-K+1,ye=[];for(const ve in e.merges){const Ve=e.merges[ve];if(!Ve)continue;let{startCol:Ue,endCol:ke}=Ve;const{startRow:He,endRow:be}=Ve;ke<K?ye.push({newAnchorKey:ve,newRange:{startCol:Ue,startRow:He,endCol:ke,endRow:be}}):Ue<K?(ke+=j,ye.push({newAnchorKey:ve,newRange:{startCol:Ue,startRow:He,endCol:ke,endRow:be}})):(Ue+=j,ke+=j,ye.push({newAnchorKey:e.cellKey(Ue,He),newRange:{startCol:Ue,startRow:He,endCol:ke,endRow:be}}))}return ye}let $e=0;function lt(){return $e++,`s_${$e}`}function ne(K){if(!Array.isArray(K))return[];const U=[];for(const j of K){if(!j||typeof j!="object")continue;const ye=j;if(!ye.type||!Array.isArray(ye.ranges)||ye.ranges.length===0)continue;const ve=ye.ranges.filter(Ve=>!!Ve&&typeof Ve.startCol=="number"&&typeof Ve.startRow=="number"&&typeof Ve.endCol=="number"&&typeof Ve.endRow=="number").map(Ve=>({startCol:Math.min(Ve.startCol,Ve.endCol),endCol:Math.max(Ve.startCol,Ve.endCol),startRow:Math.min(Ve.startRow,Ve.endRow),endRow:Math.max(Ve.startRow,Ve.endRow)}));ve.length&&U.push({...ye,id:ye.id||`dv_${U.length}`,ranges:ve})}return U}function xe(K,U){const j=Math.max(1,(U==null?void 0:U.colCount)??e.colCount),ye=Math.max(1,(U==null?void 0:U.rowCount)??e.rowCount),ve=new Array(j).fill(100),Ve=new Array(ye).fill(void 0);return{id:lt(),name:K,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:ve,rowHeights:Ve,colCount:j,rowCount:ye,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[],notes:{}}}const Ne=t.ref([xe("Sheet1")]),se=t.ref(0);function de(){const K=Ne.value[se.value];if(!K)return;K.cells={...e.cells},K.merges={...e.merges},K.selection=e.selection.value?{...e.selection.value}:null,K.activeCell={...e.activeCell.value},K.scrollX=e.scrollX.value,K.scrollY=e.scrollY.value,K.colWidths=[...e.colWidths.value],K.rowHeights=[...e.rowHeights.value],K.styles=[...e.styles],K.borders=[...e.borders],K.colCount=e.colCount,K.rowCount=e.rowCount,K.freeze={rows:e.freeze.rows,cols:e.freeze.cols},K.filter=Sr(e.getFilter()),K.conditionalFormats=[...e.conditionalFormats],K.dataValidations=[...e.dataValidations];const U=Object.entries(e.notes).map(([j,ye])=>[j,{...ye}]);K.notes=Object.fromEntries(U),K.rowOutlines=e.getRowOutlines(),K.columnOutlines=e.getColumnOutlines()}function Be(K){var Qe,v,P;const U=Ne.value[K];if(!U)return;Object.keys(e.cells).forEach(le=>e.delCell(le)),Object.assign(e.cells,U.cells),Object.keys(e.merges).forEach(le=>Reflect.deleteProperty(e.merges,le)),U.merges&&Object.assign(e.merges,U.merges),e.selection.value=U.selection?{...U.selection}:null,e.activeCell.value={...U.activeCell};const j=e.activeCell.value,ye=e.selection.value,ve=e.findMerge(j.col,j.row);ve&&ve.anchor===e.cellKey(j.col,j.row)&&(!ye||ye.startCol===j.col&&ye.startRow===j.row&&ye.endCol===j.col&&ye.endRow===j.row)&&e.selectCell(j.col,j.row),e.scrollX.value=U.scrollX,e.scrollY.value=U.scrollY,e.colWidths.value=[...U.colWidths],e.rowHeights.value=[...U.rowHeights];const Ve=Math.max(1,U.colCount??e.colCount),Ue=Math.max(1,U.rowCount??e.rowCount);if((Qe=e.setDims)==null||Qe.call(e,Ve,Ue),e.freeze.rows=Math.max(0,Math.min(U.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(U.freeze.cols,e.colCount)),U.filter){const le=U.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(le.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(le.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(le.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(le.endRow,e.rowCount-1))},columns:{...U.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(U.styles),e.syncBorders(U.borders??[{}]);const ke=U.conditionalFormats?U.conditionalFormats.map(le=>({...le,ranges:le.ranges.map(Re=>({...Re}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...ke),(v=e.invalidateConditionalFormatCache)==null||v.call(e);const He=ne(U.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...He),(P=e.invalidateDataValidationCache)==null||P.call(e);const be=Ga(U.notes);Object.keys(e.notes).forEach(le=>{e.notes[le]=void 0}),Object.assign(e.notes,be),e.syncOutlines(U.rowOutlines,U.columnOutlines),se.value=K}function _e(K){K===se.value||K<0||K>=Ne.value.length||(e.cancelEdit(),de(),Be(K))}function Ge(K){return l.saveUndo(),e.cancelEdit(),de(),Ne.value.push(xe(K??`Sheet${Ne.value.length+1}`)),Be(Ne.value.length-1),Ne.value.length-1}function ct(K){return Ne.value.length<=1||(l.saveUndo(),e.cancelEdit(),Ne.value.splice(K,1),Be(Math.min(K,Ne.value.length-1))),se.value}function nt(K,U){Ne.value[K]&&U.trim()&&(l.saveUndo(),Ne.value[K].name=U.trim())}function I(K){l.saveUndo(),e.cancelEdit(),de();const U=Ne.value[K];if(!U)return K;let j=U.name;const ye=j.match(/^(.*?)\s*\((\d+)\)$/);let ve=ye?parseInt(ye[2],10)+1:2;ye&&(j=ye[1]);let Ve=`${j} (${ve})`;const Ue=new Set(Ne.value.map(He=>He.name));for(;Ue.has(Ve);)ve++,Ve=`${j} (${ve})`;const ke={id:lt(),name:Ve,cells:{...U.cells},merges:U.merges?{...U.merges}:{},styles:[...U.styles],borders:U.borders?[...U.borders]:[{}],selection:U.selection?{...U.selection}:null,activeCell:U.activeCell?{...U.activeCell}:{col:0,row:0},scrollX:U.scrollX,scrollY:U.scrollY,colWidths:[...U.colWidths],rowHeights:[...U.rowHeights],colCount:U.colCount,rowCount:U.rowCount,freeze:{...U.freeze},filter:Sr(U.filter),conditionalFormats:U.conditionalFormats?U.conditionalFormats.map(He=>({...He})):[],dataValidations:ne(U.dataValidations),rowOutlines:U.rowOutlines?U.rowOutlines.map(He=>({...He})):[],columnOutlines:U.columnOutlines?U.columnOutlines.map(He=>({...He})):[],notes:Ga(U.notes)};return Ne.value.splice(K+1,0,ke),Be(K+1),K+1}function H(K,U){var Ve;const j=K+U;if(j<0||j>=Ne.value.length)return;l.saveUndo();const ye=se.value,ve=Ne.value.splice(K,1)[0];Ne.value.splice(j,0,ve),ye===K?se.value=j:K<ye&&j>=ye?se.value=ye-1:K>ye&&j<=ye&&(se.value=ye+1),(Ve=e.scheduleRender)==null||Ve.call(e)}const $=t.computed(()=>Ne.value.length);let V="";const B=n;function W(){de();const K=Ne.value.map(j=>{const ye={};for(const[ke,He]of Object.entries(j.cells))ye[ke]={value:He.value},He.styleId&&He.styleId>0&&(ye[ke].styleId=He.styleId),He.noteId&&(ye[ke].noteId=He.noteId);const ve={name:j.name,cells:ye};j.styles&&j.styles.length>1&&(ve.styles=[...j.styles]),j.borders&&j.borders.length>1&&(ve.borders=[...j.borders]),j.merges&&Object.keys(j.merges).length&&(ve.merges={...j.merges});const Ve={};for(let ke=0;ke<j.colWidths.length;ke++)j.colWidths[ke]!==100&&(Ve[ke]=j.colWidths[ke]);Object.keys(Ve).length&&(ve.colWidths=Ve);const Ue={};for(let ke=0;ke<j.rowHeights.length;ke++){const He=j.rowHeights[ke];He!=null&&(Ue[ke]=He)}return Object.keys(Ue).length&&(ve.rowHeights=Ue),(j.freeze.rows!==0||j.freeze.cols!==0)&&(ve.freeze={rows:j.freeze.rows,cols:j.freeze.cols}),j.filter&&(ve.filter=Sr(j.filter)),j.conditionalFormats&&j.conditionalFormats.length&&(ve.conditionalFormats=j.conditionalFormats.map(ke=>({...ke}))),j.dataValidations&&j.dataValidations.length&&(ve.dataValidations=j.dataValidations.map(ke=>({...ke,ranges:ke.ranges.map(He=>({...He}))}))),j.notes&&Object.keys(j.notes).length&&(ve.notes=Object.fromEntries(Object.entries(j.notes).map(([ke,He])=>[ke,{...He}]))),j.rowOutlines&&j.rowOutlines.length&&(ve.rowOutlines=j.rowOutlines.map(ke=>({...ke}))),j.columnOutlines&&j.columnOutlines.length&&(ve.columnOutlines=j.columnOutlines.map(ke=>({...ke}))),ve}),U=JSON.stringify(K);U!==V&&(V=U,B.value=K,a&&(a.value=U))}e.emitModelData=W;let z=!1;function q(){z||(z=!0,Promise.resolve().then(()=>{z=!1,W()}))}const Ce=t.computed(()=>e.props.theme==="dark"?Jr:Hi),We=t.computed(()=>Gp(Ce.value,e.props.width,e.props.height,Do)),gt=t.computed(()=>{const K={};for(const[U,j]of Object.entries(We.value))U.startsWith("--")&&(K[U]=j);return K}),Ae=t.ref(null),w=t.ref(null),X=t.ref(null),dt=t.ref(null),Nt=t.ref(null),Ct=t.reactive({w:800,h:600});e.viewSize&&t.watch(Ct,K=>{e.viewSize&&(e.viewSize.w=K.w,e.viewSize.h=K.h)},{deep:!0});const $t=48,xt=28,Tt=11,jt=()=>$t+e.getOutlineGutterSize("row"),Mn=()=>xt+e.getOutlineGutterSize("column"),oo=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Ct.w-jt()-Tt))),Nn=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Ct.h-Mn()-Tt)));function Xt(K,U){const j=Math.max(0,Ct.w-jt()-Tt),ye=Math.max(0,Ct.h-Mn()-Tt),ve=K??e.scrollX.value,Ve=U??e.scrollY.value,Ue=40,ke=Math.max(0,e.totalWidth.value-j),He=Math.max(0,e.totalHeight.value-ye);if(ve>=ke-Ue&&ve>e.scrollX.value||Ve>=He-Ue&&Ve>e.scrollY.value){const be=Math.max(0,Math.ceil((ve+j)/100)+2),Qe=Math.max(0,Math.ceil((Ve+ye)/24)+2);e.ensureCapacity(be,Qe)}e.scrollX.value=Math.max(0,Math.min(ve,Math.max(0,e.totalWidth.value-j))),e.scrollY.value=Math.max(0,Math.min(Ve,Math.max(0,e.totalHeight.value-ye)))}e.clampScroll=Xt;function tn(){var K;return typeof window>"u"?!1:!((K=window.matchMedia)!=null&&K.call(window,"(hover: none) and (pointer: coarse)").matches)}function Jt(K=!1){t.nextTick(()=>{const U=dt.value;if(U){if(!e.editingCell.value&&!tn()){document.activeElement===U&&U.blur();return}U.focus({preventScroll:!0}),K&&U.select()}})}function Ln(){Jt()}function ln(){var U;const K=e.selection.value;if(K){l.saveUndo();for(let j=K.startRow;j<=K.endRow;j++)e.rowHeights.value[j]=void 0;(U=e.scheduleRender)==null||U.call(e),W()}}function Un(){var U;const K=e.selection.value;if(K){l.saveUndo();for(let j=K.startCol;j<=K.endCol;j++)e.colWidths.value[j]=100;(U=e.scheduleRender)==null||U.call(e),W()}}return{deleteRows:i,insertRows:r,insertCols:c,deleteCols:s,sortSelectedColumns:Y,canSortColumns:N,sortMenuOpen:Ee,cachedSortOrder:Le,onSortMenuToggle:ue,onSortChange:ie,applyCachedSort:tt,sortConfirmOpen:te,prepareSortConfirmation:he,confirmSort:Te,cancelSortConfirmation:pe,sheets:Ne,activeSheetIndex:se,saveSheet:de,loadSheet:Be,switchSheet:_e,addSheet:Ge,removeSheet:ct,renameSheet:nt,dupSheet:I,moveSheet:H,sheetCount:$,mkSheet:xe,emitModelData:W,scheduleOptEmit:q,themeColors:Ce,outerStyle:We,toolbarThemeVars:gt,wrapperRef:Ae,canvasRef:w,freezeCanvasRef:X,editInputRef:dt,formulaBarRef:Nt,viewSize:Ct,maxScrollX:oo,maxScrollY:Nn,clampScroll:Xt,canFocusHiddenEditor:tn,focusEditInput:Jt,onCanvasFocus:Ln,resetRowHeight:ln,resetColWidth:Un,modelData:B}}function Ei(e,l){let n=-1,o=-1;const a=(r,c)=>{Number.isInteger(r)&&r>=0&&r>n&&(n=r),Number.isInteger(c)&&c>=0&&c>o&&(o=c)},i=r=>{r&&a(Math.max(r.startCol,r.endCol),Math.max(r.startRow,r.endRow))};for(const r of Object.keys(e.cells)){const c=r.indexOf(",");c<0||a(Number(r.slice(0,c)),Number(r.slice(c+1)))}for(const r of Object.values(e.merges??{}))i(r);if(e.colWidths)for(const[r,c]of Object.entries(e.colWidths)){const s=Number(r);Number.isInteger(s)&&s>=0&&c>=30&&a(s,-1)}if(e.rowHeights)for(const[r,c]of Object.entries(e.rowHeights)){const s=Number(r);Number.isInteger(s)&&s>=0&&c!=null&&c>=24&&a(-1,s)}for(const r of e.conditionalFormats??[])for(const c of r.ranges??[])i(c);for(const r of e.dataValidations??[])for(const c of r.ranges??[])i(c);e.filter&&i(e.filter.range);for(const r of e.rowOutlines??[])a(-1,r.end);for(const r of e.columnOutlines??[])a(r.end,-1);return{colCount:Math.max(1,l.colCount,n+1),rowCount:Math.max(1,l.rowCount,o+1)}}function Ri(e){return!!e&&e.width!==void 0&&e.width>0}function Kt(e,l,n,o){const a=Ri(e),i=Ri(l);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return l;const r=!!e.owner,c=!!l.owner;if(r&&!c)return e;if(c&&!r)return l;const s=e.width??0,y=l.width??0;return s>y?e:y>s?l:e}function Si(e,l){if(!e||typeof e!="object")return null;const n=e,o=n.columns??{},a=Object.keys(o).map(r=>Number(r)).filter(r=>!Number.isNaN(r));if(!n.range||typeof n.range.startRow!="number"){const r=a.length?Math.min(...a):0,c=a.length?Math.max(...a):0;let s=0;for(const y in l){const h=y.indexOf(",");if(h<0)continue;const R=parseInt(y.substring(h+1),10);R>s&&(s=R)}return{range:{startCol:r,startRow:0,endCol:c,endRow:Math.max(0,s)},columns:o}}const i={...n.range};for(const r of a)r<i.startCol&&(i.startCol=r),r>i.endCol&&(i.endCol=r);return{range:i,columns:o}}function t2(e,l,n,o,a){let i=!1,r=null,c=1,s,y=()=>{},h=()=>{},R=()=>{};function f(){i||(i=!0,requestAnimationFrame(()=>{i=!1,O(),L()}))}e.scheduleRender=f;function E(u){const{frozenColumnsWidth:b}=e.getFrozenMetrics(),T=b>0&&u<ue()+b?u-ue():u-ue()+e.scrollX.value;return e.hitCol(T)}function k(u){const{frozenRowsHeight:b}=e.getFrozenMetrics(),T=b>0&&u<ie()+b?u-ie():u-ie()+e.scrollY.value;return e.hitRow(T)}let N=fi(e.props.theme);function Y(u,b,T,J,D,G,Q,ee){const ce=ba(ee,G);if(!ce){u.fillStyle=Q,T===D?u.fillRect(b,T,J-b,G):u.fillRect(b,T,G,D-T);return}if(u.save(),u.strokeStyle=Q,u.lineWidth=G,u.lineCap=ee==="dotted"?"round":"butt",u.setLineDash(ce),u.beginPath(),T===D){const re=T+G/2;u.moveTo(b,re),u.lineTo(J,re)}else{const re=b+G/2;u.moveTo(re,T),u.lineTo(re,D)}u.stroke(),u.setLineDash([]),u.restore()}const te=14,me=9,he=16,Te=Math.min(me-1,9);function pe(u){return 0}const Ee=()=>pe(),Le=()=>pe(),ue=()=>52+Ee(),ie=()=>24+Le();function tt(u,b){return he+2+(b-u.level)*me}function st(u,b){return 3+(b-u.level)*me}function Z(u,b){const T=new Int8Array(b).fill(-1);if(!u.length)return T;const J=[...u].sort((G,Q)=>G.start-Q.start),D=new Map;J.forEach((G,Q)=>D.set(G.id,Q%2));for(const G of J){const Q=D.get(G.id),ee=Math.min(G.end,b-1);for(let ce=Math.max(0,G.start);ce<=ee;ce++)T[ce]===-1&&(T[ce]=Q)}return T}function O(){const u=o.wrapperRef.value,b=o.canvasRef.value;if(!u||!b||(r=b.getContext("2d"),!r))return;c=window.devicePixelRatio||1;const T=u.getBoundingClientRect(),J=T.width,D=T.height;o.viewSize.w=J,o.viewSize.h=D,b.width=J*c,b.height=D*c,b.style.width=J+"px",b.style.height=D+"px",r.setTransform(c,0,0,c,0,0);const G=e.scrollX.value,Q=e.scrollY.value,ee=52,ce=24,re=Ee(),ze=Le(),Fe=ee+re,ot=ce+ze,S=o.themeColors.value,d=e.getFilter(),p=e.colPositions.value,C=e.rowPositions.value,F=Z(e.getRowOutlines(),e.rowCount),A=Z(e.getColumnOutlines(),e.colCount),{frozenRowsHeight:ae,frozenColumnsWidth:fe}=e.getFrozenMetrics(),we=Fe+fe,Se=ot+ae,Ye=Math.max(0,J-Fe-11-fe),Pe=Math.max(0,D-ot-11-ae),Je=Math.max(0,e.freeze.cols-1),et=Math.max(0,e.freeze.rows-1),pt=Math.max(e.freeze.cols,e.hitCol(fe+G));let Et=pt;for(let _=pt;_<e.colCount&&!(Fe+p[_]-G>=J);_++)Et=_;const Qt=Math.max(e.freeze.rows,e.hitRow(ae+Q));let en=Qt;for(let _=Qt;_<e.rowCount&&!(ot+C[_]-Q>=D);_++)en=_;let $n=pt,sn=Et,Cn=Qt,wn=en;fe>0&&($n=0,sn=Math.max(sn,Je)),ae>0&&(Cn=0,wn=Math.max(wn,et));let vn=$n,cn=Cn;for(const _ in e.merges){const Oe=e.merges[_];Oe&&(Oe.startRow>wn||Oe.endRow<Cn||Oe.startCol>sn||Oe.endCol<$n||(Oe.startCol<vn&&(vn=Oe.startCol),Oe.startRow<cn&&(cn=Oe.startRow)))}const Yn=new Array(cn);for(let _=cn;_<=wn;_++)Yn[_]=C[_+1]-C[_];r.fillStyle=S.bg,r.fillRect(0,0,J,D),r.fillStyle=S.gridBg,r.fillRect(Fe,ot,J-Fe,D-ot);const Vt=e.selection.value,wt=e.editingCell.value;y=(_,Oe,qe,kt,zt,Zt)=>{const Mt=e.dataValidations.length>0;for(let Me=kt;Me<=zt;Me++)if(!e.isRowCollapsed(Me))for(let Ke=Oe;Ke<=qe;Ke++){if(e.isColumnCollapsed(Ke)||e.findMerge(Ke,Me))continue;const Xe=e.cellToScreenRect(Me,Ke),je=Xe.x,ht=Xe.y,ft=Xe.width,rt=Xe.height;if(je+ft<Fe||ht+rt<ot||je>J||ht>D)continue;const Wt=e.findHighlight?e.findHighlight(Ke,Me):null,Ut=e.resolveStyle(e.cells[e.cellKey(Ke,Me)]),Bt=typeof(Ut==null?void 0:Ut.backgroundColor)=="string"?Ut.backgroundColor:"";Bt&&(_.fillStyle=Bt,_.fillRect(je,ht,ft,rt));const mt=e.resolveConditionalFormat(Ke,Me);if(mt!=null&&mt.backgroundColor&&(_.fillStyle=mt.backgroundColor,_.fillRect(je,ht,ft,rt)),Wt&&(_.fillStyle=Wt==="active"?S.findActiveBg:S.findMatchBg,_.fillRect(je,ht,ft,rt)),e.isSelected(Ke,Me)&&(_.fillStyle=S.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?_.fillRect(je,ht,(p[Ke+1]??0)-p[Ke],Zt[Me]):_.fillRect(je,ht,ft,rt)),e.activeCell.value.col===Ke&&e.activeCell.value.row===Me&&(_.strokeStyle=S.activeCellBorder,_.lineWidth=2,_.strokeRect(je+1,ht+1,ft-2,rt-2)),Wt==="active"&&(_.strokeStyle=S.findActiveBg,_.lineWidth=2,_.strokeRect(je+1,ht+1,ft-2,rt-2)),_.strokeStyle=S.gridLine,_.lineWidth=.5,_.strokeRect(je+.25,ht+.25,ft-.5,rt-.5),!(wt&&wt.col===Ke&&wt.row===Me)){const De=e.resolveStyle(e.cells[e.cellKey(Ke,Me)]),ge=e.getCellValue(Ke,Me),at=typeof(De==null?void 0:De.numberFormat)=="string"?De.numberFormat:"",Ze=ge?_n(ge,at,e.locale.value):"";if(Ze){const bt=e.cellFontSize(Ke,Me),Rt=typeof(De==null?void 0:De.fontFamily)=="string"&&De.fontFamily?De.fontFamily:Vo,It=(De==null?void 0:De.fontWeight)==="bold"||(mt==null?void 0:mt.fontWeight)==="bold"?"bold":"normal",kn=(De==null?void 0:De.fontStyle)==="italic"||(mt==null?void 0:mt.fontStyle)==="italic"?"italic":"normal",Zn=(De==null?void 0:De.underline)==="underline"||(mt==null?void 0:mt.underline)==="underline",so=(De==null?void 0:De.strikethrough)==="line-through"||(mt==null?void 0:mt.strikethrough)==="line-through",En=(mt==null?void 0:mt.color)||(typeof(De==null?void 0:De.color)=="string"?De.color:""),zn=typeof(De==null?void 0:De.textAlign)=="string"?De.textAlign:ar(ge,at)?"right":"left",Rn=typeof(De==null?void 0:De.verticalAlign)=="string"?De.verticalAlign:"top";_.fillStyle=En||S.cellText,_.font=`${kn} ${It} ${bt}px ${Rt}`,_.textBaseline="alphabetic",_.save(),_.beginPath(),_.rect(je+5,ht+1,ft-10,rt-2),_.clip();const co=(De==null?void 0:De.wrap)==="wrap";let dn=ft-10;d&&Me===d.range.startRow&&Ke>=d.range.startCol&&Ke<=d.range.endCol&&(dn=ft-10-Tt);let Vn=Ze;const Dn=!co&&aa(at),Jn=Ze===Sl||ia(ge,at);if(Jn||Dn){if(Jn){const Uo=Math.max(1,_.measureText("#").width),Rl=Math.max(1,Math.floor(dn/Uo));Vn="#".repeat(Rl)}else if(e.getWrappedLines(_,Ze,1e9,!1).some(vo=>vo&&_.measureText(vo).width>dn)){const vo=Math.max(1,_.measureText("#").width),ol=Math.max(1,Math.floor(dn/vo));Vn="#".repeat(ol)}}const pn=e.getWrappedLines(_,Vn,dn,co),{ascent:wo,descent:nl}=e.measureFontMetrics(Rt,bt,It,kn),Ql=wo+nl,B2=pn.length*Ql;let er;Rn==="middle"?er=ht+(rt-B2)/2+wo:Rn==="bottom"?er=ht+rt-e.BASE_CELL_VPAD-nl-(pn.length-1)*Ql:er=ht+e.BASE_CELL_VPAD+wo;for(let Uo=0;Uo<pn.length;Uo++){const Rl=pn[Uo],vo=er+Uo*Ql,ol=_.measureText(Rl);let To;if(zn==="center"?To=je+ft/2-ol.width/2:zn==="right"?To=je+ft-5-ol.width:To=je+5,_.fillText(Rl,To,vo),Zn&&(_.strokeStyle=En||S.cellText,_.lineWidth=1,_.beginPath(),_.moveTo(To,vo+nl+1),_.lineTo(To+ol.width,vo+nl+1),_.stroke()),so){_.strokeStyle=En||S.cellText,_.lineWidth=1;const Bi=vo-wo+Ql*.42;_.beginPath(),_.moveTo(To,Bi),_.lineTo(To+ol.width,Bi),_.stroke()}}_.restore()}}if(d&&Me===d.range.startRow&&Ke>=d.range.startCol&&Ke<=d.range.endCol&&K(_,je,ht,ft,rt,Oa(d.columns[Ke]),S),Mt&&e.getListValidation(Me,Ke)){const De=e.activeCell.value.col===Ke&&e.activeCell.value.row===Me;Xt(_,je,ht,ft,rt,De||e.isSelected(Ke,Me),S)}e.hasNote(Me,Ke)&&tn(_,je,ht,ft,rt)}};const St=(_,Oe,qe)=>{const kt=e.findMerge(_,Oe);return kt?e.getCellBorderSide(e.cells[kt.anchor],qe):e.getCellBorderSide(e.cells[e.cellKey(_,Oe)],qe)};h=(_,Oe,qe,kt,zt,Zt)=>{_.fillStyle=N;for(let Mt=kt;Mt<=zt;Mt++)if(!e.isRowCollapsed(Mt))for(let Me=Oe;Me<=qe;Me++){if(e.isColumnCollapsed(Me)||e.findMerge(Me,Mt))continue;const ut=e.cellToScreenRect(Mt,Me),Xe=ut.x,je=ut.y,ht=ut.width,ft=ut.height;if(Xe+ht<Fe||je+ft<ot||Xe>J||je>D)continue;const rt=e.cells[e.cellKey(Me,Mt)],Wt={top:e.getCellBorderSide(rt,"top"),right:e.getCellBorderSide(rt,"right"),bottom:e.getCellBorderSide(rt,"bottom"),left:e.getCellBorderSide(rt,"left")},Ut={top:St(Me,Mt-1,"bottom"),left:St(Me-1,Mt,"right"),bottom:St(Me,Mt+1,"top"),right:St(Me+1,Mt,"left")},Bt=Kt(Ut.top,Wt.top),mt=Kt(Ut.left,Wt.left),De=Kt(Wt.bottom,Ut.bottom),ge=Kt(Wt.right,Ut.right),at=(Bt==null?void 0:Bt.width)??0,Ze=(mt==null?void 0:mt.width)??0,bt=(De==null?void 0:De.width)??0,Rt=(ge==null?void 0:ge.width)??0;at>0&&Y(_,Xe,je,Xe+ht,je,at,(Bt==null?void 0:Bt.color)||N,un(Bt==null?void 0:Bt.style)),bt>0&&Y(_,Xe,je+ft-bt,Xe+ht,je+ft-bt,bt,(De==null?void 0:De.color)||N,un(De==null?void 0:De.style)),Ze>0&&Y(_,Xe,je,Xe,je+ft,Ze,(mt==null?void 0:mt.color)||N,un(mt==null?void 0:mt.style)),Rt>0&&Y(_,Xe+ht-Rt,je,Xe+ht-Rt,je+ft,Rt,(ge==null?void 0:ge.color)||N,un(ge==null?void 0:ge.style));const It=Me>0&&e.isColumnCollapsed(Me-1),kn=Me<e.colCount-1&&e.isColumnCollapsed(Me+1),Zn=Mt>0&&e.isRowCollapsed(Mt-1),so=Mt<e.rowCount-1&&e.isRowCollapsed(Mt+1),En=Me<e.freeze.cols&&(()=>{try{const Rn=_.canvas;return Rn?String(Rn.className||"")==="grid-canvas":!1}catch{return!1}})(),zn=Mt<e.freeze.rows&&(()=>{try{const Rn=_.canvas;return Rn?String(Rn.className||"")==="grid-canvas":!1}catch{return!1}})();at>0&&Ze>0&&!It&&!Zn&&(_.fillStyle=(Bt==null?void 0:Bt.color)||(mt==null?void 0:mt.color)||N,_.fillRect(Xe-Ze,je-at,Ze,at)),at>0&&Rt>0&&!kn&&!Zn&&!En&&(_.fillStyle=(Bt==null?void 0:Bt.color)||(ge==null?void 0:ge.color)||N,_.fillRect(Xe+ht,je-at,Rt,at)),bt>0&&Ze>0&&!It&&!so&&!zn&&(_.fillStyle=(De==null?void 0:De.color)||(mt==null?void 0:mt.color)||N,_.fillRect(Xe-Ze,je+ft,Ze,bt)),bt>0&&Rt>0&&!kn&&!so&&!En&&!zn&&(_.fillStyle=(De==null?void 0:De.color)||(ge==null?void 0:ge.color)||N,_.fillRect(Xe+ht,je+ft,Rt,bt))}};const jn=(_,Oe,qe,kt,zt,Zt,Mt)=>{const Me=e.resolveStyle(e.cells[e.cellKey(Oe,qe)]),Ke=e.getCellValue(Oe,qe),ut=typeof(Me==null?void 0:Me.numberFormat)=="string"?Me.numberFormat:"",Xe=Ke?_n(Ke,ut,e.locale.value):"";if(!Xe||kt-10<=0||zt-2<=0)return;const ht=e.cellFontSize(Oe,qe),ft=typeof(Me==null?void 0:Me.fontFamily)=="string"&&Me.fontFamily?Me.fontFamily:Vo,rt=e.resolveConditionalFormat(Oe,qe),Wt=(Me==null?void 0:Me.fontWeight)==="bold"||(rt==null?void 0:rt.fontWeight)==="bold"?"bold":"normal",Ut=(Me==null?void 0:Me.fontStyle)==="italic"||(rt==null?void 0:rt.fontStyle)==="italic"?"italic":"normal",Bt=(Me==null?void 0:Me.underline)==="underline"||(rt==null?void 0:rt.underline)==="underline",mt=(Me==null?void 0:Me.strikethrough)==="line-through"||(rt==null?void 0:rt.strikethrough)==="line-through",De=(rt==null?void 0:rt.color)||(typeof(Me==null?void 0:Me.color)=="string"?Me.color:""),ge=typeof(Me==null?void 0:Me.textAlign)=="string"?Me.textAlign:ar(Ke,ut)?"right":"left",at=typeof(Me==null?void 0:Me.verticalAlign)=="string"?Me.verticalAlign:"top";_.fillStyle=De||S.cellText,_.font=`${Ut} ${Wt} ${ht}px ${ft}`,_.textBaseline="alphabetic",_.save(),_.beginPath(),_.rect(Zt+5,Mt+1,kt-10,zt-2),_.clip();const Ze=(Me==null?void 0:Me.wrap)==="wrap",bt=kt-10;let Rt=Xe;const It=!Ze&&aa(ut),kn=Xe===Sl||ia(Ke,ut);if(kn||It){if(kn){const dn=Math.max(1,_.measureText("#").width),Vn=Math.max(1,Math.floor(bt/dn));Rt="#".repeat(Vn)}else if(e.getWrappedLines(_,Xe,1e9,!1).some(Dn=>Dn&&_.measureText(Dn).width>bt)){const Dn=Math.max(1,_.measureText("#").width),Jn=Math.max(1,Math.floor(bt/Dn));Rt="#".repeat(Jn)}}const Zn=e.getWrappedLines(_,Rt,bt,Ze),{ascent:so,descent:En}=e.measureFontMetrics(ft,ht,Wt,Ut),zn=so+En,Rn=Zn.length*zn;let co;at==="middle"?co=Mt+(zt-Rn)/2+so:at==="bottom"?co=Mt+zt-e.BASE_CELL_VPAD-En-(Zn.length-1)*zn:co=Mt+e.BASE_CELL_VPAD+so;for(let dn=0;dn<Zn.length;dn++){const Vn=Zn[dn],Dn=co+dn*zn,Jn=_.measureText(Vn);let pn;if(ge==="center"?pn=Zt+kt/2-Jn.width/2:ge==="right"?pn=Zt+kt-5-Jn.width:pn=Zt+5,_.fillText(Vn,pn,Dn),Bt&&(_.strokeStyle=De||S.cellText,_.lineWidth=1,_.beginPath(),_.moveTo(pn,Dn+En+1),_.lineTo(pn+Jn.width,Dn+En+1),_.stroke()),mt){_.strokeStyle=De||S.cellText,_.lineWidth=1;const wo=Dn-so+zn*.42;_.beginPath(),_.moveTo(pn,wo),_.lineTo(pn+Jn.width,wo),_.stroke()}}_.restore()},Xn=(_,Oe,qe,kt,zt,Zt,Mt,Me)=>{const Ke=Oe.startCol,ut=Oe.endCol,Xe=Oe.startRow,je=Oe.endRow,ht=kt,ft=Zt,rt=Mt&&ut+1===e.freeze.cols&&e.freeze.cols<e.colCount&&e.isColumnCollapsed(e.freeze.cols),Wt=Mt&&ut>=e.freeze.cols||rt,Ut=Me&&je+1===e.freeze.rows&&e.freeze.rows<e.rowCount&&e.isRowCollapsed(e.freeze.rows),Bt=Me&&je>=e.freeze.rows||Ut,mt=e.cells[e.cellKey(Ke,Xe)],De={top:e.getCellBorderSide(mt,"top"),right:e.getCellBorderSide(mt,"right"),bottom:e.getCellBorderSide(mt,"bottom"),left:e.getCellBorderSide(mt,"left")};_.fillStyle=N;for(let ge=Ke;ge<=ut;ge++){if(Mt&&ge>=e.freeze.cols||e.isSameMergeInternal(ge,Xe-1,ge,Xe))continue;const at=St(ge,Xe-1,"bottom"),Ze=Kt(at,De.top);if(Ze&&Ze.width&&Ze.width>0){const bt=ge<e.freeze.cols?ee+p[ge]:ee+p[ge]-G,Rt=(p[ge+1]??0)-p[ge];Y(_,bt,ht,bt+Rt,ht,Ze.width,Ze.color||N,un(Ze.style))}}if(!Bt)for(let ge=Ke;ge<=ut;ge++){if(Mt&&ge>=e.freeze.cols||e.isSameMergeInternal(ge,je,ge,je+1))continue;const at=St(ge,je+1,"top"),Ze=Kt(De.bottom,at);if(Ze&&Ze.width&&Ze.width>0){const bt=ge<e.freeze.cols?ee+p[ge]:ee+p[ge]-G,Rt=(p[ge+1]??0)-p[ge],It=ht+ft-Ze.width;Y(_,bt,It,bt+Rt,It,Ze.width,Ze.color||N,un(Ze.style))}}for(let ge=Xe;ge<=je;ge++){if(Me&&ge>=e.freeze.rows||e.isSameMergeInternal(Ke-1,ge,Ke,ge))continue;const at=St(Ke-1,ge,"right"),Ze=Kt(at,De.left);if(Ze&&Ze.width&&Ze.width>0){const bt=ge<e.freeze.rows?ce+C[ge]:ce+C[ge]-Q,Rt=C[ge+1]-C[ge];Y(_,qe,bt,qe,bt+Rt,Ze.width,Ze.color||N,un(Ze.style))}}if(!Wt)for(let ge=Xe;ge<=je;ge++){if(Me&&ge>=e.freeze.rows||e.isSameMergeInternal(ut,ge,ut+1,ge))continue;const at=St(ut+1,ge,"left"),Ze=Kt(De.right,at);if(Ze&&Ze.width&&Ze.width>0){const bt=ge<e.freeze.rows?ce+C[ge]:ce+C[ge]-Q,Rt=C[ge+1]-C[ge],It=qe+zt-Ze.width;Y(_,It,bt,It,bt+Rt,Ze.width,Ze.color||N,un(Ze.style))}}{const ge=e.isSameMergeInternal(Ke,Xe-1,Ke,Xe)?De.top:Kt(St(Ke,Xe-1,"bottom"),De.top),at=e.isSameMergeInternal(Ke-1,Xe,Ke,Xe)?De.left:Kt(St(Ke-1,Xe,"right"),De.left),Ze=(ge==null?void 0:ge.width)??0,bt=(at==null?void 0:at.width)??0,Rt=Ke>0&&e.isColumnCollapsed(Ke-1),It=Xe>0&&e.isRowCollapsed(Xe-1);Ze>0&&bt>0&&!Rt&&!It&&(_.fillStyle=(ge==null?void 0:ge.color)||(at==null?void 0:at.color)||N,_.fillRect(qe-bt,kt-Ze,bt,Ze))}if(!Wt){const ge=e.isSameMergeInternal(ut,Xe-1,ut,Xe)?De.top:Kt(St(ut,Xe-1,"bottom"),De.top),at=e.isSameMergeInternal(ut,Xe,ut+1,Xe)?De.right:Kt(De.right,St(ut+1,Xe,"left")),Ze=(ge==null?void 0:ge.width)??0,bt=(at==null?void 0:at.width)??0,Rt=ut<e.colCount-1&&e.isColumnCollapsed(ut+1),It=Xe>0&&e.isRowCollapsed(Xe-1);Ze>0&&bt>0&&!Rt&&!It&&(_.fillStyle=(ge==null?void 0:ge.color)||(at==null?void 0:at.color)||N,_.fillRect(qe+zt,kt-Ze,bt,Ze))}if(!Bt){const ge=e.isSameMergeInternal(Ke,je,Ke,je+1)?De.bottom:Kt(De.bottom,St(Ke,je+1,"top")),at=e.isSameMergeInternal(Ke-1,je,Ke,je)?De.left:Kt(St(Ke-1,je,"right"),De.left),Ze=(ge==null?void 0:ge.width)??0,bt=(at==null?void 0:at.width)??0,Rt=Ke>0&&e.isColumnCollapsed(Ke-1),It=je<e.rowCount-1&&e.isRowCollapsed(je+1);Ze>0&&bt>0&&!Rt&&!It&&(_.fillStyle=(ge==null?void 0:ge.color)||(at==null?void 0:at.color)||N,_.fillRect(qe-bt,kt+Zt,bt,Ze))}if(!Wt&&!Bt){const ge=e.isSameMergeInternal(ut,je,ut,je+1)?De.bottom:Kt(De.bottom,St(ut,je+1,"top")),at=e.isSameMergeInternal(ut,je,ut+1,je)?De.right:Kt(De.right,St(ut+1,je,"left")),Ze=(ge==null?void 0:ge.width)??0,bt=(at==null?void 0:at.width)??0,Rt=ut<e.colCount-1&&e.isColumnCollapsed(ut+1),It=je<e.rowCount-1&&e.isRowCollapsed(je+1);Ze>0&&bt>0&&!Rt&&!It&&(_.fillStyle=(ge==null?void 0:ge.color)||(at==null?void 0:at.color)||N,_.fillRect(qe+zt,kt+Zt,bt,Ze))}};R=(_,Oe,qe,kt,zt)=>{var ut,Xe;const Zt=Oe+kt,Mt=qe+zt,Me=Oe<we,Ke=qe<Se;for(const je in e.merges){const ht=e.merges[je];if(!ht)continue;const ft=ht.startCol,rt=ht.startRow,Wt=ht.endCol,Ut=ht.endRow,Bt=e.cellToScreenRect(rt,ft),mt=e.cellToScreenRect(Ut,Wt),De=Bt.x,ge=Bt.y,at=mt.x+mt.width-De,Ze=mt.y+mt.height-ge,bt=Me&&Wt>=e.freeze.cols?Math.min(Zt,we):Math.min(De+at,Zt),Rt=Ke&&Ut>=e.freeze.rows?Math.min(Mt,Se):Math.min(ge+Ze,Mt),It=Math.max(De,Oe),kn=Math.max(ge,qe);if(bt<=It||Rt<=kn)continue;const Zn=(ut=e.resolveStyle(e.cells[e.cellKey(ft,rt)]))==null?void 0:ut.backgroundColor,En=((Xe=e.resolveConditionalFormat(ft,rt))==null?void 0:Xe.backgroundColor)||Zn;En&&(_.fillStyle=En,_.fillRect(It,kn,bt-It,Rt-kn)),e.isSelected(ft,rt)&&(_.fillStyle=S.selectionBg,_.fillRect(It,kn,bt-It,Rt-kn)),_.strokeStyle=S.gridLine,_.lineWidth=.5;const zn=De+.25,Rn=ge+.25,co=bt-De-.5,dn=Rt-ge-.5;if(co>0&&dn>0&&_.strokeRect(zn,Rn,co,dn),Xn(_,ht,De,ge,at,Ze,Me,Ke),e.activeCell.value.col===ft&&e.activeCell.value.row===rt&&(_.strokeStyle=S.activeCellBorder,_.lineWidth=2,_.strokeRect(De+1,ge+1,at-2,Ze-2)),e.getListValidation(rt,ft)){const Vn=e.activeCell.value.col===ft&&e.activeCell.value.row===rt;Xt(_,De,ge,at,Ze,Vn,S)}if(e.hasNote(rt,ft)&&tn(_,De,ge,at,Ze),!(e.editingCell.value&&e.editingCell.value.col===ft&&e.editingCell.value.row===rt)){const Vn=p[Wt+1]-p[ft],Dn=C[Ut+1]-C[rt],Jn=ft<e.freeze.cols,pn=rt<e.freeze.rows,wo=Me?De:Jn?De-G:De,nl=Ke?ge:pn?ge-Q:ge;jn(_,ft,rt,Vn,Dn,wo,nl)}}},r.save(),r.beginPath();const Wo=fe>0?2:0,_t=ae>0?2:0;r.rect(we-Wo,Se-_t,Ye+Wo,Pe+_t),r.clip(),y(r,vn,sn,cn,wn,Yn),h(r,vn,sn,cn,wn,Yn),R(r,we,Se,Ye,Pe),r.restore(),fe>0&&(r.strokeStyle=S.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(we+.5,ce),r.lineTo(we+.5,D),r.stroke()),ae>0&&(r.strokeStyle=S.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ee,Se+.5),r.lineTo(J,Se+.5),r.stroke()),r.fillStyle=S.headerBg,r.fillRect(Fe,ze,J-Fe,ce);for(let _=pt;_<=Et;_++){const Oe=Fe+p[_]-G;if(e.isColumnCollapsed(_))continue;const qe=(p[_+1]??0)-p[_];if(Oe+qe<Fe||Oe>J)continue;const kt=A[_];kt===0?(r.fillStyle=S.outlineGroupBg1,r.fillRect(Oe,ze,qe,ce)):kt===1&&(r.fillStyle=S.outlineGroupBg2,r.fillRect(Oe,ze,qe,ce)),Vt&&_>=Vt.startCol&&_<=Vt.endCol&&(r.fillStyle=S.selectionBg,r.fillRect(Oe,ze,qe,ce)),r.strokeStyle=S.headerBorder,r.lineWidth=.5,r.strokeRect(Oe+.25,ze+.25,qe-.5,ce-.5),Vt&&_>=Vt.startCol&&_<=Vt.endCol&&(r.strokeStyle=S.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Oe,ze+ce-1),r.lineTo(Oe+qe,ze+ce-1),r.stroke()),r.fillStyle=S.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(yt(_),Oe+qe/2,ze+ce/2)}if(fe>0){r.fillStyle=S.headerBg,r.fillRect(Fe,ze,fe,ce);for(let _=0;_<=Je;_++){const Oe=Fe+p[_];if(e.isColumnCollapsed(_))continue;const qe=(p[_+1]??0)-p[_];Oe+qe<Fe||Oe>J||(Vt&&_>=Vt.startCol&&_<=Vt.endCol&&(r.fillStyle=S.selectionBg,r.fillRect(Oe,ze,qe,ce)),r.strokeStyle=S.headerBorder,r.lineWidth=.5,r.strokeRect(Oe+.25,ze+.25,qe-.5,ce-.5),Vt&&_>=Vt.startCol&&_<=Vt.endCol&&(r.strokeStyle=S.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Oe,ze+ce-1),r.lineTo(Oe+qe,ze+ce-1),r.stroke()),r.fillStyle=S.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(yt(_),Oe+qe/2,ze+ce/2))}}r.strokeStyle=S.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Fe,ot+.5),r.lineTo(J,ot+.5),r.stroke(),r.fillStyle=S.headerBg,r.fillRect(0,ot,Fe,D-ot);for(let _=Qt;_<=en;_++){if(e.isRowHidden(_))continue;const Oe=ot+C[_]-Q,qe=Yn[_];if(Oe+qe<ot||Oe>D)continue;const kt=F[_];kt===0?(r.fillStyle=S.outlineGroupBg1,r.fillRect(re,Oe,ee,qe)):kt===1&&(r.fillStyle=S.outlineGroupBg2,r.fillRect(re,Oe,ee,qe)),Vt&&_>=Vt.startRow&&_<=Vt.endRow&&(r.fillStyle=S.selectionBg,r.fillRect(re,Oe,ee,qe)),r.strokeStyle=S.headerBorder,r.lineWidth=.5,r.strokeRect(re+.25,Oe+.25,ee-.5,qe-.5),Vt&&_>=Vt.startRow&&_<=Vt.endRow&&(r.strokeStyle=S.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(re+ee-1,Oe),r.lineTo(re+ee-1,Oe+qe),r.stroke()),r.fillStyle=S.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(_+1),re+ee/2,Oe+qe/2+.5)}if(ae>0){r.fillStyle=S.headerBg,r.fillRect(0,ot,Fe,ae);for(let _=0;_<=et;_++){if(e.isRowHidden(_))continue;const Oe=ot+C[_],qe=Yn[_];Oe+qe<ot||Oe>D||(Vt&&_>=Vt.startRow&&_<=Vt.endRow&&(r.fillStyle=S.selectionBg,r.fillRect(re,Oe,ee,qe)),r.strokeStyle=S.headerBorder,r.lineWidth=.5,r.strokeRect(re+.25,Oe+.25,ee-.5,qe-.5),Vt&&_>=Vt.startRow&&_<=Vt.endRow&&(r.strokeStyle=S.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(re+ee-1,Oe),r.lineTo(re+ee-1,Oe+qe),r.stroke()),r.fillStyle=S.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(_+1),re+ee/2,Oe+qe/2+.5))}}r.strokeStyle=S.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Fe+.5,ot),r.lineTo(Fe+.5,D),r.stroke(),r.fillStyle=S.headerBg,r.fillRect(re,ze,ee,ce),r.strokeStyle=S.headerSep,r.lineWidth=1,r.strokeRect(re+.5,ze+.5,ee-1,ce-1);const Ht=Math.min(ee,ce)*.32;r.fillStyle=S.activeCellBorder,r.beginPath(),r.moveTo(re+ee-1,ze+ce-1-Ht),r.lineTo(re+ee-1-Ht,ze+ce-1),r.lineTo(re+ee-1,ze+ce-1),r.closePath(),r.fill();const Co=e.getOutlineLevel("row"),tl=e.getOutlineLevel("column");if(e.getRowOutlines().length)for(const _ of e.getRowOutlines()){const Oe=tt(_,Co),qe=ot+C[_.start]-Q,kt=Oe-Te/2,zt=qe-Te/2;r.fillStyle=S.headerBg,r.strokeStyle=S.headerText,r.lineWidth=1,Nn(r,Math.round(kt),Math.round(zt),Te,Te,2),r.fill(),r.stroke(),r.strokeStyle=S.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Oe-2,qe),r.lineTo(Oe+2,qe),r.stroke(),_.collapsed&&(r.beginPath(),r.moveTo(Oe,qe-2),r.lineTo(Oe,qe+2),r.stroke())}if(e.getColumnOutlines().length)for(const _ of e.getColumnOutlines()){const Oe=st(_,tl),qe=Fe+p[_.start]-G,kt=qe-Te/2,zt=Oe-Te/2;r.fillStyle=S.headerBg,r.strokeStyle=S.headerText,r.lineWidth=1,Nn(r,Math.round(kt),Math.round(zt),Te,Te,2),r.fill(),r.stroke(),r.strokeStyle=S.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(qe-2,Oe),r.lineTo(qe+2,Oe),r.stroke(),_.collapsed&&(r.beginPath(),r.moveTo(qe,Oe-2),r.lineTo(qe,Oe+2),r.stroke())}oe(r,S),$e(r,S)}function L(){const u=o.freezeCanvasRef.value,b=o.wrapperRef.value;if(!u||!b)return;const T=u.getContext("2d");if(!T)return;const J=b.getBoundingClientRect(),D=J.width,G=J.height,Q=52,ee=24,ce=Ee(),re=Le(),ze=Q+ce,Fe=ee+re,ot=o.themeColors.value,S=e.colPositions.value,d=e.rowPositions.value,p=e.scrollX.value,C=e.scrollY.value;u.width=D*c,u.height=G*c,u.style.width=D+"px",u.style.height=G+"px",T.setTransform(c,0,0,c,0,0),T.clearRect(0,0,D,G);const{frozenRowsHeight:F,frozenColumnsWidth:A}=e.getFrozenMetrics(),ae=ze+A,fe=Fe+F,we=Math.max(0,D-ze-11-A),Se=Math.max(0,G-Fe-11-F),Ye=Math.max(0,e.freeze.cols-1),Pe=Math.max(0,e.freeze.rows-1),Je=Math.max(e.freeze.cols,e.hitCol(A+p));let et=Je;for(let wt=Je;wt<e.colCount&&!(ze+S[wt]-p>=D);wt++)et=wt;const pt=Math.max(e.freeze.rows,e.hitRow(F+C));let Et=pt;for(let wt=pt;wt<e.rowCount&&!(Fe+d[wt]-C>=G);wt++)Et=wt;let Qt=Je,en=et,$n=pt,sn=Et;A>0&&(Qt=0,en=Math.max(en,Ye)),F>0&&($n=0,sn=Math.max(sn,Pe));let Cn=Qt,wn=$n;for(const wt in e.merges){const St=e.merges[wt];St&&(St.startRow>sn||St.endRow<$n||St.startCol>en||St.endCol<Qt||(St.startCol<Cn&&(Cn=St.startCol),St.startRow<wn&&(wn=St.startRow)))}const vn=new Array(wn);for(let wt=wn;wt<=sn;wt++)vn[wt]=d[wt+1]-d[wt];const cn=(wt,St,jn)=>{const Xn=e.findMerge(wt,St);return Xn?e.getCellBorderSide(e.cells[Xn.anchor],jn):e.getCellBorderSide(e.cells[e.cellKey(wt,St)],jn)},Yn=(wt,St,jn,Xn,Wo)=>{wt.fillStyle=N;for(let _t=Xn;_t<=Wo;_t++)for(let Ht=St;Ht<=jn;Ht++){if(e.isRowCollapsed(_t)||e.isColumnCollapsed(Ht))continue;const Co=e.findMerge(Ht,_t);if(Co&&!(Ht===Co.range.startCol&&_t===Co.range.startRow))continue;const tl=e.cellToScreenRect(_t,Ht),_=tl.x,Oe=tl.y,qe=tl.width,kt=tl.height;if(_+qe<ze||Oe+kt<Fe||_>D||Oe>G)continue;const zt=e.cells[e.cellKey(Ht,_t)],Zt={top:e.getCellBorderSide(zt,"top"),right:e.getCellBorderSide(zt,"right"),bottom:e.getCellBorderSide(zt,"bottom"),left:e.getCellBorderSide(zt,"left")};if(Co)continue;const Mt={top:cn(Ht,_t-1,"bottom"),left:cn(Ht-1,_t,"right"),bottom:cn(Ht,_t+1,"top"),right:cn(Ht+1,_t,"left")},Me=Kt(Mt.top,Zt.top),Ke=Kt(Mt.left,Zt.left),ut=Kt(Zt.bottom,Mt.bottom),Xe=Kt(Zt.right,Mt.right),je=(Me==null?void 0:Me.width)??0,ht=(Ke==null?void 0:Ke.width)??0,ft=(ut==null?void 0:ut.width)??0,rt=(Xe==null?void 0:Xe.width)??0;je>0&&Y(wt,_,Oe,_+qe,Oe,je,(Me==null?void 0:Me.color)||N,un(Me==null?void 0:Me.style)),ft>0&&Y(wt,_,Oe+kt-ft,_+qe,Oe+kt-ft,ft,(ut==null?void 0:ut.color)||N,un(ut==null?void 0:ut.style)),ht>0&&Y(wt,_,Oe,_,Oe+kt,ht,(Ke==null?void 0:Ke.color)||N,un(Ke==null?void 0:Ke.style)),rt>0&&Y(wt,_+qe-rt,Oe,_+qe-rt,Oe+kt,rt,(Xe==null?void 0:Xe.color)||N,un(Xe==null?void 0:Xe.style));const Wt=Ht>0&&e.isColumnCollapsed(Ht-1),Ut=Ht<e.colCount-1&&e.isColumnCollapsed(Ht+1),Bt=_t>0&&e.isRowCollapsed(_t-1),mt=_t<e.rowCount-1&&e.isRowCollapsed(_t+1),De=Ht<e.freeze.cols,ge=_t<e.freeze.rows;je>0&&ht>0&&!Wt&&!Bt&&(wt.fillStyle=(Me==null?void 0:Me.color)||(Ke==null?void 0:Ke.color)||N,wt.fillRect(_-ht,Oe-je,ht,je)),je>0&&rt>0&&!Ut&&!Bt&&!De&&(wt.fillStyle=(Me==null?void 0:Me.color)||(Xe==null?void 0:Xe.color)||N,wt.fillRect(_+qe,Oe-je,rt,je)),ft>0&&ht>0&&!Wt&&!mt&&!ge&&(wt.fillStyle=(ut==null?void 0:ut.color)||(Ke==null?void 0:Ke.color)||N,wt.fillRect(_-ht,Oe+kt,ht,ft)),ft>0&&rt>0&&!Ut&&!mt&&!De&&!ge&&(wt.fillStyle=(ut==null?void 0:ut.color)||(Xe==null?void 0:Xe.color)||N,wt.fillRect(_+qe,Oe+kt,rt,ft))}},Vt=(wt,St,jn,Xn,Wo,_t,Ht,Co)=>{jn<=0||Xn<=0||(T.save(),T.beginPath(),T.rect(wt,St,jn,Xn),T.clip(),T.fillStyle=ot.gridBg,T.fillRect(wt,St,jn,Xn),y(T,Wo,_t,Ht,Co,vn),Yn(T,Wo,_t,Ht,Co),R(T,wt,St,jn,Xn),T.restore())};A>0&&F>0&&Vt(Q,ee,A,F,0,Ye,0,Pe),F>0&&Vt(ae,ee,we,F,Cn,en,0,Pe),A>0&&Vt(Q,fe,A,Se,0,Ye,wn,sn),T.strokeStyle=ot.headerSep,T.lineWidth=1,A>0&&(T.beginPath(),T.moveTo(ae+.5,ee),T.lineTo(ae+.5,G),T.stroke()),F>0&&(T.beginPath(),T.moveTo(Q,fe+.5),T.lineTo(D,fe+.5),T.stroke()),T.fillStyle=ot.headerBg,T.fillRect(0,0,Q,ee),T.strokeStyle=ot.headerSep,T.lineWidth=1,T.strokeRect(.5,.5,Q-.5,ee-.5),oe(T,ot),$e(T,ot)}function oe(u,b){const T=e.selection.value;if(!T||e.editingCell.value)return;const J=e.cellToScreenRect(T.endRow,T.endCol),D=J.x+J.width-6/2,G=J.y+J.height-6/2;if(D<ue()||G<ie())return;const{frozenColumnsWidth:Q,frozenRowsHeight:ee}=e.getFrozenMetrics();if(Q>0&&T.endCol>=e.freeze.cols&&D<ue()+Q||ee>0&&T.endRow>=e.freeze.rows&&G<ie()+ee)return;const ce=gr(T,T,e.merges).ok;u.fillStyle=ce?b.activeCellBorder:b.scrollTrack,u.fillRect(D,G,6,6),u.strokeStyle="#fff",u.lineWidth=1,u.strokeRect(D+.5,G+.5,6-1,6-1)}function $e(u,b){const T=e.autoFillState.value;if(!T.active||!T.preview||!T.targetRange)return;const J=T.targetRange,D=e.cellToScreenRect(J.startRow,J.startCol),G=e.cellToScreenRect(J.endRow,J.endCol),Q=D.x,ee=D.y,ce=G.x+G.width-Q,re=G.y+G.height-ee;ee<ie()||Q<ue()||(u.fillStyle=b.selectionBg,u.fillRect(Q,ee,ce,re),u.strokeStyle=b.activeCellBorder,u.lineWidth=1.5,u.setLineDash([4,3]),u.strokeRect(Q+.5,ee+.5,ce-1,re-1),u.setLineDash([]))}const lt=t.computed(()=>yt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),ne=t.ref(""),xe=t.ref(!1),Ne=t.computed(()=>e.editingCell.value?ne.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(u,b)=>{if(u&&!b){const T=e.editValue.value||e.getCellRaw(u.col,u.row)||"";ne.value=T,Ge=!1}else!u&&b&&(ne.value="",xe.value=!1,Ge=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(ne.value="",Ge=!1)});function se(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f())}function de(u){const b=u.target.value;e.editingCell.value?e.editValue.value=b:e.startEdit(b),ne.value=b,Ge=!0}function Be(u){var T,J;const b={...e.activeCell.value};e.editingCell.value?(e.editValue.value=u,e.commitEdit()):((T=e.saveUndo)==null||T.call(e),e.setCellValue(b.col,b.row,u)),ne.value="",Ge=!1,f(),(J=o.emitModelData)==null||J.call(o)}let _e=!1,Ge=!1;function ct(){var G,Q,ee;if(_e)return;const u=o.formulaBarRef.value,b=!!(u&&typeof document<"u"&&document.activeElement===u);if(!e.editingCell.value&&!b&&!Ge)return;const T={...e.activeCell.value},J=e.editingCell.value?e.editingCell.value.col:T.col,D=e.editingCell.value?e.editingCell.value.row:T.row;if(!e.editingCell.value){const ce=e.getCellRaw(J,D),re=ne.value!==ce;if(!Ge)return;_e=!0,re&&((G=e.saveUndo)==null||G.call(e),e.setCellValue(J,D,ne.value),f(),(Q=o.emitModelData)==null||Q.call(o)),(ee=o.formulaBarRef.value)==null||ee.blur(),ne.value="",xe.value=!1,Ge=!1,t.nextTick(()=>{_e=!1});return}_e=!0,Ge?(e.editValue.value=ne.value,e.commitEdit().then(ce=>{var re,ze;ce&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(re=o.formulaBarRef.value)==null||re.blur(),ne.value="",xe.value=!1,Ge=!1,f(),o.focusEditInput(),(ze=o.emitModelData)==null||ze.call(o),t.nextTick(()=>{_e=!1})})):b?(ne.value=e.editValue.value,e.commitEdit().then(ce=>{var re,ze;ce&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(re=o.formulaBarRef.value)==null||re.blur(),ne.value="",xe.value=!1,Ge=!1,f(),o.focusEditInput(),(ze=o.emitModelData)==null||ze.call(o),t.nextTick(()=>{_e=!1})})):e.commitEdit().then(()=>{var ce,re;(ce=o.formulaBarRef.value)==null||ce.blur(),ne.value="",xe.value=!1,Ge=!1,f(),o.focusEditInput(),(re=o.emitModelData)==null||re.call(o),t.nextTick(()=>{_e=!1})})}function nt(){var u;_e||(_e=!0,e.editingCell.value&&e.cancelEdit(),(u=o.formulaBarRef.value)==null||u.blur(),ne.value="",xe.value=!1,Ge=!1,f(),o.focusEditInput(),t.nextTick(()=>{_e=!1}))}function I(u){if(!u.isComposing){if(u.key==="Enter"&&(u.altKey||u.metaKey)&&!u.ctrlKey){u.preventDefault(),u.stopPropagation();const b=u.target;if(!b)return;e.editingCell.value||e.startEdit();const T=b.selectionStart??b.value.length,J=b.selectionEnd??b.value.length,D=b.value,G=D.substring(0,T)+`
|
|
7
|
-
`+D.substring(J),Q=T+1;ne.value=G,xe.value||(xe.value=!0),t.nextTick(()=>{try{b.setSelectionRange(Q,Q)}catch{}if(xe.value)try{b.scrollTop=b.scrollHeight}catch{}try{b.focus({preventScroll:!0})}catch{}});return}u.key==="Enter"?(u.preventDefault(),ct()):u.key==="Escape"&&(u.preventDefault(),nt())}}function H(){ct()}const $=t.ref(null),V=t.ref("");function B(u){$.value===null&&(o.switchSheet(u),f())}function W(u){u!==o.activeSheetIndex.value&&(o.saveSheet(),o.loadSheet(u),f()),$.value=u,V.value=o.sheets.value[u].name,t.nextTick(()=>{const b=document.querySelector(".tab-rename-input");b==null||b.focus(),b==null||b.select()})}function z(){$.value!==null&&(o.renameSheet($.value,V.value),t.nextTick(()=>o.emitModelData())),$.value=null,V.value=""}function q(){$.value=null,V.value=""}function Ce(u){u.key==="Enter"?(u.preventDefault(),z()):u.key==="Escape"&&(u.preventDefault(),q())}const We=t.ref(null);t.watch(We,u=>{u===null&&Ue()});const gt=t.ref(null);function Ae(u,b,T){gt.value={mode:T,row:u,col:b}}function w(){gt.value=null}function X(u,b){Ae(u,b,"edit")}function dt(u,b,T,J){const D=e.getNote(u,b);T?D?e.updateCellNote(D.id,T):e.setCellNote(u,b,T,J||Zr):D&&e.deleteCellNote(u,b),w(),f()}function Nt(u,b){e.deleteCellNote(u,b),w(),f()}function Ct(u,b){if(u<ue()||b<ie())return null;const T=e.screenToCell(u,b);if(!T)return null;const{col:J,row:D}=T;if(!e.hasNote(D,J))return null;const G=e.cellToScreenRect(D,J),Q=5,ee=G.x+G.width-1.5,ce=G.y+1.5,re=u-ee,ze=b-ce;return re<=1&&ze>=-1&&ze-re<=Q+1?{row:D,col:J}:null}const $t=t.ref(null),xt=t.ref(null),Tt=18,jt=2,Mn=2,oo=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 Nn(u,b,T,J,D,G){const Q=Math.min(G,J/2,D/2);u.beginPath(),u.moveTo(b+Q,T),u.arcTo(b+J,T,b+J,T+D,Q),u.arcTo(b+J,T+D,b,T+D,Q),u.arcTo(b,T+D,b,T,Q),u.arcTo(b,T,b+J,T,Q),u.closePath()}function Xt(u,b,T,J,D,G,Q){if(J<te+4||D<10)return;const ee=b+J-te,ce=T+1,re=D-2;u.save(),G&&(u.fillStyle=Q.selectionBg,u.fillRect(ee,ce,te,re)),u.fillStyle=Q.activeCellBorder;const ze=6,Fe=4,ot=ee+te/2,S=ce+re/2;u.beginPath(),u.moveTo(ot-ze/2,S-Fe/2+.5),u.lineTo(ot+ze/2,S-Fe/2+.5),u.lineTo(ot,S+Fe/2+.5),u.closePath(),u.fill(),u.restore()}function tn(u,b,T,J,D){if(J<8||D<8)return;const G=5,Q=b+J-1.5,ee=T+1.5;u.save(),u.fillStyle="#d93025",u.beginPath(),u.moveTo(Q,ee),u.lineTo(Q-G,ee),u.lineTo(Q,ee+G),u.closePath(),u.fill(),u.restore()}function Jt(u,b){if(e.dataValidations.length===0)return null;const T=e.screenToCell(u,b);if(!T)return null;const J=e.findMerge(T.col,T.row),D=J?J.range.startCol:T.col,G=J?J.range.startRow:T.row;if(!e.getListValidation(G,D))return null;const Q=e.cellToScreenRect(G,D);if(Q.width<te+4)return null;const ee=Q.x+Q.width-te;return u<ee||u>Q.x+Q.width||b<Q.y||b>Q.y+Q.height?null:{col:D,row:G}}function Ln(u,b){const T=e.getValidationDropdown(b,u);if(!T)return!1;const J=o.canvasRef.value;if(!J)return!1;e.activeCell.value.col===u&&e.activeCell.value.row===b||e.selectCell(u,b),e.ensureVisible(u,b),f();const D=e.cellToScreenRect(b,u),G=J.getBoundingClientRect();return xt.value={col:u,row:b,rule:T.rule,items:T.items,current:e.getCellRaw(u,b),x:G.left+D.x,y:G.top+D.y,width:D.width,height:D.height},!0}function ln(){xt.value&&(xt.value=null,f())}async function Un(u){var G;const b=xt.value;if(!b)return;const{col:T,row:J}=b;xt.value=null;const D=e.validateCell(J,T,u);if(!D.valid&&await e.confirmInvalidValue(D,T,J)!=="continue"){f(),o.focusEditInput();return}l.saveUndo(),e.setCellValue(T,J,u),(G=e.emitModelData)==null||G.call(e),f(),o.focusEditInput()}function K(u,b,T,J,D,G,Q){const ee=Math.min(J,Tt)-jt,ce=b+J-ee-jt,re=T+jt,ze=D-2*jt;u.save(),u.fillStyle=G?Q.activeCellBorder:"#ececec",Nn(u,ce,re,ee,ze,Mn),u.fill();const Fe=Math.min(ee,ze)*.72;u.translate(ce+ee/2,re+ze/2),u.scale(Fe/1024,Fe/1024),u.translate(-512,-512),u.fillStyle=G?"#ffffff":"#5a5a5a",u.fill(oo),u.restore()}function U(u,b){const T=e.getFilter();if(!T)return-1;const J=e.screenToCell(u,b);if(!J)return-1;const{col:D,row:G}=J;if(G!==T.range.startRow||D<T.range.startCol||D>T.range.endCol)return-1;const Q=e.cellToScreenRect(G,D),ee=Math.min(Q.width,Tt)-jt,ce=Q.x+Q.width-ee-jt,re=Q.x+Q.width-jt;return u>=ce&&u<=re&&b>=Q.y+jt&&b<=Q.y+Q.height-jt?D:-1}function j(u){const b=e.getFilter();if(!b)return;const T=o.canvasRef.value;if(!T)return;const J=T.getBoundingClientRect(),D=e.cellToScreenRect(b.range.startRow,u);$t.value={col:u,x:J.left+D.x+D.width-Tt,y:J.top+D.y+2}}function ye(){$t.value=null}let ve=null,Ve=null;function Ue(){ve&&(document.removeEventListener("click",ve),ve=null),Ve&&(document.removeEventListener("touchstart",Ve,{capture:!0}),Ve=null)}function ke(u,b){const T=e.getOutlineLevel("row"),J=e.getOutlineLevel("column"),D=e.rowPositions.value,G=e.colPositions.value,Q=e.scrollX.value,ee=e.scrollY.value,ce=Te/2+1;if(b>=ie())for(const re of e.getRowOutlines()){const ze=tt(re,T),Fe=ie()+D[re.start]-ee;if(Math.abs(u-ze)<=ce&&Math.abs(b-Fe)<=ce)return{kind:"toggle",outlineId:re.id}}if(u>=ue())for(const re of e.getColumnOutlines()){const ze=st(re,J),Fe=ue()+G[re.start]-Q;if(Math.abs(b-ze)<=ce&&Math.abs(u-Fe)<=ce)return{kind:"toggle",outlineId:re.id}}return null}function He(u){for(const b of u)e.removeOutline(b);o.emitModelData(),f()}function be(u){const b=e.selection.value;if(!b)return P("outlineNeedRowsOrColumns"),!1;let T;if(u==="row"){if(b.startCol!==0||b.endCol!==e.colCount-1)return P("outlineNeedRowsOrColumns"),!1;if(b.startRow===b.endRow)return P("outlineInvalidRange"),!1;T=e.addRowGroup(b.startRow,b.endRow)}else{if(b.startRow!==0||b.endRow!==e.rowCount-1)return P("outlineNeedRowsOrColumns"),!1;if(b.startCol===b.endCol)return P("outlineInvalidRange"),!1;T=e.addColumnGroup(b.startCol,b.endCol)}return T.ok?!0:(P(T.code==="outlineCrossing"?"outlineCrossing":T.code==="outlineTooDeep"?"outlineTooDeep":"outlineInvalidRange"),!1)}function Qe(u){const b=e.selection.value;if(!b||u==="row"&&(b.startCol!==0||b.endCol!==e.colCount-1)||u==="column"&&(b.startRow!==0||b.endRow!==e.rowCount-1))return P("outlineNeedRowsOrColumns"),!1;const T=u==="row"?e.getRowOutlines():e.getColumnOutlines(),J=u==="row"?b.startRow:b.startCol,D=u==="row"?b.endRow:b.endCol,G=T.filter(Q=>J<=Q.start&&Q.end<=D);return G.length?(He(G.map(Q=>Q.id)),!0):(P("outlineUngroupPartial"),!1)}function v(u,b){const T=u==="row"?e.getRowOutlines():e.getColumnOutlines();if(T.length&&!T.every(J=>J.collapsed===b)){l.saveUndo();for(const J of T)e.setOutlineCollapsed(J.id,b,!0);o.emitModelData(),f()}}function P(u){const b=g(e.locale.value,u);if(s){s(b);return}window.alert(b)}function le(u,b,T){Ue();const J=140,D=T.length*28+8,G=Fn(o.wrapperRef.value),Q=G.right,ee=G.bottom;u+J>Q&&(u-=J),b+D>ee&&(b-=D),Re.value=!1,We.value={x:u,y:b,items:T},t.nextTick(()=>x()),ve=()=>{We.value=null,Ue()},Ve=ce=>{const re=ce.target;re&&re.closest(".context-menu")||(We.value=null,Ue())},setTimeout(()=>{document.addEventListener("click",ve,{once:!0}),document.addEventListener("touchstart",Ve,{capture:!0})},0)}const Re=t.ref(!1);function Ie(u,b){}function x(){const b=document.querySelector(".context-menu"),T=We.value;if(!b||!T){Re.value=!1;return}const J=T.x+140,D=Fn(o.wrapperRef.value),G=D.right,Q=D.bottom,ee=b.style.transform;b.style.transform="none";let ce=0;if(b.querySelectorAll(".context-menu__item").forEach(ze=>{const Fe=ze.querySelector(":scope > .context-submenu");if(!Fe)return;const ot=Fe.style.display;Fe.style.display="block";const S=Fe.getBoundingClientRect(),d=S.width,p=S.height;Fe.style.display=ot,d>ce&&(ce=d),ze.getBoundingClientRect().top+p>Q-8?(Fe.style.top="auto",Fe.style.bottom="-5px"):(Fe.style.top="",Fe.style.bottom="")}),b.style.transform=ee,ce===0){Re.value=!0;return}const re=G-J;Re.value=re<ce+8}function m(u,b){u.preventDefault(),u.stopPropagation(),le(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{o.addSheet(),f()}},{label:g(e.locale.value,"copy"),action:()=>{o.dupSheet(b)}},{label:g(e.locale.value,"rename"),action:()=>{W(b)}},{label:g(e.locale.value,"delete"),action:()=>{o.removeSheet(b),f()},disabled:o.sheetCount.value<=1},{label:g(e.locale.value,"moveSheetLeft"),action:()=>{o.moveSheet(b,-1)},disabled:b===0},{label:g(e.locale.value,"moveSheetRight"),action:()=>{o.moveSheet(b,1)},disabled:b===o.sheets.value.length-1}])}function M(u){u.preventDefault(),!(u.target.closest(".tab-item")||u.target.closest(".tab-bar__add-btn"))&&le(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{o.addSheet(),f()}}])}function it(u){u.preventDefault(),e.selectAll(),f(),le(u.clientX,u.clientY,[{label:g(e.locale.value,"cut"),action:()=>{n.cutSelected(),o.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:g(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.clearSelected();for(let b=0;b<e.colCount;b++)e.colWidths.value[b]=100;for(let b=0;b<e.rowCount;b++)e.rowHeights.value[b]=void 0;f(),o.emitModelData()}}])}function vt(u,b){u.preventDefault();const T=u.clientX,J=u.clientY,D=e.selection.value;D&&D.startCol===0&&D.endCol===e.colCount-1&&b>=D.startRow&&b<=D.endRow||(e.selectRange(0,b,e.colCount-1,b,"row"),f());const G=e.selection.value;le(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{l.saveUndo(),o.insertRows(G.startRow,G.startRow),e.selectRange(0,G.startRow,e.colCount-1,G.startRow,"row"),f(),o.emitModelData()}},{label:g(e.locale.value,"cut"),action:()=>{l.saveUndo(),n.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,G.startRow,G.endRow),f(),o.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:g(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.deleteRows(G.startRow,G.endRow),f(),o.emitModelData()}},{label:`${g(e.locale.value,"rowHeight")}...`,action:()=>ul("row",T,J)},{label:g(e.locale.value,"autoRowHeight"),action:()=>o.resetRowHeight()},{label:g(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(b+1,e.freeze.cols),f()}},{label:g(e.locale.value,"outlineGroup"),children:[{label:g(e.locale.value,"outlineAddRowGroup"),action:()=>be("row")},{label:g(e.locale.value,"outlineUngroupRows"),action:()=>Qe("row")},{label:g(e.locale.value,"outlineClear"),action:()=>e.clearRowGroups()},{label:g(e.locale.value,"outlineExpandAll"),action:()=>v("row",!1)},{label:g(e.locale.value,"outlineCollapseAll"),action:()=>v("row",!0)}]}])}function At(u,b){u.preventDefault();const T=u.clientX,J=u.clientY,D=e.selection.value;D&&D.startRow===0&&D.endRow===e.rowCount-1&&b>=D.startCol&&b<=D.endCol||(e.selectRange(b,0,b,e.rowCount-1,"col"),f());const G=e.selection.value,Q=!o.canSortColumns(G.startCol,G.endCol);le(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{l.saveUndo(),o.insertCols(G.startCol,G.startCol),e.selectRange(G.startCol,0,G.startCol,e.rowCount-1,"col"),f(),o.emitModelData()}},{label:g(e.locale.value,"cut"),action:()=>{l.saveUndo(),n.copyRowCol(),e.clearCellsInRange(G.startCol,G.endCol,0,e.rowCount-1),f(),o.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:g(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.deleteCols(G.startCol,G.endCol),f(),o.emitModelData()}},{label:g(e.locale.value,"sort"),disabled:Q,children:[{label:g(e.locale.value,"sortAsc"),action:()=>{o.prepareSortConfirmation("asc")||o.sortSelectedColumns("asc")},disabled:Q},{label:g(e.locale.value,"sortDesc"),action:()=>{o.prepareSortConfirmation("desc")||o.sortSelectedColumns("desc")},disabled:Q}]},{label:`${g(e.locale.value,"colWidth")}...`,action:()=>ul("col",T,J)},{label:g(e.locale.value,"defaultColWidth"),action:()=>o.resetColWidth()},{label:g(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,b+1),f()}},{label:g(e.locale.value,"outlineGroup"),children:[{label:g(e.locale.value,"outlineAddColumnGroup"),action:()=>be("column")},{label:g(e.locale.value,"outlineUngroupColumns"),action:()=>Qe("column")},{label:g(e.locale.value,"outlineClear"),action:()=>e.clearColumnGroups()},{label:g(e.locale.value,"outlineExpandAll"),action:()=>v("column",!1)},{label:g(e.locale.value,"outlineCollapseAll"),action:()=>v("column",!0)}]}])}function Dt(u,b,T){u.preventDefault(),e.isSelected(b,T)||(e.selectCell(b,T),f());const J=e.selection.value,D=!!(J&&J.startCol===J.endCol&&J.startRow===J.endRow);le(u.clientX,u.clientY,[{label:g(e.locale.value,"cut"),action:()=>{n.cutSelected(),o.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:g(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.clearSelected(),f(),o.emitModelData()}},{label:g(e.locale.value,"calculate"),children:[{label:g(e.locale.value,"sum"),action:n.sumSelected,disabled:D},{label:g(e.locale.value,"avg"),action:n.avgSelected,disabled:D},{label:g(e.locale.value,"count"),action:n.countSelected,disabled:D}]},{label:`${g(e.locale.value,"dv")}...`,action:()=>{var G;return(G=e.requestDataValidationDialog)==null?void 0:G.call(e)}},{label:g(e.locale.value,"dvClearValidation"),action:()=>{l.saveUndo(),e.clearDataValidation(e.selection.value),f(),o.emitModelData()}},...D?[{label:e.hasNote(T,b)?g(e.locale.value,"editNote"):g(e.locale.value,"newNote"),action:()=>X(T,b)},...e.hasNote(T,b)?[{label:g(e.locale.value,"deleteNote"),action:()=>Nt(T,b)}]:[]]:[]])}const rn=t.ref(null),hn=t.ref(null);let Pn=null,Gt=null;function Hl(){Pn&&(document.removeEventListener("mousedown",Pn),Pn=null),Gt&&(document.removeEventListener("touchstart",Gt),Gt=null)}function ul(u,b,T){Hl();const J=e.selection.value;let D="";if(J){const ze=u==="row"?e.getRowHeight(J.startRow):e.colWidths.value[J.startCol];D=ze!=null&&ze>0?String(Math.round(ze)):""}const G=220,Q=118;let ee=b,ce=T;const re=Fn(o.wrapperRef.value);ee=Math.max(re.left+8,Math.min(re.right-G-8,ee)),ce=Math.max(re.top+8,Math.min(re.bottom-Q-8,ce)),hn.value={type:u,x:ee,y:ce,value:D,error:""},Pn=()=>{hn.value=null},Gt=()=>{hn.value=null},setTimeout(()=>{document.addEventListener("mousedown",Pn,{once:!0}),document.addEventListener("touchstart",Gt,{once:!0})},0),t.nextTick(()=>{const ze=rn.value;ze&&(ze.focus(),ze.select())})}function Nr(u){const b=hn.value;if(!b)return;const T=u.target,J=T.value,D=J.replace(/[^\d]/g,"");b.value=D,J!==D&&(T.value=D),b.error=""}function Br(u){u.key==="Enter"?(u.preventDefault(),Wl()):u.key==="Escape"&&(u.preventDefault(),Io())}function xr(){const u=hn.value;if(!u)return;const b=u.value.trim(),T=Number(b),J=u.type==="row",D=J?24:30,G=J?500:1e3;if(b===""||!Number.isFinite(T)){Io();return}const Q=Math.max(D,Math.min(G,Math.round(T)));u.value=String(Q),u.error=""}function Wl(){const u=hn.value,b=e.selection.value;if(!u||!b)return;const T=u.value.trim(),J=Number(T),D=u.type==="row",G=D?24:30,Q=D?500:1e3;if(T===""||!Number.isFinite(J)){u.error=g(e.locale.value,"dimNumberError");return}if(J<G||J>Q){u.error=g(e.locale.value,"dimRangeError").replace("{min}",String(G)).replace("{max}",String(Q));return}const ee=J;if(l.saveUndo(),D)for(let ce=b.startRow;ce<=b.endRow;ce++)e.rowHeights.value[ce]=ee;else for(let ce=b.startCol;ce<=b.endCol;ce++)e.colWidths.value[ce]=ee;f(),o.emitModelData(),Io()}function Io(){Hl(),hn.value=null}const Tr=t.computed(()=>{const u=!e.editingCell.value,b=e.editingCell.value??e.activeCell.value,T=b.col,J=b.row,D=e.resolveStyle(e.cells[e.cellKey(T,J)]),G=e.cellFontSize(T,J),Q=typeof(D==null?void 0:D.fontFamily)=="string"&&D.fontFamily?D.fontFamily:Vo,ee=(D==null?void 0:D.fontWeight)==="bold"?"bold":"normal",ce=(D==null?void 0:D.fontStyle)==="italic"?"italic":"normal",re=(D==null?void 0:D.underline)==="underline"?"underline":(D==null?void 0:D.strikethrough)==="line-through"?"line-through":"none",ze=(D==null?void 0:D.underline)==="underline"&&(D==null?void 0:D.strikethrough)==="line-through"?"underline line-through":re,Fe=typeof(D==null?void 0:D.color)=="string"?D.color:void 0,ot=typeof(D==null?void 0:D.backgroundColor)=="string"?D.backgroundColor:void 0,S=typeof(D==null?void 0:D.numberFormat)=="string"?D.numberFormat:"",d=e.editValue.value??e.getCellValue(T,J),p=typeof(D==null?void 0:D.textAlign)=="string"?D.textAlign:ar(d,S)?"right":"left",C=typeof(D==null?void 0:D.verticalAlign)=="string"?D.verticalAlign:"top",F=e.findMerge(T,J),A=F?e.rowPositions.value[F.range.endRow+1]-e.rowPositions.value[J]:e.getRowHeight(J),ae=2,{ascent:fe,descent:we}=e.measureFontMetrics(Q,G,ee,ce),Se=fe+we,Pe=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
-
`).length:1)*Se,Je=e.BASE_CELL_VPAD-ae;let et=0,pt=0;C==="middle"?(et=Math.floor((A-Pe)/2),pt=Math.max(0,A-Pe-et)):C==="top"?(et=Je,pt=Math.max(0,A-Pe-et)):C==="bottom"&&(pt=Je,et=Math.max(0,A-Pe-pt));const Et=e.cellToScreenRect(J,T);return{left:`${Et.x}px`,top:`${Et.y}px`,width:`${Et.width}px`,height:`${Et.height}px`,fontFamily:Q,fontSize:`${G}px`,lineHeight:1,fontWeight:ee,fontStyle:ce,textDecoration:ze,textAlign:p,paddingTop:`${et}px`,paddingRight:"3px",paddingBottom:`${pt}px`,paddingLeft:"3px",opacity:u?0:1,pointerEvents:u?"none":"auto",color:u?"transparent":Fe,caretColor:u?"transparent":void 0,borderColor:u?"transparent":void 0,background:u?"transparent":ot,boxShadow:u?"none":void 0}});function fl(){return Math.max(0,o.viewSize.w-ue()-11)}function ml(){return Math.max(0,o.viewSize.h-ie()-11)}const pl=t.computed(()=>Math.max(0,fl()-e.getFrozenMetrics().frozenColumnsWidth)),hl=t.computed(()=>Math.max(0,ml()-e.getFrozenMetrics().frozenRowsHeight)),Vr=t.computed(()=>ue()+e.getFrozenMetrics().frozenColumnsWidth),Dr=t.computed(()=>ie()+e.getFrozenMetrics().frozenRowsHeight),Ao=t.computed(()=>Math.max(0,pl.value-11*2)),No=t.computed(()=>Math.max(0,hl.value-11*2)),Lo=t.computed(()=>o.maxScrollX.value<=0?Ao.value:Math.max(24,pl.value/e.totalWidth.value*Ao.value)),gl=t.computed(()=>o.maxScrollX.value<=0?0:e.scrollX.value/o.maxScrollX.value*(Ao.value-Lo.value)),jo=t.computed(()=>o.maxScrollY.value<=0?No.value:Math.max(24,hl.value/e.totalHeight.value*No.value)),bl=t.computed(()=>o.maxScrollY.value<=0?0:e.scrollY.value/o.maxScrollY.value*(No.value-jo.value));let go=null,$o=0,Xo=0;function Fr(u){u.preventDefault(),go="v",$o=u.clientY,Xo=e.scrollY.value,document.addEventListener("mousemove",Zo),document.addEventListener("mouseup",Jo)}function Or(u){u.preventDefault(),go="h",$o=u.clientX,Xo=e.scrollX.value,document.addEventListener("mousemove",Zo),document.addEventListener("mouseup",Jo)}function Zo(u){if(go==="v"){const T=(u.clientY-$o)/(No.value-jo.value);o.clampScroll(null,Xo+T*o.maxScrollY.value),f()}else if(go==="h"){const T=(u.clientX-$o)/(Ao.value-Lo.value);o.clampScroll(Xo+T*o.maxScrollX.value,null),f()}}function Jo(){go=null,document.removeEventListener("mousemove",Zo),document.removeEventListener("mouseup",Jo)}function Ul(u){if(go)return;const b=u.currentTarget.getBoundingClientRect(),T=u.clientY-b.top;T<bl.value?o.clampScroll(null,e.scrollY.value-ml()):T>bl.value+jo.value&&o.clampScroll(null,e.scrollY.value+ml()),f()}function bo(u){if(go)return;const b=u.currentTarget.getBoundingClientRect(),T=u.clientX-b.left;T<gl.value?o.clampScroll(e.scrollX.value-fl(),null):T>gl.value+Lo.value&&o.clampScroll(e.scrollX.value+fl(),null),f()}let yo=!1,Bn=0,qt=0,fn=!1,xn=!1,lo=0,Bo=0,Kn=0,ro=0,ao=0,zo=0,Qo=0,_o=0,nn=!1,gn=!1,Ft=0,Ot=0,an="cell",yl=0,Pl=-1,Kl=-1,bn=null,io=!1,Gn=0,qn=0,on=!1,yn=null,Tn=null,Gl=0,ql=0;function el(u,b){const T=e.selection.value;if(!T||e.editingCell.value||!gr(T,T,e.merges).ok)return!1;const J=e.cellToScreenRect(T.endRow,T.endCol),D=J.x+J.width-6,G=J.y+J.height-6,Q=4;return u>=D-Q&&u<=D+6+Q&&b>=G-Q&&b<=G+6+Q}function Ir(){yn=requestAnimationFrame(Yl)}function Yl(){if(!e.autoFillState.value.active||!Tn){yn=null;return}const u=8;o.clampScroll(e.scrollX.value+Tn.x*u*.1,e.scrollY.value+Tn.y*u*.1);const b=e.screenToCell(Gl,ql),T=e.autoFillState.value.sourceRange;if(b&&T){const J=_a(T,{col:b.col,row:b.row});J?e.autoFillState.value={...e.autoFillState.value,targetRange:J.targetRange,direction:J.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}f(),yn=requestAnimationFrame(Yl)}function Cl(){yn!==null&&(cancelAnimationFrame(yn),yn=null),Tn=null}function wl(u,b){Gl=u,ql=b;const T=e.screenToCell(u,b),J=e.autoFillState.value.sourceRange;if(T&&J){const re=_a(J,{col:T.col,row:T.row});re?e.autoFillState.value={...e.autoFillState.value,targetRange:re.targetRange,direction:re.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const D=30,G=o.viewSize.w,Q=o.viewSize.h;let ee=0,ce=0;u<ue()+D?ee=-(ue()+D-u):u>G-11-D&&(ee=u-(G-11-D)),b<ie()+D?ce=-(ie()+D-b):b>Q-11-D&&(ce=b-(Q-11-D)),ee!==0||ce!==0?(Tn={x:ee,y:ce},yn===null&&Ir()):(Tn=null,yn!==null&&(cancelAnimationFrame(yn),yn=null)),f()}function vl(){Cl();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 Ar(u){var ce;if(u.button!==0)return;u.preventDefault(),We.value=null;const b=Eo(u,o.canvasRef.value),T=Jt(b.x,b.y);if(T){if(e.editingCell.value){e.commitEdit().then(re=>{re&&Ln(T.col,T.row)});return}Ln(T.col,T.row);return}if(((ce=gt.value)==null?void 0:ce.mode)==="edit")w();else if(gt.value){const re=e.screenToCell(b.x,b.y);(!re||!e.hasNote(re.row,re.col))&&w()}const J=U(b.x,b.y);if(J>=0){j(J);return}const D=ke(b.x,b.y);if(D){D.kind==="toggle"&&(e.toggleOutline(D.outlineId),f(),o.emitModelData());return}if(b.y<ie()&&b.x>=ue()){const re=b.x-ue()+e.scrollX.value,ze=E(b.x),Fe=ze>=0?e.cellToScreenRect(0,ze).x+e.colWidths.value[ze]:-1;if(ze>=0&&Math.abs(b.x-Fe)<=4){l.saveUndo(),fn=!0,lo=ze,Kn=e.colWidths.value[ze],ro=re,f();return}}if(b.x<ue()&&b.y>=ie()){const re=b.y-ie()+e.scrollY.value,ze=k(b.y),Fe=ze>=0?e.cellToScreenRect(ze,0).y+e.getRowHeight(ze):-1;if(ze>=0&&Math.abs(b.y-Fe)<=4){l.saveUndo(),xn=!0,Bo=ze,Kn=e.getRowHeight(ze),ro=re,f();return}}if(el(b.x,b.y)){const re=e.selection.value;re&&(e.autoFillState.value={active:!0,sourceRange:{...re},targetRange:null,direction:null,preview:!0},f());return}if(b.x<ue()||b.y<ie()){{const re=o.formulaBarRef.value,ze=!!(re&&typeof document<"u"&&document.activeElement===re);(e.editingCell.value||ze||Ge)&&ct()}if(b.y<ie()&&b.x>=ue()){const re=E(b.x);re>=0&&(e.selectRange(re,0,re,e.rowCount-1,"col"),yo=!0,Bn=re,qt=0)}else if(b.x<ue()&&b.y>=ie()){const re=k(b.y);re>=0&&(e.selectRange(0,re,e.colCount-1,re,"row"),yo=!0,Bn=0,qt=re)}else b.x<ue()&&b.y<ie()&&e.selectAll();f();return}const G=e.screenToCell(b.x,b.y);if(!G)return;const Q=G.col,ee=G.row;{const re=o.formulaBarRef.value,ze=!!(re&&typeof document<"u"&&document.activeElement===re);(e.editingCell.value||ze||Ge)&&ct()}if(u.shiftKey&&e.selection.value){const re=e.selection.value;e.selectRange(re.startCol,re.startRow,Q,ee)}else e.selectCell(Q,ee);if(e.hasNote(ee,Q)){Ae(ee,Q,"view"),o.emitModelData(),yo=!1,f();return}yo=!0,Bn=Q,qt=ee,o.focusEditInput(),f()}function Lr(u){if(fn){const Q=Eo(u,o.canvasRef.value).x-ue()+e.scrollX.value-ro,ee=Kn+Q;ee>=30&&ee<=1e3?e.colWidths.value[lo]=ee:ee<30?e.colWidths.value[lo]=30:e.colWidths.value[lo]=1e3,f();return}if(xn){const Q=Eo(u,o.canvasRef.value).y-ie()+e.scrollY.value-ro,ee=Kn+Q;ee>=24&&ee<=500?e.rowHeights.value[Bo]=ee:ee<24?e.rowHeights.value[Bo]=24:e.rowHeights.value[Bo]=500,f();return}if(e.autoFillState.value.active){const G=Eo(u,o.canvasRef.value);wl(G.x,G.y);return}if(!yo){const G=o.canvasRef.value;if(!G)return;if(l.paintFmt.value){G.style.cursor="copy";return}const Q=Eo(u,G),ee=e.screenToCell(Q.x,Q.y);if(ee&&e.hasNote(ee.row,ee.col)&&(G.style.cursor="pointer"),ke(Q.x,Q.y)){G.style.cursor="pointer";return}if(U(Q.x,Q.y)>=0){G.style.cursor="pointer";return}if(Jt(Q.x,Q.y)){G.style.cursor="pointer";return}if(Q.y<ie()&&Q.x>=ue()){const ce=E(Q.x),re=ce>=0?e.cellToScreenRect(0,ce).x+e.colWidths.value[ce]:-1;if(ce>=0&&Math.abs(Q.x-re)<=4){G.style.cursor="col-resize";return}}if(Q.x<ue()&&Q.y>=ie()){const ce=k(Q.y),re=ce>=0?e.cellToScreenRect(ce,0).y+e.getRowHeight(ce):-1;if(ce>=0&&Math.abs(Q.y-re)<=4){G.style.cursor="row-resize";return}}if(el(Q.x,Q.y)){G.style.cursor="crosshair";return}G.style.cursor="cell";return}const b=Eo(u,o.canvasRef.value);if(Bn<0||qt<0)return;if(b.x<ue()||b.y<ie()){if(b.y<ie()&&b.x>=ue()){const G=E(b.x);G>=0&&e.selectRange(Math.min(Bn,G),0,Math.max(Bn,G),e.rowCount-1,"col")}else if(b.x<ue()&&b.y>=ie()){const G=k(b.y);G>=0&&e.selectRange(0,Math.min(qt,G),e.colCount-1,Math.max(qt,G),"row")}f();return}const T=e.screenToCell(b.x,b.y);if(!T)return;const J=T.col,D=T.row;qt===0&&Bn>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(Bn,J),0,Math.max(Bn,J),e.rowCount-1,"col"):Bn===0&&qt>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(qt,D),e.colCount-1,Math.max(qt,D),"row"):e.selectRange(Bn,qt,J,D),f()}function $r(u){const b=fn||xn;if(yo=!1,fn=!1,xn=!1,b&&o.scheduleOptEmit(),e.autoFillState.value.active){vl();return}l.paintFmt.value&&l.applyPaintFormat()}function zr(){Cl();const u=fn||xn;yo=!1,fn=!1,xn=!1,u&&o.scheduleOptEmit()}function _r(u){u.preventDefault();const b=Eo(u,o.canvasRef.value);if(b.x<ue()&&b.y<ie()){it(u);return}if(b.y<ie()&&b.x>=ue()){const T=E(b.x);T>=0&&At(u,T);return}if(b.x<ue()&&b.y>=ie()){const T=k(b.y);T>=0&&vt(u,T);return}if(b.x>=ue()&&b.y>=ie()){const T=e.screenToCell(b.x,b.y);T&&Dt(u,T.col,T.row)}}function Hr(u){const b=Eo(u,o.canvasRef.value);if(b.x<ue()||b.y<ie())return;const T=e.screenToCell(b.x,b.y);if(!T)return;const J=T.col,D=T.row;{const G=o.formulaBarRef.value,Q=!!(G&&typeof document<"u"&&document.activeElement===G);(e.editingCell.value||Q||Ge)&&ct()}e.selectCell(J,D),e.ensureVisible(J,D),e.startEdit(),f(),o.focusEditInput()}function Wr(u){const b=e.scrollX.value+u.deltaX,T=e.scrollY.value+u.deltaY,J=40,D=o.maxScrollX.value,G=o.maxScrollY.value;if(b>=D-J&&u.deltaX>0||T>=G-J&&u.deltaY>0){const Q=Math.max(0,o.viewSize.w-28-11),ee=Math.max(0,o.viewSize.h-28-11),ce=Math.max(0,Math.ceil((b+Q)/100)+2),re=Math.max(0,Math.ceil((T+ee)/24)+2);e.ensureCapacity(ce,re)}o.clampScroll(b,T),f()}function jl(u){if(u.touches.length!==1){nn=!1;return}const b=u.touches[0],T=o.canvasRef.value;if(!T)return;const J=T.getBoundingClientRect(),D=b.clientX-J.left,G=b.clientY-J.top,Q=b.clientX,ee=b.clientY,ce=(Fe,ot)=>({clientX:Fe,clientY:ot,preventDefault(){}});{const Fe=o.formulaBarRef.value,ot=!!(Fe&&typeof document<"u"&&document.activeElement===Fe);(e.editingCell.value||ot||Ge)&&ct()}const re=e.screenToCell(D,G);if(re&&e.hasNote(re.row,re.col)){u.preventDefault(),nn=!0,gn=!0,Ae(re.row,re.col,"view"),o.emitModelData();return}if(el(D,G)){u.preventDefault();const Fe=e.selection.value;Fe&&(e.autoFillState.value={active:!0,sourceRange:{...Fe},targetRange:null,direction:null,preview:!0},nn=!0,gn=!1,an="cell",ao=D,zo=G,Qo=e.scrollX.value,_o=e.scrollY.value);return}const ze=U(D,G);if(ze>=0){u.preventDefault(),j(ze);return}if(G<ie()&&D>=ue()){const Fe=E(D);if(Fe>=0){const ot=e.cellToScreenRect(0,Fe).x+e.colWidths.value[Fe];if(Math.abs(D-ot)<=8){u.preventDefault(),l.saveUndo(),fn=!0,lo=Fe,Kn=e.colWidths.value[Fe],ro=D-ue()+e.scrollX.value,nn=!0,gn=!1;return}}}if(D<ue()&&G>=ie()){const Fe=k(G);if(Fe>=0){const ot=e.cellToScreenRect(Fe,0).y+e.getRowHeight(Fe);if(Math.abs(G-ot)<=8){u.preventDefault(),l.saveUndo(),xn=!0,Bo=Fe,Kn=e.getRowHeight(Fe),ro=G-ie()+e.scrollY.value,nn=!0,gn=!1;return}}}D>=ue()&&G>=ie()?(u.preventDefault(),nn=!0,gn=!1,io=!1,on=!1,an="cell",ao=D,zo=G,Qo=e.scrollX.value,_o=e.scrollY.value,Ft=E(D),Ot=k(G),bn!==null&&clearTimeout(bn),bn=window.setTimeout(()=>{const Fe=e.selection.value;if(!!Fe&&Ft>=Fe.startCol&&Ft<=Fe.endCol&&Ot>=Fe.startRow&&Ot<=Fe.endRow){on=!0,Dt(ce(Q,ee),Ft,Ot);return}io=!0,Gn=Ft,qn=Ot,Ft>=0&&Ot>=0&&(e.selectCell(Ft,Ot),f())},450)):D>=0&&G>=0&&(D<ue()||G<ie())&&(u.preventDefault(),nn=!0,gn=!1,io=!1,ao=D,zo=G,Qo=e.scrollX.value,_o=e.scrollY.value,G<ie()&&D>=ue()?(an="col",Ft=E(D),Ot=-1):D<ue()&&G>=ie()?(an="row",Ot=k(G),Ft=-1):(an="all",Ft=-1,Ot=-1),(an==="col"||an==="row"||an==="all")&&(bn!==null&&clearTimeout(bn),bn=window.setTimeout(()=>{const Fe=e.selection.value;if(an==="all"){on=!0,it(ce(Q,ee));return}if(an==="col"){if(!!Fe&&Fe.startRow===0&&Fe.endRow===e.rowCount-1&&Ft>=Fe.startCol&&Ft<=Fe.endCol){on=!0,At(ce(Q,ee),Ft);return}io=!0,Gn=Ft,qn=-1,Ft>=0&&(e.selectRange(Ft,0,Ft,e.rowCount-1,"col"),f())}else{if(!!Fe&&Fe.startCol===0&&Fe.endCol===e.colCount-1&&Ot>=Fe.startRow&&Ot<=Fe.endRow){on=!0,vt(ce(Q,ee),Ot);return}io=!0,Gn=-1,qn=Ot,Ot>=0&&(e.selectRange(0,Ot,e.colCount-1,Ot,"row"),f())}},450)))}function Ur(u){if(!nn||u.touches.length!==1)return;const b=u.touches[0],T=o.canvasRef.value;if(!T)return;const J=T.getBoundingClientRect(),D=b.clientX-J.left,G=b.clientY-J.top;if(e.autoFillState.value.active){u.preventDefault(),wl(D,G);return}if(fn){const Q=D-ue()+e.scrollX.value-ro;let ee=Kn+Q;ee=ee<30?30:ee>1e3?1e3:ee,e.colWidths.value[lo]=ee,u.preventDefault(),f();return}if(xn){const Q=G-ie()+e.scrollY.value-ro;let ee=Kn+Q;ee=ee<24?24:ee>500?500:ee,e.rowHeights.value[Bo]=ee,u.preventDefault(),f();return}if(io){if(u.preventDefault(),Gn>=0&&qn>=0){const Q=E(D),ee=k(G);Q>=0&&ee>=0&&(e.selectRange(Gn,qn,Q,ee),f())}else if(qn===-1&&Gn>=0){const Q=E(D);Q>=0&&(e.selectRange(Math.min(Gn,Q),0,Math.max(Gn,Q),e.rowCount-1,"col"),f())}else if(Gn===-1&&qn>=0){const Q=k(G);Q>=0&&(e.selectRange(0,Math.min(qn,Q),e.colCount-1,Math.max(qn,Q),"row"),f())}return}bn!==null&&(clearTimeout(bn),bn=null),(Math.abs(D-ao)>8||Math.abs(G-zo)>8)&&(gn=!0,u.preventDefault(),o.clampScroll(Qo+(ao-D),_o+(zo-G)),f())}function Pr(){if(nn){if(bn!==null&&(clearTimeout(bn),bn=null),on){on=!1,nn=!1;return}if(e.autoFillState.value.active){vl(),nn=!1;return}if(fn||xn){fn=!1,xn=!1,o.scheduleOptEmit(),l.paintFmt.value&&l.applyPaintFormat(),nn=!1;return}if(io){io=!1,l.paintFmt.value&&l.applyPaintFormat(),nn=!1;return}if(nn=!1,!gn){if(an==="cell"&&Ft>=0&&Ot>=0){gt.value&&w();const u=Date.now();Ft===Pl&&Ot===Kl&&u-yl<300?(e.selectCell(Ft,Ot),e.startEdit(),f(),o.focusEditInput(),yl=0):(e.commitEdit(),e.selectCell(Ft,Ot),f(),yl=u),Pl=Ft,Kl=Ot,o.focusEditInput()}else an==="col"&&Ft>=0?(e.commitEdit(),e.selectRange(Ft,0,Ft,e.rowCount-1,"col"),f()):an==="row"&&Ot>=0?(e.commitEdit(),e.selectRange(0,Ot,e.colCount-1,Ot,"row"),f()):an==="all"&&(e.commitEdit(),e.selectAll(),f());l.paintFmt.value&&!e.editingCell.value&&l.applyPaintFormat()}}}function kl(u){return u.isComposing||u.key==="Process"||u.keyCode===229}function Xl(u){return u.key.length===1&&!u.ctrlKey&&!u.metaKey&&!u.altKey}function Zl(u){if(e.autoFillState.value.active){u.key==="Escape"&&(u.preventDefault(),Cl(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},f());return}if(e.editingCell.value)return;const b=u.ctrlKey||u.metaKey,T=u.shiftKey;switch(!0){case(u.altKey&&u.key==="ArrowDown"):u.preventDefault(),Ln(e.activeCell.value.col,e.activeCell.value.row);return;case(b&&(u.key==="c"||u.key==="C")):u.preventDefault(),n.copyToClipboard();return;case(b&&(u.key==="x"||u.key==="X")):u.preventDefault(),n.cutSelected();return;case(b&&(u.key==="z"||u.key==="Z")):u.preventDefault(),l.undo();return;case(b&&(u.key==="y"||u.key==="Y")):u.preventDefault(),l.redo();return;case(b&&(u.key==="v"||u.key==="V")):u.preventDefault(),l.saveUndo(),n.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>o.emitModelData())});return;case(b&&(u.key==="a"||u.key==="A")):u.preventDefault(),e.selectAll(),f();return;case(b&&T&&(u.key==="l"||u.key==="L")):u.preventDefault(),e.toggleAutoFilter(),f();return;case(b&&u.key==="Home"):u.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),f();return;case(b&&u.key==="End"):u.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),f();return;case u.key==="Home":u.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),f();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),f();return;case u.key==="ArrowUp":u.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="ArrowDown":u.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="ArrowLeft":u.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="ArrowRight":u.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="Tab":u.preventDefault(),e.moveActive(T?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="Enter":u.preventDefault(),e.moveActive(0,T?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="F2":u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f(),o.focusEditInput();return;case(T&&u.key==="F2"):u.preventDefault(),X(e.activeCell.value.row,e.activeCell.value.col);return;case u.key==="Delete":case u.key==="Backspace":u.preventDefault(),l.saveUndo(),n.clearSelected(),f();return;case u.key==="Escape":u.preventDefault(),e.cancelEdit(),l.paintFmt.value=null,f();return;case Xl(u):if(kl(u)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),f(),o.focusEditInput();return}u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(u.key),f(),t.nextTick(()=>{const J=o.editInputRef.value;J&&(J.focus(),J.setSelectionRange(1,1))});return}}let Ho=!1,El=!1;function Jl(u){const b=u.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(b),ne.value=b,f();return}e.editValue.value=b,ne.value=b}function Kr(){Ho=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),ne.value="",f())}function Gr(u){Ho=!1,El=!0,setTimeout(()=>{El=!1},0);const b=u.target.value;e.editValue.value=b,ne.value=b}function qr(u){if(!e.editingCell.value){if(Xl(u)||kl(u))return;Zl(u);return}if(!(Ho||kl(u))&&!(El&&(u.key==="Enter"||u.key==="Escape")))if(u.key==="Enter"&&(u.altKey||u.metaKey)){u.preventDefault();const b=o.editInputRef.value;if(!b)return;const T=b.selectionStart??b.value.length,J=b.selectionEnd??b.value.length,D=b.value,G=D.slice(0,T)+`
|
|
9
|
-
`+D.slice(J);e.editValue.value=G,b.value=G,b.selectionStart=b.selectionEnd=T+1,f()}else u.key==="Enter"?(u.preventDefault(),e.commitEdit().then(b=>{if(!b){f(),o.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f(),o.focusEditInput()})):u.key==="Tab"?(u.preventDefault(),e.commitEdit().then(b=>{if(!b){f(),o.focusEditInput();return}e.moveActive(u.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f(),o.focusEditInput()})):u.key==="Escape"&&(u.preventDefault(),e.cancelEdit(),f(),o.focusEditInput())}function Yr(u){e.editingCell.value}function jr(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>f())},0)}let mn=null;function xo(){var b;const u=(b=o.wrapperRef.value)==null?void 0:b.getBoundingClientRect();if(u){const T=Do(e.props.width),J=Do(e.props.height);T!=null?o.viewSize.w=T:o.viewSize.w=u.width,J!=null?o.viewSize.h=J:o.viewSize.h=u.height}o.clampScroll(null,null),f()}function Xr(){t.onMounted(()=>{const u=Do(e.props.width),b=Do(e.props.height);(u==null||b==null)&&(mn=new ResizeObserver(()=>xo()),o.wrapperRef.value&&mn.observe(o.wrapperRef.value)),t.nextTick(()=>{xo(),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(T=>{const J=Ei(T,{colCount:e.props.colCount,rowCount:e.props.rowCount}),D=o.mkSheet(T.name,J),{cells:G,styles:Q}=si(T.cells);if(Object.assign(D.cells,G),D.styles=T.styles??Q,T.borders)D.borders=T.borders;else{const ee=ci(D.styles);D.styles=ee.styles,D.borders=ee.borders}if(T.colWidths)for(const[ee,ce]of Object.entries(T.colWidths)){const re=Number(ee);re>=0&&re<D.colCount&&ce>=30&&(D.colWidths[re]=ce)}if(T.rowHeights)for(const[ee,ce]of Object.entries(T.rowHeights)){const re=Number(ee);re>=0&&re<D.rowCount&&ce>=24&&(D.rowHeights[re]=ce)}if(T.merges)for(const[ee,ce]of Object.entries(T.merges))D.merges[ee]={...ce};return D.freeze=T.freeze?{rows:T.freeze.rows,cols:T.freeze.cols}:{rows:0,cols:0},D.filter=Si(T.filter,D.cells),D.dataValidations=Array.isArray(T.dataValidations)?[...T.dataValidations]:[],D.notes=T.notes?Object.fromEntries(Object.entries(T.notes).map(([ee,ce])=>[ee,{...ce}])):{},D}),o.sheets.value.length>0&&o.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const u=Do(e.props.width),b=Do(e.props.height);u!=null&&b!=null?(mn==null||mn.disconnect(),mn=null):!mn&&o.wrapperRef.value&&(mn=new ResizeObserver(()=>xo()),mn.observe(o.wrapperRef.value)),t.nextTick(()=>xo())}),t.watch(()=>e.props.theme,()=>{N=fi(e.props.theme),f()}),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>o.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>o.emitModelData()),f()},{deep:!1}),t.watch(o.activeSheetIndex,()=>t.nextTick(()=>o.emitModelData())),t.watch(()=>o.modelData.value,u=>{if(!u||u.length===0)return;const b=JSON.stringify(u);if(b===a.value)return;a.value=b;const T=e.selection.value?{...e.selection.value}:null,J={...e.activeCell.value};o.sheets.value=u.map(ee=>{const ce=Ei(ee,{colCount:e.props.colCount,rowCount:e.props.rowCount}),re=o.mkSheet(ee.name,ce),{cells:ze,styles:Fe}=si(ee.cells);if(Object.assign(re.cells,ze),re.styles=ee.styles??Fe,ee.borders)re.borders=ee.borders;else{const ot=ci(re.styles);re.styles=ot.styles,re.borders=ot.borders}if(ee.colWidths)for(const[ot,S]of Object.entries(ee.colWidths)){const d=Number(ot);d>=0&&d<re.colCount&&S>=30&&(re.colWidths[d]=S)}if(ee.rowHeights)for(const[ot,S]of Object.entries(ee.rowHeights)){const d=Number(ot);d>=0&&d<re.rowCount&&S>=24&&(re.rowHeights[d]=S)}if(ee.merges)for(const[ot,S]of Object.entries(ee.merges))re.merges[ot]={...S};return re.freeze=ee.freeze?{rows:ee.freeze.rows,cols:ee.freeze.cols}:{rows:0,cols:0},re.filter=Si(ee.filter,re.cells),re.dataValidations=Array.isArray(ee.dataValidations)?[...ee.dataValidations]:[],re.rowOutlines=Array.isArray(ee.rowOutlines)?ee.rowOutlines.map(ot=>({...ot})):[],re.columnOutlines=Array.isArray(ee.columnOutlines)?ee.columnOutlines.map(ot=>({...ot})):[],re.notes=ee.notes?Object.fromEntries(Object.entries(ee.notes).map(([ot,S])=>[ot,{...S}])):{},re}),o.sheets.value.length>0&&o.loadSheet(0),T&&(e.selection.value=T),e.activeCell.value=J;const D=e.activeCell.value,G=e.selection.value,Q=e.findMerge(D.col,D.row);Q&&Q.anchor===e.cellKey(D.col,D.row)&&(!G||G.startCol===D.col&&G.startRow===D.row&&G.endCol===D.col&&G.endRow===D.row)&&e.selectCell(D.col,D.row),f()},{deep:!0}),t.onBeforeUnmount(()=>{mn==null||mn.disconnect()})}return{scheduleRender:f,render:O,renderFrozenOverlay:L,activeCellLabel:lt,formulaBarDisplay:Ne,formulaBarDraft:ne,formulaBarExpanded:xe,onFormulaBarFocus:se,onFormulaBarInput:de,onFormulaBarKeydown:I,onFormulaBarBlur:H,acceptFormulaBarEdit:ct,cancelFormulaBarEdit:nt,insertFunctionIntoCell:Be,renTab:$,renTabVal:V,onTabClick:B,onTabDblClick:W,commitTabRename:z,cclTabRename:q,onTabRenameKd:Ce,ctxMenu:We,ctxSubmenuLeft:Re,filterPopup:$t,isFilterButtonHit:U,openFilterPopup:j,closeFilterPopup:ye,validationDropdown:xt,isValidationDropdownHit:Jt,openValidationDropdown:Ln,closeValidationDropdown:ln,onValidationDropdownSelect:Un,onCtxItemEnter:Ie,onTabCtxMenu:m,onTabBarCtx:M,onCornerCtx:it,onRowHdrCtx:vt,onColHdrCtx:At,onCellCtx:Dt,noteUi:gt,openNote:Ae,closeNote:w,editNoteAt:X,saveNoteAt:dt,removeNoteAt:Nt,isNoteIndicatorHit:Ct,dimInputRef:rn,dimPanel:hn,openDimPanel:ul,onDimInput:Nr,onDimKeydown:Br,onDimBlur:xr,applyDimPanel:Wl,closeDimPanel:Io,outlineGroupRows:()=>be("row"),outlineGroupCols:()=>be("column"),outlineUngroupRows:()=>Qe("row"),outlineUngroupCols:()=>Qe("column"),outlineExpandRows:()=>v("row",!1),outlineCollapseRows:()=>v("row",!0),outlineExpandCols:()=>v("column",!1),outlineCollapseCols:()=>v("column",!0),get showOutlineAlert(){return s},set showOutlineAlert(u){s=u},editInputStyle:Tr,hScrollbarW:pl,vScrollbarH:hl,hScrollbarLeft:Vr,vScrollbarTop:Dr,hTrackW:Ao,vTrackH:No,hThumbW:Lo,hThumbL:gl,vThumbH:jo,vThumbT:bl,onVStart:Fr,onHStart:Or,onSbMove:Zo,onSbUp:Jo,onVTrk:Ul,onHTrk:bo,onMouseDown:Ar,onMouseMove:Lr,onMouseUp:$r,onMouseLeave:zr,onCanvasCtx:_r,onDblClick:Hr,onWheel:Wr,onTouchStart:jl,onTouchMove:Ur,onTouchEnd:Pr,onKeydown:Zl,onEditInput:Jl,onEditCompositionStart:Kr,onEditCompositionEnd:Gr,onEditKd:qr,onEditPaste:Yr,onEditBlur:jr,applySize:xo,setupLifecycle:Xr}}function n2(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mi(e,l,n,o){return l?o?n?e===l:e.toLowerCase()===l.toLowerCase():n?e.includes(l):e.toLowerCase().includes(l.toLowerCase()):!1}function o2(e,l,n,o){if(!l)return e;if(o){const i=e.indexOf(l);return i<0?e:e.slice(0,i)+n+e.slice(i+l.length)}const a=e.toLowerCase().indexOf(l.toLowerCase());return a<0?e:e.slice(0,a)+n+e.slice(a+l.length)}function l2(e,l,n,o){return l?o?e.indexOf(l)<0?e:e.split(l).join(n):e.toLowerCase().indexOf(l.toLowerCase())<0?e:e.replace(new RegExp(n2(l),"gi"),()=>n):e}function Mr(e,l,n,o,a,i,r){const c=[];if(r){for(let s=r.startRow;s<=r.endRow;s++)for(let y=r.startCol;y<=r.endCol;y++){const h=e[n(y,s)];h&&Mi(h.value,o,a,i)&&c.push({sheetIndex:l,col:y,row:s})}return c}for(const s in e){const y=e[s];if(y&&Mi(y.value,o,a,i)){const h=s.split(","),R=Number(h[0]),f=Number(h[1]);!Number.isNaN(R)&&!Number.isNaN(f)&&c.push({sheetIndex:l,col:R,row:f})}}return c}function r2(e,l,n,o){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref("sheet"),s=t.ref(!1),y=t.ref(!1),h=t.ref(-1),R=t.ref([]),f=t.ref(""),E=t.ref(0),k=t.ref(""),N=t.computed(()=>{const ne=new Set,xe=n.activeSheetIndex.value;for(const Ne of R.value)Ne.sheetIndex===xe&&ne.add(`${Ne.col},${Ne.row}`);return ne}),Y=t.computed(()=>{if(h.value<0||h.value>=R.value.length)return null;const ne=R.value[h.value];return ne.sheetIndex!==n.activeSheetIndex.value?null:`${ne.col},${ne.row}`});e.findHighlight=(ne,xe)=>{const Ne=`${ne},${xe}`;return Y.value===Ne?"active":N.value.has(Ne)?"match":null};function te(ne){var se,de;const xe=e.cellKey(ne.col,ne.row);if(ne.sheetIndex===n.activeSheetIndex.value)return((se=e.cells[xe])==null?void 0:se.value)??"";const Ne=n.sheets.value[ne.sheetIndex];return((de=Ne==null?void 0:Ne.cells[xe])==null?void 0:de.value)??""}function me(ne,xe){const Ne=e.cellKey(ne.col,ne.row);if(ne.sheetIndex===n.activeSheetIndex.value)e.setCellValue(ne.col,ne.row,xe);else{const se=n.sheets.value[ne.sheetIndex];if(!se)return;const de=se.cells[Ne];se.cells[Ne]={value:String(xe),styleId:de==null?void 0:de.styleId}}}function he(){if(k.value){f.value=k.value;return}if(!i.value){f.value="";return}if(c.value==="selection"&&!e.selection.value){f.value=g(e.locale.value,"findNeedSelection");return}if(R.value.length===0){f.value=g(e.locale.value,"findNoResult");return}f.value=""}function Te(){const ne=i.value,xe=[];if(ne)if(c.value==="workbook")n.sheets.value.forEach((Ne,se)=>{xe.push(...Mr(Ne.cells,se,e.cellKey,ne,s.value,y.value))});else if(c.value==="selection"){const Ne=e.selection.value;Ne&&xe.push(...Mr(e.cells,n.activeSheetIndex.value,e.cellKey,ne,s.value,y.value,Ne))}else xe.push(...Mr(e.cells,n.activeSheetIndex.value,e.cellKey,ne,s.value,y.value));R.value=xe,xe.length===0?h.value=-1:h.value>=xe.length?h.value=xe.length-1:h.value<0&&(h.value=0),he()}function pe(){if(h.value<0||h.value>=R.value.length)return;const ne=R.value[h.value];ne.sheetIndex!==n.activeSheetIndex.value&&n.switchSheet(ne.sheetIndex),c.value==="selection"?e.activeCell.value={col:ne.col,row:ne.row}:e.selectCell(ne.col,ne.row),e.ensureVisible(ne.col,ne.row)}const Ee=typeof requestAnimationFrame=="function"?requestAnimationFrame:ne=>setTimeout(ne,16);let Le=!1,ue=!1;function ie(ne){if(Le){ue=ue||ne;return}Le=!0,ue=ne,Ee(()=>{var xe;Le=!1,Te(),ue&&R.value.length>0&&h.value>=0&&pe(),ue=!1,(xe=e.scheduleRender)==null||xe.call(e)})}function tt(){var ne;a.value=!0,E.value++,Te(),R.value.length>0&&(h.value=0,pe()),(ne=e.scheduleRender)==null||ne.call(e)}function st(){tt()}function Z(){var ne;a.value=!1,R.value=[],h.value=-1,k.value="",f.value="",(ne=e.scheduleRender)==null||ne.call(e)}function O(){var ne;R.value.length!==0&&(h.value=(h.value+1)%R.value.length,pe(),(ne=e.scheduleRender)==null||ne.call(e))}function L(){var ne;R.value.length!==0&&(h.value=(h.value-1+R.value.length)%R.value.length,pe(),(ne=e.scheduleRender)==null||ne.call(e))}function oe(){var de,Be;if(h.value<0||h.value>=R.value.length)return;const ne=R.value[h.value],xe=te(ne),Ne=o2(xe,i.value,r.value,s.value);if(Ne===xe)return;l.saveUndo(),me(ne,Ne);const se=h.value;Te(),R.value.length>0?(h.value=Math.min(se,R.value.length-1),O()):h.value=-1,(de=e.emitModelData)==null||de.call(e),(Be=e.scheduleRender)==null||Be.call(e)}function $e(){var se,de;const ne=i.value;if(!ne||R.value.length===0)return;l.saveUndo();let xe=0;const Ne=R.value.slice();for(const Be of Ne){const _e=te(Be),Ge=l2(_e,ne,r.value,s.value);Ge!==_e&&(me(Be,Ge),xe++)}R.value=[],h.value=-1,k.value=g(e.locale.value,"findReplacedAll").replace("{n}",String(xe)),he(),(se=e.emitModelData)==null||se.call(e),(de=e.scheduleRender)==null||de.call(e)}function lt(){const ne=xe=>{if(!(xe.ctrlKey||xe.metaKey))return;const se=xe.key.toLowerCase();(se==="f"||se==="h")&&(xe.preventDefault(),tt())};window.addEventListener("keydown",ne),t.onBeforeUnmount(()=>window.removeEventListener("keydown",ne))}return t.watch(i,()=>{a.value&&(k.value="",h.value=0,ie(!0))}),t.watch([c,s,y],()=>{a.value&&(k.value="",h.value=0,ie(!0))}),t.watch(e.cells,()=>{a.value&&ie(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&c.value==="selection"&&(h.value=0,ie(!0))}),t.watch([()=>l.undoStack.value.length,()=>l.redoStack.value.length],()=>{a.value&&ie(!1)}),{open:a,findText:i,replaceText:r,scope:c,matchCase:s,matchEntireCell:y,currentIndex:h,results:R,message:f,focusToken:E,activeSheetMatches:N,activeMatchKey:Y,openFind:tt,openReplace:st,close:Z,recompute:Te,findNext:O,findPrev:L,replace:oe,replaceAll:$e,setupLifecycle:lt}}const a2={class:"formula-bar__cell-label"},i2={class:"formula-bar__buttons"},s2=["title","aria-label"],c2=["title","aria-label"],d2=["title","aria-label"],u2=["rows","value"],f2=["title"],m2={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},p2={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},h2=["value"],g2={key:2,class:"sb-corner"},b2=["onClick","onMouseenter"],y2={class:"context-menu__label"},C2={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},w2=["onClick"],v2={key:0,class:"cf-modal-mask"},k2={key:0,class:"cf-modal-mask"},E2={class:"dim-panel__title"},R2={class:"dim-panel__body"},S2=["value"],M2={key:0,class:"dim-panel__error"},N2={class:"dim-panel__footer"},Ni=Lt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"},noteAuthor:{default:Zr}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const l=e,n=t.useModel(e,"data"),o={value:""},a=Ip(l,{rowCount:l.rowCount,colCount:l.colCount,theme:l.theme,locale:l.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:x=>{},mkSheet:x=>({id:"",name:x,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:[],notes:{}})},r=Ap(a,i),c=Kp(a,r);Lp(r,{borderMenuOpen:c.borderMenuOpen,mergeMenuOpen:c.mergeMenuOpen});const s=e2(a,r,n,void 0,o);i.sheets=s.sheets,i.activeSheetIndex=s.activeSheetIndex,i.saveSheet=s.saveSheet,i.loadSheet=s.loadSheet,i.mkSheet=s.mkSheet;function y(){const x=document.documentElement,m=s.toolbarThemeVars.value;for(const[M,it]of Object.entries(m))x.style.setProperty(M,it)}t.watch(()=>s.toolbarThemeVars.value,y,{immediate:!0,deep:!0}),t.onBeforeUnmount(()=>{const x=document.documentElement;for(const m of Object.keys(s.toolbarThemeVars.value))x.style.removeProperty(m)});const h=t2(a,r,c,s,o);h.setupLifecycle();const R=r2(a,r,s);R.setupLifecycle();const f=t.reactive(a),E=t.reactive(r),k=t.reactive(c),N=t.reactive(s),Y=s.sheets,te=s.activeSheetIndex,me=s.sortMenuOpen,he=s.cachedSortOrder,Te=t.ref(!1),pe=t.ref(!1),Ee=t.ref(!1),Le=t.ref(!1),ue=t.ref(!1),ie=t.ref(!1),tt=t.ref(!1),st=t.computed(()=>{const x=f.selection;return x?x.startCol===0&&x.endCol===f.colCount-1?"rows":x.startRow===0&&x.endRow===f.rowCount-1?"cols":null:null}),Z=t.reactive(h),O=t.reactive(R),L=t.computed(()=>{const x=f.selection;return!!x&&x.startCol===x.endCol&&x.startRow===x.endRow}),oe=t.computed(()=>{const x=f.selection;return x?s.canSortColumns(x.startCol,x.endCol):!1}),$e=t.computed(()=>{if(f.getFilter()!==null)return!0;const x=f.selection;if(!x)return!0;const m=Math.min(x.startCol,x.endCol),M=Math.max(x.startCol,x.endCol),it=Math.min(x.startRow,x.endRow),vt=Math.max(x.startRow,x.endRow);for(const At in f.merges){const Dt=f.merges[At];if(!(Dt.startCol===Dt.endCol&&Dt.startRow===Dt.endRow)&&m<=Dt.endCol&&M>=Dt.startCol&&it<=Dt.endRow&&vt>=Dt.startRow)return!1}return!0}),lt=t.computed(()=>{const x=E.selNumberFormat;if(x!==Qn&&x!==fo)return x;const m=f.activeCell,M=a.resolveStyle(f.cells[f.cellKey(m.col,m.row)]);return typeof(M==null?void 0:M.numberFormat)=="string"?M.numberFormat:""});function ne(x){r.nfDialogOpen.value=x}const xe=t.ref(!1);function Ne(){xe.value=!0}function se(x){xe.value=x}function de(x){h.insertFunctionIntoCell(x)}function Be(){f.toggleAutoFilter(),Z.scheduleRender()}function _e(x){const m=f.getFilter();return m?f.getCellValue(x,m.range.startRow):""}const Ge=t.computed(()=>{const x=f.selection,m=x?x.startRow:f.activeCell.row,M=x?x.startCol:f.activeCell.col;return m===0&&M===0});function ct(x){const m=f.freeze;if(x==="panes"){const M=f.selection,it=M?M.startRow:f.activeCell.row,vt=M?M.startCol:f.activeCell.col;f.setFreeze(it,vt)}else x==="firstRow"?f.setFreeze(1,m.cols):x==="firstCol"?f.setFreeze(m.rows,1):x==="unfreeze"&&f.clearFreeze();Z.scheduleRender()}const nt=t.ref(null),I=t.ref(!1),H=t.ref(!1),$=t.ref(null),V=t.ref("create"),B=t.computed(()=>{const x=f.selection;if(x){const M=yt(x.startCol)+(x.startRow+1),it=yt(x.endCol)+(x.endRow+1);return x.startCol===x.endCol&&x.startRow===x.endRow?M:`${M}:${it}`}const m=f.activeCell;return yt(m.col)+(m.row+1)});function W(x){var it;let m;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(x)?m={type:"cellIs",operator:x,value:""}:x==="textContains"?m={type:"textContains",value:""}:x==="textNotContains"?m={type:"textNotContains",value:""}:x==="blank"?m={type:"blank"}:x==="notBlank"?m={type:"notBlank"}:x==="duplicate"?m={type:"duplicate"}:x==="unique"?m={type:"unique"}:m={type:"cellIs",operator:"greaterThan",value:""},$.value={id:"",condition:m,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},V.value="create",(it=nt.value)==null||it.closeOverflow(),H.value=!0}function z(){var x;$.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},V.value="create",(x=nt.value)==null||x.closeOverflow(),H.value=!0}function q(){var x;(x=nt.value)==null||x.closeOverflow(),I.value=!0}function Ce(x){f.clearConditionalFormats(x),Z.scheduleRender()}function We(x){x.id?f.updateConditionalFormatRule(x.id,x):f.addConditionalFormatRule(x),H.value=!1}function gt(x){var m;$.value=x,V.value="edit",(m=nt.value)==null||m.closeOverflow(),H.value=!0}function Ae(x){f.removeConditionalFormatRule(x)}function w(x,m){f.moveConditionalFormatRule(x,m)}function X(x,m){f.updateConditionalFormatRule(x,{enabled:m})}const dt=t.ref(!1),Nt=t.ref(null),Ct=t.ref("create"),$t=t.computed(()=>{const x=f.selection;if(x){const M=yt(x.startCol)+(x.startRow+1),it=yt(x.endCol)+(x.endRow+1);return x.startCol===x.endCol&&x.startRow===x.endRow?M:`${M}:${it}`}const m=f.activeCell;return yt(m.col)+(m.row+1)}),xt=t.ref(null);let Tt=null;function jt(x){return new Promise(m=>{Tt=m,xt.value={...x}})}a.showValidationAlert=jt;const Mn=t.ref(null);function oo(x){Mn.value=x}function Nn(){Mn.value=null}h.showOutlineAlert=oo,a.getSheetCellsById=x=>{const m=s.sheets.value.findIndex(M=>M.id===x||M.name===x);return m<0?null:m===s.activeSheetIndex.value?a.cells:s.sheets.value[m].cells},a.requestDataValidationDialog=()=>Xt();function Xt(){var M;const x=f.activeCell,m=a.getDataValidationRule(x.row,x.col);Nt.value=m?JSON.parse(JSON.stringify(m)):null,Ct.value=m?"edit":"create",(M=nt.value)==null||M.closeOverflow(),dt.value=!0}function tn(x){if(x.type==="any"){x.ranges.forEach(m=>a.clearDataValidation(m)),dt.value=!1,h.scheduleRender();return}x.id?a.updateDataValidation(x.id,x):a.createDataValidation(x),dt.value=!1,h.scheduleRender()}function Jt(){const x=f.selection;x&&a.clearDataValidation(x),dt.value=!1,h.scheduleRender()}function Ln(x){xt.value=null;const m=Tt;Tt=null,t.nextTick(()=>{const M=f.editingCell;M&&(a.selectCell(M.col,M.row),a.ensureVisible(M.col,M.row),h.scheduleRender(),s.focusEditInput())}),m==null||m(x)}const ln=t.computed(()=>{const x=f.activeCell,m=a.getValidationInputMessage(x.row,x.col);if(!m)return null;const M=a.cellToScreenRect(x.row,x.col),it=s.wrapperRef.value,vt=it?it.getBoundingClientRect():{left:0,top:0};return{title:m.title,message:m.message,x:vt.left+M.x,y:vt.top+M.y,width:M.width,height:M.height}}),Un=t.computed(()=>{const x=h.noteUi.value;if(!x)return null;const m=a.cellToScreenRect(x.row,x.col);return{x:m.x,y:m.y,width:m.width,height:m.height}}),K=t.computed(()=>{const x=h.noteUi.value;return x?a.getNote(x.row,x.col)??null:null}),U=t.computed(()=>g(f.locale,"notePlaceholder"));function j(x){r.fontSizeMenuOpen.value=x}function ye(x){r.textColorMenuOpen.value=x}function ve(x){r.fillColorMenuOpen.value=x}function Ve(x){switch(x){case"group-rows":h.outlineGroupRows();break;case"group-cols":h.outlineGroupCols();break;case"ungroup-rows":h.outlineUngroupRows();break;case"ungroup-cols":h.outlineUngroupCols();break;case"clear-rows":a.clearRowGroups();break;case"clear-cols":a.clearColumnGroups();break;case"expand-rows":h.outlineExpandRows();break;case"expand-cols":h.outlineExpandCols();break;case"collapse-rows":h.outlineCollapseRows();break;case"collapse-cols":h.outlineCollapseCols();break}}function Ue(x){h.renTabVal.value=x}function ke(){h.ctxMenu.value=null}const He=x=>{s.formulaBarRef.value=x};function be(){h.formulaBarExpanded.value=!h.formulaBarExpanded.value}const Qe=t.ref(null),v=x=>{s.wrapperRef.value=x,Qe.value=x},P=x=>{s.canvasRef.value=x},le=x=>{s.freezeCanvasRef.value=x},Re=x=>{s.editInputRef.value=x},Ie=x=>{h.dimInputRef.value=x};return(x,m)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(N.outerStyle)},[t.createVNode(cu,{ref_key:"toolbarRef",ref:nt,locale:f.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":k.borderMenuOpen,"cached-border":k.cachedBorder,"cached-border-color":k.cachedBorderColor,"cached-border-line-style":k.cachedBorderLineStyle,"sort-menu-open":t.unref(me),"cached-sort-order":t.unref(he),"can-sort":oe.value,"outline-menu-open":Te.value,"outline-axis":st.value,"can-filter":$e.value,"filter-active":f.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":k.mergeMenuOpen,"calc-menu-open":k.calcMenuOpen,"cf-menu-open":pe.value,"freeze-menu-open":Ee.value,"font-menu-open":Le.value,"h-align-menu-open":ue.value,"v-align-menu-open":ie.value,"num-fmt-menu-open":tt.value,"is-single-cell":L.value,"has-freeze":f.freeze.rows>0||f.freeze.cols>0,"freeze-panes-disabled":Ge.value,"sel-number-format":E.selNumberFormatDisplay,"nf-options":E.nfOptions,"can-increase-decimals":E.canIncreaseDecimals,"can-decrease-decimals":E.canDecreaseDecimals,"boundary-el":Qe.value,"theme-vars":N.toolbarThemeVars,onUndo:m[0]||(m[0]=M=>E.undo()),onRedo:m[1]||(m[1]=M=>E.redo()),onPaintFormat:E.onPaintFormat,onClearFormat:m[2]||(m[2]=M=>E.clearFormat()),onNumberFormatChange:m[3]||(m[3]=M=>E.onNumberFormatChange(M)),onIncreaseDecimals:E.onIncreaseDecimals,onDecreaseDecimals:E.onDecreaseDecimals,onFontFamilyChange:m[4]||(m[4]=M=>E.onFontFamilyChange(M)),onFontSizeInput:m[5]||(m[5]=M=>E.onFontSizeInput(M)),onFontSizeBlur:E.onFontSizeBlur,onFontSizeKeydown:m[6]||(m[6]=M=>E.onFontSizeKeydown(M)),onFontSizeChange:m[7]||(m[7]=M=>E.onFontSizeChange(M)),"onUpdate:fontSizeMenuOpen":m[8]||(m[8]=M=>j(M)),onFontSizeToggle:m[9]||(m[9]=M=>E.toggleFontSizeMenu()),onFontSizeStepUp:E.onFontSizeStepUp,onFontSizeStepDown:E.onFontSizeStepDown,onBoldToggle:E.toggleFontWeight,onItalicToggle:E.toggleFontStyle,onUnderlineToggle:E.toggleUnderline,onStrikethroughToggle:E.toggleStrikethrough,onTextColorChange:m[10]||(m[10]=M=>E.onTextColorChange(M)),"onUpdate:textColorMenuOpen":m[11]||(m[11]=M=>ye(M)),onFillColorChange:m[12]||(m[12]=M=>E.onFillColorChange(M)),"onUpdate:fillColorMenuOpen":m[13]||(m[13]=M=>ve(M)),onApplyTextColor:E.applyCachedTextColor,onApplyFillColor:E.applyCachedFillColor,"onUpdate:borderMenuOpen":m[14]||(m[14]=M=>E.onBorderMenuToggle(M)),onBorderChange:m[15]||(m[15]=M=>k.onBorderChange(M)),onBorderColorChange:m[16]||(m[16]=M=>k.onBorderColorChange(M)),onBorderLineStyleChange:m[17]||(m[17]=M=>k.onBorderLineStyleChange(M)),onApplyBorder:k.applyCachedBorder,"onUpdate:sortMenuOpen":m[18]||(m[18]=M=>N.onSortMenuToggle(M)),onSortChange:m[19]||(m[19]=M=>N.onSortChange(M)),onApplySort:N.applyCachedSort,"onUpdate:outlineMenuOpen":m[20]||(m[20]=M=>Te.value=M),onOutlineAction:m[21]||(m[21]=M=>Ve(M)),onToggleFilter:Be,onFreezeChange:m[22]||(m[22]=M=>ct(M)),onHAlignChange:m[23]||(m[23]=M=>E.onHAlignChange(M)),onVAlignChange:m[24]||(m[24]=M=>E.onVAlignChange(M)),onWrapToggle:E.onWrapToggle,"onUpdate:mergeMenuOpen":m[25]||(m[25]=M=>k.onMergeMenuToggle(M)),onMergeChange:m[26]||(m[26]=M=>k.onMergeChange(M)),onApplyMerge:k.onApplyMerge,"onUpdate:calcMenuOpen":m[27]||(m[27]=M=>k.onCalcMenuToggle(M)),"onUpdate:cfMenuOpen":m[28]||(m[28]=M=>pe.value=M),"onUpdate:freezeMenuOpen":m[29]||(m[29]=M=>Ee.value=M),"onUpdate:fontMenuOpen":m[30]||(m[30]=M=>Le.value=M),"onUpdate:hAlignMenuOpen":m[31]||(m[31]=M=>ue.value=M),"onUpdate:vAlignMenuOpen":m[32]||(m[32]=M=>ie.value=M),"onUpdate:numFmtMenuOpen":m[33]||(m[33]=M=>tt.value=M),onCalcSum:k.onCalcSum,onCalcAvg:k.onCalcAvg,onCalcCount:k.onCalcCount,onFind:m[34]||(m[34]=M=>t.unref(R).openFind()),onCfPreset:m[35]||(m[35]=M=>W(M)),onCfNewRule:z,onCfManage:q,onCfClear:m[36]||(m[36]=M=>Ce(M)),onOpenDataValidation:Xt},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","cached-border-color","cached-border-line-style","sort-menu-open","cached-sort-order","can-sort","outline-menu-open","outline-axis","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","cf-menu-open","freeze-menu-open","font-menu-open","h-align-menu-open","v-align-menu-open","num-fmt-menu-open","is-single-cell","has-freeze","freeze-panes-disabled","sel-number-format","nf-options","can-increase-decimals","can-decrease-decimals","boundary-el","theme-vars","onPaintFormat","onIncreaseDecimals","onDecreaseDecimals","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode($u,{open:O.open,"find-text":O.findText,"replace-text":O.replaceText,scope:O.scope,"match-case":O.matchCase,"match-entire-cell":O.matchEntireCell,"current-index":O.currentIndex,total:O.results.length,message:O.message,"focus-token":O.focusToken,locale:f.locale,"theme-vars":N.toolbarThemeVars,"onUpdate:findText":m[37]||(m[37]=M=>t.unref(R).findText.value=M),"onUpdate:replaceText":m[38]||(m[38]=M=>t.unref(R).replaceText.value=M),"onUpdate:scope":m[39]||(m[39]=M=>t.unref(R).scope.value=M),"onUpdate:matchCase":m[40]||(m[40]=M=>t.unref(R).matchCase.value=M),"onUpdate:matchEntireCell":m[41]||(m[41]=M=>t.unref(R).matchEntireCell.value=M),onPrev:m[42]||(m[42]=M=>t.unref(R).findPrev()),onNext:m[43]||(m[43]=M=>t.unref(R).findNext()),onReplace:m[44]||(m[44]=M=>t.unref(R).replace()),onReplaceAll:m[45]||(m[45]=M=>t.unref(R).replaceAll()),onClose:m[46]||(m[46]=M=>t.unref(R).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(ff,{"model-open":E.nfDialogOpen,locale:f.locale,"current-format":lt.value,"is-custom":E.selNumberFormat===t.unref(fo),"onUpdate:modelOpen":m[47]||(m[47]=M=>ne(M)),onApply:m[48]||(m[48]=M=>E.applyNumberFormatCode(M))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(vf,{"model-open":N.sortConfirmOpen,locale:f.locale,"onUpdate:modelOpen":m[49]||(m[49]=M=>N.sortConfirmOpen=M),onConfirm:m[50]||(m[50]=M=>N.confirmSort(M)),onCancel:m[51]||(m[51]=M=>N.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(zf,{"model-open":xe.value,locale:f.locale,"onUpdate:modelOpen":m[52]||(m[52]=M=>se(M)),onInsert:m[53]||(m[53]=M=>de(M))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":Z.formulaBarExpanded}])},[t.createElementVNode("div",a2,t.toDisplayString(Z.activeCellLabel),1),t.createElementVNode("div",i2,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:t.unref(g)(f.locale,"formulaBarCancel"),"aria-label":t.unref(g)(f.locale,"cancel"),onMousedown:m[54]||(m[54]=t.withModifiers(()=>{},["prevent"])),onClick:m[55]||(m[55]=t.withModifiers((...M)=>Z.cancelFormulaBarEdit&&Z.cancelFormulaBarEdit(...M),["stop"]))},[...m[118]||(m[118]=[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)])],40,s2),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:t.unref(g)(f.locale,"formulaBarAccept"),"aria-label":t.unref(g)(f.locale,"accept"),onMousedown:m[56]||(m[56]=t.withModifiers(()=>{},["prevent"])),onClick:m[57]||(m[57]=t.withModifiers((...M)=>Z.acceptFormulaBarEdit&&Z.acceptFormulaBarEdit(...M),["stop"]))},[...m[119]||(m[119]=[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)])],40,c2),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(g)(f.locale,"insertFunctionTitle"),"aria-label":t.unref(g)(f.locale,"insertFunctionTitle"),onMousedown:m[58]||(m[58]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Ne,["stop"])},[...m[120]||(m[120]=[t.createElementVNode("svg",{class:"formula-bar__fx-icon",width:"16",height:"16",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[t.createElementVNode("path",{fill:"currentColor",d:"M841 370c3-3.3 2.7-8.3-0.6-11.3-1.5-1.3-3.4-2.1-5.3-2.1h-72.6c-2.4 0-4.6 1-6.1 2.8L633.5 504.6c-2.9 3.4-7.9 3.8-11.3 0.9-0.9-0.8-1.6-1.7-2.1-2.8l-63.5-141.3c-1.3-2.9-4.1-4.7-7.3-4.7H380.7l0.9-4.7 8-42.3c10.5-55.4 38-81.4 85.8-81.4 18.6 0 35.5 1.7 48.8 4.7l14.1-66.8c-22.6-4.7-35.2-6.1-54.9-6.1-103.3 0-156.4 44.3-175.9 147.3l-9.4 49.4h-97.6c-3.8 0-7.1 2.7-7.8 6.4L181.9 415c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H284l-89 429.9c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H269c3.8 0 7.1-2.7 7.8-6.4l89.7-433.1h135.8l68.2 139.1c1.4 2.9 1 6.4-1.2 8.8l-180.6 203c-2.9 3.3-2.6 8.4 0.7 11.3 1.5 1.3 3.4 2 5.3 2h72.7c2.4 0 4.6-1 6.1-2.8l123.7-146.7c2.8-3.4 7.9-3.8 11.3-1 0.9 0.8 1.6 1.7 2.1 2.8L676.4 784c1.3 2.8 4.1 4.7 7.3 4.7h64.6c4.4 0 8-3.6 8-8 0-1.2-0.3-2.4-0.8-3.5l-95.2-198.9c-1.4-2.9-0.9-6.4 1.3-8.8L841 370z"})],-1)])],40,d2)]),t.createElementVNode("textarea",{ref:He,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":Z.formulaBarExpanded}]),rows:Z.formulaBarExpanded?3:1,value:Z.formulaBarDisplay,spellcheck:"false",onFocus:m[59]||(m[59]=(...M)=>Z.onFormulaBarFocus&&Z.onFormulaBarFocus(...M)),onInput:m[60]||(m[60]=(...M)=>Z.onFormulaBarInput&&Z.onFormulaBarInput(...M)),onKeydown:m[61]||(m[61]=(...M)=>Z.onFormulaBarKeydown&&Z.onFormulaBarKeydown(...M)),onBlur:m[62]||(m[62]=(...M)=>Z.onFormulaBarBlur&&Z.onFormulaBarBlur(...M))},null,42,u2),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:t.unref(g)(f.locale,Z.formulaBarExpanded?"formulaBarCollapse":"formulaBarExpand"),onMousedown:m[63]||(m[63]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(be,["stop"])},[Z.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",p2,[...m[122]||(m[122]=[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",m2,[...m[121]||(m[121]=[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,f2)],2),t.createElementVNode("div",{ref:v,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:P,class:"grid-canvas",tabindex:"0",onMousedown:m[64]||(m[64]=(...M)=>Z.onMouseDown&&Z.onMouseDown(...M)),onMousemove:m[65]||(m[65]=(...M)=>Z.onMouseMove&&Z.onMouseMove(...M)),onMouseup:m[66]||(m[66]=(...M)=>Z.onMouseUp&&Z.onMouseUp(...M)),onMouseleave:m[67]||(m[67]=(...M)=>Z.onMouseLeave&&Z.onMouseLeave(...M)),onDblclick:m[68]||(m[68]=(...M)=>Z.onDblClick&&Z.onDblClick(...M)),onWheel:m[69]||(m[69]=t.withModifiers((...M)=>Z.onWheel&&Z.onWheel(...M),["prevent"])),onFocus:m[70]||(m[70]=(...M)=>N.onCanvasFocus&&N.onCanvasFocus(...M)),onKeydown:m[71]||(m[71]=(...M)=>Z.onKeydown&&Z.onKeydown(...M)),onContextmenu:m[72]||(m[72]=(...M)=>Z.onCanvasCtx&&Z.onCanvasCtx(...M)),onTouchstart:m[73]||(m[73]=t.withModifiers((...M)=>Z.onTouchStart&&Z.onTouchStart(...M),["prevent"])),onTouchmove:m[74]||(m[74]=t.withModifiers((...M)=>Z.onTouchMove&&Z.onTouchMove(...M),["prevent"])),onTouchend:m[75]||(m[75]=(...M)=>Z.onTouchEnd&&Z.onTouchEnd(...M))},null,32),t.createElementVNode("canvas",{ref:le,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:Re,class:"cell-editor",value:f.editValue,style:t.normalizeStyle(Z.editInputStyle),onInput:m[76]||(m[76]=(...M)=>Z.onEditInput&&Z.onEditInput(...M)),onKeydown:m[77]||(m[77]=(...M)=>Z.onEditKd&&Z.onEditKd(...M)),onCompositionstart:m[78]||(m[78]=(...M)=>Z.onEditCompositionStart&&Z.onEditCompositionStart(...M)),onCompositionend:m[79]||(m[79]=(...M)=>Z.onEditCompositionEnd&&Z.onEditCompositionEnd(...M)),onBlur:m[80]||(m[80]=(...M)=>Z.onEditBlur&&Z.onEditBlur(...M)),onPaste:m[81]||(m[81]=(...M)=>Z.onEditPaste&&Z.onEditPaste(...M))},null,44,h2),N.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:Z.vScrollbarTop+"px",height:`calc(100% - ${Z.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:m[82]||(m[82]=t.withModifiers(M=>{N.clampScroll(null,f.scrollY-50),Z.scheduleRender()},["prevent"]))},[...m[123]||(m[123]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:m[84]||(m[84]=(...M)=>Z.onVTrk&&Z.onVTrk(...M))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:Z.vThumbT+"px",height:Z.vThumbH+"px"}),onMousedown:m[83]||(m[83]=(...M)=>Z.onVStart&&Z.onVStart(...M))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:m[85]||(m[85]=t.withModifiers(M=>{N.clampScroll(null,f.scrollY+50),Z.scheduleRender()},["prevent"]))},[...m[124]||(m[124]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),N.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:Z.hScrollbarLeft+"px",width:`calc(100% - ${Z.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:m[86]||(m[86]=t.withModifiers(M=>{N.clampScroll(f.scrollX-50,null),Z.scheduleRender()},["prevent"]))},[...m[125]||(m[125]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:m[88]||(m[88]=(...M)=>Z.onHTrk&&Z.onHTrk(...M))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:Z.hThumbL+"px",width:Z.hThumbW+"px"}),onMousedown:m[87]||(m[87]=(...M)=>Z.onHStart&&Z.onHStart(...M))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:m[89]||(m[89]=t.withModifiers(M=>{N.clampScroll(f.scrollX+50,null),Z.scheduleRender()},["prevent"]))},[...m[126]||(m[126]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),N.maxScrollX>0&&N.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",g2)):t.createCommentVNode("",!0),Z.noteUi&&Un.value?(t.openBlock(),t.createBlock(G1,{key:3,anchor:Un.value,mode:Z.noteUi.mode,note:K.value,author:l.noteAuthor,locale:f.locale,placeholder:U.value,"boundary-el":Qe.value,onSave:m[90]||(m[90]=M=>t.unref(h).saveNoteAt(Z.noteUi.row,Z.noteUi.col,M,l.noteAuthor)),onDelete:m[91]||(m[91]=M=>t.unref(h).removeNoteAt(Z.noteUi.row,Z.noteUi.col)),onClose:m[92]||(m[92]=M=>t.unref(h).closeNote())},null,8,["anchor","mode","note","author","locale","placeholder","boundary-el"])):t.createCommentVNode("",!0)]),t.createVNode(ku,{locale:f.locale,sheets:t.unref(Y),"active-sheet-index":t.unref(te),"ren-tab":Z.renTab,"ren-tab-val":Z.renTabVal,"boundary-el":Qe.value,onTabClick:m[93]||(m[93]=M=>Z.onTabClick(M)),onTabDblclick:m[94]||(m[94]=M=>Z.onTabDblClick(M)),onTabContextmenu:m[95]||(m[95]=M=>Z.onTabCtxMenu(M.ev,M.i)),onTabRenameInput:m[96]||(m[96]=M=>Ue(M)),onTabRenameKeydown:m[97]||(m[97]=M=>Z.onTabRenameKd(M)),onTabRenameCommit:Z.commitTabRename,onTabbarContextmenu:m[98]||(m[98]=M=>Z.onTabBarCtx(M)),onDeleteSheet:m[99]||(m[99]=M=>{N.removeSheet(M),Z.scheduleRender()}),onAddSheet:m[100]||(m[100]=M=>{N.addSheet(),Z.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","boundary-el","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[Z.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:Z.ctxMenu.x+"px",top:Z.ctxMenu.y+"px"}),onClick:m[101]||(m[101]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.ctxMenu.items,(M,it)=>(t.openBlock(),t.createElementBlock("div",{key:it,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":M.disabled}]),onClick:vt=>!M.disabled&&M.action&&(M.action(),ke()),onMouseenter:vt=>Z.onCtxItemEnter(vt,M)},[t.createElementVNode("span",y2,t.toDisplayString(M.label),1),M.children?(t.openBlock(),t.createElementBlock("svg",C2,[...m[127]||(m[127]=[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),M.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":Z.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.children,(vt,At)=>(t.openBlock(),t.createElementBlock("div",{key:At,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":vt.disabled}]),onClick:t.withModifiers(Dt=>!vt.disabled&&vt.action&&(vt.action(),ke()),["stop"])},t.toDisplayString(vt.label),11,w2))),128))],2)):t.createCommentVNode("",!0)],42,b2))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),Z.filterPopup?(t.openBlock(),t.createBlock(fm,{key:Z.filterPopup.col,col:Z.filterPopup.col,"header-label":_e(Z.filterPopup.col),anchor:{x:Z.filterPopup.x,y:Z.filterPopup.y},locale:f.locale,"get-filter":f.getFilter,"set-filter":f.setFilter,"set-filter-column":f.setFilterColumn,"clear-filter-column":f.clearFilterColumn,"get-column-candidates":f.getColumnCandidates,close:Z.closeFilterPopup,"boundary-el":Qe.value},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close","boundary-el"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[I.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:m[103]||(m[103]=t.withModifiers(M=>I.value=!1,["self"]))},[t.createVNode(Bm,{locale:f.locale,rules:f.conditionalFormats,"theme-vars":N.toolbarThemeVars,onNew:z,onEdit:gt,onDelete:Ae,onMove:w,onToggle:X,onClose:m[102]||(m[102]=M=>I.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[H.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:m[105]||(m[105]=t.withModifiers(M=>H.value=!1,["self"]))},[t.createVNode(p0,{locale:f.locale,mode:V.value,rule:$.value,"default-range-text":B.value,"theme-vars":N.toolbarThemeVars,onSave:We,onCancel:m[104]||(m[104]=M=>H.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),Z.validationDropdown?(t.openBlock(),t.createBlock(M1,{key:`${Z.validationDropdown.col},${Z.validationDropdown.row}`,items:Z.validationDropdown.items,current:Z.validationDropdown.current,locale:f.locale,x:Z.validationDropdown.x,y:Z.validationDropdown.y,width:Z.validationDropdown.width,height:Z.validationDropdown.height,"boundary-el":Qe.value,onSelect:m[106]||(m[106]=M=>t.unref(h).onValidationDropdownSelect(M)),onClose:m[107]||(m[107]=M=>t.unref(h).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height","boundary-el"])):t.createCommentVNode("",!0),ln.value?(t.openBlock(),t.createBlock(L1,{key:2,title:ln.value.title,message:ln.value.message,x:ln.value.x,y:ln.value.y,width:ln.value.width,height:ln.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[dt.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:m[109]||(m[109]=t.withModifiers(M=>dt.value=!1,["self"]))},[t.createVNode(b1,{locale:f.locale,mode:Ct.value,rule:Nt.value,"default-range-text":$t.value,"theme-vars":N.toolbarThemeVars,onSave:tn,onClear:Jt,onCancel:m[108]||(m[108]=M=>dt.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[xt.value?(t.openBlock(),t.createElementBlock("div",v2,[t.createVNode(Ia,{locale:f.locale,severity:xt.value.severity,title:xt.value.title,message:xt.value.message,"theme-vars":N.toolbarThemeVars,onResolve:Ln},null,8,["locale","severity","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Mn.value?(t.openBlock(),t.createElementBlock("div",k2,[t.createVNode(Ia,{locale:f.locale,severity:"information",title:t.unref(g)(f.locale,"outlineAlertTitle"),message:Mn.value,"theme-vars":N.toolbarThemeVars,onResolve:Nn},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(()=>[Z.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:Z.dimPanel.x+"px",top:Z.dimPanel.y+"px"}),onMousedown:m[115]||(m[115]=t.withModifiers(()=>{},["stop"])),onTouchstart:m[116]||(m[116]=t.withModifiers(()=>{},["stop"])),onClick:m[117]||(m[117]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",E2,t.toDisplayString(Z.dimPanel.type==="row"?t.unref(g)(f.locale,"rowHeight"):t.unref(g)(f.locale,"colWidth")),1),t.createElementVNode("div",R2,[t.createElementVNode("input",{ref:Ie,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":Z.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:Z.dimPanel.value,onInput:m[110]||(m[110]=(...M)=>Z.onDimInput&&Z.onDimInput(...M)),onKeydown:m[111]||(m[111]=(...M)=>Z.onDimKeydown&&Z.onDimKeydown(...M)),onBlur:m[112]||(m[112]=(...M)=>Z.onDimBlur&&Z.onDimBlur(...M))},null,42,S2)]),Z.dimPanel.error?(t.openBlock(),t.createElementBlock("div",M2,t.toDisplayString(Z.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",N2,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:m[113]||(m[113]=(...M)=>Z.applyDimPanel&&Z.applyDimPanel(...M))},t.toDisplayString(t.unref(g)(f.locale,"ok")),1),t.createElementVNode("button",{class:"dim-panel__btn",onClick:m[114]||(m[114]=(...M)=>Z.closeDimPanel&&Z.closeDimPanel(...M))},t.toDisplayString(t.unref(g)(f.locale,"cancel")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-bd16d45d"]]);ko.Spreader=Ni,ko.default=Ni,Object.defineProperties(ko,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(En,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(En=typeof globalThis<"u"?globalThis:En||self,t(En.XiaoDaoSpreader={},En.Vue))})(this,function(En,t){"use strict";const Zr="",Si={"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:"取消",accept:"接受",formulaBarAccept:"接受(Enter)",formulaBarCancel:"取消(Esc)",formulaBarExpand:"展开为3行",formulaBarCollapse:"折叠为1行",searchNoMatch:"无匹配",emptyCellLabel:"(空)",cfRangeInvalid:"范围格式无效,例如 A1:B10",cfFormulaRequired:"请输入公式",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:"墨绿",colorPurple:"紫色",colorCyan:"青色",borderColor:"边框颜色",borderLineStyle:"边框线型",lineSolid:"实线",lineDashed:"虚线",lineDotted:"点线",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:"自定义筛选",filterBack:"返回",filterDateHint:"支持日期格式:YYYY-MM-DD、YYYY/MM/DD、YYYY年M月D日",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",outlineGroup:"分组",outlineAddGroup:"添加分组",outlineRows:"行分组",outlineColumns:"列分组",outlineAddRowGroup:"添加行分组",outlineAddColumnGroup:"添加列分组",outlineUngroup:"取消分组",outlineUngroupRows:"取消行分组",outlineUngroupColumns:"取消列分组",outlineClear:"清除分组",outlineClearAll:"清除全部分组",outlineExpand:"展开",outlineCollapse:"折叠",outlineExpandAll:"全部展开",outlineCollapseAll:"全部折叠",outlineRowsLabel:"行",outlineColumnsLabel:"列",outlineLevel:"级别",outlineLevelLabel:"等级",outlineNeedRowsOrColumns:"请选择整行或整列后分组",outlineInvalidRange:"无效的分组范围:分组至少需要连续 2 个行或列",outlineCrossing:"分组范围与现有分组交叉,请调整",outlineTooDeep:"分组不能嵌套,仅支持一层",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:"填充颜色",note:"批注",newNote:"新建批注",editNote:"编辑批注",deleteNote:"删除批注",noteSave:"保存",noteAuthor:"作者",noteUnnamed:"未命名",noteEmpty:"(无内容)",notePlaceholder:"输入批注内容…",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",accept:"Accept",formulaBarAccept:"Accept (Enter)",formulaBarCancel:"Cancel (Esc)",formulaBarExpand:"Expand to 3 rows",formulaBarCollapse:"Collapse to 1 row",searchNoMatch:"No matches",emptyCellLabel:"(blank)",cfRangeInvalid:"Invalid range format, e.g. A1:B10",cfFormulaRequired:"Please enter a formula",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",colorPurple:"Purple",colorCyan:"Cyan",borderColor:"Border Color",borderLineStyle:"Line Style",lineSolid:"Solid",lineDashed:"Dashed",lineDotted:"Dotted",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",filterBack:"Back",filterDateHint:"Date formats: YYYY-MM-DD, YYYY/MM/DD, YYYY/M/D",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",outlineGroup:"Group",outlineAddGroup:"Add 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:"Groups cannot be nested; single level only",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",note:"Note",newNote:"New Note",editNote:"Edit Note",deleteNote:"Delete Note",noteSave:"Save",noteAuthor:"Author",noteUnnamed:"Unnamed",noteEmpty:"(Empty)",notePlaceholder:"Enter note text…",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,o){var l;return((l=Si[e])==null?void 0:l[o])??o}const Tn='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',sn=16,Ni=[{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'}],Bi=[{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}],xi='<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>',Ti='<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>',Vi='<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>',Di='<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>',Fi='<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>',Oi='<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>',Ii=[{value:"left",labelKey:"alignLeft",icon:xi},{value:"center",labelKey:"alignCenter",icon:Ti},{value:"right",labelKey:"alignRight",icon:Vi}],Ai=[{value:"top",labelKey:"alignTop",icon:Di},{value:"middle",labelKey:"alignMiddle",icon:Fi},{value:"bottom",labelKey:"alignBottom",icon:Oi}],Li=[{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>'}],zi={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",toolbarTextSecondary:"#666",toolbarTextMuted:"#999",toolbarItemActiveBg:"#e5f1fb",dangerHoverBg:"#fce8e6",findHintColor:"#888",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},$i={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(0,0,0,0.25)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",toolbarTextSecondary:"#aaa",toolbarTextMuted:"#888",toolbarItemActiveBg:"rgba(78, 161, 255, 0.16)",dangerHoverBg:"rgba(197, 34, 31, 0.18)",findHintColor:"#aaa",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"};function Et(e){let o="",l=e;do o=String.fromCharCode(65+l%26)+o,l=Math.floor(l/26)-1;while(l>=0);return o}function or(e){let o=0;for(let l=0;l<e.length;l++)o=o*26+(e.toUpperCase().charCodeAt(l)-64);return o-1}function Vn(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const o=parseFloat(e);return e.endsWith("%")||isNaN(o)?null:o}return null}function rr(e){navigator.clipboard.writeText(e).catch(()=>{const o=document.createElement("textarea");o.value=e,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)})}function Wn(e,o){return`${e},${o}`}function El(e,o,l){const n=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!n)return null;const a=or(n[1]),i=parseInt(n[2],10)-1;return a<0||a>=o||i<0||i>=l?null:{col:a,row:i}}function Rn(e,o){if(!o)return{x:0,y:0};const l=o.getBoundingClientRect();return{x:e.clientX-l.left,y:e.clientY-l.top}}function Vl(e){const o=window.innerWidth,l=window.innerHeight,n=(e==null?void 0:e.getBoundingClientRect())??null;return n?{left:Math.max(0,Math.min(o,n.left)),right:Math.max(0,Math.min(o,n.right)),top:Math.max(0,Math.min(l,n.top)),bottom:Math.max(0,Math.min(l,n.bottom))}:{left:0,right:o,top:0,bottom:l}}function Dn(e){return window.innerWidth-e}const cn="__nf_custom__",Xl="",dn="",Dl="@",Mo="__NF_INVALID__",ar=2958465,ir=0;function Fl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function sr(e){return e==="zh-CN"?"¥":"$"}function _i(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Jr(e){return e.replace(/"([^"]*)"/g,"$1")}function Hi(e){let o=e,l;const n=o.match(/^\[([^\]]+)\]/);n&&(l=n[1].toLowerCase(),o=o.slice(n[0].length)),o=_i(o);const a=/E[+-]/i.test(o),i=o.includes("%"),r=o.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:i?100:1,scientific:!1,prefix:o,suffix:"",color:l};let s=-1;for(let Se=o.length-1;Se>=0;Se--){const be=o[Se];if(be==="0"||be==="#"||be==="?"||be==="E"){s=Se;break}}s<0&&(s=r);const d=r>0?o.slice(0,r):"",m=s<o.length-1?o.slice(s+1):"",p=o.slice(r,s+1),B=/[0#?]/.test(p),f=p.includes(",");let w=p.replace(/,/g,"");if(a){const Se=w.search(/E/i);Se>=0&&(w=w.slice(0,Se))}const S=w.indexOf("."),$=S>=0?w.slice(0,S):w,q=S>=0?w.slice(S+1):"",ae=(q.match(/[0#?]/g)||[]).length,fe=(q.match(/0/g)||[]).length,Ce=($.match(/0/g)||[]).length;return{hasDigits:B,decimals:ae,minDecimals:fe,minIntDigits:Ce,thousands:f,scale:i?100:1,scientific:a,prefix:d,suffix:m,color:l}}function Wi(e){const o=[];let l=!1;const n=/\[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=n.exec(e))!==null;){const i=a[0];switch(i){case"[h]":l=!0,o.push({type:"hour",len:0});break;case"[mm]":l=!0,o.push({type:"minute",len:2});break;case"[ss]":l=!0,o.push({type:"second",len:2});break;case"yyyy":o.push({type:"year",len:4});break;case"yy":case"y":o.push({type:"year",len:2});break;case"mmmm":o.push(l?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":o.push(l?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":o.push(l?{type:"minute",len:2}:{type:"month",len:2});break;case"m":o.push(l?{type:"minute",len:1}:{type:"month",len:1});break;case"dddd":o.push({type:"weekday",len:4});break;case"ddd":o.push({type:"weekday",len:3});break;case"dd":o.push({type:"day",len:2});break;case"d":o.push({type:"day",len:1});break;case"hh":o.push({type:"hour",len:2});break;case"h":o.push({type:"hour",len:1});break;case"ss":o.push({type:"second",len:2});break;case"s":o.push({type:"second",len:1});break;case"AM/PM":case"am/pm":o.push({type:"ampm",len:2});break;default:i.startsWith('"')?o.push({type:"literal",text:Jr(i),len:0}):o.push({type:"literal",text:i,len:0})}}return{tokens:o,isDuration:l}}const Qr=new Map;function Ui(e){const o=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(o)||/AM\/PM/i.test(o)||/\[h\]/i.test(o)){const i=e.split(";")[0]??e,{tokens:r,isDuration:s}=Wi(i);return{kind:s?"duration":"date",sections:[],tokens:r,isDuration:s,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Hi(i)),tokens:[],isDuration:!1,raw:e}}function un(e){const o=Qr.get(e);if(o)return o;const l=Ui(e);return Qr.set(e,l),l}function ea(e,o,l,n,a){const i=Math.pow(10,o),r=Math.round((e+Number.EPSILON)*i)/i,s=r<0,d=Math.abs(r);let p=new Intl.NumberFormat("en-US",{useGrouping:n,minimumIntegerDigits:a,minimumFractionDigits:o,maximumFractionDigits:o}).format(d);if(l<o&&o>0){const f=p.indexOf(".");if(f>=0){const I=p.substring(0,f);let w=p.substring(f+1);w=w.replace(/0+$/,""),w.length<l&&(w=w+"0".repeat(l-w.length)),p=w?`${I}.${w}`:I}}return`${s?"-":""}${p}`}function ta(e,o){if(e===0)return(o>0?"0."+"0".repeat(o):"0")+"E+00";const l=Math.floor(Math.log10(Math.abs(e))),n=e/Math.pow(10,l),a=ea(n,o,o,!1,1),i=(l>=0?"+":"-")+String(Math.abs(l)).padStart(2,"0");return`${a}E${i}`}function Pi(e,o,l){if(!l.hasDigits)return Jr(l.prefix+l.suffix);const n=l.scale===100?e*100:e,a=l.scientific?ta(n,l.decimals):ea(n,l.decimals,l.minDecimals,l.thousands,l.minIntDigits);return o+l.prefix+a+l.suffix}function Ki(e,o){const l=o.sections;if(l.length===0)return String(e);let n,a,i="";return e>0?(n=l[0],a=e):e<0?l[1]?(n=l[1],a=-e):(n=l[0],a=-e,i="-"):(n=l[2]??l[0],a=0),Pi(a,i,n)}function Gi(e){return new Date((e-25569)*864e5)}const qi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Yi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],la=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ji=["January","February","March","April","May","June","July","August","September","October","November","December"],Xi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],na=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Un(e,o){return String(e).padStart(o,"0")}function Zi(e,o,l,n){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),s=e.getUTCDay(),d=l==="zh-CN";let m="",p=!1;for(const B of o)switch(B.type){case"literal":m+=B.text??"";break;case"year":m+=B.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":m+=Un(p?e.getUTCMinutes():i,B.len);break;case"monthName":m+=B.len>=4?d?qi[i-1]:ji[i-1]:d?Yi[i-1]:Xi[i-1];break;case"day":m+=Un(r,B.len);break;case"weekday":m+=B.len>=4?d?la[s]:na[s]:d?la[s].slice(2):na[s].slice(0,3);break;case"hour":{let f=e.getUTCHours();if(B.len===0){const I=Math.floor(n*86400);f=Math.floor(I/3600)}m+=String(f),p=!0;break}case"minute":m+=Un(e.getUTCMinutes(),B.len);break;case"second":m+=Un(e.getUTCSeconds(),B.len);break;case"ampm":{const f=e.getUTCHours();m+=f<12?d?"上午":"AM":d?"下午":"PM";break}}return m}function Ji(e,o){const l=Math.floor(e*86400),n=Math.floor(l/3600),a=Math.floor(l%3600/60),i=l%60;let r="";for(const s of o)switch(s.type){case"literal":r+=s.text??"";break;case"hour":r+=String(n);break;case"minute":r+=Un(a,s.len||2);break;case"second":r+=Un(i,s.len||2);break;default:r+=""}return r}function Qi(e){if(e==="")return e;const o=Number(e);if(!isNaN(o)&&e.trim()!==""){const l=Math.abs(o);return l!==0&&(l>=1e15||l<1e-9)?ta(o,9):e}return e}function zl(e,o,l){if(Fl(o))return Qi(e);if(o==null||o===Dl)return e;const n=un(o);if(n.kind==="date"||n.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(n.kind==="date"){if(i<ir||i>ar)return Mo}else if(i<0)return Mo;return n.kind==="duration"?Ji(i,n.tokens):Zi(Gi(i),n.tokens,l,i)}const a=Number(e);return isNaN(a)?e:Ki(a,n)}const es=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function cr(e,o){if(o===Dl||o==="@")return!1;if(Fl(o)){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}const l=un(o);return!!(l.kind==="number"&&oa(l))}function oa(e){return e.sections.some(o=>o.hasDigits)}function ra(e){if(e==null||Fl(e)||e===Dl||e==="@")return!1;const o=un(e);return!!(o.kind==="date"||o.kind==="duration"||o.kind==="number"&&oa(o))}function aa(e,o){if(o==null||Fl(o)||o===Dl||o==="@")return!1;const l=un(o),n=Number(e);return Number.isFinite(n)?l.kind==="date"?n<ir||n>ar:l.kind==="duration"?n<0:!1:!1}const dr=30,ur=0;function $l(e){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}function ia(e,o){if(e==null||e===Xl||Fl(e))return $l(o);if(e===Dl)return!1;const l=un(e);return l.kind==="date"||l.kind==="duration"?!1:l.sections.some(n=>n.hasDigits)}function ts(e){if(!$l(e))return 0;const o=String(Number(e));return o.indexOf(".")<0||/e/i.test(o)?0:o.slice(o.indexOf(".")+1).length}function ls(e,o){if(!ia(e,o))return-1;if(e==null||e===Xl||Fl(e))return ts(o);const n=un(e).sections.find(a=>a.hasDigits);return n?n.decimals:-1}function ns(e,o){let l=0;const n=/\[[^\]]*\]/g;let a;for(;(a=n.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),s=r.search(/[0#?]/);if(s===-1)return e;let d=-1;for(let $=r.length-1;$>=0;$--){const q=r[$];if(q==="0"||q==="#"||q==="?"||q==="E"){d=$;break}}if(d<s)return e;const m=r.slice(s,d+1),p=m.search(/E[+-]/i),B=p>=0?m.slice(0,p):m,f=B.indexOf("."),I=f>=0?(B.slice(f+1).match(/[0#?]/g)||[]).length:0;if(I===o)return e;let w;if(f<0)w=o>0?B+"."+"0".repeat(o):B;else if(o>I)w=B+"0".repeat(o-I);else{let $=I-o;const q=B.split("");for(let ae=q.length-1;ae>=0&&$>0;ae--){const fe=q[ae];(fe==="0"||fe==="#"||fe==="?")&&(q.splice(ae,1),$--)}w=q.join(""),o===0&&w.endsWith(".")&&(w=w.slice(0,-1))}const S=w+(p>=0?m.slice(p):"");return i+r.slice(0,s)+S+r.slice(d+1)}function os(e,o){if(!Number.isInteger(o)||o<ur||o>dr||e===Xl)return null;if(e==null||Fl(e))return o>0?"0."+"0".repeat(o):"0";if(e===Dl)return null;const l=un(e);return l.kind==="date"||l.kind==="duration"||!l.sections.some(n=>n.hasDigits)?null:e.split(";").map(n=>ns(n,o)).join(";")}const fr=["¥","$","€","£"];function sa(e,o){if(e==null||e===Xl)return e??dn;if(Fl(e))return dn;if(e===Dl||e==="@")return Dl;const l=sr(o),n=o==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",a=o==="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(ca(o).some(I=>I.value===e))return e;const d=e.replace(/\[[^\]]*\]/gi,I=>/^\[(h|mm|ss)\]$/i.test(I)?I:"");if(/\[(h|mm|ss)\]/i.test(d)&&!/[yd]/i.test(d))return"[h]:mm:ss";const m=/[yd]/i.test(d),p=/h|s|AM\/PM/i.test(d);if(m&&p)return a;if(m||/AM\/PM/i.test(d))return n;if(p)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 B=fr.find(I=>e.startsWith(I));if(B)return e.includes("(")?i:/\.\d/.test(e.slice(B.length))?l+"#,##0.00":l+"#,##0";const f=un(e);return f.kind==="number"&&f.sections.some(I=>I.hasDigits)?"#,##0.00":cn}function rs(e,o){return new Date(Date.UTC(e,o,0)).getUTCDate()}function as(e,o,l){const n=Date.UTC(e,o-1,l)/864e5+25569;return n<=60?n-1:n}function Zl(e,o,l=new Date){const n=e.trim();if(!n||n.startsWith("=")||$l(n))return null;const a=o==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=o==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function s(f){const I=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(f);if(!I)return null;const w=Number(I[1]),S=Number(I[2]),$=I[3]!==void 0?Number(I[3]):0;return w>23||S>59||$>59?null:(w*3600+S*60+$)/86400}function d(f){let I=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(f),w,S,$;if(I)w=Number(I[1]),S=Number(I[2]),$=Number(I[3]);else if(I=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(f))w=Number(I[1]),S=Number(I[2]),$=Number(I[3]);else if(I=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(f))S=Number(I[1]),$=Number(I[2]),w=Number(I[3]);else if(I=/^(\d{1,2})[-/](\d{1,2})$/.exec(f))w=l.getUTCFullYear(),S=Number(I[1]),$=Number(I[2]);else return null;if(w<1900||w>9999||S<1||S>12||$<1||$>rs(w,S))return null;const q=as(w,S,$);return q>=ir&&q<=ar?q:null}const m=s(n);if(m!==null)return{serial:m,format:r};const p=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(n);if(p){const f=d(p[1].trim()),I=s(p[2]);if(f!==null&&I!==null)return{serial:f+I,format:i}}const B=d(n);return B!==null?{serial:B,format:a}:null}function So(e,o){const l=e.trim();if(!l||l.startsWith("=")||!(l.includes(",")||l.includes("%")||fr.some(ae=>l.startsWith(ae)))||Zl(l,o))return null;const a=fr.find(ae=>l.startsWith(ae)),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 s=r[1]==="-"?-1:1,d=r[2].replace(/,/g,""),m=r[3],p=(r[4]??"")==="%",B=m?m.length:0,f=+(d+(m?"."+m:""));if(!Number.isFinite(f))return null;const w=i.includes(",")?"#,##0":"0",S=B>0?"."+"0".repeat(B):"",$=(a??"")+w+S+(p?"%":"");let q=f*s;return p&&(q=q/100),q=Math.round(q*1e12)/1e12,{num:q,format:$}}function is(e,o,l,n){const a=sr(e),i=n?"#,##0":"0",r=l>0?"."+"0".repeat(l):"",s=i+r;switch(o){case"general":return"";case"text":return Dl;case"custom":return"";case"number":return s;case"percent":return s+"%";case"scientific":return"0."+"0".repeat(l)+"E+00";case"currency":return a+s;case"currencyRounded":return a+(n?"#,##0":"0");case"accounting":return`${a}${s};(${a}${s});${a}"-"`;case"financial":return`${s};[Red](${s})`;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 ca(e){const o=sr(e);return[{label:b(e,"nfGeneral"),value:dn},{label:b(e,"nfText"),value:Dl},{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:`${o}#,##0.00;(${o}#,##0.00);${o}"-"`},{label:b(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:b(e,"nfCurrency"),value:o+"#,##0.00"},{label:b(e,"nfCurrencyRounded"),value:o+"#,##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:cn}]}const ss=["disabled","title"],cs=["innerHTML"],ds=["disabled"],us=["placeholder"],fs=["disabled","onClick"],ms=["innerHTML"],ps={key:2,class:"sp-dropdown__empty"},hs=["disabled"],gs=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},locale:{default:"zh-CN"},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:""},boundaryEl:{default:null},previewFont:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:o}){const l=e,n=o,a=t.inject("sp-theme","light"),i=t.ref(!1),r=t.ref(0),s=t.ref(null),d=t.ref(null),m=t.ref(null),p=t.ref({top:0,up:!1}),B=t.ref(void 0),f=t.ref(0),I=t.ref(!1),w=t.ref(""),S=t.ref(null),$=t.computed(()=>l.options.find(se=>String(se.value)===String(l.modelValue)));function q(se){if(l.previewFont&&!(typeof se!="string"||!se))return{fontFamily:se}}const ae=t.computed(()=>l.menuWidth!==void 0?l.menuWidth:B.value),fe=t.computed(()=>{if(!l.searchable||!w.value.trim())return l.options;const se=w.value.trim().toLowerCase();return l.options.filter(ue=>String(ue.label??"").toLowerCase().includes(se))}),Ce=t.computed(()=>fe.value.length>0),Se=t.computed(()=>Math.min(l.visibleCount,fe.value.length)),be=t.computed(()=>fe.value.slice(r.value,r.value+Se.value)),Ge=t.computed(()=>r.value>0),pe=t.computed(()=>r.value+Se.value<fe.value.length),ie=t.computed(()=>fe.value.length>Se.value);function Ne(se){r.value=Math.max(0,Math.min(fe.value.length-Se.value,r.value+se))}function ft(){const se=l.triggerEl??s.value;if(!se)return;const ue=se.getBoundingClientRect();B.value=ue.width,i.value=!0,l.searchable&&(w.value=""),l.modelOpen!==void 0&&n("update:modelOpen",!0);const Le=ue.bottom+4,_e=Vl(l.boundaryEl);l.align==="right"?p.value={right:Dn(Math.min(ue.right,_e.right)),top:Le,up:!1}:p.value={left:Math.max(_e.left,ue.left),top:Le,up:!1};const dt=fe.value.findIndex(ht=>String(ht.value)===String(l.modelValue));r.value=dt>=0?Math.max(0,Math.min(dt-Math.floor(Se.value/2),fe.value.length-Se.value)):0,l.searchable&&t.nextTick(()=>{var ht;return(ht=S.value)==null?void 0:ht.focus()}),t.nextTick(()=>{const ht=l.triggerEl??s.value;if(!ht)return;const T=ht.getBoundingClientRect(),ne=m.value;if(!ne)return;const W=ne.offsetHeight,F=_e.bottom-T.bottom-8,_=T.top-_e.top-8,L=F<W&&_>0,x=L?T.top-W-4:T.bottom+4,U=Math.min(_e.top+8,T.bottom+4),te=Math.max(U,Math.min(_e.bottom-W-8,x));l.align==="right"?p.value={right:Dn(Math.min(T.right,_e.right)),top:te,up:L}:p.value={left:Math.max(_e.left,T.left),top:te,up:L}})}function mt(){i.value=!1,w.value="",l.modelOpen!==void 0&&n("update:modelOpen",!1)}function v(){l.disabled||(i.value?mt():ft())}function A(se){se.disabled||(n("update:modelValue",se.value),n("change",se.value),mt())}function X(se){var Le,_e;if(!i.value)return;const ue=se.target;(Le=s.value)!=null&&Le.contains(ue)||(_e=m.value)!=null&&_e.contains(ue)||mt()}function ze(se){i.value&&(se.preventDefault(),Ne(se.deltaY>0?1:-1))}t.watch(i,se=>{t.nextTick(()=>{var ue,Le;se?((ue=d.value)==null||ue.addEventListener("wheel",ze,{passive:!1}),document.addEventListener("keydown",Je)):((Le=d.value)==null||Le.removeEventListener("wheel",ze),document.removeEventListener("keydown",Je))})});function Je(se){i.value&&se.key==="Escape"&&mt()}t.watch(()=>l.modelOpen,se=>{se!==void 0&&se!==i.value&&(se?ft():mt())});function oe(se){i.value&&(f.value=se.touches[0].clientY,I.value=!0)}function we(se){if(!i.value||!I.value)return;const ue=se.touches[0].clientY-f.value;Math.abs(ue)>5&&(Ne(ue<0?1:-1),f.value=se.touches[0].clientY)}function Be(){I.value=!1}function rt(se){se.key==="Escape"&&(se.stopPropagation(),mt())}return t.onMounted(()=>{document.addEventListener("pointerdown",X),window.addEventListener("resize",mt),window.addEventListener("scroll",mt,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",X),document.removeEventListener("keydown",Je),window.removeEventListener("resize",mt),window.removeEventListener("scroll",mt,!0)}),(se,ue)=>{var Le,_e,dt,ht,T,ne;return t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:s,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":i.value,"sp-dropdown__trigger--disabled":e.disabled}]),disabled:e.disabled,title:e.title,onClick:v},[(Le=$.value)!=null&&Le.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((_e=$.value)==null?void 0:_e.icon)||e.triggerIcon},null,8,cs)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"sp-dropdown__value",style:t.normalizeStyle(q(((dt=$.value)==null?void 0:dt.value)??""))},t.toDisplayString((ht=$.value)!=null&&ht.icon||e.triggerIcon?((T=$.value)==null?void 0:T.label)??e.triggerLabel:((ne=$.value)==null?void 0:ne.label)??e.fallbackLabel),5),ue[5]||(ue[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,ss)),(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:m,class:t.normalizeClass(["sp-dropdown__menu sp-spreader-overlay",{"sp-dropdown__menu--up":p.value.up,dark:t.unref(a)==="dark"}]),style:t.normalizeStyle({left:p.value.left!==void 0?p.value.left+"px":void 0,right:p.value.right!==void 0?p.value.right+"px":void 0,top:p.value.top+"px",minWidth:ae.value!==void 0?typeof ae.value=="number"?ae.value+"px":ae.value:void 0}),onKeydown:rt,onMousedown:ue[4]||(ue[4]=t.withModifiers(()=>{},["prevent"]))},[ie.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Ge.value}]),disabled:!Ge.value,onClick:ue[0]||(ue[0]=W=>Ne(-1))},[...ue[6]||(ue[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,ds)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:S,"onUpdate:modelValue":ue[1]||(ue[1]=W=>w.value=W),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:ue[2]||(ue[2]=t.withModifiers(()=>{},["stop"]))},null,40,us)),[[t.vModelText,w.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"sp-dropdown__list",onTouchstart:oe,onTouchmove:we,onTouchend:Be},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(be.value,W=>(t.openBlock(),t.createElementBlock("button",{key:String(W.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!W.disabled&&String(W.value)===String(e.modelValue),"sp-dropdown__item--disabled":W.disabled}]),disabled:W.disabled,onClick:F=>A(W)},[W.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:W.icon},null,8,ms)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"sp-dropdown__item-label",style:t.normalizeStyle(q(W.value))},t.toDisplayString(W.label),5)],10,fs))),128))],544),e.searchable&&!Ce.value?(t.openBlock(),t.createElementBlock("div",ps,t.toDisplayString(t.unref(b)(e.locale,"searchNoMatch")),1)):t.createCommentVNode("",!0),ie.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!pe.value}]),disabled:!pe.value,onClick:ue[3]||(ue[3]=W=>Ne(1))},[...ue[7]||(ue[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,hs)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),_t=(e,o)=>{const l=e.__vccOpts||e;for(const[n,a]of o)l[n]=a;return l},jt=_t(gs,[["__scopeId","data-v-308dcb4d"]]);function Fn(){const e=t.ref({top:0,up:!1});function o(l,n,a){const i=Vl(n),r=l.getBoundingClientRect(),s=Dn(Math.min(r.right,i.right));if(!a){e.value={right:s,top:r.bottom+4,up:!1};return}const d=a.offsetHeight,m=i.bottom-r.bottom-8,p=r.top-i.top-8,B=m<d&&p>0,f=B?r.top-d-4:r.bottom+4,I=Math.min(i.top+8,r.bottom+4),w=Math.max(I,Math.min(i.bottom-d-8,f));e.value={right:s,top:w,up:B}}return{pos:e,place:o}}const bs={class:"color-palette"},ys=["title","onClick"],da=_t(t.defineComponent({__name:"color-palette",props:{colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"}},emits:["pick"],setup(e,{emit:o}){const l=e,n=o,a=[[{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"}]],i=[[{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"}]],r=t.computed(()=>l.colorKey==="fill"?i:a);function s(p){return b(l.locale,p)}function d(p){const B=l.currentColor;return!B&&!p?!0:B?B.toLowerCase()===p.toLowerCase():!1}function m(p){n("pick",p)}return(p,B)=>(t.openBlock(),t.createElementBlock("div",bs,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(f,I)=>(t.openBlock(),t.createElementBlock("div",{key:I,class:"color-palette__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f,w=>(t.openBlock(),t.createElementBlock("button",{key:w.value,type:"button",class:t.normalizeClass(["color-palette__swatch",{"color-palette__swatch--selected":d(w.value),"color-palette__swatch--none":!w.value}]),title:s(w.key),style:t.normalizeStyle(w.value?{background:w.value,border:"1px solid rgba(0,0,0,0.15)"}:void 0),onClick:S=>m(w.value)},null,14,ys))),128))]))),128))]))}}),[["__scopeId","data-v-71690bf8"]]),No=_t(t.defineComponent({__name:"color-picker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:o,emit:l}){const n=t.inject("sp-theme","light"),a=e,i=l,r=t.ref(!1),s=t.ref(null),d=t.ref(null),{pos:m,place:p}=Fn();t.watch(()=>a.modelOpen,S=>{S!==void 0&&S!==r.value&&(S?f():I())});function B(S){const $=s.value,q=d.value,ae=S.target;$&&$.contains(ae)||q&&q.contains(ae)||I()}function f(){const S=a.triggerEl??s.value;S&&(r.value=!0,a.modelOpen!==void 0&&i("update:modelOpen",!0),p(S,a.boundaryEl),t.nextTick(()=>{const $=a.triggerEl??s.value;if(!$)return;const q=d.value;q&&(p($,a.boundaryEl,q),document.addEventListener("pointerdown",B))}))}function I(){r.value=!1,a.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function w(S){i("update:modelValue",S),i("change",S),I()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),o({open:r,openMenu:f,close:I}),(S,$)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:s,class:"color-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:t.normalizeClass(["color-picker__menu sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),style:t.normalizeStyle({left:t.unref(m).left!==void 0?t.unref(m).left+"px":void 0,right:t.unref(m).right!==void 0?t.unref(m).right+"px":void 0,top:t.unref(m).top+"px"}),onMousedown:$[0]||($[0]=t.withModifiers(()=>{},["stop","prevent"]))},[t.createVNode(da,{"color-key":a.colorKey,"current-color":a.currentColor,locale:a.locale,onPick:w},null,8,["color-key","current-color","locale"])],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-72e754f8"]]),ua=[{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}],Cs={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"]},ws={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function Mn(e,o){return ws[e].includes(o)?"thick":Cs[e].includes(o)?"solid":"dashed"}function fa(e){return Mn(e,"right")==="dashed"&&Mn(e,"bottom")==="dashed"}const ma=.75,pa=26,ha=26,vs=[{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"}],ks={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"};function ml(e){return e==="dashed"||e==="dotted"?e:"solid"}function ga(e,o){if(e==="solid")return null;const l=Math.max(1,o);return e==="dashed"?[Math.max(3,l*2.5),Math.max(2,l*1.5)]:[1e-4,Math.max(2,l*1.8)]}const Es=["title","onClick"],Rs={viewBox:"0 0 30 30",class:"border-picker__icon"},Ms=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Ss=["cx","cy","r"],Ns={class:"border-picker__label"},Bs={class:"border-picker__item--sub-label"},xs={class:"border-picker__item--sub-label"},Ts=["title","onClick"],Vs={viewBox:"0 0 64 20",class:"border-picker__line-preview"},Ds=["stroke-dasharray","stroke-linecap"],Fs={class:"border-picker__line-label"},Os=_t(t.defineComponent({__name:"border-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},currentColor:{default:""},currentLineStyle:{default:""},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change","changeColor","change-line-style"],setup(e,{expose:o,emit:l}){const n=t.inject("sp-theme","light"),a=e,i=l,r=t.ref(!1),s=t.ref(null),d=t.ref(null),m=t.ref(!1),p=t.ref(null),B=t.ref("right"),f=t.ref(!1);let I;const w=t.ref({top:0}),{pos:S,place:$}=Fn();t.watch(()=>a.modelOpen,se=>{se!==void 0&&se!==r.value&&(se?ae():fe())});function q(se){const ue=s.value,Le=d.value,_e=se.target;ue&&ue.contains(_e)||Le&&Le.contains(_e)||_e instanceof Element&&_e.closest(".border-submenu-wrap")||fe()}function ae(){const se=a.triggerEl??s.value;se&&(r.value=!0,a.modelOpen!==void 0&&i("update:modelOpen",!0),$(se,a.boundaryEl),t.nextTick(()=>{const ue=a.triggerEl??s.value;if(!ue)return;const Le=d.value;Le&&($(ue,a.boundaryEl,Le),document.addEventListener("pointerdown",q))}))}function fe(){r.value=!1,m.value=!1,a.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",q)}function Ce(se){i("change",se),fe()}function Se(se){clearTimeout(I),m.value=!0,t.nextTick(()=>{var U;const ue=se.currentTarget instanceof HTMLElement?se.currentTarget:null;if(!ue)return;const Le=ue.getBoundingClientRect(),_e=(U=p.value)==null?void 0:U.closest(".border-submenu-wrap");if(!_e)return;const dt=Vl(a.boundaryEl),ht=_e.offsetWidth,T=_e.offsetHeight,W=Le.right+ht+8>dt.right?"left":"right",F=Le.top+T>dt.bottom-8,_=F?Le.bottom+5-T:Le.top-5,L=Math.min(dt.top+8,_),x=Math.max(L,Math.min(dt.bottom-T-8,_));B.value=W,f.value=F,w.value=W==="right"?{left:Le.right+4,top:x}:{right:Dn(Le.left-4),top:x}})}function be(){clearTimeout(I),I=setTimeout(()=>{m.value=!1},150)}function Ge(){clearTimeout(I)}function pe(se){m.value=!1,i("changeColor",se),fe()}const ie=[{key:"solid",i18nKey:"lineSolid"},{key:"dashed",i18nKey:"lineDashed"},{key:"dotted",i18nKey:"lineDotted"}],Ne=t.ref(!1),ft=t.ref(null),mt=t.ref("right"),v=t.ref(!1);let A;const X=t.ref({top:0});function ze(se){const ue=ga(se,2);return ue?`${ue[0]} ${ue[1]}`:void 0}function Je(se){return ml(a.currentLineStyle)===se}function oe(se){clearTimeout(A),Ne.value=!0,t.nextTick(()=>{var U;const ue=se.currentTarget instanceof HTMLElement?se.currentTarget:null;if(!ue)return;const Le=ue.getBoundingClientRect(),_e=(U=ft.value)==null?void 0:U.closest(".border-submenu-wrap");if(!_e)return;const dt=Vl(a.boundaryEl),ht=_e.offsetWidth,T=_e.offsetHeight,W=Le.right+ht+8>dt.right?"left":"right",F=Le.top+T>dt.bottom-8,_=F?Le.bottom+5-T:Le.top-5,L=Math.min(dt.top+8,_),x=Math.max(L,Math.min(dt.bottom-T-8,_));mt.value=W,v.value=F,X.value=W==="right"?{left:Le.right+4,top:x}:{right:Dn(Le.left-4),top:x}})}function we(){clearTimeout(A),A=setTimeout(()=>{Ne.value=!1},150)}function Be(){clearTimeout(A)}function rt(se){Ne.value=!1,i("change-line-style",se),fe()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",q),clearTimeout(I)}),o({open:r,openMenu:ae,close:fe}),(se,ue)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:s,class:"border-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:t.normalizeClass(["border-picker__menu sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),style:t.normalizeStyle({left:t.unref(S).left!==void 0?t.unref(S).left+"px":void 0,right:t.unref(S).right!==void 0?t.unref(S).right+"px":void 0,top:t.unref(S).top+"px"}),onMousedown:ue[2]||(ue[2]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(vs),Le=>(t.openBlock(),t.createElementBlock("button",{key:Le.key,class:"border-picker__item",title:t.unref(b)(e.locale,Le.i18nKey),onClick:_e=>Ce(Le.key)},[(t.openBlock(),t.createElementBlock("svg",Rs,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ua),_e=>(t.openBlock(),t.createElementBlock("line",{key:_e.name,x1:_e.x1,y1:_e.y1,x2:_e.x2,y2:_e.y2,stroke:"currentColor","stroke-width":t.unref(Mn)(Le.key,_e.name)==="thick"?3:1.5,"stroke-dasharray":t.unref(Mn)(Le.key,_e.name)==="dashed"?"0 4":"none","stroke-linecap":t.unref(Mn)(Le.key,_e.name)==="dashed"?"round":"square"},null,8,Ms))),128)),t.unref(fa)(Le.key)?(t.openBlock(),t.createElementBlock("circle",{key:0,cx:t.unref(pa),cy:t.unref(ha),r:t.unref(ma),fill:"currentColor"},null,8,Ss)):t.createCommentVNode("",!0)])),t.createElementVNode("span",Ns,t.toDisplayString(t.unref(b)(e.locale,Le.i18nKey)),1)],8,Es))),128)),ue[11]||(ue[11]=t.createElementVNode("div",{class:"border-picker__divider"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["border-picker__item border-picker__item--sub",{"border-picker__item--sub-open":Ne.value}]),onMouseenter:ue[0]||(ue[0]=Le=>oe(Le)),onMouseleave:we},[ue[7]||(ue[7]=t.createElementVNode("span",{class:"border-picker__line-icon","aria-hidden":"true"},[t.createElementVNode("svg",{viewBox:"0 0 40 20",class:"border-picker__line-svg"},[t.createElementVNode("line",{x1:"2",y1:"10",x2:"38",y2:"10",stroke:"currentColor","stroke-width":"2","stroke-dasharray":"none","stroke-linecap":"butt"})])],-1)),t.createElementVNode("span",Bs,t.toDisplayString(t.unref(b)(e.locale,"borderLineStyle")),1),ue[8]||(ue[8]=t.createElementVNode("svg",{class:"border-picker__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))],34),t.createElementVNode("div",{class:t.normalizeClass(["border-picker__item border-picker__item--sub",{"border-picker__item--sub-open":m.value}]),onMouseenter:ue[1]||(ue[1]=Le=>Se(Le)),onMouseleave:be},[ue[9]||(ue[9]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",class:"border-picker__item--sub-icon",fill:"currentColor"},[t.createElementVNode("path",{d:"M563.39456 743.34208v-51.38432h308.3264V332.24704h-102.76864V280.85248h154.14784v462.4896h-359.7056z m-230.84544 51.88608l-26.84928-102.56896 283.93984-463.89248 127.2576 75.17184-284.17024 463.78496-100.17792 27.50464z m-180.26496-103.26528h102.784v51.38432H100.89984V280.85248h359.7056v51.39456H152.28416v359.71584z"})],-1)),t.createElementVNode("span",xs,t.toDisplayString(t.unref(b)(e.locale,"borderColor")),1),t.createElementVNode("span",{class:"border-picker__item--sub-swatch",style:t.normalizeStyle({background:e.currentColor||"var(--sp-border-default, #444)"})},null,4),ue[10]||(ue[10]=t.createElementVNode("svg",{class:"border-picker__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))],34)],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"border-sub-pop"},{default:t.withCtx(()=>[r.value&&m.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"colorSubRef",ref:p,class:t.normalizeClass(["border-submenu-wrap sp-spreader-overlay",{"border-submenu-wrap--left":B.value==="left","border-submenu-wrap--up":f.value,dark:t.unref(n)==="dark"}]),style:t.normalizeStyle({left:w.value.left!==void 0?w.value.left+"px":void 0,right:w.value.right!==void 0?w.value.right+"px":void 0,top:w.value.top+"px"}),onClick:ue[3]||(ue[3]=t.withModifiers(()=>{},["stop"])),onMousedown:ue[4]||(ue[4]=t.withModifiers(()=>{},["prevent"])),onMouseenter:Ge,onMouseleave:be},[t.createVNode(da,{"color-key":"border","current-color":e.currentColor,locale:e.locale,onPick:pe},null,8,["current-color","locale"])],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"border-sub-pop"},{default:t.withCtx(()=>[r.value&&Ne.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"lineSubRef",ref:ft,class:t.normalizeClass(["border-submenu-wrap sp-spreader-overlay",{"border-submenu-wrap--left":mt.value==="left","border-submenu-wrap--up":v.value,dark:t.unref(n)==="dark"}]),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"}),onClick:ue[5]||(ue[5]=t.withModifiers(()=>{},["stop"])),onMousedown:ue[6]||(ue[6]=t.withModifiers(()=>{},["prevent"])),onMouseenter:Be,onMouseleave:we},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ie,Le=>t.createElementVNode("button",{key:Le.key,class:t.normalizeClass(["border-picker__line-item",{"border-picker__line-item--active":Je(Le.key)}]),title:t.unref(b)(e.locale,Le.i18nKey),onClick:_e=>rt(Le.key)},[(t.openBlock(),t.createElementBlock("svg",Vs,[t.createElementVNode("line",{x1:"3",y1:"10",x2:"61",y2:"10",stroke:"currentColor","stroke-width":"2","stroke-dasharray":ze(Le.key)||"none","stroke-linecap":Le.key==="dotted"?"round":"butt"},null,8,Ds)])),t.createElementVNode("span",Fs,t.toDisplayString(t.unref(b)(e.locale,Le.i18nKey)),1)],10,Ts)),64))],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-18e6b527"]]),ba=[{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}],ya={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},Is=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],As=["title","onClick"],Ls={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},zs=["x1","y1","x2","y2"],$s=["d"],_s={class:"sort-picker__label"},Hs=_t(t.defineComponent({__name:"sort-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:l}){const n=t.inject("sp-theme","light"),a=e,i=l,r=t.ref(!1),s=t.ref(null),d=t.ref(null),{pos:m,place:p}=Fn();t.watch(()=>a.modelOpen,S=>{S!==void 0&&S!==r.value&&(S?f():I())});function B(S){const $=s.value,q=d.value,ae=S.target;$&&$.contains(ae)||q&&q.contains(ae)||I()}function f(){const S=a.triggerEl??s.value;S&&(r.value=!0,a.modelOpen!==void 0&&i("update:modelOpen",!0),p(S,a.boundaryEl),t.nextTick(()=>{const $=a.triggerEl??s.value;if(!$)return;const q=d.value;q&&(p($,a.boundaryEl,q),document.addEventListener("pointerdown",B))}))}function I(){r.value=!1,a.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function w(S){i("change",S),I()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),o({open:r,openMenu:f,close:I}),(S,$)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:s,class:"sort-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:t.normalizeClass(["sort-picker__menu sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),style:t.normalizeStyle({left:t.unref(m).left!==void 0?t.unref(m).left+"px":void 0,right:t.unref(m).right!==void 0?t.unref(m).right+"px":void 0,top:t.unref(m).top+"px"}),onMousedown:$[0]||($[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Is),q=>(t.openBlock(),t.createElementBlock("button",{key:q.key,class:"sort-picker__item",title:t.unref(b)(e.locale,q.i18nKey),onClick:ae=>w(q.key)},[(t.openBlock(),t.createElementBlock("svg",Ls,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ba),ae=>(t.openBlock(),t.createElementBlock("line",{key:ae.name,x1:ae.x1,y1:ae.y1,x2:ae.x2,y2:ae.y2},null,8,zs))),128)),t.createElementVNode("path",{d:t.unref(ya)[q.key]},null,8,$s)])),t.createElementVNode("span",_s,t.toDisplayString(t.unref(b)(e.locale,q.i18nKey)),1)],8,As))),128))],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-06a3cc24"]]),Ws={key:0,class:"outline-picker__sep"},Us=["onClick"],Ps={class:"outline-picker__label"},Ks=_t(t.defineComponent({__name:"outline-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null},axis:{default:null}},emits:["update:modelOpen","action"],setup(e,{expose:o,emit:l}){const n=t.inject("sp-theme","light"),a=e,i=l,r=[{key:"group",i18nKey:"outlineAddGroup"},{key:"ungroup",i18nKey:"outlineUngroup"},{key:"clear",i18nKey:"outlineClear"},{key:"expand",i18nKey:"outlineExpandAll"},{key:"collapse",i18nKey:"outlineCollapseAll"}],s=t.ref(!1),d=t.ref(null),m=t.ref(null),{pos:p,place:B}=Fn();t.watch(()=>a.modelOpen,$=>{$!==void 0&&$!==s.value&&($?I():w())});function f($){const q=d.value,ae=m.value,fe=$.target;q&&q.contains(fe)||ae&&ae.contains(fe)||w()}function I(){const $=a.triggerEl??d.value;$&&(s.value=!0,a.modelOpen!==void 0&&i("update:modelOpen",!0),B($,a.boundaryEl),t.nextTick(()=>{const q=a.triggerEl??d.value;if(!q)return;const ae=m.value;ae&&(B(q,a.boundaryEl,ae),document.addEventListener("pointerdown",f))}))}function w(){s.value=!1,a.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",f)}function S($){a.axis&&(i("action",`${$}-${a.axis}`),w())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",f)}),o({open:s,openMenu:I,close:w}),($,q)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"outline-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:m,class:t.normalizeClass(["outline-picker__menu sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),style:t.normalizeStyle({left:t.unref(p).left!==void 0?t.unref(p).left+"px":void 0,right:t.unref(p).right!==void 0?t.unref(p).right+"px":void 0,top:t.unref(p).top+"px"}),onMousedown:q[0]||(q[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,ae=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:ae.key},[ae.sep?(t.openBlock(),t.createElementBlock("div",Ws)):(t.openBlock(),t.createElementBlock("div",{key:1,class:"outline-picker__item",onClick:fe=>S(ae.key)},[t.createElementVNode("span",Ps,t.toDisplayString(t.unref(b)(e.locale,ae.i18nKey)),1)],8,Us))],64))),64))],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-0835fff9"]]),Gs=["title","onClick"],qs=["innerHTML"],Ys={class:"merge-picker__label"},js=_t(t.defineComponent({__name:"merge-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:l}){const n=t.inject("sp-theme","light"),a=e,i=l,r=t.ref(!1),s=t.ref(null),d=t.ref(null),{pos:m,place:p}=Fn();t.watch(()=>a.modelOpen,S=>{S!==void 0&&S!==r.value&&(S?f():I())});function B(S){const $=s.value,q=d.value,ae=S.target;$&&$.contains(ae)||q&&q.contains(ae)||I()}function f(){const S=a.triggerEl??s.value;S&&(r.value=!0,a.modelOpen!==void 0&&i("update:modelOpen",!0),p(S,a.boundaryEl),t.nextTick(()=>{const $=a.triggerEl??s.value;if(!$)return;const q=d.value;q&&(p($,a.boundaryEl,q),document.addEventListener("pointerdown",B))}))}function I(){r.value=!1,a.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function w(S){i("change",S),I()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),o({open:r,openMenu:f,close:I}),(S,$)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:s,class:"merge-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:t.normalizeClass(["merge-picker__menu sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),style:t.normalizeStyle({left:t.unref(m).left!==void 0?t.unref(m).left+"px":void 0,right:t.unref(m).right!==void 0?t.unref(m).right+"px":void 0,top:t.unref(m).top+"px"}),onMousedown:$[0]||($[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Li),q=>(t.openBlock(),t.createElementBlock("button",{key:q.key,class:"merge-picker__item",title:t.unref(b)(e.locale,q.labelKey),onClick:ae=>w(q.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:q.icon},null,8,qs),t.createElementVNode("span",Ys,t.toDisplayString(t.unref(b)(e.locale,q.labelKey)),1)],8,Gs))),128))],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-75f59091"]]),Xs=["title","disabled"],Zs={class:"cf-menu-trigger__label"},Js=["disabled"],Qs=["disabled"],ec=["disabled"],tc=["disabled"],lc=["disabled"],nc=["disabled"],oc=["disabled"],rc=["onClick"],ac=["disabled"],ic=["disabled"],sc=["disabled"],cc=["disabled"],dc=_t(t.defineComponent({__name:"conditional-format-menu",props:{locale:{},hasSelection:{type:Boolean},themeVars:{default:()=>({})},boundaryEl:{default:null},modelOpen:{type:Boolean,default:!1}},emits:["preset","new-rule","manage","clear","update:modelOpen"],setup(e,{emit:o}){const l=t.inject("sp-theme","light"),n=e,a=o,i=t.ref(null),r=t.ref(null),s=t.ref(null),d=t.ref(null),m=t.ref(null),p=t.ref(!1),B=t.ref(null),f=t.ref("right"),I=t.ref("right"),w=t.ref(!1),S=t.ref(!1),$=t.ref(!1),q=t.ref(!1),ae=t.ref(!1),fe=t.ref(!1),Ce=t.ref(!1),Se=t.ref(!1),{pos:be,place:Ge}=Fn(),pe=t.ref({top:0}),ie=t.ref({top:0});let Ne;const ft=[{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 mt(){a("update:modelOpen",!p.value)}t.watch(()=>n.modelOpen,_=>{_&&!p.value?v():!_&&p.value&&A()});function v(){const _=r.value;_&&(p.value=!0,B.value=null,Ge(_,n.boundaryEl),t.nextTick(()=>{var x;const L=(x=s.value)==null?void 0:x.closest(".cf-menu");L&&(Ge(_,n.boundaryEl,L),ze())}))}function A(){p.value=!1,clearTimeout(Ne),B.value=null}function X(){a("update:modelOpen",!1)}function ze(){const _=s.value;_&&($.value=_.scrollTop>1,q.value=_.scrollTop+_.clientHeight<_.scrollHeight-1)}function Je(_){const L=s.value;L&&(L.scrollTop=Math.max(0,Math.min(L.scrollHeight-L.clientHeight,L.scrollTop+_*30)))}function oe(_){const L=_==="highlight"?d.value:m.value;if(!L)return;const x=L.scrollTop>1,U=L.scrollTop+L.clientHeight<L.scrollHeight-1;_==="highlight"?(ae.value=x,fe.value=U):(Ce.value=x,Se.value=U)}function we(_,L){const x=_==="highlight"?d.value:m.value;x&&(x.scrollTop=Math.max(0,Math.min(x.scrollHeight-x.clientHeight,x.scrollTop+L*30)))}function Be(_,L){_&&(_.scrollHeight<=_.clientHeight||(L.preventDefault(),_.scrollTop=Math.max(0,Math.min(_.scrollHeight-_.clientHeight,_.scrollTop+L.deltaY))))}function rt(_){Be(s.value,_),ze()}function se(_){Be(d.value,_),oe("highlight")}function ue(_){Be(m.value,_),oe("clear")}function Le(_){var x,U,te,ye,tt,it;if(!p.value)return;const L=_.target;(x=i.value)!=null&&x.contains(L)||(U=s.value)!=null&&U.contains(L)||(ye=(te=d.value)==null?void 0:te.closest(".cf-submenu-wrap"))!=null&&ye.contains(L)||(it=(tt=m.value)==null?void 0:tt.closest(".cf-submenu-wrap"))!=null&&it.contains(L)||X()}function _e(_,L){clearTimeout(Ne),B.value=_,t.nextTick(()=>{var Lt,Ot;const x=(L==null?void 0:L.currentTarget)instanceof HTMLElement?L.currentTarget:null;if(!x)return;const U=x.getBoundingClientRect(),te=_==="highlight"?(Lt=d.value)==null?void 0:Lt.closest(".cf-submenu-wrap"):(Ot=m.value)==null?void 0:Ot.closest(".cf-submenu-wrap");if(!te)return;const ye=Vl(n.boundaryEl),tt=te.offsetWidth,it=te.offsetHeight,qe=U.right+tt+8>ye.right;let yt="right";qe&&(yt="left");const He=U.top+it>ye.bottom-8,k=He?U.bottom+5-it:U.top-5,ee=Math.min(ye.top+8,k),wt=Math.max(ee,Math.min(ye.bottom-it-8,k)),At=yt==="right"?{left:U.right+4,top:wt}:{right:Dn(U.left-4),top:wt};_==="highlight"?(f.value=yt,w.value=He,pe.value=At):(I.value=yt,S.value=He,ie.value=At),oe(_)})}function dt(){clearTimeout(Ne),Ne=setTimeout(()=>{B.value=null},150)}function ht(){clearTimeout(Ne)}function T(_){a("preset",_),X()}function ne(){a("new-rule"),X()}function W(){a("manage"),X()}function F(_){a("clear",_),X()}return t.onMounted(()=>{document.addEventListener("pointerdown",Le),window.addEventListener("resize",X),window.addEventListener("scroll",X,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Le),window.removeEventListener("resize",X),window.removeEventListener("scroll",X,!0)}),(_,L)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:i,class:"cf-menu-root"},[t.createElementVNode("button",{ref_key:"btnRef",ref:r,type:"button",class:"toolbar-btn cf-menu-trigger",title:t.unref(b)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:mt},[L[22]||(L[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-12bd9ffe><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-12bd9ffe></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-12bd9ffe></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-12bd9ffe></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-12bd9ffe></path></svg>',1)),t.createElementVNode("span",Zs,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,Xs),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[p.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-menu sp-spreader-overlay",{dark:t.unref(l)==="dark"}]),style:t.normalizeStyle({...e.themeVars,right:t.unref(be).right+"px",top:t.unref(be).top+"px"}),onClick:L[8]||(L[8]=t.withModifiers(()=>{},["stop"])),onMousedown:L[9]||(L[9]=t.withModifiers(()=>{},["prevent"]))},[$.value||q.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!$.value}]),disabled:!$.value,onClick:L[0]||(L[0]=x=>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,Js)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:s,class:"cf-menu__body",onScroll:ze,onWheelPassive:rt},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:L[1]||(L[1]=x=>_e("highlight",x)),onMouseleave:dt},[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]=x=>e.hasSelection&&T("blank"))},t.toDisplayString(t.unref(b)(e.locale,"cfBlank")),11,Qs),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]=x=>e.hasSelection&&T("notBlank"))},t.toDisplayString(t.unref(b)(e.locale,"cfNotBlank")),11,ec),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]=x=>e.hasSelection&&T("duplicate"))},t.toDisplayString(t.unref(b)(e.locale,"cfDuplicate")),11,tc),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]=x=>e.hasSelection&&T("unique"))},t.toDisplayString(t.unref(b)(e.locale,"cfUnique")),11,lc),L[28]||(L[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:ne},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:W},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]=x=>_e("clear",x)),onMouseleave:dt},[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),$.value||q.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!q.value}]),disabled:!q.value,onClick:L[7]||(L[7]=x=>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,nc)):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(()=>[p.value&&B.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap sp-spreader-overlay",{"cf-submenu-wrap--left":f.value==="left","cf-submenu-wrap--up":w.value,dark:t.unref(l)==="dark"}]),style:t.normalizeStyle({...e.themeVars,left:pe.value.left!==void 0?pe.value.left+"px":void 0,right:pe.value.right!==void 0?pe.value.right+"px":void 0,top:pe.value.top+"px"}),onClick:L[13]||(L[13]=t.withModifiers(()=>{},["stop"])),onMousedown:L[14]||(L[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ht,onMouseleave:dt},[ae.value||fe.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ae.value}]),disabled:!ae.value,onClick:L[10]||(L[10]=x=>we("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,oc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:d,class:"cf-submenu",onScroll:L[11]||(L[11]=x=>oe("highlight")),onWheelPassive:se},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ft,x=>t.createElementVNode("button",{key:x.type,type:"button",class:"cf-menu__subitem",onClick:U=>T(x.type)},t.toDisplayString(t.unref(b)(e.locale,x.key)),9,rc)),64))],544),ae.value||fe.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!fe.value}]),disabled:!fe.value,onClick:L[12]||(L[12]=x=>we("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,ac)):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(()=>[p.value&&B.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap sp-spreader-overlay",{"cf-submenu-wrap--left":I.value==="left","cf-submenu-wrap--up":S.value,dark:t.unref(l)==="dark"}]),style:t.normalizeStyle({...e.themeVars,left:ie.value.left!==void 0?ie.value.left+"px":void 0,right:ie.value.right!==void 0?ie.value.right+"px":void 0,top:ie.value.top+"px"}),onClick:L[20]||(L[20]=t.withModifiers(()=>{},["stop"])),onMousedown:L[21]||(L[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ht,onMouseleave:dt},[Ce.value||Se.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Ce.value}]),disabled:!Ce.value,onClick:L[15]||(L[15]=x=>we("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,ic)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:m,class:"cf-submenu",onScroll:L[18]||(L[18]=x=>oe("clear")),onWheelPassive:ue},[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]=x=>e.hasSelection&&F("selection"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSelected")),11,sc),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:L[17]||(L[17]=x=>F("sheet"))},t.toDisplayString(t.unref(b)(e.locale,"cfClearSheet")),1)],544),Ce.value||Se.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Se.value}]),disabled:!Se.value,onClick:L[19]||(L[19]=x=>we("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,cc)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-12bd9ffe"]]),uc=["disabled","title","onClick"],fc={class:"calc-picker__label"},mc=_t(t.defineComponent({__name:"calc-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1},boundaryEl:{}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:l}){const n=t.inject("sp-theme","light"),a=e,i=l,r=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],s=t.ref(!1),d=t.ref(null),m=t.ref(null),{pos:p,place:B}=Fn();t.watch(()=>a.modelOpen,$=>{$!==void 0&&$!==s.value&&($?I():w())});function f($){const q=d.value,ae=m.value,fe=$.target;q&&q.contains(fe)||ae&&ae.contains(fe)||w()}function I(){const $=a.triggerEl??d.value;$&&(s.value=!0,a.modelOpen!==void 0&&i("update:modelOpen",!0),B($,a.boundaryEl),t.nextTick(()=>{const q=a.triggerEl??d.value;if(!q)return;const ae=m.value;ae&&(B(q,a.boundaryEl,ae),document.addEventListener("pointerdown",f))}))}function w(){s.value=!1,a.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",f)}function S($){a.disabled||(i("change",$),w())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",f)}),o({open:s,openMenu:I,close:w}),($,q)=>(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(()=>[s.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:m,class:t.normalizeClass(["calc-picker__menu sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),style:t.normalizeStyle({left:t.unref(p).left!==void 0?t.unref(p).left+"px":void 0,right:t.unref(p).right!==void 0?t.unref(p).right+"px":void 0,top:t.unref(p).top+"px"}),onMousedown:q[0]||(q[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,ae=>t.createElementVNode("button",{key:ae.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(b)(e.locale,ae.labelKey),onClick:fe=>S(ae.key)},[t.createElementVNode("span",fc,t.toDisplayString(t.unref(b)(e.locale,ae.labelKey)),1)],10,uc)),64))],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-6114e92a"]]),pc=["title","disabled"],hc={class:"toolbar-btn__label"},gc=["title","disabled"],bc={class:"toolbar-btn__label"},yc=["title","disabled"],Cc={class:"toolbar-btn__label"},wc=["title","disabled"],vc={class:"toolbar-btn__label"},kc={class:"toolbar-font-size"},Ec=["value","disabled","title"],Rc=["title","disabled"],Mc=["title","disabled"],Sc=["title","disabled"],Nc=["title","disabled"],Bc={class:"toolbar-btn__label"},xc=["title","disabled"],Tc={class:"toolbar-btn__label"},Vc=["title","disabled"],Dc={class:"toolbar-btn__label"},Fc=["title","disabled"],Oc={class:"toolbar-btn__label"},Ic={class:"toolbar-split"},Ac=["title","disabled"],Lc={viewBox:"0 0 1024 1024",fill:"currentColor"},zc=["fill"],$c={class:"toolbar-btn__label"},_c=["title","disabled"],Hc={class:"toolbar-split"},Wc=["title","disabled"],Uc={viewBox:"0 0 1024 1024",fill:"currentColor"},Pc=["fill"],Kc={class:"toolbar-btn__label"},Gc=["title","disabled"],qc={class:"toolbar-split"},Yc=["title","disabled"],jc={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Xc=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Zc=["cx","cy","r"],Jc={class:"toolbar-btn__label"},Qc=["title","disabled"],ed=["title","disabled"],td={class:"toolbar-btn__label"},ld={class:"toolbar-split"},nd=["title","disabled"],od={class:"toolbar-btn__label"},rd=["title","disabled"],ad={class:"toolbar-number-format-group"},id=["title","disabled"],sd=["title","disabled"],cd={class:"toolbar-split"},dd=["title","disabled"],ud={class:"toolbar-btn__label"},fd=["title","disabled"],md={class:"toolbar-split"},pd=["title","disabled"],hd={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},gd=["x1","y1","x2","y2"],bd=["d"],yd={class:"toolbar-btn__label"},Cd=["title","disabled"],wd=["disabled","title"],vd={class:"toolbar-btn__label"},kd=["disabled","title"],Ed={class:"toolbar-btn__label"},Rd=["title","disabled"],Md={class:"toolbar-btn__label"},Sd=["title"],Nd={class:"toolbar-btn__label"},Bd=["disabled"],xd=["disabled"],Ca='<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>',Td='<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>',Vd='<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>',Dd='<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>',mr=2,Fd=6,Od=34,Id=_t(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:{},cachedBorderColor:{},cachedBorderLineStyle:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},outlineMenuOpen:{type:Boolean},outlineAxis:{},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},cfMenuOpen:{type:Boolean},freezeMenuOpen:{type:Boolean},fontMenuOpen:{type:Boolean},hAlignMenuOpen:{type:Boolean},vAlignMenuOpen:{type:Boolean},numFmtMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},freezePanesDisabled:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{},canIncreaseDecimals:{type:Boolean},canDecreaseDecimals:{type:Boolean},boundaryEl:{},editable:{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","border-color-change","border-line-style-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","update:cf-menu-open","update:freeze-menu-open","update:font-menu-open","update:h-align-menu-open","update:v-align-menu-open","update:num-fmt-menu-open","border-change","sort-change","merge-change","cf-clear"],setup(e,{expose:o,emit:l}){const n=t.inject("sp-theme","light"),a=["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"],i=t.ref(null),r=t.ref(null),s=t.ref(null),d=t.ref(null),m=t.ref(null),p=t.ref(null),B=t.ref(null),f=t.ref(null),I=t.ref(null),w=t.ref(null),S=t.ref(null),$=t.ref(new Set),q=t.ref(!1),ae=t.ref(!1),fe=t.ref(0),Ce=t.ref(!1),Se=t.ref(!1),be=new Map,Ge=t.computed(()=>$.value.size>0);function pe(He){return $.value.has(He)}const ie=t.computed(()=>{const He=r.value;return He instanceof HTMLElement?He:void 0});function Ne(He){return ie.value?!pe(He):!0}function ft(){for(const He of a){const k=be.get(He);if(k===void 0||k===0)return!0}return!1}function mt(){if(!i.value)return;i.value.querySelectorAll(".tb-item").forEach(k=>{const ee=k.dataset.key;if(!ee)return;const wt=k.offsetWidth;wt>0?be.set(ee,wt):be.has(ee)||be.set(ee,0)})}function v(He,k){if(He.size!==k.size)return!1;for(const ee of He)if(!k.has(ee))return!1;return!0}let A=0,X=0,ze=null;function Je(){if(A&&cancelAnimationFrame(A),X>60){ze&&clearTimeout(ze),ze=setTimeout(()=>{X=0,Je()},500);return}X++,A=requestAnimationFrame(()=>requestAnimationFrame(oe))}function oe(){if(!i.value)return;const He=i.value.clientWidth-Fd*2;if(He<=0){Je();return}X=0,(be.size===0||ft())&&mt();let k=0;for(const wt of a)k+=(be.get(wt)??0)+mr;const ee=new Set;if(k>He){const wt=He-Od-mr;let At=0;for(let Lt=0;Lt<a.length;Lt++){const Ot=a[Lt],Rl=(be.get(Ot)??0)+mr;if(At+Rl>wt){for(let sl=Lt;sl<a.length;sl++)ee.add(a[sl]);break}At+=Rl}}v(ee,$.value)||($.value=ee,fe.value++,ee.size===0&&(q.value=!1))}let we=null;const Be=t.ref(0),rt=t.computed(()=>{const He=s.value,k={position:"fixed",top:"0px",right:"0px"};if(!He)return{...F.themeVars,...k};Be.value;const ee=He.getBoundingClientRect(),wt=Vl(F.boundaryEl);return{...F.themeVars,position:"fixed",top:`${ee.bottom+4}px`,right:`${Dn(Math.min(ee.right,wt.right))}px`}});function se(){q.value&&(Be.value++,t.nextTick(()=>oe()))}function ue(He){var ee,wt,At;if(!q.value)return;const k=He.target;(ee=k.closest)!=null&&ee.call(k,".overflow-menu-wrap")||(wt=s.value)!=null&&wt.contains(k)||(At=k.closest)!=null&&At.call(k,".cf-menu, .sp-dropdown__menu, .color-picker__menu, .outline-picker__menu, .border-picker__menu, .calc-picker__menu, .merge-picker__menu, .sort-picker__menu")||(ae.value=!0,q.value=!1,t.nextTick(()=>{ae.value=!1}))}function Le(){q.value=!q.value,q.value&&t.nextTick(ne)}function _e(){q.value=!1,x("open-data-validation")}function dt(){q.value=!1,x("find")}function ht(){q.value=!1,x("toggle-filter")}function T(){q.value=!1}function ne(){const He=r.value;He&&(Ce.value=He.scrollTop>1,Se.value=He.scrollTop+He.clientHeight<He.scrollHeight-1,tt())}function W(He){const k=r.value;k&&(k.scrollTop=Math.max(0,Math.min(k.scrollHeight-k.clientHeight,k.scrollTop+He*40)))}o({closeOverflow:T}),t.onMounted(()=>{Je(),i.value&&(we=new ResizeObserver(()=>{q.value||Je()}),we.observe(i.value)),document.addEventListener("pointerdown",ue,!0),window.addEventListener("resize",se),window.addEventListener("load",Je),window.addEventListener("orientationchange",Je)}),t.onBeforeUnmount(()=>{A&&cancelAnimationFrame(A),ze&&clearTimeout(ze),we==null||we.disconnect(),document.removeEventListener("pointerdown",ue,!0),window.removeEventListener("resize",se),window.removeEventListener("load",Je),window.removeEventListener("orientationchange",Je)});const F=e,_=l,L=new Set(["find"]),x=(He,...k)=>{if(!(F.editable===!1&&!L.has(He)))return _(He,...k)},U=["fontSize","textColor","fillColor","border","merge","calc","sort","outline","cf","freeze","font","hAlign","vAlign","numFmt"],te={fontSize:"update:font-size-menu-open",textColor:"update:text-color-menu-open",fillColor:"update:fill-color-menu-open",border:"update:border-menu-open",merge:"update:merge-menu-open",calc:"update:calc-menu-open",sort:"update:sort-menu-open",outline:"update:outline-menu-open",cf:"update:cf-menu-open",freeze:"update:freeze-menu-open",font:"update:font-menu-open",hAlign:"update:h-align-menu-open",vAlign:"update:v-align-menu-open",numFmt:"update:num-fmt-menu-open"};function ye(He,k){if(k)for(const ee of U)ee!==He&&x(te[ee],!1);x(te[He],k)}function tt(){for(const He of U)x(te[He],!1)}t.watch(()=>F.editable,He=>{if(He===!1){const k=_;for(const ee of U)k(te[ee],!1);q.value=!1}});function it(He){var ee;const k=He.target;(ee=k.closest)!=null&&ee.call(k,".toolbar-split__arrow, .outline-trigger, .toolbar-font-size__btn, .cf-menu-trigger, .sp-dropdown__trigger")||tt()}const qe=t.computed(()=>F.selNumberFormat===Xl?b(F.locale,"nfMixed"):""),yt=t.computed(()=>{const He=[{label:b(F.locale,"freezeFirstRow"),value:"firstRow",icon:Td},{label:b(F.locale,"freezeFirstCol"),value:"firstCol",icon:Vd}];return F.hasFreeze?He.unshift({label:b(F.locale,"unfreezePanes"),value:"unfreeze",icon:Dd}):He.unshift({label:b(F.locale,"freezePanes"),value:"panes",icon:Ca,disabled:F.freezePanesDisabled}),He});return(He,k)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:i,class:t.normalizeClass(["toolbar",{"toolbar--readonly":F.editable===!1}]),onMousedown:k[67]||(k[67]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("undo"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"undo"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(b)(e.locale,"undo"),disabled:!e.canUndo||!F.editable,onClick:k[0]||(k[0]=ee=>x("undo"))},[k[71]||(k[71]=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",hc,t.toDisplayString(t.unref(b)(e.locale,"undo")),1)],10,pc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("redo"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"redo"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(b)(e.locale,"redo"),disabled:!e.canRedo||!F.editable,onClick:k[1]||(k[1]=ee=>x("redo"))},[k[72]||(k[72]=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",bc,t.toDisplayString(t.unref(b)(e.locale,"redo")),1)],10,gc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("paint"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"paint"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(b)(e.locale,"paintFormat"),disabled:!e.hasSelection||!F.editable,onClick:k[2]||(k[2]=ee=>x("paint-format"))},[k[73]||(k[73]=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",Cc,t.toDisplayString(t.unref(b)(e.locale,"paintFormat")),1)],10,yc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("clear"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"clear"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(b)(e.locale,"clearFormat"),disabled:!e.hasSelection||!F.editable,onClick:k[3]||(k[3]=ee=>x("clear-format"))},[k[74]||(k[74]=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",vc,t.toDisplayString(t.unref(b)(e.locale,"clearFormat")),1)],10,wc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("sep1"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"sep1"},[...k[75]||(k[75]=[t.createElementVNode("div",{class:"toolbar-sep"},null,-1)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("font"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"font"},[t.createVNode(jt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:pe("font")?"100%":110,"menu-width":pe("font")?120:void 0,"visible-count":8,title:t.unref(b)(e.locale,"fontFamily"),align:"right","preview-font":!0,"model-open":e.fontMenuOpen,disabled:!F.editable,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[4]||(k[4]=ee=>ye("font",ee)),onChange:k[5]||(k[5]=ee=>x("font-family-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","disabled","boundary-el"])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("fontSize"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"fontSize"},[t.createElementVNode("div",kc,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,disabled:!F.editable,title:t.unref(b)(e.locale,"fontSize"),onMousedown:k[6]||(k[6]=t.withModifiers(()=>{},["stop"])),onInput:k[7]||(k[7]=ee=>x("font-size-input",ee.target.value)),onBlur:k[8]||(k[8]=ee=>x("font-size-blur")),onKeydown:k[9]||(k[9]=ee=>x("font-size-keydown",ee))},null,40,Ec),t.createVNode(jt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:pe("fontSize")?"100%":56,"menu-width":pe("fontSize")?120:56,"visible-count":9,title:t.unref(b)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":S.value,disabled:!F.editable,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[10]||(k[10]=ee=>ye("fontSize",ee)),onChange:k[11]||(k[11]=ee=>x("font-size-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el","disabled","boundary-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:S,class:"toolbar-font-size__btn",type:"button",title:t.unref(b)(e.locale,"fontSize"),disabled:!F.editable,onMousedown:k[12]||(k[12]=t.withModifiers(()=>{},["prevent"])),onClick:k[13]||(k[13]=ee=>x("font-size-toggle"))},[...k[76]||(k[76]=[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,Rc),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection||!F.editable,onMousedown:k[14]||(k[14]=t.withModifiers(()=>{},["prevent"])),onClick:k[15]||(k[15]=ee=>x("font-size-step-down"))},[...k[77]||(k[77]=[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,Mc),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(b)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection||!F.editable,onMousedown:k[16]||(k[16]=t.withModifiers(()=>{},["prevent"])),onClick:k[17]||(k[17]=ee=>x("font-size-step-up"))},[...k[78]||(k[78]=[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,Sc)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("sep2"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"sep2"},[...k[79]||(k[79]=[t.createElementVNode("div",{class:"toolbar-sep"},null,-1)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("bold"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"bold"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(b)(e.locale,"bold"),disabled:!e.hasSelection||!F.editable,onClick:k[18]||(k[18]=ee=>x("bold-toggle"))},[k[80]||(k[80]=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",Bc,t.toDisplayString(t.unref(b)(e.locale,"bold")),1)],10,Nc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("italic"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"italic"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(b)(e.locale,"italic"),disabled:!e.hasSelection||!F.editable,onClick:k[19]||(k[19]=ee=>x("italic-toggle"))},[k[81]||(k[81]=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",Tc,t.toDisplayString(t.unref(b)(e.locale,"italic")),1)],10,xc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("underline"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"underline"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(b)(e.locale,"underline"),disabled:!e.hasSelection||!F.editable,onClick:k[20]||(k[20]=ee=>x("underline-toggle"))},[k[82]||(k[82]=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",Dc,t.toDisplayString(t.unref(b)(e.locale,"underline")),1)],10,Vc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("strike"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"strike"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),disabled:!e.hasSelection||!F.editable,onClick:k[21]||(k[21]=ee=>x("strikethrough-toggle"))},[k[83]||(k[83]=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",Oc,t.toDisplayString(t.unref(b)(e.locale,"strikethrough")),1)],10,Fc)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("sep3"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"sep3"},[...k[84]||(k[84]=[t.createElementVNode("div",{class:"toolbar-sep"},null,-1)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("textColor"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"textColor"},[t.createElementVNode("div",Ic,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection||!F.editable,onClick:k[22]||(k[22]=ee=>x("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Lc,[k[85]||(k[85]=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||"currentColor"},null,8,zc)])),t.createElementVNode("span",$c,t.toDisplayString(t.unref(b)(e.locale,"fontColor")),1)],8,Ac),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:d,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fontColor"),disabled:!e.hasSelection||!F.editable,onClick:k[23]||(k[23]=ee=>ye("textColor",!e.textColorMenuOpen))},[...k[86]||(k[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,_c),t.createVNode(No,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":d.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[24]||(k[24]=ee=>ye("textColor",ee)),onChange:k[25]||(k[25]=ee=>x("text-color-change",ee))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("fillColor"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"fillColor"},[t.createElementVNode("div",Hc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection||!F.editable,onClick:k[26]||(k[26]=ee=>x("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Uc,[k[87]||(k[87]=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,Pc)])),t.createElementVNode("span",Kc,t.toDisplayString(t.unref(b)(e.locale,"fillColor")),1)],8,Wc),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:m,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"fillColor"),disabled:!e.hasSelection||!F.editable,onClick:k[27]||(k[27]=ee=>ye("fillColor",!e.fillColorMenuOpen))},[...k[88]||(k[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,Gc),t.createVNode(No,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":m.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[28]||(k[28]=ee=>ye("fillColor",ee)),onChange:k[29]||(k[29]=ee=>x("fill-color-change",ee))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("border"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"border"},[t.createElementVNode("div",qc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection||!F.editable,onClick:k[30]||(k[30]=ee=>x("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",jc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ua),ee=>(t.openBlock(),t.createElementBlock("line",{key:ee.name,x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,"stroke-width":t.unref(Mn)(e.cachedBorder,ee.name)==="thick"?3:1.5,"stroke-dasharray":t.unref(Mn)(e.cachedBorder,ee.name)==="dashed"?"0 4":"none","stroke-linecap":t.unref(Mn)(e.cachedBorder,ee.name)==="dashed"?"round":"square"},null,8,Xc))),128)),t.unref(fa)(e.cachedBorder)?(t.openBlock(),t.createElementBlock("circle",{key:0,cx:t.unref(pa),cy:t.unref(ha),r:t.unref(ma),fill:"currentColor",stroke:"none"},null,8,Zc)):t.createCommentVNode("",!0)])),t.createElementVNode("span",Jc,t.toDisplayString(t.unref(b)(e.locale,t.unref(ks)[e.cachedBorder]??"borders")),1)],8,Yc),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:p,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"borders"),disabled:!e.hasSelection||!F.editable,onClick:k[31]||(k[31]=ee=>ye("border",!e.borderMenuOpen))},[...k[89]||(k[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,Qc),t.createVNode(Os,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"current-color":e.cachedBorderColor,"current-line-style":e.cachedBorderLineStyle,"trigger-el":p.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[32]||(k[32]=ee=>ye("border",ee)),onChange:k[33]||(k[33]=ee=>x("border-change",ee)),onChangeColor:k[34]||(k[34]=ee=>x("border-color-change",ee)),onChangeLineStyle:k[35]||(k[35]=ee=>x("border-line-style-change",ee))},null,8,["model-open","locale","current-border","current-color","current-line-style","trigger-el","boundary-el"])])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("sep4"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"sep4"},[...k[90]||(k[90]=[t.createElementVNode("div",{class:"toolbar-sep"},null,-1)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("hAlign"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"hAlign"},[t.createVNode(jt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:pe("hAlign")?"100%":44,"menu-width":pe("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"hAlign"),"model-open":e.hAlignMenuOpen,disabled:!F.editable,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[36]||(k[36]=ee=>ye("hAlign",ee)),onChange:k[37]||(k[37]=ee=>x("h-align-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","disabled","boundary-el"])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("vAlign"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"vAlign"},[t.createVNode(jt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:pe("vAlign")?"100%":44,"menu-width":pe("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(b)(e.locale,"vAlign"),"model-open":e.vAlignMenuOpen,disabled:!F.editable,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[38]||(k[38]=ee=>ye("vAlign",ee)),onChange:k[39]||(k[39]=ee=>x("v-align-change",ee))},null,8,["model-value","options","width","menu-width","title","model-open","disabled","boundary-el"])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("wrap"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"wrap"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(b)(e.locale,"wrap"),disabled:!F.editable,onClick:k[40]||(k[40]=ee=>x("wrap-toggle"))},[k[91]||(k[91]=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",td,t.toDisplayString(t.unref(b)(e.locale,"wrap")),1)],10,ed)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("merge"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"merge"},[t.createElementVNode("div",ld,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"mergeCenter"),disabled:!e.hasSelection||!F.editable,onClick:k[41]||(k[41]=ee=>x("apply-merge"))},[k[92]||(k[92]=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",od,t.toDisplayString(t.unref(b)(e.locale,"mergeCenter")),1)],8,nd),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:f,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"mergeCells"),disabled:!e.hasSelection||!F.editable,onClick:k[42]||(k[42]=ee=>ye("merge",!e.mergeMenuOpen))},[...k[93]||(k[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,rd),t.createVNode(js,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":f.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[43]||(k[43]=ee=>ye("merge",ee)),onChange:k[44]||(k[44]=ee=>x("merge-change",ee))},null,8,["model-open","locale","trigger-el","boundary-el"])])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("sep6"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"sep6"},[...k[94]||(k[94]=[t.createElementVNode("div",{class:"toolbar-sep"},null,-1)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("numFmt"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"numFmt"},[t.createElementVNode("div",ad,[t.createVNode(jt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:pe("numFmt")?"auto":92,"menu-width":(pe("numFmt"),150),"visible-count":8,title:t.unref(b)(e.locale,"numberFormat"),"fallback-label":qe.value,align:"right","model-open":e.numFmtMenuOpen,disabled:!F.editable,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[45]||(k[45]=ee=>ye("numFmt",ee)),onChange:k[46]||(k[46]=ee=>x("number-format-change",String(ee)))},null,8,["model-value","options","width","menu-width","title","fallback-label","model-open","disabled","boundary-el"]),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||!F.editable,onClick:k[47]||(k[47]=ee=>x("increase-decimals"))},[...k[95]||(k[95]=[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,id),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||!F.editable,onClick:k[48]||(k[48]=ee=>x("decrease-decimals"))},[...k[96]||(k[96]=[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,sd)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("sep7"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"sep7"},[...k[97]||(k[97]=[t.createElementVNode("div",{class:"toolbar-sep"},null,-1)])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("calc"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"calc"},[t.createElementVNode("div",cd,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(b)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell||!F.editable,onClick:k[49]||(k[49]=ee=>x("calc-sum"))},[k[98]||(k[98]=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",ud,t.toDisplayString(t.unref(b)(e.locale,"sum")),1)],8,dd),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:I,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"calculate"),disabled:!e.hasSelection||!F.editable,onClick:k[50]||(k[50]=ee=>ye("calc",!e.calcMenuOpen))},[...k[99]||(k[99]=[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,fd),t.createVNode(mc,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":I.value,disabled:e.isSingleCell||!F.editable,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[51]||(k[51]=ee=>ye("calc",ee)),onChange:k[52]||(k[52]=ee=>x(`calc-${ee}`))},null,8,["model-open","locale","trigger-el","disabled","boundary-el"])])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("sort"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"sort"},[t.createElementVNode("div",md,[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||!F.editable,onClick:k[53]||(k[53]=ee=>x("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",hd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ba),ee=>(t.openBlock(),t.createElementBlock("line",{key:ee.name,x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2},null,8,gd))),128)),t.createElementVNode("path",{d:t.unref(ya)[e.cachedSortOrder]},null,8,bd)])),t.createElementVNode("span",yd,t.toDisplayString(t.unref(b)(e.locale,"sort")),1)],8,pd),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:B,class:"toolbar-btn toolbar-split__arrow",title:t.unref(b)(e.locale,"sort"),disabled:!e.canSort||!F.editable,onClick:k[54]||(k[54]=ee=>ye("sort",!e.sortMenuOpen))},[...k[100]||(k[100]=[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,Cd),t.createVNode(Hs,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":B.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[55]||(k[55]=ee=>ye("sort",ee)),onChange:k[56]||(k[56]=ee=>x("sort-change",ee))},null,8,["model-open","locale","current-sort","trigger-el","boundary-el"])])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("outline"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"outline"},[t.createElementVNode("button",{ref_key:"outlineArrowRef",ref:w,class:t.normalizeClass(["toolbar-btn outline-trigger",{"is-open":e.outlineMenuOpen}]),disabled:!e.outlineAxis||!F.editable,title:t.unref(b)(e.locale,"outlineGroup"),onClick:k[57]||(k[57]=ee=>ye("outline",!e.outlineMenuOpen))},[k[101]||(k[101]=t.createElementVNode("svg",{class:"outline-trigger__icon",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",vd,t.toDisplayString(t.unref(b)(e.locale,"outlineGroup")),1),k[102]||(k[102]=t.createElementVNode("svg",{class:"outline-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))],10,wd),t.createVNode(Ks,{"model-open":e.outlineMenuOpen,locale:e.locale,"trigger-el":w.value,"boundary-el":e.boundaryEl,axis:e.outlineAxis,"onUpdate:modelOpen":k[58]||(k[58]=ee=>ye("outline",ee)),onAction:k[59]||(k[59]=ee=>x("outline-action",ee))},null,8,["model-open","locale","trigger-el","boundary-el","axis"])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("filter"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"filter"},[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter||!F.editable,title:e.filterActive?t.unref(b)(e.locale,"clearFilter"):t.unref(b)(e.locale,"filter"),onClick:ht},[k[103]||(k[103]=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",Ed,t.toDisplayString(t.unref(b)(e.locale,"filter")),1)],10,kd)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("freeze"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"freeze"},[t.createVNode(jt,{class:"toolbar-freeze","model-value":"",options:yt.value,width:pe("freeze")?"100%":44,"menu-width":pe("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(b)(e.locale,"freezePane"),"trigger-icon":Ca,"trigger-label":t.unref(b)(e.locale,"freezePane"),"model-open":e.freezeMenuOpen,disabled:!F.editable,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[60]||(k[60]=ee=>ye("freeze",ee)),onChange:k[61]||(k[61]=ee=>x("freeze-change",String(ee)))},null,8,["options","width","menu-width","title","trigger-label","model-open","disabled","boundary-el"])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("cf"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"cf"},[t.createVNode(dc,{locale:e.locale,"has-selection":e.hasSelection&&F.editable,"theme-vars":e.themeVars,"model-open":e.cfMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":k[62]||(k[62]=ee=>ye("cf",ee)),onPreset:k[63]||(k[63]=ee=>x("cf-preset",ee)),onNewRule:k[64]||(k[64]=ee=>x("cf-new-rule")),onManage:k[65]||(k[65]=ee=>x("cf-manage")),onClear:k[66]||(k[66]=ee=>x("cf-clear",ee))},null,8,["locale","has-selection","theme-vars","model-open","boundary-el"])],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("dv"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay",{dark:t.unref(n)==="dark"}]),"data-key":"dv"},[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"dv"),disabled:!F.editable,onClick:_e},[k[104]||(k[104]=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",Md,t.toDisplayString(t.unref(b)(e.locale,"dv")),1)],8,Rd)],2)],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ne("find"),to:ie.value},[t.createElementVNode("div",{class:t.normalizeClass(["tb-item sp-spreader-overlay ro-keep",{dark:t.unref(n)==="dark"}]),"data-key":"find"},[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(b)(e.locale,"find"),onClick:dt},[k[105]||(k[105]=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",Nd,t.toDisplayString(t.unref(b)(e.locale,"findReplace")),1)],8,Sd)],2)],8,["disabled","to"])),Ge.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:s,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":q.value}]),type:"button",onClick:Le},[...k[106]||(k[106]=[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 sp-spreader-overlay",{"no-anim":ae.value,dark:t.unref(n)==="dark","toolbar--readonly":F.editable===!1}]),style:t.normalizeStyle(rt.value),onPointerdown:k[70]||(k[70]=t.withModifiers(()=>{},["stop","prevent"]))},[Ce.value||Se.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Ce.value}]),disabled:!Ce.value,onClick:k[68]||(k[68]=ee=>W(-1))},[...k[107]||(k[107]=[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,Bd)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:r,key:fe.value,class:"overflow-menu",onScroll:ne,onClick:it},null,32)),Ce.value||Se.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Se.value}]),disabled:!Se.value,onClick:k[69]||(k[69]=ee=>W(1))},[...k[108]||(k[108]=[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,xd)):t.createCommentVNode("",!0)],38),[[t.vShow,q.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-6f903436"]]),Ad=["title"],Ld={class:"tab-list"},zd=["onClick","onDblclick","onContextmenu","onTouchstart"],$d=["value"],_d={key:1,class:"tab-item__name"},Hd=["disabled","title"],Wd=["disabled"],Ud=["title","onClick"],Pd={class:"tab-list-menu__name"},Kd=["title","disabled","onClick"],Gd=["disabled"],qd=8,wa=450,Bo=8,Yd=_t(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{},boundaryEl:{},editable:{type:Boolean}},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:o}){const l=t.inject("sp-theme","light"),n=e,a=o,i=t.ref(null),r=t.ref(!1),s=t.ref(0),d=t.ref({left:0,bottom:0}),m=t.ref(null),p=t.computed(()=>Math.min(qd,n.sheets.length)),B=t.computed(()=>n.sheets.slice(s.value,s.value+p.value)),f=t.computed(()=>s.value>0),I=t.computed(()=>s.value+p.value<n.sheets.length),w=t.computed(()=>n.sheets.length>p.value),S=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!r.value)return;const W=Math.max(0,n.sheets.length-p.value);s.value>W&&(s.value=W)});function $(W){s.value=Math.max(0,Math.min(n.sheets.length-p.value,s.value+W))}function q(){if(r.value){r.value=!1;return}const W=i.value;if(!W)return;const F=W.getBoundingClientRect(),_=Vl(n.boundaryEl);d.value={left:Math.max(_.left,F.left),bottom:window.innerHeight-F.top+4};const L=n.activeSheetIndex;s.value=L>=0?Math.max(0,Math.min(L-Math.floor(p.value/2),n.sheets.length-p.value)):0,r.value=!0}function ae(W){a("tab-click",W),r.value=!1}function fe(W){S.value&&a("delete-sheet",W)}function Ce(W){var L;if(!r.value)return;const F=W.target;if((L=i.value)!=null&&L.contains(F))return;const _=document.querySelector(".tab-list-menu");_!=null&&_.contains(F)||(r.value=!1)}function Se(W){r.value&&W.key==="Escape"&&(r.value=!1)}function be(W){r.value&&(W.preventDefault(),$(W.deltaY>0?1:-1))}function Ge(){r.value=!1}function pe(W){!r.value||W.target===m.value||Ge()}const ie=t.ref(0),Ne=t.ref(!1);function ft(W){r.value&&(ie.value=W.touches[0].clientY,Ne.value=!0)}function mt(W){if(!r.value||!Ne.value)return;const F=W.touches[0].clientY-ie.value;Math.abs(F)>5&&($(F<0?1:-1),ie.value=W.touches[0].clientY)}function v(){Ne.value=!1}let A=null,X=-1,ze=0,Je=0,oe=!1,we=null,Be=0,rt=0;function se(W,F,_){return{clientX:W,clientY:F,target:_,preventDefault(){},stopPropagation(){}}}function ue(W,F){const _=W.touches[0];if(!_)return;ze=_.clientX,Je=_.clientY,X=F,A!==null&&clearTimeout(A);const L=W.target;A=window.setTimeout(()=>{oe=!0;const x=se(ze,Je,L);a("tab-contextmenu",{ev:x,i:X})},wa)}function Le(W){const F=W.touches[0];!F||A===null||(Math.abs(F.clientX-ze)>Bo||Math.abs(F.clientY-Je)>Bo)&&(clearTimeout(A),A=null)}function _e(){A!==null&&(clearTimeout(A),A=null)}function dt(W){if(oe){oe=!1;return}a("tab-click",W)}function ht(W){const F=W.touches[0];if(!F)return;const _=W.target;if(_.closest(".tab-item")||_.closest(".tab-bar__add-btn")||_.closest(".tab-bar__list-btn"))return;Be=F.clientX,rt=F.clientY,we!==null&&clearTimeout(we);const L=_;we=window.setTimeout(()=>{const x=se(Be,rt,L);a("tabbar-contextmenu",x)},wa)}function T(W){const F=W.touches[0];!F||we===null||(Math.abs(F.clientX-Be)>Bo||Math.abs(F.clientY-rt)>Bo)&&(clearTimeout(we),we=null)}function ne(){we!==null&&(clearTimeout(we),we=null)}return t.watch(r,W=>{t.nextTick(()=>{var F,_;W?(F=m.value)==null||F.addEventListener("wheel",be,{passive:!1}):(_=m.value)==null||_.removeEventListener("wheel",be)})}),t.onMounted(()=>{document.addEventListener("pointerdown",Ce),document.addEventListener("keydown",Se),window.addEventListener("resize",Ge),window.addEventListener("scroll",pe,!0)}),t.onBeforeUnmount(()=>{A!==null&&clearTimeout(A),we!==null&&clearTimeout(we),document.removeEventListener("pointerdown",Ce),document.removeEventListener("keydown",Se),window.removeEventListener("resize",Ge),window.removeEventListener("scroll",pe,!0)}),(W,F)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:F[8]||(F[8]=_=>a("tabbar-contextmenu",_)),onTouchstart:ht,onTouchmove:T,onTouchend:ne,onTouchcancel:ne},[t.createElementVNode("button",{ref_key:"listBtnRef",ref:i,class:t.normalizeClass(["tab-bar__list-btn",{"tab-bar__list-btn--active":r.value}]),type:"button",title:t.unref(b)(e.locale,"sheetList"),onClick:q},[...F[9]||(F[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,Ad),t.createElementVNode("div",Ld,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(_,L)=>(t.openBlock(),t.createElementBlock("div",{key:_.id,class:t.normalizeClass(["tab-item",{"tab-item--active":L===e.activeSheetIndex}]),onClick:x=>dt(L),onDblclick:t.withModifiers(x=>a("tab-dblclick",L),["prevent"]),onContextmenu:x=>a("tab-contextmenu",{ev:x,i:L}),onTouchstart:x=>ue(x,L),onTouchmove:Le,onTouchend:_e,onTouchcancel:_e},[e.renTab===L?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:F[0]||(F[0]=x=>a("tab-rename-input",x.target.value)),onKeydown:F[1]||(F[1]=x=>a("tab-rename-keydown",x)),onBlur:F[2]||(F[2]=x=>a("tab-rename-commit")),onClick:F[3]||(F[3]=t.withModifiers(()=>{},["stop"]))},null,40,$d)):(t.openBlock(),t.createElementBlock("span",_d,t.toDisplayString(_.name),1))],42,zd))),128))]),t.createElementVNode("button",{class:t.normalizeClass(["tab-bar__add-btn",{"tab-bar__add-btn--disabled":n.editable===!1}]),disabled:n.editable===!1,title:t.unref(b)(e.locale,"addSheet"),onClick:F[4]||(F[4]=_=>a("add-sheet"))}," + ",10,Hd),(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,class:t.normalizeClass(["tab-list-menu sp-spreader-overlay",{dark:t.unref(l)==="dark"}]),style:t.normalizeStyle({left:d.value.left+"px",bottom:d.value.bottom+"px"}),onMousedown:F[7]||(F[7]=t.withModifiers(()=>{},["prevent"]))},[w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!f.value}]),disabled:!f.value,onClick:F[5]||(F[5]=_=>$(-1))},[...F[10]||(F[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,Wd)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:m,class:"tab-list-menu__list",onTouchstart:ft,onTouchmove:mt,onTouchend:v},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.value,_=>(t.openBlock(),t.createElementBlock("div",{key:_.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(_)===e.activeSheetIndex}]),title:_.name,onClick:L=>ae(e.sheets.indexOf(_))},[t.createElementVNode("span",Pd,t.toDisplayString(_.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(b)(e.locale,"delete"),disabled:!S.value||n.editable===!1,onClick:t.withModifiers(L=>fe(e.sheets.indexOf(_)),["stop"])},[...F[11]||(F[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,Kd)],10,Ud))),128))],544),w.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!I.value}]),disabled:!I.value,onClick:F[6]||(F[6]=_=>$(1))},[...F[12]||(F[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,Gd)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-5666aa61"]]),jd={class:"find-bar__row find-bar__row--inputs"},Xd=["placeholder","value"],Zd=["placeholder","value","readonly"],Jd=["title","disabled"],Qd=["title","disabled"],eu=["title"],tu={class:"find-bar__row find-bar__row--controls"},lu=["title"],nu={class:"find-bar__count"},ou=["disabled"],ru=["disabled"],au={class:"find-bar__chk find-bar__chk--panel"},iu=["checked"],su={class:"find-bar__chk find-bar__chk--panel"},cu=["checked"],du=_t(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},editable:{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:o}){const l=t.inject("sp-theme","light"),n=e,a=o,i=t.ref(null),r=t.ref(null),s=t.ref(!1),d=t.ref({top:0,left:0}),m=t.computed(()=>n.total>0?`${n.currentIndex+1}/${n.total}`:n.message||""),p=t.computed(()=>[{label:b(n.locale,"scopeSheet"),value:"sheet"},{label:b(n.locale,"scopeWorkbook"),value:"workbook"},{label:b(n.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>n.focusToken,()=>{t.nextTick(()=>{var w;return(w=i.value)==null?void 0:w.focus()})});function B(w){w.key==="Enter"?(w.preventDefault(),w.shiftKey?a("prev"):a("next")):w.key==="Escape"&&(w.preventDefault(),a("close"))}function f(){if(r.value){if(!s.value){const w=r.value.getBoundingClientRect();d.value={top:w.bottom+2,left:w.left}}s.value=!s.value}}function I(w){if(!s.value)return;const S=w.target;S.closest(".find-bar__settings-btn")||S.closest(".find-bar__settings-panel")||(s.value=!1)}return t.watch(s,w=>{w?document.addEventListener("pointerdown",I,!0):document.removeEventListener("pointerdown",I,!0)}),t.watch(()=>n.open,w=>{w||(s.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",I,!0)),(w,S)=>(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",jd,[t.createElementVNode("input",{ref_key:"findInputRef",ref:i,class:"find-bar__input",placeholder:t.unref(b)(e.locale,"findPlaceholder"),value:e.findText,onInput:S[0]||(S[0]=$=>a("update:findText",$.target.value)),onKeydown:B},null,40,Xd),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(b)(e.locale,"replacePlaceholder"),value:e.replaceText,readonly:n.editable===!1,onInput:S[1]||(S[1]=$=>a("update:replaceText",$.target.value)),onKeydown:B},null,40,Zd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findPrev"),disabled:e.total===0,onClick:S[2]||(S[2]=$=>a("prev"))},[...S[12]||(S[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,Jd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(b)(e.locale,"findNext"),disabled:e.total===0,onClick:S[3]||(S[3]=$=>a("next"))},[...S[13]||(S[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,Qd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(b)(e.locale,"findClose"),onClick:S[4]||(S[4]=$=>a("close"))},[...S[14]||(S[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,eu)]),t.createElementVNode("div",tu,[t.createVNode(jt,{class:"find-bar__dropdown","model-value":e.scope,options:p.value,title:t.unref(b)(e.locale,"findScope"),"onUpdate:modelValue":S[5]||(S[5]=$=>w.$emit("update:scope",$))},null,8,["model-value","options","title"]),t.createElementVNode("button",{ref_key:"settingsBtnRef",ref:r,class:t.normalizeClass(["find-bar__btn find-bar__btn--icon find-bar__settings-btn",{"find-bar__btn--active":s.value}]),title:t.unref(b)(e.locale,"findOptions"),onClick:t.withModifiers(f,["stop"])},[...S[15]||(S[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,lu),t.createElementVNode("span",nu,t.toDisplayString(m.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0||n.editable===!1,onClick:S[6]||(S[6]=$=>a("replace"))},t.toDisplayString(t.unref(b)(e.locale,"replace")),9,ou),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0||n.editable===!1,onClick:S[7]||(S[7]=$=>a("replace-all"))},t.toDisplayString(t.unref(b)(e.locale,"replaceAll")),9,ru)])],4)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"find-pop"},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["find-bar__settings-panel sp-spreader-overlay",{dark:t.unref(l)==="dark"}]),style:t.normalizeStyle({top:d.value.top+"px",left:d.value.left+"px"}),onClick:S[10]||(S[10]=t.withModifiers(()=>{},["stop"])),onMousedown:S[11]||(S[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",au,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:S[8]||(S[8]=$=>a("update:matchCase",$.target.checked))},null,40,iu),S[16]||(S[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",su,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:S[9]||(S[9]=$=>a("update:matchEntireCell",$.target.checked))},null,40,cu),S[17]||(S[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)])],38)):t.createCommentVNode("",!0)]),_:1})]))],64))}}),[["__scopeId","data-v-e7238333"]]),uu={class:"nf-dialog__header"},fu={class:"nf-dialog__title"},mu={class:"nf-dialog__body"},pu={class:"nf-field"},hu={class:"nf-field__label"},gu={key:0,class:"nf-field"},bu={class:"nf-field__label"},yu={key:1,class:"nf-field nf-field--inline"},Cu={class:"nf-checkbox"},wu={key:2,class:"nf-field"},vu={class:"nf-field__label"},ku={key:3,class:"nf-field"},Eu={class:"nf-field__label"},Ru={key:4,class:"nf-field"},Mu={class:"nf-field__label"},Su={key:5,class:"nf-field"},Nu={class:"nf-field__label"},Bu={key:6,class:"nf-field"},xu={class:"nf-field__label"},Tu={class:"nf-field"},Vu={class:"nf-field__label"},Du={class:"nf-dialog__footer"},Fu={class:"nf-preview"},Ou={class:"nf-preview__label"},Iu={class:"nf-preview__value"},Au={class:"nf-dialog__actions"},Lu=["disabled"],zu=_t(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"},editable:{type:Boolean,default:!0}},emits:["update:modelOpen","apply"],setup(e,{emit:o}){const l=t.inject("sp-theme","light"),n=e,a=o,i=t.ref(!1),r=t.ref("general"),s=t.ref(2),d=t.ref(!1),m=t.ref("$"),p=t.ref("m/d/yyyy"),B=t.ref("h:mm:ss"),f=t.ref("m/d/yyyy h:mm:ss"),I=t.ref("[h]:mm:ss"),w=t.ref(""),S=t.ref(null),$=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],q=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],ae=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],fe=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],Ce=["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(()=>n.locale==="zh-CN"?[...q,...ae]:[...ae,...q]),be=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],Ge=t.computed(()=>n.locale==="zh-CN"?[...fe,...Ce]:[...Ce,...fe]),pe=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ie={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"},Ne=t.computed(()=>es.map(te=>({label:b(n.locale,ie[te]),value:te}))),ft=$.map(te=>({label:te.label,value:te.value})),mt=t.computed(()=>Se.value.map(te=>({label:te,value:te}))),v=be.map(te=>({label:te,value:te})),A=t.computed(()=>Ge.value.map(te=>({label:te,value:te}))),X=pe.map(te=>({label:te,value:te})),ze=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(r.value)),Je=t.computed(()=>["currency","currencyRounded","accounting"].includes(r.value)),oe=t.computed(()=>r.value==="date"),we=t.computed(()=>r.value==="time"),Be=t.computed(()=>r.value==="dateTime"),rt=t.computed(()=>r.value==="duration"),se=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(r.value));function ue(){if(r.value==="general")return dn;if(r.value==="text")return Dl;if(r.value==="custom")return w.value;if(r.value==="date")return p.value;if(r.value==="time")return B.value;if(r.value==="dateTime")return f.value;if(r.value==="duration")return I.value;const te=Math.max(0,Math.min(30,s.value));return r.value==="currency"||r.value==="currencyRounded"||r.value==="accounting"?Le(r.value,te,d.value,m.value):is(n.locale,r.value,te,d.value)}function Le(te,ye,tt,it){const qe=tt?"#,##0":"0";if(te==="currencyRounded")return it+qe;const yt=ye>0?"."+"0".repeat(ye):"",He=qe+yt;return te==="currency"?it+He:`${it}${He};(${it}${He});${it}"-"`}function _e(te){if(w.value=te,Fl(te)){r.value="general";return}if(te==="@"){r.value="text";return}const ye=te.replace(/\[[^\]]*\]/gi,yt=>/\[h\]/i.test(yt)?yt:"");if(/\[h\]/i.test(ye)&&!/[yd]/i.test(ye)){r.value="duration",pe.includes(te)&&(I.value=te);return}const tt=/[yd]/i.test(ye),it=/h|s|AM\/PM/i.test(ye);if(tt&&it){r.value="dateTime",Ge.value.includes(te)&&(f.value=te);return}if(tt||/AM\/PM/i.test(ye)){it&&!tt?(r.value="time",be.includes(te)&&(B.value=te)):(r.value="date",Se.value.includes(te)&&(p.value=te));return}if(te.includes("%")){r.value="percent",s.value=dt(te);return}if(/E[+-]/i.test(te)){r.value="scientific",s.value=dt(te);return}const qe=$.find(yt=>te.startsWith(yt.value));if(te.includes("[Red](")){r.value="financial",d.value=te.includes(","),s.value=dt(te);return}if(qe){te.includes("(")?(r.value="accounting",m.value=qe.value,d.value=te.includes(","),s.value=dt(te)):/\.\d/.test(te.slice(qe.value.length))?(r.value="currency",m.value=qe.value,d.value=te.includes(","),s.value=dt(te)):(r.value="currencyRounded",m.value=qe.value,d.value=te.includes(","));return}r.value="number",d.value=te.includes(","),s.value=dt(te)}function dt(te){const ye=te.match(/\.([0#?]+)/);return ye?ye[1].length:0}function ht(){r.value!=="custom"&&(w.value=ue())}function T(){}function ne(){p.value=Se.value[0],B.value=be[0],f.value=Ge.value[0],I.value=pe[0]}function W(){i.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),ne(),_e(n.currentFormat??""),n.isCustom&&(r.value="custom"),t.nextTick(()=>{var te;return(te=S.value)==null?void 0:te.focus()})}function F(){i.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1)}function _(){a("apply",w.value),F()}function L(){F()}function x(te){te.key==="Escape"&&F()}t.watch(()=>n.modelOpen,te=>{te&&!i.value?W():!te&&i.value&&F()});const U=t.computed(()=>zl(n.sampleValue,w.value,n.locale));return(te,ye)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["nf-dialog__mask sp-spreader-overlay",{dark:t.unref(l)==="dark"}]),onMousedown:L,onKeydown:x},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:ye[9]||(ye[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",uu,[t.createElementVNode("span",fu,t.toDisplayString(t.unref(b)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:F},[...ye[10]||(ye[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",mu,[t.createElementVNode("div",pu,[t.createElementVNode("label",hu,t.toDisplayString(t.unref(b)(e.locale,"nfCategory")),1),t.createVNode(jt,{class:"nf-field__dropdown","model-value":r.value,options:Ne.value,"onUpdate:modelValue":ye[0]||(ye[0]=tt=>r.value=tt),onChange:ht},null,8,["model-value","options"])]),se.value?(t.openBlock(),t.createElementBlock("div",gu,[t.createElementVNode("label",bu,t.toDisplayString(t.unref(b)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ye[1]||(ye[1]=tt=>s.value=tt),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:ht},null,544),[[t.vModelText,s.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),ze.value?(t.openBlock(),t.createElementBlock("div",yu,[t.createElementVNode("label",Cu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ye[2]||(ye[2]=tt=>d.value=tt),type:"checkbox",onChange:ht},null,544),[[t.vModelCheckbox,d.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Je.value?(t.openBlock(),t.createElementBlock("div",wu,[t.createElementVNode("label",vu,t.toDisplayString(t.unref(b)(e.locale,"nfSymbol")),1),t.createVNode(jt,{class:"nf-field__dropdown","model-value":m.value,options:t.unref(ft),"onUpdate:modelValue":ye[3]||(ye[3]=tt=>m.value=tt),onChange:ht},null,8,["model-value","options"])])):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("div",ku,[t.createElementVNode("label",Eu,t.toDisplayString(t.unref(b)(e.locale,"nfDateFormat")),1),t.createVNode(jt,{class:"nf-field__dropdown","model-value":p.value,options:mt.value,"onUpdate:modelValue":ye[4]||(ye[4]=tt=>p.value=tt),onChange:ht},null,8,["model-value","options"])])):t.createCommentVNode("",!0),we.value?(t.openBlock(),t.createElementBlock("div",Ru,[t.createElementVNode("label",Mu,t.toDisplayString(t.unref(b)(e.locale,"nfTimeFormat")),1),t.createVNode(jt,{class:"nf-field__dropdown","model-value":B.value,options:t.unref(v),"onUpdate:modelValue":ye[5]||(ye[5]=tt=>B.value=tt),onChange:ht},null,8,["model-value","options"])])):t.createCommentVNode("",!0),Be.value?(t.openBlock(),t.createElementBlock("div",Su,[t.createElementVNode("label",Nu,t.toDisplayString(t.unref(b)(e.locale,"nfDateTime")),1),t.createVNode(jt,{class:"nf-field__dropdown","model-value":f.value,options:A.value,"onUpdate:modelValue":ye[6]||(ye[6]=tt=>f.value=tt),onChange:ht},null,8,["model-value","options"])])):t.createCommentVNode("",!0),rt.value?(t.openBlock(),t.createElementBlock("div",Bu,[t.createElementVNode("label",xu,t.toDisplayString(t.unref(b)(e.locale,"nfDuration")),1),t.createVNode(jt,{class:"nf-field__dropdown","model-value":I.value,options:t.unref(X),"onUpdate:modelValue":ye[7]||(ye[7]=tt=>I.value=tt),onChange:ht},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",Tu,[t.createElementVNode("label",Vu,t.toDisplayString(t.unref(b)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:S,"onUpdate:modelValue":ye[8]||(ye[8]=tt=>w.value=tt),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:T},null,544),[[t.vModelText,w.value]])])]),t.createElementVNode("div",Du,[t.createElementVNode("div",Fu,[t.createElementVNode("span",Ou,t.toDisplayString(t.unref(b)(e.locale,"nfPreview")),1),t.createElementVNode("span",Iu,t.toDisplayString(U.value||"-"),1)]),t.createElementVNode("div",Au,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",disabled:n.editable===!1,onClick:_},t.toDisplayString(t.unref(b)(e.locale,"ok")),9,Lu),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:F},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])])],34)],34)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-e939c578"]]),$u={class:"sort-confirm__header"},_u={class:"sort-confirm__title"},Hu={class:"sort-confirm__body"},Wu={class:"sort-confirm__message"},Uu={class:"sort-confirm__options"},Pu={class:"sort-confirm__option"},Ku={class:"sort-confirm__option"},Gu={class:"sort-confirm__footer"},qu=["disabled"],Yu=_t(t.defineComponent({__name:"sort-confirm-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},editable:{type:Boolean,default:!0}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:o}){const l=t.inject("sp-theme","light"),n=e,a=o,i=t.ref(!1),r=t.ref(!0),s=t.ref(null);t.watch(()=>n.modelOpen,w=>{w&&!i.value?d():!w&&i.value&&m()});function d(){r.value=!0,i.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{var S;const w=(S=s.value)==null?void 0:S.querySelector(".sort-confirm__btn--primary");w==null||w.focus()})}function m(){i.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1)}function p(){I()}function B(w){w.key==="Escape"&&I()}function f(){a("confirm",r.value),m()}function I(){a("cancel"),m()}return(w,S)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["sort-confirm__mask sp-spreader-overlay",{dark:t.unref(l)==="dark"}]),onMousedown:p,onKeydown:B},[t.createElementVNode("div",{ref_key:"dialogRef",ref:s,class:"sort-confirm",onMousedown:S[2]||(S[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",$u,[t.createElementVNode("span",_u,t.toDisplayString(t.unref(b)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:I},[...S[3]||(S[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",Hu,[t.createElementVNode("p",Wu,t.toDisplayString(t.unref(b)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Uu,[t.createElementVNode("label",Pu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":S[0]||(S[0]=$=>r.value=$),type:"radio",value:!0},null,512),[[t.vModelRadio,r.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Ku,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=$=>r.value=$),type:"radio",value:!1},null,512),[[t.vModelRadio,r.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",Gu,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",disabled:n.editable===!1,onClick:f},t.toDisplayString(t.unref(b)(e.locale,"sort")),9,qu),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:I},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],34)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-52b246c8"]]),va=[{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)"}],ju={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 Xu(e){let o=0,l=null;for(let n=0;n<e.length;n++){const a=e[n];if(l){a===l&&(e[n+1]===l?n++:l=null);continue}if(a==='"'||a==="'"){l=a;continue}if(a==="(")o++;else if(a===")"&&(o--,o<0))return!1}return o===0}function Zu(e){const o=e.trim();if(!o.startsWith("="))return{ok:!1,name:null};const l=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(o.slice(1).trim());if(!l)return{ok:!1,name:null};const n=l[1].toUpperCase(),a=ju[n];if(!a)return{ok:!1,name:n};const i=l[2];if(!Xu(i))return{ok:!1,name:n};const r=fn(i),s=r.length===1&&r[0].trim()===""?0:r.length;return s<a.min||s>a.max?{ok:!1,name:n}:r.some(d=>d.trim()==="")?{ok:!1,name:n}:{ok:!0,name:n}}function Pn(e,o,l){const n=e.split(":");if(n.length!==2)return null;const a=El(n[0],o,l),i=El(n[1],o,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 ka(e){const o=e.trim();if(o==="")return"";const l=Number(o);return!isNaN(l)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(o)?l:e}function Jl(e,o,l,n,a){const i=l[Wn(e,o)];if(!i)return"";const r=i.value;return r.startsWith("=")?Ra(Wn(e,o),l,n,a):ka(r)}function Ea(e,o,l,n,a){const i=Jl(e,o,l,n,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const oo=new Map,xo=new Set;function Sn(){oo.clear(),xo.clear()}function Ra(e,o,l,n){return Ju(e,o,l,n,0)}function Ju(e,o,l,n,a){if(xo.has(e))return null;if(oo.has(e))return oo.get(e);xo.add(e);const i=o[e];let r;if(!i)r=null;else{const s=i.value;if(!s.startsWith("="))r=ka(s);else{const d=s.slice(1).trim(),m=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(d);r=m?Ba(m[1].toUpperCase(),m[2],o,l,n,a+1):Jt(d,o,l,n,a+1)}}return xo.delete(e),oo.set(e,r),r}function Kn(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Ma(e,o){return typeof e=="number"&&typeof o=="number"?e===o:String(e??"")===String(o??"")}function pr(e,o,l){let n;if(typeof e=="number"&&typeof o=="number")n=e<o?-1:e>o?1:0;else{const a=String(e??""),i=String(o??"");n=a<i?-1:a>i?1:0}switch(l){case"=":return n===0;case"<>":return n!==0;case"<":return n<0;case">":return n>0;case"<=":return n<=0;case">=":return n>=0}return!1}function Sa(e,o,l,n){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 Qu(e,o,l,n,a,i){let s=o.trim();s.length>=2&&(s[0]==='"'&&s[s.length-1]==='"'||s[0]==="'"&&s[s.length-1]==="'")&&(s=s.slice(1,-1));const d=/^([<>=]+)([\s\S]*)$/.exec(s);if(d){const p=d[1],B=Sa(d[2]);return pr(e,B,p)}const m=Sa(s);return Ma(e,m)}function Na(e,o,l,n,a){const i=e.trim(),r=["<=",">=","<>"];let s=null,d=-1,m=null,p=0;for(let f=0;f<i.length;f++){const I=i[f];if(m){I===m&&(i[f+1]===m?f++:m=null);continue}if(I==='"'||I==="'"){m=I;continue}if(I==="("&&p++,I===")"&&p--,p===0&&(I==="<"||I===">"||I==="=")){const w=i.slice(f,f+2);s=r.includes(w)?w:I,d=f;break}}if(s&&d>=0){const f=i.slice(0,d).trim(),I=i.slice(d+s.length).trim(),w=Jt(f,o,l,n,a),S=Jt(I,o,l,n,a);return pr(w,S,s)}const B=Jt(i,o,l,n,a);return Kn(B)}function fn(e){const o=[];let l=0,n=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(n){a+=r,r===n&&(e[i+1]===n?(i++,a+=n):n=null);continue}if(r==='"'||r==="'"){n=r,a+=r;continue}if(r==="("&&l++,r===")"&&l--,r===","&&l===0){o.push(a),a="";continue}a+=r}return o.push(a),o}function Jt(e,o,l,n,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 s=ef(i);if(s.length===0)return null;let d=0;const m=()=>{const w=p(),S=s[d];if(!(S&&S.type==="cmp"))return w;d++;const $=p();return w===null||$===null?null:pr(w,$,S.val)?1:0},p=()=>{let w=B();for(;d<s.length;){const S=s[d];if(S.type==="op"&&(S.val==="+"||S.val==="-"))d++,w=hr(w,B(),S.val);else break}return w},B=()=>{let w=f();for(;d<s.length;){const S=s[d];if(S.type==="op"&&(S.val==="*"||S.val==="/"))d++,w=hr(w,f(),S.val);else break}return w},f=()=>{const w=s[d];return w&&w.type==="op"&&w.val==="-"?(d++,hr(0,f(),"-")):w&&w.type==="op"&&w.val==="+"?(d++,f()):I()},I=()=>{const w=s[d];if(!w)return null;if(w.type==="num")return d++,Number(w.val);if(w.type==="str")return d++,w.val;if(w.type==="lp"){d++;const S=m();return s[d]&&s[d].type==="rp"&&d++,S}if(w.type==="ref"){d++;const S=El(w.val,l,n);return S?Jl(S.col,S.row,o,l,n):null}if(w.type==="func"){const S=w.val.toUpperCase();if(d++,s[d]&&s[d].type==="lp"){const $=s[d];let q=0,ae=null,fe=d;for(;fe<s.length;fe++)if(s[fe].type==="lp")q++;else if(s[fe].type==="rp"&&(q--,q===0)){ae=s[fe];break}if(ae){const Ce=i.slice($.start+1,ae.start);return d=fe+1,Ba(S,Ce,o,l,n,a+1)}}return null}return d++,null};return m()}function ef(e){const o=[];let l=0;for(;l<e.length;){const n=e[l];if(/\s/.test(n)){l++;continue}if(n==='"'||n==="'"){const a=n,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++}o.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(n)||n==="."){const a=l;let i="";for(n==="."&&(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++;o.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(n)){const a=l;let i="";for(;l<e.length&&/[A-Za-z0-9_$]/.test(e[l]);)i+=e[l],l++;e[l]==="("&&!i.includes("$")?o.push({type:"func",val:i,start:a}):o.push({type:"ref",val:i,start:a});continue}if(n==="("){o.push({type:"lp",val:n,start:l}),l++;continue}if(n===")"){o.push({type:"rp",val:n,start:l}),l++;continue}if(n===","){o.push({type:"comma",val:n,start:l}),l++;continue}if(n==="+"||n==="-"||n==="*"||n==="/"){o.push({type:"op",val:n,start:l}),l++;continue}if(n==="<"||n===">"||n==="="){const a=e.slice(l,l+2);a==="<="||a===">="||a==="<>"?(o.push({type:"cmp",val:a,start:l}),l+=2):(o.push({type:"cmp",val:n,start:l}),l++);continue}l++}return o}function hr(e,o,l){if(typeof e!="number"||typeof o!="number")return null;switch(l){case"+":return e+o;case"-":return e-o;case"*":return e*o;case"/":return o===0?null:e/o}return null}function Ba(e,o,l,n,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Pn(o.trim(),n,a);if(!r)return null;if(e==="COUNT"){let d=0;for(let m=r.sc;m<=r.ec;m++)for(let p=r.sr;p<=r.er;p++)typeof Jl(m,p,l,n,a)=="number"&&d++;return d}let s=0;for(let d=r.sc;d<=r.ec;d++)for(let m=r.sr;m<=r.er;m++)s+=Ea(d,m,l,n,a);if(isNaN(s))return null;if(e==="AVERAGE"){const d=(r.ec-r.sc+1)*(r.er-r.sr+1);return d===0?null:s/d}return s}case"AND":case"OR":{const r=fn(o);if(r.length===0)return null;const s=e==="AND";for(const d of r){const m=Jt(d,l,n,a,i);if(m===null)return null;if(e==="AND"){if(!Kn(m))return 0}else if(Kn(m))return 1}return s?1:0}case"NOT":{const r=fn(o);if(r.length!==1)return null;const s=Jt(r[0],l,n,a,i);return s===null?null:Kn(s)?0:1}case"IF":{const r=fn(o);if(r.length<3)return null;const s=Na(r[0],l,n,a,i);return Jt(s?r[1]:r[2],l,n,a,i)}case"VLOOKUP":{const r=fn(o);if(r.length<3)return null;const s=Jt(r[0],l,n,a,i),d=Pn(r[1].trim(),n,a);if(!d)return null;const m=Jt(r[2],l,n,a,i),p=typeof m=="number"?m:parseFloat(String(m));if(isNaN(p))return null;const B=d.sc+(p-1);if(B<d.sc||B>d.ec)return null;if(r.length>=4?Kn(Jt(r[3],l,n,a,i)):!1){let I=-1,w=-1/0;for(let S=d.sr;S<=d.er;S++){const $=Jl(d.sc,S,l,n,a);typeof $=="number"&&typeof s=="number"&&$<=s&&$>w&&(w=$,I=S)}return I>=0?Jl(B,I,l,n,a):null}for(let I=d.sr;I<=d.er;I++){const w=Jl(d.sc,I,l,n,a);if(Ma(w,s))return Jl(B,I,l,n,a)}return null}case"CONCATENATE":{const r=fn(o);let s="";for(const d of r){const m=Jt(d,l,n,a,i);s+=m===null?"":typeof m=="number"?String(m):m}return s}case"MAX":case"MIN":{const r=Pn(o.trim(),n,a);if(!r)return null;const s=[];for(let d=r.sc;d<=r.ec;d++)for(let m=r.sr;m<=r.er;m++){const p=Jl(d,m,l,n,a);typeof p=="number"&&s.push(p)}return s.length===0?null:e==="MAX"?Math.max(...s):Math.min(...s)}case"STDEV":{const r=Pn(o.trim(),n,a);if(!r)return null;const s=[];for(let B=r.sc;B<=r.ec;B++)for(let f=r.sr;f<=r.er;f++){const I=Jl(B,f,l,n,a);typeof I=="number"&&s.push(I)}const d=s.length;if(d<2)return null;const m=s.reduce((B,f)=>B+f,0)/d,p=s.reduce((B,f)=>B+Math.pow(f-m,2),0)/(d-1);return Math.sqrt(p)}case"SIN":{const r=fn(o);if(r.length!==1)return null;const s=Jt(r[0],l,n,a,i);return typeof s!="number"?null:Math.sin(s)}case"SUMIF":{const r=fn(o);if(r.length<2||r.length>3)return null;const s=Pn(r[0].trim(),n,a);if(!s)return null;const d=r.length===3?Pn(r[2].trim(),n,a):s;if(!d)return null;let m=0;for(let p=s.sr;p<=s.er;p++)for(let B=s.sc;B<=s.ec;B++){const f=Jl(B,p,l,n,a);Qu(f,r[1])&&(m+=Ea(d.sc+(B-s.sc),d.sr+(p-s.sr),l,n,a))}return m}case"PMT":{const r=fn(o);if(r.length<3||r.length>5)return null;const s=Jt(r[0],l,n,a,i),d=Jt(r[1],l,n,a,i),m=Jt(r[2],l,n,a,i);if(typeof s!="number"||typeof d!="number"||typeof m!="number")return null;const p=r.length>=4?Jt(r[3],l,n,a,i):0,B=typeof p=="number"?p:0,f=r.length>=5?Jt(r[4],l,n,a,i):0,I=Kn(f)?1:0;if(s===0)return d===0?null:-(m+B)/d;const w=Math.pow(1+s,d);return-(B+m*w)*s/((1+s*I)*(w-1))}default:return null}}function To(e,o,l){const n=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=El(i[1],o,l);if(r)if(i[2]){const s=El(i[2],o,l);if(!s)continue;for(let d=Math.min(r.col,s.col);d<=Math.max(r.col,s.col);d++)for(let m=Math.min(r.row,s.row);m<=Math.max(r.row,s.row);m++)n.push(Wn(d,m))}else n.push(Wn(r.col,r.row))}return n}function xa(e,o,l,n,a){const i=l[Wn(e,o)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const s=Ra(Wn(e,o),l,n,a);return s===null?"#ERROR":String(s)}function Ta(e,o,l,n){return Jt(e,o,l,n,0)}function Va(e,o,l,n){const a=e.trim().replace(/^=/,"");return a?Na(a,o,l,n,0):!1}function Vo(e,o,l,n,a,i){return o===0&&l===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,s,d,m,p)=>{const B=s?or(d):or(d)+o,f=m?parseInt(p,10)-1:parseInt(p,10)-1+l;let I;B<0?I="A":B>=n?I=i(n-1):I=i(B);let w;return f<0?w="1":f>=a?w=String(a):w=String(f+1),(s||"")+I+(m||"")+w})}class tf{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(o){var n;const l=this.deps.get(o);if(l){for(const a of l)(n=this.rev.get(a))==null||n.delete(o);this.deps.delete(o)}}set(o,l){if(this.clear(o),l.length!==0){this.deps.set(o,l);for(const n of l)this.rev.has(n)||this.rev.set(n,new Set),this.rev.get(n).add(o)}}markDirty(o){const l=[o];for(;l.length>0;){const n=l.pop(),a=this.rev.get(n);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),l.push(i))}}getDirtyAndClear(){const o=this.dirty;return this.dirty=new Set,o}rebuild(o,l,n){this.deps.clear(),this.rev.clear(),this.dirty.clear(),oo.clear();for(const[a,i]of Object.entries(o))if(i.value.startsWith("=")){const r=To(i.value.slice(1),l,n);this.set(a,r)}}}const lf={class:"ifn-dialog__header"},nf={class:"ifn-dialog__title"},of={class:"ifn-dialog__body"},rf={class:"ifn-dialog__field"},af={class:"ifn-dialog__label"},sf={key:0,class:"ifn-dialog__desc"},cf={class:"ifn-dialog__field"},df={class:"ifn-dialog__label"},uf={class:"ifn-dialog__footer"},ff=["disabled"],mf=_t(t.defineComponent({__name:"insert-function-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},editable:{type:Boolean,default:!0}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:o}){const l=t.inject("sp-theme","light"),n=e,a=o,i=t.ref(!1),r=t.ref(""),s=t.ref(""),d=t.ref(null),m=t.ref(null),p={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},B=t.computed(()=>va.map(be=>({label:be.name,value:be.name}))),f=t.computed(()=>{const be=String(r.value??"");return be?b(n.locale,p[be]??""):""}),I=t.computed(()=>Zu(s.value)),w=t.computed(()=>r.value===""||r.value===null||!s.value.trim()||!I.value.ok?!1:I.value.name===String(r.value).toUpperCase());t.watch(()=>n.modelOpen,be=>{be&&!i.value?S():!be&&i.value&&$()});function S(){s.value="",r.value="",i.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const be=d.value;if(be)try{be.focus({preventScroll:!0}),be.setSelectionRange(be.value.length,be.value.length)}catch{}})}function $(){i.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1)}function q(be){r.value=be;const Ge=va.find(pe=>pe.name===String(be));Ge&&(s.value="",ae(Ge.snippet))}function ae(be){const Ge=s.value,pe=d.value,ie=pe?pe.selectionStart??Ge.length:Ge.length,Ne=pe?pe.selectionEnd??Ge.length:Ge.length,ft=Ge.trim()?be:"="+be;s.value=Ge.slice(0,ie)+ft+Ge.slice(Ne),t.nextTick(()=>{const mt=d.value;if(!mt)return;const v=ie+ft.length;try{mt.focus({preventScroll:!0}),mt.setSelectionRange(v,v)}catch{}})}function fe(){a("insert",s.value),$()}function Ce(){a("cancel"),$()}function Se(be){be.key==="Escape"&&(be.stopPropagation(),Ce())}return(be,Ge)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"ifn-dialog"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["ifn-dialog__mask sp-spreader-overlay",{dark:t.unref(l)==="dark"}]),onMousedown:t.withModifiers(Ce,["self"]),onKeydown:Se},[t.createElementVNode("div",{ref_key:"dialogRef",ref:m,class:"ifn-dialog",onMousedown:Ge[1]||(Ge[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",lf,[t.createElementVNode("span",nf,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:Ce},[...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",of,[t.createElementVNode("div",rf,[t.createElementVNode("label",af,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(jt,{class:"ifn-dialog__dropdown",locale:e.locale,"model-value":r.value,options:B.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,["locale","model-value","options","search-placeholder","fallback-label","title"]),f.value?(t.openBlock(),t.createElementBlock("div",sf,t.toDisplayString(f.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",cf,[t.createElementVNode("label",df,t.toDisplayString(t.unref(b)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":Ge[0]||(Ge[0]=pe=>s.value=pe),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,s.value]])])]),t.createElementVNode("div",uf,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!w.value||n.editable===!1,onClick:fe},t.toDisplayString(t.unref(b)(e.locale,"insertFunctionBtn")),9,ff),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:Ce},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],544)],34)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9c59681d"]]),ro="__filter_blank__";function gr(e,o,l,n){if($l(e))return Number(e);if(n==="date"){const a=Zl(e,l);if(a)return a.serial}return null}function Do(e,o,l){if(e==null)return null;if($l(e))return Number(e);if(o==="date"){const n=Zl(e,l);if(n)return n.serial}return null}function pf(e,o,l,n,a){const i=zl(o,l,n);switch(e.operator){case"blank":return o.trim()==="";case"notBlank":return o.trim()!=="";case"equals":case"notEquals":{const r=e.operator==="equals";if(a==="number"||a==="date"){const d=gr(o,l,n,a),m=Do(e.value,a,n);return d==null||m==null?!1:r?d===m:d!==m}const s=i.toLowerCase()===(e.value??"").toLowerCase();return r?s:!s}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=gr(o,l,n,a),s=Do(e.value,a,n);return r==null||s==null?!1:e.operator==="gt"?r>s:e.operator==="gte"?r>=s:e.operator==="lt"?r<s:r<=s}case"between":{const r=gr(o,l,n,a),s=Do(e.value,a,n),d=Do(e.value2,a,n);if(r==null||s==null||d==null)return!1;const m=Math.min(s,d),p=Math.max(s,d);return r>=m&&r<=p}}return!0}function Da(e,o,l,n){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(o.trim()==="")return a.includes(ro);const i=zl(o,l,n);return a.includes(o)||a.includes(i)}return e.condition?pf(e.condition,o,l,n,e.type):!0}function hf(e,o,l,n){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const s=Number(r);if(s<i.startCol||s>i.endCol)continue;const d=a[r],m=l.getValue(s,o),p=l.getFormat(s,o);if(!Da(d,m,p,n))return!1}return!0}function gf(e,o,l,n){const a=new Set,i=[];let r=!1;const{range:s,columns:d}=e;for(let p=s.startRow+1;p<=s.endRow;p++){let B=!0;for(const w in d){const S=Number(w);if(S===o)continue;const $=d[w];if(!Da($,l.getValue(S,p),l.getFormat(S,p),n)){B=!1;break}}if(!B)continue;const f=l.getValue(o,p),I=zl(f,l.getFormat(o,p),n);if(f.trim()===""){r=!0;continue}a.has(I)||(a.add(I),i.push(I))}return i.length>0&&i.every(p=>$l(p))?i.sort((p,B)=>Number(p)-Number(B)):i.sort((p,B)=>p.localeCompare(B,n,{numeric:!0})),{values:i,hasBlank:r}}function Fa(e){var o;return e?e.type==="values"?(((o=e.values)==null?void 0:o.length)??0)>0:!!e.condition:!1}const bf={class:"filter-popup__head"},yf={class:"filter-popup__head-label"},Cf={key:0,class:"filter-popup__head-badge"},wf={class:"filter-popup__search"},vf=["placeholder"],kf={class:"filter-popup__tools"},Ef={class:"filter-popup__count"},Rf=["checked","onChange"],Mf={class:"filter-popup__item-label"},Sf={key:0,class:"filter-popup__item-note"},Nf={key:0,class:"filter-popup__empty"},Bf={class:"filter-popup__modes"},xf={key:1,class:"filter-popup__cond"},Tf={class:"filter-popup__cond-nav"},Vf={class:"filter-popup__cond-mode"},Df={class:"filter-popup__cond-title"},Ff={key:0,class:"filter-popup__cond-row filter-popup__cond-row--between"},Of={class:"filter-popup__cond-and"},If={key:1,class:"filter-popup__cond-row"},Af=["placeholder"],Lf={key:2,class:"filter-popup__cond-hint"},zf={class:"filter-popup__footer"},br=248,Fo=28,$f=252,_f=_t(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{},boundaryEl:{}},setup(e){const o=t.inject("sp-theme","light"),l=e,n=t.ref(null),a=t.ref(null),i=t.ref(null),r=t.ref({left:0,top:0}),s=t.ref("values"),d=t.ref(""),m=t.ref(new Set),p=t.ref(!1),B=t.ref(0),f=t.ref(null),I=t.ref("equals"),w=t.ref(""),S=t.ref(""),$=t.computed(()=>l.getColumnCandidates(l.col)),q=t.computed(()=>d.value.trim()!==""),ae=t.computed(()=>{const x=d.value.trim().toLowerCase();return x?$.value.values.filter(U=>U.toLowerCase().includes(x)):$.value.values}),fe=t.computed(()=>{const x=ae.value.map(U=>({key:U,label:U,isBlank:!1}));return $.value.hasBlank&&!q.value&&x.push({key:ro,label:b(l.locale,"filterBlank"),isBlank:!0}),x}),Ce=Math.ceil($f/Fo),Se=t.computed(()=>Math.max(0,Math.floor(B.value/Fo)-2)),be=t.computed(()=>Math.min(fe.value.length,Se.value+Ce+4)),Ge=t.computed(()=>fe.value.slice(Se.value,be.value)),pe=t.computed(()=>Se.value*Fo),ie=t.computed(()=>Math.max(0,(fe.value.length-be.value)*Fo));function Ne(x){B.value=x.target.scrollTop}const ft=["equals","notEquals","contains","notContains","startsWith","endsWith"],mt=["equals","notEquals","gt","gte","lt","lte","between"],v={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"},A=t.computed(()=>s.value==="text"?ft:mt),X=t.computed(()=>A.value.map(x=>({value:x,label:b(l.locale,v[x])})));function ze(x){I.value=x}const Je={text:"filterText",number:"filterNumber",date:"filterDate"},oe=t.computed(()=>{const x=s.value,U=Je[x]??Je.text;return b(l.locale,U)}),we=t.computed(()=>{var te;const x=l.getFilter(),U=x==null?void 0:x.columns[l.col];return U?U.type==="values"?(((te=U.values)==null?void 0:te.length)??0)>0:!!U.condition:!1});function Be(){const x=l.getFilter(),U=x==null?void 0:x.columns[l.col];U&&U.type==="values"?(m.value=new Set((U.values??[]).filter(te=>te!==ro)),p.value=(U.values??[]).includes(ro)):U&&U.condition?(s.value=U.type,I.value=U.condition.operator,w.value=U.condition.value??"",S.value=U.condition.value2??""):(m.value=new Set($.value.values),p.value=$.value.hasBlank)}function rt(){if(!l.getFilter())return;const U=$.value.values,te=$.value.hasBlank;if(m.value.size===U.length&&U.every(tt=>m.value.has(tt))&&p.value===te)l.setFilterColumn(l.col,null);else{const tt=[...m.value];p.value&&tt.push(ro),l.setFilterColumn(l.col,{type:"values",values:tt})}}function se(x){const U=new Set(m.value);U.has(x)?U.delete(x):U.add(x),m.value=U}function ue(){p.value=!p.value}function Le(){const x=q.value?ae.value:$.value.values,U=new Set(m.value);x.forEach(te=>U.add(te)),m.value=U,p.value=!0}function _e(){m.value=new Set,p.value=!1}function dt(x){s.value=x,I.value=x==="text"?"contains":"equals",w.value="",S.value=""}function ht(){s.value="values",Be()}function T(){const x={operator:I.value,value:w.value};s.value!=="text"&&I.value==="between"&&(x.value2=S.value),w.value.trim()!==""&&(l.setFilterColumn(l.col,{type:s.value,condition:x}),l.close())}function ne(){m.value=new Set($.value.values),p.value=$.value.hasBlank}function W(){rt(),l.close()}function F(){f.value&&l.setFilter(f.value),l.close()}function _(x){const U=n.value;U&&x.target instanceof Node&&U.contains(x.target)||l.close()}function L(x){x.key==="Escape"&&F()}return t.onMounted(async()=>{var tt,it;f.value=l.getFilter()?JSON.parse(JSON.stringify(l.getFilter())):null,Be(),await t.nextTick();const x=((tt=n.value)==null?void 0:tt.offsetHeight)??400;let U=l.anchor.x+15-br,te=l.anchor.y+24;const ye=Vl(l.boundaryEl);U<ye.left+4&&(U=Math.max(ye.left+4,l.anchor.x)),U+br>ye.right-4&&(U=Math.max(ye.left+4,ye.right-br-4)),te+x>ye.bottom-4&&(te=Math.max(ye.top+4,l.anchor.y-x-4)),r.value={left:U,top:te},(it=i.value)==null||it.focus(),document.addEventListener("pointerdown",_,!0),document.addEventListener("keydown",L,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",_,!0),document.removeEventListener("keydown",L,!0)}),(x,U)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:n,class:t.normalizeClass(["filter-popup sp-spreader-overlay",{dark:t.unref(o)==="dark"}]),style:t.normalizeStyle({left:r.value.left+"px",top:r.value.top+"px"}),onPointerdown:U[8]||(U[8]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",bf,[t.createElementVNode("span",yf,t.toDisplayString(e.headerLabel||t.unref(Et)(e.col)),1),we.value?(t.openBlock(),t.createElementBlock("span",Cf,t.toDisplayString(t.unref(b)(e.locale,"filterActive")),1)):t.createCommentVNode("",!0)]),s.value==="values"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",wf,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":U[0]||(U[0]=te=>d.value=te),class:"filter-popup__search-input",type:"text",placeholder:t.unref(b)(e.locale,"filterSearchPlaceholder")},null,8,vf),[[t.vModelText,d.value]])]),t.createElementVNode("div",kf,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:Le},t.toDisplayString(t.unref(b)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:_e},t.toDisplayString(t.unref(b)(e.locale,"filterClearAll")),1),t.createElementVNode("span",Ef,t.toDisplayString(t.unref(b)(e.locale,"filterFilteredCount").replace("{n}",String($.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:a,class:"filter-popup__list",onScroll:Ne},[t.createElementVNode("div",{style:t.normalizeStyle({height:pe.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ge.value,te=>(t.openBlock(),t.createElementBlock("label",{key:te.key,class:"filter-popup__item"},[t.createElementVNode("input",{class:"filter-popup__item-input",type:"checkbox",checked:te.isBlank?p.value:m.value.has(te.key),onChange:ye=>te.isBlank?ue():se(te.key)},null,40,Rf),U[9]||(U[9]=t.createElementVNode("span",{class:"filter-popup__item-box"},[t.createElementVNode("svg",{class:"filter-popup__item-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createElementVNode("span",Mf,t.toDisplayString(te.label),1),te.isBlank?(t.openBlock(),t.createElementBlock("span",Sf,"("+t.toDisplayString(t.unref(b)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ie.value+"px"})},null,4),fe.value.length===0?(t.openBlock(),t.createElementBlock("div",Nf,t.toDisplayString(t.unref(b)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",Bf,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[1]||(U[1]=te=>dt("text"))},t.toDisplayString(t.unref(b)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[2]||(U[2]=te=>dt("number"))},t.toDisplayString(t.unref(b)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:U[3]||(U[3]=te=>dt("date"))},t.toDisplayString(t.unref(b)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",xf,[t.createElementVNode("div",Tf,[t.createElementVNode("button",{type:"button",class:"filter-popup__back",onClick:ht},[U[10]||(U[10]=t.createElementVNode("svg",{class:"filter-popup__back-icon",viewBox:"0 0 16 16","aria-hidden":"true"},[t.createElementVNode("path",{d:"M10 3l-5 5 5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),t.createElementVNode("span",null,t.toDisplayString(t.unref(b)(e.locale,"filterBack")),1)]),t.createElementVNode("span",Vf,t.toDisplayString(oe.value),1)]),t.createElementVNode("div",Df,t.toDisplayString(t.unref(b)(e.locale,"filterCustom")),1),t.createVNode(jt,{class:"filter-popup__cond-op","model-value":I.value,options:X.value,title:t.unref(b)(e.locale,"filterCustom"),onChange:ze},null,8,["model-value","options","title"]),I.value==="between"?(t.openBlock(),t.createElementBlock("div",Ff,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[4]||(U[4]=te=>w.value=te),class:"filter-popup__cond-input",type:"text",onKeydown:t.withKeys(T,["enter"])},null,544),[[t.vModelText,w.value]]),t.createElementVNode("span",Of,t.toDisplayString(t.unref(b)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[5]||(U[5]=te=>S.value=te),class:"filter-popup__cond-input",type:"text",onKeydown:t.withKeys(T,["enter"])},null,544),[[t.vModelText,S.value]])])):(t.openBlock(),t.createElementBlock("div",If,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":U[6]||(U[6]=te=>w.value=te),class:"filter-popup__cond-input",type:"text",placeholder:s.value==="date"?"YYYY-MM-DD":"",onKeydown:t.withKeys(T,["enter"])},null,40,Af),[[t.vModelText,w.value]])])),s.value==="date"?(t.openBlock(),t.createElementBlock("p",Lf,t.toDisplayString(t.unref(b)(e.locale,"filterDateHint")),1)):t.createCommentVNode("",!0)])),t.createElementVNode("div",zf,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:ne},t.toDisplayString(t.unref(b)(e.locale,"clearFilter")),1),U[11]||(U[11]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:F},t.toDisplayString(t.unref(b)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:U[7]||(U[7]=te=>s.value==="values"?W():T())},t.toDisplayString(t.unref(b)(e.locale,"filterOk")),1)])],38)]))}}),[["__scopeId","data-v-e0e5364c"]]),Hf={class:"cf-manager__header"},Wf={class:"cf-manager__title"},Uf=["disabled"],Pf={key:0,class:"cf-manager__empty"},Kf={key:1,class:"cf-manager__list"},Gf={class:"cf-rule__main"},qf={class:"cf-rule__info"},Yf={class:"cf-rule__summary"},jf={class:"cf-rule__range"},Xf={class:"cf-rule__actions"},Zf={class:"cf-chk"},Jf=["checked","disabled","onChange"],Qf=["title","disabled","onClick"],em=["title","disabled","onClick"],tm=["title","disabled","onClick"],lm=["title","disabled","onClick"],nm=_t(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},editable:{type:Boolean,default:!0},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:o}){const l=e,n=o,a=t.computed(()=>[...l.rules].sort((d,m)=>d.priority-m.priority));function i(d){return d.ranges.map(m=>{const p=Et(m.startCol)+(m.startRow+1);return m.startCol===m.endCol&&m.startRow===m.endRow?p:p+":"+Et(m.endCol)+(m.endRow+1)}).join(", ")}function r(d){switch(d.type){case"cellIs":{const m=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"?`${m} ${d.value} ${b(l.locale,"cfValue2")} ${d.value2??""}`:`${m} ${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 s(d){const m={};return d.format.backgroundColor&&(m.background=d.format.backgroundColor),d.format.color&&(m.color=d.format.color),d.format.fontWeight==="bold"&&(m.fontWeight="700"),d.format.fontStyle==="italic"&&(m.fontStyle="italic"),d.format.underline==="underline"&&(m.textDecoration="underline"),d.format.strikethrough==="line-through"&&(m.textDecoration="line-through"),m}return(d,m)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Hf,[t.createElementVNode("span",Wf,t.toDisplayString(t.unref(b)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",disabled:l.editable===!1,onClick:m[0]||(m[0]=p=>n("new"))},t.toDisplayString(t.unref(b)(e.locale,"cfNewRule")),9,Uf),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:m[1]||(m[1]=p=>n("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",Pf,t.toDisplayString(t.unref(b)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",Kf,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,p=>(t.openBlock(),t.createElementBlock("div",{key:p.id,class:t.normalizeClass(["cf-rule",{"cf-rule--disabled":!p.enabled}])},[t.createElementVNode("div",Gf,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(s(p))},"Aa",4),t.createElementVNode("div",qf,[t.createElementVNode("div",Yf,t.toDisplayString(r(p.condition)),1),t.createElementVNode("div",jf,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(p)),1)])]),t.createElementVNode("div",Xf,[t.createElementVNode("label",Zf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:p.enabled,disabled:l.editable===!1,onChange:B=>n("toggle",p.id,B.target.checked)},null,40,Jf),m[2]||(m[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"),disabled:l.editable===!1,onClick:B=>n("move",p.id,"up")},[...m[3]||(m[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,Qf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfMoveDown"),disabled:l.editable===!1,onClick:B=>n("move",p.id,"down")},[...m[4]||(m[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,em),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfEdit"),disabled:l.editable===!1,onClick:B=>n("edit",p)},[...m[5]||(m[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,tm),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(b)(e.locale,"cfDelete"),disabled:l.editable===!1,onClick:B=>n("delete",p.id)},[...m[6]||(m[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,lm)])],2))),128))]))],4))}}),[["__scopeId","data-v-ebe5b10b"]]),om={class:"cf-editor__header"},rm={class:"cf-editor__title"},am={class:"cf-editor__body"},im={class:"cf-row"},sm={class:"cf-label"},cm={class:"cf-row"},dm={class:"cf-label"},um={class:"cf-row"},fm={class:"cf-label"},mm={key:0,class:"cf-row"},pm={class:"cf-label"},hm={class:"cf-row"},gm={class:"cf-label"},bm=["placeholder"],ym={class:"cf-hint"},Cm={key:2,class:"cf-row"},wm={class:"cf-label"},vm={class:"cf-row"},km={class:"cf-label"},Em={class:"cf-format-row"},Rm=["title"],Mm={viewBox:"0 0 1024 1024",fill:"currentColor"},Sm=["fill"],Nm=["title"],Bm={viewBox:"0 0 1024 1024",fill:"currentColor"},xm=["fill"],Tm=["title"],Vm=["title"],Dm=["title"],Fm=["title"],Om={class:"cf-row"},Im={class:"cf-label"},Am={key:3,class:"cf-error"},Lm={class:"cf-row cf-row--inline"},zm={class:"cf-chk"},$m=["checked"],_m={class:"cf-chk"},Hm=["checked"],Wm={class:"cf-editor__footer"},Um=["disabled"],Pm=_t(t.defineComponent({__name:"conditional-format-rule-editor",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},editable:{type:Boolean,default:!0},themeVars:{default:()=>({})}},emits:["save","cancel"],setup(e,{emit:o}){const l=e,n=o,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 v=l.rule.condition;return{type:v.type==="cellIs"||v.type==="textContains"||v.type==="textNotContains"||v.type==="blank"||v.type==="notBlank"||v.type==="duplicate"||v.type==="unique"||v.type==="formula"?v.type:"cellIs",operator:v.type==="cellIs"?v.operator:"greaterThan",value:v.type==="cellIs"||v.type==="textContains"||v.type==="textNotContains"?v.value:"",value2:v.type==="cellIs"?v.value2??"":"",formula:v.type==="formula"?v.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(X=>I(X)).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 s=t.reactive(r()),d=t.ref(!1),m=t.ref(!1),p=t.ref(null),B=t.ref(null),f=t.ref("");function I(v){const A=Et(v.startCol)+(v.startRow+1);return v.startCol===v.endCol&&v.startRow===v.endRow?A:A+":"+Et(v.endCol)+(v.endRow+1)}function w(v){const A=v.split(",").map(ze=>ze.trim()).filter(Boolean),X=[];for(const ze of A){if(!ze.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const oe=El(ze.split(":")[0],99999,99999),we=ze.split(":")[1],Be=we?El(we,99999,99999):oe;if(!oe||!Be)return null;X.push({startCol:Math.min(oe.col,Be.col),endCol:Math.max(oe.col,Be.col),startRow:Math.min(oe.row,Be.row),endRow:Math.max(oe.row,Be.row)})}return X.length?X:null}const S=t.computed(()=>s.type==="cellIs"&&(s.operator==="between"||s.operator==="notBetween")),$=t.computed(()=>s.type==="formula"),q=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(s.type)),ae=t.computed(()=>a.map(v=>({value:v.value,label:b(l.locale,v.label)}))),fe=t.computed(()=>i.map(v=>({value:v.value,label:b(l.locale,v.label)})));function Ce(v){s.type=v}function Se(v){s.operator=String(v)}function be(){d.value=!d.value}function Ge(){m.value=!m.value}function pe(){return f.value="",w(s.rangeText)?$.value&&!s.formula.trim()?(f.value=b(l.locale,"cfFormulaRequired"),!1):!0:(f.value=b(l.locale,"cfRangeInvalid"),!1)}function ie(){switch(s.type){case"cellIs":return{type:"cellIs",operator:s.operator,value:s.value,value2:s.value2||void 0};case"textContains":return{type:"textContains",value:s.value};case"textNotContains":return{type:"textNotContains",value:s.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:s.formula}}}function Ne(){return{backgroundColor:s.backgroundColor||void 0,color:s.color||void 0,fontWeight:s.fontWeight?"bold":"",fontStyle:s.fontStyle?"italic":"",underline:s.underline?"underline":"",strikethrough:s.strikethrough?"line-through":""}}function ft(){var X,ze;if(!pe())return;const v=w(s.rangeText),A={id:((X=l.rule)==null?void 0:X.id)??"",condition:ie(),format:Ne(),ranges:v,priority:((ze=l.rule)==null?void 0:ze.priority)??0,stopIfTrue:s.stopIfTrue,enabled:s.enabled};n("save",A)}function mt(){n("cancel")}return(v,A)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",om,[t.createElementVNode("span",rm,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:mt}," × ")]),t.createElementVNode("div",am,[t.createElementVNode("div",im,[t.createElementVNode("label",sm,t.toDisplayString(t.unref(b)(e.locale,"cfType")),1),t.createVNode(jt,{class:"cf-dropdown","model-value":s.type,options:ae.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"cfType"),align:"right",onChange:Ce},null,8,["model-value","options","title"])]),s.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",cm,[t.createElementVNode("label",dm,t.toDisplayString(t.unref(b)(e.locale,"cfOperator")),1),t.createVNode(jt,{class:"cf-dropdown","model-value":s.operator,options:fe.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"cfOperator"),align:"right",onChange:Se},null,8,["model-value","options","title"])]),t.createElementVNode("div",um,[t.createElementVNode("label",fm,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[0]||(A[0]=X=>s.value=X),class:"cf-input",type:"text"},null,512),[[t.vModelText,s.value]])]),S.value?(t.openBlock(),t.createElementBlock("div",mm,[t.createElementVNode("label",pm,t.toDisplayString(t.unref(b)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=X=>s.value2=X),class:"cf-input",type:"text"},null,512),[[t.vModelText,s.value2]])])):t.createCommentVNode("",!0)],64)):$.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",hm,[t.createElementVNode("label",gm,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[2]||(A[2]=X=>s.formula=X),class:"cf-input",type:"text",placeholder:t.unref(b)(e.locale,"cfFormulaExample")},null,8,bm),[[t.vModelText,s.formula]])]),t.createElementVNode("p",ym,t.toDisplayString(t.unref(b)(e.locale,"cfFormula")),1)],64)):q.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Cm,[t.createElementVNode("label",wm,t.toDisplayString(t.unref(b)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[3]||(A[3]=X=>s.value=X),class:"cf-input",type:"text"},null,512),[[t.vModelText,s.value]])])),t.createElementVNode("div",vm,[t.createElementVNode("label",km,t.toDisplayString(t.unref(b)(e.locale,"cfFormat")),1),t.createElementVNode("div",Em,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:p,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.value}]),title:t.unref(b)(e.locale,"fillColor"),onClick:be},[(t.openBlock(),t.createElementBlock("svg",Mm,[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:s.backgroundColor||"currentColor"},null,8,Sm)]))],10,Rm),t.createVNode(No,{"model-open":d.value,"color-key":"fill","current-color":s.backgroundColor,"trigger-el":p.value,locale:e.locale,"onUpdate:modelOpen":A[4]||(A[4]=X=>d.value=X),onChange:A[5]||(A[5]=X=>s.backgroundColor=X)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:B,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":m.value}]),title:t.unref(b)(e.locale,"fontColor"),onClick:Ge},[(t.openBlock(),t.createElementBlock("svg",Bm,[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:s.color||"#000000"},null,8,xm)]))],10,Nm),t.createVNode(No,{"model-open":m.value,"color-key":"text","current-color":s.color,"trigger-el":B.value,locale:e.locale,"onUpdate:modelOpen":A[6]||(A[6]=X=>m.value=X),onChange:A[7]||(A[7]=X=>s.color=X)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":s.fontWeight}]),title:t.unref(b)(e.locale,"bold"),onClick:A[8]||(A[8]=X=>s.fontWeight=!s.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,Tm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":s.fontStyle}]),title:t.unref(b)(e.locale,"italic"),onClick:A[9]||(A[9]=X=>s.fontStyle=!s.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,Vm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":s.underline}]),title:t.unref(b)(e.locale,"underline"),onClick:A[10]||(A[10]=X=>s.underline=!s.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":s.strikethrough}]),title:t.unref(b)(e.locale,"strikethrough"),onClick:A[11]||(A[11]=X=>s.strikethrough=!s.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,Fm)])]),t.createElementVNode("div",Om,[t.createElementVNode("label",Im,t.toDisplayString(t.unref(b)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[12]||(A[12]=X=>s.rangeText=X),class:"cf-input",type:"text"},null,512),[[t.vModelText,s.rangeText]])]),f.value?(t.openBlock(),t.createElementBlock("div",Am,t.toDisplayString(f.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Lm,[t.createElementVNode("label",zm,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:s.stopIfTrue,onChange:A[13]||(A[13]=X=>s.stopIfTrue=X.target.checked)},null,40,$m),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",_m,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:s.enabled,onChange:A[14]||(A[14]=X=>s.enabled=X.target.checked)},null,40,Hm),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",Wm,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",disabled:l.editable===!1,onClick:ft},t.toDisplayString(t.unref(b)(e.locale,"ok")),9,Um),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:mt},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-40ab4473"]]),Km={class:"dv-editor__header"},Gm={class:"dv-editor__title"},qm={class:"dv-editor__body"},Ym={class:"dv-sec"},jm={class:"dv-sec__title"},Xm={class:"dv-row"},Zm={class:"dv-label"},Jm={class:"dv-row"},Qm={class:"dv-label"},e0={class:"dv-hint"},t0={class:"dv-row dv-row--inline"},l0={class:"dv-chk"},n0=["checked"],o0={class:"dv-row"},r0={class:"dv-label"},a0={class:"dv-hint"},i0={class:"dv-row"},s0={class:"dv-label"},c0={key:0,class:"dv-row"},d0={class:"dv-label"},u0={class:"dv-row"},f0={class:"dv-label"},m0={class:"dv-row"},p0={class:"dv-label"},h0={class:"dv-row dv-row--inline"},g0=["checked","disabled"],b0=["checked","disabled"],y0={class:"dv-sec"},C0={class:"dv-sec__title"},w0={class:"dv-row dv-row--inline"},v0={class:"dv-chk"},k0=["checked"],E0={class:"dv-row"},R0={class:"dv-label"},M0=["disabled"],S0={class:"dv-row dv-row--top"},N0={class:"dv-label"},B0=["disabled"],x0={class:"dv-sec"},T0={class:"dv-sec__title"},V0={class:"dv-row dv-row--inline"},D0={class:"dv-chk"},F0=["checked"],O0={class:"dv-row"},I0={class:"dv-label"},A0={class:"dv-row"},L0={class:"dv-label"},z0=["disabled"],$0={class:"dv-row dv-row--top"},_0={class:"dv-label"},H0=["disabled"],W0={class:"dv-sec"},U0={class:"dv-row"},P0={class:"dv-label"},K0={key:0,class:"dv-error"},G0={class:"dv-editor__footer"},q0=["disabled"],Y0=["disabled"],Oo="\\$?[A-Za-z]+\\$?\\d+",j0=_t(t.defineComponent({__name:"data-validation-dialog",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},editable:{type:Boolean,default:!0},themeVars:{default:()=>({})}},emits:["save","cancel","clear"],setup(e,{emit:o}){const l=e,n=o,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 s(v){const A=Et(v.startCol)+(v.startRow+1);return v.startCol===v.endCol&&v.startRow===v.endRow?A:A+":"+Et(v.endCol)+(v.endRow+1)}function d(v){const A=v==null?void 0:v.listSource;if((A==null?void 0:A.type)==="range"){const ze=s(A.range);return A.sheetId?`${A.sheetId}!${ze}`:ze}return((A==null?void 0:A.type)==="values"?A.values:(v==null?void 0:v.values)??[]).join(",")}function m(){const v=l.rule;return{type:(v==null?void 0:v.type)??"any",operator:(v==null?void 0:v.operator)??"between",formula1:(v==null?void 0:v.formula1)??"",formula2:(v==null?void 0:v.formula2)??"",source:d(v),allowBlank:(v==null?void 0:v.allowBlank)!==!1,showDropdown:(v==null?void 0:v.showDropdown)!==!1,showInputMessage:(v==null?void 0:v.showInputMessage)===!0,inputTitle:(v==null?void 0:v.inputTitle)??"",inputMessage:(v==null?void 0:v.inputMessage)??"",showErrorMessage:(v==null?void 0:v.showErrorMessage)!==!1,errorStyle:(v==null?void 0:v.errorStyle)??"stop",errorTitle:(v==null?void 0:v.errorTitle)??"",errorMessage:(v==null?void 0:v.errorMessage)??"",rangeText:v&&v.ranges.length?v.ranges.map(s).join(", "):l.defaultRangeText,enabled:(v==null?void 0:v.enabled)!==!1}}const p=t.reactive(m()),B=t.ref(""),f=t.computed(()=>p.type==="list"),I=t.computed(()=>p.type==="custom"),w=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(p.type)),S=t.computed(()=>w.value&&(p.operator==="between"||p.operator==="notBetween")),$=t.computed(()=>p.type==="any"),q=t.computed(()=>a.map(v=>({value:v.value,label:b(l.locale,v.label)}))),ae=t.computed(()=>i.map(v=>({value:v.value,label:b(l.locale,v.label)}))),fe=t.computed(()=>r.map(v=>({value:v.value,label:b(l.locale,v.label)})));function Ce(v){const A=v.split(",").map(ze=>ze.trim()).filter(Boolean),X=[];for(const ze of A){if(!ze.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const oe=El(ze.split(":")[0],99999,99999),we=ze.split(":")[1],Be=we?El(we,99999,99999):oe;if(!oe||!Be)return null;X.push({startCol:Math.min(oe.col,Be.col),endCol:Math.max(oe.col,Be.col),startRow:Math.min(oe.row,Be.row),endRow:Math.max(oe.row,Be.row)})}return X.length?X:null}function Se(v){const A=v.trim();if(!A)return null;const X=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${Oo})(?::(${Oo}))?$`).exec(A);if(X){const oe=(X[1]??X[2]??"").trim(),we=El(X[3],99999,99999),Be=X[4]?El(X[4],99999,99999):we;return!oe||!we||!Be?null:{type:"range",sheetId:oe,range:{startCol:Math.min(we.col,Be.col),endCol:Math.max(we.col,Be.col),startRow:Math.min(we.row,Be.row),endRow:Math.max(we.row,Be.row)}}}const ze=new RegExp(`^(${Oo})(?::(${Oo}))?$`).exec(A);if(ze){const oe=El(ze[1],99999,99999),we=ze[2]?El(ze[2],99999,99999):oe;return!oe||!we?null:{type:"range",range:{startCol:Math.min(oe.col,we.col),endCol:Math.max(oe.col,we.col),startRow:Math.min(oe.row,we.row),endRow:Math.max(oe.row,we.row)}}}const Je=A.split(",").map(oe=>oe.trim());return Je.some(oe=>oe!=="")?{type:"values",values:Je}:null}const be=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Ge(v,A){const X=A.trim();if(X==="")return b(l.locale,"dvValueRequired");if(X.startsWith("="))return null;const ze=l.locale;switch(v){case"wholeNumber":case"textLength":{const Je=So(X,ze);return Je&&Number.isFinite(Je.num)&&Number.isInteger(Je.num)||be.test(X)&&Number.isInteger(Number(X))?null:b(ze,"dvMustBeInteger")}case"decimal":{const Je=So(X,ze);return Je&&Number.isFinite(Je.num)||be.test(X)&&Number.isFinite(Number(X))?null:b(ze,"dvMustBeNumber")}case"date":{const Je=Zl(X,ze);return Je&&Je.format!=="h:mm:ss"?null:b(ze,"dvDateInvalid")}case"time":return Zl(X,ze)?null:b(ze,"dvTimeInvalid");default:return null}}function pe(){if(B.value="",!Ce(p.rangeText))return B.value=b(l.locale,"dvRangeInvalid"),!1;if(p.type==="any")return!0;if(f.value)return Se(p.source)?!0:(B.value=b(l.locale,"dvSourceInvalid"),!1);if(I.value)return p.formula1.trim()?!0:(B.value=b(l.locale,"dvFormulaRequired"),!1);if(S.value){if(!p.formula1.trim())return B.value=b(l.locale,"dvMinRequired"),!1;if(!p.formula2.trim())return B.value=b(l.locale,"dvMaxRequired"),!1;const A=Ge(p.type,p.formula1);if(A)return B.value=`${b(l.locale,"dvMin")}:${A}`,!1;const X=Ge(p.type,p.formula2);return X?(B.value=`${b(l.locale,"dvMax")}:${X}`,!1):!0}if(!p.formula1.trim())return B.value=b(l.locale,"dvValueRequired"),!1;const v=Ge(p.type,p.formula1);return v?(B.value=`${b(l.locale,"dvValue")}:${v}`,!1):!0}function ie(){var X,ze;if(!pe())return;const v=Ce(p.rangeText);if(p.type==="any"){n("save",{id:((X=l.rule)==null?void 0:X.id)??"",type:"any",ranges:v,allowBlank:p.allowBlank,enabled:!0});return}const A={id:((ze=l.rule)==null?void 0:ze.id)??"",type:p.type,ranges:v,allowBlank:p.allowBlank,enabled:p.enabled,showInputMessage:p.showInputMessage,inputTitle:p.inputTitle||void 0,inputMessage:p.inputMessage||void 0,showErrorMessage:p.showErrorMessage,errorStyle:p.errorStyle,errorTitle:p.errorTitle||void 0,errorMessage:p.errorMessage||void 0};if(f.value){const Je=Se(p.source);A.listSource=Je,A.values=Je.type==="values"?Je.values:void 0,A.showDropdown=p.showDropdown}else I.value?A.formula1=p.formula1.trim():(A.operator=p.operator,A.formula1=p.formula1.trim(),A.formula2=S.value?p.formula2.trim():void 0);n("save",A)}function Ne(v){p.type=v}function ft(v){p.operator=String(v)}function mt(v){p.errorStyle=String(v)}return(v,A)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Km,[t.createElementVNode("span",Gm,t.toDisplayString(t.unref(b)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:A[0]||(A[0]=X=>n("cancel"))}," × ")]),t.createElementVNode("div",qm,[t.createElementVNode("div",Ym,[t.createElementVNode("div",jm,t.toDisplayString(t.unref(b)(e.locale,"dvSettings")),1),t.createElementVNode("div",Xm,[t.createElementVNode("label",Zm,t.toDisplayString(t.unref(b)(e.locale,"dvAllow")),1),t.createVNode(jt,{class:"dv-dropdown","model-value":p.type,options:q.value,width:"100%","visible-count":8,title:t.unref(b)(e.locale,"dvAllow"),align:"right",onChange:Ne},null,8,["model-value","options","title"])]),f.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Jm,[t.createElementVNode("label",Qm,t.toDisplayString(t.unref(b)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=X=>p.source=X),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,p.source]])]),t.createElementVNode("p",e0,t.toDisplayString(t.unref(b)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",t0,[t.createElementVNode("label",l0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:p.showDropdown,onChange:A[2]||(A[2]=X=>p.showDropdown=X.target.checked)},null,40,n0),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)):I.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",o0,[t.createElementVNode("label",r0,t.toDisplayString(t.unref(b)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[3]||(A[3]=X=>p.formula1=X),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,p.formula1]])]),t.createElementVNode("p",a0,t.toDisplayString(t.unref(b)(e.locale,"cfFormulaExample")),1)],64)):w.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",i0,[t.createElementVNode("label",s0,t.toDisplayString(t.unref(b)(e.locale,"dvData")),1),t.createVNode(jt,{class:"dv-dropdown","model-value":p.operator,options:ae.value,width:"100%","visible-count":9,title:t.unref(b)(e.locale,"dvOperator"),align:"right",onChange:ft},null,8,["model-value","options","title"])]),S.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",u0,[t.createElementVNode("label",f0,t.toDisplayString(t.unref(b)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[5]||(A[5]=X=>p.formula1=X),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,p.formula1]])]),t.createElementVNode("div",m0,[t.createElementVNode("label",p0,t.toDisplayString(t.unref(b)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[6]||(A[6]=X=>p.formula2=X),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,p.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",c0,[t.createElementVNode("label",d0,t.toDisplayString(t.unref(b)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[4]||(A[4]=X=>p.formula1=X),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,p.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",h0,[t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":$.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:p.allowBlank,disabled:$.value,onChange:A[7]||(A[7]=X=>p.allowBlank=X.target.checked)},null,40,g0),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":$.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:p.enabled,disabled:$.value,onChange:A[8]||(A[8]=X=>p.enabled=X.target.checked)},null,40,b0),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",y0,[t.createElementVNode("div",C0,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",w0,[t.createElementVNode("label",v0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:p.showInputMessage,onChange:A[9]||(A[9]=X=>p.showInputMessage=X.target.checked)},null,40,k0),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",R0,t.toDisplayString(t.unref(b)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[10]||(A[10]=X=>p.inputTitle=X),class:"dv-input",type:"text",disabled:!p.showInputMessage},null,8,M0),[[t.vModelText,p.inputTitle]])]),t.createElementVNode("div",S0,[t.createElementVNode("label",N0,t.toDisplayString(t.unref(b)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":A[11]||(A[11]=X=>p.inputMessage=X),class:"dv-input dv-input--area",rows:"2",disabled:!p.showInputMessage},null,8,B0),[[t.vModelText,p.inputMessage]])])]),t.createElementVNode("div",x0,[t.createElementVNode("div",T0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",V0,[t.createElementVNode("label",D0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:p.showErrorMessage,onChange:A[12]||(A[12]=X=>p.showErrorMessage=X.target.checked)},null,40,F0),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",O0,[t.createElementVNode("label",I0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorStyle")),1),t.createVNode(jt,{class:"dv-dropdown","model-value":p.errorStyle,options:fe.value,width:"100%","visible-count":4,title:t.unref(b)(e.locale,"dvErrorStyle"),align:"right",onChange:mt},null,8,["model-value","options","title"])]),t.createElementVNode("div",A0,[t.createElementVNode("label",L0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[13]||(A[13]=X=>p.errorTitle=X),class:"dv-input",type:"text",disabled:!p.showErrorMessage},null,8,z0),[[t.vModelText,p.errorTitle]])]),t.createElementVNode("div",$0,[t.createElementVNode("label",_0,t.toDisplayString(t.unref(b)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":A[14]||(A[14]=X=>p.errorMessage=X),class:"dv-input dv-input--area",rows:"2",disabled:!p.showErrorMessage},null,8,H0),[[t.vModelText,p.errorMessage]])])]),t.createElementVNode("div",W0,[t.createElementVNode("div",U0,[t.createElementVNode("label",P0,t.toDisplayString(t.unref(b)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":A[15]||(A[15]=X=>p.rangeText=X),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,p.rangeText]])])]),B.value?(t.openBlock(),t.createElementBlock("div",K0,t.toDisplayString(B.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",G0,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",disabled:l.editable===!1,onClick:A[16]||(A[16]=X=>n("clear"))},t.toDisplayString(t.unref(b)(e.locale,"dvClearAll")),9,q0),A[23]||(A[23]=t.createElementVNode("span",{class:"dv-editor__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--primary",disabled:l.editable===!1,onClick:ie},t.toDisplayString(t.unref(b)(e.locale,"ok")),9,Y0),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:A[17]||(A[17]=X=>n("cancel"))},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-a5b77384"]]),X0={key:0,class:"dvd__search"},Z0=["placeholder"],J0=["onMouseenter","onClick"],Q0={class:"dvd__check"},e1={class:"dvd__label"},t1={key:1,class:"dvd__empty"},Ol=24,l1=244,n1=140,o1=_t(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},boundaryEl:{}},emits:["select","close"],setup(e,{emit:o}){const l=t.inject("sp-theme","light"),n=e,a=o,i=t.ref(""),r=t.ref(0),s=t.ref(0),d=t.ref(null),m=t.ref(null),p=t.ref(null),B=t.ref({left:n.x,top:n.y+n.height+2,up:!1}),f=t.computed(()=>{const A=i.value.trim().toLowerCase();return A?n.items.filter(X=>String(X??"").toLowerCase().includes(A)):n.items}),I=t.computed(()=>Math.min(l1,Math.max(Ol,f.value.length*Ol))),w=t.computed(()=>Math.max(n1,Math.min(360,n.width))),S=t.computed(()=>Math.max(0,Math.floor(s.value/Ol)-1)),$=t.computed(()=>Math.min(f.value.length,Math.ceil((s.value+I.value)/Ol)+1)),q=t.computed(()=>f.value.slice(S.value,$.value)),ae=t.computed(()=>S.value*Ol),fe=t.computed(()=>Math.max(0,(f.value.length-$.value)*Ol));function Ce(A){return String(A??"").trim().toLowerCase()===String(n.current??"").trim().toLowerCase()}function Se(){const A=I.value+be(),X=Vl(n.boundaryEl),ze=X.bottom-(n.y+n.height)-8,Je=n.y-X.top-8,oe=ze<A&&Je>ze;let we=oe?n.y-A-2:n.y+n.height+2;we=Math.max(X.top+8,Math.min(X.bottom-A-8,we));const Be=Math.max(X.left+8,Math.min(X.right-w.value-8,n.x));B.value={left:Be,top:we,up:oe}}function be(){return f.value.length>8||i.value?34:0}t.watch(()=>[n.x,n.y,n.width,n.height],()=>Se()),t.onMounted(()=>{t.nextTick(()=>{var A;Se(),d.value?d.value.focus():(A=p.value)==null||A.focus()}),document.addEventListener("pointerdown",Ge,!0),window.addEventListener("resize",pe),window.addEventListener("scroll",pe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Ge,!0),window.removeEventListener("resize",pe),window.removeEventListener("scroll",pe,!0)});function Ge(A){var X;(X=p.value)!=null&&X.contains(A.target)||pe()}function pe(){a("close")}function ie(A){const X=m.value;if(!X)return;const ze=A*Ol,Je=ze+Ol;ze<X.scrollTop?X.scrollTop=ze:Je>X.scrollTop+I.value&&(X.scrollTop=Je-I.value)}function Ne(A){const X=f.value.length;X!==0&&(r.value=(r.value+A+X)%X,ie(r.value))}function ft(A){const X=f.value[A];X!==void 0&&a("select",X)}function mt(A){s.value=A.target.scrollTop}function v(A){switch(A.key){case"ArrowDown":A.preventDefault(),A.stopPropagation(),Ne(1);return;case"ArrowUp":A.preventDefault(),A.stopPropagation(),Ne(-1);return;case"Home":A.preventDefault(),A.stopPropagation(),r.value=0,s.value=0,m.value&&(m.value.scrollTop=0);return;case"End":{A.preventDefault(),A.stopPropagation();const X=f.value.length;r.value=Math.max(0,X-1),ie(r.value);return}case"PageDown":A.preventDefault(),A.stopPropagation(),Ne(Math.max(1,Math.floor(I.value/Ol)));return;case"PageUp":A.preventDefault(),A.stopPropagation(),Ne(-Math.max(1,Math.floor(I.value/Ol)));return;case"Enter":A.preventDefault(),A.stopPropagation(),ft(r.value);return;case"Escape":A.preventDefault(),A.stopPropagation(),pe();return;case"Tab":A.preventDefault(),A.stopPropagation(),ft(r.value);return}}return t.watch(i,()=>{r.value=0,s.value=0,m.value&&(m.value.scrollTop=0),t.nextTick(Se)}),t.watch(f,A=>{const X=A.findIndex(ze=>Ce(ze));X>=0&&(r.value=X,t.nextTick(()=>ie(X)))},{immediate:!0}),(A,X)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:p,class:t.normalizeClass(["dvd sp-spreader-overlay",{dark:t.unref(l)==="dark"}]),tabindex:"-1",style:t.normalizeStyle({left:B.value.left+"px",top:B.value.top+"px",width:w.value+"px"}),onKeydown:v,onWheel:X[2]||(X[2]=t.withModifiers(()=>{},["stop"]))},[be()>0?(t.openBlock(),t.createElementBlock("div",X0,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:d,"onUpdate:modelValue":X[0]||(X[0]=ze=>i.value=ze),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(b)(e.locale,"dvSearchPlaceholder"),onKeydown:v},null,40,Z0),[[t.vModelText,i.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:m,class:"dvd__list",style:t.normalizeStyle({height:I.value+"px"}),onScroll:mt},[t.createElementVNode("div",{style:t.normalizeStyle({height:ae.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(q.value,(ze,Je)=>(t.openBlock(),t.createElementBlock("div",{key:S.value+Je,class:t.normalizeClass(["dvd__item",{"dvd__item--active":S.value+Je===r.value,"dvd__item--checked":Ce(ze)}]),style:t.normalizeStyle({height:Ol+"px",lineHeight:Ol+"px"}),onMousedown:X[1]||(X[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:oe=>r.value=S.value+Je,onClick:oe=>ft(S.value+Je)},[t.createElementVNode("span",Q0,t.toDisplayString(Ce(ze)?"✓":""),1),t.createElementVNode("span",e1,t.toDisplayString(ze===""?t.unref(b)(e.locale,"emptyCellLabel"):ze),1)],46,J0))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:fe.value+"px"})},null,4)],36),f.value.length===0?(t.openBlock(),t.createElementBlock("div",t1,t.toDisplayString(t.unref(b)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-a605119a"]]),r1={class:"dv-alert__header"},a1={class:"dv-alert__title"},i1={class:"dv-alert__body"},s1={class:"dv-alert__icon",viewBox:"0 0 1024 1024"},c1=["d","fill","transform"],d1={class:"dv-alert__text"},u1={key:0,class:"dv-alert__subtitle"},f1={class:"dv-alert__message"},m1={class:"dv-alert__footer"},Oa=_t(t.defineComponent({__name:"data-validation-alert",props:{locale:{},severity:{},title:{default:""},message:{default:""},themeVars:{default:()=>({})}},emits:["resolve"],setup(e,{emit:o}){const l=e,n=o,a={stop:{paths:[{d:"M512 84a428 428 0 1 0 0 856 428 428 0 0 0 0-856z",fill:"#d93025"},{d:"M412 172h200v680H412z",fill:"#ffffff",t:"rotate(45 512 512)"},{d:"M412 172h200v680H412z",fill:"#ffffff",t:"rotate(-45 512 512)"}]},warning:{paths:[{d:"M512 96 L64 880 L960 880 Z",fill:"#8a5a00"},{d:"M512 128 L91 865 L933 865 Z",fill:"#ffc107"},{d:"M476 380h72v300H476z",fill:"#212121"},{d:"M512 726a46 46 0 1 0 0 92 46 46 0 0 0 0-92z",fill:"#212121"}]},information:{paths:[{d:"M512 84a428 428 0 1 0 0 856 428 428 0 0 0 0-856z",fill:"#1a73e8"},{d:"M512 316a56 56 0 1 0 0 112 56 56 0 0 0 0-112z",fill:"#ffffff"},{d:"M474 460h76v280H474z",fill:"#ffffff"}]}},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")),s=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 m(){n("resolve",l.severity==="stop"?"retry":"continue")}function p(){n("resolve","cancel")}return(B,f)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",r1,[t.createElementVNode("span",a1,t.toDisplayString(r.value),1)]),t.createElementVNode("div",i1,[(t.openBlock(),t.createElementBlock("svg",s1,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value.paths,(I,w)=>(t.openBlock(),t.createElementBlock("path",{key:w,d:I.d,fill:I.fill,transform:I.t||void 0},null,8,c1))),128))])),t.createElementVNode("div",d1,[e.title?(t.openBlock(),t.createElementBlock("div",u1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",f1,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",m1,[f[2]||(f[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:f[0]||(f[0]=t.withModifiers(()=>{},["prevent"])),onClick:m},t.toDisplayString(s.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:f[1]||(f[1]=t.withModifiers(()=>{},["prevent"])),onClick:p},t.toDisplayString(d.value),33)])],4))}}),[["__scopeId","data-v-1cba5c03"]]),p1={key:0,class:"dvim__title"},h1={class:"dvim__message"},g1=_t(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){const o=t.inject("sp-theme","light");return(l,n)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["dvim sp-spreader-overlay",{dark:t.unref(o)==="dark"}]),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",p1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",h1,t.toDisplayString(e.message),1)],6))}}),[["__scopeId","data-v-e2e2d6ab"]]),b1={class:"note-overlay__header"},y1={class:"note-overlay__author"},C1=["title"],w1={class:"note-overlay__body"},v1={class:"note-overlay__header"},k1={class:"note-overlay__author"},E1=["placeholder"],R1={class:"note-overlay__footer"},M1=_t(t.defineComponent({__name:"note-overlay",props:{anchor:{},mode:{},note:{default:null},author:{},locale:{},placeholder:{default:""},boundaryEl:{default:null}},emits:["save","delete","close"],setup(e,{emit:o}){var f;const l=e,n=o,a=t.ref(null),i=t.ref(((f=l.note)==null?void 0:f.text)??"");t.watch(()=>{var I;return[l.mode,(I=l.note)==null?void 0:I.text,l.anchor.x,l.anchor.y]},()=>{var I;i.value=((I=l.note)==null?void 0:I.text)??""});const r=t.ref({left:0,top:0}),s=t.computed(()=>({left:r.value.left+"px",top:r.value.top+"px",zIndex:2}));function d(){var pe,ie;const I=a.value,w=l.anchor;if(!I){r.value={left:w.x+w.width+6,top:w.y+6};return}const S=I.offsetWidth,$=I.offsetHeight,fe={left:52,top:24,right:((pe=l.boundaryEl)==null?void 0:pe.offsetWidth)??0,bottom:((ie=l.boundaryEl)==null?void 0:ie.offsetHeight)??0},Ce=6,Se=8;let be=w.x+w.width+Ce,Ge=w.y+Ce;be+S>fe.right-Se&&(be=w.x-S-Ce,be<fe.left+Se&&(be=Math.min(Math.max(fe.left+Se,w.x),fe.right-S-Se),fe.right-S-Se<fe.left+Se&&(be=fe.left+Se))),Ge+$>fe.bottom-Se&&(Ge=w.y+w.height-Ce-$,Ge<fe.top+Se&&(Ge=Math.min(Math.max(fe.top+Se,w.y),fe.bottom-$-Se),fe.bottom-$-Se<fe.top+Se&&(Ge=fe.top+Se))),r.value={left:be,top:Ge}}t.watch(()=>{var I;return[l.anchor.x,l.anchor.y,l.anchor.width,(I=l.note)==null?void 0:I.text,i.value]},()=>t.nextTick(d),{immediate:!0,flush:"post"});function m(){t.nextTick(d)}t.onMounted(()=>window.addEventListener("resize",m)),t.onBeforeUnmount(()=>window.removeEventListener("resize",m));function p(I){I.key==="Escape"?(I.stopPropagation(),I.preventDefault(),n("close")):I.key==="Enter"&&!I.shiftKey&&(I.ctrlKey||I.metaKey||I.altKey)&&(I.stopPropagation(),I.preventDefault(),B())}function B(){n("save",i.value.trim())}return(I,w)=>{var S,$;return e.mode?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"el",ref:a,class:t.normalizeClass(["note-overlay",`note-overlay--${e.mode}`]),style:t.normalizeStyle(s.value),onMousedown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"])),onContextmenu:w[4]||(w[4]=t.withModifiers(()=>{},["stop"])),onClick:w[5]||(w[5]=t.withModifiers(()=>{},["stop"]))},[e.mode==="view"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",b1,[t.createElementVNode("span",y1,t.toDisplayString(((S=e.note)==null?void 0:S.author)||e.author||t.unref(b)(e.locale,"noteUnnamed")),1),t.createElementVNode("button",{type:"button",class:"note-overlay__icon",title:t.unref(b)(e.locale,"findClose"),onClick:w[0]||(w[0]=q=>n("close"))}," × ",8,C1)]),t.createElementVNode("div",w1,t.toDisplayString((($=e.note)==null?void 0:$.text)||t.unref(b)(e.locale,"noteEmpty")),1)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",v1,[t.createElementVNode("span",k1,t.toDisplayString(e.author||t.unref(b)(e.locale,"noteUnnamed")),1)]),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":w[1]||(w[1]=q=>i.value=q),class:"note-overlay__editor",placeholder:e.placeholder,rows:"3",onKeydown:p,onBlur:B},null,40,E1),[[t.vModelText,i.value]]),t.createElementVNode("div",R1,[t.createElementVNode("button",{type:"button",class:"note-overlay__btn note-overlay__btn--ghost",onClick:w[2]||(w[2]=q=>n("close"))},t.toDisplayString(t.unref(b)(e.locale,"cancel")),1),t.createElementVNode("button",{type:"button",class:"note-overlay__btn note-overlay__btn--primary",onClick:B},t.toDisplayString(t.unref(b)(e.locale,"noteSave")),1)])],64))],38)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-2d4ad04f"]]);function Nn(e,o){return`${e},${o}`}function Ia(e,o){if(e.startsWith("="))return{kind:"formula",formula:e};const l=Zl(e,o);if(l)return{kind:"date",serial:l.serial};const n=/^(.*?)(\d+)$/.exec(e);if(n){const a=n[1],i=n[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return $l(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function yr(e,o){for(let l=2;l<e.length;l++)if(e[l]-e[l-1]!==o)return!1;return!0}function Aa(e){const o=e.length;if(o===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],n=o>=2?e[1].serial-l.serial:1;return{kind:"date-linear",baseSerial:l.serial,step:n,sourceLen:o}}if(e.every(l=>l.kind==="number")){if(o===1)return{kind:"copy",sourceValues:[...e]};const l=e.map(a=>a.num),n=l[1]-l[0];return yr(l,n)?{kind:"linear",step:n,base:l[0],sourceLen:o}:{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(o===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(yr(a,i))return{kind:"text-number",prefix:l.prefix,step:i,base:l.num,digits:l.digits,sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}if(e.every(l=>l.kind==="text")){const l=e.every(n=>n.text.length===1&&/[a-zA-Z]/.test(n.text));if(o>=2&&l){const n=e.map(i=>i.text.charCodeAt(0)),a=n[1]-n[0];if(a!==0&&yr(n,a))return{kind:"text-series",step:a,baseCharCode:n[0],sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function La(e,o,l){switch(e.kind){case"copy":{const n=e.sourceValues.length;return n===0?{kind:"text",text:""}:e.sourceValues[o%n]}case"linear":return{kind:"number",num:e.base+e.step*(l+o)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(l+o),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(l+o)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(l+o))};case"formula":return{kind:"formula",formula:""}}}function za(e,o){switch(e.kind){case"copy":{const l=e.sourceValues.length;return l===0?{kind:"text",text:""}:e.sourceValues[l-1-o%l]}case"linear":return{kind:"number",num:e.base-e.step*(o+1)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base-e.step*(o+1),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial-e.step*(o+1)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode-e.step*(o+1))};case"formula":return{kind:"formula",formula:""}}}function Io(e,o){switch(e.kind){case"formula":return{value:e.formula,styleId:o};case"number":return{value:String(e.num),styleId:o};case"text":return{value:e.text,styleId:o};case"text-number":return{value:e.prefix+String(e.num).padStart(e.digits,"0"),styleId:o};case"date":return{value:String(e.serial),styleId:o}}}function $a(e,o){const l=o.row<e.startRow?e.startRow-o.row:o.row>e.endRow?o.row-e.endRow:0,n=o.col<e.startCol?e.startCol-o.col:o.col>e.endCol?o.col-e.endCol:0;if(l===0&&n===0)return null;const a=l>=n?o.row<e.startRow?"up":"down":o.col<e.startCol?"left":"right";let i;switch(a){case"down":i={startCol:e.startCol,startRow:e.endRow+1,endCol:e.endCol,endRow:o.row};break;case"up":i={startCol:e.startCol,startRow:o.row,endCol:e.endCol,endRow:e.startRow-1};break;case"right":i={startCol:e.endCol+1,startRow:e.startRow,endCol:o.col,endRow:e.endRow};break;case"left":i={startCol:o.col,startRow:e.startRow,endCol:e.startCol-1,endRow:e.endRow};break}return{targetRange:i,direction:a}}function _a(e,o,l,n,a,i){return Vo(e,l.col-o.col,l.row-o.row,n,a,i)}function Ha(e,o){return!(e.endCol<o.startCol||e.startCol>o.endCol||e.endRow<o.startRow||e.startRow>o.endRow)}function Wa(e,o){return o.startCol>=e.startCol&&o.endCol<=e.endCol&&o.startRow>=e.startRow&&o.endRow<=e.endRow}function Cr(e,o,l){const n=Object.keys(l);for(const s of n){const d=l[s];if(Ha(e,d)&&!Wa(e,d))return{ok:!1,reason:"source-overlap"}}const a=[];for(const s of n){const d=l[s];Wa(e,d)||Ha(o,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 s of a)if(s.endRow-s.startRow!==i||s.endCol-s.startCol!==r)return{ok:!1,reason:"target-merge-size"};return{ok:!0,reason:"ok"}}function Ua(e,o,l,n){const a=o.length;if(a!==0){if(e.kind==="copy"){const i=n?a-1-l%a:l%a;return o[i]}return n?o[0]:o[a-1]}}function Pa(e,o,l,n,a,i,r,s){const d={cells:{},merges:{}},m=n==="up"||n==="down",p=n==="up"||n==="left";if(m){const B=e.endRow-e.startRow+1;for(let f=e.startCol;f<=e.endCol;f++){const I=[],w=[];for(let q=e.startRow;q<=e.endRow;q++){const ae=l.cells[Nn(f,q)];I.push(ae?Ia(ae.value,a):{kind:"text",text:""}),w.push(ae==null?void 0:ae.styleId)}const S=Aa(I),$=I.length;for(let q=o.startRow;q<=o.endRow;q++){const ae=p?o.endRow-q:q-o.startRow;if(S.kind==="formula"){const fe=p?e.endRow-((o.endRow-q)%B+B)%B:e.startRow+((q-e.startRow)%B+B)%B,Ce=l.cells[Nn(f,fe)],Se=Ce?Ce.value:"",be=_a(Se,{col:f,row:fe},{col:f,row:q},i,r,s);d.cells[Nn(f,q)]=Io({kind:"formula",formula:be},Ce==null?void 0:Ce.styleId)}else{const fe=p?za(S,ae):La(S,ae,$),Ce=Ua(S,w,ae,p);d.cells[Nn(f,q)]=Io(fe,Ce)}}}}else{const B=e.endCol-e.startCol+1;for(let f=e.startRow;f<=e.endRow;f++){const I=[],w=[];for(let q=e.startCol;q<=e.endCol;q++){const ae=l.cells[Nn(q,f)];I.push(ae?Ia(ae.value,a):{kind:"text",text:""}),w.push(ae==null?void 0:ae.styleId)}const S=Aa(I),$=I.length;for(let q=o.startCol;q<=o.endCol;q++){const ae=p?o.endCol-q:q-o.startCol;if(S.kind==="formula"){const fe=p?e.endCol-((o.endCol-q)%B+B)%B:e.startCol+((q-e.startCol)%B+B)%B,Ce=l.cells[Nn(fe,f)],Se=Ce?Ce.value:"",be=_a(Se,{col:fe,row:f},{col:q,row:f},i,r,s);d.cells[Nn(q,f)]=Io({kind:"formula",formula:be},Ce==null?void 0:Ce.styleId)}else{const fe=p?za(S,ae):La(S,ae,$),Ce=Ua(S,w,ae,p);d.cells[Nn(q,f)]=Io(fe,Ce)}}}}return d}function Ao(e,o){delete e[o]}function S1(){return`note-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Ka(e){return e?{...e}:{}}function Gn(e,o){return`${e},${o}`}function Ga(e,o,l){const n=l[Gn(o,e)];return!!(n&&n.noteId)}function N1(e,o,l,n){const a=l[Gn(o,e)];if(!(!a||!a.noteId))return n[a.noteId]}function B1(e,o){const l=Date.now();return{id:S1(),text:e,author:o,createdAt:l,updatedAt:l}}function x1(e,o,l,n,a,i){const r=Gn(o,e),s=a[r]||(a[r]={value:""});s.noteId&&i[s.noteId]&&Ao(i,s.noteId);const d=B1(l,n);return i[d.id]=d,s.noteId=d.id,d}function T1(e,o,l){const n=l[e];if(!n)throw new Error(`Note ${e} not found`);return n.text=o,n.updatedAt=Date.now(),n}function V1(e,o,l,n){const a=Gn(o,e),i=l[a];if(!i||!i.noteId)return;const r=n[i.noteId];return Ao(n,i.noteId),i.noteId=void 0,Object.keys(i).length===1&&"value"in i&&i.value===""&&Ao(l,a),r}function D1(e,o,l){const n=new Map;for(let a=e.startRow;a<=e.endRow;a++)for(let i=e.startCol;i<=e.endCol;i++){const r=o[Gn(i,a)];r&&r.noteId&&l[r.noteId]&&n.set(Gn(i,a),l[r.noteId])}return n}function Lo(e,o){const l=new Set;for(const n in e){const a=e[n];a!=null&&a.noteId&&l.add(a.noteId)}for(const n in o)l.has(n)||Ao(o,n)}function F1(e){let o=1/0,l=1/0;for(const n of e.ranges)n.startCol<o&&(o=n.startCol),n.startRow<l&&(l=n.startRow);return isFinite(o)||(o=0),isFinite(l)||(l=0),{col:o,row:l}}function O1(e,o,l){for(const n of e)if(o>=n.startCol&&o<=n.endCol&&l>=n.startRow&&l<=n.endRow)return!0;return!1}function _l(e){if(e==null)return null;const o=String(e).trim();if(o==="")return null;const l=o.replace(/[, ]/g,"");if(l==="")return null;const n=Number(l);return Number.isFinite(n)?n:null}function I1(e,o){const l=new Map;for(const n of e.ranges)for(let a=n.startRow;a<=n.endRow;a++)for(let i=n.startCol;i<=n.endCol;i++){const r=o.getCellValue(i,a);r!==""&&l.set(r,(l.get(r)??0)+1)}return l}class A1{constructor(){this.map=new Map}get(o){return this.map.get(o)}set(o,l){this.map.set(o,l)}invalidate(o){o?this.map.delete(o):this.map.clear()}}function L1(e,o,l,n,a,i){switch(e.type){case"cellIs":{const r=n.getCellValue(o,l),s=_l(r);switch(e.operator){case"equal":{const d=_l(e.value);return s!==null&&d!==null?s===d:r===e.value}case"notEqual":{const d=_l(e.value);return s!==null&&d!==null?s!==d:r!==e.value}case"greaterThan":{const d=_l(e.value);return s===null||d===null?!1:s>d}case"greaterThanOrEqual":{const d=_l(e.value);return s===null||d===null?!1:s>=d}case"lessThan":{const d=_l(e.value);return s===null||d===null?!1:s<d}case"lessThanOrEqual":{const d=_l(e.value);return s===null||d===null?!1:s<=d}case"between":{const d=_l(e.value),m=_l(e.value2??"");return s===null||d===null||m===null?!1:s>=Math.min(d,m)&&s<=Math.max(d,m)}case"notBetween":{const d=_l(e.value),m=_l(e.value2??"");return s===null||d===null||m===null?!1:s<Math.min(d,m)||s>Math.max(d,m)}}return!1}case"textContains":return n.getCellValue(o,l).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!n.getCellValue(o,l).toLowerCase().includes(e.value.toLowerCase());case"blank":return n.getCellValue(o,l)==="";case"notBlank":return n.getCellValue(o,l)!=="";case"duplicate":{if(!i)return!1;const r=n.getCellValue(o,l);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=n.getCellValue(o,l);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=o-a.col,s=l-a.row,d=e.formula.trim().replace(/^=/,""),m=z1(d,r,s,n.colCount,n.rowCount);return Va(m,n.cells,n.colCount,n.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function z1(e,o,l,n,a){return Vo(e,o,l,n,a,Et)}function $1(e,o,l,n,a){if(!l||l.length===0)return null;const i=l.filter(d=>d.enabled&&O1(d.ranges,e,o)).sort((d,m)=>d.priority-m.priority);if(i.length===0)return null;const r={};let s=!1;for(const d of i){const m=F1(d);let p;(d.condition.type==="duplicate"||d.condition.type==="unique")&&(p=a==null?void 0:a.get(d.id),p||(p=I1(d,n),a==null||a.set(d.id,p)));let B=!1;try{B=L1(d.condition,e,o,n,m,p)}catch{}if(!B)continue;s=!0;const f=d.format;if(f.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=f.backgroundColor),f.color!==void 0&&r.color===void 0&&(r.color=f.color),f.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=f.fontWeight),f.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=f.fontStyle),f.underline!==void 0&&r.underline===void 0&&(r.underline=f.underline),f.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=f.strikethrough),d.stopIfTrue)break}return s?r:null}function _1(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function qa(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function H1(e,o,l){for(const n of e)if(o>=n.startCol&&o<=n.endCol&&l>=n.startRow&&l<=n.endRow)return!0;return!1}function W1(e){let o=1/0,l=1/0;for(const n of e.ranges)n.startCol<o&&(o=n.startCol),n.startRow<l&&(l=n.startRow);return isFinite(o)||(o=0),isFinite(l)||(l=0),{col:o,row:l}}function U1(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function P1(e){return e?Array.from(e).length:0}const Ya=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function ao(e,o){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=wr(l.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?a:a===null?null:Number(a)}const n=So(l,o.locale);if(n&&Number.isFinite(n.num))return n.num;if(Ya.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}return null}function wr(e,o){try{return Sn(),Ta(e,o.cells,o.colCount,o.rowCount)}catch{return null}}function vr(e,o){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=wr(l.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?vr(a,o):null}if($l(l)||Ya.test(l)){const a=Number(l);return Number.isFinite(a)?a:null}const n=Zl(l,o.locale);return n&&n.format!=="h:mm:ss"?n.serial:null}function kr(e,o){if(e==null)return null;const l=String(e).trim();if(l==="")return null;if(l.startsWith("=")){const a=wr(l.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?Er(a):typeof a=="string"?kr(a,o):null}const n=Zl(l,o.locale);return n?n.format==="h:mm:ss"?n.serial:Er(n.serial):$l(l)?Er(Number(l)):null}function Er(e){return Number.isFinite(e)?Math.abs(e)%1:0}function K1(e,o,l,n){switch(e){case"between":return l===null||n===null?!1:o>=Math.min(l,n)&&o<=Math.max(l,n);case"notBetween":return l===null||n===null?!1:o<Math.min(l,n)||o>Math.max(l,n);case"equal":return l!==null&&o===l;case"notEqual":return l!==null&&o!==l;case"greaterThan":return l!==null&&o>l;case"greaterThanOrEqual":return l!==null&&o>=l;case"lessThan":return l!==null&&o<l;case"lessThanOrEqual":return l!==null&&o<=l;default:return!1}}function Rr(e){return String(e??"").trim().toLowerCase()}function ja(e,o){var p;const l=e.listSource??(e.values?{type:"values",values:e.values}:void 0);if(!l)return[];const n=[],a=new Set,i=B=>{const f=Rr(B);if(!f){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),n.push("");return}a.has(f)||(a.add(f),n.push(B))};if(l.type==="values"){for(const B of l.values??[])i(B);return n}const{range:r,sheetId:s}=l,d=s?((p=o.getSheetCells)==null?void 0:p.call(o,s))??null:null,m=d??o.cells;for(let B=r.startRow;B<=r.endRow;B++)for(let f=r.startCol;f<=r.endCol;f++){const I=`${f},${B}`,w=m[I];if(w)if(d){const S=w.value;i(S.startsWith("=")?G1(S,d,o):S)}else i(o.getCellValue(f,B))}return n}function G1(e,o,l){try{Sn();const n=Ta(e.slice(1),o,l.colCount,l.rowCount);return n===null?"":String(n)}catch{return""}}function q1(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function Y1(e,o,l){const n={value:l};return new Proxy(e,{get(a,i){return i===o?n:a[i]},has(a,i){return i===o?!0:i in a}})}function j1(e,o,l,n,a){if(e.enabled===!1)return!0;const i=o==null?"":String(o);if(U1(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=ja(e,a),s=Rr(i);return r.some(d=>Rr(d)===s)}case"wholeNumber":{const r=ao(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:io(e,r,a,ao)}case"decimal":{const r=ao(i,a);return r===null||!Number.isFinite(r)?!1:io(e,r,a,ao)}case"date":{const r=vr(i,a);return r===null?!1:io(e,r,a,vr)}case"time":{const r=kr(i,a);return r===null?!1:io(e,r,a,kr)}case"textLength":{const r=P1(i);return io(e,r,a,ao)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?X1(r,o,l,n,e,a):!0}default:return!0}}catch{return!1}}function io(e,o,l,n){const a=e.operator;if(!a)return!0;const i=e.formula1!==void 0&&e.formula1!==""?n(e.formula1,l):null,r=e.formula2!==void 0&&e.formula2!==""?n(e.formula2,l):null;return K1(a,o,i,r)}function X1(e,o,l,n,a,i){try{const r=W1(a),s=Vo(e,l-r.col,n-r.row,i.colCount,i.rowCount,Et),d=Y1(i.cells,`${l},${n}`,o==null?"":String(o));return Sn(),Va(s,d,i.colCount,i.rowCount)}catch{return!1}}const Z1={stop:3,warning:2,information:1};function Mr(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function Xa(e,o,l,n,a){if(!n||n.length===0)return{valid:!0};let i=null,r=0;for(const p of n){if(p.enabled===!1||!H1(p.ranges,o,l))continue;let B;try{B=j1(p,e,o,l,a)}catch{B=!1}if(B)continue;const f=Z1[Mr(p)];f>r&&(r=f,i=p)}if(!i)return{valid:!0};const s=Mr(i),d=i.showErrorMessage!==!1,m=J1(i,a.locale);return{valid:!1,rule:i,severity:s,title:d&&i.errorTitle?i.errorTitle:m.title,message:d&&i.errorMessage?i.errorMessage:m.message}}function J1(e,o){var a;const l=b(o,"dvErrorTitleDefault"),n=e.operator?b(o,`dv${Q1(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(o,r?"dvMsgList":"dvMsgListEmpty").replace("{values}",r)}}case"wholeNumber":return{title:l,message:so(o,b(o,"dvTypeWholeNumber"),n,e)};case"decimal":return{title:l,message:so(o,b(o,"dvTypeDecimal"),n,e)};case"date":return{title:l,message:so(o,b(o,"dvTypeDate"),n,e)};case"time":return{title:l,message:so(o,b(o,"dvTypeTime"),n,e)};case"textLength":return{title:l,message:so(o,b(o,"dvTypeTextLength"),n,e)};case"custom":return{title:l,message:b(o,"dvMsgCustom").replace("{formula}",e.formula1??"")};default:return{title:l,message:b(o,"dvMsgInvalid")}}}function Q1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function so(e,o,l,n){return l?n.operator==="between"||n.operator==="notBetween"?b(e,n.operator==="between"?"dvMsgBetween":"dvMsgNotBetween").replace("{type}",o).replace("{min}",n.formula1??"").replace("{max}",n.formula2??""):b(e,"dvMsgCompare").replace("{type}",o).replace("{op}",l).replace("{value}",n.formula1??""):b(e,"dvMsgInvalid")}const zo=64;class ep{constructor(o=[]){this.bands=new Map,this.dirty=!0,this.source=[],this.source=o}invalidate(){this.dirty=!0}ensure(o){if(o&&o!==this.source&&(this.source=o,this.dirty=!0),!!this.dirty){this.bands.clear();for(const l of this.source)if(!(!l||l.enabled===!1))for(const n of l.ranges??[]){const a=Math.floor(n.startRow/zo),i=Math.floor(n.endRow/zo);for(let r=a;r<=i;r++){let s=this.bands.get(r);s||(s=[],this.bands.set(r,s)),s.push({rule:l,range:n})}}this.dirty=!1}}getRules(o,l,n){this.ensure(n);const a=this.bands.get(Math.floor(l/zo));if(!a||a.length===0)return[];const i=[];for(const r of a)o<r.range.startCol||o>r.range.endCol||l<r.range.startRow||l>r.range.endRow||i.includes(r.rule)||i.push(r.rule);return i}has(o,l,n){const a=this.bandsOf(o,l,n);for(const i of a)if(!(o<i.range.startCol||o>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow))return!0;return!1}findRule(o,l,n,a){for(const i of this.bandsOf(o,l,a))if(!(o<i.range.startCol||o>i.range.endCol)&&!(l<i.range.startRow||l>i.range.endRow)&&n(i.rule))return i.rule;return null}bandsOf(o,l,n){return this.ensure(n),this.bands.get(Math.floor(l/zo))??tp}}const tp=[];function lp(e,o,l,n){if(o==="row"){const d=e.startRow,m=e.endRow;let p,B;if(m<l)p=d,B=m;else if(d>l+n-1)p=d-n,B=m-n;else if(p=d<l?d:l,B=m>l+n-1?m-n:l-1,B<p)return null;return{...e,startRow:p,endRow:B}}const a=e.startCol,i=e.endCol;let r,s;if(i<l)r=a,s=i;else if(a>l+n-1)r=a-n,s=i-n;else if(r=a<l?a:l,s=i>l+n-1?i-n:l-1,s<r)return null;return{...e,startCol:r,endCol:s}}function np(e,o,l,n){if(o==="row"){const r=e.startRow,s=e.endRow;return r>=l?{...e,startRow:r+n,endRow:s+n}:s<l?e:{...e,endRow:s+n}}const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+n,endCol:i+n}:i<l?e:{...e,endCol:i+n}}function Za(e,o){return!(e.endCol<o.startCol||e.startCol>o.endCol||e.endRow<o.startRow||e.startRow>o.endRow)}function Ja(e,o){if(!Za(e,o))return[{...e}];const l=[];e.startRow<o.startRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:e.startRow,endRow:o.startRow-1}),e.endRow>o.endRow&&l.push({startCol:e.startCol,endCol:e.endCol,startRow:o.endRow+1,endRow:e.endRow});const n=Math.max(e.startRow,o.startRow),a=Math.min(e.endRow,o.endRow);return n<=a&&(e.startCol<o.startCol&&l.push({startCol:e.startCol,endCol:o.startCol-1,startRow:n,endRow:a}),e.endCol>o.endCol&&l.push({startCol:o.endCol+1,endCol:e.endCol,startRow:n,endRow:a})),l}function op(e,o,l){return{startCol:e.startCol+o,endCol:e.endCol+o,startRow:e.startRow+l,endRow:e.endRow+l}}function Qa(e,o){return Za(e,o)?{startCol:Math.max(e.startCol,o.startCol),endCol:Math.min(e.endCol,o.endCol),startRow:Math.max(e.startRow,o.startRow),endRow:Math.min(e.endRow,o.endRow)}:null}const rp=1;function ap(e,o,l){let n=0;for(let a=0;a<e.length;a++){const i=e[a];i.start<=o&&l<=i.end&&n++}return n}function ip(e,o,l,n){return e<=l&&n<=o||l<=e&&o<=n||o<l||n<e}function Sr(e,o,l){if(!Number.isInteger(o)||!Number.isInteger(l)||o<0||l<o)return{ok:!1,code:"outlineInvalid"};if(l-o+1<2)return{ok:!1,code:"outlineMinSize"};for(let a=0;a<e.length;a++){const i=e[a];if(!ip(o,l,i.start,i.end))return{ok:!1,code:"outlineCrossing"}}const n=ap(e,o,l)+1;return n>rp?{ok:!1,code:"outlineTooDeep"}:{ok:!0,level:n}}function ei(e,o,l,n,a,i){const r=Sr(e,l,n);return!r.ok||r.level===void 0?{outlines:e,validation:r}:{outlines:e.concat({id:a,axis:o,start:l,end:n,level:r.level,collapsed:!1}),validation:r}}function ti(e,o,l){let n=!1;const a=e.map(i=>i.id===o&&i.collapsed!==l?(n=!0,{...i,collapsed:l}):i);return n?a:e}function li(e,o){return e.filter(l=>l.id!==o)}function $o(){return[]}function ni(e,o,l){return e.map(n=>n.start>=o?{...n,start:n.start+l,end:n.end+l}:n.end<o?n:{...n,end:n.end+l})}function oi(e,o,l){const n=[];for(const a of e){const i=a.start,r=a.end;let s,d;if(r<o)s=i,d=r;else if(i>o+l-1)s=i-l,d=r-l;else if(s=i<o?i:o,d=r>o+l-1?r-l:o-1,d<s)continue;n.push({...a,start:s,end:d})}return n}function Ql(e){return e.map(o=>{let l=0;for(let n=0;n<e.length;n++){const a=e[n];a!==o&&a.start<=o.start&&o.end<=a.end&&l++}return{...o,level:l+1}})}function ri(e,o){let l=0;for(let n=0;n<e.length;n++){const a=e[n];a.start<=o&&o<=a.end&&l++}return l}function ai(e,o){const l=o==="row"?"row-outline":"col-outline",n=new Set(e.map(i=>i.id));let a=1;for(;n.has(`${l}-${a}`);)a++;return`${l}-${a}`}class sp{constructor(o){if(o&&o.length>0){this.styles=o,this.index=new Map;for(let l=0;l<this.styles.length;l++){const n=this.stableKey(this.styles[l]);this.index.set(n,l)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const l=Object.keys(o).sort(),n={};for(const a of l)n[a]=o[a];return JSON.stringify(n)}get(o){const l=this.styles[o];return l?o===0?l:Object.freeze(l):{}}getId(o){if(!o||Object.keys(o).length===0)return 0;const l=this.stableKey(o),n=this.index.get(l);if(n!==void 0)return n;const a=this.styles.length,i=Object.freeze({...o});return this.styles.push(i),this.index.set(l,a),a}getStyles(){return[...this.styles]}setStyles(o){this.styles=o,this.index=new Map;for(let l=0;l<this.styles.length;l++){const n=this.stableKey(this.styles[l]);this.index.set(n,l)}}compactStyles(o){const l=new Set;l.add(0);for(const r in o){const s=o[r].styleId??0;l.add(s)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(l).sort((r,s)=>r-s);for(const r of i)if(r!==0&&r<this.styles.length){const s=a.length;n.set(r,s),a.push(this.styles[r])}for(const r in o){const s=o[r],d=s.styleId??0,m=n.get(d);m!==void 0&&m!==d&&(s.styleId=m)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const s=this.stableKey(this.styles[r]);this.index.set(s,r)}return a}}function cp(e,o){if(!e)return null;const l=e.styleId;return l===void 0||l===0?null:o[l]??null}function ii(e){const o=new sp,l={};for(const[n,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=o.getId(a.style)),i.styleId===0&&delete i.styleId;const r=a.noteId;typeof r=="string"&&r&&(i.noteId=r),l[n]=i}return{cells:l,styles:o.getStyles()}}function dp(e){const o={};for(const[l,n]of Object.entries(e)){const a={value:n.value};n.styleId!==void 0&&n.styleId>0&&(a.styleId=n.styleId),n.noteId&&(a.noteId=n.noteId),o[l]=a}return o}class up{constructor(o){if(o&&o.length>0){this.borders=o,this.index=new Map;for(let l=0;l<this.borders.length;l++){const n=this.stableKey(this.borders[l]);this.index.set(n,l)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const l=["top","right","bottom","left"],n={};for(const a of l){const i=o[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0||i.owner!==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),i.owner!==void 0&&(r.owner=i.owner),n[a]=r}}return JSON.stringify(n)}get(o){const l=this.borders[o];return l?o===0?l:Object.freeze(l):{}}getId(o){if(!o||this.isEmptyBorder(o))return 0;const l=this.stableKey(o),n=this.index.get(l);if(n!==void 0)return n;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(o));return this.borders.push(i),this.index.set(l,a),a}isEmptyBorder(o){return!o.top&&!o.right&&!o.bottom&&!o.left}deepCloneBorder(o){const l={};return o.top&&(l.top={...o.top}),o.right&&(l.right={...o.right}),o.bottom&&(l.bottom={...o.bottom}),o.left&&(l.left={...o.left}),l}getBorders(){return[...this.borders]}setBorders(o){this.borders=o,this.index=new Map;for(let l=0;l<this.borders.length;l++){const n=this.stableKey(this.borders[l]);this.index.set(n,l)}}compactBorders(o){const l=new Set;l.add(0);for(const r of o){const s=r.borderId??0;l.add(s)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(l).sort((r,s)=>r-s);for(const r of i)if(r!==0&&r<this.borders.length){const s=a.length;n.set(r,s),a.push(this.borders[r])}for(const r of o){const s=r.borderId??0,d=n.get(s);d!==void 0&&d!==s&&(r.borderId=d)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const s=this.stableKey(this.borders[r]);this.index.set(s,r)}return a}}function fp(e,o,l,n){if(!e)return;const a=e.styleId??0,i=l[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const s=n.get(r);if(s)return s[o]}function mp(e,o,l,n,a,i){const r=n[e.styleId??0]??{},s=r.borderId??0,d=s>0?a.get(s):{},m={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?m[o]={...l}:m[o]=void 0;const p=a.getId(m),B={...r};p===0?delete B.borderId:B.borderId=p,delete B.borderTopWidth,delete B.borderBottomWidth,delete B.borderLeftWidth,delete B.borderRightWidth,delete B.borderColor,Object.keys(B).length===0?e.styleId=0:e.styleId=i(B)}function si(e){const o=new up,l=[];for(const n of e){if(!(n.borderTopWidth!==void 0||n.borderBottomWidth!==void 0||n.borderLeftWidth!==void 0||n.borderRightWidth!==void 0)){l.push(n);continue}const i=typeof n.borderColor=="string"?n.borderColor:void 0,r={};n.borderTopWidth!==void 0&&n.borderTopWidth>0&&(r.top={width:n.borderTopWidth,color:i}),n.borderBottomWidth!==void 0&&n.borderBottomWidth>0&&(r.bottom={width:n.borderBottomWidth,color:i}),n.borderLeftWidth!==void 0&&n.borderLeftWidth>0&&(r.left={width:n.borderLeftWidth,color:i}),n.borderRightWidth!==void 0&&n.borderRightWidth>0&&(r.right={width:n.borderRightWidth,color:i});const s=o.getId(r),d={...n};delete d.borderTopWidth,delete d.borderBottomWidth,delete d.borderLeftWidth,delete d.borderRightWidth,delete d.borderColor,s>0?d.borderId=s:delete d.borderId,l.push(d)}return{styles:l,borders:o.getBorders()}}function pp(e,o){const a=t.reactive({rowCount:Math.max(200,e.rowCount??o.rowCount),colCount:Math.max(26,e.colCount??o.colCount),width:e.width,height:e.height,theme:e.theme??o.theme,locale:e.locale??o.locale,editable:e.editable??!0}),i=t.ref(e.editable??!0);t.watchEffect(()=>{a.rowCount=Math.max(200,e.rowCount??o.rowCount),a.colCount=Math.max(26,e.colCount??o.colCount),a.width=e.width,a.height=e.height,a.theme=e.theme??o.theme,a.locale=e.locale??o.locale});const r=t.computed(()=>a.locale==="zh-CN"?"zh-CN":"en-US"),s=a.colCount,d=a.rowCount,m=t.reactive({colCount:s,rowCount:d}),p=8,B=32,f=t.reactive({}),I=t.reactive([{}]),w=t.reactive([{}]);let S=new Map;S.set("{}",0);let $=new Map;$.set("{}",0);const q=t.reactive([]),ae=new A1,fe=t.reactive({}),Ce=t.reactive([]),Se=new ep(Ce),be=new Map;let Ge=0;function pe(c){const h=Object.keys(c).sort(),C={};for(const V of h)C[V]=c[V];return JSON.stringify(C)}function ie(c){const h=["top","right","bottom","left"],C={};for(const V of h){const z=c[V];if(z&&(z.width!==void 0||z.color!==void 0||z.style!==void 0)){const re={};z.width!==void 0&&(re.width=z.width),z.color!==void 0&&(re.color=z.color),z.style!==void 0&&(re.style=z.style),C[V]=re}}return JSON.stringify(C)}function Ne(c){if(!c||Object.keys(c).length===0)return 0;const h=pe(c),C=S.get(h);if(C!==void 0)return C;const V=I.length;return I.push(Object.freeze({...c})),S.set(h,V),V}function ft(c){return cp(c,I)}function mt(){S=new Map;for(let c=0;c<I.length;c++)S.set(pe(I[c]),c)}function v(c){I.splice(0,I.length,...c),mt()}function A(c){if(!c||!c.top&&!c.right&&!c.bottom&&!c.left)return 0;const h=ie(c),C=$.get(h);if(C!==void 0)return C;const V=w.length;return w.push(Object.freeze({top:c.top?Object.freeze({...c.top}):void 0,right:c.right?Object.freeze({...c.right}):void 0,bottom:c.bottom?Object.freeze({...c.bottom}):void 0,left:c.left?Object.freeze({...c.left}):void 0})),$.set(h,V),V}function X(c){return w[c]??{}}function ze(){$=new Map;for(let c=0;c<w.length;c++)$.set(ie(w[c]),c)}function Je(c){w.splice(0,w.length,...c),ze()}function oe(c,h){return fp(c,h,I,{get:C=>w[C]??{}})}function we(c,h){const C=wt(c,h);return C?C.anchor:null}function Be(c,h,C,V){const z=wt(c,h),re=wt(C,V);return!z||!re?!1:z.anchor===re.anchor}const rt=t.reactive({}),se=new tf,ue=t.ref(null),Le=t.ref("cell"),_e=t.ref({col:0,row:0}),dt=t.ref(null),ht=t.ref(""),T=t.ref(new Array(m.colCount).fill(100)),ne=t.ref(new Array(m.rowCount).fill(void 0)),W=t.ref(0),F=t.ref(0),_=t.reactive({rows:0,cols:0}),L=t.ref(null),x=t.ref([]),U=t.ref([]),te=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),ye=new Map;let tt=null;function it(c,h,C,V){const z=`${V} ${C} ${h}px ${c}`,re=ye.get(z);if(re)return re;if(!tt){if(typeof document>"u")return{ascent:h*.88,descent:h*.28};tt=document.createElement("canvas")}const me=tt.getContext("2d");if(!me)return{ascent:h*.88,descent:h*.28};me.font=z;const Ee=me.measureText(" "),De=Ee.fontBoundingBoxAscent,Xe=Ee.fontBoundingBoxDescent;if(typeof De=="number"&&typeof Xe=="number"&&De>0&&Xe>0){const il={ascent:De,descent:Xe};return ye.set(z,il),il}const Ye=["M","中","y","Ä","0"];let Qe=0,lt=0;for(const il of Ye){const ul=me.measureText(il),Il=ul.actualBoundingBoxAscent||0,el=ul.actualBoundingBoxDescent||0;Il>Qe&&(Qe=Il),el>lt&&(lt=el)}const kt=Math.max(Qe,h*.88),Vt=Math.max(lt,h*.28),ll={ascent:kt,descent:Vt};return ye.set(z,ll),ll}const qe=it(Tn,sn,"normal","normal"),yt=qe.ascent+qe.descent,He=3,k=Math.round(He*2+yt);let ee=(c,h)=>`${c},${h}`,wt=()=>null,At=()=>sn,Lt=t.computed(()=>[0]),Ot=()=>k,Rl=(c,h,C,V)=>({startCol:Math.min(c,C),startRow:Math.min(h,V),endCol:Math.max(c,C),endRow:Math.max(h,V)});function sl(c,h){const C=ft(f[ee(c,h)]),V=At(c,h),z=typeof(C==null?void 0:C.fontFamily)=="string"&&C.fontFamily?C.fontFamily:Tn,re=(C==null?void 0:C.fontWeight)==="bold"?"bold":"normal",me=(C==null?void 0:C.fontStyle)==="italic"?"italic":"normal";return it(z,V,re,me)}function Ml(c,h,C,V){if(!h)return[""];const z=h.split(`
|
|
2
|
+
`),re=[];for(const me of z)if(!V||C<=0)re.push(me);else{let Ee="";for(let De=0;De<me.length;De++){const Xe=me[De],Ye=Ee+Xe;c.measureText(Ye).width>C&&Ee?(re.push(Ee),Ee=Xe):Ee=Ye}re.push(Ee)}return re}function Sl(c,h){const C=ft(f[ee(c,h)]);return typeof(C==null?void 0:C.fontSize)=="number"&&C.fontSize>0?C.fontSize:sn}At=Sl;const Gt=t.computed(()=>{const c=[0];for(let h=0;h<m.colCount;h++)c.push(c[h]+g(h));return c});Lt=Gt;const cl={w:800,h:600};let ol=()=>{};const mn=t.computed(()=>{const c=new Set;for(const h in f){const C=h.indexOf(",");if(C<0)continue;const V=parseInt(h.substring(C+1),10),z=f[h];z&&(z.value!==""||z.styleId!==void 0)&&c.add(V)}for(let h=0;h<ne.value.length;h++)ne.value[h]!==void 0&&c.add(h);for(const h in rt){const C=h.indexOf(",");if(C<0)continue;const V=parseInt(h.substring(C+1),10);c.add(V)}return c});function P(c){if(We(c))return 0;const h=ne.value[c];if(h!=null&&h>0)return h;if(!mn.value.has(c))return k;let C,V,z=1;const re=tt?tt.getContext("2d"):null,me=it(Tn,sn,"normal","normal");C=me.ascent,V=me.descent;for(let Ye=0;Ye<m.colCount;Ye++){const Qe=Sl(Ye,c),lt=ft(f[ee(Ye,c)]),kt=typeof(lt==null?void 0:lt.fontFamily)=="string"&<.fontFamily?lt.fontFamily:Tn,Vt=(lt==null?void 0:lt.fontWeight)==="bold"?"bold":"normal",ll=(lt==null?void 0:lt.fontStyle)==="italic"?"italic":"normal",il=it(kt,Qe,Vt,ll);il.ascent>C&&(C=il.ascent),il.descent>V&&(V=il.descent);const ul=typeof(lt==null?void 0:lt.numberFormat)=="string"?lt.numberFormat:"",Il=Ft(Ye,c),el=zl(Il,ul,r.value);if(el){const Cn=(lt==null?void 0:lt.wrap)==="wrap";let nl;if(Cn&&re){re.font=`${ll} ${Vt} ${Qe}px ${kt}`;const Al=wt(Ye,c);let Dt;Al&&Ye===Al.range.startCol&&c===Al.range.startRow?Dt=Lt.value[Al.range.endCol+1]-Lt.value[Ye]:Dt=T.value[Ye],nl=Ml(re,el,Math.max(0,Dt-10),!0).length,nl>z&&(z=nl)}else nl=el.split(`
|
|
3
|
+
`).length,nl>z&&(z=nl)}}const Ee=C+V,De=He*2+z*Ee;return Math.min(500,Math.max(k,Math.round(De)))}Ot=P;function K(c){return ne.value[c]===void 0}const Z={getValue:(c,h)=>Ft(c,h),getFormat:(c,h)=>{var C;return(C=ft(f[ee(c,h)]))==null?void 0:C.numberFormat}},ve=t.computed(()=>{const c=new Set,h=L.value;if(!h)return c;const{range:C}=h;for(let V=C.startRow+1;V<=C.endRow;V++)Fe(V)||c.add(V);return c});function Fe(c){return hf(L.value,c,Z,r.value)}function Ve(){return ve.value}function We(c){return R(c)?!0:L.value?ve.value.has(c):!1}function Re(){let c=0;for(let h=0;h<m.rowCount;h++)We(h)||c++;return c}function Ue(c){let h=-1;for(let C=0;C<m.rowCount;C++)if(!We(C)&&(h++,h===c))return C;return-1}function ke(c){if(We(c))return-1;let h=0;for(let C=0;C<c;C++)We(C)||h++;return h}const st=t.computed(()=>{const c=new Set,h=x.value;for(let C=0;C<h.length;C++){const V=h[C];if(V.collapsed)for(let z=Math.max(0,V.start);z<=V.end&&z<m.rowCount;z++)c.add(z)}return c}),he=t.computed(()=>{const c=new Set,h=U.value;for(let C=0;C<h.length;C++){const V=h[C];if(V.collapsed)for(let z=Math.max(0,V.start);z<=V.end&&z<m.colCount;z++)c.add(z)}return c});function R(c){return st.value.has(c)}function Y(c){return he.value.has(c)}function de(c){return R(c)}function xe(c){return Y(c)}function Me(c){return!We(c)}function $e(c){return!Y(c)}function O(c){return Y(c)}function g(c){return O(c)?0:T.value[c]??100}function M(c){return ri(x.value,c)}function Mt(c){return ri(U.value,c)}function Nt(c){const h=c==="row"?x.value:U.value;let C=0;for(let V=0;V<h.length;V++){const z=h[V].level;z>C&&(C=z)}return C}function qt(c){return 0}const Ht=()=>qt(),rl=()=>qt();function Hl(){return x.value.map(c=>({...c}))}function pn(){return U.value.map(c=>({...c}))}function pl(c=!1){var h,C;c||(ol(W.value,F.value),(h=D.scheduleRender)==null||h.call(D),(C=D.emitModelData)==null||C.call(D))}function fo(c,h){var V;if(!i.value)return{ok:!1};const C=Sr(x.value,c,h);return!C.ok||C.level===void 0?C:((V=D.saveUndo)==null||V.call(D),x.value=Ql(ei(x.value,"row",c,h,ai(x.value,"row")).outlines),pl(),{ok:!0,level:C.level})}function Tr(c,h){var V;if(!i.value)return{ok:!1};const C=Sr(U.value,c,h);return!C.ok||C.level===void 0?C:((V=D.saveUndo)==null||V.call(D),U.value=Ql(ei(U.value,"column",c,h,ai(U.value,"column")).outlines),pl(),{ok:!0,level:C.level})}function Vr(c){var V;if(!i.value)return!1;const h=x.value.some(z=>z.id===c),C=!h&&U.value.some(z=>z.id===c);return!h&&!C?!1:((V=D.saveUndo)==null||V.call(D),h?x.value=Ql(li(x.value,c)):U.value=Ql(li(U.value,c)),pl(),!0)}function Dr(){var c;i.value&&x.value.length&&((c=D.saveUndo)==null||c.call(D),x.value=$o(),pl())}function Ho(){var c;i.value&&U.value.length&&((c=D.saveUndo)==null||c.call(D),U.value=$o(),pl())}function qn(){var c;i.value&&(!x.value.length&&!U.value.length||((c=D.saveUndo)==null||c.call(D),x.value=$o(),U.value=$o(),pl()))}function Wo(c,h,C=!1){var re;const V=ti(x.value,c,h),z=ti(U.value,c,h);V===x.value&&z===U.value||(C||(re=D.saveUndo)==null||re.call(D),x.value=V,U.value=z,pl(C))}function mo(c){const h=x.value.find(C=>C.id===c)??U.value.find(C=>C.id===c);h&&Wo(c,!h.collapsed)}function po(c,h){x.value.length&&(x.value=Ql(ni(x.value,c,h)),pl())}function ho(c,h){x.value.length&&(x.value=Ql(oi(x.value,c,h)),pl())}function go(c,h){U.value.length&&(U.value=Ql(ni(U.value,c,h)),pl())}function Fr(c,h){U.value.length&&(U.value=Ql(oi(U.value,c,h)),pl())}function Or(c,h){c&&(x.value=Ql([...c])),h&&(U.value=Ql([...h])),pl(!0)}function On(){return L.value}function In(c,h=!1){var C,V;!i.value&&!h||(L.value=c,!h&&(ol(W.value,F.value),(C=D.scheduleRender)==null||C.call(D),(V=D.emitModelData)==null||V.call(D)))}function An(c){var C,V;if(!i.value)return;const h={range:{startCol:Math.min(c.startCol,c.endCol),endCol:Math.max(c.startCol,c.endCol),startRow:Math.min(c.startRow,c.endRow),endRow:Math.max(c.startRow,c.endRow)},columns:{}};L.value=h,ol(W.value,F.value),(C=D.scheduleRender)==null||C.call(D),(V=D.emitModelData)==null||V.call(D)}function Yn(){var c,h;i.value&&L.value&&(L.value=null,ol(W.value,F.value),(c=D.scheduleRender)==null||c.call(D),(h=D.emitModelData)==null||h.call(D))}function jn(c){var V,z;if(!i.value||!L.value)return;const{[c]:h,...C}=L.value.columns;L.value={...L.value,columns:C},(V=D.scheduleRender)==null||V.call(D),(z=D.emitModelData)==null||z.call(D)}function bo(c,h){var C,V;if(i.value&&L.value){if(h)L.value={...L.value,columns:{...L.value.columns,[c]:h}};else{const{[c]:z,...re}=L.value.columns;L.value={...L.value,columns:re}}(C=D.scheduleRender)==null||C.call(D),(V=D.emitModelData)==null||V.call(D)}}function hn(c){const h=L.value;return h?gf(h,c,Z,r.value):{values:[],hasBlank:!1}}function Xn(c,h){const C=m.colCount,V=m.rowCount,z=(Qe,lt)=>{const kt=f[Qt(Qe,lt)];return!!kt&&(kt.value!==""||kt.styleId!==void 0)};if(!z(c,h))return null;const re=Qe=>{for(let lt=0;lt<C;lt++)if(z(lt,Qe))return!0;return!1},me=(Qe,lt,kt)=>{for(let Vt=lt;Vt<=kt;Vt++)if(z(Qe,Vt))return!0;return!1};let Ee=h;for(;Ee>0&&re(Ee-1);)Ee--;let De=h;for(;De<V-1&&re(De+1);)De++;let Xe=c;for(;Xe>0&&me(Xe-1,Ee,De);)Xe--;let Ye=c;for(;Ye<C-1&&me(Ye+1,Ee,De);)Ye++;return{startCol:Xe,startRow:Ee,endCol:Ye,endRow:De}}function Ln(){const c=ue.value;if(!!c&&c.startRow!==c.endRow)return{startCol:Math.min(c.startCol,c.endCol),endCol:Math.max(c.startCol,c.endCol),startRow:Math.min(c.startRow,c.endRow),endRow:Math.max(c.startRow,c.endRow)};const C=_e.value,V=c?c.startCol:C.col,z=c?c.startRow:C.row,re=(Xe,Ye)=>{const Qe=f[Qt(Xe,Ye)];return!!Qe&&(Qe.value!==""||Qe.styleId!==void 0)};let me,Ee;c?(me=Math.min(c.startCol,c.endCol),Ee=Math.max(c.startCol,c.endCol)):(me=C.col,Ee=C.col);let De=z;for(;De<m.rowCount-1;){const Xe=De+1;let Ye=!1,Qe=!1;for(let lt=me;lt<=Ee;lt++){re(lt,Xe)&&(Ye=!0);const kt=ln(lt,Xe);kt&&(kt.range.startCol!==kt.range.endCol||kt.range.startRow!==kt.range.endRow)&&(Qe=!0)}if(Qe||!Ye)break;De++}return!re(V,z)&&De===z?Uo():{startCol:me,endCol:Ee,startRow:z,endRow:De}}function Ir(){if(!i.value)return;if(L.value){Yn();return}const c=Ln();c&&An(c)}function Ar(c){const h=L.value;return h?c>=h.range.startCol&&c<=h.range.endCol:!1}function Zn(){return L.value?{...L.value.range}:null}function Jn(){return!!L.value}function Lr(c){const h=L.value;return h?Fa(h.columns[c]):!1}function Uo(){let c=1/0,h=1/0,C=-1,V=-1;for(const z in f){const re=z.indexOf(",");if(re<0)continue;const me=parseInt(z.substring(0,re),10),Ee=parseInt(z.substring(re+1),10),De=f[z];De&&(De.value!==""||De.styleId!==void 0)&&(me<c&&(c=me),Ee<h&&(h=Ee),me>C&&(C=me),Ee>V&&(V=Ee))}return C<0?null:{startCol:c,startRow:h,endCol:C,endRow:V}}const hl=t.computed(()=>{const c=[0];for(let h=0;h<m.rowCount;h++)c.push(c[h]+Ot(h));return c}),Nl=t.computed(()=>Gt.value[m.colCount]),Bl=t.computed(()=>hl.value[m.rowCount]);function Qt(c,h){return`${c},${h}`}ee=Qt;function gl(c){Reflect.deleteProperty(f,c)}function gn(c,h){Le.value="cell";const C=wt(c,h);C?(_e.value={col:C.range.startCol,row:C.range.startRow},ue.value={...C.range}):(_e.value={col:c,row:h},ue.value={startCol:c,startRow:h,endCol:c,endRow:h})}function en(c,h,C,V,z="cell"){const re=wt(c,h);if(_e.value=re?{col:re.range.startCol,row:re.range.startRow}:{col:c,row:h},Le.value=z,z==="row"||z==="col"){const me=Math.min(c,C),Ee=Math.max(c,C),De=Math.min(h,V),Xe=Math.max(h,V);ue.value={startCol:me,startRow:De,endCol:Ee,endRow:Xe}}else ue.value=Rl(c,h,C,V)}function tn(){en(0,0,m.colCount-1,m.rowCount-1,"all")}function Wl(c,h){const C=ue.value;return C?(Le.value==="cell"||Le.value==="all",c>=C.startCol&&c<=C.endCol&&h>=C.startRow&&h<=C.endRow):!1}function zn(c,h){return Wl(c,h)}function ln(c,h){for(const C in rt){const V=rt[C];if(V&&c>=V.startCol&&c<=V.endCol&&h>=V.startRow&&h<=V.endRow)return{range:V,anchor:C}}return null}wt=ln;function Qn(c,h){return rt[Qt(c,h)]!==void 0}function eo(c,h){const C=wt(c,h);if(C&&c===C.range.startCol&&h===C.range.startRow){const V=Gt.value[C.range.endCol+1]-Gt.value[c],z=hl.value[C.range.endRow+1]-hl.value[h];return{w:V,h:z}}return{w:g(c),h:Ot(h)}}function al(c,h,C,V){let z=Math.min(c,C),re=Math.max(c,C),me=Math.min(h,V),Ee=Math.max(h,V),De=!0;for(;De;){De=!1;for(const Xe in rt){const Ye=rt[Xe];if(!Ye)continue;Ye.startCol<=re&&Ye.endCol>=z&&Ye.startRow<=Ee&&Ye.endRow>=me&&(Ye.startCol<z&&(z=Ye.startCol,De=!0),Ye.endCol>re&&(re=Ye.endCol,De=!0),Ye.startRow<me&&(me=Ye.startRow,De=!0),Ye.endRow>Ee&&(Ee=Ye.endRow,De=!0))}}return{startCol:z,startRow:me,endCol:re,endRow:Ee}}Rl=al;function Ul(c,h){var C;return((C=f[Qt(c,h)])==null?void 0:C.value)??""}function Ft(c,h){return Sn(),xa(c,h,f,m.colCount,m.rowCount)}function zt(c,h,C){var De,Xe,Ye;if(!i.value)return;c>=0&&h>=0&&le(c,h);const V=Qt(c,h);Sn(),ae.invalidate(),Ce.length>0&&Zt();const z=(De=f[V])==null?void 0:De.noteId;if(C===""||C==null){se.clear(V);const Qe=(Xe=f[V])==null?void 0:Xe.styleId;Qe!==void 0&&Qe>0?f[V]={value:"",styleId:Qe}:gl(V),se.markDirty(V);return}const re=String(C);if(!re.startsWith("=")){const Qe=ft(f[V]),lt=typeof(Qe==null?void 0:Qe.numberFormat)=="string"?Qe.numberFormat:"";if(Fl(lt)){const kt=Zl(re,r.value);if(kt){const ll={...Qe??{},numberFormat:kt.format};f[V]={value:String(kt.serial),styleId:Ne(ll),noteId:z},se.clear(V),se.markDirty(V);return}const Vt=So(re,r.value);if(Vt){const ll={...Qe??{},numberFormat:Vt.format};f[V]={value:String(Vt.num),styleId:Ne(ll),noteId:z},se.clear(V),se.markDirty(V);return}}}const me=(Ye=f[V])==null?void 0:Ye.styleId,Ee={value:re};me!==void 0&&me>0&&(Ee.styleId=me),z&&(Ee.noteId=z),f[V]=Ee,re.startsWith("=")?se.set(V,To(re.slice(1),m.colCount,m.rowCount)):se.clear(V),se.markDirty(V)}function dl(c,h,C,V){if(i.value){for(let z=c;z<=h;z++)for(let re=C;re<=V;re++){const me=Qt(z,re);se.clear(me),gl(me),se.markDirty(me)}ae.invalidate(),Ce.length>0&&Zt(),Lo(f,fe)}}function yo(){return{cells:f,colCount:m.colCount,rowCount:m.rowCount,locale:r.value,getCellValue:(c,h)=>Ft(c,h)}}function Po(c,h){return q.length===0?null:$1(c,h,q,yo(),ae)}function Ko(c){var C,V,z;if(!i.value)return;(C=D.saveUndo)==null||C.call(D);const h={id:c.id||_1(),condition:c.condition,format:c.format,ranges:c.ranges,priority:c.priority,stopIfTrue:c.stopIfTrue,enabled:c.enabled!==!1};q.push(h),ae.invalidate(),(V=D.scheduleRender)==null||V.call(D),(z=D.emitModelData)==null||z.call(D)}function yl(c,h){var V,z,re;if(!i.value)return;(V=D.saveUndo)==null||V.call(D);const C=q.findIndex(me=>me.id===c);C<0||(q[C]={...q[C],...h,id:c},ae.invalidate(),(z=D.scheduleRender)==null||z.call(D),(re=D.emitModelData)==null||re.call(D))}function nn(c){var C,V,z;if(!i.value)return;(C=D.saveUndo)==null||C.call(D);const h=q.findIndex(re=>re.id===c);h<0||(q.splice(h,1),ae.invalidate(),(V=D.scheduleRender)==null||V.call(D),(z=D.emitModelData)==null||z.call(D))}function Pl(c,h){var De,Xe,Ye;if(!i.value)return;(De=D.saveUndo)==null||De.call(D);const C=[...q].sort((Qe,lt)=>Qe.priority-lt.priority),V=C.findIndex(Qe=>Qe.id===c);if(V<0)return;const z=h==="up"?V-1:V+1;if(z<0||z>=C.length)return;const re=C[V],me=C[z],Ee=re.priority;re.priority=me.priority,me.priority=Ee,ae.invalidate(),(Xe=D.scheduleRender)==null||Xe.call(D),(Ye=D.emitModelData)==null||Ye.call(D)}function Kl(){ae.invalidate()}function bn(c){var h,C,V;if(i.value){if((h=D.saveUndo)==null||h.call(D),c==="sheet")q.splice(0,q.length);else{const z=D.selection.value;if(!z)return;for(let re=q.length-1;re>=0;re--){const me=q[re];me.ranges=me.ranges.filter(Ee=>!(Ee.startCol<=z.endCol&&Ee.endCol>=z.startCol&&Ee.startRow<=z.endRow&&Ee.endRow>=z.startRow)),me.ranges.length===0&&q.splice(re,1)}}ae.invalidate(),(C=D.scheduleRender)==null||C.call(D),(V=D.emitModelData)==null||V.call(D)}}function Zt(){Se.invalidate(),be.clear()}function on(){return{cells:f,colCount:m.colCount,rowCount:m.rowCount,locale:r.value,getCellValue:(c,h)=>Ft(c,h),getSheetCells:c=>D.getSheetCellsById?D.getSheetCellsById(c):null}}function yn(c,h){const C=wt(h,c),V=C?{col:C.range.startCol,row:C.range.startRow}:{col:h,row:c};return Se.getRules(V.col,V.row,Ce)}function Go(c,h){const C=yn(c,h);return C.length?C[0]:null}function Co(c,h){return yn(c,h).length>0}function qo(c,h){const C=wt(h,c),V=C?{col:C.range.startCol,row:C.range.startRow}:{col:h,row:c};return Se.findRule(V.col,V.row,q1,Ce)}function Yo(c){const h=c.listSource,C=h&&h.type==="range"?`range:${h.sheetId??""}:${h.range.startCol},${h.range.startRow},${h.range.endCol},${h.range.endRow}`:`values:${(h&&h.type==="values"?h.values:c.values??[]).join("")}`,V=be.get(C);if(V)return V;const z=ja(c,on());return be.set(C,z),z}function wo(c,h){const C=qo(c,h);return C?{rule:C,items:Yo(C)}:null}function jo(c,h){for(const C of yn(c,h)){if(C.enabled===!1||!C.showInputMessage)continue;const V=C.inputTitle??"",z=C.inputMessage??"";if(!(!V&&!z))return{title:V,message:z}}return null}function vo(c,h,C){const V=yn(c,h);return V.length===0?{valid:!0}:Xa(C,h,c,V,on())}function Xo(c){const h=on(),C={stop:3,warning:2,information:1};let V=null,z=0;for(const re of c){const me=yn(re.row,re.col);if(me.length===0)continue;const Ee=Xa(re.value,re.col,re.row,me,h);if(Ee.valid)continue;const De=C[Mr(Ee.rule)]??0;De>z&&(z=De,V=Ee)}return V??{valid:!0}}function zr(c,h){return Ga(c,h,f)}function $r(c,h){return N1(c,h,f,fe)}function _r(c,h,C,V,z){var me,Ee,De;if(!i.value&&!(z!=null&&z.silent))return null;z!=null&&z.silent||(me=D.saveUndo)==null||me.call(D);const re=x1(c,h,C,V,f,fe);return Lo(f,fe),(Ee=D.scheduleRender)==null||Ee.call(D),(De=D.emitModelData)==null||De.call(D),re}function Hr(c,h){var C,V,z;i.value&&fe[c]&&((C=D.saveUndo)==null||C.call(D),T1(c,h,fe),(V=D.scheduleRender)==null||V.call(D),(z=D.emitModelData)==null||z.call(D))}function Wr(c,h){var C,V,z;i.value&&Ga(c,h,f)&&((C=D.saveUndo)==null||C.call(D),V1(c,h,f,fe),Lo(f,fe),(V=D.scheduleRender)==null||V.call(D),(z=D.emitModelData)==null||z.call(D))}function Ur(){Lo(f,fe)}function Pr(c){return D1(c,f,fe)}function Zo(c,h){var V,z,re;if(!i.value&&!(h!=null&&h.silent))return{...c};h!=null&&h.silent||(V=D.saveUndo)==null||V.call(D);const C={...c,id:c.id||qa(),ranges:(c.ranges??[]).map(me=>({...me})),enabled:c.enabled!==!1};return Ce.push(C),Zt(),h!=null&&h.silent||((z=D.scheduleRender)==null||z.call(D),(re=D.emitModelData)==null||re.call(D)),C}function Kr(c,h,C){var z,re,me;if(!i.value&&!(C!=null&&C.silent))return;const V=Ce.findIndex(Ee=>Ee.id===c);if(V<0){Zo({id:c,...h},C);return}C!=null&&C.silent||(z=D.saveUndo)==null||z.call(D),Ce[V]={...Ce[V],...h,id:c},Zt(),C!=null&&C.silent||((re=D.scheduleRender)==null||re.call(D),(me=D.emitModelData)==null||me.call(D))}function ko(c,h){var V,z,re;if(!i.value&&!(h!=null&&h.silent))return;const C=Ce.findIndex(me=>me.id===c);C<0||(h!=null&&h.silent||(V=D.saveUndo)==null||V.call(D),Ce.splice(C,1),Zt(),h!=null&&h.silent||((z=D.scheduleRender)==null||z.call(D),(re=D.emitModelData)==null||re.call(D)))}function Jo(c,h){var z,re,me,Ee,De,Xe;if(!i.value&&!(h!=null&&h.silent))return;if(!c){if(Ce.length===0)return;h!=null&&h.silent||(z=D.saveUndo)==null||z.call(D),Ce.splice(0,Ce.length),Zt(),h!=null&&h.silent||((re=D.scheduleRender)==null||re.call(D),(me=D.emitModelData)==null||me.call(D));return}const C={startCol:Math.min(c.startCol,c.endCol),endCol:Math.max(c.startCol,c.endCol),startRow:Math.min(c.startRow,c.endRow),endRow:Math.max(c.startRow,c.endRow)};if(Ce.filter(Ye=>(Ye.ranges??[]).some(Qe=>!(Qe.endCol<C.startCol||Qe.startCol>C.endCol||Qe.endRow<C.startRow||Qe.startRow>C.endRow))).length!==0){h!=null&&h.silent||(Ee=D.saveUndo)==null||Ee.call(D);for(let Ye=Ce.length-1;Ye>=0;Ye--){const Qe=Ce[Ye],lt=[];for(const kt of Qe.ranges??[])lt.push(...Ja(kt,C));lt.length===0?Ce.splice(Ye,1):Qe.ranges=lt}Zt(),h!=null&&h.silent||((De=D.scheduleRender)==null||De.call(D),(Xe=D.emitModelData)==null||Xe.call(D))}}function Qo(c){const h=[];for(const C of Ce)for(const V of C.ranges??[]){const z=Qa(V,c);z&&h.push({rule:C,range:z})}return h}function Eo(c,h,C){var V,z,re;if(!(!i.value&&!(C!=null&&C.silent))&&c.length){C!=null&&C.silent||(V=D.saveUndo)==null||V.call(D);for(let me=Ce.length-1;me>=0;me--){const Ee=Ce[me],De=[];for(const Xe of Ee.ranges??[])De.push(...Ja(Xe,h));De.length===0?Ce.splice(me,1):Ee.ranges=De}for(const me of c){const Ee=[];for(const De of me.ranges??[]){const Xe=Qa(De,h);Xe&&Ee.push(Xe)}Ee.length&&Ce.push({...me,id:qa(),ranges:Ee})}Zt(),C!=null&&C.silent||((z=D.scheduleRender)==null||z.call(D),(re=D.emitModelData)==null||re.call(D))}}async function $n(c,h,C){const V=c.severity??"stop";if(!(!c.rule||c.rule.showErrorMessage!==!1))return V==="stop"?"cancel":"continue";const re=D.showValidationAlert;if(!re)return V==="stop"?"cancel":"continue";Ge++;try{return await re({severity:V,title:c.title??"",message:c.message??"",col:h,row:C})}catch{return"cancel"}finally{Ge=Math.max(0,Ge-1)}}function Gr(){return Ge>0}let er=()=>{};function qr(c){i.value&&(dt.value||(dt.value={..._e.value},c!==void 0?ht.value=c:ht.value||(ht.value=Ul(_e.value.col,_e.value.row))))}async function Yr(){if(!i.value)return!1;const c=dt.value;if(!c)return!1;const h=c.col,C=c.row,V=ht.value,z=vo(C,h,V);return!z.valid&&await $n(z,h,C)!=="continue"?!1:(er(),zt(h,C,V),dt.value=null,ht.value="",!0)}function jr(){dt.value=null,ht.value=""}function Xr(c,h){const C=_e.value;let V=Math.max(0,C.col+c),z=Math.max(0,C.row+h);(V>=m.colCount||z>=m.rowCount)&&le(V,z);const re=wt(C.col,C.row),me=wt(V,z);re&&me&&re.anchor===me.anchor&&(c>0?V=re.range.endCol+1:c<0&&(V=re.range.startCol-1),h>0?z=re.range.endRow+1:h<0&&(z=re.range.startRow-1),(V>=m.colCount||z>=m.rowCount)&&le(V,z)),V=Math.max(0,Math.min(m.colCount-1,V)),z=Math.max(0,Math.min(m.rowCount-1,z)),gn(V,z)}function Cl(c,h){ce(h,c)}function Bn(c){const h=Gt.value;if(c<0||c>=h[m.colCount])return-1;let C=0,V=m.colCount-1;for(;C<V;){const z=C+V+1>>1;h[z]<=c?C=z:V=z-1}return C}function tr(c){const h=hl.value;if(c<0||c>=h[m.rowCount])return-1;let C=0,V=m.rowCount-1;for(;C<V;){const z=C+V+1>>1;h[z]<=c?C=z:V=z-1}return C}function u(c,h){var z,re;if(!i.value)return;const C=Math.max(0,Math.min(Math.floor(c),m.rowCount)),V=Math.max(0,Math.min(Math.floor(h),m.colCount));_.rows=C,_.cols=V,(z=D.scheduleRender)==null||z.call(D),(re=D.emitModelData)==null||re.call(D)}function y(){var c,h;i.value&&(_.rows=0,_.cols=0,(c=D.scheduleRender)==null||c.call(D),(h=D.emitModelData)==null||h.call(D))}function E(){return{rows:_.rows,cols:_.cols}}function J(){let c=0,h=0;if(_.cols>0){const C=T.value,V=Math.min(_.cols,C.length);for(let z=0;z<V;z++)c+=C[z]}if(_.rows>0)for(let C=0;C<_.rows;C++)h+=Ot(C);return{frozenRowsHeight:h,frozenColumnsWidth:c}}function N(){const{frozenColumnsWidth:c,frozenRowsHeight:h}=J(),C=Ht(),V=rl(),z=52+C+c,re=24+V+h,me=Math.max(0,cl.w-52-C-11-c),Ee=Math.max(0,cl.h-24-V-11-h),De=[];return h>0&&c>0&&De.push({kind:"corner",x:52+C,y:24+V,width:c,height:h,scrollLeft:0,scrollTop:0}),h>0&&De.push({kind:"rows",x:z,y:24+V,width:me,height:h,scrollLeft:W.value,scrollTop:0}),c>0&&De.push({kind:"columns",x:52+C,y:re,width:c,height:Ee,scrollLeft:0,scrollTop:F.value}),De.push({kind:"body",x:z,y:re,width:me,height:Ee,scrollLeft:W.value,scrollTop:F.value}),De}function G(c,h){const C=Gt.value,V=hl.value,z=C[h]??0,re=V[c]??0,me=wt(h,c),Ee=me?(C[me.range.endCol+1]??z)-z:(C[h+1]??z)-z,De=me?(V[me.range.endRow+1]??re)-re:Ot(c),Xe=h<_.cols,Ye=c<_.rows,Qe=(Xe?0:-W.value)+52+Ht()+z,lt=(Ye?0:-F.value)+24+rl()+re;return{x:Qe,y:lt,width:Ee,height:De}}function j(c,h){const{frozenColumnsWidth:C,frozenRowsHeight:V}=J(),z=Ht(),re=rl();if(c<52+z||h<24+re)return null;const me=C>0&&c<52+z+C,Ee=V>0&&h<24+re+V,De=me?c-52-z:c-52-z+W.value,Xe=Ee?h-24-re:h-24-re+F.value,Ye=Bn(De),Qe=tr(Xe);return Ye<0||Qe<0?null:{col:Ye,row:Qe}}function Q(c,h){return c<_.rows||h<_.cols}function ce(c,h){if(Q(c,h))return;const{frozenColumnsWidth:C,frozenRowsHeight:V}=J(),z=Math.max(0,cl.w-52-Ht()-11-C),re=Math.max(0,cl.h-24-rl()-11-V),me=Gt.value,Ee=hl.value,De=(me[h]??0)-C,Xe=(Ee[c]??0)-V,Ye=wt(h,c),Qe=Ye?(me[Ye.range.endCol+1]??0)-(me[h]??0):T.value[h]??0,lt=Ye?(Ee[Ye.range.endRow+1]??0)-(Ee[c]??0):Ot(c);let kt=W.value,Vt=F.value;De<kt?kt=De:De+Qe>kt+z&&(kt=De+Qe-z),Xe<Vt?Vt=Xe:Xe+lt>Vt+re&&(Vt=Xe+lt-re),kt=Math.max(0,kt),Vt=Math.max(0,Vt),ol(kt,Vt)}function le(c,h){var re;const C=c+1,V=h+1;let z=!1;if(C>=m.colCount){const me=Math.max(m.colCount+p,C),Ee=me-m.colCount,De=T.value;for(let Xe=0;Xe<Ee;Xe++)De.push(100);m.colCount=me,z=!0}if(V>=m.rowCount){const me=Math.max(m.rowCount+B,V),Ee=me-m.rowCount,De=ne.value;for(let Xe=0;Xe<Ee;Xe++)De.push(void 0);m.rowCount=me,z=!0}z&&((re=D.scheduleRender)==null||re.call(D))}function Pe(){return m.colCount!==s||m.rowCount!==d}function Ie(c,h,C){if(!i.value)return;const V=Cr(c,h,rt);if(!V.ok){V.reason==="target-merge-size"&&window.alert(b(r.value,"autofillMergeSizeError"));return}const z=Pa(c,h,{cells:f},C,r.value,m.colCount,m.rowCount,Et),re=Object.entries(z.cells).map(([Ee,De])=>{const Xe=Ee.indexOf(",");return{col:parseInt(Ee.substring(0,Xe),10),row:parseInt(Ee.substring(Xe+1),10),value:De?De.value:""}}),me=Xo(re);if(!me.valid){(async()=>await $n(me,h.startCol,h.startRow)==="continue"&&at(c,h,C))();return}at(c,h,C)}function at(c,h,C){var re,me,Ee;(re=D.saveUndo)==null||re.call(D),le(h.endCol,h.endRow);const V=Pa(c,h,{cells:f},C,r.value,m.colCount,m.rowCount,Et);Sn();for(const[De,Xe]of Object.entries(V.cells)){const Ye=De.indexOf(","),Qe=parseInt(De.substring(0,Ye),10),lt=parseInt(De.substring(Ye+1),10),kt=ln(Qe,lt);if(kt&&!(Qe===kt.range.startCol&<===kt.range.startRow))continue;const Vt=Xe.value;Vt===""&&(Xe.styleId===void 0||Xe.styleId===0)?(se.clear(De),gl(De)):(f[De]={value:Vt,...Xe.styleId!==void 0&&Xe.styleId>0?{styleId:Xe.styleId}:{}},Vt.startsWith("=")?se.set(De,To(Vt.slice(1),m.colCount,m.rowCount)):se.clear(De)),se.markDirty(De)}const z={startCol:Math.min(c.startCol,h.startCol),startRow:Math.min(c.startRow,h.startRow),endCol:Math.max(c.endCol,h.endCol),endRow:Math.max(c.endRow,h.endRow)};en(z.startCol,z.startRow,z.endCol,z.endRow),(me=D.scheduleRender)==null||me.call(D),(Ee=D.emitModelData)==null||Ee.call(D)}function Ke(c,h){var re;let C=!1;const V=Math.max(1,Math.floor(c)),z=Math.max(1,Math.floor(h));if(V!==m.colCount){if(V>m.colCount){const me=T.value;for(let Ee=m.colCount;Ee<V;Ee++)me.push(100)}else T.value=T.value.slice(0,V);m.colCount=V,C=!0}if(z!==m.rowCount){if(z>m.rowCount){const me=ne.value;for(let Ee=m.rowCount;Ee<z;Ee++)me.push(void 0)}else ne.value=ne.value.slice(0,z);m.rowCount=z,C=!0}C&&((re=D.scheduleRender)==null||re.call(D))}const D={props:a,locale:r,editable:i,get colCount(){return m.colCount},get rowCount(){return m.rowCount},ensureCapacity:le,hasDynamicDims:Pe,setDims:Ke,cells:f,styles:I,borders:w,merges:rt,formulaDeps:se,selection:ue,activeCell:_e,editingCell:dt,editValue:ht,colWidths:T,rowHeights:ne,scrollX:W,scrollY:F,freeze:_,setFreeze:u,clearFreeze:y,getFreeze:E,getFrozenMetrics:J,filter:L,getFilter:On,setFilter:In,enableFilter:An,clearFilter:Yn,clearFilterColumn:jn,setFilterColumn:bo,getColumnCandidates:hn,getDataRange:Uo,getCurrentRegion:Xn,detectFilterRange:Ln,toggleAutoFilter:Ir,isColumnInFilterRange:Ar,getFilterRange:Zn,isFilterEnabled:Jn,isFilterColumnActive:Lr,isRowHidden:We,getFilteredOutRows:Ve,getVisibleRowCount:Re,getVisibleRowAt:Ue,getVisibleRowIndex:ke,getViewportRegions:N,cellToScreenRect:G,screenToCell:j,isCellFrozen:Q,scrollCellIntoView:ce,BASE_CELL_VPAD:He,AUTO_ROW_BASE:k,fontMetricsCache:ye,fontMetricsCanvas:tt,measureFontMetrics:it,_getFontMetricsForCell:sl,getWrappedLines:Ml,cellFontSize:Sl,colPositions:Gt,getRowHeight:P,_isAutoRow:K,rowPositions:hl,totalWidth:Nl,totalHeight:Bl,selectCell:gn,selectRange:en,selectAll:tn,isSelected:Wl,isCellSelected:zn,selectionMode:Le,cellKey:Qt,delCell:gl,findMerge:ln,_isMergeAnchor:Qn,_mergedSpan:eo,expandSelectionForMerges:al,getCellRaw:Ul,getCellValue:Ft,setCellValue:zt,clearCellsInRange:dl,startEdit:qr,commitEdit:Yr,cancelEdit:jr,moveActive:Xr,ensureVisible:Cl,hitCol:Bn,hitRow:tr,registerStyle:Ne,resolveStyle:ft,rebuildStyleIndex:mt,syncStyles:v,registerBorder:A,resolveBorder:X,rebuildBorderIndex:ze,syncBorders:Je,getCellBorderSide:oe,getMergeOwner:we,isSameMergeInternal:Be,getRowOutlines:Hl,getColumnOutlines:pn,addRowGroup:fo,addColumnGroup:Tr,removeOutline:Vr,clearRowGroups:Dr,clearColumnGroups:Ho,clearAllOutlines:qn,setOutlineCollapsed:Wo,toggleOutline:mo,getOutlineLevel:Nt,getOutlineGutterSize:qt,getRowOutlineLevel:M,getColumnOutlineLevel:Mt,isRowCollapsed:de,isColumnCollapsed:xe,isRowVisible:Me,isColumnVisible:$e,isColHidden:O,getColWidth:g,adjustOutlinesForInsertRows:po,adjustOutlinesForDeleteRows:ho,adjustOutlinesForInsertCols:go,adjustOutlinesForDeleteCols:Fr,syncOutlines:Or,viewSize:cl,findHighlight:(c,h)=>null,autoFillState:te,applyAutoFill:Ie,conditionalFormats:q,resolveConditionalFormat:Po,addConditionalFormatRule:Ko,updateConditionalFormatRule:yl,removeConditionalFormatRule:nn,moveConditionalFormatRule:Pl,clearConditionalFormats:bn,invalidateConditionalFormatCache:Kl,dataValidations:Ce,getDataValidationRules:yn,getDataValidationRule:Go,hasDataValidation:Co,getListValidation:qo,getValidationDropdown:wo,getValidationInputMessage:jo,validateCell:vo,validateCells:Xo,createDataValidation:Zo,updateDataValidation:Kr,removeDataValidation:ko,clearDataValidation:Jo,getDataValidationsInRange:Qo,applyDataValidationsToRange:Eo,invalidateDataValidationCache:Zt,isValidationAlertOpen:Gr,confirmInvalidValue:$n,notes:fe,hasNote:zr,getNote:$r,setCellNote:_r,updateCellNote:Hr,deleteCellNote:Wr,gcNotes:Ur,getNotesInRange:Pr};return er=()=>{var c;return(c=D.saveUndo)==null?void 0:c.call(D)},ol=(c,h)=>{var C;return(C=D.clampScroll)==null?void 0:C.call(D,c,h)},D}function hp(e,o){const l=t.ref([]),n=t.ref([]);function a(R){return dp(R)}function i(){return o.saveSheet(),{sheets:o.sheets.value.map(R=>({id:R.id,name:R.name,cells:a(R.cells),styles:[...R.styles],borders:R.borders?[...R.borders]:[{}],merges:R.merges?{...R.merges}:{},selection:R.selection?{...R.selection}:null,activeCell:R.activeCell?{...R.activeCell}:{col:0,row:0},scrollX:R.scrollX,scrollY:R.scrollY,colWidths:[...R.colWidths],rowHeights:[...R.rowHeights],colCount:R.colCount,rowCount:R.rowCount,freeze:{...R.freeze},filter:R.filter?JSON.parse(JSON.stringify(R.filter)):null,conditionalFormats:R.conditionalFormats?R.conditionalFormats.map(Y=>({...Y,ranges:Y.ranges.map(de=>({...de}))})):[],dataValidations:R.dataValidations?R.dataValidations.map(Y=>({...Y,ranges:(Y.ranges??[]).map(de=>({...de}))})):[],rowOutlines:R.rowOutlines?R.rowOutlines.map(Y=>({...Y})):[],columnOutlines:R.columnOutlines?R.columnOutlines.map(Y=>({...Y})):[],notes:R.notes?Object.fromEntries(Object.entries(R.notes).map(([Y,de])=>[Y,{...de}])):{}})),styles:[...e.styles],activeSheetIndex:o.activeSheetIndex.value}}function r(R){const Y=o.sheets.value;o.sheets.value=R.sheets.map((de,xe)=>{var $e;const Me=(($e=Y[xe])==null?void 0:$e.freeze)??{rows:0,cols:0};return{...de,cells:a(de.cells),styles:[...de.styles],borders:de.borders?[...de.borders]:[{}],freeze:{rows:Me.rows,cols:Me.cols}}}),o.loadSheet(Math.max(0,Math.min(R.activeSheetIndex,o.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function s(){if(!e.editable.value)return;const R=i(),Y=l.value[l.value.length-1];Y&&JSON.stringify(Y)===JSON.stringify(R)||(l.value.push(R),n.value=[],l.value.length>50&&l.value.shift())}e.saveUndo=s;function d(){var R,Y,de;e.editable.value&&l.value.length&&(n.value.push(i()),r(l.value.pop()),(R=e.invalidateConditionalFormatCache)==null||R.call(e),(Y=e.invalidateDataValidationCache)==null||Y.call(e),(de=e.scheduleRender)==null||de.call(e),t.nextTick(()=>{var xe;return(xe=e.emitModelData)==null?void 0:xe.call(e)}))}function m(){var R,Y,de;e.editable.value&&n.value.length&&(l.value.push(i()),r(n.value.pop()),(R=e.invalidateConditionalFormatCache)==null||R.call(e),(Y=e.invalidateDataValidationCache)==null||Y.call(e),(de=e.scheduleRender)==null||de.call(e),t.nextTick(()=>{var xe;return(xe=e.emitModelData)==null?void 0:xe.call(e)}))}const p=t.computed(()=>l.value.length>0),B=t.computed(()=>n.value.length>0),f=t.computed(()=>!!e.selection.value),I=t.ref(null);function w(){var de;if(!e.editable.value)return;const R=e.selection.value;if(!R)return;const Y={};for(let xe=R.startCol;xe<=R.endCol;xe++)for(let Me=R.startRow;Me<=R.endRow;Me++)Y[`${xe-R.startCol},${Me-R.startRow}`]=((de=e.cells[e.cellKey(xe,Me)])==null?void 0:de.styleId)??0;I.value={styles:Y}}function S(){var de,xe,Me;if(!e.editable.value)return;const R=I.value,Y=e.selection.value;if(!(!R||!Y)){s();for(let $e=Y.startCol;$e<=Y.endCol;$e++)for(let O=Y.startRow;O<=Y.endRow;O++){const g=e.findMerge($e,O);if(g&&($e!==g.range.startCol||O!==g.range.startRow))continue;const M=R.styles[`${$e-Y.startCol},${O-Y.startRow}`]??0,Mt=e.cellKey($e,O),Nt=((de=e.cells[Mt])==null?void 0:de.value)??"";if(Nt===""&&M===0)e.delCell(Mt);else{const qt={value:Nt};M>0&&(qt.styleId=M),e.cells[Mt]=qt}}I.value=null,(xe=e.scheduleRender)==null||xe.call(e),(Me=e.emitModelData)==null||Me.call(e)}}function $(){var Y,de,xe;if(!e.editable.value)return;const R=e.selection.value;if(R){s();for(let Me=R.startCol;Me<=R.endCol;Me++)for(let $e=R.startRow;$e<=R.endRow;$e++){const O=e.findMerge(Me,$e);if(O&&(Me!==O.range.startCol||$e!==O.range.startRow))continue;const g=e.cellKey(Me,$e),M=((Y=e.cells[g])==null?void 0:Y.value)??"";M===""?e.delCell(g):e.cells[g]={value:M}}(de=e.scheduleRender)==null||de.call(e),(xe=e.emitModelData)==null||xe.call(e)}}const q=t.computed(()=>Ni.map(R=>({...R,label:R.value===""?b(e.locale.value,"fontDefault"):R.label}))),ae=t.computed(()=>Bi.map(R=>({...R,label:String(R.value)}))),fe="\0",Ce=t.computed(()=>{const R=e.selection.value;if(!R)return"";let Y,de=!1;for(let xe=R.startCol;xe<=R.endCol&&!de;xe++)for(let Me=R.startRow;Me<=R.endRow&&!de;Me++){const $e=e.findMerge(xe,Me);if($e&&(xe!==$e.range.startCol||Me!==$e.range.startRow))continue;const O=e.resolveStyle(e.cells[e.cellKey(xe,Me)]),g=typeof(O==null?void 0:O.fontFamily)=="string"?O.fontFamily:"";Y===void 0?Y=g:g!==Y&&(de=!0)}return de?fe:Y??""}),Se=t.computed(()=>{const R=e.selection.value;if(!R)return sn;let Y,de=!1;for(let xe=R.startCol;xe<=R.endCol&&!de;xe++)for(let Me=R.startRow;Me<=R.endRow&&!de;Me++){const $e=e.findMerge(xe,Me);if($e&&(xe!==$e.range.startCol||Me!==$e.range.startRow))continue;const O=e.cellFontSize(xe,Me);Y===void 0?Y=O:O!==Y&&(de=!0)}return de?0:Y??sn});function be(R,Y){var xe,Me,$e;if(!e.editable.value)return;const de=e.selection.value;if(de){s();for(let O=de.startCol;O<=de.endCol;O++)for(let g=de.startRow;g<=de.endRow;g++){const M=e.findMerge(O,g);if(M&&(O!==M.range.startCol||g!==M.range.startRow))continue;const Mt=e.cellKey(O,g),Nt=((xe=e.cells[Mt])==null?void 0:xe.value)??"";let Ht={...e.resolveStyle(e.cells[Mt])??{}};if(Y===""||Y===null||Y===void 0||Y===0){const{[R]:Hl,...pn}=Ht;Ht=pn}else Ht[R]=Y;const rl=Object.keys(Ht).length?e.registerStyle(Ht):0;if(Nt===""&&rl===0)e.delCell(Mt);else{const Hl={value:Nt};rl>0&&(Hl.styleId=rl),e.cells[Mt]=Hl}}(Me=e.scheduleRender)==null||Me.call(e),($e=e.emitModelData)==null||$e.call(e)}}function Ge(R){be("fontFamily",R===""?"":R)}const pe=t.ref(!1),ie=t.ref(!1),Ne=t.ref(!1),ft=t.ref(!1),mt=t.ref(!1);function v(R){be("fontSize",R),pe.value=!1}const A=t.computed(()=>Ii.map(R=>({label:b(e.locale.value,R.labelKey),value:R.value,icon:R.icon}))),X=t.computed(()=>Ai.map(R=>({label:b(e.locale.value,R.labelKey),value:R.value,icon:R.icon}))),ze=t.computed(()=>{const R=e.selection.value;if(!R)return"left";const Y=e.resolveStyle(e.cells[e.cellKey(R.startCol,R.startRow)]),de=typeof(Y==null?void 0:Y.textAlign)=="string"?Y.textAlign:"";return de==="center"||de==="right"?de:"left"}),Je=t.computed(()=>{const R=e.selection.value;if(!R)return"top";const Y=e.resolveStyle(e.cells[e.cellKey(R.startCol,R.startRow)]),de=typeof(Y==null?void 0:Y.verticalAlign)=="string"?Y.verticalAlign:"";return de==="middle"||de==="bottom"?de:"top"}),oe=t.computed(()=>{const R=e.selection.value;if(!R)return!1;const Y=e.resolveStyle(e.cells[e.cellKey(R.startCol,R.startRow)]);return(Y==null?void 0:Y.wrap)==="wrap"});function we(R){be("textAlign",R)}function Be(R){be("verticalAlign",R)}function rt(){if(!e.selection.value)return;const Y=oe.value;be("wrap",Y?void 0:"wrap")}const se=t.ref(""),ue=pe;t.watch(Se,R=>{se.value=R===0?"":String(R)},{immediate:!0});function Le(R){const Y=R.replace(/[^\d]/g,"");se.value=Y;const de=parseInt(Y,10);!isNaN(de)&&de>=5&&de<=72&&de!==Se.value&&be("fontSize",de)}function _e(){const R=se.value.trim();if(!R){se.value=Se.value===0?"":String(Se.value);return}let Y=parseInt(R,10);isNaN(Y)?Y=Se.value===0?sn:Se.value:Y=Math.max(5,Math.min(72,Y)),se.value=String(Y),Y!==Se.value&&be("fontSize",Y)}function dt(R){R.key==="Enter"&&R.target.blur()}function ht(R){R&&R.preventDefault(),ue.value=!ue.value,ue.value&&(Ne&&(Ne.value=!1),ie&&(ie.value=!1),ft.value=!1,mt.value=!1)}function T(){const R=Se.value===0?sn:Se.value,Y=Math.min(72,R+1);be("fontSize",Y),se.value=String(Y),ue.value=!1}function ne(){const R=Se.value===0?sn:Se.value,Y=Math.max(5,R-1);be("fontSize",Y),se.value=String(Y),ue.value=!1}function W(R){const Y=e.selection.value;if(!Y)return!1;let de,xe=!1;for(let Me=Y.startCol;Me<=Y.endCol&&!xe;Me++)for(let $e=Y.startRow;$e<=Y.endRow&&!xe;$e++){const O=e.findMerge(Me,$e);if(O&&(Me!==O.range.startCol||$e!==O.range.startRow))continue;const g=e.resolveStyle(e.cells[e.cellKey(Me,$e)]),M=!!(g!=null&&g[R]);de===void 0?de=M:M!==de&&(xe=!0)}return!xe&&de===!0}const F=t.computed(()=>W("fontWeight")),_=t.computed(()=>W("fontStyle")),L=t.computed(()=>W("underline")),x=t.computed(()=>W("strikethrough"));function U(){be("fontWeight",F.value?"":"bold")}function te(){be("fontStyle",_.value?"":"italic")}function ye(){be("underline",L.value?"":"underline")}function tt(){be("strikethrough",x.value?"":"line-through")}const it=t.ref(""),qe=t.ref(""),yt=ft,He=mt;function k(){yt.value=!yt.value,He.value=!1,ie&&(ie.value=!1),Ne&&(Ne.value=!1)}function ee(){He.value=!He.value,yt.value=!1,ie&&(ie.value=!1),Ne&&(Ne.value=!1)}function wt(R){ie&&(ie.value=R),R&&(yt.value=!1,He.value=!1,Ne&&(Ne.value=!1))}function At(R){it.value=R,be("color",R===""?"":R)}function Lt(R){qe.value=R,be("backgroundColor",R===""?"":R)}function Ot(){be("color",it.value===""?"":it.value)}function Rl(){be("backgroundColor",qe.value===""?"":qe.value)}const sl=t.computed(()=>{const R=e.selection.value;if(!R)return"";let Y,de=!1;for(let xe=R.startCol;xe<=R.endCol&&!de;xe++)for(let Me=R.startRow;Me<=R.endRow&&!de;Me++){const $e=e.findMerge(xe,Me);if($e&&(xe!==$e.range.startCol||Me!==$e.range.startRow))continue;const O=e.resolveStyle(e.cells[e.cellKey(xe,Me)]),g=typeof(O==null?void 0:O.color)=="string"?O.color:"";Y===void 0?Y=g:g!==Y&&(de=!0)}return de?"":Y??""}),Ml=t.computed(()=>{const R=e.selection.value;if(!R)return"";let Y,de=!1;for(let xe=R.startCol;xe<=R.endCol&&!de;xe++)for(let Me=R.startRow;Me<=R.endRow&&!de;Me++){const $e=e.findMerge(xe,Me);if($e&&(xe!==$e.range.startCol||Me!==$e.range.startRow))continue;const O=e.resolveStyle(e.cells[e.cellKey(xe,Me)]),g=typeof(O==null?void 0:O.backgroundColor)=="string"?O.backgroundColor:"";Y===void 0?Y=g:g!==Y&&(de=!0)}return de?"":Y??""}),Sl=t.computed(()=>ca(e.locale.value)),Gt=t.ref(!1),cl=t.computed(()=>{const R=e.selection.value;if(!R)return dn;let Y,de=!1;for(let xe=R.startCol;xe<=R.endCol&&!de;xe++)for(let Me=R.startRow;Me<=R.endRow&&!de;Me++){const $e=e.findMerge(xe,Me);if($e&&(xe!==$e.range.startCol||Me!==$e.range.startRow))continue;const O=e.resolveStyle(e.cells[e.cellKey(xe,Me)]),g=(O==null?void 0:O.numberFormatCategory)==="custom"?cn:typeof(O==null?void 0:O.numberFormat)=="string"?O.numberFormat:"";Y===void 0?Y=g:g!==Y&&(de=!0)}return de?Xl:Y??dn});function ol(R){if((R==null?void 0:R.numberFormatCategory)==="custom")return cn;const Y=typeof(R==null?void 0:R.numberFormat)=="string"?R.numberFormat:"";return sa(Y,e.locale.value)}const mn=t.computed(()=>{const R=cl.value;if(R!==Xl)return R===cn?cn:sa(R,e.locale.value);const Y=e.selection.value;if(!Y)return dn;let de,xe=!1;for(let Me=Y.startCol;Me<=Y.endCol&&!xe;Me++)for(let $e=Y.startRow;$e<=Y.endRow&&!xe;$e++){const O=e.findMerge(Me,$e);if(O&&(Me!==O.range.startCol||$e!==O.range.startRow))continue;const g=ol(e.resolveStyle(e.cells[e.cellKey(Me,$e)]));de===void 0?de=g:g!==de&&(xe=!0)}return xe?Xl:de??dn});function P(R){e.editable.value&&(be("numberFormat",R),K())}function K(){const R=e.selection.value;if(R)for(let Y=R.startCol;Y<=R.endCol;Y++)for(let de=R.startRow;de<=R.endRow;de++){const xe=e.findMerge(Y,de);if(xe&&(Y!==xe.range.startCol||de!==xe.range.startRow))continue;const Me=e.cellKey(Y,de),$e=e.cells[Me],O=e.resolveStyle($e);if((O==null?void 0:O.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:g,...M}=O,Mt=Object.keys(M).length?e.registerStyle(M):0,Nt=($e==null?void 0:$e.value)??"";if(Nt===""&&Mt===0)e.delCell(Me);else{const qt={value:Nt};Mt>0&&(qt.styleId=Mt),e.cells[Me]=qt}}}function Z(R){if(R===cn){Gt.value=!0;return}P(R)}function ve(){Gt.value=!0}function Fe(){const R=e.selection.value;if(!R)return[];const Y=[];for(let de=R.startCol;de<=R.endCol;de++)for(let xe=R.startRow;xe<=R.endRow;xe++){const Me=e.findMerge(de,xe);if(Me&&(de!==Me.range.startCol||xe!==Me.range.startRow))continue;const $e=e.cellKey(de,xe),O=e.cells[$e],g=e.resolveStyle(O),M=typeof(g==null?void 0:g.numberFormat)=="string"?g.numberFormat:dn,Mt=(O==null?void 0:O.value)??"",Nt=Mt.startsWith("=")?xa(de,xe,e.cells,e.colCount,e.rowCount):Mt;ia(M,Nt)&&Y.push({key:$e,nf:M,decimals:ls(M,Nt)})}return Y}const Ve=t.computed(()=>Fe().some(R=>R.decimals<dr)),We=t.computed(()=>Fe().some(R=>R.decimals>ur));function Re(R,Y,de){var g;const xe=((g=e.cells[R])==null?void 0:g.value)??"",$e={...e.resolveStyle(e.cells[R])??{}};Y===""?(delete $e.numberFormat,delete $e.numberFormatCategory):($e.numberFormat=Y,de==="custom"&&($e.numberFormatCategory="custom"));const O=Object.keys($e).length?e.registerStyle($e):0;if(xe===""&&O===0)e.delCell(R);else{const M={value:xe};O>0&&(M.styleId=O),e.cells[R]=M}}function Ue(R){var xe,Me;if(!e.editable.value)return;const Y=Fe(),de=[];for(const $e of Y){const O=$e.decimals+R;if(O<ur||O>dr)continue;const g=os($e.nf,O);g==null||g===$e.nf||de.push({key:$e.key,code:g,category:Fl($e.nf)?"custom":void 0})}if(de.length){s();for(const $e of de)Re($e.key,$e.code,$e.category);(xe=e.scheduleRender)==null||xe.call(e),(Me=e.emitModelData)==null||Me.call(e)}}function ke(){Ue(1)}function st(){Ue(-1)}return{undoStack:l,redoStack:n,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:s,undo:d,redo:m,canUndo:p,canRedo:B,hasSelection:f,paintFmt:I,onPaintFormat:w,applyPaintFormat:S,clearFormat:$,fontFamilyOptions:q,fontSizeOptions:ae,FONT_FAMILY_MIXED:fe,selFontFamily:Ce,selFontSize:Se,applyStyleToSelection:be,onFontFamilyChange:Ge,onFontSizeChange:v,hAlignOptions:A,vAlignOptions:X,selHAlign:ze,selVAlign:Je,selWrap:oe,onHAlignChange:we,onVAlignChange:Be,onWrapToggle:rt,fontSizeInput:se,fontSizeMenuOpen:ue,onFontSizeInput:Le,onFontSizeBlur:_e,onFontSizeKeydown:dt,toggleFontSizeMenu:ht,onFontSizeStepUp:T,onFontSizeStepDown:ne,selFontWeight:F,selFontStyle:_,selUnderline:L,selStrikethrough:x,toggleFontWeight:U,toggleFontStyle:te,toggleUnderline:ye,toggleStrikethrough:tt,cachedTextColor:it,cachedFillColor:qe,textColorMenuOpen:yt,fillColorMenuOpen:He,_toggleTextColorMenu:k,_toggleFillColorMenu:ee,onBorderMenuToggle:wt,onTextColorChange:At,onFillColorChange:Lt,applyCachedTextColor:Ot,applyCachedFillColor:Rl,selTextColor:sl,selFillColor:Ml,nfOptions:Sl,selNumberFormat:cl,selNumberFormatDisplay:mn,NF_NUMBER_FORMAT_MIXED:Xl,nfDialogOpen:Gt,onNumberFormatChange:Z,openNumberFormatDialog:ve,applyNumberFormatCode:P,canIncreaseDecimals:Ve,canDecreaseDecimals:We,onIncreaseDecimals:ke,onDecreaseDecimals:st}}function gp(e,o){o.borderMenuOpen&&(e.borderMenuOpen=o.borderMenuOpen),o.mergeMenuOpen&&(e.mergeMenuOpen=o.mergeMenuOpen),(()=>{const n=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{n&&(n.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),n&&(n.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)}})()}const bp="#444",yp="#aaaaaa";function ci(e){return e==="dark"?yp:bp}const Nr=["top","right","bottom","left"];function co(e){if(typeof e!="string")return;const o=e.trim();return o===""?void 0:o}function di(e,o){const l=co(e),n=co(o);return l===void 0||n===void 0?l===n:l.toLowerCase()===n.toLowerCase()}function _o(e){return!!e&&typeof e.width=="number"&&e.width>0}function Cp(e,o){const l={...e},n=co(o);return n===void 0?delete l.color:l.color=n,l}function wp(e,o){const l={...e};return o==="solid"?delete l.style:l.style=o,l}function ui(e,o,l,n){const a=e?{...e}:{};a.width=o;const i=co(l);return i===void 0?delete a.color:a.color=i,n!==void 0&&(n==="solid"?delete a.style:a.style=n),a}function uo(e,o,l){const n=Math.min(o.startCol,o.endCol),a=Math.max(o.startCol,o.endCol),i=Math.min(o.startRow,o.endRow),r=Math.max(o.startRow,o.endRow);if(a<n||r<i||e==="none")return;if(e==="all"){for(let m=n;m<=a;m++)for(let p=i;p<=r;p++)for(const B of Nr)l({col:m,row:p,side:B});return}if(e==="outer"||e==="thickOuter"){for(let m=n;m<=a;m++)l({col:m,row:i,side:"top"}),l({col:m,row:r,side:"bottom"});for(let m=i;m<=r;m++)l({col:n,row:m,side:"left"}),l({col:a,row:m,side:"right"});return}const d={bottom:{side:"bottom",isEdge:(m,p)=>p===r},top:{side:"top",isEdge:(m,p)=>p===i},left:{side:"left",isEdge:(m,p)=>m===n},right:{side:"right",isEdge:(m,p)=>m===a}}[e];if(d)for(let m=n;m<=a;m++)for(let p=i;p<=r;p++)d.isEdge(m,p)&&l({col:m,row:p,side:d.side})}function vp(e,o,l,n){const a=[];return uo(e,o,({col:i,row:r,side:s})=>{const d=n(i,r,s);if(!_o(d))return;const m=Cp(d,l);di(d==null?void 0:d.color,m.color)||a.push({col:i,row:r,side:s,next:m})}),a}function kp(e,o,l,n,a,i){const r={};for(const s of Nr)r[s]=ui(a(e,o,s),l,n,i);return r}function Ep(e,o,l){let n,a=!1,i=!1;if(uo(e,o,({col:r,row:s,side:d})=>{if(i)return;const m=l(r,s,d);if(!_o(m))return;const p=co(m.color);if(!a){n=p,a=!0;return}di(n,p)||(i=!0)}),!(i||!a))return n}function Rp(e,o,l,n){const a=[];return uo(e,o,({col:i,row:r,side:s})=>{const d=n(i,r,s);if(!_o(d))return;const m=wp(d,l);ml(d.style)!==l&&a.push({col:i,row:r,side:s,next:m})}),a}function Mp(e,o,l){let n,a=!1,i=!1;if(uo(e,o,({col:r,row:s,side:d})=>{if(i)return;const m=l(r,s,d);if(!_o(m))return;const p=ml(m.style);if(!a){n=p,a=!0;return}p!==n&&(i=!0)}),!(i||!a))return n}function Sp(e,o){const l=t.ref("none"),n=t.ref(""),a=t.ref("solid"),i=t.ref(!1);function r(T,ne,W){if(T<0||ne<0||T>=e.colCount||ne>=e.rowCount)return;const F=e.findMerge(T,ne);return e.getCellBorderSide(e.cells[F?F.anchor:e.cellKey(T,ne)],W)}function s(T,ne,W,F){if(T<0||ne<0||T>=e.colCount||ne>=e.rowCount)return;const _=e.findMerge(T,ne),L=_?_.anchor:e.cellKey(T,ne);if(!e.cells[L]){if(!F)return;e.cells[L]={value:""}}mp(e.cells[L],W,F,e.styles,{get:U=>e.resolveBorder(U),getId:U=>e.registerBorder(U)},e.registerStyle)}function d(T,ne,W){var te;const F=e.findMerge(T,ne),_=F?F.anchor:e.cellKey(T,ne),L=((te=e.cells[_])==null?void 0:te.value)??"",x=e.resolveStyle(e.cells[_])?{...e.resolveStyle(e.cells[_])}:{},U=e.registerBorder(W);if(U>0?x.borderId=U:delete x.borderId,delete x.borderTopWidth,delete x.borderBottomWidth,delete x.borderLeftWidth,delete x.borderRightWidth,delete x.borderColor,L===""&&!Object.keys(x).length)e.delCell(_);else{const ye=e.registerStyle(x);e.cells[_]={value:L,styleId:ye||void 0}}}function m(T){var ye,tt;if(!e.editable.value)return;l.value=T;const ne=e.selection.value;if(!ne)return;o.saveUndo();const{startCol:W,startRow:F,endCol:_,endRow:L}=ne,x={startCol:W,startRow:F,endCol:_,endRow:L},U=n.value||void 0,te=(it,qe,yt)=>r(it,qe,yt);if(T==="none")for(let it=W;it<=_;it++)for(let qe=F;qe<=L;qe++){const yt=e.findMerge(it,qe);yt&&(it!==yt.range.startCol||qe!==yt.range.startRow)||d(it,qe,{})}else if(T==="all")for(let it=W;it<=_;it++)for(let qe=F;qe<=L;qe++){const yt=e.findMerge(it,qe);if(yt&&(it!==yt.range.startCol||qe!==yt.range.startRow))continue;const He=kp(it,qe,1,U,te,a.value);for(const k of Nr)He[k]&&(He[k].owner=!0);d(it,qe,He)}else{const it=T==="thickOuter"?2:1;uo(T,x,({col:qe,row:yt,side:He})=>{const k=te(qe,yt,He),ee=ui(k,it,U,a.value);ee.owner=!0,s(qe,yt,He,ee)})}(ye=e.scheduleRender)==null||ye.call(e),(tt=e.emitModelData)==null||tt.call(e)}function p(T){var L,x;if(!e.editable.value)return;n.value=T;const ne=e.selection.value;if(!ne)return;const W={startCol:Math.min(ne.startCol,ne.endCol),startRow:Math.min(ne.startRow,ne.endRow),endCol:Math.max(ne.startCol,ne.endCol),endRow:Math.max(ne.startRow,ne.endRow)},F=l.value==="none"?"all":l.value,_=vp(F,W,T,(U,te,ye)=>r(U,te,ye));if(_.length!==0){o.saveUndo();for(const U of _)U.next.owner=!0,s(U.col,U.row,U.side,U.next);(L=e.scheduleRender)==null||L.call(e),(x=e.emitModelData)==null||x.call(e)}}function B(T){var L,x,U;if(!e.editable.value)return;a.value=T;const ne=e.selection.value;if(!ne)return;const W={startCol:Math.min(ne.startCol,ne.endCol),startRow:Math.min(ne.startRow,ne.endRow),endCol:Math.max(ne.startCol,ne.endCol),endRow:Math.max(ne.startRow,ne.endRow)},F=l.value==="none"?"all":l.value,_=Rp(F,W,T,(te,ye,tt)=>r(te,ye,tt));if(_.length===0){(L=e.scheduleRender)==null||L.call(e);return}o.saveUndo();for(const te of _)te.next.owner=!0,s(te.col,te.row,te.side,te.next);(x=e.scheduleRender)==null||x.call(e),(U=e.emitModelData)==null||U.call(e)}const f=t.computed(()=>{const T=e.selection.value;if(!T)return"";const ne=l.value==="none"?"all":l.value;return Ep(ne,T,(W,F,_)=>r(W,F,_))??""}),I=t.computed(()=>{const T=e.selection.value;if(!T)return"";const ne=l.value==="none"?"all":l.value;return Mp(ne,T,(W,F,_)=>r(W,F,_))??""});function w(){e.editable.value&&m(l.value)}function S(T,ne,W){const F=W.toLowerCase(),_=e.findMerge(T,ne);if(_){if(F==="top"&&ne!==_.range.startRow||F==="bottom"&&ne!==_.range.endRow||F==="left"&&T!==_.range.startCol||F==="right"&&T!==_.range.endCol)return 0;const x=e.getCellBorderSide(e.cells[_.anchor],F);return(x==null?void 0:x.width)??0}const L=e.getCellBorderSide(e.cells[e.cellKey(T,ne)],F);return(L==null?void 0:L.width)??0}const $=t.ref(!1);function q(T){$.value=T,T&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,i.value=!1,o.fontSizeMenuOpen.value=!1)}function ae(T,ne,W,F){const _=[];for(const L in e.merges){const x=e.merges[L];x&&x.startCol<=W&&x.endCol>=T&&x.startRow<=F&&x.endRow>=ne&&_.push(L)}for(const L of _)Reflect.deleteProperty(e.merges,L)}function fe(){var L,x,U;if(!e.editable.value)return;const T=e.selection.value;if(!T||T.startCol===T.endCol&&T.startRow===T.endRow)return;o.saveUndo(),ae(T.startCol,T.startRow,T.endCol,T.endRow);const ne=e.cellKey(T.startCol,T.startRow),W=((L=e.cells[ne])==null?void 0:L.value)??"";for(let te=T.startCol;te<=T.endCol;te++)for(let ye=T.startRow;ye<=T.endRow;ye++)te===T.startCol&&ye===T.startRow||e.clearCellsInRange(te,te,ye,ye);const F=e.resolveStyle(e.cells[ne])?{...e.resolveStyle(e.cells[ne])}:{};F.textAlign="center";const _=e.registerStyle(F);e.cells[ne]={value:W,styleId:_||void 0},e.merges[ne]={startCol:T.startCol,startRow:T.startRow,endCol:T.endCol,endRow:T.endRow},e.selectCell(T.startCol,T.startRow),(x=e.scheduleRender)==null||x.call(e),(U=e.emitModelData)==null||U.call(e)}function Ce(){var ne,W,F;if(!e.editable.value)return;const T=e.selection.value;if(!(!T||T.startCol===T.endCol)){o.saveUndo();for(let _=T.startRow;_<=T.endRow;_++){ae(T.startCol,_,T.endCol,_);const L=e.cellKey(T.startCol,_);(ne=e.cells[L])==null||ne.value;for(let x=T.startCol+1;x<=T.endCol;x++)e.clearCellsInRange(x,x,_,_);e.merges[L]={startCol:T.startCol,startRow:_,endCol:T.endCol,endRow:_}}e.selectRange(T.startCol,T.startRow,T.endCol,T.endRow),(W=e.scheduleRender)==null||W.call(e),(F=e.emitModelData)==null||F.call(e)}}function Se(){var W,F,_;if(!e.editable.value)return;const T=e.selection.value;if(!T||T.startCol===T.endCol&&T.startRow===T.endRow)return;o.saveUndo(),ae(T.startCol,T.startRow,T.endCol,T.endRow);const ne=e.cellKey(T.startCol,T.startRow);(W=e.cells[ne])==null||W.value;for(let L=T.startCol;L<=T.endCol;L++)for(let x=T.startRow;x<=T.endRow;x++)L===T.startCol&&x===T.startRow||e.clearCellsInRange(L,L,x,x);e.merges[ne]={startCol:T.startCol,startRow:T.startRow,endCol:T.endCol,endRow:T.endRow},e.selectCell(T.startCol,T.startRow),(F=e.scheduleRender)==null||F.call(e),(_=e.emitModelData)==null||_.call(e)}function be(){var ne,W;if(!e.editable.value)return;const T=e.selection.value;T&&(o.saveUndo(),ae(T.startCol,T.startRow,T.endCol,T.endRow),(ne=e.scheduleRender)==null||ne.call(e),(W=e.emitModelData)==null||W.call(e))}function Ge(){const T=e.selection.value;if(!T)return;const ne=e.findMerge(T.startCol,T.startRow);ne&&T.startCol===ne.range.startCol&&T.startRow===ne.range.startRow&&T.endCol===ne.range.endCol&&T.endRow===ne.range.endRow?be():fe()}function pe(T){switch(T){case"mergeCenter":fe();break;case"mergeAcross":Ce();break;case"mergeCells":Se();break;case"unmergeCells":be();break}}let ie=null,Ne=[],ft=[];function mt(T,ne,W,F){ft=[];const _={startCol:T,endCol:ne,startRow:W,endRow:F};for(const{rule:L,range:x}of e.getDataValidationsInRange(_))ft.push({...L,ranges:[{...x}]})}function v(T,ne,W,F){Ne=[];for(let _=W;_<=F;_++){const L=[];for(let x=T;x<=ne;x++){const U=e.cells[e.cellKey(x,_)];L.push((U==null?void 0:U.styleId)??0)}Ne.push(L)}}function A(T,ne,W,F){const _=e.cellKey(T,ne);if(Sn(),W===""||W==null){e.formulaDeps.clear(_),F&&F>0?e.cells[_]={value:"",styleId:F}:e.delCell(_),e.formulaDeps.markDirty(_);return}e.cells[_]={value:W,styleId:F&&F>0?F:void 0},W.startsWith("=")?e.formulaDeps.set(_,To(W.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(_),e.formulaDeps.markDirty(_)}function X(){const T=e.selection.value;if(!T)return;ie={...T},v(T.startCol,T.endCol,T.startRow,T.endRow),mt(T.startCol,T.endCol,T.startRow,T.endRow);const ne=[];for(let W=T.startRow;W<=T.endRow;W++){const F=[];for(let _=T.startCol;_<=T.endCol;_++)F.push(e.getCellRaw(_,W));ne.push(F.join(" "))}rr(ne.join(`
|
|
4
|
+
`))}function ze(){const T=e.selection.value;if(T){if(T.startCol===0&&T.endCol===e.colCount-1){ie={...T},v(0,e.colCount-1,T.startRow,T.endRow),mt(0,e.colCount-1,T.startRow,T.endRow);const ne=[];for(let W=T.startRow;W<=T.endRow;W++){const F=[];for(let _=0;_<e.colCount;_++)F.push(e.getCellRaw(_,W));ne.push(F.join(" "))}rr(ne.join(`
|
|
5
|
+
`))}else if(T.startRow===0&&T.endRow===e.rowCount-1){ie={...T},v(T.startCol,T.endCol,0,e.rowCount-1),mt(T.startCol,T.endCol,0,e.rowCount-1);const ne=[];for(let W=0;W<e.rowCount;W++){const F=[];for(let _=T.startCol;_<=T.endCol;_++)F.push(e.getCellRaw(_,W));ne.push(F.join(" "))}rr(ne.join(`
|
|
6
|
+
`))}}}async function Je(){var it;if(!e.editable.value)return;let T;try{T=await navigator.clipboard.readText()}catch{return}if(!T&&T!=="")return;const ne=T.split(/\r?\n/),W=e.activeCell.value,F=ie,_=F&&Ne.length>0,L=ne.map(qe=>qe.split(" ").length),x=L.length?Math.max(...L):0,U=W.col+x-1,te=W.row+ne.length-1;U>=0&&te>=0&&e.ensureCapacity(U,te);const ye=[];for(let qe=0;qe<ne.length;qe++){const yt=ne[qe].split(" ");for(let He=0;He<yt.length;He++){const k=W.col+He,ee=W.row+qe;let wt=yt[He];wt.startsWith("=")&&F&&(wt=Vo(wt,k-(F.startCol+He),ee-(F.startRow+qe),e.colCount,e.rowCount,Et));const At=_&&qe<Ne.length&&He<(((it=Ne[qe])==null?void 0:it.length)??0)?Ne[qe][He]??null:null;ye.push({c:k,r:ee,val:wt,styleId:At})}}const tt=e.validateCells(ye.map(qe=>({col:qe.c,row:qe.r,value:qe.val})));if(!(!tt.valid&&await e.confirmInvalidValue(tt,W.col,W.row)!=="continue")){for(const qe of ye)qe.styleId!==null?A(qe.c,qe.r,qe.val,qe.styleId):e.setCellValue(qe.c,qe.r,qe.val);if(F&&ft.length>0){const qe=W.col-F.startCol,yt=W.row-F.startRow,He={startCol:W.col,endCol:W.col+x-1,startRow:W.row,endRow:W.row+ne.length-1},k=ft.map(ee=>({...ee,ranges:ee.ranges.map(wt=>op(wt,qe,yt))}));e.applyDataValidationsToRange(k,He,{silent:!0}),e.invalidateDataValidationCache()}}}function oe(){var T;if(e.editable.value&&(o.saveUndo(),X(),e.selection.value)){const ne=e.selection.value;e.clearCellsInRange(ne.startCol,ne.endCol,ne.startRow,ne.endRow),(T=e.scheduleRender)==null||T.call(e)}}function we(){var T;if(e.editable.value&&e.selection.value){const ne=e.selection.value;e.clearCellsInRange(ne.startCol,ne.endCol,ne.startRow,ne.endRow),(T=e.scheduleRender)==null||T.call(e)}}function Be(){var L,x;if(!e.editable.value)return;const T=e.selection.value;if(!T)return;o.saveUndo();const ne=T.startCol,W=T.startRow,F=T.endCol,_=T.endRow;if(W===_)if(F+1<e.colCount){const U=`${Et(ne)}${W+1}:${Et(F)}${W+1}`;e.setCellValue(F+1,W,`=SUM(${U})`)}else{const U=`${Et(ne)}${W+1}:${Et(F-1)}${W+1}`;e.setCellValue(F,W,`=SUM(${U})`)}else for(let U=ne;U<=F;U++)if(_+1<e.rowCount){const te=`${Et(U)}${W+1}:${Et(U)}${_+1}`;e.setCellValue(U,_+1,`=SUM(${te})`)}else{const te=`${Et(U)}${W+1}:${Et(U)}${_}`;e.setCellValue(U,_,`=SUM(${te})`)}(L=e.scheduleRender)==null||L.call(e),(x=e.emitModelData)==null||x.call(e)}function rt(){var L,x;if(!e.editable.value)return;const T=e.selection.value;if(!T)return;o.saveUndo();const ne=T.startCol,W=T.startRow,F=T.endCol,_=T.endRow;if(W===_)if(F+1<e.colCount){const U=`${Et(ne)}${W+1}:${Et(F)}${W+1}`;e.setCellValue(F+1,W,`=AVERAGE(${U})`)}else{const U=`${Et(ne)}${W+1}:${Et(F-1)}${W+1}`;e.setCellValue(F,W,`=AVERAGE(${U})`)}else for(let U=ne;U<=F;U++)if(_+1<e.rowCount){const te=`${Et(U)}${W+1}:${Et(U)}${_+1}`;e.setCellValue(U,_+1,`=AVERAGE(${te})`)}else{const te=`${Et(U)}${W+1}:${Et(U)}${_}`;e.setCellValue(U,_,`=AVERAGE(${te})`)}(L=e.scheduleRender)==null||L.call(e),(x=e.emitModelData)==null||x.call(e)}function se(){var L,x;if(!e.editable.value)return;const T=e.selection.value;if(!T)return;o.saveUndo();const ne=T.startCol,W=T.startRow,F=T.endCol,_=T.endRow;if(W===_)if(F+1<e.colCount){const U=`${Et(ne)}${W+1}:${Et(F)}${W+1}`;e.setCellValue(F+1,W,`=COUNT(${U})`)}else{const U=`${Et(ne)}${W+1}:${Et(F-1)}${W+1}`;e.setCellValue(F,W,`=COUNT(${U})`)}else for(let U=ne;U<=F;U++)if(_+1<e.rowCount){const te=`${Et(U)}${W+1}:${Et(U)}${_+1}`;e.setCellValue(U,_+1,`=COUNT(${te})`)}else{const te=`${Et(U)}${W+1}:${Et(U)}${_}`;e.setCellValue(U,_,`=COUNT(${te})`)}(L=e.scheduleRender)==null||L.call(e),(x=e.emitModelData)==null||x.call(e)}const ue=t.ref(!1);function Le(T){ue.value=T,T&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,i.value=!1,o.fontSizeMenuOpen.value=!1,$.value=!1)}function _e(){Be(),ue.value=!1}function dt(){rt(),ue.value=!1}function ht(){se(),ue.value=!1}return{cachedBorder:l,cachedBorderColor:n,cachedBorderLineStyle:a,selBorderColor:f,selBorderLineStyle:I,borderMenuOpen:i,onBorderChange:m,onBorderColorChange:p,onBorderLineStyleChange:B,setCellBorderSide:s,applyBorderToCell:d,applyCachedBorder:w,cellBorderWidth:S,mergeMenuOpen:$,onMergeMenuToggle:q,removeOverlappingMerges:ae,mergeAndCenter:fe,mergeAcross:Ce,mergeCells:Se,unmergeCells:be,onApplyMerge:Ge,onMergeChange:pe,copySourceRange:null,copySourceStyles:[],captureStyles:v,captureDataValidations:mt,setCellWithStyle:A,copyToClipboard:X,copyRowCol:ze,pasteFromClipboard:Je,cutSelected:oe,clearSelected:we,sumSelected:Be,avgSelected:rt,countSelected:se,calcMenuOpen:ue,onCalcMenuToggle:Le,onCalcSum:_e,onCalcAvg:dt,onCalcCount:ht}}function Np(e,o,l){const n={},a=l(e),i=l(o);return a!=null&&(n.width=`${a}px`),i!=null&&(n.height=`${i}px`),n}function fi(e){return e==="number"?0:1}function mi(e,o,l){var i;if(e==null||e.trim()==="")return{kind:"blank"};const n=o??"";if(n===Dl||n==="@")return{kind:"text",text:e};if(Fl(n)){if($l(e))return{kind:"number",num:Number(e)};const r=Zl(e,l);return r?{kind:"number",num:r.serial}:{kind:"text",text:zl(e,n,l)}}const a=un(n);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:zl(e,n,l)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const s=((i=a.sections.find(d=>d.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*s}}return{kind:"text",text:zl(e,n,l)}}return{kind:"text",text:zl(e,n,l)}}function Bp(e,o,l,n){if(e.kind==="blank"||o.kind==="blank")return e.kind==="blank"&&o.kind==="blank"?0:e.kind==="blank"?1:-1;const a=fi(e.kind),i=fi(o.kind);if(a!==i)return l==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(o.num??0):r=(e.text??"").localeCompare(o.text??"",n,{numeric:!0}),l==="asc"?r:-r}function xp(e,o,l){const n=e.map((a,i)=>i);return n.sort((a,i)=>{const r=Bp(e[a],e[i],o,l);return r!==0?r:a-i}),n}function Tp(e){if(e.length<2||e[0].kind!=="text")return!1;for(let o=1;o<e.length;o++)if(e[o].kind==="number")return!0;return!1}function Br(e){return e?JSON.parse(JSON.stringify(e)):null}function pi(e,o,l,n){if(!e)return null;const a=l-o+1,i={...e.range};return n?o<=i.endRow&&(o<=i.startRow&&(i.startRow+=a),i.endRow+=a):l<i.startRow?(i.startRow-=a,i.endRow-=a):o<=i.endRow&&(i.endRow-=Math.min(a,i.endRow-o+1),i.endRow<i.startRow&&(i.endRow=i.startRow)),{range:i,columns:e.columns}}function hi(e,o,l,n){if(!e)return null;const a=l-o+1,i={...e.range},r={};if(n){o<=i.endCol&&(o<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const s in e.columns){const d=Number(s);r[d>=o?d+a:d]=e.columns[s]}}else{l<i.startCol?(i.startCol-=a,i.endCol-=a):o<=i.endCol&&(i.endCol-=Math.min(a,i.endCol-o+1),i.endCol<i.startCol&&(i.endCol=i.startCol));for(const s in e.columns){const d=Number(s);d>=o&&d<=l||(r[d>l?d-a:d]=e.columns[s])}}return{range:i,columns:r}}function gi(e,o,l,n){if(o==="row"){const a=e.startRow,i=e.endRow;let r,s;if(i<l)r=a,s=i;else if(a>l+n-1)r=a-n,s=i-n;else if(r=a<l?a:l,s=i>l+n-1?i-n:l-1,s<r)return null;return{...e,startRow:r,endRow:s}}else{const a=e.startCol,i=e.endCol;let r,s;if(i<l)r=a,s=i;else if(a>l+n-1)r=a-n,s=i-n;else if(r=a<l?a:l,s=i>l+n-1?i-n:l-1,s<r)return null;return{...e,startCol:r,endCol:s}}}function bi(e,o,l,n){if(o==="row"){const a=e.startRow,i=e.endRow;return a>=l?{...e,startRow:a+n,endRow:i+n}:i<l?e:{...e,endRow:i+n}}else{const a=e.startCol,i=e.endCol;return a>=l?{...e,startCol:a+n,endCol:i+n}:i<l?e:{...e,endCol:i+n}}}function Vp(e,o,l){var a;const n=l-o+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],s=r.ranges.map(d=>gi(d,"row",o,n)).filter(d=>d!==null);s.length===0?e.conditionalFormats.splice(i,1):r.ranges=s}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Dp(e,o,l){var a;const n=l-o+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>bi(r,"row",o,n));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Fp(e,o,l){var a;const n=l-o+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],s=r.ranges.map(d=>gi(d,"col",o,n)).filter(d=>d!==null);s.length===0?e.conditionalFormats.splice(i,1):r.ranges=s}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Op(e,o,l){var a;const n=l-o+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>bi(r,"col",o,n));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function yi(e,o,l,n){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],s=(r.ranges??[]).map(d=>lp(d,o,l,n)).filter(d=>d!==null);s.length===0?e.dataValidations.splice(i,1):r.ranges=s}(a=e.invalidateDataValidationCache)==null||a.call(e)}function Ci(e,o,l,n){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>np(r,o,l,n));(a=e.invalidateDataValidationCache)==null||a.call(e)}function Ip(e,o,l,n,a){function i(P,K){var Ue;if(!e.editable.value)return;const Z=K-P+1,ve=mt(P,K),Fe=[],Ve=[];for(const ke in e.cells){const st=ke.indexOf(",");if(st<0)continue;const he=parseInt(ke.substring(0,st),10),R=parseInt(ke.substring(st+1),10);R>=P&&R<=K?Ve.push(ke):R>K&&Fe.push({oldKey:ke,newKey:e.cellKey(he,R-Z),cell:e.cells[ke]})}for(const ke of Ve)Reflect.deleteProperty(e.cells,ke);for(const ke of Fe)Reflect.deleteProperty(e.cells,ke.oldKey),e.cells[ke.newKey]=ke.cell;(Ue=e.gcNotes)==null||Ue.call(e);const We=e.rowHeights.value,Re=new Array(We.length);for(let ke=0;ke<P;ke++)Re[ke]=We[ke];for(let ke=P;ke<We.length-Z;ke++)Re[ke]=We[ke+Z];for(let ke=We.length-Z;ke<We.length;ke++)Re[ke]=void 0;e.rowHeights.value=Re,ft(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(pi(e.getFilter(),P,K,!1)),Vp(e,P,K),yi(e,"row",P,Z),e.adjustOutlinesForDeleteRows(P,Z)}function r(P,K){if(!e.editable.value)return;const Z=K-P+1,ve=e.rowCount,Fe=e.colCount,{lastRow:Ve}=m();Ve>=P&&Ve+Z>=ve&&e.ensureCapacity(Fe-1,ve-1+Z);const We=e.rowCount,Re=A(P,K),Ue=[];for(const he in e.cells){const R=he.indexOf(",");if(R<0)continue;const Y=parseInt(he.substring(0,R),10),de=parseInt(he.substring(R+1),10);de>=P&&Ue.push({oldKey:he,newKey:e.cellKey(Y,de+Z),cell:e.cells[he],oldRow:de})}Ue.sort((he,R)=>R.oldRow-he.oldRow);for(const he of Ue)Reflect.deleteProperty(e.cells,he.oldKey),e.cells[he.newKey]=he.cell;for(const he in e.cells){const R=he.indexOf(",");if(R<0)continue;const Y=parseInt(he.substring(R+1),10);Y>=P&&Y<=K&&Reflect.deleteProperty(e.cells,he)}const ke=e.rowHeights.value,st=new Array(We);for(let he=0;he<P;he++)st[he]=ke[he];for(let he=P;he<=K;he++)st[he]=void 0;for(let he=P;he<We;he++)st[he+Z]=ke[he];e.rowHeights.value=st,ft(Re),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(pi(e.getFilter(),P,K,!0)),Dp(e,P,K),Ci(e,"row",P,Z),e.adjustOutlinesForInsertRows(P,Z)}function s(P,K){if(!e.editable.value)return;const Z=K-P+1,ve=e.colCount,Fe=e.rowCount,{lastCol:Ve}=m();Ve>=P&&Ve+Z>=ve&&e.ensureCapacity(ve-1+Z,Fe-1);const We=e.colCount,Re=X(P,K),Ue=[];for(const he in e.cells){const R=he.indexOf(",");if(R<0)continue;const Y=parseInt(he.substring(0,R),10),de=parseInt(he.substring(R+1),10);Y>=P&&Ue.push({oldKey:he,newKey:e.cellKey(Y+Z,de),cell:e.cells[he],oldCol:Y})}Ue.sort((he,R)=>R.oldCol-he.oldCol);for(const he of Ue)Reflect.deleteProperty(e.cells,he.oldKey),e.cells[he.newKey]=he.cell;for(const he in e.cells){const R=he.indexOf(",");if(R<0)continue;const Y=parseInt(he.substring(0,R),10);Y>=P&&Y<=K&&Reflect.deleteProperty(e.cells,he)}const ke=e.colWidths.value,st=new Array(We);for(let he=0;he<P;he++)st[he]=ke[he];for(let he=P;he<=K;he++)st[he]=100;for(let he=P;he<We;he++)st[he+Z]=ke[he];e.colWidths.value=st,ft(Re),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(hi(e.getFilter(),P,K,!0)),Op(e,P,K),Ci(e,"col",P,Z),e.adjustOutlinesForInsertCols(P,Z)}function d(P,K){var Ue;if(!e.editable.value)return;const Z=K-P+1,ve=v(P,K),Fe=[],Ve=[];for(const ke in e.cells){const st=ke.indexOf(",");if(st<0)continue;const he=parseInt(ke.substring(0,st),10),R=parseInt(ke.substring(st+1),10);he>=P&&he<=K?Ve.push(ke):he>K&&Fe.push({oldKey:ke,newKey:e.cellKey(he-Z,R),cell:e.cells[ke]})}for(const ke of Ve)Reflect.deleteProperty(e.cells,ke);for(const ke of Fe)Reflect.deleteProperty(e.cells,ke.oldKey),e.cells[ke.newKey]=ke.cell;(Ue=e.gcNotes)==null||Ue.call(e);const We=e.colWidths.value,Re=new Array(We.length);for(let ke=0;ke<P;ke++)Re[ke]=We[ke];for(let ke=P;ke<We.length-Z;ke++)Re[ke]=We[ke+Z];for(let ke=We.length-Z;ke<We.length;ke++)Re[ke]=100;e.colWidths.value=Re,ft(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(hi(e.getFilter(),P,K,!1)),Fp(e,P,K),yi(e,"col",P,Z),e.adjustOutlinesForDeleteCols(P,Z)}function m(){let P=-1,K=-1;for(const Z in e.cells){const ve=Z.split(",");if(ve.length===2){const Fe=parseInt(ve[0],10),Ve=parseInt(ve[1],10),We=e.cells[Z];We&&(We.value!==""||We.styleId!==void 0)&&(Fe>P&&(P=Fe),Ve>K&&(K=Ve))}}for(let Z=e.colCount-1;Z>=0;Z--){const ve=e.colWidths.value[Z];if(ve!==void 0&&ve!==100){Z>P&&(P=Z);break}}for(let Z=e.rowCount-1;Z>=0;Z--)if(e.rowHeights.value[Z]!==void 0){Z>K&&(K=Z);break}return{lastCol:P,lastRow:K}}function p(P,K){const Z=e.resolveStyle(e.cells[e.cellKey(P,K)]);return typeof(Z==null?void 0:Z.numberFormat)=="string"?Z.numberFormat:""}function B(P,K,Z){for(let ve=K;ve<=Z;ve++)if(e.getCellRaw(P,ve).trim()!=="")return!0;return!1}function f(P){const{startRow:K,endRow:Z,startCol:ve,endCol:Fe}=P;let Ve=ve,We=Fe;for(;Ve>0&&B(Ve-1,K,Z);)Ve--;for(;We<e.colCount-1&&B(We+1,K,Z);)We++;return{startRow:K,endRow:Z,startCol:Ve,endCol:We}}function I(P){const K=f(P);return K.startCol!==P.startCol||K.endCol!==P.endCol}function w(P,K,Z,ve=P){let Fe,Ve;if(Z)Fe=Z.startRow,Ve=Z.endRow;else{const he=e.selection.value,R=!!he&&he.startRow===he.endRow&&he.startCol===he.endCol;Fe=R||!he?0:he.startRow,Ve=R||!he?e.rowCount-1:he.endRow}let We=-1,Re=-1;for(let he=Fe;he<=Ve;he++){let R=!1;for(let Y=P;Y<=K;Y++)if(e.getCellRaw(Y,he).trim()!==""){R=!0;break}R&&(We<0&&(We=he),Re=he)}if(We<0)return null;const Ue=[];for(let he=We;he<=Re;he++){const R=e.getCellRaw(ve,he);Ue.push(mi(R,p(ve,he),e.locale.value))}const ke=Tp(Ue)?We+1:We;let st=!1;for(let he=We;he<=Re&&!st;he++)for(let R=P;R<=K;R++){const Y=e.cells[e.cellKey(R,he)];if(Y&&Y.value.startsWith("=")){st=!0;break}}if(!st)for(const he in e.merges){const R=e.merges[he];if(R&&R.startCol<=K&&R.endCol>=P&&R.startRow<=Ve&&R.endRow>=Fe){st=!0;break}}return{firstRow:We,lastRow:Re,sortStart:ke,blocked:st}}function S(P,K){const Z=w(P,K);return!!Z&&!Z.blocked&&Z.sortStart<Z.lastRow}function $(P,K,Z){var de,xe;if(!e.editable.value)return;const ve=K??e.selection.value;if(!ve)return;const Fe=ve.startCol,Ve=ve.endCol,We=Z??Fe,Re=w(Fe,Ve,{startRow:ve.startRow,endRow:ve.endRow},We);if(!Re||Re.blocked||Re.sortStart>=Re.lastRow)return;const Ue=Ve-Fe+1,ke=Re.lastRow-Re.sortStart+1,st=[],he=[];for(let Me=Re.sortStart;Me<=Re.lastRow;Me++){const $e=new Array(Ue);for(let g=Fe;g<=Ve;g++)$e[g-Fe]=e.cells[e.cellKey(g,Me)]??null;st.push($e);const O=e.getCellRaw(We,Me);he.push(mi(O,p(We,Me),e.locale.value))}const R=xp(he,P,e.locale.value);let Y=!1;for(let Me=0;Me<ke;Me++)if(R[Me]!==Me){Y=!0;break}if(Y){o.saveUndo();for(let Me=0;Me<ke;Me++){const $e=st[R[Me]],O=Re.sortStart+Me;for(let g=Fe;g<=Ve;g++){const M=e.cellKey(g,O),Mt=$e[g-Fe],Nt=Mt?Mt.value:"",qt=(de=e.cells[M])==null?void 0:de.styleId;Nt!==""||qt!==void 0?e.cells[M]={value:Nt,styleId:qt}:e.delCell(M)}}Sn();for(let Me=Re.sortStart;Me<=Re.lastRow;Me++)for(let $e=Fe;$e<=Ve;$e++)e.formulaDeps.markDirty(e.cellKey($e,Me));(xe=e.scheduleRender)==null||xe.call(e),L()}}const q=t.ref(!1),ae=t.ref(null);function fe(P){if(!e.editable.value)return!1;const K=e.selection.value;if(!K||!I(K))return!1;const Z=f(K);return ae.value={order:P,originalRange:K,expandedRange:Z},q.value=!0,!0}function Ce(P){if(!e.editable.value)return;const K=ae.value;if(!K)return;const{order:Z,originalRange:ve,expandedRange:Fe}=K;q.value=!1,ae.value=null,$(Z,P?Fe:ve,ve.startCol),Ge.value=Z}function Se(){q.value=!1,ae.value=null}const be=t.ref(!1),Ge=t.ref("asc");function pe(P){be.value=P,P&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,o.fontSizeMenuOpen.value=!1)}function ie(P){fe(P)||(Ge.value=P,$(P))}function Ne(){e.editable.value&&(fe(Ge.value)||$(Ge.value))}function ft(P){Object.keys(e.merges).forEach(K=>Reflect.deleteProperty(e.merges,K));for(const K of P)if(!(K.newRange.startCol>K.newRange.endCol||K.newRange.startRow>K.newRange.endRow)&&(e.merges[K.newAnchorKey]={...K.newRange},K.anchorCell)){const Z=K.anchorCell.value,ve=K.anchorCell.styleId;Z===""&&!ve||(e.cells[K.newAnchorKey]={value:Z,styleId:ve||void 0})}}function mt(P,K){const Z=K-P+1,ve=[];for(const Fe in e.merges){const Ve=e.merges[Fe];if(!Ve)continue;const We=e.cells[Fe]?{value:e.cells[Fe].value,styleId:e.cells[Fe].styleId??0}:{value:"",styleId:0},{startCol:Re,endCol:Ue}=Ve;let{startRow:ke,endRow:st}=Ve;if(ke>K){ke-=Z,st-=Z,ve.push({newAnchorKey:e.cellKey(Re,ke),newRange:{startCol:Re,startRow:ke,endCol:Ue,endRow:st}});continue}if(st<P){ve.push({newAnchorKey:Fe,newRange:{startCol:Re,startRow:ke,endCol:Ue,endRow:st}});continue}if(ke>=P&&st<=K||(ke>=P&&ke<=K&&(ke=P),st>=P&&st<=K?st=P-1:st>K&&(st-=Z),ke>st))continue;const he=Re,R=ke,Y=e.cellKey(he,R),xe=Fe.split(",").map(Number)[1],Me=xe>=P&&xe<=K||he!==Ve.startCol||R!==xe;ve.push({newAnchorKey:Y,newRange:{startCol:Re,startRow:ke,endCol:Ue,endRow:st},anchorCell:Me?We:void 0})}return ve}function v(P,K){const Z=K-P+1,ve=[];for(const Fe in e.merges){const Ve=e.merges[Fe];if(!Ve)continue;const We=e.cells[Fe]?{value:e.cells[Fe].value,styleId:e.cells[Fe].styleId??0}:{value:"",styleId:0};let{startCol:Re,endCol:Ue}=Ve;const{startRow:ke,endRow:st}=Ve;if(Re>K){Re-=Z,Ue-=Z,ve.push({newAnchorKey:e.cellKey(Re,ke),newRange:{startCol:Re,startRow:ke,endCol:Ue,endRow:st}});continue}if(Ue<P){ve.push({newAnchorKey:Fe,newRange:{startCol:Re,startRow:ke,endCol:Ue,endRow:st}});continue}if(Re>=P&&Ue<=K||(Re>=P&&Re<=K&&(Re=P),Ue>=P&&Ue<=K?Ue=P-1:Ue>K&&(Ue-=Z),Re>Ue))continue;const he=Re,R=ke,Y=e.cellKey(he,R),xe=Fe.split(",").map(Number)[0],Me=xe>=P&&xe<=K||he!==xe||R!==Ve.startRow;ve.push({newAnchorKey:Y,newRange:{startCol:Re,startRow:ke,endCol:Ue,endRow:st},anchorCell:Me?We:void 0})}return ve}function A(P,K){const Z=K-P+1,ve=[];for(const Fe in e.merges){const Ve=e.merges[Fe];if(!Ve)continue;const{startCol:We,endCol:Re}=Ve;let{startRow:Ue,endRow:ke}=Ve;ke<P?ve.push({newAnchorKey:Fe,newRange:{startCol:We,startRow:Ue,endCol:Re,endRow:ke}}):Ue<P?(ke+=Z,ve.push({newAnchorKey:Fe,newRange:{startCol:We,startRow:Ue,endCol:Re,endRow:ke}})):(Ue+=Z,ke+=Z,ve.push({newAnchorKey:e.cellKey(We,Ue),newRange:{startCol:We,startRow:Ue,endCol:Re,endRow:ke}}))}return ve}function X(P,K){const Z=K-P+1,ve=[];for(const Fe in e.merges){const Ve=e.merges[Fe];if(!Ve)continue;let{startCol:We,endCol:Re}=Ve;const{startRow:Ue,endRow:ke}=Ve;Re<P?ve.push({newAnchorKey:Fe,newRange:{startCol:We,startRow:Ue,endCol:Re,endRow:ke}}):We<P?(Re+=Z,ve.push({newAnchorKey:Fe,newRange:{startCol:We,startRow:Ue,endCol:Re,endRow:ke}})):(We+=Z,Re+=Z,ve.push({newAnchorKey:e.cellKey(We,Ue),newRange:{startCol:We,startRow:Ue,endCol:Re,endRow:ke}}))}return ve}let ze=0;function Je(){return ze++,`s_${ze}`}function oe(P){if(!Array.isArray(P))return[];const K=[];for(const Z of P){if(!Z||typeof Z!="object")continue;const ve=Z;if(!ve.type||!Array.isArray(ve.ranges)||ve.ranges.length===0)continue;const Fe=ve.ranges.filter(Ve=>!!Ve&&typeof Ve.startCol=="number"&&typeof Ve.startRow=="number"&&typeof Ve.endCol=="number"&&typeof Ve.endRow=="number").map(Ve=>({startCol:Math.min(Ve.startCol,Ve.endCol),endCol:Math.max(Ve.startCol,Ve.endCol),startRow:Math.min(Ve.startRow,Ve.endRow),endRow:Math.max(Ve.startRow,Ve.endRow)}));Fe.length&&K.push({...ve,id:ve.id||`dv_${K.length}`,ranges:Fe})}return K}function we(P,K){const Z=Math.max(1,(K==null?void 0:K.colCount)??e.colCount),ve=Math.max(1,(K==null?void 0:K.rowCount)??e.rowCount),Fe=new Array(Z).fill(100),Ve=new Array(ve).fill(void 0);return{id:Je(),name:P,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:Fe,rowHeights:Ve,colCount:Z,rowCount:ve,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[],notes:{}}}const Be=t.ref([we("Sheet1")]),rt=t.ref(0);function se(){const P=Be.value[rt.value];if(!P)return;P.cells={...e.cells},P.merges={...e.merges},P.selection=e.selection.value?{...e.selection.value}:null,P.activeCell={...e.activeCell.value},P.scrollX=e.scrollX.value,P.scrollY=e.scrollY.value,P.colWidths=[...e.colWidths.value],P.rowHeights=[...e.rowHeights.value],P.styles=[...e.styles],P.borders=[...e.borders],P.colCount=e.colCount,P.rowCount=e.rowCount,P.freeze={rows:e.freeze.rows,cols:e.freeze.cols},P.filter=Br(e.getFilter()),P.conditionalFormats=[...e.conditionalFormats],P.dataValidations=[...e.dataValidations];const K=Object.entries(e.notes).map(([Z,ve])=>[Z,{...ve}]);P.notes=Object.fromEntries(K),P.rowOutlines=e.getRowOutlines(),P.columnOutlines=e.getColumnOutlines()}function ue(P){var st,he,R;const K=Be.value[P];if(!K)return;Object.keys(e.cells).forEach(Y=>e.delCell(Y)),Object.assign(e.cells,K.cells),Object.keys(e.merges).forEach(Y=>Reflect.deleteProperty(e.merges,Y)),K.merges&&Object.assign(e.merges,K.merges),e.selection.value=K.selection?{...K.selection}:null,e.activeCell.value={...K.activeCell};const Z=e.activeCell.value,ve=e.selection.value,Fe=e.findMerge(Z.col,Z.row);Fe&&Fe.anchor===e.cellKey(Z.col,Z.row)&&(!ve||ve.startCol===Z.col&&ve.startRow===Z.row&&ve.endCol===Z.col&&ve.endRow===Z.row)&&e.selectCell(Z.col,Z.row),e.scrollX.value=K.scrollX,e.scrollY.value=K.scrollY,e.colWidths.value=[...K.colWidths],e.rowHeights.value=[...K.rowHeights];const Ve=Math.max(1,K.colCount??e.colCount),We=Math.max(1,K.rowCount??e.rowCount);if((st=e.setDims)==null||st.call(e,Ve,We),e.freeze.rows=Math.max(0,Math.min(K.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(K.freeze.cols,e.colCount)),K.filter){const Y=K.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(Y.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(Y.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(Y.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(Y.endRow,e.rowCount-1))},columns:{...K.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(K.styles),e.syncBorders(K.borders??[{}]);const Re=K.conditionalFormats?K.conditionalFormats.map(Y=>({...Y,ranges:Y.ranges.map(de=>({...de}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...Re),(he=e.invalidateConditionalFormatCache)==null||he.call(e);const Ue=oe(K.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...Ue),(R=e.invalidateDataValidationCache)==null||R.call(e);const ke=Ka(K.notes);Object.keys(e.notes).forEach(Y=>{e.notes[Y]=void 0}),Object.assign(e.notes,ke),e.syncOutlines(K.rowOutlines,K.columnOutlines),rt.value=P}function Le(P){P===rt.value||P<0||P>=Be.value.length||(e.cancelEdit(),se(),ue(P))}function _e(P){return e.editable.value?(o.saveUndo(),e.cancelEdit(),se(),Be.value.push(we(P??`Sheet${Be.value.length+1}`)),ue(Be.value.length-1),Be.value.length-1):-1}function dt(P){return!e.editable.value||Be.value.length<=1||(o.saveUndo(),e.cancelEdit(),Be.value.splice(P,1),ue(Math.min(P,Be.value.length-1))),rt.value}function ht(P,K){e.editable.value&&Be.value[P]&&K.trim()&&(o.saveUndo(),Be.value[P].name=K.trim())}function T(P){if(!e.editable.value)return P;o.saveUndo(),e.cancelEdit(),se();const K=Be.value[P];if(!K)return P;let Z=K.name;const ve=Z.match(/^(.*?)\s*\((\d+)\)$/);let Fe=ve?parseInt(ve[2],10)+1:2;ve&&(Z=ve[1]);let Ve=`${Z} (${Fe})`;const We=new Set(Be.value.map(Ue=>Ue.name));for(;We.has(Ve);)Fe++,Ve=`${Z} (${Fe})`;const Re={id:Je(),name:Ve,cells:{...K.cells},merges:K.merges?{...K.merges}:{},styles:[...K.styles],borders:K.borders?[...K.borders]:[{}],selection:K.selection?{...K.selection}:null,activeCell:K.activeCell?{...K.activeCell}:{col:0,row:0},scrollX:K.scrollX,scrollY:K.scrollY,colWidths:[...K.colWidths],rowHeights:[...K.rowHeights],colCount:K.colCount,rowCount:K.rowCount,freeze:{...K.freeze},filter:Br(K.filter),conditionalFormats:K.conditionalFormats?K.conditionalFormats.map(Ue=>({...Ue})):[],dataValidations:oe(K.dataValidations),rowOutlines:K.rowOutlines?K.rowOutlines.map(Ue=>({...Ue})):[],columnOutlines:K.columnOutlines?K.columnOutlines.map(Ue=>({...Ue})):[],notes:Ka(K.notes)};return Be.value.splice(P+1,0,Re),ue(P+1),P+1}function ne(P,K){var Ve;if(!e.editable.value)return;const Z=P+K;if(Z<0||Z>=Be.value.length)return;o.saveUndo();const ve=rt.value,Fe=Be.value.splice(P,1)[0];Be.value.splice(Z,0,Fe),ve===P?rt.value=Z:P<ve&&Z>=ve?rt.value=ve-1:P>ve&&Z<=ve&&(rt.value=ve+1),(Ve=e.scheduleRender)==null||Ve.call(e)}const W=t.computed(()=>Be.value.length);let F="";const _=l;function L(){se();const P=Be.value.map(Z=>{const ve={};for(const[Re,Ue]of Object.entries(Z.cells))ve[Re]={value:Ue.value},Ue.styleId&&Ue.styleId>0&&(ve[Re].styleId=Ue.styleId),Ue.noteId&&(ve[Re].noteId=Ue.noteId);const Fe={name:Z.name,cells:ve};Z.styles&&Z.styles.length>1&&(Fe.styles=[...Z.styles]),Z.borders&&Z.borders.length>1&&(Fe.borders=[...Z.borders]),Z.merges&&Object.keys(Z.merges).length&&(Fe.merges={...Z.merges});const Ve={};for(let Re=0;Re<Z.colWidths.length;Re++)Z.colWidths[Re]!==100&&(Ve[Re]=Z.colWidths[Re]);Object.keys(Ve).length&&(Fe.colWidths=Ve);const We={};for(let Re=0;Re<Z.rowHeights.length;Re++){const Ue=Z.rowHeights[Re];Ue!=null&&(We[Re]=Ue)}return Object.keys(We).length&&(Fe.rowHeights=We),(Z.freeze.rows!==0||Z.freeze.cols!==0)&&(Fe.freeze={rows:Z.freeze.rows,cols:Z.freeze.cols}),Z.filter&&(Fe.filter=Br(Z.filter)),Z.conditionalFormats&&Z.conditionalFormats.length&&(Fe.conditionalFormats=Z.conditionalFormats.map(Re=>({...Re}))),Z.dataValidations&&Z.dataValidations.length&&(Fe.dataValidations=Z.dataValidations.map(Re=>({...Re,ranges:Re.ranges.map(Ue=>({...Ue}))}))),Z.notes&&Object.keys(Z.notes).length&&(Fe.notes=Object.fromEntries(Object.entries(Z.notes).map(([Re,Ue])=>[Re,{...Ue}]))),Z.rowOutlines&&Z.rowOutlines.length&&(Fe.rowOutlines=Z.rowOutlines.map(Re=>({...Re}))),Z.columnOutlines&&Z.columnOutlines.length&&(Fe.columnOutlines=Z.columnOutlines.map(Re=>({...Re}))),Fe}),K=JSON.stringify(P);K!==F&&(F=K,_.value=P,a&&(a.value=K))}e.emitModelData=L;let x=!1;function U(){x||(x=!0,Promise.resolve().then(()=>{x=!1,L()}))}const te=t.computed(()=>e.props.theme==="dark"?$i:zi),ye=t.computed(()=>Np(e.props.width,e.props.height,Vn)),tt=t.ref(null),it=t.ref(null),qe=t.ref(null),yt=t.ref(null),He=t.ref(null),k=t.reactive({w:800,h:600});e.viewSize&&t.watch(k,P=>{e.viewSize&&(e.viewSize.w=P.w,e.viewSize.h=P.h)},{deep:!0});const ee=48,wt=28,At=11,Lt=()=>ee+e.getOutlineGutterSize("row"),Ot=()=>wt+e.getOutlineGutterSize("column"),Rl=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,k.w-Lt()-At))),sl=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,k.h-Ot()-At)));function Ml(P,K){const Z=Math.max(0,k.w-Lt()-At),ve=Math.max(0,k.h-Ot()-At),Fe=P??e.scrollX.value,Ve=K??e.scrollY.value,We=40,Re=Math.max(0,e.totalWidth.value-Z),Ue=Math.max(0,e.totalHeight.value-ve);if(Fe>=Re-We&&Fe>e.scrollX.value||Ve>=Ue-We&&Ve>e.scrollY.value){const ke=Math.max(0,Math.ceil((Fe+Z)/100)+2),st=Math.max(0,Math.ceil((Ve+ve)/24)+2);e.ensureCapacity(ke,st)}e.scrollX.value=Math.max(0,Math.min(Fe,Math.max(0,e.totalWidth.value-Z))),e.scrollY.value=Math.max(0,Math.min(Ve,Math.max(0,e.totalHeight.value-ve)))}e.clampScroll=Ml;function Sl(){var P;return typeof window>"u"?!1:!((P=window.matchMedia)!=null&&P.call(window,"(hover: none) and (pointer: coarse)").matches)}function Gt(P=!1){t.nextTick(()=>{const K=yt.value;if(K){if(!e.editingCell.value&&!Sl()){document.activeElement===K&&K.blur();return}K.focus({preventScroll:!0}),P&&K.select()}})}function cl(){Gt()}function ol(){var K;if(!e.editable.value)return;const P=e.selection.value;if(P){o.saveUndo();for(let Z=P.startRow;Z<=P.endRow;Z++)e.rowHeights.value[Z]=void 0;(K=e.scheduleRender)==null||K.call(e),L()}}function mn(){var K;if(!e.editable.value)return;const P=e.selection.value;if(P){o.saveUndo();for(let Z=P.startCol;Z<=P.endCol;Z++)e.colWidths.value[Z]=100;(K=e.scheduleRender)==null||K.call(e),L()}}return{deleteRows:i,insertRows:r,insertCols:s,deleteCols:d,sortSelectedColumns:$,canSortColumns:S,sortMenuOpen:be,cachedSortOrder:Ge,onSortMenuToggle:pe,onSortChange:ie,applyCachedSort:Ne,sortConfirmOpen:q,prepareSortConfirmation:fe,confirmSort:Ce,cancelSortConfirmation:Se,sheets:Be,activeSheetIndex:rt,saveSheet:se,loadSheet:ue,switchSheet:Le,addSheet:_e,removeSheet:dt,renameSheet:ht,dupSheet:T,moveSheet:ne,sheetCount:W,mkSheet:we,emitModelData:L,scheduleOptEmit:U,themeColors:te,outerStyle:ye,wrapperRef:tt,canvasRef:it,freezeCanvasRef:qe,editInputRef:yt,formulaBarRef:He,viewSize:k,maxScrollX:Rl,maxScrollY:sl,clampScroll:Ml,canFocusHiddenEditor:Sl,focusEditInput:Gt,onCanvasFocus:cl,resetRowHeight:ol,resetColWidth:mn,modelData:_}}function wi(e,o){let l=-1,n=-1;const a=(r,s)=>{Number.isInteger(r)&&r>=0&&r>l&&(l=r),Number.isInteger(s)&&s>=0&&s>n&&(n=s)},i=r=>{r&&a(Math.max(r.startCol,r.endCol),Math.max(r.startRow,r.endRow))};for(const r of Object.keys(e.cells)){const s=r.indexOf(",");s<0||a(Number(r.slice(0,s)),Number(r.slice(s+1)))}for(const r of Object.values(e.merges??{}))i(r);if(e.colWidths)for(const[r,s]of Object.entries(e.colWidths)){const d=Number(r);Number.isInteger(d)&&d>=0&&s>=30&&a(d,-1)}if(e.rowHeights)for(const[r,s]of Object.entries(e.rowHeights)){const d=Number(r);Number.isInteger(d)&&d>=0&&s!=null&&s>=24&&a(-1,d)}for(const r of e.conditionalFormats??[])for(const s of r.ranges??[])i(s);for(const r of e.dataValidations??[])for(const s of r.ranges??[])i(s);e.filter&&i(e.filter.range);for(const r of e.rowOutlines??[])a(-1,r.end);for(const r of e.columnOutlines??[])a(r.end,-1);return{colCount:Math.max(1,o.colCount,l+1),rowCount:Math.max(1,o.rowCount,n+1)}}function vi(e){return!!e&&e.width!==void 0&&e.width>0}function Xt(e,o,l,n){const a=vi(e),i=vi(o);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return o;const r=!!e.owner,s=!!o.owner;if(r&&!s)return e;if(s&&!r)return o;const d=e.width??0,m=o.width??0;return d>m?e:m>d?o:e}function ki(e,o){if(!e||typeof e!="object")return null;const l=e,n=l.columns??{},a=Object.keys(n).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,s=a.length?Math.max(...a):0;let d=0;for(const m in o){const p=m.indexOf(",");if(p<0)continue;const B=parseInt(m.substring(p+1),10);B>d&&(d=B)}return{range:{startCol:r,startRow:0,endCol:s,endRow:Math.max(0,d)},columns:n}}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:n}}function Ap(e,o,l,n,a){let i=!1,r=null,s=1,d,m=()=>{},p=()=>{},B=()=>{};function f(){i||(i=!0,requestAnimationFrame(()=>{i=!1,v(),A()}))}e.scheduleRender=f;function I(u){const{frozenColumnsWidth:y}=e.getFrozenMetrics(),E=y>0&&u<pe()+y?u-pe():u-pe()+e.scrollX.value;return e.hitCol(E)}function w(u){const{frozenRowsHeight:y}=e.getFrozenMetrics(),E=y>0&&u<ie()+y?u-ie():u-ie()+e.scrollY.value;return e.hitRow(E)}let S=ci(e.props.theme);function $(u,y,E,J,N,G,j,Q){const ce=ga(Q,G);if(!ce){u.fillStyle=j,E===N?u.fillRect(y,E,J-y,G):u.fillRect(y,E,G,N-E);return}if(u.save(),u.strokeStyle=j,u.lineWidth=G,u.lineCap=Q==="dotted"?"round":"butt",u.setLineDash(ce),u.beginPath(),E===N){const le=E+G/2;u.moveTo(y,le),u.lineTo(J,le)}else{const le=y+G/2;u.moveTo(le,E),u.lineTo(le,N)}u.stroke(),u.setLineDash([]),u.restore()}const q=14,ae=9,fe=16,Ce=Math.min(ae-1,9);function Se(u){return 0}const be=()=>Se(),Ge=()=>Se(),pe=()=>52+be(),ie=()=>24+Ge();function Ne(u,y){return fe+2+(y-u.level)*ae}function ft(u,y){return 3+(y-u.level)*ae}function mt(u,y){const E=new Int8Array(y).fill(-1);if(!u.length)return E;const J=[...u].sort((G,j)=>G.start-j.start),N=new Map;J.forEach((G,j)=>N.set(G.id,j%2));for(const G of J){const j=N.get(G.id),Q=Math.min(G.end,y-1);for(let ce=Math.max(0,G.start);ce<=Q;ce++)E[ce]===-1&&(E[ce]=j)}return E}function v(){const u=n.wrapperRef.value,y=n.canvasRef.value;if(!u||!y||(r=y.getContext("2d"),!r))return;s=window.devicePixelRatio||1;const E=u.getBoundingClientRect(),J=E.width,N=E.height;n.viewSize.w=J,n.viewSize.h=N,y.width=J*s,y.height=N*s,y.style.width=J+"px",y.style.height=N+"px",r.setTransform(s,0,0,s,0,0);const G=e.scrollX.value,j=e.scrollY.value,Q=52,ce=24,le=be(),Pe=Ge(),Ie=Q+le,at=ce+Pe,Ke=n.themeColors.value,D=e.getFilter(),c=e.colPositions.value,h=e.rowPositions.value,C=mt(e.getRowOutlines(),e.rowCount),V=mt(e.getColumnOutlines(),e.colCount),{frozenRowsHeight:z,frozenColumnsWidth:re}=e.getFrozenMetrics(),me=Ie+re,Ee=at+z,De=Math.max(0,J-Ie-11-re),Xe=Math.max(0,N-at-11-z),Ye=Math.max(0,e.freeze.cols-1),Qe=Math.max(0,e.freeze.rows-1),lt=Math.max(e.freeze.cols,e.hitCol(re+G));let kt=lt;for(let H=lt;H<e.colCount&&!(Ie+c[H]-G>=J);H++)kt=H;const Vt=Math.max(e.freeze.rows,e.hitRow(z+j));let ll=Vt;for(let H=Vt;H<e.rowCount&&!(at+h[H]-j>=N);H++)ll=H;let il=lt,ul=kt,Il=Vt,el=ll;re>0&&(il=0,ul=Math.max(ul,Ye)),z>0&&(Il=0,el=Math.max(el,Qe));let Cn=il,nl=Il;for(const H in e.merges){const Ae=e.merges[H];Ae&&(Ae.startRow>el||Ae.endRow<Il||Ae.startCol>ul||Ae.endCol<il||(Ae.startCol<Cn&&(Cn=Ae.startCol),Ae.startRow<nl&&(nl=Ae.startRow)))}const Al=new Array(nl);for(let H=nl;H<=el;H++)Al[H]=h[H+1]-h[H];r.fillStyle=Ke.bg,r.fillRect(0,0,J,N),r.fillStyle=Ke.gridBg,r.fillRect(Ie,at,J-Ie,N-at);const Dt=e.selection.value,Rt=e.editingCell.value;m=(H,Ae,Ze,St,Wt,tl)=>{const Tt=e.dataValidations.length>0;for(let Te=St;Te<=Wt;Te++)if(!e.isRowCollapsed(Te))for(let je=Ae;je<=Ze;je++){if(e.isColumnCollapsed(je)||e.findMerge(je,Te))continue;const nt=e.cellToScreenRect(Te,je),et=nt.x,Ct=nt.y,gt=nt.width,ct=nt.height;if(et+gt<Ie||Ct+ct<at||et>J||Ct>N)continue;const Kt=e.findHighlight?e.findHighlight(je,Te):null,Yt=e.resolveStyle(e.cells[e.cellKey(je,Te)]),It=typeof(Yt==null?void 0:Yt.backgroundColor)=="string"?Yt.backgroundColor:"";It&&(H.fillStyle=It,H.fillRect(et,Ct,gt,ct));const bt=e.resolveConditionalFormat(je,Te);if(bt!=null&&bt.backgroundColor&&(H.fillStyle=bt.backgroundColor,H.fillRect(et,Ct,gt,ct)),Kt&&(H.fillStyle=Kt==="active"?Ke.findActiveBg:Ke.findMatchBg,H.fillRect(et,Ct,gt,ct)),e.isSelected(je,Te)&&(H.fillStyle=Ke.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?H.fillRect(et,Ct,(c[je+1]??0)-c[je],tl[Te]):H.fillRect(et,Ct,gt,ct)),e.activeCell.value.col===je&&e.activeCell.value.row===Te&&(H.strokeStyle=Ke.activeCellBorder,H.lineWidth=2,H.strokeRect(et+1,Ct+1,gt-2,ct-2)),Kt==="active"&&(H.strokeStyle=Ke.findActiveBg,H.lineWidth=2,H.strokeRect(et+1,Ct+1,gt-2,ct-2)),H.strokeStyle=Ke.gridLine,H.lineWidth=.5,H.strokeRect(et+.25,Ct+.25,gt-.5,ct-.5),!(Rt&&Rt.col===je&&Rt.row===Te)){const Oe=e.resolveStyle(e.cells[e.cellKey(je,Te)]),ge=e.getCellValue(je,Te),ut=typeof(Oe==null?void 0:Oe.numberFormat)=="string"?Oe.numberFormat:"",ot=ge?zl(ge,ut,e.locale.value):"";if(ot){const vt=e.cellFontSize(je,Te),Bt=typeof(Oe==null?void 0:Oe.fontFamily)=="string"&&Oe.fontFamily?Oe.fontFamily:Tn,$t=(Oe==null?void 0:Oe.fontWeight)==="bold"||(bt==null?void 0:bt.fontWeight)==="bold"?"bold":"normal",wl=(Oe==null?void 0:Oe.fontStyle)==="italic"||(bt==null?void 0:bt.fontStyle)==="italic"?"italic":"normal",Yl=(Oe==null?void 0:Oe.underline)==="underline"||(bt==null?void 0:bt.underline)==="underline",rn=(Oe==null?void 0:Oe.strikethrough)==="line-through"||(bt==null?void 0:bt.strikethrough)==="line-through",vl=(bt==null?void 0:bt.color)||(typeof(Oe==null?void 0:Oe.color)=="string"?Oe.color:""),Ll=typeof(Oe==null?void 0:Oe.textAlign)=="string"?Oe.textAlign:cr(ge,ut)?"right":"left",kl=typeof(Oe==null?void 0:Oe.verticalAlign)=="string"?Oe.verticalAlign:"top";H.fillStyle=vl||Ke.cellText,H.font=`${wl} ${$t} ${vt}px ${Bt}`,H.textBaseline="alphabetic",H.save(),H.beginPath(),H.rect(et+5,Ct+1,gt-10,ct-2),H.clip();const an=(Oe==null?void 0:Oe.wrap)==="wrap";let fl=gt-10;D&&Te===D.range.startRow&&je>=D.range.startCol&&je<=D.range.endCol&&(fl=gt-10-Lt);let xl=ot;const Tl=!an&&ra(ut),jl=ot===Mo||aa(ge,ut);if(jl||Tl){if(jl){const Hn=Math.max(1,H.measureText("#").width),Ro=Math.max(1,Math.floor(fl/Hn));xl="#".repeat(Ro)}else if(e.getWrappedLines(H,ot,1e9,!1).some(kn=>kn&&H.measureText(kn).width>fl)){const kn=Math.max(1,H.measureText("#").width),no=Math.max(1,Math.floor(fl/kn));xl="#".repeat(no)}}const bl=e.getWrappedLines(H,xl,fl,an),{ascent:vn,descent:lo}=e.measureFontMetrics(Bt,vt,$t,wl),lr=vn+lo,i2=bl.length*lr;let nr;kl==="middle"?nr=Ct+(ct-i2)/2+vn:kl==="bottom"?nr=Ct+ct-e.BASE_CELL_VPAD-lo-(bl.length-1)*lr:nr=Ct+e.BASE_CELL_VPAD+vn;for(let Hn=0;Hn<bl.length;Hn++){const Ro=bl[Hn],kn=nr+Hn*lr,no=H.measureText(Ro);let xn;if(Ll==="center"?xn=et+gt/2-no.width/2:Ll==="right"?xn=et+gt-5-no.width:xn=et+5,H.fillText(Ro,xn,kn),Yl&&(H.strokeStyle=vl||Ke.cellText,H.lineWidth=1,H.beginPath(),H.moveTo(xn,kn+lo+1),H.lineTo(xn+no.width,kn+lo+1),H.stroke()),rn){H.strokeStyle=vl||Ke.cellText,H.lineWidth=1;const Mi=kn-vn+lr*.42;H.beginPath(),H.moveTo(xn,Mi),H.lineTo(xn+no.width,Mi),H.stroke()}}H.restore()}}if(D&&Te===D.range.startRow&&je>=D.range.startCol&&je<=D.range.endCol&&K(H,et,Ct,gt,ct,Fa(D.columns[je]),Ke),Tt&&e.getListValidation(Te,je)){const Oe=e.activeCell.value.col===je&&e.activeCell.value.row===Te;Sl(H,et,Ct,gt,ct,Oe||e.isSelected(je,Te),Ke)}e.hasNote(Te,je)&&Gt(H,et,Ct,gt,ct)}};const xt=(H,Ae,Ze)=>{const St=e.findMerge(H,Ae);return St?e.getCellBorderSide(e.cells[St.anchor],Ze):e.getCellBorderSide(e.cells[e.cellKey(H,Ae)],Ze)};p=(H,Ae,Ze,St,Wt,tl)=>{H.fillStyle=S;for(let Tt=St;Tt<=Wt;Tt++)if(!e.isRowCollapsed(Tt))for(let Te=Ae;Te<=Ze;Te++){if(e.isColumnCollapsed(Te)||e.findMerge(Te,Tt))continue;const pt=e.cellToScreenRect(Tt,Te),nt=pt.x,et=pt.y,Ct=pt.width,gt=pt.height;if(nt+Ct<Ie||et+gt<at||nt>J||et>N)continue;const ct=e.cells[e.cellKey(Te,Tt)],Kt={top:e.getCellBorderSide(ct,"top"),right:e.getCellBorderSide(ct,"right"),bottom:e.getCellBorderSide(ct,"bottom"),left:e.getCellBorderSide(ct,"left")},Yt={top:xt(Te,Tt-1,"bottom"),left:xt(Te-1,Tt,"right"),bottom:xt(Te,Tt+1,"top"),right:xt(Te+1,Tt,"left")},It=Xt(Yt.top,Kt.top),bt=Xt(Yt.left,Kt.left),Oe=Xt(Kt.bottom,Yt.bottom),ge=Xt(Kt.right,Yt.right),ut=(It==null?void 0:It.width)??0,ot=(bt==null?void 0:bt.width)??0,vt=(Oe==null?void 0:Oe.width)??0,Bt=(ge==null?void 0:ge.width)??0;ut>0&&$(H,nt,et,nt+Ct,et,ut,(It==null?void 0:It.color)||S,ml(It==null?void 0:It.style)),vt>0&&$(H,nt,et+gt-vt,nt+Ct,et+gt-vt,vt,(Oe==null?void 0:Oe.color)||S,ml(Oe==null?void 0:Oe.style)),ot>0&&$(H,nt,et,nt,et+gt,ot,(bt==null?void 0:bt.color)||S,ml(bt==null?void 0:bt.style)),Bt>0&&$(H,nt+Ct-Bt,et,nt+Ct-Bt,et+gt,Bt,(ge==null?void 0:ge.color)||S,ml(ge==null?void 0:ge.style));const $t=Te>0&&e.isColumnCollapsed(Te-1),wl=Te<e.colCount-1&&e.isColumnCollapsed(Te+1),Yl=Tt>0&&e.isRowCollapsed(Tt-1),rn=Tt<e.rowCount-1&&e.isRowCollapsed(Tt+1),vl=Te<e.freeze.cols&&(()=>{try{const kl=H.canvas;return kl?String(kl.className||"")==="grid-canvas":!1}catch{return!1}})(),Ll=Tt<e.freeze.rows&&(()=>{try{const kl=H.canvas;return kl?String(kl.className||"")==="grid-canvas":!1}catch{return!1}})();ut>0&&ot>0&&!$t&&!Yl&&(H.fillStyle=(It==null?void 0:It.color)||(bt==null?void 0:bt.color)||S,H.fillRect(nt-ot,et-ut,ot,ut)),ut>0&&Bt>0&&!wl&&!Yl&&!vl&&(H.fillStyle=(It==null?void 0:It.color)||(ge==null?void 0:ge.color)||S,H.fillRect(nt+Ct,et-ut,Bt,ut)),vt>0&&ot>0&&!$t&&!rn&&!Ll&&(H.fillStyle=(Oe==null?void 0:Oe.color)||(bt==null?void 0:bt.color)||S,H.fillRect(nt-ot,et+gt,ot,vt)),vt>0&&Bt>0&&!wl&&!rn&&!vl&&!Ll&&(H.fillStyle=(Oe==null?void 0:Oe.color)||(ge==null?void 0:ge.color)||S,H.fillRect(nt+Ct,et+gt,Bt,vt))}};const Gl=(H,Ae,Ze,St,Wt,tl,Tt)=>{const Te=e.resolveStyle(e.cells[e.cellKey(Ae,Ze)]),je=e.getCellValue(Ae,Ze),pt=typeof(Te==null?void 0:Te.numberFormat)=="string"?Te.numberFormat:"",nt=je?zl(je,pt,e.locale.value):"";if(!nt||St-10<=0||Wt-2<=0)return;const Ct=e.cellFontSize(Ae,Ze),gt=typeof(Te==null?void 0:Te.fontFamily)=="string"&&Te.fontFamily?Te.fontFamily:Tn,ct=e.resolveConditionalFormat(Ae,Ze),Kt=(Te==null?void 0:Te.fontWeight)==="bold"||(ct==null?void 0:ct.fontWeight)==="bold"?"bold":"normal",Yt=(Te==null?void 0:Te.fontStyle)==="italic"||(ct==null?void 0:ct.fontStyle)==="italic"?"italic":"normal",It=(Te==null?void 0:Te.underline)==="underline"||(ct==null?void 0:ct.underline)==="underline",bt=(Te==null?void 0:Te.strikethrough)==="line-through"||(ct==null?void 0:ct.strikethrough)==="line-through",Oe=(ct==null?void 0:ct.color)||(typeof(Te==null?void 0:Te.color)=="string"?Te.color:""),ge=typeof(Te==null?void 0:Te.textAlign)=="string"?Te.textAlign:cr(je,pt)?"right":"left",ut=typeof(Te==null?void 0:Te.verticalAlign)=="string"?Te.verticalAlign:"top";H.fillStyle=Oe||Ke.cellText,H.font=`${Yt} ${Kt} ${Ct}px ${gt}`,H.textBaseline="alphabetic",H.save(),H.beginPath(),H.rect(tl+5,Tt+1,St-10,Wt-2),H.clip();const ot=(Te==null?void 0:Te.wrap)==="wrap",vt=St-10;let Bt=nt;const $t=!ot&&ra(pt),wl=nt===Mo||aa(je,pt);if(wl||$t){if(wl){const fl=Math.max(1,H.measureText("#").width),xl=Math.max(1,Math.floor(vt/fl));Bt="#".repeat(xl)}else if(e.getWrappedLines(H,nt,1e9,!1).some(Tl=>Tl&&H.measureText(Tl).width>vt)){const Tl=Math.max(1,H.measureText("#").width),jl=Math.max(1,Math.floor(vt/Tl));Bt="#".repeat(jl)}}const Yl=e.getWrappedLines(H,Bt,vt,ot),{ascent:rn,descent:vl}=e.measureFontMetrics(gt,Ct,Kt,Yt),Ll=rn+vl,kl=Yl.length*Ll;let an;ut==="middle"?an=Tt+(Wt-kl)/2+rn:ut==="bottom"?an=Tt+Wt-e.BASE_CELL_VPAD-vl-(Yl.length-1)*Ll:an=Tt+e.BASE_CELL_VPAD+rn;for(let fl=0;fl<Yl.length;fl++){const xl=Yl[fl],Tl=an+fl*Ll,jl=H.measureText(xl);let bl;if(ge==="center"?bl=tl+St/2-jl.width/2:ge==="right"?bl=tl+St-5-jl.width:bl=tl+5,H.fillText(xl,bl,Tl),It&&(H.strokeStyle=Oe||Ke.cellText,H.lineWidth=1,H.beginPath(),H.moveTo(bl,Tl+vl+1),H.lineTo(bl+jl.width,Tl+vl+1),H.stroke()),bt){H.strokeStyle=Oe||Ke.cellText,H.lineWidth=1;const vn=Tl-rn+Ll*.42;H.beginPath(),H.moveTo(bl,vn),H.lineTo(bl+jl.width,vn),H.stroke()}}H.restore()},ql=(H,Ae,Ze,St,Wt,tl,Tt,Te)=>{const je=Ae.startCol,pt=Ae.endCol,nt=Ae.startRow,et=Ae.endRow,Ct=St,gt=tl,ct=Tt&&pt+1===e.freeze.cols&&e.freeze.cols<e.colCount&&e.isColumnCollapsed(e.freeze.cols),Kt=Tt&&pt>=e.freeze.cols||ct,Yt=Te&&et+1===e.freeze.rows&&e.freeze.rows<e.rowCount&&e.isRowCollapsed(e.freeze.rows),It=Te&&et>=e.freeze.rows||Yt,bt=e.cells[e.cellKey(je,nt)],Oe={top:e.getCellBorderSide(bt,"top"),right:e.getCellBorderSide(bt,"right"),bottom:e.getCellBorderSide(bt,"bottom"),left:e.getCellBorderSide(bt,"left")};H.fillStyle=S;for(let ge=je;ge<=pt;ge++){if(Tt&&ge>=e.freeze.cols||e.isSameMergeInternal(ge,nt-1,ge,nt))continue;const ut=xt(ge,nt-1,"bottom"),ot=Xt(ut,Oe.top);if(ot&&ot.width&&ot.width>0){const vt=ge<e.freeze.cols?Q+c[ge]:Q+c[ge]-G,Bt=(c[ge+1]??0)-c[ge];$(H,vt,Ct,vt+Bt,Ct,ot.width,ot.color||S,ml(ot.style))}}if(!It)for(let ge=je;ge<=pt;ge++){if(Tt&&ge>=e.freeze.cols||e.isSameMergeInternal(ge,et,ge,et+1))continue;const ut=xt(ge,et+1,"top"),ot=Xt(Oe.bottom,ut);if(ot&&ot.width&&ot.width>0){const vt=ge<e.freeze.cols?Q+c[ge]:Q+c[ge]-G,Bt=(c[ge+1]??0)-c[ge],$t=Ct+gt-ot.width;$(H,vt,$t,vt+Bt,$t,ot.width,ot.color||S,ml(ot.style))}}for(let ge=nt;ge<=et;ge++){if(Te&&ge>=e.freeze.rows||e.isSameMergeInternal(je-1,ge,je,ge))continue;const ut=xt(je-1,ge,"right"),ot=Xt(ut,Oe.left);if(ot&&ot.width&&ot.width>0){const vt=ge<e.freeze.rows?ce+h[ge]:ce+h[ge]-j,Bt=h[ge+1]-h[ge];$(H,Ze,vt,Ze,vt+Bt,ot.width,ot.color||S,ml(ot.style))}}if(!Kt)for(let ge=nt;ge<=et;ge++){if(Te&&ge>=e.freeze.rows||e.isSameMergeInternal(pt,ge,pt+1,ge))continue;const ut=xt(pt+1,ge,"left"),ot=Xt(Oe.right,ut);if(ot&&ot.width&&ot.width>0){const vt=ge<e.freeze.rows?ce+h[ge]:ce+h[ge]-j,Bt=h[ge+1]-h[ge],$t=Ze+Wt-ot.width;$(H,$t,vt,$t,vt+Bt,ot.width,ot.color||S,ml(ot.style))}}{const ge=e.isSameMergeInternal(je,nt-1,je,nt)?Oe.top:Xt(xt(je,nt-1,"bottom"),Oe.top),ut=e.isSameMergeInternal(je-1,nt,je,nt)?Oe.left:Xt(xt(je-1,nt,"right"),Oe.left),ot=(ge==null?void 0:ge.width)??0,vt=(ut==null?void 0:ut.width)??0,Bt=je>0&&e.isColumnCollapsed(je-1),$t=nt>0&&e.isRowCollapsed(nt-1);ot>0&&vt>0&&!Bt&&!$t&&(H.fillStyle=(ge==null?void 0:ge.color)||(ut==null?void 0:ut.color)||S,H.fillRect(Ze-vt,St-ot,vt,ot))}if(!Kt){const ge=e.isSameMergeInternal(pt,nt-1,pt,nt)?Oe.top:Xt(xt(pt,nt-1,"bottom"),Oe.top),ut=e.isSameMergeInternal(pt,nt,pt+1,nt)?Oe.right:Xt(Oe.right,xt(pt+1,nt,"left")),ot=(ge==null?void 0:ge.width)??0,vt=(ut==null?void 0:ut.width)??0,Bt=pt<e.colCount-1&&e.isColumnCollapsed(pt+1),$t=nt>0&&e.isRowCollapsed(nt-1);ot>0&&vt>0&&!Bt&&!$t&&(H.fillStyle=(ge==null?void 0:ge.color)||(ut==null?void 0:ut.color)||S,H.fillRect(Ze+Wt,St-ot,vt,ot))}if(!It){const ge=e.isSameMergeInternal(je,et,je,et+1)?Oe.bottom:Xt(Oe.bottom,xt(je,et+1,"top")),ut=e.isSameMergeInternal(je-1,et,je,et)?Oe.left:Xt(xt(je-1,et,"right"),Oe.left),ot=(ge==null?void 0:ge.width)??0,vt=(ut==null?void 0:ut.width)??0,Bt=je>0&&e.isColumnCollapsed(je-1),$t=et<e.rowCount-1&&e.isRowCollapsed(et+1);ot>0&&vt>0&&!Bt&&!$t&&(H.fillStyle=(ge==null?void 0:ge.color)||(ut==null?void 0:ut.color)||S,H.fillRect(Ze-vt,St+tl,vt,ot))}if(!Kt&&!It){const ge=e.isSameMergeInternal(pt,et,pt,et+1)?Oe.bottom:Xt(Oe.bottom,xt(pt,et+1,"top")),ut=e.isSameMergeInternal(pt,et,pt+1,et)?Oe.right:Xt(Oe.right,xt(pt+1,et,"left")),ot=(ge==null?void 0:ge.width)??0,vt=(ut==null?void 0:ut.width)??0,Bt=pt<e.colCount-1&&e.isColumnCollapsed(pt+1),$t=et<e.rowCount-1&&e.isRowCollapsed(et+1);ot>0&&vt>0&&!Bt&&!$t&&(H.fillStyle=(ge==null?void 0:ge.color)||(ut==null?void 0:ut.color)||S,H.fillRect(Ze+Wt,St+tl,vt,ot))}};B=(H,Ae,Ze,St,Wt)=>{var pt,nt;const tl=Ae+St,Tt=Ze+Wt,Te=Ae<me,je=Ze<Ee;for(const et in e.merges){const Ct=e.merges[et];if(!Ct)continue;const gt=Ct.startCol,ct=Ct.startRow,Kt=Ct.endCol,Yt=Ct.endRow,It=e.cellToScreenRect(ct,gt),bt=e.cellToScreenRect(Yt,Kt),Oe=It.x,ge=It.y,ut=bt.x+bt.width-Oe,ot=bt.y+bt.height-ge,vt=Te&&Kt>=e.freeze.cols?Math.min(tl,me):Math.min(Oe+ut,tl),Bt=je&&Yt>=e.freeze.rows?Math.min(Tt,Ee):Math.min(ge+ot,Tt),$t=Math.max(Oe,Ae),wl=Math.max(ge,Ze);if(vt<=$t||Bt<=wl)continue;const Yl=(pt=e.resolveStyle(e.cells[e.cellKey(gt,ct)]))==null?void 0:pt.backgroundColor,vl=((nt=e.resolveConditionalFormat(gt,ct))==null?void 0:nt.backgroundColor)||Yl;vl&&(H.fillStyle=vl,H.fillRect($t,wl,vt-$t,Bt-wl)),e.isSelected(gt,ct)&&(H.fillStyle=Ke.selectionBg,H.fillRect($t,wl,vt-$t,Bt-wl)),H.strokeStyle=Ke.gridLine,H.lineWidth=.5;const Ll=Oe+.25,kl=ge+.25,an=vt-Oe-.5,fl=Bt-ge-.5;if(an>0&&fl>0&&H.strokeRect(Ll,kl,an,fl),ql(H,Ct,Oe,ge,ut,ot,Te,je),e.activeCell.value.col===gt&&e.activeCell.value.row===ct&&(H.strokeStyle=Ke.activeCellBorder,H.lineWidth=2,H.strokeRect(Oe+1,ge+1,ut-2,ot-2)),e.getListValidation(ct,gt)){const xl=e.activeCell.value.col===gt&&e.activeCell.value.row===ct;Sl(H,Oe,ge,ut,ot,xl,Ke)}if(e.hasNote(ct,gt)&&Gt(H,Oe,ge,ut,ot),!(e.editingCell.value&&e.editingCell.value.col===gt&&e.editingCell.value.row===ct)){const xl=c[Kt+1]-c[gt],Tl=h[Yt+1]-h[ct],jl=gt<e.freeze.cols,bl=ct<e.freeze.rows,vn=Te?Oe:jl?Oe-G:Oe,lo=je?ge:bl?ge-j:ge;Gl(H,gt,ct,xl,Tl,vn,lo)}}},r.save(),r.beginPath();const _n=re>0?2:0,Ut=z>0?2:0;r.rect(me-_n,Ee-Ut,De+_n,Xe+Ut),r.clip(),m(r,Cn,ul,nl,el,Al),p(r,Cn,ul,nl,el,Al),B(r,me,Ee,De,Xe),r.restore(),re>0&&(r.strokeStyle=Ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(me+.5,ce),r.lineTo(me+.5,N),r.stroke()),z>0&&(r.strokeStyle=Ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Q,Ee+.5),r.lineTo(J,Ee+.5),r.stroke()),r.fillStyle=Ke.headerBg,r.fillRect(Ie,Pe,J-Ie,ce);for(let H=lt;H<=kt;H++){const Ae=Ie+c[H]-G;if(e.isColumnCollapsed(H))continue;const Ze=(c[H+1]??0)-c[H];if(Ae+Ze<Ie||Ae>J)continue;const St=V[H];St===0?(r.fillStyle=Ke.outlineGroupBg1,r.fillRect(Ae,Pe,Ze,ce)):St===1&&(r.fillStyle=Ke.outlineGroupBg2,r.fillRect(Ae,Pe,Ze,ce)),Dt&&H>=Dt.startCol&&H<=Dt.endCol&&(r.fillStyle=Ke.selectionBg,r.fillRect(Ae,Pe,Ze,ce)),r.strokeStyle=Ke.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,Pe+.25,Ze-.5,ce-.5),Dt&&H>=Dt.startCol&&H<=Dt.endCol&&(r.strokeStyle=Ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,Pe+ce-1),r.lineTo(Ae+Ze,Pe+ce-1),r.stroke()),r.fillStyle=Ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Et(H),Ae+Ze/2,Pe+ce/2)}if(re>0){r.fillStyle=Ke.headerBg,r.fillRect(Ie,Pe,re,ce);for(let H=0;H<=Ye;H++){const Ae=Ie+c[H];if(e.isColumnCollapsed(H))continue;const Ze=(c[H+1]??0)-c[H];Ae+Ze<Ie||Ae>J||(Dt&&H>=Dt.startCol&&H<=Dt.endCol&&(r.fillStyle=Ke.selectionBg,r.fillRect(Ae,Pe,Ze,ce)),r.strokeStyle=Ke.headerBorder,r.lineWidth=.5,r.strokeRect(Ae+.25,Pe+.25,Ze-.5,ce-.5),Dt&&H>=Dt.startCol&&H<=Dt.endCol&&(r.strokeStyle=Ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ae,Pe+ce-1),r.lineTo(Ae+Ze,Pe+ce-1),r.stroke()),r.fillStyle=Ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Et(H),Ae+Ze/2,Pe+ce/2))}}r.strokeStyle=Ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Ie,at+.5),r.lineTo(J,at+.5),r.stroke(),r.fillStyle=Ke.headerBg,r.fillRect(0,at,Ie,N-at);for(let H=Vt;H<=ll;H++){if(e.isRowHidden(H))continue;const Ae=at+h[H]-j,Ze=Al[H];if(Ae+Ze<at||Ae>N)continue;const St=C[H];St===0?(r.fillStyle=Ke.outlineGroupBg1,r.fillRect(le,Ae,Q,Ze)):St===1&&(r.fillStyle=Ke.outlineGroupBg2,r.fillRect(le,Ae,Q,Ze)),Dt&&H>=Dt.startRow&&H<=Dt.endRow&&(r.fillStyle=Ke.selectionBg,r.fillRect(le,Ae,Q,Ze)),r.strokeStyle=Ke.headerBorder,r.lineWidth=.5,r.strokeRect(le+.25,Ae+.25,Q-.5,Ze-.5),Dt&&H>=Dt.startRow&&H<=Dt.endRow&&(r.strokeStyle=Ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(le+Q-1,Ae),r.lineTo(le+Q-1,Ae+Ze),r.stroke()),r.fillStyle=Ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(H+1),le+Q/2,Ae+Ze/2+.5)}if(z>0){r.fillStyle=Ke.headerBg,r.fillRect(0,at,Ie,z);for(let H=0;H<=Qe;H++){if(e.isRowHidden(H))continue;const Ae=at+h[H],Ze=Al[H];Ae+Ze<at||Ae>N||(Dt&&H>=Dt.startRow&&H<=Dt.endRow&&(r.fillStyle=Ke.selectionBg,r.fillRect(le,Ae,Q,Ze)),r.strokeStyle=Ke.headerBorder,r.lineWidth=.5,r.strokeRect(le+.25,Ae+.25,Q-.5,Ze-.5),Dt&&H>=Dt.startRow&&H<=Dt.endRow&&(r.strokeStyle=Ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(le+Q-1,Ae),r.lineTo(le+Q-1,Ae+Ze),r.stroke()),r.fillStyle=Ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(H+1),le+Q/2,Ae+Ze/2+.5))}}r.strokeStyle=Ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Ie+.5,at),r.lineTo(Ie+.5,N),r.stroke(),r.fillStyle=Ke.headerBg,r.fillRect(le,Pe,Q,ce),r.strokeStyle=Ke.headerSep,r.lineWidth=1,r.strokeRect(le+.5,Pe+.5,Q-1,ce-1);const Pt=Math.min(Q,ce)*.32;r.fillStyle=Ke.activeCellBorder,r.beginPath(),r.moveTo(le+Q-1,Pe+ce-1-Pt),r.lineTo(le+Q-1-Pt,Pe+ce-1),r.lineTo(le+Q-1,Pe+ce-1),r.closePath(),r.fill();const wn=e.getOutlineLevel("row"),to=e.getOutlineLevel("column");if(e.getRowOutlines().length)for(const H of e.getRowOutlines()){const Ae=Ne(H,wn),Ze=at+h[H.start]-j,St=Ae-Ce/2,Wt=Ze-Ce/2;r.fillStyle=Ke.headerBg,r.strokeStyle=Ke.headerText,r.lineWidth=1,Ml(r,Math.round(St),Math.round(Wt),Ce,Ce,2),r.fill(),r.stroke(),r.strokeStyle=Ke.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Ae-2,Ze),r.lineTo(Ae+2,Ze),r.stroke(),H.collapsed&&(r.beginPath(),r.moveTo(Ae,Ze-2),r.lineTo(Ae,Ze+2),r.stroke())}if(e.getColumnOutlines().length)for(const H of e.getColumnOutlines()){const Ae=ft(H,to),Ze=Ie+c[H.start]-G,St=Ze-Ce/2,Wt=Ae-Ce/2;r.fillStyle=Ke.headerBg,r.strokeStyle=Ke.headerText,r.lineWidth=1,Ml(r,Math.round(St),Math.round(Wt),Ce,Ce,2),r.fill(),r.stroke(),r.strokeStyle=Ke.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Ze-2,Ae),r.lineTo(Ze+2,Ae),r.stroke(),H.collapsed&&(r.beginPath(),r.moveTo(Ze,Ae-2),r.lineTo(Ze,Ae+2),r.stroke())}X(r,Ke),ze(r,Ke)}function A(){const u=n.freezeCanvasRef.value,y=n.wrapperRef.value;if(!u||!y)return;const E=u.getContext("2d");if(!E)return;const J=y.getBoundingClientRect(),N=J.width,G=J.height,j=52,Q=24,ce=be(),le=Ge(),Pe=j+ce,Ie=Q+le,at=n.themeColors.value,Ke=e.colPositions.value,D=e.rowPositions.value,c=e.scrollX.value,h=e.scrollY.value;u.width=N*s,u.height=G*s,u.style.width=N+"px",u.style.height=G+"px",E.setTransform(s,0,0,s,0,0),E.clearRect(0,0,N,G);const{frozenRowsHeight:C,frozenColumnsWidth:V}=e.getFrozenMetrics(),z=Pe+V,re=Ie+C,me=Math.max(0,N-Pe-11-V),Ee=Math.max(0,G-Ie-11-C),De=Math.max(0,e.freeze.cols-1),Xe=Math.max(0,e.freeze.rows-1),Ye=Math.max(e.freeze.cols,e.hitCol(V+c));let Qe=Ye;for(let Rt=Ye;Rt<e.colCount&&!(Pe+Ke[Rt]-c>=N);Rt++)Qe=Rt;const lt=Math.max(e.freeze.rows,e.hitRow(C+h));let kt=lt;for(let Rt=lt;Rt<e.rowCount&&!(Ie+D[Rt]-h>=G);Rt++)kt=Rt;let Vt=Ye,ll=Qe,il=lt,ul=kt;V>0&&(Vt=0,ll=Math.max(ll,De)),C>0&&(il=0,ul=Math.max(ul,Xe));let Il=Vt,el=il;for(const Rt in e.merges){const xt=e.merges[Rt];xt&&(xt.startRow>ul||xt.endRow<il||xt.startCol>ll||xt.endCol<Vt||(xt.startCol<Il&&(Il=xt.startCol),xt.startRow<el&&(el=xt.startRow)))}const Cn=new Array(el);for(let Rt=el;Rt<=ul;Rt++)Cn[Rt]=D[Rt+1]-D[Rt];const nl=(Rt,xt,Gl)=>{const ql=e.findMerge(Rt,xt);return ql?e.getCellBorderSide(e.cells[ql.anchor],Gl):e.getCellBorderSide(e.cells[e.cellKey(Rt,xt)],Gl)},Al=(Rt,xt,Gl,ql,_n)=>{Rt.fillStyle=S;for(let Ut=ql;Ut<=_n;Ut++)for(let Pt=xt;Pt<=Gl;Pt++){if(e.isRowCollapsed(Ut)||e.isColumnCollapsed(Pt))continue;const wn=e.findMerge(Pt,Ut);if(wn&&!(Pt===wn.range.startCol&&Ut===wn.range.startRow))continue;const to=e.cellToScreenRect(Ut,Pt),H=to.x,Ae=to.y,Ze=to.width,St=to.height;if(H+Ze<Pe||Ae+St<Ie||H>N||Ae>G)continue;const Wt=e.cells[e.cellKey(Pt,Ut)],tl={top:e.getCellBorderSide(Wt,"top"),right:e.getCellBorderSide(Wt,"right"),bottom:e.getCellBorderSide(Wt,"bottom"),left:e.getCellBorderSide(Wt,"left")};if(wn)continue;const Tt={top:nl(Pt,Ut-1,"bottom"),left:nl(Pt-1,Ut,"right"),bottom:nl(Pt,Ut+1,"top"),right:nl(Pt+1,Ut,"left")},Te=Xt(Tt.top,tl.top),je=Xt(Tt.left,tl.left),pt=Xt(tl.bottom,Tt.bottom),nt=Xt(tl.right,Tt.right),et=(Te==null?void 0:Te.width)??0,Ct=(je==null?void 0:je.width)??0,gt=(pt==null?void 0:pt.width)??0,ct=(nt==null?void 0:nt.width)??0;et>0&&$(Rt,H,Ae,H+Ze,Ae,et,(Te==null?void 0:Te.color)||S,ml(Te==null?void 0:Te.style)),gt>0&&$(Rt,H,Ae+St-gt,H+Ze,Ae+St-gt,gt,(pt==null?void 0:pt.color)||S,ml(pt==null?void 0:pt.style)),Ct>0&&$(Rt,H,Ae,H,Ae+St,Ct,(je==null?void 0:je.color)||S,ml(je==null?void 0:je.style)),ct>0&&$(Rt,H+Ze-ct,Ae,H+Ze-ct,Ae+St,ct,(nt==null?void 0:nt.color)||S,ml(nt==null?void 0:nt.style));const Kt=Pt>0&&e.isColumnCollapsed(Pt-1),Yt=Pt<e.colCount-1&&e.isColumnCollapsed(Pt+1),It=Ut>0&&e.isRowCollapsed(Ut-1),bt=Ut<e.rowCount-1&&e.isRowCollapsed(Ut+1),Oe=Pt<e.freeze.cols,ge=Ut<e.freeze.rows;et>0&&Ct>0&&!Kt&&!It&&(Rt.fillStyle=(Te==null?void 0:Te.color)||(je==null?void 0:je.color)||S,Rt.fillRect(H-Ct,Ae-et,Ct,et)),et>0&&ct>0&&!Yt&&!It&&!Oe&&(Rt.fillStyle=(Te==null?void 0:Te.color)||(nt==null?void 0:nt.color)||S,Rt.fillRect(H+Ze,Ae-et,ct,et)),gt>0&&Ct>0&&!Kt&&!bt&&!ge&&(Rt.fillStyle=(pt==null?void 0:pt.color)||(je==null?void 0:je.color)||S,Rt.fillRect(H-Ct,Ae+St,Ct,gt)),gt>0&&ct>0&&!Yt&&!bt&&!Oe&&!ge&&(Rt.fillStyle=(pt==null?void 0:pt.color)||(nt==null?void 0:nt.color)||S,Rt.fillRect(H+Ze,Ae+St,ct,gt))}},Dt=(Rt,xt,Gl,ql,_n,Ut,Pt,wn)=>{Gl<=0||ql<=0||(E.save(),E.beginPath(),E.rect(Rt,xt,Gl,ql),E.clip(),E.fillStyle=at.gridBg,E.fillRect(Rt,xt,Gl,ql),m(E,_n,Ut,Pt,wn,Cn),Al(E,_n,Ut,Pt,wn),B(E,Rt,xt,Gl,ql),E.restore())};V>0&&C>0&&Dt(j,Q,V,C,0,De,0,Xe),C>0&&Dt(z,Q,me,C,Il,ll,0,Xe),V>0&&Dt(j,re,V,Ee,0,De,el,ul),E.strokeStyle=at.headerSep,E.lineWidth=1,V>0&&(E.beginPath(),E.moveTo(z+.5,Q),E.lineTo(z+.5,G),E.stroke()),C>0&&(E.beginPath(),E.moveTo(j,re+.5),E.lineTo(N,re+.5),E.stroke()),E.fillStyle=at.headerBg,E.fillRect(0,0,j,Q),E.strokeStyle=at.headerSep,E.lineWidth=1,E.strokeRect(.5,.5,j-.5,Q-.5),X(E,at),ze(E,at)}function X(u,y){const E=e.selection.value;if(!E||e.editingCell.value||!e.editable.value)return;const J=e.cellToScreenRect(E.endRow,E.endCol),N=J.x+J.width-6/2,G=J.y+J.height-6/2;if(N<pe()||G<ie())return;const{frozenColumnsWidth:j,frozenRowsHeight:Q}=e.getFrozenMetrics();if(j>0&&E.endCol>=e.freeze.cols&&N<pe()+j||Q>0&&E.endRow>=e.freeze.rows&&G<ie()+Q)return;const ce=Cr(E,E,e.merges).ok;u.fillStyle=ce?y.activeCellBorder:y.scrollTrack,u.fillRect(N,G,6,6),u.strokeStyle="#fff",u.lineWidth=1,u.strokeRect(N+.5,G+.5,6-1,6-1)}function ze(u,y){const E=e.autoFillState.value;if(!E.active||!E.preview||!E.targetRange)return;const J=E.targetRange,N=e.cellToScreenRect(J.startRow,J.startCol),G=e.cellToScreenRect(J.endRow,J.endCol),j=N.x,Q=N.y,ce=G.x+G.width-j,le=G.y+G.height-Q;Q<ie()||j<pe()||(u.fillStyle=y.selectionBg,u.fillRect(j,Q,ce,le),u.strokeStyle=y.activeCellBorder,u.lineWidth=1.5,u.setLineDash([4,3]),u.strokeRect(j+.5,Q+.5,ce-1,le-1),u.setLineDash([]))}const Je=t.computed(()=>Et(e.activeCell.value.col)+String(e.activeCell.value.row+1)),oe=t.ref(""),we=t.ref(!1),Be=t.computed(()=>e.editingCell.value?oe.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(u,y)=>{if(u&&!y){const E=e.editValue.value||e.getCellRaw(u.col,u.row)||"";oe.value=E,_e=!1}else!u&&y&&(oe.value="",we.value=!1,_e=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(oe.value="",_e=!1)});function rt(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f())}function se(u){const y=u.target.value;e.editingCell.value?e.editValue.value=y:e.startEdit(y),oe.value=y,_e=!0}function ue(u){var E,J;if(!e.editable.value)return;const y={...e.activeCell.value};e.editingCell.value?(e.editValue.value=u,e.commitEdit()):((E=e.saveUndo)==null||E.call(e),e.setCellValue(y.col,y.row,u)),oe.value="",_e=!1,f(),(J=n.emitModelData)==null||J.call(n)}let Le=!1,_e=!1;function dt(){var G,j,Q;if(Le)return;const u=n.formulaBarRef.value,y=!!(u&&typeof document<"u"&&document.activeElement===u);if(!e.editingCell.value&&!y&&!_e)return;const E={...e.activeCell.value},J=e.editingCell.value?e.editingCell.value.col:E.col,N=e.editingCell.value?e.editingCell.value.row:E.row;if(!e.editingCell.value){const ce=e.getCellRaw(J,N),le=oe.value!==ce;if(!_e)return;Le=!0,le&&((G=e.saveUndo)==null||G.call(e),e.setCellValue(J,N,oe.value),f(),(j=n.emitModelData)==null||j.call(n)),(Q=n.formulaBarRef.value)==null||Q.blur(),oe.value="",we.value=!1,_e=!1,t.nextTick(()=>{Le=!1});return}Le=!0,_e?(e.editValue.value=oe.value,e.commitEdit().then(ce=>{var le,Pe;ce&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(le=n.formulaBarRef.value)==null||le.blur(),oe.value="",we.value=!1,_e=!1,f(),n.focusEditInput(),(Pe=n.emitModelData)==null||Pe.call(n),t.nextTick(()=>{Le=!1})})):y?(oe.value=e.editValue.value,e.commitEdit().then(ce=>{var le,Pe;ce&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(le=n.formulaBarRef.value)==null||le.blur(),oe.value="",we.value=!1,_e=!1,f(),n.focusEditInput(),(Pe=n.emitModelData)==null||Pe.call(n),t.nextTick(()=>{Le=!1})})):e.commitEdit().then(()=>{var ce,le;(ce=n.formulaBarRef.value)==null||ce.blur(),oe.value="",we.value=!1,_e=!1,f(),n.focusEditInput(),(le=n.emitModelData)==null||le.call(n),t.nextTick(()=>{Le=!1})})}function ht(){var u;Le||(Le=!0,e.editingCell.value&&e.cancelEdit(),(u=n.formulaBarRef.value)==null||u.blur(),oe.value="",we.value=!1,_e=!1,f(),n.focusEditInput(),t.nextTick(()=>{Le=!1}))}function T(u){if(!u.isComposing){if(u.key==="Enter"&&(u.altKey||u.metaKey)&&!u.ctrlKey){u.preventDefault(),u.stopPropagation();const y=u.target;if(!y)return;e.editingCell.value||e.startEdit();const E=y.selectionStart??y.value.length,J=y.selectionEnd??y.value.length,N=y.value,G=N.substring(0,E)+`
|
|
7
|
+
`+N.substring(J),j=E+1;oe.value=G,we.value||(we.value=!0),t.nextTick(()=>{try{y.setSelectionRange(j,j)}catch{}if(we.value)try{y.scrollTop=y.scrollHeight}catch{}try{y.focus({preventScroll:!0})}catch{}});return}u.key==="Enter"?(u.preventDefault(),dt()):u.key==="Escape"&&(u.preventDefault(),ht())}}function ne(){dt()}const W=t.ref(null),F=t.ref("");function _(u){W.value===null&&(n.switchSheet(u),f())}function L(u){!e.editable.value&&u===n.activeSheetIndex.value||(u!==n.activeSheetIndex.value&&(n.saveSheet(),n.loadSheet(u),f()),W.value=u,F.value=n.sheets.value[u].name,t.nextTick(()=>{const y=document.querySelector(".tab-rename-input");y==null||y.focus(),y==null||y.select()}))}function x(){W.value!==null&&(n.renameSheet(W.value,F.value),t.nextTick(()=>n.emitModelData())),W.value=null,F.value=""}function U(){W.value=null,F.value=""}function te(u){u.key==="Enter"?(u.preventDefault(),x()):u.key==="Escape"&&(u.preventDefault(),U())}const ye=t.ref(null);t.watch(ye,u=>{u===null&&Re()});const tt=t.ref(null);function it(u,y,E){tt.value={mode:E,row:u,col:y}}function qe(){tt.value=null}function yt(u,y){it(u,y,"edit")}function He(u,y,E,J){if(!e.editable.value)return;const N=e.getNote(u,y);E?N?e.updateCellNote(N.id,E):e.setCellNote(u,y,E,J||Zr):N&&e.deleteCellNote(u,y),qe(),f()}function k(u,y){e.editable.value&&(e.deleteCellNote(u,y),qe(),f())}function ee(u,y){if(u<pe()||y<ie())return null;const E=e.screenToCell(u,y);if(!E)return null;const{col:J,row:N}=E;if(!e.hasNote(N,J))return null;const G=e.cellToScreenRect(N,J),j=5,Q=G.x+G.width-1.5,ce=G.y+1.5,le=u-Q,Pe=y-ce;return le<=1&&Pe>=-1&&Pe-le<=j+1?{row:N,col:J}:null}const wt=t.ref(null),At=t.ref(null),Lt=18,Ot=2,Rl=2,sl=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 Ml(u,y,E,J,N,G){const j=Math.min(G,J/2,N/2);u.beginPath(),u.moveTo(y+j,E),u.arcTo(y+J,E,y+J,E+N,j),u.arcTo(y+J,E+N,y,E+N,j),u.arcTo(y,E+N,y,E,j),u.arcTo(y,E,y+J,E,j),u.closePath()}function Sl(u,y,E,J,N,G,j){if(J<q+4||N<10)return;const Q=y+J-q,ce=E+1,le=N-2;u.save(),G&&(u.fillStyle=j.selectionBg,u.fillRect(Q,ce,q,le)),u.fillStyle=j.activeCellBorder;const Pe=6,Ie=4,at=Q+q/2,Ke=ce+le/2;u.beginPath(),u.moveTo(at-Pe/2,Ke-Ie/2+.5),u.lineTo(at+Pe/2,Ke-Ie/2+.5),u.lineTo(at,Ke+Ie/2+.5),u.closePath(),u.fill(),u.restore()}function Gt(u,y,E,J,N){if(J<8||N<8)return;const G=5,j=y+J-1.5,Q=E+1.5;u.save(),u.fillStyle="#d93025",u.beginPath(),u.moveTo(j,Q),u.lineTo(j-G,Q),u.lineTo(j,Q+G),u.closePath(),u.fill(),u.restore()}function cl(u,y){if(e.dataValidations.length===0)return null;const E=e.screenToCell(u,y);if(!E)return null;const J=e.findMerge(E.col,E.row),N=J?J.range.startCol:E.col,G=J?J.range.startRow:E.row;if(!e.getListValidation(G,N))return null;const j=e.cellToScreenRect(G,N);if(j.width<q+4)return null;const Q=j.x+j.width-q;return u<Q||u>j.x+j.width||y<j.y||y>j.y+j.height?null:{col:N,row:G}}function ol(u,y){if(!e.editable.value)return!1;const E=e.getValidationDropdown(y,u);if(!E)return!1;const J=n.canvasRef.value;if(!J)return!1;e.activeCell.value.col===u&&e.activeCell.value.row===y||e.selectCell(u,y),e.ensureVisible(u,y),f();const N=e.cellToScreenRect(y,u),G=J.getBoundingClientRect();return At.value={col:u,row:y,rule:E.rule,items:E.items,current:e.getCellRaw(u,y),x:G.left+N.x,y:G.top+N.y,width:N.width,height:N.height},!0}function mn(){At.value&&(At.value=null,f())}async function P(u){var G;if(!e.editable.value)return;const y=At.value;if(!y)return;const{col:E,row:J}=y;At.value=null;const N=e.validateCell(J,E,u);if(!N.valid&&await e.confirmInvalidValue(N,E,J)!=="continue"){f(),n.focusEditInput();return}o.saveUndo(),e.setCellValue(E,J,u),(G=e.emitModelData)==null||G.call(e),f(),n.focusEditInput()}function K(u,y,E,J,N,G,j){const Q=Math.min(J,Lt)-Ot,ce=y+J-Q-Ot,le=E+Ot,Pe=N-2*Ot;u.save(),u.fillStyle=G?j.activeCellBorder:"#ececec",Ml(u,ce,le,Q,Pe,Rl),u.fill();const Ie=Math.min(Q,Pe)*.72;u.translate(ce+Q/2,le+Pe/2),u.scale(Ie/1024,Ie/1024),u.translate(-512,-512),u.fillStyle=G?"#ffffff":"#5a5a5a",u.fill(sl),u.restore()}function Z(u,y){const E=e.getFilter();if(!E)return-1;const J=e.screenToCell(u,y);if(!J)return-1;const{col:N,row:G}=J;if(G!==E.range.startRow||N<E.range.startCol||N>E.range.endCol)return-1;const j=e.cellToScreenRect(G,N),Q=Math.min(j.width,Lt)-Ot,ce=j.x+j.width-Q-Ot,le=j.x+j.width-Ot;return u>=ce&&u<=le&&y>=j.y+Ot&&y<=j.y+j.height-Ot?N:-1}function ve(u){if(!e.editable.value)return;const y=e.getFilter();if(!y)return;const E=n.canvasRef.value;if(!E)return;const J=E.getBoundingClientRect(),N=e.cellToScreenRect(y.range.startRow,u);wt.value={col:u,x:J.left+N.x+N.width-Lt,y:J.top+N.y+2}}function Fe(){wt.value=null}let Ve=null,We=null;function Re(){Ve&&(document.removeEventListener("click",Ve),Ve=null),We&&(document.removeEventListener("touchstart",We,{capture:!0}),We=null)}function Ue(u,y){const E=e.getOutlineLevel("row"),J=e.getOutlineLevel("column"),N=e.rowPositions.value,G=e.colPositions.value,j=e.scrollX.value,Q=e.scrollY.value,ce=Ce/2+1;if(y>=ie())for(const le of e.getRowOutlines()){const Pe=Ne(le,E),Ie=ie()+N[le.start]-Q;if(Math.abs(u-Pe)<=ce&&Math.abs(y-Ie)<=ce)return{kind:"toggle",outlineId:le.id}}if(u>=pe())for(const le of e.getColumnOutlines()){const Pe=ft(le,J),Ie=pe()+G[le.start]-j;if(Math.abs(y-Pe)<=ce&&Math.abs(u-Ie)<=ce)return{kind:"toggle",outlineId:le.id}}return null}function ke(u){for(const y of u)e.removeOutline(y);n.emitModelData(),f()}function st(u){const y=e.selection.value;if(!y)return Y("outlineNeedRowsOrColumns"),!1;let E;if(u==="row"){if(y.startCol!==0||y.endCol!==e.colCount-1)return Y("outlineNeedRowsOrColumns"),!1;if(y.startRow===y.endRow)return Y("outlineInvalidRange"),!1;E=e.addRowGroup(y.startRow,y.endRow)}else{if(y.startRow!==0||y.endRow!==e.rowCount-1)return Y("outlineNeedRowsOrColumns"),!1;if(y.startCol===y.endCol)return Y("outlineInvalidRange"),!1;E=e.addColumnGroup(y.startCol,y.endCol)}return E.ok?!0:(Y(E.code==="outlineCrossing"?"outlineCrossing":E.code==="outlineTooDeep"?"outlineTooDeep":"outlineInvalidRange"),!1)}function he(u){const y=e.selection.value;if(!y||u==="row"&&(y.startCol!==0||y.endCol!==e.colCount-1)||u==="column"&&(y.startRow!==0||y.endRow!==e.rowCount-1))return Y("outlineNeedRowsOrColumns"),!1;const E=u==="row"?e.getRowOutlines():e.getColumnOutlines(),J=u==="row"?y.startRow:y.startCol,N=u==="row"?y.endRow:y.endCol,G=E.filter(j=>J<=j.start&&j.end<=N);return G.length?(ke(G.map(j=>j.id)),!0):(Y("outlineUngroupPartial"),!1)}function R(u,y){const E=u==="row"?e.getRowOutlines():e.getColumnOutlines();if(E.length&&!E.every(J=>J.collapsed===y)){o.saveUndo();for(const J of E)e.setOutlineCollapsed(J.id,y,!0);n.emitModelData(),f()}}function Y(u){const y=b(e.locale.value,u);if(d){d(y);return}window.alert(y)}function de(u,y,E){Re();const J=140,N=E.length*28+8,G=Vl(n.wrapperRef.value),j=G.right,Q=G.bottom;u+J>j&&(u-=J),y+N>Q&&(y-=N),xe.value=!1,ye.value={x:u,y,items:E},t.nextTick(()=>$e()),Ve=()=>{ye.value=null,Re()},We=ce=>{const le=ce.target;le&&le.closest(".context-menu")||(ye.value=null,Re())},setTimeout(()=>{document.addEventListener("click",Ve,{once:!0}),document.addEventListener("touchstart",We,{capture:!0})},0)}const xe=t.ref(!1);function Me(u,y){}function $e(){const y=document.querySelector(".context-menu"),E=ye.value;if(!y||!E){xe.value=!1;return}const J=E.x+140,N=Vl(n.wrapperRef.value),G=N.right,j=N.bottom,Q=y.style.transform;y.style.transform="none";let ce=0;if(y.querySelectorAll(".context-menu__item").forEach(Pe=>{const Ie=Pe.querySelector(":scope > .context-submenu");if(!Ie)return;const at=Ie.style.display;Ie.style.display="block";const Ke=Ie.getBoundingClientRect(),D=Ke.width,c=Ke.height;Ie.style.display=at,D>ce&&(ce=D),Pe.getBoundingClientRect().top+c>j-8?(Ie.style.top="auto",Ie.style.bottom="-5px"):(Ie.style.top="",Ie.style.bottom="")}),y.style.transform=Q,ce===0){xe.value=!0;return}const le=G-J;xe.value=le<ce+8}function O(u,y){u.preventDefault(),u.stopPropagation();const E=!e.editable.value;de(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.addSheet(),f()},disabled:E},{label:b(e.locale.value,"copy"),action:()=>{n.dupSheet(y)},disabled:E},{label:b(e.locale.value,"rename"),action:()=>{L(y)},disabled:E},{label:b(e.locale.value,"delete"),action:()=>{n.removeSheet(y),f()},disabled:E||n.sheetCount.value<=1},{label:b(e.locale.value,"moveSheetLeft"),action:()=>{n.moveSheet(y,-1)},disabled:E||y===0},{label:b(e.locale.value,"moveSheetRight"),action:()=>{n.moveSheet(y,1)},disabled:E||y===n.sheets.value.length-1}])}function g(u){if(u.preventDefault(),u.target.closest(".tab-item")||u.target.closest(".tab-bar__add-btn"))return;const y=!e.editable.value;de(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{n.addSheet(),f()},disabled:y}])}function M(u){u.preventDefault(),e.selectAll(),f();const y=!e.editable.value;de(u.clientX,u.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),n.emitModelData()},disabled:y},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})},disabled:y},{label:b(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.clearSelected();for(let E=0;E<e.colCount;E++)e.colWidths.value[E]=100;for(let E=0;E<e.rowCount;E++)e.rowHeights.value[E]=void 0;f(),n.emitModelData()},disabled:y}])}function Mt(u,y){u.preventDefault();const E=u.clientX,J=u.clientY,N=!e.editable.value,G=e.selection.value;G&&G.startCol===0&&G.endCol===e.colCount-1&&y>=G.startRow&&y<=G.endRow||(e.selectRange(0,y,e.colCount-1,y,"row"),f());const j=e.selection.value;de(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.saveUndo(),n.insertRows(j.startRow,j.startRow),e.selectRange(0,j.startRow,e.colCount-1,j.startRow,"row"),f(),n.emitModelData()},disabled:N},{label:b(e.locale.value,"cut"),action:()=>{o.saveUndo(),l.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,j.startRow,j.endRow),f(),n.emitModelData()},disabled:N},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})},disabled:N},{label:b(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.deleteRows(j.startRow,j.endRow),f(),n.emitModelData()},disabled:N},{label:`${b(e.locale.value,"rowHeight")}...`,action:()=>fo("row",E,J),disabled:N},{label:b(e.locale.value,"autoRowHeight"),action:()=>n.resetRowHeight(),disabled:N},{label:b(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(y+1,e.freeze.cols),f()},disabled:N},{label:b(e.locale.value,"outlineGroup"),children:[{label:b(e.locale.value,"outlineAddRowGroup"),action:()=>st("row"),disabled:N},{label:b(e.locale.value,"outlineUngroupRows"),action:()=>he("row"),disabled:N},{label:b(e.locale.value,"outlineClear"),action:()=>e.clearRowGroups(),disabled:N},{label:b(e.locale.value,"outlineExpandAll"),action:()=>R("row",!1)},{label:b(e.locale.value,"outlineCollapseAll"),action:()=>R("row",!0)}]}])}function Nt(u,y){u.preventDefault();const E=u.clientX,J=u.clientY,N=!e.editable.value,G=e.selection.value;G&&G.startRow===0&&G.endRow===e.rowCount-1&&y>=G.startCol&&y<=G.endCol||(e.selectRange(y,0,y,e.rowCount-1,"col"),f());const j=e.selection.value,Q=!n.canSortColumns(j.startCol,j.endCol);de(u.clientX,u.clientY,[{label:b(e.locale.value,"insert"),action:()=>{o.saveUndo(),n.insertCols(j.startCol,j.startCol),e.selectRange(j.startCol,0,j.startCol,e.rowCount-1,"col"),f(),n.emitModelData()},disabled:N},{label:b(e.locale.value,"cut"),action:()=>{o.saveUndo(),l.copyRowCol(),e.clearCellsInRange(j.startCol,j.endCol,0,e.rowCount-1),f(),n.emitModelData()},disabled:N},{label:b(e.locale.value,"copy"),action:()=>l.copyRowCol()},{label:b(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})},disabled:N},{label:b(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.deleteCols(j.startCol,j.endCol),f(),n.emitModelData()},disabled:N},{label:b(e.locale.value,"sort"),disabled:N||Q,children:[{label:b(e.locale.value,"sortAsc"),action:()=>{n.prepareSortConfirmation("asc")||n.sortSelectedColumns("asc")},disabled:N||Q},{label:b(e.locale.value,"sortDesc"),action:()=>{n.prepareSortConfirmation("desc")||n.sortSelectedColumns("desc")},disabled:N||Q}]},{label:`${b(e.locale.value,"colWidth")}...`,action:()=>fo("col",E,J),disabled:N},{label:b(e.locale.value,"defaultColWidth"),action:()=>n.resetColWidth(),disabled:N},{label:b(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,y+1),f()},disabled:N},{label:b(e.locale.value,"outlineGroup"),children:[{label:b(e.locale.value,"outlineAddColumnGroup"),action:()=>st("column"),disabled:N},{label:b(e.locale.value,"outlineUngroupColumns"),action:()=>he("column"),disabled:N},{label:b(e.locale.value,"outlineClear"),action:()=>e.clearColumnGroups(),disabled:N},{label:b(e.locale.value,"outlineExpandAll"),action:()=>R("column",!1)},{label:b(e.locale.value,"outlineCollapseAll"),action:()=>R("column",!0)}]}])}function qt(u,y,E){u.preventDefault(),e.isSelected(y,E)||(e.selectCell(y,E),f());const J=e.selection.value,N=!!(J&&J.startCol===J.endCol&&J.startRow===J.endRow),G=!e.editable.value;de(u.clientX,u.clientY,[{label:b(e.locale.value,"cut"),action:()=>{l.cutSelected(),n.emitModelData()},disabled:G},{label:b(e.locale.value,"copy"),action:()=>l.copyToClipboard()},{label:b(e.locale.value,"paste"),action:()=>{o.saveUndo(),l.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())})},disabled:G},{label:b(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.clearSelected(),f(),n.emitModelData()},disabled:G},{label:b(e.locale.value,"calculate"),disabled:G,children:[{label:b(e.locale.value,"sum"),action:l.sumSelected,disabled:N},{label:b(e.locale.value,"avg"),action:l.avgSelected,disabled:N},{label:b(e.locale.value,"count"),action:l.countSelected,disabled:N}]},{label:`${b(e.locale.value,"dv")}...`,action:()=>{var j;return(j=e.requestDataValidationDialog)==null?void 0:j.call(e)},disabled:G},{label:b(e.locale.value,"dvClearValidation"),action:()=>{o.saveUndo(),e.clearDataValidation(e.selection.value),f(),n.emitModelData()},disabled:G},...N?[{label:e.hasNote(E,y)?b(e.locale.value,"editNote"):b(e.locale.value,"newNote"),action:()=>yt(E,y),disabled:G},...e.hasNote(E,y)?[{label:b(e.locale.value,"deleteNote"),action:()=>k(E,y),disabled:G}]:[]]:[]])}const Ht=t.ref(null),rl=t.ref(null);let Hl=null,pn=null;function pl(){Hl&&(document.removeEventListener("mousedown",Hl),Hl=null),pn&&(document.removeEventListener("touchstart",pn),pn=null)}function fo(u,y,E){pl();const J=e.selection.value;let N="";if(J){const Pe=u==="row"?e.getRowHeight(J.startRow):e.colWidths.value[J.startCol];N=Pe!=null&&Pe>0?String(Math.round(Pe)):""}const G=220,j=118;let Q=y,ce=E;const le=Vl(n.wrapperRef.value);Q=Math.max(le.left+8,Math.min(le.right-G-8,Q)),ce=Math.max(le.top+8,Math.min(le.bottom-j-8,ce)),rl.value={type:u,x:Q,y:ce,value:N,error:""},Hl=()=>{rl.value=null},pn=()=>{rl.value=null},setTimeout(()=>{document.addEventListener("mousedown",Hl,{once:!0}),document.addEventListener("touchstart",pn,{once:!0})},0),t.nextTick(()=>{const Pe=Ht.value;Pe&&(Pe.focus(),Pe.select())})}function Tr(u){const y=rl.value;if(!y)return;const E=u.target,J=E.value,N=J.replace(/[^\d]/g,"");y.value=N,J!==N&&(E.value=N),y.error=""}function Vr(u){u.key==="Enter"?(u.preventDefault(),Ho()):u.key==="Escape"&&(u.preventDefault(),qn())}function Dr(){const u=rl.value;if(!u)return;const y=u.value.trim(),E=Number(y),J=u.type==="row",N=J?24:30,G=J?500:1e3;if(y===""||!Number.isFinite(E)){qn();return}const j=Math.max(N,Math.min(G,Math.round(E)));u.value=String(j),u.error=""}function Ho(){const u=rl.value,y=e.selection.value;if(!u||!y||!e.editable.value)return;const E=u.value.trim(),J=Number(E),N=u.type==="row",G=N?24:30,j=N?500:1e3;if(E===""||!Number.isFinite(J)){u.error=b(e.locale.value,"dimNumberError");return}if(J<G||J>j){u.error=b(e.locale.value,"dimRangeError").replace("{min}",String(G)).replace("{max}",String(j));return}const Q=J;if(o.saveUndo(),N)for(let ce=y.startRow;ce<=y.endRow;ce++)e.rowHeights.value[ce]=Q;else for(let ce=y.startCol;ce<=y.endCol;ce++)e.colWidths.value[ce]=Q;f(),n.emitModelData(),qn()}function qn(){pl(),rl.value=null}const Wo=t.computed(()=>{const u=!e.editingCell.value,y=e.editingCell.value??e.activeCell.value,E=y.col,J=y.row,N=e.resolveStyle(e.cells[e.cellKey(E,J)]),G=e.cellFontSize(E,J),j=typeof(N==null?void 0:N.fontFamily)=="string"&&N.fontFamily?N.fontFamily:Tn,Q=(N==null?void 0:N.fontWeight)==="bold"?"bold":"normal",ce=(N==null?void 0:N.fontStyle)==="italic"?"italic":"normal",le=(N==null?void 0:N.underline)==="underline"?"underline":(N==null?void 0:N.strikethrough)==="line-through"?"line-through":"none",Pe=(N==null?void 0:N.underline)==="underline"&&(N==null?void 0:N.strikethrough)==="line-through"?"underline line-through":le,Ie=typeof(N==null?void 0:N.color)=="string"?N.color:void 0,at=typeof(N==null?void 0:N.backgroundColor)=="string"?N.backgroundColor:void 0,Ke=typeof(N==null?void 0:N.numberFormat)=="string"?N.numberFormat:"",D=e.editValue.value??e.getCellValue(E,J),c=typeof(N==null?void 0:N.textAlign)=="string"?N.textAlign:cr(D,Ke)?"right":"left",h=typeof(N==null?void 0:N.verticalAlign)=="string"?N.verticalAlign:"top",C=e.findMerge(E,J),V=C?e.rowPositions.value[C.range.endRow+1]-e.rowPositions.value[J]:e.getRowHeight(J),z=2,{ascent:re,descent:me}=e.measureFontMetrics(j,G,Q,ce),Ee=re+me,Xe=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
+
`).length:1)*Ee,Ye=e.BASE_CELL_VPAD-z;let Qe=0,lt=0;h==="middle"?(Qe=Math.floor((V-Xe)/2),lt=Math.max(0,V-Xe-Qe)):h==="top"?(Qe=Ye,lt=Math.max(0,V-Xe-Qe)):h==="bottom"&&(lt=Ye,Qe=Math.max(0,V-Xe-lt));const kt=e.cellToScreenRect(J,E);return{left:`${kt.x}px`,top:`${kt.y}px`,width:`${kt.width}px`,height:`${kt.height}px`,fontFamily:j,fontSize:`${G}px`,lineHeight:1,fontWeight:Q,fontStyle:ce,textDecoration:Pe,textAlign:c,paddingTop:`${Qe}px`,paddingRight:"3px",paddingBottom:`${lt}px`,paddingLeft:"3px",opacity:u?0:1,pointerEvents:u?"none":"auto",color:u?"transparent":Ie,caretColor:u?"transparent":void 0,borderColor:u?"transparent":void 0,background:u?"transparent":at,boxShadow:u?"none":void 0}});function mo(){return Math.max(0,n.viewSize.w-pe()-11)}function po(){return Math.max(0,n.viewSize.h-ie()-11)}const ho=t.computed(()=>Math.max(0,mo()-e.getFrozenMetrics().frozenColumnsWidth)),go=t.computed(()=>Math.max(0,po()-e.getFrozenMetrics().frozenRowsHeight)),Fr=t.computed(()=>pe()+e.getFrozenMetrics().frozenColumnsWidth),Or=t.computed(()=>ie()+e.getFrozenMetrics().frozenRowsHeight),On=t.computed(()=>Math.max(0,ho.value-11*2)),In=t.computed(()=>Math.max(0,go.value-11*2)),An=t.computed(()=>n.maxScrollX.value<=0?On.value:Math.max(24,ho.value/e.totalWidth.value*On.value)),Yn=t.computed(()=>n.maxScrollX.value<=0?0:e.scrollX.value/n.maxScrollX.value*(On.value-An.value)),jn=t.computed(()=>n.maxScrollY.value<=0?In.value:Math.max(24,go.value/e.totalHeight.value*In.value)),bo=t.computed(()=>n.maxScrollY.value<=0?0:e.scrollY.value/n.maxScrollY.value*(In.value-jn.value));let hn=null,Xn=0,Ln=0;function Ir(u){u.preventDefault(),hn="v",Xn=u.clientY,Ln=e.scrollY.value,document.addEventListener("mousemove",Zn),document.addEventListener("mouseup",Jn)}function Ar(u){u.preventDefault(),hn="h",Xn=u.clientX,Ln=e.scrollX.value,document.addEventListener("mousemove",Zn),document.addEventListener("mouseup",Jn)}function Zn(u){if(hn==="v"){const E=(u.clientY-Xn)/(In.value-jn.value);n.clampScroll(null,Ln+E*n.maxScrollY.value),f()}else if(hn==="h"){const E=(u.clientX-Xn)/(On.value-An.value);n.clampScroll(Ln+E*n.maxScrollX.value,null),f()}}function Jn(){hn=null,document.removeEventListener("mousemove",Zn),document.removeEventListener("mouseup",Jn)}function Lr(u){if(hn)return;const y=u.currentTarget.getBoundingClientRect(),E=u.clientY-y.top;E<bo.value?n.clampScroll(null,e.scrollY.value-po()):E>bo.value+jn.value&&n.clampScroll(null,e.scrollY.value+po()),f()}function Uo(u){if(hn)return;const y=u.currentTarget.getBoundingClientRect(),E=u.clientX-y.left;E<Yn.value?n.clampScroll(e.scrollX.value-mo(),null):E>Yn.value+An.value&&n.clampScroll(e.scrollX.value+mo(),null),f()}let hl=!1,Nl=0,Bl=0,Qt=!1,gl=!1,gn=0,en=0,tn=0,Wl=0,zn=0,ln=0,Qn=0,eo=0,al=!1,Ul=!1,Ft=0,zt=0,dl="cell",yo=0,Po=-1,Ko=-1,yl=null,nn=!1,Pl=0,Kl=0,bn=!1,Zt=null,on=null,yn=0,Go=0;function Co(u,y){if(!e.editable.value)return!1;const E=e.selection.value;if(!E||e.editingCell.value||!Cr(E,E,e.merges).ok)return!1;const J=e.cellToScreenRect(E.endRow,E.endCol),N=J.x+J.width-6,G=J.y+J.height-6,j=4;return u>=N-j&&u<=N+6+j&&y>=G-j&&y<=G+6+j}function qo(){Zt=requestAnimationFrame(Yo)}function Yo(){if(!e.autoFillState.value.active||!on){Zt=null;return}const u=8;n.clampScroll(e.scrollX.value+on.x*u*.1,e.scrollY.value+on.y*u*.1);const y=e.screenToCell(yn,Go),E=e.autoFillState.value.sourceRange;if(y&&E){const J=$a(E,{col:y.col,row:y.row});J?e.autoFillState.value={...e.autoFillState.value,targetRange:J.targetRange,direction:J.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}f(),Zt=requestAnimationFrame(Yo)}function wo(){Zt!==null&&(cancelAnimationFrame(Zt),Zt=null),on=null}function jo(u,y){yn=u,Go=y;const E=e.screenToCell(u,y),J=e.autoFillState.value.sourceRange;if(E&&J){const le=$a(J,{col:E.col,row:E.row});le?e.autoFillState.value={...e.autoFillState.value,targetRange:le.targetRange,direction:le.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const N=30,G=n.viewSize.w,j=n.viewSize.h;let Q=0,ce=0;u<pe()+N?Q=-(pe()+N-u):u>G-11-N&&(Q=u-(G-11-N)),y<ie()+N?ce=-(ie()+N-y):y>j-11-N&&(ce=y-(j-11-N)),Q!==0||ce!==0?(on={x:Q,y:ce},Zt===null&&qo()):(on=null,Zt!==null&&(cancelAnimationFrame(Zt),Zt=null)),f()}function vo(){wo();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 Xo(u){var ce;if(u.button!==0)return;u.preventDefault(),ye.value=null;const y=Rn(u,n.canvasRef.value),E=cl(y.x,y.y);if(E){if(e.editingCell.value){e.commitEdit().then(le=>{le&&ol(E.col,E.row)});return}ol(E.col,E.row);return}if(((ce=tt.value)==null?void 0:ce.mode)==="edit")qe();else if(tt.value){const le=e.screenToCell(y.x,y.y);(!le||!e.hasNote(le.row,le.col))&&qe()}const J=Z(y.x,y.y);if(J>=0){ve(J);return}const N=Ue(y.x,y.y);if(N){N.kind==="toggle"&&(e.toggleOutline(N.outlineId),f(),n.emitModelData());return}if(y.y<ie()&&y.x>=pe()){const le=y.x-pe()+e.scrollX.value,Pe=I(y.x),Ie=Pe>=0?e.cellToScreenRect(0,Pe).x+e.colWidths.value[Pe]:-1;if(Pe>=0&&Math.abs(y.x-Ie)<=4){if(!e.editable.value)return;o.saveUndo(),Qt=!0,gn=Pe,tn=e.colWidths.value[Pe],Wl=le,f();return}}if(y.x<pe()&&y.y>=ie()){const le=y.y-ie()+e.scrollY.value,Pe=w(y.y),Ie=Pe>=0?e.cellToScreenRect(Pe,0).y+e.getRowHeight(Pe):-1;if(Pe>=0&&Math.abs(y.y-Ie)<=4){if(!e.editable.value)return;o.saveUndo(),gl=!0,en=Pe,tn=e.getRowHeight(Pe),Wl=le,f();return}}if(Co(y.x,y.y)){const le=e.selection.value;le&&(e.autoFillState.value={active:!0,sourceRange:{...le},targetRange:null,direction:null,preview:!0},f());return}if(y.x<pe()||y.y<ie()){{const le=n.formulaBarRef.value,Pe=!!(le&&typeof document<"u"&&document.activeElement===le);(e.editingCell.value||Pe||_e)&&dt()}if(y.y<ie()&&y.x>=pe()){const le=I(y.x);le>=0&&(e.selectRange(le,0,le,e.rowCount-1,"col"),hl=!0,Nl=le,Bl=0)}else if(y.x<pe()&&y.y>=ie()){const le=w(y.y);le>=0&&(e.selectRange(0,le,e.colCount-1,le,"row"),hl=!0,Nl=0,Bl=le)}else y.x<pe()&&y.y<ie()&&e.selectAll();f();return}const G=e.screenToCell(y.x,y.y);if(!G)return;const j=G.col,Q=G.row;{const le=n.formulaBarRef.value,Pe=!!(le&&typeof document<"u"&&document.activeElement===le);(e.editingCell.value||Pe||_e)&&dt()}if(u.shiftKey&&e.selection.value){const le=e.selection.value;e.selectRange(le.startCol,le.startRow,j,Q)}else e.selectCell(j,Q);if(e.hasNote(Q,j)){it(Q,j,"view"),n.emitModelData(),hl=!1,f();return}hl=!0,Nl=j,Bl=Q,n.focusEditInput(),f()}function zr(u){if(Qt){const j=Rn(u,n.canvasRef.value).x-pe()+e.scrollX.value-Wl,Q=tn+j;Q>=30&&Q<=1e3?e.colWidths.value[gn]=Q:Q<30?e.colWidths.value[gn]=30:e.colWidths.value[gn]=1e3,f();return}if(gl){const j=Rn(u,n.canvasRef.value).y-ie()+e.scrollY.value-Wl,Q=tn+j;Q>=24&&Q<=500?e.rowHeights.value[en]=Q:Q<24?e.rowHeights.value[en]=24:e.rowHeights.value[en]=500,f();return}if(e.autoFillState.value.active){const G=Rn(u,n.canvasRef.value);jo(G.x,G.y);return}if(!hl){const G=n.canvasRef.value;if(!G)return;if(o.paintFmt.value){G.style.cursor="copy";return}const j=Rn(u,G),Q=e.screenToCell(j.x,j.y);if(Q&&e.hasNote(Q.row,Q.col)&&(G.style.cursor="pointer"),Ue(j.x,j.y)){G.style.cursor="pointer";return}if(Z(j.x,j.y)>=0){G.style.cursor="pointer";return}if(cl(j.x,j.y)){G.style.cursor="pointer";return}if(j.y<ie()&&j.x>=pe()){const ce=I(j.x),le=ce>=0?e.cellToScreenRect(0,ce).x+e.colWidths.value[ce]:-1;if(ce>=0&&Math.abs(j.x-le)<=4){G.style.cursor="col-resize";return}}if(j.x<pe()&&j.y>=ie()){const ce=w(j.y),le=ce>=0?e.cellToScreenRect(ce,0).y+e.getRowHeight(ce):-1;if(ce>=0&&Math.abs(j.y-le)<=4){G.style.cursor="row-resize";return}}if(Co(j.x,j.y)){G.style.cursor="crosshair";return}G.style.cursor="cell";return}const y=Rn(u,n.canvasRef.value);if(Nl<0||Bl<0)return;if(y.x<pe()||y.y<ie()){if(y.y<ie()&&y.x>=pe()){const G=I(y.x);G>=0&&e.selectRange(Math.min(Nl,G),0,Math.max(Nl,G),e.rowCount-1,"col")}else if(y.x<pe()&&y.y>=ie()){const G=w(y.y);G>=0&&e.selectRange(0,Math.min(Bl,G),e.colCount-1,Math.max(Bl,G),"row")}f();return}const E=e.screenToCell(y.x,y.y);if(!E)return;const J=E.col,N=E.row;Bl===0&&Nl>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(Nl,J),0,Math.max(Nl,J),e.rowCount-1,"col"):Nl===0&&Bl>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Bl,N),e.colCount-1,Math.max(Bl,N),"row"):e.selectRange(Nl,Bl,J,N),f()}function $r(u){const y=Qt||gl;if(hl=!1,Qt=!1,gl=!1,y&&n.scheduleOptEmit(),e.autoFillState.value.active){vo();return}o.paintFmt.value&&o.applyPaintFormat()}function _r(){wo();const u=Qt||gl;hl=!1,Qt=!1,gl=!1,u&&n.scheduleOptEmit()}function Hr(u){u.preventDefault();const y=Rn(u,n.canvasRef.value);if(y.x<pe()&&y.y<ie()){M(u);return}if(y.y<ie()&&y.x>=pe()){const E=I(y.x);E>=0&&Nt(u,E);return}if(y.x<pe()&&y.y>=ie()){const E=w(y.y);E>=0&&Mt(u,E);return}if(y.x>=pe()&&y.y>=ie()){const E=e.screenToCell(y.x,y.y);E&&qt(u,E.col,E.row)}}function Wr(u){const y=Rn(u,n.canvasRef.value);if(y.x<pe()||y.y<ie())return;const E=e.screenToCell(y.x,y.y);if(!E)return;const J=E.col,N=E.row;{const G=n.formulaBarRef.value,j=!!(G&&typeof document<"u"&&document.activeElement===G);(e.editingCell.value||j||_e)&&dt()}e.selectCell(J,N),e.ensureVisible(J,N),e.startEdit(),f(),n.focusEditInput()}function Ur(u){const y=e.scrollX.value+u.deltaX,E=e.scrollY.value+u.deltaY,J=40,N=n.maxScrollX.value,G=n.maxScrollY.value;if(y>=N-J&&u.deltaX>0||E>=G-J&&u.deltaY>0){const j=Math.max(0,n.viewSize.w-28-11),Q=Math.max(0,n.viewSize.h-28-11),ce=Math.max(0,Math.ceil((y+j)/100)+2),le=Math.max(0,Math.ceil((E+Q)/24)+2);e.ensureCapacity(ce,le)}n.clampScroll(y,E),f()}function Pr(u){if(u.touches.length!==1){al=!1;return}const y=u.touches[0],E=n.canvasRef.value;if(!E)return;const J=E.getBoundingClientRect(),N=y.clientX-J.left,G=y.clientY-J.top,j=y.clientX,Q=y.clientY,ce=(Ie,at)=>({clientX:Ie,clientY:at,preventDefault(){}});{const Ie=n.formulaBarRef.value,at=!!(Ie&&typeof document<"u"&&document.activeElement===Ie);(e.editingCell.value||at||_e)&&dt()}const le=e.screenToCell(N,G);if(le&&e.hasNote(le.row,le.col)){u.preventDefault(),al=!0,Ul=!0,it(le.row,le.col,"view"),n.emitModelData();return}if(Co(N,G)){u.preventDefault();const Ie=e.selection.value;Ie&&(e.autoFillState.value={active:!0,sourceRange:{...Ie},targetRange:null,direction:null,preview:!0},al=!0,Ul=!1,dl="cell",zn=N,ln=G,Qn=e.scrollX.value,eo=e.scrollY.value);return}const Pe=Z(N,G);if(Pe>=0){u.preventDefault(),ve(Pe);return}if(G<ie()&&N>=pe()){const Ie=I(N);if(Ie>=0){const at=e.cellToScreenRect(0,Ie).x+e.colWidths.value[Ie];if(Math.abs(N-at)<=8){if(u.preventDefault(),!e.editable.value)return;o.saveUndo(),Qt=!0,gn=Ie,tn=e.colWidths.value[Ie],Wl=N-pe()+e.scrollX.value,al=!0,Ul=!1;return}}}if(N<pe()&&G>=ie()){const Ie=w(G);if(Ie>=0){const at=e.cellToScreenRect(Ie,0).y+e.getRowHeight(Ie);if(Math.abs(G-at)<=8){if(u.preventDefault(),!e.editable.value)return;o.saveUndo(),gl=!0,en=Ie,tn=e.getRowHeight(Ie),Wl=G-ie()+e.scrollY.value,al=!0,Ul=!1;return}}}N>=pe()&&G>=ie()?(u.preventDefault(),al=!0,Ul=!1,nn=!1,bn=!1,dl="cell",zn=N,ln=G,Qn=e.scrollX.value,eo=e.scrollY.value,Ft=I(N),zt=w(G),yl!==null&&clearTimeout(yl),yl=window.setTimeout(()=>{const Ie=e.selection.value;if(!!Ie&&Ft>=Ie.startCol&&Ft<=Ie.endCol&&zt>=Ie.startRow&&zt<=Ie.endRow){bn=!0,qt(ce(j,Q),Ft,zt);return}nn=!0,Pl=Ft,Kl=zt,Ft>=0&&zt>=0&&(e.selectCell(Ft,zt),f())},450)):N>=0&&G>=0&&(N<pe()||G<ie())&&(u.preventDefault(),al=!0,Ul=!1,nn=!1,zn=N,ln=G,Qn=e.scrollX.value,eo=e.scrollY.value,G<ie()&&N>=pe()?(dl="col",Ft=I(N),zt=-1):N<pe()&&G>=ie()?(dl="row",zt=w(G),Ft=-1):(dl="all",Ft=-1,zt=-1),(dl==="col"||dl==="row"||dl==="all")&&(yl!==null&&clearTimeout(yl),yl=window.setTimeout(()=>{const Ie=e.selection.value;if(dl==="all"){bn=!0,M(ce(j,Q));return}if(dl==="col"){if(!!Ie&&Ie.startRow===0&&Ie.endRow===e.rowCount-1&&Ft>=Ie.startCol&&Ft<=Ie.endCol){bn=!0,Nt(ce(j,Q),Ft);return}nn=!0,Pl=Ft,Kl=-1,Ft>=0&&(e.selectRange(Ft,0,Ft,e.rowCount-1,"col"),f())}else{if(!!Ie&&Ie.startCol===0&&Ie.endCol===e.colCount-1&&zt>=Ie.startRow&&zt<=Ie.endRow){bn=!0,Mt(ce(j,Q),zt);return}nn=!0,Pl=-1,Kl=zt,zt>=0&&(e.selectRange(0,zt,e.colCount-1,zt,"row"),f())}},450)))}function Zo(u){if(!al||u.touches.length!==1)return;const y=u.touches[0],E=n.canvasRef.value;if(!E)return;const J=E.getBoundingClientRect(),N=y.clientX-J.left,G=y.clientY-J.top;if(e.autoFillState.value.active){u.preventDefault(),jo(N,G);return}if(Qt){const j=N-pe()+e.scrollX.value-Wl;let Q=tn+j;Q=Q<30?30:Q>1e3?1e3:Q,e.colWidths.value[gn]=Q,u.preventDefault(),f();return}if(gl){const j=G-ie()+e.scrollY.value-Wl;let Q=tn+j;Q=Q<24?24:Q>500?500:Q,e.rowHeights.value[en]=Q,u.preventDefault(),f();return}if(nn){if(u.preventDefault(),Pl>=0&&Kl>=0){const j=I(N),Q=w(G);j>=0&&Q>=0&&(e.selectRange(Pl,Kl,j,Q),f())}else if(Kl===-1&&Pl>=0){const j=I(N);j>=0&&(e.selectRange(Math.min(Pl,j),0,Math.max(Pl,j),e.rowCount-1,"col"),f())}else if(Pl===-1&&Kl>=0){const j=w(G);j>=0&&(e.selectRange(0,Math.min(Kl,j),e.colCount-1,Math.max(Kl,j),"row"),f())}return}yl!==null&&(clearTimeout(yl),yl=null),(Math.abs(N-zn)>8||Math.abs(G-ln)>8)&&(Ul=!0,u.preventDefault(),n.clampScroll(Qn+(zn-N),eo+(ln-G)),f())}function Kr(){if(al){if(yl!==null&&(clearTimeout(yl),yl=null),bn){bn=!1,al=!1;return}if(e.autoFillState.value.active){vo(),al=!1;return}if(Qt||gl){Qt=!1,gl=!1,n.scheduleOptEmit(),o.paintFmt.value&&o.applyPaintFormat(),al=!1;return}if(nn){nn=!1,o.paintFmt.value&&o.applyPaintFormat(),al=!1;return}if(al=!1,!Ul){if(dl==="cell"&&Ft>=0&&zt>=0){tt.value&&qe();const u=Date.now();Ft===Po&&zt===Ko&&u-yo<300?(e.selectCell(Ft,zt),e.startEdit(),f(),n.focusEditInput(),yo=0):(e.commitEdit(),e.selectCell(Ft,zt),f(),yo=u),Po=Ft,Ko=zt,n.focusEditInput()}else dl==="col"&&Ft>=0?(e.commitEdit(),e.selectRange(Ft,0,Ft,e.rowCount-1,"col"),f()):dl==="row"&&zt>=0?(e.commitEdit(),e.selectRange(0,zt,e.colCount-1,zt,"row"),f()):dl==="all"&&(e.commitEdit(),e.selectAll(),f());o.paintFmt.value&&!e.editingCell.value&&o.applyPaintFormat()}}}function ko(u){return u.isComposing||u.key==="Process"||u.keyCode===229}function Jo(u){return u.key.length===1&&!u.ctrlKey&&!u.metaKey&&!u.altKey}function Qo(u){if(e.autoFillState.value.active){u.key==="Escape"&&(u.preventDefault(),wo(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},f());return}if(e.editingCell.value)return;const y=u.ctrlKey||u.metaKey,E=u.shiftKey;switch(!0){case(u.altKey&&u.key==="ArrowDown"):u.preventDefault(),ol(e.activeCell.value.col,e.activeCell.value.row);return;case(y&&(u.key==="c"||u.key==="C")):u.preventDefault(),l.copyToClipboard();return;case(y&&(u.key==="x"||u.key==="X")):if(u.preventDefault(),!e.editable.value)return;l.cutSelected();return;case(y&&(u.key==="z"||u.key==="Z")):if(u.preventDefault(),!e.editable.value)return;o.undo();return;case(y&&(u.key==="y"||u.key==="Y")):if(u.preventDefault(),!e.editable.value)return;o.redo();return;case(y&&(u.key==="v"||u.key==="V")):if(u.preventDefault(),!e.editable.value)return;o.saveUndo(),l.pasteFromClipboard().then(()=>{f(),t.nextTick(()=>n.emitModelData())});return;case(y&&(u.key==="a"||u.key==="A")):u.preventDefault(),e.selectAll(),f();return;case(y&&E&&(u.key==="l"||u.key==="L")):if(u.preventDefault(),!e.editable.value)return;e.toggleAutoFilter(),f();return;case(y&&u.key==="Home"):u.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),f();return;case(y&&u.key==="End"):u.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),f();return;case u.key==="Home":u.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),f();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),f();return;case u.key==="ArrowUp":u.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="ArrowDown":u.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="ArrowLeft":u.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="ArrowRight":u.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="Tab":u.preventDefault(),e.moveActive(E?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="Enter":u.preventDefault(),e.moveActive(0,E?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f();return;case u.key==="F2":if(u.preventDefault(),!e.editable.value)return;e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),f(),n.focusEditInput();return;case(E&&u.key==="F2"):if(u.preventDefault(),!e.editable.value)return;yt(e.activeCell.value.row,e.activeCell.value.col);return;case u.key==="Delete":case u.key==="Backspace":if(u.preventDefault(),!e.editable.value)return;o.saveUndo(),l.clearSelected(),f();return;case u.key==="Escape":u.preventDefault(),e.cancelEdit(),o.paintFmt.value=null,f();return;case Jo(u):if(!e.editable.value)return;if(ko(u)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),f(),n.focusEditInput();return}u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(u.key),f(),t.nextTick(()=>{const J=n.editInputRef.value;J&&(J.focus(),J.setSelectionRange(1,1))});return}}let Eo=!1,$n=!1;function Gr(u){const y=u.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(y),oe.value=y,f();return}e.editValue.value=y,oe.value=y}function er(){Eo=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),oe.value="",f())}function qr(u){Eo=!1,$n=!0,setTimeout(()=>{$n=!1},0);const y=u.target.value;e.editValue.value=y,oe.value=y}function Yr(u){if(!e.editingCell.value){if(Jo(u)||ko(u))return;Qo(u);return}if(!(Eo||ko(u))&&!($n&&(u.key==="Enter"||u.key==="Escape")))if(u.key==="Enter"&&(u.altKey||u.metaKey)){u.preventDefault();const y=n.editInputRef.value;if(!y)return;const E=y.selectionStart??y.value.length,J=y.selectionEnd??y.value.length,N=y.value,G=N.slice(0,E)+`
|
|
9
|
+
`+N.slice(J);e.editValue.value=G,y.value=G,y.selectionStart=y.selectionEnd=E+1,f()}else u.key==="Enter"?(u.preventDefault(),e.commitEdit().then(y=>{if(!y){f(),n.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f(),n.focusEditInput()})):u.key==="Tab"?(u.preventDefault(),e.commitEdit().then(y=>{if(!y){f(),n.focusEditInput();return}e.moveActive(u.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),f(),n.focusEditInput()})):u.key==="Escape"&&(u.preventDefault(),e.cancelEdit(),f(),n.focusEditInput())}function jr(u){e.editingCell.value}function Xr(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>f())},0)}let Cl=null;function Bn(){var y;const u=(y=n.wrapperRef.value)==null?void 0:y.getBoundingClientRect();if(u){const E=Vn(e.props.width),J=Vn(e.props.height);E!=null?n.viewSize.w=E:n.viewSize.w=u.width,J!=null?n.viewSize.h=J:n.viewSize.h=u.height}n.clampScroll(null,null),f()}function tr(){t.onMounted(()=>{const u=Vn(e.props.width),y=Vn(e.props.height);(u==null||y==null)&&(Cl=new ResizeObserver(()=>Bn()),n.wrapperRef.value&&Cl.observe(n.wrapperRef.value)),t.nextTick(()=>{Bn(),n.focusEditInput()}),e.selectCell(0,0),n.modelData.value&&n.modelData.value.length>0&&(a.value=JSON.stringify(n.modelData.value),n.sheets.value=n.modelData.value.map(E=>{const J=wi(E,{colCount:e.props.colCount,rowCount:e.props.rowCount}),N=n.mkSheet(E.name,J),{cells:G,styles:j}=ii(E.cells);if(Object.assign(N.cells,G),N.styles=E.styles??j,E.borders)N.borders=E.borders;else{const Q=si(N.styles);N.styles=Q.styles,N.borders=Q.borders}if(E.colWidths)for(const[Q,ce]of Object.entries(E.colWidths)){const le=Number(Q);le>=0&&le<N.colCount&&ce>=30&&(N.colWidths[le]=ce)}if(E.rowHeights)for(const[Q,ce]of Object.entries(E.rowHeights)){const le=Number(Q);le>=0&&le<N.rowCount&&ce>=24&&(N.rowHeights[le]=ce)}if(E.merges)for(const[Q,ce]of Object.entries(E.merges))N.merges[Q]={...ce};return N.freeze=E.freeze?{rows:E.freeze.rows,cols:E.freeze.cols}:{rows:0,cols:0},N.filter=ki(E.filter,N.cells),N.dataValidations=Array.isArray(E.dataValidations)?[...E.dataValidations]:[],N.notes=E.notes?Object.fromEntries(Object.entries(E.notes).map(([Q,ce])=>[Q,{...ce}])):{},N}),n.sheets.value.length>0&&n.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const u=Vn(e.props.width),y=Vn(e.props.height);u!=null&&y!=null?(Cl==null||Cl.disconnect(),Cl=null):!Cl&&n.wrapperRef.value&&(Cl=new ResizeObserver(()=>Bn()),Cl.observe(n.wrapperRef.value)),t.nextTick(()=>Bn())}),t.watch(()=>e.props.theme,()=>{S=ci(e.props.theme),f()}),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>n.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>n.emitModelData()),f()},{deep:!1}),t.watch(n.activeSheetIndex,()=>t.nextTick(()=>n.emitModelData())),t.watch(()=>n.modelData.value,u=>{if(!u||u.length===0)return;const y=JSON.stringify(u);if(y===a.value)return;a.value=y;const E=e.selection.value?{...e.selection.value}:null,J={...e.activeCell.value};n.sheets.value=u.map(Q=>{const ce=wi(Q,{colCount:e.props.colCount,rowCount:e.props.rowCount}),le=n.mkSheet(Q.name,ce),{cells:Pe,styles:Ie}=ii(Q.cells);if(Object.assign(le.cells,Pe),le.styles=Q.styles??Ie,Q.borders)le.borders=Q.borders;else{const at=si(le.styles);le.styles=at.styles,le.borders=at.borders}if(Q.colWidths)for(const[at,Ke]of Object.entries(Q.colWidths)){const D=Number(at);D>=0&&D<le.colCount&&Ke>=30&&(le.colWidths[D]=Ke)}if(Q.rowHeights)for(const[at,Ke]of Object.entries(Q.rowHeights)){const D=Number(at);D>=0&&D<le.rowCount&&Ke>=24&&(le.rowHeights[D]=Ke)}if(Q.merges)for(const[at,Ke]of Object.entries(Q.merges))le.merges[at]={...Ke};return le.freeze=Q.freeze?{rows:Q.freeze.rows,cols:Q.freeze.cols}:{rows:0,cols:0},le.filter=ki(Q.filter,le.cells),le.dataValidations=Array.isArray(Q.dataValidations)?[...Q.dataValidations]:[],le.rowOutlines=Array.isArray(Q.rowOutlines)?Q.rowOutlines.map(at=>({...at})):[],le.columnOutlines=Array.isArray(Q.columnOutlines)?Q.columnOutlines.map(at=>({...at})):[],le.notes=Q.notes?Object.fromEntries(Object.entries(Q.notes).map(([at,Ke])=>[at,{...Ke}])):{},le}),n.sheets.value.length>0&&n.loadSheet(0),E&&(e.selection.value=E),e.activeCell.value=J;const N=e.activeCell.value,G=e.selection.value,j=e.findMerge(N.col,N.row);j&&j.anchor===e.cellKey(N.col,N.row)&&(!G||G.startCol===N.col&&G.startRow===N.row&&G.endCol===N.col&&G.endRow===N.row)&&e.selectCell(N.col,N.row),f()},{deep:!0}),t.onBeforeUnmount(()=>{Cl==null||Cl.disconnect()})}return{scheduleRender:f,render:v,renderFrozenOverlay:A,activeCellLabel:Je,formulaBarDisplay:Be,formulaBarDraft:oe,formulaBarExpanded:we,onFormulaBarFocus:rt,onFormulaBarInput:se,onFormulaBarKeydown:T,onFormulaBarBlur:ne,acceptFormulaBarEdit:dt,cancelFormulaBarEdit:ht,insertFunctionIntoCell:ue,renTab:W,renTabVal:F,onTabClick:_,onTabDblClick:L,commitTabRename:x,cclTabRename:U,onTabRenameKd:te,ctxMenu:ye,ctxSubmenuLeft:xe,filterPopup:wt,isFilterButtonHit:Z,openFilterPopup:ve,closeFilterPopup:Fe,validationDropdown:At,isValidationDropdownHit:cl,openValidationDropdown:ol,closeValidationDropdown:mn,onValidationDropdownSelect:P,onCtxItemEnter:Me,onTabCtxMenu:O,onTabBarCtx:g,onCornerCtx:M,onRowHdrCtx:Mt,onColHdrCtx:Nt,onCellCtx:qt,noteUi:tt,openNote:it,closeNote:qe,editNoteAt:yt,saveNoteAt:He,removeNoteAt:k,isNoteIndicatorHit:ee,dimInputRef:Ht,dimPanel:rl,openDimPanel:fo,onDimInput:Tr,onDimKeydown:Vr,onDimBlur:Dr,applyDimPanel:Ho,closeDimPanel:qn,outlineGroupRows:()=>st("row"),outlineGroupCols:()=>st("column"),outlineUngroupRows:()=>he("row"),outlineUngroupCols:()=>he("column"),outlineExpandRows:()=>R("row",!1),outlineCollapseRows:()=>R("row",!0),outlineExpandCols:()=>R("column",!1),outlineCollapseCols:()=>R("column",!0),get showOutlineAlert(){return d},set showOutlineAlert(u){d=u},editInputStyle:Wo,hScrollbarW:ho,vScrollbarH:go,hScrollbarLeft:Fr,vScrollbarTop:Or,hTrackW:On,vTrackH:In,hThumbW:An,hThumbL:Yn,vThumbH:jn,vThumbT:bo,onVStart:Ir,onHStart:Ar,onSbMove:Zn,onSbUp:Jn,onVTrk:Lr,onHTrk:Uo,onMouseDown:Xo,onMouseMove:zr,onMouseUp:$r,onMouseLeave:_r,onCanvasCtx:Hr,onDblClick:Wr,onWheel:Ur,onTouchStart:Pr,onTouchMove:Zo,onTouchEnd:Kr,onKeydown:Qo,onEditInput:Gr,onEditCompositionStart:er,onEditCompositionEnd:qr,onEditKd:Yr,onEditPaste:jr,onEditBlur:Xr,applySize:Bn,setupLifecycle:tr}}function Lp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ei(e,o,l,n){return o?n?l?e===o:e.toLowerCase()===o.toLowerCase():l?e.includes(o):e.toLowerCase().includes(o.toLowerCase()):!1}function zp(e,o,l,n){if(!o)return e;if(n){const i=e.indexOf(o);return i<0?e:e.slice(0,i)+l+e.slice(i+o.length)}const a=e.toLowerCase().indexOf(o.toLowerCase());return a<0?e:e.slice(0,a)+l+e.slice(a+o.length)}function $p(e,o,l,n){return o?n?e.indexOf(o)<0?e:e.split(o).join(l):e.toLowerCase().indexOf(o.toLowerCase())<0?e:e.replace(new RegExp(Lp(o),"gi"),()=>l):e}function xr(e,o,l,n,a,i,r){const s=[];if(r){for(let d=r.startRow;d<=r.endRow;d++)for(let m=r.startCol;m<=r.endCol;m++){const p=e[l(m,d)];p&&Ei(p.value,n,a,i)&&s.push({sheetIndex:o,col:m,row:d})}return s}for(const d in e){const m=e[d];if(m&&Ei(m.value,n,a,i)){const p=d.split(","),B=Number(p[0]),f=Number(p[1]);!Number.isNaN(B)&&!Number.isNaN(f)&&s.push({sheetIndex:o,col:B,row:f})}}return s}function _p(e,o,l,n){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),s=t.ref("sheet"),d=t.ref(!1),m=t.ref(!1),p=t.ref(-1),B=t.ref([]),f=t.ref(""),I=t.ref(0),w=t.ref(""),S=t.computed(()=>{const oe=new Set,we=l.activeSheetIndex.value;for(const Be of B.value)Be.sheetIndex===we&&oe.add(`${Be.col},${Be.row}`);return oe}),$=t.computed(()=>{if(p.value<0||p.value>=B.value.length)return null;const oe=B.value[p.value];return oe.sheetIndex!==l.activeSheetIndex.value?null:`${oe.col},${oe.row}`});e.findHighlight=(oe,we)=>{const Be=`${oe},${we}`;return $.value===Be?"active":S.value.has(Be)?"match":null};function q(oe){var rt,se;const we=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===l.activeSheetIndex.value)return((rt=e.cells[we])==null?void 0:rt.value)??"";const Be=l.sheets.value[oe.sheetIndex];return((se=Be==null?void 0:Be.cells[we])==null?void 0:se.value)??""}function ae(oe,we){const Be=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===l.activeSheetIndex.value)e.setCellValue(oe.col,oe.row,we);else{const rt=l.sheets.value[oe.sheetIndex];if(!rt)return;const se=rt.cells[Be];rt.cells[Be]={value:String(we),styleId:se==null?void 0:se.styleId}}}function fe(){if(w.value){f.value=w.value;return}if(!i.value){f.value="";return}if(s.value==="selection"&&!e.selection.value){f.value=b(e.locale.value,"findNeedSelection");return}if(B.value.length===0){f.value=b(e.locale.value,"findNoResult");return}f.value=""}function Ce(){const oe=i.value,we=[];if(oe)if(s.value==="workbook")l.sheets.value.forEach((Be,rt)=>{we.push(...xr(Be.cells,rt,e.cellKey,oe,d.value,m.value))});else if(s.value==="selection"){const Be=e.selection.value;Be&&we.push(...xr(e.cells,l.activeSheetIndex.value,e.cellKey,oe,d.value,m.value,Be))}else we.push(...xr(e.cells,l.activeSheetIndex.value,e.cellKey,oe,d.value,m.value));B.value=we,we.length===0?p.value=-1:p.value>=we.length?p.value=we.length-1:p.value<0&&(p.value=0),fe()}function Se(){if(p.value<0||p.value>=B.value.length)return;const oe=B.value[p.value];oe.sheetIndex!==l.activeSheetIndex.value&&l.switchSheet(oe.sheetIndex),s.value==="selection"?e.activeCell.value={col:oe.col,row:oe.row}:e.selectCell(oe.col,oe.row),e.ensureVisible(oe.col,oe.row)}const be=typeof requestAnimationFrame=="function"?requestAnimationFrame:oe=>setTimeout(oe,16);let Ge=!1,pe=!1;function ie(oe){if(Ge){pe=pe||oe;return}Ge=!0,pe=oe,be(()=>{var we;Ge=!1,Ce(),pe&&B.value.length>0&&p.value>=0&&Se(),pe=!1,(we=e.scheduleRender)==null||we.call(e)})}function Ne(){var oe;a.value=!0,I.value++,Ce(),B.value.length>0&&(p.value=0,Se()),(oe=e.scheduleRender)==null||oe.call(e)}function ft(){Ne()}function mt(){var oe;a.value=!1,B.value=[],p.value=-1,w.value="",f.value="",(oe=e.scheduleRender)==null||oe.call(e)}function v(){var oe;B.value.length!==0&&(p.value=(p.value+1)%B.value.length,Se(),(oe=e.scheduleRender)==null||oe.call(e))}function A(){var oe;B.value.length!==0&&(p.value=(p.value-1+B.value.length)%B.value.length,Se(),(oe=e.scheduleRender)==null||oe.call(e))}function X(){var se,ue;if(!e.editable.value||p.value<0||p.value>=B.value.length)return;const oe=B.value[p.value],we=q(oe),Be=zp(we,i.value,r.value,d.value);if(Be===we)return;o.saveUndo(),ae(oe,Be);const rt=p.value;Ce(),B.value.length>0?(p.value=Math.min(rt,B.value.length-1),v()):p.value=-1,(se=e.emitModelData)==null||se.call(e),(ue=e.scheduleRender)==null||ue.call(e)}function ze(){var rt,se;if(!e.editable.value)return;const oe=i.value;if(!oe||B.value.length===0)return;o.saveUndo();let we=0;const Be=B.value.slice();for(const ue of Be){const Le=q(ue),_e=$p(Le,oe,r.value,d.value);_e!==Le&&(ae(ue,_e),we++)}B.value=[],p.value=-1,w.value=b(e.locale.value,"findReplacedAll").replace("{n}",String(we)),fe(),(rt=e.emitModelData)==null||rt.call(e),(se=e.scheduleRender)==null||se.call(e)}function Je(){const oe=we=>{if(!(we.ctrlKey||we.metaKey))return;const rt=we.key.toLowerCase();(rt==="f"||rt==="h")&&(we.preventDefault(),Ne())};window.addEventListener("keydown",oe),t.onBeforeUnmount(()=>window.removeEventListener("keydown",oe))}return t.watch(i,()=>{a.value&&(w.value="",p.value=0,ie(!0))}),t.watch([s,d,m],()=>{a.value&&(w.value="",p.value=0,ie(!0))}),t.watch(e.cells,()=>{a.value&&ie(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&s.value==="selection"&&(p.value=0,ie(!0))}),t.watch([()=>o.undoStack.value.length,()=>o.redoStack.value.length],()=>{a.value&&ie(!1)}),{open:a,findText:i,replaceText:r,scope:s,matchCase:d,matchEntireCell:m,currentIndex:p,results:B,message:f,focusToken:I,activeSheetMatches:S,activeMatchKey:$,openFind:Ne,openReplace:ft,close:mt,recompute:Ce,findNext:v,findPrev:A,replace:X,replaceAll:ze,setupLifecycle:Je}}const Hp={class:"formula-bar__cell-label"},Wp={key:0,class:"formula-bar__buttons"},Up=["title","aria-label"],Pp=["title","aria-label"],Kp=["title","aria-label"],Gp=["rows","value","readonly"],qp=["title"],Yp={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},jp={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Xp=["value"],Zp={key:2,class:"sb-corner"},Jp=["onClick","onMouseenter"],Qp={class:"context-menu__label"},e2={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},t2=["onClick"],l2={class:"dim-panel__title"},n2={class:"dim-panel__body"},o2=["value"],r2={key:0,class:"dim-panel__error"},a2={class:"dim-panel__footer"},Ri=_t(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"},noteAuthor:{default:Zr},editable:{type:Boolean,default:!0}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const o=e,l=t.useModel(e,"data"),n={value:""},a=pp(o,{rowCount:o.rowCount,colCount:o.colCount,theme:o.theme,locale:o.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:O=>{},mkSheet:O=>({id:"",name:O,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:[],notes:{}})},r=hp(a,i),s=Sp(a,r);gp(r,{borderMenuOpen:s.borderMenuOpen,mergeMenuOpen:s.mergeMenuOpen});const d=Ip(a,r,l,void 0,n);i.sheets=d.sheets,i.activeSheetIndex=d.activeSheetIndex,i.saveSheet=d.saveSheet,i.loadSheet=d.loadSheet,i.mkSheet=d.mkSheet;const m=t.computed(()=>o.theme);t.provide("sp-theme",m);const p=Ap(a,r,s,d,n);p.setupLifecycle();const B=_p(a,r,d);B.setupLifecycle();const f=t.reactive(a);t.watch(()=>o.editable,O=>{a.editable.value=O??!0},{immediate:!0});function I(){var O;ne.value=!1,W.value=!1,k.value=!1,Be.value=!1,r.nfDialogOpen.value=!1,d.sortConfirmOpen.value=!1,((O=p.noteUi.value)==null?void 0:O.mode)==="edit"&&p.closeNote(),p.ctxMenu.value=null,p.closeFilterPopup(),p.closeValidationDropdown()}t.watch(()=>o.editable,O=>{O===!1&&I()});const w=t.reactive(r),S=t.reactive(s),$=t.reactive(d),q=d.sheets,ae=d.activeSheetIndex,fe=d.sortMenuOpen,Ce=d.cachedSortOrder,Se=t.ref(!1),be=t.ref(!1),Ge=t.ref(!1),pe=t.ref(!1),ie=t.ref(!1),Ne=t.ref(!1),ft=t.ref(!1),mt=t.computed(()=>{const O=f.selection;return O?O.startCol===0&&O.endCol===f.colCount-1?"rows":O.startRow===0&&O.endRow===f.rowCount-1?"cols":null:null}),v=t.reactive(p),A=t.reactive(B),X=t.computed(()=>{const O=f.selection;return!!O&&O.startCol===O.endCol&&O.startRow===O.endRow}),ze=t.computed(()=>{const O=f.selection;return O?d.canSortColumns(O.startCol,O.endCol):!1}),Je=t.computed(()=>{if(f.getFilter()!==null)return!0;const O=f.selection;if(!O)return!0;const g=Math.min(O.startCol,O.endCol),M=Math.max(O.startCol,O.endCol),Mt=Math.min(O.startRow,O.endRow),Nt=Math.max(O.startRow,O.endRow);for(const qt in f.merges){const Ht=f.merges[qt];if(!(Ht.startCol===Ht.endCol&&Ht.startRow===Ht.endRow)&&g<=Ht.endCol&&M>=Ht.startCol&&Mt<=Ht.endRow&&Nt>=Ht.startRow)return!1}return!0}),oe=t.computed(()=>{const O=w.selNumberFormat;if(O!==Xl&&O!==cn)return O;const g=f.activeCell,M=a.resolveStyle(f.cells[f.cellKey(g.col,g.row)]);return typeof(M==null?void 0:M.numberFormat)=="string"?M.numberFormat:""});function we(O){r.nfDialogOpen.value=O}const Be=t.ref(!1);function rt(){Be.value=!0}function se(O){Be.value=O}function ue(O){p.insertFunctionIntoCell(O)}function Le(){a.editable.value!==!1&&(f.toggleAutoFilter(),v.scheduleRender())}function _e(O){const g=f.getFilter();return g?f.getCellValue(O,g.range.startRow):""}const dt=t.computed(()=>{const O=f.selection,g=O?O.startRow:f.activeCell.row,M=O?O.startCol:f.activeCell.col;return g===0&&M===0});function ht(O){if(a.editable.value===!1)return;const g=f.freeze;if(O==="panes"){const M=f.selection,Mt=M?M.startRow:f.activeCell.row,Nt=M?M.startCol:f.activeCell.col;f.setFreeze(Mt,Nt)}else O==="firstRow"?f.setFreeze(1,g.cols):O==="firstCol"?f.setFreeze(g.rows,1):O==="unfreeze"&&f.clearFreeze();v.scheduleRender()}const T=t.ref(null),ne=t.ref(!1),W=t.ref(!1),F=t.ref(null),_=t.ref("create"),L=t.computed(()=>{const O=f.selection;if(O){const M=Et(O.startCol)+(O.startRow+1),Mt=Et(O.endCol)+(O.endRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?M:`${M}:${Mt}`}const g=f.activeCell;return Et(g.col)+(g.row+1)});function x(O){var Mt;let g;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(O)?g={type:"cellIs",operator:O,value:""}:O==="textContains"?g={type:"textContains",value:""}:O==="textNotContains"?g={type:"textNotContains",value:""}:O==="blank"?g={type:"blank"}:O==="notBlank"?g={type:"notBlank"}:O==="duplicate"?g={type:"duplicate"}:O==="unique"?g={type:"unique"}:g={type:"cellIs",operator:"greaterThan",value:""},F.value={id:"",condition:g,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},_.value="create",(Mt=T.value)==null||Mt.closeOverflow(),W.value=!0}function U(){var O;F.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},_.value="create",(O=T.value)==null||O.closeOverflow(),W.value=!0}function te(){var O;(O=T.value)==null||O.closeOverflow(),ne.value=!0}function ye(O){a.editable.value!==!1&&(f.clearConditionalFormats(O),v.scheduleRender())}function tt(O){a.editable.value!==!1&&(O.id?f.updateConditionalFormatRule(O.id,O):f.addConditionalFormatRule(O),W.value=!1)}function it(O){var g;F.value=O,_.value="edit",(g=T.value)==null||g.closeOverflow(),W.value=!0}function qe(O){a.editable.value!==!1&&f.removeConditionalFormatRule(O)}function yt(O,g){a.editable.value!==!1&&f.moveConditionalFormatRule(O,g)}function He(O,g){a.editable.value!==!1&&f.updateConditionalFormatRule(O,{enabled:g})}const k=t.ref(!1),ee=t.ref(null),wt=t.ref("create"),At=t.computed(()=>{const O=f.selection;if(O){const M=Et(O.startCol)+(O.startRow+1),Mt=Et(O.endCol)+(O.endRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?M:`${M}:${Mt}`}const g=f.activeCell;return Et(g.col)+(g.row+1)}),Lt=t.ref(null);let Ot=null;function Rl(O){return new Promise(g=>{Ot=g,Lt.value={...O}})}a.showValidationAlert=Rl;const sl=t.ref(null);function Ml(O){sl.value=O}function Sl(){sl.value=null}p.showOutlineAlert=Ml,a.getSheetCellsById=O=>{const g=d.sheets.value.findIndex(M=>M.id===O||M.name===O);return g<0?null:g===d.activeSheetIndex.value?a.cells:d.sheets.value[g].cells},a.requestDataValidationDialog=()=>Gt();function Gt(){var M;const O=f.activeCell,g=a.getDataValidationRule(O.row,O.col);ee.value=g?JSON.parse(JSON.stringify(g)):null,wt.value=g?"edit":"create",(M=T.value)==null||M.closeOverflow(),k.value=!0}function cl(O){if(a.editable.value!==!1){if(O.type==="any"){O.ranges.forEach(g=>a.clearDataValidation(g)),k.value=!1,p.scheduleRender();return}O.id?a.updateDataValidation(O.id,O):a.createDataValidation(O),k.value=!1,p.scheduleRender()}}function ol(){if(a.editable.value===!1)return;const O=f.selection;O&&a.clearDataValidation(O),k.value=!1,p.scheduleRender()}function mn(O){Lt.value=null;const g=Ot;Ot=null,t.nextTick(()=>{const M=f.editingCell;M&&(a.selectCell(M.col,M.row),a.ensureVisible(M.col,M.row),p.scheduleRender(),d.focusEditInput())}),g==null||g(O)}const P=t.computed(()=>{const O=f.activeCell,g=a.getValidationInputMessage(O.row,O.col);if(!g)return null;const M=a.cellToScreenRect(O.row,O.col),Mt=d.wrapperRef.value,Nt=Mt?Mt.getBoundingClientRect():{left:0,top:0};return{title:g.title,message:g.message,x:Nt.left+M.x,y:Nt.top+M.y,width:M.width,height:M.height}}),K=t.computed(()=>{const O=p.noteUi.value;if(!O)return null;const g=a.cellToScreenRect(O.row,O.col);return{x:g.x,y:g.y,width:g.width,height:g.height}}),Z=t.computed(()=>{const O=p.noteUi.value;return O?a.getNote(O.row,O.col)??null:null}),ve=t.computed(()=>b(f.locale,"notePlaceholder"));function Fe(O){r.fontSizeMenuOpen.value=O}function Ve(O){r.textColorMenuOpen.value=O}function We(O){r.fillColorMenuOpen.value=O}function Re(O){switch(O){case"group-rows":p.outlineGroupRows();break;case"group-cols":p.outlineGroupCols();break;case"ungroup-rows":p.outlineUngroupRows();break;case"ungroup-cols":p.outlineUngroupCols();break;case"clear-rows":a.clearRowGroups();break;case"clear-cols":a.clearColumnGroups();break;case"expand-rows":p.outlineExpandRows();break;case"expand-cols":p.outlineExpandCols();break;case"collapse-rows":p.outlineCollapseRows();break;case"collapse-cols":p.outlineCollapseCols();break}}function Ue(O){p.renTabVal.value=O}function ke(){p.ctxMenu.value=null}const st=O=>{d.formulaBarRef.value=O};function he(){p.formulaBarExpanded.value=!p.formulaBarExpanded.value}const R=t.ref(null),Y=O=>{d.wrapperRef.value=O,R.value=O},de=O=>{d.canvasRef.value=O},xe=O=>{d.freezeCanvasRef.value=O},Me=O=>{d.editInputRef.value=O},$e=O=>{p.dimInputRef.value=O};return(O,g)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["spreadsheet-outer",{dark:m.value==="dark"}]),style:t.normalizeStyle($.outerStyle)},[t.createVNode(Id,{ref_key:"toolbarRef",ref:T,editable:o.editable,locale:f.locale,"can-undo":w.canUndo,"can-redo":w.canRedo,"paint-fmt-active":w.paintFmt!==null,"has-selection":w.hasSelection,"font-family-options":w.fontFamilyOptions,"font-size-options":w.fontSizeOptions,"sel-font-family":w.selFontFamily,"sel-font-size":w.selFontSize,"font-size-input":w.fontSizeInput,"font-size-menu-open":w.fontSizeMenuOpen,"sel-font-weight":w.selFontWeight,"sel-font-style":w.selFontStyle,"sel-underline":w.selUnderline,"sel-strikethrough":w.selStrikethrough,"sel-text-color":w.selTextColor,"text-color-menu-open":w.textColorMenuOpen,"sel-fill-color":w.selFillColor,"fill-color-menu-open":w.fillColorMenuOpen,"cached-text-color":w.cachedTextColor,"cached-fill-color":w.cachedFillColor,"border-menu-open":S.borderMenuOpen,"cached-border":S.cachedBorder,"cached-border-color":S.cachedBorderColor,"cached-border-line-style":S.cachedBorderLineStyle,"sort-menu-open":t.unref(fe),"cached-sort-order":t.unref(Ce),"can-sort":ze.value,"outline-menu-open":Se.value,"outline-axis":mt.value,"can-filter":Je.value,"filter-active":f.getFilter()!==null,"h-align-options":w.hAlignOptions,"v-align-options":w.vAlignOptions,"sel-h-align":w.selHAlign,"sel-v-align":w.selVAlign,"sel-wrap":w.selWrap,"merge-menu-open":S.mergeMenuOpen,"calc-menu-open":S.calcMenuOpen,"cf-menu-open":be.value,"freeze-menu-open":Ge.value,"font-menu-open":pe.value,"h-align-menu-open":ie.value,"v-align-menu-open":Ne.value,"num-fmt-menu-open":ft.value,"is-single-cell":X.value,"has-freeze":f.freeze.rows>0||f.freeze.cols>0,"freeze-panes-disabled":dt.value,"sel-number-format":w.selNumberFormatDisplay,"nf-options":w.nfOptions,"can-increase-decimals":w.canIncreaseDecimals,"can-decrease-decimals":w.canDecreaseDecimals,"boundary-el":R.value,onUndo:g[0]||(g[0]=M=>w.undo()),onRedo:g[1]||(g[1]=M=>w.redo()),onPaintFormat:w.onPaintFormat,onClearFormat:g[2]||(g[2]=M=>w.clearFormat()),onNumberFormatChange:g[3]||(g[3]=M=>w.onNumberFormatChange(M)),onIncreaseDecimals:w.onIncreaseDecimals,onDecreaseDecimals:w.onDecreaseDecimals,onFontFamilyChange:g[4]||(g[4]=M=>w.onFontFamilyChange(M)),onFontSizeInput:g[5]||(g[5]=M=>w.onFontSizeInput(M)),onFontSizeBlur:w.onFontSizeBlur,onFontSizeKeydown:g[6]||(g[6]=M=>w.onFontSizeKeydown(M)),onFontSizeChange:g[7]||(g[7]=M=>w.onFontSizeChange(M)),"onUpdate:fontSizeMenuOpen":g[8]||(g[8]=M=>Fe(M)),onFontSizeToggle:g[9]||(g[9]=M=>w.toggleFontSizeMenu()),onFontSizeStepUp:w.onFontSizeStepUp,onFontSizeStepDown:w.onFontSizeStepDown,onBoldToggle:w.toggleFontWeight,onItalicToggle:w.toggleFontStyle,onUnderlineToggle:w.toggleUnderline,onStrikethroughToggle:w.toggleStrikethrough,onTextColorChange:g[10]||(g[10]=M=>w.onTextColorChange(M)),"onUpdate:textColorMenuOpen":g[11]||(g[11]=M=>Ve(M)),onFillColorChange:g[12]||(g[12]=M=>w.onFillColorChange(M)),"onUpdate:fillColorMenuOpen":g[13]||(g[13]=M=>We(M)),onApplyTextColor:w.applyCachedTextColor,onApplyFillColor:w.applyCachedFillColor,"onUpdate:borderMenuOpen":g[14]||(g[14]=M=>w.onBorderMenuToggle(M)),onBorderChange:g[15]||(g[15]=M=>S.onBorderChange(M)),onBorderColorChange:g[16]||(g[16]=M=>S.onBorderColorChange(M)),onBorderLineStyleChange:g[17]||(g[17]=M=>S.onBorderLineStyleChange(M)),onApplyBorder:S.applyCachedBorder,"onUpdate:sortMenuOpen":g[18]||(g[18]=M=>$.onSortMenuToggle(M)),onSortChange:g[19]||(g[19]=M=>$.onSortChange(M)),onApplySort:$.applyCachedSort,"onUpdate:outlineMenuOpen":g[20]||(g[20]=M=>Se.value=M),onOutlineAction:g[21]||(g[21]=M=>Re(M)),onToggleFilter:Le,onFreezeChange:g[22]||(g[22]=M=>ht(M)),onHAlignChange:g[23]||(g[23]=M=>w.onHAlignChange(M)),onVAlignChange:g[24]||(g[24]=M=>w.onVAlignChange(M)),onWrapToggle:w.onWrapToggle,"onUpdate:mergeMenuOpen":g[25]||(g[25]=M=>S.onMergeMenuToggle(M)),onMergeChange:g[26]||(g[26]=M=>S.onMergeChange(M)),onApplyMerge:S.onApplyMerge,"onUpdate:calcMenuOpen":g[27]||(g[27]=M=>S.onCalcMenuToggle(M)),"onUpdate:cfMenuOpen":g[28]||(g[28]=M=>be.value=M),"onUpdate:freezeMenuOpen":g[29]||(g[29]=M=>Ge.value=M),"onUpdate:fontMenuOpen":g[30]||(g[30]=M=>pe.value=M),"onUpdate:hAlignMenuOpen":g[31]||(g[31]=M=>ie.value=M),"onUpdate:vAlignMenuOpen":g[32]||(g[32]=M=>Ne.value=M),"onUpdate:numFmtMenuOpen":g[33]||(g[33]=M=>ft.value=M),onCalcSum:S.onCalcSum,onCalcAvg:S.onCalcAvg,onCalcCount:S.onCalcCount,onFind:g[34]||(g[34]=M=>t.unref(B).openFind()),onCfPreset:g[35]||(g[35]=M=>x(M)),onCfNewRule:U,onCfManage:te,onCfClear:g[36]||(g[36]=M=>ye(M)),onOpenDataValidation:Gt},null,8,["editable","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","cached-border-color","cached-border-line-style","sort-menu-open","cached-sort-order","can-sort","outline-menu-open","outline-axis","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","cf-menu-open","freeze-menu-open","font-menu-open","h-align-menu-open","v-align-menu-open","num-fmt-menu-open","is-single-cell","has-freeze","freeze-panes-disabled","sel-number-format","nf-options","can-increase-decimals","can-decrease-decimals","boundary-el","onPaintFormat","onIncreaseDecimals","onDecreaseDecimals","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(du,{open:A.open,editable:o.editable,"find-text":A.findText,"replace-text":A.replaceText,scope:A.scope,"match-case":A.matchCase,"match-entire-cell":A.matchEntireCell,"current-index":A.currentIndex,total:A.results.length,message:A.message,"focus-token":A.focusToken,locale:f.locale,"onUpdate:findText":g[37]||(g[37]=M=>t.unref(B).findText.value=M),"onUpdate:replaceText":g[38]||(g[38]=M=>t.unref(B).replaceText.value=M),"onUpdate:scope":g[39]||(g[39]=M=>t.unref(B).scope.value=M),"onUpdate:matchCase":g[40]||(g[40]=M=>t.unref(B).matchCase.value=M),"onUpdate:matchEntireCell":g[41]||(g[41]=M=>t.unref(B).matchEntireCell.value=M),onPrev:g[42]||(g[42]=M=>t.unref(B).findPrev()),onNext:g[43]||(g[43]=M=>t.unref(B).findNext()),onReplace:g[44]||(g[44]=M=>t.unref(B).replace()),onReplaceAll:g[45]||(g[45]=M=>t.unref(B).replaceAll()),onClose:g[46]||(g[46]=M=>t.unref(B).close())},null,8,["open","editable","find-text","replace-text","scope","match-case","match-entire-cell","current-index","total","message","focus-token","locale"]),t.createVNode(zu,{"model-open":w.nfDialogOpen,editable:o.editable,locale:f.locale,"current-format":oe.value,"is-custom":w.selNumberFormat===t.unref(cn),"onUpdate:modelOpen":g[47]||(g[47]=M=>we(M)),onApply:g[48]||(g[48]=M=>w.applyNumberFormatCode(M))},null,8,["model-open","editable","locale","current-format","is-custom"]),t.createVNode(Yu,{"model-open":$.sortConfirmOpen,editable:o.editable,locale:f.locale,"onUpdate:modelOpen":g[49]||(g[49]=M=>$.sortConfirmOpen=M),onConfirm:g[50]||(g[50]=M=>$.confirmSort(M)),onCancel:g[51]||(g[51]=M=>$.cancelSortConfirmation())},null,8,["model-open","editable","locale"]),t.createVNode(mf,{"model-open":Be.value,editable:o.editable,locale:f.locale,"onUpdate:modelOpen":g[52]||(g[52]=M=>se(M)),onInsert:g[53]||(g[53]=M=>ue(M))},null,8,["model-open","editable","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":v.formulaBarExpanded}])},[t.createElementVNode("div",Hp,t.toDisplayString(v.activeCellLabel),1),o.editable?(t.openBlock(),t.createElementBlock("div",Wp,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:t.unref(b)(f.locale,"formulaBarCancel"),"aria-label":t.unref(b)(f.locale,"cancel"),onMousedown:g[54]||(g[54]=t.withModifiers(()=>{},["prevent"])),onClick:g[55]||(g[55]=t.withModifiers((...M)=>v.cancelFormulaBarEdit&&v.cancelFormulaBarEdit(...M),["stop"]))},[...g[118]||(g[118]=[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)])],40,Up),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:t.unref(b)(f.locale,"formulaBarAccept"),"aria-label":t.unref(b)(f.locale,"accept"),onMousedown:g[56]||(g[56]=t.withModifiers(()=>{},["prevent"])),onClick:g[57]||(g[57]=t.withModifiers((...M)=>v.acceptFormulaBarEdit&&v.acceptFormulaBarEdit(...M),["stop"]))},[...g[119]||(g[119]=[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)])],40,Pp),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(b)(f.locale,"insertFunctionTitle"),"aria-label":t.unref(b)(f.locale,"insertFunctionTitle"),onMousedown:g[58]||(g[58]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(rt,["stop"])},[...g[120]||(g[120]=[t.createElementVNode("svg",{class:"formula-bar__fx-icon",width:"16",height:"16",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[t.createElementVNode("path",{fill:"currentColor",d:"M841 370c3-3.3 2.7-8.3-0.6-11.3-1.5-1.3-3.4-2.1-5.3-2.1h-72.6c-2.4 0-4.6 1-6.1 2.8L633.5 504.6c-2.9 3.4-7.9 3.8-11.3 0.9-0.9-0.8-1.6-1.7-2.1-2.8l-63.5-141.3c-1.3-2.9-4.1-4.7-7.3-4.7H380.7l0.9-4.7 8-42.3c10.5-55.4 38-81.4 85.8-81.4 18.6 0 35.5 1.7 48.8 4.7l14.1-66.8c-22.6-4.7-35.2-6.1-54.9-6.1-103.3 0-156.4 44.3-175.9 147.3l-9.4 49.4h-97.6c-3.8 0-7.1 2.7-7.8 6.4L181.9 415c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H284l-89 429.9c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H269c3.8 0 7.1-2.7 7.8-6.4l89.7-433.1h135.8l68.2 139.1c1.4 2.9 1 6.4-1.2 8.8l-180.6 203c-2.9 3.3-2.6 8.4 0.7 11.3 1.5 1.3 3.4 2 5.3 2h72.7c2.4 0 4.6-1 6.1-2.8l123.7-146.7c2.8-3.4 7.9-3.8 11.3-1 0.9 0.8 1.6 1.7 2.1 2.8L676.4 784c1.3 2.8 4.1 4.7 7.3 4.7h64.6c4.4 0 8-3.6 8-8 0-1.2-0.3-2.4-0.8-3.5l-95.2-198.9c-1.4-2.9-0.9-6.4 1.3-8.8L841 370z"})],-1)])],40,Kp)])):t.createCommentVNode("",!0),t.createElementVNode("textarea",{ref:st,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":v.formulaBarExpanded}]),rows:v.formulaBarExpanded?3:1,value:v.formulaBarDisplay,readonly:!o.editable,spellcheck:"false",onFocus:g[59]||(g[59]=(...M)=>v.onFormulaBarFocus&&v.onFormulaBarFocus(...M)),onInput:g[60]||(g[60]=(...M)=>v.onFormulaBarInput&&v.onFormulaBarInput(...M)),onKeydown:g[61]||(g[61]=(...M)=>v.onFormulaBarKeydown&&v.onFormulaBarKeydown(...M)),onBlur:g[62]||(g[62]=(...M)=>v.onFormulaBarBlur&&v.onFormulaBarBlur(...M))},null,42,Gp),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:t.unref(b)(f.locale,v.formulaBarExpanded?"formulaBarCollapse":"formulaBarExpand"),onMousedown:g[63]||(g[63]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(he,["stop"])},[v.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",jp,[...g[122]||(g[122]=[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",Yp,[...g[121]||(g[121]=[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,qp)],2),t.createElementVNode("div",{ref:Y,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:de,class:"grid-canvas",tabindex:"0",onMousedown:g[64]||(g[64]=(...M)=>v.onMouseDown&&v.onMouseDown(...M)),onMousemove:g[65]||(g[65]=(...M)=>v.onMouseMove&&v.onMouseMove(...M)),onMouseup:g[66]||(g[66]=(...M)=>v.onMouseUp&&v.onMouseUp(...M)),onMouseleave:g[67]||(g[67]=(...M)=>v.onMouseLeave&&v.onMouseLeave(...M)),onDblclick:g[68]||(g[68]=(...M)=>v.onDblClick&&v.onDblClick(...M)),onWheel:g[69]||(g[69]=t.withModifiers((...M)=>v.onWheel&&v.onWheel(...M),["prevent"])),onFocus:g[70]||(g[70]=(...M)=>$.onCanvasFocus&&$.onCanvasFocus(...M)),onKeydown:g[71]||(g[71]=(...M)=>v.onKeydown&&v.onKeydown(...M)),onContextmenu:g[72]||(g[72]=(...M)=>v.onCanvasCtx&&v.onCanvasCtx(...M)),onTouchstart:g[73]||(g[73]=t.withModifiers((...M)=>v.onTouchStart&&v.onTouchStart(...M),["prevent"])),onTouchmove:g[74]||(g[74]=t.withModifiers((...M)=>v.onTouchMove&&v.onTouchMove(...M),["prevent"])),onTouchend:g[75]||(g[75]=(...M)=>v.onTouchEnd&&v.onTouchEnd(...M))},null,32),t.createElementVNode("canvas",{ref:xe,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:Me,class:"cell-editor",value:f.editValue,style:t.normalizeStyle(v.editInputStyle),onInput:g[76]||(g[76]=(...M)=>v.onEditInput&&v.onEditInput(...M)),onKeydown:g[77]||(g[77]=(...M)=>v.onEditKd&&v.onEditKd(...M)),onCompositionstart:g[78]||(g[78]=(...M)=>v.onEditCompositionStart&&v.onEditCompositionStart(...M)),onCompositionend:g[79]||(g[79]=(...M)=>v.onEditCompositionEnd&&v.onEditCompositionEnd(...M)),onBlur:g[80]||(g[80]=(...M)=>v.onEditBlur&&v.onEditBlur(...M)),onPaste:g[81]||(g[81]=(...M)=>v.onEditPaste&&v.onEditPaste(...M))},null,44,Xp),$.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:v.vScrollbarTop+"px",height:`calc(100% - ${v.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:g[82]||(g[82]=t.withModifiers(M=>{$.clampScroll(null,f.scrollY-50),v.scheduleRender()},["prevent"]))},[...g[123]||(g[123]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:g[84]||(g[84]=(...M)=>v.onVTrk&&v.onVTrk(...M))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:v.vThumbT+"px",height:v.vThumbH+"px"}),onMousedown:g[83]||(g[83]=(...M)=>v.onVStart&&v.onVStart(...M))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:g[85]||(g[85]=t.withModifiers(M=>{$.clampScroll(null,f.scrollY+50),v.scheduleRender()},["prevent"]))},[...g[124]||(g[124]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),$.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:v.hScrollbarLeft+"px",width:`calc(100% - ${v.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:g[86]||(g[86]=t.withModifiers(M=>{$.clampScroll(f.scrollX-50,null),v.scheduleRender()},["prevent"]))},[...g[125]||(g[125]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:g[88]||(g[88]=(...M)=>v.onHTrk&&v.onHTrk(...M))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:v.hThumbL+"px",width:v.hThumbW+"px"}),onMousedown:g[87]||(g[87]=(...M)=>v.onHStart&&v.onHStart(...M))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:g[89]||(g[89]=t.withModifiers(M=>{$.clampScroll(f.scrollX+50,null),v.scheduleRender()},["prevent"]))},[...g[126]||(g[126]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),$.maxScrollX>0&&$.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Zp)):t.createCommentVNode("",!0),v.noteUi&&K.value?(t.openBlock(),t.createBlock(M1,{key:3,anchor:K.value,mode:v.noteUi.mode,note:Z.value,author:o.noteAuthor,locale:f.locale,placeholder:ve.value,"boundary-el":R.value,onSave:g[90]||(g[90]=M=>t.unref(p).saveNoteAt(v.noteUi.row,v.noteUi.col,M,o.noteAuthor)),onDelete:g[91]||(g[91]=M=>t.unref(p).removeNoteAt(v.noteUi.row,v.noteUi.col)),onClose:g[92]||(g[92]=M=>t.unref(p).closeNote())},null,8,["anchor","mode","note","author","locale","placeholder","boundary-el"])):t.createCommentVNode("",!0)]),t.createVNode(Yd,{locale:f.locale,sheets:t.unref(q),"active-sheet-index":t.unref(ae),"ren-tab":v.renTab,"ren-tab-val":v.renTabVal,"boundary-el":R.value,editable:o.editable,onTabClick:g[93]||(g[93]=M=>v.onTabClick(M)),onTabDblclick:g[94]||(g[94]=M=>v.onTabDblClick(M)),onTabContextmenu:g[95]||(g[95]=M=>v.onTabCtxMenu(M.ev,M.i)),onTabRenameInput:g[96]||(g[96]=M=>Ue(M)),onTabRenameKeydown:g[97]||(g[97]=M=>v.onTabRenameKd(M)),onTabRenameCommit:v.commitTabRename,onTabbarContextmenu:g[98]||(g[98]=M=>v.onTabBarCtx(M)),onDeleteSheet:g[99]||(g[99]=M=>{$.removeSheet(M),v.scheduleRender()}),onAddSheet:g[100]||(g[100]=M=>{$.addSheet(),v.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","boundary-el","editable","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[v.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["context-menu sp-spreader-overlay",{dark:m.value==="dark"}]),style:t.normalizeStyle({left:v.ctxMenu.x+"px",top:v.ctxMenu.y+"px"}),onClick:g[101]||(g[101]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.ctxMenu.items,(M,Mt)=>(t.openBlock(),t.createElementBlock("div",{key:Mt,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":M.disabled}]),onClick:Nt=>!M.disabled&&M.action&&(M.action(),ke()),onMouseenter:Nt=>v.onCtxItemEnter(Nt,M)},[t.createElementVNode("span",Qp,t.toDisplayString(M.label),1),M.children?(t.openBlock(),t.createElementBlock("svg",e2,[...g[127]||(g[127]=[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),M.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":v.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.children,(Nt,qt)=>(t.openBlock(),t.createElementBlock("div",{key:qt,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":Nt.disabled}]),onClick:t.withModifiers(Ht=>!Nt.disabled&&Nt.action&&(Nt.action(),ke()),["stop"])},t.toDisplayString(Nt.label),11,t2))),128))],2)):t.createCommentVNode("",!0)],42,Jp))),128))],6)):t.createCommentVNode("",!0)]),_:1})])),v.filterPopup?(t.openBlock(),t.createBlock(_f,{key:v.filterPopup.col,col:v.filterPopup.col,"header-label":_e(v.filterPopup.col),anchor:{x:v.filterPopup.x,y:v.filterPopup.y},locale:f.locale,"get-filter":f.getFilter,"set-filter":f.setFilter,"set-filter-column":f.setFilterColumn,"clear-filter-column":f.clearFilterColumn,"get-column-candidates":f.getColumnCandidates,close:v.closeFilterPopup,"boundary-el":R.value},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close","boundary-el"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ne.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-modal-mask sp-spreader-overlay",{dark:m.value==="dark"}]),onClick:g[103]||(g[103]=t.withModifiers(M=>ne.value=!1,["self"]))},[t.createVNode(nm,{locale:f.locale,editable:o.editable,rules:f.conditionalFormats,onNew:U,onEdit:it,onDelete:qe,onMove:yt,onToggle:He,onClose:g[102]||(g[102]=M=>ne.value=!1)},null,8,["locale","editable","rules"])],2)):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[W.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-modal-mask sp-spreader-overlay",{dark:m.value==="dark"}]),onClick:g[105]||(g[105]=t.withModifiers(M=>W.value=!1,["self"]))},[t.createVNode(Pm,{locale:f.locale,editable:o.editable,mode:_.value,rule:F.value,"default-range-text":L.value,onSave:tt,onCancel:g[104]||(g[104]=M=>W.value=!1)},null,8,["locale","editable","mode","rule","default-range-text"])],2)):t.createCommentVNode("",!0)])),v.validationDropdown?(t.openBlock(),t.createBlock(o1,{key:`${v.validationDropdown.col},${v.validationDropdown.row}`,items:v.validationDropdown.items,current:v.validationDropdown.current,locale:f.locale,x:v.validationDropdown.x,y:v.validationDropdown.y,width:v.validationDropdown.width,height:v.validationDropdown.height,"boundary-el":R.value,onSelect:g[106]||(g[106]=M=>t.unref(p).onValidationDropdownSelect(M)),onClose:g[107]||(g[107]=M=>t.unref(p).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height","boundary-el"])):t.createCommentVNode("",!0),P.value?(t.openBlock(),t.createBlock(g1,{key:2,title:P.value.title,message:P.value.message,x:P.value.x,y:P.value.y,width:P.value.width,height:P.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-modal-mask sp-spreader-overlay",{dark:m.value==="dark"}]),onClick:g[109]||(g[109]=t.withModifiers(M=>k.value=!1,["self"]))},[t.createVNode(j0,{locale:f.locale,editable:o.editable,mode:wt.value,rule:ee.value,"default-range-text":At.value,onSave:cl,onClear:ol,onCancel:g[108]||(g[108]=M=>k.value=!1)},null,8,["locale","editable","mode","rule","default-range-text"])],2)):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Lt.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-modal-mask sp-spreader-overlay",{dark:m.value==="dark"}])},[t.createVNode(Oa,{locale:f.locale,severity:Lt.value.severity,title:Lt.value.title,message:Lt.value.message,onResolve:mn},null,8,["locale","severity","title","message"])],2)):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[sl.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-modal-mask sp-spreader-overlay",{dark:m.value==="dark"}])},[t.createVNode(Oa,{locale:f.locale,severity:"information",title:t.unref(b)(f.locale,"outlineAlertTitle"),message:sl.value,onResolve:Sl},null,8,["locale","title","message"])],2)):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[v.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["dim-panel sp-spreader-overlay",{dark:m.value==="dark"}]),style:t.normalizeStyle({left:v.dimPanel.x+"px",top:v.dimPanel.y+"px"}),onMousedown:g[115]||(g[115]=t.withModifiers(()=>{},["stop"])),onTouchstart:g[116]||(g[116]=t.withModifiers(()=>{},["stop"])),onClick:g[117]||(g[117]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",l2,t.toDisplayString(v.dimPanel.type==="row"?t.unref(b)(f.locale,"rowHeight"):t.unref(b)(f.locale,"colWidth")),1),t.createElementVNode("div",n2,[t.createElementVNode("input",{ref:$e,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":v.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:v.dimPanel.value,onInput:g[110]||(g[110]=(...M)=>v.onDimInput&&v.onDimInput(...M)),onKeydown:g[111]||(g[111]=(...M)=>v.onDimKeydown&&v.onDimKeydown(...M)),onBlur:g[112]||(g[112]=(...M)=>v.onDimBlur&&v.onDimBlur(...M))},null,42,o2)]),v.dimPanel.error?(t.openBlock(),t.createElementBlock("div",r2,t.toDisplayString(v.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",a2,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:g[113]||(g[113]=(...M)=>v.applyDimPanel&&v.applyDimPanel(...M))},t.toDisplayString(t.unref(b)(f.locale,"ok")),1),t.createElementVNode("button",{class:"dim-panel__btn",onClick:g[114]||(g[114]=(...M)=>v.closeDimPanel&&v.closeDimPanel(...M))},t.toDisplayString(t.unref(b)(f.locale,"cancel")),1)])],38)):t.createCommentVNode("",!0)]),_:1})]))],6))}}),[["__scopeId","data-v-e4748e40"]]);En.Spreader=Ri,En.default=Ri,Object.defineProperties(En,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|